Browse files

Release 2.4.1

See website changelog
  • Loading branch information...
1 parent 823cde4 commit 490808abd16118c60e62e7f9d91050c4e3567d6f @infernoboy committed Apr 28, 2012
Showing with 447 additions and 45 deletions.
  1. +2 −2 Info.plist
  2. +48 −0 Settings.plist
  3. +3 −0 i18n/en-us.js
  4. +9 −0 js/blocker.js
  5. +51 −37 js/global.js
  6. +332 −4 js/predefined.js
  7. +2 −2 jsblocker.plist
View
4 Info.plist
@@ -13,9 +13,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
- <string>2.4.0</string>
+ <string>2.4.1</string>
<key>CFBundleVersion</key>
- <string>60</string>
+ <string>61</string>
<key>Chrome</key>
<dict>
<key>Database Quota</key>
View
48 Settings.plist
@@ -366,6 +366,54 @@
</dict>
<dict>
<key>DefaultValue</key>
+ <true/>
+ <key>Key</key>
+ <string>enableimage</string>
+ <key>Title</key>
+ <string>Enable image blocker</string>
+ <key>Type</key>
+ <string>CheckBox</string>
+ </dict>
+ <dict>
+ <key>DefaultValue</key>
+ <true/>
+ <key>Key</key>
+ <string>showPlaceholderimage</string>
+ <key>Title</key>
+ <string>Show a clickable placeholder for blocked images</string>
+ <key>Type</key>
+ <string>CheckBox</string>
+ </dict>
+ <dict>
+ <key>DefaultValue</key>
+ <string>nowhere</string>
+ <key>Key</key>
+ <string>alwaysBlockimage</string>
+ <key>Title</key>
+ <string>Automatically block images from</string>
+ <key>Titles</key>
+ <array>
+ <string>Different hosts &amp; subdomains</string>
+ <string>Different hostnames</string>
+ <string>Nowhere</string>
+ <string>Anywhere</string>
+ </array>
+ <key>Type</key>
+ <string>PopUpButton</string>
+ <key>Values</key>
+ <array>
+ <string>topLevel</string>
+ <string>domain</string>
+ <string>nowhere</string>
+ <string>everywhere</string>
+ </array>
+ </dict>
+ <dict>
+ <key>Type</key>
+ <string>Separator</string>
+ </dict>
+ <dict>
+ <key>DefaultValue</key>
<false/>
<key>Key</key>
<string>blockReferrer</string>
View
3 i18n/en-us.js
@@ -107,10 +107,12 @@ Strings['en-us'] = {
'Use large font': 'Use large font',
'Scripts': 'Scripts', // NEW
'Frames': 'Frames', // NEW
+ 'Images': 'Images', // NEW
'Embeds': 'Embeds, Objects, & Videos', // NEW
'Frame Rules': 'Frame Rules', // NEW
'Script Rules': 'Script Rules', // NEW
'Embed Rules': 'Embed, Object, & Video Rules', // NEW
+ 'Image Rules': 'Image Rules',
'Forgot': 'iForgot', // NEW
/** /BUTTONS **/
@@ -125,6 +127,7 @@ Strings['en-us'] = {
'Loading frame': 'Loading frame&hellip;', // NEW
'Loading embed': 'Loading embed&hellip;', // NEW
'Loading object': 'Loading object&hellip;', // NEW
+ 'Loading image': 'Loading image&hellip;', // NEW
'Loading rules': 'Loading rules&hellip;',
'Copy above': 'Copy the above and save it to a file to create a backup.',
'Paste your backup': 'Paste the contents of your backup above and hit restore. All existing rules will be removed.',
View
9 js/blocker.js
@@ -158,6 +158,15 @@ var bv = window.navigator.appVersion.split('Safari/')[1].split('.'),
t.style.setProperty('display', 'none', 'important');
});
}],
+ image: [{ IMG: 'src' }, function (allowed, host, url) {
+ var t = this;
+ if (!allowed)
+ if_setting('showPlaceholderimage', true, function () {
+ createPlaceholder(t, host, url);
+ }, function () {
+ t.style.setProperty('display', 'none', 'important');
+ });
+ }],
},
jsblocker = {
allowed: {
View
88 js/global.js
@@ -55,8 +55,8 @@ var Template = {
speedMultiplier: 1,
disabled: !1,
frames: {},
- displayv: '2.4.0',
- bundleid: 60,
+ displayv: '2.4.1',
+ bundleid: 61,
donation_url: 'http://lion.toggleable.com:160/jsblocker/verify.php?id=',
set_theme: function (theme) {
@@ -132,7 +132,10 @@ var Template = {
});
}, null, null, true);
else {
- new Poppy();
+ new Poppy($(this.popover.body).width() / 2, 13, [
+ '<p>',
+ _('Updated JavaScript Blocker {1}', ['<a class="outside" href="http://javascript-blocker.toggleable.com/change-log/' + this.displayv.replace(/\./g, '') + '">' + this.displayv + '</a>']),
+ '</p>'].join(''));
this.installedBundle = this.bundleid;
}
},
@@ -216,35 +219,41 @@ var Template = {
this.rules.reinstall_predefined('frame');
this.rules.reinstall_predefined('embed');
- if (this.donationVerified)
- new Poppy($(this.popover.body).width() / 2, 13, [
- '<p class="misc-info">Update 2.4.0</p>',
- '<p>A new donator-only feature has been added!</p>',
- '<p>You can now block the loading of frames, embeds, objects, and videos.</p>',
- '<p>',
- '<input type="button" id="rawr-continue" value="', _('Understood'), '" /> ',
- '<input type="button" id="rawr-setup" value="', _('Show Setup'), '" />',
- '</p>'].join(''), function () {
- _$('#rawr-continue').click(function () {
- self.donate();
- }).siblings('#rawr-setup').click(function () {
- new Poppy();
- self.setupDone = 0;
- self.open_popover({});
-
- var ss = safari.extension.settings;
-
- _$('#setup input[type="checkbox"]').attr('checked', null);
-
- if (ss.largeFont) _$('#use-large').attr('checked', 'checked');
- if (ss.alwaysBlock === 'domain') _$('#block-manual').attr('checked', 1);
- if (ss.secureOnly) _$('#secure-only').attr('checked', 1);
- if (ss.enableframe) _$('#block-frames').attr('checked', 1);
- if (ss.enableembed) _$('#block-embeds').attr('checked', 1);
- });
- }, $.noop, null, true);
- else
- this.donate();
+ new Poppy($(this.popover.body).width() / 2, 13, [
+ '<p class="misc-info">Update 2.4.0</p>',
+ '<p>A new donator-only feature has been added!</p>',
+ '<p>You can now block the loading of frames, embeds, objects, and videos.</p>',
+ '<p>',
+ '<input type="button" id="rawr-continue" value="', _('Understood'), '" /> ',
+ '<input type="button" id="rawr-setup" value="', _('Show Setup'), '" />',
+ '</p>'].join(''), function () {
+ _$('#rawr-continue').click(function () {
+ self.updater();
+ }).siblings('#rawr-setup').click(function () {
+ new Poppy();
+ self.setupDone = 0;
+ self.open_popover({});
+ self.setupDone = 1;
+
+ for (var key in self.rules.data_types)
+ self.rules.reinstall_predefined(key);
+
+ var ss = safari.extension.settings;
+
+ _$('#setup input[type="checkbox"]').attr('checked', null);
+
+ if (ss.largeFont) _$('#use-large').attr('checked', 'checked');
+ if (ss.alwaysBlock === 'domain') _$('#block-manual').attr('checked', 1);
+ if (ss.secureOnly) _$('#secure-only').attr('checked', 1);
+ if (ss.enableframe) _$('#block-frames').attr('checked', 1);
+ if (ss.enableembed) _$('#block-embeds').attr('checked', 1);
+ });
+ }, $.noop, null, true);
+ } else if (v < 61) {
+ for (var key in this.rules.data_types)
+ this.rules.reinstall_predefined(key);
+
+ this.donate();
} else if (v < this.bundleid)
this.donate();
},
@@ -751,7 +760,7 @@ var Template = {
},
rules: {
get data_types() {
- return { script: {}, frame: {}, embed: {} };
+ return { script: {}, frame: {}, embed: {}, image: {} };
},
_loaded: false,
get rules() {
@@ -875,8 +884,10 @@ var Template = {
if (typeof rule_found === 'number')
return rule_found;
-
- if (alwaysFrom !== 'nowhere' && rule_found !== true) {
+
+ if (host === 'blank' && alwaysFrom !== 'everywhere') return 1;
+
+ if (alwaysFrom !== 'nowhere' && rule_found !== true && host !== 'blank') {
var sproto = this.utils.active_protocol(message[2]),
aproto = this.utils.active_protocol(message[1]);
@@ -1790,10 +1801,12 @@ var Template = {
if (self.donationVerified)
for (var kind in self.rules.data_types) {
+ if (!safari.extension.settings.getItem('enable' + kind)) continue;
+
var ki = kind.charAt(0).toUpperCase() + kind.substr(1) + 's';
kinds.push('<input class="ba-kind" id="ba-kind-' + kind + '" type="checkbox" ' + (!self.collapsed(kind + 'Unchecked') ? 'checked' : '') + '>' +
- '<label for="ba-kind-' + kind + '">&thinsp;' + _(ki) + '</label>&nbsp;&nbsp;&nbsp;');
+ '<label for="ba-kind-' + kind + '">&nbsp;' + _(ki) + '</label>&nbsp;&nbsp;&nbsp;');
}
new Poppy(off.left + $(this).outerWidth() / 2, off.top + 8, [
@@ -2538,7 +2551,7 @@ var Template = {
toolbarItem.badge = safari.extension.settings.toolbarDisplay === 'allowed' ?
jsblocker.allowed.count + frames_allowed_count :
(safari.extension.settings.toolbarDisplay === 'blocked' ? jsblocker.blocked.count + frames_blocked_count : 0);
- else
+ else {
var allowed_items = 0, blocked_items = 0;
for (var kind in jsblocker.allowed.items) {
@@ -2549,6 +2562,7 @@ var Template = {
toolbarItem.badge = safari.extension.settings.toolbarDisplay === 'allowed' ?
allowed_items + frames_allowed_item_count :
(safari.extension.settings.toolbarDisplay === 'blocked' ? blocked_items + frames_blocked_item_count : 0);
+ }
}
if (!badge_only) {
View
336 js/predefined.js
@@ -4,6 +4,317 @@
* @package JavaScript Blocker (http://javascript-blocker.toggleable.com)
***************************************/
+var def = [
+'/xtcore.js',
+'/?livehit=',
+'/?record&key=',
+'/__utm.gif',
+'/a.logrequest.yolx?',
+'/aa.php?anuid=',
+'/add_page_view?',
+'/adlogger_tracker.js?',
+'/adlogger_tracker.php',
+'/afrpt.gif?',
+'/aggbug.aspx?',
+'/analysis-logger/logger?',
+'/analyzer/aa.php?',
+'/aspstats/index.asp?',
+'/astrack.js',
+'/astracker.js',
+'/atapixel.js',
+'/awstats.js',
+'/awstats_misc_tracker.js',
+'/b/ss/*&ce=iso-8859-1&',
+'/b/ss/*&ce=utf-8&',
+'/b/ss/*&events=',
+'/b/ss/*&pagename=',
+'/b/ss/*=event36&',
+'/b/ss/*=referrers&',
+'/b/ss/*?[aqb]&ndh=',
+'/b/ss/*?aqb=1&ndh=',
+'/b/ss/*?aqb=1&pccr=',
+'/b/ss/*?pagename=',
+'/b/ss/ueglobaldev/*',
+'/b/ss/wdgdolad,',
+'/baynote-observer.js',
+'/baynote-search.js',
+'/baynote-single-local.js',
+'/baynote.js',
+'/baynoteobserver/*',
+'/beacon?',
+'/bh_counter.js',
+'/bluekai.js',
+'/bm-analytics-trk.js',
+'/bsuite/worker.php?',
+'/cdn5.js?',
+'/cdx.gif?',
+'/cedexis.js',
+'/cedexis/*',
+'/certifica-js14.js',
+'/certifica.js',
+'/certifica_2010.js',
+'/cgi-bin/count.cgi?*df=',
+'/cgi-bin/count.cgi?*ft=',
+'/cgi-bin/count.cgi?*rgb=',
+'/cgi-bin/count.cgi?*sh=',
+'/cgi-bin/ctasp-server.cgi?',
+'/cgi-bin/ivw-ssl/*',
+'/cgi-bin/ivw/*',
+'/cgi-bin/online/uos.cgi?',
+'/cgi-bin/pagedot.gif?',
+'/cgi-bin/user_online/uos.cgi?',
+'/cgi-bin/vdz/cp/*',
+'/cgi-sys/count.cgi?df=',
+'/ch/additional.php?res_width=',
+'/chartbeat.js',
+'/chcounter/*',
+'/clickheat.js',
+'/clickheat/*',
+'/clickstream.js',
+'/cm?ci=*&tid=',
+'/cm?tid=',
+'/cnstats/cntg.php?',
+'/cnt-combined.php?',
+'/com_astatspro/*',
+'/com_joomla-visites/*',
+'/com_joomlawatch/*',
+'/comscore.js',
+'/comscore_beacon.js',
+'/count/additional.php?res_width=',
+'/counter.php?chcounter_mode=',
+'/counter/additional.php?res_width=',
+'/csi?v=*&action=',
+'/dcs.gif?',
+'/demandbase.js',
+'/dotomi_tracking/*',
+'/dtmtag.js',
+'/e086ec.aspx?q=l3mkwgak',
+'/e107_plugins/log/log.php?',
+'/eae-logger/*',
+'/econa-site-search-ajax-log-referrer.php',
+'/edata.js',
+'/elqcfg-$script',
+'/elqcfg.js',
+'/elqimg.js',
+'/elqnow/*',
+'/eluminate?',
+'/emos2.js',
+'/estatnativeflashtag.swf',
+'/event.ng/*',
+'/finalizestats.js',
+'/firestats/*.php?*site_id=',
+'/fkounter/*',
+'/fkounter5/*',
+'/foresee/*',
+'/fpc.pl?a=',
+'/fpcount.exe',
+'/fsrscripts/*',
+'/ga.aspx?utmac=$image',
+'/ga.php?utmac=$image',
+'/ga_social_tracking.js',
+'/gaaddons.js',
+'/gapro-1.swf',
+'/gapro.swf',
+'/gatag.js',
+'/gatc.js',
+'/gcount.pl?',
+'/gemius.js',
+'/gemius/*',
+'/getsidpixeltag?sid=',
+'/globalpagetracking.js',
+'/google-analyticator/*',
+'/google-analytics-for-wordpress/*',
+'/googleanalytics-prod.swf',
+'/googleanalytics.swf',
+'/googleanalytics/ga.php?$image',
+'/googleanalyticsmanagement.swf',
+'/googleanalyticsplugin.swf',
+'/headupstats.gif?',
+'/heatmap.js',
+'/heatmap_log.js',
+'/hg?hc=&hb=*&vjs=',
+'/hgct?hc=&hb=*&vjs=',
+'/hitcounter.dll',
+'/i?siteid=',
+'/images/spacer.gif?q=l3mkwgak',
+'/index.php?_m=livesupport*&referrer=',
+'/intervigil.js',
+'/iperceptions.js',
+'/ipixel?spacedesc=',
+'/iqtm.js',
+'/istat.aspx?',
+'/ivwanalytics.swf?',
+'/ivwbox/*',
+'/js/tagging/tagtrack.js',
+'/kaizentrack/*',
+'/kelkooid?sitename=',
+'/kissmetrics.js',
+'/kissmetrics/*',
+'/layer_log.php?p=',
+'/leadgen_tracking.js',
+'/library/svy/*/broker.js',
+'/library/svy/broker.js',
+'/linkinformer.js',
+'/livezilla/server.php?request=track&',
+'/log_e.php?id=',
+'/logaholictracker.php?',
+'/logger/p.gif?',
+'/logger?*ctxid=',
+'/logreferrer.php?*&referrer=',
+'/md.js?country=',
+'/mdwtc/click_thru/*',
+'/metriweb.js',
+'/mint/?js',
+'/mintstats/?js',
+'/mmcore.js',
+'/mngi/tracking/*',
+'/modules/contrib/google_analytics/*',
+'/modules/contributions/google_analytics/*',
+'/modules/google_analytics/*',
+'/modules/google_analytics_event_tracking/*',
+'/msftaudience.js',
+'/mtvi_reporting.js',
+'/mwtag.js',
+'/mwtag_flash.js',
+'/myasg/stats_js.asp',
+'/mycounter/additional.php?res_width=',
+'/mycounter/counter_in.php?',
+'/mystats/track.js',
+'/netmind-$script',
+'/netupdate/live.php?',
+'/nielsen.js',
+'/nielsen/*',
+'/nielsenscv53.$script',
+'/nielson_stats.js',
+'/njs.gif?',
+'/nm_tr_combined-min.js',
+'/nm_tr_combined.js',
+'/nm_track.js',
+'/nm_trck.gif?',
+'/ntpagetag.gif',
+'/ntpagetag.js',
+'/ntrack.asp?',
+'/oas_analytics.js',
+'/odoscope.js',
+'/omnidiggthis|',
+'/omnitureanalytics.swf?',
+'/onestat.js',
+'/opinionlab.js',
+'/pagelogger/connector.php?',
+'/pbstrackingplugin.swf',
+'/php-stats.js.php',
+'/php-stats.php?',
+'/php-stats.phpjs.php?',
+'/php-stats.recjs.php?',
+'/phpmyvisites.js',
+'/piwik.js',
+'/piwik.php',
+'/pixelstats/*',
+'/planetstat.php?',
+'/plugins/google-analytics/*',
+'/pphlogger.js',
+'/pphlogger.php',
+'/pr.php?',
+'/prnx_track.js',
+'/quant.js',
+'/quantcast.js',
+'/rbipt.gif?',
+'/rbipt.js',
+'/rcdntpagetag.js',
+'/redirectexittrack.php?',
+'/remote/js_logger.php',
+'/revenuescience.js',
+'/revsci.js',
+'/s.gif?l=',
+'/sdctag.js?',
+'/sdxp1/dru4/meta?_hc=',
+'/server.php?request=track&output=',
+'/shinystat.cgi?',
+'/sitestat.js',
+'/sitestats.gif?',
+'/sitetrek.js',
+'/slimstat/*',
+'/softpage/stats_registerhit.asp?',
+'/sophus/logging.js',
+'/sophus3/logging-code.js',
+'/sophus3/logging.js',
+'/sophus3_logging.js',
+'/staffcp/save_stats.php?',
+'/stat/track.php?mode=js',
+'/stat36/stat/track.php',
+'/stataffs/track.php?',
+'/statcounter.js',
+'/statcountex/count.asp?',
+'/stateye/*',
+'/stats/additional.php?res_width=',
+'/stats/et_track.asp?',
+'/stats/track.asp?',
+'/stats/tracker.gif?',
+'/statsadvance.js',
+'/statscript.js',
+'/stwc-counter/*',
+'/stwc/code.js',
+'/swfaddress.js?tracker=',
+'/tacoda_ams_ddc_header.js',
+'/tagomnitureengine.js',
+'/tc_logging.js',
+'/tc_targeting.html',
+'/tc_throttle.js',
+'/tnsmetrix/*',
+'/touchclarity/*',
+'/tpix.gif?',
+'/track/*?rnd=0.$image',
+'/tracker/event?',
+'/tracking/tynt_',
+'/traffic/?',
+'/traffic/status.gif?',
+'/traffic4u.js',
+'/tsc.php?*&ses=',
+'/userfly.js',
+'/viperbar/stats.php?',
+'/visualsciences.js',
+'/visualstat/stat.php',
+'/vstats/counter.php',
+'/vtrack.php?',
+'/webabacus-$script',
+'/webforensics/*',
+'/webiq.js',
+'/webstatistik/track.asp',
+'/webtraxs.js',
+'/webtrekk.js',
+'/webtrekk_',
+'/where-go-add.js.php?',
+'/who/?js',
+'/whoson_*_trackingonly.js',
+'/wlexpert_tracker.',
+'/wlexpert_tracker/*',
+'/wp-clickmap/*',
+'/wp-content/plugins/stats/count.php?',
+'/wp-counter.php',
+'/wp-js/analytics.js?',
+'/wp-powerstat/*',
+'/wp-slimstat/*',
+'/wt_capi.js',
+'/wtbase.js',
+'/wtcore.js',
+'/wtid.js',
+'/wtinit.js',
+'/wusage_screen_properties.gif?',
+'/wysistat.js',
+'/xgemius.js',
+'/xiti.js',
+'/xtclicks-$script',
+'/xtclicks.js',
+'/xtcore.js',
+'/xtrack.php?',
+'/xtroi.js',
+'/yalst/pixel*.php?',
+'/zaehler/additional.php?res_width=',
+'/zag.gif?',
+'/~utm_gif?'];
+
+def = def.map(function (v) { return JB.utils.escape_regexp(v).replace(/\\\*/g, '.*'); });
+
JB.rules.whitelist = {
script: {
'.*': [
@@ -57,7 +368,8 @@ JB.rules.whitelist = {
'.youtube.com': [
'^http:\\/\\/([^\\/]+\\.)?ytimg\\.com\\/.*$',
]
- }
+ },
+ image: {}
};
var wl = JB.rules.whitelist.script;
@@ -80,15 +392,31 @@ JB.rules.blacklist = {
'^https?:\\/\\/(.*\\.)?kontera\\.com\\/.*$', '^https?:\\/\\/(.*\\.)?snap\\.com\\/.*$',
// Used for tracking purposes.
- '^https?:\\/\\/(ssl|www)\\.google\\-analytics\\.com\\/(ga|urchin)\\.js$', '^https?:\\/\\/edge\\.quantserve\\.com\\/.*$'
+ '^https?:\\/\\/(ssl|www)\\.google\\-analytics\\.com\\/(ga|urchin)\\.js$', '^https?:\\/\\/edge\\.quantserve\\.com\\/.*$',
+
+ '^https?:\\/\\/.*(' + def.join('|') + ').*$'
]
},
frame: {
'.*': [
'^https?:\\/\\/(.*\\.)?facebook\\.com\\/.*$',
'^https?:\\/\\/(.*\\.)?twitter\\.com\\/.*$',
'^https?:\\/\\/(.*\\.)?plusone\\.google\\.(com|ca|co\\.uk)\\/.*$',
- '^https?:\\/\\/ads\\.[^\.]+\..*\\/.*$'
+ '^https?:\\/\\/ads\\.[^\.]+\..*\\/.*$',
+ '^https?:\\/\\/.*(' + def.join('|') + ').*$'
+ ]
+ },
+ embed: {
+ '.*': [
+ '^https?:\\/\\/.*(' + def.join('|') + ').*$'
+ ]
+ },
+ image: {
+ '.*': [
+ '^https?:\\/\\/.*(' + def.join('|') + ').*$'
]
}
-};
+};
+
+delete def;
+def = undefined;
View
4 jsblocker.plist
@@ -10,9 +10,9 @@
<key>Developer Identifier</key>
<string>6S8J5HV3H4</string>
<key>CFBundleVersion</key>
- <string>60</string>
+ <string>61</string>
<key>CFBundleShortVersionString</key>
- <string>2.4.0</string>
+ <string>2.4.1</string>
<key>URL</key>
<string>http://dl.dropbox.com/u/11967/JS%20Blocker.safariextz</string>
</dict>

0 comments on commit 490808a

Please sign in to comment.