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

Delta Between Two Patch Sets: pages/uninstall-abp.tmpl

Issue 29329984: Issue 3257 - Create uninstallation page in adblockplus.org (Closed)
Left Patch Set: Addressed Dave comments Created Nov. 17, 2015, 3:21 p.m.
Right Patch Set: Convert to array instead of cloning Created Dec. 3, 2015, 1:55 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 | « no previous file | pages/uninstall-abp-submit.md » ('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 title=Adblock Plus has been uninstalled 1 title=Adblock Plus has been uninstalled
2 template=simple 2 template=simple
3 3
4 {% set reasons = [ 4 {% set reasons = [
5 ("1v0", "reason-not-installed", "I didn't install Adblock Plus."), 5 ("1v0", "reason-not-installed", "I didn't install Adblock Plus."),
6 ("2v0", "reason-slowing-down", "Adblock Plus slowed down my browser."), 6 ("2v0", "reason-slowing-down", "Adblock Plus slowed down my browser."),
7 ("3v0", "reason-acceptable-ads", "I don't like the Acceptable Ads program.") , 7 ("3v0", "reason-acceptable-ads", "I don't like the Acceptable Ads program."),
8 ("4v0", "reason-see-ads", "Adblock Plus didn't block all ads."), 8 ("4v0", "reason-see-ads", "Adblock Plus didn't block all ads."),
9 ("5v0", "reason-better-adblocker", "I found better ad blocking software."), 9 ("5v0", "reason-better-adblocker", "I found better ad blocking software."),
10 ("6v0", "reason-break-websites", "Adblock Plus breaks websites that I visit. ") 10 ("6v0", "reason-break-websites", "Adblock Plus breaks websites that I visit.")
11 ] %} 11 ] %}
12 12
13 <head> 13 <head>
14 <meta name="robots" content="noindex" /> 14 <meta name="robots" content="noindex" />
15
16 <script type="text/javascript"> 15 <script type="text/javascript">
17 (function() 16 (function()
18 { 17 {
19 function init() 18 function init()
20 { 19 {
21 var form = document.getElementById("reasons-form"); 20 var form = document.getElementById("reasons-form");
21
22 // Create hidden input for GET parameters
22 window.location.search.substr(1).split("&").forEach(function(param) 23 window.location.search.substr(1).split("&").forEach(function(param)
23 { 24 {
24 if (!/.=./.test(param)) 25 if (!/.=./.test(param))
25 return; 26 return;
26 27
27 var paramSplit = param.split("="); 28 var paramSplit = param.split("=");
28 var input = document.createElement("input"); 29 var input = document.createElement("input");
29 input.setAttribute("type", "hidden"); 30 input.setAttribute("type", "hidden");
30 input.setAttribute("name", paramSplit[0]); 31 input.setAttribute("name", paramSplit[0]);
31 input.setAttribute("value", paramSplit[1]); 32 input.setAttribute("value", paramSplit[1]);
32 form.appendChild(input); 33 form.appendChild(input);
33 }); 34 });
34 35
36 // Randomly add reasons
35 var reasonsContainer = document.getElementById("reasons"); 37 var reasonsContainer = document.getElementById("reasons");
36 var reasons = reasonsContainer.cloneNode(true).getElementsByTagName("li"); 38 var reasons = reasonsContainer.getElementsByTagName("li");
39 reasons = Array.prototype.slice.call(reasons);
37 reasonsContainer.innerHTML = ""; 40 reasonsContainer.innerHTML = "";
38 var reasons = Array.prototype.slice.call(reasons); 41 while (reasons.length)
39 while (reasons.length > 0)
40 { 42 {
41 var randomIndex = Math.floor(Math.random() * (reasons.length -1)); 43 var randomIndex = Math.floor(Math.random() * (reasons.length -1));
42 var reasonElement = reasons.splice(randomIndex, 1)[0]; 44 var reasonElement = reasons.splice(randomIndex, 1)[0];
43 reasonsContainer.appendChild(reasonElement); 45 reasonsContainer.appendChild(reasonElement);
44 } 46 }
45 47
46 document.getElementById("reason-other").addEventListener("change", 48 var reasonOtherCheckbox = document.getElementById("reason-other");
47 function() 49 reasonOtherCheckbox.addEventListener("change", function()
48 { 50 {
49 var textArea = document.getElementById("reason-other-input"); 51 var textArea = document.getElementById("reason-other-input");
50 textArea.hasAttribute("class") ? textArea.removeAttribute("class") : 52 if (textArea.hasAttribute("class"))
51 textArea.setAttribute("class", "hidden"); 53 textArea.removeAttribute("class")
54 else
55 textArea.setAttribute("class", "hidden");
52 }, false); 56 }, false);
53 57
54 document.getElementById("submit-form").addEventListener("click", 58 var submitButton = document.getElementById("submit-form");
55 function(event) 59 submitButton.addEventListener("click", function(event)
56 { 60 {
57 if (!document.querySelector("ul input:checked")) 61 if (!document.querySelector("ul input:checked"))
58 { 62 {
59 event.preventDefault(); 63 event.preventDefault();
60 form.setAttribute("class", "error"); 64 form.setAttribute("class", "error");
65 }
66 else
67 {
68 form.submit();
61 } 69 }
62 }, false); 70 }, false);
63 } 71 }
64 document.addEventListener("DOMContentLoaded", init, false); 72 document.addEventListener("DOMContentLoaded", init, false);
65 })(); 73 })();
66 </script> 74 </script>
67 </head> 75 </head>
76
68 <section class="highlighted"> 77 <section class="highlighted">
69 <h1>{{"Please select the reason(s) why you uninstalled Adblock Plus:"|translat e("reasons-header", "Form heading")}}</h1> 78 <h1>{{"Please select the reason(s) why you uninstalled Adblock Plus:"|translat e("reasons-header", "Form heading")}}</h1>
70 <form id="reasons-form" action="uninstall-abp-submit" method="post"> 79 <form id="reasons-form" action="uninstall-abp-submit" method="post">
71 <ul id="reasons"> 80 <ul id="reasons">
72 {%- for reasonId, stringId, value in reasons|shuffle %} 81 {%- for reasonId, stringId, value in reasons %}
73 <li> 82 <li>
74 <label> 83 <label>
75 <input type="checkbox" name="reason" value="{{reasonId}}" /> 84 <input type="checkbox" name="reason" value="{{reasonId}}" />
76 <span>{{value|translate(stringId, "One of the listed uninstallation re ason")}}</span> 85 {{value|translate(stringId, "Uninstallation reason")}}
77 </label> 86 </label>
78 </li> 87 </li>
79 {%- endfor %} 88 {%- endfor %}
80 <li> 89 <li>
81 <label> 90 <label>
82 <input id="reason-other" type="checkbox" name="reason" value="0v0" /> 91 <input id="reason-other" type="checkbox" name="reason" value="0v0" />
83 <span>{{"Other, namely..."|translate("reason-other", "Last uninstallat ion reason")}}</span> 92 {{"Other, namely..."|translate("reason-other", "Last uninstallation re ason")}}
84 </label> 93 </label>
85 <textarea id="reason-other-input" class="hidden" name="reasonOther" plac eholder="{{"Please explain why you are uninstalling Adblock Plus"|translate("rea son-other-placeholder", "Textarea placeholder text, appears after selecting 'Oth er, namely...' option")}}"></textarea> 94 <textarea id="reason-other-input" class="hidden" name="reasonOther" plac eholder="{{"Please explain why you are uninstalling Adblock Plus"|translate("rea son-other-placeholder", "Textarea placeholder text, appears after selecting 'Oth er, namely...' option")}}"></textarea>
86 </li> 95 </li>
87 </ul> 96 </ul>
88 <button id="submit-form" type="submit">{{"Submit"|translate("submit", "Submi t button text")}}</button> 97 <button id="submit-form">{{"Submit"|translate("submit", "Submit button text" )}}</button>
89 <span class="error-label">{{"Please select at least one of the options above "|translate("error-msg", "Error message, is being shown after submission if no i tem selected")}}</span> 98 <span class="error-label">{{"Please select at least one of the options above "|translate("error-msg", "Error message, is being shown after submission if no i tem selected")}}</span>
90 </form> 99 </form>
91 <p class="disclaimer">{{"By clicking Submit, you are sending your response to Adblock Plus. Please see our <a href='https://adblockplus.org/privacy'>privacy p olicy</a>."|translate("disclaimer", "Disclaimer below form")}}</p> 100 <p class="disclaimer">
101 {{"By clicking Submit, you are sending your response to Adblock Plus. Please see our <a href='/privacy'>privacy policy</a>."|translate("disclaimer", "Discla imer below form")}}
102 </p>
92 </section> 103 </section>
LEFTRIGHT

Powered by Google App Engine
This is Rietveld