diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-08-29 12:12:23 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-08-29 12:12:23 +0200 |
commit | 81de1c4b127e116c8ca3e5df620b5c0a56a087bc (patch) | |
tree | 45d4b4d22344c9588bd2e4e16be450a239a4e2cd /module/webui/themes/default/js | |
parent | [webui] Improve and fix (diff) | |
download | pyload-81de1c4b127e116c8ca3e5df620b5c0a56a087bc.tar.xz |
[webui] Improve and fix 2
Diffstat (limited to 'module/webui/themes/default/js')
-rw-r--r-- | module/webui/themes/default/js/filemanager.min.js | 1 | ||||
-rw-r--r-- | module/webui/themes/default/js/package.min.js | 1 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/admin.coffee (renamed from module/webui/themes/default/js/admin.coffee) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/admin.min.js (renamed from module/webui/themes/default/js/admin.min.js) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/base.coffee (renamed from module/webui/themes/default/js/base.coffee) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/base.min.js (renamed from module/webui/themes/default/js/base.min.js) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/filemanager.js (renamed from module/webui/themes/default/js/filemanager.js) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/package.js (renamed from module/webui/themes/default/js/package.js) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/settings.coffee (renamed from module/webui/themes/default/js/settings.coffee) | 0 | ||||
-rw-r--r-- | module/webui/themes/default/js/render/settings.min.js (renamed from module/webui/themes/default/js/settings.min.js) | 0 |
10 files changed, 0 insertions, 2 deletions
diff --git a/module/webui/themes/default/js/filemanager.min.js b/module/webui/themes/default/js/filemanager.min.js deleted file mode 100644 index d518e44ea..000000000 --- a/module/webui/themes/default/js/filemanager.min.js +++ /dev/null @@ -1 +0,0 @@ -function indicateLoad(){load.start("opacity",1)}function indicateFinish(){load.start("opacity",0)}function indicateSuccess(){indicateFinish(),notify.alert('{{_("Success")}}.',{className:"success"})}function indicateFail(){indicateFinish(),notify.alert('{{_("Failed")}}.',{className:"error"})}function show_rename_box(){bg_show(),$("rename_box").setStyle("display","block"),rename_box.start("opacity",1)}function hide_rename_box(){bg_hide(),rename_box.start("opacity",0).chain(function(){$("rename_box").setStyle("display","none")})}function show_confirm_box(){bg_show(),$("confirm_box").setStyle("display","block"),confirm_box.start("opacity",1)}function hide_confirm_box(){bg_hide(),confirm_box.start("opacity",0).chain(function(){$("confirm_box").setStyle("display","none")})}var load,rename_box,confirm_box;document.addEvent("domready",function(){load=new Fx.Tween($("load-indicator"),{link:"cancel"}),load.set("opacity",0),rename_box=new Fx.Tween($("rename_box")),confirm_box=new Fx.Tween($("confirm_box")),$("rename_reset").addEvent("click",function(){hide_rename_box()}),$("delete_reset").addEvent("click",function(){hide_confirm_box()})});var FilemanagerUI=new Class({initialize:function(e,t){this.url=e,this.type=t,this.directories=[],this.files=[],this.parseChildren()},parseChildren:function(){$("directories-list").getChildren("li.folder").each(function(e){var t=e.getElements("input.path")[0].get("value"),i=e.getElements("input.name")[0].get("value");this.directories.push(new Item(this,t,i,e))}.bind(this)),$("directories-list").getChildren("li.file").each(function(e){var t=e.getElements("input.path")[0].get("value"),i=e.getElements("input.name")[0].get("value");this.files.push(new Item(this,t,i,e))}.bind(this))}}),Item=new Class({initialize:function(e,t,i,n){this.ui=e,this.path=t,this.name=i,this.ele=n,this.directories=[],this.files=[],this.actions=new Array,this.actions["delete"]=this.del,this.actions.rename=this.rename,this.actions.mkdir=this.mkdir,this.parseElement();var s=this.ele.getElements("span")[0];this.buttons=new Fx.Tween(this.ele.getElements(".buttons")[0],{link:"cancel"}),this.buttons.set("opacity",0),s.addEvent("mouseenter",function(){this.buttons.start("opacity",1)}.bind(this)),s.addEvent("mouseleave",function(){this.buttons.start("opacity",0)}.bind(this))},parseElement:function(){this.ele.getChildren("span span.buttons img").each(function(e){e.addEvent("click",this.actions[e.className].bind(this))},this),this.ele.getElements("b")[0].addEvent("click",this.toggle.bind(this));var e=this.ele.getElements("ul");e.length>0&&(e[0].getChildren("li.folder").each(function(e){var t=e.getElements("input.path")[0].get("value"),i=e.getElements("input.name")[0].get("value");this.directories.push(new Item(this,t,i,e))}.bind(this)),e[0].getChildren("li.file").each(function(e){var t=e.getElements("input.path")[0].get("value"),i=e.getElements("input.name")[0].get("value");this.files.push(new Item(this,t,i,e))}.bind(this)))},reorderElements:function(){},del:function(e){$("confirm_form").removeEvents("submit"),$("confirm_form").addEvent("submit",this.deleteDirectory.bind(this)),$$("#confirm_form p").set("html",'{{_(("Are you sure you want to delete the selected item?"))}}'),show_confirm_box(),e.stop()},deleteDirectory:function(e){hide_confirm_box(),new Request.JSON({method:"POST",url:"/json/filemanager/delete",data:{path:this.path,name:this.name},onSuccess:function(e){if("success"==e.response){new Fx.Tween(this.ele).start("opacity",0);var t=this.ele.parentNode;if(this.ele.dispose(),!t.getChildren("li")[0]){var i=new Element("div",{html:'{{ _("Folder is empty") }}'});i.replaces(t)}indicateSuccess()}else indicateFail()}.bind(this),onFailure:indicateFail}).send(),e.stop()},rename:function(e){$("rename_form").removeEvents("submit"),$("rename_form").addEvent("submit",this.renameDirectory.bind(this)),$("path").set("value",this.path),$("old_name").set("value",this.name),$("new_name").set("value",this.name),show_rename_box(),e.stop()},renameDirectory:function(e){hide_rename_box(),new Request.JSON({method:"POST",url:"/json/filemanager/rename",onSuccess:function(e){"success"==e.response?(this.name=$("new_name").get("value"),this.ele.getElements("b")[0].set("html",$("new_name").get("value")),this.reorderElements(),indicateSuccess()):indicateFail()}.bind(this),onFailure:indicateFail}).send($("rename_form").toQueryString()),e.stop()},mkdir:function(e){new Request.JSON({method:"POST",url:"/json/filemanager/mkdir",data:{path:this.path+"/"+this.name,name:'{{_("New folder")}}'},onSuccess:function(e){"success"==e.response?(new Request.HTML({method:"POST",url:"/filemanager/get_dir",data:{path:e.path,name:e.name},onSuccess:function(t){var i=this.ele.getChildren("ul")[0];i||(this.ele.getChildren("div").dispose(),i=new Element("ul"),i.inject(this.ele,"bottom")),t[0].inject(i,"top"),this.directories.push(new Item(this.ui,e.path,e.name,i.firstChild))}.bind(this),onFailure:indicateFail}).send(),indicateSuccess()):indicateFail()}.bind(this),onFailure:indicateFail}).send(),e.stop()},toggle:function(){var e=this.ele.getElement("ul");null==e&&(e=this.ele.getElement("div")),null!=e&&("block"==e.getStyle("display")?e.dissolve():e.reveal())}});
\ No newline at end of file diff --git a/module/webui/themes/default/js/package.min.js b/module/webui/themes/default/js/package.min.js deleted file mode 100644 index fa12f7817..000000000 --- a/module/webui/themes/default/js/package.min.js +++ /dev/null @@ -1 +0,0 @@ -function indicateLoad(){root.load.start("opacity",1)}function indicateFinish(){root.load.start("opacity",0)}function indicateSuccess(){indicateFinish(),root.notify.alert('{{_("Success")}}.',{className:"success"})}function indicateFail(){indicateFinish(),root.notify.alert('{{_("Failed")}}.',{className:"error"})}var root=this;document.addEvent("domready",function(){root.load=new Fx.Tween($("load-indicator"),{link:"cancel"}),root.load.set("opacity",0),root.packageBox=new MooDialog({destroyOnHide:!1}),root.packageBox.setContent($("pack_box")),$("pack_reset").addEvent("click",function(){$("pack_form").reset(),root.packageBox.close()})});var PackageUI=new Class({initialize:function(e,t){this.url=e,this.type=t,this.packages=[],this.parsePackages(),this.sorts=new Sortables($("package-list"),{constrain:!1,clone:!0,revert:!0,opacity:.4,handle:".package_drag",onComplete:this.saveSort.bind(this)}),$("del_finished").addEvent("click",this.deleteFinished.bind(this)),$("restart_failed").addEvent("click",this.restartFailed.bind(this))},parsePackages:function(){$("package-list").getChildren("li").each(function(e){var t=e.getFirst().get("id").match(/[0-9]+/);this.packages.push(new Package(this,t,e))}.bind(this))},loadPackages:function(){},deleteFinished:function(){indicateLoad(),new Request.JSON({method:"get",url:"/api/deleteFinished",onSuccess:function(e){e.length>0?window.location.reload():(this.packages.each(function(e){e.close()}),indicateSuccess())}.bind(this),onFailure:indicateFail}).send()},restartFailed:function(){indicateLoad(),new Request.JSON({method:"get",url:"/api/restartFailed",onSuccess:function(){this.packages.each(function(e){e.close()}),indicateSuccess()}.bind(this),onFailure:indicateFail}).send()},startSort:function(){},saveSort:function(e){var t=[];this.sorts.serialize(function(i,s){i==e&&e.retrieve("order")!=s&&t.push(e.retrieve("pid")+"|"+s),i.store("order",s)}),t.length>0&&(indicateLoad(),new Request.JSON({method:"get",url:"/json/package_order/"+t[0],onSuccess:indicateFinish,onFailure:indicateFail}).send())}}),Package=new Class({initialize:function(e,t,i,s){this.ui=e,this.id=t,this.linksLoaded=!1,i?(this.ele=i,this.order=i.getElements("div.order")[0].get("html"),this.ele.store("order",this.order),this.ele.store("pid",this.id),this.parseElement()):this.createElement(s);var n=this.ele.getElements(".packagename")[0];this.buttons=new Fx.Tween(this.ele.getElements(".buttons")[0],{link:"cancel"}),this.buttons.set("opacity",0),n.addEvent("mouseenter",function(){this.buttons.start("opacity",1)}.bind(this)),n.addEvent("mouseleave",function(){this.buttons.start("opacity",0)}.bind(this))},createElement:function(){alert("create")},parseElement:function(){var e=this.ele.getElements("img");this.name=this.ele.getElements(".name")[0],this.folder=this.ele.getElements(".folder")[0],this.password=this.ele.getElements(".password")[0],e[1].addEvent("click",this.deletePackage.bind(this)),e[2].addEvent("click",this.restartPackage.bind(this)),e[3].addEvent("click",this.editPackage.bind(this)),e[4].addEvent("click",this.movePackage.bind(this)),this.ele.getElement(".packagename").addEvent("click",this.toggle.bind(this))},loadLinks:function(){indicateLoad(),new Request.JSON({method:"get",url:"/json/package/"+this.id,onSuccess:this.createLinks.bind(this),onFailure:indicateFail}).send()},createLinks:function(e){var t=$("sort_children_{id}".substitute({id:this.id}));t.set("html",""),e.links.each(function(e){e.id=e.fid;var i=new Element("li",{style:{"margin-left":0}}),s="<span style='cursor: move' class='child_status sorthandle'><img src='../img/{icon}' style='width: 12px; height:12px;'/></span>\n".substitute({icon:e.icon});s+="<span style='font-size: 15px'><a href=\"{url}\" target=\"_blank\">{name}</a></span><br /><div class='child_secrow'>".substitute({url:e.url,name:e.name}),s+="<span class='child_status'>{statusmsg}</span>{error} ".substitute({statusmsg:e.statusmsg,error:e.error}),s+="<span class='child_status'>{format_size}</span>".substitute({format_size:e.format_size}),s+="<span class='child_status'>{plugin}</span> ".substitute({plugin:e.plugin}),s+="<img title='{{_(\"Delete Link\")}}' style='cursor: pointer;' width='10px' height='10px' src='../img/delete.png' /> ",s+="<img title='{{_(\"Restart Link\")}}' style='cursor: pointer;margin-left: -4px' width='10px' height='10px' src='../img/arrow_refresh.png' /></div>";var n=new Element("div",{id:"file_"+e.id,"class":"child",html:s});i.store("order",e.order),i.store("lid",e.id),i.adopt(n),t.adopt(i)}),this.sorts=new Sortables(t,{constrain:!1,clone:!0,revert:!0,opacity:.4,handle:".sorthandle",onComplete:this.saveSort.bind(this)}),this.registerLinkEvents(),this.linksLoaded=!0,indicateFinish(),this.toggle()},registerLinkEvents:function(){this.ele.getElements(".child").each(function(e){var t=e.get("id").match(/[0-9]+/),i=e.getElements(".child_secrow img");i[0].addEvent("click",function(){new Request({method:"get",url:"/api/deleteFiles/["+this+"]",onSuccess:function(){$("file_"+this).nix()}.bind(this),onFailure:indicateFail}).send()}.bind(t)),i[1].addEvent("click",function(){new Request({method:"get",url:"/api/restartFile/"+this,onSuccess:function(){var e=$("file_"+this),t=e.getElements("img");t[0].set("src","../img/status_queue.png");var i=e.getElements(".child_status");i[1].set("html","queued"),indicateSuccess()}.bind(this),onFailure:indicateFail}).send()}.bind(t))})},toggle:function(){var e=this.ele.getElement(".children");"block"==e.getStyle("display")?e.dissolve():this.linksLoaded?e.reveal():this.loadLinks()},deletePackage:function(e){indicateLoad(),new Request({method:"get",url:"/api/deletePackages/["+this.id+"]",onSuccess:function(){this.ele.nix(),indicateFinish()}.bind(this),onFailure:indicateFail}).send(),e.stop()},restartPackage:function(e){indicateLoad(),new Request({method:"get",url:"/api/restartPackage/"+this.id,onSuccess:function(){this.close(),indicateSuccess()}.bind(this),onFailure:indicateFail}).send(),e.stop()},close:function(){var e=this.ele.getElement(".children");"block"==e.getStyle("display")&&e.dissolve();var t=$("sort_children_{id}".substitute({id:this.id}));t.erase("html"),this.linksLoaded=!1},movePackage:function(e){indicateLoad(),new Request({method:"get",url:"/json/move_package/"+(this.ui.type+1)%2+"/"+this.id,onSuccess:function(){this.ele.nix(),indicateFinish()}.bind(this),onFailure:indicateFail}).send(),e.stop()},editPackage:function(e){$("pack_form").removeEvents("submit"),$("pack_form").addEvent("submit",this.savePackage.bind(this)),$("pack_id").set("value",this.id),$("pack_name").set("value",this.name.get("text")),$("pack_folder").set("value",this.folder.get("text")),$("pack_pws").set("value",this.password.get("text")),root.packageBox.open(),e.stop()},savePackage:function(e){$("pack_form").send(),this.name.set("text",$("pack_name").get("value")),this.folder.set("text",$("pack_folder").get("value")),this.password.set("text",$("pack_pws").get("value")),root.packageBox.close(),e.stop()},saveSort:function(e){var t=[];this.sorts.serialize(function(i,s){i==e&&e.retrieve("order")!=s&&t.push(e.retrieve("lid")+"|"+s),i.store("order",s)}),t.length>0&&(indicateLoad(),new Request.JSON({method:"get",url:"/json/link_order/"+t[0],onSuccess:indicateFinish,onFailure:indicateFail}).send())}});
\ No newline at end of file diff --git a/module/webui/themes/default/js/admin.coffee b/module/webui/themes/default/js/render/admin.coffee index 5afbcbb66..5afbcbb66 100644 --- a/module/webui/themes/default/js/admin.coffee +++ b/module/webui/themes/default/js/render/admin.coffee diff --git a/module/webui/themes/default/js/admin.min.js b/module/webui/themes/default/js/render/admin.min.js index 94a5e494d..94a5e494d 100644 --- a/module/webui/themes/default/js/admin.min.js +++ b/module/webui/themes/default/js/render/admin.min.js diff --git a/module/webui/themes/default/js/base.coffee b/module/webui/themes/default/js/render/base.coffee index 07b8bfb6f..07b8bfb6f 100644 --- a/module/webui/themes/default/js/base.coffee +++ b/module/webui/themes/default/js/render/base.coffee diff --git a/module/webui/themes/default/js/base.min.js b/module/webui/themes/default/js/render/base.min.js index 1ba1d73f9..1ba1d73f9 100644 --- a/module/webui/themes/default/js/base.min.js +++ b/module/webui/themes/default/js/render/base.min.js diff --git a/module/webui/themes/default/js/filemanager.js b/module/webui/themes/default/js/render/filemanager.js index f1ebed93f..f1ebed93f 100644 --- a/module/webui/themes/default/js/filemanager.js +++ b/module/webui/themes/default/js/render/filemanager.js diff --git a/module/webui/themes/default/js/package.js b/module/webui/themes/default/js/render/package.js index 659a8e6fc..659a8e6fc 100644 --- a/module/webui/themes/default/js/package.js +++ b/module/webui/themes/default/js/render/package.js diff --git a/module/webui/themes/default/js/settings.coffee b/module/webui/themes/default/js/render/settings.coffee index d522741b9..d522741b9 100644 --- a/module/webui/themes/default/js/settings.coffee +++ b/module/webui/themes/default/js/render/settings.coffee diff --git a/module/webui/themes/default/js/settings.min.js b/module/webui/themes/default/js/render/settings.min.js index 41d1cb25a..41d1cb25a 100644 --- a/module/webui/themes/default/js/settings.min.js +++ b/module/webui/themes/default/js/render/settings.min.js |