From 9b8a24a7360416d5750828c9580e33dd336ff882 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Fri, 16 Mar 2012 17:57:18 -0700 Subject: Getting ownerComponent bindings --- node_modules/montage/ui/text-input.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/text-input.js b/node_modules/montage/ui/text-input.js index cdd20c78..d707fa69 100644 --- a/node_modules/montage/ui/text-input.js +++ b/node_modules/montage/ui/text-input.js @@ -79,6 +79,28 @@ var TextInput = exports.TextInput = Montage.create(NativeControl, { } }, + _valueBinding: { + value: null + }, + + valueBinding: { + get: function() { + return this._valueBinding; + }, + set: function(value) { + if (this._valueBinding !== value) { + if (this._valueBinding !== null) { + Object.deleteBinding(this, "value"); + } + this._valueBinding = value; + if (String.isString(value)) { + Object.defineBinding(this, "value", {boundObject: this.ownerComponent, boundObjectPropertyPath: value}); + + } + } + } + }, + // set value from user input /** @private -- cgit v1.2.3 From 1d0efc758bc9404eebbc8b8d592de9dbb329899e Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 11:21:22 -0700 Subject: Adding feed reader and map --- .../ui/feed-reader/feed-entry.reel/feed-entry.html | 90 +++++++ .../ui/feed-reader/feed-entry.reel/feed-entry.js | 13 + .../feed-reader/feed-reader.reel/feed-reader.html | 83 ++++++ .../ui/feed-reader/feed-reader.reel/feed-reader.js | 82 ++++++ node_modules/montage/ui/map.reel/map.css | 9 + node_modules/montage/ui/map.reel/map.html | 58 +++++ node_modules/montage/ui/map.reel/map.js | 283 +++++++++++++++++++++ node_modules/montage/ui/template.js | 6 +- 8 files changed, 621 insertions(+), 3 deletions(-) create mode 100644 node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html create mode 100644 node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js create mode 100644 node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html create mode 100644 node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js create mode 100644 node_modules/montage/ui/map.reel/map.css create mode 100644 node_modules/montage/ui/map.reel/map.html create mode 100644 node_modules/montage/ui/map.reel/map.js (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html new file mode 100644 index 00000000..213b4602 --- /dev/null +++ b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.html @@ -0,0 +1,90 @@ + + + + + Feed Entry + + + + + + + +
+ +

+

+
+ + + diff --git a/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js new file mode 100644 index 00000000..3d97eec7 --- /dev/null +++ b/node_modules/montage/ui/feed-reader/feed-entry.reel/feed-entry.js @@ -0,0 +1,13 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; + +exports.FeedEntry = Montage.create(Component, { + + entry: {value: null} + +}); diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html new file mode 100644 index 00000000..a3523001 --- /dev/null +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.html @@ -0,0 +1,83 @@ + + + + + Feed Reader + + + + + + + + + + +
+ +
+
+
+ + +
+ + + diff --git a/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js new file mode 100644 index 00000000..838a957d --- /dev/null +++ b/node_modules/montage/ui/feed-reader/feed-reader.reel/feed-reader.js @@ -0,0 +1,82 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; + //Notifier = require("ui/popup/notifier.reel").Notifier; + +exports.FeedReader = Montage.create(Component, { + + didCreate: { + value: function() { + var self = this; + var apiInit = function() { + console.log('google api initialized'); + + google.load("feeds", "1", { + callback: function() { + console.log('google feeds api loaded'); + self.needsDraw = true; + window.initGoogleAPI = null; + } + }); + }; + + // set up a global function + window.initGoogleAPI = apiInit; + } + }, + + _feedURL: {value: null}, + feedURL: { + get: function() { + return this._feedURL; + }, + set: function(value) { + this._feedURL = value; + // execute the search and get the entries + this._fetchFeed(); + } + }, + + entries: {value: null}, + + + _startLoading: { + value: function() { + //Notifier.show('Loading ... please wait', null, {top: this.element.style.top, left: this.element.style.left + 20}); + } + }, + + _stopLoading: { + value: function() { + //Notifier.hide(); + } + }, + + _fetchFeed: { + value: function() { + var url = this.feedURL; + var feed = new google.feeds.Feed(url); + feed.setNumEntries(10); + + var self = this; + + this._startLoading(); + self.entries = []; + + feed.load(function(result) { + self._stopLoading(); + if(result.error) { + self.entries = []; + } else { + //console.log('entries: ', result.feed.entries); + self.entries = result.feed.entries; + } + }); + } + } + +}); diff --git a/node_modules/montage/ui/map.reel/map.css b/node_modules/montage/ui/map.reel/map.css new file mode 100644 index 00000000..45307593 --- /dev/null +++ b/node_modules/montage/ui/map.reel/map.css @@ -0,0 +1,9 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +.montage-google-map { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/node_modules/montage/ui/map.reel/map.html b/node_modules/montage/ui/map.reel/map.html new file mode 100644 index 00000000..a6ac5303 --- /dev/null +++ b/node_modules/montage/ui/map.reel/map.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + +
+
+ Show: + +
+
MAP
+ +
+ + + diff --git a/node_modules/montage/ui/map.reel/map.js b/node_modules/montage/ui/map.reel/map.js new file mode 100644 index 00000000..1e4f452c --- /dev/null +++ b/node_modules/montage/ui/map.reel/map.js @@ -0,0 +1,283 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + + @requires montage/core/core + @requires montage/ui/component +*/ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; + +/** + @class module:"montage/ui/google/map.reel".Map + @extends module:montage/ui/component.Component + */ +var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ { + + didCreate: { + value: function() { + var self = this; + window.initialize = function initialize() { + console.log('google maps api loaded'); + self._mapLoaded = true; + self._geoCoder = new google.maps.Geocoder(); + self.needsDraw = true; + }; + } + }, + + _geoCoder: {value: null}, + + // HTMLElement to load the Map into + mapEl: {value: null}, + + _mapLoaded: { + enumerable: false, + value: false + }, + _map: { + enumerable: false, + value: false + }, + _latitude: { + enumerable: false, + value: -34.397 + }, + latitude: { + enumerable: false, + set: function(value) { + this._latitude = value; + this.needsDraw = true; + }, + get: function() { + return this._latitude; + } + }, + _longitude: { + enumerable: false, + value: -34.397 + }, + longitude: { + enumerable: false, + set: function(value) { + this._longitude = value; + this.needsDraw = true; + }, + get: function() { + return this._longitude; + } + }, + + defaultLatLng: { + value: {lat: -34.397, lng: 150.644} + }, + + _latLng: { + value: this.defaultLatLng, + distinct: true + }, + latLng: { + get: function() { + return this._latLng; + }, + set: function(value) { + if(value) { + this._latLng = value; + // refresh the map + this.needsDraw = true; + } + } + }, + + // {lat, lon} Or a String representing the location (eg: Paris, France) + center: { + get: function() { + return this._center; + }, + set: function(value) { + if(value) { + var self = this, geocoder = this._geoCoder; + this._center = value; + if(this._mapLoaded) { + + if(String.isString(value)) { + // geocode + geocoder.geocode( { 'address': value}, function(results, status) { + if (status == google.maps.GeocoderStatus.OK) { + var loc = results[0].geometry.location; + self.latLng = {lat: loc.lat(), lng: loc.lng()}; + } else { + console.log('Geocode was not successful : ' + status); + } + }); + } else if(value.lat && value.lng) { + this.latLng = value; + } else { + // default location + this.latLng = this.defaultLatLng; + } + + } + + } + + } + }, + + category: { + get: function() { + return this._category; + }, + set: function(value) { + if(value) { + this._category = value; + this._getPlaces(this._category); + this.needsDraw = true; + } + } + }, + + zoom: { + value: 8 + }, + + __places: {value: null}, + _places: { + get: function() { + return this.__places; + }, + set: function(value) { + if(value) { + this.__places = value; + this.needsDraw = true; + } + } + }, + + _getPlaces: { + value: function(type, keyword) { + var self = this; + var request = { + location: new window.google.maps.LatLng(this.latLng.lat, this.latLng.lng), + radius: 5000, + types: [type] + }; + if(!this._infoWindow) { + this._infoWindow = new google.maps.InfoWindow(); + } + var service = new google.maps.places.PlacesService(this._map); + service.search(request, function(results, status) { + if (status == google.maps.places.PlacesServiceStatus.OK) { + self._places = results; + } else { + self._places = []; + } + }); + } + }, + + _infoWindow: {value: null}, + _markers: {value: null}, + _createMarker: { + value: function(place) { + var placeLoc = place.geometry.location, map = this._map; + var icon, image; + switch(this.category) { + case 'restaurant': + icon = '48-fork-and-knife.png'; + break; + case 'hospital': + icon = '10-medical.png'; + break; + case 'cafe': + icon = '34-coffee.png'; + break; + case 'museum': + icon = '41-picture-frame.png'; + break; + }; + if(icon) { + image = new google.maps.MarkerImage('images/' + icon); + } + var options = { + map: map, + position: place.geometry.location + }; + if(image) { + options.icon = image; + } + + var marker = new google.maps.Marker(options); + if(!this._markers) { + this._markers = []; + } + this._markers.push(marker); + + var infoWindow = this._infoWindow; + google.maps.event.addListener(marker, 'click', function() { + infoWindow.setContent(place.name + '
' + place.vicinity); + infoWindow.open(map, this); + }); + } + }, + + _removeAllMarkers: { + value: function() { + if(this._markers && this._markers.length > 0) { + var i=0, len = this._markers.length; + for(i; i< len; i++) { + this._markers[i].setMap(null); + } + this._markers = []; + } + } + }, + + +/** + Description TODO + @function + */ + draw: { + enumerable: false, + value: function () { + + if(this._mapLoaded) { + var latLng = this.latLng || this.defaultLatLng; + if(!this._map) { + var map; + var myOptions = { + zoom: this.zoom, + center: new window.google.maps.LatLng(latLng.lat, latLng.lng), + mapTypeId: window.google.maps.MapTypeId.ROADMAP + }; + + this._map = new window.google.maps.Map(this.mapEl, myOptions); + } else { + var map = this._map; + map.setZoom(12); + var latLng = new window.google.maps.LatLng(latLng.lat, latLng.lng); + map.setCenter(latLng); + var marker = new google.maps.Marker({ + map: map, + position: latLng + }); + + var places = this._places; + if(places && places.length > 0) { + this._removeAllMarkers(); + for (var i = 0; i < places.length; i++) { + this._createMarker(places[i]); + } + } + } + + } + + //window.google.maps.event.addDomListener(window, 'load', initialize); + } + } +}); diff --git a/node_modules/montage/ui/template.js b/node_modules/montage/ui/template.js index c6589b35..210d8cb7 100755 --- a/node_modules/montage/ui/template.js +++ b/node_modules/montage/ui/template.js @@ -438,7 +438,7 @@ var Template = exports.Template = Montage.create(Montage, /** @lends module:mont for (var i = 0, cssTag; (cssTag = cssTags[i]); i++) { if ((url = cssTag.getAttribute("href"))) { - if (! /^http:\/\/|^\//.test(url)) { // TODO: look into base links... + if (! /^https?:\/\/|^\//.test(url)) { // TODO: look into base links... url = rootUrl + url; } @@ -547,7 +547,7 @@ var Template = exports.Template = Montage.create(Montage, /** @lends module:mont src = script.getAttribute("src"); scriptNode = doc.importNode(script, true); if (src) { - if (! /^http:\/\/|^\//.test(src)) { // TODO: look into base links... + if (! /^https?:\/\/|^\//.test(src)) { // TODO: look into base links... scriptNode.src = src = rootUrl + src; } if (src in externalScriptsLoaded) continue; @@ -688,7 +688,7 @@ var Template = exports.Template = Montage.create(Montage, /** @lends module:mont url = link.getAttribute("href"), rootUrl = this._rootUrl ? this._rootUrl[0] : ""; - if (! /^http:\/\/|^\//.test(url)) { + if (! /^https?:\/\/|^\//.test(url)) { url = rootUrl + url; } -- cgit v1.2.3 From bcddcf118d4ce93e8a2519ed455c6e25a701ce74 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 16:42:13 -0700 Subject: fixing the map styles and temporary disabling the 3d styles for elements. Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/map.reel/map.html | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/map.reel/map.html b/node_modules/montage/ui/map.reel/map.html index a6ac5303..5cd3a5b5 100644 --- a/node_modules/montage/ui/map.reel/map.html +++ b/node_modules/montage/ui/map.reel/map.html @@ -35,6 +35,17 @@ } + + -- cgit v1.2.3 From 28a7a71d2962158cab34f50627f2d22540c29eab Mon Sep 17 00:00:00 2001 From: Benoit Marchant Date: Sat, 17 Mar 2012 17:41:47 -0700 Subject: Added a new picasa-carousel component as well as an example using it --- .../picasa-carousel.reel/image.reel/image.html | 37 +++++ .../picasa-carousel.reel/image.reel/image.js | 20 +++ .../picasa-carousel.reel/picasa-carousel.css | 44 +++++ .../picasa-carousel.reel/picasa-carousel.html | 181 +++++++++++++++++++++ .../google/picasa-carousel.reel/picasa-carousel.js | 124 ++++++++++++++ 5 files changed, 406 insertions(+) create mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html create mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js create mode 100755 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css create mode 100755 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html create mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html new file mode 100644 index 00000000..e3d9c7a2 --- /dev/null +++ b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html @@ -0,0 +1,37 @@ + + + + + + + + +
+ + diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js new file mode 100644 index 00000000..0bced41b --- /dev/null +++ b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js @@ -0,0 +1,20 @@ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; + +var Image = exports.Image = Montage.create(Component, { + + _src: {value: null}, + + src: { + set: function(value) { + this._src = value; + this.needsDraw = true; + } + }, + + draw: { + value: function() { + this._element.style.backgroundImage = "url(" + this._src + ")"; + } + } +}); diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css new file mode 100755 index 00000000..cab6d1bb --- /dev/null +++ b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css @@ -0,0 +1,44 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +.montage-google-picasa-carousel { + width: 100%; + height: 100%; + display: -webkit-box; + -webkit-box-pack: center; + -webkit-box-align: center; + display: -moz-box; + -moz-box-pack: center; + -moz-box-align: center; + display: -ms-box; + -ms-box-pack: center; + -ms-box-align: center; + display: box; + box-pack: center; + box-align: center; + +} + +.montage-google-picasa-carousel .flow { + width: 100%; + height: 100%; +/* top: 0; + left: 0; + right: 0; + bottom: 0; +*/ -webkit-perspective: 800px; + background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#bbb)); +} +.image { + position: absolute; +/* -top: 50%; +*/ -webkit-box-shadow: 0 0 35px rgba(0,0,0,.5); +} + +.montage-google-picasa-carousel .flow .montage-flow-repetition { +margin: 10% 0; + +} + diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html new file mode 100755 index 00000000..73ccf076 --- /dev/null +++ b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js new file mode 100644 index 00000000..25d363b0 --- /dev/null +++ b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js @@ -0,0 +1,124 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/** + + @requires montage/core/core + @requires montage/ui/component +*/ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; +/** + @class module:"montage/ui/google/map.reel".Map + @extends module:montage/ui/component.Component + */ +var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ { + photoListController: { + enumerable: false, + value: null + }, + + queryParameter: { + enumerable: false, + value: null + }, + + resultCount: { + enumerable: false, + value: 20 + }, + + prepareForDraw: { + enumerable: false, + value: function() { + // this.searchForm.identifier = "searchForm"; + // this.searchForm.addEventListener("submit", this, false); + } + }, + + _isSearching: { + value: false, + enumerable: false + }, + + isSearching: { + enumerable: false, + get: function() { + return this._isSearching; + }, + set: function(value) { + if (value === this._isSearching) { + return; + } + + this._isSearching = value; + this.needsDraw = true; + } + }, + + handleSearchFormSubmit: { + value: function(evt) { + evt.preventDefault(); + this.performSearch(); + } + }, + + performSearch: { + value: function() { + if (this.isSearching) { + console.log("already searching!") + return; + } + + this.isSearching = true; + this.searchResults = null; + + var base = "http://picasaweb.google.com/data/feed/base/all?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true&imgmax=720u&q=" + // var base = "http://picasaweb.google.com/data/feed/base/featured?visibility=public&alt=json&max-results=" + this.resultCount + "&kind=photo&prettyprint=true" + var url = base + this.queryParameter; + + var req = new XMLHttpRequest(); + req.identifier = "searchRequest"; + req.open("GET", url); + req.addEventListener("load", this, false); + req.addEventListener("error", this, false); + req.send(); + + } + }, + + handleSearchRequestLoad: { + value: function(evt) { + var response = JSON.parse(evt.target.responseText); + this.searchResults = response.feed.entry; + this.isSearching = false; + } + }, + + handleSearchRequestError: { + value: function(evt) { + console.error("handleSearchRequestError", evt); + this.isSearching = false; + } + }, + + searchResults: { + enumerable: false, + value: null + }, + + draw: { + value: function() { + + if (this.isSearching) { + this.element.classList.add("searching"); + } else { + this.element.classList.remove("searching"); + } + + } + } + +}); -- cgit v1.2.3 From 3070d7b2a3b96609eace60825c721951c85405cc Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 18:05:23 -0700 Subject: Adding the youtube player --- .../ui/youtube-player.reel/youtube-player.html | 29 ++++ .../ui/youtube-player.reel/youtube-player.js | 179 +++++++++++++++++++++ 2 files changed, 208 insertions(+) create mode 100644 node_modules/montage/ui/youtube-player.reel/youtube-player.html create mode 100644 node_modules/montage/ui/youtube-player.reel/youtube-player.js (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/youtube-player.reel/youtube-player.html b/node_modules/montage/ui/youtube-player.reel/youtube-player.html new file mode 100644 index 00000000..ae757626 --- /dev/null +++ b/node_modules/montage/ui/youtube-player.reel/youtube-player.html @@ -0,0 +1,29 @@ + + + + + + + + +
+ + + +
+ + diff --git a/node_modules/montage/ui/youtube-player.reel/youtube-player.js b/node_modules/montage/ui/youtube-player.reel/youtube-player.js new file mode 100644 index 00000000..2f7709d7 --- /dev/null +++ b/node_modules/montage/ui/youtube-player.reel/youtube-player.js @@ -0,0 +1,179 @@ +//data="https://www.youtube.com/v/u1zgFlCw8Aw?version=3&enablejsapi=1&playerapiid=ytplayer" +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ +/*global require,exports*/ +var Montage = require("montage").Montage, + Component = require("ui/component").Component; + +var YoutubePlayer = exports.YoutubePlayer = Montage.create(Component, { + + // Stores a queue of function calls to make on the player in the draw + // function + _playerQueue: { + enumerable: false, + value: [] + }, + + _ready: { + enumerable: false, + value: false + }, + + _player: { + enumerable: false, + value: null + }, + player: { + get: function() { + return this._player; + }, + set: function(value) { + // TODO don't allow this to be changed + if (this._player !== value) { + this._player = value; + } + } + }, + + _autoplay: { + enumerable: false, + value: false + }, + autoplay: { + get: function() { + return this._autoplay; + }, + set: function(value) { + if (this._autoplay !== value) { + this._autoplay = value; + } + } + }, + + _videoId: { + enumerable: false, + value: null + }, + videoId: { + get: function() { + return this._videoId; + }, + set: function(value) { + if (this._videoId !== value) { + // TODO handle URLs as well + this._videoId = value; + + // If the video isn't in the playlist, clear the playlist, + if (this._playlist && this._playlist.indexOf(value) === -1) { + this._playlist = null; + } + // TODO if the video is in the playlist use playVideoAt + + if (this._autoplay) { + this._playerQueue.push(["loadVideoById", value]); + } else { + this._playerQueue.push(["cueVideoById", value]); + } + this.needsDraw = true; + } + } + }, + + _playlist: { + enumerable: false, + value: null + }, + playlist: { + get: function() { + return this._playlist; + }, + set: function(value) { + if (this._playlist !== value) { + this._playlist = value; + + if (this._autoplay) { + this._playerQueue.push(["loadPlaylist", value]); + } else { + this._playerQueue.push(["cuePlaylist", value]); + } + this.needsDraw = true; + } + } + }, + + play: { + value: function() { + this._playerQueue.push("playVideo"); + this.needsDraw = true; + } + }, + pause: { + value: function() { + this._playerQueue.push("pauseVideo"); + this.needsDraw = true; + } + }, + stop: { + value: function() { + this._playerQueue.push("stopVideo"); + this.needsDraw = true; + } + }, + + prepareForDraw: { + value: function() { + // Create the callback if it doesn't exist, and make it dispatch + // an event on the document instead + if (!window.onYouTubePlayerReady) { + window.onYouTubePlayerReady = function(playerId) { + var event = document.createEvent("CustomEvent"); + event.initEvent("youtubePlayerReady", true, true); + event.playerId = playerId; + document.dispatchEvent(event); + }; + } + + document.addEventListener("youtubePlayerReady", this, false); + + // If there's no videoId set one the doesn't exist + this._player.data = "https://www.youtube.com/v/" + (this._videoId || "xxxxxxxxxxx") + "?version=3&enablejsapi=1&playerapiid=" + this.uuid; + } + }, + + handleYoutubePlayerReady: { + value: function(event) { + if (event.playerId !== this.uuid) { + return; + } + + this._ready = true; + this.needsDraw = true; + } + }, + + draw: { + value: function() { + if (!this._ready) { + return; + } + + for (var i = 0, len = this._playerQueue.length; i < len; i++) { + var fnName, args; + if (typeof this._playerQueue[i] === "string") { + fnName = this._playerQueue[i]; + args = []; + } else { + fnName = this._playerQueue[i].shift(); + args = this._playerQueue[i]; + } + + this._player[fnName].apply(this._player, args); + } + + this._playerQueue.length = 0; + } + } +}); \ No newline at end of file -- cgit v1.2.3 From a086ca62423a09807e2f3a79107249bc31d5e908 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 18:41:17 -0700 Subject: Adding back webkit-transform styles in set3DProperties. Changing "zoom" to "zoomValue" in map component to avoid scaling the map. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Valerio Virgillito --- node_modules/montage/ui/map.reel/map.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/map.reel/map.js b/node_modules/montage/ui/map.reel/map.js index 1e4f452c..c03d51c5 100644 --- a/node_modules/montage/ui/map.reel/map.js +++ b/node_modules/montage/ui/map.reel/map.js @@ -140,7 +140,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ } }, - zoom: { + zoomValue: { value: 8 }, @@ -250,7 +250,7 @@ var Map = exports.Map = Montage.create(Component, /** @lends module:"montage/ui/ if(!this._map) { var map; var myOptions = { - zoom: this.zoom, + zoom: this.zoomValue, center: new window.google.maps.LatLng(latLng.lat, latLng.lng), mapTypeId: window.google.maps.MapTypeId.ROADMAP }; -- cgit v1.2.3 From 09852e9b9b8e64f003bed5aa57630d8b42c8ac95 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Sat, 17 Mar 2012 19:28:30 -0700 Subject: Integrating picasa carousel and youtube channel --- .../picasa-carousel.reel/image.reel/image.html | 37 ----- .../picasa-carousel.reel/image.reel/image.js | 20 --- .../picasa-carousel.reel/picasa-carousel.css | 44 ----- .../picasa-carousel.reel/picasa-carousel.html | 181 --------------------- .../google/picasa-carousel.reel/picasa-carousel.js | 124 -------------- .../ui/picasa-carousel.reel/image.reel/image.html | 37 +++++ .../ui/picasa-carousel.reel/image.reel/image.js | 20 +++ .../ui/picasa-carousel.reel/picasa-carousel.css | 44 +++++ .../ui/picasa-carousel.reel/picasa-carousel.html | 181 +++++++++++++++++++++ .../ui/picasa-carousel.reel/picasa-carousel.js | 124 ++++++++++++++ .../ui/youtube-channel.reel/youtube-channel.html | 34 ++++ .../ui/youtube-channel.reel/youtube-channel.js | 101 ++++++++++++ 12 files changed, 541 insertions(+), 406 deletions(-) delete mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html delete mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js delete mode 100755 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css delete mode 100755 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html delete mode 100644 node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js create mode 100644 node_modules/montage/ui/picasa-carousel.reel/image.reel/image.html create mode 100644 node_modules/montage/ui/picasa-carousel.reel/image.reel/image.js create mode 100755 node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.css create mode 100755 node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.html create mode 100644 node_modules/montage/ui/picasa-carousel.reel/picasa-carousel.js create mode 100644 node_modules/montage/ui/youtube-channel.reel/youtube-channel.html create mode 100644 node_modules/montage/ui/youtube-channel.reel/youtube-channel.js (limited to 'node_modules/montage/ui') diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html deleted file mode 100644 index e3d9c7a2..00000000 --- a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - -
- - diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js b/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js deleted file mode 100644 index 0bced41b..00000000 --- a/node_modules/montage/ui/google/picasa-carousel.reel/image.reel/image.js +++ /dev/null @@ -1,20 +0,0 @@ -var Montage = require("montage").Montage, - Component = require("ui/component").Component; - -var Image = exports.Image = Montage.create(Component, { - - _src: {value: null}, - - src: { - set: function(value) { - this._src = value; - this.needsDraw = true; - } - }, - - draw: { - value: function() { - this._element.style.backgroundImage = "url(" + this._src + ")"; - } - } -}); diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css deleted file mode 100755 index cab6d1bb..00000000 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.css +++ /dev/null @@ -1,44 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ -.montage-google-picasa-carousel { - width: 100%; - height: 100%; - display: -webkit-box; - -webkit-box-pack: center; - -webkit-box-align: center; - display: -moz-box; - -moz-box-pack: center; - -moz-box-align: center; - display: -ms-box; - -ms-box-pack: center; - -ms-box-align: center; - display: box; - box-pack: center; - box-align: center; - -} - -.montage-google-picasa-carousel .flow { - width: 100%; - height: 100%; -/* top: 0; - left: 0; - right: 0; - bottom: 0; -*/ -webkit-perspective: 800px; - background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#bbb)); -} -.image { - position: absolute; -/* -top: 50%; -*/ -webkit-box-shadow: 0 0 35px rgba(0,0,0,.5); -} - -.montage-google-picasa-carousel .flow .montage-flow-repetition { -margin: 10% 0; - -} - diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html deleted file mode 100755 index 73ccf076..00000000 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js b/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js deleted file mode 100644 index 25d363b0..00000000 --- a/node_modules/montage/ui/google/picasa-carousel.reel/picasa-carousel.js +++ /dev/null @@ -1,124 +0,0 @@ -/* - This file contains proprietary software owned by Motorola Mobility, Inc.
- No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
- (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ -/** - - @requires montage/core/core - @requires montage/ui/component -*/ -var Montage = require("montage").Montage, - Component = require("ui/component").Component; -/** - @class module:"montage/ui/google/map.reel".Map - @extends module:montage/ui/component.Component - */ -var PicasaCarousel = exports.PicasaCarousel = Montage.create(Component, /** @lends module:"montage/ui/toggle-switch.reel".ToggleSwitch# */ { - photoListController: { - enumerable: false, - value: null - }, - - queryParameter: { - enumerable: false, - value: null - }, - - resultCount: { - enumerable: false, - value: 20 - }, - - prepareForDraw: { - enumerable: false, - value: function() { - // this.searchForm.identifier = "searchForm"; - // this.searchForm.addEventListener("submit", this, false); - } - }, - - _isSearching: { - value: false, - enumerable: false - }, - - isSearching: { - enumerable: false, - get: function() { - return this._isSearching; - }, - set: function(value) { - if (value ==