/ * E x t e r n a l A P I
=== === === === === === === === === === === === === === === === == * /
if ( typeof VMM != 'undefined' && typeof VMM . ExternalAPI == 'undefined' ) {
VMM . ExternalAPI = {
pushQues : function ( ) {
if ( VMM . master _config . googlemaps . active ) {
VMM . ExternalAPI . googlemaps . pushQue ( ) ;
}
if ( VMM . master _config . youtube . active ) {
VMM . ExternalAPI . youtube . pushQue ( ) ;
}
if ( VMM . master _config . soundcloud . active ) {
VMM . ExternalAPI . soundcloud . pushQue ( ) ;
}
if ( VMM . master _config . googledocs . active ) {
VMM . ExternalAPI . googledocs . pushQue ( ) ;
}
} ,
twitter : {
tweetArray : [ ] ,
// VMM.ExternalAPI.twitter.getHTML(id);
getHTML : function ( id ) {
//var the_url = document.location.protocol + "//api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?";
var the _url = "http://api.twitter.com/1/statuses/oembed.json?id=" + id + "&callback=?" ;
VMM . getJSON ( the _url , VMM . ExternalAPI . twitter . onJSONLoaded ) ;
} ,
onJSONLoaded : function ( d ) {
trace ( "TWITTER JSON LOADED" ) ;
var id = d . id ;
VMM . attachElement ( "#" + id , VMM . Util . linkify _with _twitter ( d . html ) ) ;
} ,
// VMM.ExternalAPI.twitter.parseTwitterDate(date);
parseTwitterDate : function ( d ) {
var date = new Date ( Date . parse ( d ) ) ;
/ *
var t = d . replace ( /(\d{1,2}[:]\d{2}[:]\d{2}) (.*)/ , '$2 $1' ) ;
t = t . replace ( /(\+\S+) (.*)/ , '$2 $1' ) ;
var date = new Date ( Date . parse ( t ) ) . toLocaleDateString ( ) ;
var time = new Date ( Date . parse ( t ) ) . toLocaleTimeString ( ) ;
* /
return date ;
} ,
prettyParseTwitterDate : function ( d ) {
var date = new Date ( Date . parse ( d ) ) ;
return VMM . Util . date . prettyDate ( date , true ) ;
} ,
// VMM.ExternalAPI.twitter.getTweets(tweets_array);
getTweets : function ( tweets ) {
var tweetArray = [ ] ;
var number _of _tweets = tweets . length ;
for ( var i = 0 ; i < tweets . length ; i ++ ) {
var twitter _id = "" ;
/ * F I N D T H E T W I T T E R I D
=== === === === === === === === === === === === === === === === == * /
if ( tweets [ i ] . tweet . match ( "status\/" ) ) {
twitter _id = tweets [ i ] . tweet . split ( "status\/" ) [ 1 ] ;
} else if ( tweets [ i ] . tweet . match ( "statuses\/" ) ) {
twitter _id = tweets [ i ] . tweet . split ( "statuses\/" ) [ 1 ] ;
} else {
twitter _id = "" ;
}
/ * F E T C H T H E D A T A
=== === === === === === === === === === === === === === === === == * /
var the _url = "http://api.twitter.com/1/statuses/show.json?id=" + twitter _id + "&include_entities=true&callback=?" ;
VMM . getJSON ( the _url , function ( d ) {
var tweet = { }
/ * F O R M A T R E S P O N S E
=== === === === === === === === === === === === === === === === == * /
var twit = "<div class='twitter'><blockquote><p>" ;
var td = VMM . Util . linkify _with _twitter ( d . text , "_blank" ) ;
twit += td ;
twit += "</p>" ;
twit += "— " + d . user . name + " (<a href='https://twitter.com/" + d . user . screen _name + "'>@" + d . user . screen _name + "</a>) <a href='https://twitter.com/" + d . user . screen _name + "/status/" + d . id + "'>" + VMM . ExternalAPI . twitter . prettyParseTwitterDate ( d . created _at ) + " </a></blockquote></div>" ;
tweet . content = twit ;
tweet . raw = d ;
tweetArray . push ( tweet ) ;
/ * C H E C K I F T H A T S A L L O F T H E M
=== === === === === === === === === === === === === === === === == * /
if ( tweetArray . length == number _of _tweets ) {
var the _tweets = { tweetdata : tweetArray }
VMM . fireEvent ( global , "TWEETSLOADED" , the _tweets ) ;
}
} )
. success ( function ( ) { trace ( "second success" ) ; } )
. error ( function ( ) { trace ( "error" ) ; } )
. complete ( function ( ) { trace ( "complete" ) ; } ) ;
}
} ,
// VMM.ExternalAPI.twitter.getTweetSearch(search string);
getTweetSearch : function ( tweets , number _of _tweets ) {
var _number _of _tweets = 40 ;
if ( number _of _tweets != null && number _of _tweets != "" ) {
_number _of _tweets = number _of _tweets ;
}
var the _url = "http://search.twitter.com/search.json?q=" + tweets + "&rpp=" + _number _of _tweets + "&include_entities=true&result_type=mixed" ;
var tweetArray = [ ] ;
VMM . getJSON ( the _url , function ( d ) {
/ * F O R M A T R E S P O N S E
=== === === === === === === === === === === === === === === === == * /
for ( var i = 0 ; i < d . results . length ; i ++ ) {
var tweet = { }
var twit = "<div class='twitter'><blockquote><p>" ;
var td = VMM . Util . linkify _with _twitter ( d . results [ i ] . text , "_blank" ) ;
twit += td ;
twit += "</p>" ;
twit += "— " + d . results [ i ] . from _user _name + " (<a href='https://twitter.com/" + d . results [ i ] . from _user + "'>@" + d . results [ i ] . from _user + "</a>) <a href='https://twitter.com/" + d . results [ i ] . from _user + "/status/" + d . id + "'>" + VMM . ExternalAPI . twitter . prettyParseTwitterDate ( d . results [ i ] . created _at ) + " </a></blockquote></div>" ;
tweet . content = twit ;
tweet . raw = d . results [ i ] ;
tweetArray . push ( tweet ) ;
}
var the _tweets = { tweetdata : tweetArray }
VMM . fireEvent ( global , "TWEETSLOADED" , the _tweets ) ;
} ) ;
} ,
prettyHTML : function ( id ) {
var id = id . toString ( ) ;
var error _obj = {
twitterid : id
} ;
var the _url = "http://api.twitter.com/1/statuses/show.json?id=" + id + "&include_entities=true&callback=?" ;
trace ( "id " + id ) ;
var twitter _timeout = setTimeout ( VMM . ExternalAPI . twitter . notFoundError , 4000 , id ) ;
VMM . getJSON ( the _url , VMM . ExternalAPI . twitter . formatJSON )
. error ( function ( jqXHR , textStatus , errorThrown ) {
trace ( "TWITTER error" ) ;
trace ( "TWITTER ERROR: " + textStatus + " " + jqXHR . responseText ) ;
VMM . attachElement ( "#twitter_" + id , "<p>ERROR LOADING TWEET " + id + "</p>" ) ;
} )
. success ( function ( ) {
clearTimeout ( twitter _timeout ) ;
} ) ;
} ,
notFoundError : function ( id ) {
trace ( "TWITTER JSON ERROR TIMEOUT " + id ) ;
VMM . attachElement ( "#twitter_" + id , "<span class='messege'><p>Error loading tweet: " + id + "</p></span>" ) ;
// CHECK RATE STATUS
VMM . getJSON ( "http://api.twitter.com/1/account/rate_limit_status.json" , function ( d ) {
trace ( "REMAINING TWITTER API CALLS " + d . remaining _hits ) ;
trace ( "TWITTER RATE LIMIT WILL RESET AT " + d . reset _time ) ;
var mes = "" ;
if ( d . remaining _hits == 0 ) {
mes = "<p>You've reached the maximum number of tweets you can load in an hour.</p>" ;
mes += "<p>You can view tweets again starting at: <br/>" + d . reset _time + "</p>" ;
} else {
mes = "<p>Tweet " + id + " was not found.</p>" ;
}
VMM . attachElement ( "#twitter_" + id , "<span class='messege'>" + mes + "</span>" ) ;
} ) ;
} ,
formatJSON : function ( d ) {
trace ( "TWITTER JSON LOADED F" ) ;
trace ( d ) ;
var id = d . id _str ;
var twit = "<blockquote><p>" ;
var td = VMM . Util . linkify _with _twitter ( d . text , "_blank" ) ;
//td = td.replace(/(@([\w]+))/g,"<a href='http://twitter.com/$2' target='_blank'>$1</a>");
//td = td.replace(/(#([\w]+))/g,"<a href='http://twitter.com/#search?q=%23$2' target='_blank'>$1</a>");
twit += td ;
twit += "</p></blockquote>" ;
twit += " <a href='https://twitter.com/" + d . user . screen _name + "/status/" + d . id + "' target='_blank' alt='link to original tweet' title='link to original tweet'>" + "<span class='created-at'></span>" + " </a>" ;
twit += "<div class='vcard author'>" ;
twit += "<a class='screen-name url' href='https://twitter.com/" + d . user . screen _name + "' data-screen-name='" + d . user . screen _name + "' target='_blank'>" ;
twit += "<span class='avatar'><img src=' " + d . user . profile _image _url + "' alt=''></span>" ;
twit += "<span class='fn'>" + d . user . name + "</span>" ;
twit += "<span class='nickname'>@" + d . user . screen _name + "</span>" ;
twit += "</a>" ;
twit += "</div>" ;
VMM . attachElement ( "#twitter_" + id . toString ( ) , twit ) ;
}
} ,
googlemaps : {
get : function ( url , id ) {
var timer ;
var map _vars = VMM . Util . getUrlVars ( url ) ;
var api _key ;
if ( VMM . master _config . Timeline . api _keys . google != "" ) {
api _key = VMM . master _config . Timeline . api _keys . google ;
} else {
api _key = Aes . Ctr . decrypt ( VMM . master _config . api _keys _master . google , VMM . master _config . vp , 256 ) ;
}
var map _url = "http://maps.googleapis.com/maps/api/js?key=" + api _key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady" ;
var map = { url : url , vars : map _vars , id : id } ;
if ( VMM . master _config . googlemaps . active ) {
VMM . master _config . googlemaps . que . push ( map ) ;
} else {
VMM . master _config . googlemaps . que . push ( map ) ;
if ( VMM . master _config . googlemaps . api _loaded ) {
} else {
VMM . LoadLib . js ( map _url , function ( ) {
trace ( "Google Maps API Library Loaded" ) ;
} ) ;
}
}
} ,
create : function ( m ) {
var map _attribution = "" ;
var layer ;
var map ;
function mapProvider ( name ) {
if ( name in VMM . ExternalAPI . googlemaps . map _providers ) {
map _attribution = VMM . ExternalAPI . googlemaps . map _attribution [ VMM . ExternalAPI . googlemaps . map _providers [ name ] . attribution ] ;
return VMM . ExternalAPI . googlemaps . map _providers [ name ] ;
} else {
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 ) {
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 ( "_" ) ;
/ * M a k e t h e M a p
=== === === === === === === === === === === === === === === === == * /
if ( type . of ( VMM . master _config . Timeline . maptype ) == "string" ) {
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" ;
}
var location = new google . maps . LatLng ( 41.875696 , - 87.624207 ) ;
var latlong ;
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 ] ) ) ;
} 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 ] ) ) ;
}
if ( type . of ( VMM . Util . getUrlVars ( m . url ) [ "z" ] ) == "string" ) {
has _zoom = true ;
zoom = parseFloat ( VMM . Util . getUrlVars ( m . url ) [ "z" ] ) ;
}
var map _options = {
zoom : zoom ,
disableDefaultUI : true ,
mapTypeControl : false ,
zoomControl : true ,
zoomControlOptions : {
style : google . maps . ZoomControlStyle . SMALL ,
position : google . maps . ControlPosition . TOP _RIGHT
} ,
center : location ,
mapTypeId : layer ,
mapTypeControlOptions : {
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 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 ( ) ;
// 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 infowindow = new google . maps . InfoWindow ( ) ;
kml _layer . setMap ( map ) ;
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 ;
showInfoWindow ( text ) ;
function showInfoWindow ( c ) {
infowindow . setContent ( c ) ;
infowindow . open ( map ) ;
}
} ) ;
}
} ,
pushQue : function ( ) {
for ( var i = 0 ; i < VMM . master _config . googlemaps . que . length ; i ++ ) {
VMM . ExternalAPI . googlemaps . create ( VMM . master _config . googlemaps . que [ i ] ) ;
}
VMM . master _config . googlemaps . que = [ ] ;
} ,
onMapAPIReady : function ( ) {
VMM . master _config . googlemaps . map _active = true ;
VMM . master _config . googlemaps . places _active = true ;
VMM . ExternalAPI . googlemaps . onAPIReady ( ) ;
} ,
onPlacesAPIReady : function ( ) {
VMM . master _config . googlemaps . places _active = true ;
VMM . ExternalAPI . googlemaps . onAPIReady ( ) ;
} ,
onAPIReady : function ( ) {
if ( ! VMM . master _config . googlemaps . active ) {
if ( VMM . master _config . googlemaps . map _active && VMM . master _config . googlemaps . places _active ) {
VMM . master _config . googlemaps . active = true ;
VMM . ExternalAPI . googlemaps . pushQue ( ) ;
}
}
} ,
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"
} ,
map _providers : {
"toner" : {
"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"
} ,
"toner-labels" : {
"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"
} ,
"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"
}
} ,
} ,
googledocs : {
get : function ( url , id ) {
var doc = { url : url , id : id } ;
VMM . master _config . googledocs . que . push ( doc ) ;
VMM . master _config . googledocs . active = true ;
} ,
create : function ( doc ) {
var mediaElem = "" ;
if ( doc . url . match ( /docs.google.com/i ) ) {
mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + doc . url + "&embedded=true'></iframe>" ;
} else {
mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='http://docs.google.com/viewer?url=" + doc . url + "&embedded=true'></iframe>" ;
}
VMM . attachElement ( "#" + doc . id , mediaElem ) ;
} ,
pushQue : function ( ) {
for ( var i = 0 ; i < VMM . master _config . googledocs . que . length ; i ++ ) {
VMM . ExternalAPI . googledocs . create ( VMM . master _config . googledocs . que [ i ] ) ;
}
VMM . master _config . googledocs . que = [ ] ;
}
} ,
flickr : {
get : function ( mid , id ) {
var api _key ;
if ( VMM . master _config . Timeline . api _keys . flickr != "" ) {
api _key = VMM . master _config . Timeline . api _keys . flickr ;
} else {
api _key = Aes . Ctr . decrypt ( VMM . master _config . api _keys _master . flickr , VMM . master _config . vp , 256 )
}
var the _url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + api _key + "&photo_id=" + mid + "&format=json&jsoncallback=?" ;
VMM . getJSON ( the _url , VMM . ExternalAPI . flickr . create ) ;
} ,
create : function ( d ) {
var flickr _id = d . sizes . size [ 0 ] . url . split ( "photos\/" ) [ 1 ] . split ( "/" ) [ 1 ] ;
var id = "flickr_" + flickr _id ;
var flickr _large _id = id + "_large" ;
var flickr _thumb _id = id + "_thumb" ;
// FIND LARGE SIZE
var flickr _img _large ;
var flickr _large _found = false ;
for ( var i = 0 ; i < d . sizes . size . length ; i ++ ) {
if ( d . sizes . size [ i ] . label == "Large" ) {
flickr _large _found = true ;
flickr _img _large = d . sizes . size [ i ] . source ;
}
}
if ( ! flickr _large _found ) {
flickr _img _large = d . sizes . size [ d . sizes . size . length - 1 ] . source ;
}
var flickr _img _thumb = d . sizes . size [ 0 ] . source ;
VMM . Lib . attr ( "#" + flickr _large _id , "src" , flickr _img _large ) ;
VMM . Lib . attr ( "#" + flickr _thumb _id , "src" , flickr _img _thumb ) ;
}
} ,
soundcloud : {
get : function ( url , id ) {
var sound = { url : url , id : id } ;
VMM . master _config . soundcloud . que . push ( sound ) ;
VMM . master _config . soundcloud . active = true ;
} ,
create : function ( sound ) {
var the _url = "http://soundcloud.com/oembed?url=" + sound . url + "&format=js&callback=?" ;
VMM . getJSON ( the _url , function ( d ) {
VMM . attachElement ( "#" + sound . id , d . html ) ;
} ) ;
} ,
pushQue : function ( ) {
for ( var i = 0 ; i < VMM . master _config . soundcloud . que . length ; i ++ ) {
VMM . ExternalAPI . soundcloud . create ( VMM . master _config . soundcloud . que [ i ] ) ;
}
VMM . master _config . soundcloud . que = [ ] ;
} ,
} ,
youtube : {
get : function ( id ) {
if ( VMM . master _config . youtube . active ) {
VMM . master _config . youtube . que . push ( id ) ;
} else {
VMM . master _config . youtube . que . push ( id ) ;
if ( ! VMM . master _config . youtube . api _loaded ) {
VMM . LoadLib . js ( 'http://www.youtube.com/player_api' , function ( ) {
trace ( "YouTube API Library Loaded" ) ;
} ) ;
}
}
} ,
create : function ( id ) {
var p = {
active : false ,
player : { } ,
name : 'youtube_' + id ,
playing : false
} ;
p . player [ 'youtube_' + id ] = new YT . Player ( 'youtube_' + id , {
height : '390' ,
width : '640' ,
playerVars : {
enablejsapi : 1 ,
color : 'white' ,
showinfo : 0 ,
theme : 'light' ,
rel : 0
} ,
videoId : id ,
events : {
'onReady' : VMM . ExternalAPI . youtube . onPlayerReady ,
'onStateChange' : VMM . ExternalAPI . youtube . onStateChange
}
} ) ;
VMM . master _config . youtube . array . push ( p ) ;
} ,
pushQue : function ( ) {
for ( var i = 0 ; i < VMM . master _config . youtube . que . length ; i ++ ) {
VMM . ExternalAPI . youtube . create ( VMM . master _config . youtube . que [ i ] ) ;
}
VMM . master _config . youtube . que = [ ] ;
} ,
onAPIReady : function ( ) {
VMM . master _config . youtube . active = true ;
VMM . ExternalAPI . youtube . pushQue ( ) ;
} ,
stopPlayers : function ( ) {
for ( var i = 0 ; i < VMM . master _config . youtube . array . length ; i ++ ) {
if ( VMM . master _config . youtube . array [ i ] . playing ) {
var the _name = VMM . master _config . youtube . array [ i ] . name ;
VMM . master _config . youtube . array [ i ] . player [ the _name ] . stopVideo ( ) ;
}
}
} ,
onStateChange : function ( e ) {
for ( var i = 0 ; i < VMM . master _config . youtube . array . length ; i ++ ) {
var the _name = VMM . master _config . youtube . array [ i ] . name ;
if ( VMM . master _config . youtube . array [ i ] . player [ the _name ] == e . target ) {
if ( e . data == YT . PlayerState . PLAYING ) {
VMM . master _config . youtube . array [ i ] . playing = true ;
}
}
}
} ,
onPlayerReady : function ( e ) {
}
}
}
}
/ * Y O U T U B E A P I R E A D Y
Can ' t find a way to customize this callback and keep it in the VMM namespace
Youtube wants it to be this function .
=== === === === === === === === === === === === === === === === == * /
function onYouTubePlayerAPIReady ( ) {
trace ( "GLOBAL YOUTUBE API CALLED" )
VMM . ExternalAPI . youtube . onAPIReady ( ) ;
}