Skip to content

Instantly share code, notes, and snippets.

@ayal
Last active June 6, 2019 22:13
Show Gist options
  • Save ayal/5529e97041b8ae4e3d0bb99e808b9312 to your computer and use it in GitHub Desktop.
Save ayal/5529e97041b8ae4e3d0bb99e808b9312 to your computer and use it in GitHub Desktop.
cleans haaretz articles
javascript:void(
function(){
document.head.innerHTML = '';
var jsCode=document.createElement('script');
jsCode.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js');
document.body.appendChild(jsCode);
setTimeout(()=>{
var art = $('.article');
if (art.length === 0) {
art = $($('article')[0]);
}
$(art).find('script').remove();
console.log('article', art);
var jsCode=document.createElement('script');
jsCode.setAttribute('src',"https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js");
document.body.appendChild(jsCode);
document.body.dir='rtl';
$('body').css({opacity:0.2});
setTimeout(()=>{
console.log(2);
WebFont.load({
google: {
families: ['Varela Round:100,200,300,400,700:hebrew']
}});
art.css({fontFamily:"Varela Round", fontSize:13});
$('body script').remove();
$('img').css({maxHeight:'200px'});
$('.js-modal').remove();
$('.paywall-pop-small').remove();
$('.footer').remove();
$('.modal-wrapper').remove();
$('#post_comments+*').remove();
$('#post_comments').remove();
$('body').scrollTop(0);
$('*[data-back="teaser"]').remove();
$('.h-hidden').remove();
$('*[data-back="lst--zagreb"]').remove();
$('*[data-back="lst--geneva"]').remove();
$('.newsletterQRWrapper').remove();
$('body').css({opacity:1});
},2500);
$('figure').css({margin:0});
console.log(3);
$('.comments').remove();
$('img').css({maxHeight:'200px'});
$('iframe').each((i,ifrm)=>{
if (!$(ifrm).hasClass('yt-embed') &&
$(ifrm)[0].src.indexOf('facebook.com') === -1) {
$(ifrm).remove();
}
});
$('*[data-back="teaser"]').remove();
$('iframe').css({maxHeight:200, maxWidth:300});
$('.rel-art').remove();
$('button').remove();
$('.art__tools').remove();
$('.art__info').css({fontSize:10});
$('.js-art__info__overlay').remove();
$('aside').remove();
$('.js-dfp-ad').remove();
$('head').html('');
$('html,body').css({height:'100%', 'display': 'center'});
$('body').css({overflow:'auto', 'display': 'flex', justifyContent: 'center'}).html('').append(art);
$('.paywall-pop-small').remove();
console.log(4);
art.css({'lineHeight': '25px', padding:50, width:'40%'});
$('.outbrain-wrapper').remove();
$('.clickTrackerwrapper').remove();
$('figcaption').css({fontSize:10});
$('.h-hidden').remove();
},1000)
}());
@ayal
Copy link
Author

ayal commented May 23, 2018

Instructions for chrome:
Click the main More icon (three vertical dots, top right) and then Bookmarks and then Bookmark Manager.
In the Bookmark Manager, click the More icon and then Add new bookmark.
Enter a name for the bookmark (for example, Haaretz Cleaner).
Copy and paste the above code into the “URL” box
Click Save.
Navigate to a Haaretz Article
Click your newly created bookmark to run the code on a Haaretz Article.
The bookmark appears where you placed it in step 2. For example, it may be in the bookmarks bar under the address bar.
If you don't have the bookmarks bar always showing, click "Command + Shift + b" to show it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment