Skip to content

Commit

Permalink
Fix first lookup failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Vopaaz committed Dec 10, 2019
1 parent 9be5924 commit 56c435f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Vocabulary builder simulating using a textbook and tear-it-down methodology.

### Windows Executable

Download the [release](https://github.com/Vopaaz/Vocab-Vanquisher/releases/tag/v0.2.1).
Download the [release](https://github.com/Vopaaz/Vocab-Vanquisher/releases/tag/v0.2.2).

### Run from Source

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vocab-vanquisher",
"version": "0.2.1",
"version": "0.2.2",
"private": true,
"description": "Vocabulary builder simulating using a textbook and tear-it-down methodology.",
"author": {
Expand Down
10 changes: 5 additions & 5 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ if (isDevelopment) {
}
}

if (isDevelopment) {
const Store = require('electron-store');
const store = new Store();
store.clear()
}
// if (isDevelopment) {
// const Store = require('electron-store');
// const store = new Store();
// store.clear()
// }

import "./main-process/main"
32 changes: 26 additions & 6 deletions src/components/VocabTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default {
return {
hasDef: true,
menu: null,
selecting: ""
selecting: "",
firstLookup: true
};
},
computed: {
Expand Down Expand Up @@ -86,6 +87,17 @@ export default {
event.preventDefault();
this.selecting = item.vocabulary;
this.menu.popup({ window: remote.getCurrentWindow() });
},
openLookupWindow: function() {
let self = this
window.open(
"https://cn.bing.com/dict/search?q=" +
self.selecting +
"&qs=n&form=Z9LH5&sp=-1&pq=" +
self.selecting,
"_blank",
"nodeIntegration=no"
);
}
},
created() {
Expand All @@ -107,11 +119,19 @@ export default {
new MenuItem({
label: "Look up in the dictionary",
click() {
window.open(
"https://cn.bing.com/dict/search?q=" + self.selecting,
"_blank",
"nodeIntegration=no"
);
if (self.firstLookup) {
self.firstLookup = false;
window.open(
"https://cn.bing.com/dict/?mkt=zh-cn",
"_blank",
"nodeIntegration=no"
);
setTimeout(() => {
self.openLookupWindow();
}, 1000);
} else {
self.openLookupWindow();
}
}
})
);
Expand Down

0 comments on commit 56c435f

Please sign in to comment.