├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── UPGRADE.md ├── bower.json ├── demo ├── MonthPicker.min.css ├── MonthPicker.min.js ├── examples.css ├── examples.js ├── images │ ├── bg_hr.png │ ├── blacktocat.png │ ├── icon.gif │ ├── icon_download.png │ ├── jquery-ui-month-picker-01.png │ └── sprite_download.png ├── index.html ├── params.json └── stylesheets │ ├── github-light.css │ ├── normalize.css │ └── stylesheet.css ├── gruntfile.js ├── package.json ├── src ├── MonthPicker.css └── MonthPicker.js └── test ├── test.css ├── test.html ├── test.js └── themes.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Node template 3 | # Logs 4 | logs 5 | *.log 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git 29 | node_modules/ 30 | bower_components/ 31 | 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "5.10.1" 4 | before_install: npm install -g grunt-cli 5 | install: npm install 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

The jQuery UI Month Picker

2 | 3 | [![Build Status](https://travis-ci.org/KidSysco/jquery-ui-month-picker.svg?branch=master)](https://travis-ci.org/KidSysco/jquery-ui-month-picker) 4 | [![Bower](https://img.shields.io/bower/v/jquery-ui-month-picker.svg)](https://github.com/KidSysco/jquery-ui-month-picker/wiki#installation) 5 | [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) 6 | 7 |

8 | jQuery UI Month Picker Home Page
9 | https://kidsysco.github.io/jquery-ui-month-picker/ 10 |

11 | 12 |

13 | Getting started and Documentation
14 | https://github.com/KidSysco/jquery-ui-month-picker/wiki 15 |

16 | 17 |

18 | jsFiddle with this Plugin
19 | http://jsfiddle.net/kidsysco/JeZap/ 20 |

21 | 22 |

23 | Lead Programmer
24 | Benjamin Albert 25 |

26 | 27 |

28 | Repo Maintenance and Gopher
29 | Ryan Segura 30 |

31 | -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | # 3.x Upgrade Guide 2 | 3 | Version 3.x features a redesigned Month Picker menu which: 4 | 5 | 1. Looks more consistent with [jQuery UI Datepicker](https://jqueryui.com/datepicker/). 6 | 2. Turns the Year title into a button which gives the user a "hint" about 7 | the Jump Years menu when they mouse over it. 8 | 3. Allows the user to return to the year they clicked Jump years at. 9 | 10 | See it for yourself at the [demo on JSFiddle](http://jsfiddle.net/kidsysco/JeZap/). 11 | 12 | An upgrade from an older version is simple, and in many cases only requires a new download. 13 | 14 | ## i18n property name changes 15 | If you changed out the buttons, labels or other text using the 16 | i18n support you should rename and translate `next5Years` to `next12Years` 17 | and `prev5Years` to `prev12Years`. 18 | 19 | You should also add the `backTo` property, which is used for the 20 | new *Back to 2016* button when the user enters the Jump Year menu. 21 | 22 | ## CSS changes 23 | Version 3.x uses `em` instead of `px` units. 24 | This means that the menu determines it's size according to the 25 | `body` element's `font-size`, instead of having a fixed width of `200px`. 26 | 27 | If you need to resize the menu, add this rule to your CSS: 28 | ``` 29 | /* Makes the Month Picker menu 20% bigger. */ 30 | .month-picker { 31 | font-size: 1.2em; 32 | } 33 | ``` 34 | 35 | Version 3.x removes: 36 | ``` 37 | .month-year-input { 38 | width: 60px; 39 | } 40 | ``` 41 | 42 | If you still want the plugin to implicitly resize the input fields it's applied to you must add this rule to your own CSS. 43 | 44 | If you explicitly defined a rule that reverts the effects of this rule, it's no longer necessary and it can be deleted. 45 | 46 | ## Markup changes 47 | If you've applied custom CSS to the Month Picker menu, please note that: 48 | 49 | The following elements were removed: 50 | ``` 51 | 52 |
53 | 54 | 55 |
56 | ``` 57 | They were replaces by ``. 58 | The `` tag is a [jQyery UI Button](https://jqueryui.com/button/). 59 | 60 | The following elements: 61 | ``` 62 | 235 |

236 | 237 |

Inline Menu Demonstration

238 |

239 | This demonstrates the Month Picker menu inlined in a div tag. 240 |

241 |

242 | 243 |

HTML 5 Month Input Type Support

244 |

245 | This demonstrates how the MonthPicker will work with the HTML 5 Month Input Type. View this section using 246 | Chrome to see Google's latest implementation in comparison. 247 |
248 |
Jquery UI Month Picker: 249 | 250 |
251 |
Chrome Month Picker: 252 | 253 |

254 | 255 |

.position() Integration Demonstration

256 |

257 |
This demonstrates the Month Picker integration with the optional .position() plugin. The menu should show on top of the input 258 | rather than below where the view would be obstructed. 259 |
260 |
Choose a month: 261 | 262 |

263 | 264 | 265 | 266 | 267 | 268 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /demo/params.json: -------------------------------------------------------------------------------- 1 | {"name":"jQuery UI Month Picker Plugin","tagline":"jQuery UI Month Picker Plugin","body":"### Welcome to GitHub Pages.\r\nThis automatic page generator is the easiest way to create beautiful pages for all of your projects. Author your page content here [using GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/), select a template crafted by a designer, and publish. After your page is generated, you can check out the new `gh-pages` branch locally. If you’re using GitHub Desktop, simply sync your repository and you’ll see the new branch.\r\n\r\n### Designer Templates\r\nWe’ve crafted some handsome templates for you to use. Go ahead and click 'Continue to layouts' to browse through them. You can easily go back to edit your page before publishing. After publishing your page, you can revisit the page generator and switch to another theme. Your Page content will be preserved.\r\n\r\n### Creating pages manually\r\nIf you prefer to not use the automatic generator, push a branch named `gh-pages` to your repository to create a page manually. In addition to supporting regular HTML content, GitHub Pages support Jekyll, a simple, blog aware static site generator. Jekyll makes it easy to create site-wide headers and footers without having to copy them across every page. It also offers intelligent blog support and other advanced templating features.\r\n\r\n### Authors and Contributors\r\nYou can @mention a GitHub username to generate a link to their profile. The resulting `` element will link to the contributor’s GitHub Profile. For example: In 2007, Chris Wanstrath (@defunkt), PJ Hyett (@pjhyett), and Tom Preston-Werner (@mojombo) founded GitHub.\r\n\r\n### Support or Contact\r\nHaving trouble with Pages? Check out our [documentation](https://help.github.com/pages) or [contact support](https://github.com/contact) and we’ll help you sort it out.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."} -------------------------------------------------------------------------------- /demo/stylesheets/github-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2014 GitHub Inc. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | */ 17 | 18 | .pl-c /* comment */ { 19 | color: #969896; 20 | } 21 | 22 | .pl-c1 /* constant, markup.raw, meta.diff.header, meta.module-reference, meta.property-name, support, support.constant, support.variable, variable.other.constant */, 23 | .pl-s .pl-v /* string variable */ { 24 | color: #0086b3; 25 | } 26 | 27 | .pl-e /* entity */, 28 | .pl-en /* entity.name */ { 29 | color: #795da3; 30 | } 31 | 32 | .pl-s .pl-s1 /* string source */, 33 | .pl-smi /* storage.modifier.import, storage.modifier.package, storage.type.java, variable.other, variable.parameter.function */ { 34 | color: #333; 35 | } 36 | 37 | .pl-ent /* entity.name.tag */ { 38 | color: #63a35c; 39 | } 40 | 41 | .pl-k /* keyword, storage, storage.type */ { 42 | color: #a71d5d; 43 | } 44 | 45 | .pl-pds /* punctuation.definition.string, string.regexp.character-class */, 46 | .pl-s /* string */, 47 | .pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */, 48 | .pl-sr /* string.regexp */, 49 | .pl-sr .pl-cce /* string.regexp constant.character.escape */, 50 | .pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */, 51 | .pl-sr .pl-sre /* string.regexp source.ruby.embedded */ { 52 | color: #183691; 53 | } 54 | 55 | .pl-v /* variable */ { 56 | color: #ed6a43; 57 | } 58 | 59 | .pl-id /* invalid.deprecated */ { 60 | color: #b52a1d; 61 | } 62 | 63 | .pl-ii /* invalid.illegal */ { 64 | background-color: #b52a1d; 65 | color: #f8f8f8; 66 | } 67 | 68 | .pl-sr .pl-cce /* string.regexp constant.character.escape */ { 69 | color: #63a35c; 70 | font-weight: bold; 71 | } 72 | 73 | .pl-ml /* markup.list */ { 74 | color: #693a17; 75 | } 76 | 77 | .pl-mh /* markup.heading */, 78 | .pl-mh .pl-en /* markup.heading entity.name */, 79 | .pl-ms /* meta.separator */ { 80 | color: #1d3e81; 81 | font-weight: bold; 82 | } 83 | 84 | .pl-mq /* markup.quote */ { 85 | color: #008080; 86 | } 87 | 88 | .pl-mi /* markup.italic */ { 89 | color: #333; 90 | font-style: italic; 91 | } 92 | 93 | .pl-mb /* markup.bold */ { 94 | color: #333; 95 | font-weight: bold; 96 | } 97 | 98 | .pl-md /* markup.deleted, meta.diff.header.from-file */ { 99 | background-color: #ffecec; 100 | color: #bd2c00; 101 | } 102 | 103 | .pl-mi1 /* markup.inserted, meta.diff.header.to-file */ { 104 | background-color: #eaffea; 105 | color: #55a532; 106 | } 107 | 108 | .pl-mdr /* meta.diff.range */ { 109 | color: #795da3; 110 | font-weight: bold; 111 | } 112 | 113 | .pl-mo /* meta.output */ { 114 | color: #1d3e81; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /demo/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v3.0.2 | MIT License | git.io/normalize */ 2 | 3 | /** 4 | * 1. Set default font family to sans-serif. 5 | * 2. Prevent iOS text size adjust after orientation change, without disabling 6 | * user zoom. 7 | */ 8 | 9 | html { 10 | font-family: sans-serif; /* 1 */ 11 | -ms-text-size-adjust: 100%; /* 2 */ 12 | -webkit-text-size-adjust: 100%; /* 2 */ 13 | } 14 | 15 | /** 16 | * Remove default margin. 17 | */ 18 | 19 | body { 20 | margin: 0; 21 | } 22 | 23 | /* HTML5 display definitions 24 | ========================================================================== */ 25 | 26 | /** 27 | * Correct `block` display not defined for any HTML5 element in IE 8/9. 28 | * Correct `block` display not defined for `details` or `summary` in IE 10/11 29 | * and Firefox. 30 | * Correct `block` display not defined for `main` in IE 11. 31 | */ 32 | 33 | article, 34 | aside, 35 | details, 36 | figcaption, 37 | figure, 38 | footer, 39 | header, 40 | hgroup, 41 | main, 42 | menu, 43 | nav, 44 | section, 45 | summary { 46 | display: block; 47 | } 48 | 49 | /** 50 | * 1. Correct `inline-block` display not defined in IE 8/9. 51 | * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. 52 | */ 53 | 54 | audio, 55 | canvas, 56 | progress, 57 | video { 58 | display: inline-block; /* 1 */ 59 | vertical-align: baseline; /* 2 */ 60 | } 61 | 62 | /** 63 | * Prevent modern browsers from displaying `audio` without controls. 64 | * Remove excess height in iOS 5 devices. 65 | */ 66 | 67 | audio:not([controls]) { 68 | display: none; 69 | height: 0; 70 | } 71 | 72 | /** 73 | * Address `[hidden]` styling not present in IE 8/9/10. 74 | * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. 75 | */ 76 | 77 | [hidden], 78 | template { 79 | display: none; 80 | } 81 | 82 | /* Links 83 | ========================================================================== */ 84 | 85 | /** 86 | * Remove the gray background color from active links in IE 10. 87 | */ 88 | 89 | a { 90 | background-color: transparent; 91 | } 92 | 93 | /** 94 | * Improve readability when focused and also mouse hovered in all browsers. 95 | */ 96 | 97 | a:active, 98 | a:hover { 99 | outline: 0; 100 | } 101 | 102 | /* Text-level semantics 103 | ========================================================================== */ 104 | 105 | /** 106 | * Address styling not present in IE 8/9/10/11, Safari, and Chrome. 107 | */ 108 | 109 | abbr[title] { 110 | border-bottom: 1px dotted; 111 | } 112 | 113 | /** 114 | * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. 115 | */ 116 | 117 | b, 118 | strong { 119 | font-weight: bold; 120 | } 121 | 122 | /** 123 | * Address styling not present in Safari and Chrome. 124 | */ 125 | 126 | dfn { 127 | font-style: italic; 128 | } 129 | 130 | /** 131 | * Address variable `h1` font-size and margin within `section` and `article` 132 | * contexts in Firefox 4+, Safari, and Chrome. 133 | */ 134 | 135 | h1 { 136 | font-size: 2em; 137 | margin: 0.67em 0; 138 | } 139 | 140 | /** 141 | * Address styling not present in IE 8/9. 142 | */ 143 | 144 | mark { 145 | background: #ff0; 146 | color: #000; 147 | } 148 | 149 | /** 150 | * Address inconsistent and variable font size in all browsers. 151 | */ 152 | 153 | small { 154 | font-size: 80%; 155 | } 156 | 157 | /** 158 | * Prevent `sub` and `sup` affecting `line-height` in all browsers. 159 | */ 160 | 161 | sub, 162 | sup { 163 | font-size: 75%; 164 | line-height: 0; 165 | position: relative; 166 | vertical-align: baseline; 167 | } 168 | 169 | sup { 170 | top: -0.5em; 171 | } 172 | 173 | sub { 174 | bottom: -0.25em; 175 | } 176 | 177 | /* Embedded content 178 | ========================================================================== */ 179 | 180 | /** 181 | * Remove border when inside `a` element in IE 8/9/10. 182 | */ 183 | 184 | img { 185 | border: 0; 186 | } 187 | 188 | /** 189 | * Correct overflow not hidden in IE 9/10/11. 190 | */ 191 | 192 | svg:not(:root) { 193 | overflow: hidden; 194 | } 195 | 196 | /* Grouping content 197 | ========================================================================== */ 198 | 199 | /** 200 | * Address margin not present in IE 8/9 and Safari. 201 | */ 202 | 203 | figure { 204 | margin: 1em 40px; 205 | } 206 | 207 | /** 208 | * Address differences between Firefox and other browsers. 209 | */ 210 | 211 | hr { 212 | box-sizing: content-box; 213 | height: 0; 214 | } 215 | 216 | /** 217 | * Contain overflow in all browsers. 218 | */ 219 | 220 | pre { 221 | overflow: auto; 222 | } 223 | 224 | /** 225 | * Address odd `em`-unit font size rendering in all browsers. 226 | */ 227 | 228 | code, 229 | kbd, 230 | pre, 231 | samp { 232 | font-family: monospace, monospace; 233 | font-size: 1em; 234 | } 235 | 236 | /* Forms 237 | ========================================================================== */ 238 | 239 | /** 240 | * Known limitation: by default, Chrome and Safari on OS X allow very limited 241 | * styling of `select`, unless a `border` property is set. 242 | */ 243 | 244 | /** 245 | * 1. Correct color not being inherited. 246 | * Known issue: affects color of disabled elements. 247 | * 2. Correct font properties not being inherited. 248 | * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. 249 | */ 250 | 251 | button, 252 | input, 253 | optgroup, 254 | select, 255 | textarea { 256 | color: inherit; /* 1 */ 257 | font: inherit; /* 2 */ 258 | margin: 0; /* 3 */ 259 | } 260 | 261 | /** 262 | * Address `overflow` set to `hidden` in IE 8/9/10/11. 263 | */ 264 | 265 | button { 266 | overflow: visible; 267 | } 268 | 269 | /** 270 | * Address inconsistent `text-transform` inheritance for `button` and `select`. 271 | * All other form control elements do not inherit `text-transform` values. 272 | * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. 273 | * Correct `select` style inheritance in Firefox. 274 | */ 275 | 276 | button, 277 | select { 278 | text-transform: none; 279 | } 280 | 281 | /** 282 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 283 | * and `video` controls. 284 | * 2. Correct inability to style clickable `input` types in iOS. 285 | * 3. Improve usability and consistency of cursor style between image-type 286 | * `input` and others. 287 | */ 288 | 289 | button, 290 | html input[type="button"], /* 1 */ 291 | input[type="reset"], 292 | input[type="submit"] { 293 | -webkit-appearance: button; /* 2 */ 294 | cursor: pointer; /* 3 */ 295 | } 296 | 297 | /** 298 | * Re-set default cursor for disabled elements. 299 | */ 300 | 301 | button[disabled], 302 | html input[disabled] { 303 | cursor: default; 304 | } 305 | 306 | /** 307 | * Remove inner padding and border in Firefox 4+. 308 | */ 309 | 310 | button::-moz-focus-inner, 311 | input::-moz-focus-inner { 312 | border: 0; 313 | padding: 0; 314 | } 315 | 316 | /** 317 | * Address Firefox 4+ setting `line-height` on `input` using `!important` in 318 | * the UA stylesheet. 319 | */ 320 | 321 | input { 322 | line-height: normal; 323 | } 324 | 325 | /** 326 | * It's recommended that you don't attempt to style these elements. 327 | * Firefox's implementation doesn't respect box-sizing, padding, or width. 328 | * 329 | * 1. Address box sizing set to `content-box` in IE 8/9/10. 330 | * 2. Remove excess padding in IE 8/9/10. 331 | */ 332 | 333 | input[type="checkbox"], 334 | input[type="radio"] { 335 | box-sizing: border-box; /* 1 */ 336 | padding: 0; /* 2 */ 337 | } 338 | 339 | /** 340 | * Fix the cursor style for Chrome's increment/decrement buttons. For certain 341 | * `font-size` values of the `input`, it causes the cursor style of the 342 | * decrement button to change from `default` to `text`. 343 | */ 344 | 345 | input[type="number"]::-webkit-inner-spin-button, 346 | input[type="number"]::-webkit-outer-spin-button { 347 | height: auto; 348 | } 349 | 350 | /** 351 | * 1. Address `appearance` set to `searchfield` in Safari and Chrome. 352 | * 2. Address `box-sizing` set to `border-box` in Safari and Chrome 353 | * (include `-moz` to future-proof). 354 | */ 355 | 356 | input[type="search"] { 357 | -webkit-appearance: textfield; /* 1 */ /* 2 */ 358 | box-sizing: content-box; 359 | } 360 | 361 | /** 362 | * Remove inner padding and search cancel button in Safari and Chrome on OS X. 363 | * Safari (but not Chrome) clips the cancel button when the search input has 364 | * padding (and `textfield` appearance). 365 | */ 366 | 367 | input[type="search"]::-webkit-search-cancel-button, 368 | input[type="search"]::-webkit-search-decoration { 369 | -webkit-appearance: none; 370 | } 371 | 372 | /** 373 | * Define consistent border, margin, and padding. 374 | */ 375 | 376 | fieldset { 377 | border: 1px solid #c0c0c0; 378 | margin: 0 2px; 379 | padding: 0.35em 0.625em 0.75em; 380 | } 381 | 382 | /** 383 | * 1. Correct `color` not being inherited in IE 8/9/10/11. 384 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 385 | */ 386 | 387 | legend { 388 | border: 0; /* 1 */ 389 | padding: 0; /* 2 */ 390 | } 391 | 392 | /** 393 | * Remove default vertical scrollbar in IE 8/9/10/11. 394 | */ 395 | 396 | textarea { 397 | overflow: auto; 398 | } 399 | 400 | /** 401 | * Don't inherit the `font-weight` (applied by a rule above). 402 | * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. 403 | */ 404 | 405 | optgroup { 406 | font-weight: bold; 407 | } 408 | 409 | /* Tables 410 | ========================================================================== */ 411 | 412 | /** 413 | * Remove most spacing between table cells. 414 | */ 415 | 416 | table { 417 | border-collapse: collapse; 418 | border-spacing: 0; 419 | } 420 | 421 | td, 422 | th { 423 | padding: 0; 424 | } 425 | -------------------------------------------------------------------------------- /demo/stylesheets/stylesheet.css: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | Slate Theme for GitHub Pages 3 | by Jason Costello, @jsncostello 4 | *******************************************************************************/ 5 | 6 | @import url(github-light.css); 7 | 8 | /******************************************************************************* 9 | MeyerWeb Reset 10 | *******************************************************************************/ 11 | 12 | html, body, div, span, applet, object, iframe, 13 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 14 | a, abbr, acronym, address, big, cite, code, 15 | del, dfn, em, img, ins, kbd, q, s, samp, 16 | small, strike, strong, sub, sup, tt, var, 17 | b, u, i, center, 18 | dl, dt, dd, ol, ul, li, 19 | fieldset, form, label, legend, 20 | table, caption, tbody, tfoot, thead, tr, th, td, 21 | article, aside, canvas, details, embed, 22 | figure, figcaption, footer, header, hgroup, 23 | menu, nav, output, ruby, section, summary, 24 | time, mark, audio, video { 25 | margin: 0; 26 | padding: 0; 27 | border: 0; 28 | font: inherit; 29 | } 30 | 31 | /* HTML5 display-role reset for older browsers */ 32 | article, aside, details, figcaption, figure, 33 | footer, header, hgroup, menu, nav, section { 34 | display: block; 35 | } 36 | 37 | ol, ul { 38 | list-style: none; 39 | } 40 | 41 | table { 42 | border-collapse: collapse; 43 | border-spacing: 0; 44 | } 45 | 46 | /******************************************************************************* 47 | Theme Styles 48 | *******************************************************************************/ 49 | 50 | body { 51 | 52 | color:#373737; 53 | background: #212121; 54 | font-size: 16px; 55 | font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif; 56 | -webkit-font-smoothing: antialiased; 57 | } 58 | 59 | h1, h2, h3, h4, h5, h6 { 60 | margin: 0; 61 | font-weight: 700; 62 | color:#222222; 63 | font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif; 64 | } 65 | 66 | h1 { 67 | font-size: 36px; 68 | font-weight: 700; 69 | } 70 | 71 | h2 { 72 | padding-bottom: 10px; 73 | font-size: 32px; 74 | background: url('../images/bg_hr.png') repeat-x bottom; 75 | } 76 | 77 | h3 { 78 | font-size: 24px; 79 | } 80 | 81 | h4 { 82 | font-size: 21px; 83 | } 84 | 85 | h5 { 86 | font-size: 18px; 87 | } 88 | 89 | h6 { 90 | font-size: 16px; 91 | } 92 | 93 | p { 94 | margin: 0 0 35px 0; 95 | } 96 | 97 | footer p { 98 | color: #f2f2f2; 99 | } 100 | 101 | a { 102 | text-decoration: none; 103 | color: #007edf; 104 | text-shadow: none; 105 | 106 | transition: color 0.5s ease; 107 | transition: text-shadow 0.5s ease; 108 | -webkit-transition: color 0.5s ease; 109 | -webkit-transition: text-shadow 0.5s ease; 110 | -moz-transition: color 0.5s ease; 111 | -moz-transition: text-shadow 0.5s ease; 112 | -o-transition: color 0.5s ease; 113 | -o-transition: text-shadow 0.5s ease; 114 | -ms-transition: color 0.5s ease; 115 | -ms-transition: text-shadow 0.5s ease; 116 | } 117 | 118 | a:hover, a:focus {text-decoration: underline;} 119 | 120 | footer a { 121 | color: #F2F2F2; 122 | text-decoration: underline; 123 | } 124 | 125 | em { 126 | font-style: italic; 127 | } 128 | 129 | strong { 130 | font-weight: bold; 131 | } 132 | 133 | img { 134 | position: relative; 135 | margin: 0 auto; 136 | max-width: 739px; 137 | padding: 5px; 138 | margin: 10px 0 10px 0; 139 | border: 1px solid #ebebeb; 140 | 141 | box-shadow: 0 0 5px #ebebeb; 142 | -webkit-box-shadow: 0 0 5px #ebebeb; 143 | -moz-box-shadow: 0 0 5px #ebebeb; 144 | -o-box-shadow: 0 0 5px #ebebeb; 145 | -ms-box-shadow: 0 0 5px #ebebeb; 146 | } 147 | 148 | p img { 149 | display: inline; 150 | margin: 0; 151 | padding: 0; 152 | vertical-align: middle; 153 | text-align: center; 154 | border: none; 155 | } 156 | 157 | pre, code { 158 | width: 100%; 159 | color: #222; 160 | background-color: #fff; 161 | 162 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; 163 | font-size: 14px; 164 | 165 | border-radius: 2px; 166 | -moz-border-radius: 2px; 167 | -webkit-border-radius: 2px; 168 | } 169 | 170 | pre { 171 | width: 100%; 172 | padding: 10px; 173 | box-shadow: 0 0 10px rgba(0,0,0,.1); 174 | overflow: auto; 175 | } 176 | 177 | code { 178 | padding: 3px; 179 | margin: 0 3px; 180 | box-shadow: 0 0 10px rgba(0,0,0,.1); 181 | } 182 | 183 | pre code { 184 | display: block; 185 | box-shadow: none; 186 | } 187 | 188 | blockquote { 189 | color: #666; 190 | margin-bottom: 20px; 191 | padding: 0 0 0 20px; 192 | border-left: 3px solid #bbb; 193 | } 194 | 195 | 196 | ul, ol, dl { 197 | margin-bottom: 15px 198 | } 199 | 200 | ul { 201 | list-style-position: inside; 202 | list-style: disc; 203 | padding-left: 20px; 204 | } 205 | 206 | ol { 207 | list-style-position: inside; 208 | list-style: decimal; 209 | padding-left: 20px; 210 | } 211 | 212 | dl dt { 213 | font-weight: bold; 214 | } 215 | 216 | dl dd { 217 | padding-left: 20px; 218 | font-style: italic; 219 | } 220 | 221 | dl p { 222 | padding-left: 20px; 223 | font-style: italic; 224 | } 225 | 226 | hr { 227 | height: 1px; 228 | margin-bottom: 5px; 229 | border: none; 230 | background: url('../images/bg_hr.png') repeat-x center; 231 | } 232 | 233 | 234 | form { 235 | background: #f2f2f2; 236 | padding: 20px; 237 | } 238 | 239 | /******************************************************************************* 240 | Full-Width Styles 241 | *******************************************************************************/ 242 | 243 | .outer { 244 | width: 100%; 245 | } 246 | 247 | .inner { 248 | position: relative; 249 | max-width: 640px; 250 | padding: 20px 10px; 251 | margin: 0 auto; 252 | } 253 | 254 | #forkme_banner { 255 | display: block; 256 | position: absolute; 257 | top:0; 258 | right: 10px; 259 | z-index: 10; 260 | padding: 10px 50px 10px 10px; 261 | color: #fff; 262 | background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%; 263 | font-weight: 700; 264 | box-shadow: 0 0 10px rgba(0,0,0,.5); 265 | border-bottom-left-radius: 2px; 266 | border-bottom-right-radius: 2px; 267 | } 268 | 269 | #header_wrap { 270 | background: #212121; 271 | background: -moz-linear-gradient(top, #373737, #212121); 272 | background: -webkit-linear-gradient(top, #373737, #212121); 273 | background: -ms-linear-gradient(top, #373737, #212121); 274 | background: -o-linear-gradient(top, #373737, #212121); 275 | background: linear-gradient(top, #373737, #212121); 276 | } 277 | 278 | #header_wrap .inner { 279 | padding: 50px 10px 30px 10px; 280 | } 281 | 282 | #project_title { 283 | margin: 0; 284 | color: #fff; 285 | font-size: 42px; 286 | font-weight: 700; 287 | text-shadow: #111 0px 0px 10px; 288 | } 289 | 290 | #project_tagline { 291 | color: #fff; 292 | font-size: 24px; 293 | font-weight: 300; 294 | background: none; 295 | text-shadow: #111 0px 0px 10px; 296 | } 297 | 298 | #downloads { 299 | position: absolute; 300 | width: 210px; 301 | z-index: 10; 302 | bottom: -40px; 303 | right: 0; 304 | height: 70px; 305 | background: url('../images/icon_download.png') no-repeat 0% 90%; 306 | } 307 | 308 | .zip_download_link { 309 | display: block; 310 | float: right; 311 | width: 90px; 312 | height:70px; 313 | text-indent: -5000px; 314 | overflow: hidden; 315 | background: url(../images/sprite_download.png) no-repeat bottom left; 316 | } 317 | 318 | .tar_download_link { 319 | display: block; 320 | float: right; 321 | width: 90px; 322 | height:70px; 323 | text-indent: -5000px; 324 | overflow: hidden; 325 | background: url(../images/sprite_download.png) no-repeat bottom right; 326 | margin-left: 10px; 327 | } 328 | 329 | .zip_download_link:hover { 330 | background: url(../images/sprite_download.png) no-repeat top left; 331 | } 332 | 333 | .tar_download_link:hover { 334 | background: url(../images/sprite_download.png) no-repeat top right; 335 | } 336 | 337 | #main_content_wrap { 338 | background: #f2f2f2; 339 | border-top: 1px solid #111; 340 | border-bottom: 1px solid #111; 341 | } 342 | 343 | #main_content { 344 | padding-top: 40px; 345 | } 346 | 347 | #footer_wrap { 348 | background: #212121; 349 | } 350 | 351 | 352 | 353 | /******************************************************************************* 354 | Small Device Styles 355 | *******************************************************************************/ 356 | 357 | @media screen and (max-width: 480px) { 358 | body { 359 | font-size:14px; 360 | } 361 | 362 | #downloads { 363 | display: none; 364 | } 365 | 366 | .inner { 367 | min-width: 320px; 368 | max-width: 480px; 369 | } 370 | 371 | #project_title { 372 | font-size: 32px; 373 | } 374 | 375 | h1 { 376 | font-size: 28px; 377 | } 378 | 379 | h2 { 380 | font-size: 24px; 381 | } 382 | 383 | h3 { 384 | font-size: 21px; 385 | } 386 | 387 | h4 { 388 | font-size: 18px; 389 | } 390 | 391 | h5 { 392 | font-size: 14px; 393 | } 394 | 395 | h6 { 396 | font-size: 12px; 397 | } 398 | 399 | code, pre { 400 | min-width: 320px; 401 | max-width: 480px; 402 | font-size: 11px; 403 | } 404 | 405 | } 406 | -------------------------------------------------------------------------------- /gruntfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (grunt) { 4 | // Project Configuration 5 | grunt.initConfig({ 6 | pkg: grunt.file.readJSON('package.json'), 7 | qunit: { 8 | all: ['test/test.html'] 9 | }, 10 | 11 | uglify: { 12 | demo: { 13 | files: { 14 | 'demo/MonthPicker.min.js': 'src/MonthPicker.js' 15 | } 16 | } 17 | }, 18 | 19 | cssmin: { 20 | demo: { 21 | files: { 22 | 'demo/MonthPicker.min.css': 'src/MonthPicker.css' 23 | } 24 | } 25 | }, 26 | 27 | 'gh-pages': { 28 | options: { 29 | base: 'demo', 30 | add: true 31 | }, 32 | 33 | src: ['**'] 34 | } 35 | }); 36 | 37 | grunt.loadNpmTasks('grunt-contrib-uglify'); 38 | grunt.loadNpmTasks('grunt-contrib-qunit'); 39 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 40 | grunt.loadNpmTasks('grunt-gh-pages'); 41 | 42 | grunt.registerTask('default', ['qunit', 'uglify', 'cssmin']); 43 | grunt.registerTask('test', ['qunit']); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-ui-month-picker", 3 | "description": "jQuery UI Month Picker Plugin", 4 | "version": "3.0.4", 5 | "license": "GPL-3.0", 6 | "repository": "https://github.com/KidSysco/jquery-ui-month-picker.git", 7 | "scripts": { 8 | "test": "grunt test", 9 | "postinstall": "bower install" 10 | }, 11 | "devDependencies": { 12 | "bower": "", 13 | "grunt": "^1.0.1", 14 | "grunt-contrib-cssmin": "^0.14.0", 15 | "grunt-contrib-qunit": "^0.6.0", 16 | "grunt-contrib-uglify": "~0.6.0", 17 | "grunt-gh-pages": "^1.0.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/MonthPicker.css: -------------------------------------------------------------------------------- 1 | /* 2 | The jQuery UI Month Picker Version 3.0.4 3 | https://github.com/KidSysco/jquery-ui-month-picker/ 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see 18 | . 19 | */ 20 | 21 | .month-picker { 22 | display: inline-block; 23 | position: absolute; 24 | z-index: 9999; 25 | } 26 | 27 | .month-picker table { 28 | border-collapse: separate; 29 | border-spacing: 2px 2px; 30 | } 31 | 32 | .month-picker td { 33 | padding: 0px; 34 | } 35 | 36 | /* 37 | Prevents the button labels from maving sligtly to the left 38 | when applying the width CSS property to the buttons. 39 | See: .month-picker-month-table button { width: 4.3em; } 40 | */ 41 | .month-picker .ui-button-text { 42 | padding: .4em 0; 43 | } 44 | 45 | .month-picker-header { 46 | margin: 3px 3px 0px 3px; 47 | } 48 | 49 | .month-picker-year-table { 50 | width: 100%; 51 | /* 52 | Makes sure the next/previous/jump years buttons are not unnecessarily 53 | selected if the user clicks them a couple of times fast. 54 | */ 55 | -ms-user-select: none; /* IE 10+ */ 56 | -moz-user-select: -moz-none; 57 | -khtml-user-select: none; 58 | -webkit-user-select: none; 59 | user-select: none; 60 | } 61 | 62 | /* 63 | The plugin uses buttons with a transparent background in the year-table 64 | (aka header) in order to look consistent with jQuery UI datepicker and to 65 | make the year title a button that blends into the heading in the default state. 66 | 67 | The plugin does this by removing the .ui-state-default class from (in MonthPicker.js) 68 | the a tags (buttons) which also ends up removing the 1px border that it applies. 69 | 70 | To prevent the button from resizing and moving everything around when you hover 71 | in and out, we use a carefully constructed selector, which gets overroden by the 72 | more specific .ui-state-hover/actove class selectors in the jquery-ui.css 73 | that apply the visible borders that we want. 74 | 75 | This selector applies a 1px transparent border that keeps the button 76 | in the same size, but it doesen't hide the borders that .ui-state-hover/actove give us. 77 | */ 78 | .month-picker-year-table a { 79 | border: 1px solid transparent; 80 | } 81 | 82 | /* 83 | Sets the size of the next/previous buttons, 84 | and makes the buttons in the heading (year-table) sligtly bigger, 85 | and removes the pointer cursor from the buttons in the heading (year-table). 86 | */ 87 | .month-picker-year-table .ui-button { 88 | font-size: 1.1em; 89 | width: 1.5em; 90 | height: 1.5em; 91 | cursor: default; 92 | margin: 0; 93 | } 94 | 95 | .month-picker-year-table .month-picker-title { 96 | text-align: center; 97 | } 98 | 99 | .month-picker-year-table .month-picker-title .ui-button { 100 | font-size: 1em; 101 | padding: .1em 0; 102 | width: 100%; 103 | font-weight: bold; 104 | } 105 | 106 | /* 107 | The buttons in the heading (year-table) are slightly shrinked, but because jQuery ui and 108 | the .month-picker .ui-button-text rule at the top of this CSS file apply some 109 | padding which results in the button text being moved to the bottom of 110 | the button. 111 | 112 | This rule removes the unnecessary padding so the text in 113 | the jump years button will be vericaly centred. 114 | */ 115 | .month-picker-year-table .ui-button-text { 116 | padding: 0; 117 | } 118 | 119 | .month-picker-month-table td { 120 | height: 35px; 121 | text-align: center; 122 | } 123 | 124 | /* 125 | Makes sure the buttons stay in the same size when swithching 126 | to the Jump years menu. 127 | this also ensures that the entire menu dosen't resize itself 128 | in response to the slightly bigger buttons in the Jump years menu. 129 | */ 130 | .month-picker-month-table .ui-button { 131 | width: 4.2em; 132 | margin: .2em; 133 | } 134 | 135 | .month-picker-open-button { 136 | height: 20px; 137 | width: 20px; 138 | vertical-align: bottom; 139 | } 140 | 141 | .month-picker-invalid-message { 142 | display: none; 143 | background-color: Yellow; 144 | } 145 | 146 | .month-picker-disabled { 147 | background-color: #e1e1e1; 148 | } 149 | -------------------------------------------------------------------------------- /src/MonthPicker.js: -------------------------------------------------------------------------------- 1 | /* 2 | The jQuery UI Month Picker Version 3.0.4 3 | https://github.com/KidSysco/jquery-ui-month-picker/ 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see 18 | . 19 | */ 20 | 21 | (function ($, window, document, Date) { 22 | 'use strict'; 23 | 24 | var _setupErr = 'MonthPicker Error: '; 25 | // This test must be run before any rererence is made to jQuery. 26 | // In case the user didn't load jQuery or jQuery UI the plugin 27 | // will fail before it get's to this test + there is no reason 28 | // to perform this test for every MonthPicker instance being created. 29 | if (!$ || !$.ui || !$.ui.button || !$.ui.datepicker) { 30 | alert(_setupErr + 'The jQuery UI button and datepicker plug-ins must be loaded.'); 31 | return; 32 | } 33 | 34 | // Creates an alias to jQuery UI's .button() that dosen't 35 | // conflict with Bootstrap.js button (#35) 36 | $.widget.bridge('jqueryUIButton', $.ui.button); 37 | 38 | var _speeds = $.fx.speeds; 39 | var _eventsNs = '.MonthPicker'; 40 | var _textfieldClass = 'month-year-input'; 41 | var _clearHint = 'month-picker-clear-hint'; 42 | var _iconClass = '.ui-button-icon-primary'; 43 | var _disabledClass = 'month-picker-disabled'; 44 | var _todayClass = 'ui-state-highlight'; 45 | var _selectedClass = 'ui-state-active'; 46 | var _defaultClass = 'ui-state-default'; 47 | var _defaultPos = { my: 'left top+1', at: 'left bottom' }; 48 | var _RTL_defaultPos = { my: 'right top+1', at: 'right bottom' }; 49 | var _posErr = _setupErr + 'The jQuery UI position plug-in must be loaded.'; 50 | var _badOptValErr = _setupErr + 'Unsupported % option value, supported values are: '; 51 | var _badMinMaxVal = _setupErr + '"_" is not a valid %Month value.'; 52 | var _openedInstance = null; 53 | var _hasPosition = !!$.ui.position; 54 | var _animVals = { 55 | Animation: ['slideToggle', 'fadeToggle', 'none'], 56 | ShowAnim: ['fadeIn', 'slideDown', 'none'], 57 | HideAnim: ['fadeOut', 'slideUp', 'none'] 58 | }; 59 | var _setOptionHooks = { 60 | ValidationErrorMessage: '_createValidationMessage', 61 | Disabled: '_setDisabledState', 62 | ShowIcon: '_updateButton', 63 | Button: '_updateButton', 64 | ShowOn: '_updateFieldEvents', 65 | IsRTL: '_setRTL', 66 | AltFormat: '_updateAlt', 67 | AltField: '_updateAlt', 68 | StartYear: '_setPickerYear', 69 | MinMonth: '_setMinMonth', 70 | MaxMonth: '_setMaxMonth', 71 | SelectedMonth: '_setSelectedMonth' 72 | }; 73 | var $noop = $.noop; 74 | var $proxy = $.proxy; 75 | var $datepicker = $.datepicker; 76 | var click = 'click' + _eventsNs; 77 | 78 | function _toMonth(date) { 79 | return date.getMonth() + (date.getFullYear() * 12); 80 | } 81 | 82 | function _toYear(month) { 83 | return Math.floor(month / 12); 84 | } 85 | 86 | function _stayActive() { 87 | $(this).addClass(_selectedClass); 88 | } 89 | 90 | function _setActive( el, state ) { 91 | return el[ state ? 'on' : 'off' ]('mousenter mouseout', _stayActive ) 92 | .toggleClass(_selectedClass, state); 93 | } 94 | 95 | function _between(month, from, until) { 96 | return (!from || month >= from) && (!until || month <= until); 97 | } 98 | 99 | function _encodeMonth(_inst, _val) { 100 | if (_val === null) { 101 | return _val; 102 | } else if (_val instanceof Date) { 103 | return _toMonth(_val); 104 | } else if ($.isNumeric(_val)) { 105 | return _toMonth(new Date) + parseInt(_val, 10); 106 | } 107 | 108 | var _date = _inst._parseMonth(_val); 109 | if (_date) { 110 | return _toMonth(_date); 111 | } 112 | 113 | return _parsePeriod(_val); 114 | } 115 | 116 | function _event(_name, _inst) { 117 | return $proxy(_inst.options[_name] || $noop, _inst.element[0]); 118 | } 119 | 120 | function _parsePeriod(_val, _initDate) { 121 | // Parsing is done by replacing tokens in the value to form 122 | // a JSON object with it's keys and values reversed 123 | // (example '+1y +2m' will turn into {"+1":"y","+2":"m"}) 124 | // After that we just revers the keys and values. 125 | var _json = $.trim(_val); 126 | _json = _json.replace(/y/i, '":"y"'); 127 | _json = _json.replace(/m/i, '":"m"'); 128 | 129 | try { 130 | var _rev = JSON.parse( '{"' + _json.replace(/ /g, ',"') + '}' ), obj = {}; 131 | 132 | for (var key in _rev) { 133 | obj[ _rev[key] ] = key; 134 | } 135 | 136 | var _month = _toMonth(new Date); 137 | _month += (parseInt(obj.m, 10) || 0); 138 | return _month + (parseInt(obj.y, 10) || 0) * 12; 139 | } catch (e) { 140 | return false; 141 | } 142 | } 143 | 144 | function _makeDefaultButton(options) { 145 | // this refers to the associated input field. 146 | return $('' + options.i18n.buttonText + '') 147 | .jqueryUIButton({ 148 | text: false, 149 | icons: { 150 | // Defaults to 'ui-icon-calculator'. 151 | primary: options.ButtonIcon 152 | } 153 | }); 154 | } 155 | 156 | function _applyArrowButton($el, dir) { 157 | $el.jqueryUIButton('option', { 158 | icons: { 159 | primary: 'ui-icon-circle-triangle-' + (dir ? 'w' : 'e') 160 | } 161 | }); 162 | } 163 | 164 | function _isInline(elem) { 165 | return !elem.is('input'); 166 | } 167 | 168 | $.MonthPicker = { 169 | VERSION: '3.0.4', // Added in version 2.4; 170 | i18n: { 171 | year: 'Year', 172 | prevYear: 'Previous Year', 173 | nextYear: 'Next Year', 174 | next12Years: 'Jump Forward 12 Years', 175 | prev12Years: 'Jump Back 12 Years', 176 | nextLabel: 'Next', 177 | prevLabel: 'Prev', 178 | buttonText: 'Open Month Chooser', 179 | jumpYears: 'Jump Years', 180 | backTo: 'Back to', 181 | months: ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'June', 'July', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'] 182 | } 183 | }; 184 | 185 | var _markup = 186 | '
' + 187 | '' + 188 | '' + 189 | '' + 190 | '' + 191 | '' + 192 | '' + 193 | '
' + 194 | '
' + 195 | '
' + 196 | '' + 197 | ''; 198 | 199 | // Groups state and functionallity to fade in the jump years hint 200 | // when the user mouses over the Year 2016 text. 201 | // NOTE: An invocation of this function: 202 | // 1: Is an independent instance with it's own unique state. 203 | // 2: Assumes that there is no previous hint applied to the 204 | // button (it dosen't remove the existing hint). 205 | function _applyButtonHint(_button, _hintText) { 206 | var _speed = 125, _currentLabel, _startTimeout, _labelElem = $(); 207 | 208 | _button.on('mouseenter' + _eventsNs + 'h', _prepareToStart); 209 | 210 | // Setp 1: Wait to make sure the user isn't just mousing over and 211 | // away from the button. 212 | // NOTE: If _fadeOutHint() is triggered on mouseleave before the 213 | // timeout is triggered the animation is canceled. 214 | function _prepareToStart() { 215 | _startTimeout = setTimeout(_fadeOutLabel, 175); 216 | } 217 | 218 | // Setp 2: Fade out the label (Year 2016) text to 45%. 219 | function _fadeOutLabel() { 220 | _startTimeout = null; 221 | _labelElem = $('span', _button).animate({ opacity: 0.45 }, _speed, _fadeInHint); 222 | } 223 | 224 | // Setp 3: Fade in the hint text (Jump years). 225 | function _fadeInHint() { 226 | _currentLabel = _labelElem.text(); 227 | _labelElem.animate({ opacity: 1 }, _speed).text(_hintText); 228 | } 229 | 230 | _button.on('mouseleave' + _eventsNs + 'h', _fadeOutHint); 231 | 232 | function _fadeOutHint() { 233 | if (_startTimeout) { 234 | // If the user is just moving over and away from the button, cancel 235 | // the animation completely. 236 | clearTimeout(_startTimeout); 237 | } else { 238 | // Setp 4: Fade out the hint text (Jump years) to 45%. 239 | _labelElem = $('span', _button).animate({ opacity: 0.45 }, _speed, _fadeInLabel); 240 | } 241 | } 242 | 243 | // Setp 5: Fade in the label (Year 2016) text. 244 | function _fadeInLabel() { 245 | _labelElem.text( _currentLabel ).animate({opacity: 1}, _speed); 246 | } 247 | 248 | // Adds a function to the button elemene which is called when the 249 | // user clicks the button (the hint needs to be removed). 250 | _button.data(_clearHint, function() { 251 | clearTimeout(_startTimeout); 252 | _labelElem.stop().css({ opacity: 1 }); 253 | _button.off(_eventsNs + 'h'); 254 | }); 255 | } // End _applyButtonHint() 256 | 257 | function _setDisabled(_button, _value) { 258 | var _btnWidget = _button.data('ui-button'); 259 | if (_btnWidget.option('disabled') !== _value) { 260 | _btnWidget.option('disabled', _value); 261 | } 262 | } 263 | 264 | $.widget("KidSysco.MonthPicker", { 265 | 266 | /******* Properties *******/ 267 | 268 | options: { 269 | i18n: {}, 270 | IsRTL: false, 271 | Position: null, 272 | StartYear: null, 273 | ShowIcon: true, 274 | UseInputMask: false, 275 | ValidationErrorMessage: null, 276 | Disabled: false, 277 | MonthFormat: 'mm/yy', 278 | Animation: 'fadeToggle', 279 | ShowAnim: null, 280 | HideAnim: null, 281 | ShowOn: null, 282 | MinMonth: null, 283 | MaxMonth: null, 284 | Duration: 'normal', 285 | Button: _makeDefaultButton, 286 | ButtonIcon: 'ui-icon-calculator' 287 | }, 288 | 289 | _monthPickerButton: $(), 290 | _validationMessage: $(), 291 | _selectedBtn: $(), 292 | 293 | /******* jQuery UI Widget Factory Overrides ********/ 294 | 295 | _destroy: function () { 296 | var _elem = this.element; 297 | if ($.mask && this.options.UseInputMask) { 298 | _elem.unmask(); 299 | 300 | if (!this.GetSelectedDate()) { 301 | _elem.val(''); 302 | } 303 | } 304 | 305 | _elem.removeClass(_textfieldClass).off(_eventsNs); 306 | 307 | $(document).off(_eventsNs + this.uuid); 308 | 309 | this._monthPickerMenu.remove(); 310 | 311 | var _button = this._monthPickerButton.off(click); 312 | if (this._removeOldBtn) { 313 | _button.remove(); 314 | } 315 | 316 | this._validationMessage.remove(); 317 | 318 | if (_openedInstance === this) { 319 | _openedInstance = null; 320 | } 321 | }, 322 | 323 | _setOption: function (key, value) { 324 | switch (key) { 325 | case 'i18n': 326 | // Pass a clone i18n object to the this._super. 327 | value = $.extend({}, value); 328 | break; 329 | case 'Position': 330 | if (!_hasPosition) { 331 | alert(_posErr); 332 | return; 333 | } 334 | break; 335 | case 'MonthFormat': 336 | var date = this.GetSelectedDate(); 337 | if (date) { 338 | this.element.val( this.FormatMonth(date, value) ); 339 | } 340 | break; 341 | } 342 | 343 | // Make sure the user passed in a valid Animation, ShowAnim and HideAnim options values. 344 | if (key in _animVals && $.inArray(value, _animVals[key]) === -1) { 345 | alert(_badOptValErr.replace(/%/, key) + _animVals[key]); 346 | return; 347 | } 348 | 349 | // In jQuery UI 1.8, manually invoke the _setOption method from the base widget. 350 | //$.Widget.prototype._setOption.apply(this, arguments); 351 | // In jQuery UI 1.9 and above, you use the _super method instead. 352 | this._super(key, value); 353 | 354 | _setOptionHooks[key] ? this[ _setOptionHooks[key] ](value) : 0; 355 | }, 356 | 357 | _create: function () { 358 | var _el = this.element, _opts = this.options, _type = _el.attr('type'); 359 | // According to http://www.w3.org/TR/html-markup/input.html#input 360 | // An input element with no type attribute specified represents the same thing as an 361 | // input element with its type attribute set to "text". 362 | // TLDR: 363 | // http://www.w3.org/TR/html5/forms.html#the-input-element 364 | // https://api.jquery.com/text-selector/ 365 | 366 | // $.inArray(void 0, ['text', 'month', void 0]) returns -1 when searching for undefined in IE8 (#45) 367 | // This is only noticable in the real version of IE8, emulated versions 368 | // from the dev tools in modern browsers do not suffer from this issue. 369 | // if (!_el.is('input,div,span') || $.inArray(_el.attr('type'), ['text', 'month', void 0]) === -1) { 370 | if (!_el.is('input,div,span') || (_type !== 'text' && _type !== 'month' && _type !== void 0)) { 371 | var error = _setupErr + 'MonthPicker can only be called on text or month inputs.'; 372 | // Call alert first so that IE<10 won't trip over console.log and swallow all errors. 373 | alert(error + ' \n\nSee (developer tools) for more details.'); 374 | 375 | console.error(error + '\n Caused by:'); 376 | console.log(_el[0]); 377 | return false; 378 | } 379 | 380 | if (!$.mask && _opts.UseInputMask) { 381 | alert(_setupErr + 'The UseInputMask option requires the Input Mask Plugin. Get it from digitalbush.com'); 382 | return false; 383 | } 384 | 385 | if (_opts.Position !== null && !_hasPosition) { 386 | alert(_posErr); 387 | return false; 388 | } 389 | 390 | // Make sure the user passed in a valid Animation, ShowAnim and HideAnim options values. 391 | for (var opt in _animVals) { 392 | if (_opts[opt] !== null && $.inArray(_opts[opt], _animVals[opt]) === -1) { 393 | alert(_badOptValErr.replace(/%/, opt) + _animVals[opt]); 394 | return false; 395 | } 396 | } 397 | 398 | this._isMonthInputType = _el.attr('type') === 'month'; 399 | if (this._isMonthInputType) { 400 | this.options.MonthFormat = this.MonthInputFormat; 401 | _el.css('width', 'auto'); 402 | } 403 | 404 | var _menu = this._monthPickerMenu = $('
').hide(); 405 | var isInline = _isInline(_el); 406 | 407 | $(_markup).appendTo(_menu); 408 | _menu.appendTo( isInline ? _el : document.body ); 409 | 410 | this._titleButton = 411 | $('.month-picker-title', _menu) 412 | .click($proxy(this._showYearsClickHandler, this)) 413 | .find('a').jqueryUIButton() 414 | .removeClass(_defaultClass); 415 | 416 | this._applyJumpYearsHint(); 417 | this._createValidationMessage(); 418 | 419 | this._prevButton = $('.month-picker-previous>a', _menu) 420 | .jqueryUIButton({ text: false }) 421 | .removeClass(_defaultClass); 422 | 423 | this._nextButton = $('.month-picker-next>a', _menu) 424 | .jqueryUIButton({ text: false }) 425 | .removeClass(_defaultClass); 426 | 427 | this._setRTL(_opts.IsRTL); //Assigns icons to the next/prev buttons. 428 | 429 | $(_iconClass, this._nextButton).text(this._i18n('nextLabel')); 430 | $(_iconClass, this._prevButton).text(this._i18n('prevLabel')); 431 | 432 | var $table = $('.month-picker-month-table', _menu); 433 | for (var i = 0; i < 12; i++) { 434 | var $tr = !(i % 3) ? $('').appendTo($table) : $tr; 435 | 436 | // Use tag instead of '); 439 | } 440 | 441 | this._buttons = $('a', $table).jqueryUIButton(); 442 | 443 | _menu.on('mousedown' + _eventsNs, function (event) { 444 | event.preventDefault(); 445 | }); 446 | 447 | // Checks and initailizes Min/MaxMonth properties 448 | // (creates _setMinMonth and _setMaxMonth methods). 449 | var me = this, Month = 'Month'; 450 | $.each(['Min', 'Max'], function(i, type) { 451 | me["_set" + type + Month] = function(val) { 452 | if ((me['_' + type + Month] = _encodeMonth(me, val)) === false) { 453 | alert(_badMinMaxVal.replace(/%/, type).replace(/_/, val)); 454 | } 455 | }; 456 | 457 | me._setOption(type + Month, me.options[type + Month]); 458 | }); 459 | 460 | var _selMonth = _opts.SelectedMonth; 461 | if (_selMonth !== void 0) { 462 | var month = _encodeMonth(this, _selMonth); 463 | _el.val( this._formatMonth(new Date( _toYear(month), month % 12, 1)) ); 464 | } 465 | 466 | this._updateAlt(); 467 | 468 | this._setUseInputMask(); 469 | this._setDisabledState(); 470 | this.Destroy = this.destroy; 471 | 472 | if (isInline) { 473 | this.Open(); 474 | } else { 475 | // Update the alt field if the user manually changes 476 | // the input field. 477 | _el.addClass(_textfieldClass); 478 | _el.change($proxy(this._updateAlt, this)); 479 | } 480 | }, 481 | 482 | /****** Publicly Accessible API functions ******/ 483 | 484 | GetSelectedDate: function () { 485 | return this._parseMonth(); 486 | }, 487 | 488 | GetSelectedYear: function () { 489 | var date = this.GetSelectedDate(); 490 | return date ? date.getFullYear() : NaN; 491 | }, 492 | 493 | GetSelectedMonth: function () { 494 | var date = this.GetSelectedDate(); 495 | return date ? date.getMonth()+1 : NaN; 496 | }, 497 | 498 | Validate: function() { 499 | var _date = this.GetSelectedDate(); 500 | 501 | if (this.options.ValidationErrorMessage !== null && !this.options.Disabled) { 502 | this._validationMessage.toggle(!_date); 503 | } 504 | 505 | return _date; 506 | }, 507 | 508 | GetSelectedMonthYear: function () { 509 | var date = this.Validate(); 510 | return date ? (date.getMonth() + 1) + '/' + date.getFullYear() : null; 511 | }, 512 | 513 | Disable: function () { 514 | this._setOption("Disabled", true); 515 | }, 516 | 517 | Enable: function () { 518 | this._setOption("Disabled", false); 519 | }, 520 | 521 | ClearAllCallbacks: function () { 522 | for (var _opt in this.options) { 523 | if (_opt.indexOf('On') === 0) { 524 | this.options[_opt] = $noop; 525 | } 526 | } 527 | }, 528 | 529 | Clear: function () { 530 | this.element.val(''); 531 | $(this.options.AltField).val(''); 532 | this._validationMessage.hide(); 533 | }, 534 | 535 | Toggle: function (event) { 536 | return this._visible ? this.Close(event) : this.Open(event); 537 | }, 538 | 539 | Open: function (event) { 540 | var _elem = this.element, _opts = this.options; 541 | if (!_opts.Disabled && !this._visible) { 542 | // Allow the user to prevent opening the menu. 543 | event = event || $.Event(); 544 | if (_event('OnBeforeMenuOpen', this)(event) === false || event.isDefaultPrevented()) { 545 | return; 546 | } 547 | 548 | this._visible = true; 549 | this._ajustYear(_opts); 550 | 551 | var _menu = this._monthPickerMenu; 552 | this._showMonths(); 553 | 554 | if (_isInline(_elem)) { 555 | _menu.css('position', 'static').show(); 556 | _event('OnAfterMenuOpen', this)(); 557 | } else { 558 | // If there is an open menu close it first. 559 | if (_openedInstance) { 560 | _openedInstance.Close(event); 561 | } 562 | 563 | _openedInstance = this; 564 | $(document).on('mousedown' + _eventsNs + this.uuid, $proxy(this.Close, this)) 565 | .on('keydown' + _eventsNs + this.uuid, $proxy(this._keyDown, this)); 566 | 567 | // Trun off validation so that clicking one of the months 568 | // won't blur the input field and trogger vlaidation 569 | // befroe the month was chosen (click event was triggered). 570 | // It is turned back on when Hide() is called. 571 | _elem.off('blur' + _eventsNs).focus(); 572 | 573 | var _anim = _opts.ShowAnim || _opts.Animation, 574 | _noAnim = _anim === 'none'; 575 | 576 | // jQuery UI overrides jQuery.show and dosen't 577 | // call the start callback. 578 | // see: http://api.jqueryui.com/show/ 579 | _menu[ _noAnim ? 'fadeIn' : _anim ]({ 580 | duration: _noAnim ? 0 : this._duration(), 581 | start: $proxy(this._position, this, _menu), 582 | complete: _event('OnAfterMenuOpen', this) 583 | }); 584 | } 585 | } 586 | }, 587 | 588 | Close: function (event) { 589 | var _elem = this.element; 590 | if (!_isInline(_elem) && this._visible) { 591 | var _menu = this._monthPickerMenu, 592 | _opts = this.options; 593 | 594 | event = event || $.Event(); 595 | if (_event('OnBeforeMenuClose', this)(event) === false || event.isDefaultPrevented()) { 596 | return; 597 | } 598 | 599 | // If the menu is closed while in jump years mode, bring back 600 | // the jump years hint. 601 | if (this._backToYear) { 602 | this._applyJumpYearsHint(); 603 | this._backToYear = 0; 604 | } 605 | 606 | this._visible = false; 607 | _openedInstance = null; 608 | $(document).off('keydown' + _eventsNs + this.uuid) 609 | .off('mousedown' + _eventsNs + this.uuid); 610 | 611 | this.Validate(); 612 | _elem.on('blur' + _eventsNs, $proxy(this.Validate, this)); 613 | var _callback = _event('OnAfterMenuClose', this); 614 | 615 | var _anim = _opts.HideAnim || _opts.Animation; 616 | if (_anim === 'none') { 617 | _menu.hide(0, _callback); 618 | } else { 619 | _menu[ _anim ](this._duration(), _callback); 620 | } 621 | } 622 | }, 623 | 624 | /** 625 | * Methods the user can override to use a third party library 626 | * such as http://momentjs.com for parsing and formatting months. 627 | */ 628 | MonthInputFormat: 'yy-mm', 629 | 630 | ParseMonth: function (str, format) { 631 | try { 632 | return $datepicker.parseDate('dd' + format, '01' + str); 633 | } catch (e) { 634 | return null; 635 | } 636 | }, 637 | 638 | FormatMonth: function (date, format) { 639 | try { 640 | return $datepicker.formatDate(format, date) || null; 641 | } catch (e) { 642 | return null; 643 | } 644 | }, 645 | 646 | /****** Private and Misc Utility functions ******/ 647 | 648 | _setSelectedMonth: function (_selMonth) { 649 | var month = _encodeMonth(this, _selMonth), _el = this.element; 650 | 651 | if (month) { 652 | var date = new Date( _toYear(month), month % 12, 1 ); 653 | _el.val( this._formatMonth( date ) ); 654 | 655 | this._updateAlt(0, date); 656 | this._validationMessage.hide(); 657 | } else { 658 | this.Clear(); 659 | } 660 | 661 | this._ajustYear(this.options); 662 | this._showMonths(); 663 | }, 664 | 665 | _applyJumpYearsHint: function() { 666 | _applyButtonHint(this._titleButton, this._i18n('jumpYears')); 667 | }, 668 | 669 | _i18n: function(str) { 670 | var _trans = this.options.i18n[str]; 671 | 672 | if (typeof _trans === 'undefined') { 673 | return $.MonthPicker.i18n[str]; 674 | } else { 675 | return _trans; 676 | } 677 | }, 678 | 679 | _parseMonth: function (str, format) { 680 | return this.ParseMonth(str || this.element.val(), format || this.options.MonthFormat); 681 | }, 682 | 683 | _formatMonth: function (date, format) { 684 | return this.FormatMonth(date || this._parseMonth(), format || this.options.MonthFormat); 685 | }, 686 | 687 | _updateButton: function () { 688 | var isDisabled = this.options.Disabled; 689 | 690 | this._createButton(); 691 | 692 | // If the button is a jQuery UI button, 693 | // plain HTML button or an input we support disable it, 694 | // otherwise the user must handle the diabled state 695 | // by creating an appropriate button by passing 696 | // a function. See Button option: Img tag tests for 697 | // more details. 698 | var _button = this._monthPickerButton; 699 | try { 700 | _button.jqueryUIButton('option', 'disabled', isDisabled); 701 | } catch (e) { 702 | _button.filter('button,input').prop('disabled', isDisabled); 703 | } 704 | 705 | this._updateFieldEvents(); 706 | }, 707 | 708 | _createButton: function () { 709 | var _elem = this.element, _opts = this.options; 710 | if (_isInline(_elem)) return; 711 | 712 | var _oldButton = this._monthPickerButton.off(_eventsNs); 713 | var _btnOpt = _opts.ShowIcon ? _opts.Button : false; 714 | 715 | if ($.isFunction(_btnOpt)) { 716 | var _params = $.extend(true, {i18n: $.extend(true, {}, $.MonthPicker.i18n)}, this.options); 717 | _btnOpt = _btnOpt.call(_elem[0], _params); 718 | } 719 | 720 | var _removeOldBtn = false; 721 | this._monthPickerButton = ( _btnOpt instanceof $ ? _btnOpt : $(_btnOpt) ) 722 | .each(function() { 723 | if (!$.contains(document.body, this)) { 724 | _removeOldBtn = true; 725 | $(this).insertAfter(_elem); 726 | } 727 | }) 728 | .on(click, $proxy(this.Toggle, this)) 729 | .on('mousedown' + _eventsNs, function(r) { 730 | r.preventDefault(); 731 | }); 732 | 733 | if (this._removeOldBtn) { 734 | _oldButton.remove(); 735 | } 736 | 737 | this._removeOldBtn = _removeOldBtn; 738 | }, 739 | 740 | _updateFieldEvents: function () { 741 | var _events = click + ' focus' + _eventsNs; 742 | this.element.off(_events); 743 | if (this.options.ShowOn === 'both' || !this._monthPickerButton.length) { 744 | this.element.on(_events, $proxy(this.Open, this)); 745 | } 746 | }, 747 | 748 | _createValidationMessage: function () { 749 | var _errMsg = this.options.ValidationErrorMessage, _elem = this.element; 750 | if ($.inArray(_errMsg, [null, '']) === -1) { 751 | var _msgEl = $('' + _errMsg + ''); 752 | 753 | var _button = this._monthPickerButton; 754 | this._validationMessage = _msgEl.insertAfter(_button.length ? _button : _elem); 755 | 756 | _elem.on('blur' + _eventsNs, $proxy(this.Validate, this)); 757 | } else { 758 | this._validationMessage.remove(); 759 | } 760 | }, 761 | 762 | _setRTL: function(value) { 763 | _applyArrowButton( this._prevButton.css('float', value ? 'right' : 'left'), !value ); 764 | _applyArrowButton( this._nextButton.css('float', value ? 'left' : 'right'), value ); 765 | }, 766 | 767 | _keyDown: function (event) { 768 | // Don't use $.ui.keyCode to help minification. 769 | switch (event.keyCode) { 770 | case 13: // Enter. 771 | if (!this.element.val()) { 772 | this._chooseMonth(new Date().getMonth() + 1); 773 | } 774 | this.Close(event); 775 | break; 776 | case 27: // Escape 777 | case 9: // Tab 778 | this.Close(event); 779 | break; 780 | } 781 | }, 782 | 783 | _duration: function() { 784 | var _dur = this.options.Duration; 785 | 786 | if ($.isNumeric(_dur)) { 787 | return _dur; 788 | } 789 | 790 | return _dur in _speeds ? _speeds[ _dur ] : _speeds._default; 791 | }, 792 | 793 | _position: _hasPosition ? 794 | function($menu) { 795 | var _defauts = this.options.IsRTL ? _RTL_defaultPos : _defaultPos; 796 | var _posOpts = $.extend(_defauts, this.options.Position); 797 | 798 | // Only in IE and jQuery 1.12.0 or 2.2.0, .position() will add scrollTop to the top coordinate (#40) 799 | return $menu.position($.extend({of: this.element}, _posOpts)); 800 | } : 801 | function($menu) { 802 | // Only in IE and jQuery 1.12.0 or 2.2.0, .offset() will add scrollTop to the top coordinate (#40) 803 | var _el = this.element, 804 | _css = { top: (_el.offset().top + _el.height() + 7) + 'px' }; 805 | 806 | if (this.options.IsRTL) { 807 | _css.left = (_el.offset().left-$menu.width()+_el.width() + 7) + 'px'; 808 | } else { 809 | _css.left = _el.offset().left + 'px'; 810 | } 811 | 812 | return $menu.css(_css); 813 | }, 814 | 815 | _setUseInputMask: function () { 816 | if (!this._isMonthInputType) { 817 | try { 818 | if (this.options.UseInputMask) { 819 | this.element.mask( this._formatMonth(new Date).replace(/\d/g, 9) ); 820 | } else { 821 | this.element.unmask(); 822 | } 823 | } catch (e) {} 824 | } 825 | }, 826 | 827 | _setDisabledState: function () { 828 | var isDisabled = this.options.Disabled, _elem = this.element; 829 | 830 | // Disable the associated input field. 831 | _elem[0].disabled = isDisabled; 832 | _elem.toggleClass(_disabledClass, isDisabled); 833 | 834 | if (isDisabled) { 835 | this._validationMessage.hide(); 836 | } 837 | 838 | this.Close(); 839 | this._updateButton(); 840 | 841 | _event('OnAfterSetDisabled', this)(isDisabled); 842 | }, 843 | 844 | _getPickerYear: function () { 845 | return this._pickerYear; 846 | }, 847 | 848 | _setPickerYear: function (year) { 849 | this._pickerYear = year || new Date().getFullYear(); 850 | this._titleButton.jqueryUIButton({ label: this._i18n('year') + ' ' + this._pickerYear }); 851 | }, 852 | 853 | // When calling this method with a falsy (undefined) date 854 | // value, this.element.val() is used as the date value. 855 | // 856 | // Therefore it's important to update the input field 857 | // before calling this method. 858 | _updateAlt: function (noop, date) { 859 | var _field = $(this.options.AltField); 860 | if (_field.length) { 861 | _field.val( this._formatMonth(date, this.options.AltFormat) ); 862 | } 863 | }, 864 | 865 | _chooseMonth: function (month) { 866 | var _year = this._getPickerYear(); 867 | var date = new Date(_year, month-1); 868 | this.element.val(this._formatMonth( date )).blur(); 869 | this._updateAlt(0, date); 870 | 871 | _setActive( this._selectedBtn, false ); 872 | this._selectedBtn = _setActive( $(this._buttons[month-1]), true ); 873 | 874 | _event('OnAfterChooseMonth', this)(date); 875 | }, 876 | 877 | _chooseYear: function (year) { 878 | this._backToYear = 0; 879 | this._setPickerYear(year); 880 | this._buttons.removeClass(_todayClass); 881 | this._showMonths(); 882 | this._applyJumpYearsHint(); 883 | 884 | _event('OnAfterChooseYear', this)(); 885 | }, 886 | 887 | _showMonths: function () { 888 | var _months = this._i18n('months'); 889 | 890 | this._prevButton 891 | .attr('title', this._i18n('prevYear')) 892 | .off(click) 893 | .on(click, $proxy(this._addToYear, this, -1)); 894 | 895 | this._nextButton 896 | .attr('title', this._i18n('nextYear')) 897 | .off(click) 898 | .on(click, $proxy(this._addToYear, this, 1)); 899 | 900 | this._buttons.off(_eventsNs); 901 | 902 | var me = this, _onMonthClick = $proxy(me._onMonthClick, me); 903 | $.each(_months, function(index, monthName) { 904 | $(me._buttons[index]) 905 | .on(click, {month: index+1}, _onMonthClick ) 906 | .jqueryUIButton('option', 'label', monthName); 907 | }); 908 | 909 | this._decorateButtons(); 910 | }, 911 | 912 | _showYearsClickHandler: function () { 913 | this._buttons.removeClass(_todayClass); 914 | if (!this._backToYear) { 915 | this._backToYear = this._getPickerYear(); 916 | this._showYears(); 917 | 918 | var _label = this._i18n('backTo') + ' ' + this._getPickerYear(); 919 | this._titleButton.jqueryUIButton({ label: _label }).data( _clearHint )(); 920 | 921 | _event('OnAfterChooseYears', this)(); 922 | } else { 923 | this._setPickerYear(this._backToYear); 924 | this._applyJumpYearsHint(); 925 | this._showMonths(); 926 | this._backToYear = 0; 927 | } 928 | }, 929 | 930 | _showYears: function () { 931 | var _currYear = this._getPickerYear(), 932 | _yearDifferential = -4, 933 | _firstYear = (_currYear + _yearDifferential), 934 | AMOUNT_TO_ADD = 12, 935 | _thisYear = new Date().getFullYear(); 936 | 937 | var _minDate = this._MinMonth; 938 | var _maxDate = this._MaxMonth; 939 | var _minYear = _minDate ? _toYear(_minDate) : 0; 940 | var _maxYear = _maxDate ? _toYear(_maxDate) : 0; 941 | this._prevButton 942 | .attr('title', this._i18n('prev12Years')) 943 | .off(click) 944 | .on(click, $proxy(this._addToYears, this, -AMOUNT_TO_ADD)); 945 | 946 | this._nextButton 947 | .attr('title', this._i18n('next12Years')) 948 | .off(click) 949 | .on(click, $proxy(this._addToYears, this, AMOUNT_TO_ADD)); 950 | 951 | _setDisabled(this._prevButton, _minYear && (_firstYear - 1) < _minYear); 952 | _setDisabled(this._nextButton, _maxYear && (_firstYear + 12) -1 > _maxYear); 953 | 954 | this._buttons.off(_eventsNs); 955 | 956 | _setActive( this._selectedBtn, false ); 957 | 958 | var _selYear = this.GetSelectedYear(); 959 | var _onClick = $proxy(this._onYearClick, this); 960 | var _todayWithinBounds = _between(_thisYear, _minYear, _maxYear); 961 | var _selWithinBounds = _between(_selYear, _minYear, _maxYear); 962 | 963 | for (var _counter = 0; _counter < 12; _counter++) { 964 | var _year = _currYear + _yearDifferential; 965 | 966 | var _btn = $( this._buttons[_counter] ).jqueryUIButton({ 967 | disabled: !_between(_year, _minYear, _maxYear), 968 | label: _year 969 | }) 970 | .toggleClass(_todayClass, _year === _thisYear && _todayWithinBounds) // Heighlight the current year. 971 | .on(click, { year: _year }, _onClick ); 972 | 973 | // Heighlight the selected year. 974 | if (_selWithinBounds && _selYear && _selYear === _year) { 975 | this._selectedBtn = _setActive( _btn , true ); 976 | } 977 | 978 | _yearDifferential++; 979 | } 980 | }, 981 | 982 | _onMonthClick: function(event) { 983 | this._chooseMonth(event.data.month); 984 | this.Close(event); 985 | }, 986 | 987 | _onYearClick: function(event) { 988 | this._chooseYear(event.data.year); 989 | }, 990 | 991 | _addToYear: function(amount) { 992 | this._setPickerYear( this._getPickerYear() + amount ); 993 | this.element.focus(); 994 | this._decorateButtons(); 995 | 996 | _event('OnAfter' + (amount > 0 ? 'Next' : 'Previous') + 'Year', this)(); 997 | }, 998 | 999 | _addToYears: function(amount) { 1000 | this._pickerYear = this._getPickerYear() + amount; 1001 | this._showYears(); 1002 | this.element.focus(); 1003 | 1004 | _event('OnAfter' + (amount > 0 ? 'Next' : 'Previous') + 'Years', this)(); 1005 | }, 1006 | 1007 | _ajustYear: function(_opts) { 1008 | var _year = _opts.StartYear || this.GetSelectedYear() || new Date().getFullYear(); 1009 | if (this._MinMonth !== null) { 1010 | _year = Math.max(_toYear(this._MinMonth), _year); 1011 | } 1012 | if (this._MaxMonth !== null) { 1013 | _year = Math.min(_toYear(this._MaxMonth), _year); 1014 | } 1015 | 1016 | this._setPickerYear( _year ); 1017 | }, 1018 | 1019 | _decorateButtons: function() { 1020 | var _curYear = this._getPickerYear(), _todaysMonth = _toMonth(new Date), 1021 | _minDate = this._MinMonth, _maxDate = this._MaxMonth; 1022 | 1023 | // Heighlight the selected month. 1024 | _setActive( this._selectedBtn, false ); 1025 | var _sel = this.GetSelectedDate(); 1026 | var _withinBounds = _between(_sel ? _toMonth(_sel) : null, _minDate, _maxDate); 1027 | 1028 | if (_sel && _sel.getFullYear() === _curYear) { 1029 | this._selectedBtn = _setActive( $(this._buttons[_sel.getMonth()]) , _withinBounds ); 1030 | } 1031 | 1032 | // Disable the next/prev button if we've reached the min/max year. 1033 | _setDisabled(this._prevButton, _minDate && _curYear == _toYear(_minDate)); 1034 | _setDisabled(this._nextButton, _maxDate && _curYear == _toYear(_maxDate)); 1035 | 1036 | for (var i = 0; i < 12; i++) { 1037 | // Disable the button if the month is not between the 1038 | // min and max interval. 1039 | var _month = (_curYear * 12) + i, _isBetween = _between(_month, _minDate, _maxDate); 1040 | 1041 | $(this._buttons[i]) 1042 | .jqueryUIButton({ disabled: !_isBetween }) 1043 | .toggleClass(_todayClass, _isBetween && _month == _todaysMonth); // Highlights today's month. 1044 | } 1045 | } 1046 | }); 1047 | }(jQuery, window, document, Date)); 1048 | -------------------------------------------------------------------------------- /test/test.css: -------------------------------------------------------------------------------- 1 | /******* ***************** ********/ 2 | 3 | /* Unit Testing and demo aon JSFiddle CSS */ 4 | 5 | /******* ***************** ********/ 6 | body { 7 | font-size: 12px; 8 | font-family: Verdana, Arial, sans-serif; 9 | } 10 | .option-block { 11 | background-color: #e1e1e1; 12 | display: none; 13 | padding: 4px; 14 | border: solid 1px Black; 15 | } 16 | .option { 17 | margin: 20px; 18 | border: solid 1px Gray; 19 | padding: 4px; 20 | } 21 | .option-link { 22 | text-decoration: underline; 23 | color: Blue; 24 | cursor: pointer; 25 | font-weight: bold; 26 | } 27 | .option-link:hover { 28 | color: Red; 29 | } 30 | .option-type { 31 | margin: 0 25px; 32 | } 33 | .demo { 34 | background-color: #e1e1e1; 35 | padding: 8px; 36 | border: solid 1px Gray; 37 | } 38 | 39 | .demo-position { 40 | background-color: #e1e1e1; 41 | padding: 8px; 42 | border: solid 1px Gray; 43 | width:100%; 44 | } 45 | .text-right{ 46 | text-align: right; 47 | } 48 | -------------------------------------------------------------------------------- /test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | jQuery UI Month Picker tests 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 51 |
52 |

Version @VERSION

53 | 54 |
.position() Integration Demonstration 55 | 56 |
This demonstrates the Month Picker integration with the optional .position() plugin. The right aligned input 57 | helps to show how the menu will not allow the edges of the window to hide it's appearance. This test should remain 58 | first in the list so that no automated scrolling is needed. 59 |

60 |
Choose a month: 61 | 62 |

63 |
64 | 65 |

Button test 66 |
67 |
Choose a Month: 68 | 69 |
Plain Button: 70 | 71 |
Image Button: 72 | 73 |
External element: 74 | 75 |
Open 76 | Open 77 |
78 | 79 | 80 |
81 | 82 |
No button: 83 | 84 |
85 |
ShowOn both: 86 | 87 |

88 | 89 |

Month format test Choose a Month: 90 | 91 |

92 | 93 |

Min/MaxMonth test Choose a Month: 94 | 95 |

96 | 97 |

Right to left Choose a Month: 98 | 99 |

100 | 101 |

Toggle method test Choose a Month: 102 | 103 |

104 | 105 |

Events Choose a Month: 106 | 107 |

108 | 109 |

Today is highlighted Choose a Month: 110 | 111 |

112 | 113 |
Inline menu: 114 |
115 |
116 | 117 |
AltField and AltFormat option test: 118 | 119 | 120 |
121 | 122 |

Only one picker open test First picker: 123 | 124 |
Second picker: 125 | 126 |

127 | 128 |

MinMonth and MaxMonth Demonstration 129 | 130 |
This demonstrates how you can limit the user to choosing months within a given interval. 131 |
132 |
Future months only: 133 |
134 | 135 |
136 |
Past months only: 137 |
138 | 139 |
140 |
18 months from today: 141 |
142 | 143 |

144 |

Start Year Demonstration 145 | 146 |
This demonstrates how the plugin will default to the year specified in the text box. Changing the year in the 147 | text box will result in a new default year for the chooser and if no date is selected then the default year is 148 | the current year. 149 |
150 |
Choose a month: 151 | 152 |

153 |

Override Start Year Demonstration 154 | 155 |
This demonstrates how the MonthPicker can be configured to override the start year default behavior. This MonthPicker 156 | will start on 2023 no matter which date is currently selected, even if no date is specified. 157 |
158 |
Choose a month: 159 | 160 |

161 |

Get Month/Year & Validation API Demonstration 162 | 163 |
This demonstrates API usage for the GetSelectedMonthYear(), GetSelectedYear() and GetSelectedMonth() function 164 | calls which will also perform date validation. Clear() will clear the text field and any validation messages. 165 |
166 |
Choose a month: 167 | 168 |
169 |
170 | 171 | 172 | 173 | 174 |

175 |

Disable/Enable API Demonstration 176 | 177 |
This demonstrates API usage for the Enable() and Disable(). 178 |
179 |
Choose a month: 180 | 181 |
182 | 183 | 184 |

185 |

Digital Bush Integration Demonstration 186 | 187 |
This demonstrates how the MonthPicker plugin integrates with the Digital Bush Plugin for Input Masking as well as the html 5 placeholder attribute to simulate watermarking. Try to type an invalid date and try the 188 | Get Month/Year button to fire off validation. 189 |
190 |
Type in a month/year: 191 |
192 | 193 |
194 |
Type in a month/year:: 195 |
196 | 197 |
198 |
199 | 200 | 201 |

202 | 203 |

HTML 5 Month Input Type Support 204 | 205 |
This demonstrates how the MonthPicker will work with the HTML 5 Month Input Type. View this section using Chrome 206 | to see Google's latest implementation in comparison. 207 |
208 |
Jquery UI Month Picker: 209 | 210 |
211 |
Chrome Month Picker: 212 | 213 |

214 |
215 | 231 |
232 |
233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /test/themes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | jQuery UI Month Picker tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 36 | 37 | 38 | 65 | 66 | 67 | 68 | Theme:
69 | 70 |

71 |

72 |

73 | Example:
74 | 75 | 76 | 77 | --------------------------------------------------------------------------------