1 2function open_social_param(name){ 3 var aParams = document.location.search.substr(1).split('&'); 4 for (var i = 0; i < aParams.length; i++){ 5 var aParam = aParams[i].split('='); 6 if(decodeURIComponent(aParam[0]) == name) return decodeURIComponent(aParam[1]); 7 } 8 return ''; 9} 10 11function login_button_click(id,link,type,site){ 12 var back = location.href; 13 if(id=='wechat_mp' && !/MicroMessenger/.test(navigator.userAgent)){ 14 jQuery('#os-popup-overlay, #os-popup-box').remove(); 15 jQuery('body').append("<div id='os-popup-overlay'></div><div id='os-popup-box' class='os-popup-box'><div id='os-popup-title'>"+jQuery('#os-popup-placeholder').html()+"</div><div id='os-popup-content'></div></div>"); 16 jQuery('#os-popup-overlay').show(); 17 jQuery('#os-popup-box').css({ 18 top: jQuery(window).height()/2-175, left: jQuery(window).width()/2-150 19 }).show(); 20 jQuery('#os-popup-content').empty().qrcode({ 21 width: 250, height: 250, text: os_utf16to8(decodeURIComponent(location.href)) 22 }); 23 return; 24 } 25 if(open_social_param('redirect_to')) back = open_social_param('redirect_to'); 26 location.href = link + (/\?/.test(link) ? '&' : '?') + 'connect=' + id + '&action=' + type + (site ? '&site='+site : '') + '&back=' + escape(back); 27} 28 29function share_button_click(link){ 30 var url = encodeURIComponent(location.href); 31 var title = encodeURIComponent(document.title); 32 var summary = document.querySelector('.entry-content') || document.querySelector('article') || document.querySelector('main') || document.querySelector('body') || ''; 33 var pic = '', pics = ''; 34 if(summary){ 35 var obj = summary.querySelectorAll('img'); 36 for (var i = 0; i < obj.length; i++){ 37 pics += (pics?'||':'') + encodeURIComponent(obj[i].getAttribute('data-src')||obj[i].getAttribute('src')); 38 if(i>2) break; 39 } 40 summary = encodeURIComponent(summary.innerText.replace(/\r|\n|\t/g,'').replace(/ +/g,' ').replace(/<!--(.*)\/\/-->/g,'').substr(0,80)); 41 pic = pics.split('||')[0]; 42 } 43 if(!pic && window.os_share_image) pic = os_share_image.url; 44 if(!/summary/.test(link) && summary) title = title + ': ' + summary + '.. '; 45 link = link.replace(/%URL%/g,url).replace(/%TITLE%/g,title).replace(/%SUMMARY%/g,summary).replace(/%PICS%/g,pics).replace(/%PIC%/g,pic); 46 window.open(link, 'xmOpenWindow', 'width=750,height=600,menubar=0,scrollbars=1,resizable=1,status=1,titlebar=0,toolbar=0,location=1'); 47} 48 49function os_utf16to8(str){ 50 var i, c, out = '', len = str.length; 51 for(i = 0; i < len; i++) { 52 c = str.charCodeAt(i); 53 if ((c >= 0x0001) && (c <= 0x007F)) { 54 out += str.charAt(i); 55 } else if (c > 0x07FF) { 56 out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); 57 out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); 58 out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); 59 } else { 60 out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); 61 out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); 62 } 63 } 64 return out; 65} 66 67window.jQuery && (function(){ 68 jQuery(document).on('click', '.os-share-box .os-wechat', function(){ 69 jQuery('#os-popup-overlay, #os-popup-box').remove(); 70 jQuery('body').append("<div id='os-popup-overlay'></div><div id='os-popup-box' class='os-popup-box'><div id='os-popup-title'>"+jQuery('#os-popup-placeholder').html()+"</div><div id='os-popup-content'></div></div>"); 71 jQuery('#os-popup-overlay').show(); 72 if(/Mobile/.test(navigator.userAgent)){ 73 jQuery('#os-popup-title').hide(); 74 jQuery('#os-popup-box').removeClass().css({ 75 top: 0, right: 0, background: 'transparent', zIndex: 100000 76 }).show(); 77 jQuery('#os-popup-content').html('<i class="os-icon os-share-native"><svg aria-hidden="true"><use xlink:href="#os-share-native"></use></svg></i>'); 78 }else{ 79 jQuery('#os-popup-box').css({ 80 top: jQuery(window).height()/2-175, left: jQuery(window).width()/2-150 81 }).show(); 82 jQuery('#os-popup-content').empty().qrcode({ 83 width: 250, height: 250, text: os_utf16to8(decodeURIComponent(location.href)) 84 }); 85 } 86 });
87 jQuery(document).on('click', '#os-popup-overlay, #os-popup-box', function(){ 88 jQuery('#os-popup-overlay, #os-popup-box').hide(); 89 }); 90})(); 91 92document.addEventListener && document.addEventListener("DOMContentLoaded", function(){ 93 if(window.wx && 'object' == typeof os_wechat_init){ 94 os_wechat_init['debug'] = false; 95 os_wechat_init['jsApiList'] = ['onMenuShareAppMessage','onMenuShareTimeline','updateAppMessageShareData','updateTimelineShareData']; 96 wx.config(os_wechat_init); 97 wx.ready(function(){ 98 var shareData = { 99 title: document.title, 100 desc: '', 101 link: location.href, 102 imgUrl: '' 103 }; 104 var content = document.querySelector('.entry-content') || document.querySelector('article') || document.querySelector('body') || ''; 105 if(content){ 106 shareData.desc = content.innerText.replace(/\r|\n|\t/g,'').replace(/ +/g,' ').replace(/<!--(.*)\/\/-->/g,'').substr(0,50); 107 var img = content.querySelector('img'); 108 if(img){ 109 shareData.imgUrl = img.getAttribute('data-src')||img.getAttribute('src'); 110 }else{ 111 if(window.os_share_image) shareData.imgUrl = os_share_image.url; 112 } 113 } 114 if(wx.onMenuShareAppMessage){ 115 wx.onMenuShareAppMessage(shareData); 116 wx.onMenuShareTimeline(shareData); 117 }else{ 118 wx.updateAppMessageShareData(shareData); 119 wx.updateTimelineShareData(shareData); 120 } 121 }); 122 wx.error(function(res){ 123 window.console && console.log(res.errMsg); 124 }); 125 }; 126}, false);
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.