Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Illuna-Minecraft
illuna-minecraft.tk
Commits
f2652351
Commit
f2652351
authored
Jul 27, 2016
by
Milan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace basic logviewer with websocket based one
parent
cacc5bc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
22 deletions
+6
-22
app/views/admin/index.html.erb
app/views/admin/index.html.erb
+6
-22
No files found.
app/views/admin/index.html.erb
View file @
f2652351
<%
if
logged_in?
%>
<%
content_for
:title
,
'Admin'
%>
<style
type=
"text/css"
>
#tail
{
height
:
600px
;
background-color
:
#333333
;
color
:
#fff
;
border-radius
:
4px
;
font-family
:
'Ubuntu Mono Bold'
,
monospace
;}
@font-face
{
font-family
:
'Ubuntu Mono Bold'
;
src
:
url(//assets.illuna-minetest.tk/fonts/ubuntu/UbuntuMono-B.ttf)
format
(
"opentype"
)}
</style>
<h1>
Admin
</h1>
<button
type=
"button"
class=
"btn btn-primary pull-right"
style=
"margin-top:-5rem;"
>
Refresh
</button>
<pre
id=
"tail"
style=
"height:600px;"
>
<%=
@logs
%>
</pre>
<%
content_for
(
:after
)
do
%>
<script>
tailScroll
();
<pre
id=
"tail"
class=
"scroll"
></pre>
function
updateDiv
(){
$
(
'
#tail
'
).
triggerevent
(
function
(){
$
(
'
#tail
'
).
html
(
newContent
);
});
setInterval
(
updateDiv
,
1000
);
}
$
(
"
button
"
).
click
(
function
(
e
)
{
window
.
location
.
reload
(
true
);
});
function
tailScroll
()
{
var
height
=
$
(
"
#tail
"
).
get
(
0
).
scrollHeight
;
$
(
"
#tail
"
).
animate
({
scrollTop
:
height
},
500
);
}
</script>
<%
end
%>
<%
content_for
(
:after
)
do
%>
<script
src=
"https://illuna:1llun4forFun@illuna-minetest.tk/socket/socket.io.js"
></script>
<script>
var
Application
=
function
(){
var
t
=
io
(
"
https://user:password@illuna-minetest.tk
"
,{
path
:
"
/socket/socket.io
"
});
t
.
connect
();
var
o
=
0
;
return
t
.
on
(
"
connect
"
,
function
(){
console
.
log
(
"
Connected to:
"
,
t
.
host
)}),
t
.
on
(
"
message
"
,
function
(
t
){
console
.
log
(
"
Received message:
"
,
t
),
t
.
tail
&&
(
$
(
"
#tail
"
).
html
(
$
(
"
#tail
"
).
html
()
+
t
.
tail
),
o
++
,
$
(
"
#tail
"
).
scrollTop
(
100
*
o
))}),{
socket
:
t
}};
$
(
function
(){
Application
()});
</script>
<%
end
%>
<%
else
%>
<h1>
nope
</h1>
...
...
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