diff --git a/common/lib/xmodule/xmodule/js/fixtures/rubric.html b/common/lib/xmodule/xmodule/js/fixtures/rubric.html index 76ad59b8ff22b934bff62a78769e8a113425f04a..b869bb1ec4808749cbce0f0f860d4e1d0a834afb 100644 --- a/common/lib/xmodule/xmodule/js/fixtures/rubric.html +++ b/common/lib/xmodule/xmodule/js/fixtures/rubric.html @@ -38,7 +38,7 @@ <div class="visibility-control visibility-control-prompt"> <div class="inner"> </div> - <a href="" class="question-header">Show Prompt</a> + <a href="" class="question-header">Show Question</a> </div> <div class="problem-container"> <div class="item"> diff --git a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee index d1a7b4d816272ad81108cdbcfc988378d6ffdde2..d1006ae9a9b119305b77ae32cadbe4d71fd3c290 100644 --- a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee @@ -576,12 +576,12 @@ class @CombinedOpenEnded collapse_question: (event) => @prompt_container.slideToggle() @prompt_container.toggleClass('open') - if @question_header.text() == "Hide Prompt" - new_text = "Show Prompt" + if @question_header.text() == "Hide Question" + new_text = "Show Question" Logger.log 'oe_hide_question', {location: @location} else Logger.log 'oe_show_question', {location: @location} - new_text = "Hide Prompt" + new_text = "Hide Question" @question_header.text(new_text) return false @@ -621,13 +621,13 @@ class @CombinedOpenEnded if @prompt_container.is(":hidden")==true @prompt_container.slideToggle() @prompt_container.toggleClass('open') - @question_header.text("Hide Prompt") + @question_header.text("Hide Question") prompt_hide: () => if @prompt_container.is(":visible")==true @prompt_container.slideToggle() @prompt_container.toggleClass('open') - @question_header.text("Show Prompt") + @question_header.text("Show Question") log_feedback_click: (event) -> link_text = @$(event.target).html() diff --git a/common/lib/xmodule/xmodule/js/src/peergrading/ice.min.js b/common/lib/xmodule/xmodule/js/src/peergrading/ice.min.js index 7b83d82298dfd1b6b48ab0cfc232186d4859aad4..16a08c2c6ff053a73eb3055c72c94c823d897682 100644 --- a/common/lib/xmodule/xmodule/js/src/peergrading/ice.min.js +++ b/common/lib/xmodule/xmodule/js/src/peergrading/ice.min.js @@ -1,224 +1,9 @@ -window.rangy=function(){function e(a,d){var b=typeof a[d];return b==t||!!(b==l&&a[d])||b=="unknown"}function b(a,d){return!!(typeof a[d]==l&&a[d])}function a(a,d){return typeof a[d]!=n}function d(a){return function(d,b){for(var f=b.length;f--;)if(!a(d,b[f]))return!1;return!0}}function f(a){return a&&j(a,r)&&v(a,k)}function g(a){window.alert("Rangy not supported in your browser. Reason: "+a);p.initialized=!0;p.supported=!1}function h(){if(!p.initialized){var a,d=!1,q=!1;e(document,"createRange")&& -(a=document.createRange(),j(a,o)&&v(a,s)&&(d=!0),a.detach());if((a=b(document,"body")?document.body:document.getElementsByTagName("body")[0])&&e(a,"createTextRange"))a=a.createTextRange(),f(a)&&(q=!0);!d&&!q&&g("Neither Range nor TextRange are implemented");p.initialized=!0;p.features={implementsDomRange:d,implementsTextRange:q};d=F.concat(x);q=0;for(a=d.length;q<a;++q)try{d[q](p)}catch(h){b(window,"console")&&e(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.", -h)}}}function i(a){this.name=a;this.supported=this.initialized=!1}var l="object",t="function",n="undefined",s=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"],o=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents", -"cloneRange","toString","detach"],k=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],r=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint","getBoundingClientRect"],j=d(e),q=d(b),v=d(a),p={version:"1.2",initialized:!1,supported:!0,util:{isHostMethod:e,isHostObject:b,isHostProperty:a,areHostMethods:j,areHostObjects:q,areHostProperties:v,isTextRange:f},features:{},modules:{}, -config:{alertOnWarn:!1,preferTextRange:!1}};p.fail=g;p.warn=function(a){a="Rangy warning: "+a;p.config.alertOnWarn?window.alert(a):typeof window.console!=n&&typeof window.console.log!=n&&window.console.log(a)};({}).hasOwnProperty?p.util.extend=function(a,d){for(var b in d)d.hasOwnProperty(b)&&(a[b]=d[b])}:g("hasOwnProperty not supported");var x=[],F=[];p.init=h;p.addInitListener=function(a){p.initialized?a(p):x.push(a)};var B=[];p.addCreateMissingNativeApiListener=function(a){B.push(a)};p.createMissingNativeApi= -function(a){a=a||window;h();for(var d=0,b=B.length;d<b;++d)B[d](a)};i.prototype.fail=function(a){this.initialized=!0;this.supported=!1;throw Error("Module '"+this.name+"' failed to load: "+a);};i.prototype.warn=function(a){p.warn("Module "+this.name+": "+a)};i.prototype.createError=function(a){return Error("Error in Rangy "+this.name+" module: "+a)};p.createModule=function(a,d){var b=new i(a);p.modules[a]=b;F.push(function(a){d(a,b);b.initialized=!0;b.supported=!0})};p.requireModules=function(a){for(var d= -0,b=a.length,f,e;d<b;++d){e=a[d];f=p.modules[e];if(!f||!(f instanceof i))throw Error("Module '"+e+"' not found");if(!f.supported)throw Error("Module '"+e+"' not supported");}};var A=!1,q=function(){A||(A=!0,p.initialized||h())};if(typeof window==n)g("No window found");else if(typeof document==n)g("No document found");else return e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",q,!1),e(window,"addEventListener")?window.addEventListener("load",q,!1):e(window,"attachEvent")? -window.attachEvent("onload",q):g("Window does not have required addEventListener or attachEvent method"),p}(); -rangy.createModule("DomUtil",function(e,b){function a(a){for(var d=0;a=a.previousSibling;)d++;return d}function d(a,d){var b=[],f;for(f=a;f;f=f.parentNode)b.push(f);for(f=d;f;f=f.parentNode)if(j(b,f))return f;return null}function f(a,d,b){for(b=b?a:a.parentNode;b;){a=b.parentNode;if(a===d)return b;b=a}return null}function g(a){a=a.nodeType;return a==3||a==4||a==8}function h(a,d){var b=d.nextSibling,f=d.parentNode;b?f.insertBefore(a,b):f.appendChild(a);return a}function i(a){if(a.nodeType==9)return a; -else if(typeof a.ownerDocument!=o)return a.ownerDocument;else if(typeof a.document!=o)return a.document;else if(a.parentNode)return i(a.parentNode);else throw Error("getDocument: no document found for node");}function l(a){return!a?"[No node]":g(a)?'"'+a.data+'"':a.nodeType==1?"<"+a.nodeName+(a.id?' id="'+a.id+'"':"")+">["+a.childNodes.length+"]":a.nodeName}function t(a){this._next=this.root=a}function n(a,d){this.node=a;this.offset=d}function s(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+ -this.codeName}var o="undefined",k=e.util;k.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||b.fail("document missing a Node creation method");k.isHostMethod(document,"getElementsByTagName")||b.fail("document missing getElementsByTagName method");var r=document.createElement("div");k.areHostMethods(r,["insertBefore","appendChild","cloneNode"])||b.fail("Incomplete Element implementation");r=document.createTextNode("test");k.areHostMethods(r,["splitText","deleteData", -"insertData","appendData","cloneNode"])||b.fail("Incomplete Text Node implementation");var j=function(a,d){for(var b=a.length;b--;)if(a[b]===d)return!0;return!1};t.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,d;if(this._current){d=a.firstChild;if(!d)for(d=null;a!==this.root&&!(d=a.nextSibling);)a=a.parentNode;this._next=d}return this._current},detach:function(){this._current=this._next=this.root=null}};n.prototype={equals:function(a){return this.node=== -a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+l(this.node)+":"+this.offset+")]"}};s.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};s.prototype.toString=function(){return this.message};e.dom={arrayContains:j,getNodeIndex:a,getNodeLength:function(a){var d;return g(a)?a.length:(d=a.childNodes)?d.length:0},getCommonAncestor:d,isAncestorOf:function(a,d,b){for(d=b?d: -d.parentNode;d;)if(d===a)return!0;else d=d.parentNode;return!1},getClosestAncestorIn:f,isCharacterDataNode:g,insertAfter:h,splitDataNode:function(a,d){var b=a.cloneNode(!1);b.deleteData(0,d);a.deleteData(d,a.length-d);h(b,a);return b},getDocument:i,getWindow:function(a){a=i(a);if(typeof a.defaultView!=o)return a.defaultView;else if(typeof a.parentWindow!=o)return a.parentWindow;else throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=o)return a.contentWindow; -else if(typeof a.contentDocument!=o)return a.contentDocument.defaultView;else throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=o)return a.contentDocument;else if(typeof a.contentWindow!=o)return a.contentWindow.document;else throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return k.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var d;d= -a.parentNode;)a=d;return a},comparePoints:function(b,e,g,j){var h;if(b==g)return e===j?0:e<j?-1:1;else if(h=f(g,b,!0))return e<=a(h)?-1:1;else if(h=f(b,g,!0))return a(h)<j?-1:1;else if(e=d(b,g),b=b===e?e:f(b,e,!0),g=g===e?e:f(g,e,!0),b===g)throw Error("comparePoints got to case 4 and childA and childB are the same!");else{for(e=e.firstChild;e;){if(e===b)return-1;else if(e===g)return 1;e=e.nextSibling}throw Error("Should not be here!");}},inspectNode:l,createIterator:function(a){return new t(a)},DomPosition:n}; -e.DOMException=s}); -rangy.createModule("DomRange",function(e){function b(a,d){return a.nodeType!=3&&(m.isAncestorOf(a,d.startContainer,!0)||m.isAncestorOf(a,d.endContainer,!0))}function a(a){return m.getDocument(a.startContainer)}function d(a,d,b){if(d=a._listeners[d])for(var f=0,e=d.length;f<e;++f)d[f].call(a,{target:a,args:b})}function f(a){return new u(a.parentNode,m.getNodeIndex(a))}function g(a){return new u(a.parentNode,m.getNodeIndex(a)+1)}function h(a,d,b){var f=a.nodeType==11?a.firstChild:a;m.isCharacterDataNode(d)? -b==d.length?m.insertAfter(a,d):d.parentNode.insertBefore(a,b==0?d:m.splitDataNode(d,b)):b>=d.childNodes.length?d.appendChild(a):d.insertBefore(a,d.childNodes[b]);return f}function i(d){for(var b,f,e=a(d.range).createDocumentFragment();f=d.next();){b=d.isPartiallySelectedSubtree();f=f.cloneNode(!b);b&&(b=d.getSubtreeIterator(),f.appendChild(i(b)),b.detach(!0));if(f.nodeType==10)throw new D("HIERARCHY_REQUEST_ERR");e.appendChild(f)}return e}function l(a,d,b){for(var f,e,b=b||{stop:!1};f=a.next();)if(a.isPartiallySelectedSubtree())if(d(f)=== -!1){b.stop=!0;break}else{if(f=a.getSubtreeIterator(),l(f,d,b),f.detach(!0),b.stop)break}else for(f=m.createIterator(f);e=f.next();)if(d(e)===!1){b.stop=!0;return}}function t(a){for(var d;a.next();)a.isPartiallySelectedSubtree()?(d=a.getSubtreeIterator(),t(d),d.detach(!0)):a.remove()}function n(d){for(var b,f=a(d.range).createDocumentFragment(),e;b=d.next();){d.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),e=d.getSubtreeIterator(),b.appendChild(n(e)),e.detach(!0)):d.remove();if(b.nodeType==10)throw new D("HIERARCHY_REQUEST_ERR"); -f.appendChild(b)}return f}function s(a,d,b){var f=!(!d||!d.length),e,g=!!b;f&&(e=RegExp("^("+d.join("|")+")$"));var y=[];l(new k(a,!1),function(a){(!f||e.test(a.nodeType))&&(!g||b(a))&&y.push(a)});return y}function o(a){return"["+(typeof a.getName=="undefined"?"Range":a.getName())+"("+m.inspectNode(a.startContainer)+":"+a.startOffset+", "+m.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function k(a,d){this.range=a;this.clonePartiallySelectedTextNodes=d;if(!a.collapsed){this.sc=a.startContainer; -this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var b=a.commonAncestorContainer;this.sc===this.ec&&m.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===b&&!m.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:m.getClosestAncestorIn(this.sc,b,!0),this._last=this.ec===b&&!m.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:m.getClosestAncestorIn(this.ec,b,!0))}}function r(a){this.code= -this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function j(a,d,b){this.nodes=s(a,d,b);this._next=this.nodes[0];this._position=0}function q(a){return function(d,b){for(var f,e=b?d:d.parentNode;e;){f=e.nodeType;if(m.arrayContains(a,f))return e;e=e.parentNode}return null}}function v(a,d){if(Z(a,d))throw new r("INVALID_NODE_TYPE_ERR");}function p(a){if(!a.startContainer)throw new D("INVALID_STATE_ERR");}function x(a,d){if(!m.arrayContains(d,a.nodeType))throw new r("INVALID_NODE_TYPE_ERR"); -}function F(a,d){if(d<0||d>(m.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new D("INDEX_SIZE_ERR");}function B(a,d){if(M(a,!0)!==M(d,!0))throw new D("WRONG_DOCUMENT_ERR");}function A(a){if($(a,!0))throw new D("NO_MODIFICATION_ALLOWED_ERR");}function z(a,d){if(!a)throw new D(d);}function w(a){p(a);if(!m.arrayContains(J,a.startContainer.nodeType)&&!M(a.startContainer,!0)||!m.arrayContains(J,a.endContainer.nodeType)&&!M(a.endContainer,!0)||!(a.startOffset<=(m.isCharacterDataNode(a.startContainer)? -a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(m.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function H(){}function K(a){a.START_TO_START=R;a.START_TO_END=U;a.END_TO_END=aa;a.END_TO_START=V;a.NODE_BEFORE=W;a.NODE_AFTER=X;a.NODE_BEFORE_AND_AFTER=Y;a.NODE_INSIDE=S}function I(a){K(a);K(a.prototype)}function G(a,d){return function(){w(this); -var b=this.startContainer,f=this.startOffset,e=this.commonAncestorContainer,y=new k(this,!0);if(b!==e)b=m.getClosestAncestorIn(b,e,!0),f=g(b),b=f.node,f=f.offset;l(y,A);y.reset();e=a(y);y.detach();d(this,b,f,b,f);return e}}function C(a,d,j){function C(a,d){return function(b){p(this);x(b,O);x(y(b),J);b=(a?f:g)(b);(d?h:l)(this,b.node,b.offset)}}function h(a,b,f){var e=a.endContainer,g=a.endOffset;if(b!==a.startContainer||f!==this.startOffset){if(y(b)!=y(e)||m.comparePoints(b,f,e,g)==1)e=b,g=f;d(a,b, -f,e,g)}}function l(a,b,f){var e=a.startContainer,g=a.startOffset;if(b!==a.endContainer||f!==this.endOffset){if(y(b)!=y(e)||m.comparePoints(b,f,e,g)==-1)e=b,g=f;d(a,e,g,b,f)}}function M(a,b,f){(b!==a.startContainer||f!==this.startOffset||b!==a.endContainer||f!==this.endOffset)&&d(a,b,f,b,f)}a.prototype=new H;e.util.extend(a.prototype,{setStart:function(a,d){p(this);v(a,!0);F(a,d);h(this,a,d)},setEnd:function(a,d){p(this);v(a,!0);F(a,d);l(this,a,d)},setStartBefore:C(!0,!0),setStartAfter:C(!1,!0),setEndBefore:C(!0, -!1),setEndAfter:C(!1,!1),collapse:function(a){w(this);a?d(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){p(this);v(a,!0);d(this,a,0,a,m.getNodeLength(a))},selectNode:function(a){p(this);v(a,!1);x(a,O);var b=f(a),a=g(a);d(this,b.node,b.offset,a.node,a.offset)},extractContents:G(n,d),deleteContents:G(t,d),canSurroundContents:function(){w(this);A(this.startContainer); -A(this.endContainer);var a=new k(this,!0),d=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!d},detach:function(){j(this)},splitBoundaries:function(){w(this);var a=this.startContainer,b=this.startOffset,f=this.endContainer,e=this.endOffset,g=a===f;m.isCharacterDataNode(f)&&e>0&&e<f.length&&m.splitDataNode(f,e);m.isCharacterDataNode(a)&&b>0&&b<a.length&&(a=m.splitDataNode(a,b),g?(e-=b,f=a):f==a.parentNode&&e>=m.getNodeIndex(a)&&e++,b=0);d(this,a,b,f,e)},normalizeBoundaries:function(){w(this); -var a=this.startContainer,b=this.startOffset,f=this.endContainer,e=this.endOffset,g=function(a){var d=a.nextSibling;if(d&&d.nodeType==a.nodeType)f=a,e=a.length,a.appendData(d.data),d.parentNode.removeChild(d)},y=function(d){var g=d.previousSibling;if(g&&g.nodeType==d.nodeType){a=d;var y=d.length;b=g.length;d.insertData(0,g.data);g.parentNode.removeChild(g);a==f?(e+=b,f=a):f==d.parentNode&&(g=m.getNodeIndex(d),e==g?(f=d,e=y):e>g&&e--)}},j=!0;m.isCharacterDataNode(f)?f.length==e&&g(f):(e>0&&(j=f.childNodes[e- -1])&&m.isCharacterDataNode(j)&&g(j),j=!this.collapsed);j?m.isCharacterDataNode(a)?b==0&&y(a):b<a.childNodes.length&&(g=a.childNodes[b])&&m.isCharacterDataNode(g)&&y(g):(a=f,b=e);d(this,a,b,f,e)},collapseToPoint:function(a,d){p(this);v(a,!0);F(a,d);M(this,a,d)}});I(a)}function P(a){a.collapsed=a.startContainer===a.endContainer&&a.startOffset===a.endOffset;a.commonAncestorContainer=a.collapsed?a.startContainer:m.getCommonAncestor(a.startContainer,a.endContainer)}function N(a,b,f,e,g){var y=a.startContainer!== -b||a.startOffset!==f,j=a.endContainer!==e||a.endOffset!==g;a.startContainer=b;a.startOffset=f;a.endContainer=e;a.endOffset=g;P(a);d(a,"boundarychange",{startMoved:y,endMoved:j})}function E(a){this.startContainer=a;this.startOffset=0;this.endContainer=a;this.endOffset=0;this._listeners={boundarychange:[],detach:[]};P(this)}e.requireModules(["DomUtil"]);var m=e.dom,u=m.DomPosition,D=e.DOMException;k.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current= -null;this._next=this._first},hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next;if(a)this._next=a!==this._last?a.nextSibling:null,m.isCharacterDataNode(a)&&this.clonePartiallySelectedTextNodes&&(a===this.ec&&(a=a.cloneNode(!0)).deleteData(this.eo,a.length-this.eo),this._current===this.sc&&(a=a.cloneNode(!0)).deleteData(0,this.so));return a},remove:function(){var a=this._current,d,b;m.isCharacterDataNode(a)&&(a===this.sc||a===this.ec)?(d=a===this.sc?this.so:0,b=a=== -this.ec?this.eo:a.length,d!=b&&a.deleteData(d,b-d)):a.parentNode&&a.parentNode.removeChild(a)},isPartiallySelectedSubtree:function(){return b(this._current,this.range)},getSubtreeIterator:function(){var d;if(this.isSingleCharacterDataNode)d=this.range.cloneRange(),d.collapse();else{d=new E(a(this.range));var b=this._current,f=b,e=0,g=b,y=m.getNodeLength(b);if(m.isAncestorOf(b,this.sc,!0))f=this.sc,e=this.so;if(m.isAncestorOf(b,this.ec,!0))g=this.ec,y=this.eo;N(d,f,e,g,y)}return new k(d,this.clonePartiallySelectedTextNodes)}, -detach:function(a){a&&this.range.detach();this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};r.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2};r.prototype.toString=function(){return this.message};j.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){this._current=this._next;this._next=this.nodes[++this._position];return this._current},detach:function(){this._current=this._next=this.nodes=null}};var O=[1,3,4,5, -7,8,10],J=[2,9,11],Q=[1,3,4,5,7,8,10,11],L=[1,3,4,5,7,8],y=m.getRootContainer,M=q([9,11]),$=q([5,6,10,12]),Z=q([6,10,12]),T=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],R=0,U=1,aa=2,V=3,W=0,X=1,Y=2,S=3;H.prototype={attachListener:function(a,d){this._listeners[a].push(d)},compareBoundaryPoints:function(a,d){w(this);B(this.startContainer,d.startContainer);var b=a==V||a==R?"start":"end",f=a==U||a==R?"start":"end";return m.comparePoints(this[b+"Container"], -this[b+"Offset"],d[f+"Container"],d[f+"Offset"])},insertNode:function(a){w(this);x(a,Q);A(this.startContainer);if(m.isAncestorOf(a,this.startContainer,!0))throw new D("HIERARCHY_REQUEST_ERR");this.setStartBefore(h(a,this.startContainer,this.startOffset))},cloneContents:function(){w(this);var d,b;if(this.collapsed)return a(this).createDocumentFragment();else{if(this.startContainer===this.endContainer&&m.isCharacterDataNode(this.startContainer))return d=this.startContainer.cloneNode(!0),d.data=d.data.slice(this.startOffset, -this.endOffset),b=a(this).createDocumentFragment(),b.appendChild(d),b;else b=new k(this,!0),d=i(b),b.detach();return d}},canSurroundContents:function(){w(this);A(this.startContainer);A(this.endContainer);var a=new k(this,!0),d=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!d},surroundContents:function(a){x(a,L);if(!this.canSurroundContents())throw new r("BAD_BOUNDARYPOINTS_ERR");var d=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild); -h(a,this.startContainer,this.startOffset);a.appendChild(d);this.selectNode(a)},cloneRange:function(){w(this);for(var d=new E(a(this)),b=T.length,f;b--;)f=T[b],d[f]=this[f];return d},toString:function(){w(this);var a=this.startContainer;if(a===this.endContainer&&m.isCharacterDataNode(a))return a.nodeType==3||a.nodeType==4?a.data.slice(this.startOffset,this.endOffset):"";else{var d=[],a=new k(this,!0);l(a,function(a){(a.nodeType==3||a.nodeType==4)&&d.push(a.data)});a.detach();return d.join("")}},compareNode:function(a){w(this); -var d=a.parentNode,b=m.getNodeIndex(a);if(!d)throw new D("NOT_FOUND_ERR");a=this.comparePoint(d,b);d=this.comparePoint(d,b+1);return a<0?d>0?Y:W:d>0?X:S},comparePoint:function(a,d){w(this);z(a,"HIERARCHY_REQUEST_ERR");B(a,this.startContainer);if(m.comparePoints(a,d,this.startContainer,this.startOffset)<0)return-1;else if(m.comparePoints(a,d,this.endContainer,this.endOffset)>0)return 1;return 0},createContextualFragment:function(d){p(this);var b=a(this),f=b.createElement("div");f.innerHTML=d;for(d= -b.createDocumentFragment();b=f.firstChild;)d.appendChild(b);return d},toHtml:function(){w(this);var d=a(this).createElement("div");d.appendChild(this.cloneContents());return d.innerHTML},intersectsNode:function(d,b){w(this);z(d,"NOT_FOUND_ERR");if(m.getDocument(d)!==a(this))return!1;var f=d.parentNode,e=m.getNodeIndex(d);z(f,"NOT_FOUND_ERR");var g=m.comparePoints(f,e,this.endContainer,this.endOffset),f=m.comparePoints(f,e+1,this.startContainer,this.startOffset);return b?g<=0&&f>=0:g<0&&f>0},isPointInRange:function(a, -d){w(this);z(a,"HIERARCHY_REQUEST_ERR");B(a,this.startContainer);return m.comparePoints(a,d,this.startContainer,this.startOffset)>=0&&m.comparePoints(a,d,this.endContainer,this.endOffset)<=0},intersectsRange:function(d,b){w(this);if(a(d)!=a(this))throw new D("WRONG_DOCUMENT_ERR");var f=m.comparePoints(this.startContainer,this.startOffset,d.endContainer,d.endOffset),e=m.comparePoints(this.endContainer,this.endOffset,d.startContainer,d.startOffset);return b?f<=0&&e>=0:f<0&&e>0},intersection:function(a){if(this.intersectsRange(a)){var d= -m.comparePoints(this.startContainer,this.startOffset,a.startContainer,a.startOffset),b=m.comparePoints(this.endContainer,this.endOffset,a.endContainer,a.endOffset),f=this.cloneRange();d==-1&&f.setStart(a.startContainer,a.startOffset);b==1&&f.setEnd(a.endContainer,a.endOffset);return f}return null},union:function(a){if(this.intersectsRange(a,!0)){var d=this.cloneRange();m.comparePoints(a.startContainer,a.startOffset,this.startContainer,this.startOffset)==-1&&d.setStart(a.startContainer,a.startOffset); -m.comparePoints(a.endContainer,a.endOffset,this.endContainer,this.endOffset)==1&&d.setEnd(a.endContainer,a.endOffset);return d}else throw new r("Ranges do not intersect");},containsNode:function(a,d){return d?this.intersectsNode(a,!1):this.compareNode(a)==S},containsNodeContents:function(a){return this.comparePoint(a,0)>=0&&this.comparePoint(a,m.getNodeLength(a))<=0},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var d=this.cloneRange();d.selectNode(a); -var b=d.getNodes([3]);return b.length>0?(d.setStart(b[0],0),a=b.pop(),d.setEnd(a,a.length),a=this.containsRange(d),d.detach(),a):this.containsNodeContents(a)},createNodeIterator:function(a,d){w(this);return new j(this,a,d)},getNodes:function(a,d){w(this);return s(this,a,d)},getDocument:function(){return a(this)},collapseBefore:function(a){p(this);this.setEndBefore(a);this.collapse(!1)},collapseAfter:function(a){p(this);this.setStartAfter(a);this.collapse(!0)},getName:function(){return"DomRange"}, -equals:function(a){return E.rangesEqual(this,a)},inspect:function(){return o(this)}};C(E,N,function(a){p(a);a.startContainer=a.startOffset=a.endContainer=a.endOffset=null;a.collapsed=a.commonAncestorContainer=null;d(a,"detach",null);a._listeners=null});e.rangePrototype=H.prototype;E.rangeProperties=T;E.RangeIterator=k;E.copyComparisonConstants=I;E.createPrototypeRange=C;E.inspect=o;E.getRangeDocument=a;E.rangesEqual=function(a,d){return a.startContainer===d.startContainer&&a.startOffset===d.startOffset&& -a.endContainer===d.endContainer&&a.endOffset===d.endOffset};e.DomRange=E;e.RangeException=r}); -rangy.createModule("WrappedRange",function(e){function b(a,d,b,e){var h=a.duplicate();h.collapse(b);var k=h.parentElement();f.isAncestorOf(d,k,!0)||(k=d);if(!k.canHaveHTML)return new g(k.parentNode,f.getNodeIndex(k));var d=f.getDocument(k).createElement("span"),r,j=b?"StartToStart":"StartToEnd";do k.insertBefore(d,d.previousSibling),h.moveToElementText(d);while((r=h.compareEndPoints(j,a))>0&&d.previousSibling);j=d.nextSibling;if(r==-1&&j&&f.isCharacterDataNode(j)){h.setEndPoint(b?"EndToStart":"EndToEnd", -a);if(/[\r\n]/.test(j.data)){k=h.duplicate();b=k.text.replace(/\r\n/g,"\r").length;for(b=k.moveStart("character",b);k.compareEndPoints("StartToEnd",k)==-1;)b++,k.moveStart("character",1)}else b=h.text.length;k=new g(j,b)}else j=(e||!b)&&d.previousSibling,k=(b=(e||b)&&d.nextSibling)&&f.isCharacterDataNode(b)?new g(b,0):j&&f.isCharacterDataNode(j)?new g(j,j.length):new g(k,f.getNodeIndex(d));d.parentNode.removeChild(d);return k}function a(a,d){var b,e,g=a.offset,h=f.getDocument(a.node),r=h.body.createTextRange(), -j=f.isCharacterDataNode(a.node);j?(b=a.node,e=b.parentNode):(b=a.node.childNodes,b=g<b.length?b[g]:null,e=a.node);h=h.createElement("span");h.innerHTML="&#feff;";b?e.insertBefore(h,b):e.appendChild(h);r.moveToElementText(h);r.collapse(!d);e.removeChild(h);if(j)r[d?"moveStart":"moveEnd"]("character",g);return r}e.requireModules(["DomUtil","DomRange"]);var d,f=e.dom,g=f.DomPosition,h=e.DomRange;if(e.features.implementsDomRange&&(!e.features.implementsTextRange||!e.config.preferTextRange))(function(){function a(d){for(var b= -e.length,f;b--;)f=e[b],d[f]=d.nativeRange[f]}var b,e=h.rangeProperties,g;d=function(d){if(!d)throw Error("Range must be specified");this.nativeRange=d;a(this)};h.createPrototypeRange(d,function(a,d,b,f,e){var g=a.endContainer!==f||a.endOffset!=e;if(a.startContainer!==d||a.startOffset!=b||g)a.setEnd(f,e),a.setStart(d,b)},function(a){a.nativeRange.detach();a.detached=!0;for(var d=e.length,b;d--;)b=e[d],a[b]=null});b=d.prototype;b.selectNode=function(d){this.nativeRange.selectNode(d);a(this)};b.deleteContents= -function(){this.nativeRange.deleteContents();a(this)};b.extractContents=function(){var d=this.nativeRange.extractContents();a(this);return d};b.cloneContents=function(){return this.nativeRange.cloneContents()};b.surroundContents=function(d){this.nativeRange.surroundContents(d);a(this)};b.collapse=function(d){this.nativeRange.collapse(d);a(this)};b.cloneRange=function(){return new d(this.nativeRange.cloneRange())};b.refresh=function(){a(this)};b.toString=function(){return this.nativeRange.toString()}; -var i=document.createTextNode("test");f.getBody(document).appendChild(i);var k=document.createRange();k.setStart(i,0);k.setEnd(i,0);try{k.setStart(i,1),b.setStart=function(d,b){this.nativeRange.setStart(d,b);a(this)},b.setEnd=function(d,b){this.nativeRange.setEnd(d,b);a(this)},g=function(d){return function(b){this.nativeRange[d](b);a(this)}}}catch(r){b.setStart=function(d,b){try{this.nativeRange.setStart(d,b)}catch(f){this.nativeRange.setEnd(d,b),this.nativeRange.setStart(d,b)}a(this)},b.setEnd=function(d, -b){try{this.nativeRange.setEnd(d,b)}catch(f){this.nativeRange.setStart(d,b),this.nativeRange.setEnd(d,b)}a(this)},g=function(d,b){return function(f){try{this.nativeRange[d](f)}catch(e){this.nativeRange[b](f),this.nativeRange[d](f)}a(this)}}}b.setStartBefore=g("setStartBefore","setEndBefore");b.setStartAfter=g("setStartAfter","setEndAfter");b.setEndBefore=g("setEndBefore","setStartBefore");b.setEndAfter=g("setEndAfter","setStartAfter");k.selectNodeContents(i);b.selectNodeContents=k.startContainer== -i&&k.endContainer==i&&k.startOffset==0&&k.endOffset==i.length?function(d){this.nativeRange.selectNodeContents(d);a(this)}:function(a){this.setStart(a,0);this.setEnd(a,h.getEndOffset(a))};k.selectNodeContents(i);k.setEnd(i,3);g=document.createRange();g.selectNodeContents(i);g.setEnd(i,4);g.setStart(i,2);b.compareBoundaryPoints=k.compareBoundaryPoints(k.START_TO_END,g)==-1&k.compareBoundaryPoints(k.END_TO_START,g)==1?function(a,d){d=d.nativeRange||d;if(a==d.START_TO_END)a=d.END_TO_START;else if(a== -d.END_TO_START)a=d.START_TO_END;return this.nativeRange.compareBoundaryPoints(a,d)}:function(a,d){return this.nativeRange.compareBoundaryPoints(a,d.nativeRange||d)};f.getBody(document).removeChild(i);k.detach();g.detach()})(),e.createNativeRange=function(a){return(a||document).createRange()};else if(e.features.implementsTextRange){d=function(a){this.textRange=a;this.refresh()};d.prototype=new h(document);d.prototype.refresh=function(){var a,d,e=this.textRange;a=e.parentElement();var g=e.duplicate(); -g.collapse(!0);d=g.parentElement();g=e.duplicate();g.collapse(!1);e=g.parentElement();d=d==e?d:f.getCommonAncestor(d,e);d=d==a?d:f.getCommonAncestor(a,d);this.textRange.compareEndPoints("StartToEnd",this.textRange)==0?d=a=b(this.textRange,d,!0,!0):(a=b(this.textRange,d,!0,!1),d=b(this.textRange,d,!1,!1));this.setStart(a.node,a.offset);this.setEnd(d.node,d.offset)};h.copyComparisonConstants(d);var i=function(){return this}();if(typeof i.Range=="undefined")i.Range=d;e.createNativeRange=function(a){return(a|| -document).body.createTextRange()}}if(e.features.implementsTextRange)d.rangeToTextRange=function(d){if(d.collapsed)return a(new g(d.startContainer,d.startOffset),!0);else{var b=a(new g(d.startContainer,d.startOffset),!0),e=a(new g(d.endContainer,d.endOffset),!1),d=f.getDocument(d.startContainer).body.createTextRange();d.setEndPoint("StartToStart",b);d.setEndPoint("EndToEnd",e);return d}};d.prototype.getName=function(){return"WrappedRange"};e.WrappedRange=d;e.createRange=function(a){return new d(e.createNativeRange(a|| -document))};e.createRangyRange=function(a){return new h(a||document)};e.createIframeRange=function(a){return e.createRange(f.getIframeDocument(a))};e.createIframeRangyRange=function(a){return e.createRangyRange(f.getIframeDocument(a))};e.addCreateMissingNativeApiListener(function(a){a=a.document;if(typeof a.createRange=="undefined")a.createRange=function(){return e.createRange(this)};a=a=null})}); -rangy.createModule("WrappedSelection",function(e,b){function a(a){return(a||window).getSelection()}function d(a){return(a||window).document.selection}function f(a,d,b){var f=b?"end":"start",b=b?"start":"end";a.anchorNode=d[f+"Container"];a.anchorOffset=d[f+"Offset"];a.focusNode=d[b+"Container"];a.focusOffset=d[b+"Offset"]}function g(a){a.anchorNode=a.focusNode=null;a.anchorOffset=a.focusOffset=0;a.rangeCount=0;a.isCollapsed=!0;a._ranges.length=0}function h(a){var d;if(a instanceof v){if(d=a._selectionNativeRange, -!d)d=e.createNativeRange(j.getDocument(a.startContainer)),d.setEnd(a.endContainer,a.endOffset),d.setStart(a.startContainer,a.startOffset),a._selectionNativeRange=d,a.attachListener("detach",function(){this._selectionNativeRange=null})}else a instanceof p?d=a.nativeRange:e.features.implementsDomRange&&a instanceof j.getWindow(a.startContainer).Range&&(d=a);return d}function i(a){var d=a.getNodes(),b;a:if(!d.length||d[0].nodeType!=1)b=!1;else{b=1;for(var f=d.length;b<f;++b)if(!j.isAncestorOf(d[0],d[b])){b= -!1;break a}b=!0}if(!b)throw Error("getSingleElementFromRange: range "+a.inspect()+" did not consist of a single element");return d[0]}function l(a,d){var b=new p(d);a._ranges=[b];f(a,b,!1);a.rangeCount=1;a.isCollapsed=b.collapsed}function t(a){a._ranges.length=0;if(a.docSelection.type=="None")g(a);else{var d=a.docSelection.createRange();if(d&&typeof d.text!="undefined")l(a,d);else{a.rangeCount=d.length;for(var b,h=j.getDocument(d.item(0)),C=0;C<a.rangeCount;++C)b=e.createRange(h),b.selectNode(d.item(C)), -a._ranges.push(b);a.isCollapsed=a.rangeCount==1&&a._ranges[0].collapsed;f(a,a._ranges[a.rangeCount-1],!1)}}}function n(a,d){for(var b=a.docSelection.createRange(),f=i(d),e=j.getDocument(b.item(0)),e=j.getBody(e).createControlRange(),g=0,h=b.length;g<h;++g)e.add(b.item(g));try{e.add(f)}catch(C){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");}e.select();t(a)}function s(a,d,b){this.nativeSelection=a;this.docSelection=d;this._ranges= -[];this.win=b;this.refresh()}function o(a,d){for(var b=j.getDocument(d[0].startContainer),b=j.getBody(b).createControlRange(),f=0,e;f<rangeCount;++f){e=i(d[f]);try{b.add(e)}catch(g){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)");}}b.select();t(a)}function k(a,d){if(a.anchorNode&&j.getDocument(a.anchorNode)!==j.getDocument(d))throw new x("WRONG_DOCUMENT_ERR");}function r(a){var d=[],b=new F(a.anchorNode,a.anchorOffset), -f=new F(a.focusNode,a.focusOffset),e=typeof a.getName=="function"?a.getName():"Selection";if(typeof a.rangeCount!="undefined")for(var g=0,h=a.rangeCount;g<h;++g)d[g]=v.inspect(a.getRangeAt(g));return"["+e+"(Ranges: "+d.join(", ")+")(anchor: "+b.inspect()+", focus: "+f.inspect()+"]"}e.requireModules(["DomUtil","DomRange","WrappedRange"]);e.config.checkSelectionRanges=!0;var j=e.dom,q=e.util,v=e.DomRange,p=e.WrappedRange,x=e.DOMException,F=j.DomPosition,B,A,z=e.util.isHostMethod(window,"getSelection"), -w=e.util.isHostObject(document,"selection"),H=w&&(!z||e.config.preferTextRange);H?(B=d,e.isSelectionValid=function(a){var a=(a||window).document,d=a.selection;return d.type!="None"||j.getDocument(d.createRange().parentElement())==a}):z?(B=a,e.isSelectionValid=function(){return!0}):b.fail("Neither document.selection or window.getSelection() detected.");e.getNativeSelection=B;var z=B(),K=e.createNativeRange(document),I=j.getBody(document),G=q.areHostObjects(z,q.areHostProperties(z,["anchorOffset","focusOffset"])); -e.features.selectionHasAnchorAndFocus=G;var C=q.isHostMethod(z,"extend");e.features.selectionHasExtend=C;var P=typeof z.rangeCount=="number";e.features.selectionHasRangeCount=P;var N=!1,E=!0;q.areHostMethods(z,["addRange","getRangeAt","removeAllRanges"])&&typeof z.rangeCount=="number"&&e.features.implementsDomRange&&function(){var a=document.createElement("iframe");I.appendChild(a);var d=j.getIframeDocument(a);d.open();d.write("<html><head></head><body>12</body></html>");d.close();var b=j.getIframeWindow(a).getSelection(), -f=d.documentElement.lastChild.firstChild,d=d.createRange();d.setStart(f,1);d.collapse(!0);b.addRange(d);E=b.rangeCount==1;b.removeAllRanges();var e=d.cloneRange();d.setStart(f,0);e.setEnd(f,2);b.addRange(d);b.addRange(e);N=b.rangeCount==2;d.detach();e.detach();I.removeChild(a)}();e.features.selectionSupportsMultipleRanges=N;e.features.collapsedNonEditableSelectionsSupported=E;var m=!1,u;I&&q.isHostMethod(I,"createControlRange")&&(u=I.createControlRange(),q.areHostProperties(u,["item","add"])&&(m= -!0));e.features.implementsControlRange=m;A=G?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var D;q.isHostMethod(z,"getRangeAt")?D=function(a,d){try{return a.getRangeAt(d)}catch(b){return null}}:G&&(D=function(a){var d=j.getDocument(a.anchorNode),d=e.createRange(d);d.setStart(a.anchorNode,a.anchorOffset);d.setEnd(a.focusNode,a.focusOffset);d.collapsed!==this.isCollapsed&&(d.setStart(a.focusNode, -a.focusOffset),d.setEnd(a.anchorNode,a.anchorOffset));return d});e.getSelection=function(a){var a=a||window,b=a._rangySelection,f=B(a),e=w?d(a):null;b?(b.nativeSelection=f,b.docSelection=e,b.refresh(a)):(b=new s(f,e,a),a._rangySelection=b);return b};e.getIframeSelection=function(a){return e.getSelection(j.getIframeWindow(a))};u=s.prototype;if(!H&&G&&q.areHostMethods(z,["removeAllRanges","addRange"])){u.removeAllRanges=function(){this.nativeSelection.removeAllRanges();g(this)};var O=function(a,d){var b= -v.getRangeDocument(d),b=e.createRange(b);b.collapseToPoint(d.endContainer,d.endOffset);a.nativeSelection.addRange(h(b));a.nativeSelection.extend(d.startContainer,d.startOffset);a.refresh()};u.addRange=P?function(a,d){if(m&&w&&this.docSelection.type=="Control")n(this,a);else if(d&&C)O(this,a);else{var b;N?b=this.rangeCount:(this.removeAllRanges(),b=0);this.nativeSelection.addRange(h(a));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==b+1?(e.config.checkSelectionRanges&&(b=D(this.nativeSelection, -this.rangeCount-1))&&!v.rangesEqual(b,a)&&(a=new p(b)),this._ranges[this.rangeCount-1]=a,f(this,a,L(this.nativeSelection)),this.isCollapsed=A(this)):this.refresh()}}:function(a,d){d&&C?O(this,a):(this.nativeSelection.addRange(h(a)),this.refresh())};u.setRanges=function(a){if(m&&a.length>1)o(this,a);else{this.removeAllRanges();for(var d=0,b=a.length;d<b;++d)this.addRange(a[d])}}}else if(q.isHostMethod(z,"empty")&&q.isHostMethod(K,"select")&&m&&H)u.removeAllRanges=function(){try{if(this.docSelection.empty(), -this.docSelection.type!="None"){var a;if(this.anchorNode)a=j.getDocument(this.anchorNode);else if(this.docSelection.type=="Control"){var d=this.docSelection.createRange();d.length&&(a=j.getDocument(d.item(0)).body.createTextRange())}a&&(a.body.createTextRange().select(),this.docSelection.empty())}}catch(b){}g(this)},u.addRange=function(a){this.docSelection.type=="Control"?n(this,a):(p.rangeToTextRange(a).select(),this._ranges[0]=a,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,f(this, -a,!1))},u.setRanges=function(a){this.removeAllRanges();var d=a.length;d>1?o(this,a):d&&this.addRange(a[0])};else return b.fail("No means of selecting a Range or TextRange was found"),!1;u.getRangeAt=function(a){if(a<0||a>=this.rangeCount)throw new x("INDEX_SIZE_ERR");else return this._ranges[a]};var J;if(H)J=function(a){var d;e.isSelectionValid(a.win)?d=a.docSelection.createRange():(d=j.getBody(a.win.document).createTextRange(),d.collapse(!0));a.docSelection.type=="Control"?t(a):d&&typeof d.text!= -"undefined"?l(a,d):g(a)};else if(q.isHostMethod(z,"getRangeAt")&&typeof z.rangeCount=="number")J=function(a){if(m&&w&&a.docSelection.type=="Control")t(a);else if(a._ranges.length=a.rangeCount=a.nativeSelection.rangeCount,a.rangeCount){for(var d=0,b=a.rangeCount;d<b;++d)a._ranges[d]=new e.WrappedRange(a.nativeSelection.getRangeAt(d));f(a,a._ranges[a.rangeCount-1],L(a.nativeSelection));a.isCollapsed=A(a)}else g(a)};else if(G&&typeof z.isCollapsed=="boolean"&&typeof K.collapsed=="boolean"&&e.features.implementsDomRange)J= -function(a){var d;d=a.nativeSelection;d.anchorNode?(d=D(d,0),a._ranges=[d],a.rangeCount=1,d=a.nativeSelection,a.anchorNode=d.anchorNode,a.anchorOffset=d.anchorOffset,a.focusNode=d.focusNode,a.focusOffset=d.focusOffset,a.isCollapsed=A(a)):g(a)};else return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;u.refresh=function(a){var d=a?this._ranges.slice(0):null;J(this);if(a){a=d.length;if(a!=this._ranges.length)return!1;for(;a--;)if(!v.rangesEqual(d[a],this._ranges[a]))return!1; -return!0}};var Q=function(a,d){var b=a.getAllRanges(),f=!1;a.removeAllRanges();for(var e=0,h=b.length;e<h;++e)f||d!==b[e]?a.addRange(b[e]):f=!0;a.rangeCount||g(a)};u.removeRange=m?function(a){if(this.docSelection.type=="Control"){for(var d=this.docSelection.createRange(),a=i(a),b=j.getDocument(d.item(0)),b=j.getBody(b).createControlRange(),f,e=!1,g=0,h=d.length;g<h;++g)f=d.item(g),f!==a||e?b.add(d.item(g)):e=!0;b.select();t(this)}else Q(this,a)}:function(a){Q(this,a)};var L;!H&&G&&e.features.implementsDomRange? -(L=function(a){var d=!1;a.anchorNode&&(d=j.comparePoints(a.anchorNode,a.anchorOffset,a.focusNode,a.focusOffset)==1);return d},u.isBackwards=function(){return L(this)}):L=u.isBackwards=function(){return!1};u.toString=function(){for(var a=[],d=0,b=this.rangeCount;d<b;++d)a[d]=""+this._ranges[d];return a.join("")};u.collapse=function(a,d){k(this,a);var b=e.createRange(j.getDocument(a));b.collapseToPoint(a,d);this.removeAllRanges();this.addRange(b);this.isCollapsed=!0};u.collapseToStart=function(){if(this.rangeCount){var a= -this._ranges[0];this.collapse(a.startContainer,a.startOffset)}else throw new x("INVALID_STATE_ERR");};u.collapseToEnd=function(){if(this.rangeCount){var a=this._ranges[this.rangeCount-1];this.collapse(a.endContainer,a.endOffset)}else throw new x("INVALID_STATE_ERR");};u.selectAllChildren=function(a){k(this,a);var d=e.createRange(j.getDocument(a));d.selectNodeContents(a);this.removeAllRanges();this.addRange(d)};u.deleteFromDocument=function(){if(m&&w&&this.docSelection.type=="Control"){for(var a=this.docSelection.createRange(), -d;a.length;)d=a.item(0),a.remove(d),d.parentNode.removeChild(d);this.refresh()}else if(this.rangeCount){a=this.getAllRanges();this.removeAllRanges();d=0;for(var b=a.length;d<b;++d)a[d].deleteContents();this.addRange(a[b-1])}};u.getAllRanges=function(){return this._ranges.slice(0)};u.setSingleRange=function(a){this.setRanges([a])};u.containsNode=function(a,d){for(var b=0,f=this._ranges.length;b<f;++b)if(this._ranges[b].containsNode(a,d))return!0;return!1};u.toHtml=function(){var a="";if(this.rangeCount){for(var a= -v.getRangeDocument(this._ranges[0]).createElement("div"),d=0,b=this._ranges.length;d<b;++d)a.appendChild(this._ranges[d].cloneContents());a=a.innerHTML}return a};u.getName=function(){return"WrappedSelection"};u.inspect=function(){return r(this)};u.detach=function(){this.win=this.anchorNode=this.focusNode=this.win._rangySelection=null};s.inspect=r;e.Selection=s;e.selectionPrototype=u;e.addCreateMissingNativeApiListener(function(a){if(typeof a.getSelection=="undefined")a.getSelection=function(){return e.getSelection(this)}; -a=null})}); -rangy.createModule("CssClassApplier",function(e,b){function a(a,d){return a.className&&RegExp("(?:^|\\s)"+d+"(?:\\s|$)").test(a.className)}function d(d,b){d.className?a(d,b)||(d.className+=" "+b):d.className=b}function f(a){return a.split(/\s+/).sort().join(" ")}function g(a,d){return f(a.className)==f(d.className)}function h(a){for(var d=a.parentNode;a.hasChildNodes();)d.insertBefore(a.firstChild,a);d.removeChild(a)}function i(a,d){var b=a.cloneRange();b.selectNodeContents(d);var f=b.intersection(a),f= -f?f.toString():"";b.detach();return f!=""}function l(a){return a.getNodes([3],function(d){return i(a,d)})}function t(a,d){if(a.attributes.length!=d.attributes.length)return!1;for(var b=0,f=a.attributes.length,e,g;b<f;++b)if(e=a.attributes[b],g=e.name,g!="class"){g=d.attributes.getNamedItem(g);if(e.specified!=g.specified)return!1;if(e.specified&&e.nodeValue!==g.nodeValue)return!1}return!0}function n(a,d){for(var b=0,f=a.attributes.length,e;b<f;++b)if(e=a.attributes[b].name,(!d||!x.arrayContains(d, -e))&&a.attributes[b].specified&&e!="class")return!0;return!1}function s(a){var d;return a&&a.nodeType==1&&((d=a.parentNode)&&d.nodeType==9&&d.designMode=="on"||A(a)&&!A(a.parentNode))}function o(a){return(A(a)||a.nodeType!=1&&A(a.parentNode))&&!s(a)}function k(a){return a&&a.nodeType==1&&!z.test(B(a,"display"))}function r(a){if(a.data.length==0)return!0;if(w.test(a.data))return!1;switch(B(a.parentNode,"whiteSpace")){case "pre":case "pre-wrap":case "-moz-pre-wrap":return!1;case "pre-line":if(/[\r\n]/.test(a.data))return!1}return k(a.previousSibling)|| -k(a.nextSibling)}function j(a,d,f,e){var g,h=f==0;if(x.isAncestorOf(d,a))throw b.createError("descendant is ancestor of node");if(x.isCharacterDataNode(d))if(f==0)f=x.getNodeIndex(d),d=d.parentNode;else if(f==d.length)f=x.getNodeIndex(d)+1,d=d.parentNode;else throw b.createError("splitNodeAt should not be called with offset in the middle of a data node ("+f+" in "+d.data);if(x.isCharacterDataNode(d)?f==0?d.previousSibling:f==d.length?d.nextSibling:1:f>0&&f<d.childNodes.length){if(!g){g=d.cloneNode(!1); -for(g.id&&g.removeAttribute("id");h=d.childNodes[f];)g.appendChild(h);x.insertAfter(g,d)}return d==a?g:j(a,g.parentNode,x.getNodeIndex(g),e)}else if(a!=d)return g=d.parentNode,d=x.getNodeIndex(d),h||d++,j(a,g,d,e);return a}function q(a){var d=a?"nextSibling":"previousSibling";return function(b,f){var e=b.parentNode,h=b[d];if(h){if(h&&h.nodeType==3)return h}else if(f&&(h=e[d])&&h.nodeType==1&&e.tagName==h.tagName&&g(e,h)&&t(e,h))return h[a?"firstChild":"lastChild"];return null}}function v(a){this.firstTextNode= -(this.isElementMerge=a.nodeType==1)?a.lastChild:a;this.textNodes=[this.firstTextNode]}function p(a,d,b){this.cssClass=a;var e,g,h=null;if(typeof d=="object"&&d!==null){b=d.tagNames;h=d.elementProperties;for(e=0;g=I[e++];)d.hasOwnProperty(g)&&(this[g]=d[g]);e=d.normalize}else e=d;this.normalize=typeof e=="undefined"?!0:e;this.attrExceptions=[];e=document.createElement(this.elementTagName);this.elementProperties={};for(var j in h)h.hasOwnProperty(j)&&(G.hasOwnProperty(j)&&(j=G[j]),e[j]=h[j],this.elementProperties[j]= -e[j],this.attrExceptions.push(j));this.elementSortedClassName=this.elementProperties.hasOwnProperty("className")?f(this.elementProperties.className+" "+a):a;this.applyToAnyTagName=!1;a=typeof b;if(a=="string")b=="*"?this.applyToAnyTagName=!0:this.tagNames=b.toLowerCase().replace(/^\s\s*/,"").replace(/\s\s*$/,"").split(/\s*,\s*/);else if(a=="object"&&typeof b.length=="number"){this.tagNames=[];e=0;for(a=b.length;e<a;++e)b[e]=="*"?this.applyToAnyTagName=!0:this.tagNames.push(b[e].toLowerCase())}else this.tagNames= -[this.elementTagName]}e.requireModules(["WrappedSelection","WrappedRange"]);var x=e.dom,F=function(){function a(d,b,f){return b&&f?" ":""}return function(d,b){if(d.className)d.className=d.className.replace(RegExp("(?:^|\\s)"+b+"(?:\\s|$)"),a)}}(),B;typeof window.getComputedStyle!="undefined"?B=function(a,d){return x.getWindow(a).getComputedStyle(a,null)[d]}:typeof document.documentElement.currentStyle!="undefined"?B=function(a,d){return a.currentStyle[d]}:b.fail("No means of obtaining computed style properties found"); -var A;(function(){A=typeof document.createElement("div").isContentEditable=="boolean"?function(a){return a&&a.nodeType==1&&a.isContentEditable}:function(a){return!a||a.nodeType!=1||a.contentEditable=="false"?!1:a.contentEditable=="true"||A(a.parentNode)}})();var z=/^inline(-block|-table)?$/i,w=/[^\r\n\t\f \u200B]/,H=q(!1),K=q(!0);v.prototype={doMerge:function(){for(var a=[],d,b,f=0,e=this.textNodes.length;f<e;++f)d=this.textNodes[f],b=d.parentNode,a[f]=d.data,f&&(b.removeChild(d),b.hasChildNodes()|| -b.parentNode.removeChild(b));return this.firstTextNode.data=a=a.join("")},getLength:function(){for(var a=this.textNodes.length,d=0;a--;)d+=this.textNodes[a].length;return d},toString:function(){for(var a=[],d=0,b=this.textNodes.length;d<b;++d)a[d]="'"+this.textNodes[d].data+"'";return"[Merge("+a.join(",")+")]"}};var I=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"],G={"class":"className"};p.prototype={elementTagName:"span",elementProperties:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1, -hasClass:function(d){return d.nodeType==1&&x.arrayContains(this.tagNames,d.tagName.toLowerCase())&&a(d,this.cssClass)},getSelfOrAncestorWithClass:function(a){for(;a;){if(this.hasClass(a,this.cssClass))return a;a=a.parentNode}return null},isModifiable:function(a){return!this.applyToEditableOnly||o(a)},isIgnorableWhiteSpaceNode:function(a){return this.ignoreWhiteSpace&&a&&a.nodeType==3&&r(a)},postApply:function(a,d,b){for(var f=a[0],e=a[a.length-1],g=[],h,j=f,k=e,r=0,i=e.length,l,q,n=0,p=a.length;n< -p;++n)if(l=a[n],q=H(l,!b)){h||(h=new v(q),g.push(h));h.textNodes.push(l);if(l===f)j=h.firstTextNode,r=j.length;if(l===e)k=h.firstTextNode,i=h.getLength()}else h=null;if(a=K(e,!b))h||(h=new v(e),g.push(h)),h.textNodes.push(a);if(g.length){n=0;for(p=g.length;n<p;++n)g[n].doMerge();d.setStart(j,r);d.setEnd(k,i)}},createContainer:function(a){a=a.createElement(this.elementTagName);e.util.extend(a,this.elementProperties);d(a,this.cssClass);return a},applyToTextNode:function(a){var b=a.parentNode;b.childNodes.length== -1&&x.arrayContains(this.tagNames,b.tagName.toLowerCase())?d(b,this.cssClass):(b=this.createContainer(x.getDocument(a)),a.parentNode.insertBefore(b,a),b.appendChild(a))},isRemovable:function(a){var d;if(d=a.tagName.toLowerCase()==this.elementTagName)if(d=f(a.className)==this.elementSortedClassName){var b;a:{d=this.elementProperties;for(b in d)if(d.hasOwnProperty(b)&&a[b]!==d[b]){b=!1;break a}b=!0}d=b&&!n(a,this.attrExceptions)&&this.isModifiable(a)}return d},undoToTextNode:function(a,d,b){d.containsNode(b)|| -(a=d.cloneRange(),a.selectNode(b),a.isPointInRange(d.endContainer,d.endOffset)&&(j(b,d.endContainer,d.endOffset,[d]),d.setEndAfter(b)),a.isPointInRange(d.startContainer,d.startOffset)&&(b=j(b,d.startContainer,d.startOffset,[d])));this.isRemovable(b)?h(b):F(b,this.cssClass)},applyToRange:function(a){a.splitBoundaries();var d=l(a);if(d.length){for(var b,f=0,e=d.length;f<e;++f)b=d[f],!this.isIgnorableWhiteSpaceNode(b)&&!this.getSelfOrAncestorWithClass(b)&&this.isModifiable(b)&&this.applyToTextNode(b); -a.setStart(d[0],0);b=d[d.length-1];a.setEnd(b,b.length);this.normalize&&this.postApply(d,a,!1)}},applyToSelection:function(a){var a=e.getSelection(a||window),d,b=a.getAllRanges();a.removeAllRanges();for(var f=b.length;f--;)d=b[f],this.applyToRange(d),a.addRange(d)},undoToRange:function(a){a.splitBoundaries();var d=l(a),b,f,e=d[d.length-1];if(d.length){for(var g=0,h=d.length;g<h;++g)b=d[g],(f=this.getSelfOrAncestorWithClass(b))&&this.isModifiable(b)&&this.undoToTextNode(b,a,f),a.setStart(d[0],0),a.setEnd(e, -e.length);this.normalize&&this.postApply(d,a,!0)}},undoToSelection:function(a){var a=e.getSelection(a||window),d=a.getAllRanges(),b;a.removeAllRanges();for(var f=0,g=d.length;f<g;++f)b=d[f],this.undoToRange(b),a.addRange(b)},getTextSelectedByRange:function(a,d){var b=d.cloneRange();b.selectNodeContents(a);var f=b.intersection(d),f=f?f.toString():"";b.detach();return f},isAppliedToRange:function(a){if(a.collapsed)return!!this.getSelfOrAncestorWithClass(a.commonAncestorContainer);else{for(var d=a.getNodes([3]), -b=0,f;f=d[b++];)if(!this.isIgnorableWhiteSpaceNode(f)&&i(a,f)&&this.isModifiable(f)&&!this.getSelfOrAncestorWithClass(f))return!1;return!0}},isAppliedToSelection:function(a){for(var a=e.getSelection(a||window).getAllRanges(),d=a.length;d--;)if(!this.isAppliedToRange(a[d]))return!1;return!0},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)},toggleSelection:function(a){this.isAppliedToSelection(a)?this.undoToSelection(a):this.applyToSelection(a)},detach:function(){}}; -p.util={hasClass:a,addClass:d,removeClass:F,hasSameClasses:g,replaceWithOwnChildren:h,elementsHaveSameNonClassAttributes:t,elementHasNonClassAttributes:n,splitNodeAt:j,isEditableElement:A,isEditingHost:s,isEditable:o};e.CssClassApplier=p;e.createCssClassApplier=function(a,d,b){return new p(a,d,b)}}); -rangy.createModule("SaveRestore",function(e,b){function a(a,d){var b="selectionBoundary_"+ +new Date+"_"+(""+Math.random()).slice(2),f,e=h.getDocument(a.startContainer),g=a.cloneRange();g.collapse(d);f=e.createElement("span");f.id=b;f.style.lineHeight="0";f.style.display="none";f.className="rangySelectionBoundary";f.appendChild(e.createTextNode(i));g.insertNode(f);g.detach();return f}function d(a,d,f,e){(a=(a||document).getElementById(f))?(d[e?"setStartBefore":"setEndBefore"](a),a.parentNode.removeChild(a)): -b.warn("Marker element has been removed. Cannot restore selection.")}function f(a,d){return d.compareBoundaryPoints(a.START_TO_START,a)}function g(a,d){var b=(a||document).getElementById(d);b&&b.parentNode.removeChild(b)}e.requireModules(["DomUtil","DomRange","WrappedRange"]);var h=e.dom,i="\ufeff";e.saveSelection=function(d){var d=d||window,g=d.document;if(e.isSelectionValid(d)){var h=e.getSelection(d),i=h.getAllRanges(),o=[],k,r;i.sort(f);for(var j=0,q=i.length;j<q;++j)k=i[j],k.collapsed?(r=a(k, -!1),o.push({markerId:r.id,collapsed:!0})):(r=a(k,!1),k=a(k,!0),o[j]={startMarkerId:k.id,endMarkerId:r.id,collapsed:!1,backwards:i.length==1&&h.isBackwards()});for(j=q-1;j>=0;--j)k=i[j],k.collapsed?k.collapseBefore((g||document).getElementById(o[j].markerId)):(k.setEndBefore((g||document).getElementById(o[j].endMarkerId)),k.setStartAfter((g||document).getElementById(o[j].startMarkerId)));h.setRanges(i);return{win:d,doc:g,rangeInfos:o,restored:!1}}else b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus.")}; -e.restoreSelection=function(a,f){if(!a.restored){for(var g=a.rangeInfos,h=e.getSelection(a.win),i=[],k=g.length,r=k-1,j,q;r>=0;--r){j=g[r];q=e.createRange(a.doc);if(j.collapsed)if(j=(a.doc||document).getElementById(j.markerId)){j.style.display="inline";var v=j.previousSibling;v&&v.nodeType==3?(j.parentNode.removeChild(j),q.collapseToPoint(v,v.length)):(q.collapseBefore(j),j.parentNode.removeChild(j))}else b.warn("Marker element has been removed. Cannot restore selection.");else d(a.doc,q,j.startMarkerId, -!0),d(a.doc,q,j.endMarkerId,!1);k==1&&q.normalizeBoundaries();i[r]=q}k==1&&f&&e.features.selectionHasExtend&&g[0].backwards?(h.removeAllRanges(),h.addRange(i[0],!0)):h.setRanges(i);a.restored=!0}};e.removeMarkerElement=g;e.removeMarkers=function(a){for(var d=a.rangeInfos,b=0,f=d.length,e;b<f;++b)e=d[b],e.collapsed?g(a.doc,e.markerId):(g(a.doc,e.startMarkerId),g(a.doc,e.endMarkerId))}}); -rangy.createModule("Serializer",function(e,b){function a(d,b){var b=b||[],f=d.nodeType,e=d.childNodes,g=e.length,h=[f,d.nodeName,g].join(":"),i="",l="";switch(f){case 3:i=d.nodeValue.replace(/</g,"<").replace(/>/g,">");break;case 8:i="<\!--"+d.nodeValue.replace(/</g,"<").replace(/>/g,">")+"--\>";break;default:i="<"+h+">",l="</>"}i&&b.push(i);for(f=0;f<g;++f)a(e[f],b);l&&b.push(l);return b}function d(d){d=a(d).join("");return s(d).toString(16)}function f(a,d,b){for(var f=[],e=a,b=b||o.getDocument(a).documentElement;e&& -e!=b;)f.push(o.getNodeIndex(e,!0)),e=e.parentNode;return f.join("/")+":"+d}function g(a,d,f){d?f||o.getDocument(d):d=(f||document).documentElement;for(var a=a.split(":"),f=a[0]?a[0].split("/"):[],e=f.length,g;e--;)if(g=parseInt(f[e],10),g<d.childNodes.length)d=d.childNodes[parseInt(f[e],10)];else throw b.createError("deserializePosition failed: node "+o.inspectNode(d)+" has no child with index "+g+", "+e);return new o.DomPosition(d,parseInt(a[1],10))}function h(a,b,g){g=g||e.DomRange.getRangeDocument(a).documentElement; -if(!o.isAncestorOf(g,a.commonAncestorContainer,!0))throw Error("serializeRange: range is not wholly contained within specified root node");a=f(a.startContainer,a.startOffset,g)+","+f(a.endContainer,a.endOffset,g);b||(a+="{"+d(g)+"}");return a}function i(a,b,f){b?f=f||o.getDocument(b):(f=f||document,b=f.documentElement);var a=/^([^,]+),([^,\{]+)({([^}]+)})?$/.exec(a),h=a[4],i=d(b);if(h&&h!==d(b))throw Error("deserializeRange: checksums of serialized range root node ("+h+") and target root node ("+ -i+") do not match");h=g(a[1],b,f);b=g(a[2],b,f);f=e.createRange(f);f.setStart(h.node,h.offset);f.setEnd(b.node,b.offset);return f}function l(a,b,f){b?f||o.getDocument(b):b=(f||document).documentElement;a=/^([^,]+),([^,]+)({([^}]+)})?$/.exec(a)[3];return!a||a===d(b)}function t(a,d,b){for(var a=a||e.getSelection(),a=a.getAllRanges(),f=[],g=0,i=a.length;g<i;++g)f[g]=h(a[g],d,b);return f.join("|")}function n(a,d,b){d?b=b||o.getWindow(d):(b=b||window,d=b.document.documentElement);for(var a=a.split("|"), -f=e.getSelection(b),g=[],h=0,l=a.length;h<l;++h)g[h]=i(a[h],d,b.document);f.setRanges(g);return f}e.requireModules(["WrappedSelection","WrappedRange"]);(typeof encodeURIComponent=="undefined"||typeof decodeURIComponent=="undefined")&&b.fail("Global object is missing encodeURIComponent and/or decodeURIComponent method");var s=function(){var a=null;return function(d){for(var b=[],f=0,e=d.length,g;f<e;++f)g=d.charCodeAt(f),g<128?b.push(g):g<2048?b.push(g>>6|192,g&63|128):b.push(g>>12|224,g>>6&63|128, -g&63|128);d=-1;if(!a){for(var f=[],e=0,h;e<256;++e){h=e;for(g=8;g--;)(h&1)==1?h=h>>>1^3988292384:h>>>=1;f[e]=h>>>0}a=f}f=a;e=0;for(g=b.length;e<g;++e)h=(d^b[e])&255,d=d>>>8^f[h];return(d^-1)>>>0}}(),o=e.dom;e.serializePosition=f;e.deserializePosition=g;e.serializeRange=h;e.deserializeRange=i;e.canDeserializeRange=l;e.serializeSelection=t;e.deserializeSelection=n;e.canDeserializeSelection=function(a,d,b){var f;d?f=b?b.document:o.getDocument(d):d=(b||window).document.documentElement;for(var a=a.split("|"), -b=0,e=a.length;b<e;++b)if(!l(a[b],d,f))return!1;return!0};e.restoreSelectionFromCookie=function(a){var a=a||window,d;a:{d=a.document.cookie.split(/[;,]/);for(var b=0,f=d.length,e;b<f;++b)if(e=d[b].split("="),e[0].replace(/^\s+/,"")=="rangySerializedSelection"&&(e=e[1])){d=decodeURIComponent(e.replace(/\s+$/,""));break a}d=null}d&&n(d,a.doc)};e.saveSelectionCookie=function(a,d){var a=a||window,d=typeof d=="object"?d:{},b=d.expires?";expires="+d.expires.toUTCString():"",f=d.path?";path="+d.path:"", -g=d.domain?";domain="+d.domain:"",h=d.secure?";secure":"",i=t(e.getSelection(a));a.document.cookie=encodeURIComponent("rangySerializedSelection")+"="+encodeURIComponent(i)+b+f+g+h};e.getElementChecksum=d}); -(function(){var e,b;e={changeIdAttribute:"data-cid",userIdAttribute:"data-userid",userNameAttribute:"data-username",timeAttribute:"data-time",attrValuePrefix:"",blockEl:"p",stylePrefix:"cts",currentUser:{id:null,name:null},changeTypes:{insertType:{tag:"insert",alias:"ins",action:"Inserted"},deleteType:{tag:"delete",alias:"del",action:"Deleted"}},handleEvents:!1,contentEditable:!0,isTracking:!0,noTrack:".ice-no-track",avoid:".ice-avoid"};b=function(a){a||(a={});if(!a.element)throw Error("`options.element` must be defined for ice construction."); -ice.dom.extend(!0,this,e,a);this.pluginsManager=new ice.IcePluginManager(this);a.plugins&&this.pluginsManager.usePlugins("ice-init",a.plugins)};b.prototype={_changes:{},_userStyles:{},_styles:{},_uniqueStyleIndex:0,_browserType:null,_batchChangeid:null,_uniqueIDIndex:1,_delBookmark:"tempdel",isPlaceHoldingDeletes:!1,startTracking:function(){this.element.setAttribute("contentEditable",this.contentEditable);if(this.handleEvents){var a=this;ice.dom.bind(a.element,"keyup.ice keydown.ice keypress.ice mousedown.ice mouseup.ice", -function(d){return a.handleEvent(d)})}this.initializeEnvironment();this.initializeEditor();this.initializeRange();this.pluginsManager.fireEnabled(this.element);return this},stopTracking:function(){this.element.setAttribute("contentEditable",!this.contentEditable);this.handleEvents&&ice.dom.unbind(this.element,"keyup.ice keydown.ice keypress.ice mousedown.ice mouseup.ice");this.pluginsManager.fireDisabled(this.element);return this},initializeEnvironment:function(){this.env||(this.env={});this.env.element= -this.element;this.env.document=this.element.ownerDocument;this.env.window=this.env.document.defaultView||this.env.document.parentWindow||window;this.env.frame=this.env.window.frameElement;this.env.selection=this.selection=new ice.Selection(this.env);this.env.document.createElement(this.changeTypes.insertType.tag);this.env.document.createElement(this.changeTypes.deleteType.tag)},initializeRange:function(){var a=this.selection.createRange();a.setStart(ice.dom.find(this.element,this.blockEl)[0],0);a.collapse(!0); -this.selection.addRange(a);this.env.frame?this.env.frame.contentWindow.focus():this.element.focus()},initializeEditor:function(){var a=this,d=this.env.document.createElement("div");this.element.childNodes.length?(ice.dom.each(ice.dom.contents(this.element),function(a,b){ice.dom.isBlockElement(b)&&d.appendChild(b)}),d.innerHTML===""&&d.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">"))):d.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">"));this.element.innerHTML= -d.innerHTML;var b=[],e;for(e in this.changeTypes)b.push(this._getIceNodeClass(e));ice.dom.each(ice.dom.find(this.element,"."+b.join(", .")),function(d,e){for(var g=0,t="",n=e.className.split(" "),d=0;d<n.length;d++){var s=RegExp(a.stylePrefix+"-(\\d+)").exec(n[d]);s&&(g=s[1]);(s=RegExp("("+b.join("|")+")").exec(n[d]))&&(t=a._getChangeTypeFromAlias(s[1]))}n=ice.dom.attr(e,a.userIdAttribute);a.setUserStyle(n,Number(g));g=ice.dom.attr(e,a.changeIdAttribute);a._changes[g]={type:t,userid:n,username:ice.dom.attr(e, -a.userNameAttribute),time:ice.dom.attr(e,a.timeAttribute)}})},enableChangeTracking:function(){this.isTracking=!0;this.pluginsManager.fireEnabled(this.element)},disableChangeTracking:function(){this.isTracking=!1;this.pluginsManager.fireDisabled(this.element)},setCurrentUser:function(a){this.currentUser=a},handleEvent:function(a){if(this.isTracking)if(a.type=="mouseup"){var d=this;setTimeout(function(){d.mouseUp(a)},200)}else if(a.type=="mousedown")return this.mouseDown(a);else if(a.type=="keypress"){var b= -this.keyPress(a);b||a.preventDefault();return b}else if(a.type=="keydown")return(b=this.keyDown(a))||a.preventDefault(),b;else a.type=="keyup"&&this.pluginsManager.fireCaretUpdated()},createIceNode:function(a,d){var b=this.env.document.createElement(this.changeTypes[a].tag);ice.dom.addClass(b,this._getIceNodeClass(a));b.appendChild(d?d:this.env.document.createTextNode(""));this.addChange(this.changeTypes[a].alias,[b]);this.pluginsManager.fireNodeCreated(b,{action:this.changeTypes[a].action});return b}, -insert:function(a,d){d?this.selection.addRange(d):d=this.getCurrentRange();typeof a==="string"&&(a=document.createTextNode(a));if(!d.collapsed&&(this.deleteContents(),d=this.getCurrentRange(),d.startContainer===d.endContainer&&this.element===d.startContainer)){ice.dom.empty(this.element);var b=d.getLastSelectableChild(this.element);d.setStartAfter(b);d.collapse(!0)}this._moveRangeToValidTrackingPos(d);b=this.startBatchChange();this._insertNode(a||document.createTextNode("\ufeff"),d,!a);this.pluginsManager.fireNodeInserted(a, -d);this.endBatchChange(b);return!1},placeholdDeletes:function(){var a=this;this.isPlaceholdingDeletes&&this.revertDeletePlaceholders();this.isPlaceholdingDeletes=!0;this._deletes=[];var d="."+this._getIceNodeClass("deleteType");ice.dom.each(ice.dom.find(this.element,d),function(d,b){a._deletes.push(ice.dom.cloneNode(b));ice.dom.replaceWith(b,"<"+a._delBookmark+' data-allocation="'+(a._deletes.length-1)+'"/>')});return!0},revertDeletePlaceholders:function(){var a=this;if(!this.isPlaceholdingDeletes)return!1; -ice.dom.each(this._deletes,function(d,b){ice.dom.find(a.element,a._delBookmark+"[data-allocation="+d+"]").replaceWith(b)});this.isPlaceholdingDeletes=!1;return!0},deleteContents:function(a,d){var b=!0;d?this.selection.addRange(d):d=this.getCurrentRange();var e=this.startBatchChange(this.changeTypes.deleteType.alias);d.collapsed===!1?this._deleteFromSelection(d):b=a?this._deleteFromRight(d):this._deleteFromLeft(d);this.selection.addRange(d);this.endBatchChange(e);return b},getChanges:function(){return this._changes}, -getElementContent:function(){return this.element.innerHTML},getCleanContent:function(a,d,b){var e="",h=this;ice.dom.each(this.changeTypes,function(a,d){a!="deleteType"&&(d>0&&(e+=","),e+="."+h._getIceNodeClass(a))});a=a?typeof a==="string"?ice.dom.create("<div>"+a+"</div>"):ice.dom.cloneNode(a)[0]:ice.dom.cloneNode(this.element)[0];a=b?b.call(this,a):a;b=ice.dom.find(a,e);ice.dom.each(b,function(){ice.dom.replaceWith(this,ice.dom.contents(this))});b=ice.dom.find(a,"."+this._getIceNodeClass("deleteType")); -ice.dom.remove(b);a=d?d.call(this,a):a;return a.innerHTML},acceptAll:function(){this.element.innerHTML=this.getCleanContent()},rejectAll:function(){var a="."+this._getIceNodeClass("insertType"),d="."+this._getIceNodeClass("deleteType");ice.dom.remove(ice.dom.find(this.element,a));ice.dom.each(ice.dom.find(this.element,d),function(a,d){ice.dom.replaceWith(d,ice.dom.contents(d))})},acceptChange:function(a){this.acceptRejectChange(a,!0)},rejectChange:function(a){this.acceptRejectChange(a,!1)},acceptRejectChange:function(a, -d){var b,e,h,i,l,t,n=ice.dom;if(!a)if(b=this.getCurrentRange(),b.collapsed)a=b.startContainer;else return;b=h="."+this._getIceNodeClass("deleteType");e=i="."+this._getIceNodeClass("insertType");l=n.getNode(a,b+","+e);t=n.find(this.element,"["+this.changeIdAttribute+"="+n.attr(l,this.changeIdAttribute)+"]");d||(h=e,i=b);ice.dom.is(l,i)?n.each(t,function(a,d){n.replaceWith(d,ice.dom.contents(d))}):n.is(l,h)&&n.remove(t)},isInsideChange:function(a){var d="."+this._getIceNodeClass("insertType")+", ."+ -this._getIceNodeClass("deleteType");if(!a)if(range=this.getCurrentRange(),range.collapsed)a=range.startContainer;else return!1;return!!ice.dom.getNode(a,d)},addChangeType:function(a,d,b,e){d={tag:d,alias:b};if(e)d.action=e;this.changeTypes[a]=d},getIceNode:function(a,d){var b="."+this._getIceNodeClass(d);return ice.dom.getNode(a,b)},_moveRangeToValidTrackingPos:function(a){for(var d=!1,b=this._getVoidElement(a.endContainer);b;){try{a.moveEnd(ice.dom.CHARACTER_UNIT,1),a.moveEnd(ice.dom.CHARACTER_UNIT, --1)}catch(e){d=!0}if(d||ice.dom.onBlockBoundary(a.endContainer,a.startContainer,this.blockEl)){a.setStartAfter(b);a.collapse(!0);break}(b=this._getVoidElement(a.endContainer))?(a.setEnd(a.endContainer,0),a.moveEnd(ice.dom.CHARACTER_UNIT,ice.dom.getNodeTextContent(a.endContainer).length),a.collapse()):(a.setStart(a.endContainer,0),a.collapse(!0))}},_getNoTrackElement:function(a){var d=this._getNoTrackSelector();return ice.dom.is(a,d)?a:ice.dom.parents(a,d)[0]||null},_getNoTrackSelector:function(){return this.noTrack}, -_getVoidElement:function(a){var d=this._getVoidElSelector();return ice.dom.is(a,d)?a:ice.dom.parents(a,d)[0]||null},_getVoidElSelector:function(){return"."+this._getIceNodeClass("deleteType")+","+this.avoid},_currentUserIceNode:function(a){return ice.dom.attr(a,this.userIdAttribute)==this.currentUser.id},_getChangeTypeFromAlias:function(a){var d,b=null;for(d in this.changeTypes)this.changeTypes.hasOwnProperty(d)&&this.changeTypes[d].alias==a&&(b=d);return b},_getIceNodeClass:function(a){return this.attrValuePrefix+ -this.changeTypes[a].alias},getUserStyle:function(a){var d=null;return d=this._userStyles[a]?this._userStyles[a]:this.setUserStyle(a,this.getNewStyleId())},setUserStyle:function(a,d){var b=this.stylePrefix+"-"+d;this._styles[d]||(this._styles[d]=!0);return this._userStyles[a]=b},getNewStyleId:function(){var a=++this._uniqueStyleIndex;return this._styles[a]?this.getNewStyleId():(this._styles[a]=!0,a)},addChange:function(a,d){var b=this._batchChangeid||this.getNewChangeId();this._changes[b]||(this._changes[b]= -{type:this._getChangeTypeFromAlias(a),time:(new Date).getTime(),userid:this.currentUser.id,username:this.currentUser.name});var e=this;ice.dom.foreach(d,function(a){e.addNodeToChange(b,d[a])});return b},addNodeToChange:function(a,d){if(this._batchChangeid!==null)a=this._batchChangeid;var b=this.getChange(a);d.getAttribute(this.changeIdAttribute)||d.setAttribute(this.changeIdAttribute,a);d.getAttribute(this.userIdAttribute)||d.setAttribute(this.userIdAttribute,b.userid);d.getAttribute(this.userNameAttribute)|| -d.setAttribute(this.userNameAttribute,b.username);d.getAttribute(this.timeAttribute)||d.setAttribute(this.timeAttribute,b.time);ice.dom.hasClass(d,this._getIceNodeClass(b.type))||ice.dom.addClass(d,this._getIceNodeClass(b.type));b=this.getUserStyle(b.userid);ice.dom.hasClass(d,b)||ice.dom.addClass(d,b)},getChange:function(a){var d=null;this._changes[a]&&(d=this._changes[a]);return d},getNewChangeId:function(){var a=++this._uniqueIDIndex;this._changes[a]&&(a=this.getNewChangeId());return a},startBatchChange:function(){return this._batchChangeid= -this.getNewChangeId()},endBatchChange:function(a){if(a===this._batchChangeid)this._batchChangeid=null},getCurrentRange:function(){return this.selection.getRangeAt(0)},_insertNode:function(a,d,b){var e=this._currentUserIceNode(this.getIceNode(d.startContainer,"insertType"));if(!b||!e)e||(a=this.createIceNode("insertType",a)),d.insertNode(a),d.setEnd(a,1),d.collapse(),b&&(d.setStart(a,0),d.setEnd(a,1)),this.selection.addRange(d)},_deleteFromSelection:function(a){for(var d=new ice.Bookmark(this.env, -a),b=ice.dom.getElementsBetween(d.start,d.end),e=ice.dom.parents(a.startContainer,this.blockEl)[0],h=ice.dom.parents(a.endContainer,this.blockEl)[0],i=[],l=b.length,t=0;t<l;t++){var n=b[t];ice.dom.is(n,this.blockEl)&&i.push(n);if(!(n.nodeType===ice.dom.TEXT_NODE&&ice.dom.getNodeTextContent(n)==="")){if(n.hasChildNodes())for(var s=0;s<n.childNodes.length;s++){var o=n.childNodes[s];(this._getNoTrackElement(o)||this._currentUserIceNode(o))&&ice.dom.remove(o)}(this._getNoTrackElement(n)||this._currentUserIceNode(n))&& -ice.dom.remove(n);if(!this._getVoidElement(n)){if(n.nodeType!==ice.dom.TEXT_NODE)if(ice.dom.remove(ice.dom.find(n,"br")),s=ice.dom.cloneNode(n),ice.dom.remove(ice.dom.find(s,this._getVoidElSelector())),ice.dom.getNodeTextContent(s).length===0)continue;else if(ice.dom.is(n,this.blockEl)){s=this.createIceNode("deleteType");newEl=document.createElement(this.blockEl);s.innerHTML=n.innerHTML;n.innerHTML="";n.appendChild(s);continue}s=this.createIceNode("deleteType");ice.dom.insertBefore(n,s);s.appendChild(n)}}}if(e!== -h){for(;i.length;)ice.dom.mergeContainers(i.shift(),e);ice.dom.mergeContainers(h,e)}(b=d.start.previousSibling)?(d.selectBookmark(),a=this.getCurrentRange(),a.moveStart(ice.dom.CHARACTER_UNIT,-1),a.moveStart(ice.dom.CHARACTER_UNIT,1)):(b=this.env.document.createTextNode(""),ice.dom.insertBefore(d.start,b),this.selection.addRange(a),d.selectBookmark(),a=this.getCurrentRange(),a.setStart(b,0));a.collapse(!0)},_deleteFromRight:function(a){var d=ice.dom.parents(a.startContainer,this.blockEl)[0]||ice.dom.is(a.startContainer, -this.blockEl)&&a.startContainer||null,b=d&&d.nextSibling||null,e=ice.dom.is(a.startContainer,this.blockEl)&&ice.dom.getNodeTextContent(a.startContainer)=="";a.moveEnd(ice.dom.CHARACTER_UNIT,1);a.moveEnd(ice.dom.CHARACTER_UNIT,-1);if(!b&&!ice.dom.isChildOf(a.endContainer,this.element))return a.moveEnd(ice.dom.CHARACTER_UNIT,-1),a.moveEnd(ice.dom.CHARACTER_UNIT,1),a.collapse(),!0;if((ice.dom.onBlockBoundary(a.endContainer,a.startContainer,this.blockEl)||e)&&!this._getVoidElement(d))return b!==ice.dom.parents(a.endContainer, -this.blockEl)[0]&&a.setEnd(b,0),ice.dom.remove(ice.dom.find(a.startContainer,"br")),ice.dom.mergeBlockWithSibling(a,ice.dom.parents(a.startContainer,this.blockEl)[0]||d,!0);if(this._getVoidElement(a.endContainer))return a.setEnd(a.endContainer,0),a.moveEnd(ice.dom.CHARACTER_UNIT,ice.dom.getNodeTextContent(a.endContainer).length||0),a.collapse(),this._deleteFromRight(a);if(this._getNoTrackElement(a.endContainer.parentElement))return a.deleteContents(),!1;a.collapse();d=a.startContainer;if(a.startContainer.data&& -a.endOffset===d.data.length){b=a.cloneRange();b.moveEnd(ice.dom.CHARACTER_UNIT,1);if(e=ice.dom.getBlockParent(b.endContainer,this.element)){if(ice.dom.isChildOf(e,this.element)===!1)return;var h=ice.dom.getBlockParent(b.startContainer,this.element);if(e!==h){ice.dom.mergeContainers(e,h);a.setStart(b.startContainer,b.startContainer.data.length);a.collapse(!0);return}}d=a.getNextContainer(d);if(ice.dom.isChildOf(d,this.element)===!1)return!1;d=a.getFirstSelectableChild(d);a.setStart(d,0);this._addTextNodeTracking(d, -a)}else if(d=this.getIceNode(a.startContainer,"insertType"),d===null||!this._currentUserIceNode(d))this._addTextNodeTracking(a.startContainer,a,!0);else if(a.moveEnd(ice.dom.CHARACTER_UNIT,1),a.deleteContents(),d!==null&&ice.dom.isBlank(ice.dom.getNodeTextContent(d))===!0){b=d.previousSibling;if(!b||b.nodeType!==ice.dom.TEXT_NODE)b=this.env.document.createTextNode(""),ice.dom.insertBefore(d,b);a.setStart(b,b.data.length);ice.dom.remove(d)}a.collapse(!0);return!0},_deleteFromLeft:function(a){var d= -ice.dom.parents(a.startContainer,this.blockEl)[0]||ice.dom.is(a.startContainer,this.blockEl)&&a.startContainer||null,b=d&&d.previousSibling||null,e=ice.dom.is(a.startContainer,this.blockEl)&&ice.dom.getNodeTextContent(a.startContainer)=="";a.moveStart(ice.dom.CHARACTER_UNIT,-1);var h=a.startOffset===a.endOffset&&a.startContainer===a.endContainer,i=!ice.dom.isChildOf(a.startContainer,this.element);if(h||!b&&i)return b&&a.moveStart(ice.dom.CHARACTER_UNIT,1),a.collapse(!0),!0;a.moveStart(ice.dom.CHARACTER_UNIT, -1);if((ice.dom.onBlockBoundary(a.startContainer,a.endContainer,this.blockEl)||e)&&this._getVoidElement(b))return a.deleteContents(),!1;if(this._getVoidElement(a.startContainer))return a.setStart(a.startContainer,0),a.collapse(!0),this._deleteFromLeft(a);if(ice.dom.onBlockBoundary(a.startContainer,a.endContainer,this.blockEl)||e)return b!==ice.dom.parents(a.startContainer,this.blockEl)[0]&&a.setStart(b,0),ice.dom.remove(ice.dom.find(a.startContainer,"br")),ice.dom.mergeBlockWithSibling(a,ice.dom.parents(a.endContainer, -this.blockEl)[0]||d);if(this._getNoTrackElement(a.startContainer.parentElement))return a.deleteContents(),!1;d=a.startContainer;if(a.startOffset===0){b=a.cloneRange();b.moveStart(ice.dom.CHARACTER_UNIT,-1);if(e=ice.dom.getBlockParent(b.startContainer,this.element)){if(ice.dom.isChildOf(e,this.element)===!1)return!1;h=ice.dom.getBlockParent(b.endContainer,this.element);if(h!==e){ice.dom.mergeContainers(h,e);a.setStart(b.startContainer,b.startContainer.data.length);a.collapse(!0);return}}d=a.getPreviousContainer(d); -if(!ice.dom.isChildOf(d,this.element))return!1;ice.dom.isStubElement(d)?(a.moveStart(ice.dom.CHARACTER_UNIT,-1),ice.dom.addClass(d,this._getIceNodeClass("deleteType")),ice.dom.attr(d,"title","Content removed"),a.collapse(!0)):(d=a.getLastSelectableChild(d),a.setStart(d,d.data.length),this._addTextNodeTracking(d,a))}else b=a.startContainer,d=this.getIceNode(b,"insertType"),d===null||!this._currentUserIceNode(d)?this._addTextNodeTracking(b,a):(a.moveStart(ice.dom.CHARACTER_UNIT,-1),a.moveEnd(ice.dom.CHARACTER_UNIT, --1),a.moveEnd(ice.dom.CHARACTER_UNIT,1),a.deleteContents(),d!==null&&ice.dom.isBlank(ice.dom.getNodeTextContent(d))&&(b=this.env.document.createTextNode(""),ice.dom.insertBefore(d,b),a.setStart(b,0),a.collapse(!0),ice.dom.replaceWith(d,ice.dom.contents(d))));return!0},_addTextNodeTracking:function(a,d,b){if(!(!b&&d.startOffset===0||this.getIceNode(a,"deleteType")!==null)){var e="",h="",i="";b?(e=a.nodeValue.substring(0,d.endOffset),h=a.nodeValue.substr(d.endOffset,1),i=a.nodeValue.substring(d.endOffset+ -1)):(e=a.nodeValue.substring(0,d.startOffset-1),h=a.nodeValue.substr(d.startOffset-1,1),i=a.nodeValue.substring(d.startOffset));if(d.startOffset===1&&!b||b&&d.startOffset===0){var l=this.getIceNode(a.previousSibling,"deleteType");l!==null&&!this._currentUserIceNode(l)&&(l=null);if(l){if(b)if(l.lastChild&&l.lastChild.nodeType===ice.dom.TEXT_NODE?l.lastChild.nodeValue+=h:(b=this.env.document.createTextNode(h),l.appendChild(b)),a.nodeValue=e+i,a.nodeValue.length===0){b=!1;for(a=a.nextSibling;!b;)(l= -this.getIceNode(a,"deleteType"))?a=a.nextSibling:b=!0;a&&(d.setStart(a,0),d.collapse(!0))}else d.setStart(a,0),d.collapse(!0);else if(l.lastChild&&l.lastChild.nodeType===ice.dom.TEXT_NODE?(l.lastChild.nodeValue+=h,d.setStart(l.lastChild,l.lastChild.nodeValue.length-1)):(b=this.env.document.createTextNode(h),l.appendChild(b),d.setStart(b,0)),a.nodeValue=e+i,a.nodeValue=e+i,a.nodeValue.length===0){b=!1;for(a=a.previousSibling;!b;)(l=this.getIceNode(a,"deleteType"))?a=a.previousSibling:b=!0;a&&(a=d.getLastSelectableChild(a), -d.setStart(a,a.nodeValue.length),d.collapse(!0))}else d.collapse(!0);return}}if(d.startOffset===a.nodeValue.length&&(l=this.getIceNode(a.nextSibling,"deleteType"),l!==null&&!this._currentUserIceNode(l)&&(l=null),l)){l.firstChild&&l.firstChild.nodeType===ice.dom.TEXT_NODE?l.firstChild.nodeValue=h+l.firstChild.nodeValue:(b=this.env.document.createTextNode(h),ice.dom.insertBefore(l.firstChild,b));a.nodeValue=e;d.setStart(a,a.nodeValue.length);d.setEnd(a,a.nodeValue.length);return}l=this.createIceNode("deleteType"); -e=null;b!==!0?(e=a.splitText(d.startOffset-1),e.nodeValue=e.nodeValue.substring(1),ice.dom.insertAfter(a,e),l.firstChild.nodeValue=h,ice.dom.insertAfter(a,l),d.setStart(a,a.nodeValue.length),d.setEnd(a,a.nodeValue.length)):(e=a.splitText(d.endOffset),e.nodeValue=e.nodeValue.substring(1),ice.dom.insertAfter(a,e),l.firstChild.nodeValue=h,ice.dom.insertAfter(a,l),d.setStart(e,0),d.setEnd(e,0))}},_handleAncillaryKey:function(a){var d=!0;switch(a.keyCode){case ice.dom.DOM_VK_DELETE:d=this.deleteContents(); -this.pluginsManager.fireKeyPressed(a);break;case 46:d=this.deleteContents(!0);this.pluginsManager.fireKeyPressed(a);break;case ice.dom.DOM_VK_DOWN:case ice.dom.DOM_VK_UP:case ice.dom.DOM_VK_LEFT:case ice.dom.DOM_VK_RIGHT:this.pluginsManager.fireCaretPositioned();d=!1;break;default:d=!1}return d===!0?(ice.dom.preventDefault(a),!1):!0},keyDown:function(a){if(!this.pluginsManager.fireKeyDown(a))return ice.dom.preventDefault(a),!1;var d=!1;if(this._handleSpecialKey(a)===!1){if(ice.dom.isBrowser("msie")!== -!0)this._preventKeyPress=!0;return!1}else if((a.ctrlKey===!0||a.metaKey===!0)&&(ice.dom.isBrowser("msie")===!0||ice.dom.isBrowser("chrome")===!0)&&!this.pluginsManager.fireKeyPressed(a))return!1;switch(a.keyCode){case 27:break;default:/Firefox/.test(navigator.userAgent)!==!0&&(d=!this._handleAncillaryKey(a))}return d?(ice.dom.preventDefault(a),!1):!0},keyPress:function(a){if(this._preventKeyPress===!0)this._preventKeyPress=!1;else{if(!this.pluginsManager.fireKeyPressed(a))return!1;var d=null;a.which== -null?d=String.fromCharCode(a.keyCode):a.which>0&&(d=String.fromCharCode(a.which));var b=this.getCurrentRange(),e=ice.dom.parents(b.startContainer,"br")[0]||null;e&&(b.moveToNextEl(e),e.parentNode.removeChild(e));if(d!==null&&a.ctrlKey!==!0&&a.metaKey!==!0)switch(a.keyCode){case ice.dom.DOM_VK_DELETE:break;case ice.dom.DOM_VK_ENTER:return this._handleEnter();default:return this._moveRangeToValidTrackingPos(b,b.startContainer),this.insert(d)}return this._handleAncillaryKey(a)}},_handleEnter:function(){this.getCurrentRange().collapsed|| -this.deleteContents();return!0},_handleSpecialKey:function(a){var d=a.which;if(d===null)d=a.keyCode;var b=!1;switch(d){case 65:if(a.ctrlKey===!0||a.metaKey===!0){b=!0;d=this.getCurrentRange();if(ice.dom.isBrowser("msie")===!0){var e=this.env.document.createTextNode(""),h=this.env.document.createTextNode("");this.element.firstChild?ice.dom.insertBefore(this.element.firstChild,e):this.element.appendChild(e);this.element.appendChild(h);d.setStart(e,0);d.setEnd(h,0)}else d.setStart(d.getFirstSelectableChild(this.element), -0),e=d.getLastSelectableChild(this.element),d.setEnd(e,e.length);this.selection.addRange(d)}}return b===!0?(ice.dom.preventDefault(a),!1):!0},mouseUp:function(a){if(!this.pluginsManager.fireClicked(a))return!1;this.pluginsManager.fireSelectionChanged(this.getCurrentRange())},mouseDown:function(a){if(!this.pluginsManager.fireMouseDown(a))return!1;this.pluginsManager.fireCaretUpdated()}};this.ice=this.ice||{};this.ice.InlineChangeEditor=b}).call(this); -(function(){var e={DOM_VK_DELETE:8,DOM_VK_LEFT:37,DOM_VK_UP:38,DOM_VK_RIGHT:39,DOM_VK_DOWN:40,DOM_VK_ENTER:13,ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,CHARACTER_UNIT:"character",WORD_UNIT:"word",getKeyChar:function(b){return String.fromCharCode(b.which)},getClass:function(b,a,d){if(!a)a=document.body;b="."+b.split(" ").join("."); -d&&(b=d+b);return jQuery.makeArray(jQuery(a).find(b))},getId:function(b,a){a||(a=document);return element=a.getElementById(b)},getTag:function(b,a){a||(a=document);return jQuery.makeArray(jQuery(a).find(b))},getElementWidth:function(b){return b.offsetWidth},getElementHeight:function(b){return b.offsetHeight},getElementDimensions:function(b){return{width:e.getElementWidth(b),height:e.getElementHeight(b)}},trim:function(b){return jQuery.trim(b)},empty:function(b){if(b)return jQuery(b).empty()},remove:function(b){if(b)return jQuery(b).remove()}, -prepend:function(b,a){jQuery(b).prepend(a)},append:function(b,a){jQuery(b).append(a)},insertBefore:function(b,a){jQuery(b).before(a)},insertAfter:function(b,a){jQuery(b).after(a)},getHtml:function(b){return jQuery(b).html()},setHtml:function(b,a){b&&jQuery(b).html(a)},contents:function(b){return jQuery(b).contents()},extractContent:function(b){for(var a=document.createDocumentFragment(),d;d=b.firstChild;)a.appendChild(d);return a}};e.getNode=function(b,a){return e.is(b,a)?b:e.parents(b,a)[0]||null}; -e.getParents=function(b,a,d){for(var b=jQuery(b).parents(a),a=b.length,e=[],g=0;g<a;g++){if(b[g]===d)break;e.push(b[g])}return e};e.hasBlockChildren=function(b){for(var a=b.childNodes.length,d=0;d<a;d++)if(b.childNodes[d].nodeType===e.ELEMENT_NODE&&e.isBlockElement(b.childNodes[d])===!0)return!0;return!1};e.removeTag=function(b,a){jQuery(b).find(a).replaceWith(function(){return jQuery(this).contents()});return b};e.stripEnclosingTags=function(b,a){var d=jQuery(b);d.find("*").not(a).replaceWith(function(){return jQuery(this).contents()}); -return d[0]};e.getSiblings=function(b,a,d,e){if(d===!0)return a==="prev"?jQuery(b).prevAll():jQuery(b).nextAll();else{d=[];if(a==="prev")for(;b.previousSibling;){b=b.previousSibling;if(b===e)break;d.push(b)}else for(;b.nextSibling;){b=b.nextSibling;if(b===e)break;d.push(b)}return d}};e.getNodeTextContent=function(b){return jQuery(b).text()};e.setNodeTextContent=function(b,a){return jQuery(b).text(a)};e.getTagName=function(b){return b.tagName&&b.tagName.toLowerCase()||null};e.getIframeDocument=function(b){var a= -null;if(b.contentDocument)a=b.contentDocument;else if(b.contentWindow)a=b.contentWindow.document;else if(b.document)a=b.document;return a};e.isBlockElement=function(b){switch(b.nodeName.toLowerCase()){case "p":case "div":case "pre":case "ul":case "ol":case "li":case "table":case "tbody":case "td":case "th":case "fieldset":case "form":case "blockquote":case "dl":case "dir":case "center":case "address":case "h1":case "h2":case "h3":case "h4":case "h5":case "h6":case "img":return!0;default:return!1}}; -e.isStubElement=function(b){if(b)switch(b.nodeName.toLowerCase()){case "img":case "br":case "hr":case "iframe":case "param":case "link":case "meta":case "input":case "frame":case "col":case "base":case "area":return!0}return!1};e.isChildOf=function(b,a){try{for(;b&&b.parentNode;){if(b.parentNode===a)return!0;b=b.parentNode}}catch(d){}return!1};e.isChildOfTagName=function(b,a){var d=null;try{for(;b&&b.parentNode;){if(b.parentNode&&b.parentNode.tagName&&b.parentNode.tagName.toLowerCase()===a)d=b.parentNode; -b=b.parentNode}}catch(e){}return d};e.isChildOfClassName=function(b,a){var d=null;try{for(;b&&b.parentNode;){if(jQuery(b.parentNode).hasClass(a))d=b.parentNode;b=b.parentNode}}catch(e){}return d};e.cloneNode=function(b,a){a===void 0&&(a=!0);return jQuery(b).clone(a)};e.bind=function(b,a,d){return jQuery(b).bind(a,d)};e.unbind=function(b,a,d){return jQuery(b).unbind(a,d)};e.attr=function(b,a,d){return d?jQuery(b).attr(a,d):jQuery(b).attr(a)};e.replaceWith=function(b,a){return jQuery(b).replaceWith(a)}; -e.removeAttr=function(b,a){jQuery(b).removeAttr(a)};e.getElementsBetween=function(b,a){var d=[];if(b===a)return d;if(e.isChildOf(a,b)===!0){for(var f=b.childNodes.length,g=0;g<f;g++)if(b.childNodes[g]===a)break;else if(e.isChildOf(a,b.childNodes[g])===!0)return e.arrayMerge(d,e.getElementsBetween(b.childNodes[g],a));else d.push(b.childNodes[g]);return d}for(f=b.nextSibling;f;)if(e.isChildOf(a,f)===!0)return d=e.arrayMerge(d,e.getElementsBetween(f,a));else if(f===a)return d;else d.push(f),f=f.nextSibling; -for(var f=e.getParents(b),g=e.getParents(a),f=e.arrayDiff(f,g,!0),g=f.length,h=0;h<g-1;h++)d=e.arrayMerge(d,e.getSiblings(f[h],"next"));return d=e.arrayMerge(d,e.getElementsBetween(f[f.length-1],a))};e.getCommonAncestor=function(b,a){for(var d=b;d;){if(e.isChildOf(a,d)===!0)return d;d=d.parentNode}return null};e.getNextNode=function(b){if(b.nextSibling)return b.nextSibling;else if(b.parentNode)return e.getFirstChild(b.parentNode);return null};e.getPrevNode=function(b){if(b.previousSibling)return b.previousSibling; -else if(b.parentNode)return e.getLastChild(b.parentNode);return null};e.getFirstChild=function(b){return b.firstChild?b.firstChild.nodeType===e.ELEMENT_NODE?e.getFirstChild(b.firstChild):b.firstChild:b};e.getLastChild=function(b){return b.lastChild?b.lastChild.nodeType===e.ELEMENT_NODE?e.getLastChild(b.lastChild):b.lastChild:b};e.removeEmptyNodes=function(b,a){for(var d=jQuery(b).find(":empty"),f=d.length;f>0;)f--,e.isStubElement(d[f])===!1&&(!a||a.call(this,d[f])!==!1)&&e.remove(d[f])};e.create= -function(b){return jQuery(b)[0]};e.find=function(b,a){return jQuery(b).find(a)};e.children=function(b,a){return jQuery(b).children(a)};e.parent=function(b,a){return jQuery(b).parent(a)[0]};e.parents=function(b,a){return jQuery(b).parents(a)};e.is=function(b,a){return jQuery(b).is(a)};e.extend=function(b,a,d,e){return jQuery.extend.apply(this,arguments)};e.walk=function(b,a,d){b&&(d||(d=0),a.call(this,b,d)!==!1&&(b.childNodes&&b.childNodes.length>0?e.walk(b.firstChild,a,d+1):b.nextSibling?e.walk(b.nextSibling, -a,d):b.parentNode&&b.parentNode.nextSibling&&e.walk(b.parentNode.nextSibling,a,d-1)))};e.revWalk=function(b,a){b&&a.call(this,b)!==!1&&(b.childNodes&&b.childNodes.length>0?e.walk(b.lastChild,a):b.previousSibling?e.walk(b.previousSibling,a):b.parentNode&&b.parentNode.previousSibling&&e.walk(b.parentNode.previousSibling,a))};e.setStyle=function(b,a,d){b&&jQuery(b).css(a,d)};e.getStyle=function(b,a){return jQuery(b).css(a)};e.hasClass=function(b,a){return jQuery(b).hasClass(a)};e.addClass=function(b, -a){jQuery(b).addClass(a)};e.removeClass=function(b,a){jQuery(b).removeClass(a)};e.preventDefault=function(b){b.preventDefault();e.stopPropagation(b)};e.stopPropagation=function(b){b.stopPropagation()};e.noInclusionInherits=function(b,a){if(a instanceof String||typeof a==="string")a=window[a];if(b instanceof String||typeof b==="string")b=window[b];var d=function(){};if(e.isset(a)===!0)for(value in a.prototype)b.prototype[value]?d.prototype[value]=a.prototype[value]:b.prototype[value]=a.prototype[value]; -if(b.prototype)d.prototype.constructor=a,b.prototype["super"]=new d};e.each=function(b,a){jQuery.each(b,function(d,b){a.call(this,d,b)})};e.foreach=function(b,a){if(b instanceof Array||b instanceof NodeList||typeof b.length!="undefined"&&typeof b.item!="undefined")for(var d=b.length,e=0;e<d;e++){var g=a.call(this,e,b[e]);if(g===!1)break}else for(d in b)if(b.hasOwnProperty(d)===!0&&(g=a.call(this,d),g===!1))break};e.isBlank=function(b){return!b||/^\s*$/.test(b)?!0:!1};e.isFn=function(b){return typeof b=== -"function"?!0:!1};e.isObj=function(b){return b!==null&&typeof b==="object"?!0:!1};e.isset=function(b){return typeof b!=="undefined"&&b!==null?!0:!1};e.isArray=function(b){return jQuery.isArray(b)};e.isNumeric=function(b){return b.match(/^\d+$/)!==null?!0:!1};e.getUniqueId=function(){return((new Date).getTime()+""+Math.ceil(Math.random()*1E6)).substr(5,18).replace(/,/,"")};e.inArray=function(b,a){for(var d=a.length,e=0;e<d;e++)if(b===a[e])return!0;return!1};e.arrayDiff=function(b,a,d){for(var f=b.length, -g=[],h=0;h<f;h++)e.inArray(b[h],a)===!1&&g.push(b[h]);if(d!==!0){f=a.length;for(h=0;h<f;h++)e.inArray(a[h],b)===!1&&g.push(a[h])}return g};e.arrayMerge=function(b,a){for(var d=a.length,e=0;e<d;e++)b.push(a[e]);return b};e.stripTags=function(b,a){if(typeof a==="string"){var d=jQuery("<div>"+b+"</div>");d.find("*").not(a).remove();return d.html()}else{for(var f=RegExp(/<\/?(\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim),g=b;(d=f.exec(b))!=null;)if(e.isset(a)===!1||e.inArray(d[1], -a)!==!0)g=g.replace(d[0],"");return g}};e.browser=function(){var b={};b.version=jQuery.browser.version;if(jQuery.browser.mozilla===!0)b.type="mozilla";else if(jQuery.browser.msie===!0)b.type="msie";else if(jQuery.browser.opera===!0)b.type="opera";else if(jQuery.browser.safari===!0)b.type="safari";return b};e.getBrowserType=function(){if(this._browserType===null){for(var b=["msie","firefox","chrome","safari"],a=b.length,d=0;d<a;d++)if(RegExp(b[d],"i").test(navigator.userAgent)===!0)return this._browserType= -b[d];this._browserType="other"}return this._browserType};e.isBrowser=function(b){return e.browser().type===b};e.getBlockParent=function(b,a){if(b)for(;b.parentNode;){b=b.parentNode;if(b===a)break;if(e.isBlockElement(b)===!0)return b}return null};e.onBlockBoundary=function(b,a,d){if(!b||!a)return!1;b=e.isChildOfTagName(b,d)||e.is(b,d)&&b||null;a=e.isChildOfTagName(a,d)||e.is(a,d)&&a||null;return b!==a};e.mergeContainers=function(b,a){if(!b||!a)return!1;if(b.nodeType===e.TEXT_NODE||e.isStubElement(b))a.appendChild(b); -else if(b.nodeType===e.ELEMENT_NODE){for(;b.firstChild;)a.appendChild(b.firstChild);e.remove(b)}return!0};e.mergeBlockWithSibling=function(b,a,d){var f=d?a.nextSibling:a.previousSibling;d?e.mergeContainers(f,a):e.mergeContainers(a,f);b.collapse(!0);return!0};e.date=function(b,a,d){if(a===null&&d&&(a=e.tsIso8601ToTimestamp(d),!a))return;for(var a=new Date(a),b=b.split(""),d=b.length,f="",g=0;g<d;g++){var h="",i=b[g];switch(i){case "D":case "l":h=["Sunday","Monday","Tuesday","Wednesday","Thursday", -"Friday","Saturday"][a.getDay()];i==="D"&&(h=h.substring(0,3));break;case "F":case "m":h=a.getMonth()+1;h<10&&(h="0"+h);break;case "M":months=["January","February","March","April","May","June","July","August","September","October","November","December"];h=months[a.getMonth()];i==="M"&&(h=h.substring(0,3));break;case "d":h=a.getDate();break;case "S":h=e.getOrdinalSuffix(a.getDate());break;case "Y":h=a.getFullYear();break;case "y":h=a.getFullYear();h=h.toString().substring(2);break;case "H":h=a.getHours(); -break;case "h":h=a.getHours();h===0?h=12:h>12&&(h-=12);break;case "i":h=e.addNumberPadding(a.getMinutes());break;case "a":h="am";a.getHours()>=12&&(h="pm");break;default:h=i}f+=h}return f};e.getOrdinalSuffix=function(b){var a="",a=b%100;if(a>=4&&a<=20)a="th";else switch(b%10){case 1:a="st";break;case 2:a="nd";break;case 3:a="rd";break;default:a="th"}return a};e.addNumberPadding=function(b){b<10&&(b="0"+b);return b};e.tsIso8601ToTimestamp=function(b){if(b=b.match(RegExp(/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/))){var a= -new Date;a.setDate(b[3]);a.setFullYear(b[1]);a.setMonth(b[2]-1);a.setHours(b[4]);a.setMinutes(b[5]);a.setSeconds(b[6]);var d=b[9]*60;b[8]==="+"&&(d*=-1);d-=a.getTimezoneOffset();return a.getTime()+d*6E4}return null};this.dom=e}).call(this.ice); -(function(){var e;e=function(b,a,d){this.env=b;this.element=b.element;this.selection=this.env.selection;d||this.removeBookmarks(this.element);var b=a||this.selection.getRangeAt(0),a=b.cloneRange(),e=a.startContainer,g=a.startOffset;a.collapse(!1);d=this.env.document.createElement("span");d.style.display="none";ice.dom.setHtml(d," ");ice.dom.addClass(d,"iceBookmark iceBookmark_end");d.setAttribute("iceBookmark","end");a.insertNode(d);ice.dom.isChildOf(d,this.element)||this.element.appendChild(d); -a.setStart(e,g);a.collapse(!0);e=this.env.document.createElement("span");e.style.display="none";ice.dom.addClass(e,"iceBookmark iceBookmark_start");ice.dom.setHtml(e," ");e.setAttribute("iceBookmark","start");try{a.insertNode(e),e.previousSibling===d&&(a=e,e=d,d=a)}catch(h){ice.dom.insertBefore(d,e)}ice.dom.isChildOf(e,this.element)===!1&&(this.element.firstChild?ice.dom.insertBefore(this.element.firstChild,e):this.element.appendChild(e));d.previousSibling||(a=this.env.document.createTextNode(""), -ice.dom.insertBefore(d,a));e.nextSibling||(a=this.env.document.createTextNode(""),ice.dom.insertAfter(e,a));b.setStart(e.nextSibling,0);b.setEnd(d.previousSibling,d.previousSibling.length||0);this.start=e;this.end=d};e.prototype={selectBookmark:function(){var b=this.selection.getRangeAt(0),a=null,d=null,e=0,g=null;if(this.start.nextSibling===this.end||ice.dom.getElementsBetween(this.start,this.end).length===0)if(this.end.nextSibling)a=ice.dom.getFirstChild(this.end.nextSibling);else if(this.start.previousSibling){if(a= -ice.dom.getFirstChild(this.start.previousSibling),a.nodeType===ice.dom.TEXT_NODE)e=a.length}else this.end.parentNode.appendChild(this.env.document.createTextNode("")),a=ice.dom.getFirstChild(this.end.nextSibling);else this.start.nextSibling?a=ice.dom.getFirstChild(this.start.nextSibling):(this.start.previousSibling||(a=this.env.document.createTextNode(""),ice.dom.insertBefore(this.start,a)),a=ice.dom.getLastChild(this.start.previousSibling),e=a.length),this.end.previousSibling?d=ice.dom.getLastChild(this.end.previousSibling): -(d=ice.dom.getFirstChild(this.end.nextSibling||this.end),g=0);ice.dom.remove([this.start,this.end]);d===null?(b.setEnd(a,e),b.collapse(!1)):(b.setStart(a,e),g===null&&(g=d.length||0),b.setEnd(d,g));try{this.selection.addRange(b)}catch(h){}},getBookmark:function(b,a){return ice.dom.getClass("iceBookmark_"+a,b)[0]},removeBookmarks:function(b){ice.dom.remove(ice.dom.getClass("iceBookmark",b,"span"))}};this.Bookmark=e}).call(this.ice); -(function(){var e;e=function(b){this._selection=null;this.env=b;this._initializeRangeLibrary();this._getSelection()};e.prototype={_getSelection:function(){this._selection?this._selection.refresh():this._selection=this.env.frame?rangy.getIframeSelection(this.env.frame):rangy.getSelection();return this._selection},createRange:function(){return rangy.createRange(this.env.document)},getRangeAt:function(b){this._selection.refresh();try{return this._selection.getRangeAt(b)}catch(a){return this._selection= -null,this._getSelection().getRangeAt(0)}},addRange:function(b){this._selection||(this._selection=this._getSelection());this._selection.setSingleRange(b);this._selection.ranges=[b]},_initializeRangeLibrary:function(){var b=this;rangy.init();rangy.config.checkSelectionRanges=!1;var a=function(a,b,e,h){if(e===0)throw Error("InvalidArgumentException: units cannot be 0");switch(b){case ice.dom.CHARACTER_UNIT:e>0?a.moveCharRight(h,e):a.moveCharLeft(h,e*-1)}};rangy.rangePrototype.moveStart=function(d,b){a(this, -d,b,!0)};rangy.rangePrototype.moveEnd=function(d,b){a(this,d,b,!1)};rangy.rangePrototype.setRange=function(a,b,e){a?this.setStart(b,e):this.setEnd(b,e)};rangy.rangePrototype.moveCharLeft=function(a,b){var e,h;a?(e=this.startContainer,h=this.startOffset):(e=this.endContainer,h=this.endOffset);if(e.nodeType===ice.dom.ELEMENT_NODE)if(e.hasChildNodes()){e=e.childNodes[h];for(e=this.getPreviousTextNode(e);e&&e.nodeType==ice.dom.TEXT_NODE&&e.nodeValue==="";)e=this.getPreviousTextNode(e);h=e.data.length- -b}else h=b*-1;else h-=b;if(h<0)for(;h<0;){e=this.getPreviousTextNode(e,[]);if(!e)return;e.nodeType!==ice.dom.ELEMENT_NODE&&(h+=e.data.length)}this.setRange(a,e,h)};rangy.rangePrototype.moveCharRight=function(a,b){var e,h;a?(e=this.startContainer,h=this.startOffset):(e=this.endContainer,h=this.endOffset);e.nodeType===ice.dom.ELEMENT_NODE?(e=e.childNodes[h],e.nodeType!==ice.dom.TEXT_NODE&&(e=this.getNextTextNode(e)),h=b):h+=b;var i=h-e.data.length;if(i>0){for(h=[];i>0;)if(e=this.getNextContainer(e, -h),e.nodeType!==ice.dom.ELEMENT_NODE)if(e.data.length>=i)break;else e.data.length>0&&(i-=e.data.length);h=i}this.setRange(a,e,h)};rangy.rangePrototype.getNextContainer=function(a,b){if(!a)return null;for(;a.nextSibling;)if(a=a.nextSibling,a.nodeType!==ice.dom.TEXT_NODE){var e=this.getFirstSelectableChild(a);if(e!==null)return e}else if(this.isSelectable(a)===!0)return a;for(;a&&!a.nextSibling;)a=a.parentNode;if(!a)return null;a=a.nextSibling;if(this.isSelectable(a)===!0)return a;else b&&ice.dom.isBlockElement(a)=== -!0&&b.push(a);e=this.getFirstSelectableChild(a);return e!==null?e:this.getNextContainer(a,b)};rangy.rangePrototype.getPreviousContainer=function(a,b){if(!a)return null;for(;a.previousSibling;)if(a=a.previousSibling,a.nodeType!==ice.dom.TEXT_NODE)if(ice.dom.isStubElement(a)===!0)return a;else{var e=this.getLastSelectableChild(a);if(e!==null)return e}else if(this.isSelectable(a)===!0)return a;for(;a&&!a.previousSibling;)a=a.parentNode;if(!a)return null;a=a.previousSibling;if(this.isSelectable(a)=== -!0)return a;else b&&ice.dom.isBlockElement(a)===!0&&b.push(a);e=this.getLastSelectableChild(a);return e!==null?e:this.getPreviousContainer(a,b)};rangy.rangePrototype.getNextTextNode=function(a){if(a.nodeType===ice.dom.ELEMENT_NODE&&a.childNodes.length!==0)return this.getFirstSelectableChild(a);a=this.getNextContainer(a);return a.nodeType===ice.dom.TEXT_NODE?a:this.getNextTextNode(a)};rangy.rangePrototype.getPreviousTextNode=function(a,b){if(a.nodeType===ice.dom.ELEMENT_NODE&&a.childNodes.length!== -0)return this.getLastSelectableChild(a);a=this.getPreviousContainer(a,b);return a.nodeType===ice.dom.TEXT_NODE?a:this.getPreviousTextNode(a,b)};rangy.rangePrototype.getFirstSelectableChild=function(a){if(a)if(a.nodeType!==ice.dom.TEXT_NODE)for(a=a.firstChild;a;)if(this.isSelectable(a)===!0)return a;else if(a.firstChild){var b=this.getFirstSelectableChild(a);if(b!==null)return b;else a=a.nextSibling}else a=a.nextSibling;else return a;return null};rangy.rangePrototype.getLastSelectableChild=function(a){if(a)if(a.nodeType!== -ice.dom.TEXT_NODE)for(a=a.lastChild;a;)if(this.isSelectable(a)===!0)return a;else if(a.lastChild){var b=this.getLastSelectableChild(a);if(b!==null)return b;else a=a.previousSibling}else a=a.previousSibling;else return a;return null};rangy.rangePrototype.isSelectable=function(a){return a&&a.nodeType===ice.dom.TEXT_NODE&&a.data.length!==0?!0:!1};rangy.rangePrototype.getHTMLContents=function(a){a||(a=this.cloneContents());var e=b.env.document.createElement("div");e.appendChild(a.cloneNode(!0));return e.innerHTML}; -rangy.rangePrototype.getHTMLContentsObj=function(){return this.cloneContents()}}};this.Selection=e}).call(this.ice); -(function(){var e=function(b){this._ice=b};e.prototype={start:function(){},clicked:function(){return!0},mouseDown:function(){return!0},keyDown:function(){return!0},keyPress:function(){return!0},selectionChanged:function(){},setEnabled:function(){},setDisabled:function(){},caretUpdated:function(){},nodeInserted:function(){},nodeCreated:function(){},caretPositioned:function(){},remove:function(){this._ice.removeKeyPressListener(this)},setSettings:function(){}};this.IcePlugin=e}).call(this.ice); -(function(){var e=function(b){this.plugins={};this.pluginConstructors={};this.keyPressListeners={};this.activePlugin=null;this.pluginSets={};this.activePluginSet=null;this._ice=b};e.prototype={getPluginNames:function(){var b=[],a;for(a in this.plugins)b.push(a);return b},addPluginObject:function(b,a){this.plugins[b]=a},addPlugin:function(b,a){if(typeof a!=="function")throw Error("IcePluginException: plugin must be a constructor function");ice.dom.isset(this.pluginConstructors[b])===!1&&(this.pluginConstructors[b]= -a)},loadPlugins:function(b,a){if(b.length===0)a.call(this);else{var d=b.shift();if(typeof d==="object")d=d.name;if(ice.dom.isset(ice._plugin[d])===!0)this.addPlugin(d,ice._plugin[d]),this.loadPlugins(b,a);else throw Error("plugin was not included in the page: "+d);}},_enableSet:function(b){this.activePluginSet=b;for(var a=this.pluginSets[b].length,d=0;d<a;d++){var e=this.pluginSets[b][d],g="",g=typeof e==="object"?e.name:e,h=this.pluginConstructors[g];h&&(h=new h(this._ice),this.plugins[g]=h,ice.dom.isset(e.settings)=== -!0&&h.setSettings(e.settings),h.start())}},setActivePlugin:function(b){this.activePlugin=b},getActivePlugin:function(){return this.activePlugin},_getPluginName:function(b){b=b.toString();return b.substr(9,b.indexOf("(")-9)},removePlugin:function(b){this.plugins[b]&&this.plugins[b].remove()},getPlugin:function(b){return this.plugins[b]},usePlugins:function(b,a,d){var e=this;this.pluginSets[b]=ice.dom.isset(a)===!0?a:[];this.loadPlugins(this.pluginSets[b].concat([]),function(){e._enableSet(b);d&&d.call(this)})}, -disablePlugin:function(b){this.plugins[b].disable()},isPluginElement:function(b){for(var a in this.plugins)if(this.plugins[a].isPluginElement&&this.plugins[a].isPluginElement(b)===!0)return!0;return!1},fireKeyPressed:function(b){if(this._fireKeyPressFns(b,"all_keys")===!1)return!1;var a=[];(b.ctrlKey===!0||b.metaKey===!0)&&a.push("ctrl");b.shiftKey===!0&&a.push("shift");b.altKey===!0&&a.push("alt");switch(b.keyCode){case 13:a.push("enter");break;case ice.dom.DOM_VK_LEFT:a.push("left");break;case ice.dom.DOM_VK_RIGHT:a.push("right"); -break;case ice.dom.DOM_VK_UP:a.push("up");break;case ice.dom.DOM_VK_DOWN:a.push("down");break;case 9:a.push("tab");break;case ice.dom.DOM_VK_DELETE:a.push("delete");break;default:var d;if(b.keyCode)d=b.keyCode;else if(b.which)d=b.which;d&&a.push(String.fromCharCode(d).toLowerCase())}a=a.sort().join("+");return this._fireKeyPressFns(b,a)},_fireKeyPressFns:function(b,a){if(this.keyPressListeners[a])for(var d=this.keyPressListeners[a].length,e=0;e<d;e++){var g=this.keyPressListeners[a][e],h=g.fn,i=g.plugin, -g=g.data;if(h)if(ice.dom.isFn(h)===!0){if(h.call(i,b,g)===!0)return ice.dom.preventDefault(b),!1}else if(i[h]&&i[h].call(i,b,g)===!0)return ice.dom.preventDefault(b),!1}return!0},fireSelectionChanged:function(b){for(var a in this.plugins)this.plugins[a].selectionChanged(b)},fireNodeInserted:function(b,a){for(var d in this.plugins)if(this.plugins[d].nodeInserted(b,a)===!1)return!1},fireNodeCreated:function(b,a){for(var d in this.plugins)if(this.plugins[d].nodeCreated(b,a)===!1)return!1},fireCaretPositioned:function(){for(var b in this.plugins)this.plugins[b].caretPositioned()}, -fireClicked:function(b){var a=!0,d;for(d in this.plugins)this.plugins[d].clicked(b)===!1&&(a=!1);return a},fireMouseDown:function(b){var a=!0,d;for(d in this.plugins)this.plugins[d].mouseDown(b)===!1&&(a=!1);return a},fireKeyDown:function(b){var a=!0,d;for(d in this.plugins)this.plugins[d].keyDown(b)===!1&&(a=!1);return a},fireKeyPress:function(b){var a=!0,d;for(d in this.plugins)this.plugins[d].keyPress(b)===!1&&(a=!1);return a},fireEnabled:function(b){for(var a in this.plugins)this.plugins[a].setEnabled(b)}, -fireDisabled:function(b){for(var a in this.plugins)this.plugins[a].setDisabled(b)},fireCaretUpdated:function(){for(var b in this.plugins)this.plugins[b].caretUpdated&&this.plugins[b].caretUpdated()}};this._plugin={};this.IcePluginManager=e}).call(this.ice); -(function(){var e;e=function(b){this._ice=b};e.prototype={nodeCreated:function(b,a){b.setAttribute("title",(a.action||"Modified")+" by "+b.getAttribute(this._ice.userNameAttribute)+" - "+ice.dom.date("m/d/Y h:ia",parseInt(b.getAttribute(this._ice.timeAttribute))))}};ice.dom.noInclusionInherits(e,ice.IcePlugin);this._plugin.IceAddTitlePlugin=e}).call(this.ice); -(function(){var e;e=function(b){this._ice=b;this._tmpNode=null;this._tmpNodeTagName="icepaste";this._pasteId="icepastediv";var a=this;this.pasteType="formattedClean";this.preserve="p";this.beforePasteClean=function(a){return a};this.afterPasteClean=function(a){return a};b.element.oncopy=function(){return a.handleCopy.apply(a)};b.element.oncut=function(){return a.handleCut.apply(a)}};e.prototype={setSettings:function(b){b=b||{};ice.dom.extend(this,b);this.preserve+=","+this._tmpNodeTagName;this.setupPreserved()}, -keyDown:function(b){b.metaKey!==!0&&b.ctrlKey!==!0||b.keyCode==86&&this.handlePaste()},handleCut:function(){if(this._ice.isTracking){var b=this._ice.getCurrentRange();if(!b.collapsed){var a=b.cloneContents(),d=this;setTimeout(function(){d.doCut(a)},1);return!0}}},doCut:function(b){var a=this._ice.getCurrentRange(),d,e;this._tmpNode=this._ice.env.document.createElement("span");a.insertNode(this._tmpNode);a.setStartAfter(this._tmpNode);for(a.collapse(!0);d=b.firstChild;)a.insertNode(d),a.setStartAfter(d), -a.collapse(!0),e=d;a.setStartBefore(this._tmpNode);a.collapse(!0);a.setEndAfter(e);this._ice.env.selection.addRange(a);this._ice.deleteContents(null,null,"cutType");ice.dom.remove(this._tmpNode)},handleCopy:function(){},handlePaste:function(){var b=this._ice.getCurrentRange();b.collapsed||(this._ice.isTracking?(this._ice.deleteContents(),b=b.cloneRange()):(b.deleteContents(),b.collapse(!0)));this._ice.isTracking&&this._ice._moveRangeToValidTrackingPos(b);if(b.startContainer==this._ice.element){var a= -ice.dom.find(this._ice.element,this._ice.blockEl)[0];a||(a=ice.dom.create("<"+this._ice.blockEl+" ><br/></"+this._ice.blockEl+">"),this._ice.element.appendChild(a));b.setStart(a,0);b.collapse(!0);this._ice.env.selection.addRange(b)}this._tmpNode=this._ice.env.document.createElement(this._tmpNodeTagName);b.insertNode(this._tmpNode);switch(this.pasteType){case "formatted":this.setupPaste();break;case "formattedClean":this.setupPaste(!0)}return!0},setupPaste:function(b){var a=this.createDiv(this._pasteId), -d=this;a.focus();a.onpaste=function(){setTimeout(function(){d.handlePasteValue(b)},1)};return!0},handlePasteValue:function(b){var a=ice.dom.getHtml(document.getElementById(this._pasteId)),d=ice.dom.children("<div>"+a+"</div>",this._ice.blockEl);d.length===1&&ice.dom.getNodeTextContent("<div>"+a+"</div>")===ice.dom.getNodeTextContent(d)&&(a=ice.dom.getHtml(a));a=this.beforePasteClean.call(this,a);b&&(a=this._ice.getCleanContent(a),a=this.stripPaste(a));var a=this.afterPasteClean.call(this,a),a=ice.dom.trim(a), -e=this._ice.getCurrentRange();e.setStartAfter(this._tmpNode);e.collapse(!0);var g=null,a=e.createContextualFragment(a),b=this._ice.startBatchChange();if(ice.dom.hasBlockChildren(a)){var h=ice.dom.isChildOfTagName(this._tmpNode,this._ice.blockEl);e.setEndAfter(h.lastChild);this._ice.selection.addRange(e);g=e.extractContents();d=this._ice.env.document.createElement(this._ice.blockEl);d.appendChild(g);ice.dom.insertAfter(h,d);e.setStart(d,0);e.collapse(!0);this._ice.selection.addRange(e);for(var e=e.startContainer, -i=null,h=null;a.firstChild;)if(a.firstChild.nodeType===3&&!jQuery.trim(a.firstChild.nodeValue))a.removeChild(a.firstChild);else if(ice.dom.isBlockElement(a.firstChild)){if(a.firstChild.textContent!=="")h=i=null,this._ice.isTracking?(h=this._ice.createIceNode("insertType"),this._ice.addChange("insertType",[h]),g=document.createElement(a.firstChild.tagName),h.innerHTML=a.firstChild.innerHTML,g.appendChild(h)):(h=g=document.createElement(a.firstChild.tagName),g.innerHTML=a.firstChild.innerHTML),ice.dom.insertBefore(e, -g);a.removeChild(a.firstChild)}else i||(g=document.createElement(this._ice.blockEl),ice.dom.insertBefore(e,g),this._ice.isTracking?(i=this._ice.createIceNode("insertType"),this._ice.addChange("insertType",[i]),g.appendChild(i)):i=g),h=i,i.appendChild(a.removeChild(a.firstChild));d.textContent||d.parentNode.removeChild(d)}else if(this._ice.isTracking)g=this._ice.createIceNode("insertType",a),this._ice.addChange("insertType",[g]),e.insertNode(g),h=g;else for(;d=a.firstChild;)e.insertNode(d),e.setStartAfter(d), -e.collapse(!0),h=d;this._ice.endBatchChange(b);this._cleanup(h)},createDiv:function(b){var a=ice.dom.getId(b);if(a)return ice.dom.empty(a),a;a=this._ice.env.document.createElement("div");a.id=b;a.setAttribute("contentEditable",!0);ice.dom.setStyle(a,"width","1px");ice.dom.setStyle(a,"height","1px");ice.dom.setStyle(a,"overflow","hidden");ice.dom.setStyle(a,"position","fixed");ice.dom.setStyle(a,"top","10px");ice.dom.setStyle(a,"left","10px");document.body.appendChild(a);return a},handleCut:function(){this.cutElementId= -"icecut";this.cutElement=this.createDiv(this.cutElementId);var b=this._ice.getCurrentRange();if(!b.collapsed){var a=b.getHTMLContents();this._ice.isTracking?this._ice.deleteContents():b.deleteContents();var d=b.cloneRange();d.collapse(!0);this.cutElement.innerHTML=a;b.setStart(this.cutElement.firstChild,0);b.setEndAfter(this.cutElement.lastChild,this.cutElement.lastChild.length);var e=this;setTimeout(function(){b.setStart(d.startContainer,d.startOffset);b.collapse(!0);e._ice.env.selection.addRange(b); -ice.dom.remove(this.cutElement)},10)}},stripPaste:function(b){b=this._cleanWordPaste(b);return b=this.cleanPreserved(b)},setupPreserved:function(){var b=this;this._tags="";this._attributesMap=[];ice.dom.each(this.preserve.split(","),function(a,d){d.match(/(\w+)(\[(.+)\])?/);var e=RegExp.$1,g=RegExp.$3;b._tags&&(b._tags+=",");b._tags+=e.toLowerCase();b._attributesMap[e]=g.split("|")})},cleanPreserved:function(b){var a=this,d=this._ice.env.document.createElement("div");d.innerHTML=b;d=ice.dom.stripEnclosingTags(d, -this._tags);ice.dom.each(ice.dom.find(d,this._tags),function(b,d){if(ice.dom.hasClass(d,"skip-clean"))return!0;var e=d.tagName.toLowerCase(),e=a._attributesMap[e];if(e[0]&&e[0]==="*")return!0;if(d.hasAttributes())for(var i=d.attributes,b=i.length-1;b>=0;b--)ice.dom.inArray(i[b].name,e)||d.removeAttribute(i[b].name)});return d.innerHTML},_cleanWordPaste:function(b){b=b.replace(/<(meta|link)[^>]+>/g,"");b=b.replace(/<\!--(.|\s)*?--\>/g,"");b=b.replace(/<style>[\s\S]*?<\/style>/g,"");b=b.replace(/<\/?\w+:[^>]*>/gi, -"");b=b.replace(/<\\?\?xml[^>]*>/gi,"");b=this._cleanPaste(b);return b=b.replace(/<(\w[^>]*) (lang)=([^ |>]*)([^>]*)/gi,"<$1$4")},_getListType:function(b,a){var d=ice.dom.getHtml(b),e=null;ice.dom.foreach(a,function(b){ice.dom.foreach(a[b],function(h){ice.dom.foreach(a[b][h],function(i){if(RegExp(a[b][h][i]).test(d)===!0)return e={html:d.replace(RegExp(a[b][h][i]),""),listType:b,listStyle:h},!1});if(e!==null)return!1});if(e!==null)return!1});return e},_cleanPaste:function(b){b=b.replace(/<b(\s+|>)/g, -"<strong$1");b=b.replace(/<\/b(\s+|>)/g,"</strong$1");b=b.replace(/<i(\s+|>)/g,"<em$1");return b=b.replace(/<\/i(\s+|>)/g,"</em$1")},_cleanup:function(b){try{var b=b&&b.lastChild||b||this._tmpNode,a=this._ice.getCurrentRange();a.setStart(b,b.length);a.collapse(!0);this._ice.selection.addRange(a);this._ice.env.frame?this._ice.env.frame.contentWindow.focus():this._ice.element.focus();this._tmpNode.parentNode.removeChild(this._tmpNode);this._tmpNode=null;for(var d=this._ice.env.document.getElementsByClassName(this._ice.changeTypes.insertType.alias), -b=0;b<d.length;b++)d[b].textContent||d[b].parentNode&&d[b].parentNode.removeChild(d[b])}catch(e){window.console&&console.error(e)}}};ice.dom.noInclusionInherits(e,ice.IcePlugin);this._plugin.IceCopyPastePlugin=e}).call(this.ice); -(function(){var e=this.ice,b=function(a){this._ice=a};b.prototype={convert:function(a){var b=this;try{b._ice.placeholdDeletes(),e.dom.each(a.getElementsByTagName(this._ice.blockEl),function(a,e){b._convertBlock(e)})}catch(f){window.console&&console.error(f)}finally{b._ice.revertDeletePlaceholders()}},_convertBlock:function(a){if(!(e.dom.getNodeTextContent(a)<2)){var b,f,g,h,i,l=String.fromCharCode(8216),t=String.fromCharCode(8217),n=String.fromCharCode(8220),s=String.fromCharCode(8221),o=function(a){return a=== -String.fromCharCode(160)||a===String.fromCharCode(32)},k=function(a){return o(a)||a==null||a===";"||a===")"||a=="."||a==="!"||a===","||a==="?"||a===":"},r=function(a){return a==="'"||a===l||a===t};h=e.dom.getHtml(a).match(/(<("[^"]*"|'[^']*'|[^'">])*>|&.*;|.)/g);i=function(a,b,d){var e=a.length,f=d<0?-1:1;return function B(a,b,d){if(b<0||b>=e)return null;var g=a[b+f];return g&&g.length==1&&(d+=f*-1,!d)?g:B(a,b+f,d)}(a,b,d)};e.dom.each(h,function(a,e){e==" "&&(e=h[a]=" ");if(e.length==1){b=i(h, -a,-1);f=e;g=i(h,a,1);switch(f){case l:case t:f="'";case "'":var v;if(v=b==null||o(b))if(v=/\d/.test(g))v=/\d/.test(i(h,a,2))&&k(i(h,a,3));v?f=t:b==null||(o(b)||b==="(")&&!o(g)?f=l:g==null||!o(b)&&k(g)?f=t:/\w/.test(b)&&/\w/.test(g)&&(f=t);break;case n:case s:f='"';case '"':if(k(g)&&o(b)&&r(i(h,a,-2)))f=s;else if(b==null||(o(b)||b==="(")&&!o(g))f=n;else if(g==null||!o(b)&&k(g))f=s;else if((b==null||o(b))&&o(g)&&r(i(h,a,1)))f=n}f!=null&&(h[a]=f)}});e.dom.setHtml(a,h.join(""))}}};e.dom.noInclusionInherits(b, -e.IcePlugin);this.ice._plugin.IceSmartQuotesPlugin=b}).call(this); -(function(){var e=function(b){this._ice=b};e.prototype={keyDown:function(b){if(ice.dom.isBrowser("mozilla")){var a=parseInt(ice.dom.browser().version);if(a>14&&b.keyCode===173||a<=14&&b.keyCode===109)return this.convertEmdash(b)}else if(b.keyCode===189)return this.convertEmdash(b);return!0},convertEmdash:function(){var b=this._ice.getCurrentRange();if(b.collapsed){try{b.moveStart(ice.dom.CHARACTER_UNIT,-1);var a=ice.dom.getParents(b.startContainer,this._ice.blockEl)[0],d=ice.dom.getParents(b.endContainer, -this._ice.blockEl)[0];if(a===d&&!this._ice.getIceNode(b.startContainer,"deleteType")&&(c=b.toHtml(),c==="-")){b.extractContents();b.collapse();var e=this._ice.env.document.createTextNode("\u2014");this._ice.isTracking?this._ice._insertNode(e,b):(b.insertNode(e),b.setStart(e,1),b.collapse(!0));this._ice._preventKeyPress=!0;return!1}}catch(g){}b.collapse()}return!0}};ice.dom.noInclusionInherits(e,ice.IcePlugin);this._plugin.IceEmdashPlugin=e}).call(this.ice); +// +// ice - Master +// The MIT License +// Copyright (c) 2012 The New York Times, CMS Group, Matthew DeLambo <delambo@gmail.com> +// +window.rangy=function(){function e(e,t){var n=typeof e[t];return n==u||!(n!=d||!e[t])||"unknown"==n}function t(e,t){return!(typeof e[t]!=d||!e[t])}function n(e,t){return typeof e[t]!=h}function i(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}function r(e){return e&&C(e,p)&&N(e,m)}function o(e){window.alert("Rangy not supported in your browser. Reason: "+e),E.initialized=!0,E.supported=!1}function s(e){var t="Rangy warning: "+e;E.config.alertOnWarn?window.alert(t):typeof window.console!=h&&typeof window.console.log!=h&&window.console.log(t)}function a(){if(!E.initialized){var n,i=!1,s=!1;e(document,"createRange")&&(n=document.createRange(),C(n,g)&&N(n,f)&&(i=!0),n.detach());var a=t(document,"body")?document.body:document.getElementsByTagName("body")[0];a&&e(a,"createTextRange")&&(n=a.createTextRange(),r(n)&&(s=!0)),i||s||o("Neither Range nor TextRange are implemented"),E.initialized=!0,E.features={implementsDomRange:i,implementsTextRange:s};for(var c=_.concat(y),l=0,d=c.length;d>l;++l)try{c[l](E)}catch(u){t(window,"console")&&e(window.console,"log")&&window.console.log("Init listener threw an exception. Continuing.",u)}}}function c(e){e=e||window,a();for(var t=0,n=T.length;n>t;++t)T[t](e)}function l(e){this.name=e,this.initialized=!1,this.supported=!1}var d="object",u="function",h="undefined",f=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer","START_TO_START","START_TO_END","END_TO_START","END_TO_END"],g=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],m=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],p=["collapse","compareEndPoints","duplicate","getBookmark","moveToBookmark","moveToElementText","parentElement","pasteHTML","select","setEndPoint","getBoundingClientRect"],C=i(e),v=i(t),N=i(n),E={version:"1.2.3",initialized:!1,supported:!0,util:{isHostMethod:e,isHostObject:t,isHostProperty:n,areHostMethods:C,areHostObjects:v,areHostProperties:N,isTextRange:r},features:{},modules:{},config:{alertOnWarn:!1,preferTextRange:!1}};E.fail=o,E.warn=s,{}.hasOwnProperty?E.util.extend=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}:o("hasOwnProperty not supported");var y=[],_=[];E.init=a,E.addInitListener=function(e){E.initialized?e(E):y.push(e)};var T=[];E.addCreateMissingNativeApiListener=function(e){T.push(e)},E.createMissingNativeApi=c,l.prototype.fail=function(e){throw this.initialized=!0,this.supported=!1,Error("Module '"+this.name+"' failed to load: "+e)},l.prototype.warn=function(e){E.warn("Module "+this.name+": "+e)},l.prototype.createError=function(e){return Error("Error in Rangy "+this.name+" module: "+e)},E.createModule=function(e,t){var n=new l(e);E.modules[e]=n,_.push(function(e){t(e,n),n.initialized=!0,n.supported=!0})},E.requireModules=function(e){for(var t,n,i=0,r=e.length;r>i;++i){if(n=e[i],t=E.modules[n],!(t&&t instanceof l))throw Error("Module '"+n+"' not found");if(!t.supported)throw Error("Module '"+n+"' not supported")}};var S=!1,R=function(){S||(S=!0,E.initialized||a())};return typeof window==h?(o("No window found"),void 0):typeof document==h?(o("No document found"),void 0):(e(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",R,!1),e(window,"addEventListener")?window.addEventListener("load",R,!1):e(window,"attachEvent")?window.attachEvent("onload",R):o("Window does not have required addEventListener or attachEvent method"),E)}(),rangy.createModule("DomUtil",function(e,t){function n(e){var t;return typeof e.namespaceURI==R||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t}function i(e){var t=e.parentNode;return 1==t.nodeType?t:null}function r(e){for(var t=0;e=e.previousSibling;)t++;return t}function o(e){var t;return l(e)?e.length:(t=e.childNodes)?t.length:0}function s(e,t){var n,i=[];for(n=e;n;n=n.parentNode)i.push(n);for(n=t;n;n=n.parentNode)if(D(i,n))return n;return null}function a(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function c(e,t,n){for(var i,r=n?e:e.parentNode;r;){if(i=r.parentNode,i===t)return r;r=i}return null}function l(e){var t=e.nodeType;return 3==t||4==t||8==t}function d(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function u(e,t){var n=e.cloneNode(!1);return n.deleteData(0,t),e.deleteData(t,e.length-t),d(n,e),n}function h(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=R)return e.ownerDocument;if(typeof e.document!=R)return e.document;if(e.parentNode)return h(e.parentNode);throw Error("getDocument: no document found for node")}function f(e){var t=h(e);if(typeof t.defaultView!=R)return t.defaultView;if(typeof t.parentWindow!=R)return t.parentWindow;throw Error("Cannot get a window object for node")}function g(e){if(typeof e.contentDocument!=R)return e.contentDocument;if(typeof e.contentWindow!=R)return e.contentWindow.document;throw Error("getIframeWindow: No Document object found for iframe element")}function m(e){if(typeof e.contentWindow!=R)return e.contentWindow;if(typeof e.contentDocument!=R)return e.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element")}function p(e){return b.isHostObject(e,"body")?e.body:e.getElementsByTagName("body")[0]}function C(e){for(var t;t=e.parentNode;)e=t;return e}function v(e,t,n,i){var o,a,l,d,u;if(e==n)return t===i?0:i>t?-1:1;if(o=c(n,e,!0))return r(o)>=t?-1:1;if(o=c(e,n,!0))return i>r(o)?-1:1;if(a=s(e,n),l=e===a?a:c(e,a,!0),d=n===a?a:c(n,a,!0),l===d)throw Error("comparePoints got to case 4 and childA and childB are the same!");for(u=a.firstChild;u;){if(u===l)return-1;if(u===d)return 1;u=u.nextSibling}throw Error("Should not be here!")}function N(e){for(var t,n=h(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n}function E(e){if(!e)return"[No node]";if(l(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">["+e.childNodes.length+"]"}return e.nodeName}function y(e){this.root=e,this._next=e}function _(e){return new y(e)}function T(e,t){this.node=e,this.offset=t}function S(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}var R="undefined",b=e.util;b.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),b.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var O=document.createElement("div");b.areHostMethods(O,["insertBefore","appendChild","cloneNode"]||!b.areHostObjects(O,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),b.isHostProperty(O,"innerHTML")||t.fail("Element is missing innerHTML property");var w=document.createTextNode("test");b.areHostMethods(w,["splitText","deleteData","insertData","appendData","cloneNode"]||!b.areHostObjects(O,["previousSibling","nextSibling","childNodes","parentNode"])||!b.areHostProperties(w,["data"]))||t.fail("Incomplete Text Node implementation");var D=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};y.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},T.prototype={equals:function(e){return this.node===e.node&this.offset==e.offset},inspect:function(){return"[DomPosition("+E(this.node)+":"+this.offset+")]"}},S.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11},S.prototype.toString=function(){return this.message},e.dom={arrayContains:D,isHtmlNamespace:n,parentElement:i,getNodeIndex:r,getNodeLength:o,getCommonAncestor:s,isAncestorOf:a,getClosestAncestorIn:c,isCharacterDataNode:l,insertAfter:d,splitDataNode:u,getDocument:h,getWindow:f,getIframeWindow:m,getIframeDocument:g,getBody:p,getRootContainer:C,comparePoints:v,inspectNode:E,fragmentFromNodeChildren:N,createIterator:_,DomPosition:T},e.DOMException=S}),rangy.createModule("DomRange",function(e){function t(e,t){return 3!=e.nodeType&&(L.isAncestorOf(e,t.startContainer,!0)||L.isAncestorOf(e,t.endContainer,!0))}function n(e){return L.getDocument(e.startContainer)}function i(e,t,n){var i=e._listeners[t];if(i)for(var r=0,o=i.length;o>r;++r)i[r].call(e,{target:e,args:n})}function r(e){return new H(e.parentNode,L.getNodeIndex(e))}function o(e){return new H(e.parentNode,L.getNodeIndex(e)+1)}function s(e,t,n){var i=11==e.nodeType?e.firstChild:e;return L.isCharacterDataNode(t)?n==t.length?L.insertAfter(e,t):t.parentNode.insertBefore(e,0==n?t:L.splitDataNode(t,n)):n>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[n]),i}function a(e){for(var t,i,r,o=n(e.range).createDocumentFragment();i=e.next();){if(t=e.isPartiallySelectedSubtree(),i=i.cloneNode(!t),t&&(r=e.getSubtreeIterator(),i.appendChild(a(r)),r.detach(!0)),10==i.nodeType)throw new j("HIERARCHY_REQUEST_ERR");o.appendChild(i)}return o}function c(e,t,n){var i,r;n=n||{stop:!1};for(var o,s;o=e.next();)if(e.isPartiallySelectedSubtree()){if(t(o)===!1)return n.stop=!0,void 0;if(s=e.getSubtreeIterator(),c(s,t,n),s.detach(!0),n.stop)return}else for(i=L.createIterator(o);r=i.next();)if(t(r)===!1)return n.stop=!0,void 0}function l(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(t=e.getSubtreeIterator(),l(t),t.detach(!0)):e.remove()}function d(e){for(var t,i,r=n(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),i=e.getSubtreeIterator(),t.appendChild(d(i)),i.detach(!0)):e.remove(),10==t.nodeType)throw new j("HIERARCHY_REQUEST_ERR");r.appendChild(t)}return r}function u(e,t,n){var i,r=!(!t||!t.length),o=!!n;r&&(i=RegExp("^("+t.join("|")+")$"));var s=[];return c(new f(e,!1),function(e){r&&!i.test(e.nodeType)||o&&!n(e)||s.push(e)}),s}function h(e){var t=e.getName===void 0?"Range":e.getName();return"["+t+"("+L.inspectNode(e.startContainer)+":"+e.startOffset+", "+L.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function f(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&L.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||L.isCharacterDataNode(this.sc)?L.getClosestAncestorIn(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||L.isCharacterDataNode(this.ec)?L.getClosestAncestorIn(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}function g(e){this.code=this[e],this.codeName=e,this.message="RangeException: "+this.codeName}function m(e,t,n){this.nodes=u(e,t,n),this._next=this.nodes[0],this._position=0}function p(e){return function(t,n){for(var i,r=n?t:t.parentNode;r;){if(i=r.nodeType,L.arrayContains(e,i))return r;r=r.parentNode}return null}}function C(e,t){if(q(e,t))throw new g("INVALID_NODE_TYPE_ERR")}function v(e){if(!e.startContainer)throw new j("INVALID_STATE_ERR")}function N(e,t){if(!L.arrayContains(t,e.nodeType))throw new g("INVALID_NODE_TYPE_ERR")}function E(e,t){if(0>t||t>(L.isCharacterDataNode(e)?e.length:e.childNodes.length))throw new j("INDEX_SIZE_ERR")}function y(e,t){if(X(e,!0)!==X(t,!0))throw new j("WRONG_DOCUMENT_ERR")}function _(e){if(z(e,!0))throw new j("NO_MODIFICATION_ALLOWED_ERR")}function T(e,t){if(!e)throw new j(t)}function S(e){return!L.arrayContains(Q,e.nodeType)&&!X(e,!0)}function R(e,t){return(L.isCharacterDataNode(e)?e.length:e.childNodes.length)>=t}function b(e){return!!e.startContainer&&!!e.endContainer&&!S(e.startContainer)&&!S(e.endContainer)&&R(e.startContainer,e.startOffset)&&R(e.endContainer,e.endOffset)}function O(e){if(v(e),!b(e))throw Error("Range error: Range is no longer valid after DOM mutation ("+e.inspect()+")")}function w(){}function D(e){e.START_TO_START=et,e.START_TO_END=tt,e.END_TO_END=nt,e.END_TO_START=it,e.NODE_BEFORE=rt,e.NODE_AFTER=ot,e.NODE_BEFORE_AND_AFTER=st,e.NODE_INSIDE=at}function x(e){D(e),D(e.prototype)}function k(e,t){return function(){O(this);var n,i,r=this.startContainer,s=this.startOffset,a=this.commonAncestorContainer,l=new f(this,!0);r!==a&&(n=L.getClosestAncestorIn(r,a,!0),i=o(n),r=i.node,s=i.offset),c(l,_),l.reset();var d=e(l);return l.detach(),t(this,r,s,r,s),d}}function A(n,i,s){function a(e,t){return function(n){v(this),N(n,U),N(V(n),Q);var i=(e?r:o)(n);(t?c:u)(this,i.node,i.offset)}}function c(e,t,n){var r=e.endContainer,o=e.endOffset;(t!==e.startContainer||n!==e.startOffset)&&((V(t)!=V(r)||1==L.comparePoints(t,n,r,o))&&(r=t,o=n),i(e,t,n,r,o))}function u(e,t,n){var r=e.startContainer,o=e.startOffset;(t!==e.endContainer||n!==e.endOffset)&&((V(t)!=V(r)||-1==L.comparePoints(t,n,r,o))&&(r=t,o=n),i(e,r,o,t,n))}function h(e,t,n){(t!==e.startContainer||n!==e.startOffset||t!==e.endContainer||n!==e.endOffset)&&i(e,t,n,t,n)}n.prototype=new w,e.util.extend(n.prototype,{setStart:function(e,t){v(this),C(e,!0),E(e,t),c(this,e,t)},setEnd:function(e,t){v(this),C(e,!0),E(e,t),u(this,e,t)},setStartBefore:a(!0,!0),setStartAfter:a(!1,!0),setEndBefore:a(!0,!1),setEndAfter:a(!1,!1),collapse:function(e){O(this),e?i(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):i(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){v(this),C(e,!0),i(this,e,0,e,L.getNodeLength(e))},selectNode:function(e){v(this),C(e,!1),N(e,U);var t=r(e),n=o(e);i(this,t.node,t.offset,n.node,n.offset)},extractContents:k(d,i),deleteContents:k(l,i),canSurroundContents:function(){O(this),_(this.startContainer),_(this.endContainer);var e=new f(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},detach:function(){s(this)},splitBoundaries:function(){O(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=e===n;L.isCharacterDataNode(n)&&r>0&&n.length>r&&L.splitDataNode(n,r),L.isCharacterDataNode(e)&&t>0&&e.length>t&&(e=L.splitDataNode(e,t),o?(r-=t,n=e):n==e.parentNode&&r>=L.getNodeIndex(e)&&r++,t=0),i(this,e,t,n,r)},normalizeBoundaries:function(){O(this);var e=this.startContainer,t=this.startOffset,n=this.endContainer,r=this.endOffset,o=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(n=e,r=e.length,e.appendData(t.data),t.parentNode.removeChild(t))},s=function(i){var o=i.previousSibling;if(o&&o.nodeType==i.nodeType){e=i;var s=i.length;if(t=o.length,i.insertData(0,o.data),o.parentNode.removeChild(o),e==n)r+=t,n=e;else if(n==i.parentNode){var a=L.getNodeIndex(i);r==a?(n=i,r=s):r>a&&r--}}},a=!0;if(L.isCharacterDataNode(n))n.length==r&&o(n);else{if(r>0){var c=n.childNodes[r-1];c&&L.isCharacterDataNode(c)&&o(c)}a=!this.collapsed}if(a){if(L.isCharacterDataNode(e))0==t&&s(e);else if(e.childNodes.length>t){var l=e.childNodes[t];l&&L.isCharacterDataNode(l)&&s(l)}}else e=n,t=r;i(this,e,t,n,r)},collapseToPoint:function(e,t){v(this),C(e,!0),E(e,t),h(this,e,t)}}),x(n)}function P(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:L.getCommonAncestor(e.startContainer,e.endContainer)}function I(e,t,n,r,o){var s=e.startContainer!==t||e.startOffset!==n,a=e.endContainer!==r||e.endOffset!==o;e.startContainer=t,e.startOffset=n,e.endContainer=r,e.endOffset=o,P(e),i(e,"boundarychange",{startMoved:s,endMoved:a})}function B(e){v(e),e.startContainer=e.startOffset=e.endContainer=e.endOffset=null,e.collapsed=e.commonAncestorContainer=null,i(e,"detach",null),e._listeners=null}function M(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this._listeners={boundarychange:[],detach:[]},P(this)}e.requireModules(["DomUtil"]);var L=e.dom,H=L.DomPosition,j=e.DOMException;f.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,L.isCharacterDataNode(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!L.isCharacterDataNode(n)||n!==this.sc&&n!==this.ec?n.parentNode&&n.parentNode.removeChild(n):(e=n===this.sc?this.so:0,t=n===this.ec?this.eo:n.length,e!=t&&n.deleteData(e,t-e))},isPartiallySelectedSubtree:function(){var e=this._current;return t(e,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)e=this.range.cloneRange(),e.collapse();else{e=new M(n(this.range));var t=this._current,i=t,r=0,o=t,s=L.getNodeLength(t);L.isAncestorOf(t,this.sc,!0)&&(i=this.sc,r=this.so),L.isAncestorOf(t,this.ec,!0)&&(o=this.ec,s=this.eo),I(e,i,r,o,s)}return new f(e,this.clonePartiallySelectedTextNodes)},detach:function(e){e&&this.range.detach(),this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}},g.prototype={BAD_BOUNDARYPOINTS_ERR:1,INVALID_NODE_TYPE_ERR:2},g.prototype.toString=function(){return this.message},m.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){return this._current=this._next,this._next=this.nodes[++this._position],this._current},detach:function(){this._current=this._next=this.nodes=null}};var U=[1,3,4,5,7,8,10],Q=[2,9,11],W=[5,6,10,12],F=[1,3,4,5,7,8,10,11],K=[1,3,4,5,7,8],V=L.getRootContainer,X=p([9,11]),z=p(W),q=p([6,10,12]),Y=document.createElement("style"),$=!1;try{Y.innerHTML="<b>x</b>",$=3==Y.firstChild.nodeType}catch(G){}e.features.htmlParsingConforms=$;var Z=$?function(e){var t=this.startContainer,n=L.getDocument(t);if(!t)throw new j("INVALID_STATE_ERR");var i=null;return 1==t.nodeType?i=t:L.isCharacterDataNode(t)&&(i=L.parentElement(t)),i=null===i||"HTML"==i.nodeName&&L.isHtmlNamespace(L.getDocument(i).documentElement)&&L.isHtmlNamespace(i)?n.createElement("body"):i.cloneNode(!1),i.innerHTML=e,L.fragmentFromNodeChildren(i)}:function(e){v(this);var t=n(this),i=t.createElement("body");return i.innerHTML=e,L.fragmentFromNodeChildren(i)},J=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],et=0,tt=1,nt=2,it=3,rt=0,ot=1,st=2,at=3;w.prototype={attachListener:function(e,t){this._listeners[e].push(t)},compareBoundaryPoints:function(e,t){O(this),y(this.startContainer,t.startContainer);var n,i,r,o,s=e==it||e==et?"start":"end",a=e==tt||e==et?"start":"end";return n=this[s+"Container"],i=this[s+"Offset"],r=t[a+"Container"],o=t[a+"Offset"],L.comparePoints(n,i,r,o)},insertNode:function(e){if(O(this),N(e,F),_(this.startContainer),L.isAncestorOf(e,this.startContainer,!0))throw new j("HIERARCHY_REQUEST_ERR");var t=s(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){O(this);var e,t;if(this.collapsed)return n(this).createDocumentFragment();if(this.startContainer===this.endContainer&&L.isCharacterDataNode(this.startContainer))return e=this.startContainer.cloneNode(!0),e.data=e.data.slice(this.startOffset,this.endOffset),t=n(this).createDocumentFragment(),t.appendChild(e),t;var i=new f(this,!0);return e=a(i),i.detach(),e},canSurroundContents:function(){O(this),_(this.startContainer),_(this.endContainer);var e=new f(this,!0),n=e._first&&t(e._first,this)||e._last&&t(e._last,this);return e.detach(),!n},surroundContents:function(e){if(N(e,K),!this.canSurroundContents())throw new g("BAD_BOUNDARYPOINTS_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);s(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){O(this);for(var e,t=new M(n(this)),i=J.length;i--;)e=J[i],t[e]=this[e];return t},toString:function(){O(this);var e=this.startContainer;if(e===this.endContainer&&L.isCharacterDataNode(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new f(this,!0);return c(n,function(e){(3==e.nodeType||4==e.nodeType)&&t.push(e.data)}),n.detach(),t.join("")},compareNode:function(e){O(this);var t=e.parentNode,n=L.getNodeIndex(e);if(!t)throw new j("NOT_FOUND_ERR");var i=this.comparePoint(t,n),r=this.comparePoint(t,n+1);return 0>i?r>0?st:rt:r>0?ot:at},comparePoint:function(e,t){return O(this),T(e,"HIERARCHY_REQUEST_ERR"),y(e,this.startContainer),0>L.comparePoints(e,t,this.startContainer,this.startOffset)?-1:L.comparePoints(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:Z,toHtml:function(){O(this);var e=n(this).createElement("div");return e.appendChild(this.cloneContents()),e.innerHTML},intersectsNode:function(e,t){if(O(this),T(e,"NOT_FOUND_ERR"),L.getDocument(e)!==n(this))return!1;var i=e.parentNode,r=L.getNodeIndex(e);T(i,"NOT_FOUND_ERR");var o=L.comparePoints(i,r,this.endContainer,this.endOffset),s=L.comparePoints(i,r+1,this.startContainer,this.startOffset);return t?0>=o&&s>=0:0>o&&s>0},isPointInRange:function(e,t){return O(this),T(e,"HIERARCHY_REQUEST_ERR"),y(e,this.startContainer),L.comparePoints(e,t,this.startContainer,this.startOffset)>=0&&0>=L.comparePoints(e,t,this.endContainer,this.endOffset)},intersectsRange:function(e,t){if(O(this),n(e)!=n(this))throw new j("WRONG_DOCUMENT_ERR");var i=L.comparePoints(this.startContainer,this.startOffset,e.endContainer,e.endOffset),r=L.comparePoints(this.endContainer,this.endOffset,e.startContainer,e.startOffset);return t?0>=i&&r>=0:0>i&&r>0},intersection:function(e){if(this.intersectsRange(e)){var t=L.comparePoints(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=L.comparePoints(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsRange(e,!0)){var t=this.cloneRange();return-1==L.comparePoints(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==L.comparePoints(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new g("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):this.compareNode(e)==at},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&0>=this.comparePoint(e,L.getNodeLength(e))},containsRange:function(e){return this.intersection(e).equals(e)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();t.setEnd(i,i.length);var r=this.containsRange(t);return t.detach(),r}return this.containsNodeContents(e)},createNodeIterator:function(e,t){return O(this),new m(this,e,t)},getNodes:function(e,t){return O(this),u(this,e,t)},getDocument:function(){return n(this)},collapseBefore:function(e){v(this),this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){v(this),this.setStartAfter(e),this.collapse(!0)},getName:function(){return"DomRange"},equals:function(e){return M.rangesEqual(this,e)},isValid:function(){return b(this)},inspect:function(){return h(this)}},A(M,I,B),e.rangePrototype=w.prototype,M.rangeProperties=J,M.RangeIterator=f,M.copyComparisonConstants=x,M.createPrototypeRange=A,M.inspect=h,M.getRangeDocument=n,M.rangesEqual=function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset},e.DomRange=M,e.RangeException=g}),rangy.createModule("WrappedRange",function(e){function t(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();n=e.duplicate(),n.collapse(!1);var r=n.parentElement(),o=i==r?i:s.getCommonAncestor(i,r);return o==t?o:s.getCommonAncestor(t,o)}function n(e){return 0==e.compareEndPoints("StartToEnd",e)}function i(e,t,n,i){var r=e.duplicate();r.collapse(n);var o=r.parentElement();if(s.isAncestorOf(t,o,!0)||(o=t),!o.canHaveHTML)return new a(o.parentNode,s.getNodeIndex(o));var c,l,d,u,h,f=s.getDocument(o).createElement("span"),g=n?"StartToStart":"StartToEnd";do o.insertBefore(f,f.previousSibling),r.moveToElementText(f);while((c=r.compareEndPoints(g,e))>0&&f.previousSibling);if(h=f.nextSibling,-1==c&&h&&s.isCharacterDataNode(h)){r.setEndPoint(n?"EndToStart":"EndToEnd",e);var m;if(/[\r\n]/.test(h.data)){var p=r.duplicate(),C=p.text.replace(/\r\n/g,"\r").length;for(m=p.moveStart("character",C);-1==(c=p.compareEndPoints("StartToEnd",p));)m++,p.moveStart("character",1)}else m=r.text.length;u=new a(h,m)}else l=(i||!n)&&f.previousSibling,d=(i||n)&&f.nextSibling,u=d&&s.isCharacterDataNode(d)?new a(d,0):l&&s.isCharacterDataNode(l)?new a(l,l.length):new a(o,s.getNodeIndex(f));return f.parentNode.removeChild(f),u}function r(e,t){var n,i,r,o,a=e.offset,c=s.getDocument(e.node),l=c.body.createTextRange(),d=s.isCharacterDataNode(e.node);return d?(n=e.node,i=n.parentNode):(o=e.node.childNodes,n=o.length>a?o[a]:null,i=e.node),r=c.createElement("span"),r.innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),l.moveToElementText(r),l.collapse(!t),i.removeChild(r),d&&l[t?"moveStart":"moveEnd"]("character",a),l}e.requireModules(["DomUtil","DomRange"]);var o,s=e.dom,a=s.DomPosition,c=e.DomRange;if(!e.features.implementsDomRange||e.features.implementsTextRange&&e.config.preferTextRange){if(e.features.implementsTextRange){o=function(e){this.textRange=e,this.refresh()},o.prototype=new c(document),o.prototype.refresh=function(){var e,r,o=t(this.textRange);n(this.textRange)?r=e=i(this.textRange,o,!0,!0):(e=i(this.textRange,o,!0,!1),r=i(this.textRange,o,!1,!1)),this.setStart(e.node,e.offset),this.setEnd(r.node,r.offset)},c.copyComparisonConstants(o);var l=function(){return this}();l.Range===void 0&&(l.Range=o),e.createNativeRange=function(e){return e=e||document,e.body.createTextRange()}}}else(function(){function t(e){for(var t,n=d.length;n--;)t=d[n],e[t]=e.nativeRange[t]}function n(e,t,n,i,r){var o=e.startContainer!==t||e.startOffset!=n,s=e.endContainer!==i||e.endOffset!=r;(o||s)&&(e.setEnd(i,r),e.setStart(t,n))}function i(e){e.nativeRange.detach(),e.detached=!0;for(var t,n=d.length;n--;)t=d[n],e[t]=null}var r,a,l,d=c.rangeProperties;o=function(e){if(!e)throw Error("Range must be specified");this.nativeRange=e,t(this)},c.createPrototypeRange(o,n,i),r=o.prototype,r.selectNode=function(e){this.nativeRange.selectNode(e),t(this)},r.deleteContents=function(){this.nativeRange.deleteContents(),t(this)},r.extractContents=function(){var e=this.nativeRange.extractContents();return t(this),e},r.cloneContents=function(){return this.nativeRange.cloneContents()},r.surroundContents=function(e){this.nativeRange.surroundContents(e),t(this)},r.collapse=function(e){this.nativeRange.collapse(e),t(this)},r.cloneRange=function(){return new o(this.nativeRange.cloneRange())},r.refresh=function(){t(this)},r.toString=function(){return""+this.nativeRange};var u=document.createTextNode("test");s.getBody(document).appendChild(u);var h=document.createRange();h.setStart(u,0),h.setEnd(u,0);try{h.setStart(u,1),a=!0,r.setStart=function(e,n){this.nativeRange.setStart(e,n),t(this)},r.setEnd=function(e,n){this.nativeRange.setEnd(e,n),t(this)},l=function(e){return function(n){this.nativeRange[e](n),t(this)}}}catch(f){a=!1,r.setStart=function(e,n){try{this.nativeRange.setStart(e,n)}catch(i){this.nativeRange.setEnd(e,n),this.nativeRange.setStart(e,n)}t(this)},r.setEnd=function(e,n){try{this.nativeRange.setEnd(e,n)}catch(i){this.nativeRange.setStart(e,n),this.nativeRange.setEnd(e,n)}t(this)},l=function(e,n){return function(i){try{this.nativeRange[e](i)}catch(r){this.nativeRange[n](i),this.nativeRange[e](i)}t(this)}}}r.setStartBefore=l("setStartBefore","setEndBefore"),r.setStartAfter=l("setStartAfter","setEndAfter"),r.setEndBefore=l("setEndBefore","setStartBefore"),r.setEndAfter=l("setEndAfter","setStartAfter"),h.selectNodeContents(u),r.selectNodeContents=h.startContainer==u&&h.endContainer==u&&0==h.startOffset&&h.endOffset==u.length?function(e){this.nativeRange.selectNodeContents(e),t(this)}:function(e){this.setStart(e,0),this.setEnd(e,c.getEndOffset(e))},h.selectNodeContents(u),h.setEnd(u,3);var g=document.createRange();g.selectNodeContents(u),g.setEnd(u,4),g.setStart(u,2),r.compareBoundaryPoints=-1==h.compareBoundaryPoints(h.START_TO_END,g)&1==h.compareBoundaryPoints(h.END_TO_START,g)?function(e,t){return t=t.nativeRange||t,e==t.START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)},e.util.isHostMethod(h,"createContextualFragment")&&(r.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),s.getBody(document).removeChild(u),h.detach(),g.detach()})(),e.createNativeRange=function(e){return e=e||document,e.createRange()};e.features.implementsTextRange&&(o.rangeToTextRange=function(e){if(e.collapsed){var t=r(new a(e.startContainer,e.startOffset),!0);return t}var n=r(new a(e.startContainer,e.startOffset),!0),i=r(new a(e.endContainer,e.endOffset),!1),o=s.getDocument(e.startContainer).body.createTextRange();return o.setEndPoint("StartToStart",n),o.setEndPoint("EndToEnd",i),o}),o.prototype.getName=function(){return"WrappedRange"},e.WrappedRange=o,e.createRange=function(t){return t=t||document,new o(e.createNativeRange(t))},e.createRangyRange=function(e){return e=e||document,new c(e)},e.createIframeRange=function(t){return e.createRange(s.getIframeDocument(t))},e.createIframeRangyRange=function(t){return e.createRangyRange(s.getIframeDocument(t))},e.addCreateMissingNativeApiListener(function(t){var n=t.document;n.createRange===void 0&&(n.createRange=function(){return e.createRange(this)}),n=t=null})}),rangy.createModule("WrappedSelection",function(e,t){function n(e){return(e||window).getSelection()}function i(e){return(e||window).document.selection}function r(e,t,n){var i=n?"end":"start",r=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"Offset"]}function o(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}function s(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function a(t){var n;return t instanceof S?(n=t._selectionNativeRange,n||(n=e.createNativeRange(_.getDocument(t.startContainer)),n.setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset),t._selectionNativeRange=n,t.attachListener("detach",function(){this._selectionNativeRange=null}))):t instanceof R?n=t.nativeRange:e.features.implementsDomRange&&t instanceof _.getWindow(t.startContainer).Range&&(n=t),n}function c(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;n>t;++t)if(!_.isAncestorOf(e[0],e[t]))return!1;return!0}function l(e){var t=e.getNodes();if(!c(t))throw Error("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return t[0]}function d(e){return!!e&&e.text!==void 0}function u(e,t){var n=new R(t);e._ranges=[n],r(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function h(t){if(t._ranges.length=0,"None"==t.docSelection.type)s(t);else{var n=t.docSelection.createRange();if(d(n))u(t,n);else{t.rangeCount=n.length;for(var i,o=_.getDocument(n.item(0)),a=0;t.rangeCount>a;++a)i=e.createRange(o),i.selectNode(n.item(a)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,r(t,t._ranges[t.rangeCount-1],!1) +}}}function f(e,t){for(var n=e.docSelection.createRange(),i=l(t),r=_.getDocument(n.item(0)),o=_.getBody(r).createControlRange(),s=0,a=n.length;a>s;++s)o.add(n.item(s));try{o.add(i)}catch(c){throw Error("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}o.select(),h(e)}function g(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function m(e,t){for(var n,i=_.getDocument(t[0].startContainer),r=_.getBody(i).createControlRange(),o=0;rangeCount>o;++o){n=l(t[o]);try{r.add(n)}catch(s){throw Error("setRanges(): Element within the one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),h(e)}function p(e,t){if(e.anchorNode&&_.getDocument(e.anchorNode)!==_.getDocument(t))throw new b("WRONG_DOCUMENT_ERR")}function C(e){var t=[],n=new O(e.anchorNode,e.anchorOffset),i=new O(e.focusNode,e.focusOffset),r="function"==typeof e.getName?e.getName():"Selection";if(e.rangeCount!==void 0)for(var o=0,s=e.rangeCount;s>o;++o)t[o]=S.inspect(e.getRangeAt(o));return"["+r+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}e.requireModules(["DomUtil","DomRange","WrappedRange"]),e.config.checkSelectionRanges=!0;var v,N,E="boolean",y="_rangySelection",_=e.dom,T=e.util,S=e.DomRange,R=e.WrappedRange,b=e.DOMException,O=_.DomPosition,w="Control",D=e.util.isHostMethod(window,"getSelection"),x=e.util.isHostObject(document,"selection"),k=x&&(!D||e.config.preferTextRange);k?(v=i,e.isSelectionValid=function(e){var t=(e||window).document,n=t.selection;return"None"!=n.type||_.getDocument(n.createRange().parentElement())==t}):D?(v=n,e.isSelectionValid=function(){return!0}):t.fail("Neither document.selection or window.getSelection() detected."),e.getNativeSelection=v;var A=v(),P=e.createNativeRange(document),I=_.getBody(document),B=T.areHostObjects(A,["anchorNode","focusNode"]&&T.areHostProperties(A,["anchorOffset","focusOffset"]));e.features.selectionHasAnchorAndFocus=B;var M=T.isHostMethod(A,"extend");e.features.selectionHasExtend=M;var L="number"==typeof A.rangeCount;e.features.selectionHasRangeCount=L;var H=!1,j=!0;T.areHostMethods(A,["addRange","getRangeAt","removeAllRanges"])&&"number"==typeof A.rangeCount&&e.features.implementsDomRange&&function(){var e=document.createElement("iframe");e.frameBorder=0,e.style.position="absolute",e.style.left="-10000px",I.appendChild(e);var t=_.getIframeDocument(e);t.open(),t.write("<html><head></head><body>12</body></html>"),t.close();var n=_.getIframeWindow(e).getSelection(),i=t.documentElement,r=i.lastChild,o=r.firstChild,s=t.createRange();s.setStart(o,1),s.collapse(!0),n.addRange(s),j=1==n.rangeCount,n.removeAllRanges();var a=s.cloneRange();s.setStart(o,0),a.setEnd(o,2),n.addRange(s),n.addRange(a),H=2==n.rangeCount,s.detach(),a.detach(),I.removeChild(e)}(),e.features.selectionSupportsMultipleRanges=H,e.features.collapsedNonEditableSelectionsSupported=j;var U,Q=!1;I&&T.isHostMethod(I,"createControlRange")&&(U=I.createControlRange(),T.areHostProperties(U,["item","add"])&&(Q=!0)),e.features.implementsControlRange=Q,N=B?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return e.rangeCount?e.getRangeAt(e.rangeCount-1).collapsed:!1};var W;T.isHostMethod(A,"getRangeAt")?W=function(e,t){try{return e.getRangeAt(t)}catch(n){return null}}:B&&(W=function(t){var n=_.getDocument(t.anchorNode),i=e.createRange(n);return i.setStart(t.anchorNode,t.anchorOffset),i.setEnd(t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&(i.setStart(t.focusNode,t.focusOffset),i.setEnd(t.anchorNode,t.anchorOffset)),i}),e.getSelection=function(e){e=e||window;var t=e[y],n=v(e),r=x?i(e):null;return t?(t.nativeSelection=n,t.docSelection=r,t.refresh(e)):(t=new g(n,r,e),e[y]=t),t},e.getIframeSelection=function(t){return e.getSelection(_.getIframeWindow(t))};var F=g.prototype;if(!k&&B&&T.areHostMethods(A,["removeAllRanges","addRange"])){F.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),s(this)};var K=function(t,n){var i=S.getRangeDocument(n),r=e.createRange(i);r.collapseToPoint(n.endContainer,n.endOffset),t.nativeSelection.addRange(a(r)),t.nativeSelection.extend(n.startContainer,n.startOffset),t.refresh()};F.addRange=L?function(t,n){if(Q&&x&&this.docSelection.type==w)f(this,t);else if(n&&M)K(this,t);else{var i;if(H?i=this.rangeCount:(this.removeAllRanges(),i=0),this.nativeSelection.addRange(a(t)),this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==i+1){if(e.config.checkSelectionRanges){var o=W(this.nativeSelection,this.rangeCount-1);o&&!S.rangesEqual(o,t)&&(t=new R(o))}this._ranges[this.rangeCount-1]=t,r(this,t,z(this.nativeSelection)),this.isCollapsed=N(this)}else this.refresh()}}:function(e,t){t&&M?K(this,e):(this.nativeSelection.addRange(a(e)),this.refresh())},F.setRanges=function(e){if(Q&&e.length>1)m(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;n>t;++t)this.addRange(e[t])}}}else{if(!(T.isHostMethod(A,"empty")&&T.isHostMethod(P,"select")&&Q&&k))return t.fail("No means of selecting a Range or TextRange was found"),!1;F.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=_.getDocument(this.anchorNode);else if(this.docSelection.type==w){var t=this.docSelection.createRange();t.length&&(e=_.getDocument(t.item(0)).body.createTextRange())}if(e){var n=e.body.createTextRange();n.select(),this.docSelection.empty()}}}catch(i){}s(this)},F.addRange=function(e){this.docSelection.type==w?f(this,e):(R.rangeToTextRange(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,r(this,e,!1))},F.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?m(this,e):t&&this.addRange(e[0])}}F.getRangeAt=function(e){if(0>e||e>=this.rangeCount)throw new b("INDEX_SIZE_ERR");return this._ranges[e]};var V;if(k)V=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=_.getBody(t.win.document).createTextRange(),n.collapse(!0)),t.docSelection.type==w?h(t):d(n)?u(t,n):s(t)};else if(T.isHostMethod(A,"getRangeAt")&&"number"==typeof A.rangeCount)V=function(t){if(Q&&x&&t.docSelection.type==w)h(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,i=t.rangeCount;i>n;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));r(t,t._ranges[t.rangeCount-1],z(t.nativeSelection)),t.isCollapsed=N(t)}else s(t)};else{if(!B||typeof A.isCollapsed!=E||typeof P.collapsed!=E||!e.features.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;V=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=W(n,0),e._ranges=[t],e.rangeCount=1,o(e),e.isCollapsed=N(e)):s(e)}}F.refresh=function(e){var t=e?this._ranges.slice(0):null;if(V(this),e){var n=t.length;if(n!=this._ranges.length)return!1;for(;n--;)if(!S.rangesEqual(t[n],this._ranges[n]))return!1;return!0}};var X=function(e,t){var n=e.getAllRanges(),i=!1;e.removeAllRanges();for(var r=0,o=n.length;o>r;++r)i||t!==n[r]?e.addRange(n[r]):i=!0;e.rangeCount||s(e)};F.removeRange=Q?function(e){if(this.docSelection.type==w){for(var t,n=this.docSelection.createRange(),i=l(e),r=_.getDocument(n.item(0)),o=_.getBody(r).createControlRange(),s=!1,a=0,c=n.length;c>a;++a)t=n.item(a),t!==i||s?o.add(n.item(a)):s=!0;o.select(),h(this)}else X(this,e)}:function(e){X(this,e)};var z;!k&&B&&e.features.implementsDomRange?(z=function(e){var t=!1;return e.anchorNode&&(t=1==_.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t},F.isBackwards=function(){return z(this)}):z=F.isBackwards=function(){return!1},F.toString=function(){for(var e=[],t=0,n=this.rangeCount;n>t;++t)e[t]=""+this._ranges[t];return e.join("")},F.collapse=function(t,n){p(this,t);var i=e.createRange(_.getDocument(t));i.collapseToPoint(t,n),this.removeAllRanges(),this.addRange(i),this.isCollapsed=!0},F.collapseToStart=function(){if(!this.rangeCount)throw new b("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},F.collapseToEnd=function(){if(!this.rangeCount)throw new b("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},F.selectAllChildren=function(t){p(this,t);var n=e.createRange(_.getDocument(t));n.selectNodeContents(t),this.removeAllRanges(),this.addRange(n)},F.deleteFromDocument=function(){if(Q&&x&&this.docSelection.type==w){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),e.parentNode.removeChild(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();this.removeAllRanges();for(var i=0,r=n.length;r>i;++i)n[i].deleteContents();this.addRange(n[r-1])}},F.getAllRanges=function(){return this._ranges.slice(0)},F.setSingleRange=function(e){this.setRanges([e])},F.containsNode=function(e,t){for(var n=0,i=this._ranges.length;i>n;++n)if(this._ranges[n].containsNode(e,t))return!0;return!1},F.toHtml=function(){var e="";if(this.rangeCount){for(var t=S.getRangeDocument(this._ranges[0]).createElement("div"),n=0,i=this._ranges.length;i>n;++n)t.appendChild(this._ranges[n].cloneContents());e=t.innerHTML}return e},F.getName=function(){return"WrappedSelection"},F.inspect=function(){return C(this)},F.detach=function(){this.win[y]=null,this.win=this.anchorNode=this.focusNode=null},g.inspect=C,e.Selection=g,e.selectionPrototype=F,e.addCreateMissingNativeApiListener(function(t){t.getSelection===void 0&&(t.getSelection=function(){return e.getSelection(this)}),t=null})}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),"indexOf"in Array.prototype||(Array.prototype.indexOf=function(e,t){void 0===t&&(t=0),0>t&&(t+=this.length),0>t&&(t=0);for(var n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1}),"lastIndexOf"in Array.prototype||(Array.prototype.lastIndexOf=function(e,t){for(void 0===t&&(t=this.length-1),0>t&&(t+=this.length),t>this.length-1&&(t=this.length-1),t++;t-->0;)if(t in this&&this[t]===e)return t;return-1}),"map"in Array.prototype||(Array.prototype.map=function(e,t){for(var n=Array(this.length),i=0,r=this.length;r>i;i++)i in this&&(n[i]=e.call(t,this[i],i,this));return n}),"filter"in Array.prototype||(Array.prototype.filter=function(e,t){for(var n,i=[],r=0,o=this.length;o>r;r++)r in this&&e.call(t,n=this[r],r,this)&&i.push(n);return i}),function(){var e,t,n=this;e={changeIdAttribute:"data-cid",userIdAttribute:"data-userid",userNameAttribute:"data-username",timeAttribute:"data-time",attrValuePrefix:"",blockEl:"p",blockEls:["p","ol","ul","li","h1","h2","h3","h4","h5","h6","blockquote"],stylePrefix:"cts",currentUser:{id:null,name:null},changeTypes:{insertType:{tag:"span",alias:"ins",action:"Inserted"},deleteType:{tag:"span",alias:"del",action:"Deleted"}},handleEvents:!1,contentEditable:!0,isTracking:!0,noTrack:".ice-no-track",avoid:".ice-avoid",mergeBlocks:!0},t=function(t){if(this._changes={},t||(t={}),!t.element)throw Error("`options.element` must be defined for ice construction.");ice.dom.extend(!0,this,e,t),this.pluginsManager=new ice.IcePluginManager(this),t.plugins&&this.pluginsManager.usePlugins("ice-init",t.plugins)},t.prototype={_userStyles:{},_styles:{},_uniqueStyleIndex:0,_browserType:null,_batchChangeid:null,_uniqueIDIndex:1,_delBookmark:"tempdel",isPlaceHoldingDeletes:!1,startTracking:function(){if(this.element.setAttribute("contentEditable",this.contentEditable),this.handleEvents){var e=this;ice.dom.bind(e.element,"keyup.ice keydown.ice keypress.ice mousedown.ice mouseup.ice",function(t){return e.handleEvent(t)})}return this.initializeEnvironment(),this.initializeEditor(),this.initializeRange(),this.pluginsManager.fireEnabled(this.element),this},stopTracking:function(){if(this.element.setAttribute("contentEditable",!this.contentEditable),this.handleEvents){var e=this;ice.dom.unbind(e.element,"keyup.ice keydown.ice keypress.ice mousedown.ice mouseup.ice")}return this.pluginsManager.fireDisabled(this.element),this},initializeEnvironment:function(){this.env||(this.env={}),this.env.element=this.element,this.env.document=this.element.ownerDocument,this.env.window=this.env.document.defaultView||this.env.document.parentWindow||window,this.env.frame=this.env.window.frameElement,this.env.selection=this.selection=new ice.Selection(this.env),this.env.document.createElement(this.changeTypes.insertType.tag),this.env.document.createElement(this.changeTypes.deleteType.tag)},initializeRange:function(){var e=this.selection.createRange();e.setStart(ice.dom.find(this.element,this.blockEls.join(", "))[0],0),e.collapse(!0),this.selection.addRange(e),this.env.frame?this.env.frame.contentWindow.focus():this.element.focus()},initializeEditor:function(){var e=this,t=this.env.document.createElement("div");this.element.childNodes.length?(t.innerHTML=this.element.innerHTML,ice.dom.removeWhitespace(t),""===t.innerHTML&&t.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">"))):t.appendChild(ice.dom.create("<"+this.blockEl+" ><br/></"+this.blockEl+">")),this.element.innerHTML=t.innerHTML;var n=[];for(var i in this.changeTypes)n.push(this._getIceNodeClass(i));ice.dom.each(ice.dom.find(this.element,"."+n.join(", .")),function(t,i){for(var r=0,o="",s=i.className.split(" "),t=0;s.length>t;t++){var a=RegExp(e.stylePrefix+"-(\\d+)").exec(s[t]);a&&(r=a[1]);var c=RegExp("("+n.join("|")+")").exec(s[t]);c&&(o=e._getChangeTypeFromAlias(c[1]))}var l=ice.dom.attr(i,e.userIdAttribute);e.setUserStyle(l,Number(r));var d=ice.dom.attr(i,e.changeIdAttribute);e._changes[d]={type:o,userid:l,username:ice.dom.attr(i,e.userNameAttribute),time:ice.dom.attr(i,e.timeAttribute)}})},enableChangeTracking:function(){this.isTracking=!0,this.pluginsManager.fireEnabled(this.element)},disableChangeTracking:function(){this.isTracking=!1,this.pluginsManager.fireDisabled(this.element)},setCurrentUser:function(e){this.currentUser=e},handleEvent:function(e){if(this.isTracking)if("mouseup"==e.type){var t=this;setTimeout(function(){t.mouseUp(e)},200)}else{if("mousedown"==e.type)return this.mouseDown(e);if("keypress"==e.type){var n=this.keyPress(e);return n||e.preventDefault(),n}if("keydown"==e.type){var n=this.keyDown(e);return n||e.preventDefault(),n}"keyup"==e.type&&this.pluginsManager.fireCaretUpdated()}},createIceNode:function(e,t){var n=this.env.document.createElement(this.changeTypes[e].tag);return ice.dom.addClass(n,this._getIceNodeClass(e)),n.appendChild(t?t:this.env.document.createTextNode("")),this.addChange(this.changeTypes[e].alias,[n]),this.pluginsManager.fireNodeCreated(n,{action:this.changeTypes[e].action}),n},insert:function(e,t){var n=!e;if(e||(e=""),t?this.selection.addRange(t):t=this.getCurrentRange(),"string"==typeof e&&(e=document.createTextNode(e)),!t.collapsed&&(this.deleteContents(),t=this.getCurrentRange(),t.startContainer===t.endContainer&&this.element===t.startContainer)){ice.dom.empty(this.element);var i=t.getLastSelectableChild(this.element);t.setStartAfter(i),t.collapse(!0)}this._moveRangeToValidTrackingPos(t);var r=this.startBatchChange();return this._insertNode(e,t,n),this.pluginsManager.fireNodeInserted(e,t),this.endBatchChange(r),n},placeholdDeletes:function(){var e=this;this.isPlaceholdingDeletes&&this.revertDeletePlaceholders(),this.isPlaceholdingDeletes=!0,this._deletes=[];var t="."+this._getIceNodeClass("deleteType");return ice.dom.each(ice.dom.find(this.element,t),function(t,n){e._deletes.push(ice.dom.cloneNode(n)),ice.dom.replaceWith(n,"<"+e._delBookmark+' data-allocation="'+(e._deletes.length-1)+'"/>')}),!0},revertDeletePlaceholders:function(){var e=this;return this.isPlaceholdingDeletes?(ice.dom.each(this._deletes,function(t,n){ice.dom.find(e.element,e._delBookmark+"[data-allocation="+t+"]").replaceWith(n)}),this.isPlaceholdingDeletes=!1,!0):!1},deleteContents:function(e,t){var n=!0;t?this.selection.addRange(t):t=this.getCurrentRange();var i=this.startBatchChange(this.changeTypes.deleteType.alias);return t.collapsed===!1?this._deleteSelection(t):n=e?this._deleteRight(t):this._deleteLeft(t),this.selection.addRange(t),this.endBatchChange(i),n},getChanges:function(){return this._changes},getChangeUserids:function(){var e=[],t=Object.keys(this._changes);for(var n in t)e.push(this._changes[t[n]].userid);return e.sort().filter(function(e,t,n){return t==n.indexOf(e)?1:0})},getElementContent:function(){return this.element.innerHTML},getCleanContent:function(e,t,n){var i="",r=this;ice.dom.each(this.changeTypes,function(e,t){"deleteType"!=e&&(t>0&&(i+=","),i+="."+r._getIceNodeClass(e))}),e=e?"string"==typeof e?ice.dom.create("<div>"+e+"</div>"):ice.dom.cloneNode(e,!1)[0]:ice.dom.cloneNode(this.element,!1)[0],e=n?n.call(this,e):e;var o=ice.dom.find(e,i);ice.dom.each(o,function(){ice.dom.replaceWith(this,ice.dom.contents(this))});var s=ice.dom.find(e,"."+this._getIceNodeClass("deleteType"));return ice.dom.remove(s),e=t?t.call(this,e):e,e.innerHTML},acceptAll:function(){this.element.innerHTML=this.getCleanContent()},rejectAll:function(){var e="."+this._getIceNodeClass("insertType"),t="."+this._getIceNodeClass("deleteType");ice.dom.remove(ice.dom.find(this.element,e)),ice.dom.each(ice.dom.find(this.element,t),function(e,t){ice.dom.replaceWith(t,ice.dom.contents(t))})},acceptChange:function(e){this.acceptRejectChange(e,!0)},rejectChange:function(e){this.acceptRejectChange(e,!1)},acceptRejectChange:function(e,t){var n,i,r,o,s,a,c,l=ice.dom;if(!e){var d=this.getCurrentRange();if(!d.collapsed)return;e=d.startContainer}n=o="."+this._getIceNodeClass("deleteType"),i=s="."+this._getIceNodeClass("insertType"),r=n+","+i,a=l.getNode(e,r),c=l.find(this.element,"["+this.changeIdAttribute+"="+l.attr(a,this.changeIdAttribute)+"]"),t||(o=i,s=n),ice.dom.is(a,s)?l.each(c,function(e,t){l.replaceWith(t,ice.dom.contents(t))}):l.is(a,o)&&l.remove(c)},isInsideChange:function(e){var t="."+this._getIceNodeClass("insertType")+", ."+this._getIceNodeClass("deleteType");if(!e){if(range=this.getCurrentRange(),!range.collapsed)return!1;e=range.startContainer}return!!ice.dom.getNode(e,t)},addChangeType:function(e,t,n,i){var r={tag:t,alias:n};i&&(r.action=i),this.changeTypes[e]=r},getIceNode:function(e,t){var n="."+this._getIceNodeClass(t);return ice.dom.getNode(e,n)},_moveRangeToValidTrackingPos:function(e){for(var t=!1,n=this._getVoidElement(e.endContainer);n;){try{e.moveEnd(ice.dom.CHARACTER_UNIT,1),e.moveEnd(ice.dom.CHARACTER_UNIT,-1)}catch(i){t=!0}if(t||ice.dom.onBlockBoundary(e.endContainer,e.startContainer,this.blockEls)){e.setStartAfter(n),e.collapse(!0);break}n=this._getVoidElement(e.endContainer),n?(e.setEnd(e.endContainer,0),e.moveEnd(ice.dom.CHARACTER_UNIT,ice.dom.getNodeCharacterLength(e.endContainer)),e.collapse()):(e.setStart(e.endContainer,0),e.collapse(!0))}},_getNoTrackElement:function(e){var t=this._getNoTrackSelector(),n=ice.dom.is(e,t)?e:ice.dom.parents(e,t)[0]||null;return n},_getNoTrackSelector:function(){return this.noTrack},_getVoidElement:function(e){var t=this._getVoidElSelector();return ice.dom.is(e,t)?e:ice.dom.parents(e,t)[0]||null},_getVoidElSelector:function(){return"."+this._getIceNodeClass("deleteType")+","+this.avoid},_currentUserIceNode:function(e){return ice.dom.attr(e,this.userIdAttribute)==this.currentUser.id},_getChangeTypeFromAlias:function(e){var t,n=null;for(t in this.changeTypes)this.changeTypes.hasOwnProperty(t)&&this.changeTypes[t].alias==e&&(n=t);return n},_getIceNodeClass:function(e){return this.attrValuePrefix+this.changeTypes[e].alias},getUserStyle:function(e){var t=null;return t=this._userStyles[e]?this._userStyles[e]:this.setUserStyle(e,this.getNewStyleId())},setUserStyle:function(e,t){var n=this.stylePrefix+"-"+t;return this._styles[t]||(this._styles[t]=!0),this._userStyles[e]=n},getNewStyleId:function(){var e=++this._uniqueStyleIndex;return this._styles[e]?this.getNewStyleId():(this._styles[e]=!0,e)},addChange:function(e,t){var n=this._batchChangeid||this.getNewChangeId();this._changes[n]||(this._changes[n]={type:this._getChangeTypeFromAlias(e),time:(new Date).getTime(),userid:this.currentUser.id,username:this.currentUser.name});var i=this;return ice.dom.foreach(t,function(e){i.addNodeToChange(n,t[e])}),n},addNodeToChange:function(e,t){null!==this._batchChangeid&&(e=this._batchChangeid);var n=this.getChange(e);t.getAttribute(this.changeIdAttribute)||t.setAttribute(this.changeIdAttribute,e),t.getAttribute(this.userIdAttribute)||t.setAttribute(this.userIdAttribute,n.userid),t.getAttribute(this.userNameAttribute)||t.setAttribute(this.userNameAttribute,n.username),t.getAttribute(this.timeAttribute)||t.setAttribute(this.timeAttribute,n.time),ice.dom.hasClass(t,this._getIceNodeClass(n.type))||ice.dom.addClass(t,this._getIceNodeClass(n.type));var i=this.getUserStyle(n.userid);ice.dom.hasClass(t,i)||ice.dom.addClass(t,i)},getChange:function(e){var t=null;return this._changes[e]&&(t=this._changes[e]),t},getNewChangeId:function(){var e=++this._uniqueIDIndex;return this._changes[e]&&(e=this.getNewChangeId()),e},startBatchChange:function(){return this._batchChangeid=this.getNewChangeId(),this._batchChangeid},endBatchChange:function(e){e===this._batchChangeid&&(this._batchChangeid=null)},getCurrentRange:function(){return this.selection.getRangeAt(0)},_insertNode:function(e,t,n){ice.dom.isBlockElement(t.startContainer)||ice.dom.canContainTextElement(ice.dom.getBlockParent(t.startContainer,this.element))||!t.startContainer.previousSibling||t.setStart(t.startContainer.previousSibling,0),t.startContainer;var i=ice.dom.isBlockElement(t.startContainer)&&t.startContainer||ice.dom.getBlockParent(t.startContainer,this.element)||null;if(i===this.element){var r=document.createElement(this.blockEl);return i.appendChild(r),t.setStart(r,0),t.collapse(),this._insertNode(e,t,n)}ice.dom.hasNoTextOrStubContent(i)&&(ice.dom.empty(i),ice.dom.append(i,"<br>"),t.setStart(i,0));var o=this.getIceNode(t.startContainer,"insertType"),s=this._currentUserIceNode(o);n&&s||(s||(e=this.createIceNode("insertType",e)),t.insertNode(e),t.setEnd(e,1),n?t.setStart(e,0):t.collapse(),this.selection.addRange(t))},_handleVoidEl:function(e,t){var n=this._getVoidElement(e);return n&&!this.getIceNode(n,"deleteType")?(t.collapse(!0),!0):!1},_deleteSelection:function(e){for(var t=new ice.Bookmark(this.env,e),n=ice.dom.getElementsBetween(t.start,t.end),i=ice.dom.parents(e.startContainer,this.blockEls.join(", "))[0],r=ice.dom.parents(e.endContainer,this.blockEls.join(", "))[0],o=[],s=0;n.length>s;s++){var a=n[s];if(!ice.dom.isBlockElement(a)||(o.push(a),ice.dom.canContainTextElement(a))){if((a.nodeType!==ice.dom.TEXT_NODE||0!==ice.dom.getNodeTextContent(a).length)&&!this._getVoidElement(a)){if(a.nodeType!==ice.dom.TEXT_NODE){if(ice.dom.BREAK_ELEMENT==ice.dom.getTagName(a))continue;if(ice.dom.isStubElement(a)){this._addNodeTracking(a,!1,!0);continue}for(ice.dom.hasNoTextOrStubContent(a)&&ice.dom.remove(a),j=0;a.childNodes.length>j;j++){var c=a.childNodes[j];n.push(c)}continue}var l=ice.dom.getBlockParent(a);this._addNodeTracking(a,!1,!0,!0),ice.dom.hasNoTextOrStubContent(l)&&ice.dom.remove(l)}}else for(var d=0;a.childNodes.length>d;d++)n.push(a.childNodes[d])}if(this.mergeBlocks&&i!==r){for(;o.length;)ice.dom.mergeContainers(o.shift(),i);ice.dom.removeBRFromChild(r),ice.dom.removeBRFromChild(i),ice.dom.mergeContainers(r,i)}t.selectBookmark(),e.collapse(!1)},_deleteRight:function(e){var t,n,i=ice.dom.isBlockElement(e.startContainer)&&e.startContainer||ice.dom.getBlockParent(e.startContainer,this.element)||null,r=i?ice.dom.hasNoTextOrStubContent(i):!1,o=i&&ice.dom.getNextContentNode(i,this.element),s=o?ice.dom.hasNoTextOrStubContent(o):!1,a=e.endContainer,c=e.endOffset,l=e.commonAncestorContainer;if(r)return!1;if(l.nodeType!==ice.dom.TEXT_NODE){if(0===c&&ice.dom.isBlockElement(l)&&!ice.dom.canContainTextElement(l)){var d=l.firstElementChild;if(d)return e.setStart(d,0),e.collapse(),this._deleteRight(e)}if(l.childNodes.length>c){var u=document.createTextNode(" ");return l.insertBefore(u,l.childNodes[c]),e.setStart(u,1),e.collapse(!0),n=this._deleteRight(e),ice.dom.remove(u),n}return t=ice.dom.getNextContentNode(l,this.element),e.setEnd(t,0),e.collapse(),this._deleteRight(e)}if(e.moveEnd(ice.dom.CHARACTER_UNIT,1),e.moveEnd(ice.dom.CHARACTER_UNIT,-1),c===a.data.length&&!ice.dom.hasNoTextOrStubContent(a)){if(t=ice.dom.getNextNode(a,this.element),!t)return e.selectNodeContents(a),e.collapse(),!1;if(ice.dom.BREAK_ELEMENT==ice.dom.getTagName(t)&&(t=ice.dom.getNextNode(t,this.element)),t.nodeType===ice.dom.TEXT_NODE&&(t=t.parentNode),!t.isContentEditable){n=this._addNodeTracking(t,!1,!1);var h=document.createTextNode("");return t.parentNode.insertBefore(h,t.nextSibling),e.selectNode(h),e.collapse(!0),n}if(this._handleVoidEl(t,e))return!0;if(ice.dom.isChildOf(t,i)&&ice.dom.isStubElement(t))return this._addNodeTracking(t,e,!1)}if(this._handleVoidEl(t,e))return!0;if(this._getNoTrackElement(e.endContainer.parentElement))return e.deleteContents(),!1;if(ice.dom.isOnBlockBoundary(e.startContainer,e.endContainer,this.element)){if(this.mergeBlocks&&ice.dom.is(ice.dom.getBlockParent(t,this.element),this.blockEl)){o!==ice.dom.getBlockParent(e.endContainer,this.element)&&e.setEnd(o,0);for(var f=ice.dom.getElementsBetween(e.startContainer,e.endContainer),g=0;f.length>g;g++)ice.dom.remove(f[g]);var m=e.startContainer,p=e.endContainer;return ice.dom.remove(ice.dom.find(m,"br")),ice.dom.remove(ice.dom.find(p,"br")),ice.dom.mergeBlockWithSibling(e,ice.dom.getBlockParent(e.endContainer,this.element)||i)}return s?(ice.dom.remove(o),e.collapse(!0),!0):(e.setStart(o,0),e.collapse(!0),!0)}var C=e.endContainer,v=C.splitText(e.endOffset);return v.splitText(1),this._addNodeTracking(v,e,!1)},_deleteLeft:function(e){var t,n,i=ice.dom.isBlockElement(e.startContainer)&&e.startContainer||ice.dom.getBlockParent(e.startContainer,this.element)||null,r=i?ice.dom.hasNoTextOrStubContent(i):!1,o=i&&ice.dom.getPrevContentNode(i,this.element),s=o?ice.dom.hasNoTextOrStubContent(o):!1,a=e.startContainer,c=e.startOffset,l=e.commonAncestorContainer;if(r)return!1;if(0===c||l.nodeType!==ice.dom.TEXT_NODE){if(ice.dom.isBlockElement(l)&&!ice.dom.canContainTextElement(l))if(0===c){var d=l.firstElementChild;if(d)return e.setStart(d,0),e.collapse(),this._deleteLeft(e)}else{var u=l.lastElementChild;if(u&&(t=e.getLastSelectableChild(u)))return e.setStart(t,t.data.length),e.collapse(),this._deleteLeft(e)}if(n=0===c?ice.dom.getPrevContentNode(a,this.element):l.childNodes[c-1],!n)return!1;if(ice.dom.is(n,"."+this._getIceNodeClass("insertType")+", ."+this._getIceNodeClass("deleteType"))&&n.childNodes.length>0&&n.lastChild&&(n=n.lastChild),n.nodeType===ice.dom.TEXT_NODE&&(n=n.parentNode),!n.isContentEditable){var h=this._addNodeTracking(n,!1,!0),f=document.createTextNode("");return n.parentNode.insertBefore(f,n),e.selectNode(f),e.collapse(!0),h}if(this._handleVoidEl(n,e))return!0;if(ice.dom.isStubElement(n)&&ice.dom.isChildOf(n,i)||!n.isContentEditable)return this._addNodeTracking(n,e,!0);if(ice.dom.isStubElement(n))return ice.dom.remove(n),e.collapse(!0),!1;if(n!==i&&!ice.dom.isChildOf(n,i)){if(ice.dom.canContainTextElement(n)||(n=n.lastElementChild),n.lastChild&&n.lastChild.nodeType!==ice.dom.TEXT_NODE&&ice.dom.isStubElement(n.lastChild)&&"BR"!==n.lastChild.tagName)return e.setStartAfter(n.lastChild),e.collapse(!0),!0;if(t=e.getLastSelectableChild(n),t&&!ice.dom.isOnBlockBoundary(e.startContainer,t,this.element))return e.selectNodeContents(t),e.collapse(),!0}}if(1===c&&!ice.dom.isBlockElement(l)&&e.startContainer.childNodes.length>1&&e.startContainer.childNodes[0].nodeType===ice.dom.TEXT_NODE&&0===e.startContainer.childNodes[0].data.length)return e.setStart(e.startContainer,0),this._deleteLeft(e);if(e.moveStart(ice.dom.CHARACTER_UNIT,-1),e.moveStart(ice.dom.CHARACTER_UNIT,1),this._getNoTrackElement(e.startContainer.parentElement))return e.deleteContents(),!1;if(ice.dom.isOnBlockBoundary(e.startContainer,e.endContainer,this.element)){if(s)return ice.dom.remove(o),e.collapse(),!0;if(this.mergeBlocks&&ice.dom.is(ice.dom.getBlockParent(n,this.element),this.blockEl)){o!==ice.dom.getBlockParent(e.startContainer,this.element)&&e.setStart(o,o.childNodes.length);for(var g=ice.dom.getElementsBetween(e.startContainer,e.endContainer),m=0;g.length>m;m++)ice.dom.remove(g[m]);var p=e.startContainer,C=e.endContainer;return ice.dom.remove(ice.dom.find(p,"br")),ice.dom.remove(ice.dom.find(C,"br")),ice.dom.mergeBlockWithSibling(e,ice.dom.getBlockParent(e.endContainer,this.element)||i)}return o&&o.lastChild&&ice.dom.isStubElement(o.lastChild)?(e.setStartAfter(o.lastChild),e.collapse(!0),!0):(t=e.getLastSelectableChild(o),t?(e.setStart(t,t.data.length),e.collapse(!0)):o&&(e.setStart(o,o.childNodes.length),e.collapse(!0)),!0)}var v=e.startContainer,N=v.splitText(e.startOffset-1);return N.splitText(1),this._addNodeTracking(N,e,!0)},_addNodeTracking:function(e,t,n){var i=this.getIceNode(e,"insertType");if(i&&this._currentUserIceNode(i)){t&&n&&t.selectNode(e),e.parentNode.removeChild(e);var r=ice.dom.cloneNode(i);if(ice.dom.remove(ice.dom.find(r,".iceBookmark")),null!==i&&ice.dom.hasNoTextOrStubContent(r[0])){var o=this.env.document.createTextNode("");ice.dom.insertBefore(i,o),t&&(t.setStart(o,0),t.collapse(!0)),ice.dom.replaceWith(i,ice.dom.contents(i))}return!0}if(t&&this.getIceNode(e,"deleteType")){e.normalize();var s=!1;if(n){for(var a=ice.dom.getPrevContentNode(e,this.element);!s;)d=this.getIceNode(a,"deleteType"),d?a=ice.dom.getPrevContentNode(a,this.element):s=!0;if(a){var c=t.getLastSelectableChild(a);c&&(a=c),t.setStart(a,ice.dom.getNodeCharacterLength(a)),t.collapse(!0)}return!0}for(var l=ice.dom.getNextContentNode(e,this.element);!s;)d=this.getIceNode(l,"deleteType"),d?l=ice.dom.getNextContentNode(l,this.element):s=!0;return l&&(t.selectNodeContents(l),t.collapse(!0)),!0}e.previousSibling&&e.previousSibling.nodeType===ice.dom.TEXT_NODE&&0===e.previousSibling.length&&e.parentNode.removeChild(e.previousSibling),e.nextSibling&&e.nextSibling.nodeType===ice.dom.TEXT_NODE&&0===e.nextSibling.length&&e.parentNode.removeChild(e.nextSibling);var d,u=this.getIceNode(e.previousSibling,"deleteType"),h=this.getIceNode(e.nextSibling,"deleteType");if(u&&this._currentUserIceNode(u)){if(d=u,d.appendChild(e),h&&this._currentUserIceNode(h)){var f=ice.dom.extractContent(h);ice.dom.append(d,f),h.parentNode.removeChild(h)}}else h&&this._currentUserIceNode(h)?(d=h,d.insertBefore(e,d.firstChild)):(d=this.createIceNode("deleteType"),e.parentNode.insertBefore(d,e),d.appendChild(e));return t&&(ice.dom.isStubElement(e)?t.selectNode(e):t.selectNodeContents(e),n?t.collapse(!0):t.collapse(),e.normalize()),!0},_handleAncillaryKey:function(e){var t=e.keyCode,n=!0;switch(e.shiftKey,t){case ice.dom.DOM_VK_DELETE:n=this.deleteContents(),this.pluginsManager.fireKeyPressed(e);break;case 46:n=this.deleteContents(!0),this.pluginsManager.fireKeyPressed(e);break;case ice.dom.DOM_VK_DOWN:case ice.dom.DOM_VK_UP:case ice.dom.DOM_VK_LEFT:case ice.dom.DOM_VK_RIGHT:this.pluginsManager.fireCaretPositioned(),n=!1;break;default:n=!1}return n===!0?(ice.dom.preventDefault(e),!1):!0},keyDown:function(e){if(!this.pluginsManager.fireKeyDown(e))return ice.dom.preventDefault(e),!1;var t=!1;if(this._handleSpecialKey(e)===!1)return ice.dom.isBrowser("msie")!==!0&&(this._preventKeyPress=!0),!1;if(!(e.ctrlKey!==!0&&e.metaKey!==!0||ice.dom.isBrowser("msie")!==!0&&ice.dom.isBrowser("chrome")!==!0||this.pluginsManager.fireKeyPressed(e)))return!1;switch(e.keyCode){case 27:break;default:/Firefox/.test(navigator.userAgent)!==!0&&(t=!this._handleAncillaryKey(e))}return t?(ice.dom.preventDefault(e),!1):!0},keyPress:function(e){if(this._preventKeyPress===!0)return this._preventKeyPress=!1,void 0;var t=null;if(null==e.which?t=String.fromCharCode(e.keyCode):e.which>0&&(t=String.fromCharCode(e.which)),!this.pluginsManager.fireKeyPress(e))return!1;if(e.ctrlKey||e.metaKey)return!0;var n=this.getCurrentRange(),i=ice.dom.parents(n.startContainer,"br")[0]||null;if(i&&(n.moveToNextEl(i),i.parentNode.removeChild(i)),null!==t&&e.ctrlKey!==!0&&e.metaKey!==!0)switch(e.keyCode){case ice.dom.DOM_VK_DELETE:return this._handleAncillaryKey(e); +case ice.dom.DOM_VK_ENTER:return this._handleEnter();default:return this._moveRangeToValidTrackingPos(n,n.startContainer),this.insert()}return this._handleAncillaryKey(e)},_handleEnter:function(){var e=this.getCurrentRange();return e.collapsed||this.deleteContents(),!0},_handleSpecialKey:function(e){var t=e.which;null===t&&(t=e.keyCode);var n=!1;switch(t){case 65:if(e.ctrlKey===!0||e.metaKey===!0){n=!0;var i=this.getCurrentRange();if(ice.dom.isBrowser("msie")===!0){var r=this.env.document.createTextNode(""),o=this.env.document.createTextNode("");this.element.firstChild?ice.dom.insertBefore(this.element.firstChild,r):this.element.appendChild(r),this.element.appendChild(o),i.setStart(r,0),i.setEnd(o,0)}else{i.setStart(i.getFirstSelectableChild(this.element),0);var s=i.getLastSelectableChild(this.element);i.setEnd(s,s.length)}this.selection.addRange(i)}break;default:}return n===!0?(ice.dom.preventDefault(e),!1):!0},mouseUp:function(e){return this.pluginsManager.fireClicked(e)?(this.pluginsManager.fireSelectionChanged(this.getCurrentRange()),void 0):!1},mouseDown:function(e){return this.pluginsManager.fireMouseDown(e)?(this.pluginsManager.fireCaretUpdated(),void 0):!1}},n.ice=this.ice||{},n.ice.InlineChangeEditor=t}.call(this),function(){var e=this,t={};t.DOM_VK_DELETE=8,t.DOM_VK_LEFT=37,t.DOM_VK_UP=38,t.DOM_VK_RIGHT=39,t.DOM_VK_DOWN=40,t.DOM_VK_ENTER=13,t.ELEMENT_NODE=1,t.ATTRIBUTE_NODE=2,t.TEXT_NODE=3,t.CDATA_SECTION_NODE=4,t.ENTITY_REFERENCE_NODE=5,t.ENTITY_NODE=6,t.PROCESSING_INSTRUCTION_NODE=7,t.COMMENT_NODE=8,t.DOCUMENT_NODE=9,t.DOCUMENT_TYPE_NODE=10,t.DOCUMENT_FRAGMENT_NODE=11,t.NOTATION_NODE=12,t.CHARACTER_UNIT="character",t.WORD_UNIT="word",t.BREAK_ELEMENT="br",t.CONTENT_STUB_ELEMENTS=["img","hr","iframe","param","link","meta","input","frame","col","base","area"],t.BLOCK_ELEMENTS=["p","div","pre","ul","ol","li","table","tbody","td","th","fieldset","form","blockquote","dl","dt","dd","dir","center","address","h1","h2","h3","h4","h5","h6"],t.TEXT_CONTAINER_ELEMENTS=["p","div","pre","li","td","th","blockquote","dt","dd","center","address","h1","h2","h3","h4","h5","h6"],t.STUB_ELEMENTS=t.CONTENT_STUB_ELEMENTS.slice(),t.STUB_ELEMENTS.push(t.BREAK_ELEMENT),t.getKeyChar=function(e){return String.fromCharCode(e.which)},t.getClass=function(e,t,n){return t||(t=document.body),e="."+e.split(" ").join("."),n&&(e=n+e),jQuery.makeArray(jQuery(t).find(e))},t.getId=function(e,t){return t||(t=document),element=t.getElementById(e)},t.getTag=function(e,t){return t||(t=document),jQuery.makeArray(jQuery(t).find(e))},t.getElementWidth=function(e){return e.offsetWidth},t.getElementHeight=function(e){return e.offsetHeight},t.getElementDimensions=function(e){var n={width:t.getElementWidth(e),height:t.getElementHeight(e)};return n},t.trim=function(e){return jQuery.trim(e)},t.empty=function(e){return e?jQuery(e).empty():void 0},t.remove=function(e){return e?jQuery(e).remove():void 0},t.prepend=function(e,t){jQuery(e).prepend(t)},t.append=function(e,t){jQuery(e).append(t)},t.insertBefore=function(e,t){jQuery(e).before(t)},t.insertAfter=function(e,t){jQuery(e).after(t)},t.getHtml=function(e){return jQuery(e).html()},t.setHtml=function(e,t){e&&jQuery(e).html(t)},t.removeWhitespace=function(e){jQuery(e).contents().filter(function(){return this.nodeType!=ice.dom.TEXT_NODE&&"UL"==this.nodeName||"OL"==this.nodeName?(t.removeWhitespace(this),!1):this.nodeType!=ice.dom.TEXT_NODE?!1:!/\S/.test(this.nodeValue)}).remove()},t.contents=function(e){return jQuery.makeArray(jQuery(e).contents())},t.extractContent=function(e){for(var t,n=document.createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n},t.getNode=function(e,n){return t.is(e,n)?e:t.parents(e,n)[0]||null},t.getParents=function(e,t,n){for(var i=jQuery(e).parents(t),r=i.length,o=[],s=0;r>s&&i[s]!==n;s++)o.push(i[s]);return o},t.hasBlockChildren=function(e){for(var n=e.childNodes.length,i=0;n>i;i++)if(e.childNodes[i].nodeType===t.ELEMENT_NODE&&t.isBlockElement(e.childNodes[i])===!0)return!0;return!1},t.removeTag=function(e,t){return jQuery(e).find(t).replaceWith(function(){return jQuery(this).contents()}),e},t.stripEnclosingTags=function(e,t){var n=jQuery(e);return n.find("*").not(t).replaceWith(function(){var e,t=jQuery();try{e=jQuery(this),t=e.contents()}catch(n){}return 0===t.length&&e.remove(),t}),n[0]},t.getSiblings=function(e,t,n,i){if(n===!0)return"prev"===t?jQuery(e).prevAll():jQuery(e).nextAll();var r=[];if("prev"===t)for(;e.previousSibling&&(e=e.previousSibling,e!==i);)r.push(e);else for(;e.nextSibling&&(e=e.nextSibling,e!==i);)r.push(e);return r},t.getNodeTextContent=function(e){return jQuery(e).text()},t.getNodeStubContent=function(e){return jQuery(e).find(t.CONTENT_STUB_ELEMENTS.join(", "))},t.hasNoTextOrStubContent=function(e){return t.getNodeTextContent(e).length>0?!1:jQuery(e).find(t.CONTENT_STUB_ELEMENTS.join(", ")).length>0?!1:!0},t.getNodeCharacterLength=function(e){return t.getNodeTextContent(e).length+jQuery(e).find(t.STUB_ELEMENTS.join(", ")).length},t.setNodeTextContent=function(e,t){return jQuery(e).text(t)},t.getTagName=function(e){return e.tagName&&e.tagName.toLowerCase()||null},t.getIframeDocument=function(e){var t=null;return e.contentDocument?t=e.contentDocument:e.contentWindow?t=e.contentWindow.document:e.document&&(t=e.document),t},t.isBlockElement=function(e){return-1!=t.BLOCK_ELEMENTS.lastIndexOf(e.nodeName.toLowerCase())},t.isStubElement=function(e){return-1!=t.STUB_ELEMENTS.lastIndexOf(e.nodeName.toLowerCase())},t.removeBRFromChild=function(e){if(e&&e.hasChildNodes())for(var t=0;e.childNodes.length>t;t++){var n=e.childNodes[t];n&&ice.dom.BREAK_ELEMENT==ice.dom.getTagName(n)&&n.parentNode.removeChild(n)}},t.isChildOf=function(e,t){try{for(;e&&e.parentNode;){if(e.parentNode===t)return!0;e=e.parentNode}}catch(n){}return!1},t.isChildOfTagName=function(e,t){try{for(;e&&e.parentNode;){if(e.parentNode&&e.parentNode.tagName&&e.parentNode.tagName.toLowerCase()===t)return e.parentNode;e=e.parentNode}}catch(n){}return!1},t.isChildOfTagNames=function(e,t){try{for(;e&&e.parentNode;){if(e.parentNode&&e.parentNode.tagName){tagName=e.parentNode.tagName.toLowerCase();for(var n=0;t.length>n;n++)if(tagName===t[n])return e.parentNode}e=e.parentNode}}catch(i){}return null},t.isChildOfClassName=function(e,t){try{for(;e&&e.parentNode;){if(jQuery(e.parentNode).hasClass(t))return e.parentNode;e=e.parentNode}}catch(n){}return null},t.cloneNode=function(e,t){return void 0===t&&(t=!0),jQuery(e).clone(t)},t.bind=function(e,t,n){return jQuery(e).bind(t,n)},t.unbind=function(e,t,n){return jQuery(e).unbind(t,n)},t.attr=function(e,t,n){return n?jQuery(e).attr(t,n):jQuery(e).attr(t)},t.replaceWith=function(e,t){return jQuery(e).replaceWith(t)},t.removeAttr=function(e,t){jQuery(e).removeAttr(t)},t.getElementsBetween=function(e,n){var i=[];if(e===n)return i;if(t.isChildOf(n,e)===!0){for(var r=e.childNodes.length,o=0;r>o&&e.childNodes[o]!==n;o++){if(t.isChildOf(n,e.childNodes[o])===!0)return t.arrayMerge(i,t.getElementsBetween(e.childNodes[o],n));i.push(e.childNodes[o])}return i}for(var s=e.nextSibling;s;){if(t.isChildOf(n,s)===!0)return i=t.arrayMerge(i,t.getElementsBetween(s,n));if(s===n)return i;i.push(s),s=s.nextSibling}for(var a=t.getParents(e),c=t.getParents(n),l=t.arrayDiff(a,c,!0),d=l.length,u=0;d-1>u;u++)i=t.arrayMerge(i,t.getSiblings(l[u],"next"));var h=l[l.length-1];return i=t.arrayMerge(i,t.getElementsBetween(h,n))},t.getCommonAncestor=function(e,n){for(var i=e;i;){if(t.isChildOf(n,i)===!0)return i;i=i.parentNode}return null},t.getNextNode=function(e,n){if(e)for(;e.parentNode;){if(e===n)return null;if(e.nextSibling){if(e.nextSibling.nodeType===t.TEXT_NODE&&0===e.nextSibling.length){e=e.nextSibling;continue}return t.getFirstChild(e.nextSibling)}e=e.parentNode}return null},t.getNextContentNode=function(e,n){if(e)for(;e.parentNode;){if(e===n)return null;if(e.nextSibling&&t.canContainTextElement(t.getBlockParent(e))){if(e.nextSibling.nodeType===t.TEXT_NODE&&0===e.nextSibling.length){e=e.nextSibling;continue}return e.nextSibling}if(e.nextElementSibling)return e.nextElementSibling;e=e.parentNode}return null},t.getPrevNode=function(e,n){if(e)for(;e.parentNode;){if(e===n)return null;if(e.previousSibling){if(e.previousSibling.nodeType===t.TEXT_NODE&&0===e.previousSibling.length){e=e.previousSibling;continue}return t.getLastChild(e.previousSibling)}e=e.parentNode}return null},t.getPrevContentNode=function(e,n){if(e)for(;e.parentNode;){if(e===n)return null;if(e.previousSibling&&t.canContainTextElement(t.getBlockParent(e))){if(e.previousSibling.nodeType===t.TEXT_NODE&&0===e.previousSibling.length){e=e.previousSibling;continue}return e.previousSibling}if(e.previousElementSibling)return e.previousElementSibling;e=e.parentNode}return null},t.canContainTextElement=function(e){return e&&e.nodeName?-1!=t.TEXT_CONTAINER_ELEMENTS.lastIndexOf(e.nodeName.toLowerCase()):!1},t.getFirstChild=function(e){return e.firstChild?e.firstChild.nodeType===t.ELEMENT_NODE?t.getFirstChild(e.firstChild):e.firstChild:e},t.getLastChild=function(e){return e.lastChild?e.lastChild.nodeType===t.ELEMENT_NODE?t.getLastChild(e.lastChild):e.lastChild:e},t.removeEmptyNodes=function(e,n){for(var i=jQuery(e).find(":empty"),r=i.length;r>0;)r--,t.isStubElement(i[r])===!1&&(n&&n.call(this,i[r])===!1||t.remove(i[r]))},t.create=function(e){return jQuery(e)[0]},t.find=function(e,t){return jQuery(e).find(t)},t.children=function(e,t){return jQuery(e).children(t)},t.parent=function(e,t){return jQuery(e).parent(t)[0]},t.parents=function(e,t){return jQuery(e).parents(t)},t.is=function(e,t){return jQuery(e).is(t)},t.extend=function(){return jQuery.extend.apply(this,arguments)},t.walk=function(e,n,i){if(e){i||(i=0);var r=n.call(this,e,i);r!==!1&&(e.childNodes&&e.childNodes.length>0?t.walk(e.firstChild,n,i+1):e.nextSibling?t.walk(e.nextSibling,n,i):e.parentNode&&e.parentNode.nextSibling&&t.walk(e.parentNode.nextSibling,n,i-1))}},t.revWalk=function(e,n){if(e){var i=n.call(this,e);i!==!1&&(e.childNodes&&e.childNodes.length>0?t.walk(e.lastChild,n):e.previousSibling?t.walk(e.previousSibling,n):e.parentNode&&e.parentNode.previousSibling&&t.walk(e.parentNode.previousSibling,n))}},t.setStyle=function(e,t,n){e&&jQuery(e).css(t,n)},t.getStyle=function(e,t){return jQuery(e).css(t)},t.hasClass=function(e,t){return jQuery(e).hasClass(t)},t.addClass=function(e,t){jQuery(e).addClass(t)},t.removeClass=function(e,t){jQuery(e).removeClass(t)},t.preventDefault=function(e){e.preventDefault(),t.stopPropagation(e)},t.stopPropagation=function(e){e.stopPropagation()},t.noInclusionInherits=function(e,n){(n instanceof String||"string"==typeof n)&&(n=window[n]),(e instanceof String||"string"==typeof e)&&(e=window[e]);var i=function(){};if(t.isset(n)===!0)for(value in n.prototype)e.prototype[value]?i.prototype[value]=n.prototype[value]:e.prototype[value]=n.prototype[value];e.prototype&&(i.prototype.constructor=n,e.prototype["super"]=new i)},t.each=function(e,t){jQuery.each(e,function(e,n){t.call(this,e,n)})},t.foreach=function(e,t){if(e instanceof Array||e instanceof NodeList||e.length!==void 0&&e.item!==void 0)for(var n=e.length,i=0;n>i;i++){var r=t.call(this,i,e[i]);if(r===!1)break}else for(var o in e)if(e.hasOwnProperty(o)===!0){var r=t.call(this,o);if(r===!1)break}},t.isBlank=function(e){return!e||/^\s*$/.test(e)?!0:!1},t.isFn=function(e){return"function"==typeof e?!0:!1},t.isObj=function(e){return null!==e&&"object"==typeof e?!0:!1},t.isset=function(e){return e!==void 0&&null!==e?!0:!1},t.isArray=function(e){return jQuery.isArray(e)},t.isNumeric=function(e){var t=e.match(/^\d+$/);return null!==t?!0:!1},t.getUniqueId=function(){var e=(new Date).getTime(),t=Math.ceil(1e6*Math.random()),n=e+""+t;return n.substr(5,18).replace(/,/,"")},t.inArray=function(e,t){for(var n=t.length,i=0;n>i;i++)if(e===t[i])return!0;return!1},t.arrayDiff=function(e,n,i){for(var r=e.length,o=[],s=0;r>s;s++)t.inArray(e[s],n)===!1&&o.push(e[s]);if(i!==!0){r=n.length;for(var s=0;r>s;s++)t.inArray(n[s],e)===!1&&o.push(n[s])}return o},t.arrayMerge=function(e,t){for(var n=t.length,i=0;n>i;i++)e.push(t[i]);return e},t.stripTags=function(e,n){if("string"==typeof n){var i=jQuery("<div>"+e+"</div>");return i.find("*").not(n).remove(),i.html()}for(var r,o=RegExp(/<\/?(\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim),s=e;null!=(r=o.exec(e));)(t.isset(n)===!1||t.inArray(r[1],n)!==!0)&&(s=s.replace(r[0],""));return s},t.browser=function(){var e={};return e.version=jQuery.browser.version,jQuery.browser.mozilla===!0?e.type="mozilla":jQuery.browser.msie===!0?e.type="msie":jQuery.browser.opera===!0?e.type="opera":jQuery.browser.webkit===!0&&(e.type="webkit"),e},t.getBrowserType=function(){if(null===this._browserType){for(var e=["msie","firefox","chrome","safari"],t=e.length,n=0;t>n;n++){var i=RegExp(e[n],"i");if(i.test(navigator.userAgent)===!0)return this._browserType=e[n],this._browserType}this._browserType="other"}return this._browserType},t.getWebkitType=function(){if("webkit"!==t.browser().type)return console.log("Not a webkit!"),!1;var e=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0;return e?"safari":"chrome"},t.isBrowser=function(e){return t.browser().type===e},t.getBlockParent=function(e,n){if(t.isBlockElement(e)===!0)return e;if(e)for(;e.parentNode;){if(e=e.parentNode,e===n)return null;if(t.isBlockElement(e)===!0)return e}return null},t.findNodeParent=function(e,n,i){if(e)for(;e.parentNode;){if(e===i)return null;if(t.is(e,n)===!0)return e;e=e.parentNode}return null},t.onBlockBoundary=function(e,n,i){if(!e||!n)return!1;var r=t.isChildOfTagNames(e,i)||t.is(e,i.join(", "))&&e||null,o=t.isChildOfTagNames(n,i)||t.is(n,i.join(", "))&&n||null;return r!==o},t.isOnBlockBoundary=function(e,n,i){if(!e||!n)return!1;var r=t.getBlockParent(e,i)||t.isBlockElement(e,i)&&e||null,o=t.getBlockParent(n,i)||t.isBlockElement(n,i)&&n||null;return r!==o},t.mergeContainers=function(e,n){if(!e||!n)return!1;if(e.nodeType===t.TEXT_NODE||t.isStubElement(e))n.appendChild(e);else if(e.nodeType===t.ELEMENT_NODE){for(;e.firstChild;)n.appendChild(e.firstChild);t.remove(e)}return!0},t.mergeBlockWithSibling=function(e,n,i){var r=i?jQuery(n).next().get(0):jQuery(n).prev().get(0);return i?t.mergeContainers(r,n):t.mergeContainers(n,r),e.collapse(!0),!0},t.date=function(e,n,i){if(null!==n||!i||(n=t.tsIso8601ToTimestamp(i))){for(var r=new Date(n),o=e.split(""),s=o.length,a="",c=0;s>c;c++){var l="",d=o[c];switch(d){case"D":case"l":var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];l=u[r.getDay()],"D"===d&&(l=l.substring(0,3));break;case"F":case"m":l=r.getMonth()+1,10>l&&(l="0"+l);break;case"M":months=["January","February","March","April","May","June","July","August","September","October","November","December"],l=months[r.getMonth()],"M"===d&&(l=l.substring(0,3));break;case"d":l=r.getDate();break;case"S":l=t.getOrdinalSuffix(r.getDate());break;case"Y":l=r.getFullYear();break;case"y":l=r.getFullYear(),l=(""+l).substring(2);break;case"H":l=r.getHours();break;case"h":l=r.getHours(),0===l?l=12:l>12&&(l-=12);break;case"i":l=t.addNumberPadding(r.getMinutes());break;case"a":l="am",r.getHours()>=12&&(l="pm");break;default:l=d}a+=l}return a}},t.getOrdinalSuffix=function(e){var t="",n=e%100;if(n>=4&&20>=n)t="th";else switch(e%10){case 1:t="st";break;case 2:t="nd";break;case 3:t="rd";break;default:t="th"}return t},t.addNumberPadding=function(e){return 10>e&&(e="0"+e),e},t.tsIso8601ToTimestamp=function(e){var t=/(\d\d\d\d)(?:-?(\d\d)(?:-?(\d\d)(?:[T ](\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(?:Z|(?:([-+])(\d\d)(?::?(\d\d))?)?)?)?)?)?/,n=e.match(RegExp(t));if(n){var i=new Date;i.setDate(n[3]),i.setFullYear(n[1]),i.setMonth(n[2]-1),i.setHours(n[4]),i.setMinutes(n[5]),i.setSeconds(n[6]);var r=60*n[9];"+"===n[8]&&(r*=-1),r-=i.getTimezoneOffset();var o=i.getTime()+1e3*60*r;return o}return null},e.dom=t}.call(this.ice),function(){var e,t=this;e=function(e,t,n){this.env=e,this.element=e.element,this.selection=this.env.selection,n||this.removeBookmarks(this.element);var i=t||this.selection.getRangeAt(0);t=i.cloneRange();var r=t.startContainer;t.endContainer;var o=t.startOffset;t.endOffset;var s;t.collapse(!1);var a=this.env.document.createElement("span");a.style.display="none",ice.dom.setHtml(a," "),ice.dom.addClass(a,"iceBookmark iceBookmark_end"),a.setAttribute("iceBookmark","end"),t.insertNode(a),ice.dom.isChildOf(a,this.element)||this.element.appendChild(a),t.setStart(r,o),t.collapse(!0);var c=this.env.document.createElement("span");c.style.display="none",ice.dom.addClass(c,"iceBookmark iceBookmark_start"),ice.dom.setHtml(c," "),c.setAttribute("iceBookmark","start");try{t.insertNode(c),c.previousSibling===a&&(s=c,c=a,a=s)}catch(l){ice.dom.insertBefore(a,c)}ice.dom.isChildOf(c,this.element)===!1&&(this.element.firstChild?ice.dom.insertBefore(this.element.firstChild,c):this.element.appendChild(c)),a.previousSibling||(s=this.env.document.createTextNode(""),ice.dom.insertBefore(a,s)),c.nextSibling||(s=this.env.document.createTextNode(""),ice.dom.insertAfter(c,s)),i.setStart(c.nextSibling,0),i.setEnd(a.previousSibling,a.previousSibling.length||0),this.start=c,this.end=a},e.prototype={selectBookmark:function(){var e=this.selection.getRangeAt(0),t=null,n=null,i=0,r=null;if(this.start.nextSibling===this.end||0===ice.dom.getElementsBetween(this.start,this.end).length)this.end.nextSibling?t=ice.dom.getFirstChild(this.end.nextSibling):this.start.previousSibling?(t=ice.dom.getFirstChild(this.start.previousSibling),t.nodeType===ice.dom.TEXT_NODE&&(i=t.length)):(this.end.parentNode.appendChild(this.env.document.createTextNode("")),t=ice.dom.getFirstChild(this.end.nextSibling));else{if(this.start.nextSibling)t=ice.dom.getFirstChild(this.start.nextSibling);else{if(!this.start.previousSibling){var o=this.env.document.createTextNode("");ice.dom.insertBefore(this.start,o)}t=ice.dom.getLastChild(this.start.previousSibling),i=t.length}this.end.previousSibling?n=ice.dom.getLastChild(this.end.previousSibling):(n=ice.dom.getFirstChild(this.end.nextSibling||this.end),r=0)}ice.dom.remove([this.start,this.end]),null===n?(e.setEnd(t,i),e.collapse(!1)):(e.setStart(t,i),null===r&&(r=n.length||0),e.setEnd(n,r));try{this.selection.addRange(e)}catch(s){}},getBookmark:function(e,t){var n=ice.dom.getClass("iceBookmark_"+t,e)[0];return n},removeBookmarks:function(e){ice.dom.remove(ice.dom.getClass("iceBookmark",e,"span"))}},t.Bookmark=e}.call(this.ice),function(){var e,t=this;e=function(e){this._selection=null,this.env=e,this._initializeRangeLibrary(),this._getSelection()},e.prototype={_getSelection:function(){return this._selection?this._selection.refresh():this._selection=this.env.frame?rangy.getIframeSelection(this.env.frame):rangy.getSelection(),this._selection},createRange:function(){return rangy.createRange(this.env.document)},getRangeAt:function(e){this._selection.refresh();try{return this._selection.getRangeAt(e)}catch(t){return this._selection=null,this._getSelection().getRangeAt(0)}},addRange:function(e){this._selection||(this._selection=this._getSelection()),this._selection.setSingleRange(e),this._selection.ranges=[e]},_initializeRangeLibrary:function(){var e=this;rangy.init(),rangy.config.checkSelectionRanges=!1;var t=function(e,t,n,i){if(0===n)throw Error("InvalidArgumentException: units cannot be 0");switch(t){case ice.dom.CHARACTER_UNIT:n>0?e.moveCharRight(i,n):e.moveCharLeft(i,-1*n);break;case ice.dom.WORD_UNIT:default:}};rangy.rangePrototype.moveStart=function(e,n){t(this,e,n,!0)},rangy.rangePrototype.moveEnd=function(e,n){t(this,e,n,!1)},rangy.rangePrototype.setRange=function(e,t,n){e?this.setStart(t,n):this.setEnd(t,n)},rangy.rangePrototype.moveCharLeft=function(e,t){var n,i;if(e?(n=this.startContainer,i=this.startOffset):(n=this.endContainer,i=this.endOffset),n.nodeType===ice.dom.ELEMENT_NODE)if(n.hasChildNodes()){for(n=n.childNodes[i],n=this.getPreviousTextNode(n);n&&n.nodeType==ice.dom.TEXT_NODE&&""===n.nodeValue;)n=this.getPreviousTextNode(n);i=n.data.length-t}else i=-1*t;else i-=t;if(0>i)for(;0>i;){var r=[];if(n=this.getPreviousTextNode(n,r),!n)return;n.nodeType!==ice.dom.ELEMENT_NODE&&(i+=n.data.length)}this.setRange(e,n,i)},rangy.rangePrototype.moveCharRight=function(e,t){var n,i;e?(n=this.startContainer,i=this.startOffset):(n=this.endContainer,i=this.endOffset),n.nodeType===ice.dom.ELEMENT_NODE?(n=n.childNodes[i],n.nodeType!==ice.dom.TEXT_NODE&&(n=this.getNextTextNode(n)),i=t):i+=t;var r=i-n.data.length;if(r>0){for(var o=[];r>0;)if(n=this.getNextContainer(n,o),n.nodeType!==ice.dom.ELEMENT_NODE){if(n.data.length>=r)break;n.data.length>0&&(r-=n.data.length)}i=r}this.setRange(e,n,i)},rangy.rangePrototype.getNextContainer=function(e,t){if(!e)return null;for(;e.nextSibling;)if(e=e.nextSibling,e.nodeType!==ice.dom.TEXT_NODE){var n=this.getFirstSelectableChild(e);if(null!==n)return n}else if(this.isSelectable(e)===!0)return e;for(;e&&!e.nextSibling;)e=e.parentNode;if(!e)return null;if(e=e.nextSibling,this.isSelectable(e)===!0)return e;t&&ice.dom.isBlockElement(e)===!0&&t.push(e);var i=this.getFirstSelectableChild(e);return null!==i?i:this.getNextContainer(e,t)},rangy.rangePrototype.getPreviousContainer=function(e,t){if(!e)return null;for(;e.previousSibling;)if(e=e.previousSibling,e.nodeType!==ice.dom.TEXT_NODE){if(ice.dom.isStubElement(e)===!0)return e;var n=this.getLastSelectableChild(e);if(null!==n)return n}else if(this.isSelectable(e)===!0)return e;for(;e&&!e.previousSibling;)e=e.parentNode;if(!e)return null;if(e=e.previousSibling,this.isSelectable(e)===!0)return e;t&&ice.dom.isBlockElement(e)===!0&&t.push(e);var i=this.getLastSelectableChild(e);return null!==i?i:this.getPreviousContainer(e,t)},rangy.rangePrototype.getNextTextNode=function(e){return e.nodeType===ice.dom.ELEMENT_NODE&&0!==e.childNodes.length?this.getFirstSelectableChild(e):(e=this.getNextContainer(e),e.nodeType===ice.dom.TEXT_NODE?e:this.getNextTextNode(e))},rangy.rangePrototype.getPreviousTextNode=function(e,t){return e=this.getPreviousContainer(e,t),e.nodeType===ice.dom.TEXT_NODE?e:this.getPreviousTextNode(e,t)},rangy.rangePrototype.getFirstSelectableChild=function(e){if(e){if(e.nodeType===ice.dom.TEXT_NODE)return e;for(var t=e.firstChild;t;){if(this.isSelectable(t)===!0)return t;if(t.firstChild){var n=this.getFirstSelectableChild(t);if(null!==n)return n;t=t.nextSibling}else t=t.nextSibling}}return null},rangy.rangePrototype.getLastSelectableChild=function(e){if(e){if(e.nodeType===ice.dom.TEXT_NODE)return e;for(var t=e.lastChild;t;){if(this.isSelectable(t)===!0)return t;if(t.lastChild){var n=this.getLastSelectableChild(t);if(null!==n)return n;t=t.previousSibling}else t=t.previousSibling}}return null},rangy.rangePrototype.isSelectable=function(e){return e&&e.nodeType===ice.dom.TEXT_NODE&&0!==e.data.length?!0:!1},rangy.rangePrototype.getHTMLContents=function(t){t||(t=this.cloneContents());var n=e.env.document.createElement("div");return n.appendChild(t.cloneNode(!0)),n.innerHTML},rangy.rangePrototype.getHTMLContentsObj=function(){return this.cloneContents()}}},t.Selection=e}.call(this.ice),function(){var e=this,t=function(e){this._ice=e};t.prototype={start:function(){},clicked:function(){return!0},mouseDown:function(){return!0},keyDown:function(){return!0},keyPress:function(){return!0},selectionChanged:function(){},setEnabled:function(){},setDisabled:function(){},caretUpdated:function(){},nodeInserted:function(){},nodeCreated:function(){},caretPositioned:function(){},remove:function(){this._ice.removeKeyPressListener(this)},setSettings:function(){}},e.IcePlugin=t}.call(this.ice),function(){var e=this,t=function(e){this.plugins={},this.pluginConstructors={},this.keyPressListeners={},this.activePlugin=null,this.pluginSets={},this.activePluginSet=null,this._ice=e};t.prototype={getPluginNames:function(){var e=[];for(var t in this.plugins)e.push(t);return e},addPluginObject:function(e,t){this.plugins[e]=t},addPlugin:function(e,t){if("function"!=typeof t)throw Error("IcePluginException: plugin must be a constructor function");ice.dom.isset(this.pluginConstructors[e])===!1&&(this.pluginConstructors[e]=t)},loadPlugins:function(e,t){if(0===e.length)t.call(this);else{var n=e.shift();if("object"==typeof n&&(n=n.name),ice.dom.isset(ice._plugin[n])!==!0)throw Error("plugin was not included in the page: "+n);this.addPlugin(n,ice._plugin[n]),this.loadPlugins(e,t)}},_enableSet:function(e){this.activePluginSet=e;for(var t=this.pluginSets[e].length,n=0;t>n;n++){var i=this.pluginSets[e][n],r="";r="object"==typeof i?i.name:i;var o=this.pluginConstructors[r];if(o){var s=new o(this._ice);this.plugins[r]=s,ice.dom.isset(i.settings)===!0&&s.setSettings(i.settings),s.start()}}},setActivePlugin:function(e){this.activePlugin=e},getActivePlugin:function(){return this.activePlugin},_getPluginName:function(e){var t=""+e,n="function ".length,i=t.substr(n,t.indexOf("(")-n);return i},removePlugin:function(e){this.plugins[e]&&this.plugins[e].remove()},getPlugin:function(e){return this.plugins[e]},usePlugins:function(e,t,n){var i=this;this.pluginSets[e]=ice.dom.isset(t)===!0?t:[];var r=this.pluginSets[e].concat([]);this.loadPlugins(r,function(){i._enableSet(e),n&&n.call(this)})},disablePlugin:function(e){this.plugins[e].disable()},isPluginElement:function(e){for(var t in this.plugins)if(this.plugins[t].isPluginElement&&this.plugins[t].isPluginElement(e)===!0)return!0;return!1},fireKeyPressed:function(e){if(this._fireKeyPressFns(e,"all_keys")===!1)return!1;var t=[];switch((e.ctrlKey===!0||e.metaKey===!0)&&t.push("ctrl"),e.shiftKey===!0&&t.push("shift"),e.altKey===!0&&t.push("alt"),e.keyCode){case 13:t.push("enter");break;case ice.dom.DOM_VK_LEFT:t.push("left");break;case ice.dom.DOM_VK_RIGHT:t.push("right");break;case ice.dom.DOM_VK_UP:t.push("up");break;case ice.dom.DOM_VK_DOWN:t.push("down");break;case 9:t.push("tab");break;case ice.dom.DOM_VK_DELETE:t.push("delete");break;default:var n;e.keyCode?n=e.keyCode:e.which&&(n=e.which),n&&t.push(String.fromCharCode(n).toLowerCase())}var i=t.sort().join("+");return this._fireKeyPressFns(e,i)},_fireKeyPressFns:function(e,t){if(this.keyPressListeners[t])for(var n=this.keyPressListeners[t].length,i=0;n>i;i++){var r=this.keyPressListeners[t][i],o=r.fn,s=r.plugin,a=r.data;if(o)if(ice.dom.isFn(o)===!0){if(o.call(s,e,a)===!0)return ice.dom.preventDefault(e),!1}else if(s[o]&&s[o].call(s,e,a)===!0)return ice.dom.preventDefault(e),!1}return!0},fireSelectionChanged:function(e){for(var t in this.plugins)this.plugins[t].selectionChanged(e)},fireNodeInserted:function(e,t){for(var n in this.plugins)if(this.plugins[n].nodeInserted(e,t)===!1)return!1},fireNodeCreated:function(e,t){for(var n in this.plugins)if(this.plugins[n].nodeCreated(e,t)===!1)return!1},fireCaretPositioned:function(){for(var e in this.plugins)this.plugins[e].caretPositioned()},fireClicked:function(e){var t=!0;for(var n in this.plugins)this.plugins[n].clicked(e)===!1&&(t=!1);return t},fireMouseDown:function(e){var t=!0;for(var n in this.plugins)this.plugins[n].mouseDown(e)===!1&&(t=!1);return t},fireKeyDown:function(e){var t=!0;for(var n in this.plugins)this.plugins[n].keyDown(e)===!1&&(t=!1);return t},fireKeyPress:function(e){var t=!0;for(var n in this.plugins)this.plugins[n].keyPress(e)===!1&&(t=!1);return t},fireEnabled:function(e){for(var t in this.plugins)this.plugins[t].setEnabled(e)},fireDisabled:function(e){for(var t in this.plugins)this.plugins[t].setDisabled(e)},fireCaretUpdated:function(){for(var e in this.plugins)this.plugins[e].caretUpdated&&this.plugins[e].caretUpdated()}},e._plugin={},e.IcePluginManager=t}.call(this.ice),function(){var e,t=this;e=function(e){this._ice=e},e.prototype={nodeCreated:function(e,t){e.setAttribute("title",(t.action||"Modified")+" by "+e.getAttribute(this._ice.userNameAttribute)+" - "+ice.dom.date("m/d/Y h:ia",parseInt(e.getAttribute(this._ice.timeAttribute))))}},ice.dom.noInclusionInherits(e,ice.IcePlugin),t._plugin.IceAddTitlePlugin=e}.call(this.ice),function(){var e,t=this;e=function(e){this._ice=e,this._tmpNode=null,this._tmpNodeTagName="icepaste",this._pasteId="icepastediv";var t=this;this.pasteType="formattedClean",this.preserve="p",this.beforePasteClean=function(e){return e},this.afterPasteClean=function(e){return e},e.element.oncopy=function(){return t.handleCopy.apply(t)}},e.prototype={setSettings:function(e){e=e||{},ice.dom.extend(this,e),this.preserve+=","+this._tmpNodeTagName,this.setupPreserved()},keyDown:function(e){return e.metaKey===!0||e.ctrlKey===!0?(86==e.keyCode?this.handlePaste():88==e.keyCode&&this.handleCut(),!0):void 0},keyPress:function(e){var t=null;null==e.which?t=String.fromCharCode(e.keyCode):e.which>0&&(t=String.fromCharCode(e.which));var n=this;return this.cutElement&&"x"===t?ice.dom.isBrowser("webkit")&&n.cutElement.focus():"v"===t&&ice.dom.isBrowser("webkit")&&this._ice.env.document.getElementById(n._pasteId).focus(),!0},handleCopy:function(){},handlePaste:function(){var e=this._ice.getCurrentRange();if(e.collapsed||(this._ice.isTracking?(this._ice.deleteContents(),e=e.cloneRange()):(e.deleteContents(),e.collapse(!0))),this._ice.isTracking&&this._ice._moveRangeToValidTrackingPos(e),e.startContainer==this._ice.element){var t=ice.dom.find(this._ice.element,this._ice.blockEl)[0];t||(t=ice.dom.create("<"+this._ice.blockEl+" ><br/></"+this._ice.blockEl+">"),this._ice.element.appendChild(t)),e.setStart(t,0),e.collapse(!0),this._ice.env.selection.addRange(e)}switch(this._tmpNode=this._ice.env.document.createElement(this._tmpNodeTagName),e.insertNode(this._tmpNode),this.pasteType){case"formatted":this.setupPaste();break;case"formattedClean":this.setupPaste(!0)}return!0},setupPaste:function(e){var t=this.createDiv(this._pasteId),n=this,i=this._ice.getCurrentRange();return i.selectNodeContents(t),this._ice.selection.addRange(i),t.onpaste=function(){setTimeout(function(){n.handlePasteValue(e)},0)},t.focus(),!0},handlePasteValue:function(e){var t=this._ice.env.document,n=t.getElementById(this._pasteId),i=ice.dom.getHtml(n),r=ice.dom.children("<div>"+i+"</div>",this._ice.blockEl);1===r.length&&ice.dom.getNodeTextContent("<div>"+i+"</div>")===ice.dom.getNodeTextContent(r)&&(i=ice.dom.getHtml(i)),i=this.beforePasteClean.call(this,i),e&&(i=this._ice.getCleanContent(i),i=this.stripPaste(i)),i=this.afterPasteClean.call(this,i),i=ice.dom.trim(i);var o=this._ice.getCurrentRange();o.setStartAfter(this._tmpNode),o.collapse(!0);var s=null,a=null,c=null,l=o.createContextualFragment(i),d=this._ice.startBatchChange();if(ice.dom.hasBlockChildren(l)){var u=ice.dom.isChildOfTagName(this._tmpNode,this._ice.blockEl);o.setEndAfter(u.lastChild),this._ice.selection.addRange(o);var h=o.extractContents(),f=t.createElement(this._ice.blockEl);f.appendChild(h),ice.dom.insertAfter(u,f),o.setStart(f,0),o.collapse(!0),this._ice.selection.addRange(o);for(var g=o.startContainer;l.firstChild;)if(3!==l.firstChild.nodeType||jQuery.trim(l.firstChild.nodeValue))if(ice.dom.isBlockElement(l.firstChild)){if(""!==l.firstChild.textContent){s=null;var m=null;this._ice.isTracking?(m=this._ice.createIceNode("insertType"),this._ice.addChange("insertType",[m]),c=t.createElement(l.firstChild.tagName),m.innerHTML=l.firstChild.innerHTML,c.appendChild(m)):(m=c=t.createElement(l.firstChild.tagName),c.innerHTML=l.firstChild.innerHTML),a=m,ice.dom.insertBefore(g,c)}l.removeChild(l.firstChild)}else s||(c=t.createElement(this._ice.blockEl),ice.dom.insertBefore(g,c),this._ice.isTracking?(s=this._ice.createIceNode("insertType"),this._ice.addChange("insertType",[s]),c.appendChild(s)):s=c),a=s,s.appendChild(l.removeChild(l.firstChild));else l.removeChild(l.firstChild);f.textContent||f.parentNode.removeChild(f)}else if(this._ice.isTracking)c=this._ice.createIceNode("insertType",l),this._ice.addChange("insertType",[c]),o.insertNode(c),a=c;else for(var p;p=l.firstChild;)o.insertNode(p),o.setStartAfter(p),o.collapse(!0),a=p;this._ice.endBatchChange(d),n.parentNode.removeChild(n),this._cleanup(a)},createDiv:function(e){var t=this._ice.env.document,n=t.getElementById(e);n&&ice.dom.remove(n);var i=t.createElement("div");return i.id=e,i.setAttribute("contentEditable",!0),ice.dom.setStyle(i,"width","1px"),ice.dom.setStyle(i,"height","1px"),ice.dom.setStyle(i,"overflow","hidden"),ice.dom.setStyle(i,"position","fixed"),ice.dom.setStyle(i,"top","10px"),ice.dom.setStyle(i,"left","10px"),i.appendChild(t.createElement("br")),t.body.appendChild(i),i +},handleCut:function(){var e=this,t=this._ice.getCurrentRange();if(!t.collapsed){this.cutElement=this.createDiv("icecut"),this.cutElement.innerHTML=t.getHTMLContents().replace(/ </g," <").replace(/> /g,"> "),this._ice.isTracking?this._ice.deleteContents():t.deleteContents();var n=this._ice.env.document.createRange();n.setStart(this.cutElement.firstChild,0),n.setEndAfter(this.cutElement.lastChild),setTimeout(function(){e.cutElement.focus(),setTimeout(function(){ice.dom.remove(e.cutElement),t.setStart(t.startContainer,t.startOffset),t.collapse(!1),e._ice.env.selection.addRange(t)},100)},0),e._ice.env.selection.addRange(n)}},stripPaste:function(e){return e=this._cleanWordPaste(e),e=this.cleanPreserved(e)},setupPreserved:function(){var e=this;this._tags="",this._attributesMap=[],ice.dom.each(this.preserve.split(","),function(t,n){n.match(/(\w+)(\[(.+)\])?/);var i=RegExp.$1,r=RegExp.$3;e._tags&&(e._tags+=","),e._tags+=i.toLowerCase(),e._attributesMap[i]=r.split("|")})},cleanPreserved:function(e){var t=this,n=this._ice.env.document.createElement("div");return n.innerHTML=e,n=ice.dom.stripEnclosingTags(n,this._tags),ice.dom.each(ice.dom.find(n,this._tags),function(e,n){if(ice.dom.hasClass(n,"skip-clean"))return!0;var i=n.tagName.toLowerCase(),r=t._attributesMap[i];if(r[0]&&"*"===r[0])return!0;if(n.hasAttributes())for(var o=n.attributes,e=o.length-1;e>=0;e--)ice.dom.inArray(o[e].name,r)||n.removeAttribute(o[e].name)}),n.innerHTML},_cleanWordPaste:function(e){return e=e.replace(/<(meta|link)[^>]+>/g,""),e=e.replace(/<!--(.|\s)*?-->/g,""),e=e.replace(/<style>[\s\S]*?<\/style>/g,""),e=e.replace(/<\/?\w+:[^>]*>/gi,""),e=e.replace(/<\\?\?xml[^>]*>/gi,""),e=this._cleanPaste(e),e=e.replace(/<(\w[^>]*) (lang)=([^ |>]*)([^>]*)/gi,"<$1$4")},_cleanPaste:function(e){return e=e.replace(/<b(\s+|>)/g,"<strong$1"),e=e.replace(/<\/b(\s+|>)/g,"</strong$1"),e=e.replace(/<i(\s+|>)/g,"<em$1"),e=e.replace(/<\/i(\s+|>)/g,"</em$1")},_cleanup:function(e){try{e=e&&e.lastChild||e||this._tmpNode;var t=this._ice.getCurrentRange();t.setStartAfter(e),t.collapse(!0),this._ice.selection.addRange(t),this._ice.env.frame?this._ice.env.frame.contentWindow.focus():this._ice.element.focus(),this._tmpNode.parentNode.removeChild(this._tmpNode),this._tmpNode=null;for(var n=this._ice.env.document.getElementsByClassName(this._ice.changeTypes.insertType.alias),i=0;n.length>i;i++)n[i].textContent||n[i].parentNode&&n[i].parentNode.removeChild(n[i])}catch(r){window.console&&console.error(r)}}},ice.dom.noInclusionInherits(e,ice.IcePlugin),t._plugin.IceCopyPastePlugin=e}.call(this.ice),function(){var e=this,t=this.ice,n=function(e){this._ice=e};n.prototype={convert:function(e){var n=this;try{n._ice.placeholdDeletes(),t.dom.each(e.getElementsByTagName(this._ice.blockEl),function(e,t){n._convertBlock(t)})}catch(i){window.console&&console.error(i)}finally{n._ice.revertDeletePlaceholders()}},_convertBlock:function(e){if(!(2>t.dom.getNodeTextContent(e))){var n,i,r,o,s,a="'",c='"',l=String.fromCharCode(8216),d=String.fromCharCode(8217),u=String.fromCharCode(8220),h=String.fromCharCode(8221),f=function(e){return/\d/.test(e)},g=function(e){return/\w/.test(e)},m=function(e){return e===String.fromCharCode(160)||e===String.fromCharCode(32)},p=function(e){return m(e)||"("===e},C=function(e){return m(e)||null==e||";"===e||")"===e||"."==e||"!"===e||","===e||"?"===e||":"===e},v=function(e){return!m(e)},N=function(e){return e===a||e===l||e===d};o=t.dom.getHtml(e).match(/(<("[^"]*"|'[^']*'|[^'">])*>|&.*;|.)/g),s=function(e,t,n){var i=e.length,r=0>n?-1:1;return function o(e,t,n){if(0>t||t>=i)return null;var s=e[t+r];return s&&1==s.length&&(n+=-1*r,!n)?s:o(e,t+r,n)}(e,t,n)},t.dom.each(o,function(e,t){if(" "==t&&(t=o[e]=" "),1==t.length){switch(n=s(o,e,-1),i=t,r=s(o,e,1),i){case l:case d:i=a;case a:(null==n||m(n))&&f(r)&&f(s(o,e,2))&&C(s(o,e,3))?i=d:null==n||p(n)&&v(r)?i=l:null==r||v(n)&&C(r)?i=d:g(n)&&g(r)&&(i=d);break;case u:case h:i=c;case c:C(r)&&m(n)&&N(s(o,e,-2))?i=h:null==n||p(n)&&v(r)?i=u:null==r||v(n)&&C(r)?i=h:(null==n||m(n))&&m(r)&&N(s(o,e,1))&&(i=u)}null!=i&&(o[e]=i)}}),t.dom.setHtml(e,o.join(""))}}},t.dom.noInclusionInherits(n,t.IcePlugin),e.ice._plugin.IceSmartQuotesPlugin=n}.call(this),function(){var e=this,t=function(e){this._ice=e};t.prototype={keyDown:function(e){if(ice.dom.isBrowser("mozilla")){var t=parseInt(ice.dom.browser().version);if(t>14&&173===e.keyCode||14>=t&&109===e.keyCode)return this.convertEmdash(e)}else if(189===e.keyCode)return this.convertEmdash(e);return!0},convertEmdash:function(){var e=this._ice.getCurrentRange();if(e.collapsed){try{e.moveStart(ice.dom.CHARACTER_UNIT,-1);var t=ice.dom.getParents(e.startContainer,this._ice.blockEl)[0],n=ice.dom.getParents(e.endContainer,this._ice.blockEl)[0];if(t===n&&!this._ice.getIceNode(e.startContainer,"deleteType")&&(c=e.toHtml(),"-"===c)){e.extractContents(),e.collapse();var i=this._ice.env.document.createTextNode("—");return this._ice.isTracking?this._ice._insertNode(i,e):(e.insertNode(i),e.setStart(i,1),e.collapse(!0)),this._ice._preventKeyPress=!0,!1}}catch(r){}e.collapse()}return!0}},ice.dom.noInclusionInherits(t,ice.IcePlugin),e._plugin.IceEmdashPlugin=t}.call(this.ice); \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee index 26cdd92af3bf8967fb52fbd1c076317e6457ec58..b2cdf916079b749ea48e92018c11191ce79d8aa3 100644 --- a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee +++ b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee @@ -179,7 +179,9 @@ class @PeerGradingProblem interstitial_page_sel: '.interstitial-page' calibration_interstitial_page_sel: '.calibration-interstitial-page' error_container_sel: '.error-container' + peer_grading_instructions_sel: '.peer-grading-instructions' feedback_area_sel: '.feedback-area' + ice_legend_sel: '.ice-legend' score_selection_container_sel: '.score-selection-container' rubric_selection_container_sel: '.rubric-selection-container' submit_button_sel: '.submit-button' @@ -239,7 +241,9 @@ class @PeerGradingProblem @submission_key_input = $("input[name='submission-key']") @essay_id_input = @$("input[name='essay-id']") + @peer_grading_instructions = @$(@peer_grading_instructions_sel) @feedback_area = @$(@feedback_area_sel) + @ice_legend = @$(@ice_legend_sel) @score_selection_container = @$(@score_selection_container_sel) @rubric_selection_container = @$(@rubric_selection_container_sel) @@ -396,7 +400,7 @@ class @PeerGradingProblem @grading_message.fadeIn() message = "<p>Successfully saved your feedback. Fetching the next essay." if response.required_done - message = message + " You have done the required number of peer evals but may continue grading if you like." + message = message + " You have done the required number of peer assessments but may continue grading if you like." message = message + "</p>" @grading_message.html(message) else @@ -459,9 +463,11 @@ class @PeerGradingProblem @grading_panel.find(@grading_text_sel).hide() @flag_student_container.hide() @answer_unknown_container.hide() + @peer_grading_instructions.hide() @feedback_area.attr('disabled', true) - feedback_text = "Once you are done with training and are grading real student essays, you will be asked to share feedback with them in addition to grading their rubric." + feedback_text = "Once you are done learning to grade, and are grading your peers' work, you will be asked to share written feedback with them in addition to scoring them." if @tracking_changes() + @ice_legend.hide() @feedback_area.attr('contenteditable', false) @feedback_area.text(feedback_text) else @@ -498,7 +504,9 @@ class @PeerGradingProblem @grading_panel.find(@grading_text_sel).show() @flag_student_container.show() @answer_unknown_container.show() + @peer_grading_instructions.show() if @tracking_changes() + @ice_legend.show() @feedback_area.html(@make_paragraphs(response.student_response)) @change_tracker.rebindTracker() else @@ -598,12 +606,12 @@ class @PeerGradingProblem collapse_question: (event) => @prompt_container.slideToggle() @prompt_container.toggleClass('open') - if @question_header.text() == "Hide Prompt" - new_text = "Show Prompt" + if @question_header.text() == "Hide Question" + new_text = "Show Question" Logger.log 'oe_hide_question', {location: @location} else Logger.log 'oe_show_question', {location: @location} - new_text = "Hide Prompt" + new_text = "Hide Question" @question_header.text(new_text) return false diff --git a/common/lib/xmodule/xmodule/js/src/peergrading/track_changes.coffee b/common/lib/xmodule/xmodule/js/src/peergrading/track_changes.coffee index 3885505ed9af8d2ecf5af28e8ed5d8fa9fdb69ec..ff0b4111f284ae48fa97e090b2e4884838e24dfe 100644 --- a/common/lib/xmodule/xmodule/js/src/peergrading/track_changes.coffee +++ b/common/lib/xmodule/xmodule/js/src/peergrading/track_changes.coffee @@ -1,5 +1,7 @@ class @TrackChanges reset_button_sel: '.reset-changes' + undo_button_sel: '.undo-change' + tracked_elements_sel: 'span.del, span.ins' tracked_feedback_sel: '.feedback-area.track-changes' submit_button_sel: '.submit-button' tracker: null @@ -7,9 +9,13 @@ class @TrackChanges constructor: (element) -> @el = element @reset_button = @$(@reset_button_sel) + @undo_button = @$(@undo_button_sel) @submit_button = @$(@submit_button_sel) + @tracked_elements = @$(@tracked_elements_sel) @tracked_feedback = @$(@tracked_feedback_sel) + @reset_button.click @reset_changes + @undo_button.click @undo_change @submit_button.click @stop_tracking_on_submit @@ -42,6 +48,15 @@ class @TrackChanges reset_changes: (event) => event.preventDefault() @tracker.rejectAll() + + undo_change: (event) => + event.preventDefault() + keyOfLatestChange = 0 + @tracked_elements.each -> + key = parseInt(@attr('data-cid')) + if key > keyOfLatestChange + keyOfLatestChange = key + ICEtracker.rejectChange('[data-cid="'+ keyOfLatestChange + '"]') stop_tracking_on_submit: () => - @tracker.stopTracking() + @tracker.stopTracking() \ No newline at end of file diff --git a/lms/djangoapps/open_ended_grading/tests.py b/lms/djangoapps/open_ended_grading/tests.py index ea49e575a096373bec6b861d9fbb69036bb34dae..5a0d9e69e5bc9fda4b0c8eae399cb13d1d68ff09 100644 --- a/lms/djangoapps/open_ended_grading/tests.py +++ b/lms/djangoapps/open_ended_grading/tests.py @@ -351,7 +351,7 @@ class TestPanel(ModuleStoreTestCase, LoginEnrollmentTestCase): """ request = Mock(user=self.user) response = views.student_problem_list(request, self.course.id) - self.assertRegexpMatches(response.content, "Here are a list of open ended problems for this course.") + self.assertRegexpMatches(response.content, "Here is a list of open ended problems for this course.") @override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE) class TestPeerGradingFound(ModuleStoreTestCase): diff --git a/lms/static/sass/course/_staff_grading.scss b/lms/static/sass/course/_staff_grading.scss index ba0069a3d2efd5c579d611173fe7315713f17025..6810fe1bff1c0970f4b7ccf231b5f0c3dab0da6c 100644 --- a/lms/static/sass/course/_staff_grading.scss +++ b/lms/static/sass/course/_staff_grading.scss @@ -10,7 +10,7 @@ div.peer-grading{ div.feedback-area.track-changes { position: relative; margin: 0px; - height: 150px; + height: 400px; border: 1px solid lightgray; padding: 5px; resize: vertical; diff --git a/lms/templates/combinedopenended/combined_open_ended.html b/lms/templates/combinedopenended/combined_open_ended.html index 971f5432739c865addcdc9fc89a1566d3691f40c..c8f4c029dc7f579b46f4e6b1b2c987242afa78de 100644 --- a/lms/templates/combinedopenended/combined_open_ended.html +++ b/lms/templates/combinedopenended/combined_open_ended.html @@ -30,7 +30,7 @@ <div class="visibility-control visibility-control-prompt"> <div class="inner"> </div> - <a href="" class="section-header section-header-prompt question-header">${_("Hide Prompt")}</a> + <a href="" class="section-header section-header-prompt question-header">${_("Hide Question")}</a> </div> <div class="problem-container"> % for item in items: @@ -39,7 +39,7 @@ </div> <div class="oe-tools response-tools"> <span class="oe-tools-label"></span> - <input type="button" value="${_('Try Again')}" class="reset-button" name="reset"/> + <input type="button" value="${_('New Submission')}" class="reset-button" name="reset"/> </div> </div> diff --git a/lms/templates/combinedopenended/combined_open_ended_results.html b/lms/templates/combinedopenended/combined_open_ended_results.html index c66d5b6594c6801e4ff36a61b267f4cdb2302682..b8235470f494a71fa613deb18d9f760fc048b66e 100644 --- a/lms/templates/combinedopenended/combined_open_ended_results.html +++ b/lms/templates/combinedopenended/combined_open_ended_results.html @@ -1,4 +1,5 @@ <%! from django.utils.translation import ugettext as _ %> +% num_results = len(results) % for (i,result) in enumerate(results): % if 'task_name' in result and 'result' in result: <div class="combined-rubric-container" @@ -17,12 +18,20 @@ <button class="rubric-collapse" href="#">${_("Toggle Full Rubric")}</button> <span class="oe-tools-scores"> <span class="oe-tools-scores-label"></span> - % if len(results)>1: - <button href="#" alt="Previous" class="rubric-button rubric-previous-button"><i class="icon-chevron-left"></i></button> + % if num_results>1: + <button href="#" alt="Previous" class="rubric-button rubric-previous-button" + % if i == 0: + disabled="true" + % endif + ><i class="icon-chevron-left"></i></button> % endif ${result['task_name']} from grader ${i+1} - % if len(results)>1: - <button href="#" alt="Next" class="rubric-button rubric-next-button"><i class="icon-chevron-right"></i></button> + % if num_results>1: + <button href="#" alt="Next" class="rubric-button rubric-next-button" + % if (i+1) >= num_results: + disabled="true" + % endif + ><i class="icon-chevron-right"></i></button> % endif </span> </div> diff --git a/lms/templates/open_ended_problems/open_ended_problems.html b/lms/templates/open_ended_problems/open_ended_problems.html index 68882984f50867566b2112283d5a496b4a5b917a..aa053111d8de0e26c2055ef70d84327675e3c93a 100644 --- a/lms/templates/open_ended_problems/open_ended_problems.html +++ b/lms/templates/open_ended_problems/open_ended_problems.html @@ -17,38 +17,38 @@ <div class="error-container">${error_text}</div> <h1>${_("Open Ended Problems")}</h1> <h2>${_("Instructions")}</h2> - <p>${_("Here are a list of open ended problems for this course.")}</p> + <p>${_("Here is a list of open ended problems for this course.")}</p> % if success: - % if len(problem_list) == 0: - <div class="message-container"> - ${_("You have not attempted any open ended problems yet.")} - </div> - %else: - <table class="problem-list"> - <tr> - <th>${_("Problem Name")}</th> - <th>${_("Status")}</th> - <th>${_("Grader Type")}</th> - <th>${_("ETA")}</th> - </tr> - %for problem in problem_list: - <tr> - <td> - <a href="${problem['actual_url']}">${problem['problem_name']}</a> - </td> - <td> - ${problem['state']} - </td> - <td> - ${problem['grader_type']} - </td> - <td> - ${problem['eta_string']} - </td> - </tr> - %endfor - </table> - %endif + % if len(problem_list) == 0: + <div class="message-container"> + ${_("You have not attempted any open ended problems yet.")} + </div> + %else: + <table class="problem-list"> + <tr> + <th>${_("Problem Name")}</th> + <th>${_("Status")}</th> + <th>${_("Grader Type")}</th> + <th>${_("ETA")}</th> + </tr> + %for problem in problem_list: + <tr> + <td> + <a href="${problem['actual_url']}">${problem['problem_name']}</a> + </td> + <td> + ${problem['state']} + </td> + <td> + ${problem['grader_type']} + </td> + <td> + ${problem['eta_string']} + </td> + </tr> + %endfor + </table> + %endif %endif </div> </section> diff --git a/lms/templates/peer_grading/peer_grading_problem.html b/lms/templates/peer_grading/peer_grading_problem.html index 3d8588e73d307e182429b0f460e97906eb640b5d..be357bf0544f9e7f7dcdda508bb6292a6cac94c2 100644 --- a/lms/templates/peer_grading/peer_grading_problem.html +++ b/lms/templates/peer_grading/peer_grading_problem.html @@ -17,7 +17,7 @@ <div class="visibility-control visibility-control-prompt"> <div class="inner"> </div> - <a href="" class="section-header section-header-prompt question-header">${_('Hide Prompt')}</a> + <a href="" class="section-header section-header-prompt question-header">${_('Hide Question')}</a> </div> <div class="prompt-information-container"> <section> @@ -41,28 +41,35 @@ <div class="evaluation"> <p class="rubric-selection-container"></p> <p class="score-selection-container"></p> + <hr /> + <div class="answer-unknown-container"> + <input type="checkbox" class="answer-unknown-checkbox" value="answer_is_unknown"> + ${_("I am unsure about the scores I have given above: ")} + </div> + <br /> <h3>${_("Written Feedback")}</h3> % if track_changes: - <p>${_("Please edit your peer's submission below.")}</p> - <p class="legend"> + <p class="peer-grading-instructions">${_("Please edit your peer's submission and give them written comments below.")}</p> + <p class="ice-legend"> <span class="ins">${_("This is an insertion.")}</span> <span class="del">${_("This is a deletion.")}</span> + <span class="ins">${_("[This is a comment.]")}</span> <span class="ice-controls"> <a href="#" class="reset-changes"><i class="icon-refresh"></i> Reset Changes</a> + <a href="#" class="undo-change"><i class="icon-undo"></i> Undo Change</a> </span> </p> <div name="feedback" class="feedback-area track-changes" contenteditable="true"></div> % else: - <p>${_("Please include some written feedback as well.")}</p> + <p class="ora-instructions">${_("Please include some written feedback as well.")}</p> <textarea name="feedback" placeholder="Feedback for student" class="feedback-area" cols="70" ></textarea> % endif - <div class="flag-student-container"> ${_("This submission has explicit or offensive content : ")} + <div class="flag-student-container"> <input type="checkbox" class="flag-checkbox" value="student_is_flagged"> - </div> - <div class="answer-unknown-container"> ${_("I do not know how to grade this question : ")} - <input type="checkbox" class="answer-unknown-checkbox" value="answer_is_unknown"> + ${_("This submission has explicit, offensive, or (I suspect) plagiarized content: ")} </div> </div> + <hr /> <div class="submission"> <input type="button" value="${_("Submit")}" class="submit-button" name="show"/> </div> @@ -97,7 +104,7 @@ <section class="flag-submission-confirmation"> <h4>${_("Are you sure that you want to flag this submission?")}</h4> <p> - ${_("You are about to flag a submission. You should only flag a submission that contains explicit or offensive content. If the submission is not addressed to the question or is incorrect, you should give it a score of zero and accompanying feedback instead of flagging it.")} + ${_("You are about to flag a submission. You should only flag a submission that contains explicit, offensive, or (suspected) plagiarized content. If the submission is not addressed to the question or is incorrect, you should give it a score of zero and accompanying feedback instead of flagging it.")} </p> <div> <input type="button" class="flag-submission-removal-button" value="${_("Remove Flag")}" name="calibration-interstitial-page-button" />