Display retrieved replacements
This commit is contained in:
parent
7fe653eae3
commit
11e37d3759
|
@ -3,7 +3,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "InteractiveFics",
|
||||
"author": "mariamrf",
|
||||
"version": "5.0.2",
|
||||
"version": "5.0.3",
|
||||
"description": "Replaces Y/N & other variables in Reader Insert/second person fics with words of your choice.",
|
||||
"browser_action": {
|
||||
"default_title": "InteractiveFics",
|
||||
|
|
13
popup.js
13
popup.js
|
@ -60,10 +60,14 @@ const refreshReplacements = () => {
|
|||
}
|
||||
|
||||
const loadSaved = () => {
|
||||
chrome.storage.sync.get(null, items => {
|
||||
const list = document.getElementById('saved-items-list')
|
||||
list.innerHTML = ''
|
||||
let hasItems = false
|
||||
chrome.storage.sync.get(null, loadSavedItems)
|
||||
chrome.storage.local.get(null, loadSavedItems)
|
||||
}
|
||||
|
||||
const loadSavedItems = (items) => {
|
||||
const list = document.getElementById('saved-items-list')
|
||||
for (var key in items) {
|
||||
if (key !== DEACTIVATE_KEY && !key.endsWith('_case_sensitive')) {
|
||||
const label = key === 'person' ? 'Y/N' : key
|
||||
|
@ -72,13 +76,8 @@ const loadSaved = () => {
|
|||
const representative = `${label} -> ${items[key]} (${case_sensitive_string})`
|
||||
const list_item = createListItem(key, representative, 'one-saved-item')
|
||||
list.appendChild(list_item)
|
||||
hasItems = true
|
||||
}
|
||||
}
|
||||
if (!hasItems) {
|
||||
list.innerHTML = '<small>No stored replacements yet!</small>'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const createListItem = (id, text, className) => {
|
||||
|
|
Loading…
Reference in New Issue