// Opera specific code // initialize SpawEditor.prototype.initialize = function() { this.document = document; if (!this.document) { setTimeout(this.name+'_obj.initialize();',50); return; } for(var i=0; i0) { var rng = sel.getRangeAt(0); var ancestor = rng.commonAncestorContainer; this._in_selection = false; this.selectionNodeWalk(ancestor, rng, func); } } SpawEditor.prototype._in_selection; SpawEditor.prototype.selectionNodeWalk = function(node, rng, func) { if (this._in_selection || rng.startContainer == node || rng.endContainer == node) { func(node, (rng.startContainer == node)?rng.startOffset:null, (rng.endContainer == node)?rng.endOffset:null); this._in_selection = (rng.endContainer != node); } if (node.childNodes && node.childNodes.length>0) { for (var i=0; i 0) // something selected { if (spn.innerHTML != pnode.innerHTML || pnode.tagName.toLowerCase() == "body") // this is a new snippet, set class on it this.insertNodeAtSelection(spn); else // change class { if (cssClass != '') pnode.className = cssClass; if (styleName != '') pnode.style[styleName] = styleValue; } } else // nothing is select, set class on the parent { if (pnode.tagName.toLowerCase() != "body") // there's a parent, set class on it { if (cssClass != '') pnode.className = cssClass; if (styleName != '') pnode.style[styleName] = styleValue; } else { spn.innerHTML = pnode.innerHTML; pnode.innerHTML = ''; pnode.appendChild(spn); } } } } } // removes style from selection SpawEditor.prototype.removeStyleFromSelection = function(cssClass, styleName) { this.focus(); var pnode = this.getSelectionParent(); if (cssClass) { while(pnode && pnode.tagName.toLowerCase() != "body" && (!pnode.className || pnode.className == "")) { pnode = pnode.parentNode; } if (pnode && pnode.tagName.toLowerCase() != "body") { pnode.removeAttribute("class"); pnode.removeAttribute("className"); } } if (styleName) { while(pnode && pnode.tagName.toLowerCase() != "body" && !pnode.style[styleName]) { pnode = pnode.parentNode; } if (pnode && pnode.tagName.toLowerCase() != "body") { pnode.style[styleName] = ''; } } } x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586