jenkins-bot has submitted this change and it was merged. Change subject: Fullscreen plugin ......................................................................
Fullscreen plugin Change-Id: I66ebe8e59f82b41da6b7a009dc2c004ff05a6bb2 --- M index.html A vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js A vendor/leaflet/addon/fullscreen/fullscreen.png A vendor/leaflet/addon/fullscreen/fullscr...@2x.png A vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css M wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js 6 files changed, 48 insertions(+), 1 deletion(-) Approvals: Smalyshev: Looks good to me, approved jenkins-bot: Verified diff --git a/index.html b/index.html index 723cc13..db4195e 100644 --- a/index.html +++ b/index.html @@ -14,6 +14,7 @@ <link rel="stylesheet" href="vendor/codemirror/addon/hint/show-hint.css"> <link rel="stylesheet" href="vendor/lightbox/ekko-lightbox.min.css"> <link rel="stylesheet" href="vendor/leaflet/leaflet.css"> + <link rel="stylesheet" href="vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css"> <link rel="stylesheet" href="style.css"> <link rel="shortcut icon" href="//www.wikidata.org/static/favicon/testwikidata.ico"> @@ -191,6 +192,7 @@ <script src="vendor/wdqs-explorer/wdqs-explorer.js"></script> <script src="vendor/lightbox/ekko-lightbox.min.js"></script> <script src="vendor/leaflet/leaflet.js"></script> + <script src="vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js"></script> <script src="wikibase/codemirror/addon/tooltip/WikibaseRDFTooltip.js"></script> diff --git a/vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js b/vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js new file mode 100644 index 0000000..184cc7f --- /dev/null +++ b/vendor/leaflet/addon/fullscreen/Leaflet.fullscreen.min.js @@ -0,0 +1 @@ +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)}; \ No newline at end of file diff --git a/vendor/leaflet/addon/fullscreen/fullscreen.png b/vendor/leaflet/addon/fullscreen/fullscreen.png new file mode 100644 index 0000000..7384960 --- /dev/null +++ b/vendor/leaflet/addon/fullscreen/fullscreen.png Binary files differ diff --git a/vendor/leaflet/addon/fullscreen/fullscr...@2x.png b/vendor/leaflet/addon/fullscreen/fullscr...@2x.png new file mode 100644 index 0000000..9fca7f8 --- /dev/null +++ b/vendor/leaflet/addon/fullscreen/fullscr...@2x.png Binary files differ diff --git a/vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css b/vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css new file mode 100644 index 0000000..f489257 --- /dev/null +++ b/vendor/leaflet/addon/fullscreen/leaflet.fullscreen.css @@ -0,0 +1,40 @@ +.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; + } + +/* Do not combine these two rules; IE will break. */ +.leaflet-container:-webkit-full-screen { + width:100%!important; + height:100%!important; + } +.leaflet-container.leaflet-fullscreen-on { + 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(fullscr...@2x.png); + } + } diff --git a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js index 181f050..d8dc645 100644 --- a/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js +++ b/wikibase/queryService/ui/resultBrowser/CoordinateResultBrowser.js @@ -50,7 +50,8 @@ map = L.map( 'map', { center: [0, 0], maxZoom: 18, - minZoom: 2 + minZoom: 2, + fullscreenControl: true } ).fitBounds( markerGroup.getBounds() ); @@ -157,6 +158,9 @@ $( container ).append( $(' <span class="glyphicon glyphicon-chevron-up"/> ') ); container.onclick = function(){ + if( map.isFullscreen() ){ + map.toggleFullscreen(); + } $( window ).scrollTop( 0, 0 ); }; -- To view, visit https://gerrit.wikimedia.org/r/276494 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I66ebe8e59f82b41da6b7a009dc2c004ff05a6bb2 Gerrit-PatchSet: 2 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits