This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Mixin.create({ | |
scrollTimeout: 100, | |
boundingClientRect: 0, | |
windowHeight: 0, | |
windowWidth: 0, | |
enteredViewport: Ember.computed('boundingClientRect', 'windowHeight', 'windowWidth', function() { | |
var rect, windowHeight, windowWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scrollTimeout: 100, | |
boundingClientRect: 0, | |
windowHeight: 0, | |
windowWidth: 0, | |
_updateBoundingClientRect: function() { | |
var el; | |
el = this.$()[0]; | |
this.set('boundingClientRect', el.getBoundingClientRect()); | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_scrollHandler: function() { | |
return Ember.run.debounce(this, '_updateBoundingClientRect', this.get('scrollTimeout')); | |
}, | |
_bindScroll: (function() { | |
var scrollHandler; | |
scrollHandler = this._scrollHandler.bind(this); | |
Ember.$(document).on('touchmove.scrollable', scrollHandler); | |
Ember.$(window).on('scroll.scrollable', scrollHandler); | |
}).on('didInsertElement'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enteredViewport: Ember.computed('boundingClientRect', 'windowHeight', 'windowWidth', function() { | |
var rect, windowHeight, windowWidth; | |
rect = this.get('boundingClientRect'); | |
windowHeight = this.get('windowHeight'); | |
windowWidth = this.get('windowWidth'); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= windowHeight && | |
rect.right <= windowWidth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import FlashMessage from 'ember-cli-flash/flash/object'; | |
var { | |
computed, | |
get, | |
run | |
} = Ember; | |
export default Ember.Object.extend({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
var { | |
computed, | |
get, | |
set, | |
getWithDefault, | |
run | |
} = Ember; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FlashMessagesService from 'ember-cli-flash/services/flash-messages-service'; | |
export function initialize(_container, application) { | |
application.register('service:flash-messages', FlashMessagesService, { singleton: true }); | |
application.inject('controller', 'flashes', 'service:flash-messages'); | |
application.inject('route', 'flashes', 'service:flash-messages'); | |
} | |
export default { | |
name: 'flash-messages-service', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import youtube from 'ember-lazy-video/lazy-video-providers/youtube'; | |
import vimeo from 'ember-lazy-video/lazy-video-providers/vimeo'; | |
export default Ember.Object.extend({ | |
getUrl: function(provider, endpoint, videoId, opts) { | |
var params; | |
opts = (typeof opts === "undefined") ? {} : opts; | |
params = Ember.$.param(opts); | |
return this.get(provider)[endpoint](videoId) + '?' + params; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default { | |
apiUrl: function(videoId) { | |
return '//vimeo.com/api/oembed.json?url=http%3A//vimeo.com/' + videoId; | |
}, | |
embedUrl: function(videoId) { | |
return '//player.vimeo.com/video/' + videoId; | |
}, | |
thumbnailUrl: function(videoId) { |