[101] | 1 | /*
|
---|
| 2 | * jQuery Mobile Framework : plugin to provide a date and time picker.
|
---|
| 3 | * Copyright (c) JTSage
|
---|
| 4 | * CC 3.0 Attribution. May be relicensed without permission/notification.
|
---|
| 5 | * https://github.com/jtsage/jquery-mobile-datebox
|
---|
| 6 | */
|
---|
| 7 | /* CALBOX Mode */
|
---|
| 8 | // Version Notes: <140 :: New button theme method, still use _hoover
|
---|
| 9 |
|
---|
| 10 | (function($) {
|
---|
| 11 | $.extend( $.mobile.datebox.prototype.options, {
|
---|
| 12 | themeDateToday: 'b',
|
---|
| 13 | themeDayHigh: 'b',
|
---|
| 14 | themeDatePick: 'b',
|
---|
| 15 | themeDateHigh: 'b',
|
---|
| 16 | themeDateHighAlt: 'b',
|
---|
| 17 | themeDateHighRec: 'b',
|
---|
| 18 | themeDate: 'a',
|
---|
| 19 |
|
---|
| 20 | calHighToday: true,
|
---|
| 21 | calHighPick: true,
|
---|
| 22 |
|
---|
| 23 | calShowDays: true,
|
---|
| 24 | calOnlyMonth: false,
|
---|
| 25 | calWeekMode: false,
|
---|
| 26 | calWeekModeDay: 1,
|
---|
| 27 | calWeekHigh: false,
|
---|
| 28 | calControlGroup: false,
|
---|
| 29 | calShowWeek: false,
|
---|
| 30 | calUsePickers: false,
|
---|
| 31 | calNoHeader: false,
|
---|
| 32 |
|
---|
| 33 | useTodayButton: false,
|
---|
| 34 | useCollapsedBut: false,
|
---|
| 35 |
|
---|
| 36 | highDays: false,
|
---|
| 37 | highDates: false,
|
---|
| 38 | highDatesRec: false,
|
---|
| 39 | highDatesAlt: false,
|
---|
| 40 | enableDates: false,
|
---|
| 41 | calDateList: false,
|
---|
| 42 | calShowDateList: false,
|
---|
| 43 | });
|
---|
| 44 | $.extend( $.mobile.datebox.prototype, {
|
---|
| 45 | _cal_gen: function (start,prev,last,other,month) {
|
---|
| 46 | var rc = 0, cc = 0, day = 1,
|
---|
| 47 | next = 1, cal = [], row = [], stop = false;
|
---|
| 48 |
|
---|
| 49 | for ( rc = 0; rc <= 5; rc++ ) {
|
---|
| 50 | if ( stop === false ) {
|
---|
| 51 | row = [];
|
---|
| 52 | for ( cc = 0; cc <= 6; cc++ ) {
|
---|
| 53 | if ( rc === 0 && cc < start ) {
|
---|
| 54 | if ( other === true ) {
|
---|
| 55 | row.push([prev + (cc - start) + 1,month-1]);
|
---|
| 56 | } else {
|
---|
| 57 | row.push(false);
|
---|
| 58 | }
|
---|
| 59 | } else if ( rc > 3 && day > last ) {
|
---|
| 60 | if ( other === true ) {
|
---|
| 61 | row.push([next,month+1]); next++;
|
---|
| 62 | } else {
|
---|
| 63 | row.push(false);
|
---|
| 64 | }
|
---|
| 65 | stop = true;
|
---|
| 66 | } else {
|
---|
| 67 | row.push([day,month]); day++;
|
---|
| 68 | if ( day > last ) { stop = true; }
|
---|
| 69 | }
|
---|
| 70 | }
|
---|
| 71 | cal.push(row);
|
---|
| 72 | }
|
---|
| 73 | }
|
---|
| 74 | return cal;
|
---|
| 75 | },
|
---|
| 76 | _cal_check : function (cal, year, month, date) {
|
---|
| 77 | var w = this, i,
|
---|
| 78 | o = this.options,
|
---|
| 79 | ret = {},
|
---|
| 80 | day = new this._date(year,month,date,0,0,0,0).getDay();
|
---|
| 81 |
|
---|
| 82 | ret.ok = true;
|
---|
| 83 | ret.iso = year + '-' + w._zPad(month+1) + '-' + w._zPad(date);
|
---|
| 84 | ret.comp = parseInt(ret.iso.replace(/-/g, ''),10);
|
---|
| 85 | ret.theme = o.themeDate;
|
---|
| 86 | ret.recok = true;
|
---|
| 87 | ret.rectheme = false;
|
---|
| 88 |
|
---|
| 89 | if ( o.blackDatesRec !== false ) {
|
---|
| 90 | for ( i=0; i<o.blackDatesRec.length; i++ ) {
|
---|
| 91 | if (
|
---|
| 92 | ( o.blackDatesRec[i][0] === -1 || o.blackDatesRec[i][0] === year ) &&
|
---|
| 93 | ( o.blackDatesRec[i][1] === -1 || o.blackDatesRec[i][1] === month ) &&
|
---|
| 94 | ( o.blackDatesRec[i][2] === -1 || o.blackDatesRec[i][2] === date )
|
---|
| 95 | ) { ret.recok = false; }
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | if ( $.isArray(o.enableDates) && $.inArray(ret.iso, o.enableDates) < 0 ) {
|
---|
| 100 | ret.ok = false;
|
---|
| 101 | } else if ( cal.checkDates ) {
|
---|
| 102 | if (
|
---|
| 103 | ( ret.recok !== true ) ||
|
---|
| 104 | ( o.afterToday === true && cal.thisDate.comp() > ret.comp ) ||
|
---|
| 105 | ( o.beforeToday === true && cal.thisDate.comp() < ret.comp ) ||
|
---|
| 106 | ( o.notToday === true && cal.thisDate.comp() === ret.comp ) ||
|
---|
| 107 | ( o.maxDays !== false && cal.maxDate.comp() < ret.comp ) ||
|
---|
| 108 | ( o.minDays !== false && cal.minDate.comp() > ret.comp ) ||
|
---|
| 109 | ( $.isArray(o.blackDays) && $.inArray(day, o.blackDays) > -1 ) ||
|
---|
| 110 | ( $.isArray(o.blackDates) && $.inArray(ret.iso, o.blackDates) > -1 )
|
---|
| 111 | ) {
|
---|
| 112 | ret.ok = false;
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 | if ( ret.ok ) {
|
---|
| 116 | if ( o.highDatesRec !== false ) {
|
---|
| 117 | for ( i=0; i<o.highDatesRec.length; i++ ) {
|
---|
| 118 | if (
|
---|
| 119 | ( o.highDatesRec[i][0] === -1 || o.highDatesRec[i][0] === year ) &&
|
---|
| 120 | ( o.highDatesRec[i][1] === -1 || o.highDatesRec[i][1] === month ) &&
|
---|
| 121 | ( o.highDatesRec[i][2] === -1 || o.highDatesRec[i][2] === date )
|
---|
| 122 | ) { ret.rectheme = true; }
|
---|
| 123 | }
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | if ( o.calHighPick && date === cal.presetDay && ( w.d.input.val() !== "" | o.defaultValue !== false )) {
|
---|
| 127 | ret.theme = o.themeDatePick;
|
---|
| 128 | } else if ( o.calHighToday && ret.comp === cal.thisDate.comp() ) {
|
---|
| 129 | ret.theme = o.themeDateToday;
|
---|
| 130 | } else if ( $.isArray(o.highDatesAlt) && ($.inArray(ret.iso, o.highDatesAlt) > -1) ) {
|
---|
| 131 | ret.theme = o.themeDateHighAlt;
|
---|
| 132 | } else if ( $.isArray(o.highDates) && ($.inArray(ret.iso, o.highDates) > -1) ) {
|
---|
| 133 | ret.theme = o.themeDateHigh;
|
---|
| 134 | } else if ( $.isArray(o.highDays) && ($.inArray(day, o.highDays) > -1) ) {
|
---|
| 135 | ret.theme = o.themeDayHigh;
|
---|
| 136 | } else if ( $.isArray(o.highDatesRec) && ret.rectheme === true ) {
|
---|
| 137 | ret.theme = o.themeDateHighRec;
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 | return ret;
|
---|
| 141 | }
|
---|
| 142 | });
|
---|
| 143 | $.extend( $.mobile.datebox.prototype._build, {
|
---|
| 144 | 'calbox': function () {
|
---|
| 145 | var w = this,
|
---|
| 146 | o = this.options, i,
|
---|
| 147 | cal = false,
|
---|
| 148 | uid = 'ui-datebox-',
|
---|
| 149 | temp = false, row = false, col = false, hRow = false, checked = false;
|
---|
| 150 |
|
---|
| 151 | if ( typeof w.d.intHTML !== 'boolean' ) {
|
---|
| 152 | w.d.intHTML.remove();
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | w.d.headerText = ((w._grabLabel() !== false)?w._grabLabel():w.__('titleDateDialogLabel'));
|
---|
| 156 | w.d.intHTML = $('<span>');
|
---|
| 157 |
|
---|
| 158 | $('<div class="'+uid+'gridheader"><div class="'+uid+'gridlabel"><h4>' +
|
---|
| 159 | w._formatter(w.__('calHeaderFormat'), w.theDate) +
|
---|
| 160 | '</h4></div></div>').appendTo(w.d.intHTML);
|
---|
| 161 |
|
---|
| 162 | // Previous and next month buttons, define booleans to decide if they should do anything
|
---|
| 163 | $("<div class='"+uid+"gridplus"+(w.__('isRTL')?'-rtl':'')+"'><a href='#'>"+w.__('nextMonth')+"</a></div>")
|
---|
| 164 | .prependTo(w.d.intHTML.find('.'+uid+'gridheader'))
|
---|
| 165 | .buttonMarkup({theme: o.themeDate, icon: 'arrow-r', inline: true, iconpos: 'notext', corners:true, shadow:true})
|
---|
| 166 | .on(o.clickEventAlt, function(e) {
|
---|
| 167 | e.preventDefault();
|
---|
| 168 | if ( w.calNext ) {
|
---|
| 169 | if ( w.theDate.getDate() > 28 ) { w.theDate.setDate(1); }
|
---|
| 170 | w._offset('m',1);
|
---|
| 171 | }
|
---|
| 172 | });
|
---|
| 173 | $("<div class='"+uid+"gridminus"+(w.__('isRTL')?'-rtl':'')+"'><a href='#'>"+w.__('prevMonth')+"</a></div>")
|
---|
| 174 | .prependTo(w.d.intHTML.find('.'+uid+'gridheader'))
|
---|
| 175 | .buttonMarkup({theme: o.themeDate, icon: 'arrow-l', inline: true, iconpos: 'notext', corners:true, shadow:true})
|
---|
| 176 | .on(o.clickEventAlt, function(e) {
|
---|
| 177 | e.preventDefault();
|
---|
| 178 | if ( w.calPrev ) {
|
---|
| 179 | if ( w.theDate.getDate() > 28 ) { w.theDate.setDate(1); }
|
---|
| 180 | w._offset('m',-1);
|
---|
| 181 | }
|
---|
| 182 | });
|
---|
| 183 |
|
---|
| 184 | if ( o.calNoHeader === true ) { w.d.intHTML.find('.'+uid+'gridheader').remove(); }
|
---|
| 185 |
|
---|
| 186 | cal = {'today': -1, 'highlightDay': -1, 'presetDay': -1, 'startDay': w.__('calStartDay'),
|
---|
| 187 | 'thisDate': new w._date(), 'maxDate': w.initDate.copy(), 'minDate': w.initDate.copy(),
|
---|
| 188 | 'currentMonth': false, 'weekMode': 0, 'weekDays': null };
|
---|
| 189 | cal.start = (w.theDate.copy([0],[0,0,1]).getDay() - w.__('calStartDay') + 7) % 7;
|
---|
| 190 | cal.thisMonth = w.theDate.getMonth();
|
---|
| 191 | cal.thisYear = w.theDate.getFullYear();
|
---|
| 192 | cal.wk = w.theDate.copy([0],[0,0,1]).adj(2,(-1*cal.start)+(w.__('calStartDay')===0?1:0)).getDWeek(4);
|
---|
| 193 | cal.end = 32 - w.theDate.copy([0],[0,0,32,13]).getDate();
|
---|
| 194 | cal.lastend = 32 - w.theDate.copy([0,-1],[0,0,32,13]).getDate();
|
---|
| 195 | cal.presetDate = (w.d.input.val() === "") ? w._startOffset(w._makeDate(w.d.input.val())) : w._makeDate(w.d.input.val());
|
---|
| 196 | cal.thisDateArr = cal.thisDate.getArray();
|
---|
| 197 | cal.theDateArr = w.theDate.getArray();
|
---|
| 198 | cal.checkDates = ( $.inArray(false, [o.afterToday, o.beforeToday, o.notToday, o.maxDays, o.minDays, o.blackDates, o.blackDays]) > -1 );
|
---|
| 199 |
|
---|
| 200 | w.calNext = true;
|
---|
| 201 | w.calPrev = true;
|
---|
| 202 |
|
---|
| 203 | if ( cal.thisDateArr[0] === cal.theDateArr[0] && cal.thisDateArr[1] === cal.theDateArr[1] ) { cal.currentMonth = true; }
|
---|
| 204 | if ( cal.presetDate.comp() === w.theDate.comp() ) { cal.presetDay = cal.presetDate.getDate(); }
|
---|
| 205 |
|
---|
| 206 | if ( o.afterToday === true &&
|
---|
| 207 | ( cal.currentMonth === true || ( cal.thisDateArr[1] >= cal.theDateArr[1] && cal.theDateArr[0] === cal.thisDateArr[0] ) ) ) {
|
---|
| 208 | w.calPrev = false; }
|
---|
| 209 | if ( o.beforeToday === true &&
|
---|
| 210 | ( cal.currentMonth === true || ( cal.thisDateArr[1] <= cal.theDateArr[1] && cal.theDateArr[0] === cal.thisDateArr[0] ) ) ) {
|
---|
| 211 | w.calNext = false; }
|
---|
| 212 |
|
---|
| 213 | if ( o.minDays !== false ) {
|
---|
| 214 | cal.minDate.adj(2, -1*o.minDays);
|
---|
| 215 | if ( cal.theDateArr[0] === cal.minDate.getFullYear() && cal.theDateArr[1] <= cal.minDate.getMonth() ) { w.calPrev = false;}
|
---|
| 216 | }
|
---|
| 217 | if ( o.maxDays !== false ) {
|
---|
| 218 | cal.maxDate.adj(2, o.maxDays);
|
---|
| 219 | if ( cal.theDateArr[0] === cal.maxDate.getFullYear() && cal.theDateArr[1] >= cal.maxDate.getMonth() ) { w.calNext = false;}
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | if ( o.calUsePickers === true ) {
|
---|
| 223 | cal.picker = $('<div>', {'class': 'ui-grid-a ui-datebox-grid','style':'padding-top: 5px; padding-bottom: 5px;'});
|
---|
| 224 |
|
---|
| 225 | cal.picker1 = $('<div class="ui-block-a"><select name="pickmon"></select></div>').appendTo(cal.picker).find('select');
|
---|
| 226 | cal.picker2 = $('<div class="ui-block-b"><select name="pickyar"></select></div>').appendTo(cal.picker).find('select');
|
---|
| 227 |
|
---|
| 228 | for ( i=0; i<=11; i++ ) {
|
---|
| 229 | cal.picker1.append($('<option value="'+i+'"'+((cal.thisMonth===i)?' selected="selected"':'')+'>'+w.__('monthsOfYear')[i]+'</option>'));
|
---|
| 230 | }
|
---|
| 231 | for ( i=(cal.thisYear-6); i<=cal.thisYear+6; i++ ) {
|
---|
| 232 | cal.picker2.append($('<option value="'+i+'"'+((cal.thisYear===i)?' selected="selected"':'')+'>'+i+'</option>'));
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | cal.picker1.on('change', function () { w.theDate.setMonth($(this).val()); w.refresh(); });
|
---|
| 236 | cal.picker2.on('change', function () { w.theDate.setFullYear($(this).val()); w.refresh(); });
|
---|
| 237 |
|
---|
| 238 | cal.picker.find('select').selectmenu({mini:true, nativeMenu: true});
|
---|
| 239 | cal.picker.appendTo(w.d.intHTML);
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | temp = $('<div class="'+uid+'grid">').appendTo(w.d.intHTML);
|
---|
| 243 |
|
---|
| 244 | if ( o.calShowDays ) {
|
---|
| 245 | w._cal_days = w.__('daysOfWeekShort').concat(w.__('daysOfWeekShort'));
|
---|
| 246 | cal.weekDays = $("<div>", {'class':uid+'gridrow'}).appendTo(temp);
|
---|
| 247 | if ( w.__('isRTL') === true ) { cal.weekDays.css('direction', 'rtl'); }
|
---|
| 248 | if ( o.calShowWeek ) {
|
---|
| 249 | $("<div>").addClass(uid+'griddate '+uid+'griddate-empty '+uid+'griddate-label').appendTo(cal.weekDays);
|
---|
| 250 | }
|
---|
| 251 | for ( i=0; i<=6;i++ ) {
|
---|
| 252 | $("<div>"+w._cal_days[(i+cal.startDay)%7]+"</div>").addClass(uid+'griddate '+uid+'griddate-empty '+uid+'griddate-label').appendTo(cal.weekDays);
|
---|
| 253 | }
|
---|
| 254 | }
|
---|
| 255 |
|
---|
| 256 | cal.gen = w._cal_gen(cal.start, cal.lastend, cal.end, !o.calOnlyMonth, w.theDate.getMonth());
|
---|
| 257 | for ( var row=0, rows=cal.gen.length; row < rows; row++ ) {
|
---|
| 258 | hRow = $('<div>', {'class': uid+'gridrow'});
|
---|
| 259 | if ( w.__('isRTL') ) { hRow.css('direction', 'rtl'); }
|
---|
| 260 | if ( o.calShowWeek ) {
|
---|
| 261 | $('<div>', {'class':uid+'griddate '+uid+'griddate-empty'}).text('W'+cal.wk).appendTo(hRow);
|
---|
| 262 | cal.wk++;
|
---|
| 263 | if ( cal.wk > 52 && typeof cal.gen[parseInt(row,10)+1] !== 'undefined' ) { cal.wk = new Date(cal.theDateArr[0],cal.theDateArr[1],((w.__('calStartDay')===0)?cal.gen[parseInt(row,10)+1][1][0]:cal.gen[parseInt(row,10)+1][0][0])).getDWeek(4); }
|
---|
| 264 | }
|
---|
| 265 | for ( var col=0, cols=cal.gen[row].length; col<cols; col++ ) {
|
---|
| 266 | if ( o.calWeekMode ) { cal.weekMode = cal.gen[row][o.calWeekModeDay][0]; }
|
---|
| 267 | if ( typeof cal.gen[row][col] === 'boolean' ) {
|
---|
| 268 | $('<div>', {'class':uid+'griddate '+uid+'griddate-empty'}).appendTo(hRow);
|
---|
| 269 | } else {
|
---|
| 270 | checked = w._cal_check(cal, cal.theDateArr[0], cal.gen[row][col][1], cal.gen[row][col][0]);
|
---|
| 271 | if (cal.gen[row][col][0]) {
|
---|
| 272 | $("<div>"+String(cal.gen[row][col][0])+"</div>")
|
---|
| 273 | .addClass( cal.thisMonth === cal.gen[row][col][1] ?
|
---|
| 274 | (uid+'griddate ui-corner-all ui-btn ui-btn-'+(o.mobVer<140?'up-':'')+checked.theme + (checked.ok?'':' '+uid+'griddate-disable')):
|
---|
| 275 | (uid+'griddate '+uid+'griddate-empty')
|
---|
| 276 | )
|
---|
| 277 | .jqmData('date', ((o.calWeekMode)?cal.weekMode:cal.gen[row][col][0]))
|
---|
| 278 | .jqmData('theme', cal.thisMonth === cal.gen[row][col][1] ? checked.theme : '-')
|
---|
| 279 | .jqmData('enabled', checked.ok)
|
---|
| 280 | .jqmData('month', cal.gen[row][((o.calWeekMode)?o.calWeekModeDay:col)][1])
|
---|
| 281 | .appendTo(hRow);
|
---|
| 282 | }
|
---|
| 283 | }
|
---|
| 284 | }
|
---|
| 285 | if ( o.calControlGroup === true ) {
|
---|
| 286 | hRow.find('.ui-corner-all').removeClass('ui-corner-all').eq(0).addClass('ui-corner-left').end().last().addClass('ui-corner-right').addClass('ui-controlgroup-last');
|
---|
| 287 | }
|
---|
| 288 | hRow.appendTo(temp);
|
---|
| 289 | }
|
---|
| 290 | if ( o.calShowWeek ) { temp.find('.'+uid+'griddate').addClass(uid+'griddate-week'); }
|
---|
| 291 |
|
---|
| 292 | if ( o.calShowDateList === true && o.calDateList !== false ) {
|
---|
| 293 | cal.datelist = $('<div>');
|
---|
| 294 | cal.datelistpick = $('<select name="pickdate"></select>').appendTo(cal.datelist);
|
---|
| 295 |
|
---|
| 296 | cal.datelistpick.append('<option value="false" selected="selected">'+w.__('calDateListLabel')+'</option>');
|
---|
| 297 | for ( i=0; i<o.calDateList.length; i++ ) {
|
---|
| 298 | cal.datelistpick.append($('<option value="'+o.calDateList[i][0]+'">'+o.calDateList[i][1]+'</option>'));
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | cal.datelistpick.on('change', function() {
|
---|
| 302 | cal.datelistdate = $(this).val().split('-');
|
---|
| 303 | w.theDate = new w._date(cal.datelistdate[0], cal.datelistdate[1]-1, cal.datelistdate[2], 0,0,0,0);
|
---|
| 304 | w.d.input.trigger('datebox',{'method':'doset'});
|
---|
| 305 | });
|
---|
| 306 |
|
---|
| 307 | cal.datelist.find('select').selectmenu({mini:true, nativeMenu:true});
|
---|
| 308 | cal.datelist.appendTo(w.d.intHTML);
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | if ( o.useTodayButton || o.useClearButton ) {
|
---|
| 312 | hRow = $('<div>', {'class':uid+'controls'});
|
---|
| 313 |
|
---|
| 314 | if ( o.useTodayButton ) {
|
---|
| 315 | $('<a href="#">'+w.__('calTodayButtonLabel')+'</a>')
|
---|
| 316 | .appendTo(hRow).buttonMarkup({theme: o.theme, icon: 'check', iconpos: 'left', corners:true, shadow:true})
|
---|
| 317 | .on(o.clickEvent, function(e) {
|
---|
| 318 | e.preventDefault();
|
---|
| 319 | w.theDate = new w._date();
|
---|
| 320 | w.theDate = new w._date(w.theDate.getFullYear(), w.theDate.getMonth(), w.theDate.getDate(),0,0,0,0);
|
---|
| 321 | w.d.input.trigger('datebox',{'method':'doset'});
|
---|
| 322 | });
|
---|
| 323 | }
|
---|
| 324 | if ( o.useClearButton ) {
|
---|
| 325 | $('<a href="#">'+w.__('clearButton')+'</a>')
|
---|
| 326 | .appendTo(hRow).buttonMarkup({theme: o.theme, icon: 'delete', iconpos: 'left', corners:true, shadow:true})
|
---|
| 327 | .on(o.clickEventAlt, function(e) {
|
---|
| 328 | e.preventDefault();
|
---|
| 329 | w.d.input.val('');
|
---|
| 330 | w.d.input.trigger('datebox',{'method':'clear'});
|
---|
| 331 | w.d.input.trigger('datebox',{'method':'close'});
|
---|
| 332 | });
|
---|
| 333 | }
|
---|
| 334 | if ( o.useCollapsedBut ) {
|
---|
| 335 | hRow.addClass('ui-datebox-collapse');
|
---|
| 336 | }
|
---|
| 337 | hRow.appendTo(temp);
|
---|
| 338 | }
|
---|
| 339 |
|
---|
| 340 | w.d.intHTML.on(o.clickEventAlt+' vmouseover vmouseout', 'div.'+uid+'griddate', function(e) {
|
---|
| 341 | if ( e.type === o.clickEventAlt ) {
|
---|
| 342 | e.preventDefault();
|
---|
| 343 | if ( $(this).jqmData('enabled') ) {
|
---|
| 344 | w.theDate.setD(2,1).setD(1,$(this).jqmData('month')).setD(2,$(this).jqmData('date'));
|
---|
| 345 | w.d.input.trigger('datebox', {'method':'set', 'value':w._formatter(w.__fmt(),w.theDate), 'date':w.theDate});
|
---|
| 346 | w.d.input.trigger('datebox', {'method':'close'});
|
---|
| 347 | }
|
---|
| 348 | } else {
|
---|
| 349 | if ( $(this).jqmData('enabled') && typeof $(this).jqmData('theme') !== 'undefined' && o.mobVer < 140 ) {
|
---|
| 350 | if ( o.calWeekMode !== false && o.calWeekHigh === true ) {
|
---|
| 351 | $(this).parent().find('div').each(function() { w._hoover(this); });
|
---|
| 352 | } else { w._hoover(this); }
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
| 355 | });
|
---|
| 356 | w.d.intHTML
|
---|
| 357 | .on('swipeleft', function() { if ( w.calNext ) { w._offset('m', 1); } })
|
---|
| 358 | .on('swiperight', function() { if ( w.calPrev ) { w._offset('m', -1); } });
|
---|
| 359 |
|
---|
| 360 | if ( w.wheelExists) { // Mousewheel operations, if plugin is loaded
|
---|
| 361 | w.d.intHTML.on('mousewheel', function(e,d) {
|
---|
| 362 | e.preventDefault();
|
---|
| 363 | if ( d > 0 && w.calNext ) {
|
---|
| 364 | w.theDate.setD(2,1);
|
---|
| 365 | w._offset('m', 1);
|
---|
| 366 | }
|
---|
| 367 | if ( d < 0 && w.calPrev ) {
|
---|
| 368 | w.theDate.setD(2,1);
|
---|
| 369 | w._offset('m', -1);
|
---|
| 370 | }
|
---|
| 371 | });
|
---|
| 372 | }
|
---|
| 373 | }
|
---|
| 374 | });
|
---|
| 375 | })( jQuery );
|
---|