Hi, I've just added some features to your script : - Auto copy the url found into the clipboard - Auto close window, like this, it's easier to use it with program like FreeRapid or others download programs.
// ==UserScript== // @name Autoclick Download Button journaldupirate.net // @namespace https://greasyfork.org/fr/users/11667-hoax017 // @version 0.1 // @description try to take over the world! // @author Hoax017 // @match https://www.journaldupirate.net/go_to/* // @grant window.close // @grant window.focus // ==/UserScript== // //TODO in firefox settings for the automatic close // Go to address bar and type about:config // Go to parameter dom.allow_scripts_to_close_windows // Set its value as true
(function() { 'use strict'; if(document.querySelector('input[value="Continuer pour voir le lien"]')) { document.querySelector('input[value="Continuer pour voir le lien"]').click() }
if (document.querySelector('div.alert a')) { var link = document.querySelector('div.alert a') link.href = link.href.replace(/(\?|&)af=\d+/,'').replace(/(\?|&)aff_id=\d+/,'') //alert(link.href) textToClipboard(link.href) window.close(); } })();
function textToClipboard (text) { var dummy = document.createElement("textarea"); document.body.appendChild(dummy); dummy.value = text; dummy.select(); document.execCommand("copy"); document.body.removeChild(dummy); }
Hi,
I've just added some features to your script :
- Auto copy the url found into the clipboard
- Auto close window, like this, it's easier to use it with program like FreeRapid or others download programs.
// ==UserScript==
// @name Autoclick Download Button journaldupirate.net
// @namespace https://greasyfork.org/fr/users/11667-hoax017
// @version 0.1
// @description try to take over the world!
// @author Hoax017
// @match https://www.journaldupirate.net/go_to/*
// @grant window.close
// @grant window.focus
// ==/UserScript==
//
//TODO in firefox settings for the automatic close
// Go to address bar and type about:config
// Go to parameter dom.allow_scripts_to_close_windows
// Set its value as true
(function() {
'use strict';
if(document.querySelector('input[value="Continuer pour voir le lien"]')) {
document.querySelector('input[value="Continuer pour voir le lien"]').click()
}
if (document.querySelector('div.alert a')) {
var link = document.querySelector('div.alert a')
link.href = link.href.replace(/(\?|&)af=\d+/,'').replace(/(\?|&)aff_id=\d+/,'')
//alert(link.href)
textToClipboard(link.href)
window.close();
}
})();
function textToClipboard (text) {
var dummy = document.createElement("textarea");
document.body.appendChild(dummy);
dummy.value = text;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
}