altri SmileANCORA ANCORA SMILE!!E ringraziate donia x queste!!
Nuova Discussione
Rispondi
Cerca nel forum
 
Pagina precedente | 1 | Pagina successiva
Vota | Stampa | Notifica email    
Autore

Kentaromiura CrazyCorner 0.1 alpha(Gatsu)

Ultimo Aggiornamento: 04/04/2006 08:32
OFFLINE
Post: 508
Post: 334
Registrato il: 26/06/2003
Città: ALTIVOLE
Sesso: Maschile
Occupazione: Studente
Utente Senior
file crazycorner.js
/*


released under Creative commons license ;)

http://creativecommons.org/licenses/by-nc-nd/2.0/

Test succesfully with:

Netscape 7.2, 
Ie 6.0sp2,(it should work with 5 too)	
FF1.5,	(it should work on 1.0 too)
opera 8.51

Kentaromiura Crazy Corner Version 0.1 alpha preview (codename:Gatsu)
|-->from an idea of www.mswebpeople.com/krazy.html
|--------->from snazzy corner idea http://www.cssplay.co.uk/boxes/snazzy.html by Stu Nicholls
|---------------->from nifty corner idea	http://pro.html.it/articoli/id_598/idcat_31/pro.html (grazie Alessandro Fulciniti;)
EDIT:
as Alessandro Fulciniti told me the original idea of Krazy Corners is of Stu Nicholls.(http://www.cssplay.co.uk/boxes/krazy.html)
TODO:
better support for bordercolors 
a decornerize functi0n(it must search for boxcontent trashing all the rest ;) )
better support for divs width 
*/

var d=document;

function ele(obj) {
	return d.createElement(obj);
}

function app(pNode,cNode) {
	pNode.appendChild(cNode);	
	return pNode;
}

function text(str) {
	return d.createTextNode(str);
}

function set(obj,attr,val) {
	obj.setAttribute(attr,val);
	return obj
}

function cornerize(id,type,col){
	if(type===undefined)
		raised(id,"raised",col);
	else
	switch(type){
		case "raised":raised(id,type,col);break;		
		case "inset":raised(id,type,col);break;
		
		case "square":square(id,col);break;
		
		case "curved":curved(id,type,col);break;
		case "serif":curved(id,type,col);break;
		case "pillar":curved(id,type,col);break;
		
		case "chamfer":chamfer(id,type,col);break;
		case "barrel":chamfer(id,type,col);break;
	}	
}

function curved(id,type,col){	
	
	var cn="class";
/*@cc_on
cn="className";
@*/	
	var box=set(d.getElementById(id),cn,"boxcontent");
	var ext=set(ele("div"),cn,type);
	if(!(col===undefined))
		box.style.backgroundColor=col;
		
	var top=set(ele("span"),cn,"top");
	var t;
	for(var i=1;i<5;i++){
		app(top,t=set(ele("span"),cn,"b"+i));	
		if(!(col===undefined)&&i!=1)
			t.style.backgroundColor=col;			
	}
	
	
	app(ext,top);
	
	box.parentNode.insertBefore(ext,box);	
	
	app(ext,box);//TRANSFER because it is already into the DOM
	
	var down=set(ele("span"),cn,"bottom");
	
	for(var i=4;i>0;i--){
		app(down,t=set(ele("span"),cn,"b"+i));
		if(!(col===undefined)&&i!=1)
			t.style.backgroundColor=col;
	}	
	app(ext,down);	
}

function square(id,col){
	
	var cn="class";
/*@cc_on
cn="className";
@*/
	var box=set(d.getElementById(id),cn,"boxcontent");
	var ext=set(ele("div"),cn,"square");
	
	if(!(col===undefined))
		box.style.backgroundColor=col;
			
	var top=set(ele("span"),cn,"top");	
	var t;
	app(top,t=set(ele("span"),cn,"b1t"));	
	if(!(col===undefined))
		t.style.backgroundColor=col;
	app(top,t=set(ele("span"),cn,"b2"));
	if(!(col===undefined))
		t.style.backgroundColor=col;
	app(ext,top);
	
	box.parentNode.insertBefore(ext,box);

	
	app(ext,box);
	
	var down=set(ele("span"),cn,"bottom");
	app(down,t=set(ele("span"),cn,"b2"));	
	if(!(col===undefined))
		t.style.backgroundColor=col;
	app(down,t=set(ele("span"),cn,"b1b"));	
	if(!(col===undefined))
		t.style.backgroundColor=col;
	app(ext,down);
}	

function chamfer(id,type,col){	
	var cn="class";
/*@cc_on
cn="className";
@*/	
	var box=set(d.getElementById(id),cn,"boxcontent");
	var ext=set(ele("div"),cn,type);
		
	if(!(col===undefined))
		box.style.backgroundColor=col;		
			
	var top=set(ele("span"),cn,"top");
	for(var i=1;i<6;i++){
		app(top,t=set(ele("span"),cn,"b"+i));
		if(!(col===undefined)&&i!=1)
			t.style.backgroundColor=col;			
	}		
	app(ext,top);
	
	box.parentNode.insertBefore(ext,box);	
		
	app(ext,box);
		
	var down=set(ele("span"),cn,"bottom");
	for(var i=5;i>0;i--){
		app(down,t=set(ele("span"),cn,"b"+i));	
		if(!(col===undefined)&&i!=1)
			t.style.backgroundColor=col;	
	}
	app(ext,down);
}

function raised(id,type,col){

	var cn="class";
/*@cc_on
cn="className";
@*/
	var box=set(d.getElementById(id),cn,"boxcontent");
	var ext=set(ele("div"),cn,type);	
	if(!(col===undefined))
		box.style.backgroundColor=col;	
		
	var top=set(ele("span"),cn,"top");	
	
	for(var i=1;i<5;i++){
		var t=set(ele("span"),cn,"b"+i);
		if(!(col===undefined) && i!=1)
			t.style.backgroundColor=col;
		app(top,t);	
	}
	app(ext,top);
	box.parentNode.insertBefore(ext,box);	
	
	app(ext,box);	
	
	var down=set(ele("span"),cn,"bottom");
	for(var i=4;i>0;i--){
		var t=set(ele("span"),cn,"b"+i+"b");
		if(!(col===undefined) && i!=1)
			t.style.backgroundColor=col;
		app(down,t);	
	}	
	app(ext,down);	
}

[Modificato da kentaromiura 04/04/2006 8.32]


____________________________
_____________
Kentaromiura
03/04/2006 12:31
 
Email
 
Scheda Utente
 
Modifica
 
Cancella
 
Quota
Amministra Discussione: | Chiudi | Sposta | Cancella | Modifica | Notifica email Pagina precedente | 1 | Pagina successiva
Nuova Discussione
Rispondi

Feed | Forum | Bacheca | Album | Utenti | Cerca | Login | Registrati | Amministra
Crea forum gratis, gestisci la tua comunità! Iscriviti a FreeForumZone
FreeForumZone [v.6.1] - Leggendo la pagina si accettano regolamento e privacy
Tutti gli orari sono GMT+01:00. Adesso sono le 15:19. Versione: Stampabile | Mobile
Copyright © 2000-2024 FFZ srl - www.freeforumzone.com