Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Games.Tiscali avatar changer
- // @namespace games.cz
- // @include http://diskuse.tiscali.cz/games/*
- // @include https://diskuse.tiscali.cz/games/*
- // @version 1
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
- // @grant none
- // ==/UserScript==
- // Default source of the image to replace the unwanted image. If the user's avatar_src below isn't defined, this value is used.
- // CZ: Výchozí zdroj obrázku, který nahradí nežádoucí obrázek. Pokud není uživatelova hodnota avatar_src dole vyplněna, tento obrázek je použit
- var defaultImageSource = 'https://i.imgur.com/xOghGxE.jpg';
- // Define users by their username field. Fill in the avatar_src field for a custom avatar for this user.
- // CZ: Definuj uživatele v poli username. Pokud chceš, aby měl vlastní avatar, specifikuj jeho zdroj v avatar_src.
- var usersToFilter = {
- "Vymáčknutý jebák" : {
- "username" : "Vymáčknutý jebák",
- "avatar_src" : "https://i.imgur.com/DPm2oCg.jpg",
- },
- "Mart9" : {
- "username" : "Mart9",
- },
- //"JakýkolivNázev" : {
- // "username" : "Jméno",
- // "avatar_src" : "Zdroj obrázku",
- //},
- }
- function ChangeAvatars(avatarsToChange)
- {
- console.log("Games.Tiscali avatar changer: changing user avatars");
- for (var key in avatarsToChange)
- {
- var user = avatarsToChange[key];
- // Find posts by given username.
- // Username ids are defined in the head (hd) of the post, therefore the two .parent() calls to get the whole post.
- $("span[id*='item-username']:contains('" + user["username"] + "')").parent().parent().each(
- function(i, val) {
- console.log("Found a post from user " + user["username"]);
- // Select the image
- var userImg = $(this).find('.user-icon').first();
- // Change the image's source
- if ("avatar_src" in user) {
- userImg.attr('src', user["avatar_src"]);
- }
- else {
- userImg.attr('src', defaultImageSource);
- }
- }
- );
- }
- }
- ChangeAvatars(usersToFilter);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement