From 410d6a267b2f0d7df7859d60da6a1f034c4fb820 Mon Sep 17 00:00:00 2001 From: hensm Date: Thu, 14 Mar 2019 09:42:00 +0000 Subject: [PATCH] Remove compat scripts and move API URL redirection to contentSetup --- ext/src/compat/youtube.js | 60 ------------------------------------ ext/src/global.d.ts | 4 +-- ext/src/lib/utils.ts | 3 ++ ext/src/main.ts | 49 +++++++++++++++++------------ ext/src/manifest.json | 8 +---- ext/src/options/index.tsx | 5 ++- ext/src/shim/contentSetup.ts | 37 ++++++++++++++++++++++ ext/webpack.config.js | 35 ++++++++++----------- 8 files changed, 92 insertions(+), 109 deletions(-) delete mode 100644 ext/src/compat/youtube.js diff --git a/ext/src/compat/youtube.js b/ext/src/compat/youtube.js deleted file mode 100644 index 63b89d3..0000000 --- a/ext/src/compat/youtube.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -// Insert script before first script is run -document.addEventListener("beforescriptexecute", function onBeforeScriptExecute () { - document.removeEventListener("beforescriptexecute", onBeforeScriptExecute); - - const scriptElement = document.createElement("script"); - scriptElement.src = browser.runtime.getURL("vendor/webcomponents-lite.min.js"); - document.head.prepend(scriptElement); -}); - - -const EXT_SENDER_SCRIPT_URLS = [ - "chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/cast_sender.js" - , "chrome-extension://enhhojjnijigcajfphajepfemndkmdlo/cast_sender.js" -]; - -const SENDER_SCRIPT_URL = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"; - - -// Store reference to original function -const _createElement = document.createElement; - -function createElement () { - // Call original function - const element = _createElement.apply(this, arguments); - - /** - * If the new element being created is a