Changeset 249 for binary-improvements/webserver/js
- Timestamp:
- Aug 7, 2015, 10:18:37 AM (9 years ago)
- Location:
- binary-improvements/webserver/js
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/webserver/js/inventory_dialog.js
r245 r249 57 57 58 58 $( "#playerInventoryDialog" ).css("z-index", "1010").dialog({ 59 dialogClass: "playerInventoryDialog", 59 60 modal: true, 60 61 width: BAG_COLS*(INV_ITEM_WIDTH+14) + 3*(INV_ITEM_WIDTH+14) + 20, -
binary-improvements/webserver/js/leaflet.control.reloadtiles.js
r244 r249 2 2 options: { 3 3 position: 'bottomleft', 4 autoreload_enable: true, 5 autoreload_minInterval: 30, 6 autoreload_interval: 120, 7 autoreload_defaultOn: false, 4 8 layers: [] 5 9 }, … … 9 13 container = L.DomUtil.create('div', name + ' webmap-control'); 10 14 11 L.DomEvent.on (container, 'mousemove', L.DomEvent.stopPropagation); 15 var stop = L.DomEvent.stopPropagation; 16 L.DomEvent 17 .on (container, 'mousemove', stop) 18 .on (container, 'click', stop) 19 .on (container, 'mousedown', stop) 20 .on (container, 'dblclick', stop); 12 21 13 22 this._map = map; 23 24 this._reloadbutton = $("<a>") 25 .addClass (name+"-btn") 26 .text ("Reload tiles now") 27 .attr ("href", "#") 28 .attr ("title", "Reload tiles now") 29 .on ("click.action", null, this, this._reload); 30 $(container).append (this._reloadbutton); 14 31 15 this._reloadbutton = this._createButton( 16 "Reload tiles", "Reload tiles", 17 name + "-btn", container, this._reload, this); 32 if (this.options.autoreload_enable) { 33 $(container).append ("<br>"); 34 35 this._autocheck = $("<input>") 36 .addClass (name + "-chk") 37 .attr ("type", "checkbox") 38 .attr ("name", "map_reloadtiles_autoreload") 39 .attr ("id", "map_reloadtiles_autoreload") 40 .attr ("value", "1") 41 .on ("change", null, this, this._selectreload); 42 if (this.options.autoreload_defaultOn) { 43 this._autocheck.attr ("checked", "checked"); 44 this._timeout = window.setTimeout ($.proxy (this._reloadTilesEvent, this), this.options.autoreload_interval*1000); 45 } 46 $(container).append (this._autocheck); 47 48 var label1 = $("<label>") 49 .attr ("for", "map_reloadtiles_autoreload"); 50 label1.append ("Reload every "); 51 $(container).append (label1); 52 53 this._reloadinterval = $("<input>") 54 .addClass (name + "-txt") 55 .attr ("name", "map_reloadtiles_autoreload_time") 56 .attr ("type", "text") 57 .attr ("size", "4") 58 .attr ("maxlength", "5") 59 .attr ("value", this.options.autoreload_interval) 60 .on ("input", null, this, this._verifyinterval); 61 $(container).append (this._reloadinterval); 18 62 63 var label2 = $("<label>") 64 .attr ("for", "map_reloadtiles_autoreload"); 65 label2.append (" seconds"); 66 $(container).append (label2); 67 } 68 19 69 return container; 20 70 }, … … 22 72 onRemove: function (map) { 23 73 }, 74 75 _selectreload: function (e) { 76 if (e.data._autocheck.prop ("checked")) { 77 e.data._timeout = window.setTimeout ($.proxy (e.data._reloadTilesEvent, e.data), e.data.options.autoreload_interval*1000); 78 } else { 79 window.clearTimeout (e.data._timeout); 80 } 81 }, 82 83 _verifyinterval: function (e) { 84 var val = e.data._reloadinterval.val (); 85 if (/^[\d]+$/.test (val)) { 86 if (val >= e.data.options.autoreload_minInterval) { 87 e.data._reloadinterval.removeClass ("invalidinput"); 88 e.data.options.autoreload_interval = val; 89 if (e.data._autocheck.prop ("checked")) { 90 window.clearTimeout (e.data._timeout); 91 e.data._timeout = window.setTimeout ($.proxy (e.data._reloadTilesEvent, e.data), e.data.options.autoreload_interval*1000); 92 } 93 } else { 94 e.data._reloadinterval.addClass ("invalidinput"); 95 } 96 } else { 97 e.data._reloadinterval.addClass ("invalidinput"); 98 } 99 }, 24 100 25 101 _reload: function (e) { 26 102 var newTileTime = new Date().getTime(); 27 103 28 for (var i = 0; i < this.options.layers.length; i++) {29 this.options.layers [i].options.time = newTileTime;30 this.options.layers [i].redraw ();104 for (var i = 0; i < e.data.options.layers.length; i++) { 105 e.data.options.layers [i].options.time = newTileTime; 106 e.data.options.layers [i].redraw (); 31 107 } 32 108 }, 33 109 34 _createButton: function (html, title, className, container, fn, context) { 35 var link = L.DomUtil.create('a', className, container); 36 link.innerHTML = html; 37 link.href = '#'; 38 link.title = title; 39 40 var stop = L.DomEvent.stopPropagation; 41 42 L.DomEvent 43 .on(link, 'click', stop) 44 .on(link, 'mousedown', stop) 45 .on(link, 'dblclick', stop) 46 .on(link, 'click', L.DomEvent.preventDefault) 47 .on(link, 'click', fn, context) 48 .on(link, 'click', this._refocusOnMap, context); 49 50 return link; 51 } 110 _reloadTilesEvent: function() { 111 var div = this._div; 112 this._reload ({data: this}); 113 this._timeout = window.setTimeout ($.proxy (this._reloadTilesEvent, this), this.options.autoreload_interval*1000); 114 }, 52 115 53 116 }); -
binary-improvements/webserver/js/map.js
r245 r249 33 33 }); 34 34 35 36 37 38 35 // =============================================================================================== 39 36 // Map and basic tile layers 40 41 var initTime = new Date().getTime();42 37 43 38 map = L.map('tab_map', { … … 48 43 }).setView([0, 0], Math.max(0, mapinfo.maxzoom - 5)); 49 44 50 var tileLayer = L.tileLayer('../map/{z}/{x}/{y}.png?t={time}', { 51 maxZoom: mapinfo.maxzoom + 1, 52 minZoom: Math.max(0, mapinfo.maxzoom - 5), 53 maxNativeZoom: mapinfo.maxzoom, 54 tileSize: mapinfo.tilesize, 55 continuousWorld: true, 56 tms: true, 57 unloadInvisibleTiles: false, 58 time: initTime 59 }); 60 61 // TileLayer w/ TMS=true fix for zoomlevel >= 8 62 tileLayer._getWrapTileNum = function () { 63 return L.point(0, 0); 64 }; 65 66 var tileLayerMiniMap = L.tileLayer('../map/{z}/{x}/{y}.png?t={time}', { 67 maxZoom: mapinfo.maxzoom, 68 minZoom: 0, 69 maxNativeZoom: mapinfo.maxzoom, 70 tileSize: mapinfo.tilesize, 71 continuousWorld: true, 72 tms: true, 73 unloadInvisibleTiles: false, 74 time: initTime 75 }); 76 77 78 45 46 var initTime = new Date().getTime(); 47 var tileLayer = GetSdtdTileLayer (mapinfo, initTime); 48 var tileLayerMiniMap = GetSdtdTileLayer (mapinfo, initTime, true); 79 49 80 50 … … 92 62 93 63 94 95 var baseLayers = { 96 //"Map": tileLayer 97 }; 98 99 var layerControl = L.control.layers(baseLayers, null, { 100 collapsed: false 101 }); 64 var layerControl = L.control.layers({ 65 //"Map": tileLayer 66 }, null, { 67 collapsed: false 68 } 69 ); 102 70 103 71 var layerCount = 0; … … 105 73 106 74 tileLayer.addTo(map); 75 107 76 new L.Control.Coordinates({}).addTo(map); 108 new L.Control.ReloadTiles({layers: [tileLayer, tileLayerMiniMap]}).addTo(map); 77 78 new L.Control.ReloadTiles({ 79 autoreload_enable: true, 80 autoreload_minInterval: 30, 81 autoreload_interval: 120, 82 autoreload_defaultOn: false, 83 layers: [tileLayer, tileLayerMiniMap] 84 }).addTo(map); 85 109 86 layerControl.addOverlay (GetRegionLayer (mapinfo), "Region files"); 87 110 88 var miniMap = new L.Control.MiniMap(tileLayerMiniMap, { 111 89 zoomLevelOffset: -6, … … 113 91 }).addTo(map); 114 92 93 var measure = L.control.measure({ 94 //primaryLengthUnit: "meters", 95 //primaryAreaUnit: "sqmeters", 96 //activeColor: "#ABE67E", 97 //completedColor: "#C8F2BE", 98 position: "bottomleft" 99 }); 100 //measure.addTo(map); 101 102 //new L.Control.GameTime({}).addTo(map); 103 115 104 if (HasPermission ("webapi.getlandclaims")) { 116 105 layerControl.addOverlay (GetLandClaimsLayer (map, mapinfo), "Land claims"); 117 106 layerCount++; 118 107 } 108 119 109 if (HasPermission ("webapi.getplayerslocation")) { 120 110 layerControl.addOverlay (playersOfflineMarkerGroup, "Players (offline) (<span id='mapControlOfflineCount'>0</span>)"); … … 148 138 if (playersMappingList.hasOwnProperty(val.steamid)) { 149 139 marker = playersMappingList[val.steamid].currentPosMarker; 150 marker.setLatLng([val.position.x, val.position.z]);151 140 } else { 152 141 marker = L.marker([val.position.x, val.position.z]).bindPopup( … … 158 147 playersMappingList[val.steamid] = { online: !val.online }; 159 148 } 160 if (playersMappingList[val.steamid].online != val.online) { 161 if (val.online) { 149 if (playersMappingList[val.steamid].online) { 150 playersOnlineMarkerGroup.removeLayer(marker); 151 } else { 152 playersOfflineMarkerGroup.removeLayer(marker); 153 } 154 marker.setLatLng([val.position.x, val.position.z]); 155 if (val.online) { 162 156 marker.setOpacity(1.0); 163 playersOfflineMarkerGroup.removeLayer(marker);164 157 playersOnlineMarkerGroup.addLayer(marker); 165 158 } else { 166 159 marker.setOpacity(0.5); 167 playersOnlineMarkerGroup.removeLayer(marker);168 160 playersOfflineMarkerGroup.addLayer(marker); 169 }170 161 } 162 171 163 val.currentPosMarker = marker; 172 164 playersMappingList[val.steamid] = val; -
binary-improvements/webserver/js/permissions.js
r245 r249 36 36 }) 37 37 .always(function () { 38 $("#nopermissionwarning").attr ("style", "display: block"); 38 if (PermissionCount () == 0) { 39 $("#nopermissionwarning").attr ("style", "display: block"); 40 } 39 41 }) 40 42 } … … 49 51 } 50 52 53 function PermissionCount () { 54 var cnt = 0; 55 for (var i = 0; i < userdata.permissions.length; i++) { 56 if (userdata.permissions [i].allowed) cnt++; 57 } 58 return cnt; 59 } 60 -
binary-improvements/webserver/js/tabs.js
r245 r249 1 var tabElements = {}; 2 var currentTabClass = "current_tab"; 3 4 function OpenTab () { 5 var menuElement = $(this); 6 var linkElement = menuElement.children ("a"); 7 var linkName = linkElement.attr ("href"); 8 9 $("*").removeClass (currentTabClass); 10 menuElement.addClass (currentTabClass); 11 $(linkName).addClass (currentTabClass); 12 } 13 1 14 function InitializeTabs () { 2 15 $("#adminmenu > ul > li").addClass ("menu_button");
Note:
See TracChangeset
for help on using the changeset viewer.