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: Generate reasons in HTML then shuffle them Created Dec. 2, 2015, 6:43 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.")
(...skipping 17 matching lines...) Expand all
28 var paramSplit = param.split("="); 28 var paramSplit = param.split("=");
29 var input = document.createElement("input"); 29 var input = document.createElement("input");
30 input.setAttribute("type", "hidden"); 30 input.setAttribute("type", "hidden");
31 input.setAttribute("name", paramSplit[0]); 31 input.setAttribute("name", paramSplit[0]);
32 input.setAttribute("value", paramSplit[1]); 32 input.setAttribute("value", paramSplit[1]);
33 form.appendChild(input); 33 form.appendChild(input);
34 }); 34 });
35 35
36 // Randomly add reasons 36 // Randomly add reasons
37 var reasonsContainer = document.getElementById("reasons"); 37 var reasonsContainer = document.getElementById("reasons");
38 var reasons = reasonsContainer.cloneNode(true).getElementsByTagName("li"); 38 var reasons = reasonsContainer.getElementsByTagName("li");
Thomas Greiner 2015/12/03 12:07:28 Why do you clone the container? All you seem to do
Thomas Greiner 2015/12/03 12:07:28 `reasons` will also include `#reason-other` which
saroyanm 2015/12/03 13:06:57 I'm removing the lists from the HTML, that means t
saroyanm 2015/12/03 13:06:57 Yes that why I'm using "reasons.length - 1" for ge
Thomas Greiner 2015/12/03 13:47:37 Ok.
Thomas Greiner 2015/12/03 13:47:37 You can keep the references to the DOM elements in
saroyanm 2015/12/03 13:57:10 Fare enough :)
39 reasons = Array.prototype.slice.call(reasons);
39 reasonsContainer.innerHTML = ""; 40 reasonsContainer.innerHTML = "";
40 var reasons = Array.prototype.slice.call(reasons);
Thomas Greiner 2015/12/03 12:07:29 `reasons` has already been declared so there shoul
saroyanm 2015/12/03 13:06:57 Done.
41 while (reasons.length) 41 while (reasons.length)
42 { 42 {
43 var randomIndex = Math.floor(Math.random() * (reasons.length -1)); 43 var randomIndex = Math.floor(Math.random() * (reasons.length -1));
Thomas Greiner 2015/12/03 12:07:30 Why did you change it to `reasons.length - 1`? The
saroyanm 2015/12/03 13:06:58 Sure, please see my comment above I'm doing so to
44 var reasonElement = reasons.splice(randomIndex, 1)[0]; 44 var reasonElement = reasons.splice(randomIndex, 1)[0];
45 reasonsContainer.appendChild(reasonElement); 45 reasonsContainer.appendChild(reasonElement);
46 } 46 }
47 47
48 var reasonOtherCheckbox = document.getElementById("reason-other"); 48 var reasonOtherCheckbox = document.getElementById("reason-other");
49 reasonOtherCheckbox.addEventListener("change", function() 49 reasonOtherCheckbox.addEventListener("change", function()
50 { 50 {
51 var textArea = document.getElementById("reason-other-input"); 51 var textArea = document.getElementById("reason-other-input");
52 if (textArea.hasAttribute("class")) 52 if (textArea.hasAttribute("class"))
53 textArea.removeAttribute("class") 53 textArea.removeAttribute("class")
(...skipping 21 matching lines...) Expand all
75 </head> 75 </head>
76 76
77 <section class="highlighted"> 77 <section class="highlighted">
78 <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>
79 <form id="reasons-form" action="uninstall-abp-submit" method="post"> 79 <form id="reasons-form" action="uninstall-abp-submit" method="post">
80 <ul id="reasons"> 80 <ul id="reasons">
81 {%- for reasonId, stringId, value in reasons %} 81 {%- for reasonId, stringId, value in reasons %}
82 <li> 82 <li>
83 <label> 83 <label>
84 <input type="checkbox" name="reason" value="{{reasonId}}" /> 84 <input type="checkbox" name="reason" value="{{reasonId}}" />
85 <span>{{value|translate(stringId, "Uninstallation reason")}}</span> 85 {{value|translate(stringId, "Uninstallation reason")}}
Thomas Greiner 2015/12/03 12:07:29 I thought there's no need for having a `<span>` he
saroyanm 2015/12/03 13:06:59 Ahh right, totally forgot, thanks for the reminder
86 </label> 86 </label>
87 </li> 87 </li>
88 {%- endfor %} 88 {%- endfor %}
89 <li> 89 <li>
90 <label> 90 <label>
91 <input id="reason-other" type="checkbox" name="reason" value="0v0" /> 91 <input id="reason-other" type="checkbox" name="reason" value="0v0" />
92 <span>{{"Other, namely..."|translate("reason-other", "Last uninstallat ion reason")}}</span> 92 {{"Other, namely..."|translate("reason-other", "Last uninstallation re ason")}}
93 </label> 93 </label>
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> 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>
95 </li> 95 </li>
96 </ul> 96 </ul>
97 <button id="submit-form">{{"Submit"|translate("submit", "Submit button text" )}}</button> 97 <button id="submit-form">{{"Submit"|translate("submit", "Submit button text" )}}</button>
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> 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>
99 </form> 99 </form>
100 <p class="disclaimer"> 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")}} 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> 102 </p>
103 </section> 103 </section>
LEFTRIGHT

Powered by Google App Engine
This is Rietveld