Files
Oliver Dunk 31439d3b4e Add API sample for User Scripts API (#1023)
* Add API sample for User Scripts API

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>

* Use chrome.userScripts.update method

* Filter getScripts call

* Add minimum_chrome_version

* Apply suggestions from code review

Co-authored-by: Joe Medley <jmedley@google.com>

---------

Co-authored-by: Joe Medley <jmedley@google.com>
Co-authored-by: amysteamdev <37001393+AmySteam@users.noreply.github.com>
2023-11-01 14:02:18 -05:00

57 lines
1.6 KiB
HTML

<!--
Copyright 2023 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,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>User Scripts API Demo</title>
<link rel="stylesheet" type="text/css" href="options.css" />
<script defer src="options.js"></script>
</head>
<body>
<div id="warning">
<p>
⚠️ To use the User Scripts API, you need to first enable developer mode
at <b>chrome://extensions</b>.
</p>
<a href="">Reload</a>
</div>
<form id="settings-form">
<h1>Settings</h1>
<h2>Type</h2>
<label>
<input type="radio" name="type" value="file" />
<span>File</span>
</label>
<label>
<input type="radio" name="type" value="custom" />
<span>Custom text</span>
</label>
<div id="custom-script-wrapper">
<h2>Custom script</h2>
<textarea
name="custom-script"
draggable="false"
rows="8"
placeholder="alert('hi');"
></textarea>
</div>
<button type="button" id="save-button">Save & Enable</button>
</form>
</body>
</html>