1var url = "https://uc.chinaz.com"; 2$(function () { 3 xrLoginHtml(); 4 var ucCookie = getCookie("ucvalidate"); 5 if (ucCookie === null || ucCookie === "") { 6 delCookie("chinaz_zxuser"); 7 } 8 var ticket = getCookie("chinaz_zxuser"); 9 if (ticket === null || ticket === "") { 10 $.ajax({ 11 type: "get", 12 url: url + "/api/open/checklogin", 13 data: { f: "news", p: "pc" }, 14 xhrFields: { 15 withCredentials: true 16 }, 17 dataType:"JSON", 18 success: function (msg) { 19 if (msg.code === 0) { 20 setCookie("chinaz_zxuser", msg.data.ticket); 21 GetUserInfo(msg.data.ticket); 22 } 23 else { 24 let html = '<div class="login-div"> <a href="javascript:void(0);" onclick="OpenLogin()" class="login-btn login-before">[ç»å½/注å]</a><div class="user-infor"></div>' 25 $("#chinaz_topbar").html(html); 26 27 } 28 }, 29 error: function () { 30 } 31 }); 32 } 33 else { 34 GetUserInfo(ticket); 35 } 36 37 /** 38     * iframeç»å½éè¦çå¬å页é¢è¿å 39     */ 40 // çå¬å夿åªè½è°ç¨ä¸æ¬¡ 41 // messageåªé触å䏿¬¡ï¼è°ç¨å¤æ¬¡ä¼å¤æ¬¡è¿åç»æ 42 window.addEventListener('message', function (event) { 43 var type = event.data.type; 44 var data = event.data.data; 45 46 //Â å¤æåé¦ç±»å 47 switch (type) { 48 case 'CLOSE_LOGIN': //Â å ³éç»å½ï¼èªè¡å¤çï¼å ³éæå é¤iframe就好 49 closeLoginPop(); 50 break; 51 case 'SUCCESS_LOGIN': // æåç»å½ï¼è¿åticketï¼èªè¡å¤çï¼ä½ä¹éè¦å ³éæå é¤iframe 52 setCookie("chinaz_zxuser", data.ticket); 53 GetUserInfo(data.ticket); 54 closeLoginPop(); 55 break; 56 case 'REPEAT_LOGIN': // éå¤ç»å½ï¼ç¨æ·å¨å ¶ä»æ ç®ãå¹³å°ã页é¢ç»å½æ¶è§¦å 57 // æ è¿ååæ°ï¼å¯ä»¥èªè¡å·æ°é¡µé¢æå ¶ä»å¤ç 58 location.reload(); 59 break; 60 case 'CLIENT_JUMP': // 客æ·ç«¯è°æ´è¿æ¥ï¼ä¸æ¯å®¢æ·ç«¯è°ç¨å¯ä»¥å é¤ï¼ 61 console.log('éè¦å®¢æ·ç«¯æ¥è·³è½¬çè¿æ¥ï¼', data); 62 break; 63 } 64 }, false); 65 66}); 67 68function OpenLogin() { 69 $("#my-login").attr('src', 'https://uc.chinaz.com/?t=2&p=pc&f=news&r=https://www.chinaz.com&i=1&o=1'); 70 $(".com-login-box").show(); 71} 72 73// æ·»å ç»å½å¼¹çª 74function xrLoginHtml() { 75 let ifmBoxHtml = '<div class="com-login-box">'; 76 ifmBoxHtml += ' <iframe id="my-login" scrolling="no" frameborder="0" src=""></iframe>' 77 ifmBoxHtml += '</div>' 78 $("body").append(ifmBoxHtml) 79} 80 81function closeLoginPop() { 82 $(".com-login-box").hide() 83 $("#my-login").attr('src', '') 84} 85 86function GetUserInfo(ticket) { 87 $.ajax({
88 url: 'https://comment.chinaz.com/api/Login/GetUserInfo', 89 type: 'POST', 90 dataType: 'JSON', 91 data: "ticket=" + ticket, 92 xhrFields: { 93 withCredentials: true 94 }, 95 success: function (msg) { 96 if (msg.code === 0) { 97 let html = ' <div class="userbar user-infor" style="display: block;">' 98 html += ' <a class="username item-expand" href="https://uc.chinaz.com/user/mine" id="top_link_center" target="_blank"><span>ç¨æ·ä¸å¿</span><i class="iconfont icon-xiangxia is-rotate"></i></a>' 99 html += '<div class="dropdownmenu-wrap menu-setting" id="settingpopup"><div class="dropdownmenu"><div class="clearfix dropdownmenu-inner"><ul class="menu-setting-list"><li><a href="https://mt.chinaz.com/media-index.aspx" target="_blank">ä¼ åªä¸å¿</a></li><li><a href="//my.chinaz.com/ToolMember/Member/Account"target="_blank">å·¥å ·ä¸å¿</a></li><li><a href="https://user.chinaz.net/consoleOverview/index" target="_blank">弿¾å¹³å° </a></li></ul></div></div></div>' 100 html += '</div>' 101 html += ' <div class="user-infor">' 102 html += ' <a href="javascript:void(0);" onclick="loginout(\''+ ticket + '\')" class="logout">éåº</a>' 103 html += '</div>' 104 $("#chinaz_topbar").html(html); 105 userMenu() 106 } 107 } 108 }); 109} 110 111 112function loginout(ticket) { 113 $.ajax({
114 url: 'https://comment.chinaz.com/api/Login/LoginOut', 115 type: 'POST', 116 dataType: 'JSON', 117 contentType: 'application/x-www-form-urlencoded', 118 data: "ticket=" + ticket, 119 success: function (msg) { 120 if (msg.code === 0) { 121 delCookie("chinaz_zxuser"); 122 window.location.href = "https://www.chinaz.com"; 123 } 124 } 125 }); 126} 127 128//读åcookies 129function getCookie(cookieName) { 130 var cookieContent = ''; 131 var cookieAry = document.cookie.split("; ");//å¾å°Cookieæ°ç» 132 for (var i = 0; i < cookieAry.length; i++) { 133 var temp = cookieAry[i].split("="); 134 if (temp[0] === cookieName) { 135 cookieContent = unescape(temp[1]); 136 } 137 } 138 return cookieContent; 139} 140 141//设置cookieå¼ 142function setCookie(name, value) { 143 //document.cookie.setPath("/"); 144 var hour = 8 * 29; 145 var exp = new Date(); 146 exp.setTime(exp.getTime() + hour * 60 * 60 * 1000); 147 document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";Domain=.chinaz.com;path=/"; 148} 149 150 151//å é¤cookie 152function delCookie(name) { 153 var exp = new Date(); 154 exp.setTime(exp.getTime() - 1); 155 var cval = getCookie(name); 156 if (cval != null) { 157 document.cookie = name + "=" + cval + ";Domain=.chinaz.com;path=/;expires=" + exp.toGMTString(); 158 } 159} 160 161function userMenu(){ 162 var userbar = $('.userbar'); 163 userbar.mouseleave(function(){$('.menu-setting').css({"display":"none"})}) 164 userbar.mouseover(function(){$('.menu-setting').css({"display":"block"})}) 165 166}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.