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').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
62 function NavUpdate() {
64 if($('#live-network').length) { src = 'network'; liveUpdate(); }
65 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
68 $.get("ping",function(data) {
69 $(data).find('result').each(function() {
70 var net = $(this).find('net').text();
71 if(net == 0) { net = ''; }
72 $('#net-update').html(net);
73 var home = $(this).find('home').text();
74 if(home == 0) { home = ''; }
75 $('#home-update').html(home);
76 var mail = $(this).find('mail').text();
77 if(mail == 0) { mail = ''; }
78 $('#mail-update').html(mail);
79 var intro = $(this).find('intro').text();
80 if(intro == 0) { intro = ''; }
81 $('#notify-update').html(intro);
85 timer = setTimeout(NavUpdate,30000);
89 function liveUpdate() {
90 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
91 if($('.comment-edit-text-full').length) {
92 livetime = setTimeout(liveUpdate, 10000);
97 $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
98 $('.wall-item-outside-wrapper',data).each(function() {
99 var ident = $(this).attr('id');
100 if($('#' + ident).length == 0) {
101 $('img',this).each(function() {
102 $(this).attr('src',$(this).attr('dst'));
104 $('#' + prev).after($(this));
108 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
109 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
110 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
111 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
112 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
113 $(this).attr('src',$(this).attr('dst'));
120 $('.like-rotator').hide();
125 function confirmDelete() {
126 return confirm("Delete this item?");
129 function imgbright(node) {
130 $(node).attr("src",$(node).attr("src").replace('hide','show'));
131 $(node).css('width',24);
132 $(node).css('height',24);
135 function imgdull(node) {
136 $(node).attr("src",$(node).attr("src").replace('show','hide'));
137 $(node).css('width',16);
138 $(node).css('height',16);
141 // Since ajax is asynchronous, we will give a few seconds for
142 // the first ajax call (setting like/dislike), then run the
143 // updater to pick up any changes and display on the page.
144 // The updater will turn any rotators off when it's done.
145 // This function will have returned long before any of these
146 // events have completed and therefore there won't be any
147 // visible feedback that anything changed without all this
148 // trickery. This still could cause confusion if the "like" ajax call
149 // is delayed and NavUpdate runs before it completes.
151 function dolike(ident,verb) {
152 $('#like-rotator-' + ident.toString()).show();
153 $.get('like/' + ident.toString() + '?verb=' + verb );
154 if(timer) clearTimeout(timer);
155 timer = setTimeout(NavUpdate,3000);