/* * rules-popup.js * https://github.com/mkwia/lainchan/js/rules-popup.js * * Forces user to accept rules from /templates/rules.html on first welcome * * 2016 mkwia * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js'; * $config['additional_javascript'][] = 'js/rules-popup.js'; * */ $(window).ready(function() { if (typeof localStorage.rulesAccepted === "undefined") { // generate a 7-character long random string captcha = Math.random().toString(36).substring(2, 9) $("body") .prepend("
"); $("#rules-popup") .append("
lainchan rule agreement
") .append("
") .append("
"); $(".rules-popup-content-wrapper") .append("
"); $("#rules-popup-content") .load("/templates/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(""); } })