X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=3d77148654e82d9e391008e17245b1845bd528d3;hb=ab80172e885f5cafb2525dab0bf4102d49e8f7b6;hp=a391190df4ed72e8ac9cf9ec591e6d7d9e190757;hpb=5061b42f5e133a17132897f82f59170787ce80b0;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index a391190..3d77148 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -44,16 +44,18 @@ Dygraph.log = function(severity, message) { if (typeof(printStackTrace) != 'undefined') { // Remove uninteresting bits: logging functions and paths. var st = printStackTrace({guess:false}); - while (st[0].indexOf("Function.log") != 0) { + while (st[0].indexOf("stacktrace") != -1) { st.splice(0, 1); } + st.splice(0, 2); for (var i = 0; i < st.length; i++) { - st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '($1)') + st[i] = st[i].replace(/\([^)]*\/(.*)\)/, '@$1') .replace(/\@.*\/([^\/]*)/, '@$1') .replace('[object Object].', ''); } - message += ' (' + st.splice(0, 1) + ')'; + var top_msg = st.splice(0, 1)[0]; + message += ' (' + top_msg.replace(/^.*@ ?/, '') + ')'; } if (typeof(console) != 'undefined') { @@ -463,6 +465,11 @@ Dygraph.binarySearch = function(val, arry, abs, low, high) { Dygraph.dateParser = function(dateStr) { var dateStrSlashed; var d; + + // Let the system try the format first. + d = Dygraph.dateStrToMillis(dateStr); + if (d && !isNaN(d)) return d; + if (dateStr.search("-") != -1) { // e.g. '2009-7-12' or '2009-07-12' dateStrSlashed = dateStr.replace("-", "/", "g"); while (dateStrSlashed.search("-") != -1) { @@ -616,6 +623,15 @@ Dygraph.createCanvas = function() { /** * @private + * Checks whether the user is on an Android browser. + * Android does not fully support the tag, e.g. w/r/t/ clipping. + */ +Dygraph.isAndroid = function() { + return /Android/.test(navigator.userAgent); +}; + +/** + * @private * Call a function N times at a given interval, then call a cleanup function * once. repeat_fn is called once immediately, then (times - 1) times * asynchronously. If times=1, then cleanup_fn() is also called synchronously.