Eliminate src directory

Duplicating files causes confusion about which ones to edit.
This commit is contained in:
John Firebaugh
2015-12-28 09:24:39 -08:00
parent 5c26232491
commit 26ef3195d9
9 changed files with 8 additions and 202 deletions

View File

@ -2,24 +2,11 @@
UGLIFY = node_modules/.bin/uglifyjs
all: \
$(shell npm install && mkdir -p dist) \
dist/leaflet.fullscreen.css \
dist/Leaflet.fullscreen.js \
$(shell npm install) \
dist/Leaflet.fullscreen.min.js \
dist/fullscreen.png
clean:
rm -f dist/*
dist/fullscreen.png: src/fullscreen.png
cp src/fullscreen.png dist/fullscreen.png
cp src/fullscreen@2x.png dist/fullscreen@2x.png
dist/leaflet.fullscreen.css: src/leaflet.fullscreen.css
cp src/leaflet.fullscreen.css dist/leaflet.fullscreen.css
dist/Leaflet.fullscreen.js: src/Leaflet.fullscreen.js
cp src/Leaflet.fullscreen.js dist/Leaflet.fullscreen.js
rm -f dist/Leaflet.fullscreen.min.js
dist/Leaflet.fullscreen.min.js: dist/Leaflet.fullscreen.js
$(UGLIFY) dist/Leaflet.fullscreen.js > dist/Leaflet.fullscreen.min.js

BIN
dist/fullscreen.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 299 B

BIN
dist/fullscreen@2x.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

After

Width:  |  Height:  |  Size: 420 B

View File

@ -2,9 +2,15 @@
background:#fff url(fullscreen.png) no-repeat 0 0;
background-size:26px 52px;
}
.leaflet-touch .leaflet-control-fullscreen a {
background-position: 2px 2px;
}
.leaflet-fullscreen-on .leaflet-control-fullscreen a {
background-position:0 -26px;
}
.leaflet-touch.leaflet-fullscreen-on .leaflet-control-fullscreen a {
background-position: 2px -24px;
}
/* Do not combine these two rules; IE will break. */
.leaflet-container:-webkit-full-screen {

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,153 +0,0 @@
L.Control.Fullscreen = L.Control.extend({
options: {
position: 'topleft',
title: {
'false': 'View Fullscreen',
'true': 'Exit Fullscreen'
}
},
onAdd: function (map) {
var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control');
this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container);
this.link.href = '#';
this._map = map;
this._map.on('fullscreenchange', this._toggleTitle, this);
this._toggleTitle();
L.DomEvent.on(this.link, 'click', this._click, this);
return container;
},
_click: function (e) {
L.DomEvent.stopPropagation(e);
L.DomEvent.preventDefault(e);
this._map.toggleFullscreen(this.options);
},
_toggleTitle: function() {
this.link.title = this.options.title[this._map.isFullscreen()];
}
});
L.Map.include({
isFullscreen: function () {
return this._isFullscreen || false;
},
toggleFullscreen: function (options) {
var container = this.getContainer();
if (this.isFullscreen()) {
if (options && options.pseudoFullscreen) {
this._disablePseudoFullscreen(container);
} else if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else {
this._disablePseudoFullscreen(container);
}
} else {
if (options && options.pseudoFullscreen) {
this._enablePseudoFullscreen(container);
} else if (container.requestFullscreen) {
container.requestFullscreen();
} else if (container.mozRequestFullScreen) {
container.mozRequestFullScreen();
} else if (container.webkitRequestFullscreen) {
container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (container.msRequestFullscreen) {
container.msRequestFullscreen();
} else {
this._enablePseudoFullscreen(container);
}
}
},
_enablePseudoFullscreen: function (container) {
L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
this._setFullscreen(true);
this.invalidateSize();
this.fire('fullscreenchange');
},
_disablePseudoFullscreen: function (container) {
L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
this._setFullscreen(false);
this.invalidateSize();
this.fire('fullscreenchange');
},
_setFullscreen: function(fullscreen) {
this._isFullscreen = fullscreen;
var container = this.getContainer();
if (fullscreen) {
L.DomUtil.addClass(container, 'leaflet-fullscreen-on');
} else {
L.DomUtil.removeClass(container, 'leaflet-fullscreen-on');
}
},
_onFullscreenChange: function (e) {
var fullscreenElement =
document.fullscreenElement ||
document.mozFullScreenElement ||
document.webkitFullscreenElement ||
document.msFullscreenElement;
if (fullscreenElement === this.getContainer() && !this._isFullscreen) {
this._setFullscreen(true);
this.fire('fullscreenchange');
} else if (fullscreenElement !== this.getContainer() && this._isFullscreen) {
this._setFullscreen(false);
this.fire('fullscreenchange');
}
}
});
L.Map.mergeOptions({
fullscreenControl: false
});
L.Map.addInitHook(function () {
if (this.options.fullscreenControl) {
this.fullscreenControl = new L.Control.Fullscreen(this.options.fullscreenControl);
this.addControl(this.fullscreenControl);
}
var fullscreenchange;
if ('onfullscreenchange' in document) {
fullscreenchange = 'fullscreenchange';
} else if ('onmozfullscreenchange' in document) {
fullscreenchange = 'mozfullscreenchange';
} else if ('onwebkitfullscreenchange' in document) {
fullscreenchange = 'webkitfullscreenchange';
} else if ('onmsfullscreenchange' in document) {
fullscreenchange = 'MSFullscreenChange';
}
if (fullscreenchange) {
var onFullscreenChange = L.bind(this._onFullscreenChange, this);
this.whenReady(function () {
L.DomEvent.on(document, fullscreenchange, onFullscreenChange);
});
this.on('unload', function () {
L.DomEvent.off(document, fullscreenchange, onFullscreenChange);
});
}
});
L.control.fullscreen = function (options) {
return new L.Control.Fullscreen(options);
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 B

View File

@ -1,34 +0,0 @@
.leaflet-control-fullscreen a {
background:#fff url(fullscreen.png) no-repeat 0 0;
background-size:26px 52px;
}
.leaflet-touch .leaflet-control-fullscreen a {
background-position: 2px 2px;
}
.leaflet-fullscreen-on .leaflet-control-fullscreen a {
background-position:0 -26px;
}
.leaflet-touch.leaflet-fullscreen-on .leaflet-control-fullscreen a {
background-position: 2px -24px;
}
.leaflet-container:-webkit-full-screen {
width:100%!important;
height:100%!important;
}
.leaflet-pseudo-fullscreen {
position:fixed!important;
width:100%!important;
height:100%!important;
top:0!important;
left:0!important;
z-index:99999;
}
@media
(-webkit-min-device-pixel-ratio:2),
(min-resolution:192dpi) {
.leaflet-control-fullscreen a {
background-image:url(fullscreen@2x.png);
}
}