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 @@
...
@@ -182,48 +182,48 @@
* Returns:
* Returns:
* The DOM element representing the message.
* The DOM element representing the message.
*/
*/
console
.
log
(
'
These are the attrs and the msg object
\n
'
);
console
.
log
(
attrs
);
console
.
log
(
attrs
);
let
msg
=
this
.
__super__
.
renderMessage
.
apply
(
this
,
arguments
);
let
msg
=
this
.
__super__
.
renderMessage
.
apply
(
this
,
arguments
);
console
.
log
(
msg
);
console
.
log
(
msg
);
// const msg_content = $msg[0].querySelector('.chat-msg-content');
//Spoiler logic
//Spoiler logic
if
(
'
spoiler
'
in
attrs
)
{
if
(
'
spoiler
'
in
attrs
)
{
let
button
=
document
.
createElement
(
"
<button>
"
),
console
.
log
(
'
Spoiler in attrs
\n
'
);
container
=
document
.
createElement
(
"
<div>
"
),
let
button
=
document
.
createElement
(
"
button
"
);
content
=
document
.
createElement
(
"
<div>
"
),
let
container
=
document
.
createElement
(
"
div
"
);
hint
=
document
.
createElement
(
"
<div>
"
),
let
content
=
document
.
createElement
(
"
div
"
);
contentHidden
=
document
.
createElement
(
"
<div>
"
);
let
hint
=
document
.
createElement
(
"
div
"
);
let
contentHidden
=
document
.
createElement
(
"
div
"
);
attrs
.
spoiler
=
attrs
.
spoiler
==
true
?
_
(
'
Spoiler
'
)
:
attrs
.
spoiler
;
attrs
.
spoiler
=
attrs
.
spoiler
==
true
?
_
(
'
Spoiler
'
)
:
attrs
.
spoiler
;
//Check if attrs.spoiler can be true
hint
.
text
(
attrs
.
spoiler
);
hint
.
appendChild
(
document
.
createTextNode
(
attrs
.
spoiler
)
);
contentHidden
.
text
(
text
);
contentHidden
.
appendChild
(
document
.
createTextNode
(
msg
.
message
));
contentHidden
.
addClass
(
"
hidden
"
);
contentHidden
.
classList
.
add
(
"
hidden
"
);
contentHidden
.
addHyperlinks
();
// contentHidden.addHyperlinks();
contentHidden
.
addEmoticons
(
_converse
.
visible_toolbar_buttons
.
emoticons
);
// contentHidden.addEmoticons(_converse.visible_toolbar_buttons.emoticons);
container
.
css
(
"
background-color
"
,
"
Lavender
"
);
container
.
css
(
"
text-align
"
,
"
center
"
);
container
.
style
.
backgroundColor
=
"
Lavender
"
;
container
.
style
.
textAlign
=
"
center
"
;
//Spoiler's content
//Spoiler's content
content
.
addClass
(
"
spoiler-content
"
);
content
.
classList
.
add
(
"
spoiler-content
"
);
content
.
append
(
hint
);
content
.
appendChild
(
hint
);
content
.
append
(
contentHidden
);
content
.
appendChild
(
contentHidden
);
//Spoiler's button
//Spoiler's button
button
.
addClass
(
"
spoiler-button icon-eye
"
);
button
.
classList
.
add
(
"
spoiler-button
"
);
button
.
attr
(
"
type
"
,
"
button
"
);
button
.
classList
.
add
(
"
icon-eye
"
);
button
.
text
(
_
(
'
Show
'
));
button
.
setAttribute
(
"
type
"
,
"
button
"
);
button
.
css
(
"
width
"
,
"
100%
"
);
button
.
appendChild
(
document
.
createTextNode
(
_
(
'
Show
'
)));
button
.
attr
(
"
closed
"
,
"
true
"
);
button
.
style
.
width
=
"
100%
"
;
button
.
setAttribute
(
"
closed
"
,
"
true
"
);
container
.
append
(
button
);
container
.
append
(
content
);
container
.
appendChild
(
button
);
container
.
appendChild
(
content
);
console
.
log
(
'
And this is the container:
\n
'
);
console
.
log
(
container
);
msg
.
append
(
container
);
msg
.
append
(
container
);
}
}
...
@@ -231,7 +231,7 @@
...
@@ -231,7 +231,7 @@
}
}
},
},
'
ChatBox
'
:
{
'
ChatBox
'
:
{
'
getMessageAttributes
'
:
function
()
{
'
getMessageAttributes
'
:
function
(
message
,
delay
,
original_stanza
)
{
let
messageAttributes
=
this
.
__super__
.
getMessageAttributes
.
apply
(
this
,
arguments
);
let
messageAttributes
=
this
.
__super__
.
getMessageAttributes
.
apply
(
this
,
arguments
);
console
.
log
(
arguments
);
console
.
log
(
arguments
);
//Check if message is spoiler
//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