Skip to content

Commit

Permalink
Prepare landing
Browse files Browse the repository at this point in the history
  • Loading branch information
harytfw committed Sep 10, 2017
1 parent b96fd25 commit eb73774
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -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);
}

Expand Down
34 changes: 15 additions & 19 deletions content_scripts/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
else {
mydrag = new DragClass(document);
}
}
})
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@
<label for="timeoutCancel" data-i18n="TimeoutCancel">超时取消时间(ms)</label>
<input type="number" id="timeoutCancel">
<br>
<input disabled type="checkbox" id="enableSync">
<label for="enableSync" data-i18n="EnableSync">同步到Firefox账户(v53+)</label>
<!-- <input disabled type="checkbox" id="enableSync"> -->
<!-- <label for="enableSync" data-i18n="EnableSync">同步到Firefox账户(v53+)</label> -->
</li>
<li class="tab-content" id="tab-download">
<button data-i18n="ShowDefaultDownloadDirectory" id="showDefaultDownloadDirectory">打开浏览器的默认下载目录</button>
Expand Down

0 comments on commit eb73774

Please sign in to comment.