From 7176d5cda58fa9c5d210ae0150989a1c8581ab5e Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 15 Jan 2018 22:57:57 -0500 Subject: [PATCH 01/80] Initial commit --- SmearcarDB/LICENSE | 674 +++++++++++++++++++++++++++++++++++++++++++ SmearcarDB/README.md | 1 + 2 files changed, 675 insertions(+) create mode 100644 SmearcarDB/LICENSE create mode 100644 SmearcarDB/README.md diff --git a/SmearcarDB/LICENSE b/SmearcarDB/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/SmearcarDB/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/SmearcarDB/README.md b/SmearcarDB/README.md new file mode 100644 index 0000000..492ec03 --- /dev/null +++ b/SmearcarDB/README.md @@ -0,0 +1 @@ +# smearcar-db \ No newline at end of file From 487224c93fcda61fc3447077744f5a5c7fb59044 Mon Sep 17 00:00:00 2001 From: yamanq Date: Tue, 16 Jan 2018 14:13:19 -0500 Subject: [PATCH 02/80] initialize simple server requests --- SmearcarDB/server.py | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 SmearcarDB/server.py diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py new file mode 100644 index 0000000..abebe66 --- /dev/null +++ b/SmearcarDB/server.py @@ -0,0 +1,52 @@ +import pickle +from flask import Flask +from flask import render_template, jsonify, request +import time +import random +app = Flask(__name__) + +try: + database = pickle.load(open("save.p", "rb")) +except (FileNotFoundError) as e: + database = {'languages': [], + 'phonemes': [], + 'values': []} + + +# Render the client at the default URL +@app.route("/") +def initial(): + return render_template('index.html') + +# Place for client to communicate with the server +@app.route("/server", methods=["GET", "POST"]) +def backend(): + # Get method returns the latest database + if request.method == "GET": + return jsonify(database) + + # Post method currently appends to the languages + # TODO add more methods + elif request.method == "POST": + newlanguage = request.get_json() + database.values.append(newlanguage) + + # Add new phonemes + newphonemes = list(newlanguage.phonemes) + uniquephonemes = list(set(newphonemes) - set(database.phonemes)) + database.phonemes = database.phonemes + uniquephonemes + + # Add new language + newlang = list(newlanguage.name) + uniquelanguages = list(set(newlang) - set(database.languages)) + database.languages = database.languages + uniquelanguages + + + pickle.dump(database, open("newestsave.p", "wb")) + return jsonify(database) + + else: + return + +if __name__ == "__main__": + app.run(host="0.0.0.0") From e49ca04079a117fbd39be827b6291bf971fc6dfb Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Tue, 16 Jan 2018 22:00:32 -0500 Subject: [PATCH 03/80] improved server.py --- SmearcarDB/.gitignore | 2 ++ SmearcarDB/server.py | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 SmearcarDB/.gitignore diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore new file mode 100644 index 0000000..539f938 --- /dev/null +++ b/SmearcarDB/.gitignore @@ -0,0 +1,2 @@ +*.p +venv \ No newline at end of file diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index abebe66..3ae455a 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -6,7 +6,8 @@ import random app = Flask(__name__) try: - database = pickle.load(open("save.p", "rb")) + with open("save.p", "rb") as f: + database = pickle.load(f) except (FileNotFoundError) as e: database = {'languages': [], 'phonemes': [], @@ -29,20 +30,22 @@ def backend(): # TODO add more methods elif request.method == "POST": newlanguage = request.get_json() - database.values.append(newlanguage) + database['values'].append(newlanguage) # Add new phonemes - newphonemes = list(newlanguage.phonemes) - uniquephonemes = list(set(newphonemes) - set(database.phonemes)) - database.phonemes = database.phonemes + uniquephonemes + newphonemes = list(newlanguage[ 'phonemes' ]) + uniquephonemes = list(set(newphonemes) - set(database[ 'phonemes' ])) + database['phonemes'] = database['phonemes'] + uniquephonemes # Add new language - newlang = list(newlanguage.name) - uniquelanguages = list(set(newlang) - set(database.languages)) - database.languages = database.languages + uniquelanguages + newlang = {newlanguage['name']} + uniquelanguages = list(newlang - set(database['languages'])) + database['languages'] = database['languages'] + uniquelanguages + # Save copy under separate name + with open("newestsave.p", "wb") as f: + pickle.dump(database, f) - pickle.dump(database, open("newestsave.p", "wb")) return jsonify(database) else: From 01ebbacb01a6a9c072fd5beb97c93054c09301c2 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 20 Jan 2018 19:35:27 -0500 Subject: [PATCH 04/80] Edit flask run settings, auto_reload and debug --- SmearcarDB/server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 3ae455a..cbba62e 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -4,6 +4,10 @@ from flask import render_template, jsonify, request import time import random app = Flask(__name__) +app.config.update( + DEBUG=True, + TEMPLATES_AUTO_RELOAD=True +) try: with open("save.p", "rb") as f: From bcd7b5a2b7e9f33a8019aeb00e57f2870c0800f3 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 20 Jan 2018 19:37:14 -0500 Subject: [PATCH 05/80] .gitignore pycache + basic web layout --- SmearcarDB/.gitignore | 3 +- SmearcarDB/static/font-awesome.min.css | 4 ++ SmearcarDB/static/index.css | 87 ++++++++++++++++++++++++++ SmearcarDB/static/index.js | 20 ++++++ SmearcarDB/templates/index.html | 24 +++++++ 5 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 SmearcarDB/static/font-awesome.min.css create mode 100644 SmearcarDB/static/index.css create mode 100644 SmearcarDB/static/index.js create mode 100644 SmearcarDB/templates/index.html diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore index 539f938..2b63d07 100644 --- a/SmearcarDB/.gitignore +++ b/SmearcarDB/.gitignore @@ -1,2 +1,3 @@ *.p -venv \ No newline at end of file +venv +__pycache__/ \ No newline at end of file diff --git a/SmearcarDB/static/font-awesome.min.css b/SmearcarDB/static/font-awesome.min.css new file mode 100644 index 0000000..540440c --- /dev/null +++ b/SmearcarDB/static/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css new file mode 100644 index 0000000..6e5289a --- /dev/null +++ b/SmearcarDB/static/index.css @@ -0,0 +1,87 @@ +html { + width: 100%; + height: 100%; +} + +body { + margin: 0; + padding: 0; + height: 100%; + font-family: 'Open Sans Condensed', sans-serif; + color: white; + display: grid; + grid-template-columns: 13% auto; + grid-template-rows: 8% auto; +} + +h1,h2,h3,h4,h5,p { + margin: 0; +} + +.colorFade { + -webkit-transition: background-color 0.3s ease; + -moz-transition: background-color 0.3s ease; + -ms-transition: background-color 0.3s ease; + transition: background-color 0.3s ease; +} + +#header1 { + grid-column: 1; + grid-row: 1; + background-color: #F47922; + text-align: center; + cursor: pointer; + display: grid; +} + +#header1 h1 { + margin: auto 0 auto 0; + font-weight: 300; +} + +#header1:hover { + background-color: #F88A3C; +} + +#header2 { + grid-column: 2; + grid-row: 1; + background-color: #524948; +} + +#sidebar { + grid-column: 1; + grid-row: 2; + background-color: #524948; +} + +.navi { + width: 100%; + height: 6vh; + cursor: pointer; + display: grid; + grid-template-columns: 1fr 3fr 7fr; +} + +.navi:hover { + background-color: rgba(255,255,255,0.1); +} + +.navi i { + grid-column: 2; + text-align: center; + margin: auto 0 auto 0; + font-size: 130%; +} + +.navi p { + grid-column: 3; + margin: auto 0 auto 0; + font-size: 110%; +} + +#mainContainer { + grid-column: 2; + grid-row: 2; + background-color: #FEFEFF; +} diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js new file mode 100644 index 0000000..36a85b0 --- /dev/null +++ b/SmearcarDB/static/index.js @@ -0,0 +1,20 @@ +var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text]. + ["bar-chart", "Data Values"], + ["database", "Database and Files"], + ["bell", "Updates and Progress"] +]; + +for(var i = 0; i < navi.length; i++) { // Create navigation tabs. + var side = document.getElementById("sidebar"); + var div = document.createElement("div"); + div.className = "navi colorFade"; + var ic = document.createElement("i"); + ic.className = "fa fa-"+navi[i][0]; + ic["aria-hidden"] = true; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(navi[i][1])); + div.appendChild(ic); + div.appendChild(p); + side.appendChild(div); +} + diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html new file mode 100644 index 0000000..09d338b --- /dev/null +++ b/SmearcarDB/templates/index.html @@ -0,0 +1,24 @@ + + + + + SmearcarDB + + + + + + +
+

/smirkär/

