Skip to content

Instantly share code, notes, and snippets.

@knowlet
Created January 3, 2016 15:37
Show Gist options
  • Save knowlet/88c44eb8582a9472f9d8 to your computer and use it in GitHub Desktop.
Save knowlet/88c44eb8582a9472f9d8 to your computer and use it in GitHub Desktop.
Automatic load comic pictures.
var table = document.querySelector("table");
var source = document.querySelector("td[align] img").src.slice(0, -7);
var pages = Number(location.pathname.slice(-11, -8));
for (var i = 2; i <= pages; ++i) {
var row = table.insertRow(i+3);
row.align="center";
var cell = row.insertCell(0);
var page = ("000"+i).substr(-3);
cell.innerHTML = '<img src="' + source + page + '.jpg" border="0" onload="if(this.width>screen.width) {this.resized=true; this.width=screen.width*0.96;}">';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment