├── .gitignore ├── .jshintignore ├── .jshintrc ├── LICENSE.md ├── README.md ├── build.json ├── compile ├── ATS.js ├── SID.js ├── STAR.js ├── approaches.js ├── index.js ├── navaids.js ├── runways.js ├── utils.js └── waypoints.js ├── gefs-build-config.toml ├── images ├── attitude-jet-ils.png ├── glideslope-indicator.png ├── ils-markers.png ├── localizer-indicator.png ├── waypoint-active.png ├── waypoint.ai └── waypoint.png ├── package.json ├── source ├── .jshintrc ├── config.js ├── data.js ├── debug.js ├── distance.js ├── flight.js ├── get.js ├── get │ ├── ATS.js │ ├── SID.js │ ├── STAR.js │ ├── runway.js │ └── waypoint.js ├── html │ ├── button.html │ ├── externaldist.html │ ├── modal.html │ └── tab-contents │ │ ├── dep-arr.html │ │ ├── ils.html │ │ ├── legs.html │ │ ├── load.html │ │ ├── log.html │ │ ├── main.js │ │ ├── map.html │ │ ├── progress.html │ │ ├── route.html │ │ └── vnav.html ├── init.js ├── log.js ├── minify.js ├── nav │ ├── ILS.js │ ├── LNAV.js │ ├── VNAV.js │ └── progress.js ├── path.js ├── redefine.js ├── style │ ├── button.css │ ├── dep-arr.css │ ├── externaldist.css │ ├── ils.css │ ├── legs.css │ ├── load.css │ ├── log.css │ ├── main.js │ ├── map.css │ ├── modal.css │ ├── progress.css │ ├── route.css │ ├── vnav.css │ └── waypoints.css ├── ui │ ├── ViewModel.js │ ├── elements.js │ ├── main.js │ └── position.js ├── userscript.js ├── utils.js ├── vnav-profile.js └── waypoints.js └── testing ├── index.js └── script.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | build 4 | compile/data 5 | compile/compiled-data 6 | testing/imagery.js 7 | package 8 | *.pem 9 | ._* 10 | .idea 11 | *.log 12 | package-lock.json 13 | -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | LICENSE 2 | .gitignore 3 | .jshintrc 4 | *.json 5 | *.md 6 | *.html 7 | *.css 8 | *.log 9 | node_modules/* 10 | build/* 11 | package/* 12 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { "globals": { "module": true } 2 | , "node": true 3 | , "predef": [ "-Promise" ] 4 | , "varstmt": true 5 | , "esnext": 6 6 | , "laxcomma": true 7 | , "laxbreak": true 8 | , "multistr": true 9 | , "eqeqeq": true 10 | , "smarttabs": true 11 | , "curly": false 12 | , "expr": true 13 | , "devel": true 14 | , "debug": true 15 | , "funcscope": false 16 | , "unused": true 17 | , "bitwise": true 18 | , "-W058": false 19 | , "-W002": false 20 | , "-W004": false 21 | } 22 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | ### GNU AFFERO GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 19 November 2007 4 | 5 | Copyright (C) 2007 Free Software Foundation, Inc. 6 | 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | ### Preamble 12 | 13 | The GNU Affero General Public License is a free, copyleft license for 14 | software and other kinds of works, specifically designed to ensure 15 | cooperation with the community in the case of network server software. 16 | 17 | The licenses for most software and other practical works are designed 18 | to take away your freedom to share and change the works. By contrast, 19 | our General Public Licenses are intended to guarantee your freedom to 20 | share and change all versions of a program--to make sure it remains 21 | free software for all its users. 22 | 23 | When we speak of free software, we are referring to freedom, not 24 | price. Our General Public Licenses are designed to make sure that you 25 | have the freedom to distribute copies of free software (and charge for 26 | them if you wish), that you receive source code or can get it if you 27 | want it, that you can change the software or use pieces of it in new 28 | free programs, and that you know you can do these things. 29 | 30 | Developers that use our General Public Licenses protect your rights 31 | with two steps: (1) assert copyright on the software, and (2) offer 32 | you this License which gives you legal permission to copy, distribute 33 | and/or modify the software. 34 | 35 | A secondary benefit of defending all users' freedom is that 36 | improvements made in alternate versions of the program, if they 37 | receive widespread use, become available for other developers to 38 | incorporate. Many developers of free software are heartened and 39 | encouraged by the resulting cooperation. However, in the case of 40 | software used on network servers, this result may fail to come about. 41 | The GNU General Public License permits making a modified version and 42 | letting the public access it on a server without ever releasing its 43 | source code to the public. 44 | 45 | The GNU Affero General Public License is designed specifically to 46 | ensure that, in such cases, the modified source code becomes available 47 | to the community. It requires the operator of a network server to 48 | provide the source code of the modified version running there to the 49 | users of that server. Therefore, public use of a modified version, on 50 | a publicly accessible server, gives the public access to the source 51 | code of the modified version. 52 | 53 | An older license, called the Affero General Public License and 54 | published by Affero, was designed to accomplish similar goals. This is 55 | a different license, not a version of the Affero GPL, but Affero has 56 | released a new version of the Affero GPL which permits relicensing 57 | under this license. 58 | 59 | The precise terms and conditions for copying, distribution and 60 | modification follow. 61 | 62 | ### TERMS AND CONDITIONS 63 | 64 | #### 0. Definitions. 65 | 66 | "This License" refers to version 3 of the GNU Affero General Public 67 | License. 68 | 69 | "Copyright" also means copyright-like laws that apply to other kinds 70 | of works, such as semiconductor masks. 71 | 72 | "The Program" refers to any copyrightable work licensed under this 73 | License. Each licensee is addressed as "you". "Licensees" and 74 | "recipients" may be individuals or organizations. 75 | 76 | To "modify" a work means to copy from or adapt all or part of the work 77 | in a fashion requiring copyright permission, other than the making of 78 | an exact copy. The resulting work is called a "modified version" of 79 | the earlier work or a work "based on" the earlier work. 80 | 81 | A "covered work" means either the unmodified Program or a work based 82 | on the Program. 83 | 84 | To "propagate" a work means to do anything with it that, without 85 | permission, would make you directly or secondarily liable for 86 | infringement under applicable copyright law, except executing it on a 87 | computer or modifying a private copy. Propagation includes copying, 88 | distribution (with or without modification), making available to the 89 | public, and in some countries other activities as well. 90 | 91 | To "convey" a work means any kind of propagation that enables other 92 | parties to make or receive copies. Mere interaction with a user 93 | through a computer network, with no transfer of a copy, is not 94 | conveying. 95 | 96 | An interactive user interface displays "Appropriate Legal Notices" to 97 | the extent that it includes a convenient and prominently visible 98 | feature that (1) displays an appropriate copyright notice, and (2) 99 | tells the user that there is no warranty for the work (except to the 100 | extent that warranties are provided), that licensees may convey the 101 | work under this License, and how to view a copy of this License. If 102 | the interface presents a list of user commands or options, such as a 103 | menu, a prominent item in the list meets this criterion. 104 | 105 | #### 1. Source Code. 106 | 107 | The "source code" for a work means the preferred form of the work for 108 | making modifications to it. "Object code" means any non-source form of 109 | a work. 110 | 111 | A "Standard Interface" means an interface that either is an official 112 | standard defined by a recognized standards body, or, in the case of 113 | interfaces specified for a particular programming language, one that 114 | is widely used among developers working in that language. 115 | 116 | The "System Libraries" of an executable work include anything, other 117 | than the work as a whole, that (a) is included in the normal form of 118 | packaging a Major Component, but which is not part of that Major 119 | Component, and (b) serves only to enable use of the work with that 120 | Major Component, or to implement a Standard Interface for which an 121 | implementation is available to the public in source code form. A 122 | "Major Component", in this context, means a major essential component 123 | (kernel, window system, and so on) of the specific operating system 124 | (if any) on which the executable work runs, or a compiler used to 125 | produce the work, or an object code interpreter used to run it. 126 | 127 | The "Corresponding Source" for a work in object code form means all 128 | the source code needed to generate, install, and (for an executable 129 | work) run the object code and to modify the work, including scripts to 130 | control those activities. However, it does not include the work's 131 | System Libraries, or general-purpose tools or generally available free 132 | programs which are used unmodified in performing those activities but 133 | which are not part of the work. For example, Corresponding Source 134 | includes interface definition files associated with source files for 135 | the work, and the source code for shared libraries and dynamically 136 | linked subprograms that the work is specifically designed to require, 137 | such as by intimate data communication or control flow between those 138 | subprograms and other parts of the work. 139 | 140 | The Corresponding Source need not include anything that users can 141 | regenerate automatically from other parts of the Corresponding Source. 142 | 143 | The Corresponding Source for a work in source code form is that same 144 | work. 145 | 146 | #### 2. Basic Permissions. 147 | 148 | All rights granted under this License are granted for the term of 149 | copyright on the Program, and are irrevocable provided the stated 150 | conditions are met. This License explicitly affirms your unlimited 151 | permission to run the unmodified Program. The output from running a 152 | covered work is covered by this License only if the output, given its 153 | content, constitutes a covered work. This License acknowledges your 154 | rights of fair use or other equivalent, as provided by copyright law. 155 | 156 | You may make, run and propagate covered works that you do not convey, 157 | without conditions so long as your license otherwise remains in force. 158 | You may convey covered works to others for the sole purpose of having 159 | them make modifications exclusively for you, or provide you with 160 | facilities for running those works, provided that you comply with the 161 | terms of this License in conveying all material for which you do not 162 | control copyright. Those thus making or running the covered works for 163 | you must do so exclusively on your behalf, under your direction and 164 | control, on terms that prohibit them from making any copies of your 165 | copyrighted material outside their relationship with you. 166 | 167 | Conveying under any other circumstances is permitted solely under the 168 | conditions stated below. Sublicensing is not allowed; section 10 makes 169 | it unnecessary. 170 | 171 | #### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 172 | 173 | No covered work shall be deemed part of an effective technological 174 | measure under any applicable law fulfilling obligations under article 175 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 176 | similar laws prohibiting or restricting circumvention of such 177 | measures. 178 | 179 | When you convey a covered work, you waive any legal power to forbid 180 | circumvention of technological measures to the extent such 181 | circumvention is effected by exercising rights under this License with 182 | respect to the covered work, and you disclaim any intention to limit 183 | operation or modification of the work as a means of enforcing, against 184 | the work's users, your or third parties' legal rights to forbid 185 | circumvention of technological measures. 186 | 187 | #### 4. Conveying Verbatim Copies. 188 | 189 | You may convey verbatim copies of the Program's source code as you 190 | receive it, in any medium, provided that you conspicuously and 191 | appropriately publish on each copy an appropriate copyright notice; 192 | keep intact all notices stating that this License and any 193 | non-permissive terms added in accord with section 7 apply to the code; 194 | keep intact all notices of the absence of any warranty; and give all 195 | recipients a copy of this License along with the Program. 196 | 197 | You may charge any price or no price for each copy that you convey, 198 | and you may offer support or warranty protection for a fee. 199 | 200 | #### 5. Conveying Modified Source Versions. 201 | 202 | You may convey a work based on the Program, or the modifications to 203 | produce it from the Program, in the form of source code under the 204 | terms of section 4, provided that you also meet all of these 205 | conditions: 206 | 207 | - a) The work must carry prominent notices stating that you modified 208 | it, and giving a relevant date. 209 | - b) The work must carry prominent notices stating that it is 210 | released under this License and any conditions added under 211 | section 7. This requirement modifies the requirement in section 4 212 | to "keep intact all notices". 213 | - c) You must license the entire work, as a whole, under this 214 | License to anyone who comes into possession of a copy. This 215 | License will therefore apply, along with any applicable section 7 216 | additional terms, to the whole of the work, and all its parts, 217 | regardless of how they are packaged. This License gives no 218 | permission to license the work in any other way, but it does not 219 | invalidate such permission if you have separately received it. 220 | - d) If the work has interactive user interfaces, each must display 221 | Appropriate Legal Notices; however, if the Program has interactive 222 | interfaces that do not display Appropriate Legal Notices, your 223 | work need not make them do so. 224 | 225 | A compilation of a covered work with other separate and independent 226 | works, which are not by their nature extensions of the covered work, 227 | and which are not combined with it such as to form a larger program, 228 | in or on a volume of a storage or distribution medium, is called an 229 | "aggregate" if the compilation and its resulting copyright are not 230 | used to limit the access or legal rights of the compilation's users 231 | beyond what the individual works permit. Inclusion of a covered work 232 | in an aggregate does not cause this License to apply to the other 233 | parts of the aggregate. 234 | 235 | #### 6. Conveying Non-Source Forms. 236 | 237 | You may convey a covered work in object code form under the terms of 238 | sections 4 and 5, provided that you also convey the machine-readable 239 | Corresponding Source under the terms of this License, in one of these 240 | ways: 241 | 242 | - a) Convey the object code in, or embodied in, a physical product 243 | (including a physical distribution medium), accompanied by the 244 | Corresponding Source fixed on a durable physical medium 245 | customarily used for software interchange. 246 | - b) Convey the object code in, or embodied in, a physical product 247 | (including a physical distribution medium), accompanied by a 248 | written offer, valid for at least three years and valid for as 249 | long as you offer spare parts or customer support for that product 250 | model, to give anyone who possesses the object code either (1) a 251 | copy of the Corresponding Source for all the software in the 252 | product that is covered by this License, on a durable physical 253 | medium customarily used for software interchange, for a price no 254 | more than your reasonable cost of physically performing this 255 | conveying of source, or (2) access to copy the Corresponding 256 | Source from a network server at no charge. 257 | - c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | - d) Convey the object code by offering access from a designated 263 | place (gratis or for a charge), and offer equivalent access to the 264 | Corresponding Source in the same way through the same place at no 265 | further charge. You need not require recipients to copy the 266 | Corresponding Source along with the object code. If the place to 267 | copy the object code is a network server, the Corresponding Source 268 | may be on a different server (operated by you or a third party) 269 | that supports equivalent copying facilities, provided you maintain 270 | clear directions next to the object code saying where to find the 271 | Corresponding Source. Regardless of what server hosts the 272 | Corresponding Source, you remain obligated to ensure that it is 273 | available for as long as needed to satisfy these requirements. 274 | - e) Convey the object code using peer-to-peer transmission, 275 | provided you inform other peers where the object code and 276 | Corresponding Source of the work are being offered to the general 277 | public at no charge under subsection 6d. 278 | 279 | A separable portion of the object code, whose source code is excluded 280 | from the Corresponding Source as a System Library, need not be 281 | included in conveying the object code work. 282 | 283 | A "User Product" is either (1) a "consumer product", which means any 284 | tangible personal property which is normally used for personal, 285 | family, or household purposes, or (2) anything designed or sold for 286 | incorporation into a dwelling. In determining whether a product is a 287 | consumer product, doubtful cases shall be resolved in favor of 288 | coverage. For a particular product received by a particular user, 289 | "normally used" refers to a typical or common use of that class of 290 | product, regardless of the status of the particular user or of the way 291 | in which the particular user actually uses, or expects or is expected 292 | to use, the product. A product is a consumer product regardless of 293 | whether the product has substantial commercial, industrial or 294 | non-consumer uses, unless such uses represent the only significant 295 | mode of use of the product. 296 | 297 | "Installation Information" for a User Product means any methods, 298 | procedures, authorization keys, or other information required to 299 | install and execute modified versions of a covered work in that User 300 | Product from a modified version of its Corresponding Source. The 301 | information must suffice to ensure that the continued functioning of 302 | the modified object code is in no case prevented or interfered with 303 | solely because modification has been made. 304 | 305 | If you convey an object code work under this section in, or with, or 306 | specifically for use in, a User Product, and the conveying occurs as 307 | part of a transaction in which the right of possession and use of the 308 | User Product is transferred to the recipient in perpetuity or for a 309 | fixed term (regardless of how the transaction is characterized), the 310 | Corresponding Source conveyed under this section must be accompanied 311 | by the Installation Information. But this requirement does not apply 312 | if neither you nor any third party retains the ability to install 313 | modified object code on the User Product (for example, the work has 314 | been installed in ROM). 315 | 316 | The requirement to provide Installation Information does not include a 317 | requirement to continue to provide support service, warranty, or 318 | updates for a work that has been modified or installed by the 319 | recipient, or for the User Product in which it has been modified or 320 | installed. Access to a network may be denied when the modification 321 | itself materially and adversely affects the operation of the network 322 | or violates the rules and protocols for communication across the 323 | network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | #### 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders 351 | of that material) supplement the terms of this License with terms: 352 | 353 | - a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | - b) Requiring preservation of specified reasonable legal notices or 356 | author attributions in that material or in the Appropriate Legal 357 | Notices displayed by works containing it; or 358 | - c) Prohibiting misrepresentation of the origin of that material, 359 | or requiring that modified versions of such material be marked in 360 | reasonable ways as different from the original version; or 361 | - d) Limiting the use for publicity purposes of names of licensors 362 | or authors of the material; or 363 | - e) Declining to grant rights under trademark law for use of some 364 | trade names, trademarks, or service marks; or 365 | - f) Requiring indemnification of licensors and authors of that 366 | material by anyone who conveys the material (or modified versions 367 | of it) with contractual assumptions of liability to the recipient, 368 | for any liability that these contractual assumptions directly 369 | impose on those licensors and authors. 370 | 371 | All other non-permissive additional terms are considered "further 372 | restrictions" within the meaning of section 10. If the Program as you 373 | received it, or any part of it, contains a notice stating that it is 374 | governed by this License along with a term that is a further 375 | restriction, you may remove that term. If a license document contains 376 | a further restriction but permits relicensing or conveying under this 377 | License, you may add to a covered work material governed by the terms 378 | of that license document, provided that the further restriction does 379 | not survive such relicensing or conveying. 380 | 381 | If you add terms to a covered work in accord with this section, you 382 | must place, in the relevant source files, a statement of the 383 | additional terms that apply to those files, or a notice indicating 384 | where to find the applicable terms. 385 | 386 | Additional terms, permissive or non-permissive, may be stated in the 387 | form of a separately written license, or stated as exceptions; the 388 | above requirements apply either way. 389 | 390 | #### 8. Termination. 391 | 392 | You may not propagate or modify a covered work except as expressly 393 | provided under this License. Any attempt otherwise to propagate or 394 | modify it is void, and will automatically terminate your rights under 395 | this License (including any patent licenses granted under the third 396 | paragraph of section 11). 397 | 398 | However, if you cease all violation of this License, then your license 399 | from a particular copyright holder is reinstated (a) provisionally, 400 | unless and until the copyright holder explicitly and finally 401 | terminates your license, and (b) permanently, if the copyright holder 402 | fails to notify you of the violation by some reasonable means prior to 403 | 60 days after the cessation. 404 | 405 | Moreover, your license from a particular copyright holder is 406 | reinstated permanently if the copyright holder notifies you of the 407 | violation by some reasonable means, this is the first time you have 408 | received notice of violation of this License (for any work) from that 409 | copyright holder, and you cure the violation prior to 30 days after 410 | your receipt of the notice. 411 | 412 | Termination of your rights under this section does not terminate the 413 | licenses of parties who have received copies or rights from you under 414 | this License. If your rights have been terminated and not permanently 415 | reinstated, you do not qualify to receive new licenses for the same 416 | material under section 10. 417 | 418 | #### 9. Acceptance Not Required for Having Copies. 419 | 420 | You are not required to accept this License in order to receive or run 421 | a copy of the Program. Ancillary propagation of a covered work 422 | occurring solely as a consequence of using peer-to-peer transmission 423 | to receive a copy likewise does not require acceptance. However, 424 | nothing other than this License grants you permission to propagate or 425 | modify any covered work. These actions infringe copyright if you do 426 | not accept this License. Therefore, by modifying or propagating a 427 | covered work, you indicate your acceptance of this License to do so. 428 | 429 | #### 10. Automatic Licensing of Downstream Recipients. 430 | 431 | Each time you convey a covered work, the recipient automatically 432 | receives a license from the original licensors, to run, modify and 433 | propagate that work, subject to this License. You are not responsible 434 | for enforcing compliance by third parties with this License. 435 | 436 | An "entity transaction" is a transaction transferring control of an 437 | organization, or substantially all assets of one, or subdividing an 438 | organization, or merging organizations. If propagation of a covered 439 | work results from an entity transaction, each party to that 440 | transaction who receives a copy of the work also receives whatever 441 | licenses to the work the party's predecessor in interest had or could 442 | give under the previous paragraph, plus a right to possession of the 443 | Corresponding Source of the work from the predecessor in interest, if 444 | the predecessor has it or can get it with reasonable efforts. 445 | 446 | You may not impose any further restrictions on the exercise of the 447 | rights granted or affirmed under this License. For example, you may 448 | not impose a license fee, royalty, or other charge for exercise of 449 | rights granted under this License, and you may not initiate litigation 450 | (including a cross-claim or counterclaim in a lawsuit) alleging that 451 | any patent claim is infringed by making, using, selling, offering for 452 | sale, or importing the Program or any portion of it. 453 | 454 | #### 11. Patents. 455 | 456 | A "contributor" is a copyright holder who authorizes use under this 457 | License of the Program or a work on which the Program is based. The 458 | work thus licensed is called the contributor's "contributor version". 459 | 460 | A contributor's "essential patent claims" are all patent claims owned 461 | or controlled by the contributor, whether already acquired or 462 | hereafter acquired, that would be infringed by some manner, permitted 463 | by this License, of making, using, or selling its contributor version, 464 | but do not include claims that would be infringed only as a 465 | consequence of further modification of the contributor version. For 466 | purposes of this definition, "control" includes the right to grant 467 | patent sublicenses in a manner consistent with the requirements of 468 | this License. 469 | 470 | Each contributor grants you a non-exclusive, worldwide, royalty-free 471 | patent license under the contributor's essential patent claims, to 472 | make, use, sell, offer for sale, import and otherwise run, modify and 473 | propagate the contents of its contributor version. 474 | 475 | In the following three paragraphs, a "patent license" is any express 476 | agreement or commitment, however denominated, not to enforce a patent 477 | (such as an express permission to practice a patent or covenant not to 478 | sue for patent infringement). To "grant" such a patent license to a 479 | party means to make such an agreement or commitment not to enforce a 480 | patent against the party. 481 | 482 | If you convey a covered work, knowingly relying on a patent license, 483 | and the Corresponding Source of the work is not available for anyone 484 | to copy, free of charge and under the terms of this License, through a 485 | publicly available network server or other readily accessible means, 486 | then you must either (1) cause the Corresponding Source to be so 487 | available, or (2) arrange to deprive yourself of the benefit of the 488 | patent license for this particular work, or (3) arrange, in a manner 489 | consistent with the requirements of this License, to extend the patent 490 | license to downstream recipients. "Knowingly relying" means you have 491 | actual knowledge that, but for the patent license, your conveying the 492 | covered work in a country, or your recipient's use of the covered work 493 | in a country, would infringe one or more identifiable patents in that 494 | country that you have reason to believe are valid. 495 | 496 | If, pursuant to or in connection with a single transaction or 497 | arrangement, you convey, or propagate by procuring conveyance of, a 498 | covered work, and grant a patent license to some of the parties 499 | receiving the covered work authorizing them to use, propagate, modify 500 | or convey a specific copy of the covered work, then the patent license 501 | you grant is automatically extended to all recipients of the covered 502 | work and works based on it. 503 | 504 | A patent license is "discriminatory" if it does not include within the 505 | scope of its coverage, prohibits the exercise of, or is conditioned on 506 | the non-exercise of one or more of the rights that are specifically 507 | granted under this License. You may not convey a covered work if you 508 | are a party to an arrangement with a third party that is in the 509 | business of distributing software, under which you make payment to the 510 | third party based on the extent of your activity of conveying the 511 | work, and under which the third party grants, to any of the parties 512 | who would receive the covered work from you, a discriminatory patent 513 | license (a) in connection with copies of the covered work conveyed by 514 | you (or copies made from those copies), or (b) primarily for and in 515 | connection with specific products or compilations that contain the 516 | covered work, unless you entered into that arrangement, or that patent 517 | license was granted, prior to 28 March 2007. 518 | 519 | Nothing in this License shall be construed as excluding or limiting 520 | any implied license or other defenses to infringement that may 521 | otherwise be available to you under applicable patent law. 522 | 523 | #### 12. No Surrender of Others' Freedom. 524 | 525 | If conditions are imposed on you (whether by court order, agreement or 526 | otherwise) that contradict the conditions of this License, they do not 527 | excuse you from the conditions of this License. If you cannot convey a 528 | covered work so as to satisfy simultaneously your obligations under 529 | this License and any other pertinent obligations, then as a 530 | consequence you may not convey it at all. For example, if you agree to 531 | terms that obligate you to collect a royalty for further conveying 532 | from those to whom you convey the Program, the only way you could 533 | satisfy both those terms and this License would be to refrain entirely 534 | from conveying the Program. 535 | 536 | #### 13. Remote Network Interaction; Use with the GNU General Public License. 537 | 538 | Notwithstanding any other provision of this License, if you modify the 539 | Program, your modified version must prominently offer all users 540 | interacting with it remotely through a computer network (if your 541 | version supports such interaction) an opportunity to receive the 542 | Corresponding Source of your version by providing access to the 543 | Corresponding Source from a network server at no charge, through some 544 | standard or customary means of facilitating copying of software. This 545 | Corresponding Source shall include the Corresponding Source for any 546 | work covered by version 3 of the GNU General Public License that is 547 | incorporated pursuant to the following paragraph. 548 | 549 | Notwithstanding any other provision of this License, you have 550 | permission to link or combine any covered work with a work licensed 551 | under version 3 of the GNU General Public License into a single 552 | combined work, and to convey the resulting work. The terms of this 553 | License will continue to apply to the part which is the covered work, 554 | but the work with which it is combined will remain governed by version 555 | 3 of the GNU General Public License. 556 | 557 | #### 14. Revised Versions of this License. 558 | 559 | The Free Software Foundation may publish revised and/or new versions 560 | of the GNU Affero General Public License from time to time. Such new 561 | versions will be similar in spirit to the present version, but may 562 | differ in detail to address new problems or concerns. 563 | 564 | Each version is given a distinguishing version number. If the Program 565 | specifies that a certain numbered version of the GNU Affero General 566 | Public License "or any later version" applies to it, you have the 567 | option of following the terms and conditions either of that numbered 568 | version or of any later version published by the Free Software 569 | Foundation. If the Program does not specify a version number of the 570 | GNU Affero General Public License, you may choose any version ever 571 | published by the Free Software Foundation. 572 | 573 | If the Program specifies that a proxy can decide which future versions 574 | of the GNU Affero General Public License can be used, that proxy's 575 | public statement of acceptance of a version permanently authorizes you 576 | to choose that version for the Program. 577 | 578 | Later license versions may give you additional or different 579 | permissions. However, no additional obligations are imposed on any 580 | author or copyright holder as a result of your choosing to follow a 581 | later version. 582 | 583 | #### 15. Disclaimer of Warranty. 584 | 585 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 586 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 587 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 588 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT 589 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 590 | A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND 591 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 592 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR 593 | CORRECTION. 594 | 595 | #### 16. Limitation of Liability. 596 | 597 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 598 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR 599 | CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 600 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES 601 | ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT 602 | NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR 603 | LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM 604 | TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER 605 | PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 606 | 607 | #### 17. Interpretation of Sections 15 and 16. 608 | 609 | If the disclaimer of warranty and limitation of liability provided 610 | above cannot be given local legal effect according to their terms, 611 | reviewing courts shall apply local law that most closely approximates 612 | an absolute waiver of all civil liability in connection with the 613 | Program, unless a warranty or assumption of liability accompanies a 614 | copy of the Program in return for a fee. 615 | 616 | END OF TERMS AND CONDITIONS 617 | 618 | ### How to Apply These Terms to Your New Programs 619 | 620 | If you develop a new program, and you want it to be of the greatest 621 | possible use to the public, the best way to achieve this is to make it 622 | free software which everyone can redistribute and change under these 623 | terms. 624 | 625 | To do so, attach the following notices to the program. It is safest to 626 | attach them to the start of each source file to most effectively state 627 | the exclusion of warranty; and each file should have at least the 628 | "copyright" line and a pointer to where the full notice is found. 629 | 630 | 631 | Copyright (C) 632 | 633 | This program is free software: you can redistribute it and/or modify 634 | it under the terms of the GNU Affero General Public License as 635 | published by the Free Software Foundation, either version 3 of the 636 | License, or (at your option) any later version. 637 | 638 | This program is distributed in the hope that it will be useful, 639 | but WITHOUT ANY WARRANTY; without even the implied warranty of 640 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 641 | GNU Affero General Public License for more details. 642 | 643 | You should have received a copy of the GNU Affero General Public License 644 | along with this program. If not, see . 645 | 646 | Also add information on how to contact you by electronic and paper 647 | mail. 648 | 649 | If your software can interact with users remotely through a computer 650 | network, you should also make sure that it provides a way for users to 651 | get its source. For example, if your program is a web application, its 652 | interface could display a "Source" link that leads users to an archive 653 | of the code. There are many ways you could offer source, and different 654 | solutions will be better for different programs; see section 13 for 655 | the specific requirements. 656 | 657 | You should also get your employer (if you work as a programmer) or 658 | school, if any, to sign a "copyright disclaimer" for the program, if 659 | necessary. For more information on this, and how to apply and follow 660 | the GNU AGPL, see . 661 | 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## fmc-requirejs 2 | This is the RequireJS implementation of the Flight Management Computer for GeoFS 3 | 4 | ---- 5 | #### Testing 6 | This feature allows you to run a server for GeoFS from your local files for plugin testing. 7 | 8 | Before running, you'll need to install [Node.js](http://nodejs.org). 9 | 10 | After installation, open a terminal/command prompt in this directory, then: 11 | ``` 12 | npm install 13 | npm start 14 | ``` 15 | Then you will be able to access the game at 16 | 17 | ---- 18 | #### Quick Optimization 19 | First, make sure that you have run `npm install`. 20 | 21 | If so, open a terminal/command prompt in this directory, then do 22 | ``` 23 | npm run build 24 | 25 | ``` 26 | Then you will be able to see the optimized file in *build* as **fmc.min.js** 27 | 28 | ---- 29 | #### License 30 | ``` 31 | Copyright (C) 2016-2018 Harry Xue, (C) 2016-2017 Ethan Shields 32 | 33 | This program is free software: you can redistribute it and/or modify 34 | it under the terms of the GNU Affero General Public License as published 35 | by the Free Software Foundation, either version 3 of the License, or 36 | (at your option) any later version. 37 | 38 | This program is distributed in the hope that it will be useful, 39 | but WITHOUT ANY WARRANTY; without even the implied warranty of 40 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 41 | GNU Affero General Public License for more details. 42 | 43 | You should have received a copy of the GNU Affero General Public License 44 | along with this program. If not, see . 45 | ``` 46 | -------------------------------------------------------------------------------- /build.json: -------------------------------------------------------------------------------- 1 | { "baseUrl": "./source" 2 | , "name": "../node_modules/requirejs/require" 3 | , "include": "init" 4 | , "mainConfigFile": "./source/config.js" 5 | , "out": "./build/fmc.min.js" 6 | , "optimize": "uglify2" 7 | } 8 | -------------------------------------------------------------------------------- /compile/ATS.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | const FILE_NAME = path.join(__dirname, `${require('./utils').ROOT_FOLDER}ATS.txt`); 9 | 10 | let ATS = {}; 11 | 12 | module.exports = new Promise(resolve => { 13 | fs.readFileAsync(FILE_NAME, 'utf-8').then(parseFile).then(writeFile).then(resolve); 14 | }); 15 | 16 | 17 | 18 | // -- 19 | function parseFile (fileContent) { 20 | console.log('Parsing airways data'); 21 | 22 | fileContent = fileContent.split('\r\n\r\n'); 23 | 24 | for (let blocks = 0; blocks < fileContent.length - 1; blocks++) { 25 | let fixesList = []; 26 | fileContent[blocks] = fileContent[blocks].split('\r\n'); 27 | 28 | for (let lines = 0; lines < fileContent[blocks].length; lines++) { 29 | fileContent[blocks][lines] = fileContent[blocks][lines].split(','); 30 | 31 | // Ignores the first line (descriptor) when adding fixes 32 | if (lines > 0) fixesList.push(fileContent[blocks][lines][1].trim()); 33 | 34 | // Adds the ending fix 35 | if (lines === fileContent[blocks].length - 1) 36 | fixesList.push(fileContent[blocks][lines][4].trim()); 37 | } 38 | 39 | // If this airway already exists, push duplicate fixes 40 | if (Array.isArray(ATS[fileContent[blocks][0][1]])) 41 | ATS[fileContent[blocks][0][1]].push(fixesList); 42 | else ATS[fileContent[blocks][0][1]] = [fixesList]; 43 | } 44 | } 45 | 46 | function writeFile () { 47 | fs.writeFileSync('compiled-data/ATS.json', JSON.stringify(ATS)); 48 | } 49 | -------------------------------------------------------------------------------- /compile/SID.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | require('graceful-fs').gracefulify(fs); 9 | 10 | const PATH = path.join(__dirname, `${require('./utils').ROOT_FOLDER}proc/`); 11 | const RWY_REGEXP = /^\d\d[LCR]?$/; 12 | 13 | const waypoints = require('./compiled-data/waypoints.json'); 14 | const navaids = require('./compiled-data/navaids.json'); 15 | const fileList = require('./utils').readDir(PATH); 16 | 17 | let promises = [], SID = {}; 18 | 19 | fileList.forEach(file => { 20 | promises.push(new Promise(resolve => { 21 | const airportName = file.substring(0, file.indexOf('.txt')); 22 | 23 | fs.readFileAsync(PATH + file, 'utf-8') 24 | .then(data => parseFile(data, airportName)) 25 | .then(resolve); 26 | })); 27 | }); 28 | 29 | console.log('Parsing SID data'); 30 | Promise.all(promises).then(writeFile); 31 | 32 | // Callback functions 33 | function parseFile (fileContent, airportName) { 34 | // Splits each block (may contain SID, STAR, Final...) 35 | let temp = fileContent.split('\r\n\r\n'); 36 | temp.shift(); 37 | fileContent = []; // Empties fileContent for SID filters 38 | 39 | // Filters SID blocks and pushes to fileContent 40 | temp.forEach(block => { 41 | if (block.indexOf('SID') === 0) fileContent.push(block); 42 | }); 43 | 44 | if (fileContent.length === 0) return; 45 | 46 | SID[airportName] = []; 47 | 48 | for (let blocks = 0; blocks < fileContent.length; blocks++) { 49 | // Splits each SID block by line (SID line) 50 | fileContent[blocks] = fileContent[blocks].split('\r\n'); 51 | 52 | let obj = { 53 | name: undefined, 54 | runway: undefined, 55 | waypoints: [] 56 | }; 57 | 58 | for (let lines = 0; lines < fileContent[blocks].length; lines++) { 59 | // Splits each SID line by element 60 | fileContent[blocks][lines] = fileContent[blocks][lines].split(','); 61 | 62 | const potentialWaypoint = fileContent[blocks][lines][1]; 63 | if (lines > 0 && (waypoints[potentialWaypoint] || navaids[potentialWaypoint])) { 64 | obj.waypoints.push(fileContent[blocks][lines][1].trim()); 65 | } 66 | } 67 | 68 | const descriptor = fileContent[blocks][0]; 69 | const name = String(descriptor[1]).trim(); 70 | const runway = String(descriptor[2]).trim(); 71 | 72 | if (name) obj.name = name; 73 | if (RWY_REGEXP.test(runway)) obj.runway = runway; 74 | 75 | SID[airportName].push(obj); 76 | } 77 | 78 | } 79 | 80 | function writeFile () { 81 | fs.writeFileSync('compiled-data/SID.json', JSON.stringify(SID)); 82 | } 83 | -------------------------------------------------------------------------------- /compile/STAR.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | require('graceful-fs').gracefulify(fs); 9 | 10 | const PATH = path.join(__dirname, `${require('./utils').ROOT_FOLDER}proc/`); 11 | const RWY_REGEXP = /^\d\d[LCR]?$/; 12 | 13 | const waypoints = require('./compiled-data/waypoints.json'); 14 | const navaids = require('./compiled-data/navaids.json'); 15 | const fileList = require('./utils').readDir(PATH); 16 | 17 | let promises = [], STAR = {}; 18 | 19 | fileList.forEach(file => { 20 | promises.push(new Promise(resolve => { 21 | const airportName = file.substring(0, file.indexOf('.txt')); 22 | 23 | fs.readFileAsync(PATH + file, 'utf-8') 24 | .then(data => parseFile(data, airportName)) 25 | .then(resolve); 26 | })); 27 | }); 28 | 29 | console.log('Parsing STAR data'); 30 | Promise.all(promises).then(writeFile); 31 | 32 | // Callback functions 33 | function parseFile (fileContent, airportName) { 34 | // Splits each block (may contain SID, STAR, Final...) 35 | let temp = fileContent.split('\r\n\r\n'); 36 | temp.shift(); 37 | fileContent = []; // Empties fileContent for STAR filters 38 | 39 | // Filters STAR blocks and pushes to fileContent 40 | temp.forEach(block => { 41 | if (block.indexOf('STAR') === 0) fileContent.push(block); 42 | }); 43 | 44 | if (fileContent.length === 0) return; 45 | 46 | STAR[airportName] = []; 47 | 48 | for (let blocks = 0; blocks < fileContent.length; blocks++) { 49 | // Splits each STAR block by line (STAR line) 50 | fileContent[blocks] = fileContent[blocks].split('\r\n'); 51 | 52 | let obj = { 53 | name: undefined, 54 | runway: undefined, 55 | transition: undefined, 56 | connecting: undefined, 57 | waypoints: [] 58 | }; 59 | 60 | for (let lines = 0; lines < fileContent[blocks].length; lines++) { 61 | // Splits each STAR line by element 62 | fileContent[blocks][lines] = fileContent[blocks][lines].split(','); 63 | 64 | const potentialWaypoint = fileContent[blocks][lines][1]; 65 | if (lines > 0 && (waypoints[potentialWaypoint] || navaids[potentialWaypoint])) { 66 | obj.waypoints.push(fileContent[blocks][lines][1].trim()); 67 | } 68 | } 69 | 70 | const descriptor = fileContent[blocks][0]; 71 | const name = String(descriptor[1]).trim(); 72 | const runway = String(descriptor[2]).trim(); 73 | 74 | if (name) obj.name = name; 75 | if (RWY_REGEXP.test(runway)) obj.runway = runway; 76 | else if (runway === 'ALL') obj.connecting = true; 77 | else if (waypoints[runway] || navaids[runway]) obj.transition = runway; 78 | 79 | STAR[airportName].push(obj); 80 | } 81 | 82 | } 83 | 84 | function writeFile () { 85 | fs.writeFileSync('compiled-data/STAR.json', JSON.stringify(STAR)); 86 | } 87 | -------------------------------------------------------------------------------- /compile/approaches.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | require('graceful-fs').gracefulify(fs); 9 | 10 | const PATH = path.join(__dirname, require('./utils').ROOT_FOLDER + 'proc/'); 11 | const RWY_REGEXP = /^\d\d[LCR]?$/; 12 | 13 | const waypoints = require('./compiled-data/waypoints.json'); 14 | const navaids = require('./compiled-data/navaids.json'); 15 | const fileList = require('./utils').readDir(PATH); 16 | 17 | let promises = [], approaches = {}; 18 | 19 | fileList.forEach(file => { 20 | promises.push(new Promise(resolve => { 21 | const airportName = file.substring(0, file.indexOf('.txt')); 22 | 23 | fs.readFileAsync(PATH + file, 'utf-8') 24 | .then(data => parseFile(data, airportName)) 25 | .then(resolve); 26 | })); 27 | }); 28 | 29 | module.exports = new Promise(resolve => { 30 | console.log('Parsing approach data'); 31 | Promise.all(promises).then(writeFile); 32 | }); 33 | 34 | // Normalize an approach name 35 | function toNormalized (name) { 36 | const convertMap = { 37 | I: 'ILS', 38 | R: 'RNAV', 39 | D: 'VOR' 40 | }; // FIXME there are also 'S' and 'N', probably more... 41 | 42 | let normalized = convertMap[name.substring(0, 1)] || name.substring(0, 1); 43 | return normalized + name.substring(1, name.length); 44 | } 45 | 46 | // Callback functions 47 | function parseFile (fileContent, airportName) { // FIXME Various airports outside US 48 | // Splits each block (may contain SID, STAR, Final...) 49 | let temp = fileContent.split('\r\n\r\n'); 50 | temp.shift(); 51 | fileContent = []; // Empties fileContent for approach filters 52 | 53 | // Indeces of FINALs with at least one preceeding APPTR 54 | let finalWithAPPTR = {}; 55 | 56 | // Filters and combines APPTR and FINAL blocks and pushes to fileContent 57 | for (let i = 0; i < temp.length; i++) { 58 | if (temp[i].indexOf('APPTR') === 0) { 59 | let apptrBlock = temp[i]; 60 | 61 | // Loops to find FINAL that pairs with current APPTR 62 | // FIXME logic check: does FINAL follow APPTR? 63 | let offset; 64 | for (offset = i + 1; offset < temp.length; offset++) 65 | if (temp[offset].indexOf('FINAL') === 0) break; 66 | 67 | let finalBlock = temp[offset]; 68 | 69 | finalWithAPPTR[offset] = true; 70 | 71 | // FINAL should be combined with APPTR, but without the 72 | // first line (descriptor) and second line (transition waypoint) 73 | finalBlock = finalBlock.split('\r\n'); // Splits into lines 74 | finalBlock.splice(0, 2); // Removes first two lines 75 | 76 | // Joins the two blocks with a new line 77 | const processedBlock = [apptrBlock, finalBlock.join('\r\n')].join('\r\n'); 78 | 79 | // Gives fileContent the processed block 80 | fileContent.push(processedBlock); 81 | } else if (temp[i].indexOf('FINAL') === 0) { 82 | if (!finalWithAPPTR[i]) fileContent.push(temp[i]); 83 | } 84 | } 85 | 86 | if (fileContent.length === 0) return; 87 | 88 | approaches[airportName] = []; 89 | 90 | for (let blocks = 0; blocks < fileContent.length; blocks++) { 91 | // Splits each approach block by line 92 | fileContent[blocks] = fileContent[blocks].split('\r\n'); 93 | 94 | let obj = { 95 | name: undefined, 96 | runway: undefined, 97 | transition: undefined, 98 | waypoints: [] 99 | }; 100 | 101 | let isEndOfApproach = false; 102 | 103 | for (let lines = 0; lines < fileContent[blocks].length; lines++) { 104 | // Splits each approach line by element 105 | fileContent[blocks][lines] = fileContent[blocks][lines].split(','); 106 | const potentialWaypoint = fileContent[blocks][lines][1]; 107 | 108 | if (lines > 0) { 109 | // If end of approach (ignore failed approach waypoints) 110 | if (!isNaN(+potentialWaypoint)) { 111 | isEndOfApproach = true; 112 | break; 113 | } 114 | 115 | // If end is a runway 116 | if (potentialWaypoint.indexOf('RW') === 0) { 117 | isEndOfApproach = true; 118 | obj.waypoints.push(fileContent[blocks][lines][1].trim()); 119 | break; 120 | } 121 | 122 | // If other situations (middle of approach) 123 | if (waypoints[potentialWaypoint] || navaids[potentialWaypoint]) 124 | obj.waypoints.push(fileContent[blocks][lines][1].trim()); 125 | 126 | } 127 | if (isEndOfApproach) break; 128 | } 129 | 130 | const descriptor = fileContent[blocks][0]; 131 | const name = toNormalized(descriptor[1]).trim(); 132 | const runway = String(descriptor[2]).trim(); 133 | const transition = String(descriptor[3]).trim(); 134 | 135 | if (name) obj.name = name; 136 | if (runway) obj.runway = runway; 137 | if (descriptor[0] === 'APPTR' && transition) obj.transition = transition; 138 | 139 | approaches[airportName].push(obj); 140 | } 141 | 142 | } 143 | 144 | function writeFile () { 145 | fs.writeFileSync('compiled-data/approaches.json', JSON.stringify(approaches)); 146 | } 147 | -------------------------------------------------------------------------------- /compile/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | const waypoints = require('./waypoints'); 9 | const navaids = require('./navaids'); 10 | const airways = require('./ATS'); 11 | const runways = require('./runways'); 12 | 13 | fs.existsAsync(path.join(__dirname, 'compiled-data')).then(exists => { 14 | if (!exists) fs.mkdir('compiled-data'); 15 | 16 | Promise.all([ waypoints, navaids, airways, runways ]) 17 | .then(() => console.log('\nDone!')); 18 | }).catch(console.error); 19 | -------------------------------------------------------------------------------- /compile/navaids.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = require('fs'); 6 | const csv = require('csv-parser'); 7 | const path = require('path'); 8 | 9 | const PATH = `${require('./utils').ROOT_FOLDER}Navaids.csv`; 10 | const FILE_NAME = path.join(__dirname, PATH); 11 | 12 | module.exports = new Promise(resolve => { 13 | console.log('Parsing navaids data'); 14 | 15 | let navaids = {}; 16 | fs.createReadStream(FILE_NAME) 17 | .pipe(csv()) 18 | .on('data', vor => { 19 | let arr = [ +vor.lat, +vor.lon, vor.name ]; 20 | 21 | if (navaids[vor.navaid] && Array.isArray(navaids[vor.navaid])) 22 | navaids[vor.navaid].push(arr); 23 | else navaids[vor.navaid] = [ arr ]; 24 | }).on('end', () => { 25 | const stringified = JSON.stringify(navaids); 26 | 27 | fs.writeFileSync('compiled-data/navaids.json', stringified); 28 | resolve(); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /compile/runways.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = Promise.promisifyAll(require('fs')); 6 | const path = require('path'); 7 | 8 | const FILE_NAME = path.join(__dirname, `${require('./utils').ROOT_FOLDER}Runways.txt`); 9 | 10 | let runways = {}; 11 | 12 | module.exports = new Promise(resolve => { 13 | fs.readFileAsync(FILE_NAME, 'utf-8').then(parseFile).then(writeFile).then(resolve); 14 | }); 15 | 16 | 17 | // -- 18 | function parseFile (fileContent) { 19 | console.log('Parsing runways data'); 20 | 21 | fileContent = fileContent.split('\r\n\r\n'); 22 | 23 | for (let blocks = 0; blocks < fileContent.length - 1; blocks++) { 24 | let obj = {}; 25 | 26 | fileContent[blocks] = fileContent[blocks].split('\r\n'); 27 | 28 | for (let lines = 0; lines < fileContent[blocks].length; lines++) { 29 | fileContent[blocks][lines] = fileContent[blocks][lines].split(','); 30 | 31 | // Ignore the first line (descriptor) 32 | if (lines > 0) obj[String(fileContent[blocks][lines][1]).trim()] = [ 33 | +fileContent[blocks][lines][8], // lon 34 | +fileContent[blocks][lines][9], // lat 35 | +fileContent[blocks][lines][10], // fieldElev 36 | +fileContent[blocks][lines][11], // glideslope 37 | +fileContent[blocks][lines][3], // length 38 | +fileContent[blocks][lines][4] // width 39 | ]; 40 | } 41 | 42 | runways[fileContent[blocks][0][1]] = obj; 43 | } 44 | } 45 | 46 | function writeFile () { 47 | fs.writeFileSync('compiled-data/runways.json', JSON.stringify(runways)); 48 | } 49 | -------------------------------------------------------------------------------- /compile/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | ROOT_FOLDER: 'data/', 5 | readDir: dir => { 6 | let list = []; 7 | require('fs').readdirSync(dir).forEach(function (file) { 8 | if (/\.txt/.test(file)) list.push(file); 9 | }); 10 | 11 | return list; 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /compile/waypoints.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Promise = require('bluebird'); 4 | 5 | const fs = require('fs'); 6 | const csv = require('csv-parser'); 7 | const path = require('path'); 8 | 9 | const PATH = `${require('./utils').ROOT_FOLDER}Waypoints.csv`; 10 | const FILE_NAME = path.join(__dirname, PATH); 11 | 12 | module.exports = new Promise(resolve => { 13 | console.log('Parsing waypoints data'); 14 | 15 | let waypoints = {}; 16 | fs.createReadStream(FILE_NAME) 17 | .pipe(csv()) 18 | .on('data', fix => { 19 | // If the waypoint has a duplicate name, only push coords 20 | if (waypoints[fix.waypoint] && Array.isArray(waypoints[fix.waypoint])) 21 | waypoints[fix.waypoint].push([ +fix.lat, +fix.lon ]); 22 | 23 | // Else, create waypoint and coords 24 | else waypoints[fix.waypoint] = [[ +fix.lat, +fix.lon ]]; 25 | }).on('end', () => { 26 | const stringified = JSON.stringify(waypoints); 27 | 28 | fs.writeFileSync('compiled-data/waypoints.json', stringified); 29 | resolve(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /gefs-build-config.toml: -------------------------------------------------------------------------------- 1 | globalVariableName = "fmc" 2 | shortName = "fmc" 3 | crxName = "fmc_requirejs" 4 | 5 | [requirejs] 6 | mainConfigFile = "./build.json" 7 | -------------------------------------------------------------------------------- /images/attitude-jet-ils.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/attitude-jet-ils.png -------------------------------------------------------------------------------- /images/glideslope-indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/glideslope-indicator.png -------------------------------------------------------------------------------- /images/ils-markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/ils-markers.png -------------------------------------------------------------------------------- /images/localizer-indicator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/localizer-indicator.png -------------------------------------------------------------------------------- /images/waypoint-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/waypoint-active.png -------------------------------------------------------------------------------- /images/waypoint.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/waypoint.ai -------------------------------------------------------------------------------- /images/waypoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/images/waypoint.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fmc-requirejs", 3 | "version": "0.0.1", 4 | "description": "Proxy server to test FMC RequireJS port", 5 | "main": "index.js", 6 | "dependencies": { 7 | "geodesic": "henrythasler/Leaflet.Geodesic", 8 | "knockout": "^3.4.2", 9 | "requirejs": "latest", 10 | "text": "requirejs/text" 11 | }, 12 | "devDependencies": { 13 | "robohydra": "^0.6.4", 14 | "csv-parser": "^1.11.0", 15 | "bluebird": "^3.5.0", 16 | "graceful-fs": "latest" 17 | }, 18 | "scripts": { 19 | "start": "robohydra -I ./ -n -P testing -q", 20 | "build": "r.js -o build.json optimize=none", 21 | "build-production": "r.js -o build.json" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+https://github.com/gefs-plugins/fmc-requirejs.git" 26 | }, 27 | "author": "Harry Xue", 28 | "license": "AGPL-3.0+", 29 | "bugs": { 30 | "url": "https://github.com/gefs-plugins/fmc-requirejs/issues" 31 | }, 32 | "homepage": "https://github.com/gefs-plugins/fmc-requirejs#readme", 33 | "private": true 34 | } 35 | -------------------------------------------------------------------------------- /source/.jshintrc: -------------------------------------------------------------------------------- 1 | { "globals": 2 | { "geofs": true 3 | , "controls": true 4 | , "METERS_TO_FEET": true 5 | , "PAGE_PATH": true 6 | , "autopilot_pp": true 7 | , "componentHandler": true 8 | , "L": true 9 | , "ui": true 10 | , "define": true 11 | , "require": true 12 | , "requirejs": true 13 | , "Promise": true 14 | } 15 | , "laxcomma": true 16 | , "laxbreak": true 17 | , "multistr": true 18 | , "eqeqeq": true 19 | , "smarttabs": true 20 | , "globalstrict": true 21 | , "jquery": true 22 | , "curly": false 23 | , "browser": true 24 | , "expr": true 25 | , "devel": true 26 | , "debug": true 27 | , "funcscope": false 28 | , "unused": true 29 | , "bitwise": true 30 | , "-W004": false 31 | } 32 | -------------------------------------------------------------------------------- /source/config.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | "use strict"; 3 | 4 | requirejs.config({ 5 | urlArgs: '_=' + Date.now(), // Cache bust 6 | paths: { 7 | geodesic: '../node_modules/Leaflet.Geodesic/Leaflet.Geodesic', 8 | knockout: '../node_modules/knockout/build/output/knockout-latest', 9 | text: '../node_modules/text/text' 10 | } 11 | }); 12 | })(); 13 | -------------------------------------------------------------------------------- /source/data.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['exports'], function (exports) { 4 | 5 | var FILE_PATH = PAGE_PATH + 'fmc/compile/compiled-data/'; 6 | 7 | exports.waypoints = []; 8 | exports.navaids = []; 9 | exports.SID = []; 10 | exports.STAR = []; 11 | exports.ATS = []; 12 | exports.runways = []; 13 | 14 | $.get(FILE_PATH + 'waypoints.json', function (waypoints) { 15 | exports.waypoints = waypoints; 16 | }); 17 | 18 | $.get(FILE_PATH + 'navaids.json', function (navaids) { 19 | exports.navaids = navaids; 20 | }); 21 | 22 | $.get(FILE_PATH + 'SID.json', function (SID) { 23 | exports.SID = SID; 24 | }); 25 | 26 | $.get(FILE_PATH + 'STAR.json', function (STAR) { 27 | exports.STAR = STAR; 28 | }); 29 | 30 | $.get(FILE_PATH + 'ATS.json', function (ATS) { 31 | exports.ATS = ATS; 32 | }); 33 | 34 | $.get(FILE_PATH + 'runways.json', function (runways) { 35 | exports.runways = runways; 36 | }); 37 | 38 | }); 39 | -------------------------------------------------------------------------------- /source/debug.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['ui/elements'], function (E) { 4 | 5 | // If FMC is production 6 | var PRODUCTION = false; 7 | 8 | // Stops event propagation 9 | function stopPropagation (event) { 10 | event.stopImmediatePropagation(); 11 | } 12 | 13 | return { 14 | /** 15 | * Stops input key propagation 16 | */ 17 | stopPropagation: function () { 18 | $(E.modal) 19 | .keyup(stopPropagation) 20 | .keydown(stopPropagation) 21 | .keypress(stopPropagation); 22 | }, 23 | 24 | /** 25 | * Logs debug statement into console when needed if not PRODUCTION 26 | */ 27 | log: function (text) { 28 | if (!PRODUCTION) console.log(text); 29 | } 30 | }; 31 | }); 32 | -------------------------------------------------------------------------------- /source/distance.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['flight', 'utils', 'waypoints', 'exports'], function (flight, utils, waypoints, exports) { 4 | 5 | /** 6 | * Computes the full route distance with waypoints 7 | * Between start index (inclusive) and end index (exclusive) 8 | * 9 | * @param {Number} end The index of the end of the route to be calculated 10 | * @returns {Number} The route distance 11 | */ 12 | exports.route = function (end) { 13 | 14 | var departure = flight.departure.coords(); 15 | var arrival = flight.arrival.coords(); 16 | var start = waypoints.nextWaypoint() || 0; 17 | var route = waypoints.route(); 18 | var pos = geofs.aircraft.instance.llaLocation; 19 | 20 | // If there is no route 21 | if (route.length === 0) { 22 | // If departure and arrival airports are present 23 | if (flight.departure.airport() && flight.arrival.airport()) 24 | return utils.getDistance(departure[0], departure[1], arrival[0], arrival[1]); 25 | else return 0; 26 | } 27 | 28 | // If there is not an activated waypoint 29 | if (waypoints.nextWaypoint() === null) { 30 | // If arrival airport is present and current coords are defined 31 | if (flight.arrival.airport() && pos[0]) 32 | return utils.getDistance(pos[0], pos[1], arrival[0], arrival[1]); 33 | 34 | // If there are only current coords 35 | if (pos[0]) 36 | return utils.getDistance(pos[0], pos[1], route[route.length - 1].lat(), route[route.length - 1].lon()); 37 | 38 | // If neither is present 39 | return utils.getDistance(route[0].lat(), route[0].lon(), route[route.length - 1].lat(), route[route.length - 1].lon()); 40 | } 41 | 42 | // If there is a waypoint activated 43 | else { 44 | var total = 0; 45 | 46 | // Loops from start to end to get total distance 47 | for (var i = start; i < end && i < route.length; i++) { 48 | total += route[i].distFromPrev(); 49 | } 50 | 51 | // If waypoint is the last one in the list, compute distance to arrival airport also 52 | if (end === route.length) { 53 | if (flight.arrival.airport()) 54 | total += utils.getDistance(route[end - 1].lat(), route[end - 1].lon(), arrival[0], arrival[1]); 55 | } 56 | 57 | return total; 58 | } 59 | }; 60 | 61 | /** 62 | * Computes the distance needed to climb or descend to a certain altitude from current altitude 63 | * 64 | * @param {Number} deltaAlt The altitude difference 65 | * @returns {Number} The distance 66 | */ 67 | exports.target = function (deltaAlt) { 68 | var targetDist; 69 | if (deltaAlt < 0) { 70 | targetDist = deltaAlt / -1000 * 3.4; 71 | } else { 72 | targetDist = deltaAlt / 1000 * 2.5; 73 | } 74 | return targetDist; 75 | }; 76 | 77 | /** 78 | * Computes the turning distance to next waypoint for an aircraft to be on course 79 | * 80 | * @param {Number} angle Angle of turning 81 | * @returns {Number} The turning distance 82 | */ 83 | exports.turn = function (angle) { 84 | var v = geofs.aircraft.instance.animationValue.kcas; 85 | var r = 0.107917 * Math.pow(Math.E, 0.0128693 * v); 86 | var a = utils.toRadians(angle); 87 | return r * Math.tan(a / 2) + 0.20; 88 | }; 89 | }); 90 | -------------------------------------------------------------------------------- /source/flight.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'knockout', 'get', 'nav/LNAV', 'nav/VNAV', 'exports' 5 | ], function (ko, get, lnav, vnav, exports) { 6 | 7 | // Autopilot++ Dependencies 8 | var icao = autopilot_pp.require('json!data/icaoairports.json'); 9 | 10 | // Top Of Descent distance 11 | var todDist = ko.observable(); 12 | 13 | // If VNAV is enabled 14 | var _vnavEnabled = ko.observable(false); 15 | var vnavEnabled = ko.pureComputed({ 16 | read: _vnavEnabled, 17 | write: function (boolean) { 18 | var set = _vnavEnabled; 19 | 20 | if (!cruiseAlt()) set(false); 21 | 22 | else if (boolean) { 23 | vnav.timer = setInterval(function () { vnav.update(); }, 5000); 24 | set(true); 25 | } else { 26 | clearInterval(vnav.timer); 27 | vnav.timer = null; 28 | set(false); 29 | } 30 | } 31 | }); 32 | 33 | // Speed control 34 | var spdControl = ko.observable(true); 35 | 36 | /** 37 | * departure object: airport, coords, runway, and SID 38 | */ 39 | var _departureAirport = ko.observable(); 40 | var _departureCoords = ko.observable([]); 41 | var _selectedDepartureRwy = ko.observable(); 42 | var _selectedSID = ko.observable(); 43 | 44 | // List of runways and SIDs 45 | var _departureRwys = ko.pureComputed(function () { 46 | var depArpt = departure.airport(); 47 | var depSID = departure.SID() ? departure.SID().name : undefined; 48 | 49 | return get.runway(depArpt, depSID, true); 50 | }); 51 | var _SIDs = ko.pureComputed(function () { 52 | var depArpt = departure.airport(); 53 | var depRwy = departure.runway() ? departure.runway().runway : undefined; 54 | var depSID = departure.SID() ? departure.SID().name : undefined; 55 | 56 | return get.SID(depArpt, depRwy, depSID); 57 | }); 58 | 59 | var departure = { 60 | // Departure airport name 61 | airport: ko.pureComputed({ 62 | read: _departureAirport, 63 | write: function (airport) { 64 | var oldAirport = _departureAirport(); 65 | var coords = icao[airport]; 66 | 67 | if (airport !== oldAirport) departure.runway(undefined); 68 | 69 | if (!coords) { 70 | _departureAirport(undefined); 71 | _departureCoords([]); 72 | } 73 | else { 74 | _departureAirport(airport); 75 | _departureCoords(coords); 76 | } 77 | 78 | lnav.update(); 79 | } 80 | }), 81 | 82 | // Departure airport coordinates 83 | coords: ko.pureComputed(function () { 84 | return _departureCoords(); 85 | }), 86 | 87 | // Departure runway data 88 | runway: ko.pureComputed({ 89 | read: _selectedDepartureRwy, 90 | write: function (index) { 91 | var rwyData = _departureRwys()[index]; 92 | 93 | if (rwyData) _selectedDepartureRwy(rwyData); 94 | else { 95 | _selectedDepartureRwy(undefined); 96 | departure.SID(undefined); 97 | } 98 | } 99 | }), 100 | 101 | // SID data 102 | SID: ko.pureComputed({ 103 | read: _selectedSID, 104 | write: function (index) { 105 | var SIDData = _SIDs()[index]; 106 | _selectedSID(SIDData); 107 | } 108 | }) 109 | 110 | }; 111 | 112 | /** 113 | * arrival object: airport, coords, runway, and SID 114 | */ 115 | var _arrivalAirport = ko.observable(); 116 | var _arrivalCoords = ko.observable([]); 117 | var _selectedArrivalRwy = ko.observable(); 118 | var _selectedSTAR = ko.observable(); 119 | 120 | // List of runways and STARs 121 | var _arrivalRwys = ko.pureComputed(function () { 122 | return get.runway(arrival.airport()); 123 | }); 124 | var _STARs = ko.pureComputed(function () { 125 | return get.SID(arrival.airport(), arrival.runway() ? arrival.runway().runway : false); 126 | }); 127 | 128 | var arrival = { 129 | // Arrival airport name 130 | airport: ko.pureComputed({ 131 | read: _arrivalAirport, 132 | write: function (airport) { 133 | var oldAirport = _arrivalAirport(); 134 | var coords = icao[airport]; 135 | 136 | if (airport !== oldAirport) arrival.runway(undefined); 137 | 138 | if (!coords) { 139 | _arrivalAirport(undefined); 140 | _arrivalCoords([]); 141 | } 142 | else { 143 | _arrivalAirport(airport); 144 | _arrivalCoords(coords); 145 | } 146 | lnav.update(); 147 | } 148 | }), 149 | 150 | // Arrival airport coordinates 151 | coords: ko.pureComputed(function () { 152 | return _arrivalCoords(); 153 | }), 154 | 155 | // Arrival runway data 156 | runway: ko.pureComputed({ 157 | read: _selectedArrivalRwy, 158 | write: function (index) { 159 | var rwyData = _arrivalRwys()[index]; 160 | 161 | if (rwyData) _selectedArrivalRwy(rwyData); 162 | else { 163 | _selectedArrivalRwy(undefined); 164 | arrival.STAR(undefined); 165 | } 166 | } 167 | }), 168 | 169 | // STAR data 170 | STAR: ko.pureComputed({ 171 | read: _selectedSTAR, 172 | write: function (index) { 173 | var STARData = _STARs()[index]; 174 | _selectedSTAR(STARData); 175 | } 176 | }) 177 | 178 | }; 179 | 180 | // Flight Number 181 | var flightNumber = ko.observable(); 182 | 183 | // Cruise altitude 184 | var _cruiseAlt = ko.observable(); 185 | var cruiseAlt = ko.pureComputed({ 186 | read: _cruiseAlt, 187 | write: function (val) { 188 | var set = _cruiseAlt; 189 | 190 | if (!val) { 191 | set(undefined); 192 | vnavEnabled(false); 193 | } else set(+val); 194 | } 195 | }); 196 | 197 | // Flight phase 198 | var _phase = ko.observable(0); 199 | var phase = ko.pureComputed({ 200 | read: _phase, 201 | write: function (index) { 202 | if (phaseLocked() || index > 3) return; 203 | _phase(index); 204 | }, 205 | }); 206 | 207 | var _phaseLocked = ko.observable(false); 208 | var phaseLocked = ko.pureComputed({ 209 | read: _phaseLocked, 210 | write: function (boolean, viewmodel) { // jshint unused:false 211 | _phaseLocked(boolean); 212 | } 213 | }); 214 | 215 | // Automatic TOD calculation 216 | var todCalc = ko.observable(false); 217 | 218 | // Arrival Airport field altitude 219 | var fieldElev = ko.observable(); 220 | 221 | exports.todDist = todDist; 222 | exports.vnavEnabled = vnavEnabled; 223 | exports.spdControl = spdControl; 224 | exports.departure = departure; 225 | exports.arrival = arrival; 226 | exports.number = flightNumber; 227 | exports.cruiseAlt = cruiseAlt; 228 | exports.phase = phase; 229 | exports.phaseLocked = phaseLocked; 230 | exports.todCalc = todCalc; 231 | exports.fieldElev = fieldElev; 232 | 233 | }); 234 | -------------------------------------------------------------------------------- /source/get.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['get/waypoint', 'get/ATS', 'get/SID', 'get/STAR', 'get/runway', 'exports'], function (a, b, c, d, e, exports) { 4 | exports.waypoint = a; 5 | exports.ATS = b; 6 | exports.SID = c; 7 | exports.STAR = d; 8 | exports.runway = e; 9 | }); 10 | -------------------------------------------------------------------------------- /source/get/ATS.js: -------------------------------------------------------------------------------- 1 | "use strict"; // TODO Properly implement 2 | 3 | define(['data', 'log'], function (data, log) { 4 | 5 | function getAirway (startFix, airway, endFix) { 6 | if (!startFix || !endFix) log.warn('There must be one waypoint before and after the airway.'); 7 | 8 | var airwayList = data.ATS[airway]; // jshint unused: false 9 | 10 | var validList; 11 | } 12 | 13 | return function (startFix, airway, endFix) { 14 | return getAirway(startFix, airway, endFix); 15 | }; 16 | 17 | }); 18 | -------------------------------------------------------------------------------- /source/get/SID.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['data'], function (data) { 4 | 5 | /** 6 | * Get all SID info for airport and departure runway 7 | * 8 | * @param {String} airport 9 | * @param {String} runway 10 | * @param {String} selectedSIDName Allows SID to be selected before a runway 11 | * @returns {Array} The array of SID 12 | */ 13 | return function (airport, runway, selectedSIDName) { 14 | // If there is no departure airport 15 | if (!airport) return []; 16 | 17 | var allSID = data.SID[airport] || []; 18 | var validSID = []; 19 | 20 | // If a SID is already selected 21 | if (selectedSIDName) { 22 | // If SID is selected before runway, return selected SID name and a list of available runways 23 | if (!runway) { 24 | var availableRunways = []; 25 | 26 | allSID.forEach(function (obj) { 27 | if (obj.name === selectedSIDName) availableRunways.push(obj.runway); 28 | }); 29 | 30 | validSID.push({ 31 | name: selectedSIDName, 32 | availableRunways: availableRunways 33 | }); 34 | } 35 | 36 | 37 | // If both a SID and a runway are selected 38 | else { 39 | allSID.forEach(function (obj) { 40 | if (obj.name === selectedSIDName && obj.runway === runway) validSID.push(obj); 41 | }); 42 | } 43 | } 44 | 45 | // If there is no SID selected 46 | else { 47 | // List of SID names (no runways, no duplicates) 48 | if (!runway) { 49 | var tempSIDArray = []; 50 | 51 | allSID.forEach(function (obj) { 52 | if (tempSIDArray.indexOf(obj.name) === -1) tempSIDArray.push(obj.name); 53 | }); 54 | 55 | tempSIDArray.forEach(function (element) { 56 | validSID.push({ name: element }); 57 | }); 58 | } 59 | 60 | // List of SID names (with runways) 61 | else { 62 | allSID.forEach(function (obj) { 63 | if (obj.runway === runway) validSID.push(obj); 64 | }); 65 | } 66 | } 67 | 68 | // Returns the list of SID 69 | return validSID; 70 | }; 71 | 72 | }); 73 | -------------------------------------------------------------------------------- /source/get/STAR.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['data'], function (data) { 4 | 5 | /** 6 | * Get all STAR info for airport and arrival runway 7 | * 8 | * @param {String} airport 9 | * @returns {Array} The array of STAR 10 | */ 11 | return function (airport, runway) { 12 | if (!airport || !runway) return []; 13 | // FIXME: there still can be a STAR even if there is no arrival runway 14 | 15 | var allSTAR = data.STAR[airport]; 16 | var validSTAR = []; 17 | 18 | if (Array.isArray(allSTAR)) 19 | allSTAR.forEach(function (obj) { 20 | if (obj.runway === runway) validSTAR.push(obj); 21 | }); 22 | 23 | return validSTAR; 24 | }; 25 | 26 | }); 27 | -------------------------------------------------------------------------------- /source/get/runway.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['data', './SID'], function (data, getSID) { 4 | 5 | /** 6 | * Get all runway info for airport 7 | * 8 | * @param {String} airport Departure or Arrival airport 9 | * @param {String} selected Selected SID or STAR name 10 | * @param {Boolean} isDeparture Is the aircraft in departure 11 | * @returns {Array} The array of runway list 12 | */ 13 | return function (airport, selected, isDeparture) { 14 | // If there is no departure or arrival airport 15 | if (!airport) return []; 16 | 17 | var runways = data.runways[airport]; 18 | var runwayArray = []; 19 | 20 | // If plane is in departure 21 | if (isDeparture) { 22 | // If there is already a selected SID, extracts a list of available runways 23 | if (selected) { 24 | getSID(airport, undefined, selected)[0].availableRunways.forEach(function (rwy) { 25 | runwayArray.push({ 26 | runway: rwy 27 | }); 28 | }); 29 | } 30 | 31 | // If there is no selected SID 32 | else { 33 | for (var rwy in runways) { 34 | runwayArray.push({ 35 | runway: rwy 36 | }); 37 | } 38 | } 39 | } 40 | 41 | // If plane is in arrival 42 | else {} // TODO 43 | 44 | // Returns the list of runway 45 | return runwayArray; 46 | }; 47 | 48 | }); 49 | -------------------------------------------------------------------------------- /source/get/waypoint.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['data', 'utils', 'waypoints'], function (data, utils, waypoints) { 4 | 5 | // Autopilot++ Dependencies 6 | var icao = autopilot_pp.require('json!data/icaoairports.json'); 7 | 8 | /** 9 | * Finds closest point to the last waypoint in waypoints.route 10 | * or current coordinates 11 | * 12 | * @param {Array} list The list of coordinates 13 | * @param {Number} index Index of the route 14 | */ 15 | function closestPoint (list, index) { 16 | var closestDist = Infinity, closestIndex = 0; 17 | 18 | for (var i = 0; i < list.length; i++) { 19 | 20 | // Sets current coords to the previous waypoint in the list if applicable 21 | // Else, current coords set to current position 22 | var curLat = geofs.aircraft.instance.llaLocation[0]; 23 | var curLon = geofs.aircraft.instance.llaLocation[1]; 24 | var lat = index === 0 ? curLat : waypoints.route()[index-1].lat(); 25 | var lon = index === 0 ? curLon : waypoints.route()[index-1].lon(); 26 | 27 | var relativeDist = utils.getDistance(list[i][0], list[i][1], lat, lon); 28 | 29 | if (relativeDist < closestDist) { 30 | closestDist = relativeDist; 31 | closestIndex = i; 32 | } 33 | 34 | } 35 | 36 | return list[closestIndex]; 37 | } 38 | 39 | /** 40 | * Gets coordinates for ICAO Airports, Waypoints, or Navaids 41 | * 42 | * @param {String} fix The name of the fix 43 | * @param {Number} index Index of the route 44 | * @returns {Array} The coordinates array 45 | */ 46 | return function (fix, index) { 47 | var coords = icao[fix]; 48 | if (coords) return coords; 49 | 50 | var list = data.waypoints[fix]; 51 | if (list) return closestPoint(list, index); 52 | 53 | list = data.navaids[fix]; 54 | if (list) return closestPoint(list, index); 55 | 56 | return undefined; 57 | }; 58 | }); 59 | -------------------------------------------------------------------------------- /source/html/button.html: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /source/html/externaldist.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | Dest 4 |  nm 5 | 6 |
7 | -------------------------------------------------------------------------------- /source/html/modal.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 7 |
8 |
9 |

Flight Management Computer

10 |
11 |
12 | 13 | 14 |
15 |
16 | 17 | 18 |
19 |
20 |
21 | RTE 22 | ARR 23 | LEGS 24 | VNAV 25 | 26 | PROG 27 | 28 | LOAD 29 | LOG 30 |
31 |
32 |
33 | 34 | 35 |
36 | 37 | 38 |
39 |
40 | 41 | 45 | 46 |
47 |
48 |
49 |
50 | 51 | 52 |
53 | 54 | 55 | 58 |
59 | 63 |
64 |
65 | Phase 66 | 67 | 70 |
71 | 72 | 73 | 74 | 75 |
76 |
77 | -------------------------------------------------------------------------------- /source/html/tab-contents/dep-arr.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 | 8 | 16 | 17 | 18 | 26 | 27 |
9 | T/D Dist. 10 |
11 | 12 | 13 | Invalid T/D Distance 14 |
15 |
19 | Arrival Field Elev. 20 |
21 | 22 | 23 | Invalid Field Elevation 24 |
25 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /source/html/tab-contents/ils.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 31 | 32 | 33 | 40 | 41 | 42 | 49 | 50 | 51 | 58 | 59 |
GlideslopeRunway ThresholdOpposite Threshold
16 |
17 | 18 | 19 | Invalid Glideslope 20 |
21 |
25 |
26 | 27 | 28 | Invalid Latitude 29 |
30 |
34 |
35 | 36 | 37 | Invalid Longitude 38 |
39 |
43 |
44 | 45 | 46 | Invalid Latitude 47 |
48 |
52 |
53 | 54 | 55 | Invalid Longitude 56 |
57 |
60 |
61 |
62 |
63 | -------------------------------------------------------------------------------- /source/html/tab-contents/legs.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 24 | 27 | 28 | 29 | 30 |
17 |
18 |
19 |
21 |
22 |
23 |
25 |
26 |
31 |
32 |
33 |
34 | -------------------------------------------------------------------------------- /source/html/tab-contents/load.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 |
8 | Waypoints / Route 9 | mode_edit 10 |
11 |
12 | 13 | 14 |
15 | 18 | 19 | 20 |
21 | 22 | 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /source/html/tab-contents/log.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
TimeSpd.Hdg.Alt.Lat.Lon.FPSOther
31 |
32 |
33 |
34 | -------------------------------------------------------------------------------- /source/html/tab-contents/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'minify!./route.html', 'minify!./dep-arr.html', 'minify!./legs.html', 5 | 'minify!./vnav.html', 'minify!./ils.html', 'minify!./progress.html', 6 | 'minify!./map.html', 'minify!./load.html', 'minify!./log.html' 7 | ], function (route, depArr, legs, vnav, ils, progress, map, load, log) { 8 | return [route, depArr, legs, vnav, ils, progress, map, load, log].join(''); 9 | }); 10 | -------------------------------------------------------------------------------- /source/html/tab-contents/map.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
7 | -------------------------------------------------------------------------------- /source/html/tab-contents/progress.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 |
8 | 9 | Dest 10 |  nm 11 | 12 |
ETE: 
13 |
ETA: 
14 |
15 |
16 |
17 | 18 | 19 |
20 | 21 | T/D 22 |  nm 23 | 24 |
ETE: 
25 |
ETA: 
26 |
27 |
28 |
29 | 30 | 31 |
32 | 33 | 34 | Next Waypoint 35 | room 36 | 37 |  nm 38 | 39 | 40 |
41 | 42 |
43 |
44 |
45 | -------------------------------------------------------------------------------- /source/html/tab-contents/route.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 |
7 | 8 | 9 | 10 | 17 | 18 | 25 | 26 | 33 | 34 |
11 | flight_takeoff 12 |
13 | 14 | 15 |
16 |
19 | flight_land 20 |
21 | 22 | 23 |
24 |
27 | local_airport 28 |
29 | 30 | 31 |
32 |
35 |
36 | 37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 64 | 72 | 80 | 88 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 |
WaypointsPositionAltitudeActions
57 | 58 | 59 |
60 | 61 | 62 |
63 |
65 | 66 |
67 | 68 | 69 | Invalid Latitude 70 |
71 |
73 | 74 |
75 | 76 | 77 | Invalid Longitude 78 |
79 |
81 | 82 |
83 | 84 | 85 | Invalid Altitude 86 |
87 |
89 | 90 | 93 | 96 | 99 | 102 |
112 |
113 |
114 |
115 | -------------------------------------------------------------------------------- /source/html/tab-contents/vnav.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 | 6 | 7 | 8 | 9 | 25 | 26 | 27 | 35 | 36 |
10 |
11 |
12 | 16 | unfold_more_horizontal 17 |
18 |
19 | 20 | 21 | Invalid Cruise Altitude 22 |
23 |
24 |
28 |
29 | 33 |
34 |
37 |
38 |
39 |
40 | -------------------------------------------------------------------------------- /source/init.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Copyright (c) 2016-2018 Harry Xue, (c) 2016-2017 Ethan Shields 3 | * Released under the GNU Affero General Public License, v3.0 or later 4 | * https://github.com/geofs-plugins/fmc-requirejs/blob/master/LICENSE.md 5 | */ 6 | 7 | "use strict"; 8 | 9 | (function () { 10 | 11 | if (!window.Promise) throw new Error('Browser is outdated.'); 12 | 13 | var VALID_VERSION = 'v0.11.2'; 14 | 15 | // Error if FMC is loaded without Autopilot++ or with outdated Autopilot++ 16 | function errorNotCompatible () { 17 | console.error('Incompatible: You must have Autopilot++ ' + 18 | '{>= %s} installed in order to use FMC.', VALID_VERSION); 19 | } 20 | 21 | // Check if Autopilot++ is installed (version >= v0.10.6) 22 | function hasAutopilot () { 23 | if (window.autopilot_pp) { 24 | var apVersion = autopilot_pp.version.split('.'); 25 | var vlVersion = VALID_VERSION.substring(1).split('.'); 26 | if (apVersion[0] === vlVersion[0] && 27 | apVersion[1] === vlVersion[1] && 28 | apVersion[2] >= vlVersion[2] || 29 | apVersion[0] > vlVersion[0] || 30 | apVersion[1] > vlVersion[1]) return true; 31 | } 32 | return false; 33 | } 34 | 35 | // Check if game has completed loading 36 | var timer = setInterval(function () { 37 | if (!(window.L && 38 | window.geofs && geofs.aircraft && 39 | geofs.aircraft.instance && 40 | geofs.aircraft.instance.object3d)) return; 41 | 42 | clearInterval(timer); 43 | 44 | if (!hasAutopilot()) errorNotCompatible(); 45 | else require(['ui/main']); 46 | }, 250); 47 | 48 | })(); 49 | -------------------------------------------------------------------------------- /source/log.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['knockout', 'utils', 'exports'], function (ko, utils, exports) { 4 | 5 | var animationValue = geofs.aircraft.instance.animationValue; 6 | 7 | exports.mainTimer = null; 8 | exports.speedTimer = null; 9 | 10 | exports.data = ko.observableArray(); 11 | 12 | /** 13 | * Updates plane's flight log, set on a timer 14 | * 15 | * @param {String} [other] Updates the log with other as extra info 16 | */ 17 | exports.update = function (other) { 18 | if (!geofs.pause && !(window.flight.recorder.playing || window.flight.recorder.paused)) { 19 | var spd = Math.round(animationValue.ktas); 20 | var hdg = Math.round(animationValue.heading360); 21 | var alt = Math.round(animationValue.altitude); 22 | var fps = +geofs.debug.fps; 23 | var lat = (Math.round(10000 * geofs.aircraft.instance.llaLocation[0])) / 10000; 24 | var lon = (Math.round(10000 * geofs.aircraft.instance.llaLocation[1])) / 10000; 25 | var date = new Date(); 26 | var h = date.getUTCHours(); 27 | var m = date.getUTCMinutes(); 28 | var time = utils.formatTime(utils.timeCheck(h, m)); 29 | other = other || "--"; 30 | 31 | var dataArray = [ time, spd, hdg, alt, lat, lon, fps, other ]; 32 | exports.data.push(dataArray); 33 | } 34 | clearInterval(exports.mainTimer); 35 | if (animationValue.altitude > 18000) { 36 | exports.mainTimer = setInterval(exports.update, 120000); 37 | } else exports.mainTimer = setInterval(exports.update, 30000); 38 | }; 39 | 40 | /** 41 | * Checks for overspeed under 10000 feet AGL for log, set on a timer 42 | */ 43 | exports.speed = function () { 44 | var kcas = animationValue.kcas; 45 | var altitude = animationValue.altitude + geofs.groundElevation * METERS_TO_FEET; 46 | if (kcas > 255 && altitude < 10000) { 47 | exports.update('Overspeed'); 48 | } 49 | clearInterval(exports.speedTimer); 50 | if (altitude < 10000) exports.speedTimer = setInterval(exports.speed, 15000); 51 | else exports.speedTimer = setInterval(exports.speed, 30000); 52 | }; 53 | 54 | /** 55 | * Clears the log 56 | */ 57 | exports.removeData = function () { 58 | exports.data.removeAll(); 59 | }; 60 | 61 | }); 62 | -------------------------------------------------------------------------------- /source/minify.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | define(['text'], function (text) { 4 | 5 | var buildMap = {}; 6 | 7 | /** 8 | * Removes white space from a string (HTML and CSS only) on load 9 | * 10 | * @param {String} content The string to be trimmed and minified 11 | * @returns {String} Content that has been minified 12 | */ 13 | function minifyOnLoad (content) { 14 | return content.replace(/\r/g, "") // Carriage return 15 | .replace(/\n\s+/g, "") // New line followed by white space 16 | .replace(/\n/g, "") // Extra new lines 17 | .replace(/\t/g, "") // Extra tabs 18 | .replace(/\s*{/g, "{") // CSS open brace 19 | .replace(/\s*\:\s*/g, ":") // CSS definition colons 20 | .replace(/\s*;\s*/g, ";") // CSS semi-colons 21 | .replace(/\s*\/\*[^]*?\*\/\s*/g, "") // CSS comments 22 | .replace(/\s*\s*/g, "") // HTML comments (no ko) 23 | .replace(/\s*\s*/g, "-->"); // ko comment close tag 25 | } 26 | 27 | /** 28 | * Properly escapes javascript's String on module build 29 | * 30 | * @param {String} content The string to be escaped during build 31 | * @returns {String} Content that has been optimized for build 32 | */ 33 | function minifyOnBuild (content) { 34 | return content 35 | .replace(/\\/g, "\\\\") // Escapes backslash (\) 36 | .replace(/'/g, "\\'"); // Single quotes 37 | } 38 | 39 | return { 40 | /** 41 | * Executes minify() when module is required 42 | * 43 | * @param {String} name Name of this module 44 | * @param {Object} require The require object passed in by requirejs 45 | * @param {Function} onLoad Callback function to update content 46 | * @param {Object} config Determine require type 47 | */ 48 | load: function (name, require, onLoad, config) { 49 | if (config && config.isBuild && !config.inlineText) { 50 | onLoad(null); 51 | } else { 52 | text.get(require.toUrl(name), function (content) { 53 | buildMap[name] = minifyOnLoad(content); 54 | onLoad(buildMap[name]); 55 | }); 56 | } 57 | }, 58 | 59 | /** 60 | * Turns passed in content into a requirejs module when being built 61 | * 62 | * @param {String} pluginName Name of this module when it is required 63 | * @param {String} moduleName Name of the module that required this one 64 | * @param {Function} write Callback function to write as module 65 | */ 66 | write: function (pluginName, moduleName, write) { 67 | if (moduleName in buildMap) { 68 | var content = minifyOnBuild(buildMap[moduleName]); 69 | write("define('" + pluginName + "!" + moduleName 70 | + "', function () { return '" + content + "';});\n"); 71 | } 72 | } 73 | }; 74 | }); 75 | -------------------------------------------------------------------------------- /source/nav/ILS.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['flight', 'utils', 'exports'], function (flight, utils, exports) { 4 | 5 | // Glideslope, in degrees 6 | var glideslope = flight.arrival.runway()[3]; 7 | 8 | // Threshold lat/lon 9 | var thresholdCoords = [ flight.arrival.runway()[0], flight.arrival.runway()[1] ]; 10 | 11 | // Opposite end lat/lon 12 | // FIXME: find thresholdCoords of opposite runway 13 | // | Opposite runway # - Current runway # | = 18, L <-> R, C <-> C 14 | var oppositeCoords = []; 15 | 16 | // URLs of instruments 17 | var FILE_PATH = PAGE_PATH + 'fmc/images/'; 18 | var url = { 19 | attitudeJetILS: FILE_PATH + 'attitude-jet-ils.png', 20 | glideslopeHand: FILE_PATH + 'glideslope-indicator.png', 21 | localizerHand: FILE_PATH + 'localizer-indicator.png' 22 | }; 23 | 24 | /** 25 | * Calculates the deviation value of glideslope 26 | * 27 | * @returns {Number} The value of glideslope deviation 28 | */ 29 | function glideslopeCalc () { // FIXME find the true value for "VALUE" 30 | var gs = glideslope; 31 | var threshold = exports.thresholdCoords; 32 | var current = geofs.aircraft.instance.llaLocation; 33 | 34 | // If either one component is missing, invalid, returns 0 35 | if (!(threshold[0] && threshold[1] && current[0] && current[1] && current[2])) return 0; 36 | 37 | var VALUE = 1; // Constant value to multiply ticks off by 38 | 39 | // Landing zone calculations and target altitude 40 | var altitudeAtAim = geofs.getGroundAltitude(threshold[0], threshold[1]); // Feet 41 | var distanceToAim = utils.getDistance(current[0], current[1], threshold[0], threshold[1]) + 500 * utils.FEET_TO_NM; // nm 42 | var targetAltitude = Math.tan(utils.toRadians(gs)) * distanceToAim * utils.NM_TO_FEET + altitudeAtAim; // Feet 43 | 44 | // Each tick stands for 1/4 degrees off the intended glideslope 45 | var quarterDegree = Math.tan(utils.toRadians(0.25)) * distanceToAim * utils.NM_TO_FEET; 46 | var ticksOff = (targetAltitude - current[2]) / quarterDegree; 47 | 48 | // Maximum of 2 ticks on each side 49 | if (Math.abs(ticksOff) <= 2) return ticksOff * VALUE; 50 | else if (ticksOff < 0) return -VALUE * 2; 51 | else return VALUE * 2; 52 | } 53 | 54 | /** 55 | * Calculates the deviation value of localizer 56 | * 57 | * @returns {Number} The value of localizer deviation 58 | */ 59 | function localizerCalc () { // FIXME find the true value for "VALUE" and offset distance threshold 60 | var threshold = thresholdCoords; 61 | var opposite = oppositeCoords; 62 | var current = geofs.aircraft.instance.llaLocation; 63 | 64 | // If either one component is missing, invalid, returns 0 65 | if (!(threshold[0] && threshold[1] && opposite[0] && opposite[1] && current[0])) return 0; 66 | 67 | var VALUE = 1; // Constant to multiply ticks off by 68 | 69 | // Deviation from centerline calculation, achieved by using the sine of the angle in between 70 | var distanceToThreshold = utils.getDistance(current[0], current[1], threshold[0], threshold[1]); 71 | var runwayBearing = utils.getBearing(threshold[0], threshold[1], opposite[0], opposite[1]); 72 | var deltaTheta = utils.getBearing(current[0], current[1], threshold[0], threshold[1]) - runwayBearing; 73 | var offsetDistance = Math.sin(utils.toRadians(deltaTheta)) * distanceToThreshold * utils.NM_TO_FEET; 74 | 75 | // Each tick stands for 3 degrees off the centerline (300 feet at threshold) 76 | var maxOffsetDistance = Math.sin(utils.toRadians(3)) * (distanceToThreshold * utils.NM_TO_FEET + 500); 77 | var ticksOff = offsetDistance / (300 + maxOffsetDistance); 78 | 79 | // Maximum of 1 tick on each side 80 | if (Math.abs(ticksOff) <= 1) return ticksOff * VALUE; 81 | else if (ticksOff < 0) return -VALUE; 82 | else return VALUE; 83 | } 84 | 85 | // Replaces the current "attitudeJet" 86 | exports.instrument = { 87 | stackX: true, 88 | overlay: { 89 | url: url.attitudeJet, 90 | size: { 91 | x: 200, 92 | y: 200 93 | }, 94 | anchor: { 95 | x: 100, 96 | y: 100 97 | }, 98 | position: { 99 | x: 0, 100 | y: 110 101 | }, 102 | rescale: true, 103 | rescalePosition: true, 104 | 105 | overlays: [ 106 | 107 | // attitude-jet-hand 108 | { 109 | animations: [{ 110 | type: "rotate", 111 | value: "aroll", 112 | ratio: -1, 113 | min: -180, 114 | max: 180 115 | }, { 116 | type: "translateY", 117 | value: "atilt", 118 | ratio: -2, 119 | offset: 330, 120 | min: -90, 121 | max: 90 122 | }], 123 | url: PAGE_PATH + "images/instruments/attitude-jet-hand.png", 124 | anchor: { 125 | x: 100, 126 | y: 70 127 | }, 128 | size: { 129 | x: 200, 130 | y: 800 131 | }, 132 | position: { 133 | x: 0, 134 | y: 0 135 | }, 136 | iconFrame: { 137 | x: 200, 138 | y: 140 139 | } 140 | }, 141 | 142 | // attitude-jet-pointer 143 | { 144 | animations: [{ 145 | type: "rotate", 146 | value: "aroll", 147 | ratio: -1, 148 | min: -60, 149 | max: 60 150 | }], 151 | url: PAGE_PATH + "images/instruments/attitude-jet-pointer.png", 152 | anchor: { 153 | x: 100, 154 | y: 100 155 | }, 156 | size: { 157 | x: 200, 158 | y: 200 159 | }, 160 | position: { 161 | x: 0, 162 | y: 0 163 | } 164 | }, 165 | 166 | // glideslope-indicator 167 | { 168 | animations: [{ 169 | type: 'translateY', 170 | value: glideslopeCalc 171 | }], 172 | url: url.glideslopeHand, 173 | anchor: { 174 | x: 100, 175 | y: 100 176 | }, 177 | size: { 178 | x: 200, 179 | y: 200 180 | }, 181 | position: { 182 | x: 0, 183 | y: 0 184 | } 185 | }, 186 | 187 | // localizer-indicator 188 | { 189 | animations: [{ 190 | type: 'translateX', 191 | value: localizerCalc 192 | }], 193 | url: url.localizerHand, 194 | anchor: { 195 | x: 100, 196 | y: 100 197 | }, 198 | size: { 199 | x: 200, 200 | y: 200 201 | }, 202 | position: { 203 | x: 0, 204 | y: 0 205 | } 206 | }, 207 | 208 | // attitude-jet 209 | { 210 | url: url.attitudeJet, 211 | anchor: { 212 | x: 100, 213 | y: 100 214 | }, 215 | size: { 216 | x: 200, 217 | y: 200 218 | }, 219 | position: { 220 | x: 0, 221 | y: 0 222 | } 223 | }] 224 | } 225 | }; 226 | 227 | // Turns ILS function on/off 228 | exports.toggleILS = function () { 229 | // TO BE IMPLEMENTED 230 | }; 231 | 232 | }); 233 | -------------------------------------------------------------------------------- /source/nav/LNAV.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['distance', 'flight', 'waypoints', 'exports'], function (distance, flight, waypoints, exports) { 4 | 5 | exports.timer = null; 6 | 7 | /** 8 | * Controls LNAV, plane's lateral navigation, set on a timer 9 | */ 10 | exports.update = function () { 11 | if (waypoints.nextWaypoint() === null || !flight.arrival.airport()) { 12 | clearInterval(exports.timer); 13 | exports.timer = null; 14 | return; 15 | } 16 | 17 | var d = distance.route(waypoints.nextWaypoint() + 1); 18 | if (d <= distance.turn(60)) { 19 | waypoints.activateWaypoint(waypoints.nextWaypoint() + 1); 20 | } 21 | 22 | clearInterval(exports.timer); 23 | if (d < geofs.aircraft.instance.animationValue.ktas / 60) exports.timer = setInterval(exports.update, 500); 24 | else exports.timer = setInterval(exports.update, 5000); 25 | }; 26 | }); 27 | -------------------------------------------------------------------------------- /source/nav/VNAV.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'debug', 'distance', 'flight', 'utils', 'waypoints', 'vnav-profile' 5 | ], function (debug, distance, flight, utils, waypoints, vnavProfile) { 6 | 7 | // Autopilot++ Dependencies 8 | var apModes = autopilot_pp.require('autopilot').modes; 9 | 10 | return { 11 | timer: null, 12 | 13 | /** 14 | * Controls VNAV, plane's vertical navigation, set on a timer 15 | */ 16 | update: function () { 17 | if (!flight.vnavEnabled()) return; 18 | 19 | var route = waypoints.route(); 20 | 21 | var params = getFlightParameters(); 22 | 23 | var next = waypoints.nextWptAltRes(); 24 | var hasRestriction = next !== -1; 25 | 26 | var todDist = flight.todDist(); 27 | var cruiseAlt = flight.cruiseAlt(); 28 | var fieldElev = flight.fieldElev(); 29 | var todCalc = flight.todCalc(); 30 | 31 | var currentAlt = geofs.aircraft.instance.animationValue.altitude; 32 | var targetAlt, deltaAlt, nextDist, targetDist; 33 | if (hasRestriction) { 34 | targetAlt = route[next].alt(); 35 | deltaAlt = targetAlt - currentAlt; 36 | nextDist = distance.route(next + 1); 37 | targetDist = distance.target(deltaAlt); 38 | debug.log('targetAlt: ' + targetAlt + ', deltaAlt: ' + deltaAlt + ', nextDist: ' + nextDist + ', targetDist: ' + targetDist); 39 | } 40 | 41 | var spd = params[0], vs, alt; 42 | 43 | /********************** 44 | * Flight Phase Logic * 45 | **********************/ 46 | var lat1 = geofs.aircraft.instance.llaLocation[0] || null; 47 | var lon1 = geofs.aircraft.instance.llaLocation[1] || null; 48 | var lat2 = flight.arrival.coords()[0] || null; 49 | var lon2 = flight.arrival.coords()[1] || null; 50 | var flightDist; 51 | 52 | // Checks if the whole route is complete 53 | for (var i = 0, valid = true; i < route.length; i++) { 54 | if (!route[i].lat() || !route[i].lon()) valid = false; 55 | } 56 | if (valid) flightDist = distance.route(route.length); 57 | else flightDist = utils.getDistance(lat1, lon1, lat2, lon2); 58 | 59 | // Invalid distance, phase resets to default = climb 60 | if (isNaN(flightDist)) flight.phase(0); 61 | 62 | // Total route dist is less than T/D distance, phase = descent 63 | else if (flightDist < todDist) flight.phase(2); 64 | 65 | // If current altitude is close to the cruise altitude, phase = cruise 66 | else if (Math.abs(cruiseAlt - currentAlt) <= 100) flight.phase(1); 67 | 68 | // If current altitude is less than cruise altitude, phase = climb 69 | else if (currentAlt < cruiseAlt) flight.phase(0); 70 | 71 | // If current altitude is greater than cruise altitude 72 | // This means that cruise altitude is lowered during cruise 73 | // Phase still is cruise, but assign V/S value 74 | else if (currentAlt > cruiseAlt) { 75 | flight.phase(1); 76 | vs = -1000; 77 | } 78 | 79 | // Else, resets to default phase = climb 80 | else flight.phase(0); 81 | 82 | // ============================== 83 | 84 | // If the aircraft is climbing 85 | if (flight.phase() === 0) { 86 | 87 | // If there is an altitude restriction somewhere on the route 88 | if (hasRestriction) { 89 | var totalDist = distance.target(cruiseAlt - currentAlt) + distance.target(targetAlt - cruiseAlt); 90 | debug.log('totalDist: ' + totalDist); 91 | 92 | // Checks to see if the altitude restriction is on the climbing phase or descent phase 93 | if (nextDist < totalDist) { 94 | if (nextDist < targetDist) vs = utils.getClimbrate(deltaAlt, nextDist); 95 | else vs = params[1]; 96 | alt = targetAlt; 97 | } else { 98 | vs = params[1]; 99 | alt = cruiseAlt; 100 | } 101 | } 102 | 103 | // If there are no altitude restrictions left on the route 104 | else { 105 | vs = params[1]; 106 | alt = cruiseAlt; 107 | } 108 | } 109 | 110 | // If the aircraft is on descent 111 | else if (flight.phase() === 2) { 112 | 113 | // If there is an altitude restriction somewhere on the route 114 | if (hasRestriction) { 115 | 116 | // If targetDist has been reached 117 | if (nextDist < targetDist) { 118 | vs = utils.getClimbrate(deltaAlt, nextDist); 119 | alt = targetAlt; 120 | } 121 | 122 | // If targetDist hasn't been reached do nothing until it has been reached 123 | } 124 | 125 | // If there are no altitude restrictions left on the route 126 | else { 127 | vs = params[1]; 128 | if (currentAlt > 12000 + fieldElev) alt = 100 * Math.round((12000 + fieldElev) / 100); 129 | } 130 | } 131 | 132 | // Calculates Top of Descent 133 | if (flight.phase() === 1 && (todCalc || !todDist)) { 134 | if (hasRestriction) { 135 | todDist = distance.route(route.length) - nextDist; 136 | todDist += distance.target(targetAlt - cruiseAlt); 137 | } else { 138 | todDist = distance.target(fieldElev - cruiseAlt); 139 | } 140 | todDist = Math.round(todDist); 141 | flight.todDist(todDist); 142 | debug.log('TOD changed to ' + todDist); 143 | } 144 | 145 | // Updates SPD, VS, and ALT in Autopilot++ if new values exist 146 | if (spd !== undefined) apModes.speed.value(spd); 147 | if (vs !== undefined) apModes.vs.value(vs); 148 | if (alt !== undefined) apModes.altitude.value(alt); 149 | } 150 | }; 151 | 152 | /** 153 | * @private 154 | * Gets each plane's flight parameters, for VNAV 155 | * 156 | * @returns {Array} [speed, vertical speed] 157 | */ 158 | function getFlightParameters () { 159 | var spd, vs; 160 | var a = geofs.aircraft.instance.animationValue.altitude; 161 | 162 | // CLIMB 163 | if (flight.phase() === 0) { 164 | var profile = getVNAVProfile().climb; 165 | 166 | for (var index, i = 0; i < profile.length; i++) { 167 | if (a > profile[i][0] && a <= profile[i][1]) { 168 | index = i; 169 | break; 170 | } 171 | } 172 | 173 | var belowStartAlt = index === undefined; 174 | 175 | if (flight.spdControl() && !belowStartAlt) { 176 | spd = profile[index][2]; 177 | if (index < profile.length - 1) vs = profile[index][3]; 178 | switchSpeedMode(spd); 179 | } 180 | } 181 | 182 | // DESCENT 183 | else if (flight.phase() === 2) { 184 | var profile = getVNAVProfile().descent; 185 | 186 | for (var index, i = 0; i < profile.length; i++) { 187 | if (a > profile[i][0] && a <= profile[i][1]) { 188 | index = i; 189 | break; 190 | } 191 | } 192 | 193 | var belowLastAlt = index === undefined; 194 | 195 | // If current alt below lowest alt in profile 196 | // SPD and V/S will not be restricted 197 | if (flight.spdControl() && !belowLastAlt) { 198 | spd = profile[index][2]; 199 | vs = profile[index][3]; 200 | switchSpeedMode(spd); 201 | } 202 | } 203 | 204 | return [spd, vs]; 205 | } 206 | 207 | /** 208 | * @private 209 | * Gets the climb/descent profile for VNAV 210 | * 211 | * @returns {Object} The profile needed by VNAV 212 | */ 213 | function getVNAVProfile () { 214 | return geofs.aircraft.instance.setup.fmc || 215 | vnavProfile[geofs.aircraft.instance.id] || 216 | vnavProfile.DEFAULT; 217 | } 218 | 219 | /** 220 | * @private 221 | * Checks if the speed input is mach and switches mode 222 | * 223 | * @param {Number} spd The speed to be checked 224 | */ 225 | function switchSpeedMode (spd) { 226 | if (!spd) return; 227 | if (spd <= 10) apModes.speed.isMach(true); 228 | else apModes.speed.isMach(false); 229 | } 230 | }); 231 | -------------------------------------------------------------------------------- /source/nav/progress.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'knockout', 'distance', 'flight', 'utils', 'waypoints', 'exports' 5 | ], function (ko, distance, flight, utils, waypoints, exports) { 6 | 7 | exports.timer = null; 8 | 9 | // Progress information 10 | exports.info = { 11 | flightETE: ko.observable('--:--'), 12 | flightETA: ko.observable('--:--'), 13 | todETE: ko.observable('--:--'), 14 | todETA: ko.observable('--:--'), 15 | flightDist: ko.observable('--'), 16 | todDist: ko.observable('--'), 17 | nextDist: ko.observable('--'), 18 | nextETE: ko.observable('--:--') 19 | }; 20 | 21 | /** 22 | * Updates the plane's progress during flying, set on a timer 23 | */ 24 | exports.update = function () { 25 | var route = waypoints.route(); 26 | var nextWaypoint = waypoints.nextWaypoint(); 27 | var lat1 = geofs.aircraft.instance.llaLocation[0]; 28 | var lon1 = geofs.aircraft.instance.llaLocation[1]; 29 | var lat2 = flight.arrival.coords()[0]; 30 | var lon2 = flight.arrival.coords()[1]; 31 | var times = [[], [], [], [], []]; // flightETE, flightETA, todETE, todETA, nextETE 32 | var nextDist = 33 | nextWaypoint === null ? 0 : route[nextWaypoint].distFromPrev(); 34 | var flightDist; 35 | 36 | // Checks if the whole route is complete 37 | for (var i = 0, valid = true; i < route.length; i++) { 38 | if (!route[i].lat() || !route[i].lon()) valid = false; 39 | } 40 | if (valid) flightDist = distance.route(route.length); 41 | else flightDist = utils.getDistance(lat1, lon1, lat2, lon2); 42 | 43 | // Calculates times if aircraft is flying and has an arrival airport 44 | if (!geofs.aircraft.instance.groundContact && flight.arrival.airport()) { 45 | times[0] = utils.getETE(flightDist, true); 46 | times[1] = utils.getETA(times[0][0], times[0][1]); 47 | times[4] = utils.getETE(nextDist, false); 48 | if ((flightDist - flight.todDist()) > 0) { 49 | times[2] = utils.getETE((flightDist - flight.todDist()), false); 50 | times[3] = utils.getETA(times[2][0], times[2][1]); 51 | } 52 | } 53 | 54 | exports.print(flightDist, nextDist, times); 55 | }; 56 | 57 | /** 58 | * Prints plane's progress to the UI 59 | * 60 | * @param {Number} flightDist The total flight distance 61 | * @param {Number} nextDist The distance to the next waypoint 62 | * @param {Array} times An array of the time: [hours, minutes] 63 | */ 64 | exports.print = function (flightDist, nextDist, times) { 65 | for (var i = 0; i < times.length; i++) { 66 | times[i] = utils.formatTime(times[i]); 67 | } 68 | 69 | // Formats flightDist 70 | if (flightDist < 10) { 71 | flightDist = Math.round(flightDist * 10) / 10; 72 | } else flightDist = Math.round(flightDist); 73 | 74 | // If T/D is entered and T/D has not been passed 75 | var todDist; 76 | if (flight.todDist() && flight.todDist() < flightDist) todDist = flightDist - flight.todDist(); 77 | 78 | // Formats nextDist 79 | if (nextDist < 10) { 80 | nextDist = (Math.round(10 * nextDist)) / 10; 81 | } else nextDist = Math.round(nextDist); 82 | 83 | // If times and distances are not defined, print default 84 | var DEFAULT_DIST = '--'; 85 | 86 | exports.info.flightETE(times[0]); 87 | exports.info.flightETA(times[1]); 88 | exports.info.todETE(times[2]); 89 | exports.info.todETA(times[3]); 90 | exports.info.flightDist(flightDist || DEFAULT_DIST); 91 | exports.info.todDist(todDist || DEFAULT_DIST); 92 | exports.info.nextDist(nextDist || DEFAULT_DIST); 93 | exports.info.nextETE(times[4]); 94 | }; 95 | }); 96 | -------------------------------------------------------------------------------- /source/path.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['geodesic'], function () { 4 | 5 | /** 6 | * Updates path based on previous and current waypoint info 7 | * 8 | * @param {Waypoint} prevWaypoint 9 | * @param {Waypoint} curWaypoint 10 | */ 11 | L.Geodesic.prototype.update = function (prevWaypoint, curWaypoint) { 12 | // No previous or current waypoint 13 | if (!prevWaypoint || !prevWaypoint.lat() || !prevWaypoint.lon() 14 | || !curWaypoint || !curWaypoint.lat() || !curWaypoint.lon()) { 15 | this.setLatLngs([]); 16 | return; 17 | } 18 | 19 | var prev = L.latLng(prevWaypoint.lat(), prevWaypoint.lon()); 20 | var cur = L.latLng(curWaypoint.lat(), curWaypoint.lon()); 21 | this.options.steps = Math.ceil(curWaypoint.distFromPrev() / 10); 22 | this.setLatLngs([[ prev, cur ]]); 23 | }; 24 | 25 | return function Path () { 26 | return L.geodesic([], { weight: 2 }).addTo(ui.mapInstance.apiMap.map); 27 | }; 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /source/redefine.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['debug', 'log'], function (debug, log) { 4 | 5 | // Adds a confirm window to prevent accidental reset 6 | geofs.resetFlight = function () { 7 | if (window.confirm('Reset Flight?')) { 8 | if (geofs.lastFlightCoordinates) { 9 | geofs.flyTo(geofs.lastFlightCoordinates, true); 10 | log.update('Flight reset'); 11 | } 12 | } 13 | }; 14 | 15 | // Tracks pause event to log 16 | geofs.togglePause = function () { 17 | if (!geofs.pause) { 18 | log.update('Flight paused'); 19 | geofs.doPause(); 20 | } else { 21 | geofs.undoPause(); 22 | log.update('Flight resumed'); 23 | } 24 | }; 25 | 26 | // Tracks gear up/down event to log 27 | controls.setters.setGear.set = function () { 28 | if (!geofs.aircraft.instance.groundContact || geofs.debug.on) { 29 | if (controls.gear.target === 0) { 30 | controls.gear.target = 1; 31 | log.update('Gear up'); 32 | } else { 33 | controls.gear.target = 0; 34 | log.update('Gear down'); 35 | } 36 | 37 | controls.setPartAnimationDelta(controls.gear); 38 | } 39 | }; 40 | 41 | // Tracks flaps up event to log 42 | controls.setters.setFlapsUp.set = function () { 43 | if (controls.flaps.target > 0) { 44 | controls.flaps.target--; 45 | 46 | if (geofs.aircraft.instance.setup.flapsPositions) { 47 | controls.flaps.positionTarget = geofs.aircraft.instance.setup.flapsPositions[controls.flaps.target]; 48 | log.update('Flaps raised to ' + controls.flaps.positionTarget); 49 | } else log.update('Flaps raised to ' + controls.flaps.target); 50 | 51 | controls.setPartAnimationDelta(controls.flaps); 52 | } 53 | }; 54 | 55 | // Tracks flaps down event to log 56 | controls.setters.setFlapsDown.set = function () { 57 | if (controls.flaps.target < geofs.aircraft.instance.setup.flapsSteps) { 58 | controls.flaps.target++; 59 | 60 | if (geofs.aircraft.instance.setup.flapsPositions) { 61 | controls.flaps.positionTarget = geofs.aircraft.instance.setup.flapsPositions[controls.flaps.target]; 62 | log.update('Flaps lowered to ' + controls.flaps.positionTarget); 63 | } else log.update('Flaps lowered to ' + controls.flaps.target); 64 | 65 | controls.setPartAnimationDelta(controls.flaps); 66 | } 67 | }; 68 | 69 | }); 70 | -------------------------------------------------------------------------------- /source/style/button.css: -------------------------------------------------------------------------------- 1 | button.fmc-btn, 2 | button.fmc-btn:hover, 3 | button.fmc-btn:active, 4 | button.fmc-btn:focus:not(:active) { 5 | color: white; 6 | background: green; 7 | } 8 | 9 | button.fmc-btn__fade { 10 | transition: opacity 0.2s ease-in-out; 11 | -moz-transition: opacity 0.2s ease-in-out; 12 | -webkit-transition: opacity 0.2s ease-in-out; 13 | } 14 | 15 | button.fmc-btn__fade:hover { 16 | opacity: 0.8; 17 | } 18 | -------------------------------------------------------------------------------- /source/style/dep-arr.css: -------------------------------------------------------------------------------- 1 | div.fmc-dep-arr-container { 2 | overflow: hidden; 3 | } 4 | 5 | div.fmc-dep-arr-container .fmc-dep-arr__input-label { 6 | margin-left: 50px; 7 | font-size: 16px; 8 | font-weight: bold; 9 | color: rgba(0, 0, 0, 0.26); 10 | cursor: default; 11 | } 12 | 13 | div.fmc-dep-arr-container td div { 14 | width: 140px; 15 | margin-left: 10px; 16 | position: relative; 17 | } 18 | 19 | div.fmc-dep-arr-container .mdl-textfield__input, 20 | div.fmc-dep-arr-container label { 21 | width: 137px; 22 | } 23 | 24 | div.fmc-auto-tod-container { 25 | position: relative; 26 | left: 28%; 27 | } 28 | 29 | div.fmc-auto-tod-container .mdl-switch { 30 | width: 280px; 31 | } 32 | 33 | div.fmc-auto-tod-container .mdl-switch__label { 34 | font-weight: bold; 35 | cursor: default !important; 36 | } 37 | -------------------------------------------------------------------------------- /source/style/externaldist.css: -------------------------------------------------------------------------------- 1 | div.fmc-prog-info.geofs-f-standard-ui { 2 | position: absolute; 3 | margin-left: 5px; 4 | margin-top: -2px; 5 | } 6 | 7 | div.fmc-prog-info.geofs-f-standard-ui span.mdl-chip.mdl-chip--contact { 8 | padding-right: 12px; 9 | } 10 | -------------------------------------------------------------------------------- /source/style/ils.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gefs-plugins/fmc-requirejs/9b369dc85b538815dc1b1abf0295f36382dbedef/source/style/ils.css -------------------------------------------------------------------------------- /source/style/legs.css: -------------------------------------------------------------------------------- 1 | div.fmc-legs-container { 2 | max-height: 340px; 3 | min-height: 70px; 4 | width: 665px; 5 | overflow: auto; 6 | font-family: monospace; 7 | } 8 | 9 | table.fmc-legs-data-table { 10 | margin-left: 60px; 11 | } 12 | 13 | table.fmc-legs-data-table tr.activated { 14 | color: rgb(83, 109, 254); 15 | } 16 | 17 | table.fmc-legs-data-table tr.activated .wpt-name { 18 | font-weight: bold; 19 | } 20 | 21 | table.fmc-legs-data-table th { 22 | text-align: left; 23 | cursor: default; 24 | } 25 | 26 | table.fmc-legs-data-table td { 27 | padding: 10px; 28 | } 29 | 30 | table.fmc-legs-data-table .brng-and-wpt { 31 | width: 100px; 32 | } 33 | 34 | table.fmc-legs-data-table .dist-and-info { 35 | width: 300px; 36 | } 37 | 38 | table.fmc-legs-data-table .altitude { 39 | width: 120px; 40 | } 41 | 42 | table.fmc-legs-data-table .brng-from-prev { 43 | height: 20px; 44 | font-size: 18px; 45 | margin-bottom: 4px; 46 | } 47 | 48 | table.fmc-legs-data-table .wpt-name { 49 | font-size: 30px; 50 | } 51 | 52 | table.fmc-legs-data-table .dist-from-prev { 53 | height: 20px; 54 | font-size: 18px; 55 | margin-bottom: 4px; 56 | } 57 | 58 | table.fmc-legs-data-table .wpt-info { 59 | height: 20px; 60 | font-size: 20px; 61 | } 62 | 63 | table.fmc-legs-data-table .alt-target { 64 | font-size: 20px; 65 | margin-top: 20px; 66 | } 67 | -------------------------------------------------------------------------------- /source/style/load.css: -------------------------------------------------------------------------------- 1 | div.fmc-load-container .mdl-textfield { 2 | width: 420px; 3 | overflow: hidden; 4 | } 5 | 6 | div.fmc-load-container .fmc-load-wpt__label { 7 | font-size: 16px; 8 | font-family: "Helvetica", "Arial", sans-serif; 9 | float: left; 10 | padding: 21px 10px; 11 | } 12 | 13 | div.fmc-load-container .fmc-load-wpt__label .material-icons { 14 | vertical-align: middle; 15 | } 16 | 17 | div.fmc-load-container button.load-wpt { 18 | margin-top: -60px; 19 | } 20 | 21 | div.fmc-load-container .fmc-generate-rte-container { 22 | margin-left: 10px; 23 | } 24 | 25 | div.fmc-load-container .fmc-generate-rte-container textarea { 26 | resize: none; 27 | font-family: monospace; 28 | } 29 | 30 | button.interactive.load-tab { 31 | float: right; 32 | } 33 | -------------------------------------------------------------------------------- /source/style/log.css: -------------------------------------------------------------------------------- 1 | div.fmc-log-container { 2 | max-height: 265px; 3 | overflow: auto; 4 | } 5 | 6 | div.fmc-log-container table { 7 | border: none; 8 | } 9 | 10 | div.fmc-log-container tr:hover { 11 | background-color: initial !important; 12 | } 13 | 14 | div.fmc-log-container th { 15 | text-align: left; 16 | } 17 | 18 | div.fmc-log-container td { 19 | text-align: left; 20 | border: none; 21 | padding: 0 18px; 22 | height: 22px; 23 | } 24 | 25 | div.fmc-log-container .log-data { 26 | height: 22px; 27 | } 28 | 29 | div.fmc-log-container .time-col, 30 | div.fmc-log-container .spd-col, 31 | div.fmc-log-container .hdg-col, 32 | div.fmc-log-container .alt-col { 33 | width: 75px; 34 | } 35 | 36 | div.fmc-log-container .lat-col, 37 | div.fmc-log-container .lon-col { 38 | width: 90px; 39 | } 40 | 41 | div.fmc-log-container .fps-col { 42 | width: 60px 43 | } 44 | 45 | div.fmc-log-container .oth-col { 46 | width: 130px; 47 | } 48 | -------------------------------------------------------------------------------- /source/style/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'minify!./button.css', 'minify!./externaldist.css', 'minify!./modal.css', 5 | 'minify!./route.css', 'minify!./waypoints.css', 'minify!./dep-arr.css', 6 | 'minify!./legs.css', 'minify!./vnav.css', 'minify!./ils.css', 7 | 'minify!./progress.css', 'minify!./map.css', 'minify!./load.css', 'minify!./log.css' 8 | ], function ( 9 | button, externalDist, modal, route, waypoints, 10 | depArr, legs, vnav, ils, progress, map, load, log 11 | ) { 12 | return [ 13 | button, externalDist, modal, route, waypoints, 14 | depArr, legs, vnav, ils, progress, map, load, log 15 | ].join(''); 16 | }); 17 | -------------------------------------------------------------------------------- /source/style/map.css: -------------------------------------------------------------------------------- 1 | div.fmc-map-container { 2 | height: 405px; 3 | width: 700px; 4 | } 5 | -------------------------------------------------------------------------------- /source/style/modal.css: -------------------------------------------------------------------------------- 1 | /* modal.html */ 2 | a.fmc-btn__fade { 3 | transition: font-size 0.3s ease-in-out, 4 | font-weight 0.3s ease-in-out, 5 | color 0.3s ease-in-out; 6 | -moz-transition: font-size 0.3s ease-in-out, 7 | font-weight 0.3s ease-in-out, 8 | color 0.3s ease-in-out; 9 | -webkit-transition: font-size 0.3s ease-in-out, 10 | font-weight 0.3s ease-in-out, 11 | color 0.3s ease-in-out; 12 | } 13 | 14 | a.fmc-btn__fade:hover:not(.is-active) { 15 | font-weight: bold; 16 | color: black; 17 | } 18 | 19 | a.fmc-btn__fade.is-active { 20 | font-size: 15px; 21 | font-weight: bold; 22 | color: rgb(83, 109, 254) !important; 23 | } 24 | 25 | div.fmc-modal { 26 | display: none; 27 | width: 665px; 28 | padding: 14px 14px; 29 | border: none; 30 | border-radius: 7px; 31 | position: fixed; 32 | top: 10%; 33 | left: 0px; 34 | right: 0px; 35 | height: fit-content; 36 | height: -moz-fit-content; 37 | height: -webkit-fit-content; 38 | color: black; 39 | margin: auto; 40 | background: white; 41 | } 42 | 43 | div.fmc-modal.opened { 44 | display: block; 45 | } 46 | 47 | div.fmc-modal::backdrop { 48 | background: none; 49 | } 50 | 51 | div.fmc-modal .fmc-modal__close { 52 | height: 25px; 53 | margin: -13px 0; 54 | float: right; 55 | } 56 | 57 | div.fmc-modal h4 { 58 | text-align: center; 59 | margin-top: 10px !important; 60 | margin-bottom: 0px !important; 61 | } 62 | 63 | div.fmc-modal .fmc-modal__warning { 64 | height: 20px; 65 | text-align: center; 66 | color: #d50000; 67 | } 68 | 69 | div.fmc-modal .fmc-modal__no-shadow { 70 | box-shadow: none !important; 71 | background: white !important; 72 | min-height: inherit; 73 | height: inherit; 74 | position: static !important; /* Default MDL css was redefined */ 75 | } 76 | 77 | @media screen and (max-width: 1024px) { 78 | /* MDL's small screen hides modal header */ 79 | div.fmc-modal .fmc-modal__no-shadow { 80 | display: block !important; 81 | } 82 | } 83 | 84 | div.fmc-modal .fmc-modal__content main { 85 | padding-top: 0px !important; /* Default MDL css was redefined */ 86 | } 87 | 88 | div.fmc-modal__layout-container { 89 | position: relative; 90 | height: auto; 91 | margin-top: -2px; 92 | } 93 | 94 | div.fmc-modal__layout-container .mdl-layout__container { 95 | position: relative !important; 96 | } 97 | 98 | div.fmc-modal__header { 99 | height: 48px; 100 | } 101 | 102 | div.fmc-modal__header a { 103 | cursor: pointer; 104 | } 105 | 106 | div.fmc-modal__tab-bar { 107 | background: inherit !important; 108 | } 109 | 110 | div.fmc-modal__divider { 111 | height: 2px; 112 | margin-top: -2px; 113 | background: rgba(66, 66, 66, 0.2); 114 | } 115 | 116 | div.fmc-modal__content { 117 | padding-top: 15px; 118 | } 119 | 120 | div.fmc-modal__actions .close { 121 | display: none; /* TODO reposition */ 122 | } 123 | 124 | div.fmc-modal__actions .interactive { 125 | display: none; 126 | } 127 | 128 | div.fmc-modal__actions .interactive.is-active { 129 | display: inline-block; 130 | } 131 | -------------------------------------------------------------------------------- /source/style/progress.css: -------------------------------------------------------------------------------- 1 | div.fmc-prog-info { 2 | display: inline-block; 3 | } 4 | 5 | div.fmc-prog-info .material-icons { 6 | vertical-align: middle; 7 | } 8 | 9 | div.fmc-prog-container .fmc-prog-info { 10 | padding: 8px; 11 | } 12 | 13 | div.fmc-prog-container .fmc-prog-info.dest-info { 14 | margin: 0 70px; 15 | } 16 | 17 | div.fmc-prog-info.next-wpt-info { 18 | margin-left: 180px; 19 | } 20 | 21 | div.fmc-prog-info span.mdl-chip.mdl-chip--contact { 22 | padding: 0; 23 | height: auto; 24 | } 25 | 26 | div.fmc-prog-info .distance-info { 27 | height: 36px; 28 | line-height: 36px; 29 | font-size: 18px; 30 | text-align: center; 31 | width: 70px; 32 | } 33 | 34 | div.fmc-prog-info .mdl-chip__contact { 35 | font-size: 14px; 36 | height: 36px; 37 | line-height: 36px; 38 | width: auto; 39 | padding: 0 8px; 40 | } 41 | 42 | div.fmc-prog-info .time-info { 43 | background: tan; 44 | margin-left: 8px; 45 | margin-right: 0px; 46 | text-align: left; 47 | } 48 | 49 | div.fmc-prog-info .time-info div { 50 | line-height: 18px; 51 | font-size: 12px; 52 | width: 55px; 53 | } 54 | 55 | div.fmc-prog-info.next-wpt-info .time-info { 56 | width: 50px; 57 | text-align: center; 58 | } 59 | -------------------------------------------------------------------------------- /source/style/route.css: -------------------------------------------------------------------------------- 1 | div.fmc-dep-arr-table-container { 2 | margin-top: -10px; 3 | } 4 | 5 | div.fmc-dep-arr-table-container table { 6 | width: 100%; 7 | } 8 | 9 | div.fmc-dep-arr-table-container .material-icons { 10 | vertical-align: middle; 11 | margin-right: 5px; 12 | } 13 | 14 | div.fmc-dep-arr-table-container div { 15 | width: 80%; 16 | } 17 | 18 | div.fmc-wpt-add-container { 19 | float: right; 20 | } 21 | 22 | div.fmc-modal__actions button[action="add-wpt"] { 23 | min-width: 35px; 24 | width: 35px; height: 35px; 25 | float: right; 26 | } 27 | -------------------------------------------------------------------------------- /source/style/vnav.css: -------------------------------------------------------------------------------- 1 | div.fmc-vnav-toggle-container { 2 | margin-left: 60px; 3 | } 4 | 5 | div.fmc-vnav-toggle-container div:first-of-type{ 6 | float: left; 7 | padding: 15px 0 25px; 8 | } 9 | /* 10 | div.fmc-vnav-toggle-container label[for="vnav-toggle"] span { 11 | margin-left: -10px; 12 | }*/ 13 | 14 | div.fmc-vnav-toggle-container .mdl-switch__track { 15 | padding: 0 !important; 16 | } 17 | 18 | div.fmc-vnav-toggle-container .material-icons { 19 | vertical-align: bottom; 20 | margin-left: -15px; 21 | width: 25px; 22 | } 23 | 24 | div.fmc-vnav-toggle-container .mdl-textfield { 25 | margin: -5px 0 -30px; 26 | } 27 | 28 | div.fmc-vnav-toggle-container input { 29 | width: 133px; 30 | } 31 | 32 | div.fmc-vnav-toggle-container label { 33 | width: 133px; 34 | } 35 | 36 | div.fmc-vnav-toggle-container label[for="vnav-toggle"] { 37 | width: 110px; 38 | } 39 | 40 | div.fmc-vnav-toggle-container .mdl-textfield--floating-label { 41 | width: 140px; 42 | } 43 | 44 | div.fmc-spd-toggle-container { 45 | padding: 15px 0 25px; 46 | margin-left: 110px; 47 | width: 140px; 48 | } 49 | 50 | div.fmc-vnav-phase-container { 51 | position: relative; 52 | left: 35%; 53 | background: rgba(158, 158, 158, .2); 54 | margin-top: -10px; 55 | } 56 | 57 | div.fmc-vnav-phase-container span { 58 | font-family: "Roboto", "Helvetica", "Arial", sans-serif; 59 | font-size: 14px; 60 | font-weight: 500; 61 | text-transform: uppercase; 62 | margin: 0 10px; 63 | } 64 | 65 | div.fmc-vnav-phase-container .toggle-phase { 66 | background: rgb(83, 109, 254); 67 | color: white; 68 | } 69 | 70 | div.fmc-vnav-phase-container .toggle-phase:hover { 71 | background: rgb(83, 109, 254); 72 | } 73 | 74 | div.fmc-vnav-phase-container .toggle-phase:active { 75 | background: rgba(83, 109, 254, 0.4); 76 | } 77 | 78 | div.fmc-vnav-phase-container .lock-phase { 79 | min-width: 36px; 80 | width: 36px; 81 | } 82 | 83 | div.fmc-vnav-phase-container .lock-phase .material-icons { 84 | margin-left: -10px; 85 | } 86 | 87 | div.fmc-vnav-phase-container .lock-phase.locked { 88 | background: red; 89 | color: white; 90 | } 91 | 92 | div.fmc-vnav-phase-container .lock-phase.locked:hover { 93 | background: red; 94 | } 95 | 96 | div.fmc-vnav-phase-container .lock-phase.locked:active { 97 | background: rgba(255, 0, 0, 0.4); 98 | } 99 | -------------------------------------------------------------------------------- /source/style/waypoints.css: -------------------------------------------------------------------------------- 1 | div.fmc-wpt-list-container { 2 | padding-bottom: 9px; 3 | margin-top: -23px; 4 | max-height: 277px; 5 | overflow: auto; 6 | } 7 | 8 | div.fmc-wpt-list-container table { 9 | border: none; 10 | } 11 | 12 | div.fmc-wpt-list-container tr:hover { 13 | background-color: initial !important; 14 | } 15 | 16 | div.fmc-wpt-list-container th { 17 | text-align: left; 18 | cursor: default; 19 | } 20 | 21 | div.fmc-wpt-list-container td { 22 | border: none; 23 | } 24 | 25 | div.fmc-wpt-list-container .wpt-col { 26 | width: 12%; 27 | } 28 | 29 | div.fmc-wpt-list-container .lat-col { 30 | width: 11.8%; 31 | } 32 | 33 | div.fmc-wpt-list-container .lon-col { 34 | width: 12.4%; 35 | } 36 | 37 | div.fmc-wpt-list-container .alt-col { 38 | width: 3%; 39 | } 40 | 41 | div.fmc-wpt-list-container .actions-col { 42 | width: 10%; 43 | } 44 | 45 | tr.wpt-row td { 46 | padding-top: 0px !important; 47 | padding-bottom: 0px !important; 48 | } 49 | 50 | tr.wpt-row .mdl-textfield { 51 | width: initial; 52 | padding: 14px 0; 53 | } 54 | 55 | tr.wpt-row .mdl-textfield__label { 56 | top: 18px; 57 | } 58 | 59 | tr.wpt-row .mdl-textfield__label::after { 60 | bottom: 14px; 61 | } 62 | 63 | tr.wpt-row .fmc-wpt-info { 64 | color: rgb(83, 109, 254); 65 | position: absolute; 66 | top: -4px; 67 | font-size: 12px; 68 | } 69 | 70 | tr.wpt-row button { 71 | float: left; 72 | min-width: 22px !important; 73 | width: 22px !important; 74 | height: 22px !important; 75 | } 76 | 77 | button[action="activate-wpt"] .material-icons { 78 | color: blue; 79 | } 80 | -------------------------------------------------------------------------------- /source/ui/ViewModel.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define(['knockout', 'flight', 'get', 'log', 'waypoints', 'nav/progress'], function (ko, flight, get, log, waypoints, progress) { 4 | 5 | /** 6 | * ViewModel function for knockout bindings 7 | */ 8 | function ViewModel () { 9 | var self = this; 10 | 11 | /************************* 12 | * General Modal Actions * 13 | *************************/ 14 | var _opened = ko.observable(false); 15 | self.opened = ko.pureComputed({ 16 | read: _opened, 17 | write: function (boolean, _vm) { // jshint ignore:line 18 | _opened(boolean); 19 | } 20 | }); 21 | 22 | self.modalWarning = ko.observable(); 23 | log.warn = ko.pureComputed({ // Prints modal warning, disappears after 5 seconds 24 | read: self.modalWarning, 25 | write: function (warningText) { 26 | self.modalWarning(warningText); 27 | setTimeout(function () { self.modalWarning(undefined); }, 5000); 28 | } 29 | }); 30 | 31 | /*********** 32 | * RTE Tab * 33 | ***********/ 34 | self.departureAirport = flight.departure.airport; 35 | self.arrivalAirport = flight.arrival.airport; 36 | self.flightNumber = flight.number; 37 | self.route = waypoints.route; 38 | self.nextWaypoint = waypoints.nextWaypoint; 39 | self.saveWaypoints = waypoints.saveData; 40 | self.retrieveWaypoints = waypoints.loadFromSave; 41 | self.addWaypoint = waypoints.addWaypoint; 42 | self.activateWaypoint = waypoints.activateWaypoint; 43 | self.shiftWaypoint = waypoints.shiftWaypoint; 44 | self.removeWaypoint = waypoints.removeWaypoint; 45 | 46 | /*************** 47 | * DEP/ARR Tab * 48 | ***************/ 49 | self.fieldElev = flight.fieldElev; 50 | self.todDist = flight.todDist; 51 | self.todCalc = flight.todCalc; 52 | 53 | // List of departure runways based on departure airport and SID 54 | self.departureRwyList = ko.pureComputed(function () { 55 | if (self.SIDName()) 56 | return get.SID(self.departureAirport(), self.departureRwyName(), self.SIDName()).availableRunways; 57 | else return get.runway(self.departureAirport(), self.SIDName(), true); 58 | }); 59 | 60 | // Selected departure runway and name 61 | self.departureRunway = flight.departure.runway; 62 | self.departureRwyName = ko.pureComputed(function () { 63 | if (self.departureRunway()) return self.departureRunway().runway; 64 | else return undefined; 65 | }); 66 | 67 | // List of SIDs based on departure airport and runway 68 | self.SIDList = ko.pureComputed(function () { 69 | return get.SID(self.departureAirport(), self.departureRwyName()); 70 | }); 71 | 72 | // Selected SID name 73 | self.SID = flight.departure.SID; 74 | self.SIDName = ko.pureComputed(function () { 75 | if (self.SID()) return self.SID().name; 76 | else return undefined; 77 | }); 78 | 79 | // List of arrival runways based on arrival airport 80 | self.arrivalRwyList = ko.pureComputed(function () { 81 | return get.runway(self.arrivalAirport()); 82 | }); 83 | 84 | // Selected arrival runway and name 85 | self.arrivalRunway = flight.arrival.runway; 86 | self.arrivalRunwayName = ko.pureComputed(function () { 87 | if (self.arrivalRunway()) return self.arrivalRunway().runway; 88 | else return undefined; 89 | }); 90 | 91 | // List of STARs based on arrival airport and runway 92 | // FIXME: STARs do not necessarily need a runway at first 93 | self.STARs = ko.pureComputed(function () { 94 | return get.STAR(self.arrivalAirport(), self.arrivalRunwayName()); 95 | }); 96 | 97 | // Selected STAR name 98 | self.STAR = flight.arrival.STAR; 99 | self.STARName = ko.pureComputed(function () { 100 | if (self.STAR()) return self.STAR().name; 101 | else return undefined; 102 | }); 103 | 104 | /************ 105 | * VNAV Tab * 106 | ************/ 107 | self.vnavEnabled = flight.vnavEnabled; 108 | self.cruiseAlt = flight.cruiseAlt; 109 | self.spdControl = flight.spdControl; 110 | self.phase = flight.phase; 111 | self.phaseLocked = flight.phaseLocked; 112 | 113 | var phaseToText = ['climb', 'cruise', 'descent']; 114 | self.currentPhaseText = ko.pureComputed(function () { 115 | return phaseToText[flight.phase()]; 116 | }); 117 | 118 | self.nextPhase = function () { 119 | var phase = flight.phase(); 120 | 121 | flight.phase(phase === phaseToText.length - 1 ? 0 : phase + 1); 122 | }; 123 | 124 | /************ 125 | * PROG Tab * 126 | ************/ 127 | self.progInfo = progress.info; 128 | 129 | // LOAD tab 130 | self.loadRouteText = ko.observable(); 131 | self.loadRoute = function () { 132 | waypoints.toRoute(self.loadRouteText()); 133 | self.loadRouteText(undefined); 134 | }; 135 | 136 | var generatedRouteText = ko.observable(); 137 | self.generateRoute = ko.pureComputed({ 138 | read: generatedRouteText, 139 | write: function (isGenerate, _vm) { // jshint ignore:line 140 | var generatedRoute = isGenerate ? waypoints.toRouteString() : undefined; 141 | generatedRouteText(generatedRoute); 142 | } 143 | }); 144 | 145 | /*********** 146 | * LOG Tab * 147 | ***********/ 148 | self.logData = log.data; 149 | self.removeLogData = log.removeData; 150 | 151 | } 152 | 153 | /** 154 | * Handles CSS of MDL switch buttons 155 | */ 156 | ko.bindingHandlers.mdlSwitch = { 157 | update: function (element, _unused, bindings) { // jshint ignore:line 158 | // Listens for 'checked' binding 159 | var isChecked = bindings.get('checked'); 160 | if (isChecked) isChecked(); 161 | 162 | // Listens for 'disable' binding 163 | bindings.get('disable'); 164 | 165 | var materialSwitch = element.parentNode.MaterialSwitch; 166 | if (!materialSwitch) return; 167 | 168 | materialSwitch.checkDisabled(); 169 | materialSwitch.checkToggleState(); 170 | } 171 | }; 172 | 173 | /** 174 | * Handles CSS of MDL textfields 175 | */ 176 | ko.bindingHandlers.mdlTextfield = { 177 | update: function (element, _unused, bindings) { // jshint ignore:line 178 | // Listens for 'value' binding 179 | var hasValue = bindings.get('value'); 180 | if (hasValue) hasValue(); 181 | 182 | var materialTextfield = element.parentNode.MaterialTextfield; 183 | if (!materialTextfield) return; 184 | 185 | materialTextfield.checkDirty(); 186 | materialTextfield.checkDisabled(); 187 | materialTextfield.checkFocus(); 188 | materialTextfield.checkValidity(); 189 | } 190 | }; 191 | 192 | return ViewModel; 193 | }); 194 | -------------------------------------------------------------------------------- /source/ui/elements.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define({ 4 | modal: '.fmc-modal', 5 | container: { 6 | tabBar: '.fmc-modal .fmc-modal__tab-bar', 7 | modalContent: '.fmc-modal .fmc-modal__content main', 8 | uiBottomProgInfo: '.geofs-ui-bottom .fmc-prog-info' 9 | }, 10 | btn: { 11 | fmcBtn: 'button.fmc-btn', 12 | interactive: '.interactive' 13 | } 14 | }); 15 | -------------------------------------------------------------------------------- /source/ui/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | 'knockout', './ViewModel', './position', 'debug', 'log', 5 | 'waypoints', 'nav/progress', './elements', 'redefine' 6 | ], function (ko, ViewModel, positioningFMC, debug, log, waypoints, progress, E) { 7 | 8 | // If UI is properly placed, load FMC 9 | positioningFMC.then(loadFMC); 10 | 11 | // FMC actions init function 12 | function loadFMC () { 13 | var modal = E.modal, 14 | container = E.container, 15 | btn = E.btn; 16 | 17 | // Applies knockout bindings 18 | var vm = new ViewModel(); 19 | ko.applyBindings(vm, $(modal)[0]); 20 | ko.applyBindings(vm, $(btn.fmcBtn)[1]); 21 | ko.applyBindings(vm, $(container.uiBottomProgInfo)[0]); 22 | 23 | // Inits waypoint field 24 | // HACK: opens nav tab to make sure map imagery loads 25 | $('[data-toggle-panel=".geofs-map-list"]').click(); 26 | var timer = setInterval(function () { 27 | if (!ui.mapInstance) return; 28 | clearInterval(timer); 29 | 30 | $('[data-toggle-panel=".geofs-map-list"]').click(); 31 | waypoints.addWaypoint(); 32 | }, 250); 33 | 34 | /* ---- UI actions binding ---- */ 35 | 36 | // Modal actions: close on button click 37 | $(document).keydown(function (event) { // Sets escape button to close FMC 38 | if ((event.which === 27 || event.keyCode === 27) && $(this).is(':visible')) 39 | $(modal).removeClass('opened'); 40 | }); 41 | 42 | // IDEA Move to knockout? 43 | // Modal tab contents: toggle 44 | $(container.tabBar).on('click', 'a', function (event) { 45 | event.preventDefault(); 46 | var c = 'is-active'; 47 | var $this = $(this); 48 | var $that = $(container.tabBar).find('.' + c); 49 | var interactive = $this.attr('interactive'); 50 | 51 | // Interactive actions button 52 | $(btn.interactive).removeClass(c); 53 | if (interactive) $(interactive).addClass(c); 54 | 55 | $(container.modalContent).find($that.attr('to')).removeClass(c); 56 | $(container.modalContent).find($this.attr('to')).addClass(c); 57 | $that.removeClass(c); 58 | $this.addClass(c); 59 | }); 60 | 61 | /* ---- All Initializations ---- */ 62 | 63 | // Initializes all timers 64 | progress.timer = setInterval(function () { progress.update(); }, 5000); 65 | log.mainTimer = setInterval(function () { log.update(); }, 30000); 66 | log.speedTimer = setInterval(function () { log.speed(); }, 15000); 67 | } 68 | 69 | }); 70 | -------------------------------------------------------------------------------- /source/ui/position.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | define([ 4 | './elements', 'minify!html/button.html', 'minify!html/externaldist.html', 5 | 'minify!html/modal.html', 'html/tab-contents/main', 'style/main' 6 | ], function (E, button, externalDist, modal, tabContents, mainCSS) { 7 | 8 | return new Promise(function (resolve) { 9 | // Main FMC stylesheet 10 | $('