This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "manifest_version": 2, | |
| "name": "Beastify", | |
| "version": "1.0", | |
| "permissions": [ | |
| "activeTab" | |
| ], | |
| "browser_action": { | |
| "default_icon": "icons/beasts-32.png", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun listenForClicks() { | |
| document.addEventListener("click", { e -> | |
| val target = e.target as? Element ?: return@addEventListener | |
| browser.tabs.query(Query(active = true, currentWindow = true)) | |
| .then({ tabs -> handleClick(target, tabs[0].id) }) | |
| .catch(::reportError) | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const val SCRIPT_PATH = "/content_script/build/classes/kotlin/main/min" | |
| fun main(args: Array<String>) { | |
| Promise.all(arrayOf( | |
| browser.tabs.executeScript(Script("$SCRIPT_PATH/kotlin.js")), | |
| browser.tabs.executeScript(Script("$SCRIPT_PATH/content_script.js")) | |
| )) | |
| .then({ listenForClicks() }) | |
| .catch(::reportExecuteScriptError) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| external val browser: Browser | |
| external class Browser { | |
| val tabs: Tabs | |
| } | |
| external class Tabs { | |
| fun executeScript(def: Script): Promise<List<Any>> | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun main(args: Array<String>) { | |
| if (window.asDynamic().hasRun == true) { | |
| return | |
| } | |
| window.asDynamic().hasRun = true | |
| browser.runtime.onMessage.addListener { message -> | |
| if (message.command === "beastify") { | |
| insertBeast(message.beastURL as String) | |
| } else if (message.command === "reset") { |
OlderNewer