From 6e5ecb034d442416e5ae6e585c8cf09a46f7a7f7 Mon Sep 17 00:00:00 2001
From: Robbie Antenesse
Date: Thu, 17 Mar 2016 11:42:25 -0600
Subject: [PATCH] Updated ReadMe, returned credits to borrowed libraries, added
newlines to minified files.
---
README.md | 5 +++--
announcement.php | 3 ++-
js/min/defiant.js | 13 ++++++++++++-
js/min/dictionaryBuilder.js | 2 +-
js/min/marked.js | 7 ++++++-
js/min/publicView.js | 2 +-
js/min/removeDiacritics.js | 17 ++++++++++++++++-
js/min/ui.js | 2 +-
8 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
index 956aad0..dcff8d1 100644
--- a/README.md
+++ b/README.md
@@ -102,8 +102,9 @@ The "Filter Words" drop-down box allows you to filter your dictionary by part of
### Keyboard Shortcuts
**Esc** : Exits a window (i.e. Dictionary Settings, Account Settings, this about page, etc.) without saving.
-**Ctrl/Command +**
+**Ctrl/Control +**
+* **Enter/Return** : Submit Word (when typing in Word Form)
* **D** : Toggle Dictionary Description visibility.
* **E** : Export current dictionary. (Also Ctrl+Shift+S does this.)
* **H** : Open this help window.
@@ -114,7 +115,7 @@ The "Filter Words" drop-down box allows you to filter your dictionary by part of
**Alt/Option +**
* **A** : Toggle Account Settings window (if logged in).
-* **S** : Toggle Dicitonary Settings window. Saves & Closes if it's alraedy open.
+* **S** : Toggle Dicitonary Settings window. Saves & Closes if it's already open.
## Accounts
If you are using an account with Lexiconga, your experience should remain essentially the same, but you will see some additional options in the Settings menu and you might notice some slight changes in performance as it saves to and loads from the database.
diff --git a/announcement.php b/announcement.php
index 844d691..1e3a80c 100644
--- a/announcement.php
+++ b/announcement.php
@@ -1 +1,2 @@
-You can now unlock the Word Entry Form so it scrolls next to the dictionary as you scroll. No need to scramble up and down the screen to add words!
+You can now use Keyboard Shortcuts! Check About Lexiconga (Ctrl+H) to find out what they are!
+Check the update log for other changes.
diff --git a/js/min/defiant.js b/js/min/defiant.js
index 5762e0e..dbaa77e 100644
--- a/js/min/defiant.js
+++ b/js/min/defiant.js
@@ -1 +1,12 @@
-if("undefined"==typeof module)var module={exports:void 0};if(module.exports=Defiant=function(t,e){"use strict";var r={is_ie:/msie/i.test(navigator.userAgent),is_safari:/safari/i.test(navigator.userAgent),env:"production",xml_decl:'',namespace:'xmlns:d="defiant-namespace"',tabsize:4,render:function(t,e){var r,n,a,s,i=new XSLTProcessor,o=document.createElement("span"),l={match:"/"};switch(typeof t){case"object":this.extend(l,t),l.data||(l.data=e);break;case"string":l.template=t,l.data=e;break;default:throw"error"}if(l.data=JSON.toXML(l.data),r='//xsl:template[@name="'+l.template+'"]',this.xsl_template||this.gatherTemplates(),l.sorter&&(s=this.node.selectSingleNode(this.xsl_template,r+"//xsl:for-each//xsl:sort"),s&&(l.sorter.order&&s.setAttribute("order",l.sorter.order),l.sorter.select&&s.setAttribute("select",l.sorter.select),s.setAttribute("data-type",l.sorter.type||"text"))),a=this.node.selectSingleNode(this.xsl_template,r),a.setAttribute("match",l.match),i.importStylesheet(this.xsl_template),o.appendChild(i.transformToFragment(l.data,document)),a.removeAttribute("match"),this.is_safari){n=o.getElementsByTagName("script");for(var c=0,u=n.length;u>c;c++)n[c].defer=!0}return o.innerHTML},gatherTemplates:function(){for(var t=document.getElementsByTagName("script"),e="",r=0,n=t.length;n>r;r++)"defiant/xsl-template"===t[r].type&&(e+=t[r].innerHTML);this.xsl_template=this.xmlFromString('"+e.replace(/defiant:(\w+)/g,"$1")+"")},getSnapshot:function(t){return JSON.toXML(t,!0)},xmlFromString:function(t){var e,r;return t=t.replace(/>\s{1,}<"),null===t.trim().match(/<\?xml/)&&(t=this.xml_decl+t),this.is_ie?(r=new ActiveXObject("Msxml2.DOMDocument"),r.loadXML(t),-1===t.indexOf("xsl:stylesheet")&&r.setProperty("SelectionLanguage","XPath")):(e=new DOMParser,r=e.parseFromString(t,"text/xml")),r},extend:function(t,e){for(var r in e)t[r]&&"object"==typeof e[r]?this.extend(t[r],e[r]):t[r]=e[r];return t},node:{}};return r}(this),"undefined"==typeof XSLTProcessor){var XSLTProcessor=function(){};XSLTProcessor.prototype={importStylesheet:function(t){this.xsldoc=t},transformToFragment:function(t,e){var r=t.transformNode(this.xsldoc),n=document.createElement("span");return n.innerHTML=r,n}}}String.prototype.fill||(String.prototype.fill=function(t,e){var r=this;for(e=e||" ";r.length/,rx_constructor:/<(.+?)( d:contr=".*?")>/,rx_namespace:/ xmlns\:d="defiant\-namespace"/,rx_data:/(<.+?>)(.*?)(<\/d:data>)/i,rx_function:/function (\w+)/i,to_xml:function(t){var e=this.hash_to_xml(null,t);return Defiant.xmlFromString(e)},hash_to_xml:function(t,e,r){var n,a,s,i,o,l,c,u,h=e.constructor===Array,d=[],m=[];for(n in e)if(a=e[n],null!==a&&void 0!==a&&"NaN"!==a.toString()||(a=null),i="@"===n.slice(0,1),o=r?t:n,o==+o&&e.constructor!==Object&&(o="d:item"),null===a?(l=null,c=!1):(l=a.constructor,c=l.toString().match(this.rx_function)[1]),i)m.push(o.slice(1)+'="'+this.escape_xml(a)+'"'),"String"!==c&&m.push("d:"+o.slice(1)+'="'+c+'"');else if(null===a)d.push(this.scalar_to_xml(o,a));else switch(l){case Function:break;case Object:d.push(this.hash_to_xml(o,a));break;case Array:if(n===o){if(s=a.constructor===Array)for(u=a.length;u--;)a[u].constructor===Array&&(s=!0),s||a[u].constructor!==Object||(s=!0);d.push(this.scalar_to_xml(o,a,s));break}case String:if("string"==typeof a&&(a=a.toString().replace(/\&/g,"&").replace(/\r|\n/g,"
")),"#text"===o){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}case Number:case Boolean:if("#text"===o&&"String"!==c){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}d.push(this.scalar_to_xml(o,a))}return t||(t="d:data",m.push(Defiant.namespace),h&&m.push('d:constr="Array"')),null===t.match(this.rx_validate_name)&&(m.push('d:name="'+t+'"'),t="d:name"),r?d.join(""):(this.map.push(e),m.push('d:mi="'+this.map.length+'"'),"<"+t+(m.length?" "+m.join(" "):"")+(d.length?">"+d.join("")+""+t+">":"/>"))},scalar_to_xml:function(t,e,r){var n,a,s,i="";if(null===t.match(this.rx_validate_name)&&(i+=' d:name="'+t+'"',t="d:name",r=!1),null!==e&&"NaN"!==e.toString()||(e=null),null===e)return"<"+t+' d:constr="null"/>';if(1===e.length&&e[0].constructor===Object){n=this.hash_to_xml(!1,e[0]);var o=n.match(this.rx_node),l=n.match(this.rx_constructor);return o=null!==o?o[2].replace(this.rx_namespace,"").replace(/>/,"").replace(/"\/$/,'"'):"",l=null!==l?l[2]:"",n=n.match(this.rx_data),n=null!==n?n[2]:"","<"+t+o+" "+l+' d:type="ArrayItem">'+n+""+t+">"}return 0===e.length&&e.constructor===Array?"<"+t+' d:constr="Array"/>':r?this.hash_to_xml(t,e,!0):(a=e.constructor,s=a.toString().match(this.rx_function)[1],n=a===Array?this.hash_to_xml("d:item",e,!0):this.escape_xml(e),i+=' d:constr="'+s+'"',this.map.push(e),i+=' d:mi="'+this.map.length+'"',"#text"===t?this.escape_xml(e):"<"+t+i+">"+n+""+t+">")},escape_xml:function(t){return String(t).replace(//g,">").replace(/"/g,""").replace(/ /g," ")}},n=r.to_xml.call(r,t);return e?{doc:n,src:t,map:r.map}:(this.search.map=r.map,n)}),JSON.search||(JSON.search=function(t,e,r){"use strict";var n,a,s=t.doc&&t.doc.nodeType,i=s?t.doc:JSON.toXML(t),o=s?t.map:this.search.map,l=s?t.src:t,c=Defiant.node[r?"selectSingleNode":"selectNodes"](i,e.xTransform()),u=[];for(r&&(c=[c]),a=c.length;a--;)switch(c[a].nodeType){case 2:case 3:u.unshift(c[a].nodeValue);break;default:n=+c[a].getAttribute("d:mi"),o[n-1]&&u.unshift(o[n-1])}return"development"===Defiant.env&&(this.trace=JSON.mtrace(l,u,c)),u}),JSON.mtrace||(JSON.mtrace=function(t,e,r){"use strict";for(var n,a,s,i,o,l=window,c=JSON.stringify,u=c(t,null," ").replace(/\t/g,""),h=[],d=0,m=r.length,p=m?r[d].ownerDocument.documentElement:!1,f=(this.search.map,0);m>d;d++){switch(r[d].nodeType){case 2:a=r[d].ownerElement?r[d].ownerElement.getAttribute("d:"+r[d].nodeName):"String",n='"@'+r[d].nodeName+'": '+l[a](e[d]),s=u.indexOf(n),o=0;break;case 3:a=r[d].parentNode.getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].parentNode.nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n),o=0;break;default:if(r[d]===p)continue;"String"===r[d].getAttribute("d:constr")?(a=r[d].getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n,f),o=0,f=s+1):(n=c(e[d],null," ").replace(/\t/g,""),s=u.indexOf(n),o=n.match(/\n/g).length)}i=u.substring(0,s).match(/\n/g).length+1,h.push([i,o])}return h}),Defiant.node.selectNodes=function(t,e){if(t.evaluate){for(var r=t.createNSResolver(t.documentElement),n=t.evaluate(e,t,r,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=[],s=0,i=n.snapshotLength;i>s;s++)a.push(n.snapshotItem(s));return a}return t.selectNodes(e)},Defiant.node.selectSingleNode=function(t,e){if(t.evaluate){var r=this.selectNodes(t,e);return r.length>0?r[0]:null}return t.selectSingleNode(e)},Defiant.node.prettyPrint=function(t){var e,r,n=Defiant,a=n.tabsize,s=n.xml_decl.toLowerCase();n.is_ie?r=t.xml:(e=new XMLSerializer,r=e.serializeToString(t)),"development"!==n.env&&(r=r.replace(/ \w+\:d=".*?"| d\:\w+=".*?"/g,""));for(var i,o,l=r.trim().replace(/(>)\s*(<)(\/*)/g,"$1\n$2$3"),c=l.split("\n"),u=-1,h=0,d=c.length;d>h;h++)0===h&&c[h].toLowerCase()===s||(i=null!==c[h].match(/<[A-Za-z_\:]+.*?>/g),o=null!==c[h].match(/<\/[\w\:]+>/g),null!==c[h].match(/<.*?\/>/g)&&(i=o=!0),i&&u++,c[h]=String().fill(u," ")+c[h],i&&o&&u--,!i&&o&&u--);return c.join("\n").replace(/\t/g,String().fill(a," "))},Defiant.node.toJSON=function(t,e){"use strict";var r=function(t){var e,n,a,s,i,o,l,c,u,h,d={},m=window;switch(t.nodeType){case 1:for(i=t.getAttribute("d:constr"),"Array"===i?d=[]:"String"===i&&""===t.textContent&&(d=""),e=t.attributes,c=0,u=e.length;u>c;c++)h=e.item(c),null===h.nodeName.match(/\:d|d\:/g)&&(i=t.getAttribute("d:"+h.nodeName),o=i&&"undefined"!==i?"null"===h.nodeValue?null:m[i]("false"===h.nodeValue?"":h.nodeValue):h.nodeValue,d["@"+h.nodeName]=o);break;case 3:n=t.parentNode.getAttribute("d:type"),o=n?m[n]("false"===t.nodeValue?"":t.nodeValue):t.nodeValue,d=o}if(t.hasChildNodes())for(c=0,u=t.childNodes.length;u>c;c++)if(a=t.childNodes.item(c),s=a.nodeName,e=t.attributes,"d:name"===s&&(s=a.getAttribute("d:name")),"#text"===s)i=t.getAttribute("d:constr"),"undefined"===i&&(i=void 0),l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,i||e.length?i&&1===u?d=m[i](o):t.hasChildNodes()&&e.length<3?d=i?m[i](o):o:d[s]=i?m[i](o):o:d=o;else{if(d[s]){d[s].push?d[s].push(r(a)):d[s]=[d[s],r(a)];continue}switch(i=a.getAttribute("d:constr")){case"null":d.push?d.push(null):d[s]=null;break;case"Array":a.parentNode.firstChild===a&&"Array"===i&&"d:item"!==s?"d:item"===s||"Array"===i?(o=r(a),d[s]=o.length?[o]:o):d[s]=r(a):d.push?d.push(r(a)):d[s]=r(a);break;case"String":case"Number":case"Boolean":l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,d.push?d.push(m[i](o)):d[s]=r(a);break;default:d.push?d.push(r(a)):d[s]=r(a)}}return 1===t.nodeType&&"ArrayItem"===t.getAttribute("d:type")&&(d=[d]),d},n=9===t.nodeType?t.documentElement:t,a=r(n),s=a[n.nodeName];return n===n.ownerDocument.documentElement&&s&&s.constructor===Array&&(a=s),e&&"true"===e.toString()&&(e=" "),e?JSON.stringify(a,null,e):a},"undefined"!=typeof jQuery&&!function(t){"use strict";t.fn.defiant=function(t,e){return this.html(Defiant.render(t,e)),this}}(jQuery);
\ No newline at end of file
+/*
+ * Defiant.js v1.2.5
+ * Serch JSON structures plus smart templating with XSLT and XPath.
+ * http://defiantjs.com
+ *
+ * Copyright (c) 2013-2015, Hakan Bilgin
+ * Licensed under the MIT License
+ *
+ * NOTE:
+ * Robbie Antenesse edited line 165's RegExp to search global and case-insensitive in case of multiple contains() groups.
+ */
+if("undefined"==typeof module)var module={exports:void 0};if(module.exports=Defiant=function(t,e){"use strict";var r={is_ie:/msie/i.test(navigator.userAgent),is_safari:/safari/i.test(navigator.userAgent),env:"production",xml_decl:'',namespace:'xmlns:d="defiant-namespace"',tabsize:4,render:function(t,e){var r,n,a,s,i=new XSLTProcessor,o=document.createElement("span"),l={match:"/"};switch(typeof t){case"object":this.extend(l,t),l.data||(l.data=e);break;case"string":l.template=t,l.data=e;break;default:throw"error"}if(l.data=JSON.toXML(l.data),r='//xsl:template[@name="'+l.template+'"]',this.xsl_template||this.gatherTemplates(),l.sorter&&(s=this.node.selectSingleNode(this.xsl_template,r+"//xsl:for-each//xsl:sort"),s&&(l.sorter.order&&s.setAttribute("order",l.sorter.order),l.sorter.select&&s.setAttribute("select",l.sorter.select),s.setAttribute("data-type",l.sorter.type||"text"))),a=this.node.selectSingleNode(this.xsl_template,r),a.setAttribute("match",l.match),i.importStylesheet(this.xsl_template),o.appendChild(i.transformToFragment(l.data,document)),a.removeAttribute("match"),this.is_safari){n=o.getElementsByTagName("script");for(var c=0,u=n.length;u>c;c++)n[c].defer=!0}return o.innerHTML},gatherTemplates:function(){for(var t=document.getElementsByTagName("script"),e="",r=0,n=t.length;n>r;r++)"defiant/xsl-template"===t[r].type&&(e+=t[r].innerHTML);this.xsl_template=this.xmlFromString('"+e.replace(/defiant:(\w+)/g,"$1")+"")},getSnapshot:function(t){return JSON.toXML(t,!0)},xmlFromString:function(t){var e,r;return t=t.replace(/>\s{1,}<"),null===t.trim().match(/<\?xml/)&&(t=this.xml_decl+t),this.is_ie?(r=new ActiveXObject("Msxml2.DOMDocument"),r.loadXML(t),-1===t.indexOf("xsl:stylesheet")&&r.setProperty("SelectionLanguage","XPath")):(e=new DOMParser,r=e.parseFromString(t,"text/xml")),r},extend:function(t,e){for(var r in e)t[r]&&"object"==typeof e[r]?this.extend(t[r],e[r]):t[r]=e[r];return t},node:{}};return r}(this),"undefined"==typeof XSLTProcessor){var XSLTProcessor=function(){};XSLTProcessor.prototype={importStylesheet:function(t){this.xsldoc=t},transformToFragment:function(t,e){var r=t.transformNode(this.xsldoc),n=document.createElement("span");return n.innerHTML=r,n}}}String.prototype.fill||(String.prototype.fill=function(t,e){var r=this;for(e=e||" ";r.length/,rx_constructor:/<(.+?)( d:contr=".*?")>/,rx_namespace:/ xmlns\:d="defiant\-namespace"/,rx_data:/(<.+?>)(.*?)(<\/d:data>)/i,rx_function:/function (\w+)/i,to_xml:function(t){var e=this.hash_to_xml(null,t);return Defiant.xmlFromString(e)},hash_to_xml:function(t,e,r){var n,a,s,i,o,l,c,u,h=e.constructor===Array,d=[],m=[];for(n in e)if(a=e[n],null!==a&&void 0!==a&&"NaN"!==a.toString()||(a=null),i="@"===n.slice(0,1),o=r?t:n,o==+o&&e.constructor!==Object&&(o="d:item"),null===a?(l=null,c=!1):(l=a.constructor,c=l.toString().match(this.rx_function)[1]),i)m.push(o.slice(1)+'="'+this.escape_xml(a)+'"'),"String"!==c&&m.push("d:"+o.slice(1)+'="'+c+'"');else if(null===a)d.push(this.scalar_to_xml(o,a));else switch(l){case Function:break;case Object:d.push(this.hash_to_xml(o,a));break;case Array:if(n===o){if(s=a.constructor===Array)for(u=a.length;u--;)a[u].constructor===Array&&(s=!0),s||a[u].constructor!==Object||(s=!0);d.push(this.scalar_to_xml(o,a,s));break}case String:if("string"==typeof a&&(a=a.toString().replace(/\&/g,"&").replace(/\r|\n/g,"
")),"#text"===o){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}case Number:case Boolean:if("#text"===o&&"String"!==c){this.map.push(e),m.push('d:mi="'+this.map.length+'"'),m.push('d:constr="'+c+'"'),d.push(this.escape_xml(a));break}d.push(this.scalar_to_xml(o,a))}return t||(t="d:data",m.push(Defiant.namespace),h&&m.push('d:constr="Array"')),null===t.match(this.rx_validate_name)&&(m.push('d:name="'+t+'"'),t="d:name"),r?d.join(""):(this.map.push(e),m.push('d:mi="'+this.map.length+'"'),"<"+t+(m.length?" "+m.join(" "):"")+(d.length?">"+d.join("")+""+t+">":"/>"))},scalar_to_xml:function(t,e,r){var n,a,s,i="";if(null===t.match(this.rx_validate_name)&&(i+=' d:name="'+t+'"',t="d:name",r=!1),null!==e&&"NaN"!==e.toString()||(e=null),null===e)return"<"+t+' d:constr="null"/>';if(1===e.length&&e[0].constructor===Object){n=this.hash_to_xml(!1,e[0]);var o=n.match(this.rx_node),l=n.match(this.rx_constructor);return o=null!==o?o[2].replace(this.rx_namespace,"").replace(/>/,"").replace(/"\/$/,'"'):"",l=null!==l?l[2]:"",n=n.match(this.rx_data),n=null!==n?n[2]:"","<"+t+o+" "+l+' d:type="ArrayItem">'+n+""+t+">"}return 0===e.length&&e.constructor===Array?"<"+t+' d:constr="Array"/>':r?this.hash_to_xml(t,e,!0):(a=e.constructor,s=a.toString().match(this.rx_function)[1],n=a===Array?this.hash_to_xml("d:item",e,!0):this.escape_xml(e),i+=' d:constr="'+s+'"',this.map.push(e),i+=' d:mi="'+this.map.length+'"',"#text"===t?this.escape_xml(e):"<"+t+i+">"+n+""+t+">")},escape_xml:function(t){return String(t).replace(//g,">").replace(/"/g,""").replace(/ /g," ")}},n=r.to_xml.call(r,t);return e?{doc:n,src:t,map:r.map}:(this.search.map=r.map,n)}),JSON.search||(JSON.search=function(t,e,r){"use strict";var n,a,s=t.doc&&t.doc.nodeType,i=s?t.doc:JSON.toXML(t),o=s?t.map:this.search.map,l=s?t.src:t,c=Defiant.node[r?"selectSingleNode":"selectNodes"](i,e.xTransform()),u=[];for(r&&(c=[c]),a=c.length;a--;)switch(c[a].nodeType){case 2:case 3:u.unshift(c[a].nodeValue);break;default:n=+c[a].getAttribute("d:mi"),o[n-1]&&u.unshift(o[n-1])}return"development"===Defiant.env&&(this.trace=JSON.mtrace(l,u,c)),u}),JSON.mtrace||(JSON.mtrace=function(t,e,r){"use strict";for(var n,a,s,i,o,l=window,c=JSON.stringify,u=c(t,null," ").replace(/\t/g,""),h=[],d=0,m=r.length,p=m?r[d].ownerDocument.documentElement:!1,f=(this.search.map,0);m>d;d++){switch(r[d].nodeType){case 2:a=r[d].ownerElement?r[d].ownerElement.getAttribute("d:"+r[d].nodeName):"String",n='"@'+r[d].nodeName+'": '+l[a](e[d]),s=u.indexOf(n),o=0;break;case 3:a=r[d].parentNode.getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].parentNode.nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n),o=0;break;default:if(r[d]===p)continue;"String"===r[d].getAttribute("d:constr")?(a=r[d].getAttribute("d:constr"),n=l[a](e[d]),n='"'+r[d].nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n,f),o=0,f=s+1):(n=c(e[d],null," ").replace(/\t/g,""),s=u.indexOf(n),o=n.match(/\n/g).length)}i=u.substring(0,s).match(/\n/g).length+1,h.push([i,o])}return h}),Defiant.node.selectNodes=function(t,e){if(t.evaluate){for(var r=t.createNSResolver(t.documentElement),n=t.evaluate(e,t,r,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),a=[],s=0,i=n.snapshotLength;i>s;s++)a.push(n.snapshotItem(s));return a}return t.selectNodes(e)},Defiant.node.selectSingleNode=function(t,e){if(t.evaluate){var r=this.selectNodes(t,e);return r.length>0?r[0]:null}return t.selectSingleNode(e)},Defiant.node.prettyPrint=function(t){var e,r,n=Defiant,a=n.tabsize,s=n.xml_decl.toLowerCase();n.is_ie?r=t.xml:(e=new XMLSerializer,r=e.serializeToString(t)),"development"!==n.env&&(r=r.replace(/ \w+\:d=".*?"| d\:\w+=".*?"/g,""));for(var i,o,l=r.trim().replace(/(>)\s*(<)(\/*)/g,"$1\n$2$3"),c=l.split("\n"),u=-1,h=0,d=c.length;d>h;h++)0===h&&c[h].toLowerCase()===s||(i=null!==c[h].match(/<[A-Za-z_\:]+.*?>/g),o=null!==c[h].match(/<\/[\w\:]+>/g),null!==c[h].match(/<.*?\/>/g)&&(i=o=!0),i&&u++,c[h]=String().fill(u," ")+c[h],i&&o&&u--,!i&&o&&u--);return c.join("\n").replace(/\t/g,String().fill(a," "))},Defiant.node.toJSON=function(t,e){"use strict";var r=function(t){var e,n,a,s,i,o,l,c,u,h,d={},m=window;switch(t.nodeType){case 1:for(i=t.getAttribute("d:constr"),"Array"===i?d=[]:"String"===i&&""===t.textContent&&(d=""),e=t.attributes,c=0,u=e.length;u>c;c++)h=e.item(c),null===h.nodeName.match(/\:d|d\:/g)&&(i=t.getAttribute("d:"+h.nodeName),o=i&&"undefined"!==i?"null"===h.nodeValue?null:m[i]("false"===h.nodeValue?"":h.nodeValue):h.nodeValue,d["@"+h.nodeName]=o);break;case 3:n=t.parentNode.getAttribute("d:type"),o=n?m[n]("false"===t.nodeValue?"":t.nodeValue):t.nodeValue,d=o}if(t.hasChildNodes())for(c=0,u=t.childNodes.length;u>c;c++)if(a=t.childNodes.item(c),s=a.nodeName,e=t.attributes,"d:name"===s&&(s=a.getAttribute("d:name")),"#text"===s)i=t.getAttribute("d:constr"),"undefined"===i&&(i=void 0),l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,i||e.length?i&&1===u?d=m[i](o):t.hasChildNodes()&&e.length<3?d=i?m[i](o):o:d[s]=i?m[i](o):o:d=o;else{if(d[s]){d[s].push?d[s].push(r(a)):d[s]=[d[s],r(a)];continue}switch(i=a.getAttribute("d:constr")){case"null":d.push?d.push(null):d[s]=null;break;case"Array":a.parentNode.firstChild===a&&"Array"===i&&"d:item"!==s?"d:item"===s||"Array"===i?(o=r(a),d[s]=o.length?[o]:o):d[s]=r(a):d.push?d.push(r(a)):d[s]=r(a);break;case"String":case"Number":case"Boolean":l=a.textContent||a.text,o="Boolean"===i&&"false"===l?"":l,d.push?d.push(m[i](o)):d[s]=r(a);break;default:d.push?d.push(r(a)):d[s]=r(a)}}return 1===t.nodeType&&"ArrayItem"===t.getAttribute("d:type")&&(d=[d]),d},n=9===t.nodeType?t.documentElement:t,a=r(n),s=a[n.nodeName];return n===n.ownerDocument.documentElement&&s&&s.constructor===Array&&(a=s),e&&"true"===e.toString()&&(e=" "),e?JSON.stringify(a,null,e):a},"undefined"!=typeof jQuery&&!function(t){"use strict";t.fn.defiant=function(t,e){return this.html(Defiant.render(t,e)),this}}(jQuery);
diff --git a/js/min/dictionaryBuilder.js b/js/min/dictionaryBuilder.js
index ddc706f..10fe3ce 100644
--- a/js/min/dictionaryBuilder.js
+++ b/js/min/dictionaryBuilder.js
@@ -1 +1 @@
-function AddWord(){var e=htmlEntities(document.getElementById("word").value).trim(),t=htmlEntities(document.getElementById("pronunciation").value).trim(),n=htmlEntities(document.getElementById("partOfSpeech").value).trim(),i=htmlEntities(document.getElementById("simpleDefinition").value).trim(),r=htmlEntities(document.getElementById("longDefinition").value),o=htmlEntities(document.getElementById("editIndex").value),a=document.getElementById("errorMessage"),c="",s=document.getElementById("updateConflict");if(""==e||""==i&&""==r)""==e?(c+="Word cannot be blank",c+=""==i&&""==r?" and you need at least one definition.":"."):""==i&&""==r&&(c+="You need at least one definition.");else{var d=currentDictionary.settings.allowDuplicates?-1:WordIndex(e);if(""!=o)WordAtIndexWasChanged(o,e,t,n,i,r)?(document.getElementById("editWordButtonArea").style.display="none",DisableForm(),s.style.display="block",s.innerHTML="Do you really want to change the word \""+currentDictionary.words[parseInt(o)].name+'" to what you have set above?',s.innerHTML+='",s.innerHTML+=''):(c='No change has been made to "'+e+'"',currentDictionary.words[parseInt(o)].name!=e&&(c+=". (Your dictionary is currently set to ignore case.)"));else if(d>=0)if(WordAtIndexWasChanged(d,e,t,n,i,r)){document.getElementById("newWordButtonArea").style.display="none",DisableForm(),s.style.display="block";var l="\""+e+'" is already in the dictionary';l+=currentDictionary.words[d].name!=e?' as "'+currentDictionary.words[d].name+'", and your dictionary is set to ignore case.':".",l+=" Do you want to update it to what you have set above?",l+='",l+=' ',s.innerHTML=l}else c='"'+e+'" is already in the dictionary exactly as it is written above',currentDictionary.words[d].name!=e&&(c+=". (Your dictionary is currently set to ignore case.)");else currentDictionary.words.push({name:e,pronunciation:t,partOfSpeech:n,simpleDefinition:i,longDefinition:r,wordId:currentDictionary.nextWordId++}),FocusAfterAddingNewWord(),NewWordNotification(e),SaveAndUpdateDictionary(!1);a.innerHTML=""}a.innerHTML=c}function EditWord(e){SaveScroll(),wordFormIsLocked()&&window.scroll(0,0),ClearForm(),document.getElementById("editIndex").value=e.toString(),document.getElementById("word").value=htmlEntitiesParse(currentDictionary.words[e].name),document.getElementById("pronunciation").value=htmlEntitiesParse(currentDictionary.words[e].pronunciation),document.getElementById("partOfSpeech").value=htmlEntitiesParse(currentDictionary.words[e].partOfSpeech),document.getElementById("simpleDefinition").value=htmlEntitiesParse(currentDictionary.words[e].simpleDefinition),document.getElementById("longDefinition").value=htmlEntitiesParse(currentDictionary.words[e].longDefinition),document.getElementById("newWordButtonArea").style.display="none",document.getElementById("editWordButtonArea").style.display="block"}function UpdateWord(e,t,n,i,r,o){currentDictionary.words[e].name=t,currentDictionary.words[e].pronunciation=n,currentDictionary.words[e].partOfSpeech=i,currentDictionary.words[e].simpleDefinition=r,currentDictionary.words[e].longDefinition=o,SaveAndUpdateDictionary(),window.scroll(savedScroll.x,savedScroll.y),FocusAfterAddingNewWord()}function DeleteWord(e){""!=document.getElementById("editIndex").value&&ClearForm(),currentDictionary.words.splice(e,1),SaveAndUpdateDictionary(!0)}function ShowDictionary(){var e=document.getElementById("wordFilter").value,t=[],n=htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value),i=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,o=document.getElementById("searchOptionLong").checked,a=!document.getElementById("searchCaseSensitive").checked,c=document.getElementById("searchIgnoreDiacritics").checked;if(""!=n&&(i||r||o)){var s=[],d=htmlEntitiesParseForSearch(JSON.stringify(currentDictionary));a&&(n=n.toLowerCase()),c&&(n=removeDiacritics(n),d=removeDiacritics(d)),i&&s.push("contains("+(a?"name":'translate(name, "", "")')+', "'+n+'")'),r&&s.push("contains("+(a?"simpleDefinition":'translate(simpleDefinition, "", "")')+', "'+n+'")'),o&&s.push("contains("+(a?"longDefinition":'translate(longDefinition, "", "")')+', "'+n+'")');var l=JSON.parse(d);t=JSON.search(l,"//words["+s.join(" or ")+"]/wordId")}var u=document.getElementById("dictionaryName");u.innerHTML=htmlEntitiesParse(currentDictionary.name)+" Dictionary";var y=document.getElementById("dictionaryDescription");y.innerHTML=marked(htmlEntitiesParse(currentDictionary.description));var p=document.getElementById("theDictionary"),m="",D=0;if(currentDictionary.words.length>0)for(var g=0;g=0)&&(currentDictionary.words[g].hasOwnProperty("pronunciation")||(currentDictionary.words[g].pronunciation=""),currentDictionary.words[g].hasOwnProperty("wordId")||(currentDictionary.words[g].wordId=g+1),m+=DictionaryEntry(g),D++);else m="There are no entries in the dictionary.";p.innerHTML=m,ShowFilterWordCount(D)}function DictionaryEntry(e){displayPublic="undefined"!=typeof displayPublic&&null!=displayPublic?displayPublic:!1;var t="🔗",n=regexParseForSearch(document.getElementById("searchBox").value),i=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,o=document.getElementById("searchOptionLong").checked,a=!document.getElementById("searchCaseSensitive").checked,c=document.getElementById("searchIgnoreDiacritics").checked,s=new RegExp("("+(c?removeDiacritics(n)+"|"+n:n)+")","g"+(a?"i":""));return t+="",t+=""!=n&&i?htmlEntitiesParse(currentDictionary.words[e].name).replace(s,"$1"):currentDictionary.words[e].name,t+="",""!=currentDictionary.words[e].pronunciation&&(t+="",t+=marked(htmlEntitiesParse(currentDictionary.words[e].pronunciation)).replace("
"}function SaveSettings(){""!=htmlEntities(document.getElementById("dictionaryNameEdit").value)&&(currentDictionary.name=htmlEntities(document.getElementById("dictionaryNameEdit").value)),currentDictionary.description=htmlEntities(document.getElementById("dictionaryDescriptionEdit").value),CheckForPartsOfSpeechChange(),currentDictionary.settings.allowDuplicates=document.getElementById("dictionaryAllowDuplicates").checked,currentDictionary.settings.caseSensitive=document.getElementById("dictionaryCaseSensitive").checked,currentDictionary.settings.sortByEquivalent=document.getElementById("dictionarySortByEquivalent").checked,currentDictionary.settings.isComplete=document.getElementById("dictionaryIsComplete").checked,document.getElementById("dictionaryIsPublic")&&(currentDictionary.settings.isPublic=document.getElementById("dictionaryIsPublic").checked),HideSettingsWhenComplete(),SaveAndUpdateDictionary(!0),LoadUserDictionaries()}function EmptyWholeDictionary(){confirm("This will delete the entire current dictionary. If you do not have a backed up export, you will lose it forever!\n\nDo you still want to delete?")&&CreateNewDictionary()}function CreateNewDictionary(){ResetDictionaryToDefault(),SaveAndUpdateDictionary(!1),SetPartsOfSpeech(),HideSettings()}function DeleteCurrentDictionary(){if(confirm("This will delete the current dictionary from the database. If you do not have a backed up export, you will lose it forever!\n\nDo you still want to delete?")){ResetDictionaryToDefault();var e=new XMLHttpRequest;e.open("POST","php/ajax_dictionarymanagement.php?action=delete"),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){return 4==e.readyState&&200==e.status?(e.responseText.length<31?(console.log(e.responseText),CreateNewDictionary()):(HideSettings(),ShowDictionaryDeleteMenu(e.responseText),0==document.getElementById("loadAfterDelete").options.length&&(document.getElementById("loadAfterDeleteScreen").style.display="none",CreateNewDictionary())),!0):!1},e.send()}}function ResetDictionaryToDefault(){currentDictionary=JSON.parse(defaultDictionaryJSON)}function SaveAndUpdateDictionary(e){currentDictionary.settings.sortByEquivalent?currentDictionary.words.sort(dynamicSort(["simpleDefinition","partOfSpeech"])):currentDictionary.words.sort(dynamicSort(["name","partOfSpeech"])),SaveDictionary(!0,!0),ShowDictionary(),e||ClearForm(),CloseUpdateConflictArea("newWordButtonArea")}function SaveDictionary(e,t){localStorage.setItem("dictionary",JSON.stringify(currentDictionary)),e&&(t="undefined"!=typeof t?t:!1,SendDictionary(t)),SavePreviousDictionary()}function SendDictionary(e){e="undefined"!=typeof e?e:!1;var t="",n="";currentDictionary.externalID>0?(t="update",n=DataToSend(e)):(t="new",n=DataToSend(!0,!0));var i=new XMLHttpRequest;i.open("POST","php/ajax_dictionarymanagement.php?action="+t),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){return 4==i.readyState&&200==i.status?("updated successfully"==i.responseText?(console.log(i.responseText),LoadUserDictionaries(),ProcessLoad()):isNaN(parseInt(i.responseText))?console.log(i.responseText):(currentDictionary.externalID=parseInt(i.responseText),LoadUserDictionaries(),ProcessLoad(),console.log("saved successfully")),!0):!1},i.send(n)}function DataToSend(e,t){t="undefined"!=typeof t&&null!=t?t:!1;var n="";return 0==currentDictionary.externalID?(n="name="+encodeURIComponent(currentDictionary.name)+"&description="+encodeURIComponent(currentDictionary.description)+"&words="+encodeURIComponent(JSON.stringify(currentDictionary.words)),n+="&nextwordid="+currentDictionary.nextWordId+"&allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")+"&casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0"),n+="&partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)+"&sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")+"&iscomplete="+(currentDictionary.settings.isComplete?"1":"0")+"&ispublic="+(currentDictionary.settings.isPublic?"1":"0")):((t||currentDictionary.name!=previousDictionary.name)&&(n+="name="+encodeURIComponent(currentDictionary.name)),(t||currentDictionary.description!=previousDictionary.description)&&(n+=(""==n?"":"&")+"description="+encodeURIComponent(currentDictionary.description)),(t||e)&&(n+=(""==n?"":"&")+"words="+encodeURIComponent(JSON.stringify(currentDictionary.words))),(t||currentDictionary.nextWordId!=previousDictionary.nextWordId)&&(n+=(""==n?"":"&")+"nextwordid="+currentDictionary.nextWordId),(t||currentDictionary.settings.allowDuplicates!=previousDictionary.allowDuplicates)&&(n+=(""==n?"":"&")+"allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")),(t||currentDictionary.settings.caseSensitive!=previousDictionary.caseSensitive)&&(n+=(""==n?"":"&")+"casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0")),(t||currentDictionary.settings.partsOfSpeech!=previousDictionary.partsOfSpeech)&&(n+=(""==n?"":"&")+"partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)),(t||currentDictionary.settings.sortByEquivalent!=previousDictionary.sortByEquivalent)&&(n+=(""==n?"":"&")+"sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")),(t||currentDictionary.settings.isComplete!=previousDictionary.isComplete)&&(n+=(""==n?"":"&")+"iscomplete="+(currentDictionary.settings.isComplete?"1":"0")),(t||currentDictionary.settings.isPublic!=previousDictionary.isPublic)&&(n+=(""==n?"":"&")+"ispublic="+(currentDictionary.settings.isPublic?"1":"0"))),n}function LoadDictionary(){LoadLocalDictionary();var e=new XMLHttpRequest;e.open("GET","php/ajax_dictionarymanagement.php?action=load"),e.onreadystatechange=function(){4==e.readyState&&200==e.status&&("no dictionaries"==e.responseText?(currentDictionary.externalID=0,currentDictionary.settings.isPublic=!1,SendDictionary(!0)):e.responseText.length<60?console.log(e.responseText):(currentDictionary=JSON.parse(e.responseText),SaveDictionary(!1,!1))),ProcessLoad()},e.send()}function ChangeDictionary(e){if(e="undefined"!=typeof e&&null!=e?e:document.getElementById("userDictionaries"),currentDictionary.externalID!=e.value&&e.options.length>0){var t=new XMLHttpRequest;t.open("POST","php/ajax_dictionarymanagement.php?action=switch"),t.setRequestHeader("Content-type","application/x-www-form-urlencoded");var n="newdictionaryid="+e.value.toString();t.onreadystatechange=function(){4==t.readyState&&200==t.status&&("no dictionaries"==t.responseText?(console.log(t.responseText),SendDictionary(!1)):t.responseText.length<60?console.log(t.responseText):(currentDictionary=JSON.parse(t.responseText),SaveDictionary(!1,!1),ProcessLoad(),LoadUserDictionaries(),HideSettings()))},t.send(n)}}function LoadLocalDictionary(){if(localStorage.getItem("dictionary")){var e=JSON.parse(localStorage.getItem("dictionary"));(e.words.length>0||"A new dictionary."!=e.description||"New"!=e.name)&&(currentDictionary=JSON.parse(localStorage.getItem("dictionary"))),e=null}}function ProcessLoad(){currentDictionary.hasOwnProperty("nextWordId")||(currentDictionary.nextWordId=currentDictionary.words.length+1),HideSettingsWhenComplete(),ShowDictionary(),SetPartsOfSpeech(),currentDictionary.settings.isComplete&&(document.getElementById("wordEntryForm").style.display="none"),SavePreviousDictionary()}function SavePreviousDictionary(){previousDictionary={name:currentDictionary.name,description:currentDictionary.description,nextWordId:currentDictionary.nextWordId,allowDuplicates:currentDictionary.settings.allowDuplicates,caseSensitive:currentDictionary.settings.caseSensitive,partsOfSpeech:currentDictionary.settings.partsOfSpeech,sortByEquivalent:currentDictionary.settings.sortByEquivalent,isComplete:currentDictionary.settings.isComplete,isPublic:currentDictionary.settings.isPublic}}function ExportDictionary(){if(currentDictionary.words.length>0){var e=removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g,"");""==e&&(e="export"),download(e+".dict",localStorage.getItem("dictionary"))}else alert("Dictionary must have at least 1 word to export.")}function ImportDictionary(){if(currentDictionary.externalID>0||confirm("Importing this dictionary will overwrite your current one, making it impossible to retrieve if you have not already exported it! Do you still want to import?")){if(!window.FileReader)return alert("Your browser is not supported"),!1;var e=new FileReader;if(document.getElementById("importFile").files.length>0){var t=document.getElementById("importFile").files[0];e.readAsText(t),e.onloadend=function(){if(e.result&&e.result.length){var t=JSON.parse(e.result);if(t.hasOwnProperty("name")&&t.hasOwnProperty("description")&&t.hasOwnProperty("words")&&t.hasOwnProperty("settings"))currentDictionary=JSON.parse(e.result),currentDictionary.externalID=0,currentDictionary.settings.isPublic=!1,SaveDictionary(!0,!0),ProcessLoad(),HideSettings(),document.getElementById("importFile").value="";else{var n="File is missing:";t.hasOwnProperty("name")||(n+=" name"),t.hasOwnProperty("description")||(n+=" description"),t.hasOwnProperty("words")||(n+=" words"),t.hasOwnProperty("settings")||(n+=" settings"),alert("Uploaded file is not compatible.\n\n"+n)}t=null}else alert("Upload Failed");e=null}}else alert("You must add a file to import.")}}function WordIndex(e){for(var t=0;tDo you really want to change the word \""+currentDictionary.words[parseInt(o)].name+'" to what you have set above?',s.innerHTML+='",s.innerHTML+=''):(c='No change has been made to "'+e+'"',currentDictionary.words[parseInt(o)].name!=e&&(c+=". (Your dictionary is currently set to ignore case.)"));else if(d>=0)if(WordAtIndexWasChanged(d,e,t,n,i,r)){document.getElementById("newWordButtonArea").style.display="none",DisableForm(),s.style.display="block";var l="\""+e+'" is already in the dictionary';l+=currentDictionary.words[d].name!=e?' as "'+currentDictionary.words[d].name+'", and your dictionary is set to ignore case.':".",l+=" Do you want to update it to what you have set above?",l+='",l+=' ',s.innerHTML=l}else c='"'+e+'" is already in the dictionary exactly as it is written above',currentDictionary.words[d].name!=e&&(c+=". (Your dictionary is currently set to ignore case.)");else currentDictionary.words.push({name:e,pronunciation:t,partOfSpeech:n,simpleDefinition:i,longDefinition:r,wordId:currentDictionary.nextWordId++}),FocusAfterAddingNewWord(),NewWordNotification(e),SaveAndUpdateDictionary(!1);a.innerHTML=""}a.innerHTML=c}function EditWord(e){SaveScroll(),wordFormIsLocked()&&window.scroll(0,0),ClearForm(),document.getElementById("editIndex").value=e.toString(),document.getElementById("word").value=htmlEntitiesParse(currentDictionary.words[e].name),document.getElementById("pronunciation").value=htmlEntitiesParse(currentDictionary.words[e].pronunciation),document.getElementById("partOfSpeech").value=htmlEntitiesParse(currentDictionary.words[e].partOfSpeech),document.getElementById("simpleDefinition").value=htmlEntitiesParse(currentDictionary.words[e].simpleDefinition),document.getElementById("longDefinition").value=htmlEntitiesParse(currentDictionary.words[e].longDefinition),document.getElementById("newWordButtonArea").style.display="none",document.getElementById("editWordButtonArea").style.display="block"}function UpdateWord(e,t,n,i,r,o){currentDictionary.words[e].name=t,currentDictionary.words[e].pronunciation=n,currentDictionary.words[e].partOfSpeech=i,currentDictionary.words[e].simpleDefinition=r,currentDictionary.words[e].longDefinition=o,SaveAndUpdateDictionary(),window.scroll(savedScroll.x,savedScroll.y),FocusAfterAddingNewWord()}function DeleteWord(e){""!=document.getElementById("editIndex").value&&ClearForm(),currentDictionary.words.splice(e,1),SaveAndUpdateDictionary(!0)}function ShowDictionary(){var e=document.getElementById("wordFilter").value,t=[],n=htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value),i=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,o=document.getElementById("searchOptionLong").checked,a=!document.getElementById("searchCaseSensitive").checked,c=document.getElementById("searchIgnoreDiacritics").checked;if(""!=n&&(i||r||o)){var s=[],d=htmlEntitiesParseForSearch(JSON.stringify(currentDictionary));a&&(n=n.toLowerCase()),c&&(n=removeDiacritics(n),d=removeDiacritics(d)),i&&s.push("contains("+(a?"name":'translate(name, "", "")')+', "'+n+'")'),r&&s.push("contains("+(a?"simpleDefinition":'translate(simpleDefinition, "", "")')+', "'+n+'")'),o&&s.push("contains("+(a?"longDefinition":'translate(longDefinition, "", "")')+', "'+n+'")');var l=JSON.parse(d);t=JSON.search(l,"//words["+s.join(" or ")+"]/wordId")}var u=document.getElementById("dictionaryName");u.innerHTML=htmlEntitiesParse(currentDictionary.name)+" Dictionary";var y=document.getElementById("dictionaryDescription");y.innerHTML=marked(htmlEntitiesParse(currentDictionary.description));var p=document.getElementById("theDictionary"),m="",D=0;if(currentDictionary.words.length>0)for(var g=0;g=0)&&(currentDictionary.words[g].hasOwnProperty("pronunciation")||(currentDictionary.words[g].pronunciation=""),currentDictionary.words[g].hasOwnProperty("wordId")||(currentDictionary.words[g].wordId=g+1),m+=DictionaryEntry(g),D++);else m="There are no entries in the dictionary.";p.innerHTML=m,ShowFilterWordCount(D)}function DictionaryEntry(e){displayPublic="undefined"!=typeof displayPublic&&null!=displayPublic?displayPublic:!1;var t="🔗",n=regexParseForSearch(document.getElementById("searchBox").value),i=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,o=document.getElementById("searchOptionLong").checked,a=!document.getElementById("searchCaseSensitive").checked,c=document.getElementById("searchIgnoreDiacritics").checked,s=new RegExp("("+(c?removeDiacritics(n)+"|"+n:n)+")","g"+(a?"i":""));return t+="",t+=""!=n&&i?htmlEntitiesParse(currentDictionary.words[e].name).replace(s,"$1"):currentDictionary.words[e].name,t+="",""!=currentDictionary.words[e].pronunciation&&(t+="",t+=marked(htmlEntitiesParse(currentDictionary.words[e].pronunciation)).replace("
"}function SaveSettings(){""!=htmlEntities(document.getElementById("dictionaryNameEdit").value)&&(currentDictionary.name=htmlEntities(document.getElementById("dictionaryNameEdit").value)),currentDictionary.description=htmlEntities(document.getElementById("dictionaryDescriptionEdit").value),CheckForPartsOfSpeechChange(),currentDictionary.settings.allowDuplicates=document.getElementById("dictionaryAllowDuplicates").checked,currentDictionary.settings.caseSensitive=document.getElementById("dictionaryCaseSensitive").checked,currentDictionary.settings.sortByEquivalent=document.getElementById("dictionarySortByEquivalent").checked,currentDictionary.settings.isComplete=document.getElementById("dictionaryIsComplete").checked,document.getElementById("dictionaryIsPublic")&&(currentDictionary.settings.isPublic=document.getElementById("dictionaryIsPublic").checked),HideSettingsWhenComplete(),SaveAndUpdateDictionary(!0),LoadUserDictionaries()}function EmptyWholeDictionary(){confirm("This will delete the entire current dictionary. If you do not have a backed up export, you will lose it forever!\n\nDo you still want to delete?")&&CreateNewDictionary()}function CreateNewDictionary(){ResetDictionaryToDefault(),SaveAndUpdateDictionary(!1),SetPartsOfSpeech(),HideSettings()}function DeleteCurrentDictionary(){if(confirm("This will delete the current dictionary from the database. If you do not have a backed up export, you will lose it forever!\n\nDo you still want to delete?")){ResetDictionaryToDefault();var e=new XMLHttpRequest;e.open("POST","php/ajax_dictionarymanagement.php?action=delete"),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){return 4==e.readyState&&200==e.status?(e.responseText.length<31?(console.log(e.responseText),CreateNewDictionary()):(HideSettings(),ShowDictionaryDeleteMenu(e.responseText),0==document.getElementById("loadAfterDelete").options.length&&(document.getElementById("loadAfterDeleteScreen").style.display="none",CreateNewDictionary())),!0):!1},e.send()}}function ResetDictionaryToDefault(){currentDictionary=JSON.parse(defaultDictionaryJSON)}function SaveAndUpdateDictionary(e){currentDictionary.settings.sortByEquivalent?currentDictionary.words.sort(dynamicSort(["simpleDefinition","partOfSpeech"])):currentDictionary.words.sort(dynamicSort(["name","partOfSpeech"])),SaveDictionary(!0,!0),ShowDictionary(),e||ClearForm(),CloseUpdateConflictArea("newWordButtonArea")}function SaveDictionary(e,t){localStorage.setItem("dictionary",JSON.stringify(currentDictionary)),e&&(t="undefined"!=typeof t?t:!1,SendDictionary(t)),SavePreviousDictionary()}function SendDictionary(e){e="undefined"!=typeof e?e:!1;var t="",n="";currentDictionary.externalID>0?(t="update",n=DataToSend(e)):(t="new",n=DataToSend(!0,!0));var i=new XMLHttpRequest;i.open("POST","php/ajax_dictionarymanagement.php?action="+t),i.setRequestHeader("Content-type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){return 4==i.readyState&&200==i.status?("updated successfully"==i.responseText?(console.log(i.responseText),LoadUserDictionaries(),ProcessLoad()):isNaN(parseInt(i.responseText))?console.log(i.responseText):(currentDictionary.externalID=parseInt(i.responseText),LoadUserDictionaries(),ProcessLoad(),console.log("saved successfully")),!0):!1},i.send(n)}function DataToSend(e,t){t="undefined"!=typeof t&&null!=t?t:!1;var n="";return 0==currentDictionary.externalID?(n="name="+encodeURIComponent(currentDictionary.name)+"&description="+encodeURIComponent(currentDictionary.description)+"&words="+encodeURIComponent(JSON.stringify(currentDictionary.words)),n+="&nextwordid="+currentDictionary.nextWordId+"&allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")+"&casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0"),n+="&partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)+"&sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")+"&iscomplete="+(currentDictionary.settings.isComplete?"1":"0")+"&ispublic="+(currentDictionary.settings.isPublic?"1":"0")):((t||currentDictionary.name!=previousDictionary.name)&&(n+="name="+encodeURIComponent(currentDictionary.name)),(t||currentDictionary.description!=previousDictionary.description)&&(n+=(""==n?"":"&")+"description="+encodeURIComponent(currentDictionary.description)),(t||e)&&(n+=(""==n?"":"&")+"words="+encodeURIComponent(JSON.stringify(currentDictionary.words))),(t||currentDictionary.nextWordId!=previousDictionary.nextWordId)&&(n+=(""==n?"":"&")+"nextwordid="+currentDictionary.nextWordId),(t||currentDictionary.settings.allowDuplicates!=previousDictionary.allowDuplicates)&&(n+=(""==n?"":"&")+"allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")),(t||currentDictionary.settings.caseSensitive!=previousDictionary.caseSensitive)&&(n+=(""==n?"":"&")+"casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0")),(t||currentDictionary.settings.partsOfSpeech!=previousDictionary.partsOfSpeech)&&(n+=(""==n?"":"&")+"partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)),(t||currentDictionary.settings.sortByEquivalent!=previousDictionary.sortByEquivalent)&&(n+=(""==n?"":"&")+"sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")),(t||currentDictionary.settings.isComplete!=previousDictionary.isComplete)&&(n+=(""==n?"":"&")+"iscomplete="+(currentDictionary.settings.isComplete?"1":"0")),(t||currentDictionary.settings.isPublic!=previousDictionary.isPublic)&&(n+=(""==n?"":"&")+"ispublic="+(currentDictionary.settings.isPublic?"1":"0"))),n}function LoadDictionary(){LoadLocalDictionary();var e=new XMLHttpRequest;e.open("GET","php/ajax_dictionarymanagement.php?action=load"),e.onreadystatechange=function(){4==e.readyState&&200==e.status&&("no dictionaries"==e.responseText?(currentDictionary.externalID=0,currentDictionary.settings.isPublic=!1,SendDictionary(!0)):e.responseText.length<60?console.log(e.responseText):(currentDictionary=JSON.parse(e.responseText),SaveDictionary(!1,!1))),ProcessLoad()},e.send()}function ChangeDictionary(e){if(e="undefined"!=typeof e&&null!=e?e:document.getElementById("userDictionaries"),currentDictionary.externalID!=e.value&&e.options.length>0){var t=new XMLHttpRequest;t.open("POST","php/ajax_dictionarymanagement.php?action=switch"),t.setRequestHeader("Content-type","application/x-www-form-urlencoded");var n="newdictionaryid="+e.value.toString();t.onreadystatechange=function(){4==t.readyState&&200==t.status&&("no dictionaries"==t.responseText?(console.log(t.responseText),SendDictionary(!1)):t.responseText.length<60?console.log(t.responseText):(currentDictionary=JSON.parse(t.responseText),SaveDictionary(!1,!1),ProcessLoad(),LoadUserDictionaries(),HideSettings()))},t.send(n)}}function LoadLocalDictionary(){if(localStorage.getItem("dictionary")){var e=JSON.parse(localStorage.getItem("dictionary"));(e.words.length>0||"A new dictionary."!=e.description||"New"!=e.name)&&(currentDictionary=JSON.parse(localStorage.getItem("dictionary"))),e=null}}function ProcessLoad(){currentDictionary.hasOwnProperty("nextWordId")||(currentDictionary.nextWordId=currentDictionary.words.length+1),HideSettingsWhenComplete(),ShowDictionary(),SetPartsOfSpeech(),currentDictionary.settings.isComplete&&(document.getElementById("wordEntryForm").style.display="none"),SavePreviousDictionary()}function SavePreviousDictionary(){previousDictionary={name:currentDictionary.name,description:currentDictionary.description,nextWordId:currentDictionary.nextWordId,allowDuplicates:currentDictionary.settings.allowDuplicates,caseSensitive:currentDictionary.settings.caseSensitive,partsOfSpeech:currentDictionary.settings.partsOfSpeech,sortByEquivalent:currentDictionary.settings.sortByEquivalent,isComplete:currentDictionary.settings.isComplete,isPublic:currentDictionary.settings.isPublic}}function ExportDictionary(){if(currentDictionary.words.length>0){var e=removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g,"");""==e&&(e="export"),download(e+".dict",localStorage.getItem("dictionary"))}else alert("Dictionary must have at least 1 word to export.")}function ImportDictionary(){if(currentDictionary.externalID>0||confirm("Importing this dictionary will overwrite your current one, making it impossible to retrieve if you have not already exported it! Do you still want to import?")){if(!window.FileReader)return alert("Your browser is not supported"),!1;var e=new FileReader;if(document.getElementById("importFile").files.length>0){var t=document.getElementById("importFile").files[0];e.readAsText(t),e.onloadend=function(){if(e.result&&e.result.length){var t=JSON.parse(e.result);if(t.hasOwnProperty("name")&&t.hasOwnProperty("description")&&t.hasOwnProperty("words")&&t.hasOwnProperty("settings"))currentDictionary=JSON.parse(e.result),currentDictionary.externalID=0,currentDictionary.settings.isPublic=!1,SaveDictionary(!0,!0),ProcessLoad(),HideSettings(),document.getElementById("importFile").value="";else{var n="File is missing:";t.hasOwnProperty("name")||(n+=" name"),t.hasOwnProperty("description")||(n+=" description"),t.hasOwnProperty("words")||(n+=" words"),t.hasOwnProperty("settings")||(n+=" settings"),alert("Uploaded file is not compatible.\n\n"+n)}t=null}else alert("Upload Failed");e=null}}else alert("You must add a file to import.")}}function WordIndex(e){for(var t=0;t/g,">").replace(/"/g,""").replace(/'/g,"'")}function i(e){return e.replace(/&([#\w]+);/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function l(e,t){return e=e.source,t=t||"",function n(r,s){return r?(s=s.source||s,s=s.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,s),n):new RegExp(e,t)}}function o(){}function h(e){for(var t,n,r=1;rAn error occured:
\n"},n.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+""+n+">\n"},n.prototype.strong=function(e){return""+e+""},n.prototype.em=function(e){return""+e+""},n.prototype.codespan=function(e){return""+e+""},n.prototype.br=function(){return this.options.xhtml?" ":" "},n.prototype.del=function(e){return""+e+""},n.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(i(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(s){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var l='"+n+""},n.prototype.image=function(e,t,n){var r='":">"},n.prototype.text=function(e){return e},r.parse=function(e,t,n){var s=new r(t,n);return s.parse(e)},r.prototype.parse=function(e){this.inline=new t(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var n="";this.next();)n+=this.tok();return n},r.prototype.next=function(){return this.token=this.tokens.pop()},r.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},r.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},r.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s,i="",l="";for(n="",e=0;eNote: This dictionary is not yet complete and is likely to change.");var y=document.getElementById("dictionaryDescription");y.innerHTML=marked(htmlEntitiesParse(publicDictionary.description));var h=document.getElementById("theDictionary"),D="",g=0;if(publicDictionary.words.length>0)for(var w=0;w=0)&&(publicDictionary.words[w].hasOwnProperty("pronunciation")||(publicDictionary.words[w].pronunciation=""),publicDictionary.words[w].hasOwnProperty("wordId")||(publicDictionary.words[w].wordId=w+1),D+=PublicDictionaryEntry(w),g++);else D="There are no entries in the dictionary.";h.innerHTML=D,ShowFilterWordCount(g)}else document.getElementById("dictionaryContainer").innerHTML=publicDictionary}function PublicDictionaryEntry(e){var i="🔗",t=regexParseForSearch(document.getElementById("searchBox").value),n=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,c=document.getElementById("searchOptionLong").checked,o=!document.getElementById("searchCaseSensitive").checked,a=document.getElementById("searchIgnoreDiacritics").checked,d=new RegExp("("+(a?removeDiacritics(t)+"|"+t:t)+")","g"+(o?"i":""));return i+="",i+=""!=t&&n?htmlEntitiesParse(publicDictionary.words[e].name).replace(d,"$1"):publicDictionary.words[e].name,i+="",""!=publicDictionary.words[e].pronunciation&&(i+="",i+=marked(htmlEntitiesParse(publicDictionary.words[e].pronunciation)).replace("
","").replace("
",""),i+=""),""!=publicDictionary.words[e].partOfSpeech&&(i+="",i+=publicDictionary.words[e].partOfSpeech,i+=""),i+=" ",""!=publicDictionary.words[e].simpleDefinition&&(i+="",i+=""!=t&&r?htmlEntitiesParse(publicDictionary.words[e].simpleDefinition).replace(d,"$1"):publicDictionary.words[e].simpleDefinition,i+=""),""!=publicDictionary.words[e].longDefinition&&(i+="",i+=""!=t&&c?marked(htmlEntitiesParse(publicDictionary.words[e].longDefinition).replace(d,"$1")):marked(htmlEntitiesParse(publicDictionary.words[e].longDefinition)),i+=""),i+=""}function SetPublicPartsOfSpeech(){for(var e=document.getElementById("wordFilter"),i=htmlEntitiesParse(publicDictionary.settings.partsOfSpeech).trim().split(","),t=0;tNote: This dictionary is not yet complete and is likely to change.");var y=document.getElementById("dictionaryDescription");y.innerHTML=marked(htmlEntitiesParse(publicDictionary.description));var h=document.getElementById("theDictionary"),D="",g=0;if(publicDictionary.words.length>0)for(var w=0;w=0)&&(publicDictionary.words[w].hasOwnProperty("pronunciation")||(publicDictionary.words[w].pronunciation=""),publicDictionary.words[w].hasOwnProperty("wordId")||(publicDictionary.words[w].wordId=w+1),D+=PublicDictionaryEntry(w),g++);else D="There are no entries in the dictionary.";h.innerHTML=D,ShowFilterWordCount(g)}else document.getElementById("dictionaryContainer").innerHTML=publicDictionary}function PublicDictionaryEntry(e){var i="🔗",t=regexParseForSearch(document.getElementById("searchBox").value),n=document.getElementById("searchOptionWord").checked,r=document.getElementById("searchOptionSimple").checked,c=document.getElementById("searchOptionLong").checked,o=!document.getElementById("searchCaseSensitive").checked,a=document.getElementById("searchIgnoreDiacritics").checked,d=new RegExp("("+(a?removeDiacritics(t)+"|"+t:t)+")","g"+(o?"i":""));return i+="",i+=""!=t&&n?htmlEntitiesParse(publicDictionary.words[e].name).replace(d,"$1"):publicDictionary.words[e].name,i+="",""!=publicDictionary.words[e].pronunciation&&(i+="",i+=marked(htmlEntitiesParse(publicDictionary.words[e].pronunciation)).replace("
","").replace("
",""),i+=""),""!=publicDictionary.words[e].partOfSpeech&&(i+="",i+=publicDictionary.words[e].partOfSpeech,i+=""),i+=" ",""!=publicDictionary.words[e].simpleDefinition&&(i+="",i+=""!=t&&r?htmlEntitiesParse(publicDictionary.words[e].simpleDefinition).replace(d,"$1"):publicDictionary.words[e].simpleDefinition,i+=""),""!=publicDictionary.words[e].longDefinition&&(i+="",i+=""!=t&&c?marked(htmlEntitiesParse(publicDictionary.words[e].longDefinition).replace(d,"$1")):marked(htmlEntitiesParse(publicDictionary.words[e].longDefinition)),i+=""),i+=""}function SetPublicPartsOfSpeech(){for(var e=document.getElementById("wordFilter"),i=htmlEntitiesParse(publicDictionary.settings.partsOfSpeech).trim().split(","),t=0;t0)for(var n=e.options.length-1;n>=0;n--)e.removeChild(e.options[n]);for(var o=t.split("_DICTIONARYSEPARATOR_"),i=0;i0?currentDictionary.externalID:""}function GetTextFile(e,t,n){n="undefined"!=typeof n?n:!1;var o=new XMLHttpRequest;o.open("GET",e),o.onreadystatechange=function(){4==o.readyState&&200==o.status&&(window[t]=n?marked(o.responseText):o.responseText)},o.send()}function ValidateLogin(){var e=document.getElementById("loginError"),t=document.getElementById("loginEmailField").value,n=document.getElementById("loginPasswordField").value;return""==t?(e.innerHTML="Email cannot be blank!",!1):/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t)?""==n?(e.innerHTML="Password cannot be blank!",!1):void document.getElementById("loginForm").submit():(e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1)}function ValidateCreateAccount(){var e=document.getElementById("createAccountError"),t=document.getElementById("createAccountEmailField").value,n=document.getElementById("createAccountPasswordField").value,o=document.getElementById("createAccountPasswordConfirmField").value,i=document.getElementById("createAccountPublicNameField").value;if(""==t)return e.innerHTML="Email cannot be blank!",!1;if(!/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t))return e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1;if(""==n)return e.innerHTML="Password cannot be blank!",!1;if(n!=o)return e.innerHTML="Passwords do not match!",!1;if(""==i)return e.innerHTML="Public Name cannot be blank!",!1;var r=new XMLHttpRequest;r.open("GET","php/ajax_createaccountemailcheck.php?email="+t),r.onreadystatechange=function(){if(4==r.readyState&&200==r.status){if("ok"!=r.responseText)return e.innerHTML="The email address entered is already being used. Try logging in or using a different email address instead.",!1;document.getElementById("createAccountForm").submit()}},r.send()}function ValidateAccountSettings(){var e=document.getElementById("accountSettingsError"),t=document.getElementById("accountSettingsEmailField").value,n=document.getElementById("accountSettingsPublicNameField").value;return""==t?(e.innerHTML="Email cannot be blank!",!1):/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t)?""==n?(e.innerHTML="Public Name cannot be blank!",!1):void document.getElementById("createAccountForm").submit():(e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1)}function ValidateForgotPassword(){var e=document.getElementById("forgotError"),t=document.getElementById("forgotEmailField").value;if(""==t)return e.innerHTML="Email cannot be blank!",!1;if(!/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t))return e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1;var n=new XMLHttpRequest;n.open("GET","php/ajax_passwordresetemailcheck.php?email="+t),n.onreadystatechange=function(){if(4==n.readyState&&200==n.status){if("email exists"!=n.responseText)return e.innerHTML="The email address entered is not in use and therefore can't have its password reset. Try creating an account instead!",!1;document.getElementById("forgotForm").submit()}},n.send()}function ValidateResetPassword(){var e=document.getElementById("resetPasswordError"),t=document.getElementById("newPasswordField").value,n=document.getElementById("newPasswordConfirmField").value;return""==t?(e.innerHTML="Password cannot be blank!",!1):t!=n?(e.innerHTML="Passwords do not match!",!1):void document.getElementById("resetPasswordForm").submit()}function WarnEmailChange(){var e=document.getElementById("accountSettingsEmailChangeWarning"),t=document.getElementById("accountSettingsEmailField").value,n=document.getElementById("accountSettingsPreviousEmailField").value;t!=n?e.style.display="block":e.style.display="none"}function LoggedInResetPassword(){var e=new XMLHttpRequest;e.open("GET","php/ajax_setnewpassword.php"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){if("done"!=e.responseText)return console.log(e.responseText),alert("Error resetting password.\n\nTry again later."),!1;window.location="./"}},e.send()}function ExplainPublicName(){alert("This is the name we greet you with. It's also the name displayed if you ever decide to share any of your dictionaries.\n\nNote: this is not a username, and as such is not guaranteed to be unique. Use something people will recognize you as to differentiate from other people who might use the same name!")}function ExplainAllowEmails(){alert("We'll make sure that you're the first to hear about any new features that get added or if any of our policies change for any reason. We'll never spam you or sell your information, but you may need to mark emails from lexicon.ga as not spam to receive them.\nNOTE: Password reset emails will be sent regardless of your choice.")}function wordFormIsLocked(){return"🔒"==document.getElementById("formLockButton").innerHTML}function ToggleWordFormLock(){wordFormIsLocked()?UnlockWordForm():LockWordForm()}function UnlockWordForm(){var e=document.getElementById("formLockButton"),t=document.getElementById("leftColumn"),n=document.getElementById("wordEntryForm"),o=n.offsetWidth-20,i=t.offsetWidth,r=t.offsetHeight;e.innerHTML="🔓",n.style.position="fixed",n.style.top=document.getElementsByTagName("header")[0].offsetHeight.toString()+"px",n.style.width=o.toString()+"px",t.style.width=i.toString()+"px",t.style.height=r.toString()+"px"}function LockWordForm(){var e=document.getElementById("formLockButton"),t=document.getElementById("leftColumn"),n=document.getElementById("wordEntryForm");e.innerHTML="🔒",t.removeAttribute("style"),n.removeAttribute("style")}function CloseUpdateConflictArea(e){e="undefined"!=typeof e&&null!=e?e:!1,0!=e&&(document.getElementById(e).style.display="block"),document.getElementById("updateConflict").style.display="none",EnableForm()}function DisableForm(){document.getElementById("word").disabled=!0,document.getElementById("pronunciation").disabled=!0,document.getElementById("partOfSpeech").disabled=!0,document.getElementById("simpleDefinition").disabled=!0,document.getElementById("longDefinition").disabled=!0,document.getElementById("editIndex").disabled=!0}function EnableForm(){document.getElementById("word").disabled=!1,document.getElementById("pronunciation").disabled=!1,document.getElementById("partOfSpeech").disabled=!1,document.getElementById("simpleDefinition").disabled=!1,document.getElementById("longDefinition").disabled=!1,document.getElementById("editIndex").disabled=!1}function ClearForm(){document.getElementById("wordEntryForm")&&(document.getElementById("word").value="",document.getElementById("pronunciation").value="",document.getElementById("partOfSpeech").value="",document.getElementById("simpleDefinition").value="",document.getElementById("longDefinition").value="",document.getElementById("editIndex").value="",document.getElementById("newWordButtonArea").style.display="block",document.getElementById("editWordButtonArea").style.display="none",document.getElementById("errorMessage").innerHTML="",document.getElementById("updateConflict").style.display="none",EnableForm())}function ToggleDescription(){var e=document.getElementById("descriptionToggle"),t=document.getElementById("dictionaryDescription");"none"==t.style.display?(t.style.display="block",e.innerHTML="Hide Description"):(t.style.display="none",e.innerHTML="Show Description")}function ToggleSearchFilter(){var e=document.getElementById("searchFilterToggle"),t=document.getElementById("searchFilterArea");"none"==t.style.display?(t.style.display="block",e.innerHTML="Hide Search/Filter Options"):(t.style.display="none",e.innerHTML="Search/Filter Options")}function ShowInfo(e){document.getElementById("infoText").innerHTML=window[e],"loginForm"==e&&(currentDictionary.words.length>0||"New"!=currentDictionary.name||"A new dictionary."!=currentDictionary.description)&&(document.getElementById("dictionaryWarn").innerHTML="If your current dictionary is not already saved to your account, be sure to export it before logging in so you don't lose anything!"),HideAccountSettings(),document.getElementById("infoPage").scrollTop=0,document.getElementById("infoScreen").style.display="block"}function HideInfo(){document.getElementById("infoScreen").style.display="none"}function ToggleAccountSettings(){if(document.getElementById("accountSettingsScreen")){var e=document.getElementById("accountSettingsScreen");"block"==e.style.display?HideAccountSettings():ShowAccountSettings()}}function ShowAccountSettings(e){document.getElementById("accountSettingsScreen")&&(document.getElementById("accountSettingsScreen").style.display="block"),HideInfo()}function HideAccountSettings(){document.getElementById("accountSettingsScreen")&&(document.getElementById("accountSettingsScreen").style.display="none")}function ToggleSettingsScreen(e){var t=document.getElementById("settingsScreen");"block"==t.style.display?(e&&SaveSettings(),HideSettings()):ShowSettings()}function ShowSettings(){document.getElementById("settingsScreen").style.display="block",document.getElementById("dictionaryNameEdit").value=htmlEntitiesParse(currentDictionary.name),document.getElementById("dictionaryDescriptionEdit").value=htmlEntitiesParse(currentDictionary.description),document.getElementById("dictionaryPartsOfSpeechEdit").value=htmlEntitiesParse(currentDictionary.settings.partsOfSpeech),document.getElementById("dictionaryAllowDuplicates").checked=currentDictionary.settings.allowDuplicates,document.getElementById("dictionaryCaseSensitive").checked=currentDictionary.settings.caseSensitive,document.getElementById("dictionarySortByEquivalent").checked=currentDictionary.settings.sortByEquivalent,document.getElementById("dictionaryIsComplete").checked=currentDictionary.settings.isComplete,document.getElementById("dictionaryIsPublic")&&(document.getElementById("dictionaryIsPublic").checked=currentDictionary.settings.isPublic,TogglePublicLink()),document.getElementById("numberOfWordsInDictionary").innerHTML=currentDictionary.words.length.toString()}function HideSettings(){document.getElementById("settingsScreen").style.display="none",currentDictionary.settings.isComplete?(LockWordForm(),document.getElementById("wordEntryForm").style.display="none"):document.getElementById("wordEntryForm").style.display="block"}function HideSettingsWhenComplete(){document.getElementById("settingsScreen")&&(currentDictionary.settings.isComplete?document.getElementById("hideIfComplete").style.display="none":document.getElementById("hideIfComplete").style.display="block")}function ShowFullScreenTextbox(e,t){var n=document.getElementById(e),o=document.getElementById("fullScreenTextbox");document.getElementById("fullScreenTextboxLabel").innerHTML=t;var i=getInputSelection(n);document.getElementById("expandedTextboxId").innerHTML=e,o.value=n.value,document.getElementById("fullScreenTextboxScreen").style.display="block",setSelectionRange(o,i.start,i.end)}function HideFullScreenTextbox(){var e=document.getElementById("expandedTextboxId").innerHTML,t=document.getElementById("fullScreenTextbox"),n=document.getElementById(e),o=getInputSelection(t);n.value=t.value,document.getElementById("fullScreenTextboxScreen").style.display="none",setSelectionRange(n,o.start,o.end)}function ShowDictionaryDeleteMenu(e){document.getElementById("loadAfterDeleteScreen").style.display="block",ParseUserDictionariesIntoSelect(document.getElementById("loadAfterDelete"),e),ParseUserDictionariesIntoSelect(document.getElementById("userDictionaries"),e)}function ToggleCaseSensitiveOption(){document.getElementById("dictionaryAllowDuplicates").checked?document.getElementById("dictionaryCaseSensitive").disabled=!0:document.getElementById("dictionaryCaseSensitive").disabled=!1}function TogglePublicLink(){if(document.getElementById("dictionaryIsPublic").checked){var e="http://lexicon.ga/"+currentDictionary.externalID;document.getElementById("publicLink").innerHTML="Public Link: "+e}else document.getElementById("publicLink").innerHTML=""}function SetPartsOfSpeech(){var e=document.getElementById("partOfSpeech"),t=document.getElementById("wordFilter"),n=t.value,o=!1;if(e.options.length>0)for(var i=e.options.length-1;i>=0;i--)e.removeChild(e.options[i]),t.removeChild(t.options[i+1]);for(var r=htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(","),d=0;d"+e+""}function FocusAfterAddingNewWord(){document.getElementById("word").focus()}
\ No newline at end of file
+function Initialize(){LoadDictionary(),ClearForm(),LoadUserDictionaries(),GetTextFile("README.md","aboutText",!0),GetTextFile("TERMS.md","termsText",!0),GetTextFile("PRIVACY.md","privacyText",!0),GetTextFile("LOGIN.form","loginForm",!1),GetTextFile("FORGOT.form","forgotForm",!1),SetKeyboardShortcuts()}function SetKeyboardShortcuts(){document.addEventListener("keydown",function(e){var t=e.which?e.which:e.keyCode;if(t==keyCodeFor("escape"))"block"==document.getElementById("infoScreen").style.display?HideInfo():"block"==document.getElementById("fullScreenTextboxScreen").style.display?HideFullScreenTextbox():"block"==document.getElementById("settingsScreen").style.display?HideSettings():document.getElementById("accountSettingsScreen")&&"block"==document.getElementById("accountSettingsScreen").style.display&&HideAccountSettings();else if(e.ctrlKey)if("none"==document.getElementById("fullScreenTextboxScreen").style.display)if(t==keyCodeFor("m"))"longDefinition"==document.activeElement.id?(e.preventDefault(),ShowFullScreenTextbox("longDefinition","Explanation/Long Definition")):"dictionaryDescriptionEdit"==document.activeElement.id?(e.preventDefault(),ShowFullScreenTextbox("dictionaryDescriptionEdit","Dictionary Details")):"fullScreenTextbox"==document.activeElement.id&&(e.preventDefault(),HideFullScreenTextbox());else if(t==keyCodeFor("u"))e.preventDefault(),ToggleWordFormLock();else if(t==keyCodeFor("d"))e.preventDefault(),ToggleDescription();else if(e.shiftKey&&t==keyCodeFor("s")||t==keyCodeFor("e"))e.preventDefault(),ExportDictionary();else if(t==keyCodeFor("s")){e.preventDefault();var n=document.getElementById("searchFilterToggle"),o=document.getElementById("searchFilterArea");"none"==o.style.display&&(o.style.display="block",n.innerHTML="Hide Search/Filter Options"),document.getElementById("searchBox").focus()}else t==keyCodeFor("h")&&(e.preventDefault(),ShowInfo("aboutText"));else t==keyCodeFor("m")?(e.preventDefault(),HideFullScreenTextbox()):t==keyCodeFor("u")?e.preventDefault():t==keyCodeFor("d")?e.preventDefault():e.shiftKey&&t==keyCodeFor("s")||t==keyCodeFor("e")?e.preventDefault():t==keyCodeFor("s")?e.preventDefault():t==keyCodeFor("h")&&e.preventDefault();else e.altKey&&"none"==document.getElementById("fullScreenTextboxScreen").style.display&&(t==keyCodeFor("s")?(e.preventDefault(),ToggleSettingsScreen(!0)):t==keyCodeFor("a")&&(e.preventDefault(),ToggleAccountSettings()))},!1)}function SubmitWordOnCtrlEnter(e){var t=event.which?event.which:event.keyCode;(t===keyCodeFor("ctrlEnter")||t==keyCodeFor("enter")&&event.ctrlKey)&&(event.preventDefault(),AddWord(),"none"==document.getElementById("newWordButtonArea").style.display&&"none"==document.getElementById("editWordButtonArea").style.display&&document.getElementById("updateConfirmButton").focus())}function LoadUserDictionaries(){var e=new XMLHttpRequest,t=document.getElementById("userDictionaries");null!=t&&(e.open("GET","php/ajax_dictionarymanagement.php?action=getall"),e.onreadystatechange=function(){4==e.readyState&&200==e.status&&ParseUserDictionariesIntoSelect(t,e.responseText)},e.send())}function ParseUserDictionariesIntoSelect(e,t){if(e.options.length>0)for(var n=e.options.length-1;n>=0;n--)e.removeChild(e.options[n]);for(var o=t.split("_DICTIONARYSEPARATOR_"),i=0;i0?currentDictionary.externalID:""}function GetTextFile(e,t,n){n="undefined"!=typeof n?n:!1;var o=new XMLHttpRequest;o.open("GET",e),o.onreadystatechange=function(){4==o.readyState&&200==o.status&&(window[t]=n?marked(o.responseText):o.responseText)},o.send()}function ValidateLogin(){var e=document.getElementById("loginError"),t=document.getElementById("loginEmailField").value,n=document.getElementById("loginPasswordField").value;return""==t?(e.innerHTML="Email cannot be blank!",!1):/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t)?""==n?(e.innerHTML="Password cannot be blank!",!1):void document.getElementById("loginForm").submit():(e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1)}function ValidateCreateAccount(){var e=document.getElementById("createAccountError"),t=document.getElementById("createAccountEmailField").value,n=document.getElementById("createAccountPasswordField").value,o=document.getElementById("createAccountPasswordConfirmField").value,i=document.getElementById("createAccountPublicNameField").value;if(""==t)return e.innerHTML="Email cannot be blank!",!1;if(!/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t))return e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1;if(""==n)return e.innerHTML="Password cannot be blank!",!1;if(n!=o)return e.innerHTML="Passwords do not match!",!1;if(""==i)return e.innerHTML="Public Name cannot be blank!",!1;var r=new XMLHttpRequest;r.open("GET","php/ajax_createaccountemailcheck.php?email="+t),r.onreadystatechange=function(){if(4==r.readyState&&200==r.status){if("ok"!=r.responseText)return e.innerHTML="The email address entered is already being used. Try logging in or using a different email address instead.",!1;document.getElementById("createAccountForm").submit()}},r.send()}function ValidateAccountSettings(){var e=document.getElementById("accountSettingsError"),t=document.getElementById("accountSettingsEmailField").value,n=document.getElementById("accountSettingsPublicNameField").value;return""==t?(e.innerHTML="Email cannot be blank!",!1):/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t)?""==n?(e.innerHTML="Public Name cannot be blank!",!1):void document.getElementById("createAccountForm").submit():(e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1)}function ValidateForgotPassword(){var e=document.getElementById("forgotError"),t=document.getElementById("forgotEmailField").value;if(""==t)return e.innerHTML="Email cannot be blank!",!1;if(!/[^\s@]+@[^\s@]+\.[^\s@]+/.test(t))return e.innerHTML="Your email address looks fake. Email addresses look like this: name@email.com.",!1;var n=new XMLHttpRequest;n.open("GET","php/ajax_passwordresetemailcheck.php?email="+t),n.onreadystatechange=function(){if(4==n.readyState&&200==n.status){if("email exists"!=n.responseText)return e.innerHTML="The email address entered is not in use and therefore can't have its password reset. Try creating an account instead!",!1;document.getElementById("forgotForm").submit()}},n.send()}function ValidateResetPassword(){var e=document.getElementById("resetPasswordError"),t=document.getElementById("newPasswordField").value,n=document.getElementById("newPasswordConfirmField").value;return""==t?(e.innerHTML="Password cannot be blank!",!1):t!=n?(e.innerHTML="Passwords do not match!",!1):void document.getElementById("resetPasswordForm").submit()}function WarnEmailChange(){var e=document.getElementById("accountSettingsEmailChangeWarning"),t=document.getElementById("accountSettingsEmailField").value,n=document.getElementById("accountSettingsPreviousEmailField").value;t!=n?e.style.display="block":e.style.display="none"}function LoggedInResetPassword(){var e=new XMLHttpRequest;e.open("GET","php/ajax_setnewpassword.php"),e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){if("done"!=e.responseText)return console.log(e.responseText),alert("Error resetting password.\n\nTry again later."),!1;window.location="./"}},e.send()}function ExplainPublicName(){alert("This is the name we greet you with. It's also the name displayed if you ever decide to share any of your dictionaries.\n\nNote: this is not a username, and as such is not guaranteed to be unique. Use something people will recognize you as to differentiate from other people who might use the same name!")}function ExplainAllowEmails(){alert("We'll make sure that you're the first to hear about any new features that get added or if any of our policies change for any reason. We'll never spam you or sell your information, but you may need to mark emails from lexicon.ga as not spam to receive them.\nNOTE: Password reset emails will be sent regardless of your choice.")}function wordFormIsLocked(){return"🔒"==document.getElementById("formLockButton").innerHTML}function ToggleWordFormLock(){wordFormIsLocked()?UnlockWordForm():LockWordForm()}function UnlockWordForm(){var e=document.getElementById("formLockButton"),t=document.getElementById("leftColumn"),n=document.getElementById("wordEntryForm"),o=n.offsetWidth-20,i=t.offsetWidth,r=t.offsetHeight;e.innerHTML="🔓",n.style.position="fixed",n.style.top=document.getElementsByTagName("header")[0].offsetHeight.toString()+"px",n.style.width=o.toString()+"px",t.style.width=i.toString()+"px",t.style.height=r.toString()+"px"}function LockWordForm(){var e=document.getElementById("formLockButton"),t=document.getElementById("leftColumn"),n=document.getElementById("wordEntryForm");e.innerHTML="🔒",t.removeAttribute("style"),n.removeAttribute("style")}function CloseUpdateConflictArea(e){e="undefined"!=typeof e&&null!=e?e:!1,0!=e&&(document.getElementById(e).style.display="block"),document.getElementById("updateConflict").style.display="none",EnableForm()}function DisableForm(){document.getElementById("word").disabled=!0,document.getElementById("pronunciation").disabled=!0,document.getElementById("partOfSpeech").disabled=!0,document.getElementById("simpleDefinition").disabled=!0,document.getElementById("longDefinition").disabled=!0,document.getElementById("editIndex").disabled=!0}function EnableForm(){document.getElementById("word").disabled=!1,document.getElementById("pronunciation").disabled=!1,document.getElementById("partOfSpeech").disabled=!1,document.getElementById("simpleDefinition").disabled=!1,document.getElementById("longDefinition").disabled=!1,document.getElementById("editIndex").disabled=!1}function ClearForm(){document.getElementById("wordEntryForm")&&(document.getElementById("word").value="",document.getElementById("pronunciation").value="",document.getElementById("partOfSpeech").value="",document.getElementById("simpleDefinition").value="",document.getElementById("longDefinition").value="",document.getElementById("editIndex").value="",document.getElementById("newWordButtonArea").style.display="block",document.getElementById("editWordButtonArea").style.display="none",document.getElementById("errorMessage").innerHTML="",document.getElementById("updateConflict").style.display="none",EnableForm())}function ToggleDescription(){var e=document.getElementById("descriptionToggle"),t=document.getElementById("dictionaryDescription");"none"==t.style.display?(t.style.display="block",e.innerHTML="Hide Description"):(t.style.display="none",e.innerHTML="Show Description")}function ToggleSearchFilter(){var e=document.getElementById("searchFilterToggle"),t=document.getElementById("searchFilterArea");"none"==t.style.display?(t.style.display="block",e.innerHTML="Hide Search/Filter Options"):(t.style.display="none",e.innerHTML="Search/Filter Options")}function ShowInfo(e){document.getElementById("infoText").innerHTML=window[e],"loginForm"==e&&(currentDictionary.words.length>0||"New"!=currentDictionary.name||"A new dictionary."!=currentDictionary.description)&&(document.getElementById("dictionaryWarn").innerHTML="If your current dictionary is not already saved to your account, be sure to export it before logging in so you don't lose anything!"),HideAccountSettings(),document.getElementById("infoPage").scrollTop=0,document.getElementById("infoScreen").style.display="block"}function HideInfo(){document.getElementById("infoScreen").style.display="none"}function ToggleAccountSettings(){if(document.getElementById("accountSettingsScreen")){var e=document.getElementById("accountSettingsScreen");"block"==e.style.display?HideAccountSettings():ShowAccountSettings()}}function ShowAccountSettings(e){document.getElementById("accountSettingsScreen")&&(document.getElementById("accountSettingsScreen").style.display="block"),HideInfo()}function HideAccountSettings(){document.getElementById("accountSettingsScreen")&&(document.getElementById("accountSettingsScreen").style.display="none")}function ToggleSettingsScreen(e){var t=document.getElementById("settingsScreen");"block"==t.style.display?(e&&SaveSettings(),HideSettings()):ShowSettings()}function ShowSettings(){document.getElementById("settingsScreen").style.display="block",document.getElementById("dictionaryNameEdit").value=htmlEntitiesParse(currentDictionary.name),document.getElementById("dictionaryDescriptionEdit").value=htmlEntitiesParse(currentDictionary.description),document.getElementById("dictionaryPartsOfSpeechEdit").value=htmlEntitiesParse(currentDictionary.settings.partsOfSpeech),document.getElementById("dictionaryAllowDuplicates").checked=currentDictionary.settings.allowDuplicates,document.getElementById("dictionaryCaseSensitive").checked=currentDictionary.settings.caseSensitive,document.getElementById("dictionarySortByEquivalent").checked=currentDictionary.settings.sortByEquivalent,document.getElementById("dictionaryIsComplete").checked=currentDictionary.settings.isComplete,document.getElementById("dictionaryIsPublic")&&(document.getElementById("dictionaryIsPublic").checked=currentDictionary.settings.isPublic,TogglePublicLink()),document.getElementById("numberOfWordsInDictionary").innerHTML=currentDictionary.words.length.toString()}function HideSettings(){document.getElementById("settingsScreen").style.display="none",currentDictionary.settings.isComplete?(LockWordForm(),document.getElementById("wordEntryForm").style.display="none"):document.getElementById("wordEntryForm").style.display="block"}function HideSettingsWhenComplete(){document.getElementById("settingsScreen")&&(currentDictionary.settings.isComplete?document.getElementById("hideIfComplete").style.display="none":document.getElementById("hideIfComplete").style.display="block")}function ShowFullScreenTextbox(e,t){var n=document.getElementById(e),o=document.getElementById("fullScreenTextbox");document.getElementById("fullScreenTextboxLabel").innerHTML=t;var i=getInputSelection(n);document.getElementById("expandedTextboxId").innerHTML=e,o.value=n.value,document.getElementById("fullScreenTextboxScreen").style.display="block",setSelectionRange(o,i.start,i.end)}function HideFullScreenTextbox(){var e=document.getElementById("expandedTextboxId").innerHTML,t=document.getElementById("fullScreenTextbox"),n=document.getElementById(e),o=getInputSelection(t);n.value=t.value,document.getElementById("fullScreenTextboxScreen").style.display="none",setSelectionRange(n,o.start,o.end)}function ShowDictionaryDeleteMenu(e){document.getElementById("loadAfterDeleteScreen").style.display="block",ParseUserDictionariesIntoSelect(document.getElementById("loadAfterDelete"),e),ParseUserDictionariesIntoSelect(document.getElementById("userDictionaries"),e)}function ToggleCaseSensitiveOption(){document.getElementById("dictionaryAllowDuplicates").checked?document.getElementById("dictionaryCaseSensitive").disabled=!0:document.getElementById("dictionaryCaseSensitive").disabled=!1}function TogglePublicLink(){if(document.getElementById("dictionaryIsPublic").checked){var e="http://lexicon.ga/"+currentDictionary.externalID;document.getElementById("publicLink").innerHTML="Public Link: "+e}else document.getElementById("publicLink").innerHTML=""}function SetPartsOfSpeech(){var e=document.getElementById("partOfSpeech"),t=document.getElementById("wordFilter"),n=t.value,o=!1;if(e.options.length>0)for(var i=e.options.length-1;i>=0;i--)e.removeChild(e.options[i]),t.removeChild(t.options[i+1]);for(var r=htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(","),d=0;d"+e+""}function FocusAfterAddingNewWord(){document.getElementById("word").focus()}