From 79fee3bb45110d75bf0fea21906bcf1a9768b2a8 Mon Sep 17 00:00:00 2001 From: jsherman Date: Sat, 24 Dec 2016 11:49:55 -0500 Subject: [PATCH] Fix: added _isHTML(path) condition to content loading at HTMLServer.js:151 --- .../default/bramble/nohost/HTMLServer.js | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/extensions/default/bramble/nohost/HTMLServer.js b/src/extensions/default/bramble/nohost/HTMLServer.js index b6b7468219c..f00c72d90c3 100644 --- a/src/extensions/default/bramble/nohost/HTMLServer.js +++ b/src/extensions/default/bramble/nohost/HTMLServer.js @@ -148,23 +148,25 @@ define(function (require, exports, module) { return callback(err); } - // Since we're not instrumenting this doc fully for some reason, - // at least inject the scroll manager so we can track scroll position. - var scripts = MouseManager.getRemoteScript(path) + LinkManager.getRemoteScript(); - var scriptsWithEndTag = scripts + "$&"; - var headRegex = new RegExp(/<\/\s*head>/); - var htmlRegex = new RegExp(/<\/\s*html>/); - - // Try to inject the scripts at the end of the element - // if it is present - if(headRegex.test(content)) { - content = content.replace(headRegex, scriptsWithEndTag); - } else if(htmlRegex.test(content)) { - // Otherwise add them at the end of the element - content = content.replace(htmlRegex, scriptsWithEndTag); - } else { - // Otherwise just add it at the end of the content - content += scripts; + if (_isHTML(path)) { + // Since we're not instrumenting this doc fully for some reason, + // at least inject the scroll manager so we can track scroll position. + var scripts = MouseManager.getRemoteScript(path) + LinkManager.getRemoteScript(); + var scriptsWithEndTag = scripts + "$&"; + var headRegex = new RegExp(/<\/\s*head>/); + var htmlRegex = new RegExp(/<\/\s*html>/); + + // Try to inject the scripts at the end of the element + // if it is present + if(headRegex.test(content)) { + content = content.replace(headRegex, scriptsWithEndTag); + } else if(htmlRegex.test(content)) { + // Otherwise add them at the end of the element + content = content.replace(htmlRegex, scriptsWithEndTag); + } else { + // Otherwise just add it at the end of the content + content += scripts; + } } serve(content);