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 $(document).ready(function() {
29 $.ajaxSetup({cache: false});
30 msie = $.browser.msie ;
33 // Allow folks to stop the ajax page updates with the pause/break key
34 $(document).keypress(function(event) {
35 if(event.keyCode == '19') {
36 event.preventDefault();
37 if(stopped == false) {
39 $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
52 $('.sparkle').css({cursor: 'pointer'});
56 $('.sparkle').css({cursor: 'crosshair'});
59 setTimeout(sparkler,500);
63 function NavUpdate() {
65 if($('#live-network').length) { src = 'network'; liveUpdate(); }
66 if($('#live-profile').length) { src = 'profile'; liveUpdate(); }
69 $.get("ping",function(data) {
70 $(data).find('result').each(function() {
71 var net = $(this).find('net').text();
72 if(net == 0) { net = ''; }
73 $('#net-update').html(net);
74 var home = $(this).find('home').text();
75 if(home == 0) { home = ''; }
76 $('#home-update').html(home);
77 var mail = $(this).find('mail').text();
78 if(mail == 0) { mail = ''; }
79 $('#mail-update').html(mail);
80 var intro = $(this).find('intro').text();
81 if(intro == 0) { intro = ''; }
82 $('#notify-update').html(intro);
86 timer = setTimeout(NavUpdate,30000);
90 function liveUpdate() {
91 if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').hide(); return; }
92 if($('.comment-edit-text-full').length) {
93 livetime = setTimeout(liveUpdate, 10000);
98 $.get('update_' + src + '?p=' + profile_uid + '&msie=' + ((msie) ? 1 : 0),function(data) {
99 $('.wall-item-outside-wrapper',data).each(function() {
100 var ident = $(this).attr('id');
101 if($('#' + ident).length == 0) {
102 $('img',this).each(function() {
103 $(this).attr('src',$(this).attr('dst'));
105 $('#' + prev).after($(this));
109 $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
110 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
111 $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
112 $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
113 $('#' + ident + ' ' + '.my-comment-photo').each(function() {
114 $(this).attr('src',$(this).attr('dst'));
121 $('.like-rotator').hide();
126 function imgbright(node) {
127 $(node).attr("src",$(node).attr("src").replace('hide','show'));
128 $(node).css('width',24);
129 $(node).css('height',24);
132 function imgdull(node) {
133 $(node).attr("src",$(node).attr("src").replace('show','hide'));
134 $(node).css('width',16);
135 $(node).css('height',16);
138 // Since our ajax calls are asynchronous, we will give a few
139 // seconds for the first ajax call (setting like/dislike), then
140 // run the updater to pick up any changes and display on the page.
141 // The updater will turn any rotators off when it's done.
142 // This function will have returned long before any of these
143 // events have completed and therefore there won't be any
144 // visible feedback that anything changed without all this
145 // trickery. This still could cause confusion if the "like" ajax call
146 // is delayed and NavUpdate runs before it completes.
148 function dolike(ident,verb) {
149 $('#like-rotator-' + ident.toString()).show();
150 $.get('like/' + ident.toString() + '?verb=' + verb );
151 if(timer) clearTimeout(timer);
152 timer = setTimeout(NavUpdate,3000);
155 function getPosition(e) {
156 var cursor = {x:0, y:0};
157 if ( e.pageX || e.pageY ) {
162 if( e.clientX || e.clientY ) {
163 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
164 cursor.y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
176 var lockvisible = false;
178 function lockview(event,id) {
179 event = event || window.event;
180 cursor = getPosition(event);
186 $.get('lockview/' + id, function(data) {
187 $('#panel').html(data);
188 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
194 function lockviewhide() {