Greasy Fork镜像 Theme figuccio

Greasy Fork镜像 pagina colorata

  1. // ==UserScript==
  2. // @name Greasy Fork镜像 Theme figuccio
  3. // @namespace https://gf.qytechs.cn/users/237458
  4. // @description Greasy Fork镜像 pagina colorata
  5. // @match https://gf.qytechs.cn/*
  6. // @match https://sleazyfork.org/*
  7. // @match *://gf.qytechs.cn/*/users/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
  9. // @grant GM_setClipboard
  10. // @version 10.7
  11. // @noframes
  12. // @author figuccio
  13. // @grant GM_addStyle
  14. // @grant GM_setValue
  15. // @grant GM_getValue
  16. // @grant GM_registerMenuCommand
  17. // @run-at document-end
  18. // @grant GM_xmlhttpRequest
  19. // @icon https://www.google.com/s2/favicons?domain=gf.qytechs.cn
  20. // @require http://code.jquery.com/jquery-latest.js
  21. // @require https://code.jquery.com/ui/1.13.2/jquery-ui.js
  22. // @license MIT
  23. // ==/UserScript==
  24. (function() {
  25. 'use strict';
  26. // Aggiungi la funzione per il trascinamento limitato allo schermo
  27. function makeDraggableLimited(element) {
  28. element.draggable({
  29. containment: "window",
  30. stop: function(event, ui) {
  31. // Memorizza la posizione dopo il trascinamento
  32. GM_setValue('boxPosition', JSON.stringify(ui.position));//importante
  33. }
  34. });
  35. }
  36.  
  37. const $ = window.jQuery.noConflict();//$ evita triangolo giallo
  38. const body = document.body;
  39. const style = "position:fixed;top:9px;left:870px;z-index:99999;";
  40. const box = document.createElement("div");
  41.  
  42. box.id = "mytema";
  43. box.style = style;
  44. body.append(box);
  45.  
  46. // Ripristina la posizione salvata se presente
  47. const savedPosition = GM_getValue('boxPosition');
  48. if (savedPosition) {
  49. const parsedPosition = JSON.parse(savedPosition);
  50. $(box).css({ top: parsedPosition.top, left: parsedPosition.left });
  51. }
  52. ////////////////////////////////////////////marzo 2024
  53. // Rendi l'elemento trascinabile con limitazioni di schermo
  54. makeDraggableLimited($(box));
  55. ////////////////////////////
  56. // Mostra/Nascondi con animazione
  57. function provagf() {
  58. var box = document.getElementById('mytema');
  59. $(box).fadeToggle(3000); // Animazione per mostrare/nascondere
  60. }
  61. GM_registerMenuCommand("nascondi/mostra box", provagf);
  62.  
  63. // Dati per la conservazione
  64. const userdata = { color: 'theme' };
  65. var mycolor = GM_getValue(userdata.color, "#980000"); // Valore predefinito
  66.  
  67. let use12HourFormat = GM_getValue('use12HourFormat', false); // Default è il formato 24 ore
  68. let language = GM_getValue('language') || 'it'; // Recupera la lingua dal localStorage o usa 'it' come predefinita
  69.  
  70. const languages = {
  71. en: { weekday: 'short', month: 'short', day: '2-digit', year: 'numeric' },
  72. it: { weekday: 'short', month: '2-digit', day: '2-digit', year: 'numeric' }
  73. };
  74. function myTimer() {
  75. const now = new Date(); // Crea un'istanza di Date ogni volta
  76. let hours = now.getHours();
  77. const minutes = String(now.getMinutes()).padStart(2, "0");
  78. const seconds = String(now.getSeconds()).padStart(2, "0");
  79. const milliseconds = String(now.getMilliseconds()).padStart(3, "0");
  80. const date = now.toLocaleString(language, languages[language]); // Usa la lingua selezionata per la data
  81. let period = "";
  82.  
  83. if (use12HourFormat) { // Condizione corretta per il formato 12 ore
  84. period = hours >= 12 ? " PM" : " AM";
  85. hours = hours % 12 || 12; // Converte in formato 12 ore
  86. }
  87.  
  88. hours = String(hours).padStart(2, "0"); // Aggiunge lo zero iniziale per ore
  89. document.getElementById("greasy").textContent = `${date} ${hours}:${minutes}:${seconds}:${milliseconds}${period}`;
  90. }
  91.  
  92. function changeLanguage() {
  93. language = (language === 'it') ? 'en' : 'it'; // Alterna tra 'it' e 'en'
  94. GM_setValue('language', language); // Salva la lingua scelta
  95. alert(`Lingua cambiata a: ${language}`);
  96. }
  97.  
  98. function toggleFormat() {
  99. use12HourFormat = !use12HourFormat; // Alterna il formato orario
  100. GM_setValue('use12HourFormat', use12HourFormat); // Salva lo stato del formato
  101. alert(`Formato cambiato in ${use12HourFormat ? '12 ore' : '24 ore'}`);
  102. }
  103.  
  104. // Registra i menu di comando
  105. GM_registerMenuCommand("Cambia lingua datario", changeLanguage);
  106. GM_registerMenuCommand("Cambia formato orario 12/24", toggleFormat);
  107.  
  108. // Chiama la funzione di inizializzazione e avvia il timer
  109.  
  110. const intervalTime = 90; // Imposta l'intervallo di tempo
  111. setInterval(myTimer, intervalTime);
  112.  
  113. // Elemento HTML nel div
  114. box.innerHTML = `
  115. <fieldset style="background:#3b3b3b;border:2px solid red;color:lime;border-radius:7px;text-align:center;width:400px;height:43px;">
  116. <legend>Time</legend>
  117. <div id=setui style="width:auto;height:25px;margin-top:-13px;margin-left:0px;margin-right:0px;margin-bottom:0px;">
  118. <button id="colorspan" title="Hex value" style="font-size:14px;cursor:pointer;margin-left:1px;margin-bottom:-19px;color:lime;background-color:brown;border:1px solid yellow;">${mycolor}</button>
  119. <input type="color" title="Color picker" list="colors" id="colorinput" style="width:50px;height:23px;cursor:pointer;margin-left:1px;margin-top:12px;background-color:#3b3b3b;color:red;border:1px solid yellow;border-radius:5px;"value="${mycolor}">
  120.  
  121. <div id="greasy" title="Data-ora" style="font-size:14px!important;display:inline-block;cursor:pointer;background:#3b3b3b;color:lime;border:1px solid yellow;border-radius:5px;margin:1px;text-align:center;width:max-content;">
  122. </div>
  123.  
  124. <span class="button" title="Chiudi" id='close' style="background:chocolate;color:lime;border:1px solid yellow;border-radius:50%;cursor:pointer;font-size:14px;padding:3px 6px;display:inline-block;line-height:16px;margin-top:-19px;margin-left:1px;">X</span>
  125.  
  126. </fieldset>
  127. `;
  128.  
  129. // Aggiunta funzione per chiudere il box
  130. var colorinputsetMenuClose = document.querySelector('#close');
  131. colorinputsetMenuClose.addEventListener('click', provagf, false);
  132.  
  133. var colorinput = document.querySelector('#colorinput');
  134. var colorspan = document.querySelector('#colorspan');
  135.  
  136. // Evento della tavolozza dei colori
  137. colorinput.addEventListener('input', function(event) { colorChange(event); }, false);
  138. $('body').css("background-color", mycolor);
  139.  
  140. function colorChange(e) {
  141. mycolor = e.target.value;
  142. colorspan.innerHTML = e.target.value;
  143. $('body').css("background-color", mycolor);
  144. GM_setValue(userdata.color, mycolor);
  145. }
  146. ////////////////////////////////////////////////
  147. function execCopy() {
  148. var code='';
  149. if($(".prettyprint li").length>0)
  150. {
  151. $(".prettyprint li").each(function(){
  152. code += $(this).text()+'\n';
  153. });
  154. }
  155. else {code = $(".prettyprint").text();}
  156.  
  157. code = encodeURI(code)
  158. code = code.replace(/%C2%A0/g,'%20');
  159. code = decodeURI(code);
  160.  
  161. GM_setClipboard(code, 'text');
  162. alert("copiato con successo")
  163. return true;
  164. }
  165.  
  166. //Il collegamento al codice sorgente viene visualizzato dopo il collegamento allo script
  167. $(".script-list h2 a").each(function(){
  168. if(!$(this).next().hasClass("code-link"))
  169. {let short_link = $(this).attr("href");
  170. let $code_link = $('<a target="_blank" a href=\"'+short_link+'/code\" class=\"code-link\">codice</a>');//apre in nuova scheda
  171. $(this).after($code_link);
  172. }
  173. })
  174.  
  175. //////////////////////////////////////////////////////////
  176. GM_addStyle('.source{'+
  177. 'display: inline-block;'+
  178. 'background-color:lime;'+
  179. 'padding: 0.5em 1em;'+
  180. 'color: white;'+
  181. 'text-decoration: none;'+
  182. 'cursor:pointer}'+
  183. '.code-link'+
  184. '{'+
  185. ' margin-left:10px; '+
  186. ' padding-left:2px;'+
  187. ' padding-right:2px; '+
  188. ' font-size:12px; '+
  189. ' background:red; '+
  190. ' color:white!important; '+
  191. ' text-decoration: none;'+
  192. '}');
  193. //////////////////
  194. if(window.location.href.indexOf("/code")!= -1) //code
  195. {var source_btn = $("<a></a>")
  196. source_btn.addClass("source");
  197. source_btn.text("copiare il codice sorgente");
  198. source_btn.click(function(){
  199. execCopy();
  200. });
  201. $("#install-area").after(source_btn);
  202. }
  203. //////////////////////
  204. //passa alla pagina successiva richiede jquery anche sulla pagina degli autori marzo 2024
  205. $(window).scroll(function() {
  206. if($(window).scrollTop() + $(window).height() == $(document).height()) {
  207. document.querySelector("#user-script-list-section > div > a.next_page,body > div.width-constraint > div > div.sidebarred-main-content > div.pagination > a.next_page").click();
  208. }
  209. });
  210.  
  211. //apre i link in nuova scheda maggio 2023
  212. function modifyLinks() {
  213. let links =document.querySelectorAll('#browse-script-list a');
  214. for (let i = 0; i < links.length; i++) {
  215. links[i].setAttribute('target', '_blank');
  216. }
  217.  
  218. }
  219. modifyLinks();
  220. //////////////////////////////////////////////////////////////////////////
  221. //mostra risultati in tutte le lingue
  222. GM_addStyle('a:hover {color: ;background-color: #876b9a;padding: 5px 10px;border-radius: 5px;}');
  223. //scritta Greasy Fork镜像
  224. GM_addStyle('#main-header {background-color:#5d3e72; background-image: linear-gradient(#412451, #009981); box-shadow: 0 0 15px 2px #000000a1;padding: .25em 0; }');
  225. //menu ordina per colorato
  226. GM_addStyle('.list-option-group ul {background-color:#1eb19c!important;}');
  227. //colore paginazione
  228. GM_addStyle('.pagination > *, .script-list + .pagination > *, .user-list + .pagination > *{background-color:#564062;!important;}');
  229. GM_addStyle('body > div > div > div.sidebarred-main-content > div.pagination > em{background-color:green!important;}');//colore num pag current
  230. 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;}');
  231. GM_addStyle('.width-constraint .pagination {border-radius:10px!important;}');
  232.  
  233. //input casella ricerca script rossa
  234. GM_addStyle('.sidebar-search input{background-color:red!important;}');
  235. //colore parte centrale
  236. GM_addStyle('.script-list{background-color:#d4c515d1!important;}');
  237. //////////////////codice sorgente colorato//////////////////////////////////////////////////////////////
  238. GM_addStyle('pre.prettyprint {background-color:#92ad92!important;border: 2px solid red!important;}');//1 stesso colore
  239. GM_addStyle('li.L1, li.L3, li.L5, li.L7, li.L9 {background-color:#92ad92!important;}');//2 stesso colore
  240. /////////////////////////////////////////////////////////////////////////////////////////////////////////
  241. //parte superiore codice sorgente colorata
  242. GM_addStyle('#script-info {border: 2px solid blue!important;background-color:#1f504f!important;}');
  243.  
  244. //////////////////////mostra numero 1,2,3ecc accanto agli script
  245. //Funzione 1: Stile ed evidenziazione degli script utente
  246. function applyStylesAndHighlight() {
  247. const page = +new URLSearchParams(document.location.search).get('page') || 1;
  248. const q = `<style>
  249. #browse-script-list{counter-reset: section ${(page-1)*50};}
  250. .ad-entry{height:0;overflow:hidden;}
  251. #browse-script-list li{position:relative}
  252. .Finn{background:gold;}
  253. .ad-entry{display:none}
  254. #browse-script-list li:after{
  255. counter-increment: section;
  256. content:counter(section);
  257. font:bold 20px/30px Arial;
  258. background:red;
  259. color:green;
  260. position:absolute;
  261. bottom:8px;
  262. right:15px
  263. }
  264. </style>`;
  265. document.documentElement.insertAdjacentHTML('afterbegin', q);
  266.  
  267. const a = document.querySelector(".user-profile-link a")?.href; // Utilizzare il concatenamento facoltativo
  268. if (a) { // Procedere solo se a è definito
  269. document.querySelectorAll("#browse-script-list li").forEach(function(i) {
  270. const b = i.querySelector("dd.script-list-author a");
  271. if (b && b.href === a) {
  272. i.className = 'Finn';
  273. }
  274. });
  275. }
  276. }
  277.  
  278. //Funzione 2: Aggiungere la numerazione all'elenco degli script utente nelle pagine utente
  279. function addNumberingToUserScripts() {
  280. if (window.location.href.includes("/users/")) {
  281. const scriptList = document.querySelectorAll('.script-list > li');
  282.  
  283. if (scriptList) {
  284. scriptList.forEach((script, index) => {
  285. const numberSpan = document.createElement('span');
  286. numberSpan.style.marginRight = '5px';
  287. numberSpan.style.fontWeight = 'bold';
  288. numberSpan.style.background = 'red';
  289. numberSpan.style.color = 'green';
  290. numberSpan.textContent = `${index + 1}`;
  291. script.insertBefore(numberSpan, script.firstChild);
  292. });
  293. }
  294. }
  295. }
  296.  
  297. // Chiama entrambe le funzioni
  298. applyStylesAndHighlight();
  299. addNumberingToUserScripts();
  300.  
  301. //autoclick casella editor checkbox
  302. const checkbox = document.querySelector("#enable-source-editor-code")
  303. if (checkbox.checked === false) {
  304. checkbox.click();
  305. }
  306.  
  307. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址