/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.js |
@@ -0,0 +1,84 @@ |
/** |
* @author: Alec Fenichel |
* @webSite: https://fenichelar.com |
* @version: v1.0.0 |
*/ |
|
(function ($) { |
|
'use strict'; |
|
$.extend($.fn.bootstrapTable.defaults, { |
autoRefresh: false, |
autoRefreshInterval: 60, |
autoRefreshSilent: true, |
autoRefreshStatus: true, |
autoRefreshFunction: null |
}); |
|
$.extend($.fn.bootstrapTable.defaults.icons, { |
autoRefresh: 'glyphicon-time icon-time' |
}); |
|
$.extend($.fn.bootstrapTable.locales, { |
formatAutoRefresh: function() { |
return 'Auto Refresh'; |
} |
}); |
|
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales); |
|
var BootstrapTable = $.fn.bootstrapTable.Constructor; |
var _init = BootstrapTable.prototype.init; |
var _initToolbar = BootstrapTable.prototype.initToolbar; |
var sprintf = $.fn.bootstrapTable.utils.sprintf; |
|
BootstrapTable.prototype.init = function () { |
_init.apply(this, Array.prototype.slice.apply(arguments)); |
|
if (this.options.autoRefresh && this.options.autoRefreshStatus) { |
var that = this; |
this.options.autoRefreshFunction = setInterval(function () { |
that.refresh({silent: that.options.autoRefreshSilent}); |
}, this.options.autoRefreshInterval*1000); |
} |
}; |
|
BootstrapTable.prototype.initToolbar = function() { |
_initToolbar.apply(this, Array.prototype.slice.apply(arguments)); |
|
if (this.options.autoRefresh) { |
var $btnGroup = this.$toolbar.find('>.btn-group'); |
var $btnAutoRefresh = $btnGroup.find('.auto-refresh'); |
|
if (!$btnAutoRefresh.length) { |
$btnAutoRefresh = $([ |
sprintf('<button class="btn btn-default auto-refresh %s" ', this.options.autoRefreshStatus ? 'enabled' : ''), |
'type="button" ', |
sprintf('title="%s">', this.options.formatAutoRefresh()), |
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.autoRefresh), |
'</button>' |
].join('')).appendTo($btnGroup); |
|
$btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this)); |
} |
} |
}; |
|
BootstrapTable.prototype.toggleAutoRefresh = function() { |
if (this.options.autoRefresh) { |
if (this.options.autoRefreshStatus) { |
clearInterval(this.options.autoRefreshFunction); |
this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled'); |
} else { |
var that = this; |
this.options.autoRefreshFunction = setInterval(function () { |
that.refresh({silent: that.options.autoRefreshSilent}); |
}, this.options.autoRefreshInterval*1000); |
this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled'); |
} |
this.options.autoRefreshStatus = !this.options.autoRefreshStatus; |
} |
}; |
|
})(jQuery); |
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/dist/extensions/auto-refresh/bootstrap-table-auto-refresh.min.js |
@@ -0,0 +1,7 @@ |
/* |
* bootstrap-table - v1.11.1 - 2017-02-22 |
* https://github.com/wenzhixin/bootstrap-table |
* Copyright (c) 2017 zhixin wen |
* Licensed MIT License |
*/ |
!function(a){"use strict";a.extend(a.fn.bootstrapTable.defaults,{autoRefresh:!1,autoRefreshInterval:60,autoRefreshSilent:!0,autoRefreshStatus:!0,autoRefreshFunction:null}),a.extend(a.fn.bootstrapTable.defaults.icons,{autoRefresh:"glyphicon-time icon-time"}),a.extend(a.fn.bootstrapTable.locales,{formatAutoRefresh:function(){return"Auto Refresh"}}),a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales);var b=a.fn.bootstrapTable.Constructor,c=b.prototype.init,d=b.prototype.initToolbar,e=a.fn.bootstrapTable.utils.sprintf;b.prototype.init=function(){if(c.apply(this,Array.prototype.slice.apply(arguments)),this.options.autoRefresh&&this.options.autoRefreshStatus){var a=this;this.options.autoRefreshFunction=setInterval(function(){a.refresh({silent:a.options.autoRefreshSilent})},1e3*this.options.autoRefreshInterval)}},b.prototype.initToolbar=function(){if(d.apply(this,Array.prototype.slice.apply(arguments)),this.options.autoRefresh){var b=this.$toolbar.find(">.btn-group"),c=b.find(".auto-refresh");c.length||(c=a([e('<button class="btn btn-default auto-refresh %s" ',this.options.autoRefreshStatus?"enabled":""),'type="button" ',e('title="%s">',this.options.formatAutoRefresh()),e('<i class="%s %s"></i>',this.options.iconsPrefix,this.options.icons.autoRefresh),"</button>"].join("")).appendTo(b),c.on("click",a.proxy(this.toggleAutoRefresh,this)))}},b.prototype.toggleAutoRefresh=function(){if(this.options.autoRefresh){if(this.options.autoRefreshStatus)clearInterval(this.options.autoRefreshFunction),this.$toolbar.find(">.btn-group").find(".auto-refresh").removeClass("enabled");else{var a=this;this.options.autoRefreshFunction=setInterval(function(){a.refresh({silent:a.options.autoRefreshSilent})},1e3*this.options.autoRefreshInterval),this.$toolbar.find(">.btn-group").find(".auto-refresh").addClass("enabled")}this.options.autoRefreshStatus=!this.options.autoRefreshStatus}}}(jQuery); |