Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 title=Adblock Plus has been uninstalled | |
2 template=simple | |
3 | |
4 <head> | |
5 <meta name="robots" content="noindex" /> | |
6 <script type="text/javascript"> | |
7 (function() | |
8 { | |
9 var reasons = [ | |
10 ["1v0", "{{reason-not-installed[reason] I didn't install Adblock Plus.}}"] , | |
kzar
2015/11/27 13:38:38
Did you forget to fill out the descriptions for th
saroyanm
2015/11/27 14:26:39
No, the description is -> reason, but I've updated
| |
11 ["2v0", "{{reason-slowing-down[reason] Adblock Plus slowed down my browser .}}"], | |
12 ["3v0", "{{reason-acceptable-ads[reason] I don't like the Acceptable Ads p rogram.}}"], | |
13 ["4v0", "{{reason-see-ads[reason] Adblock Plus didn't block all ads.}}"], | |
14 ["5v0", "{{reason-better-adblocker[reason] I found better ad blocking soft ware.}}"], | |
15 ["6v0", "{{reason-break-websites[reason] Adblock Plus breaks websites that I visit.}}"] | |
16 ]; | |
17 | |
18 function init() | |
19 { | |
20 var form = document.getElementById("reasons-form"); | |
21 | |
22 // Create hidden input for GET parameters | |
23 window.location.search.substr(1).split("&").forEach(function(param) | |
24 { | |
25 if (!/.=./.test(param)) | |
26 return; | |
27 | |
28 var paramSplit = param.split("="); | |
29 var input = document.createElement("input"); | |
30 input.setAttribute("type", "hidden"); | |
31 input.setAttribute("name", paramSplit[0]); | |
kzar
2015/11/27 13:38:39
I _think_ it's OK but have you double checked that
saroyanm
2015/11/27 14:26:39
We should be fine using setAttribute the value sho
| |
32 input.setAttribute("value", paramSplit[1]); | |
33 form.appendChild(input); | |
34 }); | |
35 | |
36 // Randomly add reasons | |
37 for (var i = reasons.length; i > 0; i -= 1) | |
38 { | |
39 var reason = reasons.splice(Math.floor(Math.random() * i), 1)[0]; | |
40 var listElement = document.createElement("li"); | |
41 var labelElement = document.createElement("label"); | |
kzar
2015/11/27 13:38:38
Perhaps we should give the labels "for" attributes
saroyanm
2015/11/27 14:26:39
No, in that case I'll need redundant id assigned t
kzar
2015/11/27 14:30:42
Acknowledged.
| |
42 var checkboxElement = document.createElement("input"); | |
43 checkboxElement.setAttribute("type", "checkbox"); | |
44 checkboxElement.setAttribute("name", "reason"); | |
kzar
2015/11/27 13:38:37
Did you mean to give all the reason checkboxes the
saroyanm
2015/11/27 14:26:40
Yes, exactly, it was intentional.
| |
45 checkboxElement.setAttribute("value", reason[0]); | |
46 var spanElement = document.createElement("span"); | |
47 spanElement.innerHTML = reason[1]; | |
48 labelElement.appendChild(checkboxElement); | |
49 labelElement.appendChild(spanElement); | |
50 listElement.appendChild(labelElement); | |
51 var reasonContainer = document.getElementById("reasons"); | |
52 reasonContainer.insertBefore(listElement, reasonContainer.firstChild); | |
53 } | |
54 | |
55 document.getElementById("reason-other").addEventListener("change", | |
56 function() | |
kzar
2015/11/27 13:38:39
Nit: Shouldn't the function be indented a couple m
saroyanm
2015/11/27 14:26:41
If be honest it looks bit weird and I had to inden
kzar
2015/11/27 14:30:41
Acknowledged.
| |
57 { | |
58 var textArea = document.getElementById("reason-other-input"); | |
59 textArea.hasAttribute("class") ? textArea.removeAttribute("class") : | |
kzar
2015/11/27 13:38:38
Nit: Indentation here seems weird, maybe it would
saroyanm
2015/11/27 14:26:38
Done.
| |
60 textArea.setAttribute("class", "hidden"); | |
61 }, false); | |
62 | |
63 document.getElementById("submit-form").addEventListener("click", | |
64 function(event) | |
65 { | |
66 if (!document.querySelector("ul input:checked")) | |
67 { | |
68 event.preventDefault(); | |
69 form.setAttribute("class", "error"); | |
70 } | |
71 else | |
72 form.submit(); | |
kzar
2015/11/27 13:38:37
Nit: I've been told before that with if ... else .
saroyanm
2015/11/27 14:26:38
Done.
| |
73 }, false); | |
74 } | |
75 document.addEventListener("DOMContentLoaded", init, false); | |
76 })(); | |
77 </script> | |
78 </head> | |
79 | |
80 <section markdown="1" class="highlighted"> | |
kzar
2015/11/27 13:38:39
Nit: Shouldn't the contents of <section> be indent
saroyanm
2015/11/27 14:26:40
According to the Python example no, I've also trie
kzar
2015/11/27 14:30:41
Acknowledged.
| |
81 #{{reasons-header[Form heading] Please select the reason(s) why you uninstalled Adblock Plus:}} | |
82 | |
83 <form id="reasons-form" action="uninstall-abp-submit" method="post"> | |
84 <ul id="reasons"> | |
85 <li> | |
86 <label> | |
87 <input id="reason-other" type="checkbox" name="reason" value="0v0" /> | |
88 <span>{{reason-other[Last uninstallation reason] Other, namely...}}</spa n> | |
89 </label> | |
90 <textarea id="reason-other-input" class="hidden" name="reasonOther" placeh older="{{reason-other-placeholder[Textarea placeholder text, appears after selec ting 'Other, namely...' option] Please explain why you are uninstalling Adblock Plus}}"></textarea> | |
91 </li> | |
92 </ul> | |
93 <button id="submit-form" type="button">{{submit[Submit button text] Submit}}</ button> | |
94 <span class="error-label">{{error-msg[Error message, is being shown after subm ission if no item selected] Please select at least one of the options above}}</s pan> | |
95 </form> | |
96 | |
97 {{disclaimer[Disclaimer below form] By clicking Submit, you are sending your res ponse to Adblock Plus. Please see our [privacy policy](https://adblockplus.org/p rivacy).}} | |
98 {: .disclaimer } | |
99 </section> | |
OLD | NEW |