BSN .gif Avatars Mod

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();