Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
+83
-195
@@ -13,6 +13,8 @@ _profile.prototype.profile = {
|
||||
activeTab: '',
|
||||
viewingProfile: 0,
|
||||
customization: 0,
|
||||
defaultComment: '',
|
||||
statusInit: false,
|
||||
|
||||
init: function()
|
||||
{
|
||||
@@ -35,18 +37,6 @@ _profile.prototype.profile = {
|
||||
*/
|
||||
initEvents: function()
|
||||
{
|
||||
if( $('comment_text') && $('char_remain') ){
|
||||
$('comment_text').observe('keyup', ipb.profile.checkCommentLength);
|
||||
}
|
||||
|
||||
$$('.tab_toggle').each( function(elem){
|
||||
$(elem).observe('click', ipb.profile.changeTabContent );
|
||||
});
|
||||
|
||||
if( $('commentForm') ){
|
||||
$('commentForm').observe('submit', ipb.profile.saveComment );
|
||||
}
|
||||
|
||||
if( $('friend_toggle') ){
|
||||
$('friend_toggle').observe('click', ipb.profile.toggleFriendStatus );
|
||||
}
|
||||
@@ -55,15 +45,90 @@ _profile.prototype.profile = {
|
||||
$('dname_history').observe('click', ipb.profile.showDNameHistory );
|
||||
}
|
||||
|
||||
if( $('view-all-friends') )
|
||||
{
|
||||
if( $('view-all-friends') ){
|
||||
$('view-all-friends').observe('click', ipb.profile.retrieveFriends );
|
||||
}
|
||||
|
||||
ipb.delegate.register('.delete_comment', ipb.profile.deleteComment );
|
||||
ipb.delegate.register('.tab_toggle', ipb.profile.changeTabContent );
|
||||
|
||||
/*ipb.delegate.register('.bbc_spoiler_show', ipb.global.toggleSpoiler);*/
|
||||
},
|
||||
|
||||
changeTabContent: function(e, elem)
|
||||
{
|
||||
Event.stop(e);
|
||||
var id = elem.id.replace('tab_link_', '');
|
||||
if( !id || id.blank() ){ return; }
|
||||
|
||||
if( !$('pane_' + id) )
|
||||
{
|
||||
new Ajax.Request( ipb.vars['base_url'] + 'app=members§ion=load&module=ajax&member_id=' + ipb.profile.viewingProfile + '&tab=' + id + '&md5check=' + ipb.vars['secure_hash'],
|
||||
{
|
||||
method: 'post',
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( t.responseText == 'nopermission' )
|
||||
{
|
||||
alert( ipb.lang['no_permission'] );
|
||||
return;
|
||||
}
|
||||
|
||||
if( t.responseText != 'error' )
|
||||
{
|
||||
var newdiv = new Element('div', { 'id': 'pane_' + id } ).hide().update( t.responseText );
|
||||
$('profile_panes_wrap').insert( newdiv );
|
||||
|
||||
ipb.profile.togglePanes( id );
|
||||
|
||||
if( id == 'members:status' && !ipb.profile.statusInit ){
|
||||
ipb.status.initEvents();
|
||||
ipb.profile.statusInit = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( ipb.lang['action_failed'] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
ipb.profile.togglePanes( id );
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
togglePanes: function( newid )
|
||||
{
|
||||
var currentID = $('profile_tabs').select(".active")[0].id.replace('tab_link_', '');
|
||||
var currentPane = $('pane_' + currentID);
|
||||
|
||||
var newPane = $('pane_' + newid);
|
||||
|
||||
var curHeight = $(currentPane).measure('height');
|
||||
var newHeight = $(newPane).measure('height');
|
||||
|
||||
// Hide current one
|
||||
$('profile_panes_wrap').setStyle( { height: curHeight + "px" } );
|
||||
$( currentPane ).absolutize();
|
||||
new Effect.Fade( $( currentPane ), { duration: 0.2 } );
|
||||
|
||||
// Resize container
|
||||
new Effect.Morph( $('profile_panes_wrap'), { style: 'height: ' + newHeight + 'px', duration: 0.2, afterFinish: function(){
|
||||
new Effect.Appear( newPane, { duration: 0.2, afterFinish: function(){
|
||||
ipb.profile.executeJavascript( $( newPane ) );
|
||||
$('profile_panes_wrap').setStyle( { height: 'auto' } );
|
||||
$( currentPane ).setStyle( { position: 'static', height: 'auto' } );
|
||||
} } );
|
||||
} } );
|
||||
|
||||
$('profile_tabs').select(".tab_toggle").invoke("removeClassName", "active");
|
||||
$('tab_link_' + newid).addClassName('active');
|
||||
},
|
||||
|
||||
/**
|
||||
* Resize and set BG image
|
||||
*/
|
||||
@@ -71,16 +136,10 @@ _profile.prototype.profile = {
|
||||
{
|
||||
var main = $('main_profile_body');
|
||||
|
||||
$('userBg').setStyle( { 'height': main.getHeight() + 'px' } );
|
||||
|
||||
},
|
||||
|
||||
deleteComment: function(e, elem)
|
||||
{
|
||||
if( !confirm( ipb.lang['delete_confirm'] ) )
|
||||
if ( $('userBg') )
|
||||
{
|
||||
Event.stop(e);
|
||||
}
|
||||
$('userBg').setStyle( { 'height': main.getHeight() + 'px' } );
|
||||
}
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
@@ -199,159 +258,7 @@ _profile.prototype.profile = {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
saveComment: function(e)
|
||||
{
|
||||
if( DISABLE_AJAX )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !$('comment_text') ){ Event.stop(e); return; }
|
||||
|
||||
// Check for comment
|
||||
if( $F('comment_text').blank() )
|
||||
{
|
||||
alert( ipb.lang['prof_comment_empty'] );
|
||||
Event.stop(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if( $('comment_submit') )
|
||||
{
|
||||
$('comment_submit').disabled = true;
|
||||
}
|
||||
|
||||
// Check we have a comment list; if not, we'll do a proper submit
|
||||
if( !$('comment_list') ){
|
||||
return;
|
||||
} else {
|
||||
Event.stop(e);
|
||||
}
|
||||
|
||||
new Ajax.Request( ipb.vars['base_url'] + 'app=members§ion=comments&module=ajax&do=add&member_id=' + ipb.profile.viewingProfile + '&md5check=' + ipb.vars['secure_hash'],
|
||||
{
|
||||
method: 'post',
|
||||
parameters: {
|
||||
'comment': $F('comment_text').encodeParam()
|
||||
},
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( $('comment_submit') )
|
||||
{
|
||||
$('comment_submit').disabled = false;
|
||||
}
|
||||
|
||||
//Check for errors
|
||||
if( t.responseText == 'nopermission' )
|
||||
{
|
||||
alert( ipb.lang['prof_comment_perm'] );
|
||||
return;
|
||||
}
|
||||
else if( t.responseText == 'error-no-comment' )
|
||||
{
|
||||
alert(ipb.lang['prof_comment_empty']);
|
||||
return;
|
||||
}
|
||||
else if( t.responseText == 'error' )
|
||||
{
|
||||
alert(ipb.lang['action_failed']);
|
||||
return;
|
||||
}
|
||||
else if( t.responseText == 'pp_comment_added_mod' )
|
||||
{
|
||||
alert( ipb.lang['prof_comment_mod'] );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('comment_innerwrap').update( t.responseText );
|
||||
$('commentForm').reset();
|
||||
$('comment_wrap').scrollTo();
|
||||
|
||||
if( $('comment_list').select(':first-child')[0] )
|
||||
{
|
||||
new Effect.Highlight( $('comment_list').select(':first-child')[0], { startcolor: ipb.vars['highlight_color'], delay: 0.3 } );
|
||||
}
|
||||
|
||||
ipb.profile.checkCommentLength();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
changeTabContent: function(e)
|
||||
{
|
||||
Event.stop(e);
|
||||
elem = Event.findElement(e, 'li');
|
||||
if( !elem.hasClassName('tab_toggle') || !elem.id ){ return; }
|
||||
id = elem.id.replace('tab_link_', '');
|
||||
if( !id || id.blank() ){ return; }
|
||||
if( !$('tab_content') ){ return; }
|
||||
|
||||
if( ipb.profile.activeTab == id )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
oldTab = ipb.profile.activeTab;
|
||||
ipb.profile.activeTab = id;
|
||||
|
||||
// OK, we should have an ID. Does it exist already?
|
||||
|
||||
if( !$('tab_' + id ) )
|
||||
{
|
||||
new Ajax.Request( ipb.vars['base_url'] + 'app=members§ion=load&module=ajax&member_id=' + ipb.profile.viewingProfile + '&tab=' + id + '&md5check=' + ipb.vars['secure_hash'],
|
||||
{
|
||||
method: 'post',
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( t.responseText == 'nopermission' )
|
||||
{
|
||||
alert( ipb.lang['no_permission'] );
|
||||
return;
|
||||
}
|
||||
|
||||
if( t.responseText != 'error' )
|
||||
{
|
||||
newdiv = new Element('div', { 'id': 'tab_' + id } ).hide();
|
||||
newdiv.addClassName( 'tab_' + id.replace( ':', '_' ) );
|
||||
|
||||
newdiv.update( t.responseText );
|
||||
|
||||
$('tab_content').insert( newdiv );
|
||||
|
||||
new Effect.Parallel( [
|
||||
new Effect.BlindUp( $('tab_' + oldTab), { sync: true } ),
|
||||
new Effect.BlindDown( $('tab_' + ipb.profile.activeTab), { sync: true } )
|
||||
], { duration: 0.4, afterFinish: function(){ // Re-execute JS for various things in posts
|
||||
ipb.profile.executeJavascript( $( newdiv ) ); } } );
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( ipb.lang['action_failed'] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.write( "Just showing " + ipb.profile.activeTab );
|
||||
new Effect.Parallel( [
|
||||
new Effect.BlindUp( $('tab_' + oldTab), { sync: true } ),
|
||||
new Effect.BlindDown( $('tab_' + ipb.profile.activeTab), { sync: true } )
|
||||
], { duration: 0.4, afterFinish: function(){ // Re-execute JS for various things in posts
|
||||
ipb.profile.executeJavascript( $( 'tab_' + id ) ); } } );
|
||||
}
|
||||
|
||||
$$('.tab_toggle').each( function(otherelem){
|
||||
$(otherelem).removeClassName('active');
|
||||
});
|
||||
|
||||
$(elem).addClassName('active');
|
||||
},
|
||||
|
||||
|
||||
/* ------------------------------ */
|
||||
/**
|
||||
* Executes IPBs post handling JS for the topic/post tabs
|
||||
@@ -360,29 +267,10 @@ _profile.prototype.profile = {
|
||||
*/
|
||||
executeJavascript: function( wrapper )
|
||||
{
|
||||
// Image resize
|
||||
ipb.global.findImgs( wrapper );
|
||||
|
||||
//Code highlighting
|
||||
//dp.SyntaxHighlighter.HighlightAll('bbcode_code');
|
||||
prettyPrint();
|
||||
|
||||
/* if we have an opaque bg, make it fit */
|
||||
$('userBg').setStyle( { 'height': $('main_profile_body').getHeight() + 'px' } );
|
||||
|
||||
},
|
||||
|
||||
checkCommentLength: function(e)
|
||||
{
|
||||
newTotal = parseInt( ipb.vars['max_comment_length'] ) - parseInt( $F('comment_text').length );
|
||||
|
||||
if( newTotal < 0 )
|
||||
{
|
||||
$('comment_text').value = $F('comment_text').truncate( ipb.vars['max_comment_length'], '' );
|
||||
newTotal = 0;
|
||||
}
|
||||
|
||||
$('char_remain').update( newTotal );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user