From: Nicolas Boisselier Date: Fri, 8 Jun 2018 02:58:45 +0000 (+0100) Subject: lib/php/db/table.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=fb8e739c743b5797b291028339c8f6668f3d63b0;p=nb.git lib/php/db/table.php --- diff --git a/lib/js/nb.js b/lib/js/nb.js index 89f90a89..fff86b03 100644 --- a/lib/js/nb.js +++ b/lib/js/nb.js @@ -7,353 +7,353 @@ function NB(args) { - // Vars from args - if (typeof(args) != 'undefined') { for (var k in args) { this['o_'+k] = args[k]; } } - - var that = this; - var name = 'Nb'; - - // Lib - this.ready = function() { - - // Form clean - $('form').submit(function(e){ - //e.preventDefault(); - return that.form_submit_clean(this); - }); - - // Add msg div - var msg = $('
'); - if ($('h1').length) { - msg.insertAfter('h1:first'); - } else { - $('body').prepend(msg); - } - - //that.resize(); $( window ).resize(that.resize); - if (that.o_resize) $(window).on('load resize',that.resize); - - that.debug('READY !!!'); - - }; - - this.wh = function(s) { - var item = $(s); - if (!item) return [0,0] - - var width = item.width(); - var height = item.height(); - - /* - */ - width -= $(item).css('paddingLeft').replace(/px/,''); - width -= $(item).css('paddingRight').replace(/px/,''); - height -= $(item).css('paddingTop').replace(/px/,''); - height -= $(item).css('paddingBottom').replace(/px/,''); - - width -= $(item).css('marginLeft').replace(/px/,''); - width -= $(item).css('marginRight').replace(/px/,''); - height -= $(item).css('marginTop').replace(/px/,''); - height -= $(item).css('marginBottom').replace(/px/,''); - //console.log(width+'/'+height); - return [parseInt(width),parseInt(height)]; - } - - this.basicauth_logout = function() { - var userAgent = navigator.userAgent.toLowerCase(); - - if (userAgent.indexOf("msie") != -1) { - document.execCommand("ClearAuthenticationCache", false); - } - - xhr_objectCarte = null; - - if(window.XMLHttpRequest) - xhr_object = new XMLHttpRequest(); - else if(window.ActiveXObject) - xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); - else - alert ("Your browser doesn't support XMLHTTPREQUEST"); - - xhr_object.open ('GET', '/logout', false, '\0', 'password'); - xhr_object.send (""); - xhr_object = null; - - document.location = window.location; - return false; - } - - this.maximize = function(s) { - var height = $(window).height(); - var width = $(window).width(); - - $(s).each(function(){ - w = width; - h = height; - - // fixed margins - h -= 20; w -= 20; - - // remove what is above - var pos = $(this).position(); if (pos) h -= parseInt(pos.top); - - // remove what is after - $(this).next(). - add($(this).parent().next()) - .each(function(){ h -= $(this).height(); }); - - // apply - $(this).height(h); $(this).width(w); - $(this).css({ - 'overflow':'auto', - }); - if (this.tagName == 'TABLE') $(this).css('display','block'); - }); - } - - this.resize_width = function(s) { - var block = $(s); - if (!block) return false; - - var width = $('html').width(); - var set_width = width - 30; - block.each(function(){ - - var cur_width = $(this).width(); - var first_width = $(this).attr('nb-first-size'); - var new_width; + // Vars from args + if (typeof(args) != 'undefined') { for (var k in args) { this['o_'+k] = args[k]; } } + + var that = this; + var name = 'Nb'; + + // Lib + this.ready = function() { + + // Form clean + $('form').submit(function(e){ + //e.preventDefault(); + return that.form_submit_clean(this); + }); + + // Add msg div + var msg = $('
'); + if ($('h1').length) { + msg.insertAfter('h1:first'); + } else { + $('body').prepend(msg); + } + + //that.resize(); $( window ).resize(that.resize); + if (that.o_resize) $(window).on('load resize',that.resize); + + that.debug('READY !!!'); + + }; + + this.wh = function(s) { + var item = $(s); + if (!item) return [0,0] + + var width = item.width(); + var height = item.height(); + + /* + */ + width -= $(item).css('paddingLeft').replace(/px/,''); + width -= $(item).css('paddingRight').replace(/px/,''); + height -= $(item).css('paddingTop').replace(/px/,''); + height -= $(item).css('paddingBottom').replace(/px/,''); + + width -= $(item).css('marginLeft').replace(/px/,''); + width -= $(item).css('marginRight').replace(/px/,''); + height -= $(item).css('marginTop').replace(/px/,''); + height -= $(item).css('marginBottom').replace(/px/,''); + //console.log(width+'/'+height); + return [parseInt(width),parseInt(height)]; + } + + this.basicauth_logout = function() { + var userAgent = navigator.userAgent.toLowerCase(); + + if (userAgent.indexOf("msie") != -1) { + document.execCommand("ClearAuthenticationCache", false); + } + + xhr_objectCarte = null; + + if(window.XMLHttpRequest) + xhr_object = new XMLHttpRequest(); + else if(window.ActiveXObject) + xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); + else + alert ("Your browser doesn't support XMLHTTPREQUEST"); + + xhr_object.open ('GET', '/logout', false, '\0', 'password'); + xhr_object.send (""); + xhr_object = null; + + document.location = window.location; + return false; + } + + this.maximize = function(s) { + var height = $(window).height(); + var width = $(window).width(); + + $(s).each(function(){ + w = width; + h = height; + + // fixed margins + h -= 20; w -= 20; + + // remove what is above + var pos = $(this).position(); if (pos) h -= parseInt(pos.top); + + // remove what is after + $(this).next(). + add($(this).parent().next()) + .each(function(){ h -= $(this).height(); }); + + // apply + $(this).height(h); $(this).width(w); + $(this).css({ + 'overflow':'auto', + }); + if (this.tagName == 'TABLE') $(this).css('display','block'); + }); + } + + this.resize_width = function(s) { + var block = $(s); + if (!block) return false; + + var width = $('html').width(); + var set_width = width - 30; + block.each(function(){ + + var cur_width = $(this).width(); + var first_width = $(this).attr('nb-first-size'); + var new_width; //$(this).css({ 'border': 'solid 1px yellow', }); - // Width to big - if (cur_width > width) { + // Width to big + if (cur_width > width) { - if (this.tagName == 'TABLE') $(this).css({ - 'display': 'block', - 'overflow': 'scroll', - }); + if (this.tagName == 'TABLE') $(this).css({ + 'display': 'block', + 'overflow': 'scroll', + }); - new_width = set_width; - //if (!first_width) $(this).attr('nb-first-size',new_width); + new_width = set_width; + //if (!first_width) $(this).attr('nb-first-size',new_width); //console.log(this.tagName+' : '+$(this).width()+' / '+width); - //console.log('RESIZE: '+this.tagName+': '+cur_width+' -> '+new_width); + //console.log('RESIZE: '+this.tagName+': '+cur_width+' -> '+new_width); - // Width OK - } else { + // Width OK + } else { - if (first_width) { + if (first_width) { /* - if (this.tagName == 'TABLE') { - $(this).css({ - 'display': 'table', - 'overflow': 'visible', - }); + if (this.tagName == 'TABLE') { + $(this).css({ + 'display': 'table', + 'overflow': 'visible', + }); - } else { + } else { // NB 16.04.16 $(this).width((set_width < first_width) ? set_width : first_width); - } + } */ - new_width = first_width; - //console.log('RESTORE FIRST: '+this.tagName+': '+cur_width+' -> '+$(this).attr('nb-first-size')); + new_width = first_width; + //console.log('RESTORE FIRST: '+this.tagName+': '+cur_width+' -> '+$(this).attr('nb-first-size')); + + } else { + $(this).attr('nb-first-size',cur_width); - } else { - $(this).attr('nb-first-size',cur_width); + } - } + } - } + if (new_width) { + $(this).width(new_width); + console.log('RESIZE: width='+width+' '+this.tagName+' '+$(this).attr('class')+': '+cur_width+' -> '+new_width); + } - if (new_width) { - $(this).width(new_width); - console.log('RESIZE: width='+width+' '+this.tagName+' '+$(this).attr('class')+': '+cur_width+' -> '+new_width); - } + }); - }); + } - } + this.resize = function() { - this.resize = function() { + if (!that.o_resize) return; + var opt = that.o_resize; - if (!that.o_resize) return; - var opt = that.o_resize; + // Used in css to trigger a resize + if (!$('#'+opt['media_id']).length) $('body').append(''); - // Used in css to trigger a resize - if (!$('#'+opt['media_id']).length) $('body').append(''); + if (opt['table2div']) { + // table to div + if ($('#'+opt['media_id']).css('content') != 'none') { - if (opt['table2div']) { - // table to div - if ($('#'+opt['media_id']).css('content') != 'none') { + $(opt['table2div']).each(function(){ + if (this.tagName=='TABLE') that.table2div(this); + }); - $(opt['table2div']).each(function(){ - if (this.tagName=='TABLE') that.table2div(this); - }); + //that.table2div('table.rows'); + return true; - //that.table2div('table.rows'); - return true; + } else { + that.table2div(opt['table2div'],'CLEAN'); - } else { - that.table2div(opt['table2div'],'CLEAN'); - - } - } - - // Max width for blocks - if (opt['resize_width']) that.resize_width(opt['resize_width']); - if (opt['maximize']) that.maximize(opt['maximize']); - - that.debug('RESIZE !!!'); - } + } + } - this.table2div = function(find,clean) { - - if (clean) { - $('.t2d-th').each(function(){ $(this).remove(); }); - return $(find).addClass('t2d'); - } - - var th = [] - - var t = $(find); - if ($(t).hasClass('t2d')) return false; - $(t).addClass('t2d'); - - $(t.find('thead')).each(function(){ - $(this).find('th').each(function(){ - //$(this).find('a').remove(); - th.push($(this).html()); - }); - }); - - //console.log(th.length); - - $(t.find('tbody tr')).each(function(){ - var i = 0; - $(this).find('td').each(function(){ - if (typeof th[i] != 'undefined' && th[i] != '') $(this).prepend(''); - //$(this).css('display','block'); - i++ - }); - }); - - return t; - } - - this.form_submit_clean = function(f) { - var i = 0; - var url = ''; - var action = f.getAttribute('action'); - var method = f.getAttribute('method'); - if (method != 'get') return true; - - //if (typeof(action) == 'undefined') action = ''; - - for(i=0;imax) text = text.substring(0,(max/2)+1) + '.. ' + text.substring(text.length-(max/2),text.length); - return text; - }; - - this.e2links = function(elems,compact,class_exp_file) { - compact = (typeof compact === 'undefined') ? true : compact; - class_exp_file = (typeof class_exp_file === 'undefined') ? 'doc|dir|path' : class_exp_file; - $(elems).each(function(){ - - var text = $(this).text(); - if (text == '') return; - if (text != $(this).html()) return; // contents html - - // Search /home - var url = text - if (text.match(/^~/)) { - var ua = navigator.userAgent - if (ua.match(/Macintosh/)) { url = url.replace(/^~/,'/Users/') } - else { url = url.replace(/^~/,'/home/') } - //console.log(url); - } - - if (class_exp_file) { - var re = new RegExp(class_exp_file); - if (this.className.match(re) && !url.match(/^\w+:/)) url = 'file://'+encodeURI(url); - } - - if (compact) text = that.str_trunc(text); - //console.log(text); - - $(this).html(''+text+''); - - }); - - }; + // Max width for blocks + if (opt['resize_width']) that.resize_width(opt['resize_width']); + if (opt['maximize']) that.maximize(opt['maximize']); + + that.debug('RESIZE !!!'); + } + + this.table2div = function(find,clean) { + + if (clean) { + $('.t2d-th').each(function(){ $(this).remove(); }); + return $(find).addClass('t2d'); + } + + var th = [] + + var t = $(find); + if ($(t).hasClass('t2d')) return false; + $(t).addClass('t2d'); + + $(t.find('thead')).each(function(){ + $(this).find('th').each(function(){ + //$(this).find('a').remove(); + th.push($(this).html()); + }); + }); + + //console.log(th.length); + + $(t.find('tbody tr')).each(function(){ + var i = 0; + $(this).find('td').each(function(){ + if (typeof th[i] != 'undefined' && th[i] != '') $(this).prepend(''); + //$(this).css('display','block'); + i++ + }); + }); + + return t; + } + + this.form_submit_clean = function(f) { + var i = 0; + var url = ''; + var action = f.getAttribute('action'); + var method = f.getAttribute('method'); + if (method != 'get') return true; + + //if (typeof(action) == 'undefined') action = ''; + + for(i=0;imax) text = text.substring(0,(max/2)+1) + '.. ' + text.substring(text.length-(max/2),text.length); + return text; + }; + + this.e2links = function(elems,compact,class_exp_file) { + compact = (typeof compact === 'undefined') ? true : compact; + class_exp_file = (typeof class_exp_file === 'undefined') ? 'doc|dir|path' : class_exp_file; + $(elems).each(function(){ + + var text = $(this).text(); + if (text == '') return; + if (text != $(this).html()) return; // contents html + + // Search /home + var url = text + if (text.match(/^~/)) { + var ua = navigator.userAgent + if (ua.match(/Macintosh/)) { url = url.replace(/^~/,'/Users/') } + else { url = url.replace(/^~/,'/home/') } + //console.log(url); + } + + if (class_exp_file) { + var re = new RegExp(class_exp_file); + if (this.className.match(re) && !url.match(/^\w+:/)) url = 'file://'+encodeURI(url); + } + + if (compact) text = that.str_trunc(text); + //console.log(text); + + $(this).html(''+text+''); + + }); + + }; this.html_select = function(ar) { - console.log(json); - var select = $(''); + // JSON.parse(json) $.each(ar, function(val, text) { - select.append( + select.append( $('').val(val).html(text) ); }); - return select; + return select; } this.urlParam = function(name) { @@ -365,237 +365,237 @@ function NB(args) { } } - this.data2html = function(data) { - - if (typeof(data) == 'string') { - //if (data == '') return ' '; - return data; - } - - var items = []; - - if ($.isArray(data)) { - if (!data.length) return ''; - - if (typeof(data[0]) == 'object') { - for (var i=0;i'+that.data2html(data[i])+'' ); - } else { - items.push( '
  • '+data[i]+'
  • ' ); - } - } - return '
      ' + items.join('') + '
    '; - - } - - var key = ''; - var val = ''; - for (var key in data) { - val = data[key]; - if (typeof(val) != 'string') { val = that.data2html(val); } - //items.push( '' + key + '' + val + '' ); - items.push( '
    ' + key + '
    ' + val + '
    ' ); - //items.push( '
    ' + key + '
    ' + val + '
    ' ); - } - - //return '' + items.join('') + ''; - return items.join(''); - } + this.data2html = function(data) { + + if (typeof(data) == 'string') { + //if (data == '') return ' '; + return data; + } + + var items = []; + + if ($.isArray(data)) { + if (!data.length) return ''; + + if (typeof(data[0]) == 'object') { + for (var i=0;i'+that.data2html(data[i])+'' ); + } else { + items.push( '
  • '+data[i]+'
  • ' ); + } + } + return '
      ' + items.join('') + '
    '; + + } + + var key = ''; + var val = ''; + for (var key in data) { + val = data[key]; + if (typeof(val) != 'string') { val = that.data2html(val); } + //items.push( '' + key + '' + val + '' ); + items.push( '
    ' + key + '
    ' + val + '
    ' ); + //items.push( '
    ' + key + '
    ' + val + '
    ' ); + } + + //return '' + items.join('') + ''; + return items.join(''); + } this.j2d = function(url) { - var rows = $(''); - var count = 0; + var rows = $('
    '); + var count = 0; - $.getJSON(url, function(json) { + $.getJSON(url, function(json) { - $.each(json, function(i,rec){ + $.each(json, function(i,rec){ - $.each(rec, function(k,v){ - var row = $('',{'class':k}).appendTo(rows); + $.each(rec, function(k,v){ + var row = $('',{'class':k}).appendTo(rows); - $('
    ',{'text':k}).appendTo(row) - $('',{'text':v}).appendTo(row) + $('',{'text':k}).appendTo(row) + $('',{'text':v}).appendTo(row) //console.log(rec); - }); + }); - count++; - }); + count++; + }); - }); + }); - return rows; - } + return rows; + } this.j2t = function(url) { - var rows = $(''); - var count = 0; - - $.getJSON(url, function(json) { - - $.each(json, function(i,rec){ - var row = $('').appendTo(rows); - - if (!count) { - $.each(rec, function(k,v){ - $('').appendTo(rows); - } - - $.each(rec, function(k,v){ - $('
    ',{ - 'text': k, - 'class': k, - }).appendTo(row) - }); - row = $('
    ',{ - 'text': v, - 'class': k, - }).appendTo(row) + var rows = $(''); + var count = 0; + + $.getJSON(url, function(json) { + + $.each(json, function(i,rec){ + var row = $('').appendTo(rows); + + if (!count) { + $.each(rec, function(k,v){ + $('').appendTo(rows); + } + + $.each(rec, function(k,v){ + $('').append(row); - //if (typeof map != 'undefined') { $.each(row,map); } + if (typeof map != 'undefined') { (map)(item,v); } + //if (tags[tag] == 'td') row = $('').append(row); + //if (typeof map != 'undefined') { $.each(row,map); } - rows.append(row); + rows.append(row); - }); + }); - }); - return rows; + }); + return rows; - } + } - this.json2html = function(url) { - $.getJSON(url,function(data) { - if ($.isArray(data) && data.length == 1) data = data[0]; - var html = that.data2html(data); - //console.log(that.data2html(data)); - if (html != '') $(html).prependTo( "#nb-msg" ); - //console.log(typeof(data)); - }); - } + this.json2html = function(url) { + $.getJSON(url,function(data) { + if ($.isArray(data) && data.length == 1) data = data[0]; + var html = that.data2html(data); + //console.log(that.data2html(data)); + if (html != '') $(html).prependTo( "#nb-msg" ); + //console.log(typeof(data)); + }); + } - this.dump = function (arr,level) { - var dumped_text = ""; - if(!level) level = 0; + this.dump = function (arr,level) { + var dumped_text = ""; + if(!level) level = 0; - //The padding given at the beginning of the line. - var level_padding = ""; - for(var j=0;j \"" + value + "\"\n"; + dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n"; + } + } + } else { //Stings/Chars/Numbers etc. + dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; + } + return dumped_text; + } + + this.msg = function(msg) { + $('

    '+msg+'

    ').prependTo( "#nb-msg" ); + } + + this.reload_head_js = function() { + $("head script").each(function(){ + var oldScript = this.getAttribute("src"); + $(this).remove(); + var newScript; + newScript = document.createElement('script'); + newScript.type = 'text/javascript'; + newScript.src = oldScript; + document.getElementsByTagName("head")[0].appendChild(newScript); + }); } - } - } else { //Stings/Chars/Numbers etc. - dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; - } - return dumped_text; - } - - this.msg = function(msg) { - $('

    '+msg+'

    ').prependTo( "#nb-msg" ); - } - - this.reload_head_js = function() { - $("head script").each(function(){ - var oldScript = this.getAttribute("src"); - $(this).remove(); - var newScript; - newScript = document.createElement('script'); - newScript.type = 'text/javascript'; - newScript.src = oldScript; - document.getElementsByTagName("head")[0].appendChild(newScript); - }); - } - - // <<< FUNCTIONS - if (this.o_ready) this.ready(); + + // <<< FUNCTIONS + if (this.o_ready) this.ready(); }; // <<< NB /* - Statics + Statics */ NB.reload_head_js = NB.prototype.reload_head_js NB.get_http = NB.prototype.get_http @@ -605,46 +605,46 @@ NB.urlParam = NB.prototype.urlParam //NB.test = function() { console.log(that.dump('zaza'))} //NB.prototype.your_method = function() { } jQuery.fn.numAdd = function(num,re) { - if (typeof num == 'undefined') num = 1; num = parseInt(num); - if (typeof re == 'undefined') re = new RegExp('([\+\-]?\\d+)'); - if (typeof re == 'string') re = new RegExp(re); - //var re = new RegExp(exp); - - return this.each(function() { - var html = $(this).html(); - var m = html.match(re); - if (!m || m.length<2) return; - - for (var i=1;i'.NB_EOL; -# NB 07.01.18 if ($this->show_hidden_params and !$this->p('inc')) echo $this->form_hidden(); } if ($opt['is_html']) $this->db()->out->type('html'); @@ -2216,11 +2215,11 @@ Class Table extends nb { */ // Hiddens - $form_hidden = ['db','table','format','limit','download']; + $form_hidden = ['db','table','format','limit'];#,'download']; if ($this->show_hidden_params) $r .= ''#.print_r(self::$params,true) .self::form_hidden($form_hidden) // Embed for no html format (rent) - .''; +# NB 08.06.18 .''; ; $r .= ''; # < Options diff --git a/lib/php/mime.php b/lib/php/mime.php index 5e692fff..0633b0d7 100644 --- a/lib/php/mime.php +++ b/lib/php/mime.php @@ -730,21 +730,40 @@ class Mime { } public static function html_youtube_embed($str) { + static $init = ''; + $id = ''; if (!preg_match(',//www.youtube.com/watch\?v=([^&\s]+),',$str,$m)) return $str; - return '' + $id = $m[1]; + $iframe = '' #.'
    ' .'' #.'
    ' ; + if (empty($init)) { + $init = '' + . '' + ; + } + return $init + . ''.$str.''; + $iframe = str_replace('',$id,$iframe); + return $init.$iframe; return '' - #.'' - .'' - .'' + #.'' + .'' + .'' .'' .'' .'' diff --git a/www/dbq/dbq.php b/www/dbq/dbq.php index bc08c78d..f1e69e9c 100644 --- a/www/dbq/dbq.php +++ b/www/dbq/dbq.php @@ -631,7 +631,7 @@ class DbQ extends nb { 'name' => $this->params['table'], 'db' => $this->db, 'db' => $this->db, - 'show_hidden_params' => false, + 'show_hidden_params' => true, 'show_buttons' => false, 'show_header' => $this->is_html, ],$param));
    ',{ + 'text': k, + 'class': k, + }).appendTo(row) + }); + row = $('
    ',{ + 'text': v, + 'class': k, + }).appendTo(row) //console.log(rec); - }); + }); - count++; - }); + count++; + }); - }); + }); - return rows; - } + return rows; + } this.j2h = function(url,dest,tag='ul',map) { - var tags = { - 'table' : 'tr.td', - 'select' : 'option', - 'ul' : 'li', - } - - var m; - if (m = tag.match(/^(\w+)\.(.*)$/)) { - tag = m[1]; - tags[m[1]] = m[2]; - } else if(typeof tags[tag] == 'undefined' || tags[tag] == null) { - tags[tag] = tag; - } - - if (typeof tags[tag] == 'string') tags[tag] = tags[tag].split('.'); + var tags = { + 'table' : 'tr.td', + 'select' : 'option', + 'ul' : 'li', + } + + var m; + if (m = tag.match(/^(\w+)\.(.*)$/)) { + tag = m[1]; + tags[m[1]] = m[2]; + } else if(typeof tags[tag] == 'undefined' || tags[tag] == null) { + tags[tag] = tag; + } + + if (typeof tags[tag] == 'string') tags[tag] = tags[tag].split('.'); //console.log(tags[tag]); return; - var rows = $('<'+tag+'>'); + var rows = $('<'+tag+'>'); - $.getJSON(url, function(json) { - if (dest) $(dest).append(rows); - tag == 'select' && rows.append($('<'+tags[tag]+'>').text('')); + $.getJSON(url, function(json) { + if (dest) $(dest).append(rows); + tag == 'select' && rows.append($('<'+tags[tag]+'>').text('')); - //if (typeof map != 'undefined') { json = $.map(json,map); } - //console.log(json.toSource()); + //if (typeof map != 'undefined') { json = $.map(json,map); } + //console.log(json.toSource()); - $.each(json, function(k, v){ + $.each(json, function(k, v){ - if (typeof map == 'undefined') { - if ($.type(v) == 'object') { v = $.map(v,function(v,k){return v})[0]; v = [v,v]; } - if ($.type(v) == 'string') v = [v,v]; - if (v.length==1) v = [v[0],v[0]] - } + if (typeof map == 'undefined') { + if ($.type(v) == 'object') { v = $.map(v,function(v,k){return v})[0]; v = [v,v]; } + if ($.type(v) == 'string') v = [v,v]; + if (v.length==1) v = [v[0],v[0]] + } - var row = null; - var item; - $.each(tags[tag],function(i,t){ + var row = null; + var item; + $.each(tags[tag],function(i,t){ //console.log(t+': '+row); - item = $('<'+t+'>'); - if (row == null) { - row = item; - } else { - row.append(item); - } - }); - //row = $('<'+tags[tag]+'>'); + item = $('<'+t+'>'); + if (row == null) { + row = item; + } else { + row.append(item); + } + }); + //row = $('<'+tags[tag]+'>'); - //if (row == null) return; + //if (row == null) return; - if (typeof map == 'undefined') { - item.text(v[0]); - item.attr('value',v[1]); - } + if (typeof map == 'undefined') { + item.text(v[0]); + item.attr('value',v[1]); + } - if (typeof map != 'undefined') { (map)(item,v); } - //if (tags[tag] == 'td') row = $('