├── asb-ai ├── README.md ├── manifest.json ├── background.js └── icon.svg ├── clean.sh ├── src ├── images │ ├── add.png │ ├── remove.png │ └── icon.svg ├── manifest.json ├── Separator.js ├── styles.scss ├── popup.html ├── settings.html ├── AutoSortBookmarks.js ├── Item.js ├── AsbUtil.js ├── configure-folders.html ├── popup.jsx ├── Bookmark.js ├── default-prefs.js ├── Folder.js ├── NodeUtil.js ├── ChangeHandler.js ├── settings.jsx ├── FolderUtil.js ├── Annotations.js ├── BrowserUtil.js ├── configure-folders.jsx ├── Comparator.js ├── AsbPrefs.js └── Sorter.js ├── jsconfig.json ├── .gitignore ├── docker-run.sh ├── docker-xpi.sh ├── docker-build.sh ├── package.json ├── Dockerfile ├── .eslintrc ├── genbookmarks.py ├── README.md ├── locales ├── ja │ └── messages.json ├── en │ └── messages.json ├── zh-CN │ └── messages.json ├── sv-SE │ └── messages.json ├── fr │ └── messages.json ├── pt-BR │ └── messages.json └── de │ └── messages.json └── LICENSE /asb-ai/README.md: -------------------------------------------------------------------------------- 1 | # Experiment to use ChatGPT to generate ASB web extension. 2 | -------------------------------------------------------------------------------- /clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -f *.zip *.xpi 4 | rm -rf build/ build-tmp/ 5 | 6 | -------------------------------------------------------------------------------- /src/images/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-bixby/auto-sort-bookmarks-webext/HEAD/src/images/add.png -------------------------------------------------------------------------------- /src/images/remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eric-bixby/auto-sort-bookmarks-webext/HEAD/src/images/remove.png -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es6" 5 | }, 6 | "exclude": ["node_modules"] 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.xpi 2 | *.swp 3 | *.iml 4 | .DS_Store 5 | .idea 6 | bookmarks*.html 7 | test-*.txt 8 | build/** 9 | build-tmp/** 10 | node_modules/** 11 | -------------------------------------------------------------------------------- /docker-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SRC_DIR=/root/auto-sort-bookmarks-webext 4 | 5 | docker run \ 6 | -v $(pwd):${SRC_DIR} \ 7 | -it \ 8 | asb-dev \ 9 | bash 10 | -------------------------------------------------------------------------------- /docker-xpi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SRC_DIR=/root/auto-sort-bookmarks-webext 4 | 5 | docker run \ 6 | -v $(pwd):${SRC_DIR} \ 7 | -t \ 8 | asb-dev \ 9 | bash -c "cd ${SRC_DIR} && ./build_ff.sh" 10 | -------------------------------------------------------------------------------- /docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo Cleaning... 4 | ./clean.sh 5 | docker images -q asb-dev | xargs docker rmi -f 6 | 7 | echo 8 | echo Building image... 9 | docker build -t asb-dev . 10 | 11 | echo 12 | echo Building xpi... 13 | ./docker-xpi.sh 14 | 15 | echo 16 | echo Done. 17 | 18 | -------------------------------------------------------------------------------- /asb-ai/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Bookmark Sorter", 4 | "version": "1.0", 5 | "description": "Automatically sorts bookmarks alphabetically", 6 | "permissions": [ 7 | "bookmarks" 8 | ], 9 | "background": { 10 | "scripts": [ 11 | "background.js" 12 | ], 13 | "persistent": true 14 | }, 15 | "browser_action": { 16 | "default_icon": "icon.svg", 17 | "default_title": "Sort Bookmarks" 18 | } 19 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "@babel/core": "^7.20.5", 4 | "@babel/eslint-parser": "^7.19.1", 5 | "eslint": "^8.29.0", 6 | "eslint-config-airbnb": "^19.0.4", 7 | "eslint-config-prettier": "^8.5.0", 8 | "eslint-plugin-import": "^2.26.0", 9 | "eslint-plugin-jsx-a11y": "^6.6.1", 10 | "eslint-plugin-prettier": "^4.2.1", 11 | "eslint-plugin-react": "^7.31.11", 12 | "eslint-plugin-react-hooks": "^4.6.0", 13 | "jsdoc": "^4.0.0", 14 | "prettier": "^2.8.1" 15 | }, 16 | "dependencies": { 17 | "@types/chrome": "0.0.206", 18 | "@types/firefox-webext-browser": "^94.0.1", 19 | "prop-types": "^15.8.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Install base OS 2 | FROM ubuntu:18.04 3 | 4 | # Replace shell with bash so we can source files (for node setup) 5 | RUN rm /bin/sh && ln -s /bin/bash /bin/sh 6 | 7 | # Install curl 8 | RUN apt update && apt install -y curl 9 | 10 | # Install node and npm (weh requires node 12.x) 11 | RUN curl -sL https://deb.nodesource.com/setup_12.x | bash 12 | RUN apt install -y nodejs 13 | 14 | # Install dependencies (allow root, otherwise, get premission error) 15 | RUN npm i -g --unsafe-perm=true --alow-root \ 16 | web-ext@6.8.0 \ 17 | gulp@4.0.2 \ 18 | weh@2.10.0 19 | 20 | # Apply npm-shrinkwrap to weh 21 | COPY weh-npm-shrinkwrap.json /root/ 22 | RUN cd `npm root -g`/weh \ 23 | && cp /root/weh-npm-shrinkwrap.json ./npm-shrinkwrap.json \ 24 | && npm i 25 | 26 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "Auto-Sort Bookmarks", 4 | "description": "Sort bookmarks by multiple criteria.", 5 | "author": "Eric Bixby", 6 | "version": "3.4.6beta1", 7 | "default_locale": "en", 8 | "icons": { 9 | "48": "images/icon.svg", 10 | "96": "images/icon.svg" 11 | }, 12 | "browser_specific_settings": { 13 | "gecko": { 14 | "id": "sortbookmarks@bouanto", 15 | "strict_min_version": "63.0" 16 | } 17 | }, 18 | "permissions": ["bookmarks", "history", "storage", "tabs"], 19 | "background": { 20 | "scripts": ["AutoSortBookmarks.js"] 21 | }, 22 | "browser_action": { 23 | "default_icon": "images/icon.svg", 24 | "default_title": "Auto-Sort Bookmarks", 25 | "default_popup": "popup.html?panel=main", 26 | "browser_style": true 27 | }, 28 | "options_ui": { 29 | "page": "settings.html?panel=settings", 30 | "open_in_tab": true, 31 | "browser_style": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Separator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import Item from "./Item"; 20 | 21 | /** 22 | * Separator class. 23 | */ 24 | export default class Separator extends Item {} 25 | -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | .asb-popup { 20 | .asb-toolbar { 21 | overflow: hidden; 22 | padding: 8px; 23 | background-color: #eee; 24 | a { 25 | display: inline; 26 | cursor: pointer; 27 | margin: 0 8px; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/settings.html: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/AutoSortBookmarks.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import AsbUtil from "./AsbUtil"; 20 | import Sorter from "./Sorter"; 21 | 22 | /** 23 | * Main entry-point for add-on. 24 | */ 25 | AsbUtil.log("main:begin"); 26 | try { 27 | // eslint-disable-next-line no-unused-vars 28 | const sorter = new Sorter(); 29 | } catch (error) { 30 | console.error(error); 31 | } 32 | AsbUtil.log("main:end"); 33 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@babel/eslint-parser", 3 | "parserOptions": { 4 | "ecmaVersion": 6, 5 | "requireConfigFile": false, 6 | "sourceType": "module", 7 | "ecmaFeatures": { 8 | "jsx": true, 9 | "modules": true, 10 | "experimentalObjectRestSpread": true 11 | }, 12 | "babelOptions": { 13 | "parserOpts": { 14 | "plugins": ["jsx"] 15 | } 16 | } 17 | }, 18 | "plugins": ["prettier", "react"], 19 | "env": { 20 | "browser": true, 21 | "es6": true, 22 | "webextensions": true, 23 | "amd": true 24 | }, 25 | "extends": [ 26 | "airbnb", 27 | "prettier", 28 | "eslint:recommended", 29 | "plugin:react/recommended" 30 | ], 31 | "rules": { 32 | "prettier/prettier": ["error"], 33 | "indent": [ 34 | "error", 35 | 2, 36 | { 37 | "SwitchCase": 1 38 | } 39 | ], 40 | "linebreak-style": ["error", "unix"], 41 | "quotes": ["error", "double"], 42 | "semi": ["error", "always"], 43 | "require-jsdoc": [ 44 | "error", 45 | { 46 | "require": { 47 | "FunctionDeclaration": true, 48 | "MethodDefinition": false, 49 | "ClassDeclaration": false, 50 | "ArrowFunctionExpression": false 51 | } 52 | } 53 | ], 54 | "no-console": "off", 55 | "import/no-unresolved": "off", 56 | "jsx-a11y/anchor-is-valid": 0 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Item.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import BrowserUtil from "./BrowserUtil"; 20 | 21 | /** 22 | * Item class. 23 | */ 24 | export default class Item { 25 | /** 26 | * Creates an instance of Item. 27 | * 28 | * @param {string} id 29 | * @param {number} index 30 | * @param {string} parentId 31 | * @memberof Item 32 | */ 33 | constructor(id, index, parentId) { 34 | this.id = id; 35 | this.setIndex(index); 36 | this.parentId = parentId; 37 | } 38 | 39 | /** 40 | * Save the new index. 41 | * 42 | * @memberof Item 43 | */ 44 | saveIndex() { 45 | return BrowserUtil.moveBookmark(this.id, { index: this.index }); 46 | } 47 | 48 | /** 49 | * Set the new index and save the old index. 50 | * 51 | * @param {int} index The new index. 52 | * @memberof Item 53 | */ 54 | setIndex(index) { 55 | this.oldIndex = this.index || index; 56 | this.index = index; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/AsbUtil.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Class for common functions. 21 | */ 22 | export default class AsbUtil { 23 | /** 24 | * If enabled, send message to console for debugging. 25 | * 26 | * @param {*} o Message to display on console. 27 | */ 28 | static log(o) { 29 | console.log(o); 30 | } 31 | 32 | /** 33 | * Reverse the base of an URL for better sorting. 34 | * 35 | * @param str The URL to be reversed. 36 | * @returns {*} The reversed URL. 37 | */ 38 | static reverseBaseUrl(str) { 39 | if (!str) { 40 | return ""; 41 | } 42 | 43 | let retVal = str.replace(/^\S+:\/\//, ""); 44 | const re = /^[^/]+$|^[^/]+/; 45 | const m = re.exec(retVal); 46 | 47 | if (m !== null) { 48 | if (m.index === re.lastIndex) { 49 | re.lastIndex += 1; 50 | } 51 | 52 | // Replace the found string by it's reversion 53 | retVal = retVal.replace(m[0], m[0].split(".").reverse().join(".")); 54 | } 55 | 56 | return retVal; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/configure-folders.html: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 60 | 61 | 62 | 63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/popup.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import React from "react"; 20 | import { render } from "react-dom"; 21 | import PropTypes from "prop-types"; 22 | import weh from "weh-content"; 23 | 24 | class Link extends React.Component { 25 | constructor(props) { 26 | super(props); 27 | this.handleClick = this.handleClick.bind(this); 28 | } 29 | 30 | handleClick() { 31 | const { messageCall } = this.props; 32 | this.weh.rpc.call({ messageCall }); 33 | } 34 | 35 | render() { 36 | const { label } = this.props; 37 | return ( 38 | 41 | ); 42 | } 43 | } 44 | 45 | Link.propTypes = { 46 | messageCall: PropTypes.string.isRequired, 47 | label: PropTypes.string.isRequired, 48 | }; 49 | 50 | render( 51 |
52 |
53 | 54 | 55 | 56 |
57 |
, 58 | document.getElementById("root") 59 | ); 60 | -------------------------------------------------------------------------------- /src/Bookmark.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import AsbUtil from "./AsbUtil"; 20 | import Item from "./Item"; 21 | 22 | /** 23 | * Bookmark class. 24 | */ 25 | export default class Bookmark extends Item { 26 | /** 27 | * Get a bookmark. 28 | * 29 | * @param {string} id The bookmark identifier. 30 | * @param {int} index The bookmark position. 31 | * @param {string} parentId The bookmark parent identifier. 32 | * @param {string} title The bookmark title. 33 | * @param {int} dateAdded The timestamp of the date added. 34 | * @param {int} lastModified The timestamp of the last modified date. 35 | * @param {string} url The item URL. 36 | * @param {int} lastVisited The timestamp of the last visit. 37 | * @param {int} accessCount The access count. 38 | */ 39 | constructor( 40 | id, 41 | index, 42 | parentId, 43 | title, 44 | dateAdded, 45 | lastModified, 46 | url, 47 | lastVisited, 48 | accessCount 49 | ) { 50 | super(id, index, parentId); 51 | 52 | if ( 53 | title === null || 54 | dateAdded === null || 55 | lastModified === null || 56 | url === null || 57 | lastVisited === null || 58 | accessCount === null 59 | ) { 60 | AsbUtil.log( 61 | `ERROR: Corrupted bookmark found. ID: ${id} - Title: ${title} - URL: ${url}` 62 | ); 63 | this.corrupted = true; 64 | } 65 | 66 | this.title = title || ""; 67 | this.url = url || ""; 68 | this.lastVisited = lastVisited || 0; 69 | this.accessCount = accessCount || 0; 70 | this.dateAdded = dateAdded || 0; 71 | this.lastModified = lastModified || 0; 72 | this.order = AsbPrefs.getPref("bookmark_sort_order"); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/default-prefs.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Default properties. 21 | */ 22 | export default [ 23 | { 24 | name: "auto_sort", 25 | type: "boolean", 26 | defaultValue: false, 27 | }, 28 | { 29 | name: "delay", 30 | type: "integer", 31 | defaultValue: 3, 32 | minimum: 3, 33 | maximum: 255, 34 | }, 35 | { 36 | name: "case_insensitive", 37 | type: "boolean", 38 | defaultValue: false, 39 | }, 40 | { 41 | name: "sort_by", 42 | type: "choice", 43 | defaultValue: "title", 44 | choices: [ 45 | "title", 46 | "url", 47 | "dateAdded", 48 | "lastModified", 49 | "lastVisited", 50 | "accessCount", 51 | "revurl", 52 | "hostname", 53 | ], 54 | }, 55 | { 56 | name: "inverse", 57 | type: "boolean", 58 | defaultValue: false, 59 | }, 60 | { 61 | name: "then_sort_by", 62 | type: "choice", 63 | defaultValue: "none", 64 | choices: [ 65 | "none", 66 | "title", 67 | "url", 68 | "dateAdded", 69 | "lastModified", 70 | "lastVisited", 71 | "accessCount", 72 | "revurl", 73 | "hostname", 74 | ], 75 | }, 76 | { 77 | name: "then_inverse", 78 | type: "boolean", 79 | defaultValue: false, 80 | }, 81 | { 82 | name: "folder_sort_by", 83 | type: "choice", 84 | defaultValue: "title", 85 | choices: ["none", "title"], 86 | }, 87 | { 88 | name: "folder_inverse", 89 | type: "boolean", 90 | defaultValue: false, 91 | }, 92 | { 93 | name: "folder_sort_order", 94 | type: "integer", 95 | defaultValue: 1, 96 | minimum: 1, 97 | maximum: 2, 98 | }, 99 | { 100 | name: "bookmark_sort_order", 101 | type: "integer", 102 | defaultValue: 2, 103 | minimum: 1, 104 | maximum: 2, 105 | }, 106 | ]; 107 | -------------------------------------------------------------------------------- /genbookmarks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | """ 4 | genbookmarks.py 5 | 6 | Haskell version: 7 | http://codereview.stackexchange.com/questions/101621/netscape-bookmark-file-generator 8 | Copyright (C) 2015 Boucher, Antoni 9 | 10 | Python version: 11 | Copyright (C) 2016-2022 Eric Bixby 12 | 13 | This program is free software: you can redistribute it and/or modify 14 | it under the terms of the GNU General Public License as published by 15 | the Free Software Foundation, either version 3 of the License, or 16 | (at your option) any later version. 17 | 18 | This program is distributed in the hope that it will be useful, 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | GNU General Public License for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with this program. If not, see . 25 | """ 26 | 27 | import sys 28 | import argparse 29 | import random 30 | import string 31 | 32 | 33 | def generateFileContent(outputFile, dirCount, linkCount): 34 | f = open(outputFile, "w") 35 | f.write("\n") 36 | f.write("\n") 37 | f.write("Bookmarks\n") 38 | f.write("

Bookmarks Menu

\n") 39 | f.write("\n") 40 | f.write("

\n") 41 | f.write(generateBookmarks(dirCount, linkCount)) 42 | f.write("

\n") 43 | f.close() 44 | 45 | 46 | def generateBookmarks(dirCount, linkCount): 47 | result = "" 48 | for d in range(0, dirCount): 49 | directoryName = generateName() 50 | result += "

" \ 51 | + directoryName \ 52 | + "

\n" \ 53 | + "

\n" 54 | for b in range(0, linkCount): 55 | bookmarkName = generateName() 56 | result += "

" \ 59 | + bookmarkName \ 60 | + "\n" 61 | result += "

\n" 62 | return result 63 | 64 | 65 | def generateName(): 66 | return ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(10)) 67 | 68 | 69 | def main(argv): 70 | parser = argparse.ArgumentParser() 71 | parser.add_argument("outputfile", help="output filename") 72 | parser.add_argument("--dircount", type=int, 73 | help="number of directories to generate", default=10) 74 | parser.add_argument("--linkcount", type=int, 75 | help="number of bookmarks to generate per directory", default=10) 76 | args = parser.parse_args() 77 | generateFileContent(args.outputfile, args.dircount, args.linkcount) 78 | 79 | 80 | if __name__ == "__main__": 81 | main(sys.argv[1:]) 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [Auto-Sort Bookmarks](https://addons.mozilla.org/en-US/firefox/addon/auto-sort-bookmarks/) 3 | ================== 4 | 5 | [](https://addons.mozilla.org/firefox/addon/auto-sort-bookmarks/reviews/) 6 | [](https://addons.mozilla.org/firefox/addon/auto-sort-bookmarks/statistics) 7 | [](https://github.com/eric-bixby/auto-sort-bookmarks-webext/releases) 8 | [](https://github.com/eric-bixby/auto-sort-bookmarks-webext/blob/master/LICENSE) 9 | 10 | Firefox add-on that sorts bookmarks by multiple criteria. 11 | 12 | --- 13 | 14 | **Settings:** 15 | 16 | - **Auto-sort:** If this option is enabled, the bookmarks will be sorted when bookmarks are added, changed, moved or deleted. 17 | - **Inactivity Wait:** Specifies how long to wait (in seconds) for inactivity before sorting bookmarks. This applies to automatic and manual sorting. A minimum value of 3 and a maximum of 255. Recommend using a value of at least 45 if you move bookmarks by dragging. 18 | - **Case Insensitive:** If this option is enabled, the bookmarks will be sorted without considering the letter case. 19 | - **Sort By:** Specifies the first sort criteria to sort the bookmarks. 20 | - **Inverse Order:** if this option is enabled, the order specified in 'Sort By' will be reversed. So the order will be descending. 21 | - **Then Sort By:** Specifies the second sort criteria to sort the bookmarks. 22 | - **Inverse Second Order:** If this option is enabled, the order specified in 'Then Sort By' will be reversed. 23 | - **Sort Folder By:** Specifies sort criteria to sort folders. 24 | - **Inverse Folder Order:** If this option is enabled, the order specified in 'Sort Folder By' will be reversed. 25 | - **Folder Sort Order:** Specifies the folder sort order. A minimum value of 1 and a maximum of 2. 26 | - **Bookmark Sort Order:** Specifies the bookmark sort order. A minimum value of 1 and a maximum of 2. 27 | - **Configure Folders:** This button opens a new tab allowing you to exclude folders when sorting. If you uncheck the checkbox next to a folder, it won't be sorted, but the children folders will be sorted. If you want to exclude a folder recursively from being sorted, check the recursive checkbox. 28 | 29 | **Backup your current bookmarks** in case you do not like the new bookmarks order. To restore bookmarks, use Firefox's Bookmark Manager (click on Bookmarks menu, select Show All Bookmarks, then click on "Z" icon, select Restore, and select restore point based on date/time). 30 | 31 | **Reviewers:** Your constructive feedback is appreciated. However, if you need technical support, discover a bug, or have a feature request, then [write an issue](https://github.com/eric-bixby/auto-sort-bookmarks-webext/issues) on the support site. 32 | 33 | --- 34 | 35 | **[Version History/Releases](https://github.com/eric-bixby/auto-sort-bookmarks-webext/releases)** 36 | -------------------------------------------------------------------------------- /src/Folder.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /* eslint-disable no-param-reassign */ 20 | 21 | import Bookmark from "./Bookmark"; 22 | 23 | /** 24 | * Folder class. 25 | */ 26 | export default class Folder extends Bookmark { 27 | /** 28 | * Get a folder. 29 | * 30 | * @param {string} id The folder identifier. 31 | * @param {int} index The folder position. 32 | * @param {string} parentId The folder parent identifier. 33 | * @param {string} title The folder title. 34 | * @param {int} dateAdded The timestamp of the date added. 35 | * @param {int} lastModified The timestamp of the last modified date. 36 | */ 37 | constructor(id, index, parentId, title, dateAdded, lastModified) { 38 | super(id, index, parentId, title, dateAdded, lastModified); 39 | 40 | this.order = AsbPrefs.getPref("folder_sort_order"); 41 | } 42 | 43 | /** 44 | * Check if this folder can be sorted. 45 | * 46 | * @returns {boolean} Whether it can be sorted or not. 47 | */ 48 | canBeSorted() { 49 | if ( 50 | Annotations.hasDoNotSortAnnotation(this.id) || 51 | Annotations.isRecursivelyExcluded(this.id) 52 | ) { 53 | return false; 54 | } 55 | return !this.isRoot(); 56 | } 57 | 58 | /** 59 | * Check if this folder is the root folder. 60 | * 61 | * @returns {boolean} Whether this is a root folder or not. 62 | */ 63 | isRoot() { 64 | return this.id === AsbPrefs.getRootId(); 65 | } 66 | 67 | /** 68 | * Check if at least one children has moved. 69 | * 70 | * @returns {boolean} Whether at least one children has moved or not. 71 | */ 72 | hasMove() { 73 | for (let i = 0; i < this.children.length; i += 1) { 74 | const { length } = this.children[i]; 75 | for (let j = 0; j < length; j += 1) { 76 | if (this.children[i][j].index !== this.children[i][j].oldIndex) { 77 | return true; 78 | } 79 | } 80 | } 81 | 82 | return false; 83 | } 84 | 85 | /** 86 | * Save the new children positions. 87 | */ 88 | save(resolve) { 89 | if (this.hasMove()) { 90 | const promiseAry = []; 91 | 92 | for (let i = 0; i < this.children.length; i += 1) { 93 | const { length } = this.children[i]; 94 | for (let j = 0; j < length; j += 1) { 95 | const p = this.children[i][j].saveIndex(); 96 | promiseAry.push(p); 97 | } 98 | } 99 | 100 | Promise.all(promiseAry).then(() => { 101 | if (typeof resolve === "function") { 102 | resolve(); 103 | } 104 | }); 105 | } else if (typeof resolve === "function") { 106 | resolve(); 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/NodeUtil.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import Bookmark from "./Bookmark"; 20 | import Folder from "./Folder"; 21 | import Separator from "./Separator"; 22 | 23 | /** 24 | * Class for creating a Bookmark, Folder, or Separator from a BookmarkTreeNode. 25 | */ 26 | export default class NodeUtil { 27 | /** 28 | * Get the type of node. 29 | * 30 | * @param {bookmarks.BookmarkTreeNode} node Node to check. 31 | * @returns Type of node. 32 | */ 33 | static getNodeType(node) { 34 | let type = "bookmark"; 35 | 36 | if (typeof node.url === "undefined") { 37 | type = "folder"; 38 | } else if (node.url === "data:") { 39 | type = "separator"; 40 | } 41 | 42 | return type; 43 | } 44 | 45 | /** 46 | * Create an item from the `type`. 47 | * 48 | * @param {string} type The item type. 49 | * @param {string} id The item ID. 50 | * @param {int} index The item index. 51 | * @param {string} parentId The parent ID. 52 | * @param {string} title The item title. 53 | * @param {string} url The item URL. 54 | * @param {int} lastVisited The timestamp of the last visit. 55 | * @param {int} accessCount The access count. 56 | * @param {int} dateAdded The timestamp of the date added. 57 | * @param {int} lastModified The timestamp of the last modified date. 58 | * @returns {*} The new item. 59 | */ 60 | static createItem( 61 | type, 62 | id, 63 | index, 64 | parentId, 65 | title, 66 | url, 67 | lastVisited, 68 | accessCount, 69 | dateAdded, 70 | lastModified 71 | ) { 72 | let item; 73 | 74 | if (type === "bookmark") { 75 | item = new Bookmark( 76 | id, 77 | index, 78 | parentId, 79 | title, 80 | dateAdded, 81 | lastModified, 82 | url, 83 | lastVisited, 84 | accessCount 85 | ); 86 | } else if (type === "folder") { 87 | item = new Folder(id, index, parentId, title, dateAdded, lastModified); 88 | } else if (type === "separator") { 89 | item = new Separator(id, index, parentId); 90 | } 91 | 92 | return item; 93 | } 94 | 95 | /** 96 | * Create an item from the `node` type. 97 | * 98 | * @param {bookmarks.BookmarkTreeNode} node The node item. 99 | * @returns {Item} The new item. 100 | */ 101 | static createItemFromNode(node) { 102 | return NodeUtil.createItem( 103 | NodeUtil.getNodeType(node), 104 | node.id, 105 | node.index, 106 | node.parentId, 107 | node.title, 108 | node.url, 109 | node.lastVisited, 110 | node.accessCount, 111 | node.dateAdded, 112 | node.dateGroupModified 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/ChangeHandler.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import AsbUtil from "./AsbUtil"; 20 | import BrowserUtil from "./BrowserUtil"; 21 | 22 | /** 23 | * Class for handling bookmark changes. 24 | */ 25 | export default class ChangeHandler { 26 | /** 27 | * Creates an instance of ChangeHandler. 28 | * 29 | * @memberof ChangeHandler 30 | */ 31 | constructor(sorter) { 32 | this.sorter = sorter; 33 | this.createChangeListeners(); 34 | } 35 | 36 | /** 37 | * Changed event handler. 38 | * 39 | * @param {any} id 40 | * @param {any} changeInfo 41 | * @memberof ChangeHandler 42 | */ 43 | handleChanged(id, changeInfo) { 44 | AsbUtil.log(`onChanged: ${id}`); 45 | AsbUtil.log(changeInfo); 46 | this.sorter.sortIfAuto(); 47 | } 48 | 49 | /** 50 | * Created event handler. 51 | * 52 | * @param {any} id 53 | * @param {any} bookmark 54 | * @memberof ChangeHandler 55 | */ 56 | handleCreated(id, bookmark) { 57 | AsbUtil.log(`onCreated: ${id}`); 58 | AsbUtil.log(bookmark); 59 | this.sorter.sortIfAuto(); 60 | } 61 | 62 | /** 63 | * Moved event handler. 64 | * 65 | * @param {any} id 66 | * @param {any} moveInfo 67 | * @memberof ChangeHandler 68 | */ 69 | handleMoved(id, moveInfo) { 70 | AsbUtil.log(`onMoved: ${id}`); 71 | AsbUtil.log(moveInfo); 72 | this.sorter.sortIfAuto(); 73 | } 74 | 75 | /** 76 | * Removed event handler. 77 | * 78 | * @param {any} id 79 | * @param {any} removeInfo 80 | * @memberof ChangeHandler 81 | */ 82 | handleRemoved(id, removeInfo) { 83 | AsbUtil.log(`onRemoved: ${id}`); 84 | AsbUtil.log(removeInfo); 85 | if (this.sorter.getNodeType(removeInfo.node) === "separator") { 86 | this.sorter.sortIfAuto(); 87 | } else if (this.sorter.getNodeType(removeInfo.node) === "folder") { 88 | AsbPrefs.removeFolder(id); 89 | } 90 | } 91 | 92 | /** 93 | * Visited event handler. 94 | * 95 | * @param {any} historyItem 96 | * @memberof ChangeHandler 97 | */ 98 | handleVisited(historyItem) { 99 | AsbUtil.log("onVisited"); 100 | AsbUtil.log(historyItem); 101 | if (!historyItem.url.startsWith("moz-extension:")) { 102 | this.sorter.sortIfAuto(); 103 | } 104 | } 105 | 106 | /** 107 | * Add listeners. 108 | * 109 | * @memberof ChangeHandler 110 | */ 111 | createChangeListeners() { 112 | BrowserUtil.addBookmarkChangedListener(this.handleChanged); 113 | BrowserUtil.addBookmarkCreatedListener(this.handleCreated); 114 | BrowserUtil.addBookmarkMovedListener(this.handleMoved); 115 | BrowserUtil.addBookmarkRemovedListener(this.handleRemoved); 116 | BrowserUtil.addHistoryVistedListener(this.handleVisited); 117 | AsbUtil.log("added listeners"); 118 | } 119 | 120 | /** 121 | * Remove listeners. 122 | * 123 | * @memberof ChangeHandler 124 | */ 125 | removeChangeListeners() { 126 | BrowserUtil.removeBookmarkChangedListener(this.handleChanged); 127 | BrowserUtil.removeBookmarkCreatedListener(this.handleCreated); 128 | BrowserUtil.removeBookmarkMovedListener(this.handleMoved); 129 | BrowserUtil.removeBookmarkRemovedListener(this.handleRemoved); 130 | BrowserUtil.removeHistoryVistedListener(this.handleVisited); 131 | AsbUtil.log("removed listeners"); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /src/settings.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import React from "react"; 20 | import { render } from "react-dom"; 21 | import { Provider } from "react-redux"; 22 | import { applyMiddleware, createStore, combineReducers } from "redux"; 23 | import { 24 | reducer as prefsSettingsReducer, 25 | App as PrefsSettingsApp, 26 | WehParam, 27 | WehPrefsControls, 28 | listenPrefs, 29 | } from "react/weh-prefs-settings"; 30 | import logger from "redux-logger"; 31 | import WehHeader from "react/weh-header"; 32 | import weh from "weh-content"; 33 | import PropTypes from "prop-types"; 34 | 35 | const reducers = combineReducers({ 36 | prefs: prefsSettingsReducer, 37 | }); 38 | 39 | const store = createStore(reducers, applyMiddleware(logger)); 40 | 41 | listenPrefs(store); 42 | 43 | /** 44 | * Open tab for configure folders. 45 | */ 46 | function openConfigureFolders() { 47 | weh.rpc.call("openConfigureFolders"); 48 | } 49 | 50 | /** 51 | * Render controls. 52 | */ 53 | function RenderControls({ cancel, reset, save, flags }) { 54 | return ( 55 |

56 |
57 | 64 |
65 |
66 | 75 | 84 | 93 |
94 |
95 | ); 96 | } 97 | 98 | RenderControls.propTypes = { 99 | cancel: PropTypes.func.isRequired, 100 | reset: PropTypes.func.isRequired, 101 | save: PropTypes.func.isRequired, 102 | // eslint-disable-next-line react/forbid-prop-types 103 | flags: PropTypes.object.isRequired, 104 | }; 105 | 106 | weh.setPageTitle(weh._("settings")); 107 | 108 | render( 109 | 110 | 111 | 112 |
113 |
114 |
115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 |
128 |
129 |
130 |
131 | 132 |
133 |
134 |
, 135 | document.getElementById("root") 136 | ); 137 | -------------------------------------------------------------------------------- /locales/ja/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "取り消す" 4 | }, 5 | "configure_folders": { 6 | "message": "フォルダの設定" 7 | }, 8 | "default": { 9 | "message": "Default(規定)" 10 | }, 11 | "folders_to_sort": { 12 | "message": "ソートするフォルダ:" 13 | }, 14 | "loading": { 15 | "message": "読み込み中..." 16 | }, 17 | "recursive": { 18 | "message": "再帰的" 19 | }, 20 | "save": { 21 | "message": "保存" 22 | }, 23 | "settings": { 24 | "message": "設定" 25 | }, 26 | "sort": { 27 | "message": "ソート" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "サブフォルダは再帰的に除外されます." 31 | }, 32 | "title": { 33 | "message": "ブックマークを自動ソートする" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "並べ替え時に除外するフォルダのチェックを外します。" 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "このオプションを有効にすると、ブックマークが追加、変更、移動、削除されたときにブックマークがソートされます。" 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "ブックマークのソート順を指定します。最小値 1、最大値 2。" 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "このオプションを有効にすると、大文字と小文字を区別せずにブックマークがソートされます。" 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "ブックマークをソートする前に非アクティブの遅延時間を秒単位で指定します。これは自動ソートと手動ソートに適用されます。最小値は3、最大値は255です。ドラッグしてブックマークを移動する場合は、少なくとも45の値を使用することをお勧めします。" 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "このオプションを有効にすると、[フォルダのソート順]で指定した順序が逆になります。" 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "フォルダをソートするためのソート基準を指定します。" 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "フォルダの並び順を指定します。 最小値 1、最大値 2。" 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "このオプションを有効にすると、[並べ替え]で指定した順序が逆になります。そのため、順序は降順になります。" 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "ブックマークをソートするための最初のソート基準を指定します。" 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "このオプションを有効にすると、[ソート順]で指定した順序が逆になります。" 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "ブックマークをソートするための第二のソート順ソート基準を指定します。" 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "無し" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "タイトル" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "自動ソート:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "ブックマークのソート順:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "大文字と小文字を区別しない:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "ソートまでの遅延時間:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "フォルダの順序を逆にする:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "フォルダのソート順:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "フォルダの並び順:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "逆順:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "ソート順:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "2番目の順序を逆にする:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "第二のソート順:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "訪問回数" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "追加された日付" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "ホスト名" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "最終更新日時" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "最終訪問日時" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "URL の逆順" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "タイトル" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "訪問回数" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "追加された日付" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "ホスト名" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "最終更新日時" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "最終訪問日時" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "無し" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "URL の逆順" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "タイトル" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Cancel" 4 | }, 5 | "configure_folders": { 6 | "message": "Configure Folders" 7 | }, 8 | "default": { 9 | "message": "Default" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Folders to Sort:" 13 | }, 14 | "loading": { 15 | "message": "Loading..." 16 | }, 17 | "recursive": { 18 | "message": "Recursive" 19 | }, 20 | "save": { 21 | "message": "Save" 22 | }, 23 | "settings": { 24 | "message": "Settings" 25 | }, 26 | "sort": { 27 | "message": "Sort" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "The sub-folders are recursively excluded." 31 | }, 32 | "title": { 33 | "message": "Auto-Sort Bookmarks" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Uncheck the folders to exclude when sorting." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "If this option is enabled, the bookmarks will be sorted when bookmarks are added, changed, moved or deleted. This means you cannot move any bookmarks in the same folder, unless it is moved over a separator." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Specifies the bookmark sort order. Minimum value of 1 and maximum of 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "If this option is enabled, the bookmarks will be sorted without considering the letter case." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Specifies how long to wait (in seconds) for inactivity before sorting bookmarks. This applies to automatic and manual sorting. Minimum value of 3 and maximum of 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "If this option is enabled, the order specified in 'Sort Folder By' will be reversed." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Specifies a sort criteria to sort folders." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Specifies the folder sort order. Minimum value of 1 and maximum of 2." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "if this option is enabled, the order specified in 'Sort By' will be reversed. So the order will be descending." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Specifies the first sort criteria to sort the bookmarks." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "If this option is enabled, the order specified in 'Then Sort By' will be reversed." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Specifies the second sort criteria to sort the bookmarks." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "None" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Title" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Auto-sort:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Bookmark Sort Order:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Case Insensitive:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Inactivity Wait:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Inverse Folder Order:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Sort Folder By:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Folder Sort Order:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Inverse Order:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Sort By:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "Inverse Second Order:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Then Sort By:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Access Count" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Date Added" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Host Name" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Last Modified" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Last Visited" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "Reverse URL" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Title" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Access Count" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Date Added" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Host Name" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Last Modified" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Last Visited" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "None" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "Reverse URL" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Title" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /locales/zh-CN/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Cancel" 4 | }, 5 | "configure_folders": { 6 | "message": "Configure Folders" 7 | }, 8 | "default": { 9 | "message": "Default" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Folders to Sort:" 13 | }, 14 | "loading": { 15 | "message": "Loading..." 16 | }, 17 | "recursive": { 18 | "message": "Recursive" 19 | }, 20 | "save": { 21 | "message": "Save" 22 | }, 23 | "settings": { 24 | "message": "Settings" 25 | }, 26 | "sort": { 27 | "message": "Sort" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "The sub-folders are recursively excluded." 31 | }, 32 | "title": { 33 | "message": "Auto-Sort Bookmarks" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Uncheck the folders to exclude when sorting." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "If this option is enabled, the bookmarks will be sorted when bookmarks are added, changed, moved or deleted. This means you cannot move any bookmarks in the same folder, unless it is moved over a separator." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Specifies the bookmark sort order. Minimum value of 1 and maximum of 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "If this option is enabled, the bookmarks will be sorted without considering the letter case." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Specifies how long to wait (in seconds) for inactivity before sorting bookmarks. This applies to automatic and manual sorting. Minimum value of 3 and maximum of 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "If this option is enabled, the order specified in 'Sort Folder By' will be reversed." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Specifies a sort criteria to sort folders." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Specifies the folder sort order. Minimum value of 1 and maximum of 2." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "if this option is enabled, the order specified in 'Sort By' will be reversed. So the order will be descending." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Specifies the first sort criteria to sort the bookmarks." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "If this option is enabled, the order specified in 'Then Sort By' will be reversed." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Specifies the second sort criteria to sort the bookmarks." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "None" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Title" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Auto-sort:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Bookmark Sort Order:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Case Insensitive:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Inactivity Wait:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Inverse Folder Order:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Sort Folder By:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Folder Sort Order:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Inverse Order:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Sort By:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "Inverse Second Order:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Then Sort By:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Access Count" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Date Added" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Host Name" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Last Modified" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Last Visited" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "Reverse URL" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Title" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Access Count" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Date Added" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Host Name" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Last Modified" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Last Visited" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "None" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "Reverse URL" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Title" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /locales/sv-SE/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Avbryt" 4 | }, 5 | "configure_folders": { 6 | "message": "Konfigurera mappar" 7 | }, 8 | "default": { 9 | "message": "Standard" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Mappar att sortera:" 13 | }, 14 | "loading": { 15 | "message": "Laddar..." 16 | }, 17 | "recursive": { 18 | "message": "Rekursivt" 19 | }, 20 | "save": { 21 | "message": "Spara" 22 | }, 23 | "settings": { 24 | "message": "Inställningar" 25 | }, 26 | "sort": { 27 | "message": "Sortera" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "Undermapparna är rekursivt uteslutna." 31 | }, 32 | "title": { 33 | "message": "Sortera bookmärken automatiskt" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Avmarkera mapparna för att uteslutas vid sortering." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "Om det här alternativet är aktiverat kommer bormärkena att sorteras när de läggs till, ändras, flyttas eller tas bort. Detta betyder att du inte kan flytta ett bokmärke i samma mapp, om den inte flyttas över en avskiljare." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Specifies the bookmark sort order. Minimum value of 1 and maximum of 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "Om det här alternativet är aktiverat kommer bokmärkena sorteras utan hänsyn till skiftläget." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Anger väntetiden (i sekunder) innan bokmärkena sorteras. Detta gäller automatisk och manuell sortering. Minsta värdet är 3 och högsta är 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "Om det här alternativet är aktiverat kommer sorteringsordningen i 'Sortera mappar efter' att bli omvänd." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Anger sorteringskriterier för sortering av mappar." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Anger mappsorteringsordningen. Minsta värdet av 1 och högsta av 2." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "Om det här alternativet är aktiverat kommer sorteringsordningen i 'Sortera efter' att bli omvänd. Så ordningen kommer att bli fallande." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Anger den första sorteringsordningen för bokmärken." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "Om det här alternativet är aktiverat kommer sorteringsordningen i 'Sortera sen efter' att bli omvänd." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Anger den andra sorteringsordningen för bokmärken." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "Ingen" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Titel" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Sortera automatiskt:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Sorteringsordning av bokmärken:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Skiftlägesokänsliga:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Inaktivitetsfördröjning:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Omvänd mappordning:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Sortera mapp efter:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Mappsorteringsordning:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Omvänd ordning:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Sortera efter:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "Omvänd sekundär ordning:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Sortera sen efter:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Besöksantal" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Tilläggsdatum" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Värdnamn" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Senast ändrad" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Senast besökta" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "Omvänd webbadress" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Titel" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "Webbadress" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Besöksantal" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Tilläggsdatum" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Värdnamn" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Senast ändrad" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Senast besökta" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "Ingen" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "Omvänd webbadress" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Titel" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "Webbadress" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /locales/fr/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Annuler" 4 | }, 5 | "configure_folders": { 6 | "message": "Configurer les répertoires" 7 | }, 8 | "default": { 9 | "message": "Par défaut" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Répertoires à trier:" 13 | }, 14 | "loading": { 15 | "message": "Chargement..." 16 | }, 17 | "recursive": { 18 | "message": "Récursif" 19 | }, 20 | "save": { 21 | "message": "Sauver" 22 | }, 23 | "settings": { 24 | "message": "Paramètres" 25 | }, 26 | "sort": { 27 | "message": "Trier" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "Les sous-répertoires sont récursivement exclus." 31 | }, 32 | "title": { 33 | "message": "Trier les marque-pages automatiquement" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Désélectionner les fichiers pour les exclure du tri." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "Si ce choix est validé, le tri se fera lorsque que des marque-pages seront ajoutés, déplacés ou supprimés. Cela signifie que vous ne pourrez déplacer un marque-page dans le même répertoire, uniquement dans un répertoire distinct." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Spécifier l'ordre du tri des marque-pages. Valeur minimum 1 et maximum 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "Si ce choix est validé, les marque-pages seront triés sans distinction de la casse." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Spécifier le temps (en secondes) d'inactivité avant de trier les marque-pages. Ceci s'applique aux tris automatiques et manuels. Valeur minimum 3 et maximum 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "Si ce choix est validé, l'ordre spécifié dans 'Trier les répertoires par' sera inversé." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Spécifier un critère de tri pour classer les répertoires." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Spécifier l'ordre de tri des répertoires. Valeur minimum 1 et maximum 2." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "Si ce choix est validé, l'ordre spécifié dans 'Trier par' sera inversé." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Spécifier le premier critère de tri pour classer les marque-pages." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "Si ce choix est validé, l'ordre spécifié dans 'Puis trier par' sera inversé." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Spécifier le second critère de choix pour trier les marque-pages." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "Aucun" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Titre" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Tri-automatique:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Ordre de tri des marque-pages:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Insensible à la casse:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Temps d'inactivité:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Inverser l'ordre des répertoires:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Trier les répertoires par:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Ordre de tri des répertoires:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Inverser l'ordre:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Trier par:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "Inverser le second critère de tri:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Puis trier par:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Nombre d'accès" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Date ajoutée" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Nom d'hôte" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Derniers modifiés" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Derniers visités" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "Inverser l'URL" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Titre" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Nombre d'accès" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Date ajoutée" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Nom d'hôte" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Derniers modifiés" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Derniers visités" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "Aucun" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "Inverser l'URL" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Titre" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /locales/pt-BR/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Cancelar" 4 | }, 5 | "configure_folders": { 6 | "message": "Configurar Pastas" 7 | }, 8 | "default": { 9 | "message": "Padrão" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Pastas pra Organizar:" 13 | }, 14 | "loading": { 15 | "message": "Carregando..." 16 | }, 17 | "recursive": { 18 | "message": "Recursivo" 19 | }, 20 | "save": { 21 | "message": "Salvar" 22 | }, 23 | "settings": { 24 | "message": "Configurações" 25 | }, 26 | "sort": { 27 | "message": "Organizar" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "As sub-pastas estão excluídas recursivamente." 31 | }, 32 | "title": { 33 | "message": "Auto-Organizar Favoritos" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Remover a seleção das pastas a excluir quando organizar." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "Se esta opção estiver ativada os favoritos serão organizados quando os favoritos são adicionados, mudados ou apagados. Isto significa que você não pode mover quaisquer favoritos na mesma pasta a menos que seja movida sobre um separador." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Especifica a ordem de organização dos favoritos. Valor mínimo de 1 e máximo de 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "Se esta opção estiver ativada os favoritos serão organizados sem considerar o tamanho da letra." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Especifica quanto tempo esperar (em segundos) por inatividade antes de organizar os favoritos. Isto se aplica a organização automática e manual. Valor mínimo de 3 e máximo de 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "Se esta opção estiver ativada a ordem especificada em (Organizar Pasta Por) será revertida." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Especifica um critério de organização pra organizar as pastas." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Especifica a ordem de organização das pastas. Valor mínimo de 1 e máximo de 2." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "Se esta opção estiver ativada a ordem especificada em \"Organizar Por\" será revertida. Então a ordem será descendente." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Especifica o primeiro critério de organização pra organizar os favoritos." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "Se esta opção estiver ativada, a ordem especificada no \"Então Organizar Por\" será revertida." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Especifica o segundo critério de organização pra organizar os favoritos." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "None" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Title" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Auto-organizar:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Ordem da Organização dos Favoritos:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Caso Insensitivo:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Espera de Inatividade:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Ordem Inversa das Pastas:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Organizar Pasta Por:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Ordem de Organização das Pastas:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Ordem Inversa:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Organizar Por:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "Segunda Ordem Inversa:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Então Organizar Por:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Access Count" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Date Added" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Host Name" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Last Modified" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Last Visited" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "Reverse URL" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Title" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Access Count" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Date Added" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Host Name" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Last Modified" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Last Visited" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "None" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "Reverse URL" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Title" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/FolderUtil.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /* eslint-disable no-param-reassign */ 20 | 21 | import BrowserUtil from "./BrowserUtil"; 22 | import NodeUtil from "./NodeUtil"; 23 | import Separator from "./Separator"; 24 | 25 | /** 26 | * Class to manage Folder objects. 27 | */ 28 | export default class FolderUtil { 29 | /** 30 | * Get the immediate children. 31 | * 32 | * @param {*} callback The callback function. 33 | * @param {*} compare The compare function. 34 | */ 35 | getChildren(callback, compare, resolve) { 36 | this.children = [[]]; 37 | const self = this; 38 | 39 | BrowserUtil.getBookmarkChildren(this.id, (o) => { 40 | if (typeof o !== "undefined") { 41 | const promiseAry = []; 42 | 43 | o.forEach((node) => { 44 | if (NodeUtil.getNodeType(node) === "bookmark") { 45 | // history.getVisits() is faster than history.search() because 46 | // history.search() checks title and url, plus does not match url exactly, so it takes longer. 47 | // chrome expects a callback to be the second argument, while browser-api doesn't and returns promise. 48 | const p = BrowserUtil.getHistoryVisits({ 49 | url: node.url, 50 | }); 51 | promiseAry.push(p); 52 | } else { 53 | promiseAry.push(Promise.resolve()); 54 | } 55 | }); 56 | 57 | Promise.all(promiseAry).then((values) => { 58 | // populate nodes with visit information 59 | for (let i = 0; i < values.length; i += 1) { 60 | if (typeof values[i] !== "undefined" && values[i].length > 0) { 61 | o[i].accessCount = values[i].length; 62 | o[i].lastVisited = values[i][0].visitTime; 63 | } 64 | } 65 | 66 | let index = 0; 67 | 68 | o.forEach((node) => { 69 | const item = NodeUtil.createItemFromNode(node); 70 | if (item instanceof Separator) { 71 | // create sub-array to store nodes after separator 72 | self.children.push([]); 73 | index += 1; 74 | } else if (typeof item !== "undefined") { 75 | self.children[index].push(item); 76 | } 77 | }); 78 | 79 | if (typeof callback === "function") { 80 | callback(self, compare, resolve); 81 | } 82 | }); 83 | } else if (typeof resolve === "function") { 84 | resolve(); 85 | } 86 | }); 87 | } 88 | 89 | /** 90 | * Get folders recursively. 91 | * 92 | * @param {*} callback The callback function. 93 | */ 94 | getFolders(callback) { 95 | this.folders = []; 96 | const self = this; 97 | 98 | BrowserUtil.getBookmarkSubTree( 99 | this.id, 100 | (function getFolders() { 101 | /** 102 | * Get sub folders. Defined locally so that it can be called recursively and not blow the stack. 103 | * 104 | * @param {*} List of bookmarks. 105 | * @returns {*} Callback. 106 | */ 107 | function getSubFolders(o) { 108 | if (typeof o !== "undefined") { 109 | let folder; 110 | let isTop = false; 111 | 112 | o.forEach((node) => { 113 | if ( 114 | NodeUtil.getNodeType(node) === "folder" && 115 | !Annotations.isRecursivelyExcluded(node.id) 116 | ) { 117 | folder = NodeUtil.createItemFromNode(node); 118 | if (self.id === node.id) { 119 | isTop = true; 120 | } 121 | 122 | self.folders.push(folder); 123 | getSubFolders(node.children); 124 | } 125 | }); 126 | 127 | // only return the complete list if this is the top iteration 128 | if (isTop && typeof callback === "function") { 129 | callback(self.folders); 130 | } 131 | } 132 | } 133 | return getSubFolders; 134 | })() 135 | ); 136 | } 137 | 138 | /** 139 | * Get the children folders of a folder. 140 | * 141 | * @param {string} parentId The parent ID. 142 | * @returns {Array} 143 | */ 144 | static getChildrenFolders(parentId, callback) { 145 | BrowserUtil.getBookmarkChildren(parentId, (o) => { 146 | if (typeof o !== "undefined") { 147 | const children = []; 148 | o.forEach((node) => { 149 | if (NodeUtil.getNodeType(node) === "folder") { 150 | children.push({ 151 | id: node.id, 152 | parentId: node.parentId, 153 | title: node.title, 154 | excluded: Annotations.hasDoNotSortAnnotation(node.id), 155 | recursivelyExcluded: Annotations.hasRecursiveAnnotation(node.id), 156 | }); 157 | } 158 | }); 159 | 160 | if (typeof callback === "function") { 161 | callback(children); 162 | } 163 | } 164 | }); 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /src/Annotations.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import BrowserUtil from "./BrowserUtil"; 20 | 21 | const DO_NOT_SORT = "donotsort"; 22 | const RECURSIVE = "recursive"; 23 | 24 | /** 25 | * Class to manage bookmark annotations for folder sort exclusion. 26 | */ 27 | export default class Annotations { 28 | /** 29 | * Constructor. 30 | */ 31 | constructor() { 32 | // TODO: get this from AsbPrefs.js 33 | this.storedSettings = {}; 34 | } 35 | 36 | /** 37 | * Check if an item has a do not sort annotation. 38 | * 39 | * @param {string} id The item ID. 40 | * @returns {boolean} Whether the item has a do not sort annotation. 41 | */ 42 | hasDoNotSortAnnotation(id) { 43 | if ( 44 | typeof this.storedSettings !== "undefined" && 45 | typeof this.storedSettings[DO_NOT_SORT] !== "undefined" && 46 | typeof this.storedSettings[DO_NOT_SORT][id] !== "undefined" 47 | ) { 48 | return this.storedSettings[DO_NOT_SORT][id]; 49 | } 50 | return false; 51 | } 52 | 53 | /** 54 | * Check if an item has a recursive annotation. 55 | * 56 | * @param {string} id The item ID. 57 | * @returns {boolean} Whether the item has a recursive annotation. 58 | */ 59 | hasRecursiveAnnotation(id) { 60 | if ( 61 | typeof this.storedSettings !== "undefined" && 62 | typeof this.storedSettings[RECURSIVE] !== "undefined" && 63 | typeof this.storedSettings[RECURSIVE][id] !== "undefined" 64 | ) { 65 | return this.storedSettings[RECURSIVE][id]; 66 | } 67 | return false; 68 | } 69 | 70 | /** 71 | * Check if an item is recursively excluded. 72 | * 73 | * @param {string} id The item ID. 74 | * @returns {boolean} Whether the item is recursively excluded. 75 | */ 76 | isRecursivelyExcluded(id) { 77 | return this.hasDoNotSortAnnotation(id) && this.hasRecursiveAnnotation(id); 78 | } 79 | 80 | /** 81 | * Remove an item annotation. 82 | * 83 | * @param {string} name The item name. 84 | * @param {string} id The item ID. 85 | */ 86 | removeItemAnnotation(name, id) { 87 | if ( 88 | typeof this.storedSettings !== "undefined" && 89 | typeof this.storedSettings[name] !== "undefined" && 90 | typeof this.storedSettings[name][id] !== "undefined" 91 | ) { 92 | delete this.storedSettings[name][id]; 93 | this.setStoredSettings(); 94 | } 95 | } 96 | 97 | /** 98 | * Remove folders that no longer exist. 99 | * 100 | * @param {array} folders The current existing folders. 101 | */ 102 | removeMissingFolders(folders) { 103 | this.removeMissingFoldersForItem(DO_NOT_SORT, folders); 104 | this.removeMissingFoldersForItem(RECURSIVE, folders); 105 | } 106 | 107 | /** 108 | * Remove folders that no longer exist. 109 | * 110 | * @param {string} name Name of storage item. 111 | * @param {array} folders The current existing folders. 112 | */ 113 | removeMissingFoldersForItem(name, folders) { 114 | if ( 115 | typeof this.storedSettings !== "undefined" && 116 | typeof this.storedSettings[name] !== "undefined" 117 | ) { 118 | const ids = Object.keys(this.storedSettings[name]); 119 | ids.forEach((id) => { 120 | const found = folders.find((folder) => folder.id === id); 121 | if (typeof found !== "undefined") { 122 | this.removeItemAnnotation(name, id); 123 | } 124 | }); 125 | } 126 | } 127 | 128 | /** 129 | * Remove the do not sort annotation on an item. 130 | * 131 | * @param {string} id The item ID. 132 | */ 133 | removeDoNotSortAnnotation(id) { 134 | this.removeItemAnnotation(DO_NOT_SORT, id); 135 | } 136 | 137 | /** 138 | * Remove the recursive annotation on an item. 139 | * 140 | * @param {string} id The item ID. 141 | */ 142 | removeRecursiveAnnotation(id) { 143 | this.removeItemAnnotation(RECURSIVE, id); 144 | } 145 | 146 | /** 147 | * Set an item annotation. 148 | * 149 | * @param {string} name The item name. 150 | * @param {string} id The item ID. 151 | * @param {string} value The item value. 152 | */ 153 | setItemAnnotation(name, id, value) { 154 | if (typeof this.storedSettings !== "undefined") { 155 | if (typeof this.storedSettings[name] === "undefined") { 156 | this.storedSettings[name] = {}; 157 | } 158 | this.storedSettings[name][id] = value; 159 | this.setStoredSettings(); 160 | } 161 | } 162 | 163 | /** 164 | * Set the do not sort annotation on an item. 165 | * 166 | * @param {string} id The item ID. 167 | */ 168 | setDoNotSortAnnotation(id) { 169 | this.setItemAnnotation(DO_NOT_SORT, id, true); 170 | } 171 | 172 | /** 173 | * Set the recursive annotation on an item. 174 | * 175 | * @param {string} id The item ID. 176 | */ 177 | setRecursiveAnnotation(id) { 178 | this.setItemAnnotation(RECURSIVE, id, true); 179 | } 180 | 181 | /** 182 | * Set the stored annotation. 183 | */ 184 | setStoredSettings() { 185 | BrowserUtil.setLocalSettings(this.storedSettings); 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /locales/de/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "cancel": { 3 | "message": "Abbrechen" 4 | }, 5 | "configure_folders": { 6 | "message": "Ordner konfigurieren" 7 | }, 8 | "default": { 9 | "message": "Standard" 10 | }, 11 | "folders_to_sort": { 12 | "message": "Zu sortierende Ordner:" 13 | }, 14 | "loading": { 15 | "message": "Laden..." 16 | }, 17 | "recursive": { 18 | "message": "Rekursiv" 19 | }, 20 | "save": { 21 | "message": "Speichern" 22 | }, 23 | "settings": { 24 | "message": "Einstellungen" 25 | }, 26 | "sort": { 27 | "message": "Sortieren" 28 | }, 29 | "subfolders_recursively_excluded": { 30 | "message": "Unterordner werden rekursiv ausgeschlossen." 31 | }, 32 | "title": { 33 | "message": "Lesezeichen autom. sortieren" 34 | }, 35 | "uncheck_to_exclude_folder": { 36 | "message": "Ordner deaktivieren, um sie vom Sortieren auszuschließen." 37 | }, 38 | "weh_prefs_description_auto_sort": { 39 | "message": "Ist diese Option aktiviert, werden die Lesezeichen beim Hinzufügen, Ändern, Verschieben oder Löschen sortiert. D. h., Sie können keine Lesezeichen im selben Ordner verschieben, es sei denn, sie werden über ein Trennzeichen verschoben." 40 | }, 41 | "weh_prefs_description_bookmark_sort_order": { 42 | "message": "Legt die Lesezeichensortierreihenfolge fest. Mindestwert 1 und Höchstwert 2." 43 | }, 44 | "weh_prefs_description_case_insensitive": { 45 | "message": "Wenn diese Option aktiviert ist, werden die Lesezeichen ohne Berücksichtigung der Groß-/Kleinschreibung sortiert." 46 | }, 47 | "weh_prefs_description_delay": { 48 | "message": "Gibt an, wie lange (in Sekunden) auf Inaktivität gewartet werden soll, bevor die Lesezeichen sortiert werden. Dies gilt sowohl für die autom. als auch für die manuelle Sortierung. Mindestwert 3 und Höchstwert 255." 49 | }, 50 | "weh_prefs_description_folder_inverse": { 51 | "message": "Wenn diese Option aktiviert ist, wird die in 'Ordner sortieren nach' angegebene Reihenfolge umgekehrt." 52 | }, 53 | "weh_prefs_description_folder_sort_by": { 54 | "message": "Gibt ein Sortierkriterium für die Ordnersortierung an." 55 | }, 56 | "weh_prefs_description_folder_sort_order": { 57 | "message": "Gibt die Ordnersortierreihenfolge an. Mindestwert 1 und Höchstwert 2.." 58 | }, 59 | "weh_prefs_description_inverse": { 60 | "message": "Wenn diese Option aktiviert ist, wird die in 'Sortieren nach' angegebene Reihenfolge umgekehrt. Die Reihenfolge ist dann absteigend." 61 | }, 62 | "weh_prefs_description_sort_by": { 63 | "message": "Gibt das 1. Sortierkriterium für die Lesezeichensortierung an." 64 | }, 65 | "weh_prefs_description_then_inverse": { 66 | "message": "Wenn diese Option aktiviert ist, wird die unter 'Dann sortieren nach' angegebene Reihenfolge umgekehrt." 67 | }, 68 | "weh_prefs_description_then_sort_by": { 69 | "message": "Gibt das 2. Sortierkriterium für die Lesezeichensortierung an." 70 | }, 71 | "weh_prefs_folder_sort_by_option_none": { 72 | "message": "Keine" 73 | }, 74 | "weh_prefs_folder_sort_by_option_title": { 75 | "message": "Titel" 76 | }, 77 | "weh_prefs_label_auto_sort": { 78 | "message": "Autom. sortieren:" 79 | }, 80 | "weh_prefs_label_bookmark_sort_order": { 81 | "message": "Lesezeichensortierreihenfolge:" 82 | }, 83 | "weh_prefs_label_case_insensitive": { 84 | "message": "Groß-/Kleinschreibung egal:" 85 | }, 86 | "weh_prefs_label_delay": { 87 | "message": "Warten Inaktivität:" 88 | }, 89 | "weh_prefs_label_folder_inverse": { 90 | "message": "Umgekehrte Ordnerreihenfolge:" 91 | }, 92 | "weh_prefs_label_folder_sort_by": { 93 | "message": "Ordner sortieren nach:" 94 | }, 95 | "weh_prefs_label_folder_sort_order": { 96 | "message": "Ordnersortierreihenfolge:" 97 | }, 98 | "weh_prefs_label_inverse": { 99 | "message": "Umgekehrte Reihenfolge:" 100 | }, 101 | "weh_prefs_label_sort_by": { 102 | "message": "Sortieren nach:" 103 | }, 104 | "weh_prefs_label_then_inverse": { 105 | "message": "2. Reihenfolge umkehren:" 106 | }, 107 | "weh_prefs_label_then_sort_by": { 108 | "message": "Dann sortieren nach:" 109 | }, 110 | "weh_prefs_sort_by_option_accessCount": { 111 | "message": "Anzahl Zugriffe" 112 | }, 113 | "weh_prefs_sort_by_option_dateAdded": { 114 | "message": "Datum hinzugefügt" 115 | }, 116 | "weh_prefs_sort_by_option_hostname": { 117 | "message": "Host-Name" 118 | }, 119 | "weh_prefs_sort_by_option_lastModified": { 120 | "message": "Zuletzt geändert" 121 | }, 122 | "weh_prefs_sort_by_option_lastVisited": { 123 | "message": "Zuletzt besucht" 124 | }, 125 | "weh_prefs_sort_by_option_revurl": { 126 | "message": "URL umkehren" 127 | }, 128 | "weh_prefs_sort_by_option_title": { 129 | "message": "Titel" 130 | }, 131 | "weh_prefs_sort_by_option_url": { 132 | "message": "URL" 133 | }, 134 | "weh_prefs_then_sort_by_option_accessCount": { 135 | "message": "Anzahl Zugriffe" 136 | }, 137 | "weh_prefs_then_sort_by_option_dateAdded": { 138 | "message": "Datum hinzugefügt" 139 | }, 140 | "weh_prefs_then_sort_by_option_hostname": { 141 | "message": "Host-Name" 142 | }, 143 | "weh_prefs_then_sort_by_option_lastModified": { 144 | "message": "Zuletzt geändert" 145 | }, 146 | "weh_prefs_then_sort_by_option_lastVisited": { 147 | "message": "Zuletzt besucht" 148 | }, 149 | "weh_prefs_then_sort_by_option_none": { 150 | "message": "Keine" 151 | }, 152 | "weh_prefs_then_sort_by_option_revurl": { 153 | "message": "URL umkehren" 154 | }, 155 | "weh_prefs_then_sort_by_option_title": { 156 | "message": "Titel" 157 | }, 158 | "weh_prefs_then_sort_by_option_url": { 159 | "message": "URL" 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/BrowserUtil.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Class for browser specific API calls. 21 | */ 22 | export default class BrowserUtil { 23 | /** 24 | * Converts a relative path within an extension install directory to a fully-qualified URL. 25 | * 26 | * @param {*} path A path to a resource within an extension expressed relative to its install directory. 27 | */ 28 | static getExtensionURL(path) { 29 | chrome.extension.getURL(path); 30 | } 31 | 32 | /** 33 | * Registers an event listener callback to an event. 34 | * 35 | * @param callback Called when an event occurs. 36 | */ 37 | static addBookmarkChangedListener(callback) { 38 | chrome.bookmarks.onChanged.addListener(callback); 39 | } 40 | 41 | /** 42 | * Registers an event listener callback to an event. 43 | * 44 | * @param callback Called when an event occurs. 45 | */ 46 | static addBookmarkCreatedListener(callback) { 47 | chrome.bookmarks.onCreated.addListener(callback); 48 | } 49 | 50 | /** 51 | * Registers an event listener callback to an event. 52 | * 53 | * @param callback Called when an event occurs. 54 | */ 55 | static addBookmarkMovedListener(callback) { 56 | chrome.bookmarks.onMoved.addListener(callback); 57 | } 58 | 59 | /** 60 | * Registers an event listener callback to an event. 61 | * 62 | * @param callback Called when an event occurs. 63 | */ 64 | static addBookmarkRemovedListener(callback) { 65 | chrome.bookmarks.onRemoved.addListener(callback); 66 | } 67 | 68 | /** 69 | * Registers an event listener callback to an event. 70 | * 71 | * @param callback Called when an event occurs. 72 | */ 73 | static addHistoryVistedListener(callback) { 74 | chrome.history.onVisited.addListener(callback); 75 | } 76 | 77 | /** 78 | * Deregisters an event listener callback from an event. 79 | * 80 | * @param callback Listener that shall be unregistered. 81 | */ 82 | static removeBookmarkChangedListener(callback) { 83 | chrome.bookmarks.onChanged.removeListener(callback); 84 | } 85 | 86 | /** 87 | * Deregisters an event listener callback from an event. 88 | * 89 | * @param callback Listener that shall be unregistered. 90 | */ 91 | static removeBookmarkCreatedListener(callback) { 92 | chrome.bookmarks.onCreated.removeListener(callback); 93 | } 94 | 95 | /** 96 | * Deregisters an event listener callback from an event. 97 | * 98 | * @param callback Listener that shall be unregistered. 99 | */ 100 | static removeBookmarkMovedListener(callback) { 101 | chrome.bookmarks.onMoved.removeListener(callback); 102 | } 103 | 104 | /** 105 | * Deregisters an event listener callback from an event. 106 | * 107 | * @param callback Listener that shall be unregistered. 108 | */ 109 | static removeBookmarkRemovedListener(callback) { 110 | chrome.bookmarks.onRemoved.removeListener(callback); 111 | } 112 | 113 | /** 114 | * Deregisters an event listener callback from an event. 115 | * 116 | * @param callback Listener that shall be unregistered. 117 | */ 118 | static removeHistoryVistedListener(callback) { 119 | chrome.history.onVisited.removeListener(callback); 120 | } 121 | 122 | /** 123 | * Retrieves the children of the specified BookmarkTreeNode id. 124 | * 125 | * @param id BookmarkTreeNode id. 126 | * @param callback The callback parameter should be a function. 127 | */ 128 | static getBookmarkChildren(id, callback) { 129 | chrome.bookmarks.getChildren(id, callback); 130 | } 131 | 132 | /** 133 | * Retrieves part of the Bookmarks hierarchy, starting at the specified node. 134 | * 135 | * @param id The ID of the root of the subtree to retrieve. 136 | * @param callback The callback parameter should be a function. 137 | */ 138 | static getBookmarkSubTree(id, callback) { 139 | chrome.bookmarks.getSubTree(id, callback); 140 | } 141 | 142 | /** 143 | * Moves the specified BookmarkTreeNode to the provided location. 144 | * 145 | * @param id BookmarkTreeNode id. 146 | * @param destination Bookmark destination. 147 | * @returns The `move` method provides its result via callback or returned as a `Promise` (MV3 only). 148 | */ 149 | static moveBookmark(id, destination) { 150 | return chrome.bookmarks.move(id, destination); 151 | } 152 | 153 | /** 154 | * Sets multiple items in storage. 155 | * 156 | * @param items An object which gives each key/value pair to update storage with. 157 | */ 158 | static setLocalSettings(items) { 159 | browser.storage.local.set(items); 160 | } 161 | 162 | /** 163 | * Gets one or more items from storage. 164 | * 165 | * @param keys A single key to get, list of keys to get, or a dictionary specifying default values. 166 | */ 167 | static getLocalSettings(keys) { 168 | return browser.storage.local.get(keys); 169 | } 170 | 171 | /** 172 | * Retrieves information about visits to a URL. 173 | * 174 | * @param details Details of item to retrieve. 175 | * @returns A 'Promise' 176 | */ 177 | static getHistoryVisits(details) { 178 | return browser.history.getVisits(details); 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /asb-ai/background.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2024 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /** 20 | * Represents the detected browser API. 21 | */ 22 | const browserAPI = detectBrowserAPI(); 23 | 24 | /** 25 | * Flag to indicate if sorting is in progress. 26 | */ 27 | let sorting = false; 28 | 29 | /** 30 | * Sets the badge text for the browser action. 31 | * @param {string} text - The text to be displayed on the badge. 32 | */ 33 | function setBadgeText(text) { 34 | browserAPI.browserAction.setBadgeText({ text: text }); 35 | } 36 | 37 | /** 38 | * Listens for changes and triggers the sorting of bookmarks. 39 | */ 40 | function changeListener() { 41 | if (sorting) { 42 | return; // Do not proceed if sorting is already in progress 43 | } 44 | 45 | sorting = true; // Set sorting flag to true 46 | setBadgeText("Srt"); // Set badge text to "Srt" while sorting 47 | 48 | // Disable listeners while sorting 49 | removeListeners(); 50 | 51 | // Call sortBookmarks to perform sorting 52 | sortBookmarks().then(() => { 53 | // Sorting is finished, set sorting flag to false 54 | sorting = false; 55 | setBadgeText("End"); // Set badge text to "End" when sorting is done 56 | 57 | // Enable listeners after sorting 58 | addListeners(); 59 | 60 | // Remove badge text after 5 seconds 61 | setTimeout(() => { 62 | setBadgeText(""); 63 | }, 5000); 64 | }); 65 | } 66 | 67 | /** 68 | * Adds event listeners for bookmark changes and icon click. 69 | */ 70 | function addListeners() { 71 | browserAPI.bookmarks.onCreated.addListener(changeListener); 72 | browserAPI.bookmarks.onRemoved.addListener(changeListener); 73 | browserAPI.bookmarks.onChanged.addListener(changeListener); 74 | browserAPI.bookmarks.onMoved.addListener(changeListener); 75 | 76 | // Add a click event listener to the extension's icon when adding listeners 77 | browserAPI.browserAction.onClicked.addListener(iconClickListener); 78 | } 79 | 80 | /** 81 | * Removes the event listeners for bookmark changes and the click event listener from the extension's icon. 82 | */ 83 | function removeListeners() { 84 | browserAPI.bookmarks.onCreated.removeListener(changeListener); 85 | browserAPI.bookmarks.onRemoved.removeListener(changeListener); 86 | browserAPI.bookmarks.onChanged.removeListener(changeListener); 87 | browserAPI.bookmarks.onMoved.removeListener(changeListener); 88 | 89 | // Remove the click event listener from the extension's icon when removing listeners 90 | browserAPI.browserAction.onClicked.removeListener(iconClickListener); 91 | } 92 | 93 | /** 94 | * Handles the click event on the icon. 95 | * @param {_tab} _tab - The tab object. 96 | * @returns {void} 97 | */ 98 | function iconClickListener(_tab) { 99 | // Trigger sorting when the icon is clicked 100 | changeListener(); 101 | } 102 | 103 | /** 104 | * Detects the browser API available in the current browser environment. 105 | * @returns {object|null} The browser API object if supported, otherwise null. 106 | */ 107 | function detectBrowserAPI() { 108 | if (typeof browser !== "undefined" && browser.bookmarks) { 109 | return browser; 110 | } else if (typeof chrome !== "undefined" && chrome.bookmarks) { 111 | return chrome; 112 | } else if (typeof safari !== "undefined" && safari.extension) { 113 | return safari.extension; 114 | } else { 115 | console.error("WebExtensions API not supported in this browser"); 116 | return null; 117 | } 118 | } 119 | 120 | /** 121 | * Sorts the bookmarks tree. 122 | */ 123 | function sortBookmarks() { 124 | return getBookmarksTree().then((bookmarks) => { 125 | const sortedTree = sortTree(bookmarks[0]); 126 | return Promise.resolve(); // No need to return a Promise 127 | }); 128 | } 129 | 130 | /** 131 | * Retrieves the bookmarks tree. 132 | * @returns {Promise>} A promise that resolves to an array of BookmarkTreeNode objects representing the bookmarks tree. 133 | */ 134 | function getBookmarksTree() { 135 | return browserAPI.bookmarks.getTree(); 136 | } 137 | 138 | /** 139 | * Sorts the tree structure of bookmarks recursively. 140 | * 141 | * @param {Object} node - The root node of the tree structure. 142 | */ 143 | function sortTree(node) { 144 | if (node.children) { 145 | // Skip sorting the root node 146 | if (!node.parentId) { 147 | node.children = node.children.map((child) => { 148 | return sortTree(child); 149 | }); 150 | } else { 151 | for (let i = 0; i < node.children.length; i++) { 152 | const child = node.children[i]; 153 | 154 | // Set index to the current position if it is not set 155 | if (!child.index) { 156 | child.index = i; 157 | } 158 | } 159 | 160 | // Sort child nodes in place 161 | node.children.sort((a, b) => { 162 | // sort folders before bookmarks 163 | if (a.url && !b.url) return 1; // 'a' is a bookmark, 'b' is a folder 164 | if (!a.url && b.url) return -1; // 'a' is a folder, 'b' is a bookmark 165 | 166 | // sort by title 167 | return a.title.localeCompare(b.title); 168 | }); 169 | 170 | // Update child nodes by moving bookmarks in place 171 | for (let i = 0; i < node.children.length; i++) { 172 | const child = node.children[i]; 173 | if (child.index !== i) { 174 | console.log(`Moving ${child.title} to index ${i}`); 175 | try { 176 | browserAPI.bookmarks.move(child.id, { 177 | index: i, 178 | }); 179 | } catch (error) { 180 | console.error(`Failed to move bookmark: ${error} ${child.title}`); 181 | } 182 | } 183 | if (child.children) { 184 | sortTree(child); 185 | } 186 | } 187 | } 188 | } 189 | } 190 | 191 | // Add initial listeners 192 | addListeners(); 193 | -------------------------------------------------------------------------------- /src/configure-folders.jsx: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /* eslint-disable no-param-reassign */ 20 | 21 | import React from "react"; 22 | import { render } from "react-dom"; 23 | import { Provider } from "react-redux"; 24 | import { applyMiddleware, createStore, combineReducers } from "redux"; 25 | import { 26 | reducer as prefsSettingsReducer, 27 | App as PrefsSettingsApp, 28 | listenPrefs, 29 | } from "react/weh-prefs-settings"; 30 | import logger from "redux-logger"; 31 | import WehHeader from "react/weh-header"; 32 | import weh from "weh-content"; 33 | 34 | const reducers = combineReducers({ 35 | prefs: prefsSettingsReducer, 36 | }); 37 | 38 | const store = createStore(reducers, applyMiddleware(logger)); 39 | 40 | listenPrefs(store); 41 | 42 | let addIcon; 43 | let loadingText = ""; 44 | let messageText = ""; 45 | let recursiveText = ""; 46 | let removeIcon; 47 | const fetching = new Set(); 48 | 49 | /** 50 | * Send value. 51 | * 52 | * @param type 53 | * @param folderID 54 | * @param checkbox 55 | * @param image 56 | * @returns {Function} 57 | */ 58 | function sendValue(type, folderID, checkbox, image) { 59 | return function handleEvent() { 60 | if (type === "recursive" && image.getAttribute("data-state") === "remove") { 61 | const children = document.querySelector(`#folder-${folderID}`); 62 | children.style.display = "block"; 63 | } 64 | weh.rpc.call(`${type}CheckboxChange`, folderID, checkbox.checked); 65 | }; 66 | } 67 | 68 | /** 69 | * Toggle children. 70 | * 71 | * @param parentID 72 | * @param image 73 | * @param children 74 | * @param recursiveCheckbox 75 | * @returns {Function} 76 | */ 77 | function toggleChildren(parentID, image, children, recursiveCheckbox) { 78 | return function handleEvent() { 79 | if (!fetching.has(parentID)) { 80 | if (image.getAttribute("data-state") === "add") { 81 | image.src = removeIcon; 82 | image.setAttribute("data-state", "remove"); 83 | 84 | if (!recursiveCheckbox.checked) { 85 | children.style.display = "block"; 86 | children.textContent = loadingText; 87 | } 88 | 89 | fetching.add(parentID); 90 | setTimeout(() => { 91 | weh.rpc.call("queryChildren", parentID); 92 | }, 100); 93 | } else { 94 | image.src = addIcon; 95 | image.setAttribute("data-state", "add"); 96 | 97 | if (children) { 98 | children.style.display = "none"; 99 | } 100 | } 101 | } 102 | }; 103 | } 104 | 105 | /** 106 | * Append folder. 107 | * 108 | * @param folder 109 | * @param list 110 | */ 111 | function appendFolder(folder, list) { 112 | const listItem = document.createElement("li"); 113 | 114 | const recursiveCheckbox = document.createElement("input"); 115 | const recursiveLabel = document.createElement("label"); 116 | 117 | const children = document.createElement("ul"); 118 | children.id = `folder-${folder.id}`; 119 | 120 | const icon = document.createElement("img"); 121 | icon.alt = "Expand/Collapse"; 122 | icon.src = addIcon; 123 | icon.setAttribute("data-state", "add"); 124 | icon.addEventListener( 125 | "click", 126 | toggleChildren(folder.id, icon, children, recursiveCheckbox), 127 | false 128 | ); 129 | 130 | const checkbox = document.createElement("input"); 131 | checkbox.type = "checkbox"; 132 | checkbox.id = `enable-${folder.id}`; 133 | checkbox.checked = !folder.excluded; 134 | checkbox.addEventListener( 135 | "change", 136 | sendValue("sort", folder.id, checkbox), 137 | false 138 | ); 139 | checkbox.addEventListener( 140 | "change", 141 | () => { 142 | // clear recursive checkbox when re-enabled 143 | if (checkbox.checked) { 144 | recursiveCheckbox.checked = false; 145 | } 146 | recursiveCheckbox.disabled = checkbox.checked; 147 | recursiveLabel.disabled = checkbox.checked; 148 | }, 149 | false 150 | ); 151 | 152 | const label = document.createElement("label"); 153 | label.textContent = folder.title; 154 | label.htmlFor = `enable-${folder.id}`; 155 | label.className = "folder-title"; 156 | label.addEventListener( 157 | "click", 158 | toggleChildren(folder.id, icon, children, recursiveCheckbox), 159 | false 160 | ); 161 | 162 | recursiveCheckbox.type = "checkbox"; 163 | recursiveCheckbox.id = `recursive-${folder.id}`; 164 | recursiveCheckbox.checked = folder.recursivelyExcluded; 165 | recursiveCheckbox.disabled = checkbox.checked; 166 | recursiveCheckbox.className = "recursive-checkbox"; 167 | recursiveCheckbox.addEventListener( 168 | "change", 169 | sendValue("recursive", folder.id, recursiveCheckbox, icon), 170 | false 171 | ); 172 | 173 | recursiveLabel.textContent = recursiveText; 174 | recursiveLabel.htmlFor = `recursive-${folder.id}`; 175 | recursiveLabel.className = "recursive"; 176 | recursiveLabel.disabled = checkbox.checked; 177 | 178 | const message = document.createElement("p"); 179 | message.textContent = messageText; 180 | 181 | listItem.appendChild(icon); 182 | listItem.appendChild(checkbox); 183 | listItem.appendChild(label); 184 | listItem.appendChild(recursiveCheckbox); 185 | listItem.appendChild(recursiveLabel); 186 | listItem.appendChild(message); 187 | listItem.appendChild(children); 188 | 189 | list.appendChild(listItem); 190 | } 191 | 192 | /** 193 | * Append folders. 194 | * 195 | * @param folders 196 | * @param list 197 | */ 198 | function appendFolders(folders, list) { 199 | while (list.firstChild) { 200 | list.removeChild(list.firstChild); 201 | } 202 | folders.forEach((folder) => appendFolder(folder, list)); 203 | } 204 | 205 | weh.rpc.listen({ 206 | removeFolder: (folderID) => { 207 | const folder = document.querySelector(`#folder-${folderID}`); 208 | if (folder) { 209 | const parent = folder.parentNode; 210 | parent.parentNode.removeChild(parent); 211 | } 212 | }, 213 | children: (parentID, children) => { 214 | const list = document.querySelector(`#folder-${parentID}`); 215 | appendFolders(children, list); 216 | fetching.delete(parentID); 217 | }, 218 | root: (folders, plusIcon, minusIcon, texts) => { 219 | recursiveText = texts.recursiveText; 220 | messageText = texts.messageText; 221 | loadingText = texts.loadingText; 222 | 223 | addIcon = plusIcon; 224 | removeIcon = minusIcon; 225 | 226 | const rootFoldersDoc = document.querySelector("#rootFolders"); 227 | 228 | appendFolders(folders, rootFoldersDoc); 229 | }, 230 | }); 231 | 232 | render( 233 | 234 | 235 | 236 |
237 |
238 | {weh._("folders_to_sort")} 239 |

{weh._("uncheck_to_exclude_folder")}

240 |
    241 |
242 |
243 |
244 |
, 245 | document.getElementById("root") 246 | ); 247 | 248 | weh.setPageTitle(weh._("configure_folders")); 249 | weh.rpc.call("queryRoot"); 250 | -------------------------------------------------------------------------------- /src/Comparator.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | export default class Comparator { 20 | /** 21 | * Create a bookmark comparator. 22 | * 23 | * @returns {*} The comparator. 24 | */ 25 | static createCompare() { 26 | let comparator; 27 | 28 | /** 29 | * Check for corrupted and order flags. 30 | * 31 | * @param bookmark1 32 | * @param bookmark2 33 | * @returns {number} 34 | */ 35 | function checkCorruptedAndOrder(bookmark1, bookmark2) { 36 | if (bookmark1.corrupted) { 37 | if (bookmark2.corrupted) { 38 | return 0; 39 | } 40 | 41 | return 1; 42 | } 43 | 44 | if (bookmark2.corrupted) { 45 | return -1; 46 | } 47 | 48 | if (bookmark1.order !== bookmark2.order) { 49 | return bookmark1.order - bookmark2.order; 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | /** 56 | * Add reverse URLs. 57 | * 58 | * @param bookmark1 59 | * @param bookmark2 60 | * @param criteria 61 | */ 62 | function addReverseUrls(bookmark1, bookmark2, criteria) { 63 | if (criteria === "revurl") { 64 | bookmark1.revurl = AsbUtil.reverseBaseUrl(bookmark1.url); 65 | bookmark2.revurl = AsbUtil.reverseBaseUrl(bookmark2.url); 66 | } 67 | } 68 | 69 | /** 70 | * Add host names. 71 | * 72 | * @param bookmark1 73 | * @param bookmark2 74 | * @param criteria 75 | */ 76 | function addHostNames(bookmark1, bookmark2, criteria) { 77 | if (criteria === "hostname") { 78 | bookmark1.hostname = new URL(bookmark1.url).hostname; 79 | bookmark2.hostname = new URL(bookmark2.url).hostname; 80 | } 81 | } 82 | 83 | const compareOptions = { 84 | caseFirst: "upper", 85 | numeric: true, 86 | sensitivity: "case", 87 | }; 88 | 89 | if (Sorter.prototype.caseInsensitive) { 90 | compareOptions.sensitivity = "base"; 91 | } 92 | 93 | let firstComparator; 94 | if ( 95 | ["title", "url", "revurl", "hostname"].indexOf( 96 | Sorter.prototype.firstSortCriteria 97 | ) !== -1 98 | ) { 99 | firstComparator = function compare(bookmark1, bookmark2) { 100 | addReverseUrls( 101 | bookmark1, 102 | bookmark2, 103 | Sorter.prototype.firstSortCriteria 104 | ); 105 | addHostNames(bookmark1, bookmark2, Sorter.prototype.firstSortCriteria); 106 | return ( 107 | bookmark1[Sorter.prototype.firstSortCriteria].localeCompare( 108 | bookmark2[Sorter.prototype.firstSortCriteria], 109 | undefined, 110 | compareOptions 111 | ) * Sorter.prototype.firstReverse 112 | ); 113 | }; 114 | } else { 115 | // sort numerically: dateAdded, lastModified, accessCount, lastVisited 116 | firstComparator = function compare(bookmark1, bookmark2) { 117 | return ( 118 | (bookmark1[Sorter.prototype.firstSortCriteria] - 119 | bookmark2[Sorter.prototype.firstSortCriteria]) * 120 | Sorter.prototype.firstReverse 121 | ); 122 | }; 123 | } 124 | 125 | let secondComparator; 126 | if ( 127 | typeof Sorter.prototype.secondSortCriteria !== "undefined" && 128 | Sorter.prototype.secondSortCriteria !== "none" 129 | ) { 130 | if ( 131 | ["title", "url", "revurl", "hostname"].indexOf( 132 | Sorter.prototype.secondSortCriteria 133 | ) !== -1 134 | ) { 135 | secondComparator = function compare(bookmark1, bookmark2) { 136 | addReverseUrls( 137 | bookmark1, 138 | bookmark2, 139 | Sorter.prototype.secondSortCriteria 140 | ); 141 | addHostNames( 142 | bookmark1, 143 | bookmark2, 144 | Sorter.prototype.firstSortCriteria 145 | ); 146 | return ( 147 | bookmark1[Sorter.prototype.secondSortCriteria].localeCompare( 148 | bookmark2[Sorter.prototype.secondSortCriteria], 149 | undefined, 150 | compareOptions 151 | ) * Sorter.prototype.secondReverse 152 | ); 153 | }; 154 | } else { 155 | // sort numerically: dateAdded, lastModified, accessCount, lastVisited 156 | secondComparator = function compare(bookmark1, bookmark2) { 157 | return ( 158 | (bookmark1[Sorter.prototype.secondSortCriteria] - 159 | bookmark2[Sorter.prototype.secondSortCriteria]) * 160 | Sorter.prototype.secondReverse 161 | ); 162 | }; 163 | } 164 | } else { 165 | // no sorting 166 | secondComparator = function compare() { 167 | return 0; 168 | }; 169 | } 170 | 171 | // combine the first and second comparators 172 | const itemComparator = function compare(bookmark1, bookmark2) { 173 | return ( 174 | firstComparator(bookmark1, bookmark2) || 175 | secondComparator(bookmark1, bookmark2) 176 | ); 177 | }; 178 | 179 | if (Sorter.prototype.differentFolderOrder) { 180 | if ( 181 | typeof Sorter.prototype.folderSortCriteria !== "undefined" && 182 | Sorter.prototype.folderSortCriteria !== "none" 183 | ) { 184 | // sort folders, then sort bookmarks 185 | comparator = function compare(bookmark1, bookmark2) { 186 | if (bookmark1 instanceof Folder && bookmark2 instanceof Folder) { 187 | if (["title"].indexOf(Sorter.prototype.folderSortCriteria) !== -1) { 188 | return ( 189 | bookmark1[Sorter.prototype.folderSortCriteria].localeCompare( 190 | bookmark2[Sorter.prototype.folderSortCriteria], 191 | undefined, 192 | compareOptions 193 | ) * Sorter.prototype.folderReverse 194 | ); 195 | } 196 | 197 | // numeric sort 198 | return ( 199 | (bookmark1[Sorter.prototype.folderSortCriteria] - 200 | bookmark2[Sorter.prototype.folderSortCriteria]) * 201 | Sorter.prototype.folderReverse 202 | ); 203 | } 204 | 205 | return itemComparator(bookmark1, bookmark2); 206 | }; 207 | } else { 208 | // no sorting 209 | comparator = function compare(bookmark1, bookmark2) { 210 | if (bookmark1 instanceof Folder && bookmark2 instanceof Folder) { 211 | return 0; 212 | } 213 | 214 | return itemComparator(bookmark1, bookmark2); 215 | }; 216 | } 217 | } else { 218 | // sort bookmarks and folders with same order 219 | comparator = itemComparator; 220 | } 221 | 222 | return function compare(bookmark1, bookmark2) { 223 | const result = checkCorruptedAndOrder(bookmark1, bookmark2); 224 | if (typeof result === "undefined") { 225 | return comparator(bookmark1, bookmark2); 226 | } 227 | 228 | return result; 229 | }; 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /asb-ai/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 41 | 44 | 45 | 47 | 55 | 58 | 62 | 66 | 70 | 71 | 72 | 80 | 85 | 86 | 94 | 99 | 100 | 108 | 113 | 114 | 122 | 127 | 128 | 136 | 141 | 142 | 150 | 155 | 156 | 157 | 159 | 160 | 162 | image/svg+xml 163 | 165 | 166 | 167 | 168 | 169 | 173 | 180 | 187 | 194 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /src/images/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 41 | 44 | 45 | 47 | 55 | 58 | 62 | 66 | 70 | 71 | 72 | 80 | 85 | 86 | 94 | 99 | 100 | 108 | 113 | 114 | 122 | 127 | 128 | 136 | 141 | 142 | 150 | 155 | 156 | 157 | 159 | 160 | 162 | image/svg+xml 163 | 165 | 166 | 167 | 168 | 169 | 173 | 180 | 187 | 194 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /src/AsbPrefs.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | import BrowserUtil from "./BrowserUtil"; 20 | import FolderUtil from "./FolderUtil"; 21 | 22 | const weh = require("weh-background"); 23 | const wehPrefs = require("weh-prefs"); 24 | const defaults = require("./default-prefs").default; 25 | 26 | // TODO: make this a singleton 27 | // TODO: add method to set callback ( setCriteria() ) 28 | // TODO: add method to get "storedSettings" 29 | 30 | /** 31 | * Class to manage add-on preferences. 32 | * 33 | * This class is depended on by other class, so it is a singleton (single instance). 34 | * Also, it has been refactored to prevent circular-dependency. For example, it needs to call 35 | * setCriteria() in the Sorter class, which depends on this class, so a callback is used instead. 36 | */ 37 | export default class AsbPrefs { 38 | constructor() { 39 | weh.prefs.declare(defaults); 40 | 41 | let storedSettings = {}; 42 | 43 | AsbPrefs.getStoredSettings((settings) => { 44 | storedSettings = settings; 45 | 46 | // Get weh prefs 47 | const prefs = storedSettings["weh-prefs"] || {}; 48 | wehPrefs.assign(prefs); 49 | 50 | // Listen for change to weh prefs 51 | weh.rpc.listen({ 52 | prefsSet: function prefsSet(prefs2) { 53 | storedSettings["weh-prefs"] = prefs2; 54 | BrowserUtil.setLocalSettings(storedSettings); 55 | return wehPrefs.assign(prefs2); 56 | }, 57 | }); 58 | 59 | this.adjustSortCriteria(); 60 | this.registerUserEvents(); 61 | this.registerPrefListeners(); 62 | }); 63 | } 64 | 65 | /** 66 | * Determine if browser is Firefox or not. 67 | * 68 | * @returns {boolean} 69 | */ 70 | isFirefox() { 71 | return this.weh.browserType === "firefox"; 72 | } 73 | 74 | /** 75 | * Get stored settings. 76 | * 77 | * @param {any} callback Function called to receive stored settings. 78 | */ 79 | static getStoredSettings(callback) { 80 | const getting = BrowserUtil.getLocalSettings(); 81 | getting.then((storedSettings) => { 82 | if (typeof callback === "function") { 83 | callback(storedSettings); 84 | } 85 | }); 86 | } 87 | 88 | /** 89 | * Get current preference value or it's default value if not set. 90 | * 91 | * @param {string} param Name of preference. 92 | * @returns {*} Value or default value of preference. 93 | */ 94 | getPref(param) { 95 | const { defaultValue } = weh.prefs.$specs[param]; 96 | let value = this.weh.prefs[param]; 97 | if (typeof value === "undefined") { 98 | value = defaultValue; 99 | } 100 | // log("pref " + param + " = " + value); 101 | return value; 102 | } 103 | 104 | /** 105 | * Adjust the sort criteria of the bookmark sorter. 106 | */ 107 | adjustSortCriteria() { 108 | const differentFolderOrder = 109 | this.getPref("folder_sort_order") !== this.getPref("bookmark_sort_order"); 110 | 111 | Sorter.setCriteria( 112 | this.getPref("sort_by"), 113 | this.getPref("inverse"), 114 | this.getPref("then_sort_by"), 115 | this.getPref("then_inverse"), 116 | this.getPref("folder_sort_by"), 117 | this.getPref("folder_inverse"), 118 | differentFolderOrder, 119 | this.getPref("case_insensitive") 120 | ); 121 | } 122 | 123 | /** 124 | * Register listeners for pref changes. 125 | */ 126 | registerPrefListeners() { 127 | this.weh.prefs.on("auto_sort", this.sortIfAuto); 128 | 129 | // FIXME: do both things happen? 130 | this.weh.prefs.on("folder_sort_order", this.sortIfAuto); 131 | this.weh.prefs.on("bookmark_sort_order", this.sortIfAuto); 132 | this.weh.prefs.on("folder_sort_order", this.adjustSortCriteria); 133 | this.weh.prefs.on("bookmark_sort_order", this.adjustSortCriteria); 134 | 135 | this.weh.prefs.on("case_insensitive", this.adjustSortCriteria); 136 | this.weh.prefs.on("sort_by", this.adjustSortCriteria); 137 | this.weh.prefs.on("then_sort_by", this.adjustSortCriteria); 138 | this.weh.prefs.on("folder_sort_by", this.adjustSortCriteria); 139 | this.weh.prefs.on("inverse", this.adjustSortCriteria); 140 | this.weh.prefs.on("then_inverse", this.adjustSortCriteria); 141 | this.weh.prefs.on("folder_inverse", this.adjustSortCriteria); 142 | } 143 | 144 | /** 145 | * Register user events. 146 | */ 147 | registerUserEvents() { 148 | this.weh.rpc.listen({ 149 | openSettings: () => { 150 | this.weh.ui.open("settings", { 151 | type: "tab", 152 | url: "settings.html", 153 | }); 154 | this.weh.ui.close("main"); 155 | }, 156 | openConfigureFolders: () => { 157 | this.weh.ui.open("configure-folders", { 158 | type: "tab", 159 | url: "configure-folders.html", 160 | }); 161 | this.weh.ui.close("main"); 162 | }, 163 | sort: () => { 164 | this.sortAllBookmarks(); 165 | this.weh.ui.close("main"); 166 | }, 167 | sortCheckboxChange: (folderID, activated) => { 168 | if (activated) { 169 | Annotations.removeDoNotSortAnnotation(folderID); 170 | Annotations.removeRecursiveAnnotation(folderID); 171 | } else { 172 | Annotations.setDoNotSortAnnotation(folderID); 173 | } 174 | }, 175 | recursiveCheckboxChange: (folderID, activated) => { 176 | if (activated) { 177 | Annotations.setRecursiveAnnotation(folderID); 178 | } else { 179 | Annotations.removeRecursiveAnnotation(folderID); 180 | } 181 | }, 182 | queryRoot: () => { 183 | const texts = { 184 | recursiveText: this.weh._("recursive"), 185 | messageText: this.weh._("subfolders_recursively_excluded"), 186 | loadingText: this.weh._("loading"), 187 | }; 188 | const addImgUrl = BrowserUtil.getExtensionURL("images/add.png"); 189 | const removeImgUrl = BrowserUtil.getExtensionURL("images/remove.png"); 190 | FolderUtil.getChildrenFolders(this.getRootId(), (children) => { 191 | this.weh.rpc.call( 192 | "configure-folders", 193 | "root", 194 | children, 195 | addImgUrl, 196 | removeImgUrl, 197 | texts 198 | ); 199 | }); 200 | }, 201 | queryChildren: (parentId) => { 202 | FolderUtil.getChildrenFolders(parentId, (children) => { 203 | this.weh.rpc.call( 204 | "configure-folders", 205 | "children", 206 | parentId, 207 | children 208 | ); 209 | }); 210 | }, 211 | }); 212 | } 213 | 214 | /** 215 | * Send message that folder has been removed. 216 | * 217 | * @param {*} id ID of removed folder. 218 | */ 219 | removeFolder(id) { 220 | this.weh.rpc.call("configure-folders", "removeFolder", id); 221 | } 222 | 223 | /** 224 | * Get the rootId. 225 | * 226 | * @returns {string} 227 | */ 228 | getRootId() { 229 | if (this.isFirefox()) { 230 | return "root________"; 231 | } 232 | return "0"; 233 | } 234 | } 235 | -------------------------------------------------------------------------------- /src/Sorter.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2015 Boucher, Antoni 3 | * Copyright (C) 2016-2022 Eric Bixby 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | /* eslint-disable no-param-reassign */ 20 | 21 | import AsbUtil from "./AsbUtil"; 22 | import ChangeHandler from "./ChangeHandler"; 23 | import Folder from "./Folder"; 24 | import FolderUtil from "./FolderUtil"; 25 | import NodeUtil from "./NodeUtil"; 26 | 27 | /** 28 | * Sorter class. 29 | */ 30 | export default class Sorter { 31 | /** 32 | * Get a Sorter. 33 | */ 34 | constructor() { 35 | /** 36 | * Indicates if sorting is in progress. 37 | */ 38 | this.sorting = false; 39 | 40 | /** 41 | * Indicates if waiting for activity to stop. 42 | */ 43 | this.isWaiting = false; 44 | 45 | /** 46 | * Last time checked for change 47 | */ 48 | this.lastCheck = Date.now(); 49 | 50 | /** 51 | * Handle bookmark changes 52 | */ 53 | this.changeHandler = new ChangeHandler(this); 54 | } 55 | 56 | /** 57 | * Sort all bookmarks. 58 | */ 59 | sortAllBookmarks() { 60 | const self = this; 61 | FolderUtil.getChildrenFolders(this.getRootId(), (children) => { 62 | self.sortRootFolders(children); 63 | }); 64 | } 65 | 66 | /** 67 | * Sort root folders. 68 | * 69 | * @param children 70 | */ 71 | sortRootFolders(children) { 72 | const promiseAry = []; 73 | 74 | children.forEach((node) => { 75 | const folder = NodeUtil.createItemFromNode(node); 76 | 77 | const p = new Promise((resolve) => { 78 | const folders = []; 79 | 80 | if (!node.recursivelyExcluded) { 81 | folders.push(folder); 82 | 83 | folder.getFolders((subfolders) => { 84 | subfolders.forEach((f) => folders.push(f)); 85 | resolve(folders); 86 | }); 87 | } else { 88 | resolve(folders); 89 | } 90 | }); 91 | 92 | promiseAry.push(p); 93 | }); 94 | 95 | Promise.all(promiseAry).then((folders) => { 96 | // Flatten array of arrays into single array using spread operator (...) 97 | const mergedFolders = [].concat(...folders); 98 | 99 | Annotations.removeMissingFolders(mergedFolders); 100 | this.sortFolders(mergedFolders); 101 | }); 102 | } 103 | 104 | /** 105 | * Set sort criteria. 106 | * 107 | * @param {any} firstSortCriteria 108 | * @param {any} firstReverse 109 | * @param {any} secondSortCriteria 110 | * @param {any} secondReverse 111 | * @param {any} folderSortCriteria 112 | * @param {any} folderReverse 113 | * @param {any} differentFolderOrder 114 | * @param {any} caseInsensitive 115 | * @memberof Sorter 116 | */ 117 | setCriteria( 118 | firstSortCriteria, 119 | firstReverse, 120 | secondSortCriteria, 121 | secondReverse, 122 | folderSortCriteria, 123 | folderReverse, 124 | differentFolderOrder, 125 | caseInsensitive 126 | ) { 127 | Sorter.prototype.firstReverse = firstReverse ? -1 : 1; 128 | Sorter.prototype.firstSortCriteria = firstSortCriteria; 129 | Sorter.prototype.secondReverse = secondReverse ? -1 : 1; 130 | Sorter.prototype.secondSortCriteria = secondSortCriteria; 131 | Sorter.prototype.folderReverse = folderReverse ? -1 : 1; 132 | Sorter.prototype.folderSortCriteria = folderSortCriteria; 133 | Sorter.prototype.differentFolderOrder = differentFolderOrder; 134 | Sorter.prototype.caseInsensitive = caseInsensitive; 135 | this.compare = Sorter.createCompare(); 136 | } 137 | 138 | /** 139 | * Sort and save a folder. 140 | * 141 | * @param {Folder} folder The folder to sort and save. 142 | */ 143 | sortAndSave(folder, resolve) { 144 | if (folder.canBeSorted()) { 145 | folder.getChildren(Sorter.sortFolder, this.compare, resolve); 146 | } else if (typeof resolve === "function") { 147 | resolve(); 148 | } 149 | } 150 | 151 | /** 152 | * Sort the `folder` children. 153 | * 154 | * @param {Folder} folder The folder to sort. 155 | */ 156 | static sortFolder(folder, compare, resolve) { 157 | let delta = 0; 158 | let length; 159 | 160 | // children is an array of arrays where a separator node is used to separate lists 161 | for (let i = 0; i < folder.children.length; i += 1) { 162 | // sort each array of nodes 163 | folder.children[i].sort(compare); 164 | // assign new index to each node 165 | length = folder.children[i].length; 166 | for (let j = 0; j < length; j += 1) { 167 | folder.children[i][j].setIndex(j + delta); 168 | } 169 | 170 | delta += length + 1; 171 | } 172 | 173 | // move nodes based on new index 174 | folder.save(resolve); 175 | } 176 | 177 | /** 178 | * Sort the `folders`. 179 | * 180 | * @param folders The folders to sort. 181 | */ 182 | sortFolders(folders) { 183 | // convert single folder into array of folders 184 | folders = folders instanceof Folder ? [folders] : folders; 185 | 186 | const self = this; 187 | const promiseAry = []; 188 | 189 | folders.forEach((folder) => { 190 | // create an array of promises 191 | const p = new Promise((resolve) => { 192 | self.sortAndSave(folder, resolve); 193 | }); 194 | 195 | promiseAry.push(p); 196 | }); 197 | 198 | Promise.all(promiseAry).then(() => { 199 | AsbUtil.log("sort:end"); 200 | self.sorting = false; 201 | self.lastCheck = Date.now(); 202 | // wait for events caused by sorting to finish before listening again so the sorting is not triggered again 203 | setTimeout( 204 | () => { 205 | this.changeHandler.createChangeListeners(); 206 | }, 207 | 3000, 208 | "Javascript" 209 | ); 210 | }); 211 | } 212 | 213 | /** 214 | * Sort all bookmarks. 215 | */ 216 | sortNow() { 217 | this.sortIfNotSorting(); 218 | } 219 | 220 | /** 221 | * Sort if the auto sort option is on. 222 | */ 223 | sortIfAuto() { 224 | if (AsbPref.getPref("auto_sort")) { 225 | this.sortNow(); 226 | } 227 | } 228 | 229 | /** 230 | * Sort if not already sorting. 231 | */ 232 | sortIfNotSorting() { 233 | if (!this.sorting) { 234 | // restart clock every time there is an event triggered 235 | this.lastCheck = Date.now(); 236 | // if already waiting, then don't wait again or there will be multiple loops 237 | if (!this.isWaiting) { 238 | this.sortIfNoChanges(); 239 | } 240 | } 241 | } 242 | 243 | /** 244 | * Sort if no recent changes. 245 | */ 246 | sortIfNoChanges() { 247 | if (!this.sorting) { 248 | // wait for a period of no activity before sorting 249 | const now = Date.now(); 250 | const diff = now - this.lastCheck; 251 | const delay = parseInt(AsbPref.getPref("delay"), 10) * 1000; 252 | if (diff < delay) { 253 | this.isWaiting = true; 254 | const self = this; 255 | setTimeout( 256 | () => { 257 | AsbUtil.log("waiting one second for activity to stop"); 258 | self.sortIfNoChanges(); 259 | }, 260 | 1000, 261 | "Javascript" 262 | ); 263 | } else { 264 | this.sorting = true; 265 | this.isWaiting = false; 266 | this.changeHandler.removeChangeListeners(); 267 | AsbUtil.log("sort:begin"); 268 | this.sortAllBookmarks(); 269 | } 270 | } 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------