Warning: fopen(/www/sites/update.greasyfork.icu/index/store/forever/7b948f7ce970aabcee294d353c1b71c3.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==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/*
// @match *://greasyfork.org/*/users/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @grant GM_setClipboard
// @version 11.2
// @noframes
// @author figuccio
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @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.13.2/jquery-ui.js
// @license MIT
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// Aggiungi la funzione per il trascinamento limitato allo schermo
function makeDraggableLimited(element) {
element.draggable({
containment: "window",
stop: function(event, ui) {
// Memorizza la posizione dopo il trascinamento
GM_setValue('boxPosition', JSON.stringify(ui.position));//importante
}
});
}
const $ = window.jQuery.noConflict();//$ evita triangolo giallo
const body = document.body;
const style = "position:fixed;top:9px;left:870px;z-index:99999;";
const box = document.createElement("div");
box.id = "mytema";
box.style = style;
body.append(box);
// Ripristina la posizione salvata se presente
const savedPosition = GM_getValue('boxPosition');
if (savedPosition) {
const parsedPosition = JSON.parse(savedPosition);
$(box).css({ top: parsedPosition.top, left: parsedPosition.left });
}
////////////////////////////////////////////marzo 2024
// Rendi l'elemento trascinabile con limitazioni di schermo
makeDraggableLimited($(box));
////////////////////////////
// Mostra/Nascondi con animazione
function provagf() {
var box = document.getElementById('mytema');
$(box).fadeToggle(3000); // Animazione per mostrare/nascondere
}
GM_registerMenuCommand("nascondi/mostra box", provagf);
// Dati per la conservazione
const userdata = { color: 'theme' };
var mycolor = GM_getValue(userdata.color, "#980000"); // Valore predefinito
let use12HourFormat = GM_getValue('use12HourFormat', false); // Default è il formato 24 ore
let language = GM_getValue('language') || 'it'; // Recupera la lingua dal localStorage o usa 'it' come predefinita
const languages = {
en: { weekday: 'short', month: 'short', day: '2-digit', year: 'numeric' },
it: { weekday: 'short', month: '2-digit', day: '2-digit', year: 'numeric' }
};
function myTimer() {
const now = new Date(); // Crea un'istanza di Date ogni volta
let hours = now.getHours();
const minutes = String(now.getMinutes()).padStart(2, "0");
const seconds = String(now.getSeconds()).padStart(2, "0");
const milliseconds = String(now.getMilliseconds()).padStart(3, "0");
const date = now.toLocaleString(language, languages[language]); // Usa la lingua selezionata per la data
let period = "";
if (use12HourFormat) { // Condizione corretta per il formato 12 ore
period = hours >= 12 ? " PM" : " AM";
hours = hours % 12 || 12; // Converte in formato 12 ore
}
hours = String(hours).padStart(2, "0"); // Aggiunge lo zero iniziale per ore
document.getElementById("greasy").textContent = `${date} ${hours}:${minutes}:${seconds}:${milliseconds}${period}`;
}
function toggleFormat() {
use12HourFormat = !use12HourFormat; // Alterna il formato orario
GM_setValue('use12HourFormat', use12HourFormat); // Salva lo stato del formato
language = (language === 'it') ? 'en' : 'it'; // Alterna tra 'it' e 'en'
GM_setValue('language', language); // Salva la lingua scelta
}
// Registra i menu di comando
GM_registerMenuCommand("Cambia formato orario 12/24", toggleFormat);
// Chiama la funzione di inizializzazione e avvia il timer
const intervalTime = 90; // Imposta l'intervallo di tempo
setInterval(myTimer, intervalTime);
// Elemento HTML nel div
box.innerHTML = `