Vous n'êtes pas identifié.

Annonces

Les pages de ce Forum sont exploitables par les Navigateurs Mozilla, Fire Fox, Opera, Safari, Konqueror, Netscape, MSIE.
  • Index
  •  » Le Java
  •  » Afficher des thumbnails (vignettes) en Pop-Up

#1 [↑] [↓]09/12/2009 11:02:30

Crazy
Super Admin azimuté
Crazy
Lieu: Côte d'Azur - FRANCE
Date d'inscription: 10/04/2006
Messages: 5462
Site web

Afficher des thumbnails (vignettes) en Pop-Up

Voici un Code bien Zarbi (et non auto-documenté)...
Pour afficher des ascreens de sites au survol de leurs URL.
Débrouillez-vous avec (adaptation, traduction).

Code :

<script type = "text/javascript">
<!--
var color = "808080"; // Gris ou toute autre couleur selon convenance
var IE = document.all ? true : false; 

if (!IE) {document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove = getMouseXY; 
var mousex = 0; var mousey = 0; var sdd = 0; var sddn = 0; var stl = 0; var llink = 0; var thumb_scrollleft = 0; var thumb_scrolltop = 0; 

document.write('<div id = "thumbnaildiv" style = "position: absolute; visibility: hidden; z-index: 9999; top: 0; left: 0;"></div>');

window.onload = function()
{
	var x = document.getElementsByTagName('a'); 
	for (var i = 0; i<x.length; i++)
	{
		x[i].onmouseover = function()
		{
			if (!sdd && !document.cookie.match("thumb_disable")) {show_dd(this.getAttribute("href")); sdd = 1;}
		}
		x[i].onmousemove = function()
		{
			if (!sdd && !document.cookie.match("thumb_disable")) {sdd = 1; show_dd(this.getAttribute("href"));}
		}
		x[i].onmouseout = function() 
		{
			sdd = 0; setTimeout("hide_dd();",500); 
		}
	}
}

function getMouseXY(e) 
{
	if (document.documentElement.scrollLeft) {thumb_scrollleft = document.documentElement.scrollLeft;} 
	else {thumb_scrollleft = document.body.scrollLeft;}
	
	if (document.documentElement.scrollTop) {thumb_scrolltop = document.documentElement.scrollTop;}
	else {thumb_scrolltop = document.body.scrollTop;}
	
	if (IE) {mousex = event.clientX+thumb_scrollleft; mousey = event.clientY + thumb_scrolltop;}
	else {mousex = e.pageX; mousey = e.pageY;}
	
	if (mousex<0) {mousex = 0;}
	
	if (mousey<0) {mousey = 0;}
}

function show_dd(link)
{
	var chkext = link.substr(0,4); 
	ddomain = document.location.href; ddomain = ddomain.replace("http://",""); ddomain = ddomain.replace("https://",""); ddomain = ddomain.replace("www.",""); 
	var ddomain = ddomain.split('/'); var ddomain = ddomain[0]; 
	ldomain = link; ldomain = ldomain.replace("http://",""); ldomain = ldomain.replace("https: //",""); 
	var ldomain = ldomain.split('/'); var ldomain = ldomain[0]; ldomainc = ldomain.replace("www.",""); 
	if (ldomainc && ddomain && chkext = = "http" && !ldomainc.match(ddomain))
	{
		chg = 1; 
		if (llink! = = ddomain)
		{
			document.getElementById('thumbnaildiv').innerHTML = "<table width = \"150\" style = \"border-collapse: collapse; border: 1px solid #"+color+"; \" bgcolor = \"#ffffff\" border = \"0\" cellpadding = \"0\" cellspacing = \"0\" onmouseover = \"sddn = 1; \" onmouseout = \"sddn = 0; setTimeout('hide_dd(); ',500); \"><tr><td style = \"padding: 1px 1px 1px 1px; \" bgcolor = \"#"+color+"\"><table cellpadding = \"0\" cellspacing = \"0\" style = \"border-collapse: collapse; \" width = \"100%\"><tr><td height = \"18\" style = \"padding: 1px 1px 1px 1px; \"><font style = \"font-size: 7pt; font-family: verdana,tahoma,arial; color: #ffffff; font-weight: bold; \">&nbsp;Preview</font></td><td style = \"padding: 1px 1px 1px 1px; \" align = \"right\"><font style = \"font-size: 7pt; color: #ffffff; font-weight: bold; font-family: verdana,tahoma,arial; \"><a href = \"#\" style = \"font-size: 7pt; text-decoration: underline; color: #ffffff; font-family: verdana,tahoma,arial; \" onclick = \"thumb_ds(); return false; \">close</a>&nbsp;</font></td></tr></table></td></tr><tr><td style = \"padding: 1px 1px 1px 1px; \"><table width = \"100%\" cellpadding = \"0\" cellspacing = \"0\" style = \"border-collapse: collapse; \"><tr><td align = \"center\" colspan = \"2\" height = \"95\" bgcolor = \"#F5F5F5\" style = \"padding: 1px 1px 1px 1px; background-repeat: no-repeat; background-position: center\" valign = \"middle\"><a href = \""+link+"\" target = \"_target\"><img border = \"0\" style = \"border: solid #ffffff 1px\" onmouseover = \"this.style.borderColor = '#"+color+"'\" onmouseout = \"this.style.borderColor = '#ffffff'\" alt = \"\" src = \"http://open.thumbshots.org/image.aspx?url = "+encodeURIComponent(ldomain)+"\"></a></td></tr><tr><td align = \"center\" style = \"padding: 1px 1px 1px 1px; \"><div style = \"width: 135; overflow: hidden; \"><a href = \""+link+"\" target = \"_target\" onmouseover = \"this.style.textDecoration = 'underline'\" onmouseout = \"this.style.textDecoration = 'none'\" style = \"font-weight: bold; text-decoration: none; font-family: verdana,tahoma,arial; font-size: 8pt; color: #"+color+"; \">"+ldomainc+"</a></div></td><td style = \"padding: 1px 1px 1px 1px; \" align = \"center\"></td></tr></table></td></tr></table>"; llink = ldomain;
		}
		if (chg && !stl) {setTimeout("show_ddt();",700);}
		else
		{
			if (window.innerWidth) {var cwidth = window.innerWidth;}
			else if (document.documentElement.clientWidth) {var cwidth = document.documentElement.clientWidth;}
			else if (document.body.clientWidth) {var cwidth = document.body.clientWidth;}
			
			if (window.innerHeight) {var cheight = window.innerHeight;}
			else if (document.documentElement.clientHeight) {var cheight = document.documentElement.clientHeight;}
			else if (document.body.clientHeight) {var cheight = document.body.clientHeight;}
			
			if ((mousex+175)>cwidth) {mousex = mousex-150;}
			else {mousex = mousex+5;}
			
			if ((mousey+150)>cheight+thumb_scrolltop) {mousey = mousey-140;}
			else {mousey = mousey+5;}
			
			document.getElementById('thumbnaildiv').style.left = mousex+'px'; document.getElementById('thumbnaildiv').style.top = mousey+'px'; 
		}
	}
}

function hide_dd()
{
	if (!sdd && !sddn)
	{
		document.getElementById('thumbnaildiv').innerHTML = ""; 
		document.getElementById('thumbnaildiv').style.visibility = "hidden"; sdd = 0; stl = 0; 
	}
}

function show_ddt()
{
	document.getElementById('thumbnaildiv').style.visibility = 'visible'; stl = 1; 
	if (window.innerWidth) {var cwidth = window.innerWidth;}
	else if (document.documentElement.clientWidth) {var cwidth = document.documentElement.clientWidth;}
	else if (document.body.clientWidth) {var cwidth = document.body.clientWidth;}
	if (window.innerHeight) {var cheight = window.innerHeight;}
	else if (document.documentElement.clientHeight) {var cheight = document.documentElement.clientHeight;}
	else if (document.body.clientHeight) {var cheight = document.body.clientHeight;}
	if ((mousex+175)>cwidth) {mousex = mousex-150;}
	else {mousex = mousex+5;}
	if ((mousey+150)>cheight+thumb_scrolltop) {mousey = mousey-140;}
	else {mousey = mousey+5;}
	document.getElementById('thumbnaildiv').style.left = mousex+'px'; document.getElementById('thumbnaildiv').style.top = mousey+'px'; 
}

function thumb_ds()
{
	if (confirm("Do you really want to deactivate thumbnail pop-ups?")) {document.cookie = "thumb_disable = 1";}
}
// -->
</script>

Il faut le mettre entre les balises HTML <head> et </head> (à la fin).
Normalement, il se suffit à lui-même... whistling ...
ph34r
AHOHNM


Je suis Bon (avec un grand C) et Immortel... Jusqu'à preuve du contraire !
http://crazy.cigiema.fr/chocoku/ - http://crazy.cigiema.fr/sorcier_glouton/ - http://crazy.cigiema.fr/tiger-osmose/
http://crazy.cigiema.fr/msnbetter_thangoogle/ - http://crazy.cigiema.fr/black-hattitude/

I remember and I feel free! - I am the Killer of the Lambs!

Hors ligne

 

#2 [↑] [↓]09/12/2009 18:09:27

Crazy
Super Admin azimuté
Crazy
Lieu: Côte d'Azur - FRANCE
Date d'inscription: 10/04/2006
Messages: 5462
Site web

Re: Afficher des thumbnails (vignettes) en Pop-Up

Sauf que...
Vu que l'on utilise un site tiers qui requiert un BL...
Il convient d'ajouter celui-ci sur toutes les pages qui vont utiliser ce JavaScript !

Voici le code du lien (le mettre en footer - mettre le JS précédent en header) :

Code :

<a href="http://www.thumbshots.com" target="_blank" title="This site uses Thumbshots previews">This site uses Thumbshots previews</a>

thumbshots.org et thumbshots.com, c'est pareil... whistling ...
wink
Alain AKA Arma


Je suis Bon (avec un grand C) et Immortel... Jusqu'à preuve du contraire !
http://crazy.cigiema.fr/chocoku/ - http://crazy.cigiema.fr/sorcier_glouton/ - http://crazy.cigiema.fr/tiger-osmose/
http://crazy.cigiema.fr/msnbetter_thangoogle/ - http://crazy.cigiema.fr/black-hattitude/

I remember and I feel free! - I am the Killer of the Lambs!

Hors ligne

 
  • Index
  •  » Le Java
  •  » Afficher des thumbnails (vignettes) en Pop-Up

Pied de page des forums

Powered by PunBB modified
© Copyright 2002–2005, Rickard Andersson
© Interface & Functional Add-ons Copyright 2006-2007, by Crazy


RSS Forum CIGIEMA

© 2006-2010 / A. G.
CiGi€M@®, 1997-2010
IDDN Reproduction totale ou partielle strictement interdite
Contact :
/