1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-26 18:10:39 +12:00
Commit graph

699 commits

Author SHA1 Message Date
Raymond Hill 09123d6971 use "platform" as suggested in #360 2015-04-10 19:39:22 -04:00
Raymond Hill d6d7f9347a use "platform" as suggested in #360 2015-04-10 19:39:20 -04:00
Raymond Hill 5bc14936d5 jshint 2015-04-10 19:39:20 -04:00
Raymond Hill e260b19702 restore original semantic 2015-04-10 19:39:20 -04:00
Raymond Hill 5cd1285ee5 further separate platform-specific code 2015-04-10 19:39:20 -04:00
Deathamns e54c09da8a Ports cleanup
- Remove duplicate platform specific (from src/) and other unnecessary
  files
- Fix and update vapi-*.js files for Safari
- Add tools/make-safari.sh
- Move js/vapi-appinfo.js to meta/ (so, every vendor specific file will be
  at the same location)
2015-04-10 19:39:18 -04:00
Deathamns e6e3868080 Building extension files
Adds possibility to build extension files (Chrome and Safari) from
command line.

To run from the project directory:
python tools/build.py [meta]

If the optional `meta` argument is set, then only the manifest and
language files are uptated.
Without that everything is being built (extension files too) into the
`dist/build/version_number` folder.

