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 // this is shift-home on FF, but $ on IE, disabling until I figure out why the diff.
48 // if(event.keyCode == '36' && event.shiftKey == true) {
49 // if(homebase !== undefined) {
50 // event.preventDefault();
51 // document.location = homebase;
57 function NavUpdate() {
59 if($('#live-network').length) { src = 'network'; liveUpdate(); }
60 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
61 if($('#live-display').length) {
64 window.location.href=window.location.href
67 if($('#live-photos').length) {
70 window.location.href=window.location.href
75 $.get("ping",function(data) {
76 $(data).find('result').each(function() {
77 var net = $(this).find('net').text();
78 if(net == 0) { net = ''; }
79 $('#net-update').html(net);
80 var home = $(this).find('home').text();
81 if(home == 0) { home = ''; }
82 $('#home-update').html(home);
83 var mail = $(this).find('mail').text();
84 if(mail == 0) { mail = ''; }
85 $('#mail-update').html(mail);
86 var intro = $(this).find('intro').text();
87 var register = $(this).find('register').text();
88 if(intro == 0) { intro = ''; }
89 if(register != 0 && intro != '') { intro = intro+'/'+register; }
90 if(register != 0 && intro == '') { intro = '0/'+register; }
91 $('#notify-update').html(intro);
96 timer = setTimeout(NavUpdate,30000);
100 function liveUpdate() {
101 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
102 if(($('.comment-edit-text-full').length) || (in_progress)) {
103 livetime = setTimeout(liveUpdate, 10000);
106 prev = 'live-' + src;
109 $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
111 $('.wall-item-outside-wrapper',data).each(function() {
112 var ident = $(this).attr('id');
113 if($('#' + ident).length == 0) {
114 $('img',this).each(function() {
115 $(this).attr('src',$(this).attr('dst'));
117 $('#' + prev).after($(this));
121 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
122 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
123 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
124 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
125 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
126 $(this).attr('src',$(this).attr('dst'));
133 $('.like-rotator').hide();
138 function imgbright(node) {
139 $(node).attr("src",$(node).attr("src").replace('hide','show'));
140 $(node).css('width',24);
141 $(node).css('height',24);
144 function imgdull(node) {
145 $(node).attr("src",$(node).attr("src").replace('show','hide'));
146 $(node).css('width',16);
147 $(node).css('height',16);
150 // Since our ajax calls are asynchronous, we will give a few
151 // seconds for the first ajax call (setting like/dislike), then
152 // run the updater to pick up any changes and display on the page.
153 // The updater will turn any rotators off when it's done.
154 // This function will have returned long before any of these
155 // events have completed and therefore there won't be any
156 // visible feedback that anything changed without all this
157 // trickery. This still could cause confusion if the "like" ajax call
158 // is delayed and NavUpdate runs before it completes.
160 function dolike(ident,verb) {
161 $('#like-rotator-' + ident.toString()).show();
162 $.get('like/' + ident.toString() + '?verb=' + verb );
163 if(timer) clearTimeout(timer);
164 timer = setTimeout(NavUpdate,3000);
168 function getPosition(e) {
169 var cursor = {x:0, y:0};
170 if ( e.pageX || e.pageY ) {
175 if( e.clientX || e.clientY ) {
176 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
177 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
189 var lockvisible = false;
191 function lockview(event,id) {
192 event = event || window.event;
193 cursor = getPosition(event);
199 $.get('lockview/' + id, function(data) {
200 $('#panel').html(data);
201 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
207 function lockviewhide() {