author | Dan |
Sun, 04 Jan 2009 00:55:40 -0500 | |
changeset 801 | eb8b23f11744 |
parent 779 | 609e35845ec3 |
child 823 | 4596c40aaa94 |
child 825 | 9d5c04c1414f |
permissions | -rw-r--r-- |
1 | 1 |
// Comments |
2 |
||
3 |
var comment_template = false; |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
4 |
var comment_render_track = 0; |
1 | 5 |
|
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
6 |
window.ajaxComments = function(parms) |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
7 |
{ |
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents:
754
diff
changeset
|
8 |
load_component(['l10n', 'paginate', 'template-compiler', 'toolbar', 'flyin']); |
1 | 9 |
setAjaxLoading(); |
10 |
var pid = strToPageID(title); |
|
11 |
if(!parms) |
|
12 |
{ |
|
13 |
var parms = { |
|
14 |
'mode' : 'fetch' |
|
15 |
}; |
|
16 |
} |
|
17 |
parms.page_id = pid[0]; |
|
18 |
parms.namespace = pid[1]; |
|
19 |
if(comment_template) |
|
20 |
parms.have_template = true; |
|
21 |
parms = ajaxEscape(toJSONString(parms)); |
|
22 |
ajaxPost(stdAjaxPrefix+'&_mode=comments', 'data=' + parms, function() { |
|
407
35d94240a197
Mass-fixed all AJAX functions to also check the HTTP status code before parsing the response
Dan
parents:
359
diff
changeset
|
23 |
if ( ajax.readyState == 4 && ajax.status == 200 ) { |
1 | 24 |
unsetAjaxLoading(); |
25 |
selectButtonMajor('discussion'); |
|
26 |
unselectAllButtonsMinor(); |
|
27 |
// IE compatibility - doing ajax.responseText.substr() doesn't work |
|
28 |
var rsptxt = ajax.responseText + ''; |
|
29 |
if ( rsptxt.substr(0, 1) != '{' ) |
|
30 |
{ |
|
31 |
document.getElementById('ajaxEditContainer').innerHTML = '<p>Comment system Javascript runtime: invalid JSON response from server, response text:</p><pre>' + ajax.responseText + '</pre>'; |
|
32 |
return false; |
|
33 |
} |
|
34 |
var response = parseJSON(ajax.responseText); |
|
35 |
switch(response.mode) |
|
36 |
{ |
|
37 |
case 'fetch': |
|
86
c162ca39db8f
Finished pagination code (was incomplete in previous revision) and added a few hacks for an upcoming theme
Dan
parents:
85
diff
changeset
|
38 |
document.getElementById('ajaxEditContainer').innerHTML = '<div class="wait-box">Rendering '+response.count_total+' comments...</div>'; |
1 | 39 |
if(response.template) |
40 |
comment_template = response.template; |
|
41 |
setAjaxLoading(); |
|
42 |
renderComments(response); |
|
43 |
unsetAjaxLoading(); |
|
44 |
break; |
|
45 |
case 'redraw': |
|
46 |
redrawComment(response); |
|
47 |
break; |
|
48 |
case 'annihilate': |
|
49 |
annihiliateComment(response.id); |
|
50 |
break; |
|
51 |
case 'materialize': |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
52 |
alert($lang.get('comment_msg_comment_posted')); |
1 | 53 |
hideCommentForm(); |
54 |
materializeComment(response); |
|
55 |
break; |
|
56 |
case 'error': |
|
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
541
diff
changeset
|
57 |
new MessageBox(MB_OK|MB_ICONSTOP, ( response.title ? response.title : 'Error fetching comment data' ), response.error); |
1 | 58 |
break; |
59 |
default: |
|
60 |
alert(ajax.responseText); |
|
61 |
break; |
|
62 |
} |
|
63 |
} |
|
64 |
}); |
|
65 |
} |
|
66 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
67 |
window.renderComments = function(data) |
1 | 68 |
{ |
69 |
||
70 |
var html = ''; |
|
71 |
||
72 |
// Header |
|
73 |
||
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
74 |
html += '<h3>' + $lang.get('comment_heading') + '</h3>'; |
1 | 75 |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
76 |
var ns = ENANO_PAGE_TYPE; |
1 | 77 |
|
420
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
78 |
// Counters |
1 | 79 |
if ( data.auth_mod_comments ) |
80 |
{ |
|
81 |
var cnt = ( data.auth_mod_comments ) ? data.count_total : data.count_appr; |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
82 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
83 |
var subst = { |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
84 |
num_comments: cnt, |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
85 |
page_type: ns |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
86 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
87 |
var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) ); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
88 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
89 |
html += "<p id=\"comment_status\"><span>" + count_msg + '</span>'; |
1 | 90 |
if ( data.count_unappr > 0 ) |
91 |
{ |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
92 |
html += ' <span style="color: #D84308" id="comment_status_unapp">' + $lang.get('comment_msg_count_unapp_mod', { num_unapp: data.count_unappr }) + '</span>'; |
1 | 93 |
} |
94 |
html += '</p>'; |
|
95 |
} |
|
96 |
else |
|
97 |
{ |
|
98 |
var cnt = data.count_appr; |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
99 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
100 |
var subst = { |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
101 |
num_comments: cnt, |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
102 |
page_type: ns |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
103 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
104 |
var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) ); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
105 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
106 |
html += "<p id=\"comment_status\">" + count_msg; |
1 | 107 |
if ( data.count_unappr > 0 ) |
108 |
{ |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
109 |
var unappr_msg = ( data.count_unappr == 1 ) ? $lang.get('comment_msg_count_unapp_one') : $lang.get('comment_msg_count_unapp_plural', { num_unapp: data.count_unappr }); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
110 |
html += ' ' + unappr_msg; |
1 | 111 |
} |
112 |
html += '</p>'; |
|
113 |
} |
|
114 |
||
115 |
// Comment display |
|
116 |
||
117 |
if ( data.count_total > 0 ) |
|
118 |
{ |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
119 |
comment_render_track = 0; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
120 |
var commentpages = new paginator(data.comments, _render_comment, 0, 10, data); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
121 |
html += commentpages.html; |
1 | 122 |
} |
123 |
||
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
29
diff
changeset
|
124 |
if ( data.auth_post_comments ) |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
29
diff
changeset
|
125 |
{ |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
29
diff
changeset
|
126 |
// Posting form |
1 | 127 |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
128 |
html += '<h3>' + $lang.get('comment_postform_title') + '</h3>'; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
129 |
html += '<p>' + $lang.get('comment_postform_blurb'); |
1 | 130 |
if ( data.approval_needed ) |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
131 |
html+=' ' + $lang.get('comment_postform_blurb_unapp'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
132 |
html += ' <a id="leave_comment_button" href="#" onclick="displayCommentForm(); return false;">' + $lang.get('comment_postform_blurb_link') + '</a></p>'; |
1 | 133 |
html += '<div id="comment_form" style="display: none;">'; |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
134 |
html += ' <table border="0" style="width: 100%;">'; |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
135 |
html += ' <tr><td>' + $lang.get('comment_postform_field_name') + '</td><td>'; |
1 | 136 |
if ( data.user_id > 1 ) html += data.username + '<input id="commentform_name" type="hidden" value="'+data.username+'" size="40" />'; |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
137 |
else html += '<input id="commentform_name" type="text" size="40" style="width: 100%;" />'; |
1 | 138 |
html += ' </td></tr>'; |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
139 |
html += ' <tr><td>' + $lang.get('comment_postform_field_subject') + '</td><td><input id="commentform_subject" type="text" size="40" style="width: 100%;" /></td></tr>'; |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
140 |
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>'; |
1 | 141 |
if ( !data.logged_in && data.guest_posting == '1' ) |
142 |
{ |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
143 |
html += ' <tr><td>' + $lang.get('comment_postform_field_captcha_title') + '<br /><small>' + $lang.get('comment_postform_field_captcha_blurb') + '</small></td><td>'; |
1 | 144 |
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 />'; |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
145 |
html += ' ' + $lang.get('comment_postform_field_captcha_label') + ' <input type="text" size="8" id="commentform_captcha" />'; |
1 | 146 |
html += ' <!-- This input is used to track the ID of the CAPTCHA image --> <input type="hidden" id="commentform_captcha_id" value="'+data.captcha+'" />'; |
147 |
html += ' </td></tr>'; |
|
148 |
} |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
149 |
html += ' <tr><td colspan="2" style="text-align: center;"><input type="button" onclick="submitComment();" value="' + $lang.get('comment_postform_btn_submit') + '" /></td></tr>'; |
1 | 150 |
html += ' </table>'; |
151 |
html += '</div>'; |
|
74
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
29
diff
changeset
|
152 |
} |
68469a95658d
Various bugfixes and cleanups, too much to remember... see the diffs for what got changed :-)
Dan
parents:
29
diff
changeset
|
153 |
|
1 | 154 |
document.getElementById('ajaxEditContainer').innerHTML = html; |
748
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
155 |
if ( document.getElementById('commentform_message') ) |
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
156 |
{ |
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
157 |
document.getElementById('commentform_message').allow_wysiwyg = data.auth_edit_wysiwyg |
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
158 |
} |
1 | 159 |
|
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
160 |
for ( i = 0; i < data.comments.length; i++ ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
161 |
{ |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
162 |
document.getElementById('comment_source_'+i).value = data.comments[i].comment_source; |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
163 |
} |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
164 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
165 |
} |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
166 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
167 |
var _render_comment = function(this_comment, data) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
168 |
{ |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
169 |
var i = comment_render_track; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
170 |
comment_render_track++; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
171 |
var parser = new templateParser(comment_template); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
172 |
var tplvars = new Object(); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
173 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
174 |
if ( this_comment.approved != '1' && !data.auth_mod_comments ) |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
175 |
return ''; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
176 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
177 |
tplvars.ID = i; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
178 |
tplvars.DATETIME = this_comment.time; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
179 |
tplvars.SUBJECT = this_comment.subject; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
180 |
tplvars.DATA = this_comment.comment_data; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
181 |
tplvars.SIGNATURE = this_comment.signature; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
182 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
183 |
if ( this_comment.approved != '1' ) |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
184 |
tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>'; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
185 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
186 |
// Name |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
187 |
tplvars.NAME = this_comment.name; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
188 |
if ( this_comment.user_id > 1 ) |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
189 |
tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '" style="' + this_comment.rank_style + '">' + this_comment.name + '</a>'; |
1 | 190 |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
191 |
// Avatar |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
192 |
if ( this_comment.user_has_avatar == '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
193 |
{ |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
194 |
tplvars.AVATAR_URL = this_comment.avatar_path; |
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
195 |
tplvars.USERPAGE_LINK = makeUrlNS('User', this_comment.name); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
196 |
tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: this_comment.name }); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
197 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
198 |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
199 |
// User level |
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
200 |
tplvars.USER_LEVEL = ''; |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
201 |
if ( this_comment.user_title ) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
202 |
tplvars.USER_LEVEL += this_comment.user_title; |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
203 |
if ( this_comment.rank_title && this_comment.user_title ) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
204 |
tplvars.USER_LEVEL += '<br />'; |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
205 |
if ( this_comment.rank_title ) |
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
206 |
tplvars.USER_LEVEL += $lang.get(this_comment.rank_title); |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
207 |
|
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
208 |
// Send PM link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
209 |
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 />':''; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
210 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
211 |
// Add buddy link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
212 |
tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( this_comment.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':''; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
213 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
214 |
// Edit link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
215 |
tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">' + $lang.get('comment_btn_edit') + '</a>'; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
216 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
217 |
// Delete link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
218 |
tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_delete') + '</a>'; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
219 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
220 |
// Moderation: (Un)approve link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
221 |
var appr = ( this_comment.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve'); |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
222 |
tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>'; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
223 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
224 |
// Moderation: Delete post link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
225 |
tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>'; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
226 |
|
359 | 227 |
// Moderation: IP address link |
228 |
if ( this_comment.have_ip ) |
|
229 |
{ |
|
230 |
tplvars.MOD_IP_LINK = '<span id="comment_ip_' + i + '"><a href="#mod_ip_' + i + '" onclick="viewCommentIP(' + this_comment.comment_id + ', ' + i + '); return false;">' + $lang.get('comment_btn_mod_ip_logged') + '</a></span>'; |
|
231 |
} |
|
232 |
else |
|
233 |
{ |
|
234 |
tplvars.MOD_IP_LINK = $lang.get('comment_btn_mod_ip_missing'); |
|
235 |
} |
|
236 |
||
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
237 |
var tplbool = new Object(); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
238 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
239 |
tplbool.signature = ( this_comment.signature == '' ) ? false : true; |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
240 |
tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) ); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
241 |
tplbool.auth_mod = data.auth_mod_comments; |
108
1c7f59df9474
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
Dan
parents:
102
diff
changeset
|
242 |
tplbool.is_friend = ( this_comment.is_buddy == 1 && this_comment.is_friend == 1 ); |
1c7f59df9474
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
Dan
parents:
102
diff
changeset
|
243 |
tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 ); |
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
244 |
tplbool.user_has_avatar = ( this_comment.user_has_avatar == '1' ); |
108
1c7f59df9474
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
Dan
parents:
102
diff
changeset
|
245 |
|
1c7f59df9474
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
Dan
parents:
102
diff
changeset
|
246 |
if ( tplbool.is_friend ) |
214 | 247 |
tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_friend_list') + '</b>'; |
108
1c7f59df9474
Implemented some extra functionality for friends/foes in comments; fixed lack of table_prefix in stats.php line 63
Dan
parents:
102
diff
changeset
|
248 |
else if ( tplbool.is_foe ) |
214 | 249 |
tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_foe_list') + '</b>'; |
85
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
250 |
|
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
251 |
parser.assign_vars(tplvars); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
252 |
parser.assign_bool(tplbool); |
7c68a18a27be
AJAX comments are now paginated; plugin manager can now show system plugins; typo in installer corrected; links in oxygen/stpatty/admin footers changed to "About Enano" page; 1.0.1 release candidate
Dan
parents:
74
diff
changeset
|
253 |
|
420
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
254 |
var ret = '<div id="comment_holder_' + i + '">'; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
255 |
ret += '<input type="hidden" value="'+this_comment.comment_id+'" />'; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
256 |
ret += '<input type="hidden" id="comment_source_'+i+'" />'; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
257 |
ret += parser.run(); |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
258 |
ret += '</div>'; |
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
259 |
return ret; |
1 | 260 |
} |
261 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
262 |
window.displayCommentForm = function() |
1 | 263 |
{ |
264 |
document.getElementById('leave_comment_button').style.display = 'none'; |
|
265 |
document.getElementById('comment_form').style.display = 'block'; |
|
748
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
266 |
if ( $dynano('commentform_message').object.allow_wysiwyg ) |
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
267 |
$dynano('commentform_message').makeSwitchable(); |
1 | 268 |
} |
269 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
270 |
window.hideCommentForm = function() |
1 | 271 |
{ |
272 |
document.getElementById('leave_comment_button').style.display = 'inline'; |
|
273 |
document.getElementById('comment_form').style.display = 'none'; |
|
274 |
} |
|
275 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
276 |
window.editComment = function(id, link) |
1 | 277 |
{ |
278 |
var ctr = document.getElementById('subject_'+id); |
|
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
279 |
var subj = ( ctr.firstChild ) ? trim(ctr.firstChild.nodeValue) : ''; // If there's a span in there that says 'unapproved', this eliminates it |
1 | 280 |
ctr.innerHTML = ''; |
281 |
var ipt = document.createElement('input'); |
|
282 |
ipt.id = 'subject_edit_'+id; |
|
283 |
ipt.value = subj; |
|
284 |
ctr.appendChild(ipt); |
|
285 |
||
286 |
var src = document.getElementById('comment_source_'+id).value; |
|
287 |
var cmt = document.getElementById('comment_'+id); |
|
288 |
cmt.innerHTML = ''; |
|
289 |
var ta = document.createElement('textarea'); |
|
290 |
ta.rows = '10'; |
|
291 |
ta.cols = '40'; |
|
541
acb7e23b6ffa
Massive commit with various changes. Added user ranks system (no admin interface yet) and ability for users to have custom user titles. Made cron framework accept fractions of hours through floating-point intervals. Modifed ACL editor to use miniPrompt framework for close confirmation box. Made avatar system use a special page as opposed to fetching the files directly for caching reasons.
Dan
parents:
420
diff
changeset
|
292 |
ta.style.width = '98%'; |
1 | 293 |
ta.value = src; |
294 |
ta.id = 'comment_edit_'+id; |
|
295 |
cmt.appendChild(ta); |
|
748
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
296 |
$dynano(ta).makeSwitchable(); |
1 | 297 |
|
298 |
link.style.fontWeight = 'bold'; |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
299 |
link.innerHTML = $lang.get('comment_btn_save'); |
1 | 300 |
link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); saveComment(id, this); return false; }; |
301 |
} |
|
302 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
303 |
window.saveComment = function(id, link) |
1 | 304 |
{ |
305 |
var data = document.getElementById('comment_edit_'+id).value; |
|
306 |
var subj = document.getElementById('subject_edit_'+id).value; |
|
307 |
var div = document.getElementById('comment_holder_'+id); |
|
308 |
var real_id = div.getElementsByTagName('input')[0]['value']; |
|
309 |
var req = { |
|
310 |
'mode' : 'edit', |
|
311 |
'id' : real_id, |
|
312 |
'local_id' : id, |
|
313 |
'data' : data, |
|
314 |
'subj' : subj |
|
315 |
}; |
|
316 |
link.style.fontWeight = 'normal'; |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
317 |
link.innerHTML = $lang.get('comment_btn_edit'); |
1 | 318 |
link.onclick = function() { var id = this.id.substr(this.id.indexOf('_')+1); editComment(id, this); return false; }; |
319 |
ajaxComments(req); |
|
320 |
} |
|
321 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
322 |
window.deleteComment = function(id) |
1 | 323 |
{ |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
324 |
if ( !shift ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
325 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
326 |
var c = confirm($lang.get('comment_msg_delete_confirm')); |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
327 |
if(!c) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
328 |
return false; |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
329 |
} |
1 | 330 |
var div = document.getElementById('comment_holder_'+id); |
331 |
var real_id = div.getElementsByTagName('input')[0]['value']; |
|
332 |
var req = { |
|
333 |
'mode' : 'delete', |
|
334 |
'id' : real_id, |
|
335 |
'local_id' : id |
|
336 |
}; |
|
337 |
ajaxComments(req); |
|
338 |
} |
|
339 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
340 |
window.submitComment = function() |
1 | 341 |
{ |
342 |
var name = document.getElementById('commentform_name').value; |
|
343 |
var subj = document.getElementById('commentform_subject').value; |
|
748
e39454295bbb
Added makeSwitchable Dynano method for textareas; enabled support for makeSwitchable in comment runtime
Dan
parents:
582
diff
changeset
|
344 |
var text = $dynano('commentform_message').getContent(); |
1 | 345 |
if ( document.getElementById('commentform_captcha') ) |
346 |
{ |
|
347 |
var captcha_code = document.getElementById('commentform_captcha').value; |
|
348 |
var captcha_id = document.getElementById('commentform_captcha_id').value; |
|
349 |
} |
|
350 |
else |
|
351 |
{ |
|
352 |
var captcha_code = ''; |
|
353 |
var captcha_id = ''; |
|
354 |
} |
|
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
355 |
if ( subj == '' ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
356 |
{ |
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents:
754
diff
changeset
|
357 |
load_component(['messagebox', 'fadefilter']); |
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
541
diff
changeset
|
358 |
new MessageBox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter a subject for your comment.'); |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
359 |
return false; |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
360 |
} |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
361 |
if ( text == '' ) |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
362 |
{ |
779
609e35845ec3
load_component() now accepts an array, and most JS components are loaded all in one request now. Totally modular baby. And failsafe too.
Dan
parents:
754
diff
changeset
|
363 |
load_component(['messagebox', 'fadefilter']); |
550
685e839d934e
Added ability to delete the draft revision; [SECURITY] fixed lack of permission check on draft save; renamed messagebox() constructor to MessageBox() (backward compat. maintained)
Dan
parents:
541
diff
changeset
|
364 |
new MessageBox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter some text for the body of your comment .'); |
102
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
365 |
return false; |
d807dcd7aed7
[comments] fixed edit button (source wasn't getting filled)
Dan
parents:
86
diff
changeset
|
366 |
} |
1 | 367 |
var req = { |
368 |
'mode' : 'submit', |
|
369 |
'name' : name, |
|
370 |
'subj' : subj, |
|
371 |
'text' : text, |
|
372 |
'captcha_code' : captcha_code, |
|
373 |
'captcha_id' : captcha_id |
|
374 |
}; |
|
375 |
ajaxComments(req); |
|
376 |
} |
|
377 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
378 |
window.redrawComment = function(data) |
1 | 379 |
{ |
380 |
if ( data.subj ) |
|
381 |
{ |
|
382 |
document.getElementById('subject_' + data.id).innerHTML = data.subj; |
|
383 |
} |
|
384 |
if ( data.approved && data.approved != '1' ) |
|
385 |
{ |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
386 |
document.getElementById('subject_' + data.id).innerHTML += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>'; |
1 | 387 |
} |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
1
diff
changeset
|
388 |
if ( data.approved && ( typeof(data.approve_updated) == 'string' && data.approve_updated == 'yes' ) ) |
1 | 389 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
390 |
var appr = ( data.approved == '1' ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve'); |
1 | 391 |
document.getElementById('comment_approve_'+data.id).innerHTML = appr; |
29
e5484a9e0818
Rewrote change theme dialog; a few minor stability fixes here and there; fixed IE + St Patty background image
Dan
parents:
1
diff
changeset
|
392 |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
393 |
if ( data.approved == '1' ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
394 |
comment_decrement_unapproval(); |
1 | 395 |
else |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
396 |
comment_increment_unapproval(); |
1 | 397 |
} |
398 |
if ( data.text ) |
|
399 |
{ |
|
400 |
document.getElementById('comment_' + data.id).innerHTML = data.text; |
|
401 |
} |
|
402 |
if ( data.src ) |
|
403 |
{ |
|
404 |
document.getElementById('comment_source_' + data.id).value = data.src; |
|
405 |
} |
|
359 | 406 |
if ( data.ip_addr ) |
407 |
{ |
|
420
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
408 |
var span = $dynano('comment_ip_' + data.local_id).object; |
359 | 409 |
if ( !span ) |
410 |
return false; |
|
411 |
span.innerHTML = $lang.get('comment_msg_ip_address') + ' <a href="#rdns" onclick="ajaxReverseDNS(this); return false;">' + data.ip_addr + '</a>'; |
|
412 |
} |
|
1 | 413 |
} |
414 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
415 |
window.approveComment = function(id) |
1 | 416 |
{ |
417 |
var div = document.getElementById('comment_holder_'+id); |
|
418 |
var real_id = div.getElementsByTagName('input')[0]['value']; |
|
419 |
var req = { |
|
420 |
'mode' : 'approve', |
|
421 |
'id' : real_id, |
|
422 |
'local_id' : id |
|
423 |
}; |
|
424 |
ajaxComments(req); |
|
425 |
} |
|
426 |
||
427 |
// Does the actual DOM object removal |
|
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
428 |
window.annihiliateComment = function(id) // Did I spell that right? |
1 | 429 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
430 |
var approved = true; |
1 | 431 |
if(document.getElementById('comment_approve_'+id)) |
432 |
{ |
|
433 |
var appr = document.getElementById('comment_approve_'+id).firstChild.nodeValue; |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
434 |
if ( appr == $lang.get('comment_btn_mod_approve') ) |
1 | 435 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
436 |
approved = false; |
1 | 437 |
} |
438 |
} |
|
439 |
||
440 |
var div = document.getElementById('comment_holder_'+id); |
|
441 |
div.parentNode.removeChild(div); |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
442 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
443 |
// update approval status |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
444 |
if ( document.getElementById('comment_count_unapp_inner') && !approved ) |
1 | 445 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
446 |
comment_decrement_unapproval(); |
1 | 447 |
} |
448 |
} |
|
449 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
450 |
window.materializeComment = function(data) |
1 | 451 |
{ |
452 |
// Intelligently get an ID |
|
453 |
||
454 |
var i = 0; |
|
455 |
var brother; |
|
456 |
while ( true ) |
|
457 |
{ |
|
458 |
var x = document.getElementById('comment_holder_'+i); |
|
459 |
if(!x) |
|
460 |
break; |
|
461 |
brother = x; |
|
462 |
i++; |
|
463 |
} |
|
464 |
||
465 |
var parser = new templateParser(comment_template); |
|
466 |
var tplvars = new Object(); |
|
467 |
||
468 |
if ( data.approved != '1' && !data.auth_mod_comments ) |
|
469 |
return false; |
|
470 |
||
471 |
tplvars.ID = i; |
|
472 |
tplvars.DATETIME = data.time; |
|
473 |
tplvars.SUBJECT = data.subject; |
|
474 |
tplvars.DATA = data.comment_data; |
|
475 |
tplvars.SIGNATURE = data.signature; |
|
476 |
||
477 |
tplvars.NAME = data.name; |
|
478 |
if ( data.user_id > 1 ) |
|
479 |
tplvars.NAME = '<a href="' + makeUrlNS('User', data.name) + '">' + data.name + '</a>'; |
|
480 |
||
481 |
if ( data.approved != '1' ) |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
482 |
tplvars.SUBJECT += ' <span style="color: #D84308">' + $lang.get('comment_msg_note_unapp') + '</span>'; |
1 | 483 |
|
484 |
// User level |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
485 |
tplvars.USER_LEVEL = $lang.get('user_type_guest'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
486 |
if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = $lang.get('user_type_member'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
487 |
if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
488 |
if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin'); |
1 | 489 |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
490 |
// Avatar |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
491 |
if ( data.user_has_avatar == '1' ) |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
492 |
{ |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
493 |
tplvars.AVATAR_URL = scriptPath + '/' + data.avatar_directory + '/' + data.user_id + '.' + data.avatar_type; |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
494 |
tplvars.USERPAGE_LINK = makeUrlNS('User', data.name); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
495 |
tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: data.name }); |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
496 |
} |
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
497 |
|
1 | 498 |
// Send PM link |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
499 |
tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':''; |
1 | 500 |
|
501 |
// Add buddy link |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
502 |
tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':''; |
1 | 503 |
|
504 |
// Edit link |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
505 |
tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">' + $lang.get('comment_btn_edit') + '</a>'; |
1 | 506 |
|
507 |
// Delete link |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
508 |
tplvars.DELETE_LINK='<a href="#delete_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_delete') + '</a>'; |
1 | 509 |
|
510 |
// Moderation: (Un)approve link |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
511 |
var appr = ( data.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve'); |
1 | 512 |
tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>'; |
513 |
||
514 |
// Moderation: Delete post link |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
515 |
tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>'; |
1 | 516 |
|
359 | 517 |
// Moderation: IP address link |
518 |
tplvars.MOD_IP_LINK = '<span id="comment_ip_' + i + '"><a href="#mod_ip_' + i + '" onclick="viewCommentIP(' + data.comment_id + ', ' + i + '); return false;">' + $lang.get('comment_btn_mod_ip_logged') + '</a></span>'; |
|
519 |
||
1 | 520 |
var tplbool = new Object(); |
521 |
||
522 |
tplbool.signature = ( data.signature == '' ) ? false : true; |
|
523 |
tplbool.can_edit = ( data.auth_edit_comments && ( ( data.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) ); |
|
524 |
tplbool.auth_mod = data.auth_mod_comments; |
|
328
dc838fd61a06
Added initial avatar support. Currently rather feature complete except for admin controls for avatar.
Dan
parents:
214
diff
changeset
|
525 |
tplbool.user_has_avatar = ( data.user_has_avatar == '1' ); |
1 | 526 |
|
527 |
parser.assign_vars(tplvars); |
|
528 |
parser.assign_bool(tplbool); |
|
529 |
||
530 |
var div = document.createElement('div'); |
|
531 |
div.id = 'comment_holder_'+i; |
|
532 |
||
533 |
div.innerHTML = '<input type="hidden" value="'+data.comment_id+'" /><input type="hidden" id="comment_source_'+i+'" />' + parser.run(); |
|
534 |
||
535 |
if ( brother ) |
|
536 |
{ |
|
537 |
brother.parentNode.insertBefore(div, brother.nextSibling); |
|
538 |
} |
|
539 |
else |
|
540 |
{ |
|
541 |
// No comments in ajaxEditContainer, insert it after the header |
|
542 |
var aec = document.getElementById("ajaxEditContainer"); |
|
543 |
aec.insertBefore(div, aec.firstChild.nextSibling.nextSibling); |
|
544 |
} |
|
545 |
||
546 |
document.getElementById('comment_source_'+i).value = data.comment_source; |
|
547 |
||
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
548 |
var cnt = document.getElementById('comment_count_inner').innerHTML; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
549 |
cnt = parseInt(cnt); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
550 |
if ( isNaN(cnt) ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
551 |
cnt = 0; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
552 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
553 |
var subst = { |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
554 |
num_comments: cnt, |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
555 |
page_type: ENANO_PAGE_TYPE |
1 | 556 |
} |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
557 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
558 |
var count_msg = ( cnt == 0 ) ? $lang.get('comment_msg_count_zero', subst) : ( ( cnt == 1 ) ? $lang.get('comment_msg_count_one', subst) : $lang.get('comment_msg_count_plural', subst) ); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
559 |
|
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
560 |
document.getElementById('comment_status').firstChild.innerHTML = count_msg; |
1 | 561 |
|
562 |
if(document.getElementById('comment_approve_'+i)) |
|
563 |
{ |
|
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
564 |
var is_unappr = document.getElementById('comment_approve_'+i).firstChild.nodeValue; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
565 |
is_unappr = ( is_unappr == $lang.get('comment_btn_mod_approve') ); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
566 |
if ( is_unappr ) |
1 | 567 |
{ |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
568 |
comment_increment_unapproval(); |
1 | 569 |
} |
570 |
} |
|
571 |
||
572 |
} |
|
573 |
||
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
574 |
window.comment_decrement_unapproval = function() |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
575 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
576 |
if ( document.getElementById('comment_count_unapp_inner') ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
577 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
578 |
var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
579 |
if ( !isNaN(num_unapp) ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
580 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
581 |
num_unapp = num_unapp - 1; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
582 |
if ( num_unapp == 0 ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
583 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
584 |
var p = document.getElementById('comment_status'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
585 |
p.removeChild(p.childNodes[2]); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
586 |
p.removeChild(p.childNodes[1]); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
587 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
588 |
else |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
589 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
590 |
var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp }); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
591 |
document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
592 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
593 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
594 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
595 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
596 |
|
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
597 |
window.comment_increment_unapproval = function() |
212
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
598 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
599 |
if ( document.getElementById('comment_count_unapp_inner') ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
600 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
601 |
var num_unapp = parseInt(document.getElementById('comment_count_unapp_inner').innerHTML); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
602 |
if ( isNaN(num_unapp) ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
603 |
num_unapp = 0; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
604 |
num_unapp = num_unapp + 1; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
605 |
var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: num_unapp }); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
606 |
document.getElementById('comment_count_unapp_inner').parentNode.innerHTML = count_msg; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
607 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
608 |
else |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
609 |
{ |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
610 |
var count_msg = $lang.get('comment_msg_count_unapp_mod', { num_unapp: 1 }); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
611 |
var status = document.getElementById('comment_status'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
612 |
if ( !status.childNodes[1] ) |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
613 |
status.appendChild(document.createTextNode(' ')); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
614 |
var span = document.createElement('span'); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
615 |
span.id = 'comment_status_unapp'; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
616 |
span.style.color = '#D84308'; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
617 |
span.innerHTML = count_msg; |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
618 |
status.appendChild(span); |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
619 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
620 |
} |
30b857a6b811
Reworked comment system to not use HACKISH FIXES; AJAX comment framework is completely localized now
Dan
parents:
108
diff
changeset
|
621 |
|
582
a38876c0793c
Majorly reworked Javascript runtime stuff to use on-demand loading.
Dan
parents:
550
diff
changeset
|
622 |
window.viewCommentIP = function(id, local_id) |
359 | 623 |
{ |
624 |
// set "loading" indicator on IP button |
|
420
301f546688d1
Re-enabled, debugged, and optimized Javascript compression code
Dan
parents:
407
diff
changeset
|
625 |
var span = $dynano('comment_ip_' + local_id).object; |
359 | 626 |
if ( !span ) |
627 |
return false; |
|
628 |
span.innerHTML = '<img alt="..." src="' + ajax_load_icon + '" />'; |
|
629 |
||
630 |
var parms = { |
|
631 |
mode: 'view_ip', |
|
632 |
id: id, |
|
633 |
local_id: local_id |
|
634 |
} |
|
635 |
ajaxComments(parms); |
|
636 |
} |
|
637 |