From a3437771f51eaa80cba16df3e4697d02df601266 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Mon, 3 Apr 2017 22:24:14 -0600 Subject: [PATCH] Remove everything to start a full rewrite. --- .babelrc | 4 - .gitignore | 7 +- EXPORT.form | 18 - FORGOT.form | 10 - IMPORT.form | 23 - LOGIN.form | 36 - PRIVACY.md | 49 - TERMS.md | 40 - announcement.php | 1 - css/lexiconga.css | 149 -- css/mobile.css | 134 -- css/styles.css | 453 ------ import_test.csv | 4 - index.php | 459 ------ js/defiant.js | 687 --------- js/dictionaryBuilder.js | 880 ------------ js/helpers.js | 256 ---- js/marked.js | 1285 ----------------- js/min/defiant.js | 12 - js/min/dictionaryBuilder.js | 1 - js/min/helpers.js | 1 - js/min/marked.js | 6 - js/min/papaparse.js | 6 - js/min/publicView.js | 1 - js/min/removeDiacritics.js | 16 - js/min/ui.js | 1 - js/papaparse.js | 1423 ------------------- js/publicView.js | 194 --- js/removeDiacritics.js | 118 -- js/ui.js | 714 ---------- package.json | 53 +- php/ajax_createaccountemailcheck.php | 13 - php/ajax_dictionarymanagement.php | 345 ----- php/ajax_passwordresetemailcheck.php | 13 - php/config.php | 13 - php/display.php | 11 - php/functions.php | 10 - php/helpers.php | 85 -- php/notificationconditiontree.php | 211 --- php/passwordreset.php | 53 - php/plugins/easycrypt.php | 43 - php/validation.php | 104 -- favicon.ico => public/favicon.ico | Bin public/index.html | 17 + required.php | 5 - src/components/display/FixedPage.jsx | 81 -- src/components/display/InfoDisplay.jsx | 121 -- src/components/display/Word.jsx | 174 --- src/components/forms/EditDictionaryForm.jsx | 100 -- src/components/forms/EditWordForm.jsx | 28 - src/components/forms/WordForm.jsx | 139 -- src/components/input/Button.jsx | 37 - src/components/input/Checkbox.jsx | 37 - src/components/input/Dropdown.jsx | 74 - src/components/input/Input.jsx | 116 -- src/components/input/TextArea.jsx | 70 - src/components/login.js | 36 - src/components/structure/Dictionary.jsx | 44 - src/components/structure/Footer.jsx | 48 - src/components/structure/Header.jsx | 114 -- src/index.html | 17 - src/index.jsx | 382 ++--- src/js/IDManager.js | 13 - src/js/app.js | 877 ------------ src/js/dependencies/defiant.js | 7 - src/js/dependencies/removeDiacritics.js | 118 -- src/js/helpers.js | 258 ---- src/js/publicView.js | 194 --- src/js/ui.js | 714 ---------- src/sass/_lexiconga.scss | 175 --- src/sass/_mobile.scss | 134 -- src/sass/_styles.scss | 490 ------- src/sass/_variables.scss | 12 - src/sass/main.scss | 4 - webpack.config.js | 108 +- yarn.lock | 1383 +++++++----------- 76 files changed, 669 insertions(+), 13400 deletions(-) delete mode 100644 .babelrc delete mode 100644 EXPORT.form delete mode 100644 FORGOT.form delete mode 100644 IMPORT.form delete mode 100644 LOGIN.form delete mode 100644 PRIVACY.md delete mode 100644 TERMS.md delete mode 100644 announcement.php delete mode 100644 css/lexiconga.css delete mode 100644 css/mobile.css delete mode 100644 css/styles.css delete mode 100644 import_test.csv delete mode 100644 index.php delete mode 100644 js/defiant.js delete mode 100644 js/dictionaryBuilder.js delete mode 100644 js/helpers.js delete mode 100644 js/marked.js delete mode 100644 js/min/defiant.js delete mode 100644 js/min/dictionaryBuilder.js delete mode 100644 js/min/helpers.js delete mode 100644 js/min/marked.js delete mode 100644 js/min/papaparse.js delete mode 100644 js/min/publicView.js delete mode 100644 js/min/removeDiacritics.js delete mode 100644 js/min/ui.js delete mode 100644 js/papaparse.js delete mode 100644 js/publicView.js delete mode 100644 js/removeDiacritics.js delete mode 100644 js/ui.js delete mode 100644 php/ajax_createaccountemailcheck.php delete mode 100644 php/ajax_dictionarymanagement.php delete mode 100644 php/ajax_passwordresetemailcheck.php delete mode 100644 php/config.php delete mode 100644 php/display.php delete mode 100644 php/functions.php delete mode 100644 php/helpers.php delete mode 100644 php/notificationconditiontree.php delete mode 100644 php/passwordreset.php delete mode 100644 php/plugins/easycrypt.php delete mode 100644 php/validation.php rename favicon.ico => public/favicon.ico (100%) create mode 100644 public/index.html delete mode 100644 required.php delete mode 100644 src/components/display/FixedPage.jsx delete mode 100644 src/components/display/InfoDisplay.jsx delete mode 100644 src/components/display/Word.jsx delete mode 100644 src/components/forms/EditDictionaryForm.jsx delete mode 100644 src/components/forms/EditWordForm.jsx delete mode 100644 src/components/forms/WordForm.jsx delete mode 100644 src/components/input/Button.jsx delete mode 100644 src/components/input/Checkbox.jsx delete mode 100644 src/components/input/Dropdown.jsx delete mode 100644 src/components/input/Input.jsx delete mode 100644 src/components/input/TextArea.jsx delete mode 100644 src/components/login.js delete mode 100644 src/components/structure/Dictionary.jsx delete mode 100644 src/components/structure/Footer.jsx delete mode 100644 src/components/structure/Header.jsx delete mode 100644 src/index.html delete mode 100644 src/js/IDManager.js delete mode 100644 src/js/app.js delete mode 100644 src/js/dependencies/defiant.js delete mode 100644 src/js/dependencies/removeDiacritics.js delete mode 100644 src/js/helpers.js delete mode 100644 src/js/publicView.js delete mode 100644 src/js/ui.js delete mode 100644 src/sass/_lexiconga.scss delete mode 100644 src/sass/_mobile.scss delete mode 100644 src/sass/_styles.scss diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 57d1d41..0000000 --- a/.babelrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "presets": [ "es2015" ], - "plugins": [ "inferno" ] -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 829df86..ca6a504 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -php/google/ -node_modules/ -public/ .idea/ +node_modules/ + +public/*.js +public/*.map diff --git a/EXPORT.form b/EXPORT.form deleted file mode 100644 index bbadae5..0000000 --- a/EXPORT.form +++ /dev/null @@ -1,18 +0,0 @@ -

Export

-
-
- -

This process exports all of the words in the dictionary as a CSV format file.

-

You can either use the exported file to re-import them into a different dictionary in Lexiconga, or taken and used somewhere else you might need them!

- -
-
- -
-
diff --git a/FORGOT.form b/FORGOT.form deleted file mode 100644 index 54a057f..0000000 --- a/FORGOT.form +++ /dev/null @@ -1,10 +0,0 @@ -
-

Forgot Password

- -
- -
- Log In/Create Account -
diff --git a/IMPORT.form b/IMPORT.form deleted file mode 100644 index 86429ba..0000000 --- a/IMPORT.form +++ /dev/null @@ -1,23 +0,0 @@ -

Import

-
-
- -

This process imports words in a CSV format to the currently loaded dictionary. (Note: You can save an Excel file as a CSV)

-

The CSV file must have a header line in this order: word,pronunciation,part of speech,definition,explanation. Your word data must be in the appropriate order according to the headers. You can use this CSV file as a template if you need help.

-

Make sure the parts of speech for each word correspond to your dictionary's parts of speech or else you won't be able to find it using a filter. If a part of speech is left blank, you can find the blanks using the "Blank" option in the Filter so you can clean up.

-

At a minimum, all of your words must have the "word" field and either the "definition" or "explanation" field filled out in the CSV file.

- - -
-
- -
-
diff --git a/LOGIN.form b/LOGIN.form deleted file mode 100644 index 3990acc..0000000 --- a/LOGIN.form +++ /dev/null @@ -1,36 +0,0 @@ -
-

Log In

- - -
- -
- Forgot Password? -
-
-

Create a New Account

-

Creating an account allows you to save and switch between as many dictionaries as you need and access them from any device for free! If you have a dictionary you've been working on loaded already, it will automatically be uploaded to your account when you log in for the first time.

-

Plus if you allow us to send you emails, 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.

-

By creating an account, you are indicating that you agree to the Terms of Service and that you understand Lexiconga's Privacy Policy.

- - - - - ? -
- -
diff --git a/PRIVACY.md b/PRIVACY.md deleted file mode 100644 index 4781b29..0000000 --- a/PRIVACY.md +++ /dev/null @@ -1,49 +0,0 @@ -## Privacy Policy - -This document was last updated on November 02, 2015. - -This Privacy Policy governs the manner in which Lexiconga Dictionary Builder collects, uses, maintains and discloses information collected from users (each, a "User") of the http://lexicon.ga website ("Site") and its accounts ("Account"). - -### Personal identification information -We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, register on the site, and in connection with other activities, services, features or resources we make available on our Site. Users may be asked for, as appropriate, their name and email address. Users may, however, use our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personal identification information, except that it may prevent them from engaging in certain Site-related activities. - -### Non-personal identification information -We may collect non-personal identification information about Users whenever they interact with our Site through website analytics tools. Non-personal identification information may include the browser name, the type of computer and technical information about Users means of connection to our Site, such as the operating system and the Internet service providers utilized and other similar information. - -### Web browser cookies -Our Site does not use "cookies" to enhance User experience, but it does use "local storage". User's web browser places local storage on their hard drive for record-keeping purposes and sometimes to track information about them, but we only use this to store your current dictionary. User may choose to set their web browser to refuse local storage usage, but if they do so, the Site will not function properly. - -### How we use collected information -Lexiconga Dictionary Builder may collect and use Users personal information for the following purposes: -- **To run and operate our Site and personalize user experience:** We need your input to display content on the Site correctly, because it is a tool built entirely to display the content that you enter. - -### How we protect your information -If you are utilizing an Account, we protect your information by keeping your information on a trusted database server provided by the Site's web host. All data you save from an Account is uploaded to this database server from your browser. - -If you utilize the ability to make dictionaries associated with an Account visible to the public, you accept all responsibility for its content being visible to anyone who might find it. We cannot protect what you willingly put in public, and we do not accept liability if information you place online is used against you somehow. Never put personal information online! - -If you are not using an Account, then all of your information remains right on your own computer where it belongs. As mentioned previously, all data is stored in your browser's "local storage". - -### Sharing your personal information -We do not sell, trade, or rent Users personal identification information to others. We may share generic aggregated demographic information not linked to any personal identification information regarding visitors and users with our business partners, trusted affiliates and advertisers for the purposes outlined above. - -### Electronic newsletters -If User decides to opt-in to our mailing list, they will receive emails that may include company news, updates, related product or service information, etc. We may use third party service providers like MailChimp to help us operate our business and the Site or administer activities on our behalf, such as sending out newsletters or surveys. We may share your information with these third parties for those limited purposes provided that you have given us your permission. - -### Third party websites -Users may find advertising or other content on our Site that link to the sites and services of our partners, suppliers, advertisers, sponsors, licencors and other third parties. We do not control the content or links that appear on these sites and are not responsible for the practices employed by websites linked to or from our Site. In addition, these sites or services, including their content and links, may be constantly changing. These sites and services may have their own privacy policies and customer service policies. Browsing and interaction on any other website, including websites which have a link to our Site, is subject to that website's own terms and policies. - -### Advertising -Ads appearing on our site may be delivered to Users by advertising partners, who may set cookies. These cookies allow the ad server to recognize your computer each time they send you an online advertisement to compile non personal identification information about you or others who use your computer. This information allows ad networks to, among other things, deliver targeted advertisements that they believe will be of most interest to you. This privacy policy does not cover the use of cookies by any advertisers. - -### Google Adsense -Some of the ads may be served by Google. Google's use of the DART cookie enables it to serve ads to Users based on their visit to our Site and other sites on the Internet. DART uses "non personally identifiable information" and does NOT track personal information about you, such as your name, email address, physical address, etc. You may opt out of the use of the DART cookie by visiting the Google ad and content network privacy policy at [http://www.google.com/policies/technologies/ads/](http://www.google.com/policies/technologies/ads/) - -### Changes to this privacy policy -Lexiconga Dictionary Builder has the discretion to update this privacy policy at any time. When we do, we will post a notification on the main page of our Site. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications. - -### Your acceptance of these terms -By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes. This policy was originally generated using PrivacyPolicies.com and modified for our use. - -### Contacting us -If you have any questions about this Privacy Policy, the practices of this site, or your dealings with this site, please contact us by email at help (at) lexicon (dot) ga or follow us Twitter @alamantus. diff --git a/TERMS.md b/TERMS.md deleted file mode 100644 index ecf4c5b..0000000 --- a/TERMS.md +++ /dev/null @@ -1,40 +0,0 @@ -## Terms of Service ("Terms") - -Last updated: November 1, 2015. - -Please read these Terms of Service ("Terms", "Terms of Service") carefully before using the http://lexicon.ga website (the "Service") or the cloud account service (an "Account") operated by Robbie Antenesse and Alamantus GameDev ("us", "we", or "our"). - -Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. These Terms apply to all visitors, users and others who access or use the Service. By accessing or using the Service you agree to be bound by these Terms. If you disagree with any part of the terms then you may not access the Service. - -### Usage -You may use our Service free of charge, and you are free to stop using our Service at any time. If you are utilizing an Account with our Service, you agree to never attempt maliciously dismantling the Service in any way or to use the Service in a way that is unlawful. If you are found in violation of this, your Account and access to the Service may be terminated without warning. - -If you stop using our Service, your data will remain unless you request its removal. When data is removed from an Account in our Service, it becomes permanently irretrievable. You agree that you understand the implications of deleting or requesting the deletion of your data and that we are not liable for its loss. - -Instructions for use are visible through the "About Lexiconga" button on the site. - -### Public Dictionaries -Any dictionaries created and associated with an Account are private by default and only visible to the owner of the Account. You may make your dictionaries visible to the public at any time by utilizing the appropriate dictionarys setting. - -If you utilize the ability to make dictionaries associated with an Account visible to the public, you accept all responsibility for any and all damages that may come as a result of the information you place online and acknowledge that we are not liable in any way. Do not put any personal information online. We cannot protect what you deliberately make publicly visible. - -### Termination -We may terminate or suspend access to our Service immediately, without prior notice or liability, for any reason whatsoever, including without limitation if you breach the Terms. All provisions of the Terms which by their nature should survive termination shall survive termination, including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of liability. - -### Links To Other Web Sites -Our Service may contain links to third-party web sites or services that are not owned or controlled by Robbie Antenesse and Alamantus GameDev. - -Robbie Antenesse and Alamantus GameDev has no control over, and assumes no responsibility for, the content, privacy policies, or practices of any third party web sites or services. You further acknowledge and agree that Robbie Antenesse and Alamantus GameDev shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such web sites or services. - -We strongly advise you to read the terms and conditions and privacy policies of any third-party web sites or services that you visit. - -### Governing Law -These Terms shall be governed and construed in accordance with the laws of the United States of America, without regard to its conflict of law provisions. Our failure to enforce any right or provision of these Terms will not be considered a waiver of those rights. If any provision of these Terms is held to be invalid or unenforceable by a court, the remaining provisions of these Terms will remain in effect. These Terms constitute the entire agreement between us regarding our Service, and supersede and replace any prior agreements we might have between us regarding the Service. - -### Changes -We reserve the right, at our sole discretion, to modify or replace these Terms at any time. If a revision is material we will try to provide at least 5 days notice prior to any new terms taking effect. What constitutes a material change will be determined at our sole discretion. - -By continuing to access or use our Service after those revisions become effective, you agree to be bound by the revised terms. If you do not agree to the new terms, please stop using the Service. - -### Contact Us -If you have any questions about these Terms, please contact us by email at help (at) lexicon (dot) ga or follow us on Twitter @alamantus. diff --git a/announcement.php b/announcement.php deleted file mode 100644 index 84c462c..0000000 --- a/announcement.php +++ /dev/null @@ -1 +0,0 @@ -[Release Date] | So much has been updated! Check the Updates page to see all the changes! diff --git a/css/lexiconga.css b/css/lexiconga.css deleted file mode 100644 index 679d8f4..0000000 --- a/css/lexiconga.css +++ /dev/null @@ -1,149 +0,0 @@ -body { - background: #e6cfaa; -} - -header { - background: #eacc9d; -} - -tr, thead { - border-bottom: 1px solid #af8050; -} -td, th { - border-right: 1px solid #af8050; -} - -a { - text-decoration: underline; - color: #a01000; -} - -#siteLogo { - display: block; - text-indent: -9999px; - width: 242px; - height: 48px; - background: url(../images/logo.svg); - background-size: 242px 48px; - float: left; -} - -#aboutButton { -} - -#loginoutArea { - float: right; -} - -#loginoutArea a { - color: #000000; - text-decoration: none; - font-size: 13px; -} - -@media screen -and (min-device-width : 481px) { - #headerPadder { - padding: 1px; - } - - #loginoutArea { - margin: 16px; - } -} - -/* Smartphones (portrait and landscape) ----------- */ -@media only screen -and (max-device-width : 480px) { - #siteLogo { - display: block; - text-indent: -9999px; - width: 150px; - height: 30px; - background: url(../images/logo.svg); - background-size: 150px 30px; - float: left; - } - - #loginoutArea { - margin: 16px 8px; - } -} - -#wordEntryForm { - background: #ba5536; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - border: none; -} - -input, textarea, select, option { - background: #efdfc0; -} - -#announcementArea { - background: #a0c066; -} - -#notificationArea { - background: #c0c088; -} - -#dictionaryColumn { - background: #bd7251; - border: none; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -} - -#settingsOptions, #infoPage, #loadAfterDeletePage, #accountSettingsPage, #fullScreenTextboxPage { - background: #f2d5b2; -} - -.management { - border-width: 2px; - border: none; -} - -#dictionaryName { - text-shadow: 2px 2px 2px #915337; -} - -#dictionaryShareLink { - text-shadow: none; -} - -#dictionaryDescription { - width: 90%; - background: #f2d5b2; -} - -#loginLink, #logoutLink, #descriptionToggle, #searchFilterToggle, #settingsButton, .deleteCancelButton, .deleteConfirmButton, #settingsScreenCloseButton, #infoScreenCloseButton, .clickable, button { - background: #dcb078; -} - -entry { - background: #d7ad7d; - border: none; - -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); - -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); - box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); -} - -.editButton { - background: #86ac41; -} - -.deleteButton { - background: #ba5536; -} - -footer { - background: #cb6318; - border: none; - -webkit-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); - -moz-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); - box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); -} \ No newline at end of file diff --git a/css/mobile.css b/css/mobile.css deleted file mode 100644 index 1aea062..0000000 --- a/css/mobile.css +++ /dev/null @@ -1,134 +0,0 @@ -/* Smartphones (portrait and landscape) ----------- */ -@media screen -and (max-width : 910px) { - body { - font-size: 11pt; - } - - header { - height: 70px; - } - - footer { - position: relative; - clear: both; - max-height: 100%; - } - - #announcementArea, #notificationArea { - width: 80%; - } - - #leftColumn { - width: 100%; - margin: 0; - } - - #wordEntryForm { - padding: 8px 0; - width: 100%; - max-width: 450px; - margin: 10px auto; - } - - #wordEntryForm label { - overflow: hidden; - display: flex; - justify-content: center; - font-size: 10pt; - } - - #wordEntryForm label span { - float: left; - width: 30%; - text-align: right; - margin-right: 8px; - } - - #wordEntryForm input, #wordEntryForm select, #wordEntryForm textarea { - float: right; - width: 60%; - margin-right: 8px; - align-self: center; - } - - .longDefinition { - min-width: 200px; - height: 80px; - } - - #wordEntryForm button { - display: block; - width: 50%; - height: 30px; - margin: 0px auto; - } - - #mobileWordFormPullout { - position: fixed; - top: 7%; - left: 0; - width: 32px; - height: 32px; - font-size: 20px; - font-weight: bold; - text-align: center; - padding: 6px; - background: #86ac41; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - border: none; - cursor: pointer; - } - - #dictionaryColumn { - width: 100%; - margin: 0; - padding: 0; - } - - #dictionaryContent { - margin: 0 auto; - padding: 15px; - } - - #dictionaryDescription { - margin: 0 auto; - } - - #searchFilterArea { - width: 90%; - min-width: 200px; - padding: 10px 10px 3px; - margin: 0 auto; - } - - .fixedFade { - z-index: 5; - } - - .fixedPage { - z-index: 10; - } - - entry { - margin: 0 auto 5px; - } - - #formLockButton { - display: none; - } - - #showFullScreenTextbox { - display: none; - } - - #settingsSaveButtons { - position: relative; - right: 0; - bottom: 0; - clear: both; - width: 100%; - } -} diff --git a/css/styles.css b/css/styles.css deleted file mode 100644 index 7cc1bcc..0000000 --- a/css/styles.css +++ /dev/null @@ -1,453 +0,0 @@ -* { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -html { - width: 100%; -} - -body { - width: 100%; - padding: 0; - margin: 0; - border: none; - font-family: "Helvetica", Arial, sans-serif; -} - -contents { - display: block; - width: 100%; -} - -header { - height: 50px; - width: 100%; - margin: 0 0 10px; - position: relative; - top: 0px; - left: 0px; - right: 0px; - border: none; - padding: 0; - -webkit-box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75); - -moz-box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75); - box-shadow: 0px 3px 10px -1px rgba(0,0,0,0.75); -} - -footer { - width: 100%; - text-align: center; - vertical-align: middle; - position:fixed; - bottom: 0px; - left: 0px; - background: #aaaaaa; - padding: 0; - max-height: 32px; /* Update Dictionary Container's bottom margin to account for footer */ -} - -#footer-content { - padding: 8px; -} - -table { - border-collapse: collapse; - width: 100%; -} - -tr, thead { - border-bottom: 1px solid #afafaf; -} -tr:last-child { - border-bottom: none; -} - -td, th { - border-right: 1px solid #afafaf; - padding: 3px 10px; -} -td:last-child, th:last-child { - border-right: none; -} - -.inline { - display: inline !important; -} - -#leftColumn { - float: left; - width: 25%; - margin: 15px 0 15px 15px; -} - -form { - padding: 15px; -} - -#wordEntryForm { - max-width: 400px; - min-width: 260px; -} - -.wbr:after { - content: "\00200B"; -} - -label { - display: block; - margin-bottom: 10px; -} - -label span { - display: block; - font-weight: bold; -} - -label label { - margin-left: 20px; -} - -label span.checkboxlabel { - display: inline; - margin-left: 10px; -} - -input, textarea { - display: block; - padding: 2px 0 2px 5px; - border: none; - margin: 2px 0; -} - -input[type=checkbox] { - display: inline; - margin: 5px; -} - -.longDefinition { - width: 100%; - min-width: 230px; - height: 150px; -} - -#updateConflict { - width: 260px; -} - -#errorMessage, #updateConflictMessage, #settingsErrorMessage { - display: block; - color: maroon; - font-weight: bold; -} - -#dictionaryWarn { - margin-top: 10px; - font-size: 12px; - font-weight: bold; - font-style: italic; -} - -.exportWarnText { - display: inline; - color: red; - cursor: pointer; - text-decoration: underline; -} - -#formLockButton { - float: right; -} - -#createAccountSubmitButton, #accountSettingsSubmitButton { - margin-top: 10px; -} - -#aboutButton { - display: inline; - margin: 0 10px 0 0; -} - -#announcementArea, #notificationArea { - text-align:center; - padding:10px; - margin: 0 auto 5px; - width:50%; - min-width:200px; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -} - -#dictionaryColumn { - width: 50%; - margin: 15px 0 36px 15px; /* bottom margin must clear footer */ - padding: 0; - float: left; -} - -#dictionaryContent { - width: 100%; - min-width: 260px; - max-width: 800px; - padding: 15px; -} - -#dictionaryName { - margin: 0 0 5px; -} - -#dictionaryShareLink { - margin-left: 10px; - vertical-align: middle; - text-decoration: none; -} - -#dictionaryDescription { - width: 100%; - max-height: 400px; - overflow-y: auto; - padding: 15px; - border: none; - margin: 10px; -} - -.clickable, button { - display: inline; - font-weight: bold; - font-size: 13px; - padding: 5px; - border: none; - background: #dddddd; -} - -.clickable, button { - cursor: pointer; -} - -.inline-button { - font-size: 11px; - padding: 2px 4px; -} - -.toggleButton { - display: inline-block; - margin: 8px; - font-weight: bold; - font-size: 12px; -} - -.searchOption, .filterOption { - font-size:12px; - display: inline-block; - margin: 0 8px 0 0; -} - -#wordFilter { - margin: 10px 0; -} - -#filterWordCount { - margin: 10px 10px; - display: block; - font-weight: bold; - font-style: italic; -} - -entry { - display: block; - width: 90%; - min-width: 200px; - padding: 10px 10px 3px; - margin-bottom: 5px; -} - -.wordLink { - text-decoration: none; - float: right; - font-size: 13px; - padding: 2px; - line-height: 10px; -} - -word { - font-weight: bold; - font-size: 20px; -} - -pronunciation { - font-size: 12px; - margin-left:10px; -} - -partofspeech { - font-style: italic; - font-weight: bold; - font-size: 10px; - margin-left:10px; -} - -simpledefinition { - display: block; - font-style: italic; -} - -longdefinition { - display: block; - margin-left: 20px; -} - -longDefinition h1, longDefinition h2, longDefinition h3, longDefinition h4, longDefinition h5, longDefinition h6 { - margin: 5px 0 8px; - font-weight: bold; -} - -longDefinition h1 { - font-size: 22px; -} - -longDefinition h2 { - font-size: 20px; -} - -longDefinition h3 { - font-size: 20px; - font-weight: normal; -} - -longDefinition h4 { - font-size: 18px; -} - -longDefinition h5 { - font-size: 18px; - font-weight: normal; -} - -longDefinition h6 { - font-size: 17px; -} - -longDefinition p { - margin: 3px 0 8px; -} - -searchTerm { - display: inline; - color: #ff0000; - background: #ffff00; - padding: 1px; - text-decoration: underline; - font-style: italic; - font-weight: bold; -} - -.management { - display: block; - right: 5px; - width: 100px; - padding: 3px; - border: inset 3px; - margin: 10px; -} - -.editButton, .deleteButton, .deleteConfirmButton, .deleteCancelButton { - display: inline; - font-size: 10px; - margin: 5px; -} - -.deleteConfirm { - display: block; - font-size: 10px; - margin: 10px; -} - -.fixedFade { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: #000000; - opacity: 0.6; -} - -.fixedPage { - position: fixed; - top: 5%; - left: 6%; - right: 6%; - bottom: 10%; - min-width: 260px; - min-height: 260px; - padding: 5px 5% 5%; - overflow-y: auto; - overflow-x: hidden; - background: #ffffff; - opacity: 1; - border: none; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); -} - -.rightButton { - float: right; - font-size: 12px; -} - -#fullScreenTextboxPage { - padding: 5px 3% 4%; - overflow-y: hidden; -} - -#fullScreenTextbox { - position: relative; - width: 100%; - height: 100%; -} - -#settingsForm { - width: 100%; - padding: 0; - margin: 0; -} - -#publicLink { - font-size:12px; - font-style: italic; -} - -#dictionaryDescriptionEdit, #dictionaryPartsOfSpeechEdit { - width: 100%; - max-width: 360px; - min-width: 200px; -} - -#dictionaryDescriptionEdit { - height: 200px; -} - -#settingsErrorMessage { - float: right; - clear: both; -} -#settingsSaveButtons { - position: absolute; - right: 10%; - bottom: 8%; - font-size: 14px; - display: block; - width: 50%; -} - -.settingsCol { - display: block; - float: left; - width: 30%; - min-width: 260px; - max-width: 400px; - margin: 0 30px 0 0; -} diff --git a/import_test.csv b/import_test.csv deleted file mode 100644 index 397041d..0000000 --- a/import_test.csv +++ /dev/null @@ -1,4 +0,0 @@ -word,pronunciation,part of speech,equivalent,explanation -test0, [tehst], ,dah, -test1, [tehst], a ,dah, -test2, [tehst], a ,dah, \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index 019c411..0000000 --- a/index.php +++ /dev/null @@ -1,459 +0,0 @@ - 0) ? (($word_to_load > 0) ? "word" : "view") : "build"; - -$announcement = get_include_contents(SITE_LOCATION . '/announcement.php'); -$notificationMessage = ""; - -if ($current_user > 0 || !isset($_SESSION['loginfailures']) || (isset($_SESSION['loginlockouttime']) && time() - $_SESSION['loginlockouttime'] >= 3600)) { - // If logged in, never failed, or more than 1 hour has passed, reset login failures. - $_SESSION['loginfailures'] = 0; -} else { - $alertlockoutmessage = "You failed logging in 10 times. To prevent request flooding and hacking attempts, you may not log in or create an account for 1 hour.\\n\\nThe last time this page was loaded, you had been locked out for " . time_elapsed(time() - $_SESSION['loginlockouttime']) . "\\n\\nRefresh the page once the hour has passed."; - $hoverlockoutmessage = str_replace("\\n", "\n", $alertlockoutmessage); -} - -require_once(SITE_LOCATION . '/php/notificationconditiontree.php'); - -if ($display_mode != "build") { - $dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD); - $dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - - $dictionary_query = "SELECT `d`.`id`, `d`.`user`, `d`.`name`, `d`.`description`, `u`.`public_name`, `d`.`parts_of_speech`, `d`.`is_complete` "; - $dictionary_query .= "FROM `dictionaries` AS `d` LEFT JOIN `users` AS `u` ON `d`.`user`=`u`.`id`"; - $dictionary_query .= "WHERE `d`.`is_public`=1 AND `d`.`id`=" . $dictionary_to_load . ";"; - - $word_query = "SELECT `w`.`word_id`, `w`.`name`, `w`.`pronunciation`, `w`.`part_of_speech`, `w`.`simple_definition`, `w`.`long_definition` "; - $word_query .= "FROM `words` AS `w` LEFT JOIN `dictionaries` AS `d` ON `w`.`dictionary`=`d`.`id` "; - $word_query .= "WHERE `d`.`is_public`=1 AND `w`.`dictionary`=" . $dictionary_to_load . (($display_mode == "word") ? " AND `w`.`word_id`=" . $word_to_load : "") . " "; - $word_query .= "ORDER BY IF(`d`.`sort_by_equivalent`, `w`.`simple_definition`, `w`.`name`) COLLATE utf8_unicode_ci;"; - - try { - $dictionary_results = $dbconnection->prepare($dictionary_query); - $dictionary_results->execute(); - if ($dictionary_results) { - $word_results = $dbconnection->prepare($word_query); - $word_results->execute(); - $dictionary_words = "["; - if ($word_results) { - $words_counted = 0; - $words_total = num_rows($word_results); - while ($word = fetch($word_results)) { - $words_counted++; - $word_name = $word['name']; - $dictionary_words .= '{"name":"' . $word['name'] . '",'; - $dictionary_words .= '"pronunciation":"' . $word['pronunciation'] . '",'; - $dictionary_words .= '"partOfSpeech":"' . $word['part_of_speech'] . '",'; - $dictionary_words .= '"simpleDefinition":"' . $word['simple_definition'] . '",'; - $dictionary_words .= '"longDefinition":"' . $word['long_definition'] . '",'; - $dictionary_words .= '"wordId":"' . $word['word_id'] . '"'; - $dictionary_words .= '}'; - - if ($words_counted < $words_total) { - $dictionary_words .= ','; - } - } - } - $dictionary_words .= "]"; - - if (num_rows($dictionary_results) === 1) { - while ($dict = fetch($dictionary_results)) { - $dictionary_name = $dict['name']; - $dictionary_creator = $dict['public_name']; - $is_owner = $current_user == $dict['user']; - $the_public_dictionary = '{"name":"' . $dict['name'] . '",'; - $the_public_dictionary .= '"description":"' . $dict['description'] . '",'; - $the_public_dictionary .= '"createdBy":"' . $dict['public_name'] . '",'; - $the_public_dictionary .= '"words":' . $dictionary_words . ','; - $the_public_dictionary .= '"settings":{'; - $the_public_dictionary .= '"partsOfSpeech":"' . $dict['parts_of_speech'] . '",'; - $the_public_dictionary .= '"isComplete":' . (($dict['is_complete'] == 1) ? 'true' : 'false') . '},'; - $the_public_dictionary .= '"id":"' . $dictionary_to_load . '"'; - $the_public_dictionary .= '}'; - } - } - } - } - catch (PDOException $ex) {} -} - -?> - - - - - - - - <?php echo (($display_mode == "word") ? ($word_name . " | ") : "") . $dictionary_name; ?> Dictionary on Lexiconga - " /> - - Dictionary" /> - - - - - Lexiconga Dictionary Builder - - - - - - - - - - - - -
-
- -
- About Lexiconga -
-
- - 0) { //If logged in, show the log out button. ?> - Account Settings Log Out - - Log In/Create Account - - Can't Login - -

Viewing

- - « Edit Dictionary - - « Go Home to Lexiconga - - -
-
-
- - -
;"> - Close -
-
-
;"> - Close -
-
-
- -
-
🔒
- - - - - - - -
- -
- - -
- -
- - - - -
- - Settings - -

- - -

-
- - - - View Full Dictionary - - HideShow Description -
blocknone;">
- - - Hide Search/Filter Options -
blocknone;"> -
- -
- - -
-
- ;"> - Check All - -   - ;"> - Uncheck All - -
-
-
- - -
-
- - - - - - - - - - - - - - 0) { - $user_email = Get_User_Email($current_user); - ?> - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - diff --git a/js/defiant.js b/js/defiant.js deleted file mode 100644 index c739d6e..0000000 --- a/js/defiant.js +++ /dev/null @@ -1,687 +0,0 @@ -/* - * 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 (typeof module === "undefined") { - var module = { exports: undefined }; -} else { - // Node env adaptation goes here... -} - -module.exports = Defiant = (function(window, undefined) { - 'use strict'; - - var Defiant = { - 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(template, data) { - var processor = new XSLTProcessor(), - span = document.createElement('span'), - opt = {match: '/'}, - tmpltXpath, - scripts, - temp, - sorter; - // handle arguments - switch (typeof(template)) { - case 'object': - this.extend(opt, template); - if (!opt.data) opt.data = data; - break; - case 'string': - opt.template = template; - opt.data = data; - break; - default: - throw 'error'; - } - opt.data = JSON.toXML(opt.data); - tmpltXpath = '//xsl:template[@name="'+ opt.template +'"]'; - - if (!this.xsl_template) this.gatherTemplates(); - - if (opt.sorter) { - sorter = this.node.selectSingleNode(this.xsl_template, tmpltXpath +'//xsl:for-each//xsl:sort'); - if (sorter) { - if (opt.sorter.order) sorter.setAttribute('order', opt.sorter.order); - if (opt.sorter.select) sorter.setAttribute('select', opt.sorter.select); - sorter.setAttribute('data-type', opt.sorter.type || 'text'); - } - } - - temp = this.node.selectSingleNode(this.xsl_template, tmpltXpath); - temp.setAttribute('match', opt.match); - processor.importStylesheet(this.xsl_template); - span.appendChild(processor.transformToFragment(opt.data, document)); - temp.removeAttribute('match'); - - if (this.is_safari) { - scripts = span.getElementsByTagName('script'); - for (var i=0, il=scripts.length; i'+ str.replace(/defiant:(\w+)/g, '$1') +''); - }, - getSnapshot: function(data) { - return JSON.toXML(data, true); - }, - xmlFromString: function(str) { - var parser, - doc; - str = str.replace(/>\s{1,}<'); - if (str.trim().match(/<\?xml/) === null) { - str = this.xml_decl + str; - } - if (this.is_ie) { - doc = new ActiveXObject('Msxml2.DOMDocument'); - doc.loadXML(str); - if (str.indexOf('xsl:stylesheet') === -1) { - doc.setProperty('SelectionLanguage', 'XPath'); - } - } else { - parser = new DOMParser(); - doc = parser.parseFromString(str, 'text/xml'); - } - return doc; - }, - extend: function(src, dest) { - for (var content in dest) { - if (!src[content] || typeof(dest[content]) !== 'object') { - src[content] = dest[content]; - } else { - this.extend(src[content], dest[content]); - } - } - return src; - }, - node: {} - }; - - return Defiant; - -})(this); - - -if (typeof(XSLTProcessor) === 'undefined') { - - // emulating XSLT Processor (enough to be used in defiant) - var XSLTProcessor = function() {}; - XSLTProcessor.prototype = { - importStylesheet: function(xsldoc) { - this.xsldoc = xsldoc; - }, - transformToFragment: function(data, doc) { - var str = data.transformNode(this.xsldoc), - span = document.createElement('span'); - span.innerHTML = str; - return span; - } - }; - -} - - -// extending STRING -if (!String.prototype.fill) { - String.prototype.fill = function(i,c) { - var str = this; - c = c || ' '; - for (; str.length/, - rx_constructor : /<(.+?)( d:contr=".*?")>/, - rx_namespace : / xmlns\:d="defiant\-namespace"/, - rx_data : /(<.+?>)(.*?)(<\/d:data>)/i, - rx_function : /function (\w+)/i, - to_xml: function(tree) { - var str = this.hash_to_xml(null, tree); - return Defiant.xmlFromString(str); - }, - hash_to_xml: function(name, tree, array_child) { - var is_array = tree.constructor === Array, - elem = [], - attr = [], - key, - val, - val_is_array, - type, - is_attr, - cname, - constr, - cnName, - i; - - for (key in tree) { - val = tree[key]; - if (val === null || val === undefined || val.toString() === 'NaN') val = null; - - is_attr = key.slice(0,1) === '@'; - cname = array_child ? name : key; - if (cname == +cname && tree.constructor !== Object) cname = 'd:item'; - if (val === null) { - constr = null; - cnName = false; - } else { - constr = val.constructor; - cnName = constr.toString().match(this.rx_function)[1]; - } - - if (is_attr) { - attr.push( cname.slice(1) +'="'+ this.escape_xml(val) +'"' ); - if (cnName !== 'String') attr.push( 'd:'+ cname.slice(1) +'="'+ cnName +'"' ); - } else if (val === null) { - elem.push( this.scalar_to_xml( cname, val ) ); - } else { - switch (constr) { - case Function: - // if constructor is function, then it's not a JSON structure - // throw ERROR ? - break; - case Object: - elem.push( this.hash_to_xml( cname, val ) ); - break; - case Array: - if (key === cname) { - val_is_array = val.constructor === Array; - if (val_is_array) { - i = val.length; - while (i--) { - if (val[i].constructor === Array) val_is_array = true; - if (!val_is_array && val[i].constructor === Object) val_is_array = true; - } - } - elem.push( this.scalar_to_xml( cname, val, val_is_array ) ); - break; - } - /* falls through */ - case String: - if (typeof(val) === 'string') { - val = val.toString().replace(/\&/g, '&') - .replace(/\r|\n/g, ' '); - } - if (cname === '#text') { - // prepare map - this.map.push(tree); - attr.push('d:mi="'+ this.map.length +'"'); - attr.push('d:constr="'+ cnName +'"'); - elem.push( this.escape_xml(val) ); - break; - } - /* falls through */ - case Number: - case Boolean: - if (cname === '#text' && cnName !== 'String') { - // prepare map - this.map.push(tree); - attr.push('d:mi="'+ this.map.length +'"'); - attr.push('d:constr="'+ cnName +'"'); - elem.push( this.escape_xml(val) ); - break; - } - elem.push( this.scalar_to_xml( cname, val ) ); - break; - } - } - } - if (!name) { - name = 'd:data'; - attr.push(Defiant.namespace); - if (is_array) attr.push('d:constr="Array"'); - } - if (name.match(this.rx_validate_name) === null) { - attr.push( 'd:name="'+ name +'"' ); - name = 'd:name'; - } - if (array_child) return elem.join(''); - // prepare map - this.map.push(tree); - attr.push('d:mi="'+ this.map.length +'"'); - - return '<'+ name + (attr.length ? ' '+ attr.join(' ') : '') + (elem.length ? '>'+ elem.join('') +'' : '/>' ); - }, - scalar_to_xml: function(name, val, override) { - var attr = '', - text, - constr, - cnName; - - // check whether the nodename is valid - if (name.match(this.rx_validate_name) === null) { - attr += ' d:name="'+ name +'"'; - name = 'd:name'; - override = false; - } - if (val === null || val.toString() === 'NaN') val = null; - if (val === null) return '<'+ name +' d:constr="null"/>'; - if (val.length === 1 && val[0].constructor === Object) { - - text = this.hash_to_xml(false, val[0]); - - var a1 = text.match(this.rx_node), - a2 = text.match(this.rx_constructor); - a1 = (a1 !== null)? a1[2] - .replace(this.rx_namespace, '') - .replace(/>/, '') - .replace(/"\/$/, '"') : ''; - a2 = (a2 !== null)? a2[2] : ''; - - text = text.match(this.rx_data); - text = (text !== null)? text[2] : ''; - - return '<'+ name + a1 +' '+ a2 +' d:type="ArrayItem">'+ text +''; - } else if (val.length === 0 && val.constructor === Array) { - return '<'+ name +' d:constr="Array"/>'; - } - // else - if (override) { - return this.hash_to_xml( name, val, true ); - } - - constr = val.constructor; - cnName = constr.toString().match(this.rx_function)[1]; - text = (constr === Array) ? this.hash_to_xml( 'd:item', val, true ) - : this.escape_xml(val); - - attr += ' d:constr="'+ cnName +'"'; - // prepare map - this.map.push(val); - attr += ' d:mi="'+ this.map.length +'"'; - - return (name === '#text') ? this.escape_xml(val) : '<'+ name + attr +'>'+ text +''; - }, - escape_xml: function(text) { - return String(text) .replace(//g, '>') - .replace(/"/g, '"') - .replace(/ /g, ' '); - } - }, - doc = interpreter.to_xml.call(interpreter, tree); - - // snapshot distinctly improves performance - if (snapshot) { - return { - doc: doc, - src: tree, - map: interpreter.map - }; - } - - this.search.map = interpreter.map; - return doc; - }; -} - -if (!JSON.search) { - JSON.search = function(tree, xpath, single) { - 'use strict'; - - var isSnapshot = tree.doc && tree.doc.nodeType, - doc = isSnapshot ? tree.doc : JSON.toXML(tree), - map = isSnapshot ? tree.map : this.search.map, - src = isSnapshot ? tree.src : tree, - xres = Defiant.node[ single ? 'selectSingleNode' : 'selectNodes' ](doc, xpath.xTransform()), - ret = [], - mapIndex, - i; - - if (single) xres = [xres]; - i = xres.length; - - while (i--) { - switch(xres[i].nodeType) { - case 2: - case 3: - ret.unshift( xres[i].nodeValue ); - break; - default: - mapIndex = +xres[i].getAttribute('d:mi'); - if (map[mapIndex-1]) ret.unshift( map[mapIndex-1] ); - } - } - - // if environment = development, add search tracing - if (Defiant.env === 'development') { - this.trace = JSON.mtrace(src, ret, xres); - } - - return ret; - }; -} - -if (!JSON.mtrace) { - JSON.mtrace = function(root, hits, xres) { - 'use strict'; - - var win = window, - stringify = JSON.stringify, - sroot = stringify( root, null, '\t' ).replace(/\t/g, ''), - trace = [], - i = 0, - il = xres.length, - od = il ? xres[i].ownerDocument.documentElement : false, - map = this.search.map, - hstr, - cConstr, - fIndex = 0, - mIndex, - lStart, - lEnd; - - for (; i 0)? xI[0] : null; - } else { - return XNode.selectSingleNode(XPath); - } -}; - - -Defiant.node.prettyPrint = function(node) { - var root = Defiant, - tabs = root.tabsize, - decl = root.xml_decl.toLowerCase(), - ser, - xstr; - if (root.is_ie) { - xstr = node.xml; - } else { - ser = new XMLSerializer(); - xstr = ser.serializeToString(node); - } - if (root.env !== 'development') { - // if environment is not development, remove defiant related info - xstr = xstr.replace(/ \w+\:d=".*?"| d\:\w+=".*?"/g, ''); - } - var str = xstr.trim().replace(/(>)\s*(<)(\/*)/g, '$1\n$2$3'), - lines = str.split('\n'), - indent = -1, - i = 0, - il = lines.length, - start, - end; - for (; i/g) !== null; - //start = lines[i].match(/<[^\/]+>/g) !== null; - end = lines[i].match(/<\/[\w\:]+>/g) !== null; - if (lines[i].match(/<.*?\/>/g) !== null) start = end = true; - if (start) indent++; - lines[i] = String().fill(indent, '\t') + lines[i]; - if (start && end) indent--; - if (!start && end) indent--; - } - return lines.join('\n').replace(/\t/g, String().fill(tabs, ' ')); -}; - - -Defiant.node.toJSON = function(xnode, stringify) { - 'use strict'; - - var interpret = function(leaf) { - var obj = {}, - win = window, - attr, - type, - item, - cname, - cConstr, - cval, - text, - i, il, a; - - switch (leaf.nodeType) { - case 1: - cConstr = leaf.getAttribute('d:constr'); - if (cConstr === 'Array') obj = []; - else if (cConstr === 'String' && leaf.textContent === '') obj = ''; - - attr = leaf.attributes; - i = 0; - il = attr.length; - for (; i= 0) { - if (WordAtIndexWasChanged(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { - document.getElementById("newWordButtonArea").style.display = "none"; - DisableForm(''); - updateConflictArea.style.display = "block"; - - var updateConflictText = "\"" + word + "\" is already in the dictionary"; - if (currentDictionary.words[wordIndex].name != word) { - updateConflictText += " as \"" + currentDictionary.words[wordIndex].name + "\", and your dictionary is set to ignore case."; - } else { - updateConflictText += "." - } - updateConflictText += "
Do you want to update it to what you have set above?
"; - updateConflictText += ''; - updateConflictText += ' '; - - updateConflictArea.innerHTML = updateConflictText; - } else { - errorMessage = "\"" + word + "\" is already in the dictionary exactly as it is written above"; - if (currentDictionary.words[wordIndex].name != word) { - errorMessage += ". (Your dictionary is currently set to ignore case.)" - } - } - } else { - currentDictionary.words.push({name: word, pronunciation: pronunciation, partOfSpeech: ((partOfSpeech.length > 0) ? partOfSpeech : " "), simpleDefinition: simpleDefinition, longDefinition: longDefinition, wordId: currentDictionary.nextWordId++}); - SaveAndUpdateWords("new"); - FocusAfterAddingNewWord(); - NewWordNotification(word); - } - - errorMessageArea.innerHTML = ""; - } else { - if (word == "") { - errorMessage += "Word cannot be blank"; - if (simpleDefinition == "" && longDefinition == "") { - errorMessage += " and you need at least one definition."; - } else { - errorMessage += "."; - } - } else if (simpleDefinition == "" && longDefinition == "") { - errorMessage += "You need at least one definition." - } - } - - errorMessageArea.innerHTML = errorMessage; -} - -function ShowWordEditForm(index) { - var indexString = index.toString(); // Variable for reduced processing - var word = currentDictionary.words[index]; // Reference for easier reading - var editForm = '
\ -

Editing ' + word.name + '

\ - \ - \ - \ - \ - \ - \ -
\ - \ -
\ - \ -
'; - - document.getElementById("entry" + indexString).innerHTML = editForm; - - SetPartsOfSpeech("partOfSpeech" + indexString); - document.getElementById("partOfSpeech" + indexString).value = htmlEntitiesParse(word.partOfSpeech); - - document.getElementById("word" + indexString).focus(); -} - -function CancelEditForm(index) { - document.getElementById("entry" + index.toString()).innerHTML = DictionaryEntry(index).replace("", "").replace("", ""); -} - -function EditWord(indexString) { - var word = htmlEntities(document.getElementById("word" + indexString).value).trim(); - var pronunciation = htmlEntities(document.getElementById("pronunciation" + indexString).value).trim(); - var partOfSpeech = htmlEntities(document.getElementById("partOfSpeech" + indexString).value).trim(); - var simpleDefinition = htmlEntities(document.getElementById("simpleDefinition" + indexString).value).trim(); - var longDefinition = htmlEntities(document.getElementById("longDefinition" + indexString).value); - - var errorMessageArea = document.getElementById("errorMessage" + indexString); - var errorMessage = ""; - var updateConflictArea = document.getElementById("updateConflict" + indexString); - - if (WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { - document.getElementById("editWordButtonArea" + indexString).style.display = "none"; - DisableForm(indexString); - updateConflictArea.style.display = "block"; - updateConflictArea.innerHTML = "Do you really want to change the word \"" + currentDictionary.words[parseInt(indexString)].name + "\" to what you have set above?
"; - updateConflictArea.innerHTML += ''; - updateConflictArea.innerHTML += ''; - } else { - errorMessage = "No change has been made to \"" + word + "\""; - if (currentDictionary.words[parseInt(indexString)].name != word) { - errorMessage += ". (Your dictionary is currently set to ignore case.)"; - } - } - - errorMessageArea.innerHTML = errorMessage; - - if (document.getElementById("updateConfirmButton" + indexString)) { - document.getElementById("updateConfirmButton" + indexString).focus(); - } -} - -function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { - SaveScroll(); - - currentDictionary.words[wordIndex].name = word; - currentDictionary.words[wordIndex].pronunciation = pronunciation; - currentDictionary.words[wordIndex].partOfSpeech = ((partOfSpeech.length > 0) ? partOfSpeech : " "); - currentDictionary.words[wordIndex].simpleDefinition = simpleDefinition; - currentDictionary.words[wordIndex].longDefinition = longDefinition; - - SaveAndUpdateWords("update", wordIndex); - - window.scroll(savedScroll.x, savedScroll.y); - - if (!wordFormIsLocked()) { - FocusAfterAddingNewWord(); - } -} - -function DeleteWord(index) { - var deleteWord = new XMLHttpRequest(); - deleteWord.open('POST', "/php/ajax_dictionarymanagement.php?action=worddelete"); - deleteWord.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - deleteWord.onreadystatechange = function() { - if (deleteWord.readyState == 4 && deleteWord.status == 200) { - if (deleteWord.responseText == "deleted successfully" || deleteWord.responseText == "not signed in") { - currentDictionary.words.splice(index, 1); - - SaveWords(false); - } - console.log(deleteWord.responseText); - return true; - } else { - return false; - } - } - deleteWord.send("dict=" + currentDictionary.externalID.toString() + "&word=" + currentDictionary.words[index].wordId.toString()); -} - -function ShowDictionary() { - var filters = GetSelectedFilters(); - - var searchResults = []; - var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var searchByWord = document.getElementById("searchOptionWord").checked; - var searchBySimple = document.getElementById("searchOptionSimple").checked; - var searchByLong = document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = document.getElementById("searchIgnoreDiacritics").checked; - if (search != "" && (searchByWord || searchBySimple || searchByLong)) { - var xpath = []; - var searchDictionaryJSON = htmlEntitiesParseForSearch(JSON.stringify(currentDictionary)); - if (searchIgnoreCase) { - search = search.toLowerCase(); - } - if (searchIgnoreDiacritics) { - search = removeDiacritics(search); - searchDictionaryJSON = removeDiacritics(searchDictionaryJSON); - } - if (searchByWord) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'name' : 'translate(name, "", "")') +', "'+ search +'")'); - } - if (searchBySimple) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'simpleDefinition' : 'translate(simpleDefinition, "", "")') +', "'+ search +'")'); - } - if (searchByLong) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'longDefinition' : 'translate(longDefinition, "", "")') +', "'+ search +'")'); - } - var searchDictionary = JSON.parse(searchDictionaryJSON); - searchResults = JSON.search(searchDictionary, '//words['+ xpath.join(' or ') +']/wordId'); - } - - var dictionaryNameArea = document.getElementById("dictionaryName"); - dictionaryNameArea.innerHTML = currentDictionary.name + " Dictionary"; - if (loggedIn && currentDictionary.settings.isPublic) { - dictionaryNameArea.innerHTML += ""; - } - - var dictionaryDescriptionArea = document.getElementById("dictionaryDescription"); - dictionaryDescriptionArea.innerHTML = marked(htmlEntitiesParseForMarkdown(currentDictionary.description)); - - var dictionaryArea = document.getElementById("theDictionary"); - var dictionaryText = ""; - var numberOfWordsDisplayed = 0; - - if (currentDictionary.words.length > 0) { - for (var i = 0; i < currentDictionary.words.length; i++) { - if (filters.length == 0 || (filters.length > 0 && filters.indexOf(currentDictionary.words[i].partOfSpeech) > -1)) { - if (search == "" || (search != "" && (searchByWord || searchBySimple || searchByLong) && searchResults.indexOf(currentDictionary.words[i].wordId) >= 0)) { - if (!currentDictionary.words[i].hasOwnProperty("pronunciation")) { - currentDictionary.words[i].pronunciation = ""; //Account for new property - } - if (!currentDictionary.words[i].hasOwnProperty("wordId")) { - currentDictionary.words[i].wordId = i + 1; //Account for new property - } - dictionaryText += DictionaryEntry(i); - numberOfWordsDisplayed++; - } - } - } - } else { - dictionaryText = "There are no entries in the dictionary."; - } - - dictionaryArea.innerHTML = dictionaryText; - ShowFilterWordCount(numberOfWordsDisplayed); -} - -function DictionaryEntry(itemIndex) { - var searchTerm = regexParseForSearch(document.getElementById("searchBox").value); - var searchByWord = document.getElementById("searchOptionWord").checked; - var searchBySimple = document.getElementById("searchOptionSimple").checked; - var searchByLong = document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = document.getElementById("searchIgnoreDiacritics").checked; - - var searchRegEx = new RegExp("(" + ((searchIgnoreDiacritics) ? removeDiacritics(searchTerm) + "|" + searchTerm : searchTerm) + ")", "g" + ((searchIgnoreCase) ? "i" : "")); - - var wordName = wordPronunciation = wordPartOfSpeech = wordSimpleDefinition = wordLongDefinition = ""; - - if (searchTerm != "" && searchByWord) { - // Parse HTML Entities while searching so the regex can search actual characters instead of HTML. - wordName += htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].name).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - // Don't need to parse if not searching because HTML displays correctly anyway! - wordName += currentDictionary.words[itemIndex].name.toString(); // Use toString() to prevent using a reference instead of the value. - } - - if (currentDictionary.words[itemIndex].pronunciation != "") { - wordPronunciation += marked(htmlEntitiesParseForMarkdown(currentDictionary.words[itemIndex].pronunciation)).replace(/<\/?p>/g,""); - } - - if (currentDictionary.words[itemIndex].partOfSpeech != " " && currentDictionary.words[itemIndex].partOfSpeech != "") { - wordPartOfSpeech += currentDictionary.words[itemIndex].partOfSpeech.toString(); - } - - if (currentDictionary.words[itemIndex].simpleDefinition != "") { - if (searchTerm != "" && searchBySimple) { - wordSimpleDefinition += htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].simpleDefinition).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordSimpleDefinition += currentDictionary.words[itemIndex].simpleDefinition.toString(); - } - } - - if (currentDictionary.words[itemIndex].longDefinition != "") { - if (searchTerm != "" && searchByLong) { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].longDefinition).replace(searchRegEx, "$1")))).replace(/<(\/?)searchterm>\;/g, '<$1searchterm>'); - } else { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(currentDictionary.words[itemIndex].longDefinition)); - } - } - - return DictionaryEntryTemplate({ - name : wordName, - pronunciation : wordPronunciation, - partOfSpeech : wordPartOfSpeech, - simpleDefinition : wordSimpleDefinition, - longDefinition : wordLongDefinition, - wordId : currentDictionary.words[itemIndex].wordId.toString() - }, (!currentDictionary.settings.isComplete) ? itemIndex : false); -} - -function ManagementArea(itemIndex) { - var managementHTML = "
"; - - managementHTML += "Edit"; - managementHTML += "Delete"; - - managementHTML += ""; - - managementHTML += "
"; - - return managementHTML; -} - -function DictionaryEntryTemplate(wordObject, managementIndex) { - managementIndex = (typeof managementIndex !== 'undefined') ? managementIndex : false; - var entryText = ""; - - if (loggedIn && currentDictionary.settings.isPublic) { - entryText += ""; - } - - entryText += "🔗"; - - entryText += "" + wordObject.name + ""; - - if (wordObject.pronunciation != "") { - entryText += "" + wordObject.pronunciation + ""; - } - - if (wordObject.partOfSpeech != "") { - entryText += "" + wordObject.partOfSpeech + ""; - } - - entryText += "
"; - - if (wordObject.simpleDefinition != "") { - entryText += "" + wordObject.simpleDefinition + ""; - } - - if (wordObject.longDefinition != "") { - entryText += "" + wordObject.longDefinition + ""; - } - - if (managementIndex !== false) { - entryText += ManagementArea(managementIndex); - } - - entryText += "
"; - - return entryText; -} - -function SaveSettings() { - if (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; - if (document.getElementById("dictionaryIsPublic")) { - currentDictionary.settings.isPublic = document.getElementById("dictionaryIsPublic").checked; - } - - HideSettingsWhenComplete(); - - SaveAndUpdateDictionary(true); - LoadUserDictionaries(); -} - -function EmptyWholeDictionary() { - if (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(false); - SetPartsOfSpeech(); - HideSettings(); - ShowSettings(); - document.getElementById("dictionaryNameEdit").focus(); -} - -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 deleteDictionary = new XMLHttpRequest(); - deleteDictionary.open('POST', "/php/ajax_dictionarymanagement.php?action=delete"); - deleteDictionary.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - deleteDictionary.onreadystatechange = function() { - if (deleteDictionary.readyState == 4 && deleteDictionary.status == 200) { - if (deleteDictionary.responseText.length < 31) { - console.log(deleteDictionary.responseText); - CreateNewDictionary(); - } else { - HideSettings(); - ShowDictionaryDeleteMenu(deleteDictionary.responseText); - - if (document.getElementById("loadAfterDelete").options.length == 0) { - document.getElementById('loadAfterDeleteScreen').style.display = 'none'; - CreateNewDictionary(); - } - } - return true; - } else { - return false; - } - } - deleteDictionary.send(); - } -} - - -function ResetDictionaryToDefault() { - currentDictionary = JSON.parse(defaultDictionaryJSON); -} - -function SaveAndUpdateWords(action, wordIndex) { - var dataToSend = ""; - if (action == "all") { - // For dictionaries not already in the db. Send all the words to database. - dataToSend = JSON.stringify(currentDictionary.words); - } else if (action == "update") { - // Only send the specified word to update. - dataToSend = JSON.stringify(currentDictionary.words[wordIndex]); - } else if (action == "new") { - // Send the last word pushed to the words array before it's sorted. - dataToSend = JSON.stringify(currentDictionary.words[currentDictionary.words.length - 1]); - } - - var sendWords = new XMLHttpRequest(); - sendWords.open('POST', "/php/ajax_dictionarymanagement.php?action=word" + action + "&dict=" + currentDictionary.externalID.toString() + "&nextwordid=" + currentDictionary.nextWordId.toString()); - sendWords.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); - sendWords.onreadystatechange = function() { - if (sendWords.readyState == 4 && sendWords.status == 200) { - SaveWords(); - ClearForm(); - console.log(sendWords.responseText); - return true; - } else { - return false; - } - } - sendWords.send(dataToSend); -} - -function SaveWords() { - if (!currentDictionary.settings.sortByEquivalent) { - currentDictionary.words.sort(dynamicSort(['name', 'partOfSpeech'])); - } else { - currentDictionary.words.sort(dynamicSort(['simpleDefinition', 'partOfSpeech'])); - } - SaveDictionary(false); - ProcessLoad(); -} - -function SaveAndUpdateDictionary(keepFormContents) { - SaveDictionary(true); - ShowDictionary(); - if (!keepFormContents) { - ClearForm(); - } - CloseUpdateConflictArea(''); -} - -function SaveDictionary(sendToDatabase) { - //Always save local copy of current dictionary, but if logged in also send to database. - if (sendToDatabase) { - SendDictionary(); - } - - localStorage.setItem('dictionary', JSON.stringify(currentDictionary)); - - SavePreviousDictionary(); -} - -function SendDictionary() { - var action = ""; - var postString = ""; - if (currentDictionary.externalID > 0) { - action = "update"; - postString = DataToSend(false); - } else { - action = "new"; - postString = DataToSend(true); - } - - var sendDictionary = new XMLHttpRequest(); - sendDictionary.open('POST', "/php/ajax_dictionarymanagement.php?action=" + action); - sendDictionary.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - sendDictionary.onreadystatechange = function() { - if (sendDictionary.readyState == 4 && sendDictionary.status == 200) { - if (sendDictionary.responseText == "updated successfully") { - console.log(sendDictionary.responseText); - LoadUserDictionaries(); - ProcessLoad(); - } else if (isNaN(parseInt(sendDictionary.responseText))) { - console.log(sendDictionary.responseText); - } else { // It will only be a number if it is a new dictionary. - currentDictionary.externalID = parseInt(sendDictionary.responseText); - if (currentDictionary.words.length > 0) { - SaveAndUpdateWords("all"); - } - LoadUserDictionaries(); - ProcessLoad(); - console.log("saved " + parseInt(sendDictionary.responseText).toString() + " successfully"); - } - return true; - } else { - return false; - } - } - sendDictionary.send(postString); -} - -function DataToSend(sendAll) { - sendAll = (typeof sendAll !== 'undefined' && sendAll != null) ? sendAll : false; - var data = ""; - if (currentDictionary.externalID == 0) { - data = "name=" + encodeURIComponent(currentDictionary.name) + "&description=" + encodeURIComponent(currentDictionary.description) + "&words=" + encodeURIComponent(JSON.stringify(currentDictionary.words)); - data += "&nextwordid=" + currentDictionary.nextWordId + "&allowduplicates=" + ((currentDictionary.settings.allowDuplicates) ? "1" : "0") + "&casesensitive=" + ((currentDictionary.settings.caseSensitive) ? "1" : "0"); - data += "&partsofspeech=" + encodeURIComponent(currentDictionary.settings.partsOfSpeech) + "&sortbyequivalent=" + ((currentDictionary.settings.sortByEquivalent) ? "1" : "0") + "&iscomplete=" + ((currentDictionary.settings.isComplete) ? "1" : "0") + "&ispublic=" + ((currentDictionary.settings.isPublic) ? "1" : "0") + ""; - } else { - if (sendAll || currentDictionary.name != previousDictionary.name) { - data += "name=" + encodeURIComponent(currentDictionary.name); - } - if (sendAll || currentDictionary.description != previousDictionary.description) { - data += ((data=="") ? "" : "&") + "description=" + encodeURIComponent(currentDictionary.description); - } - if (sendAll || currentDictionary.nextWordId != previousDictionary.nextWordId) { - data += ((data=="") ? "" : "&") + "nextwordid=" + currentDictionary.nextWordId; - } - if (sendAll || currentDictionary.settings.allowDuplicates != previousDictionary.allowDuplicates) { - data += ((data=="") ? "" : "&") + "allowduplicates=" + ((currentDictionary.settings.allowDuplicates) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.caseSensitive != previousDictionary.caseSensitive) { - data += ((data=="") ? "" : "&") + "casesensitive=" + ((currentDictionary.settings.caseSensitive) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.partsOfSpeech != previousDictionary.partsOfSpeech) { - data += ((data=="") ? "" : "&") + "partsofspeech=" + encodeURIComponent(currentDictionary.settings.partsOfSpeech); - } - if (sendAll || currentDictionary.settings.sortByEquivalent != previousDictionary.sortByEquivalent) { - data += ((data=="") ? "" : "&") + "sortbyequivalent=" + ((currentDictionary.settings.sortByEquivalent) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.isComplete != previousDictionary.isComplete) { - data += ((data=="") ? "" : "&") + "iscomplete=" + ((currentDictionary.settings.isComplete) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.isPublic != previousDictionary.isPublic) { - data += ((data=="") ? "" : "&") + "ispublic=" + ((currentDictionary.settings.isPublic) ? "1" : "0"); - } - } - return data; -} - -function LoadDictionary() { - LoadLocalDictionary(); - var loadDictionary = new XMLHttpRequest(); - loadDictionary.open('GET', "/php/ajax_dictionarymanagement.php?action=load"); - loadDictionary.onreadystatechange = function() { - if (loadDictionary.readyState == 4 && loadDictionary.status == 200) { - if (loadDictionary.responseText == "no dictionaries") { - // If there are no dictionaries in the database and there's one in memory, remove the id & public setting and send it as a new one. - currentDictionary.externalID = 0; - currentDictionary.settings.isPublic = false; - SendDictionary(true); - } else if (loadDictionary.responseText.length < 60) { - console.log(loadDictionary.responseText); - } else { - currentDictionary = JSON.parse(loadDictionary.responseText); - SaveDictionary(false); - } - } - ProcessLoad(); - } - loadDictionary.send(); -} - -function ChangeDictionary(userDictionariesSelect) { - userDictionariesSelect = (typeof userDictionariesSelect !== 'undefined' && userDictionariesSelect != null) ? userDictionariesSelect : document.getElementById("userDictionaries"); - if (currentDictionary.externalID != userDictionariesSelect.value && userDictionariesSelect.options.length > 0) { - // Show the info page with loading screen and hide settings and stuff. - ShowInfoWithText("

Loading " + userDictionariesSelect.options[userDictionariesSelect.selectedIndex].text + "...

"); - HideSettings(); - - ChangeDictionaryToId(userDictionariesSelect.value, function(response) { - if (response == "no dictionaries") { - console.log(response); - SendDictionary(false); - } else if (response.length < 60) { - console.log(response); - } else { - currentDictionary = JSON.parse(response); - SaveDictionary(false); - ProcessLoad(); - LoadUserDictionaries(); - HideInfo(); // Hide the loading screen. - } - }); - } -} - -function ChangeDictionaryToId(dictionaryId, callbackFunction) { - var changeDictionaryRequest = new XMLHttpRequest(); - changeDictionaryRequest.open('POST', "/php/ajax_dictionarymanagement.php?action=switch"); - changeDictionaryRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - var postString = "newdictionaryid=" + dictionaryId.toString(); - changeDictionaryRequest.onreadystatechange = function() { - if (changeDictionaryRequest.readyState == 4 && changeDictionaryRequest.status == 200) { - callbackFunction(changeDictionaryRequest.responseText); - } - } - changeDictionaryRequest.send(postString); -} - -function LoadLocalDictionary() { - if (localStorage.getItem('dictionary')) { - var tmpDictionary = JSON.parse(localStorage.getItem('dictionary')); - if (tmpDictionary.words.length > 0 || tmpDictionary.description != "A new dictionary." || tmpDictionary.name != "New") { - currentDictionary = JSON.parse(localStorage.getItem('dictionary')); - } - tmpDictionary = null; - } -} - -function ProcessLoad() { - if (!currentDictionary.hasOwnProperty("nextWordId")) { - currentDictionary.nextWordId = currentDictionary.words.length + 1; - } - - HideSettingsWhenComplete(); - - ShowDictionary(); - - SetPartsOfSpeech(); - - if (currentDictionary.settings.isComplete) { - document.getElementById("wordEntryForm").style.display = "none"; - } - - SavePreviousDictionary(); -} - -function SavePreviousDictionary () { - // Save non-word data to check if anything has changed (words can identify themselves if changed). - // Used to minimize data pushed to database. - 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() { - var downloadName = removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g, ''); - if (downloadName == "") { - downloadName = "export"; - } - download(downloadName + ".dict", localStorage.getItem('dictionary')); -} - -function ExportWords() { - if (currentDictionary.words.length > 0) { - var downloadName = removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g, ''); - if (downloadName == "") { - downloadName = "export"; - } - downloadName += "_words"; - - var wordsCSV = "word,pronunciation,part of speech,definition,explanation\n"; - for (var i = 0; i < currentDictionary.words.length; i++) { - var word = "\"" + htmlEntitiesParse(currentDictionary.words[i].name).trim().replace(/\"/g, "\"\"") + "\""; - var pronunciation = "\"" + htmlEntitiesParse(currentDictionary.words[i].pronunciation).trim().replace(/\"/g, "\"\"") + "\""; - var partOfSpeech = "\"" + htmlEntitiesParse(currentDictionary.words[i].partOfSpeech).trim().replace(/\"/g, "\"\"") + "\""; - var simpleDefinition = "\"" + htmlEntitiesParse(currentDictionary.words[i].simpleDefinition).trim().replace(/\"/g, "\"\"") + "\""; - var longDefinition = "\"" + htmlEntitiesParse(currentDictionary.words[i].longDefinition).replace(/\"/g, "\"\"") + "\""; - wordsCSV += word + "," + pronunciation + "," + partOfSpeech + "," + simpleDefinition + "," + longDefinition + "\n"; - } - - download(downloadName + ".csv", wordsCSV); - } 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) { - alert('Your browser is not supported'); - return false; - } - - var reader = new FileReader(); - if (document.getElementById("importFile").files.length > 0) { - var file = document.getElementById("importFile").files[0]; - // Read the file - reader.readAsText(file); - // When it's loaded, process it - reader.onloadend = function () { - if (reader.result && reader.result.length) { - var tmpDicitonary = JSON.parse(reader.result); - - if (tmpDicitonary.hasOwnProperty("name") && tmpDicitonary.hasOwnProperty("description") && - tmpDicitonary.hasOwnProperty("words") && tmpDicitonary.hasOwnProperty("settings")) - { - currentDictionary = JSON.parse(reader.result); - currentDictionary.externalID = 0; // Reset external id for imported dictionary. - currentDictionary.settings.isPublic = false; // Reset public setting for imported dictionary. - SaveDictionary(true); - ProcessLoad(); - HideInfo(); - HideSettings(); - document.getElementById("importFile").value = ""; - NewNotification("Successfully Imported the \"" + currentDictionary.name + "\" Dictionary."); - } else { - var errorString = "File is missing:"; - if (!tmpDicitonary.hasOwnProperty("name")) - errorString += " name"; - if (!tmpDicitonary.hasOwnProperty("description")) - errorString += " description"; - if (!tmpDicitonary.hasOwnProperty("words")) - errorString += " words"; - if (!tmpDicitonary.hasOwnProperty("settings")) - errorString += " settings"; - alert("Uploaded file is not compatible.\n\n" + errorString); - } - - tmpDicitonary = null; - } else { - alert("Upload Failed"); - } - reader = null; - } - } else { - alert("You must add a file to import."); - } - } -} - -function ImportWords() { - if (currentDictionary.externalID > 0 || confirm("This will add words in a correctly formatted CSV file to your currently loaded dictionary. Do you still want to import?")) { - if (!window.FileReader) { - alert('Your browser is not supported'); - return false; - } - - if (document.getElementById("importWordsCSV").files.length > 0) { - var file = document.getElementById("importWordsCSV").files[0]; - - var resultsArea = document.getElementById("importOptions"); - resultsArea.innerHTML = "

Importing Words...

"; - - var currentRow = 0; // Because of the header, the first row of data is always on line 2. - var rowsImported = 0; - - Papa.parse(file, { - header: true, - step: function(row, parser) { - currentRow++; - // If there are no errors OR the word and either definition or explanation contain data, then import it. - if ((row.data[0].word.trim().length > 0 && (row.data[0].definition.trim().length > 0 || row.data[0].explanation.trim().length > 0)) || row.errors.length == 0) { - var wordName = htmlEntities(row.data[0]["word"]).trim(), - wordPronunciation = htmlEntities(row.data[0]["pronunciation"]).trim(), - wordPartOfSpeech = ((htmlEntities(row.data[0]["part of speech"]).trim().length > 0) ? htmlEntities(row.data[0]["part of speech"]).trim() : " "), - wordSimpleDefinition = htmlEntities(row.data[0]["definition"]).trim(), - wordLongDefinition = htmlEntities(row.data[0]["explanation"]).trim(), - wordId = currentDictionary.nextWordId++; - - currentDictionary.words.push({name: wordName, pronunciation: wordPronunciation, partOfSpeech: wordPartOfSpeech, simpleDefinition: wordSimpleDefinition, longDefinition: wordLongDefinition, wordId: wordId}); - - var wordEntry = DictionaryEntryTemplate(currentDictionary.words[currentDictionary.words.length - 1]); - resultsArea.innerHTML += wordEntry; - - rowsImported++; - } else { - // If it's not just an empty line, give an error. - if (row.data[0].word.trim().length > 0) { - for (var i = 0; i < row.errors.length; i++) { - resultsArea.innerHTML += "

Error on record #" + currentRow.toString() + ": " + row.errors[i].message + "

"; - } - } - } - // Scroll to the bottom. - document.getElementById("infoPage").scrollTop = document.getElementById("infoPage").scrollHeight; - }, - complete: function(results) { - SaveAndUpdateWords("all"); - resultsArea.innerHTML += "

The file has finished importing " + rowsImported.toString() + " words.

"; - NewNotification("Imported " + rowsImported.toString() + " words."); - // Scroll to the bottom. - document.getElementById("importOptions").scrollTop = document.getElementById("importOptions").scrollHeight; - document.getElementById("numberOfWordsInDictionary").innerHTML = currentDictionary.words.length.toString(); - } - }); - } else { - alert("You must add a file to import."); - } - } -} - -function WordIndex(word, byId) { -// Use byId = true to enter word id number instead of string. - for (var i = 0; i < currentDictionary.words.length; i++) - { - if ((!byId && (!currentDictionary.settings.caseSensitive && currentDictionary.words[i].name.toLowerCase() == word.toLowerCase()) || - (currentDictionary.settings.caseSensitive && currentDictionary.words[i].name == word)) || - (byId && currentDictionary.words[i].wordId == word)) { - return i; - } - } - return -1; -} - -function WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { - return (!currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name.toLowerCase() != word.toLowerCase()) || - (currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name != word) || - currentDictionary.words[parseInt(indexString)].pronunciation != pronunciation || - currentDictionary.words[parseInt(indexString)].partOfSpeech.trim() != partOfSpeech || - currentDictionary.words[parseInt(indexString)].simpleDefinition != simpleDefinition || - currentDictionary.words[parseInt(indexString)].longDefinition != longDefinition; -} - -function CheckForPartsOfSpeechChange() { - if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != currentDictionary.settings.partsOfSpeech) { - if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != "") { - currentDictionary.settings.partsOfSpeech = htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value); - SetPartsOfSpeech(); - } - } -} diff --git a/js/helpers.js b/js/helpers.js deleted file mode 100644 index e534d42..0000000 --- a/js/helpers.js +++ /dev/null @@ -1,256 +0,0 @@ -function ready(fn) { - if (document.readyState != 'loading'){ - fn(); - } else { - document.addEventListener('DOMContentLoaded', fn); - } -} - -// Set Marked.js settings -marked.setOptions({ - gfm: true, - tables: true, - breaks: true, - sanitize: true -}); - -// Get Keycode based on key name -function keyCodeFor(keyName) { - if (keyName == "backspace") return 8; - else if (keyName == "tab") return 9; - else if (keyName == "ctrlEnter") return 10; - else if (keyName == "enter") return 13; - else if (keyName == "shift") return 16; - else if (keyName == "ctrl") return 17; - else if (keyName == "alt") return 18; - else if (keyName == "pausebreak") return 19; - else if (keyName == "capslock") return 20; - else if (keyName == "escape") return 27; - else if (keyName == "space") return 32; - else if (keyName == "pageup") return 33; - else if (keyName == "pagedown") return 34; - else if (keyName == "end") return 35; - else if (keyName == "home") return 36; - else if (keyName == "left") return 37; - else if (keyName == "up") return 38; - else if (keyName == "right") return 39; - else if (keyName == "down") return 40; - else if (keyName == "insert") return 45; - else if (keyName == "del") return 46; - else if (keyName == "zero") return 48; - else if (keyName == "one") return 49; - else if (keyName == "two") return 50; - else if (keyName == "three") return 51; - else if (keyName == "four") return 52; - else if (keyName == "five") return 53; - else if (keyName == "six") return 54; - else if (keyName == "seven") return 55; - else if (keyName == "eight") return 56; - else if (keyName == "nine") return 57; - else if (keyName == "a") return 65; - else if (keyName == "b") return 66; - else if (keyName == "c") return 67; - else if (keyName == "d") return 68; - else if (keyName == "e") return 69; - else if (keyName == "f") return 70; - else if (keyName == "g") return 71; - else if (keyName == "h") return 72; - else if (keyName == "i") return 73; - else if (keyName == "j") return 74; - else if (keyName == "k") return 75; - else if (keyName == "l") return 76; - else if (keyName == "m") return 77; - else if (keyName == "n") return 78; - else if (keyName == "o") return 79; - else if (keyName == "p") return 80; - else if (keyName == "q") return 81; - else if (keyName == "r") return 82; - else if (keyName == "s") return 83; - else if (keyName == "t") return 84; - else if (keyName == "u") return 85; - else if (keyName == "v") return 86; - else if (keyName == "w") return 87; - else if (keyName == "x") return 88; - else if (keyName == "y") return 89; - else if (keyName == "z") return 90; - else if (keyName == "leftwinkey") return 91; - else if (keyName == "rightwinkey") return 92; - else if (keyName == "selectkey") return 93; - else if (keyName == "numpad_0") return 96; - else if (keyName == "numpad_1") return 97; - else if (keyName == "numpad_2") return 98; - else if (keyName == "numpad_3") return 99; - else if (keyName == "numpad_4") return 100; - else if (keyName == "numpad_5") return 101; - else if (keyName == "numpad_6") return 102; - else if (keyName == "numpad_7") return 103; - else if (keyName == "numpad_8") return 104; - else if (keyName == "numpad_9") return 105; - else if (keyName == "numpad_asterisk") return 106; - else if (keyName == "numpad_plus") return 107; - else if (keyName == "numpad_dash") return 109; - else if (keyName == "numpad_period") return 110; - else if (keyName == "numpad_slash") return 111; - else if (keyName == "f1") return 112; - else if (keyName == "f2") return 113; - else if (keyName == "f3") return 114; - else if (keyName == "f4") return 115; - else if (keyName == "f5") return 116; - else if (keyName == "f6") return 117; - else if (keyName == "f7") return 118; - else if (keyName == "f8") return 119; - else if (keyName == "f9") return 120; - else if (keyName == "f10") return 121; - else if (keyName == "f11") return 122; - else if (keyName == "f12") return 123; - else if (keyName == "numlock") return 144; - else if (keyName == "scrolllock") return 145; - else if (keyName == "semicolon") return 186; - else if (keyName == "equal") return 187; - else if (keyName == "comma") return 188; - else if (keyName == "dash") return 189; - else if (keyName == "period") return 190; - else if (keyName == "slash") return 191; - else if (keyName == "grave") return 192; - else if (keyName == "openbracket") return 219; - else if (keyName == "backslash") return 220; - else if (keyName == "closebraket") return 221; - else if (keyName == "quote") return 222; - else return false; -} - -function getInputSelection(el) { -// Retrieved from http://stackoverflow.com/a/4207763 - var start = 0, end = 0, normalizedValue, range, - textInputRange, len, endRange; - el.focus(); - if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { - start = el.selectionStart; - end = el.selectionEnd; - } else { - range = document.selection.createRange(); - - if (range && range.parentElement() == el) { - len = el.value.length; - normalizedValue = el.value.replace(/\r\n/g, "\n"); - - // Create a working TextRange that lives only in the input - textInputRange = el.createTextRange(); - textInputRange.moveToBookmark(range.getBookmark()); - - // Check if the start and end of the selection are at the very end - // of the input, since moveStart/moveEnd doesn't return what we want - // in those cases - endRange = el.createTextRange(); - endRange.collapse(false); - - if (textInputRange.compareEndPoints("StartToEnd", endRange) > -1) { - start = end = len; - } else { - start = -textInputRange.moveStart("character", -len); - start += normalizedValue.slice(0, start).split("\n").length - 1; - - if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) { - end = len; - } else { - end = -textInputRange.moveEnd("character", -len); - end += normalizedValue.slice(0, end).split("\n").length - 1; - } - } - } - } - - return { - start: start, - end: end - }; -} - -function setSelectionRange(input, selectionStart, selectionEnd) { -// Retrieved from http://stackoverflow.com/a/17858641/3508346 - if (input.setSelectionRange) { - input.focus(); - input.setSelectionRange(selectionStart, selectionEnd); - } - else if (input.createTextRange) { - var range = input.createTextRange(); - range.collapse(true); - range.moveEnd('character', selectionEnd); - range.moveStart('character', selectionStart); - range.select(); - } -} - -function SaveScroll() { - var doc = document.documentElement; - var left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); - var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - - savedScroll.x = left; - savedScroll.y = top; -} - -function htmlEntities(string) { - return String(string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\\/g, '\').replace(/\n/g, '
'); -} - -function htmlEntitiesParse(string) { - return String(string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/\/g, '\\').replace(/
/g, '\n'); -} - -function htmlEntitiesParseForMarkdown(string) { - return String(string).replace(/"/g, '"').replace(/'/g, "'").replace(/\/g, '\\').replace(/
/g, '\n'); -} - -function stripHtmlEntities(string) { - // This is for the export name. - return String(string).replace(/&/g, '').replace(/</g, '').replace(/>/g, '').replace(/"/g, '').replace(/'/g, "").replace(/\/g, '').replace(/
/g, ''); -} - -function htmlEntitiesParseForSearchEntry(string) { - return String(string).replace(/"/g, '%%%%').replace(/'/g, "````"); -} - -function htmlEntitiesParseForSearch(string) { - return String(string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '%%%%').replace(/'/g, "````"); -} - -function regexParseForSearch(string) { - return String(string).replace(/([\[\\\^\$\.\|\?\*\+\(\)\{\}\]])/g, "\\$1"); -} - -function dynamicSort(propertiesArray) { - /* Retrieved from http://stackoverflow.com/a/30446887/3508346 - Usage: theArray.sort(dynamicSort(['propertyAscending', '-propertyDescending']));*/ - return function (a, b) { - return propertiesArray - .map(function (o) { - var dir = 1; - if (o[0] === '-') { - dir = -1; - o=o.substring(1); - } - if (removeDiacritics(a[o]).toLowerCase() > removeDiacritics(b[o]).toLowerCase()) return dir; - if (removeDiacritics(a[o]).toLowerCase() < removeDiacritics(b[o]).toLowerCase()) return -(dir); - return 0; - }) - .reduce(function firstNonZeroValue (p,n) { - return p ? p : n; - }, 0); - }; -} - -function download(filename, text) { - /* Retrieved from http://stackoverflow.com/a/18197341/3508346 - Usage: download('test.txt', 'Hello world!');*/ - var element = document.createElement('a'); - element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); - element.setAttribute('download', filename); - - element.style.display = 'none'; - document.body.appendChild(element); - - element.click(); - - document.body.removeChild(element); -} \ No newline at end of file diff --git a/js/marked.js b/js/marked.js deleted file mode 100644 index bcea7a6..0000000 --- a/js/marked.js +++ /dev/null @@ -1,1285 +0,0 @@ -/** - * marked - a markdown parser - * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked - */ - -;(function() { - -/** - * Block-Level Grammar - */ - -var block = { - newline: /^\n+/, - code: /^( {4}[^\n]+\n*)+/, - fences: noop, - hr: /^( *[-*_]){3,} *(?:\n+|$)/, - heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/, - nptable: noop, - lheading: /^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/, - blockquote: /^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/, - list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/, - html: /^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/, - def: /^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/, - table: noop, - paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/, - text: /^[^\n]+/ -}; - -block.bullet = /(?:[*+-]|\d+\.)/; -block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/; -block.item = replace(block.item, 'gm') - (/bull/g, block.bullet) - (); - -block.list = replace(block.list) - (/bull/g, block.bullet) - ('hr', '\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))') - ('def', '\\n+(?=' + block.def.source + ')') - (); - -block.blockquote = replace(block.blockquote) - ('def', block.def) - (); - -block._tag = '(?!(?:' - + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code' - + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo' - + '|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b'; - -block.html = replace(block.html) - ('comment', //) - ('closed', /<(tag)[\s\S]+?<\/\1>/) - ('closing', /])*?>/) - (/tag/g, block._tag) - (); - -block.paragraph = replace(block.paragraph) - ('hr', block.hr) - ('heading', block.heading) - ('lheading', block.lheading) - ('blockquote', block.blockquote) - ('tag', '<' + block._tag) - ('def', block.def) - (); - -/** - * Normal Block Grammar - */ - -block.normal = merge({}, block); - -/** - * GFM Block Grammar - */ - -block.gfm = merge({}, block.normal, { - fences: /^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/, - paragraph: /^/, - heading: /^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/ -}); - -block.gfm.paragraph = replace(block.paragraph) - ('(?!', '(?!' - + block.gfm.fences.source.replace('\\1', '\\2') + '|' - + block.list.source.replace('\\1', '\\3') + '|') - (); - -/** - * GFM + Tables Block Grammar - */ - -block.tables = merge({}, block.gfm, { - nptable: /^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/, - table: /^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/ -}); - -/** - * Block Lexer - */ - -function Lexer(options) { - this.tokens = []; - this.tokens.links = {}; - this.options = options || marked.defaults; - this.rules = block.normal; - - if (this.options.gfm) { - if (this.options.tables) { - this.rules = block.tables; - } else { - this.rules = block.gfm; - } - } -} - -/** - * Expose Block Rules - */ - -Lexer.rules = block; - -/** - * Static Lex Method - */ - -Lexer.lex = function(src, options) { - var lexer = new Lexer(options); - return lexer.lex(src); -}; - -/** - * Preprocessing - */ - -Lexer.prototype.lex = function(src) { - src = src - .replace(/\r\n|\r/g, '\n') - .replace(/\t/g, ' ') - .replace(/\u00a0/g, ' ') - .replace(/\u2424/g, '\n'); - - return this.token(src, true); -}; - -/** - * Lexing - */ - -Lexer.prototype.token = function(src, top, bq) { - var src = src.replace(/^ +$/gm, '') - , next - , loose - , cap - , bull - , b - , item - , space - , i - , l; - - while (src) { - // newline - if (cap = this.rules.newline.exec(src)) { - src = src.substring(cap[0].length); - if (cap[0].length > 1) { - this.tokens.push({ - type: 'space' - }); - } - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - cap = cap[0].replace(/^ {4}/gm, ''); - this.tokens.push({ - type: 'code', - text: !this.options.pedantic - ? cap.replace(/\n+$/, '') - : cap - }); - continue; - } - - // fences (gfm) - if (cap = this.rules.fences.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'code', - lang: cap[2], - text: cap[3] || '' - }); - continue; - } - - // heading - if (cap = this.rules.heading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[1].length, - text: cap[2] - }); - continue; - } - - // table no leading pipe (gfm) - if (top && (cap = this.rules.nptable.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i].split(/ *\| */); - } - - this.tokens.push(item); - - continue; - } - - // lheading - if (cap = this.rules.lheading.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'heading', - depth: cap[2] === '=' ? 1 : 2, - text: cap[1] - }); - continue; - } - - // hr - if (cap = this.rules.hr.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'hr' - }); - continue; - } - - // blockquote - if (cap = this.rules.blockquote.exec(src)) { - src = src.substring(cap[0].length); - - this.tokens.push({ - type: 'blockquote_start' - }); - - cap = cap[0].replace(/^ *> ?/gm, ''); - - // Pass `top` to keep the current - // "toplevel" state. This is exactly - // how markdown.pl works. - this.token(cap, top, true); - - this.tokens.push({ - type: 'blockquote_end' - }); - - continue; - } - - // list - if (cap = this.rules.list.exec(src)) { - src = src.substring(cap[0].length); - bull = cap[2]; - - this.tokens.push({ - type: 'list_start', - ordered: bull.length > 1 - }); - - // Get each top-level item. - cap = cap[0].match(this.rules.item); - - next = false; - l = cap.length; - i = 0; - - for (; i < l; i++) { - item = cap[i]; - - // Remove the list item's bullet - // so it is seen as the next token. - space = item.length; - item = item.replace(/^ *([*+-]|\d+\.) +/, ''); - - // Outdent whatever the - // list item contains. Hacky. - if (~item.indexOf('\n ')) { - space -= item.length; - item = !this.options.pedantic - ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') - : item.replace(/^ {1,4}/gm, ''); - } - - // Determine whether the next list item belongs here. - // Backpedal if it does not belong in this list. - if (this.options.smartLists && i !== l - 1) { - b = block.bullet.exec(cap[i + 1])[0]; - if (bull !== b && !(bull.length > 1 && b.length > 1)) { - src = cap.slice(i + 1).join('\n') + src; - i = l - 1; - } - } - - // Determine whether item is loose or not. - // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/ - // for discount behavior. - loose = next || /\n\n(?!\s*$)/.test(item); - if (i !== l - 1) { - next = item.charAt(item.length - 1) === '\n'; - if (!loose) loose = next; - } - - this.tokens.push({ - type: loose - ? 'loose_item_start' - : 'list_item_start' - }); - - // Recurse. - this.token(item, false, bq); - - this.tokens.push({ - type: 'list_item_end' - }); - } - - this.tokens.push({ - type: 'list_end' - }); - - continue; - } - - // html - if (cap = this.rules.html.exec(src)) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: this.options.sanitize - ? 'paragraph' - : 'html', - pre: !this.options.sanitizer - && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'), - text: cap[0] - }); - continue; - } - - // def - if ((!bq && top) && (cap = this.rules.def.exec(src))) { - src = src.substring(cap[0].length); - this.tokens.links[cap[1].toLowerCase()] = { - href: cap[2], - title: cap[3] - }; - continue; - } - - // table (gfm) - if (top && (cap = this.rules.table.exec(src))) { - src = src.substring(cap[0].length); - - item = { - type: 'table', - header: cap[1].replace(/^ *| *\| *$/g, '').split(/ *\| */), - align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */), - cells: cap[3].replace(/(?: *\| *)?\n$/, '').split('\n') - }; - - for (i = 0; i < item.align.length; i++) { - if (/^ *-+: *$/.test(item.align[i])) { - item.align[i] = 'right'; - } else if (/^ *:-+: *$/.test(item.align[i])) { - item.align[i] = 'center'; - } else if (/^ *:-+ *$/.test(item.align[i])) { - item.align[i] = 'left'; - } else { - item.align[i] = null; - } - } - - for (i = 0; i < item.cells.length; i++) { - item.cells[i] = item.cells[i] - .replace(/^ *\| *| *\| *$/g, '') - .split(/ *\| */); - } - - this.tokens.push(item); - - continue; - } - - // top-level paragraph - if (top && (cap = this.rules.paragraph.exec(src))) { - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'paragraph', - text: cap[1].charAt(cap[1].length - 1) === '\n' - ? cap[1].slice(0, -1) - : cap[1] - }); - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - // Top-level should never reach here. - src = src.substring(cap[0].length); - this.tokens.push({ - type: 'text', - text: cap[0] - }); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return this.tokens; -}; - -/** - * Inline-Level Grammar - */ - -var inline = { - escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, - autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, - url: noop, - tag: /^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/, - link: /^!?\[(inside)\]\(href\)/, - reflink: /^!?\[(inside)\]\s*\[([^\]]*)\]/, - nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, - strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, - em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, - code: /^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/, - br: /^ {2,}\n(?!\s*$)/, - del: noop, - text: /^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/; - -inline.link = replace(inline.link) - ('inside', inline._inside) - ('href', inline._href) - (); - -inline.reflink = replace(inline.reflink) - ('inside', inline._inside) - (); - -/** - * Normal Inline Grammar - */ - -inline.normal = merge({}, inline); - -/** - * Pedantic Inline Grammar - */ - -inline.pedantic = merge({}, inline.normal, { - strong: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/, - em: /^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/ -}); - -/** - * GFM Inline Grammar - */ - -inline.gfm = merge({}, inline.normal, { - escape: replace(inline.escape)('])', '~|])')(), - url: /^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/, - del: /^~~(?=\S)([\s\S]*?\S)~~/, - text: replace(inline.text) - (']|', '~]|') - ('|', '|https?://|') - () -}); - -/** - * GFM + Line Breaks Inline Grammar - */ - -inline.breaks = merge({}, inline.gfm, { - br: replace(inline.br)('{2,}', '*')(), - text: replace(inline.gfm.text)('{2,}', '*')() -}); - -/** - * Inline Lexer & Compiler - */ - -function InlineLexer(links, options) { - this.options = options || marked.defaults; - this.links = links; - this.rules = inline.normal; - this.renderer = this.options.renderer || new Renderer; - this.renderer.options = this.options; - - if (!this.links) { - throw new - Error('Tokens array requires a `links` property.'); - } - - if (this.options.gfm) { - if (this.options.breaks) { - this.rules = inline.breaks; - } else { - this.rules = inline.gfm; - } - } else if (this.options.pedantic) { - this.rules = inline.pedantic; - } -} - -/** - * Expose Inline Rules - */ - -InlineLexer.rules = inline; - -/** - * Static Lexing/Compiling Method - */ - -InlineLexer.output = function(src, links, options) { - var inline = new InlineLexer(links, options); - return inline.output(src); -}; - -/** - * Lexing/Compiling - */ - -InlineLexer.prototype.output = function(src) { - var out = '' - , link - , text - , href - , cap; - - while (src) { - // escape - if (cap = this.rules.escape.exec(src)) { - src = src.substring(cap[0].length); - out += cap[1]; - continue; - } - - // autolink - if (cap = this.rules.autolink.exec(src)) { - src = src.substring(cap[0].length); - if (cap[2] === '@') { - text = cap[1].charAt(6) === ':' - ? this.mangle(cap[1].substring(7)) - : this.mangle(cap[1]); - href = this.mangle('mailto:') + text; - } else { - text = escape(cap[1]); - href = text; - } - out += this.renderer.link(href, null, text); - continue; - } - - // url (gfm) - if (!this.inLink && (cap = this.rules.url.exec(src))) { - src = src.substring(cap[0].length); - text = escape(cap[1]); - href = text; - out += this.renderer.link(href, null, text); - continue; - } - - // tag - if (cap = this.rules.tag.exec(src)) { - if (!this.inLink && /^/i.test(cap[0])) { - this.inLink = false; - } - src = src.substring(cap[0].length); - out += this.options.sanitize - ? this.options.sanitizer - ? this.options.sanitizer(cap[0]) - : escape(cap[0]) - : cap[0] - continue; - } - - // link - if (cap = this.rules.link.exec(src)) { - src = src.substring(cap[0].length); - this.inLink = true; - out += this.outputLink(cap, { - href: cap[2], - title: cap[3] - }); - this.inLink = false; - continue; - } - - // reflink, nolink - if ((cap = this.rules.reflink.exec(src)) - || (cap = this.rules.nolink.exec(src))) { - src = src.substring(cap[0].length); - link = (cap[2] || cap[1]).replace(/\s+/g, ' '); - link = this.links[link.toLowerCase()]; - if (!link || !link.href) { - out += cap[0].charAt(0); - src = cap[0].substring(1) + src; - continue; - } - this.inLink = true; - out += this.outputLink(cap, link); - this.inLink = false; - continue; - } - - // strong - if (cap = this.rules.strong.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.strong(this.output(cap[2] || cap[1])); - continue; - } - - // em - if (cap = this.rules.em.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.em(this.output(cap[2] || cap[1])); - continue; - } - - // code - if (cap = this.rules.code.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.codespan(escape(cap[2], true)); - continue; - } - - // br - if (cap = this.rules.br.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.br(); - continue; - } - - // del (gfm) - if (cap = this.rules.del.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.del(this.output(cap[1])); - continue; - } - - // text - if (cap = this.rules.text.exec(src)) { - src = src.substring(cap[0].length); - out += this.renderer.text(escape(this.smartypants(cap[0]))); - continue; - } - - if (src) { - throw new - Error('Infinite loop on byte: ' + src.charCodeAt(0)); - } - } - - return out; -}; - -/** - * Compile Link - */ - -InlineLexer.prototype.outputLink = function(cap, link) { - var href = escape(link.href) - , title = link.title ? escape(link.title) : null; - - return cap[0].charAt(0) !== '!' - ? this.renderer.link(href, title, this.output(cap[1])) - : this.renderer.image(href, title, escape(cap[1])); -}; - -/** - * Smartypants Transformations - */ - -InlineLexer.prototype.smartypants = function(text) { - if (!this.options.smartypants) return text; - return text - // em-dashes - .replace(/---/g, '\u2014') - // en-dashes - .replace(/--/g, '\u2013') - // opening singles - .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') - // closing singles & apostrophes - .replace(/'/g, '\u2019') - // opening doubles - .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c') - // closing doubles - .replace(/"/g, '\u201d') - // ellipses - .replace(/\.{3}/g, '\u2026'); -}; - -/** - * Mangle Links - */ - -InlineLexer.prototype.mangle = function(text) { - if (!this.options.mangle) return text; - var out = '' - , l = text.length - , i = 0 - , ch; - - for (; i < l; i++) { - ch = text.charCodeAt(i); - if (Math.random() > 0.5) { - ch = 'x' + ch.toString(16); - } - out += '&#' + ch + ';'; - } - - return out; -}; - -/** - * Renderer - */ - -function Renderer(options) { - this.options = options || {}; -} - -Renderer.prototype.code = function(code, lang, escaped) { - if (this.options.highlight) { - var out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - - if (!lang) { - return '
'
-      + (escaped ? code : escape(code, true))
-      + '\n
'; - } - - return '
'
-    + (escaped ? code : escape(code, true))
-    + '\n
\n'; -}; - -Renderer.prototype.blockquote = function(quote) { - return '
\n' + quote + '
\n'; -}; - -Renderer.prototype.html = function(html) { - return html; -}; - -Renderer.prototype.heading = function(text, level, raw) { - return '' - + text - + '\n'; -}; - -Renderer.prototype.hr = function() { - return this.options.xhtml ? '
\n' : '
\n'; -}; - -Renderer.prototype.list = function(body, ordered) { - var type = ordered ? 'ol' : 'ul'; - return '<' + type + '>\n' + body + '\n'; -}; - -Renderer.prototype.listitem = function(text) { - return '
  • ' + text + '
  • \n'; -}; - -Renderer.prototype.paragraph = function(text) { - return '

    ' + text + '

    \n'; -}; - -Renderer.prototype.table = function(header, body) { - return '\n' - + '\n' - + header - + '\n' - + '\n' - + body - + '\n' - + '
    \n'; -}; - -Renderer.prototype.tablerow = function(content) { - return '\n' + content + '\n'; -}; - -Renderer.prototype.tablecell = function(content, flags) { - var type = flags.header ? 'th' : 'td'; - var tag = flags.align - ? '<' + type + ' style="text-align:' + flags.align + '">' - : '<' + type + '>'; - return tag + content + '\n'; -}; - -// span level renderer -Renderer.prototype.strong = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.em = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.codespan = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.br = function() { - return this.options.xhtml ? '
    ' : '
    '; -}; - -Renderer.prototype.del = function(text) { - return '' + text + ''; -}; - -Renderer.prototype.link = function(href, title, text) { - if (this.options.sanitize) { - try { - var prot = decodeURIComponent(unescape(href)) - .replace(/[^\w:]/g, '') - .toLowerCase(); - } catch (e) { - return ''; - } - if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) { - return ''; - } - } - var out = '
    '; - return out; -}; - -Renderer.prototype.image = function(href, title, text) { - var out = '' + text + '' : '>'; - return out; -}; - -Renderer.prototype.text = function(text) { - return text; -}; - -/** - * Parsing & Compiling - */ - -function Parser(options) { - this.tokens = []; - this.token = null; - this.options = options || marked.defaults; - this.options.renderer = this.options.renderer || new Renderer; - this.renderer = this.options.renderer; - this.renderer.options = this.options; -} - -/** - * Static Parse Method - */ - -Parser.parse = function(src, options, renderer) { - var parser = new Parser(options, renderer); - return parser.parse(src); -}; - -/** - * Parse Loop - */ - -Parser.prototype.parse = function(src) { - this.inline = new InlineLexer(src.links, this.options, this.renderer); - this.tokens = src.reverse(); - - var out = ''; - while (this.next()) { - out += this.tok(); - } - - return out; -}; - -/** - * Next Token - */ - -Parser.prototype.next = function() { - return this.token = this.tokens.pop(); -}; - -/** - * Preview Next Token - */ - -Parser.prototype.peek = function() { - return this.tokens[this.tokens.length - 1] || 0; -}; - -/** - * Parse Text Tokens - */ - -Parser.prototype.parseText = function() { - var body = this.token.text; - - while (this.peek().type === 'text') { - body += '\n' + this.next().text; - } - - return this.inline.output(body); -}; - -/** - * Parse Current Token - */ - -Parser.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 header = '' - , body = '' - , i - , row - , cell - , flags - , j; - - // header - cell = ''; - for (i = 0; i < this.token.header.length; i++) { - flags = { header: true, align: this.token.align[i] }; - cell += this.renderer.tablecell( - this.inline.output(this.token.header[i]), - { header: true, align: this.token.align[i] } - ); - } - header += this.renderer.tablerow(cell); - - for (i = 0; i < this.token.cells.length; i++) { - row = this.token.cells[i]; - - cell = ''; - for (j = 0; j < row.length; j++) { - cell += this.renderer.tablecell( - this.inline.output(row[j]), - { header: false, align: this.token.align[j] } - ); - } - - body += this.renderer.tablerow(cell); - } - return this.renderer.table(header, body); - } - case 'blockquote_start': { - var body = ''; - - while (this.next().type !== 'blockquote_end') { - body += this.tok(); - } - - return this.renderer.blockquote(body); - } - case 'list_start': { - var body = '' - , ordered = this.token.ordered; - - while (this.next().type !== 'list_end') { - body += this.tok(); - } - - return this.renderer.list(body, ordered); - } - case 'list_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this.token.type === 'text' - ? this.parseText() - : this.tok(); - } - - return this.renderer.listitem(body); - } - case 'loose_item_start': { - var body = ''; - - while (this.next().type !== 'list_item_end') { - body += this.tok(); - } - - return this.renderer.listitem(body); - } - case 'html': { - var html = !this.token.pre && !this.options.pedantic - ? this.inline.output(this.token.text) - : this.token.text; - return this.renderer.html(html); - } - case 'paragraph': { - return this.renderer.paragraph(this.inline.output(this.token.text)); - } - case 'text': { - return this.renderer.paragraph(this.parseText()); - } - } -}; - -/** - * Helpers - */ - -function escape(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function unescape(html) { - return html.replace(/&([#\w]+);/g, function(_, n) { - n = n.toLowerCase(); - if (n === 'colon') return ':'; - if (n.charAt(0) === '#') { - return n.charAt(1) === 'x' - ? String.fromCharCode(parseInt(n.substring(2), 16)) - : String.fromCharCode(+n.substring(1)); - } - return ''; - }); -} - -function replace(regex, opt) { - regex = regex.source; - opt = opt || ''; - return function self(name, val) { - if (!name) return new RegExp(regex, opt); - val = val.source || val; - val = val.replace(/(^|[^\[])\^/g, '$1'); - regex = regex.replace(name, val); - return self; - }; -} - -function noop() {} -noop.exec = noop; - -function merge(obj) { - var i = 1 - , target - , key; - - for (; i < arguments.length; i++) { - target = arguments[i]; - for (key in target) { - if (Object.prototype.hasOwnProperty.call(target, key)) { - obj[key] = target[key]; - } - } - } - - return obj; -} - - -/** - * Marked - */ - -function marked(src, opt, callback) { - if (callback || typeof opt === 'function') { - if (!callback) { - callback = opt; - opt = null; - } - - opt = merge({}, marked.defaults, opt || {}); - - var highlight = opt.highlight - , tokens - , pending - , i = 0; - - try { - tokens = Lexer.lex(src, opt) - } catch (e) { - return callback(e); - } - - pending = tokens.length; - - var done = function(err) { - if (err) { - opt.highlight = highlight; - return callback(err); - } - - var out; - - try { - out = Parser.parse(tokens, opt); - } catch (e) { - err = e; - } - - opt.highlight = highlight; - - return err - ? callback(err) - : callback(null, out); - }; - - if (!highlight || highlight.length < 3) { - return done(); - } - - delete opt.highlight; - - if (!pending) return done(); - - for (; i < tokens.length; i++) { - (function(token) { - if (token.type !== 'code') { - return --pending || done(); - } - return highlight(token.text, token.lang, function(err, code) { - if (err) return done(err); - if (code == null || code === token.text) { - return --pending || done(); - } - token.text = code; - token.escaped = true; - --pending || done(); - }); - })(tokens[i]); - } - - return; - } - try { - if (opt) opt = merge({}, marked.defaults, opt); - return Parser.parse(Lexer.lex(src, opt), opt); - } catch (e) { - e.message += '\nPlease report this to https://github.com/chjj/marked.'; - if ((opt || marked.defaults).silent) { - return '

    An error occured:

    '
    -        + escape(e.message + '', true)
    -        + '
    '; - } - throw e; - } -} - -/** - * Options - */ - -marked.options = -marked.setOptions = function(opt) { - merge(marked.defaults, opt); - return marked; -}; - -marked.defaults = { - gfm: true, - tables: true, - breaks: false, - pedantic: false, - sanitize: false, - sanitizer: null, - mangle: true, - smartLists: false, - silent: false, - highlight: null, - langPrefix: 'lang-', - smartypants: false, - headerPrefix: '', - renderer: new Renderer, - xhtml: false -}; - -/** - * Expose - */ - -marked.Parser = Parser; -marked.parser = Parser.parse; - -marked.Renderer = Renderer; - -marked.Lexer = Lexer; -marked.lexer = Lexer.lex; - -marked.InlineLexer = InlineLexer; -marked.inlineLexer = InlineLexer.output; - -marked.parse = marked; - -if (typeof module !== 'undefined' && typeof exports === 'object') { - module.exports = marked; -} else if (typeof define === 'function' && define.amd) { - define(function() { return marked; }); -} else { - this.marked = marked; -} - -}).call(function() { - return this || (typeof window !== 'undefined' ? window : global); -}()); \ No newline at end of file diff --git a/js/min/defiant.js b/js/min/defiant.js deleted file mode 100644 index dbaa77e..0000000 --- a/js/min/defiant.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * 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("")+"":"/>"))},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+""}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+"")},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 deleted file mode 100644 index f645d60..0000000 --- a/js/min/dictionaryBuilder.js +++ /dev/null @@ -1 +0,0 @@ -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=document.getElementById("errorMessage"),a="",c=document.getElementById("updateConflict");if(""==e||""==i&&""==r)""==e?(a+="Word cannot be blank",a+=""==i&&""==r?" and you need at least one definition.":"."):""==i&&""==r&&(a+="You need at least one definition.");else{var s=currentDictionary.settings.allowDuplicates?-1:WordIndex(e);if(s>=0)if(WordAtIndexWasChanged(s,e,t,n,i,r)){document.getElementById("newWordButtonArea").style.display="none",DisableForm(""),c.style.display="block";var d="\""+e+'" is already in the dictionary';d+=currentDictionary.words[s].name!=e?' as "'+currentDictionary.words[s].name+'", and your dictionary is set to ignore case.':".",d+="
    Do you want to update it to what you have set above?
    ",d+='",d+=' ',c.innerHTML=d}else a='"'+e+'" is already in the dictionary exactly as it is written above',currentDictionary.words[s].name!=e&&(a+=". (Your dictionary is currently set to ignore case.)");else currentDictionary.words.push({name:e,pronunciation:t,partOfSpeech:n.length>0?n:" ",simpleDefinition:i,longDefinition:r,wordId:currentDictionary.nextWordId++}),SaveAndUpdateWords("new"),FocusAfterAddingNewWord(),NewWordNotification(e);o.innerHTML=""}o.innerHTML=a}function ShowWordEditForm(e){var t=e.toString(),n=currentDictionary.words[e],i='

    Editing '+n.name+'

    IPA Characters
    ';document.getElementById("entry"+t).innerHTML=i,SetPartsOfSpeech("partOfSpeech"+t),document.getElementById("partOfSpeech"+t).value=htmlEntitiesParse(n.partOfSpeech)}function CancelEditForm(e){document.getElementById("entry"+e.toString()).innerHTML=DictionaryEntry(e).replace("","").replace("","")}function EditWord(e){var t=htmlEntities(document.getElementById("word"+e).value).trim(),n=htmlEntities(document.getElementById("pronunciation"+e).value).trim(),i=htmlEntities(document.getElementById("partOfSpeech"+e).value).trim(),r=htmlEntities(document.getElementById("simpleDefinition"+e).value).trim(),o=htmlEntities(document.getElementById("longDefinition"+e).value),a=document.getElementById("errorMessage"+e),c="",s=document.getElementById("updateConflict"+e);WordAtIndexWasChanged(e,t,n,i,r,o)?(document.getElementById("editWordButtonArea"+e).style.display="none",DisableForm(e),s.style.display="block",s.innerHTML="Do you really want to change the word \""+currentDictionary.words[parseInt(e)].name+'" to what you have set above?
    ',s.innerHTML+='",s.innerHTML+='"):(c='No change has been made to "'+t+'"',currentDictionary.words[parseInt(e)].name!=t&&(c+=". (Your dictionary is currently set to ignore case.)")),a.innerHTML=c}function UpdateWord(e,t,n,i,r,o){currentDictionary.words[e].name=t,currentDictionary.words[e].pronunciation=n,currentDictionary.words[e].partOfSpeech=i.length>0?i:" ",currentDictionary.words[e].simpleDefinition=r,currentDictionary.words[e].longDefinition=o,SaveAndUpdateWords("update",e),window.scroll(savedScroll.x,savedScroll.y),wordFormIsLocked()||FocusAfterAddingNewWord()}function DeleteWord(e){var t=new XMLHttpRequest;t.open("POST","/php/ajax_dictionarymanagement.php?action=worddelete"),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.onreadystatechange=function(){return 4==t.readyState&&200==t.status?("deleted successfully"!=t.responseText&&"not signed in"!=t.responseText||(currentDictionary.words.splice(e,1),SaveWords(!1)),console.log(t.responseText),!0):!1},t.send("dict="+currentDictionary.externalID.toString()+"&word="+currentDictionary.words[e].wordId.toString())}function ShowDictionary(){var e=GetSelectedFilters(),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=currentDictionary.name+" Dictionary",loggedIn&¤tDictionary.settings.isPublic&&(u.innerHTML+="");var p=document.getElementById("dictionaryDescription");p.innerHTML=marked(htmlEntitiesParseForMarkdown(currentDictionary.description));var y=document.getElementById("theDictionary"),m="",D=0;if(currentDictionary.words.length>0)for(var g=0;g0&&e.indexOf(currentDictionary.words[g].partOfSpeech)>-1)&&(""==n||""!=n&&(i||r||o)&&t.indexOf(currentDictionary.words[g].wordId)>=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.";y.innerHTML=m,ShowFilterWordCount(D)}function DictionaryEntry(e){var t=regexParseForSearch(document.getElementById("searchBox").value),n=document.getElementById("searchOptionWord").checked,i=document.getElementById("searchOptionSimple").checked,r=document.getElementById("searchOptionLong").checked,o=!document.getElementById("searchCaseSensitive").checked,a=document.getElementById("searchIgnoreDiacritics").checked,c=new RegExp("("+(a?removeDiacritics(t)+"|"+t:t)+")","g"+(o?"i":"")),s=wordPronunciation=wordPartOfSpeech=wordSimpleDefinition=wordLongDefinition="";return s+=""!=t&&n?htmlEntities(htmlEntitiesParse(currentDictionary.words[e].name).replace(c,"$1")).replace(/<(\/?)searchterm>/g,"<$1searchterm>"):currentDictionary.words[e].name.toString(),""!=currentDictionary.words[e].pronunciation&&(wordPronunciation+=marked(htmlEntitiesParseForMarkdown(currentDictionary.words[e].pronunciation)).replace(/<\/?p>/g,""))," "!=currentDictionary.words[e].partOfSpeech&&""!=currentDictionary.words[e].partOfSpeech&&(wordPartOfSpeech+=currentDictionary.words[e].partOfSpeech.toString()),""!=currentDictionary.words[e].simpleDefinition&&(""!=t&&i?wordSimpleDefinition+=htmlEntities(htmlEntitiesParse(currentDictionary.words[e].simpleDefinition).replace(c,"$1")).replace(/<(\/?)searchterm>/g,"<$1searchterm>"):wordSimpleDefinition+=currentDictionary.words[e].simpleDefinition.toString()),""!=currentDictionary.words[e].longDefinition&&(""!=t&&r?wordLongDefinition+=marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(currentDictionary.words[e].longDefinition).replace(c,"$1")))).replace(/<(\/?)searchterm>\;/g,"<$1searchterm>"):wordLongDefinition+=marked(htmlEntitiesParseForMarkdown(currentDictionary.words[e].longDefinition))),DictionaryEntryTemplate({name:s,pronunciation:wordPronunciation,partOfSpeech:wordPartOfSpeech,simpleDefinition:wordSimpleDefinition,longDefinition:wordLongDefinition,wordId:currentDictionary.words[e].wordId.toString()},currentDictionary.settings.isComplete?!1:e)}function ManagementArea(e){var t="
    ";return t+="Edit",t+="Delete',t+="",t+="
    "}function DictionaryEntryTemplate(e,t){t="undefined"!=typeof t?t:!1;var n="",loggedIn&¤tDictionary.settings.isPublic&&(n+=""),n+="🔗",n+=""+e.name+"",""!=e.pronunciation&&(n+=""+e.pronunciation+""),""!=e.partOfSpeech&&(n+=""+e.partOfSpeech+""),n+="
    ",""!=e.simpleDefinition&&(n+=""+e.simpleDefinition+""),""!=e.longDefinition&&(n+=""+e.longDefinition+""),t!==!1&&(n+=ManagementArea(t)),n+="
    "}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(),ShowSettings(),document.getElementById("dictionaryNameEdit").focus()}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 SaveAndUpdateWords(e,t){var n="";"all"==e?n=JSON.stringify(currentDictionary.words):"update"==e?n=JSON.stringify(currentDictionary.words[t]):"new"==e&&(n=JSON.stringify(currentDictionary.words[currentDictionary.words.length-1]));var i=new XMLHttpRequest;i.open("POST","/php/ajax_dictionarymanagement.php?action=word"+e+"&dict="+currentDictionary.externalID.toString()+"&nextwordid="+currentDictionary.nextWordId.toString()),i.setRequestHeader("Content-Type","application/json; charset=UTF-8"),i.onreadystatechange=function(){return 4==i.readyState&&200==i.status?(SaveWords(),ClearForm(),console.log(i.responseText),!0):!1},i.send(n)}function SaveWords(){currentDictionary.settings.sortByEquivalent?currentDictionary.words.sort(dynamicSort(["simpleDefinition","partOfSpeech"])):currentDictionary.words.sort(dynamicSort(["name","partOfSpeech"])),SaveDictionary(!1),ProcessLoad()}function SaveAndUpdateDictionary(e){SaveDictionary(!0),ShowDictionary(),e||ClearForm(),CloseUpdateConflictArea("")}function SaveDictionary(e){e&&SendDictionary(),localStorage.setItem("dictionary",JSON.stringify(currentDictionary)),SavePreviousDictionary()}function SendDictionary(){var e="",t="";currentDictionary.externalID>0?(e="update",t=DataToSend(!1)):(e="new",t=DataToSend(!0));var n=new XMLHttpRequest;n.open("POST","/php/ajax_dictionarymanagement.php?action="+e),n.setRequestHeader("Content-type","application/x-www-form-urlencoded"),n.onreadystatechange=function(){return 4==n.readyState&&200==n.status?("updated successfully"==n.responseText?(console.log(n.responseText),LoadUserDictionaries(),ProcessLoad()):isNaN(parseInt(n.responseText))?console.log(n.responseText):(currentDictionary.externalID=parseInt(n.responseText),currentDictionary.words.length>0&&SaveAndUpdateWords("all"),LoadUserDictionaries(),ProcessLoad(),console.log("saved "+parseInt(n.responseText).toString()+" successfully")),!0):!1},n.send(t)}function DataToSend(e){e="undefined"!=typeof e&&null!=e?e:!1;var t="";return 0==currentDictionary.externalID?(t="name="+encodeURIComponent(currentDictionary.name)+"&description="+encodeURIComponent(currentDictionary.description)+"&words="+encodeURIComponent(JSON.stringify(currentDictionary.words)),t+="&nextwordid="+currentDictionary.nextWordId+"&allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")+"&casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0"),t+="&partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)+"&sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")+"&iscomplete="+(currentDictionary.settings.isComplete?"1":"0")+"&ispublic="+(currentDictionary.settings.isPublic?"1":"0")):((e||currentDictionary.name!=previousDictionary.name)&&(t+="name="+encodeURIComponent(currentDictionary.name)),(e||currentDictionary.description!=previousDictionary.description)&&(t+=(""==t?"":"&")+"description="+encodeURIComponent(currentDictionary.description)),(e||currentDictionary.nextWordId!=previousDictionary.nextWordId)&&(t+=(""==t?"":"&")+"nextwordid="+currentDictionary.nextWordId),(e||currentDictionary.settings.allowDuplicates!=previousDictionary.allowDuplicates)&&(t+=(""==t?"":"&")+"allowduplicates="+(currentDictionary.settings.allowDuplicates?"1":"0")),(e||currentDictionary.settings.caseSensitive!=previousDictionary.caseSensitive)&&(t+=(""==t?"":"&")+"casesensitive="+(currentDictionary.settings.caseSensitive?"1":"0")),(e||currentDictionary.settings.partsOfSpeech!=previousDictionary.partsOfSpeech)&&(t+=(""==t?"":"&")+"partsofspeech="+encodeURIComponent(currentDictionary.settings.partsOfSpeech)),(e||currentDictionary.settings.sortByEquivalent!=previousDictionary.sortByEquivalent)&&(t+=(""==t?"":"&")+"sortbyequivalent="+(currentDictionary.settings.sortByEquivalent?"1":"0")),(e||currentDictionary.settings.isComplete!=previousDictionary.isComplete)&&(t+=(""==t?"":"&")+"iscomplete="+(currentDictionary.settings.isComplete?"1":"0")),(e||currentDictionary.settings.isPublic!=previousDictionary.isPublic)&&(t+=(""==t?"":"&")+"ispublic="+(currentDictionary.settings.isPublic?"1":"0"))),t}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))),ProcessLoad()},e.send()}function ChangeDictionary(e){e="undefined"!=typeof e&&null!=e?e:document.getElementById("userDictionaries"),currentDictionary.externalID!=e.value&&e.options.length>0&&(ShowInfoWithText("

    Loading "+e.options[e.selectedIndex].text+"...

    "),HideSettings(),ChangeDictionaryToId(e.value,function(e){"no dictionaries"==e?(console.log(e),SendDictionary(!1)):e.length<60?console.log(e):(currentDictionary=JSON.parse(e),SaveDictionary(!1),ProcessLoad(),LoadUserDictionaries(),HideInfo())}))}function ChangeDictionaryToId(e,t){var n=new XMLHttpRequest;n.open("POST","/php/ajax_dictionarymanagement.php?action=switch"),n.setRequestHeader("Content-type","application/x-www-form-urlencoded");var i="newdictionaryid="+e.toString();n.onreadystatechange=function(){4==n.readyState&&200==n.status&&t(n.responseText)},n.send(i)}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(){var e=removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g,"");""==e&&(e="export"),download(e+".dict",localStorage.getItem("dictionary"))}function ExportWords(){if(currentDictionary.words.length>0){var e=removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g,"");""==e&&(e="export"),e+="_words";for(var t="word,pronunciation,part of speech,definition,explanation\n",n=0;n0||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),ProcessLoad(),HideInfo(),HideSettings(),document.getElementById("importFile").value="",NewNotification('Successfully Imported the "'+currentDictionary.name+'" Dictionary.');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 ImportWords(){if(currentDictionary.externalID>0||confirm("This will add words in a correctly formatted CSV file to your currently loaded dictionary. Do you still want to import?")){if(!window.FileReader)return alert("Your browser is not supported"),!1;if(document.getElementById("importWordsCSV").files.length>0){var e=document.getElementById("importWordsCSV").files[0],t=document.getElementById("importOptions");t.innerHTML="

    Importing Words...

    ";var n=0,i=0;Papa.parse(e,{header:!0,step:function(e,r){if(n++,e.data[0].word.trim().length>0&&(e.data[0].definition.trim().length>0||e.data[0].explanation.trim().length>0)||0==e.errors.length){var o=htmlEntities(e.data[0].word).trim(),a=htmlEntities(e.data[0].pronunciation).trim(),c=htmlEntities(e.data[0]["part of speech"]).trim().length>0?htmlEntities(e.data[0]["part of speech"]).trim():" ",s=htmlEntities(e.data[0].definition).trim(),d=htmlEntities(e.data[0].explanation).trim(),l=currentDictionary.nextWordId++;currentDictionary.words.push({name:o,pronunciation:a,partOfSpeech:c,simpleDefinition:s,longDefinition:d,wordId:l});var u=DictionaryEntryTemplate(currentDictionary.words[currentDictionary.words.length-1]);t.innerHTML+=u,i++}else if(e.data[0].word.trim().length>0)for(var p=0;pError on record #"+n.toString()+": "+e.errors[p].message+"

    ";document.getElementById("infoPage").scrollTop=document.getElementById("infoPage").scrollHeight},complete:function(e){SaveAndUpdateWords("all"),t.innerHTML+="

    The file has finished importing "+i.toString()+" words.

    ",NewNotification("Imported "+i.toString()+" words."),document.getElementById("importOptions").scrollTop=document.getElementById("importOptions").scrollHeight,document.getElementById("numberOfWordsInDictionary").innerHTML=currentDictionary.words.length.toString()}})}else alert("You must add a file to import.")}}function WordIndex(e,t){for(var n=0;n-1?o=l=a:(o=-n.moveStart("character",-a),o+=t.slice(0,o).split("\n").length-1,n.compareEndPoints("EndToEnd",c)>-1?l=a:(l=-n.moveEnd("character",-a),l+=t.slice(0,l).split("\n").length-1)))),{start:o,end:l}}function setSelectionRange(e,t,r){if(e.setSelectionRange)e.focus(),e.setSelectionRange(t,r);else if(e.createTextRange){var n=e.createTextRange();n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n.select()}}function SaveScroll(){var e=document.documentElement,t=(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),r=(window.pageYOffset||e.scrollTop)-(e.clientTop||0);savedScroll.x=t,savedScroll.y=r}function htmlEntities(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\\/g,"\").replace(/\n/g,"
    ")}function htmlEntitiesParse(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\/g,"\\").replace(/
    /g,"\n")}function htmlEntitiesParseForMarkdown(e){return String(e).replace(/"/g,'"').replace(/'/g,"'").replace(/\/g,"\\").replace(/
    /g,"\n")}function stripHtmlEntities(e){return String(e).replace(/&/g,"").replace(/</g,"").replace(/>/g,"").replace(/"/g,"").replace(/'/g,"").replace(/\/g,"").replace(/
    /g,"")}function htmlEntitiesParseForSearchEntry(e){return String(e).replace(/"/g,"%%%%").replace(/'/g,"````")}function htmlEntitiesParseForSearch(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"%%%%").replace(/'/g,"````")}function regexParseForSearch(e){return String(e).replace(/([\[\\\^\$\.\|\?\*\+\(\)\{\}\]])/g,"\\$1")}function dynamicSort(e){return function(t,r){return e.map(function(e){var n=1;return"-"===e[0]&&(n=-1,e=e.substring(1)),removeDiacritics(t[e]).toLowerCase()>removeDiacritics(r[e]).toLowerCase()?n:removeDiacritics(t[e]).toLowerCase()/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:

    "+s(c.message+"",!0)+"
    ";throw c}}var p={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:o,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:o,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:o,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};p.bullet=/(?:[*+-]|\d+\.)/,p.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,p.item=l(p.item,"gm")(/bull/g,p.bullet)(),p.list=l(p.list)(/bull/g,p.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+p.def.source+")")(),p.blockquote=l(p.blockquote)("def",p.def)(),p._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",p.html=l(p.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,p._tag)(),p.paragraph=l(p.paragraph)("hr",p.hr)("heading",p.heading)("lheading",p.lheading)("blockquote",p.blockquote)("tag","<"+p._tag)("def",p.def)(),p.normal=h({},p),p.gfm=h({},p.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),p.gfm.paragraph=l(p.paragraph)("(?!","(?!"+p.gfm.fences.source.replace("\\1","\\2")+"|"+p.list.source.replace("\\1","\\3")+"|")(),p.tables=h({},p.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),e.rules=p,e.lex=function(t,n){var r=new e(n);return r.lex(t)},e.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},e.prototype.token=function(e,t,n){for(var r,s,i,l,o,h,a,u,c,e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(t&&(i=this.rules.nptable.exec(e))){for(e=e.substring(i[0].length),h={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/\n$/,"").split("\n")},u=0;u ?/gm,""),this.token(i,t,!0),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),l=i[2],this.tokens.push({type:"list_start",ordered:l.length>1}),i=i[0].match(this.rules.item),r=!1,c=i.length,u=0;c>u;u++)h=i[u],a=h.length,h=h.replace(/^ *([*+-]|\d+\.) +/,""),~h.indexOf("\n ")&&(a-=h.length,h=this.options.pedantic?h.replace(/^ {1,4}/gm,""):h.replace(new RegExp("^ {1,"+a+"}","gm"),"")),this.options.smartLists&&u!==c-1&&(o=p.bullet.exec(i[u+1])[0],l===o||l.length>1&&o.length>1||(e=i.slice(u+1).join("\n")+e,u=c-1)),s=r||/\n\n(?!\s*$)/.test(h),u!==c-1&&(r="\n"===h.charAt(h.length-1),s||(s=r)),this.tokens.push({type:s?"loose_item_start":"list_item_start"}),this.token(h,!1,n),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(!n&&t&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),this.tokens.links[i[1].toLowerCase()]={href:i[2],title:i[3]};else if(t&&(i=this.rules.table.exec(e))){for(e=e.substring(i[0].length),h={type:"table",header:i[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:o,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:o,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,u.link=l(u.link)("inside",u._inside)("href",u._href)(),u.reflink=l(u.reflink)("inside",u._inside)(),u.normal=h({},u),u.pedantic=h({},u.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),u.gfm=h({},u.normal,{escape:l(u.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:l(u.text)("]|","~]|")("|","|https?://|")()}),u.breaks=h({},u.gfm,{br:l(u.br)("{2,}","*")(),text:l(u.gfm.text)("{2,}","*")()}),t.rules=u,t.output=function(e,n,r){var s=new t(n,r);return s.output(e)},t.prototype.output=function(e){for(var t,n,r,i,l="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),l+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=s(i[1]),r=n),l+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),l+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):s(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,l+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){l+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,l+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),l+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),l+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),l+=this.renderer.codespan(s(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),l+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),l+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),l+=this.renderer.text(s(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=s(i[1]),r=n,l+=this.renderer.link(r,null,n);return l},t.prototype.outputLink=function(e,t){var n=s(t.href),r=t.title?s(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,s(e[1]))},t.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},t.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;r>s;s++)t=e.charCodeAt(s),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},n.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:s(e,!0))+"\n
    \n":"
    "+(n?e:s(e,!0))+"\n
    "},n.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},n.prototype.html=function(e){return e},n.prototype.heading=function(e,t,n){return"'+e+"\n"},n.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},n.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},n.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},n.prototype.paragraph=function(e){return"

    "+e+"

    \n"},n.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
    \n"},n.prototype.tablerow=function(e){return"\n"+e+"\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.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.prototype.image=function(e,t,n){var r=''+n+'":">"},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;e0,e=!(b[0]instanceof Array);if(d){for(var g=0;g0&&(c+=i),c+=f(a[g],g);b.length>0&&(c+=j)}for(var h=0;hl;l++){l>0&&(c+=i);var m=d&&e?a[l]:l;c+=f(b[h][m],l)}h-1||" "===a.charAt(0)||" "===a.charAt(a.length-1);return c?'"'+a+'"':a}function g(a,b){for(var c=0;c-1)return!0;return!1}var h=!1,i=",",j="\r\n";if(c(),"string"==typeof a&&(a=JSON.parse(a)),a instanceof Array){if(!a.length||a[0]instanceof Array)return e(null,a);if("object"==typeof a[0])return e(d(a[0]),a)}else if("object"==typeof a)return"string"==typeof a.data&&(a.data=JSON.parse(a.data)),a.data instanceof Array&&(a.fields||(a.fields=a.meta&&a.meta.fields),a.fields||(a.fields=a.data[0]instanceof Array?a.fields:d(a.data[0])),a.data[0]instanceof Array||"object"==typeof a.data[0]||(a.data=[a.data])),e(a.fields||[],a.data||[]);throw"exception: Unable to serialize unrecognized input"}function c(a){function b(a){var b=o(a);b.chunkSize=parseInt(b.chunkSize),a.step||a.chunk||(b.chunkSize=null),this._handle=new g(b),this._handle.streamer=this,this._config=b}this._handle=null,this._paused=!1,this._finished=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},b.call(this,a),this.parseChunk=function(a){if(this.isFirstChunk&&q(this._config.beforeFirstChunk)){var b=this._config.beforeFirstChunk(a);void 0!==b&&(a=b)}this.isFirstChunk=!1;var c=this._partialLine+a;this._partialLine="";var d=this._handle.parse(c,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var e=d.meta.cursor;this._finished||(this._partialLine=c.substring(e-this._baseIndex),this._baseIndex=e),d&&d.data&&(this._rowCount+=d.data.length);var f=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(u)s.postMessage({results:d,workerId:y.WORKER_ID,finished:f});else if(q(this._config.chunk)){if(this._config.chunk(d,this._handle),this._paused)return;d=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(d.data),this._completeResults.errors=this._completeResults.errors.concat(d.errors),this._completeResults.meta=d.meta),!f||!q(this._config.complete)||d&&d.meta.aborted||this._config.complete(this._completeResults,this._input),f||d&&d.meta.paused||this._nextChunk(),d}},this._sendError=function(a){q(this._config.error)?this._config.error(a):u&&this._config.error&&s.postMessage({workerId:y.WORKER_ID,error:a,finished:!1})}}function d(a){function b(a){var b=a.getResponseHeader("Content-Range");return parseInt(b.substr(b.lastIndexOf("/")+1))}a=a||{},a.chunkSize||(a.chunkSize=y.RemoteChunkSize),c.call(this,a);var d;t?this._nextChunk=function(){this._readChunk(),this._chunkLoaded()}:this._nextChunk=function(){this._readChunk()},this.stream=function(a){this._input=a,this._nextChunk()},this._readChunk=function(){if(this._finished)return void this._chunkLoaded();if(d=new XMLHttpRequest,this._config.withCredentials&&(d.withCredentials=this._config.withCredentials),t||(d.onload=p(this._chunkLoaded,this),d.onerror=p(this._chunkError,this)),d.open("GET",this._input,!t),this._config.chunkSize){var a=this._start+this._config.chunkSize-1;d.setRequestHeader("Range","bytes="+this._start+"-"+a),d.setRequestHeader("If-None-Match","webkit-no-cache")}try{d.send()}catch(b){this._chunkError(b.message)}t&&0===d.status?this._chunkError():this._start+=this._config.chunkSize},this._chunkLoaded=function(){if(4==d.readyState){if(d.status<200||d.status>=400)return void this._chunkError();this._finished=!this._config.chunkSize||this._start>b(d),this.parseChunk(d.responseText)}},this._chunkError=function(a){var b=d.statusText||a;this._sendError(b)}}function e(a){a=a||{},a.chunkSize||(a.chunkSize=y.LocalChunkSize),c.call(this,a);var b,d,e="undefined"!=typeof FileReader;this.stream=function(a){this._input=a,d=a.slice||a.webkitSlice||a.mozSlice,e?(b=new FileReader,b.onload=p(this._chunkLoaded,this),b.onerror=p(this._chunkError,this)):b=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(a.target.result)},this._chunkError=function(){this._sendError(b.error)}}function f(a){a=a||{},c.call(this,a);var b,d;this.stream=function(a){return b=a,d=a,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var a=this._config.chunkSize,b=a?d.substr(0,a):d;return d=a?d.substr(a):"",this._finished=!d,this.parseChunk(b)}}}function g(a){function b(){if(v&&m&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+y.DefaultDelimiter+"'"),m=!1),a.skipEmptyLines)for(var b=0;b=u.length?(c.__parsed_extra||(c.__parsed_extra=[]),c.__parsed_extra.push(v.data[b][d])):c[u[d]]=v.data[b][d])}a.header&&(v.data[b]=c,d>u.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+u.length+" fields but parsed "+d,b):d1&&(k+=Math.abs(o-f),f=o):f=o}m.data.length>0&&(l/=m.data.length),("undefined"==typeof e||e>k)&&l>1.99&&(e=k,d=j)}return a.delimiter=d,{successful:!!d,bestDelimiter:d}}function g(a){a=a.substr(0,1048576);var b=a.split("\r"),c=a.split("\n"),d=c.length>1&&c[0].length=b.length/2?"\r\n":"\r"}function i(a){var b=n.test(a);return b?parseFloat(a):a}function j(a,b,c,d){v.errors.push({type:a,code:b,message:c,row:d})}var k,l,m,n=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,p=this,r=0,s=!1,t=!1,u=[],v={data:[],errors:[],meta:{}};if(q(a.step)){var w=a.step;a.step=function(d){if(v=d,c())b();else{if(b(),0===v.data.length)return;r+=d.data.length,a.preview&&r>a.preview?l.abort():w(v,p)}}}this.parse=function(c,d,e){if(a.newline||(a.newline=g(c)),m=!1,!a.delimiter){var i=f(c,a.newline);i.successful?a.delimiter=i.bestDelimiter:(m=!0,a.delimiter=y.DefaultDelimiter),v.meta.delimiter=a.delimiter}var j=o(a);return a.preview&&a.header&&j.preview++,k=c,l=new h(j),v=l.parse(k,d,e),b(),s?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return s},this.pause=function(){s=!0,l.abort(),k=k.substr(l.getCharIndex())},this.resume=function(){s=!1,p.streamer.parseChunk(k)},this.aborted=function(){return t},this.abort=function(){t=!0,l.abort(),v.meta.aborted=!0,q(a.complete)&&a.complete(v),k=""}}function h(a){a=a||{};var b=a.delimiter,c=a.newline,d=a.comments,e=a.step,f=a.preview,g=a.fastMode;if(("string"!=typeof b||y.BAD_DELIMITERS.indexOf(b)>-1)&&(b=","),d===b)throw"Comment character same as delimiter";d===!0?d="#":("string"!=typeof d||y.BAD_DELIMITERS.indexOf(d)>-1)&&(d=!1),"\n"!=c&&"\r"!=c&&"\r\n"!=c&&(c="\n");var h=0,i=!1;this.parse=function(a,j,k){function l(a){v.push(a),y=h}function m(b){return k?o():("undefined"==typeof b&&(b=a.substr(h)),x.push(b),h=q,l(x),u&&p(),o())}function n(b){h=b,l(x),x=[],C=a.indexOf(c,h)}function o(a){return{data:v,errors:w,meta:{delimiter:b,linebreak:c,aborted:i,truncated:!!a,cursor:y+(j||0)}}}function p(){e(o()),v=[],w=[]}if("string"!=typeof a)throw"Input must be a string";var q=a.length,r=b.length,s=c.length,t=d.length,u="function"==typeof e;h=0;var v=[],w=[],x=[],y=0;if(!a)return o();if(g||g!==!1&&-1===a.indexOf('"')){for(var z=a.split(c),A=0;A=f)return v=v.slice(0,f),o(!0)}}return o()}for(var B=a.indexOf(b,h),C=a.indexOf(c,h);;)if('"'!==a[h])if(d&&0===x.length&&a.substr(h,t)===d){if(-1===C)return o();h=C+s,C=a.indexOf(c,h),B=a.indexOf(b,h)}else if(-1!==B&&(C>B||-1===C))x.push(a.substring(h,B)),h=B+r,B=a.indexOf(b,h);else{if(-1===C)break;if(x.push(a.substring(h,C)),n(C+s),u&&(p(),i))return o();if(f&&v.length>=f)return o(!0)}else{var D=h;for(h++;;){var D=a.indexOf('"',D+1);if(-1===D)return k||w.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:v.length,index:h}),m();if(D===q-1){var E=a.substring(h,D).replace(/""/g,'"');return m(E)}if('"'!==a[D+1]){if(a[D+1]===b){x.push(a.substring(h,D).replace(/""/g,'"')),h=D+1+r,B=a.indexOf(b,h),C=a.indexOf(c,h);break}if(a.substr(D+1,s)===c){if(x.push(a.substring(h,D).replace(/""/g,'"')),n(D+1+s),B=a.indexOf(b,h),u&&(p(),i))return o();if(f&&v.length>=f)return o(!0);break}}else D++}}return m()},this.abort=function(){i=!0},this.getCharIndex=function(){return h}}function i(){var a=document.getElementsByTagName("script");return a.length?a[a.length-1].src:""}function j(){if(!y.WORKERS_SUPPORTED)return!1;if(!v&&null===y.SCRIPT_PATH)throw new Error("Script path cannot be determined automatically when Papa Parse is loaded asynchronously. You need to set Papa.SCRIPT_PATH manually.");var a=y.SCRIPT_PATH||r;a+=(-1!==a.indexOf("?")?"&":"?")+"papaworker";var b=new s.Worker(a);return b.onmessage=k,b.id=x++,w[b.id]=b,b}function k(a){var b=a.data,c=w[b.workerId],d=!1;if(b.error)c.userError(b.error,b.file);else if(b.results&&b.results.data){var e=function(){d=!0,l(b.workerId,{data:[],errors:[],meta:{aborted:!0}})},f={abort:e,pause:m,resume:m};if(q(c.userStep)){for(var g=0;gNote: This dictionary is not yet complete and is likely to change.");var y=document.getElementById("dictionaryDescription");y.innerHTML=marked(htmlEntitiesParseForMarkdown(publicDictionary.description));var D=document.getElementById("theDictionary"),f="",g=0;if(publicDictionary.words.length>0)for(var w=0;w0&&i.indexOf(publicDictionary.words[w].partOfSpeech)>-1)&&(""==t||""!=t&&(r||o||c)&&n.indexOf(publicDictionary.words[w].wordId)>=0)&&(publicDictionary.words[w].hasOwnProperty("pronunciation")||(publicDictionary.words[w].pronunciation=""),publicDictionary.words[w].hasOwnProperty("wordId")||(publicDictionary.words[w].wordId=w+1),f+=PublicDictionaryEntry(w,e),g++);else f="There are no entries in the dictionary.";D.innerHTML=f,e||ShowFilterWordCount(g)}else document.getElementById("dictionaryContainer").innerHTML=publicDictionary}function PublicDictionaryEntry(e,i){var n=i?"":regexParseForSearch(document.getElementById("searchBox").value),t=i?!1:document.getElementById("searchOptionWord").checked,r=i?!1:document.getElementById("searchOptionSimple").checked,o=i?!1:document.getElementById("searchOptionLong").checked,c=i?!1:!document.getElementById("searchCaseSensitive").checked,a=i?!1:document.getElementById("searchIgnoreDiacritics").checked,l=new RegExp("("+(a?removeDiacritics(n)+"|"+n:n)+")","g"+(c?"i":"")),d=wordPronunciation=wordPartOfSpeech=wordSimpleDefinition=wordLongDefinition="";return d+=""!=n&&t?htmlEntities(htmlEntitiesParse(publicDictionary.words[e].name).replace(l,"$1")).replace(/<(\/?)searchterm>/g,"<$1searchterm>"):publicDictionary.words[e].name.toString(),""!=publicDictionary.words[e].pronunciation&&(wordPronunciation+=marked(htmlEntitiesParseForMarkdown(publicDictionary.words[e].pronunciation)).replace(/<\/?p>/g,""))," "!=publicDictionary.words[e].partOfSpeech&&""!=publicDictionary.words[e].partOfSpeech&&(wordPartOfSpeech+=publicDictionary.words[e].partOfSpeech.toString()),""!=publicDictionary.words[e].simpleDefinition&&(""!=n&&r?wordSimpleDefinition+=htmlEntities(htmlEntitiesParse(publicDictionary.words[e].simpleDefinition).replace(l,"$1")).replace(/<(\/?)searchterm>/g,"<$1searchterm>"):wordSimpleDefinition+=publicDictionary.words[e].simpleDefinition.toString()),""!=publicDictionary.words[e].longDefinition&&(""!=n&&o?wordLongDefinition+=marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(publicDictionary.words[e].longDefinition).replace(l,"$1")))).replace(/<(\/?)searchterm>\;/g,"<$1searchterm>"):wordLongDefinition+=marked(htmlEntitiesParseForMarkdown(publicDictionary.words[e].longDefinition))),PublicDictionaryEntryTemplate({name:d,pronunciation:wordPronunciation,partOfSpeech:wordPartOfSpeech,simpleDefinition:wordSimpleDefinition,longDefinition:wordLongDefinition,wordId:publicDictionary.words[e].wordId.toString()},!1)}function PublicDictionaryEntryTemplate(e,i){i="undefined"!=typeof i?i:!1;var n="",n+=""+e.name+"",""!=e.pronunciation&&(n+=""+e.pronunciation+""),""!=e.partOfSpeech&&(n+=""+e.partOfSpeech+""),n+="
    ",""!=e.simpleDefinition&&(n+=""+e.simpleDefinition+""),""!=e.longDefinition&&(n+=""+e.longDefinition+""),i!==!1&&(n+=ManagementArea(i)),n+=""}function SetPublicPartsOfSpeech(){for(var e=document.getElementById("filterOptions"),i=htmlEntitiesParse(publicDictionary.settings.partsOfSpeech).trim().split(","),n=0;n0)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,{sanitize:!1}):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?document.getElementById("newWordButtonArea").style.display="block":document.getElementById("editWordButtonArea"+e).style.display="block",document.getElementById("updateConflict"+e).style.display="none",EnableForm(e)}function DisableForm(e){document.getElementById("word"+e).disabled=!0,document.getElementById("pronunciation"+e).disabled=!0,document.getElementById("partOfSpeech"+e).disabled=!0,document.getElementById("simpleDefinition"+e).disabled=!0,document.getElementById("longDefinition"+e).disabled=!0}function EnableForm(e){document.getElementById("word"+e).disabled=!1,document.getElementById("pronunciation"+e).disabled=!1,document.getElementById("partOfSpeech"+e).disabled=!1,document.getElementById("simpleDefinition"+e).disabled=!1,document.getElementById("longDefinition"+e).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){ShowInfoWithText(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!")}function ShowInfoWithText(e){document.getElementById("infoText").innerHTML=e,document.getElementById("infoScreen").style.display="block",document.getElementById("infoPage").scrollTop=0,HideAccountSettings()}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(e){e="undefined"!=typeof e?e:"partOfSpeech";var t=document.getElementById(e),n=document.getElementById("filterOptions"),o=GetSelectedFilters();t.innerHTML="",n.innerHTML="";var i=document.createElement("option");i.appendChild(document.createTextNode("")),i.value=" ",t.appendChild(i);for(var r=htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(","),d=0;d-1&&(s.checked=!0),a.appendChild(s),n.appendChild(a)}var u=document.createElement("label");u.appendChild(document.createTextNode("Blanks ")),u["part-of-speech"]=" ",u.className="filterOption";var m=document.createElement("input");m.type="checkbox",m.onchange=function(){ShowDictionary()},o.indexOf(" ")>-1&&(m.checked=!0),u.appendChild(m),n.appendChild(u)}function GetSelectedFilters(){for(var e=document.getElementById("filterOptions"),t=[],n=0;n0||""!=n?o.innerHTML="Showing "+e.toString()+" result"+(1!=e?"s":""):o.innerHTML=""}function NewWordNotification(e){var t=currentDictionary.nextWordId-1;NewNotification("New Word Added: "+e+"")}function NewNotification(e){var t=document.getElementById("notificationArea"),n=document.getElementById("notificationMessage");t.style.display="block",n.innerHTML=e}function FocusAfterAddingNewWord(){document.getElementById("word").focus()} \ No newline at end of file diff --git a/js/papaparse.js b/js/papaparse.js deleted file mode 100644 index 34c35cf..0000000 --- a/js/papaparse.js +++ /dev/null @@ -1,1423 +0,0 @@ -/*! - Papa Parse - v4.1.2 - https://github.com/mholt/PapaParse -*/ -(function(root, factory) -{ - if (typeof define === 'function' && define.amd) - { - // AMD. Register as an anonymous module. - define([], factory); - } - else if (typeof module === 'object' && module.exports) - { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); - } - else - { - // Browser globals (root is window) - root.Papa = factory(); - } -}(this, function() -{ - 'use strict'; - - var global = Function('return this')(); - var IS_WORKER = !global.document && !!global.postMessage, - IS_PAPA_WORKER = IS_WORKER && /(\?|&)papaworker(=|&|$)/.test(global.location.search), - LOADED_SYNC = false, AUTO_SCRIPT_PATH; - var workers = {}, workerIdCounter = 0; - - var Papa = {}; - - Papa.parse = CsvToJson; - Papa.unparse = JsonToCsv; - - Papa.RECORD_SEP = String.fromCharCode(30); - Papa.UNIT_SEP = String.fromCharCode(31); - Papa.BYTE_ORDER_MARK = '\ufeff'; - Papa.BAD_DELIMITERS = ['\r', '\n', '"', Papa.BYTE_ORDER_MARK]; - Papa.WORKERS_SUPPORTED = !IS_WORKER && !!global.Worker; - Papa.SCRIPT_PATH = null; // Must be set by your code if you use workers and this lib is loaded asynchronously - - // Configurable chunk sizes for local and remote files, respectively - Papa.LocalChunkSize = 1024 * 1024 * 10; // 10 MB - Papa.RemoteChunkSize = 1024 * 1024 * 5; // 5 MB - Papa.DefaultDelimiter = ','; // Used if not specified and detection fails - - // Exposed for testing and development only - Papa.Parser = Parser; - Papa.ParserHandle = ParserHandle; - Papa.NetworkStreamer = NetworkStreamer; - Papa.FileStreamer = FileStreamer; - Papa.StringStreamer = StringStreamer; - - if (global.jQuery) - { - var $ = global.jQuery; - $.fn.parse = function(options) - { - var config = options.config || {}; - var queue = []; - - this.each(function(idx) - { - var supported = $(this).prop('tagName').toUpperCase() === 'INPUT' - && $(this).attr('type').toLowerCase() === 'file' - && global.FileReader; - - if (!supported || !this.files || this.files.length === 0) - return true; // continue to next input element - - for (var i = 0; i < this.files.length; i++) - { - queue.push({ - file: this.files[i], - inputElem: this, - instanceConfig: $.extend({}, config) - }); - } - }); - - parseNextFile(); // begin parsing - return this; // maintains chainability - - - function parseNextFile() - { - if (queue.length === 0) - { - if (isFunction(options.complete)) - options.complete(); - return; - } - - var f = queue[0]; - - if (isFunction(options.before)) - { - var returned = options.before(f.file, f.inputElem); - - if (typeof returned === 'object') - { - if (returned.action === 'abort') - { - error('AbortError', f.file, f.inputElem, returned.reason); - return; // Aborts all queued files immediately - } - else if (returned.action === 'skip') - { - fileComplete(); // parse the next file in the queue, if any - return; - } - else if (typeof returned.config === 'object') - f.instanceConfig = $.extend(f.instanceConfig, returned.config); - } - else if (returned === 'skip') - { - fileComplete(); // parse the next file in the queue, if any - return; - } - } - - // Wrap up the user's complete callback, if any, so that ours also gets executed - var userCompleteFunc = f.instanceConfig.complete; - f.instanceConfig.complete = function(results) - { - if (isFunction(userCompleteFunc)) - userCompleteFunc(results, f.file, f.inputElem); - fileComplete(); - }; - - Papa.parse(f.file, f.instanceConfig); - } - - function error(name, file, elem, reason) - { - if (isFunction(options.error)) - options.error({name: name}, file, elem, reason); - } - - function fileComplete() - { - queue.splice(0, 1); - parseNextFile(); - } - } - } - - - if (IS_PAPA_WORKER) - { - global.onmessage = workerThreadReceivedMessage; - } - else if (Papa.WORKERS_SUPPORTED) - { - AUTO_SCRIPT_PATH = getScriptPath(); - - // Check if the script was loaded synchronously - if (!document.body) - { - // Body doesn't exist yet, must be synchronous - LOADED_SYNC = true; - } - else - { - document.addEventListener('DOMContentLoaded', function () { - LOADED_SYNC = true; - }, true); - } - } - - - - - function CsvToJson(_input, _config) - { - _config = _config || {}; - - if (_config.worker && Papa.WORKERS_SUPPORTED) - { - var w = newWorker(); - - w.userStep = _config.step; - w.userChunk = _config.chunk; - w.userComplete = _config.complete; - w.userError = _config.error; - - _config.step = isFunction(_config.step); - _config.chunk = isFunction(_config.chunk); - _config.complete = isFunction(_config.complete); - _config.error = isFunction(_config.error); - delete _config.worker; // prevent infinite loop - - w.postMessage({ - input: _input, - config: _config, - workerId: w.id - }); - - return; - } - - var streamer = null; - if (typeof _input === 'string') - { - if (_config.download) - streamer = new NetworkStreamer(_config); - else - streamer = new StringStreamer(_config); - } - else if ((global.File && _input instanceof File) || _input instanceof Object) // ...Safari. (see issue #106) - streamer = new FileStreamer(_config); - - return streamer.stream(_input); - } - - - - - - - function JsonToCsv(_input, _config) - { - var _output = ''; - var _fields = []; - - // Default configuration - - /** whether to surround every datum with quotes */ - var _quotes = false; - - /** delimiting character */ - var _delimiter = ','; - - /** newline character(s) */ - var _newline = '\r\n'; - - unpackConfig(); - - if (typeof _input === 'string') - _input = JSON.parse(_input); - - if (_input instanceof Array) - { - if (!_input.length || _input[0] instanceof Array) - return serialize(null, _input); - else if (typeof _input[0] === 'object') - return serialize(objectKeys(_input[0]), _input); - } - else if (typeof _input === 'object') - { - if (typeof _input.data === 'string') - _input.data = JSON.parse(_input.data); - - if (_input.data instanceof Array) - { - if (!_input.fields) - _input.fields = _input.meta && _input.meta.fields; - - if (!_input.fields) - _input.fields = _input.data[0] instanceof Array - ? _input.fields - : objectKeys(_input.data[0]); - - if (!(_input.data[0] instanceof Array) && typeof _input.data[0] !== 'object') - _input.data = [_input.data]; // handles input like [1,2,3] or ['asdf'] - } - - return serialize(_input.fields || [], _input.data || []); - } - - // Default (any valid paths should return before this) - throw 'exception: Unable to serialize unrecognized input'; - - - function unpackConfig() - { - if (typeof _config !== 'object') - return; - - if (typeof _config.delimiter === 'string' - && _config.delimiter.length === 1 - && Papa.BAD_DELIMITERS.indexOf(_config.delimiter) === -1) - { - _delimiter = _config.delimiter; - } - - if (typeof _config.quotes === 'boolean' - || _config.quotes instanceof Array) - _quotes = _config.quotes; - - if (typeof _config.newline === 'string') - _newline = _config.newline; - } - - - /** Turns an object's keys into an array */ - function objectKeys(obj) - { - if (typeof obj !== 'object') - return []; - var keys = []; - for (var key in obj) - keys.push(key); - return keys; - } - - /** The double for loop that iterates the data and writes out a CSV string including header row */ - function serialize(fields, data) - { - var csv = ''; - - if (typeof fields === 'string') - fields = JSON.parse(fields); - if (typeof data === 'string') - data = JSON.parse(data); - - var hasHeader = fields instanceof Array && fields.length > 0; - var dataKeyedByField = !(data[0] instanceof Array); - - // If there a header row, write it first - if (hasHeader) - { - for (var i = 0; i < fields.length; i++) - { - if (i > 0) - csv += _delimiter; - csv += safe(fields[i], i); - } - if (data.length > 0) - csv += _newline; - } - - // Then write out the data - for (var row = 0; row < data.length; row++) - { - var maxCol = hasHeader ? fields.length : data[row].length; - - for (var col = 0; col < maxCol; col++) - { - if (col > 0) - csv += _delimiter; - var colIdx = hasHeader && dataKeyedByField ? fields[col] : col; - csv += safe(data[row][colIdx], col); - } - - if (row < data.length - 1) - csv += _newline; - } - - return csv; - } - - /** Encloses a value around quotes if needed (makes a value safe for CSV insertion) */ - function safe(str, col) - { - if (typeof str === 'undefined' || str === null) - return ''; - - str = str.toString().replace(/"/g, '""'); - - var needsQuotes = (typeof _quotes === 'boolean' && _quotes) - || (_quotes instanceof Array && _quotes[col]) - || hasAny(str, Papa.BAD_DELIMITERS) - || str.indexOf(_delimiter) > -1 - || str.charAt(0) === ' ' - || str.charAt(str.length - 1) === ' '; - - return needsQuotes ? '"' + str + '"' : str; - } - - function hasAny(str, substrings) - { - for (var i = 0; i < substrings.length; i++) - if (str.indexOf(substrings[i]) > -1) - return true; - return false; - } - } - - /** ChunkStreamer is the base prototype for various streamer implementations. */ - function ChunkStreamer(config) - { - this._handle = null; - this._paused = false; - this._finished = false; - this._input = null; - this._baseIndex = 0; - this._partialLine = ''; - this._rowCount = 0; - this._start = 0; - this._nextChunk = null; - this.isFirstChunk = true; - this._completeResults = { - data: [], - errors: [], - meta: {} - }; - replaceConfig.call(this, config); - - this.parseChunk = function(chunk) - { - // First chunk pre-processing - if (this.isFirstChunk && isFunction(this._config.beforeFirstChunk)) - { - var modifiedChunk = this._config.beforeFirstChunk(chunk); - if (modifiedChunk !== undefined) - chunk = modifiedChunk; - } - this.isFirstChunk = false; - - // Rejoin the line we likely just split in two by chunking the file - var aggregate = this._partialLine + chunk; - this._partialLine = ''; - - var results = this._handle.parse(aggregate, this._baseIndex, !this._finished); - - if (this._handle.paused() || this._handle.aborted()) - return; - - var lastIndex = results.meta.cursor; - - if (!this._finished) - { - this._partialLine = aggregate.substring(lastIndex - this._baseIndex); - this._baseIndex = lastIndex; - } - - if (results && results.data) - this._rowCount += results.data.length; - - var finishedIncludingPreview = this._finished || (this._config.preview && this._rowCount >= this._config.preview); - - if (IS_PAPA_WORKER) - { - global.postMessage({ - results: results, - workerId: Papa.WORKER_ID, - finished: finishedIncludingPreview - }); - } - else if (isFunction(this._config.chunk)) - { - this._config.chunk(results, this._handle); - if (this._paused) - return; - results = undefined; - this._completeResults = undefined; - } - - if (!this._config.step && !this._config.chunk) { - this._completeResults.data = this._completeResults.data.concat(results.data); - this._completeResults.errors = this._completeResults.errors.concat(results.errors); - this._completeResults.meta = results.meta; - } - - if (finishedIncludingPreview && isFunction(this._config.complete) && (!results || !results.meta.aborted)) - this._config.complete(this._completeResults, this._input); - - if (!finishedIncludingPreview && (!results || !results.meta.paused)) - this._nextChunk(); - - return results; - }; - - this._sendError = function(error) - { - if (isFunction(this._config.error)) - this._config.error(error); - else if (IS_PAPA_WORKER && this._config.error) - { - global.postMessage({ - workerId: Papa.WORKER_ID, - error: error, - finished: false - }); - } - }; - - function replaceConfig(config) - { - // Deep-copy the config so we can edit it - var configCopy = copy(config); - configCopy.chunkSize = parseInt(configCopy.chunkSize); // parseInt VERY important so we don't concatenate strings! - if (!config.step && !config.chunk) - configCopy.chunkSize = null; // disable Range header if not streaming; bad values break IIS - see issue #196 - this._handle = new ParserHandle(configCopy); - this._handle.streamer = this; - this._config = configCopy; // persist the copy to the caller - } - } - - - function NetworkStreamer(config) - { - config = config || {}; - if (!config.chunkSize) - config.chunkSize = Papa.RemoteChunkSize; - ChunkStreamer.call(this, config); - - var xhr; - - if (IS_WORKER) - { - this._nextChunk = function() - { - this._readChunk(); - this._chunkLoaded(); - }; - } - else - { - this._nextChunk = function() - { - this._readChunk(); - }; - } - - this.stream = function(url) - { - this._input = url; - this._nextChunk(); // Starts streaming - }; - - this._readChunk = function() - { - if (this._finished) - { - this._chunkLoaded(); - return; - } - - xhr = new XMLHttpRequest(); - - if (this._config.withCredentials) - { - xhr.withCredentials = this._config.withCredentials; - } - - if (!IS_WORKER) - { - xhr.onload = bindFunction(this._chunkLoaded, this); - xhr.onerror = bindFunction(this._chunkError, this); - } - - xhr.open('GET', this._input, !IS_WORKER); - - if (this._config.chunkSize) - { - var end = this._start + this._config.chunkSize - 1; // minus one because byte range is inclusive - xhr.setRequestHeader('Range', 'bytes='+this._start+'-'+end); - xhr.setRequestHeader('If-None-Match', 'webkit-no-cache'); // https://bugs.webkit.org/show_bug.cgi?id=82672 - } - - try { - xhr.send(); - } - catch (err) { - this._chunkError(err.message); - } - - if (IS_WORKER && xhr.status === 0) - this._chunkError(); - else - this._start += this._config.chunkSize; - } - - this._chunkLoaded = function() - { - if (xhr.readyState != 4) - return; - - if (xhr.status < 200 || xhr.status >= 400) - { - this._chunkError(); - return; - } - - this._finished = !this._config.chunkSize || this._start > getFileSize(xhr); - this.parseChunk(xhr.responseText); - } - - this._chunkError = function(errorMessage) - { - var errorText = xhr.statusText || errorMessage; - this._sendError(errorText); - } - - function getFileSize(xhr) - { - var contentRange = xhr.getResponseHeader('Content-Range'); - return parseInt(contentRange.substr(contentRange.lastIndexOf('/') + 1)); - } - } - NetworkStreamer.prototype = Object.create(ChunkStreamer.prototype); - NetworkStreamer.prototype.constructor = NetworkStreamer; - - - function FileStreamer(config) - { - config = config || {}; - if (!config.chunkSize) - config.chunkSize = Papa.LocalChunkSize; - ChunkStreamer.call(this, config); - - var reader, slice; - - // FileReader is better than FileReaderSync (even in worker) - see http://stackoverflow.com/q/24708649/1048862 - // But Firefox is a pill, too - see issue #76: https://github.com/mholt/PapaParse/issues/76 - var usingAsyncReader = typeof FileReader !== 'undefined'; // Safari doesn't consider it a function - see issue #105 - - this.stream = function(file) - { - this._input = file; - slice = file.slice || file.webkitSlice || file.mozSlice; - - if (usingAsyncReader) - { - reader = new FileReader(); // Preferred method of reading files, even in workers - reader.onload = bindFunction(this._chunkLoaded, this); - reader.onerror = bindFunction(this._chunkError, this); - } - else - reader = new FileReaderSync(); // Hack for running in a web worker in Firefox - - this._nextChunk(); // Starts streaming - }; - - this._nextChunk = function() - { - if (!this._finished && (!this._config.preview || this._rowCount < this._config.preview)) - this._readChunk(); - } - - this._readChunk = function() - { - var input = this._input; - if (this._config.chunkSize) - { - var end = Math.min(this._start + this._config.chunkSize, this._input.size); - input = slice.call(input, this._start, end); - } - var txt = reader.readAsText(input, this._config.encoding); - if (!usingAsyncReader) - this._chunkLoaded({ target: { result: txt } }); // mimic the async signature - } - - this._chunkLoaded = function(event) - { - // Very important to increment start each time before handling results - this._start += this._config.chunkSize; - this._finished = !this._config.chunkSize || this._start >= this._input.size; - this.parseChunk(event.target.result); - } - - this._chunkError = function() - { - this._sendError(reader.error); - } - - } - FileStreamer.prototype = Object.create(ChunkStreamer.prototype); - FileStreamer.prototype.constructor = FileStreamer; - - - function StringStreamer(config) - { - config = config || {}; - ChunkStreamer.call(this, config); - - var string; - var remaining; - this.stream = function(s) - { - string = s; - remaining = s; - return this._nextChunk(); - } - this._nextChunk = function() - { - if (this._finished) return; - var size = this._config.chunkSize; - var chunk = size ? remaining.substr(0, size) : remaining; - remaining = size ? remaining.substr(size) : ''; - this._finished = !remaining; - return this.parseChunk(chunk); - } - } - StringStreamer.prototype = Object.create(StringStreamer.prototype); - StringStreamer.prototype.constructor = StringStreamer; - - - - // Use one ParserHandle per entire CSV file or string - function ParserHandle(_config) - { - // One goal is to minimize the use of regular expressions... - var FLOAT = /^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i; - - var self = this; - var _stepCounter = 0; // Number of times step was called (number of rows parsed) - var _input; // The input being parsed - var _parser; // The core parser being used - var _paused = false; // Whether we are paused or not - var _aborted = false; // Whether the parser has aborted or not - var _delimiterError; // Temporary state between delimiter detection and processing results - var _fields = []; // Fields are from the header row of the input, if there is one - var _results = { // The last results returned from the parser - data: [], - errors: [], - meta: {} - }; - - if (isFunction(_config.step)) - { - var userStep = _config.step; - _config.step = function(results) - { - _results = results; - - if (needsHeaderRow()) - processResults(); - else // only call user's step function after header row - { - processResults(); - - // It's possbile that this line was empty and there's no row here after all - if (_results.data.length === 0) - return; - - _stepCounter += results.data.length; - if (_config.preview && _stepCounter > _config.preview) - _parser.abort(); - else - userStep(_results, self); - } - }; - } - - /** - * Parses input. Most users won't need, and shouldn't mess with, the baseIndex - * and ignoreLastRow parameters. They are used by streamers (wrapper functions) - * when an input comes in multiple chunks, like from a file. - */ - this.parse = function(input, baseIndex, ignoreLastRow) - { - if (!_config.newline) - _config.newline = guessLineEndings(input); - - _delimiterError = false; - if (!_config.delimiter) - { - var delimGuess = guessDelimiter(input, _config.newline); - if (delimGuess.successful) - _config.delimiter = delimGuess.bestDelimiter; - else - { - _delimiterError = true; // add error after parsing (otherwise it would be overwritten) - _config.delimiter = Papa.DefaultDelimiter; - } - _results.meta.delimiter = _config.delimiter; - } - - var parserConfig = copy(_config); - if (_config.preview && _config.header) - parserConfig.preview++; // to compensate for header row - - _input = input; - _parser = new Parser(parserConfig); - _results = _parser.parse(_input, baseIndex, ignoreLastRow); - processResults(); - return _paused ? { meta: { paused: true } } : (_results || { meta: { paused: false } }); - }; - - this.paused = function() - { - return _paused; - }; - - this.pause = function() - { - _paused = true; - _parser.abort(); - _input = _input.substr(_parser.getCharIndex()); - }; - - this.resume = function() - { - _paused = false; - self.streamer.parseChunk(_input); - }; - - this.aborted = function () - { - return _aborted; - }; - - this.abort = function() - { - _aborted = true; - _parser.abort(); - _results.meta.aborted = true; - if (isFunction(_config.complete)) - _config.complete(_results); - _input = ''; - }; - - function processResults() - { - if (_results && _delimiterError) - { - addError('Delimiter', 'UndetectableDelimiter', 'Unable to auto-detect delimiting character; defaulted to \''+Papa.DefaultDelimiter+'\''); - _delimiterError = false; - } - - if (_config.skipEmptyLines) - { - for (var i = 0; i < _results.data.length; i++) - if (_results.data[i].length === 1 && _results.data[i][0] === '') - _results.data.splice(i--, 1); - } - - if (needsHeaderRow()) - fillHeaderFields(); - - return applyHeaderAndDynamicTyping(); - } - - function needsHeaderRow() - { - return _config.header && _fields.length === 0; - } - - function fillHeaderFields() - { - if (!_results) - return; - for (var i = 0; needsHeaderRow() && i < _results.data.length; i++) - for (var j = 0; j < _results.data[i].length; j++) - _fields.push(_results.data[i][j]); - _results.data.splice(0, 1); - } - - function applyHeaderAndDynamicTyping() - { - if (!_results || (!_config.header && !_config.dynamicTyping)) - return _results; - - for (var i = 0; i < _results.data.length; i++) - { - var row = {}; - - for (var j = 0; j < _results.data[i].length; j++) - { - if (_config.dynamicTyping) - { - var value = _results.data[i][j]; - if (value === 'true' || value === 'TRUE') - _results.data[i][j] = true; - else if (value === 'false' || value === 'FALSE') - _results.data[i][j] = false; - else - _results.data[i][j] = tryParseFloat(value); - } - - if (_config.header) - { - if (j >= _fields.length) - { - if (!row['__parsed_extra']) - row['__parsed_extra'] = []; - row['__parsed_extra'].push(_results.data[i][j]); - } - else - row[_fields[j]] = _results.data[i][j]; - } - } - - if (_config.header) - { - _results.data[i] = row; - if (j > _fields.length) - addError('FieldMismatch', 'TooManyFields', 'Too many fields: expected ' + _fields.length + ' fields but parsed ' + j, i); - else if (j < _fields.length) - addError('FieldMismatch', 'TooFewFields', 'Too few fields: expected ' + _fields.length + ' fields but parsed ' + j, i); - } - } - - if (_config.header && _results.meta) - _results.meta.fields = _fields; - return _results; - } - - function guessDelimiter(input, newline) - { - var delimChoices = [',', '\t', '|', ';', Papa.RECORD_SEP, Papa.UNIT_SEP]; - var bestDelim, bestDelta, fieldCountPrevRow; - - for (var i = 0; i < delimChoices.length; i++) - { - var delim = delimChoices[i]; - var delta = 0, avgFieldCount = 0; - fieldCountPrevRow = undefined; - - var preview = new Parser({ - delimiter: delim, - newline: newline, - preview: 10 - }).parse(input); - - for (var j = 0; j < preview.data.length; j++) - { - var fieldCount = preview.data[j].length; - avgFieldCount += fieldCount; - - if (typeof fieldCountPrevRow === 'undefined') - { - fieldCountPrevRow = fieldCount; - continue; - } - else if (fieldCount > 1) - { - delta += Math.abs(fieldCount - fieldCountPrevRow); - fieldCountPrevRow = fieldCount; - } - } - - if (preview.data.length > 0) - avgFieldCount /= preview.data.length; - - if ((typeof bestDelta === 'undefined' || delta < bestDelta) - && avgFieldCount > 1.99) - { - bestDelta = delta; - bestDelim = delim; - } - } - - _config.delimiter = bestDelim; - - return { - successful: !!bestDelim, - bestDelimiter: bestDelim - } - } - - function guessLineEndings(input) - { - input = input.substr(0, 1024*1024); // max length 1 MB - - var r = input.split('\r'); - - var n = input.split('\n'); - - var nAppearsFirst = (n.length > 1 && n[0].length < r[0].length); - - if (r.length === 1 || nAppearsFirst) - return '\n'; - - var numWithN = 0; - for (var i = 0; i < r.length; i++) - { - if (r[i][0] === '\n') - numWithN++; - } - - return numWithN >= r.length / 2 ? '\r\n' : '\r'; - } - - function tryParseFloat(val) - { - var isNumber = FLOAT.test(val); - return isNumber ? parseFloat(val) : val; - } - - function addError(type, code, msg, row) - { - _results.errors.push({ - type: type, - code: code, - message: msg, - row: row - }); - } - } - - - - - - /** The core parser implements speedy and correct CSV parsing */ - function Parser(config) - { - // Unpack the config object - config = config || {}; - var delim = config.delimiter; - var newline = config.newline; - var comments = config.comments; - var step = config.step; - var preview = config.preview; - var fastMode = config.fastMode; - - // Delimiter must be valid - if (typeof delim !== 'string' - || Papa.BAD_DELIMITERS.indexOf(delim) > -1) - delim = ','; - - // Comment character must be valid - if (comments === delim) - throw 'Comment character same as delimiter'; - else if (comments === true) - comments = '#'; - else if (typeof comments !== 'string' - || Papa.BAD_DELIMITERS.indexOf(comments) > -1) - comments = false; - - // Newline must be valid: \r, \n, or \r\n - if (newline != '\n' && newline != '\r' && newline != '\r\n') - newline = '\n'; - - // We're gonna need these at the Parser scope - var cursor = 0; - var aborted = false; - - this.parse = function(input, baseIndex, ignoreLastRow) - { - // For some reason, in Chrome, this speeds things up (!?) - if (typeof input !== 'string') - throw 'Input must be a string'; - - // We don't need to compute some of these every time parse() is called, - // but having them in a more local scope seems to perform better - var inputLen = input.length, - delimLen = delim.length, - newlineLen = newline.length, - commentsLen = comments.length; - var stepIsFunction = typeof step === 'function'; - - // Establish starting state - cursor = 0; - var data = [], errors = [], row = [], lastCursor = 0; - - if (!input) - return returnable(); - - if (fastMode || (fastMode !== false && input.indexOf('"') === -1)) - { - var rows = input.split(newline); - for (var i = 0; i < rows.length; i++) - { - var row = rows[i]; - cursor += row.length; - if (i !== rows.length - 1) - cursor += newline.length; - else if (ignoreLastRow) - return returnable(); - if (comments && row.substr(0, commentsLen) === comments) - continue; - if (stepIsFunction) - { - data = []; - pushRow(row.split(delim)); - doStep(); - if (aborted) - return returnable(); - } - else - pushRow(row.split(delim)); - if (preview && i >= preview) - { - data = data.slice(0, preview); - return returnable(true); - } - } - return returnable(); - } - - var nextDelim = input.indexOf(delim, cursor); - var nextNewline = input.indexOf(newline, cursor); - - // Parser loop - for (;;) - { - // Field has opening quote - if (input[cursor] === '"') - { - // Start our search for the closing quote where the cursor is - var quoteSearch = cursor; - - // Skip the opening quote - cursor++; - - for (;;) - { - // Find closing quote - var quoteSearch = input.indexOf('"', quoteSearch+1); - - if (quoteSearch === -1) - { - if (!ignoreLastRow) { - // No closing quote... what a pity - errors.push({ - type: 'Quotes', - code: 'MissingQuotes', - message: 'Quoted field unterminated', - row: data.length, // row has yet to be inserted - index: cursor - }); - } - return finish(); - } - - if (quoteSearch === inputLen-1) - { - // Closing quote at EOF - var value = input.substring(cursor, quoteSearch).replace(/""/g, '"'); - return finish(value); - } - - // If this quote is escaped, it's part of the data; skip it - if (input[quoteSearch+1] === '"') - { - quoteSearch++; - continue; - } - - if (input[quoteSearch+1] === delim) - { - // Closing quote followed by delimiter - row.push(input.substring(cursor, quoteSearch).replace(/""/g, '"')); - cursor = quoteSearch + 1 + delimLen; - nextDelim = input.indexOf(delim, cursor); - nextNewline = input.indexOf(newline, cursor); - break; - } - - if (input.substr(quoteSearch+1, newlineLen) === newline) - { - // Closing quote followed by newline - row.push(input.substring(cursor, quoteSearch).replace(/""/g, '"')); - saveRow(quoteSearch + 1 + newlineLen); - nextDelim = input.indexOf(delim, cursor); // because we may have skipped the nextDelim in the quoted field - - if (stepIsFunction) - { - doStep(); - if (aborted) - return returnable(); - } - - if (preview && data.length >= preview) - return returnable(true); - - break; - } - } - - continue; - } - - // Comment found at start of new line - if (comments && row.length === 0 && input.substr(cursor, commentsLen) === comments) - { - if (nextNewline === -1) // Comment ends at EOF - return returnable(); - cursor = nextNewline + newlineLen; - nextNewline = input.indexOf(newline, cursor); - nextDelim = input.indexOf(delim, cursor); - continue; - } - - // Next delimiter comes before next newline, so we've reached end of field - if (nextDelim !== -1 && (nextDelim < nextNewline || nextNewline === -1)) - { - row.push(input.substring(cursor, nextDelim)); - cursor = nextDelim + delimLen; - nextDelim = input.indexOf(delim, cursor); - continue; - } - - // End of row - if (nextNewline !== -1) - { - row.push(input.substring(cursor, nextNewline)); - saveRow(nextNewline + newlineLen); - - if (stepIsFunction) - { - doStep(); - if (aborted) - return returnable(); - } - - if (preview && data.length >= preview) - return returnable(true); - - continue; - } - - break; - } - - - return finish(); - - - function pushRow(row) - { - data.push(row); - lastCursor = cursor; - } - - /** - * Appends the remaining input from cursor to the end into - * row, saves the row, calls step, and returns the results. - */ - function finish(value) - { - if (ignoreLastRow) - return returnable(); - if (typeof value === 'undefined') - value = input.substr(cursor); - row.push(value); - cursor = inputLen; // important in case parsing is paused - pushRow(row); - if (stepIsFunction) - doStep(); - return returnable(); - } - - /** - * Appends the current row to the results. It sets the cursor - * to newCursor and finds the nextNewline. The caller should - * take care to execute user's step function and check for - * preview and end parsing if necessary. - */ - function saveRow(newCursor) - { - cursor = newCursor; - pushRow(row); - row = []; - nextNewline = input.indexOf(newline, cursor); - } - - /** Returns an object with the results, errors, and meta. */ - function returnable(stopped) - { - return { - data: data, - errors: errors, - meta: { - delimiter: delim, - linebreak: newline, - aborted: aborted, - truncated: !!stopped, - cursor: lastCursor + (baseIndex || 0) - } - }; - } - - /** Executes the user's step function and resets data & errors. */ - function doStep() - { - step(returnable()); - data = [], errors = []; - } - }; - - /** Sets the abort flag */ - this.abort = function() - { - aborted = true; - }; - - /** Gets the cursor position */ - this.getCharIndex = function() - { - return cursor; - }; - } - - - // If you need to load Papa Parse asynchronously and you also need worker threads, hard-code - // the script path here. See: https://github.com/mholt/PapaParse/issues/87#issuecomment-57885358 - function getScriptPath() - { - var scripts = document.getElementsByTagName('script'); - return scripts.length ? scripts[scripts.length - 1].src : ''; - } - - function newWorker() - { - if (!Papa.WORKERS_SUPPORTED) - return false; - if (!LOADED_SYNC && Papa.SCRIPT_PATH === null) - throw new Error( - 'Script path cannot be determined automatically when Papa Parse is loaded asynchronously. ' + - 'You need to set Papa.SCRIPT_PATH manually.' - ); - var workerUrl = Papa.SCRIPT_PATH || AUTO_SCRIPT_PATH; - // Append 'papaworker' to the search string to tell papaparse that this is our worker. - workerUrl += (workerUrl.indexOf('?') !== -1 ? '&' : '?') + 'papaworker'; - var w = new global.Worker(workerUrl); - w.onmessage = mainThreadReceivedMessage; - w.id = workerIdCounter++; - workers[w.id] = w; - return w; - } - - /** Callback when main thread receives a message */ - function mainThreadReceivedMessage(e) - { - var msg = e.data; - var worker = workers[msg.workerId]; - var aborted = false; - - if (msg.error) - worker.userError(msg.error, msg.file); - else if (msg.results && msg.results.data) - { - var abort = function() { - aborted = true; - completeWorker(msg.workerId, { data: [], errors: [], meta: { aborted: true } }); - }; - - var handle = { - abort: abort, - pause: notImplemented, - resume: notImplemented - }; - - if (isFunction(worker.userStep)) - { - for (var i = 0; i < msg.results.data.length; i++) - { - worker.userStep({ - data: [msg.results.data[i]], - errors: msg.results.errors, - meta: msg.results.meta - }, handle); - if (aborted) - break; - } - delete msg.results; // free memory ASAP - } - else if (isFunction(worker.userChunk)) - { - worker.userChunk(msg.results, handle, msg.file); - delete msg.results; - } - } - - if (msg.finished && !aborted) - completeWorker(msg.workerId, msg.results); - } - - function completeWorker(workerId, results) { - var worker = workers[workerId]; - if (isFunction(worker.userComplete)) - worker.userComplete(results); - worker.terminate(); - delete workers[workerId]; - } - - function notImplemented() { - throw 'Not implemented.'; - } - - /** Callback when worker thread receives a message */ - function workerThreadReceivedMessage(e) - { - var msg = e.data; - - if (typeof Papa.WORKER_ID === 'undefined' && msg) - Papa.WORKER_ID = msg.workerId; - - if (typeof msg.input === 'string') - { - global.postMessage({ - workerId: Papa.WORKER_ID, - results: Papa.parse(msg.input, msg.config), - finished: true - }); - } - else if ((global.File && msg.input instanceof File) || msg.input instanceof Object) // thank you, Safari (see issue #106) - { - var results = Papa.parse(msg.input, msg.config); - if (results) - global.postMessage({ - workerId: Papa.WORKER_ID, - results: results, - finished: true - }); - } - } - - /** Makes a deep copy of an array or object (mostly) */ - function copy(obj) - { - if (typeof obj !== 'object') - return obj; - var cpy = obj instanceof Array ? [] : {}; - for (var key in obj) - cpy[key] = copy(obj[key]); - return cpy; - } - - function bindFunction(f, self) - { - return function() { f.apply(self, arguments); }; - } - - function isFunction(func) - { - return typeof func === 'function'; - } - - return Papa; -})); diff --git a/js/publicView.js b/js/publicView.js deleted file mode 100644 index 2fa68d3..0000000 --- a/js/publicView.js +++ /dev/null @@ -1,194 +0,0 @@ -function IsValidPublicDicitonary() { - return typeof publicDictionary !== 'string'; -} - -function ShowPublicDictionary(ignoreFilters) { - ignoreFilters = (typeof ignoreFilters !== 'undefined') ? ignoreFilters : false; - - if (IsValidPublicDicitonary()) { - var filters = (ignoreFilters) ? [] : GetSelectedFilters(); - - var searchResults = []; - var search = (ignoreFilters) ? "" : htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var searchByWord = (ignoreFilters) ? null : document.getElementById("searchOptionWord").checked; - var searchBySimple = (ignoreFilters) ? null : document.getElementById("searchOptionSimple").checked; - var searchByLong = (ignoreFilters) ? null : document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = (ignoreFilters) ? null : !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = (ignoreFilters) ? null : document.getElementById("searchIgnoreDiacritics").checked; - if (!ignoreFilters && search != "" && (searchByWord || searchBySimple || searchByLong)) { - var xpath = []; - var searchDictionaryJSON = htmlEntitiesParseForSearch(JSON.stringify(publicDictionary)); - if (searchIgnoreCase) { - search = search.toLowerCase(); - //searchDictionaryJSON = searchDictionaryJSON.toLowerCase(); - } - if (searchIgnoreDiacritics) { - search = removeDiacritics(search); - searchDictionaryJSON = removeDiacritics(searchDictionaryJSON); - } - if (searchByWord) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'name' : 'translate(name, "", "")') +', "'+ search +'")'); - } - if (searchBySimple) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'simpleDefinition' : 'translate(simpleDefinition, "", "")') +', "'+ search +'")'); - } - if (searchByLong) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'longDefinition' : 'translate(longDefinition, "", "")') +', "'+ search +'")'); - } - var searchDictionary = JSON.parse(searchDictionaryJSON); - searchResults = JSON.search(searchDictionary, '//words['+ xpath.join(' or ') +']/wordId'); - } - - var dictionaryNameArea = document.getElementById("dictionaryName"); - dictionaryNameArea.innerHTML = publicDictionary.name + " Dictionary"; - - var dictionaryByArea = document.getElementById("dictionaryBy"); - dictionaryByArea.innerHTML = "created by " + publicDictionary.createdBy; - - var dictionaryIncompleteArea = document.getElementById("incompleteNotice"); - if (!publicDictionary.settings.isComplete) { - dictionaryIncompleteArea.innerHTML = "Note: This dictionary is not yet complete and is likely to change."; - } - - var dictionaryDescriptionArea = document.getElementById("dictionaryDescription"); - dictionaryDescriptionArea.innerHTML = marked(htmlEntitiesParseForMarkdown(publicDictionary.description)); - - var dictionaryArea = document.getElementById("theDictionary"); - var dictionaryText = ""; - var numberOfWordsDisplayed = 0; - - if (publicDictionary.words.length > 0) { - for (var i = 0; i < publicDictionary.words.length; i++) { - if (filters.length == 0 || (filters.length > 0 && filters.indexOf(publicDictionary.words[i].partOfSpeech) > -1)) { - if (search == "" || (search != "" && (searchByWord || searchBySimple || searchByLong) && searchResults.indexOf(publicDictionary.words[i].wordId) >= 0)) { - if (!publicDictionary.words[i].hasOwnProperty("pronunciation")) { - publicDictionary.words[i].pronunciation = ""; //Account for new property - } - if (!publicDictionary.words[i].hasOwnProperty("wordId")) { - publicDictionary.words[i].wordId = i + 1; //Account for new property - } - dictionaryText += PublicDictionaryEntry(i, ignoreFilters); - numberOfWordsDisplayed++; - } - } - } - } else { - dictionaryText = "There are no entries in the dictionary." - } - dictionaryArea.innerHTML = dictionaryText; - if (!ignoreFilters) { - ShowFilterWordCount(numberOfWordsDisplayed); - } - } else { - document.getElementById("dictionaryContent").innerHTML = publicDictionary; - } -} - -function PublicDictionaryEntry(itemIndex, ignoreFilters) { - var searchTerm = (ignoreFilters) ? "" : regexParseForSearch(document.getElementById("searchBox").value); - var searchByWord = (ignoreFilters) ? false : document.getElementById("searchOptionWord").checked; - var searchBySimple = (ignoreFilters) ? false : document.getElementById("searchOptionSimple").checked; - var searchByLong = (ignoreFilters) ? false : document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = (ignoreFilters) ? false : !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = (ignoreFilters) ? false : document.getElementById("searchIgnoreDiacritics").checked; - - var searchRegEx = new RegExp("(" + ((searchIgnoreDiacritics) ? removeDiacritics(searchTerm) + "|" + searchTerm : searchTerm) + ")", "g" + ((searchIgnoreCase) ? "i" : "")); - - var wordName = wordPronunciation = wordPartOfSpeech = wordSimpleDefinition = wordLongDefinition = ""; - - if (searchTerm != "" && searchByWord) { - wordName += htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].name).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordName += publicDictionary.words[itemIndex].name.toString(); // Use toString() to prevent using a reference instead of the value. - } - - if (publicDictionary.words[itemIndex].pronunciation != "") { - wordPronunciation += marked(htmlEntitiesParseForMarkdown(publicDictionary.words[itemIndex].pronunciation)).replace(/<\/?p>/g,""); - } - - if (publicDictionary.words[itemIndex].partOfSpeech != " " && publicDictionary.words[itemIndex].partOfSpeech != "") { - wordPartOfSpeech += publicDictionary.words[itemIndex].partOfSpeech.toString(); - } - - if (publicDictionary.words[itemIndex].simpleDefinition != "") { - if (searchTerm != "" && searchBySimple) { - wordSimpleDefinition += htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].simpleDefinition).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordSimpleDefinition += publicDictionary.words[itemIndex].simpleDefinition.toString(); - } - } - - if (publicDictionary.words[itemIndex].longDefinition != "") { - if (searchTerm != "" && searchByLong) { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].longDefinition).replace(searchRegEx, "$1")))).replace(/<(\/?)searchterm>\;/g, '<$1searchterm>'); - } else { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(publicDictionary.words[itemIndex].longDefinition)); - } - } - - return PublicDictionaryEntryTemplate({ - name : wordName, - pronunciation : wordPronunciation, - partOfSpeech : wordPartOfSpeech, - simpleDefinition : wordSimpleDefinition, - longDefinition : wordLongDefinition, - wordId : publicDictionary.words[itemIndex].wordId.toString() - }, false); -} - -function PublicDictionaryEntryTemplate(wordObject, managementIndex) { - managementIndex = (typeof managementIndex !== 'undefined') ? managementIndex : false; - var entryText = "➦"; - - entryText += "" + wordObject.name + ""; - - if (wordObject.pronunciation != "") { - entryText += "" + wordObject.pronunciation + ""; - } - - if (wordObject.partOfSpeech != "") { - entryText += "" + wordObject.partOfSpeech + ""; - } - - entryText += "
    "; - - if (wordObject.simpleDefinition != "") { - entryText += "" + wordObject.simpleDefinition + ""; - } - - if (wordObject.longDefinition != "") { - entryText += "" + wordObject.longDefinition + ""; - } - - if (managementIndex !== false) { - entryText += ManagementArea(managementIndex); - } - - entryText += "
    "; - - return entryText; -} - -function SetPublicPartsOfSpeech () { - var wordFilterOptions = document.getElementById("filterOptions"); - - var newPartsOfSpeech = htmlEntitiesParse(publicDictionary.settings.partsOfSpeech).trim().split(","); - for (var j = 0; j < newPartsOfSpeech.length; j++) { - var thePartOfSpeech = newPartsOfSpeech[j].trim(); - - var wordFilterLabel = document.createElement('label'); - wordFilterLabel.appendChild(document.createTextNode(thePartOfSpeech + " ")); - wordFilterLabel['part-of-speech'] = thePartOfSpeech; - wordFilterLabel.className = 'filterOption'; - var wordFilterCheckbox = document.createElement('input'); - wordFilterCheckbox.type = 'checkbox'; - wordFilterCheckbox.onchange = function(){ShowPublicDictionary()}; - wordFilterLabel.appendChild(wordFilterCheckbox); - wordFilterOptions.appendChild(wordFilterLabel); - } -} \ No newline at end of file diff --git a/js/removeDiacritics.js b/js/removeDiacritics.js deleted file mode 100644 index 26f792e..0000000 --- a/js/removeDiacritics.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - Retrieved from http://stackoverflow.com/a/18391901/3508346 - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -var defaultDiacriticsRemovalap = [ - {'base':'A', 'letters':'\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'}, - {'base':'AA','letters':'\uA732'}, - {'base':'AE','letters':'\u00C6\u01FC\u01E2'}, - {'base':'AO','letters':'\uA734'}, - {'base':'AU','letters':'\uA736'}, - {'base':'AV','letters':'\uA738\uA73A'}, - {'base':'AY','letters':'\uA73C'}, - {'base':'B', 'letters':'\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181'}, - {'base':'C', 'letters':'\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E'}, - {'base':'D', 'letters':'\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779'}, - {'base':'DZ','letters':'\u01F1\u01C4'}, - {'base':'Dz','letters':'\u01F2\u01C5'}, - {'base':'E', 'letters':'\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E'}, - {'base':'F', 'letters':'\u0046\u24BB\uFF26\u1E1E\u0191\uA77B'}, - {'base':'G', 'letters':'\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E'}, - {'base':'H', 'letters':'\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D'}, - {'base':'I', 'letters':'\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197'}, - {'base':'J', 'letters':'\u004A\u24BF\uFF2A\u0134\u0248'}, - {'base':'K', 'letters':'\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2'}, - {'base':'L', 'letters':'\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780'}, - {'base':'LJ','letters':'\u01C7'}, - {'base':'Lj','letters':'\u01C8'}, - {'base':'M', 'letters':'\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C'}, - {'base':'N', 'letters':'\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4'}, - {'base':'NJ','letters':'\u01CA'}, - {'base':'Nj','letters':'\u01CB'}, - {'base':'O', 'letters':'\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C'}, - {'base':'OI','letters':'\u01A2'}, - {'base':'OO','letters':'\uA74E'}, - {'base':'OU','letters':'\u0222'}, - {'base':'OE','letters':'\u008C\u0152'}, - {'base':'oe','letters':'\u009C\u0153'}, - {'base':'P', 'letters':'\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754'}, - {'base':'Q', 'letters':'\u0051\u24C6\uFF31\uA756\uA758\u024A'}, - {'base':'R', 'letters':'\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782'}, - {'base':'S', 'letters':'\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784'}, - {'base':'T', 'letters':'\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786'}, - {'base':'TZ','letters':'\uA728'}, - {'base':'U', 'letters':'\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244'}, - {'base':'V', 'letters':'\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245'}, - {'base':'VY','letters':'\uA760'}, - {'base':'W', 'letters':'\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72'}, - {'base':'X', 'letters':'\u0058\u24CD\uFF38\u1E8A\u1E8C'}, - {'base':'Y', 'letters':'\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE'}, - {'base':'Z', 'letters':'\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762'}, - {'base':'a', 'letters':'\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250'}, - {'base':'aa','letters':'\uA733'}, - {'base':'ae','letters':'\u00E6\u01FD\u01E3'}, - {'base':'ao','letters':'\uA735'}, - {'base':'au','letters':'\uA737'}, - {'base':'av','letters':'\uA739\uA73B'}, - {'base':'ay','letters':'\uA73D'}, - {'base':'b', 'letters':'\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253'}, - {'base':'c', 'letters':'\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184'}, - {'base':'d', 'letters':'\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A'}, - {'base':'dz','letters':'\u01F3\u01C6'}, - {'base':'e', 'letters':'\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD'}, - {'base':'f', 'letters':'\u0066\u24D5\uFF46\u1E1F\u0192\uA77C'}, - {'base':'g', 'letters':'\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F'}, - {'base':'h', 'letters':'\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265'}, - {'base':'hv','letters':'\u0195'}, - {'base':'i', 'letters':'\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131'}, - {'base':'j', 'letters':'\u006A\u24D9\uFF4A\u0135\u01F0\u0249'}, - {'base':'k', 'letters':'\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3'}, - {'base':'l', 'letters':'\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747'}, - {'base':'lj','letters':'\u01C9'}, - {'base':'m', 'letters':'\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F'}, - {'base':'n', 'letters':'\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5'}, - {'base':'nj','letters':'\u01CC'}, - {'base':'o', 'letters':'\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275'}, - {'base':'oi','letters':'\u01A3'}, - {'base':'ou','letters':'\u0223'}, - {'base':'oo','letters':'\uA74F'}, - {'base':'p','letters':'\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755'}, - {'base':'q','letters':'\u0071\u24E0\uFF51\u024B\uA757\uA759'}, - {'base':'r','letters':'\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783'}, - {'base':'s','letters':'\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B'}, - {'base':'t','letters':'\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787'}, - {'base':'tz','letters':'\uA729'}, - {'base':'u','letters': '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289'}, - {'base':'v','letters':'\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C'}, - {'base':'vy','letters':'\uA761'}, - {'base':'w','letters':'\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73'}, - {'base':'x','letters':'\u0078\u24E7\uFF58\u1E8B\u1E8D'}, - {'base':'y','letters':'\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF'}, - {'base':'z','letters':'\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763'} -]; - -var diacriticsMap = {}; -for (var i=0; i < defaultDiacriticsRemovalap.length; i++){ - var letters = defaultDiacriticsRemovalap[i].letters; - for (var j=0; j < letters.length ; j++){ - diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base; - } -} - -// "what?" version ... http://jsperf.com/diacritics/12 -function removeDiacritics(str) { - return str.replace(/[^\u0000-\u007E]/g, function(a){ - return diacriticsMap[a] || a; - }); -} \ No newline at end of file diff --git a/js/ui.js b/js/ui.js deleted file mode 100644 index a16ace0..0000000 --- a/js/ui.js +++ /dev/null @@ -1,714 +0,0 @@ -function Initialize() { - LoadDictionary(); - ClearForm(); - LoadUserDictionaries(); - - GetTextFile("/README.md", "aboutText", true); - GetTextFile("/TERMS.md", "termsText", true); - GetTextFile("/PRIVACY.md", "privacyText", true); - GetTextFile("/LOGIN.form", "loginForm", false); - GetTextFile("/FORGOT.form", "forgotForm", false); - GetTextFile("/EXPORT.form", "exportForm", false); - GetTextFile("/IMPORT.form", "importForm", false); - - SetKeyboardShortcuts(); - SetWindowListeners(); -} - -function SetKeyboardShortcuts() { - document.addEventListener("keydown", function(e) { - var keyCode = (e.which ? e.which : e.keyCode); - - if (keyCode == keyCodeFor("escape")) { - if (document.getElementById("infoScreen").style.display == "block") { - HideInfo(); - } - else if (document.getElementById("fullScreenTextboxScreen").style.display == "block") { - HideFullScreenTextbox(); - } - else if (document.getElementById("settingsScreen").style.display == "block") { - HideSettings(); - } - else if (document.getElementById("accountSettingsScreen") && document.getElementById("accountSettingsScreen").style.display == "block") { - HideAccountSettings(); - } - } - else if (e.ctrlKey) { - // Only allow shortcuts if not currently using fullscreen textbox - if (document.getElementById("fullScreenTextboxScreen").style.display == "none") { - if (keyCode == keyCodeFor("m")) { - if (document.activeElement.id.indexOf("longDefinition") >= 0) { - e.preventDefault(); - ShowFullScreenTextbox(document.activeElement.id, 'Explanation/Long Definition'); - } - else if (document.activeElement.id == "dictionaryDescriptionEdit") { - e.preventDefault(); - ShowFullScreenTextbox('dictionaryDescriptionEdit', 'Dictionary Details'); - } - else if (document.activeElement.id == "fullScreenTextbox") { - e.preventDefault(); - HideFullScreenTextbox(); - } - } - else if (keyCode == keyCodeFor("u")) { - e.preventDefault(); - ToggleWordFormLock(); - } - else if (keyCode == keyCodeFor("d")) { - e.preventDefault(); - ToggleDescription(); - } - else if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - //ToggleSearchFilter(); - var searchFilterToggle = document.getElementById("searchFilterToggle"); - var searchFilterArea = document.getElementById("searchFilterArea"); - - if (searchFilterArea.style.display == "none") { - searchFilterArea.style.display = "block"; - searchFilterToggle.innerHTML = "Hide Search/Filter Options"; - } - document.getElementById("searchBox").focus(); - } - else if (keyCode == keyCodeFor("h")) { - e.preventDefault(); - ShowInfo('aboutText'); - } - } - else { //If the fullscreen editor *is* open, just prevent the others for consistent behavior. - if (keyCode == keyCodeFor("m")) { - e.preventDefault(); - HideFullScreenTextbox(); - } - else if (keyCode == keyCodeFor("u")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("d")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("h")) { - e.preventDefault(); - } - } - } - else if (e.altKey) { - // Only toggle screens if not currently using fullscreen textbox - if (document.getElementById("fullScreenTextboxScreen").style.display == "none") { - if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - ToggleSettingsScreen(true); - } - else if (keyCode == keyCodeFor("a")) { - e.preventDefault(); - ToggleAccountSettings(); - } - } - } - }, false); -} - -function SetWindowListeners() { - window.addEventListener("scroll", function() { - var doc = document.documentElement; - var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - var dictionaryColumn = document.getElementById("dictionaryColumn"); - var wordPullout = document.getElementById("mobileWordFormPullout"); - - if (top > dictionaryColumn.offsetTop) { - wordPullout.style.display = "block"; - } else { - wordPullout.style.display = "none"; - if (wordPullout.innerHTML != "+") { - LockWordForm(); - wordPullout.innerHTML = "+"; - } - } - }); -} - -function SubmitWordOnCtrlEnter(keypress) { - var keyCode = (event.which ? event.which : event.keyCode); - - if (keyCode === keyCodeFor("ctrlEnter") || (keyCode == keyCodeFor("enter") && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10. - event.preventDefault(); - - if (/\d/.test(document.activeElement.id)) { // If there IS a number in the ID, then it is a word being edited. - EditWord(document.activeElement.id.match(/\d+/)[0]); // .match(/\d+/) returns an array of digits in a string. - } else { // Otherwise, it's a new word. - AddWord(); - } - } -} - -function LoadUserDictionaries() { - var getDictionariesRequest = new XMLHttpRequest(); - var userDictionariesSelect = document.getElementById("userDictionaries"); - if (userDictionariesSelect != null) { - getDictionariesRequest.open('GET', "/php/ajax_dictionarymanagement.php?action=getall"); - getDictionariesRequest.onreadystatechange = function() { - if (getDictionariesRequest.readyState == 4 && getDictionariesRequest.status == 200) { - ParseUserDictionariesIntoSelect(userDictionariesSelect, getDictionariesRequest.responseText); - } - } - getDictionariesRequest.send(); - } -} - -function ParseUserDictionariesIntoSelect(selectToPopulate, dicitonaryList) { - if (selectToPopulate.options.length > 0) { - for (var i = selectToPopulate.options.length - 1; i >= 0; i--) { - selectToPopulate.removeChild(selectToPopulate.options[i]); - } - } - - var dictionaries = dicitonaryList.split("_DICTIONARYSEPARATOR_"); - for (var j = 0; j < dictionaries.length - 1; j++) { - var dictionaryOption = document.createElement('option'); - var dictionaryValues = dictionaries[j].split("_IDNAMESEPARATOR_"); - dictionaryOption.appendChild(document.createTextNode(htmlEntitiesParse(dictionaryValues[1]))); - dictionaryOption.value = dictionaryValues[0]; - selectToPopulate.appendChild(dictionaryOption); - } - selectToPopulate.value = (currentDictionary.externalID > 0) ? currentDictionary.externalID : ""; -} - -function GetTextFile(filename, variableName, parseMarkdown) { - parseMarkdown = (typeof parseMarkdown !== 'undefined') ? parseMarkdown : false; - var readmeFileRequest = new XMLHttpRequest(); - readmeFileRequest.open('GET', filename); - readmeFileRequest.onreadystatechange = function() { - if (readmeFileRequest.readyState == 4 && readmeFileRequest.status == 200) { - window[variableName] = (parseMarkdown) ? marked(readmeFileRequest.responseText, {sanitize: false}) : readmeFileRequest.responseText; - } - } - readmeFileRequest.send(); -} - -function ValidateLogin() { - var errorMessage = document.getElementById("loginError"); - var emailValue = document.getElementById("loginEmailField").value; - var passwordValue = document.getElementById("loginPasswordField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else { - document.getElementById("loginForm").submit(); - } -} - -function ValidateCreateAccount() { - var errorMessage = document.getElementById("createAccountError"); - var emailValue = document.getElementById("createAccountEmailField").value; - var passwordValue = document.getElementById("createAccountPasswordField").value; - var passwordConfirmValue = document.getElementById("createAccountPasswordConfirmField").value; - var publicNameValue = document.getElementById("createAccountPublicNameField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else if (passwordValue != passwordConfirmValue) { - errorMessage.innerHTML = "Passwords do not match!"; - return false; - } else if (publicNameValue == "") { - errorMessage.innerHTML = "Public Name cannot be blank!"; - return false; - } else { - var emailCheck = new XMLHttpRequest(); - emailCheck.open('GET', "/php/ajax_createaccountemailcheck.php?email=" + emailValue); - emailCheck.onreadystatechange = function() { - if (emailCheck.readyState == 4 && emailCheck.status == 200) { - if (emailCheck.responseText != "ok") { - errorMessage.innerHTML = "The email address entered is already being used. Try logging in or using a different email address instead."; - return false; - } else { - document.getElementById("createAccountForm").submit(); - } - } - } - emailCheck.send(); - } -} - -function ValidateAccountSettings() { - var errorMessage = document.getElementById("accountSettingsError"); - var emailValue = document.getElementById("accountSettingsEmailField").value; - var publicNameValue = document.getElementById("accountSettingsPublicNameField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (publicNameValue == "") { - errorMessage.innerHTML = "Public Name cannot be blank!"; - return false; - } else { - document.getElementById("createAccountForm").submit(); - } -} - -function ValidateForgotPassword() { - var errorMessage = document.getElementById("forgotError"); - var emailValue = document.getElementById("forgotEmailField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else { - var emailCheck = new XMLHttpRequest(); - emailCheck.open('GET', "/php/ajax_passwordresetemailcheck.php?email=" + emailValue); - emailCheck.onreadystatechange = function() { - if (emailCheck.readyState == 4 && emailCheck.status == 200) { - if (emailCheck.responseText != "email exists") { - errorMessage.innerHTML = "The email address entered is not in use and therefore can't have its password reset. Try creating an account instead!"; - return false; - } else { - document.getElementById("forgotForm").submit(); - } - } - } - emailCheck.send(); - } -} - -function ValidateResetPassword() { - var errorMessage = document.getElementById("resetPasswordError"); - var passwordValue = document.getElementById("newPasswordField").value; - var passwordConfirmValue = document.getElementById("newPasswordConfirmField").value; - - if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else if (passwordValue != passwordConfirmValue) { - errorMessage.innerHTML = "Passwords do not match!"; - return false; - } else { - document.getElementById("resetPasswordForm").submit(); - } -} - -function WarnEmailChange() { - var emailChangeWarning = document.getElementById("accountSettingsEmailChangeWarning"); - var emailValue = document.getElementById("accountSettingsEmailField").value; - var originalEmailValue = document.getElementById("accountSettingsPreviousEmailField").value; - - if (emailValue != originalEmailValue) { - emailChangeWarning.style.display = "block"; - } else { - emailChangeWarning.style.display = "none"; - } -} - -function LoggedInResetPassword() { - var resetPasswordRequest = new XMLHttpRequest(); - resetPasswordRequest.open('GET', "/php/ajax_setnewpassword.php"); - resetPasswordRequest.onreadystatechange = function() { - if (resetPasswordRequest.readyState == 4 && resetPasswordRequest.status == 200) { - if (resetPasswordRequest.responseText != "done") { - console.log(resetPasswordRequest.responseText); - alert("Error resetting password.\n\nTry again later."); - return false; - } else { - window.location = "./"; - } - } - } - resetPasswordRequest.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 == "\uD83D\uDD12"; -} - -function MobileToggleWordForm() { - var pullout = document.getElementById("mobileWordFormPullout"); - ToggleWordFormLock("7%"); - if (pullout.innerHTML == "+") { - pullout.innerHTML = "✕"; - } else { - pullout.innerHTML = "+"; - } -} - -function ToggleWordFormLock(topValue) { - if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to. - UnlockWordForm(topValue); - } else { - LockWordForm(); - } -} - -function UnlockWordForm(topValue) { - var lockButton = document.getElementById("formLockButton"); - var leftColumn = document.getElementById("leftColumn"); - var wordForm = document.getElementById("wordEntryForm"); - var wordFormWidth = wordForm.offsetWidth; - var leftColumnWidth = leftColumn.offsetWidth; - var leftColumnHeight = leftColumn.offsetHeight; - - lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon. - - wordForm.style.position = "fixed"; - wordForm.style.top = (typeof topValue !== 'undefined') ? topValue : document.getElementById("dictionaryColumn").offsetTop.toString() + "px"; - wordForm.style.width = wordFormWidth.toString() + "px"; - - leftColumn.style.width = leftColumnWidth.toString() + "px"; - leftColumn.style.height = leftColumnHeight.toString() + "px"; -} - -function LockWordForm() { - var lockButton = document.getElementById("formLockButton"); - var leftColumn = document.getElementById("leftColumn"); - var wordForm = document.getElementById("wordEntryForm"); - - lockButton.innerHTML = "🔒"; // Change to the "locked" icon. - leftColumn.removeAttribute('style'); - wordForm.removeAttribute('style'); -} - -function CloseUpdateConflictArea(wordIndexString) {// displayId, hideId) { - // displayId = (typeof displayId !== 'undefined' && displayId != null) ? displayId : false; - // if (displayId != false) { - if (wordIndexString == "") { - document.getElementById("newWordButtonArea").style.display = "block"; - } else { - document.getElementById("editWordButtonArea" + wordIndexString).style.display = "block"; - } - // } - document.getElementById("updateConflict" + wordIndexString).style.display = "none"; - EnableForm(wordIndexString); -} - -function DisableForm(wordIndexString) { - document.getElementById("word" + wordIndexString).disabled = true; - document.getElementById("pronunciation" + wordIndexString).disabled = true; - document.getElementById("partOfSpeech" + wordIndexString).disabled = true; - document.getElementById("simpleDefinition" + wordIndexString).disabled = true; - document.getElementById("longDefinition" + wordIndexString).disabled = true; -} - -function EnableForm(wordIndexString) { - document.getElementById("word" + wordIndexString).disabled = false; - document.getElementById("pronunciation" + wordIndexString).disabled = false; - document.getElementById("partOfSpeech" + wordIndexString).disabled = false; - document.getElementById("simpleDefinition" + wordIndexString).disabled = false; - document.getElementById("longDefinition" + wordIndexString).disabled = false; - // document.getElementById("editIndex").disabled = false; -} - -function ClearForm() { - if (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 descriptionToggle = document.getElementById("descriptionToggle"); - var descriptionArea = document.getElementById("dictionaryDescription"); - - if (descriptionArea.style.display == "none") { - descriptionArea.style.display = "block"; - descriptionToggle.innerHTML = "Hide Description"; - } else { - descriptionArea.style.display = "none"; - descriptionToggle.innerHTML = "Show Description"; - } -} - -function ToggleSearchFilter() { - var searchFilterToggle = document.getElementById("searchFilterToggle"); - var searchFilterArea = document.getElementById("searchFilterArea"); - - if (searchFilterArea.style.display == "none") { - searchFilterArea.style.display = "block"; - searchFilterToggle.innerHTML = "Hide Search/Filter Options"; - } else { - searchFilterArea.style.display = "none"; - searchFilterToggle.innerHTML = "Search/Filter Options"; - } -} - -function ShowInfo(variableName) { - ShowInfoWithText(window[variableName]); - if (variableName == "loginForm") { - // document.getElementById("infoText").innerHTML = loginForm; - if (currentDictionary.words.length > 0 || currentDictionary.name != "New" || currentDictionary.description != "A new dictionary.") { - 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!"; - } - } -} - -function ShowInfoWithText(text) { - document.getElementById("infoText").innerHTML = text; - document.getElementById("infoScreen").style.display = "block"; - document.getElementById("infoPage").scrollTop = 0; - HideAccountSettings(); -} - -function HideInfo() { - document.getElementById("infoScreen").style.display = "none"; -} - -function ToggleAccountSettings() { - if (document.getElementById("accountSettingsScreen")) { - var accountScreen = document.getElementById("accountSettingsScreen"); - - if (accountScreen.style.display == "block") { - HideAccountSettings(); - } else { - ShowAccountSettings(); - } - } -} - -function ShowAccountSettings(variableName) { - if (document.getElementById("accountSettingsScreen")) - document.getElementById("accountSettingsScreen").style.display = "block"; - - HideInfo(); -} - -function HideAccountSettings() { - if (document.getElementById("accountSettingsScreen")) - document.getElementById("accountSettingsScreen").style.display = "none"; -} - -function ToggleSettingsScreen(doSave) { - var settingsScreen = document.getElementById("settingsScreen"); - - if (settingsScreen.style.display == "block") { - if (doSave) { - SaveSettings(); - } - HideSettings(); - } else { - 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; - if (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"; - if (currentDictionary.settings.isComplete) { - LockWordForm(); - document.getElementById("wordEntryForm").style.display = "none"; - } else { - document.getElementById("wordEntryForm").style.display = "block"; - } - -} - -function HideSettingsWhenComplete() { - if (document.getElementById("settingsScreen")) { - if (currentDictionary.settings.isComplete) { - document.getElementById("hideIfComplete").style.display = "none"; - } else { - document.getElementById("hideIfComplete").style.display = "block"; - } - } -} - -function ShowFullScreenTextbox(textboxToExpandId, labelText) { - var sourceTextboxElement = document.getElementById(textboxToExpandId); - var targetTextboxElement = document.getElementById("fullScreenTextbox"); - document.getElementById("fullScreenTextboxLabel").innerHTML = labelText; - var selection = getInputSelection(sourceTextboxElement); - - document.getElementById("expandedTextboxId").innerHTML = textboxToExpandId; - targetTextboxElement.value = sourceTextboxElement.value; - document.getElementById("fullScreenTextboxScreen").style.display = "block"; - - setSelectionRange(targetTextboxElement, selection.start, selection.end); -} - -function HideFullScreenTextbox() { - var expandedTextboxId = document.getElementById("expandedTextboxId").innerHTML; - var sourceTextboxElement = document.getElementById("fullScreenTextbox"); - var targetTextboxElement = document.getElementById(expandedTextboxId); - var selection = getInputSelection(sourceTextboxElement); - - targetTextboxElement.value = sourceTextboxElement.value; - document.getElementById("fullScreenTextboxScreen").style.display = "none"; - - setSelectionRange(targetTextboxElement, selection.start, selection.end); -} - -function ShowDictionaryDeleteMenu(dictionaryList) { - document.getElementById('loadAfterDeleteScreen').style.display = 'block'; - //Parse response into the list that forces you to load one and reload select in settings. - ParseUserDictionariesIntoSelect(document.getElementById("loadAfterDelete"), dictionaryList); - ParseUserDictionariesIntoSelect(document.getElementById("userDictionaries"), dictionaryList); -} - -function ToggleCaseSensitiveOption() { - if (document.getElementById("dictionaryAllowDuplicates").checked) { - document.getElementById("dictionaryCaseSensitive").disabled = true; - } else { - document.getElementById("dictionaryCaseSensitive").disabled = false; - } -} - -function TogglePublicLink() { - if (document.getElementById("dictionaryIsPublic").checked) { - var publicLink = "http://lexicon.ga/" + currentDictionary.externalID; - document.getElementById("publicLink").innerHTML = "Public Link:
    " + publicLink; - } else { - document.getElementById("publicLink").innerHTML = ""; - } -} - -function SetPartsOfSpeech (selectId) { - selectId = (typeof selectId !== 'undefined') ? selectId : "partOfSpeech"; - var partsOfSpeechSelect = document.getElementById(selectId); - - var wordFilterOptions = document.getElementById("filterOptions"); - var wordFiltersSelected = GetSelectedFilters(); - - // Clear parts of speech. - partsOfSpeechSelect.innerHTML = ""; - wordFilterOptions.innerHTML = ""; - - // Insert blank part of speech as first dropdown option. - var blankpartOfSpeechOption = document.createElement('option'); - blankpartOfSpeechOption.appendChild(document.createTextNode("")); - blankpartOfSpeechOption.value = " "; - partsOfSpeechSelect.appendChild(blankpartOfSpeechOption); - - // Rebuild parts of speech - var newPartsOfSpeech = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(","); - for (var j = 0; j < newPartsOfSpeech.length; j++) { - var thePartOfSpeech = newPartsOfSpeech[j].trim(); - - var partOfSpeechOption = document.createElement('option'); - partOfSpeechOption.appendChild(document.createTextNode(thePartOfSpeech)); - partOfSpeechOption.value = thePartOfSpeech; - partsOfSpeechSelect.appendChild(partOfSpeechOption); - - var wordFilterLabel = document.createElement('label'); - wordFilterLabel.appendChild(document.createTextNode(thePartOfSpeech + " ")); - wordFilterLabel['part-of-speech'] = thePartOfSpeech; - wordFilterLabel.className = 'filterOption'; - var wordFilterCheckbox = document.createElement('input'); - wordFilterCheckbox.type = 'checkbox'; - wordFilterCheckbox.onchange = function(){ShowDictionary()}; - if (wordFiltersSelected.indexOf(thePartOfSpeech) > -1) wordFilterCheckbox.checked = true; - wordFilterLabel.appendChild(wordFilterCheckbox); - wordFilterOptions.appendChild(wordFilterLabel); - } - - // Insert blank part of speech as last filter option - var blankwordFilterLabel = document.createElement('label'); - blankwordFilterLabel.appendChild(document.createTextNode("Blanks ")); - blankwordFilterLabel['part-of-speech'] = " "; - blankwordFilterLabel.className = 'filterOption'; - var blankwordFilterCheckbox = document.createElement('input'); - blankwordFilterCheckbox.type = 'checkbox'; - blankwordFilterCheckbox.onchange = function(){ShowDictionary()}; - if (wordFiltersSelected.indexOf(" ") > -1) blankwordFilterCheckbox.checked = true; - blankwordFilterLabel.appendChild(blankwordFilterCheckbox); - wordFilterOptions.appendChild(blankwordFilterLabel); -} - -function GetSelectedFilters() { - var wordFilterOptions = document.getElementById("filterOptions"); - var wordFiltersSelected = []; - - for (var i = 0; i < wordFilterOptions.children.length; i++) { - var filterOption = wordFilterOptions.children[i]; - if (filterOption.children[0].checked) { - wordFiltersSelected.push(filterOption['part-of-speech']); - } - } - - return wordFiltersSelected; -} - -function ToggleAllFilters(doCheck) { - var wordFilterOptions = document.getElementById("filterOptions"); - - for (var i = 0; i < wordFilterOptions.children.length; i++) { - wordFilterOptions.children[i].children[0].checked = doCheck; - } -} - -function ShowFilterWordCount(numberOfWords) { - var filters = GetSelectedFilters(); - var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var wordCounter = document.getElementById("filterWordCount"); - - if (filters.length > 0 || search != "") { - wordCounter.innerHTML = "Showing " + numberOfWords.toString() + " result" + ((numberOfWords != 1) ? "s" : ""); - } else { - wordCounter.innerHTML = ""; - } -} - -function NewWordNotification(word) { - var wordId = currentDictionary.nextWordId - 1; - NewNotification("New Word Added: " + word + ""); -} - -function NewNotification(message) { - var notificationArea = document.getElementById("notificationArea"); - var notificationMessage = document.getElementById("notificationMessage"); - notificationArea.style.display = "block"; - notificationMessage.innerHTML = message; -} - -function FocusAfterAddingNewWord() { - document.getElementById("word").focus(); -} diff --git a/package.json b/package.json index 08a9691..27cb1a2 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "lexiconga", "title": "Lexiconga", - "version": "1.0.0", + "version": "2.0.0", "description": "A tool to build simple dictionaries using JSON.", "main": "src/app.js", "scripts": { - "start": "node start-server.js", + "serve": "node start-server.js", "pack": "node ./node_modules/webpack/bin/webpack.js -d --progress --display-error-details", "watch": "node ./node_modules/webpack/bin/webpack.js -d --progress --watch", "build": "node ./node_modules/webpack/bin/webpack.js -p --progress" @@ -14,38 +14,33 @@ "type": "git", "url": "git+https://Alamantus@github.com/Alamantus/Lexiconga.git" }, - "author": "Robbie Antenesse ", + "author": "Robbie Antenesse ", "license": "ISC", "bugs": { "url": "https://github.com/Alamantus/Lexiconga/issues" }, "homepage": "https://github.com/Alamantus/Lexiconga#readme", - "dependencies": { - "babel-polyfill": "^6.13.0", - "bulma": "^0.2.3", - "dexie": "^1.5.1", - "inferno": "^1.5.6", - "inferno-component": "^1.0.3", - "json-query": "^2.2.0", - "marked": "^0.3.6", - "papaparse": "^4.1.2", - "react": "^15.3.2", - "react-dom": "^15.3.2", - "react-select": "^1.0.0-rc.2" - }, "devDependencies": { - "babel-core": "^6.14.0", - "babel-loader": "^6.2.5", - "babel-plugin-inferno": "^1.4.0", - "babel-preset-es2015": "^6.14.0", - "babel-preset-react": "^6.11.1", - "css-loader": "^0.25.0", - "express": "^4.14.0", - "file-loader": "^0.9.0", - "html-minify-loader": "^1.1.0", - "node-sass": "^3.10.0", - "sass-loader": "^4.0.2", - "style-loader": "^0.13.1", - "webpack": "^1.13.2" + "babel-core": "^6.24.0", + "babel-loader": "^6.4.1", + "babel-plugin-inferno": "^3.1.0", + "babel-preset-es2016": "^6.22.0", + "css-loader": "^0.28.0", + "express": "^4.15.2", + "file-loader": "^0.11.1", + "node-sass": "^4.5.2", + "sass-loader": "^6.0.3", + "style-loader": "^0.16.1", + "url-loader": "^0.5.8", + "webpack": "^2.3.3" + }, + "dependencies": { + "babel-polyfill": "^6.23.0", + "bulma": "^0.4.0", + "dexie": "^1.5.1", + "inferno": "^1.6.0", + "inferno-component": "^1.6.0", + "marked": "^0.3.6", + "papaparse": "^4.2.0" } } diff --git a/php/ajax_createaccountemailcheck.php b/php/ajax_createaccountemailcheck.php deleted file mode 100644 index 0066080..0000000 --- a/php/ajax_createaccountemailcheck.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/php/ajax_dictionarymanagement.php b/php/ajax_dictionarymanagement.php deleted file mode 100644 index 635612f..0000000 --- a/php/ajax_dictionarymanagement.php +++ /dev/null @@ -1,345 +0,0 @@ - 0) { - if ($_GET['action'] == 'getall') { - Get_Dictionaries(true); - } - elseif ($_GET['action'] == 'load') { - Load_Current_Dictionary(); - } - elseif ($_GET['action'] == 'new') { - Save_Current_DictionaryAsNew(); - } - elseif ($_GET['action'] == 'update') { - Update_Current_Dictionary(); - } - elseif ($_GET['action'] == 'wordall') { - Save_New_Word(true); - } - elseif ($_GET['action'] == 'wordnew') { - Save_New_Word(false); - } - elseif ($_GET['action'] == 'wordupdate') { - Update_Word(); - } - elseif ($_GET['action'] == 'switch') { - Switch_Current_Dictionary($_POST['newdictionaryid'], true); - } - elseif ($_GET['action'] == 'delete') { - Delete_Current_Dictionary(); - } - elseif ($_GET['action'] == 'worddelete') { - Delete_Word(); - } -} else { - echo "not signed in"; -} - -function Get_Dictionaries($return_list = true) { - $query = "SELECT `id`, `name` FROM `dictionaries` WHERE `user`=" . $_SESSION['user'] . " ORDER BY `name` ASC;"; - $dictionaries = query($query); - - if ($dictionaries) { - if (num_rows($dictionaries) > 0) { - if ($return_list) { - $list = ""; - $_SESSION['dictionaries'] = []; - while ($dict = fetch($dictionaries)) { - $_SESSION['dictionaries'][] = $dict['id']; // Save a list of all dictionaries user has. - //list for the switch dictionaries dropdown. - $list .= $dict['id'] . '_IDNAMESEPARATOR_' . $dict['name'] . '_DICTIONARYSEPARATOR_'; - } - echo $list; - } - return true; - } else { - echo "no dictionaries"; - } - } else { - echo "could not load"; - } - return false; -} - -function Load_Current_Dictionary() { - $query = "SELECT `d`.`id`, `d`.`name`, `d`.`description`, `u`.`public_name`, `d`.`words`, `d`.`next_word_id`, `d`.`allow_duplicates`, `d`.`case_sensitive`, `d`.`parts_of_speech`, `d`.`sort_by_equivalent`, `d`.`is_complete`, `d`.`is_public` "; - $query .= "FROM `dictionaries` AS `d` LEFT JOIN `users` AS `u` ON `user`=`u`.`id` WHERE `d`.`id`=`u`.`current_dictionary` AND `user`=" . $_SESSION['user'] . ";"; - $dictionary = query($query); - - if ($dictionary) { - if (num_rows($dictionary) > 0) { - if (num_rows($dictionary) === 1) { - while ($dict = fetch($dictionary)) { - $_SESSION['dictionary'] = $dict['id']; - $json = '{"name":"' . $dict['name'] . '",'; - $json .= '"description":"' . $dict['description'] . '",'; - $json .= '"createdBy":"' . $dict['public_name'] . '",'; - $json .= '"words":[' . Get_Dictionary_Words($_SESSION['dictionary']) . '],'; - $json .= '"nextWordId":' . $dict['next_word_id'] . ','; - $json .= '"settings":{'; - $json .= '"allowDuplicates":' . (($dict['allow_duplicates'] == 1) ? 'true' : 'false') . ','; - $json .= '"caseSensitive":' . (($dict['case_sensitive'] == 1) ? 'true' : 'false') . ','; - $json .= '"partsOfSpeech":"' . $dict['parts_of_speech'] . '",'; - $json .= '"sortByEquivalent":' . (($dict['sort_by_equivalent'] == 1) ? 'true' : 'false') . ','; - $json .= '"isComplete":' . (($dict['is_complete'] == 1) ? 'true' : 'false') . ','; - $json .= '"isPublic":' . (($dict['is_public'] == 1) ? 'true' : 'false') . '},'; - $json .= '"externalID":' . $dict['id'] . '}'; - echo $json; - return true; - } - } else { - echo "more than 1 returned"; - } - } else { - echo "no dictionaries"; - } - } else { - echo "could not load"; - } - return false; -} - -function Get_Dictionary_Words($dictionary) { - $query = "SELECT `w`.`word_id`, `w`.`name`, `w`.`pronunciation`, `w`.`part_of_speech`, `w`.`simple_definition`, `w`.`long_definition` "; - $query .= "FROM `words` AS `w` LEFT JOIN `dictionaries` AS `d` ON `w`.`dictionary`=`d`.`id` WHERE `w`.`dictionary`=" . $dictionary . " "; - $query .= "ORDER BY IF(`d`.`sort_by_equivalent`, `w`.`simple_definition`, `w`.`name`) COLLATE utf8_unicode_ci;"; - $words = query($query); - - $results = ""; - $processed = 0; - - if ($words) { - if (num_rows($words) > 0) { - while ($word = fetch($words)) { - $results .= '{"name":"' . $word['name'] . '",'; - $results .= '"pronunciation":"' . $word['pronunciation'] . '",'; - $results .= '"partOfSpeech":"' . $word['part_of_speech'] . '",'; - $results .= '"simpleDefinition":"' . $word['simple_definition'] . '",'; - $results .= '"longDefinition":"' . $word['long_definition'] . '",'; - $results .= '"wordId":' . $word['word_id'] . '}'; - - // If it's the last one, then don't add a comma. - if (++$processed < num_rows($words)) { - $results .= ","; - } - } - } - } - - return $results; -} - -function Save_Current_DictionaryAsNew() { - $dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD); - $dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); - $dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - - $query = "INSERT INTO `dictionaries`(`user`, `name`, `description`, `next_word_id`, `allow_duplicates`, `case_sensitive`, `parts_of_speech`, `sort_by_equivalent`, `is_complete`, `is_public`) "; - $query .= "VALUES (" . $_SESSION['user'] . ",'" . $_POST['name'] . "','" . $_POST['description'] . "'," . $_POST['nextwordid'] . "," . $_POST['allowduplicates'] . "," . $_POST['casesensitive'] . ",'" . $_POST['partsofspeech'] . "'," . $_POST['sortbyequivalent'] . "," . $_POST['iscomplete'] . "," . $_POST['ispublic'] . ")"; - - try { - $update = $dbconnection->prepare($query); - $update->execute(); - $_SESSION['dictionary'] = $dbconnection->lastInsertId(); - $_SESSION['dictionaries'][] = $_SESSION['dictionary']; //Add new id to valid dictionaries. - echo $_SESSION['dictionary']; - Switch_Current_Dictionary($_SESSION['dictionary'], false); - return true; - } - catch (PDOException $ex) { - $errorMessage = $dbconnection->errorInfo(); - echo "could not update:\n" . $errorMessage[2] . "\n" . $query; - } - return false; -} - -function Update_Current_Dictionary() { - if (isset($_SESSION['dictionary'])) { - $query = "UPDATE `dictionaries` SET "; - - if (isset($_POST['name'])) { - $query .= "`name`='" . $_POST['name'] . "', "; - } - if (isset($_POST['description'])) { - $query .= "`description`='" . $_POST['description'] . "', "; - } - if (isset($_POST['nextwordid'])) { - $query .= "`next_word_id`=" . $_POST['nextwordid'] . ", "; - } - if (isset($_POST['allowduplicates'])) { - $query .= "`allow_duplicates`=" . $_POST['allowduplicates'] . ", "; - } - if (isset($_POST['casesensitive'])) { - $query .= "`case_sensitive`=" . $_POST['casesensitive'] . ", "; - } - if (isset($_POST['partsofspeech'])) { - $query .= "`parts_of_speech`='" . $_POST['partsofspeech'] . "', "; - } - if (isset($_POST['sortbyequivalent'])) { - $query .= "`sort_by_equivalent`='" . $_POST['sortbyequivalent'] . "', "; - } - if (isset($_POST['iscomplete'])) { - $query .= "`is_complete`=" . $_POST['iscomplete'] . ", "; - } - if (isset($_POST['ispublic'])) { - $query .= "`is_public`=" . $_POST['ispublic'] . ", "; - } - - $query .= "`last_updated`='" . date("Y-m-d H:i:s") . "'"; - $query .= " WHERE `id`=" . $_SESSION['dictionary'] . " AND `user`=" . $_SESSION['user'] . ";"; - $update = query($query); - - if ($update) { - echo "updated successfully"; - return true; - } else { - echo "could not update"; - } - } else { - Save_Current_DictionaryAsNew(); - } - return false; -} - -function Save_New_Word($multiple = false) { - if (in_array($_GET['dict'], $_SESSION['dictionaries'])) { // Make sure that the given dictionary is valid before using it in the query. - // Allows users to update previously open dictionaries if they accidentally change dictionaries while in another window and go back. - $worddata = json_decode(file_get_contents("php://input"), true); - - $dbconnection = new PDO('mysql:host=' . DATABASE_SERVERNAME . ';dbname=' . DATABASE_NAME . ';charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD); - $dbconnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - - $query = "UPDATE `dictionaries` SET `next_word_id`=" . $_GET['nextwordid'] . ", `last_updated`='" . date("Y-m-d H:i:s") . "' WHERE `id`=" . $_GET['dict'] . "; "; - $query .= "INSERT IGNORE INTO `words`(`dictionary`, `word_id`, `name`, `pronunciation`, `part_of_speech`, `simple_definition`, `long_definition`) "; - $query .= "VALUES "; - if ($multiple) { - for ($i = 0; $i < count($worddata); $i++) { - if ($i > 0) { - $query .= ", "; - } - $query .= "(" . $_GET['dict'] . "," . $worddata[$i]['wordId'] . ",'" . $worddata[$i]['name'] . "','" . $worddata[$i]['pronunciation'] . "','" . $worddata[$i]['partOfSpeech'] . "','" . $worddata[$i]['simpleDefinition'] . "','" . $worddata[$i]['longDefinition'] . "')"; - } - } else { - $query .= "(" . $_GET['dict'] . "," . $worddata['wordId'] . ",'" . $worddata['name'] . "','" . $worddata['pronunciation'] . "','" . $worddata['partOfSpeech'] . "','" . $worddata['simpleDefinition'] . "','" . $worddata['longDefinition'] . "')"; - } - $query .= ";"; - - try { - $update = $dbconnection->prepare($query); - $update->execute(); - echo "added successfully"; - return true; - } - catch (PDOException $ex) { - echo "could not update:\n" . $ex->getMessage() . "\n" . $query; - } - } else { - echo "specified dictionary is not owned by user"; - } - return false; -} - -function Update_Word() { - if (in_array($_GET['dict'], $_SESSION['dictionaries'])) { // Make sure that the given dictionary is valid before using it in the query. - // Allows users to update previously open dictionaries if they accidentally change dictionaries while in another window and go back. - $worddata = json_decode(file_get_contents("php://input"), true); - - $query = "UPDATE `words` SET "; - - $query .= "`name`='" . $worddata['name'] . "', "; - $query .= "`pronunciation`='" . $worddata['pronunciation'] . "', "; - $query .= "`part_of_speech`='" . $worddata['partOfSpeech'] . "', "; - $query .= "`simple_definition`='" . $worddata['simpleDefinition'] . "', "; - $query .= "`long_definition`='" . $worddata['longDefinition'] . "', "; - $query .= "`last_updated`='" . date("Y-m-d H:i:s") . "'"; - $query .= " WHERE `dictionary`=" . $_GET['dict'] . " AND `word_id`=" . $worddata['wordId'] . ";"; - $update = query($query); - - if ($update) { - echo "updated successfully"; - return true; - } else { - echo "could not update"; - } - } else { - echo "specified dictionary is not owned by user"; - } - return false; -} - -function Switch_Current_Dictionary($newdictionaryid, $returndictionary = true) { - if (isset($newdictionaryid)) { - if (in_array($newdictionaryid, $_SESSION['dictionaries'])) { - //Clear is_current from all user's dictionaries and then update the one they chose, only if the chosen dictionary is valid. - $query .= "UPDATE `users` SET `current_dictionary`=" . $newdictionaryid . " WHERE `id`=" . $_SESSION['user'] . ";"; - $update = query($query); - - if ($update) { - if ($returndictionary) { - Load_Current_Dictionary(); - } else { - echo "dictionary switched"; - } - // return true; - } else { - echo "could not update"; - } - } else { - echo "invalid dictionary"; - } - } else { - echo "no info provided"; - } - return false; -} - -function Delete_Current_Dictionary() { - if (isset($_SESSION['dictionary'])) { - if (in_array($_SESSION['dictionary'], $_SESSION['dictionaries'])) { - //Clear is_current from all user's dictionaries and then update the one they chose, only if the chosen dictionary is valid. - $query = "DELETE FROM `dictionaries` WHERE `id`=" . $_SESSION['dictionary'] . " AND `user`=" . $_SESSION['user'] . ";"; - $update = query($query); - - if ($update) { - Get_Dictionaries(true); - } else { - echo "could not delete"; - } - } else { - echo "invalid dictionary"; - } - } else { - echo "no current dictionary"; - } - return false; -} - -function Delete_Word() { - if (isset($_SESSION['dictionary'])) { - if (in_array($_POST['dict'], $_SESSION['dictionaries'])) { // Make sure that the given dictionary is valid before using it in the query. - // Allows users to update previously open dictionaries if they accidentally change dictionaries while in another window and go back. - //Clear is_current from all user's dictionaries and then update the one they chose, only if the chosen dictionary is valid. - $query = "DELETE FROM `words` WHERE `dictionary`=" . $_POST['dict'] . " AND `word_id`=" . $_POST['word'] . ";"; - $update = query($query); - - if ($update) { - echo "deleted successfully"; - } else { - echo "could not delete: " . $_POST['dict'] . "-" . $_POST['word'] . " caused a problem"; - } - } else { - echo "invalid dictionary"; - } - } else { - echo "no current dictionary"; - } - return false; -} -?> diff --git a/php/ajax_passwordresetemailcheck.php b/php/ajax_passwordresetemailcheck.php deleted file mode 100644 index 290830d..0000000 --- a/php/ajax_passwordresetemailcheck.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/php/config.php b/php/config.php deleted file mode 100644 index e3bf456..0000000 --- a/php/config.php +++ /dev/null @@ -1,13 +0,0 @@ - \ No newline at end of file diff --git a/php/display.php b/php/display.php deleted file mode 100644 index 827f153..0000000 --- a/php/display.php +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/php/functions.php b/php/functions.php deleted file mode 100644 index 3e0a25e..0000000 --- a/php/functions.php +++ /dev/null @@ -1,10 +0,0 @@ - \ No newline at end of file diff --git a/php/helpers.php b/php/helpers.php deleted file mode 100644 index 7e7c5db..0000000 --- a/php/helpers.php +++ /dev/null @@ -1,85 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $dbconnection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $dbconnection->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); - try { - $queryResults = $dbconnection->prepare($query_string); - $queryResults->execute(); - return $queryResults; - } - catch (PDOException $ex) { - return false; - } -} -function num_rows ($query_results) { - try { - $rowcount = $query_results->rowcount(); - return $rowcount; - } - catch (PDOException $ex) { - return false; - } -} -function fetch ($query_results) { - try { - $fetchassoc = $query_results->fetch(); - return $fetchassoc; - } - catch (PDOException $ex) { - return false; - } -} - -function get_include_contents($filename) { - if (is_file($filename)) { - ob_start(); - include $filename; - return ob_get_clean(); - } - return false; -} - -function ordinal($number) { - // Retrieved from http://stackoverflow.com/a/3110033/3508346 - $ends = array('th','st','nd','rd','th','th','th','th','th','th'); - if ((($number % 100) >= 11) && (($number%100) <= 13)) - return $number. 'th'; - else - return $number. $ends[$number % 10]; -} - -function time_elapsed($secs){ - // Retrieved from http://php.net/manual/en/function.time.php#108581 - $bit = array( - // ' year' => $secs / 31556926 % 12, - // ' week' => $secs / 604800 % 52, - // ' day' => $secs / 86400 % 7, - // ' hour' => $secs / 3600 % 24, - ' minute' => $secs / 60 % 60, - ' second' => $secs % 60 - ); - - foreach($bit as $k => $v){ - if($v > 1 || $v < 1)$ret[] = $v . $k . 's'; - if($v == 1)$ret[] = $v . $k; - } - array_splice($ret, count($ret)-1, 0, 'and'); - //$ret[] = 'ago.'; - - return join(' ', $ret); -} - -function random_string($length = 10) { - // Retrieved from http://stackoverflow.com/a/4356295/3508346 - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < $length; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - return $randomString; -} -?> \ No newline at end of file diff --git a/php/notificationconditiontree.php b/php/notificationconditiontree.php deleted file mode 100644 index 45dbcf6..0000000 --- a/php/notificationconditiontree.php +++ /dev/null @@ -1,211 +0,0 @@ -Please try again later."; - break; - case "emailcreateinvalid": - $notificationMessage = "The email address used to create your account didn't work.
    Please try another."; - break; - case "createemailorpasswordblank": - $notificationMessage = "The create account form somehow got submitted without some essential information.
    Please try filling it out again."; - break; - case "couldnotsendresetemail": - $notificationMessage = "For some reason, the reset email could not be sent.
    Please try again later."; - break; - case "couldnotsetresetlink": - $notificationMessage = "The email address specified for password reset does not have an account."; - break; - case "emailresetinvalid": - $notificationMessage = "The email address specified for password reset didn't work.
    Please try again."; - break; - case "resetemailblank": - $notificationMessage = "The password reset form somehow got submitted without some essential information.
    Please try filling it out again."; - break; - case "loginfailed": - $notificationMessage = "We couldn't log you in because your email or password was incorrect.
    "; - - $_SESSION['loginfailures'] += 1; - if ($_SESSION['loginfailures'] < 10) { - $notificationMessage .= "This is your " . ordinal($_SESSION['loginfailures']) . " failed attempt.
    After 10 failures, you will not be able to log in for 1 hour.
    Please try again."; - } else { - $_SESSION['loginlockouttime'] = time(); - $notificationMessage .= "Since you failed to log in successfully 10 times, you may not try again for 1 hour."; - } - break; - case "emaildoesnotexist": - $notificationMessage = "The email address you entered doesn't have an account.
    Would you like to create an account?"; - break; - case "emailinvalid": - $notificationMessage = "The email address you entered didn't work.
    Please try another."; - break; - case "resetlinkfailed": - $notificationMessage = "The reset link used is not valid. Please make sure you have copied it correctly."; - break; - case "resetlinkinvalid": - $notificationMessage = "The reset link used is not valid. Please make sure you have copied it correctly."; - break; - case "couldnotresetpassword": - $notificationMessage = "Your password could not be reset at this time. Please try again later.
    If you remember your old password, you may still use it to log in."; - break; - case "passwordresetinvalid": - $notificationMessage = "Something went wrong in the password reset process. Please try again."; - break; - case "newpasswordblank": - $notificationMessage = "All the necessary information did not make it through for your password reset. Please try again."; - break; - case "couldnotupdatesettings": - $notificationMessage = "Could not update your account settings. Please try again."; - break; - case "accountsettingsinvalid": - $notificationMessage = "The email address you entered was either not valid or is already in use by another user. Please choose a different email address if you want to update your account email."; - break; - case "createdaccountsuccessfully": - $notificationMessage = "Your account was created successfully!
    Please log in using the email address and password you used to create it and you can start accessing your dictionaries anywhere!"; - break; - case "resetemailsent": - $notificationMessage = "The password reset link has been sent to the email you specified.
    If you do not see it in your inbox, please check your junk mail box just in case!
    Be sure to use the link before the end of today or else you will need to request a new one."; - break; - case "showresetform": - $notificationMessage = ' -
    -

    Reset Your Password

    - - - -
    - -
    '; - break; - case "passwordresetsuccessfully": - $notificationMessage = "Your password has been successfully reset. You may now log in using your new password."; - break; - case "accountsettingsupdated": - $notificationMessage = "Your settings have been updated."; - break; - } - - $_SESSION['current_status'] = ""; -} - -if (isset($_GET['logout']) && $current_user > 0) { - session_destroy(); - header('Location: ./?loggedout'); -} -elseif (isset($_GET['login']) && $current_user <= 0) { - if (isset($_POST['email']) && isset($_POST['password'])) { - if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { - if (EmailExists($_POST['email'])) { - if (Validate_Login($_POST['email'], $_POST['password'])) { - $_SESSION['user'] = Get_User_Id($_POST['email']); - query("UPDATE `users` SET `last_login`='" . date("Y-m-d H:i:s") . "' WHERE `id`=" . $_SESSION['user'] . ";"); - } else { - $_SESSION['current_status'] = "loginfailed"; - } - } else { - $_SESSION['current_status'] = "emaildoesnotexist"; - } - } else { - $_SESSION['current_status'] = "emailinvalid"; - } - } else { - $_SESSION['current_status'] = "loginemailorpasswordblank"; - } - header('Location: ./'); -} -elseif (isset($_GET['createaccount'])) { - if (isset($_POST['email']) && isset($_POST['password'])) { - if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) && !EmailExists($_POST['email'])) { - if (query("INSERT INTO users (email, password, public_name, allow_email) VALUES ('" . $_POST['email'] . "','" . crypt($_POST['password'], $_POST['email']) . "','" . htmlspecialchars($_POST['publicname'], ENT_QUOTES) . "'," . (($_POST['allowemails'] != "on") ? 0 : 1) . ")")) { - $_SESSION['current_status'] = "createdaccountsuccessfully"; - } else { - $_SESSION['current_status'] = "couldnotcreate"; - } - } else { - $_SESSION['current_status'] = "emailcreateinvalid"; - } - } else { - $_SESSION['current_status'] = "createemailorpasswordblank"; - } - header('Location: ./'); -} -elseif (isset($_GET['forgot'])) { - if (isset($_POST['email'])) { - if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) && EmailExists($_POST['email'])) { - $reset_email = Set_Password_Reset($_POST['email']); - if ($reset_email === true) { - $_SESSION['current_status'] = "resetemailsent"; - } elseif ($reset_email === "could not send") { - $_SESSION['current_status'] = "couldnotsendresetemail"; - } else { - $_SESSION['current_status'] = "couldnotsetresetlink"; - } - } else { - $_SESSION['current_status'] = "emailresetinvalid"; - } - } else { - $_SESSION['current_status'] = "resetemailblank"; - } - header('Location: ./'); -} -elseif (isset($_GET['passwordreset'])) { - if (isset($_GET['account']) && isset($_GET['code'])) { - $reset_email = Check_Password_Reset($_GET['account'], $_GET['code']); - if ($reset_email == true) { - $_SESSION['current_status'] = "showresetform"; - $_SESSION['reset_account'] = $_GET['account']; - } else { - $_SESSION['current_status'] = "resetlinkfailed"; - } - } else { - $_SESSION['current_status'] = "resetlinkinvalid"; - } - header('Location: ./'); -} -elseif (isset($_GET['resetpassword'])) { - if (isset($_POST['account']) && isset($_POST['password'])) { - if (filter_var($_POST['account'], FILTER_VALIDATE_EMAIL) && EmailExists($_POST['account'])) { - $reset_password_success = Reset_Password($_POST['password'], $_POST['account']); - if ($reset_password_success == true) { - $_SESSION['current_status'] = "passwordresetsuccessfully"; - } else { - $_SESSION['current_status'] = "couldnotresetpassword"; - } - } else { - $_SESSION['current_status'] = "passwordresetinvalid"; - } - } else { - $_SESSION['current_status'] = "newpasswordblank"; - } - header('Location: ./'); -} -elseif (isset($_GET['accountsettings'])) { - if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) && - ($_POST['email'] == Get_User_Email($current_user) || !EmailExists($_POST['email']))) - { - $public_name = (isset($_POST['publicname']) && $_POST['publicname'] != "") ? $_POST['publicname'] : "Someone"; - if (query("UPDATE `users` SET `email`='" . $_POST['email'] . "', `public_name`='" . htmlspecialchars($public_name, ENT_QUOTES) . "', `allow_email`=" . (($_POST['allowemails'] != "on") ? 0 : 1) . " WHERE `id`=" . $current_user . ";")) { - $_SESSION['current_status'] = "accountsettingsupdated"; - } else { - $_SESSION['current_status'] = "couldnotupdatesettings"; - } - } else { - $_SESSION['current_status'] = "accountsettingsinvalid"; - } - header('Location: ./'); -} -elseif (isset($_GET['loggedout']) && $current_user <= 0) { - $notificationMessage = "You have been successfully logged out.
    You will only be able to use the dictionary saved to your browser."; -} elseif ($current_user > 0) { - if ($notificationMessage != "") { - $notificationMessage = "Welcome back, " . Get_Public_Name_By_Id($current_user) . "!
    " . $notificationMessage; - } else { - $notificationMessage = "Welcome back, " . Get_Public_Name_By_Id($current_user) . "!"; - } -} -?> \ No newline at end of file diff --git a/php/passwordreset.php b/php/passwordreset.php deleted file mode 100644 index 63d8dad..0000000 --- a/php/passwordreset.php +++ /dev/null @@ -1,53 +0,0 @@ -\r\n" . - "Reply-To: help@lexicon.ga\r\n" . - "X-Mailer: PHP/" . phpversion(); - - if (mail($to, $subject, $message, $header)) { - return true; - } else { - return "could not send"; - } - } else { - return false; - } -} - -function Check_Password_Reset($id, $code) { - $date = date("Y-m-d"); - $daterange = "'" . $date . " 00:00:00' AND '" . $date . " 23:59:59'"; - $query = "SELECT * FROM `users` WHERE `id`='" . $id . "' AND `password_reset_code`='" . $code . "' AND `password_reset_date` BETWEEN " . $daterange . ";"; - $users = query($query); - - if ($users && num_rows($users) === 1) { - return true; - } else { - return false; - } -} - -function Reset_Password($password, $email) { - $query = "UPDATE `users` SET `password`='" . crypt($password, $email) . "', `password_reset_date`='0000-00-00 00:00:00' WHERE `email`='" . $email . "';"; - $reset = query($query); - - if ($reset) { - return true; - } else { - return false; - } -} -?> \ No newline at end of file diff --git a/php/plugins/easycrypt.php b/php/plugins/easycrypt.php deleted file mode 100644 index 21d7356..0000000 --- a/php/plugins/easycrypt.php +++ /dev/null @@ -1,43 +0,0 @@ - \ No newline at end of file diff --git a/php/validation.php b/php/validation.php deleted file mode 100644 index e5f0252..0000000 --- a/php/validation.php +++ /dev/null @@ -1,104 +0,0 @@ - 0) { - return true; - } else { - return false; - } -} - -function Validate_Login($email, $password) { - $hashed_pw = crypt($password, $email); - $query = "SELECT * FROM `users` WHERE `email`='" . $email . "' AND `password`='" . $hashed_pw . "'"; - $users = query($query); - - if ($users && num_rows($users) === 1) { - return true; - } else { - return false; - } -} - -function Get_User_Id($email) { - $query = "SELECT `id` FROM `users` WHERE `email`='" . $email . "'"; - $users = query($query); - - if ($users && num_rows($users) > 0) { - if (num_rows($users) === 1) { - $user = fetch($users); - return $user["id"]; - } else { - return "More than one user id returned!"; - } - } else { - return "No User"; - } -} - -function Get_User_Email($id) { - $query = "SELECT `email` FROM `users` WHERE `id`='" . $id . "'"; - $users = query($query); - - if ($users && num_rows($users) > 0) { - if (num_rows($users) === 1) { - $user = fetch($users); - return $user["email"]; - } else { - return "More than one user id returned!"; - } - } else { - return "No User"; - } -} - -function Get_Public_Name_By_Id($id) { - $query = "SELECT `public_name` FROM `users` WHERE `id`=" . $id . ";"; - $users = query($query); - - if ($users && num_rows($users) > 0) { - if (num_rows($users) === 1) { - $user = fetch($users); - return $user["public_name"]; - } else { - return "More than one public name returned!"; - } - } else { - return "No User"; - } -} - -function Get_Public_Name_By_Email($email) { - $query = "SELECT `public_name` FROM `users` WHERE `email`='" . $email . "';"; - $users = query($query); - - if ($users && num_rows($users) > 0) { - if (num_rows($users) === 1) { - $user = fetch($users); - return $user["public_name"]; - } else { - return "More than one public name returned!"; - } - } else { - return "No User"; - } -} - -function Get_Allow_Email_By_Id($id) { - $query = "SELECT `allow_email` FROM `users` WHERE `id`=" . $id . ";"; - $users = query($query); - - if ($users && num_rows($users) > 0) { - if (num_rows($users) === 1) { - $user = fetch($users); - return $user["allow_email"]; - } else { - return "More than one user returned!"; - } - } else { - return "No User"; - } -} -?> \ No newline at end of file diff --git a/favicon.ico b/public/favicon.ico similarity index 100% rename from favicon.ico rename to public/favicon.ico diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..ec9eef0 --- /dev/null +++ b/public/index.html @@ -0,0 +1,17 @@ + + + + + + Lexiconga Dictionary Builder + + + + + + + +
    + + + \ No newline at end of file diff --git a/required.php b/required.php deleted file mode 100644 index 847a034..0000000 --- a/required.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/src/components/display/FixedPage.jsx b/src/components/display/FixedPage.jsx deleted file mode 100644 index b196677..0000000 --- a/src/components/display/FixedPage.jsx +++ /dev/null @@ -1,81 +0,0 @@ -// import React from 'react'; -import Inferno from 'inferno'; -import Component from 'inferno-component'; - -import {Button} from '../input/Button'; - -// Creates a page that floats above other elements when a connected button is clicked. -// export class FixedPage extends React.Component { -export class FixedPage extends Component { - constructor(props) { - super(props); - - this.state = { - display: false - }; - - // Bind each instance to its own show/hide watchers. - this.show = this.show.bind(this); - this.hide = this.hide.bind(this); - } - - conditionalDisplay() { - if (this.state.display) { - let contentClass = 'modal-content fixed-page-content'; - - if (this.props.contentClass) { - contentClass += ' ' + this.props.contentClass; - } - - return ( -
    - -
    - -
    -
    - -
    -
    - -
    - ); - } else { - return ( - \ - \ - \ - '; - - document.getElementById("entry" + indexString).innerHTML = editForm; - - SetPartsOfSpeech("partOfSpeech" + indexString); - document.getElementById("partOfSpeech" + indexString).value = htmlEntitiesParse(word.partOfSpeech); - - document.getElementById("word" + indexString).focus(); -} - -function CancelEditForm(index) { - document.getElementById("entry" + index.toString()).innerHTML = DictionaryEntry(index).replace("", "").replace("", ""); -} - -function EditWord(indexString) { - var word = htmlEntities(document.getElementById("word" + indexString).value).trim(); - var pronunciation = htmlEntities(document.getElementById("pronunciation" + indexString).value).trim(); - var partOfSpeech = htmlEntities(document.getElementById("partOfSpeech" + indexString).value).trim(); - var simpleDefinition = htmlEntities(document.getElementById("simpleDefinition" + indexString).value).trim(); - var longDefinition = htmlEntities(document.getElementById("longDefinition" + indexString).value); - - var errorMessageArea = document.getElementById("errorMessage" + indexString); - var errorMessage = ""; - var updateConflictArea = document.getElementById("updateConflict" + indexString); - - if (WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition)) { - document.getElementById("editWordButtonArea" + indexString).style.display = "none"; - DisableForm(indexString); - updateConflictArea.style.display = "block"; - updateConflictArea.innerHTML = "Do you really want to change the word \"" + currentDictionary.words[parseInt(indexString)].name + "\" to what you have set above?
    "; - updateConflictArea.innerHTML += ''; - updateConflictArea.innerHTML += ''; - } else { - errorMessage = "No change has been made to \"" + word + "\""; - if (currentDictionary.words[parseInt(indexString)].name != word) { - errorMessage += ". (Your dictionary is currently set to ignore case.)"; - } - } - - errorMessageArea.innerHTML = errorMessage; - - if (document.getElementById("updateConfirmButton" + indexString)) { - document.getElementById("updateConfirmButton" + indexString).focus(); - } -} - -function UpdateWord(wordIndex, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { - SaveScroll(); - - currentDictionary.words[wordIndex].name = word; - currentDictionary.words[wordIndex].pronunciation = pronunciation; - currentDictionary.words[wordIndex].partOfSpeech = ((partOfSpeech.length > 0) ? partOfSpeech : " "); - currentDictionary.words[wordIndex].simpleDefinition = simpleDefinition; - currentDictionary.words[wordIndex].longDefinition = longDefinition; - - SaveAndUpdateWords("update", wordIndex); - - window.scroll(savedScroll.x, savedScroll.y); - - if (!wordFormIsLocked()) { - FocusAfterAddingNewWord(); - } -} - -function DeleteWord(index) { - var deleteWord = new XMLHttpRequest(); - deleteWord.open('POST', "/php/ajax_dictionarymanagement.php?action=worddelete"); - deleteWord.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - deleteWord.onreadystatechange = function() { - if (deleteWord.readyState == 4 && deleteWord.status == 200) { - if (deleteWord.responseText == "deleted successfully" || deleteWord.responseText == "not signed in") { - currentDictionary.words.splice(index, 1); - - SaveWords(false); - } - console.log(deleteWord.responseText); - return true; - } else { - return false; - } - } - deleteWord.send("dict=" + currentDictionary.externalID.toString() + "&word=" + currentDictionary.words[index].wordId.toString()); -} - -function ShowDictionary() { - var filters = GetSelectedFilters(); - - var searchResults = []; - var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var searchByWord = document.getElementById("searchOptionWord").checked; - var searchBySimple = document.getElementById("searchOptionSimple").checked; - var searchByLong = document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = document.getElementById("searchIgnoreDiacritics").checked; - if (search != "" && (searchByWord || searchBySimple || searchByLong)) { - var xpath = []; - var searchDictionaryJSON = htmlEntitiesParseForSearch(JSON.stringify(currentDictionary)); - if (searchIgnoreCase) { - search = search.toLowerCase(); - } - if (searchIgnoreDiacritics) { - search = removeDiacritics(search); - searchDictionaryJSON = removeDiacritics(searchDictionaryJSON); - } - if (searchByWord) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'name' : 'translate(name, "", "")') +', "'+ search +'")'); - } - if (searchBySimple) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'simpleDefinition' : 'translate(simpleDefinition, "", "")') +', "'+ search +'")'); - } - if (searchByLong) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'longDefinition' : 'translate(longDefinition, "", "")') +', "'+ search +'")'); - } - var searchDictionary = JSON.parse(searchDictionaryJSON); - searchResults = JSON.search(searchDictionary, '//words['+ xpath.join(' or ') +']/wordId'); - } - - var dictionaryNameArea = document.getElementById("dictionaryName"); - dictionaryNameArea.innerHTML = currentDictionary.name + " Dictionary"; - if (loggedIn && currentDictionary.settings.isPublic) { - dictionaryNameArea.innerHTML += ""; - } - - var dictionaryDescriptionArea = document.getElementById("dictionaryDescription"); - dictionaryDescriptionArea.innerHTML = marked(htmlEntitiesParseForMarkdown(currentDictionary.description)); - - var dictionaryArea = document.getElementById("theDictionary"); - var dictionaryText = ""; - var numberOfWordsDisplayed = 0; - - if (currentDictionary.words.length > 0) { - for (var i = 0; i < currentDictionary.words.length; i++) { - if (filters.length == 0 || (filters.length > 0 && filters.indexOf(currentDictionary.words[i].partOfSpeech) > -1)) { - if (search == "" || (search != "" && (searchByWord || searchBySimple || searchByLong) && searchResults.indexOf(currentDictionary.words[i].wordId) >= 0)) { - if (!currentDictionary.words[i].hasOwnProperty("pronunciation")) { - currentDictionary.words[i].pronunciation = ""; //Account for new property - } - if (!currentDictionary.words[i].hasOwnProperty("wordId")) { - currentDictionary.words[i].wordId = i + 1; //Account for new property - } - dictionaryText += DictionaryEntry(i); - numberOfWordsDisplayed++; - } - } - } - } else { - dictionaryText = "There are no entries in the dictionary."; - } - - dictionaryArea.innerHTML = dictionaryText; - ShowFilterWordCount(numberOfWordsDisplayed); -} - -function DictionaryEntry(itemIndex) { - var searchTerm = regexParseForSearch(document.getElementById("searchBox").value); - var searchByWord = document.getElementById("searchOptionWord").checked; - var searchBySimple = document.getElementById("searchOptionSimple").checked; - var searchByLong = document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = document.getElementById("searchIgnoreDiacritics").checked; - - var searchRegEx = new RegExp("(" + ((searchIgnoreDiacritics) ? removeDiacritics(searchTerm) + "|" + searchTerm : searchTerm) + ")", "g" + ((searchIgnoreCase) ? "i" : "")); - - var wordName = wordPronunciation = wordPartOfSpeech = wordSimpleDefinition = wordLongDefinition = ""; - - if (searchTerm != "" && searchByWord) { - // Parse HTML Entities while searching so the regex can search actual characters instead of HTML. - wordName += htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].name).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - // Don't need to parse if not searching because HTML displays correctly anyway! - wordName += currentDictionary.words[itemIndex].name.toString(); // Use toString() to prevent using a reference instead of the value. - } - - if (currentDictionary.words[itemIndex].pronunciation != "") { - wordPronunciation += marked(htmlEntitiesParseForMarkdown(currentDictionary.words[itemIndex].pronunciation)).replace(/<\/?p>/g,""); - } - - if (currentDictionary.words[itemIndex].partOfSpeech != " " && currentDictionary.words[itemIndex].partOfSpeech != "") { - wordPartOfSpeech += currentDictionary.words[itemIndex].partOfSpeech.toString(); - } - - if (currentDictionary.words[itemIndex].simpleDefinition != "") { - if (searchTerm != "" && searchBySimple) { - wordSimpleDefinition += htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].simpleDefinition).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordSimpleDefinition += currentDictionary.words[itemIndex].simpleDefinition.toString(); - } - } - - if (currentDictionary.words[itemIndex].longDefinition != "") { - if (searchTerm != "" && searchByLong) { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(currentDictionary.words[itemIndex].longDefinition).replace(searchRegEx, "$1")))).replace(/<(\/?)searchterm>\;/g, '<$1searchterm>'); - } else { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(currentDictionary.words[itemIndex].longDefinition)); - } - } - - return DictionaryEntryTemplate({ - name : wordName, - pronunciation : wordPronunciation, - partOfSpeech : wordPartOfSpeech, - simpleDefinition : wordSimpleDefinition, - longDefinition : wordLongDefinition, - wordId : currentDictionary.words[itemIndex].wordId.toString() - }, (!currentDictionary.settings.isComplete) ? itemIndex : false); -} - -function ManagementArea(itemIndex) { - var managementHTML = "
    "; - - managementHTML += "Edit"; - managementHTML += "Delete"; - - managementHTML += ""; - - managementHTML += "
    "; - - return managementHTML; -} - -function DictionaryEntryTemplate(wordObject, managementIndex) { - managementIndex = (typeof managementIndex !== 'undefined') ? managementIndex : false; - var entryText = ""; - - if (loggedIn && currentDictionary.settings.isPublic) { - entryText += ""; - } - - entryText += "🔗"; - - entryText += "" + wordObject.name + ""; - - if (wordObject.pronunciation != "") { - entryText += "" + wordObject.pronunciation + ""; - } - - if (wordObject.partOfSpeech != "") { - entryText += "" + wordObject.partOfSpeech + ""; - } - - entryText += "
    "; - - if (wordObject.simpleDefinition != "") { - entryText += "" + wordObject.simpleDefinition + ""; - } - - if (wordObject.longDefinition != "") { - entryText += "" + wordObject.longDefinition + ""; - } - - if (managementIndex !== false) { - entryText += ManagementArea(managementIndex); - } - - entryText += "
    "; - - return entryText; -} - -function SaveSettings() { - if (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; - if (document.getElementById("dictionaryIsPublic")) { - currentDictionary.settings.isPublic = document.getElementById("dictionaryIsPublic").checked; - } - - HideSettingsWhenComplete(); - - SaveAndUpdateDictionary(true); - LoadUserDictionaries(); -} - -function EmptyWholeDictionary() { - if (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(false); - SetPartsOfSpeech(); - HideSettings(); - ShowSettings(); - document.getElementById("dictionaryNameEdit").focus(); -} - -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 deleteDictionary = new XMLHttpRequest(); - deleteDictionary.open('POST', "/php/ajax_dictionarymanagement.php?action=delete"); - deleteDictionary.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - deleteDictionary.onreadystatechange = function() { - if (deleteDictionary.readyState == 4 && deleteDictionary.status == 200) { - if (deleteDictionary.responseText.length < 31) { - console.log(deleteDictionary.responseText); - CreateNewDictionary(); - } else { - HideSettings(); - ShowDictionaryDeleteMenu(deleteDictionary.responseText); - - if (document.getElementById("loadAfterDelete").options.length == 0) { - document.getElementById('loadAfterDeleteScreen').style.display = 'none'; - CreateNewDictionary(); - } - } - return true; - } else { - return false; - } - } - deleteDictionary.send(); - } -} - - -function ResetDictionaryToDefault() { - currentDictionary = JSON.parse(defaultDictionaryJSON); -} - -function SaveAndUpdateWords(action, wordIndex) { - var dataToSend = ""; - if (action == "all") { - // For dictionaries not already in the db. Send all the words to database. - dataToSend = JSON.stringify(currentDictionary.words); - } else if (action == "update") { - // Only send the specified word to update. - dataToSend = JSON.stringify(currentDictionary.words[wordIndex]); - } else if (action == "new") { - // Send the last word pushed to the words array before it's sorted. - dataToSend = JSON.stringify(currentDictionary.words[currentDictionary.words.length - 1]); - } - - var sendWords = new XMLHttpRequest(); - sendWords.open('POST', "/php/ajax_dictionarymanagement.php?action=word" + action + "&dict=" + currentDictionary.externalID.toString() + "&nextwordid=" + currentDictionary.nextWordId.toString()); - sendWords.setRequestHeader("Content-Type", "application/json; charset=UTF-8"); - sendWords.onreadystatechange = function() { - if (sendWords.readyState == 4 && sendWords.status == 200) { - SaveWords(); - ClearForm(); - console.log(sendWords.responseText); - return true; - } else { - return false; - } - } - sendWords.send(dataToSend); -} - -function SaveWords() { - if (!currentDictionary.settings.sortByEquivalent) { - currentDictionary.words.sort(dynamicSort(['name', 'partOfSpeech'])); - } else { - currentDictionary.words.sort(dynamicSort(['simpleDefinition', 'partOfSpeech'])); - } - SaveDictionary(false); - ProcessLoad(); -} - -function SaveAndUpdateDictionary(keepFormContents) { - SaveDictionary(true); - ShowDictionary(); - if (!keepFormContents) { - ClearForm(); - } - CloseUpdateConflictArea(''); -} - -function SaveDictionary(sendToDatabase) { - //Always save local copy of current dictionary, but if logged in also send to database. - if (sendToDatabase) { - SendDictionary(); - } - - localStorage.setItem('dictionary', JSON.stringify(currentDictionary)); - - SavePreviousDictionary(); -} - -function SendDictionary() { - var action = ""; - var postString = ""; - if (currentDictionary.externalID > 0) { - action = "update"; - postString = DataToSend(false); - } else { - action = "new"; - postString = DataToSend(true); - } - - var sendDictionary = new XMLHttpRequest(); - sendDictionary.open('POST', "/php/ajax_dictionarymanagement.php?action=" + action); - sendDictionary.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - sendDictionary.onreadystatechange = function() { - if (sendDictionary.readyState == 4 && sendDictionary.status == 200) { - if (sendDictionary.responseText == "updated successfully") { - console.log(sendDictionary.responseText); - LoadUserDictionaries(); - ProcessLoad(); - } else if (isNaN(parseInt(sendDictionary.responseText))) { - console.log(sendDictionary.responseText); - } else { // It will only be a number if it is a new dictionary. - currentDictionary.externalID = parseInt(sendDictionary.responseText); - if (currentDictionary.words.length > 0) { - SaveAndUpdateWords("all"); - } - LoadUserDictionaries(); - ProcessLoad(); - console.log("saved " + parseInt(sendDictionary.responseText).toString() + " successfully"); - } - return true; - } else { - return false; - } - } - sendDictionary.send(postString); -} - -function DataToSend(sendAll) { - sendAll = (typeof sendAll !== 'undefined' && sendAll != null) ? sendAll : false; - var data = ""; - if (currentDictionary.externalID == 0) { - data = "name=" + encodeURIComponent(currentDictionary.name) + "&description=" + encodeURIComponent(currentDictionary.description) + "&words=" + encodeURIComponent(JSON.stringify(currentDictionary.words)); - data += "&nextwordid=" + currentDictionary.nextWordId + "&allowduplicates=" + ((currentDictionary.settings.allowDuplicates) ? "1" : "0") + "&casesensitive=" + ((currentDictionary.settings.caseSensitive) ? "1" : "0"); - data += "&partsofspeech=" + encodeURIComponent(currentDictionary.settings.partsOfSpeech) + "&sortbyequivalent=" + ((currentDictionary.settings.sortByEquivalent) ? "1" : "0") + "&iscomplete=" + ((currentDictionary.settings.isComplete) ? "1" : "0") + "&ispublic=" + ((currentDictionary.settings.isPublic) ? "1" : "0") + ""; - } else { - if (sendAll || currentDictionary.name != previousDictionary.name) { - data += "name=" + encodeURIComponent(currentDictionary.name); - } - if (sendAll || currentDictionary.description != previousDictionary.description) { - data += ((data=="") ? "" : "&") + "description=" + encodeURIComponent(currentDictionary.description); - } - if (sendAll || currentDictionary.nextWordId != previousDictionary.nextWordId) { - data += ((data=="") ? "" : "&") + "nextwordid=" + currentDictionary.nextWordId; - } - if (sendAll || currentDictionary.settings.allowDuplicates != previousDictionary.allowDuplicates) { - data += ((data=="") ? "" : "&") + "allowduplicates=" + ((currentDictionary.settings.allowDuplicates) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.caseSensitive != previousDictionary.caseSensitive) { - data += ((data=="") ? "" : "&") + "casesensitive=" + ((currentDictionary.settings.caseSensitive) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.partsOfSpeech != previousDictionary.partsOfSpeech) { - data += ((data=="") ? "" : "&") + "partsofspeech=" + encodeURIComponent(currentDictionary.settings.partsOfSpeech); - } - if (sendAll || currentDictionary.settings.sortByEquivalent != previousDictionary.sortByEquivalent) { - data += ((data=="") ? "" : "&") + "sortbyequivalent=" + ((currentDictionary.settings.sortByEquivalent) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.isComplete != previousDictionary.isComplete) { - data += ((data=="") ? "" : "&") + "iscomplete=" + ((currentDictionary.settings.isComplete) ? "1" : "0"); - } - if (sendAll || currentDictionary.settings.isPublic != previousDictionary.isPublic) { - data += ((data=="") ? "" : "&") + "ispublic=" + ((currentDictionary.settings.isPublic) ? "1" : "0"); - } - } - return data; -} - -function LoadDictionary() { - LoadLocalDictionary(); - var loadDictionary = new XMLHttpRequest(); - loadDictionary.open('GET', "/php/ajax_dictionarymanagement.php?action=load"); - loadDictionary.onreadystatechange = function() { - if (loadDictionary.readyState == 4 && loadDictionary.status == 200) { - if (loadDictionary.responseText == "no dictionaries") { - // If there are no dictionaries in the database and there's one in memory, remove the id & public setting and send it as a new one. - currentDictionary.externalID = 0; - currentDictionary.settings.isPublic = false; - SendDictionary(true); - } else if (loadDictionary.responseText.length < 60) { - console.log(loadDictionary.responseText); - } else { - currentDictionary = JSON.parse(loadDictionary.responseText); - SaveDictionary(false); - } - } - ProcessLoad(); - } - loadDictionary.send(); -} - -function ChangeDictionary(userDictionariesSelect) { - userDictionariesSelect = (typeof userDictionariesSelect !== 'undefined' && userDictionariesSelect != null) ? userDictionariesSelect : document.getElementById("userDictionaries"); - if (currentDictionary.externalID != userDictionariesSelect.value && userDictionariesSelect.options.length > 0) { - // Show the info page with loading screen and hide settings and stuff. - ShowInfoWithText("

    Loading " + userDictionariesSelect.options[userDictionariesSelect.selectedIndex].text + "...

    "); - HideSettings(); - - ChangeDictionaryToId(userDictionariesSelect.value, function(response) { - if (response == "no dictionaries") { - console.log(response); - SendDictionary(false); - } else if (response.length < 60) { - console.log(response); - } else { - currentDictionary = JSON.parse(response); - SaveDictionary(false); - ProcessLoad(); - LoadUserDictionaries(); - HideInfo(); // Hide the loading screen. - } - }); - } -} - -function ChangeDictionaryToId(dictionaryId, callbackFunction) { - var changeDictionaryRequest = new XMLHttpRequest(); - changeDictionaryRequest.open('POST', "/php/ajax_dictionarymanagement.php?action=switch"); - changeDictionaryRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - var postString = "newdictionaryid=" + dictionaryId.toString(); - changeDictionaryRequest.onreadystatechange = function() { - if (changeDictionaryRequest.readyState == 4 && changeDictionaryRequest.status == 200) { - callbackFunction(changeDictionaryRequest.responseText); - } - } - changeDictionaryRequest.send(postString); -} - -function LoadLocalDictionary() { - if (localStorage.getItem('dictionary')) { - var tmpDictionary = JSON.parse(localStorage.getItem('dictionary')); - if (tmpDictionary.words.length > 0 || tmpDictionary.description != "A new dictionary." || tmpDictionary.name != "New") { - currentDictionary = JSON.parse(localStorage.getItem('dictionary')); - } - tmpDictionary = null; - } -} - -function ProcessLoad() { - if (!currentDictionary.hasOwnProperty("nextWordId")) { - currentDictionary.nextWordId = currentDictionary.words.length + 1; - } - - HideSettingsWhenComplete(); - - ShowDictionary(); - - SetPartsOfSpeech(); - - if (currentDictionary.settings.isComplete) { - document.getElementById("wordEntryForm").style.display = "none"; - } - - SavePreviousDictionary(); -} - -function SavePreviousDictionary () { - // Save non-word data to check if anything has changed (words can identify themselves if changed). - // Used to minimize data pushed to database. - 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() { - var downloadName = removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g, ''); - if (downloadName == "") { - downloadName = "export"; - } - download(downloadName + ".dict", localStorage.getItem('dictionary')); -} - -function ExportWords() { - if (currentDictionary.words.length > 0) { - var downloadName = removeDiacritics(stripHtmlEntities(currentDictionary.name)).replace(/\W/g, ''); - if (downloadName == "") { - downloadName = "export"; - } - downloadName += "_words"; - - var wordsCSV = "word,pronunciation,part of speech,definition,explanation\n"; - for (var i = 0; i < currentDictionary.words.length; i++) { - var word = "\"" + htmlEntitiesParse(currentDictionary.words[i].name).trim().replace(/\"/g, "\"\"") + "\""; - var pronunciation = "\"" + htmlEntitiesParse(currentDictionary.words[i].pronunciation).trim().replace(/\"/g, "\"\"") + "\""; - var partOfSpeech = "\"" + htmlEntitiesParse(currentDictionary.words[i].partOfSpeech).trim().replace(/\"/g, "\"\"") + "\""; - var simpleDefinition = "\"" + htmlEntitiesParse(currentDictionary.words[i].simpleDefinition).trim().replace(/\"/g, "\"\"") + "\""; - var longDefinition = "\"" + htmlEntitiesParse(currentDictionary.words[i].longDefinition).replace(/\"/g, "\"\"") + "\""; - wordsCSV += word + "," + pronunciation + "," + partOfSpeech + "," + simpleDefinition + "," + longDefinition + "\n"; - } - - download(downloadName + ".csv", wordsCSV); - } 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) { - alert('Your browser is not supported'); - return false; - } - - var reader = new FileReader(); - if (document.getElementById("importFile").files.length > 0) { - var file = document.getElementById("importFile").files[0]; - // Read the file - reader.readAsText(file); - // When it's loaded, process it - reader.onloadend = function () { - if (reader.result && reader.result.length) { - var tmpDicitonary = JSON.parse(reader.result); - - if (tmpDicitonary.hasOwnProperty("name") && tmpDicitonary.hasOwnProperty("description") && - tmpDicitonary.hasOwnProperty("words") && tmpDicitonary.hasOwnProperty("settings")) - { - currentDictionary = JSON.parse(reader.result); - currentDictionary.externalID = 0; // Reset external id for imported dictionary. - currentDictionary.settings.isPublic = false; // Reset public setting for imported dictionary. - SaveDictionary(true); - ProcessLoad(); - HideInfo(); - HideSettings(); - document.getElementById("importFile").value = ""; - NewNotification("Successfully Imported the \"" + currentDictionary.name + "\" Dictionary."); - } else { - var errorString = "File is missing:"; - if (!tmpDicitonary.hasOwnProperty("name")) - errorString += " name"; - if (!tmpDicitonary.hasOwnProperty("description")) - errorString += " description"; - if (!tmpDicitonary.hasOwnProperty("words")) - errorString += " words"; - if (!tmpDicitonary.hasOwnProperty("settings")) - errorString += " settings"; - alert("Uploaded file is not compatible.\n\n" + errorString); - } - - tmpDicitonary = null; - } else { - alert("Upload Failed"); - } - reader = null; - } - } else { - alert("You must add a file to import."); - } - } -} - -function ImportWords() { - if (currentDictionary.externalID > 0 || confirm("This will add words in a correctly formatted CSV file to your currently loaded dictionary. Do you still want to import?")) { - if (!window.FileReader) { - alert('Your browser is not supported'); - return false; - } - - if (document.getElementById("importWordsCSV").files.length > 0) { - var file = document.getElementById("importWordsCSV").files[0]; - - var resultsArea = document.getElementById("importOptions"); - resultsArea.innerHTML = "

    Importing Words...

    "; - - var currentRow = 0; // Because of the header, the first row of data is always on line 2. - var rowsImported = 0; - - Papa.parse(file, { - header: true, - step: function(row, parser) { - currentRow++; - // If there are no errors OR the word and either definition or explanation contain data, then import it. - if ((row.data[0].word.trim().length > 0 && (row.data[0].definition.trim().length > 0 || row.data[0].explanation.trim().length > 0)) || row.errors.length == 0) { - var wordName = htmlEntities(row.data[0]["word"]).trim(), - wordPronunciation = htmlEntities(row.data[0]["pronunciation"]).trim(), - wordPartOfSpeech = ((htmlEntities(row.data[0]["part of speech"]).trim().length > 0) ? htmlEntities(row.data[0]["part of speech"]).trim() : " "), - wordSimpleDefinition = htmlEntities(row.data[0]["definition"]).trim(), - wordLongDefinition = htmlEntities(row.data[0]["explanation"]).trim(), - wordId = currentDictionary.nextWordId++; - - currentDictionary.words.push({name: wordName, pronunciation: wordPronunciation, partOfSpeech: wordPartOfSpeech, simpleDefinition: wordSimpleDefinition, longDefinition: wordLongDefinition, wordId: wordId}); - - var wordEntry = DictionaryEntryTemplate(currentDictionary.words[currentDictionary.words.length - 1]); - resultsArea.innerHTML += wordEntry; - - rowsImported++; - } else { - // If it's not just an empty line, give an error. - if (row.data[0].word.trim().length > 0) { - for (var i = 0; i < row.errors.length; i++) { - resultsArea.innerHTML += "

    Error on record #" + currentRow.toString() + ": " + row.errors[i].message + "

    "; - } - } - } - // Scroll to the bottom. - document.getElementById("infoPage").scrollTop = document.getElementById("infoPage").scrollHeight; - }, - complete: function(results) { - SaveAndUpdateWords("all"); - resultsArea.innerHTML += "

    The file has finished importing " + rowsImported.toString() + " words.

    "; - NewNotification("Imported " + rowsImported.toString() + " words."); - // Scroll to the bottom. - document.getElementById("importOptions").scrollTop = document.getElementById("importOptions").scrollHeight; - document.getElementById("numberOfWordsInDictionary").innerHTML = currentDictionary.words.length.toString(); - } - }); - } else { - alert("You must add a file to import."); - } - } -} - -function WordIndex(word, byId) { -// Use byId = true to enter word id number instead of string. - for (var i = 0; i < currentDictionary.words.length; i++) - { - if ((!byId && (!currentDictionary.settings.caseSensitive && currentDictionary.words[i].name.toLowerCase() == word.toLowerCase()) || - (currentDictionary.settings.caseSensitive && currentDictionary.words[i].name == word)) || - (byId && currentDictionary.words[i].wordId == word)) { - return i; - } - } - return -1; -} - -function WordAtIndexWasChanged(indexString, word, pronunciation, partOfSpeech, simpleDefinition, longDefinition) { - return (!currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name.toLowerCase() != word.toLowerCase()) || - (currentDictionary.settings.caseSensitive && currentDictionary.words[parseInt(indexString)].name != word) || - currentDictionary.words[parseInt(indexString)].pronunciation != pronunciation || - currentDictionary.words[parseInt(indexString)].partOfSpeech.trim() != partOfSpeech || - currentDictionary.words[parseInt(indexString)].simpleDefinition != simpleDefinition || - currentDictionary.words[parseInt(indexString)].longDefinition != longDefinition; -} - -function CheckForPartsOfSpeechChange() { - if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != currentDictionary.settings.partsOfSpeech) { - if (htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value) != "") { - currentDictionary.settings.partsOfSpeech = htmlEntities(document.getElementById("dictionaryPartsOfSpeechEdit").value); - SetPartsOfSpeech(); - } - } -} diff --git a/src/js/dependencies/defiant.js b/src/js/dependencies/defiant.js deleted file mode 100644 index bc041fb..0000000 --- a/src/js/dependencies/defiant.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * defiant.js [v1.4.0] - * http://www.defiantjs.com - * Copyright (c) 2013-2016, Hakan Bilgin - * Licensed under the MIT License - */ -if(function(t,e,r){"use strict";var n={is_ie:/(msie|trident)/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,o=new XSLTProcessor,i=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),o.importStylesheet(this.xsl_template),i.appendChild(o.transformToFragment(l.data,document)),a.removeAttribute("match"),this.is_safari){n=i.getElementsByTagName("script");for(var c=0,u=n.length;u>c;c++)n[c].defer=!0}return i.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,e){return JSON.toXML(t,e||!0)},xmlFromString:function(t){var e,r;return t=t.replace(/>\s{1,}<"),null===t.trim().match(/<\?xml/)&&(t=this.xml_decl+t),"undefined"!=typeof ActiveXObject?(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:{}};t.Defiant=e.exports=n}("undefined"!=typeof window?window:{},"undefined"!=typeof module?module:{}),"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}}}else if("function"!=typeof XSLTProcessor&&!XSLTProcessor)throw"XSLTProcessor transformNode not implemented";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,namespace:'xmlns:d="defiant-namespace"',to_xml_str:function(t){return{str:this.hash_to_xml(null,t),map:this.map}},hash_to_xml:function(t,e,r){var n,a,s,o,i,l,c,u,d,m=e.constructor===Array,h=this,p=[],f=[],g=function(e,n){if(a=n[e],(null===a||void 0===a||"NaN"===a.toString())&&(a=null),o="@"===e.slice(0,1),i=r?t:e,i==+i&&n.constructor!==Object&&(i="d:item"),null===a?(l=null,c=!1):(l=a.constructor,c=l.toString().match(h.rx_function)[1]),o)f.push(i.slice(1)+'="'+h.escape_xml(a)+'"'),"String"!==c&&f.push("d:"+i.slice(1)+'="'+c+'"');else if(null===a)p.push(h.scalar_to_xml(i,a));else switch(l){case Function:throw"JSON data should not contain functions. Please check your structure.";case Object:p.push(h.hash_to_xml(i,a));break;case Array:if(e===i){if(s=a.constructor===Array)for(u=a.length;u--;)null!==a[u]&&a[u]&&a[u].constructor!==Array||(s=!0),s||a[u].constructor!==Object||(s=!0);p.push(h.scalar_to_xml(i,a,s));break}case String:if("string"==typeof a&&(a=a.toString().replace(/\&/g,"&").replace(/\r|\n/g," ")),"#text"===i){h.map.push(n),f.push('d:mi="'+h.map.length+'"'),f.push('d:constr="'+c+'"'),p.push(h.escape_xml(a));break}case Number:case Boolean:if("#text"===i&&"String"!==c){h.map.push(n),f.push('d:mi="'+h.map.length+'"'),f.push('d:constr="'+c+'"'),p.push(h.escape_xml(a));break}p.push(h.scalar_to_xml(i,a))}};if(e.constructor===Array)for(u=0,d=e.length;d>u;u++)g(u.toString(),e);else for(n in e)g(n,e);return t||(t="d:data",f.push(this.namespace),m&&f.push('d:constr="Array"')),null===t.match(this.rx_validate_name)&&(f.push('d:name="'+t+'"'),t="d:name"),r?p.join(""):(this.map.push(e),f.push('d:mi="'+this.map.length+'"'),"<"+t+(f.length?" "+f.join(" "):"")+(p.length?">"+p.join("")+"":"/>"))},scalar_to_xml:function(t,e,r){var n,a,s,o="";if(null===t.match(this.rx_validate_name)&&(o+=' 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.constructor===Array&&!e[0])return"<"+t+' d:constr="null" d:type="ArrayItem"/>';if(1===e.length&&e[0].constructor===Object){n=this.hash_to_xml(!1,e[0]);var i=n.match(this.rx_node),l=n.match(this.rx_constructor);return i=null!==i?i[2].replace(this.rx_namespace,"").replace(/>/,"").replace(/"\/$/,'"'):"",l=null!==l?l[2]:"",n=n.match(this.rx_data),n=null!==n?n[2]:"","<"+t+i+" "+l+' d:type="ArrayItem">'+n+""}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),o+=' d:constr="'+s+'"',this.map.push(e),o+=' d:mi="'+this.map.length+'"',"#text"===t?this.escape_xml(e):"<"+t+o+">"+n+"")},escape_xml:function(t){return String(t).replace(//g,">").replace(/"/g,""").replace(/ /g," ")}};switch(typeof e){case"function":return a=x10.compile(s),void a.to_xml_str(t,function(r){e({doc:Defiant.xmlFromString(r.str),src:t,map:r.map})});case"boolean":return r=s.to_xml_str.call(s,t),{doc:Defiant.xmlFromString(r.str),src:t,map:r.map};default:return r=s.to_xml_str.call(s,t),n=Defiant.xmlFromString(r.str),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,o=s?t.doc:JSON.toXML(t),i=s?t.map:this.search.map,l=s?t.src:t,c=Defiant.node[r?"selectSingleNode":"selectNodes"](o,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"),u.unshift(i[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,o,i,l=window,c=JSON.stringify,u=c(t,null," ").replace(/\t/g,""),d=[],m=0,h=r.length,p=h?r[m].ownerDocument.documentElement:!1,f=(this.search.map,0);h>m;m++){switch(r[m].nodeType){case 2:a=r[m].ownerElement?r[m].ownerElement.getAttribute("d:"+r[m].nodeName):"String",n='"@'+r[m].nodeName+'": '+l[a](e[m]),s=u.indexOf(n),i=0;break;case 3:a=r[m].parentNode.getAttribute("d:constr"),n=l[a](e[m]),n='"'+r[m].parentNode.nodeName+'": '+("Number"===n?n:'"'+n+'"'),s=u.indexOf(n),i=0;break;default:if(r[m]===p)continue;"String"===r[m].getAttribute("d:constr")||"Number"===r[m].getAttribute("d:constr")?(a=r[m].getAttribute("d:constr"),n=l[a](e[m]),s=u.indexOf(n,f),n='"'+r[m].nodeName+'": '+("Number"===a?n:'"'+n+'"'),i=0,f=s+1):(n=c(e[m],null," ").replace(/\t/g,""),s=u.indexOf(n),i=n.match(/\n/g).length)}o=u.substring(0,s).match(/\n/g).length+1,d.push([o,i])}return d}),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,o=n.snapshotLength;o>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 o,i,l=r.trim().replace(/(>)\s*(<)(\/*)/g,"$1\n$2$3"),c=l.split("\n"),u=-1,d=0,m=c.length;m>d;d++)(0!==d||c[d].toLowerCase()!==s)&&(o=null!==c[d].match(/<[A-Za-z_\:]+.*?>/g),i=null!==c[d].match(/<\/[\w\:]+>/g),null!==c[d].match(/<.*?\/>/g)&&(o=i=!0),o&&u++,c[d]=String().fill(u," ")+c[d],o&&i&&u--,!o&&i&&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,o,i,l,c,u,d,m={},h=window;switch(t.nodeType){case 1:for(o=t.getAttribute("d:constr"),"Array"===o?m=[]:"String"===o&&""===t.textContent&&(m=""),e=t.attributes,c=0,u=e.length;u>c;c++)d=e.item(c),null===d.nodeName.match(/\:d|d\:/g)&&(o=t.getAttribute("d:"+d.nodeName),i=o&&"undefined"!==o?"null"===d.nodeValue?null:h[o]("false"===d.nodeValue?"":d.nodeValue):d.nodeValue,m["@"+d.nodeName]=i);break;case 3:n=t.parentNode.getAttribute("d:type"),i=n?h[n]("false"===t.nodeValue?"":t.nodeValue):t.nodeValue,m=i}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)o=t.getAttribute("d:constr"),"undefined"===o&&(o=void 0),l=a.textContent||a.text,i="Boolean"===o&&"false"===l?"":l,o||e.length?o&&1===u?m=h[o](i):t.hasChildNodes()&&e.length<3?m=o?h[o](i):i:m[s]=o?h[o](i):i:m=i;else{if("null"===a.getAttribute("d:constr")){m[s]&&m[s].push?m[s].push(null):"ArrayItem"===a.getAttribute("d:type")?m[s]=[m[s]]:m[s]=null;continue}if(m[s]){m[s].push?m[s].push(r(a)):m[s]=[m[s],r(a)];continue}switch(o=a.getAttribute("d:constr")){case"null":m.push?m.push(null):m[s]=null;break;case"Array":a.parentNode.firstChild===a&&"Array"===o&&"d:item"!==s?"d:item"===s||"Array"===o?(i=r(a),m[s]=i.length?[i]:i):m[s]=r(a):m.push?m.push(r(a)):m[s]=r(a);break;case"String":case"Number":case"Boolean":l=a.textContent||a.text,i="Boolean"===o&&"false"===l?"":l,m.push?m.push(h[o](i)):m[s]=r(a);break;default:m.push?m.push(r(a)):m[s]=r(a)}}return 1===t.nodeType&&"ArrayItem"===t.getAttribute("d:type")&&(m=[m]),m},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 diff --git a/src/js/dependencies/removeDiacritics.js b/src/js/dependencies/removeDiacritics.js deleted file mode 100644 index 74e7ba6..0000000 --- a/src/js/dependencies/removeDiacritics.js +++ /dev/null @@ -1,118 +0,0 @@ -/* - Retrieved from http://stackoverflow.com/a/18391901/3508346 - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ -// "what?" version ... http://jsperf.com/diacritics/12 -export function removeDiacritics(str) { - var defaultDiacriticsRemovalap = [ - {'base':'A', 'letters':'\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F'}, - {'base':'AA','letters':'\uA732'}, - {'base':'AE','letters':'\u00C6\u01FC\u01E2'}, - {'base':'AO','letters':'\uA734'}, - {'base':'AU','letters':'\uA736'}, - {'base':'AV','letters':'\uA738\uA73A'}, - {'base':'AY','letters':'\uA73C'}, - {'base':'B', 'letters':'\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181'}, - {'base':'C', 'letters':'\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E'}, - {'base':'D', 'letters':'\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779'}, - {'base':'DZ','letters':'\u01F1\u01C4'}, - {'base':'Dz','letters':'\u01F2\u01C5'}, - {'base':'E', 'letters':'\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E'}, - {'base':'F', 'letters':'\u0046\u24BB\uFF26\u1E1E\u0191\uA77B'}, - {'base':'G', 'letters':'\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E'}, - {'base':'H', 'letters':'\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D'}, - {'base':'I', 'letters':'\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197'}, - {'base':'J', 'letters':'\u004A\u24BF\uFF2A\u0134\u0248'}, - {'base':'K', 'letters':'\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2'}, - {'base':'L', 'letters':'\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780'}, - {'base':'LJ','letters':'\u01C7'}, - {'base':'Lj','letters':'\u01C8'}, - {'base':'M', 'letters':'\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C'}, - {'base':'N', 'letters':'\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4'}, - {'base':'NJ','letters':'\u01CA'}, - {'base':'Nj','letters':'\u01CB'}, - {'base':'O', 'letters':'\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C'}, - {'base':'OI','letters':'\u01A2'}, - {'base':'OO','letters':'\uA74E'}, - {'base':'OU','letters':'\u0222'}, - {'base':'OE','letters':'\u008C\u0152'}, - {'base':'oe','letters':'\u009C\u0153'}, - {'base':'P', 'letters':'\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754'}, - {'base':'Q', 'letters':'\u0051\u24C6\uFF31\uA756\uA758\u024A'}, - {'base':'R', 'letters':'\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782'}, - {'base':'S', 'letters':'\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784'}, - {'base':'T', 'letters':'\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786'}, - {'base':'TZ','letters':'\uA728'}, - {'base':'U', 'letters':'\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244'}, - {'base':'V', 'letters':'\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245'}, - {'base':'VY','letters':'\uA760'}, - {'base':'W', 'letters':'\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72'}, - {'base':'X', 'letters':'\u0058\u24CD\uFF38\u1E8A\u1E8C'}, - {'base':'Y', 'letters':'\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE'}, - {'base':'Z', 'letters':'\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762'}, - {'base':'a', 'letters':'\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250'}, - {'base':'aa','letters':'\uA733'}, - {'base':'ae','letters':'\u00E6\u01FD\u01E3'}, - {'base':'ao','letters':'\uA735'}, - {'base':'au','letters':'\uA737'}, - {'base':'av','letters':'\uA739\uA73B'}, - {'base':'ay','letters':'\uA73D'}, - {'base':'b', 'letters':'\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253'}, - {'base':'c', 'letters':'\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184'}, - {'base':'d', 'letters':'\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A'}, - {'base':'dz','letters':'\u01F3\u01C6'}, - {'base':'e', 'letters':'\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD'}, - {'base':'f', 'letters':'\u0066\u24D5\uFF46\u1E1F\u0192\uA77C'}, - {'base':'g', 'letters':'\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F'}, - {'base':'h', 'letters':'\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265'}, - {'base':'hv','letters':'\u0195'}, - {'base':'i', 'letters':'\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131'}, - {'base':'j', 'letters':'\u006A\u24D9\uFF4A\u0135\u01F0\u0249'}, - {'base':'k', 'letters':'\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3'}, - {'base':'l', 'letters':'\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747'}, - {'base':'lj','letters':'\u01C9'}, - {'base':'m', 'letters':'\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F'}, - {'base':'n', 'letters':'\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5'}, - {'base':'nj','letters':'\u01CC'}, - {'base':'o', 'letters':'\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275'}, - {'base':'oi','letters':'\u01A3'}, - {'base':'ou','letters':'\u0223'}, - {'base':'oo','letters':'\uA74F'}, - {'base':'p','letters':'\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755'}, - {'base':'q','letters':'\u0071\u24E0\uFF51\u024B\uA757\uA759'}, - {'base':'r','letters':'\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783'}, - {'base':'s','letters':'\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B'}, - {'base':'t','letters':'\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787'}, - {'base':'tz','letters':'\uA729'}, - {'base':'u','letters': '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289'}, - {'base':'v','letters':'\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C'}, - {'base':'vy','letters':'\uA761'}, - {'base':'w','letters':'\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73'}, - {'base':'x','letters':'\u0078\u24E7\uFF58\u1E8B\u1E8D'}, - {'base':'y','letters':'\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF'}, - {'base':'z','letters':'\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763'} - ]; - - var diacriticsMap = {}; - for (var i=0; i < defaultDiacriticsRemovalap.length; i++){ - var letters = defaultDiacriticsRemovalap[i].letters; - for (var j=0; j < letters.length ; j++){ - diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base; - } - } - - return str.replace(/[^\u0000-\u007E]/g, function(a){ - return diacriticsMap[a] || a; - }); -} \ No newline at end of file diff --git a/src/js/helpers.js b/src/js/helpers.js deleted file mode 100644 index 79d48de..0000000 --- a/src/js/helpers.js +++ /dev/null @@ -1,258 +0,0 @@ -import {removeDiacritics} from './dependencies/removeDiacritics'; - -// function ready(fn) { -// if (document.readyState != 'loading'){ -// fn(); -// } else { -// document.addEventListener('DOMContentLoaded', fn); -// } -// } - -// Set Marked.js settings -// marked.setOptions({ -// gfm: true, -// tables: true, -// breaks: true, -// sanitize: true -// }); - -// Get Keycode based on key name -export function keyCodeFor(keyName) { - if (keyName == "backspace") return 8; - else if (keyName == "tab") return 9; - else if (keyName == "ctrlEnter") return 10; - else if (keyName == "enter") return 13; - else if (keyName == "shift") return 16; - else if (keyName == "ctrl") return 17; - else if (keyName == "alt") return 18; - else if (keyName == "pausebreak") return 19; - else if (keyName == "capslock") return 20; - else if (keyName == "escape") return 27; - else if (keyName == "space") return 32; - else if (keyName == "pageup") return 33; - else if (keyName == "pagedown") return 34; - else if (keyName == "end") return 35; - else if (keyName == "home") return 36; - else if (keyName == "left") return 37; - else if (keyName == "up") return 38; - else if (keyName == "right") return 39; - else if (keyName == "down") return 40; - else if (keyName == "insert") return 45; - else if (keyName == "del") return 46; - else if (keyName == "zero") return 48; - else if (keyName == "one") return 49; - else if (keyName == "two") return 50; - else if (keyName == "three") return 51; - else if (keyName == "four") return 52; - else if (keyName == "five") return 53; - else if (keyName == "six") return 54; - else if (keyName == "seven") return 55; - else if (keyName == "eight") return 56; - else if (keyName == "nine") return 57; - else if (keyName == "a") return 65; - else if (keyName == "b") return 66; - else if (keyName == "c") return 67; - else if (keyName == "d") return 68; - else if (keyName == "e") return 69; - else if (keyName == "f") return 70; - else if (keyName == "g") return 71; - else if (keyName == "h") return 72; - else if (keyName == "i") return 73; - else if (keyName == "j") return 74; - else if (keyName == "k") return 75; - else if (keyName == "l") return 76; - else if (keyName == "m") return 77; - else if (keyName == "n") return 78; - else if (keyName == "o") return 79; - else if (keyName == "p") return 80; - else if (keyName == "q") return 81; - else if (keyName == "r") return 82; - else if (keyName == "s") return 83; - else if (keyName == "t") return 84; - else if (keyName == "u") return 85; - else if (keyName == "v") return 86; - else if (keyName == "w") return 87; - else if (keyName == "x") return 88; - else if (keyName == "y") return 89; - else if (keyName == "z") return 90; - else if (keyName == "leftwinkey") return 91; - else if (keyName == "rightwinkey") return 92; - else if (keyName == "selectkey") return 93; - else if (keyName == "numpad_0") return 96; - else if (keyName == "numpad_1") return 97; - else if (keyName == "numpad_2") return 98; - else if (keyName == "numpad_3") return 99; - else if (keyName == "numpad_4") return 100; - else if (keyName == "numpad_5") return 101; - else if (keyName == "numpad_6") return 102; - else if (keyName == "numpad_7") return 103; - else if (keyName == "numpad_8") return 104; - else if (keyName == "numpad_9") return 105; - else if (keyName == "numpad_asterisk") return 106; - else if (keyName == "numpad_plus") return 107; - else if (keyName == "numpad_dash") return 109; - else if (keyName == "numpad_period") return 110; - else if (keyName == "numpad_slash") return 111; - else if (keyName == "f1") return 112; - else if (keyName == "f2") return 113; - else if (keyName == "f3") return 114; - else if (keyName == "f4") return 115; - else if (keyName == "f5") return 116; - else if (keyName == "f6") return 117; - else if (keyName == "f7") return 118; - else if (keyName == "f8") return 119; - else if (keyName == "f9") return 120; - else if (keyName == "f10") return 121; - else if (keyName == "f11") return 122; - else if (keyName == "f12") return 123; - else if (keyName == "numlock") return 144; - else if (keyName == "scrolllock") return 145; - else if (keyName == "semicolon") return 186; - else if (keyName == "equal") return 187; - else if (keyName == "comma") return 188; - else if (keyName == "dash") return 189; - else if (keyName == "period") return 190; - else if (keyName == "slash") return 191; - else if (keyName == "grave") return 192; - else if (keyName == "openbracket") return 219; - else if (keyName == "backslash") return 220; - else if (keyName == "closebraket") return 221; - else if (keyName == "quote") return 222; - else return false; -} - -export function getInputSelection(el) { -// Retrieved from http://stackoverflow.com/a/4207763 - var start = 0, end = 0, normalizedValue, range, - textInputRange, len, endRange; - el.focus(); - if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { - start = el.selectionStart; - end = el.selectionEnd; - } else { - range = document.selection.createRange(); - - if (range && range.parentElement() == el) { - len = el.value.length; - normalizedValue = el.value.replace(/\r\n/g, "\n"); - - // Create a working TextRange that lives only in the input - textInputRange = el.createTextRange(); - textInputRange.moveToBookmark(range.getBookmark()); - - // Check if the start and end of the selection are at the very end - // of the input, since moveStart/moveEnd doesn't return what we want - // in those cases - endRange = el.createTextRange(); - endRange.collapse(false); - - if (textInputRange.compareEndPoints("StartToEnd", endRange) > -1) { - start = end = len; - } else { - start = -textInputRange.moveStart("character", -len); - start += normalizedValue.slice(0, start).split("\n").length - 1; - - if (textInputRange.compareEndPoints("EndToEnd", endRange) > -1) { - end = len; - } else { - end = -textInputRange.moveEnd("character", -len); - end += normalizedValue.slice(0, end).split("\n").length - 1; - } - } - } - } - - return { - start: start, - end: end - }; -} - -export function setSelectionRange(input, selectionStart, selectionEnd) { -// Retrieved from http://stackoverflow.com/a/17858641/3508346 - if (input.setSelectionRange) { - input.focus(); - input.setSelectionRange(selectionStart, selectionEnd); - } - else if (input.createTextRange) { - var range = input.createTextRange(); - range.collapse(true); - range.moveEnd('character', selectionEnd); - range.moveStart('character', selectionStart); - range.select(); - } -} - -export function SaveScroll() { - var doc = document.documentElement; - var left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0); - var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - - savedScroll.x = left; - savedScroll.y = top; -} - -export function htmlEntities(string) { - return String(string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\\/g, '\').replace(/\n/g, '
    '); -} - -export function htmlEntitiesParse(string) { - return String(string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'").replace(/\/g, '\\').replace(/
    /g, '\n'); -} - -export function htmlEntitiesParseForMarkdown(string) { - return String(string).replace(/"/g, '"').replace(/'/g, "'").replace(/\/g, '\\').replace(/
    /g, '\n'); -} - -export function stripHtmlEntities(string) { - // This is for the export name. - return String(string).replace(/&/g, '').replace(/</g, '').replace(/>/g, '').replace(/"/g, '').replace(/'/g, "").replace(/\/g, '').replace(/
    /g, ''); -} - -export function htmlEntitiesParseForSearchEntry(string) { - return String(string).replace(/"/g, '%%%%').replace(/'/g, "````"); -} - -export function htmlEntitiesParseForSearch(string) { - return String(string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '%%%%').replace(/'/g, "````"); -} - -export function regexParseForSearch(string) { - return String(string).replace(/([\[\\\^\$\.\|\?\*\+\(\)\{\}\]])/g, "\\$1"); -} - -export function dynamicSort(propertiesArray) { - /* Retrieved from http://stackoverflow.com/a/30446887/3508346 - Usage: theArray.sort(dynamicSort(['propertyAscending', '-propertyDescending']));*/ - return function (a, b) { - return propertiesArray - .map(function (o) { - var dir = 1; - if (o[0] === '-') { - dir = -1; - o=o.substring(1); - } - if (removeDiacritics(a[o]).toLowerCase() > removeDiacritics(b[o]).toLowerCase()) return dir; - if (removeDiacritics(a[o]).toLowerCase() < removeDiacritics(b[o]).toLowerCase()) return -(dir); - return 0; - }) - .reduce(function firstNonZeroValue (p,n) { - return p ? p : n; - }, 0); - }; -} - -export function download(filename, text) { - /* Retrieved from http://stackoverflow.com/a/18197341/3508346 - Usage: download('test.txt', 'Hello world!');*/ - var element = document.createElement('a'); - element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); - element.setAttribute('download', filename); - - element.style.display = 'none'; - document.body.appendChild(element); - - element.click(); - - document.body.removeChild(element); -} \ No newline at end of file diff --git a/src/js/publicView.js b/src/js/publicView.js deleted file mode 100644 index 2fa68d3..0000000 --- a/src/js/publicView.js +++ /dev/null @@ -1,194 +0,0 @@ -function IsValidPublicDicitonary() { - return typeof publicDictionary !== 'string'; -} - -function ShowPublicDictionary(ignoreFilters) { - ignoreFilters = (typeof ignoreFilters !== 'undefined') ? ignoreFilters : false; - - if (IsValidPublicDicitonary()) { - var filters = (ignoreFilters) ? [] : GetSelectedFilters(); - - var searchResults = []; - var search = (ignoreFilters) ? "" : htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var searchByWord = (ignoreFilters) ? null : document.getElementById("searchOptionWord").checked; - var searchBySimple = (ignoreFilters) ? null : document.getElementById("searchOptionSimple").checked; - var searchByLong = (ignoreFilters) ? null : document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = (ignoreFilters) ? null : !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = (ignoreFilters) ? null : document.getElementById("searchIgnoreDiacritics").checked; - if (!ignoreFilters && search != "" && (searchByWord || searchBySimple || searchByLong)) { - var xpath = []; - var searchDictionaryJSON = htmlEntitiesParseForSearch(JSON.stringify(publicDictionary)); - if (searchIgnoreCase) { - search = search.toLowerCase(); - //searchDictionaryJSON = searchDictionaryJSON.toLowerCase(); - } - if (searchIgnoreDiacritics) { - search = removeDiacritics(search); - searchDictionaryJSON = removeDiacritics(searchDictionaryJSON); - } - if (searchByWord) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'name' : 'translate(name, "", "")') +', "'+ search +'")'); - } - if (searchBySimple) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'simpleDefinition' : 'translate(simpleDefinition, "", "")') +', "'+ search +'")'); - } - if (searchByLong) { - xpath.push('contains('+ ((searchIgnoreCase) ? 'longDefinition' : 'translate(longDefinition, "", "")') +', "'+ search +'")'); - } - var searchDictionary = JSON.parse(searchDictionaryJSON); - searchResults = JSON.search(searchDictionary, '//words['+ xpath.join(' or ') +']/wordId'); - } - - var dictionaryNameArea = document.getElementById("dictionaryName"); - dictionaryNameArea.innerHTML = publicDictionary.name + " Dictionary"; - - var dictionaryByArea = document.getElementById("dictionaryBy"); - dictionaryByArea.innerHTML = "created by " + publicDictionary.createdBy; - - var dictionaryIncompleteArea = document.getElementById("incompleteNotice"); - if (!publicDictionary.settings.isComplete) { - dictionaryIncompleteArea.innerHTML = "Note: This dictionary is not yet complete and is likely to change."; - } - - var dictionaryDescriptionArea = document.getElementById("dictionaryDescription"); - dictionaryDescriptionArea.innerHTML = marked(htmlEntitiesParseForMarkdown(publicDictionary.description)); - - var dictionaryArea = document.getElementById("theDictionary"); - var dictionaryText = ""; - var numberOfWordsDisplayed = 0; - - if (publicDictionary.words.length > 0) { - for (var i = 0; i < publicDictionary.words.length; i++) { - if (filters.length == 0 || (filters.length > 0 && filters.indexOf(publicDictionary.words[i].partOfSpeech) > -1)) { - if (search == "" || (search != "" && (searchByWord || searchBySimple || searchByLong) && searchResults.indexOf(publicDictionary.words[i].wordId) >= 0)) { - if (!publicDictionary.words[i].hasOwnProperty("pronunciation")) { - publicDictionary.words[i].pronunciation = ""; //Account for new property - } - if (!publicDictionary.words[i].hasOwnProperty("wordId")) { - publicDictionary.words[i].wordId = i + 1; //Account for new property - } - dictionaryText += PublicDictionaryEntry(i, ignoreFilters); - numberOfWordsDisplayed++; - } - } - } - } else { - dictionaryText = "There are no entries in the dictionary." - } - dictionaryArea.innerHTML = dictionaryText; - if (!ignoreFilters) { - ShowFilterWordCount(numberOfWordsDisplayed); - } - } else { - document.getElementById("dictionaryContent").innerHTML = publicDictionary; - } -} - -function PublicDictionaryEntry(itemIndex, ignoreFilters) { - var searchTerm = (ignoreFilters) ? "" : regexParseForSearch(document.getElementById("searchBox").value); - var searchByWord = (ignoreFilters) ? false : document.getElementById("searchOptionWord").checked; - var searchBySimple = (ignoreFilters) ? false : document.getElementById("searchOptionSimple").checked; - var searchByLong = (ignoreFilters) ? false : document.getElementById("searchOptionLong").checked; - var searchIgnoreCase = (ignoreFilters) ? false : !document.getElementById("searchCaseSensitive").checked; //It's easier to negate case here instead of negating it every use since ignore case is default. - var searchIgnoreDiacritics = (ignoreFilters) ? false : document.getElementById("searchIgnoreDiacritics").checked; - - var searchRegEx = new RegExp("(" + ((searchIgnoreDiacritics) ? removeDiacritics(searchTerm) + "|" + searchTerm : searchTerm) + ")", "g" + ((searchIgnoreCase) ? "i" : "")); - - var wordName = wordPronunciation = wordPartOfSpeech = wordSimpleDefinition = wordLongDefinition = ""; - - if (searchTerm != "" && searchByWord) { - wordName += htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].name).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordName += publicDictionary.words[itemIndex].name.toString(); // Use toString() to prevent using a reference instead of the value. - } - - if (publicDictionary.words[itemIndex].pronunciation != "") { - wordPronunciation += marked(htmlEntitiesParseForMarkdown(publicDictionary.words[itemIndex].pronunciation)).replace(/<\/?p>/g,""); - } - - if (publicDictionary.words[itemIndex].partOfSpeech != " " && publicDictionary.words[itemIndex].partOfSpeech != "") { - wordPartOfSpeech += publicDictionary.words[itemIndex].partOfSpeech.toString(); - } - - if (publicDictionary.words[itemIndex].simpleDefinition != "") { - if (searchTerm != "" && searchBySimple) { - wordSimpleDefinition += htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].simpleDefinition).replace(searchRegEx, "$1")).replace(/<(\/?)searchterm>/g, '<$1searchterm>'); - } else { - wordSimpleDefinition += publicDictionary.words[itemIndex].simpleDefinition.toString(); - } - } - - if (publicDictionary.words[itemIndex].longDefinition != "") { - if (searchTerm != "" && searchByLong) { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(htmlEntities(htmlEntitiesParse(publicDictionary.words[itemIndex].longDefinition).replace(searchRegEx, "$1")))).replace(/<(\/?)searchterm>\;/g, '<$1searchterm>'); - } else { - wordLongDefinition += marked(htmlEntitiesParseForMarkdown(publicDictionary.words[itemIndex].longDefinition)); - } - } - - return PublicDictionaryEntryTemplate({ - name : wordName, - pronunciation : wordPronunciation, - partOfSpeech : wordPartOfSpeech, - simpleDefinition : wordSimpleDefinition, - longDefinition : wordLongDefinition, - wordId : publicDictionary.words[itemIndex].wordId.toString() - }, false); -} - -function PublicDictionaryEntryTemplate(wordObject, managementIndex) { - managementIndex = (typeof managementIndex !== 'undefined') ? managementIndex : false; - var entryText = "➦"; - - entryText += "" + wordObject.name + ""; - - if (wordObject.pronunciation != "") { - entryText += "" + wordObject.pronunciation + ""; - } - - if (wordObject.partOfSpeech != "") { - entryText += "" + wordObject.partOfSpeech + ""; - } - - entryText += "
    "; - - if (wordObject.simpleDefinition != "") { - entryText += "" + wordObject.simpleDefinition + ""; - } - - if (wordObject.longDefinition != "") { - entryText += "" + wordObject.longDefinition + ""; - } - - if (managementIndex !== false) { - entryText += ManagementArea(managementIndex); - } - - entryText += "
    "; - - return entryText; -} - -function SetPublicPartsOfSpeech () { - var wordFilterOptions = document.getElementById("filterOptions"); - - var newPartsOfSpeech = htmlEntitiesParse(publicDictionary.settings.partsOfSpeech).trim().split(","); - for (var j = 0; j < newPartsOfSpeech.length; j++) { - var thePartOfSpeech = newPartsOfSpeech[j].trim(); - - var wordFilterLabel = document.createElement('label'); - wordFilterLabel.appendChild(document.createTextNode(thePartOfSpeech + " ")); - wordFilterLabel['part-of-speech'] = thePartOfSpeech; - wordFilterLabel.className = 'filterOption'; - var wordFilterCheckbox = document.createElement('input'); - wordFilterCheckbox.type = 'checkbox'; - wordFilterCheckbox.onchange = function(){ShowPublicDictionary()}; - wordFilterLabel.appendChild(wordFilterCheckbox); - wordFilterOptions.appendChild(wordFilterLabel); - } -} \ No newline at end of file diff --git a/src/js/ui.js b/src/js/ui.js deleted file mode 100644 index a16ace0..0000000 --- a/src/js/ui.js +++ /dev/null @@ -1,714 +0,0 @@ -function Initialize() { - LoadDictionary(); - ClearForm(); - LoadUserDictionaries(); - - GetTextFile("/README.md", "aboutText", true); - GetTextFile("/TERMS.md", "termsText", true); - GetTextFile("/PRIVACY.md", "privacyText", true); - GetTextFile("/LOGIN.form", "loginForm", false); - GetTextFile("/FORGOT.form", "forgotForm", false); - GetTextFile("/EXPORT.form", "exportForm", false); - GetTextFile("/IMPORT.form", "importForm", false); - - SetKeyboardShortcuts(); - SetWindowListeners(); -} - -function SetKeyboardShortcuts() { - document.addEventListener("keydown", function(e) { - var keyCode = (e.which ? e.which : e.keyCode); - - if (keyCode == keyCodeFor("escape")) { - if (document.getElementById("infoScreen").style.display == "block") { - HideInfo(); - } - else if (document.getElementById("fullScreenTextboxScreen").style.display == "block") { - HideFullScreenTextbox(); - } - else if (document.getElementById("settingsScreen").style.display == "block") { - HideSettings(); - } - else if (document.getElementById("accountSettingsScreen") && document.getElementById("accountSettingsScreen").style.display == "block") { - HideAccountSettings(); - } - } - else if (e.ctrlKey) { - // Only allow shortcuts if not currently using fullscreen textbox - if (document.getElementById("fullScreenTextboxScreen").style.display == "none") { - if (keyCode == keyCodeFor("m")) { - if (document.activeElement.id.indexOf("longDefinition") >= 0) { - e.preventDefault(); - ShowFullScreenTextbox(document.activeElement.id, 'Explanation/Long Definition'); - } - else if (document.activeElement.id == "dictionaryDescriptionEdit") { - e.preventDefault(); - ShowFullScreenTextbox('dictionaryDescriptionEdit', 'Dictionary Details'); - } - else if (document.activeElement.id == "fullScreenTextbox") { - e.preventDefault(); - HideFullScreenTextbox(); - } - } - else if (keyCode == keyCodeFor("u")) { - e.preventDefault(); - ToggleWordFormLock(); - } - else if (keyCode == keyCodeFor("d")) { - e.preventDefault(); - ToggleDescription(); - } - else if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - //ToggleSearchFilter(); - var searchFilterToggle = document.getElementById("searchFilterToggle"); - var searchFilterArea = document.getElementById("searchFilterArea"); - - if (searchFilterArea.style.display == "none") { - searchFilterArea.style.display = "block"; - searchFilterToggle.innerHTML = "Hide Search/Filter Options"; - } - document.getElementById("searchBox").focus(); - } - else if (keyCode == keyCodeFor("h")) { - e.preventDefault(); - ShowInfo('aboutText'); - } - } - else { //If the fullscreen editor *is* open, just prevent the others for consistent behavior. - if (keyCode == keyCodeFor("m")) { - e.preventDefault(); - HideFullScreenTextbox(); - } - else if (keyCode == keyCodeFor("u")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("d")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - } - else if (keyCode == keyCodeFor("h")) { - e.preventDefault(); - } - } - } - else if (e.altKey) { - // Only toggle screens if not currently using fullscreen textbox - if (document.getElementById("fullScreenTextboxScreen").style.display == "none") { - if (keyCode == keyCodeFor("s")) { - e.preventDefault(); - ToggleSettingsScreen(true); - } - else if (keyCode == keyCodeFor("a")) { - e.preventDefault(); - ToggleAccountSettings(); - } - } - } - }, false); -} - -function SetWindowListeners() { - window.addEventListener("scroll", function() { - var doc = document.documentElement; - var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - var dictionaryColumn = document.getElementById("dictionaryColumn"); - var wordPullout = document.getElementById("mobileWordFormPullout"); - - if (top > dictionaryColumn.offsetTop) { - wordPullout.style.display = "block"; - } else { - wordPullout.style.display = "none"; - if (wordPullout.innerHTML != "+") { - LockWordForm(); - wordPullout.innerHTML = "+"; - } - } - }); -} - -function SubmitWordOnCtrlEnter(keypress) { - var keyCode = (event.which ? event.which : event.keyCode); - - if (keyCode === keyCodeFor("ctrlEnter") || (keyCode == keyCodeFor("enter") && event.ctrlKey)) { //Windows and Linux Chrome accept ctrl+enter as keyCode 10. - event.preventDefault(); - - if (/\d/.test(document.activeElement.id)) { // If there IS a number in the ID, then it is a word being edited. - EditWord(document.activeElement.id.match(/\d+/)[0]); // .match(/\d+/) returns an array of digits in a string. - } else { // Otherwise, it's a new word. - AddWord(); - } - } -} - -function LoadUserDictionaries() { - var getDictionariesRequest = new XMLHttpRequest(); - var userDictionariesSelect = document.getElementById("userDictionaries"); - if (userDictionariesSelect != null) { - getDictionariesRequest.open('GET', "/php/ajax_dictionarymanagement.php?action=getall"); - getDictionariesRequest.onreadystatechange = function() { - if (getDictionariesRequest.readyState == 4 && getDictionariesRequest.status == 200) { - ParseUserDictionariesIntoSelect(userDictionariesSelect, getDictionariesRequest.responseText); - } - } - getDictionariesRequest.send(); - } -} - -function ParseUserDictionariesIntoSelect(selectToPopulate, dicitonaryList) { - if (selectToPopulate.options.length > 0) { - for (var i = selectToPopulate.options.length - 1; i >= 0; i--) { - selectToPopulate.removeChild(selectToPopulate.options[i]); - } - } - - var dictionaries = dicitonaryList.split("_DICTIONARYSEPARATOR_"); - for (var j = 0; j < dictionaries.length - 1; j++) { - var dictionaryOption = document.createElement('option'); - var dictionaryValues = dictionaries[j].split("_IDNAMESEPARATOR_"); - dictionaryOption.appendChild(document.createTextNode(htmlEntitiesParse(dictionaryValues[1]))); - dictionaryOption.value = dictionaryValues[0]; - selectToPopulate.appendChild(dictionaryOption); - } - selectToPopulate.value = (currentDictionary.externalID > 0) ? currentDictionary.externalID : ""; -} - -function GetTextFile(filename, variableName, parseMarkdown) { - parseMarkdown = (typeof parseMarkdown !== 'undefined') ? parseMarkdown : false; - var readmeFileRequest = new XMLHttpRequest(); - readmeFileRequest.open('GET', filename); - readmeFileRequest.onreadystatechange = function() { - if (readmeFileRequest.readyState == 4 && readmeFileRequest.status == 200) { - window[variableName] = (parseMarkdown) ? marked(readmeFileRequest.responseText, {sanitize: false}) : readmeFileRequest.responseText; - } - } - readmeFileRequest.send(); -} - -function ValidateLogin() { - var errorMessage = document.getElementById("loginError"); - var emailValue = document.getElementById("loginEmailField").value; - var passwordValue = document.getElementById("loginPasswordField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else { - document.getElementById("loginForm").submit(); - } -} - -function ValidateCreateAccount() { - var errorMessage = document.getElementById("createAccountError"); - var emailValue = document.getElementById("createAccountEmailField").value; - var passwordValue = document.getElementById("createAccountPasswordField").value; - var passwordConfirmValue = document.getElementById("createAccountPasswordConfirmField").value; - var publicNameValue = document.getElementById("createAccountPublicNameField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else if (passwordValue != passwordConfirmValue) { - errorMessage.innerHTML = "Passwords do not match!"; - return false; - } else if (publicNameValue == "") { - errorMessage.innerHTML = "Public Name cannot be blank!"; - return false; - } else { - var emailCheck = new XMLHttpRequest(); - emailCheck.open('GET', "/php/ajax_createaccountemailcheck.php?email=" + emailValue); - emailCheck.onreadystatechange = function() { - if (emailCheck.readyState == 4 && emailCheck.status == 200) { - if (emailCheck.responseText != "ok") { - errorMessage.innerHTML = "The email address entered is already being used. Try logging in or using a different email address instead."; - return false; - } else { - document.getElementById("createAccountForm").submit(); - } - } - } - emailCheck.send(); - } -} - -function ValidateAccountSettings() { - var errorMessage = document.getElementById("accountSettingsError"); - var emailValue = document.getElementById("accountSettingsEmailField").value; - var publicNameValue = document.getElementById("accountSettingsPublicNameField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else if (publicNameValue == "") { - errorMessage.innerHTML = "Public Name cannot be blank!"; - return false; - } else { - document.getElementById("createAccountForm").submit(); - } -} - -function ValidateForgotPassword() { - var errorMessage = document.getElementById("forgotError"); - var emailValue = document.getElementById("forgotEmailField").value; - - if (emailValue == "") { - errorMessage.innerHTML = "Email cannot be blank!"; - return false; - } else if (!(/[^\s@]+@[^\s@]+\.[^\s@]+/.test(emailValue))) { - errorMessage.innerHTML = "Your email address looks fake. Email addresses look like this: name@email.com." - return false; - } else { - var emailCheck = new XMLHttpRequest(); - emailCheck.open('GET', "/php/ajax_passwordresetemailcheck.php?email=" + emailValue); - emailCheck.onreadystatechange = function() { - if (emailCheck.readyState == 4 && emailCheck.status == 200) { - if (emailCheck.responseText != "email exists") { - errorMessage.innerHTML = "The email address entered is not in use and therefore can't have its password reset. Try creating an account instead!"; - return false; - } else { - document.getElementById("forgotForm").submit(); - } - } - } - emailCheck.send(); - } -} - -function ValidateResetPassword() { - var errorMessage = document.getElementById("resetPasswordError"); - var passwordValue = document.getElementById("newPasswordField").value; - var passwordConfirmValue = document.getElementById("newPasswordConfirmField").value; - - if (passwordValue == "") { - errorMessage.innerHTML = "Password cannot be blank!"; - return false; - } else if (passwordValue != passwordConfirmValue) { - errorMessage.innerHTML = "Passwords do not match!"; - return false; - } else { - document.getElementById("resetPasswordForm").submit(); - } -} - -function WarnEmailChange() { - var emailChangeWarning = document.getElementById("accountSettingsEmailChangeWarning"); - var emailValue = document.getElementById("accountSettingsEmailField").value; - var originalEmailValue = document.getElementById("accountSettingsPreviousEmailField").value; - - if (emailValue != originalEmailValue) { - emailChangeWarning.style.display = "block"; - } else { - emailChangeWarning.style.display = "none"; - } -} - -function LoggedInResetPassword() { - var resetPasswordRequest = new XMLHttpRequest(); - resetPasswordRequest.open('GET', "/php/ajax_setnewpassword.php"); - resetPasswordRequest.onreadystatechange = function() { - if (resetPasswordRequest.readyState == 4 && resetPasswordRequest.status == 200) { - if (resetPasswordRequest.responseText != "done") { - console.log(resetPasswordRequest.responseText); - alert("Error resetting password.\n\nTry again later."); - return false; - } else { - window.location = "./"; - } - } - } - resetPasswordRequest.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 == "\uD83D\uDD12"; -} - -function MobileToggleWordForm() { - var pullout = document.getElementById("mobileWordFormPullout"); - ToggleWordFormLock("7%"); - if (pullout.innerHTML == "+") { - pullout.innerHTML = "✕"; - } else { - pullout.innerHTML = "+"; - } -} - -function ToggleWordFormLock(topValue) { - if (wordFormIsLocked()) { //If it is already locked, change it to Unlocked and get everything working as it needs to. - UnlockWordForm(topValue); - } else { - LockWordForm(); - } -} - -function UnlockWordForm(topValue) { - var lockButton = document.getElementById("formLockButton"); - var leftColumn = document.getElementById("leftColumn"); - var wordForm = document.getElementById("wordEntryForm"); - var wordFormWidth = wordForm.offsetWidth; - var leftColumnWidth = leftColumn.offsetWidth; - var leftColumnHeight = leftColumn.offsetHeight; - - lockButton.innerHTML = "🔓"; // Change to the "Unlocked lock" icon. - - wordForm.style.position = "fixed"; - wordForm.style.top = (typeof topValue !== 'undefined') ? topValue : document.getElementById("dictionaryColumn").offsetTop.toString() + "px"; - wordForm.style.width = wordFormWidth.toString() + "px"; - - leftColumn.style.width = leftColumnWidth.toString() + "px"; - leftColumn.style.height = leftColumnHeight.toString() + "px"; -} - -function LockWordForm() { - var lockButton = document.getElementById("formLockButton"); - var leftColumn = document.getElementById("leftColumn"); - var wordForm = document.getElementById("wordEntryForm"); - - lockButton.innerHTML = "🔒"; // Change to the "locked" icon. - leftColumn.removeAttribute('style'); - wordForm.removeAttribute('style'); -} - -function CloseUpdateConflictArea(wordIndexString) {// displayId, hideId) { - // displayId = (typeof displayId !== 'undefined' && displayId != null) ? displayId : false; - // if (displayId != false) { - if (wordIndexString == "") { - document.getElementById("newWordButtonArea").style.display = "block"; - } else { - document.getElementById("editWordButtonArea" + wordIndexString).style.display = "block"; - } - // } - document.getElementById("updateConflict" + wordIndexString).style.display = "none"; - EnableForm(wordIndexString); -} - -function DisableForm(wordIndexString) { - document.getElementById("word" + wordIndexString).disabled = true; - document.getElementById("pronunciation" + wordIndexString).disabled = true; - document.getElementById("partOfSpeech" + wordIndexString).disabled = true; - document.getElementById("simpleDefinition" + wordIndexString).disabled = true; - document.getElementById("longDefinition" + wordIndexString).disabled = true; -} - -function EnableForm(wordIndexString) { - document.getElementById("word" + wordIndexString).disabled = false; - document.getElementById("pronunciation" + wordIndexString).disabled = false; - document.getElementById("partOfSpeech" + wordIndexString).disabled = false; - document.getElementById("simpleDefinition" + wordIndexString).disabled = false; - document.getElementById("longDefinition" + wordIndexString).disabled = false; - // document.getElementById("editIndex").disabled = false; -} - -function ClearForm() { - if (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 descriptionToggle = document.getElementById("descriptionToggle"); - var descriptionArea = document.getElementById("dictionaryDescription"); - - if (descriptionArea.style.display == "none") { - descriptionArea.style.display = "block"; - descriptionToggle.innerHTML = "Hide Description"; - } else { - descriptionArea.style.display = "none"; - descriptionToggle.innerHTML = "Show Description"; - } -} - -function ToggleSearchFilter() { - var searchFilterToggle = document.getElementById("searchFilterToggle"); - var searchFilterArea = document.getElementById("searchFilterArea"); - - if (searchFilterArea.style.display == "none") { - searchFilterArea.style.display = "block"; - searchFilterToggle.innerHTML = "Hide Search/Filter Options"; - } else { - searchFilterArea.style.display = "none"; - searchFilterToggle.innerHTML = "Search/Filter Options"; - } -} - -function ShowInfo(variableName) { - ShowInfoWithText(window[variableName]); - if (variableName == "loginForm") { - // document.getElementById("infoText").innerHTML = loginForm; - if (currentDictionary.words.length > 0 || currentDictionary.name != "New" || currentDictionary.description != "A new dictionary.") { - 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!"; - } - } -} - -function ShowInfoWithText(text) { - document.getElementById("infoText").innerHTML = text; - document.getElementById("infoScreen").style.display = "block"; - document.getElementById("infoPage").scrollTop = 0; - HideAccountSettings(); -} - -function HideInfo() { - document.getElementById("infoScreen").style.display = "none"; -} - -function ToggleAccountSettings() { - if (document.getElementById("accountSettingsScreen")) { - var accountScreen = document.getElementById("accountSettingsScreen"); - - if (accountScreen.style.display == "block") { - HideAccountSettings(); - } else { - ShowAccountSettings(); - } - } -} - -function ShowAccountSettings(variableName) { - if (document.getElementById("accountSettingsScreen")) - document.getElementById("accountSettingsScreen").style.display = "block"; - - HideInfo(); -} - -function HideAccountSettings() { - if (document.getElementById("accountSettingsScreen")) - document.getElementById("accountSettingsScreen").style.display = "none"; -} - -function ToggleSettingsScreen(doSave) { - var settingsScreen = document.getElementById("settingsScreen"); - - if (settingsScreen.style.display == "block") { - if (doSave) { - SaveSettings(); - } - HideSettings(); - } else { - 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; - if (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"; - if (currentDictionary.settings.isComplete) { - LockWordForm(); - document.getElementById("wordEntryForm").style.display = "none"; - } else { - document.getElementById("wordEntryForm").style.display = "block"; - } - -} - -function HideSettingsWhenComplete() { - if (document.getElementById("settingsScreen")) { - if (currentDictionary.settings.isComplete) { - document.getElementById("hideIfComplete").style.display = "none"; - } else { - document.getElementById("hideIfComplete").style.display = "block"; - } - } -} - -function ShowFullScreenTextbox(textboxToExpandId, labelText) { - var sourceTextboxElement = document.getElementById(textboxToExpandId); - var targetTextboxElement = document.getElementById("fullScreenTextbox"); - document.getElementById("fullScreenTextboxLabel").innerHTML = labelText; - var selection = getInputSelection(sourceTextboxElement); - - document.getElementById("expandedTextboxId").innerHTML = textboxToExpandId; - targetTextboxElement.value = sourceTextboxElement.value; - document.getElementById("fullScreenTextboxScreen").style.display = "block"; - - setSelectionRange(targetTextboxElement, selection.start, selection.end); -} - -function HideFullScreenTextbox() { - var expandedTextboxId = document.getElementById("expandedTextboxId").innerHTML; - var sourceTextboxElement = document.getElementById("fullScreenTextbox"); - var targetTextboxElement = document.getElementById(expandedTextboxId); - var selection = getInputSelection(sourceTextboxElement); - - targetTextboxElement.value = sourceTextboxElement.value; - document.getElementById("fullScreenTextboxScreen").style.display = "none"; - - setSelectionRange(targetTextboxElement, selection.start, selection.end); -} - -function ShowDictionaryDeleteMenu(dictionaryList) { - document.getElementById('loadAfterDeleteScreen').style.display = 'block'; - //Parse response into the list that forces you to load one and reload select in settings. - ParseUserDictionariesIntoSelect(document.getElementById("loadAfterDelete"), dictionaryList); - ParseUserDictionariesIntoSelect(document.getElementById("userDictionaries"), dictionaryList); -} - -function ToggleCaseSensitiveOption() { - if (document.getElementById("dictionaryAllowDuplicates").checked) { - document.getElementById("dictionaryCaseSensitive").disabled = true; - } else { - document.getElementById("dictionaryCaseSensitive").disabled = false; - } -} - -function TogglePublicLink() { - if (document.getElementById("dictionaryIsPublic").checked) { - var publicLink = "http://lexicon.ga/" + currentDictionary.externalID; - document.getElementById("publicLink").innerHTML = "Public Link:
    " + publicLink; - } else { - document.getElementById("publicLink").innerHTML = ""; - } -} - -function SetPartsOfSpeech (selectId) { - selectId = (typeof selectId !== 'undefined') ? selectId : "partOfSpeech"; - var partsOfSpeechSelect = document.getElementById(selectId); - - var wordFilterOptions = document.getElementById("filterOptions"); - var wordFiltersSelected = GetSelectedFilters(); - - // Clear parts of speech. - partsOfSpeechSelect.innerHTML = ""; - wordFilterOptions.innerHTML = ""; - - // Insert blank part of speech as first dropdown option. - var blankpartOfSpeechOption = document.createElement('option'); - blankpartOfSpeechOption.appendChild(document.createTextNode("")); - blankpartOfSpeechOption.value = " "; - partsOfSpeechSelect.appendChild(blankpartOfSpeechOption); - - // Rebuild parts of speech - var newPartsOfSpeech = htmlEntitiesParse(currentDictionary.settings.partsOfSpeech).trim().split(","); - for (var j = 0; j < newPartsOfSpeech.length; j++) { - var thePartOfSpeech = newPartsOfSpeech[j].trim(); - - var partOfSpeechOption = document.createElement('option'); - partOfSpeechOption.appendChild(document.createTextNode(thePartOfSpeech)); - partOfSpeechOption.value = thePartOfSpeech; - partsOfSpeechSelect.appendChild(partOfSpeechOption); - - var wordFilterLabel = document.createElement('label'); - wordFilterLabel.appendChild(document.createTextNode(thePartOfSpeech + " ")); - wordFilterLabel['part-of-speech'] = thePartOfSpeech; - wordFilterLabel.className = 'filterOption'; - var wordFilterCheckbox = document.createElement('input'); - wordFilterCheckbox.type = 'checkbox'; - wordFilterCheckbox.onchange = function(){ShowDictionary()}; - if (wordFiltersSelected.indexOf(thePartOfSpeech) > -1) wordFilterCheckbox.checked = true; - wordFilterLabel.appendChild(wordFilterCheckbox); - wordFilterOptions.appendChild(wordFilterLabel); - } - - // Insert blank part of speech as last filter option - var blankwordFilterLabel = document.createElement('label'); - blankwordFilterLabel.appendChild(document.createTextNode("Blanks ")); - blankwordFilterLabel['part-of-speech'] = " "; - blankwordFilterLabel.className = 'filterOption'; - var blankwordFilterCheckbox = document.createElement('input'); - blankwordFilterCheckbox.type = 'checkbox'; - blankwordFilterCheckbox.onchange = function(){ShowDictionary()}; - if (wordFiltersSelected.indexOf(" ") > -1) blankwordFilterCheckbox.checked = true; - blankwordFilterLabel.appendChild(blankwordFilterCheckbox); - wordFilterOptions.appendChild(blankwordFilterLabel); -} - -function GetSelectedFilters() { - var wordFilterOptions = document.getElementById("filterOptions"); - var wordFiltersSelected = []; - - for (var i = 0; i < wordFilterOptions.children.length; i++) { - var filterOption = wordFilterOptions.children[i]; - if (filterOption.children[0].checked) { - wordFiltersSelected.push(filterOption['part-of-speech']); - } - } - - return wordFiltersSelected; -} - -function ToggleAllFilters(doCheck) { - var wordFilterOptions = document.getElementById("filterOptions"); - - for (var i = 0; i < wordFilterOptions.children.length; i++) { - wordFilterOptions.children[i].children[0].checked = doCheck; - } -} - -function ShowFilterWordCount(numberOfWords) { - var filters = GetSelectedFilters(); - var search = htmlEntitiesParseForSearchEntry(document.getElementById("searchBox").value); - var wordCounter = document.getElementById("filterWordCount"); - - if (filters.length > 0 || search != "") { - wordCounter.innerHTML = "Showing " + numberOfWords.toString() + " result" + ((numberOfWords != 1) ? "s" : ""); - } else { - wordCounter.innerHTML = ""; - } -} - -function NewWordNotification(word) { - var wordId = currentDictionary.nextWordId - 1; - NewNotification("New Word Added: " + word + ""); -} - -function NewNotification(message) { - var notificationArea = document.getElementById("notificationArea"); - var notificationMessage = document.getElementById("notificationMessage"); - notificationArea.style.display = "block"; - notificationMessage.innerHTML = message; -} - -function FocusAfterAddingNewWord() { - document.getElementById("word").focus(); -} diff --git a/src/sass/_lexiconga.scss b/src/sass/_lexiconga.scss deleted file mode 100644 index 64eca91..0000000 --- a/src/sass/_lexiconga.scss +++ /dev/null @@ -1,175 +0,0 @@ -body { - background: #e6cfaa; -} - -header { - background: #eacc9d; - -webkit-box-shadow: $header-shadow; - -moz-box-shadow: $header-shadow; - box-shadow: $header-shadow; -} - -tr, thead { - border-bottom: 1px solid #af8050; -} -td, th { - border-right: 1px solid #af8050; -} - -a { - // text-decoration: underline; - color: #a01000; -} - -#siteLogo { - display: block; - text-indent: -9999px; - width: 242px; - height: 48px; - // background: url(../../images/logo.svg); - background-size: 242px 48px; - float: left; -} - -#aboutButton { -} - -#loginoutArea { - float: right; -} - -#loginoutArea a { - color: #000000; - text-decoration: none; - font-size: 13px; -} - -@media screen -and (min-device-width : 481px) { - #headerPadder { - padding: 1px; - } - - #loginoutArea { - margin: 16px; - } -} - -/* Smartphones (portrait and landscape) ----------- */ -@media only screen -and (max-device-width : 480px) { - #siteLogo { - display: block; - text-indent: -9999px; - width: 150px; - height: 30px; - // background: url(../images/logo.svg); - background-size: 150px 30px; - float: left; - } - - #loginoutArea { - margin: 16px 8px; - } -} - -.floating-form { - background: #ba5536; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; - border: none; -} - -input, textarea, select, option { - background: #efdfc0; -} - -#announcementArea { - background: #a0c066; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -#notificationArea { - background: #c0c088; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -.center-column { - background: #bd7251; - border: none; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -.fixed-page-content { - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -.fixed-page-content { - background: #f2d5b2; -} - -.management { - border-width: 2px; - border: none; -} - -.dictionary-name { - text-shadow: 2px 2px 2px #915337; -} - -#dictionaryShareLink { - text-shadow: none; -} - -.tabbed-interface { - z-index: 10; - background: $dictionary-info-color; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -.selected-tab { - z-index: 5; - background: $dictionary-info-color !important; - -webkit-box-shadow: $box-shadow; - -moz-box-shadow: $box-shadow; - box-shadow: $box-shadow; -} - -#loginLink, #logoutLink, #descriptionToggle, #searchFilterToggle, #settingsButton, .deleteCancelButton, .deleteConfirmButton, #settingsScreenCloseButton, #infoScreenCloseButton, .clickable, button { - background: $button-color; -} - -.word { - background: #d7ad7d; - border: none; - -webkit-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); - -moz-box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); - box-shadow: 3px 3px 10px -1px rgba(0,0,0,0.75); - - .edit-button { - background: #86ac41; - } - - .delete-button { - background: #ba5536; - } -} - -footer { - background: #cb6318; - border: none; - -webkit-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); - -moz-box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); - box-shadow: 0px -3px 7px -1px rgba(0,0,0,0.75); -} \ No newline at end of file diff --git a/src/sass/_mobile.scss b/src/sass/_mobile.scss deleted file mode 100644 index 216331f..0000000 --- a/src/sass/_mobile.scss +++ /dev/null @@ -1,134 +0,0 @@ -/* Smartphones (portrait and landscape) ----------- */ -@media screen -and (max-width : 910px) { - body { - font-size: 11pt; - } - - header { - height: 70px; - } - - footer { - position: relative; - clear: both; - max-height: 100%; - } - - #announcementArea, #notificationArea { - width: 80%; - } - - #leftColumn { - width: 100%; - margin: 0; - } - - #wordEntryForm { - padding: 8px 0; - width: 100%; - max-width: 450px; - margin: 10px auto; - } - - #wordEntryForm label { - overflow: hidden; - display: flex; - justify-content: center; - font-size: 10pt; - } - - #wordEntryForm label span { - float: left; - width: 30%; - text-align: right; - margin-right: 8px; - } - - #wordEntryForm input, #wordEntryForm select, #wordEntryForm textarea { - float: right; - width: 60%; - margin-right: 8px; - align-self: center; - } - - .longDefinition { - min-width: 200px; - height: 80px; - } - - #wordEntryForm button { - display: block; - width: 50%; - height: 30px; - margin: 0px auto; - } - - #mobileWordFormPullout { - position: fixed; - top: 7%; - left: 0; - width: 32px; - height: 32px; - font-size: 20px; - font-weight: bold; - text-align: center; - padding: 6px; - background: #86ac41; - -webkit-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - -moz-box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - box-shadow: 5px 5px 7px 0px rgba(0,0,0,0.75); - border: none; - cursor: pointer; - } - - #dictionaryColumn { - width: 100%; - margin: 0; - padding: 0; - } - - #dictionaryContent { - margin: 0 auto; - padding: 15px; - } - - #dictionaryDescription { - margin: 0 auto; - } - - #searchFilterArea { - width: 90%; - min-width: 200px; - padding: 10px 10px 3px; - margin: 0 auto; - } - - .fixedFade { - z-index: 5; - } - - .fixedPage { - z-index: 10; - } - - entry { - margin: 0 auto 5px; - } - - #formLockButton { - display: none; - } - - .maximize-button { - display: none; - } - - #settingsSaveButtons { - position: relative; - right: 0; - bottom: 0; - clear: both; - width: 100%; - } -} diff --git a/src/sass/_styles.scss b/src/sass/_styles.scss deleted file mode 100644 index de9c73f..0000000 --- a/src/sass/_styles.scss +++ /dev/null @@ -1,490 +0,0 @@ -* { - // position: relative; - // z-index: 0; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; -} - -html { - width: 100%; -} - -body { - width: 100%; - padding: 0; - margin: 0; - border: none; - font-family: "Helvetica", Arial, sans-serif; -} - -contents { - display: block; - width: 100%; -} - -header { - height: $header-height; - width: 100%; - margin: 0 0 10px; - position: relative; - top: 0px; - left: 0px; - right: 0px; - border: none; - padding: 0; - - .button-group { - float: right; - margin: 16px 8px; - font-size:12px; - - span { - margin-left: 16px; - } - } -} - -footer { - width: 100%; - text-align: center; - vertical-align: middle; - position:fixed; - bottom: 0px; - left: 0px; - background: #aaaaaa; - padding: 0; - max-height: $footer-height; - - #footer-content { - padding: 8px; - } -} - -table { - border-collapse: collapse; - width: 100%; -} - -tr, thead { - border-bottom: 1px solid #afafaf; -} -tr:last-child { - border-bottom: none; -} - -td, th { - border-right: 1px solid #afafaf; - padding: 3px 10px; -} -td:last-child, th:last-child { - border-right: none; -} - -.inline { - display: inline !important; -} - -.right { - float: right; -} - -.column { - display: block; - float: left; - margin: $column-margin; -} - -.left-column { - @extend .column; - - width: 25%; - min-width: $min-column-width; - max-width: $max-column-width / 2; -} - -.center-column { - @extend .column; - - width: 50%; - margin-bottom: $column-margin + $footer-height; - min-width: $min-column-width; - max-width: $max-column-width; - padding: 15px; -} - -.floating-form { - position: fixed; - top: $header-height + $column-margin; - width: 25%; - min-width: $min-column-width - ($column-margin * 2); - max-width: ($max-column-width / 2) - ($column-margin * 2); -} - -form { - padding: 15px; -} - -.wbr:after { - content: "\00200B"; -} - -label { - display: block; - margin-bottom: 10px; -} - -label span { - display: block; - font-weight: bold; -} - -label label { - margin-left: 20px; -} - -label span.checkboxlabel { - display: inline; - margin-left: 10px; -} - -input, textarea { - display: block; - padding: 2px 0 2px 5px; - border: none; - margin: 2px 0; - width: 100%; -} - -textarea { - min-height: 125px; -} - -input[type=checkbox] { - display: inline; - margin: 5px; -} - -.longDefinition { - width: 100%; - min-width: 230px; - height: 150px; -} - -#updateConflict { - width: 260px; -} - -#errorMessage, #updateConflictMessage, #settingsErrorMessage { - display: block; - color: maroon; - font-weight: bold; -} - -#dictionaryWarn { - margin-top: 10px; - font-size: 12px; - font-weight: bold; - font-style: italic; -} - -.exportWarnText { - display: inline; - color: red; - cursor: pointer; - text-decoration: underline; -} - -#formLockButton { - float: right; -} - -#createAccountSubmitButton, #accountSettingsSubmitButton { - margin-top: 10px; -} - -#aboutButton { - display: inline; - margin: 0 10px 0 0; -} - -#announcementArea, #notificationArea { - text-align:center; - padding:10px; - margin: 0 auto 5px; - width:50%; - min-width:200px; -} - -.dictionary-name { - margin: 0 0 5px; -} - -#dictionaryShareLink { - margin-left: 10px; - vertical-align: middle; - text-decoration: none; -} - -.dictionary-info { - width: 90%; - max-height: 400px; - overflow-y: auto; - padding: 10px; - border: none; - margin: 0; - - .selected-tab, .tabbed-interface { - position: relative; - } - - .tabbed-interface { - margin: 0; - padding: 5px 10px; - } -} - -.clickable, button { - display: inline; - font-weight: bold; - font-size: 13px; - padding: 5px; - border: none; - background: #dddddd; - margin: 0 3px; -} - -.clickable, button { - cursor: pointer; -} - -.inline-button { - display: inline-block !important; - font-size: 11px; - padding: 2px 4px; -} - -.toggleButton { - display: inline-block; - margin: 8px; - font-weight: bold; - font-size: 12px; -} - -.searchOption, .filterOption { - font-size:12px; - display: inline-block; - margin: 0 8px 0 0; -} - -#wordFilter { - margin: 10px 0; -} - -#filterWordCount { - margin: 10px 10px; - display: block; - font-weight: bold; - font-style: italic; -} - -.word { - display: block; - width: 90%; - min-width: 200px; - padding: 10px 10px 3px; - margin-bottom: 5px; - - .name { - font-weight: bold; - font-size: 20px; - } - - .pronunciation { - font-size: 12px; - margin-left:10px; - } - - .part-of-speech { - font-style: italic; - font-weight: bold; - font-size: 10px; - margin-left:10px; - } - - .simple-definition { - display: block; - font-style: italic; - } - - .long-definition { - display: block; - margin-left: 20px; - - h1, h2, h3, h4, h5, h6 { - margin: 5px 0 8px; - font-weight: bold; - } - - h1 { - font-size: 22px; - } - - h2 { - font-size: 20px; - } - - h3 { - font-size: 20px; - font-weight: normal; - } - - h4 { - font-size: 18px; - } - - h5 { - font-size: 18px; - font-weight: normal; - } - - h6 { - font-size: 17px; - } - - p { - margin: 3px 0 8px; - } - } -} - -.wordLink { - text-decoration: none; - float: right; - font-size: 13px; - padding: 2px; - line-height: 10px; -} - -searchTerm { - display: inline; - color: #ff0000; - background: #ffff00; - padding: 1px; - text-decoration: underline; - font-style: italic; - font-weight: bold; -} - -.management { - display: block; - right: 5px; - width: 100px; - padding: 3px; - border: inset 3px; - margin: 10px; -} - -.edit-button, .delete-button, .deleteConfirmButton, .deleteCancelButton { - display: inline; - font-size: 10px; - margin: 5px; -} - -.deleteConfirm { - display: block; - font-size: 10px; - margin: 10px; -} - -.fixed-page-container { - position: relative; - z-index: 999; - - .fixed-page-background-fade { - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: #000000; - opacity: 0.6; - } - - .fixed-page-content { - position: fixed; - top: 5%; - left: 6%; - right: 6%; - bottom: 10%; - min-width: 260px; - min-height: 260px; - padding: 5px 5% 5%; - overflow-y: auto; - overflow-x: hidden; - opacity: 1; - border: none; - text-align: left; - } -} - -.right-button { - @extend .right; - - font-size: 12px; -} - -.no-scroll { - padding: 5px 3% 4% !important; - overflow-y: hidden !important; -} - -.maximize-button { - @extend .inline-button; -} - -.fullscreen-textbox { - position: relative; - width: 100%; - height: 100%; -} - -#settingsForm { - width: 100%; - padding: 0; - margin: 0; -} - -#publicLink { - font-size:12px; - font-style: italic; -} - -#dictionaryDescriptionEdit, #dictionaryPartsOfSpeechEdit { - width: 100%; - max-width: 360px; - min-width: 200px; -} - -#dictionaryDescriptionEdit { - height: 200px; -} - -#settingsErrorMessage { - float: right; - clear: both; -} -#settingsSaveButtons { - position: absolute; - right: 10%; - bottom: 8%; - font-size: 14px; - display: block; - width: 50%; -} - -.settings-column { - @extend .left-column; - - margin-right: $column-margin * 2; -} diff --git a/src/sass/_variables.scss b/src/sass/_variables.scss index 23fdcdf..e69de29 100644 --- a/src/sass/_variables.scss +++ b/src/sass/_variables.scss @@ -1,12 +0,0 @@ -$header-height: 50px; -$header-shadow: 0px 3px 10px -1px rgba(0, 0, 0, 0.75); -$box-shadow: 5px 5px 7px 0px rgba(0, 0, 0, 0.75); -$column-margin: 15px; -$min-column-width: 260px; -$max-column-width: 800px; -$button-color: #dcb078; -$dictionary-info-color: #f2d5b2; -$footer-height: 32px; - -// Bulma Variables -$radius: 0; diff --git a/src/sass/main.scss b/src/sass/main.scss index 295539a..07cc46b 100644 --- a/src/sass/main.scss +++ b/src/sass/main.scss @@ -1,6 +1,2 @@ @import 'variables'; @import '../../node_modules/bulma/bulma'; -// @import 'styles'; -// @import 'lexiconga'; -// @import 'mobile'; -@import '../../node_modules/react-select/dist/react-select'; \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 11cef9f..86ae26d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,58 +4,58 @@ const path = require('path'); const BUILD_DIR = path.resolve(__dirname, 'public'); const APP_DIR = path.resolve(__dirname, 'src'); - module.exports = { - entry: APP_DIR + '/index.jsx', - output: { - path: BUILD_DIR, - filename: 'lexiconga.js' - }, - module: { - loaders: [ - { - test: /\.html?$/, - exclude: /node_modules/, - loaders: [ - 'file?name=[name].html', - 'html-minify' - ] - }, - { - test: /\.scss$/, - exclude: /node_modules/, - loaders: ['style', 'css', 'sass'] - }, - { - test: /\.jsx?$/, - exclude: /node_modules/, - loader: 'babel', - query: { - // presets: ['react', 'es2015'] - presets: ['es2015'], - plugins: ['inferno'] +module.exports = { + entry: APP_DIR + '/index.jsx' +, output: { + path: BUILD_DIR + , filename: 'lexiconga.js' + } +, module: { + rules: [ + { + test: /\.scss$/ + , exclude: /node_modules/ + , use: [ + 'style-loader' + , 'css-loader' + , { + loader: 'sass-loader' + , options: { + file: './src/sass/styles.scss', + outFile: './public/styles.css', + outputStyle: 'compressed' + } } - } - ] - }, - resolve: { - extensions: ['', '.js', '.jsx'], - }, - /*plugins: [ - // When you're ready to publish, check this article out. - // http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false - }, - output: { - comments: false - } - }) - ],*/ - sassLoader: { - file: './src/sass/styles.scss', - // includePaths: ['./node_modules/bootstrap-sass/assets/'], - outFile: './public/styles.css', - outputStyle: 'compressed' - } - }; + ] + } + , { + test: /\.jsx?$/ + , exclude: /node_modules/ + , use: [ + { + loader: 'babel-loader' + , options: { + presets: ['es2016'] + , plugins: ['inferno'] + } + } + ] + } + ] + } +, resolve: { + extensions: ['.js', '.jsx'] +} +/*, plugins: [ + // When you're ready to publish, check this article out. + // http://dev.topheman.com/make-your-react-production-minified-version-with-webpack/ + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + }, + output: { + comments: false + } + }) + ]*/ +}; diff --git a/yarn.lock b/yarn.lock index b054200..2c344a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13,11 +13,21 @@ accepts@~1.3.3: mime-types "~2.1.11" negotiator "0.6.1" -acorn@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" +acorn-dynamic-import@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz#c752bd210bef679501b6c6cb7fc84f8f47158cc4" + dependencies: + acorn "^4.0.3" -ajv@^4.9.1: +acorn@^4.0.3, acorn@^4.0.4: + version "4.0.11" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" + +ajv-keywords@^1.1.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" + +ajv@^4.7.0, ajv@^4.9.1: version "4.11.5" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" dependencies: @@ -36,11 +46,7 @@ alphanum-sort@^1.0.1, alphanum-sort@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - -ansi-regex@2, ansi-regex@^2.0.0: +ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -66,10 +72,6 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.0 || ^1.1.13" -argh@~0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/argh/-/argh-0.1.4.tgz#3eb4d612973fc6b6dc6ef338f56f759f2ac5c3a6" - argparse@^1.0.7: version "1.0.9" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" @@ -102,9 +104,13 @@ arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -asap@~2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" +asn1.js@^4.0.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" asn1@~0.2.3: version "0.2.3" @@ -132,24 +138,12 @@ async-foreach@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" -async@^0.9.0: - version "0.9.2" - resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d" - -async@^1.3.0, async@~1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - -async@^2.0.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/async/-/async-2.2.0.tgz#c324eba010a237e4fbd55a12dee86367d5c0ef32" +async@^2.1.2, async@^2.1.5: + version "2.3.0" + resolved "https://registry.yarnpkg.com/async/-/async-2.3.0.tgz#1013d1051047dd320fe24e494d5c66ecaf6147d9" dependencies: lodash "^4.14.0" -async@~0.2.6: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -181,7 +175,7 @@ babel-code-frame@^6.11.0, babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@^6.14.0, babel-core@^6.24.0: +babel-core@^6.24.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.0.tgz#8f36a0a77f5c155aed6f920b844d23ba56742a02" dependencies: @@ -218,83 +212,22 @@ babel-generator@^6.24.0: source-map "^0.5.0" trim-right "^1.0.1" -babel-helper-builder-react-jsx@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-helper-builder-react-jsx/-/babel-helper-builder-react-jsx-6.23.0.tgz#d53fc8c996e0bc56d0de0fc4cc55a7138395ea4b" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.23.0" - esutils "^2.0.0" - lodash "^4.2.0" - -babel-helper-call-delegate@^6.22.0: +babel-helper-builder-binary-assignment-operator-visitor@^6.22.0: version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.22.0.tgz#119921b56120f17e9dae3f74b4f5cc7bcc1b37ef" + resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.22.0.tgz#29df56be144d81bdeac08262bfa41d2c5e91cdcd" + dependencies: + babel-helper-explode-assignable-expression "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-helper-explode-assignable-expression@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.22.0.tgz#c97bf76eed3e0bae4048121f2b9dae1a4e7d0478" dependencies: - babel-helper-hoist-variables "^6.22.0" babel-runtime "^6.22.0" babel-traverse "^6.22.0" babel-types "^6.22.0" -babel-helper-define-map@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.23.0.tgz#1444f960c9691d69a2ced6a205315f8fd00804e7" - dependencies: - babel-helper-function-name "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.23.0" - lodash "^4.2.0" - -babel-helper-function-name@^6.22.0, babel-helper-function-name@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.23.0.tgz#25742d67175c8903dbe4b6cb9d9e1fcb8dcf23a6" - dependencies: - babel-helper-get-function-arity "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - -babel-helper-get-function-arity@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz#0beb464ad69dc7347410ac6ade9f03a50634f5ce" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-helper-hoist-variables@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz#3eacbf731d80705845dd2e9718f600cfb9b4ba72" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-helper-optimise-call-expression@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.23.0.tgz#f3ee7eed355b4282138b33d02b78369e470622f5" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.23.0" - -babel-helper-regex@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.22.0.tgz#79f532be1647b1f0ee3474b5f5c3da58001d247d" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - lodash "^4.2.0" - -babel-helper-replace-supers@^6.22.0, babel-helper-replace-supers@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.23.0.tgz#eeaf8ad9b58ec4337ca94223bacdca1f8d9b4bfd" - dependencies: - babel-helper-optimise-call-expression "^6.23.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - babel-helpers@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.23.0.tgz#4f8f2e092d0b6a8808a4bde79c27f1e2ecf0d992" @@ -302,7 +235,7 @@ babel-helpers@^6.23.0: babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-loader@^6.2.5: +babel-loader@^6.4.1: version "6.4.1" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-6.4.1.tgz#0b34112d5b0748a8dcdbf51acf6f9bd42d50b8ca" dependencies: @@ -317,244 +250,30 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-check-es2015-constants@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-inferno@^1.4.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/babel-plugin-inferno/-/babel-plugin-inferno-1.9.0.tgz#b8f5b4591577f590d78bd18e2e3e8c8c5c1f6e73" +babel-plugin-inferno@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-inferno/-/babel-plugin-inferno-3.1.0.tgz#7eb4ed85a578f22191c108c401aabcebaae27ae8" dependencies: babel-plugin-syntax-jsx "^6.18.0" - inferno-vnode-flags "1.3.0-rc.1" + inferno-vnode-flags "1.5.1" -babel-plugin-syntax-flow@^6.18.0: - version "6.18.0" - resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d" +babel-plugin-syntax-exponentiation-operator@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" -babel-plugin-syntax-jsx@^6.18.0, babel-plugin-syntax-jsx@^6.3.13, babel-plugin-syntax-jsx@^6.8.0: +babel-plugin-syntax-jsx@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" -babel-plugin-transform-es2015-arrow-functions@^6.22.0: +babel-plugin-transform-exponentiation-operator@^6.22.0: version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.22.0.tgz#d57c8335281918e54ef053118ce6eb108468084d" dependencies: + babel-helper-builder-binary-assignment-operator-visitor "^6.22.0" + babel-plugin-syntax-exponentiation-operator "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-block-scoping@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.23.0.tgz#e48895cf0b375be148cd7c8879b422707a053b51" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - lodash "^4.2.0" - -babel-plugin-transform-es2015-classes@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.23.0.tgz#49b53f326202a2fd1b3bbaa5e2edd8a4f78643c1" - dependencies: - babel-helper-define-map "^6.23.0" - babel-helper-function-name "^6.23.0" - babel-helper-optimise-call-expression "^6.23.0" - babel-helper-replace-supers "^6.23.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - -babel-plugin-transform-es2015-computed-properties@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz#7c383e9629bba4820c11b0425bdd6290f7f057e7" - dependencies: - babel-runtime "^6.22.0" - babel-template "^6.22.0" - -babel-plugin-transform-es2015-destructuring@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-duplicate-keys@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz#672397031c21610d72dd2bbb0ba9fb6277e1c36b" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-plugin-transform-es2015-for-of@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-function-name@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz#f5fcc8b09093f9a23c76ac3d9e392c3ec4b77104" - dependencies: - babel-helper-function-name "^6.22.0" - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-plugin-transform-es2015-literals@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-modules-amd@^6.24.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.0.tgz#a1911fb9b7ec7e05a43a63c5995007557bcf6a2e" - dependencies: - babel-plugin-transform-es2015-modules-commonjs "^6.24.0" - babel-runtime "^6.22.0" - babel-template "^6.22.0" - -babel-plugin-transform-es2015-modules-commonjs@^6.24.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.0.tgz#e921aefb72c2cc26cb03d107626156413222134f" - dependencies: - babel-plugin-transform-strict-mode "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-types "^6.23.0" - -babel-plugin-transform-es2015-modules-systemjs@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.23.0.tgz#ae3469227ffac39b0310d90fec73bfdc4f6317b0" - dependencies: - babel-helper-hoist-variables "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - -babel-plugin-transform-es2015-modules-umd@^6.24.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.0.tgz#fd5fa63521cae8d273927c3958afd7c067733450" - dependencies: - babel-plugin-transform-es2015-modules-amd "^6.24.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - -babel-plugin-transform-es2015-object-super@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz#daa60e114a042ea769dd53fe528fc82311eb98fc" - dependencies: - babel-helper-replace-supers "^6.22.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-parameters@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.23.0.tgz#3a2aabb70c8af945d5ce386f1a4250625a83ae3b" - dependencies: - babel-helper-call-delegate "^6.22.0" - babel-helper-get-function-arity "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.23.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - -babel-plugin-transform-es2015-shorthand-properties@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz#8ba776e0affaa60bff21e921403b8a652a2ff723" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-plugin-transform-es2015-spread@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-sticky-regex@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz#ab316829e866ee3f4b9eb96939757d19a5bc4593" - dependencies: - babel-helper-regex "^6.22.0" - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-plugin-transform-es2015-template-literals@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-typeof-symbol@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-es2015-unicode-regex@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz#8d9cc27e7ee1decfe65454fb986452a04a613d20" - dependencies: - babel-helper-regex "^6.22.0" - babel-runtime "^6.22.0" - regexpu-core "^2.0.0" - -babel-plugin-transform-flow-strip-types@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf" - dependencies: - babel-plugin-syntax-flow "^6.18.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-display-name@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-display-name/-/babel-plugin-transform-react-display-name-6.23.0.tgz#4398910c358441dc4cef18787264d0412ed36b37" - dependencies: - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx-self@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-self/-/babel-plugin-transform-react-jsx-self-6.22.0.tgz#df6d80a9da2612a121e6ddd7558bcbecf06e636e" - dependencies: - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx-source@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx-source/-/babel-plugin-transform-react-jsx-source-6.22.0.tgz#66ac12153f5cd2d17b3c19268f4bf0197f44ecd6" - dependencies: - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-react-jsx@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-jsx/-/babel-plugin-transform-react-jsx-6.23.0.tgz#23e892f7f2e759678eb5e4446a8f8e94e81b3470" - dependencies: - babel-helper-builder-react-jsx "^6.23.0" - babel-plugin-syntax-jsx "^6.8.0" - babel-runtime "^6.22.0" - -babel-plugin-transform-regenerator@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz#65740593a319c44522157538d690b84094617ea6" - dependencies: - regenerator-transform "0.9.8" - -babel-plugin-transform-strict-mode@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c" - dependencies: - babel-runtime "^6.22.0" - babel-types "^6.22.0" - -babel-polyfill@^6.13.0: +babel-polyfill@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.23.0.tgz#8364ca62df8eafb830499f699177466c3b03499d" dependencies: @@ -562,51 +281,11 @@ babel-polyfill@^6.13.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-preset-es2015@^6.14.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.0.tgz#c162d68b1932696e036cd3110dc1ccd303d2673a" +babel-preset-es2016@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-es2016/-/babel-preset-es2016-6.22.0.tgz#b061aaa3983d40c9fbacfa3743b5df37f336156c" dependencies: - babel-plugin-check-es2015-constants "^6.22.0" - babel-plugin-transform-es2015-arrow-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoping "^6.22.0" - babel-plugin-transform-es2015-classes "^6.22.0" - babel-plugin-transform-es2015-computed-properties "^6.22.0" - babel-plugin-transform-es2015-destructuring "^6.22.0" - babel-plugin-transform-es2015-duplicate-keys "^6.22.0" - babel-plugin-transform-es2015-for-of "^6.22.0" - babel-plugin-transform-es2015-function-name "^6.22.0" - babel-plugin-transform-es2015-literals "^6.22.0" - babel-plugin-transform-es2015-modules-amd "^6.24.0" - babel-plugin-transform-es2015-modules-commonjs "^6.24.0" - babel-plugin-transform-es2015-modules-systemjs "^6.22.0" - babel-plugin-transform-es2015-modules-umd "^6.24.0" - babel-plugin-transform-es2015-object-super "^6.22.0" - babel-plugin-transform-es2015-parameters "^6.22.0" - babel-plugin-transform-es2015-shorthand-properties "^6.22.0" - babel-plugin-transform-es2015-spread "^6.22.0" - babel-plugin-transform-es2015-sticky-regex "^6.22.0" - babel-plugin-transform-es2015-template-literals "^6.22.0" - babel-plugin-transform-es2015-typeof-symbol "^6.22.0" - babel-plugin-transform-es2015-unicode-regex "^6.22.0" - babel-plugin-transform-regenerator "^6.22.0" - -babel-preset-flow@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-preset-flow/-/babel-preset-flow-6.23.0.tgz#e71218887085ae9a24b5be4169affb599816c49d" - dependencies: - babel-plugin-transform-flow-strip-types "^6.22.0" - -babel-preset-react@^6.11.1: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-preset-react/-/babel-preset-react-6.23.0.tgz#eb7cee4de98a3f94502c28565332da9819455195" - dependencies: - babel-plugin-syntax-jsx "^6.3.13" - babel-plugin-transform-react-display-name "^6.23.0" - babel-plugin-transform-react-jsx "^6.23.0" - babel-plugin-transform-react-jsx-self "^6.22.0" - babel-plugin-transform-react-jsx-source "^6.22.0" - babel-preset-flow "^6.23.0" + babel-plugin-transform-exponentiation-operator "^6.22.0" babel-register@^6.24.0: version "6.24.0" @@ -620,14 +299,14 @@ babel-register@^6.24.0: mkdirp "^0.5.1" source-map-support "^0.4.2" -babel-runtime@^6.18.0, babel-runtime@^6.22.0: +babel-runtime@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.22.0, babel-template@^6.23.0: +babel-template@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" dependencies: @@ -651,7 +330,7 @@ babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1: invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: +babel-types@^6.22.0, babel-types@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" dependencies: @@ -692,6 +371,10 @@ block-stream@*: dependencies: inherits "~2.0.0" +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: + version "4.11.6" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + boom@2.x.x: version "2.10.1" resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" @@ -713,12 +396,55 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" -browserify-aes@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-0.4.0.tgz#067149b668df31c4b58533e02d01e806d8608e2c" +brorand@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + +browserify-aes@^1.0.0, browserify-aes@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.0.6.tgz#5e7725dbdef1fd5930d4ebab48567ce451c48a0a" dependencies: + buffer-xor "^1.0.2" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.0" inherits "^2.0.1" +browserify-cipher@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd" + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + +browserify-rsa@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + dependencies: + bn.js "^4.1.0" + randombytes "^2.0.1" + +browserify-sign@^4.0.0: + version "4.0.4" + resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.4.tgz#aa4eb68e5d7b658baa6bf6a57e630cbd7a93d298" + dependencies: + bn.js "^4.1.1" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.2" + elliptic "^6.0.0" + inherits "^2.0.1" + parse-asn1 "^5.0.0" + browserify-zlib@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" @@ -736,7 +462,11 @@ buffer-shims@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" -buffer@^4.9.0: +buffer-xor@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + +buffer@^4.3.0: version "4.9.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" dependencies: @@ -752,9 +482,9 @@ builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" -bulma@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.2.3.tgz#086394c65e74aa8081e658bdcf6742f81107936e" +bulma@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/bulma/-/bulma-0.4.0.tgz#2a0b07555d53bb4eb17861e3159e2616c21dfa6c" camelcase-keys@^2.0.0: version "2.1.0" @@ -785,8 +515,8 @@ caniuse-api@^1.5.2: lodash.uniq "^4.3.0" caniuse-db@^1.0.30000346, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639: - version "1.0.30000646" - resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000646.tgz#c724b90d61df24286e015fc528d062073c00def4" + version "1.0.30000649" + resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000649.tgz#1ee1754a6df235450c8b7cd15e0ebf507221a86a" caseless@~0.12.0: version "0.12.0" @@ -809,7 +539,7 @@ chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chokidar@^1.0.0: +chokidar@^1.4.3: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" dependencies: @@ -824,27 +554,18 @@ chokidar@^1.0.0: optionalDependencies: fsevents "^1.0.0" +cipher-base@^1.0.0, cipher-base@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.3.tgz#eeabf194419ce900da3018c207d212f2a6df0a07" + dependencies: + inherits "^2.0.1" + clap@^1.0.9: version "1.1.3" resolved "https://registry.yarnpkg.com/clap/-/clap-1.1.3.tgz#b3bd36e93dd4cbfb395a3c26896352445265c05b" dependencies: chalk "^1.1.3" -classnames@^2.2.4: - version "2.2.5" - resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.5.tgz#fb3801d453467649ef3603c7d61a02bd129bde6d" - -cli-color@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-1.1.0.tgz#de188cdc4929d83b67aea04110fbed40fdbf6775" - dependencies: - ansi-regex "2" - d "^0.1.1" - es5-ext "^0.10.8" - es6-iterator "2" - memoizee "^0.3.9" - timers-ext "0.1" - cliui@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" @@ -861,6 +582,16 @@ cliui@^3.2.0: strip-ansi "^3.0.1" wrap-ansi "^2.0.0" +clone-deep@^0.2.4: + version "0.2.4" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-0.2.4.tgz#4e73dd09e9fb971cc38670c5dced9c1896481cc6" + dependencies: + for-own "^0.1.3" + is-plain-object "^2.0.1" + kind-of "^3.0.2" + lazy-cache "^1.0.3" + shallow-clone "^0.1.2" + clone@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" @@ -879,10 +610,6 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -color-convert@^0.5.0: - version "0.5.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-0.5.3.tgz#bdb6c69ce660fadffe0b0007cc447e1b9f7282bd" - color-convert@^1.3.0: version "1.9.0" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" @@ -899,13 +626,6 @@ color-string@^0.3.0: dependencies: color-name "^1.0.0" -color@0.8.x: - version "0.8.0" - resolved "https://registry.yarnpkg.com/color/-/color-0.8.0.tgz#890c07c3fd4e649537638911cf691e5458b6fca5" - dependencies: - color-convert "^0.5.0" - color-string "^0.3.0" - color@^0.11.0: version "0.11.4" resolved "https://registry.yarnpkg.com/color/-/color-0.11.4.tgz#6d7b5c74fb65e841cd48792ad1ed5e07b904d764" @@ -922,21 +642,10 @@ colormin@^1.0.5: css-color-names "0.0.4" has "^1.0.1" -colornames@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/colornames/-/colornames-0.0.2.tgz#d811fd6c84f59029499a8ac4436202935b92be31" - colors@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" -colorspace@1.0.x: - version "1.0.1" - resolved "https://registry.yarnpkg.com/colorspace/-/colorspace-1.0.1.tgz#c99c796ed31128b9876a52e1ee5ee03a4a719749" - dependencies: - color "0.8.x" - text-hex "0.0.x" - combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" @@ -985,10 +694,6 @@ cookie@0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb" -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - core-js@^2.4.0: version "2.4.1" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" @@ -997,6 +702,29 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +create-ecdh@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" + dependencies: + bn.js "^4.1.0" + elliptic "^6.0.0" + +create-hash@^1.1.0, create-hash@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.2.tgz#51210062d7bb7479f6c65bb41a92208b1d61abad" + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + ripemd160 "^1.0.0" + sha.js "^2.3.6" + +create-hmac@^1.1.0, create-hmac@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.4.tgz#d3fb4ba253eb8b3f56e39ea2fbcb8af747bd3170" + dependencies: + create-hash "^1.1.0" + inherits "^2.0.1" + cross-spawn@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" @@ -1010,35 +738,41 @@ cryptiles@2.x.x: dependencies: boom "2.x.x" -crypto-browserify@3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.3.0.tgz#b9fc75bb4a0ed61dcf1cd5dae96eb30c9c3e506c" +crypto-browserify@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.11.0.tgz#3652a0906ab9b2a7e0c3ce66a408e957a2485522" dependencies: - browserify-aes "0.4.0" - pbkdf2-compat "2.0.1" - ripemd160 "0.2.0" - sha.js "2.2.6" + browserify-cipher "^1.0.0" + browserify-sign "^4.0.0" + create-ecdh "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.0" + diffie-hellman "^5.0.0" + inherits "^2.0.1" + pbkdf2 "^3.0.3" + public-encrypt "^4.0.0" + randombytes "^2.0.0" css-color-names@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" -css-loader@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.25.0.tgz#c3febc8ce28f4c83576b6b13707f47f90c390223" +css-loader@^0.28.0: + version "0.28.0" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.0.tgz#417cfa9789f8cde59a30ccbf3e4da7a806889bad" dependencies: babel-code-frame "^6.11.0" - css-selector-tokenizer "^0.6.0" + css-selector-tokenizer "^0.7.0" cssnano ">=2.6.1 <4" - loader-utils "~0.2.2" - lodash.camelcase "^3.0.1" + loader-utils "^1.0.2" + lodash.camelcase "^4.3.0" object-assign "^4.0.1" postcss "^5.0.6" postcss-modules-extract-imports "^1.0.0" postcss-modules-local-by-default "^1.0.1" postcss-modules-scope "^1.0.0" postcss-modules-values "^1.1.0" - source-list-map "^0.1.4" + source-list-map "^0.1.7" css-selector-tokenizer@^0.6.0: version "0.6.0" @@ -1048,6 +782,14 @@ css-selector-tokenizer@^0.6.0: fastparse "^1.1.1" regexpu-core "^1.0.0" +css-selector-tokenizer@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz#e6988474ae8c953477bf5e7efecfceccd9cf4c86" + dependencies: + cssesc "^0.1.0" + fastparse "^1.1.1" + regexpu-core "^1.0.0" + cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" @@ -1102,18 +844,6 @@ currently-unhandled@^0.4.1: dependencies: array-find-index "^1.0.1" -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" - dependencies: - es5-ext "^0.10.9" - -d@^0.1.1, d@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" - dependencies: - es5-ext "~0.10.2" - dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -1160,6 +890,13 @@ depd@1.1.0, depd@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3" +des.js@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + destroy@~1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" @@ -1174,46 +911,18 @@ dexie@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/dexie/-/dexie-1.5.1.tgz#ac3ad5a0ebaf7e6e42760db58710418d4a756624" -diagnostics@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/diagnostics/-/diagnostics-1.0.1.tgz#accdb080c82bb25d0dd73430a9e6a87fbb431541" +diffie-hellman@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" dependencies: - colorspace "1.0.x" - enabled "1.0.x" - kuler "0.0.x" - -dom-serializer@0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" - dependencies: - domelementtype "~1.1.1" - entities "~1.1.1" + bn.js "^4.1.0" + miller-rabin "^4.0.0" + randombytes "^2.0.0" domain-browser@^1.1.1: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" -domelementtype@1, domelementtype@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - -domelementtype@~1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" - -domhandler@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" - dependencies: - domelementtype "1" - -domutils@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.5.1.tgz#dcd8488a26f563d61079e48c9f7b7e32373682cf" - dependencies: - dom-serializer "0" - domelementtype "1" - ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1228,45 +937,34 @@ electron-to-chromium@^1.2.7: version "1.3.2" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.2.tgz#b8ce5c93b308db0e92f6d0435c46ddec8f6363ab" -emits@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/emits/-/emits-3.0.0.tgz#32752bba95e1707b219562384ab9bb8b1fd62f70" +elliptic@^6.0.0: + version "6.4.0" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.4.0.tgz#cac9af8762c85836187003c8dfe193e5e2eae5df" + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + hmac-drbg "^1.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.0" emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" -enabled@1.0.x: - version "1.0.2" - resolved "https://registry.yarnpkg.com/enabled/-/enabled-1.0.2.tgz#965f6513d2c2d1c5f4652b64a2e3396467fc2f93" - dependencies: - env-variable "0.0.x" - encodeurl@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20" -encoding@^0.1.11: - version "0.1.12" - resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.12.tgz#538b66f3ee62cd1ab51ec323829d1f9480c74beb" - dependencies: - iconv-lite "~0.4.13" - -enhanced-resolve@~0.9.0: - version "0.9.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz#4d6e689b3725f86090927ccc86cd9f1635b89e2e" +enhanced-resolve@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.1.0.tgz#9f4b626f577245edcf4b2ad83d86e17f4f421dec" dependencies: graceful-fs "^4.1.2" - memory-fs "^0.2.0" - tapable "^0.1.8" - -entities@^1.1.1, entities@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" - -env-variable@0.0.x: - version "0.0.3" - resolved "https://registry.yarnpkg.com/env-variable/-/env-variable-0.0.3.tgz#b86c1641be5610267d506f18071ea76d707097cb" + memory-fs "^0.4.0" + object-assign "^4.0.1" + tapable "^0.2.5" errno@^0.1.3: version "0.1.4" @@ -1280,52 +978,6 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es5-ext@^0.10.14, es5-ext@^0.10.8, es5-ext@^0.10.9, es5-ext@~0.10.11, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.5, es5-ext@~0.10.6: - version "0.10.15" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" - dependencies: - es6-iterator "2" - es6-symbol "~3.1" - -es6-iterator@2: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-symbol "^3.1" - -es6-iterator@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-0.1.3.tgz#d6f58b8c4fc413c249b4baa19768f8e4d7c8944e" - dependencies: - d "~0.1.1" - es5-ext "~0.10.5" - es6-symbol "~2.0.1" - -es6-symbol@^3.1, es6-symbol@~3.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - dependencies: - d "1" - es5-ext "~0.10.14" - -es6-symbol@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-2.0.1.tgz#761b5c67cfd4f1d18afb234f691d678682cb3bf3" - dependencies: - d "~0.1.1" - es5-ext "~0.10.5" - -es6-weak-map@~0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-0.1.4.tgz#706cef9e99aa236ba7766c239c8b9e286ea7d228" - dependencies: - d "~0.1.1" - es5-ext "~0.10.6" - es6-iterator "~0.1.3" - es6-symbol "~2.0.1" - escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -1338,7 +990,7 @@ esprima@^2.6.0: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" -esutils@^2.0.0, esutils@^2.0.2: +esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1346,17 +998,16 @@ etag@~1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.0.tgz#6f631aef336d6c46362b51764044ce216be3c051" -event-emitter@~0.3.4: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - dependencies: - d "1" - es5-ext "~0.10.14" - events@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" +evp_bytestokey@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz#497b66ad9fef65cd7c08a6180824ba1476b66e53" + dependencies: + create-hash "^1.1.1" + expand-brackets@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" @@ -1369,7 +1020,7 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -express@^4.14.0: +express@^4.15.2: version "4.15.2" resolved "https://registry.yarnpkg.com/express/-/express-4.15.2.tgz#af107fc148504457f2dca9a6f2571d7129b97b35" dependencies: @@ -1420,23 +1071,11 @@ fastparse@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/fastparse/-/fastparse-1.1.1.tgz#d1e2643b38a94d7583b479060e6c4affc94071f8" -fbjs@^0.8.1, fbjs@^0.8.4: - version "0.8.12" - resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.12.tgz#10b5d92f76d45575fd63a217d4ea02bea2f8ed04" +file-loader@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.11.1.tgz#6b328ee1234a729e4e47d36375dd6d35c0e1db84" dependencies: - core-js "^1.0.0" - isomorphic-fetch "^2.1.1" - loose-envify "^1.0.0" - object-assign "^4.1.0" - promise "^7.1.1" - setimmediate "^1.0.5" - ua-parser-js "^0.7.9" - -file-loader@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-0.9.0.tgz#1d2daddd424ce6d1b07cfe3f79731bed3617ab42" - dependencies: - loader-utils "~0.2.5" + loader-utils "^1.0.2" filename-regex@^2.0.0: version "2.0.0" @@ -1483,11 +1122,15 @@ flatten@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" +for-in@^0.1.3: + version "0.1.8" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" + for-in@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" -for-own@^0.1.4: +for-own@^0.1.3, for-own@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" dependencies: @@ -1649,6 +1292,12 @@ has@^1.0.1: dependencies: function-bind "^1.0.2" +hash.js@^1.0.0, hash.js@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.0.3.tgz#1332ff00156c0a0ffdd8236013d07b77a0451573" + dependencies: + inherits "^2.0.1" + hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" @@ -1658,6 +1307,14 @@ hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" +hmac-drbg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.0.tgz#3db471f45aae4a994a0688322171f51b8b91bee5" + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" @@ -1677,23 +1334,6 @@ html-comment-regex@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e" -html-minify-loader@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/html-minify-loader/-/html-minify-loader-1.1.0.tgz#76a385809a2f114eb4705748a0b12dff034ded0b" - dependencies: - minimize "^1.8.1" - -htmlparser2@~3.9.0: - version "3.9.2" - resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.9.2.tgz#1bdf87acca0f3f9e53fa4fcceb0f4b4cbb00b338" - dependencies: - domelementtype "^1.3.0" - domhandler "^2.3.0" - domutils "^1.5.1" - entities "^1.1.1" - inherits "^2.0.1" - readable-stream "^2.0.2" - http-errors@~1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.1.tgz#5f8b8ed98aca545656bf572997387f904a722257" @@ -1715,10 +1355,6 @@ https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" -iconv-lite@~0.4.13: - version "0.4.15" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" - icss-replace-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz#cb0b6054eb3af6edc9ab1d62d01933e2d4c8bfa5" @@ -1745,32 +1381,32 @@ indexof@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" -inferno-component@^1.0.3: - version "1.5.6" - resolved "https://registry.yarnpkg.com/inferno-component/-/inferno-component-1.5.6.tgz#788928171f8c2b88a6a03aa0ed89a58e2f4fab7e" +inferno-component@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/inferno-component/-/inferno-component-1.6.0.tgz#ba5c4f04d3508950cd4c602d5c8df823b9628495" dependencies: - inferno "^1.5.6" - inferno-shared "^1.5.6" - inferno-vnode-flags "^1.5.1" + inferno "^1.6.0" + inferno-shared "^1.6.0" + inferno-vnode-flags "^1.6.0" -inferno-shared@^1.5.6: - version "1.5.6" - resolved "https://registry.yarnpkg.com/inferno-shared/-/inferno-shared-1.5.6.tgz#16b8af21605ff26e1474d96d198fba44fe3d9657" +inferno-shared@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/inferno-shared/-/inferno-shared-1.6.0.tgz#8b85ec17c7140a2fe1320e556df05accc4af7145" -inferno-vnode-flags@1.3.0-rc.1: - version "1.3.0-rc.1" - resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-1.3.0-rc.1.tgz#2f027cdb70db496708eeaaf30b54962b727adf85" - -inferno-vnode-flags@^1.5.1: +inferno-vnode-flags@1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-1.5.1.tgz#3b1b54ee5e9f167863b89e6bee1b19fd3941329f" -inferno@^1.0.3, inferno@^1.5.6: - version "1.5.6" - resolved "https://registry.yarnpkg.com/inferno/-/inferno-1.5.6.tgz#5e79973247727a6ea5befe4929c242c7d7665c72" +inferno-vnode-flags@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/inferno-vnode-flags/-/inferno-vnode-flags-1.6.0.tgz#a4937aad290aec2abe743db8221af57531b3c941" + +inferno@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/inferno/-/inferno-1.6.0.tgz#e5cb246dab5fee58738513fe0a9e4d725d65fb4b" dependencies: - inferno-shared "^1.5.6" - inferno-vnode-flags "^1.5.1" + inferno-shared "^1.6.0" + inferno-vnode-flags "^1.6.0" inflight@^1.0.4: version "1.0.6" @@ -1791,9 +1427,9 @@ ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" -interpret@^0.6.4: - version "0.6.6" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-0.6.6.tgz#fecd7a18e7ce5ca6abfb953e1f86213a49f1625b" +interpret@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.2.tgz#f4f623f0bb7122f15f5717c8e254b8161b5c5b2d" invariant@^2.2.0: version "2.2.2" @@ -1879,6 +1515,12 @@ is-plain-obj@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" +is-plain-object@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.1.tgz#4d7ca539bc9db9b737b8acb612f2318ef92f294f" + dependencies: + isobject "^1.0.0" + is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" @@ -1887,10 +1529,6 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" -is-stream@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - is-svg@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-2.1.0.tgz#cf61090da0d9efbcab8722deba6f032208dbb0e9" @@ -1913,19 +1551,16 @@ isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" +isobject@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-1.0.2.tgz#f0f9b8ce92dd540fa0740882e3835a2e022ec78a" + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" dependencies: isarray "1.0.0" -isomorphic-fetch@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" - dependencies: - node-fetch "^1.0.1" - whatwg-fetch ">=0.10.0" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -1963,9 +1598,9 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" -json-query@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/json-query/-/json-query-2.2.0.tgz#750bb1750f0f985a9ae267906a2d25754d529852" +json-loader@^0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.4.tgz#8baa1365a632f58a3c46d20175fc6002c96e37de" json-schema@0.2.3: version "0.2.3" @@ -1998,17 +1633,21 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" +kind-of@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5" + dependencies: + is-buffer "^1.0.2" + kind-of@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" dependencies: is-buffer "^1.0.2" -kuler@0.0.x: - version "0.0.0" - resolved "https://registry.yarnpkg.com/kuler/-/kuler-0.0.0.tgz#b66bb46b934e550f59d818848e0abba4f7f5553c" - dependencies: - colornames "0.0.2" +lazy-cache@^0.2.3: + version "0.2.7" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-0.2.7.tgz#7feddf2dcb6edb77d11ef1d117ab5ffdf0ab1b65" lazy-cache@^1.0.3: version "1.0.4" @@ -2030,7 +1669,11 @@ load-json-file@^1.0.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -loader-utils@^0.2.11, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@~0.2.2, loader-utils@~0.2.5: +loader-runner@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" + +loader-utils@^0.2.16: version "0.2.17" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" dependencies: @@ -2039,7 +1682,7 @@ loader-utils@^0.2.11, loader-utils@^0.2.15, loader-utils@^0.2.16, loader-utils@~ json5 "^0.5.0" object-assign "^4.0.1" -loader-utils@^1.0.2: +loader-utils@^1.0.1, loader-utils@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.1.0.tgz#c98aef488bcceda2ffb5e2de646d6a754429f5cd" dependencies: @@ -2047,51 +1690,34 @@ loader-utils@^1.0.2: emojis-list "^2.0.0" json5 "^0.5.0" -lodash._createcompounder@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/lodash._createcompounder/-/lodash._createcompounder-3.0.0.tgz#5dd2cb55372d6e70e0e2392fb2304d6631091075" - dependencies: - lodash.deburr "^3.0.0" - lodash.words "^3.0.0" - -lodash._root@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" - lodash.assign@^4.0.3, lodash.assign@^4.0.6, lodash.assign@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-4.2.0.tgz#0d99f3ccd7a6d261d19bdaeb9245005d285808e7" -lodash.camelcase@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-3.0.1.tgz#932c8b87f8a4377897c67197533282f97aeac298" - dependencies: - lodash._createcompounder "^3.0.0" +lodash.camelcase@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" lodash.clonedeep@^4.3.2: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" -lodash.deburr@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.deburr/-/lodash.deburr-3.2.0.tgz#6da8f54334a366a7cf4c4c76ef8d80aa1b365ed5" - dependencies: - lodash._root "^3.0.0" - lodash.memoize@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" +lodash.mergewith@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.0.tgz#150cf0a16791f5903b8891eab154609274bdea55" + +lodash.tail@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.tail/-/lodash.tail-4.1.1.tgz#d2333a36d9e7717c8ad2f7cacafec7c32b444664" + lodash.uniq@^4.3.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" -lodash.words@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.words/-/lodash.words-3.2.0.tgz#4e2a8649bc08745b17c695b1a3ce8fee596623b3" - dependencies: - lodash._root "^3.0.0" - lodash@^4.0.0, lodash@^4.14.0, lodash@^4.2.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -2104,7 +1730,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0, loose-envify@^1.1.0: +loose-envify@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -2124,12 +1750,6 @@ lru-cache@^4.0.1: pseudomap "^1.0.1" yallist "^2.0.0" -lru-queue@0.1: - version "0.1.0" - resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" - dependencies: - es5-ext "~0.10.2" - macaddress@^0.2.8: version "0.2.8" resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" @@ -2150,25 +1770,9 @@ media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" -memoizee@^0.3.9: - version "0.3.10" - resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.3.10.tgz#4eca0d8aed39ec9d017f4c5c2f2f6432f42e5c8f" - dependencies: - d "~0.1.1" - es5-ext "~0.10.11" - es6-weak-map "~0.1.4" - event-emitter "~0.3.4" - lru-queue "0.1" - next-tick "~0.2.2" - timers-ext "0.1" - -memory-fs@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" - -memory-fs@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.3.0.tgz#7bcc6b629e3a43e871d7e29aca6ae8a7f15cbb20" +memory-fs@^0.4.0, memory-fs@~0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" dependencies: errno "^0.1.3" readable-stream "^2.0.1" @@ -2214,6 +1818,13 @@ micromatch@^2.1.5: parse-glob "^3.0.4" regex-cache "^0.4.2" +miller-rabin@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.0.tgz#4a62fb1d42933c05583982f4c716f6fb9e6c6d3d" + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + mime-db@~1.27.0: version "1.27.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.27.0.tgz#820f572296bbd20ec25ed55e5b5de869e5436eb1" @@ -2224,17 +1835,25 @@ mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.15, mime-types@~2.1.7: dependencies: mime-db "~1.27.0" -mime@1.3.4: +mime@1.3.4, mime@1.3.x: version "1.3.4" resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53" +minimalistic-assert@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" + +minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + minimatch@^3.0.0, minimatch@^3.0.2, minimatch@~3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" dependencies: brace-expansion "^1.0.0" -minimist@0.0.8, minimist@~0.0.1: +minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" @@ -2242,17 +1861,12 @@ minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimize@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/minimize/-/minimize-1.8.1.tgz#a3674ade93f28a75ffa23b8e0f365cdc23d69d8b" +mixin-object@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e" dependencies: - argh "~0.1.4" - async "~1.5.2" - cli-color "~1.1.0" - diagnostics "~1.0.1" - emits "~3.0.0" - htmlparser2 "~3.9.0" - node-uuid "~1.4.7" + for-in "^0.1.3" + is-extendable "^0.1.1" "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" @@ -2272,21 +1886,6 @@ negotiator@0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9" -next-tick@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - -next-tick@~0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-0.2.2.tgz#75da4a927ee5887e39065880065b7336413b310d" - -node-fetch@^1.0.1: - version "1.6.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.6.3.tgz#dc234edd6489982d58e8f0db4f695029abcd8c04" - dependencies: - encoding "^0.1.11" - is-stream "^1.0.1" - node-gyp@^3.3.1: version "3.6.0" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.6.0.tgz#7474f63a3a0501161dda0b6341f022f14c423fa6" @@ -2305,16 +1904,16 @@ node-gyp@^3.3.1: tar "^2.0.0" which "1" -node-libs-browser@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-0.7.0.tgz#3e272c0819e308935e26674408d7af0e1491b83b" +node-libs-browser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-2.0.0.tgz#a3a59ec97024985b46e958379646f96c4b616646" dependencies: assert "^1.1.1" browserify-zlib "^0.1.4" - buffer "^4.9.0" + buffer "^4.3.0" console-browserify "^1.1.0" constants-browserify "^1.0.0" - crypto-browserify "3.3.0" + crypto-browserify "^3.11.0" domain-browser "^1.1.1" events "^1.0.0" https-browserify "0.0.1" @@ -2347,9 +1946,9 @@ node-pre-gyp@^0.6.29: tar "^2.2.1" tar-pack "^3.4.0" -node-sass@^3.10.0: - version "3.13.1" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-3.13.1.tgz#7240fbbff2396304b4223527ed3020589c004fc2" +node-sass@^4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.5.2.tgz#4012fa2bd129b1d6365117e88d9da0500d99da64" dependencies: async-foreach "^0.1.3" chalk "^1.1.1" @@ -2360,17 +1959,15 @@ node-sass@^3.10.0: in-publish "^2.0.0" lodash.assign "^4.2.0" lodash.clonedeep "^4.3.2" + lodash.mergewith "^4.6.0" meow "^3.7.0" mkdirp "^0.5.1" nan "^2.3.2" node-gyp "^3.3.1" npmlog "^4.0.0" - request "^2.61.0" + request "^2.79.0" sass-graph "^2.1.1" - -node-uuid@~1.4.7: - version "1.4.8" - resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.8.tgz#b040eb0923968afabf8d32fb1f17f1167fdab907" + stdout-stream "^1.4.0" "nopt@2 || 3": version "3.0.6" @@ -2457,13 +2054,6 @@ once@^1.3.0, once@^1.3.3: dependencies: wrappy "1" -optimist@~0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - os-browserify@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.2.1.tgz#63fc4ccee5d2d7763d26bbf8601078e6c2e0044f" @@ -2493,10 +2083,20 @@ pako@~0.2.0: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" -papaparse@^4.1.2: +papaparse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-4.2.0.tgz#ac5bed7de39445dabb6616a507024b8b88eee7c3" +parse-asn1@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.0.tgz#37c4f9b7ed3ab65c74817b5f2480937fbf97c712" + dependencies: + asn1.js "^4.0.0" + browserify-aes "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.0" + pbkdf2 "^3.0.3" + parse-glob@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" @@ -2542,15 +2142,17 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -pbkdf2-compat@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz#b6e0c8fa99494d94e0511575802a59a5c142f288" +pbkdf2@^3.0.3: + version "3.0.9" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.9.tgz#f2c4b25a600058b3c3773c086c37dbbee1ffe693" + dependencies: + create-hmac "^1.1.2" performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" -pify@^2.0.0: +pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -2828,12 +2430,6 @@ process@^0.11.0: version "0.11.9" resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1" -promise@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/promise/-/promise-7.1.1.tgz#489654c692616b8aa55b0724fa809bb7db49c5bf" - dependencies: - asap "~2.0.3" - proxy-addr@~1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-1.1.4.tgz#27e545f6960a44a627d9b44467e35c1b6b4ce2f3" @@ -2849,6 +2445,16 @@ pseudomap@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +public-encrypt@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" + dependencies: + bn.js "^4.1.0" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + parse-asn1 "^5.0.0" + randombytes "^2.0.1" + punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" @@ -2887,46 +2493,23 @@ randomatic@^1.1.3: is-number "^2.0.2" kind-of "^3.0.2" +randombytes@^2.0.0, randombytes@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.3.tgz#674c99760901c3c4112771a31e521dc349cc09ec" + range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" rc@^1.1.7: - version "1.2.0" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.0.tgz#c7de973b7b46297c041366b2fd3d2363b1697c66" + version "1.2.1" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" dependencies: deep-extend "~0.4.0" ini "~1.3.0" minimist "^1.2.0" strip-json-comments "~2.0.1" -react-dom@^15.3.2: - version "15.4.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.4.2.tgz#015363f05b0a1fd52ae9efdd3a0060d90695208f" - dependencies: - fbjs "^0.8.1" - loose-envify "^1.1.0" - object-assign "^4.1.0" - -react-input-autosize@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/react-input-autosize/-/react-input-autosize-1.1.0.tgz#3fe1ac832387d8abab85f6051ceab1c9e5570853" - -react-select@^1.0.0-rc.2: - version "1.0.0-rc.3" - resolved "https://registry.yarnpkg.com/react-select/-/react-select-1.0.0-rc.3.tgz#94ade090522153067eff09282d0525249ea1d9e3" - dependencies: - classnames "^2.2.4" - react-input-autosize "^1.1.0" - -react@^15.3.2: - version "15.4.2" - resolved "https://registry.yarnpkg.com/react/-/react-15.4.2.tgz#41f7991b26185392ba9bae96c8889e7e018397ef" - dependencies: - fbjs "^0.8.4" - loose-envify "^1.1.0" - object-assign "^4.1.0" - read-pkg-up@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" @@ -2992,14 +2575,6 @@ regenerator-runtime@^0.10.0: version "0.10.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" -regenerator-transform@0.9.8: - version "0.9.8" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c" - dependencies: - babel-runtime "^6.18.0" - babel-types "^6.19.0" - private "^0.1.6" - regex-cache@^0.4.2: version "0.4.3" resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" @@ -3015,14 +2590,6 @@ regexpu-core@^1.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" -regexpu-core@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" - dependencies: - regenerate "^1.2.1" - regjsgen "^0.2.0" - regjsparser "^0.1.4" - regjsgen@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" @@ -3051,7 +2618,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@2, request@^2.61.0, request@^2.81.0: +request@2, request@^2.79.0, request@^2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" dependencies: @@ -3098,9 +2665,9 @@ rimraf@2, rimraf@^2.5.1, rimraf@^2.6.1: dependencies: glob "^7.0.5" -ripemd160@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce" +ripemd160@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e" safe-buffer@^5.0.1: version "5.0.1" @@ -3114,13 +2681,15 @@ sass-graph@^2.1.1: lodash "^4.0.0" yargs "^4.7.1" -sass-loader@^4.0.2: - version "4.1.1" - resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-4.1.1.tgz#79ef9468cf0bf646c29529e1f2cba6bd6e51c7bc" +sass-loader@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-6.0.3.tgz#33983b1f90d27ddab0e57d0dac403dce9bc7ecfd" dependencies: - async "^2.0.1" - loader-utils "^0.2.15" - object-assign "^4.1.0" + async "^2.1.5" + clone-deep "^0.2.4" + loader-utils "^1.0.1" + lodash.tail "^4.1.1" + pify "^2.3.0" sax@~1.2.1: version "1.2.2" @@ -3165,7 +2734,7 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" -setimmediate@^1.0.4, setimmediate@^1.0.5: +setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -3173,9 +2742,20 @@ setprototypeof@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.3.tgz#66567e37043eeb4f04d91bd658c0cbefb55b8e04" -sha.js@2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.2.6.tgz#17ddeddc5f722fb66501658895461977867315ba" +sha.js@^2.3.6: + version "2.4.8" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f" + dependencies: + inherits "^2.0.1" + +shallow-clone@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-0.1.2.tgz#5909e874ba77106d73ac414cfec1ffca87d97060" + dependencies: + is-extendable "^0.1.1" + kind-of "^2.0.1" + lazy-cache "^0.2.3" + mixin-object "^2.0.1" signal-exit@^3.0.0: version "3.0.2" @@ -3197,26 +2777,24 @@ sort-keys@^1.0.0: dependencies: is-plain-obj "^1.0.0" -source-list-map@^0.1.4, source-list-map@~0.1.7: +source-list-map@^0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106" +source-list-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.1.tgz#1a33ac210ca144d1e561f906ebccab5669ff4cb4" + source-map-support@^0.4.2: version "0.4.14" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef" dependencies: source-map "^0.5.6" -source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1: +source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.3: version "0.5.6" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" -source-map@~0.4.1: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - dependencies: - amdefine ">=0.0.4" - spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -3254,6 +2832,12 @@ sshpk@^1.7.0: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" +stdout-stream@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.0.tgz#a2c7c8587e54d9427ea9edb3ac3f2cd522df378b" + dependencies: + readable-stream "^2.0.1" + stream-browserify@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" @@ -3275,7 +2859,7 @@ strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" -string-width@^1.0.1: +string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" dependencies: @@ -3313,9 +2897,9 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -style-loader@^0.13.1: - version "0.13.2" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.13.2.tgz#74533384cf698c7104c7951150b49717adc2f3bb" +style-loader@^0.16.1: + version "0.16.1" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.16.1.tgz#50e325258d4e78421dd9680636b41e8661595d10" dependencies: loader-utils "^1.0.2" @@ -3341,9 +2925,9 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" -tapable@^0.1.8, tapable@~0.1.8: - version "0.1.10" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.1.10.tgz#29c35707c2b70e50d07482b5d202e8ed446dafd4" +tapable@^0.2.5, tapable@~0.2.5: + version "0.2.6" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-0.2.6.tgz#206be8e188860b514425375e6f1ae89bfb01fd8d" tar-pack@^3.4.0: version "3.4.0" @@ -3366,23 +2950,12 @@ tar@^2.0.0, tar@^2.2.1: fstream "^1.0.2" inherits "2" -text-hex@0.0.x: - version "0.0.0" - resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-0.0.0.tgz#578fbc85a6a92636e42dd17b41d0218cce9eb2b3" - timers-browserify@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.2.tgz#ab4883cf597dcd50af211349a00fbca56ac86b86" dependencies: setimmediate "^1.0.4" -timers-ext@0.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.1.tgz#d6422f1ebd67772355f46c93f25e3933992c8b08" - dependencies: - es5-ext "~0.10.14" - next-tick "1" - to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" @@ -3426,18 +2999,14 @@ type-is@~1.6.14: media-typer "0.3.0" mime-types "~2.1.15" -ua-parser-js@^0.7.9: - version "0.7.12" - resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb" - -uglify-js@~2.7.3: - version "2.7.5" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" +uglify-js@^2.8.5: + version "2.8.21" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.21.tgz#1733f669ae6f82fc90c7b25ec0f5c783ee375314" dependencies: - async "~0.2.6" source-map "~0.5.1" - uglify-to-browserify "~1.0.0" yargs "~3.10.0" + optionalDependencies: + uglify-to-browserify "~1.0.0" uglify-to-browserify@~1.0.0: version "1.0.2" @@ -3465,6 +3034,13 @@ unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" +url-loader@^0.5.8: + version "0.5.8" + resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.5.8.tgz#b9183b1801e0f847718673673040bc9dc1c715c5" + dependencies: + loader-utils "^1.0.2" + mime "1.3.x" + url@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -3517,44 +3093,45 @@ vm-browserify@0.0.4: dependencies: indexof "0.0.1" -watchpack@^0.2.1: - version "0.2.9" - resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-0.2.9.tgz#62eaa4ab5e5ba35fdfc018275626e3c0f5e3fb0b" +watchpack@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.3.1.tgz#7d8693907b28ce6013e7f3610aa2a1acf07dad87" dependencies: - async "^0.9.0" - chokidar "^1.0.0" + async "^2.1.2" + chokidar "^1.4.3" graceful-fs "^4.1.2" -webpack-core@~0.6.9: - version "0.6.9" - resolved "https://registry.yarnpkg.com/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2" +webpack-sources@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.2.3.tgz#17c62bfaf13c707f9d02c479e0dcdde8380697fb" dependencies: - source-list-map "~0.1.7" - source-map "~0.4.1" + source-list-map "^1.1.1" + source-map "~0.5.3" -webpack@^1.13.2: - version "1.14.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-1.14.0.tgz#54f1ffb92051a328a5b2057d6ae33c289462c823" +webpack@^2.3.3: + version "2.3.3" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.3.3.tgz#eecc083c18fb7bf958ea4f40b57a6640c5a0cc78" dependencies: - acorn "^3.0.0" - async "^1.3.0" - clone "^1.0.2" - enhanced-resolve "~0.9.0" - interpret "^0.6.4" - loader-utils "^0.2.11" - memory-fs "~0.3.0" + acorn "^4.0.4" + acorn-dynamic-import "^2.0.0" + ajv "^4.7.0" + ajv-keywords "^1.1.1" + async "^2.1.2" + enhanced-resolve "^3.0.0" + interpret "^1.0.0" + json-loader "^0.5.4" + loader-runner "^2.3.0" + loader-utils "^0.2.16" + memory-fs "~0.4.1" mkdirp "~0.5.0" - node-libs-browser "^0.7.0" - optimist "~0.6.0" + node-libs-browser "^2.0.0" + source-map "^0.5.3" supports-color "^3.1.0" - tapable "~0.1.8" - uglify-js "~2.7.3" - watchpack "^0.2.1" - webpack-core "~0.6.9" - -whatwg-fetch@>=0.10.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" + tapable "~0.2.5" + uglify-js "^2.8.5" + watchpack "^1.3.1" + webpack-sources "^0.2.3" + yargs "^6.0.0" whet.extend@~0.9.9: version "0.9.9" @@ -3588,10 +3165,6 @@ wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -3622,6 +3195,12 @@ yargs-parser@^2.4.1: camelcase "^3.0.0" lodash.assign "^4.0.6" +yargs-parser@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + dependencies: + camelcase "^3.0.0" + yargs@^4.7.1: version "4.8.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-4.8.1.tgz#c0c42924ca4aaa6b0e6da1739dfb216439f9ddc0" @@ -3641,6 +3220,24 @@ yargs@^4.7.1: y18n "^3.2.1" yargs-parser "^2.4.1" +yargs@^6.0.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^4.2.0" + yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"