Pith - grit
grit/grit_firefox/background.js [0.8 kb]
Modified: 18:55:48 154 026 (20 Aug 026)
3 Days Ago
const api = globalThis.browser ?? globalThis.chrome;
const MENU_ID = "grit-copy";

function inject(tabId, frameIds) {
  api.scripting.executeScript({
    target: frameIds ? { tabId, frameIds } : { tabId, allFrames: true },
    files: ["grit.js"]
  });
}

api.runtime.onInstalled.addListener(() => {
  api.contextMenus.create({
    id: MENU_ID,
    title: "Copy Git",
    contexts: ["selection"],
    icons: { "16": "icons/grit_icon.png", "32": "icons/grit_icon.png" }
  });
});

api.contextMenus.onClicked.addListener((info, tab) => {
  if (info.menuItemId !== MENU_ID || !tab?.id) return;
  inject(tab.id, [info.frameId ?? 0]);
});

api.commands.onCommand.addListener(async (name, tab) => {
  if (name !== "copy-git") return;
  const id = tab?.id ?? (await api.tabs.query({ active: true, currentWindow: true }))[0]?.id;
  if (id) inject(id);
});
Updates
Kerf - Android 157.026
Kiln - Android 157.026
Wedge - Android 156.026
Whittle - Linux 155.026
Grit - Firefox/Chrome 154.026

Menu
Calendar
Project Tin (024/029)
Miter
RSS Feed
User Avatar
@vgmlr
=SUM(parts)
0.00166
257,097 (+351)