diff --git a/background.js b/background.js new file mode 100644 index 0000000..d374224 --- /dev/null +++ b/background.js @@ -0,0 +1,19 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +chrome.runtime.onInstalled.addListener(function () { + chrome.storage.sync.set({color: '#3aa757'}, function () { + console.log('The color is green.'); + }); + chrome.declarativeContent.onPageChanged.removeRules(undefined, function () { + chrome.declarativeContent.onPageChanged.addRules([{ + conditions: [new chrome.declarativeContent.PageStateMatcher({ + pageUrl: {hostEquals: 'luna-development.net'}, + })], + actions: [new chrome.declarativeContent.ShowPageAction()] + }]); + }); +}); diff --git a/images/luna.png b/images/luna.png new file mode 100644 index 0000000..241a332 Binary files /dev/null and b/images/luna.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..573de96 --- /dev/null +++ b/manifest.json @@ -0,0 +1,26 @@ +{ + "name": "Kara CX", + "version": "1.0", + "description": "Your personal chatbot.", + "permissions": ["declarativeContent", "storage"], + "background": { + "scripts": ["background.js"], + "persistent": false + }, + "page_action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/luna.png", + "32": "images/luna.png", + "48": "images/luna.png", + "128": "images/luna.png" + } + }, + "icons": { + "16": "images/luna.png", + "32": "images/luna.png", + "48": "images/luna.png", + "128": "images/luna.png" + }, + "manifest_version": 2 +} diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..4940dd3 --- /dev/null +++ b/popup.html @@ -0,0 +1,22 @@ + + + + Kara CX + + + + + + diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..5772e38 --- /dev/null +++ b/popup.js @@ -0,0 +1,21 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +// let changeColor = document.getElementById('changeColor'); +// +// chrome.storage.sync.get('color', function(data) { +// changeColor.style.backgroundColor = data.color; +// changeColor.setAttribute('value', data.color); +// }); +// +// changeColor.onclick = function(element) { +// let color = element.target.value; +// chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { +// chrome.tabs.executeScript( +// tabs[0].id, +// {code: 'document.body.style.backgroundColor = "' + color + '";'}); +// }); +// };