1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Replace jsapi with loader.js in chart_class

This avoids 2 warnings when opening admin.
jsapi:22 A Parser-blocking, cross-origin script,
https://www.google.com/uds/?file=visualization&v=1&packages=corechart,
is invoked via document.write. This may be blocked by the browser if the
device has poor network connectivity. See
https://www.chromestatus.com/feature/5718547946799104 for more details.
Reference information:

http://stackoverflow.com/questions/39719334/javascript-google-visualization-selection-option
This commit is contained in:
MikeyGMT
2016-12-23 17:31:00 +00:00
parent caffecd9f5
commit aeeb740ff8

View File

@@ -2,7 +2,7 @@
/* /*
* e107 website system * e107 website system
* *
* Copyright (C) 2008-2013 e107 Inc (e107.org) * Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the * Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
* *
@@ -333,8 +333,8 @@ class e_chart
$fName = 'draw'.ucfirst($id); $fName = 'draw'.ucfirst($id);
$js = " google.load('visualization', '1', {packages:['corechart']}); $js = " google.charts.load('visualization', '1', {packages:['corechart']});
google.setOnLoadCallback(".$fName."); google.charts.setOnLoadCallback(".$fName.");
function ".$fName."() { function ".$fName."() {
var data = google.visualization.arrayToDataTable(".$this->getData()."); var data = google.visualization.arrayToDataTable(".$this->getData().");
@@ -387,7 +387,7 @@ class e_chart
"; ";
e107::js('footer','https://www.google.com/jsapi'); e107::js('footer','https://www.gstatic.com/charts/loader.js');
e107::js('footer-inline', $js); e107::js('footer-inline', $js);
return "<div class='e-graph e-chart' id='".$id."' style='width: ".$width."; height: ".$height."px;'></div>"; return "<div class='e-graph e-chart' id='".$id."' style='width: ".$width."; height: ".$height."px;'></div>";