From 9dcc4b2fd69e4733decb8731ab719dc28c8259b8 Mon Sep 17 00:00:00 2001 From: Florian BLOUET Date: Thu, 24 Mar 2016 16:26:55 +0100 Subject: [PATCH] clean and remove thesaurus dead code --- resources/gulp/components/thesaurus.js | 6 +- resources/www/thesaurus/js/sprintf.js | 97 --- resources/www/thesaurus/js/thesaurus.js | 387 ------------ resources/www/thesaurus/js/win.js | 805 +++--------------------- 4 files changed, 76 insertions(+), 1219 deletions(-) delete mode 100644 resources/www/thesaurus/js/sprintf.js delete mode 100644 resources/www/thesaurus/js/thesaurus.js diff --git a/resources/gulp/components/thesaurus.js b/resources/gulp/components/thesaurus.js index 3f2487f360..10e7fe04b3 100644 --- a/resources/gulp/components/thesaurus.js +++ b/resources/gulp/components/thesaurus.js @@ -17,9 +17,7 @@ gulp.task('build-thesaurus-js', function(){ var thesaurusGroup = [ config.paths.src + 'vendors/jquery-sprintf/js/jquery.sprintf.1.0.3.js', config.paths.src + 'thesaurus/js/win.js', - config.paths.src + 'thesaurus/js/xmlhttp.js', - config.paths.src + 'thesaurus/js/thesaurus.js', - config.paths.src + 'thesaurus/js/sprintf.js' + config.paths.src + 'thesaurus/js/xmlhttp.js' ]; return utils.buildJsGroup(thesaurusGroup, 'thesaurus', 'thesaurus/js', debugMode); }); @@ -36,4 +34,4 @@ gulp.task('watch-thesaurus-css', function() { gulp.task('build-thesaurus', ['copy-thesaurus-images', 'build-thesaurus-css'], function(){ return gulp.start('build-thesaurus-js'); -}); \ No newline at end of file +}); diff --git a/resources/www/thesaurus/js/sprintf.js b/resources/www/thesaurus/js/sprintf.js deleted file mode 100644 index cbf4abf928..0000000000 --- a/resources/www/thesaurus/js/sprintf.js +++ /dev/null @@ -1,97 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// sprintf function for javascript -function sprintf() { - if (!arguments || arguments.length < 1 || !RegExp) { - return ''; - } - - str = arguments[0]; - while ((newstr = str.replace("\n", "\x01")) != str) - str = newstr; - // var re = /([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)/; - var re = new RegExp("^([^%]*)%('.|0|\x20)?(-)?(\d+)?(\.\d+)?(%|b|c|d|u|f|o|s|x|X)(.*)$", "m"); - re["$*"] = true; - var a = b = [], numSubstitutions = 0, numMatches = 0; - a = re.exec(str); - while (a) { - var leftpart = a[1], pPad = a[2], pJustify = a[3], pMinLength = a[4]; - var pPrecision = a[5], pType = a[6], rightPart = a[7]; - numMatches++; - -// alert("str:"+str + "\nl:"+leftpart + "\nr:"+rightPart); - - if (pType == '%') { - subst = '%'; - } - else { - numSubstitutions++; - if (numSubstitutions >= arguments.length) { - alert('Error! Not enough function arguments (' + (arguments.length - 1) + ', excluding the string)\n' + 'for the number of substitution parameters in string (' + numSubstitutions + ' so far).'); - } - var param = arguments[numSubstitutions]; - var pad = ''; - if (pPad && pPad.substr(0, 1) == "'") { - pad = leftpart.substr(1, 1); - } - else if (pPad) { - pad = pPad; - } - var justifyRight = true; - if (pJustify && pJustify === "-") - justifyRight = false; - var minLength = -1; - if (pMinLength) - minLength = parseInt(pMinLength); - var precision = -1; - if (pPrecision && pType == 'f') { - precision = parseInt(pPrecision.substring(1)); - } - var subst = param; - switch (pType) { - case 'b': - subst = parseInt(param).toString(2); - break; - case 'c': - subst = String.fromCharCode(parseInt(param)); - break; - case 'd': - subst = parseInt(param) ? parseInt(param) : 0; - break; - case 'u': - subst = Math.abs(param); - break; - case 'f': - subst = (precision > -1) ? Math.round(parseFloat(param) * Math.pow(10, precision)) / Math.pow(10, precision) : parseFloat(param); - break; - case 'o': - subst = parseInt(param).toString(8); - break; - case 's': - subst = param; - break; - case 'x': - subst = ('' + parseInt(param).toString(16)).toLowerCase(); - break; - case 'X': - subst = ('' + parseInt(param).toString(16)).toUpperCase(); - break; - default: - break; - } - var padLeft = minLength - subst.toString().length; - var padding; - if (padLeft > 0) { - var arrTmp = new Array(padLeft + 1); - padding = arrTmp.join(pad ? pad : " "); - } - else { - padding = ""; - } - } - str = leftpart + padding + subst + rightPart; - a = re.exec(str); - } - while ((newstr = str.replace("\x01", "\n")) != str) - str = newstr; - return(str); -} diff --git a/resources/www/thesaurus/js/thesaurus.js b/resources/www/thesaurus/js/thesaurus.js deleted file mode 100644 index 6c7e846efb..0000000000 --- a/resources/www/thesaurus/js/thesaurus.js +++ /dev/null @@ -1,387 +0,0 @@ -function loadXMLDoc(url, post_parms, asxml) { - if (typeof(asxml) == "undefined") - asxml = false; - out = null; - xmlhttp = null; - // code for Mozilla, etc. - if (window.XMLHttpRequest) - xmlhttp = new XMLHttpRequest(); - else if (window.ActiveXObject) - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - if (xmlhttp) { - // xmlhttp.onreadystatechange=state_Change - if (post_parms) { - xmlhttp.open("POST", url, false); - xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xmlhttp.send(post_parms); - } - else { - xmlhttp.open("GET", url, false); - xmlhttp.send(null); - } - out = asxml ? xmlhttp.responseXML : xmlhttp.responseText; - } - return(out); -} - - -function showFound2(term, lterm, branch, depth) { - var c; - var ret = 0; - var thb = branch.firstChild.nextSibling.nextSibling; - // branch est un
- - if (thb) { - for (c = thb.firstChild; c; c = c.nextSibling) // THE, les SY ou les TA - { - if (c.nodeName == "DIV") - ret += showFound2(term, lterm, c, depth + 1); // on descend uniquement les THE_yyy - } - } - - - if (branch.firstChild.nextSibling.nodeValue.substr(0, lterm) == term) { - ret = 1; -// alert(branch.firstChild.nextSibling.nodeValue + " : " + thb.id); - } - -// if(ret > 0) -// if(depth > 0) -// { - if (ret > 0) { - //eventObj.Src0.innerHTML = "+"; - thb.className = "OB"; - } - else { - //eventObj.Src0.innerHTML = "+"; - thb.className = "ob"; - } -// } - /* - if(depth == 0) - { - document.getElementById("WT1").style.visibility="hidden"; - if(document.forms["fTh"].textT1.value!=term) - { - // oups! le mot a changé durant le traitement, on recommence - evt_kup_T1(); - } - } - */ - return(ret); -} - -function showAll(branch, depth) { - depth = parseInt(depth); - var c; - for (c = branch.firstChild; c; c = c.nextSibling) { - if (c.nodeType == 1 && c.nodeName == "DIV") // 1=XML_ELEMENT_NODE - showAll(c, depth + 1); - } - - if (depth > 0) - branch.style.display = ""; - - if (depth === 0) { - document.getElementById("WT1").style.visibility = "hidden"; - if (document.forms["fTh"].textT1.value !== "") { - // oups! le mot a changé durant le traitement, on recommence - evt_kup_T1(); - } - } -} - - -function scanTerms(inputName, zTerm, showhide) { - showhide = !!showhide; - var lTerm = zTerm.length; - var zTable = document.getElementById("L" + inputName); - var zTr = zTable.childNodes; // TR's - var l = zTr.length; - var found = null; - for (var i = 0; i < l; i++) { -// if(renum) -// zTr[i].id = inputName+"_"+i - var t = zTr[i].firstChild.firstChild.nodeValue; -// alert(i+" "+t); - if (zTerm == t) - found = zTr[i]; - - if (showhide === true) { - if (lTerm == 0 || (t.substr(0, lTerm) == zTerm)) - zTr[i].style.display = ""; - else - zTr[i].style.display = "none"; - } - else { - zTr[i].style.display = ""; - } - } - return(found); -} - -function addTerm(inputName, zTerm, oldid) // inputName = "TS"|"TA"|"SY" -{ - if (typeof(zTerm) == "undefined") // si pas de terme en argument, prendre dans la zone de saisie - zTerm = document.forms["fTh"]["text" + inputName].value; -// alert(zTerm); - // on cherche si le zTerm existe déjà -// var parent_id = selectedThesaurusItem.getAttribute("id"); -// alert("parent_id = " + parent_id); - - // found = scanTerms(inputName, true, false); // renuméroter et tout afficher - var found = scanTerms(inputName, zTerm, false); // tout afficher - if (!found) { - // on cherche la div "thb" si elle existe - var thb, thRef; - for (thb = selectedThesaurusItem.firstChild; thb; thb = thb.nextSibling) { - if (thb.nodeType == 1 && thb.tagName == "DIV" && thb.id.substr(0, 4) == "THB_") - break; - } - if (!thb) { - // on ajoute le premier fils ... - // ... on crée le +/- en face du terme - selectedThesaurusItem.firstChild.className = "tri"; - selectedThesaurusItem.firstChild.id = "THP_" + selectedThesaurusItem.id.substr(4); - selectedThesaurusItem.firstChild.innerHTML = "-"; - // selectedThesaurusItem.nextid = "0"; - selectedThesaurusItem.setAttribute("nextid", "0"); - // ... on crée la div "THB" - thb = selectedThesaurusItem.appendChild(document.createElement("DIV")); - thb.className = "ob"; - thb.id = "THB_" + selectedThesaurusItem.id.substr(4); - } - - if (inputName == "TS") // on ajoute un terme spécifique - { - // un id pour le nouveau terme - var nextid = parseInt(selectedThesaurusItem.getAttribute("nextid")); - // selectedThesaurusItem.nextid = "" + (nextid+1); - selectedThesaurusItem.setAttribute("nextid", "" + (nextid + 1)); - - // on ajoute le nouveau terme dans le thb : on crée une nouvelle div - var div = document.createElement("DIV"); - div.className = "s_"; - if (selectedThesaurusItem.id == "THE_") - div.id = "THE_" + nextid; - else - div.id = selectedThesaurusItem.id + "." + nextid; - if (typeof(oldid) == "undefined") { - // div.oldid = "?"; // permettra de repérer les nouveaux termes - div.setAttribute("oldid", "?"); // permettra de repérer les nouveaux termes - } - else { - // div.oldid = oldid; // le terme a provient des termes candidats - div.setAttribute("oldid", oldid); // le terme a provient des termes candidats - } - div.setAttribute("lng", ""); - var u = div.appendChild(document.createElement("U")); - //u.appendChild(document.createEntityReference("nbsp")); - u.innerHTML = " "; - div.appendChild(document.createTextNode(zTerm)); - thRef = thb.appendChild(div); - } - else // inputName="TA"|"SY" : on ajoute un terme associé ou un synonyme - { - var p = document.createElement("P"); - p.className = inputName.toLowerCase(); // ta ou sy - p.appendChild(document.createTextNode(zTerm)); - thRef = thb.appendChild(p); - nextid = document.getElementById("L" + inputName).nextid++; - } - - // on ajoute aussi à la liste des termes - tr = appendTerm(inputName, zTerm, nextid); - // on scroll la liste pour montrer le nouveau terme, et on le selectionne - tr.scrollIntoView(false); - myGUI.select(tr); - - tr.thRef = thRef; // lien du nouveau terme de la liste vers le thesaurus - - document.forms["fTh"]["text" + inputName].value = ""; - - termChanged = true; - - dirty(); - } -// else -// { - // alert("Le terme associé '"+newterm+"' existe déjà."); -// } - evt_kup(inputName); -} - -function dirty() { - thesaurusChanged = true; - document.getElementById("saveButton").style.display = ""; -} -/* - function delTerm(inputName, zTerm) // inputName = "TS"|"TA"|"SY" - { - if(typeof(zTerm)=="undefined") - zTerm = document.forms["fTh"]["text"+inputName].value; - - // on cherche si le zTerm existe déjà - // zTr = scanTerms(inputName, true, false); // renuméroter et tout afficher - var zTr = scanTerms(inputName, zTerm, false); // tout afficher - if(zTr) - { - // si on a supprimé un terme spécifique, on vérifie s'il en reste - var thb = zTr.thRef.parentNode; - - if(inputName == "TS") - { - // on deplace du thesaurus vers les candidats (refuse), pour le champ special '(deleted)' - var deleted=null - var thb_deleted; - // on cherche la branche de 'deleted' dans les cterms - for(c=document.getElementById("CTERMS").firstChild; c && !deleted; c=c.nextSibling) - { - if(c.nodeType==1 && c.field && c.field=="(deleted)") - deleted = c; - } - // si elle n'existe pas on la cree - if(!deleted) - { - var zid = document.getElementById("CTERMS").nextid; - document.getElementById("CTERMS").setAttribute("nextid", parseInt(zid)+1); - - // on cree le grp - deleted = document.getElementById("CTERMS").appendChild(document.createElement("DIV")); - deleted.name = "CTERMSGRP"; - deleted.className = "s_ R_"; - deleted.id = "C"+zid; - deleted.setAttribute("nextid", "0"); - deleted.setAttribute("field", "(deleted)"); - - var u = deleted.appendChild(document.createElement("U")); - u.className = "tri"; - u.id = "THP_C"+zid; - u.innerText = "+ "; - - deleted.appendChild(document.createTextNode("(deleted)")); - - thb_deleted = deleted.appendChild(document.createElement("DIV")); - thb_deleted.className = "ob"; - thb_deleted.id = "THB_C"+zid; - } - else - { - zid = deleted.id.substr(1); - thb_deleted = document.getElementById("THB_C" + zid); - } - - // var d = thb_deleted.appendChild(document.createElement("DIV") ); - // d.className = "s_ R_"; - // d.id = "TCE_R" + zid + "." + deleted.nextid; - // d.appendChild(zTr.thRef.firstChild.nextSibling.cloneNode(false) ); - // d.setAttribute("oldid", zTr.thRef.oldid ? zTr.thRef.oldid : zTr.thRef.id.substr(4) ); - - // deleted.setAttribute("nextid", parseInt(deleted.getAttribute("nextid")+1) ); - - deleteBranch(zTr.thRef, thb_deleted); - } - thb.removeChild(zTr.thRef); // supprime le node du thesaurus - if(!thb.firstChild) - { - // plus de ts : on nettoie - var the = thb.parentNode; - the.removeChild(thb); // supprime thb - var u = the.firstChild; - u.innerHTML = " " // vire le +/- - u.className = ""; - } - - // on supprime aussi de la liste des termes - zTr.parentNode.removeChild(zTr); - document.forms["fTh"]["text"+inputName].value = ""; - - termChanged = true; - - dirty(); - } - else - { - // alert("Le terme associé '"+newterm+"' n' existe pas."); - } - evt_kup(inputName); - } - */ -/* - // supprime un terme et tous ses fils (deplace la branche dans '(deleted)' ) - function deleteBranch(the, thb_deleted) - { - newdel = thb_deleted.appendChild(the.cloneNode(true)); - deleteBranch0(newdel, "R"+thb_deleted.parentNode.id.substr(1)); - } - - function deleteBranch0(node, pfxid) - { - if(node.id && node.id.substr(0,2)=="TH") - { - oldid = node.oldid ? node.oldid : node.id.substr(4); - if(node.id.substr(0,4)=="THE_") - { - node.id = "TCE_" + pfxid + "_" + oldid; - node.className = "s_ R_"; - node.setAttribute("oldid", oldid); - } - else // THB_ ou THP_ - { - node.id = node.id.substr(0,4) + pfxid + "_" + oldid; - } - } - for(var node=node.firstChild; node; node=node.nextSibling) - { - deleteBranch0(node, pfxid); - } - } - */ -// supprime un terme et tous ses fils (deplace 'e plat') dans '(deleted)' -function deleteBranch(the, thb_deleted) { - if (the.id.substr(0, 4) == "THE_") { - var d = thb_deleted.appendChild(document.createElement("DIV")); - d.className = "s_ R_"; - d.id = "TCE_R" + (thb_deleted.parentNode.id.substr(1)) + "." + (thb_deleted.parentNode.getAttribute("nextid")); - thb_deleted.parentNode.setAttribute("nextid", parseInt(thb_deleted.parentNode.getAttribute("nextid") + 1)); - d.appendChild(the.firstChild.nextSibling.cloneNode(false)); - d.setAttribute("oldid", the.oldid ? the.oldid : the.id.substr(4)); - if (the.firstChild.nextSibling.nextSibling) { - for (var the = the.firstChild.nextSibling.nextSibling.firstChild; the; the = the.nextSibling) { - deleteBranch(the, thb_deleted); - } - } - } -} - -function alertNode(n, msg) { - if (typeof(msg) == "undefined") - msg = ""; - if (n) { - if (n.nodeType == 1) { - alert(msg + " : <" + n.nodeName + " id='" + n.id + "'>"); - } - else { - alert(msg + " : nodeType=" + n.nodeType); - } - } - else { - alert(msg + " : NULL"); - } -} - -function appendTerm(inputName, new_term, id) { - var tr = document.createElement("TR"); - tr.id = inputName + "_" + id; - tr.className = "s_"; - var td = tr.appendChild(document.createElement("TD")); - td.appendChild(document.createTextNode(new_term)); - td = tr.appendChild(document.createElement("TD")); - td.innerHTML = ""; - td = tr.appendChild(document.createElement("TD")); - td.appendChild(document.createTextNode(" ")); - - var zTable = document.getElementById("L" + inputName); - return(zTable.appendChild(tr)); -} - diff --git a/resources/www/thesaurus/js/win.js b/resources/www/thesaurus/js/win.js index a08c370c8d..f9c4032534 100644 --- a/resources/www/thesaurus/js/win.js +++ b/resources/www/thesaurus/js/win.js @@ -3,55 +3,16 @@ var balloonObj = { X: 0, Y: 0, Src: null, Src0: null }; var dragObj = { objCursor: null, dragging: 0, X: 0, Y: 0, lastClickX: -1, lastClickY: -1, Src: null, Src0: null, Target: null, Target0: null, idTarget: null, callBack: null }; debuglog = ""; -function ww_setDragObj(obj) { +function _ww_setDragObj(obj) { if (dragObj.objCursor) dragObj.objCursor.style.visibility = "hidden"; dragObj.objCursor = obj ? obj : document.getElementById("dragDropCursor"); obj.style.visibility = "visible"; } -function evt_dblclk_doc(event, gui) { - var gui = eval(gui); - var button; - if (typeof(event.which) != 'undefined') - button = gui.firefoxButtons["b" + event.which]; - else - button = event.button; - - if (!dragObj.objCursor) - dragObj.objCursor = document.getElementById("dragDropCursor"); - dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null; - dragObj.dragging = 0; - - var srcElement = (event.target) ? event.target : event.srcElement; - var src0; - for (src0 = srcElement; src0 && !src0.id; src0 = src0.parentNode) - ; -// src0 = (event.srcElement.tagName) ? event.srcElement : null; // correction safari pour le srcElement -// alert("<"+src0.tagName + " id='"+src0.id+"'>"); - - var clickfound = false; - var xmouse = parseInt(event.clientX); - var ymouse = parseInt(event.clientY); - var acceptClick = true; - var e; - for (e = src0; e && acceptClick && (!e.tagName || !clickfound); e = e.parentNode) { - if (e && e.clickable) { - clickObj.X = xmouse; - clickObj.Y = ymouse; - clickObj.Src = e; - clickObj.Src0 = src0; - - clickfound = true; - if (e.clickCallback) - (e.clickCallback)(event, "DBLCLICK", clickObj); - } - } -} - var iiii = 0; -function ww_evt_mdwn_doc(gui, evt) { +function _ww_evt_mdwn_doc(gui, evt) { var gui = eval(gui); if (gui.elemBalloon) @@ -124,13 +85,6 @@ function ww_evt_mdwn_doc(gui, evt) { clickObj.Src = e; clickObj.Src0 = src0; - // d = new Date(); - // dT = d.getTime() - clickObj.lastClickT; - // clickObj.lastClickT = d.getTime(); - - // if(dT<5000) - // alert("dT :" + dT); - clickfound = true; if (e.clickCallback) { if (button == 1) // && !event.altKey) // left button @@ -157,115 +111,8 @@ function ww_evt_mdwn_doc(gui, evt) { evt.returnValue = false; } -/* - function unused_evt_mmov_doc(event, gui) - { - var gui = eval(gui); - var button, xmouse, ymouse; - if(gui.elemBalloon) - gui.elemBalloon.style.visibility = "hidden"; - if(timer_ballon) - { - clearTimeout(timer_ballon); - timer_ballon = null; - } - dragObj.X = xmouse = parseInt(event.clientX); - dragObj.Y = ymouse = parseInt(event.clientY); - window.status = xmouse + '-' + ymouse; - - under_ballon = (event.target) ? event.target : event.srcElement; - if(under_ballon.id) - { - js = "timeout_ballon('"+under_ballon.id+"', "+xmouse+", "+ymouse+");" - timer_ballon = setTimeout(js, 300); - } - - if(!dragObj.Src) - { - if(dragObj.objCursor) - dragObj.objCursor.style.visibility = "hidden"; - return; - } - if(dragObj.dragging == 1) - { - var dx = xmouse - dragObj.lastClickX; - var dy = ymouse - dragObj.lastClickY; - if(Math.abs(dx)>4 || Math.abs(dy)>4) - { - if(dragObj.objCursor) - { - dragObj.objCursor.style.visibility = "visible"; - } - dragObj.dragging = 2; - if(dragObj.Src.ondragstart) - { - // alert("gui is calling ondragstart"); - (dragObj.Src.ondragstart)(); - } - if(dragObj.Src.dragCallback) - { - var r = (dragObj.Src.dragCallback)(event, "DRAGSTART", dragObj); - if(!r) - { - dragObj.dragging = 0; - dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null; - if(dragObj.objCursor) - dragObj.objCursor.style.visibility = "hidden"; - } - } - } - } - if(dragObj.dragging == 2) - { - if(dragObj.objCursor) - { - dragObj.objCursor.style.pixelLeft = xmouse+8; - dragObj.objCursor.style.pixelTop = ymouse+8; - } - var srcElement = (event.target) ? event.target : event.srcElement; - var src0; - var e; - for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode) - ; - for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode) - ; - - if(src0) - { - dragObj.Target0 = src0; - if(dragObj.Target && e != dragObj.Target) // && src0 != e) - { - if(dragObj.Target.ondragleave) - (dragObj.Target.ondragleave)(); - if(dragObj.Target.dropCallback) - (dragObj.Target.dropCallback)(event, "DRAGLEAVE", dragObj); - dragObj.Target = null; - } - if(e) - { - if(!dragObj.Target) - { - dragObj.Target = e; - if(e.ondragenter) - (e.ondragenter)(); - if(dragObj.Target.dropCallback) - (dragObj.Target.dropCallback)(event, "DRAGENTER", dragObj); - } - else - { - if(dragObj.Src.dragCallback) - (dragObj.Src.dragCallback)(event, "DRAG", dragObj); - if(dragObj.Target.dropCallback) - (dragObj.Target.dropCallback)(event, "DRAGOVER", dragObj); - } - } - } - } - } - */ - -function ww_evt_mmov_doc(gui, evt) { +function _ww_evt_mmov_doc(gui, evt) { var gui = eval(gui); var button, xmouse, ymouse; @@ -354,204 +201,11 @@ function ww_evt_mmov_doc(gui, evt) { } return; // if drag/drop, don't care about moving windows } - /* - dragObj.objCursor.style.visibility = "hidden"; - // msg("" + (e.clientX) + " - " + (e.clientY) ); - if(gui.w_active != -1 && (gui.sizing || gui.dragging || gui.splitting || gui.sliding)) - { - t = ""; - var wwin = parseInt(gui.twin[gui.w_active].properties.width); - var hwin = parseInt(gui.twin[gui.w_active].properties.height); - var wgui = document.getElementById("idBody").clientWidth; - var hgui = document.getElementById("idBody").clientHeight; - - if(gui.sliding) - { - //gui.sliding = { 'obj':src0, 'dir':"H", 'divmax':divmax, 'pos':pos, 'min':min, 'max':max, 'val':val }; - if(gui.sliding.dir == "H") - { - var opos = gui.sliding.opos; - var npos = opos + (xmouse - gui.x0); - // self.status = "otop=" + otop + " ntop="+ntop; - if(npos < 0) - npos = 0; - else if(npos > gui.sliding.posmax ) - npos = gui.sliding.posmax; - if(npos != opos) - { - var val = (gui.sliding.min + (((gui.sliding.max-gui.sliding.min) * npos) / gui.sliding.posmax)); - npos = Math.round(((val-gui.sliding.min) * gui.sliding.posmax) / (gui.sliding.max-gui.sliding.min)); - if(npos != opos) - { - gui.sliding.val = val; - gui.sliding.pos = npos; - gui.sliding.obj.style.left = npos+"px"; - var cb; - if(cb = gui.sliding.callback) - (cb)('HSLIDING', gui.sliding.pbj, val); - } - } - } - } - if(gui.splitting) - { - if(gui.splitting.className == "hsplitter") - { - var otop = parseInt(gui.splitting.getAttribute('otop')); - var ntop = otop + (ymouse - gui.y0); - // self.status = "otop=" + otop + " ntop="+ntop; - if(ntop > 40 && ntop < hwin-40 ) - gui.splitting.style.top = ntop+"px"; - } - else if(gui.splitting.className == "vsplitter") - { - var oleft = parseInt(gui.splitting.getAttribute('oleft')); - var nleft = oleft + (xmouse - gui.x0); - // self.status = "otop=" + otop + " ntop="+ntop; - if(nleft > 40 && nleft < wwin-40 ) - gui.splitting.style.left = nleft+"px"; - } - } - - if(gui.dragging) - { - gui.new_t = gui.t0 + (ymouse - gui.y0); - gui.new_l = gui.l0 + (xmouse - gui.x0); - var magnetic = {T:"-", L:"-", B:"-", R:"-" }; - if(gui.new_l < 20) - { - gui.new_l = 0; - magnetic.L = "L"; - } - if(magnetic.L=="-" && gui.new_l + wwin > wgui-20) - { - gui.new_l = wgui-wwin; - magnetic.R = "R"; - } - if(gui.new_t < 20) - { - gui.new_t = 0; - magnetic.T = "T"; - } - if(magnetic.T=="-" && gui.new_t + hwin > hgui-20) - { - gui.new_t = hgui-hwin; - magnetic.B = "B"; - } - gui.twin[gui.w_active].magnetic = magnetic.T + magnetic.L + magnetic.B + magnetic.R; - - t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ; - - gui.windowBorder.style.top = (gui.new_t)+"px"; - gui.windowBorder.style.left = (gui.new_l)+"px"; - } - if(gui.sizing) - { - gui.new_h = gui.h0 + (ymouse - gui.y0); - gui.new_w = gui.w0 + (xmouse - gui.x0); - if(gui.new_w < gui.twin[gui.w_active].minwidth) - gui.new_w = gui.twin[gui.w_active].minwidth; - else - if(gui.new_w > gui.twin[gui.w_active].maxwidth) - gui.new_w = gui.twin[gui.w_active].maxwidth; - - if(gui.new_h < gui.twin[gui.w_active].minheight) - gui.new_h = gui.twin[gui.w_active].minheight; - else - if(gui.new_h > gui.twin[gui.w_active].maxheight) - gui.new_h = gui.twin[gui.w_active].maxheight; - - t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ; - - gui.windowBorder.style.width = (gui.new_w-4)+"px"; - gui.windowBorder.style.height = (gui.new_h-4)+"px"; - } - t += "z-index:999; display:block; background-color:#FFFF00; position:absolute;" - // self.status = t; - - // gui.twin[gui.w_active].hide(); - // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none"; - // document.getElementById(gui.varname+"wb").style.cssText = t; - // gui.windowBorder.style.cssText = t; - } - */ return false; } -/* - - function unused_evt_mup_doc(event, gui) - { - var gui = eval(gui); - var srcElement = (event.target) ? event.target : event.srcElement; - var src0; - for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode) - ; - - var button; - if(typeof(event.which) != 'undefined') - button = gui.firefoxButtons["b"+event.which]; - else - button = event.button; - var xmouse = parseInt(event.clientX); - var ymouse = parseInt(event.clientY); - var e; - var clickfound = false; - for(e=src0; e && (!e.tagName || !clickfound); e=e.parentNode) - { - if(e && e.clickable) - { - clickObj.X = xmouse; - clickObj.Y = ymouse; - clickObj.Src = e; - clickObj.Src0 = src0; - - clickfound = true; - if(e.clickCallback) - { - if(button == 1 && !event.ctrlKey) // left button - acceptClick = (e.clickCallback)(event, event.ctrlKey ? "RMOUSEUP" : "MOUSEUP", clickObj); - else - if(button == 2 && !event.ctrlKey) // right button - acceptClick = (e.clickCallback)(event, "RMOUSEUP", clickObj); - } - } - } - - if(!dragObj.Src) - { - if(dragObj.objCursor) - dragObj.objCursor.style.visibility = "hidden"; - return; - } - - if(dragObj.dragging==2) - { - for(e=src0; e && (!e.tagName || !e.droppable); e=e.parentNode) - { - ; - } - if(e) - { - if(dragObj.Target && e == dragObj.Target) - { - if(dragObj.Target.ondrop) - (dragObj.Target.ondrop)(); - if(dragObj.Target.dropCallback) - (dragObj.Target.dropCallback)(event, "DROP", dragObj); - } - } - } - if(dragObj.Src.dropCallback) - (dragObj.Src.dropCallback)(event, "DRAGEND", dragObj); - dragObj.dragging = 0; - dragObj.Src0 = dragObj.Src = dragObj.Target0 = dragObj.Target = null; - if(dragObj.objCursor) - dragObj.objCursor.style.visibility = "hidden"; - } - */ -function ww_evt_mup_doc(gui, evt) { +function _ww_evt_mup_doc(gui, evt) { var gui = eval(gui); var srcElement = (evt.target) ? evt.target : evt.srcElement; var src0; @@ -608,38 +262,12 @@ function ww_evt_mup_doc(gui, evt) { if (dragObj.objCursor) dragObj.objCursor.style.visibility = "hidden"; } - /* - if(gui.sliding) - { - gui.sliding = null; - } - if(gui.splitting) - { - gui.splitting.style.zIndex = parseInt(gui.splitting.getAttribute('ozindex')); - gui.splitting = null; - } - - if((gui.w_active != -1) && (gui.dragging || gui.sizing)) - { - // document.getElementById(gui.varname+"wb").style.visibility = "hidden"; - gui.windowBorder.style.visibility = "hidden"; - - gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } ); - // alert("ww_evt_mup_doc : new_w="+gui.new_w + " new_h="+gui.new_h); - // document.getElementById(gui.varname+"w"+gui.w_active).style.zIndex = 1; - if(gui.sizing && gui.twin[gui.w_active].onresized) - (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h); - - gui.dragging = gui.sizing = false; - // eval(gui.twin[gui.w_active].onresized); - } - */ return true; } -function ww_evt_kon_doc(gui, evt) { +function _ww_evt_kon_doc(gui, evt) { var gui = eval(gui); @@ -686,61 +314,6 @@ function ww_evt_kon_doc(gui, evt) { // return(false); } -/* - function disabled_evt_kon_doc(event, gui) - { - // var str=''; for (var k in event) {str+='event.'+k+'='+event[k]+'
\n'} - // document.getElementById("debug").innerHTML = "KON "+(iiii++)+"
\n" + str ; - - var gui = eval(gui); - - if(gui.elemBalloon) - gui.elemBalloon.style.visibility = "hidden"; - if(timer_ballon) - { - clearTimeout(timer_ballon); - timer_ballon = null; - } - - if(!dragObj.objCursor) - dragObj.objCursor = document.getElementById("dragDropCursor"); - dragObj.Src0 = dragObj.Src = dragObj.Target = dragObj.Target0 = null; - dragObj.dragging = 0; - - var srcElement = (event.target) ? event.target : event.srcElement; - var src0; - for(src0=srcElement; src0 && !src0.id; src0=src0.parentNode) - ; - - var dragfound = false; - var clickfound = false; - var xmouse = parseInt(event.clientX); - var ymouse = parseInt(event.clientY); - var acceptClick = true; - var e; - for(var e=src0; e && acceptClick && (!e.tagName || !dragfound || !clickfound); e=e.parentNode) - { - if(e && e.clickable) - { - clickObj.X = xmouse; - clickObj.Y = ymouse; - clickObj.Src = e; - clickObj.Src0 = src0; - clickfound = true; - if(e.clickCallback) - { - // var js = "cbDD_T0('CONTEXTMENU', '"+src0.id+"')"; - // self.setTimeout(js, 3000); - // (js)(); - acceptClick = (e.clickCallback)(event, "CONTEXTMENU", clickObj); - } - } - } - event.cancelBubble = true; - event.returnValue = false; - // document.getElementById("debug").innerHTML = "src0:("+src0.tagName+" id="+src0.id+" "+src0.draggable+")
e:("+e.tagName+" id="+e.id+" "+e.draggable+") --- "+dragObj.dragging; - } - */ // ------------------------------------------------------------------------------------------------------ @@ -768,7 +341,7 @@ function timeout_ballon(id, xmouse, ymouse) { timer_ballon = null; } -function ww_evt_balloon(msg) { +function _ww_evt_balloon(msg) { // for(var i=0; i<24; i++) // msg += "
\n"+i; var measurediv = 0; @@ -881,13 +454,7 @@ function ww_evt_balloon(msg) { this.elemBalloon.style.visibility = "visible"; } -function evt_false() { - return false; -} -function evt_true() { - return true; -} -function ww_mdwn_win(idx) { +function _ww_mdwn_win(idx) { wf = this.frontWindow(); if (wf.modal && this.twin[idx] != wf) { wf.blink(); @@ -926,31 +493,22 @@ function ww_mdwn_win(idx) { } return false; } -function ww_evt_mdwn_window(idx) { +function _ww_evt_mdwn_window(idx) { this.mdwn_win(idx); } -function ww_evt_mdwn_title(idx) { +function _ww_evt_mdwn_title(idx) { if (!this.twin[idx] || this.twin[idx].moveable <= 0) return; if (this.mdwn_win(idx)) { - // this.twin[idx].hide(); - /* for(w in this.twin) - { - // this.twin[w].kontent = document.getElementById(this.varname+"w"+w).innerHTML; - n = document.getElementById(this.varname+"w"+w); - n.removeChild(this.twin[w].kontent = n.firstChild); - // document.getElementById(this.varname+"w"+w).innerHTML = "beuark"; - } - */ + this.dragging = true; - /* - */ + window.event.cancelBubble = true; if (window.event.stopPropagation) window.event.stopPropagation(); } } -function ww_evt_mdwn_sizer(idx) { +function _ww_evt_mdwn_sizer(idx) { if (!this.twin[idx] || this.twin[idx].sizeable <= 0) return; if (this.mdwn_win(idx)) @@ -959,7 +517,7 @@ function ww_evt_mdwn_sizer(idx) { if (window.event.stopPropagation) window.event.stopPropagation(); } -function ww_evt_mdwn_reducer(idx) { +function _ww_evt_mdwn_reducer(idx) { // alert("recucer"); if (o = document.getElementById(this.varname + "w" + idx)) { if (this.twin[idx].reduced) { @@ -990,7 +548,7 @@ function ww_evt_mdwn_reducer(idx) { // this.sizing = true; } -function ww_evt_mdwn_closer(idx) { +function _ww_evt_mdwn_closer(idx) { if (o = document.getElementById(this.varname + "w" + idx)) { // alert(this.twin[idx].onclose); if (!this.twin[idx].onclose || (this.twin[idx].onclose)(this.twin[idx]) == true) { @@ -1003,65 +561,7 @@ function ww_evt_mdwn_closer(idx) { } } - -/* - function ww_evt_mdwn_doc(gui) - { - // gui = eval(gui); - // if(window.event.srcElement.id == gui.desktop) - // { - // on a clique sur le bureau - if(window.event.srcElement.onMenu && (window.event.altKey || window.event.button==2)) - { - eval(window.event.srcElement.onMenu); - window.event.returnValue = false; - return(false); - } - // } - } - */ -/* - function ww_evt_mmov_doc(gui) - { - gui = eval(gui); - e = window.event; - // msg("" + (e.clientX) + " - " + (e.clientY) ); - if(gui.w_active != -1 && (gui.sizing || gui.dragging)) - { - t = ""; - if(gui.dragging) - { - gui.new_t = gui.t0 + (e.clientY - gui.y0); - gui.new_l = gui.l0 + (e.clientX - gui.x0); - t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; width:" + (gui.w0-4) + "px; height:" + (gui.h0-4) + "px; visibility:visible;" ; - // t = "top:" + (gui.new_t) + "px; left:" + (gui.new_l) + "px; visibility:visible;" ; - } - if(gui.sizing) - { - gui.new_h = gui.h0 + (e.clientY - gui.y0); - gui.new_w = gui.w0 + (e.clientX - gui.x0); - if(gui.new_w < gui.twin[gui.w_active].minwidth) - gui.new_w = gui.twin[gui.w_active].minwidth; - else - if(gui.new_w > gui.twin[gui.w_active].maxwidth) - gui.new_w = gui.twin[gui.w_active].maxwidth; - - if(gui.new_h < gui.twin[gui.w_active].minheight) - gui.new_h = gui.twin[gui.w_active].minheight; - else - if(gui.new_h > gui.twin[gui.w_active].maxheight) - gui.new_h = gui.twin[gui.w_active].maxheight; - - t = "top:" + (gui.t0) + "px; left:" + (gui.l0) + "px; width:" + (gui.new_w-4) + "px; height:" + (gui.new_h-4) + "px; visibility:visible" ; - } - // gui.twin[gui.w_active].hide(); - // document.getElementById(gui.varname+"w"+gui.w_active).style.display = "none"; - document.getElementById(gui.varname+"wb").style.cssText = t; - } - return false; - } - */ -function ww_setProperties(properties) { +function _ww_setProperties(properties) { style = ""; for (p in this.properties) { if (properties[p]) @@ -1082,24 +582,13 @@ function ww_setProperties(properties) { if (o_h < 0) o_h = 0; if (this.twoviews && (o = document.getElementById(this.varname + "e" + this.idx).style)) { - /* - if(this.hasscroll) - o.overflow = "scroll"; - else - o.overflow = "hiddden"; - */ tv = true; o.height = (o_h) + "px"; o.width = (Math.round(win_w * .25) - 2) + "px"; // document.getElementById(this.varname+"e"+this.idx).style.cssText = style; } if (o = document.getElementById(this.varname + "c" + this.idx).style) { - /* - if(this.hasscroll) - o.style.overflow = "scroll"; - else - o.style.overflow = "hiddden"; - */ + o.height = (o_h) + "px"; if (tv) o.width = (Math.round(win_w * .75) - 2) + "px"; @@ -1116,64 +605,38 @@ function ww_setProperties(properties) { o.style.cssText = t; } } -/* - function ww_evt_mup_doc(gui) - { - gui = eval(gui); - if((gui.w_active != -1) && (gui.dragging || gui.sizing)) - { - document.getElementById(gui.varname+"wb").style.visibility = "hidden"; - gui.twin[gui.w_active].setProperties( { top:(gui.new_t)+"px", left:(gui.new_l)+"px", width:(gui.new_w)+"px", height:(gui.new_h)+"px" } ); - if(gui.sizing && gui.twin[gui.w_active].onresized) - (gui.twin[gui.w_active].onresized)(gui.new_t, gui.new_l, gui.new_w, gui.new_h); - - gui.dragging = gui.sizing = false; - } - return true; - } - */ -function ww_repaint() { +function _ww_repaint() { w = parseInt(this.gui.twin[this.idx].properties.width); h = parseInt(this.gui.twin[this.idx].properties.height); this.gui.twin[this.idx].setProperties({ width: (w) + "px", height: (h) + "px" }); } -function ww_sizeto(w, h) { +function _ww_sizeto(w, h) { if (w == -1) w = parseInt(this.gui.twin[this.idx].properties.width); if (h == -1) h = parseInt(this.gui.twin[this.idx].properties.height); this.gui.twin[this.idx].setProperties({ width: (w) + "px", height: (h) + "px" }); - /* - if(w != -1 && h != -1) - this.gui.twin[this.idx].setProperties( { width:(w)+"px", height:(h)+"px" } ); - else - if(w != -1) - this.gui.twin[this.idx].setProperties( { width:(w)+"px" } ); - else - if(h != -1) - this.gui.twin[this.idx].setProperties( { height:(h)+"px" } ); - */ if (this.gui.twin[this.idx].onresized) (this.gui.twin[this.idx].onresized)(parseInt(this.gui.twin[this.idx].properties.top) , parseInt(this.gui.twin[this.idx].properties.left), w, h); } -function ww_moveto(t, l) { +function _ww_moveto(t, l) { this.gui.twin[this.idx].setProperties({ top: (t) + "px", left: (l) + "px" }); } -function ww_setTitle(t) { +function _ww_setTitle(t) { document.getElementById(this.varname + "t" + this.idx).innerHTML = " " + t; } -function ww_setContent(t, view) { +function _ww_setContent(t, view) { if (!view || !this.twoviews || view != "e") view = "c"; document.getElementById(this.varname + view + this.idx).innerHTML = t; } -function ww_show() { +function _ww_show() { this.properties.visibility = "visible"; document.getElementById(this.varname + "w" + this.idx).style.visibility = "visible"; } -function ww_toFront() { +function _ww_toFront() { wf = this.gui.frontWindow(); if (wf.modal && this != wf) { wf.blink(); @@ -1210,11 +673,11 @@ function ww_toFront() { } return false; } -function ww_hide() { +function _ww_hide() { this.properties.visibility = "hidden"; document.getElementById(this.varname + "w" + this.idx).style.visibility = "hidden"; } -function ww_blink() { +function _ww_blink() { if (o = document.getElementById(this.varname + "t" + this.idx)) { o.className = "ww_title_blink"; window.setTimeout("ww_noblink('" + this.varname + "t" + this.idx + "');", 500); @@ -1225,7 +688,7 @@ function ww_noblink(titleid) { o.className = "ww_title"; } -function ww_getClientSize(view) { +function _ww_getClientSize(view) { if (!view || !this.twoviews || view != "e") view = "c"; if (o = document.getElementById(this.varname + view + this.idx)) { @@ -1236,7 +699,7 @@ function ww_getClientSize(view) { return(null); } -function ww_autoMove() { +function _ww_autoMove() { // alert("ww_autoMove"); var moved = false; var sized = false; @@ -1276,8 +739,6 @@ function ww_autoMove() { this.sizeto(wwin, hwin); // this.setProperties( {top:twin+"px", left:lwin+"px" } ); } - /* - */ } function ww_Window(gui, anchor, varname, idx, properties) { @@ -1295,18 +756,18 @@ function ww_Window(gui, anchor, varname, idx, properties) { // this.evt_mdwn_sizer = ww_evt_mdwn_sizer; // this.evt_mdwn_reducer = ww_evt_mdwn_reducer; // this.evt_mdwn_closer = ww_evt_mdwn_closer; - this.sizeto = ww_sizeto; - this.moveto = ww_moveto; - this.repaint = ww_repaint; - this.setTitle = ww_setTitle; - this.setContent = ww_setContent; - this.setProperties = ww_setProperties; - this.show = ww_show; - this.hide = ww_hide; - this.toFront = ww_toFront; - this.autoMove = ww_autoMove; - this.blink = ww_blink; - this.getClientSize = ww_getClientSize; + this.sizeto = _ww_sizeto; + this.moveto = _ww_moveto; + this.repaint = _ww_repaint; + this.setTitle = _ww_setTitle; + this.setContent = _ww_setContent; + this.setProperties = _ww_setProperties; + this.show = _ww_show; + this.hide = _ww_hide; + this.toFront = _ww_toFront; + this.autoMove = _ww_autoMove; + this.blink = _ww_blink; + this.getClientSize = _ww_getClientSize; // this.mdwn_win = ww_mdwn_win; this.modal = (properties.modal && properties.modal > 0); this.twoviews = (properties.twoviews && properties.twoviews > 0); @@ -1421,30 +882,14 @@ function ww_Window(gui, anchor, varname, idx, properties) { (this.oncreated)(); return this; } -function ww_createWindow(anchor, properties) { +function _ww_createWindow(anchor, properties) { this.twin[this.nwin] = new ww_Window(this, anchor, this.varname, this.nwin, properties); //this.nwin++; return(this.twin[this.nwin++]); } -function ww_getWinPosAsXML() { - var t = ""; -// t += "<"++"?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n\r\n"; - for (w in this.twin) { - t += "= 0 ? this.twin[idx] : null); } -function ww_openCenterWindow(zurl, w, h, name, params) { +function _ww_openCenterWindow(zurl, w, h, name, params) { p = new Array(); p.directories = "no"; p.location = "no"; @@ -1486,7 +931,7 @@ function ww_openCenterWindow(zurl, w, h, name, params) { return(window.open(zurl, name, s, true)); } -function ww_select(obj) { +function _ww_select(obj) { this.unselect(); if (obj) { obj.className = obj.className.replace("s_", "S_"); @@ -1494,7 +939,7 @@ function ww_select(obj) { } } -function ww_unselect() { +function _ww_unselect() { if (this.selectedObject) { var cn = this.selectedObject.className; cn = cn.replace("S_", "s_"); @@ -1503,7 +948,7 @@ function ww_unselect() { } } -function ww_runAsMenu(event, backparm) { +function _ww_runAsMenu(event, backparm) { // alert(event); this.backparm = backparm; if (this.gui.activeMenu != null) { @@ -1548,10 +993,10 @@ function ww_dieMenu(mid) { (m.menuCallback)("DIE", m.backparm, null); } } -function ww_evt_mouseout_menu() { +function _ww_evt_mouseout_menu() { this.dieMenuTimer = self.setTimeout("ww_dieMenu('" + this.id + "');", 500); } -function ww_evt_mousemove_menu() { +function _ww_evt_mousemove_menu() { // var str=''; for (var k in event) {str+='event.'+k+'='+event[k]+'
\n'} // document.getElementById("debug").innerHTML = "MOVE "+(iiii++)+"
\n" + str ; if (this.dieMenuTimer) { @@ -1559,7 +1004,7 @@ function ww_evt_mousemove_menu() { this.dieMenuTimer = null; } } -function ww_evt_click_menu(e) { +function _ww_evt_click_menu(e) { if (this.dieMenuTimer) { clearTimeout(this.dieMenuTimer); this.dieMenuTimer = null; @@ -1575,15 +1020,15 @@ function ww_evt_click_menu(e) { this.gui.activeMenu = null; (this.menuCallback)("SELECT", this.backparm, tg.id); } -function ww_setAsMenu(id, callback) { +function _ww_setAsMenu(id, callback) { o = this.document.getElementById(id); o.ismenu = 1; o.gui = this; - o.runAsMenu = ww_runAsMenu; + o.runAsMenu = _ww_runAsMenu; o.menuCallback = callback; - o.onmouseout = ww_evt_mouseout_menu; - o.onmousemove = ww_evt_mousemove_menu; - o.onclick = ww_evt_click_menu; + o.onmouseout = _ww_evt_mouseout_menu; + o.onmousemove = _ww_evt_mousemove_menu; + o.onclick = _ww_evt_click_menu; } @@ -1609,17 +1054,16 @@ function GUI(varname, idbody, skin) { this.elemBalloon = null; - this.createWindow = ww_createWindow; - this.frontWindow = ww_frontWindow; - this.evt_mdwn_window = ww_evt_mdwn_window; - this.evt_mdwn_title = ww_evt_mdwn_title; - this.evt_mdwn_sizer = ww_evt_mdwn_sizer; - this.evt_mdwn_reducer = ww_evt_mdwn_reducer; - this.evt_mdwn_closer = ww_evt_mdwn_closer; - this.showBalloon = ww_evt_balloon; - this.mdwn_win = ww_mdwn_win; - this.getWinPosAsXML = ww_getWinPosAsXML; - this.openCenterWindow = ww_openCenterWindow; + this.createWindow = _ww_createWindow; + this.frontWindow = _ww_frontWindow; + this.evt_mdwn_window = _ww_evt_mdwn_window; + this.evt_mdwn_title = _ww_evt_mdwn_title; + this.evt_mdwn_sizer = _ww_evt_mdwn_sizer; + this.evt_mdwn_reducer = _ww_evt_mdwn_reducer; + this.evt_mdwn_closer = _ww_evt_mdwn_closer; + this.showBalloon = _ww_evt_balloon; + this.mdwn_win = _ww_mdwn_win; + this.openCenterWindow = _ww_openCenterWindow; var desk = document.getElementById(idbody); @@ -1642,7 +1086,7 @@ function GUI(varname, idbody, skin) { dragObj.objCursor = desk.appendChild(node); desk.onmousemove = function (e) { - ww_evt_mmov_doc(varname, (e ? e : window.event)); + _ww_evt_mmov_doc(varname, (e ? e : window.event)); }; desk.onmousedown = function (e) { var evt = e ? e : window.event; @@ -1652,21 +1096,21 @@ function GUI(varname, idbody, skin) { evt.preventDefault(); } // ---- - ww_evt_mdwn_doc(varname, evt); + _ww_evt_mdwn_doc(varname, evt); }; desk.onmouseup = function (e) { - ww_evt_mup_doc(varname, (e ? e : window.event)); + _ww_evt_mup_doc(varname, (e ? e : window.event)); }; if (typeof(document.onselectstart) != "undefined") { // ie - document.onselectstart = evt_select_doc; + document.onselectstart = _evt_select_doc; } // on interdit les menus contextuels de explorer // document.oncontextmenu = function (e) { if(e){e.returnValue=false}else{window.event.returnValue=false}; return false; }; document.oncontextmenu = function (e) { - ww_evt_kon_doc(varname, (e ? e : window.event)); + _ww_evt_kon_doc(varname, (e ? e : window.event)); }; @@ -1688,118 +1132,17 @@ function GUI(varname, idbody, skin) { this.activeMenu = null; // this.setAsMenu = function(id){o=this.document.getElementById(id); o.ismenu=1; o.gui=this; o.runAsMenu=ww_runAsMenu}; - this.setAsMenu = ww_setAsMenu; + this.setAsMenu = _ww_setAsMenu; this.selectedObject = null; - this.select = ww_select; - this.unselect = ww_unselect; + this.select = _ww_select; + this.unselect = _ww_unselect; - this.setDragObj = ww_setDragObj; - /* - s = "
"; - s += ""; - document.write(s); - - // on enregistre des handlers sur le document pour le drag & drop - document.onselectstart = ww_selectStart; - - var o = document.getElementById("desktop"); - o.onmouseover = evt_movr_doc; - - var old = (document.onmousemove) ? document.onmousemove : function () {}; - document.onmousemove = function(e){if(e){old(e, varname); return(evt_mmov_doc(e, varname));}else{old(window.event, varname); return(evt_mmov_doc(window.event, varname));}}; - - var old = (document.onmousedown) ? document.onmousedown : function () {}; - document.onmousedown = function(e){if(e){old(e, varname); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); return(evt_mdwn_doc(window.event, varname));}}; - - var old = (document.ondblclick) ? document.ondblclick : function () {}; - document.ondblclick = function(e){if(e){old(e, varname); return(evt_dblclk_doc(e, varname));}else{old(window.event, varname); return(evt_dblclk_doc(window.event, varname));}}; - - var old = (document.onmouseup) ? document.onmouseup : function () {}; - document.onmouseup = function(e){if(e){old(e, varname); return(evt_mup_doc(e, varname));}else{old(window.event, varname); return(evt_mup_doc(window.event, varname));} }; - - // on interdit les menus contextuels de explorer... ? - // document.oncontextmenu = function () { window.event.returnValue=false; return false; }; - // ... en fait on simule un 'mousedown' pour safari qui ne le fait pas avec les souris 2 bouton - // var old = (document.oncontextmenu) ? document.oncontextmenu : function () {}; - - // document.oncontextmenu = function(e){if(e){old(e, varname); window.event.returnValue=false; return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); window.event.returnValue=false; return(evt_mdwn_doc(window.event, varname));}}; - - // document.oncontextmenu = function(e){if(e){old(e, varname); alert('rz'); return(evt_mdwn_doc(e, varname));}else{old(window.event, varname); alert('xc'); return(evt_mdwn_doc(window.event, varname));}}; - // document.oncontextmenu = function(e){if(e){old(e, varname); return(evt_kon_doc(e, varname));}else{old(window.event, varname); return(evt_kon_doc(window.event, varname));} }; - - // document.onmousedown = w2md; - // document.onmouseup = w2mu; - - document.oncontextmenu = function(e){if(!e) e=window.event; e.returnValue=false; - if(e.stopPropagation) e.stopPropagation(); - if(e.preventDefault) e.preventDefault(); - return true; - }; - */ + this.setDragObj = _ww_setDragObj; } -function evt_select_doc(evt) { +function _evt_select_doc(evt) { evt = evt ? evt : window.event; var srcElement = evt.srcElement ? evt.srcElement : evt.target; return(srcElement.tagName == "INPUT" || srcElement.tagName == "TEXTAREA"); } - - -function w2md(e) { - if (!e) - e = window.event; -// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+'
\n'} -// document.getElementById("debug").innerHTML = "DOWN "+(iiii++)+"
\n" + str ; - document.getElementById("debug").innerHTML += "DOWN "; - e.cancelBubble = true; - e.returnValue = false; -// e.stopPropagation(); - return(false); -} - -function w2mu(e) { - if (!e) - e = window.event; -// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+'
\n'} -// document.getElementById("debug").innerHTML = "UP "+(iiii++)+"
\n" + str ; - document.getElementById("debug").innerHTML += "UP "; - e.cancelBubble = true; - e.returnValue = false; -// e.stopPropagation(); - return(false); -} - -function w2k(e) { - if (!e) - e = window.event; -// var str=''; for (var k in e) {str+='event.'+k+'='+e[k]+'
\n'} -// document.getElementById("debug").innerHTML = "KON "+(iiii++)+"
\n" + str ; - document.getElementById("debug").innerHTML += "KON "; -// e.cancelBubble=true; -// e.returnValue=false; -// e.stopPropagation(); - return(false); -} - - -function ww_selectStart() { - return(window.event.srcElement.tagName == "INPUT" || window.event.srcElement.tagName == "TEXTAREA"); -} - -escapeCharString = "*+@-/"; -escapeCharCodes = new Array(42, 43, 64, 45, 47); -function fullEscape(s) { - var s2, ret, i, x, c; - s2 = escape(s); - ret = ""; - for (i = 0; i < s2.length; i++) - ret += ((x = escapeCharString.indexOf(c = s2.charAt(i))) != -1) ? "%" + escapeCharCodes[x].toString(16) : c; - return(ret); -} -function getU() { - var x; - x = new Date(); - return("" + x.getTime()); -} -