Osimo Community Forums « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Osimo Community Forums - http://getosimo.com/forums
/*
* Osimo - next-generation forum system
* Licensed under GPLv3 (GPL-LICENSE.txt)
*
* os-includes/js/ajax.js - standardized ajax functions for Osimo
*/
function checkBadChars(a)
{
for(var j = 0; j < a.length; j++)
{
if(a.charCodeAt(j)>127)
{
a = a.replace(String(a[j]),"&#" + String(a.charCodeAt(j)) + ";");
}
}
return a;
}
function submitPost(threadID)
{
if($('#osimo_postbox:visible').length==1)
{
var postContent = checkBadChars($('#osimo_postbox').attr('value'));
}
else
{
var postContent = checkBadChars(tinyMCE.get('osimo_postbox').getContent());
}
if(postContent!='')
{
var postData = {"newpost":true,"threadID":threadID,"postContent":postContent};
$.ajax({
beforeSend:function(){
if($('#osimo_postpreview').is(':visible'))
{
$('#osimo_postpreview').fadeOut('normal');
}
},
type:'POST',
url:'os-includes/ajax/post.php',
data:postData,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else if(msg=='wait')
{
alert('You must wait at least 10 seconds in between posting in order to prevent spam.');
}
else
{
$('#osimo_posts').html(msg);
$('#osimo_postbox').attr('value','');
updatePagination('thread',threadID,'last');
}
}
});
}
}
function updatePagination(page,id,activePage)
{
$('#osimo_pagination').load('os-includes/ajax/content.php',{updatePagination:true,page:page,id:id,activePage:activePage});
}
function refreshPosts(threadID)
{
$('#osimo_posts').load('os-includes/ajax/post.php',{refresh:true,threadID:threadID,page:curPostPage});
}
function postPreview()
{
if($('#osimo_postbox').length>0)
{
if($('#osimo_postbox_tbl').length>0)
{
var postContent = tinyMCE.get('osimo_postbox').getContent();
}
else
{
var postContent = $('#osimo_postbox').attr('value');
}
var url = "post.php";
}
if($('#osimo_messagepost').length>0)
{
if($('#osimo_messagepost_tbl').length>0)
{
var postContent = tinyMCE.get('osimo_messagepost').getContent();
}
else
{
var postContent = $('#osimo_messagepost').attr('value');
}
var url = "messages.php";
}
if(postContent!='')
{
var postData = {"postpreview":true,"content":postContent};
$.ajax({
type:'POST',
url:'os-includes/ajax/'+url,
data:postData,
success:function(msg){
if($('#osimo_postpreview').is(':hidden'))
{
$('#osimo_postpreview').fadeIn('normal');
}
$('#osimo_postpreview').html(msg);
}
});
}
}
function editPost(postID,threadID)
{
var postContent = escape($('#osimo_editpostcontent').attr('value'));
var postData = {"postedit":true,"postID":postID,"content":postContent};
$.ajax({
type:'POST',
url:'os-includes/ajax/post.php',
data:postData,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('#osimo_editpostbox').html('').dialog('close');
refreshPosts(threadID);
}
}
});
}
function loadPostPage(threadID,page)
{
var curLoc = String(window.location);
$.ajax({
type:'POST',
url:'os-includes/ajax/post.php',
data:'loadpage=true&threadID='+threadID+'&page='+page,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('#osimo_posts').html(msg);
curPostPage = page;
window.location = "#page="+page;
updatePagination('thread',threadID,curPostPage);
}
}
});
}
function nextPostPage(threadID)
{
if(curPostPage<totPostPages)
{
loadPostPage(threadID,curPostPage+1);
}
}
function prevPostPage(threadID)
{
if(curPostPage>1)
{
loadPostPage(threadID,curPostPage-1);
}
}
function newThread(forumID)
{
var threadTitle = $('#osimo_newthreadtitle').attr('value');
var threadDescription = $('#osimo_newthreaddescription').attr('value');
var postContent = checkBadChars(tinyMCE.get('osimo_newthreadpost').getContent());
if(postContent!=''&&threadTitle!='')
{
var postData = {"newthread":true,"forumID":forumID,"threadTitle":escape(threadTitle),"threadDescription":escape(threadDescription),"postContent":postContent};
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:postData,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else if(msg=='wait')
{
alert('You must wait at least 10 seconds in between posting in order to prevent spam.');
}
else
{
$('#osimo_threads').html(msg);
}
}
});
}
}
function deleteThread(threadID)
{
if(confirm("Are you sure you want to delete this thread?"))
{
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:'deleteThread='+threadID,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
if(confirm("Would you like to file a report?")){
window.location='os-admin/mod_panel.php?page=file&type=t_del&concerning='+threadID;
}
else{
window.location = 'index.php?thread=deleted';
}
}
}
});
}
}
function deletePost(postID)
{
if(confirm("Are you sure you want to delete this post?"))
{
$.ajax({
type:'POST',
url:'os-includes/ajax/post.php',
data:'deletePost='+postID,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
if(confirm("Would you like to file a report?")){
window.location='os-admin/mod_panel.php?page=file&type=p_del&concerning='+postID;
}
else{
refreshPosts(msg);
}
}
}
});
}
}
function moveThread(threadID, destForum)
{
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:'moveThread='+threadID+'&destForum='+destForum,
success:function(msg){
if(msg=='1')
{
if(confirm("Would you like to file a report?")){
window.location='os-admin/mod_panel.php?page=file&type=t_move&concerning='+threadID;
}
else{
window.location.reload();
}
}
else
{
alert('Thread move failed...');
}
}
});
}
function loadThreadPage(forumID,page,sticky)
{
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:'loadpage=true&forumID='+forumID+'&page='+page+'&sticky='+sticky,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('#osimo_threads').html(msg);
curThreadPage = page;
updatePagination('forum',forumID,curThreadPage);
}
}
});
}
function newMessageThread()
{
var recipient = $("#osimo_recipient").attr('value');
var threadSubj = $('#osimo_messagesubj').attr('value');
if($('#osimo_messagecontent_tbl').length>0)
{
var postContent = tinyMCE.get('osimo_messagecontent').getContent();
}
else
{
var postContent = $('#osimo_messagecontent').attr('value');
}
if(recipient!=''&&postContent!='')
{
if(threadSubj==''){ threadSubj = 'No Subject'; }
$.ajax({
type:'POST',
url:'os-includes/ajax/messages.php',
data:'newmessage=true&recipient='+escape(recipient)+'&subj='+escape(threadSubj)+'&content='+escape(postContent),
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('#osimo_messages').html(msg);
}
}
});
}
}
function newMessagePost(threadID)
{
if($('#osimo_newmessagepost_tbl').length>0)
{
var postContent = tinyMCE.get('osimo_newmessagepost').getContent();
}
else
{
var postContent = $('#osimo_messagepost').attr('value');
}
if(postContent!='')
{
$.ajax({
beforeSend:function(){
if($('#osimo_postpreview').is(':visible'))
{
$('#osimo_postpreview').fadeOut('normal');
}
},
type:'POST',
url:'os-includes/ajax/messages.php',
data:'newmessagepost=true&thread='+threadID+'&content='+escape(postContent),
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('#osimo_messageposts').html(msg);
}
}
});
}
}
function showInboxMessages()
{
$.ajax({
type:'POST',
url:'os-includes/ajax/messages.php',
data:'refreshMessages=true&which=inbox',
success:function(msg){
if(msg=='0')
{
alert('Error !')
}
else
{
$('#osimo_messages').html(msg);
}
}
});
}
function showSentMessages()
{
$.ajax({
type:'POST',
url:'os-includes/ajax/messages.php',
data:'refreshMessages=true&which=sent',
success:function(msg){
if(msg=='0')
{
alert('Error !')
}
else
{
$('#osimo_messages').html(msg);
}
}
})
}
function stickyThread(id,sticky)
{
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:'threadID='+id+'&sticky='+sticky,
success:function(msg){
if(msg=='0')
{
alert('Error !');
}
else
{
if(confirm("Would you like to file a report?")){
window.location='os-admin/mod_panel.php?page=file&type=t_sticky&concerning='+id;
}
else {
window.location.reload();
}
}
}
});
}
function lockThread(id,lock)
{
$.ajax({
type:'POST',
url:'os-includes/ajax/thread.php',
data:'threadID='+id+'&lock='+lock,
success:function(msg){
if(msg=='0')
{
alert('Error !');
}
else
{
if(confirm("Would you like to file a report?")){
window.location='os-admin/mod_panel.php?page=file&type=t_lock&concerning='+id;
}
else{
window.location.reload();
}
}
}
});
}
function updateProfile(section)
{
if(section=='info')
{
var data = $('#osimo_profile_info').serialize();
}
if(section=='contact')
{
var data = $('#osimo_profile_contact').serialize();
}
if(section=='bio')
{
var data = $('#osimo_profile_bio_container').serialize();
}
if(section=='sig')
{
var data = $('#osimo_profile_sig_container').serialize();
}
$.ajax({
type:'POST',
url:'os-includes/ajax/user.php',
data:'section='+section+'&'+data,
success:function(msg){
if(msg=='0')
{
alert('Error!');
}
else
{
$('.ui-dialog-title').fadeOut('slow',function(){
$(this).html('Profile Updated!').fadeIn('slow');
});
var timer = setTimeout(function(){
$('.ui-dialog-title').fadeOut('slow',function(){
$(this).html('Edit Profile').fadeIn('slow');
});
},4000);
if(section=='sig')
{
$('#osimo_profile_sig_preview').html(msg);
}
}
}
});
}
function resetPassword(step,type)
{
var valid = true;
var data = 'content=forgotpassword&step='+step+'&type='+type;
if(step==1&&type==1)
{
var user = $('#osimo_forgotpass_username').attr('value');
data += '&user='+user;
}
if(step==1&&type==2)
{
var email = $('#osimo_forgotpass_email').attr('value');
data += '&email='+email;
}
if(step==2)
{
var code = $('#osimo_forgotpass_code').attr('value');
var pass1 = $('#osimo_forgotpass_newpass1').attr('value');
var pass2 = $('#osimo_forgotpass_newpass2').attr('value');
if(pass1!=pass2){ valid = false; }
data += '&code='+code+'&pass1='+pass1+'&pass2='+pass2;
}
if(valid)
{
$.ajax({
type:'POST',
url:'os-includes/ajax/content.php',
data:data,
success:function(msg){
if(msg!='0')
{
if(msg=='pass')
{
alert("The passwords entered do not match");
}
else if(msg=='code')
{
alert("The code entered is not correct, please try again");
}
else
{
$('#osimo_forgotpasswordbox').html(msg).show();
var height = $(this).height();
var width = $(this).width();
$("#osimo_forgotpassword").css({'width':width+"px",'height':height+"px"});
}
}
else
{
if(step=='1'&&type=='1')
{
alert('That username is not recognized, please try again.');
}
if(step=='1'&&type=='2')
{
alert('That email address is not recognized, please try again.');
}
}
}
});
}
}
function updatePersonalInfo()
{
var displayName = escape($('#osimo_usercp_displayname').attr('value'));
var email = escape($('#osimo_usercp_emailaddr').attr('value'));
var timeZone = escape($('#osimo_usercp_timezone').attr('value'));
if(displayName=='')
{
alert("You must enter a display name");
}
if(email=='')
{
alert("You must enter a valid email address");
}
if(timeZone == '')
{
alert("You must pick a time zone");
}
var curPassword = escape($('#osimo_usercp_curpassword').attr('value'));
var newPassword = escape($('#osimo_usercp_newpassword').attr('value'));
var newPassword2 = escape($('#osimo_usercp_newpassword2').attr('value'));
if(curPassword!=''&&newPassword!=''&&newPassword2!='')
{
var data = "updatepersonal=true&displayName="+displayName+"&email="+email+"&timeZone="+timeZone+"&curPassword="+curPassword+"&newPassword="+newPassword+"&newPassword2="+newPassword2;
}
else
{
var data = "updatepersonal=true&displayName="+displayName+"&email="+email+"&timeZone="+timeZone;
}
$.ajax({
type:'POST',
url:'os-includes/ajax/user.php',
data:data,
success:function(msg){
if(msg=='passmismatch'){ alert('The passwords entered do not match'); }
else if(msg=='passincorrect'){ alert('The current password entered is not correct.'); }
else if(msg=='1'||msg=='11')
{
$('#osimo_usercp_curpassword').attr('value','');
$('#osimo_usercp_newpassword').attr('value','');
$('#osimo_usercp_newpassword2').attr('value','');
$('.ui-dialog-title').fadeOut('slow',function(){
$(this).html('User Settings Updated!').fadeIn('slow');
});
var timer = setTimeout(function(){
$('.ui-dialog-title').fadeOut('slow',function(){
$(this).html('User Control Panel').fadeIn('slow');
});
},4000);
}
else{ alert('There was an error processing your request'); }
}
});
}
function warnUser(user,postID)
{
/*
$.ajax({
type:'POST',
url:'os-includes/ajax/user.php',
data:'warnuser='+userID+'&warnpost='+postID,
success:function(msg){
if(msg=='1'){ alert("User warned successfully."); }
else{ alert("Either you do not have admin/mod permissions or warn failed."); }
}
});*/
document.location = 'os-admin/mod_panel.php?page=file&type=warning&against='+user+'&concerning='+postID;
}
/*
* Osimo - next-generation forum system
* Licensed under GPLv3 (GPL-LICENSE.txt)
*
* os-includes/js/backend.js - non-ajax functions for Osimo
*/
$(window).ready(function(){
if($('.osimo_usernamesearch').length>0)
{
$('.osimo_usernamesearch').autocomplete('os-includes/ajax/usersearch.php',{
selectFirst: false,
minChars: 2
});
/* Check to see if we're viewing the inbox */
if(String(window.location).indexOf('messages.php')!=-1)
{
if(String(window.location).indexOf('sendto=')!=-1)
{
/* We have a username entered in the URL, lets get it */
var temp1 = String(window.location).split('sendto=');
var temp2 = temp1[1].split('&'); //makes sure there aren't other GET variables in the way
var getName = temp2[0];
$('.osimo_usernamesearch').attr('value',getName);
}
}
}
});
function ajaxBookmark()
{
var curUrl = new String(window.location);
if(curUrl.indexOf('#')==-1)
{
return false;
}
else
{
var temp = curUrl.split('#');
if(temp.length==2){ return temp[1]; }
else
{
var splitUrl = temp[1].split('&');
return splitUrl;
}
}
}
function forgotPassword()
{
if($('#osimo_forgotpasswordbox').length==0)
{
$('body').prepend("<div id=\"osimo_forgotpasswordbox\"></div>");
}
$('#osimo_forgotpasswordbox').dialog({
title: 'Forgot Password',
modal: true,
resizable:false,
overlay: {
opacity: 0.5,
background: "black"
},
height: '400px',
width: '550px',
close:function(){
$(this).dialog('destroy');
},
open:function(){
resetPassword(0,0);
}
});
}
function BBHelp()
{
if($('#osimo_bbhelpbox').length==0)
{
$('body').prepend("<div id=\"osimo_bbhelpbox\"></div>");
}
$("#osimo_bbhelpbox").dialog({
title: 'BBCode Help',
resizable: true,
height: 450,
width: 600,
close:function(){
$(this).dialog('destroy');
},
open:function(){
$.ajax({
type:'POST',
url:'os-includes/ajax/content.php',
data:'content=bbhelp',
success:function(msg){
if(msg!='0')
{
$('#osimo_bbhelpbox').html(msg).show();
}
else
{
$('#osimo_bbhelpbox').dialog('destroy');
}
}
});
}
});
}
function editPostBox(postID)
{
if($("#osimo_editpostbox").length==0)
{
$('body').prepend("<div id=\"osimo_editpostbox\"></div>");
}
$("#osimo_editpostbox").dialog({
title: 'Edit Post',
resizable: true,
height: 345,
width: 400,
resize:function(){
var height = $('#osimo_editpostbox').height();
var width = $('#osimo_editpostbox').width();
$("#osimo_editpostcontent").css({'width':width-20+"px",'height':height-50+"px"});
},
close:function(){
$(this).dialog('destroy');
},
open:function(){
$.ajax({
type:'POST',
url:'os-includes/ajax/content.php',
data:'content=editpostbox&postID='+postID,
success:function(msg){
if(msg!='0')
{
$('#osimo_editpostbox').html(msg).show();
var height = $('#osimo_editpostbox').height();
var width = $('#osimo_editpostbox').width();
$("#osimo_editpostcontent").css({'width':width-20+"px",'height':height-50+"px"});
}
else
{
$('#osimo_editpostbox').dialog('destroy');
}
}
});
}
});
}
function editProfile(userID)
{
if($("#osimo_editprofilebox").length==0)
{
$('body').prepend("<div id=\"osimo_editprofilebox\"></div>");
}
$("#osimo_editprofilebox").dialog({
title: 'Edit Profile',
modal: true,
resizable:false,
overlay: {
opacity: 0.5,
background: "black"
},
height: 500,
width: 670,
open:function(){
$.ajax({
type:'POST',
url:'os-includes/ajax/content.php',
data:'content=editprofilebox&userID='+userID,
success:function(msg){
if(msg!='0')
{
$('#osimo_editprofilebox').html(msg).show();
}
else
{
$(this).dialog('destroy');
}
}
});
},
close:function(){
$(this).dialog('destroy');
}
});
}
function showMemberList()
{
getMemberList(-1,-1,-1,-1);
}
var curMemberPage = 1;
var curMemberNum = 15;
var curMemberSort = 'id';
var curMemberSortDir = 'ASC';
function getMemberList(page,num,sort,dir)
{
var totPages = Number($('#osimo_memberlist-totpage').html());
if(page==-1){ page = curMemberPage; }
else if(page=='first'){ curMemberPage = 1; page = 1; }
else if(page=='prev')
{
if(curMemberPage>1)
{
curMemberPage = curMemberPage-1; page = curMemberPage;
}
else
{
page = curMemberPage;
}
}
else if(page=='next')
{
if(curMemberPage<totPages)
{
curMemberPage = curMemberPage+1; page = curMemberPage;
}
else
{
page = curMemberPage;
}
}
else if(page=='last'){ curMemberPage = totPages; page = curMemberPage; }
else{ curMemberPage = page; }
if(num==-1){ num = curMemberNum; }
else{ curMemberNum = num; }
if(sort==-1){ sort = curMemberSort; }
else{ curMemberSort = sort; }
if(dir==-1){ dir = curMemberSortDir; }
else if(dir==-2)
{
if(curMemberSortDir=='ASC'&&sort==curMemberSort){ curMemberSortDir = 'DESC'; }
else if(curMemberSortDir=='DESC'&&sort==curMemberSort){ curMemberSortDir = 'ASC'; }
dir = curMemberSortDir;
}
else{ curMemberSortDir = dir; }
if($("#osimo_memberlistbox").length==0)
{
$('body').prepend("<div id=\"osimo_memberlistbox\" style='display:none'></div>");
}
if($('#osimo_memberlistbox:visible').length==0)
{
$("#osimo_memberlistbox").dialog({
title: 'Memberlist',
modal: true,
overlay: {
opacity: 0.5,
background: "black"
},
resizable:false,
height: 480,
width: 700,
open:function(){
$.ajax({
type:'POST',
url:'os-includes/ajax/user.php',
data:'memberlist=true&page='+page+'&num='+num+'&sort='+sort+'&sortDir='+dir,
success:function(msg){
if(msg!='0')
{
$('#osimo_memberlistbox').html(msg).show();
totPages = Number($('#osimo_memberlist-totpage').html());
}
else
{
$('#osimo_memberlistbox').dialog('destroy');
}
}
});
},
close:function(){
$(this).dialog('destroy');
}
});
}
else
{
$.ajax({
type:'POST',
url:'os-includes/ajax/user.php',
data:'memberlist=true&page='+page+'&num='+num+'&sort='+sort+'&sortDir='+dir,
success:function(msg){
if(msg!='0')
{
$('#osimo_memberlistbox').html(msg).show();
totPages = Number($('#osimo_memberlist-totpage').html());
}
else
{
$('#osimo_memberlistbox').dialog('close');
}
}
});
}
}
function userCP()
{
if($("#osimo_usercpbox").length==0)
{
$('body').prepend("<div id=\"osimo_usercpbox\"></div>");
}
$("#osimo_usercpbox").dialog({
title: 'User Control Panel',
modal: true,
resizable:false,
overlay: {
opacity: 0.5,
background: "black"
},
height: 500,
width: 700,
open:function(){
$.ajax({
type:'POST',
url:'os-includes/ajax/content.php',
data:'content=usercpbox',
success:function(msg){
if(msg=='mustlogin')
{
$('#osimo_usercpbox').dialog('destroy');
alert('You must be logged in to use this feature!');
}
else if(msg=='0')
{
$('#osimo_usercpbox').dialog('destroy');
}
else
{
$('#osimo_usercpbox').html(msg).show();
}
}
});
},
close:function(){
$(this).dialog('destroy');
}
});
}
function showUserCPSection(which)
{
if(which=='personal')
{
$('#osimo_usercp_personal').animate({
"height": "toggle", "opacity": "toggle"
}, "slow");
}
}
function changeActiveThreadPage(page)
{
$('.osimo-active-thread-page').removeClass('osimo-active-thread-page');
$('#osimo_pagenav-'+page).addClass('osimo-active-thread-page');
}
function changeActiveForumPage(page)
{
$('.osimo-active-forum-page').removeClass('osimo-active-forum-page');
$('#osimo_pagenav-'+page).addClass('osimo-active-forum-page');
}
function quotePost(postID,username)
{
var content = $('#post-'+postID).text();
var initial = tinyMCE.get('osimo_postbox').getContent();
var newContent = "[quote="+username+"]"+content+"[/quote]"+initial;
//$('#osimo_postbox').attr('value',newContent);
tinyMCE.activeEditor.setContent(newContent,{format : 'raw'});
var offset = $('#osimo_postbox_tbl').offset();
$('html, body').animate({scrollTop:offset.top}, 'slow');
}
function setOsimoSearchQuery()
{
var type = $('#osimo_search_type').attr('value');
if(type=='postsby')
{
if(!$('#osimo_search_query').hasClass('osimo_usernamesearch'))
{
$('#osimo_search_query').autocomplete('os-includes/ajax/usersearch.php',{
selectFirst: false,
minChars: 2
}).addClass('osimo_usernamesearch');
}
}
else
{
if($('#osimo_search_query').hasClass('osimo_usernamesearch'))
{
$('#osimo_search_query').removeClass('osimo_usernamesearch').unautocomplete();
}
}
}
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.