Skip to content

Commit c4cbdc5

Browse files
committed
Added loading spinner to popup menu ↞ [auto-sync from https://github.com/KudoAI/chatgpt.js-chrome-starter]
1 parent d736cdc commit c4cbdc5

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

starters/chrome/extension/popup/controller.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,7 @@
132132
moreExtensionsSpan.onclick = () => { chrome.tabs.create({ url: app.urls.relatedExtensions }) ; close() }
133133
moreExtensionsSpan.append(moreExtensionsIcon) ; footer.append(moreExtensionsSpan)
134134

135+
// Hide loading spinner
136+
document.querySelectorAll('[class^="loading"]').forEach(elem => elem.style.display = 'none')
137+
135138
})()

starters/chrome/extension/popup/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<meta charset="UTF-8">
66
</head>
77
<body>
8+
<div class="loading-bg">
9+
<span class="loading-spinner"></span>
10+
</div>
811
<div class="menu-header">
912
<div class="logo">
1013
<img width=26 src="https://cdn.jsdelivr.net/gh/KudoAI/chatgpt.js@f0cdfc9/starters/chrome/extension/icons/icon32.png">

starters/chrome/extension/popup/style.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* General size */
2-
html { height: fit-content }
2+
html { height: fit-content ; min-height: 50px }
33
body { width: max-content ; margin: 0 ; overflow: clip }
44

55
/* General font */
@@ -10,6 +10,15 @@ body, button, input, select, textarea {
1010
a { color: #999 ; text-decoration: none }
1111
a:focus, a:hover { text-decoration: underline ; color: inherit }
1212

13+
/* Loading elems */
14+
.loading-bg { background-color: white ; width: 100% ; height: 100% ; position: absolute ; z-index: 1111; }
15+
.loading-spinner {
16+
border: 8px solid #f3f3f3 ; border-top: 8px solid #3498db ; border-radius: 50% ;
17+
width: 15vh ; height: 15vh ; animation: spin 1s linear infinite ;
18+
position: absolute ; top: calc(50% - 7.5vh - 8px) ; left: calc(50% - 7.5vh)
19+
}
20+
@keyframes spin { 0% { transform: rotate(0deg) } 100% { transform: rotate(360deg) }}
21+
1322
/* Header */
1423
.menu-header {
1524
border-bottom: solid 1px lightgrey ; padding: 5px 5px 5px 0; margin: 0 ;

0 commit comments

Comments
 (0)