// ==UserScript==
// @name Greasy Fork Theme figuccio
// @namespace https://greasyfork.org/users/237458
// @description Greasy Fork pagina colorata
// @include https*://*greasyfork.org*
// @include https*://sleazyfork.org*
// @version 1.1
// @noframes
// @author figuccio
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @require https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js
// @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-start
// ==/UserScript==
window.onload = function() {
var currentColor = 'violet';
setInterval(function() {
document.body.style.backgroundColor = currentColor;
currentColor = currentColor === '#28768e75' ? '#008000ab' : '#28768e75';
}, 15000);
};
//GM_addStyle(' body {background-color:#28768e75!important;}');//cambio colore pagina
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";
//autoclick pagina successiva
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
var class_name = "next_page";
var bt = document.getElementsByClassName(class_name)[0];
bt.click();
}
});
/////////////autoclick casella editor checkbox
(() => {
'use strict';
waitForElems({
sel: '#enable-source-editor-code',
stop: true,
onmatch(checkbox) {
checkbox.click();
}
});
})();
//////////////////////////Change ordinamento script predefinito sui profili utente
(function() {
'use strict';
var Util = {
getQueryParameter: function(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
},
setQueryParameter: function(key, value, url) {
if (!url) url = window.location.href;
var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"),
hash;
if (re.test(url)) {
if (typeof value !== 'undefined' && value !== null)
return url.replace(re, '$1' + key + "=" + value + '$2$3');
else {
hash = url.split('#');
url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
if (typeof hash[1] !== 'undefined' && hash[1] !== null)
url += '#' + hash[1];
return url;
}
}
else {
if (typeof value !== 'undefined' && value !== null) {
var separator = url.indexOf('?') !== -1 ? '&' : '?';
hash = url.split('#');
url = hash[0] + separator + key + '=' + value;
if (typeof hash[1] !== 'undefined' && hash[1] !== null)
url += '#' + hash[1];
return url;
}
else
return url;
}
}
};
var Config = {
load: function() {
var defaults = {
sort: 'daily-installs'
};
var cfg = GM_getValue('cfg');
if (!cfg) return defaults;
return JSON.parse(cfg);
},
save: function (cfg) {
GM_setValue('cfg', JSON.stringify(cfg));
},
setup: function() {
var createSelect = function(label, options, value) {
var select = document.createElement('select');
select.style.margin = '2px';
var optgroup = document.createElement('optgroup');
if (label) {
optgroup.setAttribute('label', label);
}
select.appendChild(optgroup);
options.forEach(function(opt) {
var option = document.createElement('option');
option.setAttribute('value', opt.value);
option.textContent = opt.text;
optgroup.appendChild(option);
});
select.value = value;
return select;
};
var createButton = function(text, onclick) {
var button = document.createElement('button');
button.style.margin = '2px';
button.textContent = text;
button.onclick = onclick;
return button;
};
var init = function(cfg) {
var div = document.createElement('div');
div.style.backgroundColor = 'white';
div.style.border = '1px solid black';
div.style.position = 'absolute';
div.style.top = '25px';
div.style.right = '0';
var sort = createSelect('Default Sort', [
{ value: 'daily-installs', text: 'Daily installs' },
{ value: 'total_installs', text: 'Total installs' },
{ value: 'ratings', text: 'Ratings' },
{ value: 'created', text: 'Created' },
{ value: 'updated', text: 'Updated' },
{ value: 'name', text: 'Name' }
], cfg.sort);
div.appendChild(sort);
div.appendChild(document.createElement('br'));
div.appendChild(createButton('Save', function(e) {
var settings = {
sort: sort.value
};
Config.save(settings);
div.remove();
}));
div.appendChild(createButton('Cancel', function(e) {
div.remove();
}));
document.body.appendChild(div);
};
init(Config.load());
}
};
GM_registerMenuCommand('GreasyFork Sort Settings', Config.setup);
document.addEventListener('DOMContentLoaded', function(e) {
var dailyInstalls = document.querySelector('#script-list-sort > ul > li:nth-child(1) > a');
if (dailyInstalls) {
dailyInstalls.href = Util.setQueryParameter('sort', 'daily-installs', dailyInstalls.href);
}
});
var sort = Util.getQueryParameter('sort');
if (!sort) {
var cfg = Config.load();
window.location.replace(Util.setQueryParameter('sort', cfg.sort));
}
})();