Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -15,12 +15,16 @@ _topic.prototype.topic = {
|
||||
postcache: [],
|
||||
poll: [],
|
||||
pollPopups: [],
|
||||
deletePerms: {},
|
||||
deleteUrls: {},
|
||||
deletePopUps: [],
|
||||
|
||||
init: function()
|
||||
{
|
||||
Debug.write("Initializing ips.topic.js");
|
||||
|
||||
document.observe("dom:loaded", function(){
|
||||
|
||||
if( ipb.topic.inSection == 'topicview' )
|
||||
{
|
||||
if( $('show_filters') )
|
||||
@@ -33,11 +37,25 @@ _topic.prototype.topic = {
|
||||
|
||||
// Set up delegates
|
||||
ipb.delegate.register('.multiquote', ipb.topic.toggleMultimod);
|
||||
ipb.delegate.register('.delete_post', ipb.topic.confirmSingleDelete);
|
||||
|
||||
ipb.delegate.register('.edit_post', ipb.topic.ajaxEditShow);
|
||||
ipb.delegate.register('.delete_post', ipb.topic.deletePopUp);
|
||||
ipb.delegate.register('.toggle_post', ipb.topic.ajaxTogglePostApprove);
|
||||
ipb.delegate.register('.sd_content', ipb.topic.sDeletePostShow);
|
||||
ipb.delegate.register('.sd_remove', ipb.topic.confirmSingleDelete);
|
||||
ipb.delegate.register('input.post_mod', ipb.topic.checkPost);
|
||||
ipb.delegate.register('a[rel="bookmark"]', ipb.topic.showLinkToTopic );
|
||||
|
||||
if( $('showforumJump') )
|
||||
{
|
||||
$('showforumJump').observe( "change", ipb.topic.jumpToForum );
|
||||
$('forum_jump_submit').hide();
|
||||
}
|
||||
}
|
||||
else if( ipb.topic.inSection == 'searchview' )
|
||||
{
|
||||
ipb.delegate.register('input.post_mod', ipb.topic.checkPost);
|
||||
ipb.delegate.register('.sd_content', ipb.topic.sDeletePostShow);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -47,7 +65,16 @@ _topic.prototype.topic = {
|
||||
ipb.global.findImgs( $( elem ) );
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
jumpToForum: function(e)
|
||||
{
|
||||
Event.stop(e);
|
||||
|
||||
$('forum_jump').submit();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
/**
|
||||
@@ -79,6 +106,71 @@ _topic.prototype.topic = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Show a pop-up for soft delete / delete or just redirect if no hard link
|
||||
*/
|
||||
deletePopUp: function(e, elem)
|
||||
{
|
||||
var postid = elem.up().id.replace( /del_post_/, '' );
|
||||
if( !postid ){ return; }
|
||||
|
||||
/* First off, fix URLs */
|
||||
var _url_delete = ipb.topic.deleteUrls['hardDelete'].evaluate( { 'pid': postid } ).replace(/&/g, '&') + '&nr=1';
|
||||
var _url_soft = ipb.topic.deleteUrls['softDelete'].evaluate( { 'pid': postid } ).replace(/&/g, '&') + '&nr=1';
|
||||
var _permaShow = '';
|
||||
|
||||
/* If we can't soft delete posts, then just offload to normal function */
|
||||
if ( ! ipb.topic.deletePerms[ postid ]['canSoftDelete'] )
|
||||
{
|
||||
return ipb.topic.confirmSingleDelete(e, elem);
|
||||
}
|
||||
|
||||
Event.stop(e);
|
||||
|
||||
/* Can we hard delete? */
|
||||
if ( ! ipb.topic.deletePerms[ postid ]['canDelete'] )
|
||||
{
|
||||
_permaShow = 'display:none;';
|
||||
}
|
||||
|
||||
/* Create the pop-up */
|
||||
var popid = 'pop__delete_popup_' + postid;
|
||||
var content = new Template( $('delPopUp').innerHTML ).evaluate( { removeUrl: _url_soft, permaDelete: _permaShow, permaUrl: _url_delete } );
|
||||
|
||||
ipb.topic.deletePopUps = new ipb.Popup( popid, { type: 'balloon',
|
||||
initial: content,
|
||||
stem: true,
|
||||
hideAtStart: false,
|
||||
attach: { target: $('del_post_' + postid ), position: 'auto', 'event': 'click' },
|
||||
w: '450px' });
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Show's the content of soft deleted post
|
||||
*/
|
||||
sDeletePostShow: function(e, elem)
|
||||
{
|
||||
Event.stop(e);
|
||||
|
||||
var postid = elem.id.replace( /seeContent_/, '' );
|
||||
if( !postid ){ return; }
|
||||
|
||||
if ( ! $('postsDelete_' + postid )._showing )
|
||||
{
|
||||
$('postsDelete_' + postid ).hide();
|
||||
$('postsDeleteShow_' + postid).show();
|
||||
$('postsDelete_' + postid )._showing = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('postsDelete_' + postid ).show();
|
||||
$('postsDeleteShow_' + postid).hide();
|
||||
$('postsDelete_' + postid )._showing = 0;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* MATT
|
||||
* Toggle post approval thingy majigy
|
||||
@@ -121,11 +213,19 @@ _topic.prototype.topic = {
|
||||
{
|
||||
$('post_id_' + postid).removeClassName( 'moderated' );
|
||||
$('toggletext_post_' + postid).update( ipb.lang['unapprove'] );
|
||||
|
||||
$$('#toggle_post_' + postid + " a img").each( function(elem){
|
||||
$(elem).src = $(elem).src.replace( /accept/, 'delete' );
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('post_id_' + postid).addClassName( 'moderated' );
|
||||
$('toggletext_post_' + postid).update( ipb.lang['approve'] );
|
||||
|
||||
$$('#toggle_post_' + postid + " a img").each( function(elem){
|
||||
$(elem).src = $(elem).src.replace( /delete/, 'accept' );
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,6 +242,11 @@ _topic.prototype.topic = {
|
||||
*/
|
||||
ajaxEditShow: function(e, elem)
|
||||
{
|
||||
if( DISABLE_AJAX )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// If user is holding ctrl or command, just submit since they
|
||||
// want to open a new tab (requested by Luke)
|
||||
if( e.ctrlKey == true || e.metaKey == true || e.keyCode == 91 )
|
||||
@@ -189,7 +294,7 @@ _topic.prototype.topic = {
|
||||
},
|
||||
onSuccess: function(t)
|
||||
{
|
||||
if( t.responseText == 'nopermission' || t.responseText == 'NO_POST_FORUM' || t.responseText == 'NO_EDIT_PERMS' )
|
||||
if( t.responseText == 'nopermission' || t.responseText == 'NO_POST_FORUM' || t.responseText == 'NO_EDIT_PERMS' || t.responseText == 'NO_POSTING_PPD' )
|
||||
{
|
||||
alert(ipb.lang['no_permission']);
|
||||
return;
|
||||
@@ -392,7 +497,7 @@ _topic.prototype.topic = {
|
||||
*/
|
||||
preCheckPosts: function()
|
||||
{
|
||||
if( !$('selectedpidsJS') ){ return; }
|
||||
if( ! $('selectedpidsJS' ) || !$F('selectedpidsJS') ){ return true; }
|
||||
|
||||
// Get the cookie
|
||||
pids = $F('selectedpidsJS').split(',');
|
||||
@@ -448,7 +553,7 @@ _topic.prototype.topic = {
|
||||
|
||||
pids = pids.uniq().without( remove ).join(',');
|
||||
ipb.Cookie.set('modpids', pids, 0);
|
||||
$F('selectedpidsJS').value = pids;
|
||||
$('selectedpidsJS').value = pids;
|
||||
ipb.topic.updatePostModButton();
|
||||
},
|
||||
|
||||
@@ -477,7 +582,7 @@ _topic.prototype.topic = {
|
||||
* @var {event} e The event
|
||||
*/
|
||||
showLinkToTopic: function(e, elem)
|
||||
{
|
||||
{
|
||||
_t = prompt( ipb.lang['copy_topic_link'], $( elem ).readAttribute('href') );
|
||||
Event.stop(e);
|
||||
},
|
||||
@@ -490,10 +595,13 @@ _topic.prototype.topic = {
|
||||
*/
|
||||
confirmSingleDelete: function(e, elem)
|
||||
{
|
||||
if( !confirm( ipb.lang['delete_post_confirm'] ) )
|
||||
if ( ! confirm( ipb.lang['delete_post_confirm'] ) )
|
||||
{
|
||||
Event.stop(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/* ------------------------------ */
|
||||
@@ -634,7 +742,25 @@ _topic.prototype.topic = {
|
||||
w: '500px'
|
||||
});
|
||||
//}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
/* ------------------------------ */
|
||||
/**
|
||||
* Reputation Popup Balloon
|
||||
*/
|
||||
repPopUp: function( e, postID )
|
||||
{
|
||||
var _url = ipb.vars['base_url'] + '&app=forums&module=ajax&secure_key=' + ipb.vars['secure_hash'] + '§ion=topics&do=reputation&post=' + postID;
|
||||
new ipb.Popup('rep_' + postID, {
|
||||
type: 'balloon',
|
||||
stem: true,
|
||||
attach: { target: e, position: 'auto' },
|
||||
hideAtStart: false,
|
||||
ajaxURL: _url,
|
||||
w: '300px',
|
||||
h: '400px'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ipb.topic.init();
|
||||
Reference in new issue
Block a user