├── .gitignore ├── .project ├── LICENCE ├── README.md ├── build └── KEEPME ├── etc ├── README.md ├── colors5 └── html-colors.txt ├── src ├── LICENCE ├── _locales │ └── en │ │ └── messages.json ├── css │ ├── content.css │ ├── options-preview.css │ └── options.css ├── html │ ├── options.html │ ├── page_action.html │ └── popup.html ├── images │ ├── bullet.svg │ ├── icon-128.png │ ├── icon-16.png │ ├── icon-19.png │ ├── icon-48.png │ └── icon.svg ├── js │ ├── background.js │ ├── content.js │ ├── lib │ │ ├── jquery.min.js │ │ ├── spectrum.css │ │ └── spectrum.js │ ├── modules │ │ ├── common.js │ │ └── options-data.js │ ├── options.js │ └── page_action.js └── manifest.json └── webstore ├── description.txt ├── screenshot-640x400-1.png └── screenshot-640x400-2.png /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | .DS_Store 3 | *~ 4 | /build/*.zip 5 | *.pem 6 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | colorful-workflowy 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.wst.jsdt.core.jsNature 16 | 17 | 18 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Colourful tags for Workflowy 2 | 3 | This is a chrome extension that allows you to add colour to workfloy lists. 4 | You can do this by assigning a colour to each label. Actually you have more control, 5 | such as changing text colour or background colour and choosing whether to apply the 6 | colours to the tags or to the while task. 7 | 8 | The result is something like this: 9 | 10 | ![Screenshot](webstore/screenshot-640x400-1.png) 11 | 12 | ## Licence 13 | This application is open source software and is available under [GPL v3.0](http://spdx.org/licenses/GPL-3.0+) 14 | 15 | Please also look at the LICENCE file in the project route 16 | -------------------------------------------------------------------------------- /build/KEEPME: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/build/KEEPME -------------------------------------------------------------------------------- /etc/README.md: -------------------------------------------------------------------------------- 1 | # Notes 2 | 3 | ## Knowledge sources 4 | 5 | ### Extracting percieved brightness for colour 6 | 7 | [Excellent algorithm](http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx). In a nutshell: 8 | 9 | ``` 10 | function Brightness(R, G, B) 11 | { 12 | return (int)Math.Sqrt( 13 | R * R * .241 + 14 | G * G * .691 + 15 | B * B * .068); 16 | } 17 | ``` 18 | 19 | Pseudocode (or c# code): Brightness(backgroundColor) < 130 ? Colors.White : Colors.Black; 20 | 21 | 22 | 23 | You can use the following to extract an rgb: 24 | ``` 25 | function getRGB(jElm) { 26 | var res = []; 27 | jElm.css("backgroundColor") 28 | .replace(/\s*rgba?\((.*)\)/, "$1") 29 | .split(/\s*,\s*/) 30 | .forEach(function(i) { 31 | res.push(parseInt(i)); 32 | }); 33 | return res; 34 | } 35 | 36 | // jquery will return: 37 | // If there was no color set yet, in chrome: "rgba(r, g, b, a)" (actually "rgba(0, 0, 0, 0)") 38 | // If there is a color and it was set as hex: "rgb(r, g, b)" 39 | // Our function will return either [r, g, b, a] or [r, g, b]. All as integers 40 | 41 | 42 | ``` 43 | 44 | -------------------------------------------------------------------------------- /etc/colors5: -------------------------------------------------------------------------------- 1 | # cat colors4 | perl -ne 'chomp; print "\"$_\", ";' > colors5 2 | "yellow", "lightyellow", "lemonchiffon", "lightgoldenrodyellow", "papayawhip", "moccasin", "peachpuff", "palegoldenrod", "khaki", "darkkhaki", "gold", "none", "cornsilk", "blanchedalmond", "bisque", "navajowhite", "wheat", "burlywood", "tan", "rosybrown", "sandybrown", "goldenrod", "darkgoldenrod", "Peru", "chocolate", "saddlebrown", "sienna", "brown", "maroon", "lightgrey", "none", "darkolivegreen", "olive", "olivedrab", "yellowgreen", "limegreen", "lime", "lawngreen", "chartreuse", "greenyellow", "springgreen", "mediumspringgreen", "lightgreen", "palegreen", "darkseagreen", "mediumseagreen", "seagreen", "forestgreen", "green", "darkgreen", "none", "mediumaquamarine", "aqua", "cyan", "lightcyan", "paleturquoise", "aquamarine", "turquoise", "mediumturquoise", "darkturquoise", "lightseagreen", "cadetblue", "darkcyan", "teal", "lightgrey", "none", "lightsteelblue", "powderblue", "lightblue", "skyblue", "lightskyblue", "deepskyblue", "dodgerblue", "cornflowerblue", "steelblue", "royalblue", "blue", "mediumblue", "darkblue", "navy", "midnightblue", "none", "lavender", "thistle", "plum", "violet", "orchid", "fuchsia", "Magenta", "mediumorchid", "mediumpurple", "blueviolet", "darkviolet", "darkorchid", "darkmagenta", "purple", "indigo", "darkslateblue", "slateblue", "mediumslateblue", "lightgrey", "none", "white", "snow", "honeydew", "mintcream", "azure", "aliceblue", "ghostwhite", "whitesmoke", "seashell", "beige", "oldlace", "floralwhite", "ivory", "antiquewhite", "linen", "lavenderblush", "mistyrose", "none", "gainsboro", "lightgrey", "silver", "darkgray", "gray", "dimgray", "lightslategray", "slategray", "darkslategray", "black", -------------------------------------------------------------------------------- /etc/html-colors.txt: -------------------------------------------------------------------------------- 1 | yellow 2 | lightyellow 3 | lemonchiffon 4 | lightgoldenrodyellow 5 | papayawhip 6 | moccasin 7 | peachpuff 8 | palegoldenrod 9 | khaki 10 | darkkhaki 11 | gold 12 | none 13 | cornsilk 14 | blanchedalmond 15 | bisque 16 | navajowhite 17 | wheat 18 | burlywood 19 | tan 20 | rosybrown 21 | sandybrown 22 | goldenrod 23 | darkgoldenrod 24 | Peru 25 | chocolate 26 | saddlebrown 27 | sienna 28 | brown 29 | maroon 30 | lightgrey 31 | none 32 | darkolivegreen 33 | olive 34 | olivedrab 35 | yellowgreen 36 | limegreen 37 | lime 38 | lawngreen 39 | chartreuse 40 | greenyellow 41 | springgreen 42 | mediumspringgreen 43 | lightgreen 44 | palegreen 45 | darkseagreen 46 | mediumseagreen 47 | seagreen 48 | forestgreen 49 | green 50 | darkgreen 51 | none 52 | mediumaquamarine 53 | aqua 54 | cyan 55 | lightcyan 56 | paleturquoise 57 | aquamarine 58 | turquoise 59 | mediumturquoise 60 | darkturquoise 61 | lightseagreen 62 | cadetblue 63 | darkcyan 64 | teal 65 | lightgrey 66 | none 67 | lightsteelblue 68 | powderblue 69 | lightblue 70 | skyblue 71 | lightskyblue 72 | deepskyblue 73 | dodgerblue 74 | cornflowerblue 75 | steelblue 76 | royalblue 77 | blue 78 | mediumblue 79 | darkblue 80 | navy 81 | midnightblue 82 | none 83 | lavender 84 | thistle 85 | plum 86 | violet 87 | orchid 88 | fuchsia 89 | Magenta 90 | mediumorchid 91 | mediumpurple 92 | blueviolet 93 | darkviolet 94 | darkorchid 95 | darkmagenta 96 | purple 97 | indigo 98 | darkslateblue 99 | slateblue 100 | mediumslateblue 101 | lightgrey 102 | none 103 | white 104 | snow 105 | honeydew 106 | mintcream 107 | azure 108 | aliceblue 109 | ghostwhite 110 | whitesmoke 111 | seashell 112 | beige 113 | oldlace 114 | floralwhite 115 | ivory 116 | antiquewhite 117 | linen 118 | lavenderblush 119 | mistyrose 120 | none 121 | gainsboro 122 | lightgrey 123 | silver 124 | darkgray 125 | gray 126 | dimgray 127 | lightslategray 128 | slategray 129 | darkslategray 130 | black 131 | -------------------------------------------------------------------------------- /src/LICENCE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /src/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "l10nTabName": { 3 | "message":"Localization" 4 | ,"description":"name of the localization tab" 5 | } 6 | ,"l10nHeader": { 7 | "message":"It does localization too! (this whole tab is, actually)" 8 | ,"description":"Header text for the localization section" 9 | } 10 | ,"l10nIntro": { 11 | "message":"'L10n' refers to 'Localization' - 'L' an 'n' are obvious, and 10 comes from the number of letters between those two. It is the process/whatever of displaying something in the language of choice. It uses 'I18n', 'Internationalization', which refers to the tools / framework supporting L10n. I.e., something is internationalized if it has I18n support, and can be localized. Something is localized for you if it is in your language / dialect." 12 | ,"description":"introduce the basic idea." 13 | } 14 | ,"l10nProd": { 15 | "message":"You are planning to allow localization, right? You have no idea who will be using your extension! You have no idea who will be translating it! At least support the basics, it's not hard, and having the framework in place will let you transition much more easily later on." 16 | ,"description":"drive the point home. It's good for you." 17 | } 18 | ,"l10nFirstParagraph": { 19 | "message":"When the options page loads, elements decorated with data-l10n will automatically be localized!" 20 | ,"description":"inform that elements will be localized on load" 21 | } 22 | ,"l10nSecondParagraph": { 23 | "message":"If you need more complex localization, you can also define data-l10n-args. This should contain $containerType$ filled with $dataType$, which will be passed into Chrome's i18n API as $functionArgs$. In fact, this paragraph does just that, and wraps the args in mono-space font. Easy!" 24 | ,"description":"introduce the data-l10n-args attribute. End on a lame note." 25 | ,"placeholders": { 26 | "containerType": { 27 | "content":"$1" 28 | ,"example":"'array', 'list', or something similar" 29 | ,"description":"type of the args container" 30 | } 31 | ,"dataType": { 32 | "content":"$2" 33 | ,"example":"string" 34 | ,"description":"type of data in each array index" 35 | } 36 | ,"functionArgs": { 37 | "content":"$3" 38 | ,"example":"arguments" 39 | ,"description":"whatever you call what you pass into a function/method. args, params, etc." 40 | } 41 | } 42 | } 43 | ,"l10nThirdParagraph": { 44 | "message":"Message contents are passed right into innerHTML without processing - include any tags (or even scripts) that you feel like. If you have an input field, the placeholder will be set instead, and buttons will have the value attribute set." 45 | ,"description":"inform that we handle placeholders, buttons, and direct HTML input" 46 | } 47 | ,"l10nButtonsBefore": { 48 | "message":"Different types of buttons are handled as well. <button> elements have their html set:" 49 | } 50 | ,"l10nButton": { 51 | "message":"in a button" 52 | } 53 | ,"l10nButtonsBetween": { 54 | "message":"while <input type='submit'> and <input type='button'> get their 'value' set (note: no HTML):" 55 | } 56 | ,"l10nSubmit": { 57 | "message":"a submit value" 58 | } 59 | ,"l10nButtonsAfter": { 60 | "message":"Awesome, no?" 61 | } 62 | ,"l10nExtras": { 63 | "message":"You can even set data-l10n on things like the <title> tag, which lets you have translatable page titles, or fieldset <legend> tags, or anywhere else - the default Boil.localize() behavior will check every tag in the document, not just the body." 64 | ,"description":"inform about places which may not be obvious, like , etc" 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/css/content.css: -------------------------------------------------------------------------------- 1 | /* This will correct the foreground when matching tags */ 2 | .contentMatch { 3 | color: gray; 4 | } -------------------------------------------------------------------------------- /src/css/options-preview.css: -------------------------------------------------------------------------------- 1 | /** For workflow preview */ 2 | 3 | .project { 4 | position: relative; 5 | font-family: 'Helvetica Neue', Arial, sans-serif; 6 | } 7 | 8 | .name { 9 | padding-left: 28px; 10 | } 11 | 12 | .bullet { 13 | display: inline-block; 14 | margin-top: 5px; 15 | background-image: url(../images/bullet.svg); 16 | position: absolute; 17 | left: 0px; 18 | z-index: 6; 19 | margin-left: 1px; 20 | height: 18px; 21 | width: 18px; 22 | } 23 | 24 | .content { 25 | padding: 4px 0; 26 | line-height: 20px; 27 | min-height: 20px; 28 | position: relative; 29 | display: block; 30 | letter-spacing: inherit; 31 | text-decoration: none; 32 | } 33 | 34 | .content .contentTag { 35 | color: #999; 36 | padding: 0 1px; 37 | margin: 0 -1px; 38 | border-radius: 3px; 39 | } 40 | 41 | .contentTagText { 42 | text-decoration: underline; 43 | } 44 | -------------------------------------------------------------------------------- /src/css/options.css: -------------------------------------------------------------------------------- 1 | html { 2 | min-width: 660px; 3 | min-height: 400px; 4 | } 5 | 6 | body { 7 | font-size: 16px; 8 | font-family: helvetica, arial, sans-serif; 9 | line-height: 1.2em; 10 | } 11 | 12 | h1 { 13 | font-size: 2em; 14 | } 15 | 16 | /* 17 | #debug { 18 | float: right; 19 | width: 360px; 20 | height: 500px; 21 | padding: 10px; 22 | display:none; 23 | } 24 | 25 | #debugbox { 26 | width: 100%; 27 | height: 400px; 28 | font-family: monospace; 29 | } 30 | 31 | 32 | #bottom { 33 | text-align: right; 34 | } 35 | 36 | */ 37 | 38 | #options { 39 | font-size: 0.875em; 40 | min-width: 50em; 41 | max-width: 60em; 42 | padding: 0px .7em; 43 | } 44 | 45 | .pageactions { 46 | margin: 0 .5em; 47 | height: 2.5em; 48 | } 49 | 50 | .pageactions .actionleft { 51 | float: left; 52 | } 53 | 54 | .pageactions .actionright { 55 | float: right; 56 | } 57 | 58 | .note { 59 | font-size: .8em; 60 | font-style: italic; 61 | } 62 | 63 | .setting { 64 | margin-top: -2px; 65 | border-radius: .5em; 66 | border: 2px solid #eee; 67 | } 68 | 69 | .preview-outer { 70 | padding: .3em .3em; 71 | margin: 0; 72 | } 73 | 74 | .preview-title { 75 | float: left; 76 | padding: .3em; 77 | width: 18em; 78 | } 79 | 80 | .preview-title .buttonbox { 81 | display: inline; 82 | border-right: thin solid #ddd; 83 | margin-right: .3em; 84 | } 85 | .preview-title input[type=text] { 86 | margin-left: .3em; 87 | width: 12em; 88 | } 89 | 90 | .preview { 91 | margin-left: 18em; 92 | padding: 0px .3em; 93 | } 94 | 95 | .board { 96 | padding: .5em; 97 | line-height: 2em; 98 | border-top: thin solid #eee; 99 | } 100 | 101 | .board input[type=checkbox] { 102 | margin-right: 10px; 103 | vertical-align: text-top; 104 | } 105 | .board span.opttitle { 106 | color: gray; 107 | font-weight: bold; 108 | } 109 | 110 | .board .tagopts { 111 | float: left; 112 | width: 48%; 113 | } 114 | 115 | .board .textopts { 116 | float: right; 117 | width: 48%; 118 | } 119 | 120 | .board .optbody { 121 | position: relative; 122 | } 123 | 124 | .board .optbody label { 125 | display: inline-block; 126 | width: 7em; 127 | } 128 | 129 | .board .colorbox { 130 | width: 10em; 131 | } 132 | 133 | /* Override spectrum size */ 134 | .sp-preview { 135 | height: 12px; 136 | width: 2.5em; 137 | } 138 | 139 | .sp-dd { 140 | padding: 0; 141 | height: 10px; 142 | } 143 | -------------------------------------------------------------------------------- /src/html/options.html: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <!-- 3 | /** 4 | * 5 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 6 | * 7 | * This file is part of some open source application. 8 | * 9 | * Both the file and the application are Licensed under 10 | * GNU General Public License 3.0 or later. Some rights reserved. 11 | * 12 | * See LICENCE file 13 | * 14 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 15 | */ 16 | --> 17 | <html> 18 | <head> 19 | <link rel="stylesheet" href="../js/lib/spectrum.css"/> 20 | <link rel="stylesheet" href="../css/options.css"/> 21 | <link rel="stylesheet" href="../css/options-preview.css"/> 22 | <script type="text/javascript" src="../js/lib/jquery.min.js"></script> 23 | <script type="text/javascript" src="../js/lib/spectrum.js"></script> 24 | <script type="text/javascript" src="../js/modules/common.js"></script> 25 | <script type="text/javascript" src="../js/modules/options-data.js"></script> 26 | <script type="text/javascript" src="../js/options.js"></script> 27 | </head> 28 | <body> 29 | <!-- 30 | <div id="debug"> 31 | <p> 32 | <label for="debugbox">Please create your own color map below</label> 33 | <textarea id="debugbox" name="debugbox" wrap="off"></textarea> 34 | </p> 35 | </div> 36 | --> 37 | <div id="options"> 38 | <h1>Tag colors for Workflowy</h1> 39 | <p> 40 | <label for="enabled">Extension enabled (requires reload of workflowy.com)</label> 41 | <input type="checkbox" id="enabled" name="enabled"/> 42 | </p> 43 | 44 | <div class="pageactions"> 45 | <div class="actionleft"> 46 | <input type="button" name="addrule" class="addrule" value="Add new Rule"/> 47 | </div> 48 | <div class="actionright"> 49 | <input type="button" name="defaults" class="defaults" value="Defaults"/> 50 | <input type="button" name="loadsaved" class="loadsaved" value="Restore saved"/> 51 | <input type="button" name="save" class="save" value="Save"/> 52 | </div> 53 | </div> 54 | 55 | <div class="setting" style="display: none;"> 56 | <div class="preview-outer"> 57 | <div class="preview-title"> 58 | <div class="buttonbox"> 59 | <input type="button" class="edit" id="edit" value="E"/> 60 | <input type="button" class="delete" id="delete" value="D"/> 61 | </div> 62 | 63 | <!-- All form fields should start with o --> 64 | #<input type="text" class="oname" value="#urgent"/> 65 | <input type="hidden" class="otag sfield"> 66 | <input type="hidden" class="otagfg sfield"> 67 | <input type="hidden" class="otagbg sfield"> 68 | <input type="hidden" class="otagnu sfield"> 69 | <input type="hidden" class="otext sfield"> 70 | <input type="hidden" class="otextfg sfield"> 71 | <input type="hidden" class="otextbg sfield"> 72 | </div> 73 | <div class="preview"> 74 | <div class="project task"> 75 | <div class="highlight"></div> 76 | <div class="name "> 77 | <span class="bullet"></span> 78 | <div class="content"> 79 | <span class="contentTag">#<span class="contentTagText">urgent</span></span> <span class="contentText">Lorem ipsum</span> 80 | </div> 81 | </div> 82 | </div> 83 | </div> 84 | </div> 85 | </div> 86 | <!-- 87 | <select id="coloroptfg" class="colormenu" size="10"></select> 88 | <select id="coloroptbg" class="colormenu" size="10"></select> 89 | --> 90 | <div class="board" style="display:none"> 91 | <div class="tagopts"> 92 | <!-- 93 | <div class="opttitle"> 94 | Tag (empty for auto *) 95 | </div> 96 | --> 97 | <div class="optbody"> 98 | <div class="coloropt"><label for="etagfg"><span class="opttitle">Tag </span>color:</label><input type="text" id="etagfg" name="etagfg" class="colorbox"/> <input type="text" id="btagfg" value=""/></div> 99 | <div class="highlightopt"><label for="etagbg">Background:</label><input type="text" id="etagbg" name="etagbg" class="colorbox" /> <input type="text" id="btagbg" value=""/></div> 100 | <div style="display: none;" class="underlineopt"><label for="etagnu">No underline: </label><input type="checkbox" id="etagnu" name="etagnu" /></div> 101 | </div> 102 | </div> 103 | <div class="textopts"> 104 | <!-- 105 | <div class="opttitle"> 106 | Text (empty for auto *) 107 | </div> 108 | --> 109 | <div class="optbody"> 110 | <div class="coloropt"><label for="etextfg"><span class="opttitle">Text </span>color:</label><input type="text" id="etextfg" name="etextfg" class="colorbox" /> <input type="text" id="btextfg" value=""/></div> 111 | <div class="highlightopt"><label for="etextfg">Highlight:</label><input type="text" id="etextbg" name="etextbg" class="colorbox" /> <input type="text" id="btextbg" value=""/></div> 112 | <div style="display: none;" class="note">* Auto means default, except when he highlight is dark.</div> 113 | </div> 114 | </div> 115 | <div style="clear: left"></div> 116 | </div> 117 | 118 | </div> 119 | </body> 120 | </html> 121 | -------------------------------------------------------------------------------- /src/html/page_action.html: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <!-- 3 | /** 4 | * 5 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 6 | * 7 | * This file is part of some open source application. 8 | * 9 | * Both the file and the application are Licensed under 10 | * GNU General Public License 3.0 or later. Some rights reserved. 11 | * 12 | * See LICENCE file 13 | * 14 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 15 | */ 16 | --> 17 | <style type="text/css"> 18 | #mainPopup { 19 | padding: 10px; 20 | height: 200px; 21 | width: 400px; 22 | font-family: Helvetica, Ubuntu, Arial, sans-serif; 23 | } 24 | h1 { 25 | font-size: 2em; 26 | } 27 | </style> 28 | 29 | <div id="mainPopup"> 30 | <h1>Hello extensionizr!</h1> 31 | <p>To shut this popup down, edit the manifest file and remove the "default popup" key. To edit it, just edit ext/page_action/page_action.html. The CSS is there, too.</p> 32 | </div> -------------------------------------------------------------------------------- /src/html/popup.html: -------------------------------------------------------------------------------- 1 | <!doctype html> 2 | <!-- 3 | /** 4 | * 5 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 6 | * 7 | * This file is part of some open source application. 8 | * 9 | * Both the file and the application are Licensed under 10 | * GNU General Public License 3.0 or later. Some rights reserved. 11 | * 12 | * See LICENCE file 13 | * 14 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 15 | */ 16 | --> 17 | <script type="text/javascript" src="../js/modules/common.js"></script> 18 | <script type="text/javascript" src="../js/options.js"></script> 19 | <style type="text/css"> 20 | #options { 21 | width:480px; 22 | padding: 0px 10px; 23 | font-family: Helvetica, Ubuntu, Arial, sans-serif; 24 | } 25 | 26 | h1 { 27 | font-size: 2em; 28 | } 29 | 30 | #raw-colors { 31 | width: 100%; 32 | height: 256px; 33 | font-family: monospace; 34 | } 35 | #bottom { 36 | text-align: right; 37 | } 38 | </style> 39 | 40 | <div id="options"> 41 | <h1>Label colors for Workflowy</h1> 42 | <p> 43 | <label for="enabled">Extension is enabled</label> 44 | <input type="checkbox" id="enabled" name="enabled"/> 45 | </p> 46 | <p> 47 | <label for="raw-colors">Please create your own color map below</label> 48 | <textarea id="raw-colors" name="raw-colors" wrap="off"></textarea> 49 | </p> 50 | <p id="bottom"> 51 | <input type="button" name="restore" id="restore" value="Restore Defaults"/> 52 | <input type="button" name="cancel" id="cancel" value="Reload saved"/> 53 | <input type="button" name="validate" id="validate" value="Check syntax"/> 54 | <input type="button" name="save" id="save" value="Save"/> 55 | </p> 56 | </div> 57 | -------------------------------------------------------------------------------- /src/images/bullet.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0"?> 2 | <svg viewBox="0 0 100 100" version="1.1" 3 | xmlns="http://www.w3.org/2000/svg"> 4 | <circle cx="50" cy="50" r="19" style="fill: #666;"/> 5 | </svg> 6 | -------------------------------------------------------------------------------- /src/images/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/src/images/icon-128.png -------------------------------------------------------------------------------- /src/images/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/src/images/icon-16.png -------------------------------------------------------------------------------- /src/images/icon-19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/src/images/icon-19.png -------------------------------------------------------------------------------- /src/images/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/src/images/icon-48.png -------------------------------------------------------------------------------- /src/images/icon.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> 3 | 4 | <svg 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" 6 | xmlns:cc="http://creativecommons.org/ns#" 7 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 8 | xmlns:svg="http://www.w3.org/2000/svg" 9 | xmlns="http://www.w3.org/2000/svg" 10 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 11 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" 12 | width="744.09448819" 13 | height="1052.3622047" 14 | id="svg2" 15 | version="1.1" 16 | inkscape:version="0.48.4 r9939" 17 | sodipodi:docname="icon.svg"> 18 | <defs 19 | id="defs4" /> 20 | <sodipodi:namedview 21 | id="base" 22 | pagecolor="#ffffff" 23 | bordercolor="#666666" 24 | borderopacity="1.0" 25 | inkscape:pageopacity="0.0" 26 | inkscape:pageshadow="2" 27 | inkscape:zoom="1.4" 28 | inkscape:cx="320.13077" 29 | inkscape:cy="611.8619" 30 | inkscape:document-units="px" 31 | inkscape:current-layer="layer1" 32 | showgrid="false" 33 | inkscape:window-width="1495" 34 | inkscape:window-height="977" 35 | inkscape:window-x="150" 36 | inkscape:window-y="80" 37 | inkscape:window-maximized="0" /> 38 | <metadata 39 | id="metadata7"> 40 | <rdf:RDF> 41 | <cc:Work 42 | rdf:about=""> 43 | <dc:format>image/svg+xml</dc:format> 44 | <dc:type 45 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 46 | <dc:title></dc:title> 47 | </cc:Work> 48 | </rdf:RDF> 49 | </metadata> 50 | <g 51 | inkscape:label="Layer 1" 52 | inkscape:groupmode="layer" 53 | id="layer1"> 54 | <rect 55 | style="fill:#fafdff;fill-opacity:1;stroke:#000000;stroke-width:2.14533114;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" 56 | id="rect3761" 57 | width="259.85471" 58 | height="259.85474" 59 | x="230.07262" 60 | y="233.86339" 61 | ry="18.561049" 62 | rx="21.380445" 63 | inkscape:export-filename="G:\devel\tmp\workflowy-color-labels\src\images\icon-128.png" 64 | inkscape:export-xdpi="43.970001" 65 | inkscape:export-ydpi="43.970001" /> 66 | <g 67 | id="g3821" 68 | transform="translate(6,0)"> 69 | <rect 70 | ry="0" 71 | rx="0" 72 | y="270.54471" 73 | x="276.57126" 74 | height="32.324883" 75 | width="66.670067" 76 | id="rect3763" 77 | style="fill:#df0000;fill-opacity:0.76190479;stroke:none" /> 78 | <text 79 | sodipodi:linespacing="125%" 80 | id="text3767" 81 | y="300.8493" 82 | x="357.38348" 83 | style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" 84 | xml:space="preserve"><tspan 85 | y="300.8493" 86 | x="357.38348" 87 | id="tspan3769" 88 | sodipodi:role="line">Abcd</tspan></text> 89 | </g> 90 | <g 91 | id="g3826" 92 | transform="translate(44,0)"> 93 | <rect 94 | ry="0" 95 | rx="0" 96 | y="324.41949" 97 | x="276.57126" 98 | height="32.324883" 99 | width="66.670067" 100 | id="rect3763-1" 101 | style="fill:#008000;fill-opacity:0.76190479;stroke:none" /> 102 | <text 103 | sodipodi:linespacing="125%" 104 | id="text3767-7" 105 | y="354.72409" 106 | x="357.38348" 107 | style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" 108 | xml:space="preserve"><tspan 109 | y="354.72409" 110 | x="357.38348" 111 | id="tspan3769-4" 112 | sodipodi:role="line">Abc</tspan></text> 113 | </g> 114 | <g 115 | id="g3831" 116 | transform="translate(44,0)"> 117 | <rect 118 | ry="0" 119 | rx="0" 120 | y="378.29431" 121 | x="276.57126" 122 | height="32.324883" 123 | width="66.670067" 124 | id="rect3763-0" 125 | style="fill:#0068b4;fill-opacity:0.32163744;stroke:none" /> 126 | <text 127 | sodipodi:linespacing="125%" 128 | id="text3767-9" 129 | y="408.59891" 130 | x="357.38348" 131 | style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#00cebc;fill-opacity:1;stroke:none;font-family:Sans" 132 | xml:space="preserve"><tspan 133 | y="408.59891" 134 | x="357.38348" 135 | id="tspan3769-48" 136 | sodipodi:role="line">Abc</tspan></text> 137 | </g> 138 | <g 139 | id="g3836" 140 | transform="translate(6,0)"> 141 | <rect 142 | ry="0" 143 | rx="0" 144 | y="429.31198" 145 | x="276.57126" 146 | height="39.467739" 147 | width="179.52721" 148 | id="rect3763-8" 149 | style="fill:#f3ff00;fill-opacity:0.76190479;stroke:none" /> 150 | <text 151 | sodipodi:linespacing="125%" 152 | id="text3767-2" 153 | y="462.47372" 154 | x="357.38348" 155 | style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" 156 | xml:space="preserve"><tspan 157 | y="462.47372" 158 | x="357.38348" 159 | id="tspan3769-45" 160 | sodipodi:role="line">Abcd</tspan></text> 161 | <text 162 | sodipodi:linespacing="125%" 163 | id="text3817" 164 | y="463.07648" 165 | x="284.42856" 166 | style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0.51851849;stroke:none;font-family:Sans" 167 | xml:space="preserve"><tspan 168 | y="463.07648" 169 | x="284.42856" 170 | id="tspan3819" 171 | sodipodi:role="line">tag</tspan></text> 172 | </g> 173 | <path 174 | sodipodi:type="arc" 175 | style="fill:#000000;fill-opacity:0.83597885;stroke:none" 176 | id="path3843" 177 | sodipodi:cx="183.57143" 178 | sodipodi:cy="297.36218" 179 | sodipodi:rx="10.714286" 180 | sodipodi:ry="10.714286" 181 | d="m 194.28571,297.36218 a 10.714286,10.714286 0 1 1 -21.42857,0 10.714286,10.714286 0 1 1 21.42857,0 z" 182 | transform="translate(74.57143,-12)" /> 183 | <path 184 | sodipodi:type="arc" 185 | style="fill:#000000;fill-opacity:0.83597885;stroke:none" 186 | id="path3843-5" 187 | sodipodi:cx="183.57143" 188 | sodipodi:cy="297.36218" 189 | sodipodi:rx="10.714286" 190 | sodipodi:ry="10.714286" 191 | d="m 194.28571,297.36218 a 10.714286,10.714286 0 1 1 -21.42857,0 10.714286,10.714286 0 1 1 21.42857,0 z" 192 | transform="translate(116.57143,42.142856)" /> 193 | <path 194 | sodipodi:type="arc" 195 | style="fill:#000000;fill-opacity:0.83597885;stroke:none" 196 | id="path3843-1" 197 | sodipodi:cx="183.57143" 198 | sodipodi:cy="297.36218" 199 | sodipodi:rx="10.714286" 200 | sodipodi:ry="10.714286" 201 | d="m 194.28571,297.36218 a 10.714286,10.714286 0 1 1 -21.42857,0 10.714286,10.714286 0 1 1 21.42857,0 z" 202 | transform="translate(116.57143,96.428573)" /> 203 | <path 204 | sodipodi:type="arc" 205 | style="fill:#000000;fill-opacity:0.83597885;stroke:none" 206 | id="path3843-7" 207 | sodipodi:cx="183.57143" 208 | sodipodi:cy="297.36218" 209 | sodipodi:rx="10.714286" 210 | sodipodi:ry="10.714286" 211 | d="m 194.28571,297.36218 a 10.714286,10.714286 0 1 1 -21.42857,0 10.714286,10.714286 0 1 1 21.42857,0 z" 212 | transform="translate(78.57143,150.71429)" /> 213 | </g> 214 | </svg> 215 | -------------------------------------------------------------------------------- /src/js/background.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 4 | * 5 | * This file is part of some open source application. 6 | * 7 | * Both the file and the application are Licensed under 8 | * GNU General Public License 3.0 or later. Some rights reserved. 9 | * 10 | * See LICENCE file 11 | * 12 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 13 | */ 14 | 15 | 16 | // When the extension is installed or upgraded ... 17 | chrome.runtime.onInstalled.addListener(function() { 18 | 19 | // Replace all rules ... 20 | chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { 21 | // With a new rule ... 22 | chrome.declarativeContent.onPageChanged.addRules([ 23 | { 24 | // That fires when a page's URL contains a 'g' ... 25 | conditions: [ 26 | new chrome.declarativeContent.PageStateMatcher({ 27 | pageUrl: { urlContains: 'workflowy.com' }, 28 | }) 29 | ], 30 | // And shows the extension's page action. 31 | actions: [ new chrome.declarativeContent.ShowPageAction() ] 32 | } 33 | ]); 34 | }); 35 | }); 36 | 37 | -------------------------------------------------------------------------------- /src/js/content.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 4 | * 5 | * This file is part of some open source application. 6 | * 7 | * Both the file and the application are Licensed under 8 | * GNU General Public License 3.0 or later. Some rights reserved. 9 | * 10 | * See LICENCE file 11 | * 12 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 13 | */ 14 | 15 | /** 16 | * I prefer this mode 17 | */ 18 | jQuery.noConflict(); 19 | 20 | /** 21 | * Records the previous enabled state 22 | */ 23 | var prevEnabled = false; 24 | 25 | /** 26 | * We use this to mark dom objects that we should be clearing 27 | */ 28 | var marker = "wfcl"; 29 | 30 | /** 31 | * Colors all tags that are under $root 32 | */ 33 | function colorizeTree($root) { 34 | jQuery(".contentTagText", $root).each(function (i) { 35 | $elm = jQuery(this); 36 | var tag = $elm.text(); 37 | var $elmToColor; 38 | 39 | var cssReset = { 'color': '', 'background-color': '' }; 40 | 41 | var opt = labelMap.labels[tag]; 42 | 43 | if (opt) { 44 | var css = jQuery.extend({}, cssReset); 45 | if (opt.tagfg) 46 | css['color'] = opt.tagfg; 47 | if (opt.tagbg) 48 | css['background-color'] = opt.tagbg; 49 | $elm.parent().css(css).addClass(marker); 50 | //$elm.parent().css('text-decoration', fields.otagnu.val() == 'true' ? 'none' : 'underline'); 51 | 52 | // If we run it on empty background settings, 53 | // and the first tag sets the background, 54 | // if a second tag is present, it will reset it 55 | if (opt.textfg || opt.textbg) { 56 | css = jQuery.extend({}, cssReset); 57 | if (opt.textfg) 58 | css['color'] = opt.textfg; 59 | if (opt.textbg) { 60 | css['background-color'] = opt.textbg; 61 | css['border-radius'] = '6px'; 62 | } 63 | else { 64 | css['border-radius'] = ''; 65 | } 66 | $elm.parent().parent().css(css).addClass(marker); 67 | } 68 | } 69 | else { 70 | // If the user just renamed a tag to something we don't colour 71 | // workflowy will recreate the nodes, loosing colour info, so no action required 72 | // however, this is not the case for coloring 'text', so we need to check 73 | if ($elm.parent().parent().hasClass(marker)) 74 | $elm.parent().parent().css(cssReset).removeClass(marker); 75 | } 76 | 77 | // // If there is a defined label, process it and color us 78 | // if (labelInfo) { 79 | // if (labelInfo.applyTo === 'label') 80 | // $elmToColor = $elm.parent(); 81 | // else 82 | // $elmToColor = $elm.parent().parent(); 83 | // 84 | // // Color and mark 85 | // $elmToColor.css({'color': labelInfo.fg, 'background-color': labelInfo.bg}).addClass(marker); 86 | // } 87 | // else { 88 | // // If the user just renamed a tag to something we don't colour 89 | // // workflowy will recreate the nodes, loosing colour info, so no action required 90 | // // however, this is not the case for coloring 'text', so we need to check 91 | // 92 | // if ($elm.parent().parent().hasClass(marker)) 93 | // $elm.parent().parent().css({'color': '', 'background-color': ''}).removeClass(marker); 94 | // } 95 | }); 96 | } 97 | 98 | 99 | /** 100 | * Binds the dom updates to a time delayed function 101 | */ 102 | function bindDOMUpdates() { 103 | // Firstly, if we are called, it means either load or re-activation 104 | // run the updates 105 | colorizeTree(jQuery(document)); 106 | //debugger; 107 | 108 | // Bind the dom change event to a delayed update process 109 | jQuery(document).bind('DOMNodeInserted', function(e) { 110 | var $element = jQuery(e.target); 111 | 112 | // This is for when opening and closing 113 | if ($element.is('.project .open')) { 114 | colorizeTree($element); 115 | } 116 | // We only respond to tag changes 117 | else if ($element.hasClass('contentTag')) { 118 | colorizeTree($element); 119 | } 120 | }); 121 | } 122 | 123 | 124 | /** 125 | * Disables the extension 126 | */ 127 | function disable() { 128 | // Clean up the markup 129 | jQuery('.wfc').css({'color': '', 'background-color': ''}).removeClass("wfc"); 130 | } 131 | 132 | 133 | /** 134 | * This processes the loaded options and populates our local copies 135 | * 136 | * @param outerOpts Chrome will next my object in one with the same name: 137 | * save: options: {a:1, b:2} 138 | * load: options.options {a:1, b:2 139 | */ 140 | function processOptions(outerOpts) { 141 | var loaded = false; 142 | if (!chrome.runtime.error) { 143 | var opts; 144 | // First time load 145 | if (outerOpts.options === undefined) { 146 | opts = stubOptions.options; 147 | } 148 | else { 149 | // the data will have my options in the thing called "options" 150 | opts = outerOpts.options; 151 | } 152 | labelMap = opts; 153 | loaded = true; 154 | } 155 | 156 | if (!loaded) { 157 | // Add defaults 158 | labelMap = stubOptions; 159 | } 160 | } 161 | 162 | /** 163 | * A Callback called when options change 164 | * 165 | * @param outerOpts The outer wrapper for the options, see comment at processOptions 166 | */ 167 | function optionsReloaded(outerOpts) { 168 | processOptions(outerOpts); 169 | // We switched from enabled to disabled 170 | if (prevEnabled && labelMap.enabled == false) { 171 | disable(); 172 | } 173 | // We switched from disabled to enabled 174 | else if (prevEnabled == false && labelMap.enabled == true) { 175 | bindDOMUpdates(); 176 | } 177 | // We were both previously and currently enabled 178 | else if (labelMap.enabled) { 179 | colorizeTree(jQuery(document)); 180 | } 181 | 182 | prevEnabled = labelMap.enabled; 183 | }; 184 | 185 | 186 | /** 187 | * Callback called at the first load of the page 188 | * 189 | * @param outerOpts The outer wrapper for the options, see comment at processOptions 190 | */ 191 | function optionsLoaded(outerOpts) { 192 | processOptions(outerOpts); 193 | prevEnabled = labelMap.enabled; 194 | 195 | if (labelMap.enabled) 196 | bindDOMUpdates(); 197 | 198 | // Add the optionsReloaded hook to the options changing 199 | chrome.storage.onChanged.addListener(function(changes, namespace) { 200 | chrome.storage.sync.get("options", optionsReloaded); 201 | }); 202 | 203 | }; 204 | 205 | 206 | /** 207 | * We load here 208 | */ 209 | jQuery(document).ready(function() { 210 | /* 211 | * // This is a test for using a listener from the popup 212 | chrome.runtime.onMessage.addListener( 213 | function(request, sender, sendResponse) { 214 | if (request.action == "saved") { 215 | sendResponse({reply: "saved received"}); 216 | console.log("message received"); 217 | } 218 | }); 219 | */ 220 | 221 | // We start here 222 | //optionsLoaded(stubOptions); 223 | chrome.storage.sync.get("options", optionsLoaded); 224 | }); 225 | 226 | -------------------------------------------------------------------------------- /src/js/lib/spectrum.css: -------------------------------------------------------------------------------- 1 | /*** 2 | Spectrum Colorpicker v1.5.2 3 | https://github.com/bgrins/spectrum 4 | Author: Brian Grinstead 5 | License: MIT 6 | ***/ 7 | 8 | .sp-container { 9 | position:absolute; 10 | top:0; 11 | left:0; 12 | display:inline-block; 13 | *display: inline; 14 | *zoom: 1; 15 | /* https://github.com/bgrins/spectrum/issues/40 */ 16 | z-index: 9999994; 17 | overflow: hidden; 18 | } 19 | .sp-container.sp-flat { 20 | position: relative; 21 | } 22 | 23 | /* Fix for * { box-sizing: border-box; } */ 24 | .sp-container, 25 | .sp-container * { 26 | -webkit-box-sizing: content-box; 27 | -moz-box-sizing: content-box; 28 | box-sizing: content-box; 29 | } 30 | 31 | /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */ 32 | .sp-top { 33 | position:relative; 34 | width: 100%; 35 | display:inline-block; 36 | } 37 | .sp-top-inner { 38 | position:absolute; 39 | top:0; 40 | left:0; 41 | bottom:0; 42 | right:0; 43 | } 44 | .sp-color { 45 | position: absolute; 46 | top:0; 47 | left:0; 48 | bottom:0; 49 | right:20%; 50 | } 51 | .sp-hue { 52 | position: absolute; 53 | top:0; 54 | right:0; 55 | bottom:0; 56 | left:84%; 57 | height: 100%; 58 | } 59 | 60 | .sp-clear-enabled .sp-hue { 61 | top:33px; 62 | height: 77.5%; 63 | } 64 | 65 | .sp-fill { 66 | padding-top: 80%; 67 | } 68 | .sp-sat, .sp-val { 69 | position: absolute; 70 | top:0; 71 | left:0; 72 | right:0; 73 | bottom:0; 74 | } 75 | 76 | .sp-alpha-enabled .sp-top { 77 | margin-bottom: 18px; 78 | } 79 | .sp-alpha-enabled .sp-alpha { 80 | display: block; 81 | } 82 | .sp-alpha-handle { 83 | position:absolute; 84 | top:-4px; 85 | bottom: -4px; 86 | width: 6px; 87 | left: 50%; 88 | cursor: pointer; 89 | border: 1px solid black; 90 | background: white; 91 | opacity: .8; 92 | } 93 | .sp-alpha { 94 | display: none; 95 | position: absolute; 96 | bottom: -14px; 97 | right: 0; 98 | left: 0; 99 | height: 8px; 100 | } 101 | .sp-alpha-inner { 102 | border: solid 1px #333; 103 | } 104 | 105 | .sp-clear { 106 | display: none; 107 | } 108 | 109 | .sp-clear.sp-clear-display { 110 | background-position: center; 111 | } 112 | 113 | .sp-clear-enabled .sp-clear { 114 | display: block; 115 | position:absolute; 116 | top:0px; 117 | right:0; 118 | bottom:0; 119 | left:84%; 120 | height: 28px; 121 | } 122 | 123 | /* Don't allow text selection */ 124 | .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button { 125 | -webkit-user-select:none; 126 | -moz-user-select: -moz-none; 127 | -o-user-select:none; 128 | user-select: none; 129 | } 130 | 131 | .sp-container.sp-input-disabled .sp-input-container { 132 | display: none; 133 | } 134 | .sp-container.sp-buttons-disabled .sp-button-container { 135 | display: none; 136 | } 137 | .sp-container.sp-palette-buttons-disabled .sp-palette-button-container { 138 | display: none; 139 | } 140 | .sp-palette-only .sp-picker-container { 141 | display: none; 142 | } 143 | .sp-palette-disabled .sp-palette-container { 144 | display: none; 145 | } 146 | 147 | .sp-initial-disabled .sp-initial { 148 | display: none; 149 | } 150 | 151 | 152 | /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */ 153 | .sp-sat { 154 | background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0))); 155 | background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0)); 156 | background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); 157 | background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); 158 | background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0)); 159 | background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0)); 160 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)"; 161 | filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81'); 162 | } 163 | .sp-val { 164 | background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0))); 165 | background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0)); 166 | background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); 167 | background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); 168 | background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0)); 169 | background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0)); 170 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)"; 171 | filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000'); 172 | } 173 | 174 | .sp-hue { 175 | background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); 176 | background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); 177 | background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); 178 | background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000)); 179 | background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); 180 | background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%); 181 | } 182 | 183 | /* IE filters do not support multiple color stops. 184 | Generate 6 divs, line them up, and do two color gradients for each. 185 | Yes, really. 186 | */ 187 | .sp-1 { 188 | height:17%; 189 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00'); 190 | } 191 | .sp-2 { 192 | height:16%; 193 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00'); 194 | } 195 | .sp-3 { 196 | height:17%; 197 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff'); 198 | } 199 | .sp-4 { 200 | height:17%; 201 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff'); 202 | } 203 | .sp-5 { 204 | height:16%; 205 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff'); 206 | } 207 | .sp-6 { 208 | height:17%; 209 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000'); 210 | } 211 | 212 | .sp-hidden { 213 | display: none !important; 214 | } 215 | 216 | /* Clearfix hack */ 217 | .sp-cf:before, .sp-cf:after { content: ""; display: table; } 218 | .sp-cf:after { clear: both; } 219 | .sp-cf { *zoom: 1; } 220 | 221 | /* Mobile devices, make hue slider bigger so it is easier to slide */ 222 | @media (max-device-width: 480px) { 223 | .sp-color { right: 40%; } 224 | .sp-hue { left: 63%; } 225 | .sp-fill { padding-top: 60%; } 226 | } 227 | .sp-dragger { 228 | border-radius: 5px; 229 | height: 5px; 230 | width: 5px; 231 | border: 1px solid #fff; 232 | background: #000; 233 | cursor: pointer; 234 | position:absolute; 235 | top:0; 236 | left: 0; 237 | } 238 | .sp-slider { 239 | position: absolute; 240 | top:0; 241 | cursor:pointer; 242 | height: 3px; 243 | left: -1px; 244 | right: -1px; 245 | border: 1px solid #000; 246 | background: white; 247 | opacity: .8; 248 | } 249 | 250 | /* 251 | Theme authors: 252 | Here are the basic themeable display options (colors, fonts, global widths). 253 | See http://bgrins.github.io/spectrum/themes/ for instructions. 254 | */ 255 | 256 | .sp-container { 257 | border-radius: 0; 258 | background-color: #ECECEC; 259 | border: solid 1px #f0c49B; 260 | padding: 0; 261 | } 262 | .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear { 263 | font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; 264 | -webkit-box-sizing: border-box; 265 | -moz-box-sizing: border-box; 266 | -ms-box-sizing: border-box; 267 | box-sizing: border-box; 268 | } 269 | .sp-top { 270 | margin-bottom: 3px; 271 | } 272 | .sp-color, .sp-hue, .sp-clear { 273 | border: solid 1px #666; 274 | } 275 | 276 | /* Input */ 277 | .sp-input-container { 278 | float:right; 279 | width: 100px; 280 | margin-bottom: 4px; 281 | } 282 | .sp-initial-disabled .sp-input-container { 283 | width: 100%; 284 | } 285 | .sp-input { 286 | font-size: 12px !important; 287 | border: 1px inset; 288 | padding: 4px 5px; 289 | margin: 0; 290 | width: 100%; 291 | background:transparent; 292 | border-radius: 3px; 293 | color: #222; 294 | } 295 | .sp-input:focus { 296 | border: 1px solid orange; 297 | } 298 | .sp-input.sp-validation-error { 299 | border: 1px solid red; 300 | background: #fdd; 301 | } 302 | .sp-picker-container , .sp-palette-container { 303 | float:left; 304 | position: relative; 305 | padding: 10px; 306 | padding-bottom: 300px; 307 | margin-bottom: -290px; 308 | } 309 | .sp-picker-container { 310 | width: 172px; 311 | border-left: solid 1px #fff; 312 | } 313 | 314 | /* Palettes */ 315 | .sp-palette-container { 316 | border-right: solid 1px #ccc; 317 | } 318 | 319 | .sp-palette-only .sp-palette-container { 320 | border: 0; 321 | } 322 | 323 | .sp-palette .sp-thumb-el { 324 | display: block; 325 | position:relative; 326 | float:left; 327 | width: 24px; 328 | height: 15px; 329 | margin: 3px; 330 | cursor: pointer; 331 | border:solid 2px transparent; 332 | } 333 | .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active { 334 | border-color: orange; 335 | } 336 | .sp-thumb-el { 337 | position:relative; 338 | } 339 | 340 | /* Initial */ 341 | .sp-initial { 342 | float: left; 343 | border: solid 1px #333; 344 | } 345 | .sp-initial span { 346 | width: 30px; 347 | height: 25px; 348 | border:none; 349 | display:block; 350 | float:left; 351 | margin:0; 352 | } 353 | 354 | .sp-initial .sp-clear-display { 355 | background-position: center; 356 | } 357 | 358 | /* Buttons */ 359 | .sp-palette-button-container, 360 | .sp-button-container { 361 | float: right; 362 | } 363 | 364 | /* Replacer (the little preview div that shows up instead of the <input>) */ 365 | .sp-replacer { 366 | margin:0; 367 | overflow:hidden; 368 | cursor:pointer; 369 | padding: 4px; 370 | display:inline-block; 371 | *zoom: 1; 372 | *display: inline; 373 | border: solid 1px #91765d; 374 | background: #eee; 375 | color: #333; 376 | vertical-align: middle; 377 | } 378 | .sp-replacer:hover, .sp-replacer.sp-active { 379 | border-color: #F0C49B; 380 | color: #111; 381 | } 382 | .sp-replacer.sp-disabled { 383 | cursor:default; 384 | border-color: silver; 385 | color: silver; 386 | } 387 | .sp-dd { 388 | padding: 2px 0; 389 | height: 16px; 390 | line-height: 16px; 391 | float:left; 392 | font-size:10px; 393 | } 394 | .sp-preview { 395 | position:relative; 396 | width:25px; 397 | height: 20px; 398 | border: solid 1px #222; 399 | margin-right: 5px; 400 | float:left; 401 | z-index: 0; 402 | } 403 | 404 | .sp-palette { 405 | *width: 220px; 406 | max-width: 220px; 407 | } 408 | .sp-palette .sp-thumb-el { 409 | width:16px; 410 | height: 16px; 411 | margin:2px 1px; 412 | border: solid 1px #d0d0d0; 413 | } 414 | 415 | .sp-container { 416 | padding-bottom:0; 417 | } 418 | 419 | 420 | /* Buttons: http://hellohappy.org/css3-buttons/ */ 421 | .sp-container button { 422 | background-color: #eeeeee; 423 | background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc); 424 | background-image: -moz-linear-gradient(top, #eeeeee, #cccccc); 425 | background-image: -ms-linear-gradient(top, #eeeeee, #cccccc); 426 | background-image: -o-linear-gradient(top, #eeeeee, #cccccc); 427 | background-image: linear-gradient(to bottom, #eeeeee, #cccccc); 428 | border: 1px solid #ccc; 429 | border-bottom: 1px solid #bbb; 430 | border-radius: 3px; 431 | color: #333; 432 | font-size: 14px; 433 | line-height: 1; 434 | padding: 5px 4px; 435 | text-align: center; 436 | text-shadow: 0 1px 0 #eee; 437 | vertical-align: middle; 438 | } 439 | .sp-container button:hover { 440 | background-color: #dddddd; 441 | background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb); 442 | background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb); 443 | background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb); 444 | background-image: -o-linear-gradient(top, #dddddd, #bbbbbb); 445 | background-image: linear-gradient(to bottom, #dddddd, #bbbbbb); 446 | border: 1px solid #bbb; 447 | border-bottom: 1px solid #999; 448 | cursor: pointer; 449 | text-shadow: 0 1px 0 #ddd; 450 | } 451 | .sp-container button:active { 452 | border: 1px solid #aaa; 453 | border-bottom: 1px solid #888; 454 | -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; 455 | -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; 456 | -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; 457 | -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; 458 | box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee; 459 | } 460 | .sp-cancel { 461 | font-size: 11px; 462 | color: #d93f3f !important; 463 | margin:0; 464 | padding:2px; 465 | margin-right: 5px; 466 | vertical-align: middle; 467 | text-decoration:none; 468 | 469 | } 470 | .sp-cancel:hover { 471 | color: #d93f3f !important; 472 | text-decoration: underline; 473 | } 474 | 475 | 476 | .sp-palette span:hover, .sp-palette span.sp-thumb-active { 477 | border-color: #000; 478 | } 479 | 480 | .sp-preview, .sp-alpha, .sp-thumb-el { 481 | position:relative; 482 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==); 483 | } 484 | .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner { 485 | display:block; 486 | position:absolute; 487 | top:0;left:0;bottom:0;right:0; 488 | } 489 | 490 | .sp-palette .sp-thumb-inner { 491 | background-position: 50% 50%; 492 | background-repeat: no-repeat; 493 | } 494 | 495 | .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner { 496 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=); 497 | } 498 | 499 | .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner { 500 | background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=); 501 | } 502 | 503 | .sp-clear-display { 504 | background-repeat:no-repeat; 505 | background-position: center; 506 | background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==); 507 | } 508 | -------------------------------------------------------------------------------- /src/js/modules/common.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 4 | * 5 | * This file is part of some open source application. 6 | * 7 | * Both the file and the application are Licensed under 8 | * GNU General Public License 3.0 or later. Some rights reserved. 9 | * 10 | * See LICENCE file 11 | * 12 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 13 | */ 14 | 15 | var colorUtil = { 16 | /** 17 | * Gets a string such as rgb(r, g, b) or rgba(r, g, b, a) 18 | * and returns an array of numbers in the form of {r, g, b} 19 | */ 20 | rgbTextToArray: function(rgbText) { 21 | var m = /^\s*rgba?\(([^,]+?),([^,]+?),([^,]+?)(?:,([^,]+?))?\)\s*$/i.exec(rgbText); 22 | if (!m) 23 | return null; 24 | var res = { 25 | r: parseFloat(m[1]), 26 | g: parseFloat(m[2]), 27 | b: parseFloat(m[3]) 28 | }; 29 | if (m[4]) 30 | res['a'] = parseFloat(m[4]); 31 | 32 | return res; 33 | }, 34 | 35 | /** 36 | * Takes a hex color and converts it to an array of {r, g, b} 37 | */ 38 | hexToArray: function(hex) { 39 | // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") 40 | var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; 41 | hex = hex.replace(shorthandRegex, function(m, r, g, b) { 42 | return r + r + g + g + b + b; 43 | }); 44 | 45 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 46 | return result ? { 47 | r: parseInt(result[1], 16), 48 | g: parseInt(result[2], 16), 49 | b: parseInt(result[3], 16) 50 | } : null; 51 | }, 52 | 53 | colorToArray: function(color) { 54 | if (color.match(/\s*rgba?\(/i)) 55 | return this.rgbTextToArray(color); 56 | else 57 | return this.hexToArray(color); 58 | }, 59 | 60 | /** 61 | * Turns an rgb color to perceived brightness 62 | * @param RGBArray An array of three or four values 63 | * [R, G, B] : Values in 0..255 64 | * [R, G, B, A]: RGB values in 0..255, Alpha in 0..1 65 | * @return The perceived brightness between 0..255 66 | */ 67 | brightness: function(rgba) { 68 | var R = rgba.r; 69 | var G = rgba.g; 70 | var B = rgba.b; 71 | //var a = rgba.a; 72 | 73 | var res = Math.floor(Math.sqrt( 74 | R * R * .241 + 75 | G * G * .691 + 76 | B * B * .068)); 77 | 78 | // I should do something clever here about alpha, 79 | // but there is no way of knowing the color of the element behind 80 | return res; 81 | }, 82 | 83 | /** Taks an {r, g, b} array and returns a hex */ 84 | arrayToHex: function(arr) { 85 | return '#' 86 | + this._intToHex(arr.r) 87 | + this._intToHex(arr.g) 88 | + this._intToHex(arr.b); 89 | }, 90 | 91 | /** 92 | * Gets a named color and returns it as an rgb array {r, g, b} 93 | * @param named 94 | * @param blockElm 95 | * @returns 96 | */ 97 | namedToArray: function(named, blockElm) { 98 | var initBG = blockElm.css('background-color'); 99 | blockElm.css('background-color', named); 100 | var bgRGB = blockElm.css('background-color'); 101 | blockElm.css('background-color', initBG); 102 | return this.colorToArray(bgRGB); 103 | }, 104 | 105 | /** 106 | * Gets a color string and returns the suggested foreground 107 | * @param background Any valid css color string 108 | */ 109 | autoColor: function (background) { 110 | var b = this.brightness(this.colorToArray(background)); 111 | return b < this._thressold ? this._lightColor : this._darkColor; 112 | }, 113 | 114 | _lightColor : 'white', 115 | _darkColor : 'black', 116 | _thressold : 130, 117 | 118 | /** int to hex with leading zeros */ 119 | _intToHex: function(i) { 120 | var hex = i.toString(16); 121 | return hex.length == 1 ? "0" + hex : hex; 122 | }, 123 | 124 | /** The named colors in nice order */ 125 | namedColors:[ 126 | "yellow", "lightyellow", "lemonchiffon", "lightgoldenrodyellow", "papayawhip", "moccasin", 127 | "peachpuff", "palegoldenrod", "khaki", "darkkhaki", "gold", "none", "cornsilk", "blanchedalmond", 128 | "bisque", "navajowhite", "wheat", "burlywood", "tan", "rosybrown", "sandybrown", "goldenrod", 129 | "darkgoldenrod", "Peru", "chocolate", "saddlebrown", "sienna", "brown", "maroon", "lightgrey", 130 | "none", "darkolivegreen", "olive", "olivedrab", "yellowgreen", "limegreen", "lime", "lawngreen", 131 | "chartreuse", "greenyellow", "springgreen", "mediumspringgreen", "lightgreen", "palegreen", 132 | "darkseagreen", "mediumseagreen", "seagreen", "forestgreen", "green", "darkgreen", "none", 133 | "mediumaquamarine", "aqua", "cyan", "lightcyan", "paleturquoise", "aquamarine", "turquoise", 134 | "mediumturquoise", "darkturquoise", "lightseagreen", "cadetblue", "darkcyan", "teal", "lightgrey", 135 | "none", "lightsteelblue", "powderblue", "lightblue", "skyblue", "lightskyblue", "deepskyblue", 136 | "dodgerblue", "cornflowerblue", "steelblue", "royalblue", "blue", "mediumblue", "darkblue", "navy", 137 | "midnightblue", "none", "lavender", "thistle", "plum", "violet", "orchid", "fuchsia", "Magenta", 138 | "mediumorchid", "mediumpurple", "blueviolet", "darkviolet", "darkorchid", "darkmagenta", "purple", 139 | "indigo", "darkslateblue", "slateblue", "mediumslateblue", "lightgrey", "none", "white", "snow", 140 | "honeydew", "mintcream", "azure", "aliceblue", "ghostwhite", "whitesmoke", "seashell", "beige", 141 | "oldlace", "floralwhite", "ivory", "antiquewhite", "linen", "lavenderblush", "mistyrose", "none", 142 | "gainsboro", "lightgrey", "silver", "darkgray", "gray", "dimgray", "lightslategray", "slategray", 143 | "darkslategray", "black" 144 | ], 145 | 146 | buildNamedToHexMap: function(blockElm) { 147 | var res = {}; 148 | this.namedColors.forEach(function(i){ 149 | var bgArr = colorUtil.namedToArray(i, blockElm); 150 | res[i] = colorUtil.arrayToHex(bgArr); 151 | }); 152 | return res; 153 | } 154 | } 155 | 156 | 157 | /** 158 | * This turns out to be the application common object and needs to be renamed 159 | * DEPRECATED, Check if it is used anywehre and delete it 160 | */ 161 | var labelMap = { 162 | 163 | /** 164 | * We will keep the labels map here 165 | */ 166 | labels: {}, 167 | 168 | /** 169 | * @param label The label name 170 | * @param applyTo 'label' or 'text' 171 | * @param fg Foreground colour, could be empty 172 | * @param bg Background colour, could be empty 173 | */ 174 | add: function(label, applyTo, fg, bg) { 175 | if (!applyTo) applyTo = 'label'; 176 | 177 | this.labels[label] = {'applyTo': applyTo, 'fg': fg, 'bg': bg}; 178 | }, 179 | 180 | clear: function () { 181 | this.labels = {}; 182 | }, 183 | 184 | defaults: function () { 185 | this.add('next' , 'label', 'white', 'tomato'); 186 | this.add('high' , 'label', 'black', 'lightpink'); 187 | this.add('medium' , 'label', 'black', 'orange'); 188 | this.add('low' , 'label', 'black', 'skyblue'); 189 | this.add('issue' , 'label', 'black', 'palegreen'); 190 | this.add('upmc' , 'label', 'white', 'purple'); 191 | this.add('urgent' , 'text' , '' , 'yellow'); 192 | }, 193 | 194 | /** 195 | * Adds a comma seprated list of colours as labes with the same name 196 | * i.e. "red, green, blue" will make #red to be rendered in red background,and so on 197 | * param colors can be either a comma separated list (string) or an array 198 | */ 199 | addNamedColors: function (colors) { 200 | if (!(colors instanceof Array)) { 201 | colors = colors.split(/\W*,\W*/); 202 | } 203 | 204 | colors.forEach(function(color) { 205 | this.add(color, 'label', null, color); 206 | }); 207 | } 208 | }; 209 | -------------------------------------------------------------------------------- /src/js/modules/options-data.js: -------------------------------------------------------------------------------- 1 | var emptyOption = { 2 | name: "newtag", 3 | tag: false, 4 | tagfg: null, 5 | tagbg: null, 6 | tagnu: null, 7 | text: null, 8 | textfg: null, 9 | textbg: null 10 | }; 11 | 12 | /** 13 | * stub options file 14 | */ 15 | var stubOptions = { 16 | options: { 17 | enabled: true, 18 | labels: { 19 | "high": { 20 | name: "high", 21 | tag: true, 22 | tagfg: 'white', 23 | tagbg: "tomato", 24 | tagnu: null, 25 | text: false, 26 | textfg: null, 27 | textbg: null 28 | 29 | }, 30 | "medium": { 31 | name: "medium", 32 | tag: true, 33 | tagfg: 'black', 34 | tagbg: "orange", 35 | tagnu: null, 36 | text: false, 37 | textfg: null, 38 | textbg: null 39 | }, 40 | "low": { 41 | name: "low", 42 | tag: true, 43 | tagfg: 'black', 44 | tagbg: "palegreen", 45 | tagnu: null, 46 | text: false, 47 | textfg: null, 48 | textbg: null 49 | }, 50 | "mark": { 51 | name: "mark", 52 | tag: false, 53 | tagfg: 'blue', 54 | tagbg: null, 55 | tagnu: null, 56 | text: true, 57 | textfg: null, 58 | textbg: "yellow" 59 | } 60 | } 61 | } 62 | }; 63 | 64 | /** 65 | * Random phrases 66 | */ 67 | var loremIpsoum = { 68 | random: function () { 69 | return this.phrases[Math.floor((Math.random() * this.phrases.length))]; 70 | }, 71 | 72 | phrases: [ 73 | "Nullam a ex eu nisl vestibulum rutrum sit amet.", 74 | "Donec at accumsan neque. Suspendisse potenti.", 75 | "Suspendisse tempus suscipit elit, feugiat volutpat.", 76 | "Praesent mollis lobortis felis dignissim dapibus.", 77 | "Vestibulum vel orci nulla. Mauris ullamcorper massa.", 78 | "Ut sit amet volutpat urna. Quisque gravida, erat.", 79 | "Etiam luctus, sapien eget finibus pellentesque.", 80 | "Quisque odio risus, elementum in pretium sed." 81 | ] 82 | }; 83 | -------------------------------------------------------------------------------- /src/js/options.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 4 | * 5 | * This file is part of some open source application. 6 | * 7 | * Both the file and the application are Licensed under 8 | * GNU General Public License 3.0 or later. Some rights reserved. 9 | * 10 | * See LICENCE file 11 | * 12 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 13 | */ 14 | 15 | /** 16 | * The way options work: 17 | * 1. On load, calling prepList 18 | * - creates a setting div per tag 19 | * - calls valToForm which translates value to form elements 20 | * - calls formToView which updates the previews 21 | * 2. When the user attaches the editor 22 | * - calls formToEditor to update editor fields from the settings form 23 | * - binds the events in such a way that board form fields 24 | * update the setting hidden fields 25 | * 3. Editor 26 | */ 27 | var testMode; 28 | 29 | /** For debugging */ 30 | var gopts; 31 | 32 | /** legacy */ 33 | var rawColorsText; 34 | var enabledCheck; 35 | 36 | /** Holds some detachable divs */ 37 | var divs; 38 | 39 | /** Holds the editor object */ 40 | var editor; 41 | 42 | /** the collection of the settings */ 43 | var settings= {}; 44 | 45 | function createEditor(board) { 46 | var editor = { 47 | /** The setting being edited now */ 48 | settingEdited: null, 49 | mainDiv : board, 50 | fields : { 51 | etag : $('#etag' , board), 52 | etagfg : $('#etagfg' , board), 53 | etagbg : $('#etagbg' , board), 54 | etagnu : $('#etagnu' , board), 55 | etext : $('#etext' , board), 56 | etextfg : $('#etextfg', board), 57 | etextbg : $('#etextbg', board) 58 | }, 59 | 60 | pickers: { 61 | btagfg : $('#btagfg' , board), 62 | btagbg : $('#btagbg' , board), 63 | btextfg : $('#btextfg', board), 64 | btextbg : $('#btextbg', board), 65 | palette: [ 66 | ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"], 67 | ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"], 68 | ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"], 69 | ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"], 70 | ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"], 71 | ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"], 72 | ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"], 73 | ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"] 74 | ] 75 | }, 76 | 77 | _bindButtons: function() { 78 | var editor = this; 79 | var fields = this.fields; 80 | var pickers = this.pickers; 81 | var opts = { 82 | showPaletteOnly: true, 83 | togglePaletteOnly: true, 84 | hideAfterPaletteSelect:true, 85 | togglePaletteMoreText: 'more colors', 86 | togglePaletteLessText: 'less colors', 87 | color: 'blanchedalmond', 88 | palette: pickers.palette 89 | }; 90 | 91 | opts['change'] = function(color) { fields.etagfg.val(color.toHexString()).keyup(); }; 92 | pickers.btagfg.spectrum(opts); 93 | 94 | opts['change'] = function(color) { fields.etagbg.val(color.toHexString()).keyup(); }; 95 | pickers.btagbg.spectrum(opts); 96 | 97 | opts['change'] = function(color) { fields.etextfg.val(color.toHexString()).keyup(); }; 98 | pickers.btextfg.spectrum(opts); 99 | 100 | opts['change'] = function(color) { fields.etextbg.val(color.toHexString()).keyup(); }; 101 | pickers.btextbg.spectrum(opts); 102 | 103 | }, 104 | 105 | detach: function() { 106 | this.settingEdited = null; 107 | board.detach(); 108 | $.each(this.fields, function(idx, field) { 109 | field.off(); 110 | if (field.is(':checkbox')) 111 | field.prop('checked', false); 112 | else 113 | field.val(''); 114 | }); 115 | }, 116 | 117 | attach: function(setting) { 118 | this.settingEdited = setting; 119 | var board = this.mainDiv; 120 | board.appendTo(setting.mainDiv); 121 | 122 | // Populate editor with fields 123 | var fields = setting.fields; 124 | var editor = this; 125 | $.each(this.fields, function(idx, field) { 126 | var other = setting.fields['o' + idx.substr(1)]; 127 | var picker = editor.pickers['b' + idx.substr(1)]; 128 | if (field.is(':checkbox')) { 129 | field.prop('checked', other.val() == 'true').off().click(function(e){ 130 | console.log(idx + ": " + field.prop('checked')); 131 | other.val(field.prop('checked')).change(); 132 | }); 133 | } 134 | else if (field.is(':text')) { 135 | field.val(other.val()).off().keyup(function(e){ 136 | other.val(field.val()).change(); 137 | }); 138 | picker.spectrum("set", field.val()); 139 | } 140 | }); 141 | 142 | }, 143 | // 144 | // _buildColorMenu: function(menu, type) { 145 | // menu.detach(); 146 | // menu.show(); 147 | // var colorList; 148 | // if (type == 'fg') { 149 | // colorList = colorUtil.namedColors.reverse(); 150 | // } 151 | // else { 152 | // colorList = ['white'].concat(colorUtil.namedColors); 153 | // } 154 | // var optstr = '<option></option>'; 155 | // 156 | // menu.append($(optstr).text("auto").attr('value', 'auto')); 157 | // //menu.append($(optstr).text("Default").attr('value', 'auto')); 158 | // colorList.forEach(function(name) { 159 | // var opt = $(optstr).text(name).attr('value', name); 160 | // if (type == 'bg') 161 | // opt.css('background-color', name); 162 | // else 163 | // opt.css('color', name); 164 | // menu.append(opt); 165 | // }); 166 | // return menu; 167 | // }, 168 | // 169 | // menufg: null, 170 | // menubg: null, 171 | // 172 | // namedColorMap: null, 173 | // 174 | // _buildColorMenus: function () { 175 | // this.menufg = this._buildColorMenu($('#coloroptfg'), 'fg'); 176 | // this.menubg = this._buildColorMenu($('#coloroptbg'), 'bg'); 177 | // if (!this.namedColorMap) 178 | // this.namedColorMap = colorUtil.buildNamedToHexMap($('.pageactions')); 179 | // }, 180 | // 181 | // showMenuFg: function(source, other) { 182 | // var menu = this.menufg; 183 | // var fg = source.val(); 184 | // var bg = other; 185 | // 186 | // var top = source.position().top + source.height() + 7; 187 | // var left = source.position().left + 1; 188 | // 189 | // menu.css({top: top, left: left}); 190 | // 191 | // // Check to see if we need to change the background 192 | // if (bg && bg != 'auto') { 193 | // //$('option', this.menufg).css('background', bg); 194 | // } 195 | // 196 | // //$('option:first', this.menufg).css('color', ) 197 | // menu.off().change(function(e){ 198 | // source.val(this.value).keyup(); 199 | // menu.detach(); 200 | // }); 201 | // 202 | // source.after(menu); 203 | // $('body').mouseup(function(e) { 204 | // if (!$(e.target).closest(menu).length){ 205 | // menu.detach(); 206 | // } 207 | // }); 208 | // 209 | // return menu; 210 | // }, 211 | // 212 | // showMenuBg: function(source, other) { 213 | // var menu = this.menubg; 214 | // var bg = source.val(); 215 | // var fg = other; 216 | // 217 | // var top = source.position().top + source.height() + 7; 218 | // var left = source.position().left + 1; 219 | // 220 | // menu.css({top: top, left: left}); 221 | // 222 | // // Check to see if we need to change the background 223 | // if (fg && fg != 'auto') { 224 | // //$('option', this.menubg).css('color', fg); 225 | // } 226 | // else { 227 | // //$('option', this.menubg).css('color', colorUtil.autoColor(this.namedColorMap[bg])); 228 | // } 229 | // 230 | // menu.off().change(function(e){ 231 | // source.val(this.value).keyup(); 232 | // menu.detach(); 233 | // }); 234 | // 235 | // source.after(menu); 236 | // $('body').mouseup(function(e) { 237 | // if (!$(e.target).closest(menu).length){ 238 | // menu.detach(); 239 | // } 240 | // }); 241 | // 242 | // source.after(menu); 243 | // return menu; 244 | // } 245 | 246 | }; 247 | 248 | editor._bindButtons(); 249 | //editor._buildColorMenus(); 250 | return editor; 251 | } 252 | 253 | /** 254 | * Takes a setting div and value from the settings 255 | * and populates the hidden and creates the setting object 256 | * @param val 257 | * @param setting 258 | */ 259 | function createSetting(settingDiv, val) { 260 | var res = { 261 | val : val, 262 | mainDiv: settingDiv, 263 | fields : { 264 | // Note: Field to val mappings are 265 | // filed: oNAME, val: NAME 266 | // but we avoid automatic things here to have a proper list 267 | oname : $('.oname' , settingDiv), 268 | otag : $('.otag' , settingDiv), 269 | otagfg : $('.otagfg' , settingDiv), 270 | otagbg : $('.otagbg' , settingDiv), 271 | otagnu : $('.otagnu' , settingDiv), 272 | otext : $('.otext' , settingDiv), 273 | otextfg : $('.otextfg', settingDiv), 274 | otextbg : $('.otextbg', settingDiv) 275 | }, 276 | divs : { 277 | tag : $('.contentTag' , settingDiv), 278 | tagText : $('.contentTagText', settingDiv), 279 | text : $('.content' , settingDiv), 280 | textText : $('.contentText' , settingDiv) 281 | }, 282 | 283 | /** 284 | * Binds local fields to preview 285 | * This meant to be used during initalization only 286 | */ 287 | _bindFields : function() { 288 | var me = this; 289 | $.each(this.fields, function (idx, field) { 290 | if (idx == 'oname') { 291 | this.keyup(function(e) { 292 | me.divs.tagText.text($(this).val()); 293 | }) 294 | } 295 | else { 296 | this.change(function(e) { 297 | me.updatePreview(); 298 | }); 299 | } 300 | }); 301 | }, 302 | 303 | /** 304 | * Destroys this setting 305 | */ 306 | destroy: function() { 307 | $.each(this.fields, function (idx, field) { 308 | field.off(); 309 | }); 310 | this.fields = null; 311 | this.divs = null; 312 | this.mainDiv.remove(); 313 | }, 314 | 315 | /** 316 | * Sets the fields based on val, 317 | * optionally it assigns newval to val 318 | */ 319 | updateFields: function(newval) { 320 | // Assign the new val, if present 321 | if (newval) this.val = newval; 322 | 323 | // make a copy because "this" changes in the $.each loop 324 | var val = this.val; 325 | $.each(this.fields, function (idx, field) { 326 | // We can use this trick, since we have the same name 327 | // between fields members and form inputs 328 | field.val(val[idx.substr(1)]).change(); 329 | }); 330 | }, 331 | 332 | /** 333 | * updates the preview for a setting 334 | */ 335 | updatePreview: function() { 336 | var fields = this.fields; 337 | 338 | var cssReset = { 339 | 'color': '', 340 | 'background-color': '' 341 | }; 342 | 343 | // if (fields.otag.val()) { 344 | var css = $.extend({}, cssReset); 345 | if (fields.otagfg.val()) 346 | css['color'] = fields.otagfg.val(); 347 | if (fields.otagbg.val()) 348 | css['background-color'] = fields.otagbg.val(); 349 | this.divs.tag.css(css); 350 | this.divs.tagText.css('text-decoration', fields.otagnu.val() == 'true' ? 'none' : 'underline'); 351 | // } 352 | // if (fields.otext.val()) { 353 | var css = $.extend({}, cssReset); 354 | if (fields.otextfg.val()) 355 | css['color'] = fields.otextfg.val(); 356 | if (fields.otextbg.val()) { 357 | css['background-color'] = fields.otextbg.val(); 358 | css['border-radius'] = '6px'; 359 | } 360 | else { 361 | css['border-radius'] = ''; 362 | } 363 | this.divs.text.css(css); 364 | // } 365 | }, 366 | 367 | /** 368 | * Converts the hidden fields to a proper val for settings 369 | */ 370 | fieldsToVal: function() { 371 | var res = {}; 372 | var val = this.val; 373 | $.each(this.fields, function (idx, field) { 374 | res[idx.substr(1)] = field.val(); 375 | }); 376 | return res; 377 | } 378 | }; 379 | 380 | res._bindFields(); 381 | return res; 382 | } 383 | 384 | /** 385 | * This adds a new setting, after it creates it 386 | * @param key name of the setting 387 | * @param val the value 388 | */ 389 | function addSetting(opts, container, val) { 390 | var setting = createSetting(divs.setting.clone()); 391 | 392 | // Update the field values 393 | setting.updateFields(val); 394 | 395 | // Create some initial sentenses 396 | setting.divs.tagText.text(val.name); 397 | setting.divs.textText.text(loremIpsoum.random()); 398 | 399 | // Bindings 400 | var setDiv = setting.mainDiv; 401 | $('.edit', setDiv).click(function(e) { 402 | if (editor.settingEdited != setting) 403 | editor.attach(setting); 404 | else 405 | editor.detach(); 406 | }); 407 | 408 | $('.delete', setDiv).click(function(e) { 409 | setting.destroy(); 410 | delete settings[val.name]; 411 | }); 412 | 413 | setDiv.appendTo(container); 414 | settings[val.name] = setting; 415 | 416 | return setting; 417 | } 418 | 419 | /** 420 | * Creates a new array of options from the form 421 | * @returns 422 | */ 423 | function formToLabels() { 424 | var res = {}; 425 | 426 | $.each(settings, function(idx, setting) { 427 | var val = setting.fieldsToVal(); 428 | res[val.name] = val; 429 | }); 430 | 431 | return res; 432 | } 433 | 434 | function prepList(opts) { 435 | var container = $('#options'); 436 | 437 | divs.enabled.prop('checked', opts.enabled == true); 438 | 439 | $.each(opts.labels, function(key, val) { 440 | addSetting(opts, container, val); 441 | }); 442 | 443 | $('.pageactions .addrule').click(function(e) { 444 | var val = $.extend({}, emptyOption); 445 | // Add it detached 446 | //opts.labels[val.name] = val; 447 | var setting = addSetting(opts, container, val); 448 | editor.attach(setting); 449 | }); 450 | 451 | $('.pageactions .save').click(function(e) { 452 | // We need to convert settings list to options 453 | opts.enabled = divs.enabled.prop('checked'); 454 | opts.labels = formToLabels(); 455 | try { 456 | chrome.storage.sync.set({'options': opts}, function() { 457 | if (chrome.runtime.error) { 458 | console.log("Runtime error."); 459 | } 460 | }); 461 | } catch (err) { 462 | console.log("Chrome not pressent, can't save"); 463 | divs.debugText.val(JSON.stringify(opts, null, '\t')); 464 | console.log(opts); 465 | } 466 | window.close(); 467 | }); 468 | 469 | $('.pageactions .loadsaved').click(function(e) { 470 | clearForm(); 471 | loadCallback({options: opts}); 472 | }); 473 | 474 | $('.pageactions .defaults').click(function(e) { 475 | clearForm(); 476 | loadCallback(stubOptions); 477 | }); 478 | } 479 | 480 | /** 481 | * Clears the form 482 | */ 483 | function clearForm() { 484 | $('.pageactions input').off(); 485 | $.each(settings, function(idx, setting) { 486 | setting.destroy(); 487 | delete settings[idx]; 488 | }); 489 | } 490 | 491 | 492 | /* Load stuff on load */ 493 | function loadCallback (outerOpts) { 494 | if (chrome && chrome.runtime && chrome.runtime.error) { 495 | console.log("Chrome runtime error: " + chrome.runtime.error); 496 | return; 497 | } 498 | 499 | // Chrome will nest my object in one with the same name: 500 | // save: options: {a:1, b:2} 501 | // load: options.options {a:1, b:2} 502 | var opts; 503 | 504 | // First time load 505 | if (outerOpts.options === undefined) { 506 | opts = stubOptions.options; 507 | } 508 | else { 509 | // the data will have my options in the thing called "options" 510 | opts = outerOpts.options; 511 | } 512 | 513 | gopts = opts; 514 | 515 | prepList(opts); 516 | }; 517 | 518 | 519 | jQuery(document).ready(function() { 520 | // Assign shortcuts 521 | rawColorsText = document.getElementById("raw-colors"); 522 | enabledCheck = document.getElementById("enabled"); 523 | 524 | divs = { 525 | enabled : $('#enabled'), 526 | setting : $('.setting').detach().show(), 527 | board : $('.board').detach().show(), 528 | debugDiv : $('#debug'), 529 | debugText: $('#debugbox') 530 | } 531 | 532 | editor = createEditor(divs.board); 533 | 534 | // Load and trigger everything 535 | try { 536 | chrome.storage.sync.get("options", loadCallback); 537 | testMode = false; 538 | } catch (err) { 539 | testMode = true; 540 | loadCallback(stubOptions); 541 | } 542 | 543 | // if (testMode) { 544 | // divs.debugDiv.show(); 545 | // $('#options').css('margin-right', '380px'); 546 | // } 547 | // else 548 | // divs.debugDiv.hide(); 549 | }); 550 | 551 | -------------------------------------------------------------------------------- /src/js/page_action.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * Copyright 2014 by Yiannis Chronakis <jchronakis@gmail.com> 4 | * 5 | * This file is part of some open source application. 6 | * 7 | * Both the file and the application are Licensed under 8 | * GNU General Public License 3.0 or later. Some rights reserved. 9 | * 10 | * See LICENCE file 11 | * 12 | * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> 13 | */ 14 | var testMode; 15 | 16 | /** For debugging */ 17 | var gopts; 18 | 19 | var rawColorsText; 20 | var enabledCheck; 21 | 22 | /* Load stuff on load */ 23 | var loadCallback = function(outerOpts) { 24 | // Chrome will next my object in one with the same name: 25 | // save: options: {a:1, b:2} 26 | // load: options.options {a:1, b:2} 27 | if (!chrome.runtime.error) { 28 | var opts = outerOpts.options; // the data will have my options in the thing called "options" 29 | gopts = opts; 30 | rawColorsText.value = opts.labels; 31 | enabledCheck.checked = opts.enabled; 32 | } 33 | }; 34 | 35 | document.addEventListener("DOMContentLoaded", function() { 36 | // Assign shortcuts 37 | rawColorsText = document.getElementById("raw-colors"); 38 | enabledCheck = document.getElementById("enabled"); 39 | 40 | // Load 41 | try { 42 | chrome.storage.sync.get("options", loadCallback); 43 | testMode = false; 44 | } catch (err) { 45 | testMode = true; 46 | jQuery.getScript('../../test/resources/script.js', function() { 47 | loadCallback(stubOptions); 48 | }); 49 | } 50 | 51 | document.getElementById("save").onclick = function() { 52 | try{ 53 | JSON.parse(rawColorsText.value); 54 | } 55 | catch(err) { 56 | alert("Could not save because JSON syntax is wrong.\n\nPlease consider restoring defaults or last saved version"); 57 | return; 58 | } 59 | 60 | // prepare the data to save 61 | var opts = { 62 | enabled: enabledCheck.checked, 63 | labels: rawColorsText.value 64 | }; 65 | 66 | chrome.storage.sync.set({'options': opts}, function() { 67 | if (chrome.runtime.error) { 68 | console.log("Runtime error."); 69 | } 70 | }); 71 | 72 | // Send message to content to reload 73 | chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { 74 | chrome.tabs.sendMessage(tabs[0].id, {action: "saved"}, function(response) { 75 | console.log("Reply was: " + response.reply); 76 | }); 77 | }); 78 | 79 | window.close(); 80 | } 81 | 82 | document.getElementById("cancel").onclick = function() { 83 | chrome.storage.sync.get("options", loadCallback); 84 | } 85 | 86 | document.getElementById("validate").onclick = function() { 87 | try{ 88 | JSON.parse(rawColorsText.value); 89 | alert("Valid JSON!"); 90 | } 91 | catch(err) { 92 | alert("Not a valid JSON syntax.\n\nPlease consider restoring defaults or last saved version"); 93 | } 94 | } 95 | 96 | document.getElementById("restore").onclick = function() { 97 | enabledCheck.checked = true; 98 | labelMap.clear(); 99 | labelMap.defaults(); 100 | //labelMap.addSimpleColors(arColors); 101 | rawColorsText.value = JSON.stringify(labelMap.labels, null, '\t'); 102 | } 103 | 104 | }); 105 | 106 | 107 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WorkFlowy colorful tags", 3 | "short_name" : "wflowyColor", 4 | "version": "0.2.2", 5 | "manifest_version": 2, 6 | "description": "Allows to assign color to tags in Workflowy", 7 | "homepage_url": "http://github.com/chronakis", 8 | "icons": { 9 | "16": "images/icon-16.png", 10 | "48": "images/icon-48.png", 11 | "128": "images/icon-128.png" 12 | }, 13 | "default_locale": "en", 14 | "background": { 15 | "scripts": [ 16 | "js/background.js" 17 | ], 18 | "persistent": false 19 | }, 20 | "options_page": "html/options.html", 21 | "page_action": { 22 | "default_icon": "images/icon-19.png", 23 | "default_title": "Colorful labels for Workflowy", 24 | "default_popup": "html/options.html" 25 | }, 26 | "permissions" : [ 27 | "declarativeContent", "storage" 28 | ], 29 | "content_scripts": [ 30 | { 31 | "matches": [ "https://workflowy.com/", "http://workflowy.com/" ], 32 | "js": [ "js/lib/jquery.min.js", "js/modules/common.js", "js/modules/options-data.js", "js/content.js" ] 33 | }, 34 | { 35 | "matches": [ "https://workflowy.com/", "http://workflowy.com/" ], 36 | "css": [ "css/content.css" ] 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /webstore/description.txt: -------------------------------------------------------------------------------- 1 | This extension allows the user to add colour to worKflowy tags. You can assign foreground and background colors to the label itself, the text or both. Tags and colors can be edited via the settings. 2 | 3 | This is the first version and there may be a few glitches especially in the configuration user interface. -------------------------------------------------------------------------------- /webstore/screenshot-640x400-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/webstore/screenshot-640x400-1.png -------------------------------------------------------------------------------- /webstore/screenshot-640x400-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chronakis/workflowy-color-labels/c8fa77975ed9d2b7c4e9dd49b42d97f2b4448dc2/webstore/screenshot-640x400-2.png --------------------------------------------------------------------------------