function is_logged_in_user(){ if ( getCookie("searchUserID") > 0 || typeof( wgUserName ) == "string" ) { return true; } return false; } function showActions(menu, type) { if (type=="show") { $("action-menu-"+menu).style.display="block"; } else if (type=="hide") { $("action-menu-"+menu).style.display="none"; } else if (type=="minishow") { $('mini-article-actions').style.display="inline"; } else if (type=="minihide") { $('mini-article-actions').style.display="none"; } } function moreHistory(type) { new Effect.toggle('history-more', 'blind', {duration:.33, fps:32}); if (type=="less") { $('history-more-link').innerHTML = ''+getspan("More")+''; } else { var ob=''; $('history-more-link').innerHTML = '' +getspan('Less') +' ' +getspan('Type') +' ' +getspan('User') +' '; } } function showComments(result) { new Effect.toggle('comment-more-'+result, 'blind', {duration:.33, fps:32}); } function showRevision(revision, type) { new Effect.toggle('revision-text-'+revision, 'blind', {duration:.33, fps:32}); if (type=='show') { $('revision-show-'+revision).innerHTML='('+getspan("hide")+')'; } else { $('revision-show-'+revision).innerHTML='('+getspan("show")+')'; } } var show_dropdown_timer = 0; var show_dropdown_last = false; function showDropDown(el, type, parent) { if (type=="show") { if(show_dropdown_last) { show_dropdown_last.hide(); show_dropdown_last = false; } show_dropdown_last = $(el); $(el).show(); } else { $(el).hide(); show_dropdown_last = false; } } function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } function hideProfileDropDown(el) { showDropDown(el, 'hide'); } function set_header_loggedin() { if ( getCookie("searchUserID") > 0 || typeof( wgUserName ) == "string" ) { if( typeof( wgUserName ) == "string" ) un = wgUserName var login_href = "javascript:do_json_logout();"; var login_str = getspan("Logout"); var login_text = getspan('Hello')+' ' + unescape(un) + ""; document.getElementById("profile-button").style.display='inline'; document.getElementById("friends-button").style.display='inline'; // Why should the friends menu be treated differently from the profile menu? } else { var login_href = search_server_to_use+"login.html?return=" + escape(location.href); var login_str = getspan("Sign Up / Login"); var login_text = ''; document.getElementById("profile-button").style.display='none'; document.getElementById("friends-button").style.display='none'; } document.getElementById("search-login-text").innerHTML = login_text; document.getElementById("search-login").innerHTML = login_str; document.getElementById("search-login").href = login_href; if (getCookie("wikicitiesBlocked")=="true") document.getElementById("search-login-text").style.color = "#ff0000"; else document.getElementById("search-login-text").style.color = "#000000"; } function check_new_notifications() { var url = "index.php?action=ajax"; var pars = 'rs=wfCheckNewNotificationsJSON'; var sUrl = server_to_use + "/" + url + "&" + pars; var i = document.getElementById("checkNotifs"); var head = document.getElementsByTagName('head')[0]; if (i) head.removeChild(i); i = document.createElement('script'); i.setAttribute("id","checkNotifs"); i.src = sUrl; head.appendChild(i); } function check_notifications() { var url = "index.php?action=ajax"; var pars = 'rs=wfgetNotificationsJSON&rsargs[]=display_notifications&rsargs[]=' + ((ip)?ip:getCookie("searchUserName")) + "&r=" + Math.random(); var sUrl = server_to_use + "/" + url + "&" + pars; var i = document.getElementById("checkNotifs"); var head = document.getElementsByTagName('head')[0]; if (i) head.removeChild(i); i = document.createElement('script'); i.setAttribute("id","checkNotifs"); i.src = sUrl; head.appendChild(i); } var has_new_messages = false; function display_notifications(notifications) { if (notifications && notifications.notification_count) { var x=1; var output_str = "" + ((notifications.notification_count > 1) ? " " : ""); var output_str_long = ""; var title_str = ""; for (var key in notifications.types) { if (eval("notifications."+key) && eval("notifications."+key+".length")) { var the_array = eval("notifications."+key); if(key == "pokes") { for (var i=0; i" +"" + the_poke.user_name_display + " "+getspan("nudged you") +""; } title_str += " "; } else if(key=="relrequests") { for (var i=0; i" + the_array[i].user_name_display + " "+getspan("wants to be friends with you")+""; } title_str += " "; } else if(key=="messages") { has_new_messages = true; var posted_array = new Array(); var real_name_array = new Array(); var avatar_array = new Array(); for (var i=0; i1 ? "(" + posted_array[theName] + ")" : ""); output_str_long += ""; } } title_str += " "; } if (x>1) { output_str += ", "; } //output_str += eval("notifications."+key+".length") + " " + eval("notifications.types."+key) + ((eval("notifications."+key+".length")>1) ? "s" : ""); output_str += eval("notifications."+key+".length") + " " + getspan(eval("notifications.types."+key)) + ((eval("notifications."+key+".length")>1) ? "s" : ""); x++; } } output_str += ""; output_str = ""; output_str_long = "
"+getspan("Notifications") + ((notifications.notification_count > 1) ? "" : "") + "
" + output_str_long + "
"; document.getElementById("search-notifications").innerHTML = output_str_long + output_str; //set height of lightbox for IE try { var browser=navigator.appName; var b_version=navigator.appVersion; //var version=parseFloat(b_version); if ((browser=="Microsoft Internet Explorer")) { b_version_short = b_version.substring(b_version.indexOf("MSIE ")+4); b_version_short = b_version_short.substring(0,b_version_short.indexOf(";")); var version=parseFloat(b_version_short); if (version<7) { if ($("search-notifications").style.setExpression ) { // IE var temp_text = $("search-notifications").innerHTML; $("search-notifications").innerHTML = "
" + temp_text + "
"; var temp_width = $("notif-temp").offsetWidth; $("search-notifications").innerHTML = temp_text; $("search-notifications").style.width = temp_width + 'px'; $("search-notifications").style.position = 'absolute'; $("search-notifications").style.setExpression("top", "(document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight) - this.offsetHeight + 'px'"); document.body.style.backgroundImage = "url('" + search_server_to_use + "js/s.gif')"; document.body.style.backgroundAttachment = 'fixed'; } } } } catch(ex) {} if(notifications.notification_count > 1) setTimeout('setAndSwap(1)', 5000); } } function setAndSwap(collapse) { if ($('ws_notifications_big')) $('ws_notifications_big').style.height = $('ws_notifications_big').offsetHeight + "px"; swap_notif(collapse); } function swap_notif(collapse) { if (collapse ) { if ($('ws_notifications_big').style.display!='none') { new Effect.BlindUp('ws_notifications_big', {duration:0.5}); setTimeout("new Effect.BlindDown('ws_notifications_small', {duration:0.5, fps:32});", 400); } } else { new Effect.BlindUp('ws_notifications_small', {duration:0.5}); setTimeout("new Effect.BlindDown('ws_notifications_big', {duration:0.5, fps:32});", 400); } } function search_from_bar( ){ show_ads = true; window.location=search_server_to_use+'search.html#'+document.forms[0].q.value } /** @return the URL, with prepended prefix if the given URL is relative. */ function absolutize_url(prefix, url) { return /^[^:]+:\/\//.test(url) ? url : prefix + url; } /** @return HTML for one leaf menu entry. @param e - An array like this: [label, url]. */ function html_menu_entry(e) { if( !e )return; var label = e[0]; var url = absolutize_url(search_server_to_use, e[1]); return ''+getspan(label)+''; } /** @return HTML for one main menu entry, possibly including a "drop down menu" (which may actually rise up). @param e - An array like this: [label, url, id, submenu] id and submenu are optional. submenu must be an array of menu entries, suitable as html_menu_entry() arguments. */ function html_menu(e, display) { var label = e[0]; var url = absolutize_url(search_server_to_use, e[1]); var id_base= e[2]; var entries= e[3]; var id= id_base+"-more"; var mouseout= 'onmouseout="show_dropdown_timer = '+ 'setTimeout(function(){hideProfileDropDown(\''+id+'\')}, 500);"'; var behavior= ""; var menu= ""; if (undefined !== entries) { behavior= ' onmouseover="clearTimeout(show_dropdown_timer);'+ ' showDropDown(\''+id+'\', \'show\', this);"'+ mouseout; menu= '