/* multiple onload events */ window.addOnloadEvent = function(addToOnload) {var oldOnload;if (window.onload) {oldOnload = window.onload;window.onload = function(){oldOnload();addToOnload();};} else {window.onload = addToOnload;}} function hpm_toggle_ban_form(){ subject = document.getElementById('ban_subject'); mail = document.getElementById('ban_reason'); div = document.getElementById('ban_email_div'); check = document.getElementById('notifyUser'); if(mail.disabled == true){mail.disabled = false;subject.disabled = false;div.style.opacity='1';check.checked=true;} else{mail.disabled = true;subject.disabled = true;div.style.opacity='0.5';check.checked=false;} } function hpm_spoiler(obj) { var st = obj.getElementsByTagName('div')[2].style; st.display = (st.display == 'none' || st.display == '') ? 'block' : 'none'; /*var stb = obj.getElementsByTagName('div')[0].style; stb.borderWidth = (stb.borderWidth == '1px 1px 1px 1px' || stb.borderWidth == '') ? '1px 1px 0px 1px' : '1px 1px 1px 1px';*/ var sti = obj.getElementsByTagName('input')[0].getAttribute("class"); if(sti==null){ /*this means we are using the IE which doesn't know getAttribute("class")*/ sti = obj.getElementsByTagName('input')[0].getAttribute("className"); if(sti == 'hpm_spoiler_headinput hpm_spoiler_open') {obj.getElementsByTagName('input')[0].setAttribute("className", "hpm_spoiler_headinput hpm_spoiler_closed");}; if(sti == 'hpm_spoiler_headinput hpm_spoiler_closed') {obj.getElementsByTagName('input')[0].setAttribute("className", "hpm_spoiler_headinput hpm_spoiler_open");}; } else{ if(sti == 'hpm_spoiler_headinput hpm_spoiler_open') {obj.getElementsByTagName('input')[0].setAttribute("class", "hpm_spoiler_headinput hpm_spoiler_closed");}; if(sti == 'hpm_spoiler_headinput hpm_spoiler_closed') {obj.getElementsByTagName('input')[0].setAttribute("class", "hpm_spoiler_headinput hpm_spoiler_open");}; } } var miranus_iconbar_textarea = new Array(); function miranus_add_iconbar_textarea(textid) { miranus_iconbar_textarea.push(textid); } function togSub(element,link) { try { var timer; var pagewidth = document.getElementById('pagewidth').offsetWidth; var navheight = document.getElementById(element).offsetHeight; var listleft = document.getElementById(element).offsetLeft; var allEl = document.getElementById(element).getElementsByTagName("ul"); var el = document.getElementById(element); if (allEl.length > 0) { var actEl = allEl[0]; if(actEl.className=='nav_open') { actEl.className='nav_close'; el.onclick = "window.location='"+link+"'; return false;"; } else { actEl.className='nav_open'; el.onclick = ""; var actElWidth = actEl.offsetWidth; var topstring = parseInt(navheight)+'px'; actEl.style.top = topstring; actEl.style.zIndex = '99999'; if (listleft + actElWidth >= pagewidth) { actEl.style.right = '-1px'; } else { actEl.style.left = '-1px';} } } } catch(err) {} } function insertVideoTag(){ vid = prompt('Geben Sie die Url für das Video an. z.B \nMyVideo:\n\"http://www.myvideo.de/watch/6446450/Ball_Platzer_lol\" \n oder Youtube\n\"http://www.youtube.com/watch?v=-3hWIplHVeE\"', "http://www."); return returnTag('[Video]'+vid+'[/Video]');} function miranus_current_iconbar_textarea() { for(var i=0; i < miranus_iconbar_textarea.length; i++) { if(document.getElementById(miranus_iconbar_textarea[i])) { return document.getElementById(miranus_iconbar_textarea[i]); } } return false; } function returnTag(inTag) { insert(inTag,''); } function insert(aTag, eTag) { var input = miranus_current_iconbar_textarea(); if(input==false) { alert('No Textarea defined. Use this Javascript: miranus_add_iconbar_textarea(\'textarea_id\'); '); return false; } var scrollTop = input.scrollTop; var scrollLeft = input.scrollLeft; input.focus(); if(typeof document.selection != 'undefined') { var range = document.selection.createRange(); var insText = range.text; range.text = aTag + insText + eTag; range = document.selection.createRange(); if (insText.length == 0) { range.move('character', -eTag.length); } else { range.moveStart('character', aTag.length + insText.length + eTag.length); } range.select(); } else if(typeof input.selectionStart != 'undefined') { var start = input.selectionStart; var end = input.selectionEnd; var insText = input.value.substring(start, end); input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end); var pos; if (insText.length == 0) { pos = start + aTag.length; } else { pos = start + aTag.length + insText.length + eTag.length; } input.selectionStart = pos; input.selectionEnd = pos; } else { input.value = input.value + aTag + eTag; input.focus(); } input.scrollTop = scrollTop; input.scrollLeft = scrollLeft; } var hpm_loaded_js = new Array(); function miranus_load_js(jsuri, infooter) { /* Dynamisch weitere Javascript-Dateien zur Laufzeit nachladen */ if(!hpm_loaded_js[jsuri]) { if(infooter) { var appendto = document.getElementsByTagName("body")[0]; } else { var appendto = document.getElementsByTagName("head")[0]; } script = document.createElement('script'); script.type = 'text/javascript'; script.src = jsuri; appendto.appendChild(script); //alert(jsuri + ' wird jetzt geladen'); } hpm_loaded_js[jsuri] = true; return true; } function miranus_add_js(node,m_name) { /* Dynamisch Javascript zu einem Node hinzufügen */ var nodeid = node.getAttribute('id'); if( typeof nodeid != "string" || nodeid=="" ) { nodeid = parseInt(Math.random()*10000); node.setAttribute('id',nodeid); } //alert('node: ' + nodeid + ' mit funktion ' + m_name); if(m_name=='search_username') { if(miranus_load_js('/script_user.js')) { setTimeout('miranus_add_js_search_username(\'' + nodeid + '\')', 100) } } else return false; } function hpm_newDialog(url,width,height, formName){ if(width.indexOf('px')==-1 && width.indexOf('%')==-1){width= width+'px';} hpm_dialogwidth = width; return hpm_openDialog(url, formName); } function hpm_handleResponse() { /** Ajax Dialog anzeigen **/ if(hpm_request.readyState == 4){ /** disable page scrolling **/ if(document.documentElement && document.documentElement.scrollTop){ var oTop = document.documentElement.scrollTop; document.documentElement.scroll = "no"; document.documentElement.style.overflow = "hidden"; document.documentElement.scrollTop = oTop; } else if(document.body){ var oTop = document.body.scrollTop; document.body.scroll = "no"; document.body.style.overflow = "hidden"; document.body.scrollTop = oTop; } /** Get & Show Response **/ var response = hpm_request.responseText; var hpm_dialogDiv = document.createElement("div"); hpm_dialogDiv.setAttribute('id','hpm_dialog_div'); document.body.appendChild(hpm_dialogDiv); window.scrollTo(0, 0) hpm_dialogDiv.innerHTML = response; if((""+hpm_dialogwidth).indexOf('%') != -1){if(parseInt(hpm_dialogwidth) > 60){hpm_dialogwidth='60%';}} document.getElementById('hpm_pagebody').style.width= hpm_dialogwidth; if (navigator.appName != 'Microsoft Internet Explorer' && navigator.appName != 'Netscape') { document.getElementById('hpm_pagebody').style.maxHeight= getHeightMargin()+"px"; } else{ document.getElementById('hpm_pagebody').style.height= "auto"; } document.getElementById('hpm_pagebody').style.overflow= "auto"; /* If Trigger some javascript - no active javascript in ajax-dialog */ if(document.getElementById('miranus_loadGMapScript')) { setTimeout("miranus_loadGMapScript(document.getElementById('miranus_loadGMapScript').value, document.getElementById('miranus_loadGMapScript_api').value, document.getElementById('miranus_loadGMapScript_startX').value, document.getElementById('miranus_loadGMapScript_startY').value, parseInt(document.getElementById('miranus_loadGMapScript_startZoom').value) )",100); } } } function hpm_openDialog(url, formName) { /* Laden von url innerhalb eines Ajax Dialogs */ var params = ''; if(formName && document.forms[formName].elements) { var formdata = miranus_getFormFields(formName); params = '&' + miranus_js2post(formdata); } var params = 'openDialogRequest=true&last_location= ' + encodeURIComponent(location.href) + '&next_location=' + encodeURIComponent(url) + params; hpm_closeDialog(); hpm_request.open('POST', url); hpm_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); hpm_request.setRequestHeader("Content-length", params.length); hpm_request.setRequestHeader("Connection", "close"); hpm_request.onreadystatechange = hpm_handleResponse; hpm_request.send(params); if(navigator.appName == "Microsoft Internet Explorer"){ event.returnValue = false } return false; } function hpm_closeDialog() { if(document.getElementById('hpm_dialog_div')) { document.body.removeChild(document.getElementById('hpm_dialog_div')); } /** Enable scrolling **/ if(document.documentElement) { /* && document.documentElement.scrollTop){ */ document.documentElement.scroll = ""; document.documentElement.style.overflow = ""; } if(document.body){ document.body.scroll = ""; document.body.style.overflow = ""; } } //new progress function function checkNginxProgress(uuid){ var bar = $('#progressbar'); var percent = $('#upload_percent'); url = "/progress" + "?X-Progress-ID=" + uuid; success = function(upload) { upload = eval(upload); switch(upload.state){ case "starting": setTimeout("checkNginxProgress('"+uuid+"')",600); break; case "done": break; case "error": break; case "uploading": upload.percents = Math.floor((upload.received / upload.size)*1000)/10; bar.css({width: upload.percents+'%'}); if(percent){percent.html("("+upload.percents+"%)");} setTimeout("checkNginxProgress('"+uuid+"')",600); break; default: setTimeout("checkNginxProgress('"+uuid+"')",1000); } } $.get(url,success); } var callback_flag = false; var callback_function = ''; var hpm_upload_progress_link = ''; var hpm_upload_progress_show_elem = ''; var hpm_upload_http; function hpm_upload_start_progress(progress_link, show_elem,callback) { /* alert('init progress'); */ try{if(show_gallery){gallery_flag = true;}}catch(e){} try{if(callback){callback_flag = true;callback_function=callback;}}catch(e){} hpm_upload_progress_link = progress_link; hpm_upload_progress_show_elem = show_elem; hpm_upload_refresh_progress(); } function hpm_upload_refresh_progress() { /* gpm_request = null; */ /* hpm_request = hpm_createHttpRequestObject(); */ hpm_request.open('get', hpm_upload_progress_link); hpm_request.onreadystatechange = hpm_upload_handle_progress_response; hpm_request.send(null); /* alert('request send: ' + hpm_upload_progress_link); */ } function hpm_upload_handle_progress_response() { if(hpm_request==null) { alert('hpm_request = null'); return; } if(hpm_request.readyState == 4) { var response = hpm_request.responseText; if(response.length>0) { upload = eval(response); switch(upload.state){ case "starting": window.setTimeout("hpm_upload_refresh_progress()",600); case "done": break; case "error": break; case "uploading": var bar = document.getElementById('progressbar'); var percent = document.getElementById('upload_percent'); upload.percents = Math.floor((upload.received / upload.size)*1000)/10; bar.style.width = upload.percents+'%'; if(percent){percent.innerHTML = "("+upload.percents+"%)";} window.setTimeout("hpm_upload_refresh_progress()",600); break; default: break; } /* if(response.length>0) { var resp = eval('(' + response + ')'); var current = parseInt(resp['current']/1024) ; var total = parseInt(resp['total']/1024); var cur_percent = 100 * current / total; if(total>0 && current>0) { if(callback_flag){eval(callback_function+'('+cur_percent+');');} else{document.getElementById(hpm_upload_progress_show_elem).innerHTML = '
Status: ' + current + ' von ' + total + ' KByte hochgeladen';} } if(total>20480){ document.getElementById(hpm_upload_progress_show_elem).innerHTML = document.getElementById(hpm_upload_progress_show_elem).innerHTML + '


Achtung: Du hast zu viele oder zu große Bilder ausgewählt.
Dies wird dazu führen, dass der Upload-Vorgang nicht ordnungsgemäß abgeschlossen werden kann.

Upload neu starten';} } window.setTimeout("hpm_upload_refresh_progress()",600);*/ }else{window.setTimeout("hpm_upload_refresh_progress()",600);} } } function getHeightMargin(){ if(window.innerHeight){ h = window.innerHeight; b = (h - (h*0.2)) } else if(document.body || navigator.appName == 'Microsoft Internet Explorer'){ h = document.body.clientHeight b = (h -(h*0.3)) } else { h = document.documentElement.clientHeight; b = (h - (h*0.2)) } return parseInt(b); } function miranus_getFormFields(formName) { /* Alle Formularfelder im Formular formName in ein Javascript Array holen */ var val = new Array(); var el = document.forms[formName].elements; for(i=0;i 0 ? '[' + path.join('][') + ']' : '') + '=' + encodeURI(obj)); path.unshift(base); } path.pop(); return post_str.join('&'); } */ function hpm_createHttpRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var hpm_request = hpm_createHttpRequestObject(); var hpm_dialogwidth = 800; //var hpm_dialogheight = getHeightMargin(); function miranus_delete_integration(i_id,target_id,confirmed){ miranus_load_js('/js/jquery.js'); var jq_loaded = false; if(!confirmed){ var ich_will = window.confirm("Wollen Sie diese Verlinkung wirklich loeschen?");} try{$('test'); jq_loaded=true;}catch(e){setTimeout("miranus_delete_integration('"+i_id+"','"+target_id+"',true)",200)} if((ich_will || confirmed) && jq_loaded) { if(i_id > 0){ if(typeof(target_id) == 'undefined') { var target_id = false; } $.ajax({ type: "POST", url: '../integration_select.php', data: {del:true,target_id:target_id,i_id:i_id}, success: function(result){ window.location.reload(); } }); } else { alert('Cannot delete the Element with '+i_id); } } } function miranus_confirm_tag(name,redirect){ var c = window.confirm(name+" an dieser Stelle verlinken ?"); if(c){ document.UserForm.submit(); } else { document.UserForm.onsubmit() = false; } } function chkName(name){ if(name==""){ $("#UserError").html("Bitte Name eingeben"); return false; } else { $.ajax({ type:"POST", url: "../listUser.php", data: {chkUser:true,uname:name}, success: function(resp){ var user = eval('(' + resp + ')'); if(user['userid']>0){ return true; erg = true; //window.location.reload(); } else { $("#UserError").html("Name "+name+" nicht gefunden"); return false; } } }); } } function showDivById(id){ document.getElementById(id).style.display='block'; } function hideDivById(id){ document.getElementById(id).style.display='none'; } function ValideEmail(email){ var lookup = "^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9\.\-]+)\.[a-z]{2,4}$"; var regexp = new RegExp(lookup); return (regexp.test(email)); } function conf_ban(){ var ok = window.confirm("Dieses Mitglied wirklich sperren?"); return ok; } function FitToContent(id, maxHeight) { var text = id && id.style ? id : document.getElementById(id); if ( !text ) return; var adjustedHeight = text.clientHeight; if ( !maxHeight || maxHeight > adjustedHeight ) { adjustedHeight = Math.max(text.scrollHeight, adjustedHeight); if ( maxHeight ) adjustedHeight = Math.min(maxHeight, adjustedHeight); if ( adjustedHeight > text.clientHeight ) text.style.height = adjustedHeight + "px"; } } function xSetCookie(name,val,days){ var mydate = new Date(); d = days ? days : 3; mydate.setTime(mydate.getTime()+(d*24*60*60*1000)); var expires = "; expires="+mydate.toGMTString(); document.cookie = name+"="+val+expires+"; path=/"; } function xGetCookie(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; } var rating_request,activity_request; /*Rating Functions*/ var ratingHandler = "/ajax/ratings_api.php"; var already_rated = "Sie haben diesen Inhalt bereits bewertet"; function xRatingAction(id,what){ var r_type, c_type,c_id,re,xor_id; var action = what ? what : 'giveRating'; r_type = document.getElementById(id+'_rtype').innerHTML; c_type = document.getElementById(id+'_ctype').innerHTML; c_id = document.getElementById(id+'_cid').innerHTML; i_id = document.getElementById(id+'_iid').innerHTML; re = 1; try{xor_id = document.getElementById(id+'_xor_id').innerHTML;}catch(e){/*no xor*/ xor_id = 0;} var param_string = "action="+action+"&r_type="+r_type+"&c_type="+c_type+"&c_id="+c_id+"&re="+re+"&i_id="+i_id+"&xor_id="+xor_id; rating_request = hpm_createHttpRequestObject(); rating_request.open("POST",ratingHandler,true); rating_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); rating_request.setRequestHeader("Content-length", param_string.length); rating_request.setRequestHeader("Connection", "close"); rating_request.onreadystatechange=ratingdone; rating_request.send(param_string); } function ratingdone(){ if(rating_request.readyState == 4){ try{rdata=JSON.parse(rating_request.responseText);} catch(e){try{console.log("Error: "+ e + " Response was:"+ rating_request.responseText)}catch(e){}} if(rdata.success){location.reload();} else{if(rdata.errormsg){if(rdata.errormsg == 'own content'){alert('Sie können ihre eigenen Inhalte nicht bewerten')} else{ alert(rdata.errormsg)}}} } } function xGetActivities(id){ try{document.getElementById('xActivityFeed').getAttribute('id');}catch(e){/*Feed not active*/ return true;} var method = 'getActivities'; var last_id = id ? id : document.getElementById('xActivityFeed').children[0].getAttribute('id'); var param_string = "method="+method+"&last_id="+last_id; activity_request = hpm_createHttpRequestObject(); activity_request.open("POST","ajax/handler.php",true); activity_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); activity_request.setRequestHeader("Content-length", param_string.length); activity_request.setRequestHeader("Connection", "close"); activity_request.onreadystatechange=activityHandler; activity_request.send(param_string); } function activityHandler(){ if(activity_request.readyState == 4){ try{rdata=JSON.parse(activity_request.responseText); new_actions = rdata.actions ? rdata.actions : ""; feed = document.getElementById('xActivityFeed'); feed.innerHTML = new_actions + feed.innerHTML;} catch(e){try{console.log("Error: "+ e + " Response was:"+ activity_request.responseText)}catch(e){}} } } function updateFeedTime(cancel){ try{ feed = document.getElementById('xActivityFeed'); spans = feed.getElementsByTagName('span'); maxcount = (spans.length > 40) ? 40 : spans.length; for(var i =0; i< maxcount;i++){ curspan = spans[i]; if(curspan.getAttribute('class') == 'cur_ts'){ curtime = curspan.innerHTML; new_time = xDateFormat(curtime); curspan.previousSibling.innerHTML = new_time; } } if(!cancel){setTimeout("updateFeedTime()",60*1000);} } catch(e){} } function xDateFormat(t){ cur = t ? t : 0; if((cur+"").length<13){cur = cur * 1000}; off = timezone_user_offset ? timezone_user_offset : 0; now = new Date(); if(time_diff_to_server){curts = Date.parse(now); now.setTime (curts + time_diff_to_server);} now_s = now.getFullYear() + ' ' + (now.getMonth()+1) + ' ' + now.getDate(); today_start = Date.parse(now_s); yesterday_start = today_start - 24*60*60*1000; diff = (Date.parse(now) - cur) / 1000; if(diff < (60)){return 'vor einer Minute'} //diff kleiner als 1 minute? else if(diff < (60*30)){mins = Math.ceil(diff/60); res = 'vor %minutes Minuten'.replace("%minutes", mins); } //diff kleiner als 30 minuten? else if(cur > today_start){cur = cur + off; res = dateFormat(cur,"today");} //cur größer als today_start else if(cur > yesterday_start){cur = cur + off; res = dateFormat(cur,"yesterday");} //cur größer als yesterday_start else {cur = cur + off; res = dateFormat(cur,"norm");} //standard-formatierung: return res; } var xscriptsloaded = []; function xLoadScript(source,title) { if(!title || !source){return false;} load_url = source; if(!xscriptsloaded[title]){ xscriptsloaded[title]; var e = document.createElement('script'); e.src = load_url; e.async = false; document.documentElement.getElementsByTagName("HEAD")[0].appendChild(e); } } function xmouseX(evt) { if(!evt){evt = window.event;} if (evt.pageX) return evt.pageX; else if (evt.clientX) return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); else return null; } function xmouseY(evt) { if(!evt){evt = window.event;} if (evt.pageY) return evt.pageY; else if (evt.clientY) return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null; } function xconvert2entity(utf8_string) { var html_entity = ""; for(i=0; i<=utf8_string.length; i++) { if(utf8_string.charCodeAt(i)>127){ html_entity += "&#" + utf8_string.charCodeAt(i) + ";"; }else{html_entity += utf8_string.charAt(i);} } return html_entity; } function clearAutosave(forum,thread){ var f = forum ? forum : ''; var t = thread ? thread: ''; try{$('
');}catch(e){/*nojqery*/ return true;} if (typeof updateurl === 'undefined') { updateurl = './ajax/checkncacheNewMessage.php';} $('#messagetext').val(''); $('.autosaveinfo,#autosaveinfo,#autosave_info,.autosave_info').remove(); data = {"clear":1,"thread":t,"forum":f}; $.ajax({url : updateurl ,processData: true,contentType: "application/x-www-form-urlencoded; charset:utf-8",data: data,dataType:'json',type : "POST", success: function(res){if(res.cleared){/*done*/}} }); $('#messagetext').focus(); } function clearPNAutosave(){ try{$('
');}catch(e){/*nojqery*/ return true;} if (typeof updateurl === 'undefined') { updateurl = './ajax/checkncacheNewMessage.php';} $('#messagetext').val(''); $('.autosaveinfo,#autosaveinfo,#autosave_info,.autosave_info').remove(); var recs = []; var temprecs =$(document.forms.sendmail).find('input[name="name[]"]'); $.each(temprecs,function(){ var curval = $(this).val(); if(curval && curval.length){recs.push(curval)} }); if(!recs.length){recs=0;} data = {"clear":1,"thread":recs,"forum":"pn"}; $.ajax({url : updateurl ,processData: true,contentType: "application/x-www-form-urlencoded; charset:utf-8",data: data,dataType:'json',type : "POST", success: function(res){if(res.cleared){/*done*/}} }); $('#messagetext').focus(); } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j = this.length; i < j; i++) { if (this[i] === obj) { return i; } } return -1; } }