UNPKG

fd-gulp-convert-encoding

Version:

convert file to assigned charset

63 lines (46 loc) 1.54 kB
define('detail.modules.activity.View', ['jQuery', 'Class', 'lofty.ui.Timer'], function($, Class, Timer) { return Class({ init: function(view, config) { this.onEvent = $.os.supportsTouch ? 'tap' : 'click'; this.div = view; this.config = config; this._initTime(); this._initPie(); }, _initTime: function(){ if (!this.config.countdown){ return; } // mock // this.config.countdown = 5000; var timer = new Timer({ to: new Date(new Date().getTime() + this.config.countdown * 1), el: '#d-activity-timer' }); timer.on('stop', function(){ location.reload(); }); }, _initPie: function(){ var saledCount = this.config.saledCount * 1, canBookedAmount = this.config.canBookedAmount * 1, $pies = $('li', this.div), percentage; if (saledCount <= 0){ return; } percentage = (saledCount / (saledCount + canBookedAmount)).toFixed(2); if (percentage <= 0.5){ $pies.eq(3).css('-webkit-transform', 'rotate(' + percentage * 3.6 * 100 + 'deg)'); } else { $pies.eq(3).css('-webkit-transform', 'rotate(180deg)'); setTimeout(function(){ $pies.eq(3).hide(); $pies.eq(2).css('-webkit-transform', 'rotate(' + (percentage - 0.5) * 3.6 * 100 + 'deg)'); }, 500); } } }); });