├── LICENSE ├── README.md ├── v2 ├── LICENSE ├── common.js ├── data │ ├── icons │ │ ├── 128.png │ │ ├── 16.png │ │ ├── 256.png │ │ ├── 32.png │ │ ├── 48.png │ │ ├── 512.png │ │ ├── 64.png │ │ ├── bookmarked │ │ │ ├── 16.png │ │ │ ├── 32.png │ │ │ └── 64.png │ │ └── light │ │ │ ├── 16.png │ │ │ ├── 32.png │ │ │ ├── 48.png │ │ │ └── 64.png │ ├── options │ │ ├── index.html │ │ ├── index.js │ │ ├── matched.js │ │ └── matched.json │ └── panel │ │ ├── ReadMe.txt │ │ ├── body.js │ │ ├── font │ │ ├── fontello.css │ │ └── fontello.woff │ │ ├── fuse.js │ │ ├── icons │ │ ├── d_folder.svg │ │ ├── folder.svg │ │ ├── page.png │ │ └── window.svg │ │ ├── index.css │ │ ├── index.html │ │ ├── jquery-3.1.1.js │ │ ├── jstree │ │ ├── ReadMe │ │ ├── jstree.js │ │ └── themes │ │ │ ├── default-dark │ │ │ ├── 32px.png │ │ │ ├── 40px.png │ │ │ ├── style.css │ │ │ ├── style.min.css │ │ │ └── throbber.gif │ │ │ └── default │ │ │ ├── 32px.png │ │ │ ├── 40px.png │ │ │ ├── style.css │ │ │ └── throbber.gif │ │ ├── notification.js │ │ ├── properties.js │ │ ├── search.js │ │ ├── second.js │ │ ├── toolbar.js │ │ ├── tree.js │ │ └── utils.js └── manifest.json └── v3 ├── LICENSE ├── context.js ├── data ├── icons │ ├── 128.png │ ├── 16.png │ ├── 256.png │ ├── 32.png │ ├── 48.png │ ├── 512.png │ ├── 64.png │ ├── bookmarked │ │ ├── 16.png │ │ └── 32.png │ └── light │ │ ├── 16.png │ │ ├── 32.png │ │ ├── 48.png │ │ └── 64.png ├── options │ ├── index.css │ ├── index.html │ └── index.js └── panel │ ├── ReadMe.txt │ ├── body.js │ ├── font │ ├── fontello.css │ └── fontello.woff │ ├── fuse.js │ ├── icons │ ├── d_folder.svg │ ├── folder.svg │ ├── page.png │ └── window.svg │ ├── index.css │ ├── index.html │ ├── jstree │ ├── ReadMe │ ├── jquery-3.7.1.js │ ├── jstree.js │ └── themes │ │ ├── default-dark │ │ ├── 32px.png │ │ ├── 40px.png │ │ ├── style.css │ │ ├── style.min.css │ │ └── throbber.gif │ │ └── default │ │ ├── 32px.png │ │ ├── 40px.png │ │ ├── style.css │ │ ├── style.min.css │ │ └── throbber.gif │ ├── notification.js │ ├── properties.js │ ├── search.js │ ├── second.js │ ├── toolbar.js │ ├── tree.js │ └── utils.js ├── manifest.json ├── monitor.js └── worker.js /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bookmarks Manager and Viewer 2 | 3 | The "Bookmarks Manager and Viewer" extension provides a panel view to modify your bookmarks. The panel is equipped with fuzzy search (like Google search) to help you find the matching bookmarks. You have a set of tools to edit your bookmarks on the fly. It is even possible to drag a bookmark to a new position in the tree or create a new directory and place the bookmark inside it. 4 | 5 | ### YouTube Preview 6 | [![Preview](https://img.youtube.com/vi/QoR1frHBo0c/0.jpg)](https://www.youtube.com/watch?v=QoR1frHBo0c) 7 | 8 | ### Links 9 | * FAQs Page: https://webextension.org/listing/bookmarks-manager.html 10 | * Chrome: https://chromewebstore.google.com/detail/bookmarks-manager-and-vie/mnhojcjhcilkgkmijhphlbmghmmdhlfg 11 | * Firefox: https://addons.mozilla.org/firefox/addon/bookmarks-manager-and-viewer/ 12 | * Edge: https://microsoftedge.microsoft.com/addons/detail/chpbahhnffhmdbnamehajbajmciholpa 13 | * Opera: https://addons.opera.com/extensions/details/bookmarks-manager-and-viewer/ 14 | -------------------------------------------------------------------------------- /v2/LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /v2/common.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | var notify = message => chrome.notifications.create({ 14 | iconUrl: 'data/icons/48.png', 15 | title: chrome.runtime.getManifest().name, 16 | message, 17 | type: 'basic' 18 | }); 19 | 20 | var title = url => new Promise((resolve, reject) => { 21 | const req = new XMLHttpRequest(); 22 | req.open('GET', url); 23 | req.responseType = 'document'; 24 | req.onload = () => { 25 | const title = req.responseXML ? req.responseXML.title : ''; 26 | if (title) { 27 | resolve(title); 28 | } 29 | else { 30 | reject('Cannot detect "title" from GET response'); 31 | } 32 | }; 33 | req.onerror = e => reject(e.type + ' ' + req.status); 34 | req.ontimeout = () => reject('cannot resolve title (timeout)'); 35 | req.send(); 36 | }); 37 | 38 | chrome.runtime.onMessage.addListener((request, sender, response) => { 39 | if (request.cmd === 'validate') { 40 | const req = new XMLHttpRequest(); 41 | try { 42 | req.open('GET', request.url); 43 | } 44 | catch (e) { 45 | return response({ 46 | valid: false, 47 | msg: 'Link is dead' 48 | }); 49 | } 50 | req.timeout = 6000; 51 | req.onload = () => response({ 52 | valid: true, 53 | msg: 'Link is fine' 54 | }); 55 | req.ontimeout = req.onerror = () => response({ 56 | valid: false, 57 | msg: 'Link is dead' 58 | }); 59 | req.send(); 60 | 61 | return true; 62 | } 63 | else if (request.cmd === 'update-title') { 64 | title(request.url).then(title => response({title}), error => response({error})); 65 | return true; 66 | } 67 | }); 68 | 69 | function activate(tabId) { 70 | chrome.browserAction.setIcon({ 71 | tabId, 72 | path: { 73 | '16': 'data/icons/bookmarked/16.png', 74 | '32': 'data/icons/bookmarked/32.png', 75 | '64': 'data/icons/bookmarked/64.png' 76 | } 77 | }, () => chrome.runtime.lastError); 78 | } 79 | function deactivate(tabId) { 80 | chrome.browserAction.setIcon({ 81 | tabId, 82 | path: { 83 | '16': 'data/icons/16.png', 84 | '32': 'data/icons/32.png', 85 | '64': 'data/icons/64.png' 86 | } 87 | }, () => chrome.runtime.lastError); 88 | } 89 | 90 | function search(url, callback) { 91 | if (url.startsWith('about:') || url.startsWith('view-source:')) { 92 | return; 93 | } 94 | chrome.bookmarks.search({url}, callback); 95 | } 96 | 97 | chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { 98 | search(tab.url, nodes => { 99 | if (nodes && nodes.length) { 100 | activate(tabId); 101 | } 102 | }); 103 | }); 104 | 105 | function update() { 106 | chrome.tabs.query({}, tabs => { 107 | tabs.forEach(tab => { 108 | search(tab.url, nodes => { 109 | if (nodes && nodes.length) { 110 | activate(tab.id); 111 | } 112 | else { 113 | deactivate(tab.id); 114 | } 115 | }); 116 | }); 117 | }); 118 | } 119 | chrome.bookmarks.onChanged.addListener(update); 120 | chrome.bookmarks.onCreated.addListener(update); 121 | chrome.bookmarks.onRemoved.addListener(update); 122 | update(); 123 | 124 | // context menu 125 | { 126 | const context = ''; 127 | 128 | const once = () => { 129 | if (once.done) { 130 | return; 131 | } 132 | once.done = true; 133 | 134 | chrome.storage.local.get({ 135 | context, 136 | mode: 'popup' 137 | }, prefs => { 138 | if (prefs.context) { 139 | chrome.contextMenus.create({ 140 | id: 'bookmark-link', 141 | title: 'Bookmark this Link', 142 | contexts: ['link'], 143 | targetUrlPatterns: ['*://*/*'] 144 | }); 145 | } 146 | }); 147 | }; 148 | chrome.runtime.onInstalled.addListener(once); 149 | chrome.runtime.onStartup.addListener(once); 150 | 151 | chrome.contextMenus.onClicked.addListener(info => { 152 | if (info.menuItemId === 'bookmark-link') { 153 | title(info.linkUrl).catch(() => info.selectionText || info.linkUrl).then(title => chrome.storage.local.get({ 154 | context 155 | }, prefs => chrome.bookmarks.create({ 156 | parentId: prefs.context, 157 | title, 158 | url: info.linkUrl 159 | }, () => { 160 | const lastError = chrome.runtime.lastError; 161 | if (lastError) { 162 | notify(lastError.message); 163 | } 164 | }))); 165 | } 166 | }); 167 | } 168 | 169 | // mode 170 | { 171 | const once = () => { 172 | if (once.done) { 173 | return; 174 | } 175 | once.done = true; 176 | chrome.storage.local.get({ 177 | mode: 'popup' 178 | }, prefs => chrome.browserAction.setPopup({ 179 | popup: prefs.mode === 'popup' ? 'data/panel/index.html' : '' 180 | })); 181 | }; 182 | 183 | chrome.runtime.onInstalled.addListener(once); 184 | chrome.runtime.onStartup.addListener(once); 185 | chrome.storage.onChanged.addListener(prefs => { 186 | if (prefs.mode) { 187 | once.done = false; 188 | once(); 189 | } 190 | }); 191 | } 192 | chrome.browserAction.onClicked.addListener(() => chrome.tabs.create({ 193 | url: '/data/panel/index.html?in=tab' 194 | })); 195 | 196 | /* FAQs & Feedback */ 197 | { 198 | const {management, runtime: {onInstalled, setUninstallURL, getManifest}, storage, tabs} = chrome; 199 | if (navigator.webdriver !== true) { 200 | const {homepage_url: page, name, version} = getManifest(); 201 | onInstalled.addListener(({reason, previousVersion}) => { 202 | management.getSelf(({installType}) => installType === 'normal' && storage.local.get({ 203 | 'faqs': true, 204 | 'last-update': 0 205 | }, prefs => { 206 | if (reason === 'install' || (prefs.faqs && reason === 'update')) { 207 | const doUpdate = (Date.now() - prefs['last-update']) / 1000 / 60 / 60 / 24 > 45; 208 | if (doUpdate && previousVersion !== version) { 209 | tabs.query({active: true, lastFocusedWindow: true}, tbs => tabs.create({ 210 | url: page + '?version=' + version + (previousVersion ? '&p=' + previousVersion : '') + '&type=' + reason, 211 | active: reason === 'install', 212 | ...(tbs && tbs.length && {index: tbs[0].index + 1}) 213 | })); 214 | storage.local.set({'last-update': Date.now()}); 215 | } 216 | } 217 | })); 218 | }); 219 | setUninstallURL(page + '?rd=feedback&name=' + encodeURIComponent(name) + '&version=' + version); 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /v2/data/icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/128.png -------------------------------------------------------------------------------- /v2/data/icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/16.png -------------------------------------------------------------------------------- /v2/data/icons/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/256.png -------------------------------------------------------------------------------- /v2/data/icons/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/32.png -------------------------------------------------------------------------------- /v2/data/icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/48.png -------------------------------------------------------------------------------- /v2/data/icons/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/512.png -------------------------------------------------------------------------------- /v2/data/icons/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/64.png -------------------------------------------------------------------------------- /v2/data/icons/bookmarked/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/bookmarked/16.png -------------------------------------------------------------------------------- /v2/data/icons/bookmarked/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/bookmarked/32.png -------------------------------------------------------------------------------- /v2/data/icons/bookmarked/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/bookmarked/64.png -------------------------------------------------------------------------------- /v2/data/icons/light/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/light/16.png -------------------------------------------------------------------------------- /v2/data/icons/light/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/light/32.png -------------------------------------------------------------------------------- /v2/data/icons/light/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/light/48.png -------------------------------------------------------------------------------- /v2/data/icons/light/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/icons/light/64.png -------------------------------------------------------------------------------- /v2/data/options/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Options 5 | 6 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
Open the manager window in:2:
Bookmark from right-click context menu over links3:
70 |

71 | Custom styling (Read FAQs page for more info): 72 | 73 |

74 | 75 |

76 | Rate "Bookmark Manager and Viewer" 77 |

78 |
79 |

80 | 81 | - 82 | 83 |

84 |
85 |

86 | 1. If sort is enabled, you cannot use the drag and drop operation anymore 87 |
88 | 2. In Firefox and Opera, you can also open the manager window in the browser sidebar area too 89 |
90 | 3. Clear the box to disable the right-click context menu over links, otherwise place the ID of the bookmark folder in the box. You can find the id from right-click context menu over a bookmark folder in the extension's popup (extension restart is required) 91 |
92 | 4. Check this box to automatically set the focus to the search box when opening the manager window. The default focus is on the bookmark tree and you can focus the search box using Ctrl + F. 93 |
94 | 5. In Firefox, there is no built-in service for resolving domain's icon. If this item is checked, the extension uses http://www.google.com/s2/favicons service to resolve icons. 95 |

