addons/firefox-addons/open-incognito

changeset 0:3353f3c48b6b

Initial revision
author Guido Berhoerster <guido+open-incognito@berhoerster.name>
date Fri Dec 14 15:59:37 2018 +0100 (22 months ago)
parents
children e998dc498645
files COPYING Makefile NEWS README _locales/de/messages.json _locales/en/messages.json background.js icons/open-incognito.svg manifest.json.in
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/COPYING	Fri Dec 14 15:59:37 2018 +0100
     1.3 @@ -0,0 +1,373 @@
     1.4 +Mozilla Public License Version 2.0
     1.5 +==================================
     1.6 +
     1.7 +1. Definitions
     1.8 +--------------
     1.9 +
    1.10 +1.1. "Contributor"
    1.11 +    means each individual or legal entity that creates, contributes to
    1.12 +    the creation of, or owns Covered Software.
    1.13 +
    1.14 +1.2. "Contributor Version"
    1.15 +    means the combination of the Contributions of others (if any) used
    1.16 +    by a Contributor and that particular Contributor's Contribution.
    1.17 +
    1.18 +1.3. "Contribution"
    1.19 +    means Covered Software of a particular Contributor.
    1.20 +
    1.21 +1.4. "Covered Software"
    1.22 +    means Source Code Form to which the initial Contributor has attached
    1.23 +    the notice in Exhibit A, the Executable Form of such Source Code
    1.24 +    Form, and Modifications of such Source Code Form, in each case
    1.25 +    including portions thereof.
    1.26 +
    1.27 +1.5. "Incompatible With Secondary Licenses"
    1.28 +    means
    1.29 +
    1.30 +    (a) that the initial Contributor has attached the notice described
    1.31 +        in Exhibit B to the Covered Software; or
    1.32 +
    1.33 +    (b) that the Covered Software was made available under the terms of
    1.34 +        version 1.1 or earlier of the License, but not also under the
    1.35 +        terms of a Secondary License.
    1.36 +
    1.37 +1.6. "Executable Form"
    1.38 +    means any form of the work other than Source Code Form.
    1.39 +
    1.40 +1.7. "Larger Work"
    1.41 +    means a work that combines Covered Software with other material, in 
    1.42 +    a separate file or files, that is not Covered Software.
    1.43 +
    1.44 +1.8. "License"
    1.45 +    means this document.
    1.46 +
    1.47 +1.9. "Licensable"
    1.48 +    means having the right to grant, to the maximum extent possible,
    1.49 +    whether at the time of the initial grant or subsequently, any and
    1.50 +    all of the rights conveyed by this License.
    1.51 +
    1.52 +1.10. "Modifications"
    1.53 +    means any of the following:
    1.54 +
    1.55 +    (a) any file in Source Code Form that results from an addition to,
    1.56 +        deletion from, or modification of the contents of Covered
    1.57 +        Software; or
    1.58 +
    1.59 +    (b) any new file in Source Code Form that contains any Covered
    1.60 +        Software.
    1.61 +
    1.62 +1.11. "Patent Claims" of a Contributor
    1.63 +    means any patent claim(s), including without limitation, method,
    1.64 +    process, and apparatus claims, in any patent Licensable by such
    1.65 +    Contributor that would be infringed, but for the grant of the
    1.66 +    License, by the making, using, selling, offering for sale, having
    1.67 +    made, import, or transfer of either its Contributions or its
    1.68 +    Contributor Version.
    1.69 +
    1.70 +1.12. "Secondary License"
    1.71 +    means either the GNU General Public License, Version 2.0, the GNU
    1.72 +    Lesser General Public License, Version 2.1, the GNU Affero General
    1.73 +    Public License, Version 3.0, or any later versions of those
    1.74 +    licenses.
    1.75 +
    1.76 +1.13. "Source Code Form"
    1.77 +    means the form of the work preferred for making modifications.
    1.78 +
    1.79 +1.14. "You" (or "Your")
    1.80 +    means an individual or a legal entity exercising rights under this
    1.81 +    License. For legal entities, "You" includes any entity that
    1.82 +    controls, is controlled by, or is under common control with You. For
    1.83 +    purposes of this definition, "control" means (a) the power, direct
    1.84 +    or indirect, to cause the direction or management of such entity,
    1.85 +    whether by contract or otherwise, or (b) ownership of more than
    1.86 +    fifty percent (50%) of the outstanding shares or beneficial
    1.87 +    ownership of such entity.
    1.88 +
    1.89 +2. License Grants and Conditions
    1.90 +--------------------------------
    1.91 +
    1.92 +2.1. Grants
    1.93 +
    1.94 +Each Contributor hereby grants You a world-wide, royalty-free,
    1.95 +non-exclusive license:
    1.96 +
    1.97 +(a) under intellectual property rights (other than patent or trademark)
    1.98 +    Licensable by such Contributor to use, reproduce, make available,
    1.99 +    modify, display, perform, distribute, and otherwise exploit its
   1.100 +    Contributions, either on an unmodified basis, with Modifications, or
   1.101 +    as part of a Larger Work; and
   1.102 +
   1.103 +(b) under Patent Claims of such Contributor to make, use, sell, offer
   1.104 +    for sale, have made, import, and otherwise transfer either its
   1.105 +    Contributions or its Contributor Version.
   1.106 +
   1.107 +2.2. Effective Date
   1.108 +
   1.109 +The licenses granted in Section 2.1 with respect to any Contribution
   1.110 +become effective for each Contribution on the date the Contributor first
   1.111 +distributes such Contribution.
   1.112 +
   1.113 +2.3. Limitations on Grant Scope
   1.114 +
   1.115 +The licenses granted in this Section 2 are the only rights granted under
   1.116 +this License. No additional rights or licenses will be implied from the
   1.117 +distribution or licensing of Covered Software under this License.
   1.118 +Notwithstanding Section 2.1(b) above, no patent license is granted by a
   1.119 +Contributor:
   1.120 +
   1.121 +(a) for any code that a Contributor has removed from Covered Software;
   1.122 +    or
   1.123 +
   1.124 +(b) for infringements caused by: (i) Your and any other third party's
   1.125 +    modifications of Covered Software, or (ii) the combination of its
   1.126 +    Contributions with other software (except as part of its Contributor
   1.127 +    Version); or
   1.128 +
   1.129 +(c) under Patent Claims infringed by Covered Software in the absence of
   1.130 +    its Contributions.
   1.131 +
   1.132 +This License does not grant any rights in the trademarks, service marks,
   1.133 +or logos of any Contributor (except as may be necessary to comply with
   1.134 +the notice requirements in Section 3.4).
   1.135 +
   1.136 +2.4. Subsequent Licenses
   1.137 +
   1.138 +No Contributor makes additional grants as a result of Your choice to
   1.139 +distribute the Covered Software under a subsequent version of this
   1.140 +License (see Section 10.2) or under the terms of a Secondary License (if
   1.141 +permitted under the terms of Section 3.3).
   1.142 +
   1.143 +2.5. Representation
   1.144 +
   1.145 +Each Contributor represents that the Contributor believes its
   1.146 +Contributions are its original creation(s) or it has sufficient rights
   1.147 +to grant the rights to its Contributions conveyed by this License.
   1.148 +
   1.149 +2.6. Fair Use
   1.150 +
   1.151 +This License is not intended to limit any rights You have under
   1.152 +applicable copyright doctrines of fair use, fair dealing, or other
   1.153 +equivalents.
   1.154 +
   1.155 +2.7. Conditions
   1.156 +
   1.157 +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
   1.158 +in Section 2.1.
   1.159 +
   1.160 +3. Responsibilities
   1.161 +-------------------
   1.162 +
   1.163 +3.1. Distribution of Source Form
   1.164 +
   1.165 +All distribution of Covered Software in Source Code Form, including any
   1.166 +Modifications that You create or to which You contribute, must be under
   1.167 +the terms of this License. You must inform recipients that the Source
   1.168 +Code Form of the Covered Software is governed by the terms of this
   1.169 +License, and how they can obtain a copy of this License. You may not
   1.170 +attempt to alter or restrict the recipients' rights in the Source Code
   1.171 +Form.
   1.172 +
   1.173 +3.2. Distribution of Executable Form
   1.174 +
   1.175 +If You distribute Covered Software in Executable Form then:
   1.176 +
   1.177 +(a) such Covered Software must also be made available in Source Code
   1.178 +    Form, as described in Section 3.1, and You must inform recipients of
   1.179 +    the Executable Form how they can obtain a copy of such Source Code
   1.180 +    Form by reasonable means in a timely manner, at a charge no more
   1.181 +    than the cost of distribution to the recipient; and
   1.182 +
   1.183 +(b) You may distribute such Executable Form under the terms of this
   1.184 +    License, or sublicense it under different terms, provided that the
   1.185 +    license for the Executable Form does not attempt to limit or alter
   1.186 +    the recipients' rights in the Source Code Form under this License.
   1.187 +
   1.188 +3.3. Distribution of a Larger Work
   1.189 +
   1.190 +You may create and distribute a Larger Work under terms of Your choice,
   1.191 +provided that You also comply with the requirements of this License for
   1.192 +the Covered Software. If the Larger Work is a combination of Covered
   1.193 +Software with a work governed by one or more Secondary Licenses, and the
   1.194 +Covered Software is not Incompatible With Secondary Licenses, this
   1.195 +License permits You to additionally distribute such Covered Software
   1.196 +under the terms of such Secondary License(s), so that the recipient of
   1.197 +the Larger Work may, at their option, further distribute the Covered
   1.198 +Software under the terms of either this License or such Secondary
   1.199 +License(s).
   1.200 +
   1.201 +3.4. Notices
   1.202 +
   1.203 +You may not remove or alter the substance of any license notices
   1.204 +(including copyright notices, patent notices, disclaimers of warranty,
   1.205 +or limitations of liability) contained within the Source Code Form of
   1.206 +the Covered Software, except that You may alter any license notices to
   1.207 +the extent required to remedy known factual inaccuracies.
   1.208 +
   1.209 +3.5. Application of Additional Terms
   1.210 +
   1.211 +You may choose to offer, and to charge a fee for, warranty, support,
   1.212 +indemnity or liability obligations to one or more recipients of Covered
   1.213 +Software. However, You may do so only on Your own behalf, and not on
   1.214 +behalf of any Contributor. You must make it absolutely clear that any
   1.215 +such warranty, support, indemnity, or liability obligation is offered by
   1.216 +You alone, and You hereby agree to indemnify every Contributor for any
   1.217 +liability incurred by such Contributor as a result of warranty, support,
   1.218 +indemnity or liability terms You offer. You may include additional
   1.219 +disclaimers of warranty and limitations of liability specific to any
   1.220 +jurisdiction.
   1.221 +
   1.222 +4. Inability to Comply Due to Statute or Regulation
   1.223 +---------------------------------------------------
   1.224 +
   1.225 +If it is impossible for You to comply with any of the terms of this
   1.226 +License with respect to some or all of the Covered Software due to
   1.227 +statute, judicial order, or regulation then You must: (a) comply with
   1.228 +the terms of this License to the maximum extent possible; and (b)
   1.229 +describe the limitations and the code they affect. Such description must
   1.230 +be placed in a text file included with all distributions of the Covered
   1.231 +Software under this License. Except to the extent prohibited by statute
   1.232 +or regulation, such description must be sufficiently detailed for a
   1.233 +recipient of ordinary skill to be able to understand it.
   1.234 +
   1.235 +5. Termination
   1.236 +--------------
   1.237 +
   1.238 +5.1. The rights granted under this License will terminate automatically
   1.239 +if You fail to comply with any of its terms. However, if You become
   1.240 +compliant, then the rights granted under this License from a particular
   1.241 +Contributor are reinstated (a) provisionally, unless and until such
   1.242 +Contributor explicitly and finally terminates Your grants, and (b) on an
   1.243 +ongoing basis, if such Contributor fails to notify You of the
   1.244 +non-compliance by some reasonable means prior to 60 days after You have
   1.245 +come back into compliance. Moreover, Your grants from a particular
   1.246 +Contributor are reinstated on an ongoing basis if such Contributor
   1.247 +notifies You of the non-compliance by some reasonable means, this is the
   1.248 +first time You have received notice of non-compliance with this License
   1.249 +from such Contributor, and You become compliant prior to 30 days after
   1.250 +Your receipt of the notice.
   1.251 +
   1.252 +5.2. If You initiate litigation against any entity by asserting a patent
   1.253 +infringement claim (excluding declaratory judgment actions,
   1.254 +counter-claims, and cross-claims) alleging that a Contributor Version
   1.255 +directly or indirectly infringes any patent, then the rights granted to
   1.256 +You by any and all Contributors for the Covered Software under Section
   1.257 +2.1 of this License shall terminate.
   1.258 +
   1.259 +5.3. In the event of termination under Sections 5.1 or 5.2 above, all
   1.260 +end user license agreements (excluding distributors and resellers) which
   1.261 +have been validly granted by You or Your distributors under this License
   1.262 +prior to termination shall survive termination.
   1.263 +
   1.264 +************************************************************************
   1.265 +*                                                                      *
   1.266 +*  6. Disclaimer of Warranty                                           *
   1.267 +*  -------------------------                                           *
   1.268 +*                                                                      *
   1.269 +*  Covered Software is provided under this License on an "as is"       *
   1.270 +*  basis, without warranty of any kind, either expressed, implied, or  *
   1.271 +*  statutory, including, without limitation, warranties that the       *
   1.272 +*  Covered Software is free of defects, merchantable, fit for a        *
   1.273 +*  particular purpose or non-infringing. The entire risk as to the     *
   1.274 +*  quality and performance of the Covered Software is with You.        *
   1.275 +*  Should any Covered Software prove defective in any respect, You     *
   1.276 +*  (not any Contributor) assume the cost of any necessary servicing,   *
   1.277 +*  repair, or correction. This disclaimer of warranty constitutes an   *
   1.278 +*  essential part of this License. No use of any Covered Software is   *
   1.279 +*  authorized under this License except under this disclaimer.         *
   1.280 +*                                                                      *
   1.281 +************************************************************************
   1.282 +
   1.283 +************************************************************************
   1.284 +*                                                                      *
   1.285 +*  7. Limitation of Liability                                          *
   1.286 +*  --------------------------                                          *
   1.287 +*                                                                      *
   1.288 +*  Under no circumstances and under no legal theory, whether tort      *
   1.289 +*  (including negligence), contract, or otherwise, shall any           *
   1.290 +*  Contributor, or anyone who distributes Covered Software as          *
   1.291 +*  permitted above, be liable to You for any direct, indirect,         *
   1.292 +*  special, incidental, or consequential damages of any character      *
   1.293 +*  including, without limitation, damages for lost profits, loss of    *
   1.294 +*  goodwill, work stoppage, computer failure or malfunction, or any    *
   1.295 +*  and all other commercial damages or losses, even if such party      *
   1.296 +*  shall have been informed of the possibility of such damages. This   *
   1.297 +*  limitation of liability shall not apply to liability for death or   *
   1.298 +*  personal injury resulting from such party's negligence to the       *
   1.299 +*  extent applicable law prohibits such limitation. Some               *
   1.300 +*  jurisdictions do not allow the exclusion or limitation of           *
   1.301 +*  incidental or consequential damages, so this exclusion and          *
   1.302 +*  limitation may not apply to You.                                    *
   1.303 +*                                                                      *
   1.304 +************************************************************************
   1.305 +
   1.306 +8. Litigation
   1.307 +-------------
   1.308 +
   1.309 +Any litigation relating to this License may be brought only in the
   1.310 +courts of a jurisdiction where the defendant maintains its principal
   1.311 +place of business and such litigation shall be governed by laws of that
   1.312 +jurisdiction, without reference to its conflict-of-law provisions.
   1.313 +Nothing in this Section shall prevent a party's ability to bring
   1.314 +cross-claims or counter-claims.
   1.315 +
   1.316 +9. Miscellaneous
   1.317 +----------------
   1.318 +
   1.319 +This License represents the complete agreement concerning the subject
   1.320 +matter hereof. If any provision of this License is held to be
   1.321 +unenforceable, such provision shall be reformed only to the extent
   1.322 +necessary to make it enforceable. Any law or regulation which provides
   1.323 +that the language of a contract shall be construed against the drafter
   1.324 +shall not be used to construe this License against a Contributor.
   1.325 +
   1.326 +10. Versions of the License
   1.327 +---------------------------
   1.328 +
   1.329 +10.1. New Versions
   1.330 +
   1.331 +Mozilla Foundation is the license steward. Except as provided in Section
   1.332 +10.3, no one other than the license steward has the right to modify or
   1.333 +publish new versions of this License. Each version will be given a
   1.334 +distinguishing version number.
   1.335 +
   1.336 +10.2. Effect of New Versions
   1.337 +
   1.338 +You may distribute the Covered Software under the terms of the version
   1.339 +of the License under which You originally received the Covered Software,
   1.340 +or under the terms of any subsequent version published by the license
   1.341 +steward.
   1.342 +
   1.343 +10.3. Modified Versions
   1.344 +
   1.345 +If you create software not governed by this License, and you want to
   1.346 +create a new license for such software, you may create and use a
   1.347 +modified version of this License if you rename the license and remove
   1.348 +any references to the name of the license steward (except to note that
   1.349 +such modified license differs from this License).
   1.350 +
   1.351 +10.4. Distributing Source Code Form that is Incompatible With Secondary
   1.352 +Licenses
   1.353 +
   1.354 +If You choose to distribute Source Code Form that is Incompatible With
   1.355 +Secondary Licenses under the terms of this version of the License, the
   1.356 +notice described in Exhibit B of this License must be attached.
   1.357 +
   1.358 +Exhibit A - Source Code Form License Notice
   1.359 +-------------------------------------------
   1.360 +
   1.361 +  This Source Code Form is subject to the terms of the Mozilla Public
   1.362 +  License, v. 2.0. If a copy of the MPL was not distributed with this
   1.363 +  file, You can obtain one at http://mozilla.org/MPL/2.0/.
   1.364 +
   1.365 +If it is not possible or desirable to put the notice in a particular
   1.366 +file, then You may include the notice in a location (such as a LICENSE
   1.367 +file in a relevant directory) where a recipient would be likely to look
   1.368 +for such a notice.
   1.369 +
   1.370 +You may add additional accurate notices of copyright ownership.
   1.371 +
   1.372 +Exhibit B - "Incompatible With Secondary Licenses" Notice
   1.373 +---------------------------------------------------------
   1.374 +
   1.375 +  This Source Code Form is "Incompatible With Secondary Licenses", as
   1.376 +  defined by the Mozilla Public License, v. 2.0.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Makefile	Fri Dec 14 15:59:37 2018 +0100
     2.3 @@ -0,0 +1,67 @@
     2.4 +#
     2.5 +# Copyright (C) 2018 Guido Berhoerster <guido+open-incognito@berhoerster.name>
     2.6 +#
     2.7 +# Permission is hereby granted, free of charge, to any person obtaining
     2.8 +# a copy of this software and associated documentation files (the
     2.9 +# "Software"), to deal in the Software without restriction, including
    2.10 +# without limitation the rights to use, copy, modify, merge, publish,
    2.11 +# distribute, sublicense, and/or sell copies of the Software, and to
    2.12 +# permit persons to whom the Software is furnished to do so, subject to
    2.13 +# the following conditions:
    2.14 +#
    2.15 +# The above copyright notice and this permission notice shall be included
    2.16 +# in all copies or substantial portions of the Software.
    2.17 +#
    2.18 +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    2.19 +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    2.20 +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    2.21 +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    2.22 +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    2.23 +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    2.24 +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2.25 +#
    2.26 +
    2.27 +NAME =		open-incognito
    2.28 +VERSION =	1
    2.29 +EXT_NAME =	$(subst -,_,$(NAME))-$(VERSION)
    2.30 +
    2.31 +INKSCAPE := 	inkscape
    2.32 +INFOZIP :=	zip
    2.33 +SED :=		sed
    2.34 +
    2.35 +BITMAP_ICONS =	icons/open-incognito-48.png \
    2.36 +		icons/open-incognito-96.png
    2.37 +DIST_FILES =	manifest.json \
    2.38 +		COPYING \
    2.39 +		NEWS \
    2.40 +		README \
    2.41 +		$(wildcard _locales/*/messages.json) \
    2.42 +		background.js \
    2.43 +		$(BITMAP_ICONS)
    2.44 +
    2.45 +.DEFAULT_TARGET = all
    2.46 +
    2.47 +.PHONY: all extension clean clobber
    2.48 +
    2.49 +all: extension
    2.50 +
    2.51 +extension: $(EXT_NAME).zip
    2.52 +
    2.53 +$(EXT_NAME).zip: $(DIST_FILES)
    2.54 +	$(INFOZIP) $@ $^
    2.55 +
    2.56 +define generate-icon-rule
    2.57 +$1: $(1:%-$(lastword $(subst -, ,$1))=%.svg)
    2.58 +	size=$(lastword $(subst -, ,$(basename $1))); \
    2.59 +	    $(INKSCAPE) -w $$$${size} -h $$$${size} -e $$@ $$<
    2.60 +endef
    2.61 +
    2.62 +$(foreach icon,$(BITMAP_ICONS),$(eval $(call generate-icon-rule,$(icon))))
    2.63 +
    2.64 +manifest.json: manifest.json.in
    2.65 +	$(SED) 's|@VERSION@|$(VERSION)|g' $< >$@
    2.66 +
    2.67 +clean:
    2.68 +	-rm -f $(BITMAP_ICONS) manifest.json
    2.69 +
    2.70 +clobber: clean
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/NEWS	Fri Dec 14 15:59:37 2018 +0100
     3.3 @@ -0,0 +1,3 @@
     3.4 +News
     3.5 +====
     3.6 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/README	Fri Dec 14 15:59:37 2018 +0100
     4.3 @@ -0,0 +1,40 @@
     4.4 +Open Incongito
     4.5 +==============
     4.6 +
     4.7 +Open Incongito is a Firefox Addon for opening links in the most recently
     4.8 +accessed private window.
     4.9 +
    4.10 +Usage
    4.11 +-----
    4.12 +
    4.13 +Open the context menu on top of a link and select the menu item named "Open
    4.14 +Link in Private Window.  If the is no existing private window, a new private
    4.15 +window will be opened with the selected link.  If there is one private window
    4.16 +the link will be opened in that window and if there is more than one the link
    4.17 +will be opened in the most recently accessed private window.
    4.18 +
    4.19 +Contact
    4.20 +-------
    4.21 +
    4.22 +Please send any feedback, translations or bug reports via email to
    4.23 +<guido+open-incognito@berhoerster.name>
    4.24 +
    4.25 +Bug Reports
    4.26 +-----------
    4.27 +
    4.28 +When sending bug reports, please always mention the exact version of the addon
    4.29 +with which the issue occurs as well as the version of Firefox and the operating
    4.30 +system you are using and make sure that you provide sufficient information to
    4.31 +reproduce the issue and include any error messages.
    4.32 +
    4.33 +License
    4.34 +-------
    4.35 +
    4.36 +Except otherwise noted, all files are Copyright (C) 2018 Guido Berhoerster and
    4.37 +distributed under the following license terms:
    4.38 +
    4.39 +Copyright (C) 2018 Guido Berhoerster <guido+open-incognito@berhoerster.name>
    4.40 +
    4.41 +This Source Code Form is subject to the terms of the Mozilla Public
    4.42 +License, v. 2.0. If a copy of the MPL was not distributed with this
    4.43 +file, You can obtain one at http://mozilla.org/MPL/2.0/.
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/_locales/de/messages.json	Fri Dec 14 15:59:37 2018 +0100
     5.3 @@ -0,0 +1,14 @@
     5.4 +{
     5.5 +    "extensionName": {
     5.6 +        "message": "Öffne incognito",
     5.7 +        "description": "Name of the extension."
     5.8 +    },
     5.9 +    "extensionDescription": {
    5.10 +        "message": "Öffne Links im zuletzt benutzen privaten Fester.",
    5.11 +        "description": "Description of the extension."
    5.12 +    },
    5.13 +    "openLinkInPrivateWindow": {
    5.14 +        "message": "Link in privatem Fenster öffnen",
    5.15 +        "description": "Title of the menu item for opening links in a private window."
    5.16 +    }
    5.17 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/_locales/en/messages.json	Fri Dec 14 15:59:37 2018 +0100
     6.3 @@ -0,0 +1,14 @@
     6.4 +{
     6.5 +    "extensionName": {
     6.6 +        "message": "Open Incognito",
     6.7 +        "description": "Name of the extension."
     6.8 +    },
     6.9 +    "extensionDescription": {
    6.10 +        "message": "Open links in the most recently accessed private window.",
    6.11 +        "description": "Description of the extension."
    6.12 +    },
    6.13 +    "openLinkInPrivateWindow": {
    6.14 +        "message": "Open Link in Private Window",
    6.15 +        "description": "Title of the menu item for opening links in a private window."
    6.16 +    }
    6.17 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/background.js	Fri Dec 14 15:59:37 2018 +0100
     7.3 @@ -0,0 +1,58 @@
     7.4 +/*
     7.5 + * Copyright (C) 2018 Guido Berhoerster <guido+open-incognito@berhoerster.name>
     7.6 + *
     7.7 + * This Source Code Form is subject to the terms of the Mozilla Public
     7.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     7.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7.10 + */
    7.11 +
    7.12 +'use strict';
    7.13 +
    7.14 +function onMenuShown(info, tab) {
    7.15 +    let enabled = !tab.incognito &&
    7.16 +            typeof info.linkUrl !== 'undefined' &&
    7.17 +            (info.linkUrl.startsWith('http:') ||
    7.18 +            info.linkUrl.startsWith('https:') ||
    7.19 +            info.linkUrl.startsWith('ftp:'));
    7.20 +    browser.menus.update('open-link-in-private-mode', {enabled});
    7.21 +    browser.menus.refresh();
    7.22 +}
    7.23 +
    7.24 +async function onClicked(info, tab) {
    7.25 +    let activeTabs = await browser.tabs.query({
    7.26 +        active: true,
    7.27 +        currentWindow: false,
    7.28 +        windowType: 'normal'
    7.29 +    });
    7.30 +    console.log('active tabs:', activeTabs);
    7.31 +    let [windowId, ] = activeTabs.reduce((accumulator, currentTab) =>
    7.32 +            (currentTab.incognito && accumulator[1] < currentTab.lastAccessed) ?
    7.33 +            [currentTab.windowId, currentTab.lastAccessed] : accumulator,
    7.34 +            [-1, 0]);
    7.35 +    if (windowId < 0) {
    7.36 +        browser.windows.create({
    7.37 +            incognito: true,
    7.38 +            url: info.linkUrl
    7.39 +        });
    7.40 +    } else {
    7.41 +        browser.tabs.create({
    7.42 +            url: info.linkUrl,
    7.43 +            windowId
    7.44 +        });
    7.45 +    }
    7.46 +}
    7.47 +
    7.48 +browser.menus.create({
    7.49 +        id: 'open-link-in-private-mode',
    7.50 +        title: browser.i18n.getMessage('openLinkInPrivateWindow'),
    7.51 +        enabled: false,
    7.52 +        contexts: ['link']
    7.53 +    },
    7.54 +    () => {
    7.55 +    if (browser.runtime.lastError) {
    7.56 +        console.error('Failed to create menu item:', browser.runtime.lastError);
    7.57 +        return;
    7.58 +    }
    7.59 +    browser.menus.onShown.addListener(onMenuShown);
    7.60 +    browser.menus.onClicked.addListener(onClicked);
    7.61 +});
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/icons/open-incognito.svg	Fri Dec 14 15:59:37 2018 +0100
     8.3 @@ -0,0 +1,13 @@
     8.4 +<!--
     8.5 +Copyright (C) 2018 Guido Berhoerster <guido+open-incognito@berhoerster.name>
     8.6 +
     8.7 +This Source Code Form is subject to the terms of the Mozilla Public
     8.8 +License, v. 2.0. If a copy of the MPL was not distributed with this
     8.9 +file, You can obtain one at http://mozilla.org/MPL/2.0/.
    8.10 +-->
    8.11 +<svg version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    8.12 +  <rect width="48" height="48" rx="9" ry="9" fill="#6200a4"/>
    8.13 +  <path d="m30 12-6-6m0 0-6 6m6 8v-14" fill="none" stroke="#ffffff" stroke-linecap="round" stroke-width="4"/>
    8.14 +  <path id="mask-left-half" d="m12 24c-4 0-8 0-8 6 0 4 2 12 8 12 8 0 6-4 12-4v-12c-4 0-3-2-12-2zm3 6c4 0 5 1 6 2.5-1.4 2-3.8 2-6 2-1 0-3 0-5-2 1.8-2.5 4-2.5 5-2.5z" fill="#ffffff"/>
    8.15 +  <use transform="matrix(-1,0,0,1,48,0)" xlink:href="#mask-left-half"/>
    8.16 +</svg>
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/manifest.json.in	Fri Dec 14 15:59:37 2018 +0100
     9.3 @@ -0,0 +1,26 @@
     9.4 +{
     9.5 +    "manifest_version": 2,
     9.6 +    "name": "__MSG_extensionName__",
     9.7 +    "version": "@VERSION@",
     9.8 +    "description": "__MSG_extensionDescription__",
     9.9 +    "author": "Guido Berhoerster",
    9.10 +    "homepage_url": "https://code.guido-berhoerster.org/addons/firefox-addons/open-incognito/",
    9.11 +    "default_locale": "en",
    9.12 +    "applications": {
    9.13 +        "gecko": {
    9.14 +            "id": "open-incognito@code.guido-berhoerster.org",
    9.15 +            "strict_min_version": "60.0"
    9.16 +        }
    9.17 +    },
    9.18 +    "icons": {
    9.19 +        "48": "icons/open-incognito-48.png",
    9.20 +        "96": "icons/open-incognito-96.png"
    9.21 +    },
    9.22 +    "permissions": [
    9.23 +        "menus",
    9.24 +        "<all_urls>"
    9.25 +    ],
    9.26 +    "background": {
    9.27 +        "scripts": [ "background.js" ]
    9.28 +    }
    9.29 +}