]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frost/js/main.js
Fix browser prefetch in notifications menu
[friendica.git] / view / theme / frost / js / main.js
index dbeb4f2ee3fc16d84a3a75bdb1a7d9443336f271..91e79ffc383164f9619dd44e4e663fd8a0c7be49 100644 (file)
@@ -1,20 +1,32 @@
 
-  function openClose(theID) {
-    if(document.getElementById(theID).style.display == "block") { 
-      document.getElementById(theID).style.display = "none" 
-    }
-    else { 
-      document.getElementById(theID).style.display = "block" 
-    } 
-  }
+       function openClose(listID) {
+/*             if(document.getElementById(theID).style.display == "block") { 
+                       document.getElementById(theID).style.display = "none" 
+               }
+               else { 
+                       document.getElementById(theID).style.display = "block" 
+               }*/
+               listID = "#" + listID.replace(/:/g, "\\:");
+               listID = listID.replace(/\./g, "\\.");
+               listID = listID.replace(/@/g, "\\@");
+
+               if($j(listID).is(":visible")) {
+                       $j(listID).hide();
+                       $j(listID+"-wrapper").show();
+               }
+               else {
+                       $j(listID).show();
+                       $j(listID+"-wrapper").hide();
+               }
+       }
 
-  function openMenu(theID) {
-      document.getElementById(theID).style.display = "block" 
-  }
+       function openMenu(theID) {
+               document.getElementById(theID).style.display = "block" 
+       }
 
-  function closeMenu(theID) {
-      document.getElementById(theID).style.display = "none" 
-  }
+       function closeMenu(theID) {
+               document.getElementById(theID).style.display = "none" 
+       }
 
 
 
@@ -38,6 +50,8 @@
 
                msie = $j.browser.msie ;
                
+               collapseHeight();
+               
                /* setup tooltips *//*
                $j("a,.tt").each(function(){
                        var e = $j(this);
                                        html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
                                        nnm.append(html);
                                });
+
+                               $("img[data-src]", nnm).each(function(i, el){
+                                       // Replace data-src attribute with src attribute for every image
+                                       $(el).attr('src', $(el).data("src"));
+                                       $(el).removeAttr("data-src");
+                               });
                        }
                        notif = eNotif.attr('count');
                        if (notif>0){
                        }
                        /* autocomplete @nicknames */
                        $j(".comment-edit-form  textarea").contact_autocomplete(baseurl+"/acl");
-
-                       var bimgs = $j(".wall-item-body > img").not(function() { return this.complete; });
-                       var bimgcount = bimgs.length;
-
-                       if (bimgcount) {
-                               bimgs.load(function() {
-                                       bimgcount--;
-                                       if (! bimgcount) {
-                                               collapseHeight();
-
-                                       }
-                               });
-                       } else {
-                               collapseHeight();
-                       }
+               
+                       collapseHeight();
 
                });
        }
 
-       function collapseHeight() {
-               $j(".wall-item-body").each(function() {
-                               if($j(this).height() > 410) {
-                               if(! $j(this).hasClass('divmore')) {
-                                       $j(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 300 });
-                                       $j(this).addClass('divmore');
-                               }
+       function collapseHeight(elems) {
+               var elemName = '.wall-item-body:not(.divmore)';
+               if(typeof elems != 'undefined') {
+                       elemName = elems + ' ' + elemName;
+               }
+               $j(elemName).each(function() {
+                       if($j(this).height() > 450) {
+                               $j('html').height($j('html').height());
+                               $j(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 });
+                               $j(this).addClass('divmore');
+                               $j('html').height('auto');
                        }                                       
                });
        }
                else {
                        $j("#collapsed-comments-" + id).show();
                        $j("#hide-comments-" + id).html(window.showFewer);
+                       collapseHeight("#collapsed-comments-" + id);
                }
        }