]> git.mxchange.org Git - friendica.git/blob - view/head.tpl
fixup of some nits with live update and remote comment display on profile page
[friendica.git] / view / head.tpl
1 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
2 <base href="$baseurl" />
3 <link rel="stylesheet" type="text/css" href="$baseurl/view/style.css" media="all" />
4
5 <!--[if IE]>
6 <script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
7 <![endif]-->
8 <script type="text/javascript" src="$baseurl/include/jquery.js" ></script>
9 <script type="text/javascript" src="$baseurl/include/main.js" ></script>
10
11 <script type="text/javascript">
12
13         var src = null;
14         var prev = null;
15         var livetime = null;
16         var msie = false;
17
18         $(document).ready(function() {
19                 $.ajaxSetup({cache: false});
20                 msie = $.browser.msie ;
21                 NavUpdate(); 
22
23 //              $('.wall-item-delete-icon').hover(function() {
24 //                      $(this).attr("src",$(this).attr("src").replace('hide',''));
25 //              },function() {
26 //                      $(this).attr("src",$(this).attr("src").replace('','hide'));
27 //              });
28
29
30         });
31
32         function NavUpdate() {
33
34                 if($('#live-network').length) { src = 'network'; liveUpdate(); }
35                 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
36
37                 $.get("ping",function(data) {
38                         $(data).find('result').each(function() {
39                                 var net = $(this).find('net').text();
40                                 if(net == 0) { net = ''; }
41                                 $('#net-update').html(net);
42                                 var home = $(this).find('home').text();
43                                 if(home == 0) { home = ''; }
44                                 $('#home-update').html(home);
45                                 var mail = $(this).find('mail').text();
46                                 if(mail == 0) { mail = ''; }
47                                 $('#mail-update').html(mail);
48                                 var intro = $(this).find('intro').text();
49                                 if(intro == 0) { intro = ''; }
50                                 $('#notify-update').html(intro);
51                         });
52                 }) ;
53                 setTimeout(NavUpdate,30000);
54
55         }
56
57         function liveUpdate() {
58                 if(src == null) { return; }
59                 if($('.comment-edit-text-full').length) {
60                         livetime = setTimeout(liveUpdate, 10000);
61                         return;
62                 }
63                 prev = 'live-' + src;
64
65                 $.get('update_' + src + '?msie=' + ((msie) ? 1 : 0),function(data) {
66                         $('.wall-item-outside-wrapper',data).each(function() {
67                                 var ident = $(this).attr('id');
68                                 if($('#' + ident).length == 0) { 
69                                         $('#' + prev).after($(this));
70                                 }
71                                 else { $('#' + ident).replaceWith($(this)); }
72                                 prev = ident; 
73                         });
74                 });
75
76         }
77
78         function confirmDelete() { 
79                 return confirm("Delete this item?");
80         }
81
82 </script>
83