123456789101112131415161718192021222324252627 |
- function initPopup(res) {
- document.body.style.width = res.width
- document.body.style.height = res.height
- }
- window.onload = () => {
- chrome.storage.sync.get({ config: '' }, (item) => {
- if (item.config) {
- let config = JSON.parse(item.config)
- initPopup(config.popup)
- }
- })
- updateConfig()
- window.addEventListener('message', function (e) {
- chrome.storage.sync.set({ iframe: e.data });
- }, false)
- chrome.storage.sync.get({ iframe: '' }, (item) => {
- if (item.iframe) {
- document.querySelector('iframe').contentWindow.postMessage(item.iframe, '*')
- }
- });
- }
|