贴吧高清头像查看

可以查看贴吧用户的高清头像

目前為 2018-04-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name        贴吧高清头像查看
// @author      有一份田,Sonico俺の嫁,YIU
// @description 可以查看贴吧用户的高清头像
// @namespace   TieBaHDAvatar-youyifentian
// @icon        http://www.duoluohua.com/images/favicon.ico
// @license     GPL version 3
// @encoding    utf-8
// @date        09/12/2013
// @modified    11/18/2017
// @include     *://tieba.baidu.com/p/*
// @include     *://tieba.baidu.com/f*
// @include     *://tieba.baidu.com/home/*
// @grant       none
// @run-at      document-end
// @version     1.0.2
// ==/UserScript==



/*
 * === 说明 ===
 *@作者:有一份田,Sonico俺の嫁,YIU
 *@官网:http://www.duoluohua.com/download/
 *@Email:[email protected]
 *@Git:http://git.oschina.net/youyifentian
 *@转载重用请保留此信息
 *
 *
 * */


(function(){
	var portraitCache = {};
	$('body').bind('DOMNodeInserted',function(e){
		var o = $(e.target).find('.interaction_wrap');
		if(o.length){
			createEleBtn(o);
		}
	});
	function createEleBtn(o){
		$('<a href="javascript:;">').addClass("btn-encourage btn-small  user-visit-card-marriage-propose").click(function(){

			var uname = o.parents('.ui_card_content').find('a.userinfo_username').text();
			var uimgurl = $("#user_visit_card .interaction_wrap").parents('.ui_card_content').find('.j_avatar img')[0].src;
			var hexUID = getHexUid(o.parents('.ui_card_content').find(".interaction_wrap a[target='sixin']")[0].href.match(/\d+$/g));

			showHighAvatar(uname, hexUID, uimgurl);
		}).html('\u9ad8\u6e05\u5934\u50cf').prependTo(o);
	}
	function getHexUid(uid){
		hexuid =  FormatHex(parseInt(uid).toString(16));
		reg = /[a-z\d]{2}/g;
		return hexuid.match(reg).reverse().toString().replace(/,/g,'');
	}
	function FormatHex( hex ){
		zero = "00000000";
		tmp  = 8 - hex.length;
		return zero.substr(0, tmp) + hex;
	}
	function showHighAvatar(uname, hexuid, uimgurl){
		var hdImgUrl = function(){
			if(uimgurl.indexOf('portrait/') > 0)
			{
				return uimgurl.replace('portrait/','portraitl/');
			}else if(uimgurl.indexOf('hiphotos.') > 0)
			{
				return "http://imgsrc.baidu.com/forum/pic/item/" + uimgurl.substring(uimgurl.lastIndexOf('/') + 1);
			}else{
				return "https://gss0.baidu.com/7Ls0a8Sm2Q5IlBGlnYG/sys/portraitl/item/" + hexuid;
			}
		},
			httpHwnd = null,
			modal= new $.modal({show: true}),box=$('<div/>').css({
				"left":"50%",
				"top":"50%",
				"position":"fixed",
				"min-height":"240px",
				"min-width":"240px",
				"z-index":$.getzIndex()
			}).appendTo("body"),
			dialogClose = function(){
				if(httpHwnd){httpHwnd.abort();}
				modal.remove();
				box.remove();
			},
			loadingImg = $('<img src="https://tb2.bdstatic.com/tb/static-ihome/img/loading.gif"/>').css({
				"height":"32px",
				"width":"32px",
				"margin-left":"-16px",
				"margin-top":"-16px"
			}).appendTo(box),
			loadImg = function(){
				var imgurl = hdImgUrl(),
					img = new Image();
				img.src = imgurl;
				img.onload = function(){
					var h = img.height,w = img.width;
					loadingImg.remove();
					$(img).css({
						"height":h+"px",
						"width":w+"px",
						"margin-left":"-"+w/2+"px",
						"margin-top":"-"+h/2+"px",
						"border-radius":"3px",
						"box-shadow":"0 0 15px rgba(127, 173, 220, 0.8), 0 0 15px #7FADDC inset",
						"cursor":"url(\"https://tb2.bdstatic.com/tb/img/frs/cur_zout.cur\"), pointer"
					}).attr('title',uname).appendTo(box);
				};
			};

		loadImg();
		box.click(dialogClose);
		modal.element.click(dialogClose);
	}

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址