pjax(InstantClick)一般需要重载的函数,希望这篇文章能让大家少浪费点时间

多说评论

if (typeof DUOSHUO !== 'undefined'){
DUOSHUO.EmbedThread('.ds-thread');} /

网易云跟贴

if (typeof Tie !== 'undefined') {
                        Tie.loader("", true);
            }

畅言(代码来自http://www.neurallinker.com/94.misaka)

if($("#SOHUCS").length==1){
window.changyan = undefined;window.cyan = undefined;
$.getScript("https://changyan.sohu.com/upload/changyan.js", function(){window.changyan.api.config({appid: "你的appid参数",conf: "你的conf参数"});});
}

百度统计

 if (typeof _hmt !== 'undefined'){
      _hmt.push(['_trackPageview', location.pathname + location.search]);
}  

谷歌统计

if (typeof ga !== 'undefined'){
        ga('send', 'pageview', location.pathname + location.search);
} 

piwik统计

 _paq.push(['setDocumentTitle', document.title]);
    _paq.push(['trackPageView']);

SynatxHighlighter

 SyntaxHighlighter.highlight();

google code prettify

   if (typeof prettyPrint !== 'undefined'){
      prettyPrint();
} 

MathJax

if (isInitialLoad === false) {
    if (typeof MathJax !== 'undefined'){
      MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
} 

Prism.js语法高亮

 if (typeof Prism !== 'undefined') {
Prism.highlightAll(true,null);}

如果有问题,可以参考《instantclick兼容Prismjs插件》

欢迎补充

版权属于:泽泽社长
本文链接:https://blog.zezeshe.com/archives/pjax-overloaded-functions.html
本站未注明转载的文章均为原创,并采用 CC BY-NC-SA 4.0 授权协议,转载请注明来源,谢谢!