aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/background.js24
-rw-r--r--public/content_script.js27
-rw-r--r--public/index.html26
-rw-r--r--public/manifest.json28
-rw-r--r--public/page.html16
5 files changed, 84 insertions, 37 deletions
diff --git a/public/background.js b/public/background.js
new file mode 100644
index 0000000..f94c039
--- /dev/null
+++ b/public/background.js
@@ -0,0 +1,24 @@
+
+
+chrome.browserAction.onClicked.addListener( (tab) =>{
+ chrome.tabs.create({ 'url': chrome.extension.getURL('index.html') }, (tab) => {
+
+ });
+});
+
+
+chrome.runtime.onConnect.addListener(port => {
+ port.onMessage.addListener(message => {
+ /* Perform an action if the message meets our criteria */
+ if (message.code === "getBookMarks") {
+ getBookMarks(port)
+ }
+ })
+});
+
+getBookMarks = (port) => {
+ chrome.bookmarks.getTree(function (data) {
+ port.postMessage({ bookMarkData: data})
+ });
+
+} \ No newline at end of file
diff --git a/public/content_script.js b/public/content_script.js
new file mode 100644
index 0000000..612ecf5
--- /dev/null
+++ b/public/content_script.js
@@ -0,0 +1,27 @@
+(function(){
+
+ /* Open port on popup file */
+ const port = chrome.runtime.connect({
+ name: "bookmarkArranger"
+ });
+
+ /* Listen for messages on the port */
+ port.onMessage.addListener(message => {
+ console.log(message)
+ });
+
+ document.getElementById('sendMessage').addEventListener('click', ()=>{
+ /* Send a message through the port */
+ port.postMessage({
+ code: "getBookMarks"
+ });
+ })
+
+
+
+
+})();
+
+
+
+
diff --git a/public/index.html b/public/index.html
index dd1ccfd..4c5a273 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5,34 +5,12 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
- <!--
- manifest.json provides metadata used when your web app is installed on a
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
- -->
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
- <!--
- Notice the use of %PUBLIC_URL% in the tags above.
- It will be replaced with the URL of the `public` folder during the build.
- Only files inside the `public` folder can be referenced from the HTML.
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
- work correctly both with client-side routing and a non-root public URL.
- Learn how to configure a non-root public URL by running `npm run build`.
- -->
- <title>React App</title>
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+ <title>Bookmark Arranger</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
- <!--
- This HTML file is a template.
- If you open it directly in the browser, you will see an empty page.
-
- You can add webfonts, meta tags, or analytics to this file.
- The build step will place the bundled scripts into the <body> tag.
-
- To begin the development, run `npm start` or `yarn start`.
- To create a production bundle, use `npm run build` or `yarn build`.
- -->
</body>
</html>
diff --git a/public/manifest.json b/public/manifest.json
index 1f2f141..72678e3 100644
--- a/public/manifest.json
+++ b/public/manifest.json
@@ -1,15 +1,17 @@
{
- "short_name": "React App",
- "name": "Create React App Sample",
- "icons": [
- {
- "src": "favicon.ico",
- "sizes": "64x64 32x32 24x24 16x16",
- "type": "image/x-icon"
- }
+ "short_name": "Bookmark Arranger",
+ "name": "Bookmark Arranger",
+ "version": "1.0",
+ "description": "Bookmark Arrange",
+ "manifest_version": 2,
+ "background": {
+ "scripts": [
+ "background.js"
+ ],
+ "persistent": false
+ },
+ "permissions": [
+ "bookmarks"
],
- "start_url": ".",
- "display": "standalone",
- "theme_color": "#000000",
- "background_color": "#ffffff"
-}
+ "browser_action": {}
+} \ No newline at end of file
diff --git a/public/page.html b/public/page.html
new file mode 100644
index 0000000..66f4a9d
--- /dev/null
+++ b/public/page.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <title>Document</title>
+</head>
+<body>
+ <h2>Ola</h2>
+ <div id="renderArea"></div>
+ <button id="sendMessage">Send Message</button>
+
+ <script src="./content_script.js"></script>
+</body>
+</html> \ No newline at end of file