changeset 692:ab8054bba8d3 jquery

console debug div for IE
author hertzhaft
date Thu, 27 Jan 2011 00:11:50 +0100
parents fe2bb8f926be
children e06822e74ffd
files client/digitallibrary/jquery/img/make_icon.cmd client/digitallibrary/jquery/jquery-test-embedded.html client/digitallibrary/jquery/jquery.digilib.js
diffstat 3 files changed, 40 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/jquery/img/make_icon.cmd	Thu Jan 27 00:11:50 2011 +0100
@@ -0,0 +1,11 @@
+@echo off
+setlocal
+
+rem saxon embedded.svg embedded_icons.xsl
+
+set ink=C:\prog_mr\inkscape-0.48.1\inkscape.exe
+
+%ink% embedded\svg\%1.svg --export-png=embedded\16\%1.png -w16 -h16
+%ink% embedded\svg\%1.svg --export-png=embedded\32\%1.png -w32 -h32
+
+endlocal
\ No newline at end of file
--- a/client/digitallibrary/jquery/jquery-test-embedded.html	Wed Jan 26 23:43:39 2011 +0100
+++ b/client/digitallibrary/jquery/jquery-test-embedded.html	Thu Jan 27 00:11:50 2011 +0100
@@ -104,19 +104,19 @@
                         <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/&amp;pn=1" />
                     </div>
                 </td>
-            
+
                 <td>
                     <div id="digilib-2" class="digilib">
                         <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/ferrara" />
                     </div>
                 </td>
-            
+
                 <td>
                     <div id="digilib-3" class="digilib">
                         <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/weide" />
                     </div>
                 </td>
-            
+
                 <td>
                     <div id="digilib-4" class="digilib">
                         <img src="http://digilib.biblhertz.it/digilib04/servlet/Scaler?dw=200&amp;dh=200&amp;fn=/digisprint/jquery/HansHolbein-NikolausKratzer" />
--- a/client/digitallibrary/jquery/jquery.digilib.js	Wed Jan 26 23:43:39 2011 +0100
+++ b/client/digitallibrary/jquery/jquery.digilib.js	Thu Jan 27 00:11:50 2011 +0100
@@ -6,30 +6,12 @@
 // fallback for console.log calls
 if (typeof(console) === 'undefined') {
     var console = {
-        log : function(){
-            var $debug = $('#debug');
-            if (!$debug) return;
-            var args = Array.prototype.slice.call(arguments);
-            var argstr = args.join(' ');
-            $debug.append('<div class="_log">' + argstr + '</div>');
-            },
-        debug : function(){
-            // debug for MSIE etc
-            var $debug = $('#debug');
-            if (!$debug) return;
-            var args = Array.prototype.slice.call(arguments);
-            var argstr = args.join(' ');
-            $debug.append('<div class="_debug">' + argstr + '</div>');
-            },
-        error : function(){
-            var $debug = $('#debug');
-            if (!$debug) return;
-            var args = Array.prototype.slice.call(arguments);
-            var argstr = args.join(' ');
-            $debug.append('<div class="_error">' + argstr + '</div>');
-            }
-    };
-}
+        log : function(){}, 
+        debug : function(){}, 
+        error : function(){}
+        };
+    var customConsole = true;
+};
 
 (function($) {
     var buttons = {
@@ -1214,6 +1196,25 @@
         return parseInt(10000 * x, 10) / 10000;
     };
 
+    // fallback for console.log calls
+    if (customConsole) {
+        var logFunction = function(type) {
+            return function(){
+                var $debug = $('#debug'); // debug div
+                if (!$debug) return;
+                var args = Array.prototype.slice.call(arguments);
+                var argtext = args.join(' ');
+                var $logDiv = $('<div/>');
+                $logDiv.addClass(type);
+                $logDiv.text(argtext);
+                $debug.append($logDiv);
+                };
+            };
+        console.log = logFunction('_log'); 
+        console.debug = logFunction('_debug'); 
+        console.error = logFunction('_error');
+        };
+
     // hook plugin into jquery
     $.fn.digilib = function(action) {
         if (actions[action]) {
@@ -1230,5 +1231,5 @@
             $.error( 'action ' + action + ' does not exist on jQuery.digilib' );
         }
     };
-    
+
 })(jQuery);
\ No newline at end of file