Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name FB: Post Screenshot
- // @match https://www.facebook.com/*
- // @match https://*.facebook.com/*
- // @match http://www.facebook.com/*
- // @match http://*.facebook.com/*
- // @run-at document-start
- // @grant GM_addStyle
- // @author JZersche
- // @require https://greasyfork.org/scripts/12228/code/setMutationHandler.js
- // @version 1.05
- // @namespace https://greasyfork.org/users/95175
- // @description Remove Status after Screenshot Button is clicked.
- // ==/UserScript==
- if(!location.href.includes('SEARCH_BOX')) {
- setMutationHandler({
- target: document,
- selector: '._5pcb._4b0l._2q8l',
- handler: nodes => nodes.forEach(node => {
- // var dwg_PostID = node.childNodes[0].childNodes[0].childNodes[1].childNodes[0].childNodes[1].nextSibling.childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0].childNodes[0].childNodes[1].childNodes[1].childNodes[0].childNodes[0].childNodes[0].href.match(/\d+/);
- // var ____PostID = JSON.stringify(dwg_PostID).replace('\["','').replace(']','').replace('\"','');
- var ArchiveRecord = sessionStorage.getItem('A');
- ArchiveRecord = JSON.stringify(ArchiveRecord);
- setTimeout( function() {
- //var dwg_PostID = JSON.stringify(node.innerHTML.match(/posts\/\d+/));
- //var ____PostID = dwg_PostID;
- console.log(node.id.substring(38, 54));
- console.log(ArchiveRecord.includes(node.id.substring(38, 54)));
- console.log(ArchiveRecord);
- if( ArchiveRecord.includes(node.id.substring(38, 54)) ) { node.setAttribute('style','background:yellow!important;'); };
- }, 1000);
- //____PostID;
- //var post = node;
- //var P = node.parentNode;
- //////////////var ArchiveRecord = localStorage.getItem('A').match(/\d+/g);
- //////////////ArchiveRecord = JSON.stringify(ArchiveRecord);
- //alert(ArchiveRecord);alert(____PostID);
- // if(ArchiveRecord.match(____PostID)) {
- //P.removeChild(post);
- //alert(ArchiveRecord+' - '+____PostID);
- // node.setAttribute('style','background:yellow!important;');
- // };
- })
- })
- setMutationHandler({
- target: document.querySelector('._558b'),
- selector: '._54nc[title="Save screenshot"]',
- handler: nodes => nodes.forEach(node => {
- node.addEventListener('click', function (event) {
- var post = document.getElementsByClassName('_5pcb')[0];
- var P = post.parentNode;
- P.removeChild(post);
- })
- })
- })
- var i = 0;
- var ii = 0;
- var not_Anonymous = 0;
- setMutationHandler({
- target: document.querySelector('._3576'),
- selector: '._5pcp',
- processExisting: true,
- handler: node => {
- //alert(node[0].innerText);
- if (location.href.match(/facebook\.com\/\w+\S\w+/) && !location.href.match(/\S+\/\S+\/posts\/\d+/)) {
- /* Delay Script */
- setTimeout(function () {
- //alert(document.querySelectorAll('._1dwg._1w_m._q7o').length);
- try{
- if(!node[0].parentNode.parentNode.outerHTML.match(/Archive/) && node[0].closest('div').parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[0].title.length > 1) {
- node[0].insertAdjacentHTML('afterend', '<input type="button" class="ArchiveButton" name="arch" value=""/>'); //alert('a');
- node[0].nextSibling.setAttribute('style',' background-image: linear-gradient(to left, indigo, white, white, white);-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
- }
- if(!node[1].parentNode.parentNode.outerHTML.match(/Archive/) && node[1].parentNode.className.match(/_6a _5u5j _6b/)) {
- node[1].insertAdjacentHTML('afterend', '<input type="button" class="ArchiveButton" name="arch" value=""/>');//alert('b');
- node[1].nextSibling.setAttribute('style','background-image: linear-gradient(to left, indigo, white, white, white);-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
- }
- if(!node[2].parentNode.parentNode.outerHTML.match(/Archive/) && node[2].parentNode.className.match(/_6a _5u5j _6b/)) {
- node[2].insertAdjacentHTML('afterend', '<input type="button" class="ArchiveButton" name="arch" value=""/>');//alert('c');
- node[2].nextSibling.setAttribute('style','background-image: linear-gradient(to left, indigo, white, white, white);-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
- }
- if(!node[3].parentNode.parentNode.outerHTML.match(/Archive/) && node[3].parentNode.className.match(/_6a _5u5j _6b/)) {
- node[3].insertAdjacentHTML('afterend', '<input type="button" class="ArchiveButton" name="arch" value=""/>');//alert('d');
- node[3].nextSibling.setAttribute('style','background-image: linear-gradient(to left, indigo, white, white, white);-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
- }
- if(!node[4].parentNode.parentNode.outerHTML.match(/Archive/) && node[4].parentNode.className.match(/_6a _5u5j _6b/)) {
- node[4].insertAdjacentHTML('afterend', '<input type="button" class="ArchiveButton" name="arch" value=""/>');//alert('e');
- node[4].nextSibling.setAttribute('style','background-image: linear-gradient(to left, indigo, white, white, white);-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
- }
- } catch(Error) {}
- }, 100);
- }
- }
- });
- let iiii = 0; let intP = 0;
- setMutationHandler({
- target: document.querySelector('.u_1zif-yanm'),
- selector: '.ArchiveButton',
- processExisting: true,
- handler: nodes => nodes.forEach(node => {
- if (document.readyState === 'complete' && !location.href.match(/facebook\.com\/\w+\S\w+\//)) {
- iiii++; let PostID = node.parentNode.childNodes[1].childNodes[0].childNodes[0].childNodes[0].href.match(/\d{9,16}/);
- node.setAttribute("value",'['+iiii+'] Archive:'+PostID);
- }
- })
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement