Skip to content

Commit 0770e1e

Browse files
committed
started jss
1 parent f1f0cad commit 0770e1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5529
-51133
lines changed

chrome_extension/background/background.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const DEFAULT_STORAGE = {
44
plugin_is_on: false,
5+
sidebarIsOpen: false,
56
include_list: []
67
};
78

@@ -89,12 +90,16 @@ backgroundMessageHandler.readFile = (request, sender, sendResponse) => {
8990
return true;
9091
};
9192

93+
backgroundMessageHandler.toggleSidebar = (request, sender, sendResponse) => {};
94+
9295
backgroundMessageHandler.activateSidebar = (request, sender, sendResponse) => {
93-
chrome.tabs.query({ currentWindow: true, active: true }, (tabs) => {
94-
chrome.tabs.sendMessage(tabs[0].id, {
95-
researchyAction: "activateSidebar"
96-
});
97-
});
96+
chrome.storage.sync.set({ sidebarIsOpen: true });
97+
queryAllTabs({ researchyAction: "openSidebar" });
98+
};
99+
100+
backgroundMessageHandler.closeSidebar = (request, sender, sendResponse) => {
101+
chrome.storage.sync.set({ sidebarIsOpen: false });
102+
queryAllTabs({ researchyAction: "closeSidebar" });
98103
};
99104

100105
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {

chrome_extension/content/sidebar.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,27 @@ var Delta = Quill.import("delta");
77

88
$("html").prepend(
99
`<iframe id="researchySidebar" src="${chrome.runtime.getURL(
10-
"/static/html/sidebar.html"
10+
"/sidebar/index.html"
1111
)}"></iframe>`
1212
);
1313

1414
const sidebarWindow = document.getElementById("researchySidebar").contentWindow;
1515

1616
if (window.location.href == "https://this-page-intentionally-left-blank.org/")
17-
$("#researchySidebar, #annotatedHTML, body").addClass("sidebarActive");
17+
$("#researchySidebar, #annotatedHTML, body").addClass("sidebarIsOpen");
1818

1919
chrome.runtime.onMessage.addListener((message, callback) => {
2020
// console.log(message);
2121
switch (message.researchyAction) {
22-
case "activateSidebar":
22+
case "openSidebar":
2323
$("#researchySidebar, #annotatedHTML, body").addClass(
24-
"sidebarActive"
24+
"sidebarIsOpen"
2525
);
26-
sidebarWindow.postMessage({
27-
researchyAction: "sidebarActivated"
28-
});
26+
break;
27+
case "closeSidebar":
28+
$("#researchySidebar, #annotatedHTML, body").removeClass(
29+
"sidebarIsOpen"
30+
);
31+
break;
2932
}
3033
});

chrome_extension/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"externally_connectable": {
5555
"matches": ["chrome-extension://ngeljggnajfepdokmccoolkjbomnlime/**"]
5656
},
57-
"web_accessible_resources": ["static/html/sidebar.html", "**.js", "**.css"],
57+
"web_accessible_resources": ["sidebar/*.html", "**.js", "**.css"],
5858
"oauth2": {
5959
"client_id": "791991284503-42csc8frdl1tiu20lh7kobk15l7bjqb8.apps.googleusercontent.com",
6060
"scopes": ["https://www.googleapis.com/auth/drive"]
File renamed without changes.

chrome_extension/static/css/FileSystem.css renamed to chrome_extension/sidebar/fs.css

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,23 @@ button:focus {
8888
background-color: transparent !important;
8989
}
9090

91+
.ql-container.ql-snow {
92+
border-bottom: none;
93+
}
94+
95+
.ql-toolbar.ql-snow {
96+
padding: 0;
97+
padding-top: 1rem;
98+
}
99+
100+
.ql-container {
101+
border: none !important;
102+
}
103+
91104
.EditorTopBar__TextField {
92-
margin-top: 1rem !important;
93-
margin-bottom: 1rem !important;
94105
flex-grow: 1;
95106
}
107+
108+
.EditorTopBar__Button {
109+
padding: 0 !important;
110+
}

chrome_extension/sidebar/index.bundle.js

Lines changed: 5181 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 92 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,99 @@
1-
<!DOCTYPE html>
1+
<!-- <!DOCTYPE html> -->
22
<html>
33
<head>
4-
<meta charset="UTF-8" />
5-
<meta
6-
name="viewport"
7-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
4+
<link
5+
rel="stylesheet"
6+
href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css"
7+
/>
8+
<link href="/utils/quill/quill.snow.css" rel="stylesheet" />
9+
<link href="sidebar.css" rel="stylesheet" />
10+
<link href="fs.css" rel="stylesheet" />
11+
12+
<link
13+
href="https://fonts.googleapis.com/css2?family=Literata:ital,wght@0,400;0,700;1,400&display=swap"
14+
rel="stylesheet"
815
/>
9-
<title>React Starter</title>
10-
</head>
1116

17+
<link
18+
rel="stylesheet"
19+
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
20+
/>
21+
22+
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
23+
<link
24+
href="https://fonts.googleapis.com/icon?family=Material+Icons"
25+
rel="stylesheet"
26+
/>
27+
28+
<!-- <script src="http://localhost:8097"></script> -->
29+
</head>
1230
<body>
13-
<div id="root"></div>
14-
<noscript> You need to enable JavaScript to run this app. </noscript>
15-
<script src="utils/FileSystemClient.js"></script>
16-
<script src="index.js"></script>
31+
<div id="app"></div>
32+
<div id="FileSystem" class="fileSystemActive" style="display: none">
33+
<div id="foldersMenu" style="display: none"></div>
34+
<!-- <div id="FileSystem"></div> -->
35+
</div>
36+
<div id="editorContainer" style="display: none">
37+
<div id="topbar">
38+
<a
39+
id="activateFileSystem"
40+
class="waves-effect waves-blue btn-flat"
41+
><i class="material-icons">menu</i></a
42+
>
43+
<div
44+
class="input-field inline"
45+
style="
46+
margin-top: 0;
47+
margin-bottom: 0;
48+
flex-grow: 1;
49+
width: auto;
50+
"
51+
>
52+
<input
53+
id="filenameInput"
54+
type="text"
55+
class="validate"
56+
placeholder="Untitled"
57+
style=""
58+
/>
59+
<span
60+
class="helper-text"
61+
data-error="Filename already taken"
62+
></span>
63+
</div>
64+
<a
65+
id="deactivateSidebarButton"
66+
class="waves-effect waves-blue btn-flat"
67+
>
68+
<i class="material-icons">chevron_left</i>
69+
</a>
70+
</div>
71+
<div id="editor"></div>
72+
<div id="editorPreloaderContainer">
73+
<div class="preloader-wrapper big active">
74+
<div class="spinner-layer spinner-blue-only">
75+
<div class="circle-clipper left">
76+
<div class="circle"></div>
77+
</div>
78+
<div class="gap-patch">
79+
<div class="circle"></div>
80+
</div>
81+
<div class="circle-clipper right">
82+
<div class="circle"></div>
83+
</div>
84+
</div>
85+
</div>
86+
</div>
87+
</div>
88+
89+
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js"></script>
90+
<script src="/utils/quill/quill.min.js"></script>
91+
<script src="/utils/FileSystem.js"></script>
92+
<script src="/utils/FileSystemClient.js"></script>
93+
<script src="/utils/utils.js"></script>
94+
95+
<script src="index.bundle.js"></script>
96+
97+
<!-- <script src="{{/static/js/sidebarScript.js}}"></script> -->
1798
</body>
1899
</html>

chrome_extension/static/css/sidebar.css renamed to chrome_extension/sidebar/sidebar.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ html::-webkit-scrollbar {
5353
font-family: "Literata", serif;
5454
}
5555

56+
.ql-editor h1,
57+
.ql-editor h2 {
58+
margin-top: 1.3rem;
59+
margin-bottom: 0.7rem;
60+
}
61+
5662
#editorContainer {
5763
flex-flow: column;
5864
height: 100vh;
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
#activateSidebarButton {
2-
z-index: 2147483600;
3-
cursor: pointer;
4-
background-color: white;
5-
border: none;
6-
position: fixed;
7-
font-size: 1.75rem;
8-
margin-left: 0.5rem;
9-
margin-top: 0.5rem;
10-
border-radius: 50%;
11-
width: 3rem;
12-
height: 3rem;
13-
box-shadow: #3338 0px 0px 10px;
2+
z-index: 2147483600;
3+
cursor: pointer;
4+
background-color: white;
5+
border: none;
6+
position: fixed;
7+
font-size: 1.75rem;
8+
margin-left: 0.5rem;
9+
margin-top: 0.5rem;
10+
border-radius: 50%;
11+
width: 3rem;
12+
height: 3rem;
13+
box-shadow: #3338 0px 0px 10px;
1414
}
1515

1616
#researchySidebar {
17-
z-index: 2147483601;
18-
position: fixed;
19-
/*max-width: 500px;*/
20-
width: 25vw;
21-
height: 100vh;
22-
left: 0;
23-
top: 0;
24-
background-color: white;
25-
border: none;
26-
transition: margin-left 0.3s ease-in-out, box-shadow 0.3s linear;
27-
margin-left: -25vw;
17+
z-index: 2147483601;
18+
position: fixed;
19+
/*max-width: 500px;*/
20+
width: 25vw;
21+
height: 100vh;
22+
left: 0;
23+
top: 0;
24+
background-color: white;
25+
border: none;
26+
transition: margin-left 0.3s ease-in-out, box-shadow 0.3s linear;
27+
margin-left: -25vw;
2828
}
2929

30-
#researchySidebar.sidebarActive {
31-
margin-left: 0;
32-
box-shadow: #3338 0 0 10px;
30+
#researchySidebar.sidebarIsOpen {
31+
margin-left: 0;
32+
box-shadow: #3338 0 0 10px;
3333
}
3434

3535
#annotatedHTML {
36-
margin-left: 0;
37-
width: 100vw;
38-
height: 100vh;
39-
display: none;
40-
background-color: white;
41-
border: none;
42-
transition: width, margin-left 0.3s ease-in-out;
36+
margin-left: 0;
37+
width: 100vw;
38+
height: 100vh;
39+
display: none;
40+
background-color: white;
41+
border: none;
42+
transition: width, margin-left 0.3s ease-in-out;
4343
}
4444

45-
#annotatedHTML.sidebarActive {
46-
margin-left: 25vw;
47-
width: 75vw;
45+
#annotatedHTML.sidebarIsOpen {
46+
margin-left: 25vw;
47+
width: 75vw;
4848
}
4949

5050
body {
51-
transition: width, margin-left 0.3s ease-in-out;
51+
transition: width, margin-left 0.3s ease-in-out;
5252
}
5353

54-
body.sidebarActive {
55-
margin-left: 25vw;
56-
width: 75vw;
54+
body.sidebarIsOpen {
55+
margin-left: 25vw;
56+
width: 75vw;
5757
}

chrome_extension/static/html/popup.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<!DOCTYPE html>
2+
3+
<!-- Migrate to React -->
24
<html>
35
<head>
46
<link

0 commit comments

Comments
 (0)