diff options
-rw-r--r-- | app/assets/javascripts/dispatcher.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 1a791395d6f..66d558ee262 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -59,22 +59,23 @@ const ShortcutsBlob = require('./shortcuts_blob'); var Dispatcher; $(function() { - return new Dispatcher(); + const page = $('body').attr('data-page'); + + if (!page) return; + + new Dispatcher(page); }); Dispatcher = (function() { - function Dispatcher() { + function Dispatcher(page) { this.initSearch(); this.initFieldErrors(); - this.initPageScripts(); + this.initPageScripts(page); } - Dispatcher.prototype.initPageScripts = function() { - var page, path, shortcut_handler, fileBlobPermalinkUrlElement, fileBlobPermalinkUrl; - page = $('body').attr('data-page'); - if (!page) { - return false; - } + Dispatcher.prototype.initPageScripts = function(page) { + var path, shortcut_handler, fileBlobPermalinkUrlElement, fileBlobPermalinkUrl; + path = page.split(':'); shortcut_handler = null; |