diff --git a/config.js b/config.js index 88304e2..0079fe9 100644 --- a/config.js +++ b/config.js @@ -1,8 +1,8 @@ class ConfigClass { constructor() { this.onStorageChange = this.onStorageChange.bind(this); - this.set("version", browser.runtime.getManifest().version); - this.set("addon", "Glitter Drag"); + this["version"] = browser.runtime.getManifest().version; + this["addon"] = "Glitter Drag"; browser.storage.onChanged.addListener(this.onStorageChange); } diff --git a/content_scripts/content_script.js b/content_scripts/content_script.js index 9909ab0..c8892a2 100644 --- a/content_scripts/content_script.js +++ b/content_scripts/content_script.js @@ -191,7 +191,6 @@ class DragClass { } } dragstart(evt) { - this.DATATRANSFER = evt.dataTransfer; if (bgConfig.enableIndicator) { if (this.indicatorBox === null) this.indicatorBox = new Indicator(); this.indicatorBox.place(evt.pageX, evt.pageY, bgConfig.triggeredDistance); @@ -272,6 +271,7 @@ class DragClass { actions = bgConfig.Actions; } let message = "" + // TODO: buffer i18n message to run faster message = getI18nMessage(actions[this.actionType][this.direction]["act_name"]); // } this.promptBox.render(this.direction, message); @@ -674,23 +674,19 @@ let bgPort = browser.runtime.connect({ let bgConfig = null; let mydrag = null; -function main() { - bgPort.onMessage.addListener((c) => { - bgConfig = JSON.parse(c); - // console.log(bgConfig); - if (mydrag === null) { - if (["loading", "interactive"].includes(document.readyState)) { - document.addEventListener("DOMContentLoaded", () => { - mydrag = new DragClass(document); - }, { - once: true - }); - } - else { +bgPort.onMessage.addListener((c) => { + bgConfig = JSON.parse(c); + // console.log(bgConfig); + if (mydrag === null) { + if (["loading", "interactive"].includes(document.readyState)) { + document.addEventListener("DOMContentLoaded", () => { mydrag = new DragClass(document); - } + }, { + once: true + }); } - }) -} -main(); -setTimeout(main, 2000); \ No newline at end of file + else { + mydrag = new DragClass(document); + } + } +}) \ No newline at end of file diff --git a/manifest.json b/manifest.json index 1e49029..0f2f66b 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "description": "__MSG_extensionDescription__", "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "1.50.0b10", + "version": "1.50.0", "homepage_url": "https://github.com/harytfw/GlitterDrag", "icons": { "48": "Drag.png", diff --git a/options/options.html b/options/options.html index 8257f8f..d6955fe 100644 --- a/options/options.html +++ b/options/options.html @@ -150,8 +150,8 @@
- - + +