From bc45944ac9e99ac0363c36d75e49202a85f3a266 Mon Sep 17 00:00:00 2001
From: Shish <shish@shishnet.org>
Date: Fri, 26 Apr 2019 10:14:46 +0100
Subject: [PATCH] flashier tnc

---
 ext/rule34/script.js | 15 ++++++++++++---
 ext/rule34/style.css | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 ext/rule34/style.css

diff --git a/ext/rule34/script.js b/ext/rule34/script.js
index b8aef7cf..c80bddf1 100644
--- a/ext/rule34/script.js
+++ b/ext/rule34/script.js
@@ -1,16 +1,25 @@
 $(function() {
 	if(Cookies.get("ui-tnc-agreed") !== "true") {
-		$("BODY").html(""+
-			"<div align='center' style='font-size: 2em; position: absolute; z-index: 99999999999999999999999999;'>"+
+		$("BODY").addClass("censored");
+		$("BODY").append("<div class='tnc_bg'></div>");
+		$("BODY").append(""+
+			"<div class='tnc'>"+
 			"<p>For legal reasons, we need to point out that:"+
 			"<p>A) this site contains material not suitable for minors"+
 			"<br>B) cookies may be used"+
-			"<p><a href='/tnc_agreed'>Click here if you're an adult, and you're ok with that</a>"+
+			"<p><a onclick='tnc_agree();'>Click here if you're an adult, and you're ok with that</a>"+
 			"</div>"+
 		"");
 	}
 });
 
+function tnc_agree() {
+	Cookies.set("ui-tnc-agreed", "true", {path: '/', expires: 365});
+	$("BODY").removeClass("censored");
+	$(".tnc_bg").hide();
+	$(".tnc").hide();
+}
+
 function image_hash_ban(id) {
 	var reason = prompt("WHY?", "DNP");
 	if(reason) {
diff --git a/ext/rule34/style.css b/ext/rule34/style.css
new file mode 100644
index 00000000..b4687560
--- /dev/null
+++ b/ext/rule34/style.css
@@ -0,0 +1,35 @@
+BODY.censored #header,
+BODY.censored NAV,
+BODY.censored ARTICLE,
+BODY.censored FOOTER {
+	filter: blur(10px);
+}
+.tnc_bg {
+	position: fixed;
+	top: 0px;
+	left: 0px;
+	right: 0px;
+	bottom: 0px;
+	background: #ACE4A3;
+	opacity: 0.75;
+	z-index: 999999999999999999999;
+}
+.tnc {
+	position: fixed;
+	top: 20%;
+	left: 20%;
+	right: 20%;
+	text-align: center;
+	font-size: 2em;
+	background: #ACE4A3;
+	border: 1px solid #7EB977;
+	z-index: 9999999999999999999999;
+}
+@media (max-width: 1024px) {
+	.tnc {
+		top: 5%;
+		left: 5%;
+		right: 5%;
+		font-size: 3vw;
+	}
+}