You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
23 KiB
1 line
23 KiB
2 years ago
|
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){function e(e,a){var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,a&&a())}:n.onload=function(){a&&a()},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}function a(e){this.tabType=1,this.username=e.username,this.nickname=e.nickname,this.avatar=e.avatar,this.alreadyHaveCount=-1,this.allHaveCount=-1,this.haveListReady=this.allListReady=!1,this.options=e,this.self=this.isSelf(),this.allMedalList=[],this.haveMedalList=[],this.allTabIndex=0,this.getData()}function n(e){this.username=e.username,this.haveDataReady=!1,this.medalList=[],this.index=0,this.options=e,this.getData()}function t(e){this.medalId=e.medalId,this.level=e.level,this.shareType=e.shareType,this.haveDataReady=!1,this.msData={},this.mAllData=e.allData||[],this.options=e,this.getData()}var l="http"===location.protocol.substr(0,4)?"":"https:",d=l+"//g.csdnimg.cn/user-medal/2.0.0/user-medal.css",i="https://g-api.csdn.net/user-medal";!function(e){var a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.href=e,document.getElementsByTagName("head")[0].appendChild(a)}(d),window.QRCode||e("https://g.csdnimg.cn/lib/qrcode/1.0.0/qrcode.min.js"),window.html2canvas||e("https://g.csdnimg.cn/lib/html2canvas/1.4.1/html2canvas.min.js");a.prototype={constructor:a,init:function(){this.haveListReady&&this.allListReady&&(this.renderMain(),this.renderTab(),this.renderNav())},renderMain:function(){var e=this,a=$('<div id="user-medal">\n <div class="user-medal-container">\n <div class="user-medal-head"> \n <img src="'+e.avatar+'">\n <span class="user-medal-close"></span>\n </div>\n <div class="user-medal-body">\n <div class="user-medal-content medal-clearfix">'+(e.self?'\n <div class="medal-content-body"></div>\n <div class="medal-geted-share '+(1==e.tabType&&e.alreadyHaveCount>0?"":"hide")+'"><span id="to-share-all">分享全部已解锁勋章</span></div>\n ':'<div class="medal-content-body medal-content-body-others"></div>')+"</div>\n </div>\n </div>\n </div>");e.$box=a,a.find(".user-medal-close").click(function(){e.close()}),a.on("click",function(a){$(a.target).find(".user-medal-container").length&&e.close()}),$("body").find("#user-medal").remove(),$("body").append(a),a.find("#to-share-all").click(function(){window.csdn.userMedal.share({shareType:"all",allData:e.haveMedalList})})},renderTab:function(){var e=this,a=$('<div class="user-medal-tab medal-clearfix">\n <p class="medal-fl medal-user-info">\n <span class="medal-name" title="'+e.nickname+'">'+e.nickname+'</span>\n <span class="medal-count '+(e.alreadyHaveCount>0?"":" no-data")+'" >已经获得<em id="medal-count">'+(e.alreadyHaveCount||0)+"</em>种勋章啦~</span>\n </p>"+(e.self?'<p class="medal-fr medal-user-btns">\n <span class="medal-btn medal-btn-tab" data-type=1>已解锁勋章</span>\n <span class="medal-btn medal-btn-tab" data-type=2>全部勋章</span>\n </p>\n ':" ")+"</div>");a.find(".medal-user-btns .medal-btn").click(function(a){$(this).hasClass("medal-btn-red")||(e.resetScrollTop(),e.tabType=$(this).data("type"),e.toggleNav(),1===e.tabType?(e.alreadyHaveCount>0&&(e.$box.find("#medal-count").html(e.alreadyHaveCount||0),e.$box.find(".medal-content-body").toggleClass("medal-content-body-geted"),e.$box.find(".medal-geted-share").show()),e.renderMedal(e.haveMedalList)):(e.$box.find("#medal-count").html(e.allHaveCount||0),e.$nav.find("li").removeClass("active"),e.$nav.find("li").first().click(),e.$box.find(".medal-geted-share").hide(),e.
|