Bearloga has submitted this change and it was merged.

Change subject: Switch to WMF-hosted MathJax
......................................................................


Switch to WMF-hosted MathJax

Loads MathJax from Wikimedia ToolLabs CDNjs (http://tools.wmflabs.org/cdnjs/)
to comply with ToS and Privacy Policy.

Change-Id: I9f2c06b9627340a5eacbbce484fa4fad6cffac5f
---
M ui.R
1 file changed, 13 insertions(+), 8 deletions(-)

Approvals:
  Bearloga: Verified; Looks good to me, approved



diff --git a/ui.R b/ui.R
index 75d69b0..1d951a2 100644
--- a/ui.R
+++ b/ui.R
@@ -2,6 +2,17 @@
 library(shinydashboard)
 library(dygraphs)
 
+with_wikimedia_mathjax <- function() {
+  # Modified version of withMathJax() Keeping this
+  # here for now. If another dashboard needs to
+  # render LaTeX, we'll have to put this in polloi.
+  return(tagList(
+    tags$script(src = 
"https://tools-static.wmflabs.org/cdnjs/ajax/libs/mathjax/2.6.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML";,
 type = "text/javascript"),
+    tags$script(HTML("if (window.MathJax) MathJax.Hub.Queue([\"Typeset\", 
MathJax.Hub]);")),
+    tags$script(HTML("MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$']]} 
});"), type = "text/x-mathjax-config")
+  ))
+}
+
 function(request) {
   dashboardPage(
 
@@ -10,7 +21,8 @@
     dashboardSidebar(
       tags$head(
         tags$link(rel = "stylesheet", type = "text/css", href = 
"stylesheet.css"),
-        tags$script(src = "custom.js")
+        tags$script(src = "custom.js"),
+        with_wikimedia_mathjax()
       ),
       sidebarMenu(id = "tabs",
                   menuItem(text = "KPIs",
@@ -148,13 +160,6 @@
                 dygraphOutput("paulscore_approx_plot_fulltext"),
                 div(id = "paulscore_approx_legend", style = "text-align: 
center;"),
                 dygraphOutput("paulscore_approx_plot_autocomplete"),
-                withMathJax(),
-                tags$div(HTML("<!-- Additional MathJax configuration -->
-                  <script type='text/x-mathjax-config'>
-                    MathJax.Hub.Config({
-                      tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
-                    });
-                  </script>")),
                 includeHTML("./tab_documentation/paulscore_approx.html")),
         tabItem(tabName = "mobile_events",
                 fluidRow(

-- 
To view, visit https://gerrit.wikimedia.org/r/311621
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f2c06b9627340a5eacbbce484fa4fad6cffac5f
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/rainbow
Gerrit-Branch: master
Gerrit-Owner: Bearloga <mpo...@wikimedia.org>
Gerrit-Reviewer: Bearloga <mpo...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to