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
26c579e3
Commit
26c579e3
authored
Dec 17, 2017
by
Seve
Committed by
JC Brand
Feb 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start with sending stanza with spoiler
parent
a2b2291e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
45 deletions
+16
-45
src/converse-spoilers.js
src/converse-spoilers.js
+16
-45
No files found.
src/converse-spoilers.js
View file @
26c579e3
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
"
strophe.vcard
"
],
factory
);
define
([
"
converse-core
"
,
"
strophe.vcard
"
,
"
converse-chatview
"
],
factory
);
}(
this
,
function
(
converse
)
{
// Commonly used utilities and variables can be found under the "env"
...
...
@@ -13,6 +13,9 @@
_
=
converse
.
env
.
_
,
moment
=
converse
.
env
.
moment
;
function
isEditSpoilerMessage
()
{
return
document
.
querySelector
(
'
.toggle-spoiler
'
).
getAttribute
(
'
active
'
)
===
'
true
'
;
}
// The following line registers your plugin.
converse
.
plugins
.
add
(
"
converse-spoilers
"
,
{
...
...
@@ -126,10 +129,6 @@
}
function
isEditSpoilerMessage
()
{
return
document
.
querySelector
(
'
.toggle-spoiler
'
).
getAttribute
(
'
active
'
)
===
'
true
'
;
}
function
createHintTextArea
(){
let
hintTextArea
=
document
.
createElement
(
'
input
'
);
hintTextArea
.
setAttribute
(
'
type
'
,
'
text
'
);
...
...
@@ -147,47 +146,19 @@
* the "overrides" namespace.
*/
'
overrides
'
:
{
/* For example, the private *_converse* object has a
* method "onConnected". You can override that method as follows:
*/
'
onConnected
'
:
function
()
{
// Overrides the onConnected method in converse.js
// Top-level functions in "overrides" are bound to the
// inner "_converse" object.
var
_converse
=
this
;
// Your custom code can come here ...
// You can access the original function being overridden
// via the __super__ attribute.
// Make sure to pass on the arguments supplied to this
// function and also to apply the proper "this" object.
_converse
.
__super__
.
onConnected
.
apply
(
this
,
arguments
);
// Your custom code can come here ...
},
/* Override converse.js's XMPPStatus Backbone model so that we can override the
* function that sends out the presence stanza.
*/
'
XMPPStatus
'
:
{
'
sendPresence
'
:
function
(
type
,
status_message
,
jid
)
{
// The "_converse" object is available via the __super__
// attribute.
var
_converse
=
this
.
__super__
.
_converse
;
// Custom code can come here ...
// You can call the original overridden method, by
// accessing it via the __super__ attribute.
// When calling it, you need to apply the proper
// context as reference by the "this" variable.
this
.
__super__
.
sendPresence
.
apply
(
this
,
arguments
);
'
ChatBoxView
'
:
{
'
createMessageStanza
'
:
function
()
{
debugger
;
let
messageStanza
=
this
.
__super__
.
createMessageStanza
.
apply
(
this
,
arguments
);
if
(
isEditSpoilerMessage
())
{
messageStanza
.
c
(
'
spoiler
'
,{
'
xmlns
'
:
'
urn:xmpp:spoiler:0
'
},
_
(
'
Spoiler
'
));
//TODO Check for hint or send __('Spoiler');
}
alert
(
messageStanza
);
return
messageStanza
;
// Custom code can come here ...
}
}
}
});
}));
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