]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
[CORE][FRAMEWORK] URL_REGEX_VALID_PATH_CHARS didn't recognize the parenthesis sign.
[quix0rs-gnu-social.git] / js / util.js
index b0274a91bad4dfc6b1d75f77be76f8129696697e..b645e8b0298aa1dc0d5e218acac82f979f02aa6e 100644 (file)
@@ -53,11 +53,11 @@ var SN = { // StatusNet
             NoticeDataGeo: 'notice_data-geo',
             NoticeDataGeoCookie: 'NoticeDataGeo',
             NoticeDataGeoSelected: 'notice_data-geo_selected',
-            StatusNetInstance: 'StatusNetInstance'
         }
     },
 
     V: {    // Variables
+        // These get set on runtime via inline scripting, so don't put anything here.
     },
 
     /**
@@ -359,7 +359,7 @@ var SN = { // StatusNet
 
             form.ajaxForm({
                 dataType: 'xml',
-                timeout: '60000',
+                timeout: SN.V.xhrTimeout,
                 beforeSend: function (formData) {
                     if (form.find('.notice_data-text:first').val() == '') {
                         form.addClass(SN.C.S.Warning);
@@ -771,7 +771,7 @@ var SN = { // StatusNet
 
             form
                 .addClass('dialogbox')
-                .append('<button class="close">&#215;</button>')
+                .append('<button class="close" title="' + SN.msg('popup_close_button') + '">&#215;</button>')
                 .closest('.notice-options')
                     .addClass('opaque');
 
@@ -848,27 +848,29 @@ var SN = { // StatusNet
             NDA.change(function (event) {
                 form.find('.attach-status').remove();
 
-                var filename = $(this).val();
-                if (!filename) {
-                    // No file -- we've been tricked!
-                    return false;
-                }
-
-                var attachStatus = $('<div class="attach-status ' + SN.C.S.Success + '"><code></code> <button class="close">&#215;</button></div>');
-                attachStatus.find('code').text(filename);
-                attachStatus.find('button').click(function () {
-                    attachStatus.remove();
-                    NDA.val('');
-
-                    return false;
-                });
-                form.append(attachStatus);
-
                 if (typeof this.files === "object") {
+                    var attachStatus = $('<ul class="attach-status ' + SN.C.S.Success + '"></ul>');
+                    form.append(attachStatus);
                     // Some newer browsers will let us fetch the files for preview.
                     for (i = 0; i < this.files.length; i++) {
                         SN.U.PreviewAttach(form, this.files[i]);
                     }
+                } else {
+                    var filename = $(this).val();
+                    if (!filename) {
+                        // No file -- we've been tricked!
+                        return false;
+                    }
+
+                    var attachStatus = $('<div class="attach-status ' + SN.C.S.Success + '"><code></code> <button class="close">&#215;</button></div>');
+                    attachStatus.find('code').text(filename);
+                    attachStatus.find('button').click(function () {
+                        attachStatus.remove();
+                        NDA.val('');
+
+                        return false;
+                    });
+                    form.append(attachStatus);
                 }
             });
         },
@@ -964,12 +966,15 @@ var SN = { // StatusNet
 
             if (preview) {
                 blobAsDataURL(file, function (url) {
+                    var fileentry = $('<li class="attachment"></li>');
+                    fileentry.append($('<code>' + file.name + '</code>'));
                     var img = $('<img>')
                         .attr('title', tooltip)
                         .attr('alt', tooltip)
                         .attr('src', url)
                         .attr('style', 'height: 120px');
-                    form.find('.attach-status').append(img);
+                    fileentry.append(img);
+                    form.find('.attach-status').append(fileentry);
                 });
             } else {
                 var img = $('<div></div>').text(tooltip);
@@ -1081,12 +1086,12 @@ var SN = { // StatusNet
                 label.attr('title', label.text());
 
                 check.change(function () {
-                    if (check.prop('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) {
+                    if (check.prop('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === undefined) {
                         label
                             .attr('title', NoticeDataGeo_text.ShareDisable)
                             .addClass('checked');
 
-                        if ($.cookie(SN.C.S.NoticeDataGeoCookie) === null || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
+                        if ($.cookie(SN.C.S.NoticeDataGeoCookie) === undefined || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
                             if (navigator.geolocation) {
                                 SN.U.NoticeGeoStatus(form, 'Requesting location from browser...');
                                 navigator.geolocation.getCurrentPosition(
@@ -1251,56 +1256,6 @@ var SN = { // StatusNet
             return date;
         },
 
-        /**
-         * Some sort of object interface for storing some structured
-         * information in a cookie.
-         *
-         * Appears to be used to save the last-used login nickname?
-         * That's something that browsers usually take care of for us
-         * these days, do we really need to do it? Does anything else
-         * use this interface?
-         *
-         * @fixme what is this?
-         * @fixme should this use non-cookie local storage when available?
-         */
-        StatusNetInstance: {
-            /**
-             * @fixme what is this?
-             */
-            Set: function (value) {
-                var SNI = SN.U.StatusNetInstance.Get();
-                if (SNI !== null) {
-                    value = $.extend(SNI, value);
-                }
-
-                $.cookie(
-                    SN.C.S.StatusNetInstance,
-                    JSON.stringify(value),
-                    {
-                        path: '/',
-                        expires: SN.U.GetFullYear(2029, 0, 1)
-                    });
-            },
-
-            /**
-             * @fixme what is this?
-             */
-            Get: function () {
-                var cookieValue = $.cookie(SN.C.S.StatusNetInstance);
-                if (cookieValue !== undefined) {
-                    return JSON.parse(cookieValue);
-                }
-                return null;
-            },
-
-            /**
-             * @fixme what is this?
-             */
-            Delete: function () {
-                $.cookie(SN.C.S.StatusNetInstance, null);
-            }
-        },
-
         /**
          * Check if the current page is a timeline where the current user's
          * posts should be displayed immediately on success.
@@ -1594,28 +1549,6 @@ var SN = { // StatusNet
             }
         },
 
-        /**
-         * Run setup code for login form:
-         *
-         * - loads saved last-used-nickname from cookie
-         * - sets event handler to save nickname to cookie on submit
-         *
-         * @fixme is this necessary? Browsers do their own form saving these days.
-         */
-        Login: function () {
-            if (SN.U.StatusNetInstance.Get() !== null) {
-                var nickname = SN.U.StatusNetInstance.Get().Nickname;
-                if (nickname !== null) {
-                    $('#form_login #nickname').val(nickname);
-                }
-            }
-
-            $('#form_login').on('submit', function () {
-                SN.U.StatusNetInstance.Set({Nickname: $('#form_login #nickname').val()});
-                return true;
-            });
-        },
-
         /**
          * Run setup for the ajax people tags editor
          *
@@ -1744,9 +1677,6 @@ $(function () {
     if ($('#content .entity_actions').length > 0) {
         SN.Init.EntityActions();
     }
-    if ($('#form_login').length > 0) {
-        SN.Init.Login();
-    }
     if ($('#profile_search_results').length > 0) {
         SN.Init.ProfileSearch();
     }