main.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. (function(){
  2. var bp = document.createElement('script');
  3. var curProtocol = window.location.protocol.split(':')[0];
  4. if (curProtocol === 'https') {
  5. bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  6. }
  7. else {
  8. bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  9. }
  10. var s = document.getElementsByTagName("script")[0];
  11. s.parentNode.insertBefore(bp, s);
  12. })();
  13. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  14. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  15. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  16. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  17. ga('create', 'UA-33096931-4', 'auto');
  18. ga('send', 'pageview');
  19. window.onload = function() {
  20. setTimeout(function() {
  21. var ad = document.querySelector("ins.adsbygoogle");
  22. if (ad && ad.innerHTML.replace(/\s/g, "").length == 0) {
  23. if (typeof ga !== 'undefined') {
  24. ga('send', 'event', 'Adblock', 'Yes');
  25. } else if (typeof _gaq !== 'undefined') {
  26. _gaq.push(['_trackEvent', 'Adblock', 'Yes']);
  27. }
  28. }
  29. }, 2000);
  30. };