Facebook (Insert View Post Button)

Inserts a View Post button when browsing photos on Facebook — e.g. Navigates away from the standard theater view

当前为 2021-06-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name     Facebook (Insert View Post Button)
// @match    https://www.facebook.com/*
// @match    http://www.facebook.com/*
// @icon     https://www.google.com/s2/favicons?domain=facebook.com
// @run-at   document-start
// @grant    GM_addStyle
// @author   JZersche (Free Release)
// @version 1.01
// @namespace https://greasyfork.org/users/95175
// @description
// @description Inserts a View Post button when browsing photos on Facebook — e.g. Navigates away from the standard theater view
// ==/UserScript==

setTimeout(function() {

if(window.location.href.match(/(facebook\.com\/photo\/\?fbid\=\d+\&set\=a\.\d+|facebook\.com\/\S+\/photos\/a\.\d+\/\d+)/)) {

try{

let Facebook_username = document.getElementsByClassName('oajrlxb2 g5ia77u1 qu0x051f esr5mh6w e9989ue4 r7d6kgcz rq0escxv nhd2j8a9 nc684nl6 p7hjln8o kvgmc6g5 cxmmr5t8 oygrvhab hcukyx3x jb3vyjys rz4wbd8a qt6c0cv9 a8nywdso i1ao9s8h esuyzwwr f1sip0of lzcic4wl oo9gr5id gpro0wi8 lrazzd5p')[0].href.match(/com\/\S+\?/)[0].match(/\/\S+/)[0].replace('/','').replace('?','');

try{let postID = window.location.href.match(/\?fbid\=\d+/)[0].match(/\d+/)[0];}catch(e){}
try{let postID2 = window.location.href.match(/facebook\.com\S+\/photos\/a\.\d+\/\d+/)[0].match(/\d+/g)[1];

if(Facebook_username == 'profile.php') {
Facebook_username = postID2};
console.log(Facebook_username);
}catch(e){}

try{let setID = window.location.href.match(/(&set\=a\.\d+)/)[0].match(/\d+/)[0];}catch(e){}
try{let setID2 = window.location.href.match(/(a\.\d+)/)[0];}catch(e){}

try{let EditButton = document.getElementsByClassName('rq0escxv l9j0dhe7 du4w35lb j83agx80 pfnyh3mw taijpn5t bp9cbjyn owycx6da btwxx1t3 kt9q3ron ak7q8e6j isp2s0ed ri5dt5u2 rt8b4zig n8ej3o3l agehan2d sk4xxmp2 d1544ag0 tw6a2znq tdjehn4e tv7at329')[0];

if(EditButton) {
EditButton.insertAdjacentHTML('afterend','<div class="'+EditButton.className+' viewpost" style="font-family: inherit; font-weight:600; font-size:14px; color:#fff!important"><a href="#">View Post</a></div>');
document.getElementsByClassName('viewpost')[0];
}
}catch(e){}

try{
let ViewPostButton = document.getElementsByClassName('a8nywdso j7796vcc rz4wbd8a l29c1vbm')[0];
if(ViewPostButton) {


try{
if(window.location.href.match(/facebook\.com\/\D+/)[0]){
ViewPostButton.insertAdjacentHTML('afterend','<div class="viewpost" style="font-family: inherit; font-weight:600; font-size:14px; color:#fff!important"><a href="http://www.facebook.com/'+window.location.href.match(/facebook\.com\/\S+\/photos/)[0].replace('facebook.com/','').replace('/photos','')+'/posts/'+window.location.href.match(/facebook\.com\S+\/photos\/a\.\d+\/\d+/)[0].match(/\d+/g)[2]+'">View Post</a></div>');
console.log('a');
}
}catch(e){}

try{
if(window.location.href.match(/facebook\.com\/\d+/)[0]) {
ViewPostButton.insertAdjacentHTML('afterend','<div class="viewpost" style="font-family: inherit; font-weight:600; font-size:14px; color:#fff!important"><a href="http://www.facebook.com/'+window.location.href.match(/facebook\.com\/\S+\/photos/)[0].replace('facebook.com/','').replace('/photos','')+'/posts/'+window.location.href.match(/facebook\.com\S+\/photos\/a\.\d+\/\d+/)[0].match(/\d+/g)[2]+'">View Post</a></div>');
console.log('b');
}
}catch(e){}

}


}catch(e){}

}

catch(e){}


}

},5000);