User:Dst2015/common.js

function DataSet(e,t){if(!e||Array.isArray(e)||util.isDataTable(e)||(t=e,e=null),this._options=t||{},this._data={},this.length=0,this._fieldId=this._options.fieldId||"id",this._type={},this._options.type)for(var i in this._options.type)if(this._options.type.hasOwnProperty(i)){var n=this._options.type[i];"Date"==n||"ISODate"==n||"ASPDate"==n?this._type[i]="Date":this._type[i]=n}if(this._options.convert)throw new Error('Option "convert" is deprecated. Use "type" instead.');this._subscribers={},e&&this.add(e),this.setOptions(t)}function rgbToHsl(e,t,i){e/=255,t/=255,i/=255;var n,o,r=Math.max(e,t,i),a=Math.min(e,t,i),s=(r+a)/2;if(r==a)n=o=0;else{var l=r-a;switch(o=s>.5?l/(2-r-a):l/(r+a),r){case e:n=(t-i)/l+(i>t?6:0);break;case t:n=(i-e)/l+2;break;case i:n=(e-t)/l+4}n/=6}return s}function getRandomInt(e,t){return Math.floor(Math.random*(t-e+1))+e}function getRandomColor{for(var e="0123456789ABCDEF".split(""),t="#",i=0;6>i;i++)t+=e[Math.floor(16*Math.random)];return t}function getTextOfSection(e,t){e=escapeRegExp(e);var i=t.getRawText,n=new RegExp("={2,}.*"+e+".*={2,}","i"),o=n.exec(i),r=i.search(n),a="";if(console.log("sectionTitle: "+e+" STRING TO SEARCH: "+o),null!=o){var s=r+o[0].length,l=i.substring(s,i.length);l=deleteEqualsSigns(l,0),r=l.indexOf("=="),a="",a=r>-1?l.substr(0,r):l,a.replace("="," ")}return a}function deleteEqualsSigns(e,t){return 0==e.search("==")&&5>t?e=deleteEqualsSigns(e.substring(2,e.length),t+1):0==e.search(" ==")&&5>t&&(e=deleteEqualsSigns(e.substring(3,e.length),t+1)),e}function escapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function hexToRgb(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function replaceCharacterWithAnother(e,t,i,n){for(var o=0,r=0;r=i&&o[r].id<=n&&t.add(o[r])}function errorHandler(e){var t="";switch(e.name){case FileError.QUOTA_EXCEEDED_ERR:t="QUOTA_EXCEEDED_ERR";break;case FileError.NOT_FOUND_ERR:t="NOT_FOUND_ERR";break;case FileError.SECURITY_ERR:t="SECURITY_ERR";break;case FileError.INVALID_MODIFICATION_ERR:t="INVALID_MODIFICATION_ERR";break;case FileError.INVALID_STATE_ERR:t="INVALID_STATE_ERR";break;default:t="Unknown Error: "+e.name+" MESSAGE: "+e.message}console.log("Error: "+t)}function createNewLogFile(e){var t=new Date,i=t.getTime/1e3;GLOBAL_fs=e,console.log("GLOABAL FS: "+GLOBAL_fs+" "+i+".txt"),e.root.getFile("C:\\"+i+".txt",{create:!0,exclusive:!0},function(e){e.createWriter(function(e){e.onwriteend=function(e){console.log("Write completed.")},e.onerror=function(e){console.log("Write failed: "+e.toString)};var t=new Blob(["Lorem Ipsum"],{type:"text/plain"});e.write(t)},errorHandler)},errorHandler),GLOBAL_logger=i}function logToFile(e,t){console.log("sdfGLOABAL FS: "+GLOBAL_fs),GLOBAL_fs.root.getFile(e,{create:!1},function(e){e.createWriter(function(e){e.seek(e.length);var i=new Blob([t],{type:"text/plain"});e.write(i)},errorHandler)},errorHandler)}function saveStringToDisk(e){window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,1048576,function(t){t.root.getFile("test.bin",{create:!0},function(t){t.createWriter(function(i){var n=new Uint8Array(3);n[0]=97,n[1]=98,n[2]=99;var o=new Blob([e]);i.addEventListener("writeend",function{location.href=t.toURL},!1),i.write(o)},function{})},function{})},function{})}function getTooltipToQualityName(e){return"qualityFleschWordCount"==e?"This measure combines the Flesch-Reading-Ease (Reading Difficulty) with the word count in order to get a meaningful statement about how well-written the section is and if it is long enough.":"qualityKincaid"==e?"The Level of experience is measured with the help of the Flesch-Kincaid-Grade-Level which should help to check the readability of the section. The default value is 14. So a 14 year old person should have no problem to read this section! ":"qualityImages"==e?"Are there enough images referenced in the section. By default 4 is set to be the optimal value. ":"qualityExternalRefs"==e?"Are there enough external references in the section. By default 5 is set to be the optimal value. ":"qualityAllLinks"==e?"Are there enough links in the section. By default 30 is set to be the optimal value. ":"score"==e?"The overall score of the section!":e}function getAliasToQualityName(e){return"qualityFleschWordCount"==e?"Reading Difficulty * Word Count":"qualityKincaid"==e?"Level of experience":"qualityImages"==e?"Amount of Images":"qualityExternalRefs"==e?"Amount of External References":"qualityAllLinks"==e?"Amount of internal Wikipedia-links":"score"==e?"Score of the section":e}function trimToOneParagraph(e,t){var i=e.indexOf(t),n=0;if(i>-1){for("="!=e[i+n];)n++;for("="==e[i+n];)n++;var o=e.substr(i+n).indexOf("==");return e.substr(0,i+n+o)}return e}!function(e){function t(e){var t=["li","p","h1","h2","h3","h4","h5","h6","dd"];return t.forEach(function(t){e=e.replace("",".")}),e=e.replace(/<[^>]+>/g,"").replace(/[,:;\-]/," ").replace(/[\.!?]/,".").replace(/^\s+/,"").replace(/[ ]*(\n|\r\n|\r)[ ]*/," ").replace(/([\.])[\. ]+/,".").replace(/[ ]*([\.])/,". ").replace(/\s+/," ").replace(/\s+$/,""),e+="."}function i(e){return new n(e)}var n=function(e){this.text=e?t(e):this.text};n.prototype.fleschKincaidReadingEase=function(e){return e=e?t(e):this.text,Math.round(10*(206.835-1.015*this.averageWordsPerSentence(e)-84.6*this.averageSyllablesPerWord(e)))/10},n.prototype.fleschKincaidGradeLevel=function(e){return e=e?t(e):this.text,Math.round(10*(.39*this.averageWordsPerSentence(e)+11.8*this.averageSyllablesPerWord(e)-15.59))/10},n.prototype.gunningFogScore=function(e){return e=e?t(e):this.text,Math.round(.4*(this.averageWordsPerSentence(e)+this.percentageWordsWithThreeSyllables(e,!1))*10)/10},n.prototype.colemanLiauIndex=function(e){return e=e?t(e):this.text,Math.round(10*(5.89*(this.letterCount(e)/this.wordCount(e))-.3*(this.sentenceCount(e)/this.wordCount(e))-15.8))/10},n.prototype.smogIndex=function(e){return e=e?t(e):this.text,Math.round(1.043*Math.sqrt(this.wordsWithThreeSyllables(e)*(30/this.sentenceCount(e))+3.1291)*10)/10},n.prototype.automatedReadabilityIndex=function(e){return e=e?t(e):this.text,Math.round(10*(4.71*(this.letterCount(e)/this.wordCount(e))+.5*(this.wordCount(e)/this.sentenceCount(e))-21.43))/10},n.prototype.textLength=function(e){return e=e?t(e):this.text,e.length},n.prototype.letterCount=function(e){return e=e?t(e):this.text,e=e.replace(/[^a-z]+/gi,""),e.length},n.prototype.sentenceCount=function(e){return e=e?t(e):this.text,void 0!=e?e.replace(/[^\.!?]/g,"").length||1:1},n.prototype.wordCount=function(e){return e=e?t(e):this.text,void 0!=e?(console.log("1"),e.split(/[^a-z0-9]+/i).length||1):1},n.prototype.averageWordsPerSentence=function(e){return e=e?t(e):this.text,this.wordCount(e)/this.sentenceCount(e)},n.prototype.averageSyllablesPerWord=function(e){e=e?t(e):this.text;var i=0,n=this.wordCount(e),o=this;return console.log("2"),e.split(/\s+/).forEach(function(e){i+=o.syllableCount(e)}),(i||1)/(n||1)},n.prototype.wordsWithThreeSyllables=function(e,i){e=e?t(e):this.text;var n=0,o=this;return i=i===!1?!1:!0,console.log("3"),e.split(/\s+/).forEach(function(e){(!e.match(/^[A-Z]/)||i)&&o.syllableCount(e)>2&&n++}),n},n.prototype.percentageWordsWithThreeSyllables=function(e,i){return e=e?t(e):this.text,this.wordsWithThreeSyllables(e,i)/this.wordCount(e)*100},n.prototype.syllableCount=function(e){var t=0,i=0,n=0;e=e.toLowerCase.replace(/[^a-z]/g,"");var o={simile:3,forever:3,shoreline:2};if(o.hasOwnProperty(e))return o[e];var r=[/cial/,/tia/,/cius/,/cious/,/giu/,/ion/,/iou/,/sia$/,/[^aeiuoyt]{2,}ed$/,/.ely$/,/[cg]h?e[rsd]?$/,/rved?$/,/[aeiouy][dt]es?$/,/[aeiouy][^aeiouydt]e[rsd]?$/,/^[dr]e[aeiou][^aeiou]+$/,/[aeiouy]rse$/],a=[/ia/,/riet/,/dien/,/iu/,/io/,/ii/,/[aeiouym]bl$/,/[aeiou]{3}/,/^mc/,/ism$/,/([^aeiouy])\1l$/,/[^l]lien/,/^coa[dglx]./,/[^gq]ua[^auieo]/,/dnt$/,/uity$/,/ie(r|st)$/],s=[/^un/,/^fore/,/ly$/,/less$/,/ful$/,/ers?$/,/ings?$/];return s.forEach(function(t){e.match(t)&&(e=e.replace(t,""),i++)}),console.log("4"),n=e.split(/[^aeiouy]+/gi).filter(function(e){return!!e.replace(/\s+/gi,"").length}).length,t=n+i,r.forEach(function(i){e.match(i)&&t--}),a.forEach(function(i){e.match(i)&&t++}),t||1},"undefined"!=typeof module&&module.exports?module.exports=i:"undefined"!=typeof define?define("textstatistics",[],function{return i}):e.textstatistics=i}(this);var Util=function{var e={};return e.isDataTable=function(e){return"undefined"!=typeof google&&google.visualization&&google.visualization.DataTable&&e instanceof google.visualization.DataTable},e.convert=function(e,t){var i;if(void 0!==e){if(null===e)return null;if(!t)return e;if("string"!=typeof t&&!(t instanceof String))throw new Error("Type must be a string");switch(t){case"boolean":case"Boolean":return Boolean(e);case"number":case"Number":return Number(e.valueOf);case"string":case"String":return String(e);case"Date":if(exports.isNumber(e))return new Date(e);if(e instanceof Date)return new Date(e.valueOf);if(moment.isMoment(e))return new Date(e.valueOf);if(exports.isString(e))return i=ASPDateRegex.exec(e),i?new Date(Number(i[1])):moment(e).toDate;throw new Error("Cannot convert object of type "+exports.getType(e)+" to type Date");case"Moment":if(exports.isNumber(e))return moment(e);if(e instanceof Date)return moment(e.valueOf);if(moment.isMoment(e))return moment(e);if(exports.isString(e))return i=ASPDateRegex.exec(e),i?moment(Number(i[1])):moment(e);throw new Error("Cannot convert object of type "+exports.getType(e)+" to type Date");case"ISODate":if(exports.isNumber(e))return new Date(e);if(e instanceof Date)return e.toISOString;if(moment.isMoment(e))return e.toDate.toISOString;if(exports.isString(e))return i=ASPDateRegex.exec(e),i?new Date(Number(i[1])).toISOString:new Date(e).toISOString;throw new Error("Cannot convert object of type "+exports.getType(e)+" to type ISODate");case"ASPDate":if(exports.isNumber(e))return"/Date("+e+")/";if(e instanceof Date)return"/Date("+e.valueOf+")/";if(exports.isString(e)){i=ASPDateRegex.exec(e);var n;return n=i?new Date(Number(i[1])).valueOf:new Date(e).valueOf,"/Date("+n+")/"}throw new Error("Cannot convert object of type "+exports.getType(e)+" to type ASPDate");default:throw new Error('Unknown type "'+t+'"')}}},e.getType=function(e){var t=typeof e;return"object"==t?null==e?"null":e instanceof Boolean?"Boolean":e instanceof Number?"Number":e instanceof String?"String":Array.isArray(e)?"Array":e instanceof Date?"Date":"Object":"number"==t?"Number":"boolean"==t?"Boolean":"string"==t?"String":t},e.isString=function(e){return e instanceof String||"string"==typeof e},e.isNumber=function(e){return e instanceof Number||"number"==typeof e},e.randomUUID=function{var e=function{return Math.floor(65536*Math.random).toString(16)};return e+e+"-"+e+"-"+e+"-"+e+"-"+e+e+e},e},util=new Util;DataSet.prototype.setOptions=function(e){e&&void 0!==e.queue&&(e.queue===!1?this._queue&&(this._queue.destroy,delete this._queue):(this._queue||(this._queue=Queue.extend(this,{replace:["add","update","remove"]})),"object"==typeof e.queue&&this._queue.setOptions(e.queue)))},DataSet.prototype.on=function(e,t){var i=this._subscribers[e];i||(i=[],this._subscribers[e]=i),i.push({callback:t})},DataSet.prototype.subscribe=DataSet.prototype.on,DataSet.prototype.off=function(e,t){var i=this._subscribers[e];i&&(this._subscribers[e]=i.filter(function(e){return e.callback!=t}))},DataSet.prototype.unsubscribe=DataSet.prototype.off,DataSet.prototype._trigger=function(e,t,i){if("*"==e)throw new Error("Cannot trigger event *");var n=[];e in this._subscribers&&(n=n.concat(this._subscribers[e])),"*"in this._subscribers&&(n=n.concat(this._subscribers["*"]));for(var o=0;or;r++)i=o._addItem(e[r]),n.push(i);else if(util.isDataTable(e))for(var s=this._getColumnNames(e),l=0,c=e.getNumberOfRows;c>l;l++){for(var u={},d=0,g=s.length;g>d;d++){var h=s[d];u[h]=e.getValue(l,d)}i=o._addItem(u),n.push(i)}else{if(!(e instanceof Object))throw new Error("Unknown dataType");i=o._addItem(e),n.push(i)}return n.length&&this._trigger("add",{items:n},t),n},DataSet.prototype.update=function(e,t){var i=[],n=[],o=[],r=this,a=r._fieldId,s=function(e){var t=e[a];r._data[t]?(t=r._updateItem(e),n.push(t),o.push(e)):(t=r._addItem(e),i.push(t))};if(Array.isArray(e))for(var l=0,c=e.length;c>l;l++)s(e[l]);else if(util.isDataTable(e))for(var u=this._getColumnNames(e),d=0,g=e.getNumberOfRows;g>d;d++){for(var h={},p=0,m=u.length;m>p;p++){var f=u[p];h[f]=e.getValue(d,p)}s(h)}else{if(!(e instanceof Object))throw new Error("Unknown dataType");s(e)}return i.length&&this._trigger("add",{items:i},t),n.length&&this._trigger("update",{items:n,data:o},t),i.concat(n)},DataSet.prototype.DSTupdate=function(e,t){var i=[],n=[],o=[],r=this,a=r._fieldId,s=function(e){var t=e[a];r._data[t]?(t=r._updateItem(e),n.push(t),o.push(e)):(t=r._addItem(e),i.push(t))};if(Array.isArray(e))for(var l=0,c=e.length;c>l;l++)s(e[l]);else if(util.isDataTable(e))for(var u=this._getColumnNames(e),d=0,g=e.getNumberOfRows;g>d;d++){for(var h={},p=0,m=u.length;m>p;p++){var f=u[p];h[f]=e.getValue(d,p)}s(h)}else{if(!(e instanceof Object))throw new Error("Unknown dataType");s(e)}return i.concat(n)},DataSet.prototype.get=function(e){var t,i,n,o,r=this,a=util.getType(arguments[0]);"String"==a||"Number"==a?(t=arguments[0],n=arguments[1],o=arguments[2]):"Array"==a?(i=arguments[0],n=arguments[1],o=arguments[2]):(n=arguments[0],o=arguments[1]);var s;if(n&&n.returnType){var l=["DataTable","Array","Object"];if(s=-1==l.indexOf(n.returnType)?"Array":n.returnType,o&&s!=util.getType(o))throw new Error('Type of parameter "data" ('+util.getType(o)+") does not correspond with specified options.type ("+n.type+")");if("DataTable"==s&&!util.isDataTable(o))throw new Error('Parameter "data" must be a DataTable when options.type is "DataTable"')}else s=o&&"DataTable"==util.getType(o)?"DataTable":"Array";var c,u,d,g,h=n&&n.type||this._options.type,p=n&&n.filter,m=[];if(void 0!=t)c=r._getItem(t,h),p&&!p(c)&&(c=null);else if(void 0!=i)for(d=0,g=i.length;g>d;d++)c=r._getItem(i[d],h),(!p||p(c))&&m.push(c);else for(u in this._data)this._data.hasOwnProperty(u)&&(c=r._getItem(u,h),(!p||p(c))&&m.push(c));if(n&&n.order&&void 0==t&&this._sort(m,n.order),n&&n.fields){var f=n.fields;if(void 0!=t)c=this._filterFields(c,f);else for(d=0,g=m.length;g>d;d++)m[d]=this._filterFields(m[d],f)}if("DataTable"==s){var v=this._getColumnNames(o);if(void 0!=t)r._appendRow(o,v,c);else for(d=0;dd;d++)o.push(m[d]);return o}return m},DataSet.prototype.getIds=function(e){var t,i,n,o,r,a=this._data,s=e&&e.filter,l=e&&e.order,c=e&&e.type||this._options.type,u=[];if(s)if(l){r=[];for(n in a)a.hasOwnProperty(n)&&(o=this._getItem(n,c),s(o)&&r.push(o));for(this._sort(r,l),t=0,i=r.length;i>t;t++)u[t]=r[t][this._fieldId]}else for(n in a)a.hasOwnProperty(n)&&(o=this._getItem(n,c),s(o)&&u.push(o[this._fieldId]));else if(l){r=[];for(n in a)a.hasOwnProperty(n)&&r.push(a[n]);for(this._sort(r,l),t=0,i=r.length;i>t;t++)u[t]=r[t][this._fieldId]}else for(n in a)a.hasOwnProperty(n)&&(o=a[n],u.push(o[this._fieldId]));return u},DataSet.prototype.getDataSet=function{return this},DataSet.prototype.forEach=function(e,t){var i,n,o=t&&t.filter,r=t&&t.type||this._options.type,a=this._data;if(t&&t.order)for(var s=this.get(t),l=0,c=s.length;c>l;l++)i=s[l],n=i[this._fieldId],e(i,n);else for(n in a)a.hasOwnProperty(n)&&(i=this._getItem(n,r),(!o||o(i))&&e(i,n))},DataSet.prototype.map=function(e,t){var i,n=t&&t.filter,o=t&&t.type||this._options.type,r=[],a=this._data;for(var s in a)a.hasOwnProperty(s)&&(i=this._getItem(s,o),(!n||n(i))&&r.push(e(i,s)));return t&&t.order&&this._sort(r,t.order),r},DataSet.prototype._filterFields=function(e,t){if(!e)return e;var i={};if(Array.isArray(t))for(var n in e)e.hasOwnProperty(n)&&-1!=t.indexOf(n)&&(i[n]=e[n]);else for(var n in e)e.hasOwnProperty(n)&&t.hasOwnProperty(n)&&(i[t[n]]=e[n]);return i},DataSet.prototype._sort=function(e,t){if(util.isString(t)){var i=t;e.sort(function(e,t){var n=e[i],o=t[i];return n>o?1:o>n?-1:0})}else{if("function"!=typeof t)throw new TypeError("Order must be a function or a string");e.sort(t)}},DataSet.prototype.remove=function(e,t){var i,n,o,r=[];if(Array.isArray(e))for(i=0,n=e.length;n>i;i++)o=this._remove(e[i]),null!=o&&r.push(o);else o=this._remove(e),null!=o&&r.push(o);return r.length&&this._trigger("remove",{items:r},t),r},DataSet.prototype._remove=function(e){if(util.isNumber(e)||util.isString(e)){if(this._data[e])return delete this._data[e],this.length--,e}else if(e instanceof Object){var t=e[this._fieldId];if(t&&this._data[t])return delete this._data[t],this.length--,t}return null},DataSet.prototype.clear=function(e){var t=Object.keys(this._data);return this._data={},this.length=0,this._trigger("remove",{items:t},e),t},DataSet.prototype.max=function(e){var t=this._data,i=null,n=null;for(var o in t)if(t.hasOwnProperty(o)){var r=t[o],a=r[e];null!=a&&(!i||a>n)&&(i=r,n=a)}return i},DataSet.prototype.min=function(e){var t=this._data,i=null,n=null;for(var o in t)if(t.hasOwnProperty(o)){var r=t[o],a=r[e];null!=a&&(!i||n>a)&&(i=r,n=a)}return i},DataSet.prototype.distinct=function(e){var t,i=this._data,n=[],o=this._options.type&&this._options.type[e]||null,r=0;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a],l=s[e],c=!1;for(t=0;r>t;t++)if(n[t]==l){c=!0;break}c||void 0===l||(n[r]=l,r++)}if(o)for(t=0;t<n.length;t++)n[t]=util.convert(n[t],o);return n},DataSet.prototype._addItem=function(e){var t=e[this._fieldId];if(void 0!=t){if(this._data[t])throw new Error("Cannot add item: item with id "+t+" already exists")}else t=util.randomUUID,e[this._fieldId]=t;var i={};for(var n in e)if(e.hasOwnProperty(n)){var o=this._type[n];i[n]=util.convert(e[n],o)}return this._data[t]=i,this.length++,t},DataSet.prototype._getItem=function(e,t){var i,n,o=this._data[e];if(!o)return null;var r={};if(t)for(i in o)o.hasOwnProperty(i)&&(n=o[i],r[i]=util.convert(n,t[i]));else for(i in o)o.hasOwnProperty(i)&&(n=o[i],r[i]=n);return r},DataSet.prototype._updateItem=function(e){var t=e[this._fieldId];if(void 0==t)throw new Error("Cannot update item: item has no id (item: "+JSON.stringify(e)+")");var i=this._data[t];if(!i)throw new Error("Cannot update item: no item with id "+t+" found");for(var n in e)if(e.hasOwnProperty(n)){var o=this._type[n];i[n]=util.convert(e[n],o)}return t},DataSet.prototype._getColumnNames=function(e){for(var t=[],i=0,n=e.getNumberOfColumns;n>i;i++)t[i]=e.getColumnId(i)||e.getColumnLabel(i);return t},DataSet.prototype._appendRow=function(e,t,i){for(var n=e.addRow,o=0,r=t.length;r>o;o++){var a=t[o];e.setValue(n,o,i[a])}};var GLOBAL_wikiLanguage="en",prepareTableOfContent=function(e){$("#cssmenu li").on("click",function{if(console.log("cssmenu li> a "+$(this).attr("class")),void 0==$(this).attr("class"))if(GLOBAL_wikiPageActive){console.log("GLOBAL_wikiPageActive");var t=$(this).attr("name");t.replace(/ /g,"_");e.checkSensium(t)}else{var i=$(this).attr("name").replace(/[^\w\s]/gi,""),n=i.replace(/ /g,"_"),o="#"+n;void 0!=$(o).offset}}),$("#cssmenu li.has-sub>a").on("click",function{$(this).removeAttr("href");var t=$(this).parent("li");if(t.hasClass("open"))t.removeClass("open"),t.find("li").removeClass("open"),t.find("ul").slideUp;else{if(GLOBAL_wikiPageActive){console.log("GLOBAL_wikiPageActive");var i=$(this).parent.attr("name");i.replace(/ /g,"_");e.checkSensium(i)}else{var n=$(this).parent.attr("name").replace(/[^\w\s]/gi,"");n.replace(/ /g,"_")}t.addClass("open"),t.children("ul").slideDown,t.siblings("li").children("ul").slideUp,t.siblings("li").removeClass("open"),t.siblings("li").find("li").removeClass("open"),t.siblings("li").find("ul").slideUp}}),$("#cssmenu>ul>li.has-sub>a").append(' '),function{var e,t,i,n=$("#cssmenu").css("color");n=n.slice(4),e=n.slice(0,n.indexOf(",")),n=n.slice(n.indexOf(" ")+1),t=n.slice(0,n.indexOf(",")),n=n.slice(n.indexOf(" ")+1),i=n.slice(0,n.indexOf(")"));var o=rgbToHsl(e,t,i);o>.7?($("#cssmenu>ul>li>a").css("text-shadow","0 1px 1px rgba(0, 0, 0, .35)"),$("#cssmenu>ul>li>a>span").css("border-color","rgba(0, 0, 0, .35)")):($("#cssmenu>ul>li>a").css("text-shadow","0 1px 0 rgba(255, 255, 255, .35)"),$("#cssmenu>ul>li>a>span").css("border-color","rgba(255, 255, 255, .35)"))}},prepareTableOfContentToc=function(e){$("#toc li").on("click",function{if(console.log("toc li> a "+$(this).attr("class")),void 0==$(this).attr("class"))if(GLOBAL_wikiPageActive){console.log("GLOBAL_wikiPageActive");var t=$(this).attr("name");t.replace(/ /g,"_");e.checkSensium(t)}else{var i=$(this).attr("name").replace(/[^\w\s]/gi,""),n=i.replace(/ /g,"_"),o="#"+n;void 0!=$(o).offset}}),$("#toc li.has-sub>a").on("click",function{$(this).removeAttr("href");var t=$(this).parent("li");if(t.hasClass("open"))t.removeClass("open"),t.find("li").removeClass("open"),t.find("ul").slideUp;else{if(GLOBAL_wikiPageActive){console.log("GLOBAL_wikiPageActive");var i=$(this).parent.attr("name");i.replace(/ /g,"_");e.checkSensium(i)}else{var n=$(this).parent.attr("name").replace(/[^\w\s]/gi,"");n.replace(/ /g,"_")}t.addClass("open"),t.children("ul").slideDown,t.siblings("li").children("ul").slideUp,t.siblings("li").removeClass("open"),t.siblings("li").find("li").removeClass("open"),t.siblings("li").find("ul").slideUp}}),$("#toc").find("ul").css("display","block"),function{var e,t,i,n=$("#toc").css("color");n=n.slice(4),e=n.slice(0,n.indexOf(",")),n=n.slice(n.indexOf(" ")+1),t=n.slice(0,n.indexOf(",")),n=n.slice(n.indexOf(" ")+1),i=n.slice(0,n.indexOf(")"));var o=rgbToHsl(e,t,i);o>.7?($("#toc>ul>li>a").css("text-shadow","0 1px 1px rgba(0, 0, 0, .35)"),$("#toc>ul>li>a>span").css("border-color","rgba(0, 0, 0, .35)")):($("#toc>ul>li>a").css("text-shadow","0 1px 0 rgba(255, 255, 255, .35)"),$("#toc>ul>li>a>span").css("border-color","rgba(255, 255, 255, .35)"))}},good_flesch=75,good_fleschWordCount=1e4,good_kinkaid=14,good_extLinks=10,good_iwlinks=5,good_numPics=2,good_allLinks=10,default_good_flesch=75,default_good_fleschWordCount=1e4,default_good_kinkaid=14,default_good_extLinks=10,default_good_iwlinks=5,default_good_numPics=2,default_good_allLinks=10,GLOBAL_username="",overallScoreInterval=0,weightFlesch=1,weightKincaid=1,weightImageQuality=1,weightExternalRefs=1,weightAllLinks=1,currentSelectedSectionIndex=-1,currentSelectedSectionId=-1,isAddNodeMode=!1,numberOfMetrics=5,influenceFlesch=parseFloat(100/numberOfMetrics/100),influenceKincaid=parseFloat(100/numberOfMetrics/100),influenceImageQuality=parseFloat(100/numberOfMetrics/100),influenceExternalRefs=parseFloat(100/numberOfMetrics/100),influenceAllLinks=parseFloat(100/numberOfMetrics/100),currentImageSrc,GLOBAL_fs,GLOBAL_wikiPageActive=!0,GLOBAL_compare=!1,reverseString=function(e){return e.split("").reverse.join("")};String.prototype.replaceAt=function(e,t){return this.substr(0,e)+t+this.substr(e+t.length)},String.prototype.replaceAtHelp=function(e,t){return this.substr(0,e)+t+this.substr(e-1+t.length)},String.prototype.replaceHtmlEntites=function{var e=this,t=/&(nbsp|amp|quot|lt|gt);/g,i={nbsp:" ",amp:"&",quot:'"',lt:"<",gt:">"};return e.replace(t,function(e,t){return i[t]})};var getSectionToRef=function(e,t){for(var i=e.substring(0,e.search(t)),n=!1,o="",r=i.length-1;r>0;r--)if(n){if("="==i[r])return o=reverseString(o)," "==o[o.length-1]&&(o=o.substring(0,o.length-1))," "==o[0]&&(o=o.substring(1,o.length)),o;o+=i[r],cutSectionName=!0}else if("="==i[r]&&"="==i[r-1]){for("="==i[r-1];)r--;n=!0}};jQuery.fn.highlight=function(e,t){var i=new RegExp(e,"gi");return this.each(function{$(this).contents.filter(function{return 3==this.nodeType&&i.test(this.nodeValue)}).replaceWith(function{return(this.nodeValue||"").replace(i,function(e){return''+e+" "})})})};var QualityFlawManager=function(e){var t={},i=[{name:"{{unreferenced",alias:"A section does not contain any sources!",description:"This section does not cite any references or sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed."},{name:"{{citations missing",alias:"This article is missing citations and/or footnotes!",description:"This article is missing citations and/or footnotes."},{name:"{{unreferenced section",alias:"Section without references!",description:"This section does not cite any references or sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed."},{name:"{{orphan",alias:"The article has fewer then tree incoming links!",description:"Use this for articles that aren't linked to from any other pages."},{name:"{{refimprove",alias:"Additional citations for verification is needed!",description:"This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed."},{name:"{{refimprove science",alias:"The article need additional citations!",description:"This article needs additional citations to secondary or tertiary sources such as review articles, monographs, or textbooks. Please add references to provide context and establish notability for any primary research articles cited."},{name:"{{film IMDb refimprove",alias:"This media article uses IMDb for verification!",description:"This media article uses IMDb for verification. IMDb may not be a reliable source for film and television information and is generally only cited as an external link. Please help by replacing IMDb with third-party reliable sources"},{name:"{{BLP IMDb refimprove",alias:"This biographical article needs additional citations!",description:"This biographical article needs additional citations for verification, as it includes attribution to IMDb. IMDb may not be a reliable source for biographical information. Please help by adding additional, reliable sources for verification. Contentious material about living persons that is unsourced or poorly sourced must be removed immediately, especially if potentially libelous or harmful."},{name:"{{Empty section",alias:"There is an empty section in the article!",description:"The article has at least one section that is empty!"},{name:"{{No content",alias:"There is an empty section in the article!",description:"The article has at least one section that is empty"},{name:"{{notability",alias:"The topic may not meet Wikipedia's general notability guideline!",description:"The topic of this article may not meet Wikipedia's general notability guideline. Please help to establish notability by adding reliable, secondary sources about the topic. If notability cannot be established, the article is likely to be merged, redirected, or deleted."},{name:"{{no footnotes",alias:"There are no footnotes in the article!",description:"This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please improve this article by introducing more precise citations."},{name:"{{primary sources",alias:"This article relies too much on references to primary sources!",description:"This article relies too much on references to primary sources. Please improve this article by adding secondary or tertiary sources."},{name:"{{MOS",alias:"The article needs editing for compliance with Wikipedia's Manual of Style!",description:"This needs editing for compliance with Wikipedia's Manual of Style. Please improve this if you can."},{name:"{{underlinked",alias:"This article needs more links to other articles to help integrate it into the encyclopedia!",description:"This article needs more links to other articles to help integrate it into the encyclopedia. Please help improve this article by adding links that are relevant to the context within the existing text."},{name:"{{overlinked",alias:"This may have too many links to other articles!",description:"This may have too many links to other articles, and could require cleanup to meet Wikipedia's quality standards. Per the Wikipedia style guidelines, please remove duplicate links, and any links that are not relevant to the context."},{name:"{{dead end",alias:"This article has no links to other Wikipedia articles!",description:"This article has no links to other Wikipedia articles. Please help improve this article by adding links that are relevant to the context within the existing text."},{name:"{{cleanup-HTML",alias:"This article uses HTML markup!",description:"This uses HTML markup. Please help by changing HTML markup to wiki markup where appropriate. For more details, see HTML in wikitext. Bear in mind that some HTML elements (e.g., the {{sup|}} and {{sub|}} tags) should not be removed. See Help:Wikitext examples for a list of non-deprecated HTML tags."},{name:"{{cleanup-bare URLs",alias:"This article uses bare URLs for citations, which may be threatened by link rot!",description:"This article uses bare URLs for citations, which may be threatened by link rot. Please consider adding full citations so that the article remains verifiable. Several templates and the reFill tool are available to assist in formatting. (reFill documentation)"},{name:"{{format footnotes",alias:"This article includes inline citations, but they are not properly formatted!",description:"This article includes inline citations, but they are not properly formatted. Please improve this article by correcting them."},{name:"{{citation style",alias:"This article has an unclear citation style!",description:"This article has an unclear citation style. The references used may be made clearer with a different or consistent style of citation, footnoting, or external linking"},{name:"{{sections",alias:"This article should be divided into sections by topic, to make it more accessible!",description:"This article should be divided into sections by topic, to make it more accessible. Please help by adding section headings in accordance with Wikipedia's Manual of Style"},{name:"{{lead missing",alias:"This article has no lead section. Please help by adding an introductory section to this article!",description:"This article has no lead section. Please help by adding an introductory section to this article. For more information, see the layout guide, and Wikipedia's lead section guidelines."},{name:"{{lead too short",alias:"This article's lead section may not adequately summarize key points of its contents!",description:"This article's lead section may not adequately summarize key points of its contents. Please consider expanding the lead to provide an accessible overview of all important aspects of the article."},{name:"{{lead too long",alias:"This article's introduction may be too long for the overall article length!",description:"This article's introduction may be too long for the overall article length. Please help by moving some material from it into the body of the article. For more information please read the layout guide and Wikipedia's lead section guidelines."},{name:"{{inadequate lead",alias:"This article's introduction section may not adequately summarize its contents!",description:"This article's introduction section may not adequately summarize its contents. To comply with Wikipedia's lead section guidelines, please consider modifying the lead to provide an accessible overview of the article's key points in such a way that it can stand on its own as a concise version of the article." },{name:"{{lead rewrite",alias:"The lead section of this article may need to be rewritten!",description:"The lead section of this article may need to be rewritten. Please discuss this issue on the talk page and read the layout guide to make sure the section will be inclusive of all essential details."},{name:"{{advert",alias:"The article is written like an advert!",description:"This article contains content that is written like an advertisement. Please help improve it by removing promotional content and inappropriate external links, and by adding encyclopedic content written from a neutral point of view."},{name:"{{original research",alias:"This article possibly contains original research!",description:"This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed."},{name:"{{unreliable sources",alias:"Some or all of this article's listed sources may not be reliable!",description:"Some or all of this article's listed sources may not be reliable. Please help this article by looking for better, more reliable sources, or by checking whether the references meet the criteria for reliable sources. Unreliable citations may be challenged or deleted."},{name:"{{unreliable source?",alias:"There is a source which is not reliable!",description:"Wikipedia articles should be based on reliable, published sources, making sure that all majority and significant minority views that have appeared in those sources are covered."},{name:"{{citation needed",alias:"A citation is needed!",description:"Please add a citation."},{name:"{{citation needed span",alias:"A citation is needed!",description:"Please add a citation."},{name:"{{citation needed (lead)",alias:"A citation is needed!",description:"Please add a citation."},{name:"{{cleanup",alias:"A cleanup is needed!",description:"This article may require cleanup to meet Wikipedia's quality standards. No cleanup reason has been specified. Please help improve this article if you can; the talk page may contain suggestions."},{name:"{{subscription required",alias:"Subscription required!",description:"Subscription required!"}];t.reset=function{};var n=function(e,t){for(var i=t.substring(0,e),n=!1,o="",r=i.length-1;r>0;r--)if(n){if("="==i[r])return o=reverseString(o)," "==o[o.length-1]&&(o=o.substring(0,o.length-1))," "==o[0]&&(o=o.substring(1,o.length)),o=o.replace(/["']/g,"");o+=i[r]}else if("="==i[r]&&"="==i[r-1]){for("="==i[r-1];)r--;n=!0}return"Introduction"};return t.getQualityFlaws=function(e){for(var t=[],o="",r=0,a=e.toLowerCase,s=0;s-1;)if(0!=c&&(d=d.substring(c+2,d.length)),c=d.indexOf(l.name),u+=c,0==c&&c++,c>-1){t.push({name:l.name,description:l.description});var g=n(u,e);null==g?alert("ERROR SECTION NAME IS NULL "+u):(o+='  '+l.alias+'        ',r++,9==r&&(r=0))}return o+="",$("#qualityFlawViewText").html(o),t},t},SensiumRequester=function(e){var t=e.controller,i=null,n=null,o=null,r=0,a={};a.sensium=function{$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensium"}).done(function(e){var t=JSON.parse(e);console.log("score: "+t.polarity.score)})};return a.sensiumSummarize=function(e){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumSummarize",url:e}).done(function(e){var t=JSON.parse(e);$("#wikiTextInner").html(" Summary "+t.summary.text),$("#iconSensiumSummarize").css("background-color","white"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","transparent"),r=1})},a.sensiumSummarizeText=function(e,t){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumSummarizeText",sectionName:t,text:e}).done(function(t){if(""!=t){console.log("5");var i=t.split("||splithere||"),n=i[0];n=n.substring(1,n.length),console.log("DATA: "+t),t=i[1];var o=JSON.parse(t),o=" ";$("#wikiTextInner").html(o),$("#iconSensiumSummarize").css("background-color","white"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","transparent"),r=1}})},a.sensiumEventExtraction=function(e){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumEventExtraction",url:e}).done(function(e){var t=JSON.parse(e),i=t.temporalEvents,n=" ",$("#wikiTextInner").html(" Temporal Event Extraction "+n),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","white"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","transparent"),r=2})},a.sensiumEventExtractionText=function(e,t){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumEventExtractionText",sectionName:t,text:e}).done(function(e){if(""!=e){console.log("7");var t=e.split("||splithere||"),i=t[0];i=i.substring(1,i.length),e=t[1];var n=JSON.parse(e),o=n.temporalEvents,a=" ",$("#wikiTextInner").html(" Temporal Event Extraction("+i+")  "+a),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","white"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","transparent"),r=2}})},a.sensiumEntitiyExtraction=function(e){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumEntitiyExtraction",url:e}).done(function(e){var t=JSON.parse(e),i=t.entities,n=" ",$("#wikiTextInner").html(" Named Entity Recognition "+n),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","white"),r=3})},a.sensiumEntitiyExtractionText=function(e,t){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumEntitiyExtractionText",sectionName:t,text:e}).done(function(e){if(""!=e){console.log("8");var t=e.split("||splithere||"),i=t[0];i=i.substring(1,i.length),e=t[1];var n=JSON.parse(e),o=n.entities,a=" ",$("#wikiTextInner").html(" Named Entity Recognition("+i+")  "+a),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","transparent"),$("#iconSensiumEntity").css("background-color","white"),r=3}})},a.sensiumKeyphraseExtraction=function(e){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumSummarize",url:e}).done(function(e){var t=JSON.parse(e);console.log("KEYPHRASES HELP: "+JSON.stringify(t));var i=t.summary.keyPhrases,n=" ",$("#wikiTextInner").html(" Keyphrase Extraction "+n),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","white"),$("#iconSensiumEntity").css("background-color","transparent"),r=4})},a.sensiumKeyphraseExtractionText=function(e,t){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumSummarizeText",sectionName:t,text:e}).done(function(e){if(""!=e){console.log("9");var t=e.split("||splithere||"),i=t[0];i=i.substring(1,i.length),e=t[1];var n=JSON.parse(e);console.log("KEYPHRASES HELP: "+JSON.stringify(n));var o=n.summary.keyPhrases,a=" ",$("#wikiTextInner").html(" Keyphrase Extraction("+i+")  "+a),$("#iconSensiumSummarize").css("background-color","transparent"),$("#iconSensiumEvent").css("background-color","transparent"),$("#iconSensiumKey").css("background-color","white"),$("#iconSensiumEntity").css("background-color","transparent"),r=4}})},a.setURL=function(e){o=e},a.setSensiumText=function(e,t){i=e,n=t},a.setOption=function(e){r=e},a.doRequest=function(e){0!=e&&(r=e),null!=i?1==r?a.sensiumSummarizeText(i,n):2==r?a.sensiumEventExtractionText(i,n):3==r?a.sensiumEntitiyExtractionText(i,n):4==r&&a.sensiumKeyphraseExtractionText(i,n):1==r?a.sensiumSummarize(o):2==r?a.sensiumEventExtraction(o):3==r?a.sensiumEntitiyExtraction(o):4==r&&a.sensiumKeyphraseExtraction(o)},a.sensiumURLRequest=function(e){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumURLRequest",url:e}).done(function(e){var t=JSON.parse(e);$("#sentimentIcon").empty;var i="",n="";t.polarity.score.toFixed(2)<.2&&t.polarity.score.toFixed(2)>-.2?(i="https://upload.wikimedia.org/wikipedia/commons/f/f6/Smileyneu.png",n="neutral"):t.polarity.score.toFixed(2)>=.2?(i="https://upload.wikimedia.org/wikipedia/commons/d/d9/Smileypos.png",n="positive"):(i="https://upload.wikimedia.org/wikipedia/commons/a/ae/Smileyneg.png",n="negative"),$("#firstHeading").prepend(""),$("#sentimentIcon").append("")})},a.sensiumTextRequest=function(e,i){$.post("http://david-strohmaier.com/QAEnewLayout/sensiumRequester.php",{operation:"sensiumTextRequest",sectionName:i,text:e}).done(function(e){if(""!=e){console.log("10");var i=e.split("||splithere||"),n=i[0];n=n.substring(1,n.length),e=i[1];var o=JSON.parse(e),r=0;void 0!=o&&void 0!=o.polarity&&void 0!=o.polarity.score&&(r=o.polarity.score),t.setSentimentScoreOfSection(r.toFixed(2),n)}})},a},DataRetriever=function(e){function t{return console.log(v+" == "+y),v==y&&0!=v&&0!=y?(clearInterval(n),w=!0,r.fillDataNew,void r.retrievingDataDone(".")):6==b?(r.retrievingDataAnimation(b+1),b++,void(b=0)):(r.retrievingDataAnimation(b+1),void b++)}var i,n,o="",r=e.articleRenderer,a="http://en.wikipedia.org/w/api.php?",s=0,l=0,c=new Object,u=[],d=[],g="",h="",p=[],m="",f={},v=0,y=0,w=!1;f.getTitle=function{return o},f.setTitle=function(e){o=e},f.getJSONString=function{return JSON.stringify(c)},f.getAllMeasures=function{c.title=o,x(a+"action=parse&format=json&prop=sections&page="+o,T),x(a+"action=query&prop=images&format=json&imlimit=max&titles="+o+"&continue",E),x(a+"action=query&format=json&prop=extracts&explaintext=&titles="+o+"&continue",O),x(a+"action=query&prop=extlinks&format=json&ellimit=max&titles="+o+"&continue",_),x(a+"action=query&format=json&prop=revisions&rvprop=content&rvlimit=1&titles="+o+"&continue",I),x(a+"action=parse&format=json&contentmodel=wikitext&section=0&page="+o+"&prop=wikitext|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties",S),n=setInterval(t,500)};var b=0;f.getIntro=function{return m},f.getAllSectionContentData=function{return p},f.getSectionContentData=function(e){for(var t=0;t0&&p[t].sections[0].line==e)return p[t];return null},f.getImageArray=function{return u},f.getRawText=function{return g},f.getRawTextWithData=function{return h},f.getSectionInfos=function{return i},f.reloadSection=function(e,t){x(a+"action=query&format=json&prop=extracts&explaintext=&titles="+o+"&continue",O),x(a+"action=parse&format=json&contentmodel=wikitext&generatexml&section="+e+"&page="+o+"&prop=wikitext|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties",t)},f.getAllReferences=function{return d};var x=function(e,t){$.ajax({url:e,jsonp:"callback",dataType:"jsonp",cache:!1,success:t})},S=function(e){m=JSON.parse(JSON.stringify(e)).parse},k=function(e){var t=JSON.parse(JSON.stringify(e));p.push(t.parse),v++},T=function(e){var t=JSON.parse(JSON.stringify(e));if(i=t.parse.sections,i.length>0){y=i.length;for(var n=0;n<i.length;n++)x(a+"action=parse&format=json&contentmodel=wikitext&generatexml&section="+i[n].index+"&page="+o+"&prop=wikitext|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties",k)}},I=function(e){console.log("HANDLE RAW TEXT WITH DATA");var t=JSON.parse(JSON.stringify(e)),i=t.query.pages[Object.keys(t.query.pages)[0]].revisions[0]["*"];h=void 0!=i?i:""},O=function(e){var t=JSON.parse(JSON.stringify(e)),i=t.query.pages[Object.keys(t.query.pages)[0]].extract;g=void 0!=i?i:""},A=function(e){var t=JSON.parse(JSON.stringify(e)),i=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].thumburl,n=t.query.pages[Object.keys(t.query.pages)[0]].title,o=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].size,r=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].user,a=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].timestamp,s=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].comment,l=t.query.pages[Object.keys(t.query.pages)[0]].imageinfo[0].mediatype,c={url:i,imageTitle:n,size:o,user:r,timestamp:a,comment:s,mediatype:l};u.push(c)},E=function(e){var t=JSON.parse(JSON.stringify(e)),i=t.query.pages[Object.keys(t.query.pages)[0]].images;if(void 0!=i){l+=i.length,c.numImages=l;for(var n=0;n<i.length;n++)x(a+"action=query&prop=imageinfo&format=json&iilimit=1&titles="+i[n].title+"&iiprop=url|size|user|timestamp|comment|mediatype&iiurlwidth=500&continue",A);t.hasOwnProperty("continue")?t["continue"].hasOwnProperty("imcontinue")&&x(a+"action=query&prop=images&format=json&imlimit=max&titles="+o+"&imcontinue="+t["continue"].imcontinue+"&continue",E):c.numImages=l}else c.numImages=0},_=function(e){var t=JSON.parse(JSON.stringify(e)),i=t.query.pages[Object.keys(t.query.pages)[0]].extlinks;if(void 0!=i){s+=i.length,c.externalLinks=s;for(var n=0;n-1){for("="!=e[i+n];)n++;for("="==e[i+n];)n++;var o=e.substr(i+n).indexOf("==");return e.substr(0,i+n+o)}return e}function i(e){var t=e.getRawText;index=t.indexOf("==");var i="";return i=index>-1?t.substr(0,index):""}var n,o=e.data,r=e.articleName,a=e.controller,s={};s.showQualityTableOfSection=function(e,i,n){var o="",r="",a=null;a="Introduction"==e?i.getIntro:i.getSectionContentData(e),a.sections.length>1?(r=a.wikitext["*"],r=t(r,a.sections[0].line)):r=a.wikitext["*"];for(var s=n.calculateQuality(r,a,r.length>50?r.substring(0,50)+"...":r.substring(0,10)+"..."),l=Object.keys(s),o=" ",$("#articleViewerQualityTableDiv").html(o)},s.showTheWholeArticleInMainView=function(e,n){console.log("SHOWTHEWHOLE");var o=e.getAllSectionContentData,r=e.getSectionInfos,a=e.getIntro,s="";a.sections.length>1?(s=a.wikitext["*"],s=t(s,a.sections[0].line)):s=a.wikitext["*"];var l=n.calculateQuality(i(e),a,s.length>50?s.substring(0,50)+"...":s.substring(0,10)+"..."),c="";l.score>=0&&l.score<=.5?c="#FF4500":l.score>.5&&l.score<=.8?c="#FFA500":l.score>.8&&(c="#00FF00");for(var u=''+s+" ",u=''+s+" ",d=1,g=0;g1?(s=p.wikitext["*"],s=t(s,p.sections[0].line)):s=p.wikitext["*"];var l=n.calculateQuality(getTextOfSection(p.sections[0].line,e),p,s.length>50?s.substring(0,50)+"...":s.substring(0,10)+"..."),c="";l.score>=0&&l.score<=.5?c="#FF4500":l.score>.5&&l.score<=.8?c="#FFA500":l.score>.8&&(c="#00FF00");var m=p.sections[0].line.replace(/[^\w\s]/gi,""),f=m.replace(/ /g,"_");u+='<div id="'+f+'"contenteditable="true" style="background-color: white; border: 2px solid black; border-left: 5px solid '+c+'" >'+s+" "}}d++}},s.showTheWholeArticle=function(e,i){var n=e.getAllSectionContentData,o=e.getIntro,r="";o.sections.length>1?(r=o.wikitext["*"],r=t(r,o.sections[0].line)):r=o.wikitext["*"];var a=i.calculateQuality(r,o,r.length>50?r.substring(0,50)+"...":r.substring(0,10)+"..."),s="";a.score>=0&&a.score<=.5?s="#FF4500":a.score>.5&&a.score<=.8?s="#FFA500":a.score>.8&&(s="#00FF00");for(var l='<div contenteditable="true" style="background-color: '+s+'; border: 2px solid black" onclick="articleControllerMain.showQualityTable(\'Introduction\')">'+r+" ",c=0;c<n.length;c++){var u=n[c],r="";u.sections.length>1?(r=u.wikitext["*"],r=t(r,u.sections[0].line)):r=u.wikitext["*"];var a=i.calculateQuality(r,u,r.length>50?r.substring(0,50)+"...":r.substring(0,10)+"..."),s="";a.score>=0&&a.score<=.5?s="#FF4500":a.score>.5&&a.score<=.8?s="#FFA500":a.score>.8&&(s="#00FF00"),l+='<div contenteditable="true" style="background-color: '+s+'; border: 2px solid black" onclick="articleControllerMain.showQualityTable(\''+u.sections[0].line+"')\">"+r+" "}$("#articleViewerDiv").html(l),$("#articleViewer").dialog({buttons:[{text:"Save",click:function{$(this).dialog("close")}},{text:"Cancel",click:function{$(this).dialog("close")}}]}),event.preventDefault},s.connectNodes=function(e,t){if(console.log(JSON.stringify(e)),e.from==e.to)alert("NOT POSSIBLE");else{var i=o.nodes.get(e.from),n=o.nodes.get(e.to);"img"==i.type&&"text"==n.type?(n.imagesToThisNode.push(i.imageInfos.imageTitle),o.edges.add({from:i.id,to:n.id,style:"arrow"}),a.showQuality):"ref"==i.type&&"text"==n.type?(n.refsToThisNode.push(i.title),t(e),a.showQuality):alert("NOT POSSIBLE")}};s.editAnimation=function(e){console.log("EDITANIMATION")},s.closeEditDialog=function{},s.addNode=function(e){if(-1!=currentSelectedSectionId){var t=o.nodes.get(currentSelectedSectionId);console.log("ID: "+currentSelectedSectionId+" REST: "+JSON.stringify(t))}};var l=function(e,t,i){var n=a.getDataRetrieverById(t),o=null;if("Introduction"==e);else if(o=n.getSectionContentData(e),alert(o.sections.length),o.sections.length>1)for(var r=1;r<o.sections.length;r++)i+="\n"+n.getSectionContentData(o.sections[r].line).wikitext["*"];return i};return s.editNodes=function(e,t){var i=o.nodes.get(e.id);if("text"==i.type){var c=$("#node-label");c.val(i.originalText);var u=a.getItem(i.masterId);$("#dialog").dialog({buttons:[{text:"Save",click:function{console.log("click: "+i.id);var e=a.getEditToken;console.log("EDITTOKEN: "+e);var t=$("#node-label"),o=t.val;o=l(i.title,i.id,o);var c="http://en.wikipedia.org/w/api.php?action=edit&format=xml";o=o.replaceHtmlEntites,console.log("TEXT: "+o),o=o.replace(/&/g,"and");var d="action=edit&title="+r+"&section="+u.index+"&token="+e+"&text="+o+"&contentformat=text/x-wiki&contentmodel=wikitext";articleControllerMain.editRequest(c,d,i.id),n=setInterval(s.editAnimation(!0),500)}},{text:"Cancel",click:function{$(this).dialog("close")}}]}),event.preventDefault}},s},QualityManager=function(e){function t(e){var t=/\[\^\]\*\]\]/g,i=e.match(t),n=0;return null!=i&&(n=i.length),n}function i(e,t){var i=e.indexOf(t),n=0;if(i>-1){for("="!=e[i+n];)n++;for("="==e[i+n];)n++;var o=e.substr(i+n).indexOf("==");return e.substr(0,i+n+o)}return e}var n=(e.renderer,e.controller),o={},r=function(e){return e=parseFloat(e),e>1?1:0>e?0:e.toFixed(1)};o.reset=function{},o.countRefsOfSection=function(e){if(e+="",subString="<ref",subString+="",subString.length<=0)return e.length+1;for(var t=0,i=0,n=subString.length;;){if(i=e.indexOf(subString,i),!(i>=0))break;t++,i+=n}return t};var a=function(e){for(var t=n.getEquationArray,i={},o=0;o<t.length;o++)if(t[o].isCalculation){console.log("EQUATION FOR CALCULATION: "+t[o].key);var r=t[o].equationBody;console.log("equation: "+r);for(var a in e){var s=new RegExp(a,"g");r=r.replace(s,e[a])}var s=new RegExp("([a-z]|[A-Z])+","g");r=r.replace(s,1),console.log(r);var l=math.eval(r);l>1&&(l=1);var c=t[o].key;i[c]=l,console.log("equation: "+r+" EQUATION FOR CALCULATION RESULT: "+c+" : "+l)}return i};return o.calculateQuality=function(e,s,l,c){console.log("calculateQuality: ");var u={},d=n.getSensiumRequester,g=e.replace(/[\x00-\x1F\x7F-\x9F]/g,"");g=g.toString.replace(/"/g,'\\"');var h=l;d.sensiumTextRequest(g,h);var p=new textstatistics(e),m=0,f=0;""!=e&&void 0!=e&&(m=p.fleschKincaidReadingEase,f=p.fleschKincaidGradeLevel),console.log("12");var v=m*e.split(" ").length,y=r(v/good_fleschWordCount),w=(r(m/good_flesch),r(f/good_kinkaid)),b="";s.sections.length>1?(b=s.wikitext["*"],b=i(b,s.sections[0].line)):b=s.wikitext["*"];var x=o.countRefsOfSection(b);if(void 0!=s){var S=s.images.length,k=s.externallinks.length+x,T=(s.iwlinks.length,t(b)),I=r(S/good_numPics),O=r(k/good_extLinks),A=r(T/good_allLinks);y=parseFloat(r(parseFloat(y)*parseFloat(weightFlesch))),w=parseFloat(r(parseFloat(w)*parseFloat(weightKincaid))),I=parseFloat(r(parseFloat(I)*parseFloat(weightImageQuality))),O=parseFloat(r(parseFloat(O)*parseFloat(weightExternalRefs))),A=parseFloat(r(parseFloat(A)*parseFloat(weightAllLinks))),qualityMeasures=new Object,qualityMeasures.flesch=y,qualityMeasures.kincaid=w,qualityMeasures.numImages=I,qualityMeasures.externalLinks=O,qualityMeasures.internalLinks=A;var E=a(qualityMeasures),_=parseFloat(parseFloat(y)+parseFloat(w)+parseFloat(I)+parseFloat(O)+parseFloat(A));cnt=5;for(var R in E)_+=E[R],u[R]=E[R],cnt++;var L=_/cnt;u.qualityFleschWordCount=y,u.qualityKincaid=w,u.qualityImages=I,u.qualityExternalRefs=O,u.qualityAllLinks=A,u.score=L;var F=$("#cssmenu span").filter(function{return $(this).attr("name")===h}),C=$("#toc span").filter(function{return $(this).html===h}),D=$(".mw-headline").filter(function{return $(this).html===h});console.log("sectionName: "+h+" "+e.length);var q=e.length/6e3;return q>1&&(q=1),q*=100,10>q&&(q=10),L>=0&&.5-overallScoreInterval>=L?(F.css("border-radius","18px"),F.css("border-left",q+"px solid  #FF4500"),F.css("padding-left","10px "),C.css("border-radius","18px"),C.css("border-left",q+"px solid  #FF4500"),C.css("padding-left","10px "),D.css("border-radius","18px"),D.css("border-left",q+"px solid  #FF4500"),D.css("padding-left","10px ")):L>.5-overallScoreInterval&&.8-overallScoreInterval>=L?(F.css("border-radius","18px"),F.css("border-left",q+"px solid #FFA500"),F.css("padding-left","10px "),C.css("border-radius","18px"),C.css("border-left",q+"px solid #FFA500"),C.css("padding-left","10px "),D.css("border-radius","18px"),D.css("border-left",q+"px solid #FFA500"),D.css("padding-left","10px ")):L>.8-overallScoreInterval&&(F.css("border-radius","18px"),F.css("border-left",q+"px solid #00FF00"),F.css("padding-left","10px "),C.css("border-radius","18px"),C.css("border-left",q+"px solid #00FF00"),C.css("padding-left","10px "),D.css("border-radius","18px"),D.css("border-left",q+"px solid #00FF00"),D.css("padding-left","10px ")),u}return console.log("properties are undefined : "),0},o.calculateQualityRev=function(e,s,l,c){console.log("calculateQualityREV: ");var u={},d=n.getSensiumRequester,g=e.replace(/[\x00-\x1F\x7F-\x9F]/g,"");g=g.toString.replace(/"/g,'\\"');var h=l;d.sensiumTextRequest(g,h);var p=new textstatistics(e),m=0,f=0;""!=e&&void 0!=e&&(m=p.fleschKincaidReadingEase,f=p.fleschKincaidGradeLevel),console.log("13");var v=m*e.split(" ").length,y=r(v/good_fleschWordCount),w=(r(m/good_flesch),r(f/good_kinkaid)),b="";s.sections.length>1?(b=s.wikitext["*"],b=i(b,s.sections[0].line)):b=s.wikitext["*"];var x=o.countRefsOfSection(b);if(void 0!=s){var S=s.images.length,k=s.externallinks.length+x,T=(s.iwlinks.length,t(b)),I=r(S/good_numPics),O=r(k/good_extLinks),A=r(T/good_allLinks);y=parseFloat(r(parseFloat(y)*parseFloat(weightFlesch))),w=parseFloat(r(parseFloat(w)*parseFloat(weightKincaid))),I=parseFloat(r(parseFloat(I)*parseFloat(weightImageQuality))),O=parseFloat(r(parseFloat(O)*parseFloat(weightExternalRefs))),A=parseFloat(r(parseFloat(A)*parseFloat(weightAllLinks))),qualityMeasures=new Object,qualityMeasures.flesch=y,qualityMeasures.kincaid=w,qualityMeasures.numImages=I,qualityMeasures.externalLinks=O,qualityMeasures.internalLinks=A;var E=a(qualityMeasures),_=parseFloat(parseFloat(y)+parseFloat(w)+parseFloat(I)+parseFloat(O)+parseFloat(A));cnt=5;for(var R in E)_+=E[R],u[R]=E[R],cnt++;var L=_/cnt;u.qualityFleschWordCount=y,u.qualityKincaid=w,u.qualityImages=I,u.qualityExternalRefs=O,u.qualityAllLinks=A,u.score=L;var F=$("#cssmenuRev span").filter(function{return $(this).attr("name")===h});console.log("sectionName: "+h+" "+e.length);var C=e.length/6e3;return C>1&&(C=1),C*=100,10>C&&(C=10),L>=0&&.5-overallScoreInterval>=L?(F.css("border-radius","18px"),F.css("border-left",C+"px solid  #FF4500"),F.css("padding-left","10px ")):L>.5-overallScoreInterval&&.8-overallScoreInterval>=L?(F.css("border-radius","18px"),F.css("border-left",C+"px solid #FFA500"),F.css("padding-left","10px ")):L>.8-overallScoreInterval&&(F.css("border-radius","18px"),F.css("border-left",C+"px solid #00FF00"),F.css("padding-left","10px ")),u}return console.log("properties are undefined : "),0},o},ArticleLogic=function(e){function t{var e=m.getRawText;index=e.indexOf("==");var t="";return t=index>-1?e.substr(0,index):""}var i=0,n=9999,o=e.data,r=e.articleName,a=e.controller,s=0,l=0,c=new QualityFlawManager,u=new DataSet,d=!1,g=0,h={},p=new QualityManager({renderer:h,controller:a}),m=null;console.log("14"),m=r.split("oldid=").length>1?new DataRetrieverRevision({articleRenderer:h}):new DataRetriever({articleRenderer:h}),h.getDataRetriever=function{return m},h.getDataRetrieverById=function(e){return S(e)?m:!1},h.getQualityManager=function{return p},h.cleanUp=function{for(var e=o.nodes.get,t=0;t<e.length;t++){var i=e[t];S(i.id)&&o.nodes.remove(i.id)}},h.getIdCounter=function{return g},h.setIdCounter=function(e){g=e},h.retrieveData=function{m.setTitle(r),m.getAllMeasures},h.copy=function{for(var e=o.nodes.get,t=0;t<e.length;t++){var i=e[t];o.nodes.add({id:g,title:i.title,label:i.label,image:i.image,shape:i.shape,allowedToMoveX:i.allowedToMoveX,allowedToMoveY:i.allowedToMoveY,type:i.type,wikiLevel:i.wikiLevel,masterId:i.masterId}),g++}},h.updateSection=function(e){if(S(e)){var t=o.nodes.get(e);m.reloadSection(t.index,h.CBupdateSection)}},h.CBupdateSection=function(e){var i=JSON.parse(JSON.stringify(e));console.log("CBupdateSection object : "+JSON.stringify(i));var n=o.nodes.get;if(0==i.parse.sections.length)for(var r=0;r<n.length;r++){var a=n[r];if("Introduction"==a.title){var s="";s=i.parse.wikitext["*"];var l=s,c=t,u=s;u=repalceNewLineWithTwoNewLines(u,"\n","\n\n",1),u=replaceCharacterWithAnother(u," ","\n",10);var c=t;o.nodes.update({id:a.id,title:"Introduction",label:u,originalText:l,rawText:c,quality:0,sectionInfos:i.parse,imagesToThisNode:i.parse.images,refsToThisNode:i.parse.externallinks})}}else for(var r=0;r<n.length;r++){var a=n[r];if("text"==a.type&&a.sectionInfos.sections.length>0&&a.sectionInfos.sections[0].line==i.parse.sections[0].line){var s="";i.parse.sections.length>1?(s=i.parse.wikitext["*"],s=trimToOneParagraph(s,i.parse.sections[0].line)):s=i.parse.wikitext["*"];var l=s,c=getTextOfSection(i.parse.sections[0].line,m);""!=s&&s.length>10&&(s=replaceCharacterWithAnother(s," ","\n",10),o.nodes.update({id:a.id,title:i.parse.sections[0].line,label:s,originalText:l,rawText:c,quality:0,sectionInfos:i.parse,imagesToThisNode:i.parse.images,refsToThisNode:i.parse.externallinks}))}}h.showQuality},h.doRedraw=function{};var f=function(e){return"References"==e||"See also"==e||"Notes"==e||"Sources"==e||"Further reading"==e||"External links"==e||"Footnotes"==e||"Secondary sources"==e?!1:!0},v="",y=function(e,t,i){var n=0,o=m.getSectionInfos;if(0==t){$("#cssmenu").empty;for(var r="",a=0;a<m.getIntro.images.length;a++)r+=m.getIntro.images[a]+"!split!";console.log("SECTIONNAME: Introduction IMAGES TO SECTION :  "+r),v+="<ul><li images='"+r+"' name='Introduction' ><a href='#'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 10px; vertical-alignment: middle;' onclick=\"articleControllerMain.highlightSectionInTree('Introduction')\" />Introduction </a></li></ul>"}for(var s=!0,l=t;l<o.length;l++){var c=m.getSectionContentData(o[l].line);n=o[l].toclevel;for(var r="",a=0;a<c.images.length;a++)r+=c.images[a]+"!split!";if(console.log("SECTIONNAME: "+o[l].line+"IMAGES TO SECTION :  "+r),n==e)s?(v+=l+1<o.length?o[l+1].toclevel==o[l].level?"<ul><li images='"+r+"' name='"+o[l].line+"' class='has-sub'><a href='#'><span name='"+o[l].line+"'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 10px; vertical-alignment: middle;' onclick=\"articleControllerMain.highlightSectionInTree('"+o[l].line+"')\" />"+o[l].number+" "+o[l].line+" </a>":"<ul><li images='"+r+"' name='"+o[l].line+"'><a href='#'><span name='"+o[l].line+"'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 7px; vertical-alignment: middle;' onclick=\"articleControllerMain.highlightSectionInTree('"+o[l].line+"')\"  />"+o[l].number+" "+o[l].line+" </a>":"<ul><li images='"+r+"' name='"+o[l].line+"'><a href='#'><span name='"+o[l].line+"'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 7px; vertical-alignment: middle;' onclick=\"articleControllerMain.highlightSectionInTree('"+o[l].line+"')\" />"+o[l].number+" "+o[l].line+" </a>",s=!1):v+=l+1<o.length&&o[l+1].toclevel==o[l].level?"</li><li images='"+r+"' name='"+o[l].line+"' class='has-sub'><a href='#'><span name='"+o[l].line+"'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 7px; vertical-alignment: middle;'  onclick=\"articleControllerMain.highlightSectionInTree('"+o[l].line+"')\" />"+o[l].number+" "+o[l].line+" </a>":"</li><li images='"+r+"' name='"+o[l].line+"'><a href='#'><span name='"+o[l].line+"'> <img src='http://tools.wmflabs.org/quality-assisted-editor/media/assessing.png' style='padding-right: 7px; vertical-alignment: middle;' onclick=\"articleControllerMain.highlightSectionInTree('"+o[l].line+"')\" />"+o[l].number+" "+o[l].line+" </a>";else if(o[l].toclevel==o[l-1].level&&(l=y(o[l].toclevel,l,!1)), 1!=e)return v+="</li></ul>",l-1}console.log("</li></ul>"),v+="</li></ul>",$("#cssmenu").append(v),console.log("FINALLY: "+v),prepareTableOfContent(h),prepareTableOfContentToc(h)};h.fillDataNew=function{v="",y(1,0,!0),c.getQualityFlaws(m.getRawTextWithData),h.cleanUp;var e=m.getIntro,i=m.getTitle,n=m.getSectionInfos,r=0,a=0,u=0,d=[],p=[];$("#ediotr_section_selector").find("option").remove,$("#ediotr_section_selector").append($(" ",{value:"Select a section",text:"Select a section"})),$("#ediotr_section_selector").append($(" ",{value:"Introduction",text:"Introduction"}));for(var w=0;w<n.length;w++)$("#ediotr_section_selector").append($(" ",{value:n[w].line,text:n[w].line}));for(var w=0;w<n.length;w++){u=parseInt(n[w].level);for(var b=-1,x=0;x<d.length;x++)d[x].level==n[w].toclevel&&(b=d[x].id);if(u==a){for(var k=0,x=0;x<p.length;x++)p[x].level==u&&(_=!0,p[x].sectionsInSameLevel+=1,k=p[x].sectionsInSameLevel);o.nodes.add({id:g,title:n[w].line,label:n[w].line,index:n[w].index,value:1,allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:u,masterId:b,sectionInfos:m.getSectionContentData(n[w].line),allowedToMoveX:!0,allowedToMoveY:!0,type:"section"}),r=g,g++;var T=m.getSectionContentData(n[w].line);if(null!=T){var I="";T.sections.length>1?(I=T.wikitext["*"],I=trimToOneParagraph(I,n[w].line)):I=T.wikitext["*"];var O=I,A=getTextOfSection(n[w].line,m);if(""!=I&&I.length>10){console.log("15");var E=I.split(" ").length;I=replaceCharacterWithAnother(I," ","\n",10),o.nodes.add({id:g,title:n[w].line,label:I,originalText:O,index:n[w].index,value:E,shape:"box",allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:u,masterId:r,type:"text",useForQualityCalculation:f(n[w].line),quality:0,rawText:A,sectionInfos:m.getSectionContentData(n[w].line),imagesToThisNode:T.images,refsToThisNode:T.externallinks}),o.edges.add({from:r,to:g,style:"arrow"}),g++}}}else{a=u;for(var _=!1,k=0,x=0;x<p.length;x++)p[x].level==u&&(_=!0,p[x].sectionsInSameLevel+=1,k=p[x].sectionsInSameLevel);_||p.push({level:u,sectionsInSameLevel:0}),o.nodes.add({id:g,title:n[w].line,label:n[w].line,index:n[w].index,value:1,allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:u,masterId:b,sectionInfos:m.getSectionContentData(n[w].line),type:"section"}),r=g,g++;var T=m.getSectionContentData(n[w].line);if(null!=T){var I="";T.sections.length>1?(I=T.wikitext["*"],I=trimToOneParagraph(I,n[w].line)):I=T.wikitext["*"];var A=getTextOfSection(n[w].line,m),O=I;if(""!=I&&I.length>10){console.log("16");var E=I.split(" ").length;I=replaceCharacterWithAnother(I," ","\n",10),o.nodes.add({id:g,title:n[w].line,label:I,originalText:O,index:n[w].index,shape:"box",value:E,allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:u,masterId:r,type:"text",useForQualityCalculation:f(n[w].line),quality:0,rawText:A,sectionInfos:m.getSectionContentData(n[w].line),imagesToThisNode:T.images,refsToThisNode:T.externallinks}),o.edges.add({from:r,to:g,style:"arrow"}),g++}}}for(var x=0;x<d.length;x++)d[x].level==u&&d.splice(x,1);d.push({id:r,toclevel:n[w].toclevel,level:u}),0!=r&&-1!=b&&o.edges.add({from:b,to:r,style:"arrow"})}o.nodes.add({id:g,title:i,label:i,index:0,value:1,allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:0,masterId:-1,type:"section"}),s=g,g++;var R=e.wikitext["*"],O=R;R=repalceNewLineWithTwoNewLines(R,"\n","\n\n",1),R=replaceCharacterWithAnother(R," ","\n",10);var A=t;o.nodes.add({id:g,title:"Introduction",shape:"box",label:R,originalText:O,value:1,index:0,allowedToMoveX:!0,allowedToMoveY:!0,wikiLevel:1,masterId:g-1,type:"text",useForQualityCalculation:!0,quality:0,sectionInfos:m.getIntro,imagesToThisNode:m.getIntro.images,refsToThisNode:m.getIntro.externallinks,rawText:A}),l=g;for(var L=o.nodes.get,w=0;w<L.length;w++){var F=L[w];2==F.wikiLevel&&S(F.id)&&"section"==F.type&&(o.nodes.update({id:F.id,masterId:g-1}),o.edges.add({from:g-1,to:F.id,style:"arrow"}))}g++,o.edges.add({from:g-2,to:g-1,style:"arrow"})},h.retrievingDataAnimation=function(e){$("#workingAnimation").html(e)},h.retrievingDataDone=function(e){$("#workingAnimation").html(""+e+""),a.closeEditDialog,h.showQuality;var t=o.nodes.get;console.log("BEFORE FOR "+t.length);for(var i=0;i<t.length;i++){var n=t[i];if(console.log("IN FOR "+i),"text"==n.type&&S(n.id)){console.log("IN FOR TEXT"+i);for(var e=n.label,r=n.title,s=Object.keys(n.allQulityParameters),l=" ",l+=" $('#checkboxTextQualityTable').mousedown(function {if (!$(this).is(':checked')) { articleController.changeValueOfCheckbox($(this).val, true);} else{articleControllerMain.changeValueOfCheckbox($(this).val, false); }}); ";var d=$(".mw-headline").filter(function{return console.log("COMAPRISSON: "+$(this).html+" === "+r),$(this).html===r?$(this):void 0});d.parent.append(l)}}},h.changeValueOfCheckbox=function(e,t){S(e)&&(console.log("changeValueOfCheckbox : "+e+" "+t),o.nodes.update({id:e,useForQualityCalculation:t}),h.showQuality)},h.getItem=function(e){if(!S)return!1;var t=o.nodes.get(e);return null==t&&(t=h.getItemFromBackup(e)),t},h.getItemFromBackup=function(e){return u.get(e)},h.highlightSectionInTree=function(e,t){t="undefined"!=typeof t?t:!1,console.log("highlightSectionInTree: "+e+" "+t);for(var i=o.nodes.get,n=0;n<i.length;n++){var r=i[n];if("text"==r.type&&S(r.id)&&r.title.replace(/["']/g,"")==e){console.log("articleRenderer.highlightSectionInTree in if");var a={},s=[];s.push(r.id),a.nodes=s,h.onSelect(a,t),console.log("on select done!");break}}};var w=!1;h.checkSensium=function(e){for(var t=o.nodes.get,i=a.getShowSensium,n=0;n<t.length;n++){var r=t[n];if("text"==r.type&&S(r.id)&&r.title.replace(/["']/g,"")==e&&i){var s=a.getSensiumRequester,l=r.rawText,c=l.replace(/[\x00-\x1F\x7F-\x9F]/g,"");c=c.toString.replace(/"/g,'\\"'),s.setSensiumText(c,r.title),s.doRequest(0)}}},h.onSelect=function(e,t){t="undefined"!=typeof t?t:!0,x,currentSelectedSectionIndex=-1,currentSelectedSectionId=-1;var i=a.getShowSensium;if(console.log("show Sensium2 : "+i),1==e.nodes.length){var n=o.nodes.get(e.nodes[0]);if(console.log("ON SELECT2 "+n),GLOBAL_logger.log("onSelect: "+n.title),w=!0,"section"!=n.type&&"text"!=n.type||!isAddNodeMode||(currentSelectedSectionIndex=n.index,currentSelectedSectionId=n.id,"Introduction"==n.title?alert("This operation is not allowed!"):a.addNode),"text"==n.type){if(console.log("show Sensium : "+i),i){var r=a.getSensiumRequester,s=n.rawText;console.log("SHOWSENSIUM TEXT: "+s);var l=s.replace(/[\x00-\x1F\x7F-\x9F]/g,"");l=l.toString.replace(/"/g,'\\"'),r.setSensiumText(l,n.title),r.doRequest(0)}if(t){if(GLOBAL_wikiPageActive){$("#wikiTextInner").children.remove;var c=n.title,u=c.replace(/ /g,"_");console.log('<iframe src="https://'+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+"#"+u+'" style="width: 100%; height: 100%"> '),$("#wikiTextInner").append('<iframe src="https://'+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+"#"+u+'" style="width: 100%; height: 100%"> ')}$("#editor_section_name").html(n.title),$("#wikiTextInner").scrollTop(0),$("#ediotr_section_selector").val(n.title);var g=n.title.replace(/[^\w\s]/gi,""),h=g.replace(/ /g,"_"),p="#"+h;articleControllerMain.getShowWiki||void 0==$(p).offset||$("#wikiTextInner").animate({scrollTop:$(p).offset.top-300},"slow")}currentSelectedSectionIndex=n.index,currentSelectedSectionId=n.id;var s=n.label;if($("#editor").html(s),d){for(var f=Object.keys(n.allQulityParameters),v=" ",v+=" 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											$('#checkboxTextQualityTable').mousedown(function  { 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											if (!$(this).is(':checked')) { 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																												articleControllerMain.changeValueOfCheckbox($(this).val, true); 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											} 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											else{																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																												articleControllerMain.changeValueOfCheckbox($(this).val, false); 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																											} 																																																																																																																																																																																																																																																																																																																																																																																																																																																																																																										}); ",$("#qualityParameters").html(v);var c=n.title,k="";$("#cssmenu li").filter(function{$(this).attr("name")===c&&(k=$(this).attr("images"))}),console.log("imagesToSection : "+k),console.log("17");for(var T=k.split("!split!"),I=m.getImageArray,O="  ",console.log("SECTION NAME: "+c);var _=$("#cssmenu li").filter(function{return $(this).attr("name")===c});console.log("HERE: "+_.has("table").length),_.has("table").length>0?(_.find("table").remove,_.find("script").remove):_.has("ul").length>0?($(v).insertBefore(_.find("ul")),$(O).insertBefore(_.find("ul"))):(_.append(v),_.append(O))}}else if("img"==n.type){for(var f=Object.keys(n.imageInfos),v=" ",$("#qualityParameters").html(v)}else if("section"==n.type){var v=" ",$("#qualityParameters").html(v)}}},h.setSentimentScoreOfSection=function(e,t){for(var i=o.nodes.get,n=0;n<i.length;n++){var r=i[n];S(r.id)&&"text"==r.type&&r.title==e&&o.nodes.update({id:r.id,sentimentScore:t})}},h.showQuality=function{d=!0;for(var e=o.nodes.get,t=0,i=0,n={},a=0;a<e.length;a++){var s=e[a];if(S(s.id)&&"text"==s.type){var l=p.calculateQuality(s.rawText,s.sectionInfos,s.title);if(s.useForQualityCalculation){t++;for(var c in l)c in n?n[c]+=l[c]:n[c]=l[c]}o.nodes.update({id:s.id,quality:l.score,allQulityParameters:l})}}var u=" ",i=i.toFixed(2);var h=$("#firstHeading"),m=n.score;console.log("SCORE: "+m);Math.round(100*m);m>=0&&.5>=m?h.css("color"," #FF4500"):m>.5&&.8>=m?h.css("color","#FFA500"):m>.8&&h.css("color","#00FF00"),$("#bodyContent").prepend(u);for(var a=0;a<e.length;a++){var s=e[a];if(S(s.id)&&"section"==s.type){var f={score:0,numTextElements:0},v=b(s.id,f),y=0;0!=v.numTextElements&&(y=parseFloat(v.score/v.numTextElements).toFixed(2)),o.nodes.update({id:s.id,quality:y}),s.title==r&&($("#progressBarOverallScore").val(parseFloat(v.score/v.numTextElements*100).toFixed(2)),$("#overallScore").html("Quality score of this article: "+parseFloat(v.score/v.numTextElements).toFixed(2)))}}x};var b=function(e,t){for(var i=o.nodes.get,n=0;n<i.length;n++){var r=i[n];r.masterId==e&&S(r.id)&&("text"==r.type&&r.useForQualityCalculation&&(t.score+=r.quality,t.numTextElements++),t=b(r.id,t))}return t},x=function{for(var e=o.nodes.get,t=0;t<e.length;t++){var i=e[t];S(i.id)&&(i.quality>=0&&i.quality<=.5-overallScoreInterval?o.nodes.update({id:i.id,color:{background:"#FF4500",border:"#2B7CE9",highlight:{background:"#D2E5FF",border:"#2B7CE9"}}}):i.quality>.5-overallScoreInterval&&i.quality<=.8-overallScoreInterval?o.nodes.update({id:i.id,color:{background:"#FFA500",border:"#2B7CE9",highlight:{background:"#D2E5FF",border:"#2B7CE9"}}}):i.quality>.8-overallScoreInterval&&o.nodes.update({id:i.id,color:{background:"#00FF00",border:"#2B7CE9",highlight:{background:"#D2E5FF",border:"#2B7CE9"}}}))}};h.saveWholeArticle=function{var e="http://"+GLOBAL_wikiLanguage+".wikipedia.org/w/api.php?action=edit&format=xml",t="";$("#wikiTextInner").children.each(function{t+="\n"+$(this).html}),t=t.replaceHtmlEntites,t=t.replace(/&/g,"and");var i="action=edit&title="+r+"&token="+articleControllerMain.getEditToken+"&text="+t+"&contentformat=text/x-wiki&contentmodel=wikitext";a.uploadWholeArticle(e,i)},h.reset=function{p.reset,articleRendererSemanticZooming.reset,cleanUp};var S=function(e){return e>=i&&n>=e?!0:!1};return h.getTitle=function{return r},h},ArticleController=function(e){var t,i=null,n=null,o=null,r=null,a=[],s=!1,l=!0,c=[],u="",d="",g="",h="",p="",m=!1,f=!1,v=null,y=null,w={},b=null;w.setEditingEnable=function(e){l=e},w.retrieveData=function{w.reset;var e=null;e=$("#firstHeading").html,b=new SensiumRequester({controller:w}),b.sensiumURLRequest("https://"+GLOBAL_wikiLanguage+".wikipedia.org/w/index.php?title="+e);var i=new ArticleLogic({data:o,articleName:e,controller:w});t=new DataManipulator({data:o,articleName:e,controller:w}),c.push(i),i.retrieveData,$("#wikiTextInner").children.remove,$("#wikiTextInner").append("<iframe id='wikiIframe' src=\"https://"+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+'" style="width: 100%; height: 100%"> '),console.log("toggle on"),articleControllerMain.showWikiPage(!0)},w.fillDataNew=function{for(var e=$("#firstHeading").val,t=0;t<c.length;t++)c[t].getTitle==e&&c[t].fillDataNew},w.getSensiumRequester=function{return b},w.showAllItems=function{for(var e=0;e<c.length;e++)c[e].showAllItems},w.colorLevels=function{for(var e=0;e<c.length;e++)c[e].colorLevels},w.splitSectionsIntoParagraphs=function{for(var e=0;e<c.length;e++)c[e].splitSectionsIntoParagraphs},w.combineParagaphsToSections=function{for(var e=0;e<c.length;e++)c[e].combineParagaphsToSections},w.showReferences=function{GLOBAL_logger.log("showReferences"),"ca-icon"==$("#showReferences a span").attr("class")?($("#showReferences a span").attr("class","ca-icon-selected"),$("#showReferences a div h2").attr("class","ca-main-selected"),$("#showReferences").css("background-color","#000")):($("#showReferences a span").attr("class","ca-icon"),$("#showReferences a div h2").attr("class","ca-main"),$("#showReferences").css("background-color","grey")),p?"menuHelper2"==$("#showAllRefsTdRev").attr("class")?$("#showAllRefsTdRev").attr("class","menuHelper3"):$("#showAllRefsTdRev").attr("class","menuHelper2"):"menuHelper2"==$("#showAllRefsTd").attr("class")?$("#showAllRefsTd").attr("class","menuHelper3"):$("#showAllRefsTd").attr("class","menuHelper2");for(var e=0;e<c.length;e++)c[e].showReferences},w.hideReferences=function{"ca-icon"==$("#showReferences a span").attr("class")?($("#showReferences a span").attr("class","ca-icon-selected"),$("#showReferences a div h2").attr("class","ca-main-selected"),$("#showReferences").css("background-color","#000")):($("#showReferences a span").attr("class","ca-icon"),$("#showReferences a div h2").attr("class","ca-main"),$("#showReferences").css("background-color","grey"));for(var e=0;e<c.length;e++)c[e].hideReferences},w.showImages=function{GLOBAL_logger.log("showImages"),"ca-icon"==$("#showImages a span").attr("class")?($("#showImages a span").attr("class","ca-icon-selected"),$("#showImages a div h2").attr("class","ca-main-selected"),$("#showImages").css("background-color","#000")):($("#showImages a span").attr("class","ca-icon"),$("#showImages a div h2").attr("class","ca-main"),$("#showImages").css("background-color","grey")),p?"menuHelper2"==$("#showAllImagesTdRev").attr("class")?$("#showAllImagesTdRev").attr("class","menuHelper3"):$("#showAllImagesTdRev").attr("class","menuHelper2"):"menuHelper2"==$("#showAllImagesTd").attr("class")?$("#showAllImagesTd").attr("class","menuHelper3"):$("#showAllImagesTd").attr("class","menuHelper2");for(var e=0;e<c.length;e++)c[e].showImages},w.hideImages=function{for(var e=0;e<c.length;e++)c[e].hideImages},w.posImages=function{for(var e=0;e<c.length;e++)c[e].posImages},w.copy=function{for(var e=0;e<c.length;e++)c[e].copy},w.doRedraw=function{GLOBAL_logger.log("doRedraw");for(var e=0;e<c.length;e++)c[e].doRedraw},w.semanticZooming=function{GLOBAL_logger.log("semanticZooming"),p?"menuHelper2"==$("#semTdRev").attr("class")?$("#semTdRev").attr("class","menuHelper3"):$("#semTdRev").attr("class","menuHelper2"):"menuHelper2"==$("#semTd").attr("class")?$("#semTd").attr("class","menuHelper3"):$("#semTd").attr("class","menuHelper2");for(var e=0;e<c.length;e++)c[e].semanticZooming},w.showOverview=function{GLOBAL_logger.log("showOverview");for(var e=0;e<c.length;e++)c[e].showOverview},w.rotateTree=function{GLOBAL_logger.log("rotateTree");for(var e=0;e<c.length;e++)c[e].rotateTree},w.showQuality=function{for(var e=0;e<c.length;e++)c[e].showQuality},w.reset=function{c.splice(0,c.length),$("#cssmenu").empty,$("#cssmenuRev").empty,w.init(h),$("#qualityParameters").html(""),$("#overallScore").html("Quality score of the article:"),$("#sensiumOverallScore").html("Sensium score:"),$("#wikiTextInner").children.remove,$("#progressBarOverallScore").attr("value","0"),$("#progressBarSensiumOverallScoreController").css("right",200),$("#qualityFlawViewText").html(""),$("#ediotr_section_selector").find("option").remove},w.resetRevision=function{c.splice(0,c.length),w.init(h),$("#qualityParametersRev").html(""),$("#overallScoreRev").html("Quality score of the article:"),$("#sensiumOverallScoreRev").html("Sensium score:"),$("#progressBarOverallScoreRev").attr("value","0"),$("#progressBarSensiumOverallScoreControllerRev").css("right",200)},w.showTheWholeArticle=function{t.showTheWholeArticle(c[0].getDataRetriever,c[0].getQualityManager)},w.highlightSectionInTreeWithScrolling=function(e){for(var t=0;t<c.length;t++)c[t].highlightSectionInTree(e,!0)},w.highlightSectionInTree=function(e){if(!t)var t=window.event;t.cancelBubble=!0,console.log("STOP PROPATATION2"),t.stopPropagation&&(t.stopPropagation,console.log("STOP PROPATATION")),console.log("highlightSectionInTree "+GLOBAL_wikiPageActive),$("#editor_section_name").html(e),$("#ediotr_section_selector option").filter(function{return $(this).text===e}).prop("selected",!0);for(var i=0;i<c.length;i++)c[i].highlightSectionInTree(e)},w.showQualityTable=function(e){t.showQualityTableOfSection(e,c[0].getDataRetriever,c[0].getQualityManager)},w.showTheWholeArticleInMainView=function{void 0!=t&&t.showTheWholeArticleInMainView(c[0].getDataRetriever,c[0].getQualityManager)},w.resizeSections=function{for(var e=0;e<c.length;e++)c[e].resizeSections},w.login=function{r=new PhpConnector({controller:w}),$("#dialogLogin").dialog({buttons:[{text:"Login",click:function{g=$("#loginUsername").val,r.login($("#loginUsername").val,$("#loginPassword").val)}},{text:"Cancel",click:function{$(this).dialog("close")}}]}),$("#dialogLogin").dialog("open")},w.setUserToken=function(e){s=!0,d=e,console.log("USER TOKEN: "+d),$("#dialogLogin").dialog("close"),console.log("LOGIN NAME2: "+g),$("#loginSUB").html(g),$("#liLogin .ca-icon").css("color","#ccff00"),$("#liLogin .ca-content").css("color","#ccff00"),$("#liLogin .ca-content .ca-main").css("color","#ccff00"),$("#liLogin .ca-content .ca-sub").css("color","#ccff00"),r.getEditToken},w.setEditToken=function(e){u=e,u=u.replace("+\\","%2B%5C"),console.log("EDIT TOKEN: "+u)},w.getUserToken=function{return d},w.getEditToken=function{return u},w.newSection=function(e,t){s?r.createRequest(e,t,w.newSectionCreated):alert("U r not logged in!!!")},w.newImage=function(e,t){s?r.createRequest(e,t,w.newImageCreated):alert("U r not logged in!!!")},w.editRequest=function(e,t,i){s?r.editRequest(e,t,i,w.updateSection):alert("U r not logged in!!!")},w.uploadWholeArticle=function(e,t){s?($("#dialogEditInProgres").dialog("open"),r.updateWholeArticle(e,t,w.reload)):alert("U r not logged in!!!")},w.updateSection=function(e){for(var i=0;i<c.length;i++)c[i].updateSection(e);t.editAnimation(!1)},w.reload=function(e){w.reset,w.retrieveData},w.newImageCreated=function(e){console.log("NEW Image CREATED"),w.reset,w.retrieveData},w.newSectionCreated=function(e){console.log("NEW SECTION CREATED"),w.reset,w.retrieveData},w.changeValueOfCheckbox=function(e,t){for(var i=0;i<c.length;i++)c[i].changeValueOfCheckbox(e,t)},w.getItem=function(e){for(var t=0;t<c.length;t++){var i=c[t].getItem(e);if(0!=i)return i}return null},w.addNode=function{t.addNode(o)},w.getDataRetrieverById=function(e){for(var t=0;t<c.length;t++){var i=c[t].getDataRetrieverById(e);if(0!=i)return i}},w.closeEditDialog=function{t.closeEditDialog},w.goToSection=function(e,t){if(GLOBAL_logger.log("goToSection: "+e+" Tag: "+t),GLOBAL_wikiPageActive){var i=e.replace(/ /g,"_");$("#wikiIframe").attr("src","https://"+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+"#"+i)}$(".highlight").contents.unwrap,$("#wikiTextInner *").highlight(t,"highlight");for(var n=0;n<c.length;n++)c[0].highlightSectionInTree(e,!0)},w.setSentimentScoreOfSection=function(e,t){for(var i=0;i<c.length;i++)c[i].setSentimentScoreOfSection(t,e)},w.saveWholeArticle=function{console.log("saveWholeArticle"),c[0].saveWholeArticle};var x="";return w.compareRevisions=function{$("#cssmenuRev").empty,GLOBAL_compare=!GLOBAL_compare,GLOBAL_compare?$("#tableOfContentRev").css("display","inline-block"):$("#tableOfContentRev").css("display","none"),$(window).trigger("resize");var e=$("#firstHeading").val;console.log("19"),e.split("&oldid=").length>1&&(e=e.split("&oldid=")[0]),x=e,w.resetRevision,dataRetriever=new DataRetrieverRevision({articleRenderer:w}),dataRetriever.loadArticleRevIDs(e)},w.setRevisions=function(e){console.log("IN setRevisions: "+e.length),$("#compare_Selector").empty;for(var t=0;t<e.length;t++)$("#compare_Selector").append($(" ",{value:x+"&oldid="+e[t],text:x+"&oldid="+e[t]}))},w.addOneRevision=function(e){$("#compare_Selector").append($(" ",{value:x+"&oldid="+e,text:x+"&oldid="+e}))},w.retrieveRevision=function{$("#cssmenuRev").empty,w.resetRevision;var e=null;e=$("#compare_Selector").val,b=new SensiumRequesterRevision({controller:w}),b.sensiumURLRequest("https://"+GLOBAL_wikiLanguage+".wikipedia.org/w/index.php?title="+e),console.log("ArticleController.retrieveRevision "+p+" "+b);var i=new ArticleLogicRevision({data:o,articleName:e,controller:w});t=new DataManipulatorRevision({data:o,articleName:e,controller:w}),c.push(i),i.retrieveData},w.torf=function{return p},w.showWikiPage=function(e){m=e},w.getShowWiki=function{return m},w.showSensiumPanel=function{if(console.log("SHOW SENSIUM PANEL"),null!=b){if(f)$("#wikiTextInner").html(v),$("#eexcess_equation_controls").html(y),$("#showSensiumPanel").css("background-color","grey"),v=null,y=null,$("#wikiTextInner").children.remove,$("#wikiTextInner").append("<iframe id='wikiIframe' src=\"https://"+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+'" style="width: 100%; height: 100%"> '),console.log("toggle on"),GLOBAL_wikiPageActive=!0, articleControllerMain.showWikiPage(!0),$("#mytoggle").toggles({clicker:$(".clickme"),text:{on:"",off:"OFF"},on:!0}),$("#mytoggle").on("toggle",function(e,t){t?($("#wikiTextInner").children.remove,$("#wikiTextInner").append("<iframe id='wikiIframe' src=\"https://"+GLOBAL_wikiLanguage+".wikipedia.org/?title="+$("#firstHeading").val+'" style="width: 100%; height: 100%"> '),console.log("toggle on"),GLOBAL_wikiPageActive=!0,articleControllerMain.showWikiPage(!0)):(GLOBAL_wikiPageActive=!1,articleControllerMain.showTheWholeArticleInMainView,console.log("toggle off"),articleControllerMain.showWikiPage(!1))});else{v=$("#wikiTextInner").html,y=$("#eexcess_equation_controls").html,$("#eexcess_equation_controls").html(""),$("#wikiTextInner").html(""),$("#eexcess_equation_controls").append('<div id="iconSensiumSummarize" class="icon" onclick="articleControllerMain.sensiumSummariser" > <img src="media/summary.png" height="30"/ title="Summarization" > '),$("#eexcess_equation_controls").append('<div id="iconSensiumEvent" class="icon" onclick="articleControllerMain.sensiumEventExtraction" > <img src="media/eventExtraction.png" height="30"/ title="Temporal Event Extraction" > '),$("#eexcess_equation_controls").append('<div id="iconSensiumKey"  class="icon" onclick="articleControllerMain.sensiumKeyphraseExtraction" > <img src="media/keywordExtraction.png" height="30"/ title="Keyphrase Extraction" > '),$("#eexcess_equation_controls").append('<div id="iconSensiumEntity" class="icon" onclick="articleControllerMain.sensiumEntity" > <img src="media/entity.png" height="30"/ title="Keyphrase Extraction" > '),$("#showSensiumPanel").css("background-color","#000"),b.setURL("https://"+GLOBAL_wikiLanguage+".wikipedia.org/wiki/"+$("#firstHeading").val);"https://"+GLOBAL_wikiLanguage+".wikipedia.org/wiki/"+$("#firstHeading").val;b.doRequest(1)}f=!f}else alert("Please retrieve an article first!")},w.sensiumSummariser=function{b.doRequest(1)},w.sensiumEventExtraction=function{b.doRequest(2)},w.sensiumKeyphraseExtraction=function{b.doRequest(4)},w.sensiumEntity=function{b.doRequest(3)},w.getShowSensium=function{return f},w.getSensiumRequester=function{return b},w.onDoubleClick=function(e){for(var t=0;t<c.length;t++)c[t].onDoubleClick(e)},w.onClick=function(e){for(var t=0;t<c.length;t++)c[t].onClick(e)},w.onDragEnd=function(e){for(var t=0;t<c.length;t++)c[t].onDragEnd(e)},w.addQMToCalculation=function(e){for(var t=0;t<a.length;t++)a[t].key==e&&(a[t].isCalculation=!a[t].isCalculation);w.showQuality},w.getEquationArray=function{return a},w.showAllEquations=function(e){if(console.log("showAllEquations"),a.splice(0,a.length),$("#dialogSettingsTable").empty,"no results"!=e){var t=JSON.parse(e),i=t.equations;for(var n in i){var o={key:n,equationBody:i[n],isCalculation:!1};a.push(o),$("#dialogSettingsTable").append("  <input type='checkbox' onclick='articleControllerMain.addQMToCalculation(\""+n+'"); articleControllerCompare.addQMToCalculation("'+n+"\")'/>  "+n+"  "+i[n]+"  ")}$("#dialogSettingsTable").append("  <button onclick='articleControllerMain.showAllEquationsDC; '> reload      ")}},w.showQMs=function{$("#dialogQMs").dialog("open")},w.showSettings=function{$("#dialogSettings").dialog("open"),"ca-icon"==$("#showSettings a span").attr("class")?($("#showSettings a span").attr("class","ca-icon-selected"),$("#showSettings a div h2").attr("class","ca-main-selected"),$("#showSettings").css("background-color","#000")):($("#showSettings a span").attr("class","ca-icon"),$("#showSettings a div h2").attr("class","ca-main"),$("#showSettings").css("background-color","grey"))},w.init=function(e){i=new DataSet,n=new DataSet,o={nodes:i,edges:n}},w.sensium=function{var e;e=p?new SensiumRequesterRevision:new SensiumRequester,e.sensium},w.showAllEquationsDC=function{},w};$("#mw-panel").prepend(" ");var articleController=new ArticleController;articleController.retrieveData,dataRetriever.setTitle($("#firstHeading").html),dataRetriever.getAllMeasures;