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
09589150
Commit
09589150
authored
Jul 15, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor slightly to improve readability
parent
f69e39dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
src/converse-register.js
src/converse-register.js
+5
-7
src/utils.js
src/utils.js
+8
-6
No files found.
src/converse-register.js
View file @
09589150
...
...
@@ -269,13 +269,11 @@
renderRegistrationRequest
(
cancel_label
)
{
const
form
=
this
.
el
.
querySelector
(
'
#converse-register
'
);
utils
.
createElementsFromString
(
form
,
tpl_registration_request
({
cancel
:
cancel_label
,
info_message
:
_converse
.
__
(
'
Requesting a registration form from the XMPP server
'
)
})
);
const
markup
=
tpl_registration_request
({
'
cancel
'
:
cancel_label
,
'
info_message
'
:
_converse
.
__
(
'
Requesting a registration form from the XMPP server
'
)
});
form
.
appendChild
(
utils
.
createFragmentFromText
(
markup
));
if
(
!
_converse
.
registration_domain
)
{
const
cancel_button
=
document
.
querySelector
(
'
button.button-cancel
'
);
cancel_button
.
addEventListener
(
'
click
'
,
this
.
cancelRegistration
.
bind
(
this
));
...
...
src/utils.js
View file @
09589150
...
...
@@ -589,18 +589,20 @@
};
};
utils
.
createElementsFromString
=
function
(
element
,
html
)
{
utils
.
createFragmentFromText
=
function
(
markup
)
{
/* Returns a DocumentFragment containing DOM nodes based on the
* passed-in markup text.
*/
// http://stackoverflow.com/questions/9334645/create-node-from-markup-string
var
frag
=
document
.
createDocumentFragment
(),
tmp
=
document
.
createElement
(
'
body
'
),
child
;
tmp
.
innerHTML
=
html
;
// Append elements in a loop to a DocumentFragment, so that the
browser does
//
not re-render the document for each node
tmp
.
innerHTML
=
markup
;
// Append elements in a loop to a DocumentFragment, so that the
//
browser does not re-render the document for each node.
while
(
child
=
tmp
.
firstChild
)
{
// eslint-disable-line no-cond-assign
frag
.
appendChild
(
child
);
}
element
.
appendChild
(
frag
);
// Now, append all elements at once
frag
=
tmp
=
null
;
return
frag
};
utils
.
addEmoji
=
function
(
_converse
,
emojione
,
text
)
{
...
...
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