Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cribjs-editor
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
cribjs-editor
Commits
14bd78bc
Commit
14bd78bc
authored
Jul 17, 2020
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add loading icon when accessing CribData
parent
1126bdac
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
5 deletions
+71
-5
cribjs.css
cribjs.css
+14
-0
cribjs_launcher.js
cribjs_launcher.js
+47
-4
gadget/gadget_cribjs_header.html
gadget/gadget_cribjs_header.html
+4
-0
gadget/gadget_cribjs_header.js
gadget/gadget_cribjs_header.js
+6
-1
No files found.
cribjs.css
View file @
14bd78bc
...
...
@@ -22,3 +22,17 @@ iframe {
background-color
:
#cd0000
;
}
.rotate
{
animation
:
spin
1s
linear
infinite
;
-webkit-animation
:
spin
1s
linear
infinite
;
}
@-webkit-keyframes
spin
{
0
%
{
-webkit-transform
:
rotate
(
0deg
);
}
100
%
{
-webkit-transform
:
rotate
(
360deg
);
}
}
@keyframes
spin
{
0
%
{
transform
:
rotate
(
0deg
);
}
100
%
{
transform
:
rotate
(
360deg
);
}
}
cribjs_launcher.js
View file @
14bd78bc
...
...
@@ -25,9 +25,41 @@
});
}
function
increaseLoadingCounter
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
gadget
.
props
.
loading_counter
+=
1
;
if
(
gadget
.
props
.
loading_counter
===
1
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoading
();
});
}
});
}
function
decreaseLoadingCounter
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
gadget
.
props
.
loading_counter
-=
1
;
if
(
gadget
.
props
.
loading_counter
<
0
)
{
gadget
.
props
.
loading_counter
=
0
;
// throw new Error("Unexpected negative loading counter");
}
if
(
gadget
.
props
.
loading_counter
===
0
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoaded
();
});
}
});
}
function
callCribSWGadget
(
gadget
,
method
,
param_list
)
{
var
called
=
false
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
increaseLoadingCounter
(
gadget
);
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
crib_sw_gadget
"
);
})
...
...
@@ -35,10 +67,20 @@
return
crib_sw_gadget
[
method
].
apply
(
crib_sw_gadget
,
param_list
);
})
.
push
(
function
(
result
)
{
return
result
;
},
function
(
error
)
{
throw
error
;
});
return
decreaseLoadingCounter
(
gadget
)
.
push
(
function
()
{
return
result
;
});
},
function
(
error
)
{
if
(
called
)
{
return
decreaseLoadingCounter
(
gadget
)
.
push
(
function
()
{
throw
error
;
});
}
throw
error
;
});
}
function
route
(
my_root_gadget
,
my_scope
,
my_method
,
my_param_list
)
{
...
...
@@ -169,6 +211,7 @@
g
.
props
=
{};
return
g
.
getElement
()
.
push
(
function
(
element
)
{
g
.
props
.
loading_counter
=
0
;
g
.
props
.
element
=
element
;
g
.
props
.
content_element
=
element
.
querySelector
(
'
.gadget-content
'
);
});
...
...
gadget/gadget_cribjs_header.html
View file @
14bd78bc
...
...
@@ -57,6 +57,10 @@
<li><a
class=
"tools"
href=
"#page=tools"
>
Tools
</a></li>
<li><a
class=
"mass_remove"
href=
"#page=mass_remove"
>
Remove
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li><li><a
class=
"rotate loader"
style=
"font-size: xx-large;"
>
🌀
</a></li>
</ul>
</div>
</div>
</nav>
...
...
gadget/gadget_cribjs_header.js
View file @
14bd78bc
...
...
@@ -36,7 +36,7 @@
.
ready
(
function
(
g
)
{
g
.
props
=
{};
g
.
stats
=
{
loaded
:
fals
e
,
loaded
:
tru
e
,
modified
:
false
,
submitted
:
true
,
error
:
false
,
...
...
@@ -81,6 +81,11 @@
var
gadget
=
this
,
page_list
=
[
"
cribjs_home
"
,
"
url_list
"
,
"
save_load
"
,
"
tools
"
,
"
mass_remove
"
],
promise_list
=
[];
if
(
gadget
.
stats
.
loaded
)
{
gadget
.
props
.
element
.
querySelector
(
"
.loader
"
).
style
.
display
=
"
none
"
;
}
else
{
gadget
.
props
.
element
.
querySelector
(
"
.loader
"
).
style
.
display
=
""
;
}
gadget
.
stats
.
options
=
options
;
page_list
.
forEach
(
function
(
page
)
{
...
...
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