To desuarchive.org
目前為
// ==UserScript==
// @name To Desuarchive
// @namespace http://github.com/hangjeff
// @version 2025-03-20_14h20m
// @description To desuarchive.org
// @author hangjeff
// @match https://boards.4chan.org/a/*
// @match https://boards.4chan.org/aco/*
// @match https://boards.4chan.org/an/*
// @match https://boards.4chan.org/c/*
// @match https://boards.4chan.org/cgl/*
// @match https://boards.4chan.org/co/*
// @match https://boards.4chan.org/d/*
// @match https://boards.4chan.org/fit/*
// @match https://boards.4chan.org/g/*
// @match https://boards.4chan.org/his/*
// @match https://boards.4chan.org/int/*
// @match https://boards.4chan.org/k/*
// @match https://boards.4chan.org/m/*
// @match https://boards.4chan.org/mlp/*
// @match https://boards.4chan.org/mu/*
// @match https://boards.4chan.org/q/*
// @match https://boards.4chan.org/qa/*
// @match https://boards.4chan.org/r9k/*
// @match https://boards.4chan.org/tg/*
// @match https://boards.4chan.org/trash/*
// @match https://boards.4chan.org/vr/*
// @match https://boards.4chan.org/wsg/*
// @exclude https://boards.4chan.org/search*
// @require https://code.jquery.com/jquery-3.7.1.slim.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
$('.thread').each(function(){
let Komica_Thread_Url = window.location.href;
if(!Komica_Thread_Url.includes('thread')){
Komica_Thread_Url = Komica_Thread_Url.substring(0, Komica_Thread_Url.lastIndexOf('/') + 1);
if(!($(this).find('.postContainer').find('.replylink').first().attr('href') === undefined) ){
Komica_Thread_Url = Komica_Thread_Url + $(this).find('.postContainer').find('.replylink').first().attr('href');
//alert(Komica_Thread_Url);
}
else{
// Komica_Thread_Url = Komica_Thread_Url + $(this).find('.threadpost').find('.category a:last').attr('href');
console.log('404 Thread Not Found!');
}
}
// alert( Komica_Thread_Url);
$(this).find('.postInfo').first().after(ArchiveIs_Create(Komica_Thread_Url, 'Desuarchive'));
})
function ArchiveIs_Create(myUrl, myTarget){
let btn = $('<button>', {
text: 'Redirect to ' + myTarget,
tabindex: '1',
click: function(event){
event.preventDefault();
window.open(myUrl.replace("https://boards.4chan.org/", "https://desuarchive.org/"), '_blank');
return false;
}
}).css({'display': 'inline-block', 'background-color': 'green'});
return btn;
}
})();