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

Unified Diff: pages/uninstall-abp.tmpl

Issue 29329984: Issue 3257 - Create uninstallation page in adblockplus.org (Closed)
Patch Set: Fix editor readability, use for loop to randomly generate the list Created Nov. 23, 2015, 10:49 a.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 | « includes/uninstall-abp-submit.md ('k') | pages/uninstall-abp-submit.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pages/uninstall-abp.tmpl
===================================================================
new file mode 100644
--- /dev/null
+++ b/pages/uninstall-abp.tmpl
@@ -0,0 +1,82 @@
+title=Adblock Plus has been uninstalled
+template=simple
+
+<head>
+ <meta name="robots" content="noindex" />
+ <script type="text/javascript">
+ (function()
+ {
+ var reasons = [
+ ["1v0", "{{'I didn\'t install Adblock Plus.'|translate('reason-not-installed', 'reason')}}"],
+ ["2v0", "{{'Adblock Plus slowed down my browser.'|translate('reason-slowing-down', 'reason')}}"],
+ ["3v0", "{{'I don\'t like the Acceptable Ads program.'|translate('reason-acceptable-ads', 'reason')}}"],
+ ["4v0", "{{'Adblock Plus didn\'t block all ads.'|translate('reason-see-ads', 'reason')}}"],
+ ["5v0", "{{'I found better ad blocking software.'|translate('reason-better-adblocker', 'reason')}}"],
+ ["6v0", "{{'Adblock Plus breaks websites that I visit.'|translate('reason-break-websites', 'reason')}}"]
+ ];
+
+ 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)
+ {
+ var reason = reasons.splice(Math.floor(Math.random() * i), 1)[0];
+ 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];
+ 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()
+ {
+ var textArea = document.getElementById("reason-other-input");
+ textArea.hasAttribute("class") ? textArea.removeAttribute("class") :
+ 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();
+ }, false);
+ }
+ document.addEventListener("DOMContentLoaded", init, false);
+ })();
+ </script>
+</head>
+
+<section class="highlighted">
+<? include uninstall-abp ?>
+</section>
« no previous file with comments | « includes/uninstall-abp-submit.md ('k') | pages/uninstall-abp-submit.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld