Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. <style>
  2. #banner_ict {
  3. display: inline-block;
  4. min-height: 200px;
  5. height: 200px;
  6. width: 100%;
  7. overflow: hidden;
  8. }
  9. #banner_ict ins a img {
  10. transform: translateY(-533px);
  11. }
  12. #banner_ict ins iframe {
  13. width: 300px;
  14. }
  15. </style>
  16. <div id="banner_ict" style="display: none">
  17. <ins data-revive-zoneid="2" data-revive-id="bdd66532c84f3e252b918b835af34252"></ins>
  18. <script async src="//ads.ictglobus.com/www/delivery/asyncjs.php"></script></div>
  19. <script type="text/javascript">
  20. var startedAsMobile = false;
  21. var adSense = false;
  22. (function() {
  23. var lastTime = 0;
  24. var vendors = ['ms', 'moz', 'webkit', 'o'];
  25. for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
  26. window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
  27. window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
  28. || window[vendors[x]+'CancelRequestAnimationFrame'];
  29. }
  30.  
  31. if (!window.requestAnimationFrame)
  32. window.requestAnimationFrame = function(callback, element) {
  33. var currTime = new Date().getTime();
  34. var timeToCall = Math.max(0, 16 - (currTime - lastTime));
  35. var id = window.setTimeout(function() { callback(currTime + timeToCall); },
  36. timeToCall);
  37. lastTime = currTime + timeToCall;
  38. return id;
  39. };
  40.  
  41. if (!window.cancelAnimationFrame)
  42. window.cancelAnimationFrame = function(id) {
  43. clearTimeout(id);
  44. };
  45. }());
  46. function frameRequest() {
  47. if(startedAsMobile) {
  48. var bannerTop = document.getElementById("banner_ict").offsetTop;
  49. var wind = window.screen.height;
  50. var pos = window.scrollY;
  51. var newPos = -wind + ( wind + pos - bannerTop);
  52.  
  53. if(window.screen.width <= 769)
  54. document.querySelector('#banner_ict').style.display = 'block';
  55. else
  56. document.querySelector('#banner_ict').style.display = 'none';
  57.  
  58. if(!adSense)
  59. document.querySelector('#banner_ict ins a img').style.transform = 'translateY('+newPos+'px)';
  60. else
  61. document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.top = newPos+'px';
  62. }
  63. }
  64. jQuery(document).ready(function() {
  65. if(window.screen.width <= 769)
  66. {
  67. startedAsMobile = true;
  68. document.querySelector('#banner_ict').style.display = 'block';
  69.  
  70. window.onresize = function() {
  71. if(window.screen.width <= 769)
  72. document.querySelector('#banner_ict').style.display = 'block';
  73. else
  74. document.querySelector('#banner_ict').style.display = 'none';
  75. }
  76.  
  77. var stillloading = setInterval(function() {
  78. if(document.querySelector('#banner_ict ins a img') != null)
  79. {
  80. clearInterval(stillloading);
  81. adSense = false;
  82. document.querySelector('#banner_ict ins a img').offsetWidth = window.screen.width;
  83. document.querySelector('#banner_ict ins a img').style.height = window.screen.height+"px";
  84. document.querySelector('#banner_ict ins a img').style.minHeight = window.screen.height+"px";
  85. document.querySelector('#banner_ict ins a img').style.maxHeight = window.screen.height+"px";
  86.  
  87. var parChilds = document.querySelector('.field-name-field-fulltext .field-items .field-item.odd').childNodes;
  88. var elP = parChilds[Math.round(parChilds.length / 2) + 1];
  89. document.querySelector('.field-name-field-fulltext .field-items .field-item.odd').insertBefore(document.getElementById('banner_ict'), elP);
  90.  
  91. window.requestAnimationFrame(frameRequest);
  92. window.onscroll = function() {
  93. window.requestAnimationFrame(frameRequest);
  94. };
  95. }
  96. else if((typeof window.adsbygoogle !== 'undefined' && window.adsbygoogle.loaded) || (document.querySelector('#banner_ict ins iframe') !== null && (document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle') != null)))
  97. {
  98. if(document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe') != null)
  99. {
  100. clearInterval(stillloading);
  101. adSense = true;
  102. document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').offsetWidth = window.screen.width;
  103. document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.height = window.screen.height+"px";
  104. document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.minHeight = window.screen.height+"px";
  105. document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.maxHeight = window.screen.height+"px";
  106.  
  107. window.requestAnimationFrame(frameRequest);
  108. window.onscroll = function() {
  109. window.requestAnimationFrame(frameRequest);
  110. };
  111. }
  112. }
  113. }, 200);
  114. }
  115. });
  116. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement