rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
} while(tileoffsetlat > bounds.bottom - tilelat)
} while(tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
_initTiles:function() { //first of all, clear out the main div this.div.innerHTML = ""; //now clear out the old grid and start a new one this.clearGrid(); this.grid = new Array(); var viewSize = this.map.getSize(); var bounds = this.map.getExtent(); var extent = this.map.getMaxExtent(); var resolution = this.map.getResolution(); var tilelon = resolution*this.tileSize.w; var tilelat = resolution*this.tileSize.h; var offsetlon = bounds.left; var tilecol = Math.floor(offsetlon/tilelon); var tilecolremain = offsetlon/tilelon - tilecol; var tileoffsetx = -tilecolremain * this.tileSize.w; var tileoffsetlon = tilecol * tilelon; var offsetlat = bounds.top; var tilerow = Math.ceil(offsetlat/tilelat); var tilerowremain = tilerow - offsetlat/tilelat; var tileoffsety = -(tilerowremain+1) * this.tileSize.h; var tileoffsetlat = tilerow * tilelat; tileoffsetx = Math.round(tileoffsetx); // heaven help us tileoffsety = Math.round(tileoffsety); this.origin = new OpenLayers.Pixel(tileoffsetx,tileoffsety); var startX = tileoffsetx; var startLon = tileoffsetlon; do { var row = new Array(); this.grid.push(row); tileoffsetlon = startLon; tileoffsetx = startX; do { var tileBounds = new OpenLayers.Bounds(tileoffsetlon, tileoffsetlat, tileoffsetlon+tilelon, tileoffsetlat+tilelat); var tile = this.addTile(tileBounds, new OpenLayers.Pixel(tileoffsetx - parseInt(this.map.layerContainerDiv.style.left), tileoffsety - parseInt(this.map.layerContainerDiv.style.top)) ); tile.draw(); row.push(tile); tileoffsetlon += tilelon; tileoffsetx += this.tileSize.w; } while (tileoffsetlon < bounds.right) tileoffsetlat -= tilelat; tileoffsety += this.tileSize.h; } while(tileoffsetlat > bounds.bottom - tilelat) },
var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P";
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var rngBefore = doc.createRange();
rngBefore = doc.createRange();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var rngAfter = doc.createRange();
rngAfter = doc.createRange();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset;
direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; startNode = direct ? sel.anchorNode : sel.focusNode; startOffset = direct ? sel.anchorOffset : sel.focusOffset; endNode = direct ? sel.focusNode : sel.anchorNode; endOffset = direct ? sel.focusOffset : sel.anchorOffset;
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode);
startBlock = inst.getParentBlockElement(startNode); endBlock = inst.getParentBlockElement(endNode);
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
if (tinyMCE.getParentElement(startBlock, "OL,UL") != null)
if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null)
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var startChop = startNode; var endChop = endNode;
startChop = startNode; endChop = endNode;
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
sel.removeAllRanges();
if (!tinyMCE.isSafari) sel.removeAllRanges();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var contents = rng.cloneContents();
contents = rng.cloneContents();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore);
if (tinyMCE.isOpera) { paraBefore.normalize(); rngBefore.insertNode(paraBefore); paraAfter.normalize(); rngBefore.insertNode(paraAfter); } else { paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); }
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var contents = rngAfter.cloneContents();
contents = rngAfter.cloneContents();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
var rng = doc.createRange();
rng = doc.createRange();
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
rng.insertNode(paraAfter); rng.insertNode(paraBefore);
if (tinyMCE.isOpera) { rng.insertNode(paraBefore); rng.insertNode(paraAfter); } else { rng.insertNode(paraAfter); rng.insertNode(paraBefore); }
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
inst.selection.moveToBookmark(b);
_insertPara : function(inst, e) { function isEmpty(para) { function isEmptyHTML(html) { return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == ""; } // Check for images if (para.getElementsByTagName("img").length > 0) return false; // Check for tables if (para.getElementsByTagName("table").length > 0) return false; // Check for HRs if (para.getElementsByTagName("hr").length > 0) return false; // Check all textnodes var nodes = tinyMCE.getNodeTree(para, new Array(), 3); for (var i=0; i<nodes.length; i++) { if (!isEmptyHTML(nodes[i].nodeValue)) return false; } // No images, no tables, no hrs, no text content then it's empty return true; } var doc = inst.getDoc(); var sel = inst.getSel(); var win = inst.contentWindow; var rng = sel.getRangeAt(0); var body = doc.body; var rootElm = doc.documentElement; var blockName = "P"; // tinyMCE.debug(body.innerHTML); // debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString()); // Setup before range var rngBefore = doc.createRange(); rngBefore.setStart(sel.anchorNode, sel.anchorOffset); rngBefore.collapse(true); // Setup after range var rngAfter = doc.createRange(); rngAfter.setStart(sel.focusNode, sel.focusOffset); rngAfter.collapse(true); // Setup start/end points var direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0; var startNode = direct ? sel.anchorNode : sel.focusNode; var startOffset = direct ? sel.anchorOffset : sel.focusOffset; var endNode = direct ? sel.focusNode : sel.anchorNode; var endOffset = direct ? sel.focusOffset : sel.anchorOffset; startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode; endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode; // tinyMCE.debug(startNode, endNode); // Get block elements var startBlock = tinyMCE.getParentBlockElement(startNode); var endBlock = tinyMCE.getParentBlockElement(endNode); // If absolute force paragraph generation within if (startBlock && new RegExp('absolute|relative|static', 'gi').test(startBlock.style.position)) startBlock = null; if (endBlock && new RegExp('absolute|relative|static', 'gi').test(endBlock.style.position)) endBlock = null; // Use current block name if (startBlock != null) { blockName = startBlock.nodeName; // Use P instead if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat))) blockName = "P"; } // Within a list use normal behaviour if (tinyMCE.getParentElement(startBlock, "OL,UL") != null) return false; // Within a table create new paragraphs if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE")) startBlock = endBlock = null; // Setup new paragraphs var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName); var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName); // Is header, then force paragraph under if (/^(H[1-6])$/.test(blockName)) paraAfter = doc.createElement("p"); // Setup chop nodes var startChop = startNode; var endChop = endNode; // Get startChop node node = startChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; startChop = node; } while ((node = node.previousSibling ? node.previousSibling : node.parentNode)); // Get endChop node node = endChop; do { if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node)) break; endChop = node; } while ((node = node.nextSibling ? node.nextSibling : node.parentNode)); // Fix when only a image is within the TD if (startChop.nodeName == "TD") startChop = startChop.firstChild; if (endChop.nodeName == "TD") endChop = endChop.lastChild; // If not in a block element if (startBlock == null) { // Delete selection rng.deleteContents(); sel.removeAllRanges(); if (startChop != rootElm && endChop != rootElm) { // Insert paragraph before rngBefore = rng.cloneRange(); if (startChop == body) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); paraBefore.appendChild(rngBefore.cloneContents()); // Insert paragraph after if (endChop.parentNode.nodeName == blockName) endChop = endChop.parentNode; // If not after image //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY") rng.setEndAfter(endChop); if (endChop.nodeName != "#text" && endChop.nodeName != "BODY") rngBefore.setEndAfter(endChop); var contents = rng.cloneContents(); if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY")) paraAfter.innerHTML = contents.firstChild.innerHTML; else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Delete old contents rng.deleteContents(); rngAfter.deleteContents(); rngBefore.deleteContents(); // Insert new paragraphs paraAfter.normalize(); rngBefore.insertNode(paraAfter); paraBefore.normalize(); rngBefore.insertNode(paraBefore); // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML); } else { body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">"; paraAfter = body.childNodes[1]; } inst.selection.selectNode(paraAfter, true, true); return true; } // Place first part within new paragraph if (startChop.nodeName == blockName) rngBefore.setStart(startChop, 0); else rngBefore.setStartBefore(startChop); rngBefore.setEnd(startNode, startOffset); paraBefore.appendChild(rngBefore.cloneContents()); // Place secound part within new paragraph rngAfter.setEndAfter(endChop); rngAfter.setStart(endNode, endOffset); var contents = rngAfter.cloneContents(); if (contents.firstChild && contents.firstChild.nodeName == blockName) { /* var nodes = contents.firstChild.childNodes; for (var i=0; i<nodes.length; i++) { //tinyMCE.debug(nodes[i].nodeName); if (nodes[i].nodeName != "BODY") paraAfter.appendChild(nodes[i]); } */ paraAfter.innerHTML = contents.firstChild.innerHTML; } else paraAfter.appendChild(contents); // Check if it's a empty paragraph if (isEmpty(paraBefore)) paraBefore.innerHTML = "&nbsp;"; // Check if it's a empty paragraph if (isEmpty(paraAfter)) paraAfter.innerHTML = "&nbsp;"; // Create a range around everything var rng = doc.createRange(); if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) { rng.setStartBefore(startChop.parentNode); } else { if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0) rng.setStartBefore(rngBefore.startContainer); else rng.setStart(rngBefore.startContainer, rngBefore.startOffset); } if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName) rng.setEndAfter(endChop.parentNode); else rng.setEnd(rngAfter.endContainer, rngAfter.endOffset); // Delete all contents and insert new paragraphs rng.deleteContents(); rng.insertNode(paraAfter); rng.insertNode(paraBefore); //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML); // Normalize paraAfter.normalize(); paraBefore.normalize(); inst.selection.selectNode(paraAfter, true, true); return true; },
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1);
if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true)) window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1);
_insertWordContent : function(content) { if (content && content.length > 0) { // Cleanup Word content var bull = String.fromCharCode(8226); var middot = String.fromCharCode(183); var cb; if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") content = eval(cb + "('before', content)"); var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); for (var i=0; i<rl.length; i+=2) content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]); if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) { content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>'); } content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>"); content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list content = content.replace(/<o:p><\/o:p>/gi, ""); content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments if (tinyMCE.getParam("paste_remove_spans", true)) content = content.replace(/<\/?span[^>]*>/gi, ""); if (tinyMCE.getParam("paste_remove_styles", true)) content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); content = content.replace(/<\/?font[^>]*>/gi, ""); // Strips class attributes. switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) { case "all": content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); break; case "mso": content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); break; } content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']); content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); content = content.replace(/<\\?\?xml[^>]*>/gi, ""); content = content.replace(/<\/?\w+:[^>]*>/gi, ""); content = content.replace(/-- page break --\s*<p>&nbsp;<\/p>/gi, ""); // Remove pagebreaks content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks // content = content.replace(/\/?&nbsp;*/gi, ""); &nbsp; // content = content.replace(/<p>&nbsp;<\/p>/gi, ''); if (!tinyMCE.settings['force_p_newlines']) { content = content.replace('', '' ,'gi'); content = content.replace('</p>', '<br /><br />' ,'gi'); } if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) { content = content.replace(/<\/?p[^>]*>/gi, ""); } content = content.replace(/<\/?div[^>]*>/gi, ""); // Convert all middlot lists to UL lists if (tinyMCE.getParam("paste_convert_middot_lists", true)) { var div = document.createElement("div"); div.innerHTML = content; // Convert all middot paragraphs to li elements var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList"); while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull content = div.innerHTML; } // Replace all headers with strong and fix some other issues if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) { content = content.replace(/<h[1-6]>&nbsp;<\/h[1-6]>/gi, '<p>&nbsp;&nbsp;</p>'); content = content.replace(/<h[1-6]>/gi, '<p><b>'); content = content.replace(/<\/h[1-6]>/gi, '</b></p>'); content = content.replace(/<b>&nbsp;<\/b>/gi, '<b>&nbsp;&nbsp;</b>'); content = content.replace(/^(&nbsp;)*/gi, ''); } content = content.replace(/--list--/gi, ""); // Remove --list-- if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "") content = eval(cb + "('after', content)"); // Insert cleaned content tinyMCE.execCommand("mceInsertContent", false, content); window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread } },
th._column=column; th.onmouseover=f_dataGrid._Title_onMouseOver; th.onmouseout=f_dataGrid._Title_onMouseOut; th.onmousedown=f_dataGrid._Title_onMouseDown; th.onmouseup=f_dataGrid._Title_onMouseUp;
_installSorter: function(column, method) { f_core.Assert(column._head, "No Title for column '"+column._index+"'."); if (typeof(method)!="function") { method=eval(method); f_core.Assert(typeof(method)=="function", "Bad sort method for column '"+column._index+"' !"); } column._method=method; var th=column._head; th._column=column; th.onmouseover=f_dataGrid._Title_onMouseOver; th.onmouseout=f_dataGrid._Title_onMouseOut; th.onmousedown=f_dataGrid._Title_onMouseDown; th.onmouseup=f_dataGrid._Title_onMouseUp; th.style.cursor="pointer"; th.style.cursor="hand"; },
if (tinyMCE.isMSIE && !tinyMCE.isOpera && n.nodeType == 1) {
if (tinyMCE.isRealIE && n.nodeType == 1) {
_isDuplicate : function(n) { var i; if (!this.settings.fix_content_duplication) return false; if (tinyMCE.isMSIE && !tinyMCE.isOpera && n.nodeType == 1) { // Mark elements if (n.mce_serialized == this.serializationId) return true; n.setAttribute('mce_serialized', this.serializationId); } else { // Search lookup table for text nodes and comments for (i=0; i<this.serializedNodes.length; i++) { if (this.serializedNodes[i] == n) return true; } this.serializedNodes[this.serializedNodes.length] = n; } return false; }
}
},
_isStringOrNumber: function(param) { return(typeof param=='string' || typeof param=='number'); }
if (!window.calendar) {
var cal = window._dynarch_popupCalendar; if (!cal || cal.multiple)
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
}
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress");
var act = (Calendar.is_ie || ev.type == "keypress"), K = ev.keyCode;
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
switch (ev.keyCode) {
switch (K) {
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
} else switch (ev.keyCode) {
} else switch (K) {
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]);
var prev, x, y, ne, el, step; prev = K == 37 || K == 38; step = (K == 37 || K == 39) ? 1 : 7; function setVars() { el = cal.currentDateEl; var p = el.pos; x = p & 15; y = p >> 4; ne = cal.ar_days[y][x]; };setVars(); function prevMonth() { var date = new Date(cal.date); date.setDate(date.getDate() - step); cal.setDate(date); }; function nextMonth() { var date = new Date(cal.date); date.setDate(date.getDate() + step); cal.setDate(date); }; while (1) { switch (K) { case 37: if (--x >= 0) ne = cal.ar_days[y][x]; else { x = 6; K = 38; continue; } break; case 38: if (--y >= 0) ne = cal.ar_days[y][x]; else { prevMonth(); setVars(); } break; case 39: if (++x < 7) ne = cal.ar_days[y][x]; else { x = 0; K = 40; continue; } break; case 40: if (++y < cal.ar_days.length) ne = cal.ar_days[y][x]; else { nextMonth(); setVars(); } break; }
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1];
if (ne) { if (!ne.disabled) Calendar.cellClick(ne); else if (prev) prevMonth(); else nextMonth();
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne;
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
if (act) { cal.callHandler(); cal.hide(); }
if (act) Calendar.cellClick(cal.currentDateEl, ev);
Calendar._keyEvent = function(ev) { if (!window.calendar) { return false; } (Calendar.is_ie) && (ev = window.event); var cal = window.calendar; var act = (Calendar.is_ie || ev.type == "keypress"); if (ev.ctrlKey) { switch (ev.keyCode) { case 37: // KEY left act && Calendar.cellClick(cal._nav_pm); break; case 38: // KEY up act && Calendar.cellClick(cal._nav_py); break; case 39: // KEY right act && Calendar.cellClick(cal._nav_nm); break; case 40: // KEY down act && Calendar.cellClick(cal._nav_ny); break; default: return false; } } else switch (ev.keyCode) { case 32: // KEY space (now) Calendar.cellClick(cal._nav_now); break; case 27: // KEY esc act && cal.callCloseHandler(); break; case 37: // KEY left case 38: // KEY up case 39: // KEY right case 40: // KEY down if (act) { var date = cal.date.getDate() - 1; var el = cal.currentDateEl; var ne = null; var prev = (ev.keyCode == 37) || (ev.keyCode == 38); switch (ev.keyCode) { case 37: // KEY left (--date >= 0) && (ne = cal.ar_days[date]); break; case 38: // KEY up date -= 7; (date >= 0) && (ne = cal.ar_days[date]); break; case 39: // KEY right (++date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; case 40: // KEY down date += 7; (date < cal.ar_days.length) && (ne = cal.ar_days[date]); break; } if (!ne) { if (prev) { Calendar.cellClick(cal._nav_pm); } else { Calendar.cellClick(cal._nav_nm); } date = (prev) ? cal.date.getMonthDays() : 1; el = cal.currentDateEl; ne = cal.ar_days[date - 1]; } Calendar.removeClass(el, "selected"); Calendar.addClass(ne, "selected"); cal.date = new Date(ne.caldate); cal.callHandler(); cal.currentDateEl = ne; } break; case 13: // KEY enter if (act) { cal.callHandler(); cal.hide(); } break; default: return false; } return Calendar.stopEvent(ev);};
script=script.replace(/^\s*(.*?)\s*$/, "$1");
script=f_core.Trim(script);
f_classLoader.prototype._load = function(component, htmlNode, content) { f_core.Assert(component && component._kclass, "f_asyncClassLoader._load: component parameter is invalid : "+component); f_core.Assert(htmlNode && htmlNode.tagName, "f_asyncClassLoader._load: htmlNode parameter is invalid : "+htmlNode); f_core.Assert(typeof(content)=="string", "f_asyncClassLoader._load: component parameter is invalid : "+content); var classLoader=this; var interactiveMode={ _component: component, _htmlNode: htmlNode, _componentPoolLevel: this._componentPool.length, _loads: new Array, _scripts: new Array, addRequireBundle: function(bundleName) { f_core.Debug("f_asyncClassLoader", "Add require bundle '"+bundleName+"'."); this._loads.push(bundleName); return true; }, run: function() { try { var bundles=classLoader._bundles; for(;;) { var loads=this._loads; if (loads.length>0) { var bundleName=loads.shift(); // alert("Load bundle "+bundleName); if (bundles[bundleName]) { continue; } var url=f_env.ComputeJavaScriptURI(bundleName); f_core.Debug("f_asyncClassLoader", "Load script '"+bundleName+"' url='"+url+"'."); var interactive=this; var doc=this._htmlNode.ownerDocument; var script=doc.createElement("SCRIPT"); script.type=f_httpRequest.JAVASCRIPT_MIME_TYPE; script.src=url; script.defer=false; script.charset="UTF-8"; if (f_core.IsInternetExplorer()) { script.onreadystatechange=function() { switch(script.readyState) { case "loaded": case "interactive": case "complete": break; default: // alert("State "+script.readyState); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' state="+script.readyState); return; } script.onreadystatechange=null; f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } else { script.onload=function() { // alert("URL "+url+" loaded !"); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); script.onload=null; try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } doc.body.appendChild(script); return; } if (this._scripts.length>0) { var script=this._scripts.shift(); // alert("Eval script: "+script); script=script.replace(/^\s*(.*?)\s*$/, "$1"); // Pour eviter un anti-virus plutot indelicat ! if (script.indexOf("<!--")==0) { var v=script.indexOf("//-->"); if (v>0) { f_core.Debug("f_asyncClassLoader", "Simplify script '"+script+"'."); script=script.substring(v+5); } } f_core.Debug("f_asyncClassLoader", "Eval script '"+script+"'."); if (script.length>0) { try { eval(script); } catch (x) { f_core.Error("f_asyncClassLoader", "Eval throws exception; script='"+script+"'.", x); } } continue; } f_core.Debug("f_asyncClassLoader", "End of scripts evaluation."); // alert("Fin !"); classLoader._interactiveMode=undefined; classLoader._postLoad(this); return; } } catch (x) { f_core.Error("f_asyncClassLoader", "Async script loading exception.", x); } } }; this._interactiveMode=interactiveMode;// content=content.replace(/^\s+|\s+$/g, ""); f_core.Debug("f_asyncClassLoader", "Set content on component id='"+component.id+"' htmlNode='"+htmlNode+"', htmlNode.tag='"+htmlNode.tagName+"' :\n"+content); try { htmlNode.innerHTML=content; } catch (x) { f_core.Debug("f_asyncClassLoader", "Exception when setting innerHTML for component id='"+component.id+"' htmlNode='"+htmlNode.tagName+"':\n"+content, x); } var forms=htmlNode.getElementsByTagName("FORM"); if (forms.length>0) { f_core.Debug("f_asyncClassLoader", forms.length+" form(s) detected !"); for(var i=0;i<forms.length;i++) { var f=forms[i]; f_core._InitializeForm(f); } } var scripts=htmlNode.getElementsByTagName("SCRIPT"); f_core.Debug("f_asyncClassLoader", scripts.length+" script(s) detected !"); for(var i=0;i<scripts.length;i++) { var script=scripts[i]; var type=script.type; if (typeof(type)=="string" && type.length>0 && type.toLowerCase()!="text/javascript") { f_core.Error("f_asyncClassLoader", "Unknown script type: "+script.type); continue; } var js=script.text; f_core.Debug("f_asyncClassLoader", "Add script: "+js); interactiveMode._scripts.push(js); } interactiveMode.run();}
f_core.Debug("f_asyncClassLoader", "Simplify script '"+script+"'.");
var newScript=script.substring(5, v); newScript=f_core.Trim(newScript); f_core.Debug("f_asyncClassLoader", "Simplify script '"+script+"' newScript='"+newScript+"'.");
f_classLoader.prototype._load = function(component, htmlNode, content) { f_core.Assert(component && component._kclass, "f_asyncClassLoader._load: component parameter is invalid : "+component); f_core.Assert(htmlNode && htmlNode.tagName, "f_asyncClassLoader._load: htmlNode parameter is invalid : "+htmlNode); f_core.Assert(typeof(content)=="string", "f_asyncClassLoader._load: component parameter is invalid : "+content); var classLoader=this; var interactiveMode={ _component: component, _htmlNode: htmlNode, _componentPoolLevel: this._componentPool.length, _loads: new Array, _scripts: new Array, addRequireBundle: function(bundleName) { f_core.Debug("f_asyncClassLoader", "Add require bundle '"+bundleName+"'."); this._loads.push(bundleName); return true; }, run: function() { try { var bundles=classLoader._bundles; for(;;) { var loads=this._loads; if (loads.length>0) { var bundleName=loads.shift(); // alert("Load bundle "+bundleName); if (bundles[bundleName]) { continue; } var url=f_env.ComputeJavaScriptURI(bundleName); f_core.Debug("f_asyncClassLoader", "Load script '"+bundleName+"' url='"+url+"'."); var interactive=this; var doc=this._htmlNode.ownerDocument; var script=doc.createElement("SCRIPT"); script.type=f_httpRequest.JAVASCRIPT_MIME_TYPE; script.src=url; script.defer=false; script.charset="UTF-8"; if (f_core.IsInternetExplorer()) { script.onreadystatechange=function() { switch(script.readyState) { case "loaded": case "interactive": case "complete": break; default: // alert("State "+script.readyState); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' state="+script.readyState); return; } script.onreadystatechange=null; f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } else { script.onload=function() { // alert("URL "+url+" loaded !"); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); script.onload=null; try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } doc.body.appendChild(script); return; } if (this._scripts.length>0) { var script=this._scripts.shift(); // alert("Eval script: "+script); script=script.replace(/^\s*(.*?)\s*$/, "$1"); // Pour eviter un anti-virus plutot indelicat ! if (script.indexOf("<!--")==0) { var v=script.indexOf("//-->"); if (v>0) { f_core.Debug("f_asyncClassLoader", "Simplify script '"+script+"'."); script=script.substring(v+5); } } f_core.Debug("f_asyncClassLoader", "Eval script '"+script+"'."); if (script.length>0) { try { eval(script); } catch (x) { f_core.Error("f_asyncClassLoader", "Eval throws exception; script='"+script+"'.", x); } } continue; } f_core.Debug("f_asyncClassLoader", "End of scripts evaluation."); // alert("Fin !"); classLoader._interactiveMode=undefined; classLoader._postLoad(this); return; } } catch (x) { f_core.Error("f_asyncClassLoader", "Async script loading exception.", x); } } }; this._interactiveMode=interactiveMode;// content=content.replace(/^\s+|\s+$/g, ""); f_core.Debug("f_asyncClassLoader", "Set content on component id='"+component.id+"' htmlNode='"+htmlNode+"', htmlNode.tag='"+htmlNode.tagName+"' :\n"+content); try { htmlNode.innerHTML=content; } catch (x) { f_core.Debug("f_asyncClassLoader", "Exception when setting innerHTML for component id='"+component.id+"' htmlNode='"+htmlNode.tagName+"':\n"+content, x); } var forms=htmlNode.getElementsByTagName("FORM"); if (forms.length>0) { f_core.Debug("f_asyncClassLoader", forms.length+" form(s) detected !"); for(var i=0;i<forms.length;i++) { var f=forms[i]; f_core._InitializeForm(f); } } var scripts=htmlNode.getElementsByTagName("SCRIPT"); f_core.Debug("f_asyncClassLoader", scripts.length+" script(s) detected !"); for(var i=0;i<scripts.length;i++) { var script=scripts[i]; var type=script.type; if (typeof(type)=="string" && type.length>0 && type.toLowerCase()!="text/javascript") { f_core.Error("f_asyncClassLoader", "Unknown script type: "+script.type); continue; } var js=script.text; f_core.Debug("f_asyncClassLoader", "Add script: "+js); interactiveMode._scripts.push(js); } interactiveMode.run();}
script=script.substring(v+5);
script=newScript;
f_classLoader.prototype._load = function(component, htmlNode, content) { f_core.Assert(component && component._kclass, "f_asyncClassLoader._load: component parameter is invalid : "+component); f_core.Assert(htmlNode && htmlNode.tagName, "f_asyncClassLoader._load: htmlNode parameter is invalid : "+htmlNode); f_core.Assert(typeof(content)=="string", "f_asyncClassLoader._load: component parameter is invalid : "+content); var classLoader=this; var interactiveMode={ _component: component, _htmlNode: htmlNode, _componentPoolLevel: this._componentPool.length, _loads: new Array, _scripts: new Array, addRequireBundle: function(bundleName) { f_core.Debug("f_asyncClassLoader", "Add require bundle '"+bundleName+"'."); this._loads.push(bundleName); return true; }, run: function() { try { var bundles=classLoader._bundles; for(;;) { var loads=this._loads; if (loads.length>0) { var bundleName=loads.shift(); // alert("Load bundle "+bundleName); if (bundles[bundleName]) { continue; } var url=f_env.ComputeJavaScriptURI(bundleName); f_core.Debug("f_asyncClassLoader", "Load script '"+bundleName+"' url='"+url+"'."); var interactive=this; var doc=this._htmlNode.ownerDocument; var script=doc.createElement("SCRIPT"); script.type=f_httpRequest.JAVASCRIPT_MIME_TYPE; script.src=url; script.defer=false; script.charset="UTF-8"; if (f_core.IsInternetExplorer()) { script.onreadystatechange=function() { switch(script.readyState) { case "loaded": case "interactive": case "complete": break; default: // alert("State "+script.readyState); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' state="+script.readyState); return; } script.onreadystatechange=null; f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } else { script.onload=function() { // alert("URL "+url+" loaded !"); f_core.Debug("f_asyncClassLoader", "Script '"+url+"' loaded."); script.onload=null; try { interactive.run(); } catch (x) { f_core.Error("f_asyncClassLoader", "Run async script throws exception.", x); } }; } doc.body.appendChild(script); return; } if (this._scripts.length>0) { var script=this._scripts.shift(); // alert("Eval script: "+script); script=script.replace(/^\s*(.*?)\s*$/, "$1"); // Pour eviter un anti-virus plutot indelicat ! if (script.indexOf("<!--")==0) { var v=script.indexOf("//-->"); if (v>0) { f_core.Debug("f_asyncClassLoader", "Simplify script '"+script+"'."); script=script.substring(v+5); } } f_core.Debug("f_asyncClassLoader", "Eval script '"+script+"'."); if (script.length>0) { try { eval(script); } catch (x) { f_core.Error("f_asyncClassLoader", "Eval throws exception; script='"+script+"'.", x); } } continue; } f_core.Debug("f_asyncClassLoader", "End of scripts evaluation."); // alert("Fin !"); classLoader._interactiveMode=undefined; classLoader._postLoad(this); return; } } catch (x) { f_core.Error("f_asyncClassLoader", "Async script loading exception.", x); } } }; this._interactiveMode=interactiveMode;// content=content.replace(/^\s+|\s+$/g, ""); f_core.Debug("f_asyncClassLoader", "Set content on component id='"+component.id+"' htmlNode='"+htmlNode+"', htmlNode.tag='"+htmlNode.tagName+"' :\n"+content); try { htmlNode.innerHTML=content; } catch (x) { f_core.Debug("f_asyncClassLoader", "Exception when setting innerHTML for component id='"+component.id+"' htmlNode='"+htmlNode.tagName+"':\n"+content, x); } var forms=htmlNode.getElementsByTagName("FORM"); if (forms.length>0) { f_core.Debug("f_asyncClassLoader", forms.length+" form(s) detected !"); for(var i=0;i<forms.length;i++) { var f=forms[i]; f_core._InitializeForm(f); } } var scripts=htmlNode.getElementsByTagName("SCRIPT"); f_core.Debug("f_asyncClassLoader", scripts.length+" script(s) detected !"); for(var i=0;i<scripts.length;i++) { var script=scripts[i]; var type=script.type; if (typeof(type)=="string" && type.length>0 && type.toLowerCase()!="text/javascript") { f_core.Error("f_asyncClassLoader", "Unknown script type: "+script.type); continue; } var js=script.text; f_core.Debug("f_asyncClassLoader", "Add script: "+js); interactiveMode._scripts.push(js); } interactiveMode.run();}
className += " " + tinyMCE.getAttrib(ch, "class");
className = tinyMCE.getAttrib(ch, "class");
_mergeElements : function(scmd, pa, ch, override) { if (scmd == "removeformat") { pa.className = ""; pa.style.cssText = ""; ch.className = ""; ch.style.cssText = ""; return; } var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style")); var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style")); var className = tinyMCE.getAttrib(pa, "class"); className += " " + tinyMCE.getAttrib(ch, "class"); if (override) { for (var n in st) { if (typeof(st[n]) == 'function') continue; stc[n] = st[n]; } } else { for (var n in stc) { if (typeof(stc[n]) == 'function') continue; st[n] = stc[n]; } } tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st)); tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className)); ch.className = ""; ch.style.cssText = ""; ch.removeAttribute("class"); ch.removeAttribute("style"); },
var inst = tinyMCE.selectedInstance, self = TinyMCE_LayerPlugin, i, z = new Array(); var le = self._getParentLayer(inst.getFocusElement()), ci = -1, fi = -1;
var inst = tinyMCE.selectedInstance, i, z = new Array(); var le = this._getParentLayer(inst.getFocusElement()), ci = -1, fi = -1;
_move : function(d) { var inst = tinyMCE.selectedInstance, self = TinyMCE_LayerPlugin, i, z = new Array(); var le = self._getParentLayer(inst.getFocusElement()), ci = -1, fi = -1; var nl = tinyMCE.selectNodes(inst.getBody(), function(n) { return n.nodeType == 1 && new RegExp('absolute|relative|static', 'gi').test(n.style.position); }); // Find z-indexes for (i=0; i<nl.length; i++) { z[i] = nl[i].style.zIndex ? parseInt(nl[i].style.zIndex) : 0; if (ci < 0 && nl[i] == le) ci = i; } if (d < 0) { // Move back // Try find a lower one for (i=0; i<z.length; i++) { if (z[i] < z[ci]) { fi = i; break; } } if (fi > -1) { nl[ci].style.zIndex = z[fi]; nl[fi].style.zIndex = z[ci]; } else { if (z[ci] > 0) nl[ci].style.zIndex = z[ci] - 1; } } else { // Move forward // Try find a higher one for (i=0; i<z.length; i++) { if (z[i] > z[ci]) { fi = i; break; } } if (fi > -1) { nl[ci].style.zIndex = z[fi]; nl[fi].style.zIndex = z[ci]; } else nl[ci].style.zIndex = z[ci] + 1; } inst.repaint(); },
if (!tinyMCE.isMSIE) {
if (!tinyMCE.isIE) {
_onAdd : function(replace_element, form_element_name, target_document) { var hc, th, to, editorTemplate; th = this.settings['theme']; to = tinyMCE.themes[th]; var targetDoc = target_document ? target_document : document; this.targetDoc = targetDoc; tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings['theme']; this.settings['themeurl'] = tinyMCE.themeURL; if (!replace_element) { alert("Error: Could not find the target element."); return false; } if (to.getEditorTemplate) editorTemplate = to.getEditorTemplate(this.settings, this.editorId); var deltaWidth = editorTemplate['delta_width'] ? editorTemplate['delta_width'] : 0; var deltaHeight = editorTemplate['delta_height'] ? editorTemplate['delta_height'] : 0; var html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate['html']; html = tinyMCE.replaceVar(html, "editor_id", this.editorId); this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm"; this.settings['old_width'] = this.settings['width']; this.settings['old_height'] = this.settings['height']; // Set default width, height if (this.settings['width'] == -1) this.settings['width'] = replace_element.offsetWidth; if (this.settings['height'] == -1) this.settings['height'] = replace_element.offsetHeight; // Try the style width if (this.settings['width'] == 0) this.settings['width'] = replace_element.style.width; // Try the style height if (this.settings['height'] == 0) this.settings['height'] = replace_element.style.height; // If no width/height then default to 320x240, better than nothing if (this.settings['width'] == 0) this.settings['width'] = 320; if (this.settings['height'] == 0) this.settings['height'] = 240; this.settings['area_width'] = parseInt(this.settings['width']); this.settings['area_height'] = parseInt(this.settings['height']); this.settings['area_width'] += deltaWidth; this.settings['area_height'] += deltaHeight; // Special % handling if (("" + this.settings['width']).indexOf('%') != -1) this.settings['area_width'] = "100%"; if (("" + this.settings['height']).indexOf('%') != -1) this.settings['area_height'] = "100%"; if (("" + replace_element.style.width).indexOf('%') != -1) { this.settings['width'] = replace_element.style.width; this.settings['area_width'] = "100%"; } if (("" + replace_element.style.height).indexOf('%') != -1) { this.settings['height'] = replace_element.style.height; this.settings['area_height'] = "100%"; } html = tinyMCE.applyTemplate(html); this.settings['width'] = this.settings['old_width']; this.settings['height'] = this.settings['old_height']; this.visualAid = this.settings['visual']; this.formTargetElementId = form_element_name; // Get replace_element contents if (replace_element.nodeName == "TEXTAREA" || replace_element.nodeName == "INPUT") this.startContent = replace_element.value; else this.startContent = replace_element.innerHTML; // If not text area or input if (replace_element.nodeName != "TEXTAREA" && replace_element.nodeName != "INPUT") { this.oldTargetElement = replace_element; // Debug mode if (tinyMCE.settings['debug']) { hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>'; } else { hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; this.oldTargetElement.style.display = "none"; } html += '</span>'; if (tinyMCE.isGecko) html = hc + html; else html += hc; // Output HTML and set editable if (tinyMCE.isGecko) { var rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); var fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); } else { html += '</span>'; // Just hide the textarea element this.oldTargetElement = replace_element; if (!tinyMCE.settings['debug']) this.oldTargetElement.style.display = "none"; // Output HTML and set editable if (tinyMCE.isGecko) { var rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); var fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); } // Setup iframe var dynamicIFrame = false; var tElm = targetDoc.getElementById(this.editorId); if (!tinyMCE.isMSIE) { // Node case is preserved in XML strict mode if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) { tElm = tinyMCE._createIFrame(tElm, targetDoc); dynamicIFrame = true; } this.targetElement = tElm; this.iframeElement = tElm; this.contentDocument = tElm.contentDocument; this.contentWindow = tElm.contentWindow; //this.getDoc().designMode = "on"; } else { if (tElm && tElm.nodeName == "SPAN") tElm = tinyMCE._createIFrame(tElm, targetDoc, targetDoc.parentWindow); else tElm = targetDoc.frames[this.editorId]; this.targetElement = tElm; this.iframeElement = targetDoc.getElementById(this.editorId); if (tinyMCE.isOpera) { this.contentDocument = this.iframeElement.contentDocument; this.contentWindow = this.iframeElement.contentWindow; dynamicIFrame = true; } else { this.contentDocument = tElm.window.document; this.contentWindow = tElm.window; } this.getDoc().designMode = "on"; } // Setup base HTML var doc = this.contentDocument; if (dynamicIFrame) { var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>'; try { if (!this.isHidden()) this.getDoc().designMode = "on"; doc.open(); doc.write(html); doc.close(); } catch (e) { // Failed Mozilla 1.3 this.getDoc().location.href = tinyMCE.baseURL + "/blank.htm"; } } // This timeout is needed in MSIE 5.5 for some odd reason // it seems that the document.frames isn't initialized yet? if (tinyMCE.isMSIE) window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); tinyMCE.setupContent(this.editorId, true); return true; },
if (tinyMCE.isMSIE)
if (tinyMCE.isIE)
_onAdd : function(replace_element, form_element_name, target_document) { var hc, th, to, editorTemplate; th = this.settings['theme']; to = tinyMCE.themes[th]; var targetDoc = target_document ? target_document : document; this.targetDoc = targetDoc; tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings['theme']; this.settings['themeurl'] = tinyMCE.themeURL; if (!replace_element) { alert("Error: Could not find the target element."); return false; } if (to.getEditorTemplate) editorTemplate = to.getEditorTemplate(this.settings, this.editorId); var deltaWidth = editorTemplate['delta_width'] ? editorTemplate['delta_width'] : 0; var deltaHeight = editorTemplate['delta_height'] ? editorTemplate['delta_height'] : 0; var html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate['html']; html = tinyMCE.replaceVar(html, "editor_id", this.editorId); this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm"; this.settings['old_width'] = this.settings['width']; this.settings['old_height'] = this.settings['height']; // Set default width, height if (this.settings['width'] == -1) this.settings['width'] = replace_element.offsetWidth; if (this.settings['height'] == -1) this.settings['height'] = replace_element.offsetHeight; // Try the style width if (this.settings['width'] == 0) this.settings['width'] = replace_element.style.width; // Try the style height if (this.settings['height'] == 0) this.settings['height'] = replace_element.style.height; // If no width/height then default to 320x240, better than nothing if (this.settings['width'] == 0) this.settings['width'] = 320; if (this.settings['height'] == 0) this.settings['height'] = 240; this.settings['area_width'] = parseInt(this.settings['width']); this.settings['area_height'] = parseInt(this.settings['height']); this.settings['area_width'] += deltaWidth; this.settings['area_height'] += deltaHeight; // Special % handling if (("" + this.settings['width']).indexOf('%') != -1) this.settings['area_width'] = "100%"; if (("" + this.settings['height']).indexOf('%') != -1) this.settings['area_height'] = "100%"; if (("" + replace_element.style.width).indexOf('%') != -1) { this.settings['width'] = replace_element.style.width; this.settings['area_width'] = "100%"; } if (("" + replace_element.style.height).indexOf('%') != -1) { this.settings['height'] = replace_element.style.height; this.settings['area_height'] = "100%"; } html = tinyMCE.applyTemplate(html); this.settings['width'] = this.settings['old_width']; this.settings['height'] = this.settings['old_height']; this.visualAid = this.settings['visual']; this.formTargetElementId = form_element_name; // Get replace_element contents if (replace_element.nodeName == "TEXTAREA" || replace_element.nodeName == "INPUT") this.startContent = replace_element.value; else this.startContent = replace_element.innerHTML; // If not text area or input if (replace_element.nodeName != "TEXTAREA" && replace_element.nodeName != "INPUT") { this.oldTargetElement = replace_element; // Debug mode if (tinyMCE.settings['debug']) { hc = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>'; } else { hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />'; this.oldTargetElement.style.display = "none"; } html += '</span>'; if (tinyMCE.isGecko) html = hc + html; else html += hc; // Output HTML and set editable if (tinyMCE.isGecko) { var rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); var fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); } else { html += '</span>'; // Just hide the textarea element this.oldTargetElement = replace_element; if (!tinyMCE.settings['debug']) this.oldTargetElement.style.display = "none"; // Output HTML and set editable if (tinyMCE.isGecko) { var rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); var fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); } // Setup iframe var dynamicIFrame = false; var tElm = targetDoc.getElementById(this.editorId); if (!tinyMCE.isMSIE) { // Node case is preserved in XML strict mode if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) { tElm = tinyMCE._createIFrame(tElm, targetDoc); dynamicIFrame = true; } this.targetElement = tElm; this.iframeElement = tElm; this.contentDocument = tElm.contentDocument; this.contentWindow = tElm.contentWindow; //this.getDoc().designMode = "on"; } else { if (tElm && tElm.nodeName == "SPAN") tElm = tinyMCE._createIFrame(tElm, targetDoc, targetDoc.parentWindow); else tElm = targetDoc.frames[this.editorId]; this.targetElement = tElm; this.iframeElement = targetDoc.getElementById(this.editorId); if (tinyMCE.isOpera) { this.contentDocument = this.iframeElement.contentDocument; this.contentWindow = this.iframeElement.contentWindow; dynamicIFrame = true; } else { this.contentDocument = tElm.window.document; this.contentWindow = tElm.window; } this.getDoc().designMode = "on"; } // Setup base HTML var doc = this.contentDocument; if (dynamicIFrame) { var html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings['base_href'] + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>'; try { if (!this.isHidden()) this.getDoc().designMode = "on"; doc.open(); doc.write(html); doc.close(); } catch (e) { // Failed Mozilla 1.3 this.getDoc().location.href = tinyMCE.baseURL + "/blank.htm"; } } // This timeout is needed in MSIE 5.5 for some odd reason // it seems that the document.frames isn't initialized yet? if (tinyMCE.isMSIE) window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); tinyMCE.setupContent(this.editorId, true); return true; },
if (f_core._DisabledContextMenu) { f_core._DisabledContextMenu=undefined; f_core.DisableContextMenu(); }
_OnInit: function() { var now=new Date(); f_core.Profile("f_core.onInit.enter", now); try { f_core._FlushLogs(); var window=this; f_core.Info("f_core", "Install library (onload) on "+now); if (f_core.Debug_Mode) { var title=["DEBUG"]; f_core.Info("f_core", "Enable f_core.DEBUG mode"); var profiler=window.f_profilerCB; if (profiler) { title.push("PROFILER"); } if (title.length>0) { window.document.title+=" [Camelia: "+title.join(",")+"]"; } } // Hook the forms var forms = window.document.forms; for (var i=0; i<forms.length; i++) { var f = forms[i]; f_core._InitializeForm(f); } // Les objets non encore initializés window._classLoader._initializeObjects(); f_core.Profile("f_core.onInit.objects"); // Initialize packages here window._classLoader._onDocumentComplete(); } finally { f_core.Profile("f_core.onInit.exit"); } },
this.setCurrentTestCase();
this.currentTestCase = new HtmlTestCase(this.getDocument(), htmlTestRunner.getTestSuite().getCurrentRow());
_onLoad: function() { this.setCurrentTestCase(); },
this.htmlTestSuite = new HtmlTestSuite(suiteFrame.getDocument()); if (! this.htmlTestSuite.isAvailable()) {
if (! this.getTestSuite().isAvailable()) {
_onloadTestSuite:function () { this.htmlTestSuite = new HtmlTestSuite(suiteFrame.getDocument()); if (! this.htmlTestSuite.isAvailable()) { return; } if (this.controlPanel.isAutomatedRun()) { htmlTestRunner.startTestSuite(); } else if (this.controlPanel.getAutoUrl()) { //todo what is the autourl doing, left to check it out addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this)); this._getApplicationWindow().src = this.controlPanel.getAutoUrl(); } else { this.htmlTestSuite.getSuiteRows()[0].loadTestCase(); } },
htmlTestRunner.startTestSuite();
this.startTestSuite();
_onloadTestSuite:function () { this.htmlTestSuite = new HtmlTestSuite(suiteFrame.getDocument()); if (! this.htmlTestSuite.isAvailable()) { return; } if (this.controlPanel.isAutomatedRun()) { htmlTestRunner.startTestSuite(); } else if (this.controlPanel.getAutoUrl()) { //todo what is the autourl doing, left to check it out addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this)); this._getApplicationWindow().src = this.controlPanel.getAutoUrl(); } else { this.htmlTestSuite.getSuiteRows()[0].loadTestCase(); } },
this.htmlTestSuite.getSuiteRows()[0].loadTestCase();
this.getTestSuite().getSuiteRows()[0].loadTestCase();
_onloadTestSuite:function () { this.htmlTestSuite = new HtmlTestSuite(suiteFrame.getDocument()); if (! this.htmlTestSuite.isAvailable()) { return; } if (this.controlPanel.isAutomatedRun()) { htmlTestRunner.startTestSuite(); } else if (this.controlPanel.getAutoUrl()) { //todo what is the autourl doing, left to check it out addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this)); this._getApplicationWindow().src = this.controlPanel.getAutoUrl(); } else { this.htmlTestSuite.getSuiteRows()[0].loadTestCase(); } },
addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this));
addLoadListener(this._getApplicationWindow(), fnBind(this._startSingleTest, this));
_onloadTestSuite:function () { if (! this.getTestSuite().isAvailable()) { return; } if (this.controlPanel.isAutomatedRun()) { this.startTestSuite(); } else if (this.controlPanel.getAutoUrl()) { //todo what is the autourl doing, left to check it out addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this)); this._getApplicationWindow().src = this.controlPanel.getAutoUrl(); } else { this.getTestSuite().getSuiteRows()[0].loadTestCase(); } },
addLoadListener(getApplicationWindow(), this._startSingleTest.bind(this)); getApplicationWindow().src = this.runOptions.getAutoUrl();
addLoadListener(this._getApplicationWindow(), this._startSingleTest.bind(this)); this._getApplicationWindow().src = this.runOptions.getAutoUrl();
_onloadTestSuite:function () { this.htmlTestSuite = new HtmlTestSuite(suiteFrame.getDocument()); if (! this.htmlTestSuite.isAvailable()) { return; } if (this.runOptions.isAutomatedRun()) { htmlTestRunner.startTestSuite(); } else if (this.runOptions.getAutoUrl()) { //todo what is the autourl doing, left to check it out addLoadListener(getApplicationWindow(), this._startSingleTest.bind(this)); getApplicationWindow().src = this.runOptions.getAutoUrl(); } else { this.htmlTestSuite.getSuiteRows()[0].loadTestCase(); } },
onInit(this);
onInit.call(this, this);
_onReadyStateChange: function() { var req = this._request; if (!req) { f_core.Info(f_httpRequest, "Request has been canceled !"); return; } var url = this._url; switch (req.readyState) { // UNINITIALIZED, Object created but not initialized, open not called case 0: default: return; // LOADING, Object created, send not called case 1: { f_core.Profile("f_httpRequest.stateChange.loading("+url+")"); if (this._initialized) { return; } this._initialized=true; var onInit=this._listener.onInit; if (typeof(onInit)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onInit for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onInit(this); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onInit for url="+url+".\n"+onInit,ex); } } return; } // LOADED, Send called, status and headers available but no response case 2: { f_core.Profile("f_httpRequest.stateChange.loaded("+url+")"); if (f_core.IsInternetExplorer()) { // Inutile de tester qq chose ! return; } if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var status; var statusText; try { status = req.status; if (status==f_httpRequest.OK_STATUS) { return; } statusText=req.statusText; } catch(ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } this._callError(status, statusText); return; } // INTERACTIVE Some data received, partial results in responseBody/Text case 3: { if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var len = 0; var response = null; var contentType = null; try { len = req.getResponseHeader("Content-Length"); } catch(ex) { len = NaN; } try { contentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); if (contentType) { this._responseContentType=contentType; } } catch (ex) { } if (!contentType || contentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)<0) { try { response = req.responseText; } catch(ex) { } } var onProgress=this._listener.onProgress; if (typeof(onProgress)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onProgress for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onProgress(this, response, len, contentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onProgress method for url='"+url+"'.\n"+onProgress, ex); } } return; } // COMPLETE, All data received headers and status updated case 4: { f_core.Profile("f_httpRequest.stateChange.complete("+url+")"); if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } try { this._responseContentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); } catch (x) { // Il peut y avoir des cas ou la reponse n'est pas prete car c'est un RELOAD forcé par l'utilisateur ! return; } var response=null; if (this._responseContentType && this._responseContentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)>=0) { this._response = false; response=this._responseXML = req.responseXML; } else { response=this._response = req.responseText; this._responseXML = false; } this._ready = true; var status; var statusText; try { status=req.status; statusText=req.statusText; } catch (ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } f_core.Debug(f_httpRequest, "Response='"+response+"' status='"+status+"'."); if (status!=f_httpRequest.OK_STATUS) { this._callError(status, req.statusText); return; } var onLoad=this._listener.onLoad; if (typeof(onLoad)!="function") { return; } try { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onLoad for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)\nresponse size="+((response)?(response.length+" bytes"):"null")); } onLoad(this, response, this._responseContentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onLoad method for url '"+url+"'.\n"+onLoad, ex); } return; } } },
onProgress(this, response, len, contentType);
onProgress.call(this, this, response, len, contentType);
_onReadyStateChange: function() { var req = this._request; if (!req) { f_core.Info(f_httpRequest, "Request has been canceled !"); return; } var url = this._url; switch (req.readyState) { // UNINITIALIZED, Object created but not initialized, open not called case 0: default: return; // LOADING, Object created, send not called case 1: { f_core.Profile("f_httpRequest.stateChange.loading("+url+")"); if (this._initialized) { return; } this._initialized=true; var onInit=this._listener.onInit; if (typeof(onInit)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onInit for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onInit(this); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onInit for url="+url+".\n"+onInit,ex); } } return; } // LOADED, Send called, status and headers available but no response case 2: { f_core.Profile("f_httpRequest.stateChange.loaded("+url+")"); if (f_core.IsInternetExplorer()) { // Inutile de tester qq chose ! return; } if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var status; var statusText; try { status = req.status; if (status==f_httpRequest.OK_STATUS) { return; } statusText=req.statusText; } catch(ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } this._callError(status, statusText); return; } // INTERACTIVE Some data received, partial results in responseBody/Text case 3: { if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var len = 0; var response = null; var contentType = null; try { len = req.getResponseHeader("Content-Length"); } catch(ex) { len = NaN; } try { contentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); if (contentType) { this._responseContentType=contentType; } } catch (ex) { } if (!contentType || contentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)<0) { try { response = req.responseText; } catch(ex) { } } var onProgress=this._listener.onProgress; if (typeof(onProgress)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onProgress for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onProgress(this, response, len, contentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onProgress method for url='"+url+"'.\n"+onProgress, ex); } } return; } // COMPLETE, All data received headers and status updated case 4: { f_core.Profile("f_httpRequest.stateChange.complete("+url+")"); if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } try { this._responseContentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); } catch (x) { // Il peut y avoir des cas ou la reponse n'est pas prete car c'est un RELOAD forcé par l'utilisateur ! return; } var response=null; if (this._responseContentType && this._responseContentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)>=0) { this._response = false; response=this._responseXML = req.responseXML; } else { response=this._response = req.responseText; this._responseXML = false; } this._ready = true; var status; var statusText; try { status=req.status; statusText=req.statusText; } catch (ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } f_core.Debug(f_httpRequest, "Response='"+response+"' status='"+status+"'."); if (status!=f_httpRequest.OK_STATUS) { this._callError(status, req.statusText); return; } var onLoad=this._listener.onLoad; if (typeof(onLoad)!="function") { return; } try { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onLoad for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)\nresponse size="+((response)?(response.length+" bytes"):"null")); } onLoad(this, response, this._responseContentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onLoad method for url '"+url+"'.\n"+onLoad, ex); } return; } } },
onLoad(this, response, this._responseContentType);
onLoad.call(this, this, response, this._responseContentType);
_onReadyStateChange: function() { var req = this._request; if (!req) { f_core.Info(f_httpRequest, "Request has been canceled !"); return; } var url = this._url; switch (req.readyState) { // UNINITIALIZED, Object created but not initialized, open not called case 0: default: return; // LOADING, Object created, send not called case 1: { f_core.Profile("f_httpRequest.stateChange.loading("+url+")"); if (this._initialized) { return; } this._initialized=true; var onInit=this._listener.onInit; if (typeof(onInit)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onInit for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onInit(this); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onInit for url="+url+".\n"+onInit,ex); } } return; } // LOADED, Send called, status and headers available but no response case 2: { f_core.Profile("f_httpRequest.stateChange.loaded("+url+")"); if (f_core.IsInternetExplorer()) { // Inutile de tester qq chose ! return; } if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var status; var statusText; try { status = req.status; if (status==f_httpRequest.OK_STATUS) { return; } statusText=req.statusText; } catch(ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } this._callError(status, statusText); return; } // INTERACTIVE Some data received, partial results in responseBody/Text case 3: { if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } var len = 0; var response = null; var contentType = null; try { len = req.getResponseHeader("Content-Length"); } catch(ex) { len = NaN; } try { contentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); if (contentType) { this._responseContentType=contentType; } } catch (ex) { } if (!contentType || contentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)<0) { try { response = req.responseText; } catch(ex) { } } var onProgress=this._listener.onProgress; if (typeof(onProgress)=="function") { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onProgress for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)"); } try { onProgress(this, response, len, contentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onProgress method for url='"+url+"'.\n"+onProgress, ex); } } return; } // COMPLETE, All data received headers and status updated case 4: { f_core.Profile("f_httpRequest.stateChange.complete("+url+")"); if (this._error) { // On peut continuer a recevoir des infos, meme si il y a eu des problemes ! return; } try { this._responseContentType=req.getResponseHeader(f_httpRequest.HTTP_CONTENT_TYPE); } catch (x) { // Il peut y avoir des cas ou la reponse n'est pas prete car c'est un RELOAD forcé par l'utilisateur ! return; } var response=null; if (this._responseContentType && this._responseContentType.indexOf(f_httpRequest.TEXT_XML_MIME_TYPE)>=0) { this._response = false; response=this._responseXML = req.responseXML; } else { response=this._response = req.responseText; this._responseXML = false; } this._ready = true; var status; var statusText; try { status=req.status; statusText=req.statusText; } catch (ex) { f_core.Error(f_httpRequest, "Can not get status of request !", ex); } f_core.Debug(f_httpRequest, "Response='"+response+"' status='"+status+"'."); if (status!=f_httpRequest.OK_STATUS) { this._callError(status, req.statusText); return; } var onLoad=this._listener.onLoad; if (typeof(onLoad)!="function") { return; } try { if (!this._noLog) { f_core.Info(f_httpRequest, "Call onLoad for url="+url+" . (+"+(new Date().getTime()-this._date)+"ms)\nresponse size="+((response)?(response.length+" bytes"):"null")); } onLoad(this, response, this._responseContentType); } catch (ex) { f_core.Error(f_httpRequest, "Exception when calling onLoad method for url '"+url+"'.\n"+onLoad, ex); } return; } } },
tinyMCE.importPluginLanguagePack('flash','en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk,pt_br');var TinyMCE_FlashPlugin={getInfo:function(){return{longname:'Flash',author:'Moxiecode Systems',authorurl:'http:
tinyMCE.importPluginLanguagePack('flash');var TinyMCE_FlashPlugin={getInfo:function(){return{longname:'Flash',author:'Moxiecode Systems AB',authorurl:'http:
tinyMCE.importPluginLanguagePack('flash','en,tr,de,sv,zh_cn,cs,fa,fr_ca,fr,pl,pt_br,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,zh_tw,zh_tw_utf8,sk,pt_br');var TinyMCE_FlashPlugin={getInfo:function(){return{longname:'Flash',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_flash.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){if(!tinyMCE.settings['flash_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/flash/css/content.css");},getControlHTML:function(cn){switch(cn){case"flash":return tinyMCE.getButtonHTML(cn,'lang_flash_desc','{$pluginurl}/images/flash.gif','mceFlash');}return"";},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceFlash":var name="",swffile="",swfwidth="",swfheight="",action="insert";var template=new Array();var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();template['file']='../../plugins/flash/flash.htm';template['width']=430;template['height']=175;template['width']+=tinyMCE.getLang('lang_flash_delta_width',0);template['height']+=tinyMCE.getLang('lang_flash_delta_height',0);if(focusElm!=null&&focusElm.nodeName.toLowerCase()=="img"){name=tinyMCE.getAttrib(focusElm,'class');if(name.indexOf('mceItemFlash')==-1)return true;swffile=tinyMCE.getAttrib(focusElm,'alt');if(tinyMCE.getParam('convert_urls'))swffile=eval(tinyMCE.settings['urlconverter_callback']+"(swffile, null, true);");swfwidth=tinyMCE.getAttrib(focusElm,'width');swfheight=tinyMCE.getAttrib(focusElm,'height');action="update";}tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",swffile:swffile,swfwidth:swfwidth,swfheight:swfheight,action:action});return true;}return false;},cleanup:function(type,content){switch(type){case"insert_to_editor_dom":if(tinyMCE.getParam('convert_urls')){var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src);}}}break;case"get_from_editor_dom":var imgs=content.getElementsByTagName("img");for(var i=0;i<imgs.length;i++){if(tinyMCE.getAttrib(imgs[i],"class")=="mceItemFlash"){var src=tinyMCE.getAttrib(imgs[i],"alt");if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, null, true);");imgs[i].setAttribute('alt',src);imgs[i].setAttribute('title',src);}}break;case"insert_to_editor":var startPos=0;var embedList=new Array();content=content.replace(new RegExp('<[ ]*embed','gi'),'<embed');content=content.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');content=content.replace(new RegExp('<[ ]*object','gi'),'<object');content=content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');while((startPos=content.indexOf('<embed',startPos+1))!=-1){var endPos=content.indexOf('>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+6,endPos));embedList[embedList.length]=attribs;}var index=0;while((startPos=content.indexOf('<object',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('</object>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++;}var index=0;while((startPos=content.indexOf('<embed',startPos))!=-1){if(index>=embedList.length)break;var attribs=embedList[index];endPos=content.indexOf('>',startPos);endPos+=9;var contentAfter=content.substring(endPos);content=content.substring(0,startPos);content+='<img width="'+attribs["width"]+'" height="'+attribs["height"]+'"';content+=' src="'+(tinyMCE.getParam("theme_href")+'/images/spacer.gif')+'" title="'+attribs["src"]+'"';content+=' alt="'+attribs["src"]+'" class="mceItemFlash" />'+content.substring(endPos);content+=contentAfter;index++;startPos++;}break;case"get_from_editor":var startPos=-1;while((startPos=content.indexOf('<img',startPos+1))!=-1){var endPos=content.indexOf('/>',startPos);var attribs=TinyMCE_FlashPlugin._parseAttributes(content.substring(startPos+4,endPos));if(attribs['class']!="mceItemFlash")continue;endPos+=2;var embedHTML='';var wmode=tinyMCE.getParam("flash_wmode","");var quality=tinyMCE.getParam("flash_quality","high");var menu=tinyMCE.getParam("flash_menu","false");embedHTML+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';embedHTML+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';embedHTML+=' width="'+attribs["width"]+'" height="'+attribs["height"]+'">';embedHTML+='<param name="movie" value="'+attribs["title"]+'" />';embedHTML+='<param name="quality" value="'+quality+'" />';embedHTML+='<param name="menu" value="'+menu+'" />';embedHTML+='<param name="wmode" value="'+wmode+'" />';embedHTML+='<embed src="'+attribs["title"]+'" wmode="'+wmode+'" quality="'+quality+'" menu="'+menu+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+attribs["width"]+'" height="'+attribs["height"]+'"></embed></object>';chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter;}break;}return content;},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&tinyMCE.getAttrib(node,'class').indexOf('mceItemFlash')==0){tinyMCE.switchClass(editor_id+'_flash','mceButtonSelected');return true;}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_flash','mceButtonNormal');return true;},_parseAttributes:function(attribute_string){var attributeName="";var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue)withInValue=true;else if((chr=='"'||chr=="'")&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue="";}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr;}return attributes;}};tinyMCE.addPlugin("flash",TinyMCE_FlashPlugin);
testFailed = true; suiteFailed = true; var testDocument = getIframeDocument(getTestFrame()); if (!this.currentRow) { alert(errorMsg); return; }
_recordFailure : function(errorMsg) { LOG.warn("currentTest.recordFailure: " + errorMsg); // Set cell background to red this.currentRow.bgColor = failColor; // Set error message this.currentRow.cells[2].innerHTML = errorMsg; this.currentRow.title = errorMsg; testFailed = true; suiteFailed = true; },
testFailed = true; suiteFailed = true;
_recordFailure : function(errorMsg) { LOG.warn("currentTest.recordFailure: " + errorMsg); // Set cell background to red this.currentRow.bgColor = failColor; // Set error message this.currentRow.cells[2].innerHTML = errorMsg; this.currentRow.title = errorMsg; testFailed = true; suiteFailed = true; },
var errorRow = this.currentRow; if (!errorRow) { var fakeTable = testDocument.createElement("table"); fakeTable.innerHTML = "<tr><td></td><td></td><td></td></tr>"; testDocument.body.appendChild(fakeTable); errorRow = fakeTable.rows[0];
if (this.currentRow) { this.currentRow.bgColor = failColor; this.currentRow.cells[2].innerHTML = errorMsg; this.currentRow.title = errorMsg; } else { var errorElement = testDocument.createElement("p"); errorElement.id = "error"; errorElement.innerHTML = errorMsg; testDocument.body.appendChild(errorElement); Element.setStyle(errorElement, {'backgroundColor': failColor});
_recordFailure : function(errorMsg) { LOG.warn("currentTest.recordFailure: " + errorMsg); testFailed = true; suiteFailed = true; var testDocument = testIFrame.getDocument(); var errorRow = this.currentRow; if (!errorRow) { // At the end of the test, we might not have a "current" row var fakeTable = testDocument.createElement("table"); fakeTable.innerHTML = "<tr><td></td><td></td><td></td></tr>"; testDocument.body.appendChild(fakeTable); errorRow = fakeTable.rows[0]; } errorRow.bgColor = failColor; errorRow.cells[2].innerHTML = errorMsg; errorRow.title = errorMsg; },
errorRow.bgColor = failColor; errorRow.cells[2].innerHTML = errorMsg; errorRow.title = errorMsg;
_recordFailure : function(errorMsg) { LOG.warn("currentTest.recordFailure: " + errorMsg); testFailed = true; suiteFailed = true; var testDocument = testIFrame.getDocument(); var errorRow = this.currentRow; if (!errorRow) { // At the end of the test, we might not have a "current" row var fakeTable = testDocument.createElement("table"); fakeTable.innerHTML = "<tr><td></td><td></td><td></td></tr>"; testDocument.body.appendChild(fakeTable); errorRow = fakeTable.rows[0]; } errorRow.bgColor = failColor; errorRow.cells[2].innerHTML = errorMsg; errorRow.title = errorMsg; },
var accessBlock = accessMethod.bind(commandTarget);
var accessBlock = fnBind(accessMethod, commandTarget);
_registerAllAccessors: function(commandTarget) { // Methods of the form getFoo(target) result in commands: // getFoo, assertFoo, verifyFoo, assertNotFoo, verifyNotFoo // storeFoo, waitForFoo, and waitForNotFoo. for (var functionName in commandTarget) { var match = /^(get|is)([A-Z].+)$/.exec(functionName); if (match) { var accessMethod = commandTarget[functionName]; var accessBlock = accessMethod.bind(commandTarget); var baseName = match[2]; var isBoolean = (match[1] == "is"); var requiresTarget = (accessMethod.length == 1); this.registerAccessor(functionName, accessBlock); this._registerStoreCommandForAccessor(baseName, accessBlock, requiresTarget); var predicateBlock = this._predicateForAccessor(accessBlock, requiresTarget, isBoolean); this._registerAssertionsForPredicate(baseName, predicateBlock); this._registerWaitForCommandsForPredicate(commandTarget, baseName, predicateBlock); } } },
var actionBlock = actionMethod.bind(commandTarget);
var actionBlock = fnBind(actionMethod, commandTarget);
_registerAllActions: function(commandTarget) { for (var functionName in commandTarget) { var match = /^do([A-Z].+)$/.exec(functionName); if (match) { var actionName = match[1].lcfirst(); var actionMethod = commandTarget[functionName]; var dontCheckPopups = actionMethod.dontCheckAlertsAndConfirms; var actionBlock = actionMethod.bind(commandTarget); this.registerAction(actionName, actionBlock, false, dontCheckPopups); this.registerAction(actionName + "AndWait", actionBlock, true, dontCheckPopups); } } },
var assertBlock = commandTarget[functionName].bind(commandTarget);
var assertBlock = fnBind(commandTarget[functionName], commandTarget);
_registerAllAsserts: function(commandTarget) { for (var functionName in commandTarget) { var match = /^assert([A-Z].+)$/.exec(functionName); if (match) { var assertBlock = commandTarget[functionName].bind(commandTarget); // Register the assert with the "assert" prefix, and halt on failure. var assertName = functionName; this.registerAssert(assertName, assertBlock, true); // Register the assert with the "verify" prefix, and do not halt on failure. var verifyName = "verify" + match[1]; this.registerAssert(verifyName, assertBlock, false); } } },
cursor._column=undefined;
_releaseColumns: function() { var columns=this._columns; for(var i=0;i<columns.length;i++) { var column=columns[i]; var head=column._head; if (head) { column._head=undefined; head._column=undefined; head.onmouseout=null; head.onmouseover=null; head.onmousedown=null; head.onmouseup=null; f_core.VerifyProperties(head); } var cursor=column._cursor; if (cursor) { column._cursor=undefined; cursor.onmousedown=null; cursor.onclick=null; cursor._column=undefined; f_core.VerifyProperties(cursor); } var col=column._col; if (col) { column._col=undefined; f_core.VerifyProperties(col); } column._tcol=undefined; column._tcell=undefined; column._box=undefined; column._label=undefined; column._index=undefined; column._sorter=undefined; column._dataGrid=undefined; column._id=undefined; column._method=undefined; column._visibility=undefined; column._cellStyle=undefined; column._autoFilter=undefined; f_core.VerifyProperties(column); } },
if (n.nodeType == 3 || n.nodeType == 8) { n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); }
if (n.nodeType == 3 || n.nodeType == 8) n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
_removeInternal : function(n) { if (tinyMCE.isGecko) { // Remove mce_src from textnodes and comments tinyMCE.selectNodes(n, function(n) { if (n.nodeType == 3 || n.nodeType == 8) { n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), ""); n.nodeValue = n.nodeValue.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), ""); } return false; }); } },
inst.useCSS = false;
_resizeTo : function(inst, w, h, set_w) { var editorContainer = document.getElementById(inst.editorId + '_parent'); var tableElm = editorContainer.firstChild; var iframe = inst.iframeElement; if (w == null || w == "null") { set_w = false; w = 0; } if (h == null || h == "null") return; w = parseInt(w); h = parseInt(h); if (tinyMCE.isGecko) { w += 2; h += 2; } var dx = w - tableElm.clientWidth; var dy = h - tableElm.clientHeight; w = w < 1 ? 30 : w; h = h < 1 ? 30 : h; if (set_w) tableElm.style.width = w + "px"; tableElm.style.height = h + "px"; iw = iframe.clientWidth + dx; ih = iframe.clientHeight + dy; iw = iw < 1 ? 30 : iw; ih = ih < 1 ? 30 : ih; if (tinyMCE.isGecko) { iw -= 2; ih -= 2; } if (set_w) iframe.style.width = iw + "px"; iframe.style.height = ih + "px"; // Is it to small, make it bigger again if (set_w) { var tableBodyElm = tableElm.firstChild; var minIframeWidth = tableBodyElm.scrollWidth; if (inst.iframeElement.clientWidth < minIframeWidth) { dx = minIframeWidth - inst.iframeElement.clientWidth; inst.iframeElement.style.width = (iw + dx) + "px"; } } },
window.setTimeout(this.resume.bind(this), delay);
window.setTimeout(fnBind(this.resume, this), delay);
_resumeAfterDelay : function() { /** * Pause, then execute the current command. */ // Get the command delay. If a pauseInterval is set, use it once // and reset it. Otherwise, use the defined command-interval. var delay = this.pauseInterval || this.getCommandInterval(); this.pauseInterval = undefined; if (this.currentCommand.isBreakpoint || delay < 0) { // Pause: enable the "next/continue" button this.pause(); } else { window.setTimeout(this.resume.bind(this), delay); } },
if (av.length != 0) return " " + an + "=" + '"' + this.xmlEncode(av) + '"';
if (av.length != 0) { if (an.indexOf('on') != 0) av = this.xmlEncode(av); return " " + an + "=" + '"' + av + '"'; }
_serializeAttribute : function(n, r, an) { var av = '', t, os = this.settings.on_save; if (os && (an.indexOf('mce_') == 0 || an.indexOf('_moz') == 0)) return ''; if (os && this.mceAttribs[an]) av = this._getAttrib(n, this.mceAttribs[an]); if (av.length == 0) av = this._getAttrib(n, an); if (av.length == 0 && r.defaultAttribs && (t = r.defaultAttribs[an])) { av = t; if (av == "mce_empty") return " " + an + '=""'; } if (r.forceAttribs && (t = r.forceAttribs[an])) av = t; if (os && av.length != 0 && this.settings.url_converter.length != 0 && /^(src|href|longdesc)$/.test(an)) av = eval(this.settings.url_converter + '(this, n, av)'); if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) return ""; if (av.length != 0 && av == "{$uid}") av = "uid_" + (this.idCount++); if (av.length != 0) return " " + an + "=" + '"' + this.xmlEncode(av) + '"'; return ""; },
var editClass = tinyMCE.getParam("noneditable_editable_class", "mceEditable"); var nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceNonEditable");
var editClass = tinyMCE.getParam("noneditable_editable_class", "mceItemEditable"); var nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceItemNonEditable");
_setEditable : function(elm, state) { var editClass = tinyMCE.getParam("noneditable_editable_class", "mceEditable"); var nonEditClass = tinyMCE.getParam("noneditable_noneditable_class", "mceNonEditable"); var className = elm.className ? elm.className : ""; if (className.indexOf(editClass) != -1 || className.indexOf(nonEditClass) != -1) return; if ((className = tinyMCE.getAttrib(elm, "class")) != "") className += " "; className += state ? editClass : nonEditClass; elm.setAttribute("class", className); elm.className = className; }
var TinyMCE_NonEditablePlugin={getInfo:function(){return{longname:'Non editable elements',author:'Moxiecode Systems',authorurl:'http:
var TinyMCE_NonEditablePlugin={getInfo:function(){return{longname:'Non editable elements',author:'Moxiecode Systems AB',authorurl:'http:
var TinyMCE_NonEditablePlugin={getInfo:function(){return{longname:'Non editable elements',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_noneditable.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/noneditable/css/noneditable.css");if(tinyMCE.isMSIE5_0)tinyMCE.settings['plugins']=tinyMCE.settings['plugins'].replace(/noneditable/gi,'Noneditable');if(tinyMCE.isGecko){tinyMCE.addEvent(inst.getDoc(),"keyup",TinyMCE_NonEditablePlugin._fixKeyUp);}},cleanup:function(type,content,inst){switch(type){case"insert_to_editor_dom":var nodes=tinyMCE.getNodeTree(content,new Array(),1);var editClass=tinyMCE.getParam("noneditable_editable_class","mceEditable");var nonEditClass=tinyMCE.getParam("noneditable_noneditable_class","mceNonEditable");for(var i=0;i<nodes.length;i++){var elm=nodes[i];var editable=tinyMCE.getAttrib(elm,"contenteditable");if(new RegExp("true|false","gi").test(editable))TinyMCE_NonEditablePlugin._setEditable(elm,editable=="true");if(tinyMCE.isMSIE){var className=elm.className?elm.className:"";if(className.indexOf(editClass)!=-1)elm.contentEditable=true;if(className.indexOf(nonEditClass)!=-1)elm.contentEditable=false;}}break;case"insert_to_editor":if(tinyMCE.isMSIE){var editClass=tinyMCE.getParam("noneditable_editable_class","mceEditable");var nonEditClass=tinyMCE.getParam("noneditable_noneditable_class","mceNonEditable");content=content.replace(new RegExp("class=\"(.*)("+editClass+")([^\"]*)\"","gi"),'class="$1$2$3" contenteditable="true"');content=content.replace(new RegExp("class=\"(.*)("+nonEditClass+")([^\"]*)\"","gi"),'class="$1$2$3" contenteditable="false"');}break;case"get_from_editor_dom":if(tinyMCE.getParam("noneditable_leave_contenteditable",false)){var nodes=tinyMCE.getNodeTree(content,new Array(),1);for(var i=0;i<nodes.length;i++)nodes[i].removeAttribute("contenteditable");}break;}return content;},_fixKeyUp:function(e){var inst=tinyMCE.selectedInstance;var sel=inst.getSel();var rng=inst.getRng();var an=sel.anchorNode;if((e.keyCode==38||e.keyCode==37||e.keyCode==40||e.keyCode==39)&&(elm=TinyMCE_NonEditablePlugin._isNonEditable(an))!=null){rng=inst.getDoc().createRange();rng.selectNode(elm);rng.collapse(true);sel.removeAllRanges();sel.addRange(rng);tinyMCE.cancelEvent(e);}},_isNonEditable:function(elm){var editClass=tinyMCE.getParam("noneditable_editable_class","mceEditable");var nonEditClass=tinyMCE.getParam("noneditable_noneditable_class","mceNonEditable");if(!elm)return;do{var className=elm.className?elm.className:"";if(className.indexOf(editClass)!=-1)return null;if(className.indexOf(nonEditClass)!=-1)return elm;}while(elm=elm.parentNode);return null;},_setEditable:function(elm,state){var editClass=tinyMCE.getParam("noneditable_editable_class","mceEditable");var nonEditClass=tinyMCE.getParam("noneditable_noneditable_class","mceNonEditable");var className=elm.className?elm.className:"";if(className.indexOf(editClass)!=-1||className.indexOf(nonEditClass)!=-1)return;if((className=tinyMCE.getAttrib(elm,"class"))!="")className+=" ";className+=state?editClass:nonEditClass;elm.setAttribute("class",className);elm.className=className;}};tinyMCE.addPlugin("noneditable",TinyMCE_NonEditablePlugin);
element.onclick = this.ignoreEvent.bindAsEventListener(this); element.ondblclick = this.ignoreEvent.bindAsEventListener(this); element.onmousedown = this.singleClick.bindAsEventListener(this);
element.onclick = this.singleClick.bindAsEventListener(this); element.ondblclick = this.singleClick.bindAsEventListener(this); element.onmouseup = this.ignoreEvent.bindAsEventListener(this); element.onmousedown = this.ignoreEvent.bindAsEventListener(this);
_setEventHandlers : function(element, labelDiv) { // We only want to respond to a mousedown event. element.onclick = this.ignoreEvent.bindAsEventListener(this); element.ondblclick = this.ignoreEvent.bindAsEventListener(this); element.onmousedown = this.singleClick.bindAsEventListener(this); // If we are operating on a corner span we need to store a // reference to the actual tab. (See comment about OL #57 fix above.) if (labelDiv) { element.labelElement = labelDiv; } },
_setEventHandlers : function(element) {
_setEventHandlers : function(element, labelDiv) {
_setEventHandlers : function(element) { // We only want to respond to a mousedown event. element.onclick = this.ignoreEvent.bindAsEventListener(this); element.ondblclick = this.ignoreEvent.bindAsEventListener(this); element.onmousedown = this.singleClick.bindAsEventListener(this); },
if (labelDiv) { element.labelElement = labelDiv; }
_setEventHandlers : function(element) { // We only want to respond to a mousedown event. element.onclick = this.ignoreEvent.bindAsEventListener(this); element.ondblclick = this.ignoreEvent.bindAsEventListener(this); element.onmousedown = this.singleClick.bindAsEventListener(this); },
if (tinyMCE.isMSIE && tinyMCE.settings['fix_content_duplication']) {
if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) {
_setHTML : function(doc, html_content) { // Force closed anchors open //html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>'); html_content = tinyMCE.cleanupHTMLCode(html_content); // Try innerHTML if it fails use pasteHTML in MSIE try { tinyMCE.setInnerHTML(doc.body, html_content); } catch (e) { if (this.isMSIE) doc.body.createTextRange().pasteHTML(html_content); } // Content duplication bug fix if (tinyMCE.isMSIE && tinyMCE.settings['fix_content_duplication']) { // Remove P elements in P elements var paras = doc.getElementsByTagName("P"); for (var i=0; i<paras.length; i++) { var node = paras[i]; while ((node = node.parentNode) != null) { if (node.nodeName == "P") node.outerHTML = node.innerHTML; } } // Content duplication bug fix (Seems to be word crap) var html = doc.body.innerHTML;/* if (html.indexOf('="mso') != -1) { for (var i=0; i<doc.body.all.length; i++) { var el = doc.body.all[i]; el.removeAttribute("className","",0); el.removeAttribute("style","",0); } html = doc.body.innerHTML; html = tinyMCE.regexpReplace(html, "<o:p><\/o:p>", "<br />"); html = tinyMCE.regexpReplace(html, "<o:p>&nbsp;<\/o:p>", ""); html = tinyMCE.regexpReplace(html, "<st1:.*?>", ""); html = tinyMCE.regexpReplace(html, "<p><\/p>", ""); html = tinyMCE.regexpReplace(html, "<p><\/p>\r\n<p><\/p>", ""); html = tinyMCE.regexpReplace(html, "<p>&nbsp;<\/p>", "<br />"); html = tinyMCE.regexpReplace(html, "<p>\s*(<p>\s*)?", "<p>"); html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "</p>"); }*/ // Always set the htmlText output tinyMCE.setInnerHTML(doc.body, html); } tinyMCE.cleanupAnchors(doc); if (tinyMCE.getParam("convert_fonts_to_spans")) tinyMCE.convertSpansToFonts(doc); },
this.frame.contentWindow.location.replace(location);
if (browserVersion.isSafari) { this.frame.src = location; } else { this.frame.contentWindow.location.replace(location); }
_setLocation: function(location) { this.frame.contentWindow.location.replace(location); },
var isChrome = browserVersion.isChrome || false; var isHTA = browserVersion.isHTA || false; location += "?thisIsChrome=" + isChrome + "&thisIsHTA=" + isHTA;
_setLocation: function(location) { if (browserVersion.isSafari) { // safari doesn't reload the page when the location equals to current location. // hence, set the location to blank so that the page will reload automatically. this.frame.src = "about:blank"; this.frame.src = location; } else { this.frame.contentWindow.location.replace(location); } },
this.frame.src = "about:blank";
_setLocation: function(location) { if (browserVersion.isSafari) { this.frame.src = location; } else { this.frame.contentWindow.location.replace(location); } },
this.addChildRemoveRuleStr(s.valid_child_elements);
_setupRules : function() { var s = this.settings; // Setup default rule if (!this.rulesDone) { this.addRuleStr(s.valid_elements); this.addRuleStr(s.extended_valid_elements); this.rulesDone = true; } },
if (tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
if (tinyMCE.hasPlugin('flash') && tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1)
_showContextMenu : function(e, inst) { function getAttrib(elm, name) { return elm.getAttribute(name) ? elm.getAttribute(name) : ""; } var x, y, elm, contextMenu; var pos = tinyMCE.getAbsPosition(inst.iframeElement); x = tinyMCE.isMSIE ? e.screenX : pos.absLeft + (e.pageX - inst.getBody().scrollLeft); y = tinyMCE.isMSIE ? e.screenY : pos.absTop + (e.pageY - inst.getBody().scrollTop); elm = tinyMCE.isMSIE ? e.srcElement : e.target; contextMenu = this._contextMenu; contextMenu.inst = inst; // Mozilla needs some time window.setTimeout(function () { var theme = tinyMCE.getParam("theme"); contextMenu.clearAll(); var sel = inst.selection.getSelectedText().length != 0 || elm.nodeName == "IMG"; // Default items contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_cut_desc", "Cut", "", !sel); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_copy_desc", "Copy", "", !sel); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_paste_desc", "Paste", "", false); if (sel || (elm ? (elm.nodeName == 'A') || (elm.nodeName == 'IMG') : false)) { contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/link.gif", "$lang_link_desc", inst.hasPlugin("advlink") ? "mceAdvLink" : "mceLink"); contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/unlink.gif", "$lang_unlink_desc", "unlink", "", (elm ? (elm.nodeName != 'A') && (elm.nodeName != 'IMG') : true)); } // Get element elm = tinyMCE.getParentElement(elm, "img,table,td" + (inst.hasPlugin("advhr") ? ',hr' : '')); if (elm) { switch (elm.nodeName) { case "IMG": contextMenu.addSeparator(); // If flash if (tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1) contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash"); else contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", inst.hasPlugin("advimage") ? "mceAdvImage" : "mceImage"); break; case "HR": contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/advhr/images/advhr.gif", "$lang_insert_advhr_desc", "mceAdvancedHr"); break; case "TABLE": case "TD": // Is table plugin loaded if (inst.hasPlugin("table")) { var colspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "colspan"); var rowspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "rowspan"); colspan = colspan == "" ? "1" : colspan; rowspan = rowspan == "" ? "1" : rowspan; contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_table_cut_row_desc", "mceTableCutRow"); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_table_copy_row_desc", "mceTableCopyRow"); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_before_desc", "mceTablePasteRowBefore", "", inst.tableRowClipboard == null); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_after_desc", "mceTablePasteRowAfter", "", inst.tableRowClipboard == null); /* contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyleft.gif", "$lang_justifyleft_desc", "JustifyLeft", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifycenter.gif", "$lang_justifycenter_desc", "JustifyCenter", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyright.gif", "$lang_justifyright_desc", "JustifyRight", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyfull.gif", "$lang_justifyfull_desc", "JustifyFull", "", false);*/ contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_props_desc", "mceInsertTable"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_cell_props.gif", "$lang_table_cell_desc", "mceTableCellProps"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete.gif", "$lang_table_del", "mceTableDelete"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_row_props.gif", "$lang_table_row_desc", "mceTableRowProps"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_before.gif", "$lang_table_row_before_desc", "mceTableInsertRowBefore"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_after.gif", "$lang_table_row_after_desc", "mceTableInsertRowAfter"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_row.gif", "$lang_table_delete_row_desc", "mceTableDeleteRow"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_before.gif", "$lang_table_col_before_desc", "mceTableInsertColBefore"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_after.gif", "$lang_table_col_after_desc", "mceTableInsertColAfter"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_col.gif", "$lang_table_delete_col_desc", "mceTableDeleteCol"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_split_cells.gif", "$lang_table_split_cells_desc", "mceTableSplitCells", "", (colspan == "1" && rowspan == "1")); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_merge_cells.gif", "$lang_table_merge_cells_desc", "mceTableMergeCells", "", false); } break; } } else { // Add table specific if (inst.hasPlugin("table")) { contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert"); } } contextMenu.show(x, y); }, 10); // Cancel default handeling tinyMCE.cancelEvent(e); return false; },
else if (tinyMCE.hasPlugin('media') && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(elm, 'class'))) contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_media_title", "mceMedia");
_showContextMenu : function(e, inst) { function getAttrib(elm, name) { return elm.getAttribute(name) ? elm.getAttribute(name) : ""; } var x, y, elm, contextMenu; var pos = tinyMCE.getAbsPosition(inst.iframeElement); x = tinyMCE.isMSIE ? e.screenX : pos.absLeft + (e.pageX - inst.getBody().scrollLeft); y = tinyMCE.isMSIE ? e.screenY : pos.absTop + (e.pageY - inst.getBody().scrollTop); elm = tinyMCE.isMSIE ? e.srcElement : e.target; contextMenu = this._contextMenu; contextMenu.inst = inst; // Mozilla needs some time window.setTimeout(function () { var theme = tinyMCE.getParam("theme"); contextMenu.clearAll(); var sel = inst.selection.getSelectedText().length != 0 || elm.nodeName == "IMG"; // Default items contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_cut_desc", "Cut", "", !sel); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_copy_desc", "Copy", "", !sel); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_paste_desc", "Paste", "", false); if (sel || (elm ? (elm.nodeName == 'A') || (elm.nodeName == 'IMG') : false)) { contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/link.gif", "$lang_link_desc", inst.hasPlugin("advlink") ? "mceAdvLink" : "mceLink"); contextMenu.addItem(tinyMCE.baseURL + "/themes/advanced/images/unlink.gif", "$lang_unlink_desc", "unlink", "", (elm ? (elm.nodeName != 'A') && (elm.nodeName != 'IMG') : true)); } // Get element elm = tinyMCE.getParentElement(elm, "img,table,td" + (inst.hasPlugin("advhr") ? ',hr' : '')); if (elm) { switch (elm.nodeName) { case "IMG": contextMenu.addSeparator(); // If flash if (tinyMCE.getAttrib(elm, 'class').indexOf('mceItemFlash') != -1) contextMenu.addItem(tinyMCE.baseURL + "/plugins/flash/images/flash.gif", "$lang_flash_props", "mceFlash"); else contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/image.gif", "$lang_image_props_desc", inst.hasPlugin("advimage") ? "mceAdvImage" : "mceImage"); break; case "HR": contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/advhr/images/advhr.gif", "$lang_insert_advhr_desc", "mceAdvancedHr"); break; case "TABLE": case "TD": // Is table plugin loaded if (inst.hasPlugin("table")) { var colspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "colspan"); var rowspan = (elm.nodeName == "TABLE") ? "" : getAttrib(elm, "rowspan"); colspan = colspan == "" ? "1" : colspan; rowspan = rowspan == "" ? "1" : rowspan; contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/cut.gif", "$lang_table_cut_row_desc", "mceTableCutRow"); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/copy.gif", "$lang_table_copy_row_desc", "mceTableCopyRow"); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_before_desc", "mceTablePasteRowBefore", "", inst.tableRowClipboard == null); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/paste.gif", "$lang_table_paste_row_after_desc", "mceTablePasteRowAfter", "", inst.tableRowClipboard == null); /* contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyleft.gif", "$lang_justifyleft_desc", "JustifyLeft", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifycenter.gif", "$lang_justifycenter_desc", "JustifyCenter", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyright.gif", "$lang_justifyright_desc", "JustifyRight", "", false); contextMenu.addItem(tinyMCE.baseURL + "/themes/" + theme + "/images/justifyfull.gif", "$lang_justifyfull_desc", "JustifyFull", "", false);*/ contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_props_desc", "mceInsertTable"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_cell_props.gif", "$lang_table_cell_desc", "mceTableCellProps"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete.gif", "$lang_table_del", "mceTableDelete"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_row_props.gif", "$lang_table_row_desc", "mceTableRowProps"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_before.gif", "$lang_table_row_before_desc", "mceTableInsertRowBefore"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_row_after.gif", "$lang_table_row_after_desc", "mceTableInsertRowAfter"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_row.gif", "$lang_table_delete_row_desc", "mceTableDeleteRow"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_before.gif", "$lang_table_col_before_desc", "mceTableInsertColBefore"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_insert_col_after.gif", "$lang_table_col_after_desc", "mceTableInsertColAfter"); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_delete_col.gif", "$lang_table_delete_col_desc", "mceTableDeleteCol"); contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_split_cells.gif", "$lang_table_split_cells_desc", "mceTableSplitCells", "", (colspan == "1" && rowspan == "1")); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table_merge_cells.gif", "$lang_table_merge_cells_desc", "mceTableMergeCells", "", false); } break; } } else { // Add table specific if (inst.hasPlugin("table")) { contextMenu.addSeparator(); contextMenu.addItem(tinyMCE.baseURL + "/plugins/table/images/table.gif", "$lang_table_desc", "mceInsertTable", "insert"); } } contextMenu.show(x, y); }, 10); // Cancel default handeling tinyMCE.cancelEvent(e); return false; },
var item=menu.f_appendItem(menu, "_result"+i, "-- Tous les résultats ne sont pas affichés --");
var message=f_resourceBundle.Get(f_suggestTextEntry).f_get("MORE_RELEVANT_RESULTS"); var item=menu.f_appendItem(menu, "_result"+i, message);
_showPopup: function(autoSelect) { var menu=this.f_getSubMenuById(f_suggestTextEntry._SUGGESTION_MENU_ID); if (!menu) { return; } if (menu.f_isOpened()) { menu.f_close(); } menu.f_removeAllItems(menu); var results=new Array; var complete=this._filterProposals(results); if (results.length<1) { return; } var i; for(i=0;i<results.length;i++) { var result=results[i]; var label=result._label; var description=result._description; if (description) { label+=description; } var item=menu.f_appendItem(menu, "_result"+i, label, result); var imageURL=result._imageURL; if (imageURL) { menu._setItemImages(item, imageURL); } } if (!complete) { var item=menu.f_appendItem(menu, "_result"+i, "-- Tous les résultats ne sont pas affichés --"); menu.f_setItemDisabled(item, true); } var params={ position: f_menu.BOTTOM_COMPONENT, size: f_menu.WIDTH_COMPONENT }; if (!f_core.IsInternetExplorer()) { // Probleme de box modele !// params.deltaX=-1; params.deltaY=-1; params.deltaWidth=-4; } menu.f_open(this, params, null, null, autoSelect);// this.focus(); },
this.getCurrentRow().loadTestCase(htmlTestRunner.startTest);
this.getCurrentRow().loadTestCase(htmlTestRunner.startTest.bind(htmlTestRunner));
_startCurrentTestCase: function() { this.getCurrentRow().markWorking(); this.getCurrentRow().loadTestCase(htmlTestRunner.startTest); },
this.getCurrentRow().loadTestCase(htmlTestRunner.startTest.bind(htmlTestRunner));
this.getCurrentRow().loadTestCase(fnBind(htmlTestRunner.startTest, htmlTestRunner));
_startCurrentTestCase: function() { this.getCurrentRow().loadTestCase(htmlTestRunner.startTest.bind(htmlTestRunner)); },
removeLoadListener(getApplicationWindow(), this._startSingleTest.bind(this));
removeLoadListener(getApplicationWindow(), fnBind(this._startSingleTest, this));
_startSingleTest:function () { removeLoadListener(getApplicationWindow(), this._startSingleTest.bind(this)); var singleTestName = this.controlPanel.getSingleTestName(); testFrame.load(singleTestName, this.startTest.bind(this)); },
testFrame.load(singleTestName, this.startTest.bind(this));
testFrame.load(singleTestName, fnBind(this.startTest, this));
_startSingleTest:function () { removeLoadListener(getApplicationWindow(), this._startSingleTest.bind(this)); var singleTestName = this.controlPanel.getSingleTestName(); testFrame.load(singleTestName, this.startTest.bind(this)); },
tinyMCE.importPluginLanguagePack('style','en');var TinyMCE_StylePlugin={getInfo:function(){return{longname:'Style',author:'Moxiecode Systems',authorurl:'http:
tinyMCE.importPluginLanguagePack('style');var TinyMCE_StylePlugin={getInfo:function(){return{longname:'Style',author:'Moxiecode Systems AB',authorurl:'http:
tinyMCE.importPluginLanguagePack('style','en');var TinyMCE_StylePlugin={getInfo:function(){return{longname:'Style',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_style.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},getControlHTML:function(cn){switch(cn){case"styleprops":return tinyMCE.getButtonHTML(cn,'lang_style_styleinfo_desc','{$pluginurl}/images/style_info.gif','mceStyleProps',true);}return"";},execCommand:function(editor_id,element,command,user_interface,value){var e,inst;switch(command){case"mceStyleProps":TinyMCE_StylePlugin._styleProps();return true;case"mceSetElementStyle":inst=tinyMCE.getInstanceById(editor_id);e=inst.selection.getFocusElement();if(e){e.style.cssText=value;inst.repaint();}return true;}return false;},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){},_styleProps:function(){var e=tinyMCE.selectedInstance.selection.getFocusElement();if(!e)return;tinyMCE.openWindow({file:'../../plugins/style/props.htm',width:480+tinyMCE.getLang('lang_style_props_delta_width',0),height:320+tinyMCE.getLang('lang_style_props_delta_height',0)},{editor_id:tinyMCE.selectedInstance.editorId,inline:"yes",style_text:e.style.cssText});}};tinyMCE.addPlugin("style",TinyMCE_StylePlugin);
this.pauseButton.onclick = this.pauseCurrentTest.bindAsEventListener(this);
this.pauseButton.onclick = fnBindAsEventListener(this.pauseCurrentTest, this);
_switchContinueButtonToPause: function() { this.pauseButton.className = "cssPauseTest"; this.pauseButton.onclick = this.pauseCurrentTest.bindAsEventListener(this); },
this.pauseButton.onclick = this.continueCurrentTest.bindAsEventListener(this);
this.pauseButton.onclick = fnBindAsEventListener(this.continueCurrentTest, this);
_switchPauseButtonToContinue: function() { $('stepTest').disabled = false; this.pauseButton.className = "cssContinueTest"; this.pauseButton.onclick = this.continueCurrentTest.bindAsEventListener(this); },
return f_core.CancelEvent(evt); } if (!dataGrid._columnCanBeSorted) {
_Title_onMouseDown: function(evt) { var column=this._column; var dataGrid=column._dataGrid; if (dataGrid.f_getEventLocked()) { return false; } if (!evt) { evt = window.event; } if (dataGrid.f_isDisabled()) { return f_core.CancelEvent(evt); } var sub=f_core.IsPopupButton(evt); if (sub) { var menu=dataGrid.f_getSubMenuById(f_dataGrid._HEAD_MENU_ID); if (menu) { menu.f_open(this, { position: f_menu.MOUSE_POSITION }, dataGrid, evt); } return f_core.CancelEvent(evt); } dataGrid._columnSelected=column; dataGrid._updateTitleStyle(column); return true; },
if (dataGrid.f_isDisabled()) { return f_core.CancelEvent(evt);
if (dataGrid.f_isDisabled() || !dataGrid._columnCanBeSorted) { return false;
_Title_onMouseOut: function(evt) { if (!evt) { evt = window.event; } // En drag ? if (window._dragColumn) { return false; } var column=this._column; var dataGrid=column._dataGrid; if (dataGrid.f_isDisabled()) { return f_core.CancelEvent(evt); } if (dataGrid._columnSelected==column) { dataGrid._columnSelected=null; } if (dataGrid._columnOver!=column) { return true; } dataGrid._columnOver=null; dataGrid._updateTitleStyle(column); },
if (dataGrid.f_getEventLocked(false)) {
if (dataGrid.f_getEventLocked(false) || !dataGrid._columnCanBeSorted) {
_Title_onMouseOver: function(evt) { var column=this._column; var dataGrid=column._dataGrid; if (dataGrid.f_getEventLocked(false)) { return false; } if (!evt) { evt = window.event; } // En drag ? if (window._dragColumn) { return false; } if (dataGrid.f_isDisabled()) { return f_core.CancelEvent(evt); } if (dataGrid._columnOver==column) { return true; } var oldColumn=dataGrid._columnOver; dataGrid._columnOver=column; if (oldColumn) { dataGrid._updateTitleStyle(oldColumn); } dataGrid._updateTitleStyle(column); },
if (dataGrid.f_isDisabled()) {
if (dataGrid.f_isDisabled() || !dataGrid._columnCanBeSorted) {
_Title_onMouseUp: function(evt) { var column=this._column; var dataGrid=column._dataGrid; if (dataGrid.f_getEventLocked(false)) { return false; } if (!evt) { evt = window.event; } if (dataGrid.f_isDisabled()) { return f_core.CancelEvent(evt); } var oldColumn=dataGrid._columnSelected; if (!oldColumn) { return f_core.CancelEvent(evt); } dataGrid._columnSelected=undefined; if (oldColumn!=column) { if (oldColumn) { dataGrid._updateTitleStyle(oldColumn); } return true; } dataGrid.f_sortColumn(column); return true; },
var inst = tinyMCE.selectedInstance, self = TinyMCE_LayerPlugin; var le = self._getParentLayer(inst.getFocusElement());
var inst = tinyMCE.selectedInstance; var le = this._getParentLayer(inst.getFocusElement());
_toggleAbsolute : function() { var inst = tinyMCE.selectedInstance, self = TinyMCE_LayerPlugin; var le = self._getParentLayer(inst.getFocusElement()); if (le == null) le = tinyMCE.getParentElement(inst.getFocusElement(), 'div,p,img'); if (le) { if (le.style.position.toLowerCase() == "absolute") { le.style.position = ""; le.style.left = ""; le.style.top = ""; } else { le.style.position = "absolute"; if (le.style.left == "") le.style.left = 20 + 'px'; if (le.style.top == "") le.style.top = 20 + 'px'; if (le.style.width == "") le.style.width = le.width ? (le.width + 'px') : '100px'; if (le.style.height == "") le.style.height = le.height ? (le.height + 'px') : '100px'; tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst); } inst.repaint(); tinyMCE.triggerNodeChange(); } }
}
},
_toHTML: function(txt) { return txt.escapeHTML().replace(/\n/g,"<br/>"); }
if (attributeValue && attribute.specified)
if (attributeValue && (attribute.specified || attribute.nodeName == 'value'))
function _XPathMsxmlDocumentHelper() { this.getDom = function() { activateDom(this); return this.dom; } this.getXml = function() { activateDom(this); return this.dom.xml; } this.getTextResult = function(expression) { expression = expression.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "\""); var xslText = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + "<xsl:output method=\"text\"/><xsl:template match=\"*\"><xsl:value-of select=\"" + expression + "\"/>" + "</xsl:template></xsl:stylesheet>"; var xsl = new ActiveXObject("Msxml2.DOMDocument"); xsl.loadXML(xslText); try { var result = this.getDom().transformNode(xsl); } catch(error) { alert("Error: " + error.description); } return result; } this.reset = function() { this.dom = null; } function onPropertyChangeEventHandler() { document._propertyChangeDetected = true; } this.documentChangeDetected = function() { return (document.ignoreDocumentChanges ? false : this._currentElementCount != document.all.length || document._propertyChangeDetected); } function activateDom(helper) { if (!helper.dom) { var dom = new ActiveXObject("Msxml2.DOMDocument");/** SELENIUM:PATCH TO ALLOW PROVIDE FULL XPATH SUPPORT */ dom.setProperty("SelectionLanguage", "XPath");/** END SELENIUM:PATCH */ dom.async = false; dom.resolveExternals = false; loadDocument(dom, helper); helper.dom = dom; helper._currentElementCount = document.all.length; document._propertyChangeDetected = false; } else { if (helper.documentChangeDetected()) { var dom = helper.dom; dom.load(""); loadDocument(dom, helper); helper._currentElementCount = document.all.length; document._propertyChangeDetected = false; } } } function loadDocument(dom, helper) { return loadNode(dom, dom, document.body, helper); } /** SELENIUM:PATCH for loadNode() - see SEL-68 */ function loadNode(dom, domParentNode, node, helper) { // Bad node scenarios // 1. If the node contains a /, it's broken HTML // 2. If the node doesn't have a name (typically from broken HTML), the node can't be loaded // 3. Node types we can't deal with // // In all scenarios, we just skip the node. We won't be able to // query on these nodes, but they're broken anyway. if (node.nodeName.indexOf("/") > -1 || node.nodeName == "" || node.nodeName == "#document" || node.nodeName == "#document-fragment" || node.nodeName == "#cdata-section" || node.nodeName == "#xml-declaration" || node.nodeName == "#whitespace" || node.nodeName == "#significat-whitespace" ) { return; } // #comment is a <!-- comment -->, which must be created with createComment() if (node.nodeName == "#comment") { try { domParentNode.appendChild(dom.createComment(node.nodeValue)); } catch (ex) { // it's just a comment, we don't care } } else if (node.nodeType == 3) { domParentNode.appendChild(dom.createTextNode(node.nodeValue)); } else { var domNode = dom.createElement(node.nodeName.toLowerCase()); if (!node.id) { node.id = node.uniqueID; } domParentNode.appendChild(domNode); loadAttributes(dom, domNode, node); var length = node.childNodes.length; for(var i = 0; i < length; i ++ ) { loadNode(dom, domNode, node.childNodes[i], helper); } node.attachEvent("onpropertychange", onPropertyChangeEventHandler); } }/** END SELENIUM:PATCH */ function loadAttributes(dom, domParentNode, node) { for (var i = 0; i < node.attributes.length; i ++ ) { var attribute = node.attributes[i]; var attributeValue = attribute.nodeValue; if (attributeValue && attribute.specified) { var domAttribute = dom.createAttribute(attribute.nodeName); domAttribute.value = attributeValue; domParentNode.setAttributeNode(domAttribute); } } } }
if (node.nodeType == 3) {
if (node.nodeName.indexOf("/") > -1 || node.nodeName == "" || node.nodeName == "#document" || node.nodeName == "#document-fragment" || node.nodeName == "#cdata-section" || node.nodeName == "#xml-declaration" || node.nodeName == "#whitespace" || node.nodeName == "#significat-whitespace" ) { return; } if (node.nodeName == "#comment") { try { domParentNode.appendChild(dom.createComment(node.nodeValue)); } catch (ex) { } } else if (node.nodeType == 3) {
function _XPathMsxmlDocumentHelper() { this.getDom = function() { activateDom(this); return this.dom; } this.getXml = function() { activateDom(this); return this.dom.xml; } this.getTextResult = function(expression) { expression = expression.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "\""); var xslText = "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + "<xsl:output method=\"text\"/><xsl:template match=\"*\"><xsl:value-of select=\"" + expression + "\"/>" + "</xsl:template></xsl:stylesheet>"; var xsl = new ActiveXObject("Msxml2.DOMDocument"); xsl.loadXML(xslText); try { var result = this.getDom().transformNode(xsl); } catch(error) { alert("Error: " + error.description); } return result; } this.reset = function() { this.dom = null; } function onPropertyChangeEventHandler() { document._propertyChangeDetected = true; } this.documentChangeDetected = function() { return (document.ignoreDocumentChanges ? false : this._currentElementCount != document.all.length || document._propertyChangeDetected); } function activateDom(helper) { if (!helper.dom) { var dom = new ActiveXObject("Msxml2.DOMDocument");/** SELENIUM:PATCH TO ALLOW PROVIDE FULL XPATH SUPPORT */ dom.setProperty("SelectionLanguage", "XPath");/** END SELENIUM:PATCH */ dom.async = false; dom.resolveExternals = false; loadDocument(dom, helper); helper.dom = dom; helper._currentElementCount = document.all.length; document._propertyChangeDetected = false; } else { if (helper.documentChangeDetected()) { var dom = helper.dom; dom.load(""); loadDocument(dom, helper); helper._currentElementCount = document.all.length; document._propertyChangeDetected = false; } } } function loadDocument(dom, helper) { return loadNode(dom, dom, document.body, helper); } function loadNode(dom, domParentNode, node, helper) { if (node.nodeType == 3) { domParentNode.appendChild(dom.createTextNode(node.nodeValue)); } else { var domNode = dom.createElement(node.nodeName.toLowerCase()); if (!node.id) { node.id = node.uniqueID; } domParentNode.appendChild(domNode); loadAttributes(dom, domNode, node); var length = node.childNodes.length; for(var i = 0; i < length; i ++ ) { loadNode(dom, domNode, node.childNodes[i], helper); } node.attachEvent("onpropertychange", onPropertyChangeEventHandler); } } function loadAttributes(dom, domParentNode, node) { for (var i = 0; i < node.attributes.length; i ++ ) { var attribute = node.attributes[i]; var attributeValue = attribute.nodeValue; if (attributeValue && attribute.specified) { var domAttribute = dom.createAttribute(attribute.nodeName); domAttribute.value = attributeValue; domParentNode.setAttributeNode(domAttribute); } } } }
baseUrl = baseUrl.replace(/[\?\#].*/, "");
function absolutify(url, baseUrl) { /** returns a relative url in its absolute form, given by baseUrl. * * This function is a little odd, because it can take baseUrls that * aren't necessarily directories. It uses the same rules as the HTML * &lt;base&gt; tag; if the baseUrl doesn't end with "/", we'll assume * that it points to a file, and strip the filename off to find its * base directory. * * So absolutify("foo", "http://x/bar") will return "http://x/foo" (stripping off bar), * whereas absolutify("foo", "http://x/bar/") will return "http://x/bar/foo" (preserving bar). * Naturally absolutify("foo", "http://x") will return "http://x/foo", appropriately. * * @param url the url to make absolute; if this url is already absolute, we'll just return that, unchanged * @param baseUrl the baseUrl from which we'll absolutify, following the rules above. * @return 'url' if it was already absolute, or the absolutized version of url if it was not absolute. */ // DGF isn't there some library we could use for this? if (/^\w+:/.test(url)) { // it's already absolute return url; } var scheme; var schemepart; // is it absolute? what's the URL scheme? if (!/^(\w+):\/\/(.*)/.test(baseUrl)) { // is it an absolute windows file path? let's play the hero in that case if (/^\w:\\/.test(baseUrl)) { scheme = "file"; schemepart = "/" + baseUrl.replace(/\\/g, "/"); baseUrl = "file://" + schemepart; } else { throw new SeleniumError("baseUrl wasn't absolute: " + baseUrl); } } else { scheme = RegExp.$1; schemepart = RegExp.$2; } if (scheme != "http" && scheme != "file") { // What? would you have me absolutify a javascript: URL? What does that even mean??? throw new SeleniumError("We can only absolutify URLs that start with 'http' or 'file': " + baseUrl); } // for windows, replace backslashes with forward slashes url = url.replace(/\\/g, "/"); // if baseUrl ends with /, just append url if (/\/$/.test(baseUrl)) { return baseUrl + url; } // if schemepart doesn't contain a /, then it only contains a login/hostname // so we'll just append "/" + the url if (!/\//.test(schemepart)) { return baseUrl + "/" + url; } // if we're here, then the scheme part contains a /, but doesn't end with / // in that case, we replace everything after the final / with the relative url var result = baseUrl.replace(/[^\/\\]+$/, url); return result; }
if (/^\ var loginHostName = schemepart.replace(/\/(.*)/, ""); return scheme + ": }
function absolutify(url, baseUrl) { /** returns a relative url in its absolute form, given by baseUrl. * * This function is a little odd, because it can take baseUrls that * aren't necessarily directories. It uses the same rules as the HTML * &lt;base&gt; tag; if the baseUrl doesn't end with "/", we'll assume * that it points to a file, and strip the filename off to find its * base directory. * * So absolutify("foo", "http://x/bar") will return "http://x/foo" (stripping off bar), * whereas absolutify("foo", "http://x/bar/") will return "http://x/bar/foo" (preserving bar). * Naturally absolutify("foo", "http://x") will return "http://x/foo", appropriately. * * @param url the url to make absolute; if this url is already absolute, we'll just return that, unchanged * @param baseUrl the baseUrl from which we'll absolutify, following the rules above. * @return 'url' if it was already absolute, or the absolutized version of url if it was not absolute. */ // DGF isn't there some library we could use for this? if (/^\w+:/.test(url)) { // it's already absolute return url; } baseUrl = baseUrl.replace(/[\?\#].*/, ""); var scheme; var schemepart; // is it absolute? what's the URL scheme? if (!/^(\w+):\/\/(.*)/.test(baseUrl)) { // is it an absolute windows file path? let's play the hero in that case if (/^\w:\\/.test(baseUrl)) { scheme = "file"; schemepart = "/" + baseUrl.replace(/\\/g, "/"); baseUrl = "file://" + schemepart; } else { throw new SeleniumError("baseUrl wasn't absolute: " + baseUrl); } } else { scheme = RegExp.$1; schemepart = RegExp.$2; } if (scheme != "http" && scheme != "file") { // What? would you have me absolutify a javascript: URL? What does that even mean??? throw new SeleniumError("We can only absolutify URLs that start with 'http' or 'file': " + baseUrl); } // for windows, replace backslashes with forward slashes url = url.replace(/\\/g, "/"); // if baseUrl ends with /, just append url if (/\/$/.test(baseUrl)) { return baseUrl + url; } // if schemepart doesn't contain a /, then it only contains a login/hostname // so we'll just append "/" + the url if (!/\//.test(schemepart)) { return baseUrl + "/" + url; } // if we're here, then the scheme part contains a /, but doesn't end with / // in that case, we replace everything after the final / with the relative url var result = baseUrl.replace(/[^\/\\]+$/, url); return result; }
var offsets = Position.cumulativeOffset(element);
var offsets = Position.positionedOffset(element);
Position.absolutize = function(element) { element = $(element); if(element.style.position=='absolute') return; Position.prepare(); var offsets = Position.cumulativeOffset(element); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px';; element.style.left = left + 'px';; element.style.width = width + 'px';; element.style.height = height + 'px';;}
CommandHandler.call("accessor", true, accessor);
CommandHandler.call(this, "accessor", true, accessor);
function AccessorHandler(accessor) { CommandHandler.call("accessor", true, accessor);}
this.max = 15;
function ACDB(uri) { this.uri = uri; this.max = 15; this.delay = 300; this.cache = {};}
function action_area_generate_search_field(field, caption, is_first, is_last) {
function action_area_generate_search_field(field, caption, is_first, is_last, width) {
function action_area_generate_search_field(field, caption, is_first, is_last) { _elm_dt_container = document.createElement('div'); if (is_first == true) { _elm_dt_container.style.paddingTop = '1px'; }else{ _elm_dt_container.style.paddingTop = '3px'; } _elm_dt_container.style.paddingBottom = '3px'; /* container for the caption */ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption)); _elm_dt_container.appendChild(_elm_dt_container_txt); /* container for the actual field object */ _elm_dt_container_fld = document.createElement('div'); _elm_dt_container_fld.style.paddingLeft = '10px'; _elm_dt_container_fld.appendChild(field); _elm_dt_container.appendChild(_elm_dt_container_fld); if (is_last == false) { _elm_dt_container.style.borderBottom = '1px solid #f1f1f1'; } return _elm_dt_container;}
_elm_dt_container.style.width = width;
function action_area_generate_search_field(field, caption, is_first, is_last) { _elm_dt_container = document.createElement('div'); if (is_first == true) { _elm_dt_container.style.paddingTop = '1px'; }else{ _elm_dt_container.style.paddingTop = '3px'; } _elm_dt_container.style.paddingBottom = '3px'; /* container for the caption */ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption)); _elm_dt_container.appendChild(_elm_dt_container_txt); /* container for the actual field object */ _elm_dt_container_fld = document.createElement('div'); _elm_dt_container_fld.style.paddingLeft = '10px'; _elm_dt_container_fld.appendChild(field); _elm_dt_container.appendChild(_elm_dt_container_fld); if (is_last == false) { _elm_dt_container.style.borderBottom = '1px solid #f1f1f1'; } return _elm_dt_container;}
function action_area_generate_text_field(field, caption, is_first, is_last, is_split) {
function action_area_generate_text_field(field, caption, is_first, is_last, is_split, width) {
function action_area_generate_text_field(field, caption, is_first, is_last, is_split) { _elm_dt_container = document.createElement('div'); if (is_first == true) { _elm_dt_container.style.paddingTop = '1px'; }else{ _elm_dt_container.style.paddingTop = '3px'; } _elm_dt_container.style.paddingBottom = '3px'; if (is_split) { /* container for the caption */ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption)); _elm_dt_container.appendChild(_elm_dt_container_txt); /* container for the actual field */ _elm_dt_container_fld = document.createElement('div'); _elm_dt_container_fld.style.paddingLeft = '10px'; _elm_dt_container_fld.appendChild(document.createTextNode(field)); _elm_dt_container.appendChild(_elm_dt_container_fld); }else{ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption + ' ' + field)); _elm_dt_container.appendChild(_elm_dt_container_txt); } if (is_last == false) { _elm_dt_container.style.borderBottom = '1px solid #f1f1f1'; } return _elm_dt_container;}
_elm_dt_container.style.width = width;
function action_area_generate_text_field(field, caption, is_first, is_last, is_split) { _elm_dt_container = document.createElement('div'); if (is_first == true) { _elm_dt_container.style.paddingTop = '1px'; }else{ _elm_dt_container.style.paddingTop = '3px'; } _elm_dt_container.style.paddingBottom = '3px'; if (is_split) { /* container for the caption */ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption)); _elm_dt_container.appendChild(_elm_dt_container_txt); /* container for the actual field */ _elm_dt_container_fld = document.createElement('div'); _elm_dt_container_fld.style.paddingLeft = '10px'; _elm_dt_container_fld.appendChild(document.createTextNode(field)); _elm_dt_container.appendChild(_elm_dt_container_fld); }else{ _elm_dt_container_txt = document.createElement('div'); _elm_dt_container_txt.style.paddingBottom = '5px'; _elm_dt_container_txt.appendChild(document.createTextNode(caption + ' ' + field)); _elm_dt_container.appendChild(_elm_dt_container_txt); } if (is_last == false) { _elm_dt_container.style.borderBottom = '1px solid #f1f1f1'; } return _elm_dt_container;}
_txt_list_text = document.createTextNode(document.getElementById('box-' + box_id + '-text' + parent_form.elements[i].name.substr(box_id.length + 8)).innerHTML);
_txt_list_text = document.createTextNode(strip_html_tags(document.getElementById('box-' + box_id + '-text' + parent_form.elements[i].name.substr(box_id.length + 8)).innerHTML));
function action_area_update_selected_rows(box_id, parent_form) { if (_elm_selected_rows[box_id]) { _elm_selected_rows[box_id].innerHTML = ''; for (var i = 0; i < parent_form.elements.length; i++) { if ((parent_form.elements[i].name.substr(0, box_id.length + 8) == 'box-' + box_id + '-chk') && (parent_form.elements[i].checked == true)) { _elm_list_item = document.createElement('li'); _txt_list_text = document.createTextNode(document.getElementById('box-' + box_id + '-text' + parent_form.elements[i].name.substr(box_id.length + 8)).innerHTML); _elm_list_item.appendChild(_txt_list_text); _elm_selected_rows[box_id].appendChild(_elm_list_item); } } } /* force browser to re-adjust div heights */ document.getElementById('box-' + box_id + '-action-area-items').style.height = 'auto'; document.getElementById('box-' + box_id + '-action-area-menu').style.height = 'auto';}
document.getElementById('box-' + box_id + '-action-area-items').style.height = 'auto'; document.getElementById('box-' + box_id + '-action-area-menu').style.height = 'auto';
function action_area_update_selected_rows(box_id, parent_form) { if (_elm_selected_rows[box_id]) { _elm_selected_rows[box_id].innerHTML = ''; for (var i = 0; i < parent_form.elements.length; i++) { if ((parent_form.elements[i].name.substr(0, box_id.length + 8) == 'box-' + box_id + '-chk') && (parent_form.elements[i].checked == true)) { _elm_list_item = document.createElement('li'); _txt_list_text = document.createTextNode(document.getElementById('box-' + box_id + '-text' + parent_form.elements[i].name.substr(box_id.length + 8)).innerHTML); _elm_list_item.appendChild(_txt_list_text); _elm_selected_rows[box_id].appendChild(_elm_list_item); } } }}
if(drop.hoverclass) {
if(drop.hoverclass)
activate: function(drop) { if(this.last_active) this.deactivate(this.last_active); if(drop.hoverclass) { Element.Class.add(drop.element, drop.hoverclass); this.last_active = drop; } },
this.last_active = drop; }
this.last_active = drop;
activate: function(drop) { if(this.last_active) this.deactivate(this.last_active); if(drop.hoverclass) { Element.Class.add(drop.element, drop.hoverclass); this.last_active = drop; } },