Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
ce8c9c3e
Commit
ce8c9c3e
authored
Mar 27, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style (JavaScript)
parent
ccfca9d5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
299 additions
and
296 deletions
+299
-296
qa-admin.js
qa-content/qa-admin.js
+46
-41
qa-ask.js
qa-content/qa-ask.js
+98
-98
qa-page.js
qa-content/qa-page.js
+47
-44
qa-question.js
qa-content/qa-question.js
+80
-82
qa-user.js
qa-content/qa-user.js
+28
-31
No files found.
qa-content/qa-admin.js
View file @
ce8c9c3e
...
...
@@ -22,14 +22,14 @@
More about this license: http://www.question2answer.org/license.php
*/
var
qa_recalc_running
=
0
;
var
qa_recalc_running
=
0
;
window
.
onbeforeunload
=
function
(
event
)
window
.
onbeforeunload
=
function
(
event
)
{
if
(
qa_recalc_running
>
0
)
{
event
=
event
||
window
.
event
;
var
message
=
qa_warning_recalc
;
event
.
returnValue
=
message
;
if
(
qa_recalc_running
>
0
)
{
event
=
event
||
window
.
event
;
var
message
=
qa_warning_recalc
;
event
.
returnValue
=
message
;
return
message
;
}
};
...
...
@@ -37,17 +37,17 @@ window.onbeforeunload=function(event)
function
qa_recalc_click
(
state
,
elem
,
value
,
noteid
)
{
if
(
elem
.
qa_recalc_running
)
{
elem
.
qa_recalc_stopped
=
true
;
elem
.
qa_recalc_stopped
=
true
;
}
else
{
elem
.
qa_recalc_running
=
true
;
elem
.
qa_recalc_stopped
=
false
;
elem
.
qa_recalc_running
=
true
;
elem
.
qa_recalc_stopped
=
false
;
qa_recalc_running
++
;
document
.
getElementById
(
noteid
).
innerHTML
=
''
;
elem
.
qa_original_value
=
elem
.
value
;
document
.
getElementById
(
noteid
).
innerHTML
=
''
;
elem
.
qa_original_value
=
elem
.
value
;
if
(
value
)
elem
.
value
=
value
;
elem
.
value
=
value
;
qa_recalc_update
(
elem
,
state
,
noteid
);
}
...
...
@@ -57,20 +57,23 @@ function qa_recalc_click(state, elem, value, noteid)
function
qa_recalc_update
(
elem
,
state
,
noteid
)
{
if
(
state
)
qa_ajax_post
(
'recalc'
,
{
state
:
state
,
code
:(
elem
.
form
.
elements
.
code_recalc
?
elem
.
form
.
elements
.
code_recalc
.
value
:
elem
.
form
.
elements
.
code
.
value
)},
if
(
state
)
{
var
recalcCode
=
elem
.
form
.
elements
.
code_recalc
?
elem
.
form
.
elements
.
code_recalc
.
value
:
elem
.
form
.
elements
.
code
.
value
;
qa_ajax_post
(
'recalc'
,
{
state
:
state
,
code
:
recalcCode
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
if
(
lines
[
0
]
==
'1'
)
{
if
(
lines
[
2
])
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
2
];
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
2
];
if
(
elem
.
qa_recalc_stopped
)
qa_recalc_cleanup
(
elem
);
else
qa_recalc_update
(
elem
,
lines
[
1
],
noteid
);
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
qa_recalc_cleanup
(
elem
);
}
else
{
...
...
@@ -79,29 +82,31 @@ function qa_recalc_update(elem, state, noteid)
}
}
);
else
}
else
{
qa_recalc_cleanup
(
elem
);
}
}
function
qa_recalc_cleanup
(
elem
)
{
elem
.
value
=
elem
.
qa_original_value
;
elem
.
qa_recalc_running
=
null
;
elem
.
value
=
elem
.
qa_original_value
;
elem
.
qa_recalc_running
=
null
;
qa_recalc_running
--
;
}
function
qa_mailing_start
(
noteid
,
pauseid
)
{
qa_ajax_post
(
'mailing'
,
{},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
window
.
setTimeout
(
function
()
{
qa_mailing_start
(
noteid
,
pauseid
);
},
1
);
// don't recurse
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
window
.
setTimeout
(
function
()
{
qa_mailing_start
(
noteid
,
pauseid
);
},
1
);
// don't recurse
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
document
.
getElementById
(
pauseid
).
style
.
display
=
'none'
;
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
getElementById
(
noteid
).
innerHTML
=
lines
[
1
];
document
.
getElementById
(
pauseid
).
style
.
display
=
'none'
;
}
else
{
qa_ajax_error
();
...
...
@@ -112,16 +117,16 @@ function qa_mailing_start(noteid, pauseid)
function
qa_admin_click
(
target
)
{
var
p
=
target
.
name
.
split
(
'_'
);
var
p
=
target
.
name
.
split
(
'_'
);
var
params
=
{
entityid
:
p
[
1
],
action
:
p
[
2
]};
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
var
params
=
{
entityid
:
p
[
1
],
action
:
p
[
2
]};
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
qa_ajax_post
(
'click_admin'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
qa_conceal
(
document
.
getElementById
(
'p'
+
p
[
1
]),
'admin'
);
else
if
(
lines
[
0
]
==
'0'
)
{
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
qa_conceal
(
document
.
getElementById
(
'p'
+
p
[
1
]),
'admin'
);
else
if
(
lines
[
0
]
==
'0'
)
{
alert
(
lines
[
1
]);
qa_hide_waiting
(
target
);
}
else
...
...
@@ -136,12 +141,12 @@ function qa_admin_click(target)
function
qa_version_check
(
uri
,
version
,
elem
,
isCore
)
{
var
params
=
{
uri
:
uri
,
version
:
version
,
isCore
:
isCore
};
var
params
=
{
uri
:
uri
,
version
:
version
,
isCore
:
isCore
};
qa_ajax_post
(
'version'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
document
.
getElementById
(
elem
).
innerHTML
=
lines
[
1
];
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
document
.
getElementById
(
elem
).
innerHTML
=
lines
[
1
];
}
);
}
...
...
@@ -150,7 +155,7 @@ function qa_get_enabled_plugins_hashes()
{
var
hashes
=
[];
$
(
'[id^=plugin_enabled]:checked'
).
each
(
function
(
idx
,
elem
)
{
function
(
idx
,
elem
)
{
hashes
.
push
(
elem
.
id
.
replace
(
"plugin_enabled_"
,
""
));
}
);
...
...
qa-content/qa-ask.js
View file @
ce8c9c3e
...
...
@@ -24,20 +24,20 @@
function
qa_title_change
(
value
)
{
qa_ajax_post
(
'asktitle'
,
{
title
:
value
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
qa_ajax_post
(
'asktitle'
,
{
title
:
value
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
if
(
lines
[
1
].
length
)
{
qa_tags_examples
=
lines
[
1
];
qa_tags_examples
=
lines
[
1
];
qa_tag_hints
(
true
);
}
if
(
lines
.
length
>
2
)
{
var
simelem
=
document
.
getElementById
(
'similar'
);
if
(
lines
.
length
>
2
)
{
var
simelem
=
document
.
getElementById
(
'similar'
);
if
(
simelem
)
simelem
.
innerHTML
=
lines
.
slice
(
2
).
join
(
'
\
n'
);
simelem
.
innerHTML
=
lines
.
slice
(
2
).
join
(
'
\
n'
);
}
}
else
if
(
lines
[
0
]
==
'0'
)
}
else
if
(
lines
[
0
]
==
'0'
)
alert
(
lines
[
1
]);
else
qa_ajax_error
();
...
...
@@ -58,23 +58,23 @@ function qa_html_escape(text)
function
qa_tag_click
(
link
)
{
var
elem
=
document
.
getElementById
(
'tags'
);
var
parts
=
qa_tag_typed_parts
(
elem
);
var
elem
=
document
.
getElementById
(
'tags'
);
var
parts
=
qa_tag_typed_parts
(
elem
);
// removes any HTML tags and ampersand
var
tag
=
qa_html_unescape
(
link
.
innerHTML
.
replace
(
/<
[^
>
]
*>/g
,
''
));
var
tag
=
qa_html_unescape
(
link
.
innerHTML
.
replace
(
/<
[^
>
]
*>/g
,
''
));
var
separator
=
qa_tag_onlycomma
?
', '
:
' '
;
var
separator
=
qa_tag_onlycomma
?
', '
:
' '
;
// replace if matches typed, otherwise append
var
newvalue
=
(
parts
.
typed
&&
(
tag
.
toLowerCase
().
indexOf
(
parts
.
typed
.
toLowerCase
())
>=
0
))
?
(
parts
.
before
+
separator
+
tag
+
separator
+
parts
.
after
+
separator
)
:
(
elem
.
value
+
separator
+
tag
+
separator
);
var
newvalue
=
(
parts
.
typed
&&
(
tag
.
toLowerCase
().
indexOf
(
parts
.
typed
.
toLowerCase
())
>=
0
))
?
(
parts
.
before
+
separator
+
tag
+
separator
+
parts
.
after
+
separator
)
:
(
elem
.
value
+
separator
+
tag
+
separator
);
// sanitize and set value
if
(
qa_tag_onlycomma
)
elem
.
value
=
newvalue
.
replace
(
/
[\s
,
]
*,
[\s
,
]
*/g
,
', '
).
replace
(
/^
[\s
,
]
+/g
,
''
);
elem
.
value
=
newvalue
.
replace
(
/
[\s
,
]
*,
[\s
,
]
*/g
,
', '
).
replace
(
/^
[\s
,
]
+/g
,
''
);
else
elem
.
value
=
newvalue
.
replace
(
/
[\s
,
]
+/g
,
' '
).
replace
(
/^
[\s
,
]
+/g
,
''
);
elem
.
value
=
newvalue
.
replace
(
/
[\s
,
]
+/g
,
' '
).
replace
(
/^
[\s
,
]
+/g
,
''
);
elem
.
focus
();
qa_tag_hints
();
...
...
@@ -84,55 +84,55 @@ function qa_tag_click(link)
function
qa_tag_hints
(
skipcomplete
)
{
var
elem
=
document
.
getElementById
(
'tags'
);
var
html
=
''
;
var
completed
=
false
;
var
elem
=
document
.
getElementById
(
'tags'
);
var
html
=
''
;
var
completed
=
false
;
// first try to auto-complete
if
(
qa_tags_complete
&&
!
skipcomplete
)
{
var
parts
=
qa_tag_typed_parts
(
elem
);
var
parts
=
qa_tag_typed_parts
(
elem
);
if
(
parts
.
typed
)
{
html
=
qa_tags_to_html
((
qa_html_unescape
(
qa_tags_examples
+
','
+
qa_tags_complete
)).
split
(
','
),
parts
.
typed
.
toLowerCase
());
completed
=
html
?
true
:
false
;
html
=
qa_tags_to_html
((
qa_html_unescape
(
qa_tags_examples
+
','
+
qa_tags_complete
)).
split
(
','
),
parts
.
typed
.
toLowerCase
());
completed
=
html
?
true
:
false
;
}
}
// otherwise show examples
if
(
qa_tags_examples
&&
!
completed
)
html
=
qa_tags_to_html
((
qa_html_unescape
(
qa_tags_examples
)).
split
(
','
),
null
);
html
=
qa_tags_to_html
((
qa_html_unescape
(
qa_tags_examples
)).
split
(
','
),
null
);
// set title visiblity and hint list
document
.
getElementById
(
'tag_examples_title'
).
style
.
display
=
(
html
&&
!
completed
)
?
''
:
'none'
;
document
.
getElementById
(
'tag_complete_title'
).
style
.
display
=
(
html
&&
completed
)
?
''
:
'none'
;
document
.
getElementById
(
'tag_hints'
).
innerHTML
=
html
;
document
.
getElementById
(
'tag_examples_title'
).
style
.
display
=
(
html
&&
!
completed
)
?
''
:
'none'
;
document
.
getElementById
(
'tag_complete_title'
).
style
.
display
=
(
html
&&
completed
)
?
''
:
'none'
;
document
.
getElementById
(
'tag_hints'
).
innerHTML
=
html
;
}
function
qa_tags_to_html
(
tags
,
matchlc
)
{
var
html
=
''
;
var
added
=
0
;
var
tagseen
=
{};
var
html
=
''
;
var
added
=
0
;
var
tagseen
=
{};
for
(
var
i
=
0
;
i
<
tags
.
length
;
i
++
)
{
var
tag
=
tags
[
i
];
var
taglc
=
tag
.
toLowerCase
();
for
(
var
i
=
0
;
i
<
tags
.
length
;
i
++
)
{
var
tag
=
tags
[
i
];
var
taglc
=
tag
.
toLowerCase
();
if
(
!
tagseen
[
taglc
])
{
tagseen
[
taglc
]
=
true
;
tagseen
[
taglc
]
=
true
;
if
(
(
!
matchlc
)
||
(
taglc
.
indexOf
(
matchlc
)
>=
0
)
)
{
// match if necessary
if
(
(
!
matchlc
)
||
(
taglc
.
indexOf
(
matchlc
)
>=
0
)
)
{
// match if necessary
if
(
matchlc
)
{
// if matching, show appropriate part in bold
var
matchstart
=
taglc
.
indexOf
(
matchlc
);
var
matchend
=
matchstart
+
matchlc
.
length
;
inner
=
'<span style="font-weight:normal;">'
+
qa_html_escape
(
tag
.
substring
(
0
,
matchstart
))
+
'<b>'
+
qa_html_escape
(
tag
.
substring
(
matchstart
,
matchend
))
+
'</b>'
+
qa_html_escape
(
tag
.
substring
(
matchend
))
+
'</span>'
;
var
matchstart
=
taglc
.
indexOf
(
matchlc
);
var
matchend
=
matchstart
+
matchlc
.
length
;
inner
=
'<span style="font-weight:normal;">'
+
qa_html_escape
(
tag
.
substring
(
0
,
matchstart
))
+
'<b>'
+
qa_html_escape
(
tag
.
substring
(
matchstart
,
matchend
))
+
'</b>'
+
qa_html_escape
(
tag
.
substring
(
matchend
))
+
'</span>'
;
}
else
// otherwise show as-is
inner
=
qa_html_escape
(
tag
);
inner
=
qa_html_escape
(
tag
);
html
+=
qa_tag_template
.
replace
(
/
\^
/g
,
inner
.
replace
(
'$'
,
'$$$$'
))
+
' '
;
// replace ^ in template, escape $s
html
+=
qa_tag_template
.
replace
(
/
\^
/g
,
inner
.
replace
(
'$'
,
'$$$$'
))
+
' '
;
// replace ^ in template, escape $s
if
(
++
added
>=
qa_tags_max
)
if
(
++
added
>=
qa_tags_max
)
break
;
}
}
...
...
@@ -145,13 +145,13 @@ function qa_caret_from_end(elem)
{
if
(
document
.
selection
)
{
// for IE
elem
.
focus
();
var
sel
=
document
.
selection
.
createRange
();
var
sel
=
document
.
selection
.
createRange
();
sel
.
moveStart
(
'character'
,
-
elem
.
value
.
length
);
return
elem
.
value
.
length
-
sel
.
text
.
length
;
return
elem
.
value
.
length
-
sel
.
text
.
length
;
}
else
if
(
typeof
(
elem
.
selectionEnd
)
!=
'undefined'
)
// other browsers
return
elem
.
value
.
length
-
elem
.
selectionEnd
;
}
else
if
(
typeof
(
elem
.
selectionEnd
)
!=
'undefined'
)
// other browsers
return
elem
.
value
.
length
-
elem
.
selectionEnd
;
else
// by default return safest value
return
0
;
...
...
@@ -159,91 +159,91 @@ function qa_caret_from_end(elem)
function
qa_tag_typed_parts
(
elem
)
{
var
caret
=
elem
.
value
.
length
-
qa_caret_from_end
(
elem
);
var
active
=
elem
.
value
.
substring
(
0
,
caret
);
var
passive
=
elem
.
value
.
substring
(
active
.
length
);
var
caret
=
elem
.
value
.
length
-
qa_caret_from_end
(
elem
);
var
active
=
elem
.
value
.
substring
(
0
,
caret
);
var
passive
=
elem
.
value
.
substring
(
active
.
length
);
// if the caret is in the middle of a word, move the end of word from passive to active
if
(
active
.
match
(
qa_tag_onlycomma
?
/
[^\s
,
][^
,
]
*$/
:
/
[^\s
,
]
$/
)
&&
(
adjoinmatch
=
passive
.
match
(
qa_tag_onlycomma
?
/^
[^
,
]
*
[^\s
,
][^
,
]
*/
:
/^
[^\s
,
]
+/
))
)
{
active
+=
adjoinmatch
[
0
];
passive
=
elem
.
value
.
substring
(
active
.
length
);
(
adjoinmatch
=
passive
.
match
(
qa_tag_onlycomma
?
/^
[^
,
]
*
[^\s
,
][^
,
]
*/
:
/^
[^\s
,
]
+/
))
)
{
active
+=
adjoinmatch
[
0
];
passive
=
elem
.
value
.
substring
(
active
.
length
);
}
// find what has been typed so far
var
typedmatch
=
active
.
match
(
qa_tag_onlycomma
?
/
[^\s
,
]
+
[^
,
]
*$/
:
/
[^\s
,
]
+$/
)
||
[
''
];
var
typedmatch
=
active
.
match
(
qa_tag_onlycomma
?
/
[^\s
,
]
+
[^
,
]
*$/
:
/
[^\s
,
]
+$/
)
||
[
''
];
return
{
before
:
active
.
substring
(
0
,
active
.
length
-
typedmatch
[
0
].
length
),
after
:
passive
,
typed
:
typedmatch
[
0
]};
return
{
before
:
active
.
substring
(
0
,
active
.
length
-
typedmatch
[
0
].
length
),
after
:
passive
,
typed
:
typedmatch
[
0
]};
}
function
qa_category_select
(
idprefix
,
startpath
)
{
var
startval
=
startpath
?
startpath
.
split
(
"/"
)
:
[];
var
setdescnow
=
true
;
var
startval
=
startpath
?
startpath
.
split
(
"/"
)
:
[];
var
setdescnow
=
true
;
for
(
var
l
=
0
;
l
<=
qa_cat_maxdepth
;
l
++
)
{
var
elem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
);
for
(
var
l
=
0
;
l
<=
qa_cat_maxdepth
;
l
++
)
{
var
elem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
);
if
(
elem
)
{
if
(
l
)
{
if
(
l
<
startval
.
length
&&
startval
[
l
].
length
)
{
var
val
=
startval
[
l
];
if
(
l
<
startval
.
length
&&
startval
[
l
].
length
)
{
var
val
=
startval
[
l
];
for
(
var
j
=
0
;
j
<
elem
.
options
.
length
;
j
++
)
if
(
elem
.
options
[
j
].
value
==
val
)
elem
.
selectedIndex
=
j
;
for
(
var
j
=
0
;
j
<
elem
.
options
.
length
;
j
++
)
if
(
elem
.
options
[
j
].
value
==
val
)
elem
.
selectedIndex
=
j
;
}
else
var
val
=
elem
.
options
[
elem
.
selectedIndex
].
value
;
var
val
=
elem
.
options
[
elem
.
selectedIndex
].
value
;
}
else
val
=
''
;
val
=
''
;
if
(
elem
.
qa_last_sel
!==
val
)
{
elem
.
qa_last_sel
=
val
;
if
(
elem
.
qa_last_sel
!==
val
)
{
elem
.
qa_last_sel
=
val
;
var
subelem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
+
'_sub'
);
var
subelem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
+
'_sub'
);
if
(
subelem
)
subelem
.
parentNode
.
removeChild
(
subelem
);
if
(
val
.
length
||
(
l
==
0
))
{
subelem
=
elem
.
parentNode
.
insertBefore
(
document
.
createElement
(
'span'
),
elem
.
nextSibling
);
subelem
.
id
=
idprefix
+
'_'
+
l
+
'_sub'
;
if
(
val
.
length
||
(
l
==
0
))
{
subelem
=
elem
.
parentNode
.
insertBefore
(
document
.
createElement
(
'span'
),
elem
.
nextSibling
);
subelem
.
id
=
idprefix
+
'_'
+
l
+
'_sub'
;
qa_show_waiting_after
(
subelem
,
true
);
qa_ajax_post
(
'category'
,
{
categoryid
:
val
},
qa_ajax_post
(
'category'
,
{
categoryid
:
val
},
(
function
(
elem
,
l
)
{
return
function
(
lines
)
{
var
subelem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
+
'_sub'
);
var
subelem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
+
'_sub'
);
if
(
subelem
)
subelem
.
parentNode
.
removeChild
(
subelem
);
if
(
lines
[
0
]
==
'1'
)
{
elem
.
qa_cat_desc
=
lines
[
1
];
if
(
lines
[
0
]
==
'1'
)
{
elem
.
qa_cat_desc
=
lines
[
1
];
var
addedoption
=
false
;
var
addedoption
=
false
;
if
(
lines
.
length
>
2
)
{
var
subelem
=
elem
.
parentNode
.
insertBefore
(
document
.
createElement
(
'span'
),
elem
.
nextSibling
);
subelem
.
id
=
idprefix
+
'_'
+
l
+
'_sub'
;
subelem
.
innerHTML
=
' '
;
if
(
lines
.
length
>
2
)
{
var
subelem
=
elem
.
parentNode
.
insertBefore
(
document
.
createElement
(
'span'
),
elem
.
nextSibling
);
subelem
.
id
=
idprefix
+
'_'
+
l
+
'_sub'
;
subelem
.
innerHTML
=
' '
;
var
newelem
=
elem
.
cloneNode
(
false
);
var
newelem
=
elem
.
cloneNode
(
false
);
newelem
.
name
=
newelem
.
id
=
idprefix
+
'_'
+
(
l
+
1
);
newelem
.
options
.
length
=
0
;
newelem
.
name
=
newelem
.
id
=
idprefix
+
'_'
+
(
l
+
1
);
newelem
.
options
.
length
=
0
;
if
(
l
?
qa_cat_allownosub
:
qa_cat_allownone
)
newelem
.
options
[
0
]
=
new
Option
(
l
?
''
:
elem
.
options
[
0
].
text
,
''
,
true
,
true
);
newelem
.
options
[
0
]
=
new
Option
(
l
?
''
:
elem
.
options
[
0
].
text
,
''
,
true
,
true
);
for
(
var
i
=
2
;
i
<
lines
.
length
;
i
++
)
{
var
parts
=
lines
[
i
].
split
(
'/'
);
for
(
var
i
=
2
;
i
<
lines
.
length
;
i
++
)
{
var
parts
=
lines
[
i
].
split
(
'/'
);
if
(
String
(
qa_cat_exclude
).
length
&&
(
String
(
qa_cat_exclude
)
==
parts
[
0
]))
if
(
String
(
qa_cat_exclude
).
length
&&
(
String
(
qa_cat_exclude
)
==
parts
[
0
]))
continue
;
newelem
.
options
[
newelem
.
options
.
length
]
=
new
Option
(
parts
.
slice
(
1
).
join
(
'/'
),
parts
[
0
]);
addedoption
=
true
;
newelem
.
options
[
newelem
.
options
.
length
]
=
new
Option
(
parts
.
slice
(
1
).
join
(
'/'
),
parts
[
0
]);
addedoption
=
true
;
}
if
(
addedoption
)
{
...
...
@@ -252,14 +252,14 @@ function qa_category_select(idprefix, startpath)
}
if
(
l
==
0
)
elem
.
style
.
display
=
'none'
;
if
(
l
==
0
)
elem
.
style
.
display
=
'none'
;
}
if
(
!
addedoption
)
set_category_description
(
idprefix
);
}
else
if
(
lines
[
0
]
==
'0'
)
}
else
if
(
lines
[
0
]
==
'0'
)
alert
(
lines
[
1
]);
else
qa_ajax_error
();
...
...
@@ -267,7 +267,7 @@ function qa_category_select(idprefix, startpath)
})(
elem
,
l
)
);
setdescnow
=
false
;
setdescnow
=
false
;
}
break
;
...
...
@@ -281,18 +281,18 @@ function qa_category_select(idprefix, startpath)
function
set_category_description
(
idprefix
)
{
var
n
=
document
.
getElementById
(
idprefix
+
'_note'
);
var
n
=
document
.
getElementById
(
idprefix
+
'_note'
);
if
(
n
)
{
desc
=
''
;
desc
=
''
;
for
(
var
l
=
1
;
l
<=
qa_cat_maxdepth
;
l
++
)
{
var
elem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
);
for
(
var
l
=
1
;
l
<=
qa_cat_maxdepth
;
l
++
)
{
var
elem
=
document
.
getElementById
(
idprefix
+
'_'
+
l
);
if
(
elem
&&
elem
.
options
[
elem
.
selectedIndex
].
value
.
length
)
desc
=
elem
.
qa_cat_desc
;
desc
=
elem
.
qa_cat_desc
;
}
n
.
innerHTML
=
desc
;
n
.
innerHTML
=
desc
;
}
}
qa-content/qa-page.js
View file @
ce8c9c3e
...
...
@@ -37,14 +37,14 @@ function qa_conceal(elem, type, callback)
function
qa_set_inner_html
(
elem
,
type
,
html
)
{
if
(
elem
)
elem
.
innerHTML
=
html
;
elem
.
innerHTML
=
html
;
}
function
qa_set_outer_html
(
elem
,
type
,
html
)
{
if
(
elem
)
{
var
e
=
document
.
createElement
(
'div'
);
e
.
innerHTML
=
html
;
var
e
=
document
.
createElement
(
'div'
);
e
.
innerHTML
=
html
;
elem
.
parentNode
.
replaceChild
(
e
.
firstChild
,
elem
);
}
}
...
...
@@ -52,58 +52,58 @@ function qa_set_outer_html(elem, type, html)
function
qa_show_waiting_after
(
elem
,
inside
)
{
if
(
elem
&&
!
elem
.
qa_waiting_shown
)
{
var
w
=
document
.
getElementById
(
'qa-waiting-template'
);
var
w
=
document
.
getElementById
(
'qa-waiting-template'
);
if
(
w
)
{
var
c
=
w
.
cloneNode
(
true
);
c
.
id
=
null
;
var
c
=
w
.
cloneNode
(
true
);
c
.
id
=
null
;
if
(
inside
)
elem
.
insertBefore
(
c
,
null
);
else
elem
.
parentNode
.
insertBefore
(
c
,
elem
.
nextSibling
);
elem
.
qa_waiting_shown
=
c
;
elem
.
qa_waiting_shown
=
c
;
}
}
}
function
qa_hide_waiting
(
elem
)
{
var
c
=
elem
.
qa_waiting_shown
;
var
c
=
elem
.
qa_waiting_shown
;
if
(
c
)
{
c
.
parentNode
.
removeChild
(
c
);
elem
.
qa_waiting_shown
=
null
;
elem
.
qa_waiting_shown
=
null
;
}
}
function
qa_vote_click
(
elem
)
{
var
ens
=
elem
.
name
.
split
(
'_'
);
var
postid
=
ens
[
1
];
var
vote
=
parseInt
(
ens
[
2
]);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
var
anchor
=
ens
[
3
];
var
ens
=
elem
.
name
.
split
(
'_'
);
var
postid
=
ens
[
1
];
var
vote
=
parseInt
(
ens
[
2
]);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
var
anchor
=
ens
[
3
];
qa_ajax_post
(
'vote'
,
{
postid
:
postid
,
vote
:
vote
,
code
:
code
},
qa_ajax_post
(
'vote'
,
{
postid
:
postid
,
vote
:
vote
,
code
:
code
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
qa_set_inner_html
(
document
.
getElementById
(
'voting_'
+
postid
),
'voting'
,
lines
.
slice
(
1
).
join
(
"
\
n"
));
if
(
lines
[
0
]
==
'1'
)
{
qa_set_inner_html
(
document
.
getElementById
(
'voting_'
+
postid
),
'voting'
,
lines
.
slice
(
1
).
join
(
"
\
n"
));
}
else
if
(
lines
[
0
]
==
'0'
)
{
var
mess
=
document
.
getElementById
(
'errorbox'
);
}
else
if
(
lines
[
0
]
==
'0'
)
{
var
mess
=
document
.
getElementById
(
'errorbox'
);
if
(
!
mess
)
{
var
mess
=
document
.
createElement
(
'div'
);
mess
.
id
=
'errorbox'
;
mess
.
className
=
'qa-error'
;
mess
.
innerHTML
=
lines
[
1
];
mess
.
style
.
display
=
'none'
;
var
mess
=
document
.
createElement
(
'div'
);
mess
.
id
=
'errorbox'
;
mess
.
className
=
'qa-error'
;
mess
.
innerHTML
=
lines
[
1
];
mess
.
style
.
display
=
'none'
;
}
var
postelem
=
document
.
getElementById
(
anchor
);
var
e
=
postelem
.
parentNode
.
insertBefore
(
mess
,
postelem
);
var
postelem
=
document
.
getElementById
(
anchor
);
var
e
=
postelem
.
parentNode
.
insertBefore
(
mess
,
postelem
);
qa_reveal
(
e
);
}
else
...
...
@@ -116,14 +116,14 @@ function qa_vote_click(elem)
function
qa_notice_click
(
elem
)
{
var
ens
=
elem
.
name
.
split
(
'_'
);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
var
ens
=
elem
.
name
.
split
(
'_'
);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
qa_ajax_post
(
'notice'
,
{
noticeid
:
ens
[
1
],
code
:
code
},
qa_ajax_post
(
'notice'
,
{
noticeid
:
ens
[
1
],
code
:
code
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
qa_conceal
(
document
.
getElementById
(
'notice_'
+
ens
[
1
]),
'notice'
);
else
if
(
lines
[
0
]
==
'0'
)
if
(
lines
[
0
]
==
'1'
)
qa_conceal
(
document
.
getElementById
(
'notice_'
+
ens
[
1
]),
'notice'
);
else
if
(
lines
[
0
]
==
'0'
)
alert
(
lines
[
1
]);
else
qa_ajax_error
();
...
...
@@ -135,14 +135,14 @@ function qa_notice_click(elem)
function
qa_favorite_click
(
elem
)
{
var
ens
=
elem
.
name
.
split
(
'_'
);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
var
ens
=
elem
.
name
.
split
(
'_'
);
var
code
=
elem
.
form
.
elements
.
code
.
value
;
qa_ajax_post
(
'favorite'
,
{
entitytype
:
ens
[
1
],
entityid
:
ens
[
2
],
favorite
:
parseInt
(
ens
[
3
]),
code
:
code
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
qa_ajax_post
(
'favorite'
,
{
entitytype
:
ens
[
1
],
entityid
:
ens
[
2
],
favorite
:
parseInt
(
ens
[
3
]),
code
:
code
},
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
qa_set_inner_html
(
document
.
getElementById
(
'favoriting'
),
'favoriting'
,
lines
.
slice
(
1
).
join
(
"
\
n"
));
else
if
(
lines
[
0
]
==
'0'
)
{
else
if
(
lines
[
0
]
==
'0'
)
{
alert
(
lines
[
1
]);
qa_hide_waiting
(
elem
);
}
else
...
...
@@ -157,18 +157,21 @@ function qa_favorite_click(elem)
function
qa_ajax_post
(
operation
,
params
,
callback
)
{
$
.
extend
(
params
,
{
qa
:
'ajax'
,
qa_operation
:
operation
,
qa_root
:
qa_root
,
qa_request
:
qa_request
});
$
.
extend
(
params
,
{
qa
:
'ajax'
,
qa_operation
:
operation
,
qa_root
:
qa_root
,
qa_request
:
qa_request
});
$
.
post
(
qa_root
,
params
,
function
(
response
)
{
var
header
=
'QA_AJAX_RESPONSE'
;
var
headerpos
=
response
.
indexOf
(
header
);
var
header
=
'QA_AJAX_RESPONSE'
;
var
headerpos
=
response
.
indexOf
(
header
);
if
(
headerpos
>=
0
)
callback
(
response
.
substr
(
headerpos
+
header
.
length
).
replace
(
/^
\s
+/
,
''
).
split
(
"
\
n"
));
if
(
headerpos
>=
0
)
callback
(
response
.
substr
(
headerpos
+
header
.
length
).
replace
(
/^
\s
+/
,
''
).
split
(
"
\
n"
));
else
callback
([]);
},
'text'
).
fail
(
function
(
jqXHR
)
{
if
(
jqXHR
.
readyState
>
0
)
callback
([])
});
},
'text'
).
fail
(
function
(
jqXHR
)
{
if
(
jqXHR
.
readyState
>
0
)
callback
([])
});
}
function
qa_ajax_error
()
...
...
qa-content/qa-question.js
View file @
ce8c9c3e
...
...
@@ -22,18 +22,18 @@
More about this license: http://www.question2answer.org/license.php
*/
var
qa_element_revealed
=
null
;
var
qa_element_revealed
=
null
;
function
qa_toggle_element
(
elem
)
{
var
e
=
elem
?
document
.
getElementById
(
elem
)
:
null
;
var
e
=
elem
?
document
.
getElementById
(
elem
)
:
null
;
if
(
e
&&
e
.
qa_disabled
)
e
=
null
;
e
=
null
;
if
(
e
&&
(
qa_element_revealed
==
e
))
{
if
(
e
&&
(
qa_element_revealed
==
e
))
{
qa_conceal
(
qa_element_revealed
,
'form'
);
qa_element_revealed
=
null
;
qa_element_revealed
=
null
;
}
else
{
if
(
qa_element_revealed
)
...
...
@@ -42,76 +42,74 @@ function qa_toggle_element(elem)
if
(
e
)
{
if
(
e
.
qa_load
&&
!
e
.
qa_loaded
)
{
e
.
qa_load
();
e
.
qa_loaded
=
true
;
e
.
qa_loaded
=
true
;
}
if
(
e
.
qa_show
)
e
.
qa_show
();
qa_reveal
(
e
,
'form'
,
function
()
{
var
t
=
$
(
e
).
offset
().
top
;
var
h
=
$
(
e
).
height
()
+
16
;
var
wt
=
$
(
window
).
scrollTop
();
var
wh
=
$
(
window
).
height
();
var
t
=
$
(
e
).
offset
().
top
;
var
h
=
$
(
e
).
height
()
+
16
;
var
wt
=
$
(
window
).
scrollTop
();
var
wh
=
$
(
window
).
height
();
if
(
(
t
<
wt
)
||
(
t
>
(
wt
+
wh
))
)
if
(
(
t
<
wt
)
||
(
t
>
(
wt
+
wh
))
)
qa_scroll_page_to
(
t
);
else
if
((
t
+
h
)
>
(
wt
+
wh
))
qa_scroll_page_to
(
t
+
h
-
wh
);
else
if
((
t
+
h
)
>
(
wt
+
wh
))
qa_scroll_page_to
(
t
+
h
-
wh
);
if
(
e
.
qa_focus
)
e
.
qa_focus
();
});
}
qa_element_revealed
=
e
;
qa_element_revealed
=
e
;
}
return
!
(
e
||
!
elem
);
// failed to find item
return
!
(
e
||
!
elem
);
// failed to find item
}
function
qa_submit_answer
(
questionid
,
elem
)
{
var
params
=
qa_form_params
(
'a_form'
);
var
params
=
qa_form_params
(
'a_form'
);
params
.
a_questionid
=
questionid
;
params
.
a_questionid
=
questionid
;
qa_ajax_post
(
'answer'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
if
(
lines
[
1
]
<
1
)
{
var
b
=
document
.
getElementById
(
'q_doanswer'
);
if
(
lines
[
0
]
==
'1'
)
{
if
(
lines
[
1
]
<
1
)
{
var
b
=
document
.
getElementById
(
'q_doanswer'
);
if
(
b
)
b
.
style
.
display
=
'none'
;
b
.
style
.
display
=
'none'
;
}
var
t
=
document
.
getElementById
(
'a_list_title'
);
var
t
=
document
.
getElementById
(
'a_list_title'
);
qa_set_inner_html
(
t
,
'a_list_title'
,
lines
[
2
]);
qa_reveal
(
t
,
'a_list_title'
);
var
e
=
document
.
createElement
(
'div'
);
e
.
innerHTML
=
lines
.
slice
(
3
).
join
(
"
\
n"
);
var
e
=
document
.
createElement
(
'div'
);
e
.
innerHTML
=
lines
.
slice
(
3
).
join
(
"
\
n"
);
var
c
=
e
.
firstChild
;
c
.
style
.
display
=
'none'
;
var
c
=
e
.
firstChild
;
c
.
style
.
display
=
'none'
;
var
l
=
document
.
getElementById
(
'a_list'
);
var
l
=
document
.
getElementById
(
'a_list'
);
l
.
insertBefore
(
c
,
l
.
firstChild
);
var
a
=
document
.
getElementById
(
'anew'
);
a
.
qa_disabled
=
true
;
var
a
=
document
.
getElementById
(
'anew'
);
a
.
qa_disabled
=
true
;
qa_reveal
(
c
,
'answer'
);
qa_conceal
(
a
,
'form'
);
}
else
if
(
lines
[
0
]
==
'0'
)
{
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
forms
[
'a_form'
].
submit
();
}
else
{
qa_ajax_error
();
}
}
);
...
...
@@ -122,32 +120,32 @@ function qa_submit_answer(questionid, elem)
function
qa_submit_comment
(
questionid
,
parentid
,
elem
)
{
var
params
=
qa_form_params
(
'c_form_'
+
parentid
);
var
params
=
qa_form_params
(
'c_form_'
+
parentid
);
params
.
c_questionid
=
questionid
;
params
.
c_parentid
=
parentid
;
params
.
c_questionid
=
questionid
;
params
.
c_parentid
=
parentid
;
qa_ajax_post
(
'comment'
,
params
,
function
(
lines
)
{
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
parentid
+
'_list'
);
l
.
innerHTML
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
l
.
style
.
display
=
''
;
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
parentid
+
'_list'
);
l
.
innerHTML
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
l
.
style
.
display
=
''
;
var
a
=
document
.
getElementById
(
'c'
+
parentid
);
a
.
qa_disabled
=
true
;
var
a
=
document
.
getElementById
(
'c'
+
parentid
);
a
.
qa_disabled
=
true
;
var
c
=
document
.
getElementById
(
lines
[
1
]);
// id of comment
var
c
=
document
.
getElementById
(
lines
[
1
]);
// id of comment
if
(
c
)
{
c
.
style
.
display
=
'none'
;
c
.
style
.
display
=
'none'
;
qa_reveal
(
c
,
'comment'
);
}
qa_conceal
(
a
,
'form'
);
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
forms
[
'c_form_'
+
parentid
].
submit
();
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
forms
[
'c_form_'
+
parentid
].
submit
();
}
else
{
qa_ajax_error
();
...
...
@@ -163,20 +161,20 @@ function qa_submit_comment(questionid, parentid, elem)
function
qa_answer_click
(
answerid
,
questionid
,
target
)
{
var
params
=
{};
var
params
=
{};
params
.
answerid
=
answerid
;
params
.
questionid
=
questionid
;
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
params
[
target
.
name
]
=
target
.
value
;
params
.
answerid
=
answerid
;
params
.
questionid
=
questionid
;
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
params
[
target
.
name
]
=
target
.
value
;
qa_ajax_post
(
'click_a'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
qa_set_inner_html
(
document
.
getElementById
(
'a_list_title'
),
'a_list_title'
,
lines
[
1
]);
var
l
=
document
.
getElementById
(
'a'
+
answerid
);
var
h
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
var
l
=
document
.
getElementById
(
'a'
+
answerid
);
var
h
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
if
(
h
.
length
)
qa_set_outer_html
(
l
,
'answer'
,
h
);
...
...
@@ -184,7 +182,7 @@ function qa_answer_click(answerid, questionid, target)
qa_conceal
(
l
,
'answer'
);
}
else
{
target
.
form
.
elements
.
qa_click
.
value
=
target
.
name
;
target
.
form
.
elements
.
qa_click
.
value
=
target
.
name
;
target
.
form
.
submit
();
}
}
...
...
@@ -197,19 +195,19 @@ function qa_answer_click(answerid, questionid, target)
function
qa_comment_click
(
commentid
,
questionid
,
parentid
,
target
)
{
var
params
=
{};
var
params
=
{};
params
.
commentid
=
commentid
;
params
.
questionid
=
questionid
;
params
.
parentid
=
parentid
;
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
params
[
target
.
name
]
=
target
.
value
;
params
.
commentid
=
commentid
;
params
.
questionid
=
questionid
;
params
.
parentid
=
parentid
;
params
.
code
=
target
.
form
.
elements
.
code
.
value
;
params
[
target
.
name
]
=
target
.
value
;
qa_ajax_post
(
'click_c'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
commentid
);
var
h
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
commentid
);
var
h
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
if
(
h
.
length
)
qa_set_outer_html
(
l
,
'comment'
,
h
);
...
...
@@ -217,7 +215,7 @@ function qa_comment_click(commentid, questionid, parentid, target)
qa_conceal
(
l
,
'comment'
);
}
else
{
target
.
form
.
elements
.
qa_click
.
value
=
target
.
name
;
target
.
form
.
elements
.
qa_click
.
value
=
target
.
name
;
target
.
form
.
submit
();
}
}
...
...
@@ -230,17 +228,17 @@ function qa_comment_click(commentid, questionid, parentid, target)
function
qa_show_comments
(
questionid
,
parentid
,
elem
)
{
var
params
=
{};
var
params
=
{};
params
.
c_questionid
=
questionid
;
params
.
c_parentid
=
parentid
;
params
.
c_questionid
=
questionid
;
params
.
c_parentid
=
parentid
;
qa_ajax_post
(
'show_cs'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
parentid
+
'_list'
);
l
.
innerHTML
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
l
.
style
.
display
=
'none'
;
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'c'
+
parentid
+
'_list'
);
l
.
innerHTML
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
l
.
style
.
display
=
'none'
;
qa_reveal
(
l
,
'comments'
);
}
else
{
...
...
@@ -256,15 +254,15 @@ function qa_show_comments(questionid, parentid, elem)
function
qa_form_params
(
formname
)
{
var
es
=
document
.
forms
[
formname
].
elements
;
var
params
=
{};
var
es
=
document
.
forms
[
formname
].
elements
;
var
params
=
{};
for
(
var
i
=
0
;
i
<
es
.
length
;
i
++
)
{
var
e
=
es
[
i
];
var
t
=
(
e
.
type
||
''
).
toLowerCase
();
for
(
var
i
=
0
;
i
<
es
.
length
;
i
++
)
{
var
e
=
es
[
i
];
var
t
=
(
e
.
type
||
''
).
toLowerCase
();
if
(
((
t
!=
'checkbox'
)
&&
(
t
!=
'radio'
))
||
e
.
checked
)
params
[
e
.
name
]
=
e
.
value
;
if
(
((
t
!=
'checkbox'
)
&&
(
t
!=
'radio'
))
||
e
.
checked
)
params
[
e
.
name
]
=
e
.
value
;
}
return
params
;
...
...
qa-content/qa-user.js
View file @
ce8c9c3e
...
...
@@ -24,32 +24,31 @@
function
qa_submit_wall_post
(
elem
,
morelink
)
{
var
params
=
{};
var
params
=
{};
params
.
message
=
document
.
forms
.
wallpost
.
message
.
value
;
params
.
handle
=
document
.
forms
.
wallpost
.
handle
.
value
;
params
.
start
=
document
.
forms
.
wallpost
.
start
.
value
;
params
.
code
=
document
.
forms
.
wallpost
.
code
.
value
;
params
.
morelink
=
morelink
?
1
:
0
;
params
.
message
=
document
.
forms
.
wallpost
.
message
.
value
;
params
.
handle
=
document
.
forms
.
wallpost
.
handle
.
value
;
params
.
start
=
document
.
forms
.
wallpost
.
start
.
value
;
params
.
code
=
document
.
forms
.
wallpost
.
code
.
value
;
params
.
morelink
=
morelink
?
1
:
0
;
qa_ajax_post
(
'wallpost'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'wallmessages'
);
l
.
innerHTML
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'wallmessages'
);
l
.
innerHTML
=
lines
.
slice
(
2
).
join
(
"
\
n"
);
var
c
=
document
.
getElementById
(
lines
[
1
]);
// id of new message
var
c
=
document
.
getElementById
(
lines
[
1
]);
// id of new message
if
(
c
)
{
c
.
style
.
display
=
'none'
;
c
.
style
.
display
=
'none'
;
qa_reveal
(
c
,
'wallpost'
);
}
document
.
forms
.
wallpost
.
message
.
value
=
''
;
document
.
forms
.
wallpost
.
message
.
value
=
''
;
qa_hide_waiting
(
elem
);
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
forms
.
wallpost
.
qa_click
.
value
=
elem
.
name
;
}
else
if
(
lines
[
0
]
==
'0'
)
{
document
.
forms
.
wallpost
.
qa_click
.
value
=
elem
.
name
;
document
.
forms
.
wallpost
.
submit
();
}
else
{
...
...
@@ -63,23 +62,22 @@ function qa_submit_wall_post(elem, morelink)
return
false
;
}
function
qa_wall_post_click
(
messageid
,
target
)
{
var
params
=
{};
var
params
=
{};
params
.
messageid
=
messageid
;
params
.
handle
=
document
.
forms
.
wallpost
.
handle
.
value
;
params
.
start
=
document
.
forms
.
wallpost
.
start
.
value
;
params
.
code
=
document
.
forms
.
wallpost
.
code
.
value
;
params
.
messageid
=
messageid
;
params
.
handle
=
document
.
forms
.
wallpost
.
handle
.
value
;
params
.
start
=
document
.
forms
.
wallpost
.
start
.
value
;
params
.
code
=
document
.
forms
.
wallpost
.
code
.
value
;
params
[
target
.
name
]
=
target
.
value
;
params
[
target
.
name
]
=
target
.
value
;
qa_ajax_post
(
'click_wall'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'm'
+
messageid
);
var
h
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'm'
+
messageid
);
var
h
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
if
(
h
.
length
)
qa_set_outer_html
(
l
,
'wallpost'
,
h
);
...
...
@@ -87,7 +85,7 @@ function qa_wall_post_click(messageid, target)
qa_conceal
(
l
,
'wallpost'
);
}
else
{
document
.
forms
.
wallpost
.
qa_click
.
value
=
target
.
name
;
document
.
forms
.
wallpost
.
qa_click
.
value
=
target
.
name
;
document
.
forms
.
wallpost
.
submit
();
}
}
...
...
@@ -98,7 +96,6 @@ function qa_wall_post_click(messageid, target)
return
false
;
}
function
qa_pm_click
(
messageid
,
target
,
box
)
{
var
params
=
{};
...
...
@@ -112,9 +109,9 @@ function qa_pm_click(messageid, target, box)
params
[
target
.
name
]
=
target
.
value
;
qa_ajax_post
(
'click_pm'
,
params
,
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'm'
+
messageid
);
function
(
lines
)
{
if
(
lines
[
0
]
==
'1'
)
{
var
l
=
document
.
getElementById
(
'm'
+
messageid
);
var
h
=
lines
.
slice
(
1
).
join
(
"
\
n"
);
if
(
h
.
length
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment