Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DashboardLeaf
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ProjectLeaf
DashboardLeaf
Commits
27d8fa49
Commit
27d8fa49
authored
4 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed #20 - mobile view (under 650px and in portrait mode)
parent
847cbeed
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/static/js/main.js
+39
-5
39 additions, 5 deletions
src/static/js/main.js
src/templates/page.html
+0
-2
0 additions, 2 deletions
src/templates/page.html
with
39 additions
and
7 deletions
src/static/js/main.js
+
39
−
5
View file @
27d8fa49
...
...
@@ -3,7 +3,8 @@ let options = {
margin
:
'
2vh
'
,
column
:
12
,
disableDrag
:
true
,
disableResize
:
true
disableResize
:
true
,
minWidth
:
650
};
let
grid
=
GridStack
.
init
(
options
);
...
...
@@ -14,27 +15,27 @@ let socket = io.connect(url + '/update');
socket
.
on
(
'
tileUpdate
'
,
function
(
msg
)
{
let
data
=
JSON
.
parse
(
msg
);
let
node
=
document
.
querySelector
(
'
#tile-
'
+
data
[
"
fullName
"
]
+
'
.container
'
);
let
node
=
document
.
querySelector
(
'
#tile-
'
+
data
[
'
fullName
'
]
+
'
.container
'
);
if
(
node
===
null
)
{
return
;
}
if
(
data
[
"
content
"
]
===
null
)
if
(
data
[
'
content
'
]
===
null
)
{
node
.
innerHTML
=
'
<div class="placeholder">❌ Data not yet available</div>
'
;
return
;
}
node
.
innerHTML
=
data
[
"
content
"
];
node
.
innerHTML
=
data
[
'
content
'
];
// scripts have to be added dynamically instead of "innerHTML"
// (otherwise they won't be executed due to browser code injection counter measurements)
let
scriptTags
=
node
.
querySelectorAll
(
'
script
'
);
for
(
script
of
scriptTags
)
{
let
newScript
=
document
.
createElement
(
"
script
"
);
let
newScript
=
document
.
createElement
(
'
script
'
);
let
inlineScript
=
document
.
createTextNode
(
script
.
innerText
);
newScript
.
appendChild
(
inlineScript
);
script
.
parentNode
.
appendChild
(
newScript
);
...
...
@@ -66,3 +67,36 @@ function isMobileDevice()
})(
navigator
.
userAgent
||
navigator
.
vendor
||
window
.
opera
);
return
check
;
}
if
(
isMobileDevice
())
{
onOrientationChange
();
}
function
onOrientationChange
()
{
let
isPortrait
=
document
.
documentElement
.
clientWidth
<
document
.
documentElement
.
clientHeight
;
if
(
isPortrait
)
{
let
viewportElement
=
document
.
getElementById
(
'
viewport
'
);
if
(
viewportElement
===
null
)
{
let
newMeta
=
document
.
createElement
(
'
meta
'
);
newMeta
.
name
=
'
viewport
'
;
newMeta
.
id
=
'
viewport
'
;
newMeta
.
content
=
'
width=device-width, initial-scale=1.0
'
;
document
.
getElementsByTagName
(
'
head
'
)[
0
].
appendChild
(
newMeta
);
}
}
else
{
let
viewportElement
=
document
.
getElementById
(
'
viewport
'
);
if
(
viewportElement
!==
null
)
{
viewportElement
.
remove
();
}
}
grid
.
update
();
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/templates/page.html
+
0
−
2
View file @
27d8fa49
...
...
@@ -11,8 +11,6 @@
<link
type=
"text/css"
rel=
"stylesheet"
href=
"../static/css/libs/weather-icons-wind.min.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"../static/css/libs/gridstack.min.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"../static/css/main.css"
/>
{#
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
#}
</head>
<body>
<div
class=
"grid-stack"
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment