From e1dd70b5d84a23a075966cd5b73fcc81a13ee6c8 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@users.noreply.github.com>
Date: Tue, 12 May 2015 03:16:20 +0200
Subject: Code cleanup for Next theme

---
 pyload/webui/themes/Next/css/MooDialog.css  |  98 +++++------
 pyload/webui/themes/Next/js/base.coffee     |   2 +-
 pyload/webui/themes/Next/js/filemanager.js  | 254 ++++++++++++++--------------
 pyload/webui/themes/Next/js/package.js      |   4 +-
 pyload/webui/themes/Next/js/settings.coffee |   2 +-
 5 files changed, 180 insertions(+), 180 deletions(-)

(limited to 'pyload/webui/themes/Next')

diff --git a/pyload/webui/themes/Next/css/MooDialog.css b/pyload/webui/themes/Next/css/MooDialog.css
index ad2583b4b..d7c827e13 100644
--- a/pyload/webui/themes/Next/css/MooDialog.css
+++ b/pyload/webui/themes/Next/css/MooDialog.css
@@ -1,92 +1,92 @@
 /* Created by Arian Stolwijk <http://www.aryweb.nl> */
 
 .MooDialog {
-/*	position: fixed;*/
+/*  position: fixed;*/
     margin: 0 auto 0 -350px;
     width:600px;
     padding:14px;
     left:50%;
     top: 100px;
 
-	position: absolute;
-	left: 50%;
-	z-index: 50000;
+    position: absolute;
+    left: 50%;
+    z-index: 50000;
 
-	background: #fff;
-	color: black;
-	border-radius: 7px;
-	-moz-border-radius: 7px;
-	-webkit-border-radius: 7px;
-	border-radius: 7px;
-	-moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
-	-webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
-	box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
+    background: #fff;
+    color: black;
+    border-radius: 7px;
+    -moz-border-radius: 7px;
+    -webkit-border-radius: 7px;
+    border-radius: 7px;
+    -moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
+    -webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
+    box-shadow: 1px 1px 5px rgba(0,0,0,0.8);
 }
 
 .MooDialogTitle {
-	padding-top: 30px;
+    padding-top: 30px;
 }
 
 .MooDialog .title {
-	position: absolute;
-	top: 0;
-	left: 0;
-	right: 0;
-	padding: 3px 20px;
-	background: #b7c4dc;
-	border-bottom: 1px solid #a1aec5;
-	font-weight: bold;
-	text-shadow: 1px 1px 0 #fff;
-	color: black;
-	border-radius: 7px;
-	-moz-border-radius: 7px;
-	-webkit-border-radius: 7px;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    padding: 3px 20px;
+    background: #b7c4dc;
+    border-bottom: 1px solid #a1aec5;
+    font-weight: bold;
+    text-shadow: 1px 1px 0 #fff;
+    color: black;
+    border-radius: 7px;
+    -moz-border-radius: 7px;
+    -webkit-border-radius: 7px;
 }
 
 .MooDialog .close {
-	background: url(../lib/MooTools/MooDialog/css/dialog-close.png) no-repeat;
-	width: 16px;
-	height: 16px;
-	display: block;
-	cursor: pointer;
-	top: -5px;
-	left: -5px;
-	position: absolute;
+    background: url(../lib/MooTools/MooDialog/css/dialog-close.png) no-repeat;
+    width: 16px;
+    height: 16px;
+    display: block;
+    cursor: pointer;
+    top: -5px;
+    left: -5px;
+    position: absolute;
 }
 
 .MooDialog .buttons {
-	text-align: right;
-	margin: 0;
-	padding: 0;
-	border: 0;
-	background: none;
+    text-align: right;
+    margin: 0;
+    padding: 0;
+    border: 0;
+    background: none;
 }
 
 .MooDialog .iframe {
-	width: 100%;
-	height: 100%;
+    width: 100%;
+    height: 100%;
 }
 
 .MooDialog .textInput {
-	width: 200px;
-	float: left;
+    width: 200px;
+    float: left;
 }
 
 .MooDialog .MooDialogAlert,
 .MooDialog .MooDialogConfirm,
 .MooDialog .MooDialogPrompt,
 .MooDialog .MooDialogError {
-	background: url(../lib/MooTools/MooDialog/css/dialog-warning.png) no-repeat;
-	padding-left: 40px;
-	min-height: 40px;
+    background: url(../lib/MooTools/MooDialog/css/dialog-warning.png) no-repeat;
+    padding-left: 40px;
+    min-height: 40px;
 }
 
 .MooDialog .MooDialogConfirm,
 .MooDialog .MooDialogPromt {
-	background: url(../lib/MooTools/MooDialog/css/dialog-question.png) no-repeat;
+    background: url(../lib/MooTools/MooDialog/css/dialog-question.png) no-repeat;
 }
 
 .MooDialog .MooDialogError {
-	background: url(../lib/MooTools/MooDialog/css/dialog-error.png) no-repeat;
+    background: url(../lib/MooTools/MooDialog/css/dialog-error.png) no-repeat;
 }
 
diff --git a/pyload/webui/themes/Next/js/base.coffee b/pyload/webui/themes/Next/js/base.coffee
index 3b5d33e82..f58c1e4cf 100644
--- a/pyload/webui/themes/Next/js/base.coffee
+++ b/pyload/webui/themes/Next/js/base.coffee
@@ -165,7 +165,7 @@ submit_captcha = ->
     $('cap_result').set('value', '')
     false
 
-on_captcha_click = (e) -> 
+on_captcha_click = (e) ->
     position = e.target.getPosition()
     x = e.page.x - position.x
     y = e.page.y - position.y
diff --git a/pyload/webui/themes/Next/js/filemanager.js b/pyload/webui/themes/Next/js/filemanager.js
index ed64ab69d..32c225e4a 100644
--- a/pyload/webui/themes/Next/js/filemanager.js
+++ b/pyload/webui/themes/Next/js/filemanager.js
@@ -12,12 +12,12 @@ document.addEvent("domready", function() {
     $('delete_reset').addEvent('click', function() {
         hide_confirm_box()
     });
-        
+
     /*$('filemanager_actions_list').getChildren("li").each(function(action) {
       var action_name = action.className;
       if(functions[action.className] != undefined)
       {
-	action.addEvent('click', functions[action.className]);
+    action.addEvent('click', functions[action.className]);
       }
     });*/
 });
@@ -76,7 +76,7 @@ var FilemanagerUI = new Class({
         this.url = url;
         this.type = type;
         this.directories = [];
-	this.files = [];
+    this.files = [];
         this.parseChildren();
     },
 
@@ -86,8 +86,8 @@ var FilemanagerUI = new Class({
             var name = ele.getElements("input.name")[0].get("value");
             this.directories.push(new Item(this, path, name, ele))
         }.bind(this));
-	
-	$("directories-list").getChildren("li.file").each(function(ele) {
+
+    $("directories-list").getChildren("li.file").each(function(ele) {
             var path = ele.getElements("input.path")[0].get("value");
             var name = ele.getElements("input.name")[0].get("value");
             this.files.push(new Item(this, path, name, ele))
@@ -98,17 +98,17 @@ var FilemanagerUI = new Class({
 var Item = new Class({
     initialize: function(ui, path, name, ele) {
         this.ui = ui;
-	this.path = path;
-	this.name = name;
+    this.path = path;
+    this.name = name;
         this.ele = ele;
-	this.directories = [];
-	this.files = [];
-	this.actions = new Array();
-	this.actions["delete"] = this.del;
-	this.actions["rename"] = this.rename;
-	this.actions["mkdir"] = this.mkdir;
+    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 pname = this.ele.getElements("span")[0];
         this.buttons = new Fx.Tween(this.ele.getElements(".buttons")[0], {link: "cancel"});
         this.buttons.set("opacity", 0);
@@ -125,167 +125,167 @@ var Item = new Class({
 
     parseElement: function() {
         this.ele.getChildren('span span.buttons img').each(function(img) {
-	  img.addEvent('click', this.actions[img.className].bind(this));
-	}, this);
-
-	//click on the directory name must open the directory itself
-	this.ele.getElements('b')[0].addEvent('click', this.toggle.bind(this));
-	
-	//iterate over child directories
-	var uls = this.ele.getElements('ul');
-	if(uls.length > 0)
-	{
-	  uls[0].getChildren("li.folder").each(function(fld) {
-	    var path = fld.getElements("input.path")[0].get("value");
-	    var name = fld.getElements("input.name")[0].get("value");
-	    this.directories.push(new Item(this, path, name, fld));
-	  }.bind(this));
-	  uls[0].getChildren("li.file").each(function(fld) {
-	    var path = fld.getElements("input.path")[0].get("value");
-	    var name = fld.getElements("input.name")[0].get("value");
-	    this.files.push(new Item(this, path, name, fld));
-	  }.bind(this));
-	}
+      img.addEvent('click', this.actions[img.className].bind(this));
+    }, this);
+
+    //click on the directory name must open the directory itself
+    this.ele.getElements('b')[0].addEvent('click', this.toggle.bind(this));
+
+    //iterate over child directories
+    var uls = this.ele.getElements('ul');
+    if(uls.length > 0)
+    {
+      uls[0].getChildren("li.folder").each(function(fld) {
+        var path = fld.getElements("input.path")[0].get("value");
+        var name = fld.getElements("input.name")[0].get("value");
+        this.directories.push(new Item(this, path, name, fld));
+      }.bind(this));
+      uls[0].getChildren("li.file").each(function(fld) {
+        var path = fld.getElements("input.path")[0].get("value");
+        var name = fld.getElements("input.name")[0].get("value");
+        this.files.push(new Item(this, path, name, fld));
+      }.bind(this));
+    }
     },
 
     reorderElements: function() {
       //TODO sort the main ul again (to keep data ordered after renaming something)
     },
-    
+
     del: function(event) {
         $("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?"))}}');
-	
+    $$("#confirm_form p").set('html', '{{_(("Are you sure you want to delete the selected item?"))}}');
+
         show_confirm_box();
         event.stop();
     },
-    
+
     deleteDirectory: function(event) {
         hide_confirm_box();
-	new Request.JSON({
+    new Request.JSON({
             method: 'POST',
             url: "/json/filemanager/delete",
-	    data: {"path": this.path, "name": this.name},
+        data: {"path": this.path, "name": this.name},
             onSuccess: function(data) {
-		if(data.response == "success")
-		{
-		  new Fx.Tween(this.ele).start('opacity', 0);
-		  var ul = this.ele.parentNode;
-		  this.ele.dispose();
-		  //if this was the only child, add a "empty folder" div
-		  if(!ul.getChildren('li')[0])
-		  {
-		    var div = new Element("div", { 'html': '{{ _("Folder is empty") }}' });
-		    div.replaces(ul);
-		  }
-		  
-		  indicateSuccess();
-		} else
-		{
-		  //error from json code...
-		  indicateFail();
-		}
+        if(data.response == "success")
+        {
+          new Fx.Tween(this.ele).start('opacity', 0);
+          var ul = this.ele.parentNode;
+          this.ele.dispose();
+          //if this was the only child, add a "empty folder" div
+          if(!ul.getChildren('li')[0])
+          {
+            var div = new Element("div", { 'html': '{{ _("Folder is empty") }}' });
+            div.replaces(ul);
+          }
+
+          indicateSuccess();
+        } else
+        {
+          //error from json code...
+          indicateFail();
+        }
             }.bind(this),
             onFailure: indicateFail
         }).send();
-	
+
         event.stop();
     },
-    
+
     rename: function(event) {
         $("rename_form").removeEvents("submit");
         $("rename_form").addEvent("submit", this.renameDirectory.bind(this));
 
-	$("path").set("value", this.path);
+    $("path").set("value", this.path);
         $("old_name").set("value", this.name);
         $("new_name").set("value", this.name);
-        
+
         show_rename_box();
         event.stop();
     },
 
     renameDirectory: function(event) {
         hide_rename_box();
-	new Request.JSON({
+    new Request.JSON({
             method: 'POST',
             url: "/json/filemanager/rename",
             onSuccess: function(data) {
-		if(data.response == "success")
-		{
-		  this.name = $("new_name").get("value");
-		  this.ele.getElements("b")[0].set('html', $("new_name").get("value"));
-		  this.reorderElements();
-		  indicateSuccess();
-		} else
-		{
-		  //error from json code...
-		  indicateFail();
-		}
+        if(data.response == "success")
+        {
+          this.name = $("new_name").get("value");
+          this.ele.getElements("b")[0].set('html', $("new_name").get("value"));
+          this.reorderElements();
+          indicateSuccess();
+        } else
+        {
+          //error from json code...
+          indicateFail();
+        }
             }.bind(this),
             onFailure: indicateFail
         }).send($("rename_form").toQueryString());
-	
+
         event.stop();
     },
-    
+
     mkdir: function(event) {
       new Request.JSON({
-	  method: 'POST',
-	  url: "/json/filemanager/mkdir",
-	  data: {"path": this.path + "/" + this.name, "name": '{{_("New folder")}}'},
-	  onSuccess: function(data) {
-	      if(data.response == "success")
-	      {
-		new Request.HTML({
-		    method: 'POST',
-		    url: "/filemanager/get_dir",
-		    data: {"path": data.path, "name": data.name},
-		    onSuccess: function(li) {
-			//add node as first child of ul
-			var ul = this.ele.getChildren('ul')[0];
-			if(!ul)
-			{
-			  //remove the "Folder Empty" div
-			  this.ele.getChildren('div').dispose();
-			  
-			  //create new ul to contain subfolder
-			  ul = new Element("ul");
-			  ul.inject(this.ele, 'bottom');
-			}
-			li[0].inject(ul, 'top');
-			
-			//add directory as a subdirectory of the current item
-			this.directories.push(new Item(this.ui, data.path, data.name, ul.firstChild));
-		    }.bind(this),
-		    onFailure: indicateFail
-		}).send();
-		indicateSuccess();
-	      } else
-	      {
-		//error from json code...
-		indicateFail();
-	      }
-	  }.bind(this),
-	  onFailure: indicateFail
+      method: 'POST',
+      url: "/json/filemanager/mkdir",
+      data: {"path": this.path + "/" + this.name, "name": '{{_("New folder")}}'},
+      onSuccess: function(data) {
+          if(data.response == "success")
+          {
+        new Request.HTML({
+            method: 'POST',
+            url: "/filemanager/get_dir",
+            data: {"path": data.path, "name": data.name},
+            onSuccess: function(li) {
+            //add node as first child of ul
+            var ul = this.ele.getChildren('ul')[0];
+            if(!ul)
+            {
+              //remove the "Folder Empty" div
+              this.ele.getChildren('div').dispose();
+
+              //create new ul to contain subfolder
+              ul = new Element("ul");
+              ul.inject(this.ele, 'bottom');
+            }
+            li[0].inject(ul, 'top');
+
+            //add directory as a subdirectory of the current item
+            this.directories.push(new Item(this.ui, data.path, data.name, ul.firstChild));
+            }.bind(this),
+            onFailure: indicateFail
+        }).send();
+        indicateSuccess();
+          } else
+          {
+        //error from json code...
+        indicateFail();
+          }
+      }.bind(this),
+      onFailure: indicateFail
       }).send();
-      
+
       event.stop();
     },
-    
+
     toggle: function() {
         var child = this.ele.getElement('ul');
-	if(child == null)
-	  child = this.ele.getElement('div');
-	
-	if(child != null)
-	{
-	  if (child.getStyle('display') == "block") {
-	      child.dissolve();
-	  } else {
-	      child.reveal();
-	  }
-	}
+    if(child == null)
+      child = this.ele.getElement('div');
+
+    if(child != null)
+    {
+      if (child.getStyle('display') == "block") {
+          child.dissolve();
+      } else {
+          child.reveal();
+      }
+    }
     }
 });
diff --git a/pyload/webui/themes/Next/js/package.js b/pyload/webui/themes/Next/js/package.js
index 384207882..b5d711f28 100644
--- a/pyload/webui/themes/Next/js/package.js
+++ b/pyload/webui/themes/Next/js/package.js
@@ -197,7 +197,7 @@ var Package = new Class({
                     "margin-left": 0
                 }
             });
-            
+
             if (link.icon == 'arrow_right.png'){
                     link.icon = 'glyphicon glyphicon-arrow-right';
             }
@@ -216,7 +216,7 @@ var Package = new Class({
             if (link.icon == 'status_offline.png'){
                     link.icon = 'glyphicon glyphicon-ban-circle';
             }
-            
+
 
             var html = "<span style='' class='child_status'><span style='margin-right: 2px;' class='{icon} sorthandle'></span></span>\n".substitute({"icon": link.icon});
             html += "<span style='font-size: 18px; text-weight:bold'>{name}</span><br /><div class='child_secrow' style='margin-left: 21px; margin-bottom: 7px;'>".substitute({"name": link.name});
diff --git a/pyload/webui/themes/Next/js/settings.coffee b/pyload/webui/themes/Next/js/settings.coffee
index 9205233e3..0fc908d46 100644
--- a/pyload/webui/themes/Next/js/settings.coffee
+++ b/pyload/webui/themes/Next/js/settings.coffee
@@ -91,7 +91,7 @@ class SettingsUI
 
         form.send()
         e.stop()
-    
+
     submitAccounts: (e) ->
         form = $ "account_form"
         form.set "send", {
-- 
cgit v1.2.3