diff --git a/plugins/Dashboard/templates/dashboardWidget.js b/plugins/Dashboard/templates/dashboardWidget.js index f10172a5d3677b6bed41dd2e012c3914ce9116d0..c053cf3e3e2bd3fb2774b0d3c7e22d39f8e251c5 100755 --- a/plugins/Dashboard/templates/dashboardWidget.js +++ b/plugins/Dashboard/templates/dashboardWidget.js @@ -40,7 +40,7 @@ _create: function() { if(!this.options.uniqueId) { - console.error('widgets can\'t be created without an uniqueId'); + piwikHelper.error('widgets can\'t be created without an uniqueId'); return; } else { this.uniqueId = this.options.uniqueId; diff --git a/themes/default/common.js b/themes/default/common.js index 2225740f9bf3d16b6e71efec587996cb66042c37..14f75b23441e4a76555d10aa6190ece18c6c0a9d 100644 --- a/themes/default/common.js +++ b/themes/default/common.js @@ -12,6 +12,33 @@ var piwikHelper = { return $('<div/>').html(value).text(); }, + /* + * a nice cross-browser logging function + */ + log: function() { + try { + console.log.apply(console, arguments); // Firefox, Chrome + } catch (e) { + try { + opera.postError.apply(opera, arguments); // Opera + } catch (f) { + alert(Array.prototype.join.call(arguments, ' ')); // MSIE + } + } + }, + + error: function() { + try { + console.error.apply(console, arguments); // Firefox, Chrome + } catch (e) { + try { + opera.postError.apply(opera, arguments); // Opera + } catch (f) { + alert(Array.prototype.join.call(arguments, ' ')); // MSIE + } + } + }, + htmlEntities: function(value) { var findReplace = [[/&/g, "&"], [/</g, "<"], [/>/g, ">"], [/"/g, """]];