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

Side by Side Diff: firstRun.js

Issue 8403145: First attempt at creating a first-run page (Closed)
Patch Set: Created Oct. 17, 2012, 10:24 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « firstRun.html ('k') | skin/firstRun.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16
17 // Set up URLs 17 // Set up URLs
18 var versionID = chrome.app.getDetails().version.split(".").slice(0, 2).join("" ); 18 var versionId = chrome.app.getDetails().version.split(".").slice(0, 2).join("" );
19 setLinks("improvementsFeature", "https://adblockplus.org/releases/adblock-plus -" + versionID + "-for-google-chrome-released"); 19 setLinks("title-changelog", "https://adblockplus.org/releases/adblock-plus-" + versionId + "-for-google-chrome-released");
20 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads"), 20 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads", "criteria"),
21 getDocLink("acceptable_ads", "criteria"), backgroundPage.openOptions) ; 21 backgroundPage.openOptions);
22 22
23 var facebookLinks = document.getElementsByClassName("share-facebook"); 23 var facebookLinks = document.getElementsByClassName("share-facebook");
24 for (var i = 0; i < facebookLinks.length; i++) 24 for (var i = 0; i < facebookLinks.length; i++)
25 facebookLinks[i].href = getDocLink("facebook") + "&variant=" + variant; 25 facebookLinks[i].href = getDocLink("facebook") + "&variant=" + variant;
26 26
27 var twitterLinks = document.getElementsByClassName("share-twitter"); 27 var twitterLinks = document.getElementsByClassName("share-twitter");
28 for (var i = 0; i < twitterLinks.length; i++) 28 for (var i = 0; i < twitterLinks.length; i++)
29 twitterLinks[i].href = getDocLink("twitter") + "&variant=" + variant; 29 twitterLinks[i].href = getDocLink("twitter") + "&variant=" + variant;
30 30
31 var donateLink = document.getElementById("share-donate"); 31 var donateLink = document.getElementById("share-donate");
(...skipping 22 matching lines...) Expand all
54 } 54 }
55 } 55 }
56 } 56 }
57 57
58 function getDocLink(page, anchor) 58 function getDocLink(page, anchor)
59 { 59 {
60 return Prefs.documentation_link 60 return Prefs.documentation_link
61 .replace(/%LINK%/g, page) 61 .replace(/%LINK%/g, page)
62 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 62 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
63 } 63 }
OLDNEW
« no previous file with comments | « firstRun.html ('k') | skin/firstRun.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld