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

Delta Between Two Patch Sets: html/static/js/firstRun.js

Issue 5024350814076928: Issue 1103 - Migrate Simple Adblock users
Left Patch Set: Created March 24, 2015, 7:44 a.m.
Right Patch Set: Use registry instead of prefs for storing the Simple Adblock mark Created Aug. 7, 2015, 10:34 a.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
LEFTRIGHT
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.isFromSimpleAdblock() ? "first-run-title-simple-ad block" : 108 "title-main": AdblockPlus.getConversion() == "simpleadblock" ? "first-run-ti tle-simple-adblock" :
Eric 2015/03/27 12:51:45 It seems that the string "first-run-title-simple-a
Oleksandr 2015/04/16 09:58:09 We have to hardcode this logic somewhere. I think
109 AdblockPlus.isUpdate() ? "first-run-title-update" : "first-run-title-install", 109 AdblockPlus.isUpdate() ? "first-run-title-update" : "first-run-title-install",
110 "share-donate": "first-run-share2-donate", 110 "share-donate": "first-run-share2-donate",
111 "share-text": "first-run-share2", 111 "share-text": "first-run-share2",
112 "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"
113 }; 115 };
114 116
115 document.title = AdblockPlus.getMessage("first-run", mapping['title-main']); 117 document.title = AdblockPlus.getMessage("first-run", mapping['title-main']);
116 for (var i in mapping) 118 for (var i in mapping)
117 { 119 {
118 var element = document.getElementById(i); 120 var element = document.getElementById(i);
119 setElementText(element, AdblockPlus.getMessage("first-run", mapping[i])); 121 setElementText(element, AdblockPlus.getMessage("first-run", mapping[i]));
120 } 122 }
121 } 123 }
122 124
123 function init() 125 function init()
124 { 126 {
125 initTranslations(); 127 initTranslations();
126 initSocialLinks(); 128 initSocialLinks();
127 setLinks("aa-text", getDocLink("acceptable_ads_criteria"), "index.html"); 129 setLinks("aa-text", getDocLink("acceptable_ads_criteria"), "index.html");
128 130
131 if (AdblockPlus.getConversion() == "simpleadblock") {
132 document.getElementById("upgrade-from-other-plugin").style.display = "block" ;
133 }
129 var donateLink = document.getElementById("share-donate"); 134 var donateLink = document.getElementById("share-donate");
130 donateLink.href = getDocLink("donate"); 135 donateLink.href = getDocLink("donate");
131 } 136 }
132 137
133 // 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
134 // 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
135 // placeholders in the i18n message. 140 // placeholders in the i18n message.
136 setElementText = function(element, elementHtml) 141 setElementText = function(element, elementHtml)
137 { 142 {
138 function processString(str, element) 143 function processString(str, element)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 links[i].href = curArg; 181 links[i].href = curArg;
177 links[i].setAttribute("target", "_blank"); 182 links[i].setAttribute("target", "_blank");
178 } 183 }
179 else if (typeof curArg == "function") 184 else if (typeof curArg == "function")
180 { 185 {
181 links[i].href = "javascript:void(0);"; 186 links[i].href = "javascript:void(0);";
182 links[i].addEventListener("click", curArg, false); 187 links[i].addEventListener("click", curArg, false);
183 } 188 }
184 } 189 }
185 } 190 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld