Comments – wpDiscuz - Version 3.0.1

Version Description

Supercharged Comments =

IMPORTANT: If your're updating from wpDiscuz 1.x or from 2.x you should do one-time data optimization of existing comments. Please go to Comments > wpDiscuz Settings > Comments Optimization Tab and click on [Supercharge my comments] button and wait for 100% result.

IMPORTANT: If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.

  • Tip: [Supercharge my comments] button doesn't work
  • Tip: "There are new comments for optimization [--button--]" message can't get away
  • Fixed Bug: CAPTCHA image doesn't work (on websites where post ajax php file is secured)
Download this release

Release Info

Developer gzakar
Plugin Icon 128x128 Comments – wpDiscuz
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

assets/js/jquery.cookie.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery Cookie Plugin v1.4.1
3
+ * https://github.com/carhartl/jquery-cookie
4
+ *
5
+ * Copyright 2013 Klaus Hartl
6
+ * Released under the MIT license
7
+ */
8
+ (function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD
11
+ define(['jquery'], factory);
12
+ } else if (typeof exports === 'object') {
13
+ // CommonJS
14
+ factory(require('jquery'));
15
+ } else {
16
+ // Browser globals
17
+ factory(jQuery);
18
+ }
19
+ }(function ($) {
20
+
21
+ var pluses = /\+/g;
22
+
23
+ function encode(s) {
24
+ return config.raw ? s : encodeURIComponent(s);
25
+ }
26
+
27
+ function decode(s) {
28
+ return config.raw ? s : decodeURIComponent(s);
29
+ }
30
+
31
+ function stringifyCookieValue(value) {
32
+ return encode(config.json ? JSON.stringify(value) : String(value));
33
+ }
34
+
35
+ function parseCookieValue(s) {
36
+ if (s.indexOf('"') === 0) {
37
+ // This is a quoted cookie as according to RFC2068, unescape...
38
+ s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
39
+ }
40
+
41
+ try {
42
+ // Replace server-side written pluses with spaces.
43
+ // If we can't decode the cookie, ignore it, it's unusable.
44
+ // If we can't parse the cookie, ignore it, it's unusable.
45
+ s = decodeURIComponent(s.replace(pluses, ' '));
46
+ return config.json ? JSON.parse(s) : s;
47
+ } catch(e) {}
48
+ }
49
+
50
+ function read(s, converter) {
51
+ var value = config.raw ? s : parseCookieValue(s);
52
+ return $.isFunction(converter) ? converter(value) : value;
53
+ }
54
+
55
+ var config = $.cookie = function (key, value, options) {
56
+
57
+ // Write
58
+
59
+ if (value !== undefined && !$.isFunction(value)) {
60
+ options = $.extend({}, config.defaults, options);
61
+
62
+ if (typeof options.expires === 'number') {
63
+ var days = options.expires, t = options.expires = new Date();
64
+ t.setTime(+t + days * 864e+5);
65
+ }
66
+
67
+ return (document.cookie = [
68
+ encode(key), '=', stringifyCookieValue(value),
69
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
70
+ options.path ? '; path=' + options.path : '',
71
+ options.domain ? '; domain=' + options.domain : '',
72
+ options.secure ? '; secure' : ''
73
+ ].join(''));
74
+ }
75
+
76
+ // Read
77
+
78
+ var result = key ? undefined : {};
79
+
80
+ // To prevent the for loop in the first place assign an empty array
81
+ // in case there are no cookies at all. Also prevents odd result when
82
+ // calling $.cookie().
83
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
84
+
85
+ for (var i = 0, l = cookies.length; i < l; i++) {
86
+ var parts = cookies[i].split('=');
87
+ var name = decode(parts.shift());
88
+ var cookie = parts.join('=');
89
+
90
+ if (key && key === name) {
91
+ // If second argument (value) is a function it's a converter...
92
+ result = read(cookie, value);
93
+ break;
94
+ }
95
+
96
+ // Prevent storing a cookie that we couldn't decode.
97
+ if (!key && (cookie = read(cookie)) !== undefined) {
98
+ result[name] = cookie;
99
+ }
100
+ }
101
+
102
+ return result;
103
+ };
104
+
105
+ config.defaults = {};
106
+
107
+ $.removeCookie = function (key, options) {
108
+ if ($.cookie(key) === undefined) {
109
+ return false;
110
+ }
111
+
112
+ // Must not alter options, thus extending a fresh object...
113
+ $.cookie(key, '', $.extend({}, options, { expires: -1 }));
114
+ return !$.cookie(key);
115
+ };
116
+
117
+ }));
assets/js/jquery.cookie.min.js CHANGED
@@ -1,9 +1,9 @@
1
-
2
- /*!
3
- * jQuery Cookie Plugin v1.4.1
4
- * https://github.com/carhartl/jquery-cookie
5
- *
6
- * Copyright 2013 Klaus Hartl
7
- * Released under the MIT license
8
- */
9
  (function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(f){var a=/\+/g;function d(i){return b.raw?i:encodeURIComponent(i)}function g(i){return b.raw?i:decodeURIComponent(i)}function h(i){return d(b.json?JSON.stringify(i):String(i))}function c(i){if(i.indexOf('"')===0){i=i.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{i=decodeURIComponent(i.replace(a," "));return b.json?JSON.parse(i):i}catch(j){}}function e(j,i){var k=b.raw?j:c(j);return f.isFunction(i)?i(k):k}var b=f.cookie=function(q,p,v){if(p!==undefined&&!f.isFunction(p)){v=f.extend({},b.defaults,v);if(typeof v.expires==="number"){var r=v.expires,u=v.expires=new Date();u.setTime(+u+r*86400000)}return(document.cookie=[d(q),"=",h(p),v.expires?"; expires="+v.expires.toUTCString():"",v.path?"; path="+v.path:"",v.domain?"; domain="+v.domain:"",v.secure?"; secure":""].join(""))}var w=q?undefined:{};var s=document.cookie?document.cookie.split("; "):[];for(var o=0,m=s.length;o<m;o++){var n=s[o].split("=");var j=g(n.shift());var k=n.join("=");if(q&&q===j){w=e(k,p);break}if(!q&&(k=e(k))!==undefined){w[j]=k}}return w};b.defaults={};f.removeCookie=function(j,i){if(f.cookie(j)===undefined){return false}f.cookie(j,"",f.extend({},i,{expires:-1}));return !f.cookie(j)}}));
1
+
2
+ /*!
3
+ * jQuery Cookie Plugin v1.4.1
4
+ * https://github.com/carhartl/jquery-cookie
5
+ *
6
+ * Copyright 2013 Klaus Hartl
7
+ * Released under the MIT license
8
+ */
9
  (function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(f){var a=/\+/g;function d(i){return b.raw?i:encodeURIComponent(i)}function g(i){return b.raw?i:decodeURIComponent(i)}function h(i){return d(b.json?JSON.stringify(i):String(i))}function c(i){if(i.indexOf('"')===0){i=i.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{i=decodeURIComponent(i.replace(a," "));return b.json?JSON.parse(i):i}catch(j){}}function e(j,i){var k=b.raw?j:c(j);return f.isFunction(i)?i(k):k}var b=f.cookie=function(q,p,v){if(p!==undefined&&!f.isFunction(p)){v=f.extend({},b.defaults,v);if(typeof v.expires==="number"){var r=v.expires,u=v.expires=new Date();u.setTime(+u+r*86400000)}return(document.cookie=[d(q),"=",h(p),v.expires?"; expires="+v.expires.toUTCString():"",v.path?"; path="+v.path:"",v.domain?"; domain="+v.domain:"",v.secure?"; secure":""].join(""))}var w=q?undefined:{};var s=document.cookie?document.cookie.split("; "):[];for(var o=0,m=s.length;o<m;o++){var n=s[o].split("=");var j=g(n.shift());var k=n.join("=");if(q&&q===j){w=e(k,p);break}if(!q&&(k=e(k))!==undefined){w[j]=k}}return w};b.defaults={};f.removeCookie=function(j,i){if(f.cookie(j)===undefined){return false}f.cookie(j,"",f.extend({},i,{expires:-1}));return !f.cookie(j)}}));
assets/js/validator.js ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Validator v1.1.0
3
+ (c) Yair Even Or
4
+ https://github.com/yairEO/validator
5
+
6
+ MIT-style license.
7
+ */
8
+
9
+ var wpdiscuzValidator = (function ($) {
10
+ var message, tests, checkField, validate, mark, unmark, field, minmax, defaults,
11
+ validateWords, lengthRange, lengthLimit, pattern, alertTxt, data,
12
+ email_illegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\]]/,
13
+ email_filter = /^.+@.+\..{2,50}$/;
14
+ /* general text messages
15
+ */
16
+ message = {
17
+ invalid: 'invalid input',
18
+ empty: 'please put something here',
19
+ min: 'input is too short',
20
+ max: 'input is too long',
21
+ number_min: 'too low',
22
+ number_max: 'too high',
23
+ url: 'invalid URL',
24
+ number: 'not a number',
25
+ email: 'email address is invalid',
26
+ email_repeat: 'emails do not match',
27
+ password_repeat: 'passwords do not match',
28
+ repeat: 'no match',
29
+ complete: 'input is not complete',
30
+ select: 'Please select an option'
31
+ };
32
+ if (!window.console) {
33
+ console = {};
34
+ console.log = console.warn = function () {
35
+ return;
36
+ }
37
+ }
38
+
39
+ // defaults
40
+ defaults = {alerts: true};
41
+ /* Tests for each type of field (including Select element)
42
+ */
43
+ tests = {
44
+ sameAsPlaceholder: function (a) {
45
+ return $.fn.placeholder && a.attr('placeholder') !== undefined && data.val == a.prop('placeholder');
46
+ },
47
+ hasValue: function (a) {
48
+ if (!a) {
49
+ alertTxt = message.empty;
50
+ return false;
51
+ }
52
+ return true;
53
+ },
54
+ // 'linked' is a special test case for inputs which their values should be equal to each other (ex. confirm email or retype password)
55
+ linked: function (a, b) {
56
+ if (b != a) {
57
+ // choose a specific message or a general one
58
+ alertTxt = message[data.type + '_repeat'] || message.no_match;
59
+ return false;
60
+ }
61
+ return true;
62
+ },
63
+ email: function (a) {
64
+ if (!email_filter.test(a) || a.match(email_illegalChars)) {
65
+ alertTxt = a ? message.email : message.empty;
66
+ return false;
67
+ }
68
+ return true;
69
+ },
70
+ text: function (a) {
71
+ // make sure there are at least X number of words, each at least 2 chars long.
72
+ // for example 'john F kenedy' should be at least 2 words and will pass validation
73
+ if (validateWords) {
74
+ var words = a.split(' ');
75
+ // iterrate on all the words
76
+ var wordsLength = function (len) {
77
+ for (var w = words.length; w--; )
78
+ if (words[w].length < len)
79
+ return false;
80
+ return true;
81
+ };
82
+ if (words.length < validateWords || !wordsLength(2)) {
83
+ alertTxt = message.complete;
84
+ return false;
85
+ }
86
+ return true;
87
+ }
88
+ if (lengthRange && a.length < lengthRange[0]) {
89
+ alertTxt = message.min;
90
+ return false;
91
+ }
92
+
93
+ // check if there is max length & field length is greater than the allowed
94
+ if (lengthRange && lengthRange[1] && a.length > lengthRange[1]) {
95
+ alertTxt = message.max;
96
+ return false;
97
+ }
98
+ // check if the field's value should obey any length limits, and if so, make sure the length of the value is as specified
99
+ if (lengthLimit && lengthLimit.length) {
100
+ var obeyLimit = false;
101
+ while (lengthLimit.length) {
102
+ if (lengthLimit.pop() == a.length)
103
+ obeyLimit = true;
104
+ }
105
+ if (!obeyLimit) {
106
+ alertTxt = message.complete;
107
+ return false;
108
+ }
109
+ }
110
+
111
+ if (pattern) {
112
+ var regex, jsRegex;
113
+ switch (pattern) {
114
+ case 'alphanumeric' :
115
+ regex = /^[a-z0-9]+$/i;
116
+ break;
117
+ case 'numeric' :
118
+ regex = /^[0-9]+$/i;
119
+ break;
120
+ case 'phone' :
121
+ regex = /^\+?([0-9]|[-|' '])+$/i;
122
+ break;
123
+ default :
124
+ regex = pattern;
125
+ }
126
+ try {
127
+ jsRegex = new RegExp(regex).test(a);
128
+ if (a && !jsRegex)
129
+ return false;
130
+ }
131
+ catch (err) {
132
+ console.log(err, field, 'regex is invalid');
133
+ return false;
134
+ }
135
+ }
136
+ return true;
137
+ },
138
+ number: function (a) {
139
+ // if not not a number
140
+ if (isNaN(parseFloat(a)) && !isFinite(a)) {
141
+ alertTxt = message.number;
142
+ return false;
143
+ }
144
+ // not enough numbers
145
+ else if (lengthRange && a.length < lengthRange[0]) {
146
+ alertTxt = message.min;
147
+ return false;
148
+ }
149
+ // check if there is max length & field length is greater than the allowed
150
+ else if (lengthRange && lengthRange[1] && a.length > lengthRange[1]) {
151
+ alertTxt = message.max;
152
+ return false;
153
+ }
154
+ else if (minmax[0] && (a | 0) < minmax[0]) {
155
+ alertTxt = message.number_min;
156
+ return false;
157
+ }
158
+ else if (minmax[1] && (a | 0) > minmax[1]) {
159
+ alertTxt = message.number_max;
160
+ return false;
161
+ }
162
+ return true;
163
+ },
164
+ // Date is validated in European format (day,month,year)
165
+ date: function (a) {
166
+ var day, A = a.split(/[-./]/g), i;
167
+ // if there is native HTML5 support:
168
+ if (field[0].valueAsNumber)
169
+ return true;
170
+ for (i = A.length; i--; ) {
171
+ if (isNaN(parseFloat(a)) && !isFinite(a))
172
+ return false;
173
+ }
174
+ try {
175
+ day = new Date(A[2], A[1] - 1, A[0]);
176
+ if (day.getMonth() + 1 == A[1] && day.getDate() == A[0])
177
+ return day;
178
+ return false;
179
+ }
180
+ catch (er) {
181
+ console.log('date test: ', err);
182
+ return false;
183
+ }
184
+ },
185
+ url: function (a) {
186
+ // minimalistic URL validation
187
+ function testUrl(url) {
188
+ // return /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/i.test(url);
189
+ // return /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-zа-я]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/.test(url);
190
+ return /^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(url);
191
+ // return /^(https?:\/\/)?([\w\d\-_]+\.+[A-Za-z]{2,})+\/?/.test(url);
192
+ }
193
+ if (!testUrl(a)) {
194
+ console.log(a);
195
+ alertTxt = a ? message.url : message.empty;
196
+ return false;
197
+ }
198
+ return true;
199
+ },
200
+ hidden: function (a) {
201
+ if (lengthRange && a.length < lengthRange[0]) {
202
+ alertTxt = message.min;
203
+ return false;
204
+ }
205
+ if (pattern) {
206
+ var regex;
207
+ if (pattern == 'alphanumeric') {
208
+ regex = /^[a-z0-9]+$/i;
209
+ if (!regex.test(a)) {
210
+ return false;
211
+ }
212
+ }
213
+ }
214
+ return true;
215
+ },
216
+ select: function (a) {
217
+ if (!tests.hasValue(a)) {
218
+ alertTxt = message.select;
219
+ return false;
220
+ }
221
+ return true;
222
+ }
223
+ };
224
+ /* marks invalid fields
225
+ */
226
+ mark = function (field, text) {
227
+ if (!text || !field || !field.length)
228
+ return false;
229
+ // check if not already marked as a 'bad' record and add the 'alert' object.
230
+ // if already is marked as 'bad', then make sure the text is set again because it might change depending on validation
231
+ var item = field.parents('.wpdiscuz-item'),
232
+ warning;
233
+ if (item.hasClass('bad')) {
234
+ if (defaults.alerts)
235
+ item.find('.alert').html(text);
236
+ }
237
+ else if (defaults.alerts) {
238
+ warning = $('<div class="alert">').html(text);
239
+ item.append(warning);
240
+ }
241
+
242
+ item.removeClass('bad');
243
+ // a delay so the "alert" could be transitioned via CSS
244
+ setTimeout(function () {
245
+ item.addClass('bad');
246
+ }, 0);
247
+ };
248
+ /* un-marks invalid fields
249
+ */
250
+ unmark = function (field) {
251
+ if (!field || !field.length) {
252
+ console.warn('no "field" argument, null or DOM object not found');
253
+ return false;
254
+ }
255
+
256
+ field.parents('.wpdiscuz-item')
257
+ .removeClass('bad')
258
+ .find('.alert').remove();
259
+ };
260
+ function testByType(type, value) {
261
+ if (type == 'tel')
262
+ pattern = pattern || 'phone';
263
+ if (!type || type == 'password' || type == 'tel')
264
+ type = 'text';
265
+ return tests[type](value);
266
+ }
267
+
268
+ function prepareFieldData(el) {
269
+ field = $(el);
270
+ field.data('valid', true); // initialize validity of field
271
+ field.data('type', field.attr('type')); // every field starts as 'valid=true' until proven otherwise
272
+ pattern = field.attr('pattern');
273
+ }
274
+
275
+ /* Validations per-character keypress
276
+ */
277
+ function keypress(e) {
278
+ prepareFieldData(this);
279
+ if (e.charCode)
280
+ return testByType(this.type, String.fromCharCode(e.charCode));
281
+ }
282
+
283
+ /* Checks a single form field by it's type and specific (custom) attributes
284
+ */
285
+ function checkField() {
286
+ // skip testing fields whom their type is not HIDDEN but they are HIDDEN via CSS.
287
+ if (this.type != 'hidden' && $(this).is(':hidden'))
288
+ return true;
289
+ prepareFieldData(this);
290
+ field.data('val', field[0].value.replace(/^\s+|\s+$/g, "")); // cache the value of the field and trim it
291
+ data = field.data();
292
+ // Check if there is a specific error message for that field, if not, use the default 'invalid' message
293
+ alertTxt = message[field.prop('name')] || message.invalid;
294
+ // SELECT / TEXTAREA nodes needs special treatment
295
+ if (field[0].nodeName.toLowerCase() === "select") {
296
+ data.type = 'select';
297
+ }
298
+ if (field[0].nodeName.toLowerCase() === "textarea") {
299
+ data.type = 'text';
300
+ }
301
+ /* Gather Custom data attributes for specific validation:
302
+ */
303
+ validateWords = data['validateWords'] || 0;
304
+ lengthRange = data['validateLengthRange'] ? (data['validateLengthRange'] + '').split(',') : [1];
305
+ lengthLimit = data['validateLength'] ? (data['validateLength'] + '').split(',') : false;
306
+ minmax = data['validateMinmax'] ? (data['validateMinmax'] + '').split(',') : ''; // for type 'number', defines the minimum and/or maximum for the value as a number.
307
+
308
+ data.valid = tests.hasValue(data.val);
309
+ // check if field has any value
310
+ if (data.valid) {
311
+ /* Validate the field's value is different than the placeholder attribute (and attribute exists)
312
+ * this is needed when fixing the placeholders for older browsers which does not support them.
313
+ * in this case, make sure the "placeholder" jQuery plugin was even used before proceeding
314
+ */
315
+ if (tests.sameAsPlaceholder(field)) {
316
+ alertTxt = message.empty;
317
+ data.valid = false;
318
+ }
319
+
320
+ // if this field is linked to another field (their values should be the same)
321
+ if (data.validateLinked) {
322
+ var linkedTo = data['validateLinked'].indexOf('#') == 0 ? $(data['validateLinked']) : $(':input[name=' + data['validateLinked'] + ']');
323
+ data.valid = tests.linked(data.val, linkedTo.val());
324
+ }
325
+ /* validate by type of field. use 'attr()' is proffered to get the actual value and not what the browsers sees for unsupported types.
326
+ */
327
+ else if (data.valid || data.type == 'select') {
328
+ data.valid = testByType(data.type, data.val);
329
+ }
330
+
331
+ }
332
+
333
+ // optional fields are only validated if they are not empty
334
+ if (field.hasClass('wpdiscuz_optional') && !data.val) {
335
+ data.valid = true;
336
+ }
337
+
338
+ // mark / unmark the field, and set the general 'submit' flag accordingly
339
+ if (data.valid) {
340
+ unmark(field);
341
+ }
342
+ else {
343
+ mark(field, alertTxt);
344
+ submit = false;
345
+ }
346
+
347
+ return data.valid;
348
+ }
349
+
350
+ /* vaildates all the REQUIRED fields prior to submiting the form
351
+ */
352
+ function checkAll($form) {
353
+ $form = $($form);
354
+ if ($form.length == 0) {
355
+ console.warn('element not found');
356
+ return false;
357
+ }
358
+
359
+ var that = this,
360
+ submit = true, // save the scope
361
+ fieldsToCheck = $form.find(':input').filter('[required=required], .required, .wpdiscuz_optional').not('[disabled=disabled]');
362
+ fieldsToCheck.each(function () {
363
+ // use an AND operation, so if any of the fields returns 'false' then the submitted result will be also FALSE
364
+ submit = submit * checkField.apply(this);
365
+ });
366
+ return !!submit; // casting the variable to make sure it's a boolean
367
+ }
368
+
369
+ return {
370
+ defaults: defaults,
371
+ checkField: checkField,
372
+ keypress: keypress,
373
+ checkAll: checkAll,
374
+ mark: mark,
375
+ unmark: unmark,
376
+ message: message,
377
+ tests: tests
378
+ }
379
+ })(jQuery);
assets/js/validator.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  var wpdiscuzValidator=(function(c){var l,e,o,q,h,s,b,g,j,r,m,t,u,f,v,a=/[\(\)\<\>\,\;\:\\\/\"\[\]]/,d=/^.+@.+\..{2,50}$/;l={invalid:"invalid input",empty:"please put something here",min:"input is too short",max:"input is too long",number_min:"too low",number_max:"too high",url:"invalid URL",number:"not a number",email:"email address is invalid",email_repeat:"emails do not match",password_repeat:"passwords do not match",repeat:"no match",complete:"input is not complete",select:"Please select an option"};if(!window.console){console={};console.log=console.warn=function(){return}}j={alerts:true};e={sameAsPlaceholder:function(w){return c.fn.placeholder&&w.attr("placeholder")!==undefined&&v.val==w.prop("placeholder")},hasValue:function(w){if(!w){f=l.empty;return false}return true},linked:function(x,w){if(w!=x){f=l[v.type+"_repeat"]||l.no_match;return false}return true},email:function(w){if(!d.test(w)||w.match(a)){f=w?l.email:l.empty;return false}return true},text:function(x){if(r){var C=x.split(" ");var B=function(D){for(var E=C.length;E--;){if(C[E].length<D){return false}}return true};if(C.length<r||!B(2)){f=l.complete;return false}return true}if(m&&x.length<m[0]){f=l.min;return false}if(m&&m[1]&&x.length>m[1]){f=l.max;return false}if(t&&t.length){var A=false;while(t.length){if(t.pop()==x.length){A=true}}if(!A){f=l.complete;return false}}if(u){var z,w;switch(u){case"alphanumeric":z=/^[a-z0-9]+$/i;break;case"numeric":z=/^[0-9]+$/i;break;case"phone":z=/^\+?([0-9]|[-|' '])+$/i;break;default:z=u}try{w=new RegExp(z).test(x);if(x&&!w){return false}}catch(y){console.log(y,b,"regex is invalid");return false}}return true},number:function(w){if(isNaN(parseFloat(w))&&!isFinite(w)){f=l.number;return false}else{if(m&&w.length<m[0]){f=l.min;return false}else{if(m&&m[1]&&w.length>m[1]){f=l.max;return false}else{if(g[0]&&(w|0)<g[0]){f=l.number_min;return false}else{if(g[1]&&(w|0)>g[1]){f=l.number_max;return false}}}}}return true},date:function(x){var y,w=x.split(/[-./]/g),z;if(b[0].valueAsNumber){return true}for(z=w.length;z--;){if(isNaN(parseFloat(x))&&!isFinite(x)){return false}}try{y=new Date(w[2],w[1]-1,w[0]);if(y.getMonth()+1==w[1]&&y.getDate()==w[0]){return y}return false}catch(B){console.log("date test: ",err);return false}},url:function(w){function x(y){return/^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(y)}if(!x(w)){console.log(w);f=w?l.url:l.empty;return false}return true},hidden:function(w){if(m&&w.length<m[0]){f=l.min;return false}if(u){var x;if(u=="alphanumeric"){x=/^[a-z0-9]+$/i;if(!x.test(w)){return false}}}return true},select:function(w){if(!e.hasValue(w)){f=l.select;return false}return true}};h=function(y,z){if(!z||!y||!y.length){return false}var x=y.parents(".wpdiscuz-item"),w;if(x.hasClass("bad")){if(j.alerts){x.find(".alert").html(z)}}else{if(j.alerts){w=c('<div class="alert">').html(z);x.append(w)}}x.removeClass("bad");setTimeout(function(){x.addClass("bad")},0)};s=function(w){if(!w||!w.length){console.warn('no "field" argument, null or DOM object not found');return false}w.parents(".wpdiscuz-item").removeClass("bad").find(".alert").remove()};function k(w,x){if(w=="tel"){u=u||"phone"}if(!w||w=="password"||w=="tel"){w="text"}return e[w](x)}function p(w){b=c(w);b.data("valid",true);b.data("type",b.attr("type"));u=b.attr("pattern")}function i(w){p(this);if(w.charCode){return k(this.type,String.fromCharCode(w.charCode))}}function o(){if(this.type!="hidden"&&c(this).is(":hidden")){return true}p(this);b.data("val",b[0].value.replace(/^\s+|\s+$/g,""));v=b.data();f=l[b.prop("name")]||l.invalid;if(b[0].nodeName.toLowerCase()==="select"){v.type="select"}if(b[0].nodeName.toLowerCase()==="textarea"){v.type="text"}r=v.validateWords||0;m=v.validateLengthRange?(v.validateLengthRange+"").split(","):[1];t=v.validateLength?(v.validateLength+"").split(","):false;g=v.validateMinmax?(v.validateMinmax+"").split(","):"";v.valid=e.hasValue(v.val);if(v.valid){if(e.sameAsPlaceholder(b)){f=l.empty;v.valid=false}if(v.validateLinked){var w=v.validateLinked.indexOf("#")==0?c(v.validateLinked):c(":input[name="+v.validateLinked+"]");v.valid=e.linked(v.val,w.val())}else{if(v.valid||v.type=="select"){v.valid=k(v.type,v.val)}}}if(b.hasClass("wpdiscuz_optional")&&!v.val){v.valid=true}if(v.valid){s(b)}else{h(b,f);submit=false}return v.valid}function n(w){w=c(w);if(w.length==0){console.warn("element not found");return false}var y=this,z=true,x=w.find(":input").filter("[required=required], .required, .wpdiscuz_optional").not("[disabled=disabled]");x.each(function(){z=z*o.apply(this)});return !!z}return{defaults:j,checkField:o,keypress:i,checkAll:n,mark:h,unmark:s,message:l,tests:e}})(jQuery);
1
+
2
  var wpdiscuzValidator=(function(c){var l,e,o,q,h,s,b,g,j,r,m,t,u,f,v,a=/[\(\)\<\>\,\;\:\\\/\"\[\]]/,d=/^.+@.+\..{2,50}$/;l={invalid:"invalid input",empty:"please put something here",min:"input is too short",max:"input is too long",number_min:"too low",number_max:"too high",url:"invalid URL",number:"not a number",email:"email address is invalid",email_repeat:"emails do not match",password_repeat:"passwords do not match",repeat:"no match",complete:"input is not complete",select:"Please select an option"};if(!window.console){console={};console.log=console.warn=function(){return}}j={alerts:true};e={sameAsPlaceholder:function(w){return c.fn.placeholder&&w.attr("placeholder")!==undefined&&v.val==w.prop("placeholder")},hasValue:function(w){if(!w){f=l.empty;return false}return true},linked:function(x,w){if(w!=x){f=l[v.type+"_repeat"]||l.no_match;return false}return true},email:function(w){if(!d.test(w)||w.match(a)){f=w?l.email:l.empty;return false}return true},text:function(x){if(r){var C=x.split(" ");var B=function(D){for(var E=C.length;E--;){if(C[E].length<D){return false}}return true};if(C.length<r||!B(2)){f=l.complete;return false}return true}if(m&&x.length<m[0]){f=l.min;return false}if(m&&m[1]&&x.length>m[1]){f=l.max;return false}if(t&&t.length){var A=false;while(t.length){if(t.pop()==x.length){A=true}}if(!A){f=l.complete;return false}}if(u){var z,w;switch(u){case"alphanumeric":z=/^[a-z0-9]+$/i;break;case"numeric":z=/^[0-9]+$/i;break;case"phone":z=/^\+?([0-9]|[-|' '])+$/i;break;default:z=u}try{w=new RegExp(z).test(x);if(x&&!w){return false}}catch(y){console.log(y,b,"regex is invalid");return false}}return true},number:function(w){if(isNaN(parseFloat(w))&&!isFinite(w)){f=l.number;return false}else{if(m&&w.length<m[0]){f=l.min;return false}else{if(m&&m[1]&&w.length>m[1]){f=l.max;return false}else{if(g[0]&&(w|0)<g[0]){f=l.number_min;return false}else{if(g[1]&&(w|0)>g[1]){f=l.number_max;return false}}}}}return true},date:function(x){var y,w=x.split(/[-./]/g),z;if(b[0].valueAsNumber){return true}for(z=w.length;z--;){if(isNaN(parseFloat(x))&&!isFinite(x)){return false}}try{y=new Date(w[2],w[1]-1,w[0]);if(y.getMonth()+1==w[1]&&y.getDate()==w[0]){return y}return false}catch(B){console.log("date test: ",err);return false}},url:function(w){function x(y){return/^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/i.test(y)}if(!x(w)){console.log(w);f=w?l.url:l.empty;return false}return true},hidden:function(w){if(m&&w.length<m[0]){f=l.min;return false}if(u){var x;if(u=="alphanumeric"){x=/^[a-z0-9]+$/i;if(!x.test(w)){return false}}}return true},select:function(w){if(!e.hasValue(w)){f=l.select;return false}return true}};h=function(y,z){if(!z||!y||!y.length){return false}var x=y.parents(".wpdiscuz-item"),w;if(x.hasClass("bad")){if(j.alerts){x.find(".alert").html(z)}}else{if(j.alerts){w=c('<div class="alert">').html(z);x.append(w)}}x.removeClass("bad");setTimeout(function(){x.addClass("bad")},0)};s=function(w){if(!w||!w.length){console.warn('no "field" argument, null or DOM object not found');return false}w.parents(".wpdiscuz-item").removeClass("bad").find(".alert").remove()};function k(w,x){if(w=="tel"){u=u||"phone"}if(!w||w=="password"||w=="tel"){w="text"}return e[w](x)}function p(w){b=c(w);b.data("valid",true);b.data("type",b.attr("type"));u=b.attr("pattern")}function i(w){p(this);if(w.charCode){return k(this.type,String.fromCharCode(w.charCode))}}function o(){if(this.type!="hidden"&&c(this).is(":hidden")){return true}p(this);b.data("val",b[0].value.replace(/^\s+|\s+$/g,""));v=b.data();f=l[b.prop("name")]||l.invalid;if(b[0].nodeName.toLowerCase()==="select"){v.type="select"}if(b[0].nodeName.toLowerCase()==="textarea"){v.type="text"}r=v.validateWords||0;m=v.validateLengthRange?(v.validateLengthRange+"").split(","):[1];t=v.validateLength?(v.validateLength+"").split(","):false;g=v.validateMinmax?(v.validateMinmax+"").split(","):"";v.valid=e.hasValue(v.val);if(v.valid){if(e.sameAsPlaceholder(b)){f=l.empty;v.valid=false}if(v.validateLinked){var w=v.validateLinked.indexOf("#")==0?c(v.validateLinked):c(":input[name="+v.validateLinked+"]");v.valid=e.linked(v.val,w.val())}else{if(v.valid||v.type=="select"){v.valid=k(v.type,v.val)}}}if(b.hasClass("wpdiscuz_optional")&&!v.val){v.valid=true}if(v.valid){s(b)}else{h(b,f);submit=false}return v.valid}function n(w){w=c(w);if(w.length==0){console.warn("element not found");return false}var y=this,z=true,x=w.find(":input").filter("[required=required], .required, .wpdiscuz_optional").not("[disabled=disabled]");x.each(function(){z=z*o.apply(this)});return !!z}return{defaults:j,checkField:o,keypress:i,checkAll:n,mark:h,unmark:s,message:l,tests:e}})(jQuery);
assets/js/wpdiscuz-captcha.js ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ var mainWrapperUniqueId = getUniqueID($('.wc_main_comm_form'), 1);
3
+
4
+ $(document).delegate('.wc_captcha_refresh_img', 'click', function () {
5
+ changeCaptchaImage($(this));
6
+ });
7
+
8
+ $(document).delegate('.wc_field_captcha', 'focus', function () {
9
+ changeCaptchaImage($(this));//messig avelcnel cuyc tal
10
+ });
11
+
12
+ wpdiscuzTimeoutForCaptcha(mainWrapperUniqueId, 30 * 60 * 1000);
13
+
14
+ /*=======================FUNCTIONS===================================*/
15
+ function wpdiscuzTimeoutForCaptcha(uniqueId, time) {
16
+ wpdiscuzRemoveExpiredClass(uniqueId);
17
+ setTimeout(function () {
18
+ captchaExpiredTime(uniqueId);
19
+ wpdiscuzAddExpiredClass(uniqueId);
20
+ }, time);
21
+ }
22
+
23
+ function wpdiscuzAddExpiredClass(uniqueId) {
24
+ if ($('#wc-secondary-form-wrapper-' + uniqueId).hasClass('wc-secondary-forms')) {
25
+ $('#wc-secondary-form-wrapper-' + uniqueId + ' .wc_field_captcha').addClass('wpdiscuz-expired');
26
+ } else {
27
+ $('#wc-main-form-wrapper-' + uniqueId + ' .wc_field_captcha').addClass('wpdiscuz-expired');
28
+ }
29
+ }
30
+
31
+ function wpdiscuzRemoveExpiredClass(uniqueId) {
32
+ if ($('#wc-secondary-form-wrapper-' + uniqueId).hasClass('wc-secondary-forms')) {
33
+ $('#wc-secondary-form-wrapper-' + uniqueId + ' .wc_field_captcha').removeClass('wpdiscuz-expired');
34
+ } else {
35
+ $('#wc-main-form-wrapper-' + uniqueId + ' .wc_field_captcha').removeClass('wpdiscuz-expired');
36
+ }
37
+ }
38
+
39
+ function captchaExpiredTime(uniqueId) {
40
+ $.ajax({
41
+ type: 'POST',
42
+ url: wpdiscuz_ajax_obj.url,
43
+ data: {
44
+ wpdiscuz_uniqueId: uniqueId,
45
+ action: 'setCaptchaExpired'
46
+ }
47
+ });
48
+ }
49
+
50
+ function changeCaptchaImage(reloadImage) {
51
+ var captchaImg = $(reloadImage).prev().children('.wc_captcha_img');
52
+ var src = captchaImg.attr('src');
53
+ var new_src = src.substring(0, src.lastIndexOf('=')) + '=' + Math.random();
54
+ captchaImg.attr('src', new_src);
55
+ var isMain = reloadImage.parents('.wc-form-wrapper').hasClass('wc-secondary-forms') ? 0 : 1;
56
+ var uniqueId = getUniqueID(reloadImage, isMain);
57
+ var time = isMain ? 30 * 60 * 1000 : 15 * 60 * 1000;
58
+ wpdiscuzTimeoutForCaptcha(uniqueId, time);
59
+ }
60
+ });
assets/js/wpdiscuz-captcha.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  jQuery(document).ready(function(f){var d=getUniqueID(f(".wc_main_comm_form"),1);f(document).delegate(".wc_captcha_refresh_img","click",function(){b(f(this))});f(document).delegate(".wc_field_captcha","focus",function(){b(f(this))});a(d,30*60*1000);function a(i,h){g(i);setTimeout(function(){e(i);c(i)},h)}function c(h){if(f("#wc-secondary-form-wrapper-"+h).hasClass("wc-secondary-forms")){f("#wc-secondary-form-wrapper-"+h+" .wc_field_captcha").addClass("wpdiscuz-expired")}else{f("#wc-main-form-wrapper-"+h+" .wc_field_captcha").addClass("wpdiscuz-expired")}}function g(h){if(f("#wc-secondary-form-wrapper-"+h).hasClass("wc-secondary-forms")){f("#wc-secondary-form-wrapper-"+h+" .wc_field_captcha").removeClass("wpdiscuz-expired")}else{f("#wc-main-form-wrapper-"+h+" .wc_field_captcha").removeClass("wpdiscuz-expired")}}function e(h){f.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuz_uniqueId:h,action:"setCaptchaExpired"}})}function b(m){var j=f(m).prev().children(".wc_captcha_img");var l=j.attr("src");var h=l.substring(0,l.lastIndexOf("="))+"="+Math.random();j.attr("src",h);var i=m.parents(".wc-form-wrapper").hasClass("wc-secondary-forms")?0:1;var n=getUniqueID(m,i);var k=i?30*60*1000:15*60*1000;a(n,k)}});
1
+
2
  jQuery(document).ready(function(f){var d=getUniqueID(f(".wc_main_comm_form"),1);f(document).delegate(".wc_captcha_refresh_img","click",function(){b(f(this))});f(document).delegate(".wc_field_captcha","focus",function(){b(f(this))});a(d,30*60*1000);function a(i,h){g(i);setTimeout(function(){e(i);c(i)},h)}function c(h){if(f("#wc-secondary-form-wrapper-"+h).hasClass("wc-secondary-forms")){f("#wc-secondary-form-wrapper-"+h+" .wc_field_captcha").addClass("wpdiscuz-expired")}else{f("#wc-main-form-wrapper-"+h+" .wc_field_captcha").addClass("wpdiscuz-expired")}}function g(h){if(f("#wc-secondary-form-wrapper-"+h).hasClass("wc-secondary-forms")){f("#wc-secondary-form-wrapper-"+h+" .wc_field_captcha").removeClass("wpdiscuz-expired")}else{f("#wc-main-form-wrapper-"+h+" .wc_field_captcha").removeClass("wpdiscuz-expired")}}function e(h){f.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuz_uniqueId:h,action:"setCaptchaExpired"}})}function b(m){var j=f(m).prev().children(".wc_captcha_img");var l=j.attr("src");var h=l.substring(0,l.lastIndexOf("="))+"="+Math.random();j.attr("src",h);var i=m.parents(".wc-form-wrapper").hasClass("wc-secondary-forms")?0:1;var n=getUniqueID(m,i);var k=i?30*60*1000:15*60*1000;a(n,k)}});
assets/js/wpdiscuz-options.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ if (location.href.indexOf('wpdiscuz_options_page') >= 0) {
3
+ $('.wpdiscuz-color-picker').colorPicker();
4
+ }
5
+ });
assets/js/wpdiscuz-options.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  jQuery(document).ready(function(a){if(location.href.indexOf("wpdiscuz_options_page")>=0){a(".wpdiscuz-color-picker").colorPicker()}});
1
+
2
  jQuery(document).ready(function(a){if(location.href.indexOf("wpdiscuz_options_page")>=0){a(".wpdiscuz-color-picker").colorPicker()}});
assets/js/wpdiscuz-synch-comments.js ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ var offset;
3
+ var count;
4
+ if (admin_options_obj.lastCommentId) {
5
+ $('#wpdiscuz_synch_comments_count').keyup(function () {
6
+ if (isNaN(parseInt($(this).val()))) {
7
+ $('#wpdiscuz_synch_comments').attr('disabled', 'disabled');
8
+ } else {
9
+ $('#wpdiscuz_synch_comments').removeAttr('disabled');
10
+ count = Math.abs($(this).val());
11
+ }
12
+ });
13
+ }
14
+
15
+ $('#wpdiscuz_synch_comments').click(function () {
16
+ offset = 0;
17
+ $(this).attr('disabled', 'disabled');
18
+ window.onbeforeunload = confirmExit;
19
+ function confirmExit() {
20
+ return "";
21
+ }
22
+ var progressDiv = '<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:1%;">1%</div>';
23
+ document.getElementById('wpdiscuz_progressbar_wrapper').innerHTML = progressDiv;
24
+ count = count > 100 ? 100 : count;
25
+ count = count < 10 ? 10 : count;
26
+ synchronizeComments(count, 0);
27
+ });
28
+ function synchronizeComments(count, synchronizedComments) {
29
+ $.ajax({
30
+ type: 'POST',
31
+ url: ajaxurl,
32
+ data: {
33
+ action: 'synchronizeComments',
34
+ commentsCountPerRequest: count,
35
+ synchronizedComments: synchronizedComments,
36
+ offset: offset
37
+ }
38
+ }).done(function (response) {
39
+ try {
40
+ offset++;
41
+ var width, text;
42
+ var obj = $.parseJSON(response);
43
+ var wpdiscuzProgress = obj.wpdiscuz_progress;
44
+ var synchronizedComments = obj.synchronizedComments;
45
+ if (isNaN(parseInt(wpdiscuzProgress))) {
46
+ width = 100;
47
+ text = wpdiscuzProgress;
48
+ } else {
49
+ width = wpdiscuzProgress;
50
+ text = wpdiscuzProgress + ' %';
51
+ }
52
+ var progressDiv = '<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:' + width + '%;">' + text + '</div>';
53
+ document.getElementById('wpdiscuz_progressbar_wrapper').innerHTML = progressDiv;
54
+
55
+ if (parseInt(wpdiscuzProgress) < 100) {
56
+ synchronizeComments(count, synchronizedComments);
57
+ } else {
58
+ window.onbeforeunload = null;
59
+ }
60
+ } catch (e) {
61
+ console.log(e);
62
+ }
63
+ });
64
+ }
65
+ });
66
+
assets/js/wpdiscuz-synch-comments.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  jQuery(document).ready(function(c){var d;var b;if(admin_options_obj.lastCommentId){c("#wpdiscuz_synch_comments_count").keyup(function(){if(isNaN(parseInt(c(this).val()))){c("#wpdiscuz_synch_comments").attr("disabled","disabled")}else{c("#wpdiscuz_synch_comments").removeAttr("disabled");b=Math.abs(c(this).val())}})}c("#wpdiscuz_synch_comments").click(function(){d=0;c(this).attr("disabled","disabled");window.onbeforeunload=f;function f(){return""}var e='<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:1%;">1%</div>';document.getElementById("wpdiscuz_progressbar_wrapper").innerHTML=e;b=b>100?100:b;b=b<10?10:b;a(b,0)});function a(f,e){c.ajax({type:"POST",url:ajaxurl,data:{action:"synchronizeComments",commentsCountPerRequest:f,synchronizedComments:e,offset:d}}).done(function(h){try{d++;var j,n;var l=c.parseJSON(h);var m=l.wpdiscuz_progress;var i=l.synchronizedComments;if(isNaN(parseInt(m))){j=100;n=m}else{j=m;n=m+" %"}var g='<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:'+j+'%;">'+n+"</div>";document.getElementById("wpdiscuz_progressbar_wrapper").innerHTML=g;if(parseInt(m)<100){a(f,i)}else{window.onbeforeunload=null}}catch(k){console.log(k)}})}});
1
+
2
  jQuery(document).ready(function(c){var d;var b;if(admin_options_obj.lastCommentId){c("#wpdiscuz_synch_comments_count").keyup(function(){if(isNaN(parseInt(c(this).val()))){c("#wpdiscuz_synch_comments").attr("disabled","disabled")}else{c("#wpdiscuz_synch_comments").removeAttr("disabled");b=Math.abs(c(this).val())}})}c("#wpdiscuz_synch_comments").click(function(){d=0;c(this).attr("disabled","disabled");window.onbeforeunload=f;function f(){return""}var e='<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:1%;">1%</div>';document.getElementById("wpdiscuz_progressbar_wrapper").innerHTML=e;b=b>100?100:b;b=b<10?10:b;a(b,0)});function a(f,e){c.ajax({type:"POST",url:ajaxurl,data:{action:"synchronizeComments",commentsCountPerRequest:f,synchronizedComments:e,offset:d}}).done(function(h){try{d++;var j,n;var l=c.parseJSON(h);var m=l.wpdiscuz_progress;var i=l.synchronizedComments;if(isNaN(parseInt(m))){j=100;n=m}else{j=m;n=m+" %"}var g='<div id="wpdiscuz_progressbar" class="wpdiscuz_progressbar" style="width:'+j+'%;">'+n+"</div>";document.getElementById("wpdiscuz_progressbar_wrapper").innerHTML=g;if(parseInt(m)<100){a(f,i)}else{window.onbeforeunload=null}}catch(k){console.log(k)}})}});
assets/js/wpdiscuz.js ADDED
@@ -0,0 +1,737 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function ($) {
2
+ wpdiscuzValidator.message['invalid'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_invalid_field;
3
+ wpdiscuzValidator.message['empty'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_empty_text;
4
+ wpdiscuzValidator.message['email'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_email_text;
5
+ wpdiscuzValidator.message['url'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_url_text;
6
+ wpdiscuzValidator.message['min'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_min_length;
7
+ wpdiscuzValidator.message['max'] = wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_max_length;
8
+
9
+ var isUserLoggedIn = wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;
10
+ var isShowCaptchaForGuests = wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide == 0 && !isUserLoggedIn;
11
+ var isShowCaptchaForMembers = parseInt(wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members) > 0 && wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;
12
+ var mainFormTimeOut = wpdiscuz_ajax_obj.wpdiscuz_options.main_form_time_out;
13
+ var secondaryFormTimeOut = wpdiscuz_ajax_obj.wpdiscuz_options.secondary_form_time_out;
14
+ var isLoadAllComments = wpdiscuz_ajax_obj.wpdiscuz_options.wc_load_all_comments;
15
+ var wpdiscuzPostId = wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;
16
+ var commentListUpdateType = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;
17
+ var commentListUpdateTimer = wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;
18
+ var liveUpdateGuests = wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;
19
+ var loadLastCommentId = wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;
20
+ var wpdiscuzCommentOrder = wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;
21
+ var wpdiscuzLoadCount;
22
+ var wpdiscuzCommentOrderBy = 'date';
23
+ var wpdiscuzReplyArray = [];
24
+ var wpdiscuzCommentArray = [];
25
+
26
+ addTooltipster();
27
+ loginButtonsClone();
28
+
29
+ $('.wpdiscuz-date-sort-' + wpdiscuzCommentOrder).addClass('wpdiscuz-sort-button-active');
30
+
31
+ $('#wc_unsubscribe_message').delay(7000).fadeOut(1500, function () {
32
+ $(this).remove();
33
+ location.href = location.href.substring(0, location.href.indexOf('subscribeAnchor'));
34
+ });
35
+
36
+ if ($('.wc_main_comm_form').length) {
37
+ var mainWrapperUniqueId = getUniqueID($('.wc_main_comm_form'), 1);
38
+ wpdiscuzTimeoutForCaptcha(mainWrapperUniqueId, mainFormTimeOut * 60 * 1000);
39
+ setCookieInForm();
40
+ }
41
+ $(document).delegate('.wc-reply-link', 'click', function () {
42
+ if ($(this).hasClass('wpdiscuz-clonned')) {
43
+ $('#wc-secondary-form-wrapper-' + getUniqueID($(this), 0)).slideToggle(700);
44
+ } else {
45
+ cloneSecondaryForm($(this));
46
+ }
47
+ setCookieInForm();
48
+ });
49
+
50
+ $(document).delegate('textarea.wc_comment', 'focus', function () {
51
+ $(this).autoGrow();
52
+ var parent = $(this).parents('.wc-form-wrapper');
53
+ $('.wc-form-footer', parent).slideDown(700);
54
+ });
55
+
56
+ $(document).delegate('.wc-share-link', 'click', function () {
57
+ var parent = $(this).parents('.wc-comment-right');
58
+ $('.share_buttons_box', parent).slideToggle(1000);
59
+ });
60
+
61
+ $(document).delegate('.wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link', 'click', function (e) {
62
+ e.preventDefault();
63
+ });
64
+
65
+ $(document).delegate('.wc-toggle', 'click', function () {
66
+ var uniqueID = getUniqueID($(this), 0);
67
+ var toggleSpan = $(this);
68
+ $('#wc-comm-' + uniqueID + '> .wc-reply').slideToggle(700, function () {
69
+ if ($(this).is(':hidden')) {
70
+ toggleSpan.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text + ' &or;');
71
+ } else {
72
+ toggleSpan.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text + ' &and;');
73
+ }
74
+ });
75
+ });
76
+
77
+ $(document).delegate('.wc-new-loaded-comment', 'mouseenter', function () {
78
+ if ($(this).hasClass('wc-reply')) {
79
+ $('>.wc-comment-right', $(this)).animate({
80
+ backgroundColor: wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color
81
+ }, 1500);
82
+ } else {
83
+ $('>.wc-comment-right', $(this)).animate({
84
+ backgroundColor: wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color
85
+ }, 1500);
86
+ }
87
+ });
88
+ //============================== CAPTCHA ============================== //
89
+
90
+ $(document).delegate('.wc_captcha_refresh_img', 'click', function () {
91
+ changeCaptchaImage($(this));
92
+ });
93
+
94
+ $(document).delegate('.wc_field_captcha', 'focus', function () {
95
+ if ($(this).hasClass('wpdiscuz-expired')) {
96
+ addCapthcaExpiredMessage($(this));
97
+ }
98
+ });
99
+
100
+ function wpdiscuzTimeoutForCaptcha(uniqueId, time) {
101
+ if ($('#wpcomm .wc-field-captcha').length) {
102
+ wpdiscuzRemoveExpiredClass(uniqueId);
103
+ removeCapthcaExpiredMessage(uniqueId);
104
+ setTimeout(function () {
105
+ captchaExpiredTime(uniqueId);
106
+ wpdiscuzAddExpiredClass(uniqueId);
107
+ }, time);
108
+ }
109
+ }
110
+
111
+ function wpdiscuzAddExpiredClass(uniqueId) {
112
+ if ($('#wc-secondary-form-wrapper-' + uniqueId).hasClass('wc-secondary-form-wrapper')) {
113
+ $('#wc-secondary-form-wrapper-' + uniqueId + ' .wc_field_captcha').addClass('wpdiscuz-expired');
114
+ } else {
115
+ $('#wc-main-form-wrapper-' + uniqueId + ' .wc_field_captcha').addClass('wpdiscuz-expired');
116
+ }
117
+ }
118
+
119
+ function wpdiscuzRemoveExpiredClass(uniqueId) {
120
+ if ($('#wc-secondary-form-wrapper-' + uniqueId).hasClass('wc-secondary-form-wrapper')) {
121
+ $('#wc-secondary-form-wrapper-' + uniqueId + ' .wc_field_captcha').removeClass('wpdiscuz-expired');
122
+ } else {
123
+ $('#wc-main-form-wrapper-' + uniqueId + ' .wc_field_captcha').removeClass('wpdiscuz-expired');
124
+ }
125
+ }
126
+
127
+ function captchaExpiredTime(uniqueId) {
128
+ getAjaxObject('setCaptchaExpired', uniqueId);
129
+ $('.wpdiscuz-loading-bar').hide();
130
+ }
131
+
132
+ function changeCaptchaImage(reloadImage) {
133
+ if (isShowCaptchaForGuests || isShowCaptchaForMembers) {
134
+ var captchaImg = $(reloadImage).prev().children('.wc_captcha_img');
135
+ var src = captchaImg.attr('src');
136
+ var new_src = src.substring(0, src.lastIndexOf('=')) + '=' + Math.random();
137
+ captchaImg.attr('src', new_src);
138
+ var isMain = reloadImage.parents('.wc-form-wrapper').hasClass('wc-secondary-form-wrapper') ? 0 : 1;
139
+ var uniqueId = getUniqueID(reloadImage, isMain);
140
+ var time = isMain ? mainFormTimeOut * 60 * 1000 : secondaryFormTimeOut * 60 * 1000;
141
+ wpdiscuzTimeoutForCaptcha(uniqueId, time);
142
+ }
143
+ }
144
+
145
+ function addCapthcaExpiredMessage(field) {
146
+ field.parent().addClass('bad');
147
+ }
148
+
149
+ function removeCapthcaExpiredMessage(uniqueID) {
150
+ if ($('#wc-secondary-form-wrapper-' + uniqueID).hasClass('wc-secondary-form-wrapper')) {
151
+ $('#wc-secondary-form-wrapper-' + uniqueID + ' .wc-field-captcha').removeClass('bad');
152
+ } else {
153
+ $('#wc-main-form-wrapper-' + uniqueID + ' .wc-field-captcha').removeClass('bad');
154
+ }
155
+ }
156
+ //============================== CAPTCHA ============================== //
157
+ //============================== ADD COMMENT FUNCTION ============================== //
158
+
159
+ $(document).delegate('.wc_comm_submit', 'click', function () {
160
+ var submit = true;
161
+ var depth = 1;
162
+ var wcForm = $(this).parents('form');
163
+ if (!wcForm.hasClass('wc_main_comm_form')) {
164
+ depth = getCommentDepth($(this).parents('.wc-comment'));
165
+ }
166
+ if (!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required && $('.wc_email', wcForm).val()) {
167
+ $('.wc_email', wcForm).attr('required', 'required');
168
+ }
169
+
170
+ if (!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required && !($('.wc_email', wcForm).val())) {
171
+ $('.wc_email', wcForm).removeAttr('required');
172
+ $('.wc_email', wcForm).next('.alert').html('');
173
+ }
174
+
175
+ if (!wpdiscuzValidator.checkAll(wcForm)) {
176
+ submit = false;
177
+ } else {
178
+ var messageKey = '';
179
+ var message = '';
180
+ var data = wcForm.serialize() + '&wc_comment_depth=' + depth + '&comment_post_ID=' + wpdiscuzPostId;
181
+ getAjaxObject('addComment', data).done(function (response) {
182
+ try {
183
+ var obj = $.parseJSON(response);
184
+ messageKey = obj.code;
185
+ if (parseInt(messageKey) >= 0) {
186
+ var isMain = obj.is_main;
187
+ message = obj.message;
188
+ $('.wc_header_text_count').html(obj.wc_all_comments_count_new);
189
+ if (isMain) {
190
+ $('.wc-thread-wrapper').prepend(message);
191
+ } else {
192
+ $('#wc-secondary-form-wrapper-' + messageKey).slideToggle(700);
193
+ if (obj.is_in_same_container == 1) {
194
+ $('#wc-secondary-form-wrapper-' + messageKey).after(message);
195
+ } else {
196
+ // $('#wc-comm-' + messageKey).after(message.replace('wc-reply', 'wc-reply wc-no-left-margin'));
197
+ $('#wc-secondary-form-wrapper-' + messageKey).after(message.replace('wc-reply', 'wc-reply wc-no-left-margin'));
198
+ }
199
+ }
200
+ notifySubscribers(obj);
201
+ wpdiscuzRedirect(obj);
202
+ addCookie(wcForm, obj);
203
+ wcForm.get(0).reset();
204
+ setCookieInForm();
205
+
206
+ } else {
207
+ message = wpdiscuz_ajax_obj.wpdiscuz_options[messageKey];
208
+ wpdiscuzSetCommentMsg(wcForm, messageKey, message, true);
209
+ }
210
+ } catch (e) {
211
+ if (response.indexOf('<') >= 0 && response.indexOf('>') >= 0) {
212
+ message = e;
213
+ } else {
214
+ message = response;
215
+ }
216
+ wpdiscuzSetCommentMsg(wcForm, 'wc_invalid_field', message, true);
217
+ }
218
+ changeCaptchaImage($('.wc_captcha_refresh_img', wcForm));
219
+ addTooltipster();
220
+ $('.wpdiscuz-loading-bar').hide();
221
+ });
222
+ }
223
+ });
224
+
225
+ function notifySubscribers(obj) {
226
+ if (!obj.held_moderate) {
227
+ var data = 'post_id=' + wpdiscuzPostId + '&comment_id=' + obj.new_comment_id + '&email=' + obj.user_email + '&isParent=' + obj.is_main;
228
+ var ajaxObject = getAjaxObject('checkNotificationType', data);
229
+ ajaxObject.done(function (response) {
230
+ try {
231
+ obj = $.parseJSON(response);
232
+ } catch (e) {
233
+ console.log(e);
234
+ }
235
+ });
236
+ }
237
+ }
238
+
239
+ function wpdiscuzRedirect(obj) {
240
+ if (obj.redirect > 0 && obj.new_comment_id) {
241
+ var data = 'commentId=' + obj.new_comment_id;
242
+ var ajaxObject = getAjaxObject('redirect', data);
243
+ ajaxObject.done(function (response) {
244
+ obj = $.parseJSON(response);
245
+ if (obj.code == 1) {
246
+ setTimeout(function () {
247
+ window.location.href = obj.redirect_to;
248
+ }, 5000);
249
+ }
250
+ });
251
+ }
252
+ }
253
+
254
+ function setCookieInForm() {
255
+ if ($.cookie('wc_author_name')) {
256
+ $('.wc_comm_form .wc_name').val($.cookie('wc_author_name'));
257
+ }
258
+ if ($.cookie('wc_author_email')) {
259
+ $('.wc_comm_form .wc_email').val($.cookie('wc_author_email'));
260
+ }
261
+ if ($.cookie('wc_author_website')) {
262
+ $('.wc_comm_form .wc_website').val($.cookie('wc_author_website'));
263
+ }
264
+ }
265
+
266
+ function addCookie(wcForm, obj) {
267
+ if ($('.wc_email', wcForm).val()) {
268
+ $.cookie('wc_author_email', $('.wc_email', wcForm).val());
269
+ } else {
270
+ $.cookie('wc_author_email', obj.user_email);
271
+ }
272
+ if ($('.wc_name', wcForm).val()) {
273
+ $.cookie('wc_author_name', $('.wc_name', wcForm).val());
274
+ } else {
275
+ $.cookie('wc_author_name', obj.user_name);
276
+ }
277
+ $.cookie('wc_author_website', $('.wc_website', wcForm).val());
278
+ }
279
+ //============================== ADD COMMENT FUNCTION ============================== //
280
+ //============================== EDIT COMMENT FUNCTION ============================== //
281
+ var wcCommentTextBeforeEditing;
282
+
283
+ $(document).delegate('.wc_editable_comment', 'click', function () {
284
+ var uniqueID = getUniqueID($(this), 0);
285
+ var commentID = getCommentID(uniqueID);
286
+ var editButton = $(this);
287
+ var data = 'commentId=' + commentID;
288
+ getAjaxObject('editComment', data).done(function (response) {
289
+ try {
290
+ var obj = $.parseJSON(response);
291
+ var message = '';
292
+ var messageKey = obj.code;
293
+ if (parseInt(messageKey) >= 0) {
294
+ wcCommentTextBeforeEditing = obj.message;
295
+ var editableTextarea = '<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-' + uniqueID + '" style="min-height: 2em;">' + obj.message + '</textarea>';
296
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-text').replaceWith(editableTextarea);
297
+ document.getElementById('wc_edit_comment-' + uniqueID).focus();
298
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_save_edited_comment').show();
299
+ editableTextarea = '';
300
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_editable_comment').hide();
301
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_cancel_edit').show();
302
+ } else {
303
+ message = wpdiscuz_ajax_obj.wpdiscuz_options[messageKey];
304
+ wpdiscuzSetCommentMsg(editButton, messageKey, message, false);
305
+ }
306
+ } catch (e) {
307
+ console.log(e);
308
+ }
309
+ $('.wpdiscuz-loading-bar').hide();
310
+ });
311
+ });
312
+
313
+ $(document).delegate('.wc_save_edited_comment', 'click', function () {
314
+ var uniqueID = getUniqueID($(this));
315
+ var commentID = getCommentID(uniqueID);
316
+ var editableTextarea = $('#wc-comm-' + uniqueID + ' textarea#wc_edit_comment-' + uniqueID);
317
+ var commentContent = editableTextarea.val();
318
+ var saveButton = $(this);
319
+ if ($.trim(commentContent).length > 0) {
320
+ var data = 'commentId=' + commentID + '&commentContent=' + commentContent;
321
+ getAjaxObject('saveEditedComment', data).done(function (response) {
322
+ try {
323
+ var obj = $.parseJSON(response);
324
+ var messageKey = obj.code;
325
+ var message = '';
326
+ if (parseInt(messageKey) >= 0) {
327
+ wcCancelOrSave(uniqueID, obj.message);
328
+ } else {
329
+ message = wpdiscuz_ajax_obj.wpdiscuz_options[messageKey];
330
+ wpdiscuzSetCommentMsg(saveButton, messageKey, message, false);
331
+ }
332
+ editableTextarea = '';
333
+ commentContent = '';
334
+ } catch (e) {
335
+ console.log(e);
336
+ }
337
+ $('.wpdiscuz-loading-bar').hide();
338
+ });
339
+ }
340
+ });
341
+
342
+ $(document).delegate('.wc_cancel_edit', 'click', function () {
343
+ var uniqueID = getUniqueID($(this));
344
+ wcCancelOrSave(uniqueID, wcCommentTextBeforeEditing);
345
+ });
346
+
347
+ function wcCancelOrSave(uniqueID, content) {
348
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_editable_comment').show();
349
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_cancel_edit').hide();
350
+ $('#wc-comm-' + uniqueID + ' > .wc-comment-right .wc-comment-footer .wc_save_edited_comment').hide();
351
+ var commentContentWrapper = '<div class="wc-comment-text">' + nl2br(content) + '</div>';
352
+ $('#wc-comm-' + uniqueID + ' #wc_edit_comment-' + uniqueID).replaceWith(commentContentWrapper);
353
+ }
354
+
355
+ function nl2br(str, is_xhtml) {
356
+ var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br/>' : '<br>';
357
+ var string = (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
358
+ return string.replace('<br><br>', '<br/>');
359
+ }
360
+ //============================== EDIT COMMENT FUNCTION ============================== //
361
+ //============================== LOAD MORE ============================== //
362
+ $(document).delegate('.wc-load-more-submit', 'click', function () {
363
+ var data;
364
+ if (wpdiscuzCommentOrderBy == 'vote') {
365
+ data = 'offset=' + wpdiscuzLoadCount + '&orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder;
366
+ wpdiscuzLoadCount++;
367
+ } else {
368
+ data = 'orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder + '&lastParentId=' + getLastParentID();
369
+ }
370
+ data += '&postId=' + wpdiscuzPostId + '&loadAllCommnts=' + isLoadAllComments;
371
+ getAjaxObject('loadMoreComments', data).done(function (response) {
372
+ try {
373
+ var obj = $.parseJSON(response);
374
+ $('.wpdiscuz-comment-pagination').before(obj.comment_list);
375
+ setLoadMoreVisibility(obj);
376
+ $('.wpdiscuz_single').remove();
377
+ } catch (e) {
378
+ console.log(e);
379
+ }
380
+ addTooltipster();
381
+ $('.wpdiscuz-loading-bar').hide();
382
+ $('.wc-load-more-submit').blur();
383
+ });
384
+ });
385
+
386
+ function setLoadMoreVisibility(obj) {
387
+ if (obj.is_show_load_more != false) {
388
+ setLastParentID(obj.last_parent_id);
389
+ } else {
390
+ $('.wc-load-more-submit').parents('.wpdiscuz-comment-pagination').hide();
391
+ }
392
+ }
393
+
394
+ //============================== LOAD MORE ============================== //
395
+ //============================== VOTE ============================== //
396
+ $(document).delegate('.wc_vote', 'click', function () {
397
+ var currentVoteBtn = $(this);
398
+ var messageKey = '';
399
+ var message = '';
400
+ var commentID = $(this).parents('.wc-comment-right').attr('id');
401
+ commentID = commentID.substring(commentID.lastIndexOf('-') + 1);
402
+ var voteType;
403
+ if ($(this).hasClass('wc-up')) {
404
+ voteType = 1;
405
+ } else {
406
+ voteType = -1;
407
+ }
408
+ var data = 'commentId=' + commentID + '&voteType=' + voteType;
409
+
410
+ getAjaxObject('voteOnComment', data).done(function (response) {
411
+ try {
412
+ var obj = $.parseJSON(response);
413
+ messageKey = obj.code;
414
+ if (parseInt(messageKey) >= 0) {
415
+ var voteCountDiv = $('.wc-comment-footer .wc-vote-result', $('#comment-' + commentID));
416
+ $(voteCountDiv).text(parseInt($(voteCountDiv).text()) + voteType);
417
+ } else {
418
+ message = wpdiscuz_ajax_obj.wpdiscuz_options[messageKey];
419
+ wpdiscuzSetCommentMsg(currentVoteBtn, messageKey, message, false);
420
+ }
421
+ } catch (e) {
422
+ console.log(e);
423
+ }
424
+ $('.wpdiscuz-loading-bar').hide();
425
+ });
426
+ });
427
+ //============================== VOTE ============================== //
428
+ //============================== SORTING ============================== //
429
+ $(document).delegate('.wpdiscuz-sort-button', 'click', function () {
430
+ if (!($(this).hasClass('wpdiscuz-sort-button-active'))) {
431
+ var clickedBtn = $(this);
432
+ if ($(this).hasClass('wpdiscuz-vote-sort-up')) {
433
+ wpdiscuzCommentOrderBy = 'vote';
434
+ wpdiscuzCommentOrder = 'desc';
435
+ } else {
436
+ wpdiscuzCommentOrderBy = 'date';
437
+ wpdiscuzCommentOrder = $(this).hasClass('wpdiscuz-date-sort-desc') ? 'desc' : 'asc';
438
+ }
439
+ var data = 'postId=' + wpdiscuzPostId + '&orderBy=' + wpdiscuzCommentOrderBy + '&order=' + wpdiscuzCommentOrder;
440
+ var messageKey = '';
441
+ var message = '';
442
+ getAjaxObject('wpdiscuzSorting', data).done(function (response) {
443
+ try {
444
+ var obj = $.parseJSON(response);
445
+ messageKey = obj.code;
446
+ message = obj.message;
447
+ if (parseInt(messageKey) > 0) {
448
+ $('#wpcomm .wc-thread-wrapper .wc-comment').each(function () {
449
+ $(this).remove();
450
+ });
451
+ $('#wpcomm .wc-thread-wrapper').prepend(message);
452
+ wpdiscuzLoadCount = parseInt(obj.loadCount);
453
+ } else {
454
+ }
455
+ setActiveButton(clickedBtn);
456
+ setLoadMoreVisibility(obj);
457
+ } catch (e) {
458
+ console.log(e);
459
+ }
460
+ addTooltipster();
461
+ $('.wpdiscuz-loading-bar').hide();
462
+ });
463
+ }
464
+ });
465
+
466
+ function setActiveButton(clickedBtn) {
467
+ $('.wpdiscuz-sort-buttons .wpdiscuz-sort-button').each(function () {
468
+ $(this).removeClass('wpdiscuz-sort-button-active');
469
+ });
470
+ clickedBtn.addClass('wpdiscuz-sort-button-active');
471
+ }
472
+
473
+ //============================== SORTING ============================== //
474
+ //============================== SINGLE COMMENT ============================== //
475
+ function getSingleComment() {
476
+ var loc = location.href;
477
+ var matches = loc.match(/#comment\-(\d+)/);
478
+ if (matches !== null) {
479
+ var commentId = matches[1];
480
+ if (!$('#comment-' + commentId).length) {
481
+ var data = 'commentId=' + commentId;
482
+ var ajaxObject = getAjaxObject('getSingleComment', data);
483
+ ajaxObject.done(function (response) {
484
+ try {
485
+ var obj = $.parseJSON(response);
486
+ $('.wc-thread-wrapper').prepend(obj.message);
487
+ $('html, body').animate({
488
+ scrollTop: $(".wc-thread-wrapper").offset().top
489
+ }, 1000);
490
+ } catch (e) {
491
+ console.log(e);
492
+ }
493
+ addTooltipster();
494
+ $('.wpdiscuz-loading-bar').hide();
495
+ });
496
+ }
497
+ }
498
+ }
499
+ getSingleComment();
500
+ //============================== SINGLE COMMENT ============================== //
501
+ //============================== LIVE UPDATE ============================== //
502
+ if (commentListUpdateType > 0 && loadLastCommentId && (isUserLoggedIn || (!isUserLoggedIn && !liveUpdateGuests))) {
503
+ setInterval(liveUpdate, parseInt(commentListUpdateTimer) * 1000);
504
+ }
505
+
506
+ function liveUpdate() {
507
+ var visibleCommentIds = getVisibleCommentIds();
508
+ var email = ($.cookie('wc_author_email') != undefined && $.cookie('wc_author_email') != '') ? $.cookie('wc_author_email') : '';
509
+ var data = 'postId=' + wpdiscuzPostId + '&loadLastCommentId=' + loadLastCommentId + "&visibleCommentIds=" + visibleCommentIds + '&email=' + email;
510
+ var ajaxObject = getAjaxObject('liveUpdate', data);
511
+ ajaxObject.done(function (response) {
512
+ try {
513
+ var obj = $.parseJSON(response);
514
+ if (obj.code == 1) {
515
+ if (commentListUpdateType == 1) {
516
+ liveUpdateImmediately(obj);
517
+ } else {
518
+ wpdiscuzCommentArray = wpdiscuzCommentArray.concat(obj.message.comments);
519
+ wpdiscuzReplyArray = wpdiscuzReplyArray.concat(obj.message.author_replies);
520
+ var newCommentArrayLength = wpdiscuzCommentArray.length;
521
+ var newRepliesArrayLength = wpdiscuzReplyArray.length;
522
+ if (newCommentArrayLength > 0) {
523
+ var newCommentText = newCommentArrayLength + ' ';
524
+ newCommentText += newCommentArrayLength > 1 ? wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text : wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;
525
+ $('.wc_new_comment').html(newCommentText).show();
526
+ } else {
527
+ $('.wc_new_comment').hide();
528
+ }
529
+ if (newRepliesArrayLength > 0) {
530
+ var newReplyText = newRepliesArrayLength + ' ';
531
+ newReplyText += newRepliesArrayLength > 1 ? wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text : wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;
532
+ $('.wc_new_reply').html(newReplyText).show();
533
+ } else {
534
+ $('.wc_new_reply').hide();
535
+ }
536
+ }
537
+ $('.wc_header_text_count').html(obj.wc_all_comments_count_new);
538
+ loadLastCommentId = obj.loadLastCommentId;
539
+ }
540
+ } catch (e) {
541
+ console.log(e);
542
+ }
543
+ addTooltipster();
544
+ $('.wpdiscuz-loading-bar').hide();
545
+ });
546
+ }
547
+
548
+ function liveUpdateImmediately(obj) {
549
+ if (obj.message !== undefined) {
550
+ var commentObject;
551
+ var message = obj.message;
552
+ for (var i = 0; i < message.length; i++) {
553
+ commentObject = message[i];
554
+ addCommentToTree(commentObject.comment_parent, commentObject.comment_html);
555
+ }
556
+ }
557
+ }
558
+
559
+ $(document).delegate('.wc-update-on-click', 'click', function () {
560
+ var data;
561
+ var clickedButton = $(this);
562
+ if (clickedButton.hasClass('wc_new_comment')) {
563
+ data = wpdiscuzCommentArray.join();
564
+ } else {
565
+ data = wpdiscuzReplyArray.join();
566
+ }
567
+
568
+ getAjaxObject('updateOnClick', data).done(function (response) {
569
+ try {
570
+ var obj = $.parseJSON(response);
571
+ liveUpdateImmediately(obj);
572
+ if (clickedButton.hasClass('wc_new_comment')) {
573
+ wpdiscuzCommentArray = [];
574
+ $('.wc_new_comment').hide();
575
+ } else {
576
+ wpdiscuzReplyArray = [];
577
+ $('.wc_new_reply').hide();
578
+ }
579
+ } catch (e) {
580
+ console.log(e);
581
+ }
582
+ addTooltipster();
583
+ $('.wpdiscuz-loading-bar').hide();
584
+ });
585
+ });
586
+ //============================== LIVE UPDATE ============================== //
587
+ //============================== FUNCTIONS ============================== //
588
+
589
+ function wpdiscuzSetCommentMsg(field, messageKey, message, isFormError) {
590
+ var msgContainer;
591
+ var parentContainer;
592
+ if (isFormError) {
593
+ parentContainer = field.parents('.wc-form-wrapper');
594
+ } else {
595
+ parentContainer = field.closest('.wc-comment');
596
+ }
597
+ msgContainer = parentContainer.children('.wpdiscuz-comment-message');
598
+ msgContainer.addClass(messageKey);
599
+ msgContainer.html(message);
600
+ msgContainer.show().delay(5000).fadeOut(1000, function () {
601
+ msgContainer.removeClass();
602
+ msgContainer.addClass('wpdiscuz-comment-message');
603
+ msgContainer.html('');
604
+ });
605
+
606
+ }
607
+
608
+ function cloneSecondaryForm(field) {
609
+ var uniqueId = getUniqueID(field, 0);
610
+ $('#wpdiscuz_form_anchor-' + uniqueId).before(replaceUniqueId(uniqueId));
611
+ $('#wc-secondary-form-wrapper-' + uniqueId).slideToggle(700, function () {
612
+ field.addClass('wpdiscuz-clonned');
613
+ });
614
+ wpdiscuzTimeoutForCaptcha(uniqueId, secondaryFormTimeOut * 60 * 1000);
615
+ }
616
+
617
+ function replaceUniqueId(uniqueId) {
618
+ var secondaryForm = $('#wpdiscuz_hidden_secondary_form').html();
619
+ return secondaryForm.replace(/wpdiscuzuniqueid/g, uniqueId);
620
+ }
621
+
622
+ function getUniqueID(field, isMain) {
623
+ var fieldID = '';
624
+ if (isMain) {
625
+ fieldID = field.parents('.wc-main-form-wrapper').attr('id');
626
+ } else {
627
+ fieldID = field.parents('.wc-comment').attr('id');
628
+ }
629
+ var uniqueID = fieldID.substring(fieldID.lastIndexOf('-') + 1);
630
+ return uniqueID;
631
+ }
632
+
633
+ function getCommentID(uniqueID) {
634
+ return uniqueID.substring(0, uniqueID.indexOf('_'));
635
+ }
636
+
637
+ function getCommentParentID(uniqueID) {
638
+ var commentID = uniqueID.substring(uniqueID.indexOf('_') + 1);
639
+ return commentID;
640
+ }
641
+
642
+ function getLastParentID() {
643
+ var url = $('.wc-load-more-link').attr("href");
644
+ return url.substring(url.lastIndexOf('=') + 1);
645
+ }
646
+
647
+ function setLastParentID(lastParentID) {
648
+ var url = $('.wc-load-more-link').attr("href");
649
+ $('.wc-load-more-link').attr("href", url.replace(/[\d]+$/m, lastParentID));
650
+ $('.wpdiscuz-comment-pagination').show();
651
+ }
652
+
653
+
654
+ function getCommentDepth(field) {
655
+ var fieldClasses = field.attr('class');
656
+ var classesArray = fieldClasses.split(' ');
657
+ var depth = '';
658
+ $.each(classesArray, function (index, value) {
659
+ if ('wc_comment_level' === getParentDepth(value, false)) {
660
+ depth = getParentDepth(value, true);
661
+ }
662
+ });
663
+ return parseInt(depth) + 1;
664
+ }
665
+
666
+ function getParentDepth(depthValue, isNumberPart) {
667
+ var depth = '';
668
+ if (isNumberPart) {
669
+ depth = depthValue.substring(depthValue.indexOf('-') + 1);
670
+ } else {
671
+ depth = depthValue.substring(0, depthValue.indexOf('-'));
672
+ }
673
+ return depth;
674
+ }
675
+ /**
676
+ * @param {type} action the action key
677
+ * @param {type} data the request properties
678
+ * @returns {jqXHR}
679
+ */
680
+ function getAjaxObject(action, data) {
681
+ if (action !== 'liveUpdate') {
682
+ $('.wpdiscuz-loading-bar').show();
683
+ }
684
+ return $.ajax({
685
+ type: 'POST',
686
+ url: wpdiscuz_ajax_obj.url,
687
+ data: {
688
+ wpdiscuzAjaxData: data,
689
+ action: action
690
+ }
691
+ });
692
+ }
693
+
694
+ function addCommentToTree(parentId, comment) {
695
+ if (parentId == 0) {
696
+ $('.wc-thread-wrapper').prepend(comment);
697
+ } else {
698
+ var parentUniqueId = getUniqueID($('#comment-' + parentId), 0);
699
+ $('#wpdiscuz_form_anchor-' + parentUniqueId).after(comment);
700
+ }
701
+ }
702
+
703
+ function getVisibleCommentIds() {
704
+ var uniqueId;
705
+ var commentId;
706
+ var visibleCommentIds = '';
707
+ $('.wc-comment-right').each(function () {
708
+ uniqueId = getUniqueID($(this), 0);
709
+ commentId = getCommentID(uniqueId);
710
+ visibleCommentIds += commentId + ',';
711
+ });
712
+ return visibleCommentIds;
713
+ }
714
+
715
+ function addTooltipster() {
716
+ $('.wc-comment-img-link').tooltipster({
717
+ trigger: 'click',
718
+ contentAsHTML: true,
719
+ interactive: true,
720
+ multiple: true
721
+ });
722
+ $('.wc_tooltipster').tooltipster({offsetY: 2, multiple: true});
723
+ }
724
+
725
+ function loginButtonsClone() {
726
+ if ($('.wc_social_plugin_wrapper .wp-social-login-provider-list').length) {
727
+ $('.wc_social_plugin_wrapper .wp-social-login-provider-list').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content');
728
+ } else if ($('.wc_social_plugin_wrapper .the_champ_login_container').length) {
729
+ $('.wc_social_plugin_wrapper .the_champ_login_container').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content');
730
+ } else if ($('.wc_social_plugin_wrapper .social_connect_form').length) {
731
+ $('.wc_social_plugin_wrapper .social_connect_form').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content');
732
+ } else if ($('.wc_social_plugin_wrapper .oneall_social_login_providers').length) {
733
+ $('.wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers').clone().prependTo('#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content');
734
+ }
735
+ }
736
+ //============================== FUNCTIONS ============================== //
737
+ });
assets/js/wpdiscuz.min.js CHANGED
@@ -1,2 +1,2 @@
1
-
2
  jQuery(document).ready(function(E){wpdiscuzValidator.message.invalid=wpdiscuz_ajax_obj.wpdiscuz_options.wc_invalid_field;wpdiscuzValidator.message.empty=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_empty_text;wpdiscuzValidator.message.email=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_email_text;wpdiscuzValidator.message.url=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_url_text;wpdiscuzValidator.message.min=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_max_length;var S=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var r=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!S;var R=parseInt(wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members)>0&&wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var x=wpdiscuz_ajax_obj.wpdiscuz_options.main_form_time_out;var m=wpdiscuz_ajax_obj.wpdiscuz_options.secondary_form_time_out;var b=wpdiscuz_ajax_obj.wpdiscuz_options.wc_load_all_comments;var p=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var k=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var j=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var H=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var T=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var c;var n="date";var L=[];var v=[];F();h();E(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active");E("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){E(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor"))});if(E(".wc_main_comm_form").length){var G=o(E(".wc_main_comm_form"),1);N(G,x*60*1000);g()}E(document).delegate(".wc-reply-link","click",function(){if(E(this).hasClass("wpdiscuz-clonned")){E("#wc-secondary-form-wrapper-"+o(E(this),0)).slideToggle(700)}else{i(E(this))}g()});E(document).delegate("textarea.wc_comment","focus",function(){E(this).autoGrow();var aa=E(this).parents(".wc-form-wrapper");E(".wc-form-footer",aa).slideDown(700)});E(document).delegate(".wc-share-link","click",function(){var aa=E(this).parents(".wc-comment-right");E(".share_buttons_box",aa).slideToggle(1000)});E(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(aa){aa.preventDefault()});E(document).delegate(".wc-toggle","click",function(){var ab=o(E(this),0);var aa=E(this);E("#wc-comm-"+ab+"> .wc-reply").slideToggle(700,function(){if(E(this).is(":hidden")){aa.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" &or;")}else{aa.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" &and;")}})});E(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(E(this).hasClass("wc-reply")){E(">.wc-comment-right",E(this)).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color},1500)}else{E(">.wc-comment-right",E(this)).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color},1500)}});E(document).delegate(".wc_captcha_refresh_img","click",function(){Q(E(this))});E(document).delegate(".wc_field_captcha","focus",function(){if(E(this).hasClass("wpdiscuz-expired")){W(E(this))}});function N(ab,aa){if(E("#wpcomm .wc-field-captcha").length){f(ab);P(ab);setTimeout(function(){z(ab);V(ab)},aa)}}function V(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc_field_captcha").addClass("wpdiscuz-expired")}else{E("#wc-main-form-wrapper-"+aa+" .wc_field_captcha").addClass("wpdiscuz-expired")}}function f(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc_field_captcha").removeClass("wpdiscuz-expired")}else{E("#wc-main-form-wrapper-"+aa+" .wc_field_captcha").removeClass("wpdiscuz-expired")}}function z(aa){e("setCaptchaExpired",aa);E(".wpdiscuz-loading-bar").hide()}function Q(af){if(r||R){var ac=E(af).prev().children(".wc_captcha_img");var ae=ac.attr("src");var aa=ae.substring(0,ae.lastIndexOf("="))+"="+Math.random();ac.attr("src",aa);var ab=af.parents(".wc-form-wrapper").hasClass("wc-secondary-form-wrapper")?0:1;var ag=o(af,ab);var ad=ab?x*60*1000:m*60*1000;N(ag,ad)}}function W(aa){aa.parent().addClass("bad")}function P(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc-field-captcha").removeClass("bad")}else{E("#wc-main-form-wrapper-"+aa+" .wc-field-captcha").removeClass("bad")}}E(document).delegate(".wc_comm_submit","click",function(){var ae=true;var af=1;var ad=E(this).parents("form");if(!ad.hasClass("wc_main_comm_form")){af=D(E(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&E(".wc_email",ad).val()){E(".wc_email",ad).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(E(".wc_email",ad).val())){E(".wc_email",ad).removeAttr("required");E(".wc_email",ad).next(".alert").html("")}if(!wpdiscuzValidator.checkAll(ad)){ae=false}else{var aa="";var ab="";var ac=ad.serialize()+"&wc_comment_depth="+af+"&comment_post_ID="+p;e("addComment",ac).done(function(ah){try{var aj=E.parseJSON(ah);aa=aj.code;if(parseInt(aa)>=0){var ag=aj.is_main;ab=aj.message;E(".wc_header_text_count").html(aj.wc_all_comments_count_new);if(ag){E(".wc-thread-wrapper").prepend(ab)}else{E("#wc-secondary-form-wrapper-"+aa).slideToggle(700);if(aj.is_in_same_container==1){E("#wc-secondary-form-wrapper-"+aa).after(ab)}else{E("#wc-secondary-form-wrapper-"+aa).after(ab.replace("wc-reply","wc-reply wc-no-left-margin"))}}q(aj);X(aj);u(ad,aj);ad.get(0).reset();g()}else{ab=wpdiscuz_ajax_obj.wpdiscuz_options[aa];t(ad,aa,ab,true)}}catch(ai){if(ah.indexOf("<")>=0&&ah.indexOf(">")>=0){ab=ai}else{ab=ah}t(ad,"wc_invalid_field",ab,true)}Q(E(".wc_captcha_refresh_img",ad));F();E(".wpdiscuz-loading-bar").hide()})}});function q(ac){if(!ac.held_moderate){var ab="post_id="+p+"&comment_id="+ac.new_comment_id+"&email="+ac.user_email+"&isParent="+ac.is_main;var aa=e("checkNotificationType",ab);aa.done(function(ad){try{ac=E.parseJSON(ad)}catch(ae){console.log(ae)}})}}function X(ac){if(ac.redirect>0&&ac.new_comment_id){var ab="commentId="+ac.new_comment_id;var aa=e("redirect",ab);aa.done(function(ad){ac=E.parseJSON(ad);if(ac.code==1){setTimeout(function(){window.location.href=ac.redirect_to},5000)}})}}function g(){if(E.cookie("wc_author_name")){E(".wc_comm_form .wc_name").val(E.cookie("wc_author_name"))}if(E.cookie("wc_author_email")){E(".wc_comm_form .wc_email").val(E.cookie("wc_author_email"))}if(E.cookie("wc_author_website")){E(".wc_comm_form .wc_website").val(E.cookie("wc_author_website"))}}function u(aa,ab){if(E(".wc_email",aa).val()){E.cookie("wc_author_email",E(".wc_email",aa).val())}else{E.cookie("wc_author_email",ab.user_email)}if(E(".wc_name",aa).val()){E.cookie("wc_author_name",E(".wc_name",aa).val())}else{E.cookie("wc_author_name",ab.user_name)}E.cookie("wc_author_website",E(".wc_website",aa).val())}var U;E(document).delegate(".wc_editable_comment","click",function(){var ad=o(E(this),0);var aa=Y(ad);var ac=E(this);var ab="commentId="+aa;e("editComment",ab).done(function(af){try{var aj=E.parseJSON(af);var ah="";var ag=aj.code;if(parseInt(ag)>=0){U=aj.message;var ae='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+ad+'" style="min-height: 2em;">'+aj.message+"</textarea>";E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-text").replaceWith(ae);document.getElementById("wc_edit_comment-"+ad).focus();E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ae="";E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];t(ac,ag,ah,false)}}catch(ai){console.log(ai)}E(".wpdiscuz-loading-bar").hide()})});E(document).delegate(".wc_save_edited_comment","click",function(){var af=o(E(this));var ab=Y(af);var aa=E("#wc-comm-"+af+" textarea#wc_edit_comment-"+af);var ac=aa.val();var ae=E(this);if(E.trim(ac).length>0){var ad="commentId="+ab+"&commentContent="+ac;e("saveEditedComment",ad).done(function(ag){try{var ak=E.parseJSON(ag);var ah=ak.code;var ai="";if(parseInt(ah)>=0){I(af,ak.message)}else{ai=wpdiscuz_ajax_obj.wpdiscuz_options[ah];t(ae,ah,ai,false)}aa="";ac=""}catch(aj){console.log(aj)}E(".wpdiscuz-loading-bar").hide()})}});E(document).delegate(".wc_cancel_edit","click",function(){var aa=o(E(this));I(aa,U)});function I(ac,ab){E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var aa='<div class="wc-comment-text">'+l(ab)+"</div>";E("#wc-comm-"+ac+" #wc_edit_comment-"+ac).replaceWith(aa)}function l(ad,ac){var ab=(ac||typeof ac==="undefined")?"<br/>":"<br>";var aa=(ad+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+ab+"$2");return aa.replace("<br><br>","<br/>")}E(document).delegate(".wc-load-more-submit","click",function(){var aa;if(n=="vote"){aa="offset="+c+"&orderBy="+n+"&order="+a;c++}else{aa="orderBy="+n+"&order="+a+"&lastParentId="+w()}aa+="&postId="+p+"&loadAllCommnts="+b;e("loadMoreComments",aa).done(function(ab){try{var ad=E.parseJSON(ab);E(".wpdiscuz-comment-pagination").before(ad.comment_list);s(ad);E(".wpdiscuz_single").remove()}catch(ac){console.log(ac)}F();E(".wpdiscuz-loading-bar").hide();E(".wc-load-more-submit").blur()})});function s(aa){if(aa.is_show_load_more!=false){O(aa.last_parent_id)}else{E(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}}E(document).delegate(".wc_vote","click",function(){var aa=E(this);var ad="";var ae="";var ab=E(this).parents(".wc-comment-right").attr("id");ab=ab.substring(ab.lastIndexOf("-")+1);var ac;if(E(this).hasClass("wc-up")){ac=1}else{ac=-1}var af="commentId="+ab+"&voteType="+ac;e("voteOnComment",af).done(function(ag){try{var ai=E.parseJSON(ag);ad=ai.code;if(parseInt(ad)>=0){var aj=E(".wc-comment-footer .wc-vote-result",E("#comment-"+ab));E(aj).text(parseInt(E(aj).text())+ac)}else{ae=wpdiscuz_ajax_obj.wpdiscuz_options[ad];t(aa,ad,ae,false)}}catch(ah){console.log(ah)}E(".wpdiscuz-loading-bar").hide()})});E(document).delegate(".wpdiscuz-sort-button","click",function(){if(!(E(this).hasClass("wpdiscuz-sort-button-active"))){var ad=E(this);if(E(this).hasClass("wpdiscuz-vote-sort-up")){n="vote";a="desc"}else{n="date";a=E(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var ac="postId="+p+"&orderBy="+n+"&order="+a;var aa="";var ab="";e("wpdiscuzSorting",ac).done(function(ae){try{var ag=E.parseJSON(ae);aa=ag.code;ab=ag.message;if(parseInt(aa)>0){E("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){E(this).remove()});E("#wpcomm .wc-thread-wrapper").prepend(ab);c=parseInt(ag.loadCount)}else{}K(ad);s(ag)}catch(af){console.log(af)}F();E(".wpdiscuz-loading-bar").hide()})}});function K(aa){E(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){E(this).removeClass("wpdiscuz-sort-button-active")});aa.addClass("wpdiscuz-sort-button-active")}function Z(){var ae=location.href;var ad=ae.match(/#comment\-(\d+)/);if(ad!==null){var ab=ad[1];if(!E("#comment-"+ab).length){var ac="commentId="+ab;var aa=e("getSingleComment",ac);aa.done(function(af){try{var ah=E.parseJSON(af);E(".wc-thread-wrapper").prepend(ah.message);E("html, body").animate({scrollTop:E(".wc-thread-wrapper").offset().top},1000)}catch(ag){console.log(ag)}F();E(".wpdiscuz-loading-bar").hide()})}}}Z();if(k>0&&T&&(S||(!S&&!H))){setInterval(M,parseInt(j)*1000)}function M(){var ad=C();var ab=(E.cookie("wc_author_email")!=undefined&&E.cookie("wc_author_email")!="")?E.cookie("wc_author_email"):"";var ac="postId="+p+"&loadLastCommentId="+T+"&visibleCommentIds="+ad+"&email="+ab;var aa=e("liveUpdate",ac);aa.done(function(af){try{var ak=E.parseJSON(af);if(ak.code==1){if(k==1){A(ak)}else{v=v.concat(ak.message.comments);L=L.concat(ak.message.author_replies);var ag=v.length;var ae=L.length;if(ag>0){var ai=ag+" ";ai+=ag>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;E(".wc_new_comment").html(ai).show()}else{E(".wc_new_comment").hide()}if(ae>0){var ah=ae+" ";ah+=ae>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;E(".wc_new_reply").html(ah).show()}else{E(".wc_new_reply").hide()}}E(".wc_header_text_count").html(ak.wc_all_comments_count_new);T=ak.loadLastCommentId}}catch(aj){console.log(aj)}F();E(".wpdiscuz-loading-bar").hide()})}function A(ad){if(ad.message!==undefined){var aa;var ac=ad.message;for(var ab=0;ab<ac.length;ab++){aa=ac[ab];y(aa.comment_parent,aa.comment_html)}}}E(document).delegate(".wc-update-on-click","click",function(){var aa;var ab=E(this);if(ab.hasClass("wc_new_comment")){aa=v.join()}else{aa=L.join()}e("updateOnClick",aa).done(function(ac){try{var ae=E.parseJSON(ac);A(ae);if(ab.hasClass("wc_new_comment")){v=[];E(".wc_new_comment").hide()}else{L=[];E(".wc_new_reply").hide()}}catch(ad){console.log(ad)}F();E(".wpdiscuz-loading-bar").hide()})});function t(ae,ab,ad,ac){var aa;var af;if(ac){af=ae.parents(".wc-form-wrapper")}else{af=ae.closest(".wc-comment")}aa=af.children(".wpdiscuz-comment-message");aa.addClass(ab);aa.html(ad);aa.show().delay(5000).fadeOut(1000,function(){aa.removeClass();aa.addClass("wpdiscuz-comment-message");aa.html("")})}function i(aa){var ab=o(aa,0);E("#wpdiscuz_form_anchor-"+ab).before(J(ab));E("#wc-secondary-form-wrapper-"+ab).slideToggle(700,function(){aa.addClass("wpdiscuz-clonned")});N(ab,m*60*1000)}function J(ab){var aa=E("#wpdiscuz_hidden_secondary_form").html();return aa.replace(/wpdiscuzuniqueid/g,ab)}function o(ac,ab){var aa="";if(ab){aa=ac.parents(".wc-main-form-wrapper").attr("id")}else{aa=ac.parents(".wc-comment").attr("id")}var ad=aa.substring(aa.lastIndexOf("-")+1);return ad}function Y(aa){return aa.substring(0,aa.indexOf("_"))}function B(ab){var aa=ab.substring(ab.indexOf("_")+1);return aa}function w(){var aa=E(".wc-load-more-link").attr("href");return aa.substring(aa.lastIndexOf("=")+1)}function O(aa){var ab=E(".wc-load-more-link").attr("href");E(".wc-load-more-link").attr("href",ab.replace(/[\d]+$/m,aa));E(".wpdiscuz-comment-pagination").show()}function D(ac){var ab=ac.attr("class");var aa=ab.split(" ");var ad="";E.each(aa,function(ae,af){if("wc_comment_level"===d(af,false)){ad=d(af,true)}});return parseInt(ad)+1}function d(aa,ab){var ac="";if(ab){ac=aa.substring(aa.indexOf("-")+1)}else{ac=aa.substring(0,aa.indexOf("-"))}return ac}function e(ab,aa){if(ab!=="liveUpdate"){E(".wpdiscuz-loading-bar").show()}return E.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:aa,action:ab}})}function y(ac,ab){if(ac==0){E(".wc-thread-wrapper").prepend(ab)}else{var aa=o(E("#comment-"+ac),0);E("#wpdiscuz_form_anchor-"+aa).after(ab)}}function C(){var ac;var aa;var ab="";E(".wc-comment-right").each(function(){ac=o(E(this),0);aa=Y(ac);ab+=aa+","});return ab}function F(){E(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});E(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function h(){if(E(".wc_social_plugin_wrapper .wp-social-login-provider-list").length){E(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .the_champ_login_container").length){E(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .social_connect_form").length){E(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .oneall_social_login_providers").length){E(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}}}}}});
1
+
2
  jQuery(document).ready(function(E){wpdiscuzValidator.message.invalid=wpdiscuz_ajax_obj.wpdiscuz_options.wc_invalid_field;wpdiscuzValidator.message.empty=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_empty_text;wpdiscuzValidator.message.email=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_email_text;wpdiscuzValidator.message.url=wpdiscuz_ajax_obj.wpdiscuz_options.wc_error_url_text;wpdiscuzValidator.message.min=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_min_length;wpdiscuzValidator.message.max=wpdiscuz_ajax_obj.wpdiscuz_options.wc_msg_comment_text_max_length;var S=wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var r=wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide==0&&!S;var R=parseInt(wpdiscuz_ajax_obj.wpdiscuz_options.wc_captcha_show_hide_for_members)>0&&wpdiscuz_ajax_obj.wpdiscuz_options.is_user_logged_in;var x=wpdiscuz_ajax_obj.wpdiscuz_options.main_form_time_out;var m=wpdiscuz_ajax_obj.wpdiscuz_options.secondary_form_time_out;var b=wpdiscuz_ajax_obj.wpdiscuz_options.wc_load_all_comments;var p=wpdiscuz_ajax_obj.wpdiscuz_options.wc_post_id;var k=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateType;var j=wpdiscuz_ajax_obj.wpdiscuz_options.commentListUpdateTimer;var H=wpdiscuz_ajax_obj.wpdiscuz_options.liveUpdateGuests;var T=wpdiscuz_ajax_obj.wpdiscuz_options.loadLastCommentId;var a=wpdiscuz_ajax_obj.wpdiscuz_options.wordpress_comment_order;var c;var n="date";var L=[];var v=[];F();h();E(".wpdiscuz-date-sort-"+a).addClass("wpdiscuz-sort-button-active");E("#wc_unsubscribe_message").delay(7000).fadeOut(1500,function(){E(this).remove();location.href=location.href.substring(0,location.href.indexOf("subscribeAnchor"))});if(E(".wc_main_comm_form").length){var G=o(E(".wc_main_comm_form"),1);N(G,x*60*1000);g()}E(document).delegate(".wc-reply-link","click",function(){if(E(this).hasClass("wpdiscuz-clonned")){E("#wc-secondary-form-wrapper-"+o(E(this),0)).slideToggle(700)}else{i(E(this))}g()});E(document).delegate("textarea.wc_comment","focus",function(){E(this).autoGrow();var aa=E(this).parents(".wc-form-wrapper");E(".wc-form-footer",aa).slideDown(700)});E(document).delegate(".wc-share-link","click",function(){var aa=E(this).parents(".wc-comment-right");E(".share_buttons_box",aa).slideToggle(1000)});E(document).delegate(".wpdiscuz-nofollow,.wc_captcha_refresh_img,.wc-toggle,.wc-load-more-link","click",function(aa){aa.preventDefault()});E(document).delegate(".wc-toggle","click",function(){var ab=o(E(this),0);var aa=E(this);E("#wc-comm-"+ab+"> .wc-reply").slideToggle(700,function(){if(E(this).is(":hidden")){aa.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_show_replies_text+" &or;")}else{aa.html(wpdiscuz_ajax_obj.wpdiscuz_options.wc_hide_replies_text+" &and;")}})});E(document).delegate(".wc-new-loaded-comment","mouseenter",function(){if(E(this).hasClass("wc-reply")){E(">.wc-comment-right",E(this)).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_reply_bg_color},1500)}else{E(">.wc-comment-right",E(this)).animate({backgroundColor:wpdiscuz_ajax_obj.wpdiscuz_options.wc_comment_bg_color},1500)}});E(document).delegate(".wc_captcha_refresh_img","click",function(){Q(E(this))});E(document).delegate(".wc_field_captcha","focus",function(){if(E(this).hasClass("wpdiscuz-expired")){W(E(this))}});function N(ab,aa){if(E("#wpcomm .wc-field-captcha").length){f(ab);P(ab);setTimeout(function(){z(ab);V(ab)},aa)}}function V(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc_field_captcha").addClass("wpdiscuz-expired")}else{E("#wc-main-form-wrapper-"+aa+" .wc_field_captcha").addClass("wpdiscuz-expired")}}function f(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc_field_captcha").removeClass("wpdiscuz-expired")}else{E("#wc-main-form-wrapper-"+aa+" .wc_field_captcha").removeClass("wpdiscuz-expired")}}function z(aa){e("setCaptchaExpired",aa);E(".wpdiscuz-loading-bar").hide()}function Q(af){if(r||R){var ac=E(af).prev().children(".wc_captcha_img");var ae=ac.attr("src");var aa=ae.substring(0,ae.lastIndexOf("="))+"="+Math.random();ac.attr("src",aa);var ab=af.parents(".wc-form-wrapper").hasClass("wc-secondary-form-wrapper")?0:1;var ag=o(af,ab);var ad=ab?x*60*1000:m*60*1000;N(ag,ad)}}function W(aa){aa.parent().addClass("bad")}function P(aa){if(E("#wc-secondary-form-wrapper-"+aa).hasClass("wc-secondary-form-wrapper")){E("#wc-secondary-form-wrapper-"+aa+" .wc-field-captcha").removeClass("bad")}else{E("#wc-main-form-wrapper-"+aa+" .wc-field-captcha").removeClass("bad")}}E(document).delegate(".wc_comm_submit","click",function(){var ae=true;var af=1;var ad=E(this).parents("form");if(!ad.hasClass("wc_main_comm_form")){af=D(E(this).parents(".wc-comment"))}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&E(".wc_email",ad).val()){E(".wc_email",ad).attr("required","required")}if(!wpdiscuz_ajax_obj.wpdiscuz_options.is_email_field_required&&!(E(".wc_email",ad).val())){E(".wc_email",ad).removeAttr("required");E(".wc_email",ad).next(".alert").html("")}if(!wpdiscuzValidator.checkAll(ad)){ae=false}else{var aa="";var ab="";var ac=ad.serialize()+"&wc_comment_depth="+af+"&comment_post_ID="+p;e("addComment",ac).done(function(ah){try{var aj=E.parseJSON(ah);aa=aj.code;if(parseInt(aa)>=0){var ag=aj.is_main;ab=aj.message;E(".wc_header_text_count").html(aj.wc_all_comments_count_new);if(ag){E(".wc-thread-wrapper").prepend(ab)}else{E("#wc-secondary-form-wrapper-"+aa).slideToggle(700);if(aj.is_in_same_container==1){E("#wc-secondary-form-wrapper-"+aa).after(ab)}else{E("#wc-secondary-form-wrapper-"+aa).after(ab.replace("wc-reply","wc-reply wc-no-left-margin"))}}q(aj);X(aj);u(ad,aj);ad.get(0).reset();g()}else{ab=wpdiscuz_ajax_obj.wpdiscuz_options[aa];t(ad,aa,ab,true)}}catch(ai){if(ah.indexOf("<")>=0&&ah.indexOf(">")>=0){ab=ai}else{ab=ah}t(ad,"wc_invalid_field",ab,true)}Q(E(".wc_captcha_refresh_img",ad));F();E(".wpdiscuz-loading-bar").hide()})}});function q(ac){if(!ac.held_moderate){var ab="post_id="+p+"&comment_id="+ac.new_comment_id+"&email="+ac.user_email+"&isParent="+ac.is_main;var aa=e("checkNotificationType",ab);aa.done(function(ad){try{ac=E.parseJSON(ad)}catch(ae){console.log(ae)}})}}function X(ac){if(ac.redirect>0&&ac.new_comment_id){var ab="commentId="+ac.new_comment_id;var aa=e("redirect",ab);aa.done(function(ad){ac=E.parseJSON(ad);if(ac.code==1){setTimeout(function(){window.location.href=ac.redirect_to},5000)}})}}function g(){if(E.cookie("wc_author_name")){E(".wc_comm_form .wc_name").val(E.cookie("wc_author_name"))}if(E.cookie("wc_author_email")){E(".wc_comm_form .wc_email").val(E.cookie("wc_author_email"))}if(E.cookie("wc_author_website")){E(".wc_comm_form .wc_website").val(E.cookie("wc_author_website"))}}function u(aa,ab){if(E(".wc_email",aa).val()){E.cookie("wc_author_email",E(".wc_email",aa).val())}else{E.cookie("wc_author_email",ab.user_email)}if(E(".wc_name",aa).val()){E.cookie("wc_author_name",E(".wc_name",aa).val())}else{E.cookie("wc_author_name",ab.user_name)}E.cookie("wc_author_website",E(".wc_website",aa).val())}var U;E(document).delegate(".wc_editable_comment","click",function(){var ad=o(E(this),0);var aa=Y(ad);var ac=E(this);var ab="commentId="+aa;e("editComment",ab).done(function(af){try{var aj=E.parseJSON(af);var ah="";var ag=aj.code;if(parseInt(ag)>=0){U=aj.message;var ae='<textarea required="required" name="wc_comment" class="wc_comment wc_field_input wc_edit_comment" id="wc_edit_comment-'+ad+'" style="min-height: 2em;">'+aj.message+"</textarea>";E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-text").replaceWith(ae);document.getElementById("wc_edit_comment-"+ad).focus();E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").show();ae="";E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").hide();E("#wc-comm-"+ad+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").show()}else{ah=wpdiscuz_ajax_obj.wpdiscuz_options[ag];t(ac,ag,ah,false)}}catch(ai){console.log(ai)}E(".wpdiscuz-loading-bar").hide()})});E(document).delegate(".wc_save_edited_comment","click",function(){var af=o(E(this));var ab=Y(af);var aa=E("#wc-comm-"+af+" textarea#wc_edit_comment-"+af);var ac=aa.val();var ae=E(this);if(E.trim(ac).length>0){var ad="commentId="+ab+"&commentContent="+ac;e("saveEditedComment",ad).done(function(ag){try{var ak=E.parseJSON(ag);var ah=ak.code;var ai="";if(parseInt(ah)>=0){I(af,ak.message)}else{ai=wpdiscuz_ajax_obj.wpdiscuz_options[ah];t(ae,ah,ai,false)}aa="";ac=""}catch(aj){console.log(aj)}E(".wpdiscuz-loading-bar").hide()})}});E(document).delegate(".wc_cancel_edit","click",function(){var aa=o(E(this));I(aa,U)});function I(ac,ab){E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_editable_comment").show();E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_cancel_edit").hide();E("#wc-comm-"+ac+" > .wc-comment-right .wc-comment-footer .wc_save_edited_comment").hide();var aa='<div class="wc-comment-text">'+l(ab)+"</div>";E("#wc-comm-"+ac+" #wc_edit_comment-"+ac).replaceWith(aa)}function l(ad,ac){var ab=(ac||typeof ac==="undefined")?"<br/>":"<br>";var aa=(ad+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1"+ab+"$2");return aa.replace("<br><br>","<br/>")}E(document).delegate(".wc-load-more-submit","click",function(){var aa;if(n=="vote"){aa="offset="+c+"&orderBy="+n+"&order="+a;c++}else{aa="orderBy="+n+"&order="+a+"&lastParentId="+w()}aa+="&postId="+p+"&loadAllCommnts="+b;e("loadMoreComments",aa).done(function(ab){try{var ad=E.parseJSON(ab);E(".wpdiscuz-comment-pagination").before(ad.comment_list);s(ad);E(".wpdiscuz_single").remove()}catch(ac){console.log(ac)}F();E(".wpdiscuz-loading-bar").hide();E(".wc-load-more-submit").blur()})});function s(aa){if(aa.is_show_load_more!=false){O(aa.last_parent_id)}else{E(".wc-load-more-submit").parents(".wpdiscuz-comment-pagination").hide()}}E(document).delegate(".wc_vote","click",function(){var aa=E(this);var ad="";var ae="";var ab=E(this).parents(".wc-comment-right").attr("id");ab=ab.substring(ab.lastIndexOf("-")+1);var ac;if(E(this).hasClass("wc-up")){ac=1}else{ac=-1}var af="commentId="+ab+"&voteType="+ac;e("voteOnComment",af).done(function(ag){try{var ai=E.parseJSON(ag);ad=ai.code;if(parseInt(ad)>=0){var aj=E(".wc-comment-footer .wc-vote-result",E("#comment-"+ab));E(aj).text(parseInt(E(aj).text())+ac)}else{ae=wpdiscuz_ajax_obj.wpdiscuz_options[ad];t(aa,ad,ae,false)}}catch(ah){console.log(ah)}E(".wpdiscuz-loading-bar").hide()})});E(document).delegate(".wpdiscuz-sort-button","click",function(){if(!(E(this).hasClass("wpdiscuz-sort-button-active"))){var ad=E(this);if(E(this).hasClass("wpdiscuz-vote-sort-up")){n="vote";a="desc"}else{n="date";a=E(this).hasClass("wpdiscuz-date-sort-desc")?"desc":"asc"}var ac="postId="+p+"&orderBy="+n+"&order="+a;var aa="";var ab="";e("wpdiscuzSorting",ac).done(function(ae){try{var ag=E.parseJSON(ae);aa=ag.code;ab=ag.message;if(parseInt(aa)>0){E("#wpcomm .wc-thread-wrapper .wc-comment").each(function(){E(this).remove()});E("#wpcomm .wc-thread-wrapper").prepend(ab);c=parseInt(ag.loadCount)}else{}K(ad);s(ag)}catch(af){console.log(af)}F();E(".wpdiscuz-loading-bar").hide()})}});function K(aa){E(".wpdiscuz-sort-buttons .wpdiscuz-sort-button").each(function(){E(this).removeClass("wpdiscuz-sort-button-active")});aa.addClass("wpdiscuz-sort-button-active")}function Z(){var ae=location.href;var ad=ae.match(/#comment\-(\d+)/);if(ad!==null){var ab=ad[1];if(!E("#comment-"+ab).length){var ac="commentId="+ab;var aa=e("getSingleComment",ac);aa.done(function(af){try{var ah=E.parseJSON(af);E(".wc-thread-wrapper").prepend(ah.message);E("html, body").animate({scrollTop:E(".wc-thread-wrapper").offset().top},1000)}catch(ag){console.log(ag)}F();E(".wpdiscuz-loading-bar").hide()})}}}Z();if(k>0&&T&&(S||(!S&&!H))){setInterval(M,parseInt(j)*1000)}function M(){var ad=C();var ab=(E.cookie("wc_author_email")!=undefined&&E.cookie("wc_author_email")!="")?E.cookie("wc_author_email"):"";var ac="postId="+p+"&loadLastCommentId="+T+"&visibleCommentIds="+ad+"&email="+ab;var aa=e("liveUpdate",ac);aa.done(function(af){try{var ak=E.parseJSON(af);if(ak.code==1){if(k==1){A(ak)}else{v=v.concat(ak.message.comments);L=L.concat(ak.message.author_replies);var ag=v.length;var ae=L.length;if(ag>0){var ai=ag+" ";ai+=ag>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comments_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_comment_button_text;E(".wc_new_comment").html(ai).show()}else{E(".wc_new_comment").hide()}if(ae>0){var ah=ae+" ";ah+=ae>1?wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_replies_button_text:wpdiscuz_ajax_obj.wpdiscuz_options.wc_new_reply_button_text;E(".wc_new_reply").html(ah).show()}else{E(".wc_new_reply").hide()}}E(".wc_header_text_count").html(ak.wc_all_comments_count_new);T=ak.loadLastCommentId}}catch(aj){console.log(aj)}F();E(".wpdiscuz-loading-bar").hide()})}function A(ad){if(ad.message!==undefined){var aa;var ac=ad.message;for(var ab=0;ab<ac.length;ab++){aa=ac[ab];y(aa.comment_parent,aa.comment_html)}}}E(document).delegate(".wc-update-on-click","click",function(){var aa;var ab=E(this);if(ab.hasClass("wc_new_comment")){aa=v.join()}else{aa=L.join()}e("updateOnClick",aa).done(function(ac){try{var ae=E.parseJSON(ac);A(ae);if(ab.hasClass("wc_new_comment")){v=[];E(".wc_new_comment").hide()}else{L=[];E(".wc_new_reply").hide()}}catch(ad){console.log(ad)}F();E(".wpdiscuz-loading-bar").hide()})});function t(ae,ab,ad,ac){var aa;var af;if(ac){af=ae.parents(".wc-form-wrapper")}else{af=ae.closest(".wc-comment")}aa=af.children(".wpdiscuz-comment-message");aa.addClass(ab);aa.html(ad);aa.show().delay(5000).fadeOut(1000,function(){aa.removeClass();aa.addClass("wpdiscuz-comment-message");aa.html("")})}function i(aa){var ab=o(aa,0);E("#wpdiscuz_form_anchor-"+ab).before(J(ab));E("#wc-secondary-form-wrapper-"+ab).slideToggle(700,function(){aa.addClass("wpdiscuz-clonned")});N(ab,m*60*1000)}function J(ab){var aa=E("#wpdiscuz_hidden_secondary_form").html();return aa.replace(/wpdiscuzuniqueid/g,ab)}function o(ac,ab){var aa="";if(ab){aa=ac.parents(".wc-main-form-wrapper").attr("id")}else{aa=ac.parents(".wc-comment").attr("id")}var ad=aa.substring(aa.lastIndexOf("-")+1);return ad}function Y(aa){return aa.substring(0,aa.indexOf("_"))}function B(ab){var aa=ab.substring(ab.indexOf("_")+1);return aa}function w(){var aa=E(".wc-load-more-link").attr("href");return aa.substring(aa.lastIndexOf("=")+1)}function O(aa){var ab=E(".wc-load-more-link").attr("href");E(".wc-load-more-link").attr("href",ab.replace(/[\d]+$/m,aa));E(".wpdiscuz-comment-pagination").show()}function D(ac){var ab=ac.attr("class");var aa=ab.split(" ");var ad="";E.each(aa,function(ae,af){if("wc_comment_level"===d(af,false)){ad=d(af,true)}});return parseInt(ad)+1}function d(aa,ab){var ac="";if(ab){ac=aa.substring(aa.indexOf("-")+1)}else{ac=aa.substring(0,aa.indexOf("-"))}return ac}function e(ab,aa){if(ab!=="liveUpdate"){E(".wpdiscuz-loading-bar").show()}return E.ajax({type:"POST",url:wpdiscuz_ajax_obj.url,data:{wpdiscuzAjaxData:aa,action:ab}})}function y(ac,ab){if(ac==0){E(".wc-thread-wrapper").prepend(ab)}else{var aa=o(E("#comment-"+ac),0);E("#wpdiscuz_form_anchor-"+aa).after(ab)}}function C(){var ac;var aa;var ab="";E(".wc-comment-right").each(function(){ac=o(E(this),0);aa=Y(ac);ab+=aa+","});return ab}function F(){E(".wc-comment-img-link").tooltipster({trigger:"click",contentAsHTML:true,interactive:true,multiple:true});E(".wc_tooltipster").tooltipster({offsetY:2,multiple:true})}function h(){if(E(".wc_social_plugin_wrapper .wp-social-login-provider-list").length){E(".wc_social_plugin_wrapper .wp-social-login-provider-list").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .the_champ_login_container").length){E(".wc_social_plugin_wrapper .the_champ_login_container").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .social_connect_form").length){E(".wc_social_plugin_wrapper .social_connect_form").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}else{if(E(".wc_social_plugin_wrapper .oneall_social_login_providers").length){E(".wc_social_plugin_wrapper .oneall_social_login .oneall_social_login_providers").clone().prependTo("#wpdiscuz_hidden_secondary_form > .wc-form-wrapper > .wc-secondary-forms-social-content")}}}}}});
class.WpdiscuzCore.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  * Plugin Name: wpDiscuz - Supercharged native comments
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
- * Version: 3.0.0
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: http://www.gvectors.com/
9
  * Plugin URI: http://www.gvectors.com/wpdiscuz/
@@ -58,8 +58,8 @@ class WpdiscuzCore implements WpDiscuzConstants {
58
  if (!$this->optionsSerialized->captchaShowHide) {
59
  add_action('init', array(&$this->helper, 'registerSession'), 2);
60
  }
61
- add_action('admin_post_generateCaptcha', array(&$this->helper, 'generateCaptcha'));
62
- add_action('admin_post_nopriv_generateCaptcha', array(&$this->helper, 'generateCaptcha'));
63
  add_action('wp_ajax_setCaptchaExpiredd', array(&$this->helper, 'setCaptchaExpired'));
64
  add_action('wp_ajax_nopriv_setCaptchaExpired', array(&$this->helper, 'setCaptchaExpired'));
65
  add_action('wp_ajax_loadMoreComments', array(&$this, 'loadMoreComments'));
@@ -72,8 +72,8 @@ class WpdiscuzCore implements WpDiscuzConstants {
72
  add_action('wp_ajax_nopriv_addComment', array(&$this, 'addComment'));
73
  add_action('wp_ajax_getSingleComment', array(&$this, 'getSingleComment'));
74
  add_action('wp_ajax_nopriv_getSingleComment', array(&$this, 'getSingleComment'));
75
- add_action('admin_post_addSubscription', array(&$this->emailHelper, 'addSubscription'));
76
- add_action('admin_post_nopriv_addSubscription', array(&$this->emailHelper, 'addSubscription'));
77
  add_action('wp_ajax_checkNotificationType', array(&$this->emailHelper, 'checkNotificationType'));
78
  add_action('wp_ajax_nopriv_checkNotificationType', array(&$this->emailHelper, 'checkNotificationType'));
79
  add_action('wp_ajax_redirect', array(&$this, 'redirect'));
3
  /*
4
  * Plugin Name: wpDiscuz - Supercharged native comments
5
  * Description: Better comment system. Wordpress post comments and discussion plugin. Allows your visitors discuss, vote for comments and share.
6
+ * Version: 3.0.1
7
  * Author: gVectors Team (A. Chakhoyan, G. Zakaryan, H. Martirosyan)
8
  * Author URI: http://www.gvectors.com/
9
  * Plugin URI: http://www.gvectors.com/wpdiscuz/
58
  if (!$this->optionsSerialized->captchaShowHide) {
59
  add_action('init', array(&$this->helper, 'registerSession'), 2);
60
  }
61
+ add_action('wp_ajax_generateCaptcha', array(&$this->helper, 'generateCaptcha'));
62
+ add_action('wp_ajax_nopriv_generateCaptcha', array(&$this->helper, 'generateCaptcha'));
63
  add_action('wp_ajax_setCaptchaExpiredd', array(&$this->helper, 'setCaptchaExpired'));
64
  add_action('wp_ajax_nopriv_setCaptchaExpired', array(&$this->helper, 'setCaptchaExpired'));
65
  add_action('wp_ajax_loadMoreComments', array(&$this, 'loadMoreComments'));
72
  add_action('wp_ajax_nopriv_addComment', array(&$this, 'addComment'));
73
  add_action('wp_ajax_getSingleComment', array(&$this, 'getSingleComment'));
74
  add_action('wp_ajax_nopriv_getSingleComment', array(&$this, 'getSingleComment'));
75
+ add_action('wp_ajax_post_addSubscription', array(&$this->emailHelper, 'addSubscription'));
76
+ add_action('wp_ajax_nopriv_addSubscription', array(&$this->emailHelper, 'addSubscription'));
77
  add_action('wp_ajax_checkNotificationType', array(&$this->emailHelper, 'checkNotificationType'));
78
  add_action('wp_ajax_nopriv_checkNotificationType', array(&$this->emailHelper, 'checkNotificationType'));
79
  add_action('wp_ajax_redirect', array(&$this, 'redirect'));
options/options-layouts/settings-synch-comments.php CHANGED
@@ -25,12 +25,29 @@ if (!defined('ABSPATH')) {
25
  <input id="wpdiscuz_synch_comments_count" value="25" style="width:80px;" type="number" placeholder="<?php _e('Default value is 25', 'wpdiscuz'); ?>" name="wpdiscuz_synch_comments_count"/>
26
  <button <?php echo $disabled; ?> type="button" class="button button-primary" style="background:#4793C8;" id="wpdiscuz_synch_comments"><?php _e('Supercharge My Comments', 'wpdiscuz'); ?></button>
27
  <br />
28
- <span style="font-size:11px; color:#666666;"><?php _e("Number of comment threads (parent comments) per request", 'wpdiscuz'); ?></span>
29
  </div>
30
  <div style="min-width:354px; float:left; border-radius:4px; border:#CCCCCC 1px solid;">
31
  <div id="wpdiscuz_progressbar_wrapper" class="wrap" style="max-width:354px; height:50px; width:100%; margin:0px;"></div>
32
  </div>
33
  <div style="clear:both;"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </div>
35
  <span style="font-size:12px; color:#666666;">&nbsp;&nbsp; <?php _e("Note: after each deactivation of wpDiscuz, it may ask you to optimize existing comments again. It needs to make sure, that all comments, which have been added during deactivation period are also optimized.", 'wpdiscuz'); ?></span>
36
  </div>
25
  <input id="wpdiscuz_synch_comments_count" value="25" style="width:80px;" type="number" placeholder="<?php _e('Default value is 25', 'wpdiscuz'); ?>" name="wpdiscuz_synch_comments_count"/>
26
  <button <?php echo $disabled; ?> type="button" class="button button-primary" style="background:#4793C8;" id="wpdiscuz_synch_comments"><?php _e('Supercharge My Comments', 'wpdiscuz'); ?></button>
27
  <br />
28
+ <span style="font-size:11px; color:#666666;"><?php _e("Number of comments per request", 'wpdiscuz'); ?></span>
29
  </div>
30
  <div style="min-width:354px; float:left; border-radius:4px; border:#CCCCCC 1px solid;">
31
  <div id="wpdiscuz_progressbar_wrapper" class="wrap" style="max-width:354px; height:50px; width:100%; margin:0px;"></div>
32
  </div>
33
  <div style="clear:both;"></div>
34
+ <div style="font-size:13px; color:#666666; padding:10px;"><?php _e("Please note: If your comments are not optimized yet, those are hidden on front-end. All comments will be back once this process is completed.", 'wpdiscuz'); ?></div>
35
+ <div style=" padding:15px; margin:15px 0px; background:#EDFAFF; font-size:13px;">
36
+ <h3 style="margin-top:0px; padding-top:0px;">Some good tips</h3>
37
+ <p style="font-size:14px; font-weight:bold; margin-bottom:5px;"> If the [Supercharge my comments] button doesn't work:</p>
38
+ This problem comes just because you have some "Warning" errors getting outputted before the first header gets written ( or in-between ).
39
+ This is the 90% of all cases. This comes from different plugins. We can't check all those so we've created a stand-alone version of comment supercharger:
40
+ <ol>
41
+ <li style="margin-bottom:2px">Please download this file: <a href="http://wpdiscuz.com/300/wpdiscuz.zip" target="_blank">http://wpdiscuz.com/300/wpdiscuz.zip</a></li>
42
+ <li style="margin-bottom:2px">Unzip and upload wpdiscuz.php file to root directory of your WordPress site.</li>
43
+ <li style="margin-bottom:2px">Than call it like <span style="color:#FF6633">http://example.com/wpdiscuz.php</span></li>
44
+ <li style="margin-bottom:2px">This will show you a form with [Go] button. Just click on that and wait for "Done!" message.</li>
45
+ <li style="margin-bottom:2px">Remove wpdiscuz.php file from your root directory.</li>
46
+ </ol>
47
+
48
+ <p style="font-size:14px; font-weight:bold; margin-bottom:5px;">If "There are new comments for optimization [--button--]" message can't get away:</p>
49
+ Please try to post a new comment on front-end, it should fix this issue. Also don't forget to clean all caches after that.
50
+ </div>
51
  </div>
52
  <span style="font-size:12px; color:#666666;">&nbsp;&nbsp; <?php _e("Note: after each deactivation of wpDiscuz, it may ask you to optimize existing comments again. It needs to make sure, that all comments, which have been added during deactivation period are also optimized.", 'wpdiscuz'); ?></span>
53
  </div>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: wordpress comments, ajax comments, ajax, live update, live comments, realtime chat, chat, realtime commenting, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jatpack comments alternative, Facebook comments alternative, comment form, commenting, reply, comments, better comments, discussions, comment notifications, comment template, activity, comment author, comment system, redirect, comment redirect, first commenter, email commenting, social login, boost comments, native comments
5
  Requires at least: 3.1
6
  Tested up to: 4.3.1
7
- Stable tag: 3.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -140,11 +140,20 @@ wpDiscuz Documentation: http://wpdiscuz.com/wpdiscuz-documentation/
140
 
141
  == Changelog ==
142
 
143
- = 3.0.0 Supercharged Comments =
 
 
 
144
 
145
- IMPORTANT: If your're updating from wpDiscuz 1.x or from 2.x you should do one-time data optimization of existing comments. It doesn't load comments if those are not optimized. Please Go to Dashboard > Comments > wpDiscuz Settings > Comments Optimization Tab and click on [Supercharge my comments] button and wait for 100% result. All new comments will be automatically optimized. This process doesn't affect any data, it doesn't re-store comments in different tables, it just collects comments thread hierarchy and relationship information.
146
  IMPORTANT: If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
147
 
 
 
 
 
 
 
 
148
  * Boosted: Supports dozens of thousands comments per post (tested with 50k/per post)
149
  * Аccelerated: First page load x10 faster (for >100 comments)
150
  * Аccelerated: Load more comments (button) x12 faster (for >100 comments)
4
  Tags: wordpress comments, ajax comments, ajax, live update, live comments, realtime chat, chat, realtime commenting, mobile commenting, post comments, advanced comment, comments box, community, discussion, discuss, disqus, discuz, Disqus alternative, Livefyre alternative, Jatpack comments alternative, Facebook comments alternative, comment form, commenting, reply, comments, better comments, discussions, comment notifications, comment template, activity, comment author, comment system, redirect, comment redirect, first commenter, email commenting, social login, boost comments, native comments
5
  Requires at least: 3.1
6
  Tested up to: 4.3.1
7
+ Stable tag: 3.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
140
 
141
  == Changelog ==
142
 
143
+ = 3.0.1 Supercharged Comments =
144
+
145
+
146
+ IMPORTANT: If your're updating from wpDiscuz 1.x or from 2.x you should do one-time data optimization of existing comments. Please go to Comments > wpDiscuz Settings > Comments Optimization Tab and click on [Supercharge my comments] button and wait for 100% result.
147
 
 
148
  IMPORTANT: If you have a Cache Plugin and CDN, please delete all caches and purge CDN after wpDiscuz update.
149
 
150
+ * Tip: [Supercharge my comments] button doesn't work
151
+ * Tip: "There are new comments for optimization [--button--]" message can't get away
152
+ * Fixed Bug: CAPTCHA image doesn't work (on websites where post ajax php file is secured)
153
+
154
+
155
+ = 3.0.0 Supercharged Comments =
156
+
157
  * Boosted: Supports dozens of thousands comments per post (tested with 50k/per post)
158
  * Аccelerated: First page load x10 faster (for >100 comments)
159
  * Аccelerated: Load more comments (button) x12 faster (for >100 comments)
templates/comment/comment-form.php CHANGED
@@ -128,7 +128,7 @@ if (comments_open($post->ID)) {
128
  <?php
129
  if ($subscriptionType != WpdiscuzCore::SUBSCRIPTION_POST) {
130
  ?>
131
- <form action="<?php echo admin_url('admin-post.php') . '?action=addSubscription'; ?>" method="post" id="wpdiscuz-subscribe-form">
132
  <div class="wpdiscuz-subscribe-form-intro"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_of']; ?> </div>
133
  <div class="wpdiscuz-subscribe-form-option" style="width:<?php echo (!is_user_logged_in()) ? '40%' : '65%'; ?>;">
134
  <select class="wpdiscuz_select" name="wpdiscuzSubscriptionType" >
128
  <?php
129
  if ($subscriptionType != WpdiscuzCore::SUBSCRIPTION_POST) {
130
  ?>
131
+ <form action="<?php echo admin_url('admin-ajax.php') . '?action=addSubscription'; ?>" method="post" id="wpdiscuz-subscribe-form">
132
  <div class="wpdiscuz-subscribe-form-intro"><?php echo $wpdiscuz->optionsSerialized->phrases['wc_notify_of']; ?> </div>
133
  <div class="wpdiscuz-subscribe-form-option" style="width:<?php echo (!is_user_logged_in()) ? '40%' : '65%'; ?>;">
134
  <select class="wpdiscuz_select" name="wpdiscuzSubscriptionType" >
utils/class.WpdiscuzHelper.php CHANGED
@@ -364,7 +364,7 @@ class WpdiscuzHelper {
364
  <input type="text" maxlength="5" value="" required="required" name="wc_captcha" class="wc_field_input wc_field_captcha">
365
  <span class="wc-label wc-captcha-label">
366
  <a class="wpdiscuz-nofollow" href="#" rel="nofollow">
367
- <?php $wc_captcha_img_url = admin_url('admin-post.php') . '?action=generateCaptcha&wpdiscuz_captcha_id=' . $unique_id; ?>
368
  <img class="wc_captcha_img" src="<?php echo wp_nonce_url($wc_captcha_img_url, 'wc_captcha_img'); ?>&wpdiscuz-rand=<?php echo md5($unique_id); ?>">
369
  </a>
370
  <a class="wpdiscuz-nofollow wc_captcha_refresh_img" href="#" rel="nofollow">
364
  <input type="text" maxlength="5" value="" required="required" name="wc_captcha" class="wc_field_input wc_field_captcha">
365
  <span class="wc-label wc-captcha-label">
366
  <a class="wpdiscuz-nofollow" href="#" rel="nofollow">
367
+ <?php $wc_captcha_img_url = admin_url('admin-ajax.php') . '?action=generateCaptcha&wpdiscuz_captcha_id=' . $unique_id; ?>
368
  <img class="wc_captcha_img" src="<?php echo wp_nonce_url($wc_captcha_img_url, 'wc_captcha_img'); ?>&wpdiscuz-rand=<?php echo md5($unique_id); ?>">
369
  </a>
370
  <a class="wpdiscuz-nofollow wc_captcha_refresh_img" href="#" rel="nofollow">
utils/class.WpdiscuzOptimizationHelper.php CHANGED
@@ -208,7 +208,7 @@ class WpdiscuzOptimizationHelper {
208
  public function wpdiscuzRequirements() {
209
  $realLastCommentId = $this->dbManager->getLastCommentId();
210
  if ($realLastCommentId) {
211
- $savedLastCommentId = get_option(WpdiscuzCore::OPTION_SLUG_OPTIMIZED_LAST_COMMENT_ID);
212
  $synchronizeTabLink = '<a class="button button-primary" style="margin: 10px 0;" href="' . admin_url() . 'edit-comments.php?page=wpdiscuz_options_page#optionsTab7">' . __('Go to comment optimization page', 'wpdiscuz') . '</a>';
213
  if (!$savedLastCommentId) {
214
  echo "<div class='error'><p style='font-size: 14px;line-height: 20px;'>" . __('To start using wpDiscuz 3 you should do one-time data optimization of existing comments. All new comments will be automatically optimized. Just click on [Supercharge my comments] button and wait for 100% result &nbsp;&nbsp;&gt;&nbsp;&nbsp; ', 'wpdiscuz') . $synchronizeTabLink . "</p></div>";
208
  public function wpdiscuzRequirements() {
209
  $realLastCommentId = $this->dbManager->getLastCommentId();
210
  if ($realLastCommentId) {
211
+ $savedLastCommentId = intval(get_option(WpdiscuzCore::OPTION_SLUG_OPTIMIZED_LAST_COMMENT_ID));
212
  $synchronizeTabLink = '<a class="button button-primary" style="margin: 10px 0;" href="' . admin_url() . 'edit-comments.php?page=wpdiscuz_options_page#optionsTab7">' . __('Go to comment optimization page', 'wpdiscuz') . '</a>';
213
  if (!$savedLastCommentId) {
214
  echo "<div class='error'><p style='font-size: 14px;line-height: 20px;'>" . __('To start using wpDiscuz 3 you should do one-time data optimization of existing comments. All new comments will be automatically optimized. Just click on [Supercharge my comments] button and wait for 100% result &nbsp;&nbsp;&gt;&nbsp;&nbsp; ', 'wpdiscuz') . $synchronizeTabLink . "</p></div>";