2 function openClose(theID) {
3 if(document.getElementById(theID).style.display == "block") {
4 document.getElementById(theID).style.display = "none"
7 document.getElementById(theID).style.display = "block"
11 function openMenu(theID) {
12 document.getElementById(theID).style.display = "block"
15 function closeMenu(theID) {
16 document.getElementById(theID).style.display = "none"
19 function commentOpen(obj,id) {
20 if(obj.value == 'Comment') {
22 obj.className = "comment-edit-text-full";
23 openMenu("comment-edit-submit-wrapper-" + id);
26 function commentClose(obj,id) {
28 obj.value = 'Comment';
29 obj.className="comment-edit-text-empty";
30 closeMenu("comment-edit-submit-wrapper-" + id);
42 $(document).ready(function() {
43 $.ajaxSetup({cache: false});
44 msie = $.browser.msie ;
46 // Allow folks to stop the ajax page updates with the pause/break key
47 $(document).keypress(function(event) {
48 if(event.keyCode == '19') {
49 event.preventDefault();
50 if(stopped == false) {
52 $('#pause img').attr('src','images/pause.gif');
53 $('#pause img').css({'border': '1px solid black'});
58 $('#pause img').attr('src','');
59 $('#pause img').css({'border': 'none'});
66 function NavUpdate() {
68 if($('#live-network').length) { src = 'network'; pr = $('#live-network').attr('profile'); liveUpdate(); }
69 if($('#live-profile').length) { src = 'profile'; pr = $('#live-profile').attr('profile'); liveUpdate(); }
72 $.get("ping",function(data) {
73 $(data).find('result').each(function() {
74 var net = $(this).find('net').text();
75 if(net == 0) { net = ''; }
76 $('#net-update').html(net);
77 var home = $(this).find('home').text();
78 if(home == 0) { home = ''; }
79 $('#home-update').html(home);
80 var mail = $(this).find('mail').text();
81 if(mail == 0) { mail = ''; }
82 $('#mail-update').html(mail);
83 var intro = $(this).find('intro').text();
84 if(intro == 0) { intro = ''; }
85 $('#notify-update').html(intro);
89 timer = setTimeout(NavUpdate,30000);
93 function liveUpdate() {
94 if((src == null) || (stopped)) { $('.like-rotator').hide(); return; }
95 if($('.comment-edit-text-full').length) {
96 livetime = setTimeout(liveUpdate, 10000);
101 $.get('update_' + src + '?p=' + pr + '&msie=' + ((msie) ? 1 : 0),function(data) {
102 $('.wall-item-outside-wrapper',data).each(function() {
103 var ident = $(this).attr('id');
104 if($('#' + ident).length == 0) {
105 $('img',this).each(function() {
106 $(this).attr('src',$(this).attr('dst'));
108 $('#' + prev).after($(this));
112 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
113 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
114 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
115 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
116 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
117 $(this).attr('src',$(this).attr('dst'));
124 $('.like-rotator').hide();
129 function confirmDelete() {
130 return confirm("Delete this item?");
133 function imgbright(node) {
134 $(node).attr("src",$(node).attr("src").replace('hide','show'));
135 $(node).css('width',24);
136 $(node).css('height',24);
139 function imgdull(node) {
140 $(node).attr("src",$(node).attr("src").replace('show','hide'));
141 $(node).css('width',16);
142 $(node).css('height',16);
145 // Since ajax is asynchronous, we will give a few seconds for
146 // the first ajax call (setting like/dislike), then run the
147 // updater to pick up any changes and display on the page.
148 // The updater will turn any rotators off when it's done.
149 // This function will have returned long before any of these
150 // events have completed and therefore there won't be any
151 // visible feedback that anything changed without all this
152 // trickery. This still could cause confusion if the "like" ajax call
153 // is delayed and NavUpdate runs before it completes.
155 function dolike(ident,verb) {
156 $('#like-rotator-' + ident.toString()).show();
157 $.get('like/' + ident.toString() + '?verb=' + verb );
158 if(timer) clearTimeout(timer);
159 timer = setTimeout(NavUpdate,3000);