Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
808cc385
Commit
808cc385
authored
Jan 28, 2018
by
Seve
Committed by
JC Brand
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor to remove jQuery syntax
parent
093fd7a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
src/converse-spoilers.js
src/converse-spoilers.js
+31
-31
No files found.
src/converse-spoilers.js
View file @
808cc385
...
...
@@ -182,48 +182,48 @@
* Returns:
* The DOM element representing the message.
*/
console
.
log
(
'
These are the attrs and the msg object
\n
'
);
console
.
log
(
attrs
);
let
msg
=
this
.
__super__
.
renderMessage
.
apply
(
this
,
arguments
);
console
.
log
(
msg
);
// const msg_content = $msg[0].querySelector('.chat-msg-content');
//Spoiler logic
if
(
'
spoiler
'
in
attrs
)
{
let
button
=
document
.
createElement
(
"
<button>
"
),
container
=
document
.
createElement
(
"
<div>
"
),
content
=
document
.
createElement
(
"
<div>
"
),
hint
=
document
.
createElement
(
"
<div>
"
),
contentHidden
=
document
.
createElement
(
"
<div>
"
);
console
.
log
(
'
Spoiler in attrs
\n
'
);
let
button
=
document
.
createElement
(
"
button
"
);
let
container
=
document
.
createElement
(
"
div
"
);
let
content
=
document
.
createElement
(
"
div
"
);
let
hint
=
document
.
createElement
(
"
div
"
);
let
contentHidden
=
document
.
createElement
(
"
div
"
);
attrs
.
spoiler
=
attrs
.
spoiler
==
true
?
_
(
'
Spoiler
'
)
:
attrs
.
spoiler
;
hint
.
text
(
attrs
.
spoiler
);
attrs
.
spoiler
=
attrs
.
spoiler
==
true
?
_
(
'
Spoiler
'
)
:
attrs
.
spoiler
;
//Check if attrs.spoiler can be true
hint
.
appendChild
(
document
.
createTextNode
(
attrs
.
spoiler
)
);
contentHidden
.
text
(
text
);
contentHidden
.
addClass
(
"
hidden
"
);
contentHidden
.
addHyperlinks
();
contentHidden
.
addEmoticons
(
_converse
.
visible_toolbar_buttons
.
emoticons
);
container
.
css
(
"
background-color
"
,
"
Lavender
"
);
container
.
css
(
"
text-align
"
,
"
center
"
);
contentHidden
.
appendChild
(
document
.
createTextNode
(
msg
.
message
));
contentHidden
.
classList
.
add
(
"
hidden
"
);
// contentHidden.addHyperlinks();
// contentHidden.addEmoticons(_converse.visible_toolbar_buttons.emoticons);
container
.
style
.
backgroundColor
=
"
Lavender
"
;
container
.
style
.
textAlign
=
"
center
"
;
//Spoiler's content
content
.
addClass
(
"
spoiler-content
"
);
content
.
append
(
hint
);
content
.
append
(
contentHidden
);
content
.
classList
.
add
(
"
spoiler-content
"
);
content
.
appendChild
(
hint
);
content
.
appendChild
(
contentHidden
);
//Spoiler's button
button
.
addClass
(
"
spoiler-button icon-eye
"
);
button
.
attr
(
"
type
"
,
"
button
"
);
button
.
text
(
_
(
'
Show
'
));
button
.
css
(
"
width
"
,
"
100%
"
);
button
.
attr
(
"
closed
"
,
"
true
"
);
container
.
append
(
button
);
container
.
append
(
content
);
button
.
classList
.
add
(
"
spoiler-button
"
);
button
.
classList
.
add
(
"
icon-eye
"
);
button
.
setAttribute
(
"
type
"
,
"
button
"
);
button
.
appendChild
(
document
.
createTextNode
(
_
(
'
Show
'
)));
button
.
style
.
width
=
"
100%
"
;
button
.
setAttribute
(
"
closed
"
,
"
true
"
);
container
.
appendChild
(
button
);
container
.
appendChild
(
content
);
console
.
log
(
'
And this is the container:
\n
'
);
console
.
log
(
container
);
msg
.
append
(
container
);
}
...
...
@@ -231,7 +231,7 @@
}
},
'
ChatBox
'
:
{
'
getMessageAttributes
'
:
function
()
{
'
getMessageAttributes
'
:
function
(
message
,
delay
,
original_stanza
)
{
let
messageAttributes
=
this
.
__super__
.
getMessageAttributes
.
apply
(
this
,
arguments
);
console
.
log
(
arguments
);
//Check if message is spoiler
...
...
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