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});
32 msie = $.browser.msie ;
34 // Allow folks to stop the ajax page updates with the pause/break key
35 $(document).keypress(function(event) {
36 if(event.keyCode == '19') {
37 event.preventDefault();
38 if(stopped == false) {
40 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
47 if(event.keyCode == '36') {
48 event.preventDefault();
50 document.location = homebase;
55 function NavUpdate() {
57 if($('#live-network').length) { src = 'network'; liveUpdate(); }
58 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
59 if($('#live-display').length) {
62 window.location.href=window.location.href
65 if($('#live-photos').length) {
68 window.location.href=window.location.href
73 $.get("ping",function(data) {
74 $(data).find('result').each(function() {
75 var net = $(this).find('net').text();
76 if(net == 0) { net = ''; }
77 $('#net-update').html(net);
78 var home = $(this).find('home').text();
79 if(home == 0) { home = ''; }
80 $('#home-update').html(home);
81 var mail = $(this).find('mail').text();
82 if(mail == 0) { mail = ''; }
83 $('#mail-update').html(mail);
84 var intro = $(this).find('intro').text();
85 if(intro == 0) { intro = ''; }
86 $('#notify-update').html(intro);
90 timer = setTimeout(NavUpdate,30000);
94 function liveUpdate() {
95 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
96 if(($('.comment-edit-text-full').length) || (in_progress)) {
97 livetime = setTimeout(liveUpdate, 10000);
100 prev = 'live-' + src;
103 $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
105 $('.wall-item-outside-wrapper',data).each(function() {
106 var ident = $(this).attr('id');
107 if($('#' + ident).length == 0) {
108 $('img',this).each(function() {
109 $(this).attr('src',$(this).attr('dst'));
111 $('#' + prev).after($(this));
115 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
116 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
117 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
118 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
119 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
120 $(this).attr('src',$(this).attr('dst'));
127 $('.like-rotator').hide();
132 function imgbright(node) {
133 $(node).attr("src",$(node).attr("src").replace('hide','show'));
134 $(node).css('width',24);
135 $(node).css('height',24);
138 function imgdull(node) {
139 $(node).attr("src",$(node).attr("src").replace('show','hide'));
140 $(node).css('width',16);
141 $(node).css('height',16);
144 // Since our ajax calls are asynchronous, we will give a few
145 // seconds for the first ajax call (setting like/dislike), then
146 // run the updater to pick up any changes and display on the page.
147 // The updater will turn any rotators off when it's done.
148 // This function will have returned long before any of these
149 // events have completed and therefore there won't be any
150 // visible feedback that anything changed without all this
151 // trickery. This still could cause confusion if the "like" ajax call
152 // is delayed and NavUpdate runs before it completes.
154 function dolike(ident,verb) {
155 $('#like-rotator-' + ident.toString()).show();
156 $.get('like/' + ident.toString() + '?verb=' + verb );
157 if(timer) clearTimeout(timer);
158 timer = setTimeout(NavUpdate,3000);
162 function getPosition(e) {
163 var cursor = {x:0, y:0};
164 if ( e.pageX || e.pageY ) {
169 if( e.clientX || e.clientY ) {
170 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
171 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
183 var lockvisible = false;
185 function lockview(event,id) {
186 event = event || window.event;
187 cursor = getPosition(event);
193 $.get('lockview/' + id, function(data) {
194 $('#panel').html(data);
195 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
201 function lockviewhide() {