CtgoFX

Remove ads and white spaces from chatango

当前为 2014-10-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name CtgoFX
  3. // @author Itsuki
  4. // @version 120614-3
  5. // @include http://*.chatango.com*
  6. // @grant GM_addStyle
  7. // @namespace https://greasyfork.org/users/6316
  8. // @description Remove ads and white spaces from chatango
  9. // ==/UserScript==
  10.  
  11. GM_addStyle (' \
  12. #ad, #ad_placeholder_td, #ad_wrapper, \
  13. #buyers_ad, #bottom_table, \
  14. * body [name*='google_ads_frame1'], \
  15. * body [name*='google_ads_frame2'], \
  16. #left_container [href*='ad'], .topad { \
  17. display: none !important; \
  18. visibility: hidden !important; \
  19. } \
  20. #flashcontent{ \
  21. display:block !important; \
  22. position:absolute !important; \
  23. top:0px; \
  24. left:0px; \
  25. width:100%; \
  26. height:100%; \
  27. }');
  28.  
  29. function styleElement (obj, styles) {
  30. for (var property in styles) {
  31. if (styles.hasOwnProperty(property)) obj.style[property] = styles[property];
  32. }
  33. }
  34.  
  35. function fixPage() {
  36. document.getElementsByTagName("col")[1].style.display = 'none';
  37. document.getElementsByTagName("colgroup")[0].style.display = 'none';
  38. styleElement(bottom_table, {display: "none", visibility: "hidden"});
  39. }
  40.  
  41. function removeAdSection() {
  42. styleElement(ad, {display: "none", visibility: "hidden"});
  43. styleElement(ad_placeholder_td, {display: "none", visibility: "hidden"});
  44. styleElement(ad_wrapper, {display: "none", visibility: "hidden"});
  45. styleElement(buyers_ad, {display: "none", visibility: "hidden"});
  46. styleElement(topad, {display: "none", visibility: "hidden"});
  47. }
  48.  
  49. try {
  50. fixPage();
  51. removeAdSection();
  52. } catch(err) {}