From 0b619c4834b6e01ea9ae0a70b85134d9b3730607 Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Thu, 10 Jul 2014 14:52:31 +0100 Subject: [PATCH 1/5] Add user custom play/stop buttons Add user custom play/stop buttons in the same manner as current previous / next buttons are handled --- source/jquery.slides.coffee | 45 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/source/jquery.slides.coffee b/source/jquery.slides.coffee index cdeb9ba..a4becee 100755 --- a/source/jquery.slides.coffee +++ b/source/jquery.slides.coffee @@ -53,8 +53,13 @@ play: # Play and stop button setting. active: false - # [boolean] Create the play and stop buttons. - # You cannot use your own pagination. + # [boolean] Enable hands-free playing of slideshow. + generate: true + # [boolean] Create play and stop button. + # You can set to false and use your own play/stop buttons. + # User defined play/stop buttons must have the following: + # play: class="slidesjs-play slidesjs-navigation" + # stop: class="slidesjs-stop slidesjs-navigation" effect: "slide" # [string] Can be either "slide" or "fade". interval: 5000 @@ -204,19 +209,29 @@ @previous(@options.navigation.effect) if @options.play.active - playButton = $("", - class: "slidesjs-play slidesjs-navigation" - href: "#" - title: "Play" - text: "Play" - ).appendTo($element) - - stopButton = $("", - class: "slidesjs-stop slidesjs-navigation" - href: "#" - title: "Stop" - text: "Stop" - ).appendTo($element) + # If slideshow active + + if @options.play.generate + # Generate play / stop button + playButton = $("", + class: "slidesjs-play slidesjs-navigation" + href: "#" + title: "Play" + text: "Play" + ).appendTo($element) + + stopButton = $("", + class: "slidesjs-stop slidesjs-navigation" + href: "#" + title: "Stop" + text: "Stop" + ).appendTo($element) + + else + # Search for user's play/stop buttons + playButton = $(".slidesjs-play .slidesjs-navigation") + stopButton = $(".slidesjs-stop .slidesjs-navigation") + playButton.click (e) => e.preventDefault() From 6cfbef9983e31c792783487be667339022fb4aeb Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Thu, 10 Jul 2014 14:54:21 +0100 Subject: [PATCH 2/5] Consistant indentation --- source/jquery.slides.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/jquery.slides.coffee b/source/jquery.slides.coffee index a4becee..5f26506 100755 --- a/source/jquery.slides.coffee +++ b/source/jquery.slides.coffee @@ -55,11 +55,11 @@ active: false # [boolean] Enable hands-free playing of slideshow. generate: true - # [boolean] Create play and stop button. - # You can set to false and use your own play/stop buttons. - # User defined play/stop buttons must have the following: - # play: class="slidesjs-play slidesjs-navigation" - # stop: class="slidesjs-stop slidesjs-navigation" + # [boolean] Create play and stop button. + # You can set to false and use your own play/stop buttons. + # User defined play/stop buttons must have the following: + # play: class="slidesjs-play slidesjs-navigation" + # stop: class="slidesjs-stop slidesjs-navigation" effect: "slide" # [string] Can be either "slide" or "fade". interval: 5000 From fb7690730bc605a62d68b1f5650f77e3ab066c08 Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Thu, 10 Jul 2014 15:16:39 +0100 Subject: [PATCH 3/5] Goddamnit TextMate --- source/jquery.slides.coffee | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/jquery.slides.coffee b/source/jquery.slides.coffee index 5f26506..8e79f82 100755 --- a/source/jquery.slides.coffee +++ b/source/jquery.slides.coffee @@ -214,17 +214,17 @@ if @options.play.generate # Generate play / stop button playButton = $("", - class: "slidesjs-play slidesjs-navigation" - href: "#" - title: "Play" - text: "Play" + class: "slidesjs-play slidesjs-navigation" + href: "#" + title: "Play" + text: "Play" ).appendTo($element) stopButton = $("", - class: "slidesjs-stop slidesjs-navigation" - href: "#" - title: "Stop" - text: "Stop" + class: "slidesjs-stop slidesjs-navigation" + href: "#" + title: "Stop" + text: "Stop" ).appendTo($element) else From 5097e51921c19f6c8d781115a45a30c9f8301a71 Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Fri, 8 Aug 2014 15:39:09 +0100 Subject: [PATCH 4/5] Typo in selector for play/stop buttons --- source/jquery.slides.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/jquery.slides.coffee b/source/jquery.slides.coffee index 8e79f82..5f09cfb 100755 --- a/source/jquery.slides.coffee +++ b/source/jquery.slides.coffee @@ -229,8 +229,8 @@ else # Search for user's play/stop buttons - playButton = $(".slidesjs-play .slidesjs-navigation") - stopButton = $(".slidesjs-stop .slidesjs-navigation") + playButton = $(".slidesjs-play.slidesjs-navigation") + stopButton = $(".slidesjs-stop.slidesjs-navigation") playButton.click (e) => From 6fd5efc5ca56441e9c930cf2aa0742d0ebf87486 Mon Sep 17 00:00:00 2001 From: Charles Baynham Date: Thu, 21 Aug 2014 14:14:17 +0100 Subject: [PATCH 5/5] No context means global search for buttons! --- source/jquery.slides.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/jquery.slides.coffee b/source/jquery.slides.coffee index 5f09cfb..a104218 100755 --- a/source/jquery.slides.coffee +++ b/source/jquery.slides.coffee @@ -229,8 +229,8 @@ else # Search for user's play/stop buttons - playButton = $(".slidesjs-play.slidesjs-navigation") - stopButton = $(".slidesjs-stop.slidesjs-navigation") + playButton = $(".slidesjs-play.slidesjs-navigation", $element) + stopButton = $(".slidesjs-stop.slidesjs-navigation", $element) playButton.click (e) =>