Citat:
Ursprungligen postat av
Frandett
Finns det någon som byggt en egen filter eller flashback klient?
Använd Tampermonkey eller Greasemonkey, tillsammans med det här scriptet:
Kod:
// ==UserScript==
// @name Flashback Tagger
// @namespace flashbacktagger
// @author kinesarsle
// @description Script to keep track of users
// @include *www.flashback.org/*
// @version 0.4
// @grant none
// ==/UserScript==
// This script helps you to keep track of users on the Flashback forum.
// There are currently three things it can do:
// 1. Add a note
// You can add a custom note for a specific user.
// 2. Custom colour
// Customise the background colour of the username. It's up to you
// what the colours should mean.
// 3. Hide/show posts
// This script can hide and show what a tagged user has written, and
// you can also specify is this should be done for each tagged user.
//
// For discussions and new versions, please visit this thread:
// https://www.flashback.org/t2575201
// Acknowledgements
//
// Thanks to ttsp for implementing the function to hide and show posts.
// Thanks to Fnords for fixing a bug and improving the function ttsp wrote.
// *************** IMPORTANT *********************
// ********* Configuration section ***************
// In this list you save all the users you want to tag. Remember that you need to have
// correct syntax. Don't forget separating commas. Only the field 'name' is mandatory.
// Unless you want to modify how the script behaves this is the only place where you
// should write anything at all.
//
// The current supported attributes are name, color, msg and hide. The field name
// is mandatory, and the others defaults to color=undefined, msg=undefined, hide=false
//
// Check and doublecheck this for small syntax errors if the script doesn't work.
tagged = [{name : "FelixGustavsson", color : 'green', msg : 'Smart person'},
{name : "coldon86", color : 'red' , msg : 'Går alltid OT'},
{name : "Herrcykel"},
{name : "ttsp", hide : true},
{name : "Fnords", color : 'green', msg : 'haha'},
{name : "NickB"},
{name : "NickC"},
{name : "NickD"},
{name : "NickE"},
{name : "NickF"},
{name : "NickG"}
]
// ************ End of configuration **************
// Nothing below this line should be changed unless you know what you are doing.
var tagged;
var allUserText, thisUserText;
allUserText = document.evaluate(
"//td[@class='alt1 post-right']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
var allUsers, thisUser;
allUsers = document.evaluate(
"//a[@class='bigusername']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
function findIndex(list, key) {
for(var i=0; i<list.length; i++) {
if(list[i].name==key)
return i;
}
return -1;
}
// The main function
for (var i = 0; i < allUserText.snapshotLength; i++) {
thisUser = allUsers.snapshotItem(i);
ind=findIndex(tagged, thisUser.text)
if(ind != -1) {
thisUser.style.backgroundColor = tagged[ind].color;
if(tagged[ind].msg) {
var infoButton = document.createElement("BUTTON");
var infoText = document.createTextNode("info");
infoButton.setAttribute('index', ind);
infoButton.appendChild(infoText);
thisUser.parentNode.parentNode.appendChild(infoButton);
infoButton.onclick = Function("alert(tagged[this.getAttribute('index')].msg)");
}
if(tagged[ind].hide) {
thisUserText = allUserText.snapshotItem(i);
thisUserText.style.display = 'none';
var hideButton = document.createElement("input")
hideButton.type = 'button'
hideButton.value = 'Visa text'
hideButton.onclick = alternate
// thisUserText.previousElementSibling.innerHTML+= "<br/>";
thisUserText.previousElementSibling.appendChild(hideButton)
}
}
}
// Hiding and showing the text
function alternate() {
var text = this.parentNode.parentNode;
// Inputs is a LIST of objects, we assume we only have one in tree below text...
var inputs = text.getElementsByTagName('input');
var children = text.children;
// Fetch first element, which should be the button we want.
if (inputs[0].value != 'Dölj text') {
for (var i = 1; i < children.length; i++)
children[i].style.display = 'inline';
inputs[0].value = 'Dölj text';
} else {
for (var i = 1; i < children.length; i++)
children[i].style.display = 'none';
inputs[0].value = 'Visa text';
}
}
Tråden för utvecklingen av koden finns här:
(FB) Userscript för att tagga användare på Flashback
Den tar bort texten i inlägget, man kan dölja och visa med en knapp, vilket är bra för dom som vill ha en förvarning, men kanske ändå vill se vad personen skriver. Och man kan lägga till info om personen.
Avatarbilden döljs inte, men det är lätt att fixa, fråga om det är någon som vill fixa detta.