var msg="MESSAGE";
var index=0;
var delay=200
function defil() {
var nb_char=msg.length;
index++;
if (index>nb_char) index=0;
window.status=msg.substring(index)+msg;
setTimeout("defil()",delay);
}
function defiler(txt,tps) {
msg=txt + " - " + txt + " - " ;
delay=tps;
defil();
}
function cacheouaffichemoi(i){
var etat='cache';
if (FindID(i).className == 'cache')etat='visible'
FindID(i).className = etat;
}
function play() {return true;}
function FindID(id) {
var id;
if(document.layers) return document.layers[id];
if(document.all && !document.getElementById) return document.all[id];
if(document.all && document.getElementById) return document.getElementById(id);
if(!document.all && document.getElementById) return document.getElementById(id);
}
function affiche_avatar(id){
FindID('avatar').src=id;
FindID('avatar').style.display='';
}
function addsmiley(smiley,formname){
if(document.forms[formname].elements['message'])var id=document.forms[formname].elements['message'];
else if(document.forms[formname].elements['contenu'])var id=document.forms[formname].elements['contenu'];
if(id.value=='Message'){
id.value='';
}
id.value=id.value + smiley;
}
function fuckzeframe(){
if (top.location != self.document.location){
top.location = self.document.location;
}
}
fuckzeframe();
function addximg(labig,lasmall,id){
setTimeout("affiche_etat('image insérée');",1000);
FindID(id).value+='[img]'+labig+','+lasmall+'[/img]';
cacheouaffichemoi('iframe_upload');
setTimeout("affiche_etat(' ');",2000);
setTimeout("affiche_etat('image insérée');",3000);
setTimeout("affiche_etat(' ');",4000);
setTimeout("affiche_etat('image insérée');",5000);
setTimeout("affiche_etat('');",6000);
}
function affiche_etat(msg){
FindID('etat').innerHTML=msg;
}
function form_comment(i){
var etat1='cache';
if (FindID('data_'+i).className == 'cache')etat1='visible';
FindID('data_'+i).className = etat1;
var etat2='aff_comment';
if (FindID(i).className == 'aff_comment')etat2='cache_comment'
FindID(i).className = etat2;
}
var TAtextbox = "article_text";
var TAtitlebox = "article_title";
var TAactualcolor = "ActualColor";
var TAusedcolor = "UsedColor";
var TApicpath = "v2/images/pix.gif";
var TAimgalignbox = "image_align"
var TAurlimgarticle = "";
var TAnewarticle = 1;
var admBloger = true;
if (TAnewarticle == 1)
editor_no_change=1;
function initStuff()
{
drawPalette(true);
drawPalette(false);
}
function drawPalette(fg)
{
var clr = new Array('00', '11', '55', '66', '77', '88', '94', 'A3', 'BB', 'CE', 'DA', 'EE', 'FF');
var min = 0;
var max = clr.length - 1;
var images = new Array();
var d;
/* admBloger */
if (typeof admBloger != 'undefined')
{
function lightCase(e)
{
var c;
recupcolor(this, !isFg(this));
dst = document.getElementById(TAusedcolor + (isFg(this) ? '' : 'BG'));
dst.style.backgroundColor = this.style.backgroundColor;
if (!e)
window.event.returnValue = false;
else if (e.preventDefault() != undefined)
e.preventDefault();
}
function lightCase2(e)
{
var c;
dst = document.getElementById(TAactualcolor + (isFg(this) ? '' : 'BG'));
dst.style.backgroundColor = this.style.backgroundColor;
if (!e)
window.event.returnValue = false;
else if (e.preventDefault() != undefined)
e.preventDefault();
}
function isFg(elm)
{
elm = elm.parentNode;
if (elm.id.indexOf('palettefg') == -1)
return false;
return true;
}
function getCellTitle(hex)
{
if (!fg)
return 'Mettre le fond du texte en couleur. Syntaxe : [f=' + hex + ']Ton texte coloré[/f]';
return 'Mettre le texte en couleur. Syntaxe : [c=' + hex + ']Ton texte coloré[/c]';
}
}
else
{
function chooseCell()
{
setcolors(this.style.backgroundColor);
return false;
}
}
function addCell(r, g, b)
{
var a;
var hex = '#' + r + g + b;
a = document.createElement('a');
a.style.backgroundColor = hex
a.className = 'btcolordyn';
a.href = '#';
if (typeof admBloger != 'undefined')
{
a.title = getCellTitle(hex);
a.onclick = lightCase;
a.onmouseover = lightCase2;
}
else
{
a.onclick = chooseCell;
a.title = hex;
}
return a;
}
function doLoop(d, dir, loop, r, g, b)
{
var rgb = new Array(r, g, b);
if (dir > 0)
{
for (rgb[loop] = 0; rgb[loop] < clr.length; rgb[loop]++)
d.appendChild(addCell(clr[rgb[0]], clr[rgb[1]], clr[rgb[2]]));
}
else if (dir < 0)
{
for (rgb[loop] = clr.length - 1; rgb[loop] >= 0; rgb[loop]--)
d.appendChild(addCell(clr[rgb[0]], clr[rgb[1]], clr[rgb[2]]));
}
else
{
for (rgb[0] = r; rgb[0] >= 0; rgb[0]--, rgb[1]--, rgb[2]--)
d.appendChild(addCell(clr[rgb[0]], clr[rgb[1]], clr[rgb[2]]));
}
}
if (document.getElementById)
{
if (fg)
d = document.getElementById('palettefg');
else
d = document.getElementById('palette');
}
if (d)
{
/* couleur */
doLoop(d, 1, 1, max, min, min);
doLoop(d, -1, 0, max, max, min);
doLoop(d, 1, 2, min, max, min);
doLoop(d, -1, 1, min, max, max);
doLoop(d, 1, 0, min, min, max);
doLoop(d, -1, 2, max, min, max);
/* couleurs supplementaires genre rose et beige
d.appendChild(addCell('FF', '00', 'A3'));
d.appendChild(addCell('FF', '99', 'CC'));
d.appendChild(addCell('FF', '99', 'FF'));
d.appendChild(addCell('FF', 'CC', 'FF'));
*/
/* noir et blanc */
doLoop(d, 0, 2, max, max, max);
}
}
// - Freekill & Joce
var editor_no_change=0;
var tblclick = new Array();
function cleartxt(obj)
{
if (TAnewarticle == 1 && (typeof tblclick[obj.name] == 'undefined'))
{
tblclick[obj.name] = true;
obj.value="";
editor_no_change=0;
}
}
function recupcolor(obj,bg)
{
// From HTMLArea
function convercolor(v)
{
// returns the hex representation of one byte (2 digits)
function hex(d) {
return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);
};
if (typeof v == "number") {
// we're talking to IE here
var r = v & 0xFF;
var g = (v >> 8) & 0xFF;
var b = (v >> 16) & 0xFF;
return "#" + hex(r) + hex(g) + hex(b);
}
if (v.substr(0, 3) == "rgb") {
// in rgb(...) form -- Mozilla and Opera
var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
if (v.match(re)) {
var r = parseInt(RegExp.$1);
var g = parseInt(RegExp.$2);
var b = parseInt(RegExp.$3);
return "#" + hex(r) + hex(g) + hex(b);
}
// doesn't match RE?! maybe uses percentages or float numbers
// -- FIXME: not yet implemented.
return null;
}
if (v.substr(0, 1) == "#") {
// already hex rgb (hopefully :D )
return v;
}
// if everything else fails ;)
return null;
}
var tag;
if (bg) { tag = "f"; } else { tag = "c"; }
if (typeof obj.style.backgroundColor != 'undefined' && obj.style.backgroundColor.length > 0)
{
var color = convercolor(obj.style.backgroundColor);
if (color != null)
TAinsert('['+tag+'='+color+']','[/'+tag+']');
else
alert('color is null');
}
else
{
alert('bg is null');
}
}
function TAinsert(text1, text2)
{
function countInstances(ta,open,closed)
{
var opening = ta.value.split(open);
var closing = ta.value.split(closed);
return opening.length + closing.length - 2;
}
var ta = document.getElementById(TAtextbox);
if (document.selection)
{
var str = document.selection.createRange().text;
ta.focus();
var sel = document.selection.createRange();
if (text2!="")
{
if (str=="")
{
var instances = countInstances(ta,text1,text2);
if (instances%2 != 0)
{
sel.text = sel.text + text2;
}
else
{
sel.text = sel.text + text1;
}
}
else
{
sel.text = text1 + sel.text + text2;
}
}
else
{
sel.text = sel.text + text1;
}
}
else if (ta.selectionStart | ta.selectionStart == 0)
{
if (ta.selectionEnd > ta.value.length) { ta.selectionEnd = ta.value.length; }
var firstPos = ta.selectionStart;
var secondPos = ta.selectionEnd+text1.length;
ta.value=ta.value.slice(0,firstPos)+text1+ta.value.slice(firstPos);
ta.value=ta.value.slice(0,secondPos)+text2+ta.value.slice(secondPos);
ta.selectionStart = firstPos+text1.length;
ta.selectionEnd = secondPos;
ta.focus();
}
else
{ // Opera
var sel = ta; // document.post.message;
var instances = countInstances(ta,text1,text2);
if (instances%2 != 0 && text2 != ""){ sel.value = sel.value + text2; }
else{ sel.value = sel.value + text1; }
}
}
function BtnHighlight(el) {
with(el.style){
borderLeft="1px solid gray";
borderRight="1px solid #e9e9e9";
borderTop="1px solid gray";
borderBottom="1px solid #e9e9e9";
}
}
function BtnNormal(el) {
with(el.style){
border="1px solid #dddddd";
}
}
var posX=0;posY=0;var xOffset=30;yOffset=-30;
var IB=new Object;
function AffBulle(texte) {
contenu="
";
var finalPosX=posX-xOffset;
if (finalPosX<0) finalPosX=0;
if (document.layers) {
document.layers["bulle"].document.write(contenu);
document.layers["bulle"].document.close();
document.layers["bulle"].top=posY+yOffset;
document.layers["bulle"].left=finalPosX;
document.layers["bulle"].visibility="show";}
if (document.all) {
//var f=window.event;
//doc=document.body.scrollTop;
bulle.innerHTML=contenu;
document.all["bulle"].style.top=posY+yOffset;
document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
document.all["bulle"].style.visibility="visible";
}
//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
else if (document.getElementById) {
document.getElementById("bulle").innerHTML=contenu;
document.getElementById("bulle").style.top=posY+yOffset;
document.getElementById("bulle").style.left=finalPosX;
document.getElementById("bulle").style.visibility="visible";
}
}
function HideBulle() {
if (document.layers) {document.layers["bulle"].visibility="hide";}
if (document.all) {document.all["bulle"].style.visibility="hidden";}
else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}
function getMousePos(e) {
if (document.all) {
posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
posY=event.y+document.body.scrollTop;
}
else {
posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
posY=e.pageY;
}
}
function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
if (document.layers) {
window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
document.write("");
}
if (document.all) {
document.write("");
document.onmousemove=getMousePos;
}
//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
else if (document.getElementById) {
document.onmousemove=getMousePos;
document.write("");
}
}
InitBulle("#000000","#cccccc","#000000",1);
// InitBulle(couleur de texte, couleur de fond, couleur de contour taille contour)