]> source.dussan.org Git - nextcloud-server.git/commitdiff
typos, naming, remove unused code, identation
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 28 Apr 2014 14:51:57 +0000 (16:51 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Mon, 28 Apr 2014 14:51:57 +0000 (16:51 +0200)
apps/files/js/filelist.js
apps/files/js/files.js
apps/files/js/filesummary.js

index 5667d07ede7f3464478fba168ce926d5e77ea5e2..40ec898635e426ca16fd68c4a6939c301d8828d1 100644 (file)
@@ -323,7 +323,7 @@ window.FileList = {
                        mimetype: $el.attr('data-mime'),
                        type: $el.attr('data-type'),
                        size: parseInt($el.attr('data-size'), 10),
-                       etag: $el.attr('data-etag'),
+                       etag: $el.attr('data-etag')
                };
        },
 
@@ -371,7 +371,7 @@ window.FileList = {
 
        /**
         * Sets the files to be displayed in the list.
-        * This operation will rerender the list and update the summary.
+        * This operation will re-render the list and update the summary.
         * @param filesArray array of file data (map)
         */
        setFiles: function(filesArray) {
@@ -673,7 +673,6 @@ window.FileList = {
         */
        changeDirectory: function(targetDir, changeUrl, force) {
                var $dir = $('#dir'),
-                       url,
                        currentDir = $dir.val() || '/';
                targetDir = targetDir || '/';
                if (!force && currentDir === targetDir) {
@@ -971,19 +970,16 @@ window.FileList = {
                        event.stopPropagation();
                        event.preventDefault();
                        try {
-                               var newname = input.val();
-                               var directory = FileList.getCurrentDirectory();
-                               if (newname !== oldname) {
+                               var newName = input.val();
+                               if (newName !== oldname) {
                                        checkInput();
-                                       // save background image, because it's replaced by a spinner while async request
-                                       var oldBackgroundImage = td.css('background-image');
                                        // mark as loading
                                        td.css('background-image', 'url('+ OC.imagePath('core', 'loading.gif') + ')');
                                        $.ajax({
                                                url: OC.filePath('files','ajax','rename.php'),
                                                data: {
                                                        dir : $('#dir').val(),
-                                                       newname: newname,
+                                                       newname: newName,
                                                        file: oldname
                                                },
                                                success: function(result) {
@@ -1004,20 +1000,20 @@ window.FileList = {
                                }
                                input.tipsy('hide');
                                tr.data('renaming',false);
-                               tr.attr('data-file', newname);
+                               tr.attr('data-file', newName);
                                var path = td.children('a.name').attr('href');
                                // FIXME this will fail if the path contains the filename.
-                               td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newname)));
-                               var basename = newname;
-                               if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
-                                       basename = newname.substr(0, newname.lastIndexOf('.'));
+                               td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newName)));
+                               var basename = newName;
+                               if (newName.indexOf('.') > 0 && tr.data('type') !== 'dir') {
+                                       basename = newName.substr(0, newName.lastIndexOf('.'));
                                }
                                td.find('a.name span.nametext').text(basename);
-                               if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
+                               if (newName.indexOf('.') > 0 && tr.data('type') !== 'dir') {
                                        if ( ! td.find('a.name span.extension').exists() ) {
                                                td.find('a.name span.nametext').append('<span class="extension"></span>');
                                        }
-                                       td.find('a.name span.extension').text(newname.substr(newname.lastIndexOf('.')));
+                                       td.find('a.name span.extension').text(newName.substr(newName.lastIndexOf('.')));
                                }
                                form.remove();
                                FileActions.display( tr.find('td.filename'), true);
index 6857450602c6079465d652a04748aef4933ac866..6d167851e64465249f0a3e23a1299e3da22c1cb4 100644 (file)
@@ -8,8 +8,8 @@
  *
  */
 
-/* global OC, t, n, FileList, FileActions */
-/* global getURLParameter, isPublic */
+/* global OC, t, FileList */
+/* global getURLParameter */
 var Files = {
        // file space size sync
        _updateStorageStatistics: function() {
@@ -96,10 +96,10 @@ var Files = {
                        throw t('files', 'File name cannot be empty.');
                }
                // check for invalid characters
-               var invalid_characters =
+               var invalidCharacters =
                        ['\\', '/', '<', '>', ':', '"', '|', '?', '*', '\n'];
-               for (var i = 0; i < invalid_characters.length; i++) {
-                       if (trimmedName.indexOf(invalid_characters[i]) !== -1) {
+               for (var i = 0; i < invalidCharacters.length; i++) {
+                       if (trimmedName.indexOf(invalidCharacters[i]) !== -1) {
                                throw t('files', "Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed.");
                        }
                }
@@ -116,7 +116,8 @@ var Files = {
                        return;
                }
                if (usedSpacePercent > 90) {
-                       OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)', {usedSpacePercent: usedSpacePercent}));
+                       OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)',
+                               {usedSpacePercent: usedSpacePercent}));
                }
        },
 
@@ -222,7 +223,7 @@ $(document).ready(function() {
        // TODO use OC.dialogs
        $(document).bind('drop dragover', function (e) {
                        e.preventDefault(); // prevent browser from doing anything, if file isn't dropped in dropZone
-       });
+               });
 
        //do a background scan if needed
        scanFiles();
@@ -299,16 +300,6 @@ function scanFiles(force, dir, users) {
 }
 scanFiles.scanning=false;
 
-function boolOperationFinished(data, callback) {
-       result = jQuery.parseJSON(data.responseText);
-       Files.updateMaxUploadFilesize(result);
-       if (result.status === 'success') {
-               callback.call();
-       } else {
-               alert(result.data.message);
-       }
-}
-
 // TODO: move to FileList
 var createDragShadow = function(event) {
        //select dragged file
@@ -362,25 +353,25 @@ var dragOptions={
        revert: 'invalid', revertDuration: 300,
        opacity: 0.7, zIndex: 100, appendTo: 'body', cursorAt: { left: 24, top: 18 },
        helper: createDragShadow, cursor: 'move',
-               start: function(event, ui){
-                       var $selectedFiles = $('td.filename input:checkbox:checked');
-                       if($selectedFiles.length > 1){
-                               $selectedFiles.parents('tr').fadeTo(250, 0.2);
-                       }
-                       else{
-                               $(this).fadeTo(250, 0.2);
-                       }
-               },
-               stop: function(event, ui) {
-                       var $selectedFiles = $('td.filename input:checkbox:checked');
-                       if($selectedFiles.length > 1){
-                               $selectedFiles.parents('tr').fadeTo(250, 1);
-                       }
-                       else{
-                               $(this).fadeTo(250, 1);
-                       }
-                       $('#fileList tr td.filename').addClass('ui-draggable');
+       start: function(event, ui){
+               var $selectedFiles = $('td.filename input:checkbox:checked');
+               if($selectedFiles.length > 1){
+                       $selectedFiles.parents('tr').fadeTo(250, 0.2);
+               }
+               else{
+                       $(this).fadeTo(250, 0.2);
+               }
+       },
+       stop: function(event, ui) {
+               var $selectedFiles = $('td.filename input:checkbox:checked');
+               if($selectedFiles.length > 1){
+                       $selectedFiles.parents('tr').fadeTo(250, 1);
                }
+               else{
+                       $(this).fadeTo(250, 1);
+               }
+               $('#fileList tr td.filename').addClass('ui-draggable');
+       }
 };
 // sane browsers support using the distance option
 if ( $('html.ie').length === 0) {
@@ -446,7 +437,7 @@ Files.generatePreviewUrl = function(urlSpec) {
        urlSpec.x *= window.devicePixelRatio;
        urlSpec.forceIcon = 0;
        return OC.generateUrl('/core/preview.png?') + $.param(urlSpec);
-}
+};
 
 Files.lazyLoadPreview = function(path, mime, ready, width, height, etag) {
        // get mime icon url
index b3e3beeb24a9398d40b4bbe33625219bdd8d35eb..b5130247cc99911f068fe1a952b7f72fd738b29a 100644 (file)
                        var summary = this.summary;
                        var directoryInfo = n('files', '%n folder', '%n folders', summary.totalDirs);
                        var fileInfo = n('files', '%n file', '%n files', summary.totalFiles);
-                       var fileSize;
 
                        var infoVars = {
                                dirs: '<span class="dirinfo">'+directoryInfo+'</span><span class="connector">',