Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/bbecc5a1976ed65eef869edc3f6eb665.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name mmmturkeybacon Avatar Switcheroo (XenForo) // @version 1.05 // @description Add the username and new avatar to the associative array to replace a user's avatar. Automatically turns users without avatars into robots. // @author mmmturkeybacon // @namespace http://userscripts.org/users/523367 // @match http://mturkgrind.com/threads/* // @match http://www.mturkgrind.com/threads/* // @match http://mturkgrind.com/showthread.php?* // @match http://www.mturkgrind.com/showthread.php?* // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js // @grant GM_log // @downloadURL https://update.greasyfork.icu/scripts/7810/mmmturkeybacon%20Avatar%20Switcheroo%20%28XenForo%29.user.js // @updateURL https://update.greasyfork.icu/scripts/7810/mmmturkeybacon%20Avatar%20Switcheroo%20%28XenForo%29.meta.js // ==/UserScript== /* To give all users without an avatar a unique robot avatar, set this to 'robot'. * To give all users without an avatar a unique monster avatar, set this to 'monster'. * To leave all users without an avatar unchanged set this to an empty string. * Names added to userdict will override this. * If AVATARS_FOR_ALL is not an empty string it will override this. */ var AVATARS_FOR_AVATARLESS = 'robot'; /* To give all users a unique robot avatar, set this to 'robot'. * To give all users a unique monster avatar, set this to 'monster'. * To leave all users unchanged set this to an empty string. * Names added to userdict will override this. */ var AVATARS_FOR_ALL = ''; // Put the username and avatar in userdict to give that user a new avatar whether // they have one already or not. Use 'robot' in place of an avatar image to // assign a specific user a robot avatar. Use 'monster' in place of an avatar image // to assign a specific user a monster avatar. var userdict = {}; userdict['Da_Tax_Man'] = 'http://i.imgur.com/9c1YkKb.jpg'; //userdict['justmerob'] = 'robot'; //userdict['ZinGy'] = 'http://i.imgur.com/xCxdb7g.png'; $(window).load(function() { $('img[src^="data/avatars"], img[src^="styles/zipped/xenforo/avatars"], img[src^="styles/apex/xenforo/avatars/"]').each(function() { var $this = $(this) var username = $this.attr('alt'); if (username.charAt(0) == '@') { username = username.substr(1); } var username_md5hash = md5(username); if (userdict[username]) { if (userdict[username] == 'robot') { var avatar = 'http://robohash.org/'+username_md5hash+'png?size=96x96'; $this.attr('src', avatar); } else if (userdict[username] == 'monster') { var avatar = 'http://www.gravatar.com/avatar/'+username_md5hash+'?s=96&d=monsterid'; $this.attr('src', avatar); } else { // custom image $this.attr('src', userdict[username]); } } else if (AVATARS_FOR_ALL) { if (AVATARS_FOR_ALL == 'robot') { var avatar = 'http://robohash.org/'+username_md5hash+'png?size=96x96'; $this.attr('src', avatar); } else if (AVATARS_FOR_ALL == 'monster') { var avatar = 'http://www.gravatar.com/avatar/'+username_md5hash+'?s=96&d=monsterid'; $this.attr('src', avatar); } } else if (AVATARS_FOR_AVATARLESS && $this.attr('src').indexOf('xenforo/avatars') > -1) { // username is not in userdict and user doesn't have an avatar if (AVATARS_FOR_AVATARLESS == 'robot') { var avatar = 'http://robohash.org/'+username_md5hash+'png?size=96x96'; $this.attr('src', avatar); } else if (AVATARS_FOR_AVATARLESS == 'monster') { var avatar = 'http://www.gravatar.com/avatar/'+username_md5hash+'?s=96&d=monsterid'; $this.attr('src', avatar); } } }); }); // MD5 Hash | https://github.com/blueimp/JavaScript-MD5 (function(a){function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b>5]|=(255&a.charCodeAt(b/8))<16&&(e=i(e,8*a.length)),c=0;16>c;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}"function"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this));