96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /v2/data/options/index.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | var log = document.getElementById('status'); 14 | 15 | function restore() { 16 | document.getElementById('css').value = localStorage.getItem('css') || ''; 17 | document.getElementById('sort').checked = localStorage.getItem('sort') === 'true'; 18 | document.getElementById('searchfocus').checked = localStorage.getItem('searchfocus') === 'true'; 19 | document.getElementById('resolve').checked = localStorage.getItem('resolve') === 'true'; 20 | 21 | chrome.storage.local.get({ 22 | width: 400, 23 | height: 600, 24 | context: '', 25 | mode: 'popup' 26 | }, prefs => { 27 | document.getElementById('width').value = prefs.width; 28 | document.getElementById('height').value = prefs.height; 29 | document.getElementById('context').value = prefs.context; 30 | document.getElementById('mode').value = prefs.mode; 31 | }); 32 | } 33 | 34 | function save() { 35 | localStorage.setItem('css', document.getElementById('css').value || ''); 36 | localStorage.setItem('sort', document.getElementById('sort').checked); 37 | localStorage.setItem('searchfocus', document.getElementById('searchfocus').checked); 38 | localStorage.setItem('resolve', document.getElementById('resolve').checked); 39 | const prefs = { 40 | width: Math.max(300, document.getElementById('width').value), 41 | height: Math.max(400, document.getElementById('height').value), 42 | context: document.getElementById('context').value, 43 | mode: document.getElementById('mode').value 44 | }; 45 | 46 | chrome.storage.local.set(prefs, () => { 47 | log.textContent = 'Options saved.'; 48 | setTimeout(() => log.textContent = '', 750); 49 | restore(); 50 | }); 51 | } 52 | 53 | document.addEventListener('DOMContentLoaded', restore); 54 | document.getElementById('save').addEventListener('click', () => { 55 | try { 56 | save(); 57 | } 58 | catch (e) { 59 | log.textContent = e.message; 60 | setTimeout(() => log.textContent = '', 750); 61 | } 62 | }); 63 | 64 | document.getElementById('reset').addEventListener('click', e => { 65 | if (e.detail === 1) { 66 | window.setTimeout(() => log.textContent = '', 750); 67 | log.textContent = 'Double-click to reset!'; 68 | } 69 | else { 70 | localStorage.clear(); 71 | chrome.storage.local.clear(() => { 72 | chrome.runtime.reload(); 73 | window.close(); 74 | }); 75 | } 76 | }); 77 | 78 | document.getElementById('support').addEventListener('click', () => chrome.tabs.create({ 79 | url: chrome.runtime.getManifest().homepage_url + '?rd=donate' 80 | })); 81 | 82 | if (navigator.userAgent.indexOf('Firefox') !== -1) { 83 | document.getElementById('rate').href = 84 | 'https://addons.mozilla.org/en-US/firefox/addon/bookmarks-manager-and-viewer/reviews/'; 85 | } 86 | else if (navigator.userAgent.indexOf('OPR') !== -1) { 87 | document.getElementById('rate').href = 88 | 'https://addons.opera.com/en/extensions/details/bookmarks-manager-and-viewer/#feedback-container'; 89 | } 90 | -------------------------------------------------------------------------------- /v2/data/options/matched.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | { 4 | const shuffle = array => { 5 | for (let i = array.length - 1; i > 0; i -= 1) { 6 | const j = Math.floor(Math.random() * (i + 1)); 7 | [array[i], array[j]] = [array[j], array[i]]; 8 | } 9 | 10 | return array; 11 | }; 12 | 13 | const root = document.getElementById('explore'); 14 | 15 | const INC = Number(root.dataset.inc || 100); 16 | const count = Number(localStorage.getItem('explore-count') || INC - 5); 17 | 18 | const style = document.createElement('style'); 19 | style.textContent = ` 20 | #explore { 21 | background-color: #fff; 22 | position: relative; 23 | color: #969696; 24 | user-select: none; 25 | } 26 | #explore[data-loaded=true] { 27 | margin: 4px; 28 | padding: 5px; 29 | box-shadow: 0 0 1px #ccc; 30 | border: solid 1px #ccc; 31 | } 32 | #explore .close { 33 | position: absolute; 34 | right: 6px; 35 | top: 4px; 36 | cursor: pointer; 37 | } 38 | #explore>table { 39 | margin-top: 10px; 40 | table-layout: fixed; 41 | width: 100%; 42 | border-collapse: collapse; 43 | } 44 | #explore a { 45 | text-decoration: none; 46 | color: #000; 47 | display: flex; 48 | align-items: center; 49 | justify-content: center; 50 | } 51 | #explore td:first-child a { 52 | justify-content: flex-start; 53 | } 54 | #explore td:last-child a { 55 | justify-content: flex-end; 56 | } 57 | #explore .title { 58 | border-left: solid 1px #ccc; 59 | display: inline-block; 60 | align-items: center; 61 | overflow: hidden; 62 | text-overflow: ellipsis; 63 | white-space: nowrap; 64 | padding-left: 5px; 65 | } 66 | #explore .icon { 67 | min-width: 28px; 68 | height: 28px; 69 | display: inline-flex; 70 | align-items: center; 71 | justify-content: center; 72 | border-radius: 50%; 73 | color: #fff; 74 | margin-right: 5px; 75 | font-size: 10px; 76 | font-weight: 100; 77 | } 78 | #explore .explore { 79 | position: absolute; 80 | right: 10px; 81 | z-index: 1000000; 82 | cursor: pointer; 83 | font-size: 15px; 84 | }`; 85 | document.documentElement.appendChild(style); 86 | 87 | const cload = () => fetch('matched.json').then(r => r.json()).then(build); 88 | const explore = () => { 89 | const span = document.createElement('span'); 90 | span.textContent = '↯'; 91 | span.title = 'Explore more'; 92 | span.classList.add('explore'); 93 | root.appendChild(span); 94 | span.onclick = () => { 95 | root.textContent = ''; 96 | localStorage.setItem('explore-count', INC); 97 | cload(); 98 | }; 99 | }; 100 | const build = json => { 101 | if (json.length === 0) { 102 | return; 103 | } 104 | root.dataset.loaded = true; 105 | root.textContent = 'Explore more'; 106 | const table = document.createElement('table'); 107 | const tr = document.createElement('tr'); 108 | const span = document.createElement('span'); 109 | span.classList.add('close'); 110 | span.textContent = '✕'; 111 | span.onclick = () => { 112 | root.textContent = ''; 113 | root.dataset.loaded = false; 114 | localStorage.setItem('explore-count', 0); 115 | explore(); 116 | }; 117 | root.appendChild(span); 118 | 119 | const {homepage_url} = chrome.runtime.getManifest(); 120 | const origin = homepage_url.split('/').slice(0, -1).join('/'); 121 | const colors = shuffle( 122 | ['524c84', '606470', '755da3', 'c06c84', '393e46', '446e5c', '693e52', '1d566e', '693e52', 'd95858', 'f27370'] 123 | ); 124 | shuffle(Object.entries(json)).slice(0, 3).forEach(([id, {name}], i) => { 125 | const td = document.createElement('td'); 126 | const a = Object.assign(document.createElement('a'), { 127 | target: '_blank', 128 | title: 'Click to browse', 129 | href: origin + '/' + id + '.html?context=explore' 130 | }); 131 | 132 | const icon = document.createElement('span'); 133 | icon.textContent = name.split(' ').slice(0, 2).map(s => s[0]).join('').toUpperCase(); 134 | icon.classList.add('icon'); 135 | icon.style['background-color'] = '#' + colors[i]; 136 | a.appendChild(icon); 137 | 138 | const span = document.createElement('span'); 139 | span.classList.add('title'); 140 | span.textContent = name; 141 | a.appendChild(span); 142 | td.appendChild(a); 143 | tr.appendChild(td); 144 | }); 145 | table.appendChild(tr); 146 | root.appendChild(table); 147 | }; 148 | const init = () => { 149 | if (count >= INC) { 150 | if (count < INC + 3) { 151 | cload(); 152 | } 153 | else { 154 | explore(); 155 | } 156 | if (count > INC + 5) { 157 | localStorage.setItem('explore-count', INC - 6); 158 | } 159 | else { 160 | localStorage.setItem('explore-count', count + 1); 161 | } 162 | } 163 | else { 164 | explore(); 165 | localStorage.setItem('explore-count', count + 1); 166 | } 167 | }; 168 | init(); 169 | } 170 | -------------------------------------------------------------------------------- /v2/data/options/matched.json: -------------------------------------------------------------------------------- 1 | { 2 | "country-flags": { 3 | "name": "Country Flags & IP WHOIS" 4 | }, 5 | "useragent-switcher": { 6 | "name": "User Agent Switcher" 7 | }, 8 | "work-offline": { 9 | "name": "Work Offline" 10 | }, 11 | "local-cdn": { 12 | "name": "Local CDN" 13 | }, 14 | "media-converter": { 15 | "name": "Tor Control (Anonymity Layer)" 16 | }, 17 | "save-images": { 18 | "name": "Download All Images" 19 | }, 20 | "privacy-settings": { 21 | "name": "Privacy Settings" 22 | }, 23 | "media-player": { 24 | "name": "YouTube Media Player" 25 | }, 26 | "tab-discard": { 27 | "name": "Auto Tab Discard" 28 | }, 29 | "send-to": { 30 | "name": "Send to VLC" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /v2/data/panel/ReadMe.txt: -------------------------------------------------------------------------------- 1 | https://github.com/vakata/jstree/archive/3.3.6.zip 2 | https://github.com/krisk/Fuse/archive/v3.3.0.zip 3 | -------------------------------------------------------------------------------- /v2/data/panel/body.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | if (!Element.prototype.scrollIntoViewIfNeeded) { 14 | Element.prototype.scrollIntoViewIfNeeded = function(centerIfNeeded) { 15 | function withinBounds(value, min, max, extent) { 16 | if (centerIfNeeded === false || max <= value + extent && value <= min + extent) { 17 | return Math.min(max, Math.max(min, value)); 18 | } 19 | else { 20 | return (min + max) / 2; 21 | } 22 | } 23 | 24 | function makeArea(left, top, width, height) { 25 | return { 26 | 'left': left, 27 | 'top': top, 28 | 'width': width, 29 | 'height': height, 30 | 'right': left + width, 31 | 'bottom': top + height, 32 | 'translate': function(x, y) { 33 | return makeArea(x + left, y + top, width, height); 34 | }, 35 | 'relativeFromTo': function(lhs, rhs) { 36 | var newLeft = left; 37 | var newTop = top; 38 | lhs = lhs.offsetParent; 39 | rhs = rhs.offsetParent; 40 | if (lhs === rhs) { 41 | return area; 42 | } 43 | for (; lhs; lhs = lhs.offsetParent) { 44 | newLeft += lhs.offsetLeft + lhs.clientLeft; 45 | newTop += lhs.offsetTop + lhs.clientTop; 46 | } 47 | for (; rhs; rhs = rhs.offsetParent) { 48 | newLeft -= rhs.offsetLeft + rhs.clientLeft; 49 | newTop -= rhs.offsetTop + rhs.clientTop; 50 | } 51 | return makeArea(newLeft, newTop, width, height); 52 | } 53 | }; 54 | } 55 | 56 | var parent; 57 | var elem = this; 58 | var area = makeArea( 59 | this.offsetLeft, this.offsetTop, 60 | this.offsetWidth, this.offsetHeight 61 | ); 62 | while ((parent = elem.parentNode) instanceof HTMLElement) { 63 | var clientLeft = parent.offsetLeft + parent.clientLeft; 64 | var clientTop = parent.offsetTop + parent.clientTop; 65 | 66 | // Make area relative to parent's client area. 67 | area = area 68 | .relativeFromTo(elem, parent) 69 | .translate(-clientLeft, -clientTop); 70 | 71 | parent.scrollLeft = withinBounds( 72 | parent.scrollLeft, 73 | area.right - parent.clientWidth, area.left, 74 | parent.clientWidth); 75 | 76 | parent.scrollTop = withinBounds( 77 | parent.scrollTop, 78 | area.bottom - parent.clientHeight, area.top, 79 | parent.clientHeight); 80 | 81 | // Determine actual scroll amount by reading back scroll properties. 82 | area = area.translate(clientLeft - parent.scrollLeft, 83 | clientTop - parent.scrollTop); 84 | elem = parent; 85 | } 86 | }; 87 | } 88 | 89 | { 90 | const css = localStorage.getItem('css') || ''; 91 | if (css) { 92 | const style = document.createElement('style'); 93 | style.textContent = css; 94 | document.documentElement.appendChild(style); 95 | } 96 | } 97 | // loaded in sidebar 98 | 99 | document.addEventListener('DOMContentLoaded', () => { 100 | if (location.search && location.search.indexOf('in=tab') !== -1) { 101 | document.querySelector('[data-cmd=open-in-tab]').remove(); 102 | } 103 | if ( 104 | location.search && location.search.indexOf('in=sidebar') !== -1 || 105 | location.search && location.search.indexOf('in=tab') !== -1 106 | ) { 107 | document.body.style.width = '100%'; 108 | document.body.style.height = '100%'; 109 | } 110 | else { 111 | chrome.storage.local.get({ 112 | width: 400, 113 | height: 600 114 | }, prefs => { 115 | document.body.style.width = prefs.width + 'px'; 116 | document.body.style.height = prefs.height + 'px'; 117 | }); 118 | } 119 | }); 120 | -------------------------------------------------------------------------------- /v2/data/panel/font/fontello.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'fontello'; 3 | src: url('./fontello.woff') format('woff'); 4 | font-weight: normal; 5 | font-style: normal; 6 | } 7 | 8 | [class^="icon-"]:before, [class*=" icon-"]:before { 9 | font-family: "fontello"; 10 | font-style: normal; 11 | font-weight: normal; 12 | speak: none; 13 | 14 | display: inline-block; 15 | text-decoration: inherit; 16 | width: 1em; 17 | margin-right: .2em; 18 | text-align: center; 19 | /* opacity: .8; */ 20 | 21 | /* For safety - reset parent styles, that can break glyph codes*/ 22 | font-variant: normal; 23 | text-transform: none; 24 | 25 | /* fix buttons height, for twitter bootstrap */ 26 | line-height: 1em; 27 | 28 | /* Animation center compensation - margins should be symmetric */ 29 | /* remove if not needed */ 30 | margin-left: .2em; 31 | 32 | /* you can be more comfortable with increased icons size */ 33 | /* font-size: 120%; */ 34 | 35 | /* Font smoothing. That was taken from TWBS */ 36 | -webkit-font-smoothing: antialiased; 37 | -moz-osx-font-smoothing: grayscale; 38 | 39 | /* Uncomment for 3D effect */ 40 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ 41 | } 42 | 43 | .icon-ok:before { content: '\e800'; } /* '' */ 44 | .icon-close:before { content: '\e801'; } /* '' */ 45 | -------------------------------------------------------------------------------- /v2/data/panel/font/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/font/fontello.woff -------------------------------------------------------------------------------- /v2/data/panel/icons/d_folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /v2/data/panel/icons/folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /v2/data/panel/icons/page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/icons/page.png -------------------------------------------------------------------------------- /v2/data/panel/icons/window.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /v2/data/panel/index.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | overflow: hidden; 5 | } 6 | body { 7 | display: flex; 8 | flex-direction: column; 9 | width: 400px; 10 | height: 600px; 11 | margin: 0; 12 | background-color: #fff; 13 | } 14 | body, 15 | table { 16 | font-family: arial,sans-serif; 17 | font-size: 12px; 18 | -webkit-font-smoothing: antialiased; 19 | -moz-osx-font-smoothing: grayscale; 20 | } 21 | table { 22 | width: 100%; 23 | border-collapse: collapse; 24 | } 25 | button, 26 | input { 27 | outline: none; 28 | } 29 | button, 30 | input[type=submit], 31 | input[type=button], 32 | input[type=search], 33 | input[type=text], 34 | #properties span { 35 | border: solid 1px #b7b7b7; 36 | background-color: #fff; 37 | font-size: 11px; 38 | } 39 | input[type=search], 40 | input[type=text], 41 | #properties span { 42 | height: 22px; 43 | padding: 0 5px; 44 | } 45 | input[type=search]:focus, 46 | input[type=text]:focus { 47 | border-color: #419bf9; 48 | box-shadow: 0 0 1px #8ab8e7; 49 | } 50 | button, 51 | input[type=submit], 52 | input[type=button] { 53 | cursor: pointer; 54 | min-height: 22px; 55 | } 56 | button, 57 | input[type=button] { 58 | margin: 0 2px; 59 | } 60 | button:active, 61 | input[type=button]:active { 62 | opacity: 0.5; 63 | } 64 | button:disabled, 65 | input:disabled { 66 | opacity: 0.3 !important; 67 | } 68 | #tree li.separator { 69 | min-height: unset !important; 70 | height: 15px !important; 71 | position: relative; 72 | padding-left: 12px; 73 | pointer-events: none; 74 | } 75 | #tree li.separator::before { 76 | content: ''; 77 | border-bottom: dotted 1px rgba(0, 0, 0, 1); 78 | position: absolute; 79 | height: 50%; 80 | width: calc(100% - 50px); 81 | display: block; 82 | box-sizing: border-box; 83 | } 84 | #tree li.separator * { 85 | opacity: 0; 86 | } 87 | .d_folder, 88 | .folder { 89 | background-position: center !important; 90 | background-size: 20px; 91 | } 92 | .folder { 93 | background-image: url(icons/folder.svg) !important; 94 | } 95 | .d_folder { 96 | background-image: url(icons/d_folder.svg) !important; 97 | } 98 | .menu-button { 99 | position: relative; 100 | } 101 | .menu-button::after { 102 | border-color: #000 transparent transparent transparent; 103 | border-width: 0.33333rem; 104 | right: 8px; 105 | margin-top: -0.13889rem; 106 | border-style: solid; 107 | content: ''; 108 | display: block; 109 | height: 0; 110 | position: absolute; 111 | top: 50%; 112 | width: 0; 113 | display: block; 114 | } 115 | .menu-button input { 116 | padding-right: 20px; 117 | } 118 | .menu-button>ul { 119 | position: absolute; 120 | left: 2px; 121 | top: 7px; 122 | white-space: nowrap; 123 | background-color: #fff; 124 | border: solid 1px #b7b7b7; 125 | list-style-type: none; 126 | padding: 0; 127 | z-index: 1; 128 | visibility: hidden; 129 | opacity: 0; 130 | } 131 | .menu-button li { 132 | padding: 3px 5px; 133 | cursor: pointer; 134 | } 135 | .menu-button li:hover { 136 | background-color: #f4f3f4; 137 | } 138 | .menu-button li.separator { 139 | border-top: solid 1px #b7b7b7; 140 | } 141 | .menu-button:hover ul { 142 | transition-delay: .25s; 143 | visibility: visible; 144 | opacity: 1; 145 | } 146 | 147 | #collapse { 148 | position: absolute; 149 | top: 50px; 150 | right: 30px; 151 | border: none; 152 | background-color: #f2f2f2; 153 | border: solid 1px #b7b7b7; 154 | outline: none; 155 | z-index: 2; 156 | } 157 | #search { 158 | display: flex; 159 | background-color: #f2f2f2; 160 | padding: 10px; 161 | border-bottom: solid 1px #b7b7b7; 162 | } 163 | #search input[type=submit] { 164 | display: none; 165 | } 166 | #search input[type=search] { 167 | flex: 1; 168 | height: 26px; 169 | } 170 | #search input[type=button] { 171 | width: 26px; 172 | height: 26px; 173 | background: #fff url('icons/window.svg') center center no-repeat; 174 | background-size: 18px; 175 | } 176 | #tree { 177 | flex: 1; 178 | overflow: auto; 179 | position: relative; 180 | user-select: none; 181 | } 182 | #results { 183 | height: 300px; 184 | max-height: 50vh; 185 | border-top: solid 1px #b7b7b7; 186 | position: relative; 187 | white-space: nowrap; 188 | display: none; 189 | flex-direction: column; 190 | } 191 | 192 | #results [data-id=count] { 193 | background-color: #8080ea; 194 | color: #fff; 195 | float: right; 196 | margin-right: 5px; 197 | padding: 1px 3px; 198 | font-size: 80%; 199 | border-radius: 2px; 200 | } 201 | #results [data-id=count]:empty { 202 | display: none; 203 | } 204 | 205 | #results [data-id=address] { 206 | display: flex; 207 | align-items: center; 208 | } 209 | #results [data-id=address]>span { 210 | flex: 1; 211 | } 212 | 213 | #results [data-id=address] input[data-cmd=close] { 214 | border: none; 215 | font-size: 14px; 216 | opacity: 0.5; 217 | background-color: transparent; 218 | } 219 | #results [data-id=address] input { 220 | } 221 | #results [data-id=address] input:hover { 222 | opacity: 0.8; 223 | } 224 | #results [data-id=address] input:active { 225 | opacity: 0.8; 226 | } 227 | #results table { 228 | table-layout: fixed; 229 | border-spacing: 0; 230 | } 231 | #results table tbody:empty::before { 232 | content: 'No results'; 233 | display: block; 234 | margin: 5px; 235 | opacity: 0.5; 236 | } 237 | #results th { 238 | border-bottom: 1px solid #bebebe; 239 | background-color: #eeeeee; 240 | font-weight: normal; 241 | text-align: left; 242 | padding-left: 10px; 243 | user-select: none; 244 | } 245 | #results th:last-child { 246 | border-left: 1px solid #bebebe; 247 | } 248 | #results th, 249 | #results td { 250 | height: 22px; 251 | } 252 | #results tbody tr { 253 | cursor: pointer; 254 | } 255 | #results table tr[data-valid=true] td{ 256 | color: green; 257 | } 258 | #results table tr[data-valid=false] td{ 259 | color: red; 260 | } 261 | #results tbody tr:nth-child(odd) { 262 | background-color: #f4f3f4; 263 | } 264 | #results tbody tr.selected { 265 | background-color: #ccc; 266 | } 267 | 268 | #results:active tr.selected, 269 | #results:focus-within tr.selected { 270 | background-color: #b6e8ff; 271 | } 272 | #results input[type=submit] { 273 | display: none; 274 | } 275 | 276 | #results td { 277 | overflow: hidden; 278 | text-overflow: ellipsis; 279 | user-select: none; 280 | } 281 | #results td:first-child { 282 | padding-left: 26px; 283 | background-position: left 5px center; 284 | background-repeat: no-repeat; 285 | background-size: 16px; 286 | } 287 | #results td:last-child { 288 | padding-right: 5px; 289 | } 290 | #properties { 291 | border-top: solid 1px #b7b7b7; 292 | background-color: #f2f2f2; 293 | padding: 5px; 294 | } 295 | #properties[data-enable=false] { 296 | pointer-events: none; 297 | opacity: 0.5; 298 | } 299 | #properties input[type=text] { 300 | width: 100%; 301 | box-sizing: border-box; 302 | } 303 | #properties input[type=submit] { 304 | font-family: 'fontello'; 305 | background-color: #52af52; 306 | color: #fff; 307 | border: none; 308 | width: 100%; 309 | cursor: pointer; 310 | height: 20px; 311 | } 312 | #properties input[type=text]:disabled { 313 | background-color: transparent; 314 | opacity: 1!important; 315 | color: #000; 316 | } 317 | #properties input[type=submit]:disabled { 318 | background-color: #ccc; 319 | } 320 | #properties span { 321 | height: 20px; 322 | line-height: 20px; 323 | display: inline-block; 324 | width: 100%; 325 | background-color: #f2f2f2; 326 | font-size: 11px; 327 | box-sizing: border-box; 328 | } 329 | #toolbar { 330 | background-color: #f2f2f2; 331 | border-top: solid 1px #b7b7b7; 332 | padding: 5px; 333 | display: flex; 334 | align-items: center; 335 | } 336 | #toolbar span { 337 | overflow: hidden; 338 | text-overflow: ellipsis; 339 | white-space: nowrap; 340 | flex: 1; 341 | text-align: right; 342 | } 343 | #notification { 344 | position: absolute; 345 | top: 0; 346 | left: 0; 347 | width: 100%; 348 | height: 100%; 349 | background-color: rgba(0, 0, 0, 0.5); 350 | display: none; /* flex */ 351 | align-items: center; 352 | justify-content: center; 353 | } 354 | #notification>div { 355 | background-color: #fff; 356 | padding: 10px; 357 | width: 80%; 358 | max-width: 500px; 359 | min-height: 90px; 360 | max-height: 80vh; 361 | display: flex; 362 | flex-direction: column; 363 | border: solid 3px #ccc; 364 | display: flex; 365 | flex-direction: column; 366 | } 367 | #notification>div>span { 368 | overflow: hidden; 369 | text-overflow: ellipsis; 370 | white-space: pre; 371 | flex: 1; 372 | padding-bottom: 10px; 373 | } 374 | #notification>div>div { 375 | display: flex; 376 | align-items: center; 377 | justify-content: flex-end; 378 | } 379 | #notification[data-type=confirm] [data-cmd=ok] { 380 | display: none; 381 | } 382 | #notification[data-type=warning] [data-cmd=yes], 383 | #notification[data-type=warning] [data-cmd=no] { 384 | display: none; 385 | } 386 | #notification button { 387 | min-width: 90px; 388 | background-color: #3367d6; 389 | color: #fff; 390 | -webkit-appearance: none; 391 | border: none; 392 | border-radius: 3px; 393 | font-size: 12px; 394 | text-align: center; 395 | } 396 | /* inline notification */ 397 | #toolbar>span { 398 | position: fixed; 399 | background-color: #fdf8e4; 400 | color: #b79148; 401 | border: solid 1px #b79148; 402 | z-index: 10; 403 | display: block; 404 | top: 5px; 405 | right: 5px; 406 | display: flex; 407 | align-items: center; 408 | padding: 5px; 409 | } 410 | #toolbar>span:empty { 411 | display: none; 412 | } 413 | 414 | @-moz-document url-prefix() { 415 | [data-cmd="bookmark-manager"] { 416 | display: none; 417 | } 418 | } 419 | .favicon { 420 | background-color: lightyellow; 421 | padding: 10px 30px 10px 10px; 422 | position: relative; 423 | } 424 | body:not([data-favicon=true]) .favicon { 425 | display: none; 426 | } 427 | .favicon input[type=button] { 428 | background: transparent; 429 | border: none; 430 | font-size: 22px; 431 | margin: -10px -10px 0 0; 432 | position: absolute; 433 | top: 10px; 434 | right: 10px; 435 | } 436 | -------------------------------------------------------------------------------- /v2/data/panel/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 |
15 | You can disable this service from the options page. 16 | 17 |
18 | 19 | 24 |
25 |
26 | 33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 47 | 54 | 55 | 56 |
42 |
43 | 44 | Title 45 |
46 |
48 |
49 | Address 50 | 51 | 52 |
53 |
57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
67 |
68 | 69 |
70 |
71 | 72 | 80 | 89 | 90 | 91 |
92 |
93 |
94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |
Title
Address
Date
120 |
121 |
122 |
123 | 124 |
125 | 126 | 127 | 128 |
129 |
130 |
131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /v2/data/panel/jstree/ReadMe: -------------------------------------------------------------------------------- 1 | https://codeload.github.com/vakata/jstree/legacy.zip/3.3.7 -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /v2/data/panel/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v2/data/panel/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /v2/data/panel/notification.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | var notify = (function() { 14 | const div = document.getElementById('notification'); 15 | 16 | const p = div.querySelector('span'); 17 | let callback; 18 | 19 | div.querySelector('[data-cmd=yes]').addEventListener('click', () => { 20 | div.style.display = 'none'; 21 | if (callback) { 22 | callback(true); 23 | callback = ''; 24 | } 25 | }); 26 | div.querySelector('[data-cmd=no]').addEventListener('click', () => { 27 | div.style.display = 'none'; 28 | if (callback) { 29 | callback(false); 30 | callback = ''; 31 | } 32 | }); 33 | div.querySelector('[data-cmd=ok]').addEventListener('click', () => { 34 | div.style.display = 'none'; 35 | }); 36 | 37 | document.addEventListener('keyup', e => { 38 | if ((e.code === 'KeyN') && callback) { 39 | div.querySelector('[data-cmd=no]').dispatchEvent(new Event('click')); 40 | } 41 | else if (e.code === 'KeyY' && callback) { 42 | div.querySelector('[data-cmd=yes]').dispatchEvent(new Event('click')); 43 | } 44 | 45 | if (e.code === 'Escape' && callback) { 46 | div.style.display = 'none'; 47 | callback = ''; 48 | } 49 | }); 50 | 51 | const ts = document.querySelector('#toolbar span'); 52 | let id; 53 | 54 | return { 55 | confirm: function(msg, c) { 56 | p.title = p.textContent = msg; 57 | div.style.display = 'flex'; 58 | div.dataset.type = 'confirm'; 59 | callback = c; 60 | }, 61 | warning: function(msg) { 62 | p.title = p.textContent = msg; 63 | div.style.display = 'flex'; 64 | div.dataset.type = 'warning'; 65 | }, 66 | inline: function(msg) { 67 | window.clearTimeout(id); 68 | ts.title = ts.textContent = msg; 69 | id = window.setTimeout(() => ts.title = ts.textContent = '', 5000); 70 | } 71 | }; 72 | })(); 73 | 74 | chrome.runtime.onMessage.addListener(request => { 75 | if (request.cmd === 'notify.inline') { 76 | notify.inline(request.msg); 77 | } 78 | }); 79 | -------------------------------------------------------------------------------- /v2/data/panel/properties.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* globals tree, notify */ 12 | 'use strict'; 13 | 14 | var properties = document.querySelector('#properties'); 15 | properties.addEventListener('keyup', e => { 16 | const target = e.target; 17 | const tr = target.closest('tr'); 18 | if (tr) { 19 | tr.querySelector('[type=submit]').disabled = !(target && target.dataset.value !== target.value && target.value); 20 | } 21 | }); 22 | properties.addEventListener('submit', e => { 23 | e.preventDefault(); 24 | e.stopPropagation(); 25 | 26 | const form = e.target; 27 | const tr = properties.querySelector('[form=' + form.id + ']').closest('tr'); 28 | const id = properties.dataset.id; 29 | const input = tr.querySelector('input'); 30 | const prp = {}; 31 | prp[form.id] = input.value; 32 | 33 | chrome.bookmarks.update(id, prp, () => { 34 | input.dataset.value = input.value; 35 | tr.querySelector('[type=submit]').disabled = true; 36 | // updating search view 37 | const results = document.querySelector('#results tbody'); 38 | const rtr = results.querySelector(`[data-id="${id}"]`); 39 | if (rtr) { 40 | rtr.querySelector('td:nth-child(' + (form.id === 'title' ? 1 : 2) + ')').textContent = input.value; 41 | } 42 | // updating tree view 43 | if (form.id === 'title') { 44 | tree.jstree('set_text', id, tree.string.escape(prp.title)); 45 | } 46 | // reseting fuse 47 | window.dispatchEvent(new Event('search:reset-fuse')); 48 | // 49 | const lastError = chrome.runtime.lastError; 50 | if (lastError) { 51 | notify.inline('[Refresh Required] ' + lastError.message); 52 | } 53 | }); 54 | }); 55 | 56 | window.addEventListener('properties:select-title', () => { 57 | const title = properties.querySelector('tr:nth-child(1) input'); 58 | title.focus(); 59 | title.select(); 60 | }); 61 | window.addEventListener('properties:select-link', () => { 62 | const url = properties.querySelector('tr:nth-child(2) input'); 63 | url.focus(); 64 | url.select(); 65 | }); 66 | 67 | tree.on('select_node.jstree', (e, data) => { 68 | properties.dataset.id = data.node.id; 69 | 70 | const title = properties.querySelector('tr:nth-child(1) input'); 71 | title.dataset.value = title.value = 72 | tree.string.uscape(data.node.text); 73 | title.dispatchEvent(new Event('keyup', { 74 | bubbles: true 75 | })); 76 | 77 | title.disabled = data.node.id.startsWith('feed-') || data.node.data.drag === false; 78 | const url = properties.querySelector('tr:nth-child(2) input'); 79 | url.disabled = data.node.data.drag === false || data.node.data.url === ''; 80 | url.dataset.value = url.value = data.node.data.url; 81 | url.dispatchEvent(new Event('keyup', { 82 | bubbles: true 83 | })); 84 | 85 | const d = new Date(data.node.data.dateAdded); 86 | properties.querySelector('tr:nth-child(3) span').textContent = d.toDateString() + ' ' + d.toLocaleTimeString(); 87 | 88 | // disable on multiple select 89 | // properties.dataset.enable = data.selected.length === 1; 90 | }); 91 | -------------------------------------------------------------------------------- /v2/data/panel/search.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* globals Fuse, utils, tree */ 12 | 'use strict'; 13 | 14 | (function(search, searchForm, results, count, tbody, trC, close, validate) { 15 | // should the search box get the focus 16 | if(localStorage.getItem('searchfocus') === 'true') { 17 | document.addEventListener('DOMContentLoaded', () => search.focus()); 18 | } 19 | // 20 | let useNative = false; 21 | let fuse; 22 | let closed = false; 23 | // focus searchbox on Ctrl + F 24 | window.addEventListener('keydown', e => { 25 | if ((e.metaKey && e.keyCode === 70) || (e.ctrlKey && e.keyCode === 70)) { 26 | e.preventDefault(); 27 | e.stopPropagation(); 28 | search.focus(); 29 | } 30 | }); 31 | // reset fuse on edit 32 | window.addEventListener('search:reset-fuse', () => fuse = null); 33 | function prepare() { 34 | if (useNative) { 35 | return Promise.resolve(); 36 | } 37 | return new Promise(resolve => { 38 | chrome.bookmarks.getTree(nodes => { 39 | const arr = []; 40 | function extract(node) { 41 | if (node.children) { 42 | node.children.forEach(n => { 43 | // only add bookmarks not folders 44 | if (n.url) { 45 | arr.push(n); 46 | } 47 | extract(n); 48 | }); 49 | } 50 | } 51 | extract(nodes[0]); 52 | fuse = new Fuse(arr, { 53 | keys: ['title', 'url'] 54 | }); 55 | resolve(); 56 | }); 57 | }); 58 | } 59 | function hierarchy(id) { 60 | return new Promise(resolve => { 61 | const ids = []; 62 | function up(id) { 63 | ids.push(id); 64 | chrome.bookmarks.get(id, arr => { 65 | const node = arr[0]; 66 | if (node.parentId) { 67 | up(node.parentId); 68 | } 69 | else { 70 | resolve(ids); 71 | } 72 | }); 73 | } 74 | up(id); 75 | }); 76 | } 77 | // prevent old searches from populating 78 | var index = 0; 79 | 80 | function add(obj) { 81 | const node = document.importNode(trC.content, true); 82 | const tr = node.querySelector('tr'); 83 | const td1 = node.querySelector('td:nth-child(1)'); 84 | 85 | let icon = obj.url; 86 | if (!icon && navigator.userAgent.indexOf('Firefox') !== -1 && obj.type === 'folder') { 87 | icon = '/data/panel/icons/folder.png'; 88 | } 89 | if (!icon && navigator.userAgent.indexOf('Firefox') === -1) { 90 | icon = '/data/panel/icons/folder.png'; 91 | } 92 | icon = icon || '/data/panel/icons/page.png'; 93 | 94 | td1.style['background-image'] = `url(${utils.favicon(icon)})`; 95 | 96 | td1.textContent = obj.title; 97 | node.querySelector('td:nth-child(2)').textContent = obj.url; 98 | tr.dataset.id = obj.id; 99 | tr.dataset.url = obj.url || ''; 100 | tr.dataset.parentId = obj.parentId; 101 | tbody.appendChild(node); 102 | } 103 | 104 | function perform() { 105 | let value = search.value.trim(); 106 | 107 | results.style.display = value ? 'flex' : 'none'; 108 | closed = !value; 109 | validate.disabled = false; 110 | 111 | if (value.length > 1) { 112 | // to not search duplicates 113 | if (perform.value === value) { 114 | return; 115 | } 116 | perform.value = value; 117 | // updating index 118 | index += 1; 119 | 120 | if (value.startsWith('fuzzy:')) { 121 | useNative = false; 122 | value = value.replace(/fuzzy:\s*/, ''); 123 | } 124 | else { 125 | useNative = true; 126 | fuse = null; 127 | } 128 | 129 | tbody.textContent = ''; 130 | 131 | const next = (i => { 132 | return (results = [], total) => { 133 | if (i === index) { 134 | results.forEach(add); 135 | count.textContent = (results.length || '') + (total ? '/' + total : ''); 136 | const tr = document.querySelector('#results tbody tr'); 137 | // select the first child 138 | if (tr) { 139 | tr.classList.add('selected'); 140 | tr.querySelector('input').checked = true; 141 | } 142 | } 143 | }; 144 | })(index); 145 | 146 | if (value.startsWith('root:')) { 147 | const id = value.replace(/root:/, '').split(' ')[0]; 148 | const term = value.replace(/root:[^ ]+/, '').toLowerCase().trim(); 149 | const nodes = []; 150 | const search = id => new Promise(resolve => chrome.bookmarks.getChildren(id, async nds => { 151 | nodes.push(...nds.filter(n => n.url)); 152 | await Promise.all(nds.filter(n => !n.url).map(n => search(n.id))); 153 | resolve(); 154 | })); 155 | if (id) { 156 | search(id).then(() => { 157 | if (term) { 158 | next(nodes.filter(({url, title}) => { 159 | title = title.toLowerCase(); 160 | url = url.toLowerCase(); 161 | // split and match by keys 162 | const keys = term.split(/\s+/); 163 | return keys.filter(key => title.indexOf(key) !== -1 || url.indexOf(key) !== -1).length === keys.length; 164 | }), nodes.length); 165 | } 166 | else { 167 | next(nodes); 168 | } 169 | }); 170 | } 171 | } 172 | else if (value.startsWith('id:')) { 173 | const ids = value.replace(/id:\s*/, '').split(/,\s*/); 174 | chrome.bookmarks.get(ids, next); 175 | } 176 | else if (useNative) { 177 | chrome.bookmarks.search(value, next); 178 | } 179 | else { 180 | (fuse ? Promise.resolve() : prepare()).then(() => { 181 | next(fuse.search(value)); 182 | }); 183 | } 184 | } 185 | else { 186 | perform.value = ''; 187 | count.textContent = ''; 188 | } 189 | } 190 | 191 | function closePanel() { 192 | tbody.textContent = ''; 193 | search.value = ''; 194 | perform.value = ''; 195 | count.textContent = ''; 196 | search.dispatchEvent(new Event('keyup')); 197 | closed = true; 198 | } 199 | 200 | search.addEventListener('keyup', perform); 201 | search.addEventListener('search', perform); 202 | searchForm.addEventListener('submit', e => { 203 | e.preventDefault(); 204 | const tr = tbody.querySelector('.selected'); 205 | if (tr) { 206 | tr.click(); 207 | } 208 | }); 209 | 210 | results.addEventListener('click', e => { 211 | const target = e.target; 212 | const tr = target.closest('tr'); 213 | if (tr) { 214 | const id = tr.dataset.id; 215 | if (id) { 216 | // selecting 217 | [...tbody.querySelectorAll('.selected')].forEach(tr => tr.classList.remove('selected')); 218 | tr.classList.add('selected'); 219 | // displaying in tree view 220 | hierarchy(id).then(nodes => { 221 | window.dispatchEvent(new CustomEvent('tree:open-array', { 222 | detail: { 223 | nodes 224 | } 225 | })); 226 | }); 227 | tr.querySelector('input').focus(); 228 | } 229 | } 230 | const sort = target.dataset.sort; 231 | if (sort) { 232 | const trs = [...tbody.querySelectorAll('tr')].sort((a, b) => { 233 | const sa = a.querySelector(sort).textContent; 234 | const sb = b.querySelector(sort).textContent; 235 | 236 | return target.dataset.increase === 'true' ? sb.localeCompare(sa) : sa.localeCompare(sb); 237 | }); 238 | trs.forEach(tr => tbody.appendChild(tr)); 239 | target.dataset.increase = target.dataset.increase !== 'true'; 240 | } 241 | }); 242 | { 243 | const callback = () => { 244 | const tr = tbody.querySelector('.selected'); 245 | if (tr) { 246 | closePanel(); 247 | } 248 | tree.focus(); 249 | }; 250 | tbody.addEventListener('dblclick', callback); 251 | results.addEventListener('submit', e => { 252 | e.preventDefault(); 253 | callback(); 254 | }); 255 | } 256 | 257 | close.addEventListener('click', closePanel); 258 | 259 | validate.addEventListener('click', async() => { 260 | validate.disabled = true; 261 | 262 | const check = url => new Promise(resolve => chrome.runtime.sendMessage({ 263 | cmd: 'validate', 264 | url 265 | }, resolve)); 266 | 267 | const trs = [...tbody.querySelectorAll('tr')] 268 | .filter(tr => tr.dataset.url); 269 | trs.forEach(tr => tr.removeAttribute('data-valid')); 270 | 271 | const chunks = []; 272 | for (let i = 0; i < trs.length; i += 3) { 273 | chunks.push(trs.slice(i, i + 3)); 274 | } 275 | for (const chunk of chunks) { 276 | if (closed) { 277 | return; 278 | } 279 | await Promise.all(chunk.map(tr => { 280 | const url = tr.dataset.url; 281 | const td = tr.querySelector('td:last-child'); 282 | td.textContent = 'validating...'; 283 | td.scrollIntoViewIfNeeded(); 284 | return check(url).then(r => { 285 | tr.dataset.valid = r.valid; 286 | td.textContent = url; 287 | }); 288 | })); 289 | } 290 | validate.disabled = false; 291 | }); 292 | })( 293 | document.querySelector('#search input[type=search]'), 294 | document.getElementById('search'), 295 | document.querySelector('#results'), 296 | document.querySelector('#results [data-id=count]'), 297 | document.querySelector('#results tbody'), 298 | document.querySelector('#results template'), 299 | document.querySelector('#results [data-id=address] input[data-cmd=close]'), 300 | document.querySelector('#results [data-id=address] input[data-cmd=validate-list]') 301 | ); 302 | -------------------------------------------------------------------------------- /v2/data/panel/second.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* globals $, utils, notify, getRoot */ 12 | 'use strict'; 13 | 14 | var tree = $('#tree [data-id=two]'); 15 | tree.jstree({ 16 | 'types': { 17 | 'file': { 18 | 'icon': 'item', 19 | 'max_children': 0 20 | }, 21 | 'folder': { 22 | 'icon': 'folder' 23 | } 24 | }, 25 | 'plugins' : [ 26 | 'dnd' 27 | ], 28 | 'core' : { 29 | // Content Security Policy: The page’s settings blocked the loading of a resource at blob:moz-extension:// 30 | 'worker': !/Firefox/.test(navigator.userAgent), 31 | 'check_callback' : true, 32 | 'multiple': true, 33 | 'data' : function(obj, cb) { 34 | chrome.bookmarks.getChildren(obj.id === '#' ? getRoot() : obj.id, nodes => { 35 | cb.call(this, nodes.map(node => { 36 | const children = !node.url; 37 | return { 38 | text: node.title, 39 | id: node.id, 40 | type: children ? 'folder' : 'file', 41 | icon: children ? null : utils.favicon(node.url), 42 | children, 43 | data: { 44 | dateGroupModified: node.dateGroupModified, 45 | dateAdded: node.dateAdded, 46 | url: node.url || '' 47 | } 48 | }; 49 | })); 50 | }); 51 | } 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /v2/data/panel/toolbar.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* globals tree, notify, utils */ 12 | 'use strict'; 13 | 14 | document.addEventListener('click', e => { 15 | const cmd = e.target.dataset.cmd; 16 | if (cmd === 'collapse') { 17 | tree.jstree('deselect_all'); 18 | tree.jstree('close_all'); 19 | } 20 | else if (cmd === 'delete') { 21 | const ids = tree.jstree('get_selected'); 22 | const nodes = ids.map(id => tree.jstree('get_node', id)); 23 | notify.confirm(`Are you sure you want to delete: 24 | 25 | ${nodes.map((node, i) => (i + 1) + '. ' + (node.data.url || node.text)).join('\n ')}`, a => { 26 | if (a) { 27 | nodes.forEach(node => chrome.bookmarks[node.type === 'folder' ? 'removeTree' : 'remove'](node.id, () => { 28 | // jstree 29 | tree.jstree('select_node', node.parent); 30 | tree.jstree('delete_node', node.id); 31 | // results 32 | const results = document.querySelector('#results tbody'); 33 | const rtr = results.querySelector(`[data-id="${node.id}"]`); 34 | if (rtr) { 35 | rtr.parentNode.removeChild(rtr); 36 | } 37 | // reseting fuse 38 | window.dispatchEvent(new Event('search:reset-fuse')); 39 | })); 40 | } 41 | }); 42 | } 43 | else if (cmd === 'create-folder' || cmd === 'create-bookmark' || cmd === 'create-from-tab') { 44 | const ids = tree.jstree('get_selected'); 45 | const id = ids[0]; 46 | const node = tree.jstree('get_node', id); 47 | const parentId = node.type === 'folder' ? node.id : node.parent; 48 | const prp = { 49 | parentId 50 | }; 51 | if (node.type === 'folder') { 52 | prp.index = 0; 53 | } 54 | else { 55 | const parent = tree.jstree('get_node', node.parent); 56 | prp.index = parent.children.indexOf(node.id) + 1; 57 | } 58 | (function(callback) { 59 | if (cmd === 'create-folder') { 60 | return callback(null, 'new directory'); 61 | } 62 | else if (cmd === 'create-bookmark') { 63 | return callback('http://example.com', 'new bookmark'); 64 | } 65 | else { 66 | chrome.tabs.query({ 67 | active: true, 68 | currentWindow: true 69 | }, tabs => { 70 | callback(tabs[0].url, tabs[0].title); 71 | }); 72 | } 73 | })(function(url, title) { 74 | prp.url = url; 75 | prp.title = title; 76 | chrome.bookmarks.create(prp, node => { 77 | tree.jstree('create_node', parentId, { 78 | text: node.title, 79 | id: node.id, 80 | type: url ? 'file' : 'folder', 81 | icon: url ? utils.favicon(url) : null, 82 | data: { 83 | dateGroupModified: node.dateGroupModified, 84 | dateAdded: node.dateAdded, 85 | url 86 | } 87 | }, node.index, node => { 88 | window.focus(); 89 | tree.focus(); 90 | tree.jstree('deselect_all'); 91 | tree.jstree('select_node', node.id); 92 | }); 93 | tree.jstree('open_node', parentId); 94 | }); 95 | }); 96 | } 97 | else if (cmd === 'open-options') { 98 | chrome.runtime.openOptionsPage(); 99 | } 100 | else if (cmd === 'open-in-tab') { 101 | chrome.tabs.create({ 102 | url: '/data/panel/index.html?in=tab' 103 | }); 104 | } 105 | else if (cmd === 'reset-root') { 106 | localStorage.removeItem('root'); 107 | location.reload(); 108 | } 109 | else if (cmd === 'bookmark-manager') { 110 | chrome.tabs.create({ 111 | url: 'chrome://bookmarks/' 112 | }, () => chrome.runtime.lastError && notify.warning(chrome.runtime.lastError.message)); 113 | } 114 | else if (cmd === 'update-title') { 115 | const ids = tree.jstree('get_selected'); 116 | const id = ids[0]; 117 | const node = tree.jstree('get_node', id); 118 | 119 | chrome.runtime.sendMessage({ 120 | cmd, 121 | url: node.data.url 122 | }, response => { 123 | if (response.error) { 124 | chrome.runtime.sendMessage({ 125 | cmd: 'notify.inline', 126 | msg: '"title" is up-do-date' 127 | }); 128 | } 129 | else { 130 | const input = document.querySelector('#properties input[form=title]'); 131 | if (input.value !== response.title) { 132 | input.value = response.title; 133 | input.dispatchEvent(new Event('keyup', { 134 | bubbles: true 135 | })); 136 | } 137 | } 138 | }); 139 | } 140 | }); 141 | // keyboard shortcut 142 | document.addEventListener('keyup', e => { 143 | if ((e.ctrlKey && e.shiftKey) || e.key === 'Delete') { 144 | switch(e.key) { 145 | case 'C': 146 | document.querySelector('[data-cmd=collapse]').click(); 147 | break; 148 | case 'U': 149 | document.querySelector('[data-cmd=update-title]').click(); 150 | break; 151 | case 'O': 152 | document.querySelector('[data-cmd=open-options]').click(); 153 | break; 154 | case 'R': 155 | document.querySelector('[data-cmd=reset-root]').click(); 156 | break; 157 | case 'B': 158 | document.querySelector('[data-cmd=create-bookmark]').click(); 159 | break; 160 | case 'T': 161 | document.querySelector('[data-cmd=create-from-tab]').click(); 162 | break; 163 | case 'D': 164 | document.querySelector('[data-cmd=create-folder]').click(); 165 | break; 166 | case 'E': 167 | window.dispatchEvent(new Event('properties:select-title')); 168 | break; 169 | case 'L': 170 | tree.activate(); 171 | break; 172 | case 'Delete': 173 | document.querySelector('#toolbar [data-cmd="delete"]').click(); 174 | break; 175 | } 176 | e.stopImmediatePropagation(); 177 | return false; 178 | } 179 | }); 180 | -------------------------------------------------------------------------------- /v2/data/panel/tree.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* globals $, utils, notify */ 12 | 'use strict'; 13 | 14 | function getRoot() { 15 | if (localStorage.getItem('root')) { 16 | return localStorage.getItem('root'); 17 | } 18 | return typeof InstallTrigger !== 'undefined' ? 'root________' : '0'; 19 | } 20 | 21 | var tree = $('#tree'); 22 | tree.isFeed = url => url && ( 23 | url.indexOf('rss') !== -1 || 24 | url.indexOf('feed') !== -1 25 | ); 26 | tree.string = {}; 27 | tree.plugins = ['state', 'dnd', 'types', 'contextmenu', 'conditionalselect']; 28 | if (localStorage.getItem('sort') === 'true') { 29 | tree.plugins.push('sort'); 30 | } 31 | 32 | tree.element = id => $('#' + id); 33 | 34 | tree.activate = () => { 35 | try { 36 | const ids = tree.jstree('get_selected'); 37 | const id = ids[0]; 38 | tree.jstree('hover_node', tree.element(id)); 39 | } 40 | catch (e) { 41 | console.log(e); 42 | } 43 | window.setTimeout(() => tree.focus(), 100); 44 | }; 45 | 46 | tree.string.escape = str => str 47 | .replace(/&/g, '&') 48 | .replace(//g, '>') 50 | .replace(/"/g, '"') 51 | .replace(/'/g, '''); 52 | tree.string.uscape = str => str 53 | .replace(/</g, '<') 54 | .replace(/>/g, '>') 55 | .replace(/"/g, '"') 56 | .replace(/'/g, `'`) 57 | .replace(/&/g, '&'); 58 | 59 | tree.jstree({ 60 | 'types': { 61 | 'file': { 62 | 'icon': 'item', 63 | 'max_children': 0 64 | }, 65 | 'folder': { 66 | 'icon': 'folder' 67 | }, 68 | 'd_folder': { 69 | 'icon': 'd_folder' 70 | } 71 | }, 72 | 'plugins': tree.plugins, 73 | 'conditionalselect': node => { 74 | if (node.data && node.data.type === 'separator') { 75 | return false; 76 | } 77 | return true; 78 | }, 79 | 'core': { 80 | // Content Security Policy: The page’s settings blocked the loading of a resource at blob:moz-extension:// 81 | 'worker': !/Firefox/.test(navigator.userAgent), 82 | 'check_callback': (operation, node) => { 83 | // do not allow drag and drop in sort mode 84 | if (localStorage.getItem('sort') === 'true') { 85 | return false; 86 | } 87 | if (operation === 'move_node') { 88 | // do not allow moving of the root elements 89 | // do not allow moving to the root 90 | return node.data.drag; 91 | } 92 | // do not allow inline-edit 93 | if (operation === 'edit') { 94 | return false; 95 | } 96 | return true; 97 | }, 98 | 'multiple': true, 99 | 'data': (obj, cb) => { 100 | if (obj.data && obj.data.feed) { 101 | fetch(obj.data.url).then(r => r.text()) 102 | .then(str => (new DOMParser()).parseFromString(str, 'text/xml')) 103 | .then(doc => { 104 | const items = [...doc.querySelectorAll('item')]; 105 | if (items && items.length) { 106 | cb(items.map(item => { 107 | const url = item.querySelector('link').textContent; 108 | const title = item.querySelector('title').textContent || 'unknown title'; 109 | const date = item.querySelector('pubDate').textContent || ''; 110 | return { 111 | text: tree.string.escape(title), 112 | id: 'feed-' + Math.random(), 113 | type: 'file', 114 | icon: utils.favicon(url), 115 | children: false, 116 | a_attr: { // open with middle-click 117 | href: url 118 | }, 119 | data: { 120 | dateGroupModified: date, 121 | dateAdded: date, 122 | url, 123 | feed: tree.isFeed(url), 124 | drag: false 125 | } 126 | }; 127 | })); 128 | } 129 | else { 130 | throw Error('empty feed'); 131 | } 132 | }).catch(e => { 133 | cb([{ 134 | text: e.message || 'unknown error', 135 | id: 'feed-' + Math.random(), 136 | type: 'file', 137 | icon: '', 138 | children: false, 139 | a_attr: { // open with middle-click 140 | href: '' 141 | }, 142 | data: { 143 | dateGroupModified: '', 144 | dateAdded: '', 145 | url: '', 146 | feed: false, 147 | drag: false 148 | } 149 | }]); 150 | }); 151 | } 152 | else { 153 | chrome.bookmarks.getChildren(obj.id === '#' ? getRoot() : obj.id, nodes => { 154 | cb(nodes.map(node => { 155 | const feed = tree.isFeed(node.url); 156 | const children = !node.url || feed === true; 157 | const drag = node.parentId !== '0' && node.parentId !== 'root________'; 158 | const rtn = { 159 | text: node.type === 'separator' ? '..............' : tree.string.escape(node.title), 160 | id: node.id, 161 | type: children ? (drag ? 'folder' : 'd_folder') : (node.type === 'separator' ? 'separator' : 'file'), 162 | icon: children ? null : utils.favicon(node.url), 163 | children, 164 | a_attr: { // open with middle-click 165 | href: node.url || '#' 166 | }, 167 | data: { 168 | type: node.type, 169 | dateGroupModified: node.dateGroupModified, 170 | dateAdded: node.dateAdded, 171 | url: node.url || '', 172 | feed, 173 | drag 174 | }, 175 | state: { 176 | hidden: node.url && node.url.startsWith('place:') 177 | } 178 | }; 179 | if (node.type === 'separator') { 180 | rtn.li_attr = { 181 | 'class': 'separator' 182 | }; 183 | } 184 | return rtn; 185 | })); 186 | }); 187 | } 188 | } 189 | }, 190 | 'contextmenu': { 191 | 'items': node => ({ 192 | 'Copy Title': { 193 | 'label': 'Copy Title', 194 | 'action': () => { 195 | const ids = tree.jstree('get_selected'); 196 | const nodes = ids.map(id => tree.jstree('get_node', id)); 197 | 198 | utils.copy(nodes.map(node => node.text).join('\n')); 199 | } 200 | }, 201 | 'Copy Link': { 202 | 'label': 'Copy Link', 203 | 'action': () => { 204 | const ids = tree.jstree('get_selected'); 205 | const nodes = ids.map(id => tree.jstree('get_node', id)); 206 | 207 | utils.copy(nodes.map(node => node.data.url).join('\n')); 208 | }, 209 | '_disabled': () => !node.data.url 210 | }, 211 | 'Copy ID': { 212 | 'label': 'Copy ID', 213 | 'action': () => { 214 | const ids = tree.jstree('get_selected'); 215 | utils.copy(ids.join('\n')); 216 | } 217 | }, 218 | 'Rename Title': { 219 | 'separator_before': true, 220 | 'label': 'Rename Title', 221 | 'action': () => window.dispatchEvent(new Event('properties:select-title')), 222 | '_disabled': () => node.data.drag === false 223 | }, 224 | 'Edit Link': { 225 | 'label': 'Edit Link', 226 | 'action': () => window.dispatchEvent(new Event('properties:select-link')), 227 | '_disabled': () => !node.data.url 228 | }, 229 | 'Delete Bookmark': { 230 | 'label': 'Delete Bookmark', 231 | 'action': () => document.querySelector('#toolbar [data-cmd="delete"]').click(), 232 | '_disabled': () => node.data.drag === false 233 | }, 234 | 'Validate Bookmark': { 235 | 'separator_before': true, 236 | 'label': 'Search or Validate Bookmarks', 237 | 'action': () => { 238 | const input = document.querySelector('#search input'); 239 | const ids = tree.jstree('get_selected'); 240 | if (ids.length > 1) { 241 | input.value = (node.data.url, 'id:') + ids.join(','); 242 | } 243 | else { 244 | const node = tree.jstree('get_node', ids[0]); 245 | input.value = (node.data.url, node.data.url ? 'id:' : 'root:') + ids.join(',') + ' '; 246 | } 247 | input.dispatchEvent(new Event('search')); 248 | input.focus(); 249 | } 250 | }, 251 | 'Set as Root': { 252 | 'label': 'Set as Root', 253 | 'action': () => { 254 | const ids = tree.jstree('get_selected'); 255 | 256 | if (ids.length === 1) { 257 | localStorage.setItem('root', ids[0]); 258 | location.reload(); 259 | } 260 | else { 261 | notify.inline('Please select a single directory'); 262 | } 263 | }, 264 | '_disabled': () => node.data.url 265 | } 266 | }) 267 | }, 268 | 'sort': function(a, b) { 269 | a = this.get_node(a); 270 | b = this.get_node(b); 271 | 272 | if (a.data.url && !b.data.url) { 273 | return 1; 274 | } 275 | if (b.data.url && !a.data.url) { 276 | return -1; 277 | } 278 | return a.text > b.text ? -1 : 1; 279 | } 280 | }); 281 | 282 | // activate on startup 283 | if (localStorage.getItem('searchfocus') !== 'true') { 284 | tree.one('state_ready.jstree', () => { 285 | tree.activate(); 286 | }); 287 | } 288 | 289 | // open links on dblclick or Enter 290 | { 291 | const dblclick = (node, e = {shiftKey: false}) => { 292 | if (node && node.data && node.data.url && node.data.feed === false) { 293 | const url = node.data.url; 294 | chrome.tabs.query({ 295 | active: true, 296 | currentWindow: true 297 | }, tabs => { 298 | // if current tab is new tab, update it 299 | if (tabs.length && tabs[0].url === 'chrome://newtab/' || tabs[0].url === 'about:newtab' || e.shiftKey) { 300 | chrome.tabs.update({url}); 301 | } 302 | else { 303 | chrome.tabs.create({url}); 304 | } 305 | if (location.search.indexOf('in=') === -1) { 306 | window.close(); 307 | } 308 | }); 309 | } 310 | }; 311 | tree.on('dblclick.jstree', e => { 312 | const ids = tree.jstree('get_selected'); 313 | const node = tree.jstree('get_node', ids[0]); 314 | dblclick(node, e); 315 | }); 316 | // on Enter 317 | tree.on('keydown.tree', e => { 318 | if (e.key !== 'Enter') { 319 | return true; 320 | } 321 | const selected = tree.jstree('get_selected'); 322 | const current = tree.jstree('get_node', e.target); 323 | if (current && selected.indexOf(current.id) !== -1) { 324 | dblclick(current); 325 | return false; 326 | } 327 | return true; 328 | }); 329 | } 330 | 331 | tree.on('move_node.jstree copy_node.jstree', (e, data) => { 332 | if (e.type === 'copy_node') { // copy 333 | const b = { 334 | parentId: data.parent, 335 | index: data.position, 336 | title: data.node.text, 337 | url: data.original.data.url 338 | }; 339 | if (!b.url) { // delete URL if not available 340 | delete b.url; 341 | } 342 | chrome.bookmarks.create(b, bookmark => { 343 | const lastError = chrome.runtime.lastError; 344 | if (lastError) { 345 | notify.inline('[Refresh Required] ' + lastError.message); 346 | tree.jstree('delete_node', data.node); 347 | } 348 | else { 349 | // update node 350 | tree.jstree(true).set_id(data.node, bookmark.id); 351 | data.node.data = { 352 | dateGroupModified: bookmark.dateGroupModified, 353 | dateAdded: bookmark.dateAdded, 354 | url: bookmark.url || '' 355 | }; 356 | // repair new created child bookmarks 357 | data.original.children.forEach((id, index) => { 358 | const original = tree.jstree('get_node', id); 359 | const position = tree.jstree('get_node', data.original).children.indexOf(id); 360 | tree.trigger('copy_node.jstree', { 361 | node: tree.jstree('get_node', data.node.children[index]), 362 | original, 363 | parent: bookmark.id, 364 | position 365 | }); 366 | }); 367 | } 368 | }); 369 | } 370 | else { 371 | chrome.bookmarks.move(data.node.id, { 372 | parentId: data.parent, 373 | index: data.position + (data.position > data.old_position ? 1 : 0) 374 | }, () => { 375 | const lastError = chrome.runtime.lastError; 376 | if (lastError) { 377 | notify.inline('[Refresh Required] ' + lastError.message); 378 | } 379 | }); 380 | } 381 | }); 382 | 383 | // do not handle ctrlKey + shiftKey keys 384 | tree.on('keydown.tree', e => { 385 | if (e.ctrlKey && e.shiftKey) { 386 | e.stopImmediatePropagation(); 387 | return false; 388 | } 389 | }); 390 | 391 | window.addEventListener('tree:open-array', e => { 392 | const arr = e.detail.nodes; 393 | tree.jstree('deselect_all'); 394 | tree.jstree('close_all'); 395 | tree.jstree('close_all', () => { 396 | tree.jstree('load_node', arr.reverse(), () => { 397 | const id = arr[0]; 398 | tree.jstree('select_node', id); 399 | try { 400 | document.getElementById(id + '_anchor').scrollIntoView(); 401 | } 402 | catch(e) {} 403 | }); 404 | }); 405 | }); 406 | -------------------------------------------------------------------------------- /v2/data/panel/utils.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2017 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: http://add0n.com/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | var utils = {}; 14 | 15 | utils.copy = text => { 16 | document.oncopy = event => { 17 | event.clipboardData.setData('Text', text); 18 | event.preventDefault(); 19 | }; 20 | document.execCommand('Copy'); 21 | document.oncopy = undefined; 22 | }; 23 | 24 | utils.favicon = (() => { 25 | const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1; 26 | return url => { 27 | if (url.startsWith('/')) { 28 | return url; 29 | } 30 | if (isFirefox) { 31 | if (localStorage.getItem('resolve') === 'true') { 32 | return 'http://www.google.com/s2/favicons?domain_url=' + url; 33 | } 34 | else { 35 | return '/data/panel/icons/page.png'; 36 | } 37 | } 38 | return 'chrome://favicon/' + url; 39 | }; 40 | })(); 41 | // Firefox only user consent 42 | if ( 43 | navigator.userAgent.indexOf('Firefox') !== -1 && 44 | localStorage.getItem('offer-favicon') !== 'false' && 45 | localStorage.getItem('resolve') !== 'true' 46 | ) { 47 | document.body.dataset.favicon = true; 48 | document.querySelector('.favicon input[type=button]').addEventListener('click', () => { 49 | localStorage.setItem('offer-favicon', false); 50 | document.body.dataset.favicon = false; 51 | }); 52 | document.querySelector('.favicon input[type=checkbox]').addEventListener('change', e => { 53 | localStorage.setItem('resolve', e.target.checked); 54 | }); 55 | } 56 | -------------------------------------------------------------------------------- /v2/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Bookmark Manager and Viewer", 3 | "short_name": "bookmark-manager", 4 | "description": "An elegant bookmark manager with fuzzy search and more", 5 | "author": "InBasic", 6 | "version": "0.2.6.1", 7 | "manifest_version": 2, 8 | "permissions": [ 9 | "storage", 10 | "tabs", 11 | "bookmarks", 12 | "chrome://favicon/*", 13 | "", 14 | "clipboardWrite", 15 | "notifications", 16 | "contextMenus" 17 | ], 18 | "background": { 19 | "persistent": false, 20 | "scripts": [ 21 | "common.js" 22 | ] 23 | }, 24 | "browser_action": { 25 | "default_popup": "data/panel/index.html", 26 | "browser_style": true, 27 | "theme_icons": [{ 28 | "light": "data/icons/light/16.png", 29 | "dark": "data/icons/16.png", 30 | "size": 16 31 | }, { 32 | "light": "data/icons/light/32.png", 33 | "dark": "data/icons/32.png", 34 | "size": 32 35 | }, { 36 | "light": "data/icons/light/48.png", 37 | "dark": "data/icons/48.png", 38 | "size": 48 39 | }, { 40 | "light": "data/icons/light/64.png", 41 | "dark": "data/icons/64.png", 42 | "size": 64 43 | }] 44 | }, 45 | "sidebar_action": { 46 | "default_panel": "data/panel/index.html?in=sidebar", 47 | "default_icon": { 48 | "16": "data/icons/16.png", 49 | "32": "data/icons/32.png", 50 | "48": "data/icons/48.png", 51 | "128": "data/icons/128.png" 52 | } 53 | }, 54 | "homepage_url": "http://add0n.com/bookmarks-manager.html", 55 | "icons": { 56 | "16": "data/icons/16.png", 57 | "32": "data/icons/32.png", 58 | "48": "data/icons/48.png", 59 | "128": "data/icons/128.png", 60 | "256": "data/icons/256.png", 61 | "512": "data/icons/512.png" 62 | }, 63 | "web_accessible_resources": [ 64 | "favicon.ico" 65 | ], 66 | "options_ui": { 67 | "page": "data/options/index.html", 68 | "chrome_style": true 69 | }, 70 | "applications": { 71 | "gecko": { 72 | "id": "{beb1b1c0-32b9-47d8-bbd1-f65bed4e7c22}", 73 | "strict_min_version": "57.0" 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /v3/context.js: -------------------------------------------------------------------------------- 1 | { 2 | const once = () => { 3 | if (once.done) { 4 | return; 5 | } 6 | once.done = true; 7 | 8 | chrome.storage.local.get({ 9 | context: '' 10 | }, prefs => { 11 | chrome.contextMenus.create({ 12 | id: 'bookmark-link', 13 | title: 'Bookmark this Link', 14 | contexts: ['link'], 15 | targetUrlPatterns: ['*://*/*'], 16 | visible: prefs.context !== '' 17 | }, () => chrome.runtime.lastError); 18 | chrome.contextMenus.create({ 19 | id: 'bookmark-page', 20 | title: 'Bookmark this Page', 21 | contexts: ['page'], 22 | targetUrlPatterns: ['*://*/*'], 23 | visible: prefs.context !== '' 24 | }, () => chrome.runtime.lastError); 25 | if (/Firefox/.test(navigator.userAgent)) { 26 | chrome.contextMenus.create({ 27 | id: 'options', 28 | title: 'Options', 29 | contexts: ['action'] 30 | }, () => chrome.runtime.lastError); 31 | } 32 | }); 33 | }; 34 | chrome.runtime.onInstalled.addListener(once); 35 | chrome.runtime.onStartup.addListener(once); 36 | 37 | const update = () => chrome.storage.local.get({ 38 | context: '' 39 | }, prefs => { 40 | chrome.contextMenus.update('bookmark-link', { 41 | visible: prefs.context !== '' 42 | }, () => chrome.runtime.lastError); 43 | chrome.contextMenus.update('bookmark-page', { 44 | visible: prefs.context !== '' 45 | }, () => chrome.runtime.lastError); 46 | }); 47 | chrome.storage.onChanged.addListener(ps => ps.context && update()); 48 | } 49 | chrome.contextMenus.onClicked.addListener((info, tab) => { 50 | if (info.menuItemId === 'bookmark-link' || info.menuItemId === 'bookmark-page') { 51 | const props = {}; 52 | if (info.menuItemId === 'bookmark-page') { 53 | props.title = tab.title || 'Unknown Title', 54 | props.url = tab.url; 55 | } 56 | else { 57 | try { 58 | props.title = (new URL(info.linkUrl)).hostname; 59 | } 60 | catch (e) { 61 | props.title = info.linkUrl; 62 | } 63 | props.url = info.linkUrl; 64 | } 65 | 66 | chrome.storage.local.get({ 67 | context: '' 68 | }, prefs => chrome.bookmarks.create({ 69 | parentId: prefs.context, 70 | ...props 71 | }, () => { 72 | const lastError = chrome.runtime.lastError; 73 | if (lastError) { 74 | self.notify(lastError.message); 75 | } 76 | })); 77 | } 78 | else if (info.menuItemId === 'options') { 79 | chrome.runtime.openOptionsPage(); 80 | } 81 | }); 82 | -------------------------------------------------------------------------------- /v3/data/icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/128.png -------------------------------------------------------------------------------- /v3/data/icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/16.png -------------------------------------------------------------------------------- /v3/data/icons/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/256.png -------------------------------------------------------------------------------- /v3/data/icons/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/32.png -------------------------------------------------------------------------------- /v3/data/icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/48.png -------------------------------------------------------------------------------- /v3/data/icons/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/512.png -------------------------------------------------------------------------------- /v3/data/icons/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/64.png -------------------------------------------------------------------------------- /v3/data/icons/bookmarked/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/bookmarked/16.png -------------------------------------------------------------------------------- /v3/data/icons/bookmarked/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/bookmarked/32.png -------------------------------------------------------------------------------- /v3/data/icons/light/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/light/16.png -------------------------------------------------------------------------------- /v3/data/icons/light/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/light/32.png -------------------------------------------------------------------------------- /v3/data/icons/light/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/light/48.png -------------------------------------------------------------------------------- /v3/data/icons/light/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/icons/light/64.png -------------------------------------------------------------------------------- /v3/data/options/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 14px; 3 | font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif; 4 | background-color: #fff; 5 | color: #4d5156; 6 | width: min(100% - 2rem, 70rem); 7 | margin-inline: auto; 8 | } 9 | select, 10 | button, 11 | input[type=submit], 12 | input[type=button] { 13 | padding: 5px 10px; 14 | color: #444; 15 | background-image: linear-gradient(rgb(237, 237, 237), rgb(237, 237, 237) 38%, rgb(222, 222, 222)); 16 | box-shadow: rgba(0, 0, 0, 0.08) 0 1px 0, rgba(255, 255, 255, 0.75) 0 1px 2px inset; 17 | text-shadow: rgb(240, 240, 240) 0 1px 0; 18 | } 19 | select, 20 | button, 21 | textarea, 22 | input { 23 | border: solid 1px rgba(0, 0, 0, 0.25); 24 | } 25 | input[type=button]:disabled { 26 | opacity: 0.5; 27 | } 28 | textarea { 29 | width: 100%; 30 | box-sizing: border-box; 31 | display: block; 32 | } 33 | textarea, 34 | input[type=text], 35 | input[type=number] { 36 | padding: 5px; 37 | outline: none; 38 | } 39 | textarea:focus, 40 | input[type=text]:focus, 41 | input[type=number]:focus { 42 | background-color: #e5f8ff; 43 | } 44 | a, 45 | a:visited { 46 | color: #07c; 47 | text-decoration: none; 48 | } 49 | 50 | td:last-child { 51 | text-align: right; 52 | } 53 | hr { 54 | border: none; 55 | border-top: dashed 1px #ccc; 56 | } 57 | .note { 58 | text-align: left !important; 59 | font-size: 90%; 60 | color: #6d6d6d; 61 | } 62 | .two { 63 | display: grid; 64 | grid-template-columns: 1fr min-content; 65 | grid-gap: 5px; 66 | } 67 | .two :nth-child(2n) { 68 | align-self: end; 69 | justify-self: end; 70 | } 71 | 72 | .one { 73 | margin-top: 20px; 74 | display: flex; 75 | gap: 5px; 76 | flex-direction: column; 77 | } 78 | -------------------------------------------------------------------------------- /v3/data/options/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Options Page :: Bookmark Manager and Viewer 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | 36 |
37 | Custom styling (Read FAQs page for more info) 38 | 39 |
40 | 41 |

42 | Rate "Bookmark Manager and Viewer" 43 |

44 |

45 | 46 | - 47 | 48 |

49 |
50 |

51 | 1. In Firefox and Opera, you can also open the manager window in the browser sidebar area too 52 |
53 | 2. In Firefox, there is no built-in service for resolving domain's icon. If this item is checked, the extension uses http://www.google.com/s2/favicons service to resolve icons. 54 |

55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /v3/data/options/index.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | var log = document.getElementById('status'); 14 | 15 | function restore() { 16 | document.getElementById('css').value = localStorage.getItem('css') || ''; 17 | document.getElementById('sort').checked = localStorage.getItem('sort') === 'true'; 18 | document.getElementById('searchfocus').checked = localStorage.getItem('searchfocus') === 'true'; 19 | document.getElementById('resolve').checked = localStorage.getItem('resolve') === 'true'; 20 | document.getElementById('theme-source').value = localStorage.getItem('theme-source') || 'auto'; 21 | 22 | chrome.storage.local.get({ 23 | width: 500, 24 | height: 600, 25 | context: '', 26 | mode: 'popup' 27 | }, prefs => { 28 | document.getElementById('width').value = prefs.width; 29 | document.getElementById('height').value = prefs.height; 30 | document.getElementById('context').value = prefs.context; 31 | document.getElementById('mode').value = prefs.mode; 32 | }); 33 | } 34 | 35 | function save() { 36 | localStorage.setItem('css', document.getElementById('css').value || ''); 37 | localStorage.setItem('sort', document.getElementById('sort').checked); 38 | localStorage.setItem('searchfocus', document.getElementById('searchfocus').checked); 39 | localStorage.setItem('resolve', document.getElementById('resolve').checked); 40 | localStorage.setItem('theme-source', document.getElementById('theme-source').value); 41 | 42 | chrome.runtime.sendMessage({ 43 | cmd: 'theme-source' 44 | }); 45 | 46 | const prefs = { 47 | width: Math.max(300, document.getElementById('width').value), 48 | height: Math.max(400, document.getElementById('height').value), 49 | context: document.getElementById('context').value, 50 | mode: document.getElementById('mode').value 51 | }; 52 | 53 | chrome.storage.local.set(prefs, () => { 54 | log.textContent = 'Options saved.'; 55 | setTimeout(() => log.textContent = '', 750); 56 | restore(); 57 | }); 58 | } 59 | 60 | document.addEventListener('DOMContentLoaded', restore); 61 | document.getElementById('save').addEventListener('click', () => { 62 | try { 63 | save(); 64 | } 65 | catch (e) { 66 | log.textContent = e.message; 67 | setTimeout(() => log.textContent = '', 750); 68 | } 69 | }); 70 | 71 | document.getElementById('reset').addEventListener('click', e => { 72 | if (e.detail === 1) { 73 | window.setTimeout(() => log.textContent = '', 750); 74 | log.textContent = 'Double-click to reset!'; 75 | } 76 | else { 77 | localStorage.clear(); 78 | chrome.storage.local.clear(() => { 79 | chrome.runtime.reload(); 80 | window.close(); 81 | }); 82 | } 83 | }); 84 | 85 | document.getElementById('support').addEventListener('click', () => chrome.tabs.create({ 86 | url: chrome.runtime.getManifest().homepage_url + '?rd=donate' 87 | })); 88 | 89 | if (navigator.userAgent.indexOf('Firefox') !== -1) { 90 | document.getElementById('rate').href = 91 | 'https://addons.mozilla.org/en-US/firefox/addon/bookmarks-manager-and-viewer/reviews/'; 92 | } 93 | else if (navigator.userAgent.indexOf('OPR') !== -1) { 94 | document.getElementById('rate').href = 95 | 'https://addons.opera.com/en/extensions/details/bookmarks-manager-and-viewer/#feedback-container'; 96 | } 97 | 98 | // links 99 | for (const a of [...document.querySelectorAll('[data-href]')]) { 100 | if (a.hasAttribute('href') === false) { 101 | a.href = chrome.runtime.getManifest().homepage_url + '#' + a.dataset.href; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /v3/data/panel/ReadMe.txt: -------------------------------------------------------------------------------- 1 | https://github.com/vakata/jstree/archive/3.3.6.zip 2 | https://github.com/krisk/Fuse/archive/v3.3.0.zip 3 | -------------------------------------------------------------------------------- /v3/data/panel/body.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | if (!Element.prototype.scrollIntoViewIfNeeded) { 14 | Element.prototype.scrollIntoViewIfNeeded = function(centerIfNeeded) { 15 | function withinBounds(value, min, max, extent) { 16 | if (centerIfNeeded === false || max <= value + extent && value <= min + extent) { 17 | return Math.min(max, Math.max(min, value)); 18 | } 19 | else { 20 | return (min + max) / 2; 21 | } 22 | } 23 | 24 | function makeArea(left, top, width, height) { 25 | return { 26 | 'left': left, 27 | 'top': top, 28 | 'width': width, 29 | 'height': height, 30 | 'right': left + width, 31 | 'bottom': top + height, 32 | 'translate': function(x, y) { 33 | return makeArea(x + left, y + top, width, height); 34 | }, 35 | 'relativeFromTo': function(lhs, rhs) { 36 | let newLeft = left; 37 | let newTop = top; 38 | lhs = lhs.offsetParent; 39 | rhs = rhs.offsetParent; 40 | if (lhs === rhs) { 41 | return area; 42 | } 43 | for (; lhs; lhs = lhs.offsetParent) { 44 | newLeft += lhs.offsetLeft + lhs.clientLeft; 45 | newTop += lhs.offsetTop + lhs.clientTop; 46 | } 47 | for (; rhs; rhs = rhs.offsetParent) { 48 | newLeft -= rhs.offsetLeft + rhs.clientLeft; 49 | newTop -= rhs.offsetTop + rhs.clientTop; 50 | } 51 | return makeArea(newLeft, newTop, width, height); 52 | } 53 | }; 54 | } 55 | 56 | let parent; 57 | let elem = this; 58 | let area = makeArea( 59 | this.offsetLeft, this.offsetTop, 60 | this.offsetWidth, this.offsetHeight 61 | ); 62 | while ((parent = elem.parentNode) instanceof HTMLElement) { 63 | const clientLeft = parent.offsetLeft + parent.clientLeft; 64 | const clientTop = parent.offsetTop + parent.clientTop; 65 | 66 | // Make area relative to parent's client area. 67 | area = area 68 | .relativeFromTo(elem, parent) 69 | .translate(-clientLeft, -clientTop); 70 | 71 | parent.scrollLeft = withinBounds( 72 | parent.scrollLeft, 73 | area.right - parent.clientWidth, area.left, 74 | parent.clientWidth); 75 | 76 | parent.scrollTop = withinBounds( 77 | parent.scrollTop, 78 | area.bottom - parent.clientHeight, area.top, 79 | parent.clientHeight); 80 | 81 | // Determine actual scroll amount by reading back scroll properties. 82 | area = area.translate(clientLeft - parent.scrollLeft, 83 | clientTop - parent.scrollTop); 84 | elem = parent; 85 | } 86 | }; 87 | } 88 | 89 | { 90 | const css = localStorage.getItem('css') || ''; 91 | if (css) { 92 | const style = document.createElement('style'); 93 | style.textContent = css; 94 | document.documentElement.appendChild(style); 95 | } 96 | } 97 | // loaded in sidebar 98 | 99 | document.addEventListener('DOMContentLoaded', () => { 100 | if (location.search && location.search.indexOf('in=tab') !== -1) { 101 | document.querySelector('[data-cmd=open-in-tab]').remove(); 102 | } 103 | if ( 104 | location.search && location.search.indexOf('in=sidebar') !== -1 || 105 | location.search && location.search.indexOf('in=tab') !== -1 106 | ) { 107 | document.body.style.width = '100%'; 108 | document.body.style.height = '100%'; 109 | } 110 | else { 111 | chrome.storage.local.get({ 112 | width: 500, 113 | height: 600 114 | }, prefs => { 115 | document.body.style.width = prefs.width + 'px'; 116 | document.body.style.height = prefs.height + 'px'; 117 | }); 118 | } 119 | }); 120 | -------------------------------------------------------------------------------- /v3/data/panel/font/fontello.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'fontello'; 3 | src: url('./fontello.woff') format('woff'); 4 | font-weight: normal; 5 | font-style: normal; 6 | } 7 | 8 | [class^="icon-"]:before, [class*=" icon-"]:before { 9 | font-family: "fontello"; 10 | font-style: normal; 11 | font-weight: normal; 12 | speak: none; 13 | 14 | display: inline-block; 15 | text-decoration: inherit; 16 | width: 1em; 17 | margin-right: .2em; 18 | text-align: center; 19 | /* opacity: .8; */ 20 | 21 | /* For safety - reset parent styles, that can break glyph codes*/ 22 | font-variant: normal; 23 | text-transform: none; 24 | 25 | /* fix buttons height, for twitter bootstrap */ 26 | line-height: 1em; 27 | 28 | /* Animation center compensation - margins should be symmetric */ 29 | /* remove if not needed */ 30 | margin-left: .2em; 31 | 32 | /* you can be more comfortable with increased icons size */ 33 | /* font-size: 120%; */ 34 | 35 | /* Font smoothing. That was taken from TWBS */ 36 | -webkit-font-smoothing: antialiased; 37 | -moz-osx-font-smoothing: grayscale; 38 | 39 | /* Uncomment for 3D effect */ 40 | /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ 41 | } 42 | 43 | .icon-ok:before { content: '\e800'; } /* '' */ 44 | .icon-close:before { content: '\e801'; } /* '' */ 45 | -------------------------------------------------------------------------------- /v3/data/panel/font/fontello.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/font/fontello.woff -------------------------------------------------------------------------------- /v3/data/panel/icons/d_folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /v3/data/panel/icons/folder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /v3/data/panel/icons/page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/icons/page.png -------------------------------------------------------------------------------- /v3/data/panel/icons/window.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /v3/data/panel/index.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --e-hight: 28px; 3 | --border: #b7b7b7; 4 | --bg-one: #fff; 5 | --bg-two: #f2f2f2; 6 | --bg-selected: #beebff; 7 | --bg-notify: lightyellow; 8 | --fg: #000; 9 | --active: #f4f3f4; 10 | 11 | color-scheme: light; 12 | } 13 | html, 14 | body { 15 | height: 100%; 16 | overflow: hidden; 17 | } 18 | html.dark { 19 | --border: #505050; 20 | --bg-one: #464646; 21 | --bg-two: #2d2d2d; 22 | --bg-selected: #5fa2db; 23 | --bg-notify: #6d3400; 24 | --fg: #d3cdcd; 25 | --fg-alt: #fff; 26 | --active: #2d2d2d; 27 | 28 | color-scheme: dark; 29 | } 30 | body { 31 | display: flex; 32 | flex-direction: column; 33 | width: 500px; 34 | height: 600px; 35 | margin: 0; 36 | background-color: var(--bg-one); 37 | } 38 | body, 39 | table { 40 | font-family: arial, sans-serif; 41 | font-size: 13px; 42 | -webkit-font-smoothing: antialiased; 43 | -moz-osx-font-smoothing: grayscale; 44 | } 45 | table { 46 | width: 100%; 47 | border-collapse: collapse; 48 | } 49 | button, 50 | input { 51 | outline: none; 52 | } 53 | button, 54 | input[type="submit"], 55 | input[type="button"], 56 | input[type="search"], 57 | input[type="text"], 58 | #properties span { 59 | border: solid 1px var(--border); 60 | background-color: var(--bg-one); 61 | font-size: 13px; 62 | } 63 | input[type="search"], 64 | input[type="text"], 65 | #properties span { 66 | height: var(--e-hight); 67 | padding: 0 5px; 68 | } 69 | input[type="search"]:focus, 70 | input[type="text"]:focus { 71 | border-color: #419bf9; 72 | box-shadow: 0 0 1px #8ab8e7; 73 | } 74 | button, 75 | input[type="submit"], 76 | input[type="button"] { 77 | cursor: pointer; 78 | min-height: var(--e-hight); 79 | } 80 | button, 81 | input[type="button"] { 82 | margin: 0 2px; 83 | } 84 | button:active, 85 | input[type="button"]:active { 86 | opacity: 0.5; 87 | } 88 | button:disabled, 89 | input:disabled { 90 | opacity: 0.3 !important; 91 | } 92 | #tree li.separator { 93 | min-height: unset !important; 94 | height: 15px !important; 95 | position: relative; 96 | padding-left: 12px; 97 | pointer-events: none; 98 | } 99 | #tree li.separator::before { 100 | content: ''; 101 | border-bottom: dotted 1px #000; 102 | position: absolute; 103 | height: 50%; 104 | width: calc(100% - 50px); 105 | display: block; 106 | box-sizing: border-box; 107 | } 108 | #tree li.separator * { 109 | opacity: 0; 110 | } 111 | .d_folder, 112 | .folder { 113 | background-position: center !important; 114 | background-size: 20px; 115 | } 116 | .folder { 117 | background-image: url("icons/folder.svg") !important; 118 | } 119 | .d_folder { 120 | background-image: url("icons/d_folder.svg") !important; 121 | } 122 | .menu-button { 123 | position: relative; 124 | } 125 | .menu-button::after { 126 | border-color: var(--fg) transparent transparent transparent; 127 | border-width: 0.3333rem; 128 | right: 8px; 129 | margin-top: -0.1389rem; 130 | border-style: solid; 131 | content: ''; 132 | display: block; 133 | height: 0; 134 | position: absolute; 135 | top: 50%; 136 | width: 0; 137 | } 138 | .menu-button input { 139 | padding-right: 20px; 140 | } 141 | .menu-button > ul { 142 | position: absolute; 143 | left: 2px; 144 | top: 14px; 145 | white-space: nowrap; 146 | background-color: var(--bg-one); 147 | border: solid 1px var(--border); 148 | list-style-type: none; 149 | padding: 0; 150 | z-index: 1; 151 | visibility: hidden; 152 | opacity: 0; 153 | } 154 | .menu-button li { 155 | padding: 5px; 156 | cursor: pointer; 157 | } 158 | .menu-button li:hover { 159 | background-color: var(--active); 160 | } 161 | .menu-button li.separator { 162 | border-top: solid 1px var(--border); 163 | } 164 | .menu-button:hover ul { 165 | transition-delay: 0.25s; 166 | visibility: visible; 167 | opacity: 1; 168 | } 169 | #collapse { 170 | position: absolute; 171 | top: 50px; 172 | right: 30px; 173 | background-color: var(--bg-two); 174 | border: solid 1px var(--border); 175 | outline: none; 176 | z-index: 2; 177 | } 178 | #search { 179 | display: flex; 180 | margin: 10px; 181 | border: solid 1px var(--border); 182 | box-shadow: 0 0 0 10px var(--bg-two); 183 | } 184 | #search input[type="submit"] { 185 | display: none; 186 | } 187 | #search input[type="search"] { 188 | border: none; 189 | flex: 1; 190 | } 191 | #search input[type="button"] { 192 | width: 26px; 193 | height: 26px; 194 | background: var(--bg-one) url('icons/window.svg') center center no-repeat; 195 | background-size: 18px; 196 | border: none; 197 | margin: 0; 198 | } 199 | #tree { 200 | position: relative; 201 | user-select: none; 202 | border-top: solid 1px var(--border); 203 | display: contents; 204 | } 205 | .jstree-container-ul { 206 | overflow: auto; 207 | flex: 1; 208 | } 209 | #results { 210 | height: 300px; 211 | max-height: 50vh; 212 | border-top: solid 1px var(--border); 213 | position: relative; 214 | white-space: nowrap; 215 | display: none; 216 | flex-direction: column; 217 | } 218 | #results [data-id="count"] { 219 | background-color: #8080ea; 220 | color: #fff; 221 | float: right; 222 | margin-right: 5px; 223 | padding: 1px 3px; 224 | font-size: 80%; 225 | border-radius: 2px; 226 | } 227 | #results [data-id="count"]:empty { 228 | display: none; 229 | } 230 | #results [data-id="address"] { 231 | display: flex; 232 | align-items: center; 233 | } 234 | #results [data-id="address"] > span { 235 | flex: 1; 236 | } 237 | #results [data-id="address"] input[data-cmd="close"] { 238 | border: none; 239 | font-size: 14px; 240 | opacity: 0.5; 241 | background-color: transparent; 242 | } 243 | #results [data-id="address"] input:hover { 244 | opacity: 0.8; 245 | } 246 | #results [data-id="address"] input:active { 247 | opacity: 0.8; 248 | } 249 | #results table { 250 | table-layout: fixed; 251 | border-spacing: 0; 252 | } 253 | #results table tbody:empty::before { 254 | content: 'No results'; 255 | display: block; 256 | margin: 5px; 257 | opacity: 0.5; 258 | } 259 | #results th { 260 | border-bottom: 1px solid var(--border); 261 | background-color: var(--bg-two); 262 | font-weight: normal; 263 | text-align: left; 264 | padding-left: 10px; 265 | user-select: none; 266 | } 267 | #results th:last-child { 268 | border-left: 1px solid var(--border); 269 | } 270 | #results th, 271 | #results td { 272 | height: 22px; 273 | } 274 | #results tbody tr { 275 | cursor: pointer; 276 | } 277 | #results table tr[data-valid="true"] td { 278 | color: green; 279 | } 280 | #results table tr[data-valid="false"] td { 281 | color: red; 282 | } 283 | #results tbody tr:nth-child(odd) { 284 | background-color: var(--bg-two); 285 | } 286 | #results tbody tr.selected { 287 | background-color: var(--bg-selected); 288 | } 289 | #results:active tr.selected, 290 | #results:focus-within tr.selected { 291 | background-color: var(--bg-selected); 292 | } 293 | #results input[type="submit"] { 294 | display: none; 295 | } 296 | #results td { 297 | overflow: hidden; 298 | text-overflow: ellipsis; 299 | user-select: none; 300 | } 301 | #results td:first-child { 302 | padding-left: 26px; 303 | background-position: left 5px center; 304 | background-repeat: no-repeat; 305 | background-size: 16px; 306 | } 307 | #results td:last-child { 308 | padding-right: 5px; 309 | } 310 | #properties { 311 | border-top: solid 1px var(--border); 312 | background-color: var(--bg-two); 313 | padding: 5px; 314 | } 315 | #properties[data-enable="false"] { 316 | pointer-events: none; 317 | opacity: 0.5; 318 | } 319 | #properties input[type="text"] { 320 | width: 100%; 321 | box-sizing: border-box; 322 | } 323 | #properties input[type="submit"] { 324 | font-family: "fontello"; 325 | background-color: #52af52; 326 | color: #fff; 327 | border: none; 328 | width: 100%; 329 | cursor: pointer; 330 | } 331 | #properties input[type="text"]:disabled { 332 | background-color: transparent; 333 | opacity: 1 !important; 334 | } 335 | #properties input[type="submit"]:disabled { 336 | background-color: #ccc; 337 | } 338 | #properties span { 339 | height: var(--e-hight); 340 | line-height: var(--e-hight); 341 | display: inline-block; 342 | width: 100%; 343 | background-color: var(--bg-two); 344 | font-size: 11px; 345 | box-sizing: border-box; 346 | } 347 | #toolbar { 348 | background-color: var(--bg-two); 349 | border-top: solid 1px var(--border); 350 | padding: 5px; 351 | display: flex; 352 | align-items: center; 353 | } 354 | #toolbar span { 355 | position: fixed; 356 | background-color: #fdf8e4; 357 | color: #5f5032; 358 | border: solid 1px #c6c2b1; 359 | z-index: 10; 360 | top: 2px; 361 | right: 2px; 362 | padding: 10px; 363 | max-width: calc(100vw - 80px); 364 | font-size: 100%; 365 | } 366 | #notification { 367 | position: absolute; 368 | top: 0; 369 | left: 0; 370 | width: 100%; 371 | height: 100%; 372 | background-color: rgba(0, 0, 0, 0.5); 373 | display: none; /* flex */ 374 | align-items: center; 375 | justify-content: center; 376 | } 377 | #notification > div { 378 | background-color: var(--bg-one); 379 | padding: 10px; 380 | width: 80%; 381 | max-width: 500px; 382 | min-height: 90px; 383 | max-height: 80vh; 384 | border: solid 3px #ccc; 385 | display: flex; 386 | flex-direction: column; 387 | } 388 | #notification > div > span { 389 | overflow: hidden; 390 | text-overflow: ellipsis; 391 | white-space: pre; 392 | flex: 1; 393 | padding-bottom: 10px; 394 | } 395 | #notification > div > div { 396 | display: flex; 397 | align-items: center; 398 | justify-content: flex-end; 399 | } 400 | #notification[data-type="confirm"] [data-cmd="ok"] { 401 | display: none; 402 | } 403 | #notification[data-type="warning"] [data-cmd="yes"], 404 | #notification[data-type="warning"] [data-cmd="no"] { 405 | display: none; 406 | } 407 | #notification button { 408 | min-width: 90px; 409 | background-color: #3367d6; 410 | color: #fff; 411 | appearance: none; 412 | border: none; 413 | border-radius: 3px; 414 | font-size: 12px; 415 | text-align: center; 416 | } 417 | 418 | /* inline notification */ 419 | #toolbar > span { 420 | position: fixed; 421 | background-color: #fdf8e4; 422 | color: #4d3d1e; 423 | border: solid 1px #b79148; 424 | z-index: 10; 425 | top: 5px; 426 | right: 5px; 427 | display: flex; 428 | align-items: center; 429 | padding: 5px; 430 | } 431 | #toolbar > span:empty { 432 | display: none; 433 | } 434 | 435 | @-moz-document url-prefix() { 436 | [data-cmd="bookmark-manager"] { 437 | display: none; 438 | } 439 | } 440 | .favicon { 441 | background-color: var(--bg-notify); 442 | position: relative; 443 | display: grid; 444 | grid-template-columns: min-content 1fr min-content; 445 | grid-gap: 10px; 446 | padding: 5px; 447 | } 448 | .favicon input[type="button"] { 449 | align-self: baseline; 450 | } 451 | body:not([data-favicon="true"]) .favicon { 452 | display: none; 453 | } 454 | .jstree-themeicon-custom { 455 | background-size: 16px !important; 456 | } 457 | .jstree-default-dark .jstree-anchor { 458 | color: var(--fg); 459 | } 460 | .jstree-default-dark .jstree-clicked { 461 | color: var(--fg-alt); 462 | text-shadow: unset; 463 | } 464 | .jstree-default-dark .jstree-anchor > .jstree-icon { 465 | opacity: unset; 466 | } 467 | -------------------------------------------------------------------------------- /v3/data/panel/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Bookmark Manager and Viewer 12 | 13 | 14 |
15 | 16 |
17 |

To show bookmark icons, this extension uses google.com/s2 service. Check this box to enable this service

18 |

You can disable this service from the options page.

19 |
20 | 21 |
22 | 23 | 32 |
38 |
39 | 46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 67 | 68 | 69 |
55 |
56 | 57 | Title 58 |
59 |
61 |
62 | Address 63 | 64 | 65 |
66 |
70 |
71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
80 |
81 | 82 |
83 |
84 | 85 | 93 | 102 | 103 | 104 |
105 |
106 |
107 |
108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 |
Title
Address
Date
133 |
134 |
135 |
136 | 137 |
138 | 139 | 140 | 141 |
142 |
143 |
144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /v3/data/panel/jstree/ReadMe: -------------------------------------------------------------------------------- 1 | https://github.com/vakata/jstree/archive/refs/tags/3.3.17.zip 2 | -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default-dark/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default-dark/32px.png -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default-dark/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default-dark/40px.png -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default-dark/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default-dark/throbber.gif -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default/32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default/32px.png -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default/40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default/40px.png -------------------------------------------------------------------------------- /v3/data/panel/jstree/themes/default/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inbasic/bookmarks-manager/8c1681499b612732be787c3cbe2b0bec3786112e/v3/data/panel/jstree/themes/default/throbber.gif -------------------------------------------------------------------------------- /v3/data/panel/notification.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const notify = (function() { 14 | const div = document.getElementById('notification'); 15 | 16 | const p = div.querySelector('span'); 17 | let callback; 18 | 19 | div.querySelector('[data-cmd=yes]').addEventListener('click', () => { 20 | div.style.display = 'none'; 21 | if (callback) { 22 | callback(true); 23 | callback = ''; 24 | } 25 | }); 26 | div.querySelector('[data-cmd=no]').addEventListener('click', () => { 27 | div.style.display = 'none'; 28 | if (callback) { 29 | callback(false); 30 | callback = ''; 31 | } 32 | }); 33 | div.querySelector('[data-cmd=ok]').addEventListener('click', () => { 34 | div.style.display = 'none'; 35 | }); 36 | 37 | document.addEventListener('keyup', e => { 38 | if ((e.code === 'KeyN') && callback) { 39 | div.querySelector('[data-cmd=no]').dispatchEvent(new Event('click')); 40 | } 41 | else if (e.code === 'KeyY' && callback) { 42 | div.querySelector('[data-cmd=yes]').dispatchEvent(new Event('click')); 43 | } 44 | 45 | if (e.code === 'Escape' && callback) { 46 | div.style.display = 'none'; 47 | callback = ''; 48 | } 49 | }); 50 | 51 | const ts = document.querySelector('#toolbar span'); 52 | let id; 53 | 54 | return { 55 | confirm: function(msg, c) { 56 | p.title = p.textContent = msg; 57 | div.style.display = 'flex'; 58 | div.dataset.type = 'confirm'; 59 | callback = c; 60 | }, 61 | warning: function(msg) { 62 | p.title = p.textContent = msg; 63 | div.style.display = 'flex'; 64 | div.dataset.type = 'warning'; 65 | }, 66 | inline: function(msg) { 67 | window.clearTimeout(id); 68 | ts.title = ts.textContent = msg; 69 | id = window.setTimeout(() => ts.title = ts.textContent = '', 5000); 70 | } 71 | }; 72 | })(); 73 | -------------------------------------------------------------------------------- /v3/data/panel/properties.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* global tree, notify */ 12 | 'use strict'; 13 | 14 | const properties = document.querySelector('#properties'); 15 | properties.addEventListener('keyup', e => { 16 | const target = e.target; 17 | const tr = target.closest('tr'); 18 | if (tr) { 19 | tr.querySelector('[type=submit]').disabled = !(target && target.dataset.value !== target.value && target.value); 20 | } 21 | }); 22 | properties.addEventListener('submit', e => { 23 | e.preventDefault(); 24 | e.stopPropagation(); 25 | 26 | const form = e.target; 27 | const tr = properties.querySelector('[form=' + form.id + ']').closest('tr'); 28 | const id = properties.dataset.id; 29 | const input = tr.querySelector('input'); 30 | const prp = {}; 31 | prp[form.id] = input.value; 32 | 33 | chrome.bookmarks.update(id, prp, () => { 34 | input.dataset.value = input.value; 35 | tr.querySelector('[type=submit]').disabled = true; 36 | // updating search view 37 | const results = document.querySelector('#results tbody'); 38 | const rtr = results.querySelector(`[data-id="${id}"]`); 39 | if (rtr) { 40 | rtr.querySelector('td:nth-child(' + (form.id === 'title' ? 1 : 2) + ')').textContent = input.value; 41 | } 42 | // updating tree view 43 | if (form.id === 'title') { 44 | tree.jstree('set_text', id, tree.string.escape(prp.title)); 45 | } 46 | // reseting fuse 47 | window.dispatchEvent(new Event('search:reset-fuse')); 48 | // 49 | const lastError = chrome.runtime.lastError; 50 | if (lastError) { 51 | notify.inline('[Refresh Required] ' + lastError.message); 52 | } 53 | }); 54 | }); 55 | 56 | addEventListener('properties:select-title', () => { 57 | const title = properties.querySelector('tr:nth-child(1) input'); 58 | title.focus(); 59 | title.select(); 60 | }); 61 | addEventListener('properties:select-link', () => { 62 | const url = properties.querySelector('tr:nth-child(2) input'); 63 | url.focus(); 64 | url.select(); 65 | }); 66 | 67 | tree.on('select_node.jstree', (e, data) => { 68 | properties.dataset.id = data.node.id; 69 | 70 | const title = properties.querySelector('tr:nth-child(1) input'); 71 | title.dataset.value = title.value = 72 | tree.string.uscape(data.node.text); 73 | title.dispatchEvent(new Event('keyup', { 74 | bubbles: true 75 | })); 76 | 77 | title.disabled = data.node.id.startsWith('feed-') || data.node.data.drag === false; 78 | const url = properties.querySelector('tr:nth-child(2) input'); 79 | url.disabled = data.node.data.drag === false || data.node.data.url === ''; 80 | url.dataset.value = url.value = data.node.data.url; 81 | url.dispatchEvent(new Event('keyup', { 82 | bubbles: true 83 | })); 84 | 85 | const d = new Date(data.node.data.dateAdded); 86 | properties.querySelector('tr:nth-child(3) span').textContent = d.toDateString() + ' ' + d.toLocaleTimeString(); 87 | 88 | // disable on multiple select 89 | // properties.dataset.enable = data.selected.length === 1; 90 | }); 91 | -------------------------------------------------------------------------------- /v3/data/panel/search.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* global Fuse, utils, tree, notify */ 12 | 'use strict'; 13 | 14 | (function(search, searchForm, results, count, tbody, trC, close, validate) { 15 | // should the search box get the focus 16 | if (localStorage.getItem('searchfocus') === 'true') { 17 | document.addEventListener('DOMContentLoaded', () => search.focus()); 18 | } 19 | // 20 | let useNative = false; 21 | let fuse; 22 | let closed = false; 23 | // focus searchbox on Ctrl + F 24 | addEventListener('keydown', e => { 25 | if ((e.metaKey && e.keyCode === 70) || (e.ctrlKey && e.keyCode === 70)) { 26 | e.preventDefault(); 27 | e.stopPropagation(); 28 | search.focus(); 29 | } 30 | }); 31 | // reset fuse on edit 32 | addEventListener('search:reset-fuse', () => fuse = null); 33 | function prepare() { 34 | if (useNative) { 35 | return Promise.resolve(); 36 | } 37 | return new Promise(resolve => { 38 | chrome.bookmarks.getTree(nodes => { 39 | const arr = []; 40 | function extract(node) { 41 | if (node.children) { 42 | node.children.forEach(n => { 43 | // only add bookmarks not folders 44 | if (n.url) { 45 | arr.push(n); 46 | } 47 | extract(n); 48 | }); 49 | } 50 | } 51 | extract(nodes[0]); 52 | fuse = new Fuse(arr, { 53 | keys: ['title', 'url'] 54 | }); 55 | resolve(); 56 | }); 57 | }); 58 | } 59 | function hierarchy(id) { 60 | return new Promise(resolve => { 61 | const ids = []; 62 | function up(id) { 63 | ids.push(id); 64 | chrome.bookmarks.get(id, arr => { 65 | const node = arr[0]; 66 | if (node.parentId) { 67 | up(node.parentId); 68 | } 69 | else { 70 | resolve(ids); 71 | } 72 | }); 73 | } 74 | up(id); 75 | }); 76 | } 77 | // prevent old searches from populating 78 | let index = 0; 79 | 80 | function add(obj) { 81 | const node = document.importNode(trC.content, true); 82 | const tr = node.querySelector('tr'); 83 | const td1 = node.querySelector('td:nth-child(1)'); 84 | 85 | let icon = obj.url; 86 | if (!icon && navigator.userAgent.indexOf('Firefox') !== -1 && obj.type === 'folder') { 87 | icon = '/data/panel/icons/folder.png'; 88 | } 89 | if (!icon && navigator.userAgent.indexOf('Firefox') === -1) { 90 | icon = '/data/panel/icons/folder.png'; 91 | } 92 | icon = icon || '/data/panel/icons/page.png'; 93 | 94 | td1.style['background-image'] = `url(${utils.favicon(icon)})`; 95 | 96 | td1.textContent = obj.title; 97 | node.querySelector('td:nth-child(2)').textContent = obj.url; 98 | tr.dataset.id = obj.id; 99 | tr.dataset.url = obj.url || ''; 100 | tr.dataset.parentId = obj.parentId; 101 | tbody.appendChild(node); 102 | } 103 | 104 | function perform() { 105 | let value = search.value.trim(); 106 | 107 | results.style.display = value ? 'flex' : 'none'; 108 | closed = !value; 109 | validate.disabled = false; 110 | 111 | if (value.length > 1) { 112 | // to not search duplicates 113 | if (perform.value === value) { 114 | return; 115 | } 116 | perform.value = value; 117 | // updating index 118 | index += 1; 119 | 120 | if (value.startsWith('fuzzy:')) { 121 | useNative = false; 122 | value = value.replace(/fuzzy:\s*/, ''); 123 | } 124 | else { 125 | useNative = true; 126 | fuse = null; 127 | } 128 | 129 | tbody.textContent = ''; 130 | 131 | const next = (i => { 132 | return (results = [], total) => { 133 | if (i === index) { 134 | results.forEach(add); 135 | count.textContent = (results.length || '') + (total ? '/' + total : ''); 136 | const tr = document.querySelector('#results tbody tr'); 137 | // select the first child 138 | if (tr) { 139 | tr.classList.add('selected'); 140 | tr.querySelector('input').checked = true; 141 | } 142 | } 143 | }; 144 | })(index); 145 | 146 | if (value.startsWith('root:')) { 147 | const id = value.replace(/root:/, '').split(' ')[0]; 148 | const term = value.replace(/root:[^ ]+/, '').toLowerCase().trim(); 149 | const nodes = []; 150 | const search = id => new Promise(resolve => chrome.bookmarks.getChildren(id, async nds => { 151 | nodes.push(...nds.filter(n => n.url)); 152 | await Promise.all(nds.filter(n => !n.url).map(n => search(n.id))); 153 | resolve(); 154 | })); 155 | if (id) { 156 | search(id).then(() => { 157 | if (term) { 158 | next(nodes.filter(({url, title}) => { 159 | title = title.toLowerCase(); 160 | url = url.toLowerCase(); 161 | // split and match by keys 162 | const keys = term.split(/\s+/); 163 | return keys.filter(key => title.indexOf(key) !== -1 || url.indexOf(key) !== -1).length === keys.length; 164 | }), nodes.length); 165 | } 166 | else { 167 | next(nodes); 168 | } 169 | }); 170 | } 171 | } 172 | else if (value.startsWith('id:')) { 173 | const ids = value.replace(/id:\s*/, '').split(/,\s*/); 174 | chrome.bookmarks.get(ids, next); 175 | } 176 | else if (useNative) { 177 | chrome.bookmarks.search(value, next); 178 | } 179 | else { 180 | (fuse ? Promise.resolve() : prepare()).then(() => { 181 | next(fuse.search(value)); 182 | }); 183 | } 184 | } 185 | else { 186 | perform.value = ''; 187 | count.textContent = ''; 188 | } 189 | } 190 | 191 | function closePanel() { 192 | tbody.textContent = ''; 193 | search.value = ''; 194 | perform.value = ''; 195 | count.textContent = ''; 196 | search.dispatchEvent(new Event('keyup')); 197 | closed = true; 198 | } 199 | 200 | search.addEventListener('keyup', perform); 201 | search.addEventListener('search', perform); 202 | searchForm.addEventListener('submit', e => { 203 | e.preventDefault(); 204 | const tr = tbody.querySelector('.selected'); 205 | if (tr) { 206 | tr.click(); 207 | } 208 | }); 209 | 210 | results.addEventListener('click', e => { 211 | const target = e.target; 212 | const tr = target.closest('tr'); 213 | if (tr) { 214 | const id = tr.dataset.id; 215 | if (id) { 216 | // selecting 217 | [...tbody.querySelectorAll('.selected')].forEach(tr => tr.classList.remove('selected')); 218 | tr.classList.add('selected'); 219 | // displaying in tree view 220 | hierarchy(id).then(nodes => { 221 | window.dispatchEvent(new CustomEvent('tree:open-array', { 222 | detail: { 223 | nodes 224 | } 225 | })); 226 | }); 227 | tr.querySelector('input')?.focus(); 228 | } 229 | } 230 | const sort = target.dataset.sort; 231 | if (sort) { 232 | const trs = [...tbody.querySelectorAll('tr')].sort((a, b) => { 233 | const sa = a.querySelector(sort).textContent; 234 | const sb = b.querySelector(sort).textContent; 235 | 236 | return target.dataset.increase === 'true' ? sb.localeCompare(sa) : sa.localeCompare(sb); 237 | }); 238 | trs.forEach(tr => tbody.appendChild(tr)); 239 | target.dataset.increase = target.dataset.increase !== 'true'; 240 | } 241 | }); 242 | { 243 | const callback = () => { 244 | const tr = tbody.querySelector('.selected'); 245 | if (tr) { 246 | closePanel(); 247 | } 248 | tree.activate(); 249 | }; 250 | tbody.addEventListener('dblclick', callback); 251 | results.addEventListener('submit', e => { 252 | e.preventDefault(); 253 | callback(); 254 | }); 255 | } 256 | 257 | close.addEventListener('click', closePanel); 258 | 259 | validate.addEventListener('click', () => { 260 | validate.disabled = true; 261 | 262 | const check = url => new Promise((resolve, reject) => { 263 | const controller = new AbortController(); 264 | 265 | setTimeout(() => controller.abort(), 6000); 266 | fetch(url, { 267 | signal: controller.signal 268 | }).then(r => { 269 | if (r.ok) { 270 | return resolve('Link is fine'); 271 | } 272 | throw Error('Link is dead'); 273 | }).catch(reject).finally(() => controller.abort()); 274 | }); 275 | 276 | const trs = [...tbody.querySelectorAll('tr')] 277 | .filter(tr => tr.dataset.url); 278 | trs.forEach(tr => tr.removeAttribute('data-valid')); 279 | 280 | const origins = new Set(); 281 | for (const tr of trs) { 282 | try { 283 | const {origin} = new URL(tr.dataset.url); 284 | if (origin.startsWith('http')) { 285 | origins.add(origin + '/'); 286 | } 287 | } 288 | catch (e) {} 289 | } 290 | if (origins.size) { 291 | chrome.permissions.request({ 292 | origins: ['*://*/*'] 293 | }, async () => { 294 | const chunks = []; 295 | for (let i = 0; i < trs.length; i += 3) { 296 | chunks.push(trs.slice(i, i + 3)); 297 | } 298 | for (const chunk of chunks) { 299 | if (closed) { 300 | return; 301 | } 302 | await Promise.all(chunk.map(tr => { 303 | const url = tr.dataset.url; 304 | const td = tr.querySelector('td:last-child'); 305 | td.textContent = 'validating...'; 306 | td.scrollIntoViewIfNeeded(); 307 | return check(url).then(() => { 308 | tr.dataset.valid = true; 309 | td.textContent = url; 310 | }).catch(() => { 311 | tr.dataset.valid = false; 312 | }); 313 | })); 314 | } 315 | validate.disabled = false; 316 | }); 317 | } 318 | else { 319 | notify.inline('There is no remote bookmark in the list'); 320 | validate.disabled = false; 321 | } 322 | }); 323 | })( 324 | document.querySelector('#search input[type=search]'), 325 | document.getElementById('search'), 326 | document.querySelector('#results'), 327 | document.querySelector('#results [data-id=count]'), 328 | document.querySelector('#results tbody'), 329 | document.querySelector('#results template'), 330 | document.querySelector('#results [data-id=address] input[data-cmd=close]'), 331 | document.querySelector('#results [data-id=address] input[data-cmd=validate-list]') 332 | ); 333 | -------------------------------------------------------------------------------- /v3/data/panel/second.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* global $, utils, getRoot */ 12 | 'use strict'; 13 | 14 | { 15 | const tree = $('#tree [data-id=two]'); 16 | tree.jstree({ 17 | 'types': { 18 | 'file': { 19 | 'icon': 'item', 20 | 'max_children': 0 21 | }, 22 | 'folder': { 23 | 'icon': 'folder' 24 | } 25 | }, 26 | 'plugins': [ 27 | 'dnd' 28 | ], 29 | 'core': { 30 | // Content Security Policy: The page’s settings blocked the loading of a resource at blob:moz-extension:// 31 | 'worker': !/Firefox/.test(navigator.userAgent), 32 | 'check_callback': true, 33 | 'multiple': true, 34 | 'data': function(obj, cb) { 35 | chrome.bookmarks.getChildren(obj.id === '#' ? getRoot() : obj.id, nodes => { 36 | cb.call(this, nodes.map(node => { 37 | const children = !node.url; 38 | return { 39 | text: node.title, 40 | id: node.id, 41 | type: children ? 'folder' : 'file', 42 | icon: children ? null : utils.favicon(node.url), 43 | children, 44 | data: { 45 | dateGroupModified: node.dateGroupModified, 46 | dateAdded: node.dateAdded, 47 | url: node.url || '' 48 | } 49 | }; 50 | })); 51 | }); 52 | } 53 | } 54 | }); 55 | } 56 | -------------------------------------------------------------------------------- /v3/data/panel/toolbar.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* global tree, notify, utils */ 12 | 'use strict'; 13 | 14 | document.addEventListener('click', e => { 15 | const cmd = e.target.dataset.cmd; 16 | if (cmd === 'collapse') { 17 | tree.jstree('deselect_all'); 18 | tree.jstree('close_all'); 19 | } 20 | else if (cmd === 'delete') { 21 | const ids = tree.jstree('get_selected'); 22 | const nodes = ids.map(id => tree.jstree('get_node', id)); 23 | 24 | notify.confirm(`Are you sure you want to delete: 25 | 26 | ${nodes.map((node, i) => (i + 1) + '. ' + (node.data.url || node.text)).join('\n ')}`, a => { 27 | if (a) { 28 | nodes.forEach(node => chrome.bookmarks[node.type === 'folder' ? 'removeTree' : 'remove'](node.id, () => { 29 | // jstree 30 | tree.jstree('select_node', node.parent); 31 | if (tree.jstree('delete_node', node.id) === false) { 32 | notify.inline('Cannot delete nodes'); 33 | throw Error('CANNOT_DELETE'); 34 | } 35 | // results 36 | const results = document.querySelector('#results tbody'); 37 | const rtr = results.querySelector(`[data-id="${node.id}"]`); 38 | if (rtr) { 39 | rtr.parentNode.removeChild(rtr); 40 | } 41 | // reseting fuse 42 | window.dispatchEvent(new Event('search:reset-fuse')); 43 | })); 44 | } 45 | }); 46 | } 47 | else if (cmd === 'create-folder' || cmd === 'create-bookmark' || cmd === 'create-from-tab') { 48 | const ids = tree.jstree('get_selected'); 49 | 50 | if (ids.length === 0) { 51 | return notify.inline('Please select a node first'); 52 | } 53 | const id = ids[0]; 54 | const node = tree.jstree('get_node', id); 55 | const parentId = node.type === 'folder' ? node.id : node.parent; 56 | 57 | const prp = { 58 | parentId 59 | }; 60 | if (node.type === 'folder') { 61 | prp.index = 0; 62 | } 63 | else { 64 | const parent = tree.jstree('get_node', node.parent); 65 | prp.index = parent.children.indexOf(node.id) + 1; 66 | } 67 | (function(callback) { 68 | if (cmd === 'create-folder') { 69 | return callback(null, 'new directory'); 70 | } 71 | else if (cmd === 'create-bookmark') { 72 | return callback('http://example.com', 'new bookmark'); 73 | } 74 | else { 75 | chrome.tabs.query({ 76 | active: true, 77 | currentWindow: true 78 | }, tabs => { 79 | callback(tabs[0].url, tabs[0].title); 80 | }); 81 | } 82 | })(function(url, title) { 83 | prp.url = url; 84 | prp.title = title; 85 | chrome.bookmarks.create(prp, node => { 86 | tree.jstree('create_node', parentId, { 87 | text: node.title, 88 | id: node.id, 89 | type: url ? 'file' : 'folder', 90 | icon: url ? utils.favicon(url) : null, 91 | data: { 92 | dateGroupModified: node.dateGroupModified, 93 | dateAdded: node.dateAdded, 94 | url 95 | } 96 | }, node.index, node => { 97 | window.focus(); 98 | tree.focus(); 99 | tree.jstree('deselect_all'); 100 | tree.jstree('select_node', node.id); 101 | }); 102 | tree.jstree('open_node', parentId); 103 | }); 104 | }); 105 | } 106 | else if (cmd === 'open-options') { 107 | chrome.runtime.openOptionsPage(); 108 | } 109 | else if (cmd === 'open-in-tab') { 110 | chrome.tabs.create({ 111 | url: '/data/panel/index.html?in=tab' 112 | }); 113 | } 114 | else if (cmd === 'reset-root') { 115 | localStorage.removeItem('root'); 116 | location.reload(); 117 | } 118 | else if (cmd === 'bookmark-manager') { 119 | chrome.tabs.create({ 120 | url: 'chrome://bookmarks/' 121 | }, () => chrome.runtime.lastError && notify.warning(chrome.runtime.lastError.message)); 122 | } 123 | else if (cmd === 'update-title') { 124 | const name = e.target.textContent; 125 | 126 | const ids = tree.jstree('get_selected'); 127 | const id = ids[0]; 128 | const node = tree.jstree('get_node', id); 129 | 130 | if (node.data.url) { 131 | chrome.permissions.request({ 132 | origins: [node.data.url] 133 | }, () => { 134 | const controller = new AbortController(); 135 | setTimeout(() => controller.abort(), 6000); 136 | 137 | e.target.textContent = 'Please wait...'; 138 | fetch(node.data.url, { 139 | signal: controller.signal 140 | }).then(r => r.text()).then(content => { 141 | const parser = new DOMParser(); 142 | const doc = parser.parseFromString(content, 'text/html'); 143 | 144 | const e = doc.querySelector('title'); 145 | if (e && e.textContent) { 146 | const input = document.querySelector('#properties input[form=title]'); 147 | if (input.value === e.textContent) { 148 | throw Error('"title" is up-do-date'); 149 | } 150 | else { 151 | input.value = e.textContent; 152 | input.dispatchEvent(new Event('keyup', { 153 | bubbles: true 154 | })); 155 | return; 156 | } 157 | } 158 | throw Error('Cannot find title'); 159 | }).catch(e => { 160 | console.warn(e); 161 | notify.inline(e.message); 162 | }).finally(() => e.target.textContent = name); 163 | }); 164 | } 165 | else { 166 | notify.inline('This bookmark is not representing a webpage'); 167 | } 168 | } 169 | }); 170 | // keyboard shortcut 171 | document.addEventListener('keydown', e => { 172 | if ( 173 | ((e.ctrlKey || e.metaKey) && e.shiftKey) || 174 | e.code === 'Delete' || 175 | e.code === 'Backspace' 176 | ) { 177 | switch (e.code) { 178 | case 'KeyC': 179 | document.querySelector('[data-cmd=collapse]').click(); 180 | break; 181 | case 'KeyU': 182 | document.querySelector('[data-cmd=update-title]').click(); 183 | break; 184 | case 'KeyO': 185 | document.querySelector('[data-cmd=open-options]').click(); 186 | break; 187 | case 'KeyR': 188 | document.querySelector('[data-cmd=reset-root]').click(); 189 | break; 190 | case 'KeyB': 191 | document.querySelector('[data-cmd=create-bookmark]').click(); 192 | break; 193 | case 'KeyT': 194 | document.querySelector('[data-cmd=create-from-tab]').click(); 195 | break; 196 | case 'KeyD': 197 | document.querySelector('[data-cmd=create-folder]').click(); 198 | break; 199 | case 'KeyE': 200 | window.dispatchEvent(new Event('properties:select-title')); 201 | break; 202 | case 'KeyL': 203 | tree.activate(); 204 | break; 205 | case 'Backspace': 206 | case 'Delete': 207 | if (e.target.tagName !== 'INPUT') { 208 | document.querySelector('#toolbar [data-cmd="delete"]').click(); 209 | } 210 | break; 211 | } 212 | e.stopImmediatePropagation(); 213 | return false; 214 | } 215 | }); 216 | -------------------------------------------------------------------------------- /v3/data/panel/tree.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | /* global $, utils, notify */ 12 | 'use strict'; 13 | 14 | function getRoot() { 15 | if (localStorage.getItem('root')) { 16 | return localStorage.getItem('root'); 17 | } 18 | return /Firefox/.test(navigator.userAgent) ? 'root________' : '0'; 19 | } 20 | 21 | const tree = $('#tree'); 22 | tree.isFeed = url => url && ( 23 | url.indexOf('rss') !== -1 || 24 | url.indexOf('feed') !== -1 25 | ); 26 | tree.string = {}; 27 | tree.plugins = ['state', 'dnd', 'types', 'contextmenu', 'conditionalselect']; 28 | if (localStorage.getItem('sort') === 'true') { 29 | tree.plugins.push('sort'); 30 | } 31 | 32 | tree.element = id => $('#' + id); 33 | 34 | tree.activate = () => { 35 | try { 36 | const ids = tree.jstree('get_selected'); 37 | const id = ids[0]; 38 | tree.jstree('hover_node', tree.element(id)); 39 | 40 | tree.element(id).focus(); 41 | } 42 | catch (e) { 43 | console.error(e); 44 | } 45 | window.setTimeout(() => tree.focus(), 100); 46 | }; 47 | 48 | tree.string.escape = str => str 49 | .replace(/&/g, '&') 50 | .replace(//g, '>') 52 | .replace(/"/g, '"') 53 | .replace(/'/g, '''); 54 | tree.string.uscape = str => str 55 | .replace(/</g, '<') 56 | .replace(/>/g, '>') 57 | .replace(/"/g, '"') 58 | .replace(/'/g, `'`) 59 | .replace(/&/g, '&'); 60 | 61 | tree.jstree({ 62 | 'types': { 63 | 'file': { 64 | 'icon': 'item', 65 | 'max_children': 0 66 | }, 67 | 'folder': { 68 | 'icon': 'folder' 69 | }, 70 | 'd_folder': { 71 | 'icon': 'd_folder' 72 | } 73 | }, 74 | 'plugins': tree.plugins, 75 | 'conditionalselect': node => { 76 | if (node.data && node.data.type === 'separator') { 77 | return false; 78 | } 79 | return true; 80 | }, 81 | 'core': { 82 | // Content Security Policy: The page’s settings blocked the loading of a resource at blob:moz-extension:// 83 | 'worker': !/Firefox/.test(navigator.userAgent), 84 | 'check_callback': (operation, node) => { 85 | // do not allow drag and drop in sort mode 86 | if (localStorage.getItem('sort') === 'true' && operation === 'move_node') { 87 | return false; 88 | } 89 | if (operation === 'move_node') { 90 | // do not allow moving of the root elements 91 | // do not allow moving to the root 92 | return node.data.drag; 93 | } 94 | // do not allow inline-edit 95 | if (operation === 'edit') { 96 | return false; 97 | } 98 | return true; 99 | }, 100 | 'multiple': true, 101 | 'data': (obj, cb) => { 102 | if (obj.data && obj.data.feed) { 103 | fetch(obj.data.url).then(r => r.text()) 104 | .then(str => (new DOMParser()).parseFromString(str, 'text/xml')) 105 | .then(doc => { 106 | const items = [...doc.querySelectorAll('item')]; 107 | if (items && items.length) { 108 | cb(items.map(item => { 109 | const url = item.querySelector('link').textContent; 110 | const title = item.querySelector('title').textContent || 'unknown title'; 111 | const date = item.querySelector('pubDate').textContent || ''; 112 | return { 113 | text: tree.string.escape(title), 114 | id: 'feed-' + Math.random(), 115 | type: 'file', 116 | icon: utils.favicon(url), 117 | children: false, 118 | a_attr: { // open with middle-click 119 | href: url 120 | }, 121 | data: { 122 | dateGroupModified: date, 123 | dateAdded: date, 124 | url, 125 | feed: tree.isFeed(url), 126 | drag: false 127 | } 128 | }; 129 | })); 130 | } 131 | else { 132 | throw Error('empty feed'); 133 | } 134 | }).catch(e => { 135 | cb([{ 136 | text: e.message || 'unknown error', 137 | id: 'feed-' + Math.random(), 138 | type: 'file', 139 | icon: '', 140 | children: false, 141 | a_attr: { // open with middle-click 142 | href: '' 143 | }, 144 | data: { 145 | dateGroupModified: '', 146 | dateAdded: '', 147 | url: '', 148 | feed: false, 149 | drag: false 150 | } 151 | }]); 152 | }); 153 | } 154 | else { 155 | chrome.bookmarks.getChildren(obj.id === '#' ? getRoot() : obj.id, nodes => { 156 | cb(nodes.map(node => { 157 | const feed = tree.isFeed(node.url); 158 | const children = !node.url || feed === true; 159 | const drag = node.parentId !== '0' && node.parentId !== 'root________'; 160 | const rtn = { 161 | text: node.type === 'separator' ? '..............' : tree.string.escape(node.title), 162 | id: node.id, 163 | type: children ? (drag ? 'folder' : 'd_folder') : (node.type === 'separator' ? 'separator' : 'file'), 164 | icon: children ? null : utils.favicon(node.url), 165 | children, 166 | a_attr: { // open with middle-click 167 | href: node.url || '#' 168 | }, 169 | data: { 170 | type: node.type, 171 | dateGroupModified: node.dateGroupModified, 172 | dateAdded: node.dateAdded, 173 | url: node.url || '', 174 | feed, 175 | drag 176 | }, 177 | state: { 178 | hidden: node.url && node.url.startsWith('place:') 179 | } 180 | }; 181 | if (node.type === 'separator') { 182 | rtn.li_attr = { 183 | 'class': 'separator' 184 | }; 185 | } 186 | return rtn; 187 | })); 188 | }); 189 | } 190 | } 191 | }, 192 | 'contextmenu': { 193 | 'items': node => ({ 194 | 'Copy Title': { 195 | 'label': 'Copy Title', 196 | 'action': () => { 197 | const ids = tree.jstree('get_selected'); 198 | const nodes = ids.map(id => tree.jstree('get_node', id)); 199 | 200 | utils.copy(nodes.map(node => node.text).join('\n')); 201 | } 202 | }, 203 | 'Copy Link': { 204 | 'label': 'Copy Link', 205 | 'action': () => { 206 | const ids = tree.jstree('get_selected'); 207 | const nodes = ids.map(id => tree.jstree('get_node', id)); 208 | 209 | utils.copy(nodes.map(node => node.data.url).join('\n')); 210 | }, 211 | '_disabled': () => !node.data.url 212 | }, 213 | 'Copy ID': { 214 | 'label': 'Copy ID', 215 | 'action': () => { 216 | const ids = tree.jstree('get_selected'); 217 | utils.copy(ids.join('\n')); 218 | } 219 | }, 220 | 'Open Link in New Tab': { 221 | 'separator_before': true, 222 | 'label': 'Open Link in New Tab', 223 | 'action': () => dispatchEvent(new CustomEvent('actions:open-links', { 224 | detail: 'new-tab' 225 | })), 226 | '_disabled': () => !node.data.url 227 | }, 228 | 'Open Link in Background Tab': { 229 | 'label': 'Open Link in Background Tab', 230 | 'action': () => dispatchEvent(new CustomEvent('actions:open-links', { 231 | detail: 'background-tab' 232 | })), 233 | '_disabled': () => !node.data.url 234 | }, 235 | 'Open Link in New Window': { 236 | 'label': 'Open Link in New Window', 237 | 'action': () => dispatchEvent(new CustomEvent('actions:open-links', { 238 | detail: 'new-window' 239 | })), 240 | '_disabled': () => !node.data.url 241 | }, 242 | 'Open Link in Incognito Window': { 243 | 'label': 'Open Link in Incognito Window', 244 | 'action': () => dispatchEvent(new CustomEvent('actions:open-links', { 245 | detail: 'incognito-window' 246 | })), 247 | '_disabled': () => !node.data.url 248 | }, 249 | 'Rename Title': { 250 | 'separator_before': true, 251 | 'label': 'Rename Title', 252 | 'action': () => dispatchEvent(new Event('properties:select-title')), 253 | '_disabled': () => node.data.drag === false 254 | }, 255 | 'Edit Link': { 256 | 'label': 'Edit Link', 257 | 'action': () => dispatchEvent(new Event('properties:select-link')), 258 | '_disabled': () => !node.data.url 259 | }, 260 | 'Delete Bookmark': { 261 | 'label': 'Delete Bookmark', 262 | 'action': () => document.querySelector('#toolbar [data-cmd="delete"]').click(), 263 | '_disabled': () => node.data.drag === false 264 | }, 265 | 'Validate Bookmark': { 266 | 'separator_before': true, 267 | 'label': 'Search or Validate Bookmarks', 268 | 'action': () => { 269 | const input = document.querySelector('#search input'); 270 | const ids = tree.jstree('get_selected'); 271 | if (ids.length > 1) { 272 | input.value = (node.data.url, 'id:') + ids.join(','); 273 | } 274 | else { 275 | const node = tree.jstree('get_node', ids[0]); 276 | input.value = (node.data.url, node.data.url ? 'id:' : 'root:') + ids.join(',') + ' '; 277 | } 278 | input.dispatchEvent(new Event('search')); 279 | input.focus(); 280 | } 281 | }, 282 | 'Set as Root': { 283 | 'label': 'Set as Root', 284 | 'action': () => { 285 | const ids = tree.jstree('get_selected'); 286 | 287 | if (ids.length === 1) { 288 | localStorage.setItem('root', ids[0]); 289 | location.reload(); 290 | } 291 | else { 292 | notify.inline('Please select a single directory'); 293 | } 294 | }, 295 | '_disabled': () => node.data.url 296 | } 297 | }) 298 | }, 299 | 'sort': function(a, b) { 300 | a = this.get_node(a); 301 | b = this.get_node(b); 302 | 303 | if (a.data.url && !b.data.url) { 304 | return 1; 305 | } 306 | if (b.data.url && !a.data.url) { 307 | return -1; 308 | } 309 | return a.text > b.text ? -1 : 1; 310 | } 311 | }); 312 | 313 | // activate on startup 314 | if (localStorage.getItem('searchfocus') !== 'true') { 315 | tree.one('state_ready.jstree', () => { 316 | tree.activate(); 317 | }); 318 | } 319 | 320 | // open links on dblclick or Enter 321 | { 322 | const dblclick = (node, e = {shiftKey: false}) => { 323 | if (node && node.data && node.data.url && node.data.feed === false) { 324 | const url = node.data.url; 325 | chrome.tabs.query({ 326 | active: true, 327 | currentWindow: true 328 | }, tabs => { 329 | // if current tab is new tab, update it 330 | if (tabs.length && tabs[0].url === 'chrome://newtab/' || tabs[0].url === 'about:newtab' || e.shiftKey) { 331 | chrome.tabs.update({url}); 332 | } 333 | else { 334 | chrome.tabs.create({url}); 335 | } 336 | if (location.search.indexOf('in=') === -1) { 337 | window.close(); 338 | } 339 | }); 340 | } 341 | }; 342 | tree.on('dblclick.jstree', e => { 343 | const ids = tree.jstree('get_selected'); 344 | const node = tree.jstree('get_node', ids[0]); 345 | dblclick(node, e); 346 | }); 347 | // on Enter 348 | tree.on('keydown.tree', e => { 349 | if (e.key !== 'Enter') { 350 | return true; 351 | } 352 | 353 | const selected = tree.jstree('get_selected'); 354 | const current = tree.jstree('get_node', e.target); 355 | 356 | // select the hovered node 357 | if (e.altKey && current.type === 'file') { 358 | return true; 359 | } 360 | 361 | if (current && selected.indexOf(current.id) !== -1) { 362 | dblclick(current); 363 | return false; 364 | } 365 | return true; 366 | }); 367 | } 368 | 369 | tree.on('move_node.jstree copy_node.jstree', (e, data) => { 370 | if (e.type === 'copy_node') { // copy 371 | const b = { 372 | parentId: data.parent, 373 | index: data.position, 374 | title: data.node.text, 375 | url: data.original.data.url 376 | }; 377 | if (!b.url) { // delete URL if not available 378 | delete b.url; 379 | } 380 | chrome.bookmarks.create(b, bookmark => { 381 | const lastError = chrome.runtime.lastError; 382 | if (lastError) { 383 | notify.inline('[Refresh Required] ' + lastError.message); 384 | tree.jstree('delete_node', data.node); 385 | } 386 | else { 387 | // update node 388 | tree.jstree(true).set_id(data.node, bookmark.id); 389 | data.node.data = { 390 | dateGroupModified: bookmark.dateGroupModified, 391 | dateAdded: bookmark.dateAdded, 392 | url: bookmark.url || '' 393 | }; 394 | // repair new created child bookmarks 395 | data.original.children.forEach((id, index) => { 396 | const original = tree.jstree('get_node', id); 397 | const position = tree.jstree('get_node', data.original).children.indexOf(id); 398 | tree.trigger('copy_node.jstree', { 399 | node: tree.jstree('get_node', data.node.children[index]), 400 | original, 401 | parent: bookmark.id, 402 | position 403 | }); 404 | }); 405 | } 406 | }); 407 | } 408 | else { 409 | chrome.bookmarks.move(data.node.id, { 410 | parentId: data.parent, 411 | index: data.position + (data.position > data.old_position ? 1 : 0) 412 | }, () => { 413 | const lastError = chrome.runtime.lastError; 414 | if (lastError) { 415 | notify.inline('[Refresh Required] ' + lastError.message); 416 | } 417 | }); 418 | } 419 | }); 420 | 421 | // do not handle ctrlKey + shiftKey keys 422 | // tree.on('keydown.tree', e => { 423 | // if (e.ctrlKey && e.shiftKey) { 424 | // e.stopImmediatePropagation(); 425 | // return false; 426 | // } 427 | // }); 428 | 429 | addEventListener('tree:open-array', e => { 430 | const arr = e.detail.nodes; 431 | tree.jstree('deselect_all'); 432 | tree.jstree('close_all'); 433 | tree.jstree('close_all', () => { 434 | tree.jstree('load_node', arr.reverse(), () => { 435 | const id = arr[0]; 436 | tree.jstree('select_node', id); 437 | try { 438 | document.getElementById(id + '_anchor').scrollIntoView(); 439 | } 440 | catch (e) {} 441 | }); 442 | }); 443 | }); 444 | 445 | // context menu open 446 | addEventListener('actions:open-links', e => { 447 | const ids = tree.jstree('get_selected'); 448 | const nodes = ids.map(id => tree.jstree('get_node', id)); 449 | 450 | if (e.detail === 'new-tab' || e.detail === 'background-tab') { 451 | chrome.tabs.query({ 452 | active: true, 453 | currentWindow: true 454 | }, ([tab]) => { 455 | nodes.forEach((node, n) => { 456 | if (node.data.url) { 457 | chrome.tabs.create({ 458 | url: node.data.url, 459 | active: e.detail === 'new-tab', 460 | index: tab.index + n + 1 461 | }).catch(e => notify.inline(e.message)); 462 | } 463 | }); 464 | }); 465 | } 466 | else if (e.detail === 'new-window' || e.detail === 'incognito-window') { 467 | chrome.windows.create({ 468 | url: nodes.map(n => n.data.url).filter(s => s), 469 | incognito: e.detail === 'incognito-window', 470 | focused: true 471 | }).catch(e => notify.inline(e.message)); 472 | } 473 | }); 474 | 475 | // theme 476 | { 477 | const dark = () => { 478 | tree.jstree('set_theme', 'default-dark'); 479 | document.documentElement.classList.add('dark'); 480 | }; 481 | const light = () => { 482 | tree.jstree('set_theme', 'default'); 483 | document.documentElement.classList.remove('dark'); 484 | }; 485 | 486 | const run = () => { 487 | const ts = localStorage.getItem('theme-source') || 'auto'; 488 | if (ts === 'auto') { 489 | if (matchMedia('(prefers-color-scheme: dark)').matches) { 490 | return dark(); 491 | } 492 | } 493 | else if (ts === 'dark') { 494 | return dark(); 495 | } 496 | 497 | light(); 498 | }; 499 | run(); 500 | matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => { 501 | run(); 502 | }); 503 | chrome.runtime.onMessage.addListener(request => request.cmd === 'theme-source' && run()); 504 | } 505 | -------------------------------------------------------------------------------- /v3/data/panel/utils.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | 'use strict'; 12 | 13 | const utils = {}; 14 | 15 | utils.copy = text => navigator.clipboard.writeText(text).catch(() => { 16 | document.oncopy = event => { 17 | event.clipboardData.setData('Text', text); 18 | event.preventDefault(); 19 | }; 20 | document.execCommand('Copy'); 21 | document.oncopy = undefined; 22 | }); 23 | 24 | utils.favicon = (() => { 25 | const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1; 26 | return url => { 27 | if (url.startsWith('/')) { 28 | return url; 29 | } 30 | if (url.startsWith('about:') || url.startsWith('chrome') || url.startsWith('moz')) { 31 | return '/data/panel/icons/page.png'; 32 | } 33 | if (isFirefox) { 34 | if (localStorage.getItem('resolve') === 'true') { 35 | return 'http://www.google.com/s2/favicons?domain_url=' + url; 36 | } 37 | else { 38 | return '/data/panel/icons/page.png'; 39 | } 40 | } 41 | return chrome.runtime.getURL('/_favicon?') + 'pageUrl=' + encodeURIComponent(url) + '&size=48'; 42 | }; 43 | })(); 44 | // Firefox only user consent 45 | if ( 46 | navigator.userAgent.indexOf('Firefox') !== -1 && 47 | localStorage.getItem('offer-favicon') !== 'false' && 48 | localStorage.getItem('resolve') !== 'true' 49 | ) { 50 | document.body.dataset.favicon = true; 51 | document.querySelector('.favicon input[type=button]').addEventListener('click', () => { 52 | localStorage.setItem('offer-favicon', false); 53 | document.body.dataset.favicon = false; 54 | }); 55 | document.querySelector('.favicon input[type=checkbox]').addEventListener('change', e => { 56 | localStorage.setItem('resolve', e.target.checked); 57 | }); 58 | } 59 | -------------------------------------------------------------------------------- /v3/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Bookmark Manager and Viewer", 3 | "description": "An elegant bookmark manager with fuzzy search and more", 4 | "version": "0.3.4", 5 | "manifest_version": 3, 6 | "permissions": [ 7 | "storage", 8 | "activeTab", 9 | "bookmarks", 10 | "favicon", 11 | "notifications", 12 | "contextMenus", 13 | "declarativeContent" 14 | ], 15 | "optional_host_permissions": [ 16 | "*://*/*" 17 | ], 18 | "background": { 19 | "service_worker": "worker.js", 20 | "scripts": ["worker.js", "monitor.js", "context.js"] 21 | }, 22 | "action": { 23 | "default_popup": "/data/panel/index.html" 24 | }, 25 | "sidebar_action": { 26 | "default_panel": "/data/panel/index.html?in=sidebar", 27 | "default_icon": { 28 | "16": "/data/icons/16.png", 29 | "32": "/data/icons/32.png", 30 | "48": "/data/icons/48.png", 31 | "64": "/data/icons/64.png", 32 | "128": "/data/icons/128.png" 33 | } 34 | }, 35 | "homepage_url": "https://webextension.org/listing/bookmarks-manager.html", 36 | "icons": { 37 | "16": "/data/icons/16.png", 38 | "32": "/data/icons/32.png", 39 | "48": "/data/icons/48.png", 40 | "64": "/data/icons/64.png", 41 | "128": "/data/icons/128.png", 42 | "256": "/data/icons/256.png", 43 | "512": "/data/icons/512.png" 44 | }, 45 | "options_ui": { 46 | "page": "/data/options/index.html", 47 | "open_in_tab": true 48 | }, 49 | "browser_specific_settings": { 50 | "gecko": { 51 | "id": "{beb1b1c0-32b9-47d8-bbd1-f65bed4e7c22}", 52 | "strict_min_version": "128.0" 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /v3/monitor.js: -------------------------------------------------------------------------------- 1 | if (chrome.declarativeContent === undefined) { // Firefox 2 | const button = { 3 | activate(tabId) { 4 | chrome.action.setIcon({ 5 | tabId, 6 | path: { 7 | '16': '/data/icons/bookmarked/16.png', 8 | '32': '/data/icons/bookmarked/32.png', 9 | '64': '/data/icons/bookmarked/64.png' 10 | } 11 | }, () => chrome.runtime.lastError); 12 | }, 13 | deactivate(tabId) { 14 | chrome.action.setIcon({ 15 | tabId, 16 | path: { 17 | '16': '/data/icons/16.png', 18 | '32': '/data/icons/32.png', 19 | '64': '/data/icons/64.png' 20 | } 21 | }, () => chrome.runtime.lastError); 22 | } 23 | }; 24 | 25 | const search = (url, callback) => { 26 | if (!url || url.startsWith('about:') || url.startsWith('view-source:')) { 27 | return; 28 | } 29 | chrome.bookmarks.search({url}, callback); 30 | }; 31 | 32 | chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { 33 | if (changeInfo.status === 'complete' || changeInfo.url) { 34 | search(tab.url, nodes => { 35 | if (nodes && nodes.length) { 36 | button.activate(tabId); 37 | } 38 | }); 39 | } 40 | }); 41 | 42 | const update = () => { 43 | chrome.tabs.query({}, tabs => tabs.forEach(tab => { 44 | search(tab.url, nodes => { 45 | if (nodes && nodes.length) { 46 | button.activate(tab.id); 47 | } 48 | else { 49 | button.deactivate(tab.id); 50 | } 51 | }); 52 | })); 53 | }; 54 | chrome.bookmarks.onChanged.addListener(update); 55 | chrome.bookmarks.onCreated.addListener(update); 56 | chrome.bookmarks.onRemoved.addListener(update); 57 | update(); 58 | } 59 | else { // Chrome 60 | const image = async url => { 61 | const img = await createImageBitmap(await (await fetch(url)).blob()); 62 | const {width: w, height: h} = img; 63 | const canvas = new OffscreenCanvas(w, h); 64 | const ctx = canvas.getContext('2d'); 65 | ctx.drawImage(img, 0, 0, w, h); 66 | 67 | return ctx.getImageData(0, 0, w, h); 68 | }; 69 | 70 | const once = () => { 71 | if (once.done) { 72 | return; 73 | } 74 | once.done = true; 75 | 76 | chrome.declarativeContent.onPageChanged.removeRules(undefined, async () => { 77 | const action = new chrome.declarativeContent.SetIcon({ 78 | imageData: { 79 | 16: await image('/data/icons/bookmarked/16.png'), 80 | 32: await image('/data/icons/bookmarked/32.png') 81 | } 82 | }); 83 | chrome.declarativeContent.onPageChanged.addRules([{ 84 | conditions: [new chrome.declarativeContent.PageStateMatcher({ 85 | isBookmarked: true 86 | })], 87 | actions: [action] 88 | }]); 89 | }); 90 | }; 91 | chrome.runtime.onInstalled.addListener(once); 92 | chrome.runtime.onStartup.addListener(once); 93 | } 94 | -------------------------------------------------------------------------------- /v3/worker.js: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2022 InBasic 2 | * 3 | * This Source Code Form is subject to the terms of the Mozilla Public 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 | * 7 | * Home: https://webextension.org/listing/bookmarks-manager.html 8 | * GitHub: https://github.com/inbasic/bookmarks-manager/ 9 | */ 10 | 11 | if (typeof importScripts !== 'undefined') { 12 | self.importScripts('monitor.js'); 13 | self.importScripts('context.js'); 14 | } 15 | 16 | self.notify = message => chrome.notifications.create({ 17 | iconUrl: '/data/icons/48.png', 18 | title: chrome.runtime.getManifest().name, 19 | message, 20 | type: 'basic' 21 | }, id => setTimeout(() => chrome.notifications.clear(id), 5000)); 22 | 23 | // mode 24 | { 25 | const once = () => chrome.storage.local.get({ 26 | mode: 'popup' 27 | }, prefs => chrome.action.setPopup({ 28 | popup: prefs.mode === 'popup' ? 'data/panel/index.html' : '' 29 | })); 30 | 31 | chrome.runtime.onInstalled.addListener(once); 32 | chrome.runtime.onStartup.addListener(once); 33 | chrome.storage.onChanged.addListener(prefs => prefs.mode && once()); 34 | } 35 | chrome.action.onClicked.addListener(() => chrome.tabs.create({ 36 | url: '/data/panel/index.html?in=tab' 37 | })); 38 | 39 | /* FAQs & Feedback */ 40 | { 41 | const {management, runtime: {onInstalled, setUninstallURL, getManifest}, storage, tabs} = chrome; 42 | if (navigator.webdriver !== true) { 43 | const {homepage_url: page, name, version} = getManifest(); 44 | onInstalled.addListener(({reason, previousVersion}) => { 45 | management.getSelf(({installType}) => installType === 'normal' && storage.local.get({ 46 | 'faqs': true, 47 | 'last-update': 0 48 | }, prefs => { 49 | if (reason === 'install' || (prefs.faqs && reason === 'update')) { 50 | const doUpdate = (Date.now() - prefs['last-update']) / 1000 / 60 / 60 / 24 > 45; 51 | if (doUpdate && previousVersion !== version) { 52 | tabs.query({active: true, lastFocusedWindow: true}, tbs => tabs.create({ 53 | url: page + '?version=' + version + (previousVersion ? '&p=' + previousVersion : '') + '&type=' + reason, 54 | active: reason === 'install', 55 | ...(tbs && tbs.length && {index: tbs[0].index + 1}) 56 | })); 57 | storage.local.set({'last-update': Date.now()}); 58 | } 59 | } 60 | })); 61 | }); 62 | setUninstallURL(page + '?rd=feedback&name=' + encodeURIComponent(name) + '&version=' + version); 63 | } 64 | } 65 | --------------------------------------------------------------------------------