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 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);