From 78f1dc66d2804dbb9b4c0173cc6a4ad2635f983e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 3 Aug 2013 11:23:06 +0200 Subject: [PATCH] Improved browser detection logging. --- .../app/lib/app_init/track.js.coffee | 29 +++++-------------- .../app/lib/app_post/browser.coffee | 5 ++++ 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_init/track.js.coffee b/app/assets/javascripts/app/lib/app_init/track.js.coffee index 0b83b4b6f..46604baf3 100644 --- a/app/assets/javascripts/app/lib/app_init/track.js.coffee +++ b/app/assets/javascripts/app/lib/app_init/track.js.coffee @@ -54,34 +54,24 @@ class _trackSingleton ) # log ajax calls - $(document).bind( 'ajaxError', ( e, request, settings, exception ) => - if status - @log( - 'ajax.error', - 'error', - { - type: settings.type - dataType: settings.dataType - url: settings.url - data: settings.data - status: request.status - responseText: request.responseText - } - ) - ) $(document).bind( 'ajaxComplete', ( e, request, settings ) => length = @url.length - if settings.url.substr(0,length) isnt @url + if settings.url.substr(0,length) isnt @url && settings.url.substr(0,6) isnt 'api/ui' + level = 'notice' + responseText = '' + if request.status > 200 + level = 'error' + responseText = request.responseText @log( 'ajax.send', - 'notice', + level, { type: settings.type dataType: settings.dataType url: settings.url data: settings.data status: request.status -# responseText: request.responseText + responseText: responseText } ) ) @@ -142,9 +132,6 @@ class _trackSingleton @data ` -window.onerror = function(errorMsg, url, lineNumber) { - console.error(errorMsg + " - in " + url + ", line " + lineNumber); -}; (function() { var console = window.console diff --git a/app/assets/javascripts/app/lib/app_post/browser.coffee b/app/assets/javascripts/app/lib/app_post/browser.coffee index abbcd49f2..8ff09a060 100644 --- a/app/assets/javascripts/app/lib/app_post/browser.coffee +++ b/app/assets/javascripts/app/lib/app_post/browser.coffee @@ -11,26 +11,31 @@ class App.Browser # disable Crome 13 and older if data.browser == 'Chrome' && data.version <= 13 @message(data) + console.log('Browser not supported') return false # disable Firefox 6 and older else if data.browser == 'Firefox' && data.version <= 6 @message(data) + console.log('Browser not supported') return false # disable IE 8 and older else if data.browser == 'Explorer' && data.version <= 8 @message(data) + console.log('Browser not supported') return false # disable Safari 3 and older else if data.browser == 'Safari' && data.version <= 3 @message(data) + console.log('Browser not supported') return false # disable Opera 10 and older else if data.browser == 'Opera' && data.version <= 10 @message(data) + console.log('Browser not supported') return false return true