-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vera 邀请链接中的ID改为隐式传参
- Loading branch information
Showing
6 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
chrome.storage.sync.get(null, function (items) { | ||
// Notify that we saved. | ||
console.log('all local items', items); | ||
if (items) { | ||
let fragments = document.createDocumentFragment(); | ||
Object.keys(items).forEach((key) => { | ||
let item = document.createElement('li'); | ||
item.classList.add('item'); | ||
item.setAttribute('data-key', key); | ||
item.style.cursor = 'pointer'; | ||
item.title = 'Click to remove'; | ||
item.innerHTML = items[key]; | ||
item.addEventListener('click', (evt) => { | ||
console.log(evt.target); | ||
let currItemEle = evt.target; | ||
let key = currItemEle.dataset.key; | ||
if (key) { | ||
chrome.storage.sync.remove(key, (resp) => { | ||
console.log('remove', resp); | ||
currItemEle.remove(); | ||
}); | ||
} | ||
}); | ||
fragments.appendChild(item); | ||
}); | ||
let localList = document.querySelector('.locals'); | ||
localList.appendChild(fragments); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
console.log('catch invite id'); | ||
let url = new URL(location.href); | ||
let paths = url.pathname.split('/'); | ||
let decodedUrl = decodeURIComponent(paths[paths.length - 1]); | ||
console.log('decodedUrl', decodedUrl); | ||
let id = new URLSearchParams(new URL(decodedUrl).search).get('portal-vera-id'); | ||
console.log('catch the id', id); | ||
if (id) { | ||
chrome.storage.sync.set({ pvid: id }, function () { | ||
// Notify that we saved. | ||
console.log('pvid saved', id); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters