]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
Merge branch '0.8.x' of git@gitorious.org:+laconica-developers/laconica/dev into...
[quix0rs-gnu-social.git] / js / util.js
index c710ae839277c053ef6d889b661469dee57feed2..acf44a17c78d9f27fb8cadb76b290652b7dbef9c 100644 (file)
  */
 
 $(document).ready(function(){
+    $('input#notice_data-attach').toggle();
+    $('label[for=notice_data-attach]').text('Upload a file as an attachment?');
+    $('label[for=notice_data-attach]').click(function () {
+        if ('Upload a file as an attachment?' == $(this).text()) {
+            $(this).text('Upload: ');
+            $('input#notice_data-attach').slideDown('fast');
+        } else {
+            $('input#notice_data-attach').slideUp('fast', function() {$('label[for=notice_data-attach]').text('Upload a file as an attachment?');});
+        }
+    });
+
+    $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; });
+    $("a.thumbnail").hover(
+        function() {
+            var anchor = $(this);
+            $("a.thumbnail").children('img').remove();
+
+            setTimeout(function() {
+                anchor.closest(".entry-title").addClass('ov');
+                $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
+                    anchor.append(data);
+                });
+            }, 250);
+
+            setTimeout(function() {
+                anchor.children('img').remove();
+                anchor.closest(".entry-title").removeClass('ov');
+            }, 3000);
+        },
+        function() {
+            $(this).children('img').remove();
+            $(this).closest(".entry-title").removeClass('ov');
+        }
+    );
+
        // count character on keyup
        function counter(event){
                var maxLength = 140;
@@ -203,6 +238,7 @@ $(document).ready(function(){
                                                          }
                                                                                                        }
                                                                                                        $("#notice_data-text").val("");
+                                                                                               $("#notice_data-attach").val("");
                                                     counter();
                                                                                                }
                                                                                                $("#form_notice").removeClass("processing");