color picker allinterno barra facebook
当前为
// ==UserScript==
// @name new picker barra Facebook figuccio
// @namespace https://greasyfork.org/users/237458
// @version 0.6
// @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"; }
//evento della tavolozza dei colori
function colorChange (e) {
mycolor = e.target.value;
}
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 );
document.getElementById('hexcolor').value =mycolor;//value hex
document.getElementById('colorinput').value =mycolor;
colorinput.addEventListener('input', function(){
GM_setValue(userdata.color, mycolor);
console.log(this.value);
$('body,#blueBarDOMInspector>div, #blueBarDOMInspector div[role="banner"], #fb2k_pagelet_bluebar>#blueBarDOMInspector>div>div, div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor);
});
})();
//////////////////////
})();