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: move include files content to markdown Created Nov. 27, 2015, 1:07 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') | templates/simple.tmpl » ('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,99 @@
+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[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
+ ["2v0", "{{reason-slowing-down[reason] Adblock Plus slowed down my browser.}}"],
+ ["3v0", "{{reason-acceptable-ads[reason] I don't like the Acceptable Ads program.}}"],
+ ["4v0", "{{reason-see-ads[reason] Adblock Plus didn't block all ads.}}"],
+ ["5v0", "{{reason-better-adblocker[reason] I found better ad blocking software.}}"],
+ ["6v0", "{{reason-break-websites[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]);
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
+ input.setAttribute("value", paramSplit[1]);
+ form.appendChild(input);
+ });
+
+ // Randomly add reasons
+ for (var i = reasons.length; i > 0; i -= 1)
+ {
+ var reason = reasons.splice(Math.floor(Math.random() * i), 1)[0];
+ var listElement = document.createElement("li");
+ 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.
+ var checkboxElement = document.createElement("input");
+ checkboxElement.setAttribute("type", "checkbox");
+ 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.
+ checkboxElement.setAttribute("value", reason[0]);
+ var spanElement = document.createElement("span");
+ spanElement.innerHTML = reason[1];
+ labelElement.appendChild(checkboxElement);
+ labelElement.appendChild(spanElement);
+ listElement.appendChild(labelElement);
+ var reasonContainer = document.getElementById("reasons");
+ reasonContainer.insertBefore(listElement, reasonContainer.firstChild);
+ }
+
+ document.getElementById("reason-other").addEventListener("change",
+ 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.
+ {
+ var textArea = document.getElementById("reason-other-input");
+ 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.
+ textArea.setAttribute("class", "hidden");
+ }, false);
+
+ document.getElementById("submit-form").addEventListener("click",
+ function(event)
+ {
+ if (!document.querySelector("ul input:checked"))
+ {
+ event.preventDefault();
+ form.setAttribute("class", "error");
+ }
+ else
+ 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.
+ }, false);
+ }
+ document.addEventListener("DOMContentLoaded", init, false);
+ })();
+ </script>
+</head>
+
+<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.
+#{{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>
+ <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).}}
+{: .disclaimer }
+</section>
« no previous file with comments | « no previous file | pages/uninstall-abp-submit.md » ('j') | templates/simple.tmpl » ('J')

Powered by Google App Engine
This is Rietveld