// ==UserScript==
// @name Greasy Fork Theme figuccio
// @namespace https://greasyfork.org/users/237458
// @description Greasy Fork pagina colorata
// @match https://greasyfork.org/*
// @match https://sleazyfork.org/*
// @version 6.8
// @noframes
// @author figuccio
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @match *://greasyfork.org/*/script_versions/new*
// @match *://greasyfork.org/*/scripts/*/versions/new*
// @require https://gitcdn.link/repo/fuzetsu/userscripts/b38eabf72c20fa3cf7da84ecd2cefe0d4a2116be/wait-for-elements/wait-for-elements.js
// @run-at document-end
// @grant GM_xmlhttpRequest
// @icon https://www.google.com/s2/favicons?domain=greasyfork.org
// @require http://code.jquery.com/jquery-latest.js
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @license MIT
// ==/UserScript==
//apre i link in nuova scheda maggio 2023
function modifyLinks() {
let links =document.querySelectorAll('#browse-script-list a');
for (let i = 0; i < links.length; i++) {
links[i].setAttribute('target', '_blank');
}
}
modifyLinks();
//////////////////////////////////////////////////////////////////////////
// Show vertical scrollbar
GM_addStyle('body {overflow-y: scroll!important;}');
//menu ordina per colorato
GM_addStyle('.list-option-group ul {background-color:#1eb19c!important;}');
//colore paginazione
GM_addStyle('.pagination > *, .script-list + .pagination > *, .user-list + .pagination > *{background-color:rgb(19, 19, 19)!important;}');
GM_addStyle('body > div > div > div.sidebarred-main-content > div.pagination > em{background-color:green!important;}');//colore num pag current
GM_addStyle('.pagination{border: 2px solid peru !important;background: linear-gradient(to bottom, rgba(19, 19, 19, 1) 0%, rgba(51, 51, 51, 1) 0%, rgba(17, 17, 17, 1) 169%, rgba(0, 0, 0, 1) 98%) repeat scroll 0 0 rgba(0, 0, 0, 0); border-radius: 3px 3px 0 0 !important;}');
GM_addStyle('.width-constraint .pagination {border-radius:10px!important;}');
//input casella ricerca script rossa
GM_addStyle('.sidebar-search input{background-color:red!important;}');
//colore parte centrale
GM_addStyle('.script-list{background-color:#d4c515d1!important;}');
//mostra risultato per tutte le lingue
if (document.URL == "https://greasyfork.org/it/scripts") window.location.href = "https://greasyfork.org/it/scripts?filter_locale=0";
if (document.URL == "https://sleazyfork.org/it/scripts" ) window.location.href = "https://sleazyfork.org/it/scripts?filter_locale=0";
//colore nero descrizione script necessario perche se no lo scroll dark lo fara vedere bianco e non si vedra
GM_addStyle('body, input, select {color:black;}');
//////////////////codice sorgente colorato//////////////////////////////////////////////////////////////
GM_addStyle('pre.prettyprint {background-color:#92ad92!important;border: 2px solid red!important;}');//1 stesso colore
GM_addStyle('li.L1, li.L3, li.L5, li.L7, li.L9 {background-color:#92ad92!important;}');//2 stesso colore
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//parte superiore codice sorgente colorata
GM_addStyle('#script-info {border: 2px solid blue!important;background-color:aquamarine!important;}');
//scrool dark
var meta = document.createElement('meta');
meta.name = "color-scheme";
meta.content = "light dark";
document.getElementsByTagName('head')[0].appendChild(meta);
///////////////////////// color picker
(function() {
'use strict';
var $ = window.jQuery;
var j = $.noConflict();
var body=document.body;
var style=" position:fixed;top:9px;left:993px;z-index:99999;"
var box=document.createElement("div");
box.id="mytema";
box.style=style;
j(box).draggable();
body.append(box);
//mostra/nascondi
function provagf(){
var box = document.getElementById('mytema');
box.style.display = ((box.style.display!='none') ? 'none' : 'block');
}
GM_registerMenuCommand("nascondi/mostra box",provagf);
/////////////////////////////////////////////////////////////////////
//dati per la conservazione
var userdata = { color: 'theme',}
var mycolor;//dichiarare la variabile colore
//imposta la variabile del colore
if(/^#+\w+$/.test(GM_getValue(userdata.color))){mycolor = GM_getValue(userdata.color); }
else { mycolor="#000000";}
///////////////////////////////////////////////////////////
//Imposta lo stile CSS degli elementi nel menu
GM_addStyle(`
#myMenu {
font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', Arial, sans-serif;
font-size: 14px;
z-index: 2147483648;
}
.button { padding:3px 6px;line-height:16px;margin-top:-19px;display:inline-block;border:1px solid yellow;border-radius:3px;cursor:pointer;background:chocolate;}
#colorspan { margin-left:1px; margin-bottom:-19px; color:lime;background-color:brown; border:1px solid yellow;}
#setui{ width:auto;height:25px;margin-top:-10px; margin-left:0px;margin-right:0px; margin-bottom:0px;background-color:#293446;color:lime;}
#colorinput{ margin-left:4px; margin-top:-10px;background-color:#3b3b3b;color:red;border:1px solid yellow; border-radius: 5px;}
input[type="datetime-local"] { background:#3b3b3b;color:lime;border:1px solid yellow; border-radius: 5px;margin:9px;text-align:center;}
`);
setInterval(function(){
let today = new Date();
today.setMinutes(today.getMinutes() - today.getTimezoneOffset());
document.getElementById('greasy').value = today.toISOString().slice(0, -1);
}, 70);
//elemento html nel div readonly datatime non fa comparire licona del calendario width:280px evita che spostandolo ai lati cambi forma
box.innerHTML=`
</p>
<fieldset style="background:#3b3b3b;border:2px solid red;color:lime;border-radius:7px;text-align:center;width:280px;height:43px;">
<legend>Time<input readonly id="greasy" type="datetime-local" title="Data-ora"/></legend>
<div id=setui>
Hex <button id="colorspan" title="Hex value">${mycolor}</button> Picker <input type="color" list="colors" id="colorinput" value="${mycolor}" title="Color picker">
<span class="button" title="Chiudi" id='close'>X</span>
</p>
</div>
</fieldset>
`;
//////////////////////////////
//aggiunta span close per chiudere il box direttamente
var colorinputsetMenuClose=document.querySelector('#close');
colorinputsetMenuClose.addEventListener('click',provagf,false);
////////////////////////////////////////
var colorinput=document.querySelector('#colorinput');
var colorspan = document.querySelector('#colorspan');
////////////////////////////////////////
colorinput.addEventListener('input', function(event){colorChange(event)},false);
$('body').css("background-color", mycolor);
//evento della tavolozza dei colori
function colorChange (e) {
mycolor = e.target.value;
colorspan.innerHTML=e.target.value;
$('body').css("background-color", mycolor);
GM_setValue(userdata.color, mycolor);
}
})();
//////////////////////mostra numero 1,2,3ecc accanto agli script
(function() {
'use strict';
const page = +new URLSearchParams(document.location.search).get('page')||1;
const q= `<style>#browse-script-list{counter-reset: section ${(page-1)*50};}.ad-entry{height:0;overflow:hidden;}#browse-script-list li{position:relative}.Finn{background:gold;} .ad-entry{display:none}#browse-script-list li:after{counter-increment: section;content:counter(section);font:bold 20px/30px Arial;background:red;color:green;position:absolute;bottom:8px;right:15px}</style>`;
document.documentElement.insertAdjacentHTML('afterbegin', q);
const a = document.querySelector(".user-profile-link a").href;
document.querySelectorAll("#browse-script-list li").forEach(function(i){
const b = i.querySelector("dd.script-list-author a");
if( b&& b.href===a) { i.className='Finn' }
})
})();
///////////////////////////////autoclick casella editor checkbox lunghezza codice height 560px funziona
(function() {
var textarea = document.getElementById('script_version_code');
if (textarea !== null) {
textarea.style.height = '560px';
}
//autoclick casella editor checkbox
setTimeout(function(){document.getElementById("enable-source-editor-code").click();}, 2000);
})();
////////////