├── .gitignore ├── LICENSE ├── README.md ├── board_webext ├── editor │ ├── fonts │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff │ ├── minislate-full.css │ └── minislate.js ├── icons │ ├── LICENSE │ ├── logo_128.png │ ├── logo_32.png │ ├── logo_48.png │ └── logo_64.png ├── index.html └── manifest.json ├── cameraApi └── index.html ├── dateDiff ├── icons │ ├── icon_32.png │ └── icon_48.png ├── manifest.json └── popup │ ├── date.html │ ├── flatpickr.js │ └── flatpickr.min.css ├── fbBlocker_webext ├── icons │ ├── logo_32.png │ ├── logo_48.png │ └── logo_64.png ├── manifest.json ├── options.html ├── options.js └── stopIt.js ├── floatingSticky_webext ├── background.js ├── cs.js ├── logo │ ├── icon.ico │ ├── paper_128.png │ └── paper_64.png └── manifest.json ├── fullScreen_webext ├── cs.js ├── icon.png ├── logo_128.png └── manifest.json ├── funFacts_webext ├── icons │ ├── logo_32.png │ ├── logo_48.png │ └── logo_64.png ├── manifest.json └── popup │ ├── cn.gif │ ├── index.html │ ├── script.js │ └── style.css ├── handleFileEvent ├── index.html └── readme.md ├── ipFinder_webext ├── background.js ├── icons │ ├── .DS_Store │ ├── LICENSE │ ├── icon.png │ └── myip.png ├── manifest.json └── popup │ ├── .DS_Store │ ├── index.html │ └── popup.js ├── lazyYoutube_chrome_ext ├── bg.js ├── cs.js ├── icons │ ├── LICENSE │ └── icon.png └── manifest.json ├── measureIt_webext ├── bg.js ├── cs.js ├── icons │ ├── LICENSE │ ├── button.png │ ├── icon_128.png │ ├── icon_32.png │ ├── icon_48.png │ └── icon_64.png └── manifest.json ├── multicopy_webext ├── bg.js ├── cs.js ├── icons │ ├── LICENSE │ ├── icon_128.png │ ├── icon_32.png │ ├── icon_64.png │ ├── paste.png │ └── paste_old.png ├── manifest.json ├── options.html ├── options.js └── polyfill.js ├── reminders_webext ├── bg.js ├── icons │ ├── LICENSE │ ├── icon_128.png │ ├── icon_32.png │ ├── icon_64.png │ ├── logo_128.png │ ├── logo_32.png │ └── logo_64.png ├── index.html ├── manifest.json ├── reminder.css └── reminder.js ├── stickyNotes_webext ├── icons │ ├── logo_128.png │ ├── logo_32.png │ ├── logo_48.png │ └── logo_64.png ├── manifest.json └── popup │ ├── getMe.js │ └── go.html ├── ticTacToe_webext ├── icons │ ├── .DS_Store │ ├── logo_32.png │ └── logo_48.png ├── manifest.json └── popup │ ├── .DS_Store │ ├── play.html │ └── play.js ├── todo_webext ├── icons │ ├── LICENSE │ ├── logo_32.png │ └── logo_64.png ├── manifest.json └── popup │ ├── index.html │ └── script.js ├── togglePassword_webext ├── chrome │ ├── bg.js │ ├── cs.js │ ├── icons │ │ ├── LICENSE │ │ ├── icon_128.png │ │ ├── icon_32.png │ │ ├── icon_48.png │ │ └── icon_64.png │ └── manifest.json └── ff │ ├── _locales │ ├── de │ │ └── messages.json │ └── en │ │ └── messages.json │ ├── bg.js │ ├── cs.js │ ├── icons │ ├── LICENSE │ ├── icon_128.png │ ├── icon_32.png │ ├── icon_48.png │ └── icon_64.png │ ├── manifest.json │ ├── options.html │ └── options.js └── wordCount_webext ├── background.js ├── chrome ├── background.js ├── icons │ ├── LICENSE │ ├── icon_128.png │ ├── icon_32.png │ └── icon_64.png └── manifest.json ├── cs.js ├── icons ├── LICENSE ├── icon_32.png ├── icon_48.png ├── icon_64.png └── icon_96.png └── manifest.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | **/.DS_Store 3 | /.DS_Store 4 | **/*.zip 5 | __MACOSX/ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 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 | # jsDemos 2 | 3 | ### Home page for all listed extensions, if you have any suggestions/bugs, please file an issue in this repo or click [here](https://github.com/tsl143/jsDemos/issues/new) 4 | 5 | Demos for various JS functions also code repo for various webextensions submitted to addons.mozilla.org by Trishul 6 | 7 | 8 | ## Webextenstions list and functionality used 9 | * board_webext - newtab capture, page modifier, storageAPI, tabs API 10 | * fbBlocker_webext - Intercept HTTP request, webrequest, notification API, options page example, storageAPI 11 | * todo_webext - storageAPI, browserACtion API, popup handeling 12 | * FunFacts - browserAction API, popup page, XHR handeling, third party API integration 13 | * tictacTow_webext - pure JS AI based tic tac toe game, panel integration 14 | * ipBlocker_webext - pageAction API, XHR, pageAction Popup 15 | * floatingSticky_webext - contentScript API, storage 16 | * maesureIt_webext - contentScript API, browserAction API 17 | * reminders_webext - Storage API, Notification API, BrowserAlarms, BrowserAction 18 | * wordCount_webext - ContextMenu API, Notification API 19 | -------------------------------------------------------------------------------- /board_webext/editor/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/editor/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /board_webext/editor/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/editor/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /board_webext/editor/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/editor/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /board_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | The logo Icon has been taken for free from "http://www.flaticon.com/free-icon/whiteboard_234633#term=board&page=1&position=24". 2 | -------------------------------------------------------------------------------- /board_webext/icons/logo_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/icons/logo_128.png -------------------------------------------------------------------------------- /board_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/icons/logo_32.png -------------------------------------------------------------------------------- /board_webext/icons/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/icons/logo_48.png -------------------------------------------------------------------------------- /board_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/board_webext/icons/logo_64.png -------------------------------------------------------------------------------- /board_webext/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Board 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /board_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Board: Papier for Firefox", 4 | "description": "Just start typing to scribble anything on the board, use it as todo, planning pad, notes anything.", 5 | "version": "1.1", 6 | "homepage_url": "https://github.com/tsl143/jsDemos/board_webext", 7 | 8 | "icons": { 9 | "32": "icons/logo_32.png", 10 | "48": "icons/logo_48.png", 11 | "64": "icons/logo_64.png" 12 | }, 13 | 14 | "web_accessible_resources": [ 15 | "index.html", 16 | "editor/*" 17 | ], 18 | 19 | "chrome_url_overrides": { 20 | "newtab": "index.html" 21 | }, 22 | 23 | "chrome_settings_overrides" : { 24 | "homepage": "index.html" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /cameraApi/index.html: -------------------------------------------------------------------------------- 1 | 2 |

Say Cheese!

3 | 4 | 9 | 10 | 11 | 12 | 13 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /dateDiff/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/dateDiff/icons/icon_32.png -------------------------------------------------------------------------------- /dateDiff/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/dateDiff/icons/icon_48.png -------------------------------------------------------------------------------- /dateDiff/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "description": "Days diffence finder - Find number of days between two given dates (For explicitly lazy souls[like me] who think counting days is much hassle)", 4 | "manifest_version": 2, 5 | "name": "Date diff", 6 | "version": "1.0", 7 | "homepage_url": "https://github.com/tsl143/jsDemos/dateDiff", 8 | "icons": { 9 | "48": "icons/icon_48.png" 10 | }, 11 | 12 | "browser_action": { 13 | "default_icon": "icons/icon_32.png", 14 | "default_title": "Date Diff finder", 15 | "default_popup": "popup/date.html" 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /dateDiff/popup/date.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | CALCULATE RESET
14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dateDiff/popup/flatpickr.min.css: -------------------------------------------------------------------------------- 1 | .flatpickr-calendar{background:transparent;overflow:hidden;max-height:0;opacity:0;visibility:hidden;text-align:center;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:315px;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;visibility:visible;overflow:visible;max-height:640px}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px);}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.hasWeeks{width:auto}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.showTimeInput.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.rightMost:after{left:auto;right:22px}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:28px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden}.flatpickr-prev-month,.flatpickr-next-month{text-decoration:none;cursor:pointer;position:absolute;top:0;line-height:16px;height:28px;padding:10px calc(3.57% - 1.5px);z-index:3;}.flatpickr-prev-month i,.flatpickr-next-month i{position:relative}.flatpickr-prev-month.flatpickr-prev-month,.flatpickr-next-month.flatpickr-prev-month{/* 2 | /*rtl:begin:ignore*/left:0;/* 3 | /*rtl:end:ignore*/}/* 4 | /*rtl:begin:ignore*/ 5 | /* 6 | /*rtl:end:ignore*/ 7 | .flatpickr-prev-month.flatpickr-next-month,.flatpickr-next-month.flatpickr-next-month{/* 8 | /*rtl:begin:ignore*/right:0;/* 9 | /*rtl:end:ignore*/}/* 10 | /*rtl:begin:ignore*/ 11 | /* 12 | /*rtl:end:ignore*/ 13 | .flatpickr-prev-month:hover,.flatpickr-next-month:hover{color:#959ea9;}.flatpickr-prev-month:hover svg,.flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-prev-month svg,.flatpickr-next-month svg{width:14px;}.flatpickr-prev-month svg path,.flatpickr-next-month svg path{transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto;}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.05);box-sizing:border-box;}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute;top:33%}.numInputWrapper span.arrowUp{top:0;border-bottom:0;}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6)}.numInputWrapper span.arrowDown{top:50%;}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6)}.numInputWrapper span svg{width:inherit;height:auto;}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05);}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:6.16px 0 0 0;line-height:1;height:28px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);}.flatpickr-current-month.slideLeft{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);-webkit-animation:fpFadeOut 400ms ease,fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms ease,fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideLeftNew{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);-webkit-animation:fpFadeIn 400ms ease,fpSlideLeftNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms ease,fpSlideLeftNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRight{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);-webkit-animation:fpFadeOut 400ms ease,fpSlideRight 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms ease,fpSlideRight 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month.slideRightNew{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);-webkit-animation:fpFadeIn 400ms ease,fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms ease,fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0;}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block;}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;box-sizing:border-box;color:inherit;cursor:default;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:initial;border:0;border-radius:0;vertical-align:initial;}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:315px;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-flex;display:-ms-flexbox;display:flex;width:315px;}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:315px;min-width:315px;max-width:315px;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.flatpickr-calendar.animate .dayContainer.slideLeft{-webkit-animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideLeft,.flatpickr-calendar.animate .dayContainer.slideLeftNew{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.flatpickr-calendar.animate .dayContainer.slideLeftNew{-webkit-animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideLeft 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.animate .dayContainer.slideRight{-webkit-animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideRight 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeOut 400ms cubic-bezier(.23,1,.32,1),fpSlideRight 400ms cubic-bezier(.23,1,.32,1);-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.flatpickr-calendar.animate .dayContainer.slideRightNew{-webkit-animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1);animation:fpFadeIn 400ms cubic-bezier(.23,1,.32,1),fpSlideRightNew 400ms cubic-bezier(.23,1,.32,1)}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:40px;height:40px;line-height:40px;margin:0;display:inline-block;position:relative;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9;}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange,.flatpickr-day.startRange.startRange + .endRange,.flatpickr-day.endRange.startRange + .endRange{box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.disabled,.flatpickr-day.disabled:hover{pointer-events:none}.flatpickr-day.disabled,.flatpickr-day.disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.week.selected{border-radius:0;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{display:inline-block;float:left;}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day{display:block;width:100%;max-width:none}.flatpickr-innerContainer{display:block;display:-webkit-flex;display:-ms-flexbox;display:flex;box-sizing:border-box;overflow:hidden;}.flatpickr-rContainer{display:inline-block;padding:0;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;box-sizing:border-box;overflow:hidden;display:-webkit-flex;display:-ms-flexbox;display:flex;}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left;}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;cursor:pointer;color:#393939;font-size:14px;position:relative;box-sizing:border-box;}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;display:inline-block;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;-ms-grid-row-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400;}.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time .flatpickr-am-pm:focus{background:#f0f0f0}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpSlideLeft{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@keyframes fpSlideLeft{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}}@-webkit-keyframes fpSlideLeftNew{from{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpSlideLeftNew{from{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpSlideRight{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@keyframes fpSlideRight{from{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}}@-webkit-keyframes fpSlideRightNew{from{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpSlideRightNew{from{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@-webkit-keyframes fpFadeOut{from{opacity:1}to{opacity:0}}@keyframes fpFadeOut{from{opacity:1}to{opacity:0}}@-webkit-keyframes fpFadeIn{from{opacity:0}to{opacity:1}}@keyframes fpFadeIn{from{opacity:0}to{opacity:1}} 14 | 15 | 16 | .flatpickr{ 17 | margin: 10px auto; 18 | padding: 3px 5px; 19 | } 20 | .buttonOps { 21 | display: inline-block; 22 | width: 100px; 23 | margin: 10px 20px; 24 | background: #777; 25 | padding: 5px 10px; 26 | color: #fff; 27 | text-decoration: none; 28 | } 29 | 30 | #results { 31 | background: #b7b7b7; 32 | padding: 10px; 33 | margin: 10px; 34 | display: inline-block; 35 | } -------------------------------------------------------------------------------- /fbBlocker_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/fbBlocker_webext/icons/logo_32.png -------------------------------------------------------------------------------- /fbBlocker_webext/icons/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/fbBlocker_webext/icons/logo_48.png -------------------------------------------------------------------------------- /fbBlocker_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/fbBlocker_webext/icons/logo_64.png -------------------------------------------------------------------------------- /fbBlocker_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "manifest_version": 2, 4 | "name": "Facebook Blocker", 5 | "description": "Blocks the Facebook for given time period, For the self motivated people who dont want to get distracted duing work hours", 6 | "version": "2.6", 7 | 8 | "homepage_url": "https://github.com/tsl143/jsDemos/fbBlocker_webext", 9 | "icons": { 10 | "32": "icons/logo_32.png", 11 | "48": "icons/logo_48.png", 12 | "64": "icons/logo_64.png" 13 | }, 14 | 15 | "background": { 16 | "scripts": ["stopIt.js"] 17 | }, 18 | 19 | "options_ui": { 20 | "page": "options.html", 21 | "browser_style": true 22 | }, 23 | 24 | "permissions": [ 25 | "webRequest", 26 | "webRequestBlocking", 27 | "", 28 | "notifications", 29 | "storage" 30 | ] 31 | 32 | } 33 | -------------------------------------------------------------------------------- /fbBlocker_webext/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 46 | 47 | 48 | 49 |
50 |
51 | Select your distraction free hours!!!
52 | The clock time is 24 hrs 53 |
54 |
55 |
56 | 57 | 58 | 59 | 60 | FROM 61 | 62 |
63 |
64 | 65 | 66 |
67 | 68 | TO 69 | 70 |
71 | 72 |
73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /fbBlocker_webext/options.js: -------------------------------------------------------------------------------- 1 | function saveOptions(e) { 2 | e.preventDefault(); 3 | const fromH = document.querySelector("#fromTime").value; 4 | const toH = document.querySelector("#toTime").value; 5 | browser.storage.local.set({blockHrsTSL:{ 6 | fromHrs: fromH, 7 | toHrs: toH 8 | } 9 | }); 10 | alert("Settings Saved"); 11 | } 12 | 13 | function setForm() { 14 | const fromTimeBox = document.querySelector("#fromTime"); 15 | const toTimeBox = document.querySelector("#toTime"); 16 | for(let i=0; i<=24; i++) { 17 | const o1 = document.createElement('option'); 18 | const o2 = document.createElement('option'); 19 | o1.value = i; o2.value = i; 20 | o1.textContent = i; o2.textContent = i; 21 | fromTimeBox.appendChild(o1); 22 | toTimeBox.appendChild(o2); 23 | } 24 | 25 | var gettingItem = browser.storage.local.get('blockHrsTSL'); 26 | gettingItem.then((res) => { 27 | if(res.blockHrsTSL){ 28 | let fromTime = res.blockHrsTSL.fromHrs || 0; 29 | let toTime = res.blockHrsTSL.toHrs || 0; 30 | fromTimeBox.value = fromTime; 31 | toTimeBox.value = toTime; 32 | } 33 | }); 34 | } 35 | 36 | document.addEventListener("DOMContentLoaded", setForm); 37 | document.querySelector("#submit").addEventListener("click", saveOptions); -------------------------------------------------------------------------------- /fbBlocker_webext/stopIt.js: -------------------------------------------------------------------------------- 1 | //adding hook to request 2 | browser.webRequest.onBeforeRequest.addListener( 3 | handleHTTPRequest, 4 | {urls:["https://facebook.com/*","http://facebook.com/*","https://www.facebook.com/*","http://www.facebook.com/*"]}, 5 | ["blocking"] 6 | ); 7 | 8 | 9 | //function to create notification 10 | function notifyUser(fromTime, toTime){ 11 | browser.notifications.create({ 12 | "type": "basic", 13 | "iconUrl": "icons/logo_64.png", 14 | "title": "Facebook Blocked", 15 | "message": `Facebook has been blocked from ${fromTime} hrs to ${toTime} hrs` 16 | }); 17 | } 18 | 19 | //function to create promise and check if we should block the request or not 20 | function handleHTTPRequest(details) { 21 | 22 | let shallNotify = true; 23 | if(details.originUrl && details.originUrl !== 'undefined') 24 | shallNotify = false; 25 | const blockRequest = new Promise((resolve) => { 26 | gettingItem = browser.storage.local.get('blockHrsTSL'); 27 | gettingItem.then((res) => { 28 | if(res && res.blockHrsTSL) { 29 | let fromTime = res.blockHrsTSL.fromHrs || 0; 30 | let toTime = res.blockHrsTSL.toHrs || 0; 31 | 32 | if(fromTime == 0 && toTime == 0) resolve(false); 33 | 34 | if(isBlocked(fromTime, toTime)){ 35 | if(shallNotify) notifyUser(fromTime, toTime); 36 | resolve({ cancel: true }); 37 | } 38 | } 39 | 40 | resolve(false); 41 | }); 42 | }); 43 | return blockRequest; 44 | } 45 | 46 | function isBlocked(from, to){ 47 | 48 | const rightNowDate = new Date(); 49 | const rightNow = rightNowDate.getHours() * 60 + rightNowDate.getMinutes(); 50 | const fromTime = from * 60; 51 | const toTime = to * 60; 52 | 53 | if ( 54 | ( 55 | toTime < fromTime && 56 | ( 57 | (rightNow >= fromTime && rightNow <= 24*60) || 58 | (rightNow > 0 && rightNow <= toTime) 59 | ) 60 | ) || 61 | (rightNow >= fromTime && rightNow <= toTime) 62 | ) return true; 63 | else 64 | return false; 65 | } 66 | -------------------------------------------------------------------------------- /floatingSticky_webext/background.js: -------------------------------------------------------------------------------- 1 | const handleMessage = async (id, data) => { 2 | const tabs = await browser.tabs.get(id); 3 | if (tabs.url.startsWith('http')) browser.tabs.sendMessage(id,{ data }); 4 | } 5 | 6 | browser.browserAction.onClicked.addListener(tab=>{ 7 | handleMessage(tab.id,knockKnock); 8 | }); 9 | 10 | browser.tabs.onActivated.addListener(tab=>{ 11 | handleMessage(tab.tabId, 'iAmBack'); 12 | }); 13 | 14 | browser.tabs.onCreated.addListener(tab=>{ 15 | handleMessage(tab.tabId, 'iAmBack'); 16 | }); 17 | 18 | browser.tabs.onUpdated.addListener((tabId,c) =>{ 19 | handleMessage(tabId, 'iAmBack'); 20 | }); 21 | -------------------------------------------------------------------------------- /floatingSticky_webext/cs.js: -------------------------------------------------------------------------------- 1 | let onText = false; 2 | let onHandle = false; 3 | 4 | const createMemo = (stickyObj) => { 5 | 6 | if(document.getElementById('tslfs_DragMe')) 7 | document.getElementById('tslfs_DragMe').remove(); 8 | 9 | const newDiv = document.createElement('div'); 10 | const newText = document.createElement('textarea'); 11 | const newHandle = document.createElement('div'); 12 | const newClose = document.createElement('div'); 13 | 14 | newDiv.appendChild(newClose); 15 | newDiv.appendChild(newHandle); 16 | newDiv.appendChild(newText); 17 | 18 | newDiv.style.cssText = `position:fixed; 19 | z-index: 9999; 20 | height: 200px; 21 | width: 300px; 22 | border-radius: 2px; 23 | overflow: hidden; 24 | background: #FDF49F; 25 | left: calc; 26 | top:10px; 27 | box-shadow: 2px 2px 12px 2px #999`; 28 | 29 | newHandle.textContent="Drag Me"; 30 | newHandle.style.cssText=` 31 | background: #74D0EC; 32 | color: #444; 33 | line-height: 25px !important; 34 | font-weight: bold !important; 35 | text-align:center; 36 | cursor: pointer; 37 | font-family: Arial, sans-serif !important; 38 | font-size: 15px !important; 39 | `; 40 | 41 | newClose.textContent="X"; 42 | newClose.style.cssText=` 43 | color: #444; 44 | position: absolute; 45 | right: 5px; 46 | top: 5px; 47 | font-weight: bold !important; 48 | cursor: pointer; 49 | font-family: Arial, sans-serif !important; 50 | font-size: 15px !important; 51 | line-height: 15px !important; 52 | `; 53 | 54 | newText.style.cssText = ` 55 | background: #FDF49F; 56 | display: block; 57 | color: #444; 58 | height: calc(100% - 45px); 59 | width: calc(100% - 20px); 60 | padding: 10px; 61 | border: 0; 62 | overflow: auto; 63 | font-family: Arial, sans-serif !important; 64 | font-size: 15px !important; 65 | resize: none; 66 | line-height: 1.5 !important;`; 67 | 68 | newDiv.setAttribute("draggable", true); 69 | newDiv.setAttribute("id", 'tslfs_DragMe'); 70 | newText.setAttribute("id", 'tslfs_MyText'); 71 | 72 | if(stickyObj && (stickyObj.text || stickyObj.left || stickyObj.top)){ 73 | 74 | newText.value = stickyObj.text; 75 | newDiv.style.cssText += ` 76 | left: ${stickyObj.left}; 77 | top: ${stickyObj.top}; 78 | `; 79 | 80 | }else { 81 | newDiv.style.cssText += ` 82 | right: 10px; 83 | top: 10px; 84 | `; 85 | } 86 | function drag_start(event) { 87 | var style = window.getComputedStyle(event.target, null); 88 | event.dataTransfer.setData("text/plain", 89 | (parseInt(style.getPropertyValue("left"),10) - event.clientX) + ',' + (parseInt(style.getPropertyValue("top"),10) - event.clientY)); 90 | } 91 | function drag_over(event) { 92 | event.preventDefault(); 93 | return false; 94 | } 95 | function drop(event) { 96 | 97 | const offset = event.dataTransfer.getData("text/plain").split(','); 98 | newDiv.style.left = (event.clientX + parseInt(offset[0],10)) + 'px'; 99 | newDiv.style.top = (event.clientY + parseInt(offset[1],10)) + 'px'; 100 | event.preventDefault(); 101 | setData(true); 102 | return false; 103 | } 104 | 105 | function isEnter(event) { 106 | const id = event.target.getAttribute('id'); 107 | if(id=="tslfs_MyText") 108 | onText = true; 109 | if(id=="tslfs_DragMe") 110 | onHandle = true; 111 | handleDrag(); 112 | } 113 | 114 | function isLeave(event) { 115 | const id = event.target.getAttribute('id'); 116 | if(id=="tslfs_MyText") 117 | onText = false; 118 | if(id=="tslfs_DragMe") 119 | onHandle = false; 120 | handleDrag(); 121 | } 122 | 123 | function handleDrag() { 124 | if((onHandle && onText)) 125 | newDiv.draggable= false; 126 | else 127 | newDiv.draggable= true; 128 | } 129 | 130 | function closeSticky() { 131 | setData(false); 132 | newDiv.remove(); 133 | } 134 | 135 | function saveText() { 136 | setData(true); 137 | } 138 | 139 | function setData(isOpen){ 140 | 141 | const value = { 142 | isOpen: isOpen, 143 | text: newText.value, 144 | left: newDiv.style.left, 145 | top: newDiv.style.top, 146 | }; 147 | browser.storage.local.set({ tslStickies: value }); 148 | } 149 | 150 | document.body.appendChild(newDiv); 151 | 152 | newDiv.addEventListener('dragstart', drag_start, false); 153 | newDiv.addEventListener('mouseenter', isEnter, false); 154 | newDiv.addEventListener('mouseleave', isLeave, false); 155 | 156 | newText.addEventListener('keyup',saveText,false); 157 | newText.addEventListener('mouseenter', isEnter, false); 158 | newText.addEventListener('mouseleave', isLeave, false); 159 | 160 | newClose.addEventListener('click', closeSticky, false); 161 | 162 | document.body.addEventListener('dragover',drag_over,false); 163 | document.body.addEventListener('drop',drop,false); 164 | setData(true); 165 | }; 166 | 167 | function init(forceOpen){ 168 | const gettingItem = browser.storage.local.get('tslStickies'); 169 | 170 | gettingItem.then((res) => { 171 | try{ 172 | if(res.tslStickies){ 173 | const isOpen = res.tslStickies.isOpen; 174 | if(isOpen || forceOpen) 175 | createMemo(res.tslStickies); 176 | else 177 | document.getElementById('tslfs_DragMe').remove(); 178 | }else if(forceOpen){ 179 | createMemo(); 180 | } 181 | }catch(e){} 182 | }); 183 | } 184 | browser.runtime.onMessage.addListener(request=>{ 185 | switch (request.data){ 186 | case "knockKnock": 187 | init(true); 188 | break; 189 | 190 | case "iAmBack": 191 | init(); 192 | break; 193 | 194 | default: 195 | break; 196 | } 197 | }); 198 | 199 | 200 | -------------------------------------------------------------------------------- /floatingSticky_webext/logo/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/floatingSticky_webext/logo/icon.ico -------------------------------------------------------------------------------- /floatingSticky_webext/logo/paper_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/floatingSticky_webext/logo/paper_128.png -------------------------------------------------------------------------------- /floatingSticky_webext/logo/paper_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/floatingSticky_webext/logo/paper_64.png -------------------------------------------------------------------------------- /floatingSticky_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Floating Sticky", 4 | "version": "1.5", 5 | "description": "An extension to put a sticky note whereever you want on the browser.", 6 | "background": { 7 | "scripts": ["background.js"] 8 | }, 9 | "icons": { 10 | "64": "logo/paper_64.png", 11 | "128": "logo/paper_128.png" 12 | }, 13 | "content_scripts": [ 14 | { 15 | "matches": [""], 16 | "js": ["cs.js"] 17 | } 18 | ], 19 | "browser_action": { 20 | "default_icon": "logo/icon.ico", 21 | "default_title": "Floating Sticky", 22 | "browser_style": true 23 | }, 24 | "permissions": ["storage", "tabs"], 25 | "browser_specific_settings": { 26 | "gecko": { 27 | "id": "{964e45f5-76e0-4b80-9786-b7b15c14e819}" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /fullScreen_webext/cs.js: -------------------------------------------------------------------------------- 1 | const allowFullScreen = event => { 2 | event.preventDefault(); 3 | event = event || window.event; 4 | if (event.ctrlKey && event.keyCode == 70 && event.shiftKey) { 5 | if(document.documentElement.webkitRequestFullScreen) document.documentElement.webkitRequestFullScreen(); 6 | else if(document.documentElement.mozRequestFullScreen) document.documentElement.mozRequestFullScreen(); 7 | } 8 | } 9 | document.addEventListener('keyup', allowFullScreen) -------------------------------------------------------------------------------- /fullScreen_webext/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/fullScreen_webext/icon.png -------------------------------------------------------------------------------- /fullScreen_webext/logo_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/fullScreen_webext/logo_128.png -------------------------------------------------------------------------------- /fullScreen_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Fullscreen Plus", 4 | "description": "Full screen websites without address/tabs bar", 5 | "version": "2.0", 6 | "icons": { 7 | "64": "icon.png" 8 | }, 9 | "content_scripts": [ 10 | { 11 | "matches": [""], 12 | "js": ["cs.js"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /funFacts_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/funFacts_webext/icons/logo_32.png -------------------------------------------------------------------------------- /funFacts_webext/icons/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/funFacts_webext/icons/logo_48.png -------------------------------------------------------------------------------- /funFacts_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/funFacts_webext/icons/logo_64.png -------------------------------------------------------------------------------- /funFacts_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "description": "Chuck Norris facts :P ", 4 | "manifest_version": 2, 5 | "name": "Hail Chuck Norris", 6 | "version": "1.2", 7 | "homepage_url": "https://github.com/tsl143/jsDemos/FunFacts", 8 | "icons": { 9 | "64": "icons/logo_64.png", 10 | "48": "icons/logo_48.png" 11 | }, 12 | "browser_action": { 13 | "default_icon": "icons/logo_32.png", 14 | "default_title": "Hail Chuck Norris", 15 | "default_popup": "popup/go.html", 16 | "browser_style": true 17 | }, 18 | "web_accessible_resources": [ 19 | "popup/cn.gif" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /funFacts_webext/popup/cn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/funFacts_webext/popup/cn.gif -------------------------------------------------------------------------------- /funFacts_webext/popup/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 |
13 | Loading... 14 |
15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /funFacts_webext/popup/script.js: -------------------------------------------------------------------------------- 1 | /* API CORTESY - http://www.icndb.com/on-your-website/ */ 2 | 3 | var oReq = new XMLHttpRequest(); 4 | oReq.open("GET", "http://api.icndb.com/jokes/random/"); 5 | oReq.send(); 6 | oReq.onreadystatechange = function() 7 | { 8 | if(oReq.readyState == 4) 9 | { 10 | var target = document.getElementById("itsAFact"); 11 | if(oReq.status == 200) 12 | { 13 | try{ 14 | 15 | var response=(JSON.parse(oReq.responseText).value.joke); 16 | 17 | target.innerText = response; 18 | 19 | }catch(e){ 20 | target.innerHTML = "Oops, something went wrong :( "; 21 | } 22 | 23 | } 24 | else 25 | target.innerHTML = "Oops, something went wrong :( "; 26 | 27 | target.style="background: #b8b898;"; 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /funFacts_webext/popup/style.css: -------------------------------------------------------------------------------- 1 | #itsAFact { 2 | font-size: 18px; 3 | min-width: 300px; 4 | max-width: 500px; 5 | text-align: center; 6 | padding: 20px; 7 | } -------------------------------------------------------------------------------- /handleFileEvent/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Handle Cancel and Open for file input 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 35 | 36 | -------------------------------------------------------------------------------- /handleFileEvent/readme.md: -------------------------------------------------------------------------------- 1 | Demo to handle Cancel and Submit events of Browse File dialog box. 2 | 3 | Reference - http://stackoverflow.com/questions/4628544/how-to-detect-when-cancel-is-clicked-on-file-input 4 | -------------------------------------------------------------------------------- /ipFinder_webext/background.js: -------------------------------------------------------------------------------- 1 | 2 | // Setup the page action (icon, title) 3 | function initializePageAction(tab) { 4 | 5 | chrome.pageAction.setIcon({tabId: tab.id, path: "icons/icon.png"}); 6 | chrome.pageAction.setTitle({tabId: tab.id, title: "My IP"}); 7 | chrome.pageAction.show(tab.id); 8 | chrome.pageAction.setPopup({ 9 | tabId: tab.id, 10 | popup: "popup/index.html" 11 | }); 12 | } 13 | 14 | // initialize page acion on each tab update 15 | chrome.tabs.onUpdated.addListener((id, changeInfo, tab) => { 16 | initializePageAction(tab); 17 | }); 18 | -------------------------------------------------------------------------------- /ipFinder_webext/icons/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ipFinder_webext/icons/.DS_Store -------------------------------------------------------------------------------- /ipFinder_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by [https://www.flaticon.com/authors/flat-icons]Flat Icons from www.flaticon.com is licensed by [http://creativecommons.org/licenses/by/3.0/] Creative Commons BY 3.0 2 | -------------------------------------------------------------------------------- /ipFinder_webext/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ipFinder_webext/icons/icon.png -------------------------------------------------------------------------------- /ipFinder_webext/icons/myip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ipFinder_webext/icons/myip.png -------------------------------------------------------------------------------- /ipFinder_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "description": "Find the IP of given website along with other details", 4 | "manifest_version": 2, 5 | "name": "IP finder", 6 | "version": "1.1", 7 | "homepage_url": "https://github.com/tsl143/jsDemos/", 8 | 9 | "background": { 10 | "scripts": ["background.js"] 11 | }, 12 | "icons": { 13 | "64": "icons/icon.png" 14 | }, 15 | "page_action": { 16 | "default_icon": "icons/icon.png", 17 | "browser_style": true 18 | }, 19 | 20 | "permissions": [ 21 | "tabs", 22 | "" 23 | ] 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ipFinder_webext/popup/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ipFinder_webext/popup/.DS_Store -------------------------------------------------------------------------------- /ipFinder_webext/popup/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 45 | 46 | 47 | 48 |
49 |

...LOADING...

50 |
51 |
52 | MYIP.MS 53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /ipFinder_webext/popup/popup.js: -------------------------------------------------------------------------------- 1 | chrome.tabs.query({ 2 | active: true, 3 | currentWindow: true 4 | }, function (tabs) { 5 | 6 | const url = tabs[0].url.split('?')[0] ; 7 | const holderObj = document.querySelector('#holder'); 8 | const tableObj = document.createElement('table'); 9 | const XHR = new XMLHttpRequest(); 10 | const hexedURL = stringToHex(url); 11 | 12 | XHR.open('GET', `http://plugin.myip.ms/hex_${hexedURL}`, true); 13 | XHR.send(); 14 | XHR.onreadystatechange = function(){ 15 | try{ 16 | if (XHR.readyState == 4 && XHR.status == 200){ 17 | const result = JSON.parse(XHR.responseText); 18 | 19 | if(result.domain && result.domain!="") 20 | tableObj.appendChild(createTRNode('Domain Name', result.domain)); 21 | if(result.ip && result.ip!="") 22 | tableObj.appendChild(createTRNode('IP', result.ip, true)); 23 | if(result.ipv4 && result.ipv4!="") 24 | tableObj.appendChild(createTRNode('IPV4', result.ipv4)); 25 | if(result.ipv6 && result.ipv6!="") 26 | tableObj.appendChild(createTRNode('IPV6', result.ipv6)); 27 | if(result.hosting && result.hosting!="") 28 | tableObj.appendChild(createTRNode('Hosted By', result.hosting)); 29 | if(result.owners && result.owners!="") 30 | tableObj.appendChild(createTRNode('Owners', result.owners)); 31 | if(result.countryName && result.countryName!="") 32 | tableObj.appendChild(createTRNode('Country', result.countryName)); 33 | if(result.host && result.host!="") 34 | tableObj.appendChild(createTRNode('Host', result.host)); 35 | if(result.ns && result.ns!="") 36 | tableObj.appendChild(createTRNode('Name Servers', result.ns)); 37 | 38 | document.getElementsByTagName('h3')[0].remove(); 39 | holderObj.appendChild(tableObj); 40 | } 41 | }catch(e) { 42 | document.querySelector('#holder').textContent = "Something went Wrong!"; 43 | } 44 | 45 | } 46 | }); 47 | 48 | function createTRNode(label, value, isIPNode){ 49 | const tr = document.createElement('tr'); 50 | const tdLabel = document.createElement('td'); 51 | const tdValue = document.createElement('td'); 52 | tdLabel.textContent = label; 53 | tr.appendChild(tdLabel); 54 | tr.appendChild(processNode(tdValue, value, isIPNode)); 55 | return tr; 56 | } 57 | 58 | 59 | 60 | function strip(string){ 61 | return string.split("<").map(function(d){ return d.split(">").pop(); }).join(""); 62 | } 63 | 64 | function processNode(obj, str, isIPNode){ 65 | const dirtyNode = str.split('
  • '); 66 | dirtyNode.forEach(eachNode => { 67 | const pTag = document.createElement('p'); 68 | if(isIPNode){ 69 | const aTag = document.createElement('a'); 70 | aTag.setAttribute('href',`http://myip.ms/info/whois/${strip(eachNode)}/`); 71 | aTag.setAttribute('target',`_blank`); 72 | aTag.textContent = strip(eachNode); 73 | pTag.appendChild(aTag); 74 | }else{ 75 | pTag.textContent = strip(eachNode); 76 | } 77 | obj.appendChild(pTag); 78 | }); 79 | return obj; 80 | } 81 | 82 | function stringToHex(s) 83 | { 84 | s = unescape(encodeURIComponent(s)); 85 | var h = '', a; 86 | for(var i=0; i { 2 | browser.tabs.executeScript(tab.Id, {file: 'cs.js'}); 3 | }); -------------------------------------------------------------------------------- /measureIt_webext/cs.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | let x1 = 0; 3 | let x2 = 0; 4 | let y1 = 0; 5 | let y2 = 0; 6 | let drawIt = false; 7 | 8 | const manipulators = { 9 | 10 | 11 | selector: document.createElement('div'), 12 | upperLabel: document.createElement('span'), 13 | lowerLabel: document.createElement('span'), 14 | overlay: document.createElement('div'), 15 | 16 | init: () => { 17 | manipulators.initializeOverlay(); 18 | manipulators.initializeSelector(); 19 | manipulators.initializeLabels(); 20 | }, 21 | 22 | initializeSelector(){ 23 | manipulators.selector.setAttribute("id", 'tslSelector'); 24 | manipulators.selector.style.cssText=` 25 | background: rgba(255,255,0,0.3); 26 | border: 1px dashed #444; 27 | position: absolute; 28 | z-index: 9999; 29 | `; 30 | manipulators.overlay.appendChild(manipulators.selector); 31 | manipulators.selector.addEventListener('mousedown',manipulators.mDown,false); 32 | manipulators.selector.addEventListener('mouseup',manipulators.mUp,false); 33 | manipulators.selector.addEventListener('mousemove',manipulators.mMove,false); 34 | }, 35 | 36 | initializeOverlay: () => { 37 | manipulators.overlay.setAttribute("id", 'tslOverlay'); 38 | manipulators.overlay.style.cssText=` 39 | height: 100vh; 40 | left: 0; 41 | right: 0; 42 | top:0; 43 | position: fixed; 44 | cursor: crosshair; 45 | z-index: 9998; 46 | background: rgba(0,0,0,0.4); 47 | `; 48 | document.body.appendChild(manipulators.overlay); 49 | 50 | manipulators.overlay.addEventListener('mousedown',manipulators.mDown,false); 51 | manipulators.overlay.addEventListener('mouseup',manipulators.mUp,false); 52 | manipulators.overlay.addEventListener('mousemove',manipulators.mMove,false); 53 | }, 54 | 55 | initializeLabels: () => { 56 | manipulators.lowerLabel.setAttribute("id", 'tslLowerLabel'); 57 | manipulators.upperLabel.setAttribute("id", 'tslUpperLabel'); 58 | manipulators.lowerLabel.style.cssText=` 59 | position: absolute; 60 | bottom: -5px; 61 | font-size: 12px !important; 62 | font-family: Arial !important; 63 | background: #fff; 64 | left: -33px; 65 | `; 66 | manipulators.upperLabel.style.cssText=` 67 | position: absolute; 68 | top: -16px; 69 | font-size: 12px !important; 70 | font-family: Arial !important; 71 | background: #fff; 72 | right: 0; 73 | `; 74 | manipulators.selector.appendChild(manipulators.lowerLabel); 75 | manipulators.selector.appendChild(manipulators.upperLabel); 76 | }, 77 | 78 | destroy: () => { 79 | manipulators.overlay.remove(); 80 | }, 81 | 82 | drawSelector: () => { 83 | if(!drawIt) 84 | return false; 85 | 86 | const height = Math.abs(parseInt(y2, 10) - parseInt(y1, 10)); 87 | const width = Math.abs(parseInt(x2, 10) - parseInt(x1, 10)); 88 | let left = x1+"px"; 89 | let top = y1+"px"; 90 | 91 | if(x2 < x1) 92 | left = x2+"px"; 93 | 94 | if(y2 < y1) 95 | top = y2+"px"; 96 | 97 | manipulators.selector.style.left=left; 98 | manipulators.selector.style.top=top; 99 | manipulators.selector.style.height=height+"px"; 100 | manipulators.selector.style.width=width+"px"; 101 | 102 | if(width > 3 && height > 3){ 103 | manipulators.upperLabel.textContent = width+"px"; 104 | manipulators.lowerLabel.textContent = height+"px"; 105 | }else{ 106 | manipulators.upperLabel.textContent = ""; 107 | manipulators.lowerLabel.textContent = ""; 108 | } 109 | }, 110 | 111 | mDown: (e) => { 112 | drawIt = true; 113 | x1 = e.clientX; 114 | y1 = e.clientY; 115 | manipulators.drawSelector(); 116 | }, 117 | 118 | mUp: (e) => { 119 | drawIt = false; 120 | }, 121 | 122 | mMove: (e) => { 123 | x2 = e.clientX; 124 | y2 = e.clientY; 125 | 126 | if(drawIt) 127 | manipulators.drawSelector(); 128 | } 129 | } 130 | 131 | letsGo = () => { 132 | 133 | if(document.getElementById('tslOverlay')) 134 | document.getElementById('tslOverlay').remove(); 135 | else 136 | manipulators.init(); 137 | 138 | document.body.addEventListener('keyup',(e)=>{ 139 | if (e.keyCode === 27) 140 | manipulators.destroy(); 141 | }); 142 | 143 | } 144 | 145 | letsGo(); 146 | })(); -------------------------------------------------------------------------------- /measureIt_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by "http://www.freepik.com" from "www.flaticon.com" is licensed by Creative Commons BY 3.0 -------------------------------------------------------------------------------- /measureIt_webext/icons/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/measureIt_webext/icons/button.png -------------------------------------------------------------------------------- /measureIt_webext/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/measureIt_webext/icons/icon_128.png -------------------------------------------------------------------------------- /measureIt_webext/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/measureIt_webext/icons/icon_32.png -------------------------------------------------------------------------------- /measureIt_webext/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/measureIt_webext/icons/icon_48.png -------------------------------------------------------------------------------- /measureIt_webext/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/measureIt_webext/icons/icon_64.png -------------------------------------------------------------------------------- /measureIt_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Measure-it", 4 | "description": "Draw a ruler across any webpage to check the width, height, or alignment of page elements in pixels.", 5 | "version": "2.0", 6 | "icons": { 7 | "32": "icons/icon_32.png", 8 | "64": "icons/icon_64.png", 9 | "48": "icons/icon_48.png", 10 | "128": "icons/icon_128.png" 11 | }, 12 | "browser_action": { 13 | "default_icon": "icons/icon_32.png", 14 | "default_title": "Measure-it" 15 | }, 16 | "background": { 17 | "scripts": ["bg.js"] 18 | }, 19 | "permissions": ["activeTab"] 20 | } 21 | -------------------------------------------------------------------------------- /multicopy_webext/bg.js: -------------------------------------------------------------------------------- 1 | const CONSTANTS = { 2 | copyMenuId: 'copyMe', 3 | max: 10 4 | } 5 | 6 | const closeNotification = notificationId => { 7 | chrome.notifications.clear(notificationId); 8 | } 9 | 10 | const makeid = () => { 11 | let text = ''; 12 | var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 13 | for (let i = 0; i < 5; i++) 14 | text += possible.charAt(Math.floor(Math.random() * possible.length)); 15 | return text; 16 | } 17 | 18 | const notRestricted = (tab) => { 19 | const {url} = tab[0]; 20 | if(!url.includes('http') || url.includes('addons.mozilla.org')) { 21 | chrome.notifications.create(makeid(), { 22 | "type": "basic", 23 | "title": "Not Supported", 24 | "iconUrl": chrome.runtime.getURL('icons/icon_64.png'), 25 | "message": "Cannot paste on this URL (browser restricted)" 26 | }); 27 | return false; 28 | } 29 | return true; 30 | } 31 | 32 | const createBaseMenu = () => { 33 | const mainMenuObj = { 34 | id: CONSTANTS.copyMenuId, 35 | title: 'Copy This', 36 | contexts: ["selection"] 37 | } 38 | if (isFirefox) mainMenuObj.icons = {"32": chrome.runtime.getURL('icons/icon_32.png')}; 39 | chrome.contextMenus.create(mainMenuObj); 40 | 41 | chrome.contextMenus.create({ 42 | id: "separator", 43 | type: "separator", 44 | contexts: ["selection", "editable"] 45 | }); 46 | } 47 | 48 | const setMenus = multicopy => { 49 | const { texts:menus = [], max = CONSTANTS.max } = multicopy; 50 | chrome.contextMenus.removeAll(); 51 | createBaseMenu(); 52 | menus.forEach((menu, index) => { 53 | if (index < max) { 54 | const menuObj = { 55 | id: menu.id, 56 | title: menu.copyText, 57 | contexts: ["all"] 58 | } 59 | if (isFirefox) menuObj.icons = {"32": chrome.runtime.getURL('icons/paste.png')}; 60 | chrome.contextMenus.create(menuObj); 61 | } 62 | }) 63 | } 64 | 65 | const copyThis = copyText => { 66 | localStore.get('multicopy') 67 | .then((res = {}) => { 68 | const { multicopy = {} } = res; 69 | const { texts = [], max } = multicopy; 70 | // add element to top of array 71 | texts.unshift({id: makeid(), copyText}) 72 | multicopy.texts = texts; 73 | setMenus(multicopy); 74 | localStore.set({ multicopy }) 75 | }) 76 | } 77 | 78 | const pasteHere = id => { 79 | localStore.get('multicopy') 80 | .then((res = {}) => { 81 | const { multicopy = {} } = res; 82 | const { texts = []} = multicopy; 83 | const thePaste = texts.filter(t => t.id == id); 84 | try { 85 | tabs.query({currentWindow: true, active: true}) 86 | .then((tab) => { 87 | if (notRestricted(tab)){ 88 | chrome.tabs.executeScript(tab.id, {code: `multicopyCurrent = \`${thePaste[0].copyText}\`;`}); 89 | chrome.tabs.executeScript(tab.id, {file: 'cs.js'}); 90 | } 91 | }) 92 | } catch(e) {console.log(e)} 93 | }); 94 | } 95 | 96 | const copyPaste = ({menuItemId, selectionText = ''}) => { 97 | if (!menuItemId) return; 98 | if (menuItemId == CONSTANTS.copyMenuId) 99 | copyThis(selectionText); 100 | else 101 | pasteHere(menuItemId) 102 | } 103 | 104 | const init = () => { 105 | localStore.get('multicopy') 106 | .then((res = {}) => { 107 | const { multicopy = {} } = res; 108 | setMenus(multicopy) 109 | }); 110 | } 111 | 112 | createBaseMenu(); 113 | init(); 114 | 115 | chrome.contextMenus.onClicked.addListener(copyPaste); 116 | chrome.notifications.onClicked.addListener(closeNotification); 117 | chrome.runtime.onMessage.addListener(init); 118 | -------------------------------------------------------------------------------- /multicopy_webext/cs.js: -------------------------------------------------------------------------------- 1 | 2 | (function(){ 3 | try { 4 | if(document.activeElement.hasAttribute('contentEditable')) 5 | document.activeElement.textContent += multicopyCurrent; 6 | else 7 | document.activeElement.value += multicopyCurrent; 8 | 9 | navigator.clipboard.writeText(multicopyCurrent); 10 | } catch(e) { 11 | console.log('clipboard API not supported on http page or older than 61') 12 | } 13 | })() 14 | -------------------------------------------------------------------------------- /multicopy_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by "http://www.freepik.com" from "www.flaticon.com" is licensed by Creative Commons BY 3.0 -------------------------------------------------------------------------------- /multicopy_webext/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/multicopy_webext/icons/icon_128.png -------------------------------------------------------------------------------- /multicopy_webext/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/multicopy_webext/icons/icon_32.png -------------------------------------------------------------------------------- /multicopy_webext/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/multicopy_webext/icons/icon_64.png -------------------------------------------------------------------------------- /multicopy_webext/icons/paste.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/multicopy_webext/icons/paste.png -------------------------------------------------------------------------------- /multicopy_webext/icons/paste_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/multicopy_webext/icons/paste_old.png -------------------------------------------------------------------------------- /multicopy_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Multicopy", 4 | "description": "Copy multiple texts and do multiple pastes from right click menu", 5 | "version": "1.0.0", 6 | "applications": { 7 | "gecko": { 8 | "id": "multicopy@trishul" 9 | } 10 | }, 11 | "icons": { 12 | "32": "icons/icon_32.png", 13 | "64": "icons/icon_64.png", 14 | "128": "icons/icon_128.png" 15 | }, 16 | "background": { 17 | "scripts": ["polyfill.js", "bg.js"] 18 | }, 19 | "options_ui": { 20 | "page": "options.html", 21 | "browser_style": true 22 | }, 23 | "permissions": ["contextMenus", "activeTab", "notifications", "storage", "clipboardWrite"], 24 | "web_accessible_resources": [ 25 | "icons/icon_64.png" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /multicopy_webext/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | 29 | 32 | 35 | 36 | 37 | 38 | 39 |
    30 | 31 | 33 | 34 |
    40 |
    41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /multicopy_webext/options.js: -------------------------------------------------------------------------------- 1 | const deleteMe = e => { 2 | localStore.get('multicopy') 3 | .then((res = {}) => { 4 | const { multicopy = {} } = res; 5 | const { texts = [], max = 10} = multicopy; 6 | const filterTexts = texts.filter(t => t.id != e.target.id); 7 | multicopy.texts = filterTexts; 8 | localStore.set({ multicopy }).then(updateContextMenu); 9 | setData(multicopy); 10 | }); 11 | } 12 | 13 | const createRow = (text, id) => { 14 | const tr = document.createElement('tr'); 15 | const td1 = document.createElement('td'); 16 | const td2 = document.createElement('td'); 17 | const button = document.createElement('button'); 18 | button.id = id 19 | td1.textContent = text; 20 | button.textContent = 'Delete'; 21 | button.addEventListener('click', deleteMe) 22 | td2.appendChild(button); 23 | tr.appendChild(td1); 24 | tr.appendChild(td2); 25 | return tr; 26 | } 27 | 28 | const setData = multicopy => { 29 | const { texts = [], max = 10} = multicopy; 30 | document.getElementById('maxCopy').value = max; 31 | const tbl = document.getElementById('optionTable'); 32 | while (tbl.firstChild) { 33 | tbl.removeChild(tbl.firstChild); 34 | } 35 | const tr = document.createElement('tr'); 36 | const th1 = document.createElement('th'); 37 | const th2 = document.createElement('th'); 38 | th1.textContent = 'Copied Texts'; 39 | th2.textContent = 'Action'; 40 | tr.appendChild(th1); 41 | tr.appendChild(th2); 42 | tbl.appendChild(tr); 43 | texts.forEach(text => { 44 | tbl.appendChild(createRow(text.copyText, text.id)) 45 | }); 46 | } 47 | 48 | localStore.get('multicopy') 49 | .then((res = {}) => { 50 | const { multicopy = {} } = res; 51 | setData(multicopy); 52 | }); 53 | 54 | document.getElementById('maxCopy').addEventListener('keyup', e => { 55 | const ele = e.target; 56 | if(parseInt(ele.value) > 30) ele.value = 30; 57 | localStore.get('multicopy') 58 | .then((res = {}) => { 59 | const { multicopy = {} } = res; 60 | multicopy.max = ele.value; 61 | localStore.set({ multicopy }).then(updateContextMenu); 62 | }); 63 | }) 64 | 65 | document.getElementById('deleteAll').addEventListener('click', () => { 66 | localStore.get('multicopy') 67 | .then((res = {}) => { 68 | const { multicopy = {} } = res; 69 | multicopy.texts = []; 70 | localStore.set({ multicopy }).then(updateContextMenu); 71 | setData(multicopy); 72 | }); 73 | }) 74 | 75 | const updateContextMenu = () => { 76 | chrome.runtime.sendMessage({updateDemAll: true}) 77 | } 78 | -------------------------------------------------------------------------------- /multicopy_webext/polyfill.js: -------------------------------------------------------------------------------- 1 | const isFirefox = typeof browser != 'undefined' ? true : false; 2 | const localStore = { 3 | get: key => { 4 | if (isFirefox) { 5 | return browser.storage.local.get(); 6 | } else { 7 | return new Promise(resolve => chrome.storage.local.get([key], resolve)) 8 | } 9 | }, 10 | set: obj => { 11 | if (isFirefox) { 12 | return browser.storage.local.set(obj); 13 | } else { 14 | return new Promise(resolve => chrome.storage.local.set(obj, resolve)) 15 | } 16 | } 17 | } 18 | 19 | const tabs = { 20 | query: obj => { 21 | if (isFirefox) { 22 | return browser.tabs.query(obj); 23 | } else { 24 | return new Promise(resolve => chrome.tabs.query(obj, resolve)) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /reminders_webext/bg.js: -------------------------------------------------------------------------------- 1 | const idPrefix = 'queIt_'; 2 | 3 | (async () => { 4 | const {tslReminders : data = {}, migrated = false} = await browser.storage.local.get() || {}; 5 | if (migrated) return; 6 | Object.keys(data).forEach(id => { 7 | if (typeof data[id] !== 'string') return; 8 | try { 9 | const formatDate = d => { 10 | const year = tsDate.getFullYear(); 11 | const month = (tsDate.getMonth() + 1).toString().padStart(2,0); 12 | const dateN = (tsDate.getDate()).toString().padStart(2,0); 13 | return `${year}-${month}-${dateN}`; 14 | } 15 | const ts = id.split(idPrefix)[1]; 16 | const tsDate = new Date(ts*1); 17 | const rDate = formatDate(tsDate); 18 | const rTime = `${tsDate.getHours()}:${tsDate.getMinutes()}`; 19 | const newData = { 20 | title: data[id], 21 | desc: '', 22 | daily: false, 23 | id, 24 | ts, 25 | rDate, 26 | rTime 27 | } 28 | data[id] = newData; 29 | }catch(e){} 30 | }); 31 | await browser.storage.local.set({ tslReminders: data, migrated: true }) 32 | })(); 33 | 34 | const handleMessage = async ({ action, data = {} }) => { 35 | 36 | const createTimestamp = ({ rDate = '', rTime }) => { 37 | let dateArr = []; 38 | if (rDate == '') { 39 | const today = new Date; 40 | dateArr[0] = today.getFullYear(); 41 | dateArr[1] = today.getMonth() + 1; 42 | dateArr[2] = today.getDate(); 43 | } else { 44 | dateArr = rDate.split('-'); 45 | } 46 | 47 | const timeArr = rTime.split(':'); 48 | let aDate = new Date(dateArr[0], dateArr[1] - 1, dateArr[2], timeArr[0], timeArr[1] || 0); 49 | const rn = new Date(); 50 | if (rn > aDate) { 51 | aDate.setDate(aDate.getDate() + 1); 52 | } 53 | return aDate.getTime(); 54 | } 55 | 56 | const createAlarm = ({ ts: when, daily }, id) => { 57 | const info = { when }; 58 | if (daily) info.periodInMinutes = 1440; 59 | browser.alarms.create(id, info) 60 | } 61 | 62 | const gettingItem = browser.storage.local.get('tslReminders'); 63 | 64 | switch (action) { 65 | case 'create': 66 | const ts = createTimestamp(data) 67 | const id = (data.id && data.id !== '') ? data.id : `${idPrefix}${ts}`; 68 | data.id = id; 69 | data.ts = ts; 70 | gettingItem.then((res) => { 71 | const newReminders = res.tslReminders 72 | newReminders[id] = data; 73 | browser.storage.local.set({ tslReminders: newReminders }) 74 | .then(() => browser.runtime.sendMessage({ 75 | action: 'create' 76 | })); 77 | createAlarm(data, id) 78 | }).catch(() => { 79 | browser.storage.local.set({ tslReminders: { [id]: data } }) 80 | createAlarm(data, id) 81 | }); 82 | break; 83 | case 'list': 84 | gettingItem.then((res) => { 85 | const { tslReminders: reminders = {} } = res; 86 | browser.runtime.sendMessage({ 87 | action: 'list', 88 | data: reminders, 89 | current: data.current 90 | }); 91 | }).catch(() => { 92 | browser.runtime.sendMessage({ 93 | action: 'list', 94 | data: {}, 95 | current: data.current 96 | }); 97 | }); 98 | break; 99 | case 'getreminder': 100 | gettingItem.then((res) => { 101 | const { tslReminders: reminders = {} } = res; 102 | browser.runtime.sendMessage({ 103 | action: 'getreminder', 104 | data: reminders[data.id], 105 | }); 106 | }) 107 | break; 108 | case 'delete': 109 | gettingItem.then((res) => { 110 | const { tslReminders: reminders = {} } = res; 111 | browser.alarms.clear(data.id); 112 | delete reminders[data.id]; 113 | browser.storage.local.set({ tslReminders: reminders }) 114 | browser.runtime.sendMessage({ 115 | action: 'list', 116 | data: reminders, 117 | current: data.current 118 | }); 119 | }); 120 | break; 121 | } 122 | } 123 | 124 | browser.runtime.onMessage.addListener(handleMessage); 125 | 126 | const createNotification = info => { 127 | browser.notifications.create(info); 128 | } 129 | browser.alarms.onAlarm.addListener((alarm) => { 130 | const gettingItem = browser.storage.local.get('tslReminders'); 131 | gettingItem.then(({ tslReminders }) => { 132 | let reminder = tslReminders[alarm.name] || {}; 133 | if (typeof reminder === 'string') { 134 | reminder = { 135 | title: 'Reminder', 136 | desc: reminder 137 | } 138 | } 139 | const info = { 140 | type: "basic", 141 | iconUrl: "icons/logo_64.png", 142 | title: reminder.title || "Reminder", 143 | message: reminder.desc || 'PING' 144 | } 145 | createNotification(info); 146 | if (!reminder.daily) tslReminders[alarm.name].done = true; 147 | browser.storage.local.set({ tslReminders }); 148 | }); 149 | }); 150 | -------------------------------------------------------------------------------- /reminders_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by Darius Dan from www.flaticon.com is licensed by CC 3.0 BY -------------------------------------------------------------------------------- /reminders_webext/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/icon_128.png -------------------------------------------------------------------------------- /reminders_webext/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/icon_32.png -------------------------------------------------------------------------------- /reminders_webext/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/icon_64.png -------------------------------------------------------------------------------- /reminders_webext/icons/logo_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/logo_128.png -------------------------------------------------------------------------------- /reminders_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/logo_32.png -------------------------------------------------------------------------------- /reminders_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/reminders_webext/icons/logo_64.png -------------------------------------------------------------------------------- /reminders_webext/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
    9 |
    Reminders
    10 | 37 | 48 | 56 |
    57 | 64 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /reminders_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Reminders", 4 | "version": "2.0", 5 | "description": "Extensions that set reminders and shows notifications", 6 | "homepage_url": "https://github.com/tsl143/jsDemos", 7 | "icons": { 8 | "32": "icons/logo_32.png", 9 | "64": "icons/logo_64.png", 10 | "128": "icons/logo_128.png" 11 | }, 12 | "permissions": [ 13 | "alarms", 14 | "tabs", 15 | "notifications", 16 | "storage" 17 | ], 18 | "browser_action": { 19 | "default_icon": "icons/icon_32.png", 20 | "default_title": "Remind me", 21 | "default_popup": "index.html" 22 | }, 23 | "background": { 24 | "scripts": [ 25 | "bg.js" 26 | ] 27 | }, 28 | "browser_specific_settings": { 29 | "gecko": { 30 | "id": "{7dc17ae2-a65f-4e62-b639-ad5bb7d6bdbb}" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /reminders_webext/reminder.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --main-bg: #E8924D; 3 | --main-clr: #fff; 4 | } 5 | .centered { 6 | text-align: center; 7 | } 8 | body { 9 | color: #444; 10 | font-family: Arial; 11 | margin: 0; 12 | } 13 | header { 14 | padding: 7px; 15 | background: var(--main-bg); 16 | color: var(--main-clr); 17 | text-transform: uppercase; 18 | } 19 | #wrapper { 20 | min-width: 350px; 21 | min-height: 400px; 22 | background: #eaeaea; 23 | margin: 0 auto; 24 | } 25 | 26 | #overlay { 27 | background: rgba(0,0,0, .5); 28 | width: 100%; 29 | height: 100vh; 30 | z-index: 3; 31 | position: absolute; 32 | left: 0; 33 | top: 0; 34 | } 35 | 36 | #overlay > div { 37 | background: #fff; 38 | width: 300px; 39 | position: absolute; 40 | left: calc(50% - 170px); 41 | top: calc(50% - 70px); 42 | padding: 20px; 43 | text-align: center; 44 | } 45 | 46 | #closeAlert { 47 | background: #dadada; 48 | border: 0; 49 | padding: 5px 20px; 50 | font-weight: bold; 51 | } 52 | 53 | .hidden { 54 | display: none!important; 55 | } 56 | .page { 57 | padding: 20px; 58 | } 59 | .inputBox { 60 | margin-top:20px; 61 | position: relative; 62 | } 63 | .inputBox span { 64 | position: absolute; 65 | font-size: 12px; 66 | background: var(--main-bg); 67 | color: var(--main-clr); 68 | padding: 1px 5px; 69 | top: -11px; 70 | left: 10px; 71 | min-width: 30px; 72 | } 73 | input:not([type="checkbox"]), textarea { 74 | padding: 8px 5px 5px; 75 | width: 100%; 76 | border: 0; 77 | } 78 | .actionBtns span { 79 | background: var(--main-bg); 80 | color: var(--main-clr); 81 | width: 60px; 82 | display: inline-block; 83 | padding: 5px; 84 | margin: 20px 0; 85 | font-size: 12px; 86 | cursor: pointer; 87 | } 88 | label { 89 | display: inline-block; 90 | margin-top: 10px; 91 | } 92 | 93 | ul { 94 | padding-left: 15px; 95 | } 96 | li { 97 | margin-top: 5px; 98 | } 99 | li span:first-child { 100 | display: inline-block; 101 | margin-right: 5px; 102 | overflow: hidden; 103 | text-overflow: ellipsis; 104 | white-space: nowrap; 105 | width: 80%; 106 | } 107 | li span.action { 108 | margin-right: 5px; 109 | } 110 | li span:last-child { 111 | background: var(--main-bg); 112 | color: var(--main-clr); 113 | font-size: 8px; 114 | padding: 2px 3px; 115 | } 116 | li span { 117 | display: inline-block; 118 | vertical-align: middle; 119 | margin-top: 4px; 120 | } 121 | .listHeading { 122 | position: relative; 123 | } 124 | .listHeading #history { 125 | position: absolute; 126 | right: 0; 127 | } 128 | .listHeading #back { 129 | left: 0; 130 | position: absolute; 131 | transform: rotateY(180deg); 132 | color: #7e7f7f; 133 | } -------------------------------------------------------------------------------- /reminders_webext/reminder.js: -------------------------------------------------------------------------------- 1 | const idPrefix = 'queIt_'; 2 | const ele = { 3 | dateHolder: document.getElementById('dateHolder'), 4 | save: document.getElementById('save'), 5 | hidden: document.getElementById('hidden'), 6 | cancel: document.getElementById('cancel'), 7 | new: document.getElementById('newReminder'), 8 | edit: document.getElementById('editView'), 9 | list: document.getElementById('listView'), 10 | historylist: document.getElementById('listViewO'), 11 | title: document.querySelector('[name="title"]'), 12 | desc: document.querySelector('[name="desc"]'), 13 | time: document.querySelector('[name="time"]'), 14 | date: document.querySelector('[name="date"]'), 15 | daily: document.querySelector('[name="daily"]'), 16 | id: document.querySelector('[name="id"]'), 17 | cList: document.getElementById('listViewULC'), 18 | oList: document.getElementById('listViewULO'), 19 | history: document.getElementById('history'), 20 | back: document.getElementById('back'), 21 | overlay: document.getElementById('overlay'), 22 | closeAlert: document.getElementById('closeAlert'), 23 | alertTxt: document.getElementById('alertTxt'), 24 | } 25 | 26 | const showAlert = msg => { 27 | ele.alertTxt.textContent = msg; 28 | ele.overlay.classList.remove('hidden'); 29 | } 30 | 31 | const closeAlert = () => { 32 | ele.alertTxt.textContent = ''; 33 | ele.overlay.classList.add('hidden'); 34 | } 35 | 36 | const makeList = (data = [], current = true) => { 37 | if (current) { 38 | while (ele.cList.children.length > 0) { 39 | ele.cList.firstChild.remove(); 40 | } 41 | } else { 42 | while (ele.oList.children.length > 0) { 43 | ele.oList.firstChild.remove(); 44 | } 45 | } 46 | 47 | const template = document.getElementById('listitem'); 48 | const holder = current ? ele.cList : ele.oList; 49 | data.forEach(d => { 50 | if (current && d.done) return; 51 | if (!current && !d.done) return; 52 | const item = document.importNode(template.content, true); 53 | item.querySelector('.lTitle').textContent = d.title; 54 | item.querySelector('li').setAttribute('data-id', d.id) 55 | if (d.daily) item.querySelector('.daily').classList.remove('hidden'); 56 | holder.appendChild(item); 57 | }) 58 | } 59 | 60 | const changePage = mode => { 61 | switch (mode) { 62 | case 'list': 63 | browser.runtime.sendMessage({ action: 'list', data: { current: true } }); 64 | ele.list.classList.remove('hidden'); 65 | ele.edit.classList.add('hidden'); 66 | ele.historylist.classList.add('hidden'); 67 | break; 68 | case 'edit': 69 | ele.edit.classList.remove('hidden'); 70 | ele.list.classList.add('hidden'); 71 | ele.historylist.classList.add('hidden'); 72 | break; 73 | case 'history': 74 | browser.runtime.sendMessage({ action: 'list', data: { current: false } }); 75 | ele.historylist.classList.remove('hidden'); 76 | ele.edit.classList.add('hidden'); 77 | ele.list.classList.add('hidden'); 78 | break; 79 | } 80 | } 81 | 82 | const saveReminder = () => { 83 | const data = { 84 | title: ele.title.value || 'No title', 85 | desc: ele.desc.value || '', 86 | rTime: ele.time.value, 87 | daily: ele.daily.checked, 88 | rDate: ele.date.value, 89 | id: ele.id.value, 90 | } 91 | if (!data.rTime || data.rTime == "") { 92 | showAlert("No time set"); 93 | return; 94 | } 95 | if (!data.daily && (!data.rDate || data.rDate == "")) { 96 | showAlert("No Date set"); 97 | return; 98 | } 99 | // send to BG 100 | browser.runtime.sendMessage({ 101 | action: "create", 102 | data 103 | }); 104 | } 105 | 106 | const handleItemClick = (current, e) => { 107 | if(e.target.hasAttribute('data-action')) { 108 | const action = e.target.getAttribute('data-action') 109 | const id = e.target.parentNode.getAttribute('data-id'); 110 | switch(action) { 111 | case 'edit': 112 | changePage('edit'); 113 | browser.runtime.sendMessage({ 114 | action: "getreminder", 115 | data: { id, current } 116 | }); 117 | break; 118 | case 'delete': 119 | browser.runtime.sendMessage({ 120 | action: "delete", 121 | data: { id, current } 122 | }); 123 | break 124 | } 125 | } 126 | } 127 | 128 | const handleDate = () => { 129 | if(!ele.daily.checked) { 130 | ele.dateHolder.classList.remove('hidden') 131 | } else { 132 | ele.dateHolder.classList.add('hidden') 133 | } 134 | } 135 | 136 | // Edit page setup 137 | const setEdit = data => { 138 | ele.title.value = data.title; 139 | ele.desc.value = data.desc; 140 | ele.time.value = data.rTime; 141 | ele.date.value = data.rDate; 142 | ele.daily.checked = data.daily; 143 | ele.id.value = `${idPrefix}${data.ts}`; 144 | handleDate(); 145 | } 146 | 147 | // New reminder setup 148 | const emptyInputs = () => { 149 | document.querySelectorAll('input').forEach(i =>{ 150 | i.value = ''; 151 | }); 152 | const now = new Date; 153 | ele.time.value = `${now.getHours()}:${now.getMinutes()}` 154 | ele.daily.checked = false; 155 | ele.desc.value = ''; 156 | handleDate(); 157 | } 158 | 159 | const handleMessage = ({action, data, current}) => { 160 | switch(action) { 161 | case 'list': 162 | const sortedData = Object.keys(data).map(k =>data[k]); 163 | makeList(sortedData, current); 164 | break; 165 | case 'create': 166 | changePage('list') 167 | break; 168 | case 'getreminder': 169 | setEdit(data) 170 | break; 171 | } 172 | } 173 | 174 | ele.cancel.addEventListener('click', ()=> changePage('list')); 175 | ele.new.addEventListener('click', ()=> { 176 | emptyInputs(); 177 | changePage('edit'); 178 | }); 179 | ele.history.addEventListener('click', ()=> changePage('history')); 180 | ele.back.addEventListener('click', ()=> changePage('list')); 181 | ele.cList.addEventListener('click', handleItemClick.bind(this, true)); 182 | ele.oList.addEventListener('click', handleItemClick.bind(this, false)); 183 | ele.save.addEventListener('click', saveReminder); 184 | ele.daily.addEventListener('click', handleDate); 185 | ele.closeAlert.addEventListener('click', closeAlert); 186 | 187 | browser.runtime.onMessage.addListener(handleMessage); 188 | 189 | changePage('list'); 190 | -------------------------------------------------------------------------------- /stickyNotes_webext/icons/logo_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/stickyNotes_webext/icons/logo_128.png -------------------------------------------------------------------------------- /stickyNotes_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/stickyNotes_webext/icons/logo_32.png -------------------------------------------------------------------------------- /stickyNotes_webext/icons/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/stickyNotes_webext/icons/logo_48.png -------------------------------------------------------------------------------- /stickyNotes_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/stickyNotes_webext/icons/logo_64.png -------------------------------------------------------------------------------- /stickyNotes_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "description": "Simple sticky notes utility which provides facility to make small notes of any and every thing.", 4 | "manifest_version": 2, 5 | "name": "Sticky Notes", 6 | "version": "1.5", 7 | "homepage_url": "https://github.com/tsl143/jsDemos/", 8 | "icons": { 9 | "128": "icons/logo_128.png", 10 | "64": "icons/logo_64.png", 11 | "48": "icons/logo_48.png", 12 | "32": "icons/logo_32.png" 13 | }, 14 | "browser_action": { 15 | "default_icon": "icons/logo_32.png", 16 | "default_title": "Sticky Notes", 17 | "default_popup": "popup/go.html" 18 | }, 19 | "permissions": ["storage"] 20 | } 21 | -------------------------------------------------------------------------------- /stickyNotes_webext/popup/getMe.js: -------------------------------------------------------------------------------- 1 | 2 | const notePad = document.getElementById('tslNotes'); 3 | const cleanPad = document.getElementById('cleanPad'); 4 | const layOver = document.getElementById('layOver'); 5 | const yes = document.getElementById('yesPlz'); 6 | const no = document.getElementById('nope'); 7 | 8 | 9 | const gettingItem = browser.storage.local.get('tslStickyNotes'); 10 | 11 | gettingItem.then((res) => { 12 | try{ 13 | if(res.tslStickyNotes){ 14 | notePad.value = res.tslStickyNotes; 15 | } 16 | }catch(e){} 17 | }); 18 | 19 | notePad.addEventListener('keyup',()=>{ 20 | browser.storage.local.set({ tslStickyNotes: notePad.value }); 21 | }, false); 22 | 23 | cleanPad.addEventListener('click',()=>{ 24 | layOver.className=""; 25 | }, false); 26 | 27 | no.addEventListener('click',()=>{ 28 | layOver.className="hidden"; 29 | }, false); 30 | 31 | yes.addEventListener('click',()=>{ 32 | notePad.value = ""; 33 | browser.storage.local.set({ tslStickyNotes: "" }); 34 | layOver.className="hidden"; 35 | }, false); -------------------------------------------------------------------------------- /stickyNotes_webext/popup/go.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 57 | 58 | 59 |
    60 |
    61 | Clear 62 |
    63 | 68 |
    69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /ticTacToe_webext/icons/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ticTacToe_webext/icons/.DS_Store -------------------------------------------------------------------------------- /ticTacToe_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ticTacToe_webext/icons/logo_32.png -------------------------------------------------------------------------------- /ticTacToe_webext/icons/logo_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ticTacToe_webext/icons/logo_48.png -------------------------------------------------------------------------------- /ticTacToe_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "description": "Lets you kill some boredom :) ", 4 | "manifest_version": 2, 5 | "name": "Tic Tac Toe", 6 | "version": "1.1", 7 | "homepage_url": "https://github.com/tsl143", 8 | "icons": { 9 | "48": "icons/logo_48.png" 10 | }, 11 | "browser_action": { 12 | "default_icon": "icons/logo_32.png", 13 | "default_title": "Tic Tac Toe", 14 | "default_popup": "popup/play.html" 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ticTacToe_webext/popup/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/ticTacToe_webext/popup/.DS_Store -------------------------------------------------------------------------------- /ticTacToe_webext/popup/play.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 148 | 149 | 150 |
    151 |

    Wassup?

    152 |
    1 Player
    153 |
    2 Players
    154 |
    155 | 156 |
    157 |
    158 |
    159 | 0 160 |
    Player X
    161 |
    162 |
    163 | 0 164 |
    Player O
    165 |
    166 |
    167 |
    168 |
    169 | 170 |
    171 | 172 |
    173 |
    174 | 175 |
    176 |
    177 | 178 |
    179 |
    180 | 181 |
    182 |
    183 | 184 |
    185 |
    186 | 187 |
    188 |
    189 | 190 |
    191 |
    192 | 193 |
    194 |
    195 | 196 |
    197 | 198 |
    199 |
    200 |
    201 |
    Restart
    202 |
    Back
    203 |
    204 |
    205 |
    206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /ticTacToe_webext/popup/play.js: -------------------------------------------------------------------------------- 1 | /* 2 | The AI code was referred from following: 3 | 4 | AI Code Written by Cory Fogliani 5 | Testers: Cory Fogliani, Chris Gordon 6 | Featured on JavaScript Kit (http://javascriptkit.com) 7 | 8 | */ 9 | 10 | 11 | var mode = 1; 12 | var player1Score = 0; 13 | var player2Score = 0; 14 | function gotoPage(page){ 15 | if(page==1) { 16 | document.getElementById('welcomeScreen').className = "page active"; 17 | document.getElementById('tttHolder').className = "page"; 18 | document.getElementById('grid').className = ""; 19 | document.getElementsByTagName('body')[0].style.height="250px"; 20 | }else if(page==2) { 21 | document.getElementById('tttHolder').className = "page active"; 22 | document.getElementById('welcomeScreen').className = "page"; 23 | document.getElementById('grid').className = "start"; 24 | document.getElementById('player1').innerText = "0"; 25 | document.getElementById('player2').innerText = "0"; 26 | document.getElementsByTagName('body')[0].style.height="450px"; 27 | } 28 | } 29 | 30 | const selectPlayers = document.getElementsByClassName('selectPlayer'); 31 | for(let i=0; i{gotoPage(1)}, false); 42 | 43 | function restart(){ 44 | player1Score = 0; 45 | player2Score = 0; 46 | reset(); 47 | } 48 | 49 | function alertMessage(msg){ 50 | document.getElementById('alertMessage').innerText = msg; 51 | document.getElementById('alertMessage').className="show"; 52 | setTimeout(()=>{document.getElementById('alertMessage').className="";},500); 53 | } 54 | 55 | var sqr1 56 | var sqr2 57 | var sqr3 58 | var sqr4 59 | var sqr5 60 | var sqr6 61 | var sqr7 62 | var sqr8 63 | var sqr9 64 | var sqr1T = 0 65 | var sqr2T = 0 66 | var sqr3T = 0 67 | var sqr4T = 0 68 | var sqr5T = 0 69 | var sqr6T = 0 70 | var sqr7T = 0 71 | var sqr8T = 0 72 | var sqr9T = 0 73 | var moveCount = 0 74 | var turn = 0 75 | 76 | 77 | function vari() 78 | { 79 | sqr1 = document.tic.sqr1.value 80 | sqr2 = document.tic.sqr2.value 81 | sqr3 = document.tic.sqr3.value 82 | sqr4 = document.tic.sqr4.value 83 | sqr5 = document.tic.sqr5.value 84 | sqr6 = document.tic.sqr6.value 85 | sqr7 = document.tic.sqr7.value 86 | sqr8 = document.tic.sqr8.value 87 | sqr9 = document.tic.sqr9.value 88 | } 89 | function check() 90 | { 91 | if(sqr1 == " X " && sqr2 == " X " && sqr3 == " X ") 92 | { 93 | alertMessage("You \n Win!"); player1Score++; 94 | reset() 95 | } 96 | else if(sqr4 == " X " && sqr5 == " X " && sqr6 == " X ") 97 | { 98 | alertMessage("You \n Win!"); player1Score++; 99 | reset() 100 | } 101 | else if(sqr7 == " X " && sqr8 == " X " && sqr9 == " X ") 102 | { 103 | alertMessage("You \n Win!"); player1Score++; 104 | reset() 105 | } 106 | else if(sqr1 == " X " && sqr5 == " X " && sqr9 == " X ") 107 | { 108 | alertMessage("You \n Win!"); player1Score++; 109 | reset() 110 | } 111 | else if(sqr1 == " X " && sqr4 == " X " && sqr7 == " X ") 112 | { 113 | alertMessage("You \n Win!"); player1Score++; 114 | reset() 115 | } 116 | else if(sqr2 == " X " && sqr5 == " X " && sqr8 == " X ") 117 | { 118 | alertMessage("You \n Win!"); player1Score++; 119 | reset() 120 | } 121 | else if(sqr3 == " X " && sqr6 == " X " && sqr9 == " X ") 122 | { 123 | alertMessage("You \n Win!"); player1Score++; 124 | reset() 125 | } 126 | else if(sqr1 == " X " && sqr5 == " X " && sqr9 == " X ") 127 | { 128 | alertMessage("You \n Win!"); player1Score++; 129 | reset() 130 | } 131 | else if(sqr3 == " X " && sqr5 == " X " && sqr7 == " X ") 132 | { 133 | alertMessage("You \n Win!"); player1Score++; 134 | reset() 135 | } 136 | else 137 | { 138 | winCheck() 139 | check2() 140 | drawCheck() 141 | } 142 | } 143 | 144 | function check2() 145 | { 146 | vari() 147 | drawCheck() 148 | if(sqr1 == " O " && sqr2 == " O " && sqr3 == " O ") 149 | { 150 | alertMessage("You \n Lose!"); player2Score++; 151 | reset() 152 | } 153 | else if(sqr4 == " O " && sqr5 == " O " && sqr6 == " O ") 154 | { 155 | alertMessage("You \n Lose!"); player2Score++; 156 | reset() 157 | } 158 | else if(sqr7 == " O " && sqr8 == " O " && sqr9 == " O ") 159 | { 160 | alertMessage("You \n Lose!"); player2Score++; 161 | reset() 162 | } 163 | else if(sqr1 == " O " && sqr5 == " O " && sqr9 == " O ") 164 | { 165 | alertMessage("You \n Lose!"); player2Score++; 166 | reset() 167 | } 168 | else if(sqr1 == " O " && sqr4 == " O " && sqr7 == " O ") 169 | { 170 | alertMessage("You \n Lose!"); player2Score++; 171 | reset() 172 | } 173 | else if(sqr2 == " O " && sqr5 == " O " && sqr8 == " O ") 174 | { 175 | alertMessage("You \n Lose!"); player2Score++; 176 | reset() 177 | } 178 | else if(sqr3 == " O " && sqr6 == " O " && sqr9 == " O ") 179 | { 180 | alertMessage("You \n Lose!"); player2Score++; 181 | reset() 182 | } 183 | else if(sqr1 == " O " && sqr5 == " O " && sqr9 == " O ") 184 | { 185 | alertMessage("You \n Lose!"); player2Score++; 186 | reset() 187 | } 188 | else if(sqr3 == " O " && sqr5 == " O " && sqr7 == " O ") 189 | { 190 | alertMessage("You \n Lose!"); player2Score++; 191 | reset() 192 | } 193 | } 194 | 195 | function player1Check() 196 | { 197 | if(sqr1 == " X " && sqr2 == " X " && sqr3 == " X ") 198 | { 199 | alertMessage("Player X \n Win!"); player1Score++; 200 | reset() 201 | } 202 | else if(sqr4 == " X " && sqr5 == " X " && sqr6 == " X ") 203 | { 204 | alertMessage("Player X \n Win!"); player1Score++; 205 | reset() 206 | } 207 | else if(sqr7 == " X " && sqr8 == " X " && sqr9 == " X ") 208 | { 209 | alertMessage("Player X \n Win!"); player1Score++; 210 | reset() 211 | } 212 | else if(sqr1 == " X " && sqr5 == " X " && sqr9 == " X ") 213 | { 214 | alertMessage("Player X \n Win!"); player1Score++; 215 | reset() 216 | } 217 | else if(sqr1 == " X " && sqr4 == " X " && sqr7 == " X ") 218 | { 219 | alertMessage("Player X \n Win!"); player1Score++; 220 | reset() 221 | } 222 | else if(sqr2 == " X " && sqr5 == " X " && sqr8 == " X ") 223 | { 224 | alertMessage("Player X \n Win!"); player1Score++; 225 | reset() 226 | } 227 | else if(sqr3 == " X " && sqr6 == " X " && sqr9 == " X ") 228 | { 229 | alertMessage("Player X \n Win!"); player1Score++; 230 | reset() 231 | } 232 | else if(sqr1 == " X " && sqr5 == " X " && sqr9 == " X ") 233 | { 234 | alertMessage("Player X \n Win!"); player1Score++; 235 | reset() 236 | } 237 | else if(sqr3 == " X " && sqr5 == " X " && sqr7 == " X ") 238 | { 239 | alertMessage("Player X \n Win!"); player1Score++; 240 | reset() 241 | } 242 | else 243 | { 244 | player2Check() 245 | drawCheck() 246 | } 247 | } 248 | 249 | function player2Check() 250 | { 251 | vari() 252 | drawCheck() 253 | if(sqr1 == " O " && sqr2 == " O " && sqr3 == " O ") 254 | { 255 | alertMessage("Player O \n Win!"); player2Score++; 256 | reset() 257 | } 258 | else if(sqr4 == " O " && sqr5 == " O " && sqr6 == " O ") 259 | { 260 | alertMessage("Player O \n Win!"); player2Score++; 261 | reset() 262 | } 263 | else if(sqr7 == " O " && sqr8 == " O " && sqr9 == " O ") 264 | { 265 | alertMessage("Player O \n Win!"); player2Score++; 266 | reset() 267 | } 268 | else if(sqr1 == " O " && sqr5 == " O " && sqr9 == " O ") 269 | { 270 | alertMessage("Player O \n Win!"); player2Score++; 271 | reset() 272 | } 273 | else if(sqr1 == " O " && sqr4 == " O " && sqr7 == " O ") 274 | { 275 | alertMessage("Player O \n Win!"); player2Score++; 276 | reset() 277 | } 278 | else if(sqr2 == " O " && sqr5 == " O " && sqr8 == " O ") 279 | { 280 | alertMessage("Player O \n Win!"); player2Score++; 281 | reset() 282 | } 283 | else if(sqr3 == " O " && sqr6 == " O " && sqr9 == " O ") 284 | { 285 | alertMessage("Player O \n Win!"); player2Score++; 286 | reset() 287 | } 288 | else if(sqr1 == " O " && sqr5 == " O " && sqr9 == " O ") 289 | { 290 | alertMessage("Player O \n Win!"); player2Score++; 291 | reset() 292 | } 293 | else if(sqr3 == " O " && sqr5 == " O " && sqr7 == " O ") 294 | { 295 | alertMessage("Player O \n Win!"); player2Score++; 296 | reset() 297 | } 298 | } 299 | 300 | function drawCheck() 301 | { 302 | vari() 303 | moveCount = sqr1T + sqr2T + sqr3T + sqr4T + sqr5T + sqr6T + sqr7T + sqr8T + sqr9T 304 | if(moveCount == 9) 305 | { 306 | reset() 307 | alertMessage("Draw") 308 | } 309 | } 310 | 311 | function winCheck() 312 | { 313 | check2() 314 | if(sqr1 == " O " && sqr2 == " O " && sqr3T == 0 && turn == 1) 315 | { 316 | document.tic.sqr3.value = " O " 317 | sqr3T = 1; 318 | turn = 0; 319 | } 320 | else if(sqr2 == " O " && sqr3 == " O " && sqr1T == 0 && turn == 1) 321 | { 322 | document.tic.sqr1.value = " O " 323 | sqr1T = 1; 324 | turn = 0; 325 | } 326 | else if(sqr4 == " O " && sqr5 == " O " && sqr6T == 0 && turn == 1) 327 | { 328 | document.tic.sqr6.value = " O " 329 | sqr6T = 1; 330 | turn = 0; 331 | } 332 | else if(sqr5 == " O " && sqr6 == " O " && sqr4T == 0 && turn == 1) 333 | { 334 | document.tic.sqr4.value = " O " 335 | sqr4T = 1; 336 | turn = 0; 337 | } 338 | else if(sqr7 == " O " && sqr8 == " O " && sqr9T == 0 && turn == 1) 339 | { 340 | document.tic.sqr9.value = " O " 341 | sqr9T = 1; 342 | turn = 0; 343 | } 344 | else if(sqr8 == " O " && sqr9 == " O " && sqr7T == 0 && turn == 1) 345 | { 346 | document.tic.sqr7.value = " O " 347 | sqr7T = 1; 348 | turn = 0; 349 | } 350 | else if(sqr1 == " O " && sqr5 == " O " && sqr9T == 0 && turn == 1) 351 | { 352 | document.tic.sqr9.value = " O " 353 | sqr9T = 1; 354 | turn = 0; 355 | } 356 | else if(sqr5 == " O " && sqr9 == " O " && sqr1T == 0 && turn == 1) 357 | { 358 | document.tic.sqr1.value = " O " 359 | sqr1T = 1; 360 | turn = 0; 361 | } 362 | else if(sqr3 == " O " && sqr5 == " O " && sqr7T == 0 && turn == 1) 363 | { 364 | document.tic.sqr7.value = " O " 365 | sqr7T = 1; 366 | turn = 0; 367 | } 368 | else if(sqr7 == " O " && sqr5 == " O " && sqr3T == 0 && turn == 1) 369 | { 370 | document.tic.sqr3.value = " O " 371 | sqr3T = 1; 372 | turn = 0; 373 | } 374 | else if(sqr1 == " O " && sqr3 == " O " && sqr2T == 0 && turn == 1) 375 | { 376 | document.tic.sqr2.value = " O " 377 | sqr2T = 1; 378 | turn = 0; 379 | } 380 | else if(sqr4 == " O " && sqr6 == " O " && sqr5T == 0 && turn == 1) 381 | { 382 | document.tic.sqr5.value = " O " 383 | sqr5T = 1; 384 | turn = 0; 385 | } 386 | else if(sqr7 == " O " && sqr9 == " O " && sqr8T == 0 && turn == 1) 387 | { 388 | document.tic.sqr8.value = " O " 389 | sqr8T = 1; 390 | turn = 0; 391 | } 392 | else if(sqr1 == " O " && sqr7 == " O " && sqr4T == 0 && turn == 1) 393 | { 394 | document.tic.sqr4.value = " O " 395 | sqr4T = 1; 396 | turn = 0; 397 | } 398 | else if(sqr2 == " O " && sqr8 == " O " && sqr5T == 0 && turn == 1) 399 | { 400 | document.tic.sqr5.value = " O " 401 | sqr5T = 1; 402 | turn = 0; 403 | } 404 | else if(sqr3 == " O " && sqr9 == " O " && sqr6T == 0 && turn == 1) 405 | { 406 | document.tic.sqr6.value = " O " 407 | sqr6T = 1; 408 | turn = 0; 409 | } 410 | else if(sqr1 == " O " && sqr5 == " O " && sqr9T == 0 && turn == 1) 411 | { 412 | document.tic.sqr9.value = " O " 413 | sqr9T = 1; 414 | turn = 0; 415 | } 416 | else if(sqr4 == " O " && sqr7 == " O " && sqr1T == 0 && turn == 1) 417 | { 418 | document.tic.sqr1.value = " O " 419 | sqr1T = 1; 420 | turn = 0; 421 | } 422 | else if(sqr5 == " O " && sqr8 == " O " && sqr2T == 0 && turn == 1) 423 | { 424 | document.tic.sqr2.value = " O " 425 | sqr2T = 1; 426 | turn = 0; 427 | } 428 | else if(sqr6 == " O " && sqr9 == " O " && sqr3T == 0 && turn == 1) 429 | { 430 | document.tic.sqr3.value = " O " 431 | sqr3T = 1; 432 | turn = 0; 433 | } 434 | else if(sqr1 == " O " && sqr4 == " O " && sqr7T == 0 && turn == 1) 435 | { 436 | document.tic.sqr7.value = " O " 437 | sqr7T = 1; 438 | turn = 0; 439 | } 440 | else if(sqr2 == " O " && sqr5 == " O " && sqr8T == 0 && turn == 1) 441 | { 442 | document.tic.sqr8.value = " O " 443 | sqr8T = 1; 444 | turn = 0; 445 | } 446 | else if(sqr3 == " O " && sqr6 == " O " && sqr9T == 0 && turn == 1) 447 | { 448 | document.tic.sqr9.value = " O " 449 | sqr9T = 1; 450 | turn = 0; 451 | } 452 | else if(sqr1 == " O " && sqr9 == " O " && sqr5T == 0 && turn == 1) 453 | { 454 | document.tic.sqr5.value = " O " 455 | sqr5T = 1; 456 | turn = 0; 457 | } 458 | else if(sqr3 == " O " && sqr7 == " O " && sqr5T == 0 && turn == 1) 459 | { 460 | document.tic.sqr5.value = " O " 461 | sqr5T = 1; 462 | turn = 0; 463 | } 464 | else 465 | { 466 | computer() 467 | } 468 | check2() 469 | } 470 | function computer() 471 | { 472 | check2() 473 | if(sqr1 == " X " && sqr2 == " X " && sqr3T == 0 && turn == 1) 474 | { 475 | document.tic.sqr3.value = " O " 476 | sqr3T = 1; 477 | turn = 0; 478 | } 479 | else if(sqr2 == " X " && sqr3 == " X " && sqr1T == 0 && turn == 1) 480 | { 481 | document.tic.sqr1.value = " O " 482 | sqr1T = 1; 483 | turn = 0; 484 | } 485 | else if(sqr4 == " X " && sqr5 == " X " && sqr6T == 0 && turn == 1) 486 | { 487 | document.tic.sqr6.value = " O " 488 | sqr6T = 1; 489 | turn = 0; 490 | } 491 | else if(sqr5 == " X " && sqr6 == " X " && sqr4T == 0 && turn == 1) 492 | { 493 | document.tic.sqr4.value = " O " 494 | sqr4T = 1; 495 | turn = 0; 496 | } 497 | else if(sqr7 == " X " && sqr8 == " X " && sqr9T == 0 && turn == 1) 498 | { 499 | document.tic.sqr9.value = " O " 500 | sqr9T = 1; 501 | turn = 0; 502 | } 503 | else if(sqr8 == " X " && sqr9 == " X " && sqr7T == 0 && turn == 1) 504 | { 505 | document.tic.sqr7.value = " O " 506 | sqr7T = 1; 507 | turn = 0; 508 | } 509 | else if(sqr1 == " X " && sqr5 == " X " && sqr9T == 0 && turn == 1) 510 | { 511 | document.tic.sqr9.value = " O " 512 | sqr9T = 1; 513 | turn = 0; 514 | } 515 | else if(sqr5 == " X " && sqr9 == " X " && sqr1T == 0 && turn == 1) 516 | { 517 | document.tic.sqr1.value = " O " 518 | sqr1T = 1; 519 | turn = 0; 520 | } 521 | else if(sqr3 == " X " && sqr5 == " X " && sqr7T == 0 && turn == 1) 522 | { 523 | document.tic.sqr7.value = " O " 524 | sqr7T = 1; 525 | turn = 0; 526 | } 527 | else if(sqr7 == " X " && sqr5 == " X " && sqr3T == 0 && turn == 1) 528 | { 529 | document.tic.sqr3.value = " O " 530 | sqr3T = 1; 531 | turn = 0; 532 | } 533 | else if(sqr1 == " X " && sqr3 == " X " && sqr2T == 0 && turn == 1) 534 | { 535 | document.tic.sqr2.value = " O " 536 | sqr2T = 1; 537 | turn = 0; 538 | } 539 | else if(sqr4 == " X " && sqr6 == " X " && sqr5T == 0 && turn == 1) 540 | { 541 | document.tic.sqr5.value = " O " 542 | sqr5T = 1; 543 | turn = 0; 544 | } 545 | else if(sqr7 == " X " && sqr9 == " X " && sqr8T == 0 && turn == 1) 546 | { 547 | document.tic.sqr8.value = " O " 548 | sqr8T = 1; 549 | turn = 0; 550 | } 551 | else if(sqr1 == " X " && sqr7 == " X " && sqr4T == 0 && turn == 1) 552 | { 553 | document.tic.sqr4.value = " O " 554 | sqr4T = 1; 555 | turn = 0; 556 | } 557 | else if(sqr2 == " X " && sqr8 == " X " && sqr5T == 0 && turn == 1) 558 | { 559 | document.tic.sqr5.value = " O " 560 | sqr5T = 1; 561 | turn = 0; 562 | } 563 | else if(sqr3 == " X " && sqr9 == " X " && sqr6T == 0 && turn == 1) 564 | { 565 | document.tic.sqr6.value = " O " 566 | sqr6T = 1; 567 | turn = 0; 568 | } 569 | else if(sqr1 == " X " && sqr5 == " X " && sqr9T == 0 && turn == 1) 570 | { 571 | document.tic.sqr9.value = " O " 572 | sqr9T = 1; 573 | turn = 0; 574 | } 575 | else if(sqr4 == " X " && sqr7 == " X " && sqr1T == 0 && turn == 1) 576 | { 577 | document.tic.sqr1.value = " O " 578 | sqr1T = 1; 579 | turn = 0; 580 | } 581 | else if(sqr5 == " X " && sqr8 == " X " && sqr2T == 0 && turn == 1) 582 | { 583 | document.tic.sqr2.value = " O " 584 | sqr2T = 1; 585 | turn = 0; 586 | } 587 | else if(sqr6 == " X " && sqr9 == " X " && sqr3T == 0 && turn == 1) 588 | { 589 | document.tic.sqr3.value = " O " 590 | sqr3T = 1; 591 | turn = 0; 592 | } 593 | else if(sqr1 == " X " && sqr4 == " X " && sqr7T == 0 && turn == 1) 594 | { 595 | document.tic.sqr7.value = " O " 596 | sqr7T = 1; 597 | turn = 0; 598 | } 599 | else if(sqr2 == " X " && sqr5 == " X " && sqr8T == 0 && turn == 1) 600 | { 601 | document.tic.sqr8.value = " O " 602 | sqr8T = 1; 603 | turn = 0; 604 | } 605 | else if(sqr3 == " X " && sqr6 == " X " && sqr9T == 0 && turn == 1) 606 | { 607 | document.tic.sqr9.value = " O " 608 | sqr9T = 1; 609 | turn = 0; 610 | } 611 | else if(sqr1 == " X " && sqr9 == " X " && sqr5T == 0 && turn == 1) 612 | { 613 | document.tic.sqr5.value = " O " 614 | sqr5T = 1; 615 | turn = 0; 616 | } 617 | else if(sqr3 == " X " && sqr7 == " X " && sqr5T == 0 && turn == 1) 618 | { 619 | document.tic.sqr5.value = " O " 620 | sqr5T = 1; 621 | turn = 0; 622 | } 623 | else 624 | { 625 | AI() 626 | } 627 | check2() 628 | } 629 | 630 | function AI() 631 | { 632 | vari() 633 | if(document.tic.sqr5.value == " " && turn == 1) 634 | { 635 | document.tic.sqr5.value = " O " 636 | turn = 0 637 | sqr5T = 1 638 | } 639 | else if(document.tic.sqr1.value == " " && turn == 1) 640 | { 641 | document.tic.sqr1.value = " O " 642 | turn = 0 643 | sqr1T = 1 644 | } 645 | else if(document.tic.sqr9.value == " " && turn == 1) 646 | { 647 | document.tic.sqr9.value = " O " 648 | turn = 0 649 | sqr9T = 1 650 | } 651 | else if(document.tic.sqr6.value == " " && turn == 1) 652 | { 653 | document.tic.sqr6.value = " O " 654 | turn = 0 655 | sqr6T = 1 656 | } 657 | else if(document.tic.sqr2.value == " " && turn == 1) 658 | { 659 | document.tic.sqr2.value = " O " 660 | turn = 0 661 | sqr2T = 1 662 | } 663 | else if(document.tic.sqr8.value == " " && turn == 1) 664 | { 665 | document.tic.sqr8.value = " O " 666 | turn = 0 667 | sqr8T = 1 668 | } 669 | else if(document.tic.sqr3.value == " " && turn == 1) 670 | { 671 | document.tic.sqr3.value = " O " 672 | turn = 0 673 | sqr3T = 1 674 | } 675 | else if(document.tic.sqr7.value == " " && turn == 1) 676 | { 677 | document.tic.sqr7.value = " O " 678 | turn = 0 679 | sqr7T = 1 680 | } 681 | else if(document.tic.sqr4.value == " " && turn == 1) 682 | { 683 | document.tic.sqr4.value = " O " 684 | turn = 0 685 | sqr4T = 1 686 | } 687 | check2() 688 | } 689 | 690 | function reset() 691 | { 692 | 693 | document.getElementById('player1').innerText = player1Score; 694 | document.getElementById('player2').innerText = player2Score; 695 | 696 | document.tic.sqr1.value = " " 697 | document.tic.sqr2.value = " " 698 | document.tic.sqr3.value = " " 699 | document.tic.sqr4.value = " " 700 | document.tic.sqr5.value = " " 701 | document.tic.sqr6.value = " " 702 | document.tic.sqr7.value = " " 703 | document.tic.sqr8.value = " " 704 | document.tic.sqr9.value = " " 705 | sqr1T = 0 706 | sqr2T = 0 707 | sqr3T = 0 708 | sqr4T = 0 709 | sqr5T = 0 710 | sqr6T = 0 711 | sqr7T = 0 712 | sqr8T = 0 713 | sqr9T = 0 714 | vari() 715 | turn = 0 716 | moveCount = 0 717 | } 718 | 719 | function one(){ 720 | if(document.tic.sqr1.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr1.value = ' X '; sqr1T = 1; turn = 1; vari(); check();} else if(document.tic.sqr1.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr1.value = ' X '; sqr1T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr1.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr1.value = ' O '; sqr1T = 1; turn = 1; vari(); player1Check()} drawCheck() 721 | } 722 | document.getElementsByClassName('one')[0].addEventListener('click', one, false); 723 | function two(){ 724 | if(document.tic.sqr2.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr2.value = ' X '; sqr2T = 1; turn = 1; vari(); check();} else if(document.tic.sqr2.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr2.value = ' X '; sqr2T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr2.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr2.value = ' O '; sqr2T = 1; turn = 1; vari(); player1Check()} drawCheck() 725 | } 726 | document.getElementsByClassName('two')[0].addEventListener('click', two, false); 727 | function three(){ 728 | if(document.tic.sqr3.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr3.value = ' X '; sqr3T = 1; turn = 1; vari(); check();} else if(document.tic.sqr3.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr3.value = ' X '; sqr3T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr3.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr3.value = ' O '; sqr3T = 1; turn = 1; vari(); player1Check()} drawCheck() 729 | } 730 | document.getElementsByClassName('three')[0].addEventListener('click', three, false); 731 | function four(){ 732 | if(document.tic.sqr4.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr4.value = ' X '; sqr4T = 1; turn = 1; vari(); check();} else if(document.tic.sqr4.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr4.value = ' X '; sqr4T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr4.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr4.value = ' O '; sqr4T = 1; turn = 1; vari(); player1Check()} drawCheck() 733 | } 734 | document.getElementsByClassName('four')[0].addEventListener('click', four, false); 735 | function five(){ 736 | if(document.tic.sqr5.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr5.value = ' X '; sqr5T = 1; turn = 1; vari(); check();} else if(document.tic.sqr5.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr5.value = ' X '; sqr5T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr5.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr5.value = ' O '; sqr5T = 1; turn = 1; vari(); player1Check()} drawCheck() 737 | } 738 | document.getElementsByClassName('five')[0].addEventListener('click', five, false); 739 | function six(){ 740 | if(document.tic.sqr6.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr6.value = ' X '; sqr6T = 1; turn = 1; vari(); check();} else if(document.tic.sqr6.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr6.value = ' X '; sqr6T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr6.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr6.value = ' O '; sqr6T = 1; turn = 1; vari(); player1Check()} drawCheck() 741 | } 742 | document.getElementsByClassName('six')[0].addEventListener('click', six, false); 743 | function seven(){ 744 | if(document.tic.sqr7.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr7.value = ' X '; sqr7T = 1; turn = 1; vari(); check();} else if(document.tic.sqr7.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr7.value = ' X '; sqr7T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr7.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr7.value = ' O '; sqr7T = 1; turn = 1; vari(); player1Check()} drawCheck() 745 | } 746 | document.getElementsByClassName('seven')[0].addEventListener('click', seven, false); 747 | function eight(){ 748 | if(document.tic.sqr8.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr8.value = ' X '; sqr8T = 1; turn = 1; vari(); check();} else if(document.tic.sqr8.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr8.value = ' X '; sqr8T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr8.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr8.value = ' O '; sqr8T = 1; turn = 1; vari(); player1Check()} drawCheck() 749 | } 750 | document.getElementsByClassName('eight')[0].addEventListener('click', eight, false); 751 | function nine(){ 752 | if(document.tic.sqr9.value == ' ' && turn == 0 && mode == 1) {document.tic.sqr9.value = ' X '; sqr9T = 1; turn = 1; vari(); check();} else if(document.tic.sqr9.value == ' ' && turn == 1 && mode == 2) {document.tic.sqr9.value = ' X '; sqr9T = 1; turn = 0; vari(); player1Check()} else if(document.tic.sqr9.value == ' ' && turn == 0 && mode == 2) {document.tic.sqr9.value = ' O '; sqr9T = 1; turn = 1; vari(); player1Check()} drawCheck() 753 | } 754 | document.getElementsByClassName('nine')[0].addEventListener('click', nine, false); 755 | -------------------------------------------------------------------------------- /todo_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | The icon logo_32.png,logo_64.png is taken from "http://www.flaticon.com/free-icon/to-do-list_1560#" 2 | -------------------------------------------------------------------------------- /todo_webext/icons/logo_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/todo_webext/icons/logo_32.png -------------------------------------------------------------------------------- /todo_webext/icons/logo_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/todo_webext/icons/logo_64.png -------------------------------------------------------------------------------- /todo_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "A todo addon which lets you to keep a track of your work, stays in browser and available on just a click", 3 | "manifest_version": 2, 4 | "name": "Todo", 5 | "version": "2.0", 6 | "homepage_url": "https://github.com/tsl143/jsDemos/todo_webext", 7 | "icons": { 8 | "32": "icons/logo_32.png", 9 | "64": "icons/logo_64.png" 10 | }, 11 | "applications": { 12 | "gecko": { 13 | "id": "{993d7fd9-f6ba-434a-9949-2483488a8db6}" 14 | } 15 | }, 16 | "browser_action": { 17 | "default_icon": "icons/logo_32.png", 18 | "default_title": "ToDo", 19 | "default_popup": "popup/index.html" 20 | }, 21 | "permissions": ["storage"] 22 | } 23 | -------------------------------------------------------------------------------- /todo_webext/popup/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 56 | 57 | 58 |
    59 | 60 | SAVE IT! 61 |
    62 |
    63 | 64 |
    65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /todo_webext/popup/script.js: -------------------------------------------------------------------------------- 1 | let todos = []; 2 | 3 | const pushTodos = ({tslTodos = []}) => { 4 | tslTodos.forEach((entry)=>{ 5 | todos.push(entry); 6 | }); 7 | } 8 | 9 | const gettingItem = browser.storage.sync.get('tslTodos'); 10 | gettingItem.then(async (res) => { 11 | const localResult = await browser.storage.local.get('tslTodos') || {}; 12 | if(localResult.tslTodos) { 13 | pushTodos(localResult); 14 | resetMemory(); 15 | } 16 | pushTodos(res); 17 | setupTodos(); 18 | }); 19 | 20 | function setupTodos(){ 21 | if(todos.length > 0){ 22 | todos.forEach((entry)=>{ 23 | insertTodo(entry); 24 | }); 25 | setupBadge(); 26 | } 27 | } 28 | 29 | function insertTodo(entry){ 30 | 31 | let tempChild = document.createElement('div'); 32 | 33 | if(entry.done !== 0){ 34 | tempChild.className="IAmDone row"; 35 | 36 | }else{ 37 | tempChild.className="row"; 38 | } 39 | 40 | tempChild.innerHTML = `
    🗑
    ${entry.task}
    `; 41 | tempChild.setAttribute('data-isDone',entry.done); 42 | tempChild.setAttribute('data-id',entry.key); 43 | 44 | const todosHolder = document.getElementById('todosHolder'); 45 | todosHolder.appendChild(tempChild); 46 | 47 | } 48 | 49 | function pushIntoStore(obj){ 50 | let len = todos.length + 1; 51 | let index = "I"+len; 52 | 53 | obj.key = index; 54 | todos.push(obj); 55 | return obj; 56 | 57 | } 58 | 59 | function toggleTodo(ele){ 60 | let parentNode = ele.parentNode; 61 | let dataId = parentNode.getAttribute('data-id'); 62 | let dataIsDone = parentNode.getAttribute('data-isDone'); 63 | 64 | if(parseInt(dataIsDone, 10)!==0){ 65 | parentNode.className = "row"; 66 | parentNode.setAttribute('data-isDone',0); 67 | }else{ 68 | parentNode.className = "IAmDone row"; 69 | parentNode.setAttribute('data-isDone',1); 70 | } 71 | toggleTodoInMemory(dataId,dataIsDone); 72 | } 73 | 74 | function removeTodo(ele){ 75 | 76 | let parentNode = ele.parentNode; 77 | let dataId = parentNode.getAttribute('data-id'); 78 | removeTodoFromMemory(dataId); 79 | parentNode.remove(dataId); 80 | } 81 | 82 | function removeTodoFromMemory(dataId){ 83 | todos = todos.filter((item) => item.key !== dataId); 84 | resetMemory(); 85 | } 86 | 87 | function toggleTodoInMemory(dataId,dataIsDone){ 88 | todos = todos.map(entry => { 89 | if(entry.key == dataId) entry.done = dataIsDone != 1 ? 1:0; 90 | return entry; 91 | }); 92 | resetMemory(); 93 | } 94 | 95 | function saveToDo() { 96 | 97 | let todoVal = document.getElementsByTagName('textarea')[0].value; 98 | 99 | if(todoVal.trim().length>0){ 100 | obj = pushIntoStore({task:todoVal, done:0}); 101 | insertTodo(obj); 102 | document.getElementsByTagName('textarea')[0].value = ""; 103 | 104 | resetMemory(); 105 | } 106 | } 107 | 108 | function resetMemory() { 109 | browser.storage.local.clear(); 110 | browser.storage.sync.set({tslTodos:todos}); 111 | setupBadge(); 112 | } 113 | 114 | document.querySelector('body').addEventListener('click', function(event) { 115 | if (event.target.className === 'removeTodo') 116 | removeTodo(event.target); 117 | 118 | if (event.target.className === 'toggleTodo') 119 | toggleTodo(event.target); 120 | 121 | if (event.target.className === 'addTask') 122 | saveToDo(); 123 | 124 | }); 125 | 126 | function setupBadge(){ 127 | count = todos.filter((item) => item.done === 0).length; 128 | if (count > 0) 129 | browser.browserAction.setBadgeText({text: count.toString()}); 130 | else 131 | browser.browserAction.setBadgeText({text: ''}); 132 | } 133 | 134 | document.querySelector('textarea').addEventListener('keyup',function(event) { 135 | if(event.keyCode == 13) 136 | saveToDo(); 137 | }); 138 | -------------------------------------------------------------------------------- /togglePassword_webext/chrome/bg.js: -------------------------------------------------------------------------------- 1 | chrome.browserAction.onClicked.addListener(tab => { 2 | chrome.tabs.executeScript(tab.Id, {file: 'cs.js'}); 3 | }); -------------------------------------------------------------------------------- /togglePassword_webext/chrome/cs.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | const passwords = Array.from(document.querySelectorAll('input[type="password"]')); 3 | const changedPasswords = Array.from(document.querySelectorAll('input[data-toggled-password="true"]')) 4 | 5 | if(passwords.length) { 6 | passwords.forEach(p => { 7 | p.setAttribute('type', 'text'); 8 | p.setAttribute('data-toggled-password', 'true'); 9 | }) 10 | } else if (changedPasswords.length) { 11 | changedPasswords.forEach(p => { 12 | p.setAttribute('type', 'password'); 13 | p.removeAttribute('data-toggled-password'); 14 | }) 15 | } 16 | })(); -------------------------------------------------------------------------------- /togglePassword_webext/chrome/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by "http://www.freepik.com" from "www.flaticon.com" is licensed by Creative Commons BY 3.0 -------------------------------------------------------------------------------- /togglePassword_webext/chrome/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/chrome/icons/icon_128.png -------------------------------------------------------------------------------- /togglePassword_webext/chrome/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/chrome/icons/icon_32.png -------------------------------------------------------------------------------- /togglePassword_webext/chrome/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/chrome/icons/icon_48.png -------------------------------------------------------------------------------- /togglePassword_webext/chrome/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/chrome/icons/icon_64.png -------------------------------------------------------------------------------- /togglePassword_webext/chrome/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Toggle Password", 4 | "description": "Toggles password field to show plain text and vice versa.", 5 | "version": "1.0.0", 6 | "icons": { 7 | "32": "icons/icon_32.png", 8 | "48": "icons/icon_48.png", 9 | "64": "icons/icon_64.png" 10 | }, 11 | "background": { 12 | "scripts": ["bg.js"] 13 | }, 14 | "permissions": ["activeTab"], 15 | "browser_action": { 16 | "default_icon": "icons/icon_32.png", 17 | "default_title": "Toggle Password" 18 | }, 19 | "commands": { 20 | "_execute_browser_action": { 21 | "suggested_key": { 22 | "default": "Alt+Shift+P" 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /togglePassword_webext/ff/_locales/de/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionName": { 3 | "message": "Passwort umschalten", 4 | "description": "Name of the extension." 5 | }, 6 | 7 | "extensionDescription": { 8 | "message": "Schaltet das Kennwortfeld um, um Klartext anzuzeigen, und umgekehrt.", 9 | "description": "Description of the extension." 10 | }, 11 | 12 | "buttonTitle": { 13 | "message": "Passwort umschalten", 14 | "description": "Title of the toolbar button." 15 | } 16 | } -------------------------------------------------------------------------------- /togglePassword_webext/ff/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "extensionName": { 3 | "message": "Toggle Password", 4 | "description": "Name of the extension." 5 | }, 6 | 7 | "extensionDescription": { 8 | "message": "Toggles password field to show plain text and vice versa.", 9 | "description": "Description of the extension." 10 | }, 11 | 12 | "buttonTitle": { 13 | "message": "Toggle Password", 14 | "description": "Title of the toolbar button." 15 | } 16 | } -------------------------------------------------------------------------------- /togglePassword_webext/ff/bg.js: -------------------------------------------------------------------------------- 1 | chrome.browserAction.onClicked.addListener(tab => { 2 | chrome.tabs.executeScript(tab.Id, {file: 'cs.js'}); 3 | }); -------------------------------------------------------------------------------- /togglePassword_webext/ff/cs.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | const passwords = Array.from(document.querySelectorAll('input[type="password"]')); 3 | const changedPasswords = Array.from(document.querySelectorAll('input[data-toggled-password="true"]')) 4 | 5 | if(passwords.length) { 6 | passwords.forEach(p => { 7 | p.setAttribute('type', 'text'); 8 | p.setAttribute('data-toggled-password', 'true'); 9 | }) 10 | } else if (changedPasswords.length) { 11 | changedPasswords.forEach(p => { 12 | p.setAttribute('type', 'password'); 13 | p.removeAttribute('data-toggled-password'); 14 | }) 15 | } 16 | })(); -------------------------------------------------------------------------------- /togglePassword_webext/ff/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by "http://www.freepik.com" from "www.flaticon.com" is licensed by Creative Commons BY 3.0 -------------------------------------------------------------------------------- /togglePassword_webext/ff/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/ff/icons/icon_128.png -------------------------------------------------------------------------------- /togglePassword_webext/ff/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/ff/icons/icon_32.png -------------------------------------------------------------------------------- /togglePassword_webext/ff/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/ff/icons/icon_48.png -------------------------------------------------------------------------------- /togglePassword_webext/ff/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/togglePassword_webext/ff/icons/icon_64.png -------------------------------------------------------------------------------- /togglePassword_webext/ff/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "__MSG_extensionName__", 4 | "description": "__MSG_extensionDescription__", 5 | "version": "1.0.2", 6 | "icons": { 7 | "32": "icons/icon_32.png", 8 | "48": "icons/icon_48.png", 9 | "64": "icons/icon_64.png" 10 | }, 11 | "background": { 12 | "scripts": ["bg.js"] 13 | }, 14 | "default_locale": "en", 15 | "permissions": ["activeTab"], 16 | "browser_action": { 17 | "default_icon": "icons/icon_32.png", 18 | "default_title": "__MSG_buttonTitle__" 19 | }, 20 | "options_ui": { 21 | "page": "options.html" 22 | }, 23 | "commands": { 24 | "_execute_browser_action": { 25 | "suggested_key": { 26 | "default": "Alt+Shift+P" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /togglePassword_webext/ff/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Keyboard Shortcut   4 |   5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /togglePassword_webext/ff/options.js: -------------------------------------------------------------------------------- 1 | const m = typeof browser != 'undefined' ? true : false; 2 | const c = m ? browser : chrome; 3 | const t = document.getElementById("togglerShortcut"); 4 | const d = document.getElementById("restoreDefault"); 5 | t.style.cssText = ` 6 | width: 200px; 7 | padding: 5px 10px; 8 | color: #444; 9 | `; 10 | d.style.cssText = ` 11 | width: 100px; 12 | padding: 5px 10px; 13 | color: #444; 14 | background: transparent; 15 | border: 1px solid #444; 16 | text-align: center; 17 | `; 18 | const setShortCut = s => { 19 | c.commands.update({ 20 | name: '_execute_browser_action', 21 | shortcut: s 22 | }); 23 | t.value = s; 24 | } 25 | const handlePress= e => { 26 | if(e.key.length === 1 && /[a-zA-Z0-9]/.test(e.key)) { 27 | setShortCut(`Alt+Shift+${e.key.toUpperCase()}`) 28 | } else { 29 | t.value = 'Alt+Shift+'; 30 | } 31 | } 32 | const showCmd = c => (t.value = c.shortcut); 33 | const getCommands = m 34 | ? browser.commands.getAll().then(c => {showCmd(c[0])}) 35 | : chrome.commands.getAll(c => showCmd(c[0])); 36 | 37 | t.addEventListener('click', e=>{e.target.value='Alt+Shift+'}) 38 | t.addEventListener('keyup', handlePress) 39 | d.addEventListener('click', ()=>setShortCut('Alt+Shift+P')) 40 | -------------------------------------------------------------------------------- /wordCount_webext/background.js: -------------------------------------------------------------------------------- 1 | const MAX_LIMIT = 16384; 2 | const doTheMagic = text => { 3 | let selectedText = text; 4 | selectedText = selectedText.replace(/,/g, ' '); 5 | selectedText = selectedText.replace(/;/g, ' '); 6 | selectedText = selectedText.replace(/\//g, ' '); 7 | selectedText = selectedText.replace(/\\/g, ' '); 8 | selectedText = selectedText.replace(/{/g, ' '); 9 | selectedText = selectedText.replace(/}/g, ' '); 10 | selectedText = selectedText.replace(/\n/g, ' '); 11 | selectedText = selectedText.replace(/\s\s+/g, ' '); 12 | 13 | let totalWords = selectedText.trim().split(' '); 14 | totalWords = totalWords.filter(word => { 15 | if (!(word.length === 1 && !word.match(/^[a-zA-Z0-9]+$/))) 16 | return true; 17 | }); 18 | 19 | browser.notifications.create({ 20 | "type": "basic", 21 | "title": "Word Count", 22 | "message": `Total Words: ${totalWords.length}\nTotal Characters: ${text.length}` 23 | }); 24 | } 25 | 26 | const notRestricted = (tab) => { 27 | const {url} = tab[0]; 28 | if(!url.includes('http') || url.includes('addons.mozilla.org')) { 29 | browser.notifications.create({ 30 | "type": "basic", 31 | "title": "Not Supported", 32 | "message": `Cannot count beyond ${MAX_LIMIT} characters on this URL/Page (browser restricted)!` 33 | }); 34 | return false; 35 | } 36 | return true; 37 | } 38 | 39 | const countMe = info => { 40 | let selectedText = info.selectionText || ''; 41 | if (selectedText.length == MAX_LIMIT) { 42 | browser.tabs.query({currentWindow: true, active: true}) 43 | .then(tabs => { 44 | if(notRestricted(tabs)) { 45 | browser.tabs.executeScript({ code: `WCtargetElementId = ${info.targetElementId};` }); 46 | browser.tabs.executeScript({ file: 'cs.js' }); 47 | } 48 | }) 49 | } else { 50 | doTheMagic(selectedText) 51 | } 52 | } 53 | 54 | browser.menus.create({ 55 | id: "count-me", 56 | title: 'Word Count', 57 | contexts: ["all"] 58 | }); 59 | 60 | browser.menus.onClicked.addListener(countMe); 61 | browser.runtime.onMessage.addListener(({ selectionText }) => doTheMagic(selectionText)); 62 | browser.notifications.onShown.addListener(id=>{setTimeout(() => browser.notifications.clear(id), 5000)}); 63 | -------------------------------------------------------------------------------- /wordCount_webext/chrome/background.js: -------------------------------------------------------------------------------- 1 | const countMe = info => { 2 | let selectedText = info.selectionText || ''; 3 | selectedText = selectedText.replace(/,/g, ' '); 4 | selectedText = selectedText.replace(/;/g, ' '); 5 | selectedText = selectedText.replace(/\//g, ' '); 6 | selectedText = selectedText.replace(/\\/g, ' '); 7 | selectedText = selectedText.replace(/{/g, ' '); 8 | selectedText = selectedText.replace(/}/g, ' '); 9 | selectedText = selectedText.replace(/\n/g, ' '); 10 | selectedText = selectedText.replace(/\s\s+/g, ' '); 11 | 12 | let totalWords = selectedText.trim().split(' '); 13 | totalWords = totalWords.filter(word => { 14 | if (!(word.length === 1 && !word.match(/^[a-zA-Z0-9]+$/))) 15 | return true; 16 | }); 17 | 18 | chrome.notifications.create({ 19 | "type": "basic", 20 | "title": "Word Count", 21 | "iconUrl": chrome.runtime.getURL('icons/icon_64.png'), 22 | "message": `Total Words: ${totalWords.length}\nTotal Characters: ${selectedText.length}` 23 | }); 24 | } 25 | 26 | chrome.contextMenus.create({ 27 | id: "count-me", 28 | title: 'Word Count', 29 | contexts: ["all"] 30 | }); 31 | 32 | chrome.contextMenus.onClicked.addListener(countMe); -------------------------------------------------------------------------------- /wordCount_webext/chrome/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by Darius Dan from www.flaticon.com is licensed by CC 3.0 BY -------------------------------------------------------------------------------- /wordCount_webext/chrome/icons/icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/chrome/icons/icon_128.png -------------------------------------------------------------------------------- /wordCount_webext/chrome/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/chrome/icons/icon_32.png -------------------------------------------------------------------------------- /wordCount_webext/chrome/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/chrome/icons/icon_64.png -------------------------------------------------------------------------------- /wordCount_webext/chrome/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name" : "Word count", 4 | "description" : "Counts words and characters in selected text", 5 | "version": "1.0.0", 6 | "icons": { 7 | "32": "icons/icon_32.png", 8 | "128": "icons/icon_128.png", 9 | "64": "icons/icon_64.png" 10 | }, 11 | "background": { 12 | "scripts": ["background.js"] 13 | }, 14 | "permissions" : [ 15 | "contextMenus", 16 | "notifications" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /wordCount_webext/cs.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | try { 3 | const getTextSelection = field => field.value.substring(field.selectionStart, field.selectionEnd); 4 | const selectionText = window.getSelection().toString() || getTextSelection(browser.menus.getTargetElement(WCtargetElementId)); 5 | chrome.runtime.sendMessage({selectionText}); 6 | }catch (e) { 7 | console.log(`Schaize: ${e}`); 8 | } 9 | })(); -------------------------------------------------------------------------------- /wordCount_webext/icons/LICENSE: -------------------------------------------------------------------------------- 1 | Icons made by Darius Dan from www.flaticon.com is licensed by CC 3.0 BY -------------------------------------------------------------------------------- /wordCount_webext/icons/icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/icons/icon_32.png -------------------------------------------------------------------------------- /wordCount_webext/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/icons/icon_48.png -------------------------------------------------------------------------------- /wordCount_webext/icons/icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/icons/icon_64.png -------------------------------------------------------------------------------- /wordCount_webext/icons/icon_96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tsl143/jsDemos/f84e7526951b89971f71d06f2eb3d6b032e7ec27/wordCount_webext/icons/icon_96.png -------------------------------------------------------------------------------- /wordCount_webext/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name" : "word count", 4 | "description" : "Counts words and characters in selected text", 5 | "version": "2.0", 6 | 7 | "icons": { 8 | "32": "icons/icon_32.png", 9 | "48": "icons/icon_48.png", 10 | "64": "icons/icon_64.png" 11 | }, 12 | "background": { 13 | "scripts": ["background.js"] 14 | }, 15 | "permissions" : [ 16 | "menus", 17 | "notifications", 18 | "activeTab" 19 | ] 20 | } 21 | --------------------------------------------------------------------------------