diff --git a/README.md b/README.md index 5ff911a..71856f4 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ if (something) { | default | '' | default time, 'now' or '13:14' e.g. | | placement | 'bottom' | popover placement | | align | 'left' | popover arrow align | +| showdonebutton | true | show done button | | donetext | '完成' | done button text | | autoclose | false | auto close when minute is selected | | twelvehour | false | enables twelve hour mode with AM & PM buttons | diff --git a/src/clockpicker.js b/src/clockpicker.js index 7f208aa..7e301b7 100644 --- a/src/clockpicker.js +++ b/src/clockpicker.js @@ -117,50 +117,50 @@ this.spanMinutes = popover.find('.clockpicker-span-minutes'); this.spanAmPm = popover.find('.clockpicker-span-am-pm'); this.amOrPm = "PM"; - + // Setup for for 12 hour clock if option is selected if (options.twelvehour) { - + var amPmButtonsTemplate = ['
', '', '', '
'].join(''); - + var amPmButtons = $(amPmButtonsTemplate); //amPmButtons.appendTo(plate); - + ////Not working b/c they are not shown when this runs //$('clockpicker-am-button') // .on("click", function() { // self.amOrPm = "AM"; // $('.clockpicker-span-am-pm').empty().append('AM'); // }); - // + // //$('clockpicker-pm-button') // .on("click", function() { // self.amOrPm = "PM"; // $('.clockpicker-span-am-pm').empty().append('PM'); // }); - + $('') .on("click", function() { self.amOrPm = "AM"; $('.clockpicker-span-am-pm').empty().append('AM'); }).appendTo(this.amPmBlock); - - + + $('') .on("click", function() { self.amOrPm = 'PM'; $('.clockpicker-span-am-pm').empty().append('PM'); }).appendTo(this.amPmBlock); - + } - - if (! options.autoclose) { - // If autoclose is not setted, append a button + + if (options.showdonebutton) { + // Append a button if showdonebutton options is set to true $('') .click($.proxy(this.done, this)) .appendTo(popover); @@ -368,6 +368,7 @@ placement: 'bottom', // clock popover placement align: 'left', // popover arrow align donetext: '完成', // done button text + showdonebutton: 'true', // show done button autoclose: false, // auto close when minute is selected twelvehour: false, // change to 12 hour AM/PM clock from 24 hour vibrate: true // vibrate the device when dragging clock hand @@ -576,7 +577,7 @@ inner = isHours && z < (outerRadius + innerRadius) / 2, radius = inner ? innerRadius : outerRadius, value; - + if (options.twelvehour) { radius = outerRadius; } @@ -621,7 +622,7 @@ } } } - + // Once hours or minutes changed, vibrate the device if (this[this.currentView] !== value) { if (vibrate && this.options.vibrate) { @@ -679,7 +680,7 @@ if (this.options.twelvehour) { value = value + this.amOrPm; } - + this.input.prop('value', value); if (value !== last) { this.input.triggerHandler('change');