Skip to content

Instantly share code, notes, and snippets.

@4chenz
Last active September 26, 2023 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4chenz/6db47eeb612be24d5ab75628cbf397cf to your computer and use it in GitHub Desktop.
Save 4chenz/6db47eeb612be24d5ab75628cbf397cf to your computer and use it in GitHub Desktop.
Displays deletion time on FoolFuuka archives. Red icons indicate moderation, as the time is outside of when a normal user can delete.
// ==UserScript==
// @name Janny calc
// @namespace Violentmonkey Scripts
// @include http://archive.4plebs.org/*
// @include https://archive.4plebs.org/*
// @include http://archive.nyafuu.org/*
// @include https://archive.nyafuu.org/*
// @include http://desuarchive.org/*
// @include https://desuarchive.org/*
// @include http://arch.b4k.co/*
// @include https://arch.b4k.co/*
// @include http://boards.fireden.net/*
// @include https://boards.fireden.net/*
// @include http://archived.moe/*
// @include https://archived.moe/*
// @include http://archiveofsins.com/*
// @include https://archiveofsins.com/*
// @include http://thebarchive.com/*
// @include https://thebarchive.com/*
// @include http://www.tokyochronos.net/*
// @include https://www.tokyochronos.net/*
// @include https://archive.wakarimasen.moe/*
// @include http://archive.wakarimasen.moe/*
// @include http://archive.alice.al/*
// @include https://archive.alice.al/*
// @include https://archive.palanq.win/*
// @include http://archive.palanq.win/*
// @grant none
// @version 1.0
// @author Anonymous
// @run-at document-idle
// @description 10/31/2021, 11:53:38 PM
// ==/UserScript==
const jannyRange = [1, 30];
const tr = {
'Jan': '01',
'Feb': '02',
'Mar': '03',
'Apr': '04',
'May': '05',
'Jun': '06',
'Jul': '07',
'Aug': '08',
"Sep": '09',
"Oct": '10',
"Nov": '11',
"Dec": '12'
}
function is_jannied(tmp, tmp2) {
const date1 = new Date(tmp);
const parts = tmp2.split('on ')[1].replace(" at ", " ").replace(",", "").split(' ')
const date2 = new Date(`${parts[2]}-${tr[parts[0]]}-${parts[1]}T${parts[3]}-00:00`)
const min_dif = ( (date2 - date1) / 1000) / 60;
if (min_dif < jannyRange[0] || min_dif > jannyRange[1]) {
return [true, min_dif.toFixed(2)]
}
return [false, min_dif.toFixed(2)]
}
document.querySelectorAll('.post_data').forEach(
function(el) {
const trash = el.querySelector('.icon-trash');
if (trash != null) {
const date0 = el.querySelector('.time_wrap > time').dateTime;
if (window.location.hostname == 'arch.b4k.co'){
var date1 = trash.parentElement.title;
} else {
var date1 = trash.title;
if (date1.includes('prematurely')) return
}
const ij = is_jannied(date0, date1);
trash.insertAdjacentHTML('afterbegin', ij[1]);
if (ij[0]) {
trash.style = 'color:red;';
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment