From 624873de05b5ce8a1eafac228c48af0f75366e3b Mon Sep 17 00:00:00 2001 From: Martii Date: Thu, 30 Apr 2015 14:15:26 -0600 Subject: [PATCH] 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 --- controllers/user.js | 2 ++ views/includes/scriptPageHeader.html | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/controllers/user.js b/controllers/user.js index 8d245158e..a5b5639f9 100644 --- a/controllers/user.js +++ b/controllers/user.js @@ -1281,6 +1281,8 @@ exports.editScript = function (aReq, aRes, aNext) { script.installNameSlug = installNameSlug; script.scriptPermalinkInstallPageUrl = 'https://' + aReq.get('host') + script.scriptInstallPageUrl; + script.scriptRawPageUrl = '/src/' + (isLib ? 'libs' : 'scripts') + '/' + + installNameSlug + (isLib ? '.js' : '.user.js#'); // Page metadata pageMetadata(options); diff --git a/views/includes/scriptPageHeader.html b/views/includes/scriptPageHeader.html index 416e827ba..2d0808eac 100644 --- a/views/includes/scriptPageHeader.html +++ b/views/includes/scriptPageHeader.html @@ -1,14 +1,16 @@

{{#isScriptPage}} - - {{#script.isLib}} - Raw Source - {{/script.isLib}} {{^script.isLib}} - Install + + Install + {{/script.isLib}} - {{/isScriptPage}} + {{#isScriptViewSourcePage}} + + Raw Source + + {{/isScriptViewSourcePage}} {{#script.icon45Url}} {{#script.isLib}}{{/script.isLib}}{{^script.isLib}}{{/script.isLib}}