Sonarr/NzbDrone.Web/Scripts/2010.2.825/telerik.grid.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

2010-10-02 19:01:43 +00:00
(function(d){var a=d.telerik;var b=/"\\\/Date\((.*?)\)\\\/"/g;function c(e){return new Function("data",("var p=[];with(data){p.push('"+unescape(e).replace(/[\r\t\n]/g," ").replace(/'(?=[^#]*#>)/g,"\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g,"',$1,'").split("<#").join("');").split("#>").join("p.push('")+"');}return p.join('');"))}a.grid=function(f,g){this.element=f;this.groups=[];this.editing={};this.filterBy="";this.groupBy="";this.orderBy="";d.extend(this,g);this.sorted=d.grep(this.columns,function(i){return i.order});this.$tbody=d("> .t-grid-content > table tbody",f);this.scrollable=this.$tbody.length>0;if(!this.scrollable){this.$tbody=d("> table > tbody",f);this.$header=d("> table > thead tr",f);this.$footer=d("> table > tfoot .t-pager-wrapper",f)}else{this.$header=d("> .t-grid-header tr",f);this.$footer=d("> .t-grid-footer",f)}var l=this.$headerWrap=d("> .t-grid-header > .t-grid-header-wrap",f);d("> .t-grid-content",f).bind("scroll",function(){l.scrollLeft(this.scrollLeft)});this.$tbody.delegate(".t-hierarchy-cell .t-plus, .t-hierarchy-cell .t-minus","click",a.stopAll(function(o){var n=d(o.target);var m=n.hasClass("t-plus");n.toggleClass("t-minus",m).toggleClass("t-plus",!m);var i=n.closest("tr.t-master-row");if(this.detail&&!i.next().hasClass("t-detail-row")){d(new a.stringBuilder().cat('<tr class="t-detail-row">').rep('<td class="t-group-cell"></td>',i.find(".t-group-cell").length).cat('<td class="t-hierarchy-cell"></td>').cat('<td class="t-detail-cell" colspan="').cat(this.columns.length).cat('">').cat(this.displayDetails(this.dataItem(i))).cat("</td></tr>").string()).insertAfter(i)}a.trigger(this.element,m?"detailViewExpand":"detailViewCollapse",{masterRow:i[0],detailRow:i.next(".t-detail-row")[0]});i.next().toggle(m)},this));this.$pager=d("> .t-pager-wrapper .t-pager",f).add(this.$footer.find(".t-pager"));this.$pager.delegate(".t-state-disabled","click",a.preventDefault).delegate(".t-link:not(.t-state-disabled)","hover",function(){d(this).toggleClass("t-state-hover")}).delegate("input[type=text]","keydown",d.proxy(this.pagerKeyDown,this));this.$footer.add(d("> .t-pager-wrapper",f)).delegate(".t-refresh","click",d.proxy(this.refreshClick,this));d(f).delegate(".t-button","hover",a.stop(function(){d(this).toggleClass("t-button-hover")}));if(this.sort){this.$header.delegate(".t-link","hover",function(){d(this).toggleClass("t-state-hover")})}var e="tr:not(.t-grouping-row,.t-detail-row)";if(this.selectable){var k=this.$tbody[0];var j=this;this.$tbody.delegate(e,"click",function(i){if(this.parentNode==k){j.rowClick(i)}}).delegate(e,"hover",function(){if(this.parentNode==k){d(this).toggleClass("t-state-hover")}})}if(this.isAjax()){this.$pager.delegate(".t-link:not(.t-state-disabled)","click",a.stop(this.pagerClick,this));if(this.sort){this.$header.delegate(".t-link","click",a.stop(this.headerClick,this))}}for(var h=0;h<this.plugins.length;h++){a[this.plugins[h]].initialize(this)}a.bind(this,{columnResize:this.onColumnResize,"delete":this.onDelete,detailViewExpand:this.onDetailViewExpand,detailViewCollapse:this.onDetailViewCollapse,dataBinding:this.onDataBinding,dataBound:this.onDataBound,edit:this.onEdit,error:this.onError,load:this.onLoad,rowSelect:this.onRowSelect,rowDataBound:this.onRowDataBound,save:this.onSave});this.createColumnMappings()};a.grid.prototype={rowClick:function(h){var g=d(h.target);if(!g.is(":button,a,:input")){h.stopPropagation();var f=g.closest("tr").addClass("t-state-selected").siblings().removeClass("t-state-selected").end();a.trigger(this.element,"rowSelect",{row:f[0]})}},$rows:function(){return this.$tbody.find("> tr:not(.t-grouping-row,.t-detail-row)")},expandRow:function(e){d(e).find("> td .t-plus, > td .t-expand").click()},collapseRow:function(e){d(e).find("> td .t-minus, > td .t-collapse").click()},headerClick:function(f){f.preventDefault();this.toggleOrder(this.$columns().index(d(f.target).closest("th")));this.sort(this.sortExpr())},refreshClick:function(g,f){if(d(f).is(".t-loading")){return}if(this.isAjax()){g.preventDefault();this.ajaxRequest(true)}},sort:fun