-
Notifications
You must be signed in to change notification settings - Fork 8
/
app_backup2.R
executable file
·691 lines (625 loc) · 31.6 KB
/
app_backup2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
## https://unleash-shiny.rinterface.com
# -------------- Load Packages -----------------------------
require('BBmisc')
if (!require('XML')) devtools::install_github('omegahat/XML')
if (!require('runr')) devtools::install_github('yihui/runr')
## https://shi18ny.datasketch.dev
lib('shiny')
conflict_prefer('runExample', 'shiny')
if (!require('shi18ny')) devtools::install_github('datasketch/shi18ny')
pkgs <- c('shiny', 'shinythemes', 'shinydashboard', 'shinydashboardPlus', 'memoise',
'bs4Dash', 'dashboardthemes', 'shinyWidgets', 'shinyjs', 'shinyBS', 'XML', 'xml2',
'htmltools', 'shiny.i18n', 'shi18ny', 'shinyvalidate', 'shinyFeedback', 'shinyMobile',
'shiny.router', 'miniUI', 'sass')
lib(pkgs)
#lib(pkgs[1:4])
# -------------- Prefer Conflict -----------------------------
conflicts_prefer(shinydashboardPlus::dashboardPage, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::dashboardHeader, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::dashboardSidebar, .quiet = TRUE)
conflicts_prefer(shinydashboard::sidebarMenu, .quiet = TRUE)
conflicts_prefer(shinydashboard::menuItem, .quiet = TRUE)
conflicts_prefer(shinydashboard::menuSubItem, .quiet = TRUE)
conflicts_prefer(shinydashboard::dashboardBody, .quiet = TRUE)
conflicts_prefer(shinydashboard::tabItems, .quiet = TRUE)
conflicts_prefer(shinydashboard::tabItem, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::taskItem, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::messageItem, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::notificationItem, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::box, .quiet = TRUE)
conflicts_prefer(shinydashboard::updateTabItems, .quiet = TRUE)
conflicts_prefer(shinydashboardPlus::dashboardFooter, .quiet = TRUE)
#conflicts_prefer(shiny::runExample, .quiet = TRUE)
#lib(pkgs)
# -------------- Set Parameters -----------------------------
#menus <- data.frame(
# choices = c('🇬🇧 ENGLISH',# = 'en',
# '🇨🇳 简体中文',# = 'cn',
# '🇹🇼 繁体中文',# = 'tw',
# '🇯🇵 日本語',# = 'jp',
# '🇰🇷 한국어',# = 'kr',
# '🇬🇷 Ελληνικά',# = 'gr',
# '🇩🇪 Deutsch',# = 'de',
# '🇫🇷 Français',# = 'fr',
# '🇮🇹 Italiano'),# = 'it'),
# lnk = c('ryo-en', 'ryo-cn', 'ryo-tw', 'ryo-jp', 'ryo-kr', 'ryo-gr', 'ryo-de', 'ryo-fr', 'ryo-it'),
# tabItem = c('en', 'cn', 'tw', 'jp', 'kr', 'gr', 'de', 'fr', 'it'))
## Active tab to select radio button in Shiny
## https://www.javacodexamples.com/examples/active-tab-to-select-radio-button-in-shiny
##
rb_choices = list(
'🇬🇧 ENGLISH' = 'en',
'🇨🇳 简体中文' = 'cn',
'🇹🇼 繁体中文' = 'tw',
'🇯🇵 日本語' = 'jp',
'🇰🇷 한국어' = 'kr',
'🇬🇷 Ελληνικά' = 'gr',
'🇩🇪 Deutsch' = 'de',
'🇫🇷 Français' = 'fr',
'🇮🇹 Italiano' = 'it')
tabItem_choices = list(
'🇬🇧 ENGLISH' = 'en',
'🇨🇳 简体中文' = 'cn',
'🇹🇼 繁体中文' = 'tw',
'🇯🇵 日本語' = 'jp',
'🇰🇷 한국어' = 'kr',
'🇬🇷 Ελληνικά' = 'gr',
'🇩🇪 Deutsch' = 'de',
'🇫🇷 Français' = 'fr',
'🇮🇹 Italiano' = 'it')
### creating custom logo object
logo <- shinyDashboardLogoDIY(
boldText = 'ξηg',
mainText = 'Lιαη Ημ',
textSize = 16,
badgeText = '🐉 ®γσ',
badgeTextColor = 'white',
badgeTextSize = 2,
badgeBackColor = "#40E0D0",
badgeBorderRadius = 3)
## https://stackoverflow.com/a/50979068/3806250
alignCenter <- memoise(function(el) {
htmltools::tagAppendAttributes(
el, style = "
width:500vw;
height:100vh;
background-color: rgba(255, 255, 255, 0.35); /* 35% opaque white */
padding: 0.25em;
color: #FFD64D;
background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%);
transition: all 0.45s;
display:flex;
flex-wrap: wrap;
align-items:center;
justify-content:center;
")
})
# -------------- ui -----------------------------
## Dynamic UI in Shiny (incl. demo app)
## https://towardsdatascience.com/dynamic-ui-in-shiny-incl-demo-app-a6fb791be4c6
ui <- shinyUI(
#fluidPage(
## https://dreamrs.github.io/shinyWidgets/reference/setBackgroundColor.html
# use a gradient in background
# setBackgroundColor(
# color = c('#2171B5', '#F7FBFF'),
# gradient = 'radial',
# direction = c('top', 'left')
# ),
#...)
#
## https://rinterface.github.io/shinydashboardPlus/articles/more-skins.html
dashboardPage(#skin = 'midnight',
header = dashboardHeader(title = logo),
sidebar = dashboardSidebar(
minified = TRUE, collapsed = FALSE,
## https://stackoverflow.com/questions/52382832/r-shiny-dashboard-body-dependant-from-shiny-subitem-selection
## https://ducthanhnguyen.github.io/MaterialAdminLTE/index3.html
sidebarMenu(
## https://stackoverflow.com/a/70093686/3806250
id = 'sidebarID',
menuItem('🚩中科红旗☁️', tabName = 'menu',
## https://getbootstrap.com/docs/3.4/components/#glyphicons
## https://fontawesome.com/icons
#badgeLabel = '🚧', badgeColor = 'green',
icon = icon('font-awesome'), startExpanded = TRUE,
menuSubItem('🏠 主页', tabName = 'home'),
menuSubItem('🇬🇧 ENGLISH', tabName = 'en'),
menuSubItem('🇨🇳 简体中文', tabName = 'cn'),
menuSubItem('🇹🇼 繁体中文', tabName = 'tw'),
menuSubItem('🇯🇵 日本語', tabName = 'jp'),
menuSubItem('🇰🇷 한국어', tabName = 'kr'),
menuSubItem('🇬🇷 Ελληνικά', tabName = 'gr'),
menuSubItem('🇩🇪 Deutsch', tabName = 'de'),
menuSubItem('🇫🇷 français', tabName = 'fr'),
menuSubItem('🇮🇹 Italiano', tabName = 'it')),
menuItem('附录', tabName = 'append',
#badgeLabel = '🚧', badgeColor = 'blue',
icon = icon('th'), startExpanded = TRUE,
menuSubItem('世博量化®', tabName = 'scbr'),
menuSubItem('作者', tabName = 'auth'),
menuSubItem('参考文献', tabName = 'refr'))
)),
body = dashboardBody(
shinyDashboardThemes(theme = 'blue_gradient'),
## https://stackoverflow.com/questions/52198452/how-to-change-the-background-color-of-the-shiny-dashboard-body
tags$head(tags$style(HTML('
/* logo */
/* .skin-blue .main-header .logo { */
/* background-color: #F4B943; */
/* } */
/* logo when hovered */
.skin-blue .main-header .logo:hover {
/* background-color: #33A8C4; */
color: #FFD64D;
background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%);
transition: all 0.45s;
/* &:hover{ */
/* background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%); */
/* } */
}
/* navbar (rest of the header) */
.skin-blue .main-header .navbar {
/* background-color: #F4B943; */
/* color: #FFD64D; */
background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%);
transition: all 0.45s;
/* &:hover{ */
/* background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%); */
/* } */
}
/* main sidebar */
/* .skin-blue .main-sidebar { */
/* background-color: #F4B943; */
/* } */
/* active selected tab in the sidebarmenu */
/* .skin-blue .main-sidebar .sidebar .sidebar-menu .active a { */
/* background-color: #FF0000; */
/* background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%); */
/* transition: all 0.45s; */
/* &:hover{ */
/* background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%); */
/* } */
/* } */
/* other links in the sidebarmenu */
/* .skin-blue .main-sidebar .sidebar .sidebar-menu a { */
/* background-color: #00FF00; */
/* color: #000000; */
/* } */
/* other links in the sidebarmenu when hovered */
/* .skin-blue .main-sidebar .sidebar .sidebar-menu a:hover { */
/* background-color: #FFD64D; */
/* color: #FFD64D; */
/* } */
/* toggle button */
.skin-blue .main-header .navbar .sidebar-toggle {
/* background-color: #33A8C4; */
color: #FFD64D;
background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%);
}
}
/* toggle button when hovered */
.skin-blue .main-header .navbar .sidebar-toggle:hover {
/* background-color: #FFD64D; */
color: #FFD64D;
background: linear-gradient(155DEG, #002C54 0%, #4CB5F5 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155DEG, #002C54 20%, #4CB5F5 80%);
}
}
/* navbar */
.navbar-custom-menu {
/* color: #FFD64D; */
background-color: transparent;
}
/* sidebarColumn */
.sidebarCollapsed {
/* position: absolute; */
/* top: -25px; */
/* padding-top: -50px; */
}
.main-sidebar.shiny-bound-input {
/* position: absolute; */
/* top: 25px; */
/* right 25px; */
/* padding-top: 30px; */
/* padding-right: 30px; */
}
/* body */
/* .content-wrapper, .right-side { */
.content-wrapper {
/* background-color: #7DA2D1; */
color: #FFD64D;
background: linear-gradient(155DEG, #002C54 0%, #4CB5F5 100%);
transition: all 0.45s;
/* &:hover{ */
/* background: linear-gradient(155DEG, #002C54 20%, #4CB5F5 80%); */
/* } */
}
/* body when hovered */
/* .content-wrapper, .right-side, .content-wrapper:hover, .right-side:hover { */
/* background-color: #7DA2D1; */
/* color: #FFD64D; */
/* background: linear-gradient(155DEG, #002C54 0%, #4CB5F5 100%); */
/* transition: all 0.45s; */
/* &:hover{ */
/* background: linear-gradient(155DEG, #002C54 20%, #4CB5F5 80%); */
/* } */
/* } */
/* footer */
.skin-blue .main-footer {
/* background-color: #33A8C4; */
color: #FFD64D;
background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%);
transition: all 0.45s;
/* &:hover{ */
/* background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%); */
/* } */
}
/* footer */
.pull-right.hidden-xs {
/* color: #FFD64D; */
background-color: transparent;
}
/* footer when hovered */
/* .skin-blue .main-footer .main-footer:hover { */
/* background-color: #F4B943; */
/* color: #FFD64D; */
/* background: linear-gradient(155DEG, #146275 0%, #33A8C4 100%); */
/* transition: all 0.45s; */
/* &:hover{ */
/* background: linear-gradient(155DEG, #146275 20%, #33A8C4 80%); */
/* } */
/* } */
/* ## https://stackoverflow.com/questions/59760316/change-the-color-of-text-in-validate-in-a-shiny-app */
.shiny-output-error-validation {
/* background-color: #FFD64D; */
color: #FF0000;
font-size: 36px;
font-weight: bold;
display:flex;
align-items:center;
justify-content:center;
background: linear-gradient(155DEG, #002C54 0%, #4CB5F5 100%);
transition: all 0.45s;
&:hover{
background: linear-gradient(155DEG, #002C54 20%, #4CB5F5 80%);
}
}
'))),
tabItems(
tabItem(tabName = 'home', h2('🚩中科红旗☁️', align = 'center'),
#alignCenter(
## https://stackoverflow.com/questions/4253920/how-do-i-change-the-color-of-radio-buttons
## https://www.justinmind.com/blog/radio-button-design-examples
## https://www.sliderrevolution.com/resources/styling-radio-buttons
# prettyRadioButtons(
# inputId = 'rb', label = NULL,
# choices = rb_choices, #menus$choices,
# shape = 'curve', animation = 'pulse',
# selected = character(0), status = 'primary',
# thick = TRUE, width = '100%', bigger = TRUE,
# icon = icon('registered'))
#)
includeHTML('诸子百家考工记/DynRadioB.html'),
includeCSS('诸子百家考工记/DynRadioB.css')
),
tabItem(tabName = 'en', h2('🇬🇧 ENGLISH', align = 'center'),
## https://stackoverflow.com/a/9158079/3806250
#tags$iframe(src = 'http://rpubs.com/englianhu/ryo-en',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-en.html'))#,
includeHTML('诸子百家考工记/ryo-en.html'),
includeCSS('诸子百家考工记/CSSBackgrounds.css')
#htmlOutput('ryo_en')
#htmlOutput('frame')
),
tabItem(tabName = 'cn', h2('🇨🇳 简体中文', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-cn',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-cn.html'))#,
includeHTML('诸子百家考工记/ryo-cn.html'),
includeCSS('诸子百家考工记/CSSBackgrounds.css')
#htmlOutput('ryo_cn')
#htmlOutput('frame')
),
tabItem(tabName = 'tw', h2('🇹🇼 繁体中文', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-tw',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-tw.html'))#,
includeHTML('诸子百家考工记/ryo-tw.html'),
includeCSS('诸子百家考工记/CSSBackgrounds.css')
#htmlOutput('ryo_tw')
#htmlOutput('frame')
),
tabItem(tabName = 'jp', h2('🇯🇵 日本語', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-jp',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-jp.html'))#,
includeHTML('诸子百家考工记/ryo-jp.html'),
includeCSS('诸子百家考工记/CSSBackgrounds.css')
#htmlOutput('ryo_jp')
#htmlOutput('frame')
),
tabItem(tabName = 'kr', h2('🇰🇷 한국어', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-gr',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-gr.html'))#,
#includeHTML('诸子百家考工记/ryo-gr.html')#,
## https://stackoverflow.com/questions/28845499/r-shiny-how-to-align-a-gvistable-to-the-center-in-shinyapp
htmlOutput('ryo_kr'), br(), br(), br(),
HTML("<p align='center'><iframe width='560' height='315' src='https://www.youtube.com/embed/BrfA1HeOgko' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe></p>")
#htmlOutput('frame')
),
tabItem(tabName = 'gr', h2('🇬🇷 Ελληνικά', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-gr',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-gr.html'))#,
#includeHTML('诸子百家考工记/ryo-gr.html')#,
## https://stackoverflow.com/questions/28845499/r-shiny-how-to-align-a-gvistable-to-the-center-in-shinyapp
htmlOutput('ryo_gr'), br(), br(), br(),
HTML("<p align='center'><iframe width='560' height='315' src='https://www.youtube.com/embed/BrfA1HeOgko' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe></p>")
#htmlOutput('frame')
),
tabItem(tabName = 'de', h2('🇩🇪 Deutsch', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-de',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-de.html'))#,
#includeHTML('诸子百家考工记/ryo-de.html')#,
## https://stackoverflow.com/questions/28845499/r-shiny-how-to-align-a-gvistable-to-the-center-in-shinyapp
htmlOutput('ryo_de'), br(), br(), br(),
HTML("<p align='center'><iframe width='560' height='315' src='https://www.youtube.com/embed/BrfA1HeOgko' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe></p>")
#htmlOutput('frame')
),
tabItem(tabName = 'fr', h2('🇫🇷 Français', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-fr',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-fr.html'))#,
#includeHTML('诸子百家考工记/ryo-fr.html')#,
## https://stackoverflow.com/questions/28845499/r-shiny-how-to-align-a-gvistable-to-the-center-in-shinyapp
htmlOutput('ryo_fr'), br(), br(), br(),
HTML("<p align='center'><iframe width='560' height='315' src='https://www.youtube.com/embed/BrfA1HeOgko' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe></p>")#,
#tags$script(HTML("
# var p = document.getElementById('ryo_fr')
# $(p).attr('align', 'center');"))
#htmlOutput('frame')
),
tabItem(tabName = 'it', h2('🇮🇹 Italiano', align = 'center'),
#tags$iframe(src = 'https://rpubs.com/englianhu/ryo-it',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-it.html'))#,
#includeHTML('诸子百家考工记/ryo-it.html')#,
## https://stackoverflow.com/questions/28845499/r-shiny-how-to-align-a-gvistable-to-the-center-in-shinyapp
htmlOutput('ryo_it'), br(), br(), br(),
HTML("<p align='center'><iframe width='560' height='315' src='https://www.youtube.com/embed/BrfA1HeOgko' title='YouTube video player' frameborder='0' allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe></p>")
#htmlOutput('frame')
),
tabItem(tabName = 'scbr', h2('世博量化®', align = 'center'),
htmlOutput('scibrokes')
),
tabItem(tabName = 'auth', h2('作者', align = 'center'),
#tags$iframe(src = 'http://rpubs.com/englianhu/ryo-eng',
# height = 800, width = '100%', frameborder = 0)#,
#HTML(readLines('诸子百家考工记/ryo-eng.html'))#,
includeHTML('诸子百家考工记/ryo-eng.html'),
includeCSS('诸子百家考工记/CSSBackgrounds.css')
#htmlOutput('ryo_eng')
),
tabItem(tabName = 'refr', h2('参考文献', align = 'center'),
br(),
p('此履历表使用闪霓应用编程,参考了以下文献:',
HTML("<a href='https://vlab.stern.nyu.edu/doc/3?topic=mdls'>GJR-GARCH Model</a>"),
'is the best fit model. You are feel free to browse over ',
tags$ul(
tags$li(HTML("<a href='https://github.com/scibrokes/owner/issues/2'>Error: embed sidebar & css background inside html file doesn't work (shiny) #2</a>")),
tags$li(HTML("<a href='https://unleash-shiny.rinterface.com/beautify-sass.html'>Outstanding User Interfaces with Shiny</a>")),
tags$li(HTML("<a href='https://community.rstudio.com/t/how-to-use-sass-css-scss-in-r-shiny/97471'>How to use Sass CSS (SCSS) in R-Shiny</a>")),
tags$li(HTML("<a href='https://github.com/moldach/scss-shiny'>GitHub: scss-shiny</a>")),
tags$li(HTML("<a href='https://mastering-shiny.org'>Mastering Shiny</a>")),
tags$li(HTML("<a href='https://www.justinmind.com/blog/radio-button-design-examples'>Radio button design: easy selection and decision-making</a>")),
tags$li(HTML("<a href='https://codepen.io/visualcookie/details/xeBqBm'>Recreation: Card theme switcher</a>")),
tags$li(HTML("<a href='https://codepen.io/duggi/pen/gPjrKM'>3D Radar Chart</a>")),
tags$li(HTML("<a href='https://cran.r-project.org/web/packages/shinyMobile/vignettes/Tabs-Layout.html'>Mini UI - Tabs-Layout</a>")),
tags$li(HTML("<a href='https://www.sliderrevolution.com/resources/styling-radio-buttons'>Styling Radio Buttons with CSS (59 Custom Examples)</a>")),
tags$li(HTML("<a href='https://codepen.io/sodapop/pen/GpgEeE'>Custom CSS3 Radio Button - Radiosplosion</a>")),
tags$li(HTML("<a href='https://codepen.io/jkantner/pen/oNXjjZM'>Radio Buttons With Marble and Wood</a>")),
tags$li(HTML("<a href='https://codepen.io/victorfreire/pen/XXzqEr'>Google Dots Radio Buttons</a>")),
tags$li(HTML("<a href='https://shiny.rstudio.com/articles/css.html'>Using custom CSS in your app</a>")),
tags$li(HTML("<a href='https://shiny.rstudio.com/articles/packaging-javascript.html'>Packaging JavaScript code for Shiny</a>")),
tags$li(HTML("<a href='https://blog.hubspot.com/website/css-animation-examples'>24 Creative and Unique CSS Animation Examples to Inspire Your Own</a>"))),
'for the research study which compare the accuracy and the return of investment of various statistical models. '),
br(),
p('以下着手科研高频量化交易:',
HTML("<a href='https://vlab.stern.nyu.edu/doc/3?topic=mdls'>GJR-GARCH Model</a>"),
'is the best fit model. You are feel free to browse over ',
tags$ul(
tags$li(HTML("<a href='https://medium.com/@dave.cote.msc/hands-on-advanced-deep-learning-time-series-forecasting-with-tensors-7facae522f18'>Hands-On Advanced Deep Learning Time Series Forecasting with Tensors</a>")),
tags$li(HTML("<a href='http://rpubs.com/englianhu/316133'>binary.com Interview Question I (Extention)</a>")),
tags$li(HTML("<a href='https://beta.rstudioconnect.com/content/3073/'>Q1App</a>")),
tags$li(HTML("<a href='https://beta.rstudioconnect.com/content/2367/'>ShinyApp</a>"), '(App for 3 Questions : Blooper)'),
tags$li(HTML("<a href='https://beta.rstudioconnect.com/content/3775/'>testRealTimeTransc</a>"))),
'for the research study which compare the accuracy and the return of investment of various statistical models. '),
p('Below is the equation for the model.',
withMathJax(
helpText('$$\\delta_{t}^{2} = \\omega + (\\alpha + \\gamma I_{t-1}) \\varepsilon_{t-1}^{2} + \\beta \\sigma_{t-1}^{2}$$')), 'where'),
p(withMathJax(
helpText('$$I_{t-1}=
\\begin{cases}
0& \\text{if } r_{t-1} \\leq \\mu\\\\
1& \\text{if } r_{t-1} > \\mu
\\end{cases}$$'))),
p('The daily data for calculation is getting from ',
HTML("<a href='https://medium.com/@dave.cote.msc/hands-on-advanced-deep-learning-time-series-forecasting-with-tensors-7facae522f18'>Hands-On Advanced Deep Learning Time Series Forecasting with Tensors</a>"),
' while the real-time price to staking and settlement is getting from ',
HTML("<a href='https://www.truefx.com/'>TrueFX.com.</a>"),
'Therefore there has no any guarantee of profit and also accuracy of price dataset.')
)
)
),
footer = dashboardFooter(
left = p(
HTML("<a href='https://www.scibrokes.com'>Sςιβrοκεrs Trαdιηg®</a>"),
br(),
tags$a(href = 'https://www.scibrokes.com', target = '_blank',
tags$img(height = '13px', alt = 'scibrokes', #align = 'right',
#src = '诸子百家考工记/Scibrokes.png')),
src = 'https://raw.githubusercontent.com/scibrokes/owner/master/诸子百家考工记/Scibrokes.png')),
HTML("<a href='https://www.scibrokes.com'>世博量化®</a>"),
'企业知识产权®及版权®所有,盗版必究。',
),
right = p(
br(),
tags$a(href = 'https://www.pku.edu.cn', target = '_blank',
tags$img(height = '13px', alt = 'scibrokes', #align = 'right',
#src = '诸子百家考工记/Peking University 02.png')),
src = 'https://raw.githubusercontent.com/scibrokes/owner/master/诸子百家考工记/Peking%20University%2002.png')),
HTML(paste0("<a href='https://www.pku.edu.cn'>", span('北京大学', style = 'color:blue'), "</a>")),
'🐉 ®γσ ξηg 2022 原著')
),
title = 'DashboardPage'))
# -------------- server -----------------------------
server <- shinyServer(function(input, output, session) {
#kr <- file.exists('诸子百家考工记/ryo-kr.html')
#gr <- file.exists('诸子百家考工记/ryo-gr.html')
#de <- file.exists('诸子百家考工记/ryo-de.html')
#fr <- file.exists('诸子百家考工记/ryo-fr.html')
#it <- file.exists('诸子百家考工记/ryo-it.html')
#observe({
## https://stackoverflow.com/questions/56064805/displaying-html-file-using-includehtml-in-shiny-is-not-working-with-renderui
## https://stackoverflow.com/questions/33020558/embed-iframe-inside-shiny-app
# query <- menus[which(menus$choices == input$rb), 2]
# lnk <<- paste0('https://rpubs.com/englianhu/', query)
# })
#output$frame <- renderUI({
# input$rb
# ui_lnk <- tags$iframe(src = lnk, height = 800, width = '100%', frameborder = 0)
# print(ui_lnk)
# ui_lnk
#})
## https://stackoverflow.com/a/70093686/3806250
## https://stackoverflow.com/questions/70080803/uri-routing-for-shinydashboard-using-shiny-router/70093686#70093686
observeEvent(input$sidebarID, {
# http://127.0.0.1:6172/?tab=dashboard
# http://127.0.0.1:6172/?tab=widgets
newURL <- paste0(
session$clientData$url_protocol,
'//',
session$clientData$url_hostname,
':',
session$clientData$url_port,
session$clientData$url_pathname,
'?tab=',
input$sidebarID
)
updateQueryString(newURL, mode = 'replace', session)
})
observe({
currentTab <- getQueryString(session)$tab # alternative: parseQueryString(session$clientData$url_search)$tab
if(!is.null(currentTab)){
updateTabItems(session, 'sidebarID', selected = currentTab)
}
})
#observeEvent(input$rb, {
#withProgress(message = 'Loading...',
# detail = 'This may take a while...', value = 0, {
# for (i in 1:15) {
# incProgress(1/15)
# Sys.sleep(0.25)
# }
#})
# updateTabItems(session, 'sidebarID', selected = input$rb)
# })
#output$ryo_en <- renderUI({
# includeHTML('诸子百家考工记/ryo-en.html')
# })
#
#output$ryo_cn <- renderUI({
# includeHTML('诸子百家考工记/ryo-cn.html')
# })
#
#output$ryo_tw <- renderUI({
# includeHTML('诸子百家考工记/ryo-tw.html')
# })
#
#output$ryo_jp <- renderUI({
# includeHTML('诸子百家考工记/ryo-jp.html')
# })
output$ryo_kr <- renderUI({
#kr <- file.exists('诸子百家考工记/ryo-kr.html')
#
#if (kr == FALSE) {
## https://shiny.rstudio.com/articles/html-tags.html
# div(id = 'ryo_kr',
# HTML('<ruby>건설<rp>(</rp><rt>geonseol</rt><rp>)</rp>중<rp>(</rp><rt>jung</rt><rp>)</rp></ruby> !'),
# class = 'shiny-html-output shiny-bound-output shiny-output-error shiny-output-error-shiny.silent.error shiny-output-error-Missing-Data-Class shiny-output-error-validation',
# align = 'center'
# )
# } else {
# includeHTML('诸子百家考工记/ryo-kr.html')
# }
## https://rstudio.github.io/shinyvalidate/reference/compose_rules.html
## Validation rules are set in the server, start by
## making a new instance of an `InputValidator()`
#joey <- InputValidator$new()
## Basic usage: `sv_regex()` requires both a regex
## pattern and message to display if the validation
## of `input$lookup_id` fails
#joey$add_rule(
# kr,
# sv_regex('FALSE', HTML('<ruby>건설<rp>(</rp><rt>geonseol</rt><rp>)</rp>중<rp>(</rp><rt>jung</rt><rp>)</rp></ruby> !'))
# )
## Finally, `enable()` the validation rules
#joey$enable()
## https://mastering-shiny.org/action-feedback.html
#shinyFeedback::feedbackWarning(kr, FALSE, HTML('<ruby>건설<rp>(</rp><rt>geonseol</rt><rp>)</rp>중<rp>(</rp><rt>jung</rt><rp>)</rp></ruby> !'))
validate(
need(is.error(file.exists('诸子百家考工记/ryo-kr.html')), '건설중 !'),
errorClass = 'Missing-Data-Class'
)
includeHTML('诸子百家考工记/ryo-kr.html')
})
output$ryo_gr <- renderUI({
validate(
need(is.error(file.exists('诸子百家考工记/ryo-gr.html')), 'Υπό κατασκευή !'),
errorClass = 'Missing-Data-Class'
)
includeHTML('诸子百家考工记/ryo-gr.html')
})
output$ryo_de <- renderUI({
validate(
need(is.error(file.exists('诸子百家考工记/ryo-de.html')), 'En construction !'),
errorClass = 'Missing-Data-Class'
)
includeHTML('诸子百家考工记/ryo-de.html')
})
output$ryo_fr <- renderUI({
validate(
need(is.error(file.exists('诸子百家考工记/ryo-fr.html')), 'Im Bau !'),
errorClass = 'Missing-Data-Class'
)
includeHTML('诸子百家考工记/ryo-fr.html')
})
output$ryo_it <- renderUI({
validate(
need(is.error(file.exists('诸子百家考工记/ryo-it.html')), 'In costruzione !'),
errorClass = 'Missing-Data-Class'
)
includeHTML('诸子百家考工记/ryo-it.html')
})
observeEvent(input$sidebarID, {
updatePrettyRadioButtons(session, 'rb', selected = input$sidebarID)
})
#output$ryo_eng <- renderUI({
# includeHTML('诸子百家考工记/ryo-eng.html')
# })
output$scibrokes <- renderUI({
tags$iframe(src = 'https://www.scibrokes.com', height = 800, width = '100%', frameborder = 0)
})
})
# -------------- shinyApp() -----------------------------
shinyApp(ui, server)
#runApp(app.R, display.mode = 'showcase')