diff --git a/server-data/resources/[bpt_addons]/bpt_crafting/bpt_crafting.sql b/server-data/resources/[bpt_addons]/bpt_crafting/bpt_crafting.sql index 5b3375368..0e06841e9 100644 --- a/server-data/resources/[bpt_addons]/bpt_crafting/bpt_crafting.sql +++ b/server-data/resources/[bpt_addons]/bpt_crafting/bpt_crafting.sql @@ -56,5 +56,6 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES ('diamond_tip', 'Diamond tip'), ('diamond', 'Diamond'), ('marijuana_extract', 'Marijuana extract'), - ('medikit', 'Medikit') + ('medikit', 'Medikit'), + ('salmon_fillet', 'Salmon Fillet') ; \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_crafting/config.lua b/server-data/resources/[bpt_addons]/bpt_crafting/config.lua index e1978638b..4c573ac92 100644 --- a/server-data/resources/[bpt_addons]/bpt_crafting/config.lua +++ b/server-data/resources/[bpt_addons]/bpt_crafting/config.lua @@ -58,7 +58,7 @@ Config = { ["fisherman"] = { Label = "fisherman", Image = "fisherman", - Jobs = { "fisherman" }, + Jobs = { "unicorn" }, }, ["ammunation"] = { Label = "Munizioni", @@ -490,7 +490,7 @@ Config = { Level = 0, Category = "fisherman", isGun = false, - Jobs = { "fisherman" }, + Jobs = { "unicorn" }, JobGrades = {}, Amount = 2, SuccessRate = 100, @@ -567,7 +567,7 @@ Config = { coords = vector3(129.217590, -1283.802246, 29.263062), jobs = { "unicorn" }, blip = false, - recipes = { "almondmilk", "slicedchips", "bread_deer" }, + recipes = { "almondmilk", "slicedchips", "bread_deer", "salmon_fillet" }, radius = 1.0, }, { @@ -584,13 +584,6 @@ Config = { recipes = { "flour", "bread" }, radius = 1.0, }, - { - coords = vector3(-316.549438, -2781.217529, 4.982422), - jobs = { "fisherman" }, - blip = false, - recipes = { "salmon_fillet" }, - radius = 1.0, - }, }, } diff --git a/server-data/resources/[bpt_addons]/bpt_crafting/localization/bpt_crafting_it.sql b/server-data/resources/[bpt_addons]/bpt_crafting/localization/bpt_crafting_it.sql index 0f0a2d466..477024faf 100644 --- a/server-data/resources/[bpt_addons]/bpt_crafting/localization/bpt_crafting_it.sql +++ b/server-data/resources/[bpt_addons]/bpt_crafting/localization/bpt_crafting_it.sql @@ -56,5 +56,6 @@ INSERT INTO `bpt_items` (`name`, `label`) VALUES ('diamond_tip', 'Punta di diamante'), ('diamond', 'Diamond'), ('marijuana_extract', 'Estratto di marijuana'), - ('medikit', 'Medikit') + ('medikit', 'Medikit'), + ('salmon_fillet', 'Filetto di salmone') ; \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/LICENSE b/server-data/resources/[bpt_addons]/bpt_fisherman/LICENSE deleted file mode 100644 index 7c1b638e7..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - 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) 2022-2024 bitpredator - - 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) 2022-2024 bitpredator - 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/server-data/resources/[bpt_addons]/bpt_fisherman/README.md b/server-data/resources/[bpt_addons]/bpt_fisherman/README.md deleted file mode 100644 index 53165a47d..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/README.md +++ /dev/null @@ -1,23 +0,0 @@ -

bpt_fisherman

-

