Chore/move chrome ext (#3085)
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 85 KiB |
@ -1,29 +0,0 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Dify Chatbot",
|
||||
"version": "1.5",
|
||||
"description": "This is a chrome extension to inject a dify chatbot on any pages",
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"js": ["content.js"]
|
||||
}
|
||||
],
|
||||
"permissions": ["webRequest", "storage"],
|
||||
"action": {
|
||||
"default_popup": "options.html",
|
||||
"default_icon": {
|
||||
"16": "images/16.png",
|
||||
"32": "images/32.png",
|
||||
"48": "images/48.png",
|
||||
"128": "images/128.png"
|
||||
|
||||
}
|
||||
},
|
||||
"icons": {
|
||||
"16": "images/16.png",
|
||||
"32": "images/32.png",
|
||||
"48": "images/48.png",
|
||||
"128": "images/128.png"
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
body {
|
||||
background-color: #f2f2f2;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
input[type="text"] {
|
||||
width: 280px;
|
||||
padding: 6px;
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Dify Chatbot Extension</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="./tailwind.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body class="bg-gray-100 py-4 px-4 w-128">
|
||||
<div class="max-w-md mx-auto bg-white shadow-md rounded-lg p-4">
|
||||
<h2 class="text-2xl font-semibold mb-4">Dify Chatbot Extension</h2>
|
||||
<form>
|
||||
<div class="mb-4 flex items-center">
|
||||
<div class="w-1/4">
|
||||
<label for="chatbot-url" class="block font-semibold text-gray-700">ChatBot URL</label>
|
||||
</div>
|
||||
<div class="w-3/4">
|
||||
<input type="text" id="chatbot-url" name="base-url" value=""
|
||||
class="w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:border-blue-400"
|
||||
placeholder="https://udify.app/chatbot/7CQBa5yyvYLSkZtx">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 flex items-center">
|
||||
<div class="w-1/4"></div>
|
||||
<div class="w-3/4">
|
||||
<span id="error-tip" class="text-red-600"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 flex items-center">
|
||||
<div class="w-1/4"></div>
|
||||
<div class="w-3/4">
|
||||
<button id="save-button"
|
||||
class="bg-blue-500 text-white py-2 px-4 rounded hover:bg-blue-600 focus:outline-none focus:bg-blue-600">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,28 +0,0 @@
|
||||
|
||||
document.getElementById('save-button').addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const chatbotUrl = document.getElementById('chatbot-url').value;
|
||||
const errorTip = document.getElementById('error-tip');
|
||||
|
||||
if (chatbotUrl.trim() === "") {
|
||||
errorTip.textContent = "Dify ChatBot URL cannot be empty.";
|
||||
} else {
|
||||
errorTip.textContent = "";
|
||||
|
||||
chrome.storage.sync.set({
|
||||
'chatbotUrl': chatbotUrl,
|
||||
}, function () {
|
||||
alert('Save Success!');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Load parameters from chrome.storage when the page loads
|
||||
chrome.storage.sync.get(['chatbotUrl'], function (result) {
|
||||
const chatbotUrlInput = document.getElementById('chatbot-url');
|
||||
|
||||
if (result.chatbotUrl) {
|
||||
chatbotUrlInput.value = result.chatbotUrl;
|
||||
}
|
||||
|
||||
});
|
||||