No regular expressions were active.
|
|
1 |
|
|
|
|
2 |
|
$.fn.bxdol
cmtanim =
function(a
ction, eff
ect, speed
, h)
|
|
|
3 |
|
{
|
|
|
4 |
|
return
this.each(
function()
|
|
|
5 |
|
{
|
|
|
6 |
|
va
r sFunc =
'';
|
|
|
7 |
|
va
r sEval;
|
|
|
8 |
|
|
|
|
9 |
|
if
(0 == spe
ed)
|
|
|
10 |
|
effect =
'default'
;
|
|
|
11 |
|
|
|
|
12 |
|
sw
itch (acti
on)
|
|
|
13 |
|
{
|
|
|
14 |
|
case 'sh
ow':
|
|
|
15 |
|
swit
ch (effect
)
|
|
|
16 |
|
{
|
|
|
17 |
|
case 'slid
e': sFunc
= 'slideDo
wn'; break
;
|
|
|
18 |
|
case 'fade
': sFunc =
'fadeIn';
break;
|
|
|
19 |
|
default: s
Func = 'sh
ow';
|
|
|
20 |
|
}
|
|
|
21 |
|
brea
k;
|
|
|
22 |
|
case 'hi
de':
|
|
|
23 |
|
swit
ch (effect
)
|
|
|
24 |
|
{
|
|
|
25 |
|
case 'slid
e': sFunc
= 'slideUp
'; break;
|
|
|
26 |
|
case 'fade
': sFunc =
'fadeOut'
; break;
|
|
|
27 |
|
default: s
Func = 'hi
de';
|
|
|
28 |
|
}
|
|
|
29 |
|
brea
k;
|
|
|
30 |
|
default:
|
|
|
31 |
|
case 'to
ggle':
|
|
|
32 |
|
swit
ch (effect
)
|
|
|
33 |
|
{
|
|
|
34 |
|
case 'slid
e': sFunc
= 'slideTo
ggle'; bre
ak;
|
|
|
35 |
|
case 'fade
': sFunc =
($(this).
filter(':v
isible').l
ength) ? '
fadeOut' :
'fadeIn';
break;
|
|
|
36 |
|
default: s
Func = 'to
ggle';
|
|
|
37 |
|
}
|
|
|
38 |
|
}
|
|
|
39 |
|
|
|
|
40 |
|
|
|
|
41 |
|
if
((0 == sp
eed || und
efined ==
speed) &&
undefined
== h)
|
|
|
42 |
|
{
|
|
|
43 |
|
sEval =
'$(this).'
+ sFunc +
'();';
|
|
|
44 |
|
}
|
|
|
45 |
|
el
se
|
|
|
46 |
|
if
((0 == sp
eed || und
efined ==
speed) &&
undefined
!= h)
|
|
|
47 |
|
{
|
|
|
48 |
|
sEval =
'$(this).'
+ sFunc +
'(); $(th
is).each(h
);';
|
|
|
49 |
|
}
|
|
|
50 |
|
el
se
|
|
|
51 |
|
{
|
|
|
52 |
|
sEval =
'$(this).'
+ sFunc +
"('" + sp
eed + "',
h);";
|
|
|
53 |
|
}
|
|
|
54 |
|
|
|
|
55 |
|
ev
al (sEval)
;
|
|
|
56 |
|
|
|
|
57 |
|
re
turn this;
|
|
|
58 |
|
});
|
|
|
59 |
|
};
|
|
|
60 |
|
|
|
|
61 |
|
|
|
|
62 |
|
function B
xDolCmts (
options)
|
|
|
63 |
|
{
|
|
|
64 |
|
//sObj
Name, sBas
eUrl, sSys
tem, iObjI
d, sDefaul
tErrMsg, s
ConfirmMsg
, isEditAl
lowed, isR
emoveAllow
ed, iSecsT
oEdit
|
|
|
65 |
|
|
|
|
66 |
|
this.o
CmtElement
s = {}; //
form elem
ents
|
|
|
67 |
|
this._
sObjName =
undefined
== option
s.sObjName
? 'oCmts'
: options
.sObjName;
// jav
ascript ob
ject name,
to run cu
rrent obje
ct instanc
e from onT
imer
|
|
|
68 |
|
this._
sSystem =
options.sS
ystem; //
current co
mment syst
em
|
|
|
69 |
|
this._
iObjId = o
ptions.iOb
jId; // th
is object
id comment
s
|
|
|
70 |
|
this._
sActionsUr
l = option
s.sBaseUrl
+ 'cmts.p
hp'; // ac
tions url
address
|
|
|
71 |
|
this._
sDefaultEr
rMsg = und
efined ==
options.sD
efaultErrM
sg ? 'Erro
d Occured'
: ''; //
default er
ror messag
e
|
|
|
72 |
|
this._
sConfirmMs
g = undefi
ned == opt
ions.sConf
irmMsg ? '
Are you su
re?' : opt
ions.sConf
irmMsg; //
confirm m
essage
|
|
|
73 |
|
|
|
|
74 |
|
this._
isEditAllo
wed = pars
eInt(undef
ined == op
tions.isEd
itAllowed
? 0 : opti
ons.isEdit
Allowed);
// is edit
allowed
|
|
|
75 |
|
this._
isRemoveAl
lowed = pa
rseInt(und
efined ==
options.is
RemoveAllo
wed ? 0 :
options.is
RemoveAllo
wed); // i
s remove a
llowed
|
|
|
76 |
|
this._
iSecsToEdi
t = parseI
nt(undefin
ed == opti
ons.iSecsT
oEdit ? 0
: options.
iSecsToEdi
t); // num
ber of sec
onds to al
low edit c
omment
|
|
|
77 |
|
|
|
|
78 |
|
this._
oSavedText
s = {};
|
|
|
79 |
|
|
|
|
80 |
|
this._
sAnimation
Effect = u
ndefined =
= options.
sAnimation
Effect ? '
slide' : o
ptions.sAn
imationEff
ect;
|
|
|
81 |
|
this._
iAnimation
Speed = un
defined ==
options.i
AnimationS
peed ? 'sl
ow' : opti
ons.iAnima
tionSpeed;
|
|
|
82 |
|
|
|
|
83 |
|
// ini
t post com
ment form
(because b
rowser rem
eber last
inputs, we
need to c
lear it)
|
|
|
84 |
|
if ($(
'#cmts-box
-' + this.
_iObjId +
' > .cmt-p
ost-reply
> form').l
ength)
|
|
|
85 |
|
{
|
|
|
86 |
|
$(
'#cmts-box
-' + this.
_iObjId +
' > .cmt-p
ost-reply
> form')[0
].reset();
|
|
|
87 |
|
$(
'#cmts-box
-' + this.
_iObjId +
' > .cmt-p
ost-reply
> form > [
name=CmtPa
rent]').va
l(0);
|
|
|
88 |
|
}
|
|
|
89 |
|
|
|
|
90 |
|
// cli
cks handle
r for rati
ngs
|
|
|
91 |
|
var $t
his = this
;
|
|
|
92 |
|
$('#cm
ts-box-' +
this._iOb
jId).click
(function
(event)
|
|
|
93 |
|
{
|
|
|
94 |
|
va
r iRate =
0;
|
|
|
95 |
|
if
($(event.
target).fi
lter('.cmt
-pos').len
gth)
|
|
|
96 |
|
{
|
|
|
97 |
|
iRate =
1;
|
|
|
98 |
|
event.pr
eventDefau
lt();
|
|
|
99 |
|
}
|
|
|
100 |
|
el
se
|
|
|
101 |
|
if
($(event.
target).fi
lter('.cmt
-neg').len
gth)
|
|
|
102 |
|
{
|
|
|
103 |
|
iRate =
-1;
|
|
|
104 |
|
event.pr
eventDefau
lt();
|
|
|
105 |
|
}
|
|
|
106 |
|
el
se
|
|
|
107 |
|
if
($(event.
target).fi
lter('.cmt
-hid').len
gth)
|
|
|
108 |
|
{
|
|
|
109 |
|
$this._t
oggleHidde
n(event.ta
rget, pars
eInt(event
.target.id
.substr(8)
));
|
|
|
110 |
|
event.pr
eventDefau
lt();
|
|
|
111 |
|
}
|
|
|
112 |
|
|
|
|
113 |
|
if
(0 != iRa
te && !$(e
vent.targe
t).parent(
).filter('
.cmt-rate-
disabled')
.length)
|
|
|
114 |
|
{
|
|
|
115 |
|
var e =
$(event.ta
rget).pare
nt().child
ren().filt
er('span')
.get(0);
|
|
|
116 |
|
$this._r
ateComment
(e, parseI
nt(event.t
arget.id.s
ubstr(8)),
iRate);
|
|
|
117 |
|
}
|
|
|
118 |
|
});
|
|
|
119 |
|
}
|
|
|
120 |
|
|
|
|
121 |
|
BxDolCmts.
prototype.
showMore =
function
(e, iPerVi
ew)
|
|
|
122 |
|
{
|
|
|
123 |
|
$('#cm
ts-box-' +
this._iOb
jId + ' >
ul > .cmt:
hidden:lt(
'+iPerView
+')').bxdo
lcmtanim('
show', thi
s._sAnimat
ionEffect,
this._iAn
imationSpe
ed);
|
|
|
124 |
|
|
|
|
125 |
|
var n
= $('#cmts
-box-' + t
his._iObjI
d + ' > ul
> .cmt:hi
dden').len
gth;
|
|
|
126 |
|
|
|
|
127 |
|
if (n
== 0)
|
|
|
128 |
|
{
|
|
|
129 |
|
$(
'#cmts-box
-' + this.
_iObjId +
' > .cmt-s
how-more')
.remove();
|
|
|
130 |
|
}
|
|
|
131 |
|
else
|
|
|
132 |
|
{
|
|
|
133 |
|
va
r iStart =
$('#cmts-
box-' + th
is._iObjId
+ ' > ul
> .cmt:vis
ible').len
gth + 1;
|
|
|
134 |
|
if
(n > (iPe
rView-1))
|
|
|
135 |
|
{
|
|
|
136 |
|
$('#cmts
-box-' + t
his._iObjI
d + ' > .c
mt-show-mo
re b').htm
l(iStart);
|
|
|
137 |
|
$('#cmts
-box-' + t
his._iObjI
d + ' > .c
mt-show-mo
re u').htm
l(iStart +
iPerView
- 1);
|
|
|
138 |
|
}
|
|
|
139 |
|
el
se
|
|
|
140 |
|
{
|
|
|
141 |
|
$('#cmts
-box-' + t
his._iObjI
d + ' > .c
mt-show-mo
re b').htm
l(iStart);
|
|
|
142 |
|
$('#cmts
-box-' + t
his._iObjI
d + ' > .c
mt-show-mo
re u').htm
l(iStart +
n - 1);
|
|
|
143 |
|
}
|
|
|
144 |
|
}
|
|
|
145 |
|
}
|
|
|
146 |
|
|
|
|
147 |
|
// show hi
de post re
ply form
|
|
|
148 |
|
// if ther
e is no re
ply form i
t gets it
and set Cm
tParent fo
rm input
|
|
|
149 |
|
BxDolCmts.
prototype.
toggleRepl
y = functi
on (e, iCm
tParentId)
|
|
|
150 |
|
{
|
|
|
151 |
|
var h
= function
() {
|
|
|
152 |
|
if
($(this).
filter(':v
isible').l
ength)
|
|
|
153 |
|
$(this).
parent().a
ddClass('c
mt-post-re
ply-expand
ed');
|
|
|
154 |
|
el
se
|
|
|
155 |
|
$(this).
parent().r
emoveClass
('cmt-post
-reply-exp
anded');
|
|
|
156 |
|
}
|
|
|
157 |
|
|
|
|
158 |
|
if (0
== iCmtPar
entId && $
(e).parent
().next('f
orm').leng
th)
|
|
|
159 |
|
{
|
|
|
160 |
|
$(
e).parent(
).next('fo
rm').bxdol
cmtanim('t
oggle', th
is._sAnima
tionEffect
, this._iA
nimationSp
eed, h);
|
|
|
161 |
|
}
|
|
|
162 |
|
else i
f (0 != iC
mtParentId
)
|
|
|
163 |
|
{
|
|
|
164 |
|
if
($(e).nex
t('form').
length)
|
|
|
165 |
|
$(e).nex
t('form').
bxdolcmtan
im('toggle
', this._s
AnimationE
ffect, thi
s._iAnimat
ionSpeed,
h);
|
|
|
166 |
|
el
se
|
|
|
167 |
|
$(e).aft
er($('#cmt
s-box-' +
this._iObj
Id + ' > .
cmt-post-r
eply > for
m').clone(
).show().h
ide()).nex
t('form').
bxdolcmtan
im('toggle
', this._s
AnimationE
ffect, thi
s._iAnimat
ionSpeed,
h).childre
n().filter
('[name=Cm
tParent]')
.val(iCmtP
arentId);
|
|
|
168 |
|
}
|
|
|
169 |
|
}
|
|
|
170 |
|
|
|
|
171 |
|
// show/hi
de comment
replies
|
|
|
172 |
|
BxDolCmts.
prototype.
toggleCmts
= functio
n (e, iCmt
ParentId)
|
|
|
173 |
|
{
|
|
|
174 |
|
var sI
d = '#cmt'
+iCmtParen
tId;
|
|
|
175 |
|
if ($(
sId+'>ul')
.length)
|
|
|
176 |
|
{
|
|
|
177 |
|
if
($(sId+'>
ul:visible
').length)
|
|
|
178 |
|
{
|
|
|
179 |
|
$(sId+'>
ul').bxdol
cmtanim('h
ide', this
._sAnimati
onEffect,
this._iAni
mationSpee
d, functio
n () { $(s
Id+' > .cm
t-cont .cm
t-replies'
).removeCl
ass('cmt-r
eplies-hov
er'); $(sI
d+' > .cmt
-cont .cmt
-replies .
cmt-replie
s-hide').h
ide(); $(s
Id+' > .cm
t-cont .cm
t-replies
.cmt-repli
es-show').
show(); }
);
|
|
|
180 |
|
}
|
|
|
181 |
|
el
se
|
|
|
182 |
|
{
|
|
|
183 |
|
$(sId+'>
ul').bxdol
cmtanim('s
how', this
._sAnimati
onEffect,
this._iAni
mationSpee
d);
|
|
|
184 |
|
$(sId+'
> .cmt-con
t > .cmt-r
eplies').a
ddClass('c
mt-replies
-hover');
|
|
|
185 |
|
$(sId+'
> .cmt-con
t .cmt-rep
lies .cmt-
replies-sh
ow').hide(
);
|
|
|
186 |
|
$(sId+'
> .cmt-con
t .cmt-rep
lies .cmt-
replies-hi
de').show(
);
|
|
|
187 |
|
}
|
|
|
188 |
|
}
|
|
|
189 |
|
else
|
|
|
190 |
|
{
|
|
|
191 |
|
th
is._getCmt
s (e, iCmt
ParentId,
function (
) { $(sId+
' > .cmt-c
ont .cmt-r
eplies').a
ddClass('c
mt-replies
-hover');
$(sId+' >
.cmt-cont
.cmt-repli
es .cmt-re
plies-show
').hide();
$(sId+' >
.cmt-cont
.cmt-repl
ies .cmt-r
eplies-hid
e').show()
; } );
|
|
|
192 |
|
}
|
|
|
193 |
|
}
|
|
|
194 |
|
|
|
|
195 |
|
BxDolCmts.
prototype.
cmtRemove
= function
(e, iCmtI
d)
|
|
|
196 |
|
{
|
|
|
197 |
|
if (!t
his._confi
rm()) retu
rn;
|
|
|
198 |
|
|
|
|
199 |
|
var $t
his = this
;
|
|
|
200 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
201 |
|
oData[
'action']
= 'CmtRemo
ve';
|
|
|
202 |
|
oData[
'Cmt'] = i
CmtId;
|
|
|
203 |
|
|
|
|
204 |
|
this._
loading (e
, true);
|
|
|
205 |
|
|
|
|
206 |
|
jQuery
.get (
|
|
|
207 |
|
th
is._sActio
nsUrl,
|
|
|
208 |
|
oD
ata,
|
|
|
209 |
|
fu
nction (s)
|
|
|
210 |
|
{
|
|
|
211 |
|
$this._l
oading (e,
false);
|
|
|
212 |
|
|
|
|
213 |
|
if (jQue
ry.trim(s)
.length)
|
|
|
214 |
|
aler
t(s);
|
|
|
215 |
|
else
|
|
|
216 |
|
$('#
cmt'+iCmtI
d).bxdolcm
tanim('hid
e', $this.
_sAnimatio
nEffect, $
this._iAni
mationSpee
d, functio
n () { $(t
his).remov
e(); } );
|
|
|
217 |
|
}
|
|
|
218 |
|
);
|
|
|
219 |
|
}
|
|
|
220 |
|
|
|
|
221 |
|
BxDolCmts.
prototype.
cmtEdit =
function (
e, iCmtId)
|
|
|
222 |
|
{
|
|
|
223 |
|
var $t
his = this
;
|
|
|
224 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
225 |
|
oData[
'action']
= 'CmtEdit
';
|
|
|
226 |
|
oData[
'Cmt'] = i
CmtId;
|
|
|
227 |
|
|
|
|
228 |
|
if ($(
'#cmt'+iCm
tId+'>.cmt
-cont>.cmt
-body>form
').length)
|
|
|
229 |
|
{
|
|
|
230 |
|
$(
'#cmt'+iCm
tId+'>.cmt
-cont>.cmt
-body').re
moveClass(
'cmt-post-
reply-expa
nded').bxd
olcmtanim(
'hide', $t
his._sAnim
ationEffec
t, $this._
iAnimation
Speed, fun
ction() {
$(this).ht
ml($this._
oSavedText
s[iCmtId])
.bxdolcmta
nim('show'
, $this._s
AnimationE
ffect, $th
is._iAnima
tionSpeed)
} );
|
|
|
231 |
|
re
turn;
|
|
|
232 |
|
}
|
|
|
233 |
|
else
|
|
|
234 |
|
{
|
|
|
235 |
|
th
is._oSaved
Texts[iCmt
Id] = $('#
cmt'+iCmtI
d+'>.cmt-c
ont>.cmt-b
ody').html
();
|
|
|
236 |
|
}
|
|
|
237 |
|
|
|
|
238 |
|
this._
loading (e
, true);
|
|
|
239 |
|
|
|
|
240 |
|
jQuery
.get (
|
|
|
241 |
|
th
is._sActio
nsUrl,
|
|
|
242 |
|
oD
ata,
|
|
|
243 |
|
fu
nction (s)
|
|
|
244 |
|
{
|
|
|
245 |
|
$this._l
oading (e,
false);
|
|
|
246 |
|
|
|
|
247 |
|
if ('err
' == s.sub
string(0,3
))
|
|
|
248 |
|
aler
t (s.subst
ring(3));
|
|
|
249 |
|
else
|
|
|
250 |
|
$('#
cmt'+iCmtI
d+'>.cmt-c
ont>.cmt-b
ody').bxdo
lcmtanim('
hide', $th
is._sAnima
tionEffect
, $this._i
AnimationS
peed, func
tion() { $
(this).htm
l(s).bxdol
cmtanim('s
how', $thi
s._sAnimat
ionEffect,
$this._iA
nimationSp
eed, funct
ion () { $
(this).add
Class('cmt
-post-repl
y-expanded
'); }) } )
;
|
|
|
251 |
|
}
|
|
|
252 |
|
);
|
|
|
253 |
|
}
|
|
|
254 |
|
|
|
|
255 |
|
// get com
ment repli
es via aja
x request
|
|
|
256 |
|
BxDolCmts.
prototype.
_getCmts =
function
(e, iCmtPa
rentId, h)
|
|
|
257 |
|
{
|
|
|
258 |
|
var $t
his = this
;
|
|
|
259 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
260 |
|
oData[
'action']
= 'CmtsGet
';
|
|
|
261 |
|
oData[
'CmtParent
'] = iCmtP
arentId;
|
|
|
262 |
|
|
|
|
263 |
|
this._
loading (e
, true);
|
|
|
264 |
|
|
|
|
265 |
|
jQuery
.get (
|
|
|
266 |
|
th
is._sActio
nsUrl,
|
|
|
267 |
|
oD
ata,
|
|
|
268 |
|
fu
nction (s)
|
|
|
269 |
|
{
|
|
|
270 |
|
h();
|
|
|
271 |
|
$('#cmt'
+iCmtParen
tId).appen
d($(s).fil
ter('.cmts
').addClas
s('cmts-ma
rgin').hid
e()).child
ren().filt
er('.cmts'
).bxdolcmt
anim('show
', $this._
sAnimation
Effect, $t
his._iAnim
ationSpeed
);
|
|
|
272 |
|
$this._l
oading (e,
false);
|
|
|
273 |
|
}
|
|
|
274 |
|
);
|
|
|
275 |
|
}
|
|
|
276 |
|
|
|
|
277 |
|
// get jus
t posted 1
comment v
ia ajax re
quest
|
|
|
278 |
|
BxDolCmts.
prototype.
_getCmt =
function (
f, iCmtPar
entId, iCm
tId)
|
|
|
279 |
|
{
|
|
|
280 |
|
var $t
his = this
;
|
|
|
281 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
282 |
|
oData[
'action']
= 'CmtGet'
;
|
|
|
283 |
|
oData[
'Cmt'] = i
CmtId;
|
|
|
284 |
|
|
|
|
285 |
|
if (0
== iCmtPar
entId)
|
|
|
286 |
|
$(
'#cmts-box
-' + this.
_iObjId +
'>.cmt-pos
t-reply').
hide();
|
|
|
287 |
|
|
|
|
288 |
|
var eU
l = $('#cm
ts-box-' +
$this._iO
bjId + '>u
l').get();
|
|
|
289 |
|
this._
loading (e
Ul, true);
|
|
|
290 |
|
|
|
|
291 |
|
jQuery
.get (
|
|
|
292 |
|
th
is._sActio
nsUrl,
|
|
|
293 |
|
oD
ata,
|
|
|
294 |
|
fu
nction (s)
|
|
|
295 |
|
{
|
|
|
296 |
|
$this._l
oading (eU
l, false);
|
|
|
297 |
|
if (0 ==
iCmtParen
tId)
|
|
|
298 |
|
{
|
|
|
299 |
|
$('#
cmts-box-'
+ $this._
iObjId + '
>ul>.cmt-n
o').remove
();
|
|
|
300 |
|
|
|
|
301 |
|
if (
$('#cmts-b
ox-' + $th
is._iObjId
+ '>ul>li
.cmt:last'
).length)
|
|
|
302 |
|
$('#cmts-b
ox-' + $th
is._iObjId
+ '>ul>li
.cmt:last'
).after(s)
;
|
|
|
303 |
|
else
|
|
|
304 |
|
$('#cmts-b
ox-' + $th
is._iObjId
+ '>ul').
html(s);
|
|
|
305 |
|
}
|
|
|
306 |
|
else
|
|
|
307 |
|
{
|
|
|
308 |
|
// t
here was n
o comments
and we ad
ded new
|
|
|
309 |
|
if (
$('#cmt' +
iCmtParen
tId + ' >
.cmt-cont
> .cmt-pos
t-reply-to
').length)
|
|
|
310 |
|
{
|
|
|
311 |
|
$('#cmt' +
iCmtParen
tId + ' >
.cmt-cont
> .cmt-pos
t-reply-to
').replace
With($(s).
addClass('
cmts-margi
n'));
|
|
|
312 |
|
}
|
|
|
313 |
|
// t
here was s
ome commen
ts and we
added anot
her one
|
|
|
314 |
|
else
|
|
|
315 |
|
{
|
|
|
316 |
|
$('#cmt' +
iCmtParen
tId + ' >
.cmts > .c
mt-reply-t
o').remove
();
|
|
|
317 |
|
$('#cmt' +
iCmtParen
tId + '>ul
>li:last')
.after(s);
|
|
|
318 |
|
}
|
|
|
319 |
|
}
|
|
|
320 |
|
$this._r
unCountdow
n(iCmtId);
|
|
|
321 |
|
}
|
|
|
322 |
|
);
|
|
|
323 |
|
}
|
|
|
324 |
|
|
|
|
325 |
|
// submit
comment an
d show it
after post
ing
|
|
|
326 |
|
BxDolCmts.
prototype.
submitComm
ent = func
tion (f)
|
|
|
327 |
|
{
|
|
|
328 |
|
var eS
ubmit = $(
f).childre
n().filter
(':submit'
).get();
|
|
|
329 |
|
var $t
his = this
;
|
|
|
330 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
331 |
|
|
|
|
332 |
|
$this.
_err(eSubm
it, false)
; // hide
any errors
before su
bmitting
|
|
|
333 |
|
|
|
|
334 |
|
if (!t
his._getCh
eckElement
s (f, oDat
a)) return
; // get a
nd check f
orm elemen
ts
|
|
|
335 |
|
|
|
|
336 |
|
// sub
mit form
|
|
|
337 |
|
oData[
'action']
= 'CmtPost
';
|
|
|
338 |
|
this._
loading (e
Submit, tr
ue);
|
|
|
339 |
|
jQuery
.post (
|
|
|
340 |
|
th
is._sActio
nsUrl,
|
|
|
341 |
|
oD
ata,
|
|
|
342 |
|
fu
nction (s)
|
|
|
343 |
|
{
|
|
|
344 |
|
$this._l
oading (eS
ubmit, fal
se);
|
|
|
345 |
|
|
|
|
346 |
|
if (!jQu
ery.trim(s
).length)
|
|
|
347 |
|
$thi
s._err(eSu
bmit, true
, $this._s
DefaultErr
Msg); // d
isplay err
or
|
|
|
348 |
|
else
|
|
|
349 |
|
$thi
s._getCmt(
f, oData['
CmtParent'
], parseIn
t(s)); //
display ju
st posted
comment
|
|
|
350 |
|
}
|
|
|
351 |
|
);
|
|
|
352 |
|
}
|
|
|
353 |
|
|
|
|
354 |
|
|
|
|
355 |
|
// update
comment an
d show it
after post
ing
|
|
|
356 |
|
BxDolCmts.
prototype.
updateComm
ent = func
tion (f, i
CmtId)
|
|
|
357 |
|
{
|
|
|
358 |
|
var eS
ubmit = $(
f).childre
n().filter
(':submit'
).get();
|
|
|
359 |
|
var $t
his = this
;
|
|
|
360 |
|
var oD
ata = this
._getDefau
ltActions(
);
|
|
|
361 |
|
|
|
|
362 |
|
$this.
_err(eSubm
it, false)
; // hide
any errors
before su
bmitting
|
|
|
363 |
|
|
|
|
364 |
|
if (!t
his._getCh
eckElement
s (f, oDat
a)) return
; // get a
nd check f
orm elemen
ts
|
|
|
365 |
|
|
|
|
366 |
|
this._
oSavedText
s[iCmtId]
= '';
|
|
|
367 |
|
|
|
|
368 |
|
// sub
mit form
|
|
|
369 |
|
oData[
'action']
= 'CmtEdit
Submit';
|
|
|
370 |
|
oData[
'Cmt'] = i
CmtId;
|
|
|
371 |
|
this._
loading (e
Submit, tr
ue);
|
|
|
372 |
|
jQuery
.post (
|
|
|
373 |
|
th
is._sActio
nsUrl,
|
|
|
374 |
|
oD
ata,
|
|
|
375 |
|
fu
nction (s)
|
|
|
376 |
|
{
|
|
|
377 |
|
$this._l
oading (eS
ubmit, fal
se);
|
|
|
378 |
|
|
|
|
379 |
|
if (!jQu
ery.trim(s
).length)
|
|
|
380 |
|
$thi
s._err(eSu
bmit, true
, $this._s
DefaultErr
Msg); // d
isplay err
or
|
|
|
381 |
|
else
|
|
|
382 |
|
$('#
cmt'+iCmtI
d+'>.cmt-c
ont>.cmt-b
ody').bxdo
lcmtanim('
hide', $th
is._sAnima
tionEffect
, $this._i
AnimationS
peed, func
tion () {
$(this).re
moveClass(
'cmt-post-
reply-expa
nded').htm
l(s).bxdol
cmtanim('s
how', $thi
s._sAnimat
ionEffect,
$this._iA
nimationSp
eed); } );
|
|
|
383 |
|
}
|
|
|
384 |
|
);
|
|
|
385 |
|
}
|
|
|
386 |
|
|
|
|
387 |
|
// toggle
hidden com
ment
|
|
|
388 |
|
BxDolCmts.
prototype.
_toggleHid
den = func
tion (e, i
CmtId)
|
|
|
389 |
|
{
|
|
|
390 |
|
$('#cm
t'+iCmtId+
' > .cmt-c
ont').bxdo
lcmtanim('
toggle', t
his._sAnim
ationEffec
t, this._i
AnimationS
peed);
|
|
|
391 |
|
}
|
|
|
392 |
|
|
|
|
393 |
|
// rate co
mment
|
|
|
394 |
|
BxDolCmts.
prototype.
_rateComme
nt = funct
ion (e, iC
mtId, iRat
e)
|
|
|
395 |
|
{
|
|
|
396 |
|
var $thi
s = this;
|
|
|
397 |
|
var oDat
a = this._
getDefault
Actions();
|
|
|
398 |
|
oData['a
ction'] =
'CmtRate';
|
|
|
399 |
|
oData['C
mt'] = iCm
tId;
|
|
|
400 |
|
oData['R
ate'] = iR
ate;
|
|
|
401 |
|
|
|
|
402 |
|
this._lo
ading (e,
true);
|
|
|
403 |
|
|
|
|
404 |
|
jQuery.g
et (
|
|
|
405 |
|
this
._sActions
Url,
|
|
|
406 |
|
oDat
a,
|
|
|
407 |
|
func
tion (s)
|
|
|
408 |
|
{
|
|
|
409 |
|
$this._loa
ding (e, f
alse);
|
|
|
410 |
|
|
|
|
411 |
|
if (jQuery
.trim(s).l
ength)
|
|
|
412 |
|
{
|
|
|
413 |
|
alert(
s);
|
|
|
414 |
|
}
|
|
|
415 |
|
else
|
|
|
416 |
|
{
|
|
|
417 |
|
e.inne
rHTML = pa
rseInt(e.i
nnerHTML)
+ iRate;
|
|
|
418 |
|
$(e).p
arent().ad
dClass('cm
t-rate-dis
abled');
|
|
|
419 |
|
if (0
> iRate)
|
|
|
420 |
|
$(
'#cmt'+iCm
tId+'>.cmt
-cont').bx
dolcmtanim
('hide', $
this._sAni
mationEffe
ct, $this.
_iAnimatio
nSpeed);
|
|
|
421 |
|
}
|
|
|
422 |
|
}
|
|
|
423 |
|
);
|
|
|
424 |
|
}
|
|
|
425 |
|
|
|
|
426 |
|
// check a
nd get pos
t new comm
ent form e
lements
|
|
|
427 |
|
BxDolCmts.
prototype.
_getCheckE
lements =
function (
f, oData)
|
|
|
428 |
|
{
|
|
|
429 |
|
var $t
his = this
;
|
|
|
430 |
|
var bS
uccess = t
rue;
|
|
|
431 |
|
// che
ck/get for
m elements
|
|
|
432 |
|
jQuery
.each( $(f
).children
().filter(
':input'),
function
()
|
|
|
433 |
|
{
|
|
|
434 |
|
if
(this.nam
e.length &
& $this.oC
mtElements
[this.name
])
|
|
|
435 |
|
{
|
|
|
436 |
|
var isVa
lid = true
;
|
|
|
437 |
|
if ($thi
s.oCmtElem
ents[this.
name]['reg
'])
|
|
|
438 |
|
{
|
|
|
439 |
|
try
{
|
|
|
440 |
|
eval('var
isValid =
this.value
.match(' +
$this.oCm
tElements[
this.name]
['reg'] +
');');
|
|
|
441 |
|
} ca
tch (ex) {
};
|
|
|
442 |
|
}
|
|
|
443 |
|
|
|
|
444 |
|
if (!isV
alid)
|
|
|
445 |
|
{
|
|
|
446 |
|
bSuc
cess = fal
se;
|
|
|
447 |
|
$thi
s._err(thi
s, true, $
this.oCmtE
lements[th
is.name]['
msg']);
|
|
|
448 |
|
}
|
|
|
449 |
|
else
|
|
|
450 |
|
{
|
|
|
451 |
|
$thi
s._err(thi
s, false);
|
|
|
452 |
|
}
|
|
|
453 |
|
oData[th
is.name] =
this.valu
e;
|
|
|
454 |
|
}
|
|
|
455 |
|
});
|
|
|
456 |
|
|
|
|
457 |
|
return
bSuccess;
|
|
|
458 |
|
}
|
|
|
459 |
|
|
|
|
460 |
|
// run cou
ntdown tim
er for jus
t posted c
omments
|
|
|
461 |
|
BxDolCmts.
prototype.
_runCountd
own = func
tion (iCmt
Id)
|
|
|
462 |
|
{
|
|
|
463 |
|
if (th
is._isEdit
Allowed ||
this._isR
emoveAllow
ed || 0 ==
this._iSe
csToEdit)
return;
|
|
|
464 |
|
|
|
|
465 |
|
$('#cm
t-jp-' + i
CmtId + '
span').htm
l(this._iS
ecsToEdit)
;
|
|
|
466 |
|
|
|
|
467 |
|
window
.setTimeou
t(this._sO
bjName + '
.onCountdo
wn(' + iCm
tId + ','
+ this._iS
ecsToEdit
+');', 100
0);
|
|
|
468 |
|
}
|
|
|
469 |
|
|
|
|
470 |
|
BxDolCmts.
prototype.
onCountdow
n = functi
on (iCmtId
, i)
|
|
|
471 |
|
{
|
|
|
472 |
|
var i
= parseInt
($('#cmt-j
p-' + iCmt
Id + ' spa
n').html()
);
|
|
|
473 |
|
if ( 0
== --i)
|
|
|
474 |
|
{
|
|
|
475 |
|
$(
'#cmt-jp-'
+ iCmtId)
.remove();
|
|
|
476 |
|
re
turn;
|
|
|
477 |
|
}
|
|
|
478 |
|
else
|
|
|
479 |
|
{
|
|
|
480 |
|
$(
'#cmt-jp-'
+ iCmtId
+ ' span')
.html(i);
|
|
|
481 |
|
wi
ndow.setTi
meout(this
._sObjName
+ '.onCou
ntdown(' +
iCmtId +
',' + i +'
);', 1000)
;
|
|
|
482 |
|
}
|
|
|
483 |
|
}
|
|
|
484 |
|
|
|
|
485 |
|
// show/hi
de loading
indicator
|
|
|
486 |
|
BxDolCmts.
prototype.
_loading =
function
(e, bShow)
|
|
|
487 |
|
{
|
|
|
488 |
|
if (bS
how && !$(
e).next('b
').length)
|
|
|
489 |
|
$(
e).after('
<b>Loadin
g...</b>')
;
|
|
|
490 |
|
else i
f (!bShow
&& $(e).ne
xt('b').le
ngth)
|
|
|
491 |
|
$(
e).next('b
').remove(
);
|
|
|
492 |
|
}
|
|
|
493 |
|
|
|
|
494 |
|
// show/hi
de error m
essage
|
|
|
495 |
|
BxDolCmts.
prototype.
_err = fun
ction (e,
bShow, s)
|
|
|
496 |
|
{
|
|
|
497 |
|
if (bS
how && !$(
e).next('.
cmt-err').
length)
|
|
|
498 |
|
$(
e).after('
<b class=
"cmt-err">
' + s + '<
/b>');
|
|
|
499 |
|
else i
f (!bShow
&& $(e).ne
xt('.cmt-e
rr').lengt
h)
|
|
|
500 |
|
$(
e).next('.
cmt-err').
remove();
|
|
|
501 |
|
}
|
|
|
502 |
|
|
|
|
503 |
|
// confirm
message
|
|
|
504 |
|
BxDolCmts.
prototype.
_confirm =
function
()
|
|
|
505 |
|
{
|
|
|
506 |
|
return
confirm(t
his._sConf
irmMsg);
|
|
|
507 |
|
}
|
|
|
508 |
|
|
|
|
509 |
|
// standar
t form var
iables
|
|
|
510 |
|
BxDolCmts.
prototype.
_getDefaul
tActions =
function
()
|
|
|
511 |
|
{
|
|
|
512 |
|
return
{
|
|
|
513 |
|
'sys'
: this._sS
ystem,
|
|
|
514 |
|
'id'
: this._iO
bjId
|
|
|
515 |
|
};
|
|
|
516 |
|
}
|