You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Radarr/NzbDrone.Web/Scripts/2011.2.712/telerik.window.min.js

1 line
12 KiB

(function(d){var a=d.telerik;a.scripts.push("telerik.window.js");function c(e){return e&&!(/^([a-z]+:)?\/\//i).test(e)}function b(e){if(d.browser.msie&&d.browser.version<7){e.find(".t-resize-e,.t-resize-w").css("height",e.height()).end().find(".t-resize-n,.t-resize-s").css("width",e.width()).end().find(".t-overlay").css({width:e.width(),height:e.height()})}}a.fx.zoom=function(e){this.element=e};a.fx.zoom.prototype={play:function(h,f){var i=this.element.show();var g=i.find("> .t-window-content");var e={width:g.width(),height:g.height(),left:parseInt(i.css("left"))||0,top:parseInt(i.css("top"))||0};i.css({left:e.left+20,top:e.top+20}).animate({left:e.left,top:e.top},h.openDuration);g.css({width:e.width-40,height:e.height-40}).animate({width:e.width,height:e.height},h.openDuration,function(){if(f){f()}})},rewind:function(h,f){var i=this.element;var g=i.find("> .t-window-content");var e={width:g.width(),height:g.height(),left:parseInt(i.css("left")),top:parseInt(i.css("top"))};g.animate({width:e.width-40,height:e.height-40},h.closeDuration);i.animate({left:e.left+20,top:e.top+20},h.closeDuration,function(){i.css({left:e.left,top:e.top}).hide();setTimeout(function(){g.css({width:e.width,height:e.height})},0);if(f){f()}})}};a.fx.zoom.defaults=function(){return{list:[{name:"zoom"}],openDuration:"fast",closeDuration:"fast"}};a.window=function(g,h){this.element=g;var i=d(g);d.extend(this,h);if(!i.is(".t-window")){i.addClass("t-widget t-window");a.window.create(g,h)}if(!i.is("body")){var f;if(i.is(":visible")){f=i.offset();i.css({top:f.top,left:f.left})}else{i.css({visibility:"hidden",display:""});f=i.offset();i.css({top:f.top,left:f.left}).css({visibility:"visible",display:"none"})}i.toggleClass("t-rtl",i.closest(".t-rtl").length>0).appendTo(document.body)}if(this.modal){this.overlay(i.is(":visible")).css({opacity:0.5})}var e=".t-window-titlebar .t-link";i.delegate(e,"mouseenter",a.hover).delegate(e,"mouseleave",a.leave).delegate(e,"click",d.proxy(this.windowActionHandler,this));if(this.resizable){i.delegate(".t-window-titlebar","dblclick",d.proxy(this.toggleMaximization,this)).append(a.window.getResizeHandlesHtml());b(i);(function(k){function m(o){var n=d(k.element);k.initialCursorPosition=n.offset();k.resizeDirection=o.$draggable[0].className.replace("t-resize-handle t-resize-","").split("");k.resizeElement=n.find("> .t-window-content");k.initialSize={width:k.resizeElement.width(),height:k.resizeElement.height()};k.outlineSize={left:k.resizeElement.outerWidth()-k.resizeElement.width()+n.outerWidth()-n.width(),top:k.resizeElement.outerHeight()-k.resizeElement.height()+n.outerHeight()-n.height()+n.find("> .t-window-titlebar").outerHeight()};d('<div class="t-overlay" />').appendTo(k.element);n.find(".t-resize-handle").not(o.$draggable).hide();d(document.body).css("cursor",o.$draggable.css("cursor"))}function l(p){var o=d(k.element);var n={e:function(){var q=p.pageX-k.initialCursorPosition.left-k.outlineSize.left;k.resizeElement.width((q<k.minWidth?k.minWidth:(k.maxWidth&&q>k.maxWidth)?k.maxWidth:q))},s:function(){var q=p.pageY-k.initialCursorPosition.top-k.outlineSize.top;k.resizeElement.height((q<k.minHeight?k.minHeight:(k.maxHeight&&q>k.maxHeight)?k.maxHeight:q))},w:function(){var r=k.initialCursorPosition.left+k.initialSize.width;o.css("left",p.pageX>(r-k.minWidth)?r-k.minWidth:p.pageX<(r-k.maxWidth)?r-k.maxWidth:p.pageX);var q=r-p.pageX;k.resizeElement.width((q<k.minWidth?k.minWidth:(k.maxWidth&&q>k.maxWidth)?k.maxWidth:q))},n:function(){var q=k.initialCursorPosition.top+k.initialSize.height;o.css("top",p.pageY>(q-k.minHeight)?q-k.minHeight:p.pageY<(q-k.maxHeight)?q-k.maxHeight:p.pageY);var r=q-p.pageY;k.resizeElement.height((r<k.minHeight?k.minHeight:(k.maxHeight&&r>k.maxHeight)?k.maxHeight:r))}};d.each(k.resizeDirection,function(){n[this]()});b(o);if(d.browser.msie&&parseInt(d.browser.version)>=9){o[0].style.cssText=o[0].style.cssText}a.trigger(k.element,"resize")}function j(o){var n=d(k.element);n.find(".t-overlay").remove().end().find(".t-resize-handle").not(o.$draggable).show();d(document.body).css("cursor","");if(o.keyCode==27){b(n);n.css(k.initialCursorPosition);k.resizeElement.css(k.initialSize)}return false}new a.draggable({owner:k.element,selector:".t-resize-handle",scope:k.element.id+"-resizing",distance:0,start:m,drag:l,stop:j})})(this)}if(this.draggable){(function(k){function m(n){k.initialWindowPosition=d(k.element).position();k.startPosition={left:n.pageX-k.initialWindowPosition.left,top:n.pageY-k.initialWindowPosition.top};d(".t-resize-handle",k.element).hide();d('<div class="t-overlay" />').appendTo(k.element);d(document.body).css("cursor",n.$draggable.css("cursor"))}function l(o){var n={left:o.pageX-k.startPosition.left,top:Math.max(o.pageY-k.startPosition.top,0)};d(k.element).css(n)}function j(n){d(k.element).find(".t-resize-handle").show().end().find(".t-overlay").remove();d(document.body).css("cursor","");if(n.keyCode==27){n.$draggable.closest(".t-window").css(k.initialWindowPosition)}return false}new a.draggable({owner:k.element,selector:".t-window-titlebar",scope:k.element.id+"-moving",start:m,drag:l,stop:j})})(this)}a.bind(this,{open:this.onOpen,activated:this.onActivate,close:this.onClose,refresh:this.onRefresh,resize:this.onResize,error:this.onError,load:this.onLoad,move:this.onMove});d(window).resize(d.proxy(this.onDocumentResize,this));if(c(this.contentUrl)){this.ajaxRequest()}};a.window.prototype={overlay:function(e){var f=d("body > .t-overlay"),g=d(document);if(f.length==0){f=d('<div class="t-overlay" />').toggle(e).insertBefore(this.element)}else{f.insertBefore(this.element).toggle(e)}if(d.browser.msie&&d.browser.version<7){f.css({width:g.width()-21,height:g.height(),position:"absolute"})}return f},windowActionHandler:function(h){var g=d(h.target).closest(".t-link").find(".t-icon"),f=this;d.each({"t-close":this.close,"t-maximize":this.maximize,"t-restore":this.restore,"t-refresh":this.refresh},function(i,e){if(g.hasClass(i)){h.preventDefault();e.call(f);return false}})},center:function(){var g=d(this.element),e=d(window),f=d(document.body);g.css({left:e.scrollLeft()+f.scrollLeft()+Math.max(0,(e.width()-g.width())/2),top:e.scrollTop()+f.scrollTop()+Math.max(0,(e.height()-g.height())/2)});return this},title:function(f){var e=d(".t-window-titlebar > .t-window-title",this.element);if(!f){return e.text()}e.text(f);return this},content:function(e){var f=d("> .t-window-content",this.element);if(!e){return f.html()}f.html(e);return this},open:function(h){var f=d(this.element);if(!a.trigger(this.element,"open")){if(this.modal){var g=this.overlay(false);if(this.effects.list.length>0&&this.effects.list[0].name!="toggle"){g.css("opacity",0).show().animate({opacity:0.5},this.effects.openDuration)}else{g.css("opacity",0.5).show()}}if(!f.is(":visible")){a.fx.play(this.effects,f,{},function(){a.trigger(f[0],"activated")})}}if(this.isMaximized){d("html, body").css("overflow","hidden")}return this},close:function(){var h=d(this.element);if(h.is(":visible")){if(!a.trigger(this.element,"close")){var g=d(".t-window").filter(function(){var i=d(this);return i.is(":visible")&&i.data("tWindow").modal});var e=this.modal&&g.length==1;var f=this.modal?this.overlay(true):d(undefined);if(e){if(this.effects.list.length>0&&this.effects.list[0].name!="toggle"){f.animate({opacity:0},this.effects.closeDuration)}else{f.hide()}}else{if(g.length>0){g.eq(g.length-2).data("tWindow").overlay(true)}}a.fx.rewind(this.effects,h,null,function(){h.hide();if(e){f.hide()}})}}if(this.isMaximized){d("html, body").css("overflow","")}return this},toggleMaximization:function(f){if(f&&d(f.target).closest(".t-link").length>0){return}this[this.isMaximized?"restore":"maximize"]()},restore:function(){if(!this.isMaximized){return}d(this.element).css({position:"absolute",left:this.restorationSettings.left,top:this.restorationSettings.top}).find("> .t-window-content").css({width:this.restorationSettings.width,height:this.restorationSettings.height}).end().find(".t-resize-handle").show().end().find(".t-window-titlebar .t-restore").addClass("t-maximize").removeClass("t-restore");d("html, body").css("overflow","");this.isMaximized=false;a.trigger(this.element,"resize");return this},maximize:function(h){if(this.isMaximized){return}var f=d(this.element),g=f.find("> .t-window-content");this.restorationSettings={left:f.position().left,top:f.position().top,width:g.width(),height:g.height()};f.css({left:0,top:0,position:"fixed"}).find(".t-resize-handle").hide().end().find(".t-window-titlebar .t-maximize").addClass("t-restore").removeClass("t-maximize");d("html, body").css("overflow","hidden");this.isMaximized=true;this.onDocumentResize();return this},onDocumentResize:function(){if(!this.isMaximized){return}var e=d(this.element),f=e.find("> .t-window-content");f.css({width:d(window).width()-(f.outerWidth()-f.width()+e.outerWidth()-e.width()),height:d(window).height()-(f.outerHeight()-f.height()+e.outerHeight()-e.height()+e.find("> .t-window-titlebar").outerHeight())});b(e);a.trigger(e,"resize")},refresh:function(){if(c(this.contentUrl)){this.ajaxRequest()}return this},ajaxRequest:function(e){var g=setTimeout(function(){d(".t-refresh",this.element).addClass("t-loading")},100);var f={};d.ajax({type:"GET",url:e||this.contentUrl,dataType:"html",data:f,cache:false,error:d.proxy(function(i,h){if(a.ajaxError(this.element,"error",i,h)){return}},this),complete:function(){clearTimeout(g);d(".t-refresh",this.element).removeClass("t-loading")},success:d.proxy(function(h,i){d(".t-window-content",this.element).html(h);a.trigger(this.element,"refresh")},this)})},destroy:function(){d(this.element).remove();var f=d(".t-window").filter(function(){var g=d(this);return g.is(":visible")&&g.data("tWindow").modal});var e=this.modal&&f.length==0;if(e){this.overlay(false).remove()}else{if(f.length>0){f.eq(f.length-2).data("tWindow").overlay(true)}}}};d.extend(a.window,{create:function(){var f,g;if(d.isPlainObject(arguments[0])){g=arguments[0]}else{f=arguments[0];g=d.extend({html:f.innerHTML},arguments[1])}g=d.extend({title:"",html:"",actions:["Close"]},g);var e=new a.stringBuilder().catIf('<div class="t-widget t-window">',!f).cat('<div class="t-window-titlebar t-header">').cat('&nbsp;<span class="t-window-title">').cat(g.title).cat("</span>").cat('<div class="t-window-actions t-header">');d.map(g.actions,function(h){e.cat('<a href="#" class="t-link">').cat('<span class="t-icon t-').cat(h.toLowerCase()).cat('">').cat(h).cat("</span></a>")});e.cat("</div></div>").cat('<div class="t-window-content t-content" style="');if(g.width){e.cat("width:").cat(g.width).cat("px;")}if(g.height){e.cat("height:").cat(g.height).cat("px;")}if(typeof(g.scrollable)!="undefined"&&g.scrollable===false){e.cat("overflow:hidden;")}e.cat('">').catIf(g.html,!g.contentUrl||(g.contentUrl&&c(g.contentUrl))).catIf('<iframe src="',g.contentUrl,'" title="',g.title,'" frameborder="0" style="border:0;width:100%;height:100%;">This page requires frames in order to show content</iframe>',g.contentUrl&&!c(g.contentUrl)).cat("</div>").catIf("</div>",!f);if(f){d(f).html(e.string())}else{delete g.title;return d(e.string()).appendTo(document.body).tWindow(g)}},getResizeHandlesHtml:function(){var e=new a.stringBuilder();d.each("n e s w se sw ne nw".split(" "),function(f,g){e.cat('<div class="t-resize-handle t-resize-').cat(g).cat('"></div>')});return e.string()}});d.fn.tWindow=function(e){return a.create(this,{name:"tWindow",init:function(f,g){return new a.window(f,g)},success:function(h){var g=h.element,f=d(g);if(f.is(":visible")){a.trigger(g,"open");a.trigger(g,"activated")}},options:e})};d.fn.tWindow.defaults={effects:{list:[{name:"zoom"},{name:"property",properties:["opacity"]}],openDuration:"fast",closeDuration:"fast"},modal:false,resizable:true,draggable:true,minWidth:50,minHeight:50}})(jQuery);