From 6b0ec830e5ac0044252908630e52d4494f1df570 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 21 Jul 2013 22:59:27 +0200 Subject: In debug mode: catch and log JS errors with file information When debugging is enabled (allowdebug enabled) JS errors are now catched for each non-core JS file and logged with the additional information from which file they came. This should make it easier to find out which plugin is the cause for broken JS code. The feature isn't enabled by default as defining functions inside try-clauses isn't allowed in strict mode and causes a warning at least in Firefox. --- lib/scripts/helpers.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/scripts/helpers.js') diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js index d6f36967d..fdac13b71 100644 --- a/lib/scripts/helpers.js +++ b/lib/scripts/helpers.js @@ -68,3 +68,18 @@ function bind(fnc/*, ... */) { static_args.concat(Aps.call(arguments, 0))); }; } + +/** + * Report an error from a JS file to the console + * + * @param e The error object + * @param file The file in which the error occurred + */ +function logError(e, file) { + if (window.console && console.error) { + console.error('The error "%s: %s" occurred in file "%s". ' + + 'If this is in a plugin try updating or disabling the plugin, ' + + 'if this is in a template try updating the template or switching to the "default" or "dokuwiki" template.', + e.name, e.message, file); + } +} \ No newline at end of file -- cgit v1.2.3 From c6f665dd924dfa715fc19140c26d25eddcef9841 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 30 Jul 2013 17:50:17 +0200 Subject: Don't recommend the deprecated default template for JS debugging --- lib/scripts/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/scripts/helpers.js') diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js index fdac13b71..677abbad7 100644 --- a/lib/scripts/helpers.js +++ b/lib/scripts/helpers.js @@ -79,7 +79,7 @@ function logError(e, file) { if (window.console && console.error) { console.error('The error "%s: %s" occurred in file "%s". ' + 'If this is in a plugin try updating or disabling the plugin, ' + - 'if this is in a template try updating the template or switching to the "default" or "dokuwiki" template.', + 'if this is in a template try updating the template or switching to the "dokuwiki" template.', e.name, e.message, file); } -} \ No newline at end of file +} -- cgit v1.2.3 From 193e22801d763e715f03f241b135a2e249c6132e Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Thu, 1 Aug 2013 16:42:31 +0100 Subject: removed unused and old hasFlash() JS function --- lib/scripts/helpers.js | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'lib/scripts/helpers.js') diff --git a/lib/scripts/helpers.js b/lib/scripts/helpers.js index d6f36967d..632c4bff2 100644 --- a/lib/scripts/helpers.js +++ b/lib/scripts/helpers.js @@ -2,25 +2,6 @@ * Various helper functions */ -/** - * Very simplistic Flash plugin check, probably works for Flash 8 and higher only - * - * @author Andreas Gohr - */ -function hasFlash(version){ - var ver = 0; - try{ - if(navigator.plugins != null && navigator.plugins.length > 0){ - ver = navigator.plugins["Shockwave Flash"].description.split(' ')[2].split('.')[0]; - }else{ - ver = (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) - .GetVariable("$version").split(' ')[1].split(',')[0]; - } - }catch(e){ } - - return ver >= version; -} - /** * A PHP-style substr_replace * -- cgit v1.2.3