@browserless.io/browserless 2.0.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +674 -0
- package/LICENSE +6 -0
- package/README.md +132 -0
- package/assets/logo.png +0 -0
- package/bin/browserless.js +227 -0
- package/browser.json +7 -0
- package/build/browserless.d.ts +33 -0
- package/build/browserless.js +146 -0
- package/build/browsers/cdp-chromium.d.ts +41 -0
- package/build/browsers/cdp-chromium.js +287 -0
- package/build/browsers/index.d.ts +26 -0
- package/build/browsers/index.js +183 -0
- package/build/browsers/playwright-chromium.d.ts +34 -0
- package/build/browsers/playwright-chromium.js +106 -0
- package/build/browsers/playwright-firefox.d.ts +34 -0
- package/build/browsers/playwright-firefox.js +101 -0
- package/build/browsers/playwright-webkit.d.ts +34 -0
- package/build/browsers/playwright-webkit.js +101 -0
- package/build/config.d.ts +138 -0
- package/build/config.js +349 -0
- package/build/constants.d.ts +4 -0
- package/build/constants.js +4 -0
- package/build/data/classes.json +1 -0
- package/build/data/selectors.json +1 -0
- package/build/exports.d.ts +20 -0
- package/build/exports.js +22 -0
- package/build/file-system.d.ts +24 -0
- package/build/file-system.js +46 -0
- package/build/hooks.d.ts +5 -0
- package/build/hooks.js +20 -0
- package/build/http.d.ts +175 -0
- package/build/http.js +104 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +39 -0
- package/build/limiter.d.ts +24 -0
- package/build/limiter.js +147 -0
- package/build/limiter.spec.d.ts +1 -0
- package/build/limiter.spec.js +241 -0
- package/build/metrics.d.ts +24 -0
- package/build/metrics.js +86 -0
- package/build/metrics.spec.d.ts +1 -0
- package/build/metrics.spec.js +35 -0
- package/build/mime-types.d.ts +1 -0
- package/build/mime-types.js +328 -0
- package/build/monitoring.d.ts +13 -0
- package/build/monitoring.js +38 -0
- package/build/routes/chromium/http/content-post.body.json +514 -0
- package/build/routes/chromium/http/content-post.d.ts +34 -0
- package/build/routes/chromium/http/content-post.js +109 -0
- package/build/routes/chromium/http/content-post.query.json +183 -0
- package/build/routes/chromium/http/content-post.response.json +5 -0
- package/build/routes/chromium/http/download-post.body.json +32 -0
- package/build/routes/chromium/http/download-post.d.ts +16 -0
- package/build/routes/chromium/http/download-post.js +92 -0
- package/build/routes/chromium/http/download-post.query.json +120 -0
- package/build/routes/chromium/http/download-post.response.json +4 -0
- package/build/routes/chromium/http/function-post.body.json +32 -0
- package/build/routes/chromium/http/function-post.d.ts +18 -0
- package/build/routes/chromium/http/function-post.js +53 -0
- package/build/routes/chromium/http/function-post.query.json +120 -0
- package/build/routes/chromium/http/function-post.response.json +4 -0
- package/build/routes/chromium/http/pdf-post.body.json +654 -0
- package/build/routes/chromium/http/pdf-post.d.ts +35 -0
- package/build/routes/chromium/http/pdf-post.js +107 -0
- package/build/routes/chromium/http/pdf-post.query.json +120 -0
- package/build/routes/chromium/http/pdf-post.response.json +5 -0
- package/build/routes/chromium/http/performance.body.json +26 -0
- package/build/routes/chromium/http/performance.d.ts +17 -0
- package/build/routes/chromium/http/performance.js +30 -0
- package/build/routes/chromium/http/performance.query.json +120 -0
- package/build/routes/chromium/http/performance.response.json +7 -0
- package/build/routes/chromium/http/scrape-post.body.json +561 -0
- package/build/routes/chromium/http/scrape-post.d.ts +106 -0
- package/build/routes/chromium/http/scrape-post.js +205 -0
- package/build/routes/chromium/http/scrape-post.query.json +183 -0
- package/build/routes/chromium/http/scrape-post.response.json +325 -0
- package/build/routes/chromium/http/screenshot-post.body.json +604 -0
- package/build/routes/chromium/http/screenshot-post.d.ts +37 -0
- package/build/routes/chromium/http/screenshot-post.js +124 -0
- package/build/routes/chromium/http/screenshot-post.query.json +120 -0
- package/build/routes/chromium/http/screenshot-post.response.json +5 -0
- package/build/routes/chromium/tests/content.spec.d.ts +1 -0
- package/build/routes/chromium/tests/content.spec.js +285 -0
- package/build/routes/chromium/tests/download.spec.d.ts +1 -0
- package/build/routes/chromium/tests/download.spec.js +67 -0
- package/build/routes/chromium/tests/function.spec.d.ts +1 -0
- package/build/routes/chromium/tests/function.spec.js +245 -0
- package/build/routes/chromium/tests/pdf.spec.d.ts +1 -0
- package/build/routes/chromium/tests/pdf.spec.js +333 -0
- package/build/routes/chromium/tests/performance.spec.d.ts +1 -0
- package/build/routes/chromium/tests/performance.spec.js +124 -0
- package/build/routes/chromium/tests/scrape.spec.d.ts +1 -0
- package/build/routes/chromium/tests/scrape.spec.js +354 -0
- package/build/routes/chromium/tests/screenshot.spec.d.ts +1 -0
- package/build/routes/chromium/tests/screenshot.spec.js +339 -0
- package/build/routes/chromium/tests/websocket.spec.d.ts +1 -0
- package/build/routes/chromium/tests/websocket.spec.js +309 -0
- package/build/routes/chromium/utils/function/client.d.ts +26 -0
- package/build/routes/chromium/utils/function/client.js +66 -0
- package/build/routes/chromium/utils/function/handler.d.ts +18 -0
- package/build/routes/chromium/utils/function/handler.js +95 -0
- package/build/routes/chromium/utils/performance/child.d.ts +1 -0
- package/build/routes/chromium/utils/performance/child.js +29 -0
- package/build/routes/chromium/utils/performance/main.d.ts +3 -0
- package/build/routes/chromium/utils/performance/main.js +65 -0
- package/build/routes/chromium/utils/performance/types.d.ts +21 -0
- package/build/routes/chromium/utils/performance/types.js +1 -0
- package/build/routes/chromium/ws/browser.d.ts +6 -0
- package/build/routes/chromium/ws/browser.js +11 -0
- package/build/routes/chromium/ws/browser.query.json +120 -0
- package/build/routes/chromium/ws/cdp-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/cdp-chromium.js +11 -0
- package/build/routes/chromium/ws/cdp-chromium.query.json +120 -0
- package/build/routes/chromium/ws/page.d.ts +6 -0
- package/build/routes/chromium/ws/page.js +11 -0
- package/build/routes/chromium/ws/page.query.json +120 -0
- package/build/routes/chromium/ws/playwright-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/playwright-chromium.js +19 -0
- package/build/routes/chromium/ws/playwright-chromium.query.json +100 -0
- package/build/routes/firefox/tests/websocket.spec.d.ts +1 -0
- package/build/routes/firefox/tests/websocket.spec.js +104 -0
- package/build/routes/firefox/ws/playwright-firefox.d.ts +6 -0
- package/build/routes/firefox/ws/playwright-firefox.js +19 -0
- package/build/routes/firefox/ws/playwright-firefox.query.json +100 -0
- package/build/routes/management/http/config-get.d.ts +25 -0
- package/build/routes/management/http/config-get.js +43 -0
- package/build/routes/management/http/config-get.response.json +107 -0
- package/build/routes/management/http/metrics-get.d.ts +4 -0
- package/build/routes/management/http/metrics-get.js +24 -0
- package/build/routes/management/http/metrics-get.response.json +94 -0
- package/build/routes/management/http/metrics-total-get.d.ts +4 -0
- package/build/routes/management/http/metrics-total-get.js +60 -0
- package/build/routes/management/http/metrics-total-get.response.json +72 -0
- package/build/routes/management/http/sessions-get.d.ts +4 -0
- package/build/routes/management/http/sessions-get.js +21 -0
- package/build/routes/management/http/sessions-get.response.json +221 -0
- package/build/routes/management/http/static-get.d.ts +3 -0
- package/build/routes/management/http/static-get.js +67 -0
- package/build/routes/management/tests/management.spec.d.ts +1 -0
- package/build/routes/management/tests/management.spec.js +41 -0
- package/build/routes/webkit/tests/websocket.spec.d.ts +1 -0
- package/build/routes/webkit/tests/websocket.spec.js +104 -0
- package/build/routes/webkit/ws/playwright-webkit.d.ts +6 -0
- package/build/routes/webkit/ws/playwright-webkit.js +19 -0
- package/build/routes/webkit/ws/playwright-webkit.query.json +100 -0
- package/build/server.d.ts +38 -0
- package/build/server.js +365 -0
- package/build/shim.d.ts +9 -0
- package/build/shim.js +54 -0
- package/build/shim.spec.d.ts +1 -0
- package/build/shim.spec.js +114 -0
- package/build/types.d.ts +360 -0
- package/build/types.js +6 -0
- package/build/utils.d.ts +111 -0
- package/build/utils.js +570 -0
- package/build/webhooks.d.ts +11 -0
- package/build/webhooks.js +43 -0
- package/docker/base/.dockerignore +16 -0
- package/docker/base/Dockerfile +70 -0
- package/docker/chrome/.dockerignore +16 -0
- package/docker/chrome/Dockerfile +40 -0
- package/docker/firefox/.dockerignore +16 -0
- package/docker/firefox/Dockerfile +39 -0
- package/docker/multi/.dockerignore +16 -0
- package/docker/multi/Dockerfile +37 -0
- package/docker/sdk/.dockerignore +16 -0
- package/docker/sdk/Dockerfile +34 -0
- package/docker/webkit/.dockerignore +16 -0
- package/docker/webkit/Dockerfile +40 -0
- package/extensions/screencast/background.js +143 -0
- package/extensions/screencast/content_script.js +18 -0
- package/extensions/screencast/manifest.json +19 -0
- package/extensions/ublock/1p-filters.html +69 -0
- package/extensions/ublock/3p-filters.html +119 -0
- package/extensions/ublock/LICENSE.txt +674 -0
- package/extensions/ublock/_locales/ar/messages.json +1290 -0
- package/extensions/ublock/_locales/az/messages.json +1290 -0
- package/extensions/ublock/_locales/be/messages.json +1290 -0
- package/extensions/ublock/_locales/bg/messages.json +1290 -0
- package/extensions/ublock/_locales/bn/messages.json +1290 -0
- package/extensions/ublock/_locales/br_FR/messages.json +1290 -0
- package/extensions/ublock/_locales/bs/messages.json +1290 -0
- package/extensions/ublock/_locales/ca/messages.json +1290 -0
- package/extensions/ublock/_locales/cs/messages.json +1290 -0
- package/extensions/ublock/_locales/cv/messages.json +1290 -0
- package/extensions/ublock/_locales/da/messages.json +1290 -0
- package/extensions/ublock/_locales/de/messages.json +1290 -0
- package/extensions/ublock/_locales/el/messages.json +1290 -0
- package/extensions/ublock/_locales/en/messages.json +1292 -0
- package/extensions/ublock/_locales/en_GB/messages.json +1290 -0
- package/extensions/ublock/_locales/eo/messages.json +1290 -0
- package/extensions/ublock/_locales/es/messages.json +1290 -0
- package/extensions/ublock/_locales/et/messages.json +1290 -0
- package/extensions/ublock/_locales/eu/messages.json +1290 -0
- package/extensions/ublock/_locales/fa/messages.json +1290 -0
- package/extensions/ublock/_locales/fi/messages.json +1290 -0
- package/extensions/ublock/_locales/fil/messages.json +1290 -0
- package/extensions/ublock/_locales/fr/messages.json +1290 -0
- package/extensions/ublock/_locales/fy/messages.json +1290 -0
- package/extensions/ublock/_locales/gl/messages.json +1290 -0
- package/extensions/ublock/_locales/gu/messages.json +1290 -0
- package/extensions/ublock/_locales/he/messages.json +1290 -0
- package/extensions/ublock/_locales/hi/messages.json +1290 -0
- package/extensions/ublock/_locales/hr/messages.json +1290 -0
- package/extensions/ublock/_locales/hu/messages.json +1290 -0
- package/extensions/ublock/_locales/hy/messages.json +1290 -0
- package/extensions/ublock/_locales/id/messages.json +1290 -0
- package/extensions/ublock/_locales/it/messages.json +1290 -0
- package/extensions/ublock/_locales/ja/messages.json +1290 -0
- package/extensions/ublock/_locales/ka/messages.json +1290 -0
- package/extensions/ublock/_locales/kk/messages.json +1290 -0
- package/extensions/ublock/_locales/kn/messages.json +1290 -0
- package/extensions/ublock/_locales/ko/messages.json +1290 -0
- package/extensions/ublock/_locales/ku/messages.json +1290 -0
- package/extensions/ublock/_locales/lt/messages.json +1290 -0
- package/extensions/ublock/_locales/lv/messages.json +1290 -0
- package/extensions/ublock/_locales/mk/messages.json +1290 -0
- package/extensions/ublock/_locales/ml/messages.json +1290 -0
- package/extensions/ublock/_locales/mr/messages.json +1290 -0
- package/extensions/ublock/_locales/ms/messages.json +1290 -0
- package/extensions/ublock/_locales/nb/messages.json +1290 -0
- package/extensions/ublock/_locales/nl/messages.json +1290 -0
- package/extensions/ublock/_locales/no/messages.json +1290 -0
- package/extensions/ublock/_locales/oc/messages.json +1290 -0
- package/extensions/ublock/_locales/pa/messages.json +1290 -0
- package/extensions/ublock/_locales/pl/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_BR/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_PT/messages.json +1290 -0
- package/extensions/ublock/_locales/ro/messages.json +1290 -0
- package/extensions/ublock/_locales/ru/messages.json +1290 -0
- package/extensions/ublock/_locales/si/messages.json +1290 -0
- package/extensions/ublock/_locales/sk/messages.json +1290 -0
- package/extensions/ublock/_locales/sl/messages.json +1290 -0
- package/extensions/ublock/_locales/so/messages.json +1290 -0
- package/extensions/ublock/_locales/sq/messages.json +1290 -0
- package/extensions/ublock/_locales/sr/messages.json +1290 -0
- package/extensions/ublock/_locales/sv/messages.json +1290 -0
- package/extensions/ublock/_locales/sw/messages.json +1290 -0
- package/extensions/ublock/_locales/ta/messages.json +1290 -0
- package/extensions/ublock/_locales/te/messages.json +1290 -0
- package/extensions/ublock/_locales/th/messages.json +1290 -0
- package/extensions/ublock/_locales/tr/messages.json +1290 -0
- package/extensions/ublock/_locales/uk/messages.json +1290 -0
- package/extensions/ublock/_locales/ur/messages.json +1290 -0
- package/extensions/ublock/_locales/vi/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_CN/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_TW/messages.json +1290 -0
- package/extensions/ublock/about.html +63 -0
- package/extensions/ublock/advanced-settings.html +42 -0
- package/extensions/ublock/asset-viewer.html +50 -0
- package/extensions/ublock/assets/assets.json +903 -0
- package/extensions/ublock/assets/resources/scriptlets.js +4255 -0
- package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +65576 -0
- package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +33219 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/README.md +29 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +3732 -0
- package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +15431 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/LICENSE.md +42 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1970 -0
- package/extensions/ublock/assets/ublock/badlists.txt +77 -0
- package/extensions/ublock/assets/ublock/badware.min.txt +3033 -0
- package/extensions/ublock/assets/ublock/filters.min.txt +23419 -0
- package/extensions/ublock/assets/ublock/privacy.min.txt +575 -0
- package/extensions/ublock/assets/ublock/quick-fixes.min.txt +99 -0
- package/extensions/ublock/assets/ublock/unbreak.min.txt +2448 -0
- package/extensions/ublock/background.html +12 -0
- package/extensions/ublock/cloud-ui.html +23 -0
- package/extensions/ublock/code-viewer.html +53 -0
- package/extensions/ublock/css/1p-filters.css +26 -0
- package/extensions/ublock/css/3p-filters.css +250 -0
- package/extensions/ublock/css/about.css +3 -0
- package/extensions/ublock/css/advanced-settings.css +26 -0
- package/extensions/ublock/css/asset-viewer.css +79 -0
- package/extensions/ublock/css/click2load.css +53 -0
- package/extensions/ublock/css/cloud-ui.css +104 -0
- package/extensions/ublock/css/code-viewer.css +67 -0
- package/extensions/ublock/css/codemirror.css +326 -0
- package/extensions/ublock/css/common.css +347 -0
- package/extensions/ublock/css/dashboard-common.css +55 -0
- package/extensions/ublock/css/dashboard.css +115 -0
- package/extensions/ublock/css/devtools.css +22 -0
- package/extensions/ublock/css/document-blocked.css +146 -0
- package/extensions/ublock/css/dyna-rules.css +79 -0
- package/extensions/ublock/css/epicker-ui.css +270 -0
- package/extensions/ublock/css/fa-icons.css +149 -0
- package/extensions/ublock/css/fonts/Inter/Inter-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/Inter-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/LICENSE.txt +93 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/README.md +25 -0
- package/extensions/ublock/css/fonts/Metropolis/UNLICENSE +24 -0
- package/extensions/ublock/css/logger-ui-inspector.css +116 -0
- package/extensions/ublock/css/logger-ui.css +978 -0
- package/extensions/ublock/css/popup-fenix.css +778 -0
- package/extensions/ublock/css/settings.css +74 -0
- package/extensions/ublock/css/support.css +110 -0
- package/extensions/ublock/css/themes/default.css +526 -0
- package/extensions/ublock/css/whitelist.css +22 -0
- package/extensions/ublock/dashboard.html +47 -0
- package/extensions/ublock/devtools.html +58 -0
- package/extensions/ublock/document-blocked.html +64 -0
- package/extensions/ublock/dyna-rules.html +67 -0
- package/extensions/ublock/img/cloud.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/README +9 -0
- package/extensions/ublock/img/flags-of-the-world/ad.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ae.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/af.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ag.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ai.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/al.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/am.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ao.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ar.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/as.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/at.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/au.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ax.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/az.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ba.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/be.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/br.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/by.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ca.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ch.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ci.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ck.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/co.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/de.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/do.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ec.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ee.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/er.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/es.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/et.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ga.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-eng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-nir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-sct.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-wls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ge.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ht.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/id.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ie.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/il.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/im.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/in.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/io.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/iq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/is.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/it.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/je.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ke.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ki.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/km.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ky.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/la.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/li.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ly.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ma.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/md.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/me.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ml.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ms.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/my.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/na.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ne.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ni.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/no.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/om.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pe.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ph.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ps.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/py.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/qa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/re.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ro.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ru.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/se.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/si.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/so.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ss.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/st.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/td.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/th.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/to.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ua.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ug.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/um.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/us.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/va.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ve.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/wf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ws.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/xk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ye.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/yt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/za.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zw.png +0 -0
- package/extensions/ublock/img/fontawesome/LICENSE.txt +25 -0
- package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +79 -0
- package/extensions/ublock/img/help16.png +0 -0
- package/extensions/ublock/img/icon_128.png +0 -0
- package/extensions/ublock/img/icon_16-loading.png +0 -0
- package/extensions/ublock/img/icon_16-off.png +0 -0
- package/extensions/ublock/img/icon_16.png +0 -0
- package/extensions/ublock/img/icon_32-loading.png +0 -0
- package/extensions/ublock/img/icon_32-off.png +0 -0
- package/extensions/ublock/img/icon_32.png +0 -0
- package/extensions/ublock/img/icon_64-loading.png +0 -0
- package/extensions/ublock/img/icon_64-off.png +0 -0
- package/extensions/ublock/img/icon_64.png +0 -0
- package/extensions/ublock/img/material-design.svg +16 -0
- package/extensions/ublock/img/photon.svg +16 -0
- package/extensions/ublock/img/ublock-defs.svg +27 -0
- package/extensions/ublock/img/ublock.svg +44 -0
- package/extensions/ublock/is-webrtc-supported.html +9 -0
- package/extensions/ublock/js/1p-filters.js +336 -0
- package/extensions/ublock/js/3p-filters.js +867 -0
- package/extensions/ublock/js/about.js +34 -0
- package/extensions/ublock/js/advanced-settings.js +194 -0
- package/extensions/ublock/js/asset-viewer.js +112 -0
- package/extensions/ublock/js/assets.js +1448 -0
- package/extensions/ublock/js/background.js +404 -0
- package/extensions/ublock/js/base64-custom.js +246 -0
- package/extensions/ublock/js/benchmarks.js +421 -0
- package/extensions/ublock/js/biditrie.js +947 -0
- package/extensions/ublock/js/cachestorage.js +510 -0
- package/extensions/ublock/js/click2load.js +60 -0
- package/extensions/ublock/js/cloud-ui.js +238 -0
- package/extensions/ublock/js/code-viewer.js +311 -0
- package/extensions/ublock/js/codemirror/search-thread.js +199 -0
- package/extensions/ublock/js/codemirror/search.js +504 -0
- package/extensions/ublock/js/codemirror/ubo-dynamic-filtering.js +239 -0
- package/extensions/ublock/js/codemirror/ubo-static-filtering.js +1126 -0
- package/extensions/ublock/js/commands.js +181 -0
- package/extensions/ublock/js/console.js +59 -0
- package/extensions/ublock/js/contentscript-extra.js +662 -0
- package/extensions/ublock/js/contentscript.js +1366 -0
- package/extensions/ublock/js/contextmenu.js +270 -0
- package/extensions/ublock/js/cosmetic-filtering.js +983 -0
- package/extensions/ublock/js/dashboard-common.js +215 -0
- package/extensions/ublock/js/dashboard.js +166 -0
- package/extensions/ublock/js/devtools.js +184 -0
- package/extensions/ublock/js/diff-updater.js +288 -0
- package/extensions/ublock/js/document-blocked.js +230 -0
- package/extensions/ublock/js/dom.js +213 -0
- package/extensions/ublock/js/dyna-rules.js +678 -0
- package/extensions/ublock/js/dynamic-net-filtering.js +488 -0
- package/extensions/ublock/js/epicker-ui.js +924 -0
- package/extensions/ublock/js/fa-icons.js +129 -0
- package/extensions/ublock/js/filtering-context.js +461 -0
- package/extensions/ublock/js/filtering-engines.js +50 -0
- package/extensions/ublock/js/hnswitches.js +289 -0
- package/extensions/ublock/js/hntrie.js +780 -0
- package/extensions/ublock/js/html-filtering.js +465 -0
- package/extensions/ublock/js/httpheader-filtering.js +213 -0
- package/extensions/ublock/js/i18n.js +346 -0
- package/extensions/ublock/js/is-webrtc-supported.js +52 -0
- package/extensions/ublock/js/logger-ui-inspector.js +652 -0
- package/extensions/ublock/js/logger-ui.js +3028 -0
- package/extensions/ublock/js/logger.js +84 -0
- package/extensions/ublock/js/lz4.js +190 -0
- package/extensions/ublock/js/messaging.js +2095 -0
- package/extensions/ublock/js/pagestore.js +1140 -0
- package/extensions/ublock/js/popup-fenix.js +1529 -0
- package/extensions/ublock/js/redirect-engine.js +494 -0
- package/extensions/ublock/js/redirect-resources.js +193 -0
- package/extensions/ublock/js/reverselookup-worker.js +287 -0
- package/extensions/ublock/js/reverselookup.js +223 -0
- package/extensions/ublock/js/scriptlet-filtering.js +556 -0
- package/extensions/ublock/js/scriptlets/cosmetic-logger.js +376 -0
- package/extensions/ublock/js/scriptlets/cosmetic-off.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-on.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-report.js +142 -0
- package/extensions/ublock/js/scriptlets/dom-inspector.js +906 -0
- package/extensions/ublock/js/scriptlets/dom-survey-elements.js +72 -0
- package/extensions/ublock/js/scriptlets/dom-survey-scripts.js +126 -0
- package/extensions/ublock/js/scriptlets/epicker.js +1365 -0
- package/extensions/ublock/js/scriptlets/load-3p-css.js +67 -0
- package/extensions/ublock/js/scriptlets/load-large-media-all.js +62 -0
- package/extensions/ublock/js/scriptlets/load-large-media-interactive.js +299 -0
- package/extensions/ublock/js/scriptlets/noscript-spoof.js +89 -0
- package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +40 -0
- package/extensions/ublock/js/scriptlets/subscriber.js +113 -0
- package/extensions/ublock/js/scriptlets/updater.js +101 -0
- package/extensions/ublock/js/settings.js +317 -0
- package/extensions/ublock/js/start.js +509 -0
- package/extensions/ublock/js/static-dnr-filtering.js +497 -0
- package/extensions/ublock/js/static-ext-filtering-db.js +171 -0
- package/extensions/ublock/js/static-ext-filtering.js +184 -0
- package/extensions/ublock/js/static-filtering-io.js +144 -0
- package/extensions/ublock/js/static-filtering-parser.js +4459 -0
- package/extensions/ublock/js/static-net-filtering.js +5631 -0
- package/extensions/ublock/js/storage.js +1683 -0
- package/extensions/ublock/js/support.js +335 -0
- package/extensions/ublock/js/tab.js +1178 -0
- package/extensions/ublock/js/tasks.js +42 -0
- package/extensions/ublock/js/text-encode.js +275 -0
- package/extensions/ublock/js/text-utils.js +107 -0
- package/extensions/ublock/js/theme.js +151 -0
- package/extensions/ublock/js/traffic.js +1260 -0
- package/extensions/ublock/js/ublock.js +696 -0
- package/extensions/ublock/js/uri-utils.js +175 -0
- package/extensions/ublock/js/url-net-filtering.js +336 -0
- package/extensions/ublock/js/utils.js +208 -0
- package/extensions/ublock/js/vapi-background-ext.js +254 -0
- package/extensions/ublock/js/vapi-background.js +1802 -0
- package/extensions/ublock/js/vapi-client-extra.js +312 -0
- package/extensions/ublock/js/vapi-client.js +280 -0
- package/extensions/ublock/js/vapi-common.js +308 -0
- package/extensions/ublock/js/vapi.js +89 -0
- package/extensions/ublock/js/wasm/README.md +24 -0
- package/extensions/ublock/js/wasm/biditrie.wasm +0 -0
- package/extensions/ublock/js/wasm/biditrie.wat +728 -0
- package/extensions/ublock/js/wasm/hntrie.wasm +0 -0
- package/extensions/ublock/js/wasm/hntrie.wat +724 -0
- package/extensions/ublock/js/webext.js +164 -0
- package/extensions/ublock/js/whitelist.js +258 -0
- package/extensions/ublock/lib/codemirror/LICENSE +21 -0
- package/extensions/ublock/lib/codemirror/README.md +47 -0
- package/extensions/ublock/lib/codemirror/addon/comment/comment.js +211 -0
- package/extensions/ublock/lib/codemirror/addon/display/panel.js +133 -0
- package/extensions/ublock/lib/codemirror/addon/edit/closebrackets.js +201 -0
- package/extensions/ublock/lib/codemirror/addon/edit/matchbrackets.js +160 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldcode.js +157 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.css +20 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.js +163 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.css +36 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.js +509 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.css +119 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.js +1006 -0
- package/extensions/ublock/lib/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/extensions/ublock/lib/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/extensions/ublock/lib/codemirror/addon/search/searchcursor.js +296 -0
- package/extensions/ublock/lib/codemirror/addon/selection/active-line.js +72 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.css +350 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.js +9800 -0
- package/extensions/ublock/lib/codemirror/mode/css/css.js +864 -0
- package/extensions/ublock/lib/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/extensions/ublock/lib/codemirror/mode/javascript/javascript.js +942 -0
- package/extensions/ublock/lib/codemirror/mode/xml/xml.js +413 -0
- package/extensions/ublock/lib/codemirror/theme/night.css +27 -0
- package/extensions/ublock/lib/csstree/LICENSE +19 -0
- package/extensions/ublock/lib/csstree/css-tree.js +17 -0
- package/extensions/ublock/lib/diff/README.md +34 -0
- package/extensions/ublock/lib/diff/swatinem_diff.js +272 -0
- package/extensions/ublock/lib/hsluv/LICENSE +20 -0
- package/extensions/ublock/lib/hsluv/README +3 -0
- package/extensions/ublock/lib/hsluv/hsluv-0.1.0.min.js +8 -0
- package/extensions/ublock/lib/js-beautify/LICENSE +9 -0
- package/extensions/ublock/lib/js-beautify/README +5 -0
- package/extensions/ublock/lib/js-beautify/beautifier.min.js +2 -0
- package/extensions/ublock/lib/lz4/README.md +52 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-any.js +151 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-js.js +297 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-wasm.js +195 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wasm +0 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wat +745 -0
- package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +641 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/README.md +29 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wasm +0 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wat +322 -0
- package/extensions/ublock/lib/punycode.js +493 -0
- package/extensions/ublock/lib/regexanalyzer/CHANGES.md +15 -0
- package/extensions/ublock/lib/regexanalyzer/README.md +14 -0
- package/extensions/ublock/lib/regexanalyzer/regex.js +2276 -0
- package/extensions/ublock/logger-ui.html +232 -0
- package/extensions/ublock/managed_storage.json +73 -0
- package/extensions/ublock/manifest.json +115 -0
- package/extensions/ublock/no-dashboard.html +27 -0
- package/extensions/ublock/popup-fenix.html +114 -0
- package/extensions/ublock/settings.html +98 -0
- package/extensions/ublock/support.html +131 -0
- package/extensions/ublock/web_accessible_resources/1x1.gif +0 -0
- package/extensions/ublock/web_accessible_resources/2x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/32x32.png +0 -0
- package/extensions/ublock/web_accessible_resources/3x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/README.txt +11 -0
- package/extensions/ublock/web_accessible_resources/addthis_widget.js +39 -0
- package/extensions/ublock/web_accessible_resources/amazon_ads.js +70 -0
- package/extensions/ublock/web_accessible_resources/amazon_apstag.js +62 -0
- package/extensions/ublock/web_accessible_resources/ampproject_v0.js +34 -0
- package/extensions/ublock/web_accessible_resources/chartbeat.js +30 -0
- package/extensions/ublock/web_accessible_resources/click2load.html +28 -0
- package/extensions/ublock/web_accessible_resources/doubleclick_instream_ad_status.js +1 -0
- package/extensions/ublock/web_accessible_resources/empty +0 -0
- package/extensions/ublock/web_accessible_resources/epicker-ui.html +76 -0
- package/extensions/ublock/web_accessible_resources/fingerprint2.js +55 -0
- package/extensions/ublock/web_accessible_resources/fingerprint3.js +45 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_analytics.js +110 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_cx_api.js +36 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_ga.js +130 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_inpage_linkid.js +28 -0
- package/extensions/ublock/web_accessible_resources/google-ima.js +855 -0
- package/extensions/ublock/web_accessible_resources/googlesyndication_adsbygoogle.js +56 -0
- package/extensions/ublock/web_accessible_resources/googletagmanager_gtm.js +43 -0
- package/extensions/ublock/web_accessible_resources/googletagservices_gpt.js +153 -0
- package/extensions/ublock/web_accessible_resources/hd-main.js +46 -0
- package/extensions/ublock/web_accessible_resources/ligatus_angular-tag.js +29 -0
- package/extensions/ublock/web_accessible_resources/monkeybroker.js +43 -0
- package/extensions/ublock/web_accessible_resources/mxpnl_mixpanel.js +51 -0
- package/extensions/ublock/web_accessible_resources/nobab.js +87 -0
- package/extensions/ublock/web_accessible_resources/nobab2.js +42 -0
- package/extensions/ublock/web_accessible_resources/noeval-silent.js +28 -0
- package/extensions/ublock/web_accessible_resources/noeval.js +30 -0
- package/extensions/ublock/web_accessible_resources/nofab.js +67 -0
- package/extensions/ublock/web_accessible_resources/noop-0.1s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-0.5s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-1s.mp4 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-vmap1.0.xml +1 -0
- package/extensions/ublock/web_accessible_resources/noop.css +1 -0
- package/extensions/ublock/web_accessible_resources/noop.html +5 -0
- package/extensions/ublock/web_accessible_resources/noop.js +3 -0
- package/extensions/ublock/web_accessible_resources/noop.json +1 -0
- package/extensions/ublock/web_accessible_resources/noop.txt +1 -0
- package/extensions/ublock/web_accessible_resources/outbrain-widget.js +72 -0
- package/extensions/ublock/web_accessible_resources/popads-dummy.js +30 -0
- package/extensions/ublock/web_accessible_resources/popads.js +40 -0
- package/extensions/ublock/web_accessible_resources/prebid-ads.js +26 -0
- package/extensions/ublock/web_accessible_resources/scorecardresearch_beacon.js +31 -0
- package/extensions/ublock/whitelist.html +63 -0
- package/external/.gitkeep +0 -0
- package/fonts/Calibri Bold Italic.ttf +0 -0
- package/fonts/Calibri Bold.TTF +0 -0
- package/fonts/Calibri Italic.ttf +0 -0
- package/fonts/Calibri Light Italic.ttf +0 -0
- package/fonts/Calibri Light.ttf +0 -0
- package/fonts/Calibri Regular.ttf +0 -0
- package/fonts/Emoji.ttf +0 -0
- package/fonts/SegoeUI-Bold.ttf +0 -0
- package/fonts/SegoeUI-Light.ttf +0 -0
- package/fonts/SegoeUI-Regular.ttf +0 -0
- package/fonts/SegoeUI-Semibold.ttf +0 -0
- package/fonts/SegoeUI-Semilight.ttf +0 -0
- package/fonts/Tahoma Bold.ttf +0 -0
- package/fonts/Tahoma.ttf +0 -0
- package/fonts/fonts.conf +21 -0
- package/package.json +177 -0
- package/scripts/build-function.js +18 -0
- package/scripts/build-open-api.js +274 -0
- package/scripts/build-schemas.js +86 -0
- package/scripts/build-selectors.js +36 -0
- package/scripts/clean.js +7 -0
- package/scripts/install-adblock.js +45 -0
- package/scripts/install-cdp-json.js +37 -0
- package/scripts/start.sh +30 -0
- package/scripts/test.sh +17 -0
- package/src/browserless.ts +253 -0
- package/src/browsers/cdp-chromium.ts +422 -0
- package/src/browsers/index.ts +296 -0
- package/src/browsers/playwright-chromium.ts +168 -0
- package/src/browsers/playwright-firefox.ts +161 -0
- package/src/browsers/playwright-webkit.ts +161 -0
- package/src/config.ts +426 -0
- package/src/constants.ts +4 -0
- package/src/exports.ts +23 -0
- package/src/file-system.ts +54 -0
- package/src/hooks.ts +37 -0
- package/src/http.ts +157 -0
- package/src/index.ts +41 -0
- package/src/limiter.spec.ts +365 -0
- package/src/limiter.ts +225 -0
- package/src/metrics.spec.ts +49 -0
- package/src/metrics.ts +108 -0
- package/src/mime-types.ts +332 -0
- package/src/monitoring.ts +53 -0
- package/src/routes/chromium/http/content-post.ts +238 -0
- package/src/routes/chromium/http/download-post.ts +162 -0
- package/src/routes/chromium/http/function-post.ts +98 -0
- package/src/routes/chromium/http/pdf-post.ts +234 -0
- package/src/routes/chromium/http/performance.ts +71 -0
- package/src/routes/chromium/http/scrape-post.ts +439 -0
- package/src/routes/chromium/http/screenshot-post.ts +262 -0
- package/src/routes/chromium/tests/content.spec.ts +340 -0
- package/src/routes/chromium/tests/download.spec.ts +77 -0
- package/src/routes/chromium/tests/function.spec.ts +279 -0
- package/src/routes/chromium/tests/pdf.spec.ts +375 -0
- package/src/routes/chromium/tests/performance.spec.ts +155 -0
- package/src/routes/chromium/tests/scrape.spec.ts +414 -0
- package/src/routes/chromium/tests/screenshot.spec.ts +387 -0
- package/src/routes/chromium/tests/websocket.spec.ts +407 -0
- package/src/routes/chromium/utils/function/client.ts +99 -0
- package/src/routes/chromium/utils/function/handler.ts +172 -0
- package/src/routes/chromium/utils/performance/child.ts +38 -0
- package/src/routes/chromium/utils/performance/main.ts +90 -0
- package/src/routes/chromium/utils/performance/types.ts +24 -0
- package/src/routes/chromium/ws/browser.ts +31 -0
- package/src/routes/chromium/ws/cdp-chromium.ts +31 -0
- package/src/routes/chromium/ws/page.ts +31 -0
- package/src/routes/chromium/ws/playwright-chromium.ts +44 -0
- package/src/routes/firefox/tests/websocket.spec.ts +146 -0
- package/src/routes/firefox/ws/playwright-firefox.ts +44 -0
- package/src/routes/management/http/config-get.ts +82 -0
- package/src/routes/management/http/metrics-get.ts +43 -0
- package/src/routes/management/http/metrics-total-get.ts +89 -0
- package/src/routes/management/http/sessions-get.ts +39 -0
- package/src/routes/management/http/static-get.ts +109 -0
- package/src/routes/management/tests/management.spec.ts +71 -0
- package/src/routes/webkit/tests/websocket.spec.ts +146 -0
- package/src/routes/webkit/ws/playwright-webkit.ts +44 -0
- package/src/server.ts +609 -0
- package/src/shim.spec.ts +154 -0
- package/src/shim.ts +78 -0
- package/src/types.ts +470 -0
- package/src/utils.ts +787 -0
- package/src/webhooks.ts +50 -0
- package/static/docs/browserless-logo.png +0 -0
- package/static/docs/docs.js +2 -0
- package/static/docs/index.html +71 -0
- package/static/docs/swagger.json +4232 -0
- package/static/favicon-32x32.png +0 -0
- package/static/function/client.js +31623 -0
- package/static/function/index.html +12 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,1126 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
|
|
3
|
+
uBlock Origin - a browser extension to block requests.
|
|
4
|
+
Copyright (C) 2018-present Raymond Hill
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
18
|
+
|
|
19
|
+
Home: https://github.com/gorhill/uBlock
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/* global CodeMirror */
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
/******************************************************************************/
|
|
27
|
+
|
|
28
|
+
import * as sfp from '../static-filtering-parser.js';
|
|
29
|
+
import { dom, qs$ } from '../dom.js';
|
|
30
|
+
|
|
31
|
+
/******************************************************************************/
|
|
32
|
+
|
|
33
|
+
const redirectNames = new Map();
|
|
34
|
+
const scriptletNames = new Map();
|
|
35
|
+
const preparseDirectiveEnv = [];
|
|
36
|
+
const preparseDirectiveHints = [];
|
|
37
|
+
const originHints = [];
|
|
38
|
+
let hintHelperRegistered = false;
|
|
39
|
+
|
|
40
|
+
/******************************************************************************/
|
|
41
|
+
|
|
42
|
+
CodeMirror.defineOption('trustedSource', false, (cm, state) => {
|
|
43
|
+
if ( typeof state !== 'boolean' ) { return; }
|
|
44
|
+
self.dispatchEvent(new CustomEvent('trustedSource', {
|
|
45
|
+
detail: state,
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
CodeMirror.defineOption('trustedScriptletTokens', undefined, (cm, tokens) => {
|
|
50
|
+
if ( tokens === undefined || tokens === null ) { return; }
|
|
51
|
+
if ( typeof tokens[Symbol.iterator] !== 'function' ) { return; }
|
|
52
|
+
self.dispatchEvent(new CustomEvent('trustedScriptletTokens', {
|
|
53
|
+
detail: new Set(tokens),
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/******************************************************************************/
|
|
58
|
+
|
|
59
|
+
CodeMirror.defineMode('ubo-static-filtering', function() {
|
|
60
|
+
const astParser = new sfp.AstFilterParser({
|
|
61
|
+
interactive: true,
|
|
62
|
+
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
|
|
63
|
+
});
|
|
64
|
+
const astWalker = astParser.getWalker();
|
|
65
|
+
let currentWalkerNode = 0;
|
|
66
|
+
let lastNetOptionType = 0;
|
|
67
|
+
|
|
68
|
+
const redirectTokenStyle = node => {
|
|
69
|
+
const rawToken = astParser.getNodeString(node || currentWalkerNode);
|
|
70
|
+
const { token } = sfp.parseRedirectValue(rawToken);
|
|
71
|
+
return redirectNames.has(token) ? 'value' : 'value warning';
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const nodeHasError = node => {
|
|
75
|
+
return astParser.getNodeFlags(
|
|
76
|
+
node || currentWalkerNode, sfp.NODE_FLAG_ERROR
|
|
77
|
+
) !== 0;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const colorFromAstNode = function() {
|
|
81
|
+
if ( astParser.nodeIsEmptyString(currentWalkerNode) ) { return '+'; }
|
|
82
|
+
if ( nodeHasError() ) { return 'error'; }
|
|
83
|
+
const nodeType = astParser.getNodeType(currentWalkerNode);
|
|
84
|
+
switch ( nodeType ) {
|
|
85
|
+
case sfp.NODE_TYPE_WHITESPACE:
|
|
86
|
+
return '';
|
|
87
|
+
case sfp.NODE_TYPE_COMMENT:
|
|
88
|
+
if ( astWalker.canGoDown() ) { break; }
|
|
89
|
+
return 'comment';
|
|
90
|
+
case sfp.NODE_TYPE_COMMENT_URL:
|
|
91
|
+
return 'comment link';
|
|
92
|
+
case sfp.NODE_TYPE_IGNORE:
|
|
93
|
+
return 'comment';
|
|
94
|
+
case sfp.NODE_TYPE_PREPARSE_DIRECTIVE:
|
|
95
|
+
case sfp.NODE_TYPE_PREPARSE_DIRECTIVE_VALUE:
|
|
96
|
+
return 'directive';
|
|
97
|
+
case sfp.NODE_TYPE_PREPARSE_DIRECTIVE_IF_VALUE: {
|
|
98
|
+
const raw = astParser.getNodeString(currentWalkerNode);
|
|
99
|
+
const state = sfp.utils.preparser.evaluateExpr(raw, preparseDirectiveEnv);
|
|
100
|
+
return state ? 'positive strong' : 'negative strong';
|
|
101
|
+
}
|
|
102
|
+
case sfp.NODE_TYPE_EXT_OPTIONS_ANCHOR:
|
|
103
|
+
return astParser.getFlags(sfp.AST_FLAG_IS_EXCEPTION)
|
|
104
|
+
? 'tag strong'
|
|
105
|
+
: 'def strong';
|
|
106
|
+
case sfp.NODE_TYPE_EXT_DECORATION:
|
|
107
|
+
return 'def';
|
|
108
|
+
case sfp.NODE_TYPE_EXT_PATTERN_RAW:
|
|
109
|
+
if ( astWalker.canGoDown() ) { break; }
|
|
110
|
+
return 'variable';
|
|
111
|
+
case sfp.NODE_TYPE_EXT_PATTERN_COSMETIC:
|
|
112
|
+
case sfp.NODE_TYPE_EXT_PATTERN_HTML:
|
|
113
|
+
return 'variable';
|
|
114
|
+
case sfp.NODE_TYPE_EXT_PATTERN_RESPONSEHEADER:
|
|
115
|
+
case sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET:
|
|
116
|
+
if ( astWalker.canGoDown() ) { break; }
|
|
117
|
+
return 'variable';
|
|
118
|
+
case sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET_TOKEN: {
|
|
119
|
+
const token = astParser.getNodeString(currentWalkerNode);
|
|
120
|
+
if ( scriptletNames.has(token) === false ) {
|
|
121
|
+
return 'warning';
|
|
122
|
+
}
|
|
123
|
+
return 'variable';
|
|
124
|
+
}
|
|
125
|
+
case sfp.NODE_TYPE_EXT_PATTERN_SCRIPTLET_ARG:
|
|
126
|
+
return 'variable';
|
|
127
|
+
case sfp.NODE_TYPE_NET_EXCEPTION:
|
|
128
|
+
return 'tag strong';
|
|
129
|
+
case sfp.NODE_TYPE_NET_PATTERN:
|
|
130
|
+
if ( astWalker.canGoDown() ) { break; }
|
|
131
|
+
if ( astParser.isRegexPattern() ) {
|
|
132
|
+
if ( astParser.getNodeFlags(currentWalkerNode, sfp.NODE_FLAG_PATTERN_UNTOKENIZABLE) !== 0 ) {
|
|
133
|
+
return 'variable warning';
|
|
134
|
+
}
|
|
135
|
+
return 'variable notice';
|
|
136
|
+
}
|
|
137
|
+
return 'variable';
|
|
138
|
+
case sfp.NODE_TYPE_NET_PATTERN_PART:
|
|
139
|
+
return 'variable';
|
|
140
|
+
case sfp.NODE_TYPE_NET_PATTERN_PART_SPECIAL:
|
|
141
|
+
return 'keyword strong';
|
|
142
|
+
case sfp.NODE_TYPE_NET_PATTERN_PART_UNICODE:
|
|
143
|
+
return 'variable unicode';
|
|
144
|
+
case sfp.NODE_TYPE_NET_PATTERN_LEFT_HNANCHOR:
|
|
145
|
+
case sfp.NODE_TYPE_NET_PATTERN_LEFT_ANCHOR:
|
|
146
|
+
case sfp.NODE_TYPE_NET_PATTERN_RIGHT_ANCHOR:
|
|
147
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_NOT:
|
|
148
|
+
return 'keyword strong';
|
|
149
|
+
case sfp.NODE_TYPE_NET_OPTIONS_ANCHOR:
|
|
150
|
+
case sfp.NODE_TYPE_NET_OPTION_SEPARATOR:
|
|
151
|
+
lastNetOptionType = 0;
|
|
152
|
+
return 'def strong';
|
|
153
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_UNKNOWN:
|
|
154
|
+
lastNetOptionType = 0;
|
|
155
|
+
return 'error';
|
|
156
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_1P:
|
|
157
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_STRICT1P:
|
|
158
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_3P:
|
|
159
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_STRICT3P:
|
|
160
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_ALL:
|
|
161
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_BADFILTER:
|
|
162
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_CNAME:
|
|
163
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_CSP:
|
|
164
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_CSS:
|
|
165
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_DENYALLOW:
|
|
166
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_DOC:
|
|
167
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_EHIDE:
|
|
168
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_EMPTY:
|
|
169
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_FONT:
|
|
170
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_FRAME:
|
|
171
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_FROM:
|
|
172
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_GENERICBLOCK:
|
|
173
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_GHIDE:
|
|
174
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_HEADER:
|
|
175
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_IMAGE:
|
|
176
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_IMPORTANT:
|
|
177
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_INLINEFONT:
|
|
178
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_INLINESCRIPT:
|
|
179
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_MATCHCASE:
|
|
180
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_MEDIA:
|
|
181
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_METHOD:
|
|
182
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_MP4:
|
|
183
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_NOOP:
|
|
184
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_OBJECT:
|
|
185
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_OTHER:
|
|
186
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_PING:
|
|
187
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_POPUNDER:
|
|
188
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_POPUP:
|
|
189
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_REDIRECT:
|
|
190
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_REDIRECTRULE:
|
|
191
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_REMOVEPARAM:
|
|
192
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_SCRIPT:
|
|
193
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_SHIDE:
|
|
194
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_TO:
|
|
195
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_XHR:
|
|
196
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_WEBRTC:
|
|
197
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_WEBSOCKET:
|
|
198
|
+
lastNetOptionType = nodeType;
|
|
199
|
+
return 'def';
|
|
200
|
+
case sfp.NODE_TYPE_NET_OPTION_ASSIGN:
|
|
201
|
+
return 'def';
|
|
202
|
+
case sfp.NODE_TYPE_NET_OPTION_VALUE:
|
|
203
|
+
if ( astWalker.canGoDown() ) { break; }
|
|
204
|
+
switch ( lastNetOptionType ) {
|
|
205
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_REDIRECT:
|
|
206
|
+
case sfp.NODE_TYPE_NET_OPTION_NAME_REDIRECTRULE:
|
|
207
|
+
return redirectTokenStyle();
|
|
208
|
+
default:
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
return 'value';
|
|
212
|
+
case sfp.NODE_TYPE_OPTION_VALUE_NOT:
|
|
213
|
+
return 'keyword strong';
|
|
214
|
+
case sfp.NODE_TYPE_OPTION_VALUE_DOMAIN:
|
|
215
|
+
return 'value';
|
|
216
|
+
case sfp.NODE_TYPE_OPTION_VALUE_SEPARATOR:
|
|
217
|
+
return 'def';
|
|
218
|
+
default:
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
return '+';
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
self.addEventListener('trustedSource', ev => {
|
|
225
|
+
astParser.options.trustedSource = ev.detail;
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
self.addEventListener('trustedScriptletTokens', ev => {
|
|
229
|
+
astParser.options.trustedScriptletTokens = ev.detail;
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
lineComment: '!',
|
|
234
|
+
token: function(stream) {
|
|
235
|
+
if ( stream.sol() ) {
|
|
236
|
+
astParser.parse(stream.string);
|
|
237
|
+
if ( astParser.getFlags(sfp.AST_FLAG_UNSUPPORTED) !== 0 ) {
|
|
238
|
+
stream.skipToEnd();
|
|
239
|
+
return 'error';
|
|
240
|
+
}
|
|
241
|
+
if ( astParser.getType() === sfp.AST_TYPE_NONE ) {
|
|
242
|
+
stream.skipToEnd();
|
|
243
|
+
return 'comment';
|
|
244
|
+
}
|
|
245
|
+
currentWalkerNode = astWalker.reset();
|
|
246
|
+
} else if ( nodeHasError() ) {
|
|
247
|
+
currentWalkerNode = astWalker.right();
|
|
248
|
+
} else {
|
|
249
|
+
currentWalkerNode = astWalker.next();
|
|
250
|
+
}
|
|
251
|
+
let style = '';
|
|
252
|
+
while ( currentWalkerNode !== 0 ) {
|
|
253
|
+
style = colorFromAstNode(stream);
|
|
254
|
+
if ( style !== '+' ) { break; }
|
|
255
|
+
currentWalkerNode = astWalker.next();
|
|
256
|
+
}
|
|
257
|
+
if ( style === '+' ) {
|
|
258
|
+
stream.skipToEnd();
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
stream.pos = astParser.getNodeStringEnd(currentWalkerNode);
|
|
262
|
+
if ( astParser.isNetworkFilter() ) {
|
|
263
|
+
return style ? `line-cm-net ${style}` : 'line-cm-net';
|
|
264
|
+
}
|
|
265
|
+
if ( astParser.isExtendedFilter() ) {
|
|
266
|
+
let flavor = '';
|
|
267
|
+
if ( astParser.isCosmeticFilter() ) {
|
|
268
|
+
flavor = 'line-cm-ext-dom';
|
|
269
|
+
} else if ( astParser.isScriptletFilter() ) {
|
|
270
|
+
flavor = 'line-cm-ext-js';
|
|
271
|
+
} else if ( astParser.isHtmlFilter() ) {
|
|
272
|
+
flavor = 'line-cm-ext-html';
|
|
273
|
+
}
|
|
274
|
+
if ( flavor !== '' ) {
|
|
275
|
+
style = `${flavor} ${style}`;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
style = style.trim();
|
|
279
|
+
return style !== '' ? style : null;
|
|
280
|
+
},
|
|
281
|
+
parser: astParser,
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
/******************************************************************************/
|
|
286
|
+
|
|
287
|
+
// Following code is for auto-completion. Reference:
|
|
288
|
+
// https://codemirror.net/demo/complete.html
|
|
289
|
+
|
|
290
|
+
CodeMirror.defineOption('uboHints', null, (cm, hints) => {
|
|
291
|
+
if ( hints instanceof Object === false ) { return; }
|
|
292
|
+
if ( Array.isArray(hints.redirectResources) ) {
|
|
293
|
+
for ( const [ name, desc ] of hints.redirectResources ) {
|
|
294
|
+
const displayText = desc.aliasOf !== ''
|
|
295
|
+
? `${name} (${desc.aliasOf})`
|
|
296
|
+
: '';
|
|
297
|
+
if ( desc.canRedirect ) {
|
|
298
|
+
redirectNames.set(name, displayText);
|
|
299
|
+
}
|
|
300
|
+
if ( desc.canInject && name.endsWith('.js') ) {
|
|
301
|
+
scriptletNames.set(name.slice(0, -3), displayText);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if ( Array.isArray(hints.preparseDirectiveEnv)) {
|
|
306
|
+
preparseDirectiveEnv.length = 0;
|
|
307
|
+
preparseDirectiveEnv.push(...hints.preparseDirectiveEnv);
|
|
308
|
+
}
|
|
309
|
+
if ( Array.isArray(hints.preparseDirectiveHints)) {
|
|
310
|
+
preparseDirectiveHints.push(...hints.preparseDirectiveHints);
|
|
311
|
+
}
|
|
312
|
+
if ( Array.isArray(hints.originHints) ) {
|
|
313
|
+
originHints.length = 0;
|
|
314
|
+
for ( const hint of hints.originHints ) {
|
|
315
|
+
originHints.push(hint);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if ( hintHelperRegistered ) { return; }
|
|
319
|
+
hintHelperRegistered = true;
|
|
320
|
+
initHints();
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
function initHints() {
|
|
324
|
+
const astParser = new sfp.AstFilterParser({
|
|
325
|
+
interactive: true,
|
|
326
|
+
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
|
|
327
|
+
});
|
|
328
|
+
const proceduralOperatorNames = new Map(
|
|
329
|
+
Array.from(sfp.proceduralOperatorTokens)
|
|
330
|
+
.filter(item => (item[1] & 0b01) !== 0)
|
|
331
|
+
);
|
|
332
|
+
const excludedHints = new Set([
|
|
333
|
+
'genericblock',
|
|
334
|
+
'object-subrequest',
|
|
335
|
+
'rewrite',
|
|
336
|
+
'webrtc',
|
|
337
|
+
]);
|
|
338
|
+
|
|
339
|
+
const pickBestHints = function(cursor, seedLeft, seedRight, hints) {
|
|
340
|
+
const seed = (seedLeft + seedRight).trim();
|
|
341
|
+
const out = [];
|
|
342
|
+
// First, compare against whole seed
|
|
343
|
+
for ( const hint of hints ) {
|
|
344
|
+
const text = hint instanceof Object
|
|
345
|
+
? hint.displayText || hint.text
|
|
346
|
+
: hint;
|
|
347
|
+
if ( text.startsWith(seed) === false ) { continue; }
|
|
348
|
+
out.push(hint);
|
|
349
|
+
}
|
|
350
|
+
if ( out.length !== 0 ) {
|
|
351
|
+
return {
|
|
352
|
+
from: { line: cursor.line, ch: cursor.ch - seedLeft.length },
|
|
353
|
+
to: { line: cursor.line, ch: cursor.ch + seedRight.length },
|
|
354
|
+
list: out,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
// If no match, try again with a different heuristic: valid hints are
|
|
358
|
+
// those matching left seed, not matching right seed but right seed is
|
|
359
|
+
// found to be a valid hint. This is to take care of cases like:
|
|
360
|
+
//
|
|
361
|
+
// *$script,redomain=example.org
|
|
362
|
+
// ^
|
|
363
|
+
// + cursor position
|
|
364
|
+
//
|
|
365
|
+
// In such case, [ redirect=, redirect-rule= ] should be returned
|
|
366
|
+
// as valid hints.
|
|
367
|
+
for ( const hint of hints ) {
|
|
368
|
+
const text = hint instanceof Object
|
|
369
|
+
? hint.displayText || hint.text
|
|
370
|
+
: hint;
|
|
371
|
+
if ( seedLeft.length === 0 ) { continue; }
|
|
372
|
+
if ( text.startsWith(seedLeft) === false ) { continue; }
|
|
373
|
+
if ( hints.includes(seedRight) === false ) { continue; }
|
|
374
|
+
out.push(hint);
|
|
375
|
+
}
|
|
376
|
+
if ( out.length !== 0 ) {
|
|
377
|
+
return {
|
|
378
|
+
from: { line: cursor.line, ch: cursor.ch - seedLeft.length },
|
|
379
|
+
to: { line: cursor.line, ch: cursor.ch },
|
|
380
|
+
list: out,
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
// If no match, try again with a different heuristic: valid hints are
|
|
384
|
+
// those containing seed as a substring. This is to take care of cases
|
|
385
|
+
// like:
|
|
386
|
+
//
|
|
387
|
+
// *$script,redirect=gif
|
|
388
|
+
// ^
|
|
389
|
+
// + cursor position
|
|
390
|
+
//
|
|
391
|
+
// In such case, [ 1x1.gif, 1x1-transparent.gif ] should be returned
|
|
392
|
+
// as valid hints.
|
|
393
|
+
for ( const hint of hints ) {
|
|
394
|
+
const text = hint instanceof Object
|
|
395
|
+
? hint.displayText || hint.text
|
|
396
|
+
: hint;
|
|
397
|
+
if ( seedLeft.length === 1 ) {
|
|
398
|
+
if ( text.startsWith(seedLeft) === false ) { continue; }
|
|
399
|
+
} else if ( text.includes(seed) === false ) { continue; }
|
|
400
|
+
out.push(hint);
|
|
401
|
+
}
|
|
402
|
+
if ( out.length !== 0 ) {
|
|
403
|
+
return {
|
|
404
|
+
from: { line: cursor.line, ch: cursor.ch - seedLeft.length },
|
|
405
|
+
to: { line: cursor.line, ch: cursor.ch + seedRight.length },
|
|
406
|
+
list: out,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
// If still no match, try again with a different heuristic: valid hints
|
|
410
|
+
// are those containing left seed as a substring. This is to take care
|
|
411
|
+
// of cases like:
|
|
412
|
+
//
|
|
413
|
+
// *$script,redirect=gifdomain=example.org
|
|
414
|
+
// ^
|
|
415
|
+
// + cursor position
|
|
416
|
+
//
|
|
417
|
+
// In such case, [ 1x1.gif, 1x1-transparent.gif ] should be returned
|
|
418
|
+
// as valid hints.
|
|
419
|
+
for ( const hint of hints ) {
|
|
420
|
+
const text = hint instanceof Object
|
|
421
|
+
? hint.displayText || hint.text
|
|
422
|
+
: hint;
|
|
423
|
+
if ( text.includes(seedLeft) === false ) { continue; }
|
|
424
|
+
out.push(hint);
|
|
425
|
+
}
|
|
426
|
+
if ( out.length !== 0 ) {
|
|
427
|
+
return {
|
|
428
|
+
from: { line: cursor.line, ch: cursor.ch - seedLeft.length },
|
|
429
|
+
to: { line: cursor.line, ch: cursor.ch },
|
|
430
|
+
list: out,
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
const getOriginHints = function(cursor, line, suffix = '') {
|
|
436
|
+
const beg = cursor.ch;
|
|
437
|
+
const matchLeft = /[^,|=~]*$/.exec(line.slice(0, beg));
|
|
438
|
+
const matchRight = /^[^#,|]*/.exec(line.slice(beg));
|
|
439
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
440
|
+
const hints = [];
|
|
441
|
+
for ( const text of originHints ) {
|
|
442
|
+
hints.push(text + suffix);
|
|
443
|
+
}
|
|
444
|
+
return pickBestHints(cursor, matchLeft[0], matchRight[0], hints);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
const getNetPatternHints = function(cursor, line) {
|
|
448
|
+
if ( /\|\|[\w.-]*$/.test(line.slice(0, cursor.ch)) ) {
|
|
449
|
+
return getOriginHints(cursor, line, '^');
|
|
450
|
+
}
|
|
451
|
+
// Maybe a static extended filter is meant to be crafted.
|
|
452
|
+
if ( /[^\w\x80-\xF4#,.-]/.test(line) === false ) {
|
|
453
|
+
return getOriginHints(cursor, line);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
const getNetOptionHints = function(cursor, seedLeft, seedRight) {
|
|
458
|
+
const isNegated = seedLeft.startsWith('~');
|
|
459
|
+
if ( isNegated ) {
|
|
460
|
+
seedLeft = seedLeft.slice(1);
|
|
461
|
+
}
|
|
462
|
+
const assignPos = seedRight.indexOf('=');
|
|
463
|
+
if ( assignPos !== -1 ) { seedRight = seedRight.slice(0, assignPos); }
|
|
464
|
+
const isException = astParser.isException();
|
|
465
|
+
const hints = [];
|
|
466
|
+
for ( let [ text, desc ] of sfp.netOptionTokenDescriptors ) {
|
|
467
|
+
if ( excludedHints.has(text) ) { continue; }
|
|
468
|
+
if ( isNegated && desc.canNegate !== true ) { continue; }
|
|
469
|
+
if ( isException ) {
|
|
470
|
+
if ( desc.blockOnly ) { continue; }
|
|
471
|
+
} else {
|
|
472
|
+
if ( desc.allowOnly ) { continue; }
|
|
473
|
+
if ( (assignPos === -1) && desc.mustAssign ) {
|
|
474
|
+
text += '=';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
hints.push(text);
|
|
478
|
+
}
|
|
479
|
+
return pickBestHints(cursor, seedLeft, seedRight, hints);
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
const getNetRedirectHints = function(cursor, seedLeft, seedRight) {
|
|
483
|
+
const hints = [];
|
|
484
|
+
for ( const text of redirectNames.keys() ) {
|
|
485
|
+
if ( text.startsWith('abp-resource:') ) { continue; }
|
|
486
|
+
hints.push(text);
|
|
487
|
+
}
|
|
488
|
+
return pickBestHints(cursor, seedLeft, seedRight, hints);
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
const getNetHints = function(cursor, line) {
|
|
492
|
+
const patternNode = astParser.getBranchFromType(sfp.NODE_TYPE_NET_PATTERN_RAW);
|
|
493
|
+
if ( patternNode === 0 ) { return; }
|
|
494
|
+
const patternEnd = astParser.getNodeStringEnd(patternNode);
|
|
495
|
+
const beg = cursor.ch;
|
|
496
|
+
if ( beg <= patternEnd ) {
|
|
497
|
+
return getNetPatternHints(cursor, line);
|
|
498
|
+
}
|
|
499
|
+
const lineBefore = line.slice(0, beg);
|
|
500
|
+
const lineAfter = line.slice(beg);
|
|
501
|
+
let matchLeft = /[^$,]*$/.exec(lineBefore);
|
|
502
|
+
let matchRight = /^[^,]*/.exec(lineAfter);
|
|
503
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
504
|
+
const assignPos = matchLeft[0].indexOf('=');
|
|
505
|
+
if ( assignPos === -1 ) {
|
|
506
|
+
return getNetOptionHints(cursor, matchLeft[0], matchRight[0]);
|
|
507
|
+
}
|
|
508
|
+
if ( /^(redirect(-rule)?|rewrite)=/.test(matchLeft[0]) ) {
|
|
509
|
+
return getNetRedirectHints(
|
|
510
|
+
cursor,
|
|
511
|
+
matchLeft[0].slice(assignPos + 1),
|
|
512
|
+
matchRight[0]
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
if ( /^(domain|from)=/.test(matchLeft[0]) ) {
|
|
516
|
+
return getOriginHints(cursor, line);
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
const getExtSelectorHints = function(cursor, line) {
|
|
521
|
+
const beg = cursor.ch;
|
|
522
|
+
// Special selector case: `^responseheader`
|
|
523
|
+
{
|
|
524
|
+
const match = /#\^([a-z]+)$/.exec(line.slice(0, beg));
|
|
525
|
+
if (
|
|
526
|
+
match !== null &&
|
|
527
|
+
'responseheader'.startsWith(match[1]) &&
|
|
528
|
+
line.slice(beg) === ''
|
|
529
|
+
) {
|
|
530
|
+
return pickBestHints(
|
|
531
|
+
cursor,
|
|
532
|
+
match[1],
|
|
533
|
+
'',
|
|
534
|
+
[ 'responseheader()' ]
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
// Procedural operators
|
|
539
|
+
const matchLeft = /#\^?.*:([^:]*)$/.exec(line.slice(0, beg));
|
|
540
|
+
const matchRight = /^([a-z-]*)\(?/.exec(line.slice(beg));
|
|
541
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
542
|
+
const isStaticDOM = matchLeft[0].indexOf('^') !== -1;
|
|
543
|
+
const hints = [];
|
|
544
|
+
for ( let [ text, bits ] of proceduralOperatorNames ) {
|
|
545
|
+
if ( isStaticDOM && (bits & 0b10) !== 0 ) { continue; }
|
|
546
|
+
hints.push(text);
|
|
547
|
+
}
|
|
548
|
+
return pickBestHints(cursor, matchLeft[1], matchRight[1], hints);
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
const getExtHeaderHints = function(cursor, line) {
|
|
552
|
+
const beg = cursor.ch;
|
|
553
|
+
const matchLeft = /#\^responseheader\((.*)$/.exec(line.slice(0, beg));
|
|
554
|
+
const matchRight = /^([^)]*)/.exec(line.slice(beg));
|
|
555
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
556
|
+
const hints = [];
|
|
557
|
+
for ( const hint of sfp.removableHTTPHeaders ) {
|
|
558
|
+
hints.push(hint);
|
|
559
|
+
}
|
|
560
|
+
return pickBestHints(cursor, matchLeft[1], matchRight[1], hints);
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
const getExtScriptletHints = function(cursor, line) {
|
|
564
|
+
const beg = cursor.ch;
|
|
565
|
+
const matchLeft = /#\+\js\(([^,]*)$/.exec(line.slice(0, beg));
|
|
566
|
+
const matchRight = /^([^,)]*)/.exec(line.slice(beg));
|
|
567
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
568
|
+
const hints = [];
|
|
569
|
+
for ( const [ text, displayText ] of scriptletNames ) {
|
|
570
|
+
const hint = { text };
|
|
571
|
+
if ( displayText !== '' ) {
|
|
572
|
+
hint.displayText = displayText;
|
|
573
|
+
}
|
|
574
|
+
hints.push(hint);
|
|
575
|
+
}
|
|
576
|
+
return pickBestHints(cursor, matchLeft[1], matchRight[1], hints);
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
const getCommentHints = function(cursor, line) {
|
|
580
|
+
const beg = cursor.ch;
|
|
581
|
+
if ( line.startsWith('!#if ') ) {
|
|
582
|
+
const matchLeft = /^!#if !?(\w*)$/.exec(line.slice(0, beg));
|
|
583
|
+
const matchRight = /^\w*/.exec(line.slice(beg));
|
|
584
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
585
|
+
return pickBestHints(
|
|
586
|
+
cursor,
|
|
587
|
+
matchLeft[1],
|
|
588
|
+
matchRight[0],
|
|
589
|
+
preparseDirectiveHints
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
if ( line.startsWith('!#') && line !== '!#endif' ) {
|
|
593
|
+
const matchLeft = /^!#(\w*)$/.exec(line.slice(0, beg));
|
|
594
|
+
const matchRight = /^\w*/.exec(line.slice(beg));
|
|
595
|
+
if ( matchLeft === null || matchRight === null ) { return; }
|
|
596
|
+
const hints = [ 'if ', 'endif\n', 'include ' ];
|
|
597
|
+
return pickBestHints(cursor, matchLeft[1], matchRight[0], hints);
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
CodeMirror.registerHelper('hint', 'ubo-static-filtering', function(cm) {
|
|
602
|
+
const cursor = cm.getCursor();
|
|
603
|
+
const line = cm.getLine(cursor.line);
|
|
604
|
+
astParser.parse(line);
|
|
605
|
+
if ( astParser.isExtendedFilter() ) {
|
|
606
|
+
const anchorNode = astParser.getBranchFromType(sfp.NODE_TYPE_EXT_OPTIONS_ANCHOR);
|
|
607
|
+
if ( anchorNode === 0 ) { return; }
|
|
608
|
+
let hints;
|
|
609
|
+
if ( cursor.ch <= astParser.getNodeStringBeg(anchorNode) ) {
|
|
610
|
+
hints = getOriginHints(cursor, line);
|
|
611
|
+
} else if ( astParser.isScriptletFilter() ) {
|
|
612
|
+
hints = getExtScriptletHints(cursor, line);
|
|
613
|
+
} else if ( astParser.isResponseheaderFilter() ) {
|
|
614
|
+
hints = getExtHeaderHints(cursor, line);
|
|
615
|
+
} else {
|
|
616
|
+
hints = getExtSelectorHints(cursor, line);
|
|
617
|
+
}
|
|
618
|
+
return hints;
|
|
619
|
+
}
|
|
620
|
+
if ( astParser.isNetworkFilter() ) {
|
|
621
|
+
return getNetHints(cursor, line);
|
|
622
|
+
}
|
|
623
|
+
if ( astParser.isComment() ) {
|
|
624
|
+
return getCommentHints(cursor, line);
|
|
625
|
+
}
|
|
626
|
+
return getOriginHints(cursor, line);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/******************************************************************************/
|
|
631
|
+
|
|
632
|
+
CodeMirror.registerHelper('fold', 'ubo-static-filtering', (( ) => {
|
|
633
|
+
const foldIfEndif = function(startLineNo, startLine, cm) {
|
|
634
|
+
const lastLineNo = cm.lastLine();
|
|
635
|
+
let endLineNo = startLineNo;
|
|
636
|
+
let depth = 1;
|
|
637
|
+
while ( endLineNo < lastLineNo ) {
|
|
638
|
+
endLineNo += 1;
|
|
639
|
+
const line = cm.getLine(endLineNo);
|
|
640
|
+
if ( line.startsWith('!#endif') ) {
|
|
641
|
+
depth -= 1;
|
|
642
|
+
if ( depth === 0 ) {
|
|
643
|
+
return {
|
|
644
|
+
from: CodeMirror.Pos(startLineNo, startLine.length),
|
|
645
|
+
to: CodeMirror.Pos(endLineNo, 0)
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if ( line.startsWith('!#if') ) {
|
|
650
|
+
depth += 1;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
const foldInclude = function(startLineNo, startLine, cm) {
|
|
656
|
+
const lastLineNo = cm.lastLine();
|
|
657
|
+
let endLineNo = startLineNo + 1;
|
|
658
|
+
if ( endLineNo >= lastLineNo ) { return; }
|
|
659
|
+
if ( cm.getLine(endLineNo).startsWith('! >>>>>>>> ') === false ) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
while ( endLineNo < lastLineNo ) {
|
|
663
|
+
endLineNo += 1;
|
|
664
|
+
const line = cm.getLine(endLineNo);
|
|
665
|
+
if ( line.startsWith('! <<<<<<<< ') ) {
|
|
666
|
+
return {
|
|
667
|
+
from: CodeMirror.Pos(startLineNo, startLine.length),
|
|
668
|
+
to: CodeMirror.Pos(endLineNo, line.length)
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
return function(cm, start) {
|
|
675
|
+
const startLineNo = start.line;
|
|
676
|
+
const startLine = cm.getLine(startLineNo);
|
|
677
|
+
if ( startLine.startsWith('!#if') ) {
|
|
678
|
+
return foldIfEndif(startLineNo, startLine, cm);
|
|
679
|
+
}
|
|
680
|
+
if ( startLine.startsWith('!#include ') ) {
|
|
681
|
+
return foldInclude(startLineNo, startLine, cm);
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
})());
|
|
685
|
+
|
|
686
|
+
/******************************************************************************/
|
|
687
|
+
|
|
688
|
+
// Linter
|
|
689
|
+
|
|
690
|
+
{
|
|
691
|
+
const astParser = new sfp.AstFilterParser({
|
|
692
|
+
interactive: true,
|
|
693
|
+
nativeCssHas: vAPI.webextFlavor.env.includes('native_css_has'),
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
const changeset = [];
|
|
697
|
+
let changesetTimer;
|
|
698
|
+
|
|
699
|
+
const includeset = new Set();
|
|
700
|
+
let errorCount = 0;
|
|
701
|
+
|
|
702
|
+
const extractMarkerDetails = (doc, lineHandle) => {
|
|
703
|
+
if ( astParser.isUnsupported() ) {
|
|
704
|
+
return { value: 'error', msg: 'Unsupported filter syntax' };
|
|
705
|
+
}
|
|
706
|
+
if ( astParser.hasError() ) {
|
|
707
|
+
let msg = 'Invalid filter';
|
|
708
|
+
switch ( astParser.astError ) {
|
|
709
|
+
case sfp.AST_ERROR_UNSUPPORTED:
|
|
710
|
+
msg = `${msg}: Unsupported filter syntax`;
|
|
711
|
+
break;
|
|
712
|
+
case sfp.AST_ERROR_REGEX:
|
|
713
|
+
msg = `${msg}: Bad regular expression`;
|
|
714
|
+
break;
|
|
715
|
+
case sfp.AST_ERROR_PATTERN:
|
|
716
|
+
msg = `${msg}: Bad pattern`;
|
|
717
|
+
break;
|
|
718
|
+
case sfp.AST_ERROR_DOMAIN_NAME:
|
|
719
|
+
msg = `${msg}: Bad domain name`;
|
|
720
|
+
break;
|
|
721
|
+
case sfp.AST_ERROR_OPTION_BADVALUE:
|
|
722
|
+
msg = `${msg}: Bad value assigned to a valid option`;
|
|
723
|
+
break;
|
|
724
|
+
case sfp.AST_ERROR_OPTION_DUPLICATE:
|
|
725
|
+
msg = `${msg}: Duplicate filter option`;
|
|
726
|
+
break;
|
|
727
|
+
case sfp.AST_ERROR_OPTION_UNKNOWN:
|
|
728
|
+
msg = `${msg}: Unsupported filter option`;
|
|
729
|
+
break;
|
|
730
|
+
case sfp.AST_ERROR_IF_TOKEN_UNKNOWN:
|
|
731
|
+
msg = `${msg}: Unknown preparsing token`;
|
|
732
|
+
break;
|
|
733
|
+
case sfp.AST_ERROR_UNTRUSTED_SOURCE:
|
|
734
|
+
msg = `${msg}: Filter requires trusted source`;
|
|
735
|
+
break;
|
|
736
|
+
default:
|
|
737
|
+
if ( astParser.isCosmeticFilter() && astParser.result.error ) {
|
|
738
|
+
msg = `${msg}: ${astParser.result.error}`;
|
|
739
|
+
}
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
return { value: 'error', msg };
|
|
743
|
+
}
|
|
744
|
+
if ( astParser.astType !== sfp.AST_TYPE_COMMENT ) { return; }
|
|
745
|
+
if ( astParser.astTypeFlavor !== sfp.AST_TYPE_COMMENT_PREPARSER ) {
|
|
746
|
+
if ( astParser.raw.startsWith('! <<<<<<<< ') === false ) { return; }
|
|
747
|
+
for ( const include of includeset ) {
|
|
748
|
+
if ( astParser.raw.endsWith(include) === false ) { continue; }
|
|
749
|
+
includeset.delete(include);
|
|
750
|
+
return { value: 'include-end' };
|
|
751
|
+
}
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
if ( /^\s*!#if \S+/.test(astParser.raw) ) {
|
|
755
|
+
return { value: 'if-start' };
|
|
756
|
+
}
|
|
757
|
+
if ( /^\s*!#endif\b/.test(astParser.raw) ) {
|
|
758
|
+
return { value: 'if-end' };
|
|
759
|
+
}
|
|
760
|
+
const match = /^\s*!#include\s*(\S+)/.exec(astParser.raw);
|
|
761
|
+
if ( match === null ) { return; }
|
|
762
|
+
const nextLineHandle = doc.getLineHandle(lineHandle.lineNo() + 1);
|
|
763
|
+
if ( nextLineHandle === undefined ) { return; }
|
|
764
|
+
if ( nextLineHandle.text.startsWith('! >>>>>>>> ') === false ) { return; }
|
|
765
|
+
const includeToken = `/${match[1]}`;
|
|
766
|
+
if ( nextLineHandle.text.endsWith(includeToken) === false ) { return; }
|
|
767
|
+
includeset.add(includeToken);
|
|
768
|
+
return { value: 'include-start' };
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
const extractMarker = lineHandle => {
|
|
772
|
+
const markers = lineHandle.gutterMarkers || null;
|
|
773
|
+
return markers !== null
|
|
774
|
+
? markers['CodeMirror-lintgutter'] || null
|
|
775
|
+
: null;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
const markerTemplates = {
|
|
779
|
+
'error': {
|
|
780
|
+
node: null,
|
|
781
|
+
html: [
|
|
782
|
+
'<div class="CodeMirror-lintmarker" data-lint="error"> ',
|
|
783
|
+
'<span class="msg"></span>',
|
|
784
|
+
'</div>',
|
|
785
|
+
],
|
|
786
|
+
},
|
|
787
|
+
'if-start': {
|
|
788
|
+
node: null,
|
|
789
|
+
html: [
|
|
790
|
+
'<div class="CodeMirror-lintmarker" data-lint="if" data-fold="start"> ',
|
|
791
|
+
'<svg viewBox="0 0 100 100">',
|
|
792
|
+
'<polygon points="0,0 100,0 50,100" />',
|
|
793
|
+
'</svg>',
|
|
794
|
+
'</div>',
|
|
795
|
+
],
|
|
796
|
+
},
|
|
797
|
+
'if-end': {
|
|
798
|
+
node: null,
|
|
799
|
+
html: [
|
|
800
|
+
'<div class="CodeMirror-lintmarker" data-lint="if" data-fold="end"> ',
|
|
801
|
+
'<svg viewBox="0 0 100 100">',
|
|
802
|
+
'<polygon points="50,0 100,100 0,100" />',
|
|
803
|
+
'</svg>',
|
|
804
|
+
'</div>',
|
|
805
|
+
],
|
|
806
|
+
},
|
|
807
|
+
'include-start': {
|
|
808
|
+
node: null,
|
|
809
|
+
html: [
|
|
810
|
+
'<div class="CodeMirror-lintmarker" data-lint="include" data-fold="start"> ',
|
|
811
|
+
'<svg viewBox="0 0 100 100">',
|
|
812
|
+
'<polygon points="0,0 100,0 50,100" />',
|
|
813
|
+
'</svg>',
|
|
814
|
+
'</div>',
|
|
815
|
+
],
|
|
816
|
+
},
|
|
817
|
+
'include-end': {
|
|
818
|
+
node: null,
|
|
819
|
+
html: [
|
|
820
|
+
'<div class="CodeMirror-lintmarker" data-lint="include" data-fold="end"> ',
|
|
821
|
+
'<svg viewBox="0 0 100 100">',
|
|
822
|
+
'<polygon points="50,0 100,100 0,100" />',
|
|
823
|
+
'</svg>',
|
|
824
|
+
'</div>',
|
|
825
|
+
],
|
|
826
|
+
},
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
const markerFromTemplate = which => {
|
|
830
|
+
const template = markerTemplates[which];
|
|
831
|
+
if ( template.node === null ) {
|
|
832
|
+
const domParser = new DOMParser();
|
|
833
|
+
const doc = domParser.parseFromString(template.html.join(''), 'text/html');
|
|
834
|
+
template.node = document.adoptNode(qs$(doc, '.CodeMirror-lintmarker'));
|
|
835
|
+
}
|
|
836
|
+
return template.node.cloneNode(true);
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
const addMarker = (doc, lineHandle, marker, details) => {
|
|
840
|
+
if ( marker !== null && marker.dataset.lint !== details.value ) {
|
|
841
|
+
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', null);
|
|
842
|
+
if ( marker.dataset.lint === 'error' ) {
|
|
843
|
+
errorCount -= 1;
|
|
844
|
+
}
|
|
845
|
+
marker = null;
|
|
846
|
+
}
|
|
847
|
+
if ( marker === null ) {
|
|
848
|
+
marker = markerFromTemplate(details.value);
|
|
849
|
+
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', marker);
|
|
850
|
+
if ( details.value === 'error' ) {
|
|
851
|
+
errorCount += 1;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
const msgElem = qs$(marker, '.msg');
|
|
855
|
+
if ( msgElem === null ) { return; }
|
|
856
|
+
msgElem.textContent = details.msg || '';
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
const removeMarker = (doc, lineHandle, marker) => {
|
|
860
|
+
doc.setGutterMarker(lineHandle, 'CodeMirror-lintgutter', null);
|
|
861
|
+
if ( marker.dataset.lint === 'error' ) {
|
|
862
|
+
errorCount -= 1;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
const processDeletion = (doc, change) => {
|
|
867
|
+
let { from, to } = change;
|
|
868
|
+
doc.eachLine(from.line, to.line, lineHandle => {
|
|
869
|
+
const marker = extractMarker(lineHandle);
|
|
870
|
+
if ( marker === null ) { return; }
|
|
871
|
+
if ( marker.dataset.lint === 'error' ) {
|
|
872
|
+
errorCount -= 1;
|
|
873
|
+
marker.dataset.lint = 'void';
|
|
874
|
+
}
|
|
875
|
+
});
|
|
876
|
+
};
|
|
877
|
+
|
|
878
|
+
const processInsertion = (doc, deadline, change) => {
|
|
879
|
+
let { from, to } = change;
|
|
880
|
+
doc.eachLine(from, to, lineHandle => {
|
|
881
|
+
astParser.parse(lineHandle.text);
|
|
882
|
+
const markerDetails = extractMarkerDetails(doc, lineHandle);
|
|
883
|
+
const marker = extractMarker(lineHandle);
|
|
884
|
+
if ( markerDetails === undefined && marker !== null ) {
|
|
885
|
+
removeMarker(doc, lineHandle, marker);
|
|
886
|
+
} else if ( markerDetails !== undefined ) {
|
|
887
|
+
addMarker(doc, lineHandle, marker, markerDetails);
|
|
888
|
+
}
|
|
889
|
+
from += 1;
|
|
890
|
+
if ( (from & 0x0F) !== 0 ) { return; }
|
|
891
|
+
if ( deadline.timeRemaining() !== 0 ) { return; }
|
|
892
|
+
return true;
|
|
893
|
+
});
|
|
894
|
+
if ( from !== to ) {
|
|
895
|
+
return { from, to };
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
const processChangeset = (doc, deadline) => {
|
|
900
|
+
const cm = doc.getEditor();
|
|
901
|
+
cm.startOperation();
|
|
902
|
+
while ( changeset.length !== 0 ) {
|
|
903
|
+
const change = processInsertion(doc, deadline, changeset.shift());
|
|
904
|
+
if ( change === undefined ) { continue; }
|
|
905
|
+
changeset.unshift(change);
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
cm.endOperation();
|
|
909
|
+
if ( changeset.length !== 0 ) {
|
|
910
|
+
return processChangesetAsync(doc);
|
|
911
|
+
}
|
|
912
|
+
includeset.clear();
|
|
913
|
+
CodeMirror.signal(doc.getEditor(), 'linterDone', { errorCount });
|
|
914
|
+
};
|
|
915
|
+
|
|
916
|
+
const processChangesetAsync = doc => {
|
|
917
|
+
if ( changesetTimer !== undefined ) { return; }
|
|
918
|
+
changesetTimer = self.requestIdleCallback(deadline => {
|
|
919
|
+
changesetTimer = undefined;
|
|
920
|
+
processChangeset(doc, deadline);
|
|
921
|
+
});
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
const onChanges = (cm, changes) => {
|
|
925
|
+
const doc = cm.getDoc();
|
|
926
|
+
for ( const change of changes ) {
|
|
927
|
+
const from = change.from.line;
|
|
928
|
+
const to = from + change.text.length;
|
|
929
|
+
changeset.push({ from, to });
|
|
930
|
+
processChangesetAsync(doc);
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
const onBeforeChanges = (cm, change) => {
|
|
935
|
+
const doc = cm.getDoc();
|
|
936
|
+
processDeletion(doc, change);
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
const foldRangeFinder = (cm, from) => {
|
|
940
|
+
const lineNo = from.line;
|
|
941
|
+
const lineHandle = cm.getDoc().getLineHandle(lineNo);
|
|
942
|
+
const marker = extractMarker(lineHandle);
|
|
943
|
+
if ( marker === null ) { return; }
|
|
944
|
+
if ( marker.dataset.fold === undefined ) { return; }
|
|
945
|
+
const foldName = marker.dataset.lint;
|
|
946
|
+
from.ch = lineHandle.text.length;
|
|
947
|
+
const to = { line: 0, ch: 0 };
|
|
948
|
+
const doc = cm.getDoc();
|
|
949
|
+
let depth = 0;
|
|
950
|
+
doc.eachLine(from.line, doc.lineCount(), lineHandle => {
|
|
951
|
+
const marker = extractMarker(lineHandle);
|
|
952
|
+
if ( marker === null ) { return; }
|
|
953
|
+
if ( marker.dataset.lint === foldName && marker.dataset.fold === 'start' ) {
|
|
954
|
+
depth += 1;
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
if ( marker.dataset.lint !== foldName ) { return; }
|
|
958
|
+
if ( marker.dataset.fold !== 'end' ) { return; }
|
|
959
|
+
depth -= 1;
|
|
960
|
+
if ( depth !== 0 ) { return; }
|
|
961
|
+
to.line = lineHandle.lineNo();
|
|
962
|
+
return true;
|
|
963
|
+
});
|
|
964
|
+
return { from, to };
|
|
965
|
+
};
|
|
966
|
+
|
|
967
|
+
const onGutterClick = (cm, lineNo, gutterId, ev) => {
|
|
968
|
+
if ( ev.button !== 0 ) { return; }
|
|
969
|
+
if ( gutterId !== 'CodeMirror-lintgutter' ) { return; }
|
|
970
|
+
const doc = cm.getDoc();
|
|
971
|
+
const lineHandle = doc.getLineHandle(lineNo);
|
|
972
|
+
const marker = extractMarker(lineHandle);
|
|
973
|
+
if ( marker === null ) { return; }
|
|
974
|
+
if ( marker.dataset.fold === 'start' ) {
|
|
975
|
+
if ( ev.ctrlKey ) {
|
|
976
|
+
if ( dom.cl.has(marker, 'folded') ) {
|
|
977
|
+
CodeMirror.commands.unfoldAll(cm);
|
|
978
|
+
} else {
|
|
979
|
+
CodeMirror.commands.foldAll(cm);
|
|
980
|
+
}
|
|
981
|
+
doc.setCursor(lineNo);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
cm.foldCode(lineNo, {
|
|
985
|
+
widget: '\u00A0\u22EF\u00A0',
|
|
986
|
+
rangeFinder: foldRangeFinder,
|
|
987
|
+
});
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
if ( marker.dataset.fold === 'end' ) {
|
|
991
|
+
let depth = 1;
|
|
992
|
+
let lineNo = lineHandle.lineNo();
|
|
993
|
+
while ( lineNo-- ) {
|
|
994
|
+
const prevLineHandle = doc.getLineHandle(lineNo);
|
|
995
|
+
const markerFrom = extractMarker(prevLineHandle);
|
|
996
|
+
if ( markerFrom === null ) { continue; }
|
|
997
|
+
if ( markerFrom.dataset.fold === 'end' ) {
|
|
998
|
+
depth += 1;
|
|
999
|
+
} else if ( markerFrom.dataset.fold === 'start' ) {
|
|
1000
|
+
depth -= 1;
|
|
1001
|
+
if ( depth === 0 ) {
|
|
1002
|
+
doc.setCursor(lineNo);
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
self.addEventListener('trustedSource', ev => {
|
|
1012
|
+
astParser.options.trustedSource = ev.detail;
|
|
1013
|
+
});
|
|
1014
|
+
|
|
1015
|
+
self.addEventListener('trustedScriptletTokens', ev => {
|
|
1016
|
+
astParser.options.trustedScriptletTokens = ev.detail;
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
CodeMirror.defineInitHook(cm => {
|
|
1020
|
+
cm.on('changes', onChanges);
|
|
1021
|
+
cm.on('beforeChange', onBeforeChanges);
|
|
1022
|
+
cm.on('gutterClick', onGutterClick);
|
|
1023
|
+
cm.on('fold', function(cm, from) {
|
|
1024
|
+
const doc = cm.getDoc();
|
|
1025
|
+
const lineHandle = doc.getLineHandle(from.line);
|
|
1026
|
+
const marker = extractMarker(lineHandle);
|
|
1027
|
+
dom.cl.add(marker, 'folded');
|
|
1028
|
+
});
|
|
1029
|
+
cm.on('unfold', function(cm, from) {
|
|
1030
|
+
const doc = cm.getDoc();
|
|
1031
|
+
const lineHandle = doc.getLineHandle(from.line);
|
|
1032
|
+
const marker = extractMarker(lineHandle);
|
|
1033
|
+
dom.cl.remove(marker, 'folded');
|
|
1034
|
+
});
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/******************************************************************************/
|
|
1039
|
+
|
|
1040
|
+
// Enhanced word selection
|
|
1041
|
+
|
|
1042
|
+
{
|
|
1043
|
+
const selectWordAt = function(cm, pos) {
|
|
1044
|
+
const { line, ch } = pos;
|
|
1045
|
+
const s = cm.getLine(line);
|
|
1046
|
+
const { type: token } = cm.getTokenAt(pos);
|
|
1047
|
+
let beg, end;
|
|
1048
|
+
|
|
1049
|
+
// Select URL in comments
|
|
1050
|
+
if ( /\bcomment\b/.test(token) && /\blink\b/.test(token) ) {
|
|
1051
|
+
const l = /\S+$/.exec(s.slice(0, ch));
|
|
1052
|
+
if ( l && /^https?:\/\//.test(s.slice(l.index)) ) {
|
|
1053
|
+
const r = /^\S+/.exec(s.slice(ch));
|
|
1054
|
+
if ( r ) {
|
|
1055
|
+
beg = l.index;
|
|
1056
|
+
end = ch + r[0].length;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
// Better word selection for extended filters: prefix
|
|
1062
|
+
else if (
|
|
1063
|
+
/\bline-cm-ext-(?:dom|html|js)\b/.test(token) &&
|
|
1064
|
+
/\bvalue\b/.test(token)
|
|
1065
|
+
) {
|
|
1066
|
+
const l = /[^,.]*$/i.exec(s.slice(0, ch));
|
|
1067
|
+
const r = /^[^#,]*/i.exec(s.slice(ch));
|
|
1068
|
+
if ( l && r ) {
|
|
1069
|
+
beg = l.index;
|
|
1070
|
+
end = ch + r[0].length;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// Better word selection for cosmetic and HTML filters: suffix
|
|
1075
|
+
else if ( /\bline-cm-ext-(?:dom|html)\b/.test(token) ) {
|
|
1076
|
+
const l = /[#.]?[a-z0-9_-]+$/i.exec(s.slice(0, ch));
|
|
1077
|
+
const r = /^[a-z0-9_-]+/i.exec(s.slice(ch));
|
|
1078
|
+
if ( l && r ) {
|
|
1079
|
+
beg = l.index;
|
|
1080
|
+
end = ch + r[0].length;
|
|
1081
|
+
if ( /\bdef\b/.test(cm.getTokenTypeAt({ line, ch: beg + 1 })) ) {
|
|
1082
|
+
beg += 1;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// Better word selection for network filters
|
|
1088
|
+
else if ( /\bline-cm-net\b/.test(token) ) {
|
|
1089
|
+
if ( /\bvalue\b/.test(token) ) {
|
|
1090
|
+
const l = /[^ ,.=|]*$/i.exec(s.slice(0, ch));
|
|
1091
|
+
const r = /^[^ #,|]*/i.exec(s.slice(ch));
|
|
1092
|
+
if ( l && r ) {
|
|
1093
|
+
beg = l.index;
|
|
1094
|
+
end = ch + r[0].length;
|
|
1095
|
+
}
|
|
1096
|
+
} else if ( /\bdef\b/.test(token) ) {
|
|
1097
|
+
const l = /[a-z0-9-]+$/i.exec(s.slice(0, ch));
|
|
1098
|
+
const r = /^[^,]*=[^,]+/i.exec(s.slice(ch));
|
|
1099
|
+
if ( l && r ) {
|
|
1100
|
+
beg = l.index;
|
|
1101
|
+
end = ch + r[0].length;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
if ( beg === undefined ) {
|
|
1107
|
+
const { anchor, head } = cm.findWordAt(pos);
|
|
1108
|
+
return { from: anchor, to: head };
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
return {
|
|
1112
|
+
from: { line, ch: beg },
|
|
1113
|
+
to: { line, ch: end },
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
|
|
1117
|
+
CodeMirror.defineInitHook(cm => {
|
|
1118
|
+
cm.setOption('configureMouse', function(cm, repeat) {
|
|
1119
|
+
return {
|
|
1120
|
+
unit: repeat === 'double' ? selectWordAt : null,
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/******************************************************************************/
|