includes/clientside/static/comments.js
changeset 541 acb7e23b6ffa
parent 420 301f546688d1
child 550 685e839d934e
equal deleted inserted replaced
540:1e4b759da336 541:acb7e23b6ffa
   128     html += '<p>' + $lang.get('comment_postform_blurb');
   128     html += '<p>' + $lang.get('comment_postform_blurb');
   129     if ( data.approval_needed )
   129     if ( data.approval_needed )
   130       html+=' ' + $lang.get('comment_postform_blurb_unapp');
   130       html+=' ' + $lang.get('comment_postform_blurb_unapp');
   131     html += ' <a id="leave_comment_button" href="#" onclick="displayCommentForm(); return false;">' + $lang.get('comment_postform_blurb_link') + '</a></p>';
   131     html += ' <a id="leave_comment_button" href="#" onclick="displayCommentForm(); return false;">' + $lang.get('comment_postform_blurb_link') + '</a></p>';
   132     html += '<div id="comment_form" style="display: none;">';
   132     html += '<div id="comment_form" style="display: none;">';
   133     html += '  <table border="0">';
   133     html += '  <table border="0" style="width: 100%;">';
   134     html += '    <tr><td>' + $lang.get('comment_postform_field_name') + '</td><td>';
   134     html += '    <tr><td>' + $lang.get('comment_postform_field_name') + '</td><td>';
   135     if ( data.user_id > 1 ) html += data.username + '<input id="commentform_name" type="hidden" value="'+data.username+'" size="40" />';
   135     if ( data.user_id > 1 ) html += data.username + '<input id="commentform_name" type="hidden" value="'+data.username+'" size="40" />';
   136     else html += '<input id="commentform_name" type="text" size="40" />';
   136     else html += '<input id="commentform_name" type="text" size="40" style="width: 100%;" />';
   137     html += '    </td></tr>';
   137     html += '    </td></tr>';
   138     html += '    <tr><td>' + $lang.get('comment_postform_field_subject') + '</td><td><input id="commentform_subject" type="text" size="40" /></td></tr>';
   138     html += '    <tr><td>' + $lang.get('comment_postform_field_subject') + '</td><td><input id="commentform_subject" type="text" size="40" style="width: 100%;" /></td></tr>';
   139     html += '    <tr><td>' + $lang.get('comment_postform_field_comment') + '</td><td><textarea id="commentform_message" rows="15" cols="50"></textarea></td></tr>';
   139     html += '    <tr><td>' + $lang.get('comment_postform_field_comment') + '</td><td><textarea id="commentform_message" rows="15" cols="50" style="width: 100%;"></textarea></td></tr>';
   140     if ( !data.logged_in && data.guest_posting == '1' )
   140     if ( !data.logged_in && data.guest_posting == '1' )
   141     {
   141     {
   142       html += '  <tr><td>' + $lang.get('comment_postform_field_captcha_title') + '<br /><small>' + $lang.get('comment_postform_field_captcha_blurb') + '</small></td><td>';
   142       html += '  <tr><td>' + $lang.get('comment_postform_field_captcha_title') + '<br /><small>' + $lang.get('comment_postform_field_captcha_blurb') + '</small></td><td>';
   143       html += '  <img alt="CAPTCHA image" src="'+makeUrlNS('Special', 'Captcha/' + data.captcha)+'" onclick="this.src=\''+makeUrlNS('Special', 'Captcha/' + data.captcha)+'/\'+Math.floor(Math.random()*10000000);" style="cursor: pointer;" /><br />';
   143       html += '  <img alt="CAPTCHA image" src="'+makeUrlNS('Special', 'Captcha/' + data.captcha)+'" onclick="this.src=\''+makeUrlNS('Special', 'Captcha/' + data.captcha)+'/\'+Math.floor(Math.random()*10000000);" style="cursor: pointer;" /><br />';
   144       html += '  ' + $lang.get('comment_postform_field_captcha_label') + ' <input type="text" size="8" id="commentform_captcha" />';
   144       html += '  ' + $lang.get('comment_postform_field_captcha_label') + ' <input type="text" size="8" id="commentform_captcha" />';
   179     tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
   179     tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>';
   180   
   180   
   181   // Name
   181   // Name
   182   tplvars.NAME = this_comment.name;
   182   tplvars.NAME = this_comment.name;
   183   if ( this_comment.user_id > 1 )
   183   if ( this_comment.user_id > 1 )
   184     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   184     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '" style="' + this_comment.rank_style + '">' + this_comment.name + '</a>';
   185   
   185   
   186   // Avatar
   186   // Avatar
   187   if ( this_comment.user_has_avatar == '1' )
   187   if ( this_comment.user_has_avatar == '1' )
   188   {
   188   {
   189     tplvars.AVATAR_URL = scriptPath + '/' + data.avatar_directory + '/' + this_comment.user_id + '.' + this_comment.avatar_type;
   189     tplvars.AVATAR_URL = this_comment.avatar_path;
   190     tplvars.USERPAGE_LINK = makeUrlNS('User', this_comment.name);
   190     tplvars.USERPAGE_LINK = makeUrlNS('User', this_comment.name);
   191     tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: this_comment.name });
   191     tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: this_comment.name });
   192   }
   192   }
   193   
   193   
   194   // User level
   194   // User level
   195   tplvars.USER_LEVEL = $lang.get('user_type_guest');
   195   tplvars.USER_LEVEL = '';
   196   if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
   196   if ( this_comment.user_title )
   197   if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
   197     tplvars.USER_LEVEL += this_comment.user_title;
   198   if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   198   if ( this_comment.rank_title && this_comment.user_title )
       
   199     tplvars.USER_LEVEL += '<br />';
       
   200   if ( this_comment.rank_title )
       
   201     tplvars.USER_LEVEL += $lang.get(this_comment.rank_title);
   199   
   202   
   200   // Send PM link
   203   // Send PM link
   201   tplvars.SEND_PM_LINK=(this_comment.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   204   tplvars.SEND_PM_LINK=(this_comment.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   202   
   205   
   203   // Add buddy link
   206   // Add buddy link
   277   var cmt = document.getElementById('comment_'+id);
   280   var cmt = document.getElementById('comment_'+id);
   278   cmt.innerHTML = '';
   281   cmt.innerHTML = '';
   279   var ta = document.createElement('textarea');
   282   var ta = document.createElement('textarea');
   280   ta.rows = '10';
   283   ta.rows = '10';
   281   ta.cols = '40';
   284   ta.cols = '40';
       
   285   ta.style.width = '98%';
   282   ta.value = src;
   286   ta.value = src;
   283   ta.id = 'comment_edit_'+id;
   287   ta.id = 'comment_edit_'+id;
   284   cmt.appendChild(ta);
   288   cmt.appendChild(ta);
   285   
   289   
   286   link.style.fontWeight = 'bold';
   290   link.style.fontWeight = 'bold';