1 Star 1 Fork 0

柠檬不萌/左程云笔记

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pc_wap_commontools-094b8ec121.min.js.下载 5.42 KB
一键复制 编辑 原始数据 按行查看 历史
柠檬不萌 提交于 2024-04-12 21:53 . fir
$(function(){function e(){return!!window.navigator.userAgent.toLowerCase().match(/(csdn)/i)||!!u}function t(e){if(void 0!==typeof e&&null!==e&&""!==e)return e=e.toLowerCase(),class_name="hl-1",class_name}function n(e){return void 0===e||null===e||""===e}function o(e,t){n(t)||(t=t.toLowerCase().replace(/(^\s*)|(\s*$)/g,""),n(t)||(t.indexOf(" ")>0?$.each(t.split(/ +/g),function(t,n){o(e,n)}):"..."!==t&&t.length>1&&"&nbsp;"!==t&&"csdn"!==t&&"||"!==t&&(e[t]=0)))}function i(e){var t={};keyword=e.join(" "),o(t,keyword);var n=Object.keys(t);return n.sort(function(e,t){return t.length-e.length}),n}function r(n,o){for(var i=(o.html(),""),r=o.context.childNodes,a=0;a<r.length;a++){var c=r[a];if("#text"===c.nodeName){var s=c.textContent.replace(/</gi,"&lt;"),u=/[\u4e00-\u9fa5]/gi,h=n.map(function(e){return u.test(e)?e:"\\b"+e+"\\b"}),w=new RegExp(h.join("|"),"ig"),f=!1;s=s.replace(w,function(n){var o=n.toLowerCase(),i="https://so.csdn.net/so/search?q="+encodeURIComponent(n)+"&spm=1001.2101.3001.7020";i=e()?"csdnapp://app.csdn.net/search/searchRoot?keyword="+encodeURIComponent(n)+"&t=blog&u="+username+"&from_tracking_code=art_highlight_word&backSearch=true":i;var r=e()?'{"key_word":"'+n+'","spm":"1001.2101.3001.7020",}':'{"spm":"1001.2101.3001.7020","dest":"'+i+'","extra":"{\\"searchword\\":\\"'+n+'\\"}"}';return d[o]>=1||l===o||f?n:(f=!0,d[o]=d[o]?d[o]+1:1,l=o,e()?'<a data-href="'+i+'" class="app-hl hl '+t(o)+'" data-track-view='+r+" data-report-click="+r+">"+n+"</a>":'<a href="'+i+'" target="_blank" class="hl '+t(o)+'" data-report-view='+r+" data-report-click="+r+" data-tit="+n+" data-pretit="+l+">"+n+"</a>")}),i+=s}else i+=c.outerHTML?c.outerHTML:""}o[0].innerHTML=i,e()?($(window).on("scroll",function(){p.viewCheck()}),p.viewCheck()):window.csdn.report.viewCheck()}function a(){$("a.app-hl").off("click"),$("a.app-hl").click(function(e){e.preventDefault();var t=$(this).data("href"),n=$(this).attr("data-report-click"),o={action:"app_blog_highlight",trackingInfo:n,trackingCode:"art_highlight_word"},i={url:t};w&&(window.jsCallBackListener.csdntrackevent(JSON.stringify(o)),window.jsCallBackListener.csdnjumpnewpage(JSON.stringify(i))),f&&(window.webkit.messageHandlers.csdntrackevent.postMessage(JSON.stringify(o)),window.webkit.messageHandlers.csdnjumpnewpage.postMessage(JSON.stringify(i)))})}function c(){window.keyword_list_init=!0,$.ajax({type:"GET",url:"https://redisdatarecall.csdn.net/recommend/get_head_word?bid=blog-"+articleId,dataType:"json",timeout:2e3,xhrFields:{withCredentials:!0},success:function(t){if(200==t.status&&t.content){var n=i(t.content),o=t.ext?t.ext:{};if(void 0===n||0===n.length)return;window.keyword_list=n,window.keyword_list_json=o;var c=$("#content_views").find("p,h1,h2,h3,h4,h5,h6");window.keyword_list_doms=c,$.each(c,function(e,t){var t=$(t);r(n,t)}),e()&&a()}}})}var s,d={},l="",u=!!window.isApp&&window.isApp,h=navigator.userAgent,w=h.indexOf("Android")>-1||h.indexOf("Adr")>-1,f=!!h.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),p={scrollTop:function(){return Math.max(document.body.scrollTop,document.documentElement.scrollTop)},windowHeight:function(){return"CSS1Compat"==document.compatMode?document.documentElement.clientHeight:document.body.clientHeight},getElementBottom:function(e){if("undefined"!=typeof jQuery)return $(e).offset().top+$(e).height();var t=e.offsetTop;for(e=e.offsetParent;null!=e;)t+=e.offsetTop,e=e.offsetParent;return t},isView:function(e){var t=this;if(!e)return!1;var n=p.getElementBottom(e),o=n+e.offsetHeight;return t.scrollTop()<n&&n<t.scrollTop()+t.windowHeight()||t.scrollTop()<o&&o<t.scrollTop()+t.windowHeight()},reportView:function(e){console.log("app report exposure",e),w&&(console.log("isAndroid"),window.jsCallBackListener.csdntrackexpo(JSON.stringify(e))),f&&(console.log("isiOS"),window.webkit.messageHandlers.csdntrackexpo.postMessage(JSON.stringify(e)))},viewCheck:function(){clearTimeout(s),s=setTimeout(function(){$("[data-track-view]").each(function(){var e=$(this);if(p.isView(e.get(0))){var t=e.attr("data-track-view"),n={trackingCode:"art_highlight_word",trackingInfo:t};p.reportView(n),e.removeData("trackView"),e.removeAttr("data-track-view")}})},200)}};c();var g=$("#keywordDecBox");g.length&&($(document).on("mouseover","#article_content .hl",function(){var e=$(this).attr("data-tit"),t=$(this).attr("data-pretit"),n=Object(keyword_list_json)[t];if(e&&n){var o=$(this).offset().left,i=$(this).offset().top,r=$(this).outerHeight(!0),a='<span class="tit">'+e+'</span><span class="dec">'+n+"</span>";g.html(a).css({left:o,top:i+r}).show()}}),$(document).on("mouseout","#article_content .hl",function(){g.hide()}),g.on({mouseover:function(){$(this).show()},mouseout:function(){$(this).hide()}}))}),function(){function e(){return!!window.navigator.userAgent.toLowerCase().match(/(phone|pad|pod|iphone|ipod|ios|ipad|android|mobile|blackberry|iemobile|mqqbrowser|juc|fennec|wosbrowser|browserng|webos|symbian|windows phone)/i)}function t(){return!!window.navigator.userAgent.toLowerCase().match(/(csdn)/i)}function n(){var n=null,o=[];if(e())n=document.querySelectorAll('[class^="container-fluid container-fluid-flex container-"]'),o=document.querySelectorAll(".container-fluid.bdinsert");else{if(t())return!1;n=document.querySelectorAll("div[class^='recommend-item-box type_'],div.recommend-item-box.baiduSearch"),o=document.querySelectorAll("div.recommend-item-box.baiduSearch")}n=null!==n?n.length:0;var i=n-o.length;0===i&&$.get("https://statistic.csdn.net/blog/recommend?count="+i+"&baiducount="+o.length+"&articleId="+articleId)}n()}();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zheng-linmou/left-cheng-cloud-notes.git
[email protected]:zheng-linmou/left-cheng-cloud-notes.git
zheng-linmou
left-cheng-cloud-notes
左程云笔记
master

搜索帮助