├── .gitignore ├── LICENSE ├── README.md ├── audio ├── chime.mp3 ├── chime.ogg ├── move.mp3 └── move.ogg ├── css ├── chat.css ├── main.css └── thirdparty │ ├── bootstrap-tour.min.css │ ├── bootstrap.min.css │ └── jquery.contextMenu.min.css ├── favicon.ico ├── fonts ├── helvetiker_regular.typeface.js └── helvetiker_regular.typeface.json ├── images ├── board │ ├── black_blue-velvet.png │ ├── black_red-ornate.png │ ├── black_sand-velvet.png │ ├── black_simple.png │ ├── preview │ │ ├── black_blue-velvet.png │ │ ├── black_red-ornate.png │ │ ├── black_sand-velvet.png │ │ ├── black_simple.png │ │ ├── white_ornate.png │ │ ├── white_sand-velvet.png │ │ ├── white_simple.png │ │ └── white_white-velvet.png │ ├── white_ornate.png │ ├── white_sand-velvet.png │ ├── white_simple.png │ └── white_white-velvet.png ├── bus.svg ├── circle_any.svg ├── circle_black.svg ├── circle_white.svg ├── flag.svg ├── hand-i-offered.png ├── hand-other-offered.png ├── ic_account_box_black_24px.svg ├── ic_add_box_black_24px.svg ├── ic_content_copy_black_24px.svg ├── ic_create_black_24px.svg ├── ic_fast_forward_black_24px.svg ├── ic_fast_rewind_black_24px.svg ├── ic_file_download_black_24px.svg ├── ic_help_black_24px.svg ├── ic_keyboard_arrow_left_black_24px.svg ├── ic_keyboard_arrow_right_black_24px.svg ├── ic_menu_black_24px.svg ├── ic_play_circle_filled_black_24px.svg ├── ic_remove_red_eye_black_24px.svg ├── ic_screen_rotation_black_24px.svg ├── ic_settings_black_24px.svg ├── ic_volume_mute_black_24px.svg ├── ic_volume_up_black_24px.svg ├── ic_zoom_in_black_24px.svg ├── ic_zoom_out_black_24px.svg ├── irequestedundo.svg ├── offer-hand.png ├── otherrequestedundo.svg ├── pieces │ ├── black_pietersite_caps.png │ ├── black_pietersite_pieces.png │ ├── black_simple_caps.png │ ├── black_simple_pieces.png │ ├── preview │ │ ├── black_pietersite_pieces.png │ │ ├── black_simple_pieces.png │ │ ├── white_coral_pieces.png │ │ └── white_simple_pieces.png │ ├── white_coral_caps.png │ ├── white_coral_pieces.png │ ├── white_simple_caps.png │ └── white_simple_pieces.png ├── player-black.png ├── player-white.png └── requestundo.svg ├── index.html ├── js ├── board.js ├── chat.js ├── env.js ├── game.js ├── main.js ├── ptn.js ├── server.js ├── style_selector.js ├── thirdparty │ ├── OrbitControls.min.js │ ├── bootstrap-tour.min.js │ ├── bootstrap.min.js │ ├── jquery.contextMenu.min.js │ ├── linkify-string.min.js │ ├── linkify.min.js │ └── three.min.js └── tour.js └── testing └── TPSExamples.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *.patch 4 | -------------------------------------------------------------------------------- /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 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TakWeb 2 | Javascript based Tak client 3 |
4 | If you want to test your changes with TakServer running locally on your machine, you'll need websockify (https://github.com/novnc/websockify) 5 | 6 | NOTE: https://playtak.com is now being maintained by US Tak Association (https://ustak.org) 7 | -------------------------------------------------------------------------------- /audio/chime.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/audio/chime.mp3 -------------------------------------------------------------------------------- /audio/chime.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/audio/chime.ogg -------------------------------------------------------------------------------- /audio/move.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/audio/move.mp3 -------------------------------------------------------------------------------- /audio/move.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/audio/move.ogg -------------------------------------------------------------------------------- /css/chat.css: -------------------------------------------------------------------------------- 1 | #chat-toggle-button{ 2 | position: absolute; 3 | right: 185px; 4 | top: 62px; 5 | z-index: 10; 6 | } 7 | 8 | #chat { 9 | position: absolute; 10 | right: 5px; 11 | top: 60px; 12 | z-index: 10; 13 | width: 180px; 14 | height: 80%; 15 | } 16 | 17 | #chat > ul > li > a { 18 | white-space: nowrap; 19 | overflow: hidden; 20 | text-overflow: ellipsis; 21 | } 22 | 23 | #room_divs > div { 24 | padding: 3px; 25 | word-wrap: break-word; 26 | background-color: #e7e7e9; 27 | height:100%; 28 | overflow-y: auto; 29 | } 30 | 31 | .chatname { 32 | font-weight: bold; 33 | } 34 | 35 | .chatmyname { 36 | color: red; 37 | } 38 | 39 | .cmdreply { 40 | font-style: italic; 41 | color: blue; 42 | } 43 | 44 | .ircname { 45 | color: #8C6F65; 46 | } 47 | 48 | .chattime { 49 | color: #7D7D7D; 50 | text-align: center; 51 | } 52 | 53 | #chat-toggle-text { 54 | } 55 | 56 | #room_list > li { 57 | display: table; 58 | width: 100%; 59 | } 60 | 61 | #room_list > li > a { 62 | display: table-cell; 63 | white-space: nowrap; 64 | overflow: hidden; 65 | text-overflow: ellipsis; 66 | padding: 4px 0px 4px 12px; 67 | } 68 | 69 | #room_list > li > a > span > span:nth-child(2) { 70 | display: block; 71 | font-size: 12px; 72 | text-align: center; 73 | } 74 | 75 | #room_list > li > a > span > span:nth-child(3) { 76 | float: right; 77 | } 78 | 79 | #room_list > li > div { 80 | display: table-cell; 81 | text-align: center; 82 | width: 20px; 83 | padding: 4px 6px 4px 12px; 84 | font-size: 21px; 85 | opacity: .4; 86 | vertical-align: middle; 87 | } 88 | -------------------------------------------------------------------------------- /css/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0px; 3 | padding: 0px; 4 | overflow: hidden; 5 | } 6 | 7 | #gamecanvas{ 8 | display: block; 9 | position: absolute; 10 | left: 0px; 11 | top: 0px; 12 | } 13 | 14 | #floating { 15 | position: absolute; 16 | left: 5px; 17 | top: 20%; 18 | z-index: 10; 19 | } 20 | 21 | #watchgame-modal{ 22 | overflow-x: auto; 23 | } 24 | 25 | .optlist a { 26 | margin-top: 2px; 27 | margin-bottom: 2px; 28 | 29 | margin-left: 10px; 30 | margin-right: 10px; 31 | padding: 0px; 32 | } 33 | 34 | .playername { 35 | font-weight: bold; 36 | } 37 | 38 | .bold { 39 | font-weight: bold; 40 | } 41 | 42 | .fullw { 43 | width: 100%; 44 | } 45 | 46 | .context-player { 47 | cursor: pointer; 48 | } 49 | 50 | #notation-toggle-text { 51 | position: absolute; 52 | right: -17px; 53 | top: 2px; 54 | } 55 | 56 | .toggle-text { 57 | border-radius: 2px; 58 | border: 2px solid #404040; 59 | border-radius: 5px; 60 | text-align: center; 61 | color: #c3c3c3; 62 | background-color: #404040; 63 | line-height: 12px; 64 | width: 19px; 65 | } 66 | 67 | #help-modal ul li ul { 68 | font-weight: bold; 69 | } 70 | 71 | #help-modal ul li ul li { 72 | font-weight: normal; 73 | } 74 | 75 | #settings-modal ul li ul { 76 | font-weight: bold; 77 | } 78 | 79 | #settings-modal ul li ul li { 80 | font-weight: normal; 81 | } 82 | 83 | .split-container-left { 84 | display: inline-block; 85 | overflow: hidden; 86 | width: 49%; 87 | padding-right: 15px; 88 | padding-bottom: 10px; 89 | vertical-align: top; 90 | } 91 | 92 | .split-container-right { 93 | display: inline-block; 94 | overflow: hidden; 95 | width: 49%; 96 | padding-left: 15px; 97 | padding-bottom: 10px; 98 | border-left: 1px solid #ddd; 99 | vertical-align: top; 100 | } 101 | 102 | input[type=checkbox] { 103 | vertical-align: middle; 104 | line-height: 14px; 105 | margin: 0px; 106 | } 107 | 108 | input[type=range] { 109 | vertical-align: middle; 110 | margin: 0px; 111 | display: inline-block; 112 | background: transparent; 113 | width: 50%; 114 | } 115 | 116 | input[type=range]::-moz-range-track { 117 | height: 4px; 118 | border-radius: 2px; 119 | box-shadow: 1px 1px 1px #ddd, 0px 0px 1px #fff; 120 | } 121 | 122 | input[type=range]::-ms-track { 123 | height: 4px; 124 | border-radius: 2px; 125 | box-shadow: 1px 1px 1px #ddd, 0px 0px 1px #fff; 126 | } 127 | 128 | input[type=range]::-webkit-slider-runnable-track { 129 | height: 4px; 130 | border-radius: 2px; 131 | box-shadow: 1px 1px 1px #ddd, 0px 0px 1px #fff; 132 | } 133 | 134 | .radio-list-item { 135 | display: inline-block; 136 | margin: 0; 137 | width: auto; 138 | } 139 | 140 | .radio-list-item input[type=radio] { 141 | display: none; 142 | } 143 | 144 | .radio-list-img { 145 | margin: 0; 146 | border: 2px #fff solid; 147 | cursor: pointer; 148 | } 149 | 150 | .radio-list-item input[type=radio]:checked + .radio-list-img { 151 | border: 2px #88d solid; 152 | } 153 | 154 | .width-full { 155 | margin: 0 auto; 156 | width: 100%; 157 | } 158 | 159 | .height-full { 160 | margin: 0 auto; 161 | height: 100%; 162 | } 163 | 164 | .height-auto { 165 | height: auto; 166 | } 167 | 168 | #status { 169 | position: absolute; 170 | bottom: 0px; 171 | right: 0px; 172 | z-index: 10; 173 | } 174 | 175 | #pindicator { 176 | position: absolute; 177 | top: 60px; 178 | left: 50%; 179 | transform: translate(-50%, 0); 180 | font-size: 200%; 181 | z-index: 10; 182 | } 183 | 184 | #zoomcontrols { 185 | position: absolute; 186 | bottom: 5px; 187 | left: 5px; 188 | z-index: 10; 189 | } 190 | 191 | #rmenu { 192 | border-style: solid; 193 | border-width: 2px; 194 | border-color: black; 195 | padding: 5px; 196 | margin: 2px; 197 | width: 200px; 198 | text-align: left; 199 | overflow: hidden; 200 | background-color: #e7e7e7; 201 | } 202 | 203 | #notationbar { 204 | border-top-style: solid; 205 | border-top-color: #888; 206 | border-top-width: 1px; 207 | border-bottom-style: solid; 208 | border-bottom-color: #888; 209 | border-bottom-width: 1px; 210 | background-color: #eee; 211 | height: 200px; 212 | overflow: auto; 213 | } 214 | 215 | #alertbox { 216 | position: absolute; 217 | bottom: 0px; 218 | width: 100%; 219 | z-index: 8; 220 | } 221 | 222 | .alerts { 223 | width: 60%; 224 | margin: auto; 225 | } 226 | 227 | .alert { 228 | margin: 0px; 229 | } 230 | 231 | #moveslist { 232 | display: table; 233 | width: 150px; 234 | } 235 | 236 | #moveslist a { 237 | color: inherit; 238 | text-decoration: none; 239 | } 240 | 241 | .center { 242 | text-align: center; 243 | } 244 | 245 | .left { 246 | text-align: left; 247 | } 248 | 249 | .right { 250 | text-align: right; 251 | } 252 | 253 | .vertical-text { 254 | transform-origin: bottom right; 255 | transform: rotate(-90deg); 256 | float: left; 257 | } 258 | 259 | .modal { 260 | text-align: center; 261 | } 262 | 263 | .modal:before { 264 | display: inline-block; 265 | vertical-align: middle; 266 | content: " "; 267 | height: 100%; 268 | } 269 | 270 | .modal-dialog { 271 | display: inline-block; 272 | text-align: left; 273 | vertical-align: middle; 274 | } 275 | 276 | /*#moveslist thead, #moveslist tbody{ 277 | float: left; 278 | width: 100%; 279 | } 280 | 281 | #moveslist tbody { 282 | overflow: auto; 283 | height: 150px; 284 | } 285 | 286 | #moveslist tr { 287 | width: 100%; 288 | display: table; 289 | text-align: left; 290 | } 291 | 292 | #moveslist>tr>td { 293 | text-align: left; 294 | } 295 | 296 | #moveslist>tr>td:last-child { 297 | text-align: right; 298 | }*/ 299 | 300 | .selected { 301 | background: red; 302 | } 303 | 304 | .unselected { 305 | background: grey; 306 | } 307 | 308 | .selectplayer { 309 | border-radius: 10px; 310 | background-color: #cccccc; 311 | } 312 | 313 | .white-player-color { 314 | color: #b3b3b3; 315 | } 316 | 317 | #player-opp, .player1-name { 318 | display: inline-block; 319 | color: #a3a3a3; 320 | padding: 2px; 321 | } 322 | 323 | #player-me, .player2-name { 324 | display: inline-block; 325 | color: black; 326 | padding: 2px; 327 | } 328 | 329 | .border { 330 | border-radius : 20px; 331 | padding: 5px; 332 | margin: 2px; 333 | border : 2px solid black; 334 | } 335 | 336 | #moveslist tbody tr td + td { 337 | display: inline-block; 338 | height: 100%; 339 | width: 40%; 340 | } 341 | 342 | #moveslist tbody tr td { 343 | display: inline-block; 344 | height: 100%; 345 | width: 20%; 346 | } 347 | 348 | #moveslist tbody tr td a { 349 | display: block; 350 | height: 100%; 351 | width: 100%; 352 | } 353 | 354 | #moveslist tbody tr td a span { 355 | display: block; 356 | height: 100%; 357 | width: 100%; 358 | } 359 | 360 | #moveslist tbody tr td a span:hover { 361 | background-color: #c3c3c3; 362 | } 363 | 364 | .curmove { 365 | background-color: #c3c3c3; 366 | } 367 | 368 | .scrollable-menu { 369 | height: auto; 370 | max-height: 280px; 371 | overflow-x: hidden; 372 | } 373 | 374 | .botlevel { 375 | display: inline-block; 376 | width: 0; 377 | height: 0; 378 | font-size: 12px; 379 | color: #666; 380 | position: relative; 381 | top: 15px; 382 | padding-bottom: 30px; 383 | } 384 | 385 | .table { 386 | margin-bottom: 0; 387 | } 388 | 389 | #player-me-time, #player-opp-time { 390 | font-size: x-large; 391 | color: black; 392 | } 393 | 394 | a .fa:not(#undo):not(#draw) { 395 | color: black; 396 | } 397 | 398 | #zoomcontrols .fa { 399 | margin: 2px; 400 | } 401 | 402 | .request-undo, .offer-draw { 403 | color: black; 404 | } 405 | 406 | .i-requested-undo, .i-offered-draw { 407 | color: red; 408 | } 409 | 410 | .opp-requested-undo, .opp-offered-draw { 411 | color: blue; 412 | } 413 | -------------------------------------------------------------------------------- /css/thirdparty/bootstrap-tour.min.css: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * bootstrap-tour - v0.10.1 3 | * http://bootstraptour.com 4 | * ======================================================================== 5 | * Copyright 2012-2013 Ulrich Sossou 6 | * 7 | * ======================================================================== 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * ======================================================================== 20 | */ 21 | 22 | .tour-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1100;background-color:#000;opacity:.8;filter:alpha(opacity=80)}.tour-step-backdrop{position:relative;z-index:1101;background:inherit}.tour-step-backdrop>td{position:relative;z-index:1101}.tour-step-background{position:absolute!important;z-index:1100;background:inherit;border-radius:6px}.popover[class*=tour-]{z-index:1100}.popover[class*=tour-] .popover-navigation{padding:9px 14px}.popover[class*=tour-] .popover-navigation [data-role=end]{float:right}.popover[class*=tour-] .popover-navigation [data-role=prev],.popover[class*=tour-] .popover-navigation [data-role=next],.popover[class*=tour-] .popover-navigation [data-role=end]{cursor:pointer}.popover[class*=tour-] .popover-navigation [data-role=prev].disabled,.popover[class*=tour-] .popover-navigation [data-role=next].disabled,.popover[class*=tour-] .popover-navigation [data-role=end].disabled{cursor:default}.popover[class*=tour-].orphan{position:fixed;margin-top:0}.popover[class*=tour-].orphan .arrow{display:none} -------------------------------------------------------------------------------- /css/thirdparty/jquery.contextMenu.min.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";/*! 2 | * jQuery contextMenu - Plugin for simple contextMenu handling 3 | * 4 | * Version: v2.2.4-dev 5 | * 6 | * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) 7 | * Web: http://swisnl.github.io/jQuery-contextMenu/ 8 | * 9 | * Copyright (c) 2011-2016 SWIS BV and contributors 10 | * 11 | * Licensed under 12 | * MIT License http://www.opensource.org/licenses/mit-license 13 | * 14 | * Date: 2016-07-17T19:45:35.350Z 15 | */.context-menu-icon.context-menu-icon--fa::before,.context-menu-icon::before{left:0;width:2em;font-size:1em;font-style:normal;font-weight:400;line-height:1;text-align:center;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:absolute;top:50%}@font-face{font-family:context-menu-icons;font-style:normal;font-weight:400;src:url(font/context-menu-icons.eot?14l1a);src:url(font/context-menu-icons.eot?14l1a#iefix) format("embedded-opentype"),url(font/context-menu-icons.woff2?14l1a) format("woff2"),url(font/context-menu-icons.woff?14l1a) format("woff"),url(font/context-menu-icons.ttf?14l1a) format("truetype")}.context-menu-icon-add:before{content:"\EA01"}.context-menu-icon-copy:before{content:"\EA02"}.context-menu-icon-cut:before{content:"\EA03"}.context-menu-icon-delete:before{content:"\EA04"}.context-menu-icon-edit:before{content:"\EA05"}.context-menu-icon-paste:before{content:"\EA06"}.context-menu-icon-quit:before{content:"\EA07"}.context-menu-icon::before{font-family:context-menu-icons;color:#2980b9;transform:translateY(-50%)}.context-menu-icon.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-disabled::before{color:#bbb}.context-menu-icon.context-menu-icon--fa{display:list-item}.context-menu-icon.context-menu-icon--fa::before{font-family:FontAwesome;color:#2980b9;transform:translateY(-50%)}.context-menu-icon.context-menu-icon--fa.context-menu-hover:before{color:#fff}.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before{color:#bbb}.context-menu-list{position:absolute;display:inline-block;min-width:13em;max-width:26em;padding:.25em 0;margin:.3em;font-family:inherit;font-size:inherit;list-style-type:none;background:#fff;border:1px solid #bebebe;border-radius:.2em;-webkit-box-shadow:0 2px 5px rgba(0,0,0,.5);box-shadow:0 2px 5px rgba(0,0,0,.5)}.context-menu-item{position:relative;padding:.2em 2em;color:#2f2f2f;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fff}.context-menu-separator{padding:0;margin:.35em 0;border-bottom:1px solid #e6e6e6}.context-menu-item>label>input,.context-menu-item>label>textarea{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.context-menu-item.context-menu-hover{color:#fff;cursor:pointer;background-color:#2980b9}.context-menu-item.context-menu-disabled{color:#bbb;cursor:default;background-color:#fff}.context-menu-input.context-menu-hover{cursor:default}.context-menu-submenu:after{position:absolute;top:50%;right:.5em;z-index:1;width:0;height:0;content:'';border-color:transparent transparent transparent #2f2f2f;border-style:solid;border-width:.25em 0 .25em .25em;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%)}.context-menu-item.context-menu-input{padding:.3em .6em}.context-menu-input>label>*{vertical-align:top}.context-menu-input>label>input[type=checkbox],.context-menu-input>label>input[type=radio]{position:relative;top:.12em;margin-right:.4em}.context-menu-input>label{margin:0}.context-menu-input>label,.context-menu-input>label>input[type=text],.context-menu-input>label>select,.context-menu-input>label>textarea{display:block;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.context-menu-input>label>textarea{height:7em}.context-menu-item>.context-menu-list{top:.3em;right:-.3em;display:none}.context-menu-item.context-menu-visible>.context-menu-list{display:block}.context-menu-accesskey{text-decoration:underline} 16 | /*# sourceMappingURL=jquery.contextMenu.min.css.map */ 17 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/favicon.ico -------------------------------------------------------------------------------- /images/board/black_blue-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/black_blue-velvet.png -------------------------------------------------------------------------------- /images/board/black_red-ornate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/black_red-ornate.png -------------------------------------------------------------------------------- /images/board/black_sand-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/black_sand-velvet.png -------------------------------------------------------------------------------- /images/board/black_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/black_simple.png -------------------------------------------------------------------------------- /images/board/preview/black_blue-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/black_blue-velvet.png -------------------------------------------------------------------------------- /images/board/preview/black_red-ornate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/black_red-ornate.png -------------------------------------------------------------------------------- /images/board/preview/black_sand-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/black_sand-velvet.png -------------------------------------------------------------------------------- /images/board/preview/black_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/black_simple.png -------------------------------------------------------------------------------- /images/board/preview/white_ornate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/white_ornate.png -------------------------------------------------------------------------------- /images/board/preview/white_sand-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/white_sand-velvet.png -------------------------------------------------------------------------------- /images/board/preview/white_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/white_simple.png -------------------------------------------------------------------------------- /images/board/preview/white_white-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/preview/white_white-velvet.png -------------------------------------------------------------------------------- /images/board/white_ornate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/white_ornate.png -------------------------------------------------------------------------------- /images/board/white_sand-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/white_sand-velvet.png -------------------------------------------------------------------------------- /images/board/white_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/white_simple.png -------------------------------------------------------------------------------- /images/board/white_white-velvet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/board/white_white-velvet.png -------------------------------------------------------------------------------- /images/bus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /images/circle_any.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /images/circle_black.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/circle_white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/flag.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /images/hand-i-offered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/hand-i-offered.png -------------------------------------------------------------------------------- /images/hand-other-offered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/hand-other-offered.png -------------------------------------------------------------------------------- /images/ic_account_box_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_add_box_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_content_copy_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_create_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_fast_forward_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_fast_rewind_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_file_download_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_help_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_keyboard_arrow_left_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_keyboard_arrow_right_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_menu_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_play_circle_filled_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_remove_red_eye_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_screen_rotation_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_settings_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_volume_mute_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_volume_up_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/ic_zoom_in_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /images/ic_zoom_out_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /images/irequestedundo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /images/offer-hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/offer-hand.png -------------------------------------------------------------------------------- /images/otherrequestedundo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /images/pieces/black_pietersite_caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/black_pietersite_caps.png -------------------------------------------------------------------------------- /images/pieces/black_pietersite_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/black_pietersite_pieces.png -------------------------------------------------------------------------------- /images/pieces/black_simple_caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/black_simple_caps.png -------------------------------------------------------------------------------- /images/pieces/black_simple_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/black_simple_pieces.png -------------------------------------------------------------------------------- /images/pieces/preview/black_pietersite_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/preview/black_pietersite_pieces.png -------------------------------------------------------------------------------- /images/pieces/preview/black_simple_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/preview/black_simple_pieces.png -------------------------------------------------------------------------------- /images/pieces/preview/white_coral_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/preview/white_coral_pieces.png -------------------------------------------------------------------------------- /images/pieces/preview/white_simple_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/preview/white_simple_pieces.png -------------------------------------------------------------------------------- /images/pieces/white_coral_caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/white_coral_caps.png -------------------------------------------------------------------------------- /images/pieces/white_coral_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/white_coral_pieces.png -------------------------------------------------------------------------------- /images/pieces/white_simple_caps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/white_simple_caps.png -------------------------------------------------------------------------------- /images/pieces/white_simple_pieces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/pieces/white_simple_pieces.png -------------------------------------------------------------------------------- /images/player-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/player-black.png -------------------------------------------------------------------------------- /images/player-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaitu236/TakWeb/d594dbc6c3b39da8c9ee5c5b41bf9e7931f68608/images/player-white.png -------------------------------------------------------------------------------- /images/requestundo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /js/chat.js: -------------------------------------------------------------------------------- 1 | var chathandler = { 2 | lastChatTime: '', 3 | chat_width: 180, 4 | cur_room: 'global', 5 | 6 | init: function() { 7 | $('#chat').offset({ top: $('nav').height() + 5 }); 8 | $('#chat').height(window.innerHeight - $('nav').height() - 118); 9 | $('#chat-toggle-button').offset({ top: $('nav').height() + 7 }); 10 | 11 | $('#room-div-global').append(' Privacy Policy
'); 12 | }, 13 | /* 14 | * Callback from server 15 | */ 16 | received: function (type, roomName, name, txt) { 17 | console.log('received', type, roomName, name, txt); 18 | var clsname = 'chatname context-player'; 19 | 20 | if (name === 'IRC') { 21 | name = txt.split('<')[1].split('>')[0]; 22 | txt = txt.split('<' + name + '>')[1]; 23 | clsname = clsname + ' ircname'; 24 | } 25 | 26 | if (type === 'priv') { 27 | //Create room if doesn't exist and switch to it 28 | if (!this.roomExists('priv', roomName)) { 29 | chathandler.createPrivateRoom(roomName); 30 | chathandler.setRoom('priv', roomName); 31 | } 32 | } 33 | var room = type + '-' + roomName; 34 | if (type == 'global') 35 | room = 'global'; 36 | 37 | var $cs = $('#room-div-' + room); 38 | 39 | var now = new Date(); 40 | var hours = now.getHours(); 41 | var mins = now.getMinutes(); 42 | var cls = 'chattime'; 43 | var timenow = getZero(hours) + ':' + getZero(mins); 44 | 45 | if (localStorage.getItem('hide-chat-time') === 'true') { 46 | cls = cls + ' hidden'; 47 | } 48 | 49 | if (timenow !== this.lastChatTime) { 50 | $cs.append('
' + timenow + '
'); 51 | this.lastChatTime = timenow; 52 | } 53 | $cs.append('' + name + ':'); 54 | var options = {/* ... */}; 55 | 56 | var occ = (txt.match(new RegExp(server.myname, "g")) || []).length; 57 | txt = txt.linkify(options); 58 | var occ2 = (txt.match(new RegExp(server.myname, "g")) || []).length; 59 | 60 | //someone said our name and link in string doesn't contain name 61 | if (occ === occ2 && txt.indexOf(server.myname) > -1) { 62 | txt = txt.replace(new RegExp('(^|[^\\w\\d])(' + server.myname + ')(?=$|[^\\w\\d])', 'g'), '$1$2'); 63 | } 64 | 65 | $cs.append(' ' + txt + '
'); 66 | 67 | $cs.scrollTop($cs[0].scrollHeight); 68 | }, 69 | /* 70 | * Callback from server to print a msg without styling. 71 | * The caller will do stying on their end 72 | */ 73 | raw: function(type, roomName, msg) { 74 | var room = type + '-' + roomName; 75 | if (type === 'global') 76 | room = 'global'; 77 | 78 | var $cs = $('#room-div-' + room); 79 | $cs.append(' ' + msg + '
'); 80 | 81 | $cs.scrollTop($cs[0].scrollHeight); 82 | }, 83 | /* 84 | * Callback from UI 85 | */ 86 | send: function () { 87 | var msg = $('#chat-me').val(); 88 | if (msg.startsWith('.')) { 89 | server.send(msg.slice(1)); 90 | } else { 91 | if (this.cur_room.startsWith('global')) 92 | server.chat('global', '', msg); 93 | else if (this.cur_room.startsWith('room-')) 94 | server.chat('room', this.cur_room.split('room-')[1], msg); 95 | else //Assuming priv 96 | server.chat('priv', this.cur_room.split('priv-')[1], msg); 97 | } 98 | $('#chat-me').val(''); 99 | }, 100 | /* 101 | * Callback from UI 102 | */ 103 | selectRoom: function (type, name) { 104 | this.cur_room = (type + '-' + name); 105 | if (type === 'global') 106 | this.cur_room = 'global'; 107 | 108 | title = $('.room-name-' + this.cur_room + ' a span').html() 109 | $('#cur_room').html(title); 110 | }, 111 | 112 | setRoom: function (type, name) { 113 | var room = type + '-' + name; 114 | $('.room-name-' + room + ' a').tab('show'); 115 | chathandler.selectRoom(type, name); 116 | }, 117 | /* 118 | * Callback from UI 119 | */ 120 | removeRoom: function (type, name) { 121 | var room = type + '-' + name; 122 | console.log('remove '+room); 123 | 124 | if (this.cur_room === room) { 125 | $('#room_list li:eq(0) a').tab('show'); 126 | this.selectRoom('global', 'global'); 127 | } 128 | 129 | if (type === 'room') 130 | server.leaveroom(name); 131 | 132 | $('.room-name-' + room).remove(); 133 | $('#room-div-' + room).remove(); 134 | }, 135 | /* 136 | * Callback from UI 137 | */ 138 | createRoom: function (type, name, title) { 139 | var room = type + '-' + name; 140 | 141 | var room_div = $('
').attr('id', 'room-div-' + room) 142 | .addClass('tab-pane'); 143 | $('#room_divs').append(room_div); 144 | 145 | var room_list = $('#room_list'); 146 | var a = $('').click(function() { chathandler.selectRoom(type, name) }) 147 | .attr('data-toggle', 'tab') 148 | .attr('href', '#room-div-' + room) 149 | .append(title); 150 | var li = $('
  • ').append(a).addClass('room-name-' + room); 151 | 152 | $('
    ').addClass('btn').html('×') 153 | .click(function() { chathandler.removeRoom(type, name)}) 154 | .appendTo(li); 155 | 156 | $('#room_list').append(li); 157 | }, 158 | 159 | /* 160 | * Callback from UI 161 | */ 162 | createGameRoom: function (game, p1, p2) { 163 | var p1span = $('').html(p1).addClass('playername'); 164 | var p2span = $('').html(p2).addClass('playername'); 165 | var vs = $('').html(' vs '); 166 | var sp = $('').append(p1span).append(vs).append(p2span); 167 | 168 | this.createRoom('room', game, sp); 169 | }, 170 | 171 | createPrivateRoom: function (player) { 172 | var psp = $('').html(player).addClass('playername'); 173 | var sp = $('').append(psp); 174 | 175 | this.createRoom('priv', player, sp); 176 | }, 177 | 178 | roomExists: function (type, name) { 179 | return $('.room-name-' + type + '-' + name).length; 180 | }, 181 | /* 182 | * Notify checkbox change for checkbox: 183 | * Hide chat time 184 | */ 185 | hideChatTime: function() { 186 | if (document.getElementById('hide-chat-time').checked) { 187 | localStorage.setItem('hide-chat-time', 'true'); 188 | $('.chattime').each(function (index) { 189 | $(this).addClass('hidden'); 190 | }); 191 | } else { 192 | localStorage.setItem('hide-chat-time', 'false'); 193 | $('.chattime').each(function (index) { 194 | $(this).removeClass('hidden'); 195 | }); 196 | } 197 | }, 198 | showchat: function() { 199 | $('#chat-toggle-button').css('right', this.chat_width+5); 200 | $('#chat-toggle-text').html('>>
    c
    h
    a
    t'); 201 | $('#chat').removeClass('hidden'); 202 | }, 203 | hidechat: function() { 204 | $('#chat-toggle-button').css('right', 0); 205 | $('#chat-toggle-text').html('<<
    c
    h
    a
    t'); 206 | $('#chat').addClass('hidden'); 207 | }, 208 | adjustChatWidth: function(width) { 209 | this.chat_width = width; 210 | 211 | $('#chat-size-display').html(this.chat_width); 212 | $('#chat-size-slider').val(this.chat_width); 213 | $('#chat').width(this.chat_width); 214 | 215 | $('chat-toggle-button').css('right', this.chat_width+5); 216 | }, 217 | togglechat: function() { 218 | if($('#chat').hasClass('hidden')) { 219 | this.showchat() 220 | } else { 221 | this.hidechat(); 222 | } 223 | } 224 | }; 225 | 226 | $(function() { 227 | $.contextMenu({ 228 | selector: '.context-player', 229 | trigger: 'left', 230 | items: { 231 | PrivateChat: { 232 | name: "Private chat", 233 | callback: function(key, opt) { 234 | var name = opt.$trigger[0].innerText.split(':')[0]; 235 | 236 | //Don't create if already exists 237 | if (!chathandler.roomExists('priv', name)) 238 | chathandler.createPrivateRoom(name); 239 | 240 | chathandler.setRoom('priv', name); 241 | } 242 | }, 243 | Games: { 244 | name: "Games", 245 | callback: function(key, opt) { 246 | var name = opt.$trigger[0].innerText.split(':')[0]; 247 | //yuck.. but we don't need any more sophistication 248 | var url = "https://www.playtak.com/games/search?game%5Bplayer_white%5D=kaka&game%5Bplayer_black%5D=kaka&game%5Bjoin%5D=or"; 249 | url = url.replace(/kaka/g, name); 250 | window.open(url); 251 | } 252 | }, 253 | } 254 | }); 255 | 256 | $('.context-player').on('click', function(e){ 257 | console.log('clicked', this); 258 | }) 259 | }); 260 | -------------------------------------------------------------------------------- /js/env.js: -------------------------------------------------------------------------------- 1 | DEBUG = false 2 | -------------------------------------------------------------------------------- /js/game.js: -------------------------------------------------------------------------------- 1 | var camera, scene, renderer; 2 | var mesh; 3 | 4 | init(); 5 | animate(); 6 | 7 | function init() { 8 | 9 | camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 ); 10 | camera.position.z = 400; 11 | 12 | scene = new THREE.Scene(); 13 | 14 | var texture = THREE.ImageUtils.loadTexture( 'textures/crate.gif' ); 15 | 16 | var geometry = new THREE.BoxGeometry( 200, 200, 200 ); 17 | var material = new THREE.MeshBasicMaterial( { map: texture } ); 18 | 19 | mesh = new THREE.Mesh( geometry, material ); 20 | scene.add( mesh ); 21 | 22 | renderer = new THREE.WebGLRenderer(); 23 | renderer.setPixelRatio( window.devicePixelRatio ); 24 | renderer.setSize( window.innerWidth, window.innerHeight ); 25 | document.body.appendChild( renderer.domElement ); 26 | 27 | // 28 | 29 | window.addEventListener( 'resize', onWindowResize, false ); 30 | 31 | } 32 | 33 | function onWindowResize() { 34 | 35 | camera.aspect = window.innerWidth / window.innerHeight; 36 | camera.updateProjectionMatrix(); 37 | 38 | renderer.setSize( window.innerWidth, window.innerHeight ); 39 | 40 | } 41 | 42 | function animate() { 43 | 44 | requestAnimationFrame( animate ); 45 | 46 | mesh.rotation.x += 0.005; 47 | mesh.rotation.y += 0.01; 48 | 49 | renderer.render( scene, camera ); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | function alert(type, msg) { 2 | $('#alert-text').text(msg); 3 | var $alert = $('#alert'); 4 | $alert.removeClass("alert-success alert-info alert-warning alert-danger"); 5 | 6 | $alert.addClass("alert-"+type); 7 | $alert.removeClass('hidden'); 8 | $alert.stop(true, true); 9 | $alert.fadeTo(4000, 500).slideUp(500, function() { 10 | $alert.addClass('hidden'); 11 | }); 12 | alert2(type, msg); 13 | } 14 | 15 | function alert2(type, msg) { 16 | $('#alert-text2').text(msg); 17 | var $alert = $('#alert2'); 18 | $alert.removeClass("alert-success alert-info alert-warning alert-danger"); 19 | 20 | $alert.addClass("alert-"+type); 21 | $alert.removeClass('hidden'); 22 | $alert.stop(true, true); 23 | $alert.fadeTo(4000, 500).slideUp(500, function() { 24 | $alert.addClass('hidden'); 25 | }); 26 | } 27 | 28 | var camera, scene, renderer, light, canvas, controls = null; 29 | 30 | // antialiasing must be disabled per default, so slower devices are not impaired. 31 | var antialiasing_mode = true; 32 | 33 | var botlist = { 34 | "TakticianBot": [0, "Very Hard"], 35 | "TakkerusBot": [5, "Very Hard"], 36 | "alphatak_bot": [10, "Hard"], 37 | "AaaarghBot": [15, "Hard"], 38 | "ShlktBot": [20, "Intermediate"], 39 | "IntuitionBot": [25, "Intermediate"], 40 | "takkybot": [30, "Easy"], 41 | "BeginnerBot": [40, "Beginner"], 42 | "FriendlyBot": [50, "Adjustable"], 43 | "TakticianBotDev": [60, "Experimental"], 44 | "FPABot":[65, "Experimental"], 45 | "alphabot": [70, "Experimental"], 46 | "cutak_bot": [80, "Experimental"] 47 | }; 48 | 49 | init(); 50 | $(window).on("load", animate); 51 | 52 | function init() { 53 | make_style_selector(); 54 | // load the user settings. 55 | loadSettings(); 56 | 57 | canvas = document.getElementById("gamecanvas"); 58 | canvas.width = window.innerWidth; 59 | canvas.height = window.innerHeight; 60 | 61 | camera = new THREE.PerspectiveCamera(70, canvas.width / canvas.height, 1, 2000); 62 | camera.position.set(0, canvas.width / 2, canvas.height / 2); 63 | //camera.updateProjectionMatrix(); 64 | 65 | scene = new THREE.Scene(); 66 | 67 | renderer = new THREE.WebGLRenderer({canvas: canvas, 68 | antialias: antialiasing_mode}); 69 | //renderer.setPixelRatio(window.devicePixelRatio); 70 | renderer.setSize( window.innerWidth, window.innerHeight ); 71 | //renderer.setSize( 800, 640); 72 | renderer.setClearColor(0xdddddd, 1); 73 | 74 | document.body.appendChild(renderer.domElement); 75 | 76 | window.addEventListener('resize', onWindowResize, false); 77 | window.addEventListener('keyup', onKeyUp, false); 78 | 79 | controls = new THREE.OrbitControls(camera, renderer.domElement); 80 | controls.minDistance = 200; 81 | controls.maxDistance = 1500; 82 | controls.enableKeys = false; 83 | var ua = navigator.userAgent.toLowerCase(); 84 | if (ua.indexOf("android") > -1 || ua.indexOf("iphone") > -1 || 85 | ua.indexOf("ipod") > -1 || ua.indexOf("ipad") > -1) 86 | controls.zoomSpeed = 0.5; 87 | 88 | var geometry = new THREE.TorusGeometry(sq_size / 2 + 5, 3, 16, 100); 89 | //geometry.vertices.shift(); 90 | highlighter = new THREE.Mesh(geometry, materials.highlighter); 91 | highlighter.rotateX(Math.PI / 2); 92 | 93 | canvas.addEventListener('mousedown', onDocumentMouseDown, false); 94 | canvas.addEventListener('mouseup', onDocumentMouseUp, false); 95 | canvas.addEventListener('mousemove', onDocumentMouseMove, false); 96 | 97 | board.create(5, "white", true); 98 | board.initEmpty(); 99 | 100 | materials.updateBoardMaterials(); 101 | materials.updatePieceMaterials(); 102 | } 103 | 104 | function onWindowResize() { 105 | /*canvas.width = window.innerWidth; 106 | canvas.height = window.innerHeight; 107 | 108 | renderer.setSize(canvas.width, canvas.height); 109 | 110 | camera.aspect = canvas.width / canvas.height; 111 | camera.updateProjectionMatrix(); 112 | 113 | $('#chat').offset({ top: $('nav').height() + 5 }); 114 | $('#chat-toggle-button').offset({ top: $('nav').height() + 7 }); 115 | $('#chat').height(window.innerHeight - $('nav').height() - 85 116 | + (localStorage.getItem('hide-send')==='true' ? 34 : 0)); 117 | 118 | if(isBreakpoint('xs') || isBreakpoint('sm')) { 119 | chathandler.hidechat(); 120 | hidermenu(); 121 | } else { 122 | chathandler.showchat(); 123 | showrmenu(); 124 | }*/ 125 | } 126 | 127 | var dontanimate=false; 128 | function animate() { 129 | setTimeout(function () { 130 | if(!dontanimate) 131 | requestAnimationFrame(animate); 132 | }, 1000 / 30); 133 | 134 | renderer.render(scene, camera); 135 | controls.update(); 136 | } 137 | 138 | function onDocumentMouseMove(e) { 139 | e.preventDefault(); 140 | var x = e.clientX - canvas.offsetLeft; 141 | var y = e.clientY - canvas.offsetTop; 142 | mouse.x = (x / canvas.width) * 2 - 1; 143 | mouse.y = -(y / canvas.height) * 2 + 1; 144 | 145 | board.mousemove(); 146 | } 147 | 148 | function onDocumentMouseDown(e) { 149 | e.preventDefault(); 150 | 151 | var x = e.clientX - canvas.offsetLeft; 152 | var y = e.clientY - canvas.offsetTop; 153 | mouse.x = (x / canvas.width) * 2 - 1; 154 | mouse.y = -(y / canvas.height) * 2 + 1; 155 | 156 | if (e.button === 2) 157 | board.rightclick(); 158 | else { 159 | if(board.movecount !== board.moveshown) 160 | return; 161 | board.leftclick(); 162 | } 163 | } 164 | 165 | function onDocumentMouseUp(e) { 166 | if (e.button === 2) 167 | board.rightup(); 168 | } 169 | 170 | function onKeyUp(e) { 171 | switch(e.keyCode) { 172 | case 27://ESC 173 | stepback(); 174 | stepforward(); 175 | break; 176 | 177 | case 38://UP 178 | stepback(); 179 | break; 180 | 181 | case 40://DOWN 182 | stepforward(); 183 | break; 184 | } 185 | } 186 | 187 | function output(e) { 188 | if (typeof DEBUG !== 'undefined' && DEBUG) 189 | console.log("output:" + e); 190 | } 191 | 192 | function buttonclick() { 193 | var input = document.getElementById("input"); 194 | var data = input.value; 195 | input.value = ""; 196 | server.send(data); 197 | } 198 | 199 | function scratchbutton(size) { 200 | if (board.observing) 201 | server.send("Unobserve " + board.gameno); 202 | if (board.scratch || board.observing) { 203 | board.clear(); 204 | board.create(size, "white", true); 205 | board.initEmpty(); 206 | } 207 | } 208 | function rmenu() { 209 | if($('#rmenu').hasClass('hidden')) 210 | showrmenu(); 211 | else 212 | hidermenu(); 213 | } 214 | 215 | function showrmenu() { 216 | $('#notation-toggle-text').html('<<
    n
    o
    t
    a
    t
    i
    o
    n'); 217 | $('#rmenu').removeClass('hidden'); 218 | } 219 | 220 | function hidermenu() { 221 | $('#rmenu').addClass('hidden'); 222 | $('#notation-toggle-text').html('>>
    n
    o
    t
    a
    t
    i
    o
    n'); 223 | } 224 | 225 | function zoom(out) { 226 | console.log('zoom', out, controls); 227 | if (out) 228 | controls.constraint.dollyOut(1.5); 229 | else 230 | controls.constraint.dollyIn(1.5); 231 | } 232 | 233 | function load() { 234 | $('#loadmodal').modal('hide') 235 | if (!board.scratch && !board.observing) { 236 | alert('warning', "TPS/PTN won't be displayed in the middle of an online game"); 237 | return; 238 | } 239 | 240 | server.unobserve(); 241 | 242 | var text = $('#loadptntext').val(); 243 | 244 | var tpsRE = /\[(TPS\s*)?\"?\s*([,x12345678SC\/]+)(\s+([\d+]))?(\s+(\d+|-))?\s*\"?\s*\]/; 245 | var tps = tpsRE.exec(text); 246 | 247 | dontanimate = true; 248 | 249 | if(!tps) 250 | board.loadptn(text); 251 | else 252 | board.loadtps(text); 253 | 254 | dontanimate = false; 255 | 256 | $('#loadptntext').val(''); 257 | } 258 | 259 | function loadptn(text) { 260 | $('#loadmodal').modal('hide') 261 | var files = $('#loadptnfile')[0].files; 262 | if(files.length == 0) 263 | return; 264 | var reader = new FileReader(); 265 | reader.onload = function(txt) { 266 | server.unobserve(); 267 | board.loadptn(reader.result); 268 | } 269 | reader.readAsText(files[0]); 270 | } 271 | 272 | function volume_change() { 273 | var movesound = document.getElementById("move-sound"); 274 | var chimesound = document.getElementById("chime-sound"); 275 | 276 | if($('#volume-img').hasClass('fa-volume-off')) { 277 | movesound.muted = false; 278 | chimesound.muted = false; 279 | 280 | movesound.play(); 281 | localStorage.setItem('sound', 'true'); 282 | } else { 283 | movesound.muted = true; 284 | chimesound.muted = true; 285 | 286 | localStorage.setItem('sound', 'false'); 287 | } 288 | $('#volume-img').toggleClass('fa-volume-up fa-volume-off'); 289 | } 290 | 291 | function isBreakpoint( alias ) { 292 | return $('.device-' + alias).is(':hidden'); 293 | } 294 | 295 | function startTime(fromFn) { 296 | if(typeof fromFn === 'undefined' && !server.timervar) 297 | return; 298 | var now = new Date(); 299 | var t = now.getHours()*60*60 + now.getMinutes()*60+now.getSeconds(); 300 | var elapsed = t-lastTimeUpdate; 301 | 302 | if(board.movecount%2 === 0) { 303 | t1 = lastWt - elapsed; 304 | $('.player1-time:first').html(parseInt(t1/60)+':'+getZero(t1%60)); 305 | } else { 306 | t2 = lastBt - elapsed; 307 | $('.player2-time:first').html(parseInt(t2/60)+':'+getZero(t2%60)); 308 | } 309 | 310 | server.timervar = setTimeout(startTime, 500); 311 | } 312 | 313 | function stopTime() { 314 | clearTimeout(server.timervar); 315 | server.timervar = null; 316 | } 317 | 318 | function getZero(t) { 319 | return t<10?'0'+t:t; 320 | } 321 | 322 | /* 323 | * Settings loaded on initialization. Try to keep them in the order of the window. 324 | * First the left-hand div, then the right-hand div. 325 | */ 326 | function loadSettings() { 327 | // load the setting for wall orientation. 328 | if(localStorage.getItem('diagonal_walls')==='true') { 329 | document.getElementById('wall-orientation').checked = true; 330 | diagonal_walls = true; 331 | } 332 | 333 | // load the setting for piece size. 334 | if(localStorage.getItem('piece_size')!==null) { 335 | piece_size = parseInt(localStorage.getItem('piece_size')); 336 | document.getElementById('piece-size-display').innerHTML = piece_size; 337 | document.getElementById('piece-size-slider').value = piece_size; 338 | } 339 | 340 | // load white piece style. 341 | if (localStorage.getItem('piece_style_white2')!==null) { 342 | var styleName = localStorage.getItem('piece_style_white2'); 343 | materials.white_piece_style_name = styleName; 344 | materials.white_cap_style_name = styleName; 345 | document.getElementById('piece-style-white-' + styleName).checked = true; 346 | } 347 | 348 | // load black piece style. 349 | if (localStorage.getItem('piece_style_black2')!==null) { 350 | var styleName = localStorage.getItem('piece_style_black2'); 351 | materials.black_piece_style_name = styleName; 352 | materials.black_cap_style_name = styleName; 353 | document.getElementById('piece-style-black-' + styleName).checked = true; 354 | } 355 | 356 | // load black board style. 357 | if (localStorage.getItem('board_style_black2')!==null) { 358 | var styleName = localStorage.getItem('board_style_black2'); 359 | materials.black_sqr_style_name = styleName; 360 | document.getElementById('board-style-black-' + styleName).checked = true; 361 | } 362 | 363 | // load white board style. 364 | if (localStorage.getItem('board_style_white2')!==null) { 365 | var styleName = localStorage.getItem('board_style_white2'); 366 | materials.white_sqr_style_name = styleName; 367 | document.getElementById('board-style-white-' + styleName).checked = true; 368 | } 369 | 370 | // load the setting for antialiasing. 371 | if(localStorage.getItem('antialiasing_mode')==='false') { 372 | document.getElementById('antialiasing-checkbox').checked = false; 373 | antialiasing_mode = false; 374 | } 375 | 376 | // load whether or not the 'Send' button should be hidden. 377 | if (localStorage.getItem('hide-send')==='true') 378 | { 379 | document.getElementById('hide-send-checkbox').checked = true; 380 | document.getElementById('send-button').style.display = "none"; 381 | $('#chat').height(window.innerHeight - $('nav').height() - 51); 382 | } 383 | 384 | //load setting for hide chat time 385 | if (localStorage.getItem('hide-chat-time')==='true') 386 | { 387 | document.getElementById('hide-chat-time').checked = true; 388 | $('.chattime').each(function(index) { 389 | $(this).addClass('hidden'); 390 | }); 391 | } 392 | 393 | // load the setting for automatically rotating the board, when assigned player 2. 394 | if(localStorage.getItem('auto_rotate')==='false') { 395 | document.getElementById('auto-rotate-checkbox').checked = false; 396 | } 397 | 398 | /*//load chat width.. doesnt work properly 399 | if(localStorage.getItem('chat-width')!==null) { 400 | chat_width = Number(localStorage.getItem('chat-width')); 401 | console.log('val====='+chat_width); 402 | adjustChatWidth(); 403 | }*/ 404 | } 405 | 406 | /* 407 | * Notify checkbox change for checkbox: 408 | * Diagonal walls 409 | */ 410 | function checkboxDiagonalWalls() { 411 | if (document.getElementById('wall-orientation').checked) { 412 | localStorage.setItem('diagonal_walls', 'true'); 413 | diagonal_walls = true; 414 | } else { 415 | localStorage.setItem('diagonal_walls', 'false'); 416 | diagonal_walls = false; 417 | } 418 | board.updatepieces(); 419 | } 420 | 421 | /* 422 | * Notify slider movement: 423 | * Piece size 424 | */ 425 | function sliderPieceSize(newSize) { 426 | localStorage.setItem('piece_size', newSize); 427 | document.getElementById('piece-size-display').innerHTML=newSize; 428 | piece_size = parseInt(newSize); 429 | } 430 | 431 | /* 432 | * Notify radio button check: 433 | * Piece style - white 434 | */ 435 | function radioPieceStyleWhite(styleName) { 436 | document.getElementById('piece-style-white-' + styleName).checked = true; 437 | materials.white_piece_style_name = styleName; 438 | materials.white_cap_style_name = styleName; 439 | localStorage.setItem('piece_style_white2', styleName); 440 | board.updatepieces(); 441 | } 442 | 443 | /* 444 | * Notify radio button check: 445 | * Piece style - black 446 | */ 447 | function radioPieceStyleBlack(styleName) { 448 | document.getElementById('piece-style-black-' + styleName).checked = true; 449 | materials.black_piece_style_name = styleName; 450 | materials.black_cap_style_name = styleName; 451 | localStorage.setItem('piece_style_black2', styleName); 452 | board.updatepieces(); 453 | } 454 | 455 | /* 456 | * Notify radio button check: 457 | * Board style - black 458 | */ 459 | function radioBoardStyleBlack(styleName) { 460 | document.getElementById('board-style-black-' + styleName).checked = true; 461 | materials.black_sqr_style_name = styleName; 462 | localStorage.setItem('board_style_black2', styleName); 463 | board.updateboard(); 464 | } 465 | 466 | /* 467 | * Notify radio button check: 468 | * Board style - white 469 | */ 470 | function radioBoardStyleWhite(styleName) { 471 | document.getElementById('board-style-white-' + styleName).checked = true; 472 | materials.white_sqr_style_name = styleName; 473 | localStorage.setItem('board_style_white2', styleName); 474 | board.updateboard(); 475 | } 476 | 477 | /* 478 | * Notify checkbox change for checkbox: 479 | * Antialiasing 480 | */ 481 | function checkboxAntialiasing() { 482 | if (document.getElementById('antialiasing-checkbox').checked) { 483 | localStorage.setItem('antialiasing_mode', 'true'); 484 | } else { 485 | localStorage.setItem('antialiasing_mode', 'false'); 486 | } 487 | } 488 | 489 | /* 490 | * Notify checkbox change for checkbox: 491 | * Hide 'Send' button 492 | */ 493 | function checkboxHideSend() { 494 | if (document.getElementById('hide-send-checkbox').checked) { 495 | localStorage.setItem('hide-send', 'true'); 496 | document.getElementById('send-button').style.display = "none"; 497 | $('#chat').height(window.innerHeight - $('nav').height() - 51); 498 | } else { 499 | localStorage.setItem('hide-send', 'false'); 500 | document.getElementById('send-button').style.display = "initial"; 501 | $('#chat').height(window.innerHeight - $('nav').height() - 85); 502 | } 503 | 504 | } 505 | 506 | /* 507 | * Notify checkbox change for checkbox: 508 | * Rotate board when player 2 509 | */ 510 | function checkboxAutoRotate() { 511 | if (document.getElementById('auto-rotate-checkbox').checked) { 512 | localStorage.setItem('auto_rotate', 'true'); 513 | } else { 514 | localStorage.setItem('auto_rotate', 'false'); 515 | } 516 | } 517 | 518 | function showPrivacyPolicy() { 519 | $('#help-modal').modal('hide'); 520 | $('#privacy-modal').modal('show'); 521 | } 522 | 523 | function getHeader(key, val) { 524 | return '['+key+' "'+val+'"]\r\n'; 525 | } 526 | 527 | function getNotation() { 528 | var p1 = $('.player1-name:first').html(); 529 | var p2 = $('.player2-name:first').html(); 530 | var now = new Date(); 531 | var dt = (now.getYear()-100)+'.'+(now.getMonth()+1)+'.'+now.getDate()+' '+now.getHours()+'.'+getZero(now.getMinutes()); 532 | 533 | $('#download_notation').attr('download', p1+' vs '+p2+' '+dt+'.ptn'); 534 | 535 | var res=''; 536 | res += getHeader('Site', 'PlayTak.com'); 537 | res += getHeader('Date', '20'+(now.getYear()-100)+'.'+(now.getMonth()+1)+'.'+now.getDate()); 538 | res += getHeader('Player1', p1); 539 | res += getHeader('Player2', p2); 540 | res += getHeader('Size', board.size); 541 | res += getHeader('Result', board.result); 542 | res += '\r\n'; 543 | 544 | var count=1; 545 | 546 | $('#moveslist tr').each(function() { 547 | $('td', this).each(function() { 548 | var val = $(this).text(); 549 | res += val; 550 | 551 | if(count%3 === 0) 552 | res += '\r\n'; 553 | else 554 | res += ' '; 555 | 556 | count++; 557 | }) 558 | }); 559 | 560 | return res; 561 | } 562 | 563 | function downloadNotation() { 564 | $('#download_notation').attr('href', 'data:text/plain;charset=utf-8,'+encodeURIComponent(getNotation())); 565 | } 566 | 567 | function copyNotationLink() { 568 | var link = 'http://www.playtak.com/?load=' + encodeURIComponent(getNotation()); 569 | 570 | var dummy = document.createElement("input"); 571 | document.body.appendChild(dummy); 572 | 573 | dummy.value = link; 574 | dummy.select(); 575 | 576 | try { 577 | var successful = document.execCommand('copy'); 578 | if (successful) 579 | alert('success', 'Copied!'); 580 | else 581 | alert('danger', 'Unable to copy!'); 582 | } catch(err) { 583 | alert('danger', 'Unable to copy!'); 584 | } 585 | 586 | document.body.removeChild(dummy); 587 | } 588 | 589 | function sliderChatSize(newSize) { 590 | chathandler.showchat(); 591 | chathandler.adjustChatWidth(Number(newSize)); 592 | } 593 | 594 | function undoButton() { 595 | if(board.scratch) 596 | board.undo(); 597 | else 598 | server.undo(); 599 | } 600 | 601 | function showresetpwd() { 602 | $('#login').modal('hide'); 603 | $('#resetpwd-modal').modal('show'); 604 | } 605 | 606 | function fastrewind() { 607 | board.showmove(board.movestart); 608 | } 609 | 610 | function stepback() { 611 | board.showmove(board.moveshown-1); 612 | } 613 | 614 | function stepforward() { 615 | board.showmove(board.moveshown+1); 616 | } 617 | 618 | function fastforward() { 619 | board.showmove(board.movecount); 620 | } 621 | 622 | $(document).ready(function() { 623 | if(localStorage.getItem('sound')==='false') { 624 | volume_change(); 625 | } 626 | if(isBreakpoint('xs') || isBreakpoint('sm')) { 627 | chathandler.hidechat(); 628 | hidermenu(); 629 | } else { 630 | chathandler.showchat(); 631 | showrmenu(); 632 | } 633 | chathandler.init(); 634 | if (location.search.startsWith('?load=')) { 635 | var text = decodeURIComponent(location.search.split('?load=')[1]); 636 | $('#loadptntext').val(text.replace(/\n/g, ' ')); 637 | document.title = "Tak Review"; 638 | load(); 639 | } else if(localStorage.getItem('keeploggedin')==='true') { 640 | server.init(); 641 | } 642 | tour(false); 643 | }) 644 | -------------------------------------------------------------------------------- /js/ptn.js: -------------------------------------------------------------------------------- 1 | function parsePTN(text) { 2 | text = text.replace(/\r/g, ''); 3 | text = text.replace(/\{[^}]+\}/gm, ''); 4 | 5 | var header = parsePTNHeader(text); 6 | 7 | var body = text.replace(/\[(\S+)\s+\"([^"]+)\"\]/g, '').trim(); 8 | var moves = parsePTNMoves(body); 9 | if (header && moves) { 10 | return { 11 | tags: header, 12 | moves: moves 13 | } 14 | } 15 | return null; 16 | } 17 | 18 | function parsePTNHeader(header) { 19 | var tags = {}; 20 | var match; 21 | var re = /\[(\S+)\s+\"([^"]+)\"\]/gm; 22 | while ((match = re.exec(header)) !== null) { 23 | tags[match[1]] = match[2]; 24 | } 25 | return tags; 26 | } 27 | 28 | function parsePTNMoves(body) { 29 | var bits = body.split(/\s+/); 30 | var moves = []; 31 | for (var i = 0; i < bits.length; i++) { 32 | var tok = bits[i]; 33 | if (tok.match(/\d+\./)) 34 | continue; 35 | moves.push(tok); 36 | } 37 | return moves; 38 | } 39 | 40 | if(typeof(require) === 'function') { 41 | var ptn1 = ( 42 | '[Site "PlayTak.com"]\n' + 43 | '[Event "Online Play"]\n' + 44 | '[Date "2016.10.22"]\n' + 45 | '[Time "22:06:19"]\n' + 46 | '[Player1 "nelhage"]\n' + 47 | '[Player2 "Ally"]\n' + 48 | '[Clock "10:0 +15"]\n' + 49 | '[Result "F-0"]\n' + 50 | '[Size "5"]\n' + 51 | '\n' + 52 | '1. a1 e1\n' + 53 | '2. d2 a2\n' + 54 | '3. a3 b2\n' + 55 | '4. b3 Cc3\n' + 56 | '5. Cc2 b4\n' + 57 | '6. b1 1c3<1\n' + 58 | '7. 1b1+1 2b3-2\n' + 59 | '8. Sb3 a4\n' + 60 | '9. e2 e4\n' + 61 | '10. d4 d5\n' + 62 | '11. c4 c5\n' + 63 | '12. c3 e5\n' + 64 | '13. b5 1b4+1\n' + 65 | '14. 1c4+1 2b5>2\n' + 66 | '15. Sb5 3c5-3\n' + 67 | '16. 1d4<1 1c5-1\n' + 68 | '17. 1c3+1 Sb4\n' + 69 | '18. 5c4>32 1b4>1\n' + 70 | '19. c3 2c4>2\n' + 71 | '20. c5 c4\n' + 72 | '21. b4 1c4+1\n' + 73 | '22. c4 5d4<23\n' + 74 | '23. 1b5>1 1e5-1\n' + 75 | '24. 2c5-2 4e4-112\n' + 76 | '25. d1 1d5<1\n' + 77 | '26. 4c4>13 4b4>4\n' + 78 | '27. d3 d5\n' + 79 | '28. e5 5c4>5\n' + 80 | '29. c4 Sb4\n' + 81 | '30. 1c2>1 c1\n' + 82 | '31. 2d2+11 4b2>13\n' + 83 | '32. 3e4-12 b1\n' + 84 | '33. 1d1<1 b2\n' + 85 | '34. 1b3-1 d1\n' + 86 | '35. 3e2-3 3d2+3\n' + 87 | '36. 5d4+5 2e3+11\n' + 88 | '37. 4d5>4 5d3+5\n' + 89 | '38. 5e1<5 Se3\n' + 90 | '39. b5') 91 | 92 | console.log(parsePTN(ptn1)); 93 | } 94 | -------------------------------------------------------------------------------- /js/server.js: -------------------------------------------------------------------------------- 1 | var server = { 2 | connection: null, 3 | timeoutvar: null, 4 | myname: null, 5 | tries:0, 6 | timervar: null, 7 | lastTimeUpdate: null, 8 | anotherlogin: false, 9 | 10 | init: function () { 11 | if (this.connection && this.connection.readyState === 2)//closing connection 12 | return; 13 | if (this.connection && this.connection.readyState === 3)//closed 14 | this.connection = null; 15 | if (this.connection) { //user clicked logout 16 | this.connection.close(); 17 | alert("info", "Disconnnecting from server...."); 18 | 19 | localStorage.removeItem('keeploggedin'); 20 | localStorage.removeItem('usr'); 21 | localStorage.removeItem('token'); 22 | return; 23 | } 24 | var url = window.location.host + '/ws'; 25 | var proto = 'wss://'; 26 | if (window.location.protocol === "http:") { 27 | proto = 'ws://'; 28 | } 29 | this.connection = new WebSocket(proto+url, "binary"); 30 | board.server = this; 31 | this.connection.onerror = function (e) { 32 | output("Connection error: " + e); 33 | }; 34 | this.connection.onmessage = function (e) { 35 | var blob = e.data; 36 | var reader = new FileReader(); 37 | reader.onload = function (event) { 38 | var res_text = new TextDecoder("utf-8").decode(reader.result); 39 | var res = res_text.split("\n"); 40 | var i; 41 | for (i = 0; i < res.length - 1; i++) { 42 | server.msg(res[i]); 43 | } 44 | }; 45 | reader.readAsArrayBuffer(blob); 46 | }; 47 | this.connection.onopen = function (e) { 48 | }; 49 | this.connection.onclose = function (e) { 50 | document.getElementById('login-button').textContent = 'Sign up / Login'; 51 | $('#onlineplayers').addClass('hidden'); 52 | document.getElementById("onlineplayersbadge").innerHTML = "0"; 53 | document.getElementById("seekcount").innerHTML = "0"; 54 | document.getElementById("seekcountbot").innerHTML = "0"; 55 | document.getElementById("gamecount").innerHTML = "0"; 56 | document.getElementById("scratchsize").disabled = false; 57 | board.scratch = true; 58 | board.observing = false; 59 | board.gameno = 0; 60 | document.title = "Tak"; 61 | $('#seeklist').children().each(function() { 62 | this.remove(); 63 | }); 64 | $('#seeklistbot').children().each(function() { 65 | this.remove(); 66 | }); 67 | $('#gamelist').children().each(function() { 68 | this.remove(); 69 | }); 70 | stopTime(); 71 | 72 | if(localStorage.getItem('keeploggedin')==='true' && 73 | !server.anotherlogin) { 74 | alert("info", "Connection lost. Trying to reconnect..."); 75 | server.startLoginTimer(); 76 | } else { 77 | alert("info", "You're disconnected from server"); 78 | } 79 | }; 80 | }, 81 | 82 | loginTimer: null, 83 | 84 | startLoginTimer: function() { 85 | if(server.loginTimer !== null) 86 | return; 87 | server.loginTimer = setTimeout(server.loginTimerFn, 5000); 88 | }, 89 | 90 | stopLoginTimer: function() { 91 | if(server.loginTimer == null) 92 | return; 93 | clearTimeout(server.loginTimer); 94 | server.loginTimer = null; 95 | }, 96 | 97 | loginTimerFn: function() { 98 | server.init(); 99 | server.loginTimer = setTimeout(server.loginTimerFn, 5000); 100 | }, 101 | 102 | login: function () { 103 | var name = $('#login-username').val(); 104 | var pass = $('#login-pwd').val(); 105 | 106 | this.send("Login " + name + " " + pass); 107 | }, 108 | guestlogin: function() { 109 | this.send("Login Guest"); 110 | }, 111 | register: function () { 112 | var name = $('#register-username').val(); 113 | var email = $('#register-email').val(); 114 | var retyped_email = $('#retype-register-email').val(); 115 | 116 | if (email !== retyped_email) { 117 | alert("danger", "Email addresses don't match"); 118 | return; 119 | } 120 | 121 | this.send("Register " + name + " " + email); 122 | }, 123 | changepassword: function() { 124 | var curpass = $('#cur-pwd').val(); 125 | var newpass = $('#new-pwd').val(); 126 | var retypenewpass = $('#retype-new-pwd').val(); 127 | 128 | if(newpass !== retypenewpass) { 129 | alert("danger", "Passwords don't match"); 130 | } else { 131 | this.send("ChangePassword "+curpass+" "+newpass); 132 | } 133 | }, 134 | sendresettoken: function() { 135 | var name = $('#resettoken-username').val(); 136 | var email = $('#resettoken-email').val(); 137 | this.send('SendResetToken '+name+' '+email); 138 | }, 139 | resetpwd: function() { 140 | var name = $('#resetpwd-username').val(); 141 | var token = $('#resetpwd-token').val(); 142 | var npwd = $('#reset-new-pwd').val(); 143 | var rnpwd = $('#reset-retype-new-pwd').val(); 144 | if(npwd !== rnpwd) { 145 | alert("danger", "Passwords don't match"); 146 | } else { 147 | this.send('ResetPassword '+name+' '+token+' '+npwd); 148 | } 149 | }, 150 | keepalive: function() { 151 | if(server.connection && server.connection.readyState === 1)//open connection 152 | server.send("PING"); 153 | }, 154 | msg: function (e) { 155 | output(e); 156 | e = e.trim(); 157 | if (e.startsWith("Game Start")) { 158 | //Game Start no. size player_white vs player_black yourcolor time 159 | var spl = e.split(" "); 160 | board.newgame(Number(spl[3]), spl[7]); 161 | board.gameno = Number(spl[2]); 162 | console.log("gno "+board.gameno); 163 | document.getElementById("scratchsize").disabled = true; 164 | 165 | $('#player-me-name').removeClass('player1-name'); 166 | $('#player-me-name').removeClass('player2-name'); 167 | $('#player-opp-name').removeClass('player1-name'); 168 | $('#player-opp-name').removeClass('player2-name'); 169 | 170 | $('#player-me-time').removeClass('player1-time'); 171 | $('#player-me-time').removeClass('player2-time'); 172 | $('#player-opp-time').removeClass('player1-time'); 173 | $('#player-opp-time').removeClass('player2-time'); 174 | 175 | $('#player-me').removeClass('selectplayer'); 176 | $('#player-opp').removeClass('selectplayer'); 177 | 178 | if (spl[7] === "white") {//I am white 179 | $('#player-me-name').addClass('player1-name'); 180 | $('#player-opp-name').addClass('player2-name'); 181 | 182 | $('#player-me-time').addClass('player1-time'); 183 | $('#player-opp-time').addClass('player2-time'); 184 | 185 | $('#player-me-img').addClass('white-player-color'); 186 | $('#player-opp-img').removeClass('white-player-color'); 187 | 188 | $('#player-me').addClass('selectplayer'); 189 | } else {//I am black 190 | $('#player-me-name').addClass('player2-name'); 191 | $('#player-opp-name').addClass('player1-name'); 192 | 193 | $('#player-me-time').addClass('player2-time'); 194 | $('#player-opp-time').addClass('player1-time'); 195 | 196 | $('#player-me-img').removeClass('white-player-color'); 197 | $('#player-opp-img').addClass('white-player-color'); 198 | 199 | $('#player-opp').addClass('selectplayer'); 200 | } 201 | 202 | $('.player1-name:first').html(spl[4]); 203 | $('.player2-name:first').html(spl[6]); 204 | document.title = "Tak: " + spl[4] + " vs " + spl[6]; 205 | 206 | var time = Number(spl[8]); 207 | var m = parseInt(time/60); 208 | var s = getZero(parseInt(time%60)); 209 | $('.player1-time:first').html(m+':'+s); 210 | $('.player2-time:first').html(m+':'+s); 211 | 212 | if (spl[7] === "white") {//I am white 213 | if(!chathandler.roomExists('priv', spl[6])) 214 | chathandler.createPrivateRoom(spl[6]); 215 | chathandler.setRoom('priv', spl[6]); 216 | } else {//I am black 217 | if(!chathandler.roomExists('priv', spl[4])) 218 | chathandler.createPrivateRoom(spl[4]); 219 | chathandler.setRoom('priv', spl[4]); 220 | } 221 | 222 | var chimesound = document.getElementById("chime-sound"); 223 | chimesound.play(); 224 | } 225 | else if (e.startsWith("Observe Game#")) { 226 | //Observe Game#1 player1 vs player2, 4x4, 180, 7 half-moves played, player2 to move 227 | var spl = e.split(" "); 228 | 229 | var p1 = spl[2]; 230 | var p2 = spl[4].split(',')[0]; 231 | 232 | board.clear(); 233 | board.create(Number(spl[5].split("x")[0]), "white", false, true); 234 | board.initEmpty(); 235 | board.gameno = Number(spl[1].split("Game#")[1]); 236 | $('.player1-name:first').html(p1); 237 | $('.player2-name:first').html(p2); 238 | document.title = "Tak: " + p1 + " vs " + p2; 239 | 240 | var time = Number(spl[6].split(",")[0]); 241 | var m = parseInt(time/60); 242 | var s = getZero(parseInt(time%60)); 243 | $('.player1-time:first').html(m+':'+s); 244 | $('.player2-time:first').html(m+':'+s); 245 | 246 | if(!chathandler.roomExists('room', 'Game'+board.gameno)) 247 | chathandler.createGameRoom('Game'+board.gameno, p1, p2); 248 | chathandler.setRoom('room', 'Game'+board.gameno); 249 | } 250 | else if (e.startsWith("GameList Add Game#")) { 251 | //GameList Add Game#1 player1 vs player2, 4x4, 180, 15, 0 half-moves played, player1 to move 252 | var spl = e.split(" "); 253 | 254 | var no = spl[2].split("Game#")[1]; 255 | 256 | var t = Number(spl[7].split(",")[0]); 257 | var m = parseInt(t/60); 258 | var s = getZero(parseInt(t%60)); 259 | 260 | var inc = spl[8].split(",")[0]; 261 | 262 | var p1 = spl[3]; 263 | var p2 = spl[5].split(",")[0]; 264 | var sz = spl[6].split(",")[0]; 265 | 266 | p1 = ""+p1+""; 267 | p2 = ""+p2+""; 268 | sz = ""+sz+""; 269 | 270 | var row = $('').addClass('row').addClass('game'+no) 271 | .click(function() {server.observegame(spl[2].split("Game#")[1]);}) 272 | .appendTo($('#gamelist')); 273 | $('').append(p1).appendTo(row); 274 | $('').append('vs').appendTo(row); 275 | $('').append(p2).appendTo(row); 276 | $('').append(sz).appendTo(row); 277 | $('').append(m+':'+s).appendTo(row); 278 | $('').append('+'+inc+'s').appendTo(row); 279 | 280 | var op = document.getElementById("gamecount"); 281 | op.innerHTML = Number(op.innerHTML)+1; 282 | } 283 | else if (e.startsWith("GameList Remove Game#")) { 284 | //GameList Remove Game#1 player1 vs player2, 4x4, 180, 0 half-moves played, player1 to move 285 | var spl = e.split(" "); 286 | 287 | var no = spl[2].split("Game#")[1]; 288 | var game_element = $('.game'+no); 289 | 290 | var op = document.getElementById("gamecount"); 291 | if (game_element.length) { 292 | op.innerHTML = Number(op.innerHTML)-1; 293 | game_element.remove() 294 | } 295 | else { 296 | console.log('Game '+no+' removed twice.') 297 | } 298 | } 299 | else if (e.startsWith("Game#")) { 300 | var spl = e.split(" "); 301 | var gameno = Number(e.split("Game#")[1].split(" ")[0]); 302 | //Game#1 ... 303 | if(gameno === board.gameno) { 304 | //Game#1 P A4 (C|W) 305 | if (spl[1] === "P") { 306 | board.serverPmove(spl[2].charAt(0), Number(spl[2].charAt(1)), spl[3]); 307 | } 308 | //Game#1 M A2 A5 2 1 309 | else if (spl[1] === "M") { 310 | var nums = []; 311 | for (i = 4; i < spl.length; i++) 312 | nums.push(Number(spl[i])); 313 | board.serverMmove(spl[2].charAt(0), Number(spl[2].charAt(1)), 314 | spl[3].charAt(0), Number(spl[3].charAt(1)), 315 | nums); 316 | } 317 | //Game#1 Time 170 200 318 | else if (spl[1] === "Time") { 319 | var wt = Number(spl[2]); 320 | var bt = Number(spl[3]); 321 | lastWt = wt; 322 | lastBt = bt; 323 | 324 | var now = new Date(); 325 | lastTimeUpdate = now.getHours()*60*60 + now.getMinutes()*60+now.getSeconds(); 326 | 327 | 328 | $('.player1-time:first').html(parseInt(wt/60)+':'+getZero(wt%60)); 329 | $('.player2-time:first').html(parseInt(bt/60)+':'+getZero(bt%60)); 330 | 331 | if(!board.timer_started) { 332 | board.timer_started = true; 333 | startTime(true); 334 | } 335 | } 336 | //Game#1 RequestUndo 337 | else if (spl[1] === "RequestUndo") { 338 | alert("info", "Your opponent requests to undo the last move"); 339 | $('#undo').toggleClass('opp-requested-undo request-undo'); 340 | } 341 | //Game#1 RemoveUndo 342 | else if (spl[1] === "RemoveUndo") { 343 | alert("info", "Your opponent removes undo request"); 344 | $('#undo').toggleClass('opp-requested-undo request-undo'); 345 | } 346 | //Game#1 Undo 347 | else if (spl[1] === "Undo") { 348 | board.undo(); 349 | alert("info", "Game has been UNDOed by 1 move"); 350 | $('#undo').removeClass('i-requested-undo').removeClass('opp-requested-undo').addClass('request-undo'); 351 | } 352 | //Game#1 OfferDraw 353 | else if (spl[1] === "OfferDraw") { 354 | $('#draw').toggleClass('opp-offered-draw offer-draw'); 355 | alert("info", "Draw is offered by your opponent"); 356 | } 357 | //Game#1 RemoveDraw 358 | else if (spl[1] === "RemoveDraw") { 359 | $('#draw').removeClass('i-offered-draw').removeClass('opp-offered-draw').addClass('offer-draw'); 360 | alert("info", "Draw offer is taken back by your opponent"); 361 | } 362 | //Game#1 Over result 363 | else if (spl[1] === "Over") { 364 | document.title = "Tak"; 365 | board.scratch = true; 366 | board.result = spl[2]; 367 | board.notate(spl[2]); 368 | 369 | var msg = "Game over " + spl[2] + "
    "; 370 | var res; 371 | var type; 372 | 373 | if(spl[2] === "R-0" || spl[2] === "0-R") 374 | type = "making a road"; 375 | else if (spl[2] === "F-0" || spl[2] === "0-F") 376 | type = "having more flats"; 377 | else if (spl[2] === "1-0" || spl[2] === "0-1") 378 | type = "resignation or time"; 379 | 380 | if(spl[2] === "R-0" || spl[2] === "F-0" || spl[2] === "1-0") { 381 | if(board.observing === true) { 382 | msg += "White wins by "+type; 383 | } 384 | else if(board.mycolor === "white") { 385 | msg += "You win by "+type; 386 | } else { 387 | msg += "Your opponent wins by "+type; 388 | } 389 | } else if (spl[2] === "1/2-1/2") { 390 | msg += "The game is a draw!"; 391 | } else if (spl[2] === "0-0") { 392 | msg += "The game is aborted!"; 393 | } else {//black wins 394 | if(board.observing === true) { 395 | msg += "Black wins by "+type; 396 | } 397 | else if(board.mycolor === "white") { 398 | msg += "Your opponent wins by "+type; 399 | } else { 400 | msg += "You win by "+type; 401 | } 402 | } 403 | 404 | document.getElementById("scratchsize").disabled = false; 405 | stopTime(); 406 | 407 | $('#gameoveralert-text').html(msg); 408 | $('#gameoveralert').modal('show'); 409 | } 410 | //Game#1 Abandoned 411 | else if (spl[1] === "Abandoned.") { 412 | //Game#1 Abandoned. name quit 413 | document.title = "Tak"; 414 | board.scratch = true; 415 | 416 | if(board.mycolor === "white") { 417 | board.notate("1-0"); 418 | board.result = "1-0"; 419 | } else { 420 | board.notate("0-1"); 421 | board.result = "1-0"; 422 | } 423 | 424 | var msg = "Game abandoned by " + spl[2] + "."; 425 | if(!board.observing) 426 | msg += " You win!"; 427 | 428 | document.getElementById("scratchsize").disabled = false; 429 | stopTime(); 430 | 431 | $('#gameoveralert-text').html(msg); 432 | $('#gameoveralert').modal('show'); 433 | } 434 | } 435 | } 436 | else if (e.startsWith("Login or Register")) { 437 | server.send("Client " + "TakWeb-16.05.26"); 438 | this.timeoutvar = window.setInterval(this.keepalive, 30000); 439 | 440 | if(localStorage.getItem('keeploggedin')==='true' && this.tries<3) { 441 | var uname = localStorage.getItem('usr'); 442 | var token = localStorage.getItem('token'); 443 | server.send("Login " + uname + " " + token); 444 | this.tries++; 445 | } else { 446 | localStorage.removeItem('keeploggedin'); 447 | localStorage.removeItem('usr'); 448 | localStorage.removeItem('token'); 449 | $('#login').modal('show'); 450 | } 451 | } 452 | //Registered ... 453 | else if (e.startsWith("Registered")) { 454 | alert("success", "You're registered! Check mail for password"); 455 | } 456 | //Name already taken 457 | else if (e.startsWith("Name already taken")) { 458 | alert("danger", "Name is already taken"); 459 | } 460 | //Can't register with guest in the name 461 | else if (e.startsWith("Can't register with guest in the name")) { 462 | alert("danger", "Can't register with guest in the name"); 463 | } 464 | //Unknown format for username/email 465 | else if (e.startsWith("Unknown format for username/email")) { 466 | alert("danger", e); 467 | } 468 | //Authentication failure 469 | else if (e.startsWith("Authentication failure")) { 470 | console.log('failure'); 471 | if(($('#login').data('bs.modal') || {}).isShown) { 472 | alert("danger", "Authentication failure"); 473 | } else { 474 | localStorage.removeItem('keeploggedin'); 475 | localStorage.removeItem('usr'); 476 | localStorage.removeItem('token'); 477 | $('#login').modal('show'); 478 | } 479 | } 480 | else if (e.startsWith("Wrong password")) { 481 | alert("danger", "Wrong Password"); 482 | } 483 | //You're already logged in 484 | else if (e.startsWith("You're already logged in")) { 485 | alert("warning", "You're already logged in from another window"); 486 | this.connection.close(); 487 | } 488 | //Welcome kaka! 489 | else if (e.startsWith("Welcome ")) { 490 | server.stopLoginTimer(); 491 | 492 | this.tries = 0; 493 | $('#login').modal('hide'); 494 | document.getElementById('login-button').textContent = 'Logout'; 495 | this.timeoutvar = window.setInterval(this.keepalive, 30000); 496 | this.myname = e.split("Welcome ")[1].split("!")[0]; 497 | alert("success", "You're logged in "+this.myname+"!"); 498 | document.title = "Tak"; 499 | 500 | var rem = $('#keeploggedin').is(':checked'); 501 | if( rem === true && !this.myname.startsWith("Guest")) { 502 | console.log('storing'); 503 | var name = $('#login-username').val(); 504 | var token = $('#login-pwd').val(); 505 | 506 | localStorage.setItem('keeploggedin', 'true'); 507 | localStorage.setItem('usr', name); 508 | localStorage.setItem('token', token); 509 | } 510 | } 511 | else if (e.startsWith("Password changed")) { 512 | $('#settings-modal').modal('hide'); 513 | alert("success", "Password changed!"); 514 | } 515 | else if (e.startsWith("Message")) { 516 | var msg = e.split("Message "); 517 | 518 | if (e.includes("You've logged in from another window. Disconnecting")) 519 | server.anotherlogin = true; 520 | 521 | alert("info", "Server says: " + msg[1]); 522 | } 523 | else if (e.startsWith("Error")) { 524 | var msg = e.split("Error:")[1]; 525 | alert("danger", "Server says: "+msg); 526 | } 527 | //Shout msg 528 | else if (e.startsWith("Shout ")) { 529 | var regex = /Shout <([^\s]*)> (.*)/g; 530 | var match = regex.exec(e); 531 | 532 | chathandler.received('global', '', match[1], match[2]); 533 | } 534 | //ShoutRoom name msg 535 | else if (e.startsWith("ShoutRoom")) { 536 | var regex = /ShoutRoom ([^\s]*) <([^\s]*)> (.*)/g; 537 | var match = regex.exec(e); 538 | 539 | chathandler.received('room', match[1], match[2], match[3]); 540 | } 541 | //Tell msg 542 | else if (e.startsWith("Tell")) { 543 | var regex = /Tell <([^\s]*)> (.*)/g; 544 | var match = regex.exec(e); 545 | 546 | chathandler.received('priv', match[1], match[1], match[2]); 547 | } 548 | //Told msg 549 | else if (e.startsWith("Told")) { 550 | var regex = /Told <([^\s]*)> (.*)/g; 551 | var match = regex.exec(e); 552 | 553 | chathandler.received('priv', match[1], this.myname, match[2]); 554 | } 555 | else if (e.startsWith("CmdReply")) { 556 | var msg = e.split("CmdReply ")[1]; 557 | msg = '' + msg + ''; 558 | 559 | chathandler.raw('global', 'global', msg); 560 | } 561 | //new seek 562 | else if (e.startsWith("Seek new")) { 563 | //Seek new 1 chaitu 5 180 15 W|B 564 | var spl = e.split(" "); 565 | 566 | var no = spl[2]; 567 | var t = Number(spl[5]); 568 | var m = parseInt(t/60); 569 | var s = getZero(parseInt(t%60)); 570 | 571 | var inc = spl[6]; 572 | 573 | var p = spl[3]; 574 | var sz = spl[4]+'x'+spl[4]; 575 | 576 | img = "images/circle_any.svg" 577 | if(spl.length == 8) { 578 | img = (spl[7] === 'W')?"images/circle_white.svg": 579 | "images/circle_black.svg"; 580 | } 581 | img = ''; 582 | 583 | var pspan = ""+p+""; 584 | sz = ""+sz+""; 585 | var botlevel = ""; 586 | 587 | var op = document.getElementById("seekcount"); 588 | var opbot = document.getElementById("seekcountbot"); 589 | 590 | var row = $('').addClass('row').addClass('seek'+no) 591 | .click(function() {server.acceptseek(spl[2])}) 592 | if (p.toLowerCase().indexOf('bot') !== -1) { 593 | var listed = $('#seeklistbot').children(); 594 | var previous = null; 595 | var hardness = 'Unknown'; 596 | var level = 100; 597 | var botsettings = botlist[p]; 598 | 599 | if (botsettings) { 600 | for (var i = 0; i < listed.length; i++) { 601 | var position = +(/(^| )botid([0-9]+)($| )/.exec(listed[i].className)[2]); 602 | if (position < botsettings[0]) { 603 | previous = $(listed[i]); 604 | } 605 | } 606 | level = botsettings[0]; 607 | hardness = botsettings[1]; 608 | } else if (listed.length > 0) { 609 | previous = $(listed[listed.length-1]); 610 | } 611 | 612 | if (previous) 613 | previous.after(row); 614 | else 615 | $('#seeklistbot').prepend(row); 616 | 617 | row.addClass('botid'+level); 618 | botlevel = ""+hardness+""; 619 | opbot.innerHTML = Number(opbot.innerHTML)+1; 620 | } 621 | else { 622 | row.appendTo($('#seeklist')); 623 | op.innerHTML = Number(op.innerHTML)+1; 624 | } 625 | $('').append(img).appendTo(row); 626 | $('').append(botlevel+pspan).appendTo(row); 627 | $('').append(sz).appendTo(row); 628 | $('').append(m+':'+s).appendTo(row); 629 | $('').append('+'+inc+'s').appendTo(row); 630 | } 631 | //remove seek 632 | else if (e.startsWith("Seek remove")) { 633 | //Seek remove 1 chaitu 5 15 634 | var spl = e.split(" "); 635 | 636 | var no = spl[2]; 637 | 638 | var botgame = $('#seeklistbot .seek'+no).length 639 | $('.seek'+no).remove(); 640 | 641 | var op = document.getElementById("seekcount"); 642 | var opbot = document.getElementById("seekcountbot"); 643 | if (botgame) { 644 | opbot.innerHTML = Number(opbot.innerHTML)-1; 645 | } 646 | else{ 647 | op.innerHTML = Number(op.innerHTML)-1; 648 | } 649 | } 650 | //Online players 651 | else if (e.startsWith("Online ")) { 652 | $('#onlineplayers').removeClass('hidden'); 653 | var op = document.getElementById("onlineplayersbadge"); 654 | op.innerHTML = Number(e.split("Online ")[1]); 655 | } 656 | //Reset token sent 657 | else if (e.startsWith("Reset token sent")) { 658 | alert("success", "Token sent to your email"); 659 | $("#resetpwd-ul li:eq(1) a").tab('show'); 660 | } 661 | //Wrong token 662 | else if (e.startsWith("Wrong token")) { 663 | alert("danger", "Wrong token. Try again"); 664 | } 665 | //Password is changed 666 | else if (e.startsWith("Password is changed")) { 667 | alert("danger", "Password changed. Login with your new password."); 668 | $('#resetpwd-modal').modal('hide'); 669 | 670 | var name = $('#resetpwd-username').val(); 671 | var pass = $('#reset-new-pwd').val(); 672 | 673 | this.send("Login " + name + " " + pass); 674 | } 675 | }, 676 | chat: function (type, name, msg) { 677 | if ( type === 'global') 678 | this.send('Shout '+msg); 679 | else if (type == 'room') 680 | this.send('ShoutRoom ' + name + ' ' + msg); 681 | else if (type === 'priv') 682 | this.send('Tell ' + name + ' ' + msg); 683 | else 684 | console.log('undefined chat type'); 685 | }, 686 | leaveroom: function (room ) { 687 | this.send('LeaveRoom ' + room); 688 | }, 689 | send: function (e) { 690 | var binary_data = (new TextEncoder()).encode(e + "\n"); 691 | 692 | if (this.connection && this.connection.readyState === 1) 693 | this.connection.send(binary_data); 694 | else 695 | this.error("You are not logged on to the server"); 696 | }, 697 | error: function (e) { 698 | alert("danger", e); 699 | }, 700 | seek: function () { 701 | var size = $('#boardsize').find(':selected').text(); 702 | size = parseInt(size); 703 | var time = $('#timeselect').find(':selected').text(); 704 | var inc = $('#incselect').find(':selected').text(); 705 | var clrtxt = $('#colorselect').find(':selected').text(); 706 | var clr=''; 707 | if(clrtxt == 'White') 708 | clr = ' W'; 709 | if(clrtxt == 'Black') 710 | clr = ' B'; 711 | 712 | this.send("Seek "+size+" " + (time*60) + " " + inc + clr); 713 | $('#creategamemodal').modal('hide'); 714 | }, 715 | removeseek: function() { 716 | this.send("Seek 0 0 0"); 717 | $('#creategamemodal').modal('hide'); 718 | }, 719 | draw: function() { 720 | if(board.scratch) 721 | return; 722 | else if(board.observing) 723 | return; 724 | 725 | if($('#draw').hasClass("offer-draw")) {//offer 726 | $('#draw').toggleClass('i-offered-draw offer-draw'); 727 | this.send("Game#" + board.gameno + " OfferDraw"); 728 | } else if($('#draw').hasClass("i-offered-draw")) {//remove offer 729 | $('#draw').toggleClass('i-offered-draw offer-draw'); 730 | this.send("Game#" + board.gameno + " RemoveDraw"); 731 | } else {//accept the offer 732 | $('#draw').removeClass('i-offered-draw').removeClass('opp-offered-draw').addClass('offer-draw'); 733 | this.send("Game#" + board.gameno + " OfferDraw"); 734 | } 735 | }, 736 | undo: function() { 737 | if(board.observing) 738 | return; 739 | 740 | if($('#undo').hasClass('request-undo')) {//request undo 741 | this.send("Game#" + board.gameno + " RequestUndo"); 742 | $('#undo').toggleClass('request-undo i-requested-undo'); 743 | alert('info', 'Undo request sent'); 744 | } else if ($('#undo').hasClass('opp-requested-undo')) {//accept request 745 | this.send("Game#" + board.gameno + " RequestUndo"); 746 | $('#undo').toggleClass('request-undo opp-requested-undo'); 747 | } else if ($('#undo').hasClass('i-requested-undo')) {//remove request 748 | this.send("Game#" + board.gameno + " RemoveUndo"); 749 | $('#undo').toggleClass('request-undo i-requested-undo'); 750 | alert('info', 'Undo request removed'); 751 | } 752 | }, 753 | resign: function() { 754 | if(board.scratch) 755 | return; 756 | else if(board.observing) 757 | return; 758 | 759 | this.send("Game#" + board.gameno + " Resign"); 760 | }, 761 | acceptseek: function (e) { 762 | this.send("Accept " + e); 763 | $('#joingame-modal').modal('hide'); 764 | }, 765 | unobserve: function() { 766 | if(board.gameno !== 0) 767 | this.send("Unobserve " + board.gameno); 768 | }, 769 | observegame: function (no) { 770 | $('#watchgame-modal').modal('hide'); 771 | if (board.observing === false && board.scratch === false) //don't observe game while playing another 772 | return; 773 | if (no === board.gameno) 774 | return; 775 | this.unobserve(); 776 | this.send("Observe " + no); 777 | } 778 | }; 779 | -------------------------------------------------------------------------------- /js/style_selector.js: -------------------------------------------------------------------------------- 1 | var white_piece_styles = ["simple", "coral"]; 2 | var black_piece_styles = ["simple", "pietersite"]; 3 | var white_square_styles = ["simple", "ornate", "sand-velvet", "white-velvet"]; 4 | var black_square_styles = ["simple", "red-ornate", "sand-velvet", "blue-velvet"]; 5 | 6 | function make_board_selector(color) 7 | { 8 | var form = $('#'+color+'_squares_form') 9 | 10 | if (color === 'white') { 11 | arr = white_square_styles; 12 | call = 'radioBoardStyleWhite'; 13 | } else { 14 | arr = black_square_styles; 15 | call = 'radioBoardStyleBlack'; 16 | } 17 | 18 | for(var i=0;i').addClass('radio-list-item'); 21 | var inp = $('').attr('id', 'board-style-'+color+'-' + style) 22 | .attr('type', 'radio') 23 | .attr('name', 'board-style'); 24 | var img = $('').attr('src', 'images/board/preview/'+color+'_' + style + '.png') 25 | .addClass('radio-list-img') 26 | .height(50).width(50) 27 | .attr('onClick', call+'(\''+style+'\')'); 28 | div.append(inp).append(img); 29 | form.append(div); 30 | } 31 | } 32 | 33 | function make_piece_selector(color) 34 | { 35 | var form = $('#'+color+'_pieces_form') 36 | 37 | if (color === 'white') { 38 | arr = white_piece_styles; 39 | call = 'radioPieceStyleWhite'; 40 | } else { 41 | arr = black_piece_styles; 42 | call = 'radioPieceStyleBlack'; 43 | } 44 | 45 | for(var i=0;i').addClass('radio-list-item'); 48 | var inp = $('').attr('id', 'piece-style-'+color+'-' + style) 49 | .attr('type', 'radio') 50 | .attr('name', 'piece-style'); 51 | var img = $('').attr('src', 'images/pieces/preview/'+color+'_' + style + '_pieces.png') 52 | .addClass('radio-list-img') 53 | .height(50).width(50) 54 | .attr('onClick', call+'(\''+style+'\')'); 55 | div.append(inp).append(img); 56 | form.append(div); 57 | } 58 | } 59 | 60 | function make_style_selector() 61 | { 62 | make_board_selector('white'); 63 | make_board_selector('black'); 64 | make_piece_selector('white'); 65 | make_piece_selector('black'); 66 | } 67 | -------------------------------------------------------------------------------- /js/thirdparty/OrbitControls.min.js: -------------------------------------------------------------------------------- 1 | (function(){function a(f){this.object=f;this.target=new THREE.Vector3();this.minDistance=0;this.maxDistance=Infinity;this.minZoom=0;this.maxZoom=Infinity;this.minPolarAngle=0;this.maxPolarAngle=Math.PI;this.minAzimuthAngle=-Infinity;this.maxAzimuthAngle=Infinity;this.enableDamping=false;this.dampingFactor=0.25;var j=this;var h=0.000001;var c;var i;var d=0;var k=0;var e=1;var g=new THREE.Vector3();var b=false;this.getPolarAngle=function(){return i};this.getAzimuthalAngle=function(){return c};this.rotateLeft=function(l){k-=l};this.rotateUp=function(l){d-=l};this.panLeft=function(){var l=new THREE.Vector3();return function m(o){var n=this.object.matrix.elements;l.set(n[0],n[1],n[2]);l.multiplyScalar(-o);g.add(l)}}();this.panUp=function(){var l=new THREE.Vector3();return function m(o){var n=this.object.matrix.elements;l.set(n[4],n[5],n[6]);l.multiplyScalar(o);g.add(l)}}();this.pan=function(n,m,p,r){if(j.object instanceof THREE.PerspectiveCamera){var l=j.object.position;var q=l.clone().sub(j.target);var o=q.length();o*=Math.tan((j.object.fov/2)*Math.PI/180);j.panLeft(2*n*o/r);j.panUp(2*m*o/r)}else{if(j.object instanceof THREE.OrthographicCamera){j.panLeft(n*(j.object.right-j.object.left)/p);j.panUp(m*(j.object.top-j.object.bottom)/r)}else{console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")}}};this.dollyIn=function(l){if(j.object instanceof THREE.PerspectiveCamera){e/=l}else{if(j.object instanceof THREE.OrthographicCamera){j.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*l));j.object.updateProjectionMatrix();b=true}else{console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")}}};this.dollyOut=function(l){if(j.object instanceof THREE.PerspectiveCamera){e*=l}else{if(j.object instanceof THREE.OrthographicCamera){j.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/l));j.object.updateProjectionMatrix();b=true}else{console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")}}};this.update=function(){var p=new THREE.Vector3();var n=new THREE.Quaternion().setFromUnitVectors(f.up,new THREE.Vector3(0,1,0));var o=n.clone().inverse();var m=new THREE.Vector3();var l=new THREE.Quaternion();return function(){var r=this.object.position;p.copy(r).sub(this.target);p.applyQuaternion(n);c=Math.atan2(p.x,p.z);i=Math.atan2(Math.sqrt(p.x*p.x+p.z*p.z),p.y);c+=k;i+=d;c=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,c));i=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,i));i=Math.max(h,Math.min(Math.PI-h,i));var q=p.length()*e;q=Math.max(this.minDistance,Math.min(this.maxDistance,q));this.target.add(g);p.x=q*Math.sin(i)*Math.sin(c);p.y=q*Math.cos(i);p.z=q*Math.sin(i)*Math.cos(c);p.applyQuaternion(o);r.copy(this.target).add(p);this.object.lookAt(this.target);if(this.enableDamping===true){k*=(1-this.dampingFactor);d*=(1-this.dampingFactor)}else{k=0;d=0}e=1;g.set(0,0,0);if(b||m.distanceToSquared(this.object.position)>h||8*(1-l.dot(this.object.quaternion))>h){m.copy(this.object.position);l.copy(this.object.quaternion);b=false;return true}return false}}()}THREE.OrbitControls=function(E,D){var b=new a(E);this.domElement=(D!==undefined)?D:document;Object.defineProperty(this,"constraint",{get:function(){return b}});this.getPolarAngle=function(){return b.getPolarAngle()};this.getAzimuthalAngle=function(){return b.getAzimuthalAngle()};this.enabled=true;this.center=this.target;this.enableZoom=true;this.zoomSpeed=1;this.enableRotate=true;this.rotateSpeed=1;this.enablePan=true;this.keyPanSpeed=7;this.autoRotate=false;this.autoRotateSpeed=2;this.enableKeys=true;this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40};this.mouseButtons={ORBIT:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT};var c=this;var A=new THREE.Vector2();var h=new THREE.Vector2();var o=new THREE.Vector2();var e=new THREE.Vector2();var l=new THREE.Vector2();var z=new THREE.Vector2();var d=new THREE.Vector2();var s=new THREE.Vector2();var x=new THREE.Vector2();var w={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5};var i=w.NONE;this.target0=this.target.clone();this.position0=this.object.position.clone();this.zoom0=this.object.zoom;var C={type:"change"};var t={type:"start"};var q={type:"end"};function r(G,F){var H=c.domElement===document?c.domElement.body:c.domElement;b.pan(G,F,H.clientWidth,H.clientHeight)}this.update=function(){if(this.autoRotate&&i===w.NONE){b.rotateLeft(j())}if(b.update()===true){this.dispatchEvent(C)}};this.reset=function(){i=w.NONE;this.target.copy(this.target0);this.object.position.copy(this.position0);this.object.zoom=this.zoom0;this.object.updateProjectionMatrix();this.dispatchEvent(C);this.update()};function j(){return 2*Math.PI/60/60*c.autoRotateSpeed}function v(){return Math.pow(0.95,c.zoomSpeed)}function k(F){if(c.enabled===false){return}F.preventDefault();if(F.button===c.mouseButtons.ORBIT){if(c.enableRotate===false){return}i=w.ROTATE;A.set(F.clientX,F.clientY)}else{if(F.button===c.mouseButtons.ZOOM){if(c.enableZoom===false){return}i=w.DOLLY;d.set(F.clientX,F.clientY)}else{if(F.button===c.mouseButtons.PAN){if(c.enablePan===false){return}i=w.PAN;e.set(F.clientX,F.clientY)}}}if(i!==w.NONE){document.addEventListener("mousemove",n,false);document.addEventListener("mouseup",g,false);c.dispatchEvent(t)}}function n(G){if(c.enabled===false){return}G.preventDefault();var F=c.domElement===document?c.domElement.body:c.domElement;if(i===w.ROTATE){if(c.enableRotate===false){return}h.set(G.clientX,G.clientY);o.subVectors(h,A);b.rotateLeft(2*Math.PI*o.x/F.clientWidth*c.rotateSpeed);b.rotateUp(2*Math.PI*o.y/F.clientHeight*c.rotateSpeed);A.copy(h)}else{if(i===w.DOLLY){if(c.enableZoom===false){return}s.set(G.clientX,G.clientY);x.subVectors(s,d);if(x.y>0){b.dollyIn(v())}else{if(x.y<0){b.dollyOut(v())}}d.copy(s)}else{if(i===w.PAN){if(c.enablePan===false){return}l.set(G.clientX,G.clientY);z.subVectors(l,e);r(z.x,z.y);e.copy(l)}}}if(i!==w.NONE){c.update()}}function g(){if(c.enabled===false){return}document.removeEventListener("mousemove",n,false);document.removeEventListener("mouseup",g,false);c.dispatchEvent(q);i=w.NONE}function m(F){if(c.enabled===false||c.enableZoom===false||i!==w.NONE){return}F.preventDefault();F.stopPropagation();var G=0;if(F.wheelDelta!==undefined){G=F.wheelDelta}else{if(F.detail!==undefined){G=-F.detail}}if(G>0){b.dollyOut(v())}else{if(G<0){b.dollyIn(v())}}c.update();c.dispatchEvent(t);c.dispatchEvent(q)}function f(F){if(c.enabled===false||c.enableKeys===false||c.enablePan===false){return}switch(F.keyCode){case c.keys.UP:r(0,c.keyPanSpeed);c.update();break;case c.keys.BOTTOM:r(0,-c.keyPanSpeed);c.update();break;case c.keys.LEFT:r(c.keyPanSpeed,0);c.update();break;case c.keys.RIGHT:r(-c.keyPanSpeed,0);c.update();break}}function y(H){if(c.enabled===false){return}switch(H.touches.length){case 1:if(c.enableRotate===false){return}i=w.TOUCH_ROTATE;A.set(H.touches[0].pageX,H.touches[0].pageY);break;case 2:if(c.enableZoom===false){return}i=w.TOUCH_DOLLY;var G=H.touches[0].pageX-H.touches[1].pageX;var F=H.touches[0].pageY-H.touches[1].pageY;var I=Math.sqrt(G*G+F*F);d.set(0,I);break;case 3:if(c.enablePan===false){return}i=w.TOUCH_PAN;e.set(H.touches[0].pageX,H.touches[0].pageY);break;default:i=w.NONE}if(i!==w.NONE){c.dispatchEvent(t)}}function p(I){if(c.enabled===false){return}I.preventDefault();I.stopPropagation();var H=c.domElement===document?c.domElement.body:c.domElement;switch(I.touches.length){case 1:if(c.enableRotate===false){return}if(i!==w.TOUCH_ROTATE){return}h.set(I.touches[0].pageX,I.touches[0].pageY);o.subVectors(h,A);b.rotateLeft(2*Math.PI*o.x/H.clientWidth*c.rotateSpeed);b.rotateUp(2*Math.PI*o.y/H.clientHeight*c.rotateSpeed);A.copy(h);c.update();break;case 2:if(c.enableZoom===false){return}if(i!==w.TOUCH_DOLLY){return}var G=I.touches[0].pageX-I.touches[1].pageX;var F=I.touches[0].pageY-I.touches[1].pageY;var J=Math.sqrt(G*G+F*F);s.set(0,J);x.subVectors(s,d);if(x.y>0){b.dollyOut(v())}else{if(x.y<0){b.dollyIn(v())}}d.copy(s);c.update();break;case 3:if(c.enablePan===false){return}if(i!==w.TOUCH_PAN){return}l.set(I.touches[0].pageX,I.touches[0].pageY);z.subVectors(l,e);r(z.x,z.y);e.copy(l);c.update();break;default:i=w.NONE}}function B(){if(c.enabled===false){return}c.dispatchEvent(q);i=w.NONE}function u(F){F.preventDefault()}this.dispose=function(){this.domElement.removeEventListener("contextmenu",u,false);this.domElement.removeEventListener("mousedown",k,false);this.domElement.removeEventListener("mousewheel",m,false);this.domElement.removeEventListener("DOMMouseScroll",m,false);this.domElement.removeEventListener("touchstart",y,false);this.domElement.removeEventListener("touchend",B,false);this.domElement.removeEventListener("touchmove",p,false);document.removeEventListener("mousemove",n,false);document.removeEventListener("mouseup",g,false);window.removeEventListener("keydown",f,false)};this.domElement.addEventListener("contextmenu",u,false);this.domElement.addEventListener("mousedown",k,false);this.domElement.addEventListener("mousewheel",m,false);this.domElement.addEventListener("DOMMouseScroll",m,false);this.domElement.addEventListener("touchstart",y,false);this.domElement.addEventListener("touchend",B,false);this.domElement.addEventListener("touchmove",p,false);window.addEventListener("keydown",f,false);this.update()};THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.OrbitControls.prototype.constructor=THREE.OrbitControls;Object.defineProperties(THREE.OrbitControls.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(b){console.warn("THREE.OrbitControls: target is now immutable. Use target.set() instead.");this.constraint.target.copy(b)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(b){this.constraint.minDistance=b}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(b){this.constraint.maxDistance=b}},minZoom:{get:function(){return this.constraint.minZoom},set:function(b){this.constraint.minZoom=b}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(b){this.constraint.maxZoom=b}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(b){this.constraint.minPolarAngle=b}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(b){this.constraint.maxPolarAngle=b}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(b){this.constraint.minAzimuthAngle=b}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(b){this.constraint.maxAzimuthAngle=b}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(b){this.constraint.enableDamping=b}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(b){this.constraint.dampingFactor=b}},noZoom:{get:function(){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.");return !this.enableZoom},set:function(b){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.");this.enableZoom=!b}},noRotate:{get:function(){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.");return !this.enableRotate},set:function(b){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.");this.enableRotate=!b}},noPan:{get:function(){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.");return !this.enablePan},set:function(b){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.");this.enablePan=!b}},noKeys:{get:function(){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.");return !this.enableKeys},set:function(b){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.");this.enableKeys=!b}},staticMoving:{get:function(){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.");return !this.constraint.enableDamping},set:function(b){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.");this.constraint.enableDamping=!b}},dynamicDampingFactor:{get:function(){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.");return this.constraint.dampingFactor},set:function(b){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.");this.constraint.dampingFactor=b}}})}()); -------------------------------------------------------------------------------- /js/thirdparty/bootstrap-tour.min.js: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * bootstrap-tour - v0.10.1 3 | * http://bootstraptour.com 4 | * ======================================================================== 5 | * Copyright 2012-2013 Ulrich Sossou 6 | * 7 | * ======================================================================== 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | * ======================================================================== 20 | */ 21 | 22 | !function(t,e){var o,n;return n=e.document,o=function(){function o(o){var n;try{n=e.localStorage}catch(i){n=!1}this._options=t.extend({name:"tour",steps:[],container:"body",autoscroll:!0,keyboard:!0,storage:n,debug:!1,backdrop:!1,backdropPadding:0,redirect:!0,orphan:!1,duration:!1,delay:!1,basePath:"",template:'',afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){}},o),this._force=!1,this._inited=!1,this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return o.prototype.addSteps=function(t){var e,o,n;for(o=0,n=t.length;n>o;o++)e=t[o],this.addStep(e);return this},o.prototype.addStep=function(t){return this._options.steps.push(t),this},o.prototype.getStep=function(e){return null!=this._options.steps[e]?t.extend({id:"step-"+e,path:"",placement:"right",title:"",content:"

    ",next:e===this._options.steps.length-1?-1:e+1,prev:e-1,animation:!0,container:this._options.container,autoscroll:this._options.autoscroll,backdrop:this._options.backdrop,backdropPadding:this._options.backdropPadding,redirect:this._options.redirect,orphan:this._options.orphan,duration:this._options.duration,delay:this._options.delay,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume},this._options.steps[e]):void 0},o.prototype.init=function(t){return this._force=t,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),this._onResize(function(t){return function(){return t.showStep(t._current)}}(this)),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},o.prototype.start=function(t){var e;return null==t&&(t=!1),this._inited||this.init(t),null===this._current&&(e=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(e,this.showStep,0)),this},o.prototype.next=function(){var t;return t=this.hideStep(this._current),this._callOnPromiseDone(t,this._showNextStep)},o.prototype.prev=function(){var t;return t=this.hideStep(this._current),this._callOnPromiseDone(t,this._showPrevStep)},o.prototype.goTo=function(t){var e;return e=this.hideStep(this._current),this._callOnPromiseDone(e,this.showStep,t)},o.prototype.end=function(){var o,i;return o=function(o){return function(){return t(n).off("click.tour-"+o._options.name),t(n).off("keyup.tour-"+o._options.name),t(e).off("resize.tour-"+o._options.name),o._setState("end","yes"),o._inited=!1,o._force=!1,o._clearTimer(),null!=o._options.onEnd?o._options.onEnd(o):void 0}}(this),i=this.hideStep(this._current),this._callOnPromiseDone(i,o)},o.prototype.ended=function(){return!this._force&&!!this._getState("end")},o.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this.start()},o.prototype.pause=function(){var t;return t=this.getStep(this._current),t&&t.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,e.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=t.onPause?t.onPause(this,this._duration):void 0):this},o.prototype.resume=function(){var t;return t=this.getStep(this._current),t&&t.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||t.duration,this._timer=e.setTimeout(function(t){return function(){return t._isLast()?t.next():t.end()}}(this),this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=t.onResume&&this._duration!==t.duration?t.onResume(this,this._duration):void 0):this},o.prototype.hideStep=function(e){var o,n,i;return(i=this.getStep(e))?(this._clearTimer(),n=this._makePromise(null!=i.onHide?i.onHide(this,e):void 0),o=function(o){return function(){var n;return n=t(i.element),n.data("bs.popover")||n.data("popover")||(n=t("body")),n.popover("destroy").removeClass("tour-"+o._options.name+"-element tour-"+o._options.name+"-"+e+"-element"),i.reflex&&n.removeClass("tour-step-element-reflex").off(""+o._reflexEvent(i.reflex)+".tour-"+o._options.name),i.backdrop&&o._hideBackdrop(),null!=i.onHidden?i.onHidden(o):void 0}}(this),this._callOnPromiseDone(n,o),n):void 0},o.prototype.showStep=function(t){var o,i,r,s;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(s=this.getStep(t))?(r=t").parent().html()},o.prototype._reflexEvent=function(t){return"[object Boolean]"==={}.toString.call(t)?"click":t},o.prototype._reposition=function(e,o){var i,r,s,a,p,u,h;if(a=e[0].offsetWidth,r=e[0].offsetHeight,h=e.offset(),p=h.left,u=h.top,i=t(n).outerHeight()-h.top-e.outerHeight(),0>i&&(h.top=h.top+i),s=t("html").outerWidth()-h.left-e.outerWidth(),0>s&&(h.left=h.left+s),h.top<0&&(h.top=0),h.left<0&&(h.left=0),e.offset(h),"bottom"===o.placement||"top"===o.placement){if(p!==h.left)return this._replaceArrow(e,2*(h.left-p),a,"left")}else if(u!==h.top)return this._replaceArrow(e,2*(h.top-u),r,"top")},o.prototype._center=function(o){return o.css("top",t(e).outerHeight()/2-o.outerHeight()/2)},o.prototype._replaceArrow=function(t,e,o,n){return t.find(".arrow").css(n,e?50*(1-e/o)+"%":"")},o.prototype._scrollIntoView=function(o,n){var i,r,s,a,p,u;return i=t(o),i.length?(r=t(e),a=i.offset().top,u=r.height(),p=Math.max(0,a-u/2),this._debug("Scroll into view. ScrollTop: "+p+". Element offset: "+a+". Window height: "+u+"."),s=0,t("body, html").stop(!0,!0).animate({scrollTop:Math.ceil(p)},function(t){return function(){return 2===++s?(n(),t._debug("Scroll into view.\nAnimation end element offset: "+i.offset().top+".\nWindow height: "+r.height()+".")):void 0}}(this))):n()},o.prototype._onResize=function(o,n){return t(e).on("resize.tour-"+this._options.name,function(){return clearTimeout(n),n=setTimeout(o,100)})},o.prototype._initMouseNavigation=function(){var e;return e=this,t(n).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']",function(t){return function(e){return e.preventDefault(),t.next()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']",function(t){return function(e){return e.preventDefault(),t.prev()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(t){return function(e){return e.preventDefault(),t.end()}}(this)).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(o){var n;return o.preventDefault(),n=t(this),n.text(e._paused?n.data("pause-text"):n.data("resume-text")),e._paused?e.resume():e.pause()})},o.prototype._initKeyboardNavigation=function(){return this._options.keyboard?t(n).on("keyup.tour-"+this._options.name,function(t){return function(e){if(e.which)switch(e.which){case 39:return e.preventDefault(),t._isLast()?t.next():t.end();case 37:if(e.preventDefault(),t._current>0)return t.prev();break;case 27:return e.preventDefault(),t.end()}}}(this)):void 0},o.prototype._makePromise=function(e){return e&&t.isFunction(e.then)?e:null},o.prototype._callOnPromiseDone=function(t,e,o){return t?t.then(function(t){return function(){return e.call(t,o)}}(this)):e.call(this,o)},o.prototype._showBackdrop=function(){return this.backdrop.backgroundShown?void 0:(this.backdrop=t("
    ",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,t("body").append(this.backdrop))},o.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},o.prototype._hideBackground=function(){return this.backdrop?(this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1):void 0},o.prototype._showOverlayElement=function(e){var o,n;return o=t(e.element),o&&0!==o.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,this.backdrop.$element=o.addClass("tour-step-backdrop"),this.backdrop.$background=t("
    ",{"class":"tour-step-background"}),n={width:o.innerWidth(),height:o.innerHeight(),offset:o.offset()},this.backdrop.$background.appendTo("body"),e.backdropPadding&&(n=this._applyBackdropPadding(e.backdropPadding,n)),this.backdrop.$background.width(n.width).height(n.height).offset(n.offset)):void 0},o.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},o.prototype._applyBackdropPadding=function(t,e){return"object"==typeof t?(null==t.top&&(t.top=0),null==t.right&&(t.right=0),null==t.bottom&&(t.bottom=0),null==t.left&&(t.left=0),e.offset.top=e.offset.top-t.top,e.offset.left=e.offset.left-t.left,e.width=e.width+t.left+t.right,e.height=e.height+t.top+t.bottom):(e.offset.top=e.offset.top-t,e.offset.left=e.offset.left-t,e.width=e.width+2*t,e.height=e.height+2*t),e},o.prototype._clearTimer=function(){return e.clearTimeout(this._timer),this._timer=null,this._duration=null},o}(),e.Tour=o}(jQuery,window); -------------------------------------------------------------------------------- /js/thirdparty/jquery.contextMenu.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery contextMenu v2.2.4-dev - Plugin for simple contextMenu handling 3 | * 4 | * Version: v2.2.4-dev 5 | * 6 | * Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF) 7 | * Web: http://swisnl.github.io/jQuery-contextMenu/ 8 | * 9 | * Copyright (c) 2011-2016 SWIS BV and contributors 10 | * 11 | * Licensed under 12 | * MIT License http://www.opensource.org/licenses/mit-license 13 | * GPL v3 http://opensource.org/licenses/GPL-3.0 14 | * 15 | * Date: 2016-07-17T19:45:35.567Z 16 | */ 17 | !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";function t(e){for(var t,n=e.split(/\s+/),a=[],o=0;t=n[o];o++)t=t.charAt(0).toUpperCase(),a.push(t);return a}function n(t){return t.id&&e('label[for="'+t.id+'"]').val()||t.name}function a(t,o,s){return s||(s=0),o.each(function(){var o,i,c=e(this),r=this,l=this.nodeName.toLowerCase();switch("label"===l&&c.find("input, textarea, select").length&&(o=c.text(),c=c.children().first(),r=c.get(0),l=r.nodeName.toLowerCase()),l){case"menu":i={name:c.attr("label"),items:{}},s=a(i.items,c.children(),s);break;case"a":case"button":i={name:c.text(),disabled:!!c.attr("disabled"),callback:function(){return function(){c.click()}}()};break;case"menuitem":case"command":switch(c.attr("type")){case void 0:case"command":case"menuitem":i={name:c.attr("label"),disabled:!!c.attr("disabled"),icon:c.attr("icon"),callback:function(){return function(){c.click()}}()};break;case"checkbox":i={type:"checkbox",disabled:!!c.attr("disabled"),name:c.attr("label"),selected:!!c.attr("checked")};break;case"radio":i={type:"radio",disabled:!!c.attr("disabled"),name:c.attr("label"),radio:c.attr("radiogroup"),value:c.attr("id"),selected:!!c.attr("checked")};break;default:i=void 0}break;case"hr":i="-------";break;case"input":switch(c.attr("type")){case"text":i={type:"text",name:o||n(r),disabled:!!c.attr("disabled"),value:c.val()};break;case"checkbox":i={type:"checkbox",name:o||n(r),disabled:!!c.attr("disabled"),selected:!!c.attr("checked")};break;case"radio":i={type:"radio",name:o||n(r),disabled:!!c.attr("disabled"),radio:!!c.attr("name"),value:c.val(),selected:!!c.attr("checked")};break;default:i=void 0}break;case"select":i={type:"select",name:o||n(r),disabled:!!c.attr("disabled"),selected:c.val(),options:{}},c.children().each(function(){i.options[this.value]=e(this).text()});break;case"textarea":i={type:"textarea",name:o||n(r),disabled:!!c.attr("disabled"),value:c.val()};break;case"label":break;default:i={type:"html",html:c.clone(!0)}}i&&(s++,t["key"+s]=i)}),s}e.support.htmlMenuitem="HTMLMenuItemElement"in window,e.support.htmlCommand="HTMLCommandElement"in window,e.support.eventSelectstart="onselectstart"in document.documentElement,e.ui&&e.widget||(e.cleanData=function(t){return function(n){var a,o,s;for(s=0;null!=n[s];s++){o=n[s];try{a=e._data(o,"events"),a&&a.remove&&e(o).triggerHandler("remove")}catch(i){}}t(n)}}(e.cleanData));var o=null,s=!1,i=e(window),c=0,r={},l={},u={},d={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,classNames:{hover:"context-menu-hover",disabled:"context-menu-disabled",visible:"context-menu-visible",notSelectable:"context-menu-not-selectable",icon:"context-menu-icon",iconEdit:"context-menu-icon-edit",iconCut:"context-menu-icon-cut",iconCopy:"context-menu-icon-copy",iconPaste:"context-menu-icon-paste",iconDelete:"context-menu-icon-delete",iconAdd:"context-menu-icon-add",iconQuit:"context-menu-icon-quit"},determinePosition:function(t){if(e.ui&&e.ui.position)t.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var n=this.offset();n.top+=this.outerHeight(),n.left+=this.outerWidth()/2-t.outerWidth()/2,t.css(n)}},position:function(e,t,n){var a;if(!t&&!n)return void e.determinePosition.call(this,e.$menu);a="maintain"===t&&"maintain"===n?e.$menu.position():{top:n,left:t};var o=i.scrollTop()+i.height(),s=i.scrollLeft()+i.width(),c=e.$menu.outerHeight(),r=e.$menu.outerWidth();a.top+c>o&&(a.top-=c),a.top<0&&(a.top=0),a.left+r>s&&(a.left-=r),a.left<0&&(a.left=0),e.$menu.css(a)},positionSubmenu:function(t){if(e.ui&&e.ui.position)t.css("display","block").position({my:"left top",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var n={top:0,left:this.outerWidth()};t.css(n)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:e.noop,hide:e.noop},callback:null,items:{}},m={timer:null,pageX:null,pageY:null},p=function(e){for(var t=0,n=e;;)if(t=Math.max(t,parseInt(n.css("z-index"),10)||0),n=n.parent(),!n||!n.length||"html body".indexOf(n.prop("nodeName").toLowerCase())>-1)break;return t},f={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(t){var n=e(this);if("right"===t.data.trigger&&(t.preventDefault(),t.stopImmediatePropagation()),!("right"!==t.data.trigger&&"demand"!==t.data.trigger&&t.originalEvent||!(void 0===t.mouseButton||!t.data||"left"===t.data.trigger&&0===t.mouseButton||"right"===t.data.trigger&&2===t.mouseButton)||n.hasClass("context-menu-active")||n.hasClass("context-menu-disabled"))){if(o=n,t.data.build){var a=t.data.build(o,t);if(a===!1)return;if(t.data=e.extend(!0,{},d,t.data,a||{}),!t.data.items||e.isEmptyObject(t.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");t.data.$trigger=o,h.create(t.data)}var s=!1;for(var i in t.data.items)if(t.data.items.hasOwnProperty(i)){var c;c=e.isFunction(t.data.items[i].visible)?t.data.items[i].visible.call(e(t.currentTarget),i,t.data):"undefined"==typeof i.visible||t.data.items[i].visible===!0,c&&(s=!0)}s&&h.show.call(n,t.data,t.pageX,t.pageY)}},click:function(t){t.preventDefault(),t.stopImmediatePropagation(),e(this).trigger(e.Event("contextmenu",{data:t.data,pageX:t.pageX,pageY:t.pageY}))},mousedown:function(t){var n=e(this);o&&o.length&&!o.is(n)&&o.data("contextMenu").$menu.trigger("contextmenu:hide"),2===t.button&&(o=n.data("contextMenuActive",!0))},mouseup:function(t){var n=e(this);n.data("contextMenuActive")&&o&&o.length&&o.is(n)&&!n.hasClass("context-menu-disabled")&&(t.preventDefault(),t.stopImmediatePropagation(),o=n,n.trigger(e.Event("contextmenu",{data:t.data,pageX:t.pageX,pageY:t.pageY}))),n.removeData("contextMenuActive")},mouseenter:function(t){var n=e(this),a=e(t.relatedTarget),s=e(document);a.is(".context-menu-list")||a.closest(".context-menu-list").length||o&&o.length||(m.pageX=t.pageX,m.pageY=t.pageY,m.data=t.data,s.on("mousemove.contextMenuShow",f.mousemove),m.timer=setTimeout(function(){m.timer=null,s.off("mousemove.contextMenuShow"),o=n,n.trigger(e.Event("contextmenu",{data:m.data,pageX:m.pageX,pageY:m.pageY}))},t.data.delay))},mousemove:function(e){m.pageX=e.pageX,m.pageY=e.pageY},mouseleave:function(t){var n=e(t.relatedTarget);if(!n.is(".context-menu-list")&&!n.closest(".context-menu-list").length){try{clearTimeout(m.timer)}catch(t){}m.timer=null}},layerClick:function(t){var n,a,o=e(this),s=o.data("contextMenuRoot"),c=t.button,r=t.pageX,l=t.pageY;t.preventDefault(),t.stopImmediatePropagation(),setTimeout(function(){var o,u="left"===s.trigger&&0===c||"right"===s.trigger&&2===c;if(document.elementFromPoint&&s.$layer&&(s.$layer.hide(),n=document.elementFromPoint(r-i.scrollLeft(),l-i.scrollTop()),s.$layer.show()),s.reposition&&u)if(document.elementFromPoint){if(s.$trigger.is(n)||s.$trigger.has(n).length)return void s.position.call(s.$trigger,s,r,l)}else if(a=s.$trigger.offset(),o=e(window),a.top+=o.scrollTop(),a.top<=t.pageY&&(a.left+=o.scrollLeft(),a.left<=t.pageX&&(a.bottom=a.top+s.$trigger.outerHeight(),a.bottom>=t.pageY&&(a.right=a.left+s.$trigger.outerWidth(),a.right>=t.pageX))))return void s.position.call(s.$trigger,s,r,l);n&&u&&s.$trigger.one("contextmenu:hidden",function(){e(n).contextMenu({x:r,y:l,button:c})}),null!=s&&null!=s.$menu&&s.$menu.trigger("contextmenu:hide")},50)},keyStop:function(e,t){t.isInput||e.preventDefault(),e.stopPropagation()},key:function(e){var t={};o&&(t=o.data("contextMenu")||{}),void 0===t.zIndex&&(t.zIndex=0);var n=0,a=function(e){""!==e.style.zIndex?n=e.style.zIndex:null!==e.offsetParent&&void 0!==e.offsetParent?a(e.offsetParent):null!==e.parentElement&&void 0!==e.parentElement&&a(e.parentElement)};if(a(e.target),!(n>t.zIndex)){switch(e.keyCode){case 9:case 38:if(f.keyStop(e,t),t.isInput){if(9===e.keyCode&&e.shiftKey)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void t.$menu.trigger("prevcommand");if(38===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault()}else if(9!==e.keyCode||e.shiftKey)return void t.$menu.trigger("prevcommand");break;case 40:if(f.keyStop(e,t),!t.isInput)return void t.$menu.trigger("nextcommand");if(9===e.keyCode)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void t.$menu.trigger("nextcommand");if(40===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault();break;case 37:if(f.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;if(!t.$selected.parent().hasClass("context-menu-root")){var s=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=s)}break;case 39:if(f.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;var i=t.$selected.data("contextMenu")||{};if(i.$menu&&t.$selected.hasClass("context-menu-submenu"))return t.$selected=null,i.$selected=null,void i.$menu.trigger("nextcommand");break;case 35:case 36:return t.$selected&&t.$selected.find("input, textarea, select").length?void 0:((t.$selected&&t.$selected.parent()||t.$menu).children(":not(."+t.classNames.disabled+", ."+t.classNames.notSelectable+")")[36===e.keyCode?"first":"last"]().trigger("contextmenu:focus"),void e.preventDefault());case 13:if(f.keyStop(e,t),t.isInput){if(t.$selected&&!t.$selected.is("textarea, select"))return void e.preventDefault();break}return void("undefined"!=typeof t.$selected&&null!==t.$selected&&t.$selected.trigger("mouseup"));case 32:case 33:case 34:return void f.keyStop(e,t);case 27:return f.keyStop(e,t),void t.$menu.trigger("contextmenu:hide");default:var c=String.fromCharCode(e.keyCode).toUpperCase();if(t.accesskeys&&t.accesskeys[c])return void t.accesskeys[c].$node.trigger(t.accesskeys[c].$menu?"contextmenu:focus":"mouseup")}e.stopPropagation(),"undefined"!=typeof t.$selected&&null!==t.$selected&&t.$selected.trigger(e)}},prevItem:function(t){t.stopPropagation();var n=e(this).data("contextMenu")||{},a=e(this).data("contextMenuRoot")||{};if(n.$selected){var o=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=o}for(var s=n.$menu.children(),i=n.$selected&&n.$selected.prev().length?n.$selected.prev():s.last(),c=i;i.hasClass(a.classNames.disabled)||i.hasClass(a.classNames.notSelectable)||i.is(":hidden");)if(i=i.prev().length?i.prev():s.last(),i.is(c))return;n.$selected&&f.itemMouseleave.call(n.$selected.get(0),t),f.itemMouseenter.call(i.get(0),t);var r=i.find("input, textarea, select");r.length&&r.focus()},nextItem:function(t){t.stopPropagation();var n=e(this).data("contextMenu")||{},a=e(this).data("contextMenuRoot")||{};if(n.$selected){var o=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=o}for(var s=n.$menu.children(),i=n.$selected&&n.$selected.next().length?n.$selected.next():s.first(),c=i;i.hasClass(a.classNames.disabled)||i.hasClass(a.classNames.notSelectable)||i.is(":hidden");)if(i=i.next().length?i.next():s.first(),i.is(c))return;n.$selected&&f.itemMouseleave.call(n.$selected.get(0),t),f.itemMouseenter.call(i.get(0),t);var r=i.find("input, textarea, select");r.length&&r.focus()},focusInput:function(){var t=e(this).closest(".context-menu-item"),n=t.data(),a=n.contextMenu,o=n.contextMenuRoot;o.$selected=a.$selected=t,o.isInput=a.isInput=!0},blurInput:function(){var t=e(this).closest(".context-menu-item"),n=t.data(),a=n.contextMenu,o=n.contextMenuRoot;o.isInput=a.isInput=!1},menuMouseenter:function(){var t=e(this).data().contextMenuRoot;t.hovering=!0},menuMouseleave:function(t){var n=e(this).data().contextMenuRoot;n.$layer&&n.$layer.is(t.relatedTarget)&&(n.hovering=!1)},itemMouseenter:function(t){var n=e(this),a=n.data(),o=a.contextMenu,s=a.contextMenuRoot;return s.hovering=!0,t&&s.$layer&&s.$layer.is(t.relatedTarget)&&(t.preventDefault(),t.stopImmediatePropagation()),(o.$menu?o:s).$menu.children("."+s.classNames.hover).trigger("contextmenu:blur").children(".hover").trigger("contextmenu:blur"),n.hasClass(s.classNames.disabled)||n.hasClass(s.classNames.notSelectable)?void(o.$selected=null):void n.trigger("contextmenu:focus")},itemMouseleave:function(t){var n=e(this),a=n.data(),o=a.contextMenu,s=a.contextMenuRoot;return s!==o&&s.$layer&&s.$layer.is(t.relatedTarget)?("undefined"!=typeof s.$selected&&null!==s.$selected&&s.$selected.trigger("contextmenu:blur"),t.preventDefault(),t.stopImmediatePropagation(),void(s.$selected=o.$selected=o.$node)):void n.trigger("contextmenu:blur")},itemClick:function(t){var n,a=e(this),o=a.data(),s=o.contextMenu,i=o.contextMenuRoot,c=o.contextMenuKey;if(s.items[c]&&!a.is("."+i.classNames.disabled+", .context-menu-submenu, .context-menu-separator, ."+i.classNames.notSelectable)){if(t.preventDefault(),t.stopImmediatePropagation(),e.isFunction(s.callbacks[c])&&Object.prototype.hasOwnProperty.call(s.callbacks,c))n=s.callbacks[c];else{if(!e.isFunction(i.callback))return;n=i.callback}n.call(i.$trigger,c,i)!==!1?i.$menu.trigger("contextmenu:hide"):i.$menu.parent().length&&h.update.call(i.$trigger,i)}},inputClick:function(e){e.stopImmediatePropagation()},hideMenu:function(t,n){var a=e(this).data("contextMenuRoot");h.hide.call(a.$trigger,a,n&&n.force)},focusItem:function(t){t.stopPropagation();var n=e(this),a=n.data(),o=a.contextMenu,s=a.contextMenuRoot;n.hasClass(s.classNames.disabled)||n.hasClass(s.classNames.notSelectable)||(n.addClass([s.classNames.hover,s.classNames.visible].join(" ")).parent().find(".context-menu-item").not(n).removeClass(s.classNames.visible).filter("."+s.classNames.hover).trigger("contextmenu:blur"),o.$selected=s.$selected=n,o.$node&&s.positionSubmenu.call(o.$node,o.$menu))},blurItem:function(t){t.stopPropagation();var n=e(this),a=n.data(),o=a.contextMenu,s=a.contextMenuRoot;o.autoHide&&n.removeClass(s.classNames.visible),n.removeClass(s.classNames.hover),o.$selected=null}},h={show:function(t,n,a){var s=e(this),i={};if(e("#context-menu-layer").trigger("mousedown"),t.$trigger=s,t.events.show.call(s,t)===!1)return void(o=null);if(h.update.call(s,t),t.position.call(s,t,n,a),t.zIndex){var c=t.zIndex;"function"==typeof t.zIndex&&(c=t.zIndex.call(s,t)),i.zIndex=p(s)+c}h.layer.call(t.$menu,t,i.zIndex),t.$menu.find("ul").css("zIndex",i.zIndex+1),t.$menu.css(i)[t.animation.show](t.animation.duration,function(){s.trigger("contextmenu:visible")}),s.data("contextMenu",t).addClass("context-menu-active"),e(document).off("keydown.contextMenu").on("keydown.contextMenu",f.key),t.autoHide&&e(document).on("mousemove.contextMenuAutoHide",function(e){var n=s.offset();n.right=n.left+s.outerWidth(),n.bottom=n.top+s.outerHeight(),!t.$layer||t.hovering||e.pageX>=n.left&&e.pageX<=n.right&&e.pageY>=n.top&&e.pageY<=n.bottom||setTimeout(function(){t.hovering||null==t.$menu||t.$menu.trigger("contextmenu:hide")},50)})},hide:function(t,n){var a=e(this);if(t||(t=a.data("contextMenu")||{}),n||!t.events||t.events.hide.call(a,t)!==!1){if(a.removeData("contextMenu").removeClass("context-menu-active"),t.$layer){setTimeout(function(e){return function(){e.remove()}}(t.$layer),10);try{delete t.$layer}catch(s){t.$layer=null}}o=null,t.$menu.find("."+t.classNames.hover).trigger("contextmenu:blur"),t.$selected=null,t.$menu.find("."+t.classNames.visible).removeClass(t.classNames.visible),e(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),t.$menu&&t.$menu[t.animation.hide](t.animation.duration,function(){t.build&&(t.$menu.remove(),e.each(t,function(e){switch(e){case"ns":case"selector":case"build":case"trigger":return!0;default:t[e]=void 0;try{delete t[e]}catch(n){}return!0}})),setTimeout(function(){a.trigger("contextmenu:hidden")},10)})}},create:function(n,a){function o(t){var n=e("");if(t._accesskey)t._beforeAccesskey&&n.append(document.createTextNode(t._beforeAccesskey)),e("").addClass("context-menu-accesskey").text(t._accesskey).appendTo(n),t._afterAccesskey&&n.append(document.createTextNode(t._afterAccesskey));else if(t.isHtmlName){if("undefined"!=typeof t.accesskey)throw new Error("accesskeys are not compatible with HTML names and cannot be used together in the same item");n.html(t.name)}else n.text(t.name);return n}void 0===a&&(a=n),n.$menu=e('
      ').addClass(n.className||"").data({contextMenu:n,contextMenuRoot:a}),e.each(["callbacks","commands","inputs"],function(e,t){n[t]={},a[t]||(a[t]={})}),a.accesskeys||(a.accesskeys={}),e.each(n.items,function(s,i){var c=e('
    • ').addClass(i.className||""),r=null,l=null;if(c.on("click",e.noop),"string"!=typeof i&&"cm_separator"!==i.type||(i={type:"cm_seperator"}),i.$node=c.data({contextMenu:n,contextMenuRoot:a,contextMenuKey:s}),"undefined"!=typeof i.accesskey)for(var d,m=t(i.accesskey),p=0;d=m[p];p++)if(!a.accesskeys[d]){a.accesskeys[d]=i;var x=i.name.match(new RegExp("^(.*?)("+d+")(.*)$","i"));x&&(i._beforeAccesskey=x[1],i._accesskey=x[2],i._afterAccesskey=x[3]);break}if(i.type&&u[i.type])u[i.type].call(c,i,n,a),e.each([n,a],function(t,a){a.commands[s]=i,!e.isFunction(i.callback)||void 0!==a.callbacks[s]&&void 0!==n.type||(a.callbacks[s]=i.callback)});else{switch("cm_seperator"===i.type?c.addClass("context-menu-separator "+a.classNames.notSelectable):"html"===i.type?c.addClass("context-menu-html "+a.classNames.notSelectable):i.type?(r=e("").appendTo(c),o(i).appendTo(r),c.addClass("context-menu-input"),n.hasTypes=!0,e.each([n,a],function(e,t){t.commands[s]=i,t.inputs[s]=i})):i.items&&(i.type="sub"),i.type){case"cm_seperator":break;case"text":l=e('').attr("name","context-menu-input-"+s).val(i.value||"").appendTo(r);break;case"textarea":l=e('').attr("name","context-menu-input-"+s).val(i.value||"").appendTo(r),i.height&&l.height(i.height);break;case"checkbox":l=e('').attr("name","context-menu-input-"+s).val(i.value||"").prop("checked",!!i.selected).prependTo(r);break;case"radio":l=e('').attr("name","context-menu-input-"+i.radio).val(i.value||"").prop("checked",!!i.selected).prependTo(r);break;case"select":l=e('