ctf-server
old server for hosting capture-the-flag
git clone https://9o.is/git/ctf-server.git
commit 445998349e3847e9db52d6c53bdccc7916711c89 parent f9b6e667fc94e2c35ecc94e7301882a71d754c2a Author: Jul <jul@9o.is> Date: Sat, 7 Dec 2013 19:03:10 -0500 some improvements Diffstat:
| M | src/main/javascript/script.jsm | | | 3 | +-- |
| M | src/main/resources/props/default.props | | | 8 | ++++++-- |
| M | src/main/scala/com/jcabrra/snippet/MapUtil.scala | | | 15 | +++++++++++---- |
| A | src/main/webapp/img/spinner.gif | | | 0 | |
| M | src/main/webapp/templates-hidden/default.html | | | 2 | +- |
5 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/main/javascript/script.jsm b/src/main/javascript/script.jsm @@ -9,4 +9,4 @@ libs/bootstrap-2.3.2.min.js libs/polymaps.min.js -libs/svg.addclass.js -\ No newline at end of file +libs/svg.addclass.js diff --git a/src/main/resources/props/default.props b/src/main/resources/props/default.props @@ -1,2 +1,7 @@ db.user= -db.password= -\ No newline at end of file +db.password= + +# geolocations to center the map +center.long=-73.931606 +center.lat=41.721882 +center.zoomlevel=17 diff --git a/src/main/scala/com/jcabrra/snippet/MapUtil.scala b/src/main/scala/com/jcabrra/snippet/MapUtil.scala @@ -7,6 +7,7 @@ import http._ import js._ import JsCmds._ import JE._ +import util._ import util.Helpers._ import xml.NodeSeq import net.liftmodules.extras._ @@ -15,8 +16,10 @@ import net.liftmodules.extras._ * TODO Future: Use MVVM and clean this up */ object MapUtil { - val (long,lat) = (-73.931606, 41.721882) - val zoomLevel = 17 + val (long,lat) = ( + Props.get("center.long") openOr "-73.989015", + Props.get("center.lat") openOr "40.752459") + val zoomLevel = Props.get("center.zoomlevel") openOr "15" val container = "map" def genMap = { @@ -71,6 +74,7 @@ object MapUtil { for (i <- 0 until ids.size) { val captured = User.currentUser.exists(_.capturedFlags.exists(_.id.get == ids(i))) ret += s""" + e.features[$i].element.id = "map-path${ids(i)}"; e.features[$i].element.addClass("${if(captured) "captured" else ""}"); """ } @@ -192,10 +196,14 @@ object MapUtil { po.geoJson().reload; }, 500); }; + + map.on("move", function() { + jQuery(".popover").hide(); + }); """ }.mkString } """).cmd) "*" #> NodeSeq.Empty } -} -\ No newline at end of file +} diff --git a/src/main/webapp/img/spinner.gif b/src/main/webapp/img/spinner.gif Binary files differ. diff --git a/src/main/webapp/templates-hidden/default.html b/src/main/webapp/templates-hidden/default.html @@ -32,7 +32,7 @@ style="position: fixed; top: 80px; width: 50.5%; left: 62.25%; margin: 0 0 0 -37.5%; height: 0; z-index: 160"> <div data-lift="Notices" id=""></div> <div style="display: none;" id="ajax-spinner" class="text-center"> - <img src="https://s3.amazonaws.com/readmeans/img/spinner.gif" + <img src="/img/spinner.gif" width="32" height="16" /> </div> </div>