0byt3m1n1
Path:
/
home1
/
aserty
/
public_html
/
bonniescraftygifts.com
/
iFzj4
/
configCHM
/
Jump
/
0-aserty
/
natureultra.com
/
wp-content
/
plugins
/
thrive-visual-editor
/
editor
/
js
/
[
Home
]
File: rangy-cssclassapplier.min.js
/*! Thrive Content Builder - 2015-04-15 * http://www.thrivethemes.com/ * Copyright (c) 2015 Thrive Themes */ rangy.createModule("ClassApplier",["WrappedSelection"],function(a,b){function c(a,b){for(var c in a)if(a.hasOwnProperty(c)&&b(c,a[c])===!1)return!1;return!0}function d(a){return a.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function e(a,b){return a.className&&new RegExp("(?:^|\\s)"+b+"(?:\\s|$)").test(a.className)}function f(a,b){a.className?e(a,b)||(a.className+=" "+b):a.className=b}function g(a){return a&&a.split(/\s+/).sort().join(" ")}function h(a){return g(a.className)}function i(a,b){return h(a)==h(b)}function j(a,b,c,d,e){var f=a.node,g=a.offset,h=f,i=g;f==d&&g>e&&++i,f!=b||g!=c&&g!=c+1||(h=d,i+=e-c),f==b&&g>c+1&&--i,a.node=h,a.offset=i}function k(a,b,c){a.node==b&&a.offset>c&&--a.offset}function l(a,b,c,d){-1==c&&(c=b.childNodes.length);for(var e,f=a.parentNode,g=H.getNodeIndex(a),h=0;e=d[h++];)j(e,f,g,b,c);b.childNodes.length==c?b.appendChild(a):b.insertBefore(a,b.childNodes[c])}function m(a,b){for(var c,d=a.parentNode,e=H.getNodeIndex(a),f=0;c=b[f++];)k(c,d,e);a.parentNode.removeChild(a)}function n(a,b,c,d,e){for(var f,g=[];f=a.firstChild;)l(f,b,c++,e),g.push(f);return d&&m(a,e),g}function o(a,b){return n(a,a.parentNode,H.getNodeIndex(a),!0,b)}function p(a,b){var c=a.cloneRange();c.selectNodeContents(b);var d=c.intersection(a),e=d?d.toString():"";return""!=e}function q(a){for(var b,c=a.getNodes([3]),d=0;(b=c[d])&&!p(a,b);)++d;for(var e=c.length-1;(b=c[e])&&!p(a,b);)--e;return c.slice(d,e+1)}function r(a,b){if(a.attributes.length!=b.attributes.length)return!1;for(var c,d,e,f=0,g=a.attributes.length;g>f;++f)if(c=a.attributes[f],e=c.name,"class"!=e){if(d=b.attributes.getNamedItem(e),null===c!=(null===d))return!1;if(c.specified!=d.specified)return!1;if(c.specified&&c.nodeValue!==d.nodeValue)return!1}return!0}function s(a,b){for(var c,d=0,e=a.attributes.length;e>d;++d)if(c=a.attributes[d].name,(!b||!J(b,c))&&a.attributes[d].specified&&"class"!=c)return!0;return!1}function t(a,b){return c(b,function(b,c){if("object"==typeof c){if(!t(a[b],c))return!1}else if(a[b]!==c)return!1})}function u(a){var b;return a&&1==a.nodeType&&((b=a.parentNode)&&9==b.nodeType&&"on"==b.designMode||O(a)&&!O(a.parentNode))}function v(a){return(O(a)||1!=a.nodeType&&O(a.parentNode))&&!u(a)}function w(a){return a&&1==a.nodeType&&!P.test(N(a,"display"))}function x(a){if(0==a.data.length)return!0;if(Q.test(a.data))return!1;var b=N(a.parentNode,"whiteSpace");switch(b){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(a.data))return!1}return w(a.previousSibling)||w(a.nextSibling)}function y(a){var b,c,d=[];for(b=0;c=a[b++];)d.push(new I(c.startContainer,c.startOffset),new I(c.endContainer,c.endOffset));return d}function z(a,b){for(var c,d,e,f=0,g=a.length;g>f;++f)c=a[f],d=b[2*f],e=b[2*f+1],c.setStartAndEnd(d.node,d.offset,e.node,e.offset)}function A(a,b){return H.isCharacterDataNode(a)?0==b?!!a.previousSibling:b==a.length?!!a.nextSibling:!0:b>0&&b<a.childNodes.length}function B(a,c,d,e){var f,g,h=0==d;if(H.isAncestorOf(c,a))return a;if(H.isCharacterDataNode(c)){var i=H.getNodeIndex(c);if(0==d)d=i;else{if(d!=c.length)throw b.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+d+" in "+c.data);d=i+1}c=c.parentNode}if(A(c,d)){f=c.cloneNode(!1),g=c.parentNode,f.id&&f.removeAttribute("id");for(var j,k=0;j=c.childNodes[d];)l(j,f,k++,e);return l(f,g,H.getNodeIndex(c)+1,e),c==a?f:B(a,g,H.getNodeIndex(f),e)}if(a!=c){f=c.parentNode;var m=H.getNodeIndex(c);return h||m++,B(a,f,m,e)}return a}function C(a,b){return a.namespaceURI==b.namespaceURI&&a.tagName.toLowerCase()==b.tagName.toLowerCase()&&i(a,b)&&r(a,b)&&"inline"==N(a,"display")&&"inline"==N(b,"display")}function D(a){var b=a?"nextSibling":"previousSibling";return function(c,d){var e=c.parentNode,f=c[b];if(f){if(f&&3==f.nodeType)return f}else if(d&&(f=e[b],f&&1==f.nodeType&&C(e,f))){var g=f[a?"firstChild":"lastChild"];if(g&&3==g.nodeType)return g}return null}}function E(a){this.isElementMerge=1==a.nodeType,this.textNodes=[];var b=this.isElementMerge?a.lastChild:a;b&&(this.textNodes[0]=b)}function F(a,b,e){var f,g,h,i,j=this;j.cssClass=a;var k=null,l={};if("object"==typeof b&&null!==b){for(e=b.tagNames,k=b.elementProperties,l=b.elementAttributes,g=0;i=T[g++];)b.hasOwnProperty(i)&&(j[i]=b[i]);f=b.normalize}else f=b;j.normalize="undefined"==typeof f?!0:f,j.attrExceptions=[];var m=document.createElement(j.elementTagName);j.elementProperties=j.copyPropertiesToElement(k,m,!0),c(l,function(a){j.attrExceptions.push(a)}),j.elementAttributes=l,j.elementSortedClassName=j.elementProperties.hasOwnProperty("className")?j.elementProperties.className:a,j.applyToAnyTagName=!1;var n=typeof e;if("string"==n)"*"==e?j.applyToAnyTagName=!0:j.tagNames=d(e.toLowerCase()).split(/\s*,\s*/);else if("object"==n&&"number"==typeof e.length)for(j.tagNames=[],g=0,h=e.length;h>g;++g)"*"==e[g]?j.applyToAnyTagName=!0:j.tagNames.push(e[g].toLowerCase());else j.tagNames=[j.elementTagName]}function G(a,b,c){return new F(a,b,c)}var H=a.dom,I=H.DomPosition,J=H.arrayContains,K=H.isHtmlNamespace,L="span",M=function(){function a(a,b,c){return b&&c?" ":""}return function(b,c){b.className&&(b.className=b.className.replace(new RegExp("(^|\\s)"+c+"(\\s|$)"),a))}}(),N=H.getComputedStyleProperty,O=function(){var a=document.createElement("div");return"boolean"==typeof a.isContentEditable?function(a){return a&&1==a.nodeType&&a.isContentEditable}:function(a){return a&&1==a.nodeType&&"false"!=a.contentEditable?"true"==a.contentEditable||O(a.parentNode):!1}}(),P=/^inline(-block|-table)?$/i,Q=/[^\r\n\t\f \u200B]/,R=D(!1),S=D(!0);E.prototype={doMerge:function(a){var b=this.textNodes,c=b[0];if(b.length>1){for(var d,e,f,g,h=H.getNodeIndex(c),i=[],j=0,k=0,l=b.length;l>k;++k){if(d=b[k],e=d.parentNode,k>0&&(e.removeChild(d),e.hasChildNodes()||e.parentNode.removeChild(e),a))for(f=0;g=a[f++];)g.node==d&&(g.node=c,g.offset+=j),g.node==e&&g.offset>h&&(--g.offset,g.offset==h+1&&l-1>k&&(g.node=c,g.offset=j));i[k]=d.data,j+=d.data.length}c.data=i.join("")}return c.data},getLength:function(){for(var a=this.textNodes.length,b=0;a--;)b+=this.textNodes[a].length;return b},toString:function(){for(var a=[],b=0,c=this.textNodes.length;c>b;++b)a[b]="'"+this.textNodes[b].data+"'";return"[Merge("+a.join(",")+")]"}};var T=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],U={};F.prototype={elementTagName:L,elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(a,b,c){var d,e,h,i,j,k,l={};for(var m in a)if(a.hasOwnProperty(m))if(i=a[m],j=b[m],"className"==m)f(b,i),f(b,this.cssClass),b[m]=g(b[m]),c&&(l[m]=b[m]);else if("style"==m){e=j,c&&(l[m]=h={});for(d in a[m])e[d]=i[d],c&&(h[d]=e[d]);this.attrExceptions.push(m)}else b[m]=i,c&&(l[m]=b[m],k=U.hasOwnProperty(m)?U[m]:m,this.attrExceptions.push(k));return c?l:""},copyAttributesToElement:function(a,b){for(var c in a)a.hasOwnProperty(c)&&b.setAttribute(c,a[c])},hasClass:function(a){return 1==a.nodeType&&J(this.tagNames,a.tagName.toLowerCase())&&e(a,this.cssClass)},getSelfOrAncestorWithClass:function(a){for(;a;){if(this.hasClass(a))return a;a=a.parentNode}return null},isModifiable:function(a){return!this.applyToEditableOnly||v(a)},isIgnorableWhiteSpaceNode:function(a){return this.ignoreWhiteSpace&&a&&3==a.nodeType&&x(a)},postApply:function(a,b,c,d){for(var e,f,g,h=a[0],i=a[a.length-1],j=[],k=h,l=i,m=0,n=i.length,o=0,p=a.length;p>o;++o)f=a[o],g=R(f,!d),g?(e||(e=new E(g),j.push(e)),e.textNodes.push(f),f===h&&(k=e.textNodes[0],m=k.length),f===i&&(l=e.textNodes[0],n=e.getLength())):e=null;var q=S(i,!d);if(q&&(e||(e=new E(i),j.push(e)),e.textNodes.push(q)),j.length){for(o=0,p=j.length;p>o;++o)j[o].doMerge(c);b.setStartAndEnd(k,m,l,n)}},createContainer:function(a){var b=a.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,b,!1),this.copyAttributesToElement(this.elementAttributes,b),f(b,this.cssClass),this.onElementCreate&&this.onElementCreate(b,this),b},applyToTextNode:function(a){var b=a.parentNode;if(1==b.childNodes.length&&this.useExistingElements&&K(b)&&J(this.tagNames,b.tagName.toLowerCase())&&t(b,this.elementProperties))f(b,this.cssClass);else{var c=this.createContainer(H.getDocument(a));a.parentNode.insertBefore(c,a),c.appendChild(a)}},isRemovable:function(a){return K(a)&&a.tagName.toLowerCase()==this.elementTagName&&h(a)==this.elementSortedClassName&&t(a,this.elementProperties)&&!s(a,this.attrExceptions)&&this.isModifiable(a)},isEmptyContainer:function(a){var b=a.childNodes.length;return 1==a.nodeType&&this.isRemovable(a)&&(0==b||1==b&&this.isEmptyContainer(a.firstChild))},removeEmptyContainers:function(a){for(var b,c=this,d=a.getNodes([1],function(a){return c.isEmptyContainer(a)}),e=[a],f=y(e),g=0;b=d[g++];)m(b,f);z(e,f)},undoToTextNode:function(a,b,c,d){if(!b.containsNode(c)){var e=b.cloneRange();e.selectNode(c),e.isPointInRange(b.endContainer,b.endOffset)&&(B(c,b.endContainer,b.endOffset,d),b.setEndAfter(c)),e.isPointInRange(b.startContainer,b.startOffset)&&(c=B(c,b.startContainer,b.startOffset,d))}this.isRemovable(c)?o(c,d):M(c,this.cssClass)},applyToRange:function(a,b){b=b||[];var c=y(b||[]);a.splitBoundariesPreservingPositions(c),this.removeEmptyElements&&this.removeEmptyContainers(a);var d=q(a);if(d.length){for(var e,f=0;e=d[f++];)this.isIgnorableWhiteSpaceNode(e)||this.getSelfOrAncestorWithClass(e)||!this.isModifiable(e)||this.applyToTextNode(e,c);e=d[d.length-1],a.setStartAndEnd(d[0],0,e,e.length),this.normalize&&this.postApply(d,a,c,!1),z(b,c)}},applyToRanges:function(a){for(var b=a.length;b--;)this.applyToRange(a[b],a);return a},applyToSelection:function(b){var c=a.getSelection(b);c.setRanges(this.applyToRanges(c.getAllRanges()))},undoToRange:function(a,b){b=b||[];var c=y(b);a.splitBoundariesPreservingPositions(c),this.removeEmptyElements&&this.removeEmptyContainers(a,c);var d,e,f=q(a),g=f[f.length-1];if(f.length){for(var h=0,i=f.length;i>h;++h)d=f[h],e=this.getSelfOrAncestorWithClass(d),e&&this.isModifiable(d)&&this.undoToTextNode(d,a,e,c),a.setStartAndEnd(f[0],0,g,g.length);this.normalize&&this.postApply(f,a,c,!0),z(b,c)}},undoToRanges:function(a){for(var b=a.length;b--;)this.undoToRange(a[b],a);return a},undoToSelection:function(b){var c=a.getSelection(b),d=a.getSelection(b).getAllRanges();this.undoToRanges(d),c.setRanges(d)},isAppliedToRange:function(a){if(a.collapsed||""==a.toString())return!!this.getSelfOrAncestorWithClass(a.commonAncestorContainer);var b=a.getNodes([3]);if(b.length)for(var c,d=0;c=b[d++];)if(!this.isIgnorableWhiteSpaceNode(c)&&p(a,c)&&this.isModifiable(c)&&!this.getSelfOrAncestorWithClass(c))return!1;return!0},isAppliedToRanges:function(a){var b=a.length;if(0==b)return!1;for(;b--;)if(!this.isAppliedToRange(a[b]))return!1;return!0},isAppliedToSelection:function(b){var c=a.getSelection(b);return this.isAppliedToRanges(c.getAllRanges())},toggleRange:function(a){this.isAppliedToRange(a)?this.undoToRange(a):this.applyToRange(a)},toggleSelection:function(a){this.isAppliedToSelection(a)?this.undoToSelection(a):this.applyToSelection(a)},getElementsWithClassIntersectingRange:function(a){var b=[],c=this;return a.getNodes([3],function(a){var d=c.getSelfOrAncestorWithClass(a);d&&!J(b,d)&&b.push(d)}),b},detach:function(){}},F.util={hasClass:e,addClass:f,removeClass:M,hasSameClasses:i,replaceWithOwnChildren:o,elementsHaveSameNonClassAttributes:r,elementHasNonClassAttributes:s,splitNodeAt:B,isEditableElement:O,isEditingHost:u,isEditable:v},a.CssClassApplier=a.ClassApplier=F,a.createCssClassApplier=a.createClassApplier=G});