Index: firstRun.js |
=================================================================== |
--- a/firstRun.js |
+++ b/firstRun.js |
@@ -19,11 +19,6 @@ |
(function() |
{ |
- function E(id) |
- { |
- return document.getElementById(id); |
- } |
- |
// Load subscriptions for features |
var featureSubscriptions = [ |
{ |
@@ -46,15 +41,6 @@ |
} |
]; |
- function getDocLink(link, callback) |
- { |
- ext.backgroundPage.sendMessage({ |
- type: "app.get", |
- what: "doclink", |
- link: link |
- }, callback); |
- } |
- |
function onDOMLoaded() |
{ |
// Set up logo image |
@@ -150,73 +136,16 @@ |
}, false); |
} |
- function openSharePopup(url) |
- { |
- var iframe = E("share-popup"); |
- var glassPane = E("glass-pane"); |
- var popupMessageReceived = false; |
- |
- var popupMessageListener = function(event) |
- { |
- if (!/[.\/]adblockplus\.org$/.test(event.origin)) |
- return; |
- |
- var width = event.data.width; |
- var height = event.data.height; |
- iframe.width = width; |
- iframe.height = height; |
- iframe.style.marginTop = -height/2 + "px"; |
- iframe.style.marginLeft = -width/2 + "px"; |
- popupMessageReceived = true; |
- window.removeEventListener("message", popupMessageListener); |
- }; |
- // Firefox requires last parameter to be true to be triggered by unprivileged pages |
- window.addEventListener("message", popupMessageListener, false, true); |
- |
- var popupLoadListener = function() |
- { |
- if (popupMessageReceived) |
- { |
- iframe.className = "visible"; |
- |
- var popupCloseListener = function() |
- { |
- iframe.className = glassPane.className = ""; |
- document.removeEventListener("click", popupCloseListener); |
- }; |
- document.addEventListener("click", popupCloseListener, false); |
- } |
- else |
- { |
- glassPane.className = ""; |
- window.removeEventListener("message", popupMessageListener); |
- } |
- |
- iframe.removeEventListener("load", popupLoadListener); |
- }; |
- iframe.addEventListener("load", popupLoadListener, false); |
- |
- iframe.src = url; |
- glassPane.className = "visible"; |
- } |
- |
function updateSocialLinks() |
{ |
var networks = ["twitter", "facebook", "gplus"]; |
networks.forEach(function(network) |
{ |
var link = E("share-" + network); |
- var message = { |
- type: "filters.blocked", |
- url: link.getAttribute("data-script"), |
- requestType: "SCRIPT", |
- docDomain: "adblockplus.org", |
- thirdParty: true |
- }; |
- ext.backgroundPage.sendMessage(message, function(blocked) |
+ checkShareResource(link.getAttribute("data-script"), function(isBlocked) |
{ |
// Don't open the share page if the sharing script would be blocked |
- if (blocked) |
+ if (isBlocked) |
link.removeEventListener("click", onSocialLinkClick, false); |
else |
link.addEventListener("click", onSocialLinkClick, false); |