Compare commits
46 changed files with 533 additions and 4598 deletions
|
|
@ -1,16 +0,0 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
charset = utf-8
|
||||
|
||||
# Get rid of whitespace to avoid diffs with a bunch of EOL changes
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{js,html,scss,json}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
10
.travis.yml
10
.travis.yml
|
|
@ -1,7 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "lts/*"
|
||||
- "node"
|
||||
before_install:
|
||||
- gem install sass
|
||||
- npm install -g grunt-cli
|
||||
install:
|
||||
- yarn
|
||||
script: node_modules/.bin/grunt
|
||||
- npm install
|
||||
script: grunt
|
||||
|
|
|
|||
2
Gemfile
Normal file
2
Gemfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
source 'https://rubygems.org'
|
||||
gem "sass"
|
||||
13
Gemfile.lock
Normal file
13
Gemfile.lock
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
sass (3.4.16)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
sass
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
|
|
@ -17,7 +17,7 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.loadTasks("tasks")
|
||||
|
||||
grunt.registerTask("default", ["lint", "saveRevision", "copy", "sass", "postcss", "requirejs"])
|
||||
grunt.registerTask("default", ["bower-install-simple", "lint", "saveRevision", "copy", "sass", "requirejs"])
|
||||
grunt.registerTask("lint", ["eslint"])
|
||||
grunt.registerTask("dev", ["default", "connect:server", "watch"])
|
||||
}
|
||||
|
|
|
|||
74
README.md
74
README.md
|
|
@ -1,8 +1,8 @@
|
|||
[](https://travis-ci.org/hopglass/hopglass)
|
||||
[](https://travis-ci.org/plumpudding/hopglass)
|
||||
|
||||
# HopGlass
|
||||
|
||||
HopGlass is a frontend for the [HopGlass Server](https://github.com/hopglass/hopglass-server).
|
||||
HopGlass is a frontend for the [HopGlass Server](https://github.com/plumpudding/hopglass-server).
|
||||
|
||||
# Screenshots
|
||||
|
||||
|
|
@ -14,32 +14,31 @@ HopGlass is a frontend for the [HopGlass Server](https://github.com/hopglass/hop
|
|||
|
||||
# Dependencies
|
||||
|
||||
- NodeJS
|
||||
- yarn (recommended) or npm
|
||||
- npm
|
||||
- bower
|
||||
- grunt-cli
|
||||
- Sass (>= 3.2)
|
||||
|
||||
# Installing dependencies
|
||||
|
||||
Install npm package-manager. On Debian-like systems run:
|
||||
Install npm and Sass with your package-manager. On Debian-like systems run:
|
||||
|
||||
sudo apt-get install nodejs
|
||||
sudo apt-get install npm ruby-sass
|
||||
|
||||
**Note:** The official Debian packages for NodeJS are quite old, you might want to check at [NodeSource](https://github.com/nodesource/distributions/blob/master/README.md) for current binaries installable with your distribution's package manager.
|
||||
or if you have bundler you can install ruby-sass simply via `bundle install`
|
||||
|
||||
On Mac you can install nodejs and yarn via brew:
|
||||
On Mac you have to install only npm via brew and sass
|
||||
|
||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew install node
|
||||
brew install yarn
|
||||
|
||||
On Arch Linux you can install nodejs and yarn via pacman:
|
||||
|
||||
sudo pacman -S nodejs yarn
|
||||
|
||||
sudo gem install sass
|
||||
|
||||
Execute these commands on your server as a normal user to prepare the dependencies:
|
||||
|
||||
git clone https://github.com/hopglass/hopglass
|
||||
git clone https://github.com/plumpudding/hopglass
|
||||
cd hopglass
|
||||
yarn install # or `npm install`
|
||||
npm install
|
||||
npm install grunt-cli
|
||||
|
||||
# Building
|
||||
|
||||
|
|
@ -55,7 +54,7 @@ Copy `config.json.example` to `build/config.json` and change it to match your co
|
|||
|
||||
## dataPath (string/array)
|
||||
|
||||
`dataPath` can be either a string containing the address of a [HopGlass Server](https://github.com/hopglass/hopglass-server) or an array containing multiple addresses.
|
||||
`dataPath` can be either a string containing the address of a [HopGlass Server](https://github.com/plumpudding/hopglass-server) or an array containing multiple addresses.
|
||||
Don't forget the trailing slash!
|
||||
Also, proxying the data through a webserver will allow GZip and thus will greatly reduce bandwidth consumption.
|
||||
It may help with firewall problems too.
|
||||
|
|
@ -85,25 +84,9 @@ property and optionally `url` and `config` properties. If no `url` is supplied
|
|||
`name` is assumed to name a
|
||||
[Leaflet-provider](http://leaflet-extras.github.io/leaflet-providers/preview/).
|
||||
|
||||
## fixedCenter (array, optional)
|
||||
|
||||
This option allows to fix the map at one specific coordinate depending on following case-sensitive parameters:
|
||||
|
||||
- `lat` latitude of the center point
|
||||
- `lng` longitude of the center point
|
||||
- `radius` visible radius around the center in km
|
||||
|
||||
Examples for `fixedCenter`:
|
||||
|
||||
"fixedCenter": {
|
||||
"lat": 50.80,
|
||||
"lng": 12.07,
|
||||
"radius": 30
|
||||
}
|
||||
|
||||
## nodeInfos (array, optional)
|
||||
|
||||
This option allows to show node statistics depending on following case-sensitive parameters:
|
||||
This option allows to show client statistics depending on following case-sensitive parameters:
|
||||
|
||||
- `name` caption of statistics segment in infobox
|
||||
- `href` absolute or relative URL to statistics image
|
||||
|
|
@ -120,12 +103,12 @@ Examples for `nodeInfos`:
|
|||
|
||||
{ "name": "Clientstatistik",
|
||||
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
||||
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=1&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}",
|
||||
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=1&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}"
|
||||
"caption": "Knoten {NODE_ID}"
|
||||
},
|
||||
{ "name": "Uptime",
|
||||
"href": "stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
||||
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=2&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}",
|
||||
"thumbnail": "stats/render/dashboard-solo/db/node-byid?panelId=2&fullscreen&theme=light&width=600&height=300&var-nodeid={NODE_ID}"
|
||||
"caption": "Knoten {NODE_ID}"
|
||||
}
|
||||
]
|
||||
|
|
@ -154,25 +137,6 @@ Examples for `globalInfos` using Grafana server rendering:
|
|||
}
|
||||
]
|
||||
|
||||
## linkInfos (array, optional)
|
||||
|
||||
This option allows to show link statistics depending on the following case-sensitive parameters:
|
||||
|
||||
- `name` caption of statistics segment in infobox
|
||||
- `href` absolute or relative URL to statistics image
|
||||
- `thumbnail` absolute or relative URL to thumbnail image,
|
||||
can be the same like `href`
|
||||
- `caption` is shown, if `thumbnail` is not present (no thumbnail in infobox)
|
||||
|
||||
To insert the source or target node-id in either `href`, `thumbnail` or `caption`
|
||||
you can use the case-sensitive template strings `{SOURCE}` and `{TARGET}`.
|
||||
|
||||
"linkInfos": [
|
||||
{ "href": "stats/dashboard/db/links?var-source={SOURCE}&var-target={TARGET}",
|
||||
"thumbnail": "stats/render/dashboard-solo/db/links?panelId=1&fullscreen&theme=light&width=800&height=600&var-source={SOURCE}&var-target={TARGET}"
|
||||
}
|
||||
]
|
||||
|
||||
## siteNames (array, optional)
|
||||
|
||||
In this array name definitions for site statistics and node info can be saved. This requires one object for each site code. This object must contain:
|
||||
|
|
|
|||
26
app.js
26
app.js
|
|
@ -1,20 +1,20 @@
|
|||
require.config({
|
||||
baseUrl: "lib",
|
||||
paths: {
|
||||
"leaflet": "../node_modules/leaflet/dist/leaflet",
|
||||
"leaflet.label": "../node_modules/leaflet-label/dist/leaflet.label",
|
||||
"leaflet.providers": "../node_modules/leaflet-providers/leaflet-providers",
|
||||
"chroma-js": "../node_modules/chroma-js/chroma.min",
|
||||
"moment": "../node_modules/moment/min/moment-with-locales.min",
|
||||
"tablesort": "../node_modules/tablesort/tablesort.min",
|
||||
"tablesort.numeric": "../node_modules/tablesort/src/sorts/tablesort.numeric",
|
||||
"d3": "../node_modules/d3/d3.min",
|
||||
"numeral": "../node_modules/numeraljs/min/numeral.min",
|
||||
"numeral-intl": "../node_modules/numeraljs/min/languages.min",
|
||||
"virtual-dom": "../node_modules/virtual-dom/dist/virtual-dom",
|
||||
"rbush": "../node_modules/rbush/rbush",
|
||||
"leaflet": "../bower_components/leaflet/dist/leaflet",
|
||||
"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",
|
||||
"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": "../node_modules/jshashes/hashes"
|
||||
"jshashes": "../bower_components/jshashes/hashes"
|
||||
},
|
||||
shim: {
|
||||
"leaflet.label": ["leaflet"],
|
||||
|
|
|
|||
36
bower.json
Normal file
36
bower.json
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "HopGlass",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"**/.*",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"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",
|
||||
"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"
|
||||
},
|
||||
"authors": [
|
||||
"Milan Pässler <me@petabyteboy.de>",
|
||||
"Nils Schneider <nils@nilsschneider.net>"
|
||||
],
|
||||
"license": "AGPL3",
|
||||
"private": true
|
||||
}
|
||||
2
build.js
2
build.js
|
|
@ -1,6 +1,6 @@
|
|||
({
|
||||
baseUrl: "lib",
|
||||
name: "../node_modules/almond/almond",
|
||||
name: "../bower_components/almond/almond",
|
||||
mainConfigFile: "app.js",
|
||||
include: "../app",
|
||||
wrap: true,
|
||||
|
|
|
|||
|
|
@ -1,62 +1,27 @@
|
|||
{
|
||||
"dataPath": "https://map.ffdus.de/data/",
|
||||
"siteName": "Freifunk Flingern",
|
||||
"dataPath": "https://map.luebeck.freifunk.net/data/",
|
||||
"siteName": "Freifunk Lübeck",
|
||||
"mapSigmaScale": 0.5,
|
||||
"showContact": true,
|
||||
"showContact": true,
|
||||
"maxAge": 14,
|
||||
"mapLayers": [
|
||||
{ "name": "CartoDB",
|
||||
"url": "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
|
||||
{ "name": "MapQuest",
|
||||
"url": "https://otile{s}-s.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg",
|
||||
"config": {
|
||||
"maxZoom": 18,
|
||||
"attribution": "© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, © | <a href=\"https://carto.com/attribution\">CARTO</a>"
|
||||
"subdomains": "1234",
|
||||
"type": "osm",
|
||||
"attribution": "Tiles © <a href=\"https://www.mapquest.com/\" target=\"_blank\">MapQuest</a>, Data CC-BY-SA OpenStreetMap",
|
||||
"maxZoom": 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenStreetMap.HOT"
|
||||
},
|
||||
{
|
||||
"name": "Luftbilder NRW",
|
||||
"url": "https://www.wms.nrw.de/geobasis/wms_nw_dop?",
|
||||
"config": {
|
||||
"maxZoom": 20,
|
||||
"attribution": "<a href=\"http://www.bezreg-koeln.nrw.de/brk_internet/geobasis/luftbilderzeugnisse/digitale_orthophotos/index.html\">DOP20</a>, Land NRW (2017), Datenlizenz Deutschland - Namensnennung - Version 2.0 (<a href=\"https://www.govdata.de/dl-de/by-2-0\">www.govdata.de/dl-de/by-2-0</a>)",
|
||||
"format": "image/jpeg",
|
||||
"layers": "nw_dop_rgb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"nodeInfos": [
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/node-byid?panelId=1&theme=light&width=600&height=300&var-nodeid={NODE_ID}"
|
||||
},
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/node-byid?panelId=2&theme=light&width=600&height=500&var-nodeid={NODE_ID}"
|
||||
},
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/node-byid?var-nodeid={NODE_ID}",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/node-byid?panelId=3&theme=light&width=600&height=200&var-nodeid={NODE_ID}"
|
||||
}
|
||||
],
|
||||
"globalInfos": [
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/global?var-job=dus",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/global?panelId=1&&theme=light&width=800&height=600&var-job=dus"
|
||||
},
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/global?var-job=dus",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/global?panelId=8&&theme=light&width=800&height=600&var-job=dus"
|
||||
}
|
||||
],
|
||||
"linkInfos": [
|
||||
{ "href": "https://map.eulenfunk.de/stats/dashboard/db/links?var-source={SOURCE}&var-target={TARGET}",
|
||||
"thumbnail": "https://map.eulenfunk.de/stats/render/dashboard-solo/db/links?panelId=1&&theme=light&width=800&height=600&var-source={SOURCE}&var-target={TARGET}"
|
||||
"name": "Stamen.TonerLite"
|
||||
}
|
||||
],
|
||||
"siteNames": [
|
||||
{ "site": "dus", "name": "Flingern" }
|
||||
],
|
||||
"hwImg": [
|
||||
{ "thumbnail": "https://cdn.rawgit.com/Moorviper/meshviewer_hwpics/master/nodes/{MODELHASH}.svg",
|
||||
"caption": "Knoten {MODELHASH}"
|
||||
}
|
||||
{ "site": "ffhl", "name": "Lübeck" },
|
||||
{ "site": "ffeh", "name": "Entenhausen" },
|
||||
{ "site": "ffgt", "name": "Gothamcity" },
|
||||
{ "site": "ffal", "name": "Atlantis" }
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
108
helper.js
108
helper.js
|
|
@ -1,23 +1,23 @@
|
|||
function get(url) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var req = new XMLHttpRequest()
|
||||
req.open('GET', url)
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('GET', url);
|
||||
|
||||
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"))
|
||||
}
|
||||
reject(Error("Network Error"));
|
||||
};
|
||||
|
||||
req.send()
|
||||
})
|
||||
req.send();
|
||||
});
|
||||
}
|
||||
|
||||
function getJSON(url) {
|
||||
|
|
@ -73,14 +73,6 @@ function localStorageTest() {
|
|||
}
|
||||
}
|
||||
|
||||
function listReplace(s, subst) {
|
||||
for (key in subst) {
|
||||
var re = new RegExp(key, 'g')
|
||||
s = s.replace(re, subst[key])
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
/* Helpers working with nodes */
|
||||
|
||||
function offline(d) {
|
||||
|
|
@ -130,13 +122,7 @@ function attributeEntry(el, label, value) {
|
|||
|
||||
var tr = document.createElement("tr")
|
||||
var th = document.createElement("th")
|
||||
if (typeof label === "string")
|
||||
th.textContent = label
|
||||
else {
|
||||
th.appendChild(label)
|
||||
tr.className = "routerpic"
|
||||
}
|
||||
|
||||
th.textContent = label
|
||||
tr.appendChild(th)
|
||||
|
||||
var td = document.createElement("td")
|
||||
|
|
@ -152,77 +138,3 @@ function attributeEntry(el, label, value) {
|
|||
|
||||
return td
|
||||
}
|
||||
|
||||
function createIframe(opt, width, height) {
|
||||
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.frameBorder)
|
||||
el.frameBorder = opt.frameBorder
|
||||
else
|
||||
el.frameBorder = 1
|
||||
|
||||
if (opt.width)
|
||||
el.width = opt.width
|
||||
else
|
||||
el.width = width
|
||||
|
||||
if (opt.height)
|
||||
el.height = opt.height
|
||||
else
|
||||
el.height = height
|
||||
|
||||
el.scrolling = "no"
|
||||
el.seamless = "seamless"
|
||||
|
||||
return el
|
||||
}
|
||||
|
||||
function showStat(o, subst) {
|
||||
var content, caption
|
||||
subst = typeof subst !== 'undefined' ? subst : {}
|
||||
|
||||
if (o.thumbnail) {
|
||||
content = document.createElement("img")
|
||||
content.src = listReplace(o.thumbnail, subst)
|
||||
}
|
||||
|
||||
if (o.caption) {
|
||||
caption = listReplace(o.caption, subst)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
if (caption && o.thumbnail)
|
||||
link.title = caption
|
||||
|
||||
p.appendChild(link)
|
||||
} else
|
||||
p.appendChild(content)
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
<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="css/roboto-slab/roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="css/roboto/roboto-fontface.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>
|
||||
|
|
@ -14,15 +14,5 @@
|
|||
</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>
|
||||
|
|
|
|||
14
index.html
14
index.html
|
|
@ -3,14 +3,14 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="node_modules/roboto-fontface/css/roboto-slab/roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="node_modules/roboto-fontface/css/roboto/roboto-fontface.css">
|
||||
<link rel="stylesheet" href="node_modules/leaflet/dist/leaflet.css">
|
||||
<link rel="stylesheet" href="node_modules/leaflet-label/dist/leaflet.label.css">
|
||||
<link rel="stylesheet" href="node_modules/ionicons/css/ionicons.min.css">
|
||||
<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="node_modules/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="node_modules/requirejs/require.js" data-main="app"></script>
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ define(function () {
|
|||
s += "https://www.gnu.org/licenses/</a>.</p>"
|
||||
|
||||
s += "<p>The source code is available at "
|
||||
s += "<a href=\"https://github.com/hopglass/hopglass\">"
|
||||
s += "https://github.com/hopglass/hopglass</a>."
|
||||
s += "<a href=\"https://github.com/plumpudding/hopglass\">"
|
||||
s += "https://github.com/plumpudding/hopglass</a>."
|
||||
|
||||
el.innerHTML = s
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,18 +4,18 @@ define([], function () {
|
|||
var n = Object.create(data)
|
||||
n.nodes = {}
|
||||
|
||||
for (var key in data.nodes)
|
||||
for (var key in data.nodes) {
|
||||
n.nodes[key] = data.nodes[key].filter(filter)
|
||||
}
|
||||
|
||||
var filteredIds = new Set()
|
||||
|
||||
n.graph = {}
|
||||
n.graph.nodes = data.graph.nodes.filter( function (d) {
|
||||
var r
|
||||
if (d.node)
|
||||
r = filter(d.node)
|
||||
else
|
||||
r = filter({})
|
||||
if (!d.node)
|
||||
return true
|
||||
|
||||
var r = filter(d.node)
|
||||
|
||||
if (r)
|
||||
filteredIds.add(d.id)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
define(["d3"], function (d3) {
|
||||
var margin = 200
|
||||
var NODE_RADIUS = 15
|
||||
var LINE_RADIUS = 7
|
||||
var LINE_RADIUS = 12
|
||||
|
||||
return function (config, linkScale, sidebar, router) {
|
||||
var self = this
|
||||
|
|
@ -19,7 +19,6 @@ define(["d3"], function (d3) {
|
|||
var nodes = []
|
||||
var uplinkNodes = []
|
||||
var nonUplinkNodes = []
|
||||
var unseenNodes = []
|
||||
var unknownNodes = []
|
||||
var savedPanZoom
|
||||
|
||||
|
|
@ -214,7 +213,7 @@ define(["d3"], function (d3) {
|
|||
|
||||
function drawLabel(d) {
|
||||
var neighbours = d.neighbours.filter(function (d) {
|
||||
return !d.link.o.isVPN
|
||||
return d.link.o.type !== "VPN"
|
||||
})
|
||||
|
||||
var sum = neighbours.reduce(function (a, b) {
|
||||
|
|
@ -242,8 +241,7 @@ define(["d3"], function (d3) {
|
|||
}
|
||||
|
||||
function visibleLinks(d) {
|
||||
return (d.o.isVPN ||
|
||||
d.source.x > screenRect.left && d.source.x < screenRect.right &&
|
||||
return (d.source.x > screenRect.left && d.source.x < screenRect.right &&
|
||||
d.source.y > screenRect.top && d.source.y < screenRect.bottom) ||
|
||||
(d.target.x > screenRect.left && d.target.x < screenRect.right &&
|
||||
d.target.y > screenRect.top && d.target.y < screenRect.bottom)
|
||||
|
|
@ -315,7 +313,6 @@ define(["d3"], function (d3) {
|
|||
var unknownColor = "#D10E2A"
|
||||
var nonUplinkColor = "#F2E3C6"
|
||||
var uplinkColor = "#5BAAEB"
|
||||
var unseenColor = "#FFA726"
|
||||
var highlightColor = "rgba(252, 227, 198, 0.15)"
|
||||
var nodeRadius = 6
|
||||
var cableColor = "#50B0F0"
|
||||
|
|
@ -325,19 +322,16 @@ define(["d3"], function (d3) {
|
|||
links.forEach(function (d) {
|
||||
var dx = d.target.x - d.source.x
|
||||
var dy = d.target.y - d.source.y
|
||||
var a = Math.sqrt(dx * dx + dy * dy) * 2
|
||||
var a = Math.sqrt(dx * dx + dy * dy)
|
||||
dx /= a
|
||||
dy /= a
|
||||
|
||||
var distancex = d.target.x - d.source.x - (10 * dx)
|
||||
var distancey = d.target.y - d.source.y - (10 * dy)
|
||||
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(d.source.x + dx * nodeRadius, d.source.y + dy * nodeRadius)
|
||||
ctx.lineTo(d.target.x - (distancex / 2) - dx * nodeRadius, d.target.y - (distancey / 2) - dy * nodeRadius)
|
||||
ctx.lineTo(d.target.x - dx * nodeRadius, d.target.y - dy * nodeRadius)
|
||||
ctx.strokeStyle = d.o.type === "Kabel" ? cableColor : d.color
|
||||
ctx.globalAlpha = d.o.isVPN ? 0.1 : 0.8
|
||||
ctx.lineWidth = d.o.isVPN ? 1.5 : 2.5
|
||||
ctx.globalAlpha = d.o.type === "VPN" ? 0.1 : 0.8
|
||||
ctx.lineWidth = d.o.type === "VPN" ? 1.5 : 2.5
|
||||
ctx.stroke()
|
||||
})
|
||||
|
||||
|
|
@ -370,42 +364,36 @@ define(["d3"], function (d3) {
|
|||
ctx.drawImage(uplinkNode, scale * r * d.x - uplinkNode.width / 2, scale * r * d.y - uplinkNode.height / 2)
|
||||
})
|
||||
|
||||
var unseenNode = drawNode(unseenColor, nodeRadius, scale, r)
|
||||
unseenNodes.filter(visibleNodes).forEach(function (d) {
|
||||
ctx.drawImage(unseenNode, scale * r * d.x - unseenNode.width / 2, scale * r * d.y - unseenNode.height / 2)
|
||||
})
|
||||
|
||||
ctx.restore()
|
||||
|
||||
// -- draw clients --
|
||||
ctx.save()
|
||||
ctx.beginPath()
|
||||
if (scale > 0.9)
|
||||
nodes.filter(visibleNodes).forEach(function (d) {
|
||||
var clients = d.o.node.statistics.clients
|
||||
if (clients === 0)
|
||||
return
|
||||
nodes.filter(visibleNodes).forEach(function (d) {
|
||||
var clients = d.o.node.statistics.clients
|
||||
if (clients === 0)
|
||||
return
|
||||
|
||||
var startDistance = 16
|
||||
var radius = 3
|
||||
var a = 1.2
|
||||
var startAngle = Math.PI
|
||||
var startDistance = 16
|
||||
var radius = 3
|
||||
var a = 1.2
|
||||
var startAngle = Math.PI
|
||||
|
||||
for (var orbit = 0, i = 0; i < clients; orbit++) {
|
||||
var distance = startDistance + orbit * 2 * radius * a
|
||||
var n = Math.floor((Math.PI * distance) / (a * radius))
|
||||
var delta = clients - i
|
||||
for (var orbit = 0, i = 0; i < clients; orbit++) {
|
||||
var distance = startDistance + orbit * 2 * radius * a
|
||||
var n = Math.floor((Math.PI * distance) / (a * radius))
|
||||
var delta = clients - i
|
||||
|
||||
for (var j = 0; j < Math.min(delta, n); i++, j++) {
|
||||
var angle = 2 * Math.PI / n * j
|
||||
var x = d.x + distance * Math.cos(angle + startAngle)
|
||||
var y = d.y + distance * Math.sin(angle + startAngle)
|
||||
for (var j = 0; j < Math.min(delta, n); i++, j++) {
|
||||
var angle = 2 * Math.PI / n * j
|
||||
var x = d.x + distance * Math.cos(angle + startAngle)
|
||||
var y = d.y + distance * Math.sin(angle + startAngle)
|
||||
|
||||
ctx.moveTo(x, y)
|
||||
ctx.arc(x, y, radius, 0, 2 * Math.PI)
|
||||
}
|
||||
ctx.moveTo(x, y)
|
||||
ctx.arc(x, y, radius, 0, 2 * Math.PI)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
ctx.fillStyle = clientColor
|
||||
ctx.fill()
|
||||
|
|
@ -475,34 +463,32 @@ define(["d3"], function (d3) {
|
|||
requestAnimationFrame(redraw)
|
||||
}
|
||||
|
||||
function distance(ax, ay, bx, by) {
|
||||
return Math.pow(ax - bx, 2) + Math.pow(ay - by, 2)
|
||||
function distance(a, b) {
|
||||
return Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2)
|
||||
}
|
||||
|
||||
function distancePoint(a, b) {
|
||||
return Math.sqrt(distance(a.x, a.y, b.x, b.y))
|
||||
return Math.sqrt(distance(a, b))
|
||||
}
|
||||
|
||||
function distanceLink(p, a, b) {
|
||||
/* http://stackoverflow.com/questions/849211 */
|
||||
|
||||
var bx = b.x - ((b.x - a.x) / 2)
|
||||
var by = b.y - ((b.y - a.y) / 2)
|
||||
|
||||
var l2 = distance(a.x, a.y, bx, by)
|
||||
var l2 = distance(a, b)
|
||||
|
||||
if (l2 === 0)
|
||||
return distance(p.x, p.y, a.x, a.y)
|
||||
return distance(p, a)
|
||||
|
||||
var t = ((p.x - a.x) * (bx - a.x) + (p.y - a.y) * (by - a.y)) / l2
|
||||
var t = ((p.x - a.x) * (b.x - a.x) + (p.y - a.y) * (b.y - a.y)) / l2
|
||||
|
||||
if (t < 0)
|
||||
return distance(p.x, p.y, a.x, a.y)
|
||||
return distance(p, a)
|
||||
|
||||
if (t > 1)
|
||||
return distance(p.x, p.y, bx, by)
|
||||
return distance(p, b)
|
||||
|
||||
return Math.sqrt(distance(p.x, p.y, a.x + t * (bx - a.x), a.y + t * (by - a.y) ))
|
||||
return Math.sqrt(distance(p, { x: a.x + t * (b.x - a.x),
|
||||
y: a.y + t * (b.y - a.y) }))
|
||||
}
|
||||
|
||||
function translateXY(d) {
|
||||
|
|
@ -530,7 +516,7 @@ define(["d3"], function (d3) {
|
|||
}
|
||||
|
||||
var links = intLinks.filter(function (d) {
|
||||
return !d.o.isVPN
|
||||
return d.o.type !== "VPN"
|
||||
}).filter(function (d) {
|
||||
return distanceLink(e, d.source, d.target) < LINE_RADIUS
|
||||
})
|
||||
|
|
@ -591,13 +577,13 @@ define(["d3"], function (d3) {
|
|||
.charge(-250)
|
||||
.gravity(0.1)
|
||||
.linkDistance(function (d) {
|
||||
if (d.o.isVPN)
|
||||
if (d.o.type === "VPN")
|
||||
return 0
|
||||
else
|
||||
return LINK_DISTANCE
|
||||
})
|
||||
.linkStrength(function (d) {
|
||||
if (d.o.isVPN)
|
||||
if (d.o.type === "VPN")
|
||||
return 0
|
||||
else
|
||||
return Math.max(0.5, 1 / d.o.tq)
|
||||
|
|
@ -651,7 +637,7 @@ define(["d3"], function (d3) {
|
|||
e.source = newNodesDict[d.source.id]
|
||||
e.target = newNodesDict[d.target.id]
|
||||
|
||||
if (d.isVPN)
|
||||
if (d.type === "VPN")
|
||||
e.color = "rgba(255, 255, 255, " + (0.6 / d.tq) + ")"
|
||||
else
|
||||
e.color = linkScale(d.tq).hex()
|
||||
|
|
@ -699,29 +685,19 @@ define(["d3"], function (d3) {
|
|||
d.source.neighbours[d.target.o.id] = {node: d.target, link: d}
|
||||
d.target.neighbours[d.source.o.id] = {node: d.source, link: d}
|
||||
|
||||
if (d.o.source && d.o.target)
|
||||
if (d.o.source.node && d.o.target.node)
|
||||
linksDict[d.o.id] = d
|
||||
})
|
||||
|
||||
intLinks.forEach(function (d) {
|
||||
if (linksDict[d.target.o.node_id + "-" + d.source.o.node_id])
|
||||
return
|
||||
|
||||
var obj = { source: d.target, target: d.source, o: { isVPN: d.o.isVPN, type: "dead", id: d.target.o.node_id + "-" + d.source.o.node_id, tq: 1 }, color: "rgba(255, 255, 255, 0.6)" }
|
||||
intLinks.push(obj)
|
||||
linksDict[d.target.o.node_id + "-" + d.source.o.node_id] = obj
|
||||
})
|
||||
|
||||
intNodes.forEach(function (d) {
|
||||
d.neighbours = Object.keys(d.neighbours).map(function (k) {
|
||||
return d.neighbours[k]
|
||||
})
|
||||
})
|
||||
|
||||
nodes = intNodes.filter(function (d) { return !d.o.unseen && d.o.node })
|
||||
nodes = intNodes.filter(function (d) { return d.o.node })
|
||||
uplinkNodes = nodes.filter(function (d) { return d.o.node.flags.uplink })
|
||||
nonUplinkNodes = nodes.filter(function (d) { return !d.o.node.flags.uplink })
|
||||
unseenNodes = intNodes.filter(function (d) { return d.o.unseen && d.o.node })
|
||||
unknownNodes = intNodes.filter(function (d) { return !d.o.node })
|
||||
|
||||
if (localStorageTest()) {
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend, Linklist,
|
|||
}
|
||||
}
|
||||
|
||||
var loader = document.getElementsByClassName("loader")[0]
|
||||
loader.classList.add("hide")
|
||||
|
||||
contentDiv = document.createElement("div")
|
||||
contentDiv.classList.add("content")
|
||||
document.body.appendChild(contentDiv)
|
||||
|
|
@ -60,7 +57,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend, Linklist,
|
|||
contentDiv.appendChild(buttons)
|
||||
|
||||
var buttonToggle = document.createElement("button")
|
||||
buttonToggle.textContent = "\uF133"
|
||||
buttonToggle.textContent = ""
|
||||
buttonToggle.onclick = function () {
|
||||
if (content.constructor === Map)
|
||||
router.view("g")
|
||||
|
|
|
|||
|
|
@ -1,22 +1,10 @@
|
|||
define(function () {
|
||||
function showStatImg(o, d) {
|
||||
var subst = {}
|
||||
subst["{SOURCE}"] = d.source.node_id
|
||||
subst["{SOURCE_NAME}"] = d.source.node.nodeinfo.hostname ? d.source.node.nodeinfo.hostname : "unknown"
|
||||
subst["{TARGET}"] = d.target.node_id
|
||||
subst["{TARGET_NAME}"] = d.target.node.nodeinfo.hostname ? d.target.node.nodeinfo.hostname : "unknown"
|
||||
return showStat(o, subst)
|
||||
}
|
||||
|
||||
return function (config, el, router, d) {
|
||||
var unknown = !(d.source.node)
|
||||
var h2 = document.createElement("h2")
|
||||
var a1 = document.createElement("a")
|
||||
if (!unknown) {
|
||||
a1.href = "#"
|
||||
a1.onclick = router.node(d.source.node)
|
||||
}
|
||||
a1.textContent = unknown ? d.source.id : d.source.node.nodeinfo.hostname
|
||||
a1.href = "#"
|
||||
a1.onclick = router.node(d.source.node)
|
||||
a1.textContent = d.source.node.nodeinfo.hostname
|
||||
h2.appendChild(a1)
|
||||
h2.appendChild(document.createTextNode(" → "))
|
||||
var a2 = document.createElement("a")
|
||||
|
|
@ -32,17 +20,10 @@ define(function () {
|
|||
attributeEntry(attributes, "TQ", showTq(d))
|
||||
attributeEntry(attributes, "Entfernung", showDistance(d))
|
||||
attributeEntry(attributes, "Typ", d.type)
|
||||
var hw1 = unknown ? null : dictGet(d.source.node.nodeinfo, ["hardware", "model"])
|
||||
var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"])
|
||||
var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
|
||||
attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"))
|
||||
el.appendChild(attributes)
|
||||
|
||||
if (config.linkInfos)
|
||||
config.linkInfos.forEach( function (linkInfo) {
|
||||
var h4 = document.createElement("h4")
|
||||
h4.textContent = linkInfo.name
|
||||
el.appendChild(h4)
|
||||
el.appendChild(showStatImg(linkInfo, d))
|
||||
})
|
||||
el.appendChild(attributes)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,100 +1,92 @@
|
|||
define(function () {
|
||||
return function (config, el, router, d) {
|
||||
var sidebarTitle = document.createElement("h2")
|
||||
sidebarTitle.textContent = "Location: " + d.toString()
|
||||
el.appendChild(sidebarTitle)
|
||||
var h2 = document.createElement("h2")
|
||||
h2.textContent = "Location: " + d.toString()
|
||||
el.appendChild(h2)
|
||||
|
||||
getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat=" + d.lat + "&lon=" + d.lng + "&zoom=18&addressdetails=0")
|
||||
getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat=" + d.lat + "&lon=" + d.lng + "&zoom=18&addressdetail=0")
|
||||
.then(function(result) {
|
||||
if(result.display_name)
|
||||
sidebarTitle.textContent = result.display_name
|
||||
h2.textContent = result.display_name
|
||||
})
|
||||
|
||||
var editLat = document.createElement("input")
|
||||
editLat.type = "text"
|
||||
editLat.value = d.lat.toFixed(9)
|
||||
el.appendChild(createBox("lat", "Breitengrad", editLat))
|
||||
var h3lat = document.createElement("h3")
|
||||
h3lat.textContent = "Breitengrad"
|
||||
el.appendChild(h3lat)
|
||||
var txt1 = document.createElement("textarea")
|
||||
txt1.id = "location-latitude"
|
||||
txt1.value = d.lat.toFixed(9)
|
||||
var p = document.createElement("p")
|
||||
p.appendChild(txt1)
|
||||
p.appendChild(createCopyButton(txt1.id))
|
||||
el.appendChild(p)
|
||||
|
||||
var editLng = document.createElement("input")
|
||||
editLng.type = "text"
|
||||
editLng.value = d.lng.toFixed(9)
|
||||
el.appendChild(createBox("lng", "Längengrad", editLng))
|
||||
var h3lng = document.createElement("h3")
|
||||
h3lng.textContent = "Längengrad"
|
||||
el.appendChild(h3lng)
|
||||
var txt2 = document.createElement("textarea")
|
||||
txt2.id = "location-longitude"
|
||||
txt2.value = d.lng.toFixed(9)
|
||||
var p2 = document.createElement("p")
|
||||
p2.appendChild(txt2)
|
||||
p2.appendChild(createCopyButton(txt2.id))
|
||||
el.appendChild(p2)
|
||||
|
||||
var editUci = document.createElement("textarea")
|
||||
editUci.value =
|
||||
"uci set gluon-node-info.@location[0]='location'; " +
|
||||
"uci set gluon-node-info.@location[0].share_location='1';" +
|
||||
"uci set gluon-node-info.@location[0].latitude='" + d.lat.toFixed(9) + "';" +
|
||||
"uci set gluon-node-info.@location[0].longitude='" + d.lng.toFixed(9) + "';" +
|
||||
"uci commit gluon-node-info"
|
||||
|
||||
el.appendChild(createBox("uci", "Befehl", editUci, false))
|
||||
|
||||
var linkPlain = document.createElement("a")
|
||||
linkPlain.textContent = "plain"
|
||||
linkPlain.onclick = function() {
|
||||
switch2plain()
|
||||
return false
|
||||
var a1 = document.createElement("a")
|
||||
a1.textContent = "plain"
|
||||
a1.onclick = function() {
|
||||
switch2plain()
|
||||
return false
|
||||
}
|
||||
linkPlain.href = "#"
|
||||
|
||||
var linkUci = document.createElement("a")
|
||||
linkUci.textContent = "uci"
|
||||
linkUci.onclick = function() {
|
||||
switch2uci()
|
||||
return false
|
||||
a1.href = config.siteURL
|
||||
var a2 = document.createElement("a")
|
||||
a2.textContent = "uci"
|
||||
a2.onclick = function() {
|
||||
switch2uci()
|
||||
return false
|
||||
}
|
||||
linkUci.href = "#"
|
||||
a2.href = config.siteURL
|
||||
|
||||
var hintText = document.createElement("p")
|
||||
hintText.appendChild(document.createTextNode("Du kannst zwischen "))
|
||||
hintText.appendChild(linkPlain)
|
||||
hintText.appendChild(document.createTextNode(" und "))
|
||||
hintText.appendChild(linkUci)
|
||||
hintText.appendChild(document.createTextNode(" wechseln."))
|
||||
el.appendChild(hintText)
|
||||
var p3 = document.createElement("p")
|
||||
p3.textContent = "Du kannst zwischen "
|
||||
p3.appendChild(a1)
|
||||
var t1 = document.createTextNode(" und ")
|
||||
p3.appendChild(t1)
|
||||
p3.appendChild(a2)
|
||||
var t2 = document.createTextNode(" wechseln.")
|
||||
p3.appendChild(t2)
|
||||
el.appendChild(p3)
|
||||
|
||||
function createBox(name, title, inputElem, isVisible) {
|
||||
var visible = typeof isVisible !== "undefined" ? isVisible : true
|
||||
var box = document.createElement("div")
|
||||
var heading = document.createElement("h3")
|
||||
heading.textContent = title
|
||||
box.appendChild(heading)
|
||||
var btn = document.createElement("button")
|
||||
btn.className = "ion-ios-copy"
|
||||
btn.title = "Kopieren"
|
||||
btn.onclick = function() { copy2clip(inputElem.id) }
|
||||
inputElem.id = "location-" + name
|
||||
inputElem.readOnly = true
|
||||
var line = document.createElement("p")
|
||||
line.appendChild(inputElem)
|
||||
line.appendChild(btn)
|
||||
box.appendChild(line)
|
||||
box.id = "box-" + name
|
||||
box.style.display = visible ? "block" : "none"
|
||||
return box
|
||||
function createCopyButton(id) {
|
||||
var btn = document.createElement("button")
|
||||
btn.className = "ion-ios-copy"
|
||||
btn.title = "Kopiere"
|
||||
btn.onclick = function() {
|
||||
copy2clip(id)
|
||||
}
|
||||
return btn
|
||||
}
|
||||
|
||||
function copy2clip(id) {
|
||||
var copyField = document.querySelector("#" + id)
|
||||
copyField.select()
|
||||
try {
|
||||
document.execCommand("copy")
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
var copyTextarea = document.querySelector("#" + id)
|
||||
copyTextarea.select()
|
||||
try {
|
||||
var successful = document.execCommand("copy")
|
||||
var msg = successful ? "successful" : "unsuccessful"
|
||||
console.log("Copying text command was " + msg)
|
||||
} catch (err) {
|
||||
console.log("Oops, unable to copy")
|
||||
}
|
||||
}
|
||||
|
||||
function switch2plain() {
|
||||
document.getElementById("box-uci").style.display = "none"
|
||||
document.getElementById("box-lat").style.display = "block"
|
||||
document.getElementById("box-lng").style.display = "block"
|
||||
var box1 = document.getElementById("location-latitude")
|
||||
box1.value = d.lat.toFixed(9)
|
||||
var box2 = document.getElementById("location-longitude")
|
||||
box2.value = d.lng.toFixed(9)
|
||||
}
|
||||
|
||||
function switch2uci() {
|
||||
document.getElementById("box-uci").style.display = "block"
|
||||
document.getElementById("box-lat").style.display = "none"
|
||||
document.getElementById("box-lng").style.display = "none"
|
||||
var box1 = document.getElementById("location-latitude")
|
||||
box1.value = "uci set gluon-node-info.@location[0].latitude='" + d.lat.toFixed(9) + "'"
|
||||
var box2 = document.getElementById("location-longitude")
|
||||
box2.value = "uci set gluon-node-info.@location[0].longitude='" + d.lng.toFixed(9) + "'"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -42,9 +42,10 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
|||
}
|
||||
|
||||
self.gotoLocation = function (d) {
|
||||
create()
|
||||
new Location(config, el, router, d)
|
||||
}
|
||||
console.log("goto location called with ", d)
|
||||
create()
|
||||
new Location(config, el, router, d)
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue