From a9171d08d89406ec3cd593475e9e6439c0481fff Mon Sep 17 00:00:00 2001 From: frost-nzcr4 Date: Mon, 26 Sep 2011 21:32:45 +0400 Subject: [PATCH] a bit of jslint --- plugins/wysiwyg.fileManager.js | 72 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/plugins/wysiwyg.fileManager.js b/plugins/wysiwyg.fileManager.js index 4e45b487..7e9518e8 100644 --- a/plugins/wysiwyg.fileManager.js +++ b/plugins/wysiwyg.fileManager.js @@ -45,7 +45,7 @@ $.wysiwyg.plugin.register(fileManager); // Private object: - function fileManagerObj (_handler) { + function fileManagerObj(_handler) { this.handler = _handler; this.loaded = false; this.move = false; @@ -73,25 +73,25 @@ return false; } // Wrap the file list: - var uiHtml = '
' + + var uiHtml = '
' + '' + '
'; // If handler does not support upload, icon will not appear: if (self.upload.enabled) { - uiHtml += '
'; + uiHtml += '
'; } // If handler does not support mkdir, icon will not appear: if (self.mkdir.enabled) { - uiHtml += '
'; + uiHtml += '
'; } - uiHtml += '' + + uiHtml += '' + '
'; uiHtml = self.i18n(uiHtml); - if ($.wysiwyg.dialog) { + if ($.wysiwyg.dialog) { // Support for native $.wysiwyg.dialog() var _title = self.i18n("{{file_manager}}"); var fileManagerUI = new $.wysiwyg.dialog(_handler, { @@ -147,7 +147,7 @@ }); } }); - mkdirDialog.open(); + mkdirDialog.open(); }); // Upload File @@ -222,23 +222,23 @@ if (self.curDir !== "/") { var prevDir = self.curDir.replace(/[^\/]+\/?$/, ''); treeHtml += '
  • ' + - '' + + '' + self.curDir + '
  • '; } - $.each(json.data.directories, function(name, dirPath) { + $.each(json.data.directories, function (name, dirPath) { treeHtml += '
  • ' + - '' + + '' + name + '
  • '; - }); - $.each(json.data.files, function(name, url) { + }); + $.each(json.data.files, function (name, url) { var ext = name.replace(/^.*?\./, '').toLowerCase(); - treeHtml += '
  • ' + - '' + + treeHtml += '
  • ' + + '' + name + '
  • '; - }); + }); treeHtml += ''; return self.i18n(treeHtml); @@ -281,8 +281,8 @@ alert(json.error); } callback(json); - }); - }; + }); + }; // Make Directory Method this.mkDir = function (newName, callback) { @@ -297,15 +297,19 @@ alert(json.error); } callback(json); - }); + }); }; /** * Currently we will not support moving of files. This will be supported only when a more interactive interface will be introduced. */ this.moveFile = function () { - if (!this.loaded) { return false; } - if (!this.move.enabled) { console.log("$.wysiwyg.fileManager: handler: move is disabled."); return false; } + if (!this.loaded) { + return false; + } + if (!this.move.enabled) { + console.log("$.wysiwyg.fileManager: handler: move is disabled."); return false; + } var self = this; return false; }; @@ -313,13 +317,13 @@ // Upload: this.loadUploadUI = function () { if (!this.loaded) { return false; } - if (!this.upload.enabled) { console.log("$.wysiwyg.fileManager: handler: move is disabled."); return false; } + if (!this.upload.enabled) { console.log("$.wysiwyg.fileManager: handler: move is disabled."); return false; } var self = this; - var uiHtml = '
    ' + - '


    ' + - '
    ' + - '

    ' + - '

    ' + + var uiHtml = '' + + '


    ' + + '
    ' + + '

    ' + + '

    ' + '' + '
    '; uiHtml = self.i18n(uiHtml); @@ -355,7 +359,7 @@ /** * i18n Support. * The below methods will enable basic support for i18n - */ + */ // Default translations (EN): this.defaultTranslations = { @@ -367,7 +371,7 @@ "upload_action": "Upload new file to current directory", "mkdir_action": "Create new directory", "remove_action": "Remove this file", - "rename_action": "Rename this file" , + "rename_action": "Rename this file", "delete_message": "Are you sure you want to delete this file?", "new_directory": "New Directory", "previous_directory": "Go to previous directory", @@ -439,8 +443,8 @@ var entry = $(this).parent("li"); // What are we deleting? var type = entry.hasClass("wysiwyg-files-file") ? "file" : "dir"; - var uiHtml = "

    {{delete_message}}

    " + - '
    ' + + var uiHtml = "

    {{delete_message}}

    " + + '
    ' + '' + '' + "
    "; @@ -516,12 +520,8 @@ }); renameDialog.open(); - - }); - + }); } - - } }).bind("mouseleave", function () { $(this).removeClass("wysiwyg-files-dir-expanded"); @@ -530,7 +530,6 @@ // Remove action buttons: $(".wysiwyg-files-action").remove(); }); - }; /** @@ -573,5 +572,4 @@ var self = this; }; } - })(jQuery);