Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
fix regex replace bug. adding ajax/page content change sniffer. updat…
Browse files Browse the repository at this point in the history
…ing manifests. adding mccoy updatekey to firefox
  • Loading branch information
gleuch committed Mar 9, 2011
1 parent b442ca2 commit 1b7f8e6
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
2 changes: 1 addition & 1 deletion chrome/manifest.json
Expand Up @@ -17,5 +17,5 @@
"name": "Tinted Sheen Blocker",
"permissions": [ "tabs", "http://*/*" ],
"update_url": "http://addons.gleuch.com/tinted-sheen/updates/chrome?data=",
"version": "1.0.0"
"version": "1.0.1"
}
31 changes: 24 additions & 7 deletions chrome/tinted-sheen.js
Expand Up @@ -36,7 +36,7 @@ function tinted_sheen_start($_) {
};

$_.extend($_.tinted_sheen, {
settings : {hide_bg : true, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3$4$5</span>', starred: '****** ******', init : false, finish : false},
settings : {hide_bg : true, href : false, page_height : 0, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood|tiger\sblood|adonis\sdna|\#sheenskorner|sheen\'s\skorner|\#fastball)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3</span>', starred: '****** ******', init : false, finish : false},

pluck : function(str) {return str.replace(/(charlie\s)(sheen)/img, '****** ******').replace(/(sheen|\#winning)/img, '******');},

Expand Down Expand Up @@ -78,10 +78,12 @@ function tinted_sheen_start($_) {
$_(document).each(function() {this.title = $_.tinted_sheen.pluck(this.title);});

$_('img, input[type=image]').each(function() {
if ($_(this).attr('alt').match($_.tinted_sheen.settings.search) || $_(this).attr('title').match($_.tinted_sheen.settings.search) || $_(this).attr('src').match($_.tinted_sheen.settings.search)) {
var r = $_(this), w = r.width(), h = r.height(), c = rgb2hex($_(this).css('color'));
r.css({background: c, width: r.width(), height: r.height()}).attr('src', 'http://assets.gleuch.com/blank.png').width(w).height(h);
}
try {
if ($_(this).attr('alt').match($_.tinted_sheen.settings.search) || $_(this).attr('title').match($_.tinted_sheen.settings.search) || $_(this).attr('src').match($_.tinted_sheen.settings.search)) {
var r = $_(this), w = r.width(), h = r.height(), c = rgb2hex($_(this).css('color'));
r.css({background: c, width: r.width(), height: r.height()}).attr('src', 'http://assets.gleuch.com/blank.png').width(w).height(h);
}
} catch(e) {}
});

$_('input[type=text]').each(function() {if ($_(this).val().match($_.tinted_sheen.settings.search) ) $_(this).val( $_.tinted_sheen.pluck($_(this).val()) );});
Expand All @@ -91,12 +93,28 @@ function tinted_sheen_start($_) {
s.innerHTML = ".tinted_sheen {font-size: inherit !important; "+ ($_.tinted_sheen.settings.hide_bg ? "background-image: none !important;" : "") +"} .bg_tinted_sheen {"+ ($_.tinted_sheen.settings.hide_bg ? "background-image: none !important;" : "") +"}";
$_('head').append(s);

$_.tinted_sheen.settings.href = location.href;
$_.tinted_sheen.settings.page_height = $_('body').height();

$_.tinted_sheen.settings.finish = true;
}
});
})($_);

$_.tinted_sheen('body', '#000000');

/* Allow AJAX detection */
setInterval(function() {
var h = $_('body').height(), ch = $_.tinted_sheen.settings.page_height;

if (location.href != $_.tinted_sheen.settings.href || Math.abs(ch-h) > 20 ) {
$_.tinted_sheen.settings.href = location.href;
$_.tinted_sheen.settings.page_height = h;
$_.tinted_sheen.settings.init = false;
$_.tinted_sheen.settings.finish = false;
$_.tinted_sheen('body', '#000000');
}
}, 1000);
}


Expand All @@ -110,5 +128,4 @@ try {
jQuery('body').addClass('tigerblood');
tinted_sheen_start(jQuery);
}
} catch(err) {
}
} catch(err) {}
31 changes: 24 additions & 7 deletions firefox/content/tinted-sheen.js
Expand Up @@ -4413,7 +4413,7 @@ function tinted_sheen_start($_) {
};

$_.extend($_.tinted_sheen, {
settings : {hide_bg : true, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3$4$5</span>', starred: '****** ******', init : false, finish : false},
settings : {hide_bg : true, href : false, page_height : 0, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood|tiger\sblood|adonis\sdna|\#sheenskorner|sheen\'s\skorner|\#fastball)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3</span>', starred: '****** ******', init : false, finish : false},

pluck : function(str) {return str.replace(/(charlie\s)(sheen)/img, '****** ******').replace(/(sheen|\#winning)/img, '******');},

Expand Down Expand Up @@ -4455,10 +4455,12 @@ function tinted_sheen_start($_) {
$_(document).each(function() {this.title = $_.tinted_sheen.pluck(this.title);});

$_('img, input[type=image]').each(function() {
if ($_(this).attr('alt').match($_.tinted_sheen.settings.search) || $_(this).attr('title').match($_.tinted_sheen.settings.search) || $_(this).attr('src').match($_.tinted_sheen.settings.search)) {
var r = $_(this), w = r.width(), h = r.height(), c = rgb2hex($_(this).css('color'));
r.css({background: c, width: r.width(), height: r.height()}).attr('src', 'http://assets.gleuch.com/blank.png').width(w).height(h);
}
try {
if ($_(this).attr('alt').match($_.tinted_sheen.settings.search) || $_(this).attr('title').match($_.tinted_sheen.settings.search) || $_(this).attr('src').match($_.tinted_sheen.settings.search)) {
var r = $_(this), w = r.width(), h = r.height(), c = rgb2hex($_(this).css('color'));
r.css({background: c, width: r.width(), height: r.height()}).attr('src', 'http://assets.gleuch.com/blank.png').width(w).height(h);
}
} catch(e) {}
});

$_('input[type=text]').each(function() {if ($_(this).val().match($_.tinted_sheen.settings.search) ) $_(this).val( $_.tinted_sheen.pluck($_(this).val()) );});
Expand All @@ -4468,12 +4470,28 @@ function tinted_sheen_start($_) {
s.innerHTML = ".tinted_sheen {font-size: inherit !important; "+ ($_.tinted_sheen.settings.hide_bg ? "background-image: none !important;" : "") +"} .bg_tinted_sheen {"+ ($_.tinted_sheen.settings.hide_bg ? "background-image: none !important;" : "") +"}";
$_('head').append(s);

$_.tinted_sheen.settings.href = location.href;
$_.tinted_sheen.settings.page_height = $_('body').height();

$_.tinted_sheen.settings.finish = true;
}
});
})($_);

$_.tinted_sheen('body', '#000000');

/* Allow AJAX detection */
setInterval(function() {
var h = $_('body').height(), ch = $_.tinted_sheen.settings.page_height;

if (location.href != $_.tinted_sheen.settings.href || Math.abs(ch-h) > 20 ) {
$_.tinted_sheen.settings.href = location.href;
$_.tinted_sheen.settings.page_height = h;
$_.tinted_sheen.settings.init = false;
$_.tinted_sheen.settings.finish = false;
$_.tinted_sheen('body', '#000000');
}
}, 1000);
}


Expand All @@ -4487,5 +4505,4 @@ try {
jQuery('body').addClass('tigerblood');
tinted_sheen_start(jQuery);
}
} catch(err) {
}
} catch(err) {}
6 changes: 2 additions & 4 deletions firefox/install.rdf
Expand Up @@ -4,12 +4,10 @@
<Description about="urn:mozilla:install-manifest">
<em:id>tinted-sheen@gleuch.com</em:id>
<em:name>Tinted Sheen Blocker</em:name>
<em:version>1.0.0</em:version>
<!--
<em:version>1.0.1</em:version>
<em:updateURL>http://addons.gleuch.com/tinted-sheen/updates/firefox</em:updateURL>
<em:updateInfoURL>http://addons.gleuch.com/tinted-sheen/updates/firefox/info</em:updateInfoURL>
<em:updateKey></em:updateKey>
-->
<em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdaXt5MaiB3DdpsEhTagj5H/2Pd20zocVS1n/86uYswWF6pWxgx2X8fBkeujA6dmN0UIWVrLZLTFWwh6gQjsvpzxWMynRVkkx2JbMK0uuilaL6EO+MW6RNcHbLJrN2CCrYMwjTre/gruCWK63k/6wE4I2LT/O/vsmyobfYqvQ3CQIDAQAB</em:updateKey>

<em:creator>Greg Leuch</em:creator>
<em:contributor>Greg Leuch</em:contributor>
Expand Down
2 changes: 1 addition & 1 deletion tinted-sheen.js
Expand Up @@ -44,7 +44,7 @@ function tinted_sheen_start($_) {
};

$_.extend($_.tinted_sheen, {
settings : {hide_bg : true, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3$4$5</span>', starred: '****** ******', init : false, finish : false},
settings : {hide_bg : true, search: /(charlie(\s|\-|\_)?)?(sheen|porn\sfamily|\#winning|\#tigerblood|tiger\sblood|adonis\sdna|\#sheenskorner|sheen\'s\skorner|\#fastball)/img, replace: '<span class="tinted_sheen" style="color: %C; background-color: %C;">$1$2$3</span>', starred: '****** ******', init : false, finish : false},

pluck : function(str) {return str.replace(/(charlie\s)(sheen)/img, '****** ******').replace(/(sheen|\#winning)/img, '******');},

Expand Down

0 comments on commit 1b7f8e6

Please sign in to comment.