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

Delta Between Two Patch Sets: firstRun.js

Issue 8403145: First attempt at creating a first-run page (Closed)
Left Patch Set: Now with downscaling for smaller screens Created Oct. 1, 2012, 5:56 a.m.
Right Patch Set: Created Oct. 17, 2012, 2:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « firstRun.html ('k') | skin/firstRun.css » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 var backgroundPage = chrome.extension.getBackgroundPage(); 1 var backgroundPage = chrome.extension.getBackgroundPage();
2 var require = backgroundPage.require; 2 var require = backgroundPage.require;
3 var Prefs = require("prefs").Prefs; 3 var Prefs = require("prefs").Prefs;
4 var Utils = require("utils").Utils; 4 var Utils = require("utils").Utils;
5 5
6 function init() 6 function init()
7 { 7 {
8 // Choose a share text variant randomly 8 // Choose a share text variant randomly
9 var variant = Math.floor(Math.random() * 2) + 1; 9 var variant = Math.floor(Math.random() * 2) + 1;
10 document.documentElement.setAttribute("share-variant", variant); 10 document.documentElement.setAttribute("share-variant", variant);
11 11
12 // Set up page title 12 // Set up page title
13 var titleId = (backgroundPage.isFirstRun ? "firstRun_title_install" : "firstRu n_title_update"); 13 var titleId = (backgroundPage.isFirstRun ? "firstRun_title_install" : "firstRu n_title_update");
14 var pageTitle = chrome.i18n.getMessage(titleId); 14 var pageTitle = chrome.i18n.getMessage(titleId);
15 document.title = document.getElementById("title").textContent = pageTitle; 15 document.title = document.getElementById("title-main").textContent = pageTitle ;
16
17 // Only show changelog link on the update page
18 if (backgroundPage.isFirstRun)
19 document.getElementById("title-changelog").style.display = "none";
16 20
17 // Set up URLs 21 // Set up URLs
18 var versionID = chrome.app.getDetails().version.split(".").slice(0, 2).join("" ); 22 var versionId = chrome.app.getDetails().version.split(".").slice(0, 2).join("" );
Felix Dahlke 2012/10/02 12:36:04 Shouldn't this be named versionId, analogous to ti
19 setLinks("improvementsFeature", "https://adblockplus.org/releases/adblock-plus -" + versionID + "-for-google-chrome-released"); 23 setLinks("title-changelog", "https://adblockplus.org/releases/adblock-plus-" + versionId + "-for-google-chrome-released");
20 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads"), 24 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads", "criteria"),
21 getDocLink("acceptable_ads", "criteria"), backgroundPage.openOptions) ; 25 backgroundPage.openOptions);
22 26
23 var facebookLinks = document.getElementsByClassName("share-facebook"); 27 var facebookLinks = document.getElementsByClassName("share-facebook");
24 for (var i = 0; i < facebookLinks.length; i++) 28 for (var i = 0; i < facebookLinks.length; i++)
25 facebookLinks[i].href = getDocLink("facebook") + "&variant=" + variant; 29 facebookLinks[i].href = getDocLink("facebook") + "&variant=" + variant;
26 30
27 var twitterLinks = document.getElementsByClassName("share-twitter"); 31 var twitterLinks = document.getElementsByClassName("share-twitter");
28 for (var i = 0; i < twitterLinks.length; i++) 32 for (var i = 0; i < twitterLinks.length; i++)
29 twitterLinks[i].href = getDocLink("twitter") + "&variant=" + variant; 33 twitterLinks[i].href = getDocLink("twitter") + "&variant=" + variant;
30 34
31 var donateLink = document.getElementById("share-donate"); 35 var donateLink = document.getElementById("share-donate");
(...skipping 22 matching lines...) Expand all
54 } 58 }
55 } 59 }
56 } 60 }
57 61
58 function getDocLink(page, anchor) 62 function getDocLink(page, anchor)
59 { 63 {
60 return Prefs.documentation_link 64 return Prefs.documentation_link
61 .replace(/%LINK%/g, page) 65 .replace(/%LINK%/g, page)
62 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 66 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
63 } 67 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld