Cleanup
This commit is contained in:
parent
8c944c6294
commit
4995135657
@ -174,7 +174,7 @@ class Yomichan {
|
|||||||
notifyTabs(name, value) {
|
notifyTabs(name, value) {
|
||||||
chrome.tabs.query({}, (tabs) => {
|
chrome.tabs.query({}, (tabs) => {
|
||||||
for (const tab of tabs) {
|
for (const tab of tabs) {
|
||||||
chrome.tabs.sendMessage(tab.id, {name: name, value: value}, () => null);
|
chrome.tabs.sendMessage(tab.id, {name, value}, () => null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class Client {
|
|||||||
range.setLength(length);
|
range.setLength(length);
|
||||||
|
|
||||||
bgRenderText(
|
bgRenderText(
|
||||||
{defs: definitions, root: this.fgRoot, options: this.options, sequence: sequence},
|
{defs: definitions, root: this.fgRoot, options: this.options, sequence},
|
||||||
'term-list.html',
|
'term-list.html',
|
||||||
(content) => {
|
(content) => {
|
||||||
this.definitions = definitions;
|
this.definitions = definitions;
|
||||||
@ -114,7 +114,7 @@ class Client {
|
|||||||
|
|
||||||
bgCanAddNotes(definitions, ['vocabExp', 'vocabReading'], (states) => {
|
bgCanAddNotes(definitions, ['vocabExp', 'vocabReading'], (states) => {
|
||||||
if (states !== null) {
|
if (states !== null) {
|
||||||
states.forEach((state, index) => this.popup.sendMessage('setActionState', {index: index, state: state, sequence: sequence}));
|
states.forEach((state, index) => this.popup.sendMessage('setActionState', {index, state, sequence}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ class Client {
|
|||||||
|
|
||||||
bgAddNote(this.definitions[index], mode, (success) => {
|
bgAddNote(this.definitions[index], mode, (success) => {
|
||||||
if (success) {
|
if (success) {
|
||||||
this.popup.sendMessage('setActionState', {index: index, state: state, sequence: this.sequence});
|
this.popup.sendMessage('setActionState', {index, state, sequence: this.sequence});
|
||||||
} else {
|
} else {
|
||||||
alert('Note could not be added');
|
alert('Note could not be added');
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ class Client {
|
|||||||
bgFindKanji(kanji, (definitions) => {
|
bgFindKanji(kanji, (definitions) => {
|
||||||
const sequence = ++this.sequence;
|
const sequence = ++this.sequence;
|
||||||
bgRenderText(
|
bgRenderText(
|
||||||
{defs: definitions, root: this.fgRoot, options: this.options, sequence: sequence},
|
{defs: definitions, root: this.fgRoot, options: this.options, sequence},
|
||||||
'kanji-list.html',
|
'kanji-list.html',
|
||||||
(content) => {
|
(content) => {
|
||||||
this.definitions = definitions;
|
this.definitions = definitions;
|
||||||
@ -179,7 +179,7 @@ class Client {
|
|||||||
|
|
||||||
bgCanAddNotes(definitions, ['kanji'], (states) => {
|
bgCanAddNotes(definitions, ['kanji'], (states) => {
|
||||||
if (states !== null) {
|
if (states !== null) {
|
||||||
states.forEach((state, index) => this.popup.sendMessage('setActionState', {index: index, state: state, sequence: sequence}));
|
states.forEach((state, index) => this.popup.sendMessage('setActionState', {index, state, sequence}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class Popup {
|
|||||||
|
|
||||||
sendMessage(action, params, callback) {
|
sendMessage(action, params, callback) {
|
||||||
if (this.popup !== null) {
|
if (this.popup !== null) {
|
||||||
this.popup.contentWindow.postMessage({action: action, params: params}, '*');
|
this.popup.contentWindow.postMessage({action, params}, '*');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user