Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: firstRun.js

Issue 29321336: Issue 2381 - Added share overlay to options page (Closed)
Patch Set: Created July 2, 2015, 3:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « firstRun.html ('k') | options.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « firstRun.html ('k') | options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld