1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-05 18:32:30 +01:00
Commit Graph

3939 Commits

Author SHA1 Message Date
Raymond Hill
0501c0712a this fixes #399 2014-12-06 15:00:31 -02:00
Raymond Hill
251a11cdfe translation work from Crowdin 2014-12-06 10:04:42 -02:00
Raymond Hill
c123dba6f2 fine tuning visual of tooltip in popup 2014-12-05 12:53:59 -02:00
Raymond Hill
d0e34faac5 translation work from Crowdin 2014-12-04 12:56:21 -02:00
Raymond Hill
cf8f5c26e5 this fixes #396 2014-12-04 11:33:44 -02:00
Raymond Hill
db98614378 translation work from Crowdin 2014-12-03 10:56:32 -02:00
Raymond Hill
0e12797709 extension restart is platform-dependent 2014-12-02 14:02:17 -02:00
Raymond Hill
1a2eef4fa7 this fixes #393 2014-12-02 11:28:49 -02:00
Raymond Hill
e876a82154 translation work from Crowdin 2014-12-02 11:28:13 -02:00
Raymond Hill
1bc7c766b8 translation work from Crowdin 2014-12-01 20:14:53 -02:00
Deathamns
2a26448734 Safari: slightly better pop-up blocking 2014-12-01 21:09:25 +01:00
Raymond Hill
98464a56fe translation work from Crowdin 2014-12-01 14:31:56 -02:00
Raymond Hill
2e4c0a2bfe remove depending on vapi-appinfo.js 2014-12-01 14:25:33 -02:00
Raymond Hill
03fe8e2f1b synchronize with crowdin 2014-12-01 11:34:55 -02:00
Raymond Hill
d65c8d7d2b translation work from crowdin 2014-12-01 10:37:26 -02:00
Raymond Hill
f6120299af this fixes #387 2014-11-30 19:42:49 -02:00
Raymond Hill
617440dd27 "allowed" instead of "enabled", "blocked" instead of "disabled" 2014-11-30 09:44:54 -02:00
Raymond Hill
9445c6d11d this fixes #309 2014-11-30 00:38:55 -02:00
Raymond Hill
0bf088cd1e this fixes #386, #346, #299, #288, #285, #284, #279 2014-11-29 23:36:53 -02:00
Raymond Hill
be082cb666 this fixes #384; more reading required for a long-term solution--if any 2014-11-29 18:26:01 -02:00
Raymond Hill
52e8cb5338 file picker is gone: generate a unique filename each time 2014-11-29 16:04:34 -02:00
Raymond Hill
c6227289a6 code review 2014-11-27 09:41:28 -02:00
Raymond Hill
fb66fd4f36 translation work from Crowdin 2014-11-26 17:34:48 -02:00
Raymond Hill
f141d6f769 fixed overzealous cosmetic filter bug introduced in #365 2014-11-26 17:26:33 -02:00
Raymond Hill
7e55dc898e code review 2014-11-26 16:32:10 -02:00
Raymond Hill
27eeea3618 no longer needed 2014-11-26 16:25:14 -02:00
Raymond Hill
fb1221a8a1 remove overhead of PSL for "3rd-party filters" tab 2014-11-26 15:45:36 -02:00
Raymond Hill
f149b2e340 jshint 2014-11-24 20:20:21 -02:00
Raymond Hill
11a6fc5a22 translation work from Crowdin 2014-11-24 12:52:12 -02:00
Raymond Hill
369b038f92 jshint 2014-11-24 12:48:33 -02:00
Raymond Hill
1ba3142fdf this fixes #375 2014-11-24 11:56:45 -02:00
Raymond Hill
dc16a5c673 this fixes #379 2014-11-24 11:28:36 -02:00
Deathamns
219eddab74 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)
2014-11-23 18:21:06 +01:00
Raymond Hill
281dc7038e this fixes #362 2014-11-21 10:05:59 -02:00
Raymond Hill
d4402dfe02 assets has to be in project root, because existing installations 2014-11-18 08:42:00 -02:00
Lex Rivera
cc1811b1b6 Be more precise about yandex.st caching 2014-11-17 16:28:11 +03:00
Lex Rivera
5936d88346 add yandex to mirror candidates 2014-11-17 15:57:46 +03:00
Alex Silva
f89ac7cf48 Update from crowdin 2014-11-17 01:04:59 -02:00
Raymond Hill
0d920e4e44 code review 2014-11-16 22:40:34 -02:00
Raymond Hill
81a0052f39 remove code failing at trying to be smart re. obsolete filter lists 2014-11-16 21:27:48 -02:00
Paddy Xu
19d1297380 Add new URL for AdBlock Japanese filter 2014-11-16 22:44:17 +01:00
Raymond Hill
c4838581fd this fixes #365 2014-11-16 17:06:29 -02:00
Raymond Hill
91276bebfb eliminate overhead of creating two funcs/closure for each port connection 2014-11-16 12:49:55 -02:00
Raymond Hill
338bf59507 give specific message handlers priority over default one 2014-11-16 11:09:28 -02:00
Raymond Hill
84c069dfaa continued: corralling platform-specific stuff into their meta folder 2014-11-16 00:21:13 -02:00
Raymond Hill
eafc96859c further separate platform-specific code 2014-11-15 16:15:11 -02:00
Deathamns
8f0b3cf592 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.
2014-11-12 10:22:57 +01:00
Deathamns
36ad23a1db Respect defer attribute when mirroring 2014-11-11 16:33:50 +01:00
Deathamns
812da0900e Call XHR.open even if the request will be blocked
Without calling it an error may be thrown if other XHR parameters are set.
2014-11-11 16:32:17 +01:00
Deathamns
8edb628e1e Only top window should have type main_frame 2014-11-11 13:33:55 +01:00
Deathamns
2024ba1bcd Fix wrong fix in 4bf6664 2014-11-10 19:25:17 +01:00
Deathamns
fb0cacb44d 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.
2014-11-10 08:11:49 +01:00
Deathamns
0d9d285608 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).
2014-11-09 18:58:46 +01:00
Deathamns
4bf6664d6b Fix double definition of length property in uDom
The `length` property of `DOMList` couldn't be re-defined, because earlier
an Object.defineProperty was used on the object without a setter.
2014-11-09 17:41:09 +01:00
Deathamns
30ef97a678 Fix messaging for Safari 2014-11-09 17:41:07 +01:00
Deathamns
6f2e449e61 Preferences button for Safari
Brings back the possibility to click a checkbox which opens the extension
settings from Safari's Preferences/Extensions.
2014-11-09 17:41:05 +01:00
Deathamns
e36c7022cf 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.
2014-11-09 17:41:04 +01:00
Deathamns
d98a8161f9 Drop js-loader, updates from gorhill/uBlock/master 2014-11-09 17:41:02 +01:00
Deathamns
ba0b11aabe 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.
2014-11-09 17:41:00 +01:00
Deathamns
d114bf21e7 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.
2014-11-09 17:40:59 +01:00
Deathamns
e6e3f676e2 Fix toolbar icons for Safari 2014-11-09 17:40:57 +01:00
Deathamns
7f57684e2b document.head isn't always available in Safari 2014-11-09 17:40:56 +01:00
Deathamns
bccf3d68e2 Add dummy MutationObserver shim for older browsers 2014-11-09 17:40:54 +01:00
Deathamns
64c37ccd1d Badge number sometimes disappeared in Safari 2014-11-09 17:40:52 +01:00
Deathamns
56be0b6025 Remove unwanted bottom padding from Chrome's popup 2014-11-09 17:40:49 +01:00
Deathamns
99d8f431d5 input[type="file"].click() didn't work in Safari
Click couldn't be initiated with JavaScript in Safari if the input was
hidden with display: none. Using visibility: hidden or opacity: 0 solves
the problem.

