Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdde93a2c8 | ||
|
|
27704d4e3e | ||
|
|
4171594782 | ||
|
|
4c26a8c2c9 | ||
|
|
9987e443f7 | ||
|
|
5c15ccf340 | ||
|
|
6869a19ea0 | ||
|
|
173674c2a1 | ||
|
|
c451775021 | ||
|
|
09714f3b58 | ||
|
|
d4670d8742 | ||
|
|
fe3ba88887 | ||
|
|
2738967343 | ||
|
|
d5aa447ab8 | ||
|
|
41c6a03e6b | ||
|
|
f1e9aacdf7 | ||
|
|
8520abf676 | ||
|
|
6908e2953f | ||
|
|
136157eb37 | ||
|
|
d367bf58bf | ||
|
|
b510dda006 | ||
|
|
7f3a86596a | ||
|
|
231bfcedd7 | ||
|
|
88f43bc57c | ||
|
|
8bb0da9d87 | ||
|
|
44571c51f0 | ||
|
|
30b6f84b6d | ||
|
|
f7f5744a78 | ||
|
|
0a22ed5e6f | ||
|
|
9afb214360 | ||
|
|
eb4c7a04b0 | ||
|
|
8b5bcbfede |
55 changed files with 4000 additions and 3250 deletions
|
|
@ -11,6 +11,6 @@ trim_trailing_whitespace = true
|
|||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,html,scss,json}]
|
||||
[*.{js,html,scss,json,yml,md}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
|
|
|||
8
.eslintrc
Normal file
8
.eslintrc
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
"extends":
|
||||
- "defaults/configurations/eslint"
|
||||
|
||||
rules:
|
||||
"semi": ["error", "always"]
|
||||
"no-undef": 0
|
||||
"no-console": ["error", { allow: ["warn", "error"] }]
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@ node_modules/
|
|||
build/
|
||||
.sass-cache/
|
||||
config.json
|
||||
.idea/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
language: node_js
|
||||
node_js: node
|
||||
before_install:
|
||||
- gem install sass
|
||||
- npm install -g grunt-cli
|
||||
|
|
|
|||
27
Gruntfile.js
27
Gruntfile.js
|
|
@ -1,24 +1,11 @@
|
|||
module.exports = function (grunt) {
|
||||
grunt.loadNpmTasks("grunt-git-describe")
|
||||
"use strict";
|
||||
|
||||
grunt.initConfig({
|
||||
"git-describe": {
|
||||
options: {},
|
||||
default: {}
|
||||
}
|
||||
})
|
||||
grunt.loadTasks("tasks");
|
||||
|
||||
grunt.registerTask("saveRevision", function() {
|
||||
grunt.event.once("git-describe", function (rev) {
|
||||
grunt.option("gitRevision", rev)
|
||||
})
|
||||
grunt.task.run("git-describe")
|
||||
})
|
||||
|
||||
grunt.loadTasks("tasks")
|
||||
|
||||
grunt.registerTask("default", ["bower-install-simple", "lint", "saveRevision", "copy", "sass", "postcss", "requirejs"])
|
||||
grunt.registerTask("lint", ["eslint"])
|
||||
grunt.registerTask("dev", ["default", "connect:server", "watch"])
|
||||
}
|
||||
grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "inline"]);
|
||||
grunt.registerTask("lint", ["eslint"]);
|
||||
grunt.registerTask("dev", ["bower-install-simple", "lint", "copy", "sass", "requirejs:dev"]);
|
||||
grunt.registerTask("serve", ["dev", "connect:server", "watch"]);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ Just run the following command from the hopglass directory:
|
|||
|
||||
This will generate `build/` containing all required files.
|
||||
|
||||
## Development
|
||||
|
||||
Use `grunt serve` for development.
|
||||
|
||||
# Configure
|
||||
|
||||
Copy `config.json.example` to `build/config.json` and change it to match your community.
|
||||
|
|
|
|||
30
app.js
30
app.js
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
require.config({
|
||||
baseUrl: "lib",
|
||||
paths: {
|
||||
|
|
@ -5,32 +7,24 @@ require.config({
|
|||
"leaflet.label": "../bower_components/Leaflet.label/dist/leaflet.label",
|
||||
"leaflet.providers": "../bower_components/leaflet-providers/leaflet-providers",
|
||||
"chroma-js": "../bower_components/chroma-js/chroma.min",
|
||||
"moment": "../bower_components/moment/min/moment-with-locales.min",
|
||||
"tablesort": "../bower_components/tablesort/tablesort.min",
|
||||
"tablesort.numeric": "../bower_components/tablesort/src/sorts/tablesort.numeric",
|
||||
"moment": "../bower_components/moment/min/moment.min",
|
||||
"moment.de": "../bower_components/moment/locale/de",
|
||||
"tablesort": "../bower_components/tablesort/src/tablesort",
|
||||
"d3": "../bower_components/d3/d3.min",
|
||||
"numeral": "../bower_components/numeraljs/min/numeral.min",
|
||||
"numeral-intl": "../bower_components/numeraljs/min/languages.min",
|
||||
"virtual-dom": "../bower_components/virtual-dom/dist/virtual-dom",
|
||||
"rbush": "../bower_components/rbush/rbush",
|
||||
"helper": "../helper",
|
||||
"jshashes": "../bower_components/jshashes/hashes"
|
||||
"helper": "utils/helper"
|
||||
},
|
||||
shim: {
|
||||
"leaflet.label": ["leaflet"],
|
||||
"leaflet.providers": ["leaflet"],
|
||||
"moment.de": ["moment"],
|
||||
"tablesort": {
|
||||
exports: "Tablesort"
|
||||
},
|
||||
"numeral-intl": {
|
||||
deps: ["numeral"],
|
||||
exports: "numeral"
|
||||
},
|
||||
"tablesort.numeric": ["tablesort"],
|
||||
"helper": ["numeral-intl"]
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
require(["main", "helper"], function (main) {
|
||||
getJSON("config.json").then(main)
|
||||
})
|
||||
require(["main", "helper"], function (main, helper) {
|
||||
helper.getJSON("config.json").then(main);
|
||||
});
|
||||
|
|
|
|||
BIN
assets/icons/fonts/icon.ttf
Normal file
BIN
assets/icons/fonts/icon.ttf
Normal file
Binary file not shown.
BIN
assets/icons/fonts/icon.woff
Normal file
BIN
assets/icons/fonts/icon.woff
Normal file
Binary file not shown.
BIN
assets/icons/fonts/icon.woff2
Normal file
BIN
assets/icons/fonts/icon.woff2
Normal file
Binary file not shown.
96
assets/icons/hopglass-icons.css
Normal file
96
assets/icons/hopglass-icons.css
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
@font-face {
|
||||
font-family: "Ionicons";
|
||||
src: url("fonts/icon.woff2") format("woff2"),
|
||||
url("fonts/icon.woff") format("woff"),
|
||||
url("fonts/icon.ttf") format("truetype");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
[class^="ion-"]:before,
|
||||
[class*=" ion-"]:before, .ion-inside {
|
||||
display: inline-block;
|
||||
font-family: "ionicons" !important;
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
text-rendering: auto;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.ion-android-add:before {
|
||||
content: "\f2c7";
|
||||
}
|
||||
|
||||
.ion-chevron-left:before {
|
||||
content: "\f124";
|
||||
}
|
||||
|
||||
.ion-chevron-right:before {
|
||||
content: "\f125";
|
||||
}
|
||||
|
||||
.ion-pin:before {
|
||||
content: "\f3a3";
|
||||
}
|
||||
|
||||
.ion-wifi:before {
|
||||
content: "\f25c";
|
||||
}
|
||||
|
||||
.ion-eye:before {
|
||||
content: "\f133";
|
||||
}
|
||||
|
||||
.ion-ios-arrow-thin-left:before {
|
||||
content: "\f3d5";
|
||||
}
|
||||
|
||||
.ion-ios-arrow-thin-right:before {
|
||||
content: "\f3d6";
|
||||
}
|
||||
|
||||
.ion-arrow-up-b:before {
|
||||
content: "\f10d";
|
||||
}
|
||||
|
||||
.ion-arrow-down-b:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.ion-android-locate:before {
|
||||
content: "\f2e9";
|
||||
}
|
||||
|
||||
.ion-android-close:before {
|
||||
content: "\f2d7";
|
||||
}
|
||||
|
||||
.ion-android-lock:before {
|
||||
content: "\f392";
|
||||
}
|
||||
|
||||
.ion-ios-copy:before {
|
||||
content: "\f41c";
|
||||
}
|
||||
|
||||
.ion-location:before {
|
||||
content: "\f456";
|
||||
}
|
||||
|
||||
.ion-android-remove:before {
|
||||
content: "\f2f4";
|
||||
}
|
||||
|
||||
.ion-ios-person:before {
|
||||
content: "\f47e";
|
||||
}
|
||||
|
||||
.ion-layer:before {
|
||||
content: "\f229";
|
||||
}
|
||||
30
bower.json
30
bower.json
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "HopGlass",
|
||||
"name": "hopglass",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
|
|
@ -9,23 +9,19 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"Leaflet.label": "~0.2.1",
|
||||
"chroma-js": "~0.6.1",
|
||||
"leaflet": "~0.7.3",
|
||||
"ionicons": "~2.0.1",
|
||||
"moment": "~2.9.0",
|
||||
"requirejs": "~2.1.16",
|
||||
"tablesort": "https://github.com/tristen/tablesort.git#v3.0.2",
|
||||
"chroma-js": "~1.1.1",
|
||||
"leaflet": "~0.7.7",
|
||||
"moment": "~2.13.0",
|
||||
"requirejs": "~2.2.0",
|
||||
"tablesort": "https://github.com/tristen/tablesort.git#v4.0.1",
|
||||
"roboto-slab-fontface": "*",
|
||||
"es6-shim": "~0.27.1",
|
||||
"almond": "~0.3.1",
|
||||
"r.js": "~2.1.16",
|
||||
"d3": "~3.5.5",
|
||||
"numeraljs": "~1.5.3",
|
||||
"roboto-fontface": "~0.3.0",
|
||||
"virtual-dom": "~2.0.1",
|
||||
"leaflet-providers": "~1.0.27",
|
||||
"rbush": "https://github.com/mourner/rbush.git#~1.3.5",
|
||||
"jshashes": "~1.0.5"
|
||||
"es6-shim": "~0.35.1",
|
||||
"almond": "~0.3.2",
|
||||
"d3": "~3.5.17",
|
||||
"roboto-fontface": "~0.4.5",
|
||||
"virtual-dom": "~2.1.1",
|
||||
"leaflet-providers": "~1.1.10",
|
||||
"rbush": "https://github.com/mourner/rbush.git#~1.4.3"
|
||||
},
|
||||
"authors": [
|
||||
"Milan Pässler <me@petabyteboy.de>",
|
||||
|
|
|
|||
9
build.js
9
build.js
|
|
@ -1,9 +0,0 @@
|
|||
({
|
||||
baseUrl: "lib",
|
||||
name: "../bower_components/almond/almond",
|
||||
mainConfigFile: "app.js",
|
||||
include: "../app",
|
||||
wrap: true,
|
||||
optimize: "uglify",
|
||||
out: "app-combined.js"
|
||||
})
|
||||
249
helper.js
249
helper.js
|
|
@ -1,228 +1,241 @@
|
|||
function get(url) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var req = new XMLHttpRequest()
|
||||
req.open('GET', url)
|
||||
return new Promise(function (resolve, reject) {
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', url);
|
||||
|
||||
req.onload = function() {
|
||||
req.onload = function () {
|
||||
if (req.status == 200) {
|
||||
resolve(req.response)
|
||||
resolve(req.response);
|
||||
}
|
||||
else {
|
||||
reject(Error(req.statusText))
|
||||
reject(Error(req.statusText));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
req.onerror = function() {
|
||||
reject(Error("Network Error"))
|
||||
}
|
||||
req.onerror = function () {
|
||||
reject(Error("Network Error"));
|
||||
};
|
||||
|
||||
req.send()
|
||||
})
|
||||
req.send();
|
||||
});
|
||||
}
|
||||
|
||||
function getJSON(url) {
|
||||
return get(url).then(JSON.parse)
|
||||
return get(url).then(JSON.parse);
|
||||
}
|
||||
|
||||
function sortByKey(key, d) {
|
||||
return d.slice().sort( function (a, b) {
|
||||
return a[key] - b[key]
|
||||
}).reverse()
|
||||
return d.slice().sort(function (a, b) {
|
||||
return a[key] - b[key];
|
||||
}).reverse();
|
||||
}
|
||||
|
||||
function limit(key, m, d) {
|
||||
return d.filter( function (d) {
|
||||
return d[key].isAfter(m)
|
||||
})
|
||||
return d.filter(function (d) {
|
||||
return d[key].isAfter(m);
|
||||
});
|
||||
}
|
||||
|
||||
function sum(a) {
|
||||
return a.reduce( function (a, b) {
|
||||
return a + b
|
||||
}, 0)
|
||||
return a.reduce(function (a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
function one() {
|
||||
return 1
|
||||
return 1;
|
||||
}
|
||||
|
||||
function trueDefault(d) {
|
||||
return d === undefined ? true : d
|
||||
return d === undefined ? true : d;
|
||||
}
|
||||
|
||||
function dictGet(dict, key) {
|
||||
var k = key.shift()
|
||||
var k = key.shift();
|
||||
|
||||
if (!(k in dict))
|
||||
return null
|
||||
if (!(k in dict)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (key.length == 0)
|
||||
return dict[k]
|
||||
if (key.length == 0) {
|
||||
return dict[k];
|
||||
}
|
||||
|
||||
return dictGet(dict[k], key)
|
||||
return dictGet(dict[k], key);
|
||||
}
|
||||
|
||||
function localStorageTest() {
|
||||
var test = 'test'
|
||||
var test = 'test';
|
||||
try {
|
||||
localStorage.setItem(test, test)
|
||||
localStorage.removeItem(test)
|
||||
return true
|
||||
} catch(e) {
|
||||
return false
|
||||
localStorage.setItem(test, test);
|
||||
localStorage.removeItem(test);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function listReplace(s, subst) {
|
||||
for (key in subst) {
|
||||
var re = new RegExp(key, 'g')
|
||||
s = s.replace(re, subst[key])
|
||||
var re = new RegExp(key, 'g');
|
||||
s = s.replace(re, subst[key]);
|
||||
}
|
||||
return s
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Helpers working with nodes */
|
||||
|
||||
function offline(d) {
|
||||
return !d.flags.online
|
||||
return !d.flags.online;
|
||||
}
|
||||
|
||||
function online(d) {
|
||||
return d.flags.online
|
||||
return d.flags.online;
|
||||
}
|
||||
|
||||
function has_location(d) {
|
||||
return "location" in d.nodeinfo &&
|
||||
Math.abs(d.nodeinfo.location.latitude) < 90 &&
|
||||
Math.abs(d.nodeinfo.location.longitude) < 180
|
||||
Math.abs(d.nodeinfo.location.latitude) < 90 &&
|
||||
Math.abs(d.nodeinfo.location.longitude) < 180;
|
||||
}
|
||||
|
||||
function subtract(a, b) {
|
||||
var ids = {}
|
||||
var ids = {};
|
||||
|
||||
b.forEach( function (d) {
|
||||
ids[d.nodeinfo.node_id] = true
|
||||
})
|
||||
b.forEach(function (d) {
|
||||
ids[d.nodeinfo.node_id] = true;
|
||||
});
|
||||
|
||||
return a.filter( function (d) {
|
||||
return !(d.nodeinfo.node_id in ids)
|
||||
})
|
||||
return a.filter(function (d) {
|
||||
return !(d.nodeinfo.node_id in ids);
|
||||
});
|
||||
}
|
||||
|
||||
/* Helpers working with links */
|
||||
|
||||
function showDistance(d) {
|
||||
if (isNaN(d.distance))
|
||||
return
|
||||
if (isNaN(d.distance)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return numeral(d.distance).format("0,0") + " m"
|
||||
return d.distance.toFixed(0) + " m"
|
||||
}
|
||||
|
||||
function showTq(d) {
|
||||
return numeral(1/d.tq).format("0%")
|
||||
return (1 / d.tq * 100).toFixed(0) + "%"
|
||||
}
|
||||
|
||||
/* Infobox stuff (XXX: move to module) */
|
||||
|
||||
function attributeEntry(el, label, value) {
|
||||
if (value === null || value == undefined)
|
||||
return
|
||||
|
||||
var tr = document.createElement("tr")
|
||||
var th = document.createElement("th")
|
||||
if (typeof label === "string")
|
||||
th.textContent = label
|
||||
else {
|
||||
th.appendChild(label)
|
||||
tr.className = "routerpic"
|
||||
if (value === null || value == undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
tr.appendChild(th)
|
||||
var tr = document.createElement("tr");
|
||||
var th = document.createElement("th");
|
||||
if (typeof label === "string") {
|
||||
th.textContent = label;
|
||||
} else {
|
||||
th.appendChild(label);
|
||||
tr.className = "routerpic";
|
||||
}
|
||||
|
||||
var td = document.createElement("td")
|
||||
tr.appendChild(th);
|
||||
|
||||
if (typeof value == "function")
|
||||
value(td)
|
||||
else
|
||||
td.appendChild(document.createTextNode(value))
|
||||
var td = document.createElement("td");
|
||||
|
||||
tr.appendChild(td)
|
||||
if (typeof value == "function") {
|
||||
value(td);
|
||||
} else {
|
||||
td.appendChild(document.createTextNode(value));
|
||||
}
|
||||
|
||||
el.appendChild(tr)
|
||||
tr.appendChild(td);
|
||||
|
||||
return td
|
||||
el.appendChild(tr);
|
||||
|
||||
return td;
|
||||
}
|
||||
|
||||
function createIframe(opt, width, height) {
|
||||
el = document.createElement("iframe")
|
||||
width = typeof width !== 'undefined' ? width : '100%'
|
||||
height = typeof height !== 'undefined' ? height : '350px'
|
||||
el = document.createElement("iframe");
|
||||
width = typeof width !== 'undefined' ? width : '100%';
|
||||
height = typeof height !== 'undefined' ? height : '350px';
|
||||
|
||||
if (opt.src)
|
||||
el.src = opt.src
|
||||
else
|
||||
el.src = opt
|
||||
if (opt.src) {
|
||||
el.src = opt.src;
|
||||
} else {
|
||||
el.src = opt;
|
||||
}
|
||||
|
||||
if (opt.frameBorder)
|
||||
el.frameBorder = opt.frameBorder
|
||||
else
|
||||
el.frameBorder = 1
|
||||
if (opt.frameBorder) {
|
||||
el.frameBorder = opt.frameBorder;
|
||||
} else {
|
||||
el.frameBorder = 1;
|
||||
}
|
||||
|
||||
if (opt.width)
|
||||
el.width = opt.width
|
||||
else
|
||||
el.width = width
|
||||
if (opt.width) {
|
||||
el.width = opt.width;
|
||||
} else {
|
||||
el.width = width;
|
||||
}
|
||||
|
||||
if (opt.height)
|
||||
el.height = opt.height
|
||||
else
|
||||
el.height = height
|
||||
if (opt.height) {
|
||||
el.height = opt.height;
|
||||
} else {
|
||||
el.height = height;
|
||||
}
|
||||
|
||||
el.scrolling = "no"
|
||||
el.seamless = "seamless"
|
||||
el.scrolling = "no";
|
||||
el.seamless = "seamless";
|
||||
|
||||
return el
|
||||
return el;
|
||||
}
|
||||
|
||||
function showStat(o, subst) {
|
||||
var content, caption
|
||||
subst = typeof subst !== 'undefined' ? subst : {}
|
||||
var content, caption;
|
||||
subst = typeof subst !== 'undefined' ? subst : {};
|
||||
|
||||
if (o.thumbnail) {
|
||||
content = document.createElement("img")
|
||||
content.src = listReplace(o.thumbnail, subst)
|
||||
content = document.createElement("img");
|
||||
content.src = listReplace(o.thumbnail, subst);
|
||||
}
|
||||
|
||||
if (o.caption) {
|
||||
caption = listReplace(o.caption, subst)
|
||||
caption = listReplace(o.caption, subst);
|
||||
|
||||
if (!content)
|
||||
content = document.createTextNode(caption)
|
||||
if (!content) {
|
||||
content = document.createTextNode(caption);
|
||||
}
|
||||
}
|
||||
|
||||
if (o.iframe) {
|
||||
content = createIframe(o.iframe, o.width, o.height)
|
||||
if (o.iframe.src)
|
||||
content.src = listReplace(o.iframe.src, subst)
|
||||
else
|
||||
content.src = listReplace(o.iframe, subst)
|
||||
content = createIframe(o.iframe, o.width, o.height);
|
||||
if (o.iframe.src) {
|
||||
content.src = listReplace(o.iframe.src, subst);
|
||||
} else {
|
||||
content.src = listReplace(o.iframe, subst);
|
||||
}
|
||||
}
|
||||
|
||||
var p = document.createElement("p")
|
||||
var p = document.createElement("p");
|
||||
|
||||
if (o.href) {
|
||||
var link = document.createElement("a")
|
||||
link.target = "_blank"
|
||||
link.href = listReplace(o.href, subst)
|
||||
link.appendChild(content)
|
||||
var link = document.createElement("a");
|
||||
link.target = "_blank";
|
||||
link.href = listReplace(o.href, subst);
|
||||
link.appendChild(content);
|
||||
|
||||
if (caption && o.thumbnail)
|
||||
link.title = caption
|
||||
if (caption && o.thumbnail) {
|
||||
link.title = caption;
|
||||
}
|
||||
|
||||
p.appendChild(link)
|
||||
} else
|
||||
p.appendChild(content)
|
||||
p.appendChild(link);
|
||||
} else {
|
||||
p.appendChild(content);
|
||||
}
|
||||
|
||||
return p
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="roboto-fontface.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="vendor/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="app.js"></script>
|
||||
<script>
|
||||
console.log("Version: #revision#")
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="hopglass-icons.css?__inline=true">
|
||||
<link rel="stylesheet" href="roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="roboto-fontface.css">
|
||||
<link rel="stylesheet" href="style.css?__inline=true">
|
||||
<script src="vendor/es6-shim/es6-shim.min.js?__inline=true"></script>
|
||||
<script src="app.js"></script>
|
||||
<script>
|
||||
console.log("Version: #revision#");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="loader">
|
||||
<p>
|
||||
Lade<br/>
|
||||
<span class="spinner"></span><br/>
|
||||
Karte & Knoten...
|
||||
</p>
|
||||
<noscript>
|
||||
<strong>JavaScript required</strong>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
38
index.html
38
index.html
|
|
@ -1,17 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="bower_components/roboto-slab-fontface/roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="bower_components/roboto-fontface/roboto-fontface.css">
|
||||
<link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css">
|
||||
<link rel="stylesheet" href="bower_components/Leaflet.label/dist/leaflet.label.css">
|
||||
<link rel="stylesheet" href="bower_components/ionicons/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="bower_components/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="bower_components/requirejs/require.js" data-main="app"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="bower_components/roboto-slab-fontface/roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="bower_components/roboto-fontface/roboto-fontface.css">
|
||||
<link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css">
|
||||
<link rel="stylesheet" href="bower_components/Leaflet.label/dist/leaflet.label.css">
|
||||
<link rel="stylesheet" href="assets/icons/hopglass-icons.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="bower_components/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="bower_components/requirejs/require.js" data-main="app"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="loader">
|
||||
<p>
|
||||
Lade<br/>
|
||||
<span class="spinner"></span><br \>
|
||||
Karte & Knoten...
|
||||
</p>
|
||||
<noscript>
|
||||
<strong>JavaScript required</strong>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
58
lib/about.js
58
lib/about.js
|
|
@ -1,38 +1,40 @@
|
|||
define(function () {
|
||||
return function() {
|
||||
"use strict";
|
||||
|
||||
return function () {
|
||||
this.render = function (d) {
|
||||
var el = document.createElement("div")
|
||||
d.appendChild(el)
|
||||
var s = "<h2>Über HopGlass</h2>"
|
||||
var el = document.createElement("div");
|
||||
d.appendChild(el);
|
||||
var s = "<h2>Über HopGlass</h2>";
|
||||
|
||||
s += "<p>Mit Doppelklick und Shift+Doppelklick kann man in der Karte "
|
||||
s += "auch zoomen.</p>"
|
||||
s += "<p>Mit Doppelklick und Shift+Doppelklick kann man in der Karte ";
|
||||
s += "auch zoomen.</p>";
|
||||
|
||||
s += "<h3>AGPL 3</h3>"
|
||||
s += "<h3>AGPL 3</h3>";
|
||||
|
||||
s += "<p>Copyright (C) Milan Pässler</p>"
|
||||
s += "<p>Copyright (C) Nils Schneider</p>"
|
||||
s += "<p>Copyright (C) Milan Pässler</p>";
|
||||
s += "<p>Copyright (C) Nils Schneider</p>";
|
||||
|
||||
s += "<p>This program is free software: you can redistribute it and/or "
|
||||
s += "modify it under the terms of the GNU Affero General Public "
|
||||
s += "License as published by the Free Software Foundation, either "
|
||||
s += "version 3 of the License, or (at your option) any later version.</p>"
|
||||
s += "<p>This program is free software: you can redistribute it and/or ";
|
||||
s += "modify it under the terms of the GNU Affero General Public ";
|
||||
s += "License as published by the Free Software Foundation, either ";
|
||||
s += "version 3 of the License, or (at your option) any later version.</p>";
|
||||
|
||||
s += "<p>This program is distributed in the hope that it will be useful, "
|
||||
s += "but WITHOUT ANY WARRANTY; without even the implied warranty of "
|
||||
s += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
|
||||
s += "GNU Affero General Public License for more details.</p>"
|
||||
s += "<p>This program is distributed in the hope that it will be useful, ";
|
||||
s += "but WITHOUT ANY WARRANTY; without even the implied warranty of ";
|
||||
s += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ";
|
||||
s += "GNU Affero General Public License for more details.</p>";
|
||||
|
||||
s += "<p>You should have received a copy of the GNU Affero General "
|
||||
s += "Public License along with this program. If not, see "
|
||||
s += "<a href=\"https://www.gnu.org/licenses/\">"
|
||||
s += "https://www.gnu.org/licenses/</a>.</p>"
|
||||
s += "<p>You should have received a copy of the GNU Affero General ";
|
||||
s += "Public License along with this program. If not, see ";
|
||||
s += "<a href=\"https://www.gnu.org/licenses/\">";
|
||||
s += "https://www.gnu.org/licenses/</a>.</p>";
|
||||
|
||||
s += "<p>The source code is available at "
|
||||
s += "<a href=\"https://github.com/plumpudding/hopglass\">"
|
||||
s += "https://github.com/plumpudding/hopglass</a>."
|
||||
s += "<p>The source code is available at ";
|
||||
s += "<a href=\"https://github.com/plumpudding/hopglass\">";
|
||||
s += "https://github.com/plumpudding/hopglass</a>.";
|
||||
|
||||
el.innerHTML = s
|
||||
}
|
||||
}
|
||||
})
|
||||
el.innerHTML = s;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
define([], function () {
|
||||
"use strict";
|
||||
|
||||
return function (tag) {
|
||||
if (!tag)
|
||||
tag = "div"
|
||||
if (!tag) {
|
||||
tag = "div";
|
||||
}
|
||||
|
||||
var self = this
|
||||
var self = this;
|
||||
|
||||
var container = document.createElement(tag)
|
||||
var container = document.createElement(tag);
|
||||
|
||||
self.add = function (d) {
|
||||
d.render(container)
|
||||
}
|
||||
d.render(container);
|
||||
};
|
||||
|
||||
self.render = function (el) {
|
||||
el.appendChild(container)
|
||||
}
|
||||
el.appendChild(container);
|
||||
};
|
||||
|
||||
return self
|
||||
}
|
||||
})
|
||||
return self;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,80 +1,93 @@
|
|||
define(["filters/nodefilter"], function (NodeFilter) {
|
||||
"use strict";
|
||||
|
||||
return function () {
|
||||
var targets = []
|
||||
var filterObservers = []
|
||||
var filters = []
|
||||
var filteredData
|
||||
var data
|
||||
var targets = [];
|
||||
var filterObservers = [];
|
||||
var filters = [];
|
||||
var filteredData;
|
||||
var data;
|
||||
|
||||
function remove(d) {
|
||||
targets = targets.filter( function (e) { return d !== e } )
|
||||
targets = targets.filter(function (e) {
|
||||
return d !== e;
|
||||
});
|
||||
}
|
||||
|
||||
function add(d) {
|
||||
targets.push(d)
|
||||
targets.push(d);
|
||||
|
||||
if (filteredData !== undefined)
|
||||
d.setData(filteredData)
|
||||
}
|
||||
|
||||
function setData(d) {
|
||||
data = d
|
||||
refresh()
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
if (data === undefined)
|
||||
return
|
||||
|
||||
var filter = filters.reduce( function (a, f) {
|
||||
return function (d) {
|
||||
return a(d) && f.run(d)
|
||||
}
|
||||
}, function () { return true })
|
||||
|
||||
filteredData = new NodeFilter(filter)(data)
|
||||
|
||||
targets.forEach( function (t) {
|
||||
t.setData(filteredData)
|
||||
})
|
||||
}
|
||||
|
||||
function notifyObservers() {
|
||||
filterObservers.forEach( function (d) {
|
||||
d.filtersChanged(filters)
|
||||
})
|
||||
}
|
||||
|
||||
function addFilter(d) {
|
||||
filters.push(d)
|
||||
notifyObservers()
|
||||
d.setRefresh(refresh)
|
||||
refresh()
|
||||
}
|
||||
|
||||
function removeFilter(d) {
|
||||
filters = filters.filter( function (e) { return d !== e } )
|
||||
notifyObservers()
|
||||
refresh()
|
||||
}
|
||||
|
||||
function watchFilters(d) {
|
||||
filterObservers.push(d)
|
||||
|
||||
d.filtersChanged(filters)
|
||||
|
||||
return function () {
|
||||
filterObservers = filterObservers.filter( function (e) { return d !== e })
|
||||
if (filteredData !== undefined) {
|
||||
d.setData(filteredData);
|
||||
}
|
||||
}
|
||||
|
||||
return { add: add,
|
||||
remove: remove,
|
||||
setData: setData,
|
||||
addFilter: addFilter,
|
||||
removeFilter: removeFilter,
|
||||
watchFilters: watchFilters,
|
||||
refresh: refresh
|
||||
}
|
||||
}
|
||||
})
|
||||
function setData(d) {
|
||||
data = d;
|
||||
refresh();
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
if (data === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var filter = filters.reduce(function (a, f) {
|
||||
return function (d) {
|
||||
return a(d) && f.run(d);
|
||||
};
|
||||
}, function () {
|
||||
return true;
|
||||
});
|
||||
|
||||
filteredData = new NodeFilter(filter)(data);
|
||||
|
||||
targets.forEach(function (t) {
|
||||
t.setData(filteredData);
|
||||
});
|
||||
}
|
||||
|
||||
function notifyObservers() {
|
||||
filterObservers.forEach(function (d) {
|
||||
d.filtersChanged(filters);
|
||||
});
|
||||
}
|
||||
|
||||
function addFilter(d) {
|
||||
filters.push(d);
|
||||
notifyObservers();
|
||||
d.setRefresh(refresh);
|
||||
refresh();
|
||||
}
|
||||
|
||||
function removeFilter(d) {
|
||||
filters = filters.filter(function (e) {
|
||||
return d !== e;
|
||||
});
|
||||
notifyObservers();
|
||||
refresh();
|
||||
}
|
||||
|
||||
function watchFilters(d) {
|
||||
filterObservers.push(d);
|
||||
|
||||
d.filtersChanged(filters);
|
||||
|
||||
return function () {
|
||||
filterObservers = filterObservers.filter(function (e) {
|
||||
return d !== e;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
add: add,
|
||||
remove: remove,
|
||||
setData: setData,
|
||||
addFilter: addFilter,
|
||||
removeFilter: removeFilter,
|
||||
watchFilters: watchFilters,
|
||||
refresh: refresh
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,40 +1,45 @@
|
|||
define([], function () {
|
||||
define(function () {
|
||||
"use strict";
|
||||
|
||||
return function (distributor) {
|
||||
var container = document.createElement("ul")
|
||||
container.classList.add("filters")
|
||||
var div = document.createElement("div")
|
||||
var container = document.createElement("ul");
|
||||
container.classList.add("filters");
|
||||
var div = document.createElement("div");
|
||||
|
||||
function render(el) {
|
||||
el.appendChild(div)
|
||||
el.appendChild(div);
|
||||
}
|
||||
|
||||
function filtersChanged(filters) {
|
||||
while (container.firstChild)
|
||||
container.removeChild(container.firstChild)
|
||||
while (container.firstChild) {
|
||||
container.removeChild(container.firstChild);
|
||||
}
|
||||
|
||||
filters.forEach( function (d) {
|
||||
var li = document.createElement("li")
|
||||
var div = document.createElement("div")
|
||||
container.appendChild(li)
|
||||
li.appendChild(div)
|
||||
d.render(div)
|
||||
filters.forEach(function (d) {
|
||||
var li = document.createElement("li");
|
||||
var div = document.createElement("div");
|
||||
container.appendChild(li);
|
||||
li.appendChild(div);
|
||||
d.render(div);
|
||||
|
||||
var button = document.createElement("button")
|
||||
button.textContent = ""
|
||||
var button = document.createElement("button");
|
||||
button.textContent = "";
|
||||
button.onclick = function () {
|
||||
distributor.removeFilter(d)
|
||||
}
|
||||
li.appendChild(button)
|
||||
})
|
||||
distributor.removeFilter(d);
|
||||
};
|
||||
li.appendChild(button);
|
||||
});
|
||||
|
||||
if (container.parentNode === div && filters.length === 0)
|
||||
div.removeChild(container)
|
||||
else if (filters.length > 0)
|
||||
div.appendChild(container)
|
||||
if (container.parentNode === div && filters.length === 0) {
|
||||
div.removeChild(container);
|
||||
} else if (filters.length > 0) {
|
||||
div.appendChild(container);
|
||||
}
|
||||
}
|
||||
|
||||
return { render: render,
|
||||
filtersChanged: filtersChanged
|
||||
}
|
||||
}
|
||||
})
|
||||
return {
|
||||
render: render,
|
||||
filtersChanged: filtersChanged
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue