$(document).ready(function(){window.header=$(".dsr-header"),window.body=$(".dsr-body"),window.calculateBodyTop=function(){body.css("top",header.outerHeight())},calculateBodyTop(),$(".dsr-dropdown a").click(function(){$(this).next("ul").hasClass("dsr-dropdown-active")||$(".dsr-dropdown > ul").removeClass("dsr-dropdown-active"),$(this).next("ul").toggleClass("dsr-dropdown-active")}),$(".dsr-preview-toggle").click(function(){$(".dsr-preview, .dsr-tree-wrapper").toggleClass("dsr-preview-hidden")}),$(".dsr-path").click(function(){$(this).addClass("dsr-path-active"),$(this).find("input").select()}),$(".dsr-tree").jstree({plugins:["wholerow"]}),$(".dsr-wrapper").contextMenu({selector:".dsr-asset, .jstree-anchor, .dsr-path-input, tbody tr td a",callback:function(e,i){var d="clicked: "+e+" on "+$(this).text();window.console&&console.log(d)||alert(d)},items:{edit:{name:"Edit",icon:"edit"},cut:{name:"Cut",icon:"cut"},copy:{name:"Copy",icon:"copy"},paste:{name:"Paste",icon:"paste"},delete:{name:"Delete",icon:"delete"},sep1:"---------",quit:{name:"Quit",icon:function(e,i,d){return"context-menu-icon context-menu-icon-quit"}}}}),window.grid=$(".dsr-grid"),window.list=$(".dsr-list"),window.swichViewName=$(".switch-view-name"),$(".dsr-switch-grid").click(function(){window.grid.show(),window.list.hide(),$(".dsr-hide-grid").hide(),$(".dsr-show-grid").show(),window.swichViewName.html("Grid")}),$(".dsr-switch-list").click(function(){window.grid.hide(),window.list.show(),$(".dsr-hide-list").hide(),$(".dsr-show-list").show(),window.swichViewName.html("List")}),$(".dsr-show-grid-size").click(function(){window.grid.removeClass(),window.grid.addClass("dsr-content dsr-grid"),window.grid.addClass("dsr-grid-"+$(this).data("size"))})}),$(document).mouseup(function(e){var i=$(".dsr-path-active");0===i.has(e.target).length&&i.removeClass("dsr-path-active");var d=$(".dsr-dropdown-active");0===i.has(e.target).length&&d.removeClass("dsr-dropdown-active")}),$(window).resize(function(){calculateBodyTop()});