Alternative solution would be to hide (opacity: 0) the input and slide it
(position: absolute; top: 0; left: 0; width: 100%; height: 100%) over the
button, which would work in all browsers, and wouldn't require JavaScript.
2014-11-09 17:40:48 +01:00
Deathamns
f6f85ec793 Implement pop-up blocking for Safari
It works similarly to the xhr intercepting, except here the window.open
global function is being overridden.
Note that it could only work if the site's Content Security Policy allows
inline scripts, and the script on the webpage doesn't have a copy of the
original window.open function (it can happen only if the page has an
inline script in its head element, where the reference to the original
function can be obtained - likely this cannot be prevented in Safari).
2014-11-09 17:40:44 +01:00
Deathamns
ac272afb4b "Purge all caches" button seemingly didn't work 2014-11-09 17:40:43 +01:00
Deathamns
cc27193147 Element picker tweaks
- Indentation whitespace fixes.
- Use built-in getBoundingClientRect() function instead of self-made.
- Use built-in DOM API for manipulating the class attributes instead of
  altering the className property.
- Add pointer-events: none to the svgRoot when using
  document.elementFromPoint(), but if the browser (older Safari for
  example) doesn't take the pointer-events into account, then fall back to
  display: none.
- Initiate every part of the picker at the same time; when the message is
  received from the background. This way the selected element will have
  the red overlay immediately, instead of showing first the black overlay,
  then a few milliseconds later the red.
