GithubHelp home page GithubHelp logo

irvinm / tst-lock Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 45 KB

Protect your tabs in TST by replacing the close "X" with a lock. Toggle via "Ctrl + Shift + Left Mouse Click"

Home Page: https://addons.mozilla.org/en-US/firefox/addon/tst-lock/

License: MIT License

JavaScript 95.21% Makefile 1.89% Batchfile 2.91%

tst-lock's Introduction

Hi there ๐Ÿ‘‹

Anurag's github stats

tst-lock's People

Contributors

irvinm avatar

Stargazers

 avatar

Watchers

 avatar

tst-lock's Issues

Explore supporting custom lock graphics

Current lock content just uses the Unicode lock symbol. The content tag does support a URL() option, but wondering if that resource can be stored within the addon and referenced locally.

Exploring different ways to pass icon to TST

Below are some of the ways I tried to pass content to TST ... some worked, some didn't.

I just wanted to document this in case I wanted to explore other options.

function registerSelfToTST() {
  browser.runtime.sendMessage(kTST_ID, {
    type: "register-self",
    name: "TST-Lock",
    icons: browser.runtime.getManifest().icons,
    listeningTypes: ["tab-mousedown", "tab-mouseup"],
    style: `
      .tab.locked .closebox {
        pointer-events: none !important;
      }
      .tab:not(.faviconized).locked .closebox::after {
        background: none;

        /* Works */
        /* https://www.compart.com/en/unicode/U+1F512#UNC_DB */
        /* content: "๐Ÿ”’"; */
        /* content: url("http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/24/Actions-document-encrypt-icon.png"); */
        /* content: url("http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/lock-icon.png"); */
        /* content: url("moz-extension://32b76189-c6cf-43d0-af5c-e10691134da7/lock.png"); */
        /* content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAD5ElEQVR42rWWX2gcVRTGv7uzs7Ozs/83m2xIumIKNbErYtq0ogYhvogCiVFTVKm+6EsrFHzy2beAvlgVKiAVsChobcECYiVCrCqlbYymRaPRkm6y22RnN7Ob7Py593oYtEltm8VIv+EwOzPnfj/OOXeGZVJK3E4FgdaaPHko2dk9MLpqzj3809kJ0R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bp+LAAO4YNb52ebH1To/B2BNkv4Z3rUgBShUCsU//5dYXxMYfbd8zfO2/235CyRUGSky0aqyAAAAAElFTkSuQmCC'); */
        /* content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAB3RJTUUH5AYYDC4WrSU8/QAABBpJREFUeJy1VG1olWUYvu77fd73HLeac0JkzG2G82NsiAxFQ3QaVlMiEvLHwqxICcF/1b8oCn/0QQUZgQhBECKU1Q9XiflDSs3m/FjOo1s6tU1ba2fudM523vd97rsf7znbzj7cDHrg+Xff18d9X89DuMshIkdVrXFd1NbWLVu8tKbO87zSTCbde7Gt7WziUnvH2LpJMaYD37hpc8MLL+18s7K8Yo1jHEdUwcTws9lMR8fl5o8/+uD1c61nEszsiMgEkkkJ8uC7X3lt13Pbnv8keSeJnt5eWGjUoQqPDebPewiu6w3sefuNZ5q//eYoEbGqyl0J8kqeenpL41t73mlO/H4l7EsNGgD+9c7O45l0+q/SsrKq8gVVq60fauWD86i0ZHZq144X6y+cP9dJxKQqMhUBAcB9JSWxLw5+ecGLxxdeu91Nd/qT5z/bu3fblUvtbTkRWLH6kceadu783DVmbl31EnPhbOvXu1/esUWBgn3wOPUMQBvWb2iYX15RfbuvDza0yU/fe/fJK5fa24jIEJEjIuaXn386cmD//ibH8/iPW91av2Ll5kW1tZWqaomIJyUAQA6DH65euO5qz00NIHSxteWrG11dNz3PKWJWMCsZB3BdjrecOH6s50bXrwOZNP2Z7PcWL6pexQSekkBV2ApkSExJX/Jvco2Dtt86TwKA70vGWoTWIgwtwiCQ4dACnZevnXFdg95kH7IaLxaF0JjRm7HqVeFvXInlSyqCWmKjgQWtq3ceXVpMniDGBcsjZoYvVQu4TpSgIF2zLFjb144fWxJ6PbdPNdHs4YjAbn08tuHgh/LD9+1Jc/KWVaIQW9dnm5Y9a5oQzgJYR+UIAcbiSMcQTnSHABRbVqW2v/qEaVy9HataE2EXEdhEaiJLa5fzVrGeWTz7Oz/rD3hxM4R5s05L/0BcFLYgcgrAoRhqSpt5aLif42aI5rqnfa+46IH6muGNrQnsY4ZjotlHTdlQlNKOlqVT3DjnMACCPxhjUWd8GEZWOIdS2DTnMBSEzKDHej+rb5XzIiIH+fI0g7qYtN9F1vUABYgUDnRyfAAKg2F1I7hAQSETB6M2zYhfAEhRVOe7CDMGRFMDTyBSAsV8IBDQP5FkGiGgiITyTAJoSLkQT/kfFvhQJUCjgGq+hwpjOgJGjoI9OzPsUQ4oS6FQTCDI1VqC9R0Q6z05IMcCZAt6JiX4zw4cwfg8/E8OpiEYdTBzAoCmdpB/aKKqCkAChmTdnIOZHVUCk4WSVckBaj6mlItpzJBLIHglWbgmO2Pw/AkCgNQhz0TfNeWTrhoZS9yyx6zVAEoklnEv14akTOQMDUvqaq89lcMVjkYDC4D3HcseaOkMDxXFiEVFiBREmPYCClGV4lkUHjrlv3/0YthKAItC/gWYUiVDPGS12QAAAABJRU5ErkJggg=='); */

        /* Doesn't work */
        /* content: url(myURL); */
        /* content: url(browser.runtime.getURL('/lock.png')); */
        /* content: url(moz-extension://__MSG_@@extension_id__/lock.png); */
        /* content: url(lock.png); */
        /* content: url('/lock.png'); */

        /* Current selection */
        content: "๐Ÿ”’";          
        line-height: 1;
        mask: none;
      }
    `,
  });
}

Closing locked tab results in new tab without lock

  • TST 3.5.15 \ TST-Lock 1.0.3
  • Create tab
  • Lock tab
  • Right-click on TST tab and select "Close Tab"
  • Original lock tab closes
  • New tab (same URL) is opened without the lock
  • Right-click on TST tab and select "Close Tab" (Or now click on "X")
  • Tab closes

Workaround is to either close tab twice or remove lock then close tab.

Locks not restored on Firefox start-up (v1.1.2)

Logging seems to show that "ready" event was never received, but did receive a "wait-for-shutdown" event.

Add-on is working fine otherwise. Restarting Firefox gets the locks loaded properly.

2020-11-03_8-18-59

Allow option to select from a set of lock icons

  • Better lock icons are already in the "images" folder and exposed outside the addon.
  • Might need to just convert PNGs to base64 strings to pass to TST.
  • Not sure if passing a variable to TST will work after setting it to the string.

TST upgrade problem while browser is running

Scenario:

  • TST is installed and running.
  • TST-Lock is installed and running.
  • TST upgrades its version when the browser is running.
  • TST-Lock no longer displays locked tabs.
  • Workaround: Disable\enable TST-Lock OR restart browser.

Observations:

  • Trying to reproduce in Sandbox ... could not do it. Every upgrade worked fine.
  • Guess is that either TST is not sending some notification OR TST-Lock needs to monitor for a broken promise from TST to then try to re-initiate communications.

Successful upgrade:

image

Integrate lock information with "Tab Session Manager" session management

  • Lock information is currently handled by this addon by storing the lock state as part of get\setTabValue.
  • This works well within the current session.
  • Information will be lost if the session is lost.
  • If TSM then restores a session, no lock information will exist in the new session.
  • Ideally would be best to tie into TSM such that the tab information is saved as part of the "session" which could then be restored.
  • TabValue functions can only be get\set from the addon who created it. (Either TST-Lock or TSM)
  • Else would need to pass information to an "owner" of the info thus complicating the scenario.

  • sessions.setTabValue()
  • TSM save.js
  • Would need a means to ask TSM to save and restore information. (Would TST-Lock need to ask TSM for info during start-up each time?)
  • Given that TSM hasn't had a real check-in for several months, might just want to fork the project and customize.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.