├── .gitattributes ├── package.json ├── images └── default_icon │ ├── 16.png │ ├── 32.png │ ├── 48.png │ ├── 64.png │ ├── 128.png │ └── 148.png ├── .gitignore ├── scripts ├── shared_utils.js ├── default_popup │ └── main.js ├── neatified │ └── neatified.js └── libs │ ├── contentScriptsAPIBridge.js │ └── backgroundScriptsAPIBridge.js ├── manifest.v2.json ├── manifest.json ├── pages └── default_popup.html ├── styles ├── default_popup │ └── main.css └── libs │ └── normalize.css ├── README.md └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "webextension-polyfill": "^0.8.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /images/default_icon/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/16.png -------------------------------------------------------------------------------- /images/default_icon/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/32.png -------------------------------------------------------------------------------- /images/default_icon/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/48.png -------------------------------------------------------------------------------- /images/default_icon/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/64.png -------------------------------------------------------------------------------- /images/default_icon/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/128.png -------------------------------------------------------------------------------- /images/default_icon/148.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seia-soto/neatified/HEAD/images/default_icon/148.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | .DS_Store 3 | 4 | /dist 5 | 6 | package-lock.json 7 | .package-lock.json 8 | 9 | node_modules/webextension-polyfill/dist/browser-polyfill.js* 10 | -------------------------------------------------------------------------------- /scripts/shared_utils.js: -------------------------------------------------------------------------------- 1 | let browser = chrome 2 | 3 | if (typeof window !== 'undefined') { 4 | browser = window.browser || browser 5 | } 6 | 7 | const actions = [ 8 | 'disable', 9 | 'enable_soft', 10 | 'enable_strict' 11 | ] 12 | 13 | /** 14 | * Get current hostname of the active tab 15 | * 16 | * @returns {Promise} hostname 17 | */ 18 | const get_current_host = async () => { 19 | const [tab] = await browser.tabs.query({ 20 | active: true, 21 | currentWindow: true 22 | }) 23 | 24 | /** 25 | * @type {string} 26 | */ 27 | const { url } = tab 28 | 29 | return (new URL(url)).hostname 30 | } 31 | 32 | /** 33 | * Get content script injection mode 34 | * 35 | * @param {string} hostname 36 | * @returns {Promise} 37 | */ 38 | const get_action = async (hostname) => { 39 | const config = await browser.storage.sync.get(hostname) 40 | 41 | const value = Number(config[hostname]) 42 | 43 | return actions[value] || actions[0] 44 | } 45 | 46 | /** 47 | * Set content script injection mode 48 | * 49 | * @param {string} hostname 50 | * @param {string} action 51 | */ 52 | const set_action = async (hostname, action) => { 53 | await browser.storage.sync.set({ 54 | [hostname]: actions.indexOf(action) 55 | }) 56 | } 57 | 58 | /** 59 | * Reset all config 60 | */ 61 | const reset_config = async () => { 62 | await browser.storage.local.clear() 63 | await browser.storage.sync.clear() 64 | } 65 | -------------------------------------------------------------------------------- /manifest.v2.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Neatified", 4 | "author": "Seia-Soto", 5 | "version": "1.4.2", 6 | "description": "Allowing you to copy and right-click on websites.", 7 | "homepage_url": "https://seia.io/", 8 | "offline_enabled": true, 9 | "permissions": [ 10 | "http://*/*", 11 | "https://*/*", 12 | "storage" 13 | ], 14 | "browser_action": { 15 | "default_title": "Neatified", 16 | "default_popup": "pages/default_popup.html", 17 | "default_icon": { 18 | "16": "images/default_icon/16.png", 19 | "32": "images/default_icon/32.png", 20 | "48": "images/default_icon/48.png", 21 | "128": "images/default_icon/128.png" 22 | } 23 | }, 24 | "icons": { 25 | "16": "images/default_icon/16.png", 26 | "32": "images/default_icon/32.png", 27 | "48": "images/default_icon/48.png", 28 | "128": "images/default_icon/128.png" 29 | }, 30 | "content_scripts": [ 31 | { 32 | "run_at": "document_end", 33 | "matches": [ 34 | "http://*/*", 35 | "https://*/*" 36 | ], 37 | "js": [ 38 | "node_modules/webextension-polyfill/dist/browser-polyfill.min.js", 39 | "scripts/shared_utils.js", 40 | "scripts/neatified/neatified.js" 41 | ] 42 | } 43 | ], 44 | "content_security_policy": "script-src 'self'; object-src 'self'", 45 | "-ms-preload": { 46 | "backgroundScript": "scripts/backgroundScriptsAPIBridge.js", 47 | "contentScript": "scripts/contentScriptsAPIBridge.js" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "Neatified", 4 | "author": "Seia-Soto", 5 | "version": "1.4.2", 6 | "description": "Allowing you to copy and right-click on websites.", 7 | "homepage_url": "https://seia.io/", 8 | "offline_enabled": true, 9 | "permissions": [ 10 | "tabs", 11 | "storage" 12 | ], 13 | "host_permissions": [ 14 | "http://*/*", 15 | "https://*/*" 16 | ], 17 | "action": { 18 | "default_title": "Neatified", 19 | "default_popup": "pages/default_popup.html", 20 | "default_icon": { 21 | "16": "images/default_icon/16.png", 22 | "32": "images/default_icon/32.png", 23 | "48": "images/default_icon/48.png", 24 | "128": "images/default_icon/128.png" 25 | } 26 | }, 27 | "icons": { 28 | "16": "images/default_icon/16.png", 29 | "32": "images/default_icon/32.png", 30 | "48": "images/default_icon/48.png", 31 | "128": "images/default_icon/128.png" 32 | }, 33 | "content_scripts": [ 34 | { 35 | "run_at": "document_end", 36 | "matches": [ 37 | "http://*/*", 38 | "https://*/*" 39 | ], 40 | "js": [ 41 | "node_modules/webextension-polyfill/dist/browser-polyfill.min.js", 42 | "scripts/shared_utils.js", 43 | "scripts/neatified/neatified.js" 44 | ] 45 | } 46 | ], 47 | "content_security_policy": { 48 | "extension_pages": "script-src 'self'; object-src 'self'" 49 | }, 50 | "-ms-preload": { 51 | "backgroundScript": "scripts/backgroundScriptsAPIBridge.js", 52 | "contentScript": "scripts/contentScriptsAPIBridge.js" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /pages/default_popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Neatified 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 |
20 | 21 |
22 |

Site Options

23 |

Decide if we need to inject scripts into the website.

24 | 25 |
26 | 27 | 28 | 29 |
30 |
31 | 32 |
33 |

Tools

34 |

35 | If extension not working properly or browsing slowed down because of a lots of rules, you can reset the config. 36 |

37 | 38 | 39 |
40 | 41 |
42 |

Contact

43 |

44 | You can contact to the developer using GitHub. 45 | If you want to report bugs, please check following things before reporting: 46 |

    47 |
  • Full URL to the website
  • 48 |
  • Information about OS and web browser
  • 49 |
50 | 51 | We DO NOT collect any personal data. 52 | Every data is processed inside of your browser. 53 |

54 |
55 | 56 | 57 | -------------------------------------------------------------------------------- /scripts/default_popup/main.js: -------------------------------------------------------------------------------- 1 | const states = { 2 | reset: 0 3 | } 4 | 5 | const actionable_buttons = 'div.buttons > button' 6 | const reset_button = 'button[data-util-action="reset"]' 7 | 8 | /** 9 | * Set content script injection mode with UI 10 | * 11 | * @param {HTMLElement} el The element to set active 12 | * @param {string} action The action to use 13 | */ 14 | const ui_set_action = async (el, action) => { 15 | ui_disable_all_buttons() 16 | 17 | set_action(await get_current_host(), action) 18 | el.classList.add('active') 19 | } 20 | 21 | /** 22 | * Disable all active buttons 23 | */ 24 | const ui_disable_all_buttons = () => { 25 | document.querySelectorAll(actionable_buttons).forEach(el => { 26 | el.classList.remove('active') 27 | }) 28 | } 29 | 30 | /** 31 | * Enable button with current value 32 | */ 33 | const ui_enable_active_button = async () => { 34 | const action = await get_action(await get_current_host()) 35 | 36 | document.querySelector(`[data-action-mode='${action}']`).classList.add('active') 37 | } 38 | 39 | /** 40 | * Reset all config with UI 41 | */ 42 | const ui_reset_config = async () => { 43 | if (states.reset) { 44 | return 45 | } 46 | 47 | const el = document.querySelector(reset_button) 48 | 49 | el.classList.remove('active') 50 | el.innerHTML = 'Resetting config...' 51 | states.reset = 1 52 | 53 | await reset_config() 54 | 55 | el.classList.add('active') 56 | el.innerHTML = 'Reset config' 57 | states.reset = 0 58 | 59 | // reload current popup 60 | window.location.reload() 61 | } 62 | 63 | /** 64 | * Add onclick hook to all actionable buttons 65 | */ 66 | const ui_hook_action_buttons = () => { 67 | ui_disable_all_buttons() 68 | 69 | document.querySelectorAll(actionable_buttons).forEach(el => { 70 | /** 71 | * @type {string} 72 | */ 73 | const action = el.dataset.actionMode 74 | 75 | el.addEventListener('click', () => ui_set_action(el, action)) 76 | }) 77 | 78 | // reset button 79 | document.querySelector(reset_button).addEventListener('click', () => ui_reset_config()) 80 | } 81 | 82 | //////////////////// 83 | 84 | ui_hook_action_buttons() 85 | ui_enable_active_button() 86 | -------------------------------------------------------------------------------- /styles/default_popup/main.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | width: 320px; 3 | min-height: 500px; 4 | } 5 | 6 | body { 7 | color: lightgray; 8 | background: #1b1c1d; 9 | 10 | font-size: 14px; 11 | font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif; 12 | 13 | line-break: 1.6em; 14 | word-break: keep-all; 15 | } 16 | 17 | h1, h2, h3, h4, h5, h6, p, a, span { 18 | padding: 0; 19 | margin: 0; 20 | } 21 | 22 | ol, ul { 23 | padding-left: 20px; 24 | } 25 | 26 | a { 27 | color: lightsteelblue; 28 | text-decoration: none; 29 | } 30 | 31 | nav { 32 | position: fixed; 33 | top: 0; 34 | left: 0; 35 | 36 | height: 56px; 37 | width: 100%; 38 | 39 | display: flex; 40 | justify-content: center; 41 | align-items: center; 42 | 43 | font-weight: 400; 44 | } 45 | 46 | nav > h1 { 47 | font-size: 16px; 48 | font-weight: 400; 49 | } 50 | 51 | div.pusher { 52 | margin-top: 56px; 53 | } 54 | 55 | div.divider { 56 | height: 1px; 57 | padding: 0; 58 | 59 | background-color: darkgray; 60 | } 61 | 62 | .container { 63 | padding: 16px; 64 | padding-bottom: 0; 65 | } 66 | 67 | .container:last-child { 68 | padding-bottom: 16px; 69 | } 70 | 71 | .container > h2 { 72 | font-size: 16px; 73 | font-weight: 500; 74 | 75 | padding-bottom: 12px; 76 | } 77 | 78 | div.buttons { 79 | display: flex; 80 | justify-content: center; 81 | align-items: center; 82 | 83 | list-style: none; 84 | } 85 | 86 | button { 87 | width: 100%; 88 | padding: 5px 14px; 89 | margin: 14px 0; 90 | 91 | text-align: center; 92 | 93 | background-color: lightslategray; 94 | color: black; 95 | 96 | border: none; 97 | border-radius: 5px; 98 | 99 | transition: background-color 0.2s ease; 100 | 101 | cursor: pointer; 102 | } 103 | 104 | button.active { 105 | background-color: lightsteelblue; 106 | } 107 | 108 | div.buttons > button { 109 | flex: 1; 110 | 111 | border-radius: 0; 112 | } 113 | 114 | div.buttons > button:first-child { 115 | border-top-left-radius: 16px; 116 | border-bottom-left-radius: 16px; 117 | } 118 | div.buttons > button:last-child { 119 | border-top-right-radius: 16px; 120 | border-bottom-right-radius: 16px; 121 | } 122 | -------------------------------------------------------------------------------- /scripts/neatified/neatified.js: -------------------------------------------------------------------------------- 1 | const profiles = { 2 | disable: { 3 | events: [], 4 | attributes: [], 5 | useStyler: false, 6 | useObserver: false 7 | }, 8 | enable_soft: { 9 | events: [ 10 | 'copy', 11 | 'dragstart', 12 | 'contextmenu', 13 | 'selectstart' 14 | ], 15 | attributes: [ 16 | 'oncontextmenu' 17 | ], 18 | useStyler: true, 19 | useObserver: true 20 | }, 21 | enable_strict: { 22 | events: [ 23 | 'copy', 24 | 'dragstart', 25 | 'contextmenu', 26 | 'selectstart', 27 | 'selectionchange', 28 | 'mouseup', 29 | 'mousedown', 30 | 'keydown', 31 | 'keyup', 32 | 'keypress' 33 | ], 34 | attributes: [ 35 | 'oncontextmenu' 36 | ], 37 | useStyler: true, 38 | useObserver: true 39 | } 40 | } 41 | 42 | const neatified = (options, elements) => { 43 | elements = elements || Array.from(document.querySelectorAll('body > *')) 44 | 45 | for (let i = 0; i < elements.length; i++) { 46 | const element = elements[i] 47 | 48 | if (typeof element === 'object' && element !== null) { 49 | for (let k = 0; k < options.events.length; k++) { 50 | const eventName = options.events[k] 51 | 52 | element.addEventListener(eventName, function (event) { 53 | event.stopPropagation() 54 | }, true) 55 | } 56 | for (let j = 0; j < options.attributes.length; j++) { 57 | const attrName = options.attributes[j] 58 | 59 | if (element.nodeType != 3 /* If Node is not [object Text] (Text node) */) { 60 | element.removeAttribute(attrName) 61 | } 62 | } 63 | } 64 | } 65 | } 66 | 67 | const neatified_styler = () => { 68 | const styleCtx = ` 69 | html, body, *, *::after, *::before { 70 | user-select: auto !important; 71 | -webkit-user-select: auto !important; 72 | -webkit-user-drag: auto !important; 73 | -webkit-app-region: auto !important; 74 | } 75 | ` 76 | const style = document.createElement('style') 77 | 78 | style.innerHTML = styleCtx 79 | 80 | document.querySelector('head').appendChild(style) 81 | } 82 | 83 | const neatified_observer = profile => { 84 | const observer = new MutationObserver(function (mutationList) { 85 | const nodeAdded = [] 86 | 87 | for (let k = 0; k < mutationList.length; k++) { 88 | nodeAdded.push(...mutationList[k].addedNodes) 89 | 90 | if (mutationList[k].type === 'attributes') { // NOTE: attributes already filtered. 91 | nodeAdded.push(mutationList[k].target) 92 | } 93 | } 94 | 95 | neatified(profile, Array.from(nodeAdded)) 96 | }) 97 | 98 | observer.observe(document.body, { 99 | attributes: true, 100 | childList: true, 101 | subtree: true, 102 | attributeFilter: profile.attributes 103 | }) 104 | } 105 | 106 | const neatified_init = async () => { 107 | const action = await get_action((new URL(location.href)).hostname) 108 | const profile = profiles[action] 109 | 110 | neatified(profile) 111 | 112 | if (profile.useStyler) neatified_styler() 113 | if (profile.useObserver) neatified_observer(profile) 114 | } 115 | 116 | neatified_init() 117 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neatified 2 | 3 | Neatified는 복사 및 우클릭, 드래그를 방지하는 기능을 차단하는 웹 브라우저 플러그인입니다. 4 | 5 | - v1.1.0 버전부터 더 이상 `.crx` 파일이 제공되지 않으며 오직 `.zip` 아카이브만 제공됩니다. (`.crx`는 실제 설치에 관여하지 않음) 6 | 7 | ## 목차 8 | 9 | - [설치하기](#설치하기) 10 | - [도움말(FAQ)](#도움말) 11 | - [문의](#문의) 12 | 13 | ### 설치하기 14 | 15 | 각 웹 스토어 버전은 GitHub의 버전보다 레거시 버전이거나 정상적으로 동작하지 않을 수도 있습니다. 16 | 마지막 업데이트가 적용된 버전을 설치하려면 GitHub 소스에서 설치하세요. 17 | 18 | > 단, master 브랜치의 경우 정상 작동을 보장하지 않습니다. 19 | 20 | #### Firefox 21 | 22 | * [Firefox addons에서 Neatified 부가기능을 설치](https://addons.mozilla.org/addon/neatified/)할 수 있습니다. 23 | 24 | > Neatified는 Chrome에서 동작하도록 설계되었으며 일부 기능이 정상적으로 동작하지 않을 수도 있습니다. 25 | 26 | #### Chrome 27 | 28 | * [Chrome Web Store에서 Neatified 확장 프로그램을 설치](https://chrome.google.com/webstore/detail/neatified/cpchjdflfeejpegfmghbamllgdpikgaa)할 수 있습니다. 29 | 30 | > 마지막 릴리즈를 빠르게 사용하려면 아래 방법을 통해 직접 소스에서 설치할 수 있습니다. 31 | 32 | 1. [릴리즈 폴더](https://github.com/Seia-Soto/neatified/releases)에서 최신 버전(Zip 아카이브)을 다운로드하세요. 33 | 34 | ``` 35 | 모든 릴리즈 배포판(dist)이 릴리즈 페이지로 이동 및 업로드되었음을 알려드립니다. 36 | ``` 37 | 38 | * 알파벳 버전은 이전 버전에 대한 패치이며 사전순(a, b, c..., z에 가까울수록 최신 버전임)입니다. 39 | 40 | 2. 다운로드한 Zip 아카이브를 압축해제하고 Chrome 확장프로그램 관리 페이지(chrome://extensions)를 여세요. 41 | 42 | 3. 우측 상단에서 개발자 모드를 활성화하고 '압축해제된 확장프로그램 로드...' 버튼을 클릭하세요. 43 | 44 | 4. 압축해제한 Zip 아카이브 폴더(manifest.json 파일이 위치해 있음)를 선택하고 설치를 완료하세요. 45 | 46 | 5. 우측 상단에 Neatified가 설치된 것을 확인할 수 있습니다. 47 | 48 | #### Whale 49 | 50 | * [Whale Store에서 Neatified 확장앱을 설치](https://store.whale.naver.com/detail/piakhinfpllpilckgolopicmfjgocghc)할 수 있습니다. 51 | 52 | > Whale은 Chromium 기반으로 Neatified의 동작이 호환됩니다. 53 | 54 | #### Safari 55 | 56 | > 기능 지원이 현재 레포지토리와 상이할 수 있습니다. 57 | 58 | Safari용 Neatified는 Helloyunho님이 포크하여 만들어주셨습니다. 59 | 아래 레포지토리에서 설치 방법과 소스 코드를 확인할 수 있습니다. 60 | 61 | - [Helloyunho/neatified](https://github.com/Helloyunho/neatified) 62 | 63 | #### Microsoft Edge (EdgeHTML) 64 | 65 | > `1.3.2` 버전부터 EdgeHTML에 대한 지원이 추가되었습니다. 단, EdgeHTML은 Windows에 기본적으로 설치되어 있는 구 버전입니다. 66 | 67 | 1. [릴리즈 폴더](https://github.com/Seia-Soto/neatified/releases)에서 최신 버전(Zip 아카이브)을 다운로드하세요. 68 | 69 | 2. 다운로드한 Zip 아카이브를 압축해제하고 Edge 기능 관리 페이지(about:flags)를 여세요. 70 | 71 | 3. 기능 관리 페이지에서 `확장 개발자 기능 사용`을 활성화하고 Edge를 재시작하세요. 72 | 73 | 4. 우측 상단의 메뉴 버튼을 눌러 `확장` 메뉴로 진입하고 압축해제한 Zip 아카이브 폴더(manifest.json 파일이 위치해 있음)을 선택하고 설치를 완료하세요. 74 | 75 | 5. 우측 상단에 Neatified가 설치된 것을 확인할 수 있습니다. 76 | 77 | ### 도움말 78 | 79 | 플러그인 실행 중 문제(특정 사이트에서 플러그인이 작동하지 않는 경우 등)가 발생한다면 [이슈 탭](https://github.com/Seia-Soto/neatified/issues)에서 **같은 상황을 만들 수 있는 방법** 그리고 **현재 운영체제 및 웹 브라우저 버전 등의 정보** 등을 꼭 첨부하여 신고해주시기 바랍니다. 80 | 81 | 1. 웹 사이트의 일부 기능이 정상적으로 작동하지 않습니다. 어떻게 Neatified를 해당 사이트에서 사용 중지하나요? 82 | 83 | Neatified를 우측 상단의 확장프로그램 아이콘을 사용해서 설정을 편집할 수 있습니다. 설정은 **전역 설정**(모든 웹 사이트에서 설정이 적용됨)이며 Nothing을 사용하면 스크립트가 실행되지 않습니다. 84 | 85 | 2. Chrome 웹 브라우저를 동기화 기능과 함께 사용 중입니다. 다른 기기에서도 설정이 동기화되나요? 86 | 87 | 아니요. 동기화되지 않습니다. Chrome 확장프로그램 스토리지 기능에는 `sync`와 `local`, 총 2개의 옵션이 있습니다. 88 | 각각 동기화를 사용하는지 또는 현재 기기에서만 설정을 유지할 지에 차이가 있습니다. 89 | Neatified는 기본적으로 소스로부터 설치되는 환경을 가정하기 때문에 `local`을 사용하여 설정을 업데이트합니다. 90 | 91 | 3. 확장프로그램은 어떻게 업데이트해야 하나요? 자동으로 업데이트되나요? 92 | 93 | 웹스토어 혹은 애드온 마켓에서 설치하지 않은 확장 프로그램은 자동으로 업데이트되지 않습니다. 확장 프로그램을 새 버전으로 다운로드한 뒤, 다시 설치해주시면 됩니다. 94 | 95 | ### 문의 96 | 97 | [이메일](mailto:seia@outlook.kr) 또는 [트위터](https://twitter.com/equfix)에서 개발자(Seia-Soto)에게 문의를 남길 수 있습니다. 98 | 99 | - [웹사이트](https://seia.io) 100 | -------------------------------------------------------------------------------- /styles/libs/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in iOS. 9 | */ 10 | 11 | html { 12 | line-height: 1.15; /* 1 */ 13 | -webkit-text-size-adjust: 100%; /* 2 */ 14 | } 15 | 16 | /* Sections 17 | ========================================================================== */ 18 | 19 | /** 20 | * Remove the margin in all browsers. 21 | */ 22 | 23 | body { 24 | margin: 0; 25 | } 26 | 27 | /** 28 | * Render the `main` element consistently in IE. 29 | */ 30 | 31 | main { 32 | display: block; 33 | } 34 | 35 | /** 36 | * Correct the font size and margin on `h1` elements within `section` and 37 | * `article` contexts in Chrome, Firefox, and Safari. 38 | */ 39 | 40 | h1 { 41 | font-size: 2em; 42 | margin: 0.67em 0; 43 | } 44 | 45 | /* Grouping content 46 | ========================================================================== */ 47 | 48 | /** 49 | * 1. Add the correct box sizing in Firefox. 50 | * 2. Show the overflow in Edge and IE. 51 | */ 52 | 53 | hr { 54 | box-sizing: content-box; /* 1 */ 55 | height: 0; /* 1 */ 56 | overflow: visible; /* 2 */ 57 | } 58 | 59 | /** 60 | * 1. Correct the inheritance and scaling of font size in all browsers. 61 | * 2. Correct the odd `em` font sizing in all browsers. 62 | */ 63 | 64 | pre { 65 | font-family: monospace, monospace; /* 1 */ 66 | font-size: 1em; /* 2 */ 67 | } 68 | 69 | /* Text-level semantics 70 | ========================================================================== */ 71 | 72 | /** 73 | * Remove the gray background on active links in IE 10. 74 | */ 75 | 76 | a { 77 | background-color: transparent; 78 | } 79 | 80 | /** 81 | * 1. Remove the bottom border in Chrome 57- 82 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 83 | */ 84 | 85 | abbr[title] { 86 | border-bottom: none; /* 1 */ 87 | text-decoration: underline; /* 2 */ 88 | text-decoration: underline dotted; /* 2 */ 89 | } 90 | 91 | /** 92 | * Add the correct font weight in Chrome, Edge, and Safari. 93 | */ 94 | 95 | b, 96 | strong { 97 | font-weight: bolder; 98 | } 99 | 100 | /** 101 | * 1. Correct the inheritance and scaling of font size in all browsers. 102 | * 2. Correct the odd `em` font sizing in all browsers. 103 | */ 104 | 105 | code, 106 | kbd, 107 | samp { 108 | font-family: monospace, monospace; /* 1 */ 109 | font-size: 1em; /* 2 */ 110 | } 111 | 112 | /** 113 | * Add the correct font size in all browsers. 114 | */ 115 | 116 | small { 117 | font-size: 80%; 118 | } 119 | 120 | /** 121 | * Prevent `sub` and `sup` elements from affecting the line height in 122 | * all browsers. 123 | */ 124 | 125 | sub, 126 | sup { 127 | font-size: 75%; 128 | line-height: 0; 129 | position: relative; 130 | vertical-align: baseline; 131 | } 132 | 133 | sub { 134 | bottom: -0.25em; 135 | } 136 | 137 | sup { 138 | top: -0.5em; 139 | } 140 | 141 | /* Embedded content 142 | ========================================================================== */ 143 | 144 | /** 145 | * Remove the border on images inside links in IE 10. 146 | */ 147 | 148 | img { 149 | border-style: none; 150 | } 151 | 152 | /* Forms 153 | ========================================================================== */ 154 | 155 | /** 156 | * 1. Change the font styles in all browsers. 157 | * 2. Remove the margin in Firefox and Safari. 158 | */ 159 | 160 | button, 161 | input, 162 | optgroup, 163 | select, 164 | textarea { 165 | font-family: inherit; /* 1 */ 166 | font-size: 100%; /* 1 */ 167 | line-height: 1.15; /* 1 */ 168 | margin: 0; /* 2 */ 169 | } 170 | 171 | /** 172 | * Show the overflow in IE. 173 | * 1. Show the overflow in Edge. 174 | */ 175 | 176 | button, 177 | input { /* 1 */ 178 | overflow: visible; 179 | } 180 | 181 | /** 182 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 183 | * 1. Remove the inheritance of text transform in Firefox. 184 | */ 185 | 186 | button, 187 | select { /* 1 */ 188 | text-transform: none; 189 | } 190 | 191 | /** 192 | * Correct the inability to style clickable types in iOS and Safari. 193 | */ 194 | 195 | button, 196 | [type="button"], 197 | [type="reset"], 198 | [type="submit"] { 199 | -webkit-appearance: button; 200 | } 201 | 202 | /** 203 | * Remove the inner border and padding in Firefox. 204 | */ 205 | 206 | button::-moz-focus-inner, 207 | [type="button"]::-moz-focus-inner, 208 | [type="reset"]::-moz-focus-inner, 209 | [type="submit"]::-moz-focus-inner { 210 | border-style: none; 211 | padding: 0; 212 | } 213 | 214 | /** 215 | * Restore the focus styles unset by the previous rule. 216 | */ 217 | 218 | button:-moz-focusring, 219 | [type="button"]:-moz-focusring, 220 | [type="reset"]:-moz-focusring, 221 | [type="submit"]:-moz-focusring { 222 | outline: 1px dotted ButtonText; 223 | } 224 | 225 | /** 226 | * Correct the padding in Firefox. 227 | */ 228 | 229 | fieldset { 230 | padding: 0.35em 0.75em 0.625em; 231 | } 232 | 233 | /** 234 | * 1. Correct the text wrapping in Edge and IE. 235 | * 2. Correct the color inheritance from `fieldset` elements in IE. 236 | * 3. Remove the padding so developers are not caught out when they zero out 237 | * `fieldset` elements in all browsers. 238 | */ 239 | 240 | legend { 241 | box-sizing: border-box; /* 1 */ 242 | color: inherit; /* 2 */ 243 | display: table; /* 1 */ 244 | max-width: 100%; /* 1 */ 245 | padding: 0; /* 3 */ 246 | white-space: normal; /* 1 */ 247 | } 248 | 249 | /** 250 | * Add the correct vertical alignment in Chrome, Firefox, and Opera. 251 | */ 252 | 253 | progress { 254 | vertical-align: baseline; 255 | } 256 | 257 | /** 258 | * Remove the default vertical scrollbar in IE 10+. 259 | */ 260 | 261 | textarea { 262 | overflow: auto; 263 | } 264 | 265 | /** 266 | * 1. Add the correct box sizing in IE 10. 267 | * 2. Remove the padding in IE 10. 268 | */ 269 | 270 | [type="checkbox"], 271 | [type="radio"] { 272 | box-sizing: border-box; /* 1 */ 273 | padding: 0; /* 2 */ 274 | } 275 | 276 | /** 277 | * Correct the cursor style of increment and decrement buttons in Chrome. 278 | */ 279 | 280 | [type="number"]::-webkit-inner-spin-button, 281 | [type="number"]::-webkit-outer-spin-button { 282 | height: auto; 283 | } 284 | 285 | /** 286 | * 1. Correct the odd appearance in Chrome and Safari. 287 | * 2. Correct the outline style in Safari. 288 | */ 289 | 290 | [type="search"] { 291 | -webkit-appearance: textfield; /* 1 */ 292 | outline-offset: -2px; /* 2 */ 293 | } 294 | 295 | /** 296 | * Remove the inner padding in Chrome and Safari on macOS. 297 | */ 298 | 299 | [type="search"]::-webkit-search-decoration { 300 | -webkit-appearance: none; 301 | } 302 | 303 | /** 304 | * 1. Correct the inability to style clickable types in iOS and Safari. 305 | * 2. Change font properties to `inherit` in Safari. 306 | */ 307 | 308 | ::-webkit-file-upload-button { 309 | -webkit-appearance: button; /* 1 */ 310 | font: inherit; /* 2 */ 311 | } 312 | 313 | /* Interactive 314 | ========================================================================== */ 315 | 316 | /* 317 | * Add the correct display in Edge, IE 10+, and Firefox. 318 | */ 319 | 320 | details { 321 | display: block; 322 | } 323 | 324 | /* 325 | * Add the correct display in all browsers. 326 | */ 327 | 328 | summary { 329 | display: list-item; 330 | } 331 | 332 | /* Misc 333 | ========================================================================== */ 334 | 335 | /** 336 | * Add the correct display in IE 10+. 337 | */ 338 | 339 | template { 340 | display: none; 341 | } 342 | 343 | /** 344 | * Add the correct display in IE 10. 345 | */ 346 | 347 | [hidden] { 348 | display: none; 349 | } 350 | -------------------------------------------------------------------------------- /scripts/libs/contentScriptsAPIBridge.js: -------------------------------------------------------------------------------- 1 | try { 2 | if (!Range.prototype.hasOwnProperty("intersectsNode")) { 3 | Range.prototype["intersectsNode"] = function (node) { 4 | let range = document.createRange(); 5 | range.selectNode(node); 6 | return 0 > this.compareBoundaryPoints(Range.END_TO_START, range) 7 | && 0 < this.compareBoundaryPoints(Range.START_TO_END, range); 8 | }; 9 | } 10 | } 11 | catch (e) { } 12 | try { 13 | if (!Navigator.prototype.hasOwnProperty("languages")) { 14 | Navigator.prototype["languages"] = [navigator.language]; 15 | } 16 | } 17 | catch (e) { } 18 | var getExtensionProtocol = function () { 19 | if (typeof browser == "undefined") { 20 | if (typeof chrome !== "undefined") 21 | return "chrome-extension://"; 22 | } 23 | else { 24 | return "ms-browser-extension://"; 25 | } 26 | }; 27 | class BridgeAlarmEvent { 28 | constructor() { 29 | this.listeners = new Array(); 30 | } 31 | addListener(callback) { 32 | this.listeners.push(callback); 33 | } 34 | addRules(rules, callback) { } 35 | getRules(ruleIdentifiers, callback) { } 36 | hasListener(callback) { return false; } 37 | hasListeners() { return this.listeners.length > 0; } 38 | removeRules(ruleIdentifiers, callback) { } 39 | removeListener(callback) { } 40 | } 41 | class EdgeBridgeAlarms { 42 | constructor() { 43 | this.alarms = {}; 44 | this.onAlarm = new BridgeAlarmEvent(); 45 | } 46 | create(name, alarmInfo) { 47 | if (arguments.length < 1 || arguments.length > 2) { 48 | throw "Unexpected set of arguments. Expecting (alarmInfo) or (name, alarmInfo)"; 49 | } 50 | var alarmName = ""; 51 | var startMilliseconds = 0; 52 | var startSet = false; 53 | if (typeof name === "string") { 54 | alarmName = name; 55 | } 56 | else if (typeof name === "object") { 57 | alarmInfo = name; 58 | } 59 | else 60 | throw "Unexpected set of arguments. Expecting (alarmInfo) or (name, alarmInfo)"; 61 | if (!alarmInfo) { 62 | throw "You must specify an alarmInfo argument!!"; 63 | } 64 | if (!alarmInfo.when && !alarmInfo.delayInMinutes && !alarmInfo.periodInMinutes) { 65 | throw "Invalid alarmInfo argument!!"; 66 | } 67 | else if (alarmInfo.when && alarmInfo.delayInMinutes) { 68 | throw "Invalid alarmInfo argument!! Either 'when' or 'delayInMinutes' but not both!!"; 69 | } 70 | else if (alarmInfo.when) { 71 | startMilliseconds = alarmInfo.when; 72 | startSet = true; 73 | } 74 | else if (alarmInfo.delayInMinutes) { 75 | startMilliseconds = alarmInfo.delayInMinutes * 60 * 1000; 76 | startSet = true; 77 | } 78 | else if (alarmInfo.periodInMinutes) { 79 | startMilliseconds = alarmInfo.periodInMinutes * 60 * 1000; 80 | startSet = true; 81 | } 82 | else 83 | throw "Invalid alarmInfo argument!!"; 84 | var timerHandle; 85 | if (startSet) { 86 | if (this.alarms[alarmName]) { 87 | this.clearAlarm(alarmName); 88 | } 89 | var alarm = { name: alarmName, scheduledTime: Date.now() + startMilliseconds }; 90 | var alarmAndHandle = { alarm: alarm, timerHandle: 0, startedInterval: false }; 91 | this.alarms[alarmName] = alarmAndHandle; 92 | if (alarmInfo.periodInMinutes) { 93 | this.alarms[alarmName].alarm.periodInMinutes = alarmInfo.periodInMinutes; 94 | this.alarms[alarmName].timerHandle = window.setTimeout(function (alarmName, that) { 95 | that.soundAlarm(alarmName, that); 96 | that.alarms[alarmName].timerHandle = window.setInterval(that.soundAlarm, alarmInfo.periodInMinutes * 60 * 1000, alarmName, that); 97 | that.alarms[alarmName].startedInterval = true; 98 | }, startMilliseconds, alarmName, this); 99 | } 100 | else { 101 | this.alarms[alarmName].timerHandle = window.setTimeout(this.soundAlarm, startMilliseconds, alarmName, this); 102 | } 103 | } 104 | } 105 | getAll(callback) { 106 | for (var key in this.alarms) { 107 | if (this.alarms.hasOwnProperty(key)) { 108 | var alarm = this.alarms[key].alarm; 109 | callback(alarm); 110 | } 111 | } 112 | } 113 | clearAll(callback) { 114 | var clearedAll = true; 115 | for (var key in this.alarms) { 116 | if (this.alarms.hasOwnProperty(key)) { 117 | var alarm = this.alarms[key].alarm; 118 | if (!this.clearAlarm(alarm.name)) { 119 | clearedAll = false; 120 | } 121 | } 122 | } 123 | if (callback) { 124 | callback(clearedAll); 125 | } 126 | } 127 | clear(name, callback) { 128 | var alarmName = ""; 129 | if (typeof name === "string") { 130 | alarmName = name; 131 | } 132 | else if (typeof name === "function") { 133 | callback = name; 134 | } 135 | var wasCleared = this.clearAlarm(alarmName); 136 | if (callback) { 137 | callback(wasCleared); 138 | } 139 | } 140 | get(name, callback) { 141 | if (this.alarms.hasOwnProperty(name)) { 142 | var alarm = this.alarms[name].alarm; 143 | callback(alarm); 144 | } 145 | } 146 | clearAlarm(name) { 147 | var wasCleared = false; 148 | if (this.alarms[name]) { 149 | if (this.alarms[name].alarm.startedInterval) { 150 | window.clearInterval(this.alarms[name].timerHandle); 151 | } 152 | else { 153 | window.clearTimeout(this.alarms[name].timerHandle); 154 | } 155 | delete this.alarms[name]; 156 | wasCleared = true; 157 | } 158 | return wasCleared; 159 | } 160 | soundAlarm(name, that) { 161 | for (var index = 0; index < that.onAlarm.listeners.length; index++) { 162 | var listener = that.onAlarm.listeners[index]; 163 | listener({ name: name }); 164 | } 165 | } 166 | } 167 | class FakeEvent { 168 | addListener(callback) { } 169 | addRules(rules, callback) { } 170 | getRules(ruleIdentifiers, callback) { } 171 | hasListener(callback) { return false; } 172 | hasListeners() { return false; } 173 | removeRules(ruleIdentifiers, callback) { } 174 | removeListener(callback) { } 175 | } 176 | class EdgeBridgeHelper { 177 | constructor() { 178 | this.fakeEvent = new FakeEvent(); 179 | this.alarms = new EdgeBridgeAlarms(); 180 | } 181 | toAbsolutePath(relativePath) { 182 | if (relativePath.indexOf("ms-browser-extension://") == 0) { 183 | return relativePath.replace(myBrowser.runtime.getURL(""), ""); 184 | } 185 | else if (relativePath.indexOf("/") != 0) { 186 | var absolutePath = ""; 187 | var documentPath = document.location.pathname; 188 | absolutePath = documentPath.substring(0, documentPath.lastIndexOf("/") + 1); 189 | absolutePath += relativePath; 190 | return absolutePath; 191 | } 192 | return relativePath; 193 | } 194 | } 195 | var bridgeHelper = new EdgeBridgeHelper(); 196 | class EdgeBridgeDebugLog { 197 | constructor() { 198 | this.CatchOnException = true; 199 | this.VerboseLogging = true; 200 | this.FailedCalls = {}; 201 | this.SuccededCalls = {}; 202 | this.DeprecatedCalls = {}; 203 | this.BridgedCalls = {}; 204 | this.UnavailableApis = {}; 205 | this.EdgeIssues = {}; 206 | } 207 | log(message) { 208 | try { 209 | if (this.VerboseLogging) { 210 | console.log(message); 211 | } 212 | } 213 | catch (e) { 214 | } 215 | } 216 | info(message) { 217 | try { 218 | if (this.VerboseLogging) { 219 | console.info(message); 220 | } 221 | } 222 | catch (e) { 223 | } 224 | } 225 | warn(message) { 226 | try { 227 | if (this.VerboseLogging) { 228 | console.warn(message); 229 | } 230 | } 231 | catch (e) { 232 | } 233 | } 234 | error(message) { 235 | try { 236 | if (this.VerboseLogging) { 237 | console.error(message); 238 | } 239 | } 240 | catch (e) { 241 | } 242 | } 243 | DoActionAndLog(action, name, deprecatedTo, bridgedTo) { 244 | var result; 245 | try { 246 | result = action(); 247 | this.AddToCalledDictionary(this.SuccededCalls, name); 248 | if (typeof deprecatedTo !== "undefined") { 249 | this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!"); 250 | this.AddToCalledDictionary(this.DeprecatedCalls, name); 251 | } 252 | if (typeof bridgedTo !== "undefined") { 253 | this.info("API Call '" + name + "' has been bridged to another Edge API: " + bridgedTo); 254 | this.AddToCalledDictionary(this.BridgedCalls, name); 255 | } 256 | this.info("API Call: '" + name + "'"); 257 | return result; 258 | } 259 | catch (ex) { 260 | this.AddToCalledDictionary(this.FailedCalls, name); 261 | if (this.CatchOnException) 262 | this.error("API Call Failed: " + name + " - " + ex); 263 | else 264 | throw ex; 265 | } 266 | } 267 | LogEdgeIssue(name, message) { 268 | this.warn(message); 269 | this.AddToCalledDictionary(this.EdgeIssues, name); 270 | } 271 | LogUnavailbleApi(name, deprecatedTo) { 272 | this.warn("API Call '" + name + "' is not supported in Edge"); 273 | this.AddToCalledDictionary(this.UnavailableApis, name); 274 | if (typeof deprecatedTo !== "undefined") { 275 | this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!"); 276 | this.AddToCalledDictionary(this.DeprecatedCalls, name); 277 | } 278 | } 279 | AddToCalledDictionary(dictionary, name) { 280 | if (typeof dictionary[name] !== "undefined") { 281 | dictionary[name]++; 282 | } 283 | else { 284 | dictionary[name] = 1; 285 | } 286 | } 287 | } 288 | var bridgeLog = new EdgeBridgeDebugLog(); 289 | class EdgeExtensionBridge { 290 | get inIncognitoContext() { 291 | return bridgeLog.DoActionAndLog(() => { 292 | return myBrowser.extension.inIncognitoContext; 293 | }, "extension.inIncognitoContext"); 294 | } 295 | getBackgroundPage() { 296 | return bridgeLog.DoActionAndLog(() => { 297 | return myBrowser.extension.getBackgroundPage.apply(null, arguments); 298 | }, "extension.getBackgroundPage"); 299 | } 300 | getURL(path) { 301 | return bridgeLog.DoActionAndLog(() => { 302 | return myBrowser.extension.getURL.apply(null, arguments); 303 | }, "extension.getURL"); 304 | } 305 | getViews(fetchProperties) { 306 | return bridgeLog.DoActionAndLog(() => { 307 | return myBrowser.extension.getViews.apply(null, arguments); 308 | }, "extension.getViews"); 309 | } 310 | isAllowedIncognitoAccess(callback) { 311 | return bridgeLog.DoActionAndLog(() => { 312 | return myBrowser.extension.isAllowedIncognitoAccess.apply(null, arguments); 313 | }, "extension.isAllowedIncognitoAccess"); 314 | } 315 | } 316 | class EdgeChromeExtensionBridge extends EdgeExtensionBridge { 317 | get onConnect() { return bridgeLog.DoActionAndLog(() => { return EdgeRuntimeBridge.prototype.onConnect; }, "extension.onConnect", "runtime.onConnect", "runtime.onConnect"); } 318 | get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onMessage", "runtime.onMessage", "runtime.onMessage"); } 319 | get onRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onRequest", "runtime.onMessage", "runtime.onMessage"); } 320 | get onRequestExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "extension.onRequestExternal", "runtime.onMessageExternal", "runtime.onMessageExternal"); } 321 | get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "extension.lastError", undefined, "runtime.lastError"); } 322 | connect(extensionId, connectInfo) { 323 | return bridgeLog.DoActionAndLog(() => { 324 | return EdgeRuntimeBridge.prototype.connect.apply(null, arguments); 325 | }, "extension.connect", "runtime.connect", "runtime.connect"); 326 | } 327 | sendMessage(message, responseCallback) { 328 | return bridgeLog.DoActionAndLog(() => { 329 | return EdgeRuntimeBridge.prototype.sendMessage.apply(null, arguments); 330 | }, "extension.sendMessage", "runtime.sendMessage", "runtime.sendMessage"); 331 | } 332 | sendRequest(extensionId, message, options, responseCallback) { 333 | return bridgeLog.DoActionAndLog(() => { 334 | return EdgeRuntimeBridge.prototype.sendMessage.apply(null, arguments); 335 | }, "extension.sendRequest", "runtime.sendMessage", "runtime.sendMessage"); 336 | } 337 | isAllowedFileSchemeAccess(callback) { 338 | bridgeLog.LogUnavailbleApi("extension.isAllowedFileSchemeAccess"); 339 | } 340 | setUpdateUrlData(data) { 341 | bridgeLog.LogUnavailbleApi("extension.setUpdateUrlData"); 342 | } 343 | } 344 | class EdgeI18nBridge { 345 | getAcceptLanguages(callback) { 346 | return bridgeLog.DoActionAndLog(() => { 347 | return myBrowser.i18n.getAcceptLanguages.apply(null, arguments); 348 | }, "i18n.getAcceptLanguages"); 349 | } 350 | getMessage(messageName, substitutions) { 351 | return bridgeLog.DoActionAndLog(() => { 352 | if (messageName.indexOf("@@extension_id") > -1) { 353 | return myBrowser.runtime.id; 354 | } 355 | return myBrowser.i18n.getMessage.apply(null, arguments); 356 | }, "i18n.getMessage"); 357 | } 358 | getUILanguage() { 359 | return bridgeLog.DoActionAndLog(() => { 360 | return myBrowser.i18n.getUILanguage.apply(null, arguments); 361 | }, "i18n.getUILanguage"); 362 | } 363 | } 364 | class EdgeRuntimeBridge { 365 | get id() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.id; }, "runtime.id"); } 366 | get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "runtime.lastError"); } 367 | get onConnect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onConnect; }, "runtime.onConnect"); } 368 | get onInstalled() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onInstalled; }, "runtime.onInstalled"); } 369 | get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "runtime.onMessage"); } 370 | get onMessageExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "runtime.onMessageExternal"); } 371 | connect(extensionId, connectInfo) { 372 | return bridgeLog.DoActionAndLog(() => { 373 | return myBrowser.runtime.connect.apply(null, arguments); 374 | }, "runtime.connect"); 375 | } 376 | connectNative(application) { 377 | return bridgeLog.DoActionAndLog(() => { 378 | return myBrowser.runtime.connectNative.apply(null, arguments); 379 | }, "runtime.connectNative"); 380 | } 381 | getBackgroundPage(callback) { 382 | bridgeLog.DoActionAndLog(() => { 383 | myBrowser.runtime.getBackgroundPage.apply(null, arguments); 384 | }, "runtime.getBackgroundPage"); 385 | } 386 | getManifest() { 387 | return bridgeLog.DoActionAndLog(() => { 388 | return myBrowser.runtime.getManifest.apply(null, arguments); 389 | }, "runtime.getManifest"); 390 | } 391 | getURL(path) { 392 | return bridgeLog.DoActionAndLog(() => { 393 | return myBrowser.runtime.getURL.apply(null, arguments); 394 | }, "runtime.getURL"); 395 | } 396 | reload() { 397 | bridgeLog.DoActionAndLog(() => { 398 | myBrowser.runtime.reload.apply(null, arguments); 399 | }, "runtime.reload"); 400 | } 401 | sendMessage(extensionId, message, options, responseCallback) { 402 | if (arguments.length === 4) { 403 | Array.prototype.splice.apply(arguments, [2, 1]); 404 | } 405 | bridgeLog.DoActionAndLog(() => { 406 | myBrowser.runtime.sendMessage.apply(null, arguments); 407 | }, "runtime.sendMessage"); 408 | } 409 | sendNativeMessage(application, message, responseCallback) { 410 | bridgeLog.DoActionAndLog(() => { 411 | myBrowser.runtime.sendNativeMessage.apply(null, arguments); 412 | }, "runtime.sendNativeMessage"); 413 | } 414 | setUninstallURL(url, callback) { 415 | bridgeLog.DoActionAndLog(() => { 416 | myBrowser.runtime.setUninstallURL.apply(null, arguments); 417 | }, "runtime.setUninstallURL"); 418 | } 419 | } 420 | class EdgeChromeRuntimeBridge extends EdgeRuntimeBridge { 421 | get onConnectExternal() { bridgeLog.LogUnavailbleApi("runtime.onConnectExternal"); return bridgeHelper.fakeEvent; } 422 | get onRestartRequired() { bridgeLog.LogUnavailbleApi("runtime.onRestartRequired"); return bridgeHelper.fakeEvent; } 423 | get onSuspend() { bridgeLog.LogUnavailbleApi("runtime.onSuspend"); return bridgeHelper.fakeEvent; } 424 | get onSuspendCanceled() { bridgeLog.LogUnavailbleApi("runtime.onSuspendCanceled"); return bridgeHelper.fakeEvent; } 425 | get onUpdateAvailable() { bridgeLog.LogUnavailbleApi("runtime.onUpdateAvailable"); return bridgeHelper.fakeEvent; } 426 | get onStartup() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onCreated; }, "runtime.onStartup", undefined, "windows.onCreated"); } 427 | openOptionsPage(callback) { 428 | bridgeLog.DoActionAndLog(() => { 429 | var optionsPage = myBrowser.runtime.getManifest()["options_page"]; 430 | var optionsPageUrl = myBrowser.runtime.getURL(optionsPage); 431 | if (typeof callback !== "undefined") { 432 | myBrowser.tabs.create({ url: optionsPageUrl }, callback); 433 | } 434 | else { 435 | myBrowser.tabs.create({ url: optionsPageUrl }); 436 | } 437 | }, "runtime.openOptionsPage", undefined, "tabs.create({ url: optionsPageUrl })"); 438 | } 439 | setUninstallURL(url, callback) { 440 | if (myBrowser.runtime.setUninstallURL) { 441 | EdgeRuntimeBridge.prototype.setUninstallURL.apply(null, arguments); 442 | } 443 | else { 444 | bridgeLog.LogUnavailbleApi("runtime.setUninstallURL"); 445 | } 446 | } 447 | getPackageDirectoryEntry(callback) { 448 | bridgeLog.LogUnavailbleApi("runtime.getPackageDirectoryEntry"); 449 | } 450 | getPlatformInfo(callback) { 451 | bridgeLog.LogUnavailbleApi("runtime.getPlatformInfo"); 452 | } 453 | requestUpdateCheck(callback) { 454 | bridgeLog.LogUnavailbleApi("runtime.requestUpdateCheck"); 455 | } 456 | restart() { 457 | bridgeLog.LogUnavailbleApi("runtime.restart"); 458 | } 459 | } 460 | class EdgeStorageBridge { 461 | get local() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.local"); } 462 | get sync() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.sync; }, "storage.sync"); } 463 | get onChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.onChanged; }, "storage.onChanged"); } 464 | } 465 | class EdgeChromeStorageBridge extends EdgeStorageBridge { 466 | get sync() { 467 | if (myBrowser.storage.sync) { 468 | return EdgeStorageBridge.prototype.sync; 469 | } 470 | else { 471 | return bridgeLog.DoActionAndLog(() => { 472 | return myBrowser.storage.local; 473 | }, "storage.sync", undefined, "storage.local"); 474 | } 475 | } 476 | get managed() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.managed", undefined, "storage.local"); } 477 | } 478 | class EdgeContentBridge { 479 | constructor() { 480 | this.extension = typeof browser.extension !== "undefined" ? new EdgeChromeExtensionBridge() : undefined; 481 | this.i18n = typeof browser.i18n !== "undefined" ? new EdgeI18nBridge() : undefined; 482 | this.runtime = typeof browser.runtime !== "undefined" ? new EdgeChromeRuntimeBridge() : undefined; 483 | this.storage = typeof browser.storage !== "undefined" ? new EdgeChromeStorageBridge() : undefined; 484 | } 485 | } 486 | var myBrowser = browser; 487 | var chrome = new EdgeContentBridge(); 488 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright 2019 Seia-Soto 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /scripts/libs/backgroundScriptsAPIBridge.js: -------------------------------------------------------------------------------- 1 | try { 2 | if (!Range.prototype.hasOwnProperty("intersectsNode")) { 3 | Range.prototype["intersectsNode"] = function (node) { 4 | let range = document.createRange(); 5 | range.selectNode(node); 6 | return 0 > this.compareBoundaryPoints(Range.END_TO_START, range) 7 | && 0 < this.compareBoundaryPoints(Range.START_TO_END, range); 8 | }; 9 | } 10 | } 11 | catch (e) { } 12 | try { 13 | if (!Navigator.prototype.hasOwnProperty("languages")) { 14 | Navigator.prototype["languages"] = [navigator.language]; 15 | } 16 | } 17 | catch (e) { } 18 | var getExtensionProtocol = function () { 19 | if (typeof browser == "undefined") { 20 | if (typeof chrome !== "undefined") 21 | return "chrome-extension://"; 22 | } 23 | else { 24 | return "ms-browser-extension://"; 25 | } 26 | }; 27 | class BridgeAlarmEvent { 28 | constructor() { 29 | this.listeners = new Array(); 30 | } 31 | addListener(callback) { 32 | this.listeners.push(callback); 33 | } 34 | addRules(rules, callback) { } 35 | getRules(ruleIdentifiers, callback) { } 36 | hasListener(callback) { return false; } 37 | hasListeners() { return this.listeners.length > 0; } 38 | removeRules(ruleIdentifiers, callback) { } 39 | removeListener(callback) { } 40 | } 41 | class EdgeBridgeAlarms { 42 | constructor() { 43 | this.alarms = {}; 44 | this.onAlarm = new BridgeAlarmEvent(); 45 | } 46 | create(name, alarmInfo) { 47 | if (arguments.length < 1 || arguments.length > 2) { 48 | throw "Unexpected set of arguments. Expecting (alarmInfo) or (name, alarmInfo)"; 49 | } 50 | var alarmName = ""; 51 | var startMilliseconds = 0; 52 | var startSet = false; 53 | if (typeof name === "string") { 54 | alarmName = name; 55 | } 56 | else if (typeof name === "object") { 57 | alarmInfo = name; 58 | } 59 | else 60 | throw "Unexpected set of arguments. Expecting (alarmInfo) or (name, alarmInfo)"; 61 | if (!alarmInfo) { 62 | throw "You must specify an alarmInfo argument!!"; 63 | } 64 | if (!alarmInfo.when && !alarmInfo.delayInMinutes && !alarmInfo.periodInMinutes) { 65 | throw "Invalid alarmInfo argument!!"; 66 | } 67 | else if (alarmInfo.when && alarmInfo.delayInMinutes) { 68 | throw "Invalid alarmInfo argument!! Either 'when' or 'delayInMinutes' but not both!!"; 69 | } 70 | else if (alarmInfo.when) { 71 | startMilliseconds = alarmInfo.when; 72 | startSet = true; 73 | } 74 | else if (alarmInfo.delayInMinutes) { 75 | startMilliseconds = alarmInfo.delayInMinutes * 60 * 1000; 76 | startSet = true; 77 | } 78 | else if (alarmInfo.periodInMinutes) { 79 | startMilliseconds = alarmInfo.periodInMinutes * 60 * 1000; 80 | startSet = true; 81 | } 82 | else 83 | throw "Invalid alarmInfo argument!!"; 84 | var timerHandle; 85 | if (startSet) { 86 | if (this.alarms[alarmName]) { 87 | this.clearAlarm(alarmName); 88 | } 89 | var alarm = { name: alarmName, scheduledTime: Date.now() + startMilliseconds }; 90 | var alarmAndHandle = { alarm: alarm, timerHandle: 0, startedInterval: false }; 91 | this.alarms[alarmName] = alarmAndHandle; 92 | if (alarmInfo.periodInMinutes) { 93 | this.alarms[alarmName].alarm.periodInMinutes = alarmInfo.periodInMinutes; 94 | this.alarms[alarmName].timerHandle = window.setTimeout(function (alarmName, that) { 95 | that.soundAlarm(alarmName, that); 96 | that.alarms[alarmName].timerHandle = window.setInterval(that.soundAlarm, alarmInfo.periodInMinutes * 60 * 1000, alarmName, that); 97 | that.alarms[alarmName].startedInterval = true; 98 | }, startMilliseconds, alarmName, this); 99 | } 100 | else { 101 | this.alarms[alarmName].timerHandle = window.setTimeout(this.soundAlarm, startMilliseconds, alarmName, this); 102 | } 103 | } 104 | } 105 | getAll(callback) { 106 | for (var key in this.alarms) { 107 | if (this.alarms.hasOwnProperty(key)) { 108 | var alarm = this.alarms[key].alarm; 109 | callback(alarm); 110 | } 111 | } 112 | } 113 | clearAll(callback) { 114 | var clearedAll = true; 115 | for (var key in this.alarms) { 116 | if (this.alarms.hasOwnProperty(key)) { 117 | var alarm = this.alarms[key].alarm; 118 | if (!this.clearAlarm(alarm.name)) { 119 | clearedAll = false; 120 | } 121 | } 122 | } 123 | if (callback) { 124 | callback(clearedAll); 125 | } 126 | } 127 | clear(name, callback) { 128 | var alarmName = ""; 129 | if (typeof name === "string") { 130 | alarmName = name; 131 | } 132 | else if (typeof name === "function") { 133 | callback = name; 134 | } 135 | var wasCleared = this.clearAlarm(alarmName); 136 | if (callback) { 137 | callback(wasCleared); 138 | } 139 | } 140 | get(name, callback) { 141 | if (this.alarms.hasOwnProperty(name)) { 142 | var alarm = this.alarms[name].alarm; 143 | callback(alarm); 144 | } 145 | } 146 | clearAlarm(name) { 147 | var wasCleared = false; 148 | if (this.alarms[name]) { 149 | if (this.alarms[name].alarm.startedInterval) { 150 | window.clearInterval(this.alarms[name].timerHandle); 151 | } 152 | else { 153 | window.clearTimeout(this.alarms[name].timerHandle); 154 | } 155 | delete this.alarms[name]; 156 | wasCleared = true; 157 | } 158 | return wasCleared; 159 | } 160 | soundAlarm(name, that) { 161 | for (var index = 0; index < that.onAlarm.listeners.length; index++) { 162 | var listener = that.onAlarm.listeners[index]; 163 | listener({ name: name }); 164 | } 165 | } 166 | } 167 | class FakeEvent { 168 | addListener(callback) { } 169 | addRules(rules, callback) { } 170 | getRules(ruleIdentifiers, callback) { } 171 | hasListener(callback) { return false; } 172 | hasListeners() { return false; } 173 | removeRules(ruleIdentifiers, callback) { } 174 | removeListener(callback) { } 175 | } 176 | class EdgeBridgeHelper { 177 | constructor() { 178 | this.fakeEvent = new FakeEvent(); 179 | this.alarms = new EdgeBridgeAlarms(); 180 | } 181 | toAbsolutePath(relativePath) { 182 | if (relativePath.indexOf("ms-browser-extension://") == 0) { 183 | return relativePath.replace(myBrowser.runtime.getURL(""), ""); 184 | } 185 | else if (relativePath.indexOf("/") != 0) { 186 | var absolutePath = ""; 187 | var documentPath = document.location.pathname; 188 | absolutePath = documentPath.substring(0, documentPath.lastIndexOf("/") + 1); 189 | absolutePath += relativePath; 190 | return absolutePath; 191 | } 192 | return relativePath; 193 | } 194 | } 195 | var bridgeHelper = new EdgeBridgeHelper(); 196 | class EdgeBridgeDebugLog { 197 | constructor() { 198 | this.CatchOnException = true; 199 | this.VerboseLogging = true; 200 | this.FailedCalls = {}; 201 | this.SuccededCalls = {}; 202 | this.DeprecatedCalls = {}; 203 | this.BridgedCalls = {}; 204 | this.UnavailableApis = {}; 205 | this.EdgeIssues = {}; 206 | } 207 | log(message) { 208 | try { 209 | if (this.VerboseLogging) { 210 | console.log(message); 211 | } 212 | } 213 | catch (e) { 214 | } 215 | } 216 | info(message) { 217 | try { 218 | if (this.VerboseLogging) { 219 | console.info(message); 220 | } 221 | } 222 | catch (e) { 223 | } 224 | } 225 | warn(message) { 226 | try { 227 | if (this.VerboseLogging) { 228 | console.warn(message); 229 | } 230 | } 231 | catch (e) { 232 | } 233 | } 234 | error(message) { 235 | try { 236 | if (this.VerboseLogging) { 237 | console.error(message); 238 | } 239 | } 240 | catch (e) { 241 | } 242 | } 243 | DoActionAndLog(action, name, deprecatedTo, bridgedTo) { 244 | var result; 245 | try { 246 | result = action(); 247 | this.AddToCalledDictionary(this.SuccededCalls, name); 248 | if (typeof deprecatedTo !== "undefined") { 249 | this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!"); 250 | this.AddToCalledDictionary(this.DeprecatedCalls, name); 251 | } 252 | if (typeof bridgedTo !== "undefined") { 253 | this.info("API Call '" + name + "' has been bridged to another Edge API: " + bridgedTo); 254 | this.AddToCalledDictionary(this.BridgedCalls, name); 255 | } 256 | this.info("API Call: '" + name + "'"); 257 | return result; 258 | } 259 | catch (ex) { 260 | this.AddToCalledDictionary(this.FailedCalls, name); 261 | if (this.CatchOnException) 262 | this.error("API Call Failed: " + name + " - " + ex); 263 | else 264 | throw ex; 265 | } 266 | } 267 | LogEdgeIssue(name, message) { 268 | this.warn(message); 269 | this.AddToCalledDictionary(this.EdgeIssues, name); 270 | } 271 | LogUnavailbleApi(name, deprecatedTo) { 272 | this.warn("API Call '" + name + "' is not supported in Edge"); 273 | this.AddToCalledDictionary(this.UnavailableApis, name); 274 | if (typeof deprecatedTo !== "undefined") { 275 | this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!"); 276 | this.AddToCalledDictionary(this.DeprecatedCalls, name); 277 | } 278 | } 279 | AddToCalledDictionary(dictionary, name) { 280 | if (typeof dictionary[name] !== "undefined") { 281 | dictionary[name]++; 282 | } 283 | else { 284 | dictionary[name] = 1; 285 | } 286 | } 287 | } 288 | var bridgeLog = new EdgeBridgeDebugLog(); 289 | class EdgeChromeAlarmBridge { 290 | get onAlarm() { 291 | return bridgeLog.DoActionAndLog(() => { 292 | return bridgeHelper.alarms.onAlarm; 293 | }, "alarms.onAlarm", undefined, "bridgeHelper.alarms.onAlarm"); 294 | } 295 | create(name, alarmInfo) { 296 | bridgeLog.DoActionAndLog(() => { 297 | bridgeHelper.alarms.create.apply(bridgeHelper.alarms, arguments); 298 | }, "alarms.create", undefined, "bridgeHelper.alarms.create"); 299 | } 300 | getAll(callback) { 301 | bridgeLog.DoActionAndLog(() => { 302 | bridgeHelper.alarms.getAll.apply(bridgeHelper.alarms, arguments); 303 | }, "alarms.getAll", undefined, "bridgeHelper.alarms.getAll"); 304 | } 305 | clearAll(callback) { 306 | bridgeLog.DoActionAndLog(() => { 307 | bridgeHelper.alarms.clearAll.apply(bridgeHelper.alarms, arguments); 308 | }, "alarms.clearAll", undefined, "bridgeHelper.alarms.clearAll"); 309 | } 310 | clear(name, callback) { 311 | bridgeLog.DoActionAndLog(() => { 312 | bridgeHelper.alarms.clear.apply(bridgeHelper.alarms, arguments); 313 | }, "alarms.clear", undefined, "bridgeHelper.alarms.clear"); 314 | } 315 | get(name, callback) { 316 | bridgeLog.DoActionAndLog(() => { 317 | bridgeHelper.alarms.get.apply(bridgeHelper.alarms, arguments); 318 | }, "alarms.get", undefined, "bridgeHelper.alarms.get"); 319 | } 320 | } 321 | class EdgeChromeAppBridge { 322 | getDetails() { 323 | return bridgeLog.DoActionAndLog(() => { 324 | return EdgeChromeRuntimeBridge.prototype.getManifest.apply(null, arguments); 325 | }, "app.getManifest", undefined, "runtime.getManifest"); 326 | } 327 | get isInstalled() { return bridgeLog.DoActionAndLog(() => { throw "app.isInstalled is not available in Edge"; }, "app.isInstalled"); } 328 | getIsInstalled() { return bridgeLog.DoActionAndLog(() => { throw "app.getIsInstalled is not available in the Edge"; }, "app.getIsInstalled"); } 329 | installState() { return bridgeLog.DoActionAndLog(() => { throw "app.installState is not available in Edge"; }, "app.installState"); } 330 | runningState() { return bridgeLog.DoActionAndLog(() => { throw "app.runningState is not available in Edge"; }, "app.runningState"); } 331 | } 332 | class EdgeBookmarksBridge { 333 | create(bookmark, callback) { 334 | bridgeLog.DoActionAndLog(() => { 335 | myBrowser.bookmarks.create.apply(null, arguments); 336 | }, "bookmarks.create"); 337 | } 338 | getTree(callback) { 339 | bridgeLog.DoActionAndLog(() => { 340 | myBrowser.bookmarks.getTree.apply(null, arguments); 341 | }, "bookmarks.getTree"); 342 | } 343 | move(id, destination, callback) { 344 | bridgeLog.DoActionAndLog(() => { 345 | myBrowser.bookmarks.move.apply(null, arguments); 346 | }, "bookmarks.move"); 347 | } 348 | remove(id, callback) { 349 | bridgeLog.DoActionAndLog(() => { 350 | myBrowser.bookmarks.remove.apply(null, arguments); 351 | }, "bookmarks.remove"); 352 | } 353 | removeTree(id, callback) { 354 | bridgeLog.DoActionAndLog(() => { 355 | myBrowser.bookmarks.removeTree.apply(null, arguments); 356 | }, "bookmarks.removeTree"); 357 | } 358 | update(id, changes, callback) { 359 | bridgeLog.DoActionAndLog(() => { 360 | myBrowser.bookmarks.update.apply(null, arguments); 361 | }, "bookmarks.update"); 362 | } 363 | } 364 | class EdgeChromeBookmarksBridge extends EdgeBookmarksBridge { 365 | get onRemoved() { bridgeLog.LogUnavailbleApi("bookmarks.onRemoved"); return bridgeHelper.fakeEvent; } 366 | get onImportEnded() { bridgeLog.LogUnavailbleApi("bookmarks.onImportEnded"); return bridgeHelper.fakeEvent; } 367 | get onImportBegan() { bridgeLog.LogUnavailbleApi("bookmarks.onImportBegan"); return bridgeHelper.fakeEvent; } 368 | get onChanged() { bridgeLog.LogUnavailbleApi("bookmarks.onChanged"); return bridgeHelper.fakeEvent; } 369 | get onMoved() { bridgeLog.LogUnavailbleApi("bookmarks.onMoved"); return bridgeHelper.fakeEvent; } 370 | get onCreated() { bridgeLog.LogUnavailbleApi("bookmarks.onCreated"); return bridgeHelper.fakeEvent; } 371 | get onChildrenReordered() { bridgeLog.LogUnavailbleApi("bookmarks.onChildrenReordered"); return bridgeHelper.fakeEvent; } 372 | getRecent(numberOfItems, callback) { 373 | bridgeLog.LogUnavailbleApi("bookmarks.getRecent"); 374 | } 375 | get(idList, callback) { 376 | bridgeLog.LogUnavailbleApi("bookmarks.get"); 377 | } 378 | getChildren(id, callback) { 379 | bridgeLog.LogUnavailbleApi("bookmarks.getChildren"); 380 | } 381 | getSubTree(id, callback) { 382 | bridgeLog.LogUnavailbleApi("bookmarks.getSubTree"); 383 | } 384 | search(query, callback) { 385 | bridgeLog.LogUnavailbleApi("bookmarks.search"); 386 | } 387 | } 388 | class EdgeBrowserActionBridge { 389 | get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.browserAction.onClicked; }, "browserAction.onClicked"); } 390 | disable(tabId) { 391 | bridgeLog.DoActionAndLog(() => { 392 | myBrowser.browserAction.disable.apply(null, arguments); 393 | }, "browserAction.disable"); 394 | } 395 | enable(tabId) { 396 | bridgeLog.DoActionAndLog(() => { 397 | myBrowser.browserAction.enable.apply(null, arguments); 398 | }, "browserAction.Enable"); 399 | } 400 | getBadgeBackgroundColor(details, callback) { 401 | bridgeLog.DoActionAndLog(() => { 402 | myBrowser.browserAction.getBadgeBackgroundColor.apply(null, arguments); 403 | }, "browserAction.getBadgeBackgroundColor"); 404 | } 405 | getBadgeText(details, callback) { 406 | bridgeLog.DoActionAndLog(() => { 407 | myBrowser.browserAction.getBadgeText.apply(null, arguments); 408 | ; 409 | }, "browserAction.getBadgeText"); 410 | } 411 | getPopup(details, callback) { 412 | bridgeLog.DoActionAndLog(() => { 413 | myBrowser.browserAction.getPopup.apply(null, arguments); 414 | }, "browserAction.getPopup"); 415 | } 416 | getTitle(details, callback) { 417 | bridgeLog.DoActionAndLog(() => { 418 | myBrowser.browserAction.getTitle.apply(null, arguments); 419 | }, "browserAction.getTitle"); 420 | } 421 | setBadgeBackgroundColor(details) { 422 | bridgeLog.DoActionAndLog(() => { 423 | myBrowser.browserAction.setBadgeBackgroundColor.apply(null, arguments); 424 | }, "browserAction.setBadgeBackgroundColor"); 425 | } 426 | setBadgeText(details) { 427 | bridgeLog.DoActionAndLog(() => { 428 | myBrowser.browserAction.setBadgeText.apply(null, arguments); 429 | }, "browserAction.setBadgeText"); 430 | } 431 | setIcon(details, callback) { 432 | bridgeLog.DoActionAndLog(() => { 433 | myBrowser.browserAction.setIcon.apply(null, arguments); 434 | }, "browserAction.setIcon"); 435 | } 436 | setPopup(details) { 437 | bridgeLog.DoActionAndLog(() => { 438 | myBrowser.browserAction.setPopup.apply(null, arguments); 439 | }, "browserAction.setPopup"); 440 | } 441 | setTitle(details) { 442 | bridgeLog.DoActionAndLog(() => { 443 | myBrowser.browserAction.setTitle.apply(null, arguments); 444 | }, "browserAction.setTitle"); 445 | } 446 | } 447 | class EdgeChromeBrowserActionBridge extends EdgeBrowserActionBridge { 448 | getPopup(details, callback) { 449 | if (myBrowser.browserAction.getPopup) { 450 | EdgeBrowserActionBridge.prototype.getPopup.apply(null, arguments); 451 | } 452 | else { 453 | bridgeLog.LogUnavailbleApi("browserAction.getPopup"); 454 | } 455 | } 456 | getTitle(details, callback) { 457 | if (myBrowser.browserAction.getTitle) { 458 | EdgeBrowserActionBridge.prototype.getTitle.apply(null, arguments); 459 | } 460 | else { 461 | bridgeLog.LogUnavailbleApi("browserAction.getTitle"); 462 | } 463 | } 464 | setTitle(details) { 465 | if (myBrowser.browserAction.setTitle) { 466 | EdgeBrowserActionBridge.prototype.setTitle.apply(null, arguments); 467 | } 468 | else { 469 | bridgeLog.LogUnavailbleApi("browserAction.setTitle"); 470 | } 471 | } 472 | } 473 | class EdgeChromeCommandsBridge { 474 | get onCommand() { bridgeLog.LogUnavailbleApi("commands.onCommand"); return bridgeHelper.fakeEvent; } 475 | getAll(callback) { 476 | bridgeLog.LogUnavailbleApi("commands.getAll"); 477 | } 478 | } 479 | class EdgeContextMenusBridge { 480 | get ACTION_MENU_TOP_LEVEL_LIMIT() { return bridgeLog.DoActionAndLog(() => { return myBrowser.contextMenus.ACTION_MENU_TOP_LEVEL_LIMIT; }, "contextMenus.ACTION_MENU_TOP_LEVEL_LIMIT"); } 481 | get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.contextMenus.onClicked; }, "contextMenus.onClicked"); } 482 | create(createProperties, callback) { 483 | return bridgeLog.DoActionAndLog(() => { 484 | return myBrowser.contextMenus.create.apply(null, arguments); 485 | }, "contextMenus.create"); 486 | } 487 | remove(menuItemId, callback) { 488 | bridgeLog.DoActionAndLog(() => { 489 | myBrowser.contextMenus.remove.apply(null, arguments); 490 | }, "contextMenus.remove"); 491 | } 492 | removeAll(callback) { 493 | bridgeLog.DoActionAndLog(() => { 494 | myBrowser.contextMenus.removeAll.apply(null, arguments); 495 | }, "contextMenus.removeAll"); 496 | } 497 | update(id, updateProperties, callback) { 498 | bridgeLog.DoActionAndLog(() => { 499 | myBrowser.contextMenus.update.apply(null, arguments); 500 | }, "contextMenus.update"); 501 | } 502 | } 503 | class EdgeCookiesBridge { 504 | get(details, callback) { 505 | bridgeLog.DoActionAndLog(() => { 506 | myBrowser.cookies.get.apply(null, arguments); 507 | }, "cookies.get"); 508 | } 509 | getAll(details, callback) { 510 | bridgeLog.DoActionAndLog(() => { 511 | myBrowser.cookies.getAll.apply(null, arguments); 512 | }, "cookies.getAll"); 513 | } 514 | remove(details, callback) { 515 | bridgeLog.DoActionAndLog(() => { 516 | myBrowser.cookies.remove.apply(null, arguments); 517 | }, "cookies.remove"); 518 | } 519 | set(details, callback) { 520 | bridgeLog.DoActionAndLog(() => { 521 | myBrowser.cookies.set.apply(null, arguments); 522 | }, "cookies.set"); 523 | } 524 | } 525 | class EdgeChromeCookiesBridge extends EdgeCookiesBridge { 526 | get onChanged() { bridgeLog.LogUnavailbleApi("cookies.onChanged"); return bridgeHelper.fakeEvent; } 527 | } 528 | class EdgeExtensionBridge { 529 | get inIncognitoContext() { 530 | return bridgeLog.DoActionAndLog(() => { 531 | return myBrowser.extension.inIncognitoContext; 532 | }, "extension.inIncognitoContext"); 533 | } 534 | getBackgroundPage() { 535 | return bridgeLog.DoActionAndLog(() => { 536 | return myBrowser.extension.getBackgroundPage.apply(null, arguments); 537 | }, "extension.getBackgroundPage"); 538 | } 539 | getURL(path) { 540 | return bridgeLog.DoActionAndLog(() => { 541 | return myBrowser.extension.getURL.apply(null, arguments); 542 | }, "extension.getURL"); 543 | } 544 | getViews(fetchProperties) { 545 | return bridgeLog.DoActionAndLog(() => { 546 | return myBrowser.extension.getViews.apply(null, arguments); 547 | }, "extension.getViews"); 548 | } 549 | isAllowedIncognitoAccess(callback) { 550 | return bridgeLog.DoActionAndLog(() => { 551 | return myBrowser.extension.isAllowedIncognitoAccess.apply(null, arguments); 552 | }, "extension.isAllowedIncognitoAccess"); 553 | } 554 | } 555 | class EdgeChromeExtensionBridge extends EdgeExtensionBridge { 556 | get onConnect() { return bridgeLog.DoActionAndLog(() => { return EdgeRuntimeBridge.prototype.onConnect; }, "extension.onConnect", "runtime.onConnect", "runtime.onConnect"); } 557 | get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onMessage", "runtime.onMessage", "runtime.onMessage"); } 558 | get onRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onRequest", "runtime.onMessage", "runtime.onMessage"); } 559 | get onRequestExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "extension.onRequestExternal", "runtime.onMessageExternal", "runtime.onMessageExternal"); } 560 | get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "extension.lastError", undefined, "runtime.lastError"); } 561 | connect(extensionId, connectInfo) { 562 | return bridgeLog.DoActionAndLog(() => { 563 | return EdgeRuntimeBridge.prototype.connect.apply(null, arguments); 564 | }, "extension.connect", "runtime.connect", "runtime.connect"); 565 | } 566 | sendMessage(message, responseCallback) { 567 | return bridgeLog.DoActionAndLog(() => { 568 | return EdgeRuntimeBridge.prototype.sendMessage.apply(null, arguments); 569 | }, "extension.sendMessage", "runtime.sendMessage", "runtime.sendMessage"); 570 | } 571 | sendRequest(extensionId, message, options, responseCallback) { 572 | return bridgeLog.DoActionAndLog(() => { 573 | return EdgeRuntimeBridge.prototype.sendMessage.apply(null, arguments); 574 | }, "extension.sendRequest", "runtime.sendMessage", "runtime.sendMessage"); 575 | } 576 | isAllowedFileSchemeAccess(callback) { 577 | bridgeLog.LogUnavailbleApi("extension.isAllowedFileSchemeAccess"); 578 | } 579 | setUpdateUrlData(data) { 580 | bridgeLog.LogUnavailbleApi("extension.setUpdateUrlData"); 581 | } 582 | } 583 | class EdgeHistoryBridge { 584 | get onVisited() { bridgeLog.LogUnavailbleApi("history.onVisited"); return bridgeHelper.fakeEvent; } 585 | get onVisitRemoved() { bridgeLog.LogUnavailbleApi("history.onVisitRemoved"); return bridgeHelper.fakeEvent; } 586 | addUrl(details, callback) { 587 | bridgeLog.LogUnavailbleApi("history.addUrl"); 588 | } 589 | deleteAll(callback) { 590 | bridgeLog.LogUnavailbleApi("history.deleteAll"); 591 | } 592 | deleteRange(range, callback) { 593 | bridgeLog.LogUnavailbleApi("history.deleteRange"); 594 | } 595 | deleteUrl(details, callback) { 596 | bridgeLog.LogUnavailbleApi("history.deleteUrl"); 597 | } 598 | getVisits(details, callback) { 599 | bridgeLog.LogUnavailbleApi("history.getVisits"); 600 | } 601 | search(query, callback) { 602 | bridgeLog.LogUnavailbleApi("history.search"); 603 | } 604 | } 605 | class EdgeI18nBridge { 606 | getAcceptLanguages(callback) { 607 | return bridgeLog.DoActionAndLog(() => { 608 | return myBrowser.i18n.getAcceptLanguages.apply(null, arguments); 609 | }, "i18n.getAcceptLanguages"); 610 | } 611 | getMessage(messageName, substitutions) { 612 | return bridgeLog.DoActionAndLog(() => { 613 | if (messageName.indexOf("@@extension_id") > -1) { 614 | return myBrowser.runtime.id; 615 | } 616 | return myBrowser.i18n.getMessage.apply(null, arguments); 617 | }, "i18n.getMessage"); 618 | } 619 | getUILanguage() { 620 | return bridgeLog.DoActionAndLog(() => { 621 | return myBrowser.i18n.getUILanguage.apply(null, arguments); 622 | }, "i18n.getUILanguage"); 623 | } 624 | } 625 | class EdgeChromeIdleBridge { 626 | get onStateChanged() { bridgeLog.LogUnavailbleApi("idle.onStateChanged"); return bridgeHelper.fakeEvent; } 627 | queryState(detectionIntervalInSeconds, callback) { 628 | bridgeLog.LogUnavailbleApi("idle.queryState"); 629 | } 630 | setDetectionInterval(intervalInSeconds) { 631 | bridgeLog.LogUnavailbleApi("idle.setDetectionInterval"); 632 | } 633 | } 634 | class EdgeNotificationBridge { 635 | get onButtonClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.notifications.onButtonClicked; }, "notifications.onButtonClicked"); } 636 | get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.notifications.onClicked; }, "notifications.onClicked"); } 637 | get onClosed() { return bridgeLog.DoActionAndLog(() => { return myBrowser.notifications.onClosed; }, "notifications.onClosed"); } 638 | get onPermissionLevelChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.notifications.onPermissionLevelChanged; }, "notifications.onPermissionLevelChanged"); } 639 | get onShowSettings() { bridgeLog.LogUnavailbleApi("notifications.onShowSettings"); return bridgeHelper.fakeEvent; } 640 | clear(notificationId, callback) { 641 | bridgeLog.DoActionAndLog(() => { 642 | myBrowser.notifications.clear.apply(null, arguments); 643 | }, "notifications.clear"); 644 | } 645 | create(notificationId, options, callback) { 646 | bridgeLog.DoActionAndLog(() => { 647 | myBrowser.notifications.create.apply(null, arguments); 648 | }, "notifications.create"); 649 | } 650 | getAll(callback) { 651 | bridgeLog.DoActionAndLog(() => { 652 | myBrowser.notifications.getAll.apply(null, arguments); 653 | }, "notifications.getAll"); 654 | } 655 | getPermissionLevel(callback) { 656 | bridgeLog.DoActionAndLog(() => { 657 | myBrowser.notifications.getPermissionLevel.apply(null, arguments); 658 | }, "notifications.getPermissionLevel"); 659 | } 660 | update(notificationId, options, callback) { 661 | bridgeLog.DoActionAndLog(() => { 662 | myBrowser.notifications.update.apply(null, arguments); 663 | }, "notifications.update"); 664 | } 665 | } 666 | class EdgePageActionBridge { 667 | get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.pageAction.onClicked; }, "pageAction.onClicked"); } 668 | getPopup(details, callback) { 669 | bridgeLog.DoActionAndLog(() => { 670 | myBrowser.pageAction.getPopup.apply(null, arguments); 671 | }, "pageAction.getPopup"); 672 | } 673 | getTitle(details, callback) { 674 | bridgeLog.DoActionAndLog(() => { 675 | myBrowser.pageAction.getTitle.apply(null, arguments); 676 | }, "pageAction.getTitle"); 677 | } 678 | hide(tabId) { 679 | bridgeLog.DoActionAndLog(() => { 680 | myBrowser.pageAction.hide.apply(null, arguments); 681 | }, "pageAction.hide"); 682 | } 683 | setTitle(details) { 684 | bridgeLog.DoActionAndLog(() => { 685 | myBrowser.pageAction.setTitle.apply(null, arguments); 686 | }, "pageAction.setTitle"); 687 | } 688 | setIcon(details, callback) { 689 | bridgeLog.DoActionAndLog(() => { 690 | myBrowser.pageAction.setIcon.apply(null, arguments); 691 | }, "pageAction.setIcon"); 692 | } 693 | setPopup(details) { 694 | bridgeLog.DoActionAndLog(() => { 695 | myBrowser.pageAction.setPopup.apply(null, arguments); 696 | }, "pageAction.setPopup"); 697 | } 698 | show(tabId) { 699 | bridgeLog.DoActionAndLog(() => { 700 | myBrowser.pageAction.show.apply(null, arguments); 701 | }, "pageAction.show"); 702 | } 703 | } 704 | class EdgePermissionsBridge { 705 | get onAdded() { bridgeLog.LogUnavailbleApi("permissions.onAdded"); return bridgeHelper.fakeEvent; } 706 | get onRemoved() { bridgeLog.LogUnavailbleApi("permissions.onRemoved"); return bridgeHelper.fakeEvent; } 707 | contains(permissions, callback) { 708 | bridgeLog.LogUnavailbleApi("permissions.contains"); 709 | } 710 | getAll(callback) { 711 | bridgeLog.LogUnavailbleApi("permissions.getAll"); 712 | } 713 | remove(permissions, callback) { 714 | bridgeLog.LogUnavailbleApi("permissions.remove"); 715 | } 716 | request(permissions, callback) { 717 | bridgeLog.LogUnavailbleApi("permissions.request"); 718 | } 719 | } 720 | class EdgeRuntimeBridge { 721 | get id() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.id; }, "runtime.id"); } 722 | get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "runtime.lastError"); } 723 | get onConnect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onConnect; }, "runtime.onConnect"); } 724 | get onInstalled() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onInstalled; }, "runtime.onInstalled"); } 725 | get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "runtime.onMessage"); } 726 | get onMessageExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "runtime.onMessageExternal"); } 727 | connect(extensionId, connectInfo) { 728 | return bridgeLog.DoActionAndLog(() => { 729 | return myBrowser.runtime.connect.apply(null, arguments); 730 | }, "runtime.connect"); 731 | } 732 | connectNative(application) { 733 | return bridgeLog.DoActionAndLog(() => { 734 | return myBrowser.runtime.connectNative.apply(null, arguments); 735 | }, "runtime.connectNative"); 736 | } 737 | getBackgroundPage(callback) { 738 | bridgeLog.DoActionAndLog(() => { 739 | myBrowser.runtime.getBackgroundPage.apply(null, arguments); 740 | }, "runtime.getBackgroundPage"); 741 | } 742 | getManifest() { 743 | return bridgeLog.DoActionAndLog(() => { 744 | return myBrowser.runtime.getManifest.apply(null, arguments); 745 | }, "runtime.getManifest"); 746 | } 747 | getURL(path) { 748 | return bridgeLog.DoActionAndLog(() => { 749 | return myBrowser.runtime.getURL.apply(null, arguments); 750 | }, "runtime.getURL"); 751 | } 752 | reload() { 753 | bridgeLog.DoActionAndLog(() => { 754 | myBrowser.runtime.reload.apply(null, arguments); 755 | }, "runtime.reload"); 756 | } 757 | sendMessage(extensionId, message, options, responseCallback) { 758 | if (arguments.length === 4) { 759 | Array.prototype.splice.apply(arguments, [2, 1]); 760 | } 761 | bridgeLog.DoActionAndLog(() => { 762 | myBrowser.runtime.sendMessage.apply(null, arguments); 763 | }, "runtime.sendMessage"); 764 | } 765 | sendNativeMessage(application, message, responseCallback) { 766 | bridgeLog.DoActionAndLog(() => { 767 | myBrowser.runtime.sendNativeMessage.apply(null, arguments); 768 | }, "runtime.sendNativeMessage"); 769 | } 770 | setUninstallURL(url, callback) { 771 | bridgeLog.DoActionAndLog(() => { 772 | myBrowser.runtime.setUninstallURL.apply(null, arguments); 773 | }, "runtime.setUninstallURL"); 774 | } 775 | } 776 | class EdgeChromeRuntimeBridge extends EdgeRuntimeBridge { 777 | get onConnectExternal() { bridgeLog.LogUnavailbleApi("runtime.onConnectExternal"); return bridgeHelper.fakeEvent; } 778 | get onRestartRequired() { bridgeLog.LogUnavailbleApi("runtime.onRestartRequired"); return bridgeHelper.fakeEvent; } 779 | get onSuspend() { bridgeLog.LogUnavailbleApi("runtime.onSuspend"); return bridgeHelper.fakeEvent; } 780 | get onSuspendCanceled() { bridgeLog.LogUnavailbleApi("runtime.onSuspendCanceled"); return bridgeHelper.fakeEvent; } 781 | get onUpdateAvailable() { bridgeLog.LogUnavailbleApi("runtime.onUpdateAvailable"); return bridgeHelper.fakeEvent; } 782 | get onStartup() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onCreated; }, "runtime.onStartup", undefined, "windows.onCreated"); } 783 | openOptionsPage(callback) { 784 | bridgeLog.DoActionAndLog(() => { 785 | var optionsPage = myBrowser.runtime.getManifest()["options_page"]; 786 | var optionsPageUrl = myBrowser.runtime.getURL(optionsPage); 787 | if (typeof callback !== "undefined") { 788 | myBrowser.tabs.create({ url: optionsPageUrl }, callback); 789 | } 790 | else { 791 | myBrowser.tabs.create({ url: optionsPageUrl }); 792 | } 793 | }, "runtime.openOptionsPage", undefined, "tabs.create({ url: optionsPageUrl })"); 794 | } 795 | setUninstallURL(url, callback) { 796 | if (myBrowser.runtime.setUninstallURL) { 797 | EdgeRuntimeBridge.prototype.setUninstallURL.apply(null, arguments); 798 | } 799 | else { 800 | bridgeLog.LogUnavailbleApi("runtime.setUninstallURL"); 801 | } 802 | } 803 | getPackageDirectoryEntry(callback) { 804 | bridgeLog.LogUnavailbleApi("runtime.getPackageDirectoryEntry"); 805 | } 806 | getPlatformInfo(callback) { 807 | bridgeLog.LogUnavailbleApi("runtime.getPlatformInfo"); 808 | } 809 | requestUpdateCheck(callback) { 810 | bridgeLog.LogUnavailbleApi("runtime.requestUpdateCheck"); 811 | } 812 | restart() { 813 | bridgeLog.LogUnavailbleApi("runtime.restart"); 814 | } 815 | } 816 | class EdgeStorageBridge { 817 | get local() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.local"); } 818 | get sync() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.sync; }, "storage.sync"); } 819 | get onChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.onChanged; }, "storage.onChanged"); } 820 | } 821 | class EdgeChromeStorageBridge extends EdgeStorageBridge { 822 | get sync() { 823 | if (myBrowser.storage.sync) { 824 | return EdgeStorageBridge.prototype.sync; 825 | } 826 | else { 827 | return bridgeLog.DoActionAndLog(() => { 828 | return myBrowser.storage.local; 829 | }, "storage.sync", undefined, "storage.local"); 830 | } 831 | } 832 | get managed() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.managed", undefined, "storage.local"); } 833 | } 834 | class EdgeTabsBridge { 835 | get onActivated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onActivated; }, "tabs.onActivated"); } 836 | get onAttached() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onAttached; }, "tabs.onAttached"); } 837 | get onCreated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onCreated; }, "tabs.onCreated"); } 838 | get onDetached() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onDetached; }, "tabs.onDetached"); } 839 | get onRemoved() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onRemoved; }, "tabs.onRemoved"); } 840 | get onReplaced() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onReplaced; }, "tabs.onReplaced"); } 841 | get onUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onUpdated; }, "tabs.onUpdated"); } 842 | captureVisibleTab(windowId, options, callback) { 843 | bridgeLog.DoActionAndLog(() => { 844 | myBrowser.tabs.captureVisibleTab.apply(null, arguments); 845 | }, "tabs.captureVisibleTab"); 846 | } 847 | create(createProperties, callback) { 848 | bridgeLog.DoActionAndLog(() => { 849 | myBrowser.tabs.create.apply(null, arguments); 850 | }, "tabs.create"); 851 | } 852 | detectLanguage(tabId, callback) { 853 | bridgeLog.DoActionAndLog(() => { 854 | myBrowser.tabs.detectLanguage.apply(null, arguments); 855 | }, "tabs.detectLanguage"); 856 | } 857 | executeScript(tabId, details, callback) { 858 | bridgeLog.DoActionAndLog(() => { 859 | myBrowser.tabs.executeScript.apply(null, arguments); 860 | }, "tabs.executeScript"); 861 | } 862 | get(tabId, callback) { 863 | bridgeLog.DoActionAndLog(() => { 864 | myBrowser.tabs.get.apply(null, arguments); 865 | }, "tabs.get"); 866 | } 867 | getCurrent(callback) { 868 | bridgeLog.DoActionAndLog(() => { 869 | myBrowser.tabs.getCurrent.apply(null, arguments); 870 | }, "tabs.getCurrent"); 871 | } 872 | insertCSS(tabId, details, callback) { 873 | bridgeLog.DoActionAndLog(() => { 874 | myBrowser.tabs.insertCSS.apply(null, arguments); 875 | }, "tabs.insertCSS"); 876 | } 877 | query(queryInfo, callback) { 878 | bridgeLog.DoActionAndLog(() => { 879 | myBrowser.tabs.query.apply(null, arguments); 880 | }, "tabs.query"); 881 | } 882 | reload(tabId, reloadProperties, callback) { 883 | bridgeLog.DoActionAndLog(() => { 884 | myBrowser.tabs.reload.apply(null, arguments); 885 | }, "tabs.reload"); 886 | } 887 | remove(tabId, callback) { 888 | bridgeLog.DoActionAndLog(() => { 889 | myBrowser.tabs.remove.apply(null, arguments); 890 | }, "tabs.remove"); 891 | } 892 | sendMessage(tabId, message, responseCallback) { 893 | bridgeLog.DoActionAndLog(() => { 894 | myBrowser.tabs.sendMessage.apply(null, arguments); 895 | }, "tabs.sendMessage"); 896 | } 897 | update(tabId, updateProperties, callback) { 898 | var updatePropertiesBridged = false; 899 | for (var index = 0; index < arguments.length; index++) { 900 | var argument = arguments[index]; 901 | if (typeof argument === "object") { 902 | if (!argument.active && (argument.highlighted || argument.selected)) { 903 | argument.active = argument.highlighted || argument.selected; 904 | updatePropertiesBridged = true; 905 | } 906 | } 907 | } 908 | bridgeLog.DoActionAndLog(() => { 909 | myBrowser.tabs.update.apply(null, arguments); 910 | }, "tabs.update", undefined, updatePropertiesBridged ? "tabs.update with UpdateProperties modified" : undefined); 911 | } 912 | } 913 | class EdgeChromeTabsBridge extends EdgeTabsBridge { 914 | get onHighlighted() { bridgeLog.LogUnavailbleApi("tabs.onHighlighted"); return bridgeHelper.fakeEvent; } 915 | get onMoved() { bridgeLog.LogUnavailbleApi("tabs.onMoved"); return bridgeHelper.fakeEvent; } 916 | get onSelectionChanged() { 917 | return bridgeLog.DoActionAndLog(() => { 918 | var fakeEvent = bridgeHelper.fakeEvent; 919 | fakeEvent.addListener = (callback) => { 920 | myBrowser.tabs.onActivated.addListener((activeInfo) => { 921 | callback(activeInfo.tabId, { windowId: activeInfo.windowId }); 922 | }); 923 | }; 924 | return fakeEvent; 925 | }, "tabs.onSelectionChanged", "tabs.onActivated", "tabs.onActivated"); 926 | } 927 | duplicate(tabId, callback) { 928 | bridgeLog.DoActionAndLog(() => { 929 | var tabGetCallback = function (tab) { 930 | if (typeof callback !== "undefined") { 931 | myBrowser.tabs.create({ url: tab.url }, callback); 932 | } 933 | else { 934 | myBrowser.tabs.create({ url: tab.url }); 935 | } 936 | }; 937 | EdgeTabsBridge.prototype.get(tabId, tabGetCallback); 938 | }, "tabs.duplicate", undefined, "tabs.create"); 939 | } 940 | getAllInWindow(windowId, callback) { 941 | bridgeLog.DoActionAndLog(() => { 942 | EdgeTabsBridge.prototype.query({ windowId: windowId }, callback); 943 | }, "tabs.getAllInWindow", "tabs.query", "tabs.query"); 944 | } 945 | getSelected(windowId, callback) { 946 | bridgeLog.DoActionAndLog(() => { 947 | EdgeTabsBridge.prototype.query({ active: true }, (tabs) => callback(tabs[0])); 948 | }, "tabs.getSelected", "tabs.query", "tabs.query"); 949 | } 950 | sendRequest(tabId, request, responseCallback) { 951 | bridgeLog.DoActionAndLog(() => { 952 | EdgeTabsBridge.prototype.sendMessage.apply(null, arguments); 953 | }, "tabs.sendRequest", "tabs.sendMessage", "tabs.sendMessage"); 954 | } 955 | connect(tabId, connectInfo) { 956 | bridgeLog.LogUnavailbleApi("tabs.connect"); 957 | return null; 958 | } 959 | highlight(highlightInfo, callback) { 960 | bridgeLog.LogUnavailbleApi("tabs.highlight"); 961 | } 962 | move(tabId, moveProperties, callback) { 963 | bridgeLog.LogUnavailbleApi("tabs.move"); 964 | } 965 | } 966 | class EdgeWebNavigationBridge { 967 | get onBeforeNavigate() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onBeforeNavigate; }, "webNavigation.onBeforeNavigate"); } 968 | get onCommitted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCommitted; }, "webNavigation.onCommitted"); } 969 | get onCompleted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCompleted; }, "webNavigation.onCompleted"); } 970 | get onCreatedNavigationTarget() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCreatedNavigationTarget; }, "webNavigation.onCreatedNavigationTarget"); } 971 | get onDOMContentLoaded() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onDOMContentLoaded; }, "webNavigation.onDOMContentLoaded"); } 972 | get onErrorOccurred() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onErrorOccurred; }, "webNavigation.onErrorOccurred"); } 973 | get onHistoryStateUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onHistoryStateUpdated; }, "webNavigation.onHistoryStateUpdated"); } 974 | get onReferenceFragmentUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onReferenceFragmentUpdated; }, "webNavigation.onReferenceFragmentUpdated"); } 975 | get onTabReplaced() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onTabReplaced; }, "webNavigation.onTabReplaced"); } 976 | getAllFrames(details, callback) { 977 | bridgeLog.DoActionAndLog(() => { 978 | myBrowser.webNavigation.getAllFrames.apply(null, arguments); 979 | }, "webNavigation.getAllFrames"); 980 | } 981 | getFrame(details, callback) { 982 | bridgeLog.DoActionAndLog(() => { 983 | myBrowser.webNavigation.getFrame.apply(null, arguments); 984 | }, "webNavigation.getFrame"); 985 | } 986 | } 987 | class EdgeWebRequestBridge { 988 | get MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES; }, "webNavigation.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES"); } 989 | get onAuthRequired() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onAuthRequired; }, "webRequest.onAuthRequired"); } 990 | get onBeforeRedirect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeRedirect; }, "webRequest.onBeforeRedirect"); } 991 | get onBeforeRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeRequest; }, "webRequest.onBeforeRequest"); } 992 | get onBeforeSendHeaders() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeSendHeaders; }, "webRequest.onBeforeSendHeaders"); } 993 | get onCompleted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onCompleted; }, "webRequest.onCompleted"); } 994 | get onErrorOccurred() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onErrorOccurred; }, "webRequest.onErrorOccurred"); } 995 | get onHeadersReceived() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onHeadersReceived; }, "webRequest.onHeadersReceived"); } 996 | get onResponseStarted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onResponseStarted; }, "webRequest.onResponseStarted"); } 997 | get onSendHeaders() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onSendHeaders; }, "webRequest.onSendHeaders"); } 998 | handlerBehaviorChanged(callback) { 999 | bridgeLog.DoActionAndLog(() => { 1000 | myBrowser.webRequest.handlerBehaviorChanged.apply(null, arguments); 1001 | }, "webRequest.handlerBehaviorChanged"); 1002 | } 1003 | } 1004 | class EdgeWindowsBridge { 1005 | get WINDOW_ID_CURRENT() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.WINDOW_ID_CURRENT; }, "windows.WINDOW_ID_CURRENT"); } 1006 | get WINDOW_ID_NONE() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.WINDOW_ID_NONE; }, "windows.WINDOW_ID_NONE"); } 1007 | get onCreated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onCreated; }, "windows.onCreated"); } 1008 | get onFocusChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onFocusChanged; }, "windows.onFocusChanged"); } 1009 | get onRemoved() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onRemoved; }, "windows.onRemoved"); } 1010 | create(createData, callback) { 1011 | bridgeLog.DoActionAndLog(() => { 1012 | myBrowser.windows.create.apply(null, arguments); 1013 | }, "windows.create"); 1014 | } 1015 | get(windowId, getInfo, callback) { 1016 | bridgeLog.DoActionAndLog(() => { 1017 | myBrowser.windows.get.apply(null, arguments); 1018 | }, "windows.get"); 1019 | } 1020 | getAll(getInfo, callback) { 1021 | bridgeLog.DoActionAndLog(() => { 1022 | myBrowser.windows.getAll.apply(null, arguments); 1023 | }, "windows.getAll"); 1024 | } 1025 | getCurrent(getInfo, callback) { 1026 | bridgeLog.DoActionAndLog(() => { 1027 | myBrowser.windows.getCurrent.apply(null, arguments); 1028 | }, "windows.getCurrent"); 1029 | } 1030 | getLastFocused(getInfo, callback) { 1031 | bridgeLog.DoActionAndLog(() => { 1032 | myBrowser.windows.getLastFocused.apply(null, arguments); 1033 | }, "windows.getLastFocused"); 1034 | } 1035 | update(windowId, updateInfo, callback) { 1036 | bridgeLog.DoActionAndLog(() => { 1037 | myBrowser.windows.update.apply(null, arguments); 1038 | }, "windows.update"); 1039 | } 1040 | } 1041 | class EdgeChromeWindowsBridge extends EdgeWindowsBridge { 1042 | remove(windowId, callback) { 1043 | bridgeLog.LogUnavailbleApi("windows.remove"); 1044 | } 1045 | } 1046 | class EdgeBackgroundBridge { 1047 | constructor() { 1048 | this.alarms = new EdgeChromeAlarmBridge(); 1049 | this.app = new EdgeChromeAppBridge(); 1050 | this.commands = new EdgeChromeCommandsBridge(); 1051 | this.idle = new EdgeChromeIdleBridge(); 1052 | this.notifications = new EdgeNotificationBridge(); 1053 | this.bookmarks = typeof browser["bookmarks"] !== "undefined" ? new EdgeChromeBookmarksBridge() : undefined; 1054 | this.browserAction = typeof browser.browserAction !== "undefined" ? new EdgeChromeBrowserActionBridge() : undefined; 1055 | this.contextMenus = typeof browser.contextMenus !== "undefined" ? new EdgeContextMenusBridge() : undefined; 1056 | this.cookies = typeof browser.cookies !== "undefined" ? new EdgeChromeCookiesBridge() : undefined; 1057 | this.extension = typeof browser.extension !== "undefined" ? new EdgeChromeExtensionBridge() : undefined; 1058 | this.history = typeof browser.history !== "undefined" ? new EdgeHistoryBridge() : undefined; 1059 | this.i18n = typeof browser.i18n !== "undefined" ? new EdgeI18nBridge() : undefined; 1060 | this.pageAction = typeof browser.pageAction !== "undefined" ? new EdgePageActionBridge() : undefined; 1061 | this.permissions = typeof browser.permissions !== "undefined" ? new EdgePermissionsBridge() : undefined; 1062 | this.runtime = typeof browser.runtime !== "undefined" ? new EdgeChromeRuntimeBridge() : undefined; 1063 | this.storage = typeof browser.storage !== "undefined" ? new EdgeChromeStorageBridge() : undefined; 1064 | this.tabs = typeof browser.tabs !== "undefined" ? new EdgeChromeTabsBridge() : undefined; 1065 | this.webNavigation = typeof browser.webNavigation !== "undefined" ? new EdgeWebNavigationBridge() : undefined; 1066 | this.webRequest = typeof browser.webRequest !== "undefined" ? new EdgeWebRequestBridge() : undefined; 1067 | this.windows = typeof browser.windows !== "undefined" ? new EdgeChromeWindowsBridge() : undefined; 1068 | } 1069 | } 1070 | var myBrowser = browser; 1071 | var chrome = new EdgeBackgroundBridge(); 1072 | --------------------------------------------------------------------------------