Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
d1919ba0
Commit
d1919ba0
authored
Feb 21, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor part of code to not use DOM for introspection but already
existing Gadget methods.
parent
485ee200
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
renderjs.js
renderjs.js
+5
-10
No files found.
renderjs.js
View file @
d1919ba0
...
@@ -137,22 +137,17 @@ var RenderJs = (function () {
...
@@ -137,22 +137,17 @@ var RenderJs = (function () {
gadget_js
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
);
gadget_js
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
);
gadget_index
=
RenderJs
.
GadgetIndex
.
getGadgetList
();
gadget_index
=
RenderJs
.
GadgetIndex
.
getGadgetList
();
for
(
i
=
0
;
i
<
gadget_index
.
length
;
i
+=
1
)
{
gadget_index_id
=
gadget_index
[
i
].
id
;
// stop here, if the gadget_id is already on the gadgetIndex
// but not when the gadget on the page has no childNodes
// (because it's back to unenhanced status = page reload)
if
(
gadget_index_id
===
gadget_id
&&
$
(
document
.
getElementById
(
gadget_index_id
)).
children
().
length
>
0
)
{
return
;
}
}
if
(
gadget_js
===
undefined
)
{
if
(
gadget_js
===
undefined
)
{
// register gadget in javascript namespace if not already registered
// register gadget in javascript namespace if not already registered
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
}
}
if
(
gadget_js
.
isReady
())
{
// avoid loading again gadget which was loaded before in same page
return
;
}
// update Gadget's instance with contents of "data-gadget-property"
// update Gadget's instance with contents of "data-gadget-property"
gadget_property
=
gadget
.
attr
(
"
data-gadget-property
"
);
gadget_property
=
gadget
.
attr
(
"
data-gadget-property
"
);
if
(
gadget_property
!==
undefined
)
{
if
(
gadget_property
!==
undefined
)
{
...
...
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