+
+
+
+ +
+
+ + + + \ No newline at end of file From ba49f613340b0bc6c5fb156f5db9980e5cefa9c8 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 20 Jan 2018 21:35:29 -0500 Subject: [PATCH 06/80] added jquery, animations, favicon --- SmearcarDB/static/index.css | 63 +++++++++++++++++++++--- SmearcarDB/static/index.js | 42 ++++++++++++++-- SmearcarDB/static/resources/favicon.ico | Bin 0 -> 15086 bytes SmearcarDB/templates/index.html | 38 +++++++++++++- 4 files changed, 129 insertions(+), 14 deletions(-) create mode 100644 SmearcarDB/static/resources/favicon.ico diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 6e5289a..07ff414 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -1,3 +1,4 @@ +/* Layout Elements and General Formatting */ html { width: 100%; height: 100%; @@ -12,17 +13,18 @@ body { display: grid; grid-template-columns: 13% auto; grid-template-rows: 8% auto; + overflow: hidden; } h1,h2,h3,h4,h5,p { margin: 0; } -.colorFade { - -webkit-transition: background-color 0.3s ease; - -moz-transition: background-color 0.3s ease; - -ms-transition: background-color 0.3s ease; - transition: background-color 0.3s ease; +.transition { + -webkit-transition: all 0.3s cubic-bezier(.25,.8,.25,1); + -moz-transition: all 0.3s cubic-bezier(.25,.8,.25,1); + -ms-transition: all 0.3s cubic-bezier(.25,.8,.25,1); + transition: all 0.3s cubic-bezier(.25,.8,.25,1); } #header1 { @@ -64,7 +66,7 @@ h1,h2,h3,h4,h5,p { } .navi:hover { - background-color: rgba(255,255,255,0.1); + background-color: rgba(255,255,255,0.1) !important; } .navi i { @@ -83,5 +85,52 @@ h1,h2,h3,h4,h5,p { #mainContainer { grid-column: 2; grid-row: 2; - background-color: #FEFEFF; + padding: 2vh; + background-color: #F8F3F0; + overflow-y: auto; } + +.card { + background-color: #FEFEFE; + box-shadow: 1px 1px 1px 1px #000; + border-radius: 2px; + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); + transition: all 0.3s cubic-bezier(.25,.8,.25,1); +} + +.card:hover { + box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); +} + +/* Main Body */ + +#home, #dataValues, #files, #updates { + width: 100%; + height: 100%; + display: none; + opacity: 0; + grid-gap: 2vh; + grid-template-columns: 1fr 1fr; + grid-template-rows: 2fr 4fr 4fr; + transition: opacity 0.3s cubic-bezier(.25,.8,.25,1); +} + +#home { + display: grid; + opacity: 1; +} + +#langSelect { + grid-column: 1; + grid-row: 1; +} + +#dataInfo { + grid-column: 2; + grid-row: 1; +} + +#dataTable { + grid-column: 1 / 3; + grid-row: 2; +} \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 36a85b0..a35e8ca 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,13 +1,22 @@ -var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text]. - ["bar-chart", "Data Values"], - ["database", "Database and Files"], - ["bell", "Updates and Progress"] +var navSelect = "home"; + +var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. + ["home", "Home", "home"], + ["bar-chart", "Data Values", "dataValues"], + ["database", "Database and Files", "files"], + ["bell", "Updates and Progress", "updates"] ]; for(var i = 0; i < navi.length; i++) { // Create navigation tabs. var side = document.getElementById("sidebar"); var div = document.createElement("div"); - div.className = "navi colorFade"; + div.className = "navi transition"; + div.setAttribute("option", navi[i][2]); + div.onclick = function() { + var op = this.getAttribute("option"); + if(navSelect === op) return; + updateMain(op); + }; var ic = document.createElement("i"); ic.className = "fa fa-"+navi[i][0]; ic["aria-hidden"] = true; @@ -18,3 +27,26 @@ for(var i = 0; i < navi.length; i++) { // Create navigation tabs. side.appendChild(div); } +updateNav(navSelect); + +function updateMain(op) { + updateNav(op); + document.getElementById(navSelect).style.opacity = "0"; + setTimeout(function() { + document.getElementById(navSelect).style.display = "none"; + document.getElementById(op).style.display = "grid"; + setTimeout(function() { + document.getElementById(op).style.opacity = "1"; + }, 30); + navSelect = op; + }, 300); +} + +function updateNav(op) { + var oldNav = document.querySelectorAll("[option="+navSelect+"]")[0]; + var newNav = document.querySelectorAll("[option="+op+"]")[0]; + oldNav.style.backgroundColor = "rgba(0,0,0,0)"; + oldNav.style.color = "white"; + newNav.style.backgroundColor = "#F8F3F0"; + newNav.style.color = "#F47922"; +} diff --git a/SmearcarDB/static/resources/favicon.ico b/SmearcarDB/static/resources/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..5bcf53de2fc7b56e413967d8f189529a79e9ed08 GIT binary patch literal 15086 zcmdU$X^>Ra6~`YE^#dQIN~_e0(J>+-N(||HW|*4Ht2%T0 z-Fxmi|9kJb%RA?e=k@dYd&7r&N*lcSM|$2DJsBqMRr$=4yP%Ko&BQ-LI?oYSok6 z{Y4W+t)gmJx|@$|bnIUXOJ~a@Z#(MS9fv!=V#Tn+8jQ*mrqMq#YYVAQM zy8DN5#d%k~y+s#@c8IF!=;?fPgJJJDn2ksL^gH!-iFz7iJ^5e&OYCtF?>JF!_ItQZ zU>RrqTPqdcXi;z2dl+;09ZaL^U_U@SOGM$i|1a-gJD^${RL0u7C-$VCYA@I(M&Vcf zP*IDhLigbpw>c=PtUGyKlnch8!8Yifa{>Ez1;(LQw7Jn!+TG``Y_BMb;*Xm*0_kn#qI7KO@6Z2`m8Pjon*8mcNm8pCt1xopo-f#_hScv+n2jCf%%MX}5Y~&Yh)pedeMz zcj9&J?%j`a?wt>F?gY&->PN|~k_Tq6^DR{K+hef$>+%0&Tt;|)dUy0#)230Hk1Jcn zr0318Irqpb8TaU_j9a%k=XSK`-F8tn=iD#vOZxo}uKQn<0qObOgQ?Ei5SYP!Cvs{L zV?X|Zl*{LxoBwjg9dSt|KlbqJc?F)=-_N;|rtY4TBQ$20{Wax2_&D!!l41Cfd(NDs zKTeBY%ebR1tCU*{R}nkkq&4x=x2$zRzvT@o0 zQU77t6OZ9XE@ji6Dzy8$MID{BA+X~csEePmKI^umOQ;DeG(TDY%GO2UV2oD1n{_e~ zw`^V3{c3K~eQQR-op5ctKkpw~U5OvL%z5U=E1Em(le9GsrXu!O--KWt*3{-++)!9s zzIRjQUO-=dM>c>hv;HvOS%2P_&0%|B4BEe8WL;glHsexi-Vg7LULTA%l$w7gR(t8I ztN&gY>sia9_X66$*s#}Kr1gEK_~vSjVf~^VQTUNN;o*Yq-Sd2>_5$$7vLD(FHroqW zW3ch?So6+Y!1f`qQI9=~vjX^8bI7;8q}=v`mTfurW!W2fR$e0od#w3uGHfqk9cNDp z;sE!FkxxYG;}FdU%EI#O zow~LcOx2!X{bJ>z)Xoo_fvTS0LUnxI;4SP0dH2j)S;sey^(i`;e>0x$a92Fm;hzbP zoz(8G(HRzOBd@8P^QHs2wim44nDxh_Mtkl2R`dL9vV&=GFW8mJyE9}nHU^|;+??>w z^=ou)V+=Ugan5A@=R94jU$L(xvVZ15c%2Gj&~N|zT>J)z{C)}XmyJ6(oBr0}+Jrwi z*1`Utr2c0w;LIPV|Ivrs3$_02(*AerKWgp;{`X4}f8_ULE&PlDcFlM!~8vYS|W0-QoZo^W7Y5XC>@p;h11Hqlg5x+_WfQQgR1_M?qKPG zx-F7f=05>HkMjGh|Eh?;Px}vxZRoT9Tk!M9j{2ecN}+P%%_KM!2C1jC!h=-c=>MX_Wc>>TK9F%^GcNRyu*0k>3RE+HhW%w z(k9&_A_chqg=LxINZRYq#}-y2S67Qa?2p`_1~%`c;gDzAp4T_p};BCy7e;v3yUrcfvgcxy25$lYZR>$#g!kI51E?L)gP5J zUOl1PFe3Z-Cj6o)vi?jWPYr{FEObBL+jC(4WKPgL_H+{-k1Q z`0E*eus*9;{$J!*G+!Pu58^uXm*I~{(H*&`(N^ShN9E!LyM5{8|3J2dADK22(|btq zj;)Ge->m*eKlCHTEEvB!v0rpY>IW;j?)qoiEmzEwc#q*n{ugAIXKStziz7a}X?tP( zDWe{9h&T)5M4r_RrRa|AfB2|3RysDy*6fZ8vWY>Rt~e)i10VhA@@v!9%L6e7>f)EL z6MIEBHV}!=A8*B08Sk0$`(p#h{n(V(2QR)_=1Gm%shyc3 z^;;jX7I3GCK1V+HUbw#m4r1o``SFFDZfg(s7FY|gMav7Nc3vx6e}X)=7SIm#(SGX# z;{NnM@esy27;{4ge1A~TCcbv! z1;h%%`oYdxuu5~~{JFd5P*I1izh(PRlz!}hb?2+HJG*1TK3Dp!HNbv{>yuACKR%>7 zfpUNUDei$~`)`1!#Lw8$o~W{VdDIKpMrr>I?7_Wu{wQMTweuJHdDM@+cK$3N@G&$B zM^BuA>z=;@7<%pdBY>gTzP|z(dhPquFp$a~dhGk#?cC3~rhZQThDq{0G~!Ocwa_Xr zMYCKDP?KB;MqZuA_(+?J^;;zinaD;5y3mPk{1mt)8bl>Oh5py9)}#K|M>Iw>Pqb0Q zUIOu(Jj(WolA-(qMKeU(Mb*|*%HTOLC`0eqHb-*NX$?>@1v+n&sC&U?q`jEbHj&o=6c=90&miSHxM66hMPa~gXi=X~yn zv6n~O`<<)$^sQg#(uFDiOv71!qRxMO18`Qp?}fB~$AI%-=sVEH$ghtc&I{n>E&+Ec zeyg+ky{Zo$?tpP#2<%xlzJ8myivSPja?U;6&$&u>Bsu4B2H+kLM8AMpWVYeIlTVv3 z(A`n?xAN=%z{|+wB71ydB=O4~RoXNkdZ$J8!Js&)Q?^o(F z28@L-10L?c@V$l}&ewL&lyTzx%sG!SFV@8dum!^u?4MGem4mTp1HS!W$13Zx{n|W` ij4scgfQ(Mh-;{j7t@wN8&1=HnDysHaIlR=N?*9OfLI)85 literal 0 HcmV?d00001 diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 09d338b..bd05af7 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -3,10 +3,13 @@ SmearcarDB - + + + +
@@ -17,8 +20,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- \ No newline at end of file From ee250125980f088e8489c9e55035258ec3356388 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 20 Jan 2018 21:55:50 -0500 Subject: [PATCH 07/80] change favicon --- SmearcarDB/static/resources/favicon.ico | Bin 15086 -> 67646 bytes SmearcarDB/templates/index.html | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/static/resources/favicon.ico b/SmearcarDB/static/resources/favicon.ico index 5bcf53de2fc7b56e413967d8f189529a79e9ed08..c8f6c81beeb1f941e086691abae1f5dfda082a2f 100644 GIT binary patch literal 67646 zcmeI5dyo{x9mf~63d=I4ER|Rx-W`@2qDe$jF(zWESkXMpA2H^Ski=Lh7&TIIr=pE%XYrM*_qwhx!K*GnVy-R z+dZn8?U|mQp5Ny;Jw4t1`*kQZ3jbIaYW=99vUyYatb?oYdvV3A zgEPu!)?b1&lgeius3^aw@mR|#rVCZATks7*?Z(odP6A*%9^p-qjPvE?8-Gm?DqHICU3scb z1V#B1jE+I5MTqC)CHk1}{8M@mNBdy&$=B|tK82$C1J5xC(?xUT%})~knf793^L1z+ z990ZT07hdGns`~ckxn}PR3D)Kaon_b$Bkqi0Lyu9@U)tzl>F7U0s0o_k2D7VuK=Mzu3F;wZDaR1N@OXq)uUXo;USRpBbfB&5#(gKsRu2S) zJ?TrJ`Kvl0Lp=aljzXaKz4UcHao0lN`K#{&Y7gL^e4T@a>r36%)0peGBZ5Ea0NR9p zz6T&vslM^Pb!Uvtd3k`<{Ws2l#gJTs6x44+uk`@zrRdu^V_uA1^Y?zX{YxYgtgo*xE7Z3{ z*`xpJV!!-rm`%8iPX|t)-OjFhGQzHWqHu6ir^;t}+eZZU)Tf(%pZfLts^y1RB$j%< zdD&AsGya-B^z_D9duNP2{90GRdVuN;?Yu%;H~CZEUiB4&HI3!?+Mj>+{1|)v;~^`^ zv(o0{ujkm&6=M%<=w#oSYhEA7#2;fuVK2svz~0w!yo(p~DevI13xQ=0|jhHkb4z~0yK`>9VJVgo}-i?oL)x5J-wVf_c)Y*KZmttcJ;)O)~{`2%22 z^LBiD=U@J}L&HJZ++&wN=|H4A#x8jFZuaKK-R$!NQSN8B5aWEu zUFU70Pa@`)gMF=^{5$)s*ZT?d_3ds-um@frU{fCI8>YKv{l6F9*TLqk?PRr|^svUZ zm~fr&gFo39IH?1`o$PWvwaw7$+I_DMSbp{!!U=ZagMI9@xw-2sGyZx$XWZV-rY?!F z1MTAUK%c*dzvE8qjKIP(n=Czd`c3@Wdk^M+Gy7Y~P(F`|6!ed96x`F{K+{{t5IyXJd=S68<0 z=l|xX_8xD(l+G!C;`crD1OH#a2L%s*$cKEcSdyn3>6^Rx+J14&@34A( z5&TKEXU~&o{5Oj=%4Qbl@kIk!R$G;)8|it+dEVW}-|o}ODT=?W{r_g{m3{C>RHzPs zjD-4H(qwLROLMk({#Nhc`{vVMzlizo$;TfuqPZQG>r*$*;r;e|_C0HDKPqd{^2d82 zpKm(IhWzVE!JoI^cm1x?^PjW6H){vLKcQJ20Pgh7PrenU;J>$pul>Kbg}(i*mAROo zf9OiW%ugv~NIq4QR%Pi{dMoq$td^n3`6tO&t+5V(49TCa z=Z|(Fp8vGnAb67hd`r)e7wO4{i}#Pd7cX1HrvoMa=pRh2U!c4Oz>?NZkdA-VYW^`m z(i7@4>Fj|Pi3NcdshBv?$^rg`TGP){FU*6CVB@z#luN28A41}{!}h2eF1tMpxwVj=+hI8i!Yy96hPC#qhLEh7H$y~Pm@i)%dGK-UrG33rgelMvVWHj%` z?w=F>W;(&MPYT}I^*`*zTNi^jt&15b{#4!{FYII6zOdIODDhX?e>4uT3bLd%Q3JKa#r!ipq?&tk0@lWxmwQeEDoti9zx+Pno^X~6sOW)?3GhX7a^2d6|VD6h;zgzlt z^)rXq+MPq}lYsDDl_$w;ccjsr!DM=m^yd6Y$MIwq*DG6Mg||^$7}yXcEe`pOR$gFkGS?|CL+2Wn!)`i#GpL>iOS#u8-H5kMFME6=%Ofz3}bo7&|?W-%l+s ztNdxc-}(1+Fj^ysr_R@>IaAJOpY%YP|4lX^kV~T`8=1Gc_-o_4w6@oOniFi}p186O z*rgAf+k^4){{i~@YhLbTTle3ED z$O71u&w8<+{pN|N;=}LK2gAyE&J~Y_+4QF(>`wT9Uiwy-;sd%H>pe&PEp2;0Qy-bE8w+_$<^Ls!{2$twdhYGml9|@g#{N1% z@f`kNr1Jk1B>ruY7`q7Thj_`*!L@Sve;N&$OKk_baFhA>zw!NEC@!k~*W3|hcj5bx zcfDW-%tY#zssA^%4IqvGN3-Xj_MLTCjNP$rfV~IXAMy{R%;&XW`$4+lgg^D?Q=jfF zD?3Fp@h-0%{vTETC*+d5ocp7S-3P4=dBgMljM|6qz}7z;&2I~2mH(dlUiK9Fa;T5s zB1y+`c;GBhUoArRGUvhD{~HLVR=x@N{J%@F z{)3zPQ>^@X)_+jzfLGj%Xh~j}gVmt$cp+ zNME5LpY-t^^$AP-$@e4g+^@CU<+AfS`P$vb5<{nd;5OYYb|Ug6{)aiofM{J=EA{_R zAL8e~W}8I(E1R!#%3V7jjK&~H>nEVZ-_TZsT|d6}kJ9*w*n^I6- z=J<%Na5@`J=5z?|Y-XWs8Ho(jLK9if==d zV^|+W;P|WGc$#cwW1g!#D6ceqM0!045`Vw?c5*Sbx*u|UXA7OG8B;xIv~aT0h#%`J$^5Oqmw+K12m7w*STa;^2eMl zx906Q;pN7;;7{`jeVbD%9e>Q#6g^+h4Q`_Igbq;uHQ5)$5r%!IxwTIc{&B3oy;;;8 zZP9GJ%nzK&&d4)cGvE2cCJVmzPxVs9LAVxlfNV}(w>$QYKkRVr+F}NQpNKMoKiQs> z{{h#0P;p6*SAjEW@>$cuc@R3ixWN#zND_*%mIeLkNUzifxTE3gwS+Ir66q?vsz3 zJm<&~Bkv^uJ)rdqXbp=-gfK!3f$9mH8jS}Q4r5J707wG%2*{_~}nd*!{v<-H=9 z(|Sf_2on+Ldtw>_t#L`~oYGpiJIBxNZc=$tolPMI`-ua1Uw;Iyn`m83{9asv_3>zp zG#sA<<`rnWlRfo_VxBUL?+%5=q)p`UqXxIBi{o%8^wrFcI*K2WjwdM^3RP=6l;pY- z8kEDCE7YXoqtx{3>FEpxQinsK@>BvfyL5&P+HtkWHCkNFP>ZU!kj`GcKrD0oEV@8C zd-VdkxN?EIOnT*(b#c0&F8kC4GRc(!7>_6P$1h+keYdo~JgYcLfpo=D;tl%qQNTKV z90jb=$5B9ITz{AfXozPO7dK>#XB9sbx*)6gxPe0PtlPm26^b`xmv4+QUYC9R2#4`e zHQD(Uif5-T#XOfljp2%h_%MET+380a;+FNNAv?b@#&{w9HXbkZ{1}fLpGV{KYK$A7 z_hIoG{SBGaA9ecUsBaqdanwgyH-vYFF`jh;sPD3F0QF&3fvZ_|1%>FaRa6~`YE^#dQIN~_e0(J>+-N(||HW|*4Ht2%T0 z-Fxmi|9kJb%RA?e=k@dYd&7r&N*lcSM|$2DJsBqMRr$=4yP%Ko&BQ-LI?oYSok6 z{Y4W+t)gmJx|@$|bnIUXOJ~a@Z#(MS9fv!=V#Tn+8jQ*mrqMq#YYVAQM zy8DN5#d%k~y+s#@c8IF!=;?fPgJJJDn2ksL^gH!-iFz7iJ^5e&OYCtF?>JF!_ItQZ zU>RrqTPqdcXi;z2dl+;09ZaL^U_U@SOGM$i|1a-gJD^${RL0u7C-$VCYA@I(M&Vcf zP*IDhLigbpw>c=PtUGyKlnch8!8Yifa{>Ez1;(LQw7Jn!+TG``Y_BMb;*Xm*0_kn#qI7KO@6Z2`m8Pjon*8mcNm8pCt1xopo-f#_hScv+n2jCf%%MX}5Y~&Yh)pedeMz zcj9&J?%j`a?wt>F?gY&->PN|~k_Tq6^DR{K+hef$>+%0&Tt;|)dUy0#)230Hk1Jcn zr0318Irqpb8TaU_j9a%k=XSK`-F8tn=iD#vOZxo}uKQn<0qObOgQ?Ei5SYP!Cvs{L zV?X|Zl*{LxoBwjg9dSt|KlbqJc?F)=-_N;|rtY4TBQ$20{Wax2_&D!!l41Cfd(NDs zKTeBY%ebR1tCU*{R}nkkq&4x=x2$zRzvT@o0 zQU77t6OZ9XE@ji6Dzy8$MID{BA+X~csEePmKI^umOQ;DeG(TDY%GO2UV2oD1n{_e~ zw`^V3{c3K~eQQR-op5ctKkpw~U5OvL%z5U=E1Em(le9GsrXu!O--KWt*3{-++)!9s zzIRjQUO-=dM>c>hv;HvOS%2P_&0%|B4BEe8WL;glHsexi-Vg7LULTA%l$w7gR(t8I ztN&gY>sia9_X66$*s#}Kr1gEK_~vSjVf~^VQTUNN;o*Yq-Sd2>_5$$7vLD(FHroqW zW3ch?So6+Y!1f`qQI9=~vjX^8bI7;8q}=v`mTfurW!W2fR$e0od#w3uGHfqk9cNDp z;sE!FkxxYG;}FdU%EI#O zow~LcOx2!X{bJ>z)Xoo_fvTS0LUnxI;4SP0dH2j)S;sey^(i`;e>0x$a92Fm;hzbP zoz(8G(HRzOBd@8P^QHs2wim44nDxh_Mtkl2R`dL9vV&=GFW8mJyE9}nHU^|;+??>w z^=ou)V+=Ugan5A@=R94jU$L(xvVZ15c%2Gj&~N|zT>J)z{C)}XmyJ6(oBr0}+Jrwi z*1`Utr2c0w;LIPV|Ivrs3$_02(*AerKWgp;{`X4}f8_ULE&PlDcFlM!~8vYS|W0-QoZo^W7Y5XC>@p;h11Hqlg5x+_WfQQgR1_M?qKPG zx-F7f=05>HkMjGh|Eh?;Px}vxZRoT9Tk!M9j{2ecN}+P%%_KM!2C1jC!h=-c=>MX_Wc>>TK9F%^GcNRyu*0k>3RE+HhW%w z(k9&_A_chqg=LxINZRYq#}-y2S67Qa?2p`_1~%`c;gDzAp4T_p};BCy7e;v3yUrcfvgcxy25$lYZR>$#g!kI51E?L)gP5J zUOl1PFe3Z-Cj6o)vi?jWPYr{FEObBL+jC(4WKPgL_H+{-k1Q z`0E*eus*9;{$J!*G+!Pu58^uXm*I~{(H*&`(N^ShN9E!LyM5{8|3J2dADK22(|btq zj;)Ge->m*eKlCHTEEvB!v0rpY>IW;j?)qoiEmzEwc#q*n{ugAIXKStziz7a}X?tP( zDWe{9h&T)5M4r_RrRa|AfB2|3RysDy*6fZ8vWY>Rt~e)i10VhA@@v!9%L6e7>f)EL z6MIEBHV}!=A8*B08Sk0$`(p#h{n(V(2QR)_=1Gm%shyc3 z^;;jX7I3GCK1V+HUbw#m4r1o``SFFDZfg(s7FY|gMav7Nc3vx6e}X)=7SIm#(SGX# z;{NnM@esy27;{4ge1A~TCcbv! z1;h%%`oYdxuu5~~{JFd5P*I1izh(PRlz!}hb?2+HJG*1TK3Dp!HNbv{>yuACKR%>7 zfpUNUDei$~`)`1!#Lw8$o~W{VdDIKpMrr>I?7_Wu{wQMTweuJHdDM@+cK$3N@G&$B zM^BuA>z=;@7<%pdBY>gTzP|z(dhPquFp$a~dhGk#?cC3~rhZQThDq{0G~!Ocwa_Xr zMYCKDP?KB;MqZuA_(+?J^;;zinaD;5y3mPk{1mt)8bl>Oh5py9)}#K|M>Iw>Pqb0Q zUIOu(Jj(WolA-(qMKeU(Mb*|*%HTOLC`0eqHb-*NX$?>@1v+n&sC&U?q`jEbHj&o=6c=90&miSHxM66hMPa~gXi=X~yn zv6n~O`<<)$^sQg#(uFDiOv71!qRxMO18`Qp?}fB~$AI%-=sVEH$ghtc&I{n>E&+Ec zeyg+ky{Zo$?tpP#2<%xlzJ8myivSPja?U;6&$&u>Bsu4B2H+kLM8AMpWVYeIlTVv3 z(A`n?xAN=%z{|+wB71ydB=O4~RoXNkdZ$J8!Js&)Q?^o(F z28@L-10L?c@V$l}&ewL&lyTzx%sG!SFV@8dum!^u?4MGem4mTp1HS!W$13Zx{n|W` ij4scgfQ(Mh-;{j7t@wN8&1=HnDysHaIlR=N?*9OfLI)85 diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index bd05af7..5370e12 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -3,7 +3,7 @@ SmearcarDB - + From 4c8fcc4eb1f8eee876302a16e2ba6fe0577a2ab3 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 20 Jan 2018 22:34:39 -0500 Subject: [PATCH 08/80] added get method and language() --- SmearcarDB/server.py | 1 + SmearcarDB/static/index.js | 100 ++++++++++++++++----------- SmearcarDB/templates/index.html | 117 ++++++++++++++++---------------- 3 files changed, 123 insertions(+), 95 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index cbba62e..65cd0d1 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -12,6 +12,7 @@ app.config.update( try: with open("save.p", "rb") as f: database = pickle.load(f) + print("Loaded", database) except (FileNotFoundError) as e: database = {'languages': [], 'phonemes': [], diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index a35e8ca..3825160 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,52 +1,76 @@ var navSelect = "home"; +var serverURL = "http://0.0.0.0:5000"; +var data; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. - ["home", "Home", "home"], - ["bar-chart", "Data Values", "dataValues"], - ["database", "Database and Files", "files"], - ["bell", "Updates and Progress", "updates"] + ["home", "Home", "home"], + ["bar-chart", "Data Values", "dataValues"], + ["database", "Database and Files", "files"], + ["bell", "Updates and Progress", "updates"] ]; -for(var i = 0; i < navi.length; i++) { // Create navigation tabs. - var side = document.getElementById("sidebar"); - var div = document.createElement("div"); - div.className = "navi transition"; - div.setAttribute("option", navi[i][2]); - div.onclick = function() { - var op = this.getAttribute("option"); - if(navSelect === op) return; - updateMain(op); - }; - var ic = document.createElement("i"); - ic.className = "fa fa-"+navi[i][0]; - ic["aria-hidden"] = true; - var p = document.createElement("p"); - p.appendChild(document.createTextNode(navi[i][1])); - div.appendChild(ic); - div.appendChild(p); - side.appendChild(div); +for (var i = 0; i < navi.length; i++) { // Create navigation tabs. + var side = document.getElementById("sidebar"); + var div = document.createElement("div"); + div.className = "navi transition"; + div.setAttribute("option", navi[i][2]); + div.onclick = function() { + var op = this.getAttribute("option"); + if (navSelect === op) return; + updateMain(op); + }; + var ic = document.createElement("i"); + ic.className = "fa fa-" + navi[i][0]; + ic["aria-hidden"] = true; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(navi[i][1])); + div.appendChild(ic); + div.appendChild(p); + side.appendChild(div); } updateNav(navSelect); function updateMain(op) { - updateNav(op); - document.getElementById(navSelect).style.opacity = "0"; - setTimeout(function() { - document.getElementById(navSelect).style.display = "none"; - document.getElementById(op).style.display = "grid"; - setTimeout(function() { - document.getElementById(op).style.opacity = "1"; - }, 30); - navSelect = op; - }, 300); + updateNav(op); + document.getElementById(navSelect).style.opacity = "0"; + setTimeout(function() { + document.getElementById(navSelect).style.display = "none"; + document.getElementById(op).style.display = "grid"; + setTimeout(function() { + document.getElementById(op).style.opacity = "1"; + }, 30); + navSelect = op; + }, 300); } function updateNav(op) { - var oldNav = document.querySelectorAll("[option="+navSelect+"]")[0]; - var newNav = document.querySelectorAll("[option="+op+"]")[0]; - oldNav.style.backgroundColor = "rgba(0,0,0,0)"; - oldNav.style.color = "white"; - newNav.style.backgroundColor = "#F8F3F0"; - newNav.style.color = "#F47922"; + var oldNav = document.querySelectorAll("[option=" + navSelect + "]")[0]; + var newNav = document.querySelectorAll("[option=" + op + "]")[0]; + oldNav.style.backgroundColor = "rgba(0,0,0,0)"; + oldNav.style.color = "white"; + newNav.style.backgroundColor = "#F8F3F0"; + newNav.style.color = "#F47922"; +} + +function getData() { + $.ajax({ + url: serverURL + '/server', + type: 'GET' + }) + .then( + function success(incoming) { + data = incoming; + }, + function error(e) { + console.log(e); + } + ); + console.log(data); +} + +function language(language) { + return data.languages.filter(function(element) { + return element.name === language; + }); } diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 5370e12..1c70623 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -1,58 +1,61 @@ - - - - SmearcarDB - - - - - - - - - -
-

/smirkär/

-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - \ No newline at end of file + + + + + SmearcarDB + + + + + + + + + + +
+

/smirkär/

+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + From 7ce57e85a016355a23fa67c4ab1b3f3ef28a3276 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 20 Jan 2018 23:01:36 -0500 Subject: [PATCH 09/80] minor bug and formatting --- SmearcarDB/server.py | 1 - SmearcarDB/static/index.js | 26 +++++++++++++------------- SmearcarDB/templates/index.html | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 65cd0d1..cbba62e 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -12,7 +12,6 @@ app.config.update( try: with open("save.p", "rb") as f: database = pickle.load(f) - print("Loaded", database) except (FileNotFoundError) as e: database = {'languages': [], 'phonemes': [], diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 3825160..0d06a58 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,5 +1,5 @@ var navSelect = "home"; -var serverURL = "http://0.0.0.0:5000"; +var serverURL = "http://localhost:5000"; var data; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. @@ -55,18 +55,18 @@ function updateNav(op) { function getData() { $.ajax({ - url: serverURL + '/server', - type: 'GET' - }) - .then( - function success(incoming) { - data = incoming; - }, - function error(e) { - console.log(e); - } - ); - console.log(data); + url: serverURL + '/server', + type: 'GET' + }) + .then( + function success(incoming) { + data = incoming; + console.log(data); + }, + function error(e) { + console.log(e); + } + ); } function language(language) { diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 1c70623..1f98342 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -14,7 +14,7 @@ -
+

/smirkär/

From a04a7d0ba91bbf6b421377fafb35eefacbb0cc26 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 20 Jan 2018 23:01:47 -0500 Subject: [PATCH 10/80] minor bugs --- SmearcarDB/server.py | 1 - SmearcarDB/static/index.js | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 65cd0d1..cbba62e 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -12,7 +12,6 @@ app.config.update( try: with open("save.p", "rb") as f: database = pickle.load(f) - print("Loaded", database) except (FileNotFoundError) as e: database = {'languages': [], 'phonemes': [], diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 3825160..a68815e 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -66,11 +66,10 @@ function getData() { console.log(e); } ); - console.log(data); } function language(language) { - return data.languages.filter(function(element) { + return data.values.filter(function(element) { return element.name === language; }); } From 5818b90a60d6aee4af21e5b441188c0fce9a2b02 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sat, 20 Jan 2018 23:07:54 -0500 Subject: [PATCH 11/80] fix serverURL --- SmearcarDB/static/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index ecbed2b..e74c182 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,5 +1,5 @@ var navSelect = "home"; -var serverURL = "http://localhost:5000"; +var serverURL = window.location.href; var data; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. @@ -55,7 +55,7 @@ function updateNav(op) { function getData() { $.ajax({ - url: serverURL + '/server', + url: serverURL + 'server', type: 'GET' }) .then( From d09f1f0ee25158dced72a3aceab7821cf105d5e8 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sun, 21 Jan 2018 15:03:26 -0500 Subject: [PATCH 12/80] Added dropdowns --- SmearcarDB/static/index.css | 192 ++++++++++++++++++++++++++------ SmearcarDB/static/index.js | 124 +++++++++++++++++---- SmearcarDB/templates/index.html | 4 + 3 files changed, 267 insertions(+), 53 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 07ff414..a68c01f 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -1,19 +1,22 @@ /* Layout Elements and General Formatting */ html { - width: 100%; height: 100%; + width: 100%; } body { - margin: 0; - padding: 0; - height: 100%; - font-family: 'Open Sans Condensed', sans-serif; - color: white; display: grid; + + height: 100%; + overflow: hidden; + padding: 0; + margin: 0; + + color: white; + font-family: 'Open Sans Condensed', sans-serif; + grid-template-columns: 13% auto; grid-template-rows: 8% auto; - overflow: hidden; } h1,h2,h3,h4,h5,p { @@ -21,23 +24,28 @@ h1,h2,h3,h4,h5,p { } .transition { - -webkit-transition: all 0.3s cubic-bezier(.25,.8,.25,1); - -moz-transition: all 0.3s cubic-bezier(.25,.8,.25,1); + -webkit-transition: all 0.3s cubic-bezier(.25,.8,.25,1); + transition: all 0.3s cubic-bezier(.25,.8,.25,1); + + -moz-transition: all 0.3s cubic-bezier(.25,.8,.25,1); -ms-transition: all 0.3s cubic-bezier(.25,.8,.25,1); - transition: all 0.3s cubic-bezier(.25,.8,.25,1); } #header1 { + display: grid; + + background-color: #F47922; + + text-align: center; + grid-column: 1; grid-row: 1; - background-color: #F47922; - text-align: center; cursor: pointer; - display: grid; } #header1 h1 { margin: auto 0 auto 0; + font-weight: 300; } @@ -46,22 +54,26 @@ h1,h2,h3,h4,h5,p { } #header2 { + background-color: #524948; + grid-column: 2; grid-row: 1; - background-color: #524948; } #sidebar { + background-color: #524948; + grid-column: 1; grid-row: 2; - background-color: #524948; } .navi { - width: 100%; - height: 6vh; - cursor: pointer; display: grid; + + height: 6vh; + width: 100%; + + cursor: pointer; grid-template-columns: 1fr 3fr 7fr; } @@ -70,53 +82,158 @@ h1,h2,h3,h4,h5,p { } .navi i { - grid-column: 2; - text-align: center; margin: auto 0 auto 0; + font-size: 130%; + text-align: center; + + grid-column: 2; } .navi p { - grid-column: 3; margin: auto 0 auto 0; + font-size: 110%; + + grid-column: 3; } #mainContainer { + overflow-y: auto; + padding: 2vh; + + background-color: #F8F3F0; + + font-family: 'Saira Condensed', sans-serif; + grid-column: 2; grid-row: 2; - padding: 2vh; - background-color: #F8F3F0; - overflow-y: auto; } -.card { - background-color: #FEFEFE; - box-shadow: 1px 1px 1px 1px #000; +/* Dropdown */ + +.dropdown { + position: relative; + display: grid; + + border-left: 5px solid #F88A3C; + + background-color: rgba(0,0,0,0.05); + + grid-template-columns: 100%; + grid-template-rows: auto 0%; + cursor: pointer; +} + +.dropdown:hover { + background-color: rgba(0,0,0,0.1); +} + +.dropdown .button { + display: grid; + + padding-left: 2%; + margin: auto 0 auto 0; + + font-size: 170%; + + grid-column: 1; + grid-row: 1; + grid-template-columns: 14fr 1fr; + grid-template-rows: 100%; +} + +.dropdown .button p { + font-weight: 300; + grid-column: 1; + grid-row: 1; +} + +.dropdown .button i { + margin: auto 0 auto 0; + + grid-column: 2; + grid-row: 1; +} + +.dropdown .opCont { + position: absolute; + opacity: 0; + display: none; + + width: 100%; border-radius: 2px; + + background-color: #FEFEFE; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); - transition: all 0.3s cubic-bezier(.25,.8,.25,1); + + grid-column: 1; + grid-row: 2; + + overflow-y: auto; + max-height: 30vh; } -.card:hover { - box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); +.dropdown .opCont p { + padding: 2% 0 2% 4%; + + font-size: 130%; +} + +.dropdown .opCont p:hover { + background-color: rgba(0,0,0,0.1); } /* Main Body */ #home, #dataValues, #files, #updates { - width: 100%; - height: 100%; display: none; + + height: 100%; + width: 100%; opacity: 0; + + transition: opacity 0.3s cubic-bezier(.25,.8,.25,1); + grid-gap: 2vh; grid-template-columns: 1fr 1fr; grid-template-rows: 2fr 4fr 4fr; - transition: opacity 0.3s cubic-bezier(.25,.8,.25,1); +} + +.card { + display: grid; + + border-radius: 2px; + + background-color: #FEFEFE; + box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); + + color: black; + + transition: all 0.3s cubic-bezier(.25,.8,.25,1); + + grid-template-columns: 1fr; + grid-template-rows: 6fr 11fr; +} + +.card:hover { + box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); +} + +.card h2 { + width: 35%; + margin: auto 0 auto 2%; + + font-weight: 300; + border-bottom: 1px solid #D5D5D5; + + grid-column: 1; + grid-row: 1; } #home { display: grid; + opacity: 1; } @@ -125,6 +242,15 @@ h1,h2,h3,h4,h5,p { grid-row: 1; } +#langSelect .dropdown { + height: 50%; + width: 85%; + margin: auto 0 auto 5%; + + grid-column: 1; + grid-row: 2; +} + #dataInfo { grid-column: 2; grid-row: 1; diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 0d06a58..dd44cf5 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -2,6 +2,7 @@ var navSelect = "home"; var serverURL = "http://localhost:5000"; var data; + var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. ["home", "Home", "home"], ["bar-chart", "Data Values", "dataValues"], @@ -9,27 +10,34 @@ var navi = [ // Array containing navigation items in form [Font-Awesome class na ["bell", "Updates and Progress", "updates"] ]; -for (var i = 0; i < navi.length; i++) { // Create navigation tabs. - var side = document.getElementById("sidebar"); - var div = document.createElement("div"); - div.className = "navi transition"; - div.setAttribute("option", navi[i][2]); - div.onclick = function() { - var op = this.getAttribute("option"); - if (navSelect === op) return; - updateMain(op); - }; - var ic = document.createElement("i"); - ic.className = "fa fa-" + navi[i][0]; - ic["aria-hidden"] = true; - var p = document.createElement("p"); - p.appendChild(document.createTextNode(navi[i][1])); - div.appendChild(ic); - div.appendChild(p); - side.appendChild(div); -} +var dropOp = { + //Insert correct +}; -updateNav(navSelect); + +var dropOpStore = {}; + +function createNav() { + for (var i = 0; i < navi.length; i++) { // Create navigation tabs. + var side = document.getElementById("sidebar"); + var div = document.createElement("div"); + div.className = "navi transition"; + div.setAttribute("option", navi[i][2]); + div.onclick = function() { + var op = this.getAttribute("option"); + if (navSelect === op) return; + updateMain(op); + }; + var ic = document.createElement("i"); + ic.className = "fa fa-" + navi[i][0]; + ic["aria-hidden"] = true; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(navi[i][1])); + div.appendChild(ic); + div.appendChild(p); + side.appendChild(div); + } +} function updateMain(op) { updateNav(op); @@ -61,6 +69,8 @@ function getData() { .then( function success(incoming) { data = incoming; + generateDropOp(); + createDrop(); console.log(data); }, function error(e) { @@ -74,3 +84,77 @@ function language(language) { return element.name === language; }); } + +function generateDropOp() { + dropOp["langSelect"] = ["Select language..."].concat(data.languages); +} + +function createDrop() { + var dropButtons = document.getElementsByClassName("dropdown"); + for(var i = 0; i < dropButtons.length; i++) { + var div = document.createElement("div"); + div.className = "button"; + var p = document.createElement("p"); + var op = dropButtons[i].getAttribute("option"); + p.appendChild(document.createTextNode(dropOp[op][0])); + var ic = document.createElement("i"); + ic.className = "fa fa-angle-down"; + ic["aria-hidden"] = true; + div.appendChild(p); + div.appendChild(ic); + var div2 = document.createElement("div"); + div2.className = "opCont transition"; + for(var j = 1; j < dropOp[op].length; j++) { + var p2 = document.createElement("p"); + p2.className = "transition"; + p2.onclick = function(e) { + e.stopPropagation(); + dropOpStore[op] = this.textContent; + dropOpUpdate(op); + let opCont = this.parentNode; + opCont.style.opacity = "0"; + setTimeout(function() { + opCont.style.display = "none"; + }, 300); + }; + p2.appendChild(document.createTextNode(dropOp[op][j])); + div2.appendChild(p2); + } + div.onclick = function(e) { + e.stopPropagation(); + let opCont = this.nextElementSibling; + if(opCont.style.display === "block") { + opCont.style.opacity = "0"; + setTimeout(function() { + opCont.style.display = "none"; + }, 300); + } else { + opCont.style.display = "block"; + setTimeout(function() { + opCont.style.opacity = "1"; + }, 30); + } + }; + dropButtons[i].appendChild(div); + dropButtons[i].appendChild(div2); + } +} + +function dropOpUpdate(op) { + var dropdown = document.querySelectorAll(".dropdown[option="+op+"] .button p")[0]; + dropdown.textContent = dropOpStore[op]; +} + +document.onclick = function(event) { + for(var i = 0 ; i < document.getElementsByClassName("dropdown").length; i++) { + var opCont = document.querySelectorAll(".dropdown .opCont")[i]; + opCont.style.opacity = "0"; + setTimeout(function() { + opCont.style.display = "none"; + }, 300); + } +} + +getData(); +createNav(); +updateNav(navSelect); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 1f98342..bcaa1c1 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -7,6 +7,7 @@ + @@ -24,6 +25,9 @@
+

Language

+
From 79d826a1543675d622f6e4ecf80389dbafdd56bc Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 21 Jan 2018 15:32:27 -0500 Subject: [PATCH 13/80] add gitignore template --- SmearcarDB/.gitignore | 111 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 109 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore index 2b63d07..3ce1870 100644 --- a/SmearcarDB/.gitignore +++ b/SmearcarDB/.gitignore @@ -1,3 +1,110 @@ +# Created by https://www.gitignore.io/api/python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule.* + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# End of https://www.gitignore.io/api/python + + +# Other *.p -venv -__pycache__/ \ No newline at end of file From b5db597145ba080a8aee15f574e685efb7313fde Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sun, 21 Jan 2018 15:46:38 -0500 Subject: [PATCH 14/80] display info section --- SmearcarDB/static/index.css | 24 ++++++++++++++++++------ SmearcarDB/static/index.js | 29 ++++++++++++++++++++++++----- SmearcarDB/templates/index.html | 5 +++++ 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index a68c01f..1e031df 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -23,6 +23,11 @@ h1,h2,h3,h4,h5,p { margin: 0; } +a { + text-decoration: none; + color: #2EA8FF; +} + .transition { -webkit-transition: all 0.3s cubic-bezier(.25,.8,.25,1); transition: all 0.3s cubic-bezier(.25,.8,.25,1); @@ -212,8 +217,8 @@ h1,h2,h3,h4,h5,p { transition: all 0.3s cubic-bezier(.25,.8,.25,1); - grid-template-columns: 1fr; - grid-template-rows: 6fr 11fr; + grid-template-columns: 100%; + grid-template-rows: 6vh auto; } .card:hover { @@ -222,7 +227,7 @@ h1,h2,h3,h4,h5,p { .card h2 { width: 35%; - margin: auto 0 auto 2%; + margin: auto 0 auto 2vh; font-weight: 300; border-bottom: 1px solid #D5D5D5; @@ -231,6 +236,11 @@ h1,h2,h3,h4,h5,p { grid-row: 1; } +.card > div { + grid-column: 1; + grid-row: 2; +} + #home { display: grid; @@ -246,9 +256,6 @@ h1,h2,h3,h4,h5,p { height: 50%; width: 85%; margin: auto 0 auto 5%; - - grid-column: 1; - grid-row: 2; } #dataInfo { @@ -256,6 +263,11 @@ h1,h2,h3,h4,h5,p { grid-row: 1; } +#langInfoCont { + font-size: 150%; + margin-left: 4vh; +} + #dataTable { grid-column: 1 / 3; grid-row: 2; diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 1ee476c..5a89097 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -81,11 +81,28 @@ function getData() { function language(language) { return data.values.filter(function(element) { return element.name === language; - }); + })[0]; } -function generateDropOp() { - dropOp["langSelect"] = ["Select language..."].concat(data.languages); +function generateDropOp() { // For options that change based on data. + dropOp["langSelect"] = [function() { + var info = document.getElementById("langInfoCont"); + while(info.firstChild) { + info.removeChild(info.firstChild); + } + var p = document.createElement("p") + var p2 = document.createElement("p2"); + var a = document.createElement("a"); + var langInfo = language(dropOpStore["langSelect"]); + p.appendChild(document.createTextNode("Type: " + langInfo.type)); + p2.appendChild(document.createTextNode("Source: ")); + a.href = langInfo.source; + srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0,langInfo.source.length-3) + "..." : langInfo.source; + a.appendChild(document.createTextNode(srcText)); + p2.appendChild(a); + info.appendChild(p); + info.appendChild(p2); + }].concat(["Select language..."].concat(data.languages)); } function createDrop() { @@ -95,7 +112,7 @@ function createDrop() { div.className = "button"; var p = document.createElement("p"); var op = dropButtons[i].getAttribute("option"); - p.appendChild(document.createTextNode(dropOp[op][0])); + p.appendChild(document.createTextNode(dropOp[op][1])); var ic = document.createElement("i"); ic.className = "fa fa-angle-down"; ic["aria-hidden"] = true; @@ -103,7 +120,7 @@ function createDrop() { div.appendChild(ic); var div2 = document.createElement("div"); div2.className = "opCont transition"; - for(var j = 1; j < dropOp[op].length; j++) { + for(var j = 2; j < dropOp[op].length; j++) { var p2 = document.createElement("p"); p2.className = "transition"; p2.onclick = function(e) { @@ -142,6 +159,8 @@ function createDrop() { function dropOpUpdate(op) { var dropdown = document.querySelectorAll(".dropdown[option="+op+"] .button p")[0]; dropdown.textContent = dropOpStore[op]; + console.log("hi"); + (dropOp[op][0])(); } document.onclick = function(event) { diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index bcaa1c1..92ad66f 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -30,8 +30,13 @@
+

Info

+
+ +
+

Data

From 2d27836e291c0bb7bfb04056d8ca0e87eecde63e Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 21 Jan 2018 16:39:19 -0500 Subject: [PATCH 15/80] add PATCH method --- SmearcarDB/server.py | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index cbba62e..05d24ec 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,8 +1,8 @@ import pickle from flask import Flask from flask import render_template, jsonify, request -import time -import random +import ulid + app = Flask(__name__) app.config.update( DEBUG=True, @@ -12,11 +12,19 @@ app.config.update( try: with open("save.p", "rb") as f: database = pickle.load(f) + # Can be commented out after non-id languages are all converted + for item in database['values']: + if not 'id' in item: + item['id'] = ulid.new().str except (FileNotFoundError) as e: database = {'languages': [], 'phonemes': [], 'values': []} +def saveDatabase(): + # Save copy under separate name + with open("newestsave.p", "wb") as f: + pickle.dump(database, f) # Render the client at the default URL @app.route("/") @@ -24,16 +32,17 @@ def initial(): return render_template('index.html') # Place for client to communicate with the server -@app.route("/server", methods=["GET", "POST"]) +@app.route("/server", methods=["GET", "POST", "PATCH"]) +# TODO add more methods def backend(): - # Get method returns the latest database + # GET method returns the latest database if request.method == "GET": return jsonify(database) - # Post method currently appends to the languages - # TODO add more methods + # POST method currently appends to the languages elif request.method == "POST": newlanguage = request.get_json() + newlanguage['id'] = ulid.new().str database['values'].append(newlanguage) # Add new phonemes @@ -42,14 +51,18 @@ def backend(): database['phonemes'] = database['phonemes'] + uniquephonemes # Add new language - newlang = {newlanguage['name']} - uniquelanguages = list(newlang - set(database['languages'])) + newlangname = {newlanguage['name']} + uniquelanguages = list(newlangname - set(database['languages'])) database['languages'] = database['languages'] + uniquelanguages - # Save copy under separate name - with open("newestsave.p", "wb") as f: - pickle.dump(database, f) + saveDatabase() + return jsonify(database) + # PATCH method inputs edited language and returns updated database + elif request.method == "PATCH": + newlanguage = request.get_json() + database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] + saveDatabase() return jsonify(database) else: From cf869e3dd8b7e8ad8bd710ebabcbc1bd8df94439 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 21 Jan 2018 16:41:27 -0500 Subject: [PATCH 16/80] change documentation (minor) --- SmearcarDB/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 05d24ec..0c035d7 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -39,7 +39,7 @@ def backend(): if request.method == "GET": return jsonify(database) - # POST method currently appends to the languages + # POST method appends input to database['values'] elif request.method == "POST": newlanguage = request.get_json() newlanguage['id'] = ulid.new().str From a4605b9483b3f088baf8e158dd15abfcee93f1e9 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 21 Jan 2018 17:15:39 -0500 Subject: [PATCH 17/80] add phoneme() --- SmearcarDB/static/index.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 5a89097..040133e 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -17,7 +17,7 @@ var dropOp = { var dropOpStore = {}; -function createNav() { +function createNav() { for (var i = 0; i < navi.length; i++) { // Create navigation tabs. var side = document.getElementById("sidebar"); var div = document.createElement("div"); @@ -36,7 +36,7 @@ function createNav() { div.appendChild(ic); div.appendChild(p); side.appendChild(div); - } + } } function updateMain(op) { @@ -84,20 +84,36 @@ function language(language) { })[0]; } +function phoneme(p) { + return data.values.map(function(language) { + obj = {}; + if (language.phonemes[p] !== undefined) { + obj[language.name] = language.phonemes[p]; + return obj; + } + return undefined; + }).filter(function(a) { + if (a === undefined) { + return false; + } + return true; + }); +} + function generateDropOp() { // For options that change based on data. dropOp["langSelect"] = [function() { var info = document.getElementById("langInfoCont"); - while(info.firstChild) { + while (info.firstChild) { info.removeChild(info.firstChild); } - var p = document.createElement("p") + var p = document.createElement("p"); var p2 = document.createElement("p2"); var a = document.createElement("a"); var langInfo = language(dropOpStore["langSelect"]); p.appendChild(document.createTextNode("Type: " + langInfo.type)); p2.appendChild(document.createTextNode("Source: ")); a.href = langInfo.source; - srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0,langInfo.source.length-3) + "..." : langInfo.source; + srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, langInfo.source.length - 3) + "..." : langInfo.source; a.appendChild(document.createTextNode(srcText)); p2.appendChild(a); info.appendChild(p); @@ -107,7 +123,7 @@ function generateDropOp() { // For options that change based on data. function createDrop() { var dropButtons = document.getElementsByClassName("dropdown"); - for(var i = 0; i < dropButtons.length; i++) { + for (var i = 0; i < dropButtons.length; i++) { var div = document.createElement("div"); div.className = "button"; var p = document.createElement("p"); @@ -120,7 +136,7 @@ function createDrop() { div.appendChild(ic); var div2 = document.createElement("div"); div2.className = "opCont transition"; - for(var j = 2; j < dropOp[op].length; j++) { + for (var j = 2; j < dropOp[op].length; j++) { var p2 = document.createElement("p"); p2.className = "transition"; p2.onclick = function(e) { @@ -139,7 +155,7 @@ function createDrop() { div.onclick = function(e) { e.stopPropagation(); let opCont = this.nextElementSibling; - if(opCont.style.display === "block") { + if (opCont.style.display === "block") { opCont.style.opacity = "0"; setTimeout(function() { opCont.style.display = "none"; @@ -157,14 +173,14 @@ function createDrop() { } function dropOpUpdate(op) { - var dropdown = document.querySelectorAll(".dropdown[option="+op+"] .button p")[0]; + var dropdown = document.querySelectorAll(".dropdown[option=" + op + "] .button p")[0]; dropdown.textContent = dropOpStore[op]; console.log("hi"); (dropOp[op][0])(); } document.onclick = function(event) { - for(var i = 0 ; i < document.getElementsByClassName("dropdown").length; i++) { + for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) { var opCont = document.querySelectorAll(".dropdown .opCont")[i]; opCont.style.opacity = "0"; setTimeout(function() { From 3c8505b143a746ee7914390d32fb7017796cdd4a Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sun, 21 Jan 2018 21:05:48 -0500 Subject: [PATCH 18/80] added trello api, data table display --- SmearcarDB/static/index.css | 31 ++++++++- SmearcarDB/static/index.js | 120 ++++++++++++++++++++++++++------ SmearcarDB/templates/index.html | 34 ++++----- 3 files changed, 141 insertions(+), 44 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 1e031df..484d6ec 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -200,9 +200,12 @@ a { transition: opacity 0.3s cubic-bezier(.25,.8,.25,1); - grid-gap: 2vh; + grid-gap: 2vh; +} + +#home, #dataValues { grid-template-columns: 1fr 1fr; - grid-template-rows: 2fr 4fr 4fr; + grid-template-rows: 2fr 5fr 2fr; } .card { @@ -264,11 +267,33 @@ a { } #langInfoCont { + display: grid; + font-weight: 300; font-size: 150%; - margin-left: 4vh; + margin: auto 0 auto 4vh; } #dataTable { grid-column: 1 / 3; grid-row: 2; +} + +#dataTableCont { + display: grid; + font-weight: 300; + grid-template-columns: repeat(4, 1fr); + grid-template-rows: 100%; + grid-gap: 2vh; + padding: 2vh; +} + +#dataTableCont div { + display: grid; + grid-template-columns: repeat(2, 1fr); + grid-template-rows: repeat(8, 1fr); +} + +#dataTableCont div p { + font-size: 130%; + padding: 0 5% 0 5%; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 040133e..cd3a67e 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,6 +1,7 @@ var navSelect = "home"; -var serverURL = window.location.href; +var serverURL = window.location.origin; var data; +var trelloInfo = {}; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. @@ -10,6 +11,10 @@ var navi = [ // Array containing navigation items in form [Font-Awesome class na ["bell", "Updates and Progress", "updates"] ]; +var members = [ + "Kenneth Jao", "Yaman Qalieh", "Enrico Colon", "Arav Agarwal" +]; + var dropOp = { //Insert correct }; @@ -63,7 +68,7 @@ function updateNav(op) { function getData() { $.ajax({ - url: serverURL + 'server', + url: serverURL + '/server', type: 'GET' }) .then( @@ -93,31 +98,75 @@ function phoneme(p) { } return undefined; }).filter(function(a) { - if (a === undefined) { - return false; - } - return true; + return (a !== undefined); }); } function generateDropOp() { // For options that change based on data. dropOp["langSelect"] = [function() { - var info = document.getElementById("langInfoCont"); - while (info.firstChild) { - info.removeChild(info.firstChild); - } - var p = document.createElement("p"); - var p2 = document.createElement("p2"); - var a = document.createElement("a"); + // Generate info box material. var langInfo = language(dropOpStore["langSelect"]); - p.appendChild(document.createTextNode("Type: " + langInfo.type)); - p2.appendChild(document.createTextNode("Source: ")); - a.href = langInfo.source; - srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, langInfo.source.length - 3) + "..." : langInfo.source; - a.appendChild(document.createTextNode(srcText)); - p2.appendChild(a); - info.appendChild(p); - info.appendChild(p2); + var info = document.getElementById("langInfoCont"); + info.style.opacity = "0"; + setTimeout(function() { + while (info.firstChild) { + info.removeChild(info.firstChild); + } + var p = document.createElement("p"); + var p2 = document.createElement("p"); + var a = document.createElement("a"); + p.appendChild(document.createTextNode("Type: " + (langInfo.type || "N/A"))); + p2.appendChild(document.createTextNode("Source: ")); + if(langInfo.source.length > 0) { + a.href = langInfo.source; + srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, langInfo.source.length - 3) + "..." : langInfo.source; + a.appendChild(document.createTextNode(srcText)); + p2.appendChild(a); + } else { + p2.appendChild(document.createTextNode("N/A")); + } + info.appendChild(p); + info.appendChild(p2); + info.style.opacity = "1"; + }, 300); + // Generate data box material. + var dataBox = document.getElementById("dataTableCont"); + var phonemes = Object.keys(langInfo.phonemes); + dataBox.style.opacity = "0"; + setTimeout(function() { + while (dataBox.firstChild) { + dataBox.removeChild(dataBox.firstChild); + } + dataBox.style.gridTemplateColumns = "repeat("+Math.ceil(phonemes.length/6).toString() + ", 1fr)"; + for(var i = 0; i < 9; i++) dataBox.appendChild(document.createElement("div")); // Extra divs will be filled if necessary. + for(i = 0; i < phonemes.length; i++) { + var tableNum = Math.floor(i/6); + var row = i+2-tableNum*7; + var p1 = document.createElement("p"); + var p2 = document.createElement("p"); + p1.style.textAlign = "right"; + p2.style.textAlign = "left"; + p1.style.borderRight = "1px solid #D5D5D5"; + if(i%6 === 0) { + var pT1 = document.createElement("p"); + var pT2 = document.createElement("p"); + pT1.style.textAlign = "right"; + pT2.style.textAlign = "left"; + pT1.style.borderRight = "1px solid #D5D5D5"; + pT1.style.borderBottom = "1px solid #D5D5D5"; + pT2.style.borderBottom = "1px solid #D5D5D5"; + pT1.appendChild(document.createTextNode("Phoneme")); + pT2.appendChild(document.createTextNode("Percent")); + dataBox.children[tableNum].appendChild(pT1); + dataBox.children[tableNum].appendChild(pT2); + } + p1.appendChild(document.createTextNode(phonemes[i])); + p2.appendChild(document.createTextNode(langInfo.phonemes[phonemes[i]])); + dataBox.children[tableNum].appendChild(p1); + dataBox.children[tableNum].appendChild(p2); + } + dataBox.style.opacity = "1"; + }, 300); }].concat(["Select language..."].concat(data.languages)); } @@ -175,7 +224,6 @@ function createDrop() { function dropOpUpdate(op) { var dropdown = document.querySelectorAll(".dropdown[option=" + op + "] .button p")[0]; dropdown.textContent = dropOpStore[op]; - console.log("hi"); (dropOp[op][0])(); } @@ -189,6 +237,34 @@ document.onclick = function(event) { } } +function getTrelloCards() { + Trello.authorize(); + var cardArr, listArr, lists; + var cards = window.Trello.rest( + "GET", "boards/vm2c2IZd/cards", + function success() { + cardArr = JSON.parse(cards.responseText); + lists = window.Trello.rest( + "GET", "boards/vm2c2IZd/lists", + function success() { + listArr = JSON.parse(lists.responseText); + for(var i = 0; i < listArr.length; i++) { + var arr = cardArr.filter(function(obj) { + return obj.idList === listArr[i].id; + }).map(a => a.name); + trelloInfo[listArr[i].name] = arr; + } + }, + function error(e) { + console.log(e); + }); + }, + function error(e) { + console.log(e); + }); +} + getData(); +getTrelloCards(); createNav(); updateNav(navSelect); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 92ad66f..0efc234 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -12,6 +12,7 @@ + @@ -24,6 +25,14 @@
+
+
+
+
+
+
+
+

Language

-
-
-
-
-
-
+
+
-
-
-
-
-
+
+

Currently in progress!

-
-
-
-
-
+
+

Currently in progress!

From 18cdd67b1c292bda1337ce161430e6802708237d Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sun, 21 Jan 2018 21:29:32 -0500 Subject: [PATCH 19/80] changed navigation tabs --- SmearcarDB/static/index.css | 2 +- SmearcarDB/static/index.js | 6 +++--- SmearcarDB/templates/index.html | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 484d6ec..eee70d7 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -191,7 +191,7 @@ a { /* Main Body */ -#home, #dataValues, #files, #updates { +#home, #dataValues, #files, #about { display: none; height: 100%; diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index cd3a67e..83039f2 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -8,7 +8,7 @@ var navi = [ // Array containing navigation items in form [Font-Awesome class na ["home", "Home", "home"], ["bar-chart", "Data Values", "dataValues"], ["database", "Database and Files", "files"], - ["bell", "Updates and Progress", "updates"] + ["info", "About", "about"] ]; var members = [ @@ -128,7 +128,7 @@ function generateDropOp() { // For options that change based on data. info.appendChild(p); info.appendChild(p2); info.style.opacity = "1"; - }, 300); + }, 400); // Generate data box material. var dataBox = document.getElementById("dataTableCont"); var phonemes = Object.keys(langInfo.phonemes); @@ -166,7 +166,7 @@ function generateDropOp() { // For options that change based on data. dataBox.children[tableNum].appendChild(p2); } dataBox.style.opacity = "1"; - }, 300); + }, 400); }].concat(["Select language..."].concat(data.languages)); } diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 0efc234..e9d6391 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -54,7 +54,7 @@

Currently in progress!

-
+

Currently in progress!

From d7664e6335d35b648c2e9a0314903c6092e16746 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 24 Jan 2018 18:59:56 -0500 Subject: [PATCH 20/80] removed trello, gitignore --- SmearcarDB/.gitignore | 4 ++++ SmearcarDB/static/index.css | 2 +- SmearcarDB/static/index.js | 7 +++---- SmearcarDB/templates/index.html | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore index 3ce1870..a4853d7 100644 --- a/SmearcarDB/.gitignore +++ b/SmearcarDB/.gitignore @@ -6,6 +6,10 @@ __pycache__/ *.py[cod] *$py.class +#Pipenv +Pipfile +Pipfile.lock + # C extensions *.so diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index eee70d7..de5bd66 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -15,7 +15,7 @@ body { color: white; font-family: 'Open Sans Condensed', sans-serif; - grid-template-columns: 13% auto; + grid-template-columns: 15% auto; grid-template-rows: 8% auto; } diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 83039f2..8e97ca7 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,7 +1,7 @@ var navSelect = "home"; var serverURL = window.location.origin; var data; -var trelloInfo = {}; +// var trelloInfo = {}; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. @@ -237,7 +237,7 @@ document.onclick = function(event) { } } -function getTrelloCards() { +/*function getTrelloCards() { Trello.authorize(); var cardArr, listArr, lists; var cards = window.Trello.rest( @@ -262,9 +262,8 @@ function getTrelloCards() { function error(e) { console.log(e); }); -} +}*/ getData(); -getTrelloCards(); createNav(); updateNav(navSelect); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index e9d6391..d92239e 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -12,7 +12,7 @@ - + From 1a3a3f9ed657f09c36e82bf3ca6a605c1638de95 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Fri, 26 Jan 2018 17:50:53 -0500 Subject: [PATCH 21/80] Home page post function, css/animation changes --- SmearcarDB/static/index.css | 33 +++++++++++---- SmearcarDB/static/index.js | 72 ++++++++++++++++++++++++++------- SmearcarDB/templates/index.html | 10 +---- 3 files changed, 85 insertions(+), 30 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index de5bd66..1e169c3 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -203,11 +203,17 @@ a { grid-gap: 2vh; } -#home, #dataValues { + #dataValues { grid-template-columns: 1fr 1fr; grid-template-rows: 2fr 5fr 2fr; } +#home { + display: block; + + opacity: 1; +} + .card { display: grid; @@ -220,7 +226,7 @@ a { transition: all 0.3s cubic-bezier(.25,.8,.25,1); - grid-template-columns: 100%; + grid-template-columns: 35% auto 20%; grid-template-rows: 6vh auto; } @@ -228,8 +234,7 @@ a { box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); } -.card h2 { - width: 35%; +.card > h2 { margin: auto 0 auto 2vh; font-weight: 300; @@ -239,15 +244,27 @@ a { grid-row: 1; } +.card > h3 { + grid-column: 3; + grid-row: 1; +} + .card > div { - grid-column: 1; + grid-column: 1 / 4; grid-row: 2; } -#home { - display: grid; +.card > p { + margin: 2vh 0 2vh 4vh; + font-size: 120%; + font-weight: 300; + grid-column: 1 / 4; + grid-row: 2; +} - opacity: 1; +.card > h3 { + margin: auto; + font-weight: 300; } #langSelect { diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 8e97ca7..2f607ed 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,6 +1,7 @@ var navSelect = "home"; var serverURL = window.location.origin; var data; + // var trelloInfo = {}; @@ -19,7 +20,6 @@ var dropOp = { //Insert correct }; - var dropOpStore = {}; function createNav() { @@ -44,12 +44,17 @@ function createNav() { } } -function updateMain(op) { +function updateMain(op) { // Updates the actual page. updateNav(op); document.getElementById(navSelect).style.opacity = "0"; setTimeout(function() { + console.log(op); document.getElementById(navSelect).style.display = "none"; - document.getElementById(op).style.display = "grid"; + if(op === "home") { + document.getElementById(op).style.display = "block"; + } else { + document.getElementById(op).style.display = "grid"; + } setTimeout(function() { document.getElementById(op).style.opacity = "1"; }, 30); @@ -57,7 +62,7 @@ function updateMain(op) { }, 300); } -function updateNav(op) { +function updateNav(op) { // Updates the sidebar navigation. var oldNav = document.querySelectorAll("[option=" + navSelect + "]")[0]; var newNav = document.querySelectorAll("[option=" + op + "]")[0]; oldNav.style.backgroundColor = "rgba(0,0,0,0)"; @@ -103,11 +108,13 @@ function phoneme(p) { } function generateDropOp() { // For options that change based on data. - dropOp["langSelect"] = [function() { + dropOp["langSelect"] = [function() { // Function that occurs when change language. // Generate info box material. var langInfo = language(dropOpStore["langSelect"]); var info = document.getElementById("langInfoCont"); + var dataBox = document.getElementById("dataTableCont"); info.style.opacity = "0"; + dataBox.style.opacity = "0"; setTimeout(function() { while (info.firstChild) { info.removeChild(info.firstChild); @@ -119,7 +126,7 @@ function generateDropOp() { // For options that change based on data. p2.appendChild(document.createTextNode("Source: ")); if(langInfo.source.length > 0) { a.href = langInfo.source; - srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, langInfo.source.length - 3) + "..." : langInfo.source; + srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, 57) + "..." : langInfo.source; a.appendChild(document.createTextNode(srcText)); p2.appendChild(a); } else { @@ -127,13 +134,10 @@ function generateDropOp() { // For options that change based on data. } info.appendChild(p); info.appendChild(p2); - info.style.opacity = "1"; - }, 400); - // Generate data box material. - var dataBox = document.getElementById("dataTableCont"); - var phonemes = Object.keys(langInfo.phonemes); - dataBox.style.opacity = "0"; - setTimeout(function() { + // Generate data box material. + + var phonemes = Object.keys(langInfo.phonemes); + while (dataBox.firstChild) { dataBox.removeChild(dataBox.firstChild); } @@ -165,8 +169,9 @@ function generateDropOp() { // For options that change based on data. dataBox.children[tableNum].appendChild(p1); dataBox.children[tableNum].appendChild(p2); } + info.style.opacity = "1"; dataBox.style.opacity = "1"; - }, 400); + }, 300); }].concat(["Select language..."].concat(data.languages)); } @@ -237,6 +242,44 @@ document.onclick = function(event) { } } +function homeCards() { + // GET posts from server + var week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; + var month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var examplePost = [ + { + author: "Kenneth Jao", + title: "Test Post!", + content: "This is test post! Link This link should work.
Newlines work.", + date: new Date(2018, 0, 26, 4, 51) + } + ]; + var home = document.getElementById("home"); + for(var i = 0; i < examplePost.length; i++) { + var div = document.createElement("div"); + div.className = "card"; + var h2 = document.createElement("h2"); + h2.textContent = examplePost[i].title; + div.appendChild(h2); + var h3 = document.createElement("h3"); + var dt = examplePost[i].date; + var smallDate = (function() { + var m = (dt.getMonth()+1).toString(); + var d = (dt.getDay()+1).toString(); + m = (m.length === 1) ? "0" + m : m; + d = (d.length === 1) ? "0" + d : d; + return m+"/"+d+"/"+dt.getFullYear().toString(); + })(); + var fullDate = week[dt.getDay()] + ", " + month[dt.getMonth()] + " " + dt.getDate().toString() + ", " + dt.getFullYear().toString(); + h3.textContent = smallDate + " | " + fullDate; + div.appendChild(h3); + var p = document.createElement("p"); + p.innerHTML = examplePost[i].content; + div.appendChild(p); + home.appendChild(div); + } +} + /*function getTrelloCards() { Trello.authorize(); var cardArr, listArr, lists; @@ -265,5 +308,6 @@ document.onclick = function(event) { }*/ getData(); +homeCards(); createNav(); updateNav(navSelect); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index d92239e..82e2e21 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -25,12 +25,6 @@
-
-
-
-
-
-
@@ -40,12 +34,12 @@

Info

-
+

Data

-
+
From feac17bc5ca30f4b5fb5b5894dd9173745014e1f Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 28 Jan 2018 23:27:09 -0500 Subject: [PATCH 22/80] models, get, post --- SmearcarDB/.gitignore | 2 + SmearcarDB/server.py | 97 ++++++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore index 3ce1870..6e71737 100644 --- a/SmearcarDB/.gitignore +++ b/SmearcarDB/.gitignore @@ -108,3 +108,5 @@ venv.bak/ # Other *.p +*.txt +*.db diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 0c035d7..ca004e9 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,72 +1,93 @@ import pickle from flask import Flask from flask import render_template, jsonify, request +from flask_sqlalchemy import SQLAlchemy import ulid app = Flask(__name__) +app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' app.config.update( DEBUG=True, TEMPLATES_AUTO_RELOAD=True ) +db = SQLAlchemy(app) -try: - with open("save.p", "rb") as f: - database = pickle.load(f) - # Can be commented out after non-id languages are all converted - for item in database['values']: - if not 'id' in item: - item['id'] = ulid.new().str -except (FileNotFoundError) as e: - database = {'languages': [], - 'phonemes': [], - 'values': []} -def saveDatabase(): - # Save copy under separate name - with open("newestsave.p", "wb") as f: - pickle.dump(database, f) +class Frequency(db.Model): + language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True) + phoneme_id = db.Column(db.Integer, db.ForeignKey('phoneme.id'), primary_key=True) + value = db.Column(db.Float(6), nullable=False) + phoneme = db.relationship('Phoneme') + + +class Language(db.Model): + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + name = db.Column(db.String(100), nullable=False) + source = db.Column(db.LargeBinary) + phonemes = db.relationship('Frequency') + + +class Phoneme(db.Model): + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + name = db.Column(db.String(5), nullable=False) + + +def database(): + final = {'values': []} + final['languages'] = [f.name for f in Language.query.all()] + final['phonemes'] = [f.name for f in Phoneme.query.all()] + for language in Language.query.all(): + languageobject = {'name': language.name, + 'source': language.source, + 'phonemes': {}} + languageobject['name'] = language.name + for frequency in language.phonemes: + languageobject['phonemes'][frequency.phoneme.name] = frequency.value + final['values'].append(languageobject) + return final + # Render the client at the default URL @app.route("/") def initial(): return render_template('index.html') + # Place for client to communicate with the server @app.route("/server", methods=["GET", "POST", "PATCH"]) # TODO add more methods def backend(): # GET method returns the latest database if request.method == "GET": - return jsonify(database) + return jsonify(database()) # POST method appends input to database['values'] elif request.method == "POST": - newlanguage = request.get_json() - newlanguage['id'] = ulid.new().str - database['values'].append(newlanguage) + recieved = request.get_json() + language = Language(name=recieved['name'], source=recieved['source']) + db.session.add(language) - # Add new phonemes - newphonemes = list(newlanguage[ 'phonemes' ]) - uniquephonemes = list(set(newphonemes) - set(database[ 'phonemes' ])) - database['phonemes'] = database['phonemes'] + uniquephonemes + for phoneme, value in recieved['phonemes'].items(): + with db.session.no_autoflush: + search = Phoneme.query.filter_by(name=phoneme).first() + print(search) + if not search: + search = Phoneme(name=phoneme) + db.session.add(search) + link = Frequency(value=value, phoneme=search) + language.phonemes.append(link) + db.session.add(link) + db.session.commit() + return jsonify(database()) - # Add new language - newlangname = {newlanguage['name']} - uniquelanguages = list(newlangname - set(database['languages'])) - database['languages'] = database['languages'] + uniquelanguages - saveDatabase() - return jsonify(database) + # # PATCH method inputs edited language and returns updated database + # elif request.method == "PATCH": + # newlanguage = request.get_json() + # database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] + # saveDatabase() + # return jsonify(database()) - # PATCH method inputs edited language and returns updated database - elif request.method == "PATCH": - newlanguage = request.get_json() - database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] - saveDatabase() - return jsonify(database) - - else: - return if __name__ == "__main__": app.run(host="0.0.0.0") From 0b812dfd7e7d32e094fa988c948e1f0bc13e4095 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Mon, 29 Jan 2018 12:39:29 -0500 Subject: [PATCH 23/80] added chart --- SmearcarDB/static/Chart.min.js | 10 ++++++++++ SmearcarDB/static/index.css | 10 ++++++++++ SmearcarDB/templates/index.html | 4 +++- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 SmearcarDB/static/Chart.min.js diff --git a/SmearcarDB/static/Chart.min.js b/SmearcarDB/static/Chart.min.js new file mode 100644 index 0000000..2130e2a --- /dev/null +++ b/SmearcarDB/static/Chart.min.js @@ -0,0 +1,10 @@ +/*! + * Chart.js + * http://chartjs.org/ + * Version: 2.7.1 + * + * Copyright 2017 Nick Downie + * Released under the MIT license + * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Chart=t()}}(function(){return function t(e,n,i){function a(r,l){if(!n[r]){if(!e[r]){var s="function"==typeof require&&require;if(!l&&s)return s(r,!0);if(o)return o(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[r]={exports:{}};e[r][0].call(d.exports,function(t){var n=e[r][1][t];return a(n||t)},d,d.exports,t,e,n,i)}return n[r].exports}for(var o="function"==typeof require&&require,r=0;rn?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,a=void 0===e?.5:e,o=2*a-1,r=n.alpha()-i.alpha(),l=((o*r==-1?o:(o+r)/(1+o*r))+1)/2,s=1-l;return this.rgb(l*n.red()+s*i.red(),l*n.green()+s*i.green(),l*n.blue()+s*i.blue()).alpha(n.alpha()*a+i.alpha()*(1-a))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new o,i=this.values,a=n.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],"[object Array]"===(e={}.toString.call(t))?a[r]=t.slice(0):"[object Number]"===e?a[r]=t:console.error("unexpected color value:",t));return n}},o.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},o.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},o.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]}function d(t){var e,n,i,a=u(t),o=a[0],r=a[1],l=a[2];return o/=95.047,r/=100,l/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,e=116*r-16,n=500*(o-r),i=200*(r-l),[e,n,i]}function c(t){var e,n,i,a,o,r=t[0]/360,l=t[1]/100,s=t[2]/100;if(0==l)return o=255*s,[o,o,o];e=2*s-(n=s<.5?s*(1+l):s+l-s*l),a=[0,0,0];for(var u=0;u<3;u++)(i=r+1/3*-(u-1))<0&&i++,i>1&&i--,o=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*o;return a}function h(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-n),l=255*i*(1-n*o),s=255*i*(1-n*(1-o)),i=255*i;switch(a){case 0:return[i,s,r];case 1:return[l,i,r];case 2:return[r,i,s];case 3:return[r,l,i];case 4:return[s,r,i];case 5:return[i,r,l]}}function f(t){var e,n,i,a,o=t[0]/360,l=t[1]/100,s=t[2]/100,u=l+s;switch(u>1&&(l/=u,s/=u),e=Math.floor(6*o),n=1-s,i=6*o-e,0!=(1&e)&&(i=1-i),a=l+i*(n-l),e){default:case 6:case 0:r=n,g=a,b=l;break;case 1:r=a,g=n,b=l;break;case 2:r=l,g=n,b=a;break;case 3:r=l,g=a,b=n;break;case 4:r=a,g=l,b=n;break;case 5:r=n,g=l,b=a}return[255*r,255*g,255*b]}function p(t){var e,n,i,a=t[0]/100,o=t[1]/100,r=t[2]/100,l=t[3]/100;return e=1-Math.min(1,a*(1-l)+l),n=1-Math.min(1,o*(1-l)+l),i=1-Math.min(1,r*(1-l)+l),[255*e,255*n,255*i]}function v(t){var e,n,i,a=t[0]/100,o=t[1]/100,r=t[2]/100;return e=3.2406*a+-1.5372*o+-.4986*r,n=-.9689*a+1.8758*o+.0415*r,i=.0557*a+-.204*o+1.057*r,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]}function m(t){var e,n,i,a=t[0],o=t[1],r=t[2];return a/=95.047,o/=100,r/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,e=116*o-16,n=500*(a-o),i=200*(o-r),[e,n,i]}function x(t){var e,n,i,a,o=t[0],r=t[1],l=t[2];return o<=8?a=(n=100*o/903.3)/100*7.787+16/116:(n=100*Math.pow((o+16)/116,3),a=Math.pow(n/100,1/3)),e=e/95.047<=.008856?e=95.047*(r/500+a-16/116)/7.787:95.047*Math.pow(r/500+a,3),i=i/108.883<=.008859?i=108.883*(a-l/200-16/116)/7.787:108.883*Math.pow(a-l/200,3),[e,n,i]}function y(t){var e,n,i,a=t[0],o=t[1],r=t[2];return e=Math.atan2(r,o),(n=360*e/2/Math.PI)<0&&(n+=360),i=Math.sqrt(o*o+r*r),[a,i,n]}function k(t){return v(x(t))}function w(t){var e,n,i,a=t[0],o=t[1];return i=t[2]/360*2*Math.PI,e=o*Math.cos(i),n=o*Math.sin(i),[a,e,n]}function M(t){return S[t]}e.exports={rgb2hsl:i,rgb2hsv:a,rgb2hwb:o,rgb2cmyk:l,rgb2keyword:s,rgb2xyz:u,rgb2lab:d,rgb2lch:function(t){return y(d(t))},hsl2rgb:c,hsl2hsv:function(t){var e,n,i=t[0],a=t[1]/100,o=t[2]/100;return 0===o?[0,0,0]:(o*=2,a*=o<=1?o:2-o,n=(o+a)/2,e=2*a/(o+a),[i,100*e,100*n])},hsl2hwb:function(t){return o(c(t))},hsl2cmyk:function(t){return l(c(t))},hsl2keyword:function(t){return s(c(t))},hsv2rgb:h,hsv2hsl:function(t){var e,n,i=t[0],a=t[1]/100,o=t[2]/100;return n=(2-a)*o,e=a*o,e/=n<=1?n:2-n,e=e||0,n/=2,[i,100*e,100*n]},hsv2hwb:function(t){return o(h(t))},hsv2cmyk:function(t){return l(h(t))},hsv2keyword:function(t){return s(h(t))},hwb2rgb:f,hwb2hsl:function(t){return i(f(t))},hwb2hsv:function(t){return a(f(t))},hwb2cmyk:function(t){return l(f(t))},hwb2keyword:function(t){return s(f(t))},cmyk2rgb:p,cmyk2hsl:function(t){return i(p(t))},cmyk2hsv:function(t){return a(p(t))},cmyk2hwb:function(t){return o(p(t))},cmyk2keyword:function(t){return s(p(t))},keyword2rgb:M,keyword2hsl:function(t){return i(M(t))},keyword2hsv:function(t){return a(M(t))},keyword2hwb:function(t){return o(M(t))},keyword2cmyk:function(t){return l(M(t))},keyword2lab:function(t){return d(M(t))},keyword2xyz:function(t){return u(M(t))},xyz2rgb:v,xyz2lab:m,xyz2lch:function(t){return y(m(t))},lab2xyz:x,lab2rgb:k,lab2lch:y,lch2lab:w,lch2xyz:function(t){return x(w(t))},lch2rgb:function(t){return k(w(t))}};var S={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},C={};for(var _ in S)C[JSON.stringify(S[_])]=_},{}],5:[function(t,e,n){var i=t(4),a=function(){return new u};for(var o in i){a[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var r=/(\w+)2(\w+)/.exec(o),l=r[1],s=r[2];(a[l]=a[l]||{})[s]=a[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var a=0;a0&&(t[0].yLabel?n=t[0].yLabel:e.labels.length>0&&t[0].index=0&&a>0)&&(v+=a));return o=c.getPixelForValue(v),r=c.getPixelForValue(v+f),l=(r-o)/2,{size:l,base:o,head:r,center:r+l/2}},calculateBarIndexPixels:function(t,e,n){var i,a,r,l,s,u,d=this,c=n.scale.options,h=d.getStackIndex(t),f=n.pixels,g=f[e],p=f.length,v=n.start,m=n.end;return 1===p?(i=g>v?g-v:m-g,a=g0&&(i=(g-f[e-1])/2,e===p-1&&(a=i)),e');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var o=0;o'),a[o]&&e.push(a[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),r=e.datasets[0],l=a.data[i],s=l&&l.custom||{},u=o.valueAtIndexOrDefault,d=t.options.elements.arc;return{text:n,fillStyle:s.backgroundColor?s.backgroundColor:u(r.backgroundColor,i,d.backgroundColor),strokeStyle:s.borderColor?s.borderColor:u(r.borderColor,i,d.borderColor),lineWidth:s.borderWidth?s.borderWidth:u(r.borderWidth,i,d.borderWidth),hidden:isNaN(r.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,o=e.index,r=this.chart;for(n=0,i=(r.data.datasets||[]).length;n=Math.PI?-1:g<-Math.PI?1:0))+f,v={x:Math.cos(g),y:Math.sin(g)},m={x:Math.cos(p),y:Math.sin(p)},b=g<=0&&p>=0||g<=2*Math.PI&&2*Math.PI<=p,x=g<=.5*Math.PI&&.5*Math.PI<=p||g<=2.5*Math.PI&&2.5*Math.PI<=p,y=g<=-Math.PI&&-Math.PI<=p||g<=Math.PI&&Math.PI<=p,k=g<=.5*-Math.PI&&.5*-Math.PI<=p||g<=1.5*Math.PI&&1.5*Math.PI<=p,w=h/100,M={x:y?-1:Math.min(v.x*(v.x<0?1:w),m.x*(m.x<0?1:w)),y:k?-1:Math.min(v.y*(v.y<0?1:w),m.y*(m.y<0?1:w))},S={x:b?1:Math.max(v.x*(v.x>0?1:w),m.x*(m.x>0?1:w)),y:x?1:Math.max(v.y*(v.y>0?1:w),m.y*(m.y>0?1:w))},C={width:.5*(S.x-M.x),height:.5*(S.y-M.y)};u=Math.min(l/C.width,s/C.height),d={x:-.5*(S.x+M.x),y:-.5*(S.y+M.y)}}n.borderWidth=e.getMaxBorderWidth(c.data),n.outerRadius=Math.max((u-n.borderWidth)/2,0),n.innerRadius=Math.max(h?n.outerRadius/100*h:0,0),n.radiusLength=(n.outerRadius-n.innerRadius)/n.getVisibleDatasetCount(),n.offsetX=d.x*n.outerRadius,n.offsetY=d.y*n.outerRadius,c.total=e.calculateTotal(),e.outerRadius=n.outerRadius-n.radiusLength*e.getRingIndex(e.index),e.innerRadius=Math.max(e.outerRadius-n.radiusLength,0),o.each(c.data,function(n,i){e.updateElement(n,i,t)})},updateElement:function(t,e,n){var i=this,a=i.chart,r=a.chartArea,l=a.options,s=l.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=l.rotation,h=l.rotation,f=i.getDataset(),g=n&&s.animateRotate?0:t.hidden?0:i.calculateCircumference(f.data[e])*(l.circumference/(2*Math.PI)),p=n&&s.animateScale?0:i.innerRadius,v=n&&s.animateScale?0:i.outerRadius,m=o.valueAtIndexOrDefault;o.extend(t,{_datasetIndex:i.index,_index:e,_model:{x:u+a.offsetX,y:d+a.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:v,innerRadius:p,label:m(f.label,e,a.data.labels[e])}});var b=t._model;this.removeHoverStyle(t),n&&s.animateRotate||(b.startAngle=0===e?l.rotation:i.getMeta().data[e-1]._model.endAngle,b.endAngle=b.startAngle+b.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,e=this.getDataset(),n=this.getMeta(),i=0;return o.each(n.data,function(n,a){t=e.data[a],isNaN(t)||n.hidden||(i+=Math.abs(t))}),i},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,n,i=0,a=this.index,o=t.length,r=0;r(i=e>i?e:i)?n:i;return i}})}},{25:25,40:40,45:45}],18:[function(t,e,n){"use strict";var i=t(25),a=t(40),o=t(45);i._set("line",{showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}}),e.exports=function(t){function e(t,e){return o.valueOrDefault(t.showLine,e.showLines)}t.controllers.line=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,update:function(t){var n,i,a,r=this,l=r.getMeta(),s=l.dataset,u=l.data||[],d=r.chart.options,c=d.elements.line,h=r.getScaleForId(l.yAxisID),f=r.getDataset(),g=e(f,d);for(g&&(a=s.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),s._scale=h,s._datasetIndex=r.index,s._children=u,s._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:a.tension?a.tension:o.valueOrDefault(f.lineTension,c.tension),backgroundColor:a.backgroundColor?a.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:a.borderWidth?a.borderWidth:f.borderWidth||c.borderWidth,borderColor:a.borderColor?a.borderColor:f.borderColor||c.borderColor,borderCapStyle:a.borderCapStyle?a.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:a.borderDash?a.borderDash:f.borderDash||c.borderDash,borderDashOffset:a.borderDashOffset?a.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:a.borderJoinStyle?a.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:a.fill?a.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:a.steppedLine?a.steppedLine:o.valueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:a.cubicInterpolationMode?a.cubicInterpolationMode:o.valueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode)},s.pivot()),n=0,i=u.length;n');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var o=0;o'),a[o]&&e.push(a[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(t){var e=t.data;return e.labels.length&&e.datasets.length?e.labels.map(function(n,i){var a=t.getDatasetMeta(0),r=e.datasets[0],l=a.data[i].custom||{},s=o.valueAtIndexOrDefault,u=t.options.elements.arc;return{text:n,fillStyle:l.backgroundColor?l.backgroundColor:s(r.backgroundColor,i,u.backgroundColor),strokeStyle:l.borderColor?l.borderColor:s(r.borderColor,i,u.borderColor),lineWidth:l.borderWidth?l.borderWidth:s(r.borderWidth,i,u.borderWidth),hidden:isNaN(r.data[i])||a.data[i].hidden,index:i}}):[]}},onClick:function(t,e){var n,i,a,o=e.index,r=this.chart;for(n=0,i=(r.data.datasets||[]).length;n0&&!isNaN(t)?2*Math.PI/e:0}})}},{25:25,40:40,45:45}],20:[function(t,e,n){"use strict";var i=t(25),a=t(40),o=t(45);i._set("radar",{scale:{type:"radialLinear"},elements:{line:{tension:0}}}),e.exports=function(t){t.controllers.radar=t.DatasetController.extend({datasetElementType:a.Line,dataElementType:a.Point,linkScales:o.noop,update:function(t){var e=this,n=e.getMeta(),i=n.dataset,a=n.data,r=i.custom||{},l=e.getDataset(),s=e.chart.options.elements.line,u=e.chart.scale;void 0!==l.tension&&void 0===l.lineTension&&(l.lineTension=l.tension),o.extend(n.dataset,{_datasetIndex:e.index,_scale:u,_children:a,_loop:!0,_model:{tension:r.tension?r.tension:o.valueOrDefault(l.lineTension,s.tension),backgroundColor:r.backgroundColor?r.backgroundColor:l.backgroundColor||s.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:l.borderWidth||s.borderWidth,borderColor:r.borderColor?r.borderColor:l.borderColor||s.borderColor,fill:r.fill?r.fill:void 0!==l.fill?l.fill:s.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:l.borderCapStyle||s.borderCapStyle,borderDash:r.borderDash?r.borderDash:l.borderDash||s.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:l.borderDashOffset||s.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:l.borderJoinStyle||s.borderJoinStyle}}),n.dataset.pivot(),o.each(a,function(n,i){e.updateElement(n,i,t)},e),e.updateBezierControlPoints()},updateElement:function(t,e,n){var i=this,a=t.custom||{},r=i.getDataset(),l=i.chart.scale,s=i.chart.options.elements.point,u=l.getPointPositionForValue(e,r.data[e]);void 0!==r.radius&&void 0===r.pointRadius&&(r.pointRadius=r.radius),void 0!==r.hitRadius&&void 0===r.pointHitRadius&&(r.pointHitRadius=r.hitRadius),o.extend(t,{_datasetIndex:i.index,_index:e,_scale:l,_model:{x:n?l.xCenter:u.x,y:n?l.yCenter:u.y,tension:a.tension?a.tension:o.valueOrDefault(r.lineTension,i.chart.options.elements.line.tension),radius:a.radius?a.radius:o.valueAtIndexOrDefault(r.pointRadius,e,s.radius),backgroundColor:a.backgroundColor?a.backgroundColor:o.valueAtIndexOrDefault(r.pointBackgroundColor,e,s.backgroundColor),borderColor:a.borderColor?a.borderColor:o.valueAtIndexOrDefault(r.pointBorderColor,e,s.borderColor),borderWidth:a.borderWidth?a.borderWidth:o.valueAtIndexOrDefault(r.pointBorderWidth,e,s.borderWidth),pointStyle:a.pointStyle?a.pointStyle:o.valueAtIndexOrDefault(r.pointStyle,e,s.pointStyle),hitRadius:a.hitRadius?a.hitRadius:o.valueAtIndexOrDefault(r.pointHitRadius,e,s.hitRadius)}}),t._model.skip=a.skip?a.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,e=this.getMeta();o.each(e.data,function(n,i){var a=n._model,r=o.splineCurve(o.previousItem(e.data,i,!0)._model,a,o.nextItem(e.data,i,!0)._model,a.tension);a.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),a.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),a.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),a.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),n.pivot()})},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model;a.radius=n.hoverRadius?n.hoverRadius:o.valueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),a.backgroundColor=n.hoverBackgroundColor?n.hoverBackgroundColor:o.valueAtIndexOrDefault(e.pointHoverBackgroundColor,i,o.getHoverColor(a.backgroundColor)),a.borderColor=n.hoverBorderColor?n.hoverBorderColor:o.valueAtIndexOrDefault(e.pointHoverBorderColor,i,o.getHoverColor(a.borderColor)),a.borderWidth=n.hoverBorderWidth?n.hoverBorderWidth:o.valueAtIndexOrDefault(e.pointHoverBorderWidth,i,a.borderWidth)},removeHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t.custom||{},i=t._index,a=t._model,r=this.chart.options.elements.point;a.radius=n.radius?n.radius:o.valueAtIndexOrDefault(e.pointRadius,i,r.radius),a.backgroundColor=n.backgroundColor?n.backgroundColor:o.valueAtIndexOrDefault(e.pointBackgroundColor,i,r.backgroundColor),a.borderColor=n.borderColor?n.borderColor:o.valueAtIndexOrDefault(e.pointBorderColor,i,r.borderColor),a.borderWidth=n.borderWidth?n.borderWidth:o.valueAtIndexOrDefault(e.pointBorderWidth,i,r.borderWidth)}})}},{25:25,40:40,45:45}],21:[function(t,e,n){"use strict";t(25)._set("scatter",{hover:{mode:"single"},scales:{xAxes:[{id:"x-axis-1",type:"linear",position:"bottom"}],yAxes:[{id:"y-axis-1",type:"linear",position:"left"}]},showLines:!1,tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}}),e.exports=function(t){t.controllers.scatter=t.controllers.line}},{25:25}],22:[function(t,e,n){"use strict";var i=t(25),a=t(26),o=t(45);i._set("global",{animation:{duration:1e3,easing:"easeOutQuart",onProgress:o.noop,onComplete:o.noop}}),e.exports=function(t){t.Animation=a.extend({chart:null,currentStep:0,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,n,i){var a,o,r=this.animations;for(e.chart=t,i||(t.animating=!0),a=0,o=r.length;a1&&(n=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1),t.advance(1+n);var i=Date.now();t.dropFrames+=(i-e)/t.frameDuration,t.animations.length>0&&t.requestAnimationFrame()},advance:function(t){for(var e,n,i=this.animations,a=0;a=e.numSteps?(o.callback(e.onAnimationComplete,[e],n),n.animating=!1,i.splice(a,1)):++a}},Object.defineProperty(t.Animation.prototype,"animationObject",{get:function(){return this}}),Object.defineProperty(t.Animation.prototype,"chartInstance",{get:function(){return this.chart},set:function(t){this.chart=t}})}},{25:25,26:26,45:45}],23:[function(t,e,n){"use strict";var i=t(25),a=t(45),o=t(28),r=t(48);e.exports=function(t){function e(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=a.configMerge(i.global,i[t.type],t.options||{}),t}function n(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}function l(t){return"top"===t||"bottom"===t}var s=t.plugins;t.types={},t.instances={},t.controllers={},a.extend(t.prototype,{construct:function(n,i){var o=this;i=e(i);var l=r.acquireContext(n,i),s=l&&l.canvas,u=s&&s.height,d=s&&s.width;o.id=a.uid(),o.ctx=l,o.canvas=s,o.config=i,o.width=d,o.height=u,o.aspectRatio=u?d/u:null,o.options=i.options,o._bufferedRender=!1,o.chart=o,o.controller=o,t.instances[o.id]=o,Object.defineProperty(o,"data",{get:function(){return o.config.data},set:function(t){o.config.data=t}}),l&&s?(o.initialize(),o.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return s.notify(t,"beforeInit"),a.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),s.notify(t,"afterInit"),t},clear:function(){return a.canvas.clear(this),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,o=n.maintainAspectRatio&&e.aspectRatio||null,r=Math.max(0,Math.floor(a.getMaximumWidth(i))),l=Math.max(0,Math.floor(o?r/o:a.getMaximumHeight(i)));if((e.width!==r||e.height!==l)&&(i.width=e.width=r,i.height=e.height=l,i.style.width=r+"px",i.style.height=l+"px",a.retinaScale(e,n.devicePixelRatio),!t)){var u={width:r,height:l};s.notify(e,"resize",[u]),e.options.onResize&&e.options.onResize(e,u),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;a.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),a.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),n&&(n.id=n.id||"scale")},buildScales:function(){var e=this,n=e.options,i=e.scales={},o=[];n.scales&&(o=o.concat((n.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category",dposition:"bottom"}}),(n.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear",dposition:"left"}}))),n.scale&&o.push({options:n.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),a.each(o,function(n){var o=n.options,r=a.valueOrDefault(o.type,n.dtype),s=t.scaleService.getScaleConstructor(r);if(s){l(o.position)!==l(n.dposition)&&(o.position=n.dposition);var u=new s({id:o.id,options:o,ctx:e.ctx,chart:e});i[u.id]=u,u.mergeTicksOptions(),n.isDefault&&(e.scale=u)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,n=[],i=[];return a.each(e.data.datasets,function(a,o){var r=e.getDatasetMeta(o),l=a.type||e.config.type;if(r.type&&r.type!==l&&(e.destroyDatasetMeta(o),r=e.getDatasetMeta(o)),r.type=l,n.push(r.type),r.controller)r.controller.updateIndex(o);else{var s=t.controllers[r.type];if(void 0===s)throw new Error('"'+r.type+'" is not a chart type.');r.controller=new s(e,o),i.push(r.controller)}},e),i},resetElements:function(){var t=this;a.each(t.data.datasets,function(e,n){t.getDatasetMeta(n).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t){var e=this;if(t&&"object"==typeof t||(t={duration:t,lazy:arguments[1]}),n(e),!1!==s.notify(e,"beforeUpdate")){e.tooltip._data=e.data;var i=e.buildOrUpdateControllers();a.each(e.data.datasets,function(t,n){e.getDatasetMeta(n).controller.buildOrUpdateElements()},e),e.updateLayout(),a.each(i,function(t){t.reset()}),e.updateDatasets(),e.tooltip.initialize(),e.lastActive=[],s.notify(e,"afterUpdate"),e._bufferedRender?e._bufferedRequest={duration:t.duration,easing:t.easing,lazy:t.lazy}:e.render(t)}},updateLayout:function(){var e=this;!1!==s.notify(e,"beforeLayout")&&(t.layoutService.update(this,this.width,this.height),s.notify(e,"afterScaleUpdate"),s.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(!1!==s.notify(t,"beforeDatasetsUpdate")){for(var e=0,n=t.data.datasets.length;e=0;--n)e.isDatasetVisible(n)&&e.drawDataset(n,t);s.notify(e,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n=this,i=n.getDatasetMeta(t),a={meta:i,index:t,easingValue:e};!1!==s.notify(n,"beforeDatasetDraw",[a])&&(i.controller.draw(e),s.notify(n,"afterDatasetDraw",[a]))},_drawTooltip:function(t){var e=this,n=e.tooltip,i={tooltip:n,easingValue:t};!1!==s.notify(e,"beforeTooltipDraw",[i])&&(n.draw(),s.notify(e,"afterTooltipDraw",[i]))},getElementAtEvent:function(t){return o.modes.single(this,t)},getElementsAtEvent:function(t){return o.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return o.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var i=o.modes[e];return"function"==typeof i?i(this,t,n):[]},getDatasetAtEvent:function(t){return o.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e0||(a.forEach(function(e){delete t[e]}),delete t._chartjs)}}var a=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.getDataset();null===e.xAxisID&&(e.xAxisID=n.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=n.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&n(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),a=n.getDataset().data||[],o=i.data;for(t=0,e=a.length;ti&&t.insertElements(i,a-i)},insertElements:function(t,e){for(var n=0;n=n[e].length&&n[e].push({}),!n[e][r].type||s.type&&s.type!==n[e][r].type?o.merge(n[e][r],[t.scaleService.getScaleDefaults(l),s]):o.merge(n[e][r],s)}else o._merger(e,n,i,a)}})},o.where=function(t,e){if(o.isArray(t)&&Array.prototype.filter)return t.filter(e);var n=[];return o.each(t,function(t){e(t)&&n.push(t)}),n},o.findIndex=Array.prototype.findIndex?function(t,e,n){return t.findIndex(e,n)}:function(t,e,n){n=void 0===n?t:n;for(var i=0,a=t.length;i=0;i--){var a=t[i];if(e(a))return a}},o.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},o.almostEquals=function(t,e,n){return Math.abs(t-e)t},o.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},o.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},o.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},o.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},o.toRadians=function(t){return t*(Math.PI/180)},o.toDegrees=function(t){return t*(180/Math.PI)},o.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),o=Math.atan2(i,n);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:a}},o.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},o.aliasPixel=function(t){return t%2==0?0:.5},o.splineCurve=function(t,e,n,i){var a=t.skip?e:t,o=e,r=n.skip?e:n,l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),s=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),u=l/(l+s),d=s/(l+s),c=i*(u=isNaN(u)?0:u),h=i*(d=isNaN(d)?0:d);return{previous:{x:o.x-c*(r.x-a.x),y:o.y-c*(r.y-a.y)},next:{x:o.x+h*(r.x-a.x),y:o.y+h*(r.y-a.y)}}},o.EPSILON=Number.EPSILON||1e-14,o.splineCurveMonotone=function(t){var e,n,i,a,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),l=r.length;for(e=0;e0?r[e-1]:null,(a=e0?r[e-1]:null,a=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},o.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},o.niceNum=function(t,e){var n=Math.floor(o.log10(t)),i=t/Math.pow(10,n);return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*Math.pow(10,n)},o.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},o.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,r=t.currentTarget||t.srcElement,l=r.getBoundingClientRect(),s=a.touches;s&&s.length>0?(n=s[0].clientX,i=s[0].clientY):(n=a.clientX,i=a.clientY);var u=parseFloat(o.getStyle(r,"padding-left")),d=parseFloat(o.getStyle(r,"padding-top")),c=parseFloat(o.getStyle(r,"padding-right")),h=parseFloat(o.getStyle(r,"padding-bottom")),f=l.right-l.left-u-c,g=l.bottom-l.top-d-h;return n=Math.round((n-l.left-u)/f*r.width/e.currentDevicePixelRatio),i=Math.round((i-l.top-d)/g*r.height/e.currentDevicePixelRatio),{x:n,y:i}},o.getConstraintWidth=function(t){return r(t,"max-width","clientWidth")},o.getConstraintHeight=function(t){return r(t,"max-height","clientHeight")},o.getMaximumWidth=function(t){var e=t.parentNode;if(!e)return t.clientWidth;var n=parseInt(o.getStyle(e,"padding-left"),10),i=parseInt(o.getStyle(e,"padding-right"),10),a=e.clientWidth-n-i,r=o.getConstraintWidth(t);return isNaN(r)?a:Math.min(a,r)},o.getMaximumHeight=function(t){var e=t.parentNode;if(!e)return t.clientHeight;var n=parseInt(o.getStyle(e,"padding-top"),10),i=parseInt(o.getStyle(e,"padding-bottom"),10),a=e.clientHeight-n-i,r=o.getConstraintHeight(t);return isNaN(r)?a:Math.min(a,r)},o.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},o.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||window.devicePixelRatio||1;if(1!==n){var i=t.canvas,a=t.height,o=t.width;i.height=a*n,i.width=o*n,t.ctx.scale(n,n),i.style.height=a+"px",i.style.width=o+"px"}},o.fontString=function(t,e,n){return e+" "+t+"px "+n},o.longestText=function(t,e,n,i){var a=(i=i||{}).data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var l=0;o.each(n,function(e){void 0!==e&&null!==e&&!0!==o.isArray(e)?l=o.measureText(t,a,r,l,e):o.isArray(e)&&o.each(e,function(e){void 0===e||null===e||o.isArray(e)||(l=o.measureText(t,a,r,l,e))})});var s=r.length/2;if(s>n.length){for(var u=0;ui&&(i=o),i},o.numberOfLabelLines=function(t){var e=1;return o.each(t,function(t){o.isArray(t)&&t.length>e&&(e=t.length)}),e},o.color=i?function(t){return t instanceof CanvasGradient&&(t=a.global.defaultColor),i(t)}:function(t){return console.error("Color.js not found!"),t},o.getHoverColor=function(t){return t instanceof CanvasPattern?t:o.color(t).saturate(.5).darken(.1).rgbString()}}},{25:25,3:3,45:45}],28:[function(t,e,n){"use strict";function i(t,e){return t.native?{x:t.x,y:t.y}:u.getRelativePosition(t,e)}function a(t,e){var n,i,a,o,r;for(i=0,o=t.data.datasets.length;i0&&(u=t.getDatasetMeta(u[0]._datasetIndex).data),u},"x-axis":function(t,e){return s(t,e,{intersect:!1})},point:function(t,e){return o(t,i(e,t))},nearest:function(t,e,n){var a=i(e,t);n.axis=n.axis||"xy";var o=l(n.axis),s=r(t,a,n.intersect,o);return s.length>1&&s.sort(function(t,e){var n=t.getArea()-e.getArea();return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),s.slice(0,1)},x:function(t,e,n){var o=i(e,t),r=[],l=!1;return a(t,function(t){t.inXRange(o.x)&&r.push(t),t.inRange(o.x,o.y)&&(l=!0)}),n.intersect&&!l&&(r=[]),r},y:function(t,e,n){var o=i(e,t),r=[],l=!1;return a(t,function(t){t.inYRange(o.y)&&r.push(t),t.inRange(o.x,o.y)&&(l=!0)}),n.intersect&&!l&&(r=[]),r}}}},{45:45}],29:[function(t,e,n){"use strict";t(25)._set("global",{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},layout:{padding:{top:0,right:0,bottom:0,left:0}}}),e.exports=function(){var t=function(t,e){return this.construct(t,e),this};return t.Chart=t,t}},{25:25}],30:[function(t,e,n){"use strict";var i=t(45);e.exports=function(t){function e(t,e){return i.where(t,function(t){return t.position===e})}function n(t,e){t.forEach(function(t,e){return t._tmpIndex_=e,t}),t.sort(function(t,n){var i=e?n:t,a=e?t:n;return i.weight===a.weight?i._tmpIndex_-a._tmpIndex_:i.weight-a.weight}),t.forEach(function(t){delete t._tmpIndex_})}t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),e.fullWidth=e.fullWidth||!1,e.position=e.position||"top",e.weight=e.weight||0,t.boxes.push(e)},removeBox:function(t,e){var n=t.boxes?t.boxes.indexOf(e):-1;-1!==n&&t.boxes.splice(n,1)},configure:function(t,e,n){for(var i,a=["fullWidth","position","weight"],o=a.length,r=0;rh&&st.maxHeight){s--;break}s++,c=u*d}t.labelRotation=s},afterCalculateTickRotation:function(){l.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){l.callback(this.options.beforeFit,[this])},fit:function(){var t=this,a=t.minSize={width:0,height:0},o=i(t._ticks),r=t.options,u=r.ticks,d=r.scaleLabel,c=r.gridLines,h=r.display,f=t.isHorizontal(),g=n(u),p=r.gridLines.tickMarkLength;if(a.width=f?t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:h&&c.drawTicks?p:0,a.height=f?h&&c.drawTicks?p:0:t.maxHeight,d.display&&h){var v=s(d)+l.options.toPadding(d.padding).height;f?a.height+=v:a.width+=v}if(u.display&&h){var m=l.longestText(t.ctx,g.font,o,t.longestTextCache),b=l.numberOfLabelLines(o),x=.5*g.size,y=t.options.ticks.padding;if(f){t.longestLabelWidth=m;var k=l.toRadians(t.labelRotation),w=Math.cos(k),M=Math.sin(k)*m+g.size*b+x*(b-1)+x;a.height=Math.min(t.maxHeight,a.height+M+y),t.ctx.font=g.font;var S=e(t.ctx,o[0],g.font),C=e(t.ctx,o[o.length-1],g.font);0!==t.labelRotation?(t.paddingLeft="bottom"===r.position?w*S+3:w*x+3,t.paddingRight="bottom"===r.position?w*x+3:w*C+3):(t.paddingLeft=S/2+3,t.paddingRight=C/2+3)}else u.mirror?m=0:m+=y+x,a.width=Math.min(t.maxWidth,a.width+m),t.paddingTop=g.size/2,t.paddingBottom=g.size/2}t.handleMargins(),t.width=a.width,t.height=a.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){l.callback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(l.isNullOrUndef(t))return NaN;if("number"==typeof t&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},getLabelForIndex:l.noop,getPixelForValue:l.noop,getValueForPixel:l.noop,getPixelForTick:function(t){var e=this,n=e.options.offset;if(e.isHorizontal()){var i=(e.width-(e.paddingLeft+e.paddingRight))/Math.max(e._ticks.length-(n?0:1),1),a=i*t+e.paddingLeft;n&&(a+=i/2);var o=e.left+Math.round(a);return o+=e.isFullWidth()?e.margins.left:0}var r=e.height-(e.paddingTop+e.paddingBottom);return e.top+t*(r/(e._ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var n=(e.width-(e.paddingLeft+e.paddingRight))*t+e.paddingLeft,i=e.left+Math.round(n);return i+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},_autoSkip:function(t){var e,n,i,a,o=this,r=o.isHorizontal(),s=o.options.ticks.minor,u=t.length,d=l.toRadians(o.labelRotation),c=Math.cos(d),h=o.longestLabelWidth*c,f=[];for(s.maxTicksLimit&&(a=s.maxTicksLimit),r&&(e=!1,(h+s.autoSkipPadding)*u>o.width-(o.paddingLeft+o.paddingRight)&&(e=1+Math.floor((h+s.autoSkipPadding)*u/(o.width-(o.paddingLeft+o.paddingRight)))),a&&u>a&&(e=Math.max(e,Math.floor(u/a)))),n=0;n1&&n%e>0||n%e==0&&n+e>=u)&&n!==u-1&&delete i.label,f.push(i);return f},draw:function(t){var e=this,i=e.options;if(i.display){var r=e.ctx,u=o.global,d=i.ticks.minor,c=i.ticks.major||d,h=i.gridLines,f=i.scaleLabel,g=0!==e.labelRotation,p=e.isHorizontal(),v=d.autoSkip?e._autoSkip(e.getTicks()):e.getTicks(),m=l.valueOrDefault(d.fontColor,u.defaultFontColor),b=n(d),x=l.valueOrDefault(c.fontColor,u.defaultFontColor),y=n(c),k=h.drawTicks?h.tickMarkLength:0,w=l.valueOrDefault(f.fontColor,u.defaultFontColor),M=n(f),S=l.options.toPadding(f.padding),C=l.toRadians(e.labelRotation),_=[],D="right"===i.position?e.left:e.right-k,I="right"===i.position?e.left+k:e.right,P="bottom"===i.position?e.top:e.bottom-k,A="bottom"===i.position?e.top+k:e.bottom;if(l.each(v,function(n,o){if(!l.isNullOrUndef(n.label)){var r,s,c,f,m=n.label;o===e.zeroLineIndex&&i.offset===h.offsetGridLines?(r=h.zeroLineWidth,s=h.zeroLineColor,c=h.zeroLineBorderDash,f=h.zeroLineBorderDashOffset):(r=l.valueAtIndexOrDefault(h.lineWidth,o),s=l.valueAtIndexOrDefault(h.color,o),c=l.valueOrDefault(h.borderDash,u.borderDash),f=l.valueOrDefault(h.borderDashOffset,u.borderDashOffset));var b,x,y,w,M,S,T,F,O,R,L="middle",z="middle",B=d.padding;if(p){var W=k+B;"bottom"===i.position?(z=g?"middle":"top",L=g?"right":"center",R=e.top+W):(z=g?"middle":"bottom",L=g?"left":"center",R=e.bottom-W);var N=a(e,o,h.offsetGridLines&&v.length>1);N1);H0)n=t.stepSize;else{var o=i.niceNum(e.max-e.min,!1);n=i.niceNum(o/(t.maxTicks-1),!0)}var r=Math.floor(e.min/n)*n,l=Math.ceil(e.max/n)*n;t.min&&t.max&&t.stepSize&&i.almostWhole((t.max-t.min)/t.stepSize,n/1e3)&&(r=t.min,l=t.max);var s=(l-r)/n;s=i.almostEquals(s,Math.round(s),n/1e3)?Math.round(s):Math.ceil(s),a.push(void 0!==t.min?t.min:r);for(var u=1;u3?n[2]-n[1]:n[1]-n[0];Math.abs(a)>1&&t!==Math.floor(t)&&(a=t-Math.floor(t));var o=i.log10(Math.abs(a)),r="";if(0!==t){var l=-1*Math.floor(o);l=Math.max(Math.min(l,20),0),r=t.toFixed(l)}else r="0";return r},logarithmic:function(t,e,n){var a=t/Math.pow(10,Math.floor(i.log10(t)));return 0===t?"0":1===a||2===a||5===a||0===e||e===n.length-1?t.toExponential():""}}}},{45:45}],35:[function(t,e,n){"use strict";var i=t(25),a=t(26),o=t(45);i._set("global",{tooltips:{enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretPadding:2,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,borderColor:"rgba(0,0,0,0)",borderWidth:0,callbacks:{beforeTitle:o.noop,title:function(t,e){var n="",i=e.labels,a=i?i.length:0;if(t.length>0){var o=t[0];o.xLabel?n=o.xLabel:a>0&&o.indexi.height-e.height&&(r="bottom");var l,s,u,d,c,h=(a.left+a.right)/2,f=(a.top+a.bottom)/2;"center"===r?(l=function(t){return t<=h},s=function(t){return t>h}):(l=function(t){return t<=e.width/2},s=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},l(n.x)?(o="left",u(n.x)&&(o="center",r=c(n.y))):s(n.x)&&(o="right",d(n.x)&&(o="center",r=c(n.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:o,yAlign:g.yAlign?g.yAlign:r}}function d(t,e,n){var i=t.x,a=t.y,o=t.caretSize,r=t.caretPadding,l=t.cornerRadius,s=n.xAlign,u=n.yAlign,d=o+r,c=l+r;return"right"===s?i-=e.width:"center"===s&&(i-=e.width/2),"top"===u?a+=d:a-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===s?i+=d:"right"===s&&(i-=d):"left"===s?i-=c:"right"===s&&(i+=c),{x:i,y:a}}t.Tooltip=a.extend({initialize:function(){this._model=l(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options.callbacks,i=e.beforeTitle.apply(t,arguments),a=e.title.apply(t,arguments),o=e.afterTitle.apply(t,arguments),r=[];return r=n(r,i),r=n(r,a),r=n(r,o)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return o.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,a=i._options.callbacks,r=[];return o.each(t,function(t){var o={before:[],lines:[],after:[]};n(o.before,a.beforeLabel.call(i,t,e)),n(o.lines,a.label.call(i,t,e)),n(o.after,a.afterLabel.call(i,t,e)),r.push(o)}),r},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return o.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),a=e.footer.apply(t,arguments),o=e.afterFooter.apply(t,arguments),r=[];return r=n(r,i),r=n(r,a),r=n(r,o)},update:function(e){var n,i,a=this,c=a._options,h=a._model,f=a._model=l(c),g=a._active,p=a._data,v={xAlign:h.xAlign,yAlign:h.yAlign},m={x:h.x,y:h.y},b={width:h.width,height:h.height},x={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var y=[],k=[];x=t.Tooltip.positioners[c.position].call(a,g,a._eventPosition);var w=[];for(n=0,i=g.length;n0&&i.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&o&&(this.drawBackground(i,e,t,n,a),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,a),this.drawBody(i,e,t,a),this.drawFooter(i,e,t,a))}},handleEvent:function(t){var e=this,n=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chart.getElementsAtEventForMode(t,n.mode,n),!(i=!o.arrayEquals(e._active,e._lastActive)))return!1;if(e._lastActive=e._active,n.enabled||n.custom){e._eventPosition={x:t.x,y:t.y};var a=e._model;e.update(!0),e.pivot(),i|=a.x!==e._model.x||a.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,n,i=0,a=0,o=0;for(e=0,n=t.length;es;)a-=2*Math.PI;for(;a=l&&a<=s,d=r>=n.innerRadius&&r<=n.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t=this._chart.ctx,e=this._view,n=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,n,i),t.arc(e.x,e.y,e.innerRadius,i,n,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})},{25:25,26:26,45:45}],37:[function(t,e,n){"use strict";var i=t(25),a=t(26),o=t(45),r=i.global;i._set("global",{elements:{line:{tension:.4,backgroundColor:r.defaultColor,borderWidth:3,borderColor:r.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0}}}),e.exports=a.extend({draw:function(){var t,e,n,i,a=this,l=a._view,s=a._chart.ctx,u=l.spanGaps,d=a._children.slice(),c=r.elements.line,h=-1;for(a._loop&&d.length&&d.push(d[0]),s.save(),s.lineCap=l.borderCapStyle||c.borderCapStyle,s.setLineDash&&s.setLineDash(l.borderDash||c.borderDash),s.lineDashOffset=l.borderDashOffset||c.borderDashOffset,s.lineJoin=l.borderJoinStyle||c.borderJoinStyle,s.lineWidth=l.borderWidth||c.borderWidth,s.strokeStyle=l.borderColor||r.defaultColor,s.beginPath(),h=-1,t=0;te?1:-1,r=1,l=u.borderSkipped||"left"):(e=u.x-u.width/2,n=u.x+u.width/2,i=u.y,o=1,r=(a=u.base)>i?1:-1,l=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-n),Math.abs(i-a)),h=(d=d>c?c:d)/2,f=e+("left"!==l?h*o:0),g=n+("right"!==l?-h*o:0),p=i+("top"!==l?h*r:0),v=a+("bottom"!==l?-h*r:0);f!==g&&(i=p,a=v),p!==v&&(e=f,n=g)}s.beginPath(),s.fillStyle=u.backgroundColor,s.strokeStyle=u.borderColor,s.lineWidth=d;var m=[[e,a],[e,i],[n,i],[n,a]],b=["bottom","left","top","right"].indexOf(l,0);-1===b&&(b=0);var x=t(0);s.moveTo(x[0],x[1]);for(var y=1;y<4;y++)x=t(y),s.lineTo(x[0],x[1]);s.fill(),d&&s.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var n=!1;if(this._view){var i=a(this);n=t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}return n},inLabelRange:function(t,e){var n=this;if(!n._view)return!1;var o=a(n);return i(n)?t>=o.left&&t<=o.right:e>=o.top&&e<=o.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,e,n=this._view;return i(this)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})},{25:25,26:26}],40:[function(t,e,n){"use strict";e.exports={},e.exports.Arc=t(36),e.exports.Line=t(37),e.exports.Point=t(38),e.exports.Rectangle=t(39)},{36:36,37:37,38:38,39:39}],41:[function(t,e,n){"use strict";var i=t(42),n=e.exports={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,i,a,o){if(o){var r=Math.min(o,i/2),l=Math.min(o,a/2);t.moveTo(e+r,n),t.lineTo(e+i-r,n),t.quadraticCurveTo(e+i,n,e+i,n+l),t.lineTo(e+i,n+a-l),t.quadraticCurveTo(e+i,n+a,e+i-r,n+a),t.lineTo(e+r,n+a),t.quadraticCurveTo(e,n+a,e,n+a-l),t.lineTo(e,n+l),t.quadraticCurveTo(e,n,e+r,n)}else t.rect(e,n,i,a)},drawPoint:function(t,e,n,i,a){var o,r,l,s,u,d;if(!e||"object"!=typeof e||"[object HTMLImageElement]"!==(o=e.toString())&&"[object HTMLCanvasElement]"!==o){if(!(isNaN(n)||n<=0)){switch(e){default:t.beginPath(),t.arc(i,a,n,0,2*Math.PI),t.closePath(),t.fill();break;case"triangle":t.beginPath(),u=(r=3*n/Math.sqrt(3))*Math.sqrt(3)/2,t.moveTo(i-r/2,a+u/3),t.lineTo(i+r/2,a+u/3),t.lineTo(i,a-2*u/3),t.closePath(),t.fill();break;case"rect":d=1/Math.SQRT2*n,t.beginPath(),t.fillRect(i-d,a-d,2*d,2*d),t.strokeRect(i-d,a-d,2*d,2*d);break;case"rectRounded":var c=n/Math.SQRT2,h=i-c,f=a-c,g=Math.SQRT2*n;t.beginPath(),this.roundedRect(t,h,f,g,g,n/2),t.closePath(),t.fill();break;case"rectRot":d=1/Math.SQRT2*n,t.beginPath(),t.moveTo(i-d,a),t.lineTo(i,a+d),t.lineTo(i+d,a),t.lineTo(i,a-d),t.closePath(),t.fill();break;case"cross":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"crossRot":t.beginPath(),l=Math.cos(Math.PI/4)*n,s=Math.sin(Math.PI/4)*n,t.moveTo(i-l,a-s),t.lineTo(i+l,a+s),t.moveTo(i-l,a+s),t.lineTo(i+l,a-s),t.closePath();break;case"star":t.beginPath(),t.moveTo(i,a+n),t.lineTo(i,a-n),t.moveTo(i-n,a),t.lineTo(i+n,a),l=Math.cos(Math.PI/4)*n,s=Math.sin(Math.PI/4)*n,t.moveTo(i-l,a-s),t.lineTo(i+l,a+s),t.moveTo(i-l,a+s),t.lineTo(i+l,a-s),t.closePath();break;case"line":t.beginPath(),t.moveTo(i-n,a),t.lineTo(i+n,a),t.closePath();break;case"dash":t.beginPath(),t.moveTo(i,a),t.lineTo(i+n,a),t.closePath()}t.stroke()}}else t.drawImage(e,i-e.width/2,a-e.height/2,e.width,e.height)},clipArea:function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},unclipArea:function(t){t.restore()},lineTo:function(t,e,n,i){if(n.steppedLine)return"after"===n.steppedLine&&!i||"after"!==n.steppedLine&&i?t.lineTo(e.x,n.y):t.lineTo(n.x,e.y),void t.lineTo(n.x,n.y);n.tension?t.bezierCurveTo(i?e.controlPointPreviousX:e.controlPointNextX,i?e.controlPointPreviousY:e.controlPointNextY,i?n.controlPointNextX:n.controlPointPreviousX,i?n.controlPointNextY:n.controlPointPreviousY,n.x,n.y):t.lineTo(n.x,n.y)}};i.clear=n.clear,i.drawRoundedRectangle=function(t){t.beginPath(),n.roundedRect.apply(n,arguments),t.closePath()}},{42:42}],42:[function(t,e,n){"use strict";var i={noop:function(){},uid:function(){var t=0;return function(){return t++}}(),isNullOrUndef:function(t){return null===t||void 0===t},isArray:Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},isObject:function(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)},valueOrDefault:function(t,e){return void 0===t?e:t},valueAtIndexOrDefault:function(t,e,n){return i.valueOrDefault(i.isArray(t)?t[e]:t,n)},callback:function(t,e,n){if(t&&"function"==typeof t.call)return t.apply(n,e)},each:function(t,e,n,a){var o,r,l;if(i.isArray(t))if(r=t.length,a)for(o=r-1;o>=0;o--)e.call(n,t[o],o);else for(o=0;o=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===t?1:(n||(n=.3),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),i<1?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-a.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*a.easeInBounce(2*t):.5*a.easeOutBounce(2*t-1)+.5}};e.exports={effects:a},i.easingEffects=a},{42:42}],44:[function(t,e,n){"use strict";var i=t(42);e.exports={toLineHeight:function(t,e){var n=(""+t).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);if(!n||"normal"===n[1])return 1.2*e;switch(t=+n[2],n[3]){case"px":return t;case"%":t/=100}return e*t},toPadding:function(t){var e,n,a,o;return i.isObject(t)?(e=+t.top||0,n=+t.right||0,a=+t.bottom||0,o=+t.left||0):e=n=a=o=+t||0,{top:e,right:n,bottom:a,left:o,height:e+a,width:o+n}},resolve:function(t,e,n){var a,o,r;for(a=0,o=t.length;a
';var a=e.childNodes[0],r=e.childNodes[1];e._reset=function(){a.scrollLeft=1e6,a.scrollTop=1e6,r.scrollLeft=1e6,r.scrollTop=1e6};var l=function(){e._reset(),t()};return o(a,"scroll",l.bind(a,"expand")),o(r,"scroll",l.bind(r,"shrink")),e}function c(t,e){var n=t[m]||(t[m]={}),i=n.renderProxy=function(t){t.animationName===y&&e()};v.each(k,function(e){o(t,e,i)}),n.reflow=!!t.offsetParent,t.classList.add(x)}function h(t){var e=t[m]||{},n=e.renderProxy;n&&(v.each(k,function(e){r(t,e,n)}),delete e.renderProxy),t.classList.remove(x)}function f(t,e,n){var i=t[m]||(t[m]={}),a=i.resizer=d(u(function(){if(i.resizer)return e(l("resize",n))}));c(t,function(){if(i.resizer){var e=t.parentNode;e&&e!==a.parentNode&&e.insertBefore(a,e.firstChild),a._reset()}})}function g(t){var e=t[m]||{},n=e.resizer;delete e.resizer,h(t),n&&n.parentNode&&n.parentNode.removeChild(n)}function p(t,e){var n=t._style||document.createElement("style");t._style||(t._style=n,e="/* Chart.js */\n"+e,n.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n)),n.appendChild(document.createTextNode(e))}var v=t(45),m="$chartjs",b="chartjs-",x=b+"render-monitor",y=b+"render-animation",k=["animationstart","webkitAnimationStart"],w={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},M=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};e.exports={_enabled:"undefined"!=typeof window&&"undefined"!=typeof document,initialize:function(){var t="from{opacity:0.99}to{opacity:1}";p(this,"@-webkit-keyframes "+y+"{"+t+"}@keyframes "+y+"{"+t+"}."+x+"{-webkit-animation:"+y+" 0.001s;animation:"+y+" 0.001s;}")},acquireContext:function(t,e){"string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas);var n=t&&t.getContext&&t.getContext("2d");return n&&n.canvas===t?(a(t,e),n):null},releaseContext:function(t){var e=t.canvas;if(e[m]){var n=e[m].initial;["height","width"].forEach(function(t){var i=n[t];v.isNullOrUndef(i)?e.removeAttribute(t):e.setAttribute(t,i)}),v.each(n.style||{},function(t,n){e.style[n]=t}),e.width=e.width,delete e[m]}},addEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=n[m]||(n[m]={});o(i,e,(a.proxies||(a.proxies={}))[t.id+"_"+e]=function(e){n(s(e,t))})}else f(i,n,t)},removeEventListener:function(t,e,n){var i=t.canvas;if("resize"!==e){var a=((n[m]||{}).proxies||{})[t.id+"_"+e];a&&r(i,e,a)}else g(i)}},v.addEvent=o,v.removeEvent=r},{45:45}],48:[function(t,e,n){"use strict";var i=t(45),a=t(46),o=t(47),r=o._enabled?o:a;e.exports=i.extend({initialize:function(){},acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},r)},{45:45,46:46,47:47}],49:[function(t,e,n){"use strict";var i=t(25),a=t(40),o=t(45);i._set("global",{plugins:{filler:{propagate:!0}}}),e.exports=function(){function t(t,e,n){var i,a=t._model||{},o=a.fill;if(void 0===o&&(o=!!a.backgroundColor),!1===o||null===o)return!1;if(!0===o)return"origin";if(i=parseFloat(o,10),isFinite(i)&&Math.floor(i)===i)return"-"!==o[0]&&"+"!==o[0]||(i=e+i),!(i===e||i<0||i>=n)&&i;switch(o){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return o;default:return!1}}function e(t){var e,n=t.el._model||{},i=t.el._scale||{},a=t.fill,o=null;if(isFinite(a))return null;if("start"===a?o=void 0===n.scaleBottom?i.bottom:n.scaleBottom:"end"===a?o=void 0===n.scaleTop?i.top:n.scaleTop:void 0!==n.scaleZero?o=n.scaleZero:i.getBasePosition?o=i.getBasePosition():i.getBasePixel&&(o=i.getBasePixel()),void 0!==o&&null!==o){if(void 0!==o.x&&void 0!==o.y)return o;if("number"==typeof o&&isFinite(o))return e=i.isHorizontal(),{x:e?o:null,y:e?null:o}}return null}function n(t,e,n){var i,a=t[e].fill,o=[e];if(!n)return a;for(;!1!==a&&-1===o.indexOf(a);){if(!isFinite(a))return a;if(!(i=t[a]))return!1;if(i.visible)return a;o.push(a),a=i.fill}return!1}function r(t){var e=t.fill,n="dataset";return!1===e?null:(isFinite(e)||(n="boundary"),d[n](t))}function l(t){return t&&!t.skip}function s(t,e,n,i,a){var r;if(i&&a){for(t.moveTo(e[0].x,e[0].y),r=1;r0;--r)o.canvas.lineTo(t,n[r],n[r-1],!0)}}function u(t,e,n,i,a,o){var r,u,d,c,h,f,g,p=e.length,v=i.spanGaps,m=[],b=[],x=0,y=0;for(t.beginPath(),r=0,u=p+!!o;r');for(var n=0;n'),t.data.datasets[n].label&&e.push(t.data.datasets[n].label),e.push("");return e.push(""),e.join("")}}),e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function n(e,n){var i=new t.Legend({ctx:e.ctx,options:n,chart:e});r.configure(e,i,n),r.addBox(e,i),e.legend=i}var r=t.layoutService,l=o.noop;return t.Legend=a.extend({initialize:function(t){o.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:l,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:l,beforeSetDimensions:l,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:l,beforeBuildLabels:l,buildLabels:function(){var t=this,e=t.options.labels||{},n=o.callback(e.generateLabels,[t.chart],t)||[];e.filter&&(n=n.filter(function(n){return e.filter(n,t.chart.data)})),t.options.reverse&&n.reverse(),t.legendItems=n},afterBuildLabels:l,beforeFit:l,fit:function(){var t=this,n=t.options,a=n.labels,r=n.display,l=t.ctx,s=i.global,u=o.valueOrDefault,d=u(a.fontSize,s.defaultFontSize),c=u(a.fontStyle,s.defaultFontStyle),h=u(a.fontFamily,s.defaultFontFamily),f=o.fontString(d,c,h),g=t.legendHitBoxes=[],p=t.minSize,v=t.isHorizontal();if(v?(p.width=t.maxWidth,p.height=r?10:0):(p.width=r?10:0,p.height=t.maxHeight),r)if(l.font=f,v){var m=t.lineWidths=[0],b=t.legendItems.length?d+a.padding:0;l.textAlign="left",l.textBaseline="top",o.each(t.legendItems,function(n,i){var o=e(a,d)+d/2+l.measureText(n.text).width;m[m.length-1]+o+a.padding>=t.width&&(b+=d+a.padding,m[m.length]=t.left),g[i]={left:0,top:0,width:o,height:d},m[m.length-1]+=o+a.padding}),p.height+=b}else{var x=a.padding,y=t.columnWidths=[],k=a.padding,w=0,M=0,S=d+x;o.each(t.legendItems,function(t,n){var i=e(a,d)+d/2+l.measureText(t.text).width;M+S>p.height&&(k+=w+a.padding,y.push(w),w=0,M=0),w=Math.max(w,i),M+=S,g[n]={left:0,top:0,width:i,height:d}}),k+=w,y.push(w),p.width+=k}t.width=p.width,t.height=p.height},afterFit:l,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,n=t.options,a=n.labels,r=i.global,l=r.elements.line,s=t.width,u=t.lineWidths;if(n.display){var d,c=t.ctx,h=o.valueOrDefault,f=h(a.fontColor,r.defaultFontColor),g=h(a.fontSize,r.defaultFontSize),p=h(a.fontStyle,r.defaultFontStyle),v=h(a.fontFamily,r.defaultFontFamily),m=o.fontString(g,p,v);c.textAlign="left",c.textBaseline="middle",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=m;var b=e(a,g),x=t.legendHitBoxes,y=function(t,e,i){if(!(isNaN(b)||b<=0)){c.save(),c.fillStyle=h(i.fillStyle,r.defaultColor),c.lineCap=h(i.lineCap,l.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,l.borderDashOffset),c.lineJoin=h(i.lineJoin,l.borderJoinStyle),c.lineWidth=h(i.lineWidth,l.borderWidth),c.strokeStyle=h(i.strokeStyle,r.defaultColor);var a=0===h(i.lineWidth,l.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,l.borderDash)),n.labels&&n.labels.usePointStyle){var s=g*Math.SQRT2/2,u=s/Math.SQRT2,d=t+u,f=e+u;o.canvas.drawPoint(c,i.pointStyle,s,d,f)}else a||c.strokeRect(t,e,b,g),c.fillRect(t,e,b,g);c.restore()}},k=function(t,e,n,i){var a=g/2,o=b+a+t,r=e+a;c.fillText(n.text,o,r),n.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(o,r),c.lineTo(o+i,r),c.stroke())},w=t.isHorizontal();d=w?{x:t.left+(s-u[0])/2,y:t.top+a.padding,line:0}:{x:t.left+a.padding,y:t.top+a.padding,line:0};var M=g+a.padding;o.each(t.legendItems,function(e,n){var i=c.measureText(e.text).width,o=b+g/2+i,r=d.x,l=d.y;w?r+o>=s&&(l=d.y+=M,d.line++,r=d.x=t.left+(s-u[d.line])/2):l+M>t.bottom&&(r=d.x=r+t.columnWidths[d.line]+a.padding,l=d.y=t.top+a.padding,d.line++),y(r,l,e),x[n].left=r,x[n].top=l,k(r,l,e,i),w?d.x+=o+a.padding:d.y+=M})}},handleEvent:function(t){var e=this,n=e.options,i="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===i){if(!n.onHover)return}else{if("click"!==i)return;if(!n.onClick)return}var o=t.x,r=t.y;if(o>=e.left&&o<=e.right&&r>=e.top&&r<=e.bottom)for(var l=e.legendHitBoxes,s=0;s=u.left&&o<=u.left+u.width&&r>=u.top&&r<=u.top+u.height){if("click"===i){n.onClick.call(e,t.native,e.legendItems[s]),a=!0;break}if("mousemove"===i){n.onHover.call(e,t.native,e.legendItems[s]),a=!0;break}}}return a}}),{id:"legend",beforeInit:function(t){var e=t.options.legend;e&&n(t,e)},beforeUpdate:function(t){var e=t.options.legend,a=t.legend;e?(o.mergeIf(e,i.global.legend),a?(r.configure(t,a,e),a.options=e):n(t,e)):a&&(r.removeBox(t,a),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}}}},{25:25,26:26,45:45}],51:[function(t,e,n){"use strict";var i=t(25),a=t(26),o=t(45);i._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,lineHeight:1.2,padding:10,position:"top",text:"",weight:2e3}}),e.exports=function(t){function e(e,i){var a=new t.Title({ctx:e.ctx,options:i,chart:e});n.configure(e,a,i),n.addBox(e,a),e.titleBlock=a}var n=t.layoutService,r=o.noop;return t.Title=a.extend({initialize:function(t){var e=this;o.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:r,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:r,beforeSetDimensions:r,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:r,beforeBuildLabels:r,buildLabels:r,afterBuildLabels:r,beforeFit:r,fit:function(){var t=this,e=o.valueOrDefault,n=t.options,a=n.display,r=e(n.fontSize,i.global.defaultFontSize),l=t.minSize,s=o.isArray(n.text)?n.text.length:1,u=o.options.toLineHeight(n.lineHeight,r),d=a?s*u+2*n.padding:0;t.isHorizontal()?(l.width=t.maxWidth,l.height=d):(l.width=d,l.height=t.maxHeight),t.width=l.width,t.height=l.height},afterFit:r,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=o.valueOrDefault,a=t.options,r=i.global;if(a.display){var l,s,u,d=n(a.fontSize,r.defaultFontSize),c=n(a.fontStyle,r.defaultFontStyle),h=n(a.fontFamily,r.defaultFontFamily),f=o.fontString(d,c,h),g=o.options.toLineHeight(a.lineHeight,d),p=g/2+a.padding,v=0,m=t.top,b=t.left,x=t.bottom,y=t.right;e.fillStyle=n(a.fontColor,r.defaultFontColor),e.font=f,t.isHorizontal()?(s=b+(y-b)/2,u=m+p,l=y-b):(s="left"===a.position?b+p:y-p,u=m+(x-m)/2,l=x-m,v=Math.PI*("left"===a.position?-.5:.5)),e.save(),e.translate(s,u),e.rotate(v),e.textAlign="center",e.textBaseline="middle";var k=a.text;if(o.isArray(k))for(var w=0,M=0;Me.max&&(e.max=i))})});e.min=isFinite(e.min)&&!isNaN(e.min)?e.min:0,e.max=isFinite(e.max)&&!isNaN(e.max)?e.max:1,this.handleTickRangeOptions()},getTickLimit:function(){var t,e=this,n=e.options.ticks;if(e.isHorizontal())t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.width/50));else{var o=a.valueOrDefault(n.fontSize,i.global.defaultFontSize);t=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(e.height/(2*o)))}return t},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,n=this,i=n.start,a=+n.getRightValue(t),o=n.end-i;return n.isHorizontal()?(e=n.left+n.width/o*(a-i),Math.round(e)):(e=n.bottom-n.height/o*(a-i),Math.round(e))},getValueForPixel:function(t){var e=this,n=e.isHorizontal(),i=n?e.width:e.height,a=(n?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",n,e)}},{25:25,34:34,45:45}],54:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e=i.noop;t.LinearScaleBase=t.Scale.extend({getRightValue:function(e){return"string"==typeof e?+e:t.Scale.prototype.getRightValue.call(this,e)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=i.sign(t.min),a=i.sign(t.max);n<0&&a<0?t.max=0:n>0&&a>0&&(t.min=0)}var o=void 0!==e.min||void 0!==e.suggestedMin,r=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),o!==r&&t.min>=t.max&&(o?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:e,handleDirectionalChanges:e,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),o={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,stepSize:i.valueOrDefault(e.fixedStepSize,e.stepSize)},r=t.ticks=a.generators.linear(o,t);t.handleDirectionalChanges(),t.max=i.max(r),t.min=i.min(r),e.reverse?(r.reverse(),t.start=t.max,t.end=t.min):(t.start=t.min,t.end=t.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{34:34,45:45}],55:[function(t,e,n){"use strict";var i=t(45),a=t(34);e.exports=function(t){var e={position:"left",ticks:{callback:a.formatters.logarithmic}},n=t.Scale.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===e.id:t.yAxisID===e.id}var e=this,n=e.options,a=n.ticks,o=e.chart,r=o.data.datasets,l=i.valueOrDefault,s=e.isHorizontal();e.min=null,e.max=null,e.minNotZero=null;var u=n.stacked;if(void 0===u&&i.each(r,function(e,n){if(!u){var i=o.getDatasetMeta(n);o.isDatasetVisible(n)&&t(i)&&void 0!==i.stack&&(u=!0)}}),n.stacked||u){var d={};i.each(r,function(a,r){var l=o.getDatasetMeta(r),s=[l.type,void 0===n.stacked&&void 0===l.stack?r:"",l.stack].join(".");o.isDatasetVisible(r)&&t(l)&&(void 0===d[s]&&(d[s]=[]),i.each(a.data,function(t,i){var a=d[s],o=+e.getRightValue(t);isNaN(o)||l.data[i].hidden||(a[i]=a[i]||0,n.relativePoints?a[i]=100:a[i]+=o)}))}),i.each(d,function(t){var n=i.min(t),a=i.max(t);e.min=null===e.min?n:Math.min(e.min,n),e.max=null===e.max?a:Math.max(e.max,a)})}else i.each(r,function(n,a){var r=o.getDatasetMeta(a);o.isDatasetVisible(a)&&t(r)&&i.each(n.data,function(t,n){var i=+e.getRightValue(t);isNaN(i)||r.data[n].hidden||(null===e.min?e.min=i:ie.max&&(e.max=i),0!==i&&(null===e.minNotZero||ia?{start:e-n-5,end:e}:{start:e,end:e+n+5}}function s(t){var i,o,s,u=n(t),d=Math.min(t.height/2,t.width/2),c={r:t.width,l:0,t:t.height,b:0},h={};t.ctx.font=u.font,t._pointLabelSizes=[];var f=e(t);for(i=0;ic.r&&(c.r=v.end,h.r=g),m.startc.b&&(c.b=m.end,h.b=g)}t.setReductions(d,c,h)}function u(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function d(t){return 0===t||180===t?"center":t<180?"left":"right"}function c(t,e,n,i){if(a.isArray(e))for(var o=n.y,r=1.5*i,l=0;l270||t<90)&&(n.y-=e.h)}function f(t){var i=t.ctx,o=a.valueOrDefault,r=t.options,l=r.angleLines,s=r.pointLabels;i.lineWidth=l.lineWidth,i.strokeStyle=l.color;var u=t.getDistanceFromCenterForValue(r.ticks.reverse?t.min:t.max),f=n(t);i.textBaseline="top";for(var g=e(t)-1;g>=0;g--){if(l.display){var p=t.getPointPosition(g,u);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(p.x,p.y),i.stroke(),i.closePath()}if(s.display){var m=t.getPointPosition(g,u+5),b=o(s.fontColor,v.defaultFontColor);i.font=f.font,i.fillStyle=b;var x=t.getIndexAngle(g),y=a.toDegrees(x);i.textAlign=d(y),h(y,t._pointLabelSizes[g],m),c(i,t.pointLabels[g]||"",m,f.size)}}}function g(t,n,i,o){var r=t.ctx;if(r.strokeStyle=a.valueAtIndexOrDefault(n.color,o-1),r.lineWidth=a.valueAtIndexOrDefault(n.lineWidth,o-1),t.options.gridLines.circular)r.beginPath(),r.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),r.closePath(),r.stroke();else{var l=e(t);if(0===l)return;r.beginPath();var s=t.getPointPosition(0,i);r.moveTo(s.x,s.y);for(var u=1;u0&&n>0?e:0)},draw:function(){var t=this,e=t.options,n=e.gridLines,i=e.ticks,o=a.valueOrDefault;if(e.display){var r=t.ctx,l=this.getIndexAngle(0),s=o(i.fontSize,v.defaultFontSize),u=o(i.fontStyle,v.defaultFontStyle),d=o(i.fontFamily,v.defaultFontFamily),c=a.fontString(s,u,d);a.each(t.ticks,function(e,a){if(a>0||i.reverse){var u=t.getDistanceFromCenterForValue(t.ticksAsNumbers[a]);if(n.display&&0!==a&&g(t,n,u,a),i.display){var d=o(i.fontColor,v.defaultFontColor);if(r.font=c,r.save(),r.translate(t.xCenter,t.yCenter),r.rotate(l),i.showLabelBackdrop){var h=r.measureText(e).width;r.fillStyle=i.backdropColor,r.fillRect(-h/2-i.backdropPaddingX,-u-s/2-i.backdropPaddingY,h+2*i.backdropPaddingX,s+2*i.backdropPaddingY)}r.textAlign="center",r.textBaseline="middle",r.fillStyle=d,r.fillText(e,0,-u),r.restore()}}}),(e.angleLines.display||e.pointLabels.display)&&f(t)}}});t.scaleService.registerScaleType("radialLinear",b,m)}},{25:25,34:34,45:45}],57:[function(t,e,n){"use strict";function i(t,e){return t-e}function a(t){var e,n,i,a={},o=[];for(e=0,n=t.length;ee&&l=0&&r<=l;){if(i=r+l>>1,a=t[i-1]||null,o=t[i],!a)return{lo:null,hi:o};if(o[e]n))return{lo:a,hi:o};l=i-1}}return{lo:o,hi:null}}function l(t,e,n,i){var a=r(t,e,n),o=a.lo?a.hi?a.lo:t[t.length-2]:t[0],l=a.lo?a.hi?a.hi:t[t.length-1]:t[1],s=l[e]-o[e],u=s?(n-o[e])/s:0,d=(l[i]-o[i])*u;return o[i]+d}function s(t,e){var n=e.parser,i=e.parser||e.format;return"function"==typeof n?n(t):"string"==typeof t&&"string"==typeof i?m(t,i):(t instanceof m||(t=m(t)),t.isValid()?t:"function"==typeof i?i(t):t)}function u(t,e){if(x.isNullOrUndef(t))return null;var n=e.options.time,i=s(e.getRightValue(t),n);return i.isValid()?(n.round&&i.startOf(n.round),i.valueOf()):null}function d(t,e,n,i){var a,o,r,l=e-t,s=w[n],u=s.size,d=s.steps;if(!d)return Math.ceil(l/((i||1)*u));for(a=0,o=d.length;a=M.indexOf(e);a--)if(o=M[a],w[o].common&&r.as(o)>=t.length)return o;return M[e?M.indexOf(e):0]}function f(t){for(var e=M.indexOf(t)+1,n=M.length;e1?e[1]:i,r=e[0],s=(l(t,"time",o,"pos")-l(t,"time",r,"pos"))/2),a.time.max||(o=e[e.length-1],r=e.length>1?e[e.length-2]:n,u=(l(t,"time",o,"pos")-l(t,"time",r,"pos"))/2)),{left:s,right:u}}function v(t,e){var n,i,a,o,r=[];for(n=0,i=t.length;n=a&&n<=r&&c.push(n);return i.min=a,i.max=r,i._unit=s.unit||h(c,s.minUnit,i.min,i.max),i._majorUnit=f(i._unit),i._table=o(i._timestamps.data,a,r,l.distribution),i._offsets=p(i._table,c,a,r,l),v(c,i._majorUnit)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.options.time,o=i.labels&&t=0&&t - + @@ -42,6 +42,8 @@
+ +
From fdefd2732d416f56c3cdb5c1e1822c569a28ba39 Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 29 Jan 2018 16:35:37 -0500 Subject: [PATCH 24/80] Start patch method --- SmearcarDB/server.py | 77 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index ca004e9..081d982 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -12,6 +12,8 @@ app.config.update( ) db = SQLAlchemy(app) +# TODO Updates table (add, edit, delete) (author, date, title, content) +# TODO convert pickle to db class Frequency(db.Model): language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True) @@ -29,7 +31,7 @@ class Language(db.Model): class Phoneme(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) - name = db.Column(db.String(5), nullable=False) + name = db.Column(db.String(5), nullable=False, unique=True) def database(): @@ -46,6 +48,44 @@ def database(): final['values'].append(languageobject) return final +patch_functions = { + "phoneme_add": phoneme_add, # Add and edit value + "phoneme_remove": phoneme_remove, # Remove association and phoneme if necessary + # "language_name_edit": language_name_edit, # Change language name + # "language_source_add": language_source_add # Add/edit source +} + + +def phoneme_add(info): + """Add or edit value associated with phoneme.""" + # info = { + # language_id: language_id, + # phoneme: phoneme_name, + # value: phoneme_value + # } + phoneme = Phoneme.query.filter_by(name=info['phoneme']).first() + language = Language.query.filter_by(id=info['language_id']).first() + if phoneme: + link = Frequency.query.filter_by(language_id=language.id, phoneme_id=phoneme.id).first() + link.value = info['value'] + else: + phoneme = Phoneme(name=info['phoneme']) + link = Frequency(value=info['value']) + link.phoneme = phoneme + language.phonemes.append(link) + db.session.add_all([phoneme, link]) + + +def phoneme_remove(info): + """Remove a phoneme from a language.""" + # info = { + # language_id: language_id, + # phoneme_id: phoneme_id + # } + pass + + + # Render the client at the default URL @app.route("/") @@ -53,16 +93,22 @@ def initial(): return render_template('index.html') +# GET method for files +@app.route("/server/") +def file_return(lang_id): + return Language.query.filter_by(id=lang_id).first().source + + # Place for client to communicate with the server @app.route("/server", methods=["GET", "POST", "PATCH"]) # TODO add more methods def backend(): - # GET method returns the latest database - if request.method == "GET": - return jsonify(database()) + # # GET method returns the latest database + # if request.method == "GET": + # return jsonify(database()) # POST method appends input to database['values'] - elif request.method == "POST": + if request.method == "POST": recieved = request.get_json() language = Language(name=recieved['name'], source=recieved['source']) db.session.add(language) @@ -78,16 +124,19 @@ def backend(): language.phonemes.append(link) db.session.add(link) db.session.commit() - return jsonify(database()) + # return jsonify(database()) - # # PATCH method inputs edited language and returns updated database - # elif request.method == "PATCH": - # newlanguage = request.get_json() - # database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] - # saveDatabase() - # return jsonify(database()) + # PATCH method inputs edited language and returns updated database + elif request.method == "PATCH": + recieved = request.get_json() + patch_functions[recieved['action']](recieved['data']) + db.session.commit() + # database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] + # saveDatabase() + + return jsonify(database()) -if __name__ == "__main__": - app.run(host="0.0.0.0") +# if __name__ == "__main__": +# app.run(host="0.0.0.0") From b6c87fa506579757c749237500331ba126bebc8b Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Mon, 29 Jan 2018 19:36:10 -0500 Subject: [PATCH 25/80] finish PATCH and add Updates with approute --- SmearcarDB/server.py | 88 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 081d982..eb6e247 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,8 +1,7 @@ -import pickle from flask import Flask from flask import render_template, jsonify, request from flask_sqlalchemy import SQLAlchemy -import ulid +import time app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' @@ -12,8 +11,6 @@ app.config.update( ) db = SQLAlchemy(app) -# TODO Updates table (add, edit, delete) (author, date, title, content) -# TODO convert pickle to db class Frequency(db.Model): language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True) @@ -34,6 +31,15 @@ class Phoneme(db.Model): name = db.Column(db.String(5), nullable=False, unique=True) +class Update(db.Model): + id = db.Column(db.Integer, primary_key=True, autoincrement=True) + author = db.Column(db.String(30), nullable=False) + title = db.Column(db.String(100), nullable=False) + content = db.Column(db.Text, nullable=False) + date = db.Column(db.BigInteger, nullable=False, + default=int(time.time()*1000)) + + def database(): final = {'values': []} final['languages'] = [f.name for f in Language.query.all()] @@ -48,13 +54,6 @@ def database(): final['values'].append(languageobject) return final -patch_functions = { - "phoneme_add": phoneme_add, # Add and edit value - "phoneme_remove": phoneme_remove, # Remove association and phoneme if necessary - # "language_name_edit": language_name_edit, # Change language name - # "language_source_add": language_source_add # Add/edit source -} - def phoneme_add(info): """Add or edit value associated with phoneme.""" @@ -66,7 +65,9 @@ def phoneme_add(info): phoneme = Phoneme.query.filter_by(name=info['phoneme']).first() language = Language.query.filter_by(id=info['language_id']).first() if phoneme: - link = Frequency.query.filter_by(language_id=language.id, phoneme_id=phoneme.id).first() + link = Frequency.query.filter_by( + language_id=language.id, + phoneme_id=phoneme.id).first() link.value = info['value'] else: phoneme = Phoneme(name=info['phoneme']) @@ -82,9 +83,44 @@ def phoneme_remove(info): # language_id: language_id, # phoneme_id: phoneme_id # } - pass + phoneme = Phoneme.query.filter_by(id=info['phoneme_id']).first() + language = Language.query.filter_by(id=info['language_id']).first() + frequency = Frequency.query.filter_by( + phoneme_id=info['phoneme_id'], language_id=info['language_id']).first() + + if Frequency.query.filter_by(phoneme_id=info['phoneme_id']).count() == 1: + # Delete phoneme + db.session.delete(phoneme) + + language.phonemes = [frequency for frequency in language.phonemes + if frequency.phoneme_id != info['phoneme_id']] + db.session.delete(frequency) +def language_name_edit(info): + """Edit the name of a Language.""" + # info = { + # language_id: language_id, + # language_name: name + # } + Language.query.filter_by(id=info['language_id']).first().name = info['language_name'] + + +def language_source_add(info): + """Add or replace a source""" + # info = { + # language_id: language_id, + # language_source = source + # } + Language.query.filter_by(id=info['language_id']).first().source = info['language_source'] + + +patch_functions = { + "phoneme_add": phoneme_add, # Add and edit value + "phoneme_remove": phoneme_remove, # Remove association and/or phoneme + "language_name_edit": language_name_edit, # Change language name + "language_source_add": language_source_add # Add/edit source +} # Render the client at the default URL @@ -101,7 +137,6 @@ def file_return(lang_id): # Place for client to communicate with the server @app.route("/server", methods=["GET", "POST", "PATCH"]) -# TODO add more methods def backend(): # # GET method returns the latest database # if request.method == "GET": @@ -126,17 +161,36 @@ def backend(): db.session.commit() # return jsonify(database()) - # PATCH method inputs edited language and returns updated database elif request.method == "PATCH": recieved = request.get_json() patch_functions[recieved['action']](recieved['data']) db.session.commit() - # database['values'] = [newlanguage if language['id'] == newlanguage['id'] else language for language in database['values']] - # saveDatabase() return jsonify(database()) +# Manipulate Updates +@app.route("/updates", methods=["GET", "POST", "PATCH"]) +def updates(): + if request.method == "POST": + recieved = request.get_json() + update = Update(author=recieved['author'], + title=recieved['title'], + content=recieved['content']) + db.session.add(update) + elif request.method == "PATCH": + update = Update.query.filter_by(id=recieved['id']).first() + update.name = recieved['author'] + update.title = recieved['title'] + update.content = recieved['content'] + db.session.commit() + return jsonify([{"author": update.name, + "id": update.id, + "title": update.title, + "content": update.content, + "date": update.date} + for update in Update.query.all()]) + # if __name__ == "__main__": # app.run(host="0.0.0.0") From 6b9df945d3ebfe6c9fe660b7a9dcd991d7487d8c Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Wed, 31 Jan 2018 17:12:54 -0500 Subject: [PATCH 26/80] working post on js --- SmearcarDB/server.py | 9 ++++++--- SmearcarDB/static/index.js | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index eb6e247..87c22fe 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -151,7 +151,6 @@ def backend(): for phoneme, value in recieved['phonemes'].items(): with db.session.no_autoflush: search = Phoneme.query.filter_by(name=phoneme).first() - print(search) if not search: search = Phoneme(name=phoneme) db.session.add(search) @@ -173,17 +172,20 @@ def backend(): # Manipulate Updates @app.route("/updates", methods=["GET", "POST", "PATCH"]) def updates(): + if request.method == "POST": recieved = request.get_json() update = Update(author=recieved['author'], title=recieved['title'], content=recieved['content']) db.session.add(update) + elif request.method == "PATCH": update = Update.query.filter_by(id=recieved['id']).first() update.name = recieved['author'] update.title = recieved['title'] update.content = recieved['content'] + db.session.commit() return jsonify([{"author": update.name, "id": update.id, @@ -192,5 +194,6 @@ def updates(): "date": update.date} for update in Update.query.all()]) -# if __name__ == "__main__": -# app.run(host="0.0.0.0") + +if __name__ == "__main__": + app.run(host="0.0.0.0") diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 83039f2..20697e2 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -22,6 +22,28 @@ var dropOp = { var dropOpStore = {}; +// Left This so that the post function can be reused + +// function temporary(data) { +// for(var i = 0; i < data.length; i++) { +// $.ajax({ +// url: serverURL + '/server', +// type: 'POST', +// data: JSON.stringify(data[i]), +// dataType: "json", +// contentType: 'application/json;charset=UTF-8' +// }) +// .then( +// function success(data) { +// console.log(data); +// }, +// function error(e) { +// console.log(e); +// } +// ); +// } +// } + function createNav() { for (var i = 0; i < navi.length; i++) { // Create navigation tabs. var side = document.getElementById("sidebar"); From 5551469c94414a5dd95d801a2fcde592bb5d415d Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 3 Feb 2018 23:00:40 -0500 Subject: [PATCH 27/80] added chart --- SmearcarDB/static/index.css | 29 +++++++++++++++++---------- SmearcarDB/static/index.js | 35 ++++++++++++++++++++++++++++----- SmearcarDB/templates/index.html | 21 +++++++++++--------- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index e74b6d0..8d8b57a 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -203,11 +203,6 @@ a { grid-gap: 2vh; } - #dataValues { - grid-template-columns: 1fr 1fr; - grid-template-rows: 2fr 5fr 2fr; -} - #home { display: block; @@ -267,6 +262,25 @@ a { font-weight: 300; } +.row { + display: grid; + grid-template-columns: 1fr 1fr; + grid-template-rows: 100%; + grid-gap: 2vh; +} + +#dataValues > div { + margin-bottom: 2vh; +} + +#dataValues .row { + height: 20%; +} + +#dataValues #dataTable { + height: 42%; +} + #langSelect { grid-column: 1; grid-row: 1; @@ -290,11 +304,6 @@ a { margin: auto 0 auto 4vh; } -#dataTable { - grid-column: 1 / 3; - grid-row: 2; -} - #dataTableCont { display: grid; font-weight: 300; diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 2f607ed..aab606b 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -50,11 +50,7 @@ function updateMain(op) { // Updates the actual page. setTimeout(function() { console.log(op); document.getElementById(navSelect).style.display = "none"; - if(op === "home") { - document.getElementById(op).style.display = "block"; - } else { - document.getElementById(op).style.display = "grid"; - } + document.getElementById(op).style.display = "block"; setTimeout(function() { document.getElementById(op).style.opacity = "1"; }, 30); @@ -134,6 +130,7 @@ function generateDropOp() { // For options that change based on data. } info.appendChild(p); info.appendChild(p2); + // Generate data box material. var phonemes = Object.keys(langInfo.phonemes); @@ -171,6 +168,34 @@ function generateDropOp() { // For options that change based on data. } info.style.opacity = "1"; dataBox.style.opacity = "1"; + var graphData = Object.entries(langInfo.phonemes).sort(function(a,b) { + return b[1] - a[1]; + }); + graphData = [graphData.map(function(a,b) { + return a[0]; + }), graphData.map(function(a,b) { + return a[1]; + })]; + // Generate graphs. + var ctx = document.getElementById("dataGraph1").getContext("2d"); + var chart = new Chart(ctx, { + // The type of chart we want to create + type: 'bar', + + // The data for our dataset + data: { + labels: graphData[0], + datasets: [{ + label: "Phoneme Prevalence", + backgroundColor: 'rgb(255, 99, 132)', + borderColor: 'rgb(255, 99, 132)', + data: graphData[1], + }] + }, + + // Configuration options go here + options: {} + }); }, 300); }].concat(["Select language..."].concat(data.languages)); } diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 00ac2a1..d56a405 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -27,14 +27,16 @@
-
-

Language

-
+
+
+

Login

+
+

Username:

+ +
+
+

Password:

+ +
+
+

Submit!

+
+
+
From 5e1067297c1b14f3ad206d2b0c1a7416fde08ae3 Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 16 Apr 2018 21:41:01 -0400 Subject: [PATCH 50/80] static date --- SmearcarDB/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 83c17aa..72bf35f 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,7 +1,7 @@ from flask import Flask from flask import render_template, jsonify, request from flask_sqlalchemy import SQLAlchemy -import time +import datetime app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' @@ -36,8 +36,8 @@ class Update(db.Model): author = db.Column(db.String(30), nullable=False) title = db.Column(db.String(100), nullable=False) content = db.Column(db.Text, nullable=False) - date = db.Column(db.BigInteger, nullable=False, - default=int(time.time()*1000)) + date = db.Column(db.String(50), nullable=False, + default=datetime.datetime.now().strftime("%m/%d/%Y | %A, %B %d, %Y")) class Editor(db.Model): From 1ac3bd5204a32f6938eabee30607679d0fc54c4f Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 16 Apr 2018 22:07:34 -0400 Subject: [PATCH 51/80] display updates from server and fix server functions --- SmearcarDB/server.py | 8 ++--- SmearcarDB/static/index.js | 67 ++++++++++++++++++-------------------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 72bf35f..4c15b8c 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -36,8 +36,8 @@ class Update(db.Model): author = db.Column(db.String(30), nullable=False) title = db.Column(db.String(100), nullable=False) content = db.Column(db.Text, nullable=False) - date = db.Column(db.String(50), nullable=False, - default=datetime.datetime.now().strftime("%m/%d/%Y | %A, %B %d, %Y")) + date = db.Column(db.DateTime, nullable=False, + default=datetime.datetime.now()) class Editor(db.Model): @@ -214,11 +214,11 @@ def updates(): update.content = received['content'] db.session.commit() - return jsonify([{"author": update.name, + return jsonify([{"author": update.author, "id": update.id, "title": update.title, "content": update.content, - "date": update.date} + "date": update.date.strftime("%m/%d/%Y | %A, %B %d, %Y")} for update in Update.query.all()]) # Manipulate Editor diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 6854c5f..a7bf560 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -42,7 +42,7 @@ function Rnd(item,fig) { function varType(variable) { var type = typeof variable; if(type === "object") { - return (variable.constructor === Array) ? "Array" : "Object"; + return (variable.constructor === Array) ? "Array" : "Object"; } else { return type[0].toUpperCase() + type.slice(1); } @@ -310,41 +310,36 @@ document.onclick = function(event) { }; function homeCards() { - // GET posts from server - var week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; - var month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; - var examplePost = [ - { - author: "Kenneth Jao", - title: "Test Post!", - content: "This is test post! Link This link should work.
Newlines work.", - date: new Date(2018, 0, 26, 4, 51) - } - ]; - var home = document.getElementById("home"); - for(var i = 0; i < examplePost.length; i++) { - var div = document.createElement("div"); - div.className = "card"; - var h2 = document.createElement("h2"); - h2.textContent = examplePost[i].title; - div.appendChild(h2); - var h3 = document.createElement("h3"); - var dt = examplePost[i].date; - var smallDate = (function() { - var m = (dt.getMonth()+1).toString(); - var d = (dt.getDay()+1).toString(); - m = (m.length === 1) ? "0" + m : m; - d = (d.length === 1) ? "0" + d : d; - return m+"/"+d+"/"+dt.getFullYear().toString(); - })(); - var fullDate = week[dt.getDay()] + ", " + month[dt.getMonth()] + " " + dt.getDate().toString() + ", " + dt.getFullYear().toString(); - h3.textContent = smallDate + " | " + fullDate; - div.appendChild(h3); - var p = document.createElement("p"); - p.innerHTML = examplePost[i].content; - div.appendChild(p); - home.appendChild(div); - } + // TODO GET posts from server + + $.ajax({ + url: serverURL + '/updates', + type: 'GET' + }) + .then( + function success(incoming) { + var postList = incoming; + var home = document.getElementById("home"); + for(var i = 0; i < postList.length; i++) { + var div = document.createElement("div"); + div.className = "card"; + var h2 = document.createElement("h2"); + h2.textContent = postList[i].title; + div.appendChild(h2); + var h3 = document.createElement("h3"); + h3.textContent = postList[i].date; + div.appendChild(h3); + var p = document.createElement("p"); + p.innerHTML = postList[i].content; + div.appendChild(p); + home.appendChild(div); + } + }, + function error(e) { + console.log(e); + } + ); + } function chartOptions(graphData) { From 780c308b758ad4a258145cd95f6b7b1f96470947 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Mon, 16 Apr 2018 22:34:32 -0400 Subject: [PATCH 52/80] added adding users --- SmearcarDB/static/index.css | 42 +++++++--- SmearcarDB/static/index.js | 132 +++++++++++++++++++++++++++----- SmearcarDB/templates/index.html | 27 ++++++- 3 files changed, 167 insertions(+), 34 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 4a27ecd..ae09500 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -359,7 +359,7 @@ a { background-color: rgba(0, 0, 0, 0.05); } -#newLanguage, #editLanguage, #login { +#newLanguage, #editLanguage, #login, #addUser { position: absolute; width: 100%; height: 100%; @@ -368,7 +368,7 @@ a { background-color: rgba(0,0,0,0.4); } -#newLanguage > div, #editLanguage > div, #login > div { +#newLanguage > div, #editLanguage > div, #login > div, #addUser > div { position: absolute; width: 20%; height: 60%; @@ -383,11 +383,16 @@ a { grid-template-rows: 6vh 1fr 1fr 1fr; } -#loginUsername, #loginPassword { +#addUser > div { + height: 40%; + grid-template-rows: 6vh 1fr 1fr 1fr 1fr; +} + +#loginUsername, #loginPassword, #addUserUsername, #addUserPassword { margin-left: 5%; } -#login input { +#login input, #addUser input { border: 0; background-color: rgba(0,0,0,0.1); font-family: 'Saira Condensed', sans-serif; @@ -397,7 +402,7 @@ a { width: 90%; } -#newLanguageName, #editLanguageName, #loginUsername { +#newLanguageName, #editLanguageName, #loginUsername, #addUserUsername { grid-row: 2; } @@ -413,10 +418,19 @@ a { grid-row: 1; } -#newLanguagePhonemes, #editLanguagePhonemes, #loginPassword { +#newLanguagePhonemes, #editLanguagePhonemes, #loginPassword, #addUserAuthority { grid-row: 3; } +#addUserAuthority { + margin-left: 5%; + width: 90%; +} + +#addUserPassword { + grid-row: 4; +} + #newLanguagePhonemes p, #editLanguagePhonemes p { margin-left: 5%; } @@ -430,12 +444,16 @@ a { font-size: 1.5vh; } -#newLanguageSubmit, #editLanguageSubmit, #loginSubmit { +#newLanguageSubmit, #editLanguageSubmit, #loginSubmit, #addUserSubmit { display: grid; grid-row: 4; } -#newLanguageSubmit p, #editLanguageSubmit p, #loginSubmit p { +#addUserSubmit { + grid-row: 5; +} + +#newLanguageSubmit p, #editLanguageSubmit p, #loginSubmit p, #addUserSubmit p { display: block; font-size: 3vh; margin: auto 10% auto; @@ -450,7 +468,7 @@ a { grid-template-rows: 100%; } -#signIn { +#signIn, #addUserButton { display: grid; grid-template-columns: 70% 20%; grid-template-rows: 100%; @@ -459,15 +477,15 @@ a { cursor: pointer; } -#signIn:hover { +#signIn:hover, #addUserButton:hover { background-color: rgba(255,255,255,0.1); } -#signIn p, #signIn i { +#signIn p, #signIn i, #addUserButton p, #addUserButton i { margin: auto; font-size: 180%; } -#addData, #editData { +#addData, #editData, #addUserButton { display: none; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 6854c5f..4e09a87 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -21,6 +21,13 @@ var members = [ "Kenneth Jao", "Yaman Qalieh", "Enrico Colon" ]; +var authorityLabels = { + 0: "#0: Full access", + 1: "#1: Create updates", + 2: "#2: Edit values and add files", + 3: "#3: No access" +}; + var dropOp = { //Insert correct }; @@ -105,10 +112,10 @@ function getData(updatePage) { createDrop(); if(updatePage === "add") { dropOpUpdate("langSelect"); - document.querySelectorAll(".dropdown[option='langSelect'] .opCont p[langid='"+(data.languages.length)+"']")[0].click(); + document.querySelectorAll(".dropdown[option='langSelect'] .opCont p[dropoption='"+(data.languages.length)+"']")[0].click(); } else if(updatePage === "edit") { dropOpUpdate("langSelect"); - document.querySelectorAll(".dropdown[option='langSelect'] .opCont p[langid='"+(dropOpStore["langSelect"])+"']")[0].click(); + document.querySelectorAll(".dropdown[option='langSelect'] .opCont p[dropoption='"+(dropOpStore["langSelect"])+"']")[0].click(); } }, function error(e) { @@ -225,6 +232,10 @@ function generateDropOp() { // For options that change based on data. graph.style.opacity = "1"; }, 300); }].concat(["Select language..."].concat(data.values.map(a=>a.id))); + + dropOp["authority"] = [function() { + + }].concat(["Select authority..."].concat(Object.keys(authorityLabels))); } function createDrop() { @@ -236,7 +247,7 @@ function createDrop() { var div = document.createElement("div"); div.className = "button"; var p = document.createElement("p"); - var op = dropButtons[i].getAttribute("option"); + let op = dropButtons[i].getAttribute("option"); p.appendChild(document.createTextNode(dropOp[op][1])); var ic = document.createElement("i"); ic.className = "fa fa-angle-down"; @@ -246,22 +257,24 @@ function createDrop() { var div2 = document.createElement("div"); div2.className = "opCont transition"; - var p3 = document.createElement("p"); - p3.className = "transition"; - p3.id = "addData"; - p3.onclick = function() { // Open add language. - modal("newLanguage", true); - }; - p3.appendChild(document.createTextNode("Add language...")); - div2.appendChild(p3); - + if(op === "langSelect") { + var p3 = document.createElement("p"); + p3.className = "transition"; + p3.id = "addData"; + p3.onclick = function() { // Open add language. + modal("newLanguage", true); + }; + p3.appendChild(document.createTextNode("Add language...")); + div2.appendChild(p3); + } + for (var j = 2; j < dropOp[op].length; j++) { var p2 = document.createElement("p"); - p2.setAttribute("langId", dropOp[op][j]); + p2.setAttribute("dropoption", dropOp[op][j]); p2.className = "transition"; p2.onclick = function(e) { e.stopPropagation(); - dropOpStore[op] = this.getAttribute("langId"); + dropOpStore[op] = this.getAttribute("dropoption"); dropOpUpdate(op); let opCont = this.parentNode; opCont.style.opacity = "0"; @@ -269,7 +282,8 @@ function createDrop() { opCont.style.display = "none"; }, 300); }; - p2.appendChild(document.createTextNode(language(dropOp[op][j]).name)); + if(op === "langSelect") p2.appendChild(document.createTextNode(language(dropOp[op][j]).name)); + if(op === "authority") p2.appendChild(document.createTextNode(authorityLabels[dropOp[op][j]])) div2.appendChild(p2); } @@ -295,7 +309,9 @@ function createDrop() { function dropOpUpdate(op) { var dropdown = document.querySelectorAll(".dropdown[option=" + op + "] .button p")[0]; - dropdown.textContent = language(dropOpStore[op]).name; + if(op === "langSelect") dropdown.textContent = language(dropOpStore[op]).name; + if(op === "authority") dropdown.textContent = authorityLabels[dropOpStore[op]]; + console.log(op); (dropOp[op][0])(); } @@ -309,6 +325,7 @@ document.onclick = function(event) { } }; + function homeCards() { // GET posts from server var week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; @@ -416,13 +433,24 @@ function modal(id, open) { } } -var modals = ["newLanguage", "editLanguage", "login"]; +var modals = ["newLanguage", "editLanguage", "login", "addUser"]; for(var i = 0; i < modals.length; i++) { let id = modals[i]; document.getElementById(modals[i]).onclick = function(event) { modal(id, false); }; document.querySelectorAll("#"+modals[i]+" > div")[0].onclick = function(event) { event.stopPropagation(); }; } +document.querySelectorAll("#addUser > div")[0].onclick = function(event) { + event.stopPropagation(); + for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) { + var opCont = document.querySelectorAll(".dropdown .opCont")[i]; + opCont.style.opacity = "0"; + setTimeout(function() { + opCont.style.display = "none"; + }, 300); + } +} + document.getElementById("editData").onclick = function() { // Open edit language. var langInfo = language(dropOpStore["langSelect"]); document.querySelectorAll("#editLanguageName input")[0].value = langInfo.name; @@ -436,9 +464,8 @@ document.getElementById("editData").onclick = function() { // Open edit language modal("editLanguage", true); }; -document.getElementById("signIn").onclick = function() { - modal("login", true); -} +document.getElementById("signIn").onclick = function() { modal("login", true); }; +document.getElementById("addUserButton").onclick = function() { modal("addUser", true); }; document.querySelectorAll("#newLanguageSubmit p")[0].onclick = function() { // Function for adding a language. if(!submittable) return; @@ -703,7 +730,10 @@ document.querySelectorAll("#editLanguageSubmit p")[0].onclick = function() { // }; document.querySelectorAll("#loginSubmit p")[0].onclick = function() { - var info = [document.querySelectorAll("#loginUsername input")[0], document.querySelectorAll("#loginPassword input")[0]]; + var info = [ + document.querySelectorAll("#loginUsername input")[0], + document.querySelectorAll("#loginPassword input")[0] + ]; if(info[0].value === "") { alert("Please enter in a username!"); return; @@ -716,10 +746,70 @@ document.querySelectorAll("#loginSubmit p")[0].onclick = function() { modal("login", false); document.getElementById("addData").style.display = "block"; document.getElementById("editData").style.display = "grid"; + document.getElementById("addUserButton").style.display = "grid"; + document.getElementById("signIn").style.display = "none"; setTimeout(function() { info[0].value = ""; info[1].value = ""; }, 300) +}; + +document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { + var info = [ + document.querySelectorAll("#addUserUsername input")[0], + document.querySelectorAll("#addUserPassword input")[0], + dropOpStore["authority"] + ]; + if(info[0].value === "") { + alert("Please enter in a username!"); + return; + } else if(info[1].value === "") { + alert("Please enter in a password!"); + return; + } else if(info[2] === "") { + alert("Please enter in an authority level!"); + return; + } + + console.log({ + username: info[0].value, + authority: info[2], + password: info[1].value, + editor: loginInfo + }); + + this.innerText = "Processing..."; + this.style.backgroundColor = "rgba(0,0,0,0.2)"; + + $.ajax({ + url: serverURL + '/editors', + type: 'POST', + dataType: "json", + contentType: 'application/json;charset=UTF-8', + context: {counter: i}, + data: JSON.stringify({ + username: info[0].value, + authority: info[2], + password: info[1].value, + editor: loginInfo + }) + }) + .then( + function success(incoming) { + modal("addUser", false); + setTimeout(function() { + info[0].value = ""; + info[1].value = ""; + dropOpStore["authority"] = ""; + document.querySelectorAll(".dropdown[option=authority] .button p")[0].textContent = dropOp["authority"][1]; + }, 300); + }, + function error(e) { + alert("There was an error adding a user."); + console.log(e); + } + ); + } /*function getTrelloCards() { diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index d13a7a8..8e5a3a3 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -23,7 +23,11 @@

Login

-
+
+
+

Add User

+ +
@@ -145,6 +149,27 @@
+
+
+

Add New User

+
+

Username:

+ +
+
+

Authority:

+ +
+
+

Password:

+ +
+
+

Submit!

+
+
+
From bdcd0a5e08a23fac2d9ed7caf70e2c5d2051f714 Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 16 Apr 2018 22:50:11 -0400 Subject: [PATCH 53/80] fix editor bug --- SmearcarDB/server.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 4c15b8c..6d81362 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -226,17 +226,17 @@ def updates(): def editors(): if request.method == "POST": received = request.get_json() - if Editor.query.filter_by(username=received['username'].count()) == 0 and check_privelege(received['editor'], 0): + if Editor.query.filter_by(username=received['username']).count() == 0 and check_privelege(received['editor'], 0): user = Editor(authority = received['authority'], username = received['username'], password = received['password']) db.session.add(user) db.session.commit() - return user + return "Success" else: return "Bad Request" else: return "Bad Request" -if __name__ == "__main__": - app.run(host="0.0.0.0") +# if __name__ == "__main__": +# app.run(host="0.0.0.0") From a6a163844ad707162b91b354dbb91b1004e66247 Mon Sep 17 00:00:00 2001 From: yamanq Date: Mon, 16 Apr 2018 22:52:28 -0400 Subject: [PATCH 54/80] uncomment --- SmearcarDB/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 6d81362..bc5a11d 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -238,5 +238,5 @@ def editors(): else: return "Bad Request" -# if __name__ == "__main__": -# app.run(host="0.0.0.0") +if __name__ == "__main__": + app.run(host="0.0.0.0") From d1492e05df2565304014f2f912e548ad24f3baad Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Mon, 16 Apr 2018 23:16:37 -0400 Subject: [PATCH 55/80] fixed adding users --- SmearcarDB/static/index.js | 53 +++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 653657a..80a39db 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -162,10 +162,8 @@ function generateDropOp() { // For options that change based on data. while (info.firstChild) { info.removeChild(info.firstChild); } - var p = document.createElement("p"); var p2 = document.createElement("p"); var a = document.createElement("a"); - p.appendChild(document.createTextNode("Type: " + (langInfo.type || "N/A"))); p2.appendChild(document.createTextNode("Source: ")); if(langInfo.source === null) { p2.appendChild(document.createTextNode("N/A")); @@ -175,7 +173,6 @@ function generateDropOp() { // For options that change based on data. a.appendChild(document.createTextNode(srcText)); p2.appendChild(a); } - info.appendChild(p); info.appendChild(p2); // Generate data box material. @@ -431,7 +428,12 @@ function modal(id, open) { var modals = ["newLanguage", "editLanguage", "login", "addUser"]; for(var i = 0; i < modals.length; i++) { let id = modals[i]; - document.getElementById(modals[i]).onclick = function(event) { modal(id, false); }; + document.getElementById(modals[i]).onclick = function(event) { + modal(id, false); + for(var j = 0; j < document.getElementsByTagName("input"); j++) document.getElementsByTagName("input")[j].value = ""; + dropOpStore["authority"] = ""; + document.querySelectorAll(".dropdown[option=authority] .button p")[0].textContent = dropOp["authority"][1]; + }; document.querySelectorAll("#"+modals[i]+" > div")[0].onclick = function(event) { event.stopPropagation(); }; } @@ -750,31 +752,30 @@ document.querySelectorAll("#loginSubmit p")[0].onclick = function() { }; document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { + if(!submittable) return; + submittable = false; var info = [ document.querySelectorAll("#addUserUsername input")[0], document.querySelectorAll("#addUserPassword input")[0], - dropOpStore["authority"] + parseInt(dropOpStore["authority"]) ]; if(info[0].value === "") { alert("Please enter in a username!"); + submittable = true; return; } else if(info[1].value === "") { alert("Please enter in a password!"); + submittable = true; return; } else if(info[2] === "") { alert("Please enter in an authority level!"); + submittable = true; return; } - console.log({ - username: info[0].value, - authority: info[2], - password: info[1].value, - editor: loginInfo - }); - this.innerText = "Processing..."; this.style.backgroundColor = "rgba(0,0,0,0.2)"; + var p = this; $.ajax({ url: serverURL + '/editors', @@ -790,21 +791,25 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { }) }) .then( - function success(incoming) { - modal("addUser", false); - setTimeout(function() { - info[0].value = ""; - info[1].value = ""; - dropOpStore["authority"] = ""; - document.querySelectorAll(".dropdown[option=authority] .button p")[0].textContent = dropOp["authority"][1]; - }, 300); - }, + function success(incoming) {}, function error(e) { - alert("There was an error adding a user."); - console.log(e); + if(e.responseText !== "Success") { + alert("There was an error adding a user."); + console.log(e); + } else { + modal("addUser", false); + setTimeout(function() { + info[0].value = ""; + info[1].value = ""; + dropOpStore["authority"] = ""; + submittable = true; + p.innerText = "Submit!"; + p.style.backgroundColor = "#FEFEFE"; + document.querySelectorAll(".dropdown[option=authority] .button p")[0].textContent = dropOp["authority"][1]; + }, 300); + } } ); - } /*function getTrelloCards() { From 1a1c2cced27863c37929ff90a49fe044040d0d54 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 19 Apr 2018 16:10:18 -0400 Subject: [PATCH 56/80] Added updating posts --- SmearcarDB/static/index.css | 59 ++++++++++++----- SmearcarDB/static/index.js | 113 ++++++++++++++++++++++++-------- SmearcarDB/templates/index.html | 24 +++++++ 3 files changed, 153 insertions(+), 43 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index ae09500..182390e 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -170,6 +170,10 @@ a { opacity: 1; } +#home > div { + margin-bottom: 2vh; +} + .card { display: grid; border-radius: 2px; @@ -359,7 +363,7 @@ a { background-color: rgba(0, 0, 0, 0.05); } -#newLanguage, #editLanguage, #login, #addUser { +#newLanguage, #editLanguage, #login, #addUser, #writePost { position: absolute; width: 100%; height: 100%; @@ -368,7 +372,7 @@ a { background-color: rgba(0,0,0,0.4); } -#newLanguage > div, #editLanguage > div, #login > div, #addUser > div { +#newLanguage > div, #editLanguage > div, #login > div, #addUser > div, #writePost > div { position: absolute; width: 20%; height: 60%; @@ -388,11 +392,19 @@ a { grid-template-rows: 6vh 1fr 1fr 1fr 1fr; } -#loginUsername, #loginPassword, #addUserUsername, #addUserPassword { +#writePost > div { + margin-left: 30%; + margin-right: 30%; + width: 40%; + height: 60%; + grid-template-rows: 6vh 1fr 1fr 8fr 2fr; +} + +#loginUsername, #loginPassword, #addUserUsername, #addUserPassword, #writePostText, #writePostAuthor, #writePostTitle { margin-left: 5%; } -#login input, #addUser input { +#login input, #addUser input, #writePost textarea, #writePost input { border: 0; background-color: rgba(0,0,0,0.1); font-family: 'Saira Condensed', sans-serif; @@ -400,9 +412,20 @@ a { font-weight: 300; padding: 2%; width: 90%; + outline: none; } -#newLanguageName, #editLanguageName, #loginUsername, #addUserUsername { +#writePost input { + padding: 1%; + font-size: 100%; +} + +#writePost textarea { + height: 80%; + resize: none; +} + +#newLanguageName, #editLanguageName, #loginUsername, #addUserUsername, #writePostTitle { grid-row: 2; } @@ -418,7 +441,7 @@ a { grid-row: 1; } -#newLanguagePhonemes, #editLanguagePhonemes, #loginPassword, #addUserAuthority { +#newLanguagePhonemes, #editLanguagePhonemes, #loginPassword, #addUserAuthority, #writePostAuthor { grid-row: 3; } @@ -427,7 +450,7 @@ a { width: 90%; } -#addUserPassword { +#addUserPassword, #writePostText { grid-row: 4; } @@ -444,16 +467,16 @@ a { font-size: 1.5vh; } -#newLanguageSubmit, #editLanguageSubmit, #loginSubmit, #addUserSubmit { +#newLanguageSubmit, #editLanguageSubmit, #loginSubmit { display: grid; grid-row: 4; } -#addUserSubmit { +#addUserSubmit, #addUserSubmit, #writePostSubmit { grid-row: 5; } -#newLanguageSubmit p, #editLanguageSubmit p, #loginSubmit p, #addUserSubmit p { +#newLanguageSubmit p, #editLanguageSubmit p, #loginSubmit p, #addUserSubmit p, #writePostSubmit p { display: block; font-size: 3vh; margin: auto 10% auto; @@ -464,28 +487,32 @@ a { #header2 { display:grid; - grid-template-columns: 90% 10%; + grid-template-columns: 80% 10% 10%; grid-template-rows: 100%; } -#signIn, #addUserButton { +#signIn, #addUserButton, #addUpdateButton { display: grid; grid-template-columns: 70% 20%; grid-template-rows: 100%; - grid-column: 2; + grid-column: 3; grid-row: 1; cursor: pointer; } + +#addUpdateButton { + grid-column: 2; +} -#signIn:hover, #addUserButton:hover { +#signIn:hover, #addUserButton:hover, #addUpdateButton:hover, #writePostButton:hover { background-color: rgba(255,255,255,0.1); } -#signIn p, #signIn i, #addUserButton p, #addUserButton i { +#signIn p, #signIn i, #addUserButton p, #addUserButton i, #addUpdateButton p, #addUpdateButton i { margin: auto; font-size: 180%; } -#addData, #editData, #addUserButton { +#addData, #editData, #addUserButton, #addUpdateButton { display: none; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 80a39db..60368a1 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -324,35 +324,36 @@ document.onclick = function(event) { function homeCards() { - // TODO GET posts from server - + var home = document.getElementById("home"); + while (home.firstChild) { + home.removeChild(home.firstChild); + } $.ajax({ url: serverURL + '/updates', type: 'GET' }) - .then( - function success(incoming) { - var postList = incoming; - var home = document.getElementById("home"); - for(var i = 0; i < postList.length; i++) { - var div = document.createElement("div"); - div.className = "card"; - var h2 = document.createElement("h2"); - h2.textContent = postList[i].title; - div.appendChild(h2); - var h3 = document.createElement("h3"); - h3.textContent = postList[i].date; - div.appendChild(h3); - var p = document.createElement("p"); - p.innerHTML = postList[i].content; - div.appendChild(p); - home.appendChild(div); - } - }, - function error(e) { - console.log(e); + .then( + function success(incoming) { + var postList = incoming; + for(var i = postList.length - 1; i >= 0 ; i--) { + var div = document.createElement("div"); + div.className = "card"; + var h2 = document.createElement("h2"); + h2.textContent = postList[i].title; + div.appendChild(h2); + var h3 = document.createElement("h3"); + h3.textContent = postList[i].date; + div.appendChild(h3); + var p = document.createElement("p"); + p.innerHTML = postList[i].content; + div.appendChild(p); + home.appendChild(div); } - ); + }, + function error(e) { + console.log(e); + } + ); } @@ -463,6 +464,7 @@ document.getElementById("editData").onclick = function() { // Open edit language document.getElementById("signIn").onclick = function() { modal("login", true); }; document.getElementById("addUserButton").onclick = function() { modal("addUser", true); }; +document.getElementById("addUpdateButton").onclick = function() { modal("writePost", true); }; document.querySelectorAll("#newLanguageSubmit p")[0].onclick = function() { // Function for adding a language. if(!submittable) return; @@ -744,6 +746,7 @@ document.querySelectorAll("#loginSubmit p")[0].onclick = function() { document.getElementById("addData").style.display = "block"; document.getElementById("editData").style.display = "grid"; document.getElementById("addUserButton").style.display = "grid"; + document.getElementById("addUpdateButton").style.display = "grid"; document.getElementById("signIn").style.display = "none"; setTimeout(function() { info[0].value = ""; @@ -777,12 +780,11 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { this.style.backgroundColor = "rgba(0,0,0,0.2)"; var p = this; - $.ajax({ + $.ajax({ url: serverURL + '/editors', type: 'POST', dataType: "json", contentType: 'application/json;charset=UTF-8', - context: {counter: i}, data: JSON.stringify({ username: info[0].value, authority: info[2], @@ -810,7 +812,64 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { } } ); -} +}; + +document.querySelectorAll("#writePostSubmit p")[0].onclick = function() { + if(!submittable) return; + submittable = false; + var info = [ + document.querySelectorAll("#writePostTitle input")[0], + document.querySelectorAll("#writePostAuthor input")[0], + document.querySelectorAll("#writePostText textarea")[0] + ]; + if(info[0].value === "") { + alert("Please enter in a title!"); + submittable = true; + return; + } else if(info[1].value === "") { + alert("Please enter in an author!"); + submittable = true; + return; + } else if(info[2].value === "") { + alert("Please enter in a message!"); + submittable = true; + return; + } + this.innerText = "Processing..."; + this.style.backgroundColor = "rgba(0,0,0,0.2)"; + var p = this; + + $.ajax({ + url: serverURL + '/updates', + type: 'POST', + dataType: "json", + contentType: 'application/json;charset=UTF-8', + data: JSON.stringify({ + title: info[0].value, + author: info[1].value, + content: info[2].value, + editor: loginInfo + }) + }) + .then( + function success(incoming) { + modal("writePost", false); + homeCards(); + setTimeout(function() { + info[0].value = ""; + info[1].value = ""; + info[2].value = ""; + submittable = true; + p.innerText = "Submit!"; + p.style.backgroundColor = "#FEFEFE"; + }, 300); + }, + function error(e) { + alert("There was an error adding a post."); + console.log(e); + } + ); +}; /*function getTrelloCards() { Trello.authorize(); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 8e5a3a3..6eb4795 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -20,6 +20,10 @@

/'smi:ɹ̠ka:ɹ̠/

+
+

Write Post

+ +

Login

@@ -170,6 +174,26 @@
+
+
+

Write New Update

+
+

Title:

+ +
+
+

Author:

+ +
+
+

Message:

+ +
+
+

Submit!

+
+
+
From 35091bb31537f3571ff26771d31b1e2b4f7905b9 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 19 Apr 2018 20:41:05 -0400 Subject: [PATCH 57/80] Standardized modal creation --- SmearcarDB/static/index.css | 56 +++++- SmearcarDB/static/index.js | 346 +++++++++++++++++++++++--------- SmearcarDB/templates/index.html | 95 +-------- 3 files changed, 302 insertions(+), 195 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 182390e..96be431 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -363,7 +363,7 @@ a { background-color: rgba(0, 0, 0, 0.05); } -#newLanguage, #editLanguage, #login, #addUser, #writePost { +/*#newLanguage, #editLanguage, #login, #addUser, #writePost { position: absolute; width: 100%; height: 100%; @@ -382,6 +382,10 @@ a { grid-template-rows: 6vh 5% 70% auto; } +#newLanguage > div { + grid-template-rows: 6vh 5% 5% 70% auto; +} + #login > div { height: 30%; grid-template-rows: 6vh 1fr 1fr 1fr; @@ -400,7 +404,7 @@ a { grid-template-rows: 6vh 1fr 1fr 8fr 2fr; } -#loginUsername, #loginPassword, #addUserUsername, #addUserPassword, #writePostText, #writePostAuthor, #writePostTitle { +#loginUsername, #loginPassword, #addUserUsername, #addUserPassword, #writePostText, #writePostAuthor, #writePostTitle, #newLanguageSource { margin-left: 5%; } @@ -429,7 +433,7 @@ a { grid-row: 2; } -#newLanguageName p, #editLanguageName p { +#newLanguageName p, #editLanguageName p, #newLanguageSource p { display: inline; margin-left: 5%; grid-row: 1; @@ -441,6 +445,10 @@ a { grid-row: 1; } +#newLanguageSource { + grid-row: 3; +} + #newLanguagePhonemes, #editLanguagePhonemes, #loginPassword, #addUserAuthority, #writePostAuthor { grid-row: 3; } @@ -467,12 +475,16 @@ a { font-size: 1.5vh; } -#newLanguageSubmit, #editLanguageSubmit, #loginSubmit { +#newLanguagePhonemes { + grid-row: 4; +} + +#editLanguageSubmit, #loginSubmit { display: grid; grid-row: 4; } -#addUserSubmit, #addUserSubmit, #writePostSubmit { +#addUserSubmit, #addUserSubmit, #writePostSubmit, #newLanguageSubmit { grid-row: 5; } @@ -483,7 +495,7 @@ a { padding: 1%; text-align: center; cursor: pointer; -} +}*/ #header2 { display:grid; @@ -515,4 +527,36 @@ a { #addData, #editData, #addUserButton, #addUpdateButton { display: none; +} + +.modal { + position: absolute; + width: 100%; + height: 100%; + display: none; + opacity: 0; + background-color: rgba(0,0,0,0.4); +} + +.modalSubmit { + display: block; + width: 70%; + font-size: 3vh; + margin: auto; + padding: 1%; + text-align: center; + cursor: pointer; +} + +.modal input, .modal textarea { + margin: 0 auto 0 auto; + border: 0; + background-color: rgba(0,0,0,0.1); + font-family: 'Saira Condensed', sans-serif; + font-size: 100%; + font-weight: 300; + padding: 1vh; + width: 90%; + outline: none; + resize: none; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 60368a1..a63103d 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -5,11 +5,10 @@ var data; var languageChart; var dataOpen = false; var submittable = true; +var dropOp = {}; +var dropOpStore = {}; var loginInfo = {}; -// var trelloInfo = {}; - - var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. ["home", "Home", "home"], ["bar-chart", "Data Values", "dataValues1"], @@ -17,10 +16,6 @@ var navi = [ // Array containing navigation items in form [Font-Awesome class na ["info", "About", "about"] ]; -var members = [ - "Kenneth Jao", "Yaman Qalieh", "Enrico Colon" -]; - var authorityLabels = { 0: "#0: Full access", 1: "#1: Create updates", @@ -28,11 +23,137 @@ var authorityLabels = { 3: "#3: No access" }; -var dropOp = { - //Insert correct -}; -var dropOpStore = {}; +var modals = [ + { + name: "Add Language", + modal: "newLanguage", + button: "addData", + structure: { + width: "20%", + form: [ + { + name: "Name", + formType: "input" + }, + { + name: "Source", + formType: "input", + inputType: "file" + }, + { + name: "Phonemes", + formType: "textarea", + height: "25vh" + } + ] + } + }, + { + name: "Edit Language", + modal: "editLanguage", + button: "editData", + buttonClick: function() { + var langInfo = language(dropOpStore["langSelect"]); + document.querySelectorAll("#editLanguageName input")[0].value = langInfo.name; + var k = Object.keys(langInfo.phonemes); + var v = Object.values(langInfo.phonemes); + var str = ""; + for(var i = 0; i < k.length; i++) { + str += k[i] + " " + v[i] + ((i === k.length-1) ? "" : "\n"); + } + document.querySelectorAll("#editLanguagePhonemes textarea")[0].value = str; + //modal("editLanguage", true); + }, + structure: { + width: "20%", + form: [ + { + name: "Name", + formType: "input" + }, + { + name: "Source", + formType: "input", + inputType: "file" + }, + { + name: "Phonemes", + formType: "textarea", + height: "25vh" + } + ] + } + }, + { + name: "Login", + modal: "login", + button: "signIn", + structure: { + width: "20%", + form: [ + { + name: "Username", + formType: "input" + }, + { + name: "Password", + formType: "input", + inputType: "password" + }, + ] + } + }, + { + name: "Add User", + modal: "addUser", + button: "addUserButton", + structure: { + width: "20%", + form: [ + { + name: "Username", + formType: "input" + }, + { + name: "Authority", + formType: "input", + inputType: "number" + }, + { + name: "Password", + formType: "input", + inputType: "password" + } + ] + } + }, + { + name: "Write Update", + modal: "writePost", + button: "addUpdateButton", + structure: { + width: "40%", + form: [ + { + name: "Title", + formType: "input", + }, + { + name: "Author", + formType: "input", + }, + { + name: "Message", + formType: "textarea", + height: "18vh" + } + ] + } + }, +]; + + function Rnd(item,fig) { if(varType(item) === "Array") { @@ -117,6 +238,7 @@ function getData(updatePage) { dropOpUpdate("langSelect"); document.querySelectorAll(".dropdown[option='langSelect'] .opCont p[dropoption='"+(dropOpStore["langSelect"])+"']")[0].click(); } + generateModals(); }, function error(e) { console.log(e); @@ -258,9 +380,6 @@ function createDrop() { var p3 = document.createElement("p"); p3.className = "transition"; p3.id = "addData"; - p3.onclick = function() { // Open add language. - modal("newLanguage", true); - }; p3.appendChild(document.createTextNode("Add language...")); div2.appendChild(p3); } @@ -342,7 +461,7 @@ function homeCards() { h2.textContent = postList[i].title; div.appendChild(h2); var h3 = document.createElement("h3"); - h3.textContent = postList[i].date; + h3.textContent = postList[i].author + " - " + postList[i].date; div.appendChild(h3); var p = document.createElement("p"); p.innerHTML = postList[i].content; @@ -426,19 +545,7 @@ function modal(id, open) { } } -var modals = ["newLanguage", "editLanguage", "login", "addUser"]; -for(var i = 0; i < modals.length; i++) { - let id = modals[i]; - document.getElementById(modals[i]).onclick = function(event) { - modal(id, false); - for(var j = 0; j < document.getElementsByTagName("input"); j++) document.getElementsByTagName("input")[j].value = ""; - dropOpStore["authority"] = ""; - document.querySelectorAll(".dropdown[option=authority] .button p")[0].textContent = dropOp["authority"][1]; - }; - document.querySelectorAll("#"+modals[i]+" > div")[0].onclick = function(event) { event.stopPropagation(); }; -} - -document.querySelectorAll("#addUser > div")[0].onclick = function(event) { +/*document.querySelectorAll("#addUser > div")[0].onclick = function(event) { event.stopPropagation(); for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) { var opCont = document.querySelectorAll(".dropdown .opCont")[i]; @@ -447,26 +554,84 @@ document.querySelectorAll("#addUser > div")[0].onclick = function(event) { opCont.style.display = "none"; }, 300); } +}*/ + + +function generateModals() { + while(document.getElementsByClassName("modal").length > 0) { + document.getElementsByTagName("body")[0].removeChild(document.getElementsByClassName("modal")[0]); + } + for(var i = 0; i < modals.length; i++) { + let eachModal = modals[i]; + var overlay = document.createElement("div"); + overlay.id = modals[i].modal; + overlay.className = "transition modal"; + + var modalCont = document.createElement("div"); + modalCont.className = "card transition"; + modalCont.style.position = "absolute"; + modalCont.style.paddingBottom = "1vh"; + modalCont.style.width = modals[i].structure.width; + var marg = 50-parseInt(modals[i].structure.width.replace("%",""))/2; + modalCont.style.margin = "5% " + marg + "% 0 " + marg+"%"; + var h2 = document.createElement("h2"); + h2.appendChild(document.createTextNode(modals[i].name)); + h2.style.gridRow = "1"; + modalCont.appendChild(h2); + + var gridTemplate = "6vh "; + var form = modals[i].structure.form; + for(var j = 0; j < form.length; j++) { + gridTemplate += (form[j].formType === "input") ? "7vh " : "auto "; + var div = document.createElement("div"); + div.id = modals[i].modal + form[j].name; + div.style.marginLeft = "5%"; + div.style.gridRow = j+2; + var p = document.createElement("p"); + p.appendChild(document.createTextNode(form[j].name + ":")); + var input = document.createElement(form[j].formType); + if(form[j].inputType) input.type = form[j].inputType; + if(form[j].height) input.style.height = form[j].height; + + + div.appendChild(p); + div.appendChild(input); + modalCont.appendChild(div); + } + gridTemplate += "7vh"; + modalCont.style.gridTemplateRows = gridTemplate; + modalCont.style.gridTemplateColumns = "100%"; + + var submit = document.createElement("div"); + submit.id = modals[i].modal + "Submit"; + submit.style.gridRow = form.length+2; + submit.style.display = "grid"; + submit.onclick = function() { + (eachModal.submitClick)(); + } + var p2 = document.createElement("p"); + p2.className = "card modalSubmit"; // Refer to modalSubmit CSS to edit. + p2.appendChild(document.createTextNode("Submit!")); + submit.appendChild(p2); + modalCont.appendChild(submit); + + overlay.appendChild(modalCont); + document.getElementsByTagName("body")[0].appendChild(overlay); + console.log(modals[i].button); + document.getElementById(modals[i].button).onclick = function() { + if(eachModal.buttonClick) (eachModal.buttonClick)(); + modal(eachModal.modal, true); + } + + overlay.onclick = function(event) { + if(this !== event.target) return; + for(var i = 0; i < document.getElementsByTagName("input").length; i++) document.getElementsByTagName("input")[i].value = ""; + modal(eachModal.modal, false); + } + } } -document.getElementById("editData").onclick = function() { // Open edit language. - var langInfo = language(dropOpStore["langSelect"]); - document.querySelectorAll("#editLanguageName input")[0].value = langInfo.name; - var k = Object.keys(langInfo.phonemes); - var v = Object.values(langInfo.phonemes); - var str = ""; - for(var i = 0; i < k.length; i++) { - str += k[i] + " " + v[i] + ((i === k.length-1) ? "" : "\n"); - } - document.querySelectorAll("#editLanguagePhonemes textarea")[0].value = str; - modal("editLanguage", true); -}; - -document.getElementById("signIn").onclick = function() { modal("login", true); }; -document.getElementById("addUserButton").onclick = function() { modal("addUser", true); }; -document.getElementById("addUpdateButton").onclick = function() { modal("writePost", true); }; - -document.querySelectorAll("#newLanguageSubmit p")[0].onclick = function() { // Function for adding a language. +modals[0].submitClick = function() { // submitClick for newLanguage. if(!submittable) return; submittable = false; var name = document.querySelectorAll("#newLanguageName input")[0].value; @@ -493,16 +658,30 @@ document.querySelectorAll("#newLanguageSubmit p")[0].onclick = function() { // F } phonemes[info[i][0]] = num; } + + var formData = new FormData(); + var source = document.querySelectorAll("#newLanguageSource input")[0].files; + if(source.length === 0 || source[0].type) { + alert("Please give a source!"); + submittable = true; + return; + } + formData.append("source", source[0]); + formData.append("name", name); + formData.append("phonemes", phonemes); + formData.append("editor", loginInfo); + var newLanguage = { name: name, - source: null, + source: sourceData, phonemes: phonemes, editor: loginInfo }; - this.innerText = "Processing..."; - this.style.backgroundColor = "rgba(0,0,0,0.2)"; - var p = this; + var p = document.querySelectorAll("#newLanguageSubmit p ")[0] + p.innerText = "Processing..."; + p.style.backgroundColor = "rgba(0,0,0,0.2)"; + $.ajax({ url: serverURL + '/server', type: 'POST', @@ -530,7 +709,7 @@ document.querySelectorAll("#newLanguageSubmit p")[0].onclick = function() { // F ); }; -document.querySelectorAll("#editLanguageSubmit p")[0].onclick = function() { // Function for submitting edits to language. +modals[1].submitClick= function() { // submitClick for editLanguage. if(!submittable) return; var langInfo = language(dropOpStore["langSelect"]); submittable = false; @@ -561,9 +740,9 @@ document.querySelectorAll("#editLanguageSubmit p")[0].onclick = function() { // } console.log(newPhonemes); - this.innerText = "Processing..."; - this.style.backgroundColor = "rgba(0,0,0,0.2)"; - var p = this; + var p = document.querySelectorAll("#editLanguageSubmit p")[0] + p.innerText = "Processing..."; + p.style.backgroundColor = "rgba(0,0,0,0.2)"; var oldPhoneset = new Set(Object.keys(langInfo.phonemes)); var newPhoneset = new Set(Object.keys(newPhonemes)); @@ -728,7 +907,7 @@ document.querySelectorAll("#editLanguageSubmit p")[0].onclick = function() { // } }; -document.querySelectorAll("#loginSubmit p")[0].onclick = function() { +modals[2].submitClick = function() { // submitClick for login. var info = [ document.querySelectorAll("#loginUsername input")[0], document.querySelectorAll("#loginPassword input")[0] @@ -751,16 +930,16 @@ document.querySelectorAll("#loginSubmit p")[0].onclick = function() { setTimeout(function() { info[0].value = ""; info[1].value = ""; - }, 300) + }, 300); }; -document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { +modals[3].submitClick = function() { if(!submittable) return; submittable = false; var info = [ document.querySelectorAll("#addUserUsername input")[0], document.querySelectorAll("#addUserPassword input")[0], - parseInt(dropOpStore["authority"]) + document.querySelectorAll("#addUserAuthority input")[0] ]; if(info[0].value === "") { alert("Please enter in a username!"); @@ -776,9 +955,9 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { return; } - this.innerText = "Processing..."; - this.style.backgroundColor = "rgba(0,0,0,0.2)"; - var p = this; + var p = document.querySelectorAll("#addUserSubmit p")[0] + p.innerText = "Processing..."; + p.style.backgroundColor = "rgba(0,0,0,0.2)"; $.ajax({ url: serverURL + '/editors', @@ -787,7 +966,7 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { contentType: 'application/json;charset=UTF-8', data: JSON.stringify({ username: info[0].value, - authority: info[2], + authority: parseInt(info[2]), password: info[1].value, editor: loginInfo }) @@ -814,13 +993,13 @@ document.querySelectorAll("#addUserSubmit p")[0].onclick = function() { ); }; -document.querySelectorAll("#writePostSubmit p")[0].onclick = function() { +modals[4].submitClick = function() { if(!submittable) return; submittable = false; var info = [ document.querySelectorAll("#writePostTitle input")[0], document.querySelectorAll("#writePostAuthor input")[0], - document.querySelectorAll("#writePostText textarea")[0] + document.querySelectorAll("#writePostMessage textarea")[0] ]; if(info[0].value === "") { alert("Please enter in a title!"); @@ -835,11 +1014,12 @@ document.querySelectorAll("#writePostSubmit p")[0].onclick = function() { submittable = true; return; } - this.innerText = "Processing..."; - this.style.backgroundColor = "rgba(0,0,0,0.2)"; - var p = this; - $.ajax({ + var p = document.querySelectorAll("#writePostSubmit p")[0] + p.innerText = "Processing..."; + p.style.backgroundColor = "rgba(0,0,0,0.2)"; + + $.ajax({ url: serverURL + '/updates', type: 'POST', dataType: "json", @@ -871,35 +1051,7 @@ document.querySelectorAll("#writePostSubmit p")[0].onclick = function() { ); }; -/*function getTrelloCards() { - Trello.authorize(); - var cardArr, listArr, lists; - var cards = window.Trello.rest( - "GET", "boards/vm2c2IZd/cards", - function success() { - cardArr = JSON.parse(cards.responseText); - lists = window.Trello.rest( - "GET", "boards/vm2c2IZd/lists", - function success() { - listArr = JSON.parse(lists.responseText); - for(var i = 0; i < listArr.length; i++) { - var arr = cardArr.filter(function(obj) { - return obj.idList === listArr[i].id; - }).map(a => a.name); - trelloInfo[listArr[i].name] = arr; - } - }, - function error(e) { - console.log(e); - }); - }, - function error(e) { - console.log(e); - }); -}*/ - getData(); homeCards(); createNav(); -updateNav(navSelect); - +updateNav(navSelect); \ No newline at end of file diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 6eb4795..e9a1db9 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -21,7 +21,7 @@
-

Write Post

+

Update

@@ -68,7 +68,7 @@
-
+

Currently in progress!

@@ -105,95 +105,6 @@
-
-
-

Add Language

-
-

Name:

- -
-
-

Phonemes:

- -
-
-

Submit!

-
-
-
-
-
-

Edit Language

-
-

Name:

- -
-
-

Phonemes:

- -
-
-

Submit!

-
-
-
-
-
-

Login

-
-

Username:

- -
-
-

Password:

- -
-
-

Submit!

-
-
-
-
-
-

Add New User

-
-

Username:

- -
-
-

Authority:

- -
-
-

Password:

- -
-
-

Submit!

-
-
-
-
-
-

Write New Update

-
-

Title:

- -
-
-

Author:

- -
-
-

Message:

- -
-
-

Submit!

-
-
-
From 8e3aca8e20707eaaa053bafca4a7d326d9cc5d09 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 19 Apr 2018 20:47:37 -0400 Subject: [PATCH 58/80] css cleanup --- SmearcarDB/static/index.css | 134 ------------------------------------ 1 file changed, 134 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 96be431..58f7baf 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -363,140 +363,6 @@ a { background-color: rgba(0, 0, 0, 0.05); } -/*#newLanguage, #editLanguage, #login, #addUser, #writePost { - position: absolute; - width: 100%; - height: 100%; - display: none; - opacity: 0; - background-color: rgba(0,0,0,0.4); -} - -#newLanguage > div, #editLanguage > div, #login > div, #addUser > div, #writePost > div { - position: absolute; - width: 20%; - height: 60%; - margin: 5% 40% 0 40%; - background-color: #F8F3F0; - grid-template-columns: 1fr; - grid-template-rows: 6vh 5% 70% auto; -} - -#newLanguage > div { - grid-template-rows: 6vh 5% 5% 70% auto; -} - -#login > div { - height: 30%; - grid-template-rows: 6vh 1fr 1fr 1fr; -} - -#addUser > div { - height: 40%; - grid-template-rows: 6vh 1fr 1fr 1fr 1fr; -} - -#writePost > div { - margin-left: 30%; - margin-right: 30%; - width: 40%; - height: 60%; - grid-template-rows: 6vh 1fr 1fr 8fr 2fr; -} - -#loginUsername, #loginPassword, #addUserUsername, #addUserPassword, #writePostText, #writePostAuthor, #writePostTitle, #newLanguageSource { - margin-left: 5%; -} - -#login input, #addUser input, #writePost textarea, #writePost input { - border: 0; - background-color: rgba(0,0,0,0.1); - font-family: 'Saira Condensed', sans-serif; - font-size: 120%; - font-weight: 300; - padding: 2%; - width: 90%; - outline: none; -} - -#writePost input { - padding: 1%; - font-size: 100%; -} - -#writePost textarea { - height: 80%; - resize: none; -} - -#newLanguageName, #editLanguageName, #loginUsername, #addUserUsername, #writePostTitle { - grid-row: 2; -} - -#newLanguageName p, #editLanguageName p, #newLanguageSource p { - display: inline; - margin-left: 5%; - grid-row: 1; -} - -#newLanguageName input, #editLanguageName input { - margin: auto 0 auto 0; - width: 50%; - grid-row: 1; -} - -#newLanguageSource { - grid-row: 3; -} - -#newLanguagePhonemes, #editLanguagePhonemes, #loginPassword, #addUserAuthority, #writePostAuthor { - grid-row: 3; -} - -#addUserAuthority { - margin-left: 5%; - width: 90%; -} - -#addUserPassword, #writePostText { - grid-row: 4; -} - -#newLanguagePhonemes p, #editLanguagePhonemes p { - margin-left: 5%; -} - -#newLanguagePhonemes textarea, #editLanguagePhonemes textarea { - width: 90%; - margin-left: 5%; - height: 90%; - resize: none; - font-family: 'Saira Condensed', sans-serif; - font-size: 1.5vh; -} - -#newLanguagePhonemes { - grid-row: 4; -} - -#editLanguageSubmit, #loginSubmit { - display: grid; - grid-row: 4; -} - -#addUserSubmit, #addUserSubmit, #writePostSubmit, #newLanguageSubmit { - grid-row: 5; -} - -#newLanguageSubmit p, #editLanguageSubmit p, #loginSubmit p, #addUserSubmit p, #writePostSubmit p { - display: block; - font-size: 3vh; - margin: auto 10% auto; - padding: 1%; - text-align: center; - cursor: pointer; -}*/ - #header2 { display:grid; grid-template-columns: 80% 10% 10%; From d6ac7e821ae5e76b4dc9e57f8c589a770cf0b343 Mon Sep 17 00:00:00 2001 From: yamanq Date: Thu, 19 Apr 2018 21:13:03 -0400 Subject: [PATCH 59/80] source adding --- SmearcarDB/server.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index bc5a11d..52381ac 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -124,21 +124,21 @@ def language_name_edit(info): language.name = info['language_name'] -def language_source_add(info): - """Add or replace a source""" - # info = { - # language_id: language_id, - # language_source = source - # } - language = Language.query.filter_by(id=info['language_id']).first() - language.source = info['language_source'] +# def language_source_add(info): +# """Add or replace a source""" +# # info = { +# # language_id: language_id, +# # language_source = source +# # } +# language = Language.query.filter_by(id=info['language_id']).first() +# language.source = info['language_source'] patch_functions = { "phoneme_add": phoneme_add, # Add and edit value "phoneme_remove": phoneme_remove, # Remove association and/or phoneme "language_name_edit": language_name_edit, # Change language name - "language_source_add": language_source_add # Add/edit source + # "language_source_add": language_source_add # Add/edit source } @@ -149,12 +149,23 @@ def initial(): # GET method for files -@app.route("/server/") +@app.route("/server/", methods=["GET"]) def file_return(lang_id): return Language.query.filter_by(id=lang_id).first().source +# POST files +@app.route("/source", methods=["POST"]) +def source_add(): + """Add or replace a source""" + if check_privelege(received['editor'], 2): + f = request.files['mytranscript'] + f.save("files/" + request.form['lang_id']) + return "nice" + return "Error" -# Place for client to communicate with the server + + +# Add and Edit data @app.route("/server", methods=["GET", "POST", "PATCH"]) def backend(): # # GET method returns the latest database From 252607ff86e8a65440e4ab246bbfbd8db23f7bfd Mon Sep 17 00:00:00 2001 From: yamanq Date: Thu, 19 Apr 2018 21:14:43 -0400 Subject: [PATCH 60/80] typo --- SmearcarDB/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 52381ac..a95a1b9 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -158,7 +158,7 @@ def file_return(lang_id): def source_add(): """Add or replace a source""" if check_privelege(received['editor'], 2): - f = request.files['mytranscript'] + f = request.files['file'] f.save("files/" + request.form['lang_id']) return "nice" return "Error" From 1ec1f43940dec001817afff3c1d6bb44a36bb623 Mon Sep 17 00:00:00 2001 From: yamanq Date: Thu, 19 Apr 2018 21:24:00 -0400 Subject: [PATCH 61/80] get files update --- SmearcarDB/server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index a95a1b9..15f9ffd 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -22,7 +22,7 @@ class Frequency(db.Model): class Language(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) name = db.Column(db.String(100), nullable=False) - source = db.Column(db.LargeBinary) + # source = db.Column(db.LargeBinary) phonemes = db.relationship('Frequency') @@ -151,7 +151,10 @@ def initial(): # GET method for files @app.route("/server/", methods=["GET"]) def file_return(lang_id): - return Language.query.filter_by(id=lang_id).first().source + try: + return send_file('source/' + lang_id) + except Exception as e: + return str(e) # POST files @app.route("/source", methods=["POST"]) From e3497c1b9fa4cfa5b97b9cc8fe32b2e62ea8dea1 Mon Sep 17 00:00:00 2001 From: yamanq Date: Thu, 19 Apr 2018 21:33:09 -0400 Subject: [PATCH 62/80] fix bug --- SmearcarDB/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 15f9ffd..d469528 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -59,7 +59,7 @@ def database(): for language in Language.query.order_by(Language.name).all(): languageobject = {'id': language.id, 'name': language.name, - 'source': language.source, + # 'source': language.source, 'phonemes': {}} for frequency in language.phonemes: languageobject['phonemes'][frequency.phoneme.name] = frequency.value From 614c03b1ac6c9efe88e0062e7c82cc3cc918a637 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Thu, 19 Apr 2018 21:45:56 -0400 Subject: [PATCH 63/80] Header title, and minor css --- SmearcarDB/static/index.css | 13 ++++++++++--- SmearcarDB/static/index.js | 8 ++++---- SmearcarDB/templates/index.html | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 58f7baf..4f5b711 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -365,7 +365,7 @@ a { #header2 { display:grid; - grid-template-columns: 80% 10% 10%; + grid-template-columns: 20% 60% 10% 10%; grid-template-rows: 100%; } @@ -373,13 +373,13 @@ a { display: grid; grid-template-columns: 70% 20%; grid-template-rows: 100%; - grid-column: 3; + grid-column: 4; grid-row: 1; cursor: pointer; } #addUpdateButton { - grid-column: 2; + grid-column: 3; } #signIn:hover, #addUserButton:hover, #addUpdateButton:hover, #writePostButton:hover { @@ -425,4 +425,11 @@ a { width: 90%; outline: none; resize: none; +} + +#headerTitle { + font-size: 200%; + font-weight: 300; + margin: auto 10% auto; + font-family: 'Saira Condensed', sans-serif; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index a63103d..ff6ab01 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -63,7 +63,6 @@ var modals = [ str += k[i] + " " + v[i] + ((i === k.length-1) ? "" : "\n"); } document.querySelectorAll("#editLanguagePhonemes textarea")[0].value = str; - //modal("editLanguage", true); }, structure: { width: "20%", @@ -153,8 +152,6 @@ var modals = [ }, ]; - - function Rnd(item,fig) { if(varType(item) === "Array") { var arr = []; @@ -213,6 +210,7 @@ function updateMain(op) { // Updates the actual page. } function updateNav(op) { // Updates the sidebar navigation. + document.getElementById("headerTitle").textContent = navi.filter(function(val) { return val[2] === op })[0][1]; var oldNav = document.querySelectorAll("[option=" + navSelect + "]")[0]; var newNav = document.querySelectorAll("[option=" + op + "]")[0]; oldNav.style.backgroundColor = "rgba(0,0,0,0)"; @@ -287,7 +285,7 @@ function generateDropOp() { // For options that change based on data. var p2 = document.createElement("p"); var a = document.createElement("a"); p2.appendChild(document.createTextNode("Source: ")); - if(langInfo.source === null) { + if(langInfo.source === undefined) { p2.appendChild(document.createTextNode("N/A")); } else if(langInfo.source.length > 0) { a.href = langInfo.source; @@ -1051,6 +1049,8 @@ modals[4].submitClick = function() { ); }; + + getData(); homeCards(); createNav(); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index e9a1db9..84099c5 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -16,10 +16,11 @@ -
+

/'smi:ɹ̠ka:ɹ̠/

+

Update

From cf43afad742dcc1fe41655e0e81dfea8a384ae8e Mon Sep 17 00:00:00 2001 From: yamanq Date: Fri, 20 Apr 2018 12:54:11 -0400 Subject: [PATCH 64/80] expanded readme --- SmearcarDB/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SmearcarDB/README.md b/SmearcarDB/README.md index 492ec03..bf3944e 100644 --- a/SmearcarDB/README.md +++ b/SmearcarDB/README.md @@ -1 +1,2 @@ -# smearcar-db \ No newline at end of file +# smearcar-db +Smearcar-db is an online database which compares languages and the relative frequencies of their component phonemes. This information can be referenced through the provided sources. The database can be downloaded for further analysis using the "Database and Files" tab. This website is licensed under the GNU GPLv3 license and its source can be found at [Github](https://github.com/yamanq/smearcar-db'). From 2771995a0e00d382fdfc32484021b9216fb4b0e3 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 19:40:30 -0400 Subject: [PATCH 65/80] Source adding complete --- SmearcarDB/server.py | 11 +++- SmearcarDB/static/index.js | 127 +++++++++++++++++++++---------------- 2 files changed, 82 insertions(+), 56 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index d469528..94736a1 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -2,6 +2,7 @@ from flask import Flask from flask import render_template, jsonify, request from flask_sqlalchemy import SQLAlchemy import datetime +import os app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' @@ -160,10 +161,14 @@ def file_return(lang_id): @app.route("/source", methods=["POST"]) def source_add(): """Add or replace a source""" - if check_privelege(received['editor'], 2): + if check_privelege({ + "username": request.form["username"], + "password": request.form["password"] + }, 2): f = request.files['file'] - f.save("files/" + request.form['lang_id']) + f.save("files/"+request.form['lang_id']) return "nice" + return "Error" @@ -181,7 +186,7 @@ def backend(): received = request.get_json() if check_privelege(received['editor'], 2): - language = Language(name=received['name'], source=received['source']) + language = Language(name=received['name']) db.session.add(language) for phoneme, value in received['phonemes'].items(): diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index ff6ab01..caa2eb4 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -543,18 +543,6 @@ function modal(id, open) { } } -/*document.querySelectorAll("#addUser > div")[0].onclick = function(event) { - event.stopPropagation(); - for (var i = 0; i < document.getElementsByClassName("dropdown").length; i++) { - var opCont = document.querySelectorAll(".dropdown .opCont")[i]; - opCont.style.opacity = "0"; - setTimeout(function() { - opCont.style.display = "none"; - }, 300); - } -}*/ - - function generateModals() { while(document.getElementsByClassName("modal").length > 0) { document.getElementsByTagName("body")[0].removeChild(document.getElementsByClassName("modal")[0]); @@ -591,7 +579,6 @@ function generateModals() { if(form[j].inputType) input.type = form[j].inputType; if(form[j].height) input.style.height = form[j].height; - div.appendChild(p); div.appendChild(input); modalCont.appendChild(div); @@ -615,7 +602,6 @@ function generateModals() { overlay.appendChild(modalCont); document.getElementsByTagName("body")[0].appendChild(overlay); - console.log(modals[i].button); document.getElementById(modals[i].button).onclick = function() { if(eachModal.buttonClick) (eachModal.buttonClick)(); modal(eachModal.modal, true); @@ -657,26 +643,20 @@ modals[0].submitClick = function() { // submitClick for newLanguage. phonemes[info[i][0]] = num; } - var formData = new FormData(); var source = document.querySelectorAll("#newLanguageSource input")[0].files; - if(source.length === 0 || source[0].type) { + if(source.length === 0) { alert("Please give a source!"); submittable = true; return; } - formData.append("source", source[0]); - formData.append("name", name); - formData.append("phonemes", phonemes); - formData.append("editor", loginInfo); - + var newLanguage = { name: name, - source: sourceData, phonemes: phonemes, editor: loginInfo }; - var p = document.querySelectorAll("#newLanguageSubmit p ")[0] + var p = document.querySelectorAll("#newLanguageSubmit p")[0] p.innerText = "Processing..."; p.style.backgroundColor = "rgba(0,0,0,0.2)"; @@ -689,22 +669,40 @@ modals[0].submitClick = function() { // submitClick for newLanguage. }) .then( function success(incoming) { - document.getElementById("newLanguage").style.opacity = "0"; - setTimeout(function() { - document.getElementById("newLanguage").style.display = "none"; - submittable = true; - p.innerText = "Submit!"; - p.style.backgroundColor = "#FEFEFE"; - document.querySelectorAll("#newLanguageName input")[0].value = ""; - document.querySelectorAll("#newLanguagePhonemes textarea")[0].value = ""; - }, 300); - getData("add"); + }, function error(e) { alert("There was an error adding a language."); console.log(e); } - ); + ).done(function(incoming) { + var formData = new FormData(); + formData.append("file", source[0]); + formData.append("lang_id", data.values.length); + formData.append("username", newLanguage.editor.username); + formData.append("password", newLanguage.editor.password) + + $.ajax({ + url: serverURL + '/source', + type: 'POST', + data: formData, + contentType: false, + processData: false + }).then( + function success(incoming) { + document.getElementById("newLanguage").style.opacity = "0"; + setTimeout(function() { + document.getElementById("newLanguage").style.display = "none"; + submittable = true; + p.innerText = "Submit!"; + p.style.backgroundColor = "#FEFEFE"; + document.querySelectorAll("#newLanguageName input")[0].value = ""; + document.querySelectorAll("#newLanguagePhonemes textarea")[0].value = ""; + }, 300); + getData("add"); + } + ) + }); }; modals[1].submitClick= function() { // submitClick for editLanguage. @@ -725,7 +723,7 @@ modals[1].submitClick= function() { // submitClick for editLanguage. } info = info.split("\n"); var newPhonemes = {}; - console.log(info); + for(var i = 0; i < info.length; i++) { info[i] = info[i].split(/[ ,]+/); var num = parseFloat(info[i][1]); @@ -736,11 +734,9 @@ modals[1].submitClick= function() { // submitClick for editLanguage. } newPhonemes[info[i][0]] = num; } - console.log(newPhonemes); - var p = document.querySelectorAll("#editLanguageSubmit p")[0] - p.innerText = "Processing..."; - p.style.backgroundColor = "rgba(0,0,0,0.2)"; + + var source = document.querySelectorAll("#editLanguageSource input")[0].files; var oldPhoneset = new Set(Object.keys(langInfo.phonemes)); var newPhoneset = new Set(Object.keys(newPhonemes)); @@ -749,8 +745,6 @@ modals[1].submitClick= function() { // submitClick for editLanguage. var union = [...newPhoneset].filter(x=>oldPhoneset.has(x)); for(var i = 0; i < union.length; i++) { - console.log(langInfo.phonemes[union[i]]); - console.log(newPhonemes[union[i]]); if(newPhonemes[union[i]] === undefined) { diffRemove.push(union[i]); } else if(langInfo.phonemes[union[i]] !== newPhonemes[union[i]]) { @@ -763,14 +757,20 @@ modals[1].submitClick= function() { // submitClick for editLanguage. var todo = { name: name !== langInfo.name, add: diffChange.length > 0, - remove: diffRemove.length > 0 + remove: diffRemove.length > 0, + source: source.length !== 0 }; + console.log(todo); - if(!todo.name && !todo.add && !todo.remove) { + if(!todo.name && !todo.add && !todo.remove && !todo.source) { modal("editLanguage", false); return; } + var p = document.querySelectorAll("#editLanguageSubmit p")[0] + p.innerText = "Processing..."; + p.style.backgroundColor = "rgba(0,0,0,0.2)"; + var error = false; if(todo.name) { // Ajax requests for changing name. @@ -832,7 +832,7 @@ modals[1].submitClick= function() { // submitClick for editLanguage. }) .then( function success(incoming) { - if(todo.add && !todo.remove && this.counter === diffChange.length-1) { + if(todo.add && !todo.remove && !todo.source && this.counter === diffChange.length-1) { document.getElementById("editLanguage").style.opacity = "0"; setTimeout(function() { document.getElementById("editLanguage").style.display = "none"; @@ -856,14 +856,6 @@ modals[1].submitClick= function() { // submitClick for editLanguage. if(error) return; - console.log({ - action: "phoneme_remove", - data: { - language_id: langInfo.id, - phoneme_id: diffRemove[i] - } - }); - for(var i = 0; i < diffRemove.length; i++) { // Ajax requests for removing phoneme values. $.ajax({ url: serverURL + '/server', @@ -882,7 +874,7 @@ modals[1].submitClick= function() { // submitClick for editLanguage. }) .then( function success(incoming) { - if(this.counter === diffRemove.length-1) { + if(todo.remove && !todo.source && this.counter === diffRemove.length-1) { document.getElementById("editLanguage").style.opacity = "0"; setTimeout(function() { document.getElementById("editLanguage").style.display = "none"; @@ -903,6 +895,35 @@ modals[1].submitClick= function() { // submitClick for editLanguage. } ); } + + if(error) return; + if(todo.source) { + var formData = new FormData(); + formData.append("file", source[0]); + formData.append("lang_id", data.values.length); + formData.append("username", loginInfo.username); + formData.append("password", loginInfo.password) + $.ajax({ + url: serverURL + '/source', + type: 'POST', + data: formData, + contentType: false, + processData: false + }).then( + function success(incoming) { + document.getElementById("newLanguage").style.opacity = "0"; + setTimeout(function() { + document.getElementById("newLanguage").style.display = "none"; + submittable = true; + p.innerText = "Submit!"; + p.style.backgroundColor = "#FEFEFE"; + document.querySelectorAll("#newLanguageName input")[0].value = ""; + document.querySelectorAll("#newLanguagePhonemes textarea")[0].value = ""; + }, 300); + getData("edit"); + } + ) + } }; modals[2].submitClick = function() { // submitClick for login. From 3bf3988354842a38f726b6ca92e523d6b4630ef2 Mon Sep 17 00:00:00 2001 From: yamanq Date: Sat, 28 Apr 2018 21:48:37 -0400 Subject: [PATCH 66/80] fix files adding --- SmearcarDB/.gitignore | 1 + SmearcarDB/server.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/.gitignore b/SmearcarDB/.gitignore index fef690a..bab3343 100644 --- a/SmearcarDB/.gitignore +++ b/SmearcarDB/.gitignore @@ -114,3 +114,4 @@ venv.bak/ *.p *.txt *.db +files/ diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 94736a1..172487c 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -11,7 +11,7 @@ app.config.update( TEMPLATES_AUTO_RELOAD=True ) db = SQLAlchemy(app) - +working_dir = os.path.dirname(__file__) class Frequency(db.Model): language_id = db.Column(db.Integer, db.ForeignKey('language.id'), primary_key=True) @@ -166,7 +166,10 @@ def source_add(): "password": request.form["password"] }, 2): f = request.files['file'] - f.save("files/"+request.form['lang_id']) + write_path = os.path.join(working_dir, "files", request.form['lang_id']) + # with open(write_path, 'w') as a: + # a.write() + f.save(write_path) return "nice" return "Error" From 840fd4fb633b9be5582c8a283086321cd5af10d2 Mon Sep 17 00:00:00 2001 From: yamanq Date: Sat, 28 Apr 2018 22:39:38 -0400 Subject: [PATCH 67/80] bug fixes --- SmearcarDB/server.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 172487c..4ff2abc 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -82,13 +82,14 @@ def phoneme_add(info): # } phoneme = Phoneme.query.filter_by(name=info['phoneme']).first() language = Language.query.filter_by(id=info['language_id']).first() - if phoneme: - link = Frequency.query.filter_by( - language_id=language.id, - phoneme_id=phoneme.id).first() + link = Frequency.query.filter_by( + language_id=language.id, + phoneme_id=phoneme.id).first() + if phoneme and link: link.value = info['value'] else: - phoneme = Phoneme(name=info['phoneme']) + if not phoneme: + phoneme = Phoneme(name=info['phoneme']) link = Frequency(value=info['value']) link.phoneme = phoneme language.phonemes.append(link) From 737ef3c6fb86ea22a24ef4171dde78d46f8ddfcf Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 22:43:11 -0400 Subject: [PATCH 68/80] fixed editing language source --- SmearcarDB/static/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index caa2eb4..2732313 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -900,7 +900,7 @@ modals[1].submitClick= function() { // submitClick for editLanguage. if(todo.source) { var formData = new FormData(); formData.append("file", source[0]); - formData.append("lang_id", data.values.length); + formData.append("lang_id", langInfo.id); formData.append("username", loginInfo.username); formData.append("password", loginInfo.password) $.ajax({ From d8310ce45b84131b90a0264aa61513a0d31117c5 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 22:49:41 -0400 Subject: [PATCH 69/80] added source link --- SmearcarDB/static/index.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 2732313..4095950 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -282,18 +282,11 @@ function generateDropOp() { // For options that change based on data. while (info.firstChild) { info.removeChild(info.firstChild); } - var p2 = document.createElement("p"); var a = document.createElement("a"); - p2.appendChild(document.createTextNode("Source: ")); - if(langInfo.source === undefined) { - p2.appendChild(document.createTextNode("N/A")); - } else if(langInfo.source.length > 0) { - a.href = langInfo.source; - srcText = (langInfo.source.length > 60) ? langInfo.source.substring(0, 57) + "..." : langInfo.source; - a.appendChild(document.createTextNode(srcText)); - p2.appendChild(a); - } - info.appendChild(p2); + a.appendChild(document.createTextNode("Source")); + a.href = serverURL + "/server/" + langInfo.id; + a.setAttribute("target", "_blank"); + info.appendChild(a); // Generate data box material. From a2dc10db39ce0021ad4edb794a497ff0ea37bd4a Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 23:04:34 -0400 Subject: [PATCH 70/80] Added about and source download --- SmearcarDB/server.py | 3 ++- SmearcarDB/static/index.css | 2 +- SmearcarDB/templates/index.html | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 4ff2abc..e9689a4 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,6 +1,7 @@ from flask import Flask from flask import render_template, jsonify, request from flask_sqlalchemy import SQLAlchemy +from flask import send_file import datetime import os @@ -154,7 +155,7 @@ def initial(): @app.route("/server/", methods=["GET"]) def file_return(lang_id): try: - return send_file('source/' + lang_id) + return send_file('files/' + lang_id) except Exception as e: return str(e) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 4f5b711..a695080 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -217,7 +217,7 @@ a { } .card > p { - margin: 2vh 0 2vh 4vh; + margin: 2vh 2vh 2vh 4vh; font-size: 2.2vh; font-weight: 300; grid-column: 1 / 4; diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index 84099c5..f62c174 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -101,8 +101,9 @@
-
-

Currently in progress!

+
+

About

+

Smearcar-db is an online database which compares languages and the relative frequencies of their component phonemes. This information can be referenced through the provided sources. The database can be downloaded for further analysis using the "Database and Files" tab. This website is licensed under the GNU GPLv3 license and its source can be found at Github.

From a91204745eeb81958099480afd029cc15cb8b8d0 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 23:34:45 -0400 Subject: [PATCH 71/80] Added file extensions --- SmearcarDB/server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index e9689a4..b3fb68c 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -154,8 +154,9 @@ def initial(): # GET method for files @app.route("/server/", methods=["GET"]) def file_return(lang_id): + extensions = dict(x.split(".") for x in os.listdir("F:/Programming Projects/SmearcarDB/files")) try: - return send_file('files/' + lang_id) + return send_file('files/' + lang_id+"."+extensions[str(lang_id)]) except Exception as e: return str(e) @@ -168,7 +169,7 @@ def source_add(): "password": request.form["password"] }, 2): f = request.files['file'] - write_path = os.path.join(working_dir, "files", request.form['lang_id']) + write_path = os.path.join(working_dir, "files", request.form['lang_id']+"."+f.filename.split(".")[-1]) # with open(write_path, 'w') as a: # a.write() f.save(write_path) From 7f7baa5f88ea84f401dff10bb1e92dbc23f8402b Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Sat, 28 Apr 2018 23:37:28 -0400 Subject: [PATCH 72/80] changed listdir --- SmearcarDB/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index b3fb68c..32b7f4a 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -154,7 +154,7 @@ def initial(): # GET method for files @app.route("/server/", methods=["GET"]) def file_return(lang_id): - extensions = dict(x.split(".") for x in os.listdir("F:/Programming Projects/SmearcarDB/files")) + extensions = dict(x.split(".") for x in os.listdir("files/")) try: return send_file('files/' + lang_id+"."+extensions[str(lang_id)]) except Exception as e: From 61d0c3cb09273bb47fd17c224f549a3df97ee280 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Fri, 25 May 2018 19:30:45 -0400 Subject: [PATCH 73/80] add data analysis --- SmearcarDB/phoible | 2000 ++++++++++++++++++++++++++++++++++++++++++ SmearcarDB/server.py | 87 +- 2 files changed, 2079 insertions(+), 8 deletions(-) create mode 100644 SmearcarDB/phoible diff --git a/SmearcarDB/phoible b/SmearcarDB/phoible new file mode 100644 index 0000000..75a3590 --- /dev/null +++ b/SmearcarDB/phoible @@ -0,0 +1,2000 @@ +m +k +i +a +j +u +p +w +n +s +t +b +o +e +l +h +ɡ +ŋ +d +ɲ +f +t̠ʃ +ʔ +ɛ +ɔ +ʃ +r +z +ɾ +d̠ʒ +iː +v +aː +uː +˦ +˨ +t̪ +ts +ə +oː +eː +ĩ +ã +ũ +ɨ +x +d̪ +kʰ +ɡb +kp +n̪ +pʰ +ɪ +ʊ +kʷ +ʒ +õ +c +ɣ +ɓ +mb +ẽ +˧ +ɟ +ŋɡ +nd +β +tʰ +ɔː +ɛː +ɗ +o̞ +e̞ +l̪ +dz +ɛ̃ +s̪ +ɔ̃ +q +kʼ +ʈ +ɡʷ +ɖ +t̪ʰ +t̠ʃʰ +t̠ʃʼ +tʼ +˦˨ +ɸ +æ +pʼ +ɯ +ɨ̃ +n̠d̠ʒ +χ +ɑ +ʂ +˨˦ +ɽ +ɳ +cç +ɬ +ŋʷ +ç +ɟʝ +ʌ +ʎ +əː +ɭ +ð +tsʼ +tsʰ +ŋmɡb +ŋm +ɪ̃ +θ +y +ʊ̃ +kʲ +z̪ +ɦ +mː +ʊː +ũː +ʈʰ +ĩː +nː +ɪː +ə̃ +t̪s̪ +ɨː +xʷ +r̪ +õ̞ +˥ +kː +hʷ +qʼ +ʁ +lː +ãː +tʲ +ɡʲ +ai +mʷ +ŋɡʷ +ħ +ʈʂ +t̪ʼ +bʷ +b̤ +˩ +cʰ +ø +bː +˥˩ +ndz +sː +ẽ̞ +kʷʼ +ʝ +ʉ +ɑː +au +ɤ +pː +tː +nz +ɱv +ɡʰ +cçʰ +qʷ +n̠ +ɡː +m̥ +ʄ +qʰ +œ +pʲ +õː +mʲ +ɮ +fʷ +æː +ɥ +dʲ +ʕ +a̟ +jː +pʷ +χʷ +ɐ +ɹ +ŋk +d̪z̪ +ɖ̤ +d̪̤ +ɒ +ʐ +ɻ +nt +rː +ɘ +˩˥ +kʷʰ +bʲ +pf +*R̪ +dː +æ̃ +ɲː +ɲɟ +ẽː +t̪s̪ʰ +sʷ +n̥ +mp +n̪d̪ +tʷ +lʲ +ʋ +ɰ +ɯ̃ +ɾ̪ +o̞ː +wː +˨˧ +ɛ̃ː +j̰ +w̰ +ʍ +fː +ɔ̃ː +ɯː +ɢ +ŋː +˧˨ +ɺ +ɜ +ɑ̃ +hʲ +ɬ̪ +e̞ː +t̠ʃː +ʃː +nʲ +ʃʷ +ⱱ +ŋ̥ +ɕ +æ̞̃ +β̞ +l̥ +m̰ +ɟ̤ʝ +ɲ̥ +ia +ui +tɬʼ +t̠ʃʷ +t̪s̪ʼ +tɕ +cʼ +b̰ +a̰ +j̥ +ɣʷ +nʷ +sʲ +d̠ʒː +øː +yː +t̠ +bv +qʷʼ +ʔʷ +ḭ +zː +fʲ +m̤ +o̤ +ua +ʔʲ +ns +ʈʂʰ +ɡ̤ +ə̃ː +ɠ +n̠t̠ʃ +ɗ̪ +dʷ +lʷ +oi +ei +ṵ +o̰ +ḛ +w̃ +d̠ʒʷ +ɾʲ +ɱ +ɲʷ +e̤ +i̤ +l̤ +n̰ +ʔː +ʌ̃ +ʌː +ṳ +a̤ +˦˧ +uə +˥˦ +t̪ː +d̤ +m̩ +ɲ̟ +ou +ɔ̤ +t̪ʲ +zʷ +s̻ +ʁʷ +mbʷ +tɬ +sʼ +ɵ +ɟː +kǃ +vʲ +l̰ +jʷ +d̠ʒ̤ +ʈː +kʼː +rʲ +l̠ +ɔi +ʑ +dʑ +k̰ +p̰ +bʰ +kʼʲ +ɗː +u̞ +a̟ː +r̥ +n̩ +ie +ʀ +t̠ʃʼː +kǀ +ʏ +t̪ɬ̪ʼ +ɛ̤ +ɱf +t̰ +lˠ +ə̆ +ˀm +ˀj +hː +tʼː +ʒː +ɓ̥ +ɑ̃ː +n̪̥ +iə +l̪̥ +d̰ +rʷ +ɓː +ɵ̞ +d̪ː +ɒː +ˀn +ɯ̞ +ŋ̩ +xː +tɬʰ +ʈʂʼ +ɤ̞ +j̃ +œː +l̪ˠ +ɽ̤ +*R +n̪̰ +↓˦ +tsʷ +r̃ +N +ɤː +ɢʷ +qʷʰ +ʃʼ +ɖʐ +˩˨ +ˀw +˦˥ +˧˩ +qː +jˀ +ndʲ +ʃʲ +ᶑ +βʲ +ʉː +t̠ʃʲ +ɨ̃ː +n̪̤ +n̤ +ʒʷ +s̪ʲ +l̪ʲ +iu +vʷ +cː +dʰ +ʐ͇ +ɖː +uo +nts +pʼː +ã̟ +ɐː +pʲʰ +kǁ +ɒ̃ +zʲ +tsʲ +ie̞ +d̪ʲ +t̪ɬ̪ +ŋkʷ +əi +ɺ̠ +s̪ʼ +ŋǃ +kǃʰ +ŋɡʲ +kˀ +sˀ +qχ +ˀb +sʰ +˧˦ +ĭ +χː +sˤ +kʲʼ +ɗ̥ +ɤ̃ +ᴅ +cɕ +e̞i +l̪̰ +ɯa +ndʷ +kǀʰ +q̰ +t̠ʃ̰ +d̪ʰ +cʷ +wʲ +i̤ː +ã̰ +pˀ +t̠ʃʷʰ +n̻ +s̪ː +tsː +ˀl +ɔ̰ +nˀ +mˀ +ŭ +ă +ŋʲ +kʲʰ +t̻ +c̟ +æ̃ː +wˀ +ɸʲ +zˤ +lˤ +tˤ +dˤ +d̠ʒʲ +vː +n̪t̪ +ɯ̤ +d̠ +ɯə +l̃ +əu +o̞i +ɨi +n̪ʲ +ɡǃ +tr +dr +ɡǀ +ts̰ +mʰ +nʰ +ea +tɕʰ +ṳː +a̤ː +ɛ̤ː +ɔ̤ː +ḭ̃ +r̤ +iˑ +aˑ +uˑ +oˑ +t̠ʃˀ +t̠ʃʷʼ +e̞ˤ +t̻s̻ +dzː +ɛ̰ +u̥ +i̥ +ɘː +l̻ +ɳɖ +tx +t̪θʼ +t̪θ +kx +h̃ +t͉ +p͉ +k͉ +ʰt +ʰk +ɳɖʐ +ʕː +ħː +kʷː +iɛ +pfʰ +kxʰ +ø̞ +ɜ̃ +aˤ +ɮ̪ +t̪ɬ̪ʰ +mbʲ +kǀ͓ +ŋǀ͓ +d̪ɮ̪ +o̞u +ŋ̰ +kpʷ +ndr +n̠ʃ +↓ +ɲʒ +˦˨˦ +˨˦˨ +ŋmkp +dzʷ +d̠ʒʰ +d̃ +b̃ +oa +ao +eu +o̤ː +ɖʰ +e̝ +e̤ː +ŋǁ +kǁʰ +ŋǀ +ɲ̤ +eˑ +ɵ̞ː +k̟ +d̻ +t̻ʰ +z̻ +ɬʲ +r̠ +ˀɲ +ɪ̈ +ə˞ +ɴ +t̪θʰ +ʔˤ +xʼ +ɯ̃ː +ɤ̞̃ +t̠ʃ͉ +kʰː +t̠ʃʰː +tsʼː +ʰp +n̠ʒ +t̠ʃʲʰ +dˤː +zˤː +sˤː +tˤː +ɟʝʷ +kǂ +ɐ̃ +tʲʰ +ɽ̃ +ɾ̤ +dɮ +n̠d̠ +uˤ +t̪ˤ +kpʰ +ɨ̞ +ɛi +ao̞ +aɛ +ɤ̤ +t̪s̪ʲ +mpʰ +kǁ͓ +kǃ̠ +v̤ +ae̞ +d̪̰ +ɲ̰ +ɻʲ +βʷ +ɟʷ +ue +ɽʰ +ɠɓ +ʊ̤ +k̰ʷ +ae +ɑ̤ +ɡ̰ +ṵ̃ +aɪ +ʈʼ +ʰm +õ̰ +ð̞ +kpʲ +ps +ɥ̃ +ɾʷ +kǀʼ +ɡǁ +cçʼ +β̃ +w̤ +ë +tˀ +tsʷʰ +fʼ +d̻z̻ +qχʷ +ɮʲ +õ̞ː +ẽ̞ː +ˀd +a˞ +ɛ̆ +l̩ +r̩ +tːs +ɪ̃ː +ɬʼ +ɨ˞ +ʰt̠ʃ +ʌ̃ː +rˤ +çʷ +ɡ̤ʷ +d̪ð +e̯ +mʷˠ +ɡ̟ +ø̞ː +œ̃ +ʁ̞ +ɨ̆ +ɵ̞̆ +ɔ̆ +cçʷ +s̪ʷ +iˤ +ɬ̪ː +o̞ˤ +t̪s̪ʷʰ +t̪s̪ʷʼ +z̪ˤ +s̪ˤ +d̪ˤ +t̪s̪ː +ʕ̝ +z̪ʲ +t̪ˀ +cɕʰ +ɲc +ɴq +ŋkʰ +aɯ +ɺ̪ +e̞u +l̪̤ +ŋǃ̠ +ŋ̥ǀ͓ˀ +kǀ͓ʰ +ŋǁ͓ +t̪ʷ +ɳʈ +xʲ +e̞o̞ +ɯi +s̪ʰ +ɡǃx +ɡǂ +kǃx +ŋ̥ǃ +ɡ̤ǃ +æi +n̪d̪z̪ +ɟ̰ +r̪ʲ +*R̪̰ +iˠ +nsʷ +ntʷ +˦↓˦ +ndʑ +ʄ̥ +ɻʷ +kʰʷ +ö +tʲʼ +iaː +ʕʷ +lʼ +ŋɣ +nɡ +cʲ +ɟʲ +ja +q̰ʷ +oe +s̺ +c̰ +˧˦˧ +o̝ +bz +eo +ɯ̰ +ə̰ +tç +t̺ +ɡbʲ +ɡᶣ +ɖr +ʈr +kxʼ +ɟ̤ +ɵː +ᶑʼ +cʼː +nɗ +kǁʼ +kǃʼ +ɗʲ +i̞ +ɔ̝ +ï +r̠ʲ +t̪̰ +üː +c̤ +d̤z +ʰɾ +ḛ̃ +ø̞ˤ +t͈ +p͈ +k͈ +æˤ +t̻s̻ʼ +qχʷʼ +qχʼ +β̞ː +ˀr +ˀŋ +˩̰ +˨˩ +˧˥ +˧˨˥ +b̤̥ +tz̤̥ +˥˧˥ +ɡ̤̥ +d̤̥ +z̞̩ +k̟ʰ +˥̰ +ɾˀ +ĕ +ŋ̥ʲ +ʂ͇ +ɲ̩ +ɡɣ +ʎ̟ +ɸʷ +ɬː +s̻ː +dl +ʃ͈ː +k͈ː +s͈ː +t͈ː +ɤ̞ː +ʊ̃ː +ɸʼ +ʰkʷ +çʲ +ɺʲ +bˀ +dˀ +kˤ +ɪ̈ː +ʊ̈ +sʼː +ʁː +ħʷ +l̪ː +ɾˤ +lˤː +ʃ͉ +s͉ +uɔ +b̤ʲ +o̯ +l̥ˠ +bʷˠ +ɾˠ +nˠ +n̥ʲ +n̥ˠ +ɸʷˠ +pʷˠʰ +l̥ʲ +ə̯ +ɾ̥ʲ +ɾ̥ˠ +ʃˠ +ʒˠ +ʒʲ +ʈʰː +pʰː +n̪ː +t̪ʰː +ɟʝː +cçː +ĕ̞ +ɒ̆ +ŏ̞ +z͇ +ʊ̙ +ʊ̙ː +ɪ̙ +ɔˤ +ɪˤ +ʊˤ +ɹ̪ +ʃʷː +ʁʷˤ +qχʼː +t̪s̪ʼː +χʷˤ +χʷː +χˤ +ʁˤ +ɤ̟ +ɯ͓ +ɞ +ʌ̤ +ɒ̤ +ɘ̃ +z͇̪ +n̠̥ +ỹ +ɬ̪ʲ +n̪t̪ʰ +n̪t̪s̪ +ɳʈʂ +ŋ̥ʷ +nr +aɨ +kǃ̠ʰ +ŋ̥ǁ͓ˀ +ŋ̥ǃ̠ˀ +kǁ͓ʰ +ɭ̥ +ɡbʷ +ɔ̃ĩ +ŋkʲ +t̪ɦ +pɦ +kɦ +ɣʲ +ʊi +e̠ +õ̞ĩ +ũĩ +ɨa +ɜː +ɟʑ +aˤː +ɡʼ +ãˤ +ɡǀ͓ +dʼ +tˠ +dˠ +ɡǂx +d̠ʒʼ +o̞a +kǂʰ +ŋ̤ǃ +dz̤ +ẽ̞ĩ +ŋ̥ǀ͓ʰ +ŋǂ +ŋ̥ǃˀ +kǂx +b̪ +ts͇ +ɲɟʑ +n̪ʷ +ɨə +ŋ̤ +kʷˀ +ɰ̰ +ɬ̪ʼ +ɓʲ +uʌ +n̪z̪ +ðʲ +nzʷ +n̠d̠ʒʷ +˨˦˧ +ɡv +kf +ɠ̥ +ɗʒ +eˠ +nh +nl +r̝ +˨˥˩ +dʲʷ +tʰʷ +cʷʰ +uaː +mʼ +nʼ +wʰ +ɾʰ +ɗʰ +ˀp +ɾ̥ +ɟʰ +dzʰ +k̃ +ɡ̃ +ntʰ +ṽ +nɟ +ju +wə +ʉ̃ +æ̤ː +æ̤ +ɵ̤ +ʊ̤ː +ay +vʰ +s̰ +iã +ʌi +lʰ +ʊa +w̥ +ts̪ +uai +iau +˧˨˧ +ɔu +ⱱ̟ +wa +aʊ +io +ɥ̥ +ʊu +ʊɪ +ɔɪ +ɲj +ʰn̪ +ɛə +iɔ +ɑi +ɡbː +kpː +ə̰̃ +t̪s +ɲʰ +uj +aj +aw +t̪n̪ +tn +pm +kŋ +ʈɳ +tl +nd̪ +eɪ +˥˧ +tɕᶣ +ɕᶣ +sᶣ +dʑᶣ +ɲᶣ +ʙ +ɦʷ +i̤ˑ +ɔ̤ˑ +ṳˑ +e̤ˑ +a̤ˑ +ɛ̤ˑ +ɗʷ +ɓʷ +m̤b̤ +n̤d̤ɮ̤ +ɦ̤ +mbv +n̤d̤ +ntsʼ +n̠t̠ʃʼ +z̤ +ɪ̤ +kᶣ +mɓ +dx +kǁxʼ +ɡǁx +kǁx +kʘ +ɡǀx +kǀx +kǃxʼ +kǀxʼ +oˤ +bβ +tɾ +dɾ +ndɾ +u̞ː +ɔ̝ː +ɛ̝ː +i̞ː +ɛ̝ +mpʲ +ɡʲʷ +lˀ +u̜ +i̜ +ə̤ +k̙ +ë̞ +ä +ɽ̩ +l̠˞ +ʰw +ʰn +aʲ +ʰd +t͈sʷ +x͈ +k͈ʷ +s͈ +ʃ͈ +χ͈ +t͈s +x͈ʷ +tsʷʼ +t̠͈ʃʷ +q͈ +q͈ʷ +χ͈ʷ +ʃ͈ʷ +t̠͈ʃ +k̟ʲʼ +ʝ̟ +x̟ʲ +ɬʲʼ +ɡ̟ʲ +k̟ʲʰ +t̻ʼ +ɣ̟ʲ +ç̟ +ɭː +ˀɖ +ˀɡ +ˀd̠ʒ +ɪ̯ +ʊ̯ +ei̙ +əɨ̙ +o̘ː +ou̙ +ɛ̘ː +a̟̙ː +ə̘ː +e̘ː +ɔ̘ː +ʌ̯ +˨˩̤ +˦˥̰ +ə̃˞ +a̟˞ +u˞ +ɑ̃˞ +ɤ˞ +w˞ +ə̟ +ŋɡ̟ +˧˩̰ +˧˨ˤ +oũ +eĩ +ŋˀ +˧˨̤ +ŭ̃ +ã̆ +˨˧˩ +ɛ̆̃ +iẽ +ŏ̃ +ʈr̥̠ +ɳʈr̠̥ +ɖr̠ +ɳɖr̠ +d̠͈ʒ +d͈ +b͈ +d̪̤̥ +m̥ʷ +ɲ̟ʝ̟ +ɶ̝ +ɴː +kxʷ +t̻s̻ʰ +p͈ː +t̠͈ʃː +l̻̰ +t͉s +s̻θ +t̠ːʃ +ɬ̻ +xh +kʷʼː +kʷʰː +tsʰː +ã̟ː +ɯ̆ +oːu +y̆ +ʰts +ʰq +ʈ͉ +ɺː +˦˩ +z̞̩̃ˠ +z̞̩ˠ +r͈ː +ɡ͈ː +d͈ː +b͈ː +z͈ː +ʒ͈ː +x͈ː +f͈ː +n͈ː +ħ͈ː +ɣ͈ː +l͈ː +m͈ː +ɪ̠ +ɜɪ̯ +ʊ̈ː +ᶑː +ɢː +ðˤ +mˤ +bˤː +fʷː +z̪ː +bʷː +bˤ +mʷː +rˤː +mˤː +f͉ +d̩ +ŋ̩ʷ +b̩ +ɣ̩ +z̩ +ɡ̩ +v̩ +ɡb̩ +ɡ̩ʷ +cçʷʰ +kʟ̥͓ʼ +ˀd̪ +ˀo̯ +ɤ̯ +ɯ̞̯ +ɸ̃ +ŋˑ +ɹ̩ +ɭ̩ +l̪̩ +ð͉ +ɔ̯ +ɛ̯ +n̻ʲ +d̻ʲ +t̻ʲ +t̻ː +n̻ː +d̻ː +t̻ʰː +l̻ː +ʋː +æẽ̯ +ɔo̯ +d̪̤ː +ɡ̤ː +æe̯ +ɔõ̯ +ɖ̤ː +d̠ʒ̤ː +b̤ː +ə̥ +p͉ʲ +t͉ʲ +ioː +iæ +i̙ː +çː +pfʼ +ɡⁿ +dⁿ +d̠ⁿ +bⁿ +d̪ⁿ +ɖⁿ +ɐˤ +ɜi +s̪ʷː +d̪ʷ +qχʷˤʼ +χˤː +t̪ɬ̪ʷʰ +t̪ɬ̪ʷʼ +qχˤ +ɬ̪ʷ +z̪ʷ +qχˤː +χʷˤː +ɬ̪ʷː +qχˤʼ +t̪ʷʰ +qχʷˤ +ʈʂ͇ +kxʼː +qχː +t̪ɬ̪ʼː +t̪ɬ̪ː +kxː +n̪s̪ +*Rʲ +ɛo̞ +ɛ̃ɔ̃ +ɑ̃ɔ̃ +ɬʟ̥͓ +t̪s̪ˀ +kɬ +ɯ̤ə̤ +*R̪̥ +i̤ə̤ +ṳə̤ +t̪ˠʰ +kxʷʰ +ø̆ +n̪d̪ʲ +t̪ʲʰ +r̠̙ +n̠t̠ʃʰ +ɳʈʂʰ +ɴqʰ +n̪t̪s̪ʰ +ɛɯ +ɗ̠ +ɡˡ +ɹ̪̥ +ia̟ +ɾ̠ +i͓ +u͓ +ŏ +ɲcɕ +əɯ +r͓̪ +j̟ +ɳ̥ +ŋ̥m̥ +ɾ̪ʲ +ḁ +o̞̥ +e̞̥ +ãĩ +ɨ̃ĩ +ʛ̥ +n̠t̠ +tɦ +tsɦ +ɾ̰ +tsˀ +ɘ̃ː +ʃ͇ +ʒ͇ +ɬ̪ʲʼ +ɮ̪ʲ +o̟ +e̞ə +a̟i +ã̟ĩ +d̪l̪ +ɕʼ +ʂʼ +ᴅ̪̰ +ᴅ̪ +s̪ˀ +ɐ̹̆ +ɐ̆ +ʉ̆ +bʼ +ŋ̥ǂˀ +ãẽ̞ˤ +dzʼ +ao̞ˤ +ŋ̥ǀ͓xˀ +ŋ̥ǂʰ +dzˠ +ŋ̥ǃˠˀ +kǀ͓x +tsˠ +o̞ˤː +ae̞ˤ +ŋˤ +ŋǂ͓ˡ +o̞iˤ +ŋ̥ǂxˀ +õ̞ã +õ̞ˤ +ɡ̰ǃx +ɡ̰ǀ͓x +ãˤː +ɡ̤ǂ͓ˡ +õ̞ãˤ +ɡǂ͓ˡ +ẽ̞ũ +kǂ͓ˡʰ +ŋ̤ǀ͓ +t̠ʃˠ +d̠ʒˠ +o̞e̞ +õ̞ĩˤ +ɡ̰ǂ͓ˡx +ŋ̥ǂ͓ˡxˀ +ŋ̤ǂ +ɡǀ͓x +ɔ̃ˤː +ŋ̥ǂ͓ˡʰ +ɡǂ͓ˡx +ɡ̰ǂx +ɡ̤ǂ +ŋ̥ǂ͓ˡˀ +ãõ̞ˤ +ɡ̤ǀ͓ +kǂ͓ˡ +kǂ͓ˡx +o̞aˤ +ŋ̤ǂ͓ˡ +ĩẽ̞ +xʷː +t̪s̪ʷː +qʷː +t̠ʃʷː +ø̠ +õ̞ũ +õ̞̰ +ḭ̃ +ã̰ +ẽ̞̰ +e̞̰ +o̞̰ +ɺ̠̰ +hˀ +kǃxʰ +kǀ͓ˠʰ +ŋ̥ǃ̠ʰ +kǃ̠xʰ +kǁ͓xʰ +ŋ̥ǁ͓ʰ +ɸ̞ +d̪z̪̤ +t̠ʰ +ɪe̞ +ɭ͓ +ɔy +øy +æʉ +ɒ̝ +ʊ̆ +ɪ̆ +ɯ̞̆ +ʰs̪ +ʰʃ +d̠̰ +ɖr̠͓ +ʈɹ̠̥ +a̤ṳ +ɯ̤i̤ +l̠̤ +ʒ̤ +i̤a̤ +n̠̤ +ɤ̤i̤ +ṳi̤ +i̤ɛ̤ +ɔ̤i̤ +ɤi +a̤ɯ̤ +a̤i̤ +o̤i̤ +i̤ṳ +io̞ +ṳa̤ +e̞a +ɢʷˤ +qˤʰ +qˤʼ +qʷˤʼ +qʷˤʰ +ɢˤ +kǀ͓ˀ +ɡǁ͓ +kǁ͓ˀ +ɡǃ̠ +kǃ̠ˀ +yø̞ +r̪̰ +r̪̥ +r̪ˤ +l̪ˤ +ʁ̞̰ʷ +qʷˀ +t̪ɬ̪ˀ +qˀ +ʁ̞ʷ +ɨ̞̃ +d̪z̪ʲ +β̞ʲ +ʈˀ +ɖ̰ +ʉ̞ +ɑ̝ +ĩˠ +n̪d̪ʷ +ɣ̰ +ts͇ʰ +cɕʼ +χʼ +χʷʼ +xʷʼ +ɾ͓ +uˤː +iˤː +ɲɟʝ +β̞ˠ +ɵ̃ +ɯʌ +iʌ +ʐ̰ +ʟ̥͓ +e̞̠ +o̞̟ +t̪s̪ɦ +ʟ +r̪ˠ +ʔ̬ +ɤ̞̟̃ +kʟ̥ʼ +kǃ͓ +ɣː +ɱfʷ +n̠ʃʷ +˨˧˨ +↓˦˨ +mv +lʔ +nð +ŋmˤ +ɡbˤ +kpˤ +ɠ̥ʷ +ɠ̥ʲ +aˠ +ɪˠ +ɛˠ +fʰ +ẅ +ɣv +a̠ː +a̠ +ɕː +ʑː +pˤ +wˤ +jˤ +kǀ̪ +kǀʷ +kǃ̪ +tsʰʷ +kǀʰʷ +rʰ +ü +ʕʼ +yʼ +wʼ +ɹˤ +ʕʷʼ +ɹ̰ˤ +jʰ +ˀt +ŋb +kʰʲ +ɲcʲ +ˀɗ +ˀɟ +dz̃ +p̃ +t̃ +pʰʷ +b̃ʷ +k̃ʷ +z̃ +m̃ʷ +jɔ +eə +oe̞ +ʡ +ɵ̤ː +n̥ʃ +n̠̥t̠ʃ +ɱ̥f +b̻ +k̻ +p̻ +t̺s̺ +o˞ +r̺ +n̺ +uẽ +ɳʰ +ɪa +ɪʌ +æe +ɪã +ʊe +ṳa +ɯ̤ː +i̤a +ɤ̤ː +ʌ̤ː +ɑ̤ː +ɯ̤a +ʕ̰ʷ +ʕ̰ +r̰ +pʃʼ +pʃʰ +fʃ +pʷˠː +pʷˠ +mʷˠː +ɻː +ɟ̩̰ +f̰ +θ̰ +ɹ̝ +t̰s̰ +uei +t̠ʃ̺ʰ +iou +ye +ʃ̺ +ɔɛ +dzʲ +ɛɪ +ɛj +œy +ˀj̰ +ˀw̰ +oi̯ +wei̯ +au̯ +wai̯ +jau̯ +ai̯ +jai̯ +ei̯ +we +ou̯ +jeu̯ +wo +wi +jo +ui̯ +je +eu̯ +ld +n͉ +eˀ +l͉ +aˀ +m͉ +ʂ͉ +oˀ +iˀ +uˀ +k͉ʷ +˦ː +˨ː +ɐu +ɐi +w̞ +ɛʊ +ʰɾ̪ +ʎ̥ +ũə +ɔə +ɛ̃ə +ĩə +ãi +ɯ̃ə +ʌə +uɨ +iɨ +zˠ +ɾ̪ˠ +ðˠ +æu +ɪi +mˠ +sˠ +ieː +iɛː +˦˥˦ +tɬ̰ +ʉi +ɫ +ɨ̥ +ɛ̰̃ +ˀl̪̥ +ˀq +ˀt̪ +ˀn̪̥ +ˀw̥ +ˀt̪ɬ +ˀt̪s +ˀj̥ +ˀm̥ +ˀkʷ +ɑʊ +æɪ +ʎʼ +ʎʰ +ɲʼ +ŋʷː +ej +ɛw +jɛ +ow +ɛu +ɛ̙ː +a̙ˠ +ɔ̙ +ɛ̙ˠ +ɔ̙ː +a̙ː +ɛ̙ +ɪ̙ˠ +ɪ̙ː +a̙ +oj +ɡɦ +lɦ +nɦ +ɟɦ +bɦ +mɦ +ɖɦ +d̪ɦ +ɳɦ +ʉ̟ +ɧ +tʰʲ +dz̪ +tçʰ +cɲ +ʊɔ +ɪɛ +ɲʄ +ɑ̃ĩ +ɑ̃õ +ẽĩ +ɑu +ɑe +õũ +ɑo +z̥ +ɣ̥ +x̥ +ɴɢ +oʊ +aɔ +eɔ +iʊ +uɛ +oɛ +oɪ +eʊ +uɪ +˥˧̰ +˧˩̤ +a̰ḭ +a̰ṵ +˨˥ +u̙ +o̙ +o̘ +u̘ +e̘ +i̙ +i̘ +e̙ +t̠n̠ +ʃʰ +mw +ʑᶣ +lᶣ +ŋmʲ +br +ŋɡː +mbː +ndː +ʔʲː +t̠ʃʱ +wʱ +tʱ +tʷʰ +pkʰ +bɡ +pʱ +kʷʱ +tsʱ +eʲ +↓˦↓˦ +sʲʷ +a̰ˑ +o̰ː +o̰ˑ +ḭː +ɛ̰ː +ɛ̰ˑ +ɔ̰ˑ +ɔ̰ː +ḛˑ +ḛː +o̤ˑ +a̰ː +ḭˑ +l̥ː +ɱð +uːʌ +iːɛ +iːe +uːa +ɰ̃ +ɤ̃ː +d̤z̤ +mbz +psʰ +tlʰ +n̠̩d̠ʒ +d̤ʒ̤ +d̤ɮ̤ +ŋ̤ɡǃ +b̤z̤ +n̤ɡ̤ +ndl +b̤v̤ +ntʼ +ɡ̤ǁ +ŋ̤ǀ +n̤d̤z̤ +d̠̤ʒ̤ +ŋǃʼ +mpʼ +ŋǁʼ +ɮ̤ +ŋ̤ǁ +n̠̤d̠̤ʒ +mpfʼ +ntlʼ +ɲ̤ɟ̤ +ɲcʼ +m̤b̤v̤ +ɣ̤ +ɡ̤ǀ +ŋkʼ +ŋ̤ɡ̤ +l̪ʷ +ɳɖr +jʔ +y̤ +œ̤ +rᶣ +e̥ː +m̪ +e̥ +p̪ +ᶑʼː +n̠t̠ʃʷ +nˤ +nˤː +rʼː +lʼː +rʼ +ɡɓ +ˀy +ʔw +dʼkxʼ +d̪ʼkxʼ +eˤ +ɢʰ +kʘxʼ +ɢʘ +ɡǂqʰ +ŋʘ +ɡǀkxʼ +qǀʼ +qʘ +qǀʰ +ˀnʘ +ŋ̥ʘ +ɴɢǀqʰ +kǂxʼ +ɡǃkxʼ +ɡʘqʰ +ɡǀqʰ +o̰ʰ +qʘʰ +ɡǂkxʼ +ŋ̥ǀ +qʘʼ +pʼkxʼ +d̪x +tʼkxʼ +ɴɢǁqʰ +ṵʰ +qǂʰ +qǂʼ +ɡǃqʰ +ɡʘkxʼ +ɡǁkxʼ +t̪ʼkxʼ +ɡǁqʰ +kʘʼ +kǂʼ +kʘʰ +ɴɢǃqʰ +qǁʰ +qǁʼ +ɡʘx +ɢǀ +ɢǁ +ɢǂ +ɢǃ +ɡʘ +a̰ʰ +t̪x +ɡʼkxʼ +qǃʰ +ˀnǁ +ˀnǀ +ˀnǃ +ˀnǂ +ŋ̥ǂ +ŋ̥ǁ +qǃʼ +qǁ +qǀ +qǃ +qǂ +kʘx +ŋǃǃʰ +kǃǃʼ +kǃǃʰ +qm +kǃǃ +ɡǀxʼ +ɡǃǃʰ +kǃǃx +d̠ʒxʼ +kǁʼʰ +õˤ +ɡǃʰ +ɡǃxʼ +qn +ʼŋǃ +ʼŋǀ +ɡǃǃxʼ +ŋǀʰ +ʼn +ʼm +kǃǃxʼ +kǀʰʼ +tʰʼ +ŋǃʰ +kǃǃʰʼ +ɡǀʰ +ɡǃǃ +ũˤ +ɡǃǃx +t̠ʃx +kǃʰʼ +ɡǁxʼ +ŋǃǃ +pɸ +ŋʰ +nθ +˥˨˧ +˧˥˨ +ɒ̃ː +t̪ʃ +ɪ̝ +øɘ +eɘ +œu +œi +oɘ +ɘi +ɪ̝ː +hʼ +b͉ +ˀb͉ +q̚ +ɡbr +kpr +ðː +ʈɽ +ɳɖɽ +ɖɽ +r̪ː +ɸː +ɸʰ diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 32b7f4a..b9463bd 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -1,6 +1,11 @@ from flask import Flask from flask import render_template, jsonify, request from flask_sqlalchemy import SQLAlchemy +from numpy.polynomial.polynomial import polyfit +from numpy import corrcoef +import numpy as np +import tkinter +import matplotlib.pyplot as plt from flask import send_file import datetime import os @@ -41,7 +46,6 @@ class Update(db.Model): date = db.Column(db.DateTime, nullable=False, default=datetime.datetime.now()) - class Editor(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) authority = db.Column(db.Integer, nullable=False, default=1) @@ -49,10 +53,76 @@ class Editor(db.Model): # 1: Below + create Updates # 2: Edit values and Add files # 3: No Access - username = db.Column(db.String(32), nullable=False) password = db.Column(db.String(32), nullable=False) +def rand_jitter(arr): + stdev = .01*(max(arr)-min(arr)) + return arr + np.random.randn(len(arr)) * stdev + +def uniqueness(): + x = [] + y = [] + languages = Language.query.all() + for phoneme in Phoneme.query.all(): + frequencies = Frequency.query.filter_by(phoneme_id=phoneme.id).all() + values = [x.value for x in frequencies] + x.append(len(frequencies) / len(languages)) + y.append(sum(values) / len(frequencies)) + print(corrcoef(x, y)) + b, m = polyfit(x, y, 1) + plt.scatter(rand_jitter(x), y, s=7) + bestfit = [b + m * number for number in x] + plt.plot(x, bestfit, '-') + plt.xlabel("Phoneme Presence in Studied Languages") + plt.ylabel("Average Frequency / %") + plt.title("Figure 1") + plt.show() + +def phoneme_rank(scatter=False, detail=1000, textOutput=False, title="Figure 2"): + speakers = { + 'Spanish (Castillian)': 46.4, + 'English (American)': 308.9, + 'Spanish (American)': 435.7, + 'Japanese': 128, + 'German': 76, + 'Arabic': 315, + 'Mandarin': 909, + 'Portuguese (Brazilian)': 194, + 'French': 76.8, + 'Hindi': 260, + 'Polish': 40.3, + 'Samoan': 0.40742, + 'Kaiwa': 0.0021, + 'Bengali': 243, + 'Swedish': 12.8, + 'Malay': 60.7, + 'Italian': 64.8 + } + total = sum(list(speakers.values())) + calculation = sorted([(phoneme.name, sum([frequency.value * speakers[Language.query.filter_by(id=frequency.language_id).first().name] / total for frequency in Frequency.query.filter_by(phoneme_id=phoneme.id).all()])) for phoneme in Phoneme.query.limit(detail).all()], key=lambda x:-x[1]) + labels, data = zip(*calculation) + + if textOutput: + return labels + + if scatter: + plt.yscale("log") + plt.plot(range(len(data)), data) + else: + plt.bar(range(len(data)), data) + + plt.xlabel("Phoneme Rank") + plt.ylabel("Frequency weighted by Number of Speakers / %") + plt.title(title) + plt.show() + +def phoible_compare(): + # lang_id = Language.query.filter_by(name=lang).first().id + with open("phoible", "r") as f: + phoible = f.read().splitlines() + phonemes = [phoneme.name for phoneme in Phoneme.query.all()] + return [x for x in phoible if x in phonemes] def database(): final = {'values': []} @@ -83,18 +153,19 @@ def phoneme_add(info): # } phoneme = Phoneme.query.filter_by(name=info['phoneme']).first() language = Language.query.filter_by(id=info['language_id']).first() + if not phoneme: + phoneme = Phoneme(name=info['phoneme']) + db.session.add(phoneme) link = Frequency.query.filter_by( language_id=language.id, phoneme_id=phoneme.id).first() - if phoneme and link: - link.value = info['value'] - else: - if not phoneme: - phoneme = Phoneme(name=info['phoneme']) + if not link: link = Frequency(value=info['value']) link.phoneme = phoneme language.phonemes.append(link) - db.session.add_all([phoneme, link]) + db.session.add(link) + else: + link.value = info['value'] def phoneme_remove(info): From 43373de921ce2175f62a48680e7415708cc3bcbc Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 27 May 2018 01:33:07 -0400 Subject: [PATCH 74/80] fix duplicate language names in phoneme_rank calculation --- SmearcarDB/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index b9463bd..423fdc9 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -100,9 +100,8 @@ def phoneme_rank(scatter=False, detail=1000, textOutput=False, title="Figure 2") 'Italian': 64.8 } total = sum(list(speakers.values())) - calculation = sorted([(phoneme.name, sum([frequency.value * speakers[Language.query.filter_by(id=frequency.language_id).first().name] / total for frequency in Frequency.query.filter_by(phoneme_id=phoneme.id).all()])) for phoneme in Phoneme.query.limit(detail).all()], key=lambda x:-x[1]) + calculation = sorted([(phoneme.name, sum([frequency.value * speakers[Language.query.filter_by(id=frequency.language_id).first().name] / (total * len(Language.query.filter_by(name=Language.query.filter_by(id=frequency.language_id).first().name).all()) ) for frequency in Frequency.query.filter_by(phoneme_id=phoneme.id).all()])) for phoneme in Phoneme.query.limit(detail).all()], key=lambda x:-x[1]) labels, data = zip(*calculation) - if textOutput: return labels @@ -124,6 +123,12 @@ def phoible_compare(): phonemes = [phoneme.name for phoneme in Phoneme.query.all()] return [x for x in phoible if x in phonemes] +def rank_compare(): + phoible = phoible_compare() + original = phoneme_rank(textOutput=True) + + + def database(): final = {'values': []} final['languages'] = [f.name for f in Language.query.order_by(Language.name).all()] From 225627bffda50d21c641b82962fab92e6b0beb8f Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Sun, 27 May 2018 01:55:30 -0400 Subject: [PATCH 75/80] add rank comparison --- SmearcarDB/server.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 423fdc9..d89ee8d 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -9,6 +9,7 @@ import matplotlib.pyplot as plt from flask import send_file import datetime import os +from scipy import stats app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' @@ -60,7 +61,7 @@ def rand_jitter(arr): stdev = .01*(max(arr)-min(arr)) return arr + np.random.randn(len(arr)) * stdev -def uniqueness(): +def uniqueness(title="Figure 1"): x = [] y = [] languages = Language.query.all() @@ -76,7 +77,7 @@ def uniqueness(): plt.plot(x, bestfit, '-') plt.xlabel("Phoneme Presence in Studied Languages") plt.ylabel("Average Frequency / %") - plt.title("Figure 1") + plt.title(title) plt.show() def phoneme_rank(scatter=False, detail=1000, textOutput=False, title="Figure 2"): @@ -123,10 +124,20 @@ def phoible_compare(): phonemes = [phoneme.name for phoneme in Phoneme.query.all()] return [x for x in phoible if x in phonemes] -def rank_compare(): +def rank_compare(textOutput=True, title="Rank Comparison"): phoible = phoible_compare() original = phoneme_rank(textOutput=True) - + phoible_ranks = list(range(len(phoible)+1))[1:] + original_ranks = [original.index(phoneme) + 1 for phoneme in phoible] + if textOutput: + return {"kendall": stats.kendalltau(phoible_ranks, original_ranks), + "spearman": stats.spearmanr(phoible_ranks, original_ranks), + "wilcoxon": stats.wilcoxon(phoible_ranks, original_ranks, zero_method="pratt")} + plt.scatter(phoible_ranks, original_ranks) + plt.xlabel("Phoible Rank") + plt.ylabel("Weighted Rank") + plt.title(title) + plt.show() def database(): From 5b314ddac48de08a8007fc75850bc019225d611c Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Tue, 29 May 2018 00:16:19 -0400 Subject: [PATCH 76/80] remove unnecessary list conversion --- SmearcarDB/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index d89ee8d..18037eb 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -100,7 +100,7 @@ def phoneme_rank(scatter=False, detail=1000, textOutput=False, title="Figure 2") 'Malay': 60.7, 'Italian': 64.8 } - total = sum(list(speakers.values())) + total = sum(speakers.values()) calculation = sorted([(phoneme.name, sum([frequency.value * speakers[Language.query.filter_by(id=frequency.language_id).first().name] / (total * len(Language.query.filter_by(name=Language.query.filter_by(id=frequency.language_id).first().name).all()) ) for frequency in Frequency.query.filter_by(phoneme_id=phoneme.id).all()])) for phoneme in Phoneme.query.limit(detail).all()], key=lambda x:-x[1]) labels, data = zip(*calculation) if textOutput: From 7abb32fcb632ff4f64b9224e0b06dfe71b335edc Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Wed, 30 May 2018 00:27:36 -0400 Subject: [PATCH 77/80] Added phoneme view --- SmearcarDB/static/index.css | 34 +++++------ SmearcarDB/static/index.js | 101 +++++++++++++++++++++++++++++--- SmearcarDB/templates/index.html | 26 ++++---- 3 files changed, 124 insertions(+), 37 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index a695080..b5f6954 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -239,27 +239,27 @@ a { height: 20%; } -#dataValues1 #dataTable, #dataValues2 .row { +#dataValues1 #dataTable, #dataValues2 #dataTable2 { height: 42%; } -#dataTable { +#dataTable, #dataTable2 { grid-template-columns: 90fr 10fr; } -#langSelect { +#langSelect, #phonemeSelect { grid-column: 1; grid-row: 1 } -#langSelect .dropdown { +#langSelect .dropdown, #phonemeSelect .dropdown { height: 50%; width: 85%; margin: auto 0 auto 5%; } -#flipMode { +#flipMode1, #flipMode2 { grid-column: 4; grid-row: 1; cursor: pointer; @@ -270,11 +270,11 @@ a { background-color: rgba(0, 0, 0, 0); } -#flipMode:hover { +#flipMode1:hover, #flipMode2:hover { background-color: rgba(0, 0, 0, 0.05); } -#flipMode p { +#flipMode1 p, #flipMode2 p { font-size: 2vh; margin: auto 0 auto auto; vertical-align: middle; @@ -284,27 +284,27 @@ a { pointer-events: none; } -#flipMode .fa { - margin: auto; +#flipMode1 .fa, #flipMode2 .fa { + margin: auto auto auto 30%; font-size: 3vh; grid-column: 2; grid-row: 1; pointer-events: none; } -#dataInfo { +#dataInfo, #dataInfo2 { grid-column: 2; grid-row: 1; } -#langInfoCont { +#langInfoCont, #phonemeInfoCont { display: grid; font-weight: 300; font-size: 2.5vh; margin: auto 0 auto 4vh; } -#dataTableCont { +#dataTableCont, #dataTableCont2 { display: grid; font-weight: 300; grid-template-columns: repeat(4, 1fr); @@ -313,18 +313,18 @@ a { padding: 2vh; } -#dataTableCont div { +#dataTableCont div, #dataTableCont2 div { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(8, 1fr); } -#dataTableCont div p { +#dataTableCont div p, #dataTableCont2 div p { font-size: 2.2vh; padding: 0 5% 0 5%; } -#dataTableCont input { +#dataTableCont input, #dataTableCont2 input { border: 1px solid rgba(0, 0, 0, 0.3); font-size: 2vh; width: 60%; @@ -333,11 +333,11 @@ a { font-weight: 300; } -#langGraph { +#langGraph, #phonemeGraph { display: block; } -#langGraph canvas { +#langGraph canvas, #phonemeGraph canvas { grid-column: 1; grid-row: 1; } diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 4095950..842d443 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -5,6 +5,7 @@ var data; var languageChart; var dataOpen = false; var submittable = true; +var flipMode = "dataValues1"; var dropOp = {}; var dropOpStore = {}; var loginInfo = {}; @@ -263,9 +264,28 @@ function phoneme(p) { }); } -document.getElementById("flipMode").onclick = function() { - dropOpStore["flipMode"] = (dropOpStore["flipMode"] === "language") ? "phoneme" : "language"; +document.getElementById("flipMode1").onclick = function() { + document.getElementById(flipMode).style.opacity = "0"; + setTimeout(function() { + document.getElementById(flipMode).style.display = "none"; + flipMode = (flipMode === "dataValues1") ? "dataValues2" : "dataValues1"; + document.getElementById(flipMode).style.display = "block"; + setTimeout(function() { + document.getElementById(flipMode).style.opacity = "1"; + }, 30); + }, 300); +}; +document.getElementById("flipMode2").onclick = function() { + document.getElementById(flipMode).style.opacity = "0"; + setTimeout(function() { + document.getElementById(flipMode).style.display = "none"; + flipMode = (flipMode === "dataValues1") ? "dataValues2" : "dataValues1"; + document.getElementById(flipMode).style.display = "block"; + setTimeout(function() { + document.getElementById(flipMode).style.opacity = "1"; + }, 30); + }, 300); } function generateDropOp() { // For options that change based on data. @@ -289,7 +309,6 @@ function generateDropOp() { // For options that change based on data. info.appendChild(a); // Generate data box material. - var phonemes = Object.keys(langInfo.phonemes).sort(Intl.Collator().compare); while (dataBox.firstChild) { @@ -343,9 +362,78 @@ function generateDropOp() { // For options that change based on data. }, 300); }].concat(["Select language..."].concat(data.values.map(a=>a.id))); - dropOp["authority"] = [function() { + dropOp["phonemeSelect"] = [function() { // Function that occurs when change language. + // Generate info box material. + var langInfo = phoneme(dropOpStore["phonemeSelect"]); + var info = document.getElementById("phonemeInfoCont"); + var dataBox = document.getElementById("dataTableCont2"); + var graph = document.querySelectorAll("#phonemeGraph > canvas")[0]; + info.style.opacity = "0"; + dataBox.style.opacity = "0"; + graph.style.opacity = "0"; + setTimeout(function() { + while (info.firstChild) { + info.removeChild(info.firstChild); + } + var a = document.createElement("a"); + a.appendChild(document.createTextNode("Sound")); + a.href = "https://en.wikipedia.org"; // replace with wikipedia + a.setAttribute("target", "_blank"); + info.appendChild(a); + + // Generate data box material. + + while (dataBox.firstChild) { + dataBox.removeChild(dataBox.firstChild); + } + dataBox.style.gridTemplateColumns = "repeat("+Math.ceil(langInfo.length/6).toString() + ", 1fr)"; + for(var i = 0; i < 9; i++) dataBox.appendChild(document.createElement("div")); // Extra divs will be filled if necessary. + for(i = 0; i < langInfo.length; i++) { + var tableNum = Math.floor(i/6); + var row = i+2-tableNum*7; + var p1 = document.createElement("p"); + var p2 = document.createElement("p"); + p1.style.textAlign = "right"; + p2.style.textAlign = "left"; + p1.style.borderRight = "1px solid #D5D5D5"; + if(i%6 === 0) { + var pT1 = document.createElement("p"); + var pT2 = document.createElement("p"); + pT1.style.textAlign = "right"; + pT2.style.textAlign = "left"; + pT1.style.borderRight = "1px solid #D5D5D5"; + pT1.style.borderBottom = "1px solid #D5D5D5"; + pT2.style.borderBottom = "1px solid #D5D5D5"; + pT1.appendChild(document.createTextNode("Language")); + pT2.appendChild(document.createTextNode("Percent")); + dataBox.children[tableNum].appendChild(pT1); + dataBox.children[tableNum].appendChild(pT2); + } + p1.appendChild(document.createTextNode(Object.keys(langInfo[i]))); + p2.appendChild(document.createTextNode(Rnd(langInfo[i][Object.keys(langInfo[i])], 2))); + dataBox.children[tableNum].appendChild(p1); + dataBox.children[tableNum].appendChild(p2); + } + var graphData = langInfo.map(function(a) { return Object.entries(a)[0]; }).sort(function(a,b) { + return b[1] - a[1]; + }); + graphData = [graphData.map(function(a,b) { + return a[0]; + }), graphData.map(function(a,b) { + return a[1]; + })]; + // Generate graphs. + var ctx = graph.getContext("2d"); + try { + languageChart.destroy(); + } catch(err) {} + languageChart = new Chart(ctx, chartOptions(graphData)); + info.style.opacity = "1"; + dataBox.style.opacity = "1"; + graph.style.opacity = "1"; + }, 300); + }].concat(["Select phoneme..."].concat(data.phonemes.sort())); - }].concat(["Select authority..."].concat(Object.keys(authorityLabels))); } function createDrop() { @@ -390,7 +478,7 @@ function createDrop() { }, 300); }; if(op === "langSelect") p2.appendChild(document.createTextNode(language(dropOp[op][j]).name)); - if(op === "authority") p2.appendChild(document.createTextNode(authorityLabels[dropOp[op][j]])) + if(op === "phonemeSelect") p2.appendChild(document.createTextNode(dropOp[op][j])); div2.appendChild(p2); } @@ -418,7 +506,6 @@ function dropOpUpdate(op) { var dropdown = document.querySelectorAll(".dropdown[option=" + op + "] .button p")[0]; if(op === "langSelect") dropdown.textContent = language(dropOpStore[op]).name; if(op === "authority") dropdown.textContent = authorityLabels[dropOpStore[op]]; - console.log(op); (dropOp[op][0])(); } diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index f62c174..d589fab 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -43,7 +43,7 @@

Language

-
+

Phoneme

@@ -69,32 +69,32 @@
- +

Currently in progress!

From bd310137efd2dcd2bbf17624b4cc6408e26e4d2a Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 5 Jun 2018 20:32:10 -0400 Subject: [PATCH 78/80] Fixed bugs --- SmearcarDB/static/index.css | 12 ++++++++---- SmearcarDB/static/index.js | 25 ++----------------------- SmearcarDB/templates/index.html | 3 --- 3 files changed, 10 insertions(+), 30 deletions(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index b5f6954..4fdca24 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -243,6 +243,9 @@ a { height: 42%; } +#dataTableCont, #dataTable2Cont { + height: 40%; +} #dataTable, #dataTable2 { grid-template-columns: 90fr 10fr; } @@ -250,7 +253,8 @@ a { #langSelect, #phonemeSelect { grid-column: 1; - grid-row: 1 + grid-row: 1; + grid-template-columns: 35% auto 20%; } #langSelect .dropdown, #phonemeSelect .dropdown { @@ -260,7 +264,7 @@ a { } #flipMode1, #flipMode2 { - grid-column: 4; + grid-column: 3; grid-row: 1; cursor: pointer; text-align: right; @@ -365,7 +369,7 @@ a { #header2 { display:grid; - grid-template-columns: 20% 60% 10% 10%; + grid-template-columns: 60% 20% 10% 10%; grid-template-rows: 100%; } @@ -430,6 +434,6 @@ a { #headerTitle { font-size: 200%; font-weight: 300; - margin: auto 10% auto; + margin: auto 3% auto; font-family: 'Saira Condensed', sans-serif; } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 842d443..5f3faf9 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -199,6 +199,7 @@ function createNav() { function updateMain(op) { // Updates the actual page. updateNav(op); + if(flipMode === "dataValues2") navSelect = "dataValues2"; document.getElementById(navSelect).style.opacity = "0"; setTimeout(function() { document.getElementById(navSelect).style.display = "none"; @@ -367,19 +368,12 @@ function generateDropOp() { // For options that change based on data. var langInfo = phoneme(dropOpStore["phonemeSelect"]); var info = document.getElementById("phonemeInfoCont"); var dataBox = document.getElementById("dataTableCont2"); - var graph = document.querySelectorAll("#phonemeGraph > canvas")[0]; info.style.opacity = "0"; dataBox.style.opacity = "0"; - graph.style.opacity = "0"; setTimeout(function() { while (info.firstChild) { info.removeChild(info.firstChild); } - var a = document.createElement("a"); - a.appendChild(document.createTextNode("Sound")); - a.href = "https://en.wikipedia.org"; // replace with wikipedia - a.setAttribute("target", "_blank"); - info.appendChild(a); // Generate data box material. @@ -414,23 +408,8 @@ function generateDropOp() { // For options that change based on data. dataBox.children[tableNum].appendChild(p1); dataBox.children[tableNum].appendChild(p2); } - var graphData = langInfo.map(function(a) { return Object.entries(a)[0]; }).sort(function(a,b) { - return b[1] - a[1]; - }); - graphData = [graphData.map(function(a,b) { - return a[0]; - }), graphData.map(function(a,b) { - return a[1]; - })]; - // Generate graphs. - var ctx = graph.getContext("2d"); - try { - languageChart.destroy(); - } catch(err) {} - languageChart = new Chart(ctx, chartOptions(graphData)); info.style.opacity = "1"; dataBox.style.opacity = "1"; - graph.style.opacity = "1"; }, 300); }].concat(["Select phoneme..."].concat(data.phonemes.sort())); @@ -505,7 +484,7 @@ function createDrop() { function dropOpUpdate(op) { var dropdown = document.querySelectorAll(".dropdown[option=" + op + "] .button p")[0]; if(op === "langSelect") dropdown.textContent = language(dropOpStore[op]).name; - if(op === "authority") dropdown.textContent = authorityLabels[dropOpStore[op]]; + if(op === "phonemeSelect") dropdown.textContent = dropOpStore[op]; (dropOp[op][0])(); } diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index d589fab..e4f9df9 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -91,9 +91,6 @@
-
- -
From 5632bec45b2e139eedc93d3d1f2363420fb9a9ec Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 5 Jun 2018 22:42:39 -0400 Subject: [PATCH 79/80] Added database and files --- SmearcarDB/server.py | 38 ++++++ SmearcarDB/static/index.css | 97 ++++++++++++++++ SmearcarDB/static/index.js | 198 ++++++++++++++++++++++++++++++-- SmearcarDB/templates/index.html | 21 +++- 4 files changed, 340 insertions(+), 14 deletions(-) diff --git a/SmearcarDB/server.py b/SmearcarDB/server.py index 18037eb..1a617d7 100644 --- a/SmearcarDB/server.py +++ b/SmearcarDB/server.py @@ -232,6 +232,7 @@ patch_functions = { } + # Render the client at the default URL @app.route("/") def initial(): @@ -350,5 +351,42 @@ def editors(): else: return "Bad Request" +@app.route("/directory", methods=["GET","POST"]) +def directory(): + rootDir = "directory/" + if request.method == "GET": + return jsonify({"dir": rootDir}) + if request.method == "POST": + received = request.get_json() + files = [] + for filename in os.listdir(received["path"]): + file = {} + filedir = received["path"]+filename + isdir = os.path.isdir(filedir) + file["name"] = filename + file["date"] = datetime.datetime.fromtimestamp(os.path.getmtime(filedir)).strftime("%B %d, %Y") + if(isdir): + file["size"] = "- - - -" + file["folder"] = "true" + else: + file["size"] = sizeof_fmt(os.path.getsize(filedir)) + file["folder"] = "false" + + files.append(file) + return jsonify(files) + +def sizeof_fmt(num, suffix='B'): + for unit in ['','K','M','G','T','P','E','Z']: + if abs(num) < 1024.0: + return "%3.1f%s%s" % (num, unit, suffix) + num /= 1024.0 + return "%.1f%s%s" % (num, 'Yi', suffix) + +@app.route("/directory/", methods=["GET"]) +def dir_download(file): + print(file) + return send_file(file) + if __name__ == "__main__": app.run(host="0.0.0.0") + diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index 4fdca24..aa7e4af 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -436,4 +436,101 @@ a { font-weight: 300; margin: auto 3% auto; font-family: 'Saira Condensed', sans-serif; +} + +#directory p { + font-size: 150%; + padding: 1.5vh 2vh 1.5vh 2vh; +} + +#directoryHeader { + height: 10%; + display: grid; + grid-template-columns: 70% 15% 10% 5%; + grid-template-rows: 100%; + color: black; + background-color: white; +} + +#directoryHeader p { + display: grid; + cursor: pointer; + grid-template-columns: 19fr 1fr; + grid-template-rows: 100%; + padding: 2.3vh; +} + +#directoryHeader p:hover { + background-color: rgba(0,0,0,0.1); +} + +#directoryHeader i { + margin: auto; + display: none; + opacity: 0; +} + +#directoryCont { + overflow-y: auto; +} + +.item { + display: grid; + cursor: pointer; + grid-template-columns: 70% 15% 10% 5%; + grid-template-rows: 100%; + margin: 1vh 0 1vh 0; +} + +.item p { + pointer-events: none; +} + +.item a { + grid-column: 4; + grid-row: 2; + margin: auto; + font-size: 140%; +} + +.item a:hover { + color: #F47922; +} + +#directoryLocation { + height: 10%; + margin-bottom: 2vh; + opacity: 0; + display: block; +} + +#directoryLocation p { + padding: 0.5vh; + margin: 1vh 1.5vh 1vh 1.5vh; + border-radius: 5px; + display: inline-block; +} + +#directoryLocation i { + font-size: 150%; +} + +#directoryHeader .name, .item .name { + grid-column: 1; +} + +#directoryHeader .date, .item .modified { + grid-column: 2; +} + +#directoryHeader .size, .item .size { + grid-column: 3; +} + +#directoryHeader p, .item p { + margin: 0; +} + +.subdir:hover { + background-color: rgba(0,0,0,0.1); } \ No newline at end of file diff --git a/SmearcarDB/static/index.js b/SmearcarDB/static/index.js index 5f3faf9..e2c141d 100644 --- a/SmearcarDB/static/index.js +++ b/SmearcarDB/static/index.js @@ -1,14 +1,8 @@ -var navSelect = "home"; -var dataMode; -var serverURL = window.location.origin; -var data; -var languageChart; -var dataOpen = false; -var submittable = true; -var flipMode = "dataValues1"; -var dropOp = {}; -var dropOpStore = {}; -var loginInfo = {}; +var navSelect = "home", flipMode = "dataValues1", currDir = "", + dataMode, data, languageChart, rootDir, files, + serverURL = window.location.origin, + dataOpen = false, submittable = true, clickable = true, + dropOp = {}, dropOpStore = {}, loginInfo = {}; var navi = [ // Array containing navigation items in form [Font-Awesome class name, Display Text, Onclick function]. ["home", "Home", "home"], @@ -24,7 +18,6 @@ var authorityLabels = { 3: "#3: No access" }; - var modals = [ { name: "Add Language", @@ -200,6 +193,7 @@ function createNav() { function updateMain(op) { // Updates the actual page. updateNav(op); if(flipMode === "dataValues2") navSelect = "dataValues2"; + if(op === "files") getFiles(); document.getElementById(navSelect).style.opacity = "0"; setTimeout(function() { document.getElementById(navSelect).style.display = "none"; @@ -246,6 +240,186 @@ function getData(updatePage) { ); } +function getFiles() { + $.ajax({ + url: serverURL + "/directory", + type: 'GET' + }) + .then( + function success(incoming) { + rootDir = incoming.dir; + listDir(""); + } + ); +} + +function listDir(dir) { + $.ajax({ + url: serverURL + "/directory", + type: 'POST', + dataType: "json", + contentType: 'application/json;charset=UTF-8', + data: JSON.stringify({path:rootDir+dir}) + }) + .then( + function success(incoming) { + files = incoming; + dispDir(); + clickable = true; + } + ); +} + +function dispDir() { + updateLocation(); + document.getElementById("directory").removeChild(document.getElementById("directoryCont")); + var cont = document.createElement("div"); + cont.id = "directoryCont"; + cont.style.opacity = "0"; + cont.className = "transition"; + + selectName = ""; + var item; + if(files.length === 0) { + var p = document.createElement("p"); + p.appendChild(document.createTextNode("Nothing here!")); + p.style.fontWeight = "100"; + cont.appendChild(p); + } + for(var i = 0; i < files.length; i++) { + item = createRow(); + + var curr = files[i]; + var name = document.createTextNode(curr.name); + var modified = document.createTextNode(curr.date); + var size = document.createTextNode(curr.size); + + item.childNodes[0].appendChild(name); + item.childNodes[1].appendChild(modified); + item.childNodes[2].appendChild(size); + + var ext = document.createAttribute("ext"); + + if(curr.folder == "true") { + ext.value = "fol"; + } else { + console.log(name); + var f = document.createElement("i"); + var a = document.createElement("a"); + a.href = getURI(curr.name) + a.setAttribute("target", "_blank"); + f.className = "fa fa-download transition"; + a.appendChild(f); + item.appendChild(a); + } + item.setAttributeNode(ext); + + item.onclick = function() { + if(clickable == true) { + var name = this.childNodes[0].innerText; + if(selectName == name) { + clickable = false; + attr = this.getAttribute("ext"); + if(attr == "fol") { + clearTbl(); + setTimeout(function() { + currDir += name+"/"; + listDir(currDir); + }, 300) + return; + } + } + selectName = name; + selectDiv = this; + for(var i =0; i < document.getElementsByClassName("item").length;i++){ + document.getElementsByClassName("item")[i].style.backgroundColor = ""; + } + this.style.backgroundColor = "#d9d9d9"; + } + } + cont.appendChild(item); + item = null; + } + document.getElementById("directory").appendChild(cont); + setTimeout(function() { + document.getElementById("directoryCont").style.opacity = "1"; + }, 100); +} + +function getURI(name) { + var dirs = (rootDir+currDir+name).split("/"); + var uri = window.location.origin+"/directory"; + for(var i = 0; i < dirs.length; i++) uri+="/"+encodeURIComponent(dirs[i]); + return uri; +} + +function clearTbl() { + selected = undefined; + selectDiv = undefined; + document.getElementById("directoryCont").style.opacity = "0"; + document.getElementById("directoryLocation").style.opacity = "0"; +} + +function createRow() { + var item = document.createElement("div"); + item.className = "item transition card"; + var name = document.createElement("p"); + name.className = "name"; + item.appendChild(name); + var modified = document.createElement("p"); + modified.className = "modified"; + item.appendChild(modified); + var size = document.createElement("p"); + size.className = "size"; + item.appendChild(size); + return item; +} + +function updateLocation() { + var loc = document.getElementById("directoryLocation"); + while(loc.firstChild) loc.removeChild(loc.firstChild); + loc.style.opacity = "1"; + var subdir = currDir.split("/"); + subdir = subdir.slice(0, subdir.length-1); + for(var i = 0; i < subdir.length+1; i++) { + var p = document.createElement("p"); + var ic = document.createElement("i"); + ic.className = "fa fa-angle-right"; + if(i !== 0) loc.appendChild(ic); + if(i === 0) { + p.appendChild(document.createTextNode("Database")); + } else { + p.appendChild(document.createTextNode(subdir[i-1])); + } + if(i !== subdir.length) { + p.style.cursor = "pointer"; + p.className = "subdir transition"; + p.onclick = function() { + clickable = false; + clearTbl(); + subdirNum = subdir.indexOf(this.innerText); + if(subdirNum === -1) { + currDir = ""; + } else { + currDir = subdir.slice(0, subdirNum+1).reduce(function(a,b) { return a+"/"+b; })+"/"; + } + listDir(currDir); + } + } + loc.appendChild(p); + } +} + +function downloadFile(name) { + $.ajax({ + url: serverURL + "/directory/download", + type: 'POST', + dataType: "json", + contentType: 'application/json;charset=UTF-8', + data: JSON.stringify({path:rootDir+currDir+name}) + }); +} + function language(language) { return data.values.filter(function(element) { return element.id === parseInt(language); diff --git a/SmearcarDB/templates/index.html b/SmearcarDB/templates/index.html index e4f9df9..7abbb7c 100644 --- a/SmearcarDB/templates/index.html +++ b/SmearcarDB/templates/index.html @@ -93,8 +93,25 @@
-
-

Currently in progress!

+
+
+

Database

+
+
+

Name + + +

+

Date Modified + + +

+

Size + + +

+
+
From 32b32a60efc1c1f087f64e8397f03318889adb59 Mon Sep 17 00:00:00 2001 From: Kenneth Jao Date: Tue, 5 Jun 2018 23:06:58 -0400 Subject: [PATCH 80/80] css spacing --- SmearcarDB/static/index.css | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SmearcarDB/static/index.css b/SmearcarDB/static/index.css index aa7e4af..97f52f8 100644 --- a/SmearcarDB/static/index.css +++ b/SmearcarDB/static/index.css @@ -243,9 +243,18 @@ a { height: 42%; } -#dataTableCont, #dataTable2Cont { +#dataTableCont { height: 40%; } + +#dataTableCont2 { + height: 45%; +} + +#dataTable2{ + height: 50% !important; +} + #dataTable, #dataTable2 { grid-template-columns: 90fr 10fr; }