├── LICENSE ├── README.md ├── build.bat ├── dev └── images │ ├── icons.svg │ ├── language.svg │ └── redirect.svg ├── src ├── LICENSE.TXT ├── _locales │ ├── en │ │ └── messages.json │ ├── fr │ │ └── messages.json │ ├── pt_BR │ │ └── messages.json │ └── sr │ │ └── messages.json ├── background-common.js ├── background.js ├── bootstrap.js ├── chrome.manifest ├── content-scripts │ └── content.js ├── images │ ├── language.svg │ ├── rb-icon128.png │ ├── rb-icon16.png │ ├── rb-icon48-disable.png │ ├── rb-icon48-enable.png │ ├── rb-icon48.png │ └── rb-icon64.png ├── install.rdf ├── main.js ├── manifest.json ├── options.css ├── options.html ├── options.js ├── siterules.html └── siterules.js └── test └── test-redirectbypasser.html /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Useful to avoid frame pages (e.g., Google images, Yahoo, Bing...) , ads, surveys, unwanted redirects... 2 | 3 | **Features:** 4 | 5 | * Extract links recursively (every URL found are added to a pop-up overlay while hovering the link to let the user choose the best option in a fast way). 6 | 7 | * Decode obfuscated links as "reverse", base64 and hex (tricks used by some sites to prevent direct access to the original web address). 8 | 9 | * Extract web addresses within tag's attributes (e.g. onclick, onmouseover...), text contents and JavaScript: protocol (mostly used to open pop-ups or to show overlays). 10 | 11 | * Extract web addresses from plug-ins (useful to open flash games, videos... in a new tab or to get URL of videos, musics...). 12 | 13 | * Can handle dynamic content (links that move or hide...) very well. 14 | 15 | * The icons are sorted by file extension and auto-set colors based on algorithm used, for the user identify them quickly. As an example, while browsing any site (e.g. Google images) the blue icon was the desired target, another link that show blue icon is likely to be the desired one too. 16 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | cd /d %~dp0 3 | 7za a -mx0 redirectbypasser-chrome.zip ".\src\*" -x!"%C%dev" -x!"%C%bootstrap.js" -x!"%C%chrome.manifest" -x!"%C%install.rdf" 4 | 7za a -mx0 redirectbypasser-mozilla.xpi ".\src\*" -x!"%C%dev" -x!"%C%background.js" -x!"%C%manifest.json" -------------------------------------------------------------------------------- /dev/images/icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 18 | 22 | 23 | 26 | 30 | 31 | 34 | 38 | 39 | 42 | 46 | 47 | 50 | 54 | 55 | 58 | 62 | 63 | 66 | 70 | 71 | 72 | 74 | 75 | 77 | image/svg+xml 78 | 80 | 81 | 82 | 83 | 84 | 87 | 90 | 93 | 97 | 98 | 101 | 105 | 106 | 108 | 111 | 115 | 121 | 122 | 123 | 127 | 131 | 135 | 138 | 143 | 144 | 150 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /dev/images/language.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 18 | 22 | 23 | 24 | 26 | 27 | 29 | image/svg+xml 30 | 32 | 33 | 34 | 35 | 36 | 40 | 44 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /dev/images/redirect.svg: -------------------------------------------------------------------------------- 1 | 2 | 14 | 16 | 18 | 22 | 26 | 27 | 29 | 33 | 37 | 38 | 40 | 44 | 48 | 49 | 51 | 55 | 59 | 60 | 62 | 66 | 70 | 71 | 74 | 78 | 79 | 82 | 86 | 90 | 91 | 94 | 98 | 99 | 101 | 105 | 106 | 108 | 112 | 116 | 117 | 119 | 123 | 127 | 128 | 135 | 140 | 145 | 151 | 153 | 156 | 159 | 160 | 161 | 164 | 168 | 169 | 172 | 176 | 177 | 180 | 184 | 185 | 188 | 192 | 193 | 196 | 200 | 201 | 204 | 208 | 209 | 218 | 227 | 236 | 245 | 254 | 255 | 257 | 258 | 260 | image/svg+xml 261 | 263 | 264 | 265 | 266 | 267 | 270 | 274 | 277 | 281 | 285 | 289 | 293 | 297 | 301 | 305 | 306 | 307 | -------------------------------------------------------------------------------- /src/LICENSE.TXT: -------------------------------------------------------------------------------- 1 | Copyright 2016 Moises Lima 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /src/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extShortDesc": { 3 | "description": "this will be in the chrome web store: must be 132 characters or less", 4 | "message": "Avoid redirects and has direct access to the sites you want to visit." 5 | }, 6 | "General": { 7 | "message": "General" 8 | }, 9 | "Style": { 10 | "message": "Style" 11 | }, 12 | "Advanced": { 13 | "message": "Advanced" 14 | }, 15 | "Sites": { 16 | "message": "Sites" 17 | }, 18 | "highlightLink": { 19 | "message": "Highlight active link on the page" 20 | }, 21 | "openInNewPage": { 22 | "message": "Open in new page" 23 | }, 24 | "openInNewPage0": { 25 | "message": "Default Browser behavior" 26 | }, 27 | "openInNewPage1": { 28 | "message": "Open in new tab" 29 | }, 30 | "openInNewPage2": { 31 | "message": "Open in background tab" 32 | }, 33 | "menuEnable": { 34 | "message": "Enable menu" 35 | }, 36 | "menuHideIfSingleRedir": { 37 | "message": "Hide the menu if the URL has a single redirect" 38 | }, 39 | "replaceUrl": { 40 | "message": "Replace URL of the link" 41 | }, 42 | "replaceOnlySingleRedir": { 43 | "message": "Only if the URL has a single redirect" 44 | }, 45 | "useFallbackRule": { 46 | "message": "Use an alternate fallback method if no rules is set for the link" 47 | }, 48 | "Manage_rules": { 49 | "message": "Manage rules" 50 | }, 51 | "Keyboard_shortcuts": { 52 | "message": "Keyboard shortcuts" 53 | }, 54 | "keyboard_tip": { 55 | "message": "The option \"Keyboard shortcut to show the menu\" controls the menu visibility.\nUsage:\n* Press while the cursor is over any link in the page.\n** Press while click any icon on menu popup." 56 | }, 57 | "keysShowPopup": { 58 | "message": "Keyboard shortcut to show the menu" 59 | }, 60 | "keysOpenAsDownload": { 61 | "message": "Open link as download" 62 | }, 63 | "keysPreventReferrer": { 64 | "message": "Stop link from sending referrer. Useful to avoid 403/Forbidden pages" 65 | }, 66 | "keysAddSiterule": { 67 | "message": "Add rule to the link" 68 | }, 69 | "keysToggleEnable": { 70 | "message": "Enable/disable the extension" 71 | }, 72 | "keysToggleEnableTemp": { 73 | "message": "Enable/disable the extension (current page only)" 74 | }, 75 | "Menu": { 76 | "message": "Menu" 77 | }, 78 | "menuShowDelay": { 79 | "message": "Show delay (ms)" 80 | }, 81 | "menuHideDelay": { 82 | "message": "Hide delay (ms)" 83 | }, 84 | "menuOpacity": { 85 | "message": "Opacity" 86 | }, 87 | "menuOpacityHover": { 88 | "message": "Opacity (hover)" 89 | }, 90 | "menuShadowDepth": { 91 | "message": "Shadow depth" 92 | }, 93 | "Icons": { 94 | "message": "Icons" 95 | }, 96 | "iconSize": { 97 | "message": "Size (px)" 98 | }, 99 | "Tooltip": { 100 | "message": "Tooltip" 101 | }, 102 | "tooltipFontSize": { 103 | "message": "Font size (px)" 104 | }, 105 | "tooltipColor": { 106 | "message": "Color" 107 | }, 108 | "tooltipBackgroundColor": { 109 | "message": "Background color" 110 | }, 111 | "tooltipShowIcon": { 112 | "message": "Show favicon" 113 | }, 114 | "Protocols": { 115 | "message": "Protocols" 116 | }, 117 | "Methods": { 118 | "message": "Methods" 119 | }, 120 | "useDeobfuscator": { 121 | "message": "Obfuscated (Hex, Base64...)" 122 | }, 123 | "getFromTagText": { 124 | "message": "Text content" 125 | }, 126 | "getFromPlugins": { 127 | "message": "Plugins" 128 | }, 129 | "getFromAttributes": { 130 | "message": "Attributes (onclick, onmouseover...)" 131 | }, 132 | "Excluded_attr": { 133 | "message": "Ignored attributes" 134 | }, 135 | "maxCaptureRecursion": { 136 | "message": "Maximum capture recursion depth on a single link" 137 | }, 138 | "watchNodeInserted": { 139 | "message": "Check content inserted, after page load" 140 | }, 141 | "watchAttrModified": { 142 | "message": "Detect attribute changes" 143 | }, 144 | "Extension_sort_order": { 145 | "message": "Extension sort order" 146 | }, 147 | "Rules": { 148 | "message": "Rules" 149 | }, 150 | "siterules_tip": { 151 | "message": "Rules also are added by using the shortcut set in General > Keys > Add rule to the link.\n\nPatterns: URL of the link (use * as wildcard). Use to matches any TLD (com, org, net, gov...).\n\nParameters:\n1. Any query string parameter.\n Example: imgrefurl matches ...&imgrefurl=http://example.com.\n2. @attribute-name: matches an attribute.\n Example: @onclick, @onmouseover...\n3. *.extension: matches a extension.\n Example: *.jpg, *.mp4...\n4. #extraction-method: matches a extraction method (#base64, #hex, #reverse, #text, #javascript, #forced).\n5. Parameters except extensions can be mixed in the same field with commas.\n Example: \"@attribute,src\" matches if contains @attribute followed by src.\n Does not work: \"@attribute,*.avi\", \"*.mp3,*.avi\"...\n\nThe processing order of the rules is according as they are shown on configuration page." 152 | }, 153 | "Patterns_parameters": { 154 | "message": "Patterns / parameters" 155 | }, 156 | "Add_rule": { 157 | "message": "Add rule" 158 | }, 159 | "Add_default_rules": { 160 | "message": "Add default rules" 161 | }, 162 | "Ignore": { 163 | "message": "Ignore" 164 | }, 165 | "Patterns": { 166 | "message": "Patterns" 167 | }, 168 | "Parameters": { 169 | "message": "Parameters" 170 | }, 171 | "Add_rule": { 172 | "message": "Add rule" 173 | }, 174 | "Pattern": { 175 | "message": "Pattern" 176 | }, 177 | "Behavior": { 178 | "message": "Behavior" 179 | }, 180 | "siteruleBehaviorOriginal": { 181 | "message": "Use original URL" 182 | }, 183 | "siteruleBehaviorIgnore": { 184 | "message": "Ignore this URL" 185 | }, 186 | "About": { 187 | "message": "About" 188 | }, 189 | "Changelog": { 190 | "message": "Changelog" 191 | }, 192 | "Source_code": { 193 | "message": "Source code" 194 | }, 195 | "Contributors": { 196 | "message": "Contributors" 197 | }, 198 | "Contribute": { 199 | "message": "Contribute" 200 | }, 201 | "Language": { 202 | "message": "Language" 203 | }, 204 | "Auto": { 205 | "message": "Auto-select" 206 | }, 207 | "Save": { 208 | "message": "Save" 209 | }, 210 | "Close": { 211 | "message": "Close" 212 | }, 213 | "Reset": { 214 | "message": "Reset" 215 | }, 216 | "testArea": { 217 | "message": "Test area" 218 | }, 219 | "ON": { 220 | "message": "ON" 221 | }, 222 | "OFF": { 223 | "message": "OFF" 224 | }, 225 | "Donate_paypal": { 226 | "message": "Donate with Paypal" 227 | }, 228 | "Rate_it": { 229 | "message": "Rate it" 230 | }, 231 | "Translation": { 232 | "message": "Translation" 233 | } 234 | } -------------------------------------------------------------------------------- /src/_locales/fr/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extShortDesc": { 3 | "description": "this will be in the chrome web store: must be 132 characters or less", 4 | "message": "Contourne les redirections en donnant accès aux liens directs." 5 | }, 6 | "General": { 7 | "message": "G\u00e9n\u00e9ral" 8 | }, 9 | "Style": { 10 | "message": "Style" 11 | }, 12 | "Advanced": { 13 | "message": "Avanc\u00e9" 14 | }, 15 | "Sites": { 16 | "message": "Sites" 17 | }, 18 | "highlightLink": { 19 | "message": "Surligner le lien actif sur la page" 20 | }, 21 | "openInNewPage": { 22 | "message": "Ouvrir le lien dans\u00a0:" 23 | }, 24 | "openInNewPage0": { 25 | "message": "Comportement par d\u00e9faut du navigateur" 26 | }, 27 | "openInNewPage1": { 28 | "message": "Onglet au premier plan" 29 | }, 30 | "openInNewPage2": { 31 | "message": "Onglet en arri\u00e8re-plan" 32 | }, 33 | "menuEnable": { 34 | "message": "Afficher le menu" 35 | }, 36 | "menuHideIfSingleRedir": { 37 | "message": "Ne pas afficher le menu si l\u2019adresse a une seule redirection" 38 | }, 39 | "replaceUrl": { 40 | "message": "Remplacer l\u2019adresse du lien" 41 | }, 42 | "replaceOnlySingleRedir": { 43 | "message": "Remplacer l\u2019adresse du lien uniquement si elle a une seule redirection" 44 | }, 45 | "useFallbackRule": { 46 | "message": "Utiliser une solution de repli si aucune r\u00e8gle n\u2019est d\u00e9finie pour le lien" 47 | }, 48 | "Manage_rules": { 49 | "message": "g\u00e9rer les r\u00e8gles" 50 | }, 51 | "Keyboard_shortcuts": { 52 | "message": "Raccourcis clavier" 53 | }, 54 | "keyboard_tip": { 55 | "message": "Le raccourci pour \u00ab\u00a0Affichage du menu\u00a0\u00bb contr\u00f4le l\u2019apparition du menu.\nEmploi\u00a0:\n* Presser alors que le curseur est au-dessus d\u2019un lien sur la page.\n** Presser tout en cliquant sur une des ic\u00f4nes du menu." 56 | }, 57 | "keysShowPopup": { 58 | "message": "Affichage du menu\u00a0:" 59 | }, 60 | "keysOpenAsDownload": { 61 | "message": "Ouverture du lien en tant que t\u00e9l\u00e9chargement\u00a0:" 62 | }, 63 | "keysPreventReferrer": { 64 | "message": "Blocage de l\u2019envoi du r\u00e9f\u00e9rent (utile pour \u00e9viter les pages \u00ab\u00a0403 : acc\u00e8s refus\u00e9\u00a0\u00bb)\u00a0:" 65 | }, 66 | "keysAddSiterule": { 67 | "message": "Ajout d\u2019une r\u00e8gle pour le lien\u00a0:" 68 | }, 69 | "keysToggleEnable": { 70 | "message": "Activation ou d\u00e9sactivation de l\u2019extension\u00a0:" 71 | }, 72 | "keysToggleEnableTemp": { 73 | "message": "Activation ou d\u00e9sactivation de l\u2019extension (page active uniquement)\u00a0:" 74 | }, 75 | "Menu": { 76 | "message": "Menu" 77 | }, 78 | "menuShowDelay": { 79 | "message": "D\u00e9lai d\u2019apparition (ms)\u00a0:" 80 | }, 81 | "menuHideDelay": { 82 | "message": "D\u00e9lai de disparition (ms)\u00a0:" 83 | }, 84 | "menuOpacity": { 85 | "message": "Opacit\u00e9\u00a0:" 86 | }, 87 | "menuOpacityHover": { 88 | "message": "Opacit\u00e9 (survol)\u00a0:" 89 | }, 90 | "menuShadowDepth": { 91 | "message": "Ombre\u00a0:" 92 | }, 93 | "Icons": { 94 | "message": "Ic\u00f4nes" 95 | }, 96 | "iconSize": { 97 | "message": "Taille (pixels)\u00a0:" 98 | }, 99 | "Tooltip": { 100 | "message": "Info-bulle" 101 | }, 102 | "tooltipFontSize": { 103 | "message": "Taille de la police (pixels)\u00a0:" 104 | }, 105 | "tooltipColor": { 106 | "message": "Couleur du texte\u00a0:" 107 | }, 108 | "tooltipBackgroundColor": { 109 | "message": "Couleur du fond\u00a0:" 110 | }, 111 | "tooltipShowIcon": { 112 | "message": "Afficher le favicon" 113 | }, 114 | "Protocols": { 115 | "message": "Protocoles" 116 | }, 117 | "Methods": { 118 | "message": "M\u00e9thodes d\u2019extraction des adresses" 119 | }, 120 | "useDeobfuscator": { 121 | "message": "Brouill\u00e9es (hex, base64, etc.)\u00a0:" 122 | }, 123 | "getFromTagText": { 124 | "message": "Contenu texte\u00a0:" 125 | }, 126 | "getFromPlugins": { 127 | "message": "Greffons\u00a0:" 128 | }, 129 | "getFromAttributes": { 130 | "message": "Attributs (onclick, onmouseover, etc.)\u00a0:" 131 | }, 132 | "Excluded_attr": { 133 | "message": "Attributs ignor\u00e9s" 134 | }, 135 | "maxCaptureRecursion": { 136 | "message": "Profondeur maximale d\u2019extraction d\u2019un lien\u00a0:" 137 | }, 138 | "watchNodeInserted": { 139 | "message": "V\u00e9rifier le contenu ins\u00e9r\u00e9 au chargement de la page" 140 | }, 141 | "watchAttrModified": { 142 | "message": "D\u00e9tecter les changements d\u2019attributs" 143 | }, 144 | "Extension_sort_order": { 145 | "message": "Classement des extensions" 146 | }, 147 | "Rules": { 148 | "message": "R\u00e8gles" 149 | }, 150 | "siterules_tip": { 151 | "message": "Il est \u00e9galement possible d\u2019ajouter une r\u00e8gle pour un lien en utilisant le raccourci clavier d\u00e9fini \u00e0 la rubrique \u00ab\u00a0G\u00e9n\u00e9ral\u00a0\u00bb.\n\nMotif\u00a0: adresse du lien (utiliser * comme caract\u00e8re de remplacement)\u00a0; correspond \u00e0 n\u2019importe quel domaine de premier niveau (com, org, net, gov, ...).\n\nParam\u00e8tres\u00a0:\n1. Toute cha\u00ecne de requ\u00eate.\n Exemple\u00a0: imgrefurl correspond \u00e0 ...&imgrefurl=http://example.com.\n2. @nom-attribut correspond \u00e0 un attribut.\n Exemples\u00a0: @onclick, @onmouseover, ...\n3. *.extension correspond \u00e0 une extension.\n Exemples\u00a0: *.jpg, *.mp4, ...\n4. #m\u00e9thode-extraction correspond \u00e0 une m\u00e9thode d\u2019extraction (#base64, #hex, #reverse, #text, #javascript, #forced).\n5. Plusieurs param\u00e8tres, except\u00e9 les extensions, peuvent \u00eatre juxtapos\u00e9s dans le m\u00eame champ en les s\u00e9parant par une virgule.\n Exemple\u00a0: \u00ab\u00a0@attribute,src\u00a0\u00bb \u00e9quivaut \u00e0 @attribute suivi de src.\n Contre-exemples\u00a0: \u00ab\u00a0@attribute,*.avi\u00a0\u00bb, \u00ab\u00a0*.mp3,*.avi\u00a0\u00bb, ...\n\nLes r\u00e8gles sont trait\u00e9es dans l\u2019ordre qu\u2019elles occupent sur la page de configuration." 152 | }, 153 | "Patterns_parameters": { 154 | "message": "Motif et param\u00e8tres\u00a0:" 155 | }, 156 | "Add_rule": { 157 | "message": "Ajouter une r\u00e8gle" 158 | }, 159 | "Add_default_rules": { 160 | "message": "Ajouter les r\u00e8gles par d\u00e9faut" 161 | }, 162 | "Ignore": { 163 | "message": "Exclusions" 164 | }, 165 | "Patterns": { 166 | "message": "Motif\u00a0:" 167 | }, 168 | "Parameters": { 169 | "message": "Param\u00e8tres\u00a0" 170 | }, 171 | "Add_rule": { 172 | "message": "Ajouter une r\u00e8gle" 173 | }, 174 | "Pattern": { 175 | "message": "Motif" 176 | }, 177 | "Behavior": { 178 | "message": "Comportement" 179 | }, 180 | "siteruleBehaviorOriginal": { 181 | "message": "Utiliser l\u2019adresse originale" 182 | }, 183 | "siteruleBehaviorIgnore": { 184 | "message": "Ignorer cette adresse" 185 | }, 186 | "About": { 187 | "message": "\u00c0 propos" 188 | }, 189 | "Changelog": { 190 | "message": "Historique" 191 | }, 192 | "Source_code": { 193 | "message": "Code source" 194 | }, 195 | "Contributors": { 196 | "message": "Contributeurs" 197 | }, 198 | "Language": { 199 | "message": "Langue" 200 | }, 201 | "Auto": { 202 | "message": "Automatique" 203 | }, 204 | "Save": { 205 | "message": "Enregistrer" 206 | }, 207 | "Close": { 208 | "message": "Fermer" 209 | }, 210 | "Reset": { 211 | "message": "R\u00e9initialiser" 212 | }, 213 | "testArea": { 214 | "message": "Zone de test" 215 | }, 216 | "ON": { 217 | "message": "MARCHE" 218 | }, 219 | "OFF": { 220 | "message": "ARR\u00caT" 221 | }, 222 | "Donate_paypal": { 223 | "message": "Faire un don par Paypal" 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /src/_locales/pt_BR/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extShortDesc": { 3 | "description": "this will be in the chrome web store: must be 132 characters or less", 4 | "message": "Evite redirecionamentos e tenha acesso direto aos sites que você quer visitar." 5 | }, 6 | "General": { 7 | "message": "Geral" 8 | }, 9 | "Style": { 10 | "message": "Estilo" 11 | }, 12 | "Advanced": { 13 | "message": "Avan\u00E7ado" 14 | }, 15 | "Sites": { 16 | "message": "Sites" 17 | }, 18 | "highlightLink": { 19 | "message": "Destacar link ativo na p\u00E1gina" 20 | }, 21 | "openInNewPage": { 22 | "message": "Abrir links em nova p\u00E1gina" 23 | }, 24 | "openInNewPage0": { 25 | "message": "Padr\u00E3o do navegador" 26 | }, 27 | "openInNewPage1": { 28 | "message": "Abrir em nova aba" 29 | }, 30 | "openInNewPage2": { 31 | "message": "Abrir em segundo plano" 32 | }, 33 | "menuEnable": { 34 | "message": "Ativar menu" 35 | }, 36 | "menuHideIfSingleRedir": { 37 | "message": "Esconder o menu se o link tem apenas uma op\u00E7\u00E3o de redirecionamento" 38 | }, 39 | "replaceUrl": { 40 | "message": "Substituir URL do link" 41 | }, 42 | "replaceOnlySingleRedir": { 43 | "message": "Somente se o link tem apenas uma op\u00E7\u00E3o de redirecionamento" 44 | }, 45 | "useFallbackRule": { 46 | "message": "Usar um plano alternativo quando n\u00E3o houver regras para um link" 47 | }, 48 | "Manage_rules": { 49 | "message": "Configurar regras" 50 | }, 51 | "Keys": { 52 | "message": "Atalhos de teclado" 53 | }, 54 | "keyboard_tip": { 55 | "message": "A op\u00E7\u00E3o \"Tecla de atalho para mostrar o menu\" controla a visibilidade do menu.\nUtiliza\u00E7\u00E3o:\n* Pressione enquanto o cursor esta sobre o link na p\u00E1gina.\n** Pressione enquanto clica em algum \u00EDcone no menu popup." 56 | }, 57 | "keysShowPopup": { 58 | "message": "Tecla de atalho para mostrar o menu" 59 | }, 60 | "keysOpenAsDownload": { 61 | "message": "Abrir link como download" 62 | }, 63 | "keysPreventReferrer": { 64 | "message": "Bloqueiar o envio de \"referrer\". \u00DAtil para evitar p\u00E1ginas 403/Forbidden" 65 | }, 66 | "keysAddSiterule": { 67 | "message": "Adicionar regra para o link" 68 | }, 69 | "keysToggleEnable": { 70 | "message": "Ativar/desativar a extens\u00E3o" 71 | }, 72 | "keysToggleEnableTemp": { 73 | "message": "Ativar/desativar a extens\u00E3o (somente na p\u00E1gina atual)" 74 | }, 75 | "Menu": { 76 | "message": "Menu" 77 | }, 78 | "menuShowDelay": { 79 | "message": "Atraso antes de mostrar (ms)" 80 | }, 81 | "menuHideDelay": { 82 | "message": "Atraso antes de esconder (ms)" 83 | }, 84 | "menuOpacity": { 85 | "message": "Opacidade" 86 | }, 87 | "menuOpacityHover": { 88 | "message": "Opacidade (Mouse sobre)" 89 | }, 90 | "menuShadowDepth": { 91 | "message": "Sombra" 92 | }, 93 | "Icons": { 94 | "message": "\u00CDcones" 95 | }, 96 | "iconSize": { 97 | "message": "Tamanho (pixel)" 98 | }, 99 | "Tooltip": { 100 | "message": "Dica de contexto" 101 | }, 102 | "tooltipFontSize": { 103 | "message": "Tamanho da fonte (pixel)" 104 | }, 105 | "tooltipColor": { 106 | "message": "Cor do texto" 107 | }, 108 | "tooltipBackgroundColor": { 109 | "message": "Cor do plano de fundo" 110 | }, 111 | "tooltipShowIcon": { 112 | "message": "Mostrar favicon" 113 | }, 114 | "Protocols": { 115 | "message": "Lista de protocolos" 116 | }, 117 | "Methods": { 118 | "message": "M\u00E9todos" 119 | }, 120 | "useDeobfuscator": { 121 | "message": "Protetores de links" 122 | }, 123 | "getFromTagText": { 124 | "message": "Texto do link" 125 | }, 126 | "getFromPlugins": { 127 | "message": "Plugins" 128 | }, 129 | "getFromAttributes": { 130 | "message": "Atributos do link (onclick, onmouseover...)" 131 | }, 132 | "Excluded_attr": { 133 | "message": "Atributos ignorados" 134 | }, 135 | "maxCaptureRecursion": { 136 | "message": "N\u00FAmero m\u00E1ximo de recurs\u00F5es permitido para a captura em um \u00FAnico link" 137 | }, 138 | "watchNodeInserted": { 139 | "message": "Verificar conte\u00FAdo inserido ap\u00F3s carregamento da p\u00E1gina" 140 | }, 141 | "watchAttrModified": { 142 | "message": "Verificar atributos modificados ap\u00F3s carregamento da p\u00E1gina" 143 | }, 144 | "Extension_sort_order": { 145 | "message": "Ordem de classifica\u00E7\u00E3o de extens\u00F5es" 146 | }, 147 | "Rules": { 148 | "message": "Regras" 149 | }, 150 | "siterules_tip": { 151 | "message": "Regras tamb\u00E9m podem ser adicionadas usando o atalho configurado em Geral > Atalhos de teclado > Adicionar regra para o link.\n\nModelos de URL: URL do link (use * como caractere-curinga). Use para combinar com qualquer TLD (com, org, net, gov...).\n\nPar\u00E2metros:\n1. Algum par\u00E2metro da \"query string\" da URL.\n Ex: imgrefurl corresponde a ...&imgrefurl=http://example.com.\n2. @nome-do-atributo: corresponde a um atributo.\n Ex: @onclick, @onmouseover...\n3. *.extens\u00E3o: corresponde a uma extens\u00E3o.\n Ex: *.jpg, *.mp4...\n4. #m\u00E9todo-de-extra\u00E7\u00E3o: corresponde a um m\u00E9todo de extra\u00E7\u00E3o (#base64, #hex, #reverse, #text, #javascript, #forced).\n5. Par\u00E2metros, exceto extens\u00F5es podem ser misturados no mesmo campo usando v\u00EDrgulas\n Ex: \"@attribute,src\" combina se contem @attribute seguido por src.\n N\u00E3o funciona: \"@attribute,*.avi\", \"*.mp3,*.avi\"...\n\nA ordem de processamento das regras \u00E9 de acordo como s\u00E3o exibidas na p\u00E1gina de configura\u00E7\u00E3o." 152 | }, 153 | "Patterns_parameters": { 154 | "message": "Modelos de URL / Par\u00E2metros" 155 | }, 156 | "Add_rule": { 157 | "message": "Adicionar Regra" 158 | }, 159 | "Add_default_rules": { 160 | "message": "Adicionar Regras padr\u00E3o" 161 | }, 162 | "Ignore": { 163 | "message": "Ignorar" 164 | }, 165 | "Patterns": { 166 | "message": "Modelos de URL" 167 | }, 168 | "Parameters": { 169 | "message": "Par\u00E2metros" 170 | }, 171 | "Add_rule": { 172 | "message": "Adicionar Regra" 173 | }, 174 | "Pattern": { 175 | "message": "Modelo de URL" 176 | }, 177 | "Behavior": { 178 | "message": "Comportamento" 179 | }, 180 | "siteruleBehaviorOriginal": { 181 | "message": "Usar a URL original do link" 182 | }, 183 | "siteruleBehaviorIgnore": { 184 | "message": "Ignorar esta URL" 185 | }, 186 | "About": { 187 | "message": "Sobre" 188 | }, 189 | "Changelog": { 190 | "message": "Changelog" 191 | }, 192 | "Source_code": { 193 | "message": "C\u00F3digo fonte" 194 | }, 195 | "Contributors": { 196 | "message": "Colaboradores" 197 | }, 198 | "Language": { 199 | "message": "Idioma" 200 | }, 201 | "Auto": { 202 | "message": "Autom\u00E1tico" 203 | }, 204 | "Save": { 205 | "message": "Salvar" 206 | }, 207 | "Close": { 208 | "message": "Fechar" 209 | }, 210 | "Reset": { 211 | "message": "Padr\u00E3o" 212 | }, 213 | "testArea": { 214 | "message": "\u00C1rea de teste" 215 | }, 216 | "ON": { 217 | "message": "Ligado" 218 | }, 219 | "OFF": { 220 | "message": "Desligado" 221 | }, 222 | "Donate_paypal": { 223 | "message": "Doar com Paypal" 224 | } 225 | } -------------------------------------------------------------------------------- /src/_locales/sr/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extShortDesc": { 3 | "description": "this will be in the chrome web store: must be 132 characters or less", 4 | "message": "Избегава преусмеравања и има директан приступ сајтовима које желите да посетите." 5 | }, 6 | "General": { 7 | "message": "Опште" 8 | }, 9 | "Style": { 10 | "message": "Стил" 11 | }, 12 | "Advanced": { 13 | "message": "Напредно" 14 | }, 15 | "Sites": { 16 | "message": "Сајтови" 17 | }, 18 | "highlightLink": { 19 | "message": "Означи активан линк на страници" 20 | }, 21 | "openInNewPage": { 22 | "message": "Отворање линкова у новој страници" 23 | }, 24 | "openInNewPage0": { 25 | "message": "Подразумевано понашање прегледача" 26 | }, 27 | "openInNewPage1": { 28 | "message": "Отвори у новој картици" 29 | }, 30 | "openInNewPage2": { 31 | "message": "Отвори у позадинској картици" 32 | }, 33 | "menuEnable": { 34 | "message": "Омогући мени" 35 | }, 36 | "menuHideIfSingleRedir": { 37 | "message": "Сакриј мени ако УРЛ адреса има једно преусмеравање" 38 | }, 39 | "replaceUrl": { 40 | "message": "Замени УРЛ адресу линка" 41 | }, 42 | "replaceOnlySingleRedir": { 43 | "message": "Само ако УРЛ адреса има једно преусмеравање" 44 | }, 45 | "useFallbackRule": { 46 | "message": "Користи резервну опцију ако нема постављених правила за линк" 47 | }, 48 | "Manage_rules": { 49 | "message": "Управљај правилима" 50 | }, 51 | "Keyboard_shortcuts": { 52 | "message": "Тастерске пречице" 53 | }, 54 | "keyboard_tip": { 55 | "message": "Опција \"Тастерска пречица за приказивање менија\" контролише видљивост менија.\nУпотреба:\n* Притисни док се курсор миша налази преко било којег линка на страници.\n** Притисни приликом клика на било коју иконицу у искачућем менију." 56 | }, 57 | "keysShowPopup": { 58 | "message": "Тастерска пречица за приказивање менија" 59 | }, 60 | "keysOpenAsDownload": { 61 | "message": "Отвори линк као преузимање" 62 | }, 63 | "keysPreventReferrer": { 64 | "message": "Спречи слање реферера. Корисно за избегавање 403/Забрањена страница" 65 | }, 66 | "keysAddSiterule": { 67 | "message": "Додај правило линку" 68 | }, 69 | "keysToggleEnable": { 70 | "message": "Омогући/онемогући проширење" 71 | }, 72 | "keysToggleEnableTemp": { 73 | "message": "Омогући/онемогући проширење (само на тренутној страници)" 74 | }, 75 | "Menu": { 76 | "message": "Мени" 77 | }, 78 | "menuShowDelay": { 79 | "message": "Прикажи после (у милисекундама)" 80 | }, 81 | "menuHideDelay": { 82 | "message": "Сакриј после (у милисекундама)" 83 | }, 84 | "menuOpacity": { 85 | "message": "Провидност" 86 | }, 87 | "menuOpacityHover": { 88 | "message": "Провидност (курсор миша преко)" 89 | }, 90 | "menuShadowDepth": { 91 | "message": "Дубина сенке" 92 | }, 93 | "Icons": { 94 | "message": "Иконице" 95 | }, 96 | "iconSize": { 97 | "message": "Величина (у пикселима)" 98 | }, 99 | "Tooltip": { 100 | "message": "Опис алатке" 101 | }, 102 | "tooltipFontSize": { 103 | "message": "Величина фонта (у пикселима)" 104 | }, 105 | "tooltipColor": { 106 | "message": "Боја" 107 | }, 108 | "tooltipBackgroundColor": { 109 | "message": "Боја позадине" 110 | }, 111 | "tooltipShowIcon": { 112 | "message": "Прикажи фавикон" 113 | }, 114 | "Protocols": { 115 | "message": "Протоколи" 116 | }, 117 | "Methods": { 118 | "message": "Методе" 119 | }, 120 | "useDeobfuscator": { 121 | "message": "Заштита линкова (Hex, Base64...)" 122 | }, 123 | "getFromTagText": { 124 | "message": "Садржај текста" 125 | }, 126 | "getFromPlugins": { 127 | "message": "Прикључци" 128 | }, 129 | "getFromAttributes": { 130 | "message": "Особине (на клику, преласком миша преко...)" 131 | }, 132 | "Excluded_attr": { 133 | "message": "Игнорисане особине" 134 | }, 135 | "maxCaptureRecursion": { 136 | "message": "Максималан број дозвољених понављања за учитавање на једном линку" 137 | }, 138 | "watchNodeInserted": { 139 | "message": "Провери убачени садржај после учитавања странице" 140 | }, 141 | "watchAttrModified": { 142 | "message": "Откриј измене особина" 143 | }, 144 | "Extension_sort_order": { 145 | "message": "Редослед сортирања екстензија" 146 | }, 147 | "Rules": { 148 | "message": "Правила" 149 | }, 150 | "siterules_tip": { 151 | "message": "Правила се такође могу додати користећи пречицу постављену у Опште > Тастерске пречице > Додај правило линку.\n\nОбрасци: УРЛ адреса линка (користи * као знак замене). Користи за подударање са било којим највишим интернет доменом (com, org, net, gov...).\n\nПараметри:\n1. Било који знаковни низ упита.\n Пример: imgrefurl се подудара са ...&imgrefurl=http://example.com.\n2. @назив-особине: се подудара са особином.\n Пример: @onclick, @onmouseover...\n3. *.екстензија: се подудара са екстензијом.\n Пример: *.jpg, *.mp4...\n4. #метода-екстракције: се подудара са методом екстракције (#base64, #hex, #reverse, #text, #javascript, #forced).\n5. Параметри, осим екстензија, се могу мешати у истом пољу одвојени зарезима.\n Пример: \"@attribute,src\" се подудара ако садржи @attribute а затим src.\n Не ради: \"@attribute,*.avi\", \"*.mp3,*.avi\"...\n\nРедослед обраде правила је на основу тога како су приказани на страници за конфигурацију." 152 | }, 153 | "Patterns_parameters": { 154 | "message": "Обрасци / параметри" 155 | }, 156 | "Add_rule": { 157 | "message": "Додај правило" 158 | }, 159 | "Add_default_rules": { 160 | "message": "Додај подразумевана правила" 161 | }, 162 | "Ignore": { 163 | "message": "Игнориши" 164 | }, 165 | "Patterns": { 166 | "message": "Обрасци" 167 | }, 168 | "Parameters": { 169 | "message": "Параметри" 170 | }, 171 | "Add_rule": { 172 | "message": "Додај правило" 173 | }, 174 | "Pattern": { 175 | "message": "Образац" 176 | }, 177 | "Behavior": { 178 | "message": "Понашање" 179 | }, 180 | "siteruleBehaviorOriginal": { 181 | "message": "Користи оригиналну УРЛ адресу" 182 | }, 183 | "siteruleBehaviorIgnore": { 184 | "message": "Игнориши ову УРЛ адресу" 185 | }, 186 | "About": { 187 | "message": "Информације" 188 | }, 189 | "Changelog": { 190 | "message": "Листа измена" 191 | }, 192 | "Source_code": { 193 | "message": "Изворни код" 194 | }, 195 | "Contributors": { 196 | "message": "Сарадници" 197 | }, 198 | "Language": { 199 | "message": "Језик" 200 | }, 201 | "Auto": { 202 | "message": "Аутоматски избор" 203 | }, 204 | "Save": { 205 | "message": "Сачувај" 206 | }, 207 | "Close": { 208 | "message": "Затвори" 209 | }, 210 | "Reset": { 211 | "message": "Врати на подразумевано" 212 | }, 213 | "testArea": { 214 | "message": "Тест поље" 215 | }, 216 | "ON": { 217 | "message": "Укључено" 218 | }, 219 | "OFF": { 220 | "message": "Искључено" 221 | }, 222 | "Donate_paypal": { 223 | "message": "Донирајте преко Paypal сервиса" 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /src/background.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | var siteruleFormData = {}; 4 | 5 | function runtimeOnMessage(msgData, msgSender, sendResponse) { 6 | switch (msgData.name) { 7 | case "opts.get": 8 | sendResponse({PAGE_DATA: ((OPTS.scriptEnabled || msgData.force)? rb.PAGE_DATA : rb.PAGE_DATA_SIMPLE )}); 9 | break; 10 | case "target.process": 11 | sendResponse(rb.linkProcess(msgData)); 12 | break; 13 | case "tab.open": 14 | msgData.openerTabId = msgSender.tab.id; 15 | msgData.index = msgSender.tab.index + 1; 16 | delete msgData.name; 17 | 18 | chrome.tabs.create(msgData); 19 | break; 20 | case "state.toggle": 21 | rb.PAGE_DATA.OPTS.scriptEnabled = OPTS.scriptEnabled = !OPTS.scriptEnabled; 22 | 23 | chrome.storage.local.set({"opts": OPTS}); 24 | updateContentScript(); 25 | showNotification(OPTS.scriptEnabled); 26 | break; 27 | case "opts.set": 28 | if (msgData.opts) { 29 | rb.optsBuild(msgData.opts); 30 | chrome.storage.local.set({"opts": OPTS}); 31 | } 32 | 33 | chrome.storage.local.get("sitesrules", function(storageData) { 34 | var sitesrules = ((msgData.sitesrulesAction == "replace") 35 | ? msgData.sitesrules 36 | : (storageData.sitesrules || JSON.parse(JSON.stringify(SITESRULES))) 37 | ); 38 | 39 | if (msgData.sitesrulesAction == "merge") { 40 | msgData.sitesrules.rules.forEach(function(k) { 41 | sitesrules.rules.push(k); 42 | }); 43 | msgData.sitesrules.ignore.forEach(function(k) { 44 | sitesrules.ignore.push(k); 45 | }); 46 | } 47 | 48 | if ((msgData.sitesrulesAction == "replace") || (msgData.sitesrulesAction == "merge")) { 49 | rb.sitesFilterRules(sitesrules); 50 | chrome.storage.local.set({"sitesrules": sitesrules}); 51 | } 52 | 53 | rb.sitesBuildRules((OPTS.replaceUrl)? sitesrules : null); 54 | updateContentScript(); 55 | sendResponse(); 56 | }); 57 | return true; 58 | case "siterules.addform.getdata": 59 | sendResponse(siteruleFormData); 60 | break; 61 | case "siterules.addform.show": 62 | siteruleFormData = msgData; 63 | 64 | chrome.extension.getViews({type: "tab"}).forEach(function(win) { 65 | win.close(); 66 | }); 67 | chrome.tabs.create({ 68 | url : chrome.extension.getURL("siterules.html"), 69 | openerTabId : msgSender.tab.id, 70 | index : msgSender.tab.index + 1 71 | }); 72 | break; 73 | case "notification.show": 74 | showNotification(msgData.scriptEnabled); 75 | break; 76 | default : 77 | sendResponse({}); 78 | break; 79 | } 80 | } 81 | 82 | function updateContentScript() { 83 | var code = "if (typeof redirectBypasser != \"undefined\") {redirectBypasser.stop(); redirectBypasser.start({PAGE_DATA: " 84 | + JSON.stringify(rb.PAGE_DATA)+ "});}"; 85 | 86 | chrome.tabs.query({url: ["https://*/*", "http://*/*", "file://*/*"]}, function(tabs) { 87 | tabs.forEach(function(tab) { 88 | chrome.tabs.executeScript(tab.id, {code: code, allFrames: true, runAt: "document_start"}, function() { 89 | if (!chrome.runtime.lastError) {} 90 | }); 91 | }); 92 | }); 93 | } 94 | 95 | function showNotification(scriptEnabled) { 96 | chrome.notifications.create("notf1", { 97 | type : "basic", 98 | title : "Redirect Bypasser", 99 | message : chrome.i18n.getMessage((scriptEnabled)? "ON" : "OFF"), 100 | iconUrl : ((scriptEnabled)? "images/rb-icon48-enable.png" : "images/rb-icon48-disable.png") 101 | }); 102 | } 103 | 104 | chrome.runtime.onMessage.addListener(runtimeOnMessage); 105 | chrome.storage.local.get(["opts", "sitesrules"], function(storageData) { 106 | var code = "if (typeof redirectBypasser != \"undefined\") {redirectBypasser.stop(true); redirectBypasser = undefined;}", delay = 0; 107 | 108 | rb.optsBuild(storageData.opts) && chrome.storage.local.set({"opts": OPTS}); 109 | rb.sitesBuildRules((OPTS.replaceUrl)? (storageData.sitesrules || SITESRULES) : null); 110 | chrome.tabs.query({url: ["https://*/*", "http://*/*", "file://*/*"]}, function(tabs) { 111 | tabs.forEach(function(tab) { 112 | delay += 200; 113 | 114 | setTimeout(function(tabId) { 115 | chrome.tabs.executeScript(tabId, {code: code, allFrames: true, runAt: "document_idle"}, function() { 116 | if (!chrome.runtime.lastError) {} 117 | 118 | chrome.tabs.executeScript(tabId, { 119 | file: "/content-scripts/content.js", 120 | allFrames: true, 121 | runAt: "document_idle" 122 | }, function() {if (!chrome.runtime.lastError) {}}); 123 | }); 124 | }, delay, tab.id); 125 | }); 126 | }); 127 | }); 128 | 129 | })(); 130 | -------------------------------------------------------------------------------- /src/bootstrap.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const {classes: CC, interfaces: CI, utils: CU} = Components; 4 | CU.importGlobalProperties(["atob", "btoa", "URL", "Blob"]); 5 | 6 | var document = ((document)? document : null); 7 | var rb; 8 | 9 | function startup(startupData, startupReason) { 10 | var script = ""; 11 | var sandboxs = []; 12 | var siteruleFormData = {}; 13 | var xhr = function(url, callback, type, responseType) { 14 | var dx = new Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest")(); 15 | type && dx.overrideMimeType(type); 16 | dx.open("GET", url, true); 17 | dx.addEventListener("loadend", callback); 18 | dx.responseType = ((responseType)? responseType : ""); 19 | dx.send(); 20 | }; 21 | 22 | xhr(URL.createObjectURL(new Blob( 23 | [""], 24 | {type: "text/html"} 25 | )), function(ev) { 26 | URL.revokeObjectURL(this.responseURL); 27 | document = this.response; 28 | 29 | xhr("chrome://redirectbypasser/content/content-scripts/content.js", function() { 30 | script = this.responseText; 31 | 32 | rb.optsBuild(storageGet("opts")) && storageSet("opts", OPTS); 33 | rb.sitesBuildRules((OPTS.replaceUrl)? (storageGet("sitesrules") || SITESRULES) : null); 34 | windowList(function(win) { 35 | var i = win.frames.length; 36 | windowProcess(win); 37 | 38 | while (i--) { 39 | windowProcess(win.frames[i]); 40 | } 41 | }); 42 | CC["@mozilla.org/observer-service;1"].getService(CI.nsIObserverService).addObserver(rb, "document-element-inserted", false); 43 | }, "text/javascript", ""); 44 | }, "text/html", "document"); 45 | 46 | CC["@mozilla.org/moz/jssubscript-loader;1"].getService(CI.mozIJSSubScriptLoader) 47 | .loadSubScript("chrome://redirectbypasser/content/background-common.js"); 48 | 49 | rb.observe = function(observeSubject, observeTopic, observeData) { 50 | if ((observeTopic == "document-element-inserted") && observeSubject.defaultView) { 51 | windowProcess(observeSubject.defaultView); 52 | } 53 | }; 54 | 55 | rb.cleanUp = function() { 56 | CC["@mozilla.org/observer-service;1"].getService(CI.nsIObserverService).removeObserver(rb, "document-element-inserted", false); 57 | 58 | var i = sandboxs.length; 59 | 60 | while (i--) { 61 | sandboxs[i].window.removeEventListener("unload", windowOnUnload, false); 62 | CU.evalInSandbox("if (typeof redirectBypasser != \"undefined\") {redirectBypasser.stop(true); redirectBypasser = undefined;}", sandboxs[i]); 63 | CU.nukeSandbox(sandboxs[i]); 64 | } 65 | 66 | sandboxs.length = 0; 67 | 68 | windowList(function(win) { 69 | (win.location.href.indexOf("chrome://redirectbypasser/content/") === 0) && win.close(); 70 | }); 71 | }; 72 | 73 | function windowList(callback) { 74 | var wins = CC["@mozilla.org/appshell/window-mediator;1"].getService(CI.nsIWindowMediator).getEnumerator("navigator:browser"); 75 | 76 | while (wins.hasMoreElements()) { 77 | var win = wins.getNext().QueryInterface(CI.nsIDOMWindow); 78 | 79 | if ("gBrowser" in win) { 80 | var i = (("browsers" in win.gBrowser)? win.gBrowser.browsers.length : 0); 81 | 82 | while (i--) { 83 | callback(win.gBrowser.getBrowserAtIndex(i).contentDocument.defaultView, win); 84 | } 85 | 86 | } else if ("BrowserApp" in win) { 87 | var i = (("tabs" in win.BrowserApp)? win.BrowserApp.tabs.length : 0); 88 | 89 | while (i--) { 90 | callback(win.BrowserApp.tabs[i].window, win); 91 | } 92 | } 93 | } 94 | } 95 | 96 | function windowOpen(params) { 97 | var win = CC['@mozilla.org/appshell/window-mediator;1'].getService(CI.nsIWindowMediator).getMostRecentWindow('navigator:browser'); 98 | 99 | if (win && win.document && (win.document.readyState == "complete")) { 100 | if ("gBrowser" in win) { 101 | params.inBackground = !params.active; 102 | 103 | win.gBrowser.loadOneTab(params.url, params); 104 | 105 | } else if ("BrowserApp" in win) { 106 | params.selected = params.active; 107 | win.BrowserApp.addTab(params.url, params); 108 | } 109 | } 110 | } 111 | 112 | function windowProcess(win) { 113 | if (/^(https?|file):/.test(win.location.href)) { 114 | //debug 115 | //xhr("content/content-scripts/content.js", function() {script = this.responseText;}, "text/javascript", ""); 116 | var sandbox = new CU.Sandbox(win, { 117 | sandboxName : "redirectBypasser (sandbox)", 118 | sandboxPrototype : win, 119 | sameZoneAs : win, 120 | wantXrays : true, 121 | wantComponents : false 122 | }); 123 | 124 | sandboxs.push(sandbox); 125 | win.addEventListener("unload", windowOnUnload, false); 126 | CU.exportFunction(onMessage, sandbox, {defineAs: "sendMessage"}); 127 | CU.evalInSandbox(script, sandbox); 128 | 129 | } else if (win.location.href.indexOf("chrome://redirectbypasser/content/") === 0) { 130 | CU.exportFunction(onMessage, win, {defineAs: "sendMessage"}); 131 | CU.exportFunction(windowList, win, {defineAs: "windowList"}); 132 | } 133 | } 134 | 135 | function windowOnUnload(ev) { 136 | ev.currentTarget.removeEventListener("unload", windowOnUnload, false); 137 | 138 | var i = sandboxs.length; 139 | 140 | while (i--) { 141 | if (sandboxs[i].window == ev.currentTarget) { 142 | CU.evalInSandbox("if (typeof redirectBypasser != \"undefined\") {redirectBypasser.stop(true); redirectBypasser = undefined;}", sandboxs[i]); 143 | CU.nukeSandbox(sandboxs.splice(i, 1)[0]); 144 | break; 145 | } 146 | } 147 | } 148 | 149 | function onMessage(msgData, sendResponse) { 150 | switch (msgData.name) { 151 | case "opts.get": 152 | sendResponse(CU.cloneInto({ 153 | PAGE_DATA: ((OPTS.scriptEnabled || msgData.force)? rb.PAGE_DATA : rb.PAGE_DATA_SIMPLE) 154 | }, msgData)); 155 | break; 156 | case "target.process": 157 | var timer = CC["@mozilla.org/timer;1"].createInstance(CI.nsITimer); 158 | 159 | timer.initWithCallback(function() { 160 | sendResponse(CU.cloneInto(rb.linkProcess(msgData), msgData)); 161 | }, 10, CI.nsITimer.TYPE_ONE_SHOT); 162 | break; 163 | case "tab.open": 164 | windowOpen(msgData); 165 | break; 166 | case "state.toggle": 167 | rb.PAGE_DATA.OPTS.scriptEnabled = OPTS.scriptEnabled = !OPTS.scriptEnabled; 168 | 169 | storageSet("opts", OPTS); 170 | updateContentScript(); 171 | showNotification(OPTS.scriptEnabled); 172 | break; 173 | case "opts.set": 174 | if (msgData.opts) { 175 | rb.optsBuild(msgData.opts); 176 | storageSet("opts", OPTS); 177 | } 178 | 179 | var sitesrules = ((msgData.sitesrulesAction == "replace") 180 | ? msgData.sitesrules 181 | : (storageGet("sitesrules") || JSON.parse(JSON.stringify(SITESRULES))) 182 | ); 183 | 184 | if (msgData.sitesrulesAction == "merge") { 185 | msgData.sitesrules.rules.forEach(function(k) { 186 | sitesrules.rules.push(k); 187 | }); 188 | 189 | msgData.sitesrules.ignore.forEach(function(k) { 190 | sitesrules.ignore.push(k); 191 | }); 192 | } 193 | 194 | if (msgData.sitesrulesAction == "replace" || msgData.sitesrulesAction == "merge") { 195 | rb.sitesFilterRules(sitesrules); 196 | storageSet("sitesrules", sitesrules); 197 | } 198 | 199 | rb.sitesBuildRules((OPTS.replaceUrl)? sitesrules : null); 200 | updateContentScript(); 201 | sendResponse(); 202 | break; 203 | case "siterules.addform.getdata": 204 | sendResponse(CU.cloneInto(siteruleFormData, msgData)); 205 | break; 206 | case "siterules.addform.show": 207 | siteruleFormData = msgData; 208 | 209 | windowOpen({url: "chrome://redirectbypasser/content/siterules.html"}); 210 | break; 211 | case "notification.show": 212 | showNotification(msgData.scriptEnabled); 213 | break; 214 | default : 215 | sendResponse({}); 216 | break; 217 | } 218 | } 219 | 220 | function showNotification(scriptEnabled) { 221 | var notify = CC["@mozilla.org/alerts-service;1"].getService(CI.nsIAlertsService); 222 | 223 | try { 224 | notify.showAlertNotification( 225 | "chrome://redirectbypasser/content/images/" + ((scriptEnabled)? "rb-icon48-enable.png" : "rb-icon48-disable.png"), 226 | "Redirect Bypasser", 227 | "" 228 | ); 229 | } catch (e) {} 230 | } 231 | 232 | function updateContentScript() { 233 | var code = "if (typeof redirectBypasser != \"undefined\") { redirectBypasser.stop(); redirectBypasser.start({PAGE_DATA: " 234 | + JSON.stringify(rb.PAGE_DATA) + "});}"; 235 | 236 | for (var i = sandboxs.length; i--; CU.evalInSandbox(code, sandboxs[i])); 237 | } 238 | 239 | function storageSet(storageName, storageData) { 240 | var pref = CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefService).getBranch("extensions.redirectbypasser."); 241 | 242 | if (pref.getPrefType(storageName) != pref.PREF_STRING) { 243 | pref.deleteBranch(storageName); 244 | } 245 | 246 | pref.setCharPref(storageName, JSON.stringify(storageData)); 247 | } 248 | 249 | function storageGet(storageName) { 250 | var pref = CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefService).getBranch("extensions.redirectbypasser."); 251 | var storageData = null; 252 | 253 | if (pref.getPrefType(storageName) == pref.PREF_STRING) { 254 | try { 255 | storageData = JSON.parse(pref.getCharPref(storageName)); 256 | } catch(e) {} 257 | } 258 | 259 | return storageData; 260 | } 261 | } 262 | 263 | function shutdown(shutdownData, shutdownReason) { 264 | rb.cleanUp && rb.cleanUp(); 265 | rb = null; 266 | 267 | if (shutdownReason == ADDON_DISABLE) { 268 | //debug 269 | //CC["@mozilla.org/observer-service;1"].getService(CI.nsIObserverService).notifyObservers(null, "startupcache-invalidate", null); 270 | } 271 | } 272 | 273 | function install(installData, installReason) {} 274 | 275 | function uninstall(uninstallData, uninstallReason) { 276 | if (uninstallReason == ADDON_UNINSTALL) { 277 | CC["@mozilla.org/preferences-service;1"].getService(CI.nsIPrefService).getBranch("extensions.redirectbypasser.") 278 | .deleteBranch("extensions.redirectbypasser."); 279 | } 280 | } -------------------------------------------------------------------------------- /src/chrome.manifest: -------------------------------------------------------------------------------- 1 | content redirectbypasser ./ -------------------------------------------------------------------------------- /src/content-scripts/content.js: -------------------------------------------------------------------------------- 1 | if (typeof redirectBypasser == "undefined") { 2 | var sendMessage = (((typeof(chrome) == "object") && ("runtime" in chrome) && ("sendMessage" in chrome.runtime)) 3 | ? chrome.runtime.sendMessage 4 | : sendMessage 5 | ); 6 | var redirectBypasser = new function() { 7 | "use strict"; 8 | var doc = window.document; 9 | var redirectBypasser = this; 10 | var OPTS = {}; 11 | var RE = {}; 12 | var targets = []; 13 | var targetsIDs = []; 14 | var targetsRects = []; 15 | var targetsHideTimers = []; 16 | var targetsShowTimers = []; 17 | var handleMouseTarget = null; 18 | var handleMousemoveTimer = 0; 19 | var handleMousemoveScroll = -1; 20 | var handleKeyList = {}; 21 | var handleKeyRaw = ""; 22 | var handleKeyTimer = 0; 23 | var CX, CY; 24 | var extTest = [ 25 | /\.(jpg|jpeg?|gif|png|bmp|ico|svg|svgz)$/i, 26 | /\.(mp3|wav|wma|ra|mid|m3u|asx|ogg)$/i, 27 | /\.(mov|mpg|avi|wmv|mpe|mpeg|rm|ram|rmvb|mp4|asf|flv|m4v|webm)$/i, 28 | /\.(torrent|zip|rar|tar|tgz|gz|bz2|tbz2|gzip|z|sit|dmg|cab|7z|lzh|pkg)$/i, 29 | /\.(txt|rtf|readme|xls|xlt|doc|dot|pps|odt|pdf)$/i, 30 | /\.(exe|pif|lnk|scr|msi|vb|vbs|vba|wsh|ref|cmd|bat|reg|app|sh|bin|ini)$/i, 31 | /.?/ 32 | ]; 33 | var observerCallback = function(ms) { 34 | var i = ms.length; 35 | 36 | while (i--) { 37 | if (ms[i].type == "attributes") { 38 | nodeAdd(ms[i].target, true); 39 | 40 | } else if (ms[i].addedNodes.length > 0) { 41 | var j = ms[i].addedNodes.length; 42 | 43 | while (j--) { 44 | if (ms[i].addedNodes[j].nodeType == Node.ELEMENT_NODE) { 45 | nodeAdd(ms[i].addedNodes[j], true); 46 | } 47 | } 48 | } 49 | } 50 | } 51 | var observer = new MutationObserver(observerCallback); 52 | var uiTarget, uiTimer = 0; 53 | var uiPopup = doc.createElement("div"); 54 | var uiStyle = doc.createElement("style"); 55 | var uiTooltip = uiPopup.appendChild(doc.createElement("div")); 56 | var uiMenulist = uiPopup.appendChild(doc.createElement("div")); 57 | 58 | uiPopup.id = "rb-div"; 59 | uiTooltip.id = "rb-tooltip"; 60 | uiMenulist.id = "rb-menulist"; 61 | 62 | if (!CSS.escape) { 63 | CSS.escape = function(s) { 64 | return s.replace(/[~!@$%^&*\(\)+=,./';:"?><\[\]\\\{\}|`#]/g, "\\$&"); 65 | } 66 | } 67 | 68 | uiPopup.addEventListener("mouseover", function(ev) { 69 | if (ev.target.nodeName == "A") { 70 | var el = ev.target, w = (684 / OPTS.tooltipFontSize) * 1.3; 71 | 72 | if (OPTS.tooltipShowIcon) { 73 | uiTooltip.style.setProperty("background-image", "url(" + el.origin + "/favicon.ico)", "important"); 74 | } 75 | 76 | uiTooltip.innerHTML = doc.createTextNode(el.origin 77 | + ((el.pathname.length < w)? el.pathname : "/..." + el.pathname.slice(-w)) 78 | + ((el.pathname.length && el.search.length)? el.search.substr(0, w) : el.search.substr(0, w * 2))).textContent 79 | + "" 80 | + doc.createTextNode(el.getAttribute("data-rb-tooltip")).textContent 81 | + ""; 82 | 83 | var rect = el.getBoundingClientRect(); 84 | var left = el.offsetLeft 85 | - ((rect.left + uiTooltip.offsetWidth > window.innerWidth)? uiTooltip.offsetWidth - el.offsetWidth : 0); 86 | 87 | uiTooltip.style.top = ((rect.top - uiTooltip.offsetHeight < 2)? uiPopup.offsetHeight : ~(uiTooltip.offsetHeight + -1)) + "px"; 88 | uiTooltip.style.left = ((left + uiPopup.offsetLeft > 1)? left : -uiPopup.offsetLeft) + "px"; 89 | uiTooltip.style.visibility = "visible"; 90 | } 91 | }, false); 92 | 93 | uiPopup.addEventListener("mouseout", function(ev) { 94 | uiTooltip.style.visibility = "hidden"; 95 | }, false); 96 | 97 | uiPopup.addEventListener("click", function(ev) { 98 | if (ev.target.nodeName == "A") { 99 | if (handleKeyRaw == OPTS.keysAddSiterule) { 100 | var target = targets[targetsIDs.indexOf(ev.target.getAttribute("data-rb-target-id"))]; 101 | var links = JSON.parse(target && target.getAttribute("data-rb-store") || "{}"); 102 | 103 | links && links.base && sendMessage({ 104 | name : "siterules.addform.show", 105 | url : links.base.url, 106 | info : ev.target.getAttribute("data-rb-tooltip").split(" \u2022 ").reverse(), 107 | links : links 108 | }); 109 | targetsRemove(); 110 | ev.preventDefault(); 111 | 112 | } else if (!ev.button && OPTS.openInNewPage == 2) { 113 | sendMessage({name: "tab.open", url: ev.target.href, active: false}); 114 | ev.preventDefault(); 115 | } 116 | } 117 | 118 | ev.stopPropagation(); 119 | }, false); 120 | 121 | uiPopup.addEventListener("mousedown", function(ev) { 122 | if (ev.target.nodeName == "A") { 123 | if (handleKeyRaw == OPTS.keysPreventReferrer) { 124 | ev.target.setAttribute("rel", "noreferrer"); 125 | 126 | } else if (handleKeyRaw == OPTS.keysOpenAsDownload) { 127 | ev.target.setAttribute("download", ""); 128 | } 129 | } 130 | }, false); 131 | 132 | function uiShow(target, ccX, ccY) { 133 | if (target != uiTarget && !uiPopup.parentNode) { 134 | var rect = target.getBoundingClientRect(); 135 | 136 | if (!(ccX < rect.left || ccX > rect.right || ccY < rect.top || ccY > rect.bottom)) { 137 | uiTarget = target; 138 | uiPopup.style.visibility = "hidden"; 139 | uiPopup.style.display = "block"; 140 | uiPopup.parentNode || doc.documentElement.insertBefore(uiPopup, doc.documentElement.firstChild); 141 | uiStyle.parentNode || doc.head.appendChild(uiStyle); 142 | 143 | var isPlugin = /embed|object|video|audio/i.test(target.nodeName), uPW = uiPopup.offsetWidth, uPH = uiPopup.offsetHeight; 144 | 145 | uiPopup.style.top = ((isPlugin || ((target.nodeName == "IMG")? (target.offsetHeight < 50) : (target.offsetHeight < 20))) 146 | ? rect.top + ((rect.top - uPH > -1) 147 | ? -uPH 148 | : ((rect.bottom + uPH < doc.documentElement.offsetHeight - window.pageYOffset)? rect.height : 0)) 149 | : ccY + ((ccY - uPH > -1)? -uPH : ccY) 150 | ) + window.pageYOffset + "px"; 151 | 152 | uiPopup.style.left = ((isPlugin) 153 | ? rect.left 154 | : (ccX + ((ccX + uPW + 5 < window.innerWidth)? 5 : ((ccX - uPW < -1)? -ccX :-uPW))) 155 | ) + window.pageXOffset + "px"; 156 | 157 | uiPopup.style.visibility = "visible"; 158 | } 159 | } 160 | } 161 | 162 | function uiAddItems(links, target) { 163 | uiPopup.style.display = "none"; 164 | OPTS.highlightLink && target.setAttribute("rb-hl", ""); 165 | clearTimeout(uiTimer); 166 | 167 | for (var i = 0, link; link = links.list[links.index[i]]; i++) { 168 | if (!(/^(javascript|data)/i).test(link.url) 169 | && !uiMenulist.querySelector("a[data-rb-link-id=\"" + CSS.escape(link.url) + "\"]") 170 | ) { 171 | var menuItem = doc.createElement("a"); 172 | menuItem.href = link.url; 173 | menuItem.setAttribute("data-rb-link-id", link.url); 174 | menuItem.setAttribute("data-rb-target-id", links.targetID); 175 | menuItem.setAttribute("data-rb-tooltip", link.info.reverse().join(" \u2022 ")); 176 | OPTS.openInNewPage && menuItem.setAttribute("target", "_blank"); 177 | 178 | extTest.some(function(key, idx) { 179 | if (key.test(menuItem.pathname)) { 180 | var sa = (link.info.join("")).split("").sort(), i = sa.length, ch = 0, cs = 0, cl = 0; 181 | var mw = (((i)? sa[i - 1].charCodeAt(0) - sa[0].charCodeAt(0) : 0) || 1); 182 | 183 | for (var cc; i--; cc = sa[i].charCodeAt(0), ch += cc, cs += ((i % 2)? cc : 0), cl += ((i % 2)? 0 : cc)); 184 | 185 | var hue = parseInt(((((ch % mw) / mw * 100) + (idx / extTest.length * 100)) % 100) * 3.6, 10); 186 | var hil = (hue > 30 && 90 > hue) || (hue > 150 && 210 > hue) || (hue > 270 && 330 > hue); 187 | 188 | menuItem.style.backgroundColor = "hsl(" + hue 189 | + "," + (30 + ~~(((hil)? 0.1 : 0.2) * ((cs % mw) / mw * 100))) + "%," 190 | + (40 + ~~(((!hil)? 0.1 : 0.2) * ((cl % mw) / mw * 100))) + "%)"; 191 | menuItem.style.setProperty("background-position", "-" + idx + "em center", "important"); 192 | 193 | return true; 194 | } 195 | }); 196 | uiMenulist.appendChild(menuItem); 197 | } 198 | } 199 | 200 | uiTimer = setTimeout(function() { 201 | uiPopup.style.display = "block"; 202 | }, 50); 203 | } 204 | 205 | function uiRemoveItems(targetID, target) { 206 | for (var a = uiMenulist.querySelectorAll("a[data-rb-target-id=\"" + targetID + "\"]"), i = a.length; i--; a[i].remove()); 207 | 208 | target.removeAttribute("rb-hl"); 209 | 210 | if (!uiMenulist.childNodes.length) { 211 | uiTarget = null; 212 | uiTooltip.style.visibility = "hidden"; 213 | uiPopup.remove(); 214 | (!OPTS.highlightLink || !OPTS.replaceUrl) && uiStyle.remove(); 215 | } 216 | } 217 | 218 | function targetProcess(targetID, target, callback) { 219 | if (target.hasAttribute("data-rb-store")) { 220 | var data = JSON.parse(target.getAttribute("data-rb-store")); 221 | data.targetID = targetID; 222 | callback(data); 223 | 224 | } else { 225 | sendMessage({ 226 | name : "target.process", 227 | targetID : targetID, 228 | src : target.outerHTML, 229 | baseURI : (target.baseURI || doc.baseURI) 230 | }, callback); 231 | } 232 | } 233 | 234 | function targetsAdd(targetID, target) { 235 | targetProcess(targetID, target, function(data) { 236 | var i = targetsIDs.indexOf(data.targetID); 237 | 238 | if (i !== -1) { 239 | var show = !!data.index.length; 240 | 241 | if (show && (target.nodeName == "A") || (target.nodeName == "AREA")) { 242 | if (!OPTS.keysShowPopup || (OPTS.keysShowPopup != handleKeyRaw)) { 243 | if (OPTS.menuHideIfSingleRedir && data.replaceURL && (data.index.length == 1)) { 244 | show = false; 245 | } 246 | } 247 | } 248 | 249 | ((show)? (uiAddItems(data, targets[i]), uiShow(handleMouseTarget, CX, CY)) : targetsRemove(targets[i])); 250 | } 251 | }); 252 | } 253 | 254 | function targetsRemove(target) { 255 | if (!target) { 256 | for (var i = targets.length; i--; targetsRemove(targets[i])); 257 | 258 | } else { 259 | var i = targets.indexOf(target); 260 | 261 | if (i !== -1) { 262 | uiRemoveItems(targetsIDs[i], targets[i]); 263 | clearTimeout(targetsHideTimers[i]); 264 | clearTimeout(targetsShowTimers[i]); 265 | targets.splice(i, 1); 266 | targetsIDs.splice(i, 1); 267 | targetsRects.splice(i, 1); 268 | targetsHideTimers.splice(i, 1); 269 | targetsShowTimers.splice(i, 1); 270 | } 271 | 272 | if (!targets.length) { 273 | handleMouseTarget = null; 274 | doc.removeEventListener("mousemove", handleMousemove, false); 275 | doc.removeEventListener("mouseout", handleMouse, false); 276 | } 277 | 278 | window.HTMLElement.prototype.addEventListener.call(target, "mouseover", handleMouseover, false); 279 | } 280 | } 281 | 282 | function handleMouse(ev) { 283 | if (ev.type == "mousemove") { 284 | var hS = handleMousemoveScroll; 285 | handleMousemoveScroll = window.pageXOffset + window.pageYOffset; 286 | 287 | if ((hS > -1) && (hS != handleMousemoveScroll) && (targets.length > 1)) { 288 | for (var i = targets.length - 1; i--; targetsRemove(targets[i])); 289 | 290 | } else { 291 | var isUi = uiPopup.contains(ev.target); 292 | 293 | for (var i = 0, rect; rect = targetsRects[i]; i++) { 294 | if (isUi 295 | || (ev.clientX > rect.left && ev.clientX < rect.right && ev.clientY > rect.top && ev.clientY < rect.bottom) 296 | || targets[i].contains(ev.target) 297 | ) { 298 | clearTimeout(targetsHideTimers[i]); 299 | targetsHideTimers[i] = 0; 300 | 301 | if (targetsShowTimers[i] === 0) { 302 | targetsShowTimers[i] = setTimeout(targetsAdd, OPTS.menuShowDelay, targetsIDs[i], targets[i]); 303 | } 304 | 305 | } else { 306 | if (targetsShowTimers[i] !== 0) { 307 | clearTimeout(targetsShowTimers[i]); 308 | targetsShowTimers[i] = 0; 309 | } 310 | 311 | if (targetsHideTimers[i] === 0) { 312 | targetsHideTimers[i] = setTimeout(targetsRemove, OPTS.menuHideDelay, targets[i]); 313 | } 314 | } 315 | } 316 | } 317 | } else if ((ev.type == "mouseout") && (ev.relatedTarget === null)) { 318 | targetsRemove(); 319 | } 320 | } 321 | 322 | function handleMousemove(ev) { 323 | CX = ev.clientX, CY = ev.clientY; 324 | (CX % 2 || CY % 2) && (clearTimeout(handleMousemoveTimer), handleMousemoveTimer = setTimeout(handleMouse, 50, ev)); 325 | } 326 | 327 | function handleMouseover(ev) { 328 | if (OPTS.replaceUrl 329 | && ((ev.currentTarget.nodeName == "A") || (ev.currentTarget.nodeName == "AREA")) 330 | && !ev.currentTarget.hasAttribute("data-rb-store") 331 | ) { 332 | var cTarget = ev.currentTarget; 333 | 334 | targetProcess("", ev.currentTarget, function(data) { 335 | if (data.index.length) { 336 | cTarget.setAttribute("data-rb-store", JSON.stringify(data)); 337 | 338 | if (data.replaceURL) { 339 | cTarget.href = data.replaceURL; 340 | 341 | if (OPTS.highlightLink && !uiStyle.parentNode) { 342 | doc.head.appendChild(uiStyle); 343 | cTarget.setAttribute("rb-hl-replace", ""); 344 | } 345 | } 346 | } 347 | }); 348 | } 349 | 350 | if ((OPTS.menuEnable && !OPTS.keysShowPopup) 351 | || (OPTS.keysShowPopup && (OPTS.keysShowPopup == handleKeyRaw)) 352 | && (targets.indexOf(ev.currentTarget) == -1) 353 | ) { 354 | window.HTMLElement.prototype.removeEventListener.call(ev.currentTarget, "mouseover", handleMouseover, false); 355 | 356 | var tcW = ev.target.clientWidth, tcH = ev.target.clientHeight, rect; 357 | 358 | if (!tcW || !tcH) { 359 | var el = doc.elementFromPoint(ev.clientX, ev.clientY); 360 | handleMouseTarget = el; 361 | rect = el.getBoundingClientRect(); 362 | 363 | } else { 364 | handleMouseTarget = ev.target; 365 | rect = { 366 | height : tcH, 367 | width : tcW, 368 | top : ev.clientY - ev.layerY, 369 | right : ev.clientX - ev.layerX + tcW, 370 | bottom : ev.clientY - ev.layerY + tcH, 371 | left : ev.clientX - ev.layerX 372 | } 373 | } 374 | 375 | targets.push(ev.currentTarget); 376 | targetsIDs.push(Math.random().toString(36).substr(2, 9)); 377 | targetsRects.push(rect); 378 | targetsHideTimers.push(0); 379 | targetsShowTimers.push(0); 380 | 381 | if (targets.length === 1) { 382 | doc.addEventListener("mousemove", handleMousemove, false); 383 | doc.addEventListener("mouseout", handleMouse, false); 384 | } 385 | } 386 | } 387 | 388 | function handleKey() { 389 | doc.removeEventListener("keyup", handleKeyup, false); 390 | 391 | if (handleKeyRaw == OPTS.keysToggleEnableTemp) { 392 | OPTS.scriptEnabled = !OPTS.scriptEnabled; 393 | 394 | if (!OPTS.loaded) { 395 | sendMessage({name: "opts.get", force: true}, function(data) { 396 | data.PAGE_DATA.OPTS.scriptEnabled = OPTS.scriptEnabled; 397 | OPTS.loaded = true; 398 | redirectBypasser.start(data); 399 | }); 400 | 401 | } else { 402 | redirectBypasser.start({}); 403 | } 404 | 405 | sendMessage({name: "notification.show", scriptEnabled: OPTS.scriptEnabled}); 406 | 407 | } else if (handleKeyRaw == OPTS.keysToggleEnable) { 408 | sendMessage({name: "state.toggle"}); 409 | } 410 | 411 | handleKeyList = {}; 412 | handleKeyRaw = ""; 413 | } 414 | 415 | function handleKeyup(ev) { 416 | clearTimeout(handleKeyTimer); handleKeyTimer = setTimeout(handleKey, 200); 417 | } 418 | 419 | function handleKeydown(ev) { 420 | if (!ev.repeat) { 421 | handleKeyList[ev.key || ev.keyIdentifier] = 0; 422 | handleKeyRaw = Object.keys(handleKeyList).sort().join(",").toUpperCase(); 423 | doc.addEventListener("keyup", handleKeyup, false); 424 | } 425 | } 426 | 427 | function nodeWatch(el, fromObserver) { 428 | var add = 2; 429 | 430 | if ((el.nodeName == "EMBED") || (el.nodeName == "OBJECT") || (el.nodeName == "VIDEO") || (el.nodeName == "AUDIO")) { 431 | add = ((OPTS.getFromPlugins)? 1 : 0); 432 | 433 | } else { 434 | var url = el.href || el.src || el.data || ""; 435 | 436 | if (url && RE["CONTAINS_URL_TESTER"].test(url)) { 437 | add = 1; 438 | 439 | } else if (OPTS.getFromTagText && RE["CONTAINS_URL"].test(el.textContent)) { 440 | add = 1; 441 | 442 | } else if (OPTS.getFromAttributes) { 443 | for (var i = 0, attrs = el.attributes, attr; attr = attrs[i]; i++) { 444 | if (!(RE["IS_EXCLUDED_ATTR"].test(attr.name)) && RE["CONTAINS_URL"].test(attr.value)) { 445 | add = 1; 446 | break; 447 | } 448 | } 449 | } 450 | } 451 | 452 | if (add === 1) { 453 | window.HTMLElement.prototype.addEventListener.call(el, "mouseover", handleMouseover, false); 454 | 455 | if (fromObserver) { 456 | var obsr = new MutationObserver(function() {}); 457 | obsr.observe(el, {attributes: true, subtree: true, childList: true}); 458 | obsr.disconnect(); 459 | } 460 | 461 | } else if (add === 2 && OPTS.watchAttrModified) { 462 | observer.observe(el, {attributes: true}); 463 | } 464 | } 465 | 466 | function nodeAdd(el, fromObserver) { 467 | if (!uiPopup.contains(el)) { 468 | var n = el.nodeName; 469 | 470 | if (n == "A" || n == "AREA" || (OPTS.getFromPlugins && (n == "EMBED" || n == "OBJECT" || n == "VIDEO" || n == "AUDIO"))) { 471 | nodeWatch(el, fromObserver); 472 | 473 | } else if (el.childElementCount && el.querySelectorAll) { 474 | for ( 475 | var a = el.querySelectorAll("area,a" + ((OPTS.getFromPlugins)? ",embed,object,video,audio" : "")), i = a.length; 476 | i--; 477 | nodeWatch(a[i], fromObserver) 478 | ); 479 | } 480 | } 481 | } 482 | 483 | this.start = function(data) { 484 | if (data && ("PAGE_DATA" in data)) { 485 | if ("REGEXPS" in data.PAGE_DATA) { 486 | Object.keys(data.PAGE_DATA["REGEXPS"]).forEach(function(key) { 487 | RE[key] = RegExp(data.PAGE_DATA.REGEXPS[key], "i"); 488 | }); 489 | } 490 | 491 | if ("OPTS" in data.PAGE_DATA) { 492 | Object.keys(data.PAGE_DATA["OPTS"]).forEach(function(key) { 493 | OPTS[key] = data.PAGE_DATA["OPTS"][key]; 494 | }); 495 | } 496 | } 497 | 498 | doc.addEventListener("keydown", handleKeydown, false); 499 | 500 | if (OPTS.scriptEnabled) { 501 | var onDOMContentLoaded = function (ev) { 502 | ev && ev.currentTarget.removeEventListener("DOMContentLoaded", onDOMContentLoaded, false); 503 | 504 | if ((document.contentType == "text/html") && !doc.documentElement.isContentEditable) { 505 | uiStyle.textContent = "\ 506 | #rb-div, #rb-div * {border: 0!; box-sizing: content-box!; font: Menu!; margin: 0!; padding: 0!; transition: none!;}\ 507 | #rb-div {background-color: transparent!; box-shadow: 0 0 @menuShadowDepth@px #000, 0 0 @menuShadowDepth@px #fff!;opacity: @menuOpacity@!; position: absolute!; z-index: 15000000!;}\ 508 | #rb-div:hover {opacity: @menuOpacityHover@!;}\ 509 | #rb-div a {\ 510 | background-image: url(\"data:image/svg+xml;charset=utf-8,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0D%0A%3Csvg%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Aosb%3D%22http%3A%2F%2Fwww.openswatchbook.org%2Furi%2F2009%2Fosb%22%20height%3D%2232%22%20width%3D%22224%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A%2F%2Fcreativecommons.org%2Fns%23%22%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%3E%0D%0A%3Cg%20transform%3D%22translate%280%20-1020.4%29%22%3E%0D%0A%3Cg%20transform%3D%22matrix%28.55078%200%200%20.55078%2032.315%201011%29%22%3E%0D%0A%3Cpath%20d%3D%22m29.385%2022.376v33.589c-0.05297%200.93126-2.0645%200.43156-3.6312%200-4.318-1.659-14.525%200.61102-14.525%207.2624-0.0043%203.2872%204.1141%207.2861%209.078%207.2624%206.5361%200.04302%2011.214-3.9298%2014.525-7.2624v-29.05c5.5756%203.2191%209.0509%206.4666%205.4468%2012.709-0.07976%200.85769%203.0893%201.0908%203.6312%200%205.4564-5.9817%201.1992-13.326-1.8156-16.34-4.1857-4.1857-5.305-4.5809-7.2624-8.1702-0.7021-0.82078-5.2536-0.71436-5.4468%200z%22%20fill%3D%22%23fff%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%20transform%3D%22matrix%28.55434%200%200%20.55434%2065.128%201002.6%29%22%3E%0D%0A%3Cpath%20style%3D%22color%3A%23000000%22%20d%3D%22m2.4752%2036.55%200.0000102%2048.707h15.334l-0.00001-10.824h18.039l0.00001%2010.824h15.334l-0.00001-48.707h-15.334l-0.000013%205.4118h-18.039v-5.4118zm4.5099%200h7.2158l-0.000013%203.6079h-7.2158zm32.471%200h7.2158v3.6079h-7.2158zm-32.471%209.0197h7.2158v5.4118h-7.2158zm32.471%200h7.2158v5.4118h-7.2158zm-21.647%201.8039h18.039v21.647l-18.039%200.000001zm-10.824%209.0197h7.2158l0.000013%205.4118h-7.2158zm32.471%200.000001h7.2158v5.4118h-7.2158zm-32.471%2010.824h7.2158v5.4118h-7.2158zm32.471%200h7.2158v5.4118h-7.2158zm-32.471%2018.039h7.2158-0.000013zm32.471-7.2158h7.2158v5.4118h-7.2158zm-32.471%200.000001h7.2158v5.4118l-7.2158%200.000037zm32.471%207.2158h0.000005%207.2158l-0.000023%200.000037z%22%20fill%3D%22%23fff%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%20fill%3D%22%23fff%22%20transform%3D%22translate%28-83%29%22%3E%0D%0A%3Cpath%20style%3D%22color%3A%23000000%22%20d%3D%22m89%201025.9c-2.5462%200-3.5%200.9138-3.5%203.5l-0.000004%2014c0%202.4878%201.0056%203.5%203.5%203.5h20c2.5183%200%203.5-1.0224%203.5-3.5v-14c0-2.5612-1.0774-3.5-3.5-3.5zm-0.5%205c0-2.0035-0.0035-2%202-2h17c2.0035%200%202%200.041%202%202v11c-1.8896-3.2729-6.209-3.1022-8%200-0.22638%200.3921-0.77359%200.3922-1%200-3.7999-6.5816-8.1748-6.6254-12%200z%22%2F%3E%0D%0A%3Ccircle%20cx%3D%22104.5%22%20stroke%3D%22%23fff%22%20cy%3D%221033.9%22%20r%3D%221.44%22%20stroke-width%3D%222.12%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%20fill%3D%22%23fff%22%3E%0D%0A%3Cpath%20style%3D%22color%3A%23000000%22%20d%3D%22m196.5%201022.9v27h23v-27zm15.5%205h-4l-3.5%201-2%202v1l0.5%201%201-0.5%200.5%202%201.5-0.5v1.5l-1%202%201%201%202%201%200.5%202.5%201.5%201v1.5l1%200.5v-2.5l1-1.5v-1.5l1-1%200.5-1.5%201-2-3-1-1.5%200.5-2-0.5-1.5-1.5-1.5%201%200.5-1-1-1-1%200.5v-1h3.5l2-1%202-1s3.4094%200.4138%203.5%200.5c1.7985%201.7131%203%204.0784%203%207%200%205.4272-3.9079%209.5-9.5%209.5-5.4832%200-9.5-3.9844-9.5-9.5%200-5.4875%203.9819-9.5%209.5-9.5%202.1924%200%204%201%204%201z%22%2F%3E%0D%0A%3Cpath%20d%3D%22m112%201049.9-10.5-10h7v-17h7v17h7z%22%2F%3E%0D%0A%3Cpath%20style%3D%22color%3A%23000000%22%20d%3D%22m131.5%201022.9v4c0-0.7456%201.0115-2%202.5-2%201.3788%200%202.5%200.9648%202.5%202.5%200%201.4413-0.96497%202.5-2.5%202.5-1.5038%200-2.5-1.2462-2.5-2v7c0-0.7851%200.93372-2%202.5-2s2.5%200.9336%202.5%202.5c0%201.535-0.99622%202.5-2.5%202.5-1.535%200-2.5-1.3088-2.5-2v7c0-0.7225%200.99622-2%202.5-2%201.41%200%202.5%200.9649%202.5%202.5%200%201.4414-1.0587%202.5-2.5%202.5-1.4725%200-2.5-1.3091-2.5-2v6c0-0.098%201.0587-1%202.5-1%201.4056%200%202.5%200.7986%202.5%201h20v-27z%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3Cg%20transform%3D%22translate%28.21502%2017%29%22%3E%0D%0A%3Cpath%20style%3D%22color%3A%23000000%22%20d%3D%22m-20.462%2034.746c-0.6261-1.0268-2.9818-1.0268-3.6079%200l-22.549%2036.981c-2.1366%203.504%200.08786%207.2158%204.5099%207.2158h39.687c4.2437%200%206.6124-3.7676%204.5099-7.2158zm-1.8039%207.2158%2019.843%2031.569-39.687-0.000054z%22%20transform%3D%22matrix%28.55434%200%200%20.55434%20188.13%20988.1%29%22%20fill%3D%22%23fff%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3Ccircle%20cx%3D%22176%22%20cy%3D%221042.4%22%20r%3D%221.5%22%20fill%3D%22%23fff%22%2F%3E%0D%0A%3Cpath%20d%3D%22m174.5%201033.9v5h3v-5z%22%20fill-rule%3D%22evenodd%22%20fill%3D%22%23fff%22%2F%3E%0D%0A%3C%2Fg%3E%0D%0A%3C%2Fsvg%3E\")!;\ 511 | background-origin: content-box!; background-repeat: no-repeat!; background-size: 7em 1em!; cursor: pointer!; display: inline-block!; float: left!; font-size: @iconSize@px!; height: 1em!; line-height: 1em!; padding: 1px!; text-decoration: none!; width: 1em!;\ 512 | }\ 513 | #rb-div a:hover {background-color: @tooltipBackgroundColor@!;}\ 514 | #rb-tooltip {background: 2px 2px / 20px auto no-repeat @tooltipBackgroundColor@!; color: @tooltipColor@!; font-size: @tooltipFontSize@px!; line-height: normal!; max-width: 600px!; overflow: hidden!; padding: 2px 2px 2px 24px!; position: absolute!; text-align: left!; text-overflow: ellipsis!; visibility: hidden; white-space: nowrap!; z-index: 15000000!;}\ 515 | #rb-tooltip * {line-height: normal!; color: @tooltipColor@!;}\ 516 | a[rb-hl], a[rb-hl] img, area[rb-hl], a[rb-hl-replace]:hover, a[rb-hl-replace]:hover img, area[rb-hl-replace]:hover {outline: 2px dotted rgba(60,60,60,0.25)!;outline-offset: -1px!;}\ 517 | ".replace(/@([^@]+)@/g, function(s, k) { 518 | return ((OPTS.hasOwnProperty(k))? OPTS[k] : s); 519 | }).replace(/!;/g, " !important; "); 520 | 521 | nodeAdd(doc.body || doc.documentElement); 522 | OPTS.watchNodeInserted && observer.observe(doc.body || doc.documentElement, {subtree: true, childList: true}); 523 | } 524 | } 525 | 526 | if ((doc.readyState == "loading") || (doc.readyState == "uninitialized")) { 527 | doc.addEventListener("DOMContentLoaded", onDOMContentLoaded, false); 528 | } else { 529 | onDOMContentLoaded(); 530 | } 531 | } else { 532 | redirectBypasser.stop(); 533 | } 534 | } 535 | 536 | this.stop = function(isFull) { 537 | observer.disconnect(); 538 | targetsRemove(); //removeEventListener "doc:mousemove:handleMousemove", "doc:mouseout:handleMouse" 539 | uiStyle.remove(); 540 | clearTimeout(handleMousemoveTimer); 541 | 542 | if (isFull) { 543 | doc.removeEventListener("keydown", handleKeydown, false); 544 | doc.removeEventListener("keyup", handleKeyup, false); 545 | } 546 | 547 | var els = doc.querySelectorAll("area,a,embed,object,video,audio"); 548 | var i = els.length; 549 | 550 | while (i--) { 551 | var links = JSON.parse(els[i].getAttribute("data-rb-store")); 552 | 553 | if (links) { 554 | els[i].href = links.base.url; 555 | } 556 | 557 | els[i].removeAttribute("data-rb-store"); 558 | els[i].removeAttribute("rb-hl-replace"); 559 | window.HTMLElement.prototype.removeEventListener.call(els[i], "mouseover", handleMouseover, false); 560 | } 561 | } 562 | 563 | sendMessage({name: "opts.get"}, redirectBypasser.start); 564 | } 565 | } -------------------------------------------------------------------------------- /src/images/language.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 18 | 22 | 23 | 24 | 26 | 27 | 29 | image/svg+xml 30 | 32 | 33 | 34 | 35 | 36 | 40 | 44 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/images/rb-icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon128.png -------------------------------------------------------------------------------- /src/images/rb-icon16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon16.png -------------------------------------------------------------------------------- /src/images/rb-icon48-disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon48-disable.png -------------------------------------------------------------------------------- /src/images/rb-icon48-enable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon48-enable.png -------------------------------------------------------------------------------- /src/images/rb-icon48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon48.png -------------------------------------------------------------------------------- /src/images/rb-icon64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozlima/redirectbypasser/d6e40955fbeed389a941425417cb49612ba7902d/src/images/rb-icon64.png -------------------------------------------------------------------------------- /src/install.rdf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirect Bypasser 5 | 2.1.3 6 | Moises Lima 7 | Avoid redirects and has direct access to the sites you want to visit. 8 | http://moisesplima.blogspot.com.br/redirect-bypasser 9 | redirectbypasser@moonlight21.com 10 | true 11 | true 12 | 2 13 | 3 14 | chrome://redirectbypasser/content/options.html 15 | 16 | 17 | 18 | pt-BR 19 | Moises Lima 20 | Redirect Bypasser 21 | Evite redirecionamentos e tenha acesso direto aos sites que você quer visitar. 22 | http://moisesplima.blogspot.com.br/redirect-bypasser 23 | Moises Lima 24 | 25 | 26 | 27 | 28 | sr 29 | Moises Lima 30 | Redirect Bypasser 31 | Избегава преусмеравања и има директан приступ сајтовима које желите да посетите. 32 | http://moisesplima.blogspot.com.br/redirect-bypasser 33 | https://github.com/Sijera 34 | 35 | 36 | 37 | 38 | fr 39 | Moises Lima 40 | Redirect Bypasser 41 | Contourne les redirections en donnant accès aux liens directs. 42 | http://moisesplima.blogspot.com.br/redirect-bypasser 43 | https://github.com/DenB10 44 | 45 | 46 | 47 | 48 | 49 | 50 | {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 51 | 32.0 52 | 46.* 53 | 54 | 55 | 56 | 57 | 58 | 59 | {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} 60 | 2.28 61 | 2.47 62 | 63 | 64 | 65 | 66 | 67 | 68 | {aa3c5121-dab2-40e2-81ca-7ea25febc110} 69 | 32.0 70 | 47.* 71 | 72 | 73 | 74 | chrome://redirectbypasser/content/images/rb-icon48.png 75 | chrome://redirectbypasser/content/images/rb-icon64.png 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | if (!CSS.escape) { 4 | CSS.escape = function(s) { 5 | return s.replace(/[~!@$%^&*\(\)+=,./';:"?><\[\]\\\{\}|`#]/g, "\\$&"); 6 | } 7 | } 8 | 9 | if (!RegExp.escape) { 10 | RegExp.escape = function(s) { 11 | return s.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 12 | } 13 | } 14 | 15 | function t(w) { 16 | if ((t.language in t.languages) && (w in t.languages[t.language])) { 17 | return t.languages[t.language][w]["message"]; 18 | 19 | } else if (("en" in t.languages) && (w in t.languages["en"])) { 20 | return t.languages["en"][w]["message"]; 21 | } 22 | 23 | return t.missing(w); 24 | } 25 | 26 | t.availableLanguages = []; 27 | t.language = "en"; 28 | t.languages = {}; 29 | t.missing = function(w) { 30 | return "-" + w; 31 | } 32 | t.load = function (lng, callback) { 33 | if (!t.availableLanguages.length 34 | && (typeof chrome != undefined) 35 | && chrome.runtime 36 | && chrome.runtime.getPackageDirectoryEntry 37 | ) { 38 | chrome.runtime.getPackageDirectoryEntry(function(fs) { 39 | fs.getDirectory("_locales", {create: false}, function(dir) { 40 | var dr = dir.createReader(); 41 | var rd = function(entries) { 42 | var i = entries.length; 43 | 44 | while (i--) { 45 | if (entries[i].isDirectory) { 46 | t.availableLanguages.push(entries[i].name); 47 | } 48 | } 49 | 50 | if (!entries.length) { 51 | return t.load(lng, callback); 52 | } 53 | 54 | dr.readEntries(rd); 55 | } 56 | 57 | dr.readEntries(rd); 58 | }); 59 | }); 60 | 61 | return t; 62 | } 63 | 64 | if (!lng || lng == "auto" || t.availableLanguages.indexOf(lng) == -1) { 65 | lng = navigator.language.replace("-", "_"); 66 | 67 | if (t.availableLanguages.indexOf(lng) == -1) { 68 | lng = lng.split("_")[0]; 69 | lng = ((t.availableLanguages.indexOf(lng) == -1)? "en" : lng); 70 | } 71 | } 72 | 73 | t.language = lng; 74 | 75 | if (t.languages[lng]) { 76 | callback && callback(); 77 | 78 | } else { 79 | var xhr = new XMLHttpRequest(); 80 | xhr.open("GET", "_locales/" + lng + "/messages.json", true); 81 | xhr.overrideMimeType("application/json"); 82 | xhr.addEventListener("loadend", function() { 83 | if (this.response) { 84 | t.languages[lng] = this.response; 85 | callback && callback(); 86 | } 87 | }); 88 | xhr.addEventListener("error", function(ev) { 89 | alert("Failed to load language : " + lng); 90 | !("en" in t.languages) && t.load("en", callback); 91 | }); 92 | xhr.responseType = "json"; 93 | xhr.send(); 94 | } 95 | 96 | return t; 97 | } 98 | t.node = function (target) { 99 | var nodes = document.evaluate( 100 | "descendant-or-self::*[@data-lang or @*[contains(name(), 'data-lang-')]]", 101 | (target || document), 102 | null, 103 | XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, 104 | null 105 | ); 106 | 107 | for (var i = 0, node; node = nodes.snapshotItem(i); i++) { 108 | var atts = document.evaluate( 109 | "@data-lang | @*[starts-with(name(), 'data-lang-')]", 110 | node, 111 | null, 112 | XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, 113 | null 114 | ); 115 | 116 | for (var ii = 0, att, attn; att = atts.snapshotItem(ii); ii++) { 117 | if (att.name == "data-lang") { 118 | node.textContent = t(att.value); 119 | 120 | } else { 121 | node.setAttribute(att.name.substr(10), t(att.value)); 122 | } 123 | } 124 | } 125 | 126 | return t; 127 | } 128 | 129 | function ce() { 130 | var a = arguments, e = document.createElement(a[0]), l = a.length; 131 | 132 | for (var i = 1, c = l + ~l % 2; i < c; i += 2) { 133 | e.setAttribute(a[i], a[i + 1]); 134 | } 135 | 136 | return ((!(l % 2) && a[l - 1].appendChild(e)) || e); 137 | } 138 | 139 | function q(s, t) { 140 | return Array.prototype.slice.call((t || document).querySelectorAll(s)); 141 | } 142 | 143 | function tabSelect(id) { 144 | var tab = document.getElementById(id.replace("#", "")); 145 | 146 | if (tab) { 147 | var xpath = document.evaluate( 148 | "//div[@id='" + tab.id 149 | + "']/ancestor-or-self::*[contains(concat(' ', @class, ' '), ' tab ')]/../div[contains(concat(' ', @class, ' '), ' tab ')]", 150 | document, 151 | null, 152 | XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, 153 | null 154 | ); 155 | 156 | for (var i = 0, isDescendant = false, el; el = xpath.snapshotItem(i); i++) { 157 | isDescendant = el.contains(tab); 158 | el.classList[((isDescendant)? "add" : "remove")]("tab-selected"); 159 | 160 | if (el.id) { 161 | var nodes = document.querySelectorAll("a[href$=\"#" + CSS.escape(el.id) + "\"]" + ((isDescendant)? "" : ".tab-selected" )); 162 | 163 | for (var ii = 0, el2; el2 = nodes[ii]; ii++ ) { 164 | el2.classList[((isDescendant)? "add" : "remove")]("tab-selected"); 165 | } 166 | } 167 | } 168 | 169 | return true; 170 | } 171 | 172 | return false; 173 | } 174 | 175 | var mlWatcher = new function() { 176 | var self = this, loaded = {}, timer = 0, callbacks = [], ids = []; 177 | 178 | var onLoaded = function(id) { 179 | if (id) { 180 | ids.push(id); 181 | clearTimeout(timer); 182 | timer = setTimeout(onLoaded, 20); 183 | return; 184 | } 185 | 186 | var i = ids.length; 187 | 188 | while (i--) { 189 | var ii = callbacks.length, idx = 0; 190 | 191 | while (ii--) { 192 | idx = callbacks[ii].indexOf(ids[i]); 193 | 194 | if (idx != -1) { 195 | callbacks[ii].splice(idx, 1); 196 | 197 | if (callbacks[ii].length == 1) { 198 | callbacks[ii][0](); 199 | callbacks.splice(ii, 1); 200 | } 201 | } 202 | } 203 | } 204 | 205 | ids.length = 0; 206 | } 207 | 208 | this.setItem = function(id, v) { 209 | loaded[id] = +v; 210 | onLoaded(id); 211 | } 212 | 213 | this.getItem = function(id) { 214 | return ((loaded[id] == undefined)? -1 : loaded[id]); 215 | } 216 | 217 | this.onItemsDone = function() { 218 | var args = []; 219 | 220 | for (var i = 0, l = arguments.length - 1; i < l; i++) { 221 | if (self.getItem(arguments[i]) == -1) { 222 | args.push(arguments[i]); 223 | } 224 | } 225 | 226 | if (args.length) { 227 | callbacks.push([arguments[arguments.length - 1]].concat(args)); 228 | 229 | } else { 230 | arguments[arguments.length - 1](); 231 | } 232 | } 233 | 234 | this.watchLoad = function(obj, id) { 235 | if (loaded[id] == undefined) { 236 | var watchLoad = function(ev) { 237 | obj.removeEventListener(ev.type, watchLoad, true); 238 | self.setItem(id, +(ev.type == "load" || ev.type == "DOMContentLoaded")); 239 | } 240 | loaded[t] = -1; 241 | 242 | if (obj instanceof HTMLDocument) { 243 | if ((obj.readyState != "interactive") && (obj.readyState != "complete")) { 244 | obj.addEventListener("DOMContentLoaded", watchLoad, true); 245 | 246 | } else { 247 | mlWatcher.setItem("DOMContentLoaded", 1); 248 | } 249 | 250 | } else if (obj instanceof Window || obj instanceof XMLHttpRequest || obj instanceof HTMLElement) { 251 | obj.addEventListener("load", watchLoad, true); 252 | !(obj instanceof Window) && obj.addEventListener("error", watchLoad, true); 253 | } 254 | } 255 | 256 | return obj; 257 | } 258 | } 259 | 260 | function addItem(id) { 261 | var tpl = document.getElementById("tpl-" + id); 262 | var el = document.importNode(tpl.content.firstElementChild, true); 263 | var gid = Math.random().toString(36).substr(2, 9); 264 | var atts = document.evaluate("descendant-or-self::*/@*[contains(., \"\!ID!\")]", el, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 265 | 266 | for (var i = 0, att, attn; att = atts.snapshotItem(i); i++ ) { 267 | att.value = att.value.replace(/!ID!/g, gid); 268 | } 269 | 270 | tpl.parentNode.insertBefore(el, tpl); 271 | return el; 272 | } 273 | 274 | function getNodeListValues(selector, arrayRef, target, preF) { 275 | var values = []; 276 | var arr = q(selector, target).filter(function(item, pos, arr) { 277 | var val = ((typeof preF == "function")? preF(item) : item.value); 278 | if ((val.length && (arr.indexOf(item) == pos) && (!arrayRef || (arrayRef.indexOf(val) == -1)))) { 279 | values.push(val); 280 | arrayRef && arrayRef.push(val); 281 | return true; 282 | } 283 | 284 | return false; 285 | }); 286 | 287 | return values; 288 | } 289 | 290 | function fadein(el) { 291 | el.classList.add("fadein"); 292 | setTimeout(function() { 293 | el.classList.remove("fadein"); 294 | }, 1100); 295 | } 296 | 297 | window.addEventListener("click", function(ev) { 298 | ev.target.hash && setTimeout(function(x, y){window.scroll(x, y);}, 100, window.scrollX, window.scrollY); 299 | }, true); 300 | 301 | window.addEventListener("hashchange", function(ev) { 302 | tabSelect(location.hash); 303 | ev.preventDefault(); 304 | ev.stopPropagation(); 305 | }, true); 306 | 307 | window.addEventListener("load", function() { 308 | var eventTarget, dragSrcEl, dragTargetEl; 309 | var uiStyle = ce("style"); 310 | var uiImgMove = ce("img", "src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAKFJREFUOI29k9ENwyAMRH3tLmSNLGDDRiUbNckC6RhhGfcLiVJiUkXq/YHunvABRIaYfWT20fLcrTCAB4DRuQEp7dtpQA7ndQ9yKJGgIkEtz+0nogXolVXqy8vsY++opUSCZgjqwrKW5Yk6VHtUdbrcARFdG+ED0jK2wKcL/8s7QGuzdTOqOq3rHGtv8y+ktG/ODQAwWuFDQAkhotdRmIjoDUwkT9iVjrbcAAAAAElFTkSuQmCC", "style", "position: absolute;z-index: 2000;width:auto;padding:2px;box-sizing: border-box;cursor:move;display:none;"); 311 | var uiImgClose = ce("img", "src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNqkU9ENhCAMBSdxBG8H2AMmO/bgywl0A92Ea72SlFrxcjZpKuG9+igPW0oxT2LgC+/9dEcAzKg2gI0AZYH67pARs1E9wuIR6M8Lw6acc1TIvPkLMOuhAD+QxDYDV6KQE3G+ChgQQYEDIWeFHJsjCKmyiekdbZAIAqRfyGoDivkvH1wMTB3slZFO0+7djmak07SVmTRNqpHQntuNkeTtNEbaocTetIWSWI1kUEFN59zE11pKjH36nD8CDACsIpgfdd3pqwAAAABJRU5ErkJggg==", "style", "position: absolute;z-index: 2000;width:auto;padding:2px;box-sizing: border-box;cursor:pointer;display:none;"); 312 | 313 | uiStyle.textContent = "\ 314 | /* removable */\ 315 | input[type=\"text\"][data-removable=\"true\"] {\ 316 | padding: 0px 1.8em 0px 2px;\ 317 | }\ 318 | /* movable or checkable */\ 319 | input[type=\"text\"][data-movable],\ 320 | input[type=\"text\"][data-checkable] {\ 321 | padding: 0px 2px 0px 1.8em;\ 322 | }\ 323 | /* movable & checkable & removable */\ 324 | input[type=\"text\"][data-removable=\"true\"][data-movable][data-checkable] {\ 325 | padding: 0px 1.8em 0px 3.6em;\ 326 | }\ 327 | /* removable & checkable or removable & checkable */\ 328 | input[type=\"text\"][data-removable=\"true\"][data-movable],\ 329 | input[type=\"text\"][data-removable=\"true\"][data-checkable] {\ 330 | padding: 0px 1.8em 0px 1.8em;\ 331 | }\ 332 | /* movable & checkable */\ 333 | input[type=\"text\"][data-movable][data-checkable] {\ 334 | padding: 0px 2px 0px 3.6em;\ 335 | }\ 336 | input[type=\"text\"][data-checkable] {\ 337 | background-repeat: no-repeat;\ 338 | background-color: transparent;\ 339 | background-size: 1em;\ 340 | background-image: url(\"images/input-unchecked.png\");\ 341 | background-position: 2px center;\ 342 | }\ 343 | input[type=\"text\"][data-checkable][data-checked=\"true\"] {\ 344 | background-image: url(\"images/input-checked.png\");\ 345 | }\ 346 | html.ml-drag * {\ 347 | cursor: move !important;\ 348 | }\ 349 | html.ml-drag1 *:not([data-movable]) {\ 350 | cursor: no-drop !important;\ 351 | }\ 352 | input.ml-drag-source {\ 353 | opacity: 0.25;\ 354 | visibility:hidden;\ 355 | cursor: move !important;\ 356 | }\ 357 | input.ml-drag-target-before,\ 358 | input.ml-drag-target-after {\ 359 | opacity: 0.5;\ 360 | cursor: alias !important;\ 361 | }\ 362 | input.ml-drag-target-before {\ 363 | box-shadow:-4px 0px 3px -2px black;\ 364 | }\ 365 | input.ml-drag-target-after {\ 366 | box-shadow: 4px 0px 3px -2px black;\ 367 | }\ 368 | input[data-movable-vertical].ml-drag-target-before {\ 369 | box-shadow: 0px -4px 3px -2px black;\ 370 | }\ 371 | input[data-movable-vertical].ml-drag-target-after {\ 372 | box-shadow: 0px 4px 3px -2px black;\ 373 | }\ 374 | .ml-fadein {\ 375 | animation: ml-fade-in 2000ms;\ 376 | }\ 377 | @keyframes ml-fade-in {\ 378 | 0% {\ 379 | opacity: 0;\ 380 | }\ 381 | 100% {\ 382 | opacity: 1;\ 383 | }\ 384 | }\ 385 | "; 386 | 387 | document.documentElement.insertBefore(uiStyle, document.documentElement.firstChild); 388 | document.documentElement.insertBefore(uiImgMove, document.documentElement.firstChild); 389 | document.documentElement.insertBefore(uiImgClose, document.documentElement.firstChild); 390 | 391 | function fadein(el) { 392 | el.classList.add("ml-fadein"); 393 | setTimeout(function() { 394 | el.classList.remove("ml-fadein"); 395 | }, 2100); 396 | } 397 | 398 | var uiImgMoveOnmousedown = function(ev) { 399 | if (eventTarget && eventTarget.hasAttribute("data-movable")) { 400 | dragSrcEl = eventTarget; 401 | dragSrcEl.classList.add("ml-drag-source"); 402 | document.addEventListener("mouseup", documentOnmouseup, true); 403 | document.addEventListener("mousemove", documentOnmousemove, true); 404 | ev.preventDefault(); 405 | ev.stopPropagation(); 406 | } 407 | } 408 | 409 | var documentOnmouseup = function(ev) { 410 | if (dragTargetEl && (ev.target.getAttribute("data-movable") == dragSrcEl.getAttribute("data-movable"))) { 411 | dragSrcEl.parentNode.removeChild(dragSrcEl); 412 | dragTargetEl.parentNode.insertBefore(dragSrcEl , ((dragTargetEl.classList.contains("ml-drag-target-before"))? dragTargetEl : dragTargetEl.nextElementSibling)); 413 | fadein(dragSrcEl); 414 | } 415 | 416 | document.documentElement.classList.remove("ml-drag"); 417 | dragSrcEl && dragSrcEl.classList.remove("ml-drag-source"); 418 | dragTargetEl && dragTargetEl.classList.remove("ml-drag-target-before", "ml-drag-target-after"); 419 | dragSrcEl = null; 420 | dragTargetEl = null; 421 | ev.currentTarget.removeEventListener("mouseup", documentOnmouseup, true); 422 | ev.currentTarget.removeEventListener("mousemove", documentOnmousemove, true); 423 | } 424 | 425 | var documentOnmousemove = function(ev) { 426 | if (dragSrcEl && (ev.target !== dragSrcEl)) { 427 | dragTargetEl && dragTargetEl.classList.remove("ml-drag-target-before", "ml-drag-target-after"); 428 | 429 | if (ev.target.getAttribute("data-movable") == dragSrcEl.getAttribute("data-movable")) { 430 | dragTargetEl = ev.target; 431 | if (ev.target.hasAttribute("data-movable-vertical")) { 432 | dragTargetEl.classList.add(((((ev.offsetY || ev.layerY) / dragTargetEl.offsetHeight) < 0.5)? "ml-drag-target-before" : "ml-drag-target-after")); 433 | } else { 434 | dragTargetEl.classList.add(((((ev.offsetX || ev.layerX) / dragTargetEl.offsetWidth) < 0.5)? "ml-drag-target-before" : "ml-drag-target-after")); 435 | } 436 | } 437 | 438 | document.documentElement.classList.add("ml-drag"); 439 | dragSrcEl && dragSrcEl.blur(); 440 | ev.preventDefault(); 441 | ev.stopPropagation(); 442 | } 443 | } 444 | 445 | var fieldOnMouseOver = function(ev) { 446 | uiImgMove.style.display = "none"; 447 | uiImgClose.style.display = "none"; 448 | 449 | if (!dragSrcEl) { 450 | var rect = ev.target.getBoundingClientRect(); 451 | var isRemovable = (ev.target.getAttribute("data-removable") == "true"); 452 | var movableId = ev.target.getAttribute("data-movable"); 453 | var checkableId = ev.target.getAttribute("data-checkable"); 454 | 455 | eventTarget = ev.target; 456 | 457 | if (isRemovable) { 458 | uiImgClose.style.top = (window.pageYOffset + rect.top) + "px"; 459 | uiImgClose.style.left = (window.pageXOffset + rect.right - rect.height) + "px"; 460 | uiImgClose.style.height = rect.height + "px"; 461 | uiImgClose.style.display = "initial"; 462 | } 463 | 464 | if (movableId) { 465 | uiImgMove.style.top = (window.pageYOffset + rect.top) + "px"; 466 | uiImgMove.style.left = (window.pageXOffset + rect.left + ((checkableId)? rect.height : 0)) + "px"; 467 | uiImgMove.style.height = rect.height + "px"; 468 | uiImgMove.style.display = "initial"; 469 | } 470 | } 471 | } 472 | 473 | var fieldOnMouseOut = function(ev) { 474 | if (ev.relatedTarget && (ev.relatedTarget !== uiImgMove && ev.relatedTarget !== uiImgClose)) { 475 | uiImgMove.style.display = "none"; 476 | uiImgClose.style.display = "none"; 477 | } 478 | } 479 | 480 | var fieldOnClick = function(ev) { 481 | if (ev.target.hasAttribute("data-checkable")) { 482 | var tgt = ev.target; 483 | var style = window.getComputedStyle(tgt); 484 | var lx = (ev.offsetX || ev.layerX); 485 | 486 | if (((tgt.type == "radio") || (tgt.type == "checkbox")) || ((parseInt(style.height, 10) > lx) && lx < tgt.offsetWidth)) { 487 | if (tgt.hasAttribute("data-checkable-multiple")) { 488 | tgt.setAttribute("data-checked", ((tgt.getAttribute("data-checked") == "true")? "false" : "true")); 489 | } else { 490 | var els = document.querySelectorAll("[data-checkable=\"" + CSS.escape(tgt.getAttribute("data-checkable")) + "\"]:not([data-checkable-multiple])"); 491 | 492 | for(var i = 0, l = els.length; i < l; i++) { 493 | els[i].removeAttribute("data-checked"); 494 | els[i].checked = false; 495 | } 496 | 497 | tgt.setAttribute("data-checked", "true"); 498 | tgt.checked = true; 499 | 500 | var evt = new Event("change", {"bubbles": true, "cancelable": true}); 501 | tgt.dispatchEvent(evt); 502 | } 503 | } 504 | } 505 | } 506 | 507 | var fieldOnMouseMove = function(ev) { 508 | var style = window.getComputedStyle(this); 509 | this.style.cursor = ((parseInt(style.height, 10) > (ev.offsetX || ev.layerX))? "pointer" : "initial"); 510 | } 511 | 512 | uiImgClose.addEventListener("mouseout", fieldOnMouseOut, false); 513 | uiImgClose.addEventListener("click", function() { 514 | if (eventTarget) { 515 | var evt = new CustomEvent("inputremove", {bubbles: true, cancelable: true}); 516 | 517 | if (eventTarget.dispatchEvent(evt)) { 518 | eventTarget.parentNode.removeChild(eventTarget); 519 | uiImgMove.style.display = "none"; 520 | uiImgClose.style.display = "none"; 521 | eventTarget = null; 522 | } 523 | 524 | var evt = new CustomEvent("inputafterremove", {bubbles: true, cancelable: false}); 525 | document.dispatchEvent(evt); 526 | } 527 | }, true); 528 | uiImgMove.addEventListener("mouseout", fieldOnMouseOut, false); 529 | uiImgMove.addEventListener("mousedown", uiImgMoveOnmousedown, true); 530 | 531 | var removableInputHook = function(field) { 532 | if ((field.nodeName.toUpperCase() == "INPUT") && (field.nodeType == field.ELEMENT_NODE)) { 533 | var isRemovable = (field.getAttribute("data-removable") == "true"); 534 | var movableId = field.getAttribute("data-movable"); 535 | var checkableId = field.getAttribute("data-checkable"); 536 | 537 | field[(checkableId)? "addEventListener" : "removeEventListener"]("click", fieldOnClick, false); 538 | 539 | if (field.type == "text") { 540 | field[(isRemovable || movableId || checkableId)? "addEventListener" : "removeEventListener"]("mousemove", fieldOnMouseMove, false); 541 | field[(isRemovable || movableId || checkableId)? "addEventListener" : "removeEventListener"]("mouseover", fieldOnMouseOver, false); 542 | field[(isRemovable || movableId || checkableId)? "addEventListener" : "removeEventListener"]("focus", fieldOnMouseOver, false); 543 | field[(isRemovable || movableId || checkableId)? "addEventListener" : "removeEventListener"]("mouseout", fieldOnMouseOut, false); 544 | field[(isRemovable || movableId || checkableId)? "addEventListener" : "removeEventListener"]("blur", fieldOnMouseOut, false); 545 | } 546 | } else if (field.querySelectorAll) { 547 | var els = field.querySelectorAll("input[type=\"text\"][data-removable=\"true\"], [data-movable], [data-checkable]"); 548 | for(var i = 0, l = els.length; i < l; i++) { 549 | removableInputHook(els[i]); 550 | } 551 | } 552 | } 553 | 554 | var observer = new MutationObserver(function(ms) { 555 | for (var i = 0; i < ms.length; i++) { 556 | if (ms[i].type == "attributes") { 557 | removableInputHook(ms[i].target); 558 | } else { 559 | for (var j = 0; j < ms[i].addedNodes.length; j++) { 560 | removableInputHook(ms[i].addedNodes[j]); 561 | } 562 | } 563 | } 564 | }); 565 | 566 | observer.observe(window.document.body || window.document.documentElement, { 567 | subtree: true , 568 | attributes: false, 569 | childList: true, 570 | characterData: false, 571 | attributeOldValue: false, 572 | characterDataOldValue: false 573 | }); 574 | 575 | var els = document.querySelectorAll("input[type=\"text\"][data-removable=\"true\"], [data-movable], [data-checkable]"); 576 | 577 | for(var i = 0, l = els.length; i < l; i++) { 578 | removableInputHook(els[i]); 579 | } 580 | }, true); 581 | 582 | 583 | var sendMessage = (((typeof(chrome) == "object") && ("runtime" in chrome) && ("sendMessage" in chrome.runtime)) 584 | ? chrome.runtime.sendMessage 585 | : sendMessage 586 | ); 587 | var OPTS_DEFAULT = JSON.parse(JSON.stringify(OPTS)); 588 | var SITESRULES_DEFAULT = JSON.parse(JSON.stringify(SITESRULES)); 589 | t.availableLanguages = ["en", "fr", "pt_BR", "sr"]; 590 | 591 | mlWatcher.watchLoad(document, "DOMContentLoaded"); 592 | 593 | (function() { 594 | var initStorage = function(optsStored, sitesrulesStored) { 595 | SITESRULES = ((!!sitesrulesStored && typeof(sitesrulesStored) == "object")? sitesrulesStored : SITESRULES); 596 | 597 | rb.optsBuild(optsStored); 598 | rb.sitesBuildRules(SITESRULES); 599 | t.load("en", function() { 600 | t.load(OPTS.language, function() { 601 | mlWatcher.setItem("storage+translation", 1); 602 | }); 603 | }); 604 | } 605 | 606 | if ((typeof(chrome) == "object") && chrome.storage) { 607 | chrome.storage.local.get(["opts", "sitesrules"], function(storageData) { 608 | setTimeout(initStorage, 10, storageData.opts, storageData.sitesrules); 609 | //initStorage(storageData.opts || {}, storageData.sitesrules || {}); 610 | }); 611 | 612 | } else { 613 | var optsStored, sitesrulesStored; 614 | var pref = Components.classes["@mozilla.org/preferences-service;1"] 615 | .getService(Components.interfaces.nsIPrefService) 616 | .getBranch("extensions.redirectbypasser."); 617 | 618 | if (pref.getPrefType("opts") == pref.PREF_STRING) { 619 | try { 620 | optsStored = JSON.parse(pref.getCharPref("opts")); 621 | } catch(e) {} 622 | } 623 | 624 | if (pref.getPrefType("sitesrules") == pref.PREF_STRING) { 625 | try { 626 | sitesrulesStored = JSON.parse(pref.getCharPref("sitesrules")); 627 | } catch(e) {} 628 | } 629 | 630 | windowList(function(win) { 631 | ((win.location.href.indexOf("chrome://redirectbypasser/content/") === 0) && (win !== window)) && win.close(); 632 | }); 633 | 634 | initStorage(optsStored, sitesrulesStored); 635 | } 636 | })(); 637 | 638 | mlWatcher.onItemsDone("storage+translation", "DOMContentLoaded", function() { 639 | var handleKeyList = {}; 640 | var handleKeyTimer = 0; 641 | 642 | t.availableLanguages.sort().forEach(function(key) { 643 | this.options.add(new Option(key.replace("_", "-").toUpperCase(), key)); 644 | }, document.getElementById("select-language")); 645 | 646 | Object.keys(OPTS).forEach(function(key) { 647 | q("input[name=\"" + CSS.escape(key) + "\"], select[name=\"" + CSS.escape(key) + "\"]").forEach(function(el) { 648 | if (el.hasAttribute("data-keyboard-keys")) { 649 | el.value = convertkeys(OPTS[key].split(",")); 650 | 651 | el.setAttribute("data-keyboard-keys", OPTS[key]); 652 | el.addEventListener("keyup", function(ev) { 653 | clearTimeout(handleKeyTimer); 654 | 655 | handleKeyTimer = setTimeout(handleKey, 300, ev.target); 656 | handleKeyList[ev.key || ev.keyIdentifier] = 0; 657 | }, false); 658 | 659 | el.addEventListener("keydown", function(ev) { 660 | setTimeout(function() { 661 | ev.target.value = ((ev.target.value[0] == ".")? " . . . " : ". . . ."); 662 | },10); 663 | }, false); 664 | 665 | el.addEventListener("input", function(ev) { 666 | ev.target.value = convertkeys(ev.target.getAttribute("data-keyboard-keys").split(",")); 667 | }, false); 668 | 669 | } else if (el.getAttribute("type") == "radio" ) { 670 | el.checked = (el.value == OPTS[key]); 671 | 672 | } else { 673 | el.checked = OPTS[key]; 674 | el.value = OPTS[key]; 675 | } 676 | }); 677 | }); 678 | 679 | document.getElementById("about-version").textContent = OPTS_DEFAULT.version; 680 | 681 | setTimeout(mlWatcher.setItem, 0, "resources", 1); 682 | 683 | function convertkeys(keys) { 684 | keys.forEach(function(k, i) { 685 | keys[i] = ((k[1] == "+")? String.fromCharCode(parseInt(k.substr(2), 16)) : k); 686 | }); 687 | 688 | return keys.sort(function(a, b) {return b.length - a.length;}).join(" + ").toUpperCase(); 689 | } 690 | 691 | function handleKey(target) { 692 | var akeys = Object.keys(handleKeyList), skeys = akeys.sort().join(",").toUpperCase(); 693 | 694 | if (/U\+0008|BACKSPACE/.test(skeys)) { 695 | akeys = []; 696 | skeys = ""; 697 | } 698 | 699 | target.setAttribute("data-keyboard-keys", skeys); 700 | target.value = convertkeys(akeys); 701 | handleKeyList = {}; 702 | } 703 | }); 704 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Redirect Bypasser", 3 | "version": "2.1.3", 4 | "manifest_version": 2, 5 | "homepage_url": "http://moisesplima.blogspot.com.br/redirect-bypasser", 6 | "default_locale": "en", 7 | "description": "__MSG_extShortDesc__", 8 | "developer": { 9 | "name": "Moises Lima", 10 | "url": "http://moisesplima.blogspot.com.br" 11 | }, 12 | "icons": { 13 | "16": "images/rb-icon16.png", 14 | "48": "images/rb-icon48.png", 15 | "64": "images/rb-icon64.png", 16 | "128": "images/rb-icon128.png" 17 | }, 18 | "background": { 19 | "scripts": ["background-common.js", "background.js"], 20 | "persistent": true 21 | }, 22 | "options_page": "options.html", 23 | "options_ui": { 24 | "page": "options.html", 25 | "chrome_style": false, 26 | "open_in_tab": true 27 | }, 28 | "content_scripts": [{ 29 | "matches": ["http://*/*", "https://*/*", "ftp://*/*", "file://*/*"], 30 | "js": ["content-scripts/content.js"], 31 | "run_at": "document_start", 32 | "all_frames": true 33 | }], 34 | "permissions": [ 35 | "tabs", 36 | "storage", 37 | "http://*/*", 38 | "https://*/*", 39 | "file://*/*", 40 | "notifications" 41 | ], 42 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 43 | "applications": { 44 | "gecko": { 45 | "id": "redirectbypasser@moonlight21.com", 46 | "strict_min_version": "47.0" 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/options.css: -------------------------------------------------------------------------------- 1 | * { 2 | color: #111111; 3 | font: menu; 4 | margin: 0; 5 | padding: 0; 6 | text-rendering: optimizeLegibility; 7 | text-shadow: transparent 0 0 0, rgba(0,0,0,0.68) 0 0 0; 8 | -webkit-font-smoothing: antialiased; 9 | -webkit-text-stroke: 0.1px rgba(0,0,0,0.5); 10 | } 11 | 12 | html {overflow-y: scroll;} 13 | 14 | html, 15 | body { 16 | background-color: #FFFFFF; 17 | color: #111111; 18 | font: menu; 19 | height: 100%; 20 | } 21 | 22 | strong, b { 23 | font-weight: bold; 24 | } 25 | 26 | .wrapper { 27 | height: auto !important; 28 | margin: 0 auto -30px auto; 29 | max-width: 600px; 30 | min-height: 100%; 31 | min-width: 300px; 32 | padding: 0 2px; 33 | } 34 | 35 | .footer, .push{ 36 | height: 30px; 37 | text-align: center; 38 | } 39 | 40 | h1#page-title { 41 | color: #EEEEEE; 42 | font-size: 7rem; 43 | height: 3rem; 44 | letter-spacing: -0.85rem; 45 | line-height: 1.5rem; 46 | overflow: hidden; 47 | text-indent: -0.85rem; 48 | text-overflow: clip; 49 | white-space: nowrap; 50 | } 51 | 52 | h1, h2, h3 { 53 | -webkit-text-stroke: 0 !important; 54 | font-weight: normal; 55 | text-shadow: none !important; 56 | } 57 | 58 | h2 { 59 | color: #DEDEDE; 60 | font-size: 2.5rem; 61 | height: 0.75em; 62 | letter-spacing: -0.10em; 63 | line-height: 0.62em; 64 | margin: .15em 0; 65 | overflow: hidden; 66 | text-overflow: clip; 67 | white-space: nowrap; 68 | } 69 | 70 | h3 { 71 | color: #666666; 72 | font-size: 1.17em; 73 | margin: .10em 0; 74 | } 75 | 76 | a { 77 | color: #02679C; 78 | cursor: pointer; 79 | text-decoration: none; 80 | } 81 | 82 | input:not([type="checkbox"]):not([type="radio"]), 83 | button, 84 | select { 85 | box-sizing: border-box; 86 | color: #555555; 87 | font-size: 1rem; 88 | height: 1.5em; 89 | vertical-align: middle; 90 | } 91 | 92 | select, 93 | button, 94 | input[type="color"], 95 | input[type="text"], 96 | input[type="number"] { 97 | border: 1px solid #DDDDDD; 98 | } 99 | 100 | select:disabled { 101 | background-color: #DDDDDD; 102 | } 103 | 104 | select[size] { 105 | cursor: pointer; 106 | height: auto; 107 | } 108 | 109 | input[type="number"]{ 110 | padding: 0 0 0 2px; 111 | } 112 | 113 | input[type="text"] { 114 | padding: 0 2px; 115 | } 116 | 117 | input[type="radio"] { 118 | vertical-align: middle; 119 | } 120 | 121 | button, 122 | input[type="text"] { 123 | color: #666666; 124 | margin: 1px 1px 1px 0; 125 | } 126 | 127 | button { 128 | background-color: #AAAAAA; 129 | border: none; 130 | color: #FFFFFF; 131 | cursor: pointer; 132 | padding: 0 5px; 133 | text-align: center; 134 | } 135 | 136 | button * { 137 | pointer-events: none; 138 | } 139 | 140 | button.green { 141 | background-color: #008287; 142 | color: #FFFFFF; 143 | } 144 | 145 | button.red { 146 | background-color: #C0392B; 147 | color: #FFFFFF; 148 | } 149 | 150 | button.icon { 151 | padding: 0; 152 | width: 1.5rem; 153 | } 154 | 155 | button.icon img { 156 | height: 100%; 157 | } 158 | 159 | .nav { 160 | margin: -1rem 0 10px 0; 161 | } 162 | 163 | .nav a, 164 | .nav a span { 165 | color: #333333; 166 | display: inline-table; 167 | font-size: 1.10rem; 168 | padding: 0 5px 0 5px; 169 | text-shadow: 0 0 0.5px rgba(0,0,0,0.5); 170 | } 171 | 172 | .nav a:first-child, 173 | .nav a span:first-child { 174 | padding-left: 0; 175 | } 176 | 177 | .nav a:first-letter, 178 | .nav a span:first-letter { 179 | text-transform: uppercase; 180 | } 181 | 182 | .nav a:hover, 183 | .nav a span:hover { 184 | color: #999999; 185 | } 186 | 187 | .nav a.tab-selected, 188 | .nav a.tab-selected span { 189 | color: #C0392B; 190 | transition: color 0.5s linear; 191 | } 192 | 193 | .tab { 194 | display: none; 195 | } 196 | 197 | .tab.tab-selected { 198 | display: block; 199 | } 200 | 201 | .template { 202 | display: none; 203 | } 204 | 205 | div.field { 206 | border-bottom: 1px solid #F9F9F9; 207 | padding: 3px 0px; 208 | } 209 | 210 | div.field > label:first-child { 211 | display: inline-block; 212 | vertical-align: top; 213 | width: 50%; 214 | } 215 | 216 | div.field > label:first-child ~ input[type="text"] { 217 | width: 45%; 218 | } 219 | 220 | div.field input[type="number"], 221 | div.field input[type="range"] { 222 | width: 5rem; 223 | } 224 | 225 | div.siterule { 226 | border-bottom: 1px dashed #E1E1E1; 227 | margin-bottom: 5px; 228 | padding: 0px 0px 5px 0px; 229 | } 230 | 231 | div.siterule > div { 232 | display: inline-block; 233 | vertical-align: top; 234 | } 235 | 236 | div.siterule > div:first-child { 237 | width: 50%; 238 | } 239 | 240 | div.siterule > div:nth-child(2) { 241 | width: calc(50% - 25px); 242 | } 243 | 244 | div.siterule > div:nth-child(3) { 245 | width: 25px; 246 | } 247 | 248 | div.siterule > div:nth-child(3) button { 249 | clear: both; 250 | float: right; 251 | margin-right: 0px; 252 | } 253 | 254 | .siterule-rule-pattern { 255 | width: 99%; 256 | } 257 | 258 | .siterule-rule-param { 259 | width: 10rem; 260 | } 261 | 262 | .protocol-item, 263 | .excludedattr-item, 264 | .extorder-item { 265 | width: 10rem; 266 | } 267 | 268 | #test-area { 269 | border: 2px dotted rgba(0,0,0,0.2); 270 | color: #aaa; 271 | display: block; 272 | margin: 5px 0px; 273 | padding: 10px; 274 | text-align: center; 275 | } 276 | 277 | .action-buttons { 278 | padding: 5px 0; 279 | text-align: right; 280 | } 281 | 282 | .action-buttons select, 283 | .action-buttons button { 284 | border: none; 285 | color: #FFFFFF; 286 | display: inline-block; 287 | height: 2.5rem; 288 | margin: 0 1px; 289 | text-align: center; 290 | } 291 | 292 | .action-buttons select { 293 | background-color: #AAAAAA; 294 | background-image: url("images/language.svg"); 295 | background-position: right; 296 | background-repeat: no-repeat; 297 | background-size: auto; 298 | color: transparent; 299 | text-shadow: none; 300 | width: 2.5rem; 301 | -webkit-appearance: none; 302 | -webkit-text-stroke: 0 !important; 303 | /* Firefox */ 304 | -moz-appearance: none; 305 | text-indent: 0.01px; 306 | text-overflow: ""; 307 | cursor: pointer; 308 | text-align: left; 309 | text-shadow: none !important; 310 | } 311 | 312 | .action-buttons select:hover, 313 | .action-buttons select:focus, 314 | .action-buttons select:hover option, 315 | .action-buttons select:focus option { 316 | background-color: #4887E4; 317 | color: #FFFFFF; 318 | width: 128px; 319 | } 320 | 321 | .action-buttons input[type="button"] { 322 | padding: 0 5px; 323 | width: auto; 324 | } 325 | 326 | .notice, .notice:before { 327 | font-family: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, monospace; 328 | tab-size: 0; 329 | -moz-tab-size: 0; 330 | } 331 | 332 | .notice { 333 | margin: 4px 0px 4px 20px; 334 | padding: 0px 4px 0px 4px; 335 | white-space: pre-wrap; 336 | } 337 | 338 | .notice:before { 339 | color: #FFFFFF; 340 | float: left; 341 | font-size: 32px; 342 | height: 18px; 343 | line-height: 12px; 344 | margin-left: -22px; 345 | overflow: hidden; 346 | text-shadow: none; 347 | width: 18px; 348 | -webkit-font-smoothing: antialiased; 349 | -webkit-text-stroke: 0; 350 | } 351 | 352 | .warning:before { 353 | background: #FFBF00; 354 | content: "!"; 355 | } 356 | 357 | .fadein { 358 | -webkit-animation: fade-in 500ms; 359 | animation: fade-in 500ms; 360 | } 361 | 362 | @-webkit-keyframes fade-in { 363 | 0% { 364 | opacity: 0.25; 365 | } 366 | 367 | 50% { 368 | opacity: 0; 369 | } 370 | 371 | 100% { 372 | opacity: 1; 373 | }; 374 | } 375 | 376 | ::-webkit-scrollbar { 377 | background-color: transparent; 378 | height: 10px; 379 | width: 10px; 380 | } 381 | 382 | ::-webkit-scrollbar-thumb { 383 | background-color: #E9E9E9; 384 | border-width: 0 0 0 2px; 385 | border: 2px solid #FFFFFF; 386 | } -------------------------------------------------------------------------------- /src/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirect Bypasser 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Redirect Bypasser 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 34 | ... 35 | ... 36 | ... 37 | 38 | 39 | ... 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | () 53 | 54 | ... 55 | 56 | 57 | * 59 | 60 | 61 | ** 63 | 64 | 65 | ** 67 | 68 | 69 | ** 71 | 72 | 73 | 75 | 76 | 77 | 79 | 80 | 81 | 82 | ... 83 | 84 | 86 | 87 | 88 | 90 | 91 | 92 | 93 | 95 | 96 | 97 | 99 | 100 | 101 | 103 | 104 | ... 105 | 106 | 108 | 109 | ... 110 | 111 | 113 | 114 | 115 | 117 | 118 | 119 | 121 | 122 | 123 | 125 | 126 | 127 | 128 | ... 129 | 130 | + 132 | 133 | ... 134 | 135 | 137 | 138 | 139 | 141 | 142 | 143 | 145 | 146 | 147 | 149 | 150 | ... 151 | 152 | + 154 | 155 | 156 | 158 | 159 | 160 | 162 | 163 | 164 | 166 | 167 | ... 168 | 169 | + 171 | 172 | 173 | 174 | ... 175 | 176 | 177 | 178 | 179 | Add 180 | 181 | ... 182 | 183 | 184 | 185 | + 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | ... 197 | Github 198 | ... 199 | : Opera add-ons, 200 | Firefox add-ons 201 | : Github 202 | Donate 203 | 204 | 205 | 206 | ... 207 | 210 | 211 | 212 | 213 | 214 | 215 | 221 | 222 | -------------------------------------------------------------------------------- /src/options.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | mlWatcher.onItemsDone("resources", function() { 4 | var testArea = document.getElementById("test-area"); 5 | testArea.setAttribute("data-attribute-1", "http://example.com/test.avi"); 6 | testArea.setAttribute("data-attribute-2", "http://example.com/test.jpg?url=http://example.com/test.zip"); 7 | testArea.href = "http://example.com/test/" 8 | + "?url1=http://example.com/1" 9 | + "&url2=http://example.com/t.jpg" 10 | + "&url3=http://example.com/t.mp3" 11 | + "&aHR0cDovL2V4YW1wbGUuY29tL2Jhc2U2NA==" 12 | + "&687474703A2F2F6578616D706C652E636F6D2F686578"; 13 | var _sendMessage = sendMessage; 14 | 15 | sendMessage = function(data, sendResponse) { 16 | if (data.name == "opts.get") { 17 | sendResponse({PAGE_DATA: rb.PAGE_DATA}); 18 | 19 | } else if (data.name == "target.process") { 20 | sendResponse(rb.linkProcess(data)); 21 | 22 | } else if (data.name == "state.toggle") { 23 | rb.PAGE_DATA.OPTS.scriptEnabled = OPTS.scriptEnabled = !OPTS.scriptEnabled; 24 | _sendMessage({name: "notification.show", scriptEnabled: OPTS.scriptEnabled}); 25 | 26 | } else if (data.name == "siterules.show.form") { 27 | } else { 28 | _sendMessage.apply(_sendMessage, arguments); 29 | } 30 | } 31 | 32 | var eventActions = { 33 | "click.siterule.add": function(ev, name, val, focused, chkd) { 34 | siteruleAdd([["*://example.org*"] , ["*.html"]]); 35 | }, 36 | "click.siterule.add.default": function(ev) { 37 | SITESRULES_DEFAULT.rules.forEach(siteruleAdd); 38 | SITESRULES_DEFAULT.ignore.forEach(function(key) { 39 | addItem("siterule-ignore-pattern").value = key; 40 | }); 41 | }, 42 | "click.item.clone": function(ev, name, val, focused, chkd) { 43 | addItem(name); 44 | }, 45 | "click.form.action": function(ev, type) { 46 | if (type == "reset") { 47 | sendMessage({name: "opts.set", opts : OPTS_DEFAULT}, function() { 48 | window.location.reload(); 49 | }); 50 | 51 | } else { 52 | var data = getFormData(); 53 | 54 | sendMessage({name: "opts.set", opts: data.opts, sitesrules: data.sitesrules, sitesrulesAction: "replace"}, function() { 55 | window.location.reload(); 56 | }); 57 | } 58 | }, 59 | "click.void": function(ev, type) { 60 | return true; 61 | }, 62 | "change.language.switch": function(ev) { 63 | t.load(ev.target.value, function() { 64 | t.node(document); 65 | }); 66 | } 67 | } 68 | 69 | OPTS.allowedProtocols.split(/((?:[^\|\\]+|\\.)*)\|/).forEach(function(key) { 70 | key && (addItem("protocol-item").value = key.replace(/\\(.)/g, "$1")); 71 | }); 72 | OPTS.extOrder.split(/((?:[^\|\\]+|\\.)*)\|/).forEach(function(key) { 73 | key && (addItem("extorder-item").value = key.replace(/\\(.)/g, "$1")); 74 | }); 75 | OPTS.excludedAttr.split(/((?:[^\|\\]+|\\.)*)\|/).forEach(function(key) { 76 | key && (addItem("excludedattr-item").value = key.replace(/\\(.)/g, "$1")); 77 | }); 78 | SITESRULES.rules.forEach(siteruleAdd); 79 | SITESRULES.ignore.forEach(function(key) { 80 | addItem("siterule-ignore-pattern").value = key; 81 | }); 82 | 83 | for ( 84 | var a = Object.keys(eventActions), i = a.length; 85 | i--; 86 | document.body.addEventListener(a[i].substring(0, a[i].indexOf(".")), handleEvents, true) 87 | ); 88 | 89 | t.node(document); 90 | tabSelect(location.hash || "#general"); 91 | document.addEventListener("change", updateScript, false); 92 | document.addEventListener("inputafterremove", updateScript, false); 93 | ce("script", "src", "content-scripts/content.js", document.head); 94 | 95 | function handleEvents(ev) { 96 | var action = ev.target.getAttribute("data-evt-" + ev.type); 97 | 98 | if (action) { 99 | var params = action.split("|"), fnc = eventActions[ev.type + "." + params[0]]; 100 | 101 | if (fnc) { 102 | params[0] = ev; 103 | 104 | if (fnc.apply(fnc, params)) { 105 | ev.preventDefault(); 106 | } 107 | } 108 | } 109 | } 110 | 111 | function siteruleAdd(rule) { 112 | var siterules = document.getElementById("siterules"); 113 | var siterule = ce("div", "class", "siterule", siterules); 114 | var divPatterns = ce("div", siterule); 115 | var divParams = ce("div", siterule); 116 | var divAction = ce("div", siterule); 117 | var inpPattern = ce("input", "type", "text", "value", "*://example.org*", "class", "siterule-rule-pattern", "data-removable", "true"); 118 | var inpParam = ce( 119 | "input", 120 | "type", "text", 121 | "value", "*.html", 122 | "class", "siterule-rule-param", 123 | "data-removable", "true", 124 | "data-movable", "siterule-rule-param" 125 | ); 126 | 127 | var bt1 = ce("button", "type", "button", "class", "icon green", divPatterns); 128 | bt1.addEventListener("click", function() { 129 | divPatterns.insertBefore(inpPattern.cloneNode(), this).focus(); 130 | }, true); 131 | bt1.textContent = "\u002B"; 132 | 133 | var bt2 = ce("button", "type", "button", "class", "icon green", divParams); 134 | bt2.addEventListener("click", function() { 135 | divParams.insertBefore(inpParam.cloneNode(), this).focus(); 136 | }, true); 137 | bt2.textContent = "\u002B"; 138 | 139 | var bt3 = ce("button", "type", "button", "class", "icon", divAction); 140 | bt3.addEventListener("click", function() { 141 | siterule.parentNode.removeChild(siterule); 142 | }, true); 143 | bt3.textContent = "\u00D7"; 144 | 145 | var bt4 = ce("button", "type", "button", "class", "icon", divAction); 146 | bt4.addEventListener("click", function() { 147 | siterule.previousElementSibling && siterule.parentNode.insertBefore(siterule, siterule.previousElementSibling); 148 | fadein(siterule); 149 | }, true); 150 | bt4.textContent = "\u2191"; 151 | 152 | var bt5 = ce("button", "type", "button", "class", "icon", divAction); 153 | bt5.addEventListener("click", function() { 154 | siterule.nextElementSibling && siterule.parentNode.insertBefore(siterule.nextElementSibling, siterule); 155 | fadein(siterule); 156 | }, true); 157 | bt5.textContent = "\u2193"; 158 | 159 | rule[0].forEach(function(pattern) { 160 | divPatterns.insertBefore(inpPattern.cloneNode(), divPatterns.lastElementChild).value = pattern; 161 | }); 162 | 163 | rule[1].forEach(function(param) { 164 | divParams.insertBefore(inpParam.cloneNode(), divParams.lastElementChild).value = param; 165 | }); 166 | 167 | fadein(siterule); 168 | } 169 | 170 | function getFormData() { 171 | var sitesrules = {ignore: [], rules: []}; 172 | var optsNew = JSON.parse(JSON.stringify(OPTS)); 173 | 174 | Object.keys(optsNew).forEach(function(key) { 175 | q("input[name=\"" + CSS.escape(key) + "\"], select[name=\"" + CSS.escape(key) + "\"]").forEach(function(el) { 176 | if (el.hasAttribute("data-keyboard-keys")) { 177 | optsNew[key] = el.getAttribute("data-keyboard-keys"); 178 | 179 | } else if ((el.type != "radio") || el.checked) { 180 | optsNew[key] = ((el.type == "checkbox")? el.checked : ((typeof optsNew[key] == "number")? +el.value : el.value)); 181 | } 182 | }); 183 | }); 184 | 185 | optsNew.scriptEnabled = OPTS.scriptEnabled; 186 | optsNew.allowedProtocols = getNodeListValues("input.protocol-item", null, null, function(el) { 187 | return el.value.trim().replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); 188 | }).join("|"); 189 | optsNew.excludedAttr = getNodeListValues("input.excludedattr-item", null, null, function(el) { 190 | return el.value.trim().replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); 191 | }).join("|"); 192 | optsNew.extOrder = getNodeListValues("input.extorder-item", null, null, function(el) { 193 | return el.value.trim().replace(/\*|\.|\s/g, "").replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); 194 | }).join("|"); 195 | 196 | q("div.siterule").forEach(function(siterule) { 197 | var rule = [ 198 | getNodeListValues("input.siterule-rule-pattern", null, siterule), 199 | getNodeListValues("input.siterule-rule-param", null, siterule) 200 | ]; 201 | (rule[0].length && rule[1].length) && sitesrules.rules.push(rule); 202 | }); 203 | getNodeListValues("input.siterule-ignore-pattern", sitesrules.ignore); 204 | rb.sitesFilterRules(sitesrules); 205 | 206 | return {opts: optsNew, sitesrules: sitesrules}; 207 | } 208 | 209 | function updateScript() { 210 | var data = getFormData(); 211 | 212 | rb.optsBuild(data.opts); 213 | rb.sitesBuildRules(data.sitesrules); 214 | redirectBypasser.stop(true); 215 | redirectBypasser.start({PAGE_DATA : rb.PAGE_DATA}); 216 | } 217 | }); -------------------------------------------------------------------------------- /src/siterules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirect Bypasser 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Redirect Bypasser 16 | 17 | 18 | ... 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | : 27 | 28 | 29 | + 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | Auto 43 | 46 | 47 | 48 | 49 | 50 | 51 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/siterules.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | var SITERULE_FORMDATA; 3 | 4 | sendMessage({name: "siterules.addform.getdata"}, function(msgData) { 5 | SITERULE_FORMDATA = msgData; 6 | mlWatcher.setItem("siteruleFormData", 1); 7 | }); 8 | 9 | mlWatcher.onItemsDone("resources", "siteruleFormData", function() { 10 | var selectSiterulePattern = document.getElementById("select-siterule-pattern"); 11 | var eventActions = { 12 | "click.item.clone": function(ev, name, val, focused, chkd) { 13 | addItem(name); 14 | }, 15 | "click.form.action": function(ev, type) { 16 | if (type == "close") { 17 | window.close(); 18 | 19 | } else { 20 | var data = getFormData(); 21 | 22 | sendMessage({name: "opts.set", opts: data.opts, sitesrules: data.sitesrules, sitesrulesAction: "replace"}, function() { 23 | window.close(); 24 | }); 25 | } 26 | }, 27 | "change.language.switch": function(ev) { 28 | t.load(ev.target.value, function() { 29 | t.node(document); 30 | }); 31 | }, 32 | "change.pattern.switch": function(ev) { 33 | var value = ev.target.value; 34 | 35 | SITESRULES.rules.some(function(rule) { 36 | var stop; 37 | 38 | rule[0].some(function(pattern) { 39 | if (pattern == value) { 40 | document.getElementById("siteruleBehaviorParam").checked = true; 41 | 42 | rule[1].forEach(function(param) { 43 | if (!document.querySelector("input.siterule-rule-param[value=\"" + CSS.escape(param) + "\"]")) { 44 | addItem("siterule-rule-param").setAttribute("value", param); 45 | } 46 | }); 47 | 48 | stop = true; 49 | } 50 | 51 | return stop; 52 | }); 53 | 54 | return stop; 55 | }); 56 | 57 | SITESRULES.ignore.some(function(pattern) { 58 | if (pattern == value) { 59 | document.getElementById("siteruleBehaviorIgnore").checked = true; 60 | return true; 61 | } 62 | }); 63 | 64 | q("input.siterule-rule-param").forEach(function(el) { 65 | if (el.value.toLowerCase() == "original") { 66 | el.remove(); 67 | document.getElementById("siteruleBehaviorOriginal").checked = true; 68 | } 69 | }); 70 | } 71 | }; 72 | var url = new URL(SITERULE_FORMDATA.url || "http://example.com"); 73 | var originWithoutScheme = url.origin.replace(/^[^:]*/,"*"); 74 | var originWithoutSchemeAndTld = originWithoutScheme.replace(new RegExp("\\.(?:demon\\.co\\.uk|esc\\.edu\\.ar|(?:c[oi]\\.)?[^\\.]\\.(?:vt|ne|ks|il|hi|sc|nh|ia|wy|or|ma|vi|tn|in|az|id|nc|co|dc|nd|me|al|ak|de|wv|nm|mo|pr|nj|sd|md|va|ri|ut|ct|pa|ok|ky|mt|ga|la|oh|ms|wi|wa|gu|mi|tx|fl|ca|ar|mn|ny|nv)\\.us|[^\\.]\\.(?:(?:pvt\\.)?k12|cc|tec|lib|state|gen)\\.(?:vt|ne|ks|il|hi|sc|nh|ia|wy|or|ma|vi|tn|in|az|id|nc|co|dc|nd|me|al|ak|de|wv|nm|mo|pr|nj|sd|md|va|ri|ut|ct|pa|ok|ky|mt|ga|la|oh|ms|wi|wa|gu|mi|tx|fl|ca|ar|mn|ny|nv)\\.us|[^\\.]\\.vt|ne|ks|il|hi|sc|nh|ia|wy|or|ma|vi|tn|in|az|id|nc|co|dc|nd|me|al|ak|de|wv|nm|mo|pr|nj|sd|md|va|ri|ut|ct|pa|ok|ky|mt|ga|la|oh|ms|wi|wa|gu|mi|tx|fl|ca|ar|mn|ny|nvus|ne|gg|tr|mm|ki|biz|sj|my|hn|gl|ro|tn|co|br|coop|cy|bo|ck|tc|bv|ke|aero|cs|dm|km|bf|af|mv|ls|tm|jm|pg|ky|ga|pn|sv|mq|hu|za|se|uy|iq|ai|com|ve|na|ba|ph|xxx|no|lv|tf|kz|ma|in|id|si|re|om|by|fi|gs|ir|li|tz|td|cg|pa|am|tv|jo|bi|ee|cd|pk|mn|gd|nz|as|lc|ae|cn|ag|mx|sy|cx|cr|vi|sg|bm|kh|nr|bz|vu|kw|gf|al|uz|eh|int|ht|mw|gm|bg|gu|info|aw|gy|ac|ca|museum|sk|ax|es|kp|bb|sa|et|ie|tl|org|tj|cf|im|mk|de|pro|md|fm|cl|jp|bn|vn|gp|sm|ar|dj|bd|mc|ug|nu|ci|dk|nc|rw|aq|name|st|hm|mo|gq|ps|ge|ao|gr|va|is|mt|gi|la|bh|ms|bt|gb|it|wf|sb|ly|ng|gt|lu|il|pt|mh|eg|kg|pf|um|fr|sr|vg|fj|py|pm|sn|sd|au|sl|gh|us|mr|dz|ye|kn|cm|arpa|bw|lk|mg|tk|su|sc|ru|travel|az|ec|mz|lb|ml|bj|edu|pr|fk|lr|nf|np|do|mp|bs|to|cu|ch|yu|eu|mu|ni|pw|pl|gov|pe|an|ua|uk|gw|tp|kr|je|tt|net|fo|jobs|yt|cc|sh|io|zm|hk|th|so|er|cz|lt|mil|hr|gn|be|qa|cv|vc|tw|ws|ad|sz|at|tg|zw|nl|info\\.tn|org\\.sd|med\\.sd|com\\.hk|org\\.ai|edu\\.sg|at\\.tt|mail\\.pl|net\\.ni|pol\\.dz|hiroshima\\.jp|org\\.bh|edu\\.vu|net\\.im|ernet\\.in|nic\\.tt|com\\.tn|go\\.cr|jersey\\.je|bc\\.ca|com\\.la|go\\.jp|com\\.uy|tourism\\.tn|com\\.ec|conf\\.au|dk\\.org|shizuoka\\.jp|ac\\.vn|matsuyama\\.jp|agro\\.pl|yamaguchi\\.jp|edu\\.vn|yamanashi\\.jp|mil\\.in|sos\\.pl|bj\\.cn|net\\.au|ac\\.ae|psi\\.br|sch\\.ng|org\\.mt|edu\\.ai|edu\\.ck|ac\\.yu|org\\.ws|org\\.ng|rel\\.pl|uk\\.tt|com\\.py|aomori\\.jp|co\\.ug|video\\.hu|net\\.gg|org\\.pk|id\\.au|gov\\.zw|mil\\.tr|net\\.tn|org\\.ly|re\\.kr|mil\\.ye|mil\\.do|com\\.bb|net\\.vi|edu\\.na|co\\.za|asso\\.re|nom\\.pe|edu\\.tw|name\\.et|jl\\.cn|gov\\.ye|ehime\\.jp|miyazaki\\.jp|kanagawa\\.jp|gov\\.au|nm\\.cn|he\\.cn|edu\\.sd|mod\\.om|web\\.ve|edu\\.hk|medecin\\.fr|org\\.cu|info\\.au|edu\\.ve|nx\\.cn|alderney\\.gg|net\\.cu|org\\.za|mb\\.ca|com\\.ye|edu\\.pa|fed\\.us|ac\\.pa|alt\\.na|mil\\.lv|fukuoka\\.jp|gen\\.in|gr\\.jp|gov\\.br|gov\\.ac|id\\.fj|fukui\\.jp|hu\\.com|org\\.gu|net\\.ae|mil\\.ph|ltd\\.je|alt\\.za|gov\\.np|edu\\.jo|net\\.gu|g12\\.br|org\\.tn|store\\.co|fin\\.tn|ac\\.nz|gouv\\.fr|gov\\.il|org\\.ua|org\\.do|org\\.fj|sci\\.eg|gov\\.tt|cci\\.fr|tokyo\\.jp|net\\.lv|gov\\.lc|ind\\.br|ca\\.tt|gos\\.pk|hi\\.cn|net\\.do|co\\.tv|web\\.co|com\\.pa|com\\.ng|ac\\.ma|gov\\.bh|org\\.zw|csiro\\.au|lakas\\.hu|gob\\.ni|gov\\.fk|org\\.sy|gov\\.lb|gov\\.je|ed\\.cr|nb\\.ca|net\\.uy|com\\.ua|media\\.hu|com\\.lb|nom\\.pl|org\\.br|hk\\.cn|co\\.hu|org\\.my|gov\\.dz|sld\\.pa|gob\\.pk|net\\.uk|guernsey\\.gg|nara\\.jp|telememo\\.au|k12\\.tr|org\\.nz|pub\\.sa|edu\\.ac|com\\.dz|edu\\.lv|edu\\.pk|com\\.ph|net\\.na|net\\.et|id\\.lv|au\\.com|ac\\.ng|com\\.my|net\\.cy|unam\\.na|nom\\.za|net\\.np|info\\.pl|priv\\.hu|rec\\.ve|ac\\.uk|edu\\.mm|go\\.ug|ac\\.ug|co\\.dk|net\\.tt|oita\\.jp|fi\\.cr|org\\.ac|aichi\\.jp|org\\.tt|edu\\.bh|us\\.com|ac\\.kr|js\\.cn|edu\\.ni|com\\.mt|fam\\.pk|experts-comptables\\.fr|or\\.kr|org\\.au|web\\.pk|mil\\.jo|biz\\.pl|org\\.np|city\\.hu|org\\.uy|auto\\.pl|aid\\.pl|bib\\.ve|mo\\.cn|br\\.com|dns\\.be|sh\\.cn|org\\.mo|com\\.sg|me\\.uk|gov\\.kw|eun\\.eg|kagoshima\\.jp|ln\\.cn|seoul\\.kr|school\\.fj|com\\.mk|e164\\.arpa|rnu\\.tn|pro\\.ae|org\\.om|gov\\.my|net\\.ye|gov\\.do|co\\.im|org\\.lb|plc\\.co\\.im|net\\.jp|go\\.id|net\\.tw|gov\\.ai|tlf\\.nr|ac\\.im|com\\.do|net\\.py|tozsde\\.hu|com\\.na|tottori\\.jp|net\\.ge|gov\\.cn|org\\.bb|net\\.bs|ac\\.za|rns\\.tn|biz\\.pk|gov\\.ge|org\\.uk|org\\.fk|nhs\\.uk|net\\.bh|tm\\.za|co\\.nz|gov\\.jp|jogasz\\.hu|shop\\.pl|media\\.pl|chiba\\.jp|city\\.za|org\\.ck|net\\.id|com\\.ar|gon\\.pk|gov\\.om|idf\\.il|net\\.cn|prd\\.fr|co\\.in|or\\.ug|red\\.sv|edu\\.lb|k12\\.ec|gx\\.cn|net\\.nz|info\\.hu|ac\\.zw|info\\.tt|com\\.ws|org\\.gg|com\\.et|ac\\.jp|ac\\.at|avocat\\.fr|org\\.ph|sark\\.gg|org\\.ve|tm\\.pl|net\\.pg|gov\\.co|com\\.lc|film\\.hu|ishikawa\\.jp|hotel\\.hu|hl\\.cn|edu\\.ge|com\\.bm|ac\\.om|tec\\.ve|edu\\.tr|cq\\.cn|com\\.pk|firm\\.in|inf\\.br|gunma\\.jp|gov\\.tn|oz\\.au|nf\\.ca|akita\\.jp|net\\.sd|tourism\\.pl|net\\.bb|or\\.at|idv\\.tw|dni\\.us|org\\.mx|conf\\.lv|net\\.jo|nic\\.in|info\\.vn|pe\\.kr|tw\\.cn|org\\.eg|ad\\.jp|hb\\.cn|kyonggi\\.kr|bourse\\.za|org\\.sb|gov\\.gg|net\\.br|mil\\.pe|kobe\\.jp|net\\.sa|edu\\.mt|org\\.vn|yokohama\\.jp|net\\.il|ac\\.cr|edu\\.sb|nagano\\.jp|travel\\.pl|gov\\.tr|com\\.sv|co\\.il|rec\\.br|biz\\.om|com\\.mm|com\\.az|org\\.vu|edu\\.ng|com\\.mx|info\\.co|realestate\\.pl|mil\\.sh|yamagata\\.jp|or\\.id|org\\.ae|greta\\.fr|k12\\.il|com\\.tw|gov\\.ve|arts\\.ve|cul\\.na|gov\\.kh|org\\.bm|etc\\.br|or\\.th|ch\\.vu|de\\.tt|ind\\.je|org\\.tw|nom\\.fr|co\\.tt|net\\.lc|intl\\.tn|shiga\\.jp|pvt\\.ge|gov\\.ua|org\\.pe|net\\.kh|co\\.vi|iwi\\.nz|biz\\.vn|gov\\.ck|edu\\.eg|zj\\.cn|press\\.ma|ac\\.in|eu\\.tt|art\\.do|med\\.ec|bbs\\.tr|gov\\.uk|edu\\.ua|eu\\.com|web\\.do|szex\\.hu|mil\\.kh|gen\\.nz|okinawa\\.jp|mob\\.nr|edu\\.ws|edu\\.sv|xj\\.cn|net\\.ru|dk\\.tt|erotika\\.hu|com\\.sh|cn\\.com|edu\\.pl|com\\.nc|org\\.il|arts\\.co|chirurgiens-dentistes\\.fr|net\\.pa|takamatsu\\.jp|net\\.ng|org\\.hu|net\\.in|net\\.vu|gen\\.tr|shop\\.hu|com\\.ae|tokushima\\.jp|za\\.com|gov\\.eg|co\\.jp|uba\\.ar|net\\.my|biz\\.et|art\\.br|ac\\.fk|gob\\.pe|com\\.bs|co\\.ae|de\\.net|net\\.eg|hyogo\\.jp|edunet\\.tn|museum\\.om|nom\\.ve|rnrt\\.tn|hn\\.cn|com\\.fk|edu\\.dz|ne\\.kr|co\\.je|sch\\.uk|priv\\.pl|sp\\.br|net\\.hk|name\\.vn|com\\.sa|edu\\.bm|qc\\.ca|bolt\\.hu|per\\.kh|sn\\.cn|mil\\.id|kagawa\\.jp|utsunomiya\\.jp|erotica\\.hu|gd\\.cn|net\\.tr|edu\\.np|asn\\.au|com\\.gu|ind\\.tn|mil\\.br|net\\.lb|nom\\.co|org\\.la|mil\\.pl|ac\\.il|gov\\.jo|com\\.kw|edu\\.sh|otc\\.au|gmina\\.pl|per\\.sg|gov\\.mo|int\\.ve|news\\.hu|sec\\.ps|ac\\.pg|health\\.vn|sex\\.pl|net\\.nc|qc\\.com|idv\\.hk|org\\.hk|gok\\.pk|com\\.ac|tochigi\\.jp|gsm\\.pl|law\\.za|pro\\.vn|edu\\.pe|info\\.et|sch\\.gg|com\\.vn|gov\\.bm|com\\.cn|mod\\.uk|gov\\.ps|toyama\\.jp|gv\\.at|yk\\.ca|org\\.et|suli\\.hu|edu\\.my|org\\.mm|co\\.yu|int\\.ar|pe\\.ca|tm\\.hu|net\\.sb|org\\.yu|com\\.ru|com\\.pe|edu\\.kh|edu\\.kw|org\\.qa|med\\.om|net\\.ws|org\\.in|turystyka\\.pl|store\\.ve|org\\.bs|mil\\.uy|net\\.ar|iwate\\.jp|org\\.nc|us\\.tt|gov\\.sh|nom\\.fk|go\\.th|gov\\.ec|com\\.br|edu\\.do|gov\\.ng|pro\\.tt|sapporo\\.jp|net\\.ua|tm\\.fr|com\\.lv|com\\.mo|edu\\.uk|fin\\.ec|edu\\.ps|ru\\.com|edu\\.ec|ac\\.fj|net\\.mm|veterinaire\\.fr|nom\\.re|ingatlan\\.hu|fr\\.vu|ne\\.jp|int\\.co|gov\\.cy|org\\.lv|de\\.com|nagasaki\\.jp|com\\.sb|gov\\.za|org\\.lc|com\\.fj|ind\\.in|or\\.cr|sc\\.cn|chambagri\\.fr|or\\.jp|forum\\.hu|tmp\\.br|reklam\\.hu|gob\\.sv|com\\.pl|saitama\\.jp|name\\.tt|niigata\\.jp|sklep\\.pl|nom\\.ni|co\\.ma|net\\.la|co\\.om|pharmacien\\.fr|port\\.fr|mil\\.gu|au\\.tt|edu\\.gu|ngo\\.ph|com\\.ve|ac\\.th|gov\\.fj|barreau\\.fr|net\\.ac|ac\\.je|org\\.kw|sport\\.hu|ac\\.cn|net\\.bm|ibaraki\\.jp|tel\\.no|org\\.cy|edu\\.mo|gb\\.net|kyoto\\.jp|sch\\.sa|com\\.au|edu\\.lc|fax\\.nr|gov\\.mm|it\\.tt|org\\.jo|nat\\.tn|mil\\.ve|be\\.tt|org\\.az|rec\\.co|co\\.ve|gifu\\.jp|net\\.th|hokkaido\\.jp|ac\\.gg|go\\.kr|edu\\.ye|qh\\.cn|ab\\.ca|org\\.cn|no\\.com|co\\.uk|gov\\.gu|de\\.vu|miasta\\.pl|kawasaki\\.jp|co\\.cr|miyagi\\.jp|org\\.jp|osaka\\.jp|web\\.za|net\\.za|gov\\.pk|gov\\.vn|agrar\\.hu|asn\\.lv|org\\.sv|net\\.sh|org\\.sa|org\\.dz|assedic\\.fr|com\\.sy|net\\.ph|mil\\.ge|es\\.tt|mobile\\.nr|co\\.kr|ltd\\.uk|ac\\.be|fgov\\.be|geek\\.nz|ind\\.gg|net\\.mt|maori\\.nz|ens\\.tn|edu\\.py|gov\\.sd|gov\\.qa|nt\\.ca|com\\.pg|org\\.kh|pc\\.pl|com\\.eg|net\\.ly|se\\.com|gb\\.com|edu\\.ar|sch\\.je|mil\\.ac|mil\\.ar|okayama\\.jp|gov\\.sg|ac\\.id|co\\.id|com\\.ly|huissier-justice\\.fr|nic\\.im|gov\\.lv|nu\\.ca|org\\.sg|com\\.kh|org\\.vi|sa\\.cr|lg\\.jp|ns\\.ca|edu\\.co|gov\\.im|edu\\.om|net\\.dz|org\\.pl|pp\\.ru|tm\\.mt|org\\.ar|co\\.gg|org\\.im|edu\\.qa|org\\.py|edu\\.uy|targi\\.pl|com\\.ge|gub\\.uy|gov\\.ar|ltd\\.gg|fr\\.tt|net\\.qa|com\\.np|ass\\.dz|se\\.tt|com\\.ai|org\\.ma|plo\\.ps|co\\.at|med\\.sa|net\\.sg|kanazawa\\.jp|com\\.fr|school\\.za|net\\.pl|ngo\\.za|net\\.sy|ed\\.jp|org\\.na|net\\.ma|asso\\.fr|police\\.uk|powiat\\.pl|govt\\.nz|sk\\.ca|tj\\.cn|mil\\.ec|com\\.jo|net\\.mo|notaires\\.fr|avoues\\.fr|aeroport\\.fr|yn\\.cn|gov\\.et|gov\\.sa|gov\\.ae|com\\.tt|art\\.dz|firm\\.ve|com\\.sd|school\\.nz|edu\\.et|gob\\.pa|telecom\\.na|ac\\.cy|gz\\.cn|net\\.kw|mobil\\.nr|nic\\.uk|co\\.th|com\\.vu|com\\.re|belgie\\.be|nl\\.ca|uk\\.com|com\\.om|utazas\\.hu|presse\\.fr|co\\.ck|xz\\.cn|org\\.tr|mil\\.co|edu\\.cn|net\\.ec|on\\.ca|konyvelo\\.hu|gop\\.pk|net\\.om|info\\.ve|com\\.ni|sa\\.com|com\\.tr|sch\\.sd|fukushima\\.jp|tel\\.nr|atm\\.pl|kitakyushu\\.jp|com\\.qa|firm\\.co|edu\\.tt|games\\.hu|mil\\.nz|cri\\.nz|net\\.az|org\\.ge|mie\\.jp|net\\.mx|sch\\.ae|nieruchomosci\\.pl|int\\.vn|edu\\.za|com\\.cy|wakayama\\.jp|gov\\.hk|org\\.pa|edu\\.au|gov\\.in|pro\\.om|2000\\.hu|szkola\\.pl|shimane\\.jp|co\\.zw|gove\\.tw|com\\.co|net\\.ck|net\\.pk|net\\.ve|org\\.ru|uk\\.net|org\\.co|uu\\.mt|com\\.cu|mil\\.za|plc\\.uk|lkd\\.co\\.im|gs\\.cn|sex\\.hu|net\\.je|kumamoto\\.jp|mil\\.lb|edu\\.yu|gov\\.ws|sendai\\.jp|eu\\.org|ah\\.cn|net\\.vn|gov\\.sb|net\\.pe|nagoya\\.jp|geometre-expert\\.fr|net\\.fk|biz\\.tt|org\\.sh|edu\\.sa|saga\\.jp|sx\\.cn|org\\.je|org\\.ye|muni\\.il|kochi\\.jp|com\\.bh|org\\.ec|priv\\.at|gov\\.sy|org\\.ni|casino\\.hu|res\\.in|uy\\.com)$"), "."); 75 | var paths = url.pathname.split("/"); 76 | var pathsArray = ["*", "/*"]; 77 | var pathsStr = ""; 78 | 79 | for (var i = 1, l = paths.length; i < l; i++) { 80 | pathsStr += "/" + paths[i]; 81 | 82 | if ((paths[i].length && (i + 1 == l) && (!paths[i + 1])) 83 | || ((!paths[i].length && i > 1) || ((i + 1 == l) && (paths[i].indexOf(".") !== -1))) 84 | ) { 85 | pathsArray.push(pathsStr + "*"); 86 | 87 | } else if (paths[i].length) { 88 | pathsArray.push(pathsStr + "/*"); 89 | } 90 | } 91 | 92 | [originWithoutSchemeAndTld, originWithoutScheme, url.origin].forEach(function(originKey) { 93 | pathsArray.forEach(function(pathsKey) { 94 | if ((originKey != originWithoutSchemeAndTld) || (pathsKey != "*")) { 95 | selectSiterulePattern.options.add(new Option(originKey + pathsKey, originKey + pathsKey)); 96 | } 97 | }); 98 | }); 99 | 100 | if (SITERULE_FORMDATA.info) { 101 | addItem("siterule-rule-param").value = SITERULE_FORMDATA.info.join(","); 102 | } 103 | 104 | SITESRULES.rules.some(function(rule) { 105 | var stop; 106 | 107 | rule[0].some(function(pattern) { 108 | if (selectSiterulePattern.querySelector("[value=\"" + CSS.escape(pattern) + "\"]")) { 109 | selectSiterulePattern.value = pattern; 110 | stop = true; 111 | } 112 | 113 | return stop; 114 | }); 115 | 116 | return stop; 117 | }); 118 | SITESRULES.ignore.some(function(pattern) { 119 | if (selectSiterulePattern.querySelector("[value=\"" + CSS.escape(pattern) + "\"]")) { 120 | selectSiterulePattern.value = pattern; 121 | return true; 122 | } 123 | }); 124 | 125 | for ( 126 | var a = Object.keys(eventActions), i = a.length; 127 | i--; 128 | document.body.addEventListener(a[i].substring(0, a[i].indexOf(".")), handleEvents, true) 129 | ); 130 | 131 | t.node(document); 132 | selectSiterulePattern.dispatchEvent(new Event("change", {"bubbles": true, "cancelable": true})); 133 | 134 | function handleEvents(ev) { 135 | var action = ev.target.getAttribute("data-evt-" + ev.type); 136 | 137 | if (action) { 138 | var params = action.split("|"), fnc = eventActions[ev.type + "." + params[0]]; 139 | 140 | if (fnc) { 141 | params[0] = ev; 142 | 143 | if (fnc.apply(fnc, params)) { 144 | ev.preventDefault(); 145 | } 146 | } 147 | } 148 | } 149 | 150 | function getFormData() { 151 | var sitesrules = JSON.parse(JSON.stringify(SITESRULES)); 152 | var optsNew = JSON.parse(JSON.stringify(OPTS)); 153 | var siteruleBehavior = "siteruleBehaviorParam"; 154 | 155 | optsNew.language = document.getElementById("select-language").value; 156 | 157 | q("input[type=\"radio\"][name=\"siteruleBehavior\"]:checked").forEach(function(el) { 158 | siteruleBehavior = el.value; 159 | }); 160 | 161 | var idx = sitesrules.ignore.indexOf(selectSiterulePattern.value); 162 | 163 | if (idx !== -1) { 164 | sitesrules.ignore.splice(idx, 1); 165 | } 166 | 167 | for (var i = 0, l = sitesrules.rules.length; i < l; i++) { 168 | var idx = sitesrules.rules[i][0].indexOf(selectSiterulePattern.value); 169 | 170 | if (idx !== -1) { 171 | sitesrules.rules[i][0].splice(idx, 1); 172 | } 173 | } 174 | 175 | if (siteruleBehavior == "siteruleBehaviorIgnore" ) { 176 | sitesrules.ignore.push(selectSiterulePattern.value); 177 | 178 | } else if (siteruleBehavior === "siteruleBehaviorParam" ) { 179 | var rule = [[selectSiterulePattern.value], getNodeListValues("input.siterule-rule-param", null)]; 180 | rule[1].length && sitesrules.rules.push(rule); 181 | } 182 | 183 | rb.sitesFilterRules(sitesrules); 184 | 185 | return {opts: optsNew, sitesrules: sitesrules}; 186 | } 187 | }); -------------------------------------------------------------------------------- /test/test-redirectbypasser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test RedirectBypasser 6 | 74 | 75 | 179 | 180 | 181 | 182 | Disable Redirect Bypasser 183 | General 184 | 185 | Security 186 | 187 | UI 188 | 189 | Obfuscated 190 | 191 | Attributes 192 | 193 | Others 194 | 195 | Fixs 196 | 197 | Plugins 198 | 199 | 200 | 201 | Plugin 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | Plugin 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 219 | 220 | 221 | Dynamic content 222 | 223 | 224 | 225 | 226 | 227 | initial 228 | 229 | 230 | hover 231 | 232 | 233 | 234 | 235 | initial 236 | 237 | 238 | hover 239 | 240 | 241 | 242 | 243 | initial 244 | 245 | 246 | hover 247 | 248 | 249 | 250 | 251 | initial 252 | 253 | 254 | hover 255 | 256 | 257 | 258 | 259 | 260 | Colors 261 | 262 | 263 | 264 | --------------------------------------------------------------------------------