Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dioslaska committed Apr 20, 2016
2 parents e4038e7 + 9b5c405 commit 396f6cd
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 70 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll",
"version": "2.17.1",
"version": "2.17.2",
"main": [
"js/mobiscroll.core.js",
"js/mobiscroll.frame.js",
Expand Down
3 changes: 3 additions & 0 deletions css/mobiscroll.frame.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
overflow: hidden;
text-align: center;
font-family: arial, verdana, sans-serif;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
/* Modal overlay */

Expand Down
3 changes: 3 additions & 0 deletions css/mobiscroll.scroller.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@
left: 0;
width: 100%;
pointer-events: none;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
/* Liquid mode */

Expand Down
61 changes: 61 additions & 0 deletions js/i18n/mobiscroll.i18n.da.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Dansk
/*
* Translation by: Mikkel Bonde, Apacta A/S <[email protected]>
*/
(function ($) {
$.mobiscroll.i18n.da = {
// Core
setText: 'Sæt',
cancelText: 'Annuller',
clearText: 'Ryd',
selectedText: '{count} valgt',
selectedPluralText: '{count} valgt',
// Datetime component
dateFormat: 'dd/mm/yy',
dateOrder: 'ddmmyy',
dayNames: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'],
dayNamesShort: ['Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'],
dayNamesMin: ['S', 'M', 'T', 'O', 'T', 'F', 'L'],
dayText: 'Dag',
hourText: 'Timer',
minuteText: 'Minutter',
monthNames: ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
monthText: 'Måned',
secText: 'Sekunder',
amText: 'am',
pmText: 'pm',
timeFormat: 'HH:ii',
timeWheels: 'HHii',
yearText: 'År',
nowText: 'Nu',
// Calendar component
firstDay: 1,
dateText: 'Dato',
timeText: 'Tid',
calendarText: 'Kalender',
closeText: 'Luk',
// Daterange component
fromText: 'Start',
toText: 'Slut',
// Measurement components
wholeText: 'Hele',
fractionText: 'Dele',
unitText: 'Enhed',
// Time / Timespan component
labels: ['År', 'Måneder', 'Dage', 'Timer', 'Minutter', 'Sekunder', ''],
labelsShort: ['År', 'Mdr', 'Dg', 'Timer', 'Min', 'Sek', ''],
// Timer component
startText: 'Start',
stopText: 'Stop',
resetText: 'Nulstil',
lapText: 'Omgang',
hideText: 'Skjul',
// Forms
offText: 'Fra',
onText: 'Til',
// Listview
backText: 'Tilbage',
undoText: 'Fortryd'
};
})(jQuery);
32 changes: 12 additions & 20 deletions js/mobiscroll.core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mobiscroll v2.17.1
* Mobiscroll v2.17.2
* http://mobiscroll.com
*
* Copyright 2010-2015, Acid Media
Expand Down Expand Up @@ -78,7 +78,7 @@
};

ms = $.mobiscroll = $.mobiscroll || {
version: '2.17.1',
version: '2.17.2',
util: {
prefix: prefix,
jsPrefix: pr,
Expand Down Expand Up @@ -174,7 +174,9 @@
} else {
icons[align] = icon;
}
}

if (icon || ic) {
extend(icons, ic);

$parent
Expand Down Expand Up @@ -306,12 +308,14 @@
};

that._destroy = function () {
that.trigger('onDestroy', []);
if (that) {
that.trigger('onDestroy', []);

// Delete scroller instance
delete instances[el.id];
// Delete scroller instance
delete instances[el.id];

that = null;
that = null;
}
};

/**
Expand All @@ -333,12 +337,6 @@
startX = getCoord(ev, 'X');
startY = getCoord(ev, 'Y');
moved = false;

if (ev.type == 'pointerdown') {
$(document)
.on('pointermove', onMove)
.on('pointerup', onEnd);
}
}
}

Expand All @@ -356,12 +354,6 @@
handler.call(target, ev, that);
}

if (ev.type == 'pointerup') {
$(document)
.off('pointermove', onMove)
.off('pointerup', onEnd);
}

target = false;

util.preventClick();
Expand All @@ -374,8 +366,8 @@

if (s.tap) {
el
.on('touchstart.dw pointerdown.dw', onStart)
.on('touchcancel.dw pointercancel.dw', onCancel)
.on('touchstart.dw', onStart)
.on('touchcancel.dw', onCancel)
.on('touchmove.dw', onMove)
.on('touchend.dw', onEnd);
}
Expand Down
11 changes: 6 additions & 5 deletions js/mobiscroll.datetimebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var ms = $.mobiscroll,
datetime = ms.datetime,
adjustedDate = datetime.adjustedDate,
date = new Date(),
defaults = {
startYear: date.getFullYear() - 100,
Expand Down Expand Up @@ -105,8 +106,8 @@
stepM = steps.minute || s.stepMinute || 1,
stepS = steps.second || s.stepSecond || 1,
zeroBased = steps.zeroBased,
mind = s.minDate || new Date(s.startYear, 0, 1),
maxd = s.maxDate || new Date(s.endYear, 11, 31, 23, 59, 59),
mind = s.minDate || adjustedDate(s.startYear, 0, 1),
maxd = s.maxDate || adjustedDate(s.endYear, 11, 31, 23, 59, 59),
minH = zeroBased ? 0 : mind.getHours() % stepH,
minM = zeroBased ? 0 : mind.getMinutes() % stepM,
minS = zeroBased ? 0 : mind.getSeconds() % stepS,
Expand Down Expand Up @@ -637,7 +638,7 @@
if (v.start && v.start.getTime) {
start = new Date(v.start);
while (start <= v.end) {
ret.push(new Date(start.getFullYear(), start.getMonth(), start.getDate()));
ret.push(adjustedDate(start.getFullYear(), start.getMonth(), start.getDate()));
start.setDate(start.getDate() + 1);
}
} else {
Expand Down Expand Up @@ -747,7 +748,7 @@
max = maxs[i],
maxdays = 31,
val = get(temp, i),
t = $('.dw-ul', dw).eq(o[i]);
t = $('.dwwl' + o[i] + ' .dw-ul', dw);

if (i == 'd') {
maxdays = s.getMaxDayOfMonth(y, m);
Expand Down Expand Up @@ -812,7 +813,7 @@
$.each(['a', 'h', 'i', 's'], function (i, v) {
var val = get(temp, v),
d = get(temp, 'd'),
t = $('.dw-ul', dw).eq(o[v]);
t = $('.dwwl' + o[v] + ' .dw-ul', dw);

if (o[v] !== undefined) {
validateTimes(invalid, i, v, temp, y, m, d, t, 0);
Expand Down
31 changes: 17 additions & 14 deletions js/mobiscroll.frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
preventShow,
ms = $.mobiscroll,
util = ms.util,
pr = util.jsPrefix,
has3d = util.has3d,
constrain = util.constrain,
isString = util.isString,
Expand Down Expand Up @@ -98,23 +97,27 @@
var activeEl,
value,
type,
$activeEl = $activeElm,
focus = s.focusOnClose;

that._markupRemove();

$markup.remove();

if ($activeElm && !prevAnim) {
if (!prevAnim) {
if (!$activeEl) {
$activeEl = $elm;
}
setTimeout(function () {
if (focus === undefined || focus === true) {
preventShow = true;
activeEl = $activeElm[0];
activeEl = $activeEl[0];
type = activeEl.type;
value = activeEl.value;
try {
activeEl.type = 'button';
} catch (ex) {}
$activeElm.focus();
$activeEl.focus();
activeEl.type = type;
activeEl.value = value;
} else if (focus) {
Expand All @@ -123,6 +126,8 @@
}, 200);
}

$activeElm = null;

that._isVisible = false;

event('onHide', []);
Expand Down Expand Up @@ -157,11 +162,6 @@
beforeShow();
}

// Hide virtual keyboard
if ($(document.activeElement).is('input,textarea')) {
$(document.activeElement).blur();
}

if (that.show() !== false) {
$activeElm = $elm;

Expand Down Expand Up @@ -210,16 +210,16 @@
totalw = 0,
minw = 0,
css = {},
nw = Math.min($wnd[0].innerWidth || $wnd.innerWidth(), $persp.width()), //$persp.width(), // To get the width without scrollbar
nw = Math.min($wnd[0].innerWidth || $wnd.innerWidth(), $persp ? $persp.width() : 0), //$persp.width(), // To get the width without scrollbar
nh = $wnd[0].innerHeight || $wnd.innerHeight(),
$focused = $(document.activeElement);

if ($focused.is('input,textarea') && !/(button|submit|checkbox|radio)/.test($focused.attr('type'))) {
if (isModal && $focused.is('input,textarea') && !/(button|submit|checkbox|radio)/.test($focused.attr('type'))) {
$focused.on('blur', onBlur);
return;
}

if ((wndWidth === nw && wndHeight === nh && check) || preventPos) {
if ((wndWidth === nw && wndHeight === nh && check) || preventPos || !that._isVisible) {
return;
}

Expand Down Expand Up @@ -461,6 +461,9 @@
return false;
}

// Hide virtual keyboard
document.activeElement.blur();

doAnim = isOldAndroid ? false : s.animate;

if (doAnim !== false) {
Expand Down Expand Up @@ -543,7 +546,7 @@
}

// Disable inputs to prevent bleed through (Android bug)
if (pr !== 'Moz') {
if (isOldAndroid) {
$('input,select,button', $ctx).each(function () {
if (!this.disabled) {
$(this).addClass('dwtd').prop('disabled', true);
Expand Down Expand Up @@ -669,7 +672,7 @@
// Hide wheels and overlay
if ($markup) {
// Re-enable temporary disabled fields
if (pr !== 'Moz') {
if (isOldAndroid) {
$('.dwtd', $ctx).each(function () {
$(this).prop('disabled', false).removeClass('dwtd');
});
Expand Down
11 changes: 6 additions & 5 deletions js/mobiscroll.scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@

function isReadOnly(wh) {
if ($.isArray(s.readonly)) {
var i = $('.dwwl', $markup).index(wh);
var i = +$(wh).attr('data-index');
return s.readonly[i];
}
return s.readonly;
Expand Down Expand Up @@ -259,7 +259,7 @@
multiple = t.closest('.dwwl').hasClass('dwwms');
min = $('.dw-li', t).index($(multiple ? '.dw-li' : '.dw-v', t).eq(0));
max = Math.max(min, $('.dw-li', t).index($(multiple ? '.dw-li' : '.dw-v', t).eq(-1)) - (multiple ? s.rows - (s.mode == 'scroller' ? 1 : 3) : 0));
index = $('.dw-ul', $markup).index(t);
index = +t.closest('.dwwl').attr('data-index');
}

function formatHeader(v) {
Expand Down Expand Up @@ -372,8 +372,9 @@
// Call validation event
if (trigger('validate', [$markup, index, time, dir]) !== false) {
// Set scrollers to position
$('.dw-ul', $markup).each(function (i) {
$('.dw-ul', $markup).each(function () {
var t = $(this),
i = +t.closest('.dwwl').attr('data-index'),
multiple = t.closest('.dwwl').hasClass('dwwms'),
sc = i == index || index === undefined,
res = getValid(that._tempWheelArray[i], t, dir, multiple, true),
Expand Down Expand Up @@ -527,7 +528,7 @@
$.each(wg, function (k, w) {
if ($.inArray(i, idx) > -1) {
wheels[i] = w;
$('.dw-ul', $markup).eq(i).html(generateWheelItems(i));
$('.dwwl' + i + ' .dw-ul', $markup).html(generateWheelItems(i));
nr--;
if (!nr) {
that.position();
Expand Down Expand Up @@ -570,7 +571,7 @@
(s.fixedWidth ? ('width:' + (s.fixedWidth[l] || s.fixedWidth) + 'px;') :
(s.minWidth ? ('min-width:' + (s.minWidth[l] || s.minWidth) + 'px;') : 'min-width:' + s.width + 'px;') +
(s.maxWidth ? ('max-width:' + (s.maxWidth[l] || s.maxWidth) + 'px;') : '')) + '">' +
'<div class="dwwl dwwl' + l + (w.multiple ? ' dwwms' : '') + '">' +
'<div class="dwwl dwwl' + l + (w.multiple ? ' dwwms' : '') + '" data-index="' + l + '">' +
(s.mode != 'scroller' ?
'<div class="dwb-e dwwb dwwbp ' + (s.btnPlusClass || '') + '" style="height:' + itemHeight + 'px;line-height:' + itemHeight + 'px;"><span>+</span></div>' + // + button
'<div class="dwb-e dwwb dwwbm ' + (s.btnMinusClass || '') + '" style="height:' + itemHeight + 'px;line-height:' + itemHeight + 'px;"><span>&ndash;</span></div>' : '') + // - button
Expand Down
2 changes: 1 addition & 1 deletion js/mobiscroll.select.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
inst._tempWheelArray = groupWheel ? [group, option] : [option];

if (inst._isVisible) {
inst.changeWheel(groupWheel ? [groupWheelIdx, optionWheelIdx] : [optionWheelIdx]);
inst.changeWheel(groupWheel ? [groupWheelIdx, optionWheelIdx] : [optionWheelIdx], 0, true);
}
};

Expand Down
Loading

0 comments on commit 396f6cd

Please sign in to comment.