~/scriptsprint-thread

bookmarklet

פרינט אשכול

Print a whole thread

Loads every page of an Ivelt thread into one clean page, with no header, footer, profiles or buttons, ready to print.

  • working
  • works on ivelt.com
  • computer, Android, iPhone
פרינט אשכול

Drag this button up to your bookmarks bar. That's the whole install.

Don't see a bookmarks bar? Press Ctrl+Shift+B (on a Mac ⌘+Shift+B).

Can't drag? , then add a new bookmark and paste it as the bookmark's address (URL).

Install on a phone

First tap Copy the bookmarklet above. Then:

Android (Chrome)

  1. Tap ⋮ and then ☆ to bookmark any page.
  2. Tap Edit, change the name to פרינט אשכול, and replace the address with the copied text.
  3. To use it, go to the page, tap the address bar, type פרינט אשכול, and tap the bookmark in the suggestions.

iPhone (Safari)

  1. Tap the share button and choose Add Bookmark, then save.
  2. Open Bookmarks, tap Edit, tap the new bookmark, and replace the address with the copied text.
  3. To use it, go to the page, open Bookmarks, and tap it.

How to use it

  1. Open the Ivelt thread you want to print (any page of it).
  2. Click the bookmark. It loads all the pages of the thread, one after the other, into the page you’re on.
  3. When it’s done, print as usual (Ctrl+P), or save as PDF.

Long threads take a little while, so wait until all pages have loaded before printing.

Not working, or have an idea for it? Tell me.

Links

Source code

Show it here

var lastPage = $('.pagination li:not(.next):last').text();
var on_page = $('.pagination li.active:first').text();
var baseUrl = document.URL.replace(/&start=\d*/, '');

function cleanPosts() {
    $('#page-body').siblings().remove();
    $('.post:first').prevAll().remove();
    $('.post:last').nextAll().remove();
    $('ul.profile-icons, dl.postprofile, div.back2top, div.bg3, .signature ,.post:not(.post[id^="p"])').remove();
    $('.postbody').width('100%');
    $('.post-buttons').remove();
    $('.responsive-hide').removeClass('responsive-hide');
    $(".postbody h3:contains('Re:')").remove();
}

function loadPage(page) {
    if (page < lastPage) {
        $('#loading-page').text(page);
        loadNextPage(page);
    } else {
        cleanPosts();
    }
}

function loadNextPage(page) {
    $.ajax({
        url: baseUrl + '&start=' + (page++ * 25),
        success: function(data) {
            $('.post:last').after($('<h3>').addClass('page-number').text('זייט ' + page).css({
                'text-align': 'center',
                'font-size': '14px'
            }));
            $('.page-number:last').after($('.post', data));
            loadPage(page);
        }
    });
}
lastPage = Math.max(on_page, Math.min(lastPage, prompt('You are on page ' + on_page + ' of ' + lastPage + ' pages.\r\nTill which page do you want to print?', lastPage)));
$('#page-body').before($('<h3>').css({
    'text-align': 'center',
    'font-size': '14px'
}).text('loading page ').append('<span id="loading-page">'));
loadPage(on_page);

Free to use, share and change (MIT license).