@ -2466,55 +2466,62 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}
} ,
defaultType : function ( name ) {
if ( name . toLowerCase ( ) == "satellite" || name . toLowerCase ( ) == "hybrid" || name . toLowerCase ( ) == "terrain" || name . toLowerCase ( ) == "roadmap" ) {
return true ;
} else {
return false ;
}
} ,
map _subdomains : [ "" , "a." , "b." , "c." , "d." ] ,
map _attribution : {
"stamen" : "Map tiles by <a href='http://stamen.com'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>." ,
"apple" : "Map data © 2012 Apple, Imagery © 2012 Apple"
"stamen" : "Map tiles by <a href='http://stamen.com'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>." ,
"apple" : "Map data © 2012 Apple, Imagery © 2012 Apple"
} ,
map _providers : {
"toner" : {
"url" : "http://{S}tile.stamen.com/toner/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
"url" : "http://{S}tile.stamen.com/toner/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
} ,
"toner-lines" : {
"url" : "http://{S}tile.stamen.com/toner-lines/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
"url" : "http://{S}tile.stamen.com/toner-lines/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
} ,
"toner-labels" : {
"url" : "http://{S}tile.stamen.com/toner-labels/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
"url" : "http://{S}tile.stamen.com/toner-labels/{Z}/{X}/{Y}.png" ,
"minZoom" : 0 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
} ,
"sterrain" : {
"url" : "http://{S}tile.stamen.com/terrain/{Z}/{X}/{Y}.jpg" ,
"minZoom" : 4 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
"url" : "http://{S}tile.stamen.com/terrain/{Z}/{X}/{Y}.jpg" ,
"minZoom" : 4 ,
"maxZoom" : 20 ,
"attribution" : "stamen"
} ,
"apple" : {
"url" : "http://gsp2.apple.com/tile?api=1&style=slideshow&layers=default&lang=en_US&z={z}&x={x}&y={y}&v=9" ,
"minZoom" : 4 ,
"maxZoom" : 20 ,
"attribution" : "apple"
"url" : "http://gsp2.apple.com/tile?api=1&style=slideshow&layers=default&lang=en_US&z={z}&x={x}&y={y}&v=9" ,
"minZoom" : 4 ,
"maxZoom" : 14 ,
"attribution" : "apple"
} ,
"watercolor" : {
"url" : "http://{S}tile.stamen.com/watercolor/{Z}/{X}/{Y}.jpg" ,
"minZoom" : 3 ,
"maxZoom" : 16 ,
"attribution" : "stamen"
"url" : "http://{S}tile.stamen.com/watercolor/{Z}/{X}/{Y}.jpg" ,
"minZoom" : 3 ,
"maxZoom" : 16 ,
"attribution" : "stamen"
}
} ,
createMap : function ( m ) {
trace ( VMM . ExternalAPI . googlemaps . stamen _map _attribution ) ;
/ * M A P P R O V I D E R S
Including Stamen Maps
http : //maps.stamen.com/
@ -2528,31 +2535,40 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
map _attribution = VMM . ExternalAPI . googlemaps . map _attribution [ VMM . ExternalAPI . googlemaps . map _providers [ name ] . attribution ] ;
return VMM . ExternalAPI . googlemaps . map _providers [ name ] ;
} else {
throw 'No such provider: "' + name + '"' ;
if ( VMM . ExternalAPI . googlemaps . defaultType ( name ) ) {
trace ( "GOOGLE MAP DEFAULT TYPE" ) ;
return google . maps . MapTypeId [ name . toUpperCase ( ) ] ;
} else {
trace ( "Not a maptype: " + name ) ;
}
}
}
google . maps . VeriteMapType = function ( name ) {
var provider = mapProvider ( name ) ;
return google . maps . ImageMapType . call ( this , {
"getTileUrl" : function ( coord , zoom ) {
var index = ( zoom + coord . x + coord . y ) % VMM . ExternalAPI . googlemaps . map _subdomains . length ;
return [
provider . url
. replace ( "{S}" , VMM . ExternalAPI . googlemaps . map _subdomains [ index ] )
. replace ( "{Z}" , zoom )
. replace ( "{X}" , coord . x )
. replace ( "{Y}" , coord . y )
. replace ( "{z}" , zoom )
. replace ( "{x}" , coord . x )
. replace ( "{y}" , coord . y )
] ;
} ,
"tileSize" : new google . maps . Size ( 256 , 256 ) ,
"name" : name ,
"minZoom" : provider . minZoom ,
"maxZoom" : provider . maxZoom
} ) ;
if ( VMM . ExternalAPI . googlemaps . defaultType ( name ) ) {
return google . maps . MapTypeId [ name . toUpperCase ( ) ] ;
} else {
var provider = mapProvider ( name ) ;
return google . maps . ImageMapType . call ( this , {
"getTileUrl" : function ( coord , zoom ) {
var index = ( zoom + coord . x + coord . y ) % VMM . ExternalAPI . googlemaps . map _subdomains . length ;
return [
provider . url
. replace ( "{S}" , VMM . ExternalAPI . googlemaps . map _subdomains [ index ] )
. replace ( "{Z}" , zoom )
. replace ( "{X}" , coord . x )
. replace ( "{Y}" , coord . y )
. replace ( "{z}" , zoom )
. replace ( "{x}" , coord . x )
. replace ( "{y}" , coord . y )
] ;
} ,
"tileSize" : new google . maps . Size ( 256 , 256 ) ,
"name" : name ,
"minZoom" : provider . minZoom ,
"maxZoom" : provider . maxZoom
} ) ;
}
} ;
google . maps . VeriteMapType . prototype = new google . maps . ImageMapType ( "_" ) ;
@ -2561,96 +2577,94 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
=== === === === === === === === === === === === === === === === == * /
var layer ;
if ( type . of ( VMM . master _config . Timeline . maptype ) == "string" ) {
layer = VMM . master _config . Timeline . maptype ;
if ( VMM . ExternalAPI . googlemaps . defaultType ( VMM . master _config . Timeline . maptype ) ) {
layer = google . maps . MapTypeId [ VMM . master _config . Timeline . maptype . toUpperCase ( ) ] ;
} else {
layer = VMM . master _config . Timeline . maptype ;
}
} else {
layer = "toner" ;
layer = "toner" ;
}
var location = new google . maps . LatLng ( 41.875696 , - 87.624207 ) ;
var location = new google . maps . LatLng ( 41.875696 , - 87.624207 ) ;
var latlong ;
var zoom = 11 ;
var has _location = false ;
var has _zoom = false ;
var zoom = 11 ;
var has _location = false ;
var has _zoom = false ;
var map _bounds ;
if ( type . of ( VMM . Util . getUrlVars ( m . url ) [ "ll" ] ) == "string" ) {
has _location = true ;
latlong = VMM . Util . getUrlVars ( m . url ) [ "ll" ] . split ( "," ) ;
location = new google . maps . LatLng ( parseFloat ( latlong [ 0 ] ) , parseFloat ( latlong [ 1 ] ) ) ;
has _location = true ;
latlong = VMM . Util . getUrlVars ( m . url ) [ "ll" ] . split ( "," ) ;
location = new google . maps . LatLng ( parseFloat ( latlong [ 0 ] ) , parseFloat ( latlong [ 1 ] ) ) ;
} else if ( type . of ( VMM . Util . getUrlVars ( m . url ) [ "sll" ] ) == "string" ) {
latlong = VMM . Util . getUrlVars ( m . url ) [ "sll" ] . split ( "," ) ;
location = new google . maps . LatLng ( parseFloat ( latlong [ 0 ] ) , parseFloat ( latlong [ 1 ] ) ) ;
latlong = VMM . Util . getUrlVars ( m . url ) [ "sll" ] . split ( "," ) ;
location = new google . maps . LatLng ( parseFloat ( latlong [ 0 ] ) , parseFloat ( latlong [ 1 ] ) ) ;
}
if ( type . of ( VMM . Util . getUrlVars ( m . url ) [ "z" ] ) == "string" ) {
has _zoom = true ;
zoom = parseFloat ( VMM . Util . getUrlVars ( m . url ) [ "z" ] ) ;
has _zoom = true ;
zoom = parseFloat ( VMM . Util . getUrlVars ( m . url ) [ "z" ] ) ;
}
var map _options = {
zoom : zoom ,
disableDefaultUI : true ,
mapTypeControl : false ,
zoomControl : true ,
zoom : zoom ,
disableDefaultUI : true ,
mapTypeControl : false ,
zoomControl : true ,
zoomControlOptions : {
style : google . maps . ZoomControlStyle . SMALL ,
position : google . maps . ControlPosition . TOP _RIGHT
style : google . maps . ZoomControlStyle . SMALL ,
position : google . maps . ControlPosition . TOP _RIGHT
} ,
center : location ,
mapTypeId : layer ,
center : location ,
mapTypeId : layer ,
mapTypeControlOptions : {
mapTypeIds : [ layer ]
mapTypeIds : [ layer ]
}
}
var unique _map _id = m . id . toString ( ) + "_gmap" ;
VMM . attachElement ( "#" + m . id , "<div class='google-map' id='" + unique _map _id + "' style='width=100%;height=100%;'></div>" ) ;
var unique _map _id = m . id . toString ( ) + "_gmap" ;
var map = new google . maps . Map ( document . getElementById ( unique _map _id ) , map _options ) ;
map . mapTypes . set ( layer , new google . maps . VeriteMapType ( layer ) ) ;
VMM . attachElement ( "#" + m . id , "<div class='google-map' id='" + unique _map _id + "' style='width=100%;height=100%;'></div>" ) ;
/ * A T T R I B U T I O N
=== === === === === === === === === === === === === === === === == * /
var map _attribution _html = "<div class='map-attribution'><div class='attribution-text'>" + map _attribution + "</div></div>" ;
VMM . appendElement ( "#" + unique _map _id , map _attribution _html ) ;
var map = new google . maps . Map ( document . getElementById ( unique _map _id ) , map _options ) ;
if ( VMM . ExternalAPI . googlemaps . defaultType ( VMM . master _config . Timeline . maptype ) ) {
} else {
map . mapTypes . set ( layer , new google . maps . VeriteMapType ( layer ) ) ;
// ATTRIBUTION
var map _attribution _html = "<div class='map-attribution'><div class='attribution-text'>" + map _attribution + "</div></div>" ;
VMM . appendElement ( "#" + unique _map _id , map _attribution _html ) ;
}
loadKML ( ) ;
/ * K M L
=== === === === === === === === === === === === === === === === == * /
// KML
function loadKML ( ) {
var kml _url = m . url + "&output=kml" ;
kml _url = kml _url . replace ( "&output=embed" , "" ) ;
var kml _layer = new google . maps . KmlLayer ( kml _url , { preserveViewport : true } ) ;
var kml _url = m . url + "&output=kml" ;
kml _url = kml _url . replace ( "&output=embed" , "" ) ;
var kml _layer = new google . maps . KmlLayer ( kml _url , { preserveViewport : true } ) ;
var infowindow = new google . maps . InfoWindow ( ) ;
kml _layer . setMap ( map ) ;
var infowindow = new google . maps . InfoWindow ( ) ;
google . maps . event . addListenerOnce ( kml _layer , "defaultviewport_changed" , function ( ) {
map . fitBounds ( kml _layer . getDefaultViewport ( ) ) ;
if ( has _location ) {
map . panTo ( location ) ;
}
if ( has _zoom ) {
map . setZoom ( zoom ) ;
}
} ) ;
google . maps . event . addListener ( kml _layer , 'click' , function ( kmlEvent ) {
var text = kmlEvent . featureData . description ;
trace ( kmlEvent . featureData . infoWindowHtml )
var text = kmlEvent . featureData . description ;
showInfoWindow ( text ) ;
function showInfoWindow ( c ) {
//trace("showInfoWindow")
infowindow . setContent ( c ) ;
infowindow . open ( map ) ;
}
@ -3170,7 +3184,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/ * P R I V A T E V A R S
=== === === === === === === === === === === === === === === === == * /
var events = { } ;
var events = { } , config ;
// ARRAYS
var data = [ ] , slides = [ ] , medias = [ ] , slide _positions = [ ] ;
var slides _content = "" ;
@ -3182,11 +3196,37 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
var layout = parent ;
// ELEMENTS
var $slider , $slider _mask , $slider _container , $slides _items ;
// CONFIG
var config = { slider : { width : 720 , height : 400 , content : { width : 720 , height : 400 , padding : 130 } , nav : { width : 100 , height : 200 } } } ;
var _config = { interval : 10 , something : 0 , width : 720 , height : 400 , ease : "easeInOutExpo" , duration : 1000 , timeline : false , spacing : 15 } ;
// NAVIGATION
var navigation = { nextBtn : "" , prevBtn : "" , nextDate : "" , prevDate : "" , nextTitle : "" , prevTitle : "" } ;
// CONFIG
if ( typeof VMM . Timeline != 'undefined' ) {
config = VMM . Timeline . Config ;
} else {
config = {
current _slide : 0 ,
interval : 10 ,
something : 0 ,
width : 720 ,
height : 400 ,
ease : "easeInOutExpo" ,
duration : 1000 ,
timeline : false ,
spacing : 15 ,
slider : {
width : 720 ,
height : 400 ,
content : {
width : 720 ,
height : 400 ,
padding : 130
} ,
nav : {
width : 100 ,
height : 200
}
}
} ;
}
/ * P U B L I C V A R S
=== === === === === === === === === === === === === === === === == * /
@ -3194,7 +3234,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/ * A P P L Y S U P P L I E D C O N F I G
=== === === === === === === === === === === === === === === === == * /
/ *
if ( type . of ( parent _config ) == 'object' ) {
var x ;
for ( x in parent _config ) {
@ -3210,11 +3250,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
}
}
}
* /
config . slider . width = config . width ;
config . slider . height = config . height ;
/ * P U B L I C F U N C T I O N S
=== === === === === === === === === === === === === === === === == * /
this . init = function ( d ) {
@ -3261,8 +3300,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
this . setConfig = function ( d ) {
if ( typeof d != 'undefined' ) {
config = d ;
// TO DO
// FIRE AN EVENT ETC
} else {
trace ( "NO CONFIG DATA" ) ;
}
@ -3414,6 +3451,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/ * U P D A T E
=== === === === === === === === === === === === === === === === == * /
function upDate ( ) {
config . current _slide = current _slide ;
VMM . fireEvent ( layout , "UPDATE" ) ;
} ;
@ -3744,7 +3782,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
reSize ( false , true ) ;
VMM . Element . visible ( navigation . prevBtn , false ) ;
// GO TO FIRST SLIDE
goToSlide ( 0 , "easeOutExpo" , _ _duration , true , true ) ;
trace ( "config.current_slide " + config . current _slide ) ;
goToSlide ( config . current _slide , "easeOutExpo" , _ _duration , true , true ) ;
_active = true ;
} ;
@ -4826,7 +4865,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
var $timeline , $feedback , $messege , slider , timenav , version , timeline _id ;
var events = { } , data = { } , _dates = [ ] , config = { } ;
var has _width = false , has _height = false , ie7 = false ;
var has _width = false , has _height = false , ie7 = false , is _moving = false ;
if ( type . of ( _timeline _id ) == "string" ) {
timeline _id = _timeline _id ;
@ -4834,7 +4873,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
timeline _id = "#timeline" ;
}
version = "0.98.5 " ;
version = "0.98.6 " ;
trace ( "TIMELINE VERSION " + version ) ;
@ -4844,6 +4883,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
id : timeline _id ,
type : "timeline" ,
maptype : "toner" ,
current _slide : 0 ,
hash _bookmark : false ,
start _at _end : false ,
start _page : false ,
interval : 10 ,
something : 0 ,
@ -4905,10 +4947,24 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
has _height = true ;
}
if ( window . location . hash ) {
var hash = window . location . hash . substring ( 1 ) ;
config . current _slide = parseInt ( hash ) ;
}
window . onhashchange = function ( ) {
if ( config . hash _bookmark ) {
if ( is _moving ) {
var hash = window . location . hash . substring ( 1 ) ;
goToEvent ( parseInt ( hash ) ) ;
} else {
is _moving = false ;
}
}
}
/ * C R E A T E C O N F I G
=== === === === === === === === === === === === === === === === == * /
var createConfig = function ( conf ) {
// APPLY SUPPLIED CONFIG TO TIMELINE CONFIG
if ( typeof timeline _config == 'object' ) {
@ -4928,13 +4984,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
}
}
config . nav . width = config . width ;
config . nav . height = 200 ;
config . feature . width = config . width ;
config . feature . height = config . height - config . nav . height ;
VMM . Timeline . Config = config ;
VMM . master _config . Timeline = VMM . Timeline . Config ;
config . nav . width = config . width ;
config . nav . height = 200 ;
config . feature . width = config . width ;
config . feature . height = config . height - config . nav . height ;
VMM . Timeline . Config = config ;
VMM . master _config . Timeline = VMM . Timeline . Config ;
}
/ * C R E A T E T I M E L I N E S T R U C T U R E
@ -5009,13 +5064,33 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
}
function onSlideUpdate ( e ) {
timenav . setMarker ( slider . getCurrentNumber ( ) , config . ease , config . duration ) ;
is _moving = true ;
config . current _slide = slider . getCurrentNumber ( ) ;
setHash ( config . current _slide ) ;
timenav . setMarker ( config . current _slide , config . ease , config . duration ) ;
} ;
function onMarkerUpdate ( e ) {
slider . setSlide ( timenav . getCurrentNumber ( ) ) ;
is _moving = true ;
config . current _slide = timenav . getCurrentNumber ( ) ;
setHash ( config . current _slide ) ;
slider . setSlide ( config . current _slide ) ;
} ;
var goToEvent = function ( n ) {
if ( n <= _dates . length - 1 && n >= 0 ) {
config . current _slide = n ;
slider . setSlide ( config . current _slide ) ;
timenav . setMarker ( config . current _slide , config . ease , config . duration ) ;
}
}
function setHash ( n ) {
if ( config . hash _bookmark ) {
window . location . hash = "#" + n . toString ( ) ;
}
}
/ * P U B L I C F U N C T I O N S
=== === === === === === === === === === === === === === === === == * /
this . init = function ( _data , _timeline _id , conf ) {
@ -5089,27 +5164,25 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
=== === === === === === === === === === === === === === === === == * /
var build = function ( ) {
/ * C R E A T E D O M S T R U C T U R E
=== === === === === === === === === === === === === === === === == * /
// START AT END?
if ( config . start _at _end ) {
config . current _slide = _dates . length - 1 ;
}
// CREATE DOM STRUCTURE
VMM . attachElement ( $timeline , "" ) ;
VMM . appendElement ( $timeline , "<div class='container main'><div class='feature'><div class='slider'></div></div><div class='navigation'></div></div>" ) ;
reSize ( ) ;
/ * I N I T T H E O B J E C T S
=== === === === === === === === === === === === === === === === == * /
VMM . bindEvent ( "div.slider" , onSliderLoaded , "LOADED" ) ;
VMM . bindEvent ( "div.navigation" , onTimeNavLoaded , "LOADED" ) ;
VMM . bindEvent ( "div.slider" , onSlideUpdate , "UPDATE" ) ;
VMM . bindEvent ( "div.navigation" , onMarkerUpdate , "UPDATE" ) ;
slider . init ( _dates ) ;
timenav . init ( _dates , data . era ) ;
/ * R E S I Z E E V E N T L I S T E N E R S
=== === === === === === === === === === === === === === === === == * /
// RESIZE EVENT LISTENERS
VMM . bindEvent ( global , reSize , "resize" ) ;
//VMM.bindEvent(global, function(e) {e.preventDefault()}, "touchmove");
@ -5436,7 +5509,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
function reSize ( firstrun ) {
VMM . Element . css ( $timenavline , "left" , Math . round ( config . width / 2 ) + 2 ) ;
goToMarker ( current _marker , config . ease , config . duration , true , firstrun ) ;
goToMarker ( config . current _slide , config . ease , config . duration , true , firstrun ) ;
} ;
function upDate ( ) {
@ -5535,9 +5608,9 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM . Element . removeClass ( markers [ i ] . marker , "active" ) ;
}
if ( config . start _page && markers [ current _marker ] . type == "start" ) {
VMM . Element . visible ( markers [ current _marker ] . marker , false ) ;
VMM . Element . addClass ( markers [ current _marker ] . marker , "start" ) ;
if ( config . start _page && markers [ 0 ] . type == "start" ) {
VMM . Element . visible ( markers [ 0 ] . marker , false ) ;
VMM . Element . addClass ( markers [ 0 ] . marker , "start" ) ;
}
VMM . Element . addClass ( markers [ current _marker ] . marker , "active" ) ;
@ -6242,7 +6315,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
positionMarkers ( ) ;
positionInterval ( interval _array , false , true ) ;
positionInterval ( interval _major _array ) ;
reSize ( true ) ;
//reSize(true);
if ( config . start _page ) {
$backhome = VMM . appendAndGetElement ( $toolbar , "<div>" , "back-home" , "<div class='icon'></div>" ) ;
@ -6271,11 +6344,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM . DragSlider . createPanel ( layout , $timenav , config . width , config . spacing , false ) ;
}
VMM . bindEvent ( ".zoom-in" , onZoomIn , "click" ) ;
VMM . bindEvent ( ".zoom-out" , onZoomOut , "click" ) ;
VMM . fireEvent ( layout , "LOADED" ) ;
_active = true ;
reSize ( true ) ;
} ;
var buildInterval = function ( ) {