v0.1 with spot app
This commit is contained in:
1 parent
94370ae57e
commit
a52307af80
6 files changed
+32
-14
No files matched your search
+7
-7
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
class Spot extends Main
|
class Spot extends Main
|
||||||
{
|
{
|
||||||
//Spot datasource
|
//Spot feed
|
||||||
const SPOT_ID = '0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm';
|
const FEED_ID = '0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm';
|
||||||
const SPOT_HOOK = 'https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/';
|
const FEED_HOOK = 'https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/';
|
||||||
const SPOT_TYPE_XML = '/message.xml';
|
const FEED_TYPE_XML = '/message.xml';
|
||||||
const SPOT_TYPE_JSON = '/message.json';
|
const FEED_TYPE_JSON = '/message.json';
|
||||||
|
|
||||||
//Database
|
//Database
|
||||||
const MSG_TABLE = 'messages';
|
const MSG_TABLE = 'messages';
|
||||||
@@ -62,14 +62,14 @@ class Spot extends Main
|
|||||||
|
|
||||||
public function getSpotData()
|
public function getSpotData()
|
||||||
{
|
{
|
||||||
//$sContent = file_get_contents(self::SPOT_HOOK.self::SPOT_ID.self::SPOT_TYPE_JSON);
|
//$sContent = file_get_contents(self::FEED_HOOK.self::FEED_ID.self::FEED_TYPE_JSON);
|
||||||
$sContent = '{"response":{"feedMessageResponse":{"count":1,"feed":{"id":"0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm","name":"Te Araroa","description":"Te Araroa","status":"ACTIVE","usage":0,"daysRange":7,"detailedMessageShown":false},"totalCount":1,"activityCount":0,"messages":{"message":{"@clientUnixTime":"0","id":477259564,"messengerId":"0-2489517","messengerName":"Francois","unixTime":1449002345,"messageType":"OK","latitude":48.85129,"longitude":2.40491,"modelId":"SPOT3","showCustomMsg":"N","dateTime":"2015-12-01T20:39:05+0000","messageDetail":"","batteryState":"GOOD","hidden":0,"messageContent":"Jusque là , tout va bien ! Click sur le lien en dessous pour voir où je suis :)\r\n\r\n@Clara: <3"}}}}}';
|
$sContent = '{"response":{"feedMessageResponse":{"count":1,"feed":{"id":"0Y5LrvigElWeAieBGnFol0KBEuOTkFJmm","name":"Te Araroa","description":"Te Araroa","status":"ACTIVE","usage":0,"daysRange":7,"detailedMessageShown":false},"totalCount":1,"activityCount":0,"messages":{"message":{"@clientUnixTime":"0","id":477259564,"messengerId":"0-2489517","messengerName":"Francois","unixTime":1449002345,"messageType":"OK","latitude":48.85129,"longitude":2.40491,"modelId":"SPOT3","showCustomMsg":"N","dateTime":"2015-12-01T20:39:05+0000","messageDetail":"","batteryState":"GOOD","hidden":0,"messageContent":"Jusque là , tout va bien ! Click sur le lien en dessous pour voir où je suis :)\r\n\r\n@Clara: <3"}}}}}';
|
||||||
return json_decode($sContent, true);
|
return json_decode($sContent, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMainPage()
|
public function getMainPage()
|
||||||
{
|
{
|
||||||
return parent::getMainPage(array('vars'=>array()));
|
return parent::getMainPage(array('vars'=>array('feed_id'=>self::FEED_ID)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -4,9 +4,11 @@
|
|||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
<link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon" />
|
<link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon" />
|
||||||
<link type="image/png" href="images/favicon_32.png" rel="icon" sizes="32x32" />
|
<link type="image/png" href="images/favicon_32.png" rel="icon" sizes="32x32" />
|
||||||
<link type="text/css" href="style/pedidor.css" rel="stylesheet" media="all" />
|
<link type="text/css" href="style/spot.css" rel="stylesheet" media="all" />
|
||||||
<script type="text/javascript" src="script/jquery.js"></script>
|
<script type="text/javascript" src="script/jquery.js"></script>
|
||||||
<script type="text/javascript" src="script/jquery.mods.js"></script>
|
<script type="text/javascript" src="script/jquery.mods.js"></script>
|
||||||
|
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
|
||||||
|
<script type="text/javascript" src="//d3ra5e5xmvzawh.cloudfront.net/live-widget/2.0/spot-main-min.js"></script>
|
||||||
<script type="text/javascript" src="script/spot.js"></script>
|
<script type="text/javascript" src="script/spot.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var oSpot = new Spot(asGlobalVars);
|
var oSpot = new Spot(asGlobalVars);
|
||||||
@@ -15,6 +17,10 @@
|
|||||||
<title>Find Me Spot</title>
|
<title>Find Me Spot</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="container"></div>
|
<div id="container">
|
||||||
|
<header></header>
|
||||||
|
<div id="main"></div>
|
||||||
|
<footer></footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+8
-3
@@ -1,10 +1,15 @@
|
|||||||
<div id="messages">
|
<div id="messages">
|
||||||
|
<div id="widget"></div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
oCvtheque.pageInit = function(asHash)
|
oSpot.pageInit = function(asHash)
|
||||||
{
|
{
|
||||||
|
$('#widget').spotLiveWidget({
|
||||||
|
feedId: self.vars('feed_id'),
|
||||||
|
width: '100%',
|
||||||
|
height: 800
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
//oCvtheque.onSamePageMove = function(asHash){return true;};
|
//oSpot.onSamePageMove = function(asHash){return true;};
|
||||||
</script>
|
</script>
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/* Spot Librairy - findmespot.com */
|
||||||
|
//function SpotMain(){this.scriptName="spot-main-min.js";this.COMPRESSED=true;this.scriptLocation=null;this.scriptsToLoad=["markermanager.js","spot-widget.js"];this.stylesToLoad=["Resources/css/spotlivewidget.css"]}function MarkerManager(e,t){var n=this;n.map_=e;n.mapZoom_=e.getZoom();n.projectionHelper_=new ProjectionHelperOverlay(e);google.maps.event.addListener(n.projectionHelper_,"ready",function(){n.projection_=this.getProjection();n.initialize(e,t)})}function GridBounds(e){this.minX=Math.min(e[0].x,e[1].x);this.maxX=Math.max(e[0].x,e[1].x);this.minY=Math.min(e[0].y,e[1].y);this.maxY=Math.max(e[0].y,e[1].y)}function ProjectionHelperOverlay(e){this.setMap(e);var t=8;var n=1<<t;var r=7;this._map=e;this._zoom=-1;this._X0=this._Y0=this._X1=this._Y1=-1}SpotMain.prototype.getScriptLocation=function(){if(this.scriptLocation==null){var e=document.getElementsByTagName("script");for(var t=0;t<e.length;t++){var n=e[t].getAttribute("src");if(n){var r=n.lastIndexOf(this.scriptName);var i=n.lastIndexOf("?");if(i<0){i=n.length}if(r>-1&&r+this.scriptName.length==i){this.scriptLocation=n.slice(0,i-this.scriptName.length);break}}}}return this.scriptLocation};SpotMain.prototype.loadStyles=function(){for(var e=0;e<this.stylesToLoad.length;e++){var t=document.getElementsByTagName("head")[0],n=document.createElement("link");n.rel="stylesheet";n.type="text/css";n.href=this.getScriptLocation()+this.stylesToLoad[e];n.media="all";t.appendChild(n)}};SpotMain.prototype.loadScript=function(e){document.write('<script src="'+this.getScriptLocation()+e+'"></script>')};SpotMain.prototype.loadScripts=function(e){for(var t=0;t<this.scriptsToLoad.length;t++){this.loadScript(this.scriptsToLoad[t])}};SpotMain.prototype.load=function(){if(this.COMPRESSED===false)this.loadScripts();this.loadStyles()};window.spotMain=new SpotMain;spotMain.load();MarkerManager.prototype.initialize=function(e,t){var n=this;t=t||{};n.tileSize_=MarkerManager.DEFAULT_TILE_SIZE_;var r=e.mapTypes;var i=1;for(var s in r){if(typeof e.mapTypes.get(s)==="object"&&typeof e.mapTypes.get(s).maxZoom==="number"){var o=e.mapTypes.get(s).maxZoom;if(o>i){i=o}}}n.maxZoom_=t.maxZoom||19;n.trackMarkers_=t.trackMarkers;n.show_=t.show||true;var u;if(typeof t.borderPadding==="number"){u=t.borderPadding}else{u=MarkerManager.DEFAULT_BORDER_PADDING_}n.swPadding_=new google.maps.Size(-u,u);n.nePadding_=new google.maps.Size(u,-u);n.borderPadding_=u;n.gridWidth_={};n.grid_={};n.grid_[n.maxZoom_]={};n.numMarkers_={};n.numMarkers_[n.maxZoom_]=0;google.maps.event.addListener(e,"dragend",function(){n.onMapMoveEnd_()});google.maps.event.addListener(e,"zoom_changed",function(){n.onMapMoveEnd_()});n.removeOverlay_=function(e){e.setMap(null);n.shownMarkers_--};n.addOverlay_=function(e){if(n.show_){e.setMap(n.map_);n.shownMarkers_++}};n.resetManager_();n.shownMarkers_=0;n.shownBounds_=n.getMapGridBounds_();google.maps.event.trigger(n,"loaded")};MarkerManager.DEFAULT_TILE_SIZE_=1024;MarkerManager.DEFAULT_BORDER_PADDING_=100;MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE=256;MarkerManager.prototype.resetManager_=function(){var e=MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE;for(var t=0;t<=this.maxZoom_;++t){this.grid_[t]={};this.numMarkers_[t]=0;this.gridWidth_[t]=Math.ceil(e/this.tileSize_);e<<=1}};MarkerManager.prototype.clearMarkers=function(){this.processAll_(this.shownBounds_,this.removeOverlay_);this.resetManager_()};MarkerManager.prototype.getTilePoint_=function(e,t,n){var r=this.projectionHelper_.LatLngToPixel(e,t);var i=new google.maps.Point(Math.floor((r.x+n.width)/this.tileSize_),Math.floor((r.y+n.height)/this.tileSize_));return i};MarkerManager.prototype.addMarkerBatch_=function(e,t,n){var r=this;var i=e.getPosition();e.MarkerManager_minZoom=t;if(this.trackMarkers_){google.maps.event.addListener(e,"changed",function(e,t,n){r.onMarkerMoved_(e,t,n)})}var s=this.getTilePoint_(i,n,new google.maps.Size(0,0,0,0));for(var o=n;o>=t;o--){var u=this.getGridCellCreate_(s.x,s.y,o);u.push(e);s.x=s.x>>1;s.y=s.y>>1}};MarkerManager.prototype.isGridPointVisible_=function(e){var t=this.shownBounds_.minY<=e.y&&e.y<=this.shownBounds_.maxY;var n=this.shownBounds_.minX;var r=n<=e.x&&e.x<=this.shownBounds_.maxX;if(!r&&n<0){var i=this.gridWidth_[this.shownBounds_.z];r=n+i<=e.x&&e.x<=i-1}return t&&r};MarkerManager.prototype.onMarkerMoved_=function(e,t,n){var r=this.maxZoom_;var i=false;var s=this.getTilePoint_(t,r,new google.maps.Size(0,0,0,0));var o=this.getTilePoint_(n,r,new google.maps.Size(0,0,0,0));while(r>=0&&(s.x!==o.x||s.y!==o.y)){var u=this.getGridCellNoCreate_(s.x,s.y,r);if(u){if(this.removeFromArray_(u,e)){this.getGridCellCreate_(o.x,o.y,r).push(e)}}if(r===this.mapZoom_){if(this.isGridPointVisible_(s)){if(!this.isGridPointVisible_(o)){this.removeOverlay_(e);i=true}}else{if(this.isGridPointVisible_(o)){this.addOverlay_(e);i=true}}}s.x=s.x>>1;s.y=s.y>>1;o.x=o.x>>1;o.y=o.y>>1;--r}if(i){this.notifyListeners_()}};MarkerManager.prototype.removeMarker=function(e){var t=this.maxZoom_;var n=false;var r=e.getPosit
Line truncated
|
||||||
+1
-2
@@ -18,6 +18,7 @@ function Spot(asGlobals)
|
|||||||
//page elem
|
//page elem
|
||||||
self.elem = {};
|
self.elem = {};
|
||||||
self.elem.container = $('#container');
|
self.elem.container = $('#container');
|
||||||
|
self.elem.main = $('#main');
|
||||||
|
|
||||||
//on window resize
|
//on window resize
|
||||||
//$(window).resize(self.onResize).resize();
|
//$(window).resize(self.onResize).resize();
|
||||||
@@ -130,8 +131,6 @@ function Spot(asGlobals)
|
|||||||
var $Dom = $(self.consts.pages[sPageName]);
|
var $Dom = $(self.consts.pages[sPageName]);
|
||||||
if(bFirstPage)
|
if(bFirstPage)
|
||||||
{
|
{
|
||||||
self.elem.container.html($(self.consts.pages['template']));
|
|
||||||
self.elem.main = self.elem.container.find('#main');
|
|
||||||
self.splash($Dom, asHash, bFirstPage); //first page
|
self.splash($Dom, asHash, bFirstPage); //first page
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
#widget img[alt="spot-banner"]{
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user