Save the Majeur thread
Pada tanggal
// ==UserScript==
// @name majeur Save
// @namespace http://tampermonkey.net/
// @version 2024-07-23
// @description Save the Majeur thread
// @author hangjeff
// @match https://majeur.zawarudo.org/*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Your code here...
$('.op').each(function(){
let majeur_Thread_Url = window.location.href;
if(!majeur_Thread_Url.includes('res')){
for(let i = 0; i < 2; i++){
majeur_Thread_Url = majeur_Thread_Url.substring(0, majeur_Thread_Url.lastIndexOf('/'));
}
majeur_Thread_Url = majeur_Thread_Url + $(this).find('.intro a:contains("[Reply]")').attr('href');
}
$(this).find('.intro').after(ArchiveIs_Create(majeur_Thread_Url, 'Thread'));
$(this).find('.intro').after(WebArchive_Create(majeur_Thread_Url, 'Thread'));
if($(this).find('.fileinfo').length){
let majeur_File_Url = majeur_Thread_Url;
for(let i = 0; i < 3; i++){
majeur_File_Url = majeur_File_Url.substring(0, majeur_File_Url.lastIndexOf('/'));
}
majeur_File_Url = majeur_File_Url + $(this).find('.fileinfo').find('a').first().attr('href');
if($(this).find('.fileinfo').find('a').first().attr('href').includes('.webm') || $(this).find('.fileinfo').find('a').first().attr('href').includes('.mp4')){
$(this).find('.file-text').first().append(WebArchive_Create(majeur_File_Url, 'Video'));
}
else{
$(this).find('.unimportant').first().append(WebArchive_Create(majeur_File_Url, 'Image'));
$(this).find('.unimportant').first().append(GhostArchive_Create(majeur_File_Url, 'Image'));
}
}
reply_Class_Read(majeur_Thread_Url);
})
function reply_Class_Read(Thread_Url){
$('.reply').each(function(){
if($(this).find('.fileinfo').length){
if(!$(this).find('form').length){
let majeur_File_Url = Thread_Url;
for(let i = 0; i < 3; i++){
majeur_File_Url = majeur_File_Url.substring(0, majeur_File_Url.lastIndexOf('/'));
}
majeur_File_Url = majeur_File_Url + $(this).find('.fileinfo').find('a').first().attr('href');
if(majeur_File_Url.includes('.webm') || majeur_File_Url.includes('.mp4')){
$(this).find('.fileinfo').first().append(WebArchive_Create(majeur_File_Url, 'Video'));
}
else{
$(this).find('.fileinfo').first().append(WebArchive_Create(majeur_File_Url, 'Image'));
$(this).find('.fileinfo').first().append(GhostArchive_Create(majeur_File_Url, 'Image'));
}
$(this).find('.fileinfo').css('height', '46px');
}
}
})
}
function WebArchive_Create(myUrl, myTarget){
let form = $('<form>', {
name: 'wwmform_save',
action: 'https://web.archive.org/save',
method: 'POST',
target: '_blank'
}).css('display', 'inline-block');
form.append(
$('<input>', {
id: 'url',
type: 'hidden',
name: 'url',
value: myUrl
})
);
form.append(
$('<input>', {
type: 'submit',
value: 'Save ' + myTarget + ' to Web archive',
})
);
return form;
}
function ArchiveIs_Create(myUrl, myTarget){
let form = $('<form>', {
id: 'submiturl',
action: 'https://archive.is/submit/',
method: 'GET',
target: '_blank'
}).css('display', 'inline-block');
form.append(
$('<input>', {
id: 'url',
type: 'hidden',
name: 'url',
value: myUrl
})
);
form.append(
$('<input>', {
type: 'submit',
value: 'Save ' + myTarget + ' to archive.is',
tabindex: '1'
})
);
return form;
}
function GhostArchive_Create(myUrl, myTarget){
let form = $('<form>', {
id: 'submiturl',
action: 'https://ghostarchive.org/archive2',
method: 'POST',
target: '_blank'
}).css('display', 'inline-block');
form.append(
$('<input>', {
id: 'url',
type: 'hidden',
name: 'archive',
value: myUrl
})
);
form.append(
$('<input>', {
type: 'submit',
value: 'Save ' + myTarget + ' to ghostarchive.org',
tabindex: '1'
})
);
return form;
}
})();