Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
Elphel
x3domlet
Commits
bf175159
Commit
bf175159
authored
Jul 17, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
token loading
parent
bd5ccad1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
51 deletions
+98
-51
.directory
js/.directory
+0
-6
index.js
js/index.js
+74
-27
leaflet_init.js
js/leaflet_init.js
+3
-1
ui_init.js
js/ui_init.js
+21
-17
No files found.
js/.directory
deleted
100644 → 0
View file @
bd5ccad1
[Dolphin]
PreviewsShown=true
SortRole=date
Timestamp=2017,6,7,11,0,36
Version=3
ViewMode=1
js/index.js
View file @
bf175159
...
...
@@ -9,35 +9,47 @@ var map_autofit = true;
var
BLOCK_MOVEEND
=
false
;
var
mbxtoken
=
""
;
$
(
function
(){
//init();
parseURL
();
init_maps
();
init_help
();
var
url
=
'list.php?rating='
+
SETTINGS
.
rating
+
'&basepath='
+
SETTINGS
.
basepath
;
if
(
SETTINGS
.
showall
){
url
+=
"?showall"
;
}
$
.
ajax
({
url
:
"mapbox_token.txt"
,
success
:
function
(
token
){
mbxtoken
=
token
;
init
();
},
error
:
function
(
response
){
init
();
}
});
url
:
url
,
success
:
function
(
response
){
});
List
=
response
;
if
(
map_autofit
)
fit_map
(
response
);
parse_list
(
response
);
init_dragging
();
map
.
fire
(
'moveend'
);
function
init
(){
parseURL
(
);
init_maps
();
init_help
(
);
}
var
url
=
'list.php?rating='
+
SETTINGS
.
rating
+
'&basepath='
+
SETTINGS
.
basepath
;
});
if
(
SETTINGS
.
showall
){
url
+=
"?showall"
;
}
});
$
.
ajax
({
url
:
url
,
success
:
function
(
response
){
List
=
response
;
if
(
map_autofit
)
fit_map
(
response
);
parse_list
(
response
);
init_dragging
();
map
.
fire
(
'moveend'
);
}
});
}
var
SETTINGS
=
{
'rating'
:
5
,
...
...
@@ -452,19 +464,54 @@ function init_maps(){
}
);
var
mapboxattr
=
'<a href="https://www.mapbox.com/about/maps/" target="_blank">© Mapbox</a> <a href="https://openstreetmap.org/about/" target="_blank">© OpenStreetMap</a>'
;
var
mbxurl1
=
"https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.png?access_token="
+
mbxtoken
;
var
mbxurl2
=
"https://api.mapbox.com/v4/mapbox.pencil/{z}/{x}/{y}@2x.png?access_token="
+
mbxtoken
;
var
MBXTiles1
=
L
.
tileLayer
(
mbxurl1
,
{
maxZoom
:
21
,
attribution
:
mapboxattr
}
);
var
MBXTiles2
=
L
.
tileLayer
(
mbxurl2
,
{
maxZoom
:
21
,
attribution
:
mapboxattr
}
);
if
(
mbxtoken
==
""
){
selected_layer
=
googleSat
;
var
baseMaps
=
{
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
}
else
{
selected_layer
=
MBXTiles1
;
var
baseMaps
=
{
"Mapbox 1"
:
MBXTiles1
,
"Mapbox 2"
:
MBXTiles2
,
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
}
map
=
L
.
map
(
'leaflet_map'
,{
layers
:[
googleSat
],
layers
:[
selected_layer
],
zoomControl
:
false
,
}).
setView
([
SETTINGS
.
lat
,
SETTINGS
.
lng
],
SETTINGS
.
zoom
);
new
L
.
Control
.
Zoom
({
position
:
'topright'
}).
addTo
(
map
);
var
baseMaps
=
{
"Esri world imagery"
:
Esri_WorldImagery
,
"Google"
:
googleSat
,
"Open Street Map"
:
OSMTiles
};
//Esri_WorldImagery.addTo(map);
//googleSat.addTo(map);
...
...
js/leaflet_init.js
View file @
bf175159
...
...
@@ -42,7 +42,7 @@
var
mbxtoken
=
""
;
var
LeafletObject
=
function
(
id
,
data
,
options
){
var
LeafletObject
=
function
(
id
,
data
,
options
,
callback
){
var
defaults
=
{
debug
:
true
,
...
...
@@ -73,9 +73,11 @@ var LeafletObject = function(id,data,options){
success
:
function
(
token
){
mbxtoken
=
token
;
self
.
initialize
();
callback
();
},
error
:
function
(
response
){
self
.
initialize
();
callback
();
}
});
...
...
js/ui_init.js
View file @
bf175159
...
...
@@ -367,23 +367,27 @@ function parse_light_init_response(response,state,mode){
Scene
=
new
X3DOMObject
(
element
,
Data
,{});
Scene
.
initResize
();
Map
=
new
LeafletObject
(
'leaflet_map'
,
Data
,{});
$
.
getScript
(
"js/x3dom/x3dom-full.debug.js"
,
function
(){
//wait until it DOM is extended
x3dom
.
runtime
.
ready
=
function
(){
map_resize_init
();
deep_init
();
//align_init();
x3d_initial_camera_placement
(
mode
);
Scene
.
resize
();
x3d_events
();
leaf_events
();
};
Map
=
new
LeafletObject
(
'leaflet_map'
,
Data
,{},
function
(){
$
.
getScript
(
"js/x3dom/x3dom-full.debug.js"
,
function
(){
console
.
log
(
"loaded x3dom"
);
//wait until it DOM is extended
x3dom
.
runtime
.
ready
=
function
(){
map_resize_init
();
deep_init
();
//align_init();
x3d_initial_camera_placement
(
mode
);
Scene
.
resize
();
x3d_events
();
leaf_events
();
};
});
});
}
else
{
...
...
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