├── LICENSE ├── README.md ├── crossword.js ├── index.html ├── lib ├── jScrollPane.css ├── jScrollPane.js ├── jquery.cookie.js ├── jquery.em.js ├── jquery.hotkeys.js ├── jquery.min.js └── jquery.mousewheel.js ├── puzzle.js └── style.css /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | javascript-crossword 2 | ==================== 3 | 4 | A browser-based crossword puzzle implemented in JavaScript. 5 | 6 | The puzzle data is in json format in puzzle.js. Open index.html in a browser to view. 7 | -------------------------------------------------------------------------------- /crossword.js: -------------------------------------------------------------------------------- 1 | /* 2 | A browser-based crossword puzzle implemented in JavaScript 3 | Copyright (C) 2014 Matt Wiseley 4 | 5 | https://github.com/wiseley/javascript-crossword 6 | 7 | This program is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU General Public License 9 | as published by the Free Software Foundation; either version 2 10 | of the License, or (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | function Crossw1rd(container_id) { 23 | 24 | this.container; // container for the grid 25 | this.width = 0; // how many cells wide 26 | this.height = 0; // how many cells high 27 | this.clues; // data used to populate puzzle 28 | this.cells = []; // 2 dim array of cells in grid [y][x] 29 | this.grid; 30 | this.direction = 'A'; // A=across, D=down 31 | this.id; // puzzle identifier - gets set in init 32 | this.saved = true; // gets set to false when answers have changed 33 | this.autosave = true; 34 | var self = this; 35 | 36 | // initializer 37 | this.init = function(id) { 38 | var c = $("#"+container_id); 39 | c.empty(); 40 | this.id = id; 41 | this.container = $('
').appendTo(c); 42 | this.populateClues(function() { 43 | self.initDimensions(); 44 | self.drawClues(); 45 | self.drawGrid(); 46 | self.drawControls(); 47 | self.adjustDimensions(); 48 | self.mapKeyBindings(); 49 | // check for & load saved state 50 | var state = $.cookie('crossw1rd.'+id); 51 | if (state!=null) self.resume(state); 52 | // turn on autosave 53 | if (self.autosave) { 54 | setInterval(self.save, 1000); 55 | } 56 | }); 57 | } 58 | 59 | // populate the array of clues - must be in word number order 60 | this.populateClues = function(continueInit) { 61 | var idre = new RegExp('[0-9a-zA-Z]+'); 62 | if (!idre.test(this.id)) alert('Invalid ID'); 63 | this.clues = $.ajax({ 64 | type: 'GET', 65 | dataType: 'json', 66 | url: this.id+'.js', 67 | success: function(data) { 68 | self.puzzle = data; 69 | self.clues = data.clues; 70 | continueInit(); 71 | }, 72 | error: function(jqXHR, textStatus, errorThrown) { 73 | console.log(jqXHR, textStatus, errorThrown); 74 | self.container.text("I couldn't retrieve that puzzle :("); 75 | } 76 | }); 77 | } 78 | 79 | // establish puzzle dimensions 80 | this.initDimensions = function() { 81 | for (var i=0; ithis.width) this.width = c.x + c.a.length; 84 | if (c.d=='D' && (c.y + c.a.length)>this.height) this.height = c.y + c.a.length; 85 | } 86 | } 87 | 88 | // draw the grid 89 | this.drawGrid = function() { 90 | // create grid container 91 | this.grid = $('
').appendTo(this.container); 92 | 93 | // set height and width 94 | this.grid.attr('style','height:'+(this.height*28)+'px; width:'+(this.width*28)+'px;'); 95 | 96 | // add rows and cols and store cells in this.cells 97 | this.cells = []; 98 | for (var r=0; r').appendTo(this.grid); 100 | this.cells[r] = []; 101 | for (var c=0; c').appendTo(row); 103 | this.cells[r][c] = cell; 104 | } 105 | } 106 | 107 | // populate letters 108 | for (var i=0; i'+clue.n+'').prependTo(cell); 116 | } 117 | cell.addClass((clue.d=='A'?'across':'down')+clue.n); 118 | // add all the letters in the word 119 | for (var c=0; c').appendTo(cell); 127 | } 128 | } 129 | } 130 | } 131 | 132 | // draw clues 133 | this.drawClues = function() { 134 | var cluediv = $('
').appendTo(this.container); 135 | cluediv.append('

Across

'); 136 | var aol = $('
').appendTo(cluediv); 137 | cluediv.append('

Down

'); 138 | var dol = $('
').appendTo(cluediv); 139 | for (var i=0; i

').appendTo(aol); 144 | } 145 | else { 146 | li = $('

').appendTo(dol); 147 | } 148 | li.addClass('c'+clue.d+clue.n); 149 | li.text(clue.n + '. ' + clue.c); 150 | li.data('clueix',i); 151 | li.click(this.clue_click); 152 | } 153 | } 154 | 155 | // handle click of a clue 156 | this.clue_click = function(ev) { 157 | var clicked = $(this); 158 | var clue = self.clues[clicked.data('clueix')]; 159 | self.direction = clue.d; 160 | var cell = self.cells[clue.y][clue.x]; 161 | cell.click(); 162 | self.activateClue(clicked); 163 | } 164 | this.activateClue = function (li) { 165 | self.container.find('.active_clue').removeClass('active_clue'); 166 | li.addClass('active_clue'); 167 | var paddingMarginOffset = 8; 168 | var top = li.position().top - li.parent().position().top - paddingMarginOffset; 169 | self.container.find('.clues ' + 170 | (self.direction=='A'?'.across':'.down') 171 | ).scrollTop(top); 172 | } 173 | 174 | // draw controls 175 | this.drawControls = function() { 176 | var div = $('
').appendTo(this.container); 177 | var reset = $('').appendTo(div);; 178 | reset.click(this.reset); 179 | } 180 | 181 | // set container dimensions based on grid size 182 | this.adjustDimensions = function() { 183 | var clueW = 200; 184 | var padding = 20; 185 | var h = this.grid.height(); 186 | var w = this.grid.width(); 187 | var ctrlH = this.container.find('.controls').height(); 188 | this.container.width(h+padding+clueW); 189 | this.container.height(h+6+ctrlH); 190 | this.container.find('.clues').width(clueW); 191 | this.container.find('.clues').height(h); 192 | var labelh = $(".clues h4").height(); 193 | $(".clues .across, .clues .down").height((h/2)-(labelh*2)); 194 | } 195 | 196 | /*** NAVIGATION & ENTRY ***/ 197 | 198 | // get the cell to the left 199 | this.cellLeft = function(cell, sameWord, includeBlanks) { 200 | while (true) { 201 | cell = cell.prev(); 202 | if (cell.length==0) return cell; 203 | if (!cell.hasClass('blank') || includeBlanks) return cell; 204 | if (cell.hasClass('blank') && sameWord) return $(); 205 | } 206 | } 207 | 208 | // get the cell to the right 209 | this.cellRight = function(cell, sameWord, includeBlanks) { 210 | while (true) { 211 | cell = cell.next(); 212 | if (cell.length==0) return cell; 213 | if (!cell.hasClass('blank') || includeBlanks) return cell; 214 | if (cell.hasClass('blank') && sameWord) return $(); 215 | } 216 | } 217 | 218 | // get the cell above 219 | this.cellAbove = function(cell, sameWord, includeBlanks) { 220 | var ix = cell.index(); 221 | while (true) { 222 | cell = cell.parent().prev(); 223 | if (cell.length==0) return cell; 224 | cell = cell.children(':eq('+ix+')'); 225 | if (!cell.hasClass('blank') || includeBlanks) return cell; 226 | if (cell.hasClass('blank') && sameWord) return $(); 227 | } 228 | } 229 | 230 | // get the cell below 231 | this.cellBelow = function(cell, sameWord, includeBlanks) { 232 | var ix = cell.index(); 233 | while (true) { 234 | cell = cell.parent().next(); 235 | if (cell.length==0) return cell; 236 | cell = cell.children(':eq('+ix+')'); 237 | if (!cell.hasClass('blank') || includeBlanks) return cell; 238 | if (cell.hasClass('blank') && sameWord) return $(); 239 | } 240 | } 241 | 242 | // return the number of the current word given a letter cell 243 | this.wordNumber = function(cell) { 244 | var num; 245 | if (this.direction=='A') { 246 | var firstLetter=cell; 247 | while ((cell=this.cellLeft(cell,true)).length>0) { 248 | firstLetter = cell; 249 | } 250 | num= firstLetter.find('.num').text(); 251 | } 252 | else if (this.direction=='D') { 253 | var firstLetter = cell; 254 | while ((cell=this.cellAbove(cell,true)).length>0) { 255 | firstLetter = cell; 256 | } 257 | num = firstLetter.find('.num').text(); 258 | } 259 | return num; 260 | } 261 | 262 | // return the cell of the first letter of the next word given a current word number 263 | this.nextWord = function(curWordNum) { 264 | for (var i=0; i curWordNum) { 267 | var nextWord = this.grid.find('.'+(this.direction=='D'?'down':'across')+c.n); 268 | return nextWord; 269 | } 270 | } 271 | // get first word 272 | return this.nextWord(0); 273 | } 274 | 275 | // return the cell of the first letter of the previous word given a current word number 276 | this.prevWord = function(curWordNum) { 277 | for (var i=this.clues.length-1; i>=0; i--) { 278 | var c = this.clues[i]; 279 | if (c.d==this.direction && c.n < curWordNum) { 280 | var prevWord = this.grid.find('.'+(this.direction=='D'?'down':'across')+c.n); 281 | return prevWord; 282 | } 283 | } 284 | // get last word 285 | return this.prevWord(Number.MAX_VALUE); 286 | } 287 | 288 | // activate a cell & set current word 289 | this.activateCell = function(cell, changedDir) { 290 | this.grid.find(".row > div").removeClass('active'); 291 | this.grid.find(".row > div").removeClass('word'); 292 | cell = $(cell); 293 | cell.addClass('active'); 294 | cell.addClass('word'); 295 | if (this.direction=='A') { 296 | var prev = cell; 297 | while ((prev = this.cellLeft(prev, true)).length>0) { 298 | prev.addClass('word'); 299 | } 300 | var next = cell; 301 | while ((next = this.cellRight(next, true)).length>0) { 302 | next.addClass('word'); 303 | } 304 | } 305 | if (this.direction=='D') { 306 | prev = cell; 307 | while ((prev = this.cellAbove(prev, true)).length>0) { 308 | prev.addClass('word') 309 | } 310 | next = cell; 311 | while ((next = this.cellBelow(next, true)).length>0) { 312 | next.addClass('word') 313 | } 314 | } 315 | // change direction if we're not in a word 316 | if (this.grid.find('.word').length==1 && typeof changedDir=='undefined') { 317 | this.direction = this.direction=='A'?'D':'A'; 318 | this.activateCell(cell, true); 319 | } 320 | else { 321 | // select clue 322 | var wordNum = this.wordNumber(cell); 323 | var ol; 324 | if (this.direction=='A') ol = this.container.find(".clues .across"); 325 | else ol = this.container.find(".clues .down"); 326 | var li = ol.find('p.c'+this.direction+wordNum); 327 | this.activateClue(li); 328 | } 329 | } 330 | 331 | // key bindings 332 | this.mapKeyBindings = function() { 333 | // the current Crossw1rd instance 334 | 335 | // activate cell on click 336 | this.grid.find(".row > div").click(function(ev) { 337 | if (!$(this).hasClass('blank')) { 338 | self.activateCell(this); 339 | } 340 | }); 341 | 342 | // alphanumeric 343 | for (var i=48; i<=90; i++) { 344 | // numbers (48-57) letters (65-90) 345 | if ((i >= 48 && i <= 57) || (i>=65 && i<= 90)) { 346 | $(document).bind('keypress', String.fromCharCode(i), function(e) { 347 | // insert the character 348 | var c = String.fromCharCode(Crossw1rd.keyCode(e)).toUpperCase(); 349 | var active = self.grid.find('.active'); 350 | active.children('.letter').text(c); 351 | self.saved = false; 352 | // move to the next cell 353 | var next; 354 | if (self.direction=='A') { 355 | next = self.cellRight(active,true); 356 | } else { 357 | next = self.cellBelow(active,true); 358 | } 359 | if (next.length>0) next.click(); 360 | return false; 361 | }); 362 | } 363 | } 364 | 365 | // arrow keys - left 366 | $(document).bind('keydown', 'left', function() { 367 | var c = self.grid.find(".active"); 368 | if (c.length==0) return; 369 | c = c.prev(); 370 | while (true) { 371 | if (c.length==0) return false; 372 | if (c.hasClass('blank')) { 373 | c = c.prev(); 374 | continue; 375 | } 376 | c.click(); 377 | return false; 378 | } 379 | }); 380 | // arrow keys - right 381 | $(document).bind('keydown', 'right', function() { 382 | var c = self.grid.find(".active"); 383 | if (c.length==0) return; 384 | c = self.cellRight(c); 385 | if (c.length>0) c.click(); 386 | return false; 387 | }); 388 | // arrow keys - up 389 | $(document).bind('keydown', 'up', function() { 390 | var c = self.grid.find(".active"); 391 | if (c.length==0) return; 392 | c = self.cellAbove(c); 393 | if (c.length>0) c.click(); 394 | return false; 395 | }); 396 | // arrow keys - down 397 | $(document).bind('keydown', 'down', function() { 398 | var c = self.grid.find(".active"); 399 | if (c.length==0) return; 400 | c = self.cellBelow(c); 401 | if (c.length>0) c.click(); 402 | return false; 403 | }); 404 | // backspace - clear current cell and move left within current word 405 | $(document).bind('keydown', 'backspace', function() { 406 | var c = self.grid.find(".active"); 407 | if (c.length==0) return; 408 | c.find('.letter').text(''); 409 | self.saved = false; 410 | c.removeClass('incorrect'); 411 | c.removeClass('correct'); 412 | c = self.cellLeft(c); 413 | if (c.length>0) c.click(); 414 | }); 415 | // delete - clear current cell 416 | $(document).bind('keydown', 'del', function() { 417 | var c = self.grid.find(".active"); 418 | if (c.length==0) return; 419 | c.find('.letter').text(''); 420 | self.saved = false; 421 | c.removeClass('incorrect'); 422 | c.removeClass('correct'); 423 | }); 424 | // space - change current direction 425 | $(document).bind('keydown', 'space', function() { 426 | self.direction = self.direction=='A'?'D':'A'; 427 | var active = self.grid.find('.active'); 428 | if (active.length>0) self.activateCell(active[0]); 429 | }); 430 | // tab - next word 431 | $(document).bind('keydown', 'tab', function() { 432 | var cell = self.grid.find('.active'); 433 | var curWordNum = self.wordNumber(cell); 434 | var nextWord = self.nextWord(curWordNum); 435 | self.activateCell(nextWord); 436 | return false; 437 | }); 438 | // shift+tab - prev word 439 | $(document).bind('keydown', 'shift+tab', function() { 440 | var cell = self.grid.find('.active'); 441 | var curWordNum = self.wordNumber(cell); 442 | var prevWord = self.prevWord(curWordNum); 443 | self.activateCell(prevWord); 444 | return false; 445 | }); 446 | // ctrl+shift+l - check letter 447 | $(document).bind('keydown', 'ctrl+shift+l', function() { 448 | self.checkCell(); 449 | }); 450 | // ctrl+shift+w - check word 451 | $(document).bind('keydown', 'ctrl+shift+w', function() { 452 | self.checkWord(); 453 | }); 454 | // ctrl+shift+a - check puzzle 455 | $(document).bind('keydown', 'ctrl+shift+a', function() { 456 | self.checkPuzzle(); 457 | }); 458 | } 459 | 460 | /*** ANSWER CHECKING ***/ 461 | 462 | // check the correctness of the active cell 463 | this.checkCell = function(cell) { 464 | if (typeof cell == 'undefined') cell = this.grid.find('.active'); 465 | var entered = cell.find('.letter').text(); 466 | if (entered=='') return; 467 | if (cell.data('a')==entered) { 468 | cell.addClass('correct'); 469 | cell.removeClass('incorrect'); 470 | } 471 | else { 472 | cell.removeClass('correct'); 473 | cell.addClass('incorrect'); 474 | } 475 | } 476 | 477 | // check the correctness of the current word 478 | this.checkWord = function() { 479 | var cell = this.grid.find('.active'); 480 | var wordNum = this.wordNumber(cell); 481 | for (var i=0; i1) { 528 | throw 'Multiple characters found in cell ['+i+']['+c+']'; 529 | } 530 | else { 531 | state.push(letter); 532 | } 533 | } 534 | } 535 | state.push(delim); // delim between each row 536 | } 537 | return state.join(''); 538 | } 539 | 540 | // load the puzzle and populate answers from serialized puzzle state 541 | this.resume = function(state) { 542 | var delim = state[0]; 543 | var parts = state.split(delim); 544 | parts.shift(); // drop the 1st delimeter 545 | var id = parts.shift(); // get the ID 546 | var settingslen = parts.shift(); // the number of settings 547 | var settings = {}; 548 | // convert settings to an object 549 | for (var i=0; i 2 | 3 | JavaScript Crossword 4 | 5 | 6 | 7 | 8 | 9 | 17 | 18 | 19 | 20 |
21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /lib/jScrollPane.css: -------------------------------------------------------------------------------- 1 | 2 | .jScrollPaneContainer { 3 | position: relative; 4 | overflow: hidden; 5 | z-index: 1; 6 | } 7 | 8 | .jScrollPaneTrack { 9 | position: absolute; 10 | cursor: pointer; 11 | right: 0; 12 | top: 0; 13 | height: 100%; 14 | background: #aaa; 15 | } 16 | .jScrollPaneDrag { 17 | position: absolute; 18 | background: #666; 19 | cursor: pointer; 20 | overflow: hidden; 21 | } 22 | .jScrollPaneDragTop { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | overflow: hidden; 27 | } 28 | .jScrollPaneDragBottom { 29 | position: absolute; 30 | bottom: 0; 31 | left: 0; 32 | overflow: hidden; 33 | } 34 | a.jScrollArrowUp { 35 | display: block; 36 | position: absolute; 37 | z-index: 1; 38 | top: 0; 39 | right: 0; 40 | text-indent: -2000px; 41 | overflow: hidden; 42 | /*background-color: #666;*/ 43 | height: 9px; 44 | } 45 | a.jScrollArrowUp:hover { 46 | /*background-color: #f60;*/ 47 | } 48 | 49 | a.jScrollArrowDown { 50 | display: block; 51 | position: absolute; 52 | z-index: 1; 53 | bottom: 0; 54 | right: 0; 55 | text-indent: -2000px; 56 | overflow: hidden; 57 | /*background-color: #666;*/ 58 | height: 9px; 59 | } 60 | a.jScrollArrowDown:hover { 61 | /*background-color: #f60;*/ 62 | } 63 | a.jScrollActiveArrowButton, a.jScrollActiveArrowButton:hover { 64 | /*background-color: #f00;*/ 65 | } -------------------------------------------------------------------------------- /lib/jScrollPane.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2009 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com) 2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 | * 5 | * See http://kelvinluck.com/assets/jquery/jScrollPane/ 6 | * $Id$ 7 | */ 8 | 9 | /** 10 | * Replace the vertical scroll bars on any matched elements with a fancy 11 | * styleable (via CSS) version. With JS disabled the elements will 12 | * gracefully degrade to the browsers own implementation of overflow:auto. 13 | * If the mousewheel plugin has been included on the page then the scrollable areas will also 14 | * respond to the mouse wheel. 15 | * 16 | * @example jQuery(".scroll-pane").jScrollPane(); 17 | * 18 | * @name jScrollPane 19 | * @type jQuery 20 | * @param Object settings hash with options, described below. 21 | * scrollbarWidth - The width of the generated scrollbar in pixels 22 | * scrollbarMargin - The amount of space to leave on the side of the scrollbar in pixels 23 | * wheelSpeed - The speed the pane will scroll in response to the mouse wheel in pixels 24 | * showArrows - Whether to display arrows for the user to scroll with 25 | * arrowSize - The height of the arrow buttons if showArrows=true 26 | * animateTo - Whether to animate when calling scrollTo and scrollBy 27 | * dragMinHeight - The minimum height to allow the drag bar to be 28 | * dragMaxHeight - The maximum height to allow the drag bar to be 29 | * animateInterval - The interval in milliseconds to update an animating scrollPane (default 100) 30 | * animateStep - The amount to divide the remaining scroll distance by when animating (default 3) 31 | * maintainPosition- Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true) 32 | * tabIndex - The tabindex for this jScrollPane to control when it is tabbed to when navigating via keyboard (default 0) 33 | * enableKeyboardNavigation - Whether to allow keyboard scrolling of this jScrollPane when it is focused (default true) 34 | * animateToInternalLinks - Whether the move to an internal link (e.g. when it's focused by tabbing or by a hash change in the URL) should be animated or instant (default false) 35 | * scrollbarOnLeft - Display the scrollbar on the left side? (needs stylesheet changes, see examples.html) 36 | * reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded (default false) 37 | * topCapHeight - The height of the "cap" area between the top of the jScrollPane and the top of the track/ buttons 38 | * bottomCapHeight - The height of the "cap" area between the bottom of the jScrollPane and the bottom of the track/ buttons 39 | * observeHash - Whether jScrollPane should attempt to automagically scroll to the correct place when an anchor inside the scrollpane is linked to (default true) 40 | * @return jQuery 41 | * @cat Plugins/jScrollPane 42 | * @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com) 43 | */ 44 | 45 | (function($) { 46 | 47 | $.jScrollPane = { 48 | active : [] 49 | }; 50 | $.fn.jScrollPane = function(settings) 51 | { 52 | settings = $.extend({}, $.fn.jScrollPane.defaults, settings); 53 | 54 | var rf = function() { return false; }; 55 | 56 | return this.each( 57 | function() 58 | { 59 | var $this = $(this); 60 | var paneEle = this; 61 | var currentScrollPosition = 0; 62 | var paneWidth; 63 | var paneHeight; 64 | var trackHeight; 65 | var trackOffset = settings.topCapHeight; 66 | var $container; 67 | 68 | if ($(this).parent().is('.jScrollPaneContainer')) { 69 | $container = $(this).parent(); 70 | currentScrollPosition = settings.maintainPosition ? $this.position().top : 0; 71 | var $c = $(this).parent(); 72 | paneWidth = $c.innerWidth(); 73 | paneHeight = $c.outerHeight(); 74 | $('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap', $c).remove(); 75 | $this.css({'top':0}); 76 | } else { 77 | $this.data('originalStyleTag', $this.attr('style')); 78 | // Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208] 79 | $this.css('overflow', 'hidden'); 80 | this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft'); 81 | this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0); 82 | paneWidth = $this.innerWidth(); 83 | paneHeight = $this.innerHeight(); 84 | $container = $('
') 85 | .attr({'className':'jScrollPaneContainer'}) 86 | .css( 87 | { 88 | 'height':paneHeight+'px', 89 | 'width':paneWidth+'px' 90 | } 91 | ); 92 | if (settings.enableKeyboardNavigation) { 93 | $container.attr( 94 | 'tabindex', 95 | settings.tabIndex 96 | ); 97 | } 98 | $this.wrap($container); 99 | $container = $this.parent(); 100 | // deal with text size changes (if the jquery.em plugin is included) 101 | // and re-initialise the scrollPane so the track maintains the 102 | // correct size 103 | $(document).bind( 104 | 'emchange', 105 | function(e, cur, prev) 106 | { 107 | $this.jScrollPane(settings); 108 | } 109 | ); 110 | 111 | } 112 | trackHeight = paneHeight; 113 | 114 | if (settings.reinitialiseOnImageLoad) { 115 | // code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad 116 | // except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size... 117 | // TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise? 118 | var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this); 119 | var loadedImages = []; 120 | 121 | if ($imagesToLoad.length) { 122 | $imagesToLoad.each(function(i, val) { 123 | $(this).bind('load readystatechange', function() { 124 | if($.inArray(i, loadedImages) == -1){ //don't double count images 125 | loadedImages.push(val); //keep a record of images we've seen 126 | $imagesToLoad = $.grep($imagesToLoad, function(n, i) { 127 | return n != val; 128 | }); 129 | $.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad); 130 | var s2 = $.extend(settings, {reinitialiseOnImageLoad:false}); 131 | $this.jScrollPane(s2); // re-initialise 132 | } 133 | }).each(function(i, val) { 134 | if(this.complete || this.complete===undefined) { 135 | //needed for potential cached images 136 | this.src = this.src; 137 | } 138 | }); 139 | }); 140 | }; 141 | } 142 | 143 | var p = this.originalSidePaddingTotal; 144 | var realPaneWidth = paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p; 145 | 146 | var cssToApply = { 147 | 'height':'auto', 148 | 'width': realPaneWidth + 'px' 149 | } 150 | 151 | if(settings.scrollbarOnLeft) { 152 | cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px'; 153 | } else { 154 | cssToApply.paddingRight = settings.scrollbarMargin + 'px'; 155 | } 156 | 157 | $this.css(cssToApply); 158 | 159 | var contentHeight = $this.outerHeight(); 160 | var percentInView = paneHeight / contentHeight; 161 | 162 | var isScrollable = percentInView < .99; 163 | $container[isScrollable ? 'addClass' : 'removeClass']('jScrollPaneScrollable'); 164 | 165 | if (isScrollable) { 166 | $container.append( 167 | $('
').addClass('jScrollCap jScrollCapTop').css({height:settings.topCapHeight}), 168 | $('
').attr({'className':'jScrollPaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append( 169 | $('
').attr({'className':'jScrollPaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append( 170 | $('
').attr({'className':'jScrollPaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}), 171 | $('
').attr({'className':'jScrollPaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'}) 172 | ) 173 | ), 174 | $('
').addClass('jScrollCap jScrollCapBottom').css({height:settings.bottomCapHeight}) 175 | ); 176 | 177 | var $track = $('>.jScrollPaneTrack', $container); 178 | var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container); 179 | 180 | 181 | var currentArrowDirection; 182 | var currentArrowTimerArr = [];// Array is used to store timers since they can stack up when dealing with keyboard events. This ensures all timers are cleaned up in the end, preventing an acceleration bug. 183 | var currentArrowInc; 184 | var whileArrowButtonDown = function() 185 | { 186 | if (currentArrowInc > 4 || currentArrowInc % 4 == 0) { 187 | positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier); 188 | } 189 | currentArrowInc++; 190 | }; 191 | 192 | if (settings.enableKeyboardNavigation) { 193 | $container.bind( 194 | 'keydown.jscrollpane', 195 | function(e) 196 | { 197 | switch (e.keyCode) { 198 | case 38: //up 199 | currentArrowDirection = -1; 200 | currentArrowInc = 0; 201 | whileArrowButtonDown(); 202 | currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100); 203 | return false; 204 | case 40: //down 205 | currentArrowDirection = 1; 206 | currentArrowInc = 0; 207 | whileArrowButtonDown(); 208 | currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100); 209 | return false; 210 | case 33: // page up 211 | case 34: // page down 212 | // TODO 213 | return false; 214 | default: 215 | } 216 | } 217 | ).bind( 218 | 'keyup.jscrollpane', 219 | function(e) 220 | { 221 | if (e.keyCode == 38 || e.keyCode == 40) { 222 | for (var i = 0; i < currentArrowTimerArr.length; i++) { 223 | clearInterval(currentArrowTimerArr[i]); 224 | } 225 | return false; 226 | } 227 | } 228 | ); 229 | } 230 | 231 | if (settings.showArrows) { 232 | 233 | var currentArrowButton; 234 | var currentArrowInterval; 235 | 236 | var onArrowMouseUp = function(event) 237 | { 238 | $('html').unbind('mouseup', onArrowMouseUp); 239 | currentArrowButton.removeClass('jScrollActiveArrowButton'); 240 | clearInterval(currentArrowInterval); 241 | }; 242 | var onArrowMouseDown = function() { 243 | $('html').bind('mouseup', onArrowMouseUp); 244 | currentArrowButton.addClass('jScrollActiveArrowButton'); 245 | currentArrowInc = 0; 246 | whileArrowButtonDown(); 247 | currentArrowInterval = setInterval(whileArrowButtonDown, 100); 248 | }; 249 | $container 250 | .append( 251 | $('') 252 | .attr( 253 | { 254 | 'href':'javascript:;', 255 | 'className':'jScrollArrowUp', 256 | 'tabindex':-1 257 | } 258 | ) 259 | .css( 260 | { 261 | 'width':settings.scrollbarWidth+'px', 262 | 'top':settings.topCapHeight + 'px' 263 | } 264 | ) 265 | .html('Scroll up') 266 | .bind('mousedown', function() 267 | { 268 | currentArrowButton = $(this); 269 | currentArrowDirection = -1; 270 | onArrowMouseDown(); 271 | this.blur(); 272 | return false; 273 | }) 274 | .bind('click', rf), 275 | $('') 276 | .attr( 277 | { 278 | 'href':'javascript:;', 279 | 'className':'jScrollArrowDown', 280 | 'tabindex':-1 281 | } 282 | ) 283 | .css( 284 | { 285 | 'width':settings.scrollbarWidth+'px', 286 | 'bottom':settings.bottomCapHeight + 'px' 287 | } 288 | ) 289 | .html('Scroll down') 290 | .bind('mousedown', function() 291 | { 292 | currentArrowButton = $(this); 293 | currentArrowDirection = 1; 294 | onArrowMouseDown(); 295 | this.blur(); 296 | return false; 297 | }) 298 | .bind('click', rf) 299 | ); 300 | var $upArrow = $('>.jScrollArrowUp', $container); 301 | var $downArrow = $('>.jScrollArrowDown', $container); 302 | } 303 | 304 | if (settings.arrowSize) { 305 | trackHeight = paneHeight - settings.arrowSize - settings.arrowSize; 306 | trackOffset += settings.arrowSize; 307 | } else if ($upArrow) { 308 | var topArrowHeight = $upArrow.height(); 309 | settings.arrowSize = topArrowHeight; 310 | trackHeight = paneHeight - topArrowHeight - $downArrow.height(); 311 | trackOffset += topArrowHeight; 312 | } 313 | trackHeight -= settings.topCapHeight + settings.bottomCapHeight; 314 | $track.css({'height': trackHeight+'px', top:trackOffset+'px'}) 315 | 316 | var $pane = $(this).css({'position':'absolute', 'overflow':'visible'}); 317 | 318 | var currentOffset; 319 | var maxY; 320 | var mouseWheelMultiplier; 321 | // store this in a seperate variable so we can keep track more accurately than just updating the css property.. 322 | var dragPosition = 0; 323 | var dragMiddle = percentInView*paneHeight/2; 324 | 325 | // pos function borrowed from tooltip plugin and adapted... 326 | var getPos = function (event, c) { 327 | var p = c == 'X' ? 'Left' : 'Top'; 328 | return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0; 329 | }; 330 | 331 | var ignoreNativeDrag = function() { return false; }; 332 | 333 | var initDrag = function() 334 | { 335 | ceaseAnimation(); 336 | currentOffset = $drag.offset(false); 337 | currentOffset.top -= dragPosition; 338 | maxY = trackHeight - $drag[0].offsetHeight; 339 | mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight; 340 | }; 341 | 342 | var onStartDrag = function(event) 343 | { 344 | initDrag(); 345 | dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top; 346 | $('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll).bind('mouseleave', onStopDrag) 347 | if ($.browser.msie) { 348 | $('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag); 349 | } 350 | return false; 351 | }; 352 | var onStopDrag = function() 353 | { 354 | $('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll); 355 | dragMiddle = percentInView*paneHeight/2; 356 | if ($.browser.msie) { 357 | $('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag); 358 | } 359 | }; 360 | var positionDrag = function(destY) 361 | { 362 | $container.scrollTop(0); 363 | destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY); 364 | dragPosition = destY; 365 | $drag.css({'top':destY+'px'}); 366 | var p = destY / maxY; 367 | $this.data('jScrollPanePosition', (paneHeight-contentHeight)*-p); 368 | $pane.css({'top':((paneHeight-contentHeight)*p) + 'px'}); 369 | $this.trigger('scroll'); 370 | if (settings.showArrows) { 371 | $upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled'); 372 | $downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled'); 373 | } 374 | }; 375 | var updateScroll = function(e) 376 | { 377 | positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle); 378 | }; 379 | 380 | var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight); 381 | 382 | $drag.css( 383 | {'height':dragH+'px'} 384 | ).bind('mousedown', onStartDrag); 385 | 386 | var trackScrollInterval; 387 | var trackScrollInc; 388 | var trackScrollMousePos; 389 | var doTrackScroll = function() 390 | { 391 | if (trackScrollInc > 8 || trackScrollInc%4==0) { 392 | positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2))); 393 | } 394 | trackScrollInc ++; 395 | }; 396 | var onStopTrackClick = function() 397 | { 398 | clearInterval(trackScrollInterval); 399 | $('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove); 400 | }; 401 | var onTrackMouseMove = function(event) 402 | { 403 | trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle; 404 | }; 405 | var onTrackClick = function(event) 406 | { 407 | initDrag(); 408 | onTrackMouseMove(event); 409 | trackScrollInc = 0; 410 | $('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove); 411 | trackScrollInterval = setInterval(doTrackScroll, 100); 412 | doTrackScroll(); 413 | return false; 414 | }; 415 | 416 | $track.bind('mousedown', onTrackClick); 417 | 418 | $container.bind( 419 | 'mousewheel', 420 | function (event, delta) { 421 | delta = delta || (event.wheelDelta ? event.wheelDelta / 120 : (event.detail) ? 422 | -event.detail/3 : 0); 423 | initDrag(); 424 | ceaseAnimation(); 425 | var d = dragPosition; 426 | positionDrag(dragPosition - delta * mouseWheelMultiplier); 427 | var dragOccured = d != dragPosition; 428 | return !dragOccured; 429 | } 430 | ); 431 | 432 | var _animateToPosition; 433 | var _animateToInterval; 434 | function animateToPosition() 435 | { 436 | var diff = (_animateToPosition - dragPosition) / settings.animateStep; 437 | if (diff > 1 || diff < -1) { 438 | positionDrag(dragPosition + diff); 439 | } else { 440 | positionDrag(_animateToPosition); 441 | ceaseAnimation(); 442 | } 443 | } 444 | var ceaseAnimation = function() 445 | { 446 | if (_animateToInterval) { 447 | clearInterval(_animateToInterval); 448 | delete _animateToPosition; 449 | } 450 | }; 451 | var scrollTo = function(pos, preventAni) 452 | { 453 | if (typeof pos == "string") { 454 | // Legal hash values aren't necessarily legal jQuery selectors so we need to catch any 455 | // errors from the lookup... 456 | try { 457 | $e = $(pos, $this); 458 | } catch (err) { 459 | return; 460 | } 461 | if (!$e.length) return; 462 | pos = $e.offset().top - $this.offset().top; 463 | } 464 | ceaseAnimation(); 465 | var maxScroll = contentHeight - paneHeight; 466 | pos = pos > maxScroll ? maxScroll : pos; 467 | $this.data('jScrollPaneMaxScroll', maxScroll); 468 | var destDragPosition = pos/maxScroll * maxY; 469 | if (preventAni || !settings.animateTo) { 470 | positionDrag(destDragPosition); 471 | } else { 472 | $container.scrollTop(0); 473 | _animateToPosition = destDragPosition; 474 | _animateToInterval = setInterval(animateToPosition, settings.animateInterval); 475 | } 476 | }; 477 | $this[0].scrollTo = scrollTo; 478 | 479 | $this[0].scrollBy = function(delta) 480 | { 481 | var currentPos = -parseInt($pane.css('top')) || 0; 482 | scrollTo(currentPos + delta); 483 | }; 484 | 485 | initDrag(); 486 | 487 | scrollTo(-currentScrollPosition, true); 488 | 489 | // Deal with it when the user tabs to a link or form element within this scrollpane 490 | $('*', this).bind( 491 | 'focus', 492 | function(event) 493 | { 494 | var $e = $(this); 495 | 496 | // loop through parents adding the offset top of any elements that are relatively positioned between 497 | // the focused element and the jScrollPaneContainer so we can get the true distance from the top 498 | // of the focused element to the top of the scrollpane... 499 | var eleTop = 0; 500 | 501 | var preventInfiniteLoop = 100; 502 | 503 | while ($e[0] != $this[0]) { 504 | eleTop += $e.position().top; 505 | $e = $e.offsetParent(); 506 | if (!preventInfiniteLoop--) { 507 | return; 508 | } 509 | } 510 | 511 | var viewportTop = -parseInt($pane.css('top')) || 0; 512 | var maxVisibleEleTop = viewportTop + paneHeight; 513 | var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop; 514 | if (!eleInView) { 515 | var destPos = eleTop - settings.scrollbarMargin; 516 | if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom. 517 | destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight; 518 | } 519 | scrollTo(destPos); 520 | } 521 | } 522 | ) 523 | 524 | 525 | if (settings.observeHash) { 526 | if (location.hash && location.hash.length > 1) { 527 | setTimeout(function(){ 528 | scrollTo(location.hash); 529 | }, $.browser.safari ? 100 : 0); 530 | } 531 | 532 | // use event delegation to listen for all clicks on links and hijack them if they are links to 533 | // anchors within our content... 534 | $(document).bind('click', function(e){ 535 | $target = $(e.target); 536 | if ($target.is('a')) { 537 | var h = $target.attr('href'); 538 | if (h && h.substr(0, 1) == '#' && h.length > 1) { 539 | setTimeout(function(){ 540 | scrollTo(h, !settings.animateToInternalLinks); 541 | }, $.browser.safari ? 100 : 0); 542 | } 543 | } 544 | }); 545 | } 546 | 547 | // Deal with dragging and selecting text to make the scrollpane scroll... 548 | function onSelectScrollMouseDown(e) 549 | { 550 | $(document).bind('mousemove.jScrollPaneDragging', onTextSelectionScrollMouseMove); 551 | $(document).bind('mouseup.jScrollPaneDragging', onSelectScrollMouseUp); 552 | 553 | } 554 | 555 | var textDragDistanceAway; 556 | var textSelectionInterval; 557 | 558 | function onTextSelectionInterval() 559 | { 560 | direction = textDragDistanceAway < 0 ? -1 : 1; 561 | $this[0].scrollBy(textDragDistanceAway / 2); 562 | } 563 | 564 | function clearTextSelectionInterval() 565 | { 566 | if (textSelectionInterval) { 567 | clearInterval(textSelectionInterval); 568 | textSelectionInterval = undefined; 569 | } 570 | } 571 | 572 | function onTextSelectionScrollMouseMove(e) 573 | { 574 | var offset = $this.parent().offset().top; 575 | var maxOffset = offset + paneHeight; 576 | var mouseOffset = getPos(e, 'Y'); 577 | textDragDistanceAway = mouseOffset < offset ? mouseOffset - offset : (mouseOffset > maxOffset ? mouseOffset - maxOffset : 0); 578 | if (textDragDistanceAway == 0) { 579 | clearTextSelectionInterval(); 580 | } else { 581 | if (!textSelectionInterval) { 582 | textSelectionInterval = setInterval(onTextSelectionInterval, 100); 583 | } 584 | } 585 | } 586 | 587 | function onSelectScrollMouseUp(e) 588 | { 589 | $(document) 590 | .unbind('mousemove.jScrollPaneDragging') 591 | .unbind('mouseup.jScrollPaneDragging'); 592 | clearTextSelectionInterval(); 593 | } 594 | 595 | $container.bind('mousedown.jScrollPane', onSelectScrollMouseDown); 596 | 597 | 598 | $.jScrollPane.active.push($this[0]); 599 | 600 | } else { 601 | $this.css( 602 | { 603 | 'height':paneHeight+'px', 604 | 'width':paneWidth-this.originalSidePaddingTotal+'px', 605 | 'padding':this.originalPadding 606 | } 607 | ); 608 | $this[0].scrollTo = $this[0].scrollBy = function() {}; 609 | // clean up listeners 610 | $this.parent().unbind('mousewheel').unbind('mousedown.jScrollPane').unbind('keydown.jscrollpane').unbind('keyup.jscrollpane'); 611 | } 612 | 613 | } 614 | ) 615 | }; 616 | 617 | $.fn.jScrollPaneRemove = function() 618 | { 619 | $(this).each(function() 620 | { 621 | $this = $(this); 622 | var $c = $this.parent(); 623 | if ($c.is('.jScrollPaneContainer')) { 624 | $this.css( 625 | { 626 | 'top':'', 627 | 'height':'', 628 | 'width':'', 629 | 'padding':'', 630 | 'overflow':'', 631 | 'position':'' 632 | } 633 | ); 634 | $this.attr('style', $this.data('originalStyleTag')); 635 | $c.after($this).remove(); 636 | } 637 | }); 638 | } 639 | 640 | $.fn.jScrollPane.defaults = { 641 | scrollbarWidth : 10, 642 | scrollbarMargin : 5, 643 | wheelSpeed : 18, 644 | showArrows : false, 645 | arrowSize : 0, 646 | animateTo : false, 647 | dragMinHeight : 1, 648 | dragMaxHeight : 99999, 649 | animateInterval : 100, 650 | animateStep: 3, 651 | maintainPosition: true, 652 | scrollbarOnLeft: false, 653 | reinitialiseOnImageLoad: false, 654 | tabIndex : 0, 655 | enableKeyboardNavigation: true, 656 | animateToInternalLinks: false, 657 | topCapHeight: 0, 658 | bottomCapHeight: 0, 659 | observeHash: true 660 | }; 661 | 662 | // clean up the scrollTo expandos 663 | $(window) 664 | .bind('unload', function() { 665 | var els = $.jScrollPane.active; 666 | for (var i=0; i 11 | * 12 | * Released under the MIT licence: 13 | * http://www.opensource.org/licenses/mit-license.php 14 | */ 15 | 16 | // Upon $(document).ready()… 17 | jQuery(function($) { 18 | // Configuration… 19 | var eventName = 'emchange'; 20 | 21 | 22 | // Set up default options. 23 | $.em = $.extend({ 24 | /** 25 | * The jQuery-Em version string. 26 | * 27 | * @example $.em.version; 28 | * @desc '1.0a' 29 | * 30 | * @property 31 | * @name version 32 | * @type String 33 | * @cat Plugins/Em 34 | */ 35 | version: '1.0', 36 | 37 | /** 38 | * The number of milliseconds to wait when polling for changes to the 39 | * font size. 40 | * 41 | * @example $.em.delay = 400; 42 | * @desc Defaults to 200. 43 | * 44 | * @property 45 | * @name delay 46 | * @type Number 47 | * @cat Plugins/Em 48 | */ 49 | delay: 200, 50 | 51 | /** 52 | * The element used to detect changes to the font size. 53 | * 54 | * @example $.em.element = $('
')[0]; 55 | * @desc Default is an empty, absolutely positioned, 100em-wide
. 56 | * 57 | * @private 58 | * @property 59 | * @name element 60 | * @type Element 61 | * @cat Plugins/Em 62 | */ 63 | element: $('
').css({ left: '-100em', 64 | position: 'absolute', 65 | width: '100em' }) 66 | .prependTo('body')[0], 67 | 68 | /** 69 | * The action to perform when a change in the font size is detected. 70 | * 71 | * @example $.em.action = function() { ... } 72 | * @desc The default action is to trigger a global “emchange” event. 73 | * You probably shouldn’t change this behaviour as other plugins may 74 | * rely on it, but the option is here for completion. 75 | * 76 | * @example $(document).bind('emchange', function(e, cur, prev) {...}) 77 | * @desc Any functions triggered on this event are passed the current 78 | * font size, and last known font size as additional parameters. 79 | * 80 | * @private 81 | * @property 82 | * @name action 83 | * @type Function 84 | * @cat Plugins/Em 85 | * @see current 86 | * @see previous 87 | */ 88 | action: function() { 89 | var currentWidth = $.em.element.offsetWidth / 100; 90 | 91 | // If the font size has changed since we last checked… 92 | if ( currentWidth != $.em.current ) { 93 | /** 94 | * The previous pixel value of the user agent’s font size. See 95 | * $.em.current for caveats. Will initially be undefined until 96 | * the “emchange” event is triggered. 97 | * 98 | * @example $.em.previous; 99 | * @result 16 100 | * 101 | * @property 102 | * @name previous 103 | * @type Number 104 | * @cat Plugins/Em 105 | * @see current 106 | */ 107 | $.em.previous = $.em.current; 108 | 109 | /** 110 | * The current pixel value of the user agent’s font size. As 111 | * with $.em.previous, this value *may* be subject to minor 112 | * browser rounding errors that mean you might not want to 113 | * rely upon it as an absolute value. 114 | * 115 | * @example $.em.current; 116 | * @result 14 117 | * 118 | * @property 119 | * @name current 120 | * @type Number 121 | * @cat Plugins/Em 122 | * @see previous 123 | */ 124 | $.em.current = currentWidth; 125 | 126 | $.event.trigger(eventName, [$.em.current, $.em.previous]); 127 | } 128 | } 129 | }, $.em ); 130 | 131 | 132 | /** 133 | * Bind a function to the emchange event of each matched element. 134 | * 135 | * @example $("p").emchange( function() { alert("Hello"); } ); 136 | * 137 | * @name emchange 138 | * @type jQuery 139 | * @param Function fn A function to bind to the emchange event. 140 | * @cat Plugins/Em 141 | */ 142 | 143 | /** 144 | * Trigger the emchange event of each matched element. 145 | * 146 | * @example $("p").emchange() 147 | * 148 | * @name emchange 149 | * @type jQuery 150 | * @cat Plugins/Em 151 | */ 152 | $.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn) 153 | : this.trigger(eventName); }; 154 | 155 | 156 | // Store the initial pixel value of the user agent’s font size. 157 | $.em.current = $.em.element.offsetWidth / 100; 158 | 159 | /** 160 | * While polling for font-size changes, $.em.iid stores the intervalID in 161 | * case you should want to cancel with clearInterval(). 162 | * 163 | * @example window.clearInterval( $.em.iid ); 164 | * 165 | * @property 166 | * @name iid 167 | * @type Number 168 | * @cat Plugins/Em 169 | */ 170 | $.em.iid = setInterval( $.em.action, $.em.delay ); 171 | }); 172 | -------------------------------------------------------------------------------- /lib/jquery.hotkeys.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Hotkeys Plugin 3 | * Copyright 2010, John Resig 4 | * Dual licensed under the MIT or GPL Version 2 licenses. 5 | * 6 | * Based upon the plugin by Tzury Bar Yochay: 7 | * http://github.com/tzuryby/hotkeys 8 | * 9 | * Original idea by: 10 | * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ 11 | */ 12 | 13 | (function(jQuery){ 14 | 15 | jQuery.hotkeys = { 16 | version: "0.8", 17 | 18 | specialKeys: { 19 | 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", 20 | 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", 21 | 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 22 | 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", 23 | 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", 24 | 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 25 | 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" 26 | }, 27 | 28 | shiftNums: { 29 | "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", 30 | "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", 31 | ".": ">", "/": "?", "\\": "|" 32 | } 33 | }; 34 | 35 | function keyHandler( handleObj ) { 36 | // Only care when a possible input has been specified 37 | if ( typeof handleObj.data !== "string" ) { 38 | return; 39 | } 40 | 41 | var origHandler = handleObj.handler, 42 | keys = handleObj.data.toLowerCase().split(" "); 43 | 44 | handleObj.handler = function( event ) { 45 | // Don't fire in text-accepting inputs that we didn't directly bind to 46 | if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || 47 | event.target.type === "text") ) { 48 | return; 49 | } 50 | 51 | // Keypress represents characters, not special keys 52 | var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], 53 | character = String.fromCharCode( event.which ).toLowerCase(), 54 | key, modif = "", possible = {}; 55 | 56 | // check combinations (alt|ctrl|shift+anything) 57 | if ( event.altKey && special !== "alt" ) { 58 | modif += "alt+"; 59 | } 60 | 61 | if ( event.ctrlKey && special !== "ctrl" ) { 62 | modif += "ctrl+"; 63 | } 64 | 65 | // TODO: Need to make sure this works consistently across platforms 66 | if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { 67 | modif += "meta+"; 68 | } 69 | 70 | if ( event.shiftKey && special !== "shift" ) { 71 | modif += "shift+"; 72 | } 73 | 74 | if ( special ) { 75 | possible[ modif + special ] = true; 76 | 77 | } else { 78 | possible[ modif + character ] = true; 79 | possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; 80 | 81 | // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" 82 | if ( modif === "shift+" ) { 83 | possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; 84 | } 85 | } 86 | 87 | for ( var i = 0, l = keys.length; i < l; i++ ) { 88 | if ( possible[ keys[i] ] ) { 89 | return origHandler.apply( this, arguments ); 90 | } 91 | } 92 | }; 93 | } 94 | 95 | jQuery.each([ "keydown", "keyup", "keypress" ], function() { 96 | jQuery.event.special[ this ] = { add: keyHandler }; 97 | }); 98 | 99 | })( jQuery ); 100 | 101 | -------------------------------------------------------------------------------- /lib/jquery.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.8.2 jquery.com | jquery.org/license */ 2 | (function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write(""),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return a!=null?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b
a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="
t
",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="
",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||p.guid++:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c=0)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,d+""),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j=0:p.find(m,this,null,[f]).length),h[m]&&j.push(l);j.length&&u.push({elem:f,matches:j})}o.length>q&&u.push({elem:this,matches:o.slice(q)});for(d=0;d0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function bc(a,b,c,d){c=c||[],b=b||r;var e,f,i,j,k=b.nodeType;if(!a||typeof a!="string")return c;if(k!==1&&k!==9)return[];i=g(b);if(!i&&!d)if(e=P.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&h(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return w.apply(c,x.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&_&&b.getElementsByClassName)return w.apply(c,x.call(b.getElementsByClassName(j),0)),c}return bp(a.replace(L,"$1"),b,c,d,i)}function bd(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function be(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bf(a){return z(function(b){return b=+b,z(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function bg(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bh(a,b){var c,d,f,g,h,i,j,k=C[o][a];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){if(!c||(d=M.exec(h)))d&&(h=h.slice(d[0].length)),i.push(f=[]);c=!1;if(d=N.exec(h))f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=d[0].replace(L," ");for(g in e.filter)(d=W[g].exec(h))&&(!j[g]||(d=j[g](d,r,!0)))&&(f.push(c=new q(d.shift())),h=h.slice(c.length),c.type=g,c.matches=d);if(!c)break}return b?h.length:h?bc.error(a):C(a,i).slice(0)}function bi(a,b,d){var e=b.dir,f=d&&b.dir==="parentNode",g=u++;return b.first?function(b,c,d){while(b=b[e])if(f||b.nodeType===1)return a(b,c,d)}:function(b,d,h){if(!h){var i,j=t+" "+g+" ",k=j+c;while(b=b[e])if(f||b.nodeType===1){if((i=b[o])===k)return b.sizset;if(typeof i=="string"&&i.indexOf(j)===0){if(b.sizset)return b}else{b[o]=k;if(a(b,d,h))return b.sizset=!0,b;b.sizset=!1}}}else while(b=b[e])if(f||b.nodeType===1)if(a(b,d,h))return b}}function bj(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function bk(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=b!=null;for(;h-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==l)||((b=c).nodeType?j(a,c,d):k(a,c,d))}];for(;i1&&bj(m),i>1&&a.slice(0,i-1).join("").replace(L,"$1"),c,i0,f=a.length>0,g=function(h,i,j,k,m){var n,o,p,q=[],s=0,u="0",x=h&&[],y=m!=null,z=l,A=h||f&&e.find.TAG("*",m&&i.parentNode||i),B=t+=z==null?1:Math.E;y&&(l=i!==r&&i,c=g.el);for(;(n=A[u])!=null;u++){if(f&&n){for(o=0;p=a[o];o++)if(p(n,i,j)){k.push(n);break}y&&(t=B,c=++g.el)}d&&((n=!p&&n)&&s--,h&&x.push(n))}s+=u;if(d&&u!==s){for(o=0;p=b[o];o++)p(x,q,i,j);if(h){if(s>0)while(u--)!x[u]&&!q[u]&&(q[u]=v.call(k));q=bk(q)}w.apply(k,q),y&&!h&&q.length>0&&s+b.length>1&&bc.uniqueSort(k)}return y&&(t=B,l=z),x};return g.el=0,d?z(g):g}function bo(a,b,c,d){var e=0,f=b.length;for(;e2&&(j=h[0]).type==="ID"&&b.nodeType===9&&!f&&e.relative[h[1].type]){b=e.find.ID(j.matches[0].replace(V,""),b,f)[0];if(!b)return c;a=a.slice(h.shift().length)}for(g=W.POS.test(a)?-1:h.length-1;g>=0;g--){j=h[g];if(e.relative[k=j.type])break;if(l=e.find[k])if(d=l(j.matches[0].replace(V,""),R.test(h[0].type)&&b.parentNode||b,f)){h.splice(g,1),a=d.length&&h.join("");if(!a)return w.apply(c,x.call(d,0)),c;break}}}return i(a,m)(d,b,f,c,R.test(a)),c}function bq(){}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=String,r=a.document,s=r.documentElement,t=0,u=0,v=[].pop,w=[].push,x=[].slice,y=[].indexOf||function(a){var b=0,c=this.length;for(;be.cacheLength&&delete a[b.shift()],a[c]=d},a)},B=A(),C=A(),D=A(),E="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",G=F.replace("w","w#"),H="([*^$|!~]?=)",I="\\["+E+"*("+F+")"+E+"*(?:"+H+E+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+G+")|)|)"+E+"*\\]",J=":("+F+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+I+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+E+"*((?:-\\d)?\\d*)"+E+"*\\)|)(?=[^-]|$)",L=new RegExp("^"+E+"+|((?:^|[^\\\\])(?:\\\\.)*)"+E+"+$","g"),M=new RegExp("^"+E+"*,"+E+"*"),N=new RegExp("^"+E+"*([\\x20\\t\\r\\n\\f>+~])"+E+"*"),O=new RegExp(J),P=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,Q=/^:not/,R=/[\x20\t\r\n\f]*[+~]/,S=/:not\($/,T=/h\d/i,U=/input|select|textarea|button/i,V=/\\(?!\\)/g,W={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),NAME:new RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+J),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+E+"*(even|odd|(([+-]|)(\\d*)n|)"+E+"*(?:([+-]|)"+E+"*(\\d+)|))"+E+"*\\)|)","i"),needsContext:new RegExp("^"+E+"*[>+~]|"+K,"i")},X=function(a){var b=r.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},Y=X(function(a){return a.appendChild(r.createComment("")),!a.getElementsByTagName("*").length}),Z=X(function(a){return a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),$=X(function(a){a.innerHTML="";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),_=X(function(a){return a.innerHTML="",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),ba=X(function(a){a.id=o+0,a.innerHTML="
",s.insertBefore(a,s.firstChild);var b=r.getElementsByName&&r.getElementsByName(o).length===2+r.getElementsByName(o+0).length;return d=!r.getElementById(o),s.removeChild(a),b});try{x.call(s.childNodes,0)[0].nodeType}catch(bb){x=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}bc.matches=function(a,b){return bc(a,null,null,b)},bc.matchesSelector=function(a,b){return bc(b,null,null,[a]).length>0},f=bc.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},g=bc.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},h=bc.contains=s.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:s.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},bc.attr=function(a,b){var c,d=g(a);return d||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):d||$?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},e=bc.selectors={cacheLength:50,createPseudo:z,match:W,attrHandle:Z?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:d?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:Y?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:ba&&function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:_&&function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(V,""),a[3]=(a[4]||a[5]||"").replace(V,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||bc.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&bc.error(a[0]),a},PSEUDO:function(a){var b,c;if(W.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(b=a[4])O.test(b)&&(c=bh(b,!0))&&(c=b.indexOf(")",b.length-c)-b.length)&&(b=b.slice(0,c),a[0]=a[0].slice(0,c)),a[2]=b;return a.slice(0,3)}},filter:{ID:d?function(a){return a=a.replace(V,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(V,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(V,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=B[o][a];return b||(b=B(a,new RegExp("(^|"+E+")"+a+"("+E+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return function(d,e){var f=bc.attr(d,a);return f==null?b==="!=":b?(f+="",b==="="?f===c:b==="!="?f!==c:b==="^="?c&&f.indexOf(c)===0:b==="*="?c&&f.indexOf(c)>-1:b==="$="?c&&f.substr(f.length-c.length)===c:b==="~="?(" "+f+" ").indexOf(c)>-1:b==="|="?f===c||f.substr(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d){return a==="nth"?function(a){var b,e,f=a.parentNode;if(c===1&&d===0)return!0;if(f){e=0;for(b=f.firstChild;b;b=b.nextSibling)if(b.nodeType===1){e++;if(a===b)break}}return e-=d,e===c||e%c===0&&e/c>=0}:function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||bc.error("unsupported pseudo: "+a);return d[o]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?z(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=y.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:z(function(a){var b=[],c=[],d=i(a.replace(L,"$1"));return d[o]?z(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)if(f=g[h])a[h]=!(b[h]=f)}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:z(function(a){return function(b){return bc(a,b).length>0}}),contains:z(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!e.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},header:function(a){return T.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:bd("radio"),checkbox:bd("checkbox"),file:bd("file"),password:bd("password"),image:bd("image"),submit:be("submit"),reset:be("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return U.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement},first:bf(function(a,b,c){return[0]}),last:bf(function(a,b,c){return[b-1]}),eq:bf(function(a,b,c){return[c<0?c+b:c]}),even:bf(function(a,b,c){for(var d=0;d=0;)a.push(d);return a}),gt:bf(function(a,b,c){for(var d=c<0?c+b:c;++d",a.querySelectorAll("[selected]").length||e.push("\\["+E+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),X(function(a){a.innerHTML="

",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+E+"*(?:\"\"|'')"),a.innerHTML="",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=new RegExp(e.join("|")),bp=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a))){var i,j,k=!0,l=o,m=d,n=d.nodeType===9&&a;if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){i=bh(a),(k=d.getAttribute("id"))?l=k.replace(c,"\\$&"):d.setAttribute("id",l),l="[id='"+l+"'] ",j=i.length;while(j--)i[j]=l+i[j].join("");m=R.test(a)&&d.parentNode||d,n=i.join(",")}if(n)try{return w.apply(f,x.call(m.querySelectorAll(n),0)),f}catch(p){}finally{k||d.removeAttribute("id")}}return b(a,d,f,g,h)},h&&(X(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),f.push("!=",J)}catch(c){}}),f=new RegExp(f.join("|")),bc.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!g(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=h.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return bc(c,null,null,[b]).length>0})}(),e.pseudos.nth=e.pseudos.eq,e.filters=bq.prototype=e.pseudos,e.setFilters=new bq,bc.attr=p.attr,p.find=bc,p.expr=bc.selectors,p.expr[":"]=p.expr.pseudos,p.unique=bc.uniqueSort,p.text=bc.getText,p.isXMLDoc=bc.isXML,p.contains=bc.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b0)for(e=d;e=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*\s*$/g,bz={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X
","
"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1>");try{for(;d1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]===""&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{ck=f.href}catch(cy){ck=e.createElement("a"),ck.href="",ck=ck.href}cj=ct.exec(ck.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("
").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:ck,isLocal:cn.test(cj[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,cj[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase())||!1,l.crossDomain=i&&i.join(":")+(i[3]?"":i[1]==="http:"?80:443)!==cj.join(":")+(cj[3]?"":cj[1]==="http:"?80:443)),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=cQ.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){c=+f[2],d=f[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&h){h=p.css(e.elem,a,!0)||c||1;do i=i||".5",h=h/i,p.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&i!==1&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window); -------------------------------------------------------------------------------- /lib/jquery.mousewheel.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) 2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 4 | * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. 5 | * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. 6 | * 7 | * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $ 8 | * $Rev: 4265 $ 9 | * 10 | * Version: 3.0 11 | * 12 | * Requires: $ 1.2.2+ 13 | */ 14 | 15 | (function($) { 16 | 17 | $.event.special.mousewheel = { 18 | setup: function() { 19 | var handler = $.event.special.mousewheel.handler; 20 | 21 | // Fix pageX, pageY, clientX and clientY for mozilla 22 | if ( $.browser.mozilla ) 23 | $(this).bind('mousemove.mousewheel', function(event) { 24 | $.data(this, 'mwcursorposdata', { 25 | pageX: event.pageX, 26 | pageY: event.pageY, 27 | clientX: event.clientX, 28 | clientY: event.clientY 29 | }); 30 | }); 31 | 32 | if ( this.addEventListener ) 33 | this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false); 34 | else 35 | this.onmousewheel = handler; 36 | }, 37 | 38 | teardown: function() { 39 | var handler = $.event.special.mousewheel.handler; 40 | 41 | $(this).unbind('mousemove.mousewheel'); 42 | 43 | if ( this.removeEventListener ) 44 | this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false); 45 | else 46 | this.onmousewheel = function(){}; 47 | 48 | $.removeData(this, 'mwcursorposdata'); 49 | }, 50 | 51 | handler: function(event) { 52 | var args = Array.prototype.slice.call( arguments, 1 ); 53 | 54 | event = $.event.fix(event || window.event); 55 | // Get correct pageX, pageY, clientX and clientY for mozilla 56 | $.extend( event, $.data(this, 'mwcursorposdata') || {} ); 57 | var delta = 0, returnValue = true; 58 | 59 | if ( event.wheelDelta ) delta = event.wheelDelta/120; 60 | if ( event.detail ) delta = -event.detail/3; 61 | // if ( $.browser.opera ) delta = -event.wheelDelta; 62 | 63 | event.data = event.data || {}; 64 | event.type = "mousewheel"; 65 | 66 | // Add delta to the front of the arguments 67 | args.unshift(delta); 68 | // Add event to the front of the arguments 69 | args.unshift(event); 70 | 71 | return $.event.handle.apply(this, args); 72 | } 73 | }; 74 | 75 | $.fn.extend({ 76 | mousewheel: function(fn) { 77 | return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); 78 | }, 79 | 80 | unmousewheel: function(fn) { 81 | return this.unbind("mousewheel", fn); 82 | } 83 | }); 84 | 85 | })(jQuery); -------------------------------------------------------------------------------- /puzzle.js: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Sample Puzzle", 3 | "by": "By Line", 4 | "clues": [ 5 | { "d":"A", "n":6, "x":1, "y":1, "a":"REPEATS", "c":"Shows you've seen" }, 6 | { "d":"A", "n":7, "x":9, "y":1, "a":"NINES", "c":"Eights aren't enough" }, 7 | { "d":"A", "n":9, "x":0, "y":3, "a":"DIAL", "c":"Don't touch that __" }, 8 | { "d":"A", "n":10, "x":5, "y":3, "a":"ASTRONOMER", "c":"Starstruck scientist" }, 9 | { "d":"A", "n":11, "x":0, "y":5, "a":"WEIGHING", "c":"Measuring heaviness" }, 10 | { "d":"A", "n":13, "x":9, "y":5, "a":"COUSIN", "c":"Maybe you can marry" }, 11 | { "d":"A", "n":15, "x":0, "y":7, "a":"JAZZ", "c":"American music" }, 12 | { "d":"A", "n":17, "x":5, "y":7, "a":"BOATS", "c":"Marina sights" }, 13 | { "d":"A", "n":18, "x":11, "y":7, "a":"EASE", "c":"Let out" }, 14 | { "d":"A", "n":19, "x":0, "y":9, "a":"PURSES", "c":"Sums of money" }, 15 | { "d":"A", "n":20, "x":7, "y":9, "a":"POSTPONE", "c":"Give a rain check" }, 16 | { "d":"A", "n":23, "x":0, "y":11, "a":"RIDICULOUS", "c":"Cockamamy" }, 17 | { "d":"A", "n":26, "x":11, "y":11, "a":"CAGE", "c":"Hamster's home" }, 18 | { "d":"A", "n":27, "x":1, "y":13, "a":"GHOST", "c":"Father & son, three's a crowd" }, 19 | { "d":"A", "n":28, "x":7, "y":13, "a":"ELEMENT", "c":"Substance like no other" }, 20 | { "d":"D", "n":1, "x":3, "y":0, "a":"APOLOGIZES", "c":"Makes amends" }, 21 | { "d":"D", "n":2, "x":5, "y":0, "a":"HAWAII", "c":"Barack's home " }, 22 | { "d":"D", "n":3, "x":7, "y":0, "a":"ISNT", "c":"__ it romantic?" }, 23 | { "d":"D", "n":4, "x":9, "y":0, "a":"ENFORCES", "c":"Keeps lawfull" }, 24 | { "d":"D", "n":5, "x":11, "y":0, "a":"ONTO", "c":"I'm __ you!" }, 25 | { "d":"D", "n":6, "x":1, "y":1, "a":"RAISE", "c":"Bring up" }, 26 | { "d":"D", "n":8, "x":13, "y":1, "a":"SPECIES", "c":"Variety" }, 27 | { "d":"D", "n":12, "x":7, "y":5, "a":"GRASP", "c":"Hold" }, 28 | { "d":"D", "n":14, "x":11, "y":5, "a":"UNEXPECTED", "c":"Abrupt" }, 29 | { "d":"D", "n":16, "x":1, "y":7, "a":"AMUSING", "c":"Gladdening" }, 30 | { "d":"D", "n":17, "x":5, "y":7, "a":"BISCUITS", "c":"Go with gravy" }, 31 | { "d":"D", "n":21, "x":9, "y":9, "a":"SISTER", "c":"Nun" }, 32 | { "d":"D", "n":22, "x":13, "y":9, "a":"NIGHT", "c":"Dusk to dawn" }, 33 | { "d":"D", "n":24, "x":3, "y":11, "a":"IRON", "c":"Pumping __" }, 34 | { "d":"D", "n":25, "x":7, "y":11, "a":"OVER", "c":"Game __" } 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | .crossw1rd { 2 | border: solid 1px #eee; 3 | padding:10px; 4 | } 5 | 6 | .grid { 7 | border-top: 1px solid #aaa; 8 | border-left: 1px solid #aaa; 9 | } 10 | 11 | .row { 12 | clear: left; 13 | white-space: nowrap; 14 | } 15 | 16 | .row > div { 17 | float: left; 18 | text-align: center; 19 | height: 27px; 20 | width: 27px; 21 | border-bottom: 1px solid #aaa; 22 | border-right: 1px solid #aaa; 23 | background-color: #fff; 24 | -moz-user-select: none; 25 | -khtml-user-select: none; 26 | user-select: none; 27 | } 28 | 29 | .row > div.word { 30 | background-color: #FCFCD6; 31 | } 32 | .row > div.word.active { 33 | background-color: yellow; 34 | } 35 | 36 | .num { 37 | font-family: arial; 38 | font-size: 8px; 39 | float:left; 40 | position: relative; 41 | left: 1px; 42 | top: 1px; 43 | } 44 | 45 | .letter { 46 | font-family: courier; 47 | font-size: 20px; 48 | position: relative; 49 | top: 4px; 50 | white-space: normal; 51 | } 52 | .correct .letter { 53 | color: green; 54 | } 55 | .incorrect .letter { 56 | color: red; 57 | } 58 | 59 | .row > div.blank { 60 | background-color: #ccc; 61 | } 62 | 63 | .clues { 64 | font-family: arial; 65 | float: right; 66 | } 67 | .clues .across, .clues .down { 68 | background-color: #eee; 69 | margin:4px; 70 | } 71 | .clues h4 { 72 | font-size: 12px; 73 | margin:0; 74 | } 75 | .clues div { 76 | margin: 4px 0; 77 | padding: 4px; 78 | overflow: auto; 79 | } 80 | .clues p { 81 | font-size: 12px; 82 | margin: 0; 83 | cursor: default; 84 | position: relative; 85 | } 86 | .active_clue { 87 | background-color: #FCFCD6; 88 | } 89 | 90 | .controls { 91 | margin: 10px 0; 92 | } 93 | 94 | /* CSSButtonGenerator.com */ 95 | .controls button { 96 | -moz-box-shadow:inset 0px 1px 0px 0px #ffffff; 97 | -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff; 98 | box-shadow:inset 0px 1px 0px 0px #ffffff; 99 | background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); 100 | background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); 101 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); 102 | background-color:#ededed; 103 | -moz-border-radius:6px; 104 | -webkit-border-radius:6px; 105 | border-radius:6px; 106 | border:1px solid #dcdcdc; 107 | display:inline-block; 108 | color:#777777; 109 | font-family:arial; 110 | font-size:12px; 111 | font-weight:bold; 112 | padding:4px 8px; 113 | text-decoration:none; 114 | text-shadow:1px 1px 0px #ffffff; 115 | } 116 | .controls button:hover { 117 | background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) ); 118 | background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% ); 119 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed'); 120 | background-color:#dfdfdf; 121 | } 122 | .controls button:active { 123 | position:relative; 124 | top:1px; 125 | } 126 | 127 | --------------------------------------------------------------------------------