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

Unified Diff: pages/uninstall-abp.md

Issue 29329984: Issue 3257 - Create uninstallation page in adblockplus.org (Closed)
Patch Set: Addressed Dave comments Created Nov. 27, 2015, 2:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pages/uninstall-abp-submit.md » ('j') | pages/uninstall-abp-submit.md » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pages/uninstall-abp.md
===================================================================
new file mode 100644
--- /dev/null
+++ b/pages/uninstall-abp.md
@@ -0,0 +1,103 @@
+title=Adblock Plus has been uninstalled
+template=simple
+
+<head>
+ <meta name="robots" content="noindex" />
+ <script type="text/javascript">
+ (function()
+ {
+ var reasons = [
+ ["1v0", "{{reason-not-installed[Uninstallation reason] I didn't install Adblock Plus.}}"],
Thomas Greiner 2015/11/27 19:10:13 This code may break if the translated text contain
kzar 2015/11/28 16:25:14 No, I already checked and they are escaped. Just t
Thomas Greiner 2015/11/30 17:09:07 Thanks for checking. Should be fine then.
+ ["2v0", "{{reason-slowing-down[Uninstallation reason] Adblock Plus slowed down my browser.}}"],
+ ["3v0", "{{reason-acceptable-ads[Uninstallation reason] I don't like the Acceptable Ads program.}}"],
+ ["4v0", "{{reason-see-ads[Uninstallation reason] Adblock Plus didn't block all ads.}}"],
+ ["5v0", "{{reason-better-adblocker[Uninstallation reason] I found better ad blocking software.}}"],
+ ["6v0", "{{reason-break-websites[Uninstallation reason] Adblock Plus breaks websites that I visit.}}"]
+ ];
+
+ function init()
+ {
+ var form = document.getElementById("reasons-form");
+
+ // Create hidden input for GET parameters
+ window.location.search.substr(1).split("&").forEach(function(param)
+ {
+ if (!/.=./.test(param))
+ return;
+
+ var paramSplit = param.split("=");
+ var input = document.createElement("input");
+ input.setAttribute("type", "hidden");
+ input.setAttribute("name", paramSplit[0]);
+ input.setAttribute("value", paramSplit[1]);
+ form.appendChild(input);
+ });
+
+ // Randomly add reasons
+ for (var i = reasons.length; i > 0; i -= 1)
Thomas Greiner 2015/11/27 19:10:11 Detail: Actually, you don't even need the `i` vari
saroyanm 2015/11/30 10:27:05 Please check current discussion, I'm also in favor
kzar 2015/11/30 10:49:10 I don't mind at all how this code is implemented,
Thomas Greiner 2015/11/30 17:09:06 I would consider the original solution simpler tha
saroyanm 2015/11/30 18:04:43 Done.
+ {
+ var reason = reasons.splice(Math.floor(Math.random() * i), 1)[0];
Thomas Greiner 2015/11/27 19:10:12 You should create a copy of `reasons` before the l
kzar 2015/11/28 16:25:14 Well we're not looping through the reasons array,
Thomas Greiner 2015/11/30 17:09:06 Must've forgotten to remove that comment after I r
+ var listElement = document.createElement("li");
+ var labelElement = document.createElement("label");
+ var checkboxElement = document.createElement("input");
+ checkboxElement.setAttribute("type", "checkbox");
+ checkboxElement.setAttribute("name", "reason");
+ checkboxElement.setAttribute("value", reason[0]);
+ var spanElement = document.createElement("span");
+ spanElement.innerHTML = reason[1];
Thomas Greiner 2015/11/27 19:10:13 `reason[1]` doesn't appear to include any HTML so
saroyanm 2015/11/30 10:27:05 The reason why I used span, is that I wanted the t
Thomas Greiner 2015/11/30 17:09:07 That appears a bit odd given that the style guide
saroyanm 2015/11/30 18:04:43 I guess we initially implemented something similar
Thomas Greiner 2015/12/02 16:41:04 Personally, I'd prefer avoid using `innerHTML` and
Thomas Greiner 2015/12/02 16:41:04 In case you missed it from the comment above… On
saroyanm 2015/12/02 18:47:58 Done.
+ labelElement.appendChild(checkboxElement);
+ labelElement.appendChild(spanElement);
+ listElement.appendChild(labelElement);
+ var reasonContainer = document.getElementById("reasons");
+ reasonContainer.insertBefore(listElement, reasonContainer.firstChild);
+ }
+
+ var reasonOtherCheckbox = document.getElementById("reason-other");
+ reasonOtherCheckbox.addEventListener("change", function()
+ {
+ var textArea = document.getElementById("reason-other-input");
+ if (textArea.hasAttribute("class"))
+ textArea.removeAttribute("class")
+ else
+ textArea.setAttribute("class", "hidden");
+ }, false);
+
+ var submitButton = document.getElementById("submit-form");
+ submitButton.addEventListener("click", function(event)
+ {
+ if (!document.querySelector("ul input:checked"))
+ {
+ event.preventDefault();
+ form.setAttribute("class", "error");
+ }
+ else
+ {
+ form.submit();
+ }
+ }, false);
+ }
+ document.addEventListener("DOMContentLoaded", init, false);
+ })();
+ </script>
+</head>
+
+<section markdown="1" class="highlighted">
+#{{reasons-header[Form heading] Please select the reason(s) why you uninstalled Adblock Plus:}}
+
+<form id="reasons-form" action="uninstall-abp-submit" method="post">
+ <ul id="reasons">
+ <li>
+ <label>
+ <input id="reason-other" type="checkbox" name="reason" value="0v0" />
+ <span>{{reason-other[Last uninstallation reason] Other, namely...}}</span>
+ </label>
+ <textarea id="reason-other-input" class="hidden" name="reasonOther" placeholder="{{reason-other-placeholder[Textarea placeholder text, appears after selecting 'Other, namely...' option] Please explain why you are uninstalling Adblock Plus}}"></textarea>
+ </li>
+ </ul>
+ <button id="submit-form" type="button">{{submit[Submit button text] Submit}}</button>
Thomas Greiner 2015/11/27 19:10:12 Detail: It's a `<button>` element so isn't the `ty
saroyanm 2015/11/30 10:27:06 Done.
+ <span class="error-label">{{error-msg[Error message, is being shown after submission if no item selected] Please select at least one of the options above}}</span>
+</form>
+
+{{disclaimer[Disclaimer below form] By clicking Submit, you are sending your response to Adblock Plus. Please see our [privacy policy](https://adblockplus.org/privacy).}}
Thomas Greiner 2015/11/27 19:10:12 Detail: This page is located on https://adblockplu
saroyanm 2015/11/30 10:27:06 Done.
+{: .disclaimer }
+</section>
« no previous file with comments | « no previous file | pages/uninstall-abp-submit.md » ('j') | pages/uninstall-abp-submit.md » ('J')

Powered by Google App Engine
This is Rietveld