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"
28 var in_progress = false;
30 $(document).ready(function() {
31 $.ajaxSetup({cache: false});
33 msie = $.browser.msie ;
35 // Allow folks to stop the ajax page updates with the pause/break key
36 $(document).keypress(function(event) {
37 if(event.keyCode == '19') {
38 event.preventDefault();
39 if(stopped == false) {
41 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
48 // this is shift-home on FF, but $ on IE, disabling until I figure out why the diff.
49 // update: incompatible usage of onKeyDown vs onKeyPress
50 // if(event.keyCode == '36' && event.shiftKey == true) {
51 // if(homebase !== undefined) {
52 // event.preventDefault();
53 // document.location = homebase;
59 function NavUpdate() {
61 if($('#live-network').length) { src = 'network'; liveUpdate(); }
62 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
63 if($('#live-display').length) {
66 window.location.href=window.location.href
69 if($('#live-photos').length) {
72 window.location.href=window.location.href
77 $.get("ping",function(data) {
78 $(data).find('result').each(function() {
79 var net = $(this).find('net').text();
80 if(net == 0) { net = ''; }
81 $('#net-update').html(net);
82 var home = $(this).find('home').text();
83 if(home == 0) { home = ''; }
84 $('#home-update').html(home);
85 var mail = $(this).find('mail').text();
86 if(mail == 0) { mail = ''; }
87 $('#mail-update').html(mail);
88 var intro = $(this).find('intro').text();
89 var register = $(this).find('register').text();
90 if(intro == 0) { intro = ''; }
91 if(register != 0 && intro != '') { intro = intro+'/'+register; }
92 if(register != 0 && intro == '') { intro = '0/'+register; }
93 $('#notify-update').html(intro);
98 timer = setTimeout(NavUpdate,30000);
102 function liveUpdate() {
103 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
104 if(($('.comment-edit-text-full').length) || (in_progress)) {
105 livetime = setTimeout(liveUpdate, 10000);
108 prev = 'live-' + src;
111 $.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 imgbright(node) {
141 $(node).attr("src",$(node).attr("src").replace('hide','show'));
142 $(node).css('width',24);
143 $(node).css('height',24);
146 function imgdull(node) {
147 $(node).attr("src",$(node).attr("src").replace('show','hide'));
148 $(node).css('width',16);
149 $(node).css('height',16);
152 // Since our ajax calls are asynchronous, we will give a few
153 // seconds for the first ajax call (setting like/dislike), then
154 // run the updater to pick up any changes and display on the page.
155 // The updater will turn any rotators off when it's done.
156 // This function will have returned long before any of these
157 // events have completed and therefore there won't be any
158 // visible feedback that anything changed without all this
159 // trickery. This still could cause confusion if the "like" ajax call
160 // is delayed and NavUpdate runs before it completes.
162 function dolike(ident,verb) {
163 $('#like-rotator-' + ident.toString()).show();
164 $.get('like/' + ident.toString() + '?verb=' + verb );
165 if(timer) clearTimeout(timer);
166 timer = setTimeout(NavUpdate,3000);
170 function getPosition(e) {
171 var cursor = {x:0, y:0};
172 if ( e.pageX || e.pageY ) {
177 if( e.clientX || e.clientY ) {
178 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
179 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
191 var lockvisible = false;
193 function lockview(event,id) {
194 event = event || window.event;
195 cursor = getPosition(event);
201 $.get('lockview/' + id, function(data) {
202 $('#panel').html(data);
203 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
209 function lockviewhide() {
214 function post_comment(id) {
217 $("#comment-edit-form-" + id).serialize(),
220 $("#comment-edit-wrapper-" + id).hide();
221 $("#comment-edit-text-" + id).val('');
222 var tarea = document.getElementById("comment-edit-text-" + id);
224 commentClose(tarea,id);
225 if(timer) clearTimeout(timer);
226 timer = setTimeout(NavUpdate,10);