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 ;
47 // Allow folks to stop the ajax page updates with the pause/break key
48 $(document).keypress(function(event) {
49 if(event.keyCode == '19') {
50 event.preventDefault();
51 if(stopped == false) {
53 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
66 $('.sparkle').css({cursor: 'pointer'});
70 $('.sparkle').css({cursor: 'crosshair'});
73 setTimeout(sparkler,500);
77 function NavUpdate() {
79 if($('#live-network').length) { src = 'network'; liveUpdate(); }
80 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
83 $.get("ping",function(data) {
84 $(data).find('result').each(function() {
85 var net = $(this).find('net').text();
86 if(net == 0) { net = ''; }
87 $('#net-update').html(net);
88 var home = $(this).find('home').text();
89 if(home == 0) { home = ''; }
90 $('#home-update').html(home);
91 var mail = $(this).find('mail').text();
92 if(mail == 0) { mail = ''; }
93 $('#mail-update').html(mail);
94 var intro = $(this).find('intro').text();
95 if(intro == 0) { intro = ''; }
96 $('#notify-update').html(intro);
100 timer = setTimeout(NavUpdate,30000);
104 function liveUpdate() {
105 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
106 if($('.comment-edit-text-full').length) {
107 livetime = setTimeout(liveUpdate, 10000);
110 prev = 'live-' + src;
112 $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
113 $('.wall-item-outside-wrapper',data).each(function() {
114 var ident = $(this).attr('id');
115 if($('#' + ident).length == 0) {
116 $('img',this).each(function() {
117 $(this).attr('src',$(this).attr('dst'));
119 $('#' + prev).after($(this));
123 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
124 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
125 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
126 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
127 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
128 $(this).attr('src',$(this).attr('dst'));
135 $('.like-rotator').hide();
140 function confirmDelete() {
141 return confirm("Delete this item?");
144 function imgbright(node) {
145 $(node).attr("src",$(node).attr("src").replace('hide','show'));
146 $(node).css('width',24);
147 $(node).css('height',24);
150 function imgdull(node) {
151 $(node).attr("src",$(node).attr("src").replace('show','hide'));
152 $(node).css('width',16);
153 $(node).css('height',16);
156 // Since ajax is asynchronous, we will give a few seconds for
157 // the first ajax call (setting like/dislike), then run the
158 // updater to pick up any changes and display on the page.
159 // The updater will turn any rotators off when it's done.
160 // This function will have returned long before any of these
161 // events have completed and therefore there won't be any
162 // visible feedback that anything changed without all this
163 // trickery. This still could cause confusion if the "like" ajax call
164 // is delayed and NavUpdate runs before it completes.
166 function dolike(ident,verb) {
167 $('#like-rotator-' + ident.toString()).show();
168 $.get('like/' + ident.toString() + '?verb=' + verb );
169 if(timer) clearTimeout(timer);
170 timer = setTimeout(NavUpdate,3000);