Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timelyportfolio/202be3408080cee0c9da to your computer and use it in GitHub Desktop.
Save timelyportfolio/202be3408080cee0c9da to your computer and use it in GitHub Desktop.
sweetalert javascript in r with @rstudio htmltools
# give yourself some positive feedback in R
# as you toil away on some difficult, but worthwhile task
# uses javascript sweet-alert https://github.com/t4t5/sweetalert
library(htmltools)
library(pipeR)
tagList(
tags$script(
'
document.addEventListener("DOMContentLoaded", function(event) {
swal("Good job! Brilliant!", "You\'re doing worthwhile things.", "success")
});
'
)
) %>>%
attachDependencies(
htmlDependency(
name="sweet-alert"
,version="0.2.1"
,src=c("href"=
"http://timelyportfolio.github.io/sweetalert/lib"
)
,script = "sweet-alert.min.js"
,style = "sweet-alert.css"
)
) %>>%
html_print
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link href="http://timelyportfolio.github.io/sweetalert/lib/sweet-alert.css" rel="stylesheet" />
<script src="http://timelyportfolio.github.io/sweetalert/lib/sweet-alert.min.js"></script>
</head>
<body>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
swal("Good job! Brilliant!", "You're doing worthwhile things.", "success")
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment