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,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"');}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:
Anonymous2009-03-07 10:58
did not see ur post
Name:
Anonymous2009-03-07 12:12
>>1
Hi, I cannot read your post, the Gestapo has blotted out critical parts of the text.
Name:
Anonymous2009-03-07 12:33
Hello [PROG MEME HERE]
[COPY PASTED CODE HERE]
Make it do this for me:
[LIST OF THINGS HERE]
[PROG MEME HERE]
Name:
Anonymous2009-03-07 12:35
Your homework is actually feasible and easy
Name:
Anonymous2009-03-07 21:08
Like this?
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,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"');}var q,m='',h,i,b,l=0,z=open().document,a=Math.floor(window.innerWidth/250);z.write('<head></head><p>Images linked to by '+hE(location.href)+':</p><hr><table border="1"><tr>');for(q in document.links){h=document.links[q].href;if(h&&I(h)) {b = hE(h);if(m.indexOf('&'+b+'&')>=0) continue;m += '&'+b+'&';z.write('<td width="250px" height="250px"><img width="250px" src="'+b+'"><br/> ('+b.link(b)+')</td>');l=(l+1)%a;if(l==0)z.write("</tr><tr>");}}z.close();})()
Name:
Anonymous2009-03-07 21:09
>>6 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,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"');}var q,m='',h,i,b,l=0,z=open().document,a=Math.floor(window.innerWidth/250);z.write('<head></head><p>Images linked to by '+hE(location.href)+':</p><hr><table border="1"><tr>');for(q in document.links){h=document.links[q].href;if(h&&I(h)) {b = hE(h);if(m.indexOf('&'+b+'&')>=0) continue;m += '&'+b+'&';z.write('<td width="250px" height="250px"><img width="250px" src="'+b+'"><br/> ('+b.link(b)+')</td>');l=(l+1)%a;if(l==0)z.write("</tr><tr>");}}z.close();})()
>>6,7
This implementation is flawed as it sets the image width, it doesn't clap it. If it was that easy iy wouldn't be IMPOSSIBLE. Hint: there needs to be some post-processing after the image has been loaded and its original dimensions are know.
>>8
Please provide a browser with alternate language support. I don't think anybody enjoys JS.
>>10
If this was homework, it'd suggest there are bigger problems than getting it done.
>>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.
>>13
Why are you even asking anyway? I would help you if you genuinely needed it but you seem more than capable of this, particularly considering how far you got and how well you understand what you want to do.