Added logo-component.
This commit is contained in:
parent
e6c32b7b7d
commit
8ce73f51a6
3 changed files with 49 additions and 0 deletions
|
|
@ -61,6 +61,10 @@ components:
|
||||||
type: timeofdayclock
|
type: timeofdayclock
|
||||||
showdigitalclock: true
|
showdigitalclock: true
|
||||||
#showweather: true
|
#showweather: true
|
||||||
|
#- class: org.dynmap.ClientComponent
|
||||||
|
# type: logo
|
||||||
|
# text: "Dynmap"
|
||||||
|
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
|
||||||
#- class: org.dynmap.regions.RegionsComponent
|
#- class: org.dynmap.regions.RegionsComponent
|
||||||
# type: regions
|
# type: regions
|
||||||
# name: WorldGuard
|
# name: WorldGuard
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,12 @@
|
||||||
border: 1px solid red;
|
border: 1px solid red;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
/*******************
|
||||||
|
* Attribution placement
|
||||||
|
*/
|
||||||
|
.leaflet-control-attribution {
|
||||||
|
margin-right: 20px !important;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* Page setup
|
* Page setup
|
||||||
|
|
|
||||||
39
web/js/logo.js
Normal file
39
web/js/logo.js
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
componentconstructors['logo'] = function(dynmap, configuration) {
|
||||||
|
|
||||||
|
var Logo = L.Class.extend({
|
||||||
|
onAdd: function(map) {
|
||||||
|
this._container = L.DomUtil.create('div', 'leaflet-control-attribution');
|
||||||
|
this._map = map;
|
||||||
|
this._update();
|
||||||
|
},
|
||||||
|
|
||||||
|
getPosition: function() {
|
||||||
|
return L.Control.Position.BOTTOM_RIGHT;
|
||||||
|
},
|
||||||
|
|
||||||
|
getContainer: function() {
|
||||||
|
return this._container;
|
||||||
|
},
|
||||||
|
|
||||||
|
_update: function() {
|
||||||
|
if (!this._map) return;
|
||||||
|
var c = this._container;
|
||||||
|
if (configuration.linkurl) {
|
||||||
|
c = $('<a/>').attr('href', configuration.linkurl).appendTo(c)[0];
|
||||||
|
}
|
||||||
|
if (configuration.logourl) {
|
||||||
|
$(c).append($('<img/>').attr('src', configuration.logourl).attr('alt', configuration.text).appendTo(c)[0]);
|
||||||
|
} else {
|
||||||
|
$(c).text(configuration.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dynmap.map.options.attributionControl = false;
|
||||||
|
if (dynmap.map.attributionControl) {
|
||||||
|
dynmap.map.removeControl(dynmap.map.attributionControl);
|
||||||
|
dynmap.map.attributionControl = null;
|
||||||
|
}
|
||||||
|
var l = new Logo();
|
||||||
|
dynmap.map.addControl(l);
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue