{"id":16768775,"url":"https://github.com/phptuts/rocket-final","last_synced_at":"2025-03-16T13:43:10.031Z","repository":{"id":172634108,"uuid":"649538217","full_name":"phptuts/rocket-final","owner":"phptuts","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-11T05:49:49.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T01:26:49.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phptuts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-05T05:16:48.000Z","updated_at":"2023-06-11T05:49:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fffb131-a7e0-4839-a24f-77675cc7aca2","html_url":"https://github.com/phptuts/rocket-final","commit_stats":null,"previous_names":["phptuts/rocket-final"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phptuts%2Frocket-final","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phptuts%2Frocket-final/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phptuts%2Frocket-final/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phptuts%2Frocket-final/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phptuts","download_url":"https://codeload.github.com/phptuts/rocket-final/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878437,"owners_count":20362432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T06:12:30.833Z","updated_at":"2025-03-16T13:43:10.012Z","avatar_url":"https://github.com/phptuts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chrome Extension Starter Kit\n\n## Setup Developement\n\n1. Download the chrome extension starter kit\n\n2. Install type hinting dependencies\n\n```\nnpm install\n```\n\n4. Go to chrome://extensions in the browser\n\n5. Turn on developer mode in the top right of the screen.\n\n6. Click on load unpacked extension\n\n## Chrome Extensions Snippets\n\n### How to register your right click icons\n\n```\nvar contextMenuItem = {\n  id: 'spendMoney',\n  title: 'SpendMoney',\n  contexts: ['selection']\n};\n\n// This should only happen once\nchrome.runtime.onInstalled.addListener(function() {\n  chrome.contextMenus.create(contextMenuItem);\n});\n```\n\n## How to respond to your own right click icon events\n\n```\nchrome.contextMenus.onClicked.addListener(function(clickedData) {\n  if (clickedData.menuItemId == 'spendMoney' \u0026\u0026 clickedData.selectionText) {\n      // Notice the id spend Money above\n  }\n});\n```\n\n### How to store data in for later\n\n```\nchrome.storage.sync.set({ example: data }, function() { });\n```\n\n### How to fetch data you stored\n\n```\nchrome.storage.sync.get(['example1', 'exampl2'], function(ex) { });\n```\n\n### How to send a simple notification\n\n```\nvar notifOptions = {\n    type: 'basic',\n    iconUrl: 'icon48.png',\n    title: 'Example!',\n    message: 'Example Message!'\n};\nchrome.notifications.create(\n    'limitNotif' + new Date().getTime(), // Id must be unique for every notification\n    notifOptions\n);\n```\n\n### How to register a content script\n\n```\n\"content_scripts\": [\n    {\n      \"js\": [\"content.js\"],\n      \"exclude_matches\": [\"*://*.youtube.com/watch*\"],\n      \"matches\": [\"https://*.youtube.com/*\"],\n      \"run_at\": \"document_end\"\n    }\n  ],\n```\n\n### How Send Message from background script to content script\n\n```\nchrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {\n    chrome.tabs.sendMessage(tabs[0].id, {\n      src: clickedData.srcUrl,\n      type: 'replace_image'\n    });\n});\n```\n\n### How to recieve a message from background script to the content script\n\n```\nchrome.runtime.onMessage.addListener(function(message, sender, reply) { });\n```\n\n## Packing Chrome Extension\n\n- Delete node_modules folder we are using it for type hinting only.\n\n\n## Image Attribution\n\nIcons made by \u003ca href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\"\u003eFreepik\u003c/a\u003e from \u003ca href=\"https://www.flaticon.com/\" title=\"Flaticon\"\u003e www.flaticon.com\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphptuts%2Frocket-final","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphptuts%2Frocket-final","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphptuts%2Frocket-final/lists"}