Skip to content

Commit

Permalink
Inject flash controls into the page context
Browse files Browse the repository at this point in the history
At some point, Chrome got better sandboxing for its extensions, which broke the flash controls.
Injecting it into the page context gives it access to the flash GotoFrame function, and the like.
  • Loading branch information
madman-bob committed Nov 18, 2017
1 parent c4c3637 commit 2b72481
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
2 changes: 2 additions & 0 deletions POV Cam/flash-controls/flash-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ function addFlashControls(flashPanel) {
}
}
}

initFlashControls();
18 changes: 17 additions & 1 deletion POV Cam/injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});

Expand All @@ -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();
12 changes: 6 additions & 6 deletions POV Cam/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
Expand All @@ -69,4 +69,4 @@
"all_frames": true
}
]
}
}

0 comments on commit 2b72481

Please sign in to comment.