Browse Source

Init commit;

master
Nero Ignis 5 years ago
parent
commit
3b96264f30
  1. 19
      background.js
  2. BIN
      images/luna.png
  3. 26
      manifest.json
  4. 22
      popup.html
  5. 21
      popup.js

19
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()]
}]);
});
});

BIN
images/luna.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

26
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
}

22
popup.html

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Kara CX</title>
<style>
body {
margin: 0;
padding: 0;
}
#frame {
border: none;
margin: 0;
height: 500px;
width: 400px;
}
</style>
</head>
<body>
<iframe src="https://luna-development.net/kara" id="frame"></iframe>
</body>
</html>

21
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 + '";'});
// });
// };