Guest User

Untitled

a guest
Mar 20th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. <img src="/ads/" width="0" height="0" border="0" alt="adblocktest" id="adblocktest" onload="this.imgloaded=true;" onerror="this.imgloaded=true;" />
  2.  
  3. <script type="text/javascript">
  4.  
  5. adblockblock = function() {
  6. if (window.addEventListener) {
  7. window.addEventListener('load', this.bind(this.initialize), false);
  8. } else if (window.attachEvent) {
  9. window.attachEvent('onload', this.bind(this.initialize));
  10. }
  11. };
  12.  
  13. adblockblock.prototype = {
  14.  
  15. initialize: function() {
  16. this.interval = setInterval(this.bind(this.test), 1000);
  17. this.test();
  18. },
  19.  
  20. test: function() {
  21.  
  22. var element=document.getElementById('adblocktest');
  23.  
  24. /* Maxthon?, Konqueror
  25. */
  26. if(!element)
  27. {
  28. this.logger('Element image non trouvé');
  29. return this.block();
  30. }
  31.  
  32. /*
  33. */
  34. if (element.complete && !element.imgloaded)
  35. {
  36. this.logger('Görüntü yüklenmediyse');
  37. return this.block();
  38. }
  39.  
  40. /* Eski Adblock
  41. */
  42. var display = this.getStyle(element, 'display');
  43. var visibility = this.getStyle(element, 'visibility');
  44. var position = this.getStyle(element, 'position');
  45. if (display != 'inline' || (visibility != 'visible' && visibility != 'inherit') || position != 'static')
  46. {
  47. this.logger('Image cachée: display='+display+' visibility='+visibility+' position='+position);
  48. return this.block();
  49. }
  50.  
  51. /* Adblock ile engellemeyen boy ve yükseklik 0 olmalı
  52. */
  53. if ((element.naturalWidth && element.naturalWidth > 0) || (element.naturalHeight && element.naturalHeight > 0)) {
  54. this.logger('Resim değiştirildi');
  55. return this.block();
  56. }
  57. /* Pour Konqueror
  58. */
  59. if (element.width && element.width == 64) {
  60. this.logger('Resim değiştirildi (Konqueror)');
  61. return this.block();
  62. }
  63. },
  64.  
  65. getStyle: function(element, key) {
  66. if (document.defaultView && document.defaultView.getComputedStyle) {
  67. return document.defaultView.getComputedStyle(element, '').getPropertyValue(key);
  68. } else {
  69. return element.currentStyle[key];
  70. }
  71. },
  72.  
  73. block: function(blockMethod) {
  74. // Bu satırı kaldırmayın
  75. if (this.interval) clearInterval(this.interval);
  76.  
  77. // Burada adblockçular ne yapmak istiyorsanız onu
  78. alert('Bu sitede rahatsız edici reklamlar yoktur.Adblock ayarlarından engeli kaldırın.! ');
  79. },
  80.  
  81. bind: function(func) {
  82. var obj = this;
  83. return function() {
  84. return func.apply(obj, []);
  85. };
  86. },
  87.  
  88. logger: function(str) {
  89. if (typeof console == 'undefined') return;
  90. if (typeof console.log == 'undefined') return;
  91. console.log(str);
  92. }
  93. };
  94.  
  95. /* Firebug için debuger
  96. if (typeof console == 'undefined') {
  97. console={};
  98. console.log = function(str) {
  99. var el = document.createElement('div');
  100. el.appendChild(document.createTextNode(str));
  101. document.body.appendChild(el);
  102. };
  103. }
  104. */
  105.  
  106. new adblockblock();
  107. </script>
Advertisement
Add Comment
Please, Sign In to add comment