diff --git a/POV Cam/flash-controls/flash-controls.js b/POV Cam/flash-controls/flash-controls.js index fe88e67..6e91f99 100644 --- a/POV Cam/flash-controls/flash-controls.js +++ b/POV Cam/flash-controls/flash-controls.js @@ -101,3 +101,5 @@ function addFlashControls(flashPanel) { } } } + +initFlashControls(); diff --git a/POV Cam/injection.js b/POV Cam/injection.js index d458dd4..1806e51 100644 --- a/POV Cam/injection.js +++ b/POV Cam/injection.js @@ -67,7 +67,9 @@ function modifyPage() { // Flash controls if (items.flashcontrols == "yes") { - initFlashControls(); + injectPageContextJS("pageNo = " + pageNo); + injectPageContextJSFile('flash-controls/flash-lengths.js'); + injectPageContextJSFile('flash-controls/flash-controls.js'); } }); @@ -86,4 +88,18 @@ function modifyPage() { } } +function injectPageContextScript(scriptAttr, scriptValue) { + var script = document.createElement('script'); + script[scriptAttr] = scriptValue; + document.head.appendChild(script); +} + +function injectPageContextJS(scriptCode) { + return injectPageContextScript('textContent', scriptCode); +} + +function injectPageContextJSFile(fileLocation) { + return injectPageContextScript('src', chrome.extension.getURL(fileLocation)); +} + modifyPage(); diff --git a/POV Cam/manifest.json b/POV Cam/manifest.json index f6368d9..da32935 100644 --- a/POV Cam/manifest.json +++ b/POV Cam/manifest.json @@ -12,7 +12,10 @@ "web_accessible_resources": [ "options/options.html", - "images/*.png" + "images/*.png", + + "flash-controls/flash-lengths.js", + "flash-controls/flash-controls.js" ], "icons": { @@ -57,10 +60,7 @@ "pre-retcon-images/pre-retcon-images.js", "mspaintadventures-page-elements.js", - "injection.js", - - "flash-controls/flash-lengths.js", - "flash-controls/flash-controls.js" + "injection.js" ], "css": [ "pre-retcon-images/pre-retcon-images.css" @@ -69,4 +69,4 @@ "all_frames": true } ] -} \ No newline at end of file +}