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

Side by Side Diff: html/static/js/firstRun.js

Issue 5024350814076928: Issue 1103 - Migrate Simple Adblock users
Patch Set: Added comments in code Created April 24, 2015, 11: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
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 .replace(/%LINK%/g, page) 98 .replace(/%LINK%/g, page)
99 .replace(/%LANG%/g, Utils.appLocale); 99 .replace(/%LANG%/g, Utils.appLocale);
100 } 100 }
101 101
102 function initTranslations() 102 function initTranslations()
103 { 103 {
104 // Map message ID to HTML element ID 104 // Map message ID to HTML element ID
105 var mapping = { 105 var mapping = {
106 "aa-title": "first-run-aa-title", 106 "aa-title": "first-run-aa-title",
107 "aa-text": "first-run-aa-text", 107 "aa-text": "first-run-aa-text",
108 "title-main": AdblockPlus.isUpdate() ? "first-run-title-update" : "first-run -title-install", 108 "title-main": AdblockPlus.getConversion() == "simpleadblock" ? "first-run-ti tle-simple-adblock" :
109 AdblockPlus.isUpdate() ? "first-run-title-update" : "first-run-title-install",
109 "share-donate": "first-run-share2-donate", 110 "share-donate": "first-run-share2-donate",
110 "share-text": "first-run-share2", 111 "share-text": "first-run-share2",
111 "share-connection": "first-run-share2-or" 112 "share-connection": "first-run-share2-or",
113 "upgrade-from-other-plugin-text1": "first-run-text1-simple-adblock",
114 "upgrade-from-other-plugin-text2": "first-run-text2-simple-adblock"
112 }; 115 };
113 116
114 document.title = AdblockPlus.getMessage("first-run", mapping['title-main']); 117 document.title = AdblockPlus.getMessage("first-run", mapping['title-main']);
115 for (var i in mapping) 118 for (var i in mapping)
116 { 119 {
117 var element = document.getElementById(i); 120 var element = document.getElementById(i);
118 setElementText(element, AdblockPlus.getMessage("first-run", mapping[i])); 121 setElementText(element, AdblockPlus.getMessage("first-run", mapping[i]));
119 } 122 }
120 } 123 }
121 124
122 function init() 125 function init()
123 { 126 {
124 initTranslations(); 127 initTranslations();
125 initSocialLinks(); 128 initSocialLinks();
126 setLinks("aa-text", getDocLink("acceptable_ads_criteria"), "index.html"); 129 setLinks("aa-text", getDocLink("acceptable_ads_criteria"), "index.html");
127 130
131 if (AdblockPlus.isUpgradeFrom("simpleadblock")) {
Eric 2015/05/17 00:29:25 Where is 'isUpgradeFrom' defined? Is it the same
132 document.getElementById("upgrade-from-other-plugin").style.display = "block" ;
133 }
128 var donateLink = document.getElementById("share-donate"); 134 var donateLink = document.getElementById("share-donate");
129 donateLink.href = getDocLink("donate"); 135 donateLink.href = getDocLink("donate");
130 } 136 }
131 137
132 // Inserts i18n strings into matching elements. Any inner HTML already in the 138 // Inserts i18n strings into matching elements. Any inner HTML already in the
133 // element is parsed as JSON and used as parameters to substitute into 139 // element is parsed as JSON and used as parameters to substitute into
134 // placeholders in the i18n message. 140 // placeholders in the i18n message.
135 setElementText = function(element, elementHtml) 141 setElementText = function(element, elementHtml)
136 { 142 {
137 function processString(str, element) 143 function processString(str, element)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 links[i].href = curArg; 181 links[i].href = curArg;
176 links[i].setAttribute("target", "_blank"); 182 links[i].setAttribute("target", "_blank");
177 } 183 }
178 else if (typeof curArg == "function") 184 else if (typeof curArg == "function")
179 { 185 {
180 links[i].href = "javascript:void(0);"; 186 links[i].href = "javascript:void(0);";
181 links[i].addEventListener("click", curArg, false); 187 links[i].addEventListener("click", curArg, false);
182 } 188 }
183 } 189 }
184 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld