Version 3.3.4

This commit is contained in:
Neo committed 2025-12-19 00:35:52 -08:00
1 parent 78706903a2
commit fb6b5baabc
2206 files changed
+409828 -382984

No files matched your search

+137 -64
View File
@@ -31,12 +31,16 @@ _comments.prototype.comments = {
parentId: 0,
commentId: 0,
deletePopUps: {},
hidePopUps: {},
deleted: 0,
modPop: false,
cCard: 0,
hc: '',
up: '',
_id: 0,
modOptionsUnapproved: 0,
modOptionsHidden: 0,
modOptionsUnhidden: 0,
/*------------------------------*/
/* Constructor */
@@ -53,9 +57,9 @@ _comments.prototype.comments = {
/* Comments */
ipb.delegate.register('.edit_comment' , ipb.comments.editShow );
ipb.delegate.register('.delete_comment' , ipb.comments.deletePop );
ipb.delegate.register('.hide_comment' , ipb.comments.hidePop );
ipb.delegate.register('.reply_comment' , ipb.comments.reply );
ipb.delegate.register('a[rel="bookmark"]', ipb.comments.showCommentLink );
ipb.delegate.register('input.ipsComment_mod', ipb.comments.moderate );
ipb.delegate.register('input.ipsComment_mod', ipb.comments.checkComment );
if ( $('commentPost') && !$('commentCaptcha') )
{
@@ -83,7 +87,7 @@ _comments.prototype.comments = {
{
// Count checked boxes that are visible
var count = $$(".ipsComment_mod:checked").findAll( function(el){ return el.up('.ipsComment').visible(); } );
if( count.size() ){
if( !$('comment_moderate_box') ){
$$('body')[0].insert({'bottom': ipb.templates['comment_moderation'].evaluate({count: count.size()}) });
@@ -95,6 +99,24 @@ _comments.prototype.comments = {
if( !$('comment_moderate_box').visible() ){
new Effect.Appear( $('comment_moderate_box'), { duration: 0.3 } );
}
/* Update the available options */
$('commentModAction').select('option').invoke('remove');
if ( ipb.comments.modOptionsUnapproved )
{
$('commentModAction').insert( new Element('option', { value: 'approve' } ).update( ipb.lang['cpt_approve'] ) );
}
if ( ipb.comments.modOptionsUnhidden )
{
$('commentModAction').insert( new Element('option', { value: 'hide' } ).update( ipb.lang['cpt_hide'] ) );
}
if ( ipb.comments.modOptionsHidden )
{
$('commentModAction').insert( new Element('option', { value: 'unhide' } ).update( ipb.lang['cpt_undelete'] ) );
}
$('commentModAction').insert( new Element('option', { value: 'delete' } ).update( ipb.lang['cpt_delete'] ) );
}
else
{
@@ -106,8 +128,8 @@ _comments.prototype.comments = {
doModerate: function(e)
{
var doMod = $('commentModAction').value;
var url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=moderate&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&modact=' + doMod + '&secure_key=' + ipb.vars['secure_hash'];
var doMod = $('commentModAction').value;
var url = ipb.comments.data['ajaxModerateUrl'] ? ipb.comments.data['ajaxModerateUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=moderate&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
// Get checked comment IDs
var ids = $$('.ipsComment_mod:checked').collect( function(item){
@@ -121,6 +143,7 @@ _comments.prototype.comments = {
encoding: ipb.vars['charset'],
parameters: {
md5check: ipb.vars['secure_hash'],
modact: doMod,
"commentIds[]": ids
},
onSuccess: function(t)
@@ -145,7 +168,7 @@ _comments.prototype.comments = {
Debug.write( "Deleted - " + ipb.comments.deleted + ", on this page - " + ipb.comments.data['counts']['thisPageCount'] );
if ( ipb.comments.data['counts']['curStart'] ){
if ( ipb.comments.data['counts']['thisPageCount'] - ipb.comments.deleted < 1 ){
window.location = ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
window.location = ipb.comments.data['findLastComment'] ? ipb.comments.data['findLastComment'] : ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
return false;
}
}
@@ -155,11 +178,13 @@ _comments.prototype.comments = {
{ duration: 0.8 }
);
break;
case 'hide':
case 'unapprove':
for( var i = 0 ; i <= ids.length ; i++ ){
ipb.comments.visibilityEffect( 'off', ids[i] );
}
break;
case 'unhide':
case 'approve':
for( var i = 0 ; i <= ids.length ; i++ ){
ipb.comments.visibilityEffect( 'on', ids[i] );
@@ -169,19 +194,6 @@ _comments.prototype.comments = {
}
}
});
},
/* ------------------------------ */
/**
* Shows a prompt allowing user to copy the URL
*
* @var {event} e The event
*/
showCommentLink: function(e, elem)
{
_t = prompt( ipb.lang['copy_topic_link'], $( elem ).readAttribute('href') );
Event.stop(e);
},
/**
@@ -223,9 +235,13 @@ _comments.prototype.comments = {
var startColor = $('comment_id_' + id ).getStyle( 'background-color' );
new Effect.Morph( 'comment_id_' + id, { 'style': 'background-color:' + endColor, duration: 0.6, afterFinish: function() { $('comment_id_' + id ).addClassName( toClass ); } } );
$( 'mod_comment_id_' + id ).writeAttribute( 'data-status', '-1' );
ipb.comments.modOptionsHidden++;
ipb.comments.modOptionsUnhidden--;
}
else
{
{
var startColor = $('comment_id_' + id ).getStyle( 'background-color' );
$('comment_id_' + id ).removeClassName( fromClass );
@@ -234,6 +250,10 @@ _comments.prototype.comments = {
$('comment_id_' + id ).addClassName( fromClass );
new Effect.Morph( 'comment_id_' + id, { 'style': 'background-color:' + endColor, duration: 0.6, afterFinish: function() { $('comment_id_' + id ).removeClassName( fromClass ); } } );
$( 'mod_comment_id_' + id ).writeAttribute( 'data-status', '1' );
ipb.comments.modOptionsHidden--;
ipb.comments.modOptionsUnhidden++;
}
},
@@ -247,7 +267,7 @@ _comments.prototype.comments = {
},
/**
* Show a pop-up for soft delete / delete or just redirect if no hard link
* Show a pop-up for delete
*/
deletePop: function(e, elem)
{
@@ -269,11 +289,8 @@ _comments.prototype.comments = {
/* store for use later */
ipb.comments.commentId = commentId;
},
/**
* Fire delete
*/
@@ -284,7 +301,7 @@ _comments.prototype.comments = {
ipb.comments.deletePopUps.hide();
/* Fire ajax */
var url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=delete&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&secure_key=' + ipb.vars['secure_hash'] + '&comment_id=' + ipb.comments.commentId;
var url = ipb.comments.data['ajaxDeleteUrl'] ? ipb.comments.data['ajaxDeleteUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=delete&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
Debug.write( url );
@@ -294,12 +311,13 @@ _comments.prototype.comments = {
evalJSON: 'force',
encoding: ipb.vars['charset'],
parameters: {
md5check: ipb.vars['secure_hash']
md5check: ipb.vars['secure_hash'],
comment_id: ipb.comments.commentId
},
onSuccess: function(t)
{
if ( t.responseJSON['error'] ){
alert( ipb.lang['no_permission'] );
alert( ipb.lang['no_permission'] );
return false;
}
else
@@ -314,8 +332,8 @@ _comments.prototype.comments = {
if ( ipb.comments.data['counts']['thisPageCount'] - ipb.comments.deleted < 1 )
{
/* redirect to the previous page */
window.location = ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
window.location = ipb.comments.data['findLastComment'] ? ipb.comments.data['findLastComment'] : ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
return false;
}
}
@@ -328,6 +346,33 @@ _comments.prototype.comments = {
);
},
/**
* Show a pop-up for hide
*/
hidePop: function(e, elem)
{
Event.stop(e);
var commentId = elem.up('.ipsComment').readAttribute('data-commentid');
if( !commentId ){ return; }
/* Create the pop-up */
var popid = 'pop__hide_popup_' + commentId;
var content = ipb.templates['comment_hide'].evaluate( { 'commentId': commentId, url: elem.href } );
ipb.comments.deletePopUps = new ipb.Popup( popid, { type: 'balloon',
initial: content,
stem: true,
hideAtStart: false,
attach: { target: $('hide_comment_' + commentId ), position: 'auto', 'event': 'click' },
w: '550px' } );
$('hidePop_reason').defaultize( ipb.lang['post_hide_reason_default'] );
/* store for use later */
ipb.comments.commentId = commentId;
},
/**
* Show quick edit
*/
@@ -363,7 +408,7 @@ _comments.prototype.comments = {
// Find post content
ipb.comments.commentCache[ edit['pid'] ] = edit['post'].innerHTML;
url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=showEdit&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&secure_key=' + ipb.vars['secure_hash'] + '&comment_id=' + edit['pid'];
url = ipb.comments.data['ajaxShowEditUrl'] ? ipb.comments.data['ajaxShowEditUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=showEdit&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
if ( Prototype.Browser.IE7 )
{
@@ -379,7 +424,8 @@ _comments.prototype.comments = {
{
method: 'post',
parameters: {
md5check: ipb.vars['secure_hash']
md5check: ipb.vars['secure_hash'],
comment_id: edit['pid']
},
onSuccess: function(t)
{
@@ -412,7 +458,7 @@ _comments.prototype.comments = {
}
}
);
Debug.write( url );
},
@@ -434,8 +480,8 @@ _comments.prototype.comments = {
return;
}
var url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=saveEdit&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&secure_key=' + ipb.vars['secure_hash'] + '&comment_id=' + postid;
Debug.write( url );
var url = ipb.comments.data['ajaxSaveEditUrl'] ? ipb.comments.data['ajaxSaveEditUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=saveEdit&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
new Ajax.Request( url,
{
method: 'post',
@@ -443,7 +489,8 @@ _comments.prototype.comments = {
encoding: ipb.vars['charset'],
parameters: {
md5check: ipb.vars['secure_hash'],
Post: Post.encodeParam()
Post: Post.encodeParam(),
comment_id: postid
},
onSuccess: function(t)
{
@@ -485,7 +532,6 @@ _comments.prototype.comments = {
}
);
},
/**
* Cancel the quick edit
@@ -508,7 +554,7 @@ _comments.prototype.comments = {
return;
},
/**
* Saves the contents of comment
*/
@@ -530,17 +576,16 @@ _comments.prototype.comments = {
in_use = 0;
var url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=add&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&secure_key=' + ipb.vars['secure_hash'];
Debug.write( url );
var url = ipb.comments.data['ajaxSaveUrl'] ? ipb.comments.data['ajaxSaveUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=add&parentId=' + ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
new Ajax.Request( url,
{
method: 'post',
evalJSON: 'force',
encoding: ipb.vars['charset'],
parameters: {
md5check: ipb.vars['secure_hash'],
Post: content.encodeParam(),
md5check: ipb.vars['secure_hash'],
Post: content.encodeParam(),
comment_name: $('comment_name') ? $('comment_name').value : '',
isRte: isRte
},
onSuccess: function(t)
@@ -551,6 +596,10 @@ _comments.prototype.comments = {
{
ipb.global.okDialogue( ipb.lang['comment_requires_approval'] );
}
else if( t.responseJSON['error'] == 'NO_COMMENT' )
{
ipb.global.errorDialogue( ipb.lang['post_empty'] );
}
else
{
ipb.global.errorDialogue( ipb.lang['no_permission'] );
@@ -564,12 +613,12 @@ _comments.prototype.comments = {
if ( ( ipb.comments.data['counts']['commentTotal'] ) && ( ( ipb.comments.data['counts']['commentTotal'] - ipb.comments.data['counts']['curStart'] ) >= ipb.comments.data['counts']['perPage'] ) )
{
/* http redirect */
window.location = ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
window.location = ipb.comments.data['findLastComment'] ? ipb.comments.data['findLastComment'] : ipb.vars['base_url'] + 'app=core&module=global&section=comments&do=findLastComment&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
return false;
}
}
/* Fetch latest ID */
latestId = 0;
m = t.responseText.match( /<a id='comment_(\d+?)'>/ );
@@ -578,7 +627,7 @@ _comments.prototype.comments = {
{
latestId = m[1];
}
$('comment_wrap').insert( t.responseText );
//Debug.write( 'inserted data' );
ipb.comments.data['counts']['thisPageCount']++;
@@ -603,7 +652,7 @@ _comments.prototype.comments = {
new Effect.Morph( 'comment_id_' + latestId, { 'style': 'border-top-color:' + endBorderColor, queue: 'end' } );
new Effect.Morph( 'comment_id_' + latestId, { 'style': 'background-color:' + endColor, queue: 'end', afterFinish: function() { $('comment_id_' + latestId ).removeClassName('row2').addClassName( 'row1' ); } } );
}
prettyPrint();
}
}
@@ -636,7 +685,7 @@ _comments.prototype.comments = {
commentId = elem.id.replace('reply_comment_', '');
url = ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=fetchReply&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'] + '&secure_key=' + ipb.vars['secure_hash'] + '&comment_id=' + commentId;
url = ipb.comments.data['ajaxFetchReplyUrl'] ? ipb.comments.data['ajaxFetchReplyUrl'] : ipb.vars['base_url'] + 'app=core&module=ajax&section=comments&do=fetchReply&parentId=' +ipb.comments.parentId + '&fromApp=' + ipb.comments.data['fromApp'];
Effect.ScrollTo( $('fast_reply'), { offset: -100 } );
@@ -646,7 +695,8 @@ _comments.prototype.comments = {
{
method: 'post',
parameters: {
md5check: ipb.vars['secure_hash']
md5check: ipb.vars['secure_hash'],
comment_id: commentId
},
onSuccess: function(t)
{
@@ -661,12 +711,12 @@ _comments.prototype.comments = {
return;
}
ipb.textEditor.getEditor().insert( t.responseText );
ipb.textEditor.getEditor('commentFastReply').insert( t.responseText );
}
}
);
},
/**
* Show the comment link
*/
@@ -709,7 +759,7 @@ _comments.prototype.comments = {
}
// Save cookie
ipb.Cookie.set('gal_pids', quoted, 0);
ipb.Cookie.set('gal_pids', quoted, 0);
},
/**
@@ -740,7 +790,7 @@ _comments.prototype.comments = {
}
});
}
$$('.comment_mod').each( function(check){
checkboxesOnPage++;
} );
@@ -765,21 +815,49 @@ _comments.prototype.comments = {
{
remove = new Array();
check = elem;
selectedTopics = $F('selectedgcids').split(',').compact();
var checkboxesOnPage = 0;
var checkedOnPage = 0;
if( check.checked == true )
{
Debug.write("Checked");
selectedTopics.push( check.id.replace('pid_', '') );
ipb.comments.totalChecked++;
switch ( check.readAttribute("data-status") )
{
case '0':
ipb.comments.modOptionsUnapproved += 1;
break;
case '-1':
ipb.comments.modOptionsHidden += 1;
break;
default:
ipb.comments.modOptionsUnhidden += 1;
break;
}
}
else
{
remove.push( check.id.replace('pid_', '') );
ipb.comments.totalChecked--;
switch ( check.readAttribute("data-status") )
{
case '0':
ipb.comments.modOptionsUnapproved -= 1;
break;
case '-1':
ipb.comments.modOptionsHidden -= 1;
break;
default:
ipb.comments.modOptionsUnhidden -= 1;
break;
}
}
$$('.comment_mod').each( function(check){
@@ -803,17 +881,12 @@ _comments.prototype.comments = {
}
}
selectedTopics = selectedTopics.uniq().without( remove ).join(',');
ipb.Cookie.set('modgcids', selectedTopics, 0);
$('selectedgcids').value = selectedTopics;
ipb.comments.updateModButton();
ipb.comments.moderate();
},
/**
* Update the moderation button
*/
*/
updateModButton: function( )
{
if( $('mod_submit') )
@@ -838,7 +911,7 @@ _comments.prototype.comments = {
if( $( 'comment_id_' + id ).select('.post_wrap')[0] )
{
$( 'comment_id_' + id ).select('.post_wrap')[0].hide();
if( $('unhide_post_' + id ) )
{
$('unhide_post_' + id).observe('click', ipb.comments.showHiddenComment );