summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js')
-rw-r--r--plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js b/plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js
index 00b581cb..35f6826b 100644
--- a/plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js
+++ b/plugins/jetpack/_inc/build/after-the-deadline/atd.core.min.js
@@ -6,4 +6,4 @@
* Project : http://www.afterthedeadline.com/developers.slp
* Contact : raffi@automattic.com
*/
-function AtDCore(){this.ignore_types=["Bias Language","Cliches","Complex Expression","Diacritical Marks","Double Negatives","Hidden Verbs","Jargon Language","Passive voice","Phrases to Avoid","Redundant Expression"],this.ignore_strings={},this.i18n={}}function TokenIterator(e){this.tokens=e,this.index=0,this.count=0,this.last=0}function atd_sprintf(e,t){for(var r=e,n=0;n<t.length;n++)r=r.replace(new RegExp("%"+(n+1)+"\\$","g"),t[n]);return r}var EXPORTED_SYMBOLS=["AtDCore"];AtDCore.prototype.getLang=function(e,t){return window.AtD_l10n_r0ar&&window.AtD_l10n_r0ar[e]||t},AtDCore.prototype.addI18n=function(e){window.AtD_l10n_r0ar=e},AtDCore.prototype.setIgnoreStrings=function(e){var t=this;this.map(e.split(/,\s*/g),function(e){t.ignore_strings[e]=1})},AtDCore.prototype.showTypes=function(e){var t=e.split(/,\s*/g),r={};r["Double Negatives"]=1,r["Hidden Verbs"]=1,r["Passive voice"]=1,r["Bias Language"]=1,r.Cliches=1,r["Complex Expression"]=1,r["Diacritical Marks"]=1,r["Jargon Language"]=1,r["Phrases to Avoid"]=1,r["Redundant Expression"]=1;var n=[];this.map(t,function(e){r[e]=void 0}),this.map(this.ignore_types,function(e){void 0!==r[e]&&n.push(e)}),this.ignore_types=n},AtDCore.prototype.makeError=function(e,t,r,n){var s={};return s.type=r,s.string=e,s.tokens=t,new RegExp("\\b"+e+"\\b").test(e)?s.regexp=new RegExp("(?!"+e+"<)\\b"+e.replace(/\s+/g,n)+"\\b"):new RegExp(e+"\\b").test(e)?s.regexp=new RegExp("(?!"+e+"<)"+e.replace(/\s+/g,n)+"\\b"):new RegExp("\\b"+e).test(e)?s.regexp=new RegExp("(?!"+e+"<)\\b"+e.replace(/\s+/g,n)):s.regexp=new RegExp("(?!"+e+"<)"+e.replace(/\s+/g,n)),s.used=!1,s},AtDCore.prototype.addToErrorStructure=function(e,t,r,n){var s=this;this.map(t,function(t){var i=t.word.split(/\s+/),o=t.pre,a=i[0];void 0===e["__"+a]&&(e["__"+a]={},e["__"+a].pretoks={},e["__"+a].defaults=[]),""===o?e["__"+a].defaults.push(s.makeError(t.word,i,r,n,o)):(void 0===e["__"+a].pretoks["__"+o]&&(e["__"+a].pretoks["__"+o]=[]),e["__"+a].pretoks["__"+o].push(s.makeError(t.word,i,r,n,o)))})},AtDCore.prototype.buildErrorStructure=function(e,t,r){var n=this._getSeparators(),s={};return this.addToErrorStructure(s,e,"hiddenSpellError",n),this.addToErrorStructure(s,r,"hiddenGrammarError",n),this.addToErrorStructure(s,t,"hiddenSuggestion",n),s},AtDCore.prototype._getSeparators=function(){var e,t="",r='"s!#$%&()*+,./:;<=>?@[\\]^_{|}';for(e=0;e<r.length;e++)t+="\\"+r.charAt(e);return"(?:(?:[ "+t+"])|(?:\\-\\-))+"},AtDCore.prototype.processXML=function(e){var t={};this.map(this.ignore_types,function(e){t[e]=1}),this.suggestions=[];for(var r=e.getElementsByTagName("error"),n=[],s=[],i=[],o=0;o<r.length;o++)if(null!==r[o].getElementsByTagName("string").item(0).firstChild){var a,p=r[o].getElementsByTagName("string").item(0).firstChild.data,g=r[o].getElementsByTagName("type").item(0).firstChild.data,u=r[o].getElementsByTagName("description").item(0).firstChild.data;if(a=null!==r[o].getElementsByTagName("precontext").item(0).firstChild?r[o].getElementsByTagName("precontext").item(0).firstChild.data:"",void 0===this.ignore_strings[p]){var h={};if(h.description=u,h.suggestions=[],h.matcher=new RegExp("^"+p.replace(/\s+/,this._getSeparators())+"$"),h.context=a,h.string=p,h.type=g,this.suggestions.push(h),null!==r[o].getElementsByTagName("suggestions").item(0))for(var l=r[o].getElementsByTagName("suggestions").item(0).getElementsByTagName("option"),d=0;d<l.length;d++)h.suggestions.push(l[d].firstChild.data);if(null!==r[o].getElementsByTagName("url").item(0)){var c=r[o].getElementsByTagName("url").item(0).firstChild.data;h.moreinfo=c+"&theme=tinymce"}void 0===t[u]&&("suggestion"===g&&i.push({word:p,pre:a}),"grammar"===g&&n.push({word:p,pre:a})),"spelling"!==g&&"Homophone"!==u||s.push({word:p,pre:a}),"Cliches"===u&&(h.description="Clichés"),"Spelling"===u&&(h.description=this.getLang("menu_title_spelling","Spelling")),"Repeated Word"===u&&(h.description=this.getLang("menu_title_repeated_word","Repeated Word")),"Did you mean..."===u&&(h.description=this.getLang("menu_title_confused_word","Did you mean..."))}}var m,f=s.length+n.length+i.length;return m=f>0?this.buildErrorStructure(s,i,n):void 0,{errors:m,count:f,suggestions:this.suggestions}},AtDCore.prototype.findSuggestion=function(e){var t=e.innerHTML,r=(this.getAttrib(e,"pre")+"").replace(/[\\,!\\?\\."\s]/g,"");void 0===this.getAttrib(e,"pre")&&alert(e.innerHTML);for(var n,s=this.suggestions.length,i=0;i<s;i++)if((""===r||r===this.suggestions[i].context)&&this.suggestions[i].matcher.test(t)){n=this.suggestions[i];break}return n},TokenIterator.prototype.next=function(){var e=this.tokens[this.index];return this.count=this.last,this.last+=e.length+1,this.index++,""!==e&&("'"===e[0]&&(e=e.substring(1,e.length)),"'"===e[e.length-1]&&(e=e.substring(0,e.length-1))),e},TokenIterator.prototype.hasNext=function(){return this.index<this.tokens.length},TokenIterator.prototype.hasNextN=function(e){return this.index+e<this.tokens.length},TokenIterator.prototype.skip=function(e,t){this.index+=e,this.last+=t,this.index<this.tokens.length&&(this.count=this.last-this.tokens[this.index].length)},TokenIterator.prototype.getCount=function(){return this.count},TokenIterator.prototype.peek=function(e){for(var t=[],r=this.index+e,n=this.index;n<r;n++)t.push(this.tokens[n]);return t},AtDCore.prototype.markMyWords=function(e,t){function r(e,t,r){var n,s=e.nodeValue,i=s.search(t),o=s.match(t),a=[];return i<0||!o.length?[e]:(i>0&&a.push(document.createTextNode(s.substr(0,i))),a.push(p.create(o[0].replace(t,r))),n=i+o[0].length,n<s.length&&a.push(document.createTextNode(s.substr(n))),a)}function n(e){if(e)for(;e.parentNode;){if("PRE"===e.nodeName)return!0;e=e.parentNode}return!1}var s,i=new RegExp(this._getSeparators()),o=[],a=0,p=this,g=this._isTinyMCE?' data-mce-bogus="1"':"",u='<span class="mceItemHidden"'+g+">&nbsp;</span>";this._walk(e,function(e){3!==e.nodeType||p.isMarkedNode(e)||n(e)||o.push(e)});var h;return this.map(o,function(e){var n;if(3===e.nodeType){n=e.nodeValue;var o=e.nodeValue.split(i),l="",d=[];for(h=new TokenIterator(o);h.hasNext();){var c,m=h.next(),f=t["__"+m];if(void 0!==f&&void 0!==f.pretoks){c=f.defaults,f=f.pretoks["__"+l];var v,y,_=!1;v=n.substr(0,h.getCount()),y=n.substr(v.length,n.length);var E=function(e){void 0!==e&&!e.used&&void 0===x["__"+e.string]&&e.regexp.test(y)&&(x["__"+e.string]=1,d.push([e.regexp,'<span class="'+e.type+'" pre="'+l+'"'+g+">$&</span>"]),e.used=!0,_=!0)},x={};void 0!==f&&(l+=" ",p.map(f,E)),_||(l="",p.map(c,E))}l=m}if(d.length>0){for(var C=e,T=0;T<d.length;T++){var k=d[T][0],b=d[T][1];C=function(e){var t,n;if(3===e.nodeType){if(a++,p.isIE()&&e.nodeValue.length>0&&" "===e.nodeValue.substr(0,1))return p.create(u+e.nodeValue.substr(1,e.nodeValue.length-1).replace(k,b),!1);if(s)return p.create(e.nodeValue.replace(k,b),!1);if(t=p.create("<span />"),void 0===s&&(s="function"!=typeof t.appendChild))return p.remove(t),p.create(e.nodeValue.replace(k,b),!1);n=r(e,k,b);for(var i=0;i<n.length;i++)t.appendChild(n[i]);return e=t}for(var o=p.contents(e),g=0;g<o.length;g++)if(3===o[g].nodeType&&k.test(o[g].nodeValue)){var h;return h=p.isIE()&&o[g].nodeValue.length>0&&" "===o[g].nodeValue.substr(0,1)?p.create(u+o[g].nodeValue.substr(1,o[g].nodeValue.length-1).replace(k,b),!0):p.create(o[g].nodeValue.replace(k,b),!0),p.replaceWith(o[g],h),p.removeParent(h),a++,e}return e}(C)}p.replaceWith(e,C)}}}),a},AtDCore.prototype._walk=function(e,t){var r;for(r=0;r<e.length;r++)t.call(t,e[r]),this._walk(this.contents(e[r]),t)},AtDCore.prototype.removeWords=function(e,t){var r=0,n=this;return this.map(this.findSpans(e).reverse(),function(e){if(e&&(n.isMarkedNode(e)||n.hasClass(e,"mceItemHidden")||n.isEmptySpan(e)))if("&nbsp;"===e.innerHTML){var s=document.createTextNode(" ");n.replaceWith(e,s)}else t&&e.innerHTML!==t||(n.removeParent(e),r++)}),r},AtDCore.prototype.isEmptySpan=function(e){return""===this.getAttrib(e,"class")&&""===this.getAttrib(e,"style")&&""===this.getAttrib(e,"id")&&!this.hasClass(e,"Apple-style-span")&&""===this.getAttrib(e,"mce_name")},AtDCore.prototype.isMarkedNode=function(e){return this.hasClass(e,"hiddenGrammarError")||this.hasClass(e,"hiddenSpellError")||this.hasClass(e,"hiddenSuggestion")},AtDCore.prototype.applySuggestion=function(e,t){if("(omit)"===t)this.remove(e);else{var r=this.create(t);this.replaceWith(e,r),this.removeParent(r)}},AtDCore.prototype.hasErrorMessage=function(e){return void 0!==e&&null!==e.getElementsByTagName("message").item(0)},AtDCore.prototype.getErrorMessage=function(e){return e.getElementsByTagName("message").item(0)},AtDCore.prototype.isIE=function(){return"Microsoft Internet Explorer"===navigator.appName}; \ No newline at end of file
+var EXPORTED_SYMBOLS=["AtDCore"];function AtDCore(){this.ignore_types=["Bias Language","Cliches","Complex Expression","Diacritical Marks","Double Negatives","Hidden Verbs","Jargon Language","Passive voice","Phrases to Avoid","Redundant Expression"],this.ignore_strings={},this.i18n={}}function TokenIterator(e){this.tokens=e,this.index=0,this.count=0,this.last=0}function atd_sprintf(e,t){for(var r=e,n=0;n<t.length;n++)r=r.replace(new RegExp("%"+(n+1)+"\\$","g"),t[n]);return r}AtDCore.prototype.getLang=function(e,t){return window.AtD_l10n_r0ar&&window.AtD_l10n_r0ar[e]||t},AtDCore.prototype.addI18n=function(e){window.AtD_l10n_r0ar=e},AtDCore.prototype.setIgnoreStrings=function(e){var t=this;this.map(e.split(/,\s*/g),function(e){t.ignore_strings[e]=1})},AtDCore.prototype.showTypes=function(e){var t=e.split(/,\s*/g),r={"Double Negatives":1,"Hidden Verbs":1,"Passive voice":1,"Bias Language":1,Cliches:1,"Complex Expression":1,"Diacritical Marks":1,"Jargon Language":1,"Phrases to Avoid":1,"Redundant Expression":1},n=[];this.map(t,function(e){r[e]=void 0}),this.map(this.ignore_types,function(e){void 0!==r[e]&&n.push(e)}),this.ignore_types=n},AtDCore.prototype.makeError=function(e,t,r,n){var s={};return s.type=r,s.string=e,s.tokens=t,new RegExp("\\b"+e+"\\b").test(e)?s.regexp=new RegExp("(?!"+e+"<)\\b"+e.replace(/\s+/g,n)+"\\b"):new RegExp(e+"\\b").test(e)?s.regexp=new RegExp("(?!"+e+"<)"+e.replace(/\s+/g,n)+"\\b"):new RegExp("\\b"+e).test(e)?s.regexp=new RegExp("(?!"+e+"<)\\b"+e.replace(/\s+/g,n)):s.regexp=new RegExp("(?!"+e+"<)"+e.replace(/\s+/g,n)),s.used=!1,s},AtDCore.prototype.addToErrorStructure=function(e,t,r,n){var s=this;this.map(t,function(t){var i=t.word.split(/\s+/),o=t.pre,a=i[0];void 0===e["__"+a]&&(e["__"+a]={},e["__"+a].pretoks={},e["__"+a].defaults=[]),""===o?e["__"+a].defaults.push(s.makeError(t.word,i,r,n,o)):(void 0===e["__"+a].pretoks["__"+o]&&(e["__"+a].pretoks["__"+o]=[]),e["__"+a].pretoks["__"+o].push(s.makeError(t.word,i,r,n,o)))})},AtDCore.prototype.buildErrorStructure=function(e,t,r){var n=this._getSeparators(),s={};return this.addToErrorStructure(s,e,"hiddenSpellError",n),this.addToErrorStructure(s,r,"hiddenGrammarError",n),this.addToErrorStructure(s,t,"hiddenSuggestion",n),s},AtDCore.prototype._getSeparators=function(){var e,t="",r='"s!#$%&()*+,./:;<=>?@[\\]^_{|}';for(e=0;e<r.length;e++)t+="\\"+r.charAt(e);return"(?:(?:[ "+t+"])|(?:\\-\\-))+"},AtDCore.prototype.processXML=function(e){var t={};this.map(this.ignore_types,function(e){t[e]=1}),this.suggestions=[];for(var r=e.getElementsByTagName("error"),n=[],s=[],i=[],o=0;o<r.length;o++)if(null!==r[o].getElementsByTagName("string").item(0).firstChild){var a,p=r[o].getElementsByTagName("string").item(0).firstChild.data,g=r[o].getElementsByTagName("type").item(0).firstChild.data,u=r[o].getElementsByTagName("description").item(0).firstChild.data;if(a=null!==r[o].getElementsByTagName("precontext").item(0).firstChild?r[o].getElementsByTagName("precontext").item(0).firstChild.data:"",void 0===this.ignore_strings[p]){var h={};if(h.description=u,h.suggestions=[],h.matcher=new RegExp("^"+p.replace(/\s+/,this._getSeparators())+"$"),h.context=a,h.string=p,h.type=g,this.suggestions.push(h),null!==r[o].getElementsByTagName("suggestions").item(0))for(var l=r[o].getElementsByTagName("suggestions").item(0).getElementsByTagName("option"),d=0;d<l.length;d++)h.suggestions.push(l[d].firstChild.data);if(null!==r[o].getElementsByTagName("url").item(0)){var c=r[o].getElementsByTagName("url").item(0).firstChild.data;h.moreinfo=c+"&theme=tinymce"}void 0===t[u]&&("suggestion"===g&&i.push({word:p,pre:a}),"grammar"===g&&n.push({word:p,pre:a})),"spelling"!==g&&"Homophone"!==u||s.push({word:p,pre:a}),"Cliches"===u&&(h.description="Clichés"),"Spelling"===u&&(h.description=this.getLang("menu_title_spelling","Spelling")),"Repeated Word"===u&&(h.description=this.getLang("menu_title_repeated_word","Repeated Word")),"Did you mean..."===u&&(h.description=this.getLang("menu_title_confused_word","Did you mean..."))}}var m=s.length+n.length+i.length;return{errors:m>0?this.buildErrorStructure(s,i,n):void 0,count:m,suggestions:this.suggestions}},AtDCore.prototype.findSuggestion=function(e){var t,r=e.innerHTML,n=(this.getAttrib(e,"pre")+"").replace(/[\\,!\\?\\."\s]/g,"");void 0===this.getAttrib(e,"pre")&&alert(e.innerHTML);for(var s=this.suggestions.length,i=0;i<s;i++)if((""===n||n===this.suggestions[i].context)&&this.suggestions[i].matcher.test(r)){t=this.suggestions[i];break}return t},TokenIterator.prototype.next=function(){var e=this.tokens[this.index];return this.count=this.last,this.last+=e.length+1,this.index++,""!==e&&("'"===e[0]&&(e=e.substring(1,e.length)),"'"===e[e.length-1]&&(e=e.substring(0,e.length-1))),e},TokenIterator.prototype.hasNext=function(){return this.index<this.tokens.length},TokenIterator.prototype.hasNextN=function(e){return this.index+e<this.tokens.length},TokenIterator.prototype.skip=function(e,t){this.index+=e,this.last+=t,this.index<this.tokens.length&&(this.count=this.last-this.tokens[this.index].length)},TokenIterator.prototype.getCount=function(){return this.count},TokenIterator.prototype.peek=function(e){for(var t=[],r=this.index+e,n=this.index;n<r;n++)t.push(this.tokens[n]);return t},AtDCore.prototype.markMyWords=function(e,t){var r,n,s=new RegExp(this._getSeparators()),i=[],o=0,a=this,p=this._isTinyMCE?' data-mce-bogus="1"':"",g='<span class="mceItemHidden"'+p+">&nbsp;</span>";function u(e,t,r){var n,s=e.nodeValue,i=s.search(t),o=s.match(t),p=[];return i<0||!o.length?[e]:(i>0&&p.push(document.createTextNode(s.substr(0,i))),p.push(a.create(o[0].replace(t,r))),(n=i+o[0].length)<s.length&&p.push(document.createTextNode(s.substr(n))),p)}return this._walk(e,function(e){3!==e.nodeType||a.isMarkedNode(e)||function(e){if(e)for(;e.parentNode;){if("PRE"===e.nodeName)return!0;e=e.parentNode}return!1}(e)||i.push(e)}),this.map(i,function(e){var i;if(3===e.nodeType){i=e.nodeValue;var h=e.nodeValue.split(s),l="",d=[];for(n=new TokenIterator(h);n.hasNext();){var c,m=n.next(),f=t["__"+m];if(void 0!==f&&void 0!==f.pretoks){c=f.defaults,f=f.pretoks["__"+l];var v,y,_=!1;v=i.substr(0,n.getCount()),y=i.substr(v.length,i.length);var E=function(e){void 0!==e&&!e.used&&void 0===x["__"+e.string]&&e.regexp.test(y)&&(x["__"+e.string]=1,d.push([e.regexp,'<span class="'+e.type+'" pre="'+l+'"'+p+">$&</span>"]),e.used=!0,_=!0)},x={};void 0!==f&&(l+=" ",a.map(f,E)),_||(l="",a.map(c,E))}l=m}if(d.length>0){for(var C=e,T=0;T<d.length;T++){var k=d[T][0],b=d[T][1];C=function(e){var t,n;if(3===e.nodeType){if(o++,a.isIE()&&e.nodeValue.length>0&&" "===e.nodeValue.substr(0,1))return a.create(g+e.nodeValue.substr(1,e.nodeValue.length-1).replace(k,b),!1);if(r)return a.create(e.nodeValue.replace(k,b),!1);if(t=a.create("<span />"),void 0===r&&(r="function"!=typeof t.appendChild))return a.remove(t),a.create(e.nodeValue.replace(k,b),!1);n=u(e,k,b);for(var s=0;s<n.length;s++)t.appendChild(n[s]);return e=t}for(var i=a.contents(e),p=0;p<i.length;p++){var h;if(3===i[p].nodeType&&k.test(i[p].nodeValue))return h=a.isIE()&&i[p].nodeValue.length>0&&" "===i[p].nodeValue.substr(0,1)?a.create(g+i[p].nodeValue.substr(1,i[p].nodeValue.length-1).replace(k,b),!0):a.create(i[p].nodeValue.replace(k,b),!0),a.replaceWith(i[p],h),a.removeParent(h),o++,e}return e}(C)}a.replaceWith(e,C)}}}),o},AtDCore.prototype._walk=function(e,t){var r;for(r=0;r<e.length;r++)t.call(t,e[r]),this._walk(this.contents(e[r]),t)},AtDCore.prototype.removeWords=function(e,t){var r=0,n=this;return this.map(this.findSpans(e).reverse(),function(e){if(e&&(n.isMarkedNode(e)||n.hasClass(e,"mceItemHidden")||n.isEmptySpan(e)))if("&nbsp;"===e.innerHTML){var s=document.createTextNode(" ");n.replaceWith(e,s)}else t&&e.innerHTML!==t||(n.removeParent(e),r++)}),r},AtDCore.prototype.isEmptySpan=function(e){return""===this.getAttrib(e,"class")&&""===this.getAttrib(e,"style")&&""===this.getAttrib(e,"id")&&!this.hasClass(e,"Apple-style-span")&&""===this.getAttrib(e,"mce_name")},AtDCore.prototype.isMarkedNode=function(e){return this.hasClass(e,"hiddenGrammarError")||this.hasClass(e,"hiddenSpellError")||this.hasClass(e,"hiddenSuggestion")},AtDCore.prototype.applySuggestion=function(e,t){if("(omit)"===t)this.remove(e);else{var r=this.create(t);this.replaceWith(e,r),this.removeParent(r)}},AtDCore.prototype.hasErrorMessage=function(e){return void 0!==e&&null!==e.getElementsByTagName("message").item(0)},AtDCore.prototype.getErrorMessage=function(e){return e.getElementsByTagName("message").item(0)},AtDCore.prototype.isIE=function(){return"Microsoft Internet Explorer"===navigator.appName}; \ No newline at end of file