Sign up | Lost password? | Help

[ advanced search ]

Thumbnail when hovering imagelinks

Forums » Opera Community » General Opera topics » User JavaScript

Tuesday, 30. September 2008, 12:48:59

Kani

avatar

Posts: 63

Finland

Thumbnail when hovering imagelinks

Maybe theres something similiar out there (always seem to be when I make a userjs).

But here it is anyway. When you hover a image link youll see a thumbnail in bottom left corner.
It's not bug-tested at all so please say if you find any bugs.

http://sima.ax.loopiadns.com/Other/imgthumb.js

Might have to restart opera after putting it in userJS folder.

Tuesday, 30. September 2008, 18:02:00 (edited)

Thank You! :smile:
EDIT:
Large images + "Fit to Width" :worried:
widewidewidewide.png

Friday, 3. October 2008, 07:18:21

Kani

avatar

Posts: 63

Finland

Updated the link in main post to version 1.1, fixed the fit-to-width bug and added a very handy feature:
Like before, a thumbnail is shown when you hover an image link. But now you can show the image in it's original size by pressing and holding down ctrl while the thumbnail is shown.

Friday, 3. October 2008, 07:31:49

airiRin

幸せになりたい

avatar

Posts:

Indonesia

Thanks..

It's very useful

Monday, 6. October 2008, 05:50:45

HyperBrain

avatar

Posts: 18

Many thanks man, very useful. :D . Without any problem

Monday, 6. October 2008, 05:52:34

Kani

avatar

Posts: 63

Finland

Nice to see you like it :D

Monday, 6. October 2008, 12:26:19

matejakezman

Che Guevara

avatar

Posts: 218

Croatia

this is great thing. one of the best i have ever used.

Tuesday, 7. October 2008, 14:33:16

offcu

offchu

avatar

Posts: 529

Turkey

Thanks but "Download All with oGet" script does not work with imgthumb.js. Is there any solution?

"Download All with oGet"
[Document Popup Menu]
.
.
.
Platform Windows, Item, "Download All with oGet"="Go to Page, "javascript:(function(){var encodeBase64=function(a){var b='';var c=0;var i=0;var d='';var e=a.length;var f=[];var g='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';while(c=a.charCodeAt(i++)){if(c<0x80){f[f.length]=c}else if(c<0x800){f[f.length]=0xc0|(c>>6);f[f.length]=0x80|(c&0x3f)}else if(c<0x10000){f[f.length]=0xe0|(c>>12);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}else{f[f.length]=0xf0|(c>>18);f[f.length]=0x80|((c>>12)&0x3f);f[f.length]=0x80|((c>>6)&0x3f);f[f.length]=0x80|(c&0x3f)}if(i==e){while(f.length%%3){f[f.length]=0;d+='='}}if(f.length>2){b+=g[f[0]>>2];b+=g[((f.shift()&3)<<4)|(f[0]>>4)];b+=g[((f.shift()&0xf)<<2)|(f[0]>>6)];b+=g[f.shift()&0x3f]}}return(b+d)};var topLevelDN=function(domain){if(!domain)return;if(/^(?:\d{1,3}\.){3}\d{1,3}$/.test(domain))return domain;var a=domain.split('.');var l=a.length;return(l<3)?domain:(a[l-2]+'.'+a[l-1])};var links='';var n=0;var rn='\r\n';var downloadAll=function(w){if(w)with(w)try{var l=document.links;var h=topLevelDN(location.hostname);var c=document.cookie;for(var i=0,li;li=l[i];i++){if(li.protocol!='javascript:'&&li.protocol!='mailto:'){links+=li.href+rn+li.innerText.replace(/\s/g,' ').replace(/^\s+|\s+$/,'')+rn+((c&&h==topLevelDN(li.hostname))?c+'; ':'')+rn+rn;n++}};for(var j=0,f;f=frames[j];j++){downloadAll(f)}}catch(e){}};downloadAll(window.top);location.href='data:text/ogt;charset=UTF-8;base64,'+encodeBase64(n+';My_Download_Manager;2;;'+rn+location.href+rn+links)})()",,,"Save" "


Tuesday, 7. October 2008, 15:19:26

Kani

avatar

Posts: 63

Finland

Do you mean you can't download the file or that running the imgthumb userJS breaks oGet?

Tuesday, 7. October 2008, 18:31:34

offcu

offchu

avatar

Posts: 529

Turkey

I meant imgthumb userJS breaks "Download All ..." menu function of oGet.

Wednesday, 8. October 2008, 05:37:11

Kani

avatar

Posts: 63

Finland

That's very weird, it don't change the links in any way so it shouldn't break cause of that. Are you using extra-download-links.js as well?

Wednesday, 8. October 2008, 21:14:54 (edited)

offcu

offchu

avatar

Posts: 529

Turkey

Yes, I'm using it.

Friday, 10. October 2008, 09:15:49

Kani

avatar

Posts: 63

Finland

Okay, I'll look into it when I have time, very busy with work and some other stuff atm.

Wednesday, 15. October 2008, 05:59:20

ZAHEK

z@h3k

