]> git.mxchange.org Git - friendica.git/blobdiff - view/theme/frost-mobile/js/main.js
Merge pull request #473 from pixelroot/master
[friendica.git] / view / theme / frost-mobile / js / main.js
index bffa7977ab0211cb12d22c10e76a2e626ac12b8d..aaa69e7078c6c455e9d5e28dfc8ffa2a56cfff82 100644 (file)
 
                        // add a new thread
 
-                       $j('.tread-wrapper',data).each(function() {
+                       $j('.toplevel_item',data).each(function() {
                                var ident = $j(this).attr('id');
 
                                if($j('#' + ident).length == 0 && profile_page == 1) {
                        }
                        /* 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();
+                       }
+
+               });
+       }
+
+       function collapseHeight() {
+               $j(".wall-item-body").each(function() {
+                               if($j(this).height() > 310) {
+                               if(! $j(this).hasClass('divmore')) {
+                                       $j(this).divgrow({ initialHeight: 300, showBrackets: false, speed: 0 });
+                                       $j(this).addClass('divmore');
+                               }
+                       }                                       
                });
        }
 
 
        function getPosition(e) {
                var cursor = {x:0, y:0};
-               if ( e.pageX || e.pageY  ) {
-                       cursor.x = e.pageX;
-                       cursor.y = e.pageY;
+               if ( e.touches[0].pageX || e.touches[0].pageY  ) {
+                       cursor.x = e.touches[0].pageX;
+                       cursor.y = e.touches[0].pageY;
                }
                else {
-                       if( e.clientX || e.clientY ) {
-                               cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
-                               cursor.y = e.clientY + (document.documentElement.scrollTop  || document.body.scrollTop)  - document.documentElement.clientTop;
+                       if( e.touches[0].clientX || e.touches[0].clientY ) {
+                               cursor.x = e.touches[0].clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
+                               cursor.y = e.touches[0].clientY + (document.documentElement.scrollTop  || document.body.scrollTop)  - document.documentElement.clientTop;
                        }
                        else {
-                               if( e.x || e.y ) {
-                                       cursor.x = e.x;
-                                       cursor.y = e.y;
+                               if( e.touches[0].x || e.touches[0].y ) {
+                                       cursor.touches[0].x = e.touches[0].x;
+                                       cursor.touches[0].y = e.touches[0].y;
                                }
                        }
                }
@@ -657,7 +684,7 @@ Array.prototype.remove = function(item) {
 function previewTheme(elm) {
        theme = $j(elm).val();
        $j.getJSON('pretheme?f=&theme=' + theme,function(data) {
-                       $j('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
+                       $j('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div>');
        });
 
 }