Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var hideableAds = (function() {
- var adBlocks = $('a[href*="ads."]').closest('table');
- var hideAds = function() {
- adBlocks.hide();
- localStorage.setItem('hideableAdsHide', true);
- };
- var beHideable = function() {
- var hideButton = $('<div class="hideAd">✗</div>');
- hideButton.css({
- position: 'absolute',
- top: '0',
- right: '-20px',
- width: '20px',
- lineHeight: '20px',
- fontSize: '16px',
- textAlign: 'center',
- background: 'red',
- color: 'white',
- cursor: 'pointer',
- zIndex: 1000
- }).click(function(e) {
- e.preventDefault();
- hideAds();
- });
- adBlocks.each(function() {
- var $this = $(this);
- $this.css({
- position: 'relative'
- });
- $this.append(hideButton);
- });
- };
- return {
- init: function() {
- if ( localStorage.getItem('hideableAdsHide') === null ) {
- beHideable();
- } else {
- this.hide();
- }
- },
- hide: function() {
- hideAds();
- }
- };
- }());
- hideableAds.init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement