summaryrefslogtreecommitdiff
path: root/js/rules-popup.js
diff options
context:
space:
mode:
authorMilosz Kwiatkowski <m.kiwi2000@gmail.com>2016-08-20 14:31:49 +0100
committerMilosz Kwiatkowski <m.kiwi2000@gmail.com>2016-08-20 14:31:49 +0100
commitc3bfb8635649213535059ea0deacbc0bfb1c0d40 (patch)
tree0a08fe2d5f7336e6eec88cbc6c234a2131c3731a /js/rules-popup.js
parent0678b74b7afed7eade5415d2b2cd4cd619c4bc89 (diff)
add rules agreement page
Diffstat (limited to 'js/rules-popup.js')
-rw-r--r--js/rules-popup.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/rules-popup.js b/js/rules-popup.js
new file mode 100644
index 00000000..a94db90e
--- /dev/null
+++ b/js/rules-popup.js
@@ -0,0 +1,51 @@
+/*
+ * rules-popup.js
+ * https://github.com/mkwia/lainchan/js/rules-popup.js
+ *
+ * Forces user to accept rules from /rules.txt on first welcome
+ *
+ * 2016 mkwia <github.com/mkwia>
+ *
+ * Usage:
+ * $config['additional_javascript'][] = 'js/jquery.min.js';
+ * $config['additional_javascript'][] = 'js/rules-popup.js';
+ *
+ */
+
+$(function() {
+ if (typeof localStorage.rulesAccepted === "undefined") + function(c) {
+ var d = $("<div id='rules'>").prependTo("body").width("80%").height("80%")
+ .css("z-index", 9999).css("position", "fixed")
+ .css("top", "50%").css("bottom", 0).css("left", "50%").css("right", 0)
+ .css("margin-top", "-40vh").css("margin-left", "-40%")
+ .css("background", "black")
+ .css("text-align", "center").css("font-family", "sans-serif")
+ .css("font-size", "14px").css("color", "white")
+
+ d.html("" +
+
+ "<div style='font-size: 40px; line-height: 60px; position: absolute; top: 0px; height: 60px; width: 100%;'>lainchan rule agreement</div>" +
+
+ "<div style='text-align: left; position: absolute; bottom: 80px; top: 60px;" +
+ "width: 100%; background-color: #ddd; overflow: auto; font-family: serif; color: #444;'>" +
+ "<div style='padding: 10px; font-size: 12px;' id='rules-actual'>" +
+ "</div>" +
+ "</div>" +
+
+ "<div style='bottom: 0px; height: 80px; width: 100%; position: absolute;'>" +
+ "<div style='line-height: 40px;'>If you accept the rules, retype the captcha and press ACCEPT.</div>" +
+ "<div style='height: 40px;'><div style='display: inline-block; border: 1px solid white; font-family: serif; padding: 3px;'>" + c + "</div>" +
+ "<form onsubmit=\"if ($('#captcha').val() == '" + c + "') { localStorage.rulesAccepted = 1; $('#rules').remove(); } return false;\"" +
+ " style='display: inline-block;'>" +
+ "<input type='text' id='captcha' style='width: 100px;' />" +
+ "<input type='submit' value='ACCEPT' />" +
+ "</form>" +
+ "</div>" +
+ "</div>" +
+
+ "");
+
+ $("#rules-actual").load("/templates/rules.html");
+
+ }("faggotry1234");
+});