Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuya Hashimoto committed Apr 12, 2013
2 parents 2b22e8d + 14dbd6d commit 2194bad
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 15 deletions.
25 changes: 17 additions & 8 deletions build/coffee/src/flickable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ do (root = this, factory = (window, document) ->
for prefix in @prefixes
_prop = @ucFirst(prefix) + @ucFirst(prop)

# @prefixes とマッチした
# @prefixes とマッチしたら
if style[_prop] isnt undefined
@saveProp[prop] = _prop
style[_prop] = val
Expand Down Expand Up @@ -241,9 +241,7 @@ do (root = this, factory = (window, document) ->
@opts.disable3d = @opts.disable3d or false

@opts.autoPlay = @opts.autoPlay or false
# @opts.interval = @opts.interval or 6600
# @opts.interval = @opts.interval or 500
@opts.interval = @opts.interval or 2500
@opts.interval = @opts.interval or 6600
@opts.loop = @opts.loop or if @opts.autoPlay then true else false

@opts.transition = @opts.transition or {}
Expand Down Expand Up @@ -271,6 +269,20 @@ do (root = this, factory = (window, document) ->
@gestureStart = false
, false

window.addEventListener "blur", =>
@_clearAutoPlay()
, false
window.addEventListener "focus", =>
@_startAutoPlay()
, false
# $(window).on
# "blur": (event) =>
# document.title = "戻ってこいよゴルァ"
# @_clearAutoPlay()
# "focus": (event) =>
# document.title = "クイキン";
# @_startAutoPlay()

@el.addEventListener(@events.start, @, false)

if @opts.autoPlay then @_startAutoPlay()
Expand Down Expand Up @@ -495,7 +507,6 @@ do (root = this, factory = (window, document) ->
@timerId = window.setInterval(toNextFn, interval)

_clearAutoPlay: ->
# timerId = @timerId
window.clearInterval(@timerId)

tmpClearAutoPlay: ->
Expand All @@ -504,7 +515,7 @@ do (root = this, factory = (window, document) ->

_setTotalWidth: ->
childNodes = @el.childNodes
itemAry = []
itemAry = if childNodes.length isnt 0 then [] else [@el]

for node in childNodes
if node.nodeType is 1 then itemAry.push(node)
Expand Down Expand Up @@ -559,9 +570,7 @@ do (root = this, factory = (window, document) ->
destroy: ->
@el.removeEventListener(@events.start, @, false)

window["Helper"] = Helper
window[NS] = Flickable

) ->
# AMD
if typeof define is "function" and define.amd is "object"
Expand Down
10 changes: 8 additions & 2 deletions build/coffee/test/flickable.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
"use strict"
expect = chai.expect
expect = chai.expect

describe "Helper Class", ->
helper = new Helper()
div = document.createElement("div")

div.style.width = "100px"
div.style.height = "100px"

flickable = new Flickable(div, {})
helper = flickable.helper

# UserAgent を偽装するヘルパ
spoofUserAgent = (ua) ->
Expand Down
11 changes: 8 additions & 3 deletions src/flickable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions test/flickable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2194bad

Please sign in to comment.