Greasy Fork is available in English.

new picker barra Facebook figuccio

color picker allinterno barra facebook

// ==UserScript==
// @name          new picker barra Facebook figuccio
// @namespace     https://greasyfork.org/users/237458
// @version       0.7
// @author        figuccio
// @description   color picker allinterno barra facebook
// @match         https://*.facebook.com/*
// @match         https://*.facebook.com/me/*
// @grant         GM_addStyle
// @grant         GM_setValue
// @grant         GM_getValue
// @grant         GM_registerMenuCommand
// @require       https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @run-at        document-start
// @icon          https://www.google.com/s2/favicons?domain=facebook.com
// @require       https://greasyfork.org/scripts/12228/code/setMutationHandler.js
// @noframes
// @license        MIT
// ==/UserScript==
 (function() {
 'use strict';
 var $ = window.jQuery;
 $(document).ready(function() {
 $('<input type="button"  id="hexcolor" value="${mycolor}" title="Hex color"></input>').appendTo('body');
 $('#hexcolor').css({ 'z-index':'999999999999', 'position': 'fixed','top': 13,'right': 425, color:'darkred', 'border':'2px solid green', 'border-radius': '6px',});

         //Creazione del colorPicker
 $('<input type="color" list="colors" value="${mycolor}" id="colorinput"  title="color picker">').appendTo('body');
 $('#colorinput').css({ 'z-index':'999999999999', 'position': 'fixed','top': 10,'right': 330, 'border':'2px solid yellow', 'border-radius': '6px',});
//////////////////////////////////////////////////////////////////////////////////////////////////casella hex
 $('#colorinput').on('input', function() {$('#hexcolor').val(this.value);});

    //////////////////////////////////////////////////////////////////////////////////////////////
       //dati per la conservazione
        var userdata = { color: 'figuccio', }

        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"; }
//////////////////////////////////////////
      // salvare i dati personalizzati
    function saveSetting() {GM_setValue(userdata.color, mycolor);
    $('body,#blueBarDOMInspector>div, #blueBarDOMInspector div[role="banner"], #fb2k_pagelet_bluebar>#blueBarDOMInspector>div>div, div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor);
          }
/////////////////////////////
       var hexcolor=document.querySelector('#hexcolor');
     var colorinput=document.querySelector('#colorinput');
      colorinput.addEventListener('input', function(event){colorChange(event)},false);
$('body,#blueBarDOMInspector>div, #blueBarDOMInspector div[role="banner"], #fb2k_pagelet_bluebar>#blueBarDOMInspector>div>div, div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor );

 //evento della tavolozza dei colori
            function colorChange (e) {
            mycolor = e.target.value;
                hexcolor.innerHTML=e.target.value;
                //colore immediatamente visibile
$('body,#blueBarDOMInspector>div, #blueBarDOMInspector div[role="banner"], #fb2k_pagelet_bluebar>#blueBarDOMInspector>div>div, div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor );
GM_setValue(userdata.color, mycolor);
            }


                                document.getElementById('hexcolor').value =mycolor;//value hex
                                document.getElementById('colorinput').value =mycolor;

 saveSetting();//salva
 window.setTimeout(saveSetting,3000);//attendi 3sec e risalva il colore utile sulla barra facebook giochi facebook
})();
//////////////////////
})();