From 30dac4509e28f07bacf29c3be3d58f8fa684b115 Mon Sep 17 00:00:00 2001 From: ryderr Date: Fri, 24 Oct 2014 14:25:39 -0400 Subject: adding video --- views/home.ejs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'views') diff --git a/views/home.ejs b/views/home.ejs index 85d6f23..7fe0c71 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -70,6 +70,11 @@ [[ include partials/sign-in ]] [[ include partials/footer ]] + +
+ +
+
[[ include partials/scripts ]] -- cgit v1.2.3-70-g09d2 From 04e20c10c7a01d78c08b8aa87dbeeb0061c535f5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 24 Oct 2014 14:53:50 -0400 Subject: setting up embed, hide play bar --- public/assets/javascripts/app.js | 35 ++++++++++++++++++++++++++--------- public/assets/stylesheets/app.css | 5 +++++ views/home.ejs | 2 +- 3 files changed, 32 insertions(+), 10 deletions(-) (limited to 'views') diff --git a/public/assets/javascripts/app.js b/public/assets/javascripts/app.js index f26a782..42e8a53 100644 --- a/public/assets/javascripts/app.js +++ b/public/assets/javascripts/app.js @@ -17,21 +17,38 @@ else { new WOW().init(); -$('.hero .circle').click( function(){ - $('.videoModal').addClass('active'); -}); - -$('.videoModal .ion-ios7-close-empty').click( function(){ - $('.videoModal').removeClass('active'); -}); - +$(function(){ + var player + $('.hero .circle').click( function(){ + $('.videoModal').css("display","table").addClass('active'); + player = $f( okplayer ) + player.api('play') + player.addEvent('ready', function(){ + player.api('play') + player.addEvent('finish', function(){ + hide() + }) + }) + }); + + $('.videoModal .ion-ios7-close-empty').click( function(){ + player.api('pause') + hide() + }) + + function hide() { + $('.videoModal').fadeOut(300, function(){ + $('.videoModal').removeClass('active'); + }) + } +}) var scene, cam, map; var app = new function(){} app.mode = { editor: false, builder: false } - + app.init = function () { app.tube = new Tube () app.router = new SiteRouter () diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 4dfb707..2d52633 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -107,6 +107,11 @@ a{ -moz-transition:0.4s background; transition:0.4s background; display:none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; } .videoModal.active { diff --git a/views/home.ejs b/views/home.ejs index 7fe0c71..2da811d 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -74,7 +74,7 @@
-
+
[[ include partials/scripts ]] -- cgit v1.2.3-70-g09d2 From c80f79f9ade5fa06eda8c31a252729b5bbb61e84 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 24 Oct 2014 15:01:43 -0400 Subject: arg vimeo --- public/assets/javascripts/app.js | 18 ++++++++---------- views/home.ejs | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'views') diff --git a/public/assets/javascripts/app.js b/public/assets/javascripts/app.js index 42e8a53..883a24c 100644 --- a/public/assets/javascripts/app.js +++ b/public/assets/javascripts/app.js @@ -18,18 +18,16 @@ else { new WOW().init(); $(function(){ - var player + var player = $f( okplayer ) +// player.addEvent('ready', function(){ +// player.addEvent('finish', function(){ +// hide() +// }) +// }) $('.hero .circle').click( function(){ $('.videoModal').css("display","table").addClass('active'); - player = $f( okplayer ) player.api('play') - player.addEvent('ready', function(){ - player.api('play') - player.addEvent('finish', function(){ - hide() - }) - }) - }); + }) $('.videoModal .ion-ios7-close-empty').click( function(){ player.api('pause') @@ -38,7 +36,7 @@ $(function(){ function hide() { $('.videoModal').fadeOut(300, function(){ - $('.videoModal').removeClass('active'); + $('.videoModal').removeClass('active') }) } }) diff --git a/views/home.ejs b/views/home.ejs index 2da811d..36b9afd 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -74,7 +74,7 @@
-
+
[[ include partials/scripts ]] -- cgit v1.2.3-70-g09d2 From 47f77566c31e9d14f5afc199c217dbdaabd54037 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 24 Oct 2014 15:17:15 -0400 Subject: fixing embed --- public/assets/javascripts/app.js | 10 +- public/assets/javascripts/ui/lib/Parser.js | 2 +- public/assets/javascripts/vendor/froogaloop.js | 287 +++++++++++++++++++++++++ views/home.ejs | 2 +- views/partials/scripts.ejs | 4 +- 5 files changed, 296 insertions(+), 9 deletions(-) create mode 100644 public/assets/javascripts/vendor/froogaloop.js (limited to 'views') diff --git a/public/assets/javascripts/app.js b/public/assets/javascripts/app.js index 883a24c..028ebb8 100644 --- a/public/assets/javascripts/app.js +++ b/public/assets/javascripts/app.js @@ -19,11 +19,11 @@ new WOW().init(); $(function(){ var player = $f( okplayer ) -// player.addEvent('ready', function(){ -// player.addEvent('finish', function(){ -// hide() -// }) -// }) + player.addEvent('ready', function(){ + player.addEvent('finish', function(){ + hide() + }) + }) $('.hero .circle').click( function(){ $('.videoModal').css("display","table").addClass('active'); player.api('play') diff --git a/public/assets/javascripts/ui/lib/Parser.js b/public/assets/javascripts/ui/lib/Parser.js index aa8c480..d68f58b 100644 --- a/public/assets/javascripts/ui/lib/Parser.js +++ b/public/assets/javascripts/ui/lib/Parser.js @@ -112,7 +112,7 @@ var Parser = { }, tag: function (media) { // return ''; - return '
' + return '
' } }, /* diff --git a/public/assets/javascripts/vendor/froogaloop.js b/public/assets/javascripts/vendor/froogaloop.js new file mode 100644 index 0000000..c9330e6 --- /dev/null +++ b/public/assets/javascripts/vendor/froogaloop.js @@ -0,0 +1,287 @@ +// Init style shamelessly stolen from jQuery http://jquery.com +var Froogaloop = (function(){ + // Define a local copy of Froogaloop + function Froogaloop(iframe) { + // The Froogaloop object is actually just the init constructor + return new Froogaloop.fn.init(iframe); + } + + var eventCallbacks = {}, + hasWindowEvent = false, + isReady = false, + slice = Array.prototype.slice, + playerDomain = ''; + + Froogaloop.fn = Froogaloop.prototype = { + element: null, + + init: function(iframe) { + if (typeof iframe === "string") { + iframe = document.getElementById(iframe); + } + + this.element = iframe; + + // Register message event listeners + playerDomain = getDomainFromUrl(this.element.getAttribute('src')); + + return this; + }, + + /* + * Calls a function to act upon the player. + * + * @param {string} method The name of the Javascript API method to call. Eg: 'play'. + * @param {Array|Function} valueOrCallback params Array of parameters to pass when calling an API method + * or callback function when the method returns a value. + */ + api: function(method, valueOrCallback) { + if (!this.element || !method) { + return false; + } + + var self = this, + element = self.element, + target_id = element.id !== '' ? element.id : null, + params = !isFunction(valueOrCallback) ? valueOrCallback : null, + callback = isFunction(valueOrCallback) ? valueOrCallback : null; + + // Store the callback for get functions + if (callback) { + storeCallback(method, callback, target_id); + } + + postMessage(method, params, element); + return self; + }, + + /* + * Registers an event listener and a callback function that gets called when the event fires. + * + * @param eventName (String): Name of the event to listen for. + * @param callback (Function): Function that should be called when the event fires. + */ + addEvent: function(eventName, callback) { + if (!this.element) { + return false; + } + + var self = this, + element = self.element, + target_id = element.id !== '' ? element.id : null; + + storeCallback(eventName, callback, target_id); + + // The ready event is not registered via postMessage. It fires regardless. + if (eventName != 'ready') { + postMessage('addEventListener', eventName, element); + } + else if (eventName == 'ready' && isReady) { + callback.call(null, target_id); + } + + return self; + }, + + /* + * Unregisters an event listener that gets called when the event fires. + * + * @param eventName (String): Name of the event to stop listening for. + */ + removeEvent: function(eventName) { + if (!this.element) { + return false; + } + + var self = this, + element = self.element, + target_id = element.id !== '' ? element.id : null, + removed = removeCallback(eventName, target_id); + + // The ready event is not registered + if (eventName != 'ready' && removed) { + postMessage('removeEventListener', eventName, element); + } + } + }; + + /** + * Handles posting a message to the parent window. + * + * @param method (String): name of the method to call inside the player. For api calls + * this is the name of the api method (api_play or api_pause) while for events this method + * is api_addEventListener. + * @param params (Object or Array): List of parameters to submit to the method. Can be either + * a single param or an array list of parameters. + * @param target (HTMLElement): Target iframe to post the message to. + */ + function postMessage(method, params, target) { + if (!target.contentWindow.postMessage) { + return false; + } + + var url = target.getAttribute('src').split('?')[0], + data = JSON.stringify({ + method: method, + value: params + }); + + if (url.substr(0, 2) === '//') { + url = window.location.protocol + url; + } + + target.contentWindow.postMessage(data, url); + } + + /** + * Event that fires whenever the window receives a message from its parent + * via window.postMessage. + */ + function onMessageReceived(event) { + var data, method; + + try { + data = JSON.parse(event.data); + method = data.event || data.method; + } + catch(e) { + //fail silently... like a ninja! + } + + if (method == 'ready' && !isReady) { + isReady = true; + } + + // Handles messages from moogaloop only + if (event.origin != playerDomain) { + return false; + } + + var value = data.value, + eventData = data.data, + target_id = target_id === '' ? null : data.player_id, + + callback = getCallback(method, target_id), + params = []; + + if (!callback) { + return false; + } + + if (value !== undefined) { + params.push(value); + } + + if (eventData) { + params.push(eventData); + } + + if (target_id) { + params.push(target_id); + } + + return params.length > 0 ? callback.apply(null, params) : callback.call(); + } + + + /** + * Stores submitted callbacks for each iframe being tracked and each + * event for that iframe. + * + * @param eventName (String): Name of the event. Eg. api_onPlay + * @param callback (Function): Function that should get executed when the + * event is fired. + * @param target_id (String) [Optional]: If handling more than one iframe then + * it stores the different callbacks for different iframes based on the iframe's + * id. + */ + function storeCallback(eventName, callback, target_id) { + if (target_id) { + if (!eventCallbacks[target_id]) { + eventCallbacks[target_id] = {}; + } + eventCallbacks[target_id][eventName] = callback; + } + else { + eventCallbacks[eventName] = callback; + } + } + + /** + * Retrieves stored callbacks. + */ + function getCallback(eventName, target_id) { + if (target_id) { + return eventCallbacks[target_id][eventName]; + } + else { + return eventCallbacks[eventName]; + } + } + + function removeCallback(eventName, target_id) { + if (target_id && eventCallbacks[target_id]) { + if (!eventCallbacks[target_id][eventName]) { + return false; + } + eventCallbacks[target_id][eventName] = null; + } + else { + if (!eventCallbacks[eventName]) { + return false; + } + eventCallbacks[eventName] = null; + } + + return true; + } + + /** + * Returns a domain's root domain. + * Eg. returns http://vimeo.com when http://vimeo.com/channels is sbumitted + * + * @param url (String): Url to test against. + * @return url (String): Root domain of submitted url + */ + function getDomainFromUrl(url) { + if (url.substr(0, 2) === '//') { + url = window.location.protocol + url; + } + + var url_pieces = url.split('/'), + domain_str = ''; + + for(var i = 0, length = url_pieces.length; i < length; i++) { + if(i<3) {domain_str += url_pieces[i];} + else {break;} + if(i<2) {domain_str += '/';} + } + + return domain_str; + } + + function isFunction(obj) { + return !!(obj && obj.constructor && obj.call && obj.apply); + } + + function isArray(obj) { + return toString.call(obj) === '[object Array]'; + } + + // Give the init function the Froogaloop prototype for later instantiation + Froogaloop.fn.init.prototype = Froogaloop.fn; + + // Listens for the message event. + // W3C + if (window.addEventListener) { + window.addEventListener('message', onMessageReceived, false); + } + // IE + else { + window.attachEvent('onmessage', onMessageReceived); + } + + // Expose froogaloop to the global object + return (window.Froogaloop = window.$f = Froogaloop); + +})(); \ No newline at end of file diff --git a/views/home.ejs b/views/home.ejs index 36b9afd..85548fb 100755 --- a/views/home.ejs +++ b/views/home.ejs @@ -74,7 +74,7 @@
-
+
[[ include partials/scripts ]] diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index c9b4c95..0373a3e 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -11,6 +11,7 @@ + @@ -122,5 +123,4 @@ - - + -- cgit v1.2.3-70-g09d2