For Chrome there will be two files, a crx, and a .zip file which
includes the key.pem private key (so this must not be shared,
it's just a bit help for publishing it to the Chrome Web Store).

Beside the extension files, update-files are generated too (for self
hosting - Safari needs it).
2015-04-10 19:39:18 -04:00
Deathamns 9f23b45651 Site-patching possibility for Safari
Safari's extension API doesn't provide a way to intercept requests
initiated by plugins, so those cases need special care (or at least the
popular sites).

This commit adds a new JS file (sitepatch-safari.js), which will store the
patches (if it's possible to create one) for specific sites.

As an example, this commit includes a technique for removing in-video ads
from YouTube videos.
2015-04-10 19:39:18 -04:00
Deathamns 686403af38 Avoid using Chrome's @@bidi_* type i18n messages
... for the sake of portability.

When including vapi-common.js in an HTML file, then the body element there
will have a "dir" attribute filled with the current locale's direction
(ltr or rtl).

The following languages are considered right-to-left: ar, he, fa, ps, ur.
Everything else is left-to-right.

After the "dir" attribute is set, we can decide in CSS which elements
should have different styling for rtl languages (e.g., body[dir=rtl] #id).
2015-04-10 19:39:18 -04:00
Deathamns 358ec2c644 Fix download URL for the fallback method 2015-04-10 19:39:18 -04:00
Deathamns da0e62dff6 Use HTML5 download instead of extension API
Benefits:
- Cross browser solution (however only for relatively new browsers)
- Doesn't need extra permission in Chrome

If the browser doesn't suppor the download attribute, then a new tab will
be opened with the exported data.

Other changes:
- Start the download only if the data is not empty (previously the
  download started anyway)
- Reorder code in vapi-client.js for Safari, so unnecessary code doesn't
  run on extension pages
2015-04-10 19:39:18 -04:00
Deathamns 25caa9241c Set default dimensions for Safari's popup 2015-04-10 19:39:18 -04:00
Deathamns 2216b7f32e Implement popup autoresizing for Safari
By default, Safari doesn't resize the popup to its content, but it's
possible to set the size pragmatically.
The popup will be resized every time when a change happens in the DOM tree.
2015-04-10 19:39:18 -04:00
Deathamns db83931fb7 Add .jshintrc, and use the "use strict" directive
.jshintrc's otion-set is a personal choice, merely a suggestion.
Beside that, it includes some common globals for specific browsers, so
there's no need to set the globals in every .js file.

In order to force strict coding, "use strict" directive was added into
every .js file.
2015-04-10 19:39:18 -04:00
Deathamns cd08ad9782 Work on vendor API abstraction, and near complete Safari support 2015-04-10 19:39:18 -04:00
gorhill 9bb22b65ec forgot to add shutdown to other platforms (re. https://github.com/gorhill/uMatrix/issues/144) 2015-04-10 19:37:30 -04:00
gorhill dd60a74e3f code review 2015-04-10 19:37:30 -04:00
gorhill 987acfef65 this fixes https://github.com/gorhill/uMatrix/issues/144 2015-04-10 19:37:30 -04:00
YFdyh000 5ff7909497 Correct issue links 2015-04-10 19:37:30 -04:00
gorhill 170f164288 had a doubt, had to check it worked as intended 2015-04-10 19:37:30 -04:00
Deathamns 4599486290 vAPI.sessionId, element-picker dialog as iframe
vAPI.sessionId - random ID generated every time when a page loads.

Having the dialog in an iframe lowers the chance of interference with the
styling of the page, also avoids using innerHTML (AMO complaint).
2015-04-10 19:37:30 -04:00
Chris db772dea22 Remove previous Safari overhead; cleanup workarounds from rest of code 2015-04-10 19:37:30 -04:00
gorhill 894921e23f not needed 2015-04-10 19:37:30 -04:00
Deathamns bd0b1638db URL handling changes 2015-04-10 19:37:30 -04:00
gorhill 9172fcd049 this fixes one part of #498 2015-04-10 19:37:30 -04:00
Deathamns 3d40e0b2aa Code styling 2015-04-10 19:37:30 -04:00
Deathamns 5ec2e067df Add license headers, plus some code styling 2015-04-10 19:37:30 -04:00
Deathamns ba47f39c47 Firefox: implement vAPI.tabs.injectScript 2015-04-10 19:37:30 -04:00
Deathamns 9c00fbfb3b Firefox: implement toolbar button and popup 2015-04-10 19:37:30 -04:00
gorhill 06398e8065 code review for #456 2015-04-10 19:37:30 -04:00
gorhill a036152cc7 this fixes #456: another unrelated bug unveil from previous fix 2015-04-10 19:37:30 -04:00
Raymond Hill 3d61e80d1c jshint 2015-04-10 19:37:30 -04:00
Raymond Hill 61fb46a87f use "platform" as suggested in #360 2015-04-10 19:37:30 -04:00
Raymond Hill b626b71b90 use "platform" as suggested in #360 2015-04-10 19:37:28 -04:00
Raymond Hill 247f85c9e2 jshint 2015-04-10 19:37:28 -04:00
Raymond Hill 0feefd6659 further separate platform-specific code 2015-04-10 19:37:28 -04:00
Deathamns 33e6728468 Ports cleanup
- Remove duplicate platform specific (from src/) and other unnecessary
  files
- Fix and update vapi-*.js files for Safari
- Add tools/make-safari.sh
- Move js/vapi-appinfo.js to meta/ (so, every vendor specific file will be
  at the same location)
2015-04-10 19:37:25 -04:00
Deathamns 03af075a64 Move MutationObserver shim
Since it will be used only for older Safari versions, move it to Safari
related code, so it doesn't pollute the content scripts.
2015-04-10 19:37:25 -04:00
Deathamns ef30ab4c2d Respect defer attribute when mirroring 2015-04-10 19:37:25 -04:00
Deathamns abb13424b4 Call XHR.open even if the request will be blocked
Without calling it an error may be thrown if other XHR parameters are set.
2015-04-10 19:37:25 -04:00
Deathamns d9c9627758 Only top window should have type main_frame 2015-04-10 19:37:25 -04:00
Deathamns 8f0172467a Remove unnecessary messaging workaround
A better fix was introduced in e36c702 for this issue.

The actual problem was that Safari when sends a message from the
background to content, then it passes to all the frames in the target tab,
but it doesn't make copies, it passes only references to the same object,
so if one frame modifies the message, then other frames would have
received the modified message.
2015-04-10 19:37:25 -04:00
Deathamns aebfb15aa2 Building extension files
Adds possibility to build extension files (Chrome and Safari) from
command line.

To run from the project directory:
python tools/build.py [meta]

If the optional `meta` argument is set, then only the manifest and
language files are uptated.
Without that everything is being built (extension files too) into the
`dist/build/version_number` folder.

For Chrome there will be two files, a crx, and a .zip file which
includes the key.pem private key (so this must not be shared,
it's just a bit help for publishing it to the Chrome Web Store).

Beside the extension files, update-files are generated too (for self
hosting - Safari needs it).
2015-04-10 19:37:25 -04:00
Deathamns a39572448d Fix messaging for Safari 2015-04-10 19:37:25 -04:00
Deathamns 08247fb5dd Preferences button for Safari
Brings back the possibility to click a checkbox which opens the extension
settings from Safari's Preferences/Extensions.
2015-04-10 19:37:25 -04:00
Deathamns 1a38523875 Messaging fixes
Checking the message name (and connectorId) is mandatory for Safari,
because when the background page sends a response back to a document,
then all the frames in its owner tab will receive the exact same
message, which could confuse the script in some cases.
2015-04-10 19:37:25 -04:00
Deathamns 0bc67a8819 Drop js-loader, updates from gorhill/uBlock/master 2015-04-10 19:37:25 -04:00
Deathamns d150eb6d1c Use different page navigation detection for Safari
The beforeNavigate event wasn't reliable (sometimes didn't fire, sometimes
fired unnecessary when opening a link with the middle click - which had a
workaround previously, but that's also removed by this commit).

When the event didn't fire, the bindTabToPageStats method didn't run,
and the requests related to the tab weren't blocked.
2015-04-10 19:37:25 -04:00
Deathamns ed1e23cfb1 Site-patching possibility for Safari
Safari's extension API doesn't provide a way to intercept requests
initiated by plugins, so those cases need special care (or at least the
popular sites).

This commit adds a new JS file (sitepatch-safari.js), which will store the
patches (if it's possible to create one) for specific sites.

As an example, this commit includes a technique for removing in-video ads
from YouTube videos.
2015-04-10 19:37:25 -04:00
Deathamns 192053ae99 document.head isn't always available in Safari 2015-04-10 19:37:25 -04:00