mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Replace cat GIF source (#440)
chilloutandwatchsomecatgifs.com now appears to serve ads. Replaced the link open on activating the page action with https://giphy.com/explore/cat. Also made some minor improvements to the readme file.
This commit is contained in:
@@ -2,17 +2,16 @@
|
|||||||
|
|
||||||
## What it does
|
## What it does
|
||||||
|
|
||||||
After N seconds of inactivity (defined as the user not having navigated
|
After 6 seconds of inactivity (defined as the user not having navigated
|
||||||
or switched away from the active tab) display a
|
or switched away from the active tab) display a
|
||||||
[page action](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/pageAction)
|
[page action](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/pageAction)
|
||||||
for that tab.
|
for that tab.
|
||||||
|
|
||||||
When the user clicks the page action,
|
When the user clicks the page action, navigate to https://giphy.com/explore/cat.
|
||||||
navigate to http://chilloutandwatchsomecatgifs.com/.
|
|
||||||
|
|
||||||
"N" is set to 6 seconds in this example. Such a short period is chosen to make
|
The delay of 6 seconds is to make the extension's behavior obvious, but such a short
|
||||||
the extension's behavior more obvious, but this is not recommended in real life.
|
period is not recommended in practical applications. Note that in Chrome, alarms do not
|
||||||
Note that in Chrome, alarms cannot be set for less than a minute. In Chrome:
|
fire in under a minute. In Chrome:
|
||||||
|
|
||||||
* if you install this extension "unpacked", you'll see a warning
|
* if you install this extension "unpacked", you'll see a warning
|
||||||
in the console, but the alarm will still go off after 6 seconds
|
in the console, but the alarm will still go off after 6 seconds
|
||||||
@@ -21,6 +20,8 @@ a minute.
|
|||||||
|
|
||||||
## What it shows
|
## What it shows
|
||||||
|
|
||||||
* how to use various `tabs` functions
|
How to:
|
||||||
* how to show/hide a page action
|
|
||||||
* how to set alarms and handle alarms going off
|
* use various `tabs` functions.
|
||||||
|
* show and hide a page action.
|
||||||
|
* set alarms and handle alarms going off.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ in the console, but the alarm will still go off after 6 seconds
|
|||||||
a minute.
|
a minute.
|
||||||
*/
|
*/
|
||||||
var DELAY = 0.1;
|
var DELAY = 0.1;
|
||||||
var CATGIFS = "http://chilloutandwatchsomecatgifs.com/";
|
var CATGIFS = "https://giphy.com/explore/cat";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Restart alarm for the currently active tab, whenever background.js is run.
|
Restart alarm for the currently active tab, whenever background.js is run.
|
||||||
|
|||||||
Reference in New Issue
Block a user