Files
librenms-librenms/html/js/jquery.bootgrid.min.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

7 lines
23 KiB
JavaScript
Raw Normal View History

/*!
* jQuery Bootgrid v1.3.1 - 09/11/2015
* Copyright (c) 2014-2015 Rafael Staib (http://www.jquery-bootgrid.com)
* Licensed under MIT http://www.opensource.org/licenses/MIT
*/
!function(t,e,i){"use strict";function s(t){var e=this;return!this.rows.contains(function(i){return e.identifier&&i[e.identifier]===t[e.identifier]})&&(this.rows.push(t),!0)}function n(e){var i=this.footer?this.footer.find(e):t(),s=this.header?this.header.find(e):t();return t.merge(i,s)}function o(e){return e?t.extend({},this.cachedParams,{ctx:e}):this.cachedParams}function r(){var e={current:this.current,rowCount:this.rowCount,sort:this.sortDictionary,searchPhrase:this.searchPhrase},i=this.options.post;return i=t.isFunction(i)?i():i,this.options.requestHandler(t.extend(!0,e,i))}function l(e){return"."+t.trim(e).replace(/\s+/gm,".")}function a(){var e=this.options.url;return t.isFunction(e)?e():e}function c(){this.element.trigger("initialize"+M),u.call(this),this.selection=this.options.selection&&null!=this.identifier,f.call(this),v.call(this),_.call(this),S.call(this),m.call(this),p.call(this),this.element.trigger("initialized"+M)}function h(t){this.options.highlightRows}function d(t){return t.visible}function u(){var e=this,i=!1;this.element.find("thead > tr").first().children().each(function(){var s=t(this),n=s.data(),o={id:n.columnId,identifier:null==e.identifier&&n.identifier||!1,converter:e.options.converters[n.converter||n.type]||e.options.converters.string,text:s.text(),align:n.align||"left",headerAlign:n.headerAlign||"left",cssClass:n.cssClass||"",headerCssClass:n.headerCssClass||"",formatter:e.options.formatters[n.formatter]||null,order:i||"asc"!==n.order&&"desc"!==n.order?null:n.order,searchable:!(!1===n.searchable),sortable:!(!1===n.sortable),visible:!(!1===n.visible),visibleInSelection:!(!1===n.visibleInSelection),width:t.isNumeric(n.width)?n.width+"px":"string"==typeof n.width?n.width:null};e.columns.push(o),null!=o.order&&(e.sortDictionary[o.id]=o.order),o.identifier&&(e.identifier=o.id,e.converter=o.converter),e.options.multiSort||null===o.order||(i=!0)})}function p(){function i(t,e){s.currentRows=t,g.call(s,e),s.options.keepSelection||(s.selectedRows=[]),A.call(s,t),w.call(s),x.call(s),s.element._bgBusyAria(!1).trigger("loaded"+M)}var s=this;if(this.element._bgBusyAria(!0).trigger("load"+M),B.call(this),this.options.ajax){var n=r.call(this),o=a.call(this);if(null==o||"string"!=typeof o||0===o.length)throw new Error("Url setting must be a none empty string or a function that returns one.");this.xqr&&this.xqr.abort();var l={url:o,data:n,success:function(e){s.xqr=null,"string"==typeof e&&(e=t.parseJSON(e)),e=s.options.responseHandler(e),s.current=e.current,i(e.rows,e.total)},error:function(t,e,i){s.xqr=null,"abort"!==e&&(y.call(s),s.element._bgBusyAria(!1).trigger("loaded"+M))}};l=t.extend(this.options.ajaxSettings,l),this.xqr=t.ajax(l)}else{var c=this.searchPhrase.length>0?this.rows.where(function(t){for(var e,i=new RegExp(s.searchPhrase,s.options.caseSensitive?"g":"gi"),n=0;n<s.columns.length;n++)if((e=s.columns[n]).searchable&&e.visible&&e.converter.to(t[e.id]).search(i)>-1)return!0;return!1}):this.rows,h=c.length;-1!==this.rowCount&&(c=c.page(this.current,this.rowCount)),e.setTimeout(function(){i(c,h)},10)}}function f(){if(!this.options.ajax){var e=this;this.element.find("tbody > tr").each(function(){var i=t(this).children("td"),n={};t.each(e.columns,function(t,e){n[e.id]=e.converter.from(i.eq(t).text())}),s.call(e,n)}),g.call(this,this.rows.length),j.call(this)}}function g(t){this.total=t,this.totalPages=-1===this.rowCount?1:Math.ceil(this.total/this.rowCount)}function v(){var e=this.options.templates,i=this.element.parent().hasClass(this.options.css.responsiveTable)?this.element.parent():this.element;this.element.addClass(this.options.css.table),0===this.element.children("tbody").length&&this.element.append(e.body),1&this.options.navigation&&(this.header=t(e.header.resolve(o.call(this,{id:this.element._bgId()+"-header"}))),i.before(this.header)),2&this.options.navigation&&(this.footer=t(e.footer.resolve(o.call(this,{id:this.element._bgId()+"-footer"}))),i.after(this.footer))}function m(){if(0!==this.options.navigation){var e=this.options.css,i=l(e.actions),s=n.call(this,i);if(s.length>0){var r=this,a