// ==UserScript==
// @name new Facebook figuccio
// @namespace https://greasyfork.org/users/237458
// @version 8.4
// @author figuccio
// @description new facebook con logo e home facebook recenti
// @include https://*.facebook.com/*
// @include https://*.facebook.com/me/*
// @grant GM_addStyle
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @run-at document-end
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @icon https://www.google.com/s2/favicons?domain=facebook.com
// @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
// @noframes
// @license MIT
// ==/UserScript==
//post e commenti colorati
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
//Colors
addGlobalStyle(":root,.__fb-dark-mode{--surface-background: blue; important;}");//oh
addGlobalStyle(":root,.__fb-dark-mode{--comment-background: #4B0205; !important;}");//commenti
addGlobalStyle(":root,.__fb-dark-mode{--nav-bar-background:red; !important;}");//barra facebook
//////////////////////
(function() {
'use strict';
//scrollbar nera
var meta = document.createElement('meta');
meta.name = "color-scheme";
meta.content = "light dark";
document.getElementsByTagName('head')[0].appendChild(meta);
////////////////////
//blocco temporanio click su ok dopo 5sec
setTimeout(function(){
document.querySelector("body > div.l9j0dhe7.tkr6xdv7 > div.rq0escxv.l9j0dhe7.du4w35lb > div > div.iqfcb0g7.tojvnm2t.a6sixzi8.k5wvi7nf.q3lfd5jv.pk4s997a.bipmatt0.cebpdrjk.qowsmv63.owwhemhu.dp1hu0rb.dhp61c6y.l9j0dhe7.iyyx5f41.a8s20v7p > div > div > div > div.gjzvkazv.dati1w0a.f10w8fjw.hv4rvrfc.ecm0bbzt.cbu4d94t.j83agx80.c4hnarmi > div > div > div.bp9cbjyn.j83agx80.taijpn5t.c4xchbtz.by2jbhx6.a0jftqn4").click();}, 5000);
//////////////////////popup notifiche in basso ha sinistra rimozione
(function() {var css = "";
if (false || (document.domain == "facebook.com" || document.domain.substring(document.domain.indexOf(".facebook.com") + 1) == "facebook.com"))
css += [
"",
" /*nasconde pop up notifica a sinistra*/",
"ul[data-gt*=\"\\\"ref\\\":\\\"beeper\\\"\"] { display:none !important; }",
"",
"ul[data-gt*=\"\\\"ref\\\":\\\"beeper\\\"\"], ul.poy2od1o.p7hjln8o > li.pmk7jnqg.pedkr2u6.ilcmz9jb.j9ispegn > :not(.cwj9ozl2), .poy2od1o ul.p7hjln8o > li.pmk7jnqg.pedkr2u6.ilcmz9jb.j9ispegn > :not(.cwj9ozl2), .poy2od1o.kavbgo14[class*='-mode'] li > :not([class*='-mode']) { display:none !important; } ",
].join("\n");
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
addStyle(css);
} else {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
heads[0].appendChild(node);
} else {
// no head yet, stick it whereever
document.documentElement.appendChild(node);
}
}
})();
//home preferiti recenti pagina centrale
GM_addStyle('.qsy8amke {display:none!important;}');
//watch marketplace groups gaming
GM_addStyle('div[role="navigation"][aria-label="Facebook"]>ul>li:nth-child(2){display:none!important;}');
GM_addStyle('div[role="navigation"][aria-label="Facebook"]>ul>li:nth-child(3){display:none!important;}');
GM_addStyle('div[role="navigation"][aria-label="Facebook"]>ul>li:nth-child(4){display:none!important;}');
GM_addStyle('div[role="navigation"][aria-label="Facebook"]>ul>li:nth-child(5){display:none!important;}');
//cambio colore barra facebook+pagina centrale random 12 colori rimuovere body per avere solo la barra facebook che cambia colore
$(function() {
var colors = ["#0099cc","#587b2e","#990000","#000000","#1C8200","#987baa","#981890","#AA8971","#1987FC","#99081E","#ff5722","#28768e75"];
setInterval(function() {
var bodybgarrayno = Math.floor(Math.random() * colors.length);
var selectedcolor = colors[bodybgarrayno];
$("body,.thodolrn ").css("background",selectedcolor);
}, 9000);
})
//////////////////////
//tasto menu accanto ha messaggi
GM_addStyle('div.oi9244e8.taijpn5t.datstx6m.j83agx80.bp9cbjyn > .bx45vsiw > .iyyx5f41.dhp61c6y.dp1hu0rb.owwhemhu.qowsmv63.cebpdrjk.bipmatt0.pk4s997a.q3lfd5jv.k5wvi7nf.t1p8iaqh.a8s20v7p.abs2jz4q.a6sixzi8.tojvnm2t{display: none!important}');
//giochi sopra la chat
GM_addStyle('div.dati1w0a.hv4rvrfc.bi6gxh9e.aov4n071.d2edcug0.pfnyh3mw.cbu4d94t.j83agx80.du4w35lb.l9j0dhe7.rq0escxv > .k4urcfbm.l9j0dhe7.j83agx80 > .sbcfpzgs.stjgntxs.ni8dbmo4.k4urcfbm.nwvqtn77.fbipl8qg.m5lcvass.io0zqebd.hybvsw6c.du4w35lb.l9j0dhe7.rq0escxv{display: none!important}');
//elimina piccolo spazio occupato inutilmente sopra contatti dopo la rimozione dei giochi sopra la chat
GM_addStyle('.cxgpxx05 > div > .discj3wi.d2edcug0.pfnyh3mw.cbu4d94t.j83agx80.du4w35lb.l9j0dhe7.rq0escxv{display: none!important}');
/////////////////////rimuove sponsorizzati zona chat
var xpath = function (xpathToExecute) {
var result = [];
var nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < nodesSnapshot.snapshotLength; i++) {
result.push(nodesSnapshot.snapshotItem(i));
}
return result;
};
var thePath = "//div/div[1]/div/div[3]/div/div/div[1]/div[1]/div/div[3]/div/div/div[1]/div/div[1]/span/div";
var runCount;
var intv = 500; // Esegui ogni 0,5 secondi
var intvEnd = 5000 // Cancella dopo 5 secondi
var go = setInterval(pollDOM, intv);
function pollDOM() {
runCount+=intv; // Aggiungi il valore intv a runCount ogni volta per contare la quantità di ms eseguiti
if (runCount >= intvEnd) { // Cancella intervallo dopo intvEnd
clearInterval(go);
}
try {
if (xpath(thePath)[0].children[0].children.length) {
xpath(thePath)[0].children[0].remove();
}
} catch {}
}
////////////////////////////////////////
function NEWaddtopnavbarlogout(){
var logout=document.createElement('a');
logout.innerHTML=" Log<br/> Out ";
logout.href="";
logout.id="Logout";
logout.title = 'esci';
logout.style="text-decoration: none;left:7px;color:var(--primary-text);position:relative;background-color:var(--secondary-button-background);font-weight:700;padding-left: 4px;padding-right: 4px;padding-top: 4px; padding-bottom: 4px; leftmargin:15px;border-top-left-radius: 50%;border-bottom-left-radius: 50%;border-top-right-radius: 50%;border-bottom-right-radius: 50%;"
document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild.parentNode.insertBefore(logout,document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild);
logout.addEventListener("click", function(e) {e.preventDefault(); document.querySelector('div[aria-label="Account"]').click(); window.setTimeout(function(){document.querySelector('div[data-nocookies="true"]').querySelector('span').click();e.target.innerHTML='<img src="//www.facebook.com/images/loaders/indicator_blue_small.gif"/>'},100)},false);
}
window.setTimeout(NEWaddtopnavbarlogout,10000);
GM_registerMenuCommand("✅riavvia logout",NEWaddtopnavbarlogout);
////////////////
$(document).ready(function() {
function updateClock() {
let time = new Date().toLocaleTimeString();
let d = new Date();
let ms = d.getMilliseconds()
node.innerHTML = time+ ":" +ms;
}
let node = document.createElement('a');
node.style="text-decoration: none;margin-left:800px;position:fixed;line-height:12px;width:auto;padding:3px 6px;color:var(--primary-text);background-color:var(--secondary-button-background);font-family:sans-serif;top:6px;text-align:center;border-radius:10px;"
document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild.parentNode.insertBefore(node,document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild);
node.addEventListener('click',function(e) {e.preventDefault();document.querySelector('div[aria-label="Account"]').click();window.setTimeout(function() {document.querySelector('div[data-nocookies="true"]').querySelector('span').click();}, 100)}, false);
document.body.appendChild(node);
setInterval(() => updateClock(), 70);
node.id="clock";
node.title = 'logout';
//mostra nascondi orologio
function myFunctionclock() {
node.style.display = ((node.style.display!='none') ? 'none' : 'block');}
//GM_registerMenuCommand("nascondi-clock/mostra-clock",myFunctionclock);
function dateClock() {
let date = new Date();
let datario = date.toLocaleString('it',{
day:'2-digit',year:'numeric',month:'long',weekday:'long',
});
node1.innerHTML = datario;
}
let node1 = document.createElement('a');
node1.style="text-decoration:none;margin-left:800px;position:fixed;line-height:12px;width:auto;padding:3px 6px;color:var(--primary-text);background-color:var(--secondary-button-background);font-family:sans-serif;top:6px;text-align:center;border-radius:10px;"
document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild.parentNode.insertBefore(node1,document.querySelectorAll('div[role="banner"] div[role="navigation"]')[1].firstChild);
node1.addEventListener('click',function(e) {e.preventDefault();document.querySelector('div[aria-label="Account"]').click();window.setTimeout(function() {document.querySelector('div[data-nocookies="true"]').querySelector('span').click();}, 100)}, false);
document.body.appendChild(node1);
setInterval(() => dateClock(), 1000);
node1.id="clock1";
node1.title = 'logout';
function myFunctiondata() {
node1.style.display = ((node1.style.display!='none') ? 'none' : 'block');}
//GM_registerMenuCommand("nascondi-data/mostra-data",myFunctiondata);
function Functionok() {
if (node.style.display === 'none') {
node.style.display = 'block';
node1.style.display = 'none';
} else {
node.style.display = 'none';
node1.style.display = 'block';
}
}
//data e ora alternata ogni 5 secondi
setInterval(() => Functionok(), 5000);
//GM_registerMenuCommand("mostra data /time",Functionok);
//al passaggio mouse
node.addEventListener('mouseover', Functionok);//passaggio del mouse
node1.addEventListener('mouseout',Functionok);//toglie il mouse
node1.style.display = 'none';
});
//accetta tutti cookie facebook
document.cookie = "datr=7JceYLHE4muIe3TIZpm1aiuj; domain=.facebook.com;max-age=315360000";
if(!localStorage.reload) {
setTimeout("document.location.reload()",2000);
localStorage.reload = 1;
}
//popup accetta cookie nascosto
GM_addStyle('div[data-testid=\"cookie-policy-dialog\"]{display: none!important}');
//memorizza password
GM_addStyle('.sjgh65i0 > .k4urcfbm.l9j0dhe7.j83agx80 > .sbcfpzgs.stjgntxs.ni8dbmo4.k4urcfbm.nwvqtn77.fbipl8qg.m5lcvass.io0zqebd.hybvsw6c.du4w35lb.l9j0dhe7.rq0escxv > .k4urcfbm {display: none!important}');
//crea stanza
GM_addStyle('.ecm0bbzt.e5nlhep0.l9j0dhe7.k4urcfbm.du4w35lb > .du4w35lb.l9j0dhe7.rq0escxv {display: none!important}');
////////////////////////////////////////////////////////////////////////
(function() {
'use strict';
//logo e home sempre feed piu recenti
var CONTENT_HAS_LINKS_SELECTORS = ".userContentWrapper, ._5pcr";
var BLOCK_LIST_SELECTORS = "._5r69, ._5g-l, ._2r3x, .uiLikePageButton, .uiStreamSponsoredLink";
var observer;
var contentAreaFoundTimeout;
function findAncestor (el, cls) {
while ((el = el.parentElement) && !el.classList.contains(cls));
return el;
}
function filterPosts(elements) {
//console.log("filterPosts");
if(!Array.isArray(elements) && !(elements instanceof NodeList)) {
return filterPosts([elements]);
}
//console.log("elements",elements);
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var elementDirty = false;
//console.log("element",element);
if (element.matches(BLOCK_LIST_SELECTORS) || element.querySelectorAll(BLOCK_LIST_SELECTORS).length>0) {
elementDirty = true;
} else {
var allLinks = element.querySelectorAll('a');
for (var j = 0; j < allLinks.length; j++) {
var str = allLinks[j].getAttribute("href");
if (str !== undefined && !str.startsWith("/") && !str.startsWith("#") && !str.includes("www.facebook.com")) {
elementDirty = true;
break;
}
}
}
if(elementDirty) {
findAncestor(element, "_4-u2").style.display = "none";
} else {
}
}
}
function mutationsHandler(mutations) {
mutations.forEach(function(mutation) {
var newNodes = mutation.addedNodes;
if (newNodes !== null) {
for (var i = 0; i < newNodes.length; i++) {
if (newNodes[i] && newNodes[i].className && (newNodes[i].className.contains("userContentWrapper") || newNodes[i].className.contains("_5pcr"))) {
filterPosts(newNodes[i]);
} else if (newNodes[i] && newNodes[i].querySelectorAll) {
filterPosts(newNodes[i].querySelectorAll(CONTENT_HAS_LINKS_SELECTORS));
}
}
}
});
}
function setupHistoryStateListener(callback) {
(function (old) {
window.history.pushState = function () {
old.apply(window.history, arguments);
console.log("push state");
callback();
};
})(window.history.pushState);
}
function main() {
//console.log("main");
if (window.top != window.self) {
return;
}
if(window.self.location.pathname !== "/") {
console.log("not on main feed");
return;
}
if(!window.self.location.search) {
window.self.location.search = "?sk=h_chr";
}
var contentArea = document.getElementById("contentArea");
if(!contentArea) {
console.log("contentarea not found, retry soon");
if(contentAreaFoundTimeout) {
clearTimeout(contentAreaFoundTimeout);
contentAreaFoundTimeout = null;
}
contentAreaFoundTimeout = setTimeout(main, 200);
return;
}
console.log("contentarea found");
observer.disconnect();
observer.observe(contentArea, { attributes: false, childList: true, characterData: false, subtree: true });
filterPosts(document.querySelectorAll(CONTENT_HAS_LINKS_SELECTORS));
setTimeout(function() {
document.body.scrollTop = 160;
contentArea.style.display = "block";
},100);
}
function setup() {
//console.log("set up");
observer = new MutationObserver(mutationsHandler);
if (document.readyState === "complete") {
main();
} else {
window.addEventListener("load", main);
}
setupHistoryStateListener(function() {
setTimeout(main,1000);
});
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML =
'.home .newsFeedComposer #contentArea { display:none; }'+
document.getElementsByTagName('head')[0].appendChild(style);
}
setup();
})();
// Verifica che l'URL principale sia il più recente
if (document.URL == "https://www.facebook.com/") window.location.href = "https://www.facebook.com/?sk=h_chr";
if (document.URL == "https://www.facebook.com/?ref=tn_tnmn") window.location.href = "https://www.facebook.com/?sk=h_chr";//home giochi facebook
if (document.URL == "https://www.facebook.com/?sk=h_nor") window.location.href = "https://www.facebook.com/?sk=h_chr";
if (document.URL == "https://www.facebook.com/?ref=logo") window.location.href = "https://www.facebook.com/?sk=h_chr"; //logo facebook giochi facebook
if (document.URL == "https://www.facebook.com/#_=_") window.location.href = "https://www.facebook.com/?sk=h_chr"; //quando si accede ha facebook da google
/////////////////////////////////////////////////
//nasconde pop up notifica a sinistra quando si gioca
GM_addStyle('ul[data-gt*=\"\\\"ref\\\":\\\"beeper\\\"\"] {display:none !important;}');
//nascondi blocco publicita app giochi facebook
GM_addStyle('div._1k76,div._pagelet_ego_pane { display:none;}');
// ti piace questo gioco popup
GM_addStyle('._3mqg {display:none!important}');
///////////////////////crea una storia e pass con immagine dalla sez centrale rimosse
GM_addStyle('.sbcfpzgs.k4urcfbm.stjgntxs.ni8dbmo4.l82x9zwi.uo3d90p7.pw54ja7n.ue3kfks5.hybvsw6c.du4w35lb.l9j0dhe7.rq0escxv > .k4urcfbm{display:none!important}');
GM_addStyle('.gs1a9yip.j83agx80.btwxx1t3.owycx6da.jifvfom9.dlv3wnog.rl04r1d5.ni8dbmo4.stjgntxs.jbae33se.cxgpxx05.l9j0dhe7 {display:none!important}');
GM_addStyle('.m9osqain.m7msyxje.tmrshh9y.m7zwrmfr.taijpn5t.sk4xxmp2.agehan2d.n8ej3o3l.rt8b4zig.spb7xbtv.bkmhp75w.emlxlaya.s45kfl79.bp9cbjyn.p8dawk7l.abiwlrkh.l9j0dhe7.lzcic4wl.f1sip0of.esuyzwwr.i1ao9s8h.a8nywdso.qt6c0cv9.rz4wbd8a.jb3vyjys.hcukyx3x.oygrvhab.cxmmr5t8.kvgmc6g5.p7hjln8o.j83agx80.nhd2j8a9.rq0escxv.r7d6kgcz.e9989ue4.esr5mh6w.qu0x051f.hn33210v.oajrlxb2{display:none!important}');
//persone che potresti conoscere
GM_addStyle('.k4urcfbm.l9j0dhe7.jktsbyx5.dy7m38rt.stjgntxs.ni8dbmo4.o7xrwllt.c8r2yrt7{display:none!important}');
GM_addStyle('.bp9cbjyn.j83agx80.jnigpg78.taijpn5t.ecm0bbzt.hv4rvrfc.a5h7je3r.dati1w0a{display:none!important}');
GM_addStyle('.j83agx80.btwxx1t3.i1fnvgqd.pybr56ya.hv4rvrfc.e5nlhep0.dati1w0a{display:none!important}');
//sponsorizzato sopra la chat
GM_addStyle('.cxgpxx05 > div:nth-of-type(1) > div > .l9j0dhe7 > .sj5x9vvc.cxgpxx05{display:none!important}');
GM_addStyle('.hzawbc8m.m9osqain.lrazzd5p.g1cxx5fr.a5q79mjw.ew0dbk1b.s89635nw.c1et5uql.qv66sw1b.hpfvmrgz.d2edcug0.ik7dh3pa.oi732d6d.l9j0dhe7.stjgntxs.ni8dbmo4.a8c37x1j{display:none!important}');
GM_addStyle('.ejjq64ki.v8c10jal.e3xpq0al.d2edcug0{display:none!important}');
//pulsante crea
GM_addStyle('div.oi9244e8.taijpn5t.datstx6m.j83agx80.bp9cbjyn:nth-of-type(3) > .iyyx5f41.dhp61c6y.dp1hu0rb.owwhemhu.qowsmv63.cebpdrjk.bipmatt0.pk4s997a.q3lfd5jv.k5wvi7nf.t1p8iaqh.a8s20v7p.abs2jz4q.a6sixzi8.tojvnm2t > .q676j6op.qypqp5cg.taijpn5t.sk4xxmp2.agehan2d.n8ej3o3l.rt8b4zig.spb7xbtv.bkmhp75w.emlxlaya.s45kfl79.bp9cbjyn.p8dawk7l.abiwlrkh.l9j0dhe7.lzcic4wl.f1sip0of.esuyzwwr.i1ao9s8h.a8nywdso.qt6c0cv9.rz4wbd8a.jb3vyjys.hcukyx3x.oygrvhab.cxmmr5t8.kvgmc6g5.p7hjln8o.j83agx80.nhd2j8a9.rq0escxv.r7d6kgcz.e9989ue4.esr5mh6w.qu0x051f.tdjehn4e.oajrlxb2{display:none!important}');
///////////////////////////////////////////////////barra blu su giochi facebook////////
GM_addStyle('body ._2s1x ._2s1y{background-color:blue!important;}');
//nascondi trova amici guida rapida e crea link vecchia barra facebook giochi facebook
GM_addStyle('#findFriendsNav,div._59fb._tmz,#creation_hub_entrypoint { display:none;}');
//barra ricerca nascosta giochi
GM_addStyle('._4kny ._585- {display: none!important}');
//bordi tratteggiati
GM_addStyle('#facebook ._-kb div.rirtxc74{ border-radius:14px;border-style:dashed;border-color:green;border-spacing:26px;margin:px;}');//margin 14px
//colore spondo nomi arrotondati
GM_addStyle('.nnctdnn4 {min-height: 44px; background-color:#da2456;border-radius:22px;margin:3px!important;}');
//bordi sez centrale
GM_addStyle('.sbcfpzgs {--T68779821: 0 1px 2px var(--shadow-2); border:red; border-style: dashed;border-width: 2px;}');
//icone compresa la home .aaxa7vy3
GM_addStyle('.aaxa7vy3,.em6zcovv{fill: #1ef12e!important;}');
//sidebar sinistra
GM_addStyle('div[data-pagelet="LeftRail"]{background-color:blue!important;}');
//eliminato piccolo spazio sopra sidebar sinistra
GM_addStyle('.tr9rh885{margin-top:0px!important;}');
//sidebar destra chat
GM_addStyle('div[role="complementary"]{background-color:orange!important;}');
////////////////////////////////////////scritta contatti in chat e i tuoi collegamenti//
GM_addStyle('.aodizinl{background-color:red!important;padding:15px!important;border-radius:20px}');
//icone contatti cerchio piu visibile 3puntini ... sui post cerchio piu visibile
GM_addStyle('.pkj7ub1o::after{background-color:#ee82ee63!important}');
///////////////////////sezione notizie larga interferisce con tagga amici
GM_addStyle('.oh7imozk {width:100%!important;}');
//margine superiore sezione notizie rivisto
GM_addStyle('.oh7imozk {margin-top:5px!important;}');
//////////no login recent
$(document).ready(function() {
if(!document.querySelectorAll('.removableItem a[role="button"][ajaxify^="/login/device-based"]').length)
return;
var x=document.querySelectorAll('.removableItem a[role="button"][ajaxify^="/login/device-based"]');
for(var i=0;i<x.length;i++)
x[i].click();
})();
/////
////////////
})();