Skip to content

Loading…

Fix YouTube ClickToPlugin conflict #619

Merged
merged 2 commits into from

5 participants

@chrisaljoudi

Resolves #615

@gorhill gorhill merged commit 66a9e91 into chrisaljoudi:master
@d4v1dv00

may I ask when will this fix being released as beta?

@gorhill

I will do it now, after I import changes from Crowdin, if any.

@locusathome

@chrisaljoudi I am sorry but there still is a bug somewhere with µBlock 0.8.6.0 and ClickToPlugin on youtube.com.
After clean install µBlock 0.8.6.0 and update all (default) filters, cleaning all history, website data, cookies etc, restarting Safari I am able to watch a youtube video.

Reloading the same youtube page and I get 'video unavailable update to latest flash or update to latest quicktime'.

Cleaning up all Safari data, restart to the same page and I am able to watch the video, reload the same page and I get the error 'video unavailable update to latest flash or update to latest quicktime'.

So after cleaning up I am able to watch a video, reloading the same page and it is error.

@chrisaljoudi

@locusathome new 0.8.6.0 beta released (includes more fixes to YouTube) — see if that fixes the issue.

@locusathome

@chrisaljoudi Nope, no change.

If I disable for this site on youtube, I get the normal behaviour of ClickToPlugin and I am able to watch HTML5 video.

This is on OS X 10.10.2, Safari 8.0.3, ClickToPlugin 3.0 and µBlock 0.8.6.0 beta through extension update.

@chrisaljoudi

@locusathome commit acf434f fixes this. Sorry about that.

@locusathome

@chrisaljoudi It is okay now, nice job

@locusathome

@chrisaljoudi Please don't be sorry for that. I am deeply thrilled that there are people like you and @gorhill and @Deathamns who develop extension(s) for Safari (and other browsers) which greatly enhance the web and that for free!

So thank you!

@ErikSwan

Thanks for fixing this guys!

@ErikSwan ErikSwan referenced this pull request in hoyois/clicktoplugin
Closed

No longer works on YouTube without Flash installed #106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 27, 2015
  1. Fix YouTube patch

    committed
This page is out of date. Refresh to see the latest.
Showing with 78 additions and 84 deletions.
  1. +78 −84 platform/safari/sitepatch-safari.js
View
162 platform/safari/sitepatch-safari.js
@@ -1,22 +1,22 @@
/*******************************************************************************
- µBlock - a browser extension to block requests.
- Copyright (C) 2014 The µBlock authors
+µBlock - a browser extension to block requests.
+Copyright (C) 2014 The µBlock authors
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see {http://www.gnu.org/licenses/}.
+You should have received a copy of the GNU General Public License
+along with this program. If not, see {http://www.gnu.org/licenses/}.
- Home: https://github.com/gorhill/uBlock
+Home: https://github.com/gorhill/uBlock
*/
/******************************************************************************/
@@ -29,82 +29,76 @@
var vAPI = self.vAPI = self.vAPI || {};
-if ( /^www\.youtube(-nocookie)?\.com/.test(location.host) ) {
- vAPI.sitePatch = function() {
- // disable spf
- window.ytspf = {};
- Object.defineProperty(ytspf, 'enabled', {'value': false});
-
- // Based on ExtendTube's ad removing solution
- var p;
- var yt = {};
- var config_ = {};
- var ytplayer = {};
- var playerConfig = { args: {} };
-
- Object.defineProperties(yt, {
- 'playerConfig': {
- get: function() { return playerConfig; },
- set: function(data) {
- if ( data && typeof data === 'object'
- && data.args && typeof data.args === 'object' ) {
- var nope = /ad\d?_|afv|watermark|adsense|xfp/;
-
- for ( var prop in data.args ) {
- if ( nope.test(prop) && !/policy/.test(prop) ) {
- delete data.args[prop];
- }
- }
- }
-
- playerConfig = data;
+vAPI.sitePatch = function() {
+ // disable spf
+ window.ytspf = {};
+ Object.defineProperty(ytspf, 'enabled', {'value': false});
- var playerRoot = document.querySelector('[data-swf-config]');
+ // Based on ExtendTube's ad removing solution
+ var p;
+ var yt = {};
+ var config_ = {};
+ var ytplayer = {};
+ var playerConfig = { args: {} };
- if ( playerRoot ) {
- playerRoot.dataset.swfConfig = JSON.stringify(yt.playerConfig);
+ Object.defineProperties(yt, {
+ 'playerConfig': {
+ get: function() { return playerConfig; },
+ set: function(data) {
+ if ( data && typeof data === 'object'
+ && data.args && typeof data.args === 'object' ) {
+ var nope = /ad\d?_|afv|watermark|adsense|xfp/;
+
+ for ( var prop in data.args ) {
+ if ( nope.test(prop) && !/policy/.test(prop) ) {
+ delete data.args[prop];
+ }
}
}
- },
- 'config_': {
- get: function() { return config_; },
- set: function(value) { config_ = value; }
- }
- });
- Object.defineProperty(config_, 'PLAYER_CONFIG', {
- get: function() { return yt.playerConfig; },
- set: function(value) { yt.playerConfig = value; }
- });
+ playerConfig = data;
- Object.defineProperty(ytplayer, 'config', {
- get: function() { return playerConfig; },
- set: function(value) { yt.playerConfig = value; }
- });
-
- if ( window.yt ) {
- for ( p in window.yt ) { yt[p] = window.yt[p]; }
- window.yt = yt;
- }
- else {
- Object.defineProperty(window, 'yt', {
- get: function() { return yt; },
- set: function() {}
- });
- }
+ var playerRoot = document.querySelector('[data-swf-config]');
- if ( window.ytplayer ) {
- for ( p in window.ytplayer ) { ytplayer[p] = window.ytplayer[p]; }
- window.ytplayer = ytplayer;
- }
- else {
- Object.defineProperty(window, 'ytplayer', {
- get: function() { return ytplayer; },
- set: function() {}
- });
+ if ( playerRoot ) {
+ playerRoot.dataset.swfConfig = JSON.stringify(yt.playerConfig);
+ }
+ }
+ },
+ 'config_': {
+ get: function() { return config_; },
+ set: function(value) { config_ = value; }
}
- };
-}
-/*else if ( check url ) {
- vAPI.sitePatch do something
-}*/
+ });
+
+ Object.defineProperty(config_, 'PLAYER_CONFIG', {
+ get: function() { return yt.playerConfig; },
+ set: function(value) { yt.playerConfig = value; }
+ });
+
+ Object.defineProperty(ytplayer, 'config', {
+ get: function() { return playerConfig; },
+ set: function(value) { yt.playerConfig = value; }
+ });
+
+ if ( window.yt ) {
+ var oldyt = window.yt;
+ delete window.yt;
+ for ( p in oldyt ) { yt[p] = oldyt[p]; }
+ }
+ Object.defineProperty(window, 'yt', {
+ get: function() { return yt; },
+ set: function() {}
+ });
+
+ if ( window.ytplayer ) {
+ for ( p in window.ytplayer ) { ytplayer[p] = window.ytplayer[p]; }
+ window.ytplayer = ytplayer;
+ }
+ else {
+ Object.defineProperty(window, 'ytplayer', {
+ get: function() { return ytplayer; },
+ set: function() {}
+ });
+ }
+};
Something went wrong with that request. Please try again.