Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simple logger that will use firebug console log first if available, otherwise simply log to a div
- // Requires jquery
- // Usage L.log('log this text');
- var L = {
- logEnabled: true,
- log: function(obj)
- {
- if(L.logEnabled){
- try{
- console.log(obj);
- }catch(ex){
- var theConsole = $('#pp-log-console');
- var cnt = theConsole.data('cnt');
- if(theConsole.length == 0){
- theConsole = jQuery("<div/>").attr('id','pp-log-console').appendTo('body');
- theConsole.css({ position: 'absolute', left: '15px', top: '40px', border: '5px solid #999'});
- topBar = jQuery("<div/>").appendTo(theConsole);
- topBar.css({ height: '25px', background: '#4466BB', width: '100%'});
- topBar.css({ position: 'absolute', left: '-5px', top: '-30px', zIndex: '20'});
- topBar.css({ border: '5px solid #999', borderBottom: '0px none'});
- closeBut = jQuery("<a/>").text('close').prependTo(theConsole);
- closeBut.css({ position: 'absolute', right: '10px', top: '-20px', color: '#fff', cursor: 'pointer', zIndex: '200'});
- closeBut.click(function(e){
- $('#pp-log-console').remove();
- });
- ul = jQuery("<ul/>").appendTo(theConsole);
- ul.css({ background: '#000', color: '#00ff00', fontFamily: 'lucida console,monospace' });
- ul.css({ height: '100%', width: '100%', overflow: 'auto' });
- cnt = 100;
- try{ theConsole.draggable({cancel: '#pp-log-console ul'}); }catch(ex){}
- try{ theConsole.resizable(); }catch(ex){}
- }
- cnt++;
- theConsole.data('cnt', cnt);
- jQuery("<li/>").css({padding: '2px 10px'}).text(cnt + ' | ' + obj).prependTo(theConsole.find('ul'));
- }
- }
- }
- };
Add Comment
Please, Sign In to add comment