This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alreadyClicked = false; | |
let timer; | |
chrome.action.onClicked.addListener(function(tab) { | |
let wasClicked = alreadyClicked; | |
// Reset state | |
if (wasClicked) { | |
clearTimeout(timer); | |
alreadyClicked = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number} srcPixels Number of pixels used when rendering on a standard desktop dispaly. Defaults to 1 pixel | |
* @param {number} distance Distance in inches at which the item is rendered. Defaults to 28 inches (distance specified in the CSS spec) | |
* | |
* https://www.w3.org/TR/css-values-4/#reference-pixel | |
*/ | |
function getProjectedPixel({pixels = 1, distance = 28} = {}) { | |
const inToMm = (inch) => inch * 25.4; | |
const opposite = distance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<script src="devtools.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Web Workers basic example</title> | |
</head> | |
<body> | |
<script src="main.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2021 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
let videos = [ | |
{ | |
url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4', | |
type: 'video/mp4', | |
}, { | |
url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm', | |
type: 'video/webm', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Copyright 2021 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 | |
--> | |
<video width="320" height="240" controls | |
preload="none" playsinline="" aria-label="Stephen Colbert Popcorn Munching GIF" | |
disablepictureinpicture="" poster="https://pbs.twimg.com/tweet_video_thumb/E8o7fA9VoAojxVl.jpg" | |
src="https://video.twimg.com/tweet_video/E8o7fA9VoAojxVl.mp4" type="video/mp4"></video> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2021 Google LLC | |
// | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file or at | |
// https://developers.google.com/open-source/licenses/bsd | |
// Use importScripts to load other JS files | |
import { demo } from './lib.js'; | |
console.log(demo.greeting); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2021 Google LLC | |
// | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file or at | |
// https://developers.google.com/open-source/licenses/bsd | |
// Use importScripts to load other JS files | |
importScripts('./lib.js'); | |
console.log(self.demo.greeting); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2019 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
chrome.runtime.onInstalled.addListener(({reason}) => { | |
console.log(reason); | |
console.log(chrome.runtime.OnInstalledReason.UPDATE); | |
if (reason === chrome.runtime.OnInstalledReason.INSTALL || | |
reason === chrome.runtime.OnInstalledReason.UPDATE) { | |
chrome.tabs.create({url: 'popup.html'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright 2020 Google LLC | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
https://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |
NewerOlder