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