BSN .gif Avatars Mod

Allows you to see everyone's glorious animated .gif profile photos on the new BSN forums

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          BSN .gif Avatars Mod
// @description   Allows you to see everyone's glorious animated .gif profile photos on the new BSN forums
// @include       http://forum.bioware.com/*
// @version       2014.2.27
// @grant         none
// @namespace https://greasyfork.org/users/2524
// ==/UserScript==

var targetObject = document.body,
	imgElems = document.getElementsByTagName('img'),
	imgSrc = '';

  // Create an observer object and assign a callback function.
var observerObject = new MutationObserver(callback);

  // Register the target node to observe and specify which DOM changes to watch.
observerObject.observe(targetObject, { 
    attributes: true,
    characterData: true,
    childList: true
});

function callback() {
	setTimeout(function() {
		setGifs();
	}, 3000); // allow time for post to load before calling setGifs
}

function setGifs() {
	console.log('setgifs called');
	for (var i = 0; i < imgElems.length; i++) {
		if (imgElems[i].className.indexOf('ipsUserPhoto') !== -1 || imgElems[i].className.indexOf('user_photo') !== -1) {
			if (imgElems[i].src.indexOf('gif') !== -1) {
				imgSrc = imgElems[i].src;
				imgSrc.replace('thumb-','');
				imgElems[i].src = imgSrc.replace('thumb-','');
			}
		}
	}
}

setGifs();