Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ENTERPRISE JAVACRIPT TURNKEY IMAGE FETCHING

Name: SUBJECT IS TOO FUCKING LONG 2009-03-07 10:56

Hello EXPERT JAVASCRIPT PROGRAMMERS.

Have you ever heard of these things called bookmarklets? These browser-portable pieces of code perform an action over a webpage when invoked from (typically) a bookmark, such as, for example, creating a new document containing all linked images:

javascript:(function(){function I(u){var t=u.split('.'),e=t[t.length-1].toLowerCase();return {gif:1,jpg:1,jpeg:1,png:1,mng:1}[e]}function hE(s){return s.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;').replace(/"/g,'&quot;');}var q,h,i,z=open().document;z.write('<p>Images linked to by '+hE(location.href)+':</p><hr>');for(i=0;q=document.links[i];++i){h=q.href;if(h&&I(h))z.write('<p>'+q.innerHTML+' ('+hE(h)+')<br><img src="'+hE(h)+'">');}z.close();})()

Your task is to modify this naïve example to add the following features:

1. Remove duplicate entries.
2. Clamp width to a certain value, preserving aspect ratio.
3. Pad height vertically (with additional HTML elements) so that an integer number of images is displayed for every block of n pixels, for some n.

The first should be EASY AS FUCK, the second and third ones might be IMPOSSIBLE.

Name: Anonymous 2009-03-08 19:23

>>12
You still don't understand the request. I don't know why I bother, but let's try some examples, for a maximum width of 1000:

50x50 -> 50x50
999x5000 -> 999x5000
4000x1000 -> 1000x250
2000x8000 -> 1000x4000

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List