Discord - -📌 License -Copyright (C) 2022-2024 bitpredator - -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. - -ATTENTION: -You are not authorized to change the name of the resource and the resources within it. - -If you want to contribute you can open a pull request. - -You are not authorized to sell this software (this is free project). - -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 http://www.gnu.org/licenses/. - -## Info -This Script will allow you to simulate the creation of sandwiches using flour and water \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/bpt_fishermanjob.sql b/server-data/resources/[bpt_addons]/bpt_fisherman/bpt_fishermanjob.sql deleted file mode 100644 index e6b254bad..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/bpt_fishermanjob.sql +++ /dev/null @@ -1,23 +0,0 @@ -INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `datastore` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `jobs` (name, label) VALUES - ('fisherman', 'Fisherman') -; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('fisherman',0,'ontrial','Ontrial',12,'{"hair_2":0,"hair_color_2":0,"torso_1":32,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":0,"age_2":0,"glasses_2":0,"ears_2":0,"arms":27,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',1,'employee','Employee',24,'{"hair_2":0,"hair_color_2":0,"torso_1":32,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":0,"age_2":0,"glasses_2":0,"ears_2":0,"arms":27,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',2,'driver','Driver',36,'{"hair_2":0,"hair_color_2":0,"torso_1":26,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":57,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":11,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',3,'responsible','Responsible',48,'{"hair_2":0,"hair_color_2":0,"torso_1":26,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":57,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":11,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',4,'boss','Boss',0,'{"hair_2":0,"hair_color_2":0,"torso_1":29,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":1,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":4,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}') -; \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua deleted file mode 100644 index f57cde19c..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/client/main.lua +++ /dev/null @@ -1,374 +0,0 @@ -local HasAlreadyEnteredMarker -local CurrentAction, CurrentActionMsg, CurrentActionData = nil, "", {} -local LastZone - -RegisterNetEvent("esx:playerLoaded") -AddEventHandler("esx:playerLoaded", function(xPlayer) - ESX.PlayerData = xPlayer - ESX.PlayerLoaded = true -end) - -RegisterNetEvent("esx:onPlayerLogout") -AddEventHandler("esx:onPlayerLogout", function() - ESX.PlayerLoaded = false - ESX.PlayerData = {} -end) - -RegisterNetEvent("esx:setJob") -AddEventHandler("esx:setJob", function(job) - ESX.PlayerData.job = job -end) - -function DrawSub(msg, time) - ClearPrints() - BeginTextCommandPrint("STRING") - AddTextComponentSubstringPlayerName(msg) - EndTextCommandPrint(time, 1) -end - -function ShowLoadingPromt(msg, time, type) - CreateThread(function() - Wait(0) - - BeginTextCommandBusyspinnerOn("STRING") - AddTextComponentSubstringPlayerName(msg) - EndTextCommandBusyspinnerOn(type) - Wait(time) - - BusyspinnerOff() - end) -end - -function OpenCloakroom() - local elements = { - { unselectable = true, icon = "fas fa-shirt", title = TranslateCap("cloakroom_menu") }, - { icon = "fas fa-shirt", title = TranslateCap("wear_citizen"), value = "wear_citizen" }, - { icon = "fas fa-shirt", title = TranslateCap("wear_work"), value = "wear_work" }, - } - - ESX.OpenContext("right", elements, function(_, element) - if element.value == "wear_citizen" then - ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin) - TriggerEvent("skinchanger:loadSkin", skin) - end) - elseif element.value == "wear_work" then - ESX.TriggerServerCallback("esx_skin:getPlayerSkin", function(skin, jobSkin) - if skin.sex == 0 then - TriggerEvent("skinchanger:loadClothes", skin, jobSkin.skin_male) - else - TriggerEvent("skinchanger:loadClothes", skin, jobSkin.skin_female) - end - end) - end - ESX.CloseContext() - end, function() - CurrentAction = "cloakroom" - CurrentActionMsg = TranslateCap("cloakroom_prompt") - CurrentActionData = {} - end) -end - -function OpenVehicleSpawnerMenu() - local elements = { - { unselectable = true, icon = "fas fa-car", title = TranslateCap("spawn_veh") }, - } - - if Config.EnableSocietyOwnedVehicles then - ESX.TriggerServerCallback("bpt_society:getVehiclesInGarage", function(vehicles) - if #vehicles == 0 then - ESX.ShowNotification(TranslateCap("empty_garage")) - return - end - - for i = 1, #vehicles, 1 do - elements[#elements + 1] = { - icon = "fas fa-car", - title = GetDisplayNameFromVehicleModel(vehicles[i].model) .. " [" .. vehicles[i].plate .. "]", - value = vehicles[i], - } - end - - ESX.OpenContext("right", elements, function(_, element) - if not ESX.Game.IsSpawnPointClear(Config.Zones.VehicleSpawnPoint.Pos, 5.0) then - ESX.ShowNotification(TranslateCap("spawnpoint_blocked")) - return - end - - if element.value == nil then - print("ERROR: Context menu clicked item value is nil!") - return - end - - local vehicleProps = element.value - ESX.TriggerServerCallback("bpt_fishermanjob:SpawnVehicle", function() - return - end, vehicleProps.model, vehicleProps) - TriggerServerEvent("bpt_society:removeVehicleFromGarage", "fisherman", vehicleProps) - end, function() - CurrentAction = "vehicle_spawner" - CurrentActionMsg = TranslateCap("spawner_prompt") - CurrentActionData = {} - end) - end, "fisherman") - else -- not society vehicles - if #Config.AuthorizedVehicles == 0 then - ESX.ShowNotification(TranslateCap("empty_garage")) - return - end - - for i = 1, #Config.AuthorizedVehicles, 1 do - elements[#elements + 1] = { - icon = "fas fa-car", - title = Config.AuthorizedVehicles[i].label, - value = Config.AuthorizedVehicles[i].model, - } - end - - ESX.OpenContext("right", elements, function(_, element) - if not ESX.Game.IsSpawnPointClear(Config.Zones.VehicleSpawnPoint.Pos, 5.0) then - ESX.ShowNotification(TranslateCap("spawnpoint_blocked")) - return - end - - if element.value == nil then - print("ERROR: Context menu clicked item value is nil!") - return - end - - ESX.TriggerServerCallback("bpt_fishermanjob:SpawnVehicle", function() - ESX.ShowNotification(TranslateCap("vehicle_spawned"), "success") - end, element.value, { plate = "FISH JOB" }) - ESX.CloseContext() - end, function() - CurrentAction = "vehicle_spawner" - CurrentActionMsg = TranslateCap("spawner_prompt") - CurrentActionData = {} - end) - end -end - -function DeleteJobVehicle() - if Config.EnableSocietyOwnedVehicles then - local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle) - TriggerServerEvent("bpt_society:putVehicleInGarage", "fisherman", vehicleProps) - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - else - if IsInAuthorizedVehicle() then - ESX.Game.DeleteVehicle(CurrentActionData.vehicle) - else - ESX.ShowNotification(TranslateCap("only_fisherman")) - end - end -end - -function OpenFishermanActionsMenu() - local elements = { - { unselectable = true, icon = "fas fa-fisherman", title = TranslateCap("fisherman") }, - { icon = "fas fa-box", title = TranslateCap("deposit_stock"), value = "put_stock" }, - { icon = "fas fa-box", title = TranslateCap("take_stock"), value = "get_stock" }, - } - - if Config.EnablePlayerManagement and ESX.PlayerData.job ~= nil and ESX.PlayerData.job.grade_name == "boss" then - elements[#elements + 1] = { - icon = "fas fa-wallet", - title = TranslateCap("boss_actions"), - value = "boss_actions", - } - end - - ESX.OpenContext("right", elements, function(_, element) - if Config.OxInventory and (element.value == "put_stock" or element.value == "get_stock") then - exports.ox_inventory:openInventory("stash", "society_fisherman") - return ESX.CloseContext() - elseif element.value == "put_stock" then - OpenPutStocksMenu() - elseif element.value == "get_stock" then - OpenGetStocksMenu() - elseif element.value == "boss_actions" then - TriggerEvent("bpt_society:openBossMenu", "fisherman", function(_, menu) - menu.close() - end) - end - end, function() - CurrentAction = "fisherman_actions_menu" - CurrentActionMsg = TranslateCap("press_to_open") - CurrentActionData = {} - end) -end - -function OpenMobileFishermanActionsMenu() - local elements = { - { unselectable = true, icon = "fas fa-fisherman", title = TranslateCap("fisherman") }, - { icon = "fas fa-scroll", title = TranslateCap("billing"), value = "billing" }, - } - - ESX.OpenContext("right", elements, function(_, element) - if element.value == "billing" then - local elements2 = { - { unselectable = true, icon = "fas fa-fisherman", title = element.title }, - { - title = TranslateCap("amount"), - input = true, - inputType = "number", - inputMin = 1, - inputMax = 10000000, - inputPlaceholder = TranslateCap("bill_amount"), - }, - { icon = "fas fa-check-double", title = TranslateCap("confirm"), value = "confirm" }, - } - - ESX.OpenContext("right", elements2, function(menu2) - local amount = tonumber(menu2.eles[2].inputValue) - if amount == nil then - ESX.ShowNotification(TranslateCap("amount_invalid")) - else - ESX.CloseContext() - local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() - if closestPlayer == -1 or closestDistance > 3.0 then - ESX.ShowNotification(TranslateCap("no_players_near")) - else - TriggerServerEvent("bpt_billing:sendBill", GetPlayerServerId(closestPlayer), "society_fisherman", "Fisherman", amount) - ESX.ShowNotification(TranslateCap("billing_sent")) - end - end - end) - end - end) -end - -function IsInAuthorizedVehicle() - local playerPed = PlayerPedId() - local vehModel = GetEntityModel(GetVehiclePedIsIn(playerPed, false)) - - for i = 1, #Config.AuthorizedVehicles, 1 do - if vehModel == joaat(Config.AuthorizedVehicles[i].model) then - return true - end - end - - return false -end - -AddEventHandler("bpt_fishermanjob:hasEnteredMarker", function(zone) - if zone == "VehicleSpawner" then - CurrentAction = "vehicle_spawner" - CurrentActionMsg = TranslateCap("spawner_prompt") - CurrentActionData = {} - elseif zone == "VehicleDeleter" then - local playerPed = PlayerPedId() - local vehicle = GetVehiclePedIsIn(playerPed, false) - - if IsPedInAnyVehicle(playerPed, false) and GetPedInVehicleSeat(vehicle, -1) == playerPed then - CurrentAction = "delete_vehicle" - CurrentActionMsg = TranslateCap("store_veh") - CurrentActionData = { - vehicle = vehicle, - } - end - elseif zone == "FishermanActions" then - CurrentAction = "fisherman_actions_menu" - CurrentActionMsg = TranslateCap("press_to_open") - CurrentActionData = {} - elseif zone == "Cloakroom" then - CurrentAction = "cloakroom" - CurrentActionMsg = TranslateCap("cloakroom_prompt") - CurrentActionData = {} - end -end) - -AddEventHandler("bpt_fishermanjob:hasExitedMarker", function() - ESX.CloseContext() - CurrentAction = nil -end) - --- Create Blips -CreateThread(function() - local blip = AddBlipForCoord(Config.Zones.FishermanActions.Pos.x, Config.Zones.FishermanActions.Pos.y, Config.Zones.FishermanActions.Pos.z) - - SetBlipSprite(blip, 478) - SetBlipDisplay(blip, 4) - SetBlipScale(blip, 1.0) - SetBlipColour(blip, 21) - SetBlipAsShortRange(blip, true) - - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(TranslateCap("blip_fisherman")) - EndTextCommandSetBlipName(blip) -end) - --- Enter / Exit marker events, and draw markers -CreateThread(function() - while true do - local sleep = 1500 - if ESX.PlayerData.job and ESX.PlayerData.job.name == "fisherman" then - local coords = GetEntityCoords(PlayerPedId()) - local isInMarker, currentZone = false - local inVeh = IsPedInAnyVehicle(PlayerPedId()) - - for k, v in pairs(Config.Zones) do - local zonePos = vector3(v.Pos.x, v.Pos.y, v.Pos.z) - local distance = #(coords - zonePos) - - if v.Type ~= -1 and distance < Config.DrawDistance then - sleep = 0 - if k == "VehicleDeleter" then - if inVeh then - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, false, 2, v.Rotate, nil, nil, false) - end - else - DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, false, 2, v.Rotate, nil, nil, false) - end - end - - if distance < v.Size.x then - isInMarker, currentZone = true, k - end - end - - if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then - HasAlreadyEnteredMarker, LastZone = true, currentZone - TriggerEvent("bpt_fishermanjob:hasEnteredMarker", currentZone) - end - - if not isInMarker and HasAlreadyEnteredMarker then - HasAlreadyEnteredMarker = false - TriggerEvent("bpt_fishermanjob:hasExitedMarker", LastZone) - end - end - Wait(sleep) - end -end) - --- Key Controls -CreateThread(function() - while true do - local sleep = 1500 - if CurrentAction and not ESX.PlayerData.dead then - sleep = 0 - ESX.ShowHelpNotification(CurrentActionMsg) - - if IsControlJustReleased(0, 38) and ESX.PlayerData.job and ESX.PlayerData.job.name == "fisherman" then - if CurrentAction == "fisherman_actions_menu" then - OpenFishermanActionsMenu() - elseif CurrentAction == "cloakroom" then - OpenCloakroom() - elseif CurrentAction == "vehicle_spawner" then - OpenVehicleSpawnerMenu() - elseif CurrentAction == "delete_vehicle" then - DeleteJobVehicle() - end - - CurrentAction = nil - end - end - Wait(sleep) - end -end) - -RegisterCommand("fishermanmenu", function() - if not ESX.PlayerData.dead and Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.name == "fisherman" then - OpenMobileFishermanActionsMenu() - end -end, false) - -RegisterKeyMapping("fishermanmenu", "Open Fisherman Menu", "keyboard", "f6") diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/config.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/config.lua deleted file mode 100644 index c12f8f037..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/config.lua +++ /dev/null @@ -1,53 +0,0 @@ -Config = {} -Config.DrawDistance = 10.0 -- How close do you need to be for the markers to be drawn (in GTA units). -Config.EnablePlayerManagement = true -- Enable society managing. -Config.EnableSocietyOwnedVehicles = false -Config.Locale = "it" -Config.OxInventory = ESX.GetConfig().OxInventory - -Config.AuthorizedVehicles = { - { model = "rumpo", label = "Rumpo" }, -} - -Config.Zones = { - - VehicleSpawner = { - Pos = { x = -351.956055, y = -2790.316406, z = 5.993408 }, - Size = { x = 0.6, y = 0.6, z = 0.6 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 36, - Rotate = true, - }, - - VehicleSpawnPoint = { - Pos = { x = -363.270325, y = -2775.824219, z = 5.993408 }, - Size = { x = 1.5, y = 1.5, z = 1.0 }, - Type = -1, - Rotate = false, - Heading = 225.0, - }, - - VehicleDeleter = { - Pos = { x = -348.118683, y = -2760.224121, z = 5.027100 }, - Size = { x = 3.0, y = 3.0, z = 0.25 }, - Color = { r = 255, g = 0, b = 0 }, - Type = 1, - Rotate = false, - }, - - FishermanActions = { - Pos = { x = -327.547241, y = -2769.125244, z = 5.201416 }, - Size = { x = 0.6, y = 0.6, z = 0.6 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 20, - Rotate = true, - }, - - Cloakroom = { - Pos = { x = -323.604401, y = -2784.065918, z = 5.201416 }, - Size = { x = 0.6, y = 0.6, z = 0.6 }, - Color = { r = 204, g = 204, b = 0 }, - Type = 21, - Rotate = true, - }, -} diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/fxmanifest.lua deleted file mode 100644 index 0d5c4ff1d..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/fxmanifest.lua +++ /dev/null @@ -1,25 +0,0 @@ -fx_version("adamant") - -game("gta5") - -description("bpt_fishermanjob") -lua54("yes") -version("1.0.1") - -shared_script("@es_extended/imports.lua") - -client_scripts({ - "@es_extended/locale.lua", - "locales/*.lua", - "config.lua", - "client/main.lua", -}) - -server_scripts({ - "@es_extended/locale.lua", - "locales/*.lua", - "config.lua", - "server/main.lua", -}) - -dependency("es_extended") diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/locales/en.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/locales/en.lua deleted file mode 100644 index 953e14dc4..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/locales/en.lua +++ /dev/null @@ -1,30 +0,0 @@ -Locales["en"] = { - -- cloakroom - ["cloakroom_menu"] = "cloakroom", - ["cloakroom_prompt"] = "press [E] to access the cloakroom.", - ["wear_citizen"] = "civilian clothes", - ["wear_work"] = "work clothes", - -- Inventory - ["deposit_stock"] = "Deposit stock", - ["take_stock"] = "Take stock", - ["have_deposited"] = "Have deposited", - ["quantity_invalid"] = "Quantity invelid", - -- garage - ["spawner_prompt"] = "press [E] to access the Garage.", - ["vehicle_spawned"] = "Vehicle picked up successfully!", - ["store_veh"] = "press [E] to deposit the vehicle", - ["spawn_veh"] = "vehicle spawns", - ["spawnpoint_blocked"] = "the spawnpoint is blocked!", - ["only_fisherman"] = "you can only deposit company vehicles.", - ["amount_invalid"] = "invalid amount", - ["press_to_open"] = "press [E] to access the menu", - ["invoice_amount"] = "invoice amount", - ["no_players_near"] = "no players nearby", - ["boss_actions"] = "Boss actions", - ["blip_fisherman"] = "Fisherman", - ["fisherman"] = "fisherman", - -- billing - ["bill_amount"] = "Amount to bill..", - ["confirm"] = "Confirm", - ["amount"] = "amount", -} diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/locales/it.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/locales/it.lua deleted file mode 100644 index 7b025fd83..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/locales/it.lua +++ /dev/null @@ -1,30 +0,0 @@ -Locales["it"] = { - -- cloakroom - ["cloakroom_menu"] = "guardaroba", - ["cloakroom_prompt"] = "premi [E] per accedere al guardaroba.", - ["wear_citizen"] = "abiti civili", - ["wear_work"] = "abiti da lavoro", - -- Inventory - ["deposit_stock"] = "Depositare", - ["take_stock"] = "Prendi", - ["have_deposited"] = "Hai depositato", - ["quantity_invalid"] = "Qunatità non valida", - -- garage - ["spawner_prompt"] = "premi [E] per accedere al Garage.", - ["vehicle_spawned"] = "Veicolo ritirato con successo!", - ["store_veh"] = "premi [E] per depositare il veicolo", - ["spawn_veh"] = "spawn veicolo", - ["spawnpoint_blocked"] = "lo spawnpoint è bloccato !", - ["only_fisherman"] = "puoi solo depositare veicoli aziendali.", - ["amount_invalid"] = "importo non valido", - ["press_to_open"] = "premi [E] per accedere al menu", - ["invoice_amount"] = "importo della fattura", - ["no_players_near"] = "nessun giocatore nelle vicinanze", - ["boss_actions"] = "Azioni del boss", - ["blip_fisherman"] = "Fisherman", - ["fisherman"] = "fisherman", - -- billing - ["bill_amount"] = "importo della fattura", - ["confirm"] = "Conferma", - ["amount"] = "Importo", -} diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/localization/bpt_fishermanjob_it.sql b/server-data/resources/[bpt_addons]/bpt_fisherman/localization/bpt_fishermanjob_it.sql deleted file mode 100644 index 524d3802d..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/localization/bpt_fishermanjob_it.sql +++ /dev/null @@ -1,23 +0,0 @@ -INSERT INTO `addon_account` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `datastore` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `addon_inventory` (name, label, shared) VALUES - ('society_fisherman', 'Fisherman', 1) -; - -INSERT INTO `jobs` (name, label) VALUES - ('fisherman', 'Fisherman') -; - -INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES - ('fisherman',0,'ontrial','in prova',12,'{"hair_2":0,"hair_color_2":0,"torso_1":32,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":0,"age_2":0,"glasses_2":0,"ears_2":0,"arms":27,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',1,'employee','dipendente',24,'{"hair_2":0,"hair_color_2":0,"torso_1":32,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":0,"age_2":0,"glasses_2":0,"ears_2":0,"arms":27,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',2,'driver','autista',36,'{"hair_2":0,"hair_color_2":0,"torso_1":26,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":57,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":11,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',3,'responsible','responsabile',48,'{"hair_2":0,"hair_color_2":0,"torso_1":26,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":57,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":11,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}'), - ('fisherman',4,'boss','Direttore',0,'{"hair_2":0,"hair_color_2":0,"torso_1":29,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":31,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":4,"age_2":0,"glasses_2":0,"ears_2":0,"arms":1,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":0,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":0,"bproof_1":0,"mask_1":0,"decals_1":0,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":4,"eyebrows_1":0,"face":0,"shoes_1":10,"pants_1":24}', '{"hair_2":0,"hair_color_2":0,"torso_1":57,"bags_1":0,"helmet_2":0,"chain_2":0,"eyebrows_3":0,"makeup_3":0,"makeup_2":0,"tshirt_1":38,"makeup_1":0,"bags_2":0,"makeup_4":0,"eyebrows_4":0,"chain_1":0,"lipstick_4":0,"bproof_2":0,"hair_color_1":0,"decals_2":0,"pants_2":1,"age_2":0,"glasses_2":0,"ears_2":0,"arms":21,"lipstick_1":0,"ears_1":-1,"mask_2":0,"sex":1,"lipstick_3":0,"helmet_1":-1,"shoes_2":0,"beard_2":0,"beard_1":0,"lipstick_2":0,"beard_4":0,"glasses_1":5,"bproof_1":0,"mask_1":0,"decals_1":1,"hair_1":0,"eyebrows_2":0,"beard_3":0,"age_1":0,"tshirt_2":0,"skin":0,"torso_2":0,"eyebrows_1":0,"face":0,"shoes_1":49,"pants_1":11}') -; \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua b/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua deleted file mode 100644 index 0f93551a9..000000000 --- a/server-data/resources/[bpt_addons]/bpt_fisherman/server/main.lua +++ /dev/null @@ -1,80 +0,0 @@ -TriggerEvent("bpt_society:registerSociety", "fisherman", "Fisherman", "society_fisherman", "society_fisherman", "society_fisherman", { - type = "public", -}) - -if Config.MaxInService ~= -1 then - TriggerEvent("esx_service:activateService", "fisherman", Config.MaxInService) -end - -ESX.RegisterServerCallback("bpt_fishermanjob:SpawnVehicle", function(source, cb, model, props) - local xPlayer = ESX.GetPlayerFromId(source) - - if xPlayer.job.name ~= "fisherman" then - print(("[^3WARNING^7] Player ^5%s^7 attempted to Exploit Vehicle Spawing!!"):format(source)) - return - end - local SpawnPoint = vector3(Config.Zones.VehicleSpawnPoint.Pos.x, Config.Zones.VehicleSpawnPoint.Pos.y, Config.Zones.VehicleSpawnPoint.Pos.z) - ESX.OneSync.SpawnVehicle(joaat(model), SpawnPoint, Config.Zones.VehicleSpawnPoint.Heading, props, function() - local vehicle = NetworkGetEntityFromNetworkId() - while GetVehicleNumberPlateText(vehicle) ~= props.plate do - Wait(0) - end - TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1) - end) - cb() -end) - -RegisterNetEvent("bpt_fishermanjob:getStockItem") -AddEventHandler("bpt_fishermanjob:getStockItem", function(itemName, count) - local xPlayer = ESX.GetPlayerFromId(source) - - if xPlayer.job.name == "fisherman" then - TriggerEvent("bpt_addoninventory:getSharedInventory", "society_fisherman", function(inventory) - local item = inventory.getItem(itemName) - - -- is there enough in the society? - if count > 0 and item.count >= count then - -- can the player carry the said amount of x item? - if xPlayer.canCarryItem(itemName, count) then - inventory.removeItem(itemName, count) - xPlayer.addInventoryItem(itemName, count) - xPlayer.showNotification(TranslateCap("have_withdrawn", count, item.label)) - else - xPlayer.showNotification(TranslateCap("player_cannot_hold")) - end - else - xPlayer.showNotification(TranslateCap("quantity_invalid")) - end - end) - else - print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_fishermanjob:getStockItem^7 (cheating)"):format(source)) - end -end) - -ESX.RegisterServerCallback("bpt_fishermanjob:getStockItems", function(_, cb) - TriggerEvent("bpt_addoninventory:getSharedInventory", "society_fisherman", function(inventory) - cb(inventory.items) - end) -end) - -RegisterNetEvent("bpt_fishermanjob:putStockItems") -AddEventHandler("bpt_fishermanjob:putStockItems", function(itemName, count) - local xPlayer = ESX.GetPlayerFromId(source) - local sourceItem = xPlayer.getInventoryItem(itemName) - - if xPlayer.job.name == "fisherman" then - TriggerEvent("bpt_addoninventory:getSharedInventory", "society_fisherman", function(inventory) - local item = inventory.getItem(itemName) - - if sourceItem.count >= count and count > 0 then - xPlayer.removeInventoryItem(itemName, count) - inventory.addItem(itemName, count) - xPlayer.showNotification(TranslateCap("have_deposited", count, item.label)) - else - xPlayer.showNotification(TranslateCap("quantity_invalid")) - end - end) - else - print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_fishermanjob:putStockItems^7 (cheating)"):format(source)) - end -end) diff --git a/server-data/resources/[bpt_addons]/bpt_idcard/html/assets/js/materialize.js b/server-data/resources/[bpt_addons]/bpt_idcard/html/assets/js/materialize.js index 48cc41287..79f6d7c12 100644 --- a/server-data/resources/[bpt_addons]/bpt_idcard/html/assets/js/materialize.js +++ b/server-data/resources/[bpt_addons]/bpt_idcard/html/assets/js/materialize.js @@ -3,6 +3,7 @@ * Copyright 2014-2017 Materialize * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE) */ +// eslint-disable-next-line max-statements-per-line const _get = function get(object, property, receiver) { // eslint-disable-next-line max-statements-per-line if (object === null) object = Function.prototype; const desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { @@ -31,15 +32,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons (function(factory) { window.cash = factory(); })(function() { + // eslint-disable-next-line prefer-const const doc = document, + // eslint-disable-next-line prefer-const win = window, + // eslint-disable-next-line prefer-const ArrayProto = Array.prototype, + // eslint-disable-next-line prefer-const slice = ArrayProto.slice, + // eslint-disable-next-line prefer-const filter = ArrayProto.filter, push = ArrayProto.push; - // eslint-disable-next-line no-empty-function + // eslint-disable-next-line prefer-const, no-empty-function const noop = function() { }, + // eslint-disable-next-line prefer-const isFunction = function(item) { // @see https://crbug.com/568448 return typeof item === typeof noop && item.call; @@ -48,8 +55,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons return typeof item === typeof ''; }; + // eslint-disable-next-line prefer-const const idMatch = /^#[\w-]*$/, + // eslint-disable-next-line prefer-const classMatch = /^\.[\w-]*$/, + // eslint-disable-next-line prefer-const htmlMatch = /<.+>/, singlet = /^\w+$/; @@ -82,53 +92,53 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons } } - class Init { - constructor(selector, context) { - if (!selector) { - return this; - } + function Init(selector, context) { + if (!selector) { + return this; + } - // If already a cash collection, don't do any further processing - if (selector.cash && selector !== win) { - return selector; - } + // If already a cash collection, don't do any further processing + if (selector.cash && selector !== win) { + return selector; + } - let elems = selector, i = 0, length; + let elems = selector, + i = 0, + length; - if (isString(selector)) { - elems = idMatch.test(selector) ? - // If an ID use the faster getElementById check - doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? - // If HTML, parse it into real elements - parseHTML(selector) : - // else use `find` - find(selector, context); + if (isString(selector)) { + elems = idMatch.test(selector) ? + // If an ID use the faster getElementById check + doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ? + // If HTML, parse it into real elements + parseHTML(selector) : + // else use `find` + find(selector, context); - // If function, use as shortcut for DOM ready - } - else if (isFunction(selector)) { - onReady(selector); return this; - } + // If function, use as shortcut for DOM ready + } + else if (isFunction(selector)) { + onReady(selector); return this; + } - if (!elems) { - return this; - } + if (!elems) { + return this; + } - // If a single DOM element is passed in or received via ID, return the single element - if (elems.nodeType || elems === win) { - this[0] = elems; - this.length = 1; - } - else { - // Treat like an array and loop through each item. - length = this.length = elems.length; - for (; i < length; i++) { - this[i] = elems[i]; - } + // If a single DOM element is passed in or received via ID, return the single element + if (elems.nodeType || elems === win) { + this[0] = elems; + this.length = 1; + } + else { + // Treat like an array and loop through each item. + length = this.length = elems.length; + for (; i < length; i++) { + this[i] = elems[i]; } - - return this; } + + return this; } function cash(selector, context) { @@ -298,1832 +308,1654 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons }); - const notWhiteMatch = /\S+/g; - - function getClasses(c) { - return isString(c) && c.match(notWhiteMatch); - } - - function hasClass(v, c) { - return v.classList ? v.classList.contains(c) : new RegExp('(^| )' + c + '( |$)', 'gi').test(v.className); - } + var notWhiteMatch = /\S+/g; + + function getClasses(c) { + return isString(c) && c.match(notWhiteMatch); + } + + function hasClass(v, c) { + return v.classList ? v.classList.contains(c) : new RegExp("(^| )" + c + "( |$)", "gi").test(v.className); + } + + function addClass(v, c, spacedName) { + if (v.classList) { + v.classList.add(c); + } else if (spacedName.indexOf(" " + c + " ")) { + v.className += " " + c; + } + } + + function removeClass(v, c) { + if (v.classList) { + v.classList.remove(c); + } else { + v.className = v.className.replace(c, ""); + } + } + + fn.extend({ + addClass: function (c) { + var classes = getClasses(c); + + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + addClass(v, c, spacedName); + }); + }) : this; + }, + + attr: function (name, value) { + if (!name) { + return undefined; + } + + if (isString(name)) { + if (value === undefined) { + return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; + } + + return this.each(function (v) { + if (v.setAttribute) { + v.setAttribute(name, value); + } else { + v[name] = value; + } + }); + } + + for (var key in name) { + this.attr(key, name[key]); + } + + return this; + }, + + hasClass: function (c) { + var check = false, + classes = getClasses(c); + if (classes && classes.length) { + this.each(function (v) { + check = hasClass(v, classes[0]); + return !check; + }); + } + return check; + }, + + prop: function (name, value) { + if (isString(name)) { + return value === undefined ? this[0][name] : this.each(function (v) { + v[name] = value; + }); + } + + for (var key in name) { + this.prop(key, name[key]); + } + + return this; + }, + + removeAttr: function (name) { + return this.each(function (v) { + if (v.removeAttribute) { + v.removeAttribute(name); + } else { + delete v[name]; + } + }); + }, + + removeClass: function (c) { + if (!arguments.length) { + return this.attr("class", ""); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + each(classes, function (c) { + removeClass(v, c); + }); + }) : this; + }, + + removeProp: function (name) { + return this.each(function (v) { + delete v[name]; + }); + }, + + toggleClass: function (c, state) { + if (state !== undefined) { + return this[state ? "addClass" : "removeClass"](c); + } + var classes = getClasses(c); + return classes ? this.each(function (v) { + var spacedName = " " + v.className + " "; + each(classes, function (c) { + if (hasClass(v, c)) { + removeClass(v, c); + } else { + addClass(v, c, spacedName); + } + }); + }) : this; + } + }); + + fn.extend({ + add: function (selector, context) { + return unique(cash.merge(this, cash(selector, context))); + }, + + each: function (callback) { + each(this, callback); + return this; + }, + + eq: function (index) { + return cash(this.get(index)); + }, + + filter: function (selector) { + if (!selector) { + return this; + } + + var comparator = isFunction(selector) ? selector : getCompareFunction(selector); + + return cash(filter.call(this, function (e) { + return comparator(e, selector); + })); + }, + + first: function () { + return this.eq(0); + }, + + get: function (index) { + if (index === undefined) { + return slice.call(this); + } + return index < 0 ? this[index + this.length] : this[index]; + }, + + index: function (elem) { + var child = elem ? cash(elem)[0] : this[0], + collection = elem ? this : cash(child).parent().children(); + return slice.call(collection).indexOf(child); + }, + + last: function () { + return this.eq(-1); + } + + }); + + var camelCase = function () { + var camelRegex = /(?:^\w|[A-Z]|\b\w)/g, + whiteSpace = /[\s-_]+/g; + return function (str) { + return str.replace(camelRegex, function (letter, index) { + return letter[index === 0 ? "toLowerCase" : "toUpperCase"](); + }).replace(whiteSpace, ""); + }; + }(); + + var getPrefixedProp = function () { + var cache = {}, + doc = document, + div = doc.createElement("div"), + style = div.style; + + return function (prop) { + prop = camelCase(prop); + if (cache[prop]) { + return cache[prop]; + } + + var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), + prefixes = ["webkit", "moz", "ms", "o"], + props = (prop + " " + prefixes.join(ucProp + " ") + ucProp).split(" "); + + each(props, function (p) { + if (p in style) { + cache[p] = prop = cache[prop] = p; + return false; + } + }); + + return cache[prop]; + }; + }(); + + cash.prefixedProp = getPrefixedProp; + cash.camelCase = camelCase; + + fn.extend({ + css: function (prop, value) { + if (isString(prop)) { + prop = getPrefixedProp(prop); + return arguments.length > 1 ? this.each(function (v) { + return v.style[prop] = value; + }) : win.getComputedStyle(this[0])[prop]; + } + + for (var key in prop) { + this.css(key, prop[key]); + } + + return this; + } + + }); + + function compute(el, prop) { + return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; + } + + each(["Width", "Height"], function (v) { + var lower = v.toLowerCase(); + + fn[lower] = function () { + return this[0].getBoundingClientRect()[lower]; + }; + + fn["inner" + v] = function () { + return this[0]["client" + v]; + }; + + fn["outer" + v] = function (margins) { + return this[0]["offset" + v] + (margins ? compute(this, "margin" + (v === "Width" ? "Left" : "Top")) + compute(this, "margin" + (v === "Width" ? "Right" : "Bottom")) : 0); + }; + }); + + function registerEvent(node, eventName, callback) { + var eventCache = getData(node, "_cashEvents") || setData(node, "_cashEvents", {}); + eventCache[eventName] = eventCache[eventName] || []; + eventCache[eventName].push(callback); + node.addEventListener(eventName, callback); + } + + function removeEvent(node, eventName, callback) { + var events = getData(node, "_cashEvents"), + eventCache = events && events[eventName], + index; + + if (!eventCache) { + return; + } + + if (callback) { + node.removeEventListener(eventName, callback); + index = eventCache.indexOf(callback); + if (index >= 0) { + eventCache.splice(index, 1); + } + } else { + each(eventCache, function (event) { + node.removeEventListener(eventName, event); + }); + eventCache = []; + } + } + + fn.extend({ + off: function (eventName, callback) { + return this.each(function (v) { + return removeEvent(v, eventName, callback); + }); + }, + + on: function (eventName, delegate, callback, runOnce) { + // jshint ignore:line + var originalCallback; + if (!isString(eventName)) { + for (var key in eventName) { + this.on(key, delegate, eventName[key]); + } + return this; + } + + if (isFunction(delegate)) { + callback = delegate; + delegate = null; + } + + if (eventName === "ready") { + onReady(callback); + return this; + } + + if (delegate) { + originalCallback = callback; + callback = function (e) { + var t = e.target; + while (!matches(t, delegate)) { + if (t === this || t === null) { + return t = false; + } + + t = t.parentNode; + } + + if (t) { + originalCallback.call(t, e); + } + }; + } + + return this.each(function (v) { + var finalCallback = callback; + if (runOnce) { + finalCallback = function () { + callback.apply(this, arguments); + removeEvent(v, eventName, finalCallback); + }; + } + registerEvent(v, eventName, finalCallback); + }); + }, + + one: function (eventName, delegate, callback) { + return this.on(eventName, delegate, callback, true); + }, + + ready: onReady, + + /** + * Modified + * Triggers browser event + * @param String eventName + * @param Object data - Add properties to event object + */ + trigger: function (eventName, data) { + if (document.createEvent) { + var evt = document.createEvent('HTMLEvents'); + evt.initEvent(eventName, true, false); + evt = this.extend(evt, data); + return this.each(function (v) { + return v.dispatchEvent(evt); + }); + } + } + + }); + + function encode(name, value) { + return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+"); + } + + function getSelectMultiple_(el) { + var values = []; + each(el.options, function (o) { + if (o.selected) { + values.push(o.value); + } + }); + return values.length ? values : null; + } + + function getSelectSingle_(el) { + var selectedIndex = el.selectedIndex; + return selectedIndex >= 0 ? el.options[selectedIndex].value : null; + } + + function getValue(el) { + var type = el.type; + if (!type) { + return null; + } + switch (type.toLowerCase()) { + case "select-one": + return getSelectSingle_(el); + case "select-multiple": + return getSelectMultiple_(el); + case "radio": + return el.checked ? el.value : null; + case "checkbox": + return el.checked ? el.value : null; + default: + return el.value ? el.value : null; + } + } + + fn.extend({ + serialize: function () { + var query = ""; + + each(this[0].elements || this, function (el) { + if (el.disabled || el.tagName === "FIELDSET") { + return; + } + var name = el.name; + switch (el.type.toLowerCase()) { + case "file": + case "reset": + case "submit": + case "button": + break; + case "select-multiple": + var values = getValue(el); + if (values !== null) { + each(values, function (value) { + query += encode(name, value); + }); + } + break; + default: + var value = getValue(el); + if (value !== null) { + query += encode(name, value); + } + } + }); + + return query.substr(1); + }, + + val: function (value) { + if (value === undefined) { + return getValue(this[0]); + } + + return this.each(function (v) { + return v.value = value; + }); + } + + }); + + function insertElement(el, child, prepend) { + if (prepend) { + var first = el.childNodes[0]; + el.insertBefore(child, first); + } else { + el.appendChild(child); + } + } + + function insertContent(parent, child, prepend) { + var str = isString(child); + + if (!str && child.length) { + each(child, function (v) { + return insertContent(parent, v, prepend); + }); + return; + } + + each(parent, str ? function (v) { + return v.insertAdjacentHTML(prepend ? "afterbegin" : "beforeend", child); + } : function (v, i) { + return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); + }); + } + + fn.extend({ + after: function (selector) { + cash(selector).insertAfter(this); + return this; + }, + + append: function (content) { + insertContent(this, content); + return this; + }, + + appendTo: function (parent) { + insertContent(cash(parent), this); + return this; + }, + + before: function (selector) { + cash(selector).insertBefore(this); + return this; + }, + + clone: function () { + return cash(this.map(function (v) { + return v.cloneNode(true); + })); + }, + + empty: function () { + this.html(""); + return this; + }, + + html: function (content) { + if (content === undefined) { + return this[0].innerHTML; + } + var source = content.nodeType ? content[0].outerHTML : content; + return this.each(function (v) { + return v.innerHTML = source; + }); + }, + + insertAfter: function (selector) { + var _this = this; + + cash(selector).each(function (el, i) { + var parent = el.parentNode, + sibling = el.nextSibling; + _this.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); + }); + }); + + return this; + }, + + insertBefore: function (selector) { + var _this2 = this; + cash(selector).each(function (el, i) { + var parent = el.parentNode; + _this2.each(function (v) { + parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); + }); + }); + return this; + }, + + prepend: function (content) { + insertContent(this, content, true); + return this; + }, + + prependTo: function (parent) { + insertContent(cash(parent), this, true); + return this; + }, + + remove: function () { + return this.each(function (v) { + if (!!v.parentNode) { + return v.parentNode.removeChild(v); + } + }); + }, + + text: function (content) { + if (content === undefined) { + return this[0].textContent; + } + return this.each(function (v) { + return v.textContent = content; + }); + } + + }); + + var docEl = doc.documentElement; + + fn.extend({ + position: function () { + var el = this[0]; + return { + left: el.offsetLeft, + top: el.offsetTop + }; + }, + + offset: function () { + var rect = this[0].getBoundingClientRect(); + return { + top: rect.top + win.pageYOffset - docEl.clientTop, + left: rect.left + win.pageXOffset - docEl.clientLeft + }; + }, + + offsetParent: function () { + return cash(this[0].offsetParent); + } + + }); + + fn.extend({ + children: function (selector) { + var elems = []; + this.each(function (el) { + push.apply(elems, el.children); + }); + elems = unique(elems); + + return !selector ? elems : elems.filter(function (v) { + return matches(v, selector); + }); + }, + + closest: function (selector) { + if (!selector || this.length < 1) { + return cash(); + } + if (this.is(selector)) { + return this.filter(selector); + } + return this.parent().closest(selector); + }, + + is: function (selector) { + if (!selector) { + return false; + } + + var match = false, + comparator = getCompareFunction(selector); + + this.each(function (el) { + match = comparator(el, selector); + return !match; + }); + + return match; + }, + + find: function (selector) { + if (!selector || selector.nodeType) { + return cash(selector && this.has(selector).length ? selector : null); + } + + var elems = []; + this.each(function (el) { + push.apply(elems, find(selector, el)); + }); + + return unique(elems); + }, + + has: function (selector) { + var comparator = isString(selector) ? function (el) { + return find(selector, el).length !== 0; + } : function (el) { + return el.contains(selector); + }; + + return this.filter(comparator); + }, + + next: function () { + return cash(this[0].nextElementSibling); + }, + + not: function (selector) { + if (!selector) { + return this; + } + + var comparator = getCompareFunction(selector); + + return this.filter(function (el) { + return !comparator(el, selector); + }); + }, + + parent: function () { + var result = []; + + this.each(function (item) { + if (item && item.parentNode) { + result.push(item.parentNode); + } + }); + + return unique(result); + }, + + parents: function (selector) { + var last, + result = []; + + this.each(function (item) { + last = item; + + while (last && last.parentNode && last !== doc.body.parentNode) { + last = last.parentNode; + + if (!selector || selector && matches(last, selector)) { + result.push(last); + } + } + }); + + return unique(result); + }, + + prev: function () { + return cash(this[0].previousElementSibling); + }, + + siblings: function (selector) { + var collection = this.parent().children(selector), + el = this[0]; + + return collection.filter(function (i) { + return i !== el; + }); + } - function addClass(v, c, spacedName) { - if (v.classList) { - v.classList.add(c); - } - else if (spacedName.indexOf(' ' + c + ' ')) { - v.className += ' ' + c; - } - } + }); - function removeClass(v, c) { - if (v.classList) { - v.classList.remove(c); - } - else { - v.className = v.className.replace(c, ''); - } - } + return cash; +}); +; +var Component = function () { + /** + * Generic constructor for all components + * @constructor + * @param {Element} el + * @param {Object} options + */ + function Component(classDef, el, options) { + _classCallCheck(this, Component); - fn.extend({ - addClass: function(c) { - const classes = getClasses(c); - - return classes ? this.each(function(v) { - const spacedName = ' ' + v.className + ' '; - // eslint-disable-next-line no-shadow - each(classes, function(c) { - addClass(v, c, spacedName); - }); - }) : this; - }, + // Display error if el is valid HTML Element + if (!(el instanceof Element)) { + console.error(Error(el + ' is not an HTML Element')); + } - attr: function(name, value) { - if (!name) { - return undefined; - } + // If exists, destroy and reinitialize in child + var ins = classDef.getInstance(el); + if (!!ins) { + ins.destroy(); + } - if (isString(name)) { - if (value === undefined) { - return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined; - } + this.el = el; + this.$el = cash(el); + } - return this.each(function(v) { - if (v.setAttribute) { - v.setAttribute(name, value); - } - else { - v[name] = value; - } - }); - } + /** + * Initializes components + * @param {class} classDef + * @param {Element | NodeList | jQuery} els + * @param {Object} options + */ - for (const key in name) { - this.attr(key, name[key]); - } - return this; - }, + _createClass(Component, null, [{ + key: "init", + value: function init(classDef, els, options) { + var instances = null; + if (els instanceof Element) { + instances = new classDef(els, options); + } else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { + var instancesArr = []; + for (var i = 0; i < els.length; i++) { + instancesArr.push(new classDef(els[i], options)); + } + instances = instancesArr; + } + + return instances; + } + }]); + + return Component; +}(); - hasClass: function(c) { - let check = false, - // eslint-disable-next-line prefer-const - classes = getClasses(c); - if (classes && classes.length) { - this.each(function(v) { - check = hasClass(v, classes[0]); - return !check; - }); - } - return check; - }, +; // Required for Meteor package, the use of window prevents export by Meteor +(function (window) { + if (window.Package) { + M = {}; + } else { + window.M = {}; + } - prop: function(name, value) { - if (isString(name)) { - return value === undefined ? this[0][name] : this.each(function(v) { - v[name] = value; - }); - } + // Check for jQuery + M.jQueryLoaded = !!window.jQuery; +})(window); - for (const key in name) { - this.prop(key, name[key]); - } +// AMD +if (typeof define === "function" && define.amd) { + define("M", [], function () { + return M; + }); + + // Common JS +} else if (typeof exports !== 'undefined' && !exports.nodeType) { + if (typeof module !== 'undefined' && !module.nodeType && module.exports) { + exports = module.exports = M; + } + exports.default = M; +} - return this; - }, +M.keys = { + TAB: 9, + ENTER: 13, + ESC: 27, + ARROW_UP: 38, + ARROW_DOWN: 40 +}; - removeAttr: function(name) { - return this.each(function(v) { - if (v.removeAttribute) { - v.removeAttribute(name); - } - else { - delete v[name]; - } - }); - }, +/** + * TabPress Keydown handler + */ +M.tabPressed = false; +var docHandleKeydown = function (e) { + if (e.which === M.keys.TAB) { + M.tabPressed = true; + } +}; +var docHandleKeyup = function (e) { + if (e.which === M.keys.TAB) { + M.tabPressed = false; + } +}; +document.addEventListener('keydown', docHandleKeydown); +document.addEventListener('keyup', docHandleKeyup); - removeClass: function(c) { - if (!arguments.length) { - return this.attr('class', ''); - } - const classes = getClasses(c); - return classes ? this.each(function(v) { - // eslint-disable-next-line no-shadow - each(classes, function(c) { - removeClass(v, c); - }); - }) : this; - }, +/** + * Initialize jQuery wrapper for plugin + * @param {Class} plugin javascript class + * @param {string} pluginName jQuery plugin name + * @param {string} classRef Class reference name + */ +M.initializeJqueryWrapper = function (plugin, pluginName, classRef) { + jQuery.fn[pluginName] = function (methodOrOptions) { + // Call plugin method if valid method name is passed in + if (plugin.prototype[methodOrOptions]) { + var params = Array.prototype.slice.call(arguments, 1); + + // Getter methods + if (methodOrOptions.slice(0, 3) === 'get') { + var instance = this.first()[0][classRef]; + return instance[methodOrOptions].apply(instance, params); + } + + // Void methods + return this.each(function () { + var instance = this[classRef]; + instance[methodOrOptions].apply(instance, params); + }); + + // Initialize plugin if options or no argument is passed in + } else if (typeof methodOrOptions === 'object' || !methodOrOptions) { + plugin.init(this, arguments[0]); + return this; + } + + // Return error if an unrecognized method name is passed in + jQuery.error("Method " + methodOrOptions + " does not exist on jQuery." + pluginName); + }; +}; - removeProp: function(name) { - return this.each(function(v) { - delete v[name]; - }); - }, +/** + * Automatically initialize components + * @param {Element} context DOM Element to search within for components + */ +M.AutoInit = function (context) { + // Use document.body if no context is given + var root = !!context ? context : document.body; + + var registry = { + Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), + Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), + Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), + Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), + Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), + Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), + Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), + Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), + Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), + Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), + ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), + FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), + Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), + Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), + TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), + Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), + Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), + FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)') + }; + + for (var pluginName in registry) { + var plugin = M[pluginName]; + plugin.init(registry[pluginName]); + } +}; - toggleClass: function(c, state) { - if (state !== undefined) { - return this[state ? 'addClass' : 'removeClass'](c); - } - const classes = getClasses(c); - return classes ? this.each(function(v) { - const spacedName = ' ' + v.className + ' '; - // eslint-disable-next-line no-shadow - each(classes, function(c) { - if (hasClass(v, c)) { - removeClass(v, c); - } - else { - addClass(v, c, spacedName); - } - }); - }) : this; - }, - }); +/** + * Generate approximated selector string for a jQuery object + * @param {jQuery} obj jQuery object to be parsed + * @returns {string} + */ +M.objectSelectorString = function (obj) { + var tagStr = obj.prop('tagName') || ''; + var idStr = obj.attr('id') || ''; + var classStr = obj.attr('class') || ''; + return (tagStr + idStr + classStr).replace(/\s/g, ''); +}; - fn.extend({ - add: function(selector, context) { - return unique(cash.merge(this, cash(selector, context))); - }, +// Unique Random ID +M.guid = function () { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); + } + return function () { + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); + }; +}(); - each: function(callback) { - each(this, callback); - return this; - }, +/** + * Escapes hash from special characters + * @param {string} hash String returned from this.hash + * @returns {string} + */ +M.escapeHash = function (hash) { + return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, "\\$1"); +}; - eq: function(index) { - return cash(this.get(index)); - }, +M.elementOrParentIsFixed = function (element) { + var $element = $(element); + var $checkElements = $element.add($element.parents()); + var isFixed = false; + $checkElements.each(function () { + if ($(this).css("position") === "fixed") { + isFixed = true; + return false; + } + }); + return isFixed; +}; - filter: function(selector) { - if (!selector) { - return this; - } +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ - const comparator = isFunction(selector) ? selector : getCompareFunction(selector); +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ - return cash(filter.call(this, function(e) { - return comparator(e, selector); - })); - }, +/** + * Escapes hash from special characters + * @param {Element} container Container element that acts as the boundary + * @param {Bounding} bounding element bounding that is being checked + * @param {Number} offset offset from edge that counts as exceeding + * @returns {Edges} + */ +M.checkWithinContainer = function (container, bounding, offset) { + var edges = { + top: false, + right: false, + bottom: false, + left: false + }; - first: function() { - return this.eq(0); - }, + var containerRect = container.getBoundingClientRect(); - get: function(index) { - if (index === undefined) { - return slice.call(this); - } - return index < 0 ? this[index + this.length] : this[index]; - }, + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; - index: function(elem) { - // eslint-disable-next-line prefer-const - let child = elem ? cash(elem)[0] : this[0], - // eslint-disable-next-line prefer-const - collection = elem ? this : cash(child).parent().children(); - return slice.call(collection).indexOf(child); - }, + var scrolledX = bounding.left - scrollLeft; + var scrolledY = bounding.top - scrollTop; - last: function() { - return this.eq(-1); - }, + // Check for container and viewport for each edge + if (scrolledX < containerRect.left + offset || scrolledX < offset) { + edges.left = true; + } - }); + if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { + edges.right = true; + } - const camelCase = function() { - const camelRegex = /(?:^\w|[A-Z]|\b\w)/g, - whiteSpace = /[\s-_]+/g; - return function(str) { - return str.replace(camelRegex, function(letter, index) { - return letter[index === 0 ? 'toLowerCase' : 'toUpperCase'](); - }).replace(whiteSpace, ''); - }; - }(); - - const getPrefixedProp = function() { - const cache = {}, - // eslint-disable-next-line no-shadow - doc = document, - div = doc.createElement('div'), - style = div.style; - - return function(prop) { - prop = camelCase(prop); - if (cache[prop]) { - return cache[prop]; - } + if (scrolledY < containerRect.top + offset || scrolledY < offset) { + edges.top = true; + } - const ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), - prefixes = ['webkit', 'moz', 'ms', 'o'], - props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' '); + if (scrolledY + bounding.height > containerRect.bottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { + edges.bottom = true; + } - each(props, function(p) { - if (p in style) { - cache[p] = prop = cache[prop] = p; - return false; - } - }); + return edges; +}; - return cache[prop]; - }; - }(); +M.checkPossibleAlignments = function (el, container, bounding, offset) { + var canAlign = { + top: true, + right: true, + bottom: true, + left: true, + spaceOnTop: null, + spaceOnRight: null, + spaceOnBottom: null, + spaceOnLeft: null + }; + + var containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; + var containerRect = container.getBoundingClientRect(); + var containerHeight = Math.min(containerRect.height, window.innerHeight); + var containerWidth = Math.min(containerRect.width, window.innerWidth); + var elOffsetRect = el.getBoundingClientRect(); + + var scrollLeft = container.scrollLeft; + var scrollTop = container.scrollTop; + + var scrolledX = bounding.left - scrollLeft; + var scrolledYTopEdge = bounding.top - scrollTop; + var scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; + + // Check for container and viewport for left + canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); + if (canAlign.spaceOnRight < 0) { + canAlign.left = false; + } + + // Check for container and viewport for Right + canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; + if (canAlign.spaceOnLeft < 0) { + canAlign.right = false; + } + + // Check for container and viewport for Top + canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); + if (canAlign.spaceOnBottom < 0) { + canAlign.top = false; + } + + // Check for container and viewport for Bottom + canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); + if (canAlign.spaceOnTop < 0) { + canAlign.bottom = false; + } + + return canAlign; +}; - cash.prefixedProp = getPrefixedProp; - cash.camelCase = camelCase; +M.getOverflowParent = function (element) { + if (element == null) { + return null; + } - fn.extend({ - css: function(prop, value) { - if (isString(prop)) { - prop = getPrefixedProp(prop); - return arguments.length > 1 ? this.each(function(v) { - return v.style[prop] = value; - }) : win.getComputedStyle(this[0])[prop]; - } + if (element === document.body || getComputedStyle(element).overflow !== 'visible') { + return element; + } - for (const key in prop) { - this.css(key, prop[key]); - } + return M.getOverflowParent(element.parentElement); +}; - return this; - }, +/** + * Gets id of component from a trigger + * @param {Element} trigger trigger + * @returns {string} + */ +M.getIdFromTrigger = function (trigger) { + var id = trigger.getAttribute('data-target'); + if (!id) { + id = trigger.getAttribute('href'); + if (id) { + id = id.slice(1); + } else { + id = ""; + } + } + return id; +}; - }); +/** + * Multi browser support for document scroll top + * @returns {Number} + */ +M.getDocumentScrollTop = function () { + return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; +}; - function compute(el, prop) { - return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0; - } +/** + * Multi browser support for document scroll left + * @returns {Number} + */ +M.getDocumentScrollLeft = function () { + return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; +}; - each(['Width', 'Height'], function(v) { - const lower = v.toLowerCase(); +/** + * @typedef {Object} Edges + * @property {Boolean} top If the top edge was exceeded + * @property {Boolean} right If the right edge was exceeded + * @property {Boolean} bottom If the bottom edge was exceeded + * @property {Boolean} left If the left edge was exceeded + */ - fn[lower] = function() { - return this[0].getBoundingClientRect()[lower]; - }; +/** + * @typedef {Object} Bounding + * @property {Number} left left offset coordinate + * @property {Number} top top offset coordinate + * @property {Number} width + * @property {Number} height + */ - fn['inner' + v] = function() { - return this[0]['client' + v]; - }; +/** + * Get time in ms + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @type {function} + * @return {number} + */ +var getTime = Date.now || function () { + return new Date().getTime(); +}; - fn['outer' + v] = function(margins) { - return this[0]['offset' + v] + (margins ? compute(this, 'margin' + (v === 'Width' ? 'Left' : 'Top')) + compute(this, 'margin' + (v === 'Width' ? 'Right' : 'Bottom')) : 0); - }; - }); +/** + * Returns a function, that, when invoked, will only be triggered at most once + * during a given window of time. Normally, the throttled function will run + * as much as it can, without ever going more than once per `wait` duration; + * but if you'd like to disable the execution on the leading edge, pass + * `{leading: false}`. To disable execution on the trailing edge, ditto. + * @license https://raw.github.com/jashkenas/underscore/master/LICENSE + * @param {function} func + * @param {number} wait + * @param {Object=} options + * @returns {Function} + */ +M.throttle = function (func, wait, options) { + var context = void 0, + args = void 0, + result = void 0; + var timeout = null; + var previous = 0; + options || (options = {}); + var later = function () { + previous = options.leading === false ? 0 : getTime(); + timeout = null; + result = func.apply(context, args); + context = args = null; + }; + return function () { + var now = getTime(); + if (!previous && options.leading === false) previous = now; + var remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result; + }; +}; +; /* + v2.2.0 + 2017 Julian Garnier + Released under the MIT license + */ +var $jscomp = { scope: {} }; $jscomp.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, r, p) { + if (p.get || p.set) throw new TypeError("ES3 does not support getters and setters."); e != Array.prototype && e != Object.prototype && (e[r] = p.value); +}; $jscomp.getGlobal = function (e) { + return "undefined" != typeof window && window === e ? e : "undefined" != typeof global && null != global ? global : e; +}; $jscomp.global = $jscomp.getGlobal(this); $jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; +$jscomp.initSymbol = function () { + $jscomp.initSymbol = function () { }; $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); +}; $jscomp.symbolCounter_ = 0; $jscomp.Symbol = function (e) { + return $jscomp.SYMBOL_PREFIX + (e || "") + $jscomp.symbolCounter_++; +}; +$jscomp.initSymbolIterator = function () { + $jscomp.initSymbol(); var e = $jscomp.global.Symbol.iterator; e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")); "function" != typeof Array.prototype[e] && $jscomp.defineProperty(Array.prototype, e, { + configurable: !0, writable: !0, value: function () { + return $jscomp.arrayIterator(this); + } + }); $jscomp.initSymbolIterator = function () { }; +}; $jscomp.arrayIterator = function (e) { + var r = 0; return $jscomp.iteratorPrototype(function () { + return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; + }); +}; +$jscomp.iteratorPrototype = function (e) { + $jscomp.initSymbolIterator(); e = { next: e }; e[$jscomp.global.Symbol.iterator] = function () { + return this; + }; return e; +}; $jscomp.array = $jscomp.array || {}; $jscomp.iteratorFromArray = function (e, r) { + $jscomp.initSymbolIterator(); e instanceof String && (e += ""); var p = 0, + m = { + next: function () { + if (p < e.length) { + var u = p++; return { value: r(u, e[u]), done: !1 }; + } m.next = function () { + return { done: !0, value: void 0 }; + }; return m.next(); + } + }; m[Symbol.iterator] = function () { + return m; + }; return m; +}; +$jscomp.polyfill = function (e, r, p, m) { + if (r) { + p = $jscomp.global; e = e.split("."); for (m = 0; m < e.length - 1; m++) { + var u = e[m]; u in p || (p[u] = {}); p = p[u]; + } e = e[e.length - 1]; m = p[e]; r = r(m); r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); + } +}; $jscomp.polyfill("Array.prototype.keys", function (e) { + return e ? e : function () { + return $jscomp.iteratorFromArray(this, function (e) { + return e; + }); + }; +}, "es6-impl", "es3"); var $jscomp$this = this; +(function (r) { + M.anime = r(); +})(function () { + function e(a) { + if (!h.col(a)) try { + return document.querySelectorAll(a); + } catch (c) { } + } function r(a, c) { + for (var d = a.length, b = 2 <= arguments.length ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { + if (n in a) { + var k = a[n]; c.call(b, k, n, a) && f.push(k); + } + } return f; + } function p(a) { + return a.reduce(function (a, d) { + return a.concat(h.arr(d) ? p(d) : d); + }, []); + } function m(a) { + if (h.arr(a)) return a; + h.str(a) && (a = e(a) || a); return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; + } function u(a, c) { + return a.some(function (a) { + return a === c; + }); + } function C(a) { + var c = {}, + d; for (d in a) { + c[d] = a[d]; + } return c; + } function D(a, c) { + var d = C(a), + b; for (b in a) { + d[b] = c.hasOwnProperty(b) ? c[b] : a[b]; + } return d; + } function z(a, c) { + var d = C(a), + b; for (b in c) { + d[b] = h.und(a[b]) ? c[b] : a[b]; + } return d; + } function T(a) { + a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (a, c, d, k) { + return c + c + d + d + k + k; + }); var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); + a = parseInt(c[1], 16); var d = parseInt(c[2], 16), + c = parseInt(c[3], 16); return "rgba(" + a + "," + d + "," + c + ",1)"; + } function U(a) { + function c(a, c, b) { + 0 > b && (b += 1); 1 < b && --b; return b < 1 / 6 ? a + 6 * (c - a) * b : .5 > b ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; + } var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a); a = parseInt(d[1]) / 360; var b = parseInt(d[2]) / 100, + f = parseInt(d[3]) / 100, + d = d[4] || 1; if (0 == b) f = b = a = f; else { + var n = .5 > f ? f * (1 + b) : f + b - f * b, + k = 2 * f - n, + f = c(k, n, a + 1 / 3), + b = c(k, n, a); a = c(k, n, a - 1 / 3); + } return "rgba(" + 255 * f + "," + 255 * b + "," + 255 * a + "," + d + ")"; + } function y(a) { + if (a = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; + } function V(a) { + if (-1 < a.indexOf("translate") || "perspective" === a) return "px"; if (-1 < a.indexOf("rotate") || -1 < a.indexOf("skew")) return "deg"; + } function I(a, c) { + return h.fnc(a) ? a(c.target, c.id, c.total) : a; + } function E(a, c) { + if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0"; + } function J(a, c) { + if (h.dom(a) && u(W, c)) return "transform"; if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return "attribute"; if (h.dom(a) && "transform" !== c && E(a, c)) return "css"; if (null != a[c]) return "object"; + } function X(a, c) { + var d = V(c), + d = -1 < c.indexOf("scale") ? 1 : 0 + d; a = a.style.transform; if (!a) return d; for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { + f.push(b[1]), n.push(b[2]); + } a = r(n, function (a, b) { + return f[b] === c; + }); return a.length ? a[0] : d; + } function K(a, c) { + switch (J(a, c)) { + case "transform": + return X(a, c); case "css": + return E(a, c); case "attribute": + return a.getAttribute(c); + }return a[c] || 0; + } function L(a, c) { + var d = /^(\*=|\+=|-=)/.exec(a); if (!d) return a; var b = y(a) || 0; c = parseFloat(c); a = parseFloat(a.replace(d[0], "")); switch (d[0][0]) { + case "+": + return c + a + b; case "-": + return c - a + b; case "*": + return c * a + b; + } + } function F(a, c) { + return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); + } function M(a) { + a = a.points; for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { + var f = a.getItem(b); 0 < b && (c += F(d, f)); d = f; + } return c; + } function N(a) { + if (a.getTotalLength) return a.getTotalLength(); switch (a.tagName.toLowerCase()) { + case "circle": + return 2 * Math.PI * a.getAttribute("r"); case "rect": + return 2 * a.getAttribute("width") + 2 * a.getAttribute("height"); case "line": + return F({ x: a.getAttribute("x1"), y: a.getAttribute("y1") }, { x: a.getAttribute("x2"), y: a.getAttribute("y2") }); case "polyline": + return M(a); case "polygon": + var c = a.points; return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0)); + } + } function Y(a, c) { + function d(b) { + b = void 0 === b ? 0 : b; return a.el.getPointAtLength(1 <= c + b ? c + b : 0); + } var b = d(), + f = d(-1), + n = d(1); switch (a.property) { + case "x": + return b.x; case "y": + return b.y; + case "angle": + return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI; + } + } function O(a, c) { + var d = /-?\d*\.?\d+/g, + b; b = h.pth(a) ? a.totalLength : a; if (h.col(b)) { + if (h.rgb(b)) { + var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b); b = f ? "rgba(" + f[1] + ",1)" : b; + } else b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0; + } else f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f; b += ""; return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; + } function P(a) { + a = a ? p(h.arr(a) ? a.map(m) : m(a)) : []; return r(a, function (a, d, b) { + return b.indexOf(a) === d; + }); + } function Z(a) { + var c = P(a); return c.map(function (a, b) { + return { target: a, id: b, total: c.length }; + }); + } function aa(a, c) { + var d = C(c); if (h.arr(a)) { + var b = a.length; 2 !== b || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; + } return m(a).map(function (a, b) { + b = b ? 0 : c.delay; a = h.obj(a) && !h.pth(a) ? a : { value: a }; h.und(a.delay) && (a.delay = b); return a; + }).map(function (a) { + return z(a, d); + }); + } function ba(a, c) { + var d = {}, + b; for (b in a) { + var f = I(a[b], c); h.arr(f) && (f = f.map(function (a) { + return I(a, c); + }), 1 === f.length && (f = f[0])); d[b] = f; + } d.duration = parseFloat(d.duration); d.delay = parseFloat(d.delay); return d; + } function ca(a) { + return h.arr(a) ? A.apply(this, a) : Q[a]; + } function da(a, c) { + var d; return a.tweens.map(function (b) { + b = ba(b, c); var f = b.value, + e = K(c.target, a.name), + k = d ? d.to.original : e, + k = h.arr(f) ? f[0] : k, + w = L(h.arr(f) ? f[1] : f, k), + e = y(w) || y(k) || y(e); b.from = O(k, e); b.to = O(w, e); b.start = d ? d.end : a.offset; b.end = b.start + b.delay + b.duration; b.easing = ca(b.easing); b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3; b.isPath = h.pth(f); b.isColor = h.col(b.from.original); b.isColor && (b.round = 1); return d = b; + }); + } function ea(a, c) { + return r(p(a.map(function (a) { + return c.map(function (b) { + var c = J(a.target, b.name); if (c) { + var d = da(b, a); b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; + } else b = void 0; return b; + }); + })), function (a) { + return !h.und(a); + }); + } function R(a, c, d, b) { + var f = "delay" === a; return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function (b) { + return b[a]; + })) : f ? b.delay : d.offset + b.delay + b.duration; + } function fa(a) { + var c = D(ga, a), + d = D(S, a), + b = Z(a.targets), + f = [], + e = z(c, d), + k; for (k in a) { + e.hasOwnProperty(k) || "targets" === k || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); + } a = ea(b, f); return z(c, { children: [], animatables: b, animations: a, duration: R("duration", a, c, d), delay: R("delay", a, c, d) }); + } function q(a) { + function c() { + return window.Promise && new Promise(function (a) { + return p = a; + }); + } function d(a) { + return g.reversed ? g.duration - a : a; + } function b(a) { + for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { + var e = d[b], + k = e.animatable, + h = e.tweens, + n = h.length - 1, + l = h[n]; n && (l = r(h, function (b) { + return a < b.end; + })[0] || l); for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { + var x = void 0, + x = l.to.numbers[t], + q = l.from.numbers[t], + x = l.isPath ? Y(l.value, w * x) : q + w * (x - q); p && (l.isColor && 2 < t || (x = Math.round(x * p) / p)); n.push(x); + } if (l = h.length) for (m = h[0], w = 0; w < l; w++) { + p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + " ")); + } else m = n[0]; ha[e.type](k.target, e.property, m, c, k.id); e.currentValue = m; b++; + } if (b = Object.keys(c).length) for (d = 0; d < b; d++) { + H || (H = E(document.body, "transform") ? "transform" : "-webkit-transform"), g.animatables[d].target.style[H] = c[d].join(" "); + } g.currentTime = a; g.progress = a / g.duration * 100; + } function f(a) { + if (g[a]) g[a](g); + } function e() { + g.remaining && !0 !== g.remaining && g.remaining--; + } function k(a) { + var k = g.duration, + n = g.offset, + w = n + g.delay, + r = g.currentTime, + x = g.reversed, + q = d(a); if (g.children.length) { + var u = g.children, + v = u.length; + if (q >= g.currentTime) for (var G = 0; G < v; G++) { + u[G].seek(q); + } else for (; v--;) { + u[v].seek(q); + } + } if (q >= w || !k) g.began || (g.began = !0, f("begin")), f("run"); if (q > n && q < k) b(q); else if (q <= n && 0 !== r && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e(); f("update"); a >= k && (g.remaining ? (t = h, "alternate" === g.direction && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f("complete"), "Promise" in window && (p(), m = c()))), l = 0); + } a = void 0 === a ? {} : a; var h, + t, + l = 0, + p = null, + m = c(), + g = fa(a); g.reset = function () { + var a = g.direction, + c = g.loop; g.currentTime = 0; g.progress = 0; g.paused = !0; g.began = !1; g.completed = !1; g.reversed = "reverse" === a; g.remaining = "alternate" === a && 1 === c ? 2 : c; b(0); for (a = g.children.length; a--;) { + g.children[a].reset(); + } + }; g.tick = function (a) { + h = a; t || (t = h); k((l + h - t) * q.speed); + }; g.seek = function (a) { + k(d(a)); + }; g.pause = function () { + var a = v.indexOf(g); -1 < a && v.splice(a, 1); g.paused = !0; + }; g.play = function () { + g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); + }; g.reverse = function () { + g.reversed = !g.reversed; t = 0; l = d(g.currentTime); + }; g.restart = function () { + g.pause(); + g.reset(); g.play(); + }; g.finished = m; g.reset(); g.autoplay && g.play(); return g; + } var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: "normal", autoplay: !0, offset: 0 }, + S = { duration: 1E3, delay: 0, easing: "easeOutElastic", elasticity: 500, round: 0 }, + W = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), + H, + h = { + arr: function (a) { + return Array.isArray(a); + }, obj: function (a) { + return -1 < Object.prototype.toString.call(a).indexOf("Object"); + }, + pth: function (a) { + return h.obj(a) && a.hasOwnProperty("totalLength"); + }, svg: function (a) { + return a instanceof SVGElement; + }, dom: function (a) { + return a.nodeType || h.svg(a); + }, str: function (a) { + return "string" === typeof a; + }, fnc: function (a) { + return "function" === typeof a; + }, und: function (a) { + return "undefined" === typeof a; + }, hex: function (a) { + return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) + ); + }, rgb: function (a) { + return (/^rgb/.test(a) + ); + }, hsl: function (a) { + return (/^hsl/.test(a) + ); + }, col: function (a) { + return h.hex(a) || h.rgb(a) || h.hsl(a); + } + }, + A = function () { + function a(a, d, b) { + return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; + } return function (c, d, b, f) { + if (0 <= c && 1 >= c && 0 <= b && 1 >= b) { + var e = new Float32Array(11); if (c !== d || b !== f) for (var k = 0; 11 > k; ++k) { + e[k] = a(.1 * k, c, b); + } return function (k) { + if (c === d && b === f) return k; if (0 === k) return 0; if (1 === k) return 1; for (var h = 0, l = 1; 10 !== l && e[l] <= k; ++l) { + h += .1; + } --l; var l = h + (k - e[l]) / (e[l + 1] - e[l]) * .1, + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (.001 <= n) { + for (h = 0; 4 > h; ++h) { + n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (0 === n) break; var m = a(l, c, b) - k, + l = l - m / n; + } k = l; + } else if (0 === n) k = l; else { + var l = h, + h = h + .1, + g = 0; do { + m = l + (h - l) / 2, n = a(m, c, b) - k, 0 < n ? h = m : l = m; + } while (1e-7 < Math.abs(n) && 10 > ++g); k = m; + } return a(k, d, f); + }; + } + }; + }(), + Q = function () { + function a(a, b) { + return 0 === a || 1 === a ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); + } var c = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), + d = { + In: [[.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], a], Out: [[.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function (b, c) { + return 1 - a(1 - b, c); + }], InOut: [[.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function (b, c) { + return .5 > b ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; + }] + }, + b = { linear: A(.25, .25, .75, .75) }, + f = {}, + e; for (e in d) { + f.type = e, d[f.type].forEach(function (a) { + return function (d, f) { + b["ease" + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); + }; + }(f)), f = { type: f.type }; + } return b; + }(), + ha = { + css: function (a, c, d) { + return a.style[c] = d; + }, attribute: function (a, c, d) { + return a.setAttribute(c, d); + }, object: function (a, c, d) { + return a[c] = d; + }, transform: function (a, c, d, b, f) { + b[f] || (b[f] = []); b[f].push(c + "(" + d + ")"); + } + }, + v = [], + B = 0, + ia = function () { + function a() { + B = requestAnimationFrame(c); + } function c(c) { + var b = v.length; if (b) { + for (var d = 0; d < b;) { + v[d] && v[d].tick(c), d++; + } a(); + } else cancelAnimationFrame(B), B = 0; + } return a; + }(); q.version = "2.2.0"; q.speed = 1; q.running = v; q.remove = function (a) { + a = P(a); for (var c = v.length; c--;) { + for (var d = v[c], b = d.animations, f = b.length; f--;) { + u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); + } + } + }; q.getValue = K; q.path = function (a, c) { + var d = h.str(a) ? e(a)[0] : a, + b = c || 100; return function (a) { + return { el: d, property: a, totalLength: N(d) * (b / 100) }; + }; + }; q.setDashoffset = function (a) { + var c = N(a); a.setAttribute("stroke-dasharray", c); return c; + }; q.bezier = A; q.easings = Q; q.timeline = function (a) { + var c = q(a); c.pause(); c.duration = 0; c.add = function (d) { + c.children.forEach(function (a) { + a.began = !0; a.completed = !0; + }); m(d).forEach(function (b) { + var d = z(b, D(S, a || {})); d.targets = d.targets || a.targets; b = c.duration; var e = d.offset; d.autoplay = !1; d.direction = c.direction; d.offset = h.und(e) ? b : L(e, b); c.began = !0; c.completed = !0; c.seek(d.offset); d = q(d); d.began = !0; d.completed = !0; d.duration > b && (c.duration = d.duration); c.children.push(d); + }); c.seek(0); c.reset(); c.autoplay && c.restart(); return c; + }; return c; + }; q.random = function (a, c) { + return Math.floor(Math.random() * (c - a + 1)) + a; + }; return q; +}); +; (function ($, anim) { + 'use strict'; + + var _defaults = { + accordion: true, + onOpenStart: undefined, + onOpenEnd: undefined, + onCloseStart: undefined, + onCloseEnd: undefined, + inDuration: 300, + outDuration: 300 + }; + + /** + * @class + * + */ - function registerEvent(node, eventName, callback) { - const eventCache = getData(node, '_cashEvents') || setData(node, '_cashEvents', {}); - eventCache[eventName] = eventCache[eventName] || []; - eventCache[eventName].push(callback); - node.addEventListener(eventName, callback); - } + var Collapsible = function (_Component) { + _inherits(Collapsible, _Component); - function removeEvent(node, eventName, callback) { - // eslint-disable-next-line prefer-const - let events = getData(node, '_cashEvents'), - eventCache = events && events[eventName], - index; - - if (!eventCache) { - return; - } - - if (callback) { - node.removeEventListener(eventName, callback); - index = eventCache.indexOf(callback); - if (index >= 0) { - eventCache.splice(index, 1); - } - } - else { - each(eventCache, function(event) { - node.removeEventListener(eventName, event); - }); - eventCache = []; - } - } - - fn.extend({ - off: function(eventName, callback) { - return this.each(function(v) { - return removeEvent(v, eventName, callback); - }); - }, - - on: function(eventName, delegate, callback, runOnce) { - // jshint ignore:line - let originalCallback; - if (!isString(eventName)) { - for (const key in eventName) { - this.on(key, delegate, eventName[key]); - } - return this; - } - - if (isFunction(delegate)) { - callback = delegate; - delegate = null; - } - - if (eventName === 'ready') { - onReady(callback); - return this; - } - - if (delegate) { - originalCallback = callback; - callback = function(e) { - let t = e.target; - while (!matches(t, delegate)) { - if (t === this || t === null) { - return t = false; - } - - t = t.parentNode; - } - - if (t) { - originalCallback.call(t, e); - } - }; - } - - return this.each(function(v) { - let finalCallback = callback; - if (runOnce) { - finalCallback = function() { - callback.apply(this, arguments); - removeEvent(v, eventName, finalCallback); - }; - } - registerEvent(v, eventName, finalCallback); - }); - }, - - one: function(eventName, delegate, callback) { - return this.on(eventName, delegate, callback, true); - }, - - ready: onReady, - - /** - * Modified - * Triggers browser event - * @param String eventName - * @param Object data - Add properties to event object - */ - trigger: function(eventName, data) { - if (document.createEvent) { - let evt = document.createEvent('HTMLEvents'); - evt.initEvent(eventName, true, false); - evt = this.extend(evt, data); - return this.each(function(v) { - return v.dispatchEvent(evt); - }); - } - }, - - }); - - function encode(name, value) { - return '&' + encodeURIComponent(name) + '=' + encodeURIComponent(value).replace(/%20/g, '+'); - } - - function getSelectMultiple_(el) { - const values = []; - each(el.options, function(o) { - if (o.selected) { - values.push(o.value); - } - }); - return values.length ? values : null; - } - - function getSelectSingle_(el) { - const selectedIndex = el.selectedIndex; - return selectedIndex >= 0 ? el.options[selectedIndex].value : null; - } - - function getValue(el) { - const type = el.type; - if (!type) { - return null; - } - switch (type.toLowerCase()) { - case 'select-one': - return getSelectSingle_(el); - case 'select-multiple': - return getSelectMultiple_(el); - case 'radio': - return el.checked ? el.value : null; - case 'checkbox': - return el.checked ? el.value : null; - default: - return el.value ? el.value : null; - } - } - - fn.extend({ - serialize: function() { - let query = ''; - - each(this[0].elements || this, function(el) { - if (el.disabled || el.tagName === 'FIELDSET') { - return; - } - const name = el.name; - switch (el.type.toLowerCase()) { - case 'file': - case 'reset': - case 'submit': - case 'button': - break; - case 'select-multiple': - // eslint-disable-next-line no-var - var values = getValue(el); - if (values !== null) { - each(values, function(value) { - query += encode(name, value); - }); - } - break; - default: - // eslint-disable-next-line no-var - var value = getValue(el); - if (value !== null) { - query += encode(name, value); - } - } - }); - - return query.substr(1); - }, - - val: function(value) { - if (value === undefined) { - return getValue(this[0]); - } - - return this.each(function(v) { - return v.value = value; - }); - }, - - }); - - function insertElement(el, child, prepend) { - if (prepend) { - const first = el.childNodes[0]; - el.insertBefore(child, first); - } - else { - el.appendChild(child); - } - } - - function insertContent(parent, child, prepend) { - const str = isString(child); - - if (!str && child.length) { - each(child, function(v) { - return insertContent(parent, v, prepend); - }); - return; - } - - each(parent, str ? function(v) { - return v.insertAdjacentHTML(prepend ? 'afterbegin' : 'beforeend', child); - } : function(v, i) { - return insertElement(v, i === 0 ? child : child.cloneNode(true), prepend); - }); - } - - fn.extend({ - after: function(selector) { - cash(selector).insertAfter(this); - return this; - }, - - append: function(content) { - insertContent(this, content); - return this; - }, - - appendTo: function(parent) { - insertContent(cash(parent), this); - return this; - }, - - before: function(selector) { - cash(selector).insertBefore(this); - return this; - }, - - clone: function() { - return cash(this.map(function(v) { - return v.cloneNode(true); - })); - }, - - empty: function() { - this.html(''); - return this; - }, - - html: function(content) { - if (content === undefined) { - return this[0].innerHTML; - } - const source = content.nodeType ? content[0].outerHTML : content; - return this.each(function(v) { - return v.innerHTML = source; - }); - }, - - insertAfter: function(selector) { - const _this = this; - - cash(selector).each(function(el, i) { - const parent = el.parentNode, - sibling = el.nextSibling; - _this.each(function(v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), sibling); - }); - }); - - return this; - }, - - insertBefore: function(selector) { - const _this2 = this; - cash(selector).each(function(el, i) { - const parent = el.parentNode; - _this2.each(function(v) { - parent.insertBefore(i === 0 ? v : v.cloneNode(true), el); - }); - }); - return this; - }, - - prepend: function(content) { - insertContent(this, content, true); - return this; - }, - - prependTo: function(parent) { - insertContent(cash(parent), this, true); - return this; - }, - - remove: function() { - return this.each(function(v) { - if (v.parentNode) { - return v.parentNode.removeChild(v); - } - }); - }, - - text: function(content) { - if (content === undefined) { - return this[0].textContent; - } - return this.each(function(v) { - return v.textContent = content; - }); - }, - - }); - - const docEl = doc.documentElement; - - fn.extend({ - position: function() { - const el = this[0]; - return { - left: el.offsetLeft, - top: el.offsetTop, - }; - }, - - offset: function() { - const rect = this[0].getBoundingClientRect(); - return { - top: rect.top + win.pageYOffset - docEl.clientTop, - left: rect.left + win.pageXOffset - docEl.clientLeft, - }; - }, - - offsetParent: function() { - return cash(this[0].offsetParent); - }, - - }); - - fn.extend({ - children: function(selector) { - let elems = []; - this.each(function(el) { - push.apply(elems, el.children); - }); - elems = unique(elems); - - return !selector ? elems : elems.filter(function(v) { - return matches(v, selector); - }); - }, - - closest: function(selector) { - if (!selector || this.length < 1) { - return cash(); - } - if (this.is(selector)) { - return this.filter(selector); - } - return this.parent().closest(selector); - }, - - is: function(selector) { - if (!selector) { - return false; - } - - let match = false, - // eslint-disable-next-line prefer-const - comparator = getCompareFunction(selector); - - this.each(function(el) { - match = comparator(el, selector); - return !match; - }); - - return match; - }, - - find: function(selector) { - if (!selector || selector.nodeType) { - return cash(selector && this.has(selector).length ? selector : null); - } - - const elems = []; - this.each(function(el) { - push.apply(elems, find(selector, el)); - }); - - return unique(elems); - }, - - has: function(selector) { - const comparator = isString(selector) ? function(el) { - return find(selector, el).length !== 0; - } : function(el) { - return el.contains(selector); - }; - - return this.filter(comparator); - }, - - next: function() { - return cash(this[0].nextElementSibling); - }, - - not: function(selector) { - if (!selector) { - return this; - } - - const comparator = getCompareFunction(selector); - - return this.filter(function(el) { - return !comparator(el, selector); - }); - }, - - parent: function() { - const result = []; - - this.each(function(item) { - if (item && item.parentNode) { - result.push(item.parentNode); - } - }); - - return unique(result); - }, - - parents: function(selector) { - let last, - // eslint-disable-next-line prefer-const - result = []; - - this.each(function(item) { - last = item; - - while (last && last.parentNode && last !== doc.body.parentNode) { - last = last.parentNode; - - if (!selector || selector && matches(last, selector)) { - result.push(last); - } - } - }); - - return unique(result); - }, - - prev: function() { - return cash(this[0].previousElementSibling); - }, - - siblings: function(selector) { - const collection = this.parent().children(selector), - el = this[0]; - - return collection.filter(function(i) { - return i !== el; - }); - }, - - }); - - return cash; -}); -; -const Component = function() { - /** - * Generic constructor for all components - * @constructor - * @param {Element} el - * @param {Object} options - */ - // eslint-disable-next-line no-shadow - class Component { - constructor(classDef, el) { - _classCallCheck(this, Component); - - // Display error if el is valid HTML Element - if (!(el instanceof Element)) { - console.error(Error(el + ' is not an HTML Element')); - } - - // If exists, destroy and reinitialize in child - const ins = classDef.getInstance(el); - if (ins) { - ins.destroy(); - } - - this.el = el; - this.$el = cash(el); - } - } - - /** - * Initializes components - * @param {class} classDef - * @param {Element | NodeList | jQuery} els - * @param {Object} options - */ - - - _createClass(Component, null, [{ - key: 'init', - value: function init(classDef, els, options) { - let instances = null; - if (els instanceof Element) { - instances = new classDef(els, options); - } - else if (!!els && (els.jquery || els.cash || els instanceof NodeList)) { - const instancesArr = []; - for (let i = 0; i < els.length; i++) { - instancesArr.push(new classDef(els[i], options)); - } - instances = instancesArr; - } - - return instances; - }, - }]); - - return Component; -}();; - -(function(window) { - if (window.Package) { - M = {}; - } - else { - window.M = {}; - } - - // Check for jQuery - M.jQueryLoaded = !!window.jQuery; -})(window); - -// AMD -if (typeof define === 'function' && define.amd) { - define('M', [], function() { - return M; - }); - - // Common JS -} -else if (typeof exports !== 'undefined' && !exports.nodeType) { - if (typeof module !== 'undefined' && !module.nodeType && module.exports) { - exports = module.exports = M; - } - exports.default = M; -} - -M.keys = { - TAB: 9, - ENTER: 13, - ESC: 27, - ARROW_UP: 38, - ARROW_DOWN: 40, -}; - -/** - * TabPress Keydown handler - */ -M.tabPressed = false; -const docHandleKeydown = function(e) { - if (e.which === M.keys.TAB) { - M.tabPressed = true; - } -}; -const docHandleKeyup = function(e) { - if (e.which === M.keys.TAB) { - M.tabPressed = false; - } -}; -document.addEventListener('keydown', docHandleKeydown); -document.addEventListener('keyup', docHandleKeyup); - -/** - * Initialize jQuery wrapper for plugin - * @param {Class} plugin javascript class - * @param {string} pluginName jQuery plugin name - * @param {string} classRef Class reference name - */ -M.initializeJqueryWrapper = function(plugin, pluginName, classRef) { - jQuery.fn[pluginName] = function(methodOrOptions) { - // Call plugin method if valid method name is passed in - if (plugin.prototype[methodOrOptions]) { - const params = Array.prototype.slice.call(arguments, 1); - - // Getter methods - if (methodOrOptions.slice(0, 3) === 'get') { - const instance = this.first()[0][classRef]; - return instance[methodOrOptions].apply(instance, params); - } - - // Void methods - return this.each(function() { - const instance = this[classRef]; - instance[methodOrOptions].apply(instance, params); - }); - - // Initialize plugin if options or no argument is passed in - } - else if (typeof methodOrOptions === 'object' || !methodOrOptions) { - plugin.init(this, arguments[0]); - return this; - } - - // Return error if an unrecognized method name is passed in - jQuery.error('Method ' + methodOrOptions + ' does not exist on jQuery.' + pluginName); - }; -}; - -/** - * Automatically initialize components - * @param {Element} context DOM Element to search within for components - */ -M.AutoInit = function(context) { - // Use document.body if no context is given - const root = context ? context : document.body; - - const registry = { - Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'), - Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'), - Chips: root.querySelectorAll('.chips:not(.no-autoinit)'), - Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'), - Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'), - Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'), - Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'), - Modal: root.querySelectorAll('.modal:not(.no-autoinit)'), - Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'), - Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'), - ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'), - FormSelect: root.querySelectorAll('select:not(.no-autoinit)'), - Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'), - Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'), - TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'), - Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'), - Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'), - FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)'), - }; - - for (const pluginName in registry) { - const plugin = M[pluginName]; - plugin.init(registry[pluginName]); - } -}; - -/** - * Generate approximated selector string for a jQuery object - * @param {jQuery} obj jQuery object to be parsed - * @returns {string} - */ -M.objectSelectorString = function(obj) { - const tagStr = obj.prop('tagName') || ''; - const idStr = obj.attr('id') || ''; - const classStr = obj.attr('class') || ''; - return (tagStr + idStr + classStr).replace(/\s/g, ''); -}; - -// Unique Random ID -M.guid = function() { - function s4() { - return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); - } - return function() { - return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); - }; -}(); - -/** - * Escapes hash from special characters - * @param {string} hash String returned from this.hash - * @returns {string} - */ -M.escapeHash = function(hash) { - return hash.replace(/\\/g, '\\\\').replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1'); -}; - -M.elementOrParentIsFixed = function(element) { - const $element = $(element); - const $checkElements = $element.add($element.parents()); - let isFixed = false; - $checkElements.each(function() { - if ($(this).css('position') === 'fixed') { - isFixed = true; - return false; - } - }); - return isFixed; -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Escapes hash from special characters - * @param {Element} container Container element that acts as the boundary - * @param {Bounding} bounding element bounding that is being checked - * @param {Number} offset offset from edge that counts as exceeding - * @returns {Edges} - */ -M.checkWithinContainer = function(container, bounding, offset) { - const edges = { - top: false, - right: false, - bottom: false, - left: false, - }; - - const containerRect = container.getBoundingClientRect(); - - const scrollLeft = container.scrollLeft; - const scrollTop = container.scrollTop; - - const scrolledX = bounding.left - scrollLeft; - const scrolledY = bounding.top - scrollTop; - - // Check for container and viewport for each edge - if (scrolledX < containerRect.left + offset || scrolledX < offset) { - edges.left = true; - } - - if (scrolledX + bounding.width > containerRect.right - offset || scrolledX + bounding.width > window.innerWidth - offset) { - edges.right = true; - } - - if (scrolledY < containerRect.top + offset || scrolledY < offset) { - edges.top = true; - } - - if (scrolledY + bounding.height > containerRect.bottom - offset || scrolledY + bounding.height > window.innerHeight - offset) { - edges.bottom = true; - } - - return edges; -}; - -M.checkPossibleAlignments = function(el, container, bounding, offset) { - const canAlign = { - top: true, - right: true, - bottom: true, - left: true, - spaceOnTop: null, - spaceOnRight: null, - spaceOnBottom: null, - spaceOnLeft: null, - }; - - const containerAllowsOverflow = getComputedStyle(container).overflow === 'visible'; - const containerRect = container.getBoundingClientRect(); - const containerHeight = Math.min(containerRect.height, window.innerHeight); - const containerWidth = Math.min(containerRect.width, window.innerWidth); - const elOffsetRect = el.getBoundingClientRect(); - - const scrollLeft = container.scrollLeft; - const scrollTop = container.scrollTop; - - const scrolledX = bounding.left - scrollLeft; - const scrolledYTopEdge = bounding.top - scrollTop; - const scrolledYBottomEdge = bounding.top + elOffsetRect.height - scrollTop; - - // Check for container and viewport for left - canAlign.spaceOnRight = !containerAllowsOverflow ? containerWidth - (scrolledX + bounding.width) : window.innerWidth - (elOffsetRect.left + bounding.width); - if (canAlign.spaceOnRight < 0) { - canAlign.left = false; - } - - // Check for container and viewport for Right - canAlign.spaceOnLeft = !containerAllowsOverflow ? scrolledX - bounding.width + elOffsetRect.width : elOffsetRect.right - bounding.width; - if (canAlign.spaceOnLeft < 0) { - canAlign.right = false; - } - - // Check for container and viewport for Top - canAlign.spaceOnBottom = !containerAllowsOverflow ? containerHeight - (scrolledYTopEdge + bounding.height + offset) : window.innerHeight - (elOffsetRect.top + bounding.height + offset); - if (canAlign.spaceOnBottom < 0) { - canAlign.top = false; - } - - // Check for container and viewport for Bottom - canAlign.spaceOnTop = !containerAllowsOverflow ? scrolledYBottomEdge - (bounding.height - offset) : elOffsetRect.bottom - (bounding.height + offset); - if (canAlign.spaceOnTop < 0) { - canAlign.bottom = false; - } - - return canAlign; -}; - -M.getOverflowParent = function(element) { - if (element == null) { - return null; - } - - if (element === document.body || getComputedStyle(element).overflow !== 'visible') { - return element; - } - - return M.getOverflowParent(element.parentElement); -}; - -/** - * Gets id of component from a trigger - * @param {Element} trigger trigger - * @returns {string} - */ -M.getIdFromTrigger = function(trigger) { - let id = trigger.getAttribute('data-target'); - if (!id) { - id = trigger.getAttribute('href'); - if (id) { - id = id.slice(1); - } - else { - id = ''; - } - } - return id; -}; - -/** - * Multi browser support for document scroll top - * @returns {Number} - */ -M.getDocumentScrollTop = function() { - return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; -}; - -/** - * Multi browser support for document scroll left - * @returns {Number} - */ -M.getDocumentScrollLeft = function() { - return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; -}; - -/** - * @typedef {Object} Edges - * @property {Boolean} top If the top edge was exceeded - * @property {Boolean} right If the right edge was exceeded - * @property {Boolean} bottom If the bottom edge was exceeded - * @property {Boolean} left If the left edge was exceeded - */ - -/** - * @typedef {Object} Bounding - * @property {Number} left left offset coordinate - * @property {Number} top top offset coordinate - * @property {Number} width - * @property {Number} height - */ - -/** - * Get time in ms - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @type {function} - * @return {number} - */ -const getTime = Date.now || function() { - return new Date().getTime(); -}; - -/** - * Returns a function, that, when invoked, will only be triggered at most once - * during a given window of time. Normally, the throttled function will run - * as much as it can, without ever going more than once per `wait` duration; - * but if you'd like to disable the execution on the leading edge, pass - * `{leading: false}`. To disable execution on the trailing edge, ditto. - * @license https://raw.github.com/jashkenas/underscore/master/LICENSE - * @param {function} func - * @param {number} wait - * @param {Object=} options - * @returns {Function} - */ -M.throttle = function(func, wait, options) { - let context = void 0, - args = void 0, - result = void 0; - let timeout = null; - let previous = 0; - options || (options = {}); - const later = function() { - previous = options.leading === false ? 0 : getTime(); - timeout = null; - result = func.apply(context, args); - context = args = null; - }; - return function() { - const now = getTime(); - if (!previous && options.leading === false) previous = now; - const remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0) { - clearTimeout(timeout); - timeout = null; - previous = now; - result = func.apply(context, args); - context = args = null; - } - else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; -}; -// eslint-disable-next-line no-inline-comments -; /* - v2.2.0 - 2017 Julian Garnier - Released under the MIT license - */ -const $jscomp = { scope: {} }; $jscomp.defineProperty = typeof Object.defineProperties == 'function' ? Object.defineProperty : function(e, r, p) { - if (p.get || p.set) throw new TypeError('ES3 does not support getters and setters.'); e != Array.prototype && e != Object.prototype && (e[r] = p.value); -}; $jscomp.getGlobal = function(e) { - return typeof window != 'undefined' && window === e ? e : typeof global != 'undefined' && global != null ? global : e; -// eslint-disable-next-line max-statements-per-line -}; $jscomp.global = $jscomp.getGlobal(this); $jscomp.SYMBOL_PREFIX = 'jscomp_symbol_'; -$jscomp.initSymbol = function() { - // eslint-disable-next-line no-empty-function - $jscomp.initSymbol = function() { }; $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); -// eslint-disable-next-line max-statements-per-line -}; $jscomp.symbolCounter_ = 0; $jscomp.Symbol = function(e) { - return $jscomp.SYMBOL_PREFIX + (e || '') + $jscomp.symbolCounter_++; -}; -$jscomp.initSymbolIterator = function() { - // eslint-disable-next-line max-statements-per-line - $jscomp.initSymbol(); let e = $jscomp.global.Symbol.iterator; e || (e = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol('iterator')); typeof Array.prototype[e] != 'function' && $jscomp.defineProperty(Array.prototype, e, { - configurable: !0, writable: !0, value: function() { - return $jscomp.arrayIterator(this); - }, - // eslint-disable-next-line no-empty-function - }); $jscomp.initSymbolIterator = function() { }; -}; $jscomp.arrayIterator = function(e) { - let r = 0; return $jscomp.iteratorPrototype(function() { - return r < e.length ? { done: !1, value: e[r++] } : { done: !0 }; - }); -}; -$jscomp.iteratorPrototype = function(e) { - // eslint-disable-next-line max-statements-per-line - $jscomp.initSymbolIterator(); e = { next: e }; e[$jscomp.global.Symbol.iterator] = function() { - return this; - }; return e; -// eslint-disable-next-line max-statements-per-line -}; $jscomp.array = $jscomp.array || {}; $jscomp.iteratorFromArray = function(e, r) { - // eslint-disable-next-line max-statements-per-line, no-var - $jscomp.initSymbolIterator(); e instanceof String && (e += ''); var p = 0, - m = { - next: function() { - if (p < e.length) { - const u = p++; return { value: r(u, e[u]), done: !1 }; - } m.next = function() { - return { done: !0, value: void 0 }; - }; return m.next(); - }, - }; m[Symbol.iterator] = function() { - return m; - }; return m; -}; -$jscomp.polyfill = function(e, r, p, m) { - if (r) { - // eslint-disable-next-line max-statements-per-line - p = $jscomp.global; e = e.split('.'); for (m = 0; m < e.length - 1; m++) { - // eslint-disable-next-line max-statements-per-line - const u = e[m]; u in p || (p[u] = {}); p = p[u]; - // eslint-disable-next-line max-statements-per-line - } e = e[e.length - 1]; m = p[e]; r = r(m); r != m && r != null && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r }); - } -}; $jscomp.polyfill('Array.prototype.keys', function(e) { - return e ? e : function() { - // eslint-disable-next-line no-shadow - return $jscomp.iteratorFromArray(this, function(e) { - return e; - }); - }; -}, 'es6-impl', 'es3'); const $jscomp$this = this; -(function(r) { - M.anime = r(); -})(function() { - function e(a) { - if (!h.col(a)) { - try { - return document.querySelectorAll(a); - } - // eslint-disable-next-line no-unused-vars, no-inline-comments - catch (c) { /* empty */ } - } - } function r(a, c) { - // eslint-disable-next-line no-var - for (var d = a.length, b = arguments.length >= 2 ? arguments[1] : void 0, f = [], n = 0; n < d; n++) { - if (n in a) { - const k = a[n]; c.call(b, k, n, a) && f.push(k); - } - } return f; - } function p(a) { - // eslint-disable-next-line no-shadow - return a.reduce(function(a, d) { - return a.concat(h.arr(d) ? p(d) : d); - }, []); - } function m(a) { - if (h.arr(a)) return a; - h.str(a) && (a = e(a) || a); return a instanceof NodeList || a instanceof HTMLCollection ? [].slice.call(a) : [a]; - } function u(a, c) { - // eslint-disable-next-line no-shadow - return a.some(function(a) { - return a === c; - }); - } function C(a) { - // eslint-disable-next-line prefer-const - let c = {}, - d; for (d in a) { - c[d] = a[d]; - } return c; - } function D(a, c) { - // eslint-disable-next-line prefer-const - let d = C(a), - b; for (b in a) { - d[b] = Object.prototype.hasOwnProperty.call(c, b) ? c[b] : a[b]; - } return d; - } function z(a, c) { - // eslint-disable-next-line prefer-const - let d = C(a), - b; for (b in c) { - d[b] = h.und(a[b]) ? c[b] : a[b]; - } return d; - } function T(a) { - a = a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function(_a, c, d, k) { - return c + c + d + d + k + k; - // eslint-disable-next-line no-var - }); var c = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a); - // eslint-disable-next-line no-var - a = parseInt(c[1], 16); var d = parseInt(c[2], 16), - // eslint-disable-next-line no-redeclare - c = parseInt(c[3], 16); return 'rgba(' + a + ',' + d + ',' + c + ',1)'; - } function U(a) { - // eslint-disable-next-line no-shadow - function c(a, c, b) { - // eslint-disable-next-line max-statements-per-line - b < 0 && (b += 1); b > 1 && --b; return b < 1 / 6 ? a + 6 * (c - a) * b : b < 0.5 ? c : b < 2 / 3 ? a + (c - a) * (2 / 3 - b) * 6 : a; - // eslint-disable-next-line no-var, max-statements-per-line - } var d = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a); a = parseInt(d[1]) / 360; var b = parseInt(d[2]) / 100, - f = parseInt(d[3]) / 100, - // eslint-disable-next-line no-redeclare, max-statements-per-line - d = d[4] || 1; if (b == 0) {f = b = a = f;} - else { - // eslint-disable-next-line no-var - var n = f < 0.5 ? f * (1 + b) : f + b - f * b, - k = 2 * f - n, - // eslint-disable-next-line no-redeclare - f = c(k, n, a + 1 / 3), - // eslint-disable-next-line no-redeclare - b = c(k, n, a); a = c(k, n, a - 1 / 3); - } return 'rgba(' + 255 * f + ',' + 255 * b + ',' + 255 * a + ',' + d + ')'; - } function y(a) { - // eslint-disable-next-line no-cond-assign - if (a = /([+-]?[0-9#.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a)) return a[2]; - } function V(a) { - if (a.indexOf('translate') > -1 || a === 'perspective') return 'px'; if (a.indexOf('rotate') > -1 || a.indexOf('skew') > -1) return 'deg'; - } function I(a, c) { - return h.fnc(a) ? a(c.target, c.id, c.total) : a; - } function E(a, c) { - if (c in a.style) return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()) || '0'; - } function J(a, c) { - // eslint-disable-next-line max-statements-per-line - if (h.dom(a) && u(W, c)) return 'transform'; if (h.dom(a) && (a.getAttribute(c) || h.svg(a) && a[c])) return 'attribute'; if (h.dom(a) && c !== 'transform' && E(a, c)) return 'css'; if (a[c] != null) return 'object'; - } function X(a, c) { - // eslint-disable-next-line no-var - var d = V(c), - // eslint-disable-next-line no-redeclare, max-statements-per-line, no-var, no-cond-assign - d = c.indexOf('scale') > -1 ? 1 : 0 + d; a = a.style.transform; if (!a) return d; for (var b = [], f = [], n = [], k = /(\w+)\((.+?)\)/g; b = k.exec(a);) { - f.push(b[1]), n.push(b[2]); - // eslint-disable-next-line no-shadow - } a = r(n, function(_a, b) { - return f[b] === c; - }); return a.length ? a[0] : d; - } function K(a, c) { - switch (J(a, c)) { - case 'transform': - return X(a, c); case 'css': - return E(a, c); case 'attribute': - return a.getAttribute(c); - } return a[c] || 0; - } function L(a, c) { - // eslint-disable-next-line max-statements-per-line - const d = /^(\*=|\+=|-=)/.exec(a); if (!d) return a; const b = y(a) || 0; c = parseFloat(c); a = parseFloat(a.replace(d[0], '')); switch (d[0][0]) { - case '+': - return c + a + b; case '-': - return c - a + b; case '*': - return c * a + b; - } - } function F(a, c) { - return Math.sqrt(Math.pow(c.x - a.x, 2) + Math.pow(c.y - a.y, 2)); - } function M(a) { - // eslint-disable-next-line no-var - a = a.points; for (var c = 0, d, b = 0; b < a.numberOfItems; b++) { - // eslint-disable-next-line max-statements-per-line - const f = a.getItem(b); b > 0 && (c += F(d, f)); d = f; - } return c; - } function N(a) { - if (a.getTotalLength) return a.getTotalLength(); switch (a.tagName.toLowerCase()) { - case 'circle': - return 2 * Math.PI * a.getAttribute('r'); case 'rect': - return 2 * a.getAttribute('width') + 2 * a.getAttribute('height'); case 'line': - return F({ x: a.getAttribute('x1'), y: a.getAttribute('y1') }, { x: a.getAttribute('x2'), y: a.getAttribute('y2') }); case 'polyline': - return M(a); case 'polygon': - // eslint-disable-next-line no-var - var c = a.points; return M(a) + F(c.getItem(c.numberOfItems - 1), c.getItem(0)); - } - } function Y(a, c) { - function d(b) { - b = void 0 === b ? 0 : b; return a.el.getPointAtLength(c + b >= 1 ? c + b : 0); - } const b = d(), - f = d(-1), - n = d(1); switch (a.property) { - case 'x': - return b.x; case 'y': - return b.y; - case 'angle': - return 180 * Math.atan2(n.y - f.y, n.x - f.x) / Math.PI; - } - } function O(a, c) { - // eslint-disable-next-line prefer-const - let d = /-?\d*\.?\d+/g, - // eslint-disable-next-line max-statements-per-line - b; b = h.pth(a) ? a.totalLength : a; if (h.col(b)) { - if (h.rgb(b)) { - // eslint-disable-next-line no-var - var f = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b); b = f ? 'rgba(' + f[1] + ',1)' : b; - } - else {b = h.hex(b) ? T(b) : h.hsl(b) ? U(b) : void 0;} - } - // eslint-disable-next-line no-cond-assign, max-statements-per-line - else {f = (f = y(b)) ? b.substr(0, b.length - f.length) : b, b = c && !/\s/g.test(b) ? f + c : f;} b += ''; return { original: b, numbers: b.match(d) ? b.match(d).map(Number) : [0], strings: h.str(a) || c ? b.split(d) : [] }; - } function P(a) { - // eslint-disable-next-line no-shadow - a = a ? p(h.arr(a) ? a.map(m) : m(a)) : []; return r(a, function(a, d, b) { - return b.indexOf(a) === d; - }); - } function Z(a) { - // eslint-disable-next-line no-shadow - const c = P(a); return c.map(function(a, b) { - return { target: a, id: b, total: c.length }; - }); - } function aa(a, c) { - const d = C(c); if (h.arr(a)) { - const b = a.length; b !== 2 || h.obj(a[0]) ? h.fnc(c.duration) || (d.duration = c.duration / b) : a = { value: a }; - // eslint-disable-next-line no-shadow - } return m(a).map(function(a, b) { - // eslint-disable-next-line max-statements-per-line - b = b ? 0 : c.delay; a = h.obj(a) && !h.pth(a) ? a : { value: a }; h.und(a.delay) && (a.delay = b); return a; - // eslint-disable-next-line no-shadow - }).map(function(a) { - return z(a, d); - }); - } function ba(a, c) { - // eslint-disable-next-line prefer-const - let d = {}, - b; for (b in a) { - // eslint-disable-next-line no-shadow - let f = I(a[b], c); h.arr(f) && (f = f.map(function(a) { - return I(a, c); - }), f.length === 1 && (f = f[0])); d[b] = f; - // eslint-disable-next-line max-statements-per-line - } d.duration = parseFloat(d.duration); d.delay = parseFloat(d.delay); return d; - } function ca(a) { - return h.arr(a) ? A.apply(this, a) : Q[a]; - } function da(a, c) { - let d; return a.tweens.map(function(b) { - // eslint-disable-next-line no-var - b = ba(b, c); var f = b.value, - // eslint-disable-next-line no-shadow - e = K(c.target, a.name), - k = d ? d.to.original : e, - // eslint-disable-next-line no-redeclare - k = h.arr(f) ? f[0] : k, - w = L(h.arr(f) ? f[1] : f, k), - // eslint-disable-next-line no-redeclare, max-statements-per-line - e = y(w) || y(k) || y(e); b.from = O(k, e); b.to = O(w, e); b.start = d ? d.end : a.offset; b.end = b.start + b.delay + b.duration; b.easing = ca(b.easing); b.elasticity = (1E3 - Math.min(Math.max(b.elasticity, 1), 999)) / 1E3; b.isPath = h.pth(f); b.isColor = h.col(b.from.original); b.isColor && (b.round = 1); return d = b; - }); - } function ea(a, c) { - // eslint-disable-next-line no-shadow - return r(p(a.map(function(a) { - return c.map(function(b) { - // eslint-disable-next-line no-shadow - const c = J(a.target, b.name); if (c) { - const d = da(b, a); b = { type: c, property: b.name, animatable: a, tweens: d, duration: d[d.length - 1].end, delay: d[0].delay }; - } - else {b = void 0;} return b; - }); - // eslint-disable-next-line no-shadow - })), function(a) { - return !h.und(a); - }); - } function R(a, c, d, b) { - // eslint-disable-next-line no-shadow - const f = a === 'delay'; return c.length ? (f ? Math.min : Math.max).apply(Math, c.map(function(b) { - return b[a]; - })) : f ? b.delay : d.offset + b.delay + b.duration; - } function fa(a) { - // eslint-disable-next-line prefer-const - let c = D(ga, a), - // eslint-disable-next-line prefer-const - d = D(S, a), - // eslint-disable-next-line prefer-const - b = Z(a.targets), - // eslint-disable-next-line prefer-const - f = [], - // eslint-disable-next-line no-shadow, prefer-const - e = z(c, d), - k; for (k in a) { - Object.prototype.hasOwnProperty.call(e, k) || k === 'targets' || f.push({ name: k, offset: e.offset, tweens: aa(a[k], d) }); - // eslint-disable-next-line max-statements-per-line - } a = ea(b, f); return z(c, { children: [], animatables: b, animations: a, duration: R('duration', a, c, d), delay: R('delay', a, c, d) }); - } function q(a) { - function c() { - // eslint-disable-next-line no-shadow - return window.Promise && new Promise(function(a) { - return p = a; - }); - // eslint-disable-next-line no-shadow - } function d(a) { - return g.reversed ? g.duration - a : a; - // eslint-disable-next-line no-shadow - } function b(a) { - // eslint-disable-next-line no-var, no-shadow - for (var b = 0, c = {}, d = g.animations, f = d.length; b < f;) { - // eslint-disable-next-line no-var, no-shadow - var e = d[b], - // eslint-disable-next-line no-shadow - k = e.animatable, - h = e.tweens, - n = h.length - 1, - // eslint-disable-next-line no-shadow - l = h[n]; n && (l = r(h, function(b) { - return a < b.end; - // eslint-disable-next-line no-var, no-redeclare - })[0] || l); for (var h = Math.min(Math.max(a - l.start - l.delay, 0), l.duration) / l.duration, w = isNaN(h) ? 1 : l.easing(h, l.elasticity), h = l.to.strings, p = l.round, n = [], m = void 0, m = l.to.numbers.length, t = 0; t < m; t++) { - // eslint-disable-next-line no-var - var x = void 0, - // eslint-disable-next-line no-redeclare - x = l.to.numbers[t], - // eslint-disable-next-line no-shadow - q = l.from.numbers[t], - // eslint-disable-next-line no-redeclare, max-statements-per-line - x = l.isPath ? Y(l.value, w * x) : q + w * (x - q); p && (l.isColor && t > 2 || (x = Math.round(x * p) / p)); n.push(x); - // eslint-disable-next-line no-cond-assign - } if (l = h.length) { - for (m = h[0], w = 0; w < l; w++) { - p = h[w + 1], t = n[w], isNaN(t) || (m = p ? m + (t + p) : m + (t + ' ')); - } - } - // eslint-disable-next-line max-statements-per-line - else {m = n[0];} ha[e.type](k.target, e.property, m, c, k.id); e.currentValue = m; b++; - // eslint-disable-next-line no-cond-assign - } if (b = Object.keys(c).length) { - for (d = 0; d < b; d++) { - H || (H = E(document.body, 'transform') ? 'transform' : '-webkit-transform'), g.animatables[d].target.style[H] = c[d].join(' '); - } - // eslint-disable-next-line max-statements-per-line - } g.currentTime = a; g.progress = a / g.duration * 100; - // eslint-disable-next-line no-shadow - } function f(a) { - if (g[a]) g[a](g); - // eslint-disable-next-line no-shadow - } function e() { - g.remaining && !0 !== g.remaining && g.remaining--; - // eslint-disable-next-line no-shadow - } function k(a) { - // eslint-disable-next-line no-shadow - const k = g.duration, - n = g.offset, - w = n + g.delay, - // eslint-disable-next-line no-shadow - r = g.currentTime, - x = g.reversed, - // eslint-disable-next-line no-shadow - q = d(a); if (g.children.length) { - // eslint-disable-next-line no-shadow, prefer-const - let u = g.children, - v = u.length; - if (q >= g.currentTime) { - for (let G = 0; G < v; G++) { - u[G].seek(q); - } - } - else { - for (; v--;) { - u[v].seek(q); - } - } - // eslint-disable-next-line max-statements-per-line - } if (q >= w || !k) g.began || (g.began = !0, f('begin')), f('run'); if (q > n && q < k) b(q); else if (q <= n && r !== 0 && (b(0), x && e()), q >= k && r !== k || !k) b(k), x || e(); f('update'); a >= k && (g.remaining ? (t = h, g.direction === 'alternate' && (g.reversed = !g.reversed)) : (g.pause(), g.completed || (g.completed = !0, f('complete'), 'Promise' in window && (p(), m = c()))), l = 0); - // eslint-disable-next-line max-statements-per-line, no-var - } a = void 0 === a ? {} : a; var h, - t, - l = 0, - // eslint-disable-next-line no-shadow - p = null, - // eslint-disable-next-line no-shadow - m = c(), - g = fa(a); g.reset = function() { - // eslint-disable-next-line no-shadow - let a = g.direction, - // eslint-disable-next-line no-shadow, prefer-const, max-statements-per-line - c = g.loop; g.currentTime = 0; g.progress = 0; g.paused = !0; g.began = !1; g.completed = !1; g.reversed = a === 'reverse'; g.remaining = a === 'alternate' && c === 1 ? 2 : c; b(0); for (a = g.children.length; a--;) { - g.children[a].reset(); - } - // eslint-disable-next-line no-shadow - }; g.tick = function(a) { - // eslint-disable-next-line max-statements-per-line - h = a; t || (t = h); k((l + h - t) * q.speed); - // eslint-disable-next-line no-shadow - }; g.seek = function(a) { - k(d(a)); - }; g.pause = function() { - // eslint-disable-next-line max-statements-per-line, no-shadow - const a = v.indexOf(g); a > -1 && v.splice(a, 1); g.paused = !0; - }; g.play = function() { - g.paused && (g.paused = !1, t = 0, l = d(g.currentTime), v.push(g), B || ia()); - }; g.reverse = function() { - // eslint-disable-next-line max-statements-per-line - g.reversed = !g.reversed; t = 0; l = d(g.currentTime); - }; g.restart = function() { - g.pause(); - g.reset(); g.play(); - // eslint-disable-next-line max-statements-per-line - }; g.finished = m; g.reset(); g.autoplay && g.play(); return g; - // eslint-disable-next-line no-var - } var ga = { update: void 0, begin: void 0, run: void 0, complete: void 0, loop: 1, direction: 'normal', autoplay: !0, offset: 0 }, - S = { duration: 1E3, delay: 0, easing: 'easeOutElastic', elasticity: 500, round: 0 }, - W = 'translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective'.split(' '), - H, - h = { - arr: function(a) { - return Array.isArray(a); - }, obj: function(a) { - return Object.prototype.toString.call(a).indexOf('Object') > -1; - }, - pth: function(a) { - return h.obj(a) && Object.prototype.hasOwnProperty.call(a, 'totalLength'); - }, svg: function(a) { - return a instanceof SVGElement; - }, dom: function(a) { - return a.nodeType || h.svg(a); - }, str: function(a) { - return typeof a === 'string'; - }, fnc: function(a) { - return typeof a === 'function'; - }, und: function(a) { - return typeof a === 'undefined'; - }, hex: function(a) { - return (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a) - ); - }, rgb: function(a) { - return (/^rgb/.test(a) - ); - }, hsl: function(a) { - return (/^hsl/.test(a) - ); - }, col: function(a) { - return h.hex(a) || h.rgb(a) || h.hsl(a); - }, - }, - A = function() { - // eslint-disable-next-line no-shadow - function a(a, d, b) { - return (((1 - 3 * b + 3 * d) * a + (3 * b - 6 * d)) * a + 3 * d) * a; - } return function(c, d, b, f) { - if (c >= 0 && c <= 1 && b >= 0 && b <= 1) { - // eslint-disable-next-line no-shadow - const e = new Float32Array(11); if (c !== d || b !== f) { - for (let k = 0; k < 11; ++k) { - e[k] = a(0.1 * k, c, b); - } - } return function(k) { - // eslint-disable-next-line max-statements-per-line, no-var, no-shadow - if (c === d && b === f) return k; if (k === 0) return 0; if (k === 1) return 1; for (var h = 0, l = 1; l !== 10 && e[l] <= k; ++l) { - h += 0.1; - // eslint-disable-next-line max-statements-per-line, no-var, no-redeclare - } --l; var l = h + (k - e[l]) / (e[l + 1] - e[l]) * 0.1, - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (n >= 0.001) { - for (h = 0; h < 4; ++h) { - // eslint-disable-next-line max-statements-per-line, no-var, no-shadow - n = 3 * (1 - 3 * b + 3 * c) * l * l + 2 * (3 * b - 6 * c) * l + 3 * c; if (n === 0) break; var m = a(l, c, b) - k, - // eslint-disable-next-line no-redeclare - l = l - m / n; - } k = l; - } - else if (n === 0) {k = l;} - else { - // eslint-disable-next-line no-var, no-redeclare - var l = h, - // eslint-disable-next-line no-redeclare - h = h + 0.1, - g = 0; do { - m = l + (h - l) / 2, n = a(m, c, b) - k, n > 0 ? h = m : l = m; - } while (Math.abs(n) > 1e-7 && ++g < 10); k = m; - } return a(k, d, f); - }; - } - }; - }(), - Q = function() { - // eslint-disable-next-line no-shadow - function a(a, b) { - return a === 0 || a === 1 ? a : -Math.pow(2, 10 * (a - 1)) * Math.sin(2 * (a - 1 - b / (2 * Math.PI) * Math.asin(1)) * Math.PI / b); - // eslint-disable-next-line prefer-const - } let c = 'Quad Cubic Quart Quint Sine Expo Circ Back Elastic'.split(' '), - // eslint-disable-next-line prefer-const - d = { - // eslint-disable-next-line no-shadow - In: [[0.55, 0.085, 0.68, 0.53], [0.55, 0.055, 0.675, 0.19], [0.895, 0.03, 0.685, 0.22], [0.755, 0.05, 0.855, 0.06], [0.47, 0, 0.745, 0.715], [0.95, 0.05, 0.795, 0.035], [0.6, 0.04, 0.98, 0.335], [0.6, -0.28, 0.735, 0.045], a], Out: [[0.25, 0.46, 0.45, 0.94], [0.215, 0.61, 0.355, 1], [0.165, 0.84, 0.44, 1], [0.23, 1, 0.32, 1], [0.39, 0.575, 0.565, 1], [0.19, 1, 0.22, 1], [0.075, 0.82, 0.165, 1], [0.175, 0.885, 0.32, 1.275], function(b, c) { - return 1 - a(1 - b, c); - // eslint-disable-next-line no-shadow - }], InOut: [[0.455, 0.03, 0.515, 0.955], [0.645, 0.045, 0.355, 1], [0.77, 0, 0.175, 1], [0.86, 0, 0.07, 1], [0.445, 0.05, 0.55, 0.95], [1, 0, 0, 1], [0.785, 0.135, 0.15, 0.86], [0.68, -0.55, 0.265, 1.55], function(b, c) { - return b < 0.5 ? a(2 * b, c) / 2 : 1 - a(-2 * b + 2, c) / 2; - }], - }, - // eslint-disable-next-line prefer-const - b = { linear: A(0.25, 0.25, 0.75, 0.75) }, - f = {}, - // eslint-disable-next-line no-shadow - e; for (e in d) { - // eslint-disable-next-line no-shadow - f.type = e, d[f.type].forEach(function(a) { - // eslint-disable-next-line no-shadow - return function(d, f) { - b['ease' + a.type + c[f]] = h.fnc(d) ? d : A.apply($jscomp$this, d); - }; - }(f)), f = { type: f.type }; - } return b; - }(), - ha = { - css: function(a, c, d) { - return a.style[c] = d; - }, attribute: function(a, c, d) { - return a.setAttribute(c, d); - }, object: function(a, c, d) { - return a[c] = d; - }, transform: function(_a, c, d, b, f) { - b[f] || (b[f] = []); b[f].push(c + '(' + d + ')'); - }, - }, - v = [], - B = 0, - ia = function() { - function a() { - B = requestAnimationFrame(c); - // eslint-disable-next-line no-shadow - } function c(c) { - const b = v.length; if (b) { - for (let d = 0; d < b;) { - v[d] && v[d].tick(c), d++; - } a(); - } - else {cancelAnimationFrame(B), B = 0;} - } return a; - // eslint-disable-next-line max-statements-per-line - }(); q.version = '2.2.0'; q.speed = 1; q.running = v; q.remove = function(a) { - a = P(a); for (let c = v.length; c--;) { - for (let d = v[c], b = d.animations, f = b.length; f--;) { - u(a, b[f].animatable.target) && (b.splice(f, 1), b.length || d.pause()); - } - } - // eslint-disable-next-line max-statements-per-line - }; q.getValue = K; q.path = function(a, c) { - const d = h.str(a) ? e(a)[0] : a, - // eslint-disable-next-line no-shadow - b = c || 100; return function(a) { - return { el: d, property: a, totalLength: N(d) * (b / 100) }; - }; - }; q.setDashoffset = function(a) { - // eslint-disable-next-line max-statements-per-line - const c = N(a); a.setAttribute('stroke-dasharray', c); return c; - // eslint-disable-next-line max-statements-per-line - }; q.bezier = A; q.easings = Q; q.timeline = function(a) { - // eslint-disable-next-line max-statements-per-line - const c = q(a); c.pause(); c.duration = 0; c.add = function(d) { - // eslint-disable-next-line no-shadow - c.children.forEach(function(a) { - a.began = !0; a.completed = !0; - }); m(d).forEach(function(b) { - // eslint-disable-next-line no-shadow, max-statements-per-line - let d = z(b, D(S, a || {})); d.targets = d.targets || a.targets; b = c.duration; const e = d.offset; d.autoplay = !1; d.direction = c.direction; d.offset = h.und(e) ? b : L(e, b); c.began = !0; c.completed = !0; c.seek(d.offset); d = q(d); d.began = !0; d.completed = !0; d.duration > b && (c.duration = d.duration); c.children.push(d); - // eslint-disable-next-line max-statements-per-line - }); c.seek(0); c.reset(); c.autoplay && c.restart(); return c; - }; return c; - }; q.random = function(a, c) { - return Math.floor(Math.random() * (c - a + 1)) + a; - }; return q; -}); -; (function($, anim) { - 'use strict'; - - const _defaults = { - accordion: true, - onOpenStart: undefined, - onOpenEnd: undefined, - onCloseStart: undefined, - onCloseEnd: undefined, - inDuration: 300, - outDuration: 300, - }; - - /** - * @class - * - */ - - const Collapsible = function(_Component) { - _inherits(Collapsible, _Component); - - /** + /** * Construct Collapsible instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function Collapsible(el, options) { - _classCallCheck(this, Collapsible); + function Collapsible(el, options) { + _classCallCheck(this, Collapsible); - const _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); + var _this3 = _possibleConstructorReturn(this, (Collapsible.__proto__ || Object.getPrototypeOf(Collapsible)).call(this, Collapsible, el, options)); - _this3.el.M_Collapsible = _this3; + _this3.el.M_Collapsible = _this3; - /** + /** * Options for the collapsible * @member Collapsible#options * @prop {Boolean} [accordion=false] - Type of the collapsible @@ -2134,328 +1966,324 @@ $jscomp.polyfill = function(e, r, p, m) { * @prop {Number} inDuration - Transition in duration in milliseconds. * @prop {Number} outDuration - Transition duration in milliseconds. */ - _this3.options = $.extend({}, Collapsible.defaults, options); + _this3.options = $.extend({}, Collapsible.defaults, options); - // Setup tab indices - _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); - _this3.$headers.attr('tabindex', 0); + // Setup tab indices + _this3.$headers = _this3.$el.children('li').children('.collapsible-header'); + _this3.$headers.attr('tabindex', 0); - _this3._setupEventHandlers(); + _this3._setupEventHandlers(); - // Open first active - const $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); - if (_this3.options.accordion) { - // Handle Accordion - $activeBodies.first().css('display', 'block'); - } - else { - // Handle Expandables - $activeBodies.css('display', 'block'); - } - return _this3; - } + // Open first active + var $activeBodies = _this3.$el.children('li.active').children('.collapsible-body'); + if (_this3.options.accordion) { + // Handle Accordion + $activeBodies.first().css('display', 'block'); + } else { + // Handle Expandables + $activeBodies.css('display', 'block'); + } + return _this3; + } - _createClass(Collapsible, [{ - key: 'destroy', + _createClass(Collapsible, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Collapsible = undefined; - }, + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Collapsible = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - const _this4 = this; + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this4 = this; - this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); - this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); - this.el.addEventListener('click', this._handleCollapsibleClickBound); - this.$headers.each(function(header) { - header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); - }); - }, + this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this); + this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this); + this.el.addEventListener('click', this._handleCollapsibleClickBound); + this.$headers.each(function (header) { + header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound); + }); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleCollapsibleClickBound); - }, + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleCollapsibleClickBound); + } - /** + /** * Handle Collapsible Click * @param {Event} e */ - }, { - key: '_handleCollapsibleClick', - value: function _handleCollapsibleClick(e) { - const $header = $(e.target).closest('.collapsible-header'); - if (e.target && $header.length) { - const $collapsible = $header.closest('.collapsible'); - if ($collapsible[0] === this.el) { - const $collapsibleLi = $header.closest('li'); - const $collapsibleLis = $collapsible.children('li'); - const isActive = $collapsibleLi[0].classList.contains('active'); - const index = $collapsibleLis.index($collapsibleLi); - - if (isActive) { - this.close(index); - } - else { - this.open(index); - } - } - } - }, - - /** + }, { + key: "_handleCollapsibleClick", + value: function _handleCollapsibleClick(e) { + var $header = $(e.target).closest('.collapsible-header'); + if (e.target && $header.length) { + var $collapsible = $header.closest('.collapsible'); + if ($collapsible[0] === this.el) { + var $collapsibleLi = $header.closest('li'); + var $collapsibleLis = $collapsible.children('li'); + var isActive = $collapsibleLi[0].classList.contains('active'); + var index = $collapsibleLis.index($collapsibleLi); + + if (isActive) { + this.close(index); + } else { + this.open(index); + } + } + } + } + + /** * Handle Collapsible Keydown * @param {Event} e */ - }, { - key: '_handleCollapsibleKeydown', - value: function _handleCollapsibleKeydown(e) { - if (e.keyCode === 13) { - this._handleCollapsibleClickBound(e); - } - }, + }, { + key: "_handleCollapsibleKeydown", + value: function _handleCollapsibleKeydown(e) { + if (e.keyCode === 13) { + this._handleCollapsibleClickBound(e); + } + } - /** + /** * Animate in collapsible slide * @param {Number} index - 0th index of slide */ - }, { - key: '_animateIn', - value: function _animateIn(index) { - const _this5 = this; - - const $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - const $body = $collapsibleLi.children('.collapsible-body'); - - anim.remove($body[0]); - $body.css({ - display: 'block', - overflow: 'hidden', - height: 0, - paddingTop: '', - paddingBottom: '', - }); - - const pTop = $body.css('padding-top'); - const pBottom = $body.css('padding-bottom'); - const finalHeight = $body[0].scrollHeight; - $body.css({ - paddingTop: 0, - paddingBottom: 0, - }); - - anim({ - targets: $body[0], - height: finalHeight, - paddingTop: pTop, - paddingBottom: pBottom, - duration: this.options.inDuration, - easing: 'easeInOutCubic', - complete: function() { - $body.css({ - overflow: '', - paddingTop: '', - paddingBottom: '', - height: '', - }); - - // onOpenEnd callback - if (typeof _this5.options.onOpenEnd === 'function') { - _this5.options.onOpenEnd.call(_this5, $collapsibleLi[0]); - } - }, - }); - } - }, - - /** + }, { + key: "_animateIn", + value: function _animateIn(index) { + var _this5 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + + anim.remove($body[0]); + $body.css({ + display: 'block', + overflow: 'hidden', + height: 0, + paddingTop: '', + paddingBottom: '' + }); + + var pTop = $body.css('padding-top'); + var pBottom = $body.css('padding-bottom'); + var finalHeight = $body[0].scrollHeight; + $body.css({ + paddingTop: 0, + paddingBottom: 0 + }); + + anim({ + targets: $body[0], + height: finalHeight, + paddingTop: pTop, + paddingBottom: pBottom, + duration: this.options.inDuration, + easing: 'easeInOutCubic', + complete: function (anim) { + $body.css({ + overflow: '', + paddingTop: '', + paddingBottom: '', + height: '' + }); + + // onOpenEnd callback + if (typeof _this5.options.onOpenEnd === 'function') { + _this5.options.onOpenEnd.call(_this5, $collapsibleLi[0]); + } + } + }); + } + } + + /** * Animate out collapsible slide * @param {Number} index - 0th index of slide to open */ - }, { - key: '_animateOut', - value: function _animateOut(index) { - const _this6 = this; - - const $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length) { - const $body = $collapsibleLi.children('.collapsible-body'); - anim.remove($body[0]); - $body.css('overflow', 'hidden'); - anim({ - targets: $body[0], - height: 0, - paddingTop: 0, - paddingBottom: 0, - duration: this.options.outDuration, - easing: 'easeInOutCubic', - complete: function() { - $body.css({ - height: '', - overflow: '', - padding: '', - display: '', - }); - - // onCloseEnd callback - if (typeof _this6.options.onCloseEnd === 'function') { - _this6.options.onCloseEnd.call(_this6, $collapsibleLi[0]); - } - }, - }); - } - }, - - /** + }, { + key: "_animateOut", + value: function _animateOut(index) { + var _this6 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length) { + var $body = $collapsibleLi.children('.collapsible-body'); + anim.remove($body[0]); + $body.css('overflow', 'hidden'); + anim({ + targets: $body[0], + height: 0, + paddingTop: 0, + paddingBottom: 0, + duration: this.options.outDuration, + easing: 'easeInOutCubic', + complete: function () { + $body.css({ + height: '', + overflow: '', + padding: '', + display: '' + }); + + // onCloseEnd callback + if (typeof _this6.options.onCloseEnd === 'function') { + _this6.options.onCloseEnd.call(_this6, $collapsibleLi[0]); + } + } + }); + } + } + + /** * Open Collapsible * @param {Number} index - 0th index of slide */ - }, { - key: 'open', - value: function open(index) { - const _this7 = this; - - const $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { - - // onOpenStart callback - if (typeof this.options.onOpenStart === 'function') { - this.options.onOpenStart.call(this, $collapsibleLi[0]); - } - - // Handle accordion behavior - if (this.options.accordion) { - const $collapsibleLis = this.$el.children('li'); - const $activeLis = this.$el.children('li.active'); - $activeLis.each(function(el) { - // eslint-disable-next-line no-shadow - const index = $collapsibleLis.index($(el)); - _this7.close(index); - }); - } - - // Animate in - $collapsibleLi[0].classList.add('active'); - this._animateIn(index); - } - }, - - /** + }, { + key: "open", + value: function open(index) { + var _this7 = this; + + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) { + + // onOpenStart callback + if (typeof this.options.onOpenStart === 'function') { + this.options.onOpenStart.call(this, $collapsibleLi[0]); + } + + // Handle accordion behavior + if (this.options.accordion) { + var $collapsibleLis = this.$el.children('li'); + var $activeLis = this.$el.children('li.active'); + $activeLis.each(function (el) { + var index = $collapsibleLis.index($(el)); + _this7.close(index); + }); + } + + // Animate in + $collapsibleLi[0].classList.add('active'); + this._animateIn(index); + } + } + + /** * Close Collapsible * @param {Number} index - 0th index of slide */ - }, { - key: 'close', - value: function close(index) { - const $collapsibleLi = this.$el.children('li').eq(index); - if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { - - // onCloseStart callback - if (typeof this.options.onCloseStart === 'function') { - this.options.onCloseStart.call(this, $collapsibleLi[0]); - } - - // Animate out - $collapsibleLi[0].classList.remove('active'); - this._animateOut(index); - } - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), 'init', this).call(this, this, els, options); - }, - - /** + }, { + key: "close", + value: function close(index) { + var $collapsibleLi = this.$el.children('li').eq(index); + if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) { + + // onCloseStart callback + if (typeof this.options.onCloseStart === 'function') { + this.options.onCloseStart.call(this, $collapsibleLi[0]); + } + + // Animate out + $collapsibleLi[0].classList.remove('active'); + this._animateOut(index); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Collapsible.__proto__ || Object.getPrototypeOf(Collapsible), "init", this).call(this, this, els, options); + } + + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_Collapsible; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Collapsible; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return Collapsible; - }(Component); + return Collapsible; + }(Component); - M.Collapsible = Collapsible; + M.Collapsible = Collapsible; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Collapsible, 'collapsible', 'M_Collapsible'); + } })(cash, M.anime); -; (function($, anim) { - 'use strict'; - - const _defaults = { - alignment: 'left', - autoFocus: true, - constrainWidth: true, - container: null, - coverTrigger: true, - closeOnClick: true, - hover: false, - inDuration: 150, - outDuration: 250, - onOpenStart: null, - onOpenEnd: null, - onCloseStart: null, - onCloseEnd: null, - }; - - /** +; (function ($, anim) { + 'use strict'; + + var _defaults = { + alignment: 'left', + autoFocus: true, + constrainWidth: true, + container: null, + coverTrigger: true, + closeOnClick: true, + hover: false, + inDuration: 150, + outDuration: 250, + onOpenStart: null, + onOpenEnd: null, + onCloseStart: null, + onCloseEnd: null + }; + + /** * @class */ - const Dropdown = function(_Component2) { - _inherits(Dropdown, _Component2); + var Dropdown = function (_Component2) { + _inherits(Dropdown, _Component2); - // eslint-disable-next-line no-shadow - function Dropdown(el, options) { - _classCallCheck(this, Dropdown); + function Dropdown(el, options) { + _classCallCheck(this, Dropdown); - const _this8 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); + var _this8 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options)); - _this8.el.M_Dropdown = _this8; - Dropdown._dropdowns.push(_this8); + _this8.el.M_Dropdown = _this8; + Dropdown._dropdowns.push(_this8); - _this8.id = M.getIdFromTrigger(el); - _this8.dropdownEl = document.getElementById(_this8.id); - _this8.$dropdownEl = $(_this8.dropdownEl); + _this8.id = M.getIdFromTrigger(el); + _this8.dropdownEl = document.getElementById(_this8.id); + _this8.$dropdownEl = $(_this8.dropdownEl); - /** + /** * Options for the dropdown * @member Dropdown#options * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to @@ -2472,631 +2300,616 @@ $jscomp.polyfill = function(e, r, p, m) { * @prop {Function} onCloseStart - Function called when dropdown starts closing * @prop {Function} onCloseEnd - Function called when dropdown finishes closing */ - _this8.options = $.extend({}, Dropdown.defaults, options); + _this8.options = $.extend({}, Dropdown.defaults, options); - /** + /** * Describes open/close state of dropdown * @type {Boolean} */ - _this8.isOpen = false; + _this8.isOpen = false; - /** + /** * Describes if dropdown content is scrollable * @type {Boolean} */ - _this8.isScrollable = false; + _this8.isScrollable = false; - /** + /** * Describes if touch moving on dropdown content * @type {Boolean} */ - _this8.isTouchMoving = false; + _this8.isTouchMoving = false; - _this8.focusedIndex = -1; - _this8.filterQuery = []; + _this8.focusedIndex = -1; + _this8.filterQuery = []; - // Move dropdown-content after dropdown-trigger - if (_this8.options.container) { - $(_this8.options.container).append(_this8.dropdownEl); - } - else { - _this8.$el.after(_this8.dropdownEl); - } + // Move dropdown-content after dropdown-trigger + if (!!_this8.options.container) { + $(_this8.options.container).append(_this8.dropdownEl); + } else { + _this8.$el.after(_this8.dropdownEl); + } - _this8._makeDropdownFocusable(); - _this8._resetFilterQueryBound = _this8._resetFilterQuery.bind(_this8); - _this8._handleDocumentClickBound = _this8._handleDocumentClick.bind(_this8); - _this8._handleDocumentTouchmoveBound = _this8._handleDocumentTouchmove.bind(_this8); - _this8._handleDropdownKeydownBound = _this8._handleDropdownKeydown.bind(_this8); - _this8._handleTriggerKeydownBound = _this8._handleTriggerKeydown.bind(_this8); - _this8._setupEventHandlers(); - return _this8; - } + _this8._makeDropdownFocusable(); + _this8._resetFilterQueryBound = _this8._resetFilterQuery.bind(_this8); + _this8._handleDocumentClickBound = _this8._handleDocumentClick.bind(_this8); + _this8._handleDocumentTouchmoveBound = _this8._handleDocumentTouchmove.bind(_this8); + _this8._handleDropdownKeydownBound = _this8._handleDropdownKeydown.bind(_this8); + _this8._handleTriggerKeydownBound = _this8._handleTriggerKeydown.bind(_this8); + _this8._setupEventHandlers(); + return _this8; + } - _createClass(Dropdown, [{ - key: 'destroy', + _createClass(Dropdown, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._resetDropdownStyles(); - this._removeEventHandlers(); - Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); - this.el.M_Dropdown = undefined; - }, + value: function destroy() { + this._resetDropdownStyles(); + this._removeEventHandlers(); + Dropdown._dropdowns.splice(Dropdown._dropdowns.indexOf(this), 1); + this.el.M_Dropdown = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - // Trigger keydown handler - this.el.addEventListener('keydown', this._handleTriggerKeydownBound); - - // Hover event handlers - if (this.options.hover) { - this._handleMouseEnterBound = this._handleMouseEnter.bind(this); - this.el.addEventListener('mouseenter', this._handleMouseEnterBound); - this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); - this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); - - // Click event handlers - } - else { - this._handleClickBound = this._handleClick.bind(this); - this.el.addEventListener('click', this._handleClickBound); - } - }, - - /** + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + // Trigger keydown handler + this.el.addEventListener('keydown', this._handleTriggerKeydownBound); + + // Hover event handlers + if (this.options.hover) { + this._handleMouseEnterBound = this._handleMouseEnter.bind(this); + this.el.addEventListener('mouseenter', this._handleMouseEnterBound); + this._handleMouseLeaveBound = this._handleMouseLeave.bind(this); + this.el.addEventListener('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.addEventListener('mouseleave', this._handleMouseLeaveBound); + + // Click event handlers + } else { + this._handleClickBound = this._handleClick.bind(this); + this.el.addEventListener('click', this._handleClickBound); + } + } + + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - // Trigger keydown handler - this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); - - if (this.options.hover) { - this.el.removeEventHandlers('mouseenter', this._handleMouseEnterBound); - this.el.removeEventHandlers('mouseleave', this._handleMouseLeaveBound); - this.dropdownEl.removeEventHandlers('mouseleave', this._handleMouseLeaveBound); - } - else { - this.el.removeEventListener('click', this._handleClickBound); - } - }, - }, { - key: '_setupTemporaryEventHandlers', - value: function _setupTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); - }, - }, { - key: '_removeTemporaryEventHandlers', - value: function _removeTemporaryEventHandlers() { - // Use capture phase event handler to prevent click - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); - this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); - }, - }, { - key: '_handleClick', - value: function _handleClick(e) { - e.preventDefault(); - this.open(); - }, - }, { - key: '_handleMouseEnter', - value: function _handleMouseEnter() { - this.open(); - }, - }, { - key: '_handleMouseLeave', - value: function _handleMouseLeave(e) { - const toEl = e.toElement || e.relatedTarget; - const leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; - let leaveToActiveDropdownTrigger = false; - - const $closestTrigger = $(toEl).closest('.dropdown-trigger'); - if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { - leaveToActiveDropdownTrigger = true; - } - - // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content - if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { - this.close(); - } - }, - }, { - key: '_handleDocumentClick', - value: function _handleDocumentClick(e) { - const _this9 = this; - - const $target = $(e.target); - if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { - // isTouchMoving to check if scrolling on mobile. - setTimeout(function() { - _this9.close(); - }, 0); - } - else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { - setTimeout(function() { - _this9.close(); - }, 0); - } - this.isTouchMoving = false; - }, - }, { - key: '_handleTriggerKeydown', - value: function _handleTriggerKeydown(e) { - // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown - if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { - e.preventDefault(); - this.open(); - } - }, - - /** + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + // Trigger keydown handler + this.el.removeEventListener('keydown', this._handleTriggerKeydownBound); + + if (this.options.hover) { + this.el.removeEventHandlers('mouseenter', this._handleMouseEnterBound); + this.el.removeEventHandlers('mouseleave', this._handleMouseLeaveBound); + this.dropdownEl.removeEventHandlers('mouseleave', this._handleMouseLeaveBound); + } else { + this.el.removeEventListener('click', this._handleClickBound); + } + } + }, { + key: "_setupTemporaryEventHandlers", + value: function _setupTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_removeTemporaryEventHandlers", + value: function _removeTemporaryEventHandlers() { + // Use capture phase event handler to prevent click + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound); + this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound); + } + }, { + key: "_handleClick", + value: function _handleClick(e) { + e.preventDefault(); + this.open(); + } + }, { + key: "_handleMouseEnter", + value: function _handleMouseEnter() { + this.open(); + } + }, { + key: "_handleMouseLeave", + value: function _handleMouseLeave(e) { + var toEl = e.toElement || e.relatedTarget; + var leaveToDropdownContent = !!$(toEl).closest('.dropdown-content').length; + var leaveToActiveDropdownTrigger = false; + + var $closestTrigger = $(toEl).closest('.dropdown-trigger'); + if ($closestTrigger.length && !!$closestTrigger[0].M_Dropdown && $closestTrigger[0].M_Dropdown.isOpen) { + leaveToActiveDropdownTrigger = true; + } + + // Close hover dropdown if mouse did not leave to either active dropdown-trigger or dropdown-content + if (!leaveToActiveDropdownTrigger && !leaveToDropdownContent) { + this.close(); + } + } + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + var _this9 = this; + + var $target = $(e.target); + if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) { + // isTouchMoving to check if scrolling on mobile. + setTimeout(function () { + _this9.close(); + }, 0); + } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) { + setTimeout(function () { + _this9.close(); + }, 0); + } + this.isTouchMoving = false; + } + }, { + key: "_handleTriggerKeydown", + value: function _handleTriggerKeydown(e) { + // ARROW DOWN OR ENTER WHEN SELECT IS CLOSED - open Dropdown + if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ENTER) && !this.isOpen) { + e.preventDefault(); + this.open(); + } + } + + /** * Handle Document Touchmove * @param {Event} e */ - }, { - key: '_handleDocumentTouchmove', - value: function _handleDocumentTouchmove(e) { - const $target = $(e.target); - if ($target.closest('.dropdown-content').length) { - this.isTouchMoving = true; - } - }, + }, { + key: "_handleDocumentTouchmove", + value: function _handleDocumentTouchmove(e) { + var $target = $(e.target); + if ($target.closest('.dropdown-content').length) { + this.isTouchMoving = true; + } + } - /** + /** * Handle Dropdown Keydown * @param {Event} e */ - }, { - key: '_handleDropdownKeydown', - value: function _handleDropdownKeydown(e) { - if (e.which === M.keys.TAB) { - e.preventDefault(); - this.close(); - - // Navigate down dropdown list - } - else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) { - e.preventDefault(); - const direction = e.which === M.keys.ARROW_DOWN ? 1 : -1; - let newFocusedIndex = this.focusedIndex; - let foundNewIndex = false; - do { - newFocusedIndex = newFocusedIndex + direction; - - if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) { - foundNewIndex = true; - break; - } - } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0); - - if (foundNewIndex) { - this.focusedIndex = newFocusedIndex; - this._focusFocusedItem(); - } - - // ENTER selects choice on focused item - } - else if (e.which === M.keys.ENTER && this.isOpen) { - // Search for and ' + ''; - }, - }, { - key: 'renderRow', - value: function renderRow(days, isRTL, isRowSelected) { - return '' + (isRTL ? days.reverse() : days).join('') + ''; - }, - }, { - key: 'renderTable', - value: function renderTable(opts, data, randId) { - return '

