Repository: denschub/firefox-tabgroups
Branch: develop
Commit: b92a0224ac0c
Files: 36
Total size: 82.2 KB
Directory structure:
gitextract_2araavjk/
├── .gitignore
├── Changelog.md
├── Jakefile
├── LICENSE
├── README.md
├── package.json
└── src/
├── .eslintignore
├── .eslintrc.json
├── bootstrap.js
├── chrome.manifest
├── content/
│ └── icons/
│ └── togglebutton/
│ └── LICENSE
├── data/
│ ├── action_creators.js
│ ├── assets/
│ │ └── css/
│ │ └── groupspanel.css
│ ├── components/
│ │ ├── app.js
│ │ ├── group.js
│ │ ├── groupaddbutton.js
│ │ ├── groupcontrols.js
│ │ ├── grouplist.js
│ │ ├── tab.js
│ │ └── tablist.js
│ ├── groupspanel.html
│ ├── groupspanel.js
│ ├── reducer.js
│ └── vendor/
│ └── css/
│ └── font-awesome.css
├── index.js
├── install.rdf
├── lib/
│ ├── storage/
│ │ └── session.js
│ ├── tabmanager.js
│ └── utils.js
├── locale/
│ ├── de-DE.properties
│ ├── en-US.properties
│ ├── es-AR.properties
│ ├── es-ES.properties
│ ├── fr-FR.properties
│ └── nl-NL.properties
└── package.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
dist/
node_modules/
================================================
FILE: Changelog.md
================================================
# 0.6.0
## Features
* Added a timeout when closing a group to restore a group when closed by accident (PR [34](https://github.com/denschub/firefox-tabgroups/pull/34))
## Bug fixes
* Show the correct icon when using the dark compact theme
* Fix invalid group selection after closing tabs (PR [51](https://github.com/denschub/firefox-tabgroups/pull/51))
# 0.5.1
Set `multiprocessCompatible` to `true`!
# 0.5.0
## Bug fixes
* Use the inverted toolbar icon if needed on high resolutions.
## Refactorings
* Use the default favicon instead of no favicon at all. (PR [35](https://github.com/denschub/firefox-tabgroups/pull/35))
* Removed the Panorama migration to avoid breakage in Firefox 52
# 0.4.0
## Features
* You can now drag and drop tabs in the panel to move them between groups. Dragging a tab onto the "Create new group" button will create a new group with that tab. (PR [32](https://github.com/denschub/firefox-tabgroups/pull/32))
# 0.3.0
## Bug fixes
* Clicking the input field while renaming will no longer select the group. (PR [28](https://github.com/denschub/firefox-tabgroups/pull/28))
* Use `label` instead of `visibleLabel` since the latter was removed in bug 1247920.
# 0.2.1
* Don't try to set the groups active tab if an app tab is active. (Issue [#27](https://github.com/denschub/firefox-tabgroups/issues/27))
# 0.2.0
## Features
* Added a migration override so tab groups won't be migrated away.
* Added compatiblity with Quicksavers Tab Groups add-on.
* Added keyboard shortcuts to switch between groups. (PR [#23](https://github.com/denschub/firefox-tabgroups/pull/23))
* Added option for alphabetic tab group sorting. (PR [#24](https://github.com/denschub/firefox-tabgroups/pull/24))
## Refactorings
* `minVersion` is now set to 44 so people have a chance to install the addon before the migration kicks in.
* `Tab Groups` was renamed to `Simplified Tab Groups` to avoid confusion and conflicts with other add-ons.
* Simpilified development by adding `jake` and some basic scripts.
# 0.1.1
This was the first public release.
================================================
FILE: Jakefile
================================================
/* global desc, task, jake, complete */
/* vim: set fdl=0: */
"use strict";
const SRC_DIR = "./src";
const DIST_DIR = "./dist";
desc("Builds the source");
task("build", ["cleanup"], () => {
jake.cpR(SRC_DIR, DIST_DIR);
});
desc("Removes all build-related files");
task("cleanup", () => {
jake.rmRf(DIST_DIR);
});
desc("runs wslint on the built source");
task("lint", ["build"], {async: true}, () => {
jake.exec([`cd ${DIST_DIR}; eslint .`], {
interactive: true
}, complete);
});
desc("Builds the source and starts a test installation. You can specify jpm parameters with 'JPM_PARAMS=\"...\" jake run'");
task("run", ["build"], {async: true}, () => {
jake.exec([`cd ${DIST_DIR}; jpm run ${process.env.JPM_PARAMS}`], {
interactive: true
}, complete);
});
desc("Builds the source and generates a XPI");
task("xpi", ["build"], {async: true}, () => {
jake.exec([
`cd ${DIST_DIR}; jpm xpi`,
`cd ${DIST_DIR}; find . -not -name "*.xpi" -delete`
], {printStderr: true}, () => {
console.log(`.xpi was created in ${DIST_DIR}`);
complete();
});
});
================================================
FILE: LICENSE
================================================
NOTE: The menu button icons were imported from Firefox. Please see
data/assets/images/LICENSE for further information!
--------------------------------------------------------------------------------
Copyright (c) 2015 Dennis Schubert
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
Simplified Tab Groups for Firefox
=================================
**NOTE**: This project is currently unmaintained. If someone wants to take over, [check this discussion](https://github.com/denschub/firefox-tabgroups/issues/60#issuecomment-388541616) and drop me a note.
---
This project aims to provide a simple add-on to replace some functionalities
from TabView/Tab Groups/Panorama which were removed from Firefox due to a lot
of open bugs and a very low overall usage.
Installation
------------
The add-on is available at [addons.mozilla.org][amo] and should be installed
there to ensure the add-on stays updated.
Warning
-------
Please note that this extension is currently in a very unstable and untested
state and may kill your tabs or small kittens. While it may get improved and
secured in the future, I strongly advise you to make a backup of your important
tabs...
Building
--------
Assuming you have Node.js v5 installed on your machine, building this project
is rather easy.
1. Install the dependencies: `npm install`.
2. Run `./node_modules/.bin/jake build` to build all source files into the
`dist/` directory or run `./node_modules/.bin/jake run` to build the add-on
and start a Firefox instance for testing.
`jake run` uses `jpm` and you can pass additional parameters to it by setting
an environment variable, for example: `JPM_PARAMS="-b nightly" jake run`
Contributing
------------
Feel free to [fix some open issues][issues] and submit a pull request. Please
make sure to file the pull request against the `develop` branch, which should
be the default. Please make sure your code passes the coding styleguides by
running `jake lint` before submitting the PR.
If you want to help translating this add-on, feel free to alter or add new
files in `src/locale`. The extensions name and descriptions have to be changed
in `src/install.rdf`.
License
-------
MIT.
[amo]: https://addons.mozilla.org/en-US/firefox/addon/tab-groups/
[issues]: https://github.com/denschub/firefox-tabgroups/issues
================================================
FILE: package.json
================================================
{
"name": "tabgroups",
"author": "",
"license": "MIT",
"private": true,
"devDependencies": {
"jake": "^8.0.12",
"jpm": "^1.0.3"
}
}
================================================
FILE: src/.eslintignore
================================================
data/vendor/
bootstrap.js
================================================
FILE: src/.eslintrc.json
================================================
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true,
"mocha": true,
"node": true
},
"globals": {
"Cc": true,
"Ci": true,
"Components": true,
"Cr": true,
"Cu": true,
"EventEmitter": true,
"Services": true,
"Task": true,
"XPCNativeWrapper": true,
"XPCOMUtils": true,
"console": true,
"console": true,
"devtools": true,
"dump": true,
"exports": true,
"exports": true,
"loader": true,
"module": true,
"require": true,
"require": true,
"addon": true,
"ActionCreators": true,
"App": true,
"classNames": true,
"Group": true,
"GroupAddButton": true,
"GroupControls": true,
"GroupList": true,
"Immutable": true,
"React": true,
"ReactDOM": true,
"ReactRedux": true,
"Reducer": true,
"Redux": true,
"Tab": true,
"TabList": true
},
"rules": {
"block-scoped-var": 0,
"brace-style": [2, "1tbs", {"allowSingleLine": false}],
"camelcase": 2,
"comma-dangle": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"comma-style": [2, "last"],
"complexity": 1,
"consistent-return": 2,
"consistent-this": 0,
"curly": 2,
"default-case": 0,
"dot-location": [1, "property"],
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": 0,
"func-names": 0,
"func-style": 0,
"generator-star": 0,
"generator-star-spacing": [1, "after"],
"global-strict": 0,
"guard-for-in": 0,
"handle-callback-err": 0,
"indent": [2, 2, {"SwitchCase": 1}],
"key-spacing": [1, {"beforeColon": false, "afterColon": true}],
"keyword-spacing": 1,
"linebreak-style": 0,
"max-depth": 0,
"max-len": [1, 80],
"max-nested-callbacks": [2, 3],
"max-params": 0,
"max-statements": 0,
"new-cap": [2, {"capIsNew": false}],
"new-parens": 2,
"newline-after-var": 0,
"no-alert": 0,
"no-array-constructor": 2,
"no-bitwise": 0,
"no-caller": 2,
"no-catch-shadow": 1,
"no-comma-dangle": 0,
"no-cond-assign": 2,
"no-console": 0,
"no-constant-condition": 0,
"no-continue": 0,
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-div-regex": 0,
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-else-return": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-eq-null": 0,
"no-eval": 2,
"no-ex-assign": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 2,
"no-extra-strict": 0,
"no-fallthrough": 2,
"no-floating-decimal": 0,
"no-func-assign": 0,
"no-implied-eval": 0,
"no-inline-comments": 1,
"no-inner-declarations": 0,
"no-invalid-regexp": 0,
"no-irregular-whitespace": 0,
"no-iterator": 0,
"no-label-var": 0,
"no-labels": 0,
"no-lone-blocks": 0,
"no-lonely-if": 2,
"no-loop-func": 0,
"no-mixed-requires": 0,
"no-mixed-spaces-and-tabs": 2,
"no-multi-spaces": 1,
"no-multi-str": 1,
"no-multiple-empty-lines": [1, {"max": 1}],
"no-native-reassign": 2,
"no-negated-in-lhs": 0,
"no-nested-ternary": 2,
"no-new": 0,
"no-new-func": 0,
"no-new-object": 0,
"no-new-require": 0,
"no-new-wrappers": 0,
"no-obj-calls": 0,
"no-octal": 1,
"no-octal-escape": 0,
"no-param-reassign": 0,
"no-path-concat": 0,
"no-plusplus": 0,
"no-process-env": 0,
"no-process-exit": 0,
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-reserved-keys": 0,
"no-restricted-modules": 0,
"no-return-assign": 2,
"no-script-url": 0,
"no-self-compare": 2,
"no-sequences": 2,
"no-shadow": 1,
"no-shadow-restricted-names": 2,
"no-space-before-semi": 0,
"no-spaced-func": 1,
"no-sparse-arrays": 2,
"no-sync": 0,
"no-ternary": 0,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-undef-init": 0,
"no-undefined": 0,
"no-underscore-dangle": 0,
"no-unneeded-ternary": 2,
"no-unreachable": 2,
"no-unused-expressions": 0,
"no-unused-vars": 1,
"no-use-before-define": 0,
"no-var": 0,
"no-void": 0,
"no-warning-comments": 0,
"no-with": 2,
"no-wrap-func": 0,
"object-shorthand": 0,
"one-var": 0,
"operator-assignment": 0,
"operator-linebreak": 0,
"padded-blocks": [1, "never"],
"quote-props": 0,
"quotes": [1, "double", "avoid-escape"],
"radix": 2,
"semi": [1, "always"],
"semi-spacing": [1, {"before": false, "after": true}],
"sort-vars": 0,
"space-before-blocks": [1, "always"],
"space-before-function-paren": [1, "never"],
"space-before-function-parentheses": 0,
"space-in-brackets": 0,
"space-in-parens": [1, "never"],
"space-infix-ops": [1, {"int32Hint": true}],
"space-unary-ops": [1, { "words": true, "nonwords": false }],
"space-unary-word-ops": 0,
"spaced-comment": [1, "always"],
"strict": [2, "global"],
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
"vars-on-top": 0,
"wrap-iife": 0,
"wrap-regex": 0,
"yoda": 2
}
}
================================================
FILE: src/bootstrap.js
================================================
/**
* This Source Code is based on the original bootstrap.js generated by the
* add-on sdk which is subject to the terms of the Mozilla Public License, v.
* 2.0. You can obtain a copy of this license at http://mozilla.org/MPL/2.0/.
*/
"use strict";
const { utils: Cu } = Components;
const rootURI = __SCRIPT_URI_SPEC__.replace("bootstrap.js", "");
const COMMONJS_URI = "resource://gre/modules/commonjs";
const { require } = Cu.import(COMMONJS_URI + "/toolkit/require.js", {});
const { Bootstrap } = require(COMMONJS_URI + "/sdk/addon/bootstrap.js");
var { startup, shutdown, install, uninstall } = new Bootstrap(rootURI);
================================================
FILE: src/chrome.manifest
================================================
content simplified-tabgroups content/
================================================
FILE: src/content/icons/togglebutton/LICENSE
================================================
NOTE: Icons were imported from Firefox as the original TabView was
removed and those icons are no longer needed.
--------------------------------------------------------------------------------
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
================================================
FILE: src/data/action_creators.js
================================================
const ActionCreators = {
setTabgroups: function(tabgroups) {
return {
type: "TABGROUPS_RECEIVE",
tabgroups: tabgroups
};
},
setGroupCloseTimeout: function(timeout) {
return {
type: "GROUP_CLOSE_TIMEOUT_RECIEVE",
closeTimeout: timeout
};
}
};
================================================
FILE: src/data/assets/css/groupspanel.css
================================================
ul, li {
display: block;
margin: 0;
padding: 0;
}
li {
list-style-type: none;
cursor: move;
}
.group-title {
display: block;
overflow: hidden;
padding-right: 16px;
text-overflow: ellipsis;
white-space: nowrap;
}
.group.active .group-title, .tab.active {
font-weight: bold;
}
.group:hover .group-title {
padding-right: 15px;
}
.group-title input {
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.12);
margin: 0;
padding: 1px;
width: calc(100% - 25px);
}
.group, .tab {
border-radius: 3px;
border: 1px solid transparent;
cursor: pointer;
padding: 5px;
position: relative;
}
.tab {
padding: 0;
}
.group:hover, .tab:hover {
background-color: rgba(0, 0, 0, 0.06);
border-color: rgba(0, 0, 0, 0.12);
}
.group.dragSourceGroup {
border: inherit;
background-color : inherit;
}
.group.draggingOver, .draggingOver {
border: 1px dashed #ccc;
background-color: rgba(0, 0, 0, 0.04);
}
.tab-list {
display: none;
margin-top: 5px;
}
.expanded .tab-list {
display: block;
}
.tab-title {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: calc(100% - 32px);
padding: 5px 5px 1px;
margin-bottom: 1px;
}
.tab-icon {
height: 16px;
width: 16px;
margin-right: 1px;
margin-bottom: 1px;
margin-left: 4px;
}
.tab-icon:-moz-broken {
background: url("chrome://mozapps/skin/places/defaultFavicon.png");
background-size: contain;
display: inline-block;
}
@media (min-resolution: 1.1dppx) {
.tab-icon:-moz-broken {
background-image: url("chrome://mozapps/skin/places/defaultFavicon@2x.png");
}
}
.expanded .group-title {
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
padding-bottom: 5px;
}
.group-controls {
display: inline-block;
font-size: 120%;
opacity: 0.7;
position: absolute;
right: 5px;
top: 4px;
}
.group.editing .group-controls {
top: 6px;
}
.group.closing .group-controls .group-close,
.group.closing:hover .group-controls .group-close,
.group.closing .group-controls .fa-chevron-down,
.group.closing .group-controls .group-edit {
display: none;
}
.group.closing .group-title {
color: #ccc;
text-decoration: line-through;
}
.group:hover .group-title {
padding-right: 55px;
}
.group .group-controls .group-close,
.group .group-controls .group-edit {
display: none;
}
.group:hover .group-controls .group-close,
.group:hover .group-controls .group-edit {
display: inline-block;
}
================================================
FILE: src/data/components/app.js
================================================
const App = React.createClass({
propTypes: {
onGroupAddClick: React.PropTypes.func,
onGroupAddDrop: React.PropTypes.func,
onGroupClick: React.PropTypes.func,
onGroupDrop: React.PropTypes.func,
onGroupCloseClick: React.PropTypes.func,
onGroupTitleChange: React.PropTypes.func,
onTabClick: React.PropTypes.func,
onTabDrag: React.PropTypes.func,
onTabDragStart: React.PropTypes.func,
uiHeightChanged: React.PropTypes.func
},
render: function() {
return React.createElement(GroupList, this.props);
}
});
================================================
FILE: src/data/components/group.js
================================================
const Group = React.createClass({
propTypes: {
closeTimeout: React.PropTypes.number,
group: React.PropTypes.object.isRequired,
onGroupClick: React.PropTypes.func,
onGroupDrop: React.PropTypes.func,
onGroupCloseClick: React.PropTypes.func,
onGroupTitleChange: React.PropTypes.func,
onTabClick: React.PropTypes.func,
onTabDrag: React.PropTypes.func,
onTabDragStart: React.PropTypes.func,
uiHeightChanged: React.PropTypes.func
},
getInitialState: function() {
return {
closing: false,
editing: false,
expanded: false,
draggingOverCounter: 0,
dragSourceGroup: false,
newTitle: this.getTitle()
};
},
componentDidUpdate: function() {
this.props.uiHeightChanged && this.props.uiHeightChanged();
},
getTitle: function() {
return this.props.group.title || (
addon.options.l10n.unnamed_group + " " + this.props.group.id
);
},
render: function() {
let titleElement;
if (this.state.editing) {
titleElement = React.DOM.input(
{
type: "text",
defaultValue: this.getTitle(),
onChange: (event) => {
this.setState({newTitle: event.target.value});
},
onClick: (event) => {
event.stopPropagation();
},
onKeyUp: this.handleGroupTitleInputKey
}
);
} else {
titleElement = React.DOM.span({}, this.getTitle());
}
let groupClasses = classNames({
active: this.props.group.active,
editing: this.state.editing,
closing: this.state.closing,
draggingOver: this.state.draggingOverCounter !== 0,
dragSourceGroup: this.state.dragSourceGroup,
expanded: this.state.expanded,
group: true
});
return (
React.DOM.li(
{
className: groupClasses,
onClick: this.handleGroupClick,
onDragOver: this.handleGroupDragOver,
onDragEnter: this.handleGroupDragEnter,
onDragLeave: this.handleGroupDragLeave,
onDrop: this.handleGroupDrop
},
React.DOM.span(
{
className: "group-title"
},
titleElement,
React.createElement(
GroupControls,
{
closing: this.state.closing,
editing: this.state.editing,
expanded: this.state.expanded,
onClose: this.handleGroupCloseClick,
onEdit: this.handleGroupEditClick,
onEditAbort: this.handleGroupEditAbortClick,
onEditSave: this.handleGroupEditSaveClick,
onExpand: this.handleGroupExpandClick,
onUndoCloseClick: this.handleGroupCloseAbortClick
}
)
),
this.state.expanded && React.createElement(
TabList,
{
tabs: this.props.group.tabs,
onTabClick: this.props.onTabClick,
onTabDrag: this.props.onTabDrag,
onTabDragStart: this.props.onTabDragStart,
onTabDragEnd: this.props.onTabDragEnd
}
)
)
);
},
handleGroupCloseClick: function(event) {
event.stopPropagation();
this.setState({editing: false});
this.setState({closing: true});
let group = this;
if (this.props.closeTimeout == 0) {
group.props.onGroupCloseClick(group.props.group.id);
return;
}
setTimeout(function() {
group.props.onGroupCloseClick(group.props.group.id);
}, this.props.closeTimeout * 1000);
},
handleGroupClick: function(event) {
event.stopPropagation();
this.props.onGroupClick(this.props.group.id);
},
handleGroupEditClick: function(event) {
event.stopPropagation();
this.setState({editing: !this.state.editing});
},
handleGroupEditAbortClick: function(event) {
event.stopPropagation();
this.setState({editing: false});
},
handleGroupEditSaveClick: function(event) {
event.stopPropagation();
this.setState({editing: false});
this.props.onGroupTitleChange(this.props.group.id, this.state.newTitle);
},
handleGroupExpandClick: function(event) {
event.stopPropagation();
this.setState({expanded: !this.state.expanded});
},
handleGroupTitleInputKey: function(event) {
if (event.keyCode == 13) {
this.setState({editing: false});
this.props.onGroupTitleChange(this.props.group.id, this.state.newTitle);
}
},
handleGroupDrop: function(event) {
event.stopPropagation();
this.setState({draggingOverCounter: 0});
let sourceGroup = event.dataTransfer.getData("tab/group");
let tabIndex = event.dataTransfer.getData("tab/index");
this.props.onGroupDrop(
sourceGroup,
tabIndex,
this.props.group.id
);
},
handleGroupDragOver: function(event) {
event.stopPropagation();
event.preventDefault();
return false;
},
handleGroupDragEnter: function(event) {
event.stopPropagation();
event.preventDefault();
let sourceGroupId = event.dataTransfer.getData("tab/group");
let isSourceGroup = sourceGroupId == this.props.group.id;
this.setState({dragSourceGroup: isSourceGroup});
let draggingCounterValue = (this.state.draggingOverCounter == 1) ? 2 : 1;
this.setState({draggingOverCounter: draggingCounterValue});
},
handleGroupDragLeave: function(event) {
event.stopPropagation();
event.preventDefault();
if (this.state.draggingOverCounter == 2) {
this.setState({draggingOverCounter: 1});
} else if (this.state.draggingOverCounter == 1) {
this.setState({draggingOverCounter: 0});
}
return false;
},
handleGroupCloseAbortClick: function(event) {
event.stopPropagation();
this.setState({closing: false});
}
});
================================================
FILE: src/data/components/groupaddbutton.js
================================================
const GroupAddButton = React.createClass({
propTypes: {
onClick: React.PropTypes.func,
onDrop: React.PropTypes.func
},
getInitialState: function() {
return {
draggingOverCounter: 0
};
},
render: function() {
let buttonClasses = classNames({
draggingOver: this.state.draggingOverCounter !== 0,
group: true
});
return (
React.DOM.li(
{
className: buttonClasses,
onClick: this.handleClick,
onDrop: this.handleDrop,
onDragOver: this.handleGroupDragOver,
onDragEnter: this.handleDragEnter,
onDragLeave: this.handleDragLeave
},
React.DOM.span(
{className: "group-title"},
addon.options.l10n.add_group
)
)
);
},
handleClick: function(event) {
event.stopPropagation();
this.props.onClick();
},
handleGroupDragOver: function(event) {
event.stopPropagation();
event.preventDefault();
},
handleDragEnter: function(event) {
event.stopPropagation();
event.preventDefault();
let draggingCounterValue = (this.state.draggingOverCounter == 1) ? 2 : 1;
this.setState({draggingOverCounter: draggingCounterValue});
},
handleDragLeave: function(event) {
event.stopPropagation();
event.preventDefault();
if (this.state.draggingOverCounter == 2) {
this.setState({draggingOverCounter: 1});
} else if (this.state.draggingOverCounter == 1) {
this.setState({draggingOverCounter: 0});
}
},
handleDrop: function(event) {
event.stopPropagation();
this.setState({draggingOverCounter: 0});
let sourceGroup = event.dataTransfer.getData("tab/group");
let tabIndex = event.dataTransfer.getData("tab/index");
this.props.onDrop(
sourceGroup,
tabIndex
);
}
});
================================================
FILE: src/data/components/groupcontrols.js
================================================
const GroupControls = React.createClass({
propTypes: {
expanded: React.PropTypes.bool.isRequired,
onClose: React.PropTypes.func,
onEdit: React.PropTypes.func,
onEditAbort: React.PropTypes.func,
onEditSave: React.PropTypes.func,
onExpand: React.PropTypes.func,
onUndoCloseClick: React.PropTypes.func
},
getEditControls: function() {
let controls;
if (this.props.editing) {
controls = [
React.DOM.i({
className: "group-edit fa fa-fw fa-check",
onClick: this.props.onEditSave
}),
React.DOM.i({
className: "group-edit fa fa-fw fa-ban",
onClick: this.props.onEditAbort
})
];
} else {
controls = React.DOM.i({
className: "group-edit fa fa-fw fa-pencil",
onClick: this.props.onEdit
});
}
return controls;
},
getClosingControls: function() {
return [
React.DOM.i({
className: "group-close-undo fa fa-fw fa-undo",
onClick: this.props.onUndoCloseClick
})
];
},
render: function() {
let groupControls;
if (this.props.closing) {
groupControls = this.getClosingControls();
} else {
groupControls = this.getEditControls();
}
let expanderClasses = classNames({
"group-expand": true,
"fa": true,
"fa-fw": true,
"fa-chevron-down": !this.props.expanded,
"fa-chevron-up": this.props.expanded
});
return React.DOM.span(
{
className: "group-controls"
},
groupControls,
React.DOM.i({
className: "group-close fa fa-fw fa-times",
onClick: this.props.onClose
}),
React.DOM.i({
className: expanderClasses,
onClick: this.props.onExpand
})
);
}
});
================================================
FILE: src/data/components/grouplist.js
================================================
const GroupList = (() => {
const GroupListStandalone = React.createClass({
propTypes: {
groups: React.PropTypes.object.isRequired,
closeTimeout: React.PropTypes.number,
onGroupAddClick: React.PropTypes.func,
onGroupAddDrop: React.PropTypes.func,
onGroupClick: React.PropTypes.func,
onGroupDrop: React.PropTypes.func,
onGroupCloseClick: React.PropTypes.func,
onGroupTitleChange: React.PropTypes.func,
onTabClick: React.PropTypes.func,
onTabDrag: React.PropTypes.func,
onTabDragStart: React.PropTypes.func,
uiHeightChanged: React.PropTypes.func
},
componentDidUpdate: function() {
this.props.uiHeightChanged && this.props.uiHeightChanged();
},
render: function() {
return React.DOM.ul(
{className: "group-list"},
this.props.groups.map((group) => {
return React.createElement(Group, {
key: group.id,
group: group,
closeTimeout: this.props.closeTimeout,
onGroupClick: this.props.onGroupClick,
onGroupDrop: this.props.onGroupDrop,
onGroupCloseClick: this.props.onGroupCloseClick,
onGroupTitleChange: this.props.onGroupTitleChange,
onTabClick: this.props.onTabClick,
onTabDrag: this.props.onTabDrag,
onTabDragStart: this.props.onTabDragStart,
uiHeightChanged: this.props.uiHeightChanged
});
}),
React.createElement(
GroupAddButton,
{
onClick: this.props.onGroupAddClick,
onDrop: this.props.onGroupAddDrop
}
)
);
}
});
return ReactRedux.connect((state) => {
return {
groups: state.get("tabgroups"),
closeTimeout: state.get("closeTimeout")
};
}, ActionCreators)(GroupListStandalone);
})();
================================================
FILE: src/data/components/tab.js
================================================
const Tab = React.createClass({
propTypes: {
onTabClick: React.PropTypes.func,
onTabDrag: React.PropTypes.func,
onTabDragStart: React.PropTypes.func,
tab: React.PropTypes.object.isRequired
},
render: function() {
let favicon = React.DOM.img({
alt: "",
className: "tab-icon",
src: this.props.tab.icon
});
let tabClasses = classNames({
active: this.props.tab.active,
tab: true
});
return (
React.DOM.li(
{
className: tabClasses,
onClick: this.handleTabClick,
onDrag: this.handleTabDrag,
onDragStart: this.handleTabDragStart,
draggable: true
},
favicon,
React.DOM.span({className: "tab-title"}, this.props.tab.title)
)
);
},
handleTabClick: function(event) {
event.stopPropagation();
let tab = this.props.tab;
this.props.onTabClick(
tab.group,
tab.index
);
},
handleTabDrag: function(event) {
event.stopPropagation();
let tab = this.props.tab;
event.dataTransfer.setData("tab/index", tab.index);
event.dataTransfer.setData("tab/group", tab.group);
this.props.onTabDrag(
tab.group,
tab.index
);
},
handleTabDragStart: function(event) {
event.stopPropagation();
let tab = this.props.tab;
event.dataTransfer.setData("tab/index", tab.index);
event.dataTransfer.setData("tab/group", tab.group);
this.props.onTabDragStart(
tab.group,
tab.index
);
}
});
================================================
FILE: src/data/components/tablist.js
================================================
const TabList = React.createClass({
propTypes: {
onTabClick: React.PropTypes.func,
onTabDrag: React.PropTypes.func,
onTabDragStart: React.PropTypes.func,
tabs: React.PropTypes.array.isRequired
},
render: function() {
return (
React.DOM.ul(
{className: "tab-list"},
this.props.tabs.map((tab) => {
return React.createElement(Tab, {
key: tab.index,
tab: tab,
onTabClick: this.props.onTabClick,
onTabDrag: this.props.onTabDrag,
onTabDragStart: this.props.onTabDragStart,
uiHeightChanged: this.props.uiHeightChanged
});
})
)
);
}
});
================================================
FILE: src/data/groupspanel.html
================================================
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="vendor/js/classnames.min.js"></script>
<script src="vendor/js/immutable.min.js"></script>
<script src="vendor/js/react.min.js"></script>
<script src="vendor/js/react-dom.min.js"></script>
<script src="vendor/js/redux.min.js"></script>
<script src="vendor/js/react-redux.min.js"></script>
<script src="action_creators.js"></script>
<script src="reducer.js"></script>
<script src="components/app.js"></script>
<script src="components/group.js"></script>
<script src="components/groupaddbutton.js"></script>
<script src="components/groupcontrols.js"></script>
<script src="components/grouplist.js"></script>
<script src="components/tab.js"></script>
<script src="components/tablist.js"></script>
<script src="groupspanel.js"></script>
<link rel="stylesheet" href="vendor/css/font-awesome.css">
<link rel="stylesheet" href="assets/css/groupspanel.css">
</head>
<body>
<div id="content"></div>
</body>
</html>
================================================
FILE: src/data/groupspanel.js
================================================
const store = Redux.createStore(Reducer);
const Actions = {
addGroup: function() {
addon.port.emit("Group:Add");
},
addGroupWithTab: function(sourceGroupID, tabIndex) {
addon.port.emit("Group:AddWithTab", {sourceGroupID, tabIndex});
},
closeGroup: function(groupID) {
addon.port.emit("Group:Close", {groupID});
},
uiHeightChanged: function() {
addon.port.emit("UI:Resize", {
width: document.body.clientWidth,
height: document.body.clientHeight
});
},
renameGroup: function(groupID, title) {
addon.port.emit("Group:Rename", {groupID, title});
},
selectGroup: function(groupID) {
addon.port.emit("Group:Select", {groupID});
},
moveTabToGroup: function(sourceGroupID, tabIndex, targetGroupID) {
addon.port.emit("Group:Drop", {sourceGroupID, tabIndex, targetGroupID});
},
selectTab: function(groupID, tabIndex) {
addon.port.emit("Tab:Select", {groupID, tabIndex});
},
dragTab: function(groupID, tabIndex) {
addon.port.emit("Tab:Drag", {groupID, tabIndex});
},
dragTabStart: function(groupID, tabIndex) {
addon.port.emit("Tab:DragStart", {groupID, tabIndex});
}
};
document.addEventListener("DOMContentLoaded", () => {
ReactDOM.render(
React.createElement(
ReactRedux.Provider,
{store: store},
React.createElement(App, {
onGroupAddClick: Actions.addGroup,
onGroupAddDrop: Actions.addGroupWithTab,
onGroupClick: Actions.selectGroup,
onGroupDrop: Actions.moveTabToGroup,
onGroupCloseClick: Actions.closeGroup,
onGroupTitleChange: Actions.renameGroup,
onTabClick: Actions.selectTab,
onTabDrag: Actions.dragTab,
onTabDragStart: Actions.dragTabStart,
uiHeightChanged: Actions.uiHeightChanged
})
),
document.getElementById("content")
);
});
addon.port.on("Groups:Changed", (tabgroups) => {
store.dispatch(ActionCreators.setTabgroups(tabgroups));
});
addon.port.on("Groups:CloseTimeoutChanged", (timeout) => {
store.dispatch(ActionCreators.setGroupCloseTimeout(timeout));
});
================================================
FILE: src/data/reducer.js
================================================
const INITIAL_STATE = Immutable.fromJS({
tabgroups: [],
closeTimeout: 0
});
const Reducer = function(state = INITIAL_STATE, action) {
switch (action.type) {
case "TABGROUPS_RECEIVE":
return state.set("tabgroups", Immutable.fromJS(action.tabgroups));
case "GROUP_CLOSE_TIMEOUT_RECIEVE":
return state.set("closeTimeout", action.closeTimeout);
}
return state;
};
================================================
FILE: src/data/vendor/css/font-awesome.css
================================================
/*!
* Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
/* FONT PATH
* -------------------------- */
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome.eot?v=4.4.0');
src: url('../fonts/fontawesome.eot?#iefix&v=4.4.0') format('embedded-opentype'), url('../fonts/fontawesome.woff?v=4.4.0') format('woff'), url('../fonts/fontawesome.ttf?v=4.4.0') format('truetype'), url('../fonts/fontawesome.svg?v=4.4.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* makes the font 33% larger relative to the icon container */
.fa-lg {
font-size: 1.33333333em;
line-height: 0.75em;
vertical-align: -15%;
}
.fa-2x {
font-size: 2em;
}
.fa-3x {
font-size: 3em;
}
.fa-4x {
font-size: 4em;
}
.fa-5x {
font-size: 5em;
}
.fa-fw {
width: 1.28571429em;
text-align: center;
}
.fa-check:before { content: "\f00c"; }
.fa-remove:before, .fa-close:before, .fa-times:before { content: "\f00d"; }
.fa-pencil:before { content: "\f040"; }
.fa-ban:before { content: "\f05e"; }
.fa-plus:before { content: "\f067"; }
.fa-minus:before { content: "\f068"; }
.fa-chevron-up:before { content: "\f077"; }
.fa-chevron-down:before { content: "\f078"; }
.fa-undo:before { content: "\f079"; }
================================================
FILE: src/index.js
================================================
const self = require("sdk/self");
const _ = require("sdk/l10n").get;
const {Hotkey} = require("sdk/hotkeys");
const {Panel} = require("sdk/panel");
const Prefs = require("sdk/simple-prefs");
const TabsUtils = require("sdk/tabs/utils");
const Tabs = require("sdk/tabs");
const {ToggleButton} = require("sdk/ui/button/toggle");
const WindowUtils = require("sdk/window/utils");
const Utils = require("lib/utils");
const {SessionStorage} = require("lib/storage/session");
const {TabManager} = require("lib/tabmanager");
function TabGroups() {
this._groupsPanel = null;
this._hotkeyOpen = null;
this._hotkeyNextGroup = null;
this._hotkeyPrevGroup = null;
this._panelButton = null;
this._tabs = new TabManager(new SessionStorage());
this.init();
this.bindEvents();
}
TabGroups.prototype = {
init: function() {
this.createPanelButton();
this.createGroupsPanel();
this.createOpenHotkey();
this.createNavigationHotkey();
},
bindEvents: function() {
this.bindHotkeyPreference();
this.bindGroupPreference();
this.bindPanelButtonEvents();
this.bindPanelEvents();
this.bindTabEvents();
},
createGroupsPanel: function() {
this._groupsPanel = Panel({
height: 1,
contentURL: self.data.url("groupspanel.html"),
contentScriptOptions: {
l10n: Utils.getL10nStrings([
"add_group",
"unnamed_group"
]),
groupCloseTimeout: Prefs.prefs.groupCloseTimeout
}
});
},
createPanelButton: function() {
let iconBase = "chrome://simplified-tabgroups/content/icons/togglebutton/";
let toolBarButton = Utils.themeSwitch({
dark: iconBase + "icon-inverted-32.png",
light: iconBase + "icon-32.png"
});
this._panelButton = ToggleButton({
id: "tabgroups-show",
icon: {
"16": toolBarButton,
"32": toolBarButton,
"64": iconBase + "icon-64.png"
},
label: _("panelButton_label")
});
},
createOpenHotkey: function() {
if (!Prefs.prefs.bindPanoramaShortcut) {
return;
}
/**
* Note: since this is intended to be released after 1222490 has landed,
* it is perfectly save to assume accel-shift-e is not used by anything
* else.
*/
this._hotkeyOpen = Hotkey({
combo: "accel-shift-e",
onPress: () => {
if (this._groupsPanel.isShowing) {
this._groupsPanel.hide();
} else {
this._groupsPanel.show({position: this._panelButton});
this._panelButton.state("window", {checked: true});
}
}
});
},
createNavigationHotkey: function() {
if (!Prefs.prefs.bindNavigationShortcut) {
return;
}
this._hotkeyNextGroup = Hotkey({
combo: "control-`",
onPress: () => {
this._tabs.selectNextPrevGroup(
this._getWindow(),
this._getTabBrowser(),
1
);
}
});
this._hotkeyPrevGroup = Hotkey({
combo: "control-shift-`",
onPress: () => {
this._tabs.selectNextPrevGroup(
this._getWindow(),
this._getTabBrowser(),
-1
);
}
});
},
bindHotkeyPreference: function() {
if (Prefs.prefs.bindPanoramaShortcut) {
this.createOpenHotkey();
}
if (Prefs.prefs.bindNavigationShortcut) {
this.createNavigationHotkey();
}
Prefs.on("bindPanoramaShortcut", () => {
if (Prefs.prefs.bindPanoramaShortcut) {
if (!this._hotkeyOpen) {
this.createOpenHotkey();
}
} else if (this._hotkeyOpen) {
this._hotkeyOpen.destroy();
this._hotkeyOpen = null;
}
});
Prefs.on("bindNavigationShortcut", () => {
if (Prefs.prefs.bindNavigationShortcut) {
if (!this._hotkeyNextGroup) {
this.createNavigationHotkey();
}
} else {
if (this._hotkeyNextGroup) {
this._hotkeyNextGroup.destroy();
this._hotkeyNextGroup = null;
}
if (this._hotkeyPrevGroup) {
this._hotkeyPrevGroup.destroy();
this._hotkeyPrevGroup = null;
}
}
});
},
bindGroupPreference: function() {
let emitCloseTimeoutChange = () => {
this._groupsPanel.port.emit("Groups:CloseTimeoutChanged", Prefs.prefs.groupCloseTimeout);
};
Prefs.on("groupCloseTimeout", emitCloseTimeoutChange);
emitCloseTimeoutChange();
},
bindPanelButtonEvents: function() {
this._panelButton.on("change", (state) => {
if (!state.checked) {
this._groupsPanel.hide();
} else {
if (this._groupsPanel.isShowing) {
this._groupsPanel.hide();
}
this._groupsPanel.show({position: this._panelButton});
}
});
},
bindPanelEvents: function() {
this._groupsPanel.on("hide", () => {
this._panelButton.state("window", {checked: false});
});
this._groupsPanel.on("show", this.refreshUi.bind(this));
this._groupsPanel.port.on("Group:Add", this.onGroupAdd.bind(this));
this._groupsPanel.port.on("Group:AddWithTab", this.onGroupAddWithTab.bind(this));
this._groupsPanel.port.on("Group:Close", this.onGroupClose.bind(this));
this._groupsPanel.port.on("Group:Rename", this.onGroupRename.bind(this));
this._groupsPanel.port.on("Group:Select", this.onGroupSelect.bind(this));
this._groupsPanel.port.on("Group:Drop", this.onGroupDrop.bind(this));
this._groupsPanel.port.on("Tab:Select", this.onTabSelect.bind(this));
this._groupsPanel.port.on("UI:Resize", this.resizePanel.bind(this));
},
bindTabEvents: function() {
Tabs.on("activate", () => {
let window = this._getWindow();
this._tabs.updateCurrentSelectedTab(window);
this._tabs.updateCurrentSelectedGroup(window);
});
Tabs.on("open", () => {
this._tabs.updateCurrentSelectedTab(this._getWindow());
});
},
refreshUi: function() {
let groups = this._tabs.getGroupsWithTabs(this._getWindow(), Prefs.prefs.enableAlphabeticSort);
this._groupsPanel.port.emit("Groups:Changed", groups);
},
resizePanel: function(dimensions) {
this._groupsPanel.resize(
this._groupsPanel.width,
dimensions.height + 18
);
},
onGroupAdd: function() {
this._tabs.addGroup(
this._getWindow()
);
this.refreshUi();
},
onGroupAddWithTab: function(event) {
this._tabs.addGroupWithTab(
this._getWindow(),
this._getTabBrowser(),
event.tabIndex
);
this.refreshUi();
},
onGroupClose: function(event) {
this._tabs.closeGroup(
this._getWindow(),
this._getTabBrowser(),
event.groupID
);
this.refreshUi();
},
onGroupRename: function(event) {
this._tabs.renameGroup(
this._getWindow(),
event.groupID,
event.title
);
this.refreshUi();
},
onGroupSelect: function(event) {
this._tabs.selectGroup(
this._getWindow(),
this._getTabBrowser(),
event.groupID
);
this.refreshUi();
},
onTabSelect: function(event) {
this._tabs.selectTab(
this._getWindow(),
this._getTabBrowser(),
event.tabIndex,
event.groupID
);
this.refreshUi();
},
onGroupDrop: function(event) {
this._tabs.moveTabToGroup(
this._getWindow(),
this._getTabBrowser(),
event.tabIndex,
event.targetGroupID
);
this.refreshUi();
},
_getWindow: function() {
return WindowUtils.getMostRecentBrowserWindow();
},
_getTabBrowser: function() {
return TabsUtils.getTabBrowser(this._getWindow());
}
};
new TabGroups();
================================================
FILE: src/install.rdf
================================================
<?xml version="1.0" encoding="utf-8"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>tabgroups@schub.io</em:id>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>
<em:version>0.6.0-dev</em:version>
<em:optionsURL>data:text/xml,<placeholder/></em:optionsURL>
<em:optionsType>2</em:optionsType>
<em:targetApplication>
<Description>
<!-- Firefox -->
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>44.0a1</em:minVersion>
<em:maxVersion>*</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>Simplified Tab Groups</em:name>
<em:description>Provides tab grouping features similar to the removed TabView/TabGroups/Panorama features.</em:description>
<em:creator>Dennis Schubert <mozilla@dennis-schubert.de></em:creator>
<em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>
<em:iconURL>chrome://simplified-tabgroups/content/icons/extension-32.png</em:iconURL>
<em:icon64URL>chrome://simplified-tabgroups/content/icons/extension-32.png</em:icon64URL>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
<em:localized>
<Description>
<em:locale>de-DE</em:locale>
<em:name>Einfache Tab-Gruppen</em:name>
<em:description>Ermöglicht die Gruppierung von Tabs ähnlich den entfernten Panorama-Funktionen</em:description>
<em:creator>Dennis Schubert <mozilla@dennis-schubert.de></em:creator>
<em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>
</Description>
</em:localized>
<em:localized>
<Description>
<em:locale>fr-FR</em:locale>
<em:name>Simplified Tab Groups</em:name>
<em:description>Permet de remplacer la gestion des groupes d'onglets supprimée suite à l'abandon de Panorama.</em:description>
<em:creator>Dennis Schubert <mozilla@dennis-schubert.de></em:creator>
<em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>
</Description>
</em:localized>
<em:localized>
<Description>
<em:locale>es-AR</em:locale>
<em:name>Grupos de pestañas simplificados</em:name>
<em:description>Provee la funcionalidad de gestionar grupos de pestañas similar a la funcionalidad removida de TabView/TabGroups/Panorama.</em:description>
<em:creator>Dennis Schubert <mozilla@dennis-schubert.de></em:creator>
<em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>
</Description>
</em:localized>
<em:localized>
<Description>
<em:locale>es-ES</em:locale>
<em:name>Grupos de pestañas simplificados</em:name>
<em:description>Provee la funcionalidad de gestionar grupos de pestañas similar a la funcionalidad removida de TabView/TabGroups/Panorama.</em:description>
<em:creator>Dennis Schubert <mozilla@dennis-schubert.de></em:creator>
<em:homepageURL>https://github.com/denschub/firefox-tabgroups</em:homepageURL>
</Description>
</em:localized>
</Description>
</RDF>
================================================
FILE: src/lib/storage/session.js
================================================
const {Cc, Ci} = require("chrome");
const TabsUtils = require("sdk/tabs/utils");
function SessionStorage() {
this._store = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore);
}
/**
* Note: This is an implementation of the existing Panorama storage using
* SessionStore so we are able to reuse the existing groups.
*
* This will eventually get replaced by the SDKs simple-storage or something
* similar.
*/
SessionStorage.prototype = {
/**
* Returns an array of available groups.
*
* @param {ChromeWindow} chromeWindow
* @returns {Array}
*/
getGroups: function(chromeWindow) {
let groupsData = this._getGroupsData(chromeWindow);
let currentGroup = this._getCurrentGroupData(chromeWindow);
if (Object.keys(groupsData).length == 0) {
this.addGroup(chromeWindow);
groupsData = this._getGroupsData(chromeWindow);
}
let groups = [];
for (let groupIndex in groupsData) {
let group = groupsData[groupIndex];
groups.push({
active: group.id == currentGroup.activeGroupId,
id: group.id,
title: group.title,
selectedIndex: group.selectedIndex
});
}
return groups;
},
/**
* Returns all tabs.
*
* @param {ChromeWindow} chromeWindow
* @returns {Array}
*/
getTabs: function(chromeWindow) {
let browser = TabsUtils.getTabBrowser(chromeWindow);
let tabs = [];
let currentGroup = this.getCurrentGroup(chromeWindow);
for (let tabIndex = 0; tabIndex < browser.tabs.length; tabIndex++) {
let tab = browser.tabs[tabIndex];
let tabData = this._getTabData(tab);
let tabState = this._getTabState(tab);
if (tabState.pinned) {
continue;
}
let group = currentGroup;
if (tabData && tabData.groupID) {
group = tabData.groupID;
} else {
this.setTabGroup(tab, group);
}
tabs.push({
active: tab.selected,
group: group,
icon: browser.getIcon(tab),
index: tabIndex,
title: tab.label
});
}
return tabs;
},
/**
* Returns all tab indexes in the specified group.
*
* @param {TabBrowser} tabBrowser
* @param {Number} groupID
* @returns {Array}
*/
getTabIndexesByGroup: function(tabBrowser, targetGroupId) {
let tabs = [];
for (let tabIndex = 0; tabIndex < tabBrowser.tabs.length; tabIndex++) {
let tab = tabBrowser.tabs[tabIndex];
let tabData = this._getTabData(tab);
let tabState = this._getTabState(tab);
let group = 0;
if (tabData && tabData.groupID) {
group = tabData.groupID;
}
if (tabState.pinned || group != targetGroupId) {
continue;
}
tabs.push(tabIndex);
}
return tabs;
},
/**
* Returns the ID of the current group.
*
* @param {ChromeWindow} chromeWindow
* @returns {Number}
*/
getCurrentGroup: function(chromeWindow) {
let groupData = this._getCurrentGroupData(chromeWindow);
return groupData.activeGroupId || 0;
},
/**
* Returns the ID of the current group.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID
*/
setCurrentGroup: function(chromeWindow, groupID) {
let groupData = this._getCurrentGroupData(chromeWindow);
groupData.activeGroupId = groupID;
this._setCurrentGroupData(chromeWindow, groupData);
},
/**
* Assigns a tab to a group.
*
* @param {XULElement} tab
* @param {Number} groupID
*/
setTabGroup: function(tab, groupID) {
this._setTabData(
tab,
Object.assign({}, this._getTabData(tab), {groupID})
);
},
/**
* Returns the next possible GroupID.
*
* @param {ChromeWindow} chromeWindow
* @returns {Number}
*/
getNextGroupID: function(chromeWindow) {
let groupData = this._getCurrentGroupData(chromeWindow);
let id = groupData.nextID;
groupData.nextID++;
this._setCurrentGroupData(chromeWindow, groupData);
return id;
},
/**
* Creates a new tab group.
*
* @param {ChromeWindow} chromeWindow
* @param {String} title - defaults to an empty string
*/
addGroup: function(chromeWindow, title = "") {
let groups = this._getGroupsData(chromeWindow);
let groupID = this.getNextGroupID(chromeWindow);
groups[groupID] = {
id: groupID,
title: title,
selectedIndex: 0
};
let currentGroups = this._getCurrentGroupData(chromeWindow);
currentGroups.totalNumber++;
this._setGroupsData(chromeWindow, groups);
this._setCurrentGroupData(chromeWindow, currentGroups);
},
/**
* Removes tabs from a specified group.
*
* @param {TabBrowser} tabBrowser
* @param {Number} groupID
*/
removeGroupTabs: function(tabBrowser, groupID) {
let tabsToRemove = [];
for (let tabIndex = 0; tabIndex < tabBrowser.tabs.length; tabIndex++) {
let tab = tabBrowser.tabs[tabIndex];
let tabData = this._getTabData(tab);
if (tabData && tabData.groupID && tabData.groupID == groupID) {
tabsToRemove.push(tab);
}
}
tabsToRemove.forEach((tab) => {
tabBrowser.removeTab(tab);
});
},
/**
* Removes a tab group from the storage.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID
*/
removeGroup: function(chromeWindow, groupID) {
let groups = this._getGroupsData(chromeWindow);
delete groups[groupID];
let currentGroups = this._getCurrentGroupData(chromeWindow);
currentGroups.totalNumber -= 1;
this._setGroupsData(chromeWindow, groups);
this._setCurrentGroupData(chromeWindow, currentGroups);
},
/**
* Renames a group.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID - the groupID
* @param {String} title - the new title
*/
renameGroup: function(chromeWindow, groupID, title) {
let groupsData = this._getGroupsData(chromeWindow);
groupsData[groupID].title = title;
this._setGroupsData(chromeWindow, groupsData);
},
/**
* Get the selected tab index for a group.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID - the groupID
*/
getGroupSelectedIndex: function(chromeWindow, groupID) {
let groupsData = this._getGroupsData(chromeWindow);
let currentGroup = groupsData[groupID];
return currentGroup == null ? 0 : currentGroup.selectedIndex;
},
/**
* Set the selected tab index for a group.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID - the groupID
* @param {Number} index - the new selected index
*/
setGroupSelectedIndex: function(chromeWindow, groupID, index) {
let groupsData = this._getGroupsData(chromeWindow);
let currentGroup = groupsData[groupID];
if (currentGroup != null) {
currentGroup.selectedIndex = index;
this._setGroupsData(chromeWindow, groupsData);
}
},
/**
* Returns the data for a tab.
*
* @param {XULElement} tab
* @returns {Object}
*/
_getTabData: function(tab) {
return this._parseOptionalJson(
this._store.getTabValue(tab, "tabview-tab")
);
},
/**
* Stores the data for a tab.
*
* @param {XULElement} tab
* @param {Object} data
* @returns {Object}
*/
_setTabData: function(tab, data) {
this._stopTabView(tab.ownerDocument.defaultView);
this._store.setTabValue(
tab,
"tabview-tab",
JSON.stringify(data)
);
},
/**
* Returns the data for the current tab state.
*
* @param {XULElement} tab
* @returns {Object}
*/
_getTabState: function(tab) {
return this._parseOptionalJson(
this._store.getTabState(tab)
);
},
/**
* Returns all tab groups with additional information.
*
* @param {ChromeWindow} chromeWindow
* @returns {Object}
*/
_getGroupsData: function(chromeWindow) {
return this._parseOptionalJson(
this._store.getWindowValue(chromeWindow, "tabview-group")
);
},
/**
* Set group information for the given window.
*
* @param {ChromeWindow} chromeWindow
* @param {Object} data
* @returns {Object}
*/
_setGroupsData: function(chromeWindow, data) {
this._stopTabView(chromeWindow);
this._store.setWindowValue(
chromeWindow,
"tabview-group",
JSON.stringify(data)
);
},
/**
* Returns the current group as well as the next group ID and the total
* number of groups.
*
* @param {ChromeWindow} chromeWindow
* @returns {Object}
*/
_getCurrentGroupData: function(chromeWindow) {
let data = this._parseOptionalJson(
this._store.getWindowValue(chromeWindow, "tabview-groups")
);
if (Object.keys(data).length == 0) {
data = {
activeGroupId: 1,
nextID: 1,
totalNumber: 0
};
}
return data;
},
/**
* Stores information about the current session.
*
* @param {ChromeWindow} chromeWindow
* @param {Object} data
* @returns {Object}
*/
_setCurrentGroupData: function(chromeWindow, data) {
this._stopTabView(chromeWindow);
this._store.setWindowValue(
chromeWindow,
"tabview-groups",
JSON.stringify(data)
);
},
/**
* Deinitializes the TabView frame from the Tab Groups add-on, so that it
* reconstructs any changed data by us properly when it is accessed again.
* The _deinitFrame method only exists with that add-on enabled, and it
* will no-op if the frame isn't already initialized.
*
* @param {ChromeWindow} chromeWindow
*/
_stopTabView: function(chromeWindow) {
if (chromeWindow.TabView && chromeWindow.TabView._deinitFrame) {
chromeWindow.TabView._deinitFrame();
}
},
/**
* Safely parses a JSON string.
*
* @param {String} jsonString - JSON encoded data
* @returns {Object} decoded JSON data or an empty object if something failed
*/
_parseOptionalJson: function(jsonString) {
if (jsonString) {
try {
return JSON.parse(jsonString);
} catch (e) {
return {};
}
}
return {};
}
};
exports.SessionStorage = SessionStorage;
================================================
FILE: src/lib/tabmanager.js
================================================
const TabsUtils = require("sdk/tabs/utils");
function TabManager(storage) {
this._storage = storage;
}
TabManager.prototype = {
/**
* Returns all groups with their tabs.
*
* @param {ChromeWindow} chromeWindow
* @returns {Object}
*/
getGroupsWithTabs: function(chromeWindow, sort) {
let groups = this._storage.getGroups(chromeWindow);
let tabs = this._storage.getTabs(chromeWindow);
let retGroups = groups.map((group) => {
return Object.assign({}, group, {
tabs: tabs.filter((tab) => {
return tab.group == group.id;
})
});
});
if (sort) {
retGroups.sort((a, b) => {
if (a.title.toLowerCase() == b.title.toLowerCase()) {
return 0;
}
return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;
});
}
return retGroups;
},
/**
* Selects a given tab.
*
* @param {ChromeWindow} chromeWindow
* @param {TabBrowser} tabBrowser
* @param {Number} index - the tabs index
* @param {Number} groupID - the tabs groupID
*/
selectTab: function(chromeWindow, tabBrowser, index, groupID) {
let currentGroup = this._storage.getCurrentGroup(chromeWindow);
if (currentGroup == groupID) {
tabBrowser.selectedTab = tabBrowser.tabs[index];
} else {
this.selectGroup(chromeWindow, tabBrowser, groupID, index);
}
},
/**
* Move tab beetwen groups
*
* @param {ChromeWindow} chromeWindow
* @param {TabBrowser} tabBrowser
* @param {Number} tabIndex - the tabs index
* @param {Number} targetGroupID - target groupID (where to move tab)
*/
moveTabToGroup: function(chromeWindow, tabBrowser, tabIndex, targetGroupID) {
let tab = tabBrowser.tabs[tabIndex];
if (tab.groupID === targetGroupID) {
return;
}
this._storage.setTabGroup(tab, targetGroupID);
if (tab.selected) {
this.selectGroup(chromeWindow, tabBrowser, targetGroupID);
}
},
/**
* Selects a given group.
*
* @param {ChromeWindow} chromeWindow
* @param {TabBrowser} tabBrowser
* @param {Number} groupID - the groupID
* @param {Number} tabIndex - the tab to activate
*/
selectGroup: function(chromeWindow, tabBrowser, groupID, tabIndex = 0) {
let currentGroup = this._storage.getCurrentGroup(chromeWindow);
if (currentGroup == groupID) {
return;
}
this.updateCurrentSelectedTab(chromeWindow);
let lastSelected = this._storage.getGroupSelectedIndex(chromeWindow, groupID);
let tabs = this._storage.getTabIndexesByGroup(tabBrowser, groupID);
let selectedTab;
if (tabs.length == 0) {
selectedTab = tabBrowser.addTab("about:newtab");
this._storage.setTabGroup(selectedTab, groupID);
tabs.push(selectedTab);
} else if (tabIndex) {
selectedTab = tabBrowser.tabs[tabIndex];
} else {
selectedTab = tabBrowser.tabs[lastSelected < tabs.length ? tabs[lastSelected] : tabs[0]];
}
this._storage.setCurrentGroup(chromeWindow, groupID);
tabBrowser.selectedTab = selectedTab;
tabBrowser.showOnlyTheseTabs(tabs.map((tab) => {
return tabBrowser.tabs[tab];
}));
},
/**
* Selects the next or previous group in the list
*
* @param {ChromeWindow} chromeWindow
* @param {Number} direction
*/
selectNextPrevGroup: function(chromeWindow, tabBrowser, direction) {
let currentGroup = this._storage.getCurrentGroup(chromeWindow);
let groups = this._storage.getGroups(chromeWindow);
if (groups.length == 0) {
return;
}
let index = groups.findIndex((group) => {
return group.id == currentGroup;
});
if (index == -1) {
return;
}
index = (index + direction + groups.length) % groups.length;
this.selectGroup(chromeWindow, tabBrowser, groups[index].id);
},
/**
* Updates the currently selected index for the given window
*
* @param {ChromeWindow} chromeWindow
*/
updateCurrentSelectedTab: function(chromeWindow) {
let tabs = this._storage.getTabs(chromeWindow);
let curtab = tabs.find((tab) => {
return tab.active;
});
if (curtab) {
let curindex = tabs.filter((tab) => {
return tab.group == curtab.group;
}).indexOf(curtab);
this._storage.setGroupSelectedIndex(chromeWindow, curtab.group, curindex);
}
},
/**
* Updates the currently selected group based on the active tab
*
* @param {ChromwWindow} chromeWindow
*/
updateCurrentSelectedGroup: function(chromeWindow) {
let tabs = this._storage.getTabs(chromeWindow);
let curtab = tabs.find((tab) => {
return tab.active;
});
if (curtab) {
let currentGroupID = this._storage.getCurrentGroup(chromeWindow);
if (currentGroupID && curtab.group !== currentGroupID) {
this.selectGroup(chromeWindow, TabsUtils.getTabBrowser(chromeWindow), curtab.group, tabs.indexOf(curtab));
}
}
},
/**
* Renames a given group.
*
* @param {ChromeWindow} chromeWindow
* @param {Number} groupID - the groupID
* @param {String} title - the new title
*/
renameGroup: function(chromeWindow, groupID, title) {
this._storage.renameGroup(chromeWindow, groupID, title);
},
/**
* Adds a blank group
*
* @param {ChromeWindow} chromeWindow
*/
addGroup: function(chromeWindow) {
this._storage.addGroup(chromeWindow);
},
/**
* Adds a group with associated tab
*
* @param {ChromeWindow} chromeWindow
* @param {TabBrowser} tabBrowser
* @param {Number} tabIndex - the tab to place into group
*/
addGroupWithTab: function(chromeWindow, tabBrowser, tabIndex) {
this._storage.addGroup(chromeWindow);
let group = this.getRecentlyAddedGroup(chromeWindow);
this.moveTabToGroup(
chromeWindow,
tabBrowser,
tabIndex,
group.id
);
},
/**
* Return recently added group
*
* @param {ChromeWindow} chromeWindow
*/
getRecentlyAddedGroup: function(chromeWindow) {
let currentGoups = this._storage.getGroups(chromeWindow);
let recentlyAddedGroup = null;
if (currentGoups.length > 0) {
recentlyAddedGroup = currentGoups[currentGoups.length - 1];
}
return recentlyAddedGroup;
},
/**
* Closes a group and all attached tabs
*
* @param {Number} groupID - the groupID
*/
closeGroup: function(chromeWindow, tabBrowser, groupID) {
this._storage.removeGroup(chromeWindow, groupID);
let currentGroup = this._storage.getCurrentGroup(chromeWindow);
if (currentGroup == groupID) {
let remainingGroups = this._storage.getGroups(chromeWindow);
this.selectGroup(chromeWindow, tabBrowser, remainingGroups[0].id);
}
this._storage.removeGroupTabs(tabBrowser, groupID);
}
};
exports.TabManager = TabManager;
================================================
FILE: src/lib/utils.js
================================================
const _ = require("sdk/l10n").get;
const PrefService = require("sdk/preferences/service");
/**
* Returns an object of translated strings for the use in the frontend.
*
* @param {Array} keys - l10n keys
* @returns {Object}
*/
exports.getL10nStrings = function(keys) {
let returnStrings = {};
for (let key of keys) {
returnStrings[key] = _(key);
}
return returnStrings;
};
function isDarkTheme() {
let currentTheme = PrefService.get("lightweightThemes.selectedThemeID");
switch (currentTheme) {
case "firefox-compact-dark@mozilla.org":
return true;
case "firefox-devedition@mozilla.org":
let devtoolsTheme = PrefService.get("devtools.theme");
return devtoolsTheme == "dark";
default:
return false;
}
}
/**
* Used to switch stuff by the current design.
*
* @param {Object} object - object with .light and .dark
* @returns {Object} input.dark if a dark theme is used, .light otherwise
*/
exports.themeSwitch = function(object) {
return isDarkTheme() ? object.dark : object.light;
};
================================================
FILE: src/locale/de-DE.properties
================================================
bindPanoramaShortcut_title = Strg/Cmd-Umschalt-E verwenden
enableAlphabeticSort_title = Alphabetische Sortierung
add_group = Neue Gruppe anlegen
panelButton_label = Tabs gruppieren
unnamed_group = Unbenannte Gruppe
================================================
FILE: src/locale/en-US.properties
================================================
bindPanoramaShortcut_title = Listen to Ctrl/Cmd-Shift-E
enableAlphabeticSort_title = Enable alphabetic sorting
groupUndoCloseTimeout_title = Closing group delay
groupUndoCloseTimeout_description = Delay in seconds to wait before the group gets actually closed.
add_group = Create new group
panelButton_label = Group Tabs
unnamed_group = Unnamed Group
close_group_prompt_title = Close group
close_group_prompt_message = Do you want to close this group?
================================================
FILE: src/locale/es-AR.properties
================================================
bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E
enableAlphabeticSort_title = Habilitar orden alfabético
groupUndoCloseTimeout_title = Retardo al cerrar un grupo
groupUndoCloseTimeout_description = Tiempo de espera en segundos antes de cerrar el grupo.
add_group = Crear nuevo grupo
panelButton_label = Grupos de Pestañas
unnamed_group = Grupo sin nombre
close_group_prompt_title = Cerrar grupo
close_group_prompt_message = ¿Está seguro de querer cerrar este grupo?
================================================
FILE: src/locale/es-ES.properties
================================================
bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E
enableAlphabeticSort_title = Habilitar orden alfabético
groupUndoCloseTimeout_title = Retardo al cerrar un grupo
groupUndoCloseTimeout_description = Tiempo de espera en segundos antes de cerrar el grupo.
add_group = Crear nuevo grupo
panelButton_label = Grupos de Pestañas
unnamed_group = Grupo sin nombre
close_group_prompt_title = Cerrar grupo
close_group_prompt_message = ¿Quieres cerrar este grupo?
================================================
FILE: src/locale/fr-FR.properties
================================================
bindPanoramaShortcut_title = Utiliser le raccourci Ctrl/Cmd-Maj-E
enableAlphabeticSort_title = Activer le tri alphabétique
groupUndoCloseTimeout_title = Délai de fermeture du groupe
groupUndoCloseTimeout_description = Délai d'attente (en secondes) avant la fermeture effective du groupe.
add_group = Ajouter un groupe
panelButton_label = Groupes d'onglets
unnamed_group = Groupe sans nom
close_group_prompt_title = Fermer le groupe
close_group_prompt_message = Voulez-vous fermer ce groupe ?
================================================
FILE: src/locale/nl-NL.properties
================================================
bindPanoramaShortcut_title = Sneltoets Ctrl/Cmd-Shift-E activeren
enableAlphabeticSort_title = Alfabetische sortering activeren
groupUndoCloseTimeout_title = Vertraging op sluiten van groepen
groupUndoCloseTimeout_description = Vertraging in seconden waarna de groep gesloten zal worden
add_group = Nieuwe groep toevoegen
panelButton_label = Tabbladen groeperen
unnamed_group = Niet-benoemde groep
close_group_prompt_title = Groep sluiten
close_group_prompt_message = Wilt u deze groep sluiten?
================================================
FILE: src/package.json
================================================
{
"id": "tabgroups@schub.io",
"name": "tabgroups",
"version": "0.6.0-dev",
"title": "Simplified Tab Groups",
"description": "An add-on to replace the removed TabView/TabGroups/Panorama.",
"author": "Dennis Schubert <mozilla@dennis-schubert.de>",
"license": "MIT",
"main": "index.js",
"icon": "chrome://simplified-tabgroups/content/icons/extension-32.png",
"permissions": {
"private-browsing": true
},
"preferences": [
{
"name": "bindPanoramaShortcut",
"title": "Listen to Ctrl/Cmd-Shift-E",
"type": "bool",
"value": true
},
{
"name": "bindNavigationShortcut",
"title": "Listen to Ctrl-~ and Ctrl-Shift-~",
"type": "bool",
"value": true
},
{
"name": "enableAlphabeticSort",
"title": "Enable alphabetic sorting",
"type": "bool",
"value": false
},
{
"name": "groupCloseTimeout",
"title": "Closing group delay",
"description": "Delay in seconds to wait before the group gets actually closed.",
"type": "integer",
"value": 3
}
]
}
gitextract_2araavjk/
├── .gitignore
├── Changelog.md
├── Jakefile
├── LICENSE
├── README.md
├── package.json
└── src/
├── .eslintignore
├── .eslintrc.json
├── bootstrap.js
├── chrome.manifest
├── content/
│ └── icons/
│ └── togglebutton/
│ └── LICENSE
├── data/
│ ├── action_creators.js
│ ├── assets/
│ │ └── css/
│ │ └── groupspanel.css
│ ├── components/
│ │ ├── app.js
│ │ ├── group.js
│ │ ├── groupaddbutton.js
│ │ ├── groupcontrols.js
│ │ ├── grouplist.js
│ │ ├── tab.js
│ │ └── tablist.js
│ ├── groupspanel.html
│ ├── groupspanel.js
│ ├── reducer.js
│ └── vendor/
│ └── css/
│ └── font-awesome.css
├── index.js
├── install.rdf
├── lib/
│ ├── storage/
│ │ └── session.js
│ ├── tabmanager.js
│ └── utils.js
├── locale/
│ ├── de-DE.properties
│ ├── en-US.properties
│ ├── es-AR.properties
│ ├── es-ES.properties
│ ├── fr-FR.properties
│ └── nl-NL.properties
└── package.json
SYMBOL INDEX (6 symbols across 6 files)
FILE: src/bootstrap.js
constant COMMONJS_URI (line 11) | const COMMONJS_URI = "resource://gre/modules/commonjs";
FILE: src/data/reducer.js
constant INITIAL_STATE (line 1) | const INITIAL_STATE = Immutable.fromJS({
FILE: src/index.js
function TabGroups (line 16) | function TabGroups() {
FILE: src/lib/storage/session.js
function SessionStorage (line 4) | function SessionStorage() {
FILE: src/lib/tabmanager.js
function TabManager (line 3) | function TabManager(storage) {
FILE: src/lib/utils.js
function isDarkTheme (line 20) | function isDarkTheme() {
Condensed preview — 36 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (90K chars).
[
{
"path": ".gitignore",
"chars": 20,
"preview": "dist/\nnode_modules/\n"
},
{
"path": "Changelog.md",
"chars": 2071,
"preview": "# 0.6.0\n\n## Features\n\n* Added a timeout when closing a group to restore a group when closed by accident (PR [34](https:/"
},
{
"path": "Jakefile",
"chars": 1085,
"preview": "/* global desc, task, jake, complete */\n/* vim: set fdl=0: */\n\"use strict\";\n\nconst SRC_DIR = \"./src\";\nconst DIST_DIR = \""
},
{
"path": "LICENSE",
"chars": 1261,
"preview": "NOTE: The menu button icons were imported from Firefox. Please see\ndata/assets/images/LICENSE for further information!\n\n"
},
{
"path": "README.md",
"chars": 2031,
"preview": "Simplified Tab Groups for Firefox\n=================================\n\n**NOTE**: This project is currently unmaintained. I"
},
{
"path": "package.json",
"chars": 152,
"preview": "{\n \"name\": \"tabgroups\",\n \"author\": \"\",\n \"license\": \"MIT\",\n \"private\": true,\n \"devDependencies\": {\n \"jake\": \"^8.0"
},
{
"path": "src/.eslintignore",
"chars": 26,
"preview": "data/vendor/\nbootstrap.js\n"
},
{
"path": "src/.eslintrc.json",
"chars": 5287,
"preview": "{\n \"parserOptions\": {\n \"ecmaVersion\": 6,\n \"sourceType\": \"module\"\n },\n \"env\": {\n \"browser\": true,\n \"es6\": "
},
{
"path": "src/bootstrap.js",
"chars": 629,
"preview": "/**\n * This Source Code is based on the original bootstrap.js generated by the\n * add-on sdk which is subject to the ter"
},
{
"path": "src/chrome.manifest",
"chars": 38,
"preview": "content simplified-tabgroups content/\n"
},
{
"path": "src/content/icons/togglebutton/LICENSE",
"chars": 16923,
"preview": "NOTE: Icons were imported from Firefox as the original TabView was\nremoved and those icons are no longer needed.\n\n------"
},
{
"path": "src/data/action_creators.js",
"chars": 291,
"preview": "const ActionCreators = {\n setTabgroups: function(tabgroups) {\n return {\n type: \"TABGROUPS_RECEIVE\",\n tabgr"
},
{
"path": "src/data/assets/css/groupspanel.css",
"chars": 2577,
"preview": "ul, li {\n display: block;\n margin: 0;\n padding: 0;\n}\n\n li {\n list-style-type: none;\n cursor: move;\n }\n\n.group"
},
{
"path": "src/data/components/app.js",
"chars": 553,
"preview": "const App = React.createClass({\n propTypes: {\n onGroupAddClick: React.PropTypes.func,\n onGroupAddDrop: React.Prop"
},
{
"path": "src/data/components/group.js",
"chars": 5811,
"preview": "const Group = React.createClass({\n propTypes: {\n closeTimeout: React.PropTypes.number,\n group: React.PropTypes.ob"
},
{
"path": "src/data/components/groupaddbutton.js",
"chars": 1842,
"preview": "const GroupAddButton = React.createClass({\n propTypes: {\n onClick: React.PropTypes.func,\n onDrop: React.PropTypes"
},
{
"path": "src/data/components/groupcontrols.js",
"chars": 1795,
"preview": "const GroupControls = React.createClass({\n propTypes: {\n expanded: React.PropTypes.bool.isRequired,\n onClose: Rea"
},
{
"path": "src/data/components/grouplist.js",
"chars": 1873,
"preview": "const GroupList = (() => {\n const GroupListStandalone = React.createClass({\n propTypes: {\n groups: React.PropTy"
},
{
"path": "src/data/components/tab.js",
"chars": 1539,
"preview": "const Tab = React.createClass({\n propTypes: {\n onTabClick: React.PropTypes.func,\n onTabDrag: React.PropTypes.func"
},
{
"path": "src/data/components/tablist.js",
"chars": 690,
"preview": "const TabList = React.createClass({\n propTypes: {\n onTabClick: React.PropTypes.func,\n onTabDrag: React.PropTypes."
},
{
"path": "src/data/groupspanel.html",
"chars": 1062,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n\n <script src=\"vendor/js/classnames.min.js\"></script>\n "
},
{
"path": "src/data/groupspanel.js",
"chars": 2097,
"preview": "const store = Redux.createStore(Reducer);\n\nconst Actions = {\n addGroup: function() {\n addon.port.emit(\"Group:Add\");\n"
},
{
"path": "src/data/reducer.js",
"chars": 391,
"preview": "const INITIAL_STATE = Immutable.fromJS({\n tabgroups: [],\n closeTimeout: 0\n});\n\nconst Reducer = function(state = INITIA"
},
{
"path": "src/data/vendor/css/font-awesome.css",
"chars": 1547,
"preview": "/*!\n * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome\n * License - http://fontawesome.io/lice"
},
{
"path": "src/index.js",
"chars": 7622,
"preview": "const self = require(\"sdk/self\");\nconst _ = require(\"sdk/l10n\").get;\n\nconst {Hotkey} = require(\"sdk/hotkeys\");\nconst {Pa"
},
{
"path": "src/install.rdf",
"chars": 3280,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:em=\"http://www.moz"
},
{
"path": "src/lib/storage/session.js",
"chars": 10137,
"preview": "const {Cc, Ci} = require(\"chrome\");\nconst TabsUtils = require(\"sdk/tabs/utils\");\n\nfunction SessionStorage() {\n this._st"
},
{
"path": "src/lib/tabmanager.js",
"chars": 6810,
"preview": "const TabsUtils = require(\"sdk/tabs/utils\");\n\nfunction TabManager(storage) {\n this._storage = storage;\n}\n\nTabManager.pr"
},
{
"path": "src/lib/utils.js",
"chars": 1050,
"preview": "const _ = require(\"sdk/l10n\").get;\nconst PrefService = require(\"sdk/preferences/service\");\n\n/**\n * Returns an object of "
},
{
"path": "src/locale/de-DE.properties",
"chars": 216,
"preview": "bindPanoramaShortcut_title = Strg/Cmd-Umschalt-E verwenden\nenableAlphabeticSort_title = Alphabetische Sortierung\n\nadd_gr"
},
{
"path": "src/locale/en-US.properties",
"chars": 453,
"preview": "bindPanoramaShortcut_title = Listen to Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Enable alphabetic sorting\ngroupUndo"
},
{
"path": "src/locale/es-AR.properties",
"chars": 493,
"preview": "bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Habilitar orden "
},
{
"path": "src/locale/es-ES.properties",
"chars": 479,
"preview": "bindPanoramaShortcut_title = Escuchar el atajo de teclado Ctrl/Cmd-Shift-E\nenableAlphabeticSort_title = Habilitar orden "
},
{
"path": "src/locale/fr-FR.properties",
"chars": 493,
"preview": "bindPanoramaShortcut_title = Utiliser le raccourci Ctrl/Cmd-Maj-E\nenableAlphabeticSort_title = Activer le tri alphabétiq"
},
{
"path": "src/locale/nl-NL.properties",
"chars": 496,
"preview": "bindPanoramaShortcut_title = Sneltoets Ctrl/Cmd-Shift-E activeren\nenableAlphabeticSort_title = Alfabetische sortering ac"
},
{
"path": "src/package.json",
"chars": 1090,
"preview": "{\n \"id\": \"tabgroups@schub.io\",\n \"name\": \"tabgroups\",\n \"version\": \"0.6.0-dev\",\n \"title\": \"Simplified Tab Groups\",\n \""
}
]
About this extraction
This page contains the full source code of the denschub/firefox-tabgroups GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 36 files (82.2 KB), approximately 22.1k tokens, and a symbol index with 6 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.