From c3bfb8635649213535059ea0deacbc0bfb1c0d40 Mon Sep 17 00:00:00 2001 From: Milosz Kwiatkowski Date: Sat, 20 Aug 2016 14:31:49 +0100 Subject: add rules agreement page --- js/rules-popup.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 js/rules-popup.js (limited to 'js') 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 + * + * 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 = $("
").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("" + + + "
lainchan rule agreement
" + + + "
" + + "
" + + "
" + + "
" + + + "
" + + "
If you accept the rules, retype the captcha and press ACCEPT.
" + + "
" + c + "
" + + "
" + + "" + + "" + + "
" + + "
" + + "
" + + + ""); + + $("#rules-actual").load("/templates/rules.html"); + + }("faggotry1234"); +}); -- cgit v1.3 From 432c4bcbdea639cca6643afb1b39a4ea2dbf3055 Mon Sep 17 00:00:00 2001 From: Milosz Kwiatkowski Date: Sat, 20 Aug 2016 14:33:34 +0100 Subject: update comment to account for previous commit --- js/rules-popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/rules-popup.js b/js/rules-popup.js index a94db90e..5f1b5615 100644 --- a/js/rules-popup.js +++ b/js/rules-popup.js @@ -2,7 +2,7 @@ * rules-popup.js * https://github.com/mkwia/lainchan/js/rules-popup.js * - * Forces user to accept rules from /rules.txt on first welcome + * Forces user to accept rules from /templates/rules.html on first welcome * * 2016 mkwia * -- cgit v1.3 From d550abed22f9c2f0c2d521a47a9105096d129e8b Mon Sep 17 00:00:00 2001 From: Milosz Kwiatkowski Date: Sun, 21 Aug 2016 14:29:11 +0100 Subject: add random captchas and remove redundant code --- js/rules-popup.js | 75 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'js') diff --git a/js/rules-popup.js b/js/rules-popup.js index 5f1b5615..1702ff68 100644 --- a/js/rules-popup.js +++ b/js/rules-popup.js @@ -12,40 +12,41 @@ * */ -$(function() { - if (typeof localStorage.rulesAccepted === "undefined") + function(c) { - var d = $("
").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("" + - - "
lainchan rule agreement
" + - - "
" + - "
" + - "
" + - "
" + - - "
" + - "
If you accept the rules, retype the captcha and press ACCEPT.
" + - "
" + c + "
" + - "
" + - "" + - "" + - "
" + - "
" + - "
" + - - ""); - - $("#rules-actual").load("/templates/rules.html"); - - }("faggotry1234"); -}); +if (typeof localStorage.rulesAccepted === "undefined") { + + // generate a 7-character long random string + captcha = Math.random().toString(36).substring(2, 9) + + var d = $("
").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("" + + + "
lainchan rule agreement
" + + + "
" + + "
" + + "
" + + "
" + + + "
" + + "
If you accept the rules, retype the captcha and press ACCEPT.
" + + "
" + captcha + "
" + + "
" + + "" + + "" + + "
" + + "
" + + "
" + + + ""); + + $("#rules-actual").load("rules.html"); +} -- cgit v1.3 From 0373db5e1775ccfbb5607675f03048497027d4e8 Mon Sep 17 00:00:00 2001 From: Milosz Kwiatkowski Date: Sun, 21 Aug 2016 18:15:36 +0100 Subject: move css to style.css and clear up element creation --- js/rules-popup.js | 56 ++++++++++++++++++-------------------------- stylesheets/style.css | 65 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 35 deletions(-) (limited to 'js') diff --git a/js/rules-popup.js b/js/rules-popup.js index 1702ff68..6b5c99ac 100644 --- a/js/rules-popup.js +++ b/js/rules-popup.js @@ -17,36 +17,26 @@ if (typeof localStorage.rulesAccepted === "undefined") { // generate a 7-character long random string captcha = Math.random().toString(36).substring(2, 9) - var d = $("
").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("" + - - "
lainchan rule agreement
" + - - "
" + - "
" + - "
" + - "
" + - - "
" + - "
If you accept the rules, retype the captcha and press ACCEPT.
" + - "
" + captcha + "
" + - "
" + - "" + - "" + - "
" + - "
" + - "
" + - - ""); - - $("#rules-actual").load("rules.html"); -} + $("
") + .prependTo("body"); + + $("#rules-popup") + .append("
lainchan rule agreement
") + .append("
") + .append("
"); + + $(".rules-popup-content-wrapper") + .append("
"); + $("#rules-popup-content") + .load("rules.html"); + + $(".rules-popup-bottom") + .append("
If you accept the rules, retype the captcha and press ACCEPT.
") + .append("
"); + $(".rules-popup-captcha-wrapper") + .append("
" + captcha + "
") + .append("
"); + $(".rules-popup-form") + .append("") + .append(""); +} \ No newline at end of file diff --git a/stylesheets/style.css b/stylesheets/style.css index 94428412..e25638d5 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1812,5 +1812,66 @@ table.fileboard .intro a { margin-left: 0px; } - - +/* Rules Popup */ +#rules-popup { + width: 80%; + height: 80%; + position: fixed; + z-index: 9999; + left: 50%; + margin-left: -40%; + top: 50%; + margin-top: -40vh; + background: #000000; + text-align: center; + font-family: sans-serif; + font-size: 14px; + color: #FFFFFF; +} +#rules-popup .rules-popup-top { + font-size: 40px; + line-height: 60px; + position: absolute; + top: 0px; + height: 60px; + width: 100%; +} +#rules-popup .rules-popup-content-wrapper { + text-align: left; + position: absolute; + bottom: 80px; + top: 60px; + width: 100%; + background-color: #DDDDDD; + overflow: auto; + font-family: serif; + color: #444; +} +#rules-popup .rules-popup-content { + padding: 10px; + font-size: 12px; +} +#rules-popup .rules-popup-bottom { + bottom: 0px; + height: 80px; + width: 100%; + position: absolute; +} +#rules-popup .rules-popup-bottom-instructions { + line-height: 40px; +} +#rules-popup .rules-popup-captcha-wrapper { + height: 40px; +} +#rules-popup .rules-popup-captcha { + display: inline-block; + border: 1px solid white; + font-family: serif; + padding: 3px; +} +#rules-popup .rules-popup-form { + display: inline-block; +} +#rules-popup .rules-popup-form-input { + width: 100px; +} -- cgit v1.3 From 315c376976bafb3a08efec9783c744e80914306d Mon Sep 17 00:00:00 2001 From: Milosz Kwiatkowski Date: Sun, 21 Aug 2016 18:36:22 +0100 Subject: change incorrent path to rules.html and css --- js/rules-popup.js | 2 +- stylesheets/style.css | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/rules-popup.js b/js/rules-popup.js index 6b5c99ac..515c5b71 100644 --- a/js/rules-popup.js +++ b/js/rules-popup.js @@ -28,7 +28,7 @@ if (typeof localStorage.rulesAccepted === "undefined") { $(".rules-popup-content-wrapper") .append("
"); $("#rules-popup-content") - .load("rules.html"); + .load("/templates/rules.html"); $(".rules-popup-bottom") .append("
If you accept the rules, retype the captcha and press ACCEPT.
") diff --git a/stylesheets/style.css b/stylesheets/style.css index e25638d5..b495891f 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1844,10 +1844,9 @@ table.fileboard .intro a { width: 100%; background-color: #DDDDDD; overflow: auto; - font-family: serif; color: #444; } -#rules-popup .rules-popup-content { +#rules-popup #rules-popup-content { padding: 10px; font-size: 12px; } -- cgit v1.3