Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
smogonet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dominik Rosiek
smogonet
Commits
c1249436
Commit
c1249436
authored
Jan 03, 2017
by
Antek Grzanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work in progress.
parent
a77d7cda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
22 deletions
+45
-22
index.html
index.html
+45
-22
No files found.
index.html
View file @
c1249436
...
@@ -67,30 +67,53 @@
...
@@ -67,30 +67,53 @@
<script>
<script>
function
getParams
()
{
(
function
(){
var
vars
=
[];
if
(
window
.
location
.
href
.
indexOf
(
'?'
)
!==
-
1
){
var
defaultStation
=
"00000000-0000-0000-0000-000000000001"
;
var
hashes
=
window
.
location
.
href
.
slice
(
window
.
location
.
href
.
indexOf
(
'?'
)
+
1
).
split
(
'&'
)
var
defaultPollution
=
"00000000-0000-0000-0000-000000000001"
;
for
(
var
i
=
0
;
i
<
hashes
.
length
;
i
++
)
{
var
hash
=
hashes
[
i
].
split
(
'='
);
var
possibleCities
=
[
'bialystok'
,
'kielce'
,
'krakow'
,
'kujawskopomorskie'
,
'lublin'
,
'lubuskie'
,
'lodz'
,
'olsztyn'
,
'opole'
,
'poznan'
,
'rzeszow'
,
'szczecin'
,
'slask'
,
'trojmiasto'
,
'warszawa'
,
'wielka_brytania_i_irlandia'
,
'wroclaw'
];
vars
[
hash
[
0
]]
=
hash
[
1
];
var
getParams
=
function
(){
var
vars
=
[];
if
(
window
.
location
.
href
.
indexOf
(
'?'
)
!==
-
1
){
var
hashes
=
window
.
location
.
href
.
slice
(
window
.
location
.
href
.
indexOf
(
'?'
)
+
1
).
split
(
'&'
)
for
(
var
i
=
0
;
i
<
hashes
.
length
;
i
++
)
{
var
hash
=
hashes
[
i
].
split
(
'='
);
vars
[
hash
[
0
]]
=
hash
[
1
];
}
}
}
}
return
vars
;
return
vars
;
};
}
var
getPollution
=
function
(
station
,
pollution
){
document
.
addEventListener
(
'DOMContentLoaded'
,
function
(){
var
xhr
=
new
XMLHttpRequest
();
var
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
function
()
{
parameters
=
getParams
();
if
(
xhr
.
readyState
==
XMLHttpRequest
.
DONE
)
{
console
.
debug
(
parameters
);
updateView
(
filterValues
(
JSON
.
parse
(
xhr
.
response
),
station
,
pollution
));
xhr
.
onreadystatechange
=
function
()
{
}
if
(
xhr
.
readyState
==
XMLHttpRequest
.
DONE
)
{
console
.
debug
(
xhr
);
document
.
getElementById
(
'widget'
).
innerHTML
=
xhr
.
response
;
}
}
xhr
.
open
(
'GET'
,
'view'
,
true
);
xhr
.
send
(
null
);
};
var
filterValues
=
function
(
data
,
station
,
pollution
){
console
.
debug
(
data
,
station
,
pollution
);
};
var
updateView
=
function
(
values
){
console
.
debug
(
"ELO "
+
values
);
};
var
parameters
=
getParams
();
if
(
parameters
[
"local_id"
]){
getPollution
(
parameters
[
"local_id"
],
defaultPollution
);
}
else
if
(
parameters
[
"locals"
]
&&
parameters
[
"locals"
]
===
'krakow'
){
getPollution
(
defaultStation
,
defaultPollution
);
}
}
xhr
.
open
(
'GET'
,
'view'
,
true
);
xhr
.
send
(
null
);
})();
});
</script>
</script>
\ No newline at end of file
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