Index: chrome/content/ui/firstRun.js |
=================================================================== |
--- a/chrome/content/ui/firstRun.js |
+++ b/chrome/content/ui/firstRun.js |
@@ -93,6 +93,8 @@ |
var featureSubscription = featureSubscriptions[i]; |
updateToggleButton(featureSubscription.feature, isSubscriptionEnabled(featureSubscription)); |
} |
+ |
+ setSocialLinks(); |
} |
} |
FilterNotifier.addListener(filterListener); |
@@ -106,7 +108,7 @@ |
onWindowResize(); |
- initSocialLinks(null); |
+ setSocialLinks(); |
} |
function onScroll() |
@@ -222,20 +224,35 @@ |
glassPane.className = "visible"; |
} |
- function initSocialLinks(variant) |
+ function setSocialLinks() |
{ |
+ var isSocialFeatureEnabled = false; |
+ for (var i = 0; i < featureSubscriptions.length; i++) |
+ { |
+ if (featureSubscriptions[i].feature == "social") |
+ { |
+ isSocialFeatureEnabled = isSubscriptionEnabled(featureSubscriptions[i]); |
+ break; |
+ } |
+ } |
+ |
var networks = ["twitter", "facebook", "gplus"]; |
networks.forEach(function(network) |
{ |
var link = E("share-" + network); |
- link.addEventListener("click", function(e) |
- { |
- e.preventDefault(); |
- openSharePopup(Utils.getDocLink("share-" + network) + "&variant=" + variant); |
- }, false); |
+ if (isSocialFeatureEnabled) |
+ link.removeEventListener("click", onSocialLinkClick, false); |
+ else |
+ link.addEventListener("click", onSocialLinkClick, false); |
}); |
} |
+ function onSocialLinkClick(e) |
+ { |
+ e.preventDefault(); |
+ openSharePopup(Utils.getDocLink(e.target.id)); |
+ } |
+ |
function setLinks(id) |
{ |
var element = E(id); |
@@ -271,8 +288,10 @@ |
function updateToggleButton(feature, isEnabled) |
{ |
var button = E("toggle-" + feature); |
- button.className = isEnabled ? "disable" : "enable"; |
- button.textContent = i18n.getMessage(isEnabled ? "firstRun_action_disable" : "firstRun_action_enable"); |
+ if (isEnabled) |
+ button.className = button.className.replace("enable", "disable"); |
+ else |
+ button.className = button.className.replace("disable", "enable"); |
Wladimir Palant
2013/06/07 14:00:04
Frankly, one class name should be sufficient here:
|
} |
document.addEventListener("DOMContentLoaded", onDOMLoaded, false); |