UNPKG

alinator

Version:

Gera uma tabela de projetores alocados por professor do dia corrente.

2 lines 4.72 kB
//colResizable 1.4 Alvaro Prieto Lauroba http://bacubacu.com/colresizable (function(e){var t=e(document);var n=e("head");var r=null;var i=[];var s=0;var o="id";var u="px";var a="JColResizer";var f=parseInt;var l=Math;var c=navigator.userAgent.indexOf("Trident/4.0")>0;var h;try{h=sessionStorage}catch(p){}n.append("<style type='text/css'> .JColResizer{table-layout:fixed;} .JColResizer td, .JColResizer th{overflow:hidden;padding-left:0!important; padding-right:0!important;} .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{margin-left:-5px; position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black; }</style>");var d=function(t,n){var r=e(t);if(n.disable)return v(r);var u=r.id=r.attr(o)||a+s++;r.p=n.postbackSafe;if(!r.is("table")||i[u])return;r.addClass(a).attr(o,u).before('<div class="JCLRgrips"/>');r.opt=n;r.g=[];r.c=[];r.w=r.width();r.gc=r.prev();if(n.marginLeft)r.gc.css("marginLeft",n.marginLeft);if(n.marginRight)r.gc.css("marginRight",n.marginRight);r.cs=f(c?t.cellSpacing||t.currentStyle.borderSpacing:r.css("border-spacing"))||2;r.b=f(c?t.border||t.currentStyle.borderLeftWidth:r.css("border-left-width"))||1;i[u]=r;m(r)};var v=function(e){var t=e.attr(o),e=i[t];if(!e||!e.is("table"))return;e.removeClass(a).gc.remove();delete i[t]};var m=function(t){var n=t.find(">thead>tr>th,>thead>tr>td");if(!n.length)n=t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td");t.cg=t.find("col");t.ln=n.length;if(t.p&&h&&h[t.id])g(t,n);n.each(function(n){var r=e(this);var i=e(t.gc.append('<div class="JCLRgrip"></div>')[0].lastChild);i.t=t;i.i=n;i.c=r;r.w=r.width();t.g.push(i);t.c.push(r);r.width(r.w).removeAttr("width");if(n<t.ln-1){i.bind("touchstart mousedown",S).append(t.opt.gripInnerHtml).append('<div class="'+a+'" style="cursor:'+t.opt.hoverCursor+'"></div>')}else i.addClass("JCLRLastGrip").removeClass("JCLRgrip");i.data(a,{i:n,t:t.attr(o)})});t.cg.removeAttr("width");y(t);t.find("td, th").not(n).not("table th, table td").each(function(){e(this).removeAttr("width")})};var g=function(e,t){var n,r=0,i=0,s=[];if(t){e.cg.removeAttr("width");if(e.opt.flush){h[e.id]="";return}n=h[e.id].split(";");for(;i<e.ln;i++){s.push(100*n[i]/n[e.ln]+"%");t.eq(i).css("width",s[i])}for(i=0;i<e.ln;i++)e.cg.eq(i).css("width",s[i])}else{h[e.id]="";for(;i<e.c.length;i++){n=e.c[i].width();h[e.id]+=n+";";r+=n}h[e.id]+=r}};var y=function(e){e.gc.width(e.w);for(var t=0;t<e.ln;t++){var n=e.c[t];e.g[t].css({left:n.offset().left-e.offset().left+n.outerWidth(false)+e.cs/2+u,height:e.opt.headerOnly?e.c[0].outerHeight(false):e.outerHeight(false)})}};var b=function(e,t,n){var i=r.x-r.l,s=e.c[t],o=e.c[t+1];var a=s.w+i;var f=o.w-i;s.width(a+u);o.width(f+u);e.cg.eq(t).width(a+u);e.cg.eq(t+1).width(f+u);if(n){s.w=a;o.w=f}};var w=function(e){if(!r)return;var t=r.t;if(e.originalEvent.touches){var n=e.originalEvent.touches[0].pageX-r.ox+r.l}else{var n=e.pageX-r.ox+r.l}var i=t.opt.minWidth,s=r.i;var o=t.cs*1.5+i+t.b;var a=s==t.ln-1?t.w-o:t.g[s+1].position().left-t.cs-i;var f=s?t.g[s-1].position().left+t.cs+i:o;n=l.max(f,l.min(a,n));r.x=n;r.css("left",n+u);if(t.opt.liveDrag){b(t,s);y(t);var c=t.opt.onDrag;if(c){e.currentTarget=t[0];c(e)}}return false};var E=function(n){t.unbind("touchend."+a+" mouseup."+a).unbind("touchmove."+a+" mousemove."+a);e("head :last-child").remove();if(!r)return;r.removeClass(r.t.opt.draggingClass);var i=r.t;var s=i.opt.onResize;if(r.x){b(i,r.i,true);y(i);if(s){n.currentTarget=i[0];s(n)}}if(i.p&&h)g(i);r=null};var S=function(s){var o=e(this).data(a);var u=i[o.t],f=u.g[o.i];if(s.originalEvent.touches){f.ox=s.originalEvent.touches[0].pageX}else{f.ox=s.pageX}f.l=f.position().left;t.bind("touchmove."+a+" mousemove."+a,w).bind("touchend."+a+" mouseup."+a,E);n.append("<style type='text/css'>*{cursor:"+u.opt.dragCursor+"!important}</style>");f.addClass(u.opt.draggingClass);r=f;if(u.c[o.i].l)for(var l=0,c;l<u.ln;l++){c=u.c[l];c.l=false;c.w=c.width()}return false};var x=function(){for(e in i){var e=i[e],t,n=0;e.removeClass(a);if(e.w!=e.width()){e.w=e.width();for(t=0;t<e.ln;t++)n+=e.c[t].w;for(t=0;t<e.ln;t++)e.c[t].css("width",l.round(1e3*e.c[t].w/n)/10+"%").l=true}y(e.addClass(a))}};e(window).bind("resize."+a,x);e.fn.extend({colResizable:function(t){var n={draggingClass:"JCLRgripDrag",gripInnerHtml:"",liveDrag:false,minWidth:15,headerOnly:false,hoverCursor:"e-resize",dragCursor:"e-resize",postbackSafe:false,flush:false,marginLeft:null,marginRight:null,disable:false,onDrag:null,onResize:null};var t=e.extend(n,t);return this.each(function(){d(this,t)})}})})(jQuery)