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

Side by Side Diff: firstRun.js

Issue 8621090: Replaced chrome.i18n by a platform-independent i18n object in UI (Closed)
Patch Set: Created Oct. 22, 2012, 8:46 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 | « .hgsubstate ('k') | i18n.js » ('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 = i18n.getMessage(titleId);
15 document.title = document.getElementById("title-main").textContent = pageTitle ; 15 document.title = document.getElementById("title-main").textContent = pageTitle ;
16 16
17 // Only show changelog link on the update page 17 // Only show changelog link on the update page
18 if (backgroundPage.isFirstRun) 18 if (backgroundPage.isFirstRun)
19 document.getElementById("title-changelog").style.display = "none"; 19 document.getElementById("title-changelog").style.display = "none";
20 20
21 // Set up URLs 21 // Set up URLs
22 var versionId = chrome.app.getDetails().version.split(".").slice(0, 2).join("" ); 22 var versionId = chrome.app.getDetails().version.split(".").slice(0, 2).join("" );
23 setLinks("title-changelog", "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");
24 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads", "criteria"), 24 setLinks("acceptableAdsExplanation", getDocLink("acceptable_ads", "criteria"),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 } 59 }
60 } 60 }
61 61
62 function getDocLink(page, anchor) 62 function getDocLink(page, anchor)
63 { 63 {
64 return Prefs.documentation_link 64 return Prefs.documentation_link
65 .replace(/%LINK%/g, page) 65 .replace(/%LINK%/g, page)
66 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" ); 66 .replace(/%LANG%/g, Utils.appLocale) + (anchor ? "#" + anchor : "" );
67 } 67 }
OLDNEW
« no previous file with comments | « .hgsubstate ('k') | i18n.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld