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 var udargs = ((netargs.length) ? '/' + netargs : '');
112 var update_url = 'update_' + src + udargs + '?p=' + profile_uid + '&page=' + profile_page + '&msie=' + ((msie) ? 1 : 0);
114 $.get(update_url,function(data) {
116 $('.wall-item-outside-wrapper',data).each(function() {
117 var ident = $(this).attr('id');
118 if($('#' + ident).length == 0) {
119 $('img',this).each(function() {
120 $(this).attr('src',$(this).attr('dst'));
122 $('#' + prev).after($(this));
126 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
127 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
128 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
129 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
130 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
131 $(this).attr('src',$(this).attr('dst'));
138 $('.like-rotator').hide();
143 function imgbright(node) {
144 $(node).attr("src",$(node).attr("src").replace('hide','show'));
145 $(node).css('width',24);
146 $(node).css('height',24);
149 function imgdull(node) {
150 $(node).attr("src",$(node).attr("src").replace('show','hide'));
151 $(node).css('width',16);
152 $(node).css('height',16);
155 // Since our ajax calls are asynchronous, we will give a few
156 // seconds for the first ajax call (setting like/dislike), then
157 // run the updater to pick up any changes and display on the page.
158 // The updater will turn any rotators off when it's done.
159 // This function will have returned long before any of these
160 // events have completed and therefore there won't be any
161 // visible feedback that anything changed without all this
162 // trickery. This still could cause confusion if the "like" ajax call
163 // is delayed and NavUpdate runs before it completes.
165 function dolike(ident,verb) {
166 $('#like-rotator-' + ident.toString()).show();
167 $.get('like/' + ident.toString() + '?verb=' + verb );
168 if(timer) clearTimeout(timer);
169 timer = setTimeout(NavUpdate,3000);
173 function getPosition(e) {
174 var cursor = {x:0, y:0};
175 if ( e.pageX || e.pageY ) {
180 if( e.clientX || e.clientY ) {
181 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
182 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
194 var lockvisible = false;
196 function lockview(event,id) {
197 event = event || window.event;
198 cursor = getPosition(event);
204 $.get('lockview/' + id, function(data) {
205 $('#panel').html(data);
206 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
212 function lockviewhide() {
217 function post_comment(id) {
220 $("#comment-edit-form-" + id).serialize(),
223 $("#comment-edit-wrapper-" + id).hide();
224 $("#comment-edit-text-" + id).val('');
225 var tarea = document.getElementById("comment-edit-text-" + id);
227 commentClose(tarea,id);
228 if(timer) clearTimeout(timer);
229 timer = setTimeout(NavUpdate,10);
232 window.location.href=data.reload;