/* Go to page */ function gotopage(url) { var page = prompt("Which page do you want to go to?"); if(page != null) { document.location = url + "/" + page; } } /* Onload */ function general_onload() { // add in 's to CSS class .menu-link-selected $('.menu-link-selected').append(''); // add in 's to CSS class .label2-arr $('.label2-arr').append(''); } /* Load User Pips */ function loaduserpip(pip) { $.get("/ajax/userpip", { t: pip }, function(data) { if(data.length == 0) { alert("I'm sorry, there was a problem. Please try again!"); } else { alert("Woot."); } }); } /* Change style */ function submitstylechange() { var newstyle = $('#styleswitch').val(); $.get("/ajax/stylechange", { id: newstyle }, function(data) { if(data.length == 0) { alert("I'm sorry, there was a problem. Please try again!"); } else { document.getElementById("style-sheet").href = "/library/css/" + data; } }); } /* Toggle invisibility */ function toggleInvisible() { $('#invisible-icon').attr('src', '/library/img/load2.gif'); $.get("/ajax/invisible", function(data) { if(data == 0) { $('#invisible-icon').attr('src', '/library/icons/status.png') $('#invisible-text').html('Online'); } else { $('#invisible-icon').attr('src', '/library/icons/status-offline.png') $('#invisible-text').html('Invisible'); } }); } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } /* * Refresh quick bar */ function togglequickbar(id) { $('#ql-check-' + id).toggle(); $('#ql-load-' + id).toggle(); $.get("/ajax/quickbar", { id: id }, function(data) { if(data.success == 1) { $('#ql-check-' + id).toggle(); $('#ql-load-' + id).toggle(); $('#ql-' + id).toggle(); } else { alert(data.error); } }, "json"); } /** * Post preeviews */ /** * Adds a new method to all string objects - trims leading and trailing whitespace * * Electron | 2008-12-15 @ 19:52 */ String.prototype.trim = function() { return this.replace(/^\s+|\n+$/g,""); } /* Load Affiliate Images function affload(){ var counter = 0; imagePreload = new Image(); preloadImages = new Array(); $.getJSON("/ajax.php", {t: "aff"}, function(json){ $.each(json.affiliates, function(i, affiliate){ preloadImages[i] = json.affiliates[i][0]; alert(json.affiliates[i][0];+"|"+i) }); }); // start preloading for(i=0; i<=count(preloadImages); i++) { imagePreload.src=images[i]; } }*/ // Disables Enter key on forms function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } function close_popup_alert_box() { var d = document; d.getElementById('__alert_popupbox').style.visibility='hidden'; d.getElementById('__gray_overlay').style.visibility='hidden'; unblock_scrolling(); } function open_inbox() { window.location.href = 'http://www.eeveeshq.com/community/mail'; } function block_scrolling() { window.onscroll = function(){window.scrollTo(0,0);} } function unblock_scrolling() { window.onscroll = ''; } /* * Switch Input */ function switchinput(ele,def,empt) { if(!empt){ var empt = ""; } if (ele.value == def) { ele.value = ""; } else if (ele.value == "") { ele.value = def; } } /* * Popup */ function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=500');"); } /* * Suckerfish */ sfHover = function() { if(document.getElementById("nlist")) { var sfEls = document.getElementById("nlist").getElementsByTagName("LI"); for (var i=0; isettings.minHeight?textarea.height():settings.minHeight; var w = parseInt(textarea.width()||textarea.css("width")); //get the width of the textarea var div = $("
"); textarea.after(div); var resizeBox = function(){ var html = textarea.val().replace(/(<|>)/g, '').replace(/\n/g,"
|"); if(html!=div.html()) { div.html(html); var h = div.height(); prevh = textarea.height(); var newh = h<=minh?minh:(h>settings.maxHeight?settings.maxHeight:h); newh += settings.buffer; if(newh>=settings.maxHeight) { textarea.css("overflow","auto"); } else { textarea.css("overflow","hidden"); } textarea.css({"height":newh+"px"}); } }; textarea.keydown(resizeBox); textarea.keyup(resizeBox); resizeBox(); }); }; })(jQuery);