'; - }, - }, { - key: 'renderHead', - value: function renderHead(opts) { - let i = void 0, - // eslint-disable-next-line prefer-const - arr = []; - for (i = 0; i < 7; i++) { - arr.push('' + this.renderDayName(opts, i, true) + ''); - } - return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; - }, - }, { - key: 'renderBody', - value: function renderBody(rows) { - return '' + rows.join('') + ''; - }, - }, { - key: 'renderTitle', - value: function renderTitle(instance, c, year, month, refYear, randId) { - let i = void 0, - j = void 0, - arr = void 0, - // eslint-disable-next-line prefer-const - opts = this.options, - // eslint-disable-next-line prefer-const - isMinYear = year === opts.minYear, - // eslint-disable-next-line prefer-const - isMaxYear = year === opts.maxYear, - html = '
', - monthHtml = void 0, - yearHtml = void 0, - prev = true, - next = true; - - for (arr = [], i = 0; i < 12; i++) { - arr.push(''); - } - - monthHtml = ''; - - if ($.isArray(opts.yearRange)) { - i = opts.yearRange[0]; - j = opts.yearRange[1] + 1; - } - else { - i = year - opts.yearRange; - j = 1 + year + opts.yearRange; - } - - for (arr = []; i < j && i <= opts.maxYear; i++) { - if (i >= opts.minYear) { - arr.push(''); - } - } - - yearHtml = ''; - - const leftArrow = ''; - html += ''; - - html += '
'; - if (opts.showMonthAfterYear) { - html += yearHtml + monthHtml; - } - else { - html += monthHtml + yearHtml; - } - html += '
'; - - if (isMinYear && (month === 0 || opts.minMonth >= month)) { - prev = false; - } - - if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { - next = false; - } - - // if (c === (this.options.numberOfMonths - 1) ) { - const rightArrow = ''; - html += ''; - // } - - return html += '
'; - }, - - /** + }, { + key: "gotoDate", + value: function gotoDate(date) { + var newCalendar = true; + + if (!Datepicker._isDate(date)) { + return; + } + + if (this.calendars) { + var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1), + lastVisibleDate = new Date(this.calendars[this.calendars.length - 1].year, this.calendars[this.calendars.length - 1].month, 1), + visibleDate = date.getTime(); + // get the end of the month + lastVisibleDate.setMonth(lastVisibleDate.getMonth() + 1); + lastVisibleDate.setDate(lastVisibleDate.getDate() - 1); + newCalendar = visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate; + } + + if (newCalendar) { + this.calendars = [{ + month: date.getMonth(), + year: date.getFullYear() + }]; + // if (this.options.mainCalendar === 'right') { + // this.calendars[0].month += 1 - this.options.numberOfMonths; + // } + } + + this.adjustCalendars(); + } + }, { + key: "adjustCalendars", + value: function adjustCalendars() { + this.calendars[0] = this.adjustCalendar(this.calendars[0]); + // for (let c = 1; c < this.options.numberOfMonths; c++) { + // this.calendars[c] = this.adjustCalendar({ + // month: this.calendars[0].month + c, + // year: this.calendars[0].year + // }); + // } + this.draw(); + } + }, { + key: "adjustCalendar", + value: function adjustCalendar(calendar) { + if (calendar.month < 0) { + calendar.year -= Math.ceil(Math.abs(calendar.month) / 12); + calendar.month += 12; + } + if (calendar.month > 11) { + calendar.year += Math.floor(Math.abs(calendar.month) / 12); + calendar.month -= 12; + } + return calendar; + } + }, { + key: "nextMonth", + value: function nextMonth() { + this.calendars[0].month++; + this.adjustCalendars(); + } + }, { + key: "prevMonth", + value: function prevMonth() { + this.calendars[0].month--; + this.adjustCalendars(); + } + }, { + key: "render", + value: function render(year, month, randId) { + var opts = this.options, + now = new Date(), + days = Datepicker._getDaysInMonth(year, month), + before = new Date(year, month, 1).getDay(), + data = [], + row = []; + Datepicker._setToStartOfDay(now); + if (opts.firstDay > 0) { + before -= opts.firstDay; + if (before < 0) { + before += 7; + } + } + var previousMonth = month === 0 ? 11 : month - 1, + nextMonth = month === 11 ? 0 : month + 1, + yearOfPreviousMonth = month === 0 ? year - 1 : year, + yearOfNextMonth = month === 11 ? year + 1 : year, + daysInPreviousMonth = Datepicker._getDaysInMonth(yearOfPreviousMonth, previousMonth); + var cells = days + before, + after = cells; + while (after > 7) { + after -= 7; + } + cells += 7 - after; + var isWeekSelected = false; + for (var i = 0, r = 0; i < cells; i++) { + var day = new Date(year, month, 1 + (i - before)), + isSelected = Datepicker._isDate(this.date) ? Datepicker._compareDates(day, this.date) : false, + isToday = Datepicker._compareDates(day, now), + hasEvent = opts.events.indexOf(day.toDateString()) !== -1 ? true : false, + isEmpty = i < before || i >= days + before, + dayNumber = 1 + (i - before), + monthNumber = month, + yearNumber = year, + isStartRange = opts.startRange && Datepicker._compareDates(opts.startRange, day), + isEndRange = opts.endRange && Datepicker._compareDates(opts.endRange, day), + isInRange = opts.startRange && opts.endRange && opts.startRange < day && day < opts.endRange, + isDisabled = opts.minDate && day < opts.minDate || opts.maxDate && day > opts.maxDate || opts.disableWeekends && Datepicker._isWeekend(day) || opts.disableDayFn && opts.disableDayFn(day); + + if (isEmpty) { + if (i < before) { + dayNumber = daysInPreviousMonth + dayNumber; + monthNumber = previousMonth; + yearNumber = yearOfPreviousMonth; + } else { + dayNumber = dayNumber - days; + monthNumber = nextMonth; + yearNumber = yearOfNextMonth; + } + } + + var dayConfig = { + day: dayNumber, + month: monthNumber, + year: yearNumber, + hasEvent: hasEvent, + isSelected: isSelected, + isToday: isToday, + isDisabled: isDisabled, + isEmpty: isEmpty, + isStartRange: isStartRange, + isEndRange: isEndRange, + isInRange: isInRange, + showDaysInNextAndPreviousMonths: opts.showDaysInNextAndPreviousMonths + }; + + row.push(this.renderDay(dayConfig)); + + if (++r === 7) { + data.push(this.renderRow(row, opts.isRTL, isWeekSelected)); + row = []; + r = 0; + isWeekSelected = false; + } + } + return this.renderTable(opts, data, randId); + } + }, { + key: "renderDay", + value: function renderDay(opts) { + var arr = []; + var ariaSelected = 'false'; + if (opts.isEmpty) { + if (opts.showDaysInNextAndPreviousMonths) { + arr.push('is-outside-current-month'); + arr.push('is-selection-disabled'); + } else { + return ''; + } + } + if (opts.isDisabled) { + arr.push('is-disabled'); + } + + if (opts.isToday) { + arr.push('is-today'); + } + if (opts.isSelected) { + arr.push('is-selected'); + ariaSelected = 'true'; + } + if (opts.hasEvent) { + arr.push('has-event'); + } + if (opts.isInRange) { + arr.push('is-inrange'); + } + if (opts.isStartRange) { + arr.push('is-startrange'); + } + if (opts.isEndRange) { + arr.push('is-endrange'); + } + return '' + '' + ''; + } + }, { + key: "renderRow", + value: function renderRow(days, isRTL, isRowSelected) { + return '' + (isRTL ? days.reverse() : days).join('') + ''; + } + }, { + key: "renderTable", + value: function renderTable(opts, data, randId) { + return '
' + this.renderHead(opts) + this.renderBody(data) + '
'; + } + }, { + key: "renderHead", + value: function renderHead(opts) { + var i = void 0, + arr = []; + for (i = 0; i < 7; i++) { + arr.push('' + this.renderDayName(opts, i, true) + ''); + } + return '' + (opts.isRTL ? arr.reverse() : arr).join('') + ''; + } + }, { + key: "renderBody", + value: function renderBody(rows) { + return '' + rows.join('') + ''; + } + }, { + key: "renderTitle", + value: function renderTitle(instance, c, year, month, refYear, randId) { + var i = void 0, + j = void 0, + arr = void 0, + opts = this.options, + isMinYear = year === opts.minYear, + isMaxYear = year === opts.maxYear, + html = '
', + monthHtml = void 0, + yearHtml = void 0, + prev = true, + next = true; + + for (arr = [], i = 0; i < 12; i++) { + arr.push(''); + } + + monthHtml = ''; + + if ($.isArray(opts.yearRange)) { + i = opts.yearRange[0]; + j = opts.yearRange[1] + 1; + } else { + i = year - opts.yearRange; + j = 1 + year + opts.yearRange; + } + + for (arr = []; i < j && i <= opts.maxYear; i++) { + if (i >= opts.minYear) { + arr.push(''); + } + } + + yearHtml = ''; + + var leftArrow = ''; + html += ''; + + html += '
'; + if (opts.showMonthAfterYear) { + html += yearHtml + monthHtml; + } else { + html += monthHtml + yearHtml; + } + html += '
'; + + if (isMinYear && (month === 0 || opts.minMonth >= month)) { + prev = false; + } + + if (isMaxYear && (month === 11 || opts.maxMonth <= month)) { + next = false; + } + + // if (c === (this.options.numberOfMonths - 1) ) { + var rightArrow = ''; + html += ''; + // } + + return html += '
'; + } + + /** * refresh the HTML */ - }, { - key: 'draw', - value: function draw(force) { - if (!this.isOpen && !force) { - return; - } - // eslint-disable-next-line prefer-const - let opts = this.options, - // eslint-disable-next-line prefer-const - minYear = opts.minYear, - // eslint-disable-next-line prefer-const - maxYear = opts.maxYear, - // eslint-disable-next-line prefer-const - minMonth = opts.minMonth, - // eslint-disable-next-line prefer-const - maxMonth = opts.maxMonth, - html = '', - randId = void 0; - - if (this._y <= minYear) { - this._y = minYear; - if (!isNaN(minMonth) && this._m < minMonth) { - this._m = minMonth; - } - } - if (this._y >= maxYear) { - this._y = maxYear; - if (!isNaN(maxMonth) && this._m > maxMonth) { - this._m = maxMonth; - } - } - - randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); - - for (let c = 0; c < 1; c++) { - this._renderDateDisplay(); - html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); - } - - this.destroySelects(); - - this.calendarEl.innerHTML = html; - - // Init Materialize Select - const yearSelect = this.calendarEl.querySelector('.pika-select-year'); - const monthSelect = this.calendarEl.querySelector('.pika-select-month'); - M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } }); - M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } }); - - // Add change handlers for select - yearSelect.addEventListener('change', this._handleYearChange.bind(this)); - monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); - - if (typeof this.options.onDraw === 'function') { - this.options.onDraw(this); - } - }, - - /** + }, { + key: "draw", + value: function draw(force) { + if (!this.isOpen && !force) { + return; + } + var opts = this.options, + minYear = opts.minYear, + maxYear = opts.maxYear, + minMonth = opts.minMonth, + maxMonth = opts.maxMonth, + html = '', + randId = void 0; + + if (this._y <= minYear) { + this._y = minYear; + if (!isNaN(minMonth) && this._m < minMonth) { + this._m = minMonth; + } + } + if (this._y >= maxYear) { + this._y = maxYear; + if (!isNaN(maxMonth) && this._m > maxMonth) { + this._m = maxMonth; + } + } + + randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2); + + for (var c = 0; c < 1; c++) { + this._renderDateDisplay(); + html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId); + } + + this.destroySelects(); + + this.calendarEl.innerHTML = html; + + // Init Materialize Select + var yearSelect = this.calendarEl.querySelector('.pika-select-year'); + var monthSelect = this.calendarEl.querySelector('.pika-select-month'); + M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } }); + M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } }); + + // Add change handlers for select + yearSelect.addEventListener('change', this._handleYearChange.bind(this)); + monthSelect.addEventListener('change', this._handleMonthChange.bind(this)); + + if (typeof this.options.onDraw === 'function') { + this.options.onDraw(this); + } + } + + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleInputChangeBound = this._handleInputChange.bind(this); - this._handleCalendarClickBound = this._handleCalendarClick.bind(this); - this._finishSelectionBound = this._finishSelection.bind(this); - this._handleMonthChange = this._handleMonthChange.bind(this); - this._closeBound = this.close.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.el.addEventListener('change', this._handleInputChangeBound); - this.calendarEl.addEventListener('click', this._handleCalendarClickBound); - this.doneBtn.addEventListener('click', this._finishSelectionBound); - this.cancelBtn.addEventListener('click', this._closeBound); - - if (this.options.showClearBtn) { - this._handleClearClickBound = this._handleClearClick.bind(this); - this.clearBtn.addEventListener('click', this._handleClearClickBound); - } - }, - }, { - key: '_setupVariables', - value: function _setupVariables() { - const _this55 = this; - - this.$modalEl = $(Datepicker._template); - this.modalEl = this.$modalEl[0]; - - this.calendarEl = this.modalEl.querySelector('.pika-single'); - - this.yearTextEl = this.modalEl.querySelector('.year-text'); - this.dateTextEl = this.modalEl.querySelector('.date-text'); - if (this.options.showClearBtn) { - this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); - } - this.doneBtn = this.modalEl.querySelector('.datepicker-done'); - this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); - - this.formats = { - - d: function() { - return _this55.date.getDate(); - }, - dd: function() { - const d = _this55.date.getDate(); - return (d < 10 ? '0' : '') + d; - }, - ddd: function() { - return _this55.options.i18n.weekdaysShort[_this55.date.getDay()]; - }, - dddd: function() { - return _this55.options.i18n.weekdays[_this55.date.getDay()]; - }, - m: function() { - return _this55.date.getMonth() + 1; - }, - mm: function() { - const m = _this55.date.getMonth() + 1; - return (m < 10 ? '0' : '') + m; - }, - mmm: function() { - return _this55.options.i18n.monthsShort[_this55.date.getMonth()]; - }, - mmmm: function() { - return _this55.options.i18n.months[_this55.date.getMonth()]; - }, - yy: function() { - return ('' + _this55.date.getFullYear()).slice(2); - }, - yyyy: function() { - return _this55.date.getFullYear(); - }, - }; - }, - - /** + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleInputChangeBound = this._handleInputChange.bind(this); + this._handleCalendarClickBound = this._handleCalendarClick.bind(this); + this._finishSelectionBound = this._finishSelection.bind(this); + this._handleMonthChange = this._handleMonthChange.bind(this); + this._closeBound = this.close.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.el.addEventListener('change', this._handleInputChangeBound); + this.calendarEl.addEventListener('click', this._handleCalendarClickBound); + this.doneBtn.addEventListener('click', this._finishSelectionBound); + this.cancelBtn.addEventListener('click', this._closeBound); + + if (this.options.showClearBtn) { + this._handleClearClickBound = this._handleClearClick.bind(this); + this.clearBtn.addEventListener('click', this._handleClearClickBound); + } + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + var _this55 = this; + + this.$modalEl = $(Datepicker._template); + this.modalEl = this.$modalEl[0]; + + this.calendarEl = this.modalEl.querySelector('.pika-single'); + + this.yearTextEl = this.modalEl.querySelector('.year-text'); + this.dateTextEl = this.modalEl.querySelector('.date-text'); + if (this.options.showClearBtn) { + this.clearBtn = this.modalEl.querySelector('.datepicker-clear'); + } + this.doneBtn = this.modalEl.querySelector('.datepicker-done'); + this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel'); + + this.formats = { + + d: function () { + return _this55.date.getDate(); + }, + dd: function () { + var d = _this55.date.getDate(); + return (d < 10 ? '0' : '') + d; + }, + ddd: function () { + return _this55.options.i18n.weekdaysShort[_this55.date.getDay()]; + }, + dddd: function () { + return _this55.options.i18n.weekdays[_this55.date.getDay()]; + }, + m: function () { + return _this55.date.getMonth() + 1; + }, + mm: function () { + var m = _this55.date.getMonth() + 1; + return (m < 10 ? '0' : '') + m; + }, + mmm: function () { + return _this55.options.i18n.monthsShort[_this55.date.getMonth()]; + }, + mmmm: function () { + return _this55.options.i18n.months[_this55.date.getMonth()]; + }, + yy: function () { + return ('' + _this55.date.getFullYear()).slice(2); + }, + yyyy: function () { + return _this55.date.getFullYear(); + } + }; + } + + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - this.el.removeEventListener('change', this._handleInputChangeBound); - this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); - }, - }, { - key: '_handleInputClick', - value: function _handleInputClick() { - this.open(); - }, - }, { - key: '_handleInputKeydown', - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - }, - }, { - key: '_handleCalendarClick', - value: function _handleCalendarClick(e) { - if (!this.isOpen) { - return; - } - - const $target = $(e.target); - if (!$target.hasClass('is-disabled')) { - if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { - this.setDate(new Date(e.target.getAttribute('data-pika-year'), e.target.getAttribute('data-pika-month'), e.target.getAttribute('data-pika-day'))); - } - else if ($target.closest('.month-prev').length) { - this.prevMonth(); - } - else if ($target.closest('.month-next').length) { - this.nextMonth(); - } - } - }, - }, { - key: '_handleClearClick', - value: function _handleClearClick() { - this.date = null; - this.setInputValue(); - this.close(); - }, - }, { - key: '_handleMonthChange', - value: function _handleMonthChange(e) { - this.gotoMonth(e.target.value); - }, - }, { - key: '_handleYearChange', - value: function _handleYearChange(e) { - this.gotoYear(e.target.value); - }, - - /** + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + this.el.removeEventListener('change', this._handleInputChangeBound); + this.calendarEl.removeEventListener('click', this._handleCalendarClickBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleCalendarClick", + value: function _handleCalendarClick(e) { + if (!this.isOpen) { + return; + } + + var $target = $(e.target); + if (!$target.hasClass('is-disabled')) { + if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) { + this.setDate(new Date(e.target.getAttribute('data-pika-year'), e.target.getAttribute('data-pika-month'), e.target.getAttribute('data-pika-day'))); + } else if ($target.closest('.month-prev').length) { + this.prevMonth(); + } else if ($target.closest('.month-next').length) { + this.nextMonth(); + } + } + } + }, { + key: "_handleClearClick", + value: function _handleClearClick() { + this.date = null; + this.setInputValue(); + this.close(); + } + }, { + key: "_handleMonthChange", + value: function _handleMonthChange(e) { + this.gotoMonth(e.target.value); + } + }, { + key: "_handleYearChange", + value: function _handleYearChange(e) { + this.gotoYear(e.target.value); + } + + /** * change view to a specific month (zero-index, e.g. 0: January) */ - }, { - key: 'gotoMonth', - value: function gotoMonth(month) { - if (!isNaN(month)) { - this.calendars[0].month = parseInt(month, 10); - this.adjustCalendars(); - } - }, + }, { + key: "gotoMonth", + value: function gotoMonth(month) { + if (!isNaN(month)) { + this.calendars[0].month = parseInt(month, 10); + this.adjustCalendars(); + } + } - /** + /** * change view to a specific full year (e.g. "2012") */ - }, { - key: 'gotoYear', - value: function gotoYear(year) { - if (!isNaN(year)) { - this.calendars[0].year = parseInt(year, 10); - this.adjustCalendars(); - } - }, - }, { - key: '_handleInputChange', - value: function _handleInputChange(e) { - let date = void 0; - - // Prevent change event from being fired when triggered by the plugin - if (e.firedBy === this) { - return; - } - if (this.options.parse) { - date = this.options.parse(this.el.value, this.options.format); - } - else { - date = new Date(Date.parse(this.el.value)); - } - - if (Datepicker._isDate(date)) { - this.setDate(date); - } - // if (!self._v) { - // self.show(); - // } - }, - }, { - key: 'renderDayName', - value: function renderDayName(opts, day, abbr) { - day += opts.firstDay; - while (day >= 7) { - day -= 7; - } - return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; - }, - - /** + }, { + key: "gotoYear", + value: function gotoYear(year) { + if (!isNaN(year)) { + this.calendars[0].year = parseInt(year, 10); + this.adjustCalendars(); + } + } + }, { + key: "_handleInputChange", + value: function _handleInputChange(e) { + var date = void 0; + + // Prevent change event from being fired when triggered by the plugin + if (e.firedBy === this) { + return; + } + if (this.options.parse) { + date = this.options.parse(this.el.value, this.options.format); + } else { + date = new Date(Date.parse(this.el.value)); + } + + if (Datepicker._isDate(date)) { + this.setDate(date); + } + // if (!self._v) { + // self.show(); + // } + } + }, { + key: "renderDayName", + value: function renderDayName(opts, day, abbr) { + day += opts.firstDay; + while (day >= 7) { + day -= 7; + } + return abbr ? opts.i18n.weekdaysAbbrev[day] : opts.i18n.weekdays[day]; + } + + /** * Set input value to the selected date and close Datepicker */ - }, { - key: '_finishSelection', - value: function _finishSelection() { - this.setInputValue(); - this.close(); - }, + }, { + key: "_finishSelection", + value: function _finishSelection() { + this.setInputValue(); + this.close(); + } - /** + /** * Open Datepicker */ - }, { - key: 'open', - value: function open() { - if (this.isOpen) { - return; - } - - this.isOpen = true; - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this); - } - this.draw(); - this.modal.open(); - return this; - }, - - /** - * Close Datepicker - */ - - }, { - key: 'close', - value: function close() { - if (!this.isOpen) { - return; - } - - this.isOpen = false; - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this); - } - this.modal.close(); - return this; - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), 'init', this).call(this, this, els, options); - }, - }, { - key: '_isDate', - value: function _isDate(obj) { - return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) - ); - }, - }, { - key: '_isWeekend', - value: function _isWeekend(date) { - const day = date.getDay(); - return day === 0 || day === 6; - }, - }, { - key: '_setToStartOfDay', - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - }, - }, { - key: '_getDaysInMonth', - value: function _getDaysInMonth(year, month) { - return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - }, - }, { - key: '_isLeapYear', - value: function _isLeapYear(year) { - // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 - return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; - }, - }, { - key: '_compareDates', - value: function _compareDates(a, b) { - // weak date comparison (use setToStartOfDay(date) to ensure correct result) - return a.getTime() === b.getTime(); - }, - }, { - key: '_setToStartOfDay', - value: function _setToStartOfDay(date) { - if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); - }, - - /** - * Get Instance - */ - - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_Datepicker; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); - - return Datepicker; - }(Component); - - Datepicker._template = [''].join(''); - - M.Datepicker = Datepicker; - - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); - } -})(cash); -; (function($) { - 'use strict'; - - const _defaults = { - dialRadius: 135, - outerRadius: 105, - innerRadius: 70, - tickRadius: 20, - duration: 350, - container: null, - defaultTime: 'now', - fromNow: 0, - showClearBtn: false, - - // internationalization - i18n: { - cancel: 'Cancel', - clear: 'Clear', - done: 'Ok', - }, - - autoClose: false, - twelveHour: true, - vibrate: true, - }; - - /** - * @class - * - */ - - const Timepicker = function(_Component16) { - _inherits(Timepicker, _Component16); - - // eslint-disable-next-line no-shadow - function Timepicker(el, options) { - _classCallCheck(this, Timepicker); + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } - const _this56 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); + this.isOpen = true; + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this); + } + this.draw(); + this.modal.open(); + return this; + } - _this56.el.M_Timepicker = _this56; - - _this56.options = $.extend({}, Timepicker.defaults, options); - - _this56.id = M.guid(); - _this56._insertHTMLIntoDOM(); - _this56._setupModal(); - _this56._setupVariables(); - _this56._setupEventHandlers(); - - _this56._clockSetup(); - _this56._pickerSetup(); - return _this56; - } - - _createClass(Timepicker, [{ - key: 'destroy', - - - /** - * Teardown component + /** + * Close Datepicker */ - value: function destroy() { - this._removeEventHandlers(); - this.modal.destroy(); - $(this.modalEl).remove(); - this.el.M_Timepicker = undefined; - }, - /** - * Setup Event Handlers + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this); + } + this.modal.close(); + return this; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Datepicker.__proto__ || Object.getPrototypeOf(Datepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_isDate", + value: function _isDate(obj) { + return (/Date/.test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()) + ); + } + }, { + key: "_isWeekend", + value: function _isWeekend(date) { + var day = date.getDay(); + return day === 0 || day === 6; + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + }, { + key: "_getDaysInMonth", + value: function _getDaysInMonth(year, month) { + return [31, Datepicker._isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; + } + }, { + key: "_isLeapYear", + value: function _isLeapYear(year) { + // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 + return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; + } + }, { + key: "_compareDates", + value: function _compareDates(a, b) { + // weak date comparison (use setToStartOfDay(date) to ensure correct result) + return a.getTime() === b.getTime(); + } + }, { + key: "_setToStartOfDay", + value: function _setToStartOfDay(date) { + if (Datepicker._isDate(date)) date.setHours(0, 0, 0, 0); + } + + /** + * Get Instance */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - this._handleInputKeydownBound = this._handleInputKeydown.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); - this._handleClockClickStartBound = this._handleClockClickStart.bind(this); - this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); - this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); - - this.el.addEventListener('click', this._handleInputClickBound); - this.el.addEventListener('keydown', this._handleInputKeydownBound); - this.plate.addEventListener('mousedown', this._handleClockClickStartBound); - this.plate.addEventListener('touchstart', this._handleClockClickStartBound); - - $(this.spanHours).on('click', this.showView.bind(this, 'hours')); - $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); - }, - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleInputClickBound); - this.el.removeEventListener('keydown', this._handleInputKeydownBound); - }, - }, { - key: '_handleInputClick', - value: function _handleInputClick() { - this.open(); - }, - }, { - key: '_handleInputKeydown', - value: function _handleInputKeydown(e) { - if (e.which === M.keys.ENTER) { - e.preventDefault(); - this.open(); - } - }, - }, { - key: '_handleClockClickStart', - value: function _handleClockClickStart(e) { - e.preventDefault(); - const clockPlateBR = this.plate.getBoundingClientRect(); - const offset = { x: clockPlateBR.left, y: clockPlateBR.top }; - - this.x0 = offset.x + this.options.dialRadius; - this.y0 = offset.y + this.options.dialRadius; - this.moved = false; - const clickPos = Timepicker._Pos(e); - this.dx = clickPos.x - this.x0; - this.dy = clickPos.y - this.y0; - - // Set clock hands - this.setHand(this.dx, this.dy, false); - - // Mousemove on document - document.addEventListener('mousemove', this._handleDocumentClickMoveBound); - document.addEventListener('touchmove', this._handleDocumentClickMoveBound); - - // Mouseup on document - document.addEventListener('mouseup', this._handleDocumentClickEndBound); - document.addEventListener('touchend', this._handleDocumentClickEndBound); - }, - }, { - key: '_handleDocumentClickMove', - value: function _handleDocumentClickMove(e) { - e.preventDefault(); - const clickPos = Timepicker._Pos(e); - const x = clickPos.x - this.x0; - const y = clickPos.y - this.y0; - this.moved = true; - this.setHand(x, y, false, true); - }, - }, { - key: '_handleDocumentClickEnd', - value: function _handleDocumentClickEnd(e) { - const _this57 = this; - - e.preventDefault(); - document.removeEventListener('mouseup', this._handleDocumentClickEndBound); - document.removeEventListener('touchend', this._handleDocumentClickEndBound); - const clickPos = Timepicker._Pos(e); - const x = clickPos.x - this.x0; - const y = clickPos.y - this.y0; - if (this.moved && x === this.dx && y === this.dy) { - this.setHand(x, y); - } + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Datepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - if (this.currentView === 'hours') { - this.showView('minutes', this.options.duration / 2); - } - else if (this.options.autoClose) { - $(this.minutesView).addClass('timepicker-dial-out'); - setTimeout(function() { - _this57.done(); - }, this.options.duration / 2); - } + return Datepicker; + }(Component); - // Unbind mousemove event - document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); - document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); - }, - }, { - key: '_insertHTMLIntoDOM', - value: function _insertHTMLIntoDOM() { - this.$modalEl = $(Timepicker._template); - this.modalEl = this.$modalEl[0]; - this.modalEl.id = 'modal-' + this.id; - - // Append popover to input by default - const containerEl = document.querySelector(this.options.container); - if (this.options.container && !!containerEl) { - this.$modalEl.appendTo(containerEl); - } - else { - this.$modalEl.insertBefore(this.el); - } - }, - }, { - key: '_setupModal', - value: function _setupModal() { - const _this58 = this; - - this.modal = M.Modal.init(this.modalEl, { - onCloseEnd: function() { - _this58.isOpen = false; - }, - }); - }, - }, { - key: '_setupVariables', - value: function _setupVariables() { - this.currentView = 'hours'; - this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; - - this._canvas = this.modalEl.querySelector('.timepicker-canvas'); - this.plate = this.modalEl.querySelector('.timepicker-plate'); - - this.hoursView = this.modalEl.querySelector('.timepicker-hours'); - this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); - this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); - this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); - this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); - this.footer = this.modalEl.querySelector('.timepicker-footer'); - this.amOrPm = 'PM'; - }, - }, { - key: '_pickerSetup', - value: function _pickerSetup() { - - const $clearBtn = $('').appendTo(this.footer).on('click', this.clear.bind(this)); - if (this.options.showClearBtn) { - $clearBtn.css({ visibility: '' }); - } + Datepicker._template = [''].join(''); - const confirmationBtnsContainer = $('
'); - $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); - $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); - confirmationBtnsContainer.appendTo(this.footer); - }, - }, { - key: '_clockSetup', - value: function _clockSetup() { - if (this.options.twelveHour) { - this.$amBtn = $('
AM
'); - this.$pmBtn = $('
PM
'); - this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); - } + M.Datepicker = Datepicker; - this._buildHoursView(); - this._buildMinutesView(); - this._buildSVGClock(); - }, - }, { - key: '_buildSVGClock', - value: function _buildSVGClock() { - // Draw clock hands and others - const dialRadius = this.options.dialRadius; - const tickRadius = this.options.tickRadius; - const diameter = dialRadius * 2; - - const svg = Timepicker._createSVGEl('svg'); - svg.setAttribute('class', 'timepicker-svg'); - svg.setAttribute('width', diameter); - svg.setAttribute('height', diameter); - const g = Timepicker._createSVGEl('g'); - g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); - const bearing = Timepicker._createSVGEl('circle'); - bearing.setAttribute('class', 'timepicker-canvas-bearing'); - bearing.setAttribute('cx', 0); - bearing.setAttribute('cy', 0); - bearing.setAttribute('r', 4); - const hand = Timepicker._createSVGEl('line'); - hand.setAttribute('x1', 0); - hand.setAttribute('y1', 0); - const bg = Timepicker._createSVGEl('circle'); - bg.setAttribute('class', 'timepicker-canvas-bg'); - bg.setAttribute('r', tickRadius); - g.appendChild(hand); - g.appendChild(bg); - g.appendChild(bearing); - svg.appendChild(g); - this._canvas.appendChild(svg); - - this.hand = hand; - this.bg = bg; - this.bearing = bearing; - this.g = g; - }, - }, { - key: '_buildHoursView', - value: function _buildHoursView() { - const $tick = $('
'); - // Hours view - if (this.options.twelveHour) { - for (let i = 1; i < 13; i += 1) { - const tick = $tick.clone(); - const radian = i / 6 * Math.PI; - const radius = this.options.outerRadius; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px', - }); - tick.html(i === 0 ? '00' : i); - this.hoursView.appendChild(tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } - else { - for (let _i2 = 0; _i2 < 24; _i2 += 1) { - const _tick = $tick.clone(); - const _radian = _i2 / 6 * Math.PI; - const inner = _i2 > 0 && _i2 < 13; - const _radius = inner ? this.options.innerRadius : this.options.outerRadius; - _tick.css({ - left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px', - }); - _tick.html(_i2 === 0 ? '00' : _i2); - this.hoursView.appendChild(_tick[0]); - // tick.on(mousedownEvent, mousedown); - } - } - }, - }, { - key: '_buildMinutesView', - value: function _buildMinutesView() { - const $tick = $('
'); - // Minutes view - for (let i = 0; i < 60; i += 5) { - const tick = $tick.clone(); - const radian = i / 30 * Math.PI; - tick.css({ - left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', - top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px', - }); - tick.html(Timepicker._addLeadingZero(i)); - this.minutesView.appendChild(tick[0]); - } - }, - }, { - key: '_handleAmPmClick', - value: function _handleAmPmClick(e) { - const $btnClicked = $(e.target); - this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; - this._updateAmPmView(); - }, - }, { - key: '_updateAmPmView', - value: function _updateAmPmView() { - if (this.options.twelveHour) { - this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); - this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); - } - }, - }, { - key: '_updateTimeFromInput', - value: function _updateTimeFromInput() { - // Get the time - let value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); - if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { - if (value[1].toUpperCase().indexOf('AM') > 0) { - this.amOrPm = 'AM'; - } - else { - this.amOrPm = 'PM'; - } - value[1] = value[1].replace('AM', '').replace('PM', ''); - } - if (value[0] === 'now') { - const now = new Date(+new Date() + this.options.fromNow); - value = [now.getHours(), now.getMinutes()]; - if (this.options.twelveHour) { - this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; - } - } - this.hours = +value[0] || 0; - this.minutes = +value[1] || 0; - this.spanHours.innerHTML = this.hours; - this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); - - this._updateAmPmView(); - }, - }, { - key: 'showView', - value: function showView(view, delay) { - if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') { - // raiseCallback(this.options.beforeHourSelect); - } - const isHours = view === 'hours', - nextView = isHours ? this.hoursView : this.minutesView, - hideView = isHours ? this.minutesView : this.hoursView; - this.currentView = view; - - $(this.spanHours).toggleClass('text-primary', isHours); - $(this.spanMinutes).toggleClass('text-primary', !isHours); - - // Transition view - hideView.classList.add('timepicker-dial-out'); - $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); - - // Reset clock hand - this.resetClock(delay); - - // After transitions ended - clearTimeout(this.toggleViewTimer); - this.toggleViewTimer = setTimeout(function() { - $(hideView).css('visibility', 'hidden'); - }, this.options.duration); - }, - }, { - key: 'resetClock', - value: function resetClock(delay) { - const view = this.currentView, - value = this[view], - isHours = view === 'hours', - unit = Math.PI / (isHours ? 6 : 30), - radian = value * unit, - radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, - x = Math.sin(radian) * radius, - y = -Math.cos(radian) * radius, - self = this; - - if (delay) { - $(this.canvas).addClass('timepicker-canvas-out'); - setTimeout(function() { - $(self.canvas).removeClass('timepicker-canvas-out'); - self.setHand(x, y); - }, delay); - } - else { - this.setHand(x, y); - } - }, - }, { - key: 'setHand', - value: function setHand(x, y, roundBy5) { - const _this59 = this; - - let radian = Math.atan2(x, -y), - // eslint-disable-next-line prefer-const - isHours = this.currentView === 'hours', - // eslint-disable-next-line prefer-const - unit = Math.PI / (isHours || roundBy5 ? 6 : 30), - // eslint-disable-next-line prefer-const - z = Math.sqrt(x * x + y * y), - // eslint-disable-next-line prefer-const - inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, - radius = inner ? this.options.innerRadius : this.options.outerRadius; - - if (this.options.twelveHour) { - radius = this.options.outerRadius; - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Datepicker, 'datepicker', 'M_Datepicker'); + } +})(cash); +; (function ($) { + 'use strict'; + + var _defaults = { + dialRadius: 135, + outerRadius: 105, + innerRadius: 70, + tickRadius: 20, + duration: 350, + container: null, + defaultTime: 'now', // default time, 'now' or '13:14' e.g. + fromNow: 0, // Millisecond offset from the defaultTime + showClearBtn: false, + + // internationalization + i18n: { + cancel: 'Cancel', + clear: 'Clear', + done: 'Ok' + }, + + autoClose: false, // auto close when minute is selected + twelveHour: true, // change to 12 hour AM/PM clock from 24 hour + vibrate: true // vibrate the device when dragging clock hand + }; + + /** + * @class + * + */ - // Radian should in range [0, 2PI] - if (radian < 0) { - radian = Math.PI * 2 + radian; - } + var Timepicker = function (_Component16) { + _inherits(Timepicker, _Component16); - // Get the round value - let value = Math.round(radian / unit); + function Timepicker(el, options) { + _classCallCheck(this, Timepicker); - // Get the round radian - radian = value * unit; + var _this56 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options)); - // Correct the hours or minutes - if (this.options.twelveHour) { - if (isHours) { - if (value === 0) value = 12; - } - else { - if (roundBy5) value *= 5; - if (value === 60) value = 0; - } - } - else if (isHours) { - if (value === 12) { - value = 0; - } - value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; - } - else { - if (roundBy5) { - value *= 5; - } - if (value === 60) { - value = 0; - } - } + _this56.el.M_Timepicker = _this56; - // Once hours or minutes changed, vibrate the device - if (this[this.currentView] !== value) { - if (this.vibrate && this.options.vibrate) { - // Do not vibrate too frequently - if (!this.vibrateTimer) { - navigator[this.vibrate](10); - this.vibrateTimer = setTimeout(function() { - _this59.vibrateTimer = null; - }, 100); - } - } - } + _this56.options = $.extend({}, Timepicker.defaults, options); - this[this.currentView] = value; - if (isHours) { - this['spanHours'].innerHTML = value; - } - else { - this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); - } + _this56.id = M.guid(); + _this56._insertHTMLIntoDOM(); + _this56._setupModal(); + _this56._setupVariables(); + _this56._setupEventHandlers(); - // Set clock hand and others' position - const cx1 = Math.sin(radian) * (radius - this.options.tickRadius), - cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), - cx2 = Math.sin(radian) * radius, - cy2 = -Math.cos(radian) * radius; - this.hand.setAttribute('x2', cx1); - this.hand.setAttribute('y2', cy1); - this.bg.setAttribute('cx', cx2); - this.bg.setAttribute('cy', cy2); - }, - }, { - key: 'open', - value: function open() { - if (this.isOpen) { - return; - } + _this56._clockSetup(); + _this56._pickerSetup(); + return _this56; + } - this.isOpen = true; - this._updateTimeFromInput(); - this.showView('hours'); - this.modal.open(); - }, - }, { - key: 'close', - value: function close() { - if (!this.isOpen) { - return; - } + _createClass(Timepicker, [{ + key: "destroy", - this.isOpen = false; - this.modal.close(); - }, - /** - * Finish timepicker selection. + /** + * Teardown component */ + value: function destroy() { + this._removeEventHandlers(); + this.modal.destroy(); + $(this.modalEl).remove(); + this.el.M_Timepicker = undefined; + } - }, { - key: 'done', - value: function done(e, clearValue) { - // Set input value - const last = this.el.value; - let value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); - this.time = value; - if (!clearValue && this.options.twelveHour) { - value = value + ' ' + this.amOrPm; - } - this.el.value = value; + /** + * Setup Event Handlers + */ - // Trigger change event - if (value !== last) { - this.$el.trigger('change'); - } + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleInputKeydownBound = this._handleInputKeydown.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleClockClickStartBound = this._handleClockClickStart.bind(this); + this._handleDocumentClickMoveBound = this._handleDocumentClickMove.bind(this); + this._handleDocumentClickEndBound = this._handleDocumentClickEnd.bind(this); + + this.el.addEventListener('click', this._handleInputClickBound); + this.el.addEventListener('keydown', this._handleInputKeydownBound); + this.plate.addEventListener('mousedown', this._handleClockClickStartBound); + this.plate.addEventListener('touchstart', this._handleClockClickStartBound); + + $(this.spanHours).on('click', this.showView.bind(this, 'hours')); + $(this.spanMinutes).on('click', this.showView.bind(this, 'minutes')); + } + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleInputClickBound); + this.el.removeEventListener('keydown', this._handleInputKeydownBound); + } + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + this.open(); + } + }, { + key: "_handleInputKeydown", + value: function _handleInputKeydown(e) { + if (e.which === M.keys.ENTER) { + e.preventDefault(); + this.open(); + } + } + }, { + key: "_handleClockClickStart", + value: function _handleClockClickStart(e) { + e.preventDefault(); + var clockPlateBR = this.plate.getBoundingClientRect(); + var offset = { x: clockPlateBR.left, y: clockPlateBR.top }; + + this.x0 = offset.x + this.options.dialRadius; + this.y0 = offset.y + this.options.dialRadius; + this.moved = false; + var clickPos = Timepicker._Pos(e); + this.dx = clickPos.x - this.x0; + this.dy = clickPos.y - this.y0; + + // Set clock hands + this.setHand(this.dx, this.dy, false); + + // Mousemove on document + document.addEventListener('mousemove', this._handleDocumentClickMoveBound); + document.addEventListener('touchmove', this._handleDocumentClickMoveBound); + + // Mouseup on document + document.addEventListener('mouseup', this._handleDocumentClickEndBound); + document.addEventListener('touchend', this._handleDocumentClickEndBound); + } + }, { + key: "_handleDocumentClickMove", + value: function _handleDocumentClickMove(e) { + e.preventDefault(); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + this.moved = true; + this.setHand(x, y, false, true); + } + }, { + key: "_handleDocumentClickEnd", + value: function _handleDocumentClickEnd(e) { + var _this57 = this; + + e.preventDefault(); + document.removeEventListener('mouseup', this._handleDocumentClickEndBound); + document.removeEventListener('touchend', this._handleDocumentClickEndBound); + var clickPos = Timepicker._Pos(e); + var x = clickPos.x - this.x0; + var y = clickPos.y - this.y0; + if (this.moved && x === this.dx && y === this.dy) { + this.setHand(x, y); + } + + if (this.currentView === 'hours') { + this.showView('minutes', this.options.duration / 2); + } else if (this.options.autoClose) { + $(this.minutesView).addClass('timepicker-dial-out'); + setTimeout(function () { + _this57.done(); + }, this.options.duration / 2); + } + + // Unbind mousemove event + document.removeEventListener('mousemove', this._handleDocumentClickMoveBound); + document.removeEventListener('touchmove', this._handleDocumentClickMoveBound); + } + }, { + key: "_insertHTMLIntoDOM", + value: function _insertHTMLIntoDOM() { + this.$modalEl = $(Timepicker._template); + this.modalEl = this.$modalEl[0]; + this.modalEl.id = 'modal-' + this.id; + + // Append popover to input by default + var containerEl = document.querySelector(this.options.container); + if (this.options.container && !!containerEl) { + this.$modalEl.appendTo(containerEl); + } else { + this.$modalEl.insertBefore(this.el); + } + } + }, { + key: "_setupModal", + value: function _setupModal() { + var _this58 = this; + + this.modal = M.Modal.init(this.modalEl, { + onCloseEnd: function () { + _this58.isOpen = false; + } + }); + } + }, { + key: "_setupVariables", + value: function _setupVariables() { + this.currentView = 'hours'; + this.vibrate = navigator.vibrate ? 'vibrate' : navigator.webkitVibrate ? 'webkitVibrate' : null; + + this._canvas = this.modalEl.querySelector('.timepicker-canvas'); + this.plate = this.modalEl.querySelector('.timepicker-plate'); + + this.hoursView = this.modalEl.querySelector('.timepicker-hours'); + this.minutesView = this.modalEl.querySelector('.timepicker-minutes'); + this.spanHours = this.modalEl.querySelector('.timepicker-span-hours'); + this.spanMinutes = this.modalEl.querySelector('.timepicker-span-minutes'); + this.spanAmPm = this.modalEl.querySelector('.timepicker-span-am-pm'); + this.footer = this.modalEl.querySelector('.timepicker-footer'); + this.amOrPm = 'PM'; + } + }, { + key: "_pickerSetup", + value: function _pickerSetup() { + + var $clearBtn = $('').appendTo(this.footer).on('click', this.clear.bind(this)); + if (this.options.showClearBtn) { + $clearBtn.css({ visibility: '' }); + } + + var confirmationBtnsContainer = $('
'); + $('').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this)); + $('').appendTo(confirmationBtnsContainer).on('click', this.done.bind(this)); + confirmationBtnsContainer.appendTo(this.footer); + } + }, { + key: "_clockSetup", + value: function _clockSetup() { + if (this.options.twelveHour) { + this.$amBtn = $('
AM
'); + this.$pmBtn = $('
PM
'); + this.$amBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + this.$pmBtn.on('click', this._handleAmPmClick.bind(this)).appendTo(this.spanAmPm); + } + + this._buildHoursView(); + this._buildMinutesView(); + this._buildSVGClock(); + } + }, { + key: "_buildSVGClock", + value: function _buildSVGClock() { + // Draw clock hands and others + var dialRadius = this.options.dialRadius; + var tickRadius = this.options.tickRadius; + var diameter = dialRadius * 2; + + var svg = Timepicker._createSVGEl('svg'); + svg.setAttribute('class', 'timepicker-svg'); + svg.setAttribute('width', diameter); + svg.setAttribute('height', diameter); + var g = Timepicker._createSVGEl('g'); + g.setAttribute('transform', 'translate(' + dialRadius + ',' + dialRadius + ')'); + var bearing = Timepicker._createSVGEl('circle'); + bearing.setAttribute('class', 'timepicker-canvas-bearing'); + bearing.setAttribute('cx', 0); + bearing.setAttribute('cy', 0); + bearing.setAttribute('r', 4); + var hand = Timepicker._createSVGEl('line'); + hand.setAttribute('x1', 0); + hand.setAttribute('y1', 0); + var bg = Timepicker._createSVGEl('circle'); + bg.setAttribute('class', 'timepicker-canvas-bg'); + bg.setAttribute('r', tickRadius); + g.appendChild(hand); + g.appendChild(bg); + g.appendChild(bearing); + svg.appendChild(g); + this._canvas.appendChild(svg); + + this.hand = hand; + this.bg = bg; + this.bearing = bearing; + this.g = g; + } + }, { + key: "_buildHoursView", + value: function _buildHoursView() { + var $tick = $('
'); + // Hours view + if (this.options.twelveHour) { + for (var i = 1; i < 13; i += 1) { + var tick = $tick.clone(); + var radian = i / 6 * Math.PI; + var radius = this.options.outerRadius; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * radius - this.options.tickRadius + 'px' + }); + tick.html(i === 0 ? '00' : i); + this.hoursView.appendChild(tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } else { + for (var _i2 = 0; _i2 < 24; _i2 += 1) { + var _tick = $tick.clone(); + var _radian = _i2 / 6 * Math.PI; + var inner = _i2 > 0 && _i2 < 13; + var _radius = inner ? this.options.innerRadius : this.options.outerRadius; + _tick.css({ + left: this.options.dialRadius + Math.sin(_radian) * _radius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(_radian) * _radius - this.options.tickRadius + 'px' + }); + _tick.html(_i2 === 0 ? '00' : _i2); + this.hoursView.appendChild(_tick[0]); + // tick.on(mousedownEvent, mousedown); + } + } + } + }, { + key: "_buildMinutesView", + value: function _buildMinutesView() { + var $tick = $('
'); + // Minutes view + for (var i = 0; i < 60; i += 5) { + var tick = $tick.clone(); + var radian = i / 30 * Math.PI; + tick.css({ + left: this.options.dialRadius + Math.sin(radian) * this.options.outerRadius - this.options.tickRadius + 'px', + top: this.options.dialRadius - Math.cos(radian) * this.options.outerRadius - this.options.tickRadius + 'px' + }); + tick.html(Timepicker._addLeadingZero(i)); + this.minutesView.appendChild(tick[0]); + } + } + }, { + key: "_handleAmPmClick", + value: function _handleAmPmClick(e) { + var $btnClicked = $(e.target); + this.amOrPm = $btnClicked.hasClass('am-btn') ? 'AM' : 'PM'; + this._updateAmPmView(); + } + }, { + key: "_updateAmPmView", + value: function _updateAmPmView() { + if (this.options.twelveHour) { + this.$amBtn.toggleClass('text-primary', this.amOrPm === 'AM'); + this.$pmBtn.toggleClass('text-primary', this.amOrPm === 'PM'); + } + } + }, { + key: "_updateTimeFromInput", + value: function _updateTimeFromInput() { + // Get the time + var value = ((this.el.value || this.options.defaultTime || '') + '').split(':'); + if (this.options.twelveHour && !(typeof value[1] === 'undefined')) { + if (value[1].toUpperCase().indexOf("AM") > 0) { + this.amOrPm = 'AM'; + } else { + this.amOrPm = 'PM'; + } + value[1] = value[1].replace("AM", "").replace("PM", ""); + } + if (value[0] === 'now') { + var now = new Date(+new Date() + this.options.fromNow); + value = [now.getHours(), now.getMinutes()]; + if (this.options.twelveHour) { + this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM'; + } + } + this.hours = +value[0] || 0; + this.minutes = +value[1] || 0; + this.spanHours.innerHTML = this.hours; + this.spanMinutes.innerHTML = Timepicker._addLeadingZero(this.minutes); + + this._updateAmPmView(); + } + }, { + key: "showView", + value: function showView(view, delay) { + if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") { + // raiseCallback(this.options.beforeHourSelect); + } + var isHours = view === 'hours', + nextView = isHours ? this.hoursView : this.minutesView, + hideView = isHours ? this.minutesView : this.hoursView; + this.currentView = view; + + $(this.spanHours).toggleClass('text-primary', isHours); + $(this.spanMinutes).toggleClass('text-primary', !isHours); + + // Transition view + hideView.classList.add('timepicker-dial-out'); + $(nextView).css('visibility', 'visible').removeClass('timepicker-dial-out'); + + // Reset clock hand + this.resetClock(delay); + + // After transitions ended + clearTimeout(this.toggleViewTimer); + this.toggleViewTimer = setTimeout(function () { + $(hideView).css('visibility', 'hidden'); + }, this.options.duration); + } + }, { + key: "resetClock", + value: function resetClock(delay) { + var view = this.currentView, + value = this[view], + isHours = view === 'hours', + unit = Math.PI / (isHours ? 6 : 30), + radian = value * unit, + radius = isHours && value > 0 && value < 13 ? this.options.innerRadius : this.options.outerRadius, + x = Math.sin(radian) * radius, + y = -Math.cos(radian) * radius, + self = this; + + if (delay) { + $(this.canvas).addClass('timepicker-canvas-out'); + setTimeout(function () { + $(self.canvas).removeClass('timepicker-canvas-out'); + self.setHand(x, y); + }, delay); + } else { + this.setHand(x, y); + } + } + }, { + key: "setHand", + value: function setHand(x, y, roundBy5) { + var _this59 = this; + + var radian = Math.atan2(x, -y), + isHours = this.currentView === 'hours', + unit = Math.PI / (isHours || roundBy5 ? 6 : 30), + z = Math.sqrt(x * x + y * y), + inner = isHours && z < (this.options.outerRadius + this.options.innerRadius) / 2, + radius = inner ? this.options.innerRadius : this.options.outerRadius; + + if (this.options.twelveHour) { + radius = this.options.outerRadius; + } + + // Radian should in range [0, 2PI] + if (radian < 0) { + radian = Math.PI * 2 + radian; + } + + // Get the round value + var value = Math.round(radian / unit); + + // Get the round radian + radian = value * unit; + + // Correct the hours or minutes + if (this.options.twelveHour) { + if (isHours) { + if (value === 0) value = 12; + } else { + if (roundBy5) value *= 5; + if (value === 60) value = 0; + } + } else { + if (isHours) { + if (value === 12) { + value = 0; + } + value = inner ? value === 0 ? 12 : value : value === 0 ? 0 : value + 12; + } else { + if (roundBy5) { + value *= 5; + } + if (value === 60) { + value = 0; + } + } + } + + // Once hours or minutes changed, vibrate the device + if (this[this.currentView] !== value) { + if (this.vibrate && this.options.vibrate) { + // Do not vibrate too frequently + if (!this.vibrateTimer) { + navigator[this.vibrate](10); + this.vibrateTimer = setTimeout(function () { + _this59.vibrateTimer = null; + }, 100); + } + } + } + + this[this.currentView] = value; + if (isHours) { + this['spanHours'].innerHTML = value; + } else { + this['spanMinutes'].innerHTML = Timepicker._addLeadingZero(value); + } + + // Set clock hand and others' position + var cx1 = Math.sin(radian) * (radius - this.options.tickRadius), + cy1 = -Math.cos(radian) * (radius - this.options.tickRadius), + cx2 = Math.sin(radian) * radius, + cy2 = -Math.cos(radian) * radius; + this.hand.setAttribute('x2', cx1); + this.hand.setAttribute('y2', cy1); + this.bg.setAttribute('cx', cx2); + this.bg.setAttribute('cy', cy2); + } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + this._updateTimeFromInput(); + this.showView('hours'); + this.modal.open(); + } + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + this.modal.close(); + } + + /** + * Finish timepicker selection. + */ - this.close(); - this.el.focus(); - }, - }, { - key: 'clear', - value: function clear() { - this.done(null, true); - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), 'init', this).call(this, this, els, options); - }, - }, { - key: '_addLeadingZero', - value: function _addLeadingZero(num) { - return (num < 10 ? '0' : '') + num; - }, - }, { - key: '_createSVGEl', - value: function _createSVGEl(name) { - const svgNS = 'http://www.w3.org/2000/svg'; - return document.createElementNS(svgNS, name); - }, - - /** + }, { + key: "done", + value: function done(e, clearValue) { + // Set input value + var last = this.el.value; + var value = clearValue ? '' : Timepicker._addLeadingZero(this.hours) + ':' + Timepicker._addLeadingZero(this.minutes); + this.time = value; + if (!clearValue && this.options.twelveHour) { + value = value + " " + this.amOrPm; + } + this.el.value = value; + + // Trigger change event + if (value !== last) { + this.$el.trigger('change'); + } + + this.close(); + this.el.focus(); + } + }, { + key: "clear", + value: function clear() { + this.done(null, true); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Timepicker.__proto__ || Object.getPrototypeOf(Timepicker), "init", this).call(this, this, els, options); + } + }, { + key: "_addLeadingZero", + value: function _addLeadingZero(num) { + return (num < 10 ? '0' : '') + num; + } + }, { + key: "_createSVGEl", + value: function _createSVGEl(name) { + var svgNS = 'http://www.w3.org/2000/svg'; + return document.createElementNS(svgNS, name); + } + + /** * @typedef {Object} Point * @property {number} x The X Coordinate * @property {number} y The Y Coordinate */ - /** + /** * Get x position of mouse or touch event * @param {Event} e * @return {Point} x and y location */ - }, { - key: '_Pos', - value: function _Pos(e) { - if (e.targetTouches && e.targetTouches.length >= 1) { - return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; - } - // mouse event - return { x: e.clientX, y: e.clientY }; - }, + }, { + key: "_Pos", + value: function _Pos(e) { + if (e.targetTouches && e.targetTouches.length >= 1) { + return { x: e.targetTouches[0].clientX, y: e.targetTouches[0].clientY }; + } + // mouse event + return { x: e.clientX, y: e.clientY }; + } - /** + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_Timepicker; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Timepicker; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return Timepicker; - }(Component); + return Timepicker; + }(Component); - Timepicker._template = [''].join(''); + Timepicker._template = [''].join(''); - M.Timepicker = Timepicker; + M.Timepicker = Timepicker; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Timepicker, 'timepicker', 'M_Timepicker'); + } })(cash); -; (function($) { - 'use strict'; +; (function ($) { + 'use strict'; - const _defaults = {}; + var _defaults = {}; - /** + /** * @class * */ - const CharacterCounter = function(_Component17) { - _inherits(CharacterCounter, _Component17); + var CharacterCounter = function (_Component17) { + _inherits(CharacterCounter, _Component17); - /** + /** * Construct CharacterCounter instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function CharacterCounter(el, options) { - _classCallCheck(this, CharacterCounter); + function CharacterCounter(el, options) { + _classCallCheck(this, CharacterCounter); - const _this60 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); + var _this60 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options)); - _this60.el.M_CharacterCounter = _this60; + _this60.el.M_CharacterCounter = _this60; - /** + /** * Options for the character counter */ - _this60.options = $.extend({}, CharacterCounter.defaults, options); + _this60.options = $.extend({}, CharacterCounter.defaults, options); - _this60.isInvalid = false; - _this60.isValidLength = false; - _this60._setupCounter(); - _this60._setupEventHandlers(); - return _this60; - } + _this60.isInvalid = false; + _this60.isValidLength = false; + _this60._setupCounter(); + _this60._setupEventHandlers(); + return _this60; + } - _createClass(CharacterCounter, [{ - key: 'destroy', + _createClass(CharacterCounter, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this.el.CharacterCounter = undefined; - this._removeCounter(); - }, + value: function destroy() { + this._removeEventHandlers(); + this.el.CharacterCounter = undefined; + this._removeCounter(); + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - this._handleUpdateCounterBound = this.updateCounter.bind(this); + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleUpdateCounterBound = this.updateCounter.bind(this); - this.el.addEventListener('focus', this._handleUpdateCounterBound, true); - this.el.addEventListener('input', this._handleUpdateCounterBound, true); - }, + this.el.addEventListener('focus', this._handleUpdateCounterBound, true); + this.el.addEventListener('input', this._handleUpdateCounterBound, true); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); - this.el.removeEventListener('input', this._handleUpdateCounterBound, true); - }, + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('focus', this._handleUpdateCounterBound, true); + this.el.removeEventListener('input', this._handleUpdateCounterBound, true); + } - /** + /** * Setup counter element */ - }, { - key: '_setupCounter', - value: function _setupCounter() { - this.counterEl = document.createElement('span'); - $(this.counterEl).addClass('character-counter').css({ - float: 'right', - 'font-size': '12px', - height: 1, - }); + }, { + key: "_setupCounter", + value: function _setupCounter() { + this.counterEl = document.createElement('span'); + $(this.counterEl).addClass('character-counter').css({ + float: 'right', + 'font-size': '12px', + height: 1 + }); - this.$el.parent().append(this.counterEl); - }, + this.$el.parent().append(this.counterEl); + } - /** + /** * Remove counter element */ - }, { - key: '_removeCounter', - value: function _removeCounter() { - $(this.counterEl).remove(); - }, + }, { + key: "_removeCounter", + value: function _removeCounter() { + $(this.counterEl).remove(); + } - /** + /** * Update counter */ - }, { - key: 'updateCounter', - value: function updateCounter() { - const maxLength = +this.$el.attr('data-length'), - actualLength = this.el.value.length; - this.isValidLength = actualLength <= maxLength; - let counterString = actualLength; + }, { + key: "updateCounter", + value: function updateCounter() { + var maxLength = +this.$el.attr('data-length'), + actualLength = this.el.value.length; + this.isValidLength = actualLength <= maxLength; + var counterString = actualLength; - if (maxLength) { - counterString += '/' + maxLength; - this._validateInput(); - } + if (maxLength) { + counterString += '/' + maxLength; + this._validateInput(); + } - $(this.counterEl).html(counterString); - }, + $(this.counterEl).html(counterString); + } - /** + /** * Add validation classes */ - }, { - key: '_validateInput', - value: function _validateInput() { - if (this.isValidLength && this.isInvalid) { - this.isInvalid = false; - this.$el.removeClass('invalid'); - } - else if (!this.isValidLength && !this.isInvalid) { - this.isInvalid = true; - this.$el.removeClass('valid'); - this.$el.addClass('invalid'); - } - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), 'init', this).call(this, this, els, options); - }, - - /** + }, { + key: "_validateInput", + value: function _validateInput() { + if (this.isValidLength && this.isInvalid) { + this.isInvalid = false; + this.$el.removeClass('invalid'); + } else if (!this.isValidLength && !this.isInvalid) { + this.isInvalid = true; + this.$el.removeClass('valid'); + this.$el.addClass('invalid'); + } + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter), "init", this).call(this, this, els, options); + } + + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_CharacterCounter; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_CharacterCounter; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return CharacterCounter; - }(Component); + return CharacterCounter; + }(Component); - M.CharacterCounter = CharacterCounter; + M.CharacterCounter = CharacterCounter; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(CharacterCounter, 'characterCounter', 'M_CharacterCounter'); + } })(cash); -; (function($) { - 'use strict'; - - const _defaults = { - duration: 200, - dist: -100, - shift: 0, - padding: 0, - numVisible: 5, - fullWidth: false, - indicators: false, - noWrap: false, - onCycleTo: null, - }; - - /** +; (function ($) { + 'use strict'; + + var _defaults = { + duration: 200, // ms + dist: -100, // zoom scale TODO: make this more intuitive as an option + shift: 0, // spacing for center image + padding: 0, // Padding between non center items + numVisible: 5, // Number of visible items in carousel + fullWidth: false, // Change to full width styles + indicators: false, // Toggle indicators + noWrap: false, // Don't wrap around and cycle through items. + onCycleTo: null // Callback for when a new slide is cycled to. + }; + + /** * @class * */ - const Carousel = function(_Component18) { - _inherits(Carousel, _Component18); + var Carousel = function (_Component18) { + _inherits(Carousel, _Component18); - /** + /** * Construct Carousel instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function Carousel(el, options) { - _classCallCheck(this, Carousel); + function Carousel(el, options) { + _classCallCheck(this, Carousel); - const _this61 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); + var _this61 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options)); - _this61.el.M_Carousel = _this61; + _this61.el.M_Carousel = _this61; - /** + /** * Options for the carousel * @member Carousel#options * @prop {Number} duration @@ -10736,593 +10425,579 @@ $jscomp.polyfill = function(e, r, p, m) { * @prop {Boolean} noWrap * @prop {Function} onCycleTo */ - _this61.options = $.extend({}, Carousel.defaults, options); - - // Setup - _this61.hasMultipleSlides = _this61.$el.find('.carousel-item').length > 1; - _this61.showIndicators = _this61.options.indicators && _this61.hasMultipleSlides; - _this61.noWrap = _this61.options.noWrap || !_this61.hasMultipleSlides; - _this61.pressed = false; - _this61.dragged = false; - _this61.offset = _this61.target = 0; - _this61.images = []; - _this61.itemWidth = _this61.$el.find('.carousel-item').first().innerWidth(); - _this61.itemHeight = _this61.$el.find('.carousel-item').first().innerHeight(); - _this61.dim = _this61.itemWidth * 2 + _this61.options.padding || 1; - _this61._autoScrollBound = _this61._autoScroll.bind(_this61); - _this61._trackBound = _this61._track.bind(_this61); - - // Full Width carousel setup - if (_this61.options.fullWidth) { - _this61.options.dist = 0; - _this61._setCarouselHeight(); - - // Offset fixed items when indicators. - if (_this61.showIndicators) { - _this61.$el.find('.carousel-fixed-item').addClass('with-indicators'); - } - } - - // Iterate through slides - _this61.$indicators = $('
    '); - // eslint-disable-next-line no-shadow - _this61.$el.find('.carousel-item').each(function(el, i) { - _this61.images.push(el); - if (_this61.showIndicators) { - const $indicator = $('
  • '); - - // Add active to first by default. - if (i === 0) { - $indicator[0].classList.add('active'); - } - - _this61.$indicators.append($indicator); - } - }); - if (_this61.showIndicators) { - _this61.$el.append(_this61.$indicators); - } - _this61.count = _this61.images.length; - - // Cap numVisible at count - _this61.options.numVisible = Math.min(_this61.count, _this61.options.numVisible); - - // Setup cross browser string - _this61.xform = 'transform'; - ['webkit', 'Moz', 'O', 'ms'].every(function(prefix) { - const e = prefix + 'Transform'; - if (typeof document.body.style[e] !== 'undefined') { - _this61.xform = e; - return false; - } - return true; - }); - - _this61._setupEventHandlers(); - _this61._scroll(_this61.offset); - return _this61; - } - - _createClass(Carousel, [{ - key: 'destroy', - - - /** + _this61.options = $.extend({}, Carousel.defaults, options); + + // Setup + _this61.hasMultipleSlides = _this61.$el.find('.carousel-item').length > 1; + _this61.showIndicators = _this61.options.indicators && _this61.hasMultipleSlides; + _this61.noWrap = _this61.options.noWrap || !_this61.hasMultipleSlides; + _this61.pressed = false; + _this61.dragged = false; + _this61.offset = _this61.target = 0; + _this61.images = []; + _this61.itemWidth = _this61.$el.find('.carousel-item').first().innerWidth(); + _this61.itemHeight = _this61.$el.find('.carousel-item').first().innerHeight(); + _this61.dim = _this61.itemWidth * 2 + _this61.options.padding || 1; // Make sure dim is non zero for divisions. + _this61._autoScrollBound = _this61._autoScroll.bind(_this61); + _this61._trackBound = _this61._track.bind(_this61); + + // Full Width carousel setup + if (_this61.options.fullWidth) { + _this61.options.dist = 0; + _this61._setCarouselHeight(); + + // Offset fixed items when indicators. + if (_this61.showIndicators) { + _this61.$el.find('.carousel-fixed-item').addClass('with-indicators'); + } + } + + // Iterate through slides + _this61.$indicators = $('
      '); + _this61.$el.find('.carousel-item').each(function (el, i) { + _this61.images.push(el); + if (_this61.showIndicators) { + var $indicator = $('
    • '); + + // Add active to first by default. + if (i === 0) { + $indicator[0].classList.add('active'); + } + + _this61.$indicators.append($indicator); + } + }); + if (_this61.showIndicators) { + _this61.$el.append(_this61.$indicators); + } + _this61.count = _this61.images.length; + + // Cap numVisible at count + _this61.options.numVisible = Math.min(_this61.count, _this61.options.numVisible); + + // Setup cross browser string + _this61.xform = 'transform'; + ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) { + var e = prefix + 'Transform'; + if (typeof document.body.style[e] !== 'undefined') { + _this61.xform = e; + return false; + } + return true; + }); + + _this61._setupEventHandlers(); + _this61._scroll(_this61.offset); + return _this61; + } + + _createClass(Carousel, [{ + key: "destroy", + + + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this.el.M_Carousel = undefined; - }, + value: function destroy() { + this._removeEventHandlers(); + this.el.M_Carousel = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - const _this62 = this; + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this62 = this; - this._handleCarouselTapBound = this._handleCarouselTap.bind(this); - this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); - this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); - this._handleCarouselClickBound = this._handleCarouselClick.bind(this); + this._handleCarouselTapBound = this._handleCarouselTap.bind(this); + this._handleCarouselDragBound = this._handleCarouselDrag.bind(this); + this._handleCarouselReleaseBound = this._handleCarouselRelease.bind(this); + this._handleCarouselClickBound = this._handleCarouselClick.bind(this); - if (typeof window.ontouchstart !== 'undefined') { - this.el.addEventListener('touchstart', this._handleCarouselTapBound); - this.el.addEventListener('touchmove', this._handleCarouselDragBound); - this.el.addEventListener('touchend', this._handleCarouselReleaseBound); - } + if (typeof window.ontouchstart !== 'undefined') { + this.el.addEventListener('touchstart', this._handleCarouselTapBound); + this.el.addEventListener('touchmove', this._handleCarouselDragBound); + this.el.addEventListener('touchend', this._handleCarouselReleaseBound); + } - this.el.addEventListener('mousedown', this._handleCarouselTapBound); - this.el.addEventListener('mousemove', this._handleCarouselDragBound); - this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.addEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); - this.$indicators.find('.indicator-item').each(function(el) { - el.addEventListener('click', _this62._handleIndicatorClickBound); - }); - } + this.el.addEventListener('mousedown', this._handleCarouselTapBound); + this.el.addEventListener('mousemove', this._handleCarouselDragBound); + this.el.addEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.addEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.addEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this); + this.$indicators.find('.indicator-item').each(function (el, i) { + el.addEventListener('click', _this62._handleIndicatorClickBound); + }); + } - // Resize - const throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); - window.addEventListener('resize', this._handleThrottledResizeBound); - }, + window.addEventListener('resize', this._handleThrottledResizeBound); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - const _this63 = this; - - if (typeof window.ontouchstart !== 'undefined') { - this.el.removeEventListener('touchstart', this._handleCarouselTapBound); - this.el.removeEventListener('touchmove', this._handleCarouselDragBound); - this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); - } - this.el.removeEventListener('mousedown', this._handleCarouselTapBound); - this.el.removeEventListener('mousemove', this._handleCarouselDragBound); - this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); - this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); - this.el.removeEventListener('click', this._handleCarouselClickBound); - - if (this.showIndicators && this.$indicators) { - this.$indicators.find('.indicator-item').each(function(el) { - el.removeEventListener('click', _this63._handleIndicatorClickBound); - }); - } - - window.removeEventListener('resize', this._handleThrottledResizeBound); - }, - - /** + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this63 = this; + + if (typeof window.ontouchstart !== 'undefined') { + this.el.removeEventListener('touchstart', this._handleCarouselTapBound); + this.el.removeEventListener('touchmove', this._handleCarouselDragBound); + this.el.removeEventListener('touchend', this._handleCarouselReleaseBound); + } + this.el.removeEventListener('mousedown', this._handleCarouselTapBound); + this.el.removeEventListener('mousemove', this._handleCarouselDragBound); + this.el.removeEventListener('mouseup', this._handleCarouselReleaseBound); + this.el.removeEventListener('mouseleave', this._handleCarouselReleaseBound); + this.el.removeEventListener('click', this._handleCarouselClickBound); + + if (this.showIndicators && this.$indicators) { + this.$indicators.find('.indicator-item').each(function (el, i) { + el.removeEventListener('click', _this63._handleIndicatorClickBound); + }); + } + + window.removeEventListener('resize', this._handleThrottledResizeBound); + } + + /** * Handle Carousel Tap * @param {Event} e */ - }, { - key: '_handleCarouselTap', - value: function _handleCarouselTap(e) { - // Fixes firefox draggable image bug - if (e.type === 'mousedown' && $(e.target).is('img')) { - e.preventDefault(); - } - this.pressed = true; - this.dragged = false; - this.verticalDragged = false; - this.reference = this._xpos(e); - this.referenceY = this._ypos(e); - - this.velocity = this.amplitude = 0; - this.frame = this.offset; - this.timestamp = Date.now(); - clearInterval(this.ticker); - this.ticker = setInterval(this._trackBound, 100); - }, - - /** + }, { + key: "_handleCarouselTap", + value: function _handleCarouselTap(e) { + // Fixes firefox draggable image bug + if (e.type === 'mousedown' && $(e.target).is('img')) { + e.preventDefault(); + } + this.pressed = true; + this.dragged = false; + this.verticalDragged = false; + this.reference = this._xpos(e); + this.referenceY = this._ypos(e); + + this.velocity = this.amplitude = 0; + this.frame = this.offset; + this.timestamp = Date.now(); + clearInterval(this.ticker); + this.ticker = setInterval(this._trackBound, 100); + } + + /** * Handle Carousel Drag * @param {Event} e */ - }, { - key: '_handleCarouselDrag', - value: function _handleCarouselDrag(e) { - let x = void 0, - y = void 0, - delta = void 0, - deltaY = void 0; - if (this.pressed) { - x = this._xpos(e); - y = this._ypos(e); - delta = this.reference - x; - deltaY = Math.abs(this.referenceY - y); - if (deltaY < 30 && !this.verticalDragged) { - // If vertical scrolling don't allow dragging. - if (delta > 2 || delta < -2) { - this.dragged = true; - this.reference = x; - this._scroll(this.offset + delta); - } - } - else if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } - else { - // Vertical scrolling. - this.verticalDragged = true; - } - } - - if (this.dragged) { - // If dragging don't allow vertical scroll. - e.preventDefault(); - e.stopPropagation(); - return false; - } - }, - - /** + }, { + key: "_handleCarouselDrag", + value: function _handleCarouselDrag(e) { + var x = void 0, + y = void 0, + delta = void 0, + deltaY = void 0; + if (this.pressed) { + x = this._xpos(e); + y = this._ypos(e); + delta = this.reference - x; + deltaY = Math.abs(this.referenceY - y); + if (deltaY < 30 && !this.verticalDragged) { + // If vertical scrolling don't allow dragging. + if (delta > 2 || delta < -2) { + this.dragged = true; + this.reference = x; + this._scroll(this.offset + delta); + } + } else if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } else { + // Vertical scrolling. + this.verticalDragged = true; + } + } + + if (this.dragged) { + // If dragging don't allow vertical scroll. + e.preventDefault(); + e.stopPropagation(); + return false; + } + } + + /** * Handle Carousel Release * @param {Event} e */ - }, { - key: '_handleCarouselRelease', - value: function _handleCarouselRelease(e) { - if (this.pressed) { - this.pressed = false; - } - else { - return; - } - - clearInterval(this.ticker); - this.target = this.offset; - if (this.velocity > 10 || this.velocity < -10) { - this.amplitude = 0.9 * this.velocity; - this.target = this.offset + this.amplitude; - } - this.target = Math.round(this.target / this.dim) * this.dim; - - // No wrap of items. - if (this.noWrap) { - if (this.target >= this.dim * (this.count - 1)) { - this.target = this.dim * (this.count - 1); - } - else if (this.target < 0) { - this.target = 0; - } - } - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - } - return false; - }, - - /** + }, { + key: "_handleCarouselRelease", + value: function _handleCarouselRelease(e) { + if (this.pressed) { + this.pressed = false; + } else { + return; + } + + clearInterval(this.ticker); + this.target = this.offset; + if (this.velocity > 10 || this.velocity < -10) { + this.amplitude = 0.9 * this.velocity; + this.target = this.offset + this.amplitude; + } + this.target = Math.round(this.target / this.dim) * this.dim; + + // No wrap of items. + if (this.noWrap) { + if (this.target >= this.dim * (this.count - 1)) { + this.target = this.dim * (this.count - 1); + } else if (this.target < 0) { + this.target = 0; + } + } + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + } + return false; + } + + /** * Handle Carousel CLick * @param {Event} e */ - }, { - key: '_handleCarouselClick', - value: function _handleCarouselClick(e) { - // Disable clicks if carousel was dragged. - if (this.dragged) { - e.preventDefault(); - e.stopPropagation(); - return false; - } - else if (!this.options.fullWidth) { - const clickedIndex = $(e.target).closest('.carousel-item').index(); - const diff = this._wrap(this.center) - clickedIndex; - - // Disable clicks if carousel was shifted by click - if (diff !== 0) { - e.preventDefault(); - e.stopPropagation(); - } - this._cycleTo(clickedIndex); - } - }, - - /** + }, { + key: "_handleCarouselClick", + value: function _handleCarouselClick(e) { + // Disable clicks if carousel was dragged. + if (this.dragged) { + e.preventDefault(); + e.stopPropagation(); + return false; + } else if (!this.options.fullWidth) { + var clickedIndex = $(e.target).closest('.carousel-item').index(); + var diff = this._wrap(this.center) - clickedIndex; + + // Disable clicks if carousel was shifted by click + if (diff !== 0) { + e.preventDefault(); + e.stopPropagation(); + } + this._cycleTo(clickedIndex); + } + } + + /** * Handle Indicator CLick * @param {Event} e */ - }, { - key: '_handleIndicatorClick', - value: function _handleIndicatorClick(e) { - e.stopPropagation(); + }, { + key: "_handleIndicatorClick", + value: function _handleIndicatorClick(e) { + e.stopPropagation(); - const indicator = $(e.target).closest('.indicator-item'); - if (indicator.length) { - this._cycleTo(indicator.index()); - } - }, + var indicator = $(e.target).closest('.indicator-item'); + if (indicator.length) { + this._cycleTo(indicator.index()); + } + } - /** + /** * Handle Throttle Resize * @param {Event} e */ - }, { - key: '_handleResize', - value: function _handleResize() { - if (this.options.fullWidth) { - this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); - this.imageHeight = this.$el.find('.carousel-item.active').height(); - this.dim = this.itemWidth * 2 + this.options.padding; - this.offset = this.center * 2 * this.itemWidth; - this.target = this.offset; - this._setCarouselHeight(true); - } - else { - this._scroll(); - } - }, - - /** + }, { + key: "_handleResize", + value: function _handleResize(e) { + if (this.options.fullWidth) { + this.itemWidth = this.$el.find('.carousel-item').first().innerWidth(); + this.imageHeight = this.$el.find('.carousel-item.active').height(); + this.dim = this.itemWidth * 2 + this.options.padding; + this.offset = this.center * 2 * this.itemWidth; + this.target = this.offset; + this._setCarouselHeight(true); + } else { + this._scroll(); + } + } + + /** * Set carousel height based on first slide * @param {Booleam} imageOnly - true for image slides */ - }, { - key: '_setCarouselHeight', - value: function _setCarouselHeight(imageOnly) { - const _this64 = this; - - const firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); - const firstImage = firstSlide.find('img').first(); - if (firstImage.length) { - if (firstImage[0].complete) { - // If image won't trigger the load event - const imageHeight = firstImage.height(); - if (imageHeight > 0) { - this.$el.css('height', imageHeight + 'px'); - } - else { - // If image still has no height, use the natural dimensions to calculate - const naturalWidth = firstImage[0].naturalWidth; - const naturalHeight = firstImage[0].naturalHeight; - const adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; - this.$el.css('height', adjustedHeight + 'px'); - } - } - else { - // Get height when image is loaded normally - firstImage.one('load', function(el) { - _this64.$el.css('height', el.offsetHeight + 'px'); - }); - } - } - else if (!imageOnly) { - const slideHeight = firstSlide.height(); - this.$el.css('height', slideHeight + 'px'); - } - }, - - /** + }, { + key: "_setCarouselHeight", + value: function _setCarouselHeight(imageOnly) { + var _this64 = this; + + var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first(); + var firstImage = firstSlide.find('img').first(); + if (firstImage.length) { + if (firstImage[0].complete) { + // If image won't trigger the load event + var imageHeight = firstImage.height(); + if (imageHeight > 0) { + this.$el.css('height', imageHeight + 'px'); + } else { + // If image still has no height, use the natural dimensions to calculate + var naturalWidth = firstImage[0].naturalWidth; + var naturalHeight = firstImage[0].naturalHeight; + var adjustedHeight = this.$el.width() / naturalWidth * naturalHeight; + this.$el.css('height', adjustedHeight + 'px'); + } + } else { + // Get height when image is loaded normally + firstImage.one('load', function (el, i) { + _this64.$el.css('height', el.offsetHeight + 'px'); + }); + } + } else if (!imageOnly) { + var slideHeight = firstSlide.height(); + this.$el.css('height', slideHeight + 'px'); + } + } + + /** * Get x position from event * @param {Event} e */ - }, { - key: '_xpos', - value: function _xpos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientX; - } + }, { + key: "_xpos", + value: function _xpos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientX; + } - // mouse event - return e.clientX; - }, + // mouse event + return e.clientX; + } - /** + /** * Get y position from event * @param {Event} e */ - }, { - key: '_ypos', - value: function _ypos(e) { - // touch event - if (e.targetTouches && e.targetTouches.length >= 1) { - return e.targetTouches[0].clientY; - } + }, { + key: "_ypos", + value: function _ypos(e) { + // touch event + if (e.targetTouches && e.targetTouches.length >= 1) { + return e.targetTouches[0].clientY; + } - // mouse event - return e.clientY; - }, + // mouse event + return e.clientY; + } - /** + /** * Wrap index * @param {Number} x */ - }, { - key: '_wrap', - value: function _wrap(x) { - return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; - }, + }, { + key: "_wrap", + value: function _wrap(x) { + return x >= this.count ? x % this.count : x < 0 ? this._wrap(this.count + x % this.count) : x; + } - /** + /** * Tracks scrolling information */ - }, { - key: '_track', - value: function _track() { - let now = void 0, - elapsed = void 0, - delta = void 0, - v = void 0; + }, { + key: "_track", + value: function _track() { + var now = void 0, + elapsed = void 0, + delta = void 0, + v = void 0; - now = Date.now(); - elapsed = now - this.timestamp; - this.timestamp = now; - delta = this.offset - this.frame; - this.frame = this.offset; + now = Date.now(); + elapsed = now - this.timestamp; + this.timestamp = now; + delta = this.offset - this.frame; + this.frame = this.offset; - v = 1000 * delta / (1 + elapsed); - this.velocity = 0.8 * v + 0.2 * this.velocity; - }, + v = 1000 * delta / (1 + elapsed); + this.velocity = 0.8 * v + 0.2 * this.velocity; + } - /** + /** * Auto scrolls to nearest carousel item. */ - }, { - key: '_autoScroll', - value: function _autoScroll() { - let elapsed = void 0, - delta = void 0; - - if (this.amplitude) { - elapsed = Date.now() - this.timestamp; - delta = this.amplitude * Math.exp(-elapsed / this.options.duration); - if (delta > 2 || delta < -2) { - this._scroll(this.target - delta); - requestAnimationFrame(this._autoScrollBound); - } - else { - this._scroll(this.target); - } - } - }, - - /** + }, { + key: "_autoScroll", + value: function _autoScroll() { + var elapsed = void 0, + delta = void 0; + + if (this.amplitude) { + elapsed = Date.now() - this.timestamp; + delta = this.amplitude * Math.exp(-elapsed / this.options.duration); + if (delta > 2 || delta < -2) { + this._scroll(this.target - delta); + requestAnimationFrame(this._autoScrollBound); + } else { + this._scroll(this.target); + } + } + } + + /** * Scroll to target * @param {Number} x */ - }, { - key: '_scroll', - value: function _scroll(x) { - const _this65 = this; - - // Track scrolling state - if (!this.$el.hasClass('scrolling')) { - this.el.classList.add('scrolling'); - } - if (this.scrollingTimeout != null) { - window.clearTimeout(this.scrollingTimeout); - } - this.scrollingTimeout = window.setTimeout(function() { - _this65.$el.removeClass('scrolling'); - }, this.options.duration); - - // Start actual scroll - let i = void 0, - half = void 0, - delta = void 0, - dir = void 0, - tween = void 0, - el = void 0, - alignment = void 0, - zTranslation = void 0, - tweenedOpacity = void 0, - centerTweenedOpacity = void 0; - const lastCenter = this.center; - const numVisibleOffset = 1 / this.options.numVisible; - - this.offset = typeof x === 'number' ? x : this.offset; - this.center = Math.floor((this.offset + this.dim / 2) / this.dim); - delta = this.offset - this.center * this.dim; - dir = delta < 0 ? 1 : -1; - tween = -dir * delta * 2 / this.dim; - half = this.count >> 1; - - if (this.options.fullWidth) { - alignment = 'translateX(0)'; - centerTweenedOpacity = 1; - } - else { - alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; - alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; - centerTweenedOpacity = 1 - numVisibleOffset * tween; - } - - // Set indicator active - if (this.showIndicators) { - const diff = this.center % this.count; - const activeIndicator = this.$indicators.find('.indicator-item.active'); - if (activeIndicator.index() !== diff) { - activeIndicator.removeClass('active'); - this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - - // Add active class to center item. - if (!$(el).hasClass('active')) { - this.$el.find('.carousel-item').removeClass('active'); - el.classList.add('active'); - } - const transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)'; - this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); - } - - for (i = 1; i <= half; ++i) { - // right side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; - } - else { - zTranslation = this.options.dist * (i * 2 + tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center + i < this.count) { - el = this.images[this._wrap(this.center + i)]; - const _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)'; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString); - } - - // left side - if (this.options.fullWidth) { - zTranslation = this.options.dist; - tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; - } - else { - zTranslation = this.options.dist * (i * 2 - tween * dir); - tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); - } - // Don't show wrapped items. - if (!this.noWrap || this.center - i >= 0) { - el = this.images[this._wrap(this.center - i)]; - const _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)'; - this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); - } - } - - // center - // Don't show wrapped items. - if (!this.noWrap || this.center >= 0 && this.center < this.count) { - el = this.images[this._wrap(this.center)]; - const _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)'; - this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); - } - - // onCycleTo callback - const $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); - if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') { - this.options.onCycleTo.call(this, $currItem[0], this.dragged); - } - - // One time callback - if (typeof this.oneTimeCallback === 'function') { - this.oneTimeCallback.call(this, $currItem[0], this.dragged); - this.oneTimeCallback = null; - } - }, - - /** + }, { + key: "_scroll", + value: function _scroll(x) { + var _this65 = this; + + // Track scrolling state + if (!this.$el.hasClass('scrolling')) { + this.el.classList.add('scrolling'); + } + if (this.scrollingTimeout != null) { + window.clearTimeout(this.scrollingTimeout); + } + this.scrollingTimeout = window.setTimeout(function () { + _this65.$el.removeClass('scrolling'); + }, this.options.duration); + + // Start actual scroll + var i = void 0, + half = void 0, + delta = void 0, + dir = void 0, + tween = void 0, + el = void 0, + alignment = void 0, + zTranslation = void 0, + tweenedOpacity = void 0, + centerTweenedOpacity = void 0; + var lastCenter = this.center; + var numVisibleOffset = 1 / this.options.numVisible; + + this.offset = typeof x === 'number' ? x : this.offset; + this.center = Math.floor((this.offset + this.dim / 2) / this.dim); + delta = this.offset - this.center * this.dim; + dir = delta < 0 ? 1 : -1; + tween = -dir * delta * 2 / this.dim; + half = this.count >> 1; + + if (this.options.fullWidth) { + alignment = 'translateX(0)'; + centerTweenedOpacity = 1; + } else { + alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) '; + alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)'; + centerTweenedOpacity = 1 - numVisibleOffset * tween; + } + + // Set indicator active + if (this.showIndicators) { + var diff = this.center % this.count; + var activeIndicator = this.$indicators.find('.indicator-item.active'); + if (activeIndicator.index() !== diff) { + activeIndicator.removeClass('active'); + this.$indicators.find('.indicator-item').eq(diff)[0].classList.add('active'); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + + // Add active class to center item. + if (!$(el).hasClass('active')) { + this.$el.find('.carousel-item').removeClass('active'); + el.classList.add('active'); + } + var transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)'; + this._updateItemStyle(el, centerTweenedOpacity, 0, transformString); + } + + for (i = 1; i <= half; ++i) { + // right side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 + tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center + i < this.count) { + el = this.images[this._wrap(this.center + i)]; + var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)'; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString); + } + + // left side + if (this.options.fullWidth) { + zTranslation = this.options.dist; + tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1; + } else { + zTranslation = this.options.dist * (i * 2 - tween * dir); + tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir); + } + // Don't show wrapped items. + if (!this.noWrap || this.center - i >= 0) { + el = this.images[this._wrap(this.center - i)]; + var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)'; + this._updateItemStyle(el, tweenedOpacity, -i, _transformString2); + } + } + + // center + // Don't show wrapped items. + if (!this.noWrap || this.center >= 0 && this.center < this.count) { + el = this.images[this._wrap(this.center)]; + var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)'; + this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3); + } + + // onCycleTo callback + var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center)); + if (lastCenter !== this.center && typeof this.options.onCycleTo === "function") { + this.options.onCycleTo.call(this, $currItem[0], this.dragged); + } + + // One time callback + if (typeof this.oneTimeCallback === "function") { + this.oneTimeCallback.call(this, $currItem[0], this.dragged); + this.oneTimeCallback = null; + } + } + + /** * Cycle to target * @param {Element} el * @param {Number} opacity @@ -11330,818 +11005,810 @@ $jscomp.polyfill = function(e, r, p, m) { * @param {String} transform */ - }, { - key: '_updateItemStyle', - value: function _updateItemStyle(el, opacity, zIndex, transform) { - el.style[this.xform] = transform; - el.style.zIndex = zIndex; - el.style.opacity = opacity; - el.style.visibility = 'visible'; - }, + }, { + key: "_updateItemStyle", + value: function _updateItemStyle(el, opacity, zIndex, transform) { + el.style[this.xform] = transform; + el.style.zIndex = zIndex; + el.style.opacity = opacity; + el.style.visibility = 'visible'; + } - /** + /** * Cycle to target * @param {Number} n * @param {Function} callback */ - }, { - key: '_cycleTo', - value: function _cycleTo(n, callback) { - let diff = this.center % this.count - n; - - // Account for wraparound. - if (!this.noWrap) { - if (diff < 0) { - if (Math.abs(diff + this.count) < Math.abs(diff)) { - diff += this.count; - } - } - else if (diff > 0) { - if (Math.abs(diff - this.count) < diff) { - diff -= this.count; - } - } - } - - this.target = this.dim * Math.round(this.offset / this.dim); - // Next - if (diff < 0) { - this.target += this.dim * Math.abs(diff); - - // Prev - } - else if (diff > 0) { - this.target -= this.dim * diff; - } - - // Set one time callback - if (typeof callback === 'function') { - this.oneTimeCallback = callback; - } - - // Scroll - if (this.offset !== this.target) { - this.amplitude = this.target - this.offset; - this.timestamp = Date.now(); - requestAnimationFrame(this._autoScrollBound); - } - }, - - /** + }, { + key: "_cycleTo", + value: function _cycleTo(n, callback) { + var diff = this.center % this.count - n; + + // Account for wraparound. + if (!this.noWrap) { + if (diff < 0) { + if (Math.abs(diff + this.count) < Math.abs(diff)) { + diff += this.count; + } + } else if (diff > 0) { + if (Math.abs(diff - this.count) < diff) { + diff -= this.count; + } + } + } + + this.target = this.dim * Math.round(this.offset / this.dim); + // Next + if (diff < 0) { + this.target += this.dim * Math.abs(diff); + + // Prev + } else if (diff > 0) { + this.target -= this.dim * diff; + } + + // Set one time callback + if (typeof callback === "function") { + this.oneTimeCallback = callback; + } + + // Scroll + if (this.offset !== this.target) { + this.amplitude = this.target - this.offset; + this.timestamp = Date.now(); + requestAnimationFrame(this._autoScrollBound); + } + } + + /** * Cycle to next item * @param {Number} [n] */ - }, { - key: 'next', - value: function next(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } + }, { + key: "next", + value: function next(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } - let index = this.center + n; - if (index > this.count || index < 0) { - if (this.noWrap) { - return; - } + var index = this.center + n; + if (index > this.count || index < 0) { + if (this.noWrap) { + return; + } - index = this._wrap(index); - } - this._cycleTo(index); - }, + index = this._wrap(index); + } + this._cycleTo(index); + } - /** + /** * Cycle to previous item * @param {Number} [n] */ - }, { - key: 'prev', - value: function prev(n) { - if (n === undefined || isNaN(n)) { - n = 1; - } + }, { + key: "prev", + value: function prev(n) { + if (n === undefined || isNaN(n)) { + n = 1; + } - let index = this.center - n; - if (index > this.count || index < 0) { - if (this.noWrap) { - return; - } + var index = this.center - n; + if (index > this.count || index < 0) { + if (this.noWrap) { + return; + } - index = this._wrap(index); - } + index = this._wrap(index); + } - this._cycleTo(index); - }, + this._cycleTo(index); + } - /** + /** * Cycle to nth item * @param {Number} [n] * @param {Function} callback */ - }, { - key: 'set', - value: function set(n, callback) { - if (n === undefined || isNaN(n)) { - n = 0; - } + }, { + key: "set", + value: function set(n, callback) { + if (n === undefined || isNaN(n)) { + n = 0; + } - if (n > this.count || n < 0) { - if (this.noWrap) { - return; - } + if (n > this.count || n < 0) { + if (this.noWrap) { + return; + } - n = this._wrap(n); - } + n = this._wrap(n); + } - this._cycleTo(n, callback); - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), 'init', this).call(this, this, els, options); - }, + this._cycleTo(n, callback); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Carousel.__proto__ || Object.getPrototypeOf(Carousel), "init", this).call(this, this, els, options); + } - /** + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_Carousel; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Carousel; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return Carousel; - }(Component); + return Carousel; + }(Component); - M.Carousel = Carousel; + M.Carousel = Carousel; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Carousel, 'carousel', 'M_Carousel'); + } })(cash); -; (function($) { - 'use strict'; +; (function ($) { + 'use strict'; - const _defaults = { - onOpen: undefined, - onClose: undefined, - }; + var _defaults = { + onOpen: undefined, + onClose: undefined + }; - /** + /** * @class * */ - const TapTarget = function(_Component19) { - _inherits(TapTarget, _Component19); + var TapTarget = function (_Component19) { + _inherits(TapTarget, _Component19); - /** + /** * Construct TapTarget instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function TapTarget(el, options) { - _classCallCheck(this, TapTarget); + function TapTarget(el, options) { + _classCallCheck(this, TapTarget); - const _this66 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); + var _this66 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options)); - _this66.el.M_TapTarget = _this66; + _this66.el.M_TapTarget = _this66; - /** + /** * Options for the select * @member TapTarget#options * @prop {Function} onOpen - Callback function called when feature discovery is opened * @prop {Function} onClose - Callback function called when feature discovery is closed */ - _this66.options = $.extend({}, TapTarget.defaults, options); + _this66.options = $.extend({}, TapTarget.defaults, options); - _this66.isOpen = false; + _this66.isOpen = false; - // setup - _this66.$origin = $('#' + _this66.$el.attr('data-target')); - _this66._setup(); + // setup + _this66.$origin = $('#' + _this66.$el.attr('data-target')); + _this66._setup(); - _this66._calculatePositioning(); - _this66._setupEventHandlers(); - return _this66; - } + _this66._calculatePositioning(); + _this66._setupEventHandlers(); + return _this66; + } - _createClass(TapTarget, [{ - key: 'destroy', + _createClass(TapTarget, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this.el.TapTarget = undefined; - }, + value: function destroy() { + this._removeEventHandlers(); + this.el.TapTarget = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - this._handleDocumentClickBound = this._handleDocumentClick.bind(this); - this._handleTargetClickBound = this._handleTargetClick.bind(this); - this._handleOriginClickBound = this._handleOriginClick.bind(this); + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleDocumentClickBound = this._handleDocumentClick.bind(this); + this._handleTargetClickBound = this._handleTargetClick.bind(this); + this._handleOriginClickBound = this._handleOriginClick.bind(this); - this.el.addEventListener('click', this._handleTargetClickBound); - this.originEl.addEventListener('click', this._handleOriginClickBound); + this.el.addEventListener('click', this._handleTargetClickBound); + this.originEl.addEventListener('click', this._handleOriginClickBound); - // Resize - const throttledResize = M.throttle(this._handleResize, 200); - this._handleThrottledResizeBound = throttledResize.bind(this); + // Resize + var throttledResize = M.throttle(this._handleResize, 200); + this._handleThrottledResizeBound = throttledResize.bind(this); - window.addEventListener('resize', this._handleThrottledResizeBound); - }, + window.addEventListener('resize', this._handleThrottledResizeBound); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('click', this._handleTargetClickBound); - this.originEl.removeEventListener('click', this._handleOriginClickBound); - window.removeEventListener('resize', this._handleThrottledResizeBound); - }, + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('click', this._handleTargetClickBound); + this.originEl.removeEventListener('click', this._handleOriginClickBound); + window.removeEventListener('resize', this._handleThrottledResizeBound); + } - /** + /** * Handle Target Click * @param {Event} e */ - }, { - key: '_handleTargetClick', - value: function _handleTargetClick() { - this.open(); - }, + }, { + key: "_handleTargetClick", + value: function _handleTargetClick(e) { + this.open(); + } - /** + /** * Handle Origin Click * @param {Event} e */ - }, { - key: '_handleOriginClick', - value: function _handleOriginClick() { - this.close(); - }, + }, { + key: "_handleOriginClick", + value: function _handleOriginClick(e) { + this.close(); + } - /** + /** * Handle Resize * @param {Event} e */ - }, { - key: '_handleResize', - value: function _handleResize() { - this._calculatePositioning(); - }, + }, { + key: "_handleResize", + value: function _handleResize(e) { + this._calculatePositioning(); + } - /** + /** * Handle Resize * @param {Event} e */ - }, { - key: '_handleDocumentClick', - value: function _handleDocumentClick(e) { - if (!$(e.target).closest('.tap-target-wrapper').length) { - this.close(); - e.preventDefault(); - e.stopPropagation(); - } - }, + }, { + key: "_handleDocumentClick", + value: function _handleDocumentClick(e) { + if (!$(e.target).closest('.tap-target-wrapper').length) { + this.close(); + e.preventDefault(); + e.stopPropagation(); + } + } - /** + /** * Setup Tap Target */ - }, { - key: '_setup', - value: function _setup() { - // Creating tap target - this.wrapper = this.$el.parent()[0]; - this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; - this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; - this.contentEl = this.$el.find('.tap-target-content')[0]; - - // Creating wrapper - if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { - this.wrapper = document.createElement('div'); - this.wrapper.classList.add('tap-target-wrapper'); - this.$el.before($(this.wrapper)); - this.wrapper.append(this.el); - } - - // Creating content - if (!this.contentEl) { - this.contentEl = document.createElement('div'); - this.contentEl.classList.add('tap-target-content'); - this.$el.append(this.contentEl); - } - - // Creating foreground wave - if (!this.waveEl) { - this.waveEl = document.createElement('div'); - this.waveEl.classList.add('tap-target-wave'); - - // Creating origin - if (!this.originEl) { - this.originEl = this.$origin.clone(true, true); - this.originEl.addClass('tap-target-origin'); - this.originEl.removeAttr('id'); - this.originEl.removeAttr('style'); - this.originEl = this.originEl[0]; - this.waveEl.append(this.originEl); - } - - this.wrapper.append(this.waveEl); - } - }, - - /** + }, { + key: "_setup", + value: function _setup() { + // Creating tap target + this.wrapper = this.$el.parent()[0]; + this.waveEl = $(this.wrapper).find('.tap-target-wave')[0]; + this.originEl = $(this.wrapper).find('.tap-target-origin')[0]; + this.contentEl = this.$el.find('.tap-target-content')[0]; + + // Creating wrapper + if (!$(this.wrapper).hasClass('.tap-target-wrapper')) { + this.wrapper = document.createElement('div'); + this.wrapper.classList.add('tap-target-wrapper'); + this.$el.before($(this.wrapper)); + this.wrapper.append(this.el); + } + + // Creating content + if (!this.contentEl) { + this.contentEl = document.createElement('div'); + this.contentEl.classList.add('tap-target-content'); + this.$el.append(this.contentEl); + } + + // Creating foreground wave + if (!this.waveEl) { + this.waveEl = document.createElement('div'); + this.waveEl.classList.add('tap-target-wave'); + + // Creating origin + if (!this.originEl) { + this.originEl = this.$origin.clone(true, true); + this.originEl.addClass('tap-target-origin'); + this.originEl.removeAttr('id'); + this.originEl.removeAttr('style'); + this.originEl = this.originEl[0]; + this.waveEl.append(this.originEl); + } + + this.wrapper.append(this.waveEl); + } + } + + /** * Calculate positioning */ - }, { - key: '_calculatePositioning', - value: function _calculatePositioning() { - // Element or parent is fixed position? - let isFixed = this.$origin.css('position') === 'fixed'; - if (!isFixed) { - const parents = this.$origin.parents(); - for (let i = 0; i < parents.length; i++) { - isFixed = $(parents[i]).css('position') == 'fixed'; - if (isFixed) { - break; - } - } - } - - // Calculating origin - const originWidth = this.$origin.outerWidth(); - const originHeight = this.$origin.outerHeight(); - const originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; - const originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; - - // Calculating screen - const windowWidth = window.innerWidth; - const windowHeight = window.innerHeight; - const centerX = windowWidth / 2; - const centerY = windowHeight / 2; - const isLeft = originLeft <= centerX; - const isRight = originLeft > centerX; - const isTop = originTop <= centerY; - const isBottom = originTop > centerY; - const isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; - - // Calculating tap target - const tapTargetWidth = this.$el.outerWidth(); - const tapTargetHeight = this.$el.outerHeight(); - const tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; - const tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; - const tapTargetPosition = isFixed ? 'fixed' : 'absolute'; - - // Calculating content - const tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; - const tapTargetTextHeight = tapTargetHeight / 2; - const tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; - const tapTargetTextBottom = 0; - const tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; - const tapTargetTextRight = 0; - const tapTargetTextPadding = originWidth; - const tapTargetTextAlign = isBottom ? 'bottom' : 'top'; - - // Calculating wave - const tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; - const tapTargetWaveHeight = tapTargetWaveWidth; - const tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; - const tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; - - // Setting tap target - const tapTargetWrapperCssObj = {}; - tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; - tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; - tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; - tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; - tapTargetWrapperCssObj.position = tapTargetPosition; - $(this.wrapper).css(tapTargetWrapperCssObj); - - // Setting content - $(this.contentEl).css({ - width: tapTargetTextWidth + 'px', - height: tapTargetTextHeight + 'px', - top: tapTargetTextTop + 'px', - right: tapTargetTextRight + 'px', - bottom: tapTargetTextBottom + 'px', - left: tapTargetTextLeft + 'px', - padding: tapTargetTextPadding + 'px', - verticalAlign: tapTargetTextAlign, - }); - - // Setting wave - $(this.waveEl).css({ - top: tapTargetWaveTop + 'px', - left: tapTargetWaveLeft + 'px', - width: tapTargetWaveWidth + 'px', - height: tapTargetWaveHeight + 'px', - }); - }, - - /** + }, { + key: "_calculatePositioning", + value: function _calculatePositioning() { + // Element or parent is fixed position? + var isFixed = this.$origin.css('position') === 'fixed'; + if (!isFixed) { + var parents = this.$origin.parents(); + for (var i = 0; i < parents.length; i++) { + isFixed = $(parents[i]).css('position') == 'fixed'; + if (isFixed) { + break; + } + } + } + + // Calculating origin + var originWidth = this.$origin.outerWidth(); + var originHeight = this.$origin.outerHeight(); + var originTop = isFixed ? this.$origin.offset().top - M.getDocumentScrollTop() : this.$origin.offset().top; + var originLeft = isFixed ? this.$origin.offset().left - M.getDocumentScrollLeft() : this.$origin.offset().left; + + // Calculating screen + var windowWidth = window.innerWidth; + var windowHeight = window.innerHeight; + var centerX = windowWidth / 2; + var centerY = windowHeight / 2; + var isLeft = originLeft <= centerX; + var isRight = originLeft > centerX; + var isTop = originTop <= centerY; + var isBottom = originTop > centerY; + var isCenterX = originLeft >= windowWidth * 0.25 && originLeft <= windowWidth * 0.75; + + // Calculating tap target + var tapTargetWidth = this.$el.outerWidth(); + var tapTargetHeight = this.$el.outerHeight(); + var tapTargetTop = originTop + originHeight / 2 - tapTargetHeight / 2; + var tapTargetLeft = originLeft + originWidth / 2 - tapTargetWidth / 2; + var tapTargetPosition = isFixed ? 'fixed' : 'absolute'; + + // Calculating content + var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth / 2 + originWidth; + var tapTargetTextHeight = tapTargetHeight / 2; + var tapTargetTextTop = isTop ? tapTargetHeight / 2 : 0; + var tapTargetTextBottom = 0; + var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth / 2 - originWidth : 0; + var tapTargetTextRight = 0; + var tapTargetTextPadding = originWidth; + var tapTargetTextAlign = isBottom ? 'bottom' : 'top'; + + // Calculating wave + var tapTargetWaveWidth = originWidth > originHeight ? originWidth * 2 : originWidth * 2; + var tapTargetWaveHeight = tapTargetWaveWidth; + var tapTargetWaveTop = tapTargetHeight / 2 - tapTargetWaveHeight / 2; + var tapTargetWaveLeft = tapTargetWidth / 2 - tapTargetWaveWidth / 2; + + // Setting tap target + var tapTargetWrapperCssObj = {}; + tapTargetWrapperCssObj.top = isTop ? tapTargetTop + 'px' : ''; + tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth + 'px' : ''; + tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight + 'px' : ''; + tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft + 'px' : ''; + tapTargetWrapperCssObj.position = tapTargetPosition; + $(this.wrapper).css(tapTargetWrapperCssObj); + + // Setting content + $(this.contentEl).css({ + width: tapTargetTextWidth + 'px', + height: tapTargetTextHeight + 'px', + top: tapTargetTextTop + 'px', + right: tapTargetTextRight + 'px', + bottom: tapTargetTextBottom + 'px', + left: tapTargetTextLeft + 'px', + padding: tapTargetTextPadding + 'px', + verticalAlign: tapTargetTextAlign + }); + + // Setting wave + $(this.waveEl).css({ + top: tapTargetWaveTop + 'px', + left: tapTargetWaveLeft + 'px', + width: tapTargetWaveWidth + 'px', + height: tapTargetWaveHeight + 'px' + }); + } + + /** * Open TapTarget */ - }, { - key: 'open', - value: function open() { - if (this.isOpen) { - return; - } + }, { + key: "open", + value: function open() { + if (this.isOpen) { + return; + } - // onOpen callback - if (typeof this.options.onOpen === 'function') { - this.options.onOpen.call(this, this.$origin[0]); - } + // onOpen callback + if (typeof this.options.onOpen === 'function') { + this.options.onOpen.call(this, this.$origin[0]); + } - this.isOpen = true; - this.wrapper.classList.add('open'); + this.isOpen = true; + this.wrapper.classList.add('open'); - document.body.addEventListener('click', this._handleDocumentClickBound, true); - document.body.addEventListener('touchend', this._handleDocumentClickBound); - }, + document.body.addEventListener('click', this._handleDocumentClickBound, true); + document.body.addEventListener('touchend', this._handleDocumentClickBound); + } - /** + /** * Close Tap Target */ - }, { - key: 'close', - value: function close() { - if (!this.isOpen) { - return; - } + }, { + key: "close", + value: function close() { + if (!this.isOpen) { + return; + } - // onClose callback - if (typeof this.options.onClose === 'function') { - this.options.onClose.call(this, this.$origin[0]); - } + // onClose callback + if (typeof this.options.onClose === 'function') { + this.options.onClose.call(this, this.$origin[0]); + } - this.isOpen = false; - this.wrapper.classList.remove('open'); + this.isOpen = false; + this.wrapper.classList.remove('open'); - document.body.removeEventListener('click', this._handleDocumentClickBound, true); - document.body.removeEventListener('touchend', this._handleDocumentClickBound); - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), 'init', this).call(this, this, els, options); - }, + document.body.removeEventListener('click', this._handleDocumentClickBound, true); + document.body.removeEventListener('touchend', this._handleDocumentClickBound); + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options); + } - /** + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_TapTarget; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_TapTarget; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return TapTarget; - }(Component); + return TapTarget; + }(Component); - M.TapTarget = TapTarget; + M.TapTarget = TapTarget; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget'); + } })(cash); -; (function($) { - 'use strict'; +; (function ($) { + 'use strict'; - const _defaults = { - classes: '', - dropdownOptions: {}, - }; + var _defaults = { + classes: '', + dropdownOptions: {} + }; - /** + /** * @class * */ - const FormSelect = function(_Component20) { - _inherits(FormSelect, _Component20); + var FormSelect = function (_Component20) { + _inherits(FormSelect, _Component20); - /** + /** * Construct FormSelect instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function FormSelect(el, options) { - _classCallCheck(this, FormSelect); + function FormSelect(el, options) { + _classCallCheck(this, FormSelect); - // Don't init if browser default version - const _this67 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); + // Don't init if browser default version + var _this67 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options)); - if (_this67.$el.hasClass('browser-default')) { - return _possibleConstructorReturn(_this67); - } + if (_this67.$el.hasClass('browser-default')) { + return _possibleConstructorReturn(_this67); + } - _this67.el.M_FormSelect = _this67; + _this67.el.M_FormSelect = _this67; - /** + /** * Options for the select * @member FormSelect#options */ - _this67.options = $.extend({}, FormSelect.defaults, options); + _this67.options = $.extend({}, FormSelect.defaults, options); - _this67.isMultiple = _this67.$el.prop('multiple'); + _this67.isMultiple = _this67.$el.prop('multiple'); - // Setup - _this67.el.tabIndex = -1; - _this67._keysSelected = {}; - _this67._valueDict = {}; - _this67._setupDropdown(); + // Setup + _this67.el.tabIndex = -1; + _this67._keysSelected = {}; + _this67._valueDict = {}; // Maps key to original and generated option element. + _this67._setupDropdown(); - _this67._setupEventHandlers(); - return _this67; - } + _this67._setupEventHandlers(); + return _this67; + } - _createClass(FormSelect, [{ - key: 'destroy', + _createClass(FormSelect, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this._removeDropdown(); - this.el.M_FormSelect = undefined; - }, + value: function destroy() { + this._removeEventHandlers(); + this._removeDropdown(); + this.el.M_FormSelect = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - const _this68 = this; + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + var _this68 = this; - this._handleSelectChangeBound = this._handleSelectChange.bind(this); - this._handleOptionClickBound = this._handleOptionClick.bind(this); - this._handleInputClickBound = this._handleInputClick.bind(this); + this._handleSelectChangeBound = this._handleSelectChange.bind(this); + this._handleOptionClickBound = this._handleOptionClick.bind(this); + this._handleInputClickBound = this._handleInputClick.bind(this); - $(this.dropdownOptions).find('li:not(.optgroup)').each(function(el) { - el.addEventListener('click', _this68._handleOptionClickBound); - }); - this.el.addEventListener('change', this._handleSelectChangeBound); - this.input.addEventListener('click', this._handleInputClickBound); - }, + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.addEventListener('click', _this68._handleOptionClickBound); + }); + this.el.addEventListener('change', this._handleSelectChangeBound); + this.input.addEventListener('click', this._handleInputClickBound); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - const _this69 = this; + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + var _this69 = this; - $(this.dropdownOptions).find('li:not(.optgroup)').each(function(el) { - el.removeEventListener('click', _this69._handleOptionClickBound); - }); - this.el.removeEventListener('change', this._handleSelectChangeBound); - this.input.removeEventListener('click', this._handleInputClickBound); - }, + $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) { + el.removeEventListener('click', _this69._handleOptionClickBound); + }); + this.el.removeEventListener('change', this._handleSelectChangeBound); + this.input.removeEventListener('click', this._handleInputClickBound); + } - /** + /** * Handle Select Change * @param {Event} e */ - }, { - key: '_handleSelectChange', - value: function _handleSelectChange() { - this._setValueToInput(); - }, + }, { + key: "_handleSelectChange", + value: function _handleSelectChange(e) { + this._setValueToInput(); + } - /** + /** * Handle Option Click * @param {Event} e */ - }, { - key: '_handleOptionClick', - value: function _handleOptionClick(e) { - e.preventDefault(); - const option = $(e.target).closest('li')[0]; - const key = option.id; - if (!$(option).hasClass('disabled') && !$(option).hasClass('optgroup') && key.length) { - let selected = true; - - if (this.isMultiple) { - // Deselect placeholder option if still selected. - const placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); - if (placeholderOption.length) { - placeholderOption.removeClass('selected'); - placeholderOption.find('input[type="checkbox"]').prop('checked', false); - this._toggleEntryFromArray(placeholderOption[0].id); - } - - const checkbox = $(option).find('input[type="checkbox"]'); - checkbox.prop('checked', !checkbox.prop('checked')); - selected = this._toggleEntryFromArray(key); - } - else { - $(this.dropdownOptions).find('li').removeClass('active'); - $(option).toggleClass('active'); - this.input.value = option.textContent; - } - - this._activateOption($(this.dropdownOptions), option); - $(this._valueDict[key].el).prop('selected', selected); - this.$el.trigger('change'); - } - - e.stopPropagation(); - }, - - /** + }, { + key: "_handleOptionClick", + value: function _handleOptionClick(e) { + e.preventDefault(); + var option = $(e.target).closest('li')[0]; + var key = option.id; + if (!$(option).hasClass('disabled') && !$(option).hasClass('optgroup') && key.length) { + var selected = true; + + if (this.isMultiple) { + // Deselect placeholder option if still selected. + var placeholderOption = $(this.dropdownOptions).find('li.disabled.selected'); + if (placeholderOption.length) { + placeholderOption.removeClass('selected'); + placeholderOption.find('input[type="checkbox"]').prop('checked', false); + this._toggleEntryFromArray(placeholderOption[0].id); + } + + var checkbox = $(option).find('input[type="checkbox"]'); + checkbox.prop('checked', !checkbox.prop('checked')); + selected = this._toggleEntryFromArray(key); + } else { + $(this.dropdownOptions).find('li').removeClass('active'); + $(option).toggleClass('active'); + this.input.value = option.textContent; + } + + this._activateOption($(this.dropdownOptions), option); + $(this._valueDict[key].el).prop('selected', selected); + this.$el.trigger('change'); + } + + e.stopPropagation(); + } + + /** * Handle Input Click */ - }, { - key: '_handleInputClick', - value: function _handleInputClick() { - if (this.dropdown && this.dropdown.isOpen) { - this._setValueToInput(); - this._setSelectedStates(); - } - }, + }, { + key: "_handleInputClick", + value: function _handleInputClick() { + if (this.dropdown && this.dropdown.isOpen) { + this._setValueToInput(); + this._setSelectedStates(); + } + } - /** + /** * Setup dropdown */ - }, { - key: '_setupDropdown', - value: function _setupDropdown() { - const _this70 = this; - - this.wrapper = document.createElement('div'); - $(this.wrapper).addClass('select-wrapper' + ' ' + this.options.classes); - this.$el.before($(this.wrapper)); - this.wrapper.appendChild(this.el); - - if (this.el.disabled) { - this.wrapper.classList.add('disabled'); - } - - // Create dropdown - this.$selectOptions = this.$el.children('option, optgroup'); - this.dropdownOptions = document.createElement('ul'); - this.dropdownOptions.id = 'select-options-' + M.guid(); - $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); - - // Create dropdown structure. - if (this.$selectOptions.length) { - this.$selectOptions.each(function(el) { - if ($(el).is('option')) { - // Direct descendant option. - let optionEl = void 0; - if (_this70.isMultiple) { - optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'multiple'); - } - else { - optionEl = _this70._appendOptionWithIcon(_this70.$el, el); - } - - _this70._addOptionToValueDict(el, optionEl); - } - else if ($(el).is('optgroup')) { - // Optgroup. - const selectOptions = $(el).children('option'); - $(_this70.dropdownOptions).append($('
    • ' + el.getAttribute('label') + '
    • ')[0]); - - // eslint-disable-next-line no-shadow - selectOptions.each(function(el) { - const optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'optgroup-option'); - _this70._addOptionToValueDict(el, optionEl); - }); - } - }); - } - - this.$el.after(this.dropdownOptions); - - // Add input dropdown - this.input = document.createElement('input'); - $(this.input).addClass('select-dropdown dropdown-trigger'); - this.input.setAttribute('type', 'text'); - this.input.setAttribute('readonly', 'true'); - this.input.setAttribute('data-target', this.dropdownOptions.id); - if (this.el.disabled) { - $(this.input).prop('disabled', 'true'); - } - - this.$el.before(this.input); - this._setValueToInput(); - - // Add caret - const dropdownIcon = $(''); - this.$el.before(dropdownIcon[0]); - - // Initialize dropdown - if (!this.el.disabled) { - const dropdownOptions = $.extend({}, this.options.dropdownOptions); - - // Add callback for centering selected option when dropdown content is scrollable - dropdownOptions.onOpenEnd = function() { - const selectedOption = $(_this70.dropdownOptions).find('.selected').first(); - if (_this70.dropdown.isScrollable && selectedOption.length) { - let scrollOffset = selectedOption[0].getBoundingClientRect().top - _this70.dropdownOptions.getBoundingClientRect().top; - scrollOffset -= _this70.dropdownOptions.clientHeight / 2; - _this70.dropdownOptions.scrollTop = scrollOffset; - } - }; - - if (this.isMultiple) { - dropdownOptions.closeOnClick = false; - } - this.dropdown = M.Dropdown.init(this.input, dropdownOptions); - } - - // Add initial selections - this._setSelectedStates(); - }, - - /** + }, { + key: "_setupDropdown", + value: function _setupDropdown() { + var _this70 = this; + + this.wrapper = document.createElement('div'); + $(this.wrapper).addClass('select-wrapper' + ' ' + this.options.classes); + this.$el.before($(this.wrapper)); + this.wrapper.appendChild(this.el); + + if (this.el.disabled) { + this.wrapper.classList.add('disabled'); + } + + // Create dropdown + this.$selectOptions = this.$el.children('option, optgroup'); + this.dropdownOptions = document.createElement('ul'); + this.dropdownOptions.id = "select-options-" + M.guid(); + $(this.dropdownOptions).addClass('dropdown-content select-dropdown ' + (this.isMultiple ? 'multiple-select-dropdown' : '')); + + // Create dropdown structure. + if (this.$selectOptions.length) { + this.$selectOptions.each(function (el) { + if ($(el).is('option')) { + // Direct descendant option. + var optionEl = void 0; + if (_this70.isMultiple) { + optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'multiple'); + } else { + optionEl = _this70._appendOptionWithIcon(_this70.$el, el); + } + + _this70._addOptionToValueDict(el, optionEl); + } else if ($(el).is('optgroup')) { + // Optgroup. + var selectOptions = $(el).children('option'); + $(_this70.dropdownOptions).append($('
    • ' + el.getAttribute('label') + '
    • ')[0]); + + selectOptions.each(function (el) { + var optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'optgroup-option'); + _this70._addOptionToValueDict(el, optionEl); + }); + } + }); + } + + this.$el.after(this.dropdownOptions); + + // Add input dropdown + this.input = document.createElement('input'); + $(this.input).addClass('select-dropdown dropdown-trigger'); + this.input.setAttribute('type', 'text'); + this.input.setAttribute('readonly', 'true'); + this.input.setAttribute('data-target', this.dropdownOptions.id); + if (this.el.disabled) { + $(this.input).prop('disabled', 'true'); + } + + this.$el.before(this.input); + this._setValueToInput(); + + // Add caret + var dropdownIcon = $(''); + this.$el.before(dropdownIcon[0]); + + // Initialize dropdown + if (!this.el.disabled) { + var dropdownOptions = $.extend({}, this.options.dropdownOptions); + + // Add callback for centering selected option when dropdown content is scrollable + dropdownOptions.onOpenEnd = function (el) { + var selectedOption = $(_this70.dropdownOptions).find('.selected').first(); + if (_this70.dropdown.isScrollable && selectedOption.length) { + var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this70.dropdownOptions.getBoundingClientRect().top; // scroll to selected option + scrollOffset -= _this70.dropdownOptions.clientHeight / 2; // center in dropdown + _this70.dropdownOptions.scrollTop = scrollOffset; + } + }; + + if (this.isMultiple) { + dropdownOptions.closeOnClick = false; + } + this.dropdown = M.Dropdown.init(this.input, dropdownOptions); + } + + // Add initial selections + this._setSelectedStates(); + } + + /** * Add option to value dict * @param {Element} el original option element * @param {Element} optionEl generated option element */ - }, { - key: '_addOptionToValueDict', - value: function _addOptionToValueDict(el, optionEl) { - const index = Object.keys(this._valueDict).length; - const key = this.dropdownOptions.id + index; - const obj = {}; - optionEl.id = key; + }, { + key: "_addOptionToValueDict", + value: function _addOptionToValueDict(el, optionEl) { + var index = Object.keys(this._valueDict).length; + var key = this.dropdownOptions.id + index; + var obj = {}; + optionEl.id = key; - obj.el = el; - obj.optionEl = optionEl; - this._valueDict[key] = obj; - }, + obj.el = el; + obj.optionEl = optionEl; + this._valueDict[key] = obj; + } - /** + /** * Remove dropdown */ - }, { - key: '_removeDropdown', - value: function _removeDropdown() { - $(this.wrapper).find('.caret').remove(); - $(this.input).remove(); - $(this.dropdownOptions).remove(); - $(this.wrapper).before(this.$el); - $(this.wrapper).remove(); - }, + }, { + key: "_removeDropdown", + value: function _removeDropdown() { + $(this.wrapper).find('.caret').remove(); + $(this.input).remove(); + $(this.dropdownOptions).remove(); + $(this.wrapper).before(this.$el); + $(this.wrapper).remove(); + } - /** + /** * Setup dropdown * @param {Element} select select element * @param {Element} option option element from select @@ -12149,486 +11816,484 @@ $jscomp.polyfill = function(e, r, p, m) { * @return {Element} option element added */ - }, { - key: '_appendOptionWithIcon', - value: function _appendOptionWithIcon(select, option, type) { - // Add disabled attr if disabled - const disabledClass = option.disabled ? 'disabled ' : ''; - const optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; - const multipleCheckbox = this.isMultiple ? '' : option.innerHTML; - const liEl = $('
    • '); - const spanEl = $(''); - spanEl.html(multipleCheckbox); - liEl.addClass(disabledClass + ' ' + optgroupClass); - liEl.append(spanEl); - - // add icons - const iconUrl = option.getAttribute('data-icon'); - if (iconUrl) { - const imgEl = $(''); - liEl.prepend(imgEl); - } - - // Check for multiple type. - $(this.dropdownOptions).append(liEl[0]); - return liEl[0]; - }, - - /** + }, { + key: "_appendOptionWithIcon", + value: function _appendOptionWithIcon(select, option, type) { + // Add disabled attr if disabled + var disabledClass = option.disabled ? 'disabled ' : ''; + var optgroupClass = type === 'optgroup-option' ? 'optgroup-option ' : ''; + var multipleCheckbox = this.isMultiple ? "" : option.innerHTML; + var liEl = $('
    • '); + var spanEl = $(''); + spanEl.html(multipleCheckbox); + liEl.addClass(disabledClass + " " + optgroupClass); + liEl.append(spanEl); + + // add icons + var iconUrl = option.getAttribute('data-icon'); + var classes = option.getAttribute('class'); + if (!!iconUrl) { + var imgEl = $(''); + liEl.prepend(imgEl); + } + + // Check for multiple type. + $(this.dropdownOptions).append(liEl[0]); + return liEl[0]; + } + + /** * Toggle entry from option * @param {String} key Option key * @return {Boolean} if entry was added or removed */ - }, { - key: '_toggleEntryFromArray', - value: function _toggleEntryFromArray(key) { - const notAdded = !Object.prototype.hasOwnProperty.call(this._keysSelected, key); - if (notAdded) { - this._keysSelected[key] = true; - } - else { - delete this._keysSelected[key]; - } + }, { + key: "_toggleEntryFromArray", + value: function _toggleEntryFromArray(key) { + var notAdded = !this._keysSelected.hasOwnProperty(key); + if (notAdded) { + this._keysSelected[key] = true; + } else { + delete this._keysSelected[key]; + } - $(this._valueDict[key].optionEl).toggleClass('active'); + $(this._valueDict[key].optionEl).toggleClass('active'); - // use notAdded instead of true (to detect if the option is selected or not) - $(this._valueDict[key].el).prop('selected', notAdded); + // use notAdded instead of true (to detect if the option is selected or not) + $(this._valueDict[key].el).prop('selected', notAdded); - return notAdded; - }, + return notAdded; + } - /** + /** * Set value to input */ - }, { - key: '_setValueToInput', - value: function _setValueToInput() { - let value = ''; - const options = this.$el.find('option'); + }, { + key: "_setValueToInput", + value: function _setValueToInput() { + var value = ''; + var options = this.$el.find('option'); - options.each(function(el) { - if ($(el).prop('selected')) { - const text = $(el).text(); - value === '' ? value += text : value += ', ' + text; - } - }); + options.each(function (el) { + if ($(el).prop('selected')) { + var text = $(el).text(); + value === '' ? value += text : value += ', ' + text; + } + }); - if (value === '') { - const firstDisabled = this.$el.find('option:disabled').eq(0); - if (firstDisabled.length) { - value = firstDisabled.text(); - } - } + if (value === '') { + var firstDisabled = this.$el.find('option:disabled').eq(0); + if (firstDisabled.length) { + value = firstDisabled.text(); + } + } - this.input.value = value; - }, + this.input.value = value; + } - /** + /** * Set selected state of dropdown too match actual select element */ - }, { - key: '_setSelectedStates', - value: function _setSelectedStates() { - this._keysSelected = {}; - - for (const key in this._valueDict) { - const option = this._valueDict[key]; - if ($(option.el).prop('selected')) { - $(option.optionEl).find('input[type="checkbox"]').prop('checked', true); - this._activateOption($(this.dropdownOptions), $(option.optionEl)); - this._keysSelected[key] = true; - } - else { - $(option.optionEl).find('input[type="checkbox"]').prop('checked', false); - $(option.optionEl).removeClass('selected'); - } - } - }, - - /** + }, { + key: "_setSelectedStates", + value: function _setSelectedStates() { + this._keysSelected = {}; + + for (var key in this._valueDict) { + var option = this._valueDict[key]; + if ($(option.el).prop('selected')) { + $(option.optionEl).find('input[type="checkbox"]').prop("checked", true); + this._activateOption($(this.dropdownOptions), $(option.optionEl)); + this._keysSelected[key] = true; + } else { + $(option.optionEl).find('input[type="checkbox"]').prop("checked", false); + $(option.optionEl).removeClass('selected'); + } + } + } + + /** * Make option as selected and scroll to selected position * @param {jQuery} collection Select options jQuery element * @param {Element} newOption element of the new option */ - }, { - key: '_activateOption', - value: function _activateOption(collection, newOption) { - if (newOption) { - if (!this.isMultiple) { - collection.find('li.selected').removeClass('selected'); - } + }, { + key: "_activateOption", + value: function _activateOption(collection, newOption) { + if (newOption) { + if (!this.isMultiple) { + collection.find('li.selected').removeClass('selected'); + } - const option = $(newOption); - option.addClass('selected'); - } - }, + var option = $(newOption); + option.addClass('selected'); + } + } - /** + /** * Get Selected Values * @return {Array} Array of selected values */ - }, { - key: 'getSelectedValues', - value: function getSelectedValues() { - const selectedValues = []; - for (const key in this._keysSelected) { - selectedValues.push(this._valueDict[key].el.value); - } - return selectedValues; - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), 'init', this).call(this, this, els, options); - }, - - /** + }, { + key: "getSelectedValues", + value: function getSelectedValues() { + var selectedValues = []; + for (var key in this._keysSelected) { + selectedValues.push(this._valueDict[key].el.value); + } + return selectedValues; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(FormSelect.__proto__ || Object.getPrototypeOf(FormSelect), "init", this).call(this, this, els, options); + } + + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_FormSelect; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_FormSelect; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return FormSelect; - }(Component); + return FormSelect; + }(Component); - M.FormSelect = FormSelect; + M.FormSelect = FormSelect; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(FormSelect, 'formSelect', 'M_FormSelect'); + } })(cash); -; (function($, anim) { - 'use strict'; +; (function ($, anim) { + 'use strict'; - const _defaults = {}; + var _defaults = {}; - /** + /** * @class * */ - const Range = function(_Component21) { - _inherits(Range, _Component21); + var Range = function (_Component21) { + _inherits(Range, _Component21); - /** + /** * Construct Range instance * @constructor * @param {Element} el * @param {Object} options */ - // eslint-disable-next-line no-shadow - function Range(el, options) { - _classCallCheck(this, Range); + function Range(el, options) { + _classCallCheck(this, Range); - const _this71 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); + var _this71 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options)); - _this71.el.M_Range = _this71; + _this71.el.M_Range = _this71; - /** + /** * Options for the range * @member Range#options */ - _this71.options = $.extend({}, Range.defaults, options); + _this71.options = $.extend({}, Range.defaults, options); - _this71._mousedown = false; + _this71._mousedown = false; - // Setup - _this71._setupThumb(); + // Setup + _this71._setupThumb(); - _this71._setupEventHandlers(); - return _this71; - } + _this71._setupEventHandlers(); + return _this71; + } - _createClass(Range, [{ - key: 'destroy', + _createClass(Range, [{ + key: "destroy", - /** + /** * Teardown component */ - value: function destroy() { - this._removeEventHandlers(); - this._removeThumb(); - this.el.M_Range = undefined; - }, + value: function destroy() { + this._removeEventHandlers(); + this._removeThumb(); + this.el.M_Range = undefined; + } - /** + /** * Setup Event Handlers */ - }, { - key: '_setupEventHandlers', - value: function _setupEventHandlers() { - this._handleRangeChangeBound = this._handleRangeChange.bind(this); - this._handleRangeFocusBound = this._handleRangeFocus.bind(this); - this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); - this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); - this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); - this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); + }, { + key: "_setupEventHandlers", + value: function _setupEventHandlers() { + this._handleRangeChangeBound = this._handleRangeChange.bind(this); + this._handleRangeFocusBound = this._handleRangeFocus.bind(this); + this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this); + this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this); + this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this); + this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this); - this.el.addEventListener('change', this._handleRangeChangeBound); - this.el.addEventListener('focus', this._handleRangeFocusBound); + this.el.addEventListener('change', this._handleRangeChangeBound); + this.el.addEventListener('focus', this._handleRangeFocusBound); - this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.addEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); + this.el.addEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.addEventListener('touchend', this._handleRangeMouseupTouchendBound); - this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - }, + this.el.addEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.addEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } - /** + /** * Remove Event Handlers */ - }, { - key: '_removeEventHandlers', - value: function _removeEventHandlers() { - this.el.removeEventListener('change', this._handleRangeChangeBound); - this.el.removeEventListener('focus', this._handleRangeFocusBound); + }, { + key: "_removeEventHandlers", + value: function _removeEventHandlers() { + this.el.removeEventListener('change', this._handleRangeChangeBound); + this.el.removeEventListener('focus', this._handleRangeFocusBound); - this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); - this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); + this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound); + this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound); - this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('input', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('mousemove', this._handleRangeInputMousemoveTouchmoveBound); + this.el.removeEventListener('touchmove', this._handleRangeInputMousemoveTouchmoveBound); - this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); - this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); + this.el.removeEventListener('mouseup', this._handleRangeMouseupTouchendBound); + this.el.removeEventListener('touchend', this._handleRangeMouseupTouchendBound); - this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); - this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); - }, + this.el.removeEventListener('blur', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('mouseout', this._handleRangeBlurMouseoutTouchleaveBound); + this.el.removeEventListener('touchleave', this._handleRangeBlurMouseoutTouchleaveBound); + } - /** + /** * Handle Range Change * @param {Event} e */ - }, { - key: '_handleRangeChange', - value: function _handleRangeChange() { - $(this.value).html(this.$el.val()); + }, { + key: "_handleRangeChange", + value: function _handleRangeChange() { + $(this.value).html(this.$el.val()); - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } - const offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - }, + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } - /** + /** * Handle Range Focus * @param {Event} e */ - }, { - key: '_handleRangeFocus', - value: function _handleRangeFocus() { - if (M.tabPressed) { - this.$el.addClass('focused'); - } - }, + }, { + key: "_handleRangeFocus", + value: function _handleRangeFocus() { + if (M.tabPressed) { + this.$el.addClass('focused'); + } + } - /** + /** * Handle Range Mousedown and Touchstart * @param {Event} e */ - }, { - key: '_handleRangeMousedownTouchstart', - value: function _handleRangeMousedownTouchstart(e) { - // Set indicator value - $(this.value).html(this.$el.val()); + }, { + key: "_handleRangeMousedownTouchstart", + value: function _handleRangeMousedownTouchstart(e) { + // Set indicator value + $(this.value).html(this.$el.val()); - this._mousedown = true; - this.$el.addClass('active'); + this._mousedown = true; + this.$el.addClass('active'); - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } - if (e.type !== 'input') { - const offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - } - }, + if (e.type !== 'input') { + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + } + } - /** + /** * Handle Range Input, Mousemove and Touchmove */ - }, { - key: '_handleRangeInputMousemoveTouchmove', - value: function _handleRangeInputMousemoveTouchmove() { - if (this._mousedown) { - if (!$(this.thumb).hasClass('active')) { - this._showRangeBubble(); - } + }, { + key: "_handleRangeInputMousemoveTouchmove", + value: function _handleRangeInputMousemoveTouchmove() { + if (this._mousedown) { + if (!$(this.thumb).hasClass('active')) { + this._showRangeBubble(); + } - const offsetLeft = this._calcRangeOffset(); - $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); - $(this.value).html(this.$el.val()); - } - }, + var offsetLeft = this._calcRangeOffset(); + $(this.thumb).addClass('active').css('left', offsetLeft + 'px'); + $(this.value).html(this.$el.val()); + } + } - /** + /** * Handle Range Mouseup and Touchend */ - }, { - key: '_handleRangeMouseupTouchend', - value: function _handleRangeMouseupTouchend() { - this._mousedown = false; - this.$el.removeClass('active'); - }, + }, { + key: "_handleRangeMouseupTouchend", + value: function _handleRangeMouseupTouchend() { + this._mousedown = false; + this.$el.removeClass('active'); + } - /** + /** * Handle Range Blur, Mouseout and Touchleave */ - }, { - key: '_handleRangeBlurMouseoutTouchleave', - value: function _handleRangeBlurMouseoutTouchleave() { - if (!this._mousedown) { - this.$el.removeClass('focused'); - const paddingLeft = parseInt(this.$el.css('padding-left')); - const marginLeft = 7 + paddingLeft + 'px'; - - if ($(this.thumb).hasClass('active')) { - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 0, - width: 0, - top: 10, - easing: 'easeOutQuad', - marginLeft: marginLeft, - duration: 100, - }); - } - $(this.thumb).removeClass('active'); - } - }, - - /** + }, { + key: "_handleRangeBlurMouseoutTouchleave", + value: function _handleRangeBlurMouseoutTouchleave() { + if (!this._mousedown) { + this.$el.removeClass('focused'); + var paddingLeft = parseInt(this.$el.css('padding-left')); + var marginLeft = 7 + paddingLeft + 'px'; + + if ($(this.thumb).hasClass('active')) { + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 0, + width: 0, + top: 10, + easing: 'easeOutQuad', + marginLeft: marginLeft, + duration: 100 + }); + } + $(this.thumb).removeClass('active'); + } + } + + /** * Setup dropdown */ - }, { - key: '_setupThumb', - value: function _setupThumb() { - this.thumb = document.createElement('span'); - this.value = document.createElement('span'); - $(this.thumb).addClass('thumb'); - $(this.value).addClass('value'); - $(this.thumb).append(this.value); - this.$el.after(this.thumb); - }, + }, { + key: "_setupThumb", + value: function _setupThumb() { + this.thumb = document.createElement('span'); + this.value = document.createElement('span'); + $(this.thumb).addClass('thumb'); + $(this.value).addClass('value'); + $(this.thumb).append(this.value); + this.$el.after(this.thumb); + } - /** + /** * Remove dropdown */ - }, { - key: '_removeThumb', - value: function _removeThumb() { - $(this.thumb).remove(); - }, + }, { + key: "_removeThumb", + value: function _removeThumb() { + $(this.thumb).remove(); + } - /** + /** * morph thumb into bubble */ - }, { - key: '_showRangeBubble', - value: function _showRangeBubble() { - const paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); - const marginLeft = -7 + paddingLeft + 'px'; - anim.remove(this.thumb); - anim({ - targets: this.thumb, - height: 30, - width: 30, - top: -30, - marginLeft: marginLeft, - duration: 300, - easing: 'easeOutQuint', - }); - }, - - /** + }, { + key: "_showRangeBubble", + value: function _showRangeBubble() { + var paddingLeft = parseInt($(this.thumb).parent().css('padding-left')); + var marginLeft = -7 + paddingLeft + 'px'; // TODO: fix magic number? + anim.remove(this.thumb); + anim({ + targets: this.thumb, + height: 30, + width: 30, + top: -30, + marginLeft: marginLeft, + duration: 300, + easing: 'easeOutQuint' + }); + } + + /** * Calculate the offset of the thumb * @return {Number} offset in pixels */ - }, { - key: '_calcRangeOffset', - value: function _calcRangeOffset() { - const width = this.$el.width() - 15; - const max = parseFloat(this.$el.attr('max')); - const min = parseFloat(this.$el.attr('min')); - const percent = (parseFloat(this.$el.val()) - min) / (max - min); - return percent * width; - }, - }], [{ - key: 'init', - value: function init(els, options) { - return _get(Range.__proto__ || Object.getPrototypeOf(Range), 'init', this).call(this, this, els, options); - }, - - /** + }, { + key: "_calcRangeOffset", + value: function _calcRangeOffset() { + var width = this.$el.width() - 15; + var max = parseFloat(this.$el.attr('max')); + var min = parseFloat(this.$el.attr('min')); + var percent = (parseFloat(this.$el.val()) - min) / (max - min); + return percent * width; + } + }], [{ + key: "init", + value: function init(els, options) { + return _get(Range.__proto__ || Object.getPrototypeOf(Range), "init", this).call(this, this, els, options); + } + + /** * Get Instance */ - }, { - key: 'getInstance', - value: function getInstance(el) { - const domElem = el.jquery ? el[0] : el; - return domElem.M_Range; - }, - }, { - key: 'defaults', - get: function() { - return _defaults; - }, - }]); + }, { + key: "getInstance", + value: function getInstance(el) { + var domElem = !!el.jquery ? el[0] : el; + return domElem.M_Range; + } + }, { + key: "defaults", + get: function () { + return _defaults; + } + }]); - return Range; - }(Component); + return Range; + }(Component); - M.Range = Range; + M.Range = Range; - if (M.jQueryLoaded) { - M.initializeJqueryWrapper(Range, 'range', 'M_Range'); - } + if (M.jQueryLoaded) { + M.initializeJqueryWrapper(Range, 'range', 'M_Range'); + } - Range.init($('input[type=range]')); + Range.init($('input[type=range]')); })(cash, M.anime); \ No newline at end of file diff --git a/server-data/resources/[maps]/WarehousePort/fxmanifest.lua b/server-data/resources/[maps]/WarehousePort/fxmanifest.lua deleted file mode 100644 index efb59d7a8..000000000 --- a/server-data/resources/[maps]/WarehousePort/fxmanifest.lua +++ /dev/null @@ -1,4 +0,0 @@ -fx_version "adamant" -game 'gta5' -this_is_a_map "yes" -version '0.0.5' \ No newline at end of file diff --git a/server-data/resources/[maps]/WarehousePort/stream/_manifest.ymf b/server-data/resources/[maps]/WarehousePort/stream/_manifest.ymf deleted file mode 100644 index cf62fb95e..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/_manifest.ymf and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ymap b/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ymap deleted file mode 100644 index 4cfbe4590..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ymap and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ytyp b/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ytyp deleted file mode 100644 index a99fcd26b..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port.ytyp and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_col.ybn b/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_col.ybn deleted file mode 100644 index db7e8004d..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_col.ybn and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_shell.ydr b/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_shell.ydr deleted file mode 100644 index f39ad4258..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/a_int_warehouse_port_shell.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ydr b/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ydr deleted file mode 100644 index 250170adb..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ytyp b/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ytyp deleted file mode 100644 index 268054317..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/decals_warehouse_port.ytyp and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/hei_po1_01_0.ybn b/server-data/resources/[maps]/WarehousePort/stream/hei_po1_01_0.ybn deleted file mode 100644 index 02210b58b..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/hei_po1_01_0.ybn and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/hei_po1_occl_00.ymap b/server-data/resources/[maps]/WarehousePort/stream/hei_po1_occl_00.ymap deleted file mode 100644 index ea86d58ef..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/hei_po1_occl_00.ymap and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/hi@hei_po1_01_5.ybn b/server-data/resources/[maps]/WarehousePort/stream/hi@hei_po1_01_5.ybn deleted file mode 100644 index 44aa0a2ed..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/hi@hei_po1_01_5.ybn and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/po1_01_b.ydr b/server-data/resources/[maps]/WarehousePort/stream/po1_01_b.ydr deleted file mode 100644 index 0ca798843..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/po1_01_b.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/po1_01_build59_ov2.ydr b/server-data/resources/[maps]/WarehousePort/stream/po1_01_build59_ov2.ydr deleted file mode 100644 index 4caf04c7d..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/po1_01_build59_ov2.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/po1_01_glue_03.ydr b/server-data/resources/[maps]/WarehousePort/stream/po1_01_glue_03.ydr deleted file mode 100644 index a5e091dff..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/po1_01_glue_03.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/po1_01_tug_det.ydr b/server-data/resources/[maps]/WarehousePort/stream/po1_01_tug_det.ydr deleted file mode 100644 index 02daccf09..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/po1_01_tug_det.ydr and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/prop_warehouse_light.ytyp b/server-data/resources/[maps]/WarehousePort/stream/prop_warehouse_light.ytyp deleted file mode 100644 index f78be9beb..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/prop_warehouse_light.ytyp and /dev/null differ diff --git a/server-data/resources/[maps]/WarehousePort/stream/prop_warehouseport_light.ydr b/server-data/resources/[maps]/WarehousePort/stream/prop_warehouseport_light.ydr deleted file mode 100644 index 872bd3234..000000000 Binary files a/server-data/resources/[maps]/WarehousePort/stream/prop_warehouseport_light.ydr and /dev/null differ