From 0b6c71f688b6e8d2c067f943879099a554e88728 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 11 Oct 2016 11:17:38 +0100 Subject: [PATCH 1/6] Patch Ace to fix accent key problem in Chrome --- services/web/public/js/ace-1.2.5/ace.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index 2b601cc9b9..713f82c218 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -34,6 +34,14 @@ * @param payload a function to call with (require, exports, module) params */ +// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. +// https://github.com/ajaxorg/ace/issues/3045 +var isChrome53PlusMatched = navigator.userAgent.match(/Chrome\/(.*?)(.|\s+|$)/); +var isChrome53Plus = false; +if (isChrome53PlusMatched) { + isChrome53Plus = isChrome53PlusMatched[1] >= 53; +} + (function() { var ACE_NAMESPACE = "ace"; @@ -2283,6 +2291,9 @@ var TextInput = function(parentNode, host) { if (e.type == "compositionend" && c.range) { host.selection.setRange(c.range); } + // WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. + // https://github.com/ajaxorg/ace/issues/3045 + if (isChrome53Plus) onInput(); }; From e26eda57540e779f762fff35bde824c85b4cdca4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 11 Oct 2016 11:34:33 +0100 Subject: [PATCH 2/6] Update regex to grab Chrome version. --- services/web/public/js/ace-1.2.5/ace.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index 713f82c218..aeef9f6a85 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -34,16 +34,7 @@ * @param payload a function to call with (require, exports, module) params */ -// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. -// https://github.com/ajaxorg/ace/issues/3045 -var isChrome53PlusMatched = navigator.userAgent.match(/Chrome\/(.*?)(.|\s+|$)/); -var isChrome53Plus = false; -if (isChrome53PlusMatched) { - isChrome53Plus = isChrome53PlusMatched[1] >= 53; -} - (function() { - var ACE_NAMESPACE = "ace"; var global = (function() { return this; })(); @@ -1927,6 +1918,11 @@ var lang = require("../lib/lang"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; +// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. +// https://github.com/ajaxorg/ace/issues/3045 +var chromeVersion = navigator.userAgent.match(/Chrome\/(\d*)/)[1]; +var isChrome53Plus = (chromeVersion >= 53); + var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); text.className = "ace_text-input"; From 0fbbad33ffa0dbde4c468e4a50c286c58e500aae Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 11 Oct 2016 11:40:26 +0100 Subject: [PATCH 3/6] Use built in Ace browser detection --- services/web/public/js/ace-1.2.5/ace.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index aeef9f6a85..89bef3543d 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -35,6 +35,7 @@ */ (function() { + var ACE_NAMESPACE = "ace"; var global = (function() { return this; })(); @@ -1918,11 +1919,6 @@ var lang = require("../lib/lang"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; -// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. -// https://github.com/ajaxorg/ace/issues/3045 -var chromeVersion = navigator.userAgent.match(/Chrome\/(\d*)/)[1]; -var isChrome53Plus = (chromeVersion >= 53); - var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); text.className = "ace_text-input"; @@ -2289,7 +2285,7 @@ var TextInput = function(parentNode, host) { } // WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. // https://github.com/ajaxorg/ace/issues/3045 - if (isChrome53Plus) onInput(); + if (useragent.isChrome >= 53) onInput(); }; From 380487abf07ab2e93ace6d37c80a5a486a14dd71 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 11 Oct 2016 14:30:27 +0100 Subject: [PATCH 4/6] use separate jade template block for requirejs removes the need to suppressDefaultJs --- services/web/app/views/layout.jade | 34 ++++++++----------- services/web/app/views/project/editor.jade | 10 ++---- .../subscriptions/edit-billing-details.jade | 5 ++- services/web/app/views/subscriptions/new.jade | 6 +--- 4 files changed, 21 insertions(+), 34 deletions(-) diff --git a/services/web/app/views/layout.jade b/services/web/app/views/layout.jade index 4d16b98c29..7f5cfd891f 100644 --- a/services/web/app/views/layout.jade +++ b/services/web/app/views/layout.jade @@ -52,6 +52,7 @@ html(itemscope, itemtype='http://schema.org/Product') window.csrfToken = "#{csrfToken}"; block scripts + script(src=buildJsPath("libs/jquery-1.11.1.min.js", {fingerprint:false})) script(type="text/javascript"). var noCdnKey = "nocdn=true" @@ -109,41 +110,36 @@ html(itemscope, itemtype='http://schema.org/Product') - if(typeof(suppressNavbar) == "undefined") include layout/navbar - script(type='text/javascript'). - // minimal requirejs configuration (can be extended/overridden) - window.requirejs = { - "paths" : { - "moment": "libs/#{lib('moment')}" - }, - "config":{ - "moment":{ - "noGlobal": true - } - } - }; - block content + div(ng-controller="AbTestController") - if(typeof(suppressFooter) == "undefined") include layout/footer - - - if (typeof(lookingForScribtex) != "undefined" && lookingForScribtex) span(ng-controller="ScribtexPopupController") include scribtex-modal - - if(typeof(suppressDefaultJs) == "undefined") + block requirejs script(type='text/javascript'). - // extend requirejs config - window.requirejs.urlArgs = "fingerprint=#{fingerprint(jsPath + 'main.js')}-#{fingerprint(jsPath + 'libs.js')}" + // minimal requirejs configuration (can be extended/overridden) + window.requirejs = { + "paths" : { + "moment": "libs/#{lib('moment')}" + }, + "urlArgs": "fingerprint=#{fingerprint(jsPath + 'main.js')}-#{fingerprint(jsPath + 'libs.js')}", + "config":{ + "moment":{ + "noGlobal": true + } + } + }; script( data-main=buildJsPath('main.js', {fingerprint:false}), baseurl=fullJsPath, src=buildJsPath('libs/require.js') ) - include contact-us-modal include sentry diff --git a/services/web/app/views/project/editor.jade b/services/web/app/views/project/editor.jade index bc8016dd86..298f02268e 100644 --- a/services/web/app/views/project/editor.jade +++ b/services/web/app/views/project/editor.jade @@ -3,7 +3,6 @@ extends ../layout block vars - var suppressNavbar = true - var suppressFooter = true - - var suppressDefaultJs = true - var suppressSystemMessages = true block content @@ -86,8 +85,8 @@ block content .modal-footer button.btn.btn-info(ng-click="done()") #{translate("ok")} - script(src='/socket.io/socket.io.js') - +block requirejs + script(type="text/javascript" src='/socket.io/socket.io.js') //- We need to do .replace(/\//g, '\\/') do that '' -> '<\/script>' //- and doesn't prematurely end the script tag. script(type='text/javascript'). @@ -126,8 +125,6 @@ block content }; window.aceFingerprint = "#{fingerprint(jsPath + lib('ace') + '/ace.js')}" - - locals.suppressDefaultJs = true - - var pdfPath = "libs/" + lib('pdfjs') + "/pdf.worker.js" - var fingerprintedPath = fingerprint(jsPath+pdfPath) - var pdfJsWorkerPath = buildJsPath(pdfPath, {cdn:false,qs:{fingerprint:fingerprintedPath}}) // don't use worker for cdn @@ -144,5 +141,4 @@ block content src=buildJsPath('libs/require.js') ) - - + \ No newline at end of file diff --git a/services/web/app/views/subscriptions/edit-billing-details.jade b/services/web/app/views/subscriptions/edit-billing-details.jade index 6c13985cfe..cc41e0a4b9 100644 --- a/services/web/app/views/subscriptions/edit-billing-details.jade +++ b/services/web/app/views/subscriptions/edit-billing-details.jade @@ -1,10 +1,9 @@ extends ../layout -block content - - locals.suppressDefaultJs = true - script(data-main=jsPath+'main.js', src=jsPath+'libs/require.js', baseurl=jsPath) +block scripts script(src=buildJsPath('libs/recurly.min.js', {fingerprint:false})) +block content .content.content-alt .container .row diff --git a/services/web/app/views/subscriptions/new.jade b/services/web/app/views/subscriptions/new.jade index 691efdf7f6..4bd75574b1 100644 --- a/services/web/app/views/subscriptions/new.jade +++ b/services/web/app/views/subscriptions/new.jade @@ -1,6 +1,6 @@ extends ../layout -block scripts +block scripts script(src="https://js.recurly.com/v3/recurly.js") script(type='text/javascript'). @@ -11,10 +11,6 @@ block scripts window.couponCode = "#{couponCode}" block content - - locals.suppressDefaultJs = true - script(data-main=jsPath+'main.js', src=jsPath+'libs/require.js', baseurl=jsPath) - - .content.content-alt .container(ng-controller="NewSubscriptionController" ng-cloak) .row.card-group From 8fcc58495e45f7433fb55b9d0340d2d9f7de452b Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 11 Oct 2016 14:34:30 +0100 Subject: [PATCH 5/6] Use a new key for the delete-account warning --- services/web/app/views/user/settings.jade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/web/app/views/user/settings.jade b/services/web/app/views/user/settings.jade index 2e17eb1888..d2fa8326d1 100644 --- a/services/web/app/views/user/settings.jade +++ b/services/web/app/views/user/settings.jade @@ -151,7 +151,7 @@ block content .modal-header h3 #{translate("delete_account")} .modal-body - p !{translate("delete_account_warning_message")} + p !{translate("delete_account_warning_message_2")} form(novalidate, name="deleteAccountForm") input.form-control( type="text", From bf0fba2c89417c0618eeb6d73c8fb23dc45b708b Mon Sep 17 00:00:00 2001 From: James Allen Date: Wed, 12 Oct 2016 09:52:15 +0100 Subject: [PATCH 6/6] Minify correct version of Ace --- services/web/Gruntfile.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/Gruntfile.coffee b/services/web/Gruntfile.coffee index 3e7c187d8d..374e7659c0 100644 --- a/services/web/Gruntfile.coffee +++ b/services/web/Gruntfile.coffee @@ -161,6 +161,7 @@ module.exports = (grunt) -> "moment": "libs/#{PackageVersions.lib('moment')}" "mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML" "libs/pdf": "libs/#{PackageVersions.lib('pdfjs')}/pdf" + "ace": "#{PackageVersions.lib('ace')}" shim: "libs/pdf": deps: ["libs/#{PackageVersions.lib('pdfjs')}/compatibility"]