File: favicon.md.rsp

package info (click to toggle)
r-cran-r.rsp 0.45.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,568 kB
  • sloc: javascript: 612; tcl: 304; sh: 18; makefile: 16
file content (20 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# RSP: Creating inline HTML favicons

<%---------------------------------------------------------------
  RSP template functions
  ---------------------------------------------------------------%>
<% faviconScript <- function(..., envir=parent.frame()) { %>
<script>
  <% url <- R.devices::toFavicon(..., envir=envir, field="dataURI") %>
  var link = document.createElement('link');
  link.rel = 'icon';
  link.href = "<%=url%>";
  document.getElementsByTagName('head')[0].appendChild(link);
</script>
<% } # faviconScript() %>


<%-- Create a favicon --%>
<% faviconScript({
plot(1, col="blue", bg="red", pch=21, cex=4, lwd=4, axes=FALSE);
})%>