Background Color figuccio

lista colori

当前为 2025-03-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Background Color figuccio
  3. // @namespace https://greasyfork.org/users/237458
  4. // @version 1.3
  5. // @author figuccio
  6. // @description lista colori
  7. // @match *://*/*
  8. // @grant GM_addStyle
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant GM_registerMenuCommand
  12. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
  13. // @run-at document-start
  14. // @require http://code.jquery.com/jquery-latest.js
  15. // @require https://code.jquery.com/ui/1.12.1/jquery-ui.js
  16. // @icon https://www.google.com/favicon.ico
  17. // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
  18. // @noframes
  19. // @license MIT
  20. // ==/UserScript==
  21. (function() {
  22. 'use strict';
  23. var $ = window.jQuery.noConflict();
  24. //avvia la funzione dopo che la pagina e stata caricata
  25. $(document).ready(function() {
  26. var body=document.body;
  27. var style="position:fixed; top:0px;left:70px;z-index:99999;"
  28. var box=document.createElement("div");
  29.  
  30. box.id="myback";
  31. box.style=style;
  32.  
  33. box.style=style;
  34. $(box).draggable({
  35. containment: "window",
  36. stop: function(event, ui) {
  37. // Salva la posizione nella memoria locale quando il div viene trascinato
  38. GM_setValue('divPosition', {top: ui.position.top, left: ui.position.left});
  39. }
  40. });
  41.  
  42. // Recupera la posizione dall'archivio locale, se esiste
  43. var savedPosition = GM_getValue('divPosition');
  44. if (savedPosition) {
  45. box.style.top = savedPosition.top + 'px';
  46. box.style.left = savedPosition.left + 'px';
  47. }
  48.  
  49. body.append(box);
  50. ///////////////////////
  51. function prova(){
  52. var box = document.getElementById('myback');
  53. box.style.display = ((box.style.display!='none') ? 'none' : 'block');
  54. }
  55. GM_registerMenuCommand("nascondi/mostra time",prova);
  56. ///////////////////////stile colori
  57. $(function(){
  58. $("select").change(function(){
  59. var $selectedOption = $(this).find("option:selected");
  60. $(this).removeAttr("style").attr("style", $selectedOption.attr("style"));
  61. });
  62. });
  63. /////////////////////////local storage///////////
  64. //mantiene il colore della lista cambia colore pagina
  65. $(function() {
  66. $('#selectColor').change(function() {
  67. GM_setValue('lista1', this.value);
  68. //backgroundColor su google search risolve il problema che bisognava ricaricare
  69. document.body.style.backgroundColor=GM_getValue('lista1');
  70. ///////////////////////////////////barra facebook
  71. $("div[aria-label=Facebook][role=navigation]").css("background-color" ,GM_getValue("lista1"));
  72. });
  73. /////////////////////////////////////////////////recupero storage
  74. if(GM_getValue('lista1')){
  75. $('#selectColor').val(GM_getValue('lista1'));
  76. document.getElementById('selectColor').value =GM_getValue('lista1');
  77. document.body.style.backgroundColor=GM_getValue('lista1');
  78. ///////////////////////////////////////////////////////barra facebook
  79. $("div[aria-label=Facebook][role=navigation]").css("background-color" ,GM_getValue("lista1"));
  80. /////////////////////////////////////////////////////////////////////////////////////////////
  81. }
  82. });
  83.  
  84. //elemento html nel div readonly datatime non fa comparire licona del calendario
  85. box.innerHTML=`
  86. <fieldset style="background:#3b3b3b;border:2px solid red;color:lime;border-radius:7px;text-align:center;width:120px;height:44px;">
  87. <legend>Color</legend>
  88. <div id=setuia style="width:auto;height:25px;margin-top:0px!important;margin-left:-12px;margin-right:-12px;margin-bottom:0px;border-width:1px;">
  89. <select id="selectColor" title="Selettore colori" style="background:#3b3b3b;color:lime;border:1px solid yellow; border-radius:5px;"onchange="javascript:document.body.style.backgroundColor=this.value;">
  90. <option value="">Scegli ...</option>
  91. <option style="background-color: Purple" value="Purple">Purple</option>
  92. <option style="background-color: Blue" value="Blue">Blue</option>
  93. <option style="background-color: Green" value="Green">Green</option>
  94. <option style="background-color: Orange" value="Orange">Orange</option>
  95. <option style="background-color: Brown" value="Brown">Brown</option>
  96. <option style="background-color: Cyan" value="Cyan">Cyan</option>
  97. <option style="background-color: Gray" value="Gray">Gray</option>
  98. <option style="background-color: Indigo" value="Indigo">Indigo</option>
  99. <option style="background-color: Magenta" value="Magenta">Magenta</option>
  100. <option style="background-color: Pink" value="Pink">Pink</option>
  101. <option style="background-color: Red" value="Red">Red</option>
  102. <option style="background-color: Violet" value="Violet">Violet</option>
  103. <option style="background-color: Yellow" value="Yellow">Yellow</option>
  104. <option style="background-color: Black" value="Black">Black</option>
  105. <option style="background-color: lightgreen" value="lightgreen">lightgreen</option>
  106. <option style="background-color: lightyellow" value="lightyellow">lightyellow</option>
  107. <option style="background-color: lightblue" value="lightblue">lightblue</option>
  108. <option style="background-color: lightgrey" value="lightgrey">lightgrey</option>
  109.  
  110. </select>
  111.  
  112. </fieldset>
  113. `;
  114.  
  115. })();
  116.  
  117. })();