avatar

Posts: 3755

Turkey

This is really nice.Thanks Kani.

Wednesday, 15. October 2008, 11:16:08

Kani
Good idea, but worst code which I saw. I think it contains most possible errors.

offcu

but "Download All with oGet" script does not work with imgthumb.js.


Replace
links = document.getElementsByTagName("a");
in imgthumb.js
on «var links = document.getElementsByTagName("a");»

Wednesday, 15. October 2008, 11:52:51

Kani
http://dev.opera.com/articles/view/efficient-javascript/

Error №1 Avoid a global variables and functions. Use anonymous function.
Error №2 Don't use .onsomething. It may break exists handlers on pages.
Error №3 Not forget about «var» in functions.
Error №4 Cache DOM values in script variables. Five «document.getElementById('thumbBoxDiv')» - bad idea.

And it contains many useless code
function onReady()
{
createBox();

var links = document.getElementsByTagName("a");

for(var i = 0; i <= links.length; i++)
{
if(links[i] != 'undefined' && links[i] != 'null' && links[i] != null)
{
if(links[i].href.toLowerCase().match("jpg$") || links[i].href.toLowerCase().match("png$") || links[i].href.toLowerCase().match("gif$"))
{
links[i].onmouseover = "showThumb('" + links[i].href + "');";
links[i].onmouseout = hideThumb;
}
}
}
}

it can be written twice shorter:
function onReady()
{
createBox();

var links = document.getElementsByTagName('a');
for(var i=0, li; li=links[i]; i++)
{
if(li.href && li.href.match(/\.(jpe?g|bmp|gif|png)$/i))
{
li.onmouseover = "showThumb('" + li.href + "');";
li.onmouseout = hideThumb;
}
}
}

Wednesday, 15. October 2008, 19:23:09

Kani

avatar

Posts: 63

Finland

Thanks for the input lex1, javascript really isn't my strongest side. Too much stuff that don't really make sense to me in it.
ATM I have too much stuff going on to work on this, but if anyone wanna rewrite/change it feel free to do so.

Tuesday, 10. March 2009, 10:51:02

Sn3ipen

Joey

avatar

Posts: 51

Norway

Thanks. This works great:)

It gave me a new idea for a js. It would be useful to have something like this for Google Image Search and facebook. When I hover an image thumbnail that link to the full size image, i will see the image the same way as this js display it, only in full size.

Just imagine to search for a image and you can just hover it to display the full size image. The same goes foe facebook, when i am looking for my friends and their updates.

Friday, 13. March 2009, 14:40:54

purgossu

proud Opera (power)user

avatar

Posts: 405

Spain

Downloading for trying. Thanks! :up:

Tuesday, 30. June 2009, 08:41:43

This is a awesome JS :smile: Thanks for making it Jonas!

Saturday, 15. August 2009, 11:58:05

alekksander

avatar

Posts: 81

useful. thanks alot.

Monday, 17. August 2009, 04:04:47

Mastermind1

Like my blood, a Positive(+) AB-Person.

avatar

Posts: 173

Argentina

You should check that when using this script your acid3 test results will drop to 97/100, at least it happened to me using it with Blockit, Linkalert and Snap-Links, BUT removing any/all of those other JS didn't make a difference on the result so it is a problem with imgthumb.js

Monday, 17. August 2009, 12:58:10

Kani

avatar

Posts: 63

Finland

Hey, just came back and saw all the positive support here :smile: I have a lot more javascript experience now so I might rewrite this and make it work better along with other scripts.

If you have any requests for additional functionality just tell me :D

Monday, 17. August 2009, 17:10:31

ThMartin

Strange things happen...

avatar

Posts: 29

Argentina

Very usefull, thanks.

Monday, 7. September 2009, 22:21:55

frem82

avatar

Posts: 239

Italy

Thanks! it's very useful.:D

Originally posted by Kani:

If you have any requests for additional functionality just tell me


is it possible to adjust the size of the image? i'd be fantastic if when i put the mouse on the thumb i can resize it.

Sunday, 20. September 2009, 19:13:30

zikzakatak

avatar

Posts: 290

will be awsome if we can use this script with extra download links script... that way we will be able to have a preview of the image in link panel.

Saturday, 26. September 2009, 10:51:47

SilentRain5

avatar

Posts: 4

I found errors:

Error 01
Error 02

On these screenshots all normal:

Normal 01
Normal 02

Wednesday, 25. November 2009, 03:56:16

kentdm

avatar

Posts: 2

I am too ignorant to properly download this. Went to preferences, put in folder title as suggested, right-clicked on the link,saved it (went to My Pictures) and nothing happens. I imagine I did about 6 things wrong. Can you make it even simpler than you already did?
Thanks.

Wednesday, 25. November 2009, 06:54:29 (edited)

Zotlan

ExtendOpera admin

avatar

Posts: 2128

Netherlands

If you have Opera 10.1 you can install this Unite application, it can install scripts for you.

@Kani, it's a wonderful script but is there anything that can be done to makeit compatible with Arve's autosizer script?

Forums » Opera Community » General Opera topics » User JavaScript