This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/rule34/script.js

81 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-07-19 18:55:28 +00:00
$(function() {
if(Cookies.get("ui-tnc-agreed") !== "true") {
2019-04-26 09:14:46 +00:00
$("BODY").addClass("censored");
$("BODY").append("<div class='tnc_bg'></div>");
$("BODY").append(""+
"<div class='tnc'>"+
2018-07-19 18:55:28 +00:00
"<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"+
2019-04-26 09:14:46 +00:00
"<p><a onclick='tnc_agree();'>Click here if you're an adult, and you're ok with that</a>"+
2018-07-19 18:55:28 +00:00
"</div>"+
"");
}
});
2019-04-26 09:14:46 +00:00
function tnc_agree() {
Cookies.set("ui-tnc-agreed", "true", {path: '/', expires: 365});
$("BODY").removeClass("censored");
$(".tnc_bg").hide();
$(".tnc").hide();
}
2018-07-19 18:55:28 +00:00
function image_hash_ban(id) {
var reason = prompt("WHY?", "DNP");
if(reason) {
$.post(
"/image_hash_ban/add",
{
"image_id": id,
"reason": reason,
},
function() {
$("#thumb_" + id).parent().parent().hide();
2018-07-19 19:09:36 +00:00
}
2018-07-19 18:55:28 +00:00
);
}
}
2018-07-25 23:28:08 +00:00
var navHidden = false;
2018-07-19 18:55:28 +00:00
function toggleNav() {
if(navHidden) {
2018-07-25 23:28:08 +00:00
$('BODY').removeClass('navHidden');
Cookies.set("ui-shownav", "true");
2018-07-19 18:55:28 +00:00
}
else {
2018-07-25 23:28:08 +00:00
$('BODY').addClass('navHidden');
Cookies.set("ui-shownav", "false");
2018-07-19 18:55:28 +00:00
}
navHidden = !navHidden;
}
2018-07-25 23:28:08 +00:00
$(function() {
if(Cookies.get("ui-shownav") === "false") {
toggleNav();
}
});
var forceDesktop = false;
function toggleDesktop() {
if(forceDesktop) {
2019-05-29 17:23:29 +00:00
let viewport = document.querySelector("meta[name=viewport]");
2018-09-09 09:58:18 +00:00
viewport.setAttribute('content', 'width=512');
2018-07-25 23:28:08 +00:00
Cookies.set("ui-desktop", "false");
}
else {
2019-05-29 17:23:29 +00:00
let viewport = document.querySelector("meta[name=viewport]");
2018-07-25 23:28:08 +00:00
viewport.setAttribute('content', 'width=1024, initial-scale=0.4');
Cookies.set("ui-desktop", "true");
navHidden = true;
toggleNav();
}
forceDesktop = !forceDesktop;
}
$(function() {
if(Cookies.get("ui-desktop") === "true") {
toggleDesktop();
}
});