'contact' => array(
'extras'=> array(
- ' pic' => '\'<img src="/scripts/gravatar/?email=\' || contact.email || \'" />\'',
+ ' pic' => '\'<img alt="" src="/scripts/gravatar/?email=\' || contact.email || \'" />\'',
),
),
'node' => array(
'row_parse_post'=> function(&$r) {
- $r['graph'] = '<a target="_blank" href="/graphite/?Hosts='.$r['id'].'"><img src="/images/graphite.png" /></a>';
+ $r['graph'] = '<a target="_blank" href="/graphite/?Hosts='.$r['id'].'"><img alt="" src="/images/graphite.png" /></a>';
},
'extras'=> array(
'ip' => false,
))"),
'fact' => "(SELECT count(*) FROM fact WHERE fact.idnode=node.id)",
'keyevent' => "(SELECT count(*) FROM keyevent WHERE keyevent.idnode=node.id)",
- #'graph' => '\'<a target="_blank" href="/graphite/?Hosts=\' || id || \'"><img src="/images/graphite.png" /></a>\'',
+ #'graph' => '\'<a target="_blank" href="/graphite/?Hosts=\' || id || \'"><img alt="" src="/images/graphite.png" /></a>\'',
),
),
'pingdom_check' => array(
'row_parse_post'=> function(&$r) {
- $r['View'] = '<a target="_blank" class="pingdom_check_report" href="https://my.pingdom.com/reports/uptime#check='.$r['id'].'"><img src="/images/graphite.png" /></a>';
+ $r['View'] = '<a target="_blank" class="pingdom_check_report" href="https://my.pingdom.com/reports/uptime#check='.$r['id'].'"><img alt="" src="/images/graphite.png" /></a>';
},
),
* See: http://www.w3schools.com/jquery/jquery_ref_selectors.asp
*/
-function NB() {
+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
$('body').prepend(msg);
}
- // Used in css to trigger a resize
- $('body').append('<span id="_responsive" style="display:none"></span>');
+ //that.resize(); $( window ).resize(that.resize);
+ if (that.o_resize) $(window).on('load resize',that.resize);
- //that.resize();
- //$( window ).resize(that.resize);
- $(window).on('load resize',that.resize);
+ that.debug('READY !!!');
- }
+ };
this.wh = function(s) {
var item = $(s);
return [parseInt(width),parseInt(height)];
}
- this.maxhw = function(s) {
+ this.maximize = function(s) {
var height = $(window).height();
var width = $(window).width();
});
}
- this.maxhw_resize = function(s) {
+ this.resize_width = function(s) {
var block = $(s);
if (!block) return false;
- var width = $('body').width();
- var set_width = width - 20;
+ var width = $('html').width();
+ var set_width = width - 30;
block.each(function(){
- var first_width = $(this).attr('nb-resize');
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) {
- if (!first_width) {
- $(this).attr('nb-resize',cur_width);
- }
+
if (this.tagName == 'TABLE') $(this).css({
'display': 'block',
'overflow': 'scroll',
});
- $(this).width(set_width);
- //console.log(this.tagName+' : '+$(this).width()+' / '+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);
+
+ // Width OK
} else {
if (first_width) {
+/*
if (this.tagName == 'TABLE') {
$(this).css({
'display': 'table',
});
} else {
- $(this).width((set_width < first_width) ? set_width : first_width);
+// NB 16.04.16 $(this).width((set_width < first_width) ? set_width : first_width);
}
- //console.log(this.tagName+' : '+$(this).attr('nb-resize'));
+*/
+ 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);
}
}
+ if (new_width) {
+ $(this).width(new_width);
+ console.log('RESIZE: width='+width+' '+this.tagName+' '+$(this).attr('class')+': '+cur_width+' -> '+new_width);
+ }
+
});
}
this.resize = function() {
- // table to div
- if ($('#_responsive').css('content') != 'none') {
- that.table2div('table.rows');
- return true;
- } else {
- $('.block table, table.block, table.rows').addClass('t2d');
- $('.t2d-th').each(function(){ $(this).remove(); });
+ if (!that.o_resize) return;
+ var opt = that.o_resize;
+
+ // Used in css to trigger a resize
+ if (!$('#'+opt['media_id']).length) $('body').append('<span id="'+opt['media_id']+'" style="display:none"></span>');
+
+ if (opt['table2div']) {
+ // table to div
+ if ($('#'+opt['media_id']).css('content') != 'none') {
+
+ $(opt['table2div']).each(function(){
+ if (this.tagName=='TABLE') that.table2div(this);
+ });
+
+ //that.table2div('table.rows');
+ return true;
+
+ } else {
+ that.table2div(opt['table2div'],'CLEAN');
+
+ }
}
// Max width for blocks
- that.maxhw_resize('table, div');
+ if (opt['resize_width']) that.resize_width(opt['resize_width']);
+ if (opt['maximize']) that.maximize(opt['maximize']);
+
+ that.debug('RESIZE !!!');
}
- this.table2div = function(find) {
+ this.table2div = function(find,clean) {
+
+ if (clean) {
+ $('.t2d-th').each(function(){ $(this).remove(); });
+ return $(find).addClass('t2d');
+ }
+
var th = []
var t = $(find);
});
});
+ return t;
}
this.form_submit_clean = function(f) {
}
};
- this.debug = function(test) {
- console.log(test);
+ this.debug = function(msg) {
+ if (!this.o_debug) return;
+ console.log(msg);
};
this.get_http = function(url) {
});
}
-};
+ // <<< FUNCTIONS
+ if (this.o_ready) this.ready();
+
+}; // <<< NB
/*
Statics
*/
html = html.replace(m[0],m.slice(1).join(''));
$(this).html(html);
});
+
}
jQuery.fn.href2delete = function(minus_one,minus_one_re) {