2014-11-09 17:40:41 +01:00
Deathamns
6d49ef0dac 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).
2014-11-09 17:40:40 +01:00
Deathamns
86222cb368 Use utf-8 for data: URIs when downloading 2014-11-09 17:39:43 +01:00
Deathamns
5e587aa42f Workaround for a messaging bug in Safari 2014-11-09 17:39:42 +01:00
Deathamns
5e99ead9ff Fix download URL for the fallback method 2014-11-09 17:39:40 +01:00
Deathamns
749b6f186d Use a dedicated file for storing extension info
Chrome has getManifest(), Safari doesn't have anything, Firefox has an
asynchronous API...
So, instead of using extension APIs, store the common informations
(extension name, version, homepage url) in a file (vapi-appinfo.js), which
can be included when it's needed (its data will be available at vAPI.app.____).
The file's content is updated each time the extension is being built, so
it shouldn't be modified manually.
2014-11-09 17:39:38 +01:00
Deathamns
fbffc5b07e 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
2014-11-09 17:39:36 +01:00
Deathamns
2e787d8541 Set default dimensions for Safari's popup 2014-11-09 17:39:35 +01:00
Deathamns
ab12c8d7d9 Remove unnecessary comments 2014-11-09 17:39:33 +01:00
Deathamns
7dba1f7e22 Use extension API to open links from the popup
Safari doesn't seem to follow links embedded in the popup window (not even
with target="_blank").
2014-11-09 17:39:31 +01:00
Deathamns
d38ca13107 Script injection, element picker, messaging
- Add script injection to vAPI, plus a raw implementation for Safari
  (element-picker.js requires it)
- Tweak element picker to work with Safari
- Revert a change from previous commit: element-picker.js' background
  message handler (since actually it can have its own messaging channel)
- Don't send "undefined" reponses from background to content
2014-11-09 17:39:30 +01:00
Deathamns
88a7910bcb element-picker fixes, changes
- Include latest changes from gorhill/uBlock/master
- Append the pickerRoot container to document.documentElement instead
  of document.body ("body > div" type CSS selectors are more common, so
  they could overwrite the extension's styling with higher probability)
- Request localized strings from the background script instead of using
  the i18n API in content scripts
- Fuse element-picker.js' message handling into contentscript-end.js', since
  only one messaging channel can live at a time in a content script
2014-11-09 17:39:28 +01:00
Deathamns
f9602fa5a7 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.
2014-11-09 17:39:26 +01:00
Deathamns
775f51a04b Fix "invalid token" exception in Safari
Seems like in older versions the const keyword doesn't play well with the "use strict" directive
2014-11-09 17:39:24 +01:00
Deathamns
1a83d1a753 Move vAPI into .jshintrc as a global 2014-11-09 17:39:22 +01:00
Deathamns
171619506b Remove storage change-event listener from Safari
Earlier, a technique was used to open the extension's Options page when
the user clicked a checkbox input at Safari's extension settings. The method was removed because:
- the Options page can be opened via the extension's toolbar button (which
  cannot be disabled in Safari, so it will be there all the time);
- involved more clicks than opening from the toolbar button;
- the string beside the checkbox couldn't be localized.
2014-11-09 17:39:20 +01:00
Deathamns
7af9805296 Safari shows integers only over the toolbar icon 2014-11-09 17:39:19 +01:00
Deathamns
0886f7e886 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.
2014-11-09 17:39:17 +01:00
Deathamns
4278121f74 Minor changes
- Update assets from gorhill/uBlock/master
- Remove whitespace from element-picker.js
- Simplify code in profiler.js (btw, Date is still needed as fallback
  for older browsers)
- Clarification for Safari's storage where the QUOTA_BYTES came from
2014-11-09 17:39:15 +01:00
Deathamns
723fc6087c Alphabetical order for keys in Safari's Info.plist 2014-11-09 17:39:14 +01:00
Deathamns
5b79bf3536 Work on vendor API abstraction, and near complete Safari support 2014-11-09 17:39:12 +01:00