Author: timopollmeier Date: 2016-12-02 10:29:09 +0100 (Fri, 02 Dec 2016) New Revision: 26750
Added: trunk/gsa/src/html/classic/js/gsa_polyfill.js Modified: trunk/gsa/CMakeLists.txt trunk/gsa/ChangeLog trunk/gsa/src/html/classic/graphics.xsl trunk/gsa/src/html/classic/js/gsa_chart_helpers.js trunk/gsa/src/html/classic/js/gsa_graphics_base.js trunk/gsa/src/html/classic/js/gsa_h_bar_chart.js trunk/gsa/src/html/classic/js/lib/d3.tip.js Log: Fix several script errors occurring mostly in Internet Explorer 11. * CMakeLists.txt: Install src/html/classic/js/gsa_polyfill.js. * src/html/classic/graphics.xsl (init-d3charts): Add new JS file /js/gsa_polyfill.js. * src/html/classic/js/gsa_chart_helpers.js (register_chart_generator): Do not use function name as key because it is undefined in IE 11. * src/html/classic/js/gsa_graphics_base.js (addHtmlTableMenuItem): Create Blob with empty string if data is undefined. * src/html/classic/js/gsa_h_bar_chart.js: Use "bar" instead of "BarChartGenerator" in get_chart_generator calls. * src/html/classic/js/gsa_polyfill.js: New JavaScript file. * src/html/classic/js/lib/d3.tip.js (getScreenBBox): Fix loop condition for finding ancestor element with getScreenCTM function. Modified: trunk/gsa/CMakeLists.txt =================================================================== --- trunk/gsa/CMakeLists.txt 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/CMakeLists.txt 2016-12-02 09:29:09 UTC (rev 26750) @@ -323,6 +323,7 @@ src/html/classic/js/gsa_h_bar_chart.js src/html/classic/js/gsa_line_chart.js src/html/classic/js/gsa_topology_chart.js + src/html/classic/js/gsa_polyfill.js src/html/classic/js/greenbone.js src/html/classic/js/greenbone-ui.js DESTINATION ${GSA_DATA_DIR}/classic/js) Modified: trunk/gsa/ChangeLog =================================================================== --- trunk/gsa/ChangeLog 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/ChangeLog 2016-12-02 09:29:09 UTC (rev 26750) @@ -1,3 +1,26 @@ +2016-12-02 Timo Pollmeier <timo.pollme...@greenbone.net> + + Fix several script errors occurring mostly in Internet Explorer 11. + + * CMakeLists.txt: Install src/html/classic/js/gsa_polyfill.js. + + * src/html/classic/graphics.xsl (init-d3charts): Add new JS file + /js/gsa_polyfill.js. + + * src/html/classic/js/gsa_chart_helpers.js (register_chart_generator): + Do not use function name as key because it is undefined in IE 11. + + * src/html/classic/js/gsa_graphics_base.js (addHtmlTableMenuItem): + Create Blob with empty string if data is undefined. + + * src/html/classic/js/gsa_h_bar_chart.js: Use "bar" instead of + "BarChartGenerator" in get_chart_generator calls. + + * src/html/classic/js/gsa_polyfill.js: New JavaScript file. + + * src/html/classic/js/lib/d3.tip.js (getScreenBBox): Fix loop condition + for finding ancestor element with getScreenCTM function. + 2016-11-30 Timo Pollmeier <timo.pollme...@greenbone.net> * src/html/classic/omp.xsl (nvt-details): Rename the button Modified: trunk/gsa/src/html/classic/graphics.xsl =================================================================== --- trunk/gsa/src/html/classic/graphics.xsl 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/src/html/classic/graphics.xsl 2016-12-02 09:29:09 UTC (rev 26750) @@ -47,6 +47,7 @@ <script src="/js/d3.v3.js"></script> <script src="/js/d3.layout.cloud.js"></script> <script src="/js/d3.tip.js"></script> + <script src="/js/gsa_polyfill.js"></script> <script src="/js/gsa_chart_helpers.js"></script> <script src="/js/gsa_graphics_base.js"></script> <script src="/js/gsa_dashboard.js"></script> Modified: trunk/gsa/src/html/classic/js/gsa_chart_helpers.js =================================================================== --- trunk/gsa/src/html/classic/js/gsa_chart_helpers.js 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/src/html/classic/js/gsa_chart_helpers.js 2016-12-02 09:29:09 UTC (rev 26750) @@ -2852,7 +2852,6 @@ */ gch.register_chart_generator = function(chart_type, generator) { gch.chart_generators[chart_type] = generator; - gch.chart_generators[generator.name] = generator; }; /** Modified: trunk/gsa/src/html/classic/js/gsa_graphics_base.js =================================================================== --- trunk/gsa/src/html/classic/js/gsa_graphics_base.js 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/src/html/classic/js/gsa_graphics_base.js 2016-12-02 09:29:09 UTC (rev 26750) @@ -224,13 +224,14 @@ BaseChartGenerator.prototype.addHtmlTableMenuItem = function(controller, html_table_data) { var self = this; + var data = gsa.is_defined (html_table_data) ? html_table_data : ""; if (this.html_table_url !== null) { URL.revokeObjectURL(this.html_table_url); this.html_table_url = null; } - var html_table_blob = new Blob([html_table_data], + var html_table_blob = new Blob([data], {type: 'text/html'}); this.html_table_url = URL.createObjectURL(html_table_blob); Modified: trunk/gsa/src/html/classic/js/gsa_h_bar_chart.js =================================================================== --- trunk/gsa/src/html/classic/js/gsa_h_bar_chart.js 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/src/html/classic/js/gsa_h_bar_chart.js 2016-12-02 09:29:09 UTC (rev 26750) @@ -75,7 +75,7 @@ } HorizontalBarChartGenerator.prototype = Object.create( - gch.get_chart_generator('BarChartGenerator').prototype); + gch.get_chart_generator('bar').prototype); HorizontalBarChartGenerator.prototype.constructor = HorizontalBarChartGenerator; @@ -111,7 +111,7 @@ }; HorizontalBarChartGenerator.prototype.evaluateParams = function(gen_params) { - gch.get_chart_generator('BarChartGenerator').prototype.evaluateParams.call( + gch.get_chart_generator('bar').prototype.evaluateParams.call( this, gen_params); if (gsa.is_defined(gen_params.extra)) { Added: trunk/gsa/src/html/classic/js/gsa_polyfill.js =================================================================== --- trunk/gsa/src/html/classic/js/gsa_polyfill.js (rev 0) +++ trunk/gsa/src/html/classic/js/gsa_polyfill.js 2016-12-02 09:29:09 UTC (rev 26750) @@ -0,0 +1,62 @@ +/* + * Greenbone Security Assistant + * $Id$ + * Description: Polyfills for GSA. + * + * Authors: + * Timo Pollmeier <timo.pollme...@greenbone.net> + * + * Copyright: + * Copyright (C) 2016 Greenbone Networks GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +(function(global, $, console) { + 'use strict'; + + /* + * Public Domain polyfills from Mozilla JavaScript Reference + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference + */ + + // + if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, 'find', { + value: function(predicate) { + 'use strict'; + if (this == null) { + throw new TypeError('Array.prototype.find called on null or undefined'); + } + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + var list = Object(this); + var length = list.length >>> 0; + var thisArg = arguments[1]; + var value; + + for (var i = 0; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) { + return value; + } + } + return undefined; + } + }); + } + +})(window, window.$, window.console); \ No newline at end of file Modified: trunk/gsa/src/html/classic/js/lib/d3.tip.js =================================================================== --- trunk/gsa/src/html/classic/js/lib/d3.tip.js 2016-12-01 16:12:21 UTC (rev 26749) +++ trunk/gsa/src/html/classic/js/lib/d3.tip.js 2016-12-02 09:29:09 UTC (rev 26750) @@ -335,7 +335,7 @@ var targetel = target || d3.event.target; while ('undefined' === typeof targetel.getScreenCTM && - 'undefined' === targetel.parentNode) { + 'undefined' !== typeof targetel.parentNode) { targetel = targetel.parentNode; } _______________________________________________ Openvas-commits mailing list Openvas-commits@wald.intevation.org https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits