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);
41 $(document).ready(function() {
42 $.ajaxSetup({cache: false});
43 msie = $.browser.msie ;
45 // Allow folks to stop the ajax page updates with the pause/break key
46 $(document).keypress(function(event) {
47 if(event.keyCode == '19') {
48 event.preventDefault();
58 function NavUpdate() {
60 if($('#live-network').length) { src = 'network'; liveUpdate(); }
61 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
64 $.get("ping",function(data) {
65 $(data).find('result').each(function() {
66 var net = $(this).find('net').text();
67 if(net == 0) { net = ''; }
68 $('#net-update').html(net);
69 var home = $(this).find('home').text();
70 if(home == 0) { home = ''; }
71 $('#home-update').html(home);
72 var mail = $(this).find('mail').text();
73 if(mail == 0) { mail = ''; }
74 $('#mail-update').html(mail);
75 var intro = $(this).find('intro').text();
76 if(intro == 0) { intro = ''; }
77 $('#notify-update').html(intro);
81 timer = setTimeout(NavUpdate,30000);
85 function liveUpdate() {
86 if((src == null) || (stopped)) { $('.like-rotator').hide(); return; }
87 if($('.comment-edit-text-full').length) {
88 livetime = setTimeout(liveUpdate, 10000);
93 $.get('update_' + src + '?msie=' + ((msie) ? 1 : 0),function(data) {
94 $('.wall-item-outside-wrapper',data).each(function() {
95 var ident = $(this).attr('id');
96 if($('#' + ident).length == 0) {
97 $('img',this).each(function() {
98 $(this).attr('src',$(this).attr('dst'));
100 $('#' + prev).after($(this));
104 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
105 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
106 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
107 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
108 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
109 $(this).attr('src',$(this).attr('dst'));
116 $('.like-rotator').hide();
121 function confirmDelete() {
122 return confirm("Delete this item?");
125 function imgbright(node) {
126 $(node).attr("src",$(node).attr("src").replace('hide','show'));
127 $(node).css('width',24);
128 $(node).css('height',24);
131 function imgdull(node) {
132 $(node).attr("src",$(node).attr("src").replace('show','hide'));
133 $(node).css('width',16);
134 $(node).css('height',16);
137 // Since ajax is asynchronous, we will give a few seconds for
138 // the first ajax call (setting like/dislike), then run the
139 // updater to pick up any changes and display on the page.
140 // The updater will turn any rotators off when it's done.
141 // This function will have returned long before any of these
142 // events have completed and therefore there won't be any
143 // visible feedback that anything changed without all this
144 // trickery. This still could cause confusion if the "like" ajax call
145 // is delayed and NavUpdate runs before it completes.
147 function dolike(ident,verb) {
148 $('#like-rotator-' + ident.toString()).show();
149 $.get('like/' + ident.toString() + '?verb=' + verb );
150 if(timer) clearTimeout(timer);
151 timer = setTimeout(NavUpdate,3000);