Skip to content

Commit 954ee3a

Browse files
committed
Add missing readme files. Fixes #798
1 parent 36f4297 commit 954ee3a

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Drink Water Alarm
2+
3+
This example demonstrates how to use the [Alarms API](https://developer.chrome.com/docs/extensions/reference/api/alarms) and [Notifications API](https://developer.chrome.com/docs/extensions/reference/api/notifications) to remind users to drink water at set intervals.
4+
5+
## Overview
6+
7+
The extension allows users to set a recurring reminder to stay hydrated. Users can choose from preset intervals (1, 15, or 30 minutes) through a popup interface. When the alarm fires, a notification appears prompting the user to drink water.
8+
9+
## Implementation Notes
10+
11+
The extension uses several Chrome APIs together:
12+
13+
- `chrome.alarms` - Creates and manages the reminder timer
14+
- `chrome.notifications` - Displays the hydration reminder when the alarm fires
15+
- `chrome.storage.sync` - Persists the user's selected interval across sessions
16+
- `chrome.action` - Shows an "ON" badge when an alarm is active
17+
18+
When the notification appears, users can click "Keep it Flowing" to restart the timer with their previously selected interval.
19+
20+
## Running this extension
21+
22+
1. Clone this repository.
23+
2. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
24+
3. Click the extension icon to open the popup.
25+
4. Select a time interval (Sample minute, 15 Minutes, or 30 Minutes).
26+
5. Wait for the notification to appear reminding you to drink water.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Focus Mode
2+
3+
This example demonstrates how to use the [Scripting API](https://developer.chrome.com/docs/extensions/reference/api/scripting) to inject and remove CSS on demand, enabling a distraction-free reading experience on Chrome's documentation pages.
4+
5+
## Overview
6+
7+
The extension adds a focus mode toggle for Chrome's Extensions and Chrome Web Store documentation. When activated, it hides navigation elements and other distractions, centering the article content for easier reading.
8+
9+
## Implementation Notes
10+
11+
The extension uses the following Chrome APIs:
12+
13+
- `chrome.scripting.insertCSS()` - Injects the focus mode stylesheet when enabled
14+
- `chrome.scripting.removeCSS()` - Removes the stylesheet when disabled
15+
- `chrome.action` - Displays an "ON"/"OFF" badge indicating the current state
16+
- `activeTab` permission - Allows the extension to modify only the current tab
17+
18+
The focus mode can be toggled by:
19+
20+
- Clicking the extension icon
21+
- Using the keyboard shortcut (Ctrl+B on Windows/Linux, Command+B on Mac)
22+
23+
The toggle state is maintained per-tab, allowing different tabs to have different focus mode states.
24+
25+
## Running this extension
26+
27+
1. Clone this repository.
28+
2. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
29+
3. Navigate to https://developer.chrome.com/docs/extensions/ or https://developer.chrome.com/docs/webstore/.
30+
4. Click the extension icon or press Ctrl+B (Command+B on Mac) to toggle focus mode.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Open Extension API Reference
2+
3+
This example demonstrates how to use the [Omnibox API](https://developer.chrome.com/docs/extensions/reference/api/omnibox) to quickly navigate to Chrome extension API reference pages directly from the address bar.
4+
5+
## Overview
6+
7+
The extension registers the keyword "api" in Chrome's omnibox. When users type "api" followed by a space, they can search for any Chrome extension API and navigate directly to its documentation page.
8+
9+
## Implementation Notes
10+
11+
The extension uses several Chrome APIs:
12+
13+
- `chrome.omnibox` - Registers the "api" keyword and handles input/selection events
14+
- `chrome.storage.local` - Stores recent search history to provide personalized suggestions
15+
- `chrome.alarms` - Used for periodic tip fetching from an external service
16+
- Content script - Runs on the API reference pages
17+
18+
When the user types in the omnibox:
19+
20+
1. `onInputChanged` provides API suggestions based on user input and search history
21+
2. `onInputEntered` opens the selected API's reference page in a new tab
22+
3. The most recent searches (up to 4) are saved for future suggestions
23+
24+
The service worker is organized into modules:
25+
26+
- `sw-omnibox.js` - Handles omnibox events and navigation
27+
- `sw-suggestions.js` - Generates API suggestions
28+
- `sw-tips.js` - Fetches extension development tips
29+
30+
## Running this extension
31+
32+
1. Clone this repository.
33+
2. Load this directory in Chrome as an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
34+
3. Type "api" in the address bar and press Space or Tab.
35+
4. Start typing an API name (e.g., "tabs", "storage", "scripting").
36+
5. Select a suggestion or press Enter to open the API reference page.

0 commit comments

Comments
 (0)