Skip to content

Commit

Permalink
Merging 3.2.2 changes - fixes #427, #430
Browse files Browse the repository at this point in the history
  • Loading branch information
dioslaska committed Jul 10, 2017
1 parent 91751b2 commit a9fe06d
Show file tree
Hide file tree
Showing 21 changed files with 248 additions and 136 deletions.
2 changes: 1 addition & 1 deletion packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-angular",
"version": "3.2.1",
"version": "3.2.2",
"description": "Angular UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/angularjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-angularjs",
"version": "3.2.1",
"version": "3.2.2",
"description": "AngularJS UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-javascript",
"version": "3.2.1",
"version": "3.2.2",
"description": "Framework agnostic UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jquery/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-jquery",
"version": "3.2.1",
"version": "3.2.2",
"description": "jQuery and jQuery Mobile UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/knockout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-knockout",
"version": "3.2.1",
"version": "3.2.2",
"description": "Knockout UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobiscroll-react",
"version": "3.2.1",
"version": "3.2.2",
"description": "React UI library for progressive web and hybrid apps",
"homepage": "https://mobiscroll.com/",
"license": "Apache-2.0",
Expand Down
59 changes: 31 additions & 28 deletions src/js/classes/forms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mobiscroll, {
$
$,
isBrowser
} from '../core/core';
import './page';
import '../util/notifications';
Expand Down Expand Up @@ -231,42 +232,44 @@ mobiscroll.presetShort('form', 'Form');
// Init mbsc-enhance elements on page load
// ---

$(function () {
if (isBrowser) {
$(function () {

var selector = '[mbsc-enhance],[mbsc-form]';
var selector = '[mbsc-enhance],[mbsc-form]';

$(selector).each(function () {
new Form(this);
});
$(selector).each(function () {
new Form(this);
});

$(document).on('mbsc-enhance', function (ev, settings) {
if ($(ev.target).is(selector)) {
new Form(ev.target, settings);
} else {
$(selector, ev.target).each(function () {
new Form(this, settings);
});
}
});
$(document).on('mbsc-enhance', function (ev, settings) {
if ($(ev.target).is(selector)) {
new Form(ev.target, settings);
} else {
$(selector, ev.target).each(function () {
new Form(this, settings);
});
}
});

$(document).on('mbsc-refresh', function (ev) {
var inst;
$(document).on('mbsc-refresh', function (ev) {
var inst;

if ($(ev.target).is(selector)) {
inst = instances[ev.target.id];
if (inst) {
inst.refresh();
}
} else {
$(selector, ev.target).each(function () {
inst = instances[this.id];
if ($(ev.target).is(selector)) {
inst = instances[ev.target.id];
if (inst) {
inst.refresh();
}
});
}
} else {
$(selector, ev.target).each(function () {
inst = instances[this.id];
if (inst) {
inst.refresh();
}
});
}
});
});
});
}

// ---
// Init end
Expand Down
30 changes: 19 additions & 11 deletions src/js/classes/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import mobiscroll, {
$,
extend
} from '../core/core';
import platform from '../util/platform';
import {
os,
majorVersion,
isBrowser,
userAgent
} from '../util/platform';

var $activeElm,
preventShow,
Expand All @@ -13,9 +18,10 @@ var $activeElm,
isString = util.isString,
getCoord = util.getCoord,
animEnd = util.animEnd,
needsFixed = /(iphone|ipod)/i.test(navigator.userAgent) && platform.majorVersion >= 7,
isAndroid = platform.name == 'android',
isIOS8 = platform.name == 'ios' && platform.majorVersion == 8,
needsFixed = /(iphone|ipod)/i.test(userAgent) && majorVersion >= 7,
isAndroid = os == 'android',
isIOS = os == 'ios',
isIOS8 = isIOS && majorVersion == 8,
empty = function () {},
prevdef = function (ev) {
ev.preventDefault();
Expand Down Expand Up @@ -1088,7 +1094,7 @@ Frame.prototype._defaults = {
maxPopupWidth: 600,
disabled: false,
closeOnOverlayTap: true,
showOnFocus: isAndroid, // Needed for ion-input
showOnFocus: isAndroid || isIOS, // Needed for ion-input
showOnTap: true,
display: 'center',
scroll: true,
Expand Down Expand Up @@ -1119,11 +1125,13 @@ themes.scroller.mobiscroll = extend({}, themes.frame.mobiscroll, {
btnCalNextClass: 'mbsc-ic mbsc-ic-arrow-right5'
});

// Prevent re-show on window focus
$(window).on('focus', function () {
if ($activeElm) {
preventShow = true;
}
});
if (isBrowser) {
// Prevent re-show on window focus
$(window).on('focus', function () {
if ($activeElm) {
preventShow = true;
}
});
}

export default Frame;
33 changes: 18 additions & 15 deletions src/js/classes/page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mobiscroll, {
$
$,
isBrowser
} from '../core/core';

var classes = mobiscroll.classes;
Expand Down Expand Up @@ -86,24 +87,26 @@ mobiscroll.presetShort('page', 'Page');
// Init mbsc-page elements on page load or when mbsc-enhance event is triggeres
// ---

$(function () {
if (isBrowser) {
$(function () {

var selector = '[mbsc-page]';
var selector = '[mbsc-page]';

$(selector).each(function () {
new classes.Page(this);
});
$(selector).each(function () {
new classes.Page(this);
});

$(document).on('mbsc-enhance', function (ev, settings) {
if ($(ev.target).is(selector)) {
new classes.Page(ev.target, settings);
} else {
$(selector, ev.target).each(function () {
new classes.Page(this, settings);
});
}
$(document).on('mbsc-enhance', function (ev, settings) {
if ($(ev.target).is(selector)) {
new classes.Page(ev.target, settings);
} else {
$(selector, ev.target).each(function () {
new classes.Page(this, settings);
});
}
});
});
});
}

// ---
// Init end
Expand Down
11 changes: 7 additions & 4 deletions src/js/classes/scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import mobiscroll, {
$,
extend
} from '../core/core';
import {
os,
isBrowser
} from '../util/platform';
import Frame from './frame';
import ScrollView from './scrollview';

var platform = mobiscroll.platform,
util = mobiscroll.util,
var util = mobiscroll.util,
pr = util.jsPrefix,
pref = util.prefix,
getCoord = util.getCoord,
testTouch = util.testTouch,
css = window.CSS,
css = isBrowser ? window.CSS : null,
has3d = css && css.supports && css.supports("(transform-style: preserve-3d)"),
force2D = !has3d || platform.name == 'wp' || platform.name == 'android';
force2D = !has3d || os == 'wp' || os == 'android';

mobiscroll.presetShort('scroller', 'Scroller', false);

Expand Down
13 changes: 6 additions & 7 deletions src/js/classes/scrollview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import mobiscroll, {
$
} from '../core/core';
import {
os,
raf,
rafc
} from '../util/platform';

var classes = mobiscroll.classes,
util = mobiscroll.util,
Expand All @@ -12,13 +17,7 @@ var classes = mobiscroll.classes,
testTouch = util.testTouch,
isNumeric = util.isNumeric,
isString = util.isString,
isIOS = /(iphone|ipod|ipad)/i.test(navigator.userAgent),
empty = function () {},
//transEnd = 'webkitTransitionEnd transitionend',
raf = window.requestAnimationFrame || function (x) {
x();
},
rafc = window.cancelAnimationFrame || empty;
isIOS = os == 'ios';

const ScrollView = function (el, settings, inherit) {
var $btn,
Expand Down
9 changes: 6 additions & 3 deletions src/js/classes/textarea.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
$
$,
isBrowser
} from '../core/core';
import Input from './input';

Expand Down Expand Up @@ -55,8 +56,10 @@ function scrollTextArea(elm) {
}
}

// Set height of textareas on viewport size changes
$(window).on('resize orientationchange', sizeTextAreas);
if (isBrowser) {
// Set height of textareas on viewport size changes
$(window).on('resize orientationchange', sizeTextAreas);
}

class TextArea extends Input {
constructor(elm) {
Expand Down
37 changes: 27 additions & 10 deletions src/js/core/core.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Mobiscroll v3.2.1
* Mobiscroll v3.2.2
* http://mobiscroll.com
*
* Copyright 2010-2016, Acid Media
Expand All @@ -8,7 +8,12 @@
*/

import mobiscroll from './mobiscroll';
import platform from '../util/platform';
import {
os,
majorVersion,
minorVersion,
isBrowser
} from '../util/platform';
import {
preventClick,
getCoord,
Expand Down Expand Up @@ -39,20 +44,27 @@ function testPrefix() {
return '';
}

var ms,
var animEnd,
mod,
ms,
pr,
prefix,
empty = function () {},
$ = mobiscroll.$,
id = +new Date(),
instances = {},
extend = $.extend,
mod = document.createElement('modernizr').style,
prefix = testPrefix(),
pr = prefix.replace(/^\-/, '').replace(/\-$/, '').replace('moz', 'Moz'),
extend = $.extend;

if (isBrowser) {
mod = document.createElement('modernizr').style;
prefix = testPrefix();
pr = prefix.replace(/^\-/, '').replace(/\-$/, '').replace('moz', 'Moz');
animEnd = mod.animation !== undefined ? 'animationend' : 'webkitAnimationEnd';
}

ms = extend(mobiscroll, {
$: $,
version: '3.2.1',
version: '3.2.2',
util: {
prefix: prefix,
jsPrefix: pr,
Expand Down Expand Up @@ -161,7 +173,11 @@ ms = extend(mobiscroll, {
menustrip: {},
progress: {}
},
platform: platform,
platform: {
name: os,
majorVersion: majorVersion,
minorVersion: minorVersion
},
i18n: {},
instances: instances,
classes: {},
Expand Down Expand Up @@ -359,5 +375,6 @@ ms.classes.Base = function (el, settings) {

export {
$,
extend
extend,
isBrowser
};
Loading

0 comments on commit a9fe06d

Please sign in to comment.