1(function( $ ) { 2 'use strict'; 3 // The initViz function. Refer Tableau JS API for details on how this works (https://onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api.htm) 4 function initViz(containerDiv) { 5 if(containerDiv.hasAttributes()){ 6 var url = containerDiv.getAttribute("data-url"), 7 tabs = containerDiv.getAttribute("data-hide-tabs"), 8 toolbar = containerDiv.getAttribute("data-hide-toolbar"), 9 device = '', 10 height = '', 11 width = ''; 12 if(containerDiv.hasAttributes('data-device')){ 13 device = containerDiv.getAttribute('data-device'); 14 } 15 if(containerDiv.hasAttributes('data-height')){ 16 height = parseInt(containerDiv.getAttribute('data-height')); 17 } 18 if(containerDiv.hasAttributes('data-width')){ 19 width = parseInt(containerDiv.getAttribute('data-width')); 20 } 21 var options = { 22 hideTabs: JSON.parse(tabs), 23 hideToolbar: JSON.parse(toolbar), 24 device: device, 25 height: height, 26 width: width, 27 onFirstInteractive: function () { 28 //console.log('tabs: ' + tabs + '\ntoolbar: ' + toolbar + '\ndevice: ' + device + '\nheight: ' + height + '\nwidth: ' + width); 29 //console.log("The viz has finished loading."); 30 } 31 }; 32 // Remove unset options 33 if(!height) { delete options.height; } 34 if(!width) { delete options.width; } 35 if(!device) { delete options.device; } 36 // Create a viz object and embed it in the container div. 37 if (url && 0 !== url.length) { 38 var viz = new tableau.Viz(containerDiv, url, options); 39 } 40 } 41 42 } 43 //Document ready fuction 44 $(document).ready(function() { 45 //if the data attribute is populated, initialize the Tableau Viz. 46 var containerDivs = document.querySelectorAll('*[id^="viz-container"]'); 47 if(containerDivs.length > 0){ 48 containerDivs.forEach(function(contDiv){ 49 if ($(contDiv.id).attr("data-url") !== ''){ 50 initViz(contDiv); 51 } 52 }) 53 } else { 54 //for backward compatibility with older versions of the plugin 55 var containerDiv = document.getElementById("vizContainer"); 56 if (containerDiv && $(containerDiv).attr("data-url") !== ''){ 57 initViz(containerDiv); 58 } 59 } 60 61 }); 62})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.