Skip to content

Commit 624873d

Browse files
author
Martii
committed
Move and duplicate Raw Source button to Source Code pages
* Should cut down on the number of scripts posted to libs that are UserScripts by removing any semblence of install button on main script homepage * Allows raw source to be handled externally... I have been working with portable devices and I can't find any reason to not start out in edit mode with Ace other than this... this makes more logistical sense anyhow imho. * Use empty URI fragment to ensure .user.js engine doesn't trigger install dialog for UserScripts... doesn't matter right now for libraries so omitting... could modify the mime-type but then other feature of updating without install count increment could be affected. Applies to #150, #243 and closes #169
1 parent c4ab8b4 commit 624873d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

controllers/user.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,8 @@ exports.editScript = function (aReq, aRes, aNext) {
12811281
script.installNameSlug = installNameSlug;
12821282
script.scriptPermalinkInstallPageUrl = 'https://' + aReq.get('host') +
12831283
script.scriptInstallPageUrl;
1284+
script.scriptRawPageUrl = '/src/' + (isLib ? 'libs' : 'scripts') + '/'
1285+
+ installNameSlug + (isLib ? '.js' : '.user.js#');
12841286

12851287
// Page metadata
12861288
pageMetadata(options);

views/includes/scriptPageHeader.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<h2 class="page-heading">
22
{{#isScriptPage}}
3-
<a href="{{{script.scriptInstallPageUrl}}}" class="btn btn-info pull-right">
4-
{{#script.isLib}}
5-
<i class="fa fa-file-text-o"></i> Raw Source
6-
{{/script.isLib}}
73
{{^script.isLib}}
8-
<i class="fa fa-download"></i> Install
4+
<a href="{{{script.scriptInstallPageUrl}}}" class="btn btn-info pull-right">
5+
<i class="fa fa-download"></i> Install
6+
</a>
97
{{/script.isLib}}
10-
</a>
118
{{/isScriptPage}}
9+
{{#isScriptViewSourcePage}}
10+
<a href="{{{script.scriptRawPageUrl}}}" class="btn btn-info pull-right">
11+
<i class="fa fa-file-text-o"></i> Raw Source
12+
</a>
13+
{{/isScriptViewSourcePage}}
1214
{{#script.icon45Url}}
1315
<span class="page-heading-icon" {{#script.icon45Url}}data-icon-src="{{{script.icon45Url}}}"{{/script.icon45Url}}>
1416
{{#script.isLib}}<i class="fa fa-fw fa-file-excel-o"></i>{{/script.isLib}}{{^script.isLib}}<i class="fa fa-fw fa-file-code-o"></i>{{/script.isLib}}

0 commit comments

Comments
 (0)