Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
014a877f
Commit
014a877f
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
refactor.
parent
a8a25c44
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/resources/eu/simstadt/regionchooser/website/script/utils.js
+59
-59
...sources/eu/simstadt/regionchooser/website/script/utils.js
with
59 additions
and
59 deletions
+59
-59
src/main/resources/eu/simstadt/regionchooser/website/script/utils.js
+
59
-
59
View file @
014a877f
var
utils
=
{
var
utils
=
{};
groupBy
:
function
(
xs
,
key
)
{
utils
.
groupBy
=
function
(
xs
,
key
)
{
return
xs
.
reduce
(
function
(
rv
,
x
)
{
return
xs
.
reduce
(
function
(
rv
,
x
)
{
(
rv
[
x
[
key
]]
=
rv
[
x
[
key
]]
||
[]).
push
(
x
);
(
rv
[
x
[
key
]]
=
rv
[
x
[
key
]]
||
[]).
push
(
x
);
return
rv
;
return
rv
;
},
{});
},
{});
},
}
// Copies a string to the clipboard. Must be called from within an
// Copies a string to the clipboard. Must be called from within an
// event handler such as click. May return false if it failed, but
// event handler such as click. May return false if it failed, but
// this is not always possible. Browser support for Chrome 43+,
// this is not always possible. Browser support for Chrome 43+,
// Firefox 42+, Safari 10+, Edge and Internet Explorer 10+.
// Firefox 42+, Safari 10+, Edge and Internet Explorer 10+.
// Internet Explorer: The clipboard feature may be disabled by
// Internet Explorer: The clipboard feature may be disabled by
// an administrator. By default a prompt is shown the first
// an administrator. By default a prompt is shown the first
// time the clipboard is used (per session).
// time the clipboard is used (per session).
// https://stackoverflow.com/a/33928558/6419007
// https://stackoverflow.com/a/33928558/6419007
copyToClipboard
:
function
(
text
,
log
)
{
utils
.
copyToClipboard
=
function
(
text
,
log
)
{
if
(
window
.
clipboardData
&&
window
.
clipboardData
.
setData
)
{
if
(
window
.
clipboardData
&&
window
.
clipboardData
.
setData
)
{
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
return
window
.
clipboardData
.
setData
(
"
Text
"
,
text
);
return
window
.
clipboardData
.
setData
(
"
Text
"
,
text
);
...
@@ -38,18 +39,18 @@ var utils = {
...
@@ -38,18 +39,18 @@ var utils = {
document
.
body
.
removeChild
(
textarea
);
document
.
body
.
removeChild
(
textarea
);
}
}
}
}
},
}
read_kml
:
function
(
url
){
utils
.
read_kml
=
function
(
url
){
return
new
ol
.
source
.
KML
({
return
new
ol
.
source
.
KML
({
projection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
),
projection
:
ol
.
proj
.
get
(
'
EPSG:3857
'
),
url
:
url
,
url
:
url
,
extractAttributes
:
false
,
extractAttributes
:
false
,
extractStyles
:
false
extractStyles
:
false
});
});
},
}
polygon_style
:
function
(
color
,
alpha
)
{
utils
.
polygon_style
=
function
(
color
,
alpha
)
{
return
new
ol
.
style
.
Style
({
return
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'
rgba(255, 255, 255,
'
+
alpha
+
'
)
'
color
:
'
rgba(255, 255, 255,
'
+
alpha
+
'
)
'
...
@@ -60,5 +61,4 @@ var utils = {
...
@@ -60,5 +61,4 @@ var utils = {
lineDash
:
[
5
,
10
]
lineDash
:
[
5
,
10
]
}),
}),
});
});
}
}
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment