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 18:49

>>11
Either Opera is either a steaming pile of shit more so than I thought or you are wrong. Setting a width attribute on an image per spec should let the height freely change to match the aspect ratio. The problem here is obviously that a very tall image will just make the table look like crap. The ideal solution, setting a maximum dimension and then either the width or height to that maximum dimension while preserving aspect ratio such as to maximize the size of the image, is easily doable also. Because you are a faggot however; I'll leave you to your own devices.

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