@bghitcode/bghitapp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +203 -0
  3. package/dist/cli.js +2995 -0
  4. package/package.json +104 -0
  5. package/src-tauri/Cargo.lock +5966 -0
  6. package/src-tauri/Cargo.toml +59 -0
  7. package/src-tauri/Info.plist +14 -0
  8. package/src-tauri/assets/macos/dmg/background.png +0 -0
  9. package/src-tauri/assets/main.wxs +350 -0
  10. package/src-tauri/bghitapp.json +42 -0
  11. package/src-tauri/build.rs +5 -0
  12. package/src-tauri/capabilities/default.json +29 -0
  13. package/src-tauri/entitlements.plist +7 -0
  14. package/src-tauri/icons/chatgpt.icns +0 -0
  15. package/src-tauri/icons/deepseek.icns +0 -0
  16. package/src-tauri/icons/excalidraw.icns +0 -0
  17. package/src-tauri/icons/flomo.icns +0 -0
  18. package/src-tauri/icons/gemini.icns +0 -0
  19. package/src-tauri/icons/grok.icns +0 -0
  20. package/src-tauri/icons/icon.icns +0 -0
  21. package/src-tauri/icons/icon.png +0 -0
  22. package/src-tauri/icons/lizhi.icns +0 -0
  23. package/src-tauri/icons/programmusic.icns +0 -0
  24. package/src-tauri/icons/qwerty.icns +0 -0
  25. package/src-tauri/icons/twitter.icns +0 -0
  26. package/src-tauri/icons/wechat.icns +0 -0
  27. package/src-tauri/icons/weekly.icns +0 -0
  28. package/src-tauri/icons/weread.icns +0 -0
  29. package/src-tauri/icons/xiaohongshu.icns +0 -0
  30. package/src-tauri/icons/youtube.icns +0 -0
  31. package/src-tauri/icons/youtubemusic.icns +0 -0
  32. package/src-tauri/rust_proxy.toml +10 -0
  33. package/src-tauri/src/app/config.rs +100 -0
  34. package/src-tauri/src/app/invoke.rs +242 -0
  35. package/src-tauri/src/app/menu.rs +324 -0
  36. package/src-tauri/src/app/mod.rs +6 -0
  37. package/src-tauri/src/app/setup.rs +172 -0
  38. package/src-tauri/src/app/window.rs +577 -0
  39. package/src-tauri/src/inject/auth.js +75 -0
  40. package/src-tauri/src/inject/custom.js +0 -0
  41. package/src-tauri/src/inject/event.js +1111 -0
  42. package/src-tauri/src/inject/find.js +708 -0
  43. package/src-tauri/src/inject/fullscreen.js +253 -0
  44. package/src-tauri/src/inject/offline.js +68 -0
  45. package/src-tauri/src/inject/splash-transition.js +13 -0
  46. package/src-tauri/src/inject/style.js +505 -0
  47. package/src-tauri/src/inject/theme_refresh.js +59 -0
  48. package/src-tauri/src/inject/toast.js +22 -0
  49. package/src-tauri/src/lib.rs +227 -0
  50. package/src-tauri/src/main.rs +8 -0
  51. package/src-tauri/src/util.rs +245 -0
  52. package/src-tauri/tauri.conf.json +20 -0
  53. package/src-tauri/tauri.linux.conf.json +12 -0
  54. package/src-tauri/tauri.macos.conf.json +28 -0
  55. package/src-tauri/tauri.windows.conf.json +15 -0
@@ -0,0 +1,505 @@
1
+ window.addEventListener("DOMContentLoaded", (_event) => {
2
+ // Customize and transform existing functions
3
+ const contentCSS = `
4
+ #page #footer-wrapper,
5
+ .drawing-board .toolbar .toolbar-action,
6
+ .c-swiper-container,
7
+ .download_entry,
8
+ .lang, .copyright,
9
+ .wwads-cn, .adsbygoogle,
10
+ #Bottom > div.content > div.inner,
11
+ #Rightbar .sep20:nth-of-type(5),
12
+ #Rightbar > div.box:nth-child(4),
13
+ #Main > div.box:nth-child(8) > div
14
+ #Wrapper > div.sep20,
15
+ #Main > div.box:nth-child(8),
16
+ #masthead-ad,
17
+ #app > header > div > div.menu,
18
+ #root > div > div.fixed.top-0.left-0.w-64.h-screen.p-10.pb-0.flex.flex-col.justify-between > div > div.space-y-4 > a:nth-child(3),
19
+ #app > div.layout > div.main-container > div.side-bar > li.divider,
20
+ #Rightbar > div:nth-child(6) > div.sidebar_compliance,
21
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > aside > div > div > a.ChatPageFollowTwitterLink_followLink__Gl2tt,
22
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > aside > div > div > a.Button_buttonBase__0QP_m.Button_primary__pIDjn.ChatPageDownloadLinks_downloadButton__amBRh,
23
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > aside > div > div > section a[href*="/contact"],
24
+ .dc04ec1d .c7f51894 .a1e75851, .a7f3a288 .b91228e4, .efe408db .a24007f4{
25
+ display: none !important;
26
+ }
27
+
28
+ #app > header .right .avatar.logged-in{
29
+ opacity: 0;
30
+ transition: opacity 0.3s;
31
+ }
32
+
33
+ #app > header .right .avatar.logged-in:hover{
34
+ opacity: 1;
35
+ }
36
+
37
+ html::-webkit-scrollbar {
38
+ display: none !important;
39
+ }
40
+
41
+ #__next .ChatPageSidebar_menuFooter__E1KTY,#__next > div.PageWithSidebarLayout_centeringDiv___L9br > div > aside > div > menu > section:nth-child(6) {
42
+ display: none;
43
+ }
44
+
45
+ #__next > div.overflow-hidden.w-full.h-full .min-h-\\[20px\\].items-start.gap-4.whitespace-pre-wrap.break-words {
46
+ word-break: break-all;
47
+ }
48
+
49
+ #__next .PageWithSidebarLayout_mainSection__i1yOg {
50
+ width: 100%;
51
+ max-width: 1000px;
52
+ }
53
+
54
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > aside{
55
+ min-width: 260px;
56
+ }
57
+
58
+ #__next > div.overflow-hidden.w-full.h-full.relative.flex.z-0 > div.relative.flex.h-full.max-w-full.flex-1.overflow-hidden > div > main > div.absolute.left-2.top-2.z-10.hidden.md\\:inline-block{
59
+ margin-top:20px;
60
+ margin-left: 10px;
61
+ }
62
+
63
+ .a7f3a288.f0d4f23d {
64
+ padding-top: 34px;
65
+ }
66
+
67
+ .ec92d1d3 {
68
+ padding-top: 48px;
69
+ }
70
+
71
+ .chakra-ui-light #app .chakra-heading,
72
+ .chakra-ui-dark #app .chakra-heading,
73
+ .chakra-ui-light #app .chakra-stack,
74
+ .chakra-ui-dark #app .chakra-stack,
75
+ .app-main .sidebar-mouse-in-out,
76
+ .chakra-modal__content-container .chakra-modal__header > div > div,
77
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > section > header {
78
+ padding-top: 10px;
79
+ }
80
+
81
+ #__next .overflow-hidden>.hidden.bg-gray-900 span.rounded-md.bg-yellow-200 {
82
+ display: none;
83
+ }
84
+
85
+ #__next .absolute .px-3.pt-2.pb-3.text-center {
86
+ visibility: hidden;
87
+ padding-bottom: 4px;
88
+ }
89
+
90
+ #__next .h-full.w-full .text-center.text-xs.text-gray-600>span {
91
+ visibility: hidden;
92
+ height: 15px;
93
+ }
94
+
95
+ #__next > div.overflow-hidden.w-full.h-full.relative.flex > div.dark.hidden.flex-shrink-0.bg-gray-900.md\\:flex.md\\:w-\\[260px\\].md\\:flex-col > div > div > nav {
96
+ width: 100%;
97
+ }
98
+
99
+ .panel.give_me .nav_view {
100
+ top: 164px !important;
101
+ }
102
+
103
+ #Wrapper{
104
+ background-color: #F8F8F8 !important;
105
+ background-image:none !important;
106
+ }
107
+
108
+ #Top {
109
+ border-bottom: none;
110
+ }
111
+
112
+ #global > div.header-container.showSearchBoxOrHeaderFixed > header > div.right > div > div.dropdown-nav{
113
+ display: none;
114
+ }
115
+
116
+ #__next > div.AnnouncementWrapper_container__Z51yh > div > aside > div > div > menu > section:nth-child(4) > section, #__next > div.AnnouncementWrapper_container__Z51yh > div > aside > div > div > menu > section:nth-child(4){
117
+ display: none;
118
+ }
119
+
120
+ #react-root [data-testid="placementTracking"] article,
121
+ #react-root a[href*="quick_promote_web"],
122
+ #react-root a[href*="/lists"][role="link"][aria-label],
123
+ #react-root a[href*="/i/communitynotes"][role="link"][aria-label],
124
+ #react-root a[role="link"][aria-label="Communities"],
125
+ #react-root a[role="link"][aria-label="Premium"],
126
+ #react-root a[role="link"][aria-label="SuperGrok"],
127
+ #react-root a[href*="/i/verified-orgs-signup"][role="link"][aria-label] {
128
+ display: none !important;
129
+ }
130
+
131
+ #react-root [data-testid="DMDrawer"],
132
+ #react-root [data-testid="GrokDrawer"],
133
+ #react-root [data-testid="chat-drawer-root"],
134
+ #root > main > footer.justify-center.ease-in {
135
+ visibility: hidden !important;
136
+ }
137
+
138
+ #__next > div.overflow-hidden.w-full.h-full .absolute.bottom-0.left-0.w-full > div.text-center.text-xs {
139
+ visibility: hidden !important;
140
+ height: 0px !important;
141
+ }
142
+
143
+ #react-root [data-testid="primaryColumn"] > div > div {
144
+ position: relative !important;
145
+ }
146
+
147
+ #react-root [data-testid="sidebarColumn"] {
148
+ visibility: hidden !important;
149
+ width: 0 !important;
150
+ margin: 0 !important;
151
+ padding: 0 !important;
152
+ z-index: 1 !important;
153
+ }
154
+
155
+ @media only screen and (min-width: 1000px) {
156
+ #react-root main[role="main"] {
157
+ align-items: center !important;
158
+ overflow-x: clip !important;
159
+ }
160
+
161
+ #react-root [data-testid="primaryColumn"] {
162
+ width: 700px !important;
163
+ max-width: 700px !important;
164
+ margin: 0 auto !important;
165
+ }
166
+ #react-root [data-testid="primaryColumn"] > div > div:last-child,
167
+ #react-root [data-testid="primaryColumn"] > div > div:last-child div {
168
+ max-width: unset !important;
169
+ }
170
+
171
+ #react-root div[aria-label][role="group"][id^="id__"] {
172
+ margin-right: 81px !important;
173
+ }
174
+
175
+ #react-root header[role="banner"] {
176
+ position: fixed !important;
177
+ left: 0 !important;
178
+ }
179
+
180
+ #react-root header[role="banner"] > div > div > div {
181
+ justify-content: center !important;
182
+ padding-top: 0;
183
+ overflow-x: hidden;
184
+ }
185
+
186
+ #react-root form[role="search"] > div:nth-child(1) > div {
187
+ background-color: transparent !important;
188
+ }
189
+
190
+ #react-root h1[role="heading"] {
191
+ padding-top: 4px !important;
192
+ }
193
+
194
+ #react-root header[role="banner"]
195
+ nav[role="navigation"]
196
+ *
197
+ div[dir="auto"]:not([aria-label])
198
+ > span,
199
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"] > div:not(:first-child) {
200
+ display: inline-block !important;
201
+ opacity: 0 !important;
202
+ transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
203
+ }
204
+ #react-root header[role="banner"]
205
+ nav[role="navigation"]:hover
206
+ *
207
+ div[dir="auto"]:not([aria-label])
208
+ > span,
209
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"]:hover > div:not(:first-child) {
210
+ opacity: 1 !important;
211
+ }
212
+ #react-root header[role="banner"] nav[role="navigation"]:hover > * > div {
213
+ backdrop-filter: blur(12px) !important;
214
+ }
215
+ #react-root header[role="banner"] nav[role="navigation"] > a {
216
+ position: relative;
217
+ }
218
+
219
+ #react-root header[role="banner"] nav[role="navigation"] > a::before {
220
+ content: "";
221
+ position: absolute;
222
+ top: 0px;
223
+ right: -40px;
224
+ bottom: 0px;
225
+ left: 0px;
226
+ }
227
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"] {
228
+ bottom: 18px !important;
229
+ left: 1px !important;
230
+ }
231
+
232
+ #react-root [data-testid="SideNav_NewTweet_Button"], #react-root [aria-label="Twitter Blue"]{
233
+ display: none;
234
+ }
235
+ }
236
+
237
+ @media only screen and (min-width: 1000px) and (max-width: 1264px) {
238
+ #react-root [data-testid="sidebarColumn"] form[role="search"] {
239
+ visibility: visible !important;
240
+ position: fixed !important;
241
+ top: 12px !important;
242
+ right: 16px !important;
243
+ }
244
+
245
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search"] {
246
+ width: 150px;
247
+ }
248
+
249
+ #react-root [data-testid="sidebarColumn"] form[role="search"]:focus-within {
250
+ width: 280px !important;
251
+ backdrop-filter: blur(12px) !important;
252
+ }
253
+
254
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search"]:focus {
255
+ width: 234px !important;
256
+ }
257
+ }
258
+
259
+ @media only screen and (min-width: 1265px) {
260
+ #react-root [data-testid="sidebarColumn"] form[role="search"] {
261
+ visibility: visible !important;
262
+ position: fixed !important;
263
+ top: 12px !important;
264
+ right: 16px !important;
265
+ }
266
+
267
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search"] {
268
+ width: 150px;
269
+ }
270
+
271
+ #react-root [data-testid="sidebarColumn"] form[role="search"]:focus-within {
272
+ width: 374px !important;
273
+ backdrop-filter: blur(12px) !important;
274
+ }
275
+
276
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search"]:focus {
277
+ width: 328px !important;
278
+ }
279
+
280
+ #react-root div[style*="left: -12px"] {
281
+ left: unset !important;
282
+ }
283
+
284
+ #react-root div[style="left: -8px; width: 306px;"] {
285
+ left: unset !important;
286
+ width: 374px !important;
287
+ }
288
+
289
+ #react-root .searchFilters {
290
+ visibility: visible !important;
291
+ position: fixed;
292
+ top: 12px;
293
+ right: 16px;
294
+ width: 240px;
295
+ }
296
+ #react-root .searchFilters > div > div:first-child {
297
+ display: none;
298
+ }
299
+ }
300
+
301
+ @media (min-width:1280px){
302
+ #__next .text-base.xl\\:max-w-3xl, #__next form.stretch.xl\\:max-w-3xl {
303
+ max-width: 48rem;
304
+ }
305
+ }
306
+
307
+ #__next .prose ol li p {
308
+ margin: 0;
309
+ display: inline;
310
+ }
311
+
312
+ .AppHeader .AppHeader-globalBar.js-global-bar {
313
+ padding-top: 35px;
314
+ }
315
+
316
+ .header-overlay .header-logged-out {
317
+ margin-top: 15px;
318
+ }
319
+
320
+ .w-full #stage-slideover-sidebar {
321
+ padding-top: 16px;
322
+ }
323
+ .w-full #thread #page-header {
324
+ padding-top: 36px;
325
+ }
326
+ `;
327
+ const contentStyleElement = document.createElement("style");
328
+ contentStyleElement.textContent = contentCSS;
329
+ document.head.appendChild(contentStyleElement);
330
+
331
+ // Top spacing adapts to head-hiding scenarios
332
+ const topPaddingCSS = `
333
+ #layout > ytmusic-nav-bar{
334
+ padding-top: 20px;
335
+ }
336
+
337
+ .columns .column #header,
338
+ .main > div > div.panel.give_me > div.header {
339
+ padding-top: 30px;
340
+ }
341
+
342
+ ytd-masthead>#container.style-scope.ytd-masthead {
343
+ padding-top: 12px;
344
+ }
345
+
346
+ #__next header.HeaderBar_header__jn5ju {
347
+ padding-top: 16px;
348
+ }
349
+
350
+ #root > .excalidraw-app> .excalidraw-container .App-menu.App-menu_top{
351
+ margin-top: 15px;
352
+ }
353
+
354
+ .geist-page nav.dashboard_nav__PRmJv,
355
+ #app > div.layout > div.header-container.showSearchBoxOrHeaderFixed > header > a {
356
+ padding-top:10px;
357
+ }
358
+
359
+ .geist-page .submenu button{
360
+ margin-top:24px;
361
+ }
362
+
363
+ .container-with-note #home, .container-with-note #switcher{
364
+ top: 30px;
365
+ }
366
+
367
+ #__next .overflow-hidden>.overflow-x-hidden .scrollbar-trigger > nav {
368
+ padding-top: 12px;
369
+ }
370
+
371
+ #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.flex.h-full.flex-col > div.flex-1.overflow-hidden > div > div.absolute.left-0.right-0 > div > div.flex.items-center.gap-2 > button{
372
+ margin-left: 60px;
373
+ margin-right: -10px;
374
+ }
375
+
376
+ #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.dark.flex-shrink-0.overflow-x-hidden.bg-black > div > div > div > div > nav > div.flex.flex-col.pt-2.empty\\:hidden.dark\\:border-white\\/20 > a,
377
+ #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.group.fixed.bottom-3.right-3.z-10.hidden.gap-1.lg\\:flex > div,
378
+ #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary > div > div > div > div > nav > div.flex.flex-col.pt-2.empty\\:hidden.dark\\:border-white\\/20 > a {
379
+ display: none;
380
+ }
381
+
382
+ #__next .md\\:px-\\[60px\\].text-token-text-secondary.text-xs.text-center.py-2.px-2.relative{
383
+ visibility:hidden;
384
+ }
385
+
386
+ #__next>div>div>.flex.h-screen.w-full.flex-col.items-center {
387
+ padding-top: 20px;
388
+ }
389
+
390
+ .h-dvh.flex-grow .bg-gradient-to-b.from-background.via-background {
391
+ padding-top: 40px;
392
+ }
393
+
394
+ body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.z-\\[21\\].flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary.max-md\\:\\!w-0 > div > div > div > nav > div.flex.justify-between.h-\\[60px\\].items-center.md\\:h-header-height {
395
+ padding-top: 25px;
396
+ }
397
+
398
+ body > div.relative.flex.h-full.w-full.overflow-hidden.transition-colors.z-0 > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main > div.composer-parent.flex.h-full.flex-col.focus-visible\\:outline-0 > div.flex-1.overflow-hidden.\\@container\\/thread > div > div.absolute.left-0.right-0 > div{
399
+ padding-top: 35px;
400
+ }
401
+
402
+ #__next .sticky.left-0.right-0.top-0.z-20.bg-black{
403
+ padding-top: 0px;
404
+ }
405
+
406
+ #header-area > div > .css-gtiexd > div:nth-child(1) > div, #header-area .logoIcon .user-info{
407
+ padding-top: 20px;
408
+ }
409
+
410
+ #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.flex-shrink-0.overflow-x-hidden.bg-token-sidebar-surface-primary > div > div > div > div > nav, #__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div.relative.flex.h-full.max-w-full.flex-1.flex-col.overflow-hidden > main {
411
+ padding-top: 6px;
412
+ }
413
+
414
+ #__next > div.AnnouncementWrapper_container__Z51yh > div > aside.SidebarLayout_sidebar__SXeDJ.SidebarLayout_left__k163a > div > div > header{
415
+ padding-left: 84px;
416
+ padding-top: 10px;
417
+ }
418
+
419
+ #page .main_header, .cb-layout-basic--navbar,
420
+ #app .splitpanes.splitpanes--horizontal.no-splitter header,
421
+ .fui-FluentProvider .fui-Button[data-testid="HomeButton"],
422
+ #__next > div.PageWithSidebarLayout_centeringDiv___L9br > aside .ChatPageSidebar_logo__9PIXq {
423
+ padding-top: 20px;
424
+ }
425
+
426
+ #tabs-sidebar--tabpanel-0 > div.tw-flex.tw-items-center.tw-mb-\\[12px\\].tw-mt-\\[14px\\].tw-px-4 {
427
+ padding-top: 15px;
428
+ }
429
+
430
+ #tabs-sidebar--tabpanel-1 > div > div.tw-p-\\[16px\\].tw-flex.tw-flex-col.tw-gap-1\\.5{
431
+ padding-top: 30px;
432
+ }
433
+
434
+ #tabs-sidebar--tabpanel-2 > div > h2 {
435
+ padding-top: 20px;
436
+ height: 70px;
437
+ }
438
+
439
+ .lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
440
+ padding-top:15px;
441
+ }
442
+
443
+ #app-root .mat-mdc-tooltip-trigger.main-menu-button.mdc-icon-button {
444
+ margin-top: 15px;
445
+ }
446
+
447
+ .lark > .main-wrapper [data-testid="aside"] {
448
+ top: 15px;
449
+ }
450
+
451
+ #global > div.header-container > .mask-paper {
452
+ padding-top: 20px;
453
+ }
454
+
455
+ #background.ytd-masthead {
456
+ height: 68px;
457
+ }
458
+
459
+ .wrap.h1body-exist.max-container > div.menu-tocs > div.menu-btn{
460
+ top: 28px;
461
+ }
462
+
463
+ .flex.w-full.h-full.overflow-hidden{
464
+ padding-top:20px;
465
+ }
466
+
467
+ .text-sidebar-foreground .bg-sidebar{
468
+ padding-top:30px;
469
+ }
470
+
471
+ #bghitapp-top-dom:active {
472
+ cursor: grabbing;
473
+ cursor: -webkit-grabbing;
474
+ }
475
+
476
+ #bghitapp-top-dom{
477
+ position:fixed;
478
+ background:transparent;
479
+ top:0;
480
+ width: 100%;
481
+ height: 20px;
482
+ cursor: grab;
483
+ -webkit-app-region: drag;
484
+ user-select: none;
485
+ -webkit-user-select: none;
486
+ z-index: 99999;
487
+ }
488
+
489
+ @media (max-width:767px){
490
+ #__next .overflow-hidden.w-full .max-w-full>.sticky.top-0 {
491
+ padding-top: 20px;
492
+ }
493
+
494
+ #__next > div.overflow-hidden.w-full.h-full main.relative.h-full.w-full.flex-1 > .flex-1.overflow-hidden .h-32.md\\:h-48.flex-shrink-0{
495
+ height: 0px;
496
+ }
497
+ }
498
+ `;
499
+ const isMac = /Mac/i.test(navigator.userAgent);
500
+ if (window["bghitappConfig"]?.hide_title_bar && isMac) {
501
+ const topPaddingStyleElement = document.createElement("style");
502
+ topPaddingStyleElement.textContent = topPaddingCSS;
503
+ document.head.appendChild(topPaddingStyleElement);
504
+ }
505
+ });
@@ -0,0 +1,59 @@
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const debounce = (func, wait) => {
3
+ let timeout;
4
+ return (...args) => {
5
+ clearTimeout(timeout);
6
+ timeout = setTimeout(() => func(...args), wait);
7
+ };
8
+ };
9
+
10
+ const updateTheme = () => {
11
+ const doc = document.documentElement;
12
+ const body = document.body;
13
+ let mode = null;
14
+
15
+ // Check for explicit theme classes or attributes
16
+ const isDark =
17
+ doc.classList.contains("dark") ||
18
+ body.classList.contains("dark") ||
19
+ doc.getAttribute("data-theme") === "dark" ||
20
+ body.getAttribute("data-theme") === "dark" ||
21
+ doc.style.colorScheme === "dark";
22
+
23
+ const isLight =
24
+ doc.classList.contains("light") ||
25
+ body.classList.contains("light") ||
26
+ doc.getAttribute("data-theme") === "light" ||
27
+ body.getAttribute("data-theme") === "light" ||
28
+ doc.style.colorScheme === "light";
29
+
30
+ if (isDark) mode = "dark";
31
+ else if (isLight) mode = "light";
32
+
33
+ // Only invoke Rust command if an explicit theme override is detected
34
+ if (mode && window.__TAURI__?.core) {
35
+ window.__TAURI__.core.invoke("update_theme_mode", { mode });
36
+ }
37
+ };
38
+
39
+ const debouncedUpdateTheme = debounce(updateTheme, 200);
40
+
41
+ // Initial check with delay to allow site to render
42
+ setTimeout(updateTheme, 500);
43
+
44
+ // Watch for DOM changes
45
+ const observer = new MutationObserver(debouncedUpdateTheme);
46
+ const config = {
47
+ attributes: true,
48
+ attributeFilter: ["class", "data-theme", "style"],
49
+ subtree: false,
50
+ };
51
+
52
+ observer.observe(document.documentElement, config);
53
+ observer.observe(document.body, config);
54
+
55
+ // Watch for system theme changes (though window should handle this natively now)
56
+ window
57
+ .matchMedia("(prefers-color-scheme: dark)")
58
+ .addEventListener("change", updateTheme);
59
+ });
@@ -0,0 +1,22 @@
1
+ // Lightweight in-page toast used by Rust `show_toast` (download status, etc).
2
+ // Kept tiny and always loaded so the Rust side can rely on `window.bghitappToast`.
3
+ document.addEventListener("DOMContentLoaded", () => {
4
+ function bghitappToast(msg) {
5
+ const m = document.createElement("div");
6
+ m.innerHTML = msg;
7
+ m.style.cssText =
8
+ "max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;";
9
+ document.body.appendChild(m);
10
+ setTimeout(function () {
11
+ const d = 0.5;
12
+ m.style.transition =
13
+ "transform " + d + "s ease-in, opacity " + d + "s ease-in";
14
+ m.style.opacity = "0";
15
+ setTimeout(function () {
16
+ document.body.removeChild(m);
17
+ }, d * 1000);
18
+ }, 3000);
19
+ }
20
+
21
+ window.bghitappToast = bghitappToast;
22
+ });