diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-10-07 21:23:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-07 21:23:42 -0400 |
commit | 05e51a950e3fb7da3f9a252a742c068a9daad6b2 (patch) | |
tree | 0649a711633648c379adb79ca4b8344d8da001d7 /ext/bg/js/settings/dictionary-controller.js | |
parent | cb1902eaddeb092bf1e3d78f9e601109bd32202c (diff) |
Settings templates refactor (#897)
* Add template instantiation API to SettingsController
* Use SettingsController.instantiateTemplate
Diffstat (limited to 'ext/bg/js/settings/dictionary-controller.js')
-rw-r--r-- | ext/bg/js/settings/dictionary-controller.js | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/ext/bg/js/settings/dictionary-controller.js b/ext/bg/js/settings/dictionary-controller.js index 7a71a02a..cbbd0a8e 100644 --- a/ext/bg/js/settings/dictionary-controller.js +++ b/ext/bg/js/settings/dictionary-controller.js @@ -293,7 +293,7 @@ class DictionaryController { } _createExtra(totalCounts, remainders, totalRemainder) { - const node = this._instantiateTemplate('#dict-extra-template'); + const node = this._settingsController.instantiateTemplate('dict-extra'); this._integrityExtraInfoNode = node; node.querySelector('.dict-total-count').textContent = `${totalRemainder} item${totalRemainder !== 1 ? 's' : ''}`; @@ -317,7 +317,7 @@ class DictionaryController { } _createDictionaryEntry(dictionary) { - const node = this._instantiateTemplate('#dict-template'); + const node = this._settingsController.instantiateTemplate('dict'); this._dictionaryEntryContainer.appendChild(node); const entry = new DictionaryEntry(this, node, dictionary); @@ -369,12 +369,6 @@ class DictionaryController { } } - _instantiateTemplate(templateSelector) { - const template = document.querySelector(templateSelector); - const content = document.importNode(template.content, true); - return content.firstChild; - } - async _deleteDictionaryInternal(dictionaryTitle, onProgress) { const dictionaryDatabase = await this._getPreparedDictionaryDatabase(); try { |