Last active
January 24, 2017 05:48
-
-
Save tungnk1993/47190ede23284e25b0be3aed1fd400bb to your computer and use it in GitHub Desktop.
Extract a print-ready news article from NHK News Easy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open article with chrome, press f12, paste this code into console | |
$(function() { | |
var A4_HEIGHT = 975; | |
var save = $('#mainTop').detach(); | |
$('body').empty().append(save); | |
$('.pagemove').remove(); | |
$('#regularnews').remove(); | |
$('#soundkana').remove(); | |
$('body').css('background-image', 'none'); | |
$('body').css('background-color', '#FFF'); | |
//console.log("done!"); | |
var bodyHeight = $('#mainTop').height(); | |
if (bodyHeight > A4_HEIGHT) $('#mainimg').remove(); | |
// Duplicate content for no-kana version printing on reverse side | |
bodyHeight = $('#mainTop').height(); | |
var marginBottom = A4_HEIGHT - bodyHeight; | |
$('#mainTop').css('margin-bottom', marginBottom); | |
var z = $('#mainTop').clone(); | |
$('body').append(z); | |
console.log('done'); | |
var kana = $('rt'); | |
var n = kana.size(); | |
for (idx = n / 2; idx < n; idx++) kana[idx].remove(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment