From 11e4fc2e1fbb1f2c3633a7ab23dfc24eb4ca511f Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 8 Feb 2017 19:26:46 +0000 Subject: Revert "Use HTML5 import to load content scripts." This reverts commit d00345f45b5b3e56970237799c69808527e91919. This is not (and will not be) supported by Firefox. --- manifest.json | 2 -- pages/blank.html | 25 ++++++++++++++++++++++++- pages/completion_engines.html | 25 ++++++++++++++++++++++++- pages/content_script_loader.coffee | 28 ++++++++++++++++++++++++++++ pages/help_dialog.html | 25 ++++++++++++++++++++++++- pages/logging.html | 25 ++++++++++++++++++++++++- pages/options.html | 25 ++++++++++++++++++++++++- pages/vimium_resources.html | 24 ------------------------ 8 files changed, 148 insertions(+), 31 deletions(-) create mode 100644 pages/content_script_loader.coffee delete mode 100644 pages/vimium_resources.html diff --git a/manifest.json b/manifest.json index 5dceb6d5..09d44e18 100644 --- a/manifest.json +++ b/manifest.json @@ -35,8 +35,6 @@ ], "content_scripts": [ { - "_comment": - "IMPORTANT: All resources listed here must also be listed in ./pages/vimium_resources.html.", "matches": [""], "js": ["lib/utils.js", "lib/keyboard_utils.js", diff --git a/pages/blank.html b/pages/blank.html index c238282d..4f0d7bfa 100644 --- a/pages/blank.html +++ b/pages/blank.html @@ -1,7 +1,30 @@ New Tab - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/completion_engines.html b/pages/completion_engines.html index 0c350664..338ff3eb 100644 --- a/pages/completion_engines.html +++ b/pages/completion_engines.html @@ -4,7 +4,30 @@ - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/content_script_loader.coffee b/pages/content_script_loader.coffee new file mode 100644 index 00000000..5058bb7b --- /dev/null +++ b/pages/content_script_loader.coffee @@ -0,0 +1,28 @@ +injectContentScripts = -> + manifest = chrome.runtime.getManifest() + content_scripts = manifest.content_scripts + + insertLocation = document.head.firstChild + + for scriptInfo in content_scripts + continue if scriptInfo.matches.indexOf("") == -1 + + if scriptInfo.js + for script in scriptInfo.js + scriptElement = document.createElement "script" + scriptElement.type = "text/javascript" + scriptElement.async = false # Don't load out of order! + scriptElement.src = chrome.runtime.getURL script + + insertLocation.parentElement.insertBefore scriptElement, insertLocation + + if scriptInfo.css + for style in scriptInfo.css + styleElement = document.createElement "link" + styleElement.rel = "stylesheet" + styleElement.type = "text/css" + styleElement.href = chrome.runtime.getURL style + + insertLocation.parentElement.insertBefore styleElement, insertLocation + +injectContentScripts() diff --git a/pages/help_dialog.html b/pages/help_dialog.html index 7bc0d86c..58cdf8c2 100644 --- a/pages/help_dialog.html +++ b/pages/help_dialog.html @@ -1,7 +1,30 @@ Vimium Help - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pages/logging.html b/pages/logging.html index bc4ffb80..dd05e819 100644 --- a/pages/logging.html +++ b/pages/logging.html @@ -1,7 +1,30 @@ Vimium Logging - + + + + + + + + + + + + + + + + + + + + + + +