-
Notifications
You must be signed in to change notification settings - Fork 1
/
popup.R
39 lines (34 loc) · 1.05 KB
/
popup.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
library(shiny)
popup <- function (message='Default Message', width=500, height=150, title='Important') {
launch.browser = function(appUrl, browser.path='/usr/bin/chromium-browser') {
system(sprintf('"%s" --disable-gpu --app="data:text/html,<html>
<head>
<title>%s</title>
</head>
<body>
<script>window.resizeTo(%s,%s);window.location=\'%s\';</script>
</body></html>" &', browser.path, title, width, height, appUrl))
}
shinyApp(
ui = fluidPage(
fluidRow(
br(),
br(),
fluidRow(
column(12,
div(htmlOutput("message"),align = "center"),
br(),
div(tags$button( "Close", id="close", type="button", class="btn action-button", onclick="self.close()"),align = "center")
)
)
)
),
server = function(input, output, session) {
session$onSessionEnded(function() {
stopApp()
})
output$message <- renderText(message)
},
options = list(launch.browser=launch.browser)
)
}