From b408272150f14fdc0ffea4c20ab673700261071a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 19 May 2015 19:11:49 +0100 Subject: [PATCH] Correct Line Feeds --- LICENSE.txt | 1348 ++++++++++++++--------------- assets/content.js | 1450 ++++++++++++++++---------------- assets/editor.js | 452 +++++----- assets/effects.js | 492 +++++------ assets/engine.js | 333 ++++---- assets/game.js | 324 +++---- assets/libraries/jQuery.min.js | 4 +- assets/map.js | 838 +++++++++--------- assets/player.js | 670 +++++++-------- assets/style.css | 319 +++---- editor.html | 122 +-- index.html | 76 +- 12 files changed, 3217 insertions(+), 3211 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 818433e..94a9ed0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,674 +1,674 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/assets/content.js b/assets/content.js index 0dfdaa3..055d3da 100644 --- a/assets/content.js +++ b/assets/content.js @@ -1,722 +1,728 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -// Define the sprite maps -define.sprite("default","assets/sprites/tiles.png"); -define.sprite("editor","assets/sprites/editor.png"); - -// Can take damage -Crafty.c("crushable",{ - crush: function(){ - if (this.tile_data.crush_sound) - Crafty.audio.play(this.tile_data.crush_sound); - - if (this.tile_data.destructColor) - ParticleExplosion({x:this.x, y:this.y}, 300, this.tile_data.destructColor, 0, 750); - - if (this.body) - Crafty.box2D.world.DestroyBody(this.body); - - if ((this.tile_data.respawn || this.tile_meta.respawn) && this.tile_meta.respawn != false) - Crafty.e("Tile").tile(this.tile_data.name, this.tile_p.x, this.tile_p.y, map.map_data.width, map.map_data.height); - - this.destroy(); - } -}); - -// Can pull object with use button -Crafty.c("pull", { - using: false, - can_detach: false, - use: function() { - if (this.using) { - return; - } - this.can_detach = false; - setTimeout(function() { this.can_detach = true; }, 5); - console.log("Use"); - Crafty.bind("using", function(to) { this_item.end_use(this_item, to) }); - this.using = true; - game.player.lock_turn = game.player.lock_turn + 1; - - // Delta - var deltax = this.x - game.player.x; - var deltay = this.y - game.player.y; - this.delta = {x: deltax, y: deltay}; - - // Destroy tile's body - Crafty.box2D.world.DestroyBody(this.body); - this.body = null; - - // Add as fixture - this.fixture = game.player.addFixture({ - density: 0.1, - shape: [ [deltax+10,deltay+10], [deltax+72,deltay+10], [deltax+72,deltay+72], [deltax+10,deltay+72] ] - }); - game.player.attach(this); - this.bind("EnterFrame", this.move_to_fix); - this.bind("KeyDown", this.keydown); - var this_item = this; - Crafty.bind("PlayerDeath", function(to) { this_item.end_use(this_item, to) }); - - }, - move_to_fix: function() { - this.can_detach = true; - this.trigger("move", {x: this.x, y: this.y}); - }, - keydown: function(e) { - if (e.key == Crafty.keys.E && this.can_detach) { - this.end_use(this, null); - } - }, - end_use: function(this_item, to) { - if (this_item.using && (to == null || this_item != to)) { - Crafty.unbind("using", this_item.end_use); - this_item.unbind("EnterFrame", this_item.move_to_fix); - this_item.unbind("KeyDown", this_item.keydown); - Crafty.unbind("PlayerDeath", this_item.end_use); - game.player.detach(this_item); - Crafty.box2D.world.DestroyBody(game.player.body); - game.player.physics(); - this_item.using = false; - game.player.lock_turn = game.player.lock_turn - 1; - this_item.init_physics(); - } - } -}); - -Crafty.c("DeathHazzard",{ - init: function(){ - this.bind("EnterFrame",this._enterframe); - }, - _enterframe: function(){ - if (!game.player) - return; - - if (this.contact("Player")){ - game.player.hit(20); - } - - if (this.tile_data.crushes){ - var obj = this.contact("crushable"); - - for (var i=0;i this.hit_tick+1000){ - this.hit_tick = now; - if (this.contact("Player")){ - game.player.hit(1); - } - } - }); - return false; - }, - init_req: true, - ascii: '$' -}); - -/********************************* - * LEVELS * - *********************************/ - -// Level: Tutorial, get cake -define.map({ - title: "Tutorial: Get Cake", - spawn:{ - x: 1, - y: 2 - }, - width: 4, - height: 4, - help: [ - { - msg: "Welcome traveller!

Collect the cakes to proceed to the next level.", - at: {x: -3, y: 1, w: 120}, - behind: true - } - ], - cakes:1, - map: [ - ["blank","blank","blank","blank"], - ["blank","cake","","blank"], - ["blank","","sign_jump","blank"], - ["blank","blank","blank","blank"] - ] -}); - -// Level: Tutorial, water bounce -define.map({ - title: "Tutorial: Jumping", - spawn:{ - x: 1, - y: 2 - }, - width: 26, - height: 5, - help: [ - { - msg: "Don't fall into
the water!", - at: {x: -3, y: 1, w: 120}, - behind: true - } - ], - cakes: 1, - map: [ - ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "bounce", "bounce", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "bounce", "bounce", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], - ["blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "cake", "blank"], - ["blank", "blank", "blank", "bounce", "water", "water", "water", "water", "water", "water", "water", "water", "water", "blank", "blank", "bounce", "water", "water", "water", "water", "water", "water", "water", "water", "blank", "blank", "blank", "blank"], - ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] - ] -}); - -// Level: Tutorial, box and buttons -define.map({ - title: "Tutorial: Buttons", - spawn:{ - x: 5, - y: 2 - }, - width: 10, - height: 4, - help: [ - { - msg: "Press E to pull the box,
Press E again to let go.", - at: {x: -3, y: 1, w: 120}, - behind: true - } - ], - cakes: 1, - map: [ - ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], - ["blank", "", "", "", "", "", "", "tech", "", "blank"], - ["blank", "box", "", {node:"button",method:"downtoggle",action:[{x:7,y:1},{x:7,y:2}]}, "", "", "", "tech", "cake", "blank"], - ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] - ] -}); - -// Level: Box and Buttons 1 -define.map({ - title: "Box and Buttons", - spawn:{ - x: 5, - y: 5 - }, - width: 13, - height: 8, - cakes: 1, - map: [ - ["blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank"], - ["blank","blank", {node:"vbuttonl",method:"toggle",action:[{x:4,y:4},{x:4,y:5}]},"","","","","","","","","ladder","blank"], - ["blank","push","","","","","","","","","","ladder","blank"], - ["blank","blank","blank","blank","blank","blank","blank","blank","blank","","","ladder","blank"], - ["blank","","","tech","tech","","","","","","","ladder","blank"], - ["blank","cake","","tech","tech","","","",{node:"button",method:"downtoggle",action:[{x:3,y:4},{x:3,y:5}]},"","","ladder","blank"], - ["blank","blank","blank","blank","blank","blank","blank","spikes","blank","blank","blank","blank","blank"], - ["blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank"] - ] -}); - -// Level: Two doors -define.map({ - title: "Two Doors", - spawn:{ - x: 3, - y: 2 - }, - width: 29, - height: 12, - cakes: 1, - map: [ - ["", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], - ["", "", "blank", "", "", "", "", "", "", "", "tech", "", "", "", "", "blank"], - ["", "", "blank", "", "", "", "", "", "", "", "tech", "", "", "cake", "", "blank"], - ["blank", "blank", "blank", "blank", "blank", "blank", {node:"tech", visible:false}, {node:"tech", visible:false}, {node:"tech", visible:false}, "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], - ["blank", "ladder", "", "", "", "tech", "ladder", "", "", "", "", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "ladder", "", "", "", "tech", "ladder", "", "", "", "", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "ladder", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "ladder", "", "", "", "", "", "", "", "", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "ladder", "", "", "", "", "", "", "", "blank", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["blank", "ladder", "", "", "", "", {node:"button",method:"downtoggle",action:[{x: 10, y:1}, {x:10, y:2}]}, "", "", "box", "blank", "ladder", "", "", {node:"button",method:"downtoggle",action:[{x:5,y:4},{x:5,y:5}, {x:6, y:3}, {x:7, y:3}, {x:8, y:3}]}, "", "", "", "", "", "", "", "", "flag", "", "box", "", "box", "blank"], - ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "water", "water", "water", "blank", "water", "water", "water", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], - ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] - ] -}); - -// Level: Falling Box -define.map({ - title: "Falling Box", - spawn:{ - x: 27, - y: 6 - }, - width: 29, - height: 14, - cakes: 2, - map: [ - ["", "", "", "blank", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], - ["blank", "blank", "blank", "blank", "drop", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], - ["blank", "cake", "", "", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], - ["blank", "", "", "", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank"], - ["blank", "blank", "blank", "blank", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "", "", "", "", "blank"], - ["", "", "", "blank", "ladder", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "", "", "", "", "blank"], - ["", "", "", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "cake", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["", "", "", "blank", "ladder", "", "", "flag", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["", "", "", "blank", "", "", "blank", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank"], - ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "bounce", "", "", "bounce", "", "", "bounce", "", "", "bounce", "", "", "blank"], - ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], - ["", "", "", "blank", "spikes", "spikes","blank", "", "blank", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "blank"], - ["", "", "", "blank", "blank", "blank", "blank", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] - ] -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +// Define the sprite maps +define.sprite("default","assets/sprites/tiles.png"); +define.sprite("editor","assets/sprites/editor.png"); + +// Can take damage +Crafty.c("crushable",{ + crush: function(){ + if (this.tile_data.crush_sound) + Crafty.audio.play(this.tile_data.crush_sound); + + if (this.tile_data.destructColor) + ParticleExplosion({x:this.x, y:this.y}, 300, this.tile_data.destructColor, 0, 750); + + if (this.body) + Crafty.box2D.world.DestroyBody(this.body); + + if ((this.tile_data.respawn || this.tile_meta.respawn) && this.tile_meta.respawn != false) + Crafty.e("Tile").tile(this.tile_data.name, this.tile_p.x, this.tile_p.y, map.map_data.width, map.map_data.height); + + this.destroy(); + } +}); + +// Can pull object with use button +Crafty.c("pull", { + using: false, + can_detach: false, + use: function() { + if (this.using) { + return; + } + this.can_detach = false; + setTimeout(function() { this.can_detach = true; }, 5); + console.log("Use"); + Crafty.bind("using", function(to) { this_item.end_use(this_item, to) }); + this.using = true; + game.player.lock_turn = game.player.lock_turn + 1; + + // Delta + var deltax = this.x - game.player.x; + var deltay = this.y - game.player.y; + this.delta = {x: deltax, y: deltay}; + + // Destroy tile's body + Crafty.box2D.world.DestroyBody(this.body); + this.body = null; + + // Add as fixture + this.fixture = game.player.addFixture({ + density: 0.1, + shape: [ [deltax+10,deltay+10], [deltax+72,deltay+10], [deltax+72,deltay+72], [deltax+10,deltay+72] ] + }); + game.player.attach(this); + this.bind("EnterFrame", this.move_to_fix); + this.bind("KeyDown", this.keydown); + var this_item = this; + Crafty.bind("PlayerDeath", function(to) { this_item.end_use(this_item, to) }); + + }, + move_to_fix: function() { + this.can_detach = true; + this.trigger("move", {x: this.x, y: this.y}); + }, + keydown: function(e) { + if (e.key == Crafty.keys.E && this.can_detach) { + this.end_use(this, null); + } + }, + end_use: function(this_item, to) { + if (this_item.using && (to == null || this_item != to)) { + Crafty.unbind("using", this_item.end_use); + this_item.unbind("EnterFrame", this_item.move_to_fix); + this_item.unbind("KeyDown", this_item.keydown); + Crafty.unbind("PlayerDeath", this_item.end_use); + game.player.detach(this_item); + Crafty.box2D.world.DestroyBody(game.player.body); + game.player.physics(); + this_item.using = false; + game.player.lock_turn = game.player.lock_turn - 1; + this_item.init_physics(); + } + } +}); + +Crafty.c("DeathHazzard",{ + init: function(){ + this.bind("EnterFrame",this._enterframe); + }, + _enterframe: function(){ + if (!game.player) + return; + + if (this.contact("Player")){ + game.player.hit(20); + } + + if (this.tile_data.crushes){ + var obj = this.contact("crushable"); + + for (var i=0;i this.hit_tick+1000){ + this.hit_tick = now; + if (this.contact("Player")){ + game.player.hit(1); + } + } + }); + return false; + }, + init_req: true, + ascii: '$' +}); + +/********************************* + * LEVELS * + *********************************/ + +// Level: Tutorial, get cake +define.map({ + title: "Tutorial: Get Cake", + spawn:{ + x: 1, + y: 2 + }, + width: 4, + height: 4, + help: [ + { + msg: "Welcome traveller!

Collect the cakes to proceed to the next level.", + at: {x: -3, y: 1, w: 120}, + behind: true + } + ], + cakes:1, + map: [ + ["blank","blank","blank","blank"], + ["blank","cake","","blank"], + ["blank","","sign_jump","blank"], + ["blank","blank","blank","blank"] + ] +}); + +// Level: Tutorial, water bounce +define.map({ + title: "Tutorial: Jumping", + spawn:{ + x: 1, + y: 2 + }, + width: 26, + height: 5, + help: [ + { + msg: "Don't fall into
the water!", + at: {x: -3, y: 1, w: 120}, + behind: true + } + ], + cakes: 1, + map: [ + ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "bounce", "bounce", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "bounce", + "bounce", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], + ["blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "blank"], + ["blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "cake", "blank"], + ["blank", "blank", "blank", "bounce", "water", "water", "water", "water", "water", "water", + "water", "water", + "water", "blank", "blank", "bounce", "water", "water", "water", "water", "water", "water", "water", "water", + "blank", "blank", "blank", "blank"], + ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] + ] +}); + +// Level: Tutorial, box and buttons +define.map({ + title: "Tutorial: Buttons", + spawn:{ + x: 5, + y: 2 + }, + width: 10, + height: 4, + help: [ + { + msg: "Press E to pull the box,
Press E again to let go.", + at: {x: -3, y: 1, w: 120}, + behind: true + } + ], + cakes: 1, + map: [ + ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], + ["blank", "", "", "", "", "", "", "tech", "", "blank"], + ["blank", "box", "", {node:"button",method:"downtoggle",action:[{x:7,y:1},{x:7,y:2}]}, "", "", "", "tech", "cake", "blank"], + ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] + ] +}); + +// Level: Box and Buttons 1 +define.map({ + title: "Box and Buttons", + spawn:{ + x: 5, + y: 5 + }, + width: 13, + height: 8, + cakes: 1, + map: [ + ["blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank"], + ["blank","blank", {node:"vbuttonl",method:"toggle",action:[{x:4,y:4},{x:4,y:5}]},"","","","","","","","","ladder","blank"], + ["blank","push","","","","","","","","","","ladder","blank"], + ["blank","blank","blank","blank","blank","blank","blank","blank","blank","","","ladder","blank"], + ["blank","","","tech","tech","","","","","","","ladder","blank"], + ["blank","cake","","tech","tech","","","",{node:"button",method:"downtoggle",action:[{x:3,y:4},{x:3,y:5}]},"","","ladder","blank"], + ["blank","blank","blank","blank","blank","blank","blank","spikes","blank","blank","blank","blank","blank"], + ["blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank","blank"] + ] +}); + +// Level: Two doors +define.map({ + title: "Two Doors", + spawn:{ + x: 3, + y: 2 + }, + width: 29, + height: 12, + cakes: 1, + map: [ + ["", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], + ["", "", "blank", "", "", "", "", "", "", "", "tech", "", "", "", "", "blank"], + ["", "", "blank", "", "", "", "", "", "", "", "tech", "", "", "cake", "", "blank"], + ["blank", "blank", "blank", "blank", "blank", "blank", {node:"tech", visible:false}, {node:"tech", visible:false}, {node:"tech", visible:false}, "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], + ["blank", "ladder", "", "", "", "tech", "ladder", "", "", "", "", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["blank", "ladder", "", "", "", "tech", "ladder", "", "", "", "", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["blank", "ladder", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["blank", "ladder", "", "", "", "", "", "", "", "", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["blank", "ladder", "", "", "", "", "", "", "", "blank", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["blank", "ladder", "", "", "", "", {node:"button",method:"downtoggle",action:[{x: 10, y:1}, {x:10, y:2}]}, "", "", "box", "blank", "ladder", "", "", {node:"button",method:"downtoggle",action:[{x:5,y:4},{x:5,y:5}, {x:6, y:3}, {x:7, y:3}, {x:8, y:3}]}, "", "", "", "", "", "", "", "", "flag", "", "box", "", "box", "blank"], + ["blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "water", "water", "water", "blank", "water", "water", "water", "blank", "blank", "blank", "blank", "blank", "blank", "blank"], + ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] + ] +}); + +// Level: Falling Box +define.map({ + title: "Falling Box", + spawn:{ + x: 27, + y: 6 + }, + width: 29, + height: 14, + cakes: 2, + map: [ + ["", "", "", "blank", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], + ["blank", "blank", "blank", "blank", "drop", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], + ["blank", "cake", "", "", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], + ["blank", "", "", "", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank"], + ["blank", "blank", "blank", "blank", "ladder", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "", "", "", "", "blank"], + ["", "", "", "blank", "ladder", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "", "", "", "", "blank"], + ["", "", "", "blank", "ladder", "", "", "", "", "", "", "", "", "", "", "cake", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["", "", "", "blank", "ladder", "", "", "flag", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["", "", "", "blank", "", "", "blank", "blank", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank", "blank", "blank", "blank", "blank", "blank"], + ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "bounce", "", "", "bounce", "", "", "bounce", "", "", "bounce", "", "", "blank"], + ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["", "", "", "blank", "", "", "blank", "", "blank", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "blank"], + ["", "", "", "blank", "spikes", "spikes","blank", "", "blank", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "spikes", "blank"], + ["", "", "", "blank", "blank", "blank", "blank", "", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank", "blank"] + ] +}); diff --git a/assets/editor.js b/assets/editor.js index dc40d16..4806766 100644 --- a/assets/editor.js +++ b/assets/editor.js @@ -1,226 +1,226 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -game.after_load = "editor"; -game.is_editor = true; - -function ed_save(){ - console.log("Exporting..."); - var maps = map.save(); - map.getDim(); - var cakes = map.getCakes(); - - var res = "define.map({\n"; - res += "\tspawn:{\n"; - res += "\t\tx: 1,\n"; - res += "\t\ty: 2\n"; - res += "\t},\n"; - res += "\twidth: "+map.map_data.width+",\n"; - res += "\theight: "+map.map_data.height+",\n"; - res += "\tcakes: "+cakes+",\n"; - res += "\tmap: [\n"; - res += maps; - res += "\n\t]\n"; - res += "});"; - - $("#load_dia").remove(); - var out = '

Save Level

'; - out += '

Close

'; - $("body").append(out); -} - -function ed_load(){ - $("#load_dia").remove(); - var out = '

Load level

'; - out += '

Load - Close

'; - $("body").append(out); -} - -var NEXT_MAP = { - spawn:{ - x: 1, - y: 2 - }, - width: 4, - height: 4, - cakes:1, - map: [ - ["blank","blank","blank","blank"], - ["blank","cake","","blank"], - ["blank","","","blank"], - ["blank","blank","blank","blank"] - ] -}; - -function ed_doload(){ - code = $("#load_code").val(); - console.log(code); - $("#load_dia").remove(); - eval(code); - NEXT_MAP = define._map[define._map.length-1]; - Crafty.scene("editor"); -} - -render_grid = function(c){ - var topx = (Crafty.viewport.x%64)-10; - var topy = (Crafty.viewport.y%64)+5; - c.beginPath(); - for (var x = topx; x<($(window).width()); x+=64){ - if (x>0){ - if (Crafty.viewport.x-10 == x){ - c.strokeStyle="white"; - c.stroke(); - c.beginPath(); - c.moveTo(190+x+0.5,0); - c.lineTo(190+x+0.5,$(window).height()); - c.strokeStyle="black"; - c.stroke(); - c.beginPath(); - }else{ - c.moveTo(190+x+0.5,0); - c.lineTo(190+x+0.5,$(window).height()); - } - } - } - for (var x = topy; x<($(window).height()); x+=64){ - if (Crafty.viewport.y+5 == x){ - c.strokeStyle="white"; - c.stroke(); - c.beginPath(); - c.moveTo(192,x-0.5); - c.lineTo($(window).width(),x-0.5); - c.strokeStyle="black"; - c.stroke(); - c.beginPath(); - }else{ - c.moveTo(192,x-0.5); - c.lineTo($(window).width(),x-0.5); - } - } - c.strokeStyle="white"; - c.stroke(); -}; - -var EDMODE = "rubber"; -var EDTOOL = "pencil"; - -function ed_updatetoolbar(){ - $("#tools").children('ul').children('li').each(function(){ - console.log("Removing..."); - $(this).children('a').removeClass('selected'); - }); - $("#"+EDMODE).addClass('selected'); - $("#tool_"+EDTOOL).addClass('selected'); -} - -function change_mode(name){ - EDMODE = name; - ed_updatetoolbar(); -} - -function dotool(x,y){ - if (x<0 || y<0) - return; - - if (EDMODE == "rubber"){ - map.set(x,y,''); - }else if (EDMODE == "player"){ - - }else{ - map.set(x,y,EDMODE); - } -} - -// Editor -var prev; -Crafty.scene("editor", function () { - game.player = null; - map = Map(); - map.load(NEXT_MAP); - Crafty.viewport.x = 75; - Crafty.viewport.y = 60; - - // Debugging background: - // warns user that the script has not finished. - Crafty.background("#ffcccc"); - var tmp = 'Level Editor
';//'
'; - tmp += 'Save - '; - tmp += 'Load'; - tmp += ' - Exit'; - //tmp += '
'; - $("#fps").html(tmp); - tmp = '
'; - tmp += '
    '; - tmp += '
  • Pencil
  • '; - tmp += '
  • Rectangle
  • '; - tmp += '

  • '; - tmp += '
  • Rubber
  • '; - tmp += '
  • Player
  • '; - tmp += '

  • '; - for (key in define._bloc) { - var b = define._bloc[key]; - if (b.desc) - tmp += '
  • '+b.desc+'
  • '; - else - tmp += '
  • '+b.name+'
  • '; - } - tmp += '
'; - tmp += '
'; - $("#panel").append(tmp); - - // FPS counter - /*var fps = Crafty.e("FPS") - .bind("MessureFPS",function(fps){ - var res = "Map Editor
"; - res += "FPS: " + fps.value; - $("#fps").html(res); - });*/ - - Crafty.e("Keyboard").bind("EnterFrame",function(){ - var cur = (new Date).getTime(); - var dt = (cur - prev) / 1000; - prev = cur; - - var sp = 128; - if ((Crafty.keydown[Crafty.keys['W']] || Crafty.keydown[Crafty.keys['UP_ARROW']])){ - Crafty.viewport.y += sp * dt; - } - if ((Crafty.keydown[Crafty.keys['D']] || Crafty.keydown[Crafty.keys['RIGHT_ARROW']])){ - Crafty.viewport.x -= sp * dt; - } - if ((Crafty.keydown[Crafty.keys['S']] || Crafty.keydown[Crafty.keys['DOWN_ARROW']])){ - Crafty.viewport.y -= sp * dt; - } - if ((Crafty.keydown[Crafty.keys['A']] || Crafty.keydown[Crafty.keys['LEFT_ARROW']])){ - Crafty.viewport.x += sp * dt; - } - render_bg(); - }); - - var win = $(window)[0]; - win.addEventListener('mousemove', function(e) { - game.mouse = { - x: e.clientX, - y: e.clientY - }; - }); - win.addEventListener('click', function(e){ - if (game.mouse.x > 190 && !$("#load_dia")[0]){ - dotool( - Math.floor((game.mouse.x-Crafty.viewport.x-180)/64), - Math.floor((game.mouse.y-Crafty.viewport.y)/64) - ); - } - }, false); - - // Initiate the inventory - ed_updatetoolbar(); - //dotool(0,0); - Crafty.background("transparent"); -},function(){ - $('#tools').remove(); - $('#editor').remove(); -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +game.after_load = "editor"; +game.is_editor = true; + +function ed_save(){ + console.log("Exporting..."); + var maps = map.save(); + map.getDim(); + var cakes = map.getCakes(); + + var res = "define.map({\n"; + res += "\tspawn:{\n"; + res += "\t\tx: 1,\n"; + res += "\t\ty: 2\n"; + res += "\t},\n"; + res += "\twidth: "+map.map_data.width+",\n"; + res += "\theight: "+map.map_data.height+",\n"; + res += "\tcakes: "+cakes+",\n"; + res += "\tmap: [\n"; + res += maps; + res += "\n\t]\n"; + res += "});"; + + $("#load_dia").remove(); + var out = '

Save Level

'; + out += '

Close

'; + $("body").append(out); +} + +function ed_load(){ + $("#load_dia").remove(); + var out = '

Load level

'; + out += '

Load - Close

'; + $("body").append(out); +} + +var NEXT_MAP = { + spawn:{ + x: 1, + y: 2 + }, + width: 4, + height: 4, + cakes:1, + map: [ + ["blank","blank","blank","blank"], + ["blank","cake","","blank"], + ["blank","","","blank"], + ["blank","blank","blank","blank"] + ] +}; + +function ed_doload(){ + code = $("#load_code").val(); + console.log(code); + $("#load_dia").remove(); + eval(code); + NEXT_MAP = define._map[define._map.length-1]; + Crafty.scene("editor"); +} + +render_grid = function(c){ + var topx = (Crafty.viewport.x%64)-10; + var topy = (Crafty.viewport.y%64)+5; + c.beginPath(); + for (var x = topx; x<($(window).width()); x+=64){ + if (x>0){ + if (Crafty.viewport.x-10 == x){ + c.strokeStyle="white"; + c.stroke(); + c.beginPath(); + c.moveTo(190+x+0.5,0); + c.lineTo(190+x+0.5,$(window).height()); + c.strokeStyle="black"; + c.stroke(); + c.beginPath(); + }else{ + c.moveTo(190+x+0.5,0); + c.lineTo(190+x+0.5,$(window).height()); + } + } + } + for (var x = topy; x<($(window).height()); x+=64){ + if (Crafty.viewport.y+5 == x){ + c.strokeStyle="white"; + c.stroke(); + c.beginPath(); + c.moveTo(192,x-0.5); + c.lineTo($(window).width(),x-0.5); + c.strokeStyle="black"; + c.stroke(); + c.beginPath(); + }else{ + c.moveTo(192,x-0.5); + c.lineTo($(window).width(),x-0.5); + } + } + c.strokeStyle="white"; + c.stroke(); +}; + +var EDMODE = "rubber"; +var EDTOOL = "pencil"; + +function ed_updatetoolbar(){ + $("#tools").children('ul').children('li').each(function(){ + console.log("Removing..."); + $(this).children('a').removeClass('selected'); + }); + $("#"+EDMODE).addClass('selected'); + $("#tool_"+EDTOOL).addClass('selected'); +} + +function change_mode(name){ + EDMODE = name; + ed_updatetoolbar(); +} + +function dotool(x,y){ + if (x<0 || y<0) + return; + + if (EDMODE == "rubber"){ + map.set(x,y,''); + }else if (EDMODE == "player"){ + + }else{ + map.set(x,y,EDMODE); + } +} + +// Editor +var prev; +Crafty.scene("editor", function () { + game.player = null; + map = Map(); + map.load(NEXT_MAP); + Crafty.viewport.x = 75; + Crafty.viewport.y = 60; + + // Debugging background: + // warns user that the script has not finished. + Crafty.background("#ffcccc"); + var tmp = 'Level Editor
';//'
'; + tmp += 'Save - '; + tmp += 'Load'; + tmp += ' - Exit'; + //tmp += '
'; + $("#fps").html(tmp); + tmp = '
'; + tmp += '
    '; + tmp += '
  • Pencil
  • '; + tmp += '
  • Rectangle
  • '; + tmp += '

  • '; + tmp += '
  • Rubber
  • '; + tmp += '
  • Player
  • '; + tmp += '

  • '; + for (key in define._bloc) { + var b = define._bloc[key]; + if (b.desc) + tmp += '
  • '+b.desc+'
  • '; + else + tmp += '
  • '+b.name+'
  • '; + } + tmp += '
'; + tmp += '
'; + $("#panel").append(tmp); + + // FPS counter + /*var fps = Crafty.e("FPS") + .bind("MessureFPS",function(fps){ + var res = "Map Editor
"; + res += "FPS: " + fps.value; + $("#fps").html(res); + });*/ + + Crafty.e("Keyboard").bind("EnterFrame",function(){ + var cur = (new Date).getTime(); + var dt = (cur - prev) / 1000; + prev = cur; + + var sp = 128; + if ((Crafty.keydown[Crafty.keys['W']] || Crafty.keydown[Crafty.keys['UP_ARROW']])){ + Crafty.viewport.y += sp * dt; + } + if ((Crafty.keydown[Crafty.keys['D']] || Crafty.keydown[Crafty.keys['RIGHT_ARROW']])){ + Crafty.viewport.x -= sp * dt; + } + if ((Crafty.keydown[Crafty.keys['S']] || Crafty.keydown[Crafty.keys['DOWN_ARROW']])){ + Crafty.viewport.y -= sp * dt; + } + if ((Crafty.keydown[Crafty.keys['A']] || Crafty.keydown[Crafty.keys['LEFT_ARROW']])){ + Crafty.viewport.x += sp * dt; + } + render_bg(); + }); + + var win = $(window)[0]; + win.addEventListener('mousemove', function(e) { + game.mouse = { + x: e.clientX, + y: e.clientY + }; + }); + win.addEventListener('click', function(e){ + if (game.mouse.x > 190 && !$("#load_dia")[0]){ + dotool( + Math.floor((game.mouse.x-Crafty.viewport.x-180)/64), + Math.floor((game.mouse.y-Crafty.viewport.y)/64) + ); + } + }, false); + + // Initiate the inventory + ed_updatetoolbar(); + //dotool(0,0); + Crafty.background("transparent"); +},function(){ + $('#tools').remove(); + $('#editor').remove(); +}); diff --git a/assets/effects.js b/assets/effects.js index aba0d0a..586369c 100644 --- a/assets/effects.js +++ b/assets/effects.js @@ -1,246 +1,246 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -Crafty.c("ParticleSystem",{ - init: function(){}, - particles: function(data){ - this.requires("2D"); - this.data = data; - this.start = new Date().getTime(); - this.last = this.start; - this.bind("EnterFrame",this.tick); - return this; - }, - tick: function(){ - var now = new Date().getTime(); - if (this.data && this.data.expire && now > (this.start+this.data.expire)){ - console.log("Deleting particle spawner"); - this.destroy(); - } - - if (now > this.last + this.data.delay){ - this.last = now; - var amt = 1; - if (this.data.spawn && this.data.spawn.amt) - amt = this.data.spawn.amt; - for (var i=0;i (this.start+this.expire.t)) || - (this.expire && this.expire.vy_gt && this.vel.y > this.expire.vy_gt) || - (this.expire && this.expire.vy_lt && this.vel.y < this.expire.vy_lt) || - (this.expire && this.expire.vx_gt && this.vel.x > this.expire.vx_gt) || - (this.expire && this.expire.vx_lt && this.vel.x < this.expire.vx_lt) - ){ - if (this.decay == -1) - this.decay = now; - } - if (this.decay != -1){ - if (now > (this.decay + this.expire.fo)){ - this.destroy(); - return; - } - var perc = 1-((now-this.decay)/this.expire.fo); - this.alpha = perc; - this.visible = (perc>0); - } - var dtime = (now - this.last)/1000; - this.x += this.vel.x * dtime; - this.y += this.vel.y * dtime; - this.vel.x += this.acc.x * 32 * dtime; - this.vel.y += this.acc.y * 32 * dtime; - - this.last = now; - } -}); - -function ParticleExplosion(pos, speed, tcolor, g, timeout, width, amt){ - if (!width) - width = 64; - if (!amt) - amt = 8; - - for (var x=0;x this.last + 4000){ - this.last = now; - this.placeCloud(Crafty.viewport.width + 100); - } - }, - placeCloud: function(x){ - var top = 0; - if (this.data.top) - top = this.data.top; - var height = 200; - if (this.data.height) - height = this.data.height; - - //this.current_y = (this.current_y + 59) % 200; - var cloud = Crafty.e("Cloud"); - var new_y = this.old_y; - while (Math.abs(new_y-this.old_y) < 80){ - new_y = Math.random() * height + top; - } - cloud.attr({ - x: x, - y: new_y // this.current_y + top - }); - this.old_y = new_y; - } - -}); - -Crafty.c("Cloud",{ - init: function(){ - this.requires("2D, drawmode, Sprite, CloudS"); - this.attr({z:-10}); - this.sprite(0,0,128,64); - this.crop(0,0,128,64); - this.last = new Date().getTime(); - this.speed = 25; - this.bind("EnterFrame",this.tick); - }, - tick: function(){ - var now = new Date().getTime(); - var dtime = (now - this.last)/1000; - this.last = now; - - this.x -= this.speed * dtime; - - if (this.x < -(Crafty.viewport.width/2)){ - this.destroy(); - } - }, -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +Crafty.c("ParticleSystem",{ + init: function(){}, + particles: function(data){ + this.requires("2D"); + this.data = data; + this.start = new Date().getTime(); + this.last = this.start; + this.bind("EnterFrame",this.tick); + return this; + }, + tick: function(){ + var now = new Date().getTime(); + if (this.data && this.data.expire && now > (this.start+this.data.expire)){ + console.log("Deleting particle spawner"); + this.destroy(); + } + + if (now > this.last + this.data.delay){ + this.last = now; + var amt = 1; + if (this.data.spawn && this.data.spawn.amt) + amt = this.data.spawn.amt; + for (var i=0;i (this.start+this.expire.t)) || + (this.expire && this.expire.vy_gt && this.vel.y > this.expire.vy_gt) || + (this.expire && this.expire.vy_lt && this.vel.y < this.expire.vy_lt) || + (this.expire && this.expire.vx_gt && this.vel.x > this.expire.vx_gt) || + (this.expire && this.expire.vx_lt && this.vel.x < this.expire.vx_lt) + ){ + if (this.decay == -1) + this.decay = now; + } + if (this.decay != -1){ + if (now > (this.decay + this.expire.fo)){ + this.destroy(); + return; + } + var perc = 1-((now-this.decay)/this.expire.fo); + this.alpha = perc; + this.visible = (perc>0); + } + var dtime = (now - this.last)/1000; + this.x += this.vel.x * dtime; + this.y += this.vel.y * dtime; + this.vel.x += this.acc.x * 32 * dtime; + this.vel.y += this.acc.y * 32 * dtime; + + this.last = now; + } +}); + +function ParticleExplosion(pos, speed, tcolor, g, timeout, width, amt){ + if (!width) + width = 64; + if (!amt) + amt = 8; + + for (var x=0;x this.last + 4000){ + this.last = now; + this.placeCloud(Crafty.viewport.width + 100); + } + }, + placeCloud: function(x){ + var top = 0; + if (this.data.top) + top = this.data.top; + var height = 200; + if (this.data.height) + height = this.data.height; + + //this.current_y = (this.current_y + 59) % 200; + var cloud = Crafty.e("Cloud"); + var new_y = this.old_y; + while (Math.abs(new_y-this.old_y) < 80){ + new_y = Math.random() * height + top; + } + cloud.attr({ + x: x, + y: new_y // this.current_y + top + }); + this.old_y = new_y; + } + +}); + +Crafty.c("Cloud",{ + init: function(){ + this.requires("2D, drawmode, Sprite, CloudS"); + this.attr({z:-10}); + this.sprite(0,0,128,64); + this.crop(0,0,128,64); + this.last = new Date().getTime(); + this.speed = 25; + this.bind("EnterFrame",this.tick); + }, + tick: function(){ + var now = new Date().getTime(); + var dtime = (now - this.last)/1000; + this.last = now; + + this.x -= this.speed * dtime; + + if (this.x < -(Crafty.viewport.width/2)){ + this.destroy(); + } + }, +}); diff --git a/assets/engine.js b/assets/engine.js index 52f0f37..bd48bc3 100644 --- a/assets/engine.js +++ b/assets/engine.js @@ -1,167 +1,166 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -var game = { - player: null, - inventory: {}, - next_map: "not-ready" -}; -var AUDIO_CARDB_CRUSH = "boxCrush1"; -var AUDIO_DEATH = "playerDie"; -var DEBUG = true; - -function assert(cond) { - if (!cond) - throw("Assertion Failed!"); -} - -var define = { - // Private definition tables - _bloc: {}, - _map: [], - _sprite: {}, - _alias: {}, - - // Define map - map: function(data){ - data.id = this._map.length; - this._map.push(data); - }, - - // Define block - block: function(data){ - if (game.is_editor && data.editor){ - for (key in data.editor){ - data[key] = data.editor[key]; - } - data.editor = null; - } - - this._bloc[data.name] = data; - }, - - sprite: function(name,file){ - this._sprite[name] = file; - }, - - alias: function(old, newn){ - this._alias[old] = newn; - } -}; - -var map = Map(); -var bg_render = 0; - -var render_grid = 0; - -function render_bg(){ - if ( - bg_render == 0 || - bg_render.width != $(window).width() || - bg_render.height != $(window).height() || - Crafty.viewport.y > bg_render.y + 20 || Crafty.viewport.y < bg_render.y - 20 || - game.is_editor - ){ - bg_render = { - width: $(window).width(), - height: $(window).height(), - y: Crafty.viewport.y - }; - var ce = $("#bg")[0]; - ce.width = $(window).width(); - ce.height = $(window).height(); - var c = ce.getContext("2d"); - if (!game.is_editor){ - var skygrad= c.createLinearGradient(0,(ce.height/4)+Crafty.viewport.y/5,0,ce.height); - skygrad.addColorStop(0,"#87C1EB"); - skygrad.addColorStop(1,"#9DDDF2"); - c.fillStyle = skygrad; - }else{ - c.fillStyle = "#87CEEB"; - } - c.fillRect(0,0,ce.width,ce.height); - //c.fillStyle="#4b4b33"; - - if (render_grid!=0) - render_grid(c); - } -} - -// Auto mode select -Crafty.c("drawmode",{ - init: function(){ - this.requires("2D, DOM"); - } -}); - -// Load -Crafty.scene("Load", function() { - $("body").prepend(""); - - if (!game.is_editor) { - Crafty.background("transparent"); - setInterval(render_bg, 1000/20); - - Crafty.e("2D, DOM, Image, logo") - .attr({x: Crafty.viewport.width / 2 - 92, y: Crafty.viewport.height / 2 - 190, w: 186}) - .image("assets/sprites/rubenwardy.jpg"); - Crafty.e("2D, DOM, Text, logo") - .attr({x: Crafty.viewport.width / 2 - 92, y: Crafty.viewport.height / 2, w: 186}) - //.textColor("#ffffff") - .textFont({ family: 'Arial', size: '20px'}) - .css("text-align", "center") - .text("rubenwardy"); - } else { - Crafty.background("#000"); - } - - var resources = [ - "assets/sprites/player_body.png", - "assets/sprites/player_head.png", - "assets/sprites/DeadPlayer.png", - "assets/sprites/cloud.png", - "assets/sounds/cboxCrush.wav", - "assets/sounds/playerDie.wav" - ]; - - for (key in define._sprite){ - resources.push(define._sprite[key]); - } - - var time_before = new Date().getTime(); - // Load stuff - Crafty.load(resources,function() { - Crafty.audio.add(AUDIO_CARDB_CRUSH, "assets/sounds/cboxCrush.wav"); - Crafty.audio.add(AUDIO_DEATH, "assets/sounds/playerDie.wav"); - Crafty.sprite(27,21,"assets/sprites/player_body.png", { - PlayerBody:[0,0] - }); - Crafty.sprite(20,13,"assets/sprites/player_head.png", { - PlayerHead:[0,0] - }); - Crafty.sprite(31,28,"assets/sprites/DeadPlayer.png", { - DeadPlayer:[0,0] - }); - Crafty.sprite(128,64,"assets/sprites/cloud.png", { - CloudS:[0,0] - }); - for (key in define._sprite){ - console.log("Loading '"+key+"' from '"+define._sprite[key]+"'"); - var ind = {}; - ind[key] = [0, 0]; - Crafty.sprite(80, 80,define._sprite[key], ind, 0, 0); - } - if (game.is_editor) - Crafty.scene(game.after_load); - else { - Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); - setTimeout(function() { - $(".logo").fadeOut(); - setTimeout(function(){Crafty.scene(game.after_load);}, 500); - }, 700 - (new Date().getTime() - time_before)); - } - }); -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +var game = { + player: null, + inventory: {}, + next_map: "not-ready" +}; +var AUDIO_CARDB_CRUSH = "boxCrush1"; +var AUDIO_DEATH = ""; +var DEBUG = true; + +function assert(cond) { + if (!cond) + throw("Assertion Failed!"); +} + +var define = { + // Private definition tables + _bloc: {}, + _map: [], + _sprite: {}, + _alias: {}, + + // Define map + map: function(data){ + data.id = this._map.length; + this._map.push(data); + }, + + // Define block + block: function(data){ + if (game.is_editor && data.editor){ + for (key in data.editor){ + data[key] = data.editor[key]; + } + data.editor = null; + } + + this._bloc[data.name] = data; + }, + + sprite: function(name,file){ + this._sprite[name] = file; + }, + + alias: function(old, newn){ + this._alias[old] = newn; + } +}; + +var map = Map(); +var bg_render = 0; + +var render_grid = 0; + +function render_bg(){ + if ( + bg_render == 0 || + bg_render.width != $(window).width() || + bg_render.height != $(window).height() || + Crafty.viewport.y > bg_render.y + 20 || Crafty.viewport.y < bg_render.y - 20 || + game.is_editor + ){ + bg_render = { + width: $(window).width(), + height: $(window).height(), + y: Crafty.viewport.y + }; + var ce = $("#bg")[0]; + ce.width = $(window).width(); + ce.height = $(window).height(); + var c = ce.getContext("2d"); + if (!game.is_editor){ + var skygrad= c.createLinearGradient(0,(ce.height/4)+Crafty.viewport.y/5,0,ce.height); + skygrad.addColorStop(0,"#87C1EB"); + skygrad.addColorStop(1,"#9DDDF2"); + c.fillStyle = skygrad; + }else{ + c.fillStyle = "#87CEEB"; + } + c.fillRect(0,0,ce.width,ce.height); + //c.fillStyle="#4b4b33"; + + if (render_grid!=0) + render_grid(c); + } +} + +// Auto mode select +Crafty.c("drawmode",{ + init: function(){ + this.requires("2D, DOM"); + } +}); + +// Load +Crafty.scene("Load", function() { + $("body").prepend(""); + + if (!game.is_editor) { + Crafty.background("transparent"); + setInterval(render_bg, 1000/20); + + Crafty.e("2D, DOM, Image, logo") + .attr({x: Crafty.viewport.width / 2 - 92, y: Crafty.viewport.height / 2 - 190, w: 186}) + .image("assets/sprites/rubenwardy.jpg"); + Crafty.e("2D, DOM, Text, logo") + .attr({x: Crafty.viewport.width / 2 - 92, y: Crafty.viewport.height / 2, w: 186}) + //.textColor("#ffffff") + .textFont({ family: 'Arial', size: '20px'}) + .css("text-align", "center") + .text("rubenwardy"); + } else { + Crafty.background("#000"); + } + + var resources = [ + "assets/sprites/player_body.png", + "assets/sprites/player_head.png", + "assets/sprites/DeadPlayer.png", + "assets/sprites/cloud.png", + "assets/sounds/cboxCrush.wav" + ]; + + for (key in define._sprite){ + resources.push(define._sprite[key]); + } + + var time_before = new Date().getTime(); + // Load stuff + Crafty.load(resources,function() { + Crafty.audio.add(AUDIO_CARDB_CRUSH, "assets/sounds/cboxCrush.wav"); + Crafty.audio.add(AUDIO_DEATH, "assets/sounds/playerDie.wav"); + Crafty.sprite(27,21,"assets/sprites/player_body.png", { + PlayerBody:[0,0] + }); + Crafty.sprite(20,13,"assets/sprites/player_head.png", { + PlayerHead:[0,0] + }); + Crafty.sprite(31,28,"assets/sprites/DeadPlayer.png", { + DeadPlayer:[0,0] + }); + Crafty.sprite(128,64,"assets/sprites/cloud.png", { + CloudS:[0,0] + }); + for (key in define._sprite){ + console.log("Loading '"+key+"' from '"+define._sprite[key]+"'"); + var ind = {}; + ind[key] = [0, 0]; + Crafty.sprite(80, 80,define._sprite[key], ind, 0, 0); + } + if (game.is_editor) + Crafty.scene(game.after_load); + else { + Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); + setTimeout(function() { + $(".logo").fadeOut(); + setTimeout(function(){Crafty.scene(game.after_load);}, 500); + }, 700 - (new Date().getTime() - time_before)); + } + }); +}); diff --git a/assets/game.js b/assets/game.js index 9364c3c..6837867 100644 --- a/assets/game.js +++ b/assets/game.js @@ -1,162 +1,162 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -game.after_load = "menu"; - -/* - * Menu - */ - -Crafty.scene("menu", function() { - // Set up style - Crafty.background("transparent"); - Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); - - Crafty.e("2D, DOM, Image") - .attr({x: -20, y: Crafty.viewport.height - 110}) - .image("assets/sprites/pp.png"); - Crafty.e("2D, DOM, Image") - .attr({x: Crafty.viewport.width - 190, y: Crafty.viewport.height - 115}) - .image("assets/sprites/pp_right.png"); - Crafty.e("2D, DOM, Text, logo") - .attr({x: 0, y: 20, w: Crafty.viewport.width}) - .textFont({ family: 'Arial', size: '40px'}) - .css("text-align", "center") - .text("Puzzle Platformer"); - - $("#fps").hide(); - var d = "\n"; - d += "
\n"; - d += "Help\n"; - d += "

Get all the cakes to win!

"; - d += "WASD to Move
"; - d += "Space to Jump
"; - d += "
\n"; - - $("body").append(d); - $("#menu").css("left", (Crafty.viewport.width/2 - $("#menu").width()/2 + 20) + "px"); -},function(){ - $("#menu").remove(); - $("#fps").fadeIn(); -}); - -Crafty.scene("level_select", function() { - // Set up style - Crafty.background("transparent"); - Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); - - Crafty.e("2D, DOM, Image") - .attr({x: -20, y: Crafty.viewport.height - 110}) - .image("assets/sprites/pp.png"); - Crafty.e("2D, DOM, Image") - .attr({x: Crafty.viewport.width - 190, y: Crafty.viewport.height - 115}) - .image("assets/sprites/pp_right.png"); - Crafty.e("2D, DOM, Text, logo") - .attr({x: 0, y: 20, w: Crafty.viewport.width}) - .textFont({ family: 'Arial', size: '40px'}) - .css("text-align", "center") - .text("Puzzle Platformer"); - - $("#fps").hide(); - var d = ""; - $("body").append(d); - $("#level_select").css("left", (Crafty.viewport.width/2 - $("#level_select").width()/2 + 20) + "px"); -},function(){ - $("#level_select").remove(); - $("#fps").fadeIn(); -}); - -function play_game(map_id){ - if (!map_id || map_id < 0){ - game.next_map = define._map[0]; - }else{ - game.next_map = define._map[map_id]; - } - - Crafty.scene("play"); -} -var prev = 0; -game.fpsco = 10000; - - -Crafty.c('FPS_TICK', { - init: function() { - this.ticks = 0; - this.lastReportedOn = new Date().getTime(); - - this.bind('MeasureRenderTime', function(elapsed) { - this.ticks += 1; - }); - - this.bind('EnterFrame', function() { - var now = new Date().getTime(); - var seconds = (now - this.lastReportedOn) / 1000; - - if (seconds >= 0.5) { - $("#fps").html( - "Puzzle Platform
" + - "CAKE: " + game.inventory.cake + - "
FPS: " + Math.round(this.ticks / seconds) + - "
Facing: " + ((game.player.facing==FACING_RIGHT)?"right":"left") - ); - this.ticks = 0; - this.lastReportedOn = now; - } - }); - } -}); - -// Play scene -Crafty.scene("play", function () { - // Debuging background: warns user that the script has not finished. - Crafty.background("#ffcccc"); - - // Create player - game.inventory = {}; - game.player = Crafty.e("2D, Player, Keyboard").player(); - - // follow player - Crafty.viewport.clampToEntities = false; - Crafty.viewport.follow(game.player, 0, 0); - - // Load test_map - map = Map(); - map.load(game.next_map); - - // Set up physics - game.player.physics(); - - // FPS counter - var fps = Crafty.e("2D, FPS_TICK"); - - // Initiate the inventory - game.inventory = {cake:0}; - - /*Crafty.e("CloudSystem").clouds({ - left:-Crafty.viewport.width/2, - width: 2*Crafty.viewport.width, - top:-Crafty.viewport.height/2, - height: 2 * Crafty.viewport.height / 3, - res: 32 - });*/ - - $("#fps").html("Puzzle Platform"); - Crafty.background("transparent"); -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +game.after_load = "menu"; + +/* + * Menu + */ + +Crafty.scene("menu", function() { + // Set up style + Crafty.background("transparent"); + Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); + + Crafty.e("2D, DOM, Image") + .attr({x: -20, y: Crafty.viewport.height - 110}) + .image("assets/sprites/pp.png"); + Crafty.e("2D, DOM, Image") + .attr({x: Crafty.viewport.width - 190, y: Crafty.viewport.height - 115}) + .image("assets/sprites/pp_right.png"); + Crafty.e("2D, DOM, Text, logo") + .attr({x: 0, y: 20, w: Crafty.viewport.width}) + .textFont({ family: 'Arial', size: '40px'}) + .css("text-align", "center") + .text("Puzzle Platformer"); + + $("#fps").hide(); + var d = "\n"; + d += "
\n"; + d += "Help\n"; + d += "

Get all the cakes to win!

"; + d += "WASD to Move
"; + d += "Space to Jump
"; + d += "
\n"; + + $("body").append(d); + $("#menu").css("left", (Crafty.viewport.width/2 - $("#menu").width()/2 + 20) + "px"); +},function(){ + $("#menu").remove(); + $("#fps").fadeIn(); +}); + +Crafty.scene("level_select", function() { + // Set up style + Crafty.background("transparent"); + Crafty.e("CloudSystem").clouds({top:0, height: 350, res: 23}); + + Crafty.e("2D, DOM, Image") + .attr({x: -20, y: Crafty.viewport.height - 110}) + .image("assets/sprites/pp.png"); + Crafty.e("2D, DOM, Image") + .attr({x: Crafty.viewport.width - 190, y: Crafty.viewport.height - 115}) + .image("assets/sprites/pp_right.png"); + Crafty.e("2D, DOM, Text, logo") + .attr({x: 0, y: 20, w: Crafty.viewport.width}) + .textFont({ family: 'Arial', size: '40px'}) + .css("text-align", "center") + .text("Puzzle Platformer"); + + $("#fps").hide(); + var d = ""; + $("body").append(d); + $("#level_select").css("left", (Crafty.viewport.width/2 - $("#level_select").width()/2 + 20) + "px"); +},function(){ + $("#level_select").remove(); + $("#fps").fadeIn(); +}); + +function play_game(map_id){ + if (!map_id || map_id < 0){ + game.next_map = define._map[0]; + }else{ + game.next_map = define._map[map_id]; + } + + Crafty.scene("play"); +} +var prev = 0; +game.fpsco = 10000; + + +Crafty.c('FPS_TICK', { + init: function() { + this.ticks = 0; + this.lastReportedOn = new Date().getTime(); + + this.bind('MeasureRenderTime', function(elapsed) { + this.ticks += 1; + }); + + this.bind('EnterFrame', function() { + var now = new Date().getTime(); + var seconds = (now - this.lastReportedOn) / 1000; + + if (seconds >= 0.5) { + $("#fps").html( + "Puzzle Platform
" + + "CAKE: " + game.inventory.cake + + "
FPS: " + Math.round(this.ticks / seconds) + + "
Facing: " + ((game.player.facing==FACING_RIGHT)?"right":"left") + ); + this.ticks = 0; + this.lastReportedOn = now; + } + }); + } +}); + +// Play scene +Crafty.scene("play", function () { + // Debuging background: warns user that the script has not finished. + Crafty.background("#ffcccc"); + + // Create player + game.inventory = {}; + game.player = Crafty.e("2D, Player, Keyboard").player(); + + // follow player + Crafty.viewport.clampToEntities = false; + Crafty.viewport.follow(game.player, 0, 0); + + // Load test_map + map = Map(); + map.load(game.next_map); + + // Set up physics + game.player.physics(); + + // FPS counter + var fps = Crafty.e("2D, FPS_TICK"); + + // Initiate the inventory + game.inventory = {cake:0}; + + /*Crafty.e("CloudSystem").clouds({ + left:-Crafty.viewport.width/2, + width: 2*Crafty.viewport.width, + top:-Crafty.viewport.height/2, + height: 2 * Crafty.viewport.height / 3, + res: 32 + });*/ + + $("#fps").html("Puzzle Platform"); + Crafty.background("transparent"); +}); diff --git a/assets/libraries/jQuery.min.js b/assets/libraries/jQuery.min.js index 83589da..45477c0 100644 --- a/assets/libraries/jQuery.min.js +++ b/assets/libraries/jQuery.min.js @@ -1,2 +1,2 @@ -/*! jQuery v1.8.3 jquery.com | jquery.org/license */ -(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); \ No newline at end of file +/*! jQuery v1.8.3 jquery.com | jquery.org/license */ +(function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write(""),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t
a",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="
t
",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="
",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;ti.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="
",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="

",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t0)for(i=r;i=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*\s*$/g,Nt={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X
","
"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1>");try{for(;r1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]===""&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("
").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); diff --git a/assets/map.js b/assets/map.js index d46ac54..db1f57f 100644 --- a/assets/map.js +++ b/assets/map.js @@ -1,419 +1,419 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -function Map(){ - return { - tiles: null, - map_data: null, - load: function(data){ - if (!data){ - throw("MapNotFound"); - return; - } - - this.tiles = []; - this.map_data = data; - - for (var y = data.map.length-1; y >= 0; y--) { - this.tiles[y] = []; - for (var x = 0; x < data.map[y].length; x++) { - if (data.map[y][x] != ''){ - this.tiles[y][x] = Crafty.e("2D, Tile") - .tile(data.map[y][x],x,y,data.width,data.height); - }else{ - this.tiles[y][x] = null; - } - } - } - - if (game.player){ - game.player.newSpawn(data.spawn); - game.player.attr({x: data.spawn.x*64+15,y: data.spawn.y*64+25}); - } - - if (this.map_data.help) - this.show_bubble(this.map_data.help[0]); - }, - get: function(x,y){ - return this.tiles[y][x]; - }, - set: function(x,y,data){ - while (y>=this.tiles.length){ - this.tiles.push([]); - } - while (x>=this.tiles[y].length){ - this.tiles[y].push(null); - } - if (this.tiles[y][x]){ - this.tiles[y][x].destroy(); - this.tiles[y][x] = null; - } - if (data != ''){ - this.tiles[y][x] = Crafty.e("Tile").tile(data,x,y,this.map_data.width,this.map_data.height); - }else{ - this.tiles[y][x] = null; - } - //this.debug(); - }, - debug: function(){ - var res = ""; - for (var y=0;y w) - w = this.tiles[y].length; - } - this.map_data.width = w; - this.map_data.height = h; - }, - getCakes: function(){ - var c = 0; - for (var y=0;y one.x + one.w || - other.x + other.w < one.x || - other.y > one.y + one.h || - other.y + other.h < one.y - ); - }; - - var distance = Math.sqrt( Math.pow(from.x - to.x, 2) + Math.pow(from.y - to.y, 2) ); - var direction = Math.atan((to.y - from.y) / (to.x - from.x)); - for (var i = 0; i < distance; i += step){ - var pos = { - x: from.x + Math.cos(direction) * i, - y: from.y + Math.sin(direction) * i, - w: 27, - h: 29 - }; - if (interRect(rect, pos)) - return true; - } - if (interRect(rect, {x: to.x, y: to.y, w: 27, h: 29})) - return true; - - return false; - }, - show_bubble: function(data){ - Crafty.e("Bubble_E").bubble(data); - } - }; -}; - -var BUBBLES = 0; -Crafty.c("Bubble_E",{ - init: function(){ - this.bub_id = BUBBLES; - BUBBLES = BUBBLES + 1; - }, - bubble: function(data){ - if (data.at){ - this.requires("2D, DOM, bubble, Text"); - this.text(data.msg); - this.attr({ - x: data.at.x * 64, - y: data.at.y * 64 + 10, - z: 1000 - }); - if (data.behind) - this.attr({z: 0}); - if (data.at.w) - this.attr({w: data.at.w}); - if (data.at.h) - this.attr({h: data.at.h}); - - }else{ - $("#bubble").remove(); - $("body").append("
" + data.msg + "
"); - if (data.behind) - $("#bubble").css("z-index", "0"); - } - } - -}); - -Crafty.c("LayerDebug", { - init: function() { - return; - this.text = Crafty.e("2D, DOM, Text") - .attr({x: -40, y: 40, w: 64, z: 1999}) - .textFont({ family: 'Arial', size: '10px'}) - .css("text-align", "center") - .text(this.z); - this.attach(this.text); - - this.bind("EnterFrame", function() { - this.text.text(this.z); - }); - } - -}); - -// Tile components -Crafty.c("Tile",{ - // Tile properties - tile_data: null, // The tile definition - tile_meta: null, // The tile meta data - tile_p: null, // The tile position - - show: function(){ - this.visible = true; - }, - hide: function(){ - this.visible = false; - }, - - // Set up functions - tile: function(_tile, _x, _y, mapwidth, mapheight) { - this.mapwidth = mapwidth; - this.mapheight = mapheight; - this.get_def(_tile, _x, _y); - - // Check stuff - if (!this.tile_data) - return null; - - // Load required components - this.addComponent(this.require()); - - // Set position - var z_shift = this.tile_data.z_shift; - if (!z_shift) - z_shift = 0; - this.attr({ - x: (this.tile_p.x * 64) - 10, - y: (this.tile_p.y * 64) - 10, - z: (_x + (mapheight - _y) * mapwidth) * 2 + z_shift - }); - - this.bind("move",function() { - var z_shift = this.tile_data.z_shift; - if (!z_shift) - z_shift = 0; - this.attr({z: Math.round(((this.x + 10) / 64 + (this.mapheight - (this.y + 10) / 65) * this.mapwidth) * 2 + z_shift)}); - }); - - // Do draw type - this.addComponent("Tile" + this.tile_data.drawtype); - - - // Init physics - if (this.tile_meta && this.tile_meta.visible == false) { - this.hide(); - } else { - if (this.init_physics) - this.init_physics(); - } - - // Run function, if needed - if ((game.player && this.tile_data.init) || this.tile_data.init_req) - if (this.tile_data.init(this)==false) - return null; - - return this; - }, - require: function(){ - var def = "2D, drawmode, LayerDebug"; - // Extra components - if (this.tile_data.c) - def += ", "+this.tile_data.c; - - // Standard components - if (this.tile_data.physics) - def += ", TilePhysics"; - - return def; - }, - get_def: function(_tile,_x,_y){ - var tile; - - if (typeof(_tile) == "string"){ - tile=_tile; - this.tile_meta = {node:tile}; - }else{ - tile=_tile.node; - this.tile_meta = _tile; - } - - this.tile_data = define._bloc[tile]; - - if (!this.tile_data && define._alias[tile]){ - this.tile_meta.node = define._alias[tile]; - this.tile_data = define._bloc[define._alias[tile]]; - } - - // Give the position - this.tile_p = { - x:_x, - y:_y - }; - } -}); - -// THESE DEFINE BUILT IN TILE DRAW TYPES -// ------------------------------------- -// Drawtypes: -// * Tile - Adds a sprite that fits behind. -// * Block - Does above and makes a perspective block. -// * Anim - Defines an animated sprite. -// ------------------------------------- - -Crafty.c("TileTile",{ - spritemap: null, - init: function(){ - if (this.tile_data.tile && this.tile_data.tile.tile) - this.spritemap = this.tile_data.tile.tile; - else - this.spritemap = "default"; - - if (this.tile_data.tile && this.tile_data.tile.ani) { - this.applyAnimation(this.tile_data.tile, this); - }else{ - this.requires("Sprite"); - this.addComponent(this.spritemap); - this.sprite(this.tile_data.tile.x, this.tile_data.tile.y, 80, 80); - this.crop(0, 0, 80, 80); - } - - if (game.is_editor && this.tile_data.drawtype=="Block") - this.visible = false; - - return this; - }, - applyAnimation: function(tile_data, sprite){ - sprite.requires("SpriteAnimation"); - sprite.addComponent(this.spritemap); - var frames = []; - if (tile_data.ani.frames) { - frames = tile_data.ani.frames; - } else { - for (var i = 0; i < tile_data.ani.l; i++) { - frames.push([tile_data.x + i, tile_data.y]); - } - } - sprite.reel("normal", tile_data.ani.dur, frames); - sprite.animate("normal", -1); - } -}); - -Crafty.c("TileBlock",{ - front: null, - init: function(){ - this.addComponent("TileTile"); - this.front = Crafty.e("2D, drawmode"); - if (this.tile_data.tile && this.tile_data.tile.ani) - this.applyAnimation(this.tile_data.tile, this.front); - else{ - this.front.requires("Sprite"); - this.front.addComponent(this.spritemap); - this.front.sprite(this.tile_data.tile.x, this.tile_data.tile.y, 80, 80); - } - function getOrDef(one, two){ - if (one!=null) - return one; - else - return two - } - var height = getOrDef(this.tile_data.top, 15); - var right = getOrDef(this.tile_data.right, 64); - var bottom = getOrDef(this.tile_data.bottom, 80); - this.front.crop(0, height, right, bottom - height); - this.front.attr({ - x: (this.tile_p.x*64)-10, - y: (this.tile_p.y*64)-10+height, - z: 1000 - }); - this.attach(this.front); - return this; - }, - show: function(){ - this.visible = true; - this.front.visible = true; - }, - hide: function(){ - this.visible = false; - this.front.visible = false; - }, -}); - -Crafty.c("TilePhysics",{ - _physics: null, - init_physics: function(){ - // Get physics object def - this._physics = this.tile_data.physics; - - if (!this._physics.isSensor){ - this.addComponent("Obstacle"); - } - - - this.addComponent("Box2D"); - - - // Create physics object, if not defined - if (!this._physics) - return; - - // Set body type, if not defined - if (!this._physics.bodyType) - this._physics.bodyType = "static"; - - // Set shape, if not defined - if (!this._physics.shape) - this._physics.shape = [[10,10],[72,10],[72,72],[10,72]]; - - // Add Box2D physics, if needed - if (this.box2d) - this.box2d(this._physics,true); - - return this; - } -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +function Map(){ + return { + tiles: null, + map_data: null, + load: function(data){ + if (!data){ + throw("MapNotFound"); + return; + } + + this.tiles = []; + this.map_data = data; + + for (var y = data.map.length-1; y >= 0; y--) { + this.tiles[y] = []; + for (var x = 0; x < data.map[y].length; x++) { + if (data.map[y][x] != ''){ + this.tiles[y][x] = Crafty.e("2D, Tile") + .tile(data.map[y][x],x,y,data.width,data.height); + }else{ + this.tiles[y][x] = null; + } + } + } + + if (game.player){ + game.player.newSpawn(data.spawn); + game.player.attr({x: data.spawn.x*64+15,y: data.spawn.y*64+25}); + } + + if (this.map_data.help) + this.show_bubble(this.map_data.help[0]); + }, + get: function(x,y){ + return this.tiles[y][x]; + }, + set: function(x,y,data){ + while (y>=this.tiles.length){ + this.tiles.push([]); + } + while (x>=this.tiles[y].length){ + this.tiles[y].push(null); + } + if (this.tiles[y][x]){ + this.tiles[y][x].destroy(); + this.tiles[y][x] = null; + } + if (data != ''){ + this.tiles[y][x] = Crafty.e("Tile").tile(data,x,y,this.map_data.width,this.map_data.height); + }else{ + this.tiles[y][x] = null; + } + //this.debug(); + }, + debug: function(){ + var res = ""; + for (var y=0;y w) + w = this.tiles[y].length; + } + this.map_data.width = w; + this.map_data.height = h; + }, + getCakes: function(){ + var c = 0; + for (var y=0;y one.x + one.w || + other.x + other.w < one.x || + other.y > one.y + one.h || + other.y + other.h < one.y + ); + }; + + var distance = Math.sqrt( Math.pow(from.x - to.x, 2) + Math.pow(from.y - to.y, 2) ); + var direction = Math.atan((to.y - from.y) / (to.x - from.x)); + for (var i = 0; i < distance; i += step){ + var pos = { + x: from.x + Math.cos(direction) * i, + y: from.y + Math.sin(direction) * i, + w: 27, + h: 29 + }; + if (interRect(rect, pos)) + return true; + } + if (interRect(rect, {x: to.x, y: to.y, w: 27, h: 29})) + return true; + + return false; + }, + show_bubble: function(data){ + Crafty.e("Bubble_E").bubble(data); + } + }; +}; + +var BUBBLES = 0; +Crafty.c("Bubble_E",{ + init: function(){ + this.bub_id = BUBBLES; + BUBBLES = BUBBLES + 1; + }, + bubble: function(data){ + if (data.at){ + this.requires("2D, DOM, bubble, Text"); + this.text(data.msg); + this.attr({ + x: data.at.x * 64, + y: data.at.y * 64 + 10, + z: 1000 + }); + if (data.behind) + this.attr({z: 0}); + if (data.at.w) + this.attr({w: data.at.w}); + if (data.at.h) + this.attr({h: data.at.h}); + + }else{ + $("#bubble").remove(); + $("body").append("
" + data.msg + "
"); + if (data.behind) + $("#bubble").css("z-index", "0"); + } + } + +}); + +Crafty.c("LayerDebug", { + init: function() { + return; + this.text = Crafty.e("2D, DOM, Text") + .attr({x: -40, y: 40, w: 64, z: 1999}) + .textFont({ family: 'Arial', size: '10px'}) + .css("text-align", "center") + .text(this.z); + this.attach(this.text); + + this.bind("EnterFrame", function() { + this.text.text(this.z); + }); + } + +}); + +// Tile components +Crafty.c("Tile",{ + // Tile properties + tile_data: null, // The tile definition + tile_meta: null, // The tile meta data + tile_p: null, // The tile position + + show: function(){ + this.visible = true; + }, + hide: function(){ + this.visible = false; + }, + + // Set up functions + tile: function(_tile, _x, _y, mapwidth, mapheight) { + this.mapwidth = mapwidth; + this.mapheight = mapheight; + this.get_def(_tile, _x, _y); + + // Check stuff + if (!this.tile_data) + return null; + + // Load required components + this.addComponent(this.require()); + + // Set position + var z_shift = this.tile_data.z_shift; + if (!z_shift) + z_shift = 0; + this.attr({ + x: (this.tile_p.x * 64) - 10, + y: (this.tile_p.y * 64) - 10, + z: (_x + (mapheight - _y) * mapwidth) * 2 + z_shift + }); + + this.bind("move",function() { + var z_shift = this.tile_data.z_shift; + if (!z_shift) + z_shift = 0; + this.attr({z: Math.round(((this.x + 10) / 64 + (this.mapheight - (this.y + 10) / 65) * this.mapwidth) * 2 + z_shift)}); + }); + + // Do draw type + this.addComponent("Tile" + this.tile_data.drawtype); + + + // Init physics + if (this.tile_meta && this.tile_meta.visible == false) { + this.hide(); + } else { + if (this.init_physics) + this.init_physics(); + } + + // Run function, if needed + if ((game.player && this.tile_data.init) || this.tile_data.init_req) + if (this.tile_data.init(this)==false) + return null; + + return this; + }, + require: function(){ + var def = "2D, drawmode, LayerDebug"; + // Extra components + if (this.tile_data.c) + def += ", "+this.tile_data.c; + + // Standard components + if (this.tile_data.physics) + def += ", TilePhysics"; + + return def; + }, + get_def: function(_tile,_x,_y){ + var tile; + + if (typeof(_tile) == "string"){ + tile=_tile; + this.tile_meta = {node:tile}; + }else{ + tile=_tile.node; + this.tile_meta = _tile; + } + + this.tile_data = define._bloc[tile]; + + if (!this.tile_data && define._alias[tile]){ + this.tile_meta.node = define._alias[tile]; + this.tile_data = define._bloc[define._alias[tile]]; + } + + // Give the position + this.tile_p = { + x:_x, + y:_y + }; + } +}); + +// THESE DEFINE BUILT IN TILE DRAW TYPES +// ------------------------------------- +// Drawtypes: +// * Tile - Adds a sprite that fits behind. +// * Block - Does above and makes a perspective block. +// * Anim - Defines an animated sprite. +// ------------------------------------- + +Crafty.c("TileTile",{ + spritemap: null, + init: function(){ + if (this.tile_data.tile && this.tile_data.tile.tile) + this.spritemap = this.tile_data.tile.tile; + else + this.spritemap = "default"; + + if (this.tile_data.tile && this.tile_data.tile.ani) { + this.applyAnimation(this.tile_data.tile, this); + }else{ + this.requires("Sprite"); + this.addComponent(this.spritemap); + this.sprite(this.tile_data.tile.x, this.tile_data.tile.y, 80, 80); + this.crop(0, 0, 80, 80); + } + + if (game.is_editor && this.tile_data.drawtype=="Block") + this.visible = false; + + return this; + }, + applyAnimation: function(tile_data, sprite){ + sprite.requires("SpriteAnimation"); + sprite.addComponent(this.spritemap); + var frames = []; + if (tile_data.ani.frames) { + frames = tile_data.ani.frames; + } else { + for (var i = 0; i < tile_data.ani.l; i++) { + frames.push([tile_data.x + i, tile_data.y]); + } + } + sprite.reel("normal", tile_data.ani.dur, frames); + sprite.animate("normal", -1); + } +}); + +Crafty.c("TileBlock",{ + front: null, + init: function(){ + this.addComponent("TileTile"); + this.front = Crafty.e("2D, drawmode"); + if (this.tile_data.tile && this.tile_data.tile.ani) + this.applyAnimation(this.tile_data.tile, this.front); + else{ + this.front.requires("Sprite"); + this.front.addComponent(this.spritemap); + this.front.sprite(this.tile_data.tile.x, this.tile_data.tile.y, 80, 80); + } + function getOrDef(one, two){ + if (one!=null) + return one; + else + return two + } + var height = getOrDef(this.tile_data.top, 15); + var right = getOrDef(this.tile_data.right, 64); + var bottom = getOrDef(this.tile_data.bottom, 80); + this.front.crop(0, height, right, bottom - height); + this.front.attr({ + x: (this.tile_p.x*64)-10, + y: (this.tile_p.y*64)-10+height, + z: 1000 + }); + this.attach(this.front); + return this; + }, + show: function(){ + this.visible = true; + this.front.visible = true; + }, + hide: function(){ + this.visible = false; + this.front.visible = false; + }, +}); + +Crafty.c("TilePhysics",{ + _physics: null, + init_physics: function(){ + // Get physics object def + this._physics = this.tile_data.physics; + + if (!this._physics.isSensor){ + this.addComponent("Obstacle"); + } + + + this.addComponent("Box2D"); + + + // Create physics object, if not defined + if (!this._physics) + return; + + // Set body type, if not defined + if (!this._physics.bodyType) + this._physics.bodyType = "static"; + + // Set shape, if not defined + if (!this._physics.shape) + this._physics.shape = [[10,10],[72,10],[72,72],[10,72]]; + + // Add Box2D physics, if needed + if (this.box2d) + this.box2d(this._physics,true); + + return this; + } +}); diff --git a/assets/player.js b/assets/player.js index 2005d4c..b2d3776 100644 --- a/assets/player.js +++ b/assets/player.js @@ -1,335 +1,335 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -var FACING_RIGHT = 0; -var FACING_LEFT = 1; -var FACING_FORWARD = 2; -var PLAYER_Z = 700; - -// Player component -// Handles player related stuff -Crafty.c("Player",{ - pbody: null, - deadbody: null, - lastSpawn: {x:1,y:1}, - pulling: null, - head: null, - pbody: null, - foot: null, - left_hand: null, - right_hand: null, - facing: FACING_RIGHT, - lock_turn: 0, - health: 10, - freeze: false, - data: { - head: 'default', - body: 'default' - }, - hit: function(amt){ - if (this.health == 0 && this.dstart){ - return; - } - - this.health -= amt; - - var f = $("#flash"); - f.show(); - f.fadeOut(); - - if (this.health <= 0){ - this.kill(); - } - }, - kill: function(){ - if (this.health == 0 && this.dstart){ - return; - } - console.log("Player has died!"); - Crafty.trigger("PlayerDeath", null); - this.head.visible = false; - this.pbody.visible = false; - this.deadbody.visible = true; - $(".DeadPlayer").show(); - this.health = 0; - this.freeze = true; - this.dstart = new Date().getTime(); - this.body.SetAwake(false); - }, - revive: function(){ - console.log("Reviving player"); - this.goto(this.lastSpawn); - this.attr({x: this.body.GetPosition().x, y: this.body.GetPosition().y}); - this.head.visible = true; - this.pbody.visible = true; - this.deadbody.visible = false; - $(".DeadPlayer").hide(); - setTimeout(function(){ - console.log("Unfrozen"); - game.player.health = 10; - game.player.freeze = false; - game.player.body.SetAwake(true); - }, 10); - }, - goto: function(pos){ - console.log("Going to tile ("+pos.x+","+pos.y+")"); - this.body.SetPosition({x: pos.x,y: pos.y}); - this.body.SetAwake(true); - }, - newSpawn: function(pos){ - console.log("Last spawn position changed"); - this.lastSpawn = pos; - }, - init: function(){ - this.requires("Box2D"); - return this; - }, - player: function(){ - // Set up physics - this.attr({w:20,h:46,z:PLAYER_Z}); - - // Create body parts - this.head = Crafty.e("2D, drawmode, SpriteAnimation, PlayerHead") - .attr({x:3,z: PLAYER_Z + 1}); - this.pbody = Crafty.e("2D, drawmode, SpriteAnimation, PlayerBody") - .attr({y:8,z: PLAYER_Z}); - this.deadbody = Crafty.e("2D, drawmode, SpriteAnimation, DeadPlayer"); - this.deadbody.attr({y:8,x:-2,z: PLAYER_Z}); - - // Attach body parts - this.attach(this.head); - this.attach(this.pbody); - this.attach(this.deadbody); - this.deadbody.visible=false; - $(".DeadPlayer").hide(); - - // Bind to events - /*this.head.bind("NewDirection",function (direction) { - if (direction.x < 0) { - if (!this.isPlaying("walk")) - this.stop().animate("walk", 10, -1); - } - if (direction.x > 0 ) { - if (!this.isPlaying("walk")) - this.stop().animate("walk", 10, -1); - } - if(!direction.x && !direction.y) { - this.stop(); - } - });*/ - this.bind("EnterFrame",this._enterframe); - this.bind("KeyDown", function(e) { - if (!this.body || this.freeze) - return; - - // Punch - if (e.key == Crafty.keys.K) { - if (this.facing == FACING_RIGHT) { - var contact = this.contactWithFixture("crushable", this.right_hand); - if (contact) - contact[0].obj.crush(); - } else if (this.facing == FACING_LEFT) { - var contact = this.contactWithFixture("crushable", this.left_hand); - if (contact) - contact[0].obj.crush(); - } - } - - // Use - if (e.key == Crafty.keys.E) { - if (this.facing == FACING_RIGHT) { - var contact = this.contactWithFixture("usable", this.right_hand); - if (contact) { - Crafty.trigger("using", contact[0].obj); - contact[0].obj.use(); - } - } else if (this.facing == FACING_LEFT) { - var contact = this.contactWithFixture("usable", this.left_hand); - if (contact) - contact[0].obj.use(); - } - } - }); - - return this; - }, - _enterframe: function() { - // Progress to next level - if (game.inventory.cake >= map.map_data.cakes && !game.switching){ - game.switching = true; - setTimeout(function(){ - game.switching = false; - game.next_map = define._map[map.map_data.id + 1]; - - if (game.next_map) - Crafty.scene("play"); - else - Crafty.scene("menu"); - }, 2000); - return; - } - - // Die and revive - if (this.health <= 0){ - if (!this.dstart) - this.kill(); - - if (new Date().getTime() > this.dstart + 500) - this.revive(); - return; - } - if (!this.body || this.freeze) - return; - - // Die if falling too far - if (this.y > (map.map_data.height + 5)* 64){ - this.kill(); - return; - } - this.update_player(); - }, - update_player: function() { - assert(this.lock_turn >= 0); - - var on_ladder = (this.contact("Ladder"))?true:false; - var up_key = (Crafty.keydown[Crafty.keys['W']] || Crafty.keydown[Crafty.keys['UP_ARROW']] || Crafty.keydown[Crafty.keys['SPACE']]); - var left_key = (Crafty.keydown[Crafty.keys['A']] || Crafty.keydown[Crafty.keys['LEFT_ARROW']]); - var right_key = (Crafty.keydown[Crafty.keys['D']] || Crafty.keydown[Crafty.keys['RIGHT_ARROW']]); - - // Physics - var vvel = 3.8; - - // Ladder physics - if (on_ladder) { - this.body.ApplyForce(new b2Vec2(0, -(9.81 * this.body.GetMass())), this.body.GetPosition()); - this.body.SetLinearDamping(10); - vvel = 10; - if ((Crafty.keydown[Crafty.keys['S']] || Crafty.keydown[Crafty.keys['DOWN_ARROW']])){ - this.body.ApplyImpulse(new b2Vec2(0, 0.5), this.body.GetPosition()); - } - if (up_key) - this.body.ApplyImpulse(new b2Vec2(0, -0.7), this.body.GetPosition()); - } else { - this.body.SetLinearDamping(0.5); - - // Handle Jumping - var on_ground = (this.contactWithFixture("Obstacle", this.foot)) ? true : false; - if (up_key && on_ground) - this.body.ApplyImpulse(new b2Vec2(0,-0.5), this.body.GetPosition()); - } - - // Walk left - if (left_key) { - if (this.lock_turn == 0) - this.facing = FACING_LEFT; - this.body.ApplyForce(new b2Vec2(-vvel, 0), this.body.GetPosition()); - } else if (right_key) { - if (this.lock_turn == 0) - this.facing = FACING_RIGHT; - this.body.ApplyForce(new b2Vec2(vvel, 0), this.body.GetPosition()); - } - }, - physics: function() { - this.box2d({ - bodyType: "dynamic", - density: 1, - shape: [[0,0],[27,0],[27,29],[0,29]] - },true); - this.foot = this.addSensor([[9,30],[20,30],[20,33],[9,33]]); - this.left_hand = this.addSensor([[-5,10],[0,10],[0,20],[-5,20]]); - var wid = 27; // width of character - this.right_hand = this.addSensor([[wid,10],[wid+5,10],[wid+5,20],[wid,20]]); - return this; - }, - addSensor: function(loc) { - this.addFixture({ - bodyType: 'static', - shape: loc, - isSensor: true - }); - return this.fixtures[this.fixtures.length - 1]; - } -}); - -Crafty.c("PickUp",{ - type: null, - amount: null, - count: 0, - init: function(){ - }, - PickUp: function(type,amount){ - this.type = type; - this.amount = amount; - this.count = 0; - this.bind("EnterFrame",this._enterframe); - }, - _enterframe: function(){ - this.count += 1; - if ( this.count > 2 ){ - this.count = 0; - var now_pos = {x: game.player.x, y: game.player.y, w: 27, h: 29}; - if (!this.last_pos){ - this.last_pos = now_pos; - return; - } - if ( map.raycast_player(this.last_pos, now_pos, {x: this.x+20, y: this.y+30, w: 30, h: 40}, 2) ){ - this.destroy(); - if ( game.inventory[this.type] ) - game.inventory[this.type]+=this.amount; - else - game.inventory[this.type]=this.amount; - - console.log(this.amount+"x "+this.type+" added to the Inventory"); - Crafty.trigger("PickUp",{type:this.type,amount:this.amount}); - if (this.tile_data.onPickUp){ - this.tile_data.onPickUp(this); - } - } - this.last_pos = now_pos; - } - } -}); - -Crafty.c("Flag",{ - type: null, - amount: null, - count: 0, - init: function(){ - this.count = 0; - this.triggered = false; - this.bind("EnterFrame",this._enterframe); - this.bind("reset_flags", function(){ - if (this.tile_data.onFlagReset) - this.tile_data.onFlagReset(this); - - this.triggered = false; - }); - }, - _enterframe: function(){ - if (this.triggered) - return; - this.count += 1; - if ( this.count > 2 ){ - this.count = 0; - var now_pos = {x: game.player.x, y: game.player.y, w: 27, h: 29}; - if ( !this.last_pos ){ - this.last_pos = now_pos; - return; - } - if ( map.raycast_player(this.last_pos, now_pos, {x: this.x+10, y: this.y+10, w: 62, h: 62}, 2) ){ - Crafty.trigger("reset_flags"); - - game.player.newSpawn({x: this.tile_p.x, y: this.tile_p.y}); - - if (this.tile_data.onFlag) - this.tile_data.onFlag(this); - - this.triggered = true; - } - - } - } -}); +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +var FACING_RIGHT = 0; +var FACING_LEFT = 1; +var FACING_FORWARD = 2; +var PLAYER_Z = 700; + +// Player component +// Handles player related stuff +Crafty.c("Player",{ + pbody: null, + deadbody: null, + lastSpawn: {x:1,y:1}, + pulling: null, + head: null, + pbody: null, + foot: null, + left_hand: null, + right_hand: null, + facing: FACING_RIGHT, + lock_turn: 0, + health: 10, + freeze: false, + data: { + head: 'default', + body: 'default' + }, + hit: function(amt){ + if (this.health == 0 && this.dstart){ + return; + } + + this.health -= amt; + + var f = $("#flash"); + f.show(); + f.fadeOut(); + + if (this.health <= 0){ + this.kill(); + } + }, + kill: function(){ + if (this.health == 0 && this.dstart){ + return; + } + console.log("Player has died!"); + Crafty.trigger("PlayerDeath", null); + this.head.visible = false; + this.pbody.visible = false; + this.deadbody.visible = true; + $(".DeadPlayer").show(); + this.health = 0; + this.freeze = true; + this.dstart = new Date().getTime(); + this.body.SetAwake(false); + }, + revive: function(){ + console.log("Reviving player"); + this.goto(this.lastSpawn); + this.attr({x: this.body.GetPosition().x, y: this.body.GetPosition().y}); + this.head.visible = true; + this.pbody.visible = true; + this.deadbody.visible = false; + $(".DeadPlayer").hide(); + setTimeout(function(){ + console.log("Unfrozen"); + game.player.health = 10; + game.player.freeze = false; + game.player.body.SetAwake(true); + }, 10); + }, + goto: function(pos){ + console.log("Going to tile ("+pos.x+","+pos.y+")"); + this.body.SetPosition({x: pos.x,y: pos.y}); + this.body.SetAwake(true); + }, + newSpawn: function(pos){ + console.log("Last spawn position changed"); + this.lastSpawn = pos; + }, + init: function(){ + this.requires("Box2D"); + return this; + }, + player: function(){ + // Set up physics + this.attr({w:20,h:46,z:PLAYER_Z}); + + // Create body parts + this.head = Crafty.e("2D, drawmode, SpriteAnimation, PlayerHead") + .attr({x:3,z: PLAYER_Z + 1}); + this.pbody = Crafty.e("2D, drawmode, SpriteAnimation, PlayerBody") + .attr({y:8,z: PLAYER_Z}); + this.deadbody = Crafty.e("2D, drawmode, SpriteAnimation, DeadPlayer"); + this.deadbody.attr({y:8,x:-2,z: PLAYER_Z}); + + // Attach body parts + this.attach(this.head); + this.attach(this.pbody); + this.attach(this.deadbody); + this.deadbody.visible=false; + $(".DeadPlayer").hide(); + + // Bind to events + /*this.head.bind("NewDirection",function (direction) { + if (direction.x < 0) { + if (!this.isPlaying("walk")) + this.stop().animate("walk", 10, -1); + } + if (direction.x > 0 ) { + if (!this.isPlaying("walk")) + this.stop().animate("walk", 10, -1); + } + if(!direction.x && !direction.y) { + this.stop(); + } + });*/ + this.bind("EnterFrame",this._enterframe); + this.bind("KeyDown", function(e) { + if (!this.body || this.freeze) + return; + + // Punch + if (e.key == Crafty.keys.K) { + if (this.facing == FACING_RIGHT) { + var contact = this.contactWithFixture("crushable", this.right_hand); + if (contact) + contact[0].obj.crush(); + } else if (this.facing == FACING_LEFT) { + var contact = this.contactWithFixture("crushable", this.left_hand); + if (contact) + contact[0].obj.crush(); + } + } + + // Use + if (e.key == Crafty.keys.E) { + if (this.facing == FACING_RIGHT) { + var contact = this.contactWithFixture("usable", this.right_hand); + if (contact) { + Crafty.trigger("using", contact[0].obj); + contact[0].obj.use(); + } + } else if (this.facing == FACING_LEFT) { + var contact = this.contactWithFixture("usable", this.left_hand); + if (contact) + contact[0].obj.use(); + } + } + }); + + return this; + }, + _enterframe: function() { + // Progress to next level + if (game.inventory.cake >= map.map_data.cakes && !game.switching){ + game.switching = true; + setTimeout(function(){ + game.switching = false; + game.next_map = define._map[map.map_data.id + 1]; + + if (game.next_map) + Crafty.scene("play"); + else + Crafty.scene("menu"); + }, 2000); + return; + } + + // Die and revive + if (this.health <= 0){ + if (!this.dstart) + this.kill(); + + if (new Date().getTime() > this.dstart + 500) + this.revive(); + return; + } + if (!this.body || this.freeze) + return; + + // Die if falling too far + if (this.y > (map.map_data.height + 5)* 64){ + this.kill(); + return; + } + this.update_player(); + }, + update_player: function() { + assert(this.lock_turn >= 0); + + var on_ladder = (this.contact("Ladder"))?true:false; + var up_key = (Crafty.keydown[Crafty.keys['W']] || Crafty.keydown[Crafty.keys['UP_ARROW']] || Crafty.keydown[Crafty.keys['SPACE']]); + var left_key = (Crafty.keydown[Crafty.keys['A']] || Crafty.keydown[Crafty.keys['LEFT_ARROW']]); + var right_key = (Crafty.keydown[Crafty.keys['D']] || Crafty.keydown[Crafty.keys['RIGHT_ARROW']]); + + // Physics + var vvel = 3.8; + + // Ladder physics + if (on_ladder) { + this.body.ApplyForce(new b2Vec2(0, -(9.81 * this.body.GetMass())), this.body.GetPosition()); + this.body.SetLinearDamping(10); + vvel = 10; + if ((Crafty.keydown[Crafty.keys['S']] || Crafty.keydown[Crafty.keys['DOWN_ARROW']])){ + this.body.ApplyImpulse(new b2Vec2(0, 0.5), this.body.GetPosition()); + } + if (up_key) + this.body.ApplyImpulse(new b2Vec2(0, -0.7), this.body.GetPosition()); + } else { + this.body.SetLinearDamping(0.5); + + // Handle Jumping + var on_ground = (this.contactWithFixture("Obstacle", this.foot)) ? true : false; + if (up_key && on_ground) + this.body.ApplyImpulse(new b2Vec2(0,-0.5), this.body.GetPosition()); + } + + // Walk left + if (left_key) { + if (this.lock_turn == 0) + this.facing = FACING_LEFT; + this.body.ApplyForce(new b2Vec2(-vvel, 0), this.body.GetPosition()); + } else if (right_key) { + if (this.lock_turn == 0) + this.facing = FACING_RIGHT; + this.body.ApplyForce(new b2Vec2(vvel, 0), this.body.GetPosition()); + } + }, + physics: function() { + this.box2d({ + bodyType: "dynamic", + density: 1, + shape: [[0,0],[27,0],[27,29],[0,29]] + },true); + this.foot = this.addSensor([[9,30],[20,30],[20,33],[9,33]]); + this.left_hand = this.addSensor([[-5,10],[0,10],[0,20],[-5,20]]); + var wid = 27; // width of character + this.right_hand = this.addSensor([[wid,10],[wid+5,10],[wid+5,20],[wid,20]]); + return this; + }, + addSensor: function(loc) { + this.addFixture({ + bodyType: 'static', + shape: loc, + isSensor: true + }); + return this.fixtures[this.fixtures.length - 1]; + } +}); + +Crafty.c("PickUp",{ + type: null, + amount: null, + count: 0, + init: function(){ + }, + PickUp: function(type,amount){ + this.type = type; + this.amount = amount; + this.count = 0; + this.bind("EnterFrame",this._enterframe); + }, + _enterframe: function(){ + this.count += 1; + if ( this.count > 2 ){ + this.count = 0; + var now_pos = {x: game.player.x, y: game.player.y, w: 27, h: 29}; + if (!this.last_pos){ + this.last_pos = now_pos; + return; + } + if ( map.raycast_player(this.last_pos, now_pos, {x: this.x+20, y: this.y+30, w: 30, h: 40}, 2) ){ + this.destroy(); + if ( game.inventory[this.type] ) + game.inventory[this.type]+=this.amount; + else + game.inventory[this.type]=this.amount; + + console.log(this.amount+"x "+this.type+" added to the Inventory"); + Crafty.trigger("PickUp",{type:this.type,amount:this.amount}); + if (this.tile_data.onPickUp){ + this.tile_data.onPickUp(this); + } + } + this.last_pos = now_pos; + } + } +}); + +Crafty.c("Flag",{ + type: null, + amount: null, + count: 0, + init: function(){ + this.count = 0; + this.triggered = false; + this.bind("EnterFrame",this._enterframe); + this.bind("reset_flags", function(){ + if (this.tile_data.onFlagReset) + this.tile_data.onFlagReset(this); + + this.triggered = false; + }); + }, + _enterframe: function(){ + if (this.triggered) + return; + this.count += 1; + if ( this.count > 2 ){ + this.count = 0; + var now_pos = {x: game.player.x, y: game.player.y, w: 27, h: 29}; + if ( !this.last_pos ){ + this.last_pos = now_pos; + return; + } + if ( map.raycast_player(this.last_pos, now_pos, {x: this.x+10, y: this.y+10, w: 62, h: 62}, 2) ){ + Crafty.trigger("reset_flags"); + + game.player.newSpawn({x: this.tile_p.x, y: this.tile_p.y}); + + if (this.tile_data.onFlag) + this.tile_data.onFlag(this); + + this.triggered = true; + } + + } + } +}); diff --git a/assets/style.css b/assets/style.css index f702102..da0313c 100644 --- a/assets/style.css +++ b/assets/style.css @@ -1,159 +1,160 @@ -/* -* part of PUZZLE PLATFORMER -* by rubenwardy (rubenwardy@gmail.com) -* Licensed under GNU GPL 3.0 or later. See LICENSE.txt -*/ - -body{ - margin: 0; - padding: 0; - font-family: "Arial",sans-serif; -} - -a{ - color: blue; -} - -div{ - image-rendering: -moz-crisp-edges; /* Firefox */ - image-rendering: -o-crisp-edges; /* Opera */ - image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */ - image-rendering: crisp-edges; - -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */ -} - -#panel { - position: fixed; - left: 0; - top: 0; - z-index: 10000; -} -#panel div{ - width: 128px; - margin: 1em; - border-radius: 5px; - background: rgba(255,255,255,0.3); - padding: 1em; - z-index: 1101; -} - -#tools ul{ - list-style: none; - padding: 0; - margin: 0; -} -#tools ul li a{ - display: block; - padding: 4px; - color: black; - text-decoration: underline; -} - -#tools ul li a:hover{ - background: rgba(255,255,255,0.5); -} - -.selected{ - color: blue !important; - padding: 4px 4px 4px 1.2em !important; -} - -#flash { - position: fixed; - display: none; - left: 0; - top: 0; - right: 0; - bottom: 0; - margin: 0; - padding: 0; - background: rgba(255,0,0,0.4); - z-index: 1100; -} - -#menu { - display: table; - position: fixed; - bottom: 35px; - left: 30%; - margin: 0; - padding: 0; - border-radius: 5px; - z-index: 2000; - list-style: none; -} - -#menu li { - display: table-cell; - width: 25%; - text-align: center; - padding: 0 10px 0 0; -} - -#menu li a { - background: rgba(255, 255, 255, 0.6); - display: block; - padding: 5px 15px 5px 15px; - text-decoration: none; - width: auto; - color: black; - cursor: pointer; - font-size: 150%; - border-radius: 5px; -} - -#menu li a:hover { - text-decoration: underline; - background: rgba(255, 255, 255, 0.75); -} - -.bubble{ - background: #d7bc7b; - border: 1px solid #ae965d; - font-size: 12px !important; - padding: 4px 7px 4px 7px; - position: fixed; - top: 50%; - left: 60%; - display: block; - width: auto; - height: auto !important; - color: white; - z-index: 10000; - text-align: center; -} - -#help { - position: fixed; - top: 10px; - left: 10px; - z-index: 2000; - background: rgba(255, 255, 255, 0.6); - padding: 1em; - border-radius: 5px; -} - -#level_select { - background: rgba(255, 255, 255, 0.8); - padding: 1em; - border-radius: 5px; - position: fixed; - margin: auto; - top: 100px; - z-index: 10000; -} - -#level_select li { - display: block; - padding: 2px; -} - -#level_select li a { - display: block; - padding: 10px; - border-radius: 5px; -} - -#level_select li a:hover { - background: rgba(255, 255, 255, 0.6); -} +/* +* part of PUZZLE PLATFORMER +* by rubenwardy (rubenwardy@gmail.com) +* Licensed under GNU GPL 3.0 or later. See LICENSE.txt +*/ + +body{ + margin: 0; + padding: 0; + font-family: "Arial",sans-serif; +} + +a{ + color: blue; +} + +div{ + image-rendering: -moz-crisp-edges; /* Firefox */ + image-rendering: -o-crisp-edges; /* Opera */ + image-rendering: -webkit-optimize-contrast;/* Webkit (non-standard naming) */ + image-rendering: crisp-edges; + -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */ +} + +#panel { + position: fixed; + left: 0; + top: 0; + z-index: 10000; +} +#panel div{ + width: 128px; + margin: 1em; + border-radius: 5px; + background: rgba(255,255,255,0.3); + padding: 1em; + z-index: 1101; +} + +#tools ul{ + list-style: none; + padding: 0; + margin: 0; +} +#tools ul li a{ + display: block; + padding: 4px; + color: black; + text-decoration: underline; +} + +#tools ul li a:hover{ + background: rgba(255,255,255,0.5); +} + +.selected{ + color: blue !important; + padding: 4px 4px 4px 1.2em !important; +} + +#flash { + position: fixed; + display: none; + left: 0; + top: 0; + right: 0; + bottom: 0; + margin: 0; + padding: 0; + background: rgba(255,0,0,0.4); + z-index: 1100; +} + +#menu { + display: table; + position: fixed; + bottom: 35px; + left: 30%; + margin: 0; + padding: 0; + border-radius: 5px; + z-index: 2000; + list-style: none; +} + +#menu li { + display: table-cell; + width: 25%; + text-align: center; + padding: 0 10px 0 0; +} + +#menu li a { + background: rgba(255, 255, 255, 0.6); + display: block; + padding: 5px 15px 5px 15px; + text-decoration: none; + width: auto; + color: black; + cursor: pointer; + font-size: 150%; + border-radius: 5px; +} + +#menu li a:hover { + text-decoration: underline; + background: rgba(255, 255, 255, 0.75); +} + +.bubble{ + background: #d7bc7b; + border: 1px solid #ae965d; + font-size: 12px !important; + padding: 4px 7px 4px 7px; + position: fixed; + top: 50%; + left: 60%; + display: block; + width: auto; + height: auto !important; + color: white; + z-index: 10000; + text-align: center; +} + +#help { + position: fixed; + top: 10px; + left: 10px; + z-index: 2000; + background: rgba(255, 255, 255, 0.6); + padding: 1em; + border-radius: 5px; +} + +#level_select { + background: rgba(255, 255, 255, 0.8); + padding: 1em; + border-radius: 5px; + position: fixed; + margin: auto; + top: 100px; + z-index: 10000; +} + +#level_select li { + display: block; + padding: 2px; +} + +#level_select li a { + display: block; + padding: 10px; + border-radius: 5px; + text-align: center; +} + +#level_select li a:hover { + background: rgba(255, 255, 255, 0.6); +} diff --git a/editor.html b/editor.html index 54b90a8..5993344 100644 --- a/editor.html +++ b/editor.html @@ -1,61 +1,61 @@ - - - - Puzzle Platform - - - - - - - - - - - - - - - - - -
-
Loading Engine...
-
-
- + + + + Puzzle Platform + + + + + + + + + + + + + + + + + +
+
Loading Engine...
+
+
+ diff --git a/index.html b/index.html index f09161e..87ed8cc 100644 --- a/index.html +++ b/index.html @@ -1,38 +1,38 @@ - - - - Puzzle Platform - - - - - - - - - - - - - - - - - - - -
-
Loading Engine...
-
-
- + + + + Puzzle Platform + + + + + + + + + + + + + + + + + + + +
+
Loading Engine...
+
+
+