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 I didn't install Adblock Plus.}}"], | |
11 ["2v0", "{{reason-slowing-down Adblock Plus slowed down my browser.}}"], | |
12 ["3v0", "{{reason-acceptable-ads I don't like the Acceptable Ads program.} }"], | |
13 ["4v0", "{{reason-see-ads Adblock Plus didn't block all ads.}}"], | |
14 ["5v0", "{{reason-better-adblocker I found better ad blocking software.}}" ], | |
15 ["6v0", "{{reason-break-websites 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 | |
kzar
2015/11/20 13:06:13
Nit: Capitalize "create" to match the comment belo
saroyanm
2015/11/20 18:33:54
Done.
| |
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]); | |
32 input.setAttribute("value", paramSplit[1]); | |
33 form.appendChild(input); | |
34 }); | |
35 | |
36 // Randomly add reasons | |
37 while (reasons.length > 0) | |
kzar
2015/11/20 13:06:13
Would it make more sense to use a for loop here? S
saroyanm
2015/11/20 18:33:53
Not sure why it makes more sense. From my point of
kzar
2015/11/21 19:01:24
Well in your current implementation you're (re)dec
saroyanm
2015/11/23 10:50:29
Well, with your implementation we also generating
| |
38 { | |
39 var randomIndex = Math.floor(Math.random() * (reasons.length)); | |
40 var reason = reasons.splice(randomIndex, 1)[0]; | |
41 var listElement = document.createElement("li"); | |
42 var labelElement = document.createElement("label"); | |
43 var checkboxElement = document.createElement("input"); | |
44 checkboxElement.setAttribute("type", "checkbox"); | |
45 checkboxElement.setAttribute("name", "reason"); | |
46 checkboxElement.setAttribute("value", reason[0]); | |
47 var spanElement = document.createElement("span"); | |
48 spanElement.innerHTML = reason[1]; | |
49 labelElement.appendChild(checkboxElement); | |
50 labelElement.appendChild(spanElement); | |
51 listElement.appendChild(labelElement); | |
52 var reasonContainer = document.getElementById("reasons"); | |
53 reasonContainer.insertBefore(listElement, reasonContainer.firstChild); | |
54 } | |
55 | |
56 document.getElementById("reason-other").addEventListener("change", | |
57 function() | |
58 { | |
59 var textArea = document.getElementById("reason-other-input"); | |
60 textArea.hasAttribute("class") ? textArea.removeAttribute("class") : | |
61 textArea.setAttribute("class", "hidden"); | |
62 }, false); | |
63 | |
64 document.getElementById("submit-form").addEventListener("click", | |
65 function(event) | |
66 { | |
67 if (!document.querySelector("ul input:checked")) | |
68 { | |
69 event.preventDefault(); | |
70 form.setAttribute("class", "error"); | |
71 } | |
72 else | |
73 form.submit(); | |
74 }, false); | |
75 } | |
76 document.addEventListener("DOMContentLoaded", init, false); | |
77 })(); | |
78 </script> | |
79 </head> | |
80 | |
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 <noscript> | |
96 <span>{{noscript[No script notification] Form can not be submited with disab led JavaScript}}</span> | |
kzar
2015/11/20 13:06:14
If the user doesn't have JavaScript then we can't
saroyanm
2015/11/20 18:33:53
Can see any good way to do that.
I've just removed
kzar
2015/11/21 19:01:24
Perhaps we should discuss what should happen for n
saroyanm
2015/11/23 10:50:29
I can see a reason of discussing this question in
| |
97 </noscript> | |
98 </form> | |
99 | |
100 {{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).}} | |
101 {: .disclaimer } | |
OLD | NEW |