Skip to content
Snippets Groups Projects
index_template.html 3.19 KiB
Newer Older
  • Learn to ignore specific revisions
  • Cam Saul's avatar
    Cam Saul committed
    <!DOCTYPE html>
    
    <html lang="en" ng-app="metabase" class="no-js">
    
    Kyle Doherty's avatar
    Kyle Doherty committed
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="X-UA-Compatible" content="IE=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui" />
            <meta name="apple-mobile-web-app-capable" content="yes" />
            <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    
            {{{embed_code}}}
    
    
    Kyle Doherty's avatar
    Kyle Doherty committed
            <title>Metabase</title>
    
    Tom Robinson's avatar
    Tom Robinson committed
    
    
            <script type="text/javascript">
    
                (function() {
                    window.MetabaseBootstrap = {{{bootstrap_json}}};
                    // THIS IS PROBABLY VULNERABLE TO XSS
                    // Add trailing slashes
                    var backendPathname = {{{uri}}}.replace(/\/*$/, "/");
                    // e.x. "/questions/"
                    var frontendPathname = window.location.pathname.replace(/\/*$/, "/");
                    // e.x. "/metabase/questions/"
                    if (backendPathname === frontendPathname.slice(-backendPathname.length)) {
                        // Remove the backend pathname from the end of the frontend pathname
                        window.MetabaseBasename = frontendPathname.slice(0, -backendPathname.length) + "/";
                        // e.x. "/metabase/"
                    } else {
                        window.MetabaseBasename = "/";
                    }
                    document.getElementsByTagName("base")[0].href = window.MetabaseBasename;
                })();
    
    Kyle Doherty's avatar
    Kyle Doherty committed
        </head>
    
    Cam Saul's avatar
    Cam Saul committed
    
    
        <body>
            <div id="root" />
            <div style="display: none;" ng-controller="Metabase" ng-view />
        </body>
    
    Kyle Doherty's avatar
    Kyle Doherty committed
    
    
        <script type="text/javascript">
    
         // Load scripts asyncronously after the page has finished loading
    
         (function () {
             function loadScript(src, onload) {
                 var script = document.createElement('script');
                 script.type  = "text/javascript";
                 script.async = true;
                 script.src   = src;
                 if (onload) script.onload = onload;
                 document.body.appendChild(script);
             }
             loadScript('https://ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js', function () {
    
                 WebFont.load({ google: { families: ["Lato:n3,n4,n9"] } });
    
    
             var googleAuthClientID = window.MetabaseBootstrap.google_auth_client_id;
             if (googleAuthClientID) {
                 loadScript('https://apis.google.com/js/api:client.js');
             }
    
    Kyle Doherty's avatar
    Kyle Doherty committed
        <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    
        })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    
        // if we are not doing tracking then go ahead and disable GA now so we never even track the initial pageview
        const tracking = window.MetabaseBootstrap.anon_tracking_enabled;
        const ga_code = window.MetabaseBootstrap.ga_code;
        if (!tracking) {
            window['ga-disable-'+ga_code] = true;
        }
    
        ga('create', ga_code, 'auto');
    
    Kyle Doherty's avatar
    Kyle Doherty committed
        </script>
    
    Cam Saul's avatar
    Cam Saul committed
    </html>