mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge initial wp8 fixes
This commit is contained in:
@@ -13,9 +13,10 @@
|
||||
(function(ionic) {
|
||||
|
||||
// Custom event polyfill
|
||||
ionic.CustomEvent = window.CustomEvent || (function() {
|
||||
var CustomEvent;
|
||||
CustomEvent = function(event, params) {
|
||||
ionic.CustomEvent = (function() {
|
||||
if( typeof window.CustomEvent === 'function' ) return CustomEvent;
|
||||
|
||||
var customEvent = function(event, params) {
|
||||
var evt;
|
||||
params = params || {
|
||||
bubbles: false,
|
||||
@@ -35,8 +36,8 @@
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
CustomEvent.prototype = window.Event.prototype;
|
||||
return CustomEvent;
|
||||
customEvent.prototype = window.Event.prototype;
|
||||
return customEvent;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ function keyboardSetShow(e) {
|
||||
clearTimeout(keyboardFocusOutTimer);
|
||||
|
||||
keyboardFocusInTimer = setTimeout(function(){
|
||||
if ( keyboardLastShow + 350 > Date.now() ) return;
|
||||
if ( keyboardLastShow + 350 > Date.now() ) return;
|
||||
keyboardLastShow = Date.now();
|
||||
var keyboardHeight;
|
||||
var keyboardHeight;
|
||||
var elementBounds = keyboardActiveElement.getBoundingClientRect();
|
||||
var count = 0;
|
||||
|
||||
@@ -80,8 +80,8 @@ function keyboardSetShow(e) {
|
||||
clearInterval(pollKeyboardHeight);
|
||||
}
|
||||
count++;
|
||||
|
||||
}, 100);
|
||||
|
||||
}, 100);
|
||||
}, 32);
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ function keyboardShow(element, elementTop, elementBottom, viewportHeight, keyboa
|
||||
|
||||
details.contentHeight = viewportHeight - keyboardHeight;
|
||||
|
||||
console.debug('keyboardShow', keyboardHeight, details.contentHeight);
|
||||
console.log('keyboardShow', keyboardHeight, details.contentHeight);
|
||||
|
||||
// distance from top of input to the top of the keyboard
|
||||
details.keyboardTopOffset = details.elementTop - details.contentHeight;
|
||||
|
||||
console.debug('keyboardTopOffset', details.elementTop, details.contentHeight, details.keyboardTopOffset);
|
||||
console.log('keyboardTopOffset', details.elementTop, details.contentHeight, details.keyboardTopOffset);
|
||||
|
||||
// figure out if the element is under the keyboard
|
||||
details.isElementUnderKeyboard = (details.elementBottom > details.contentHeight);
|
||||
@@ -133,7 +133,7 @@ function keyboardFocusOut(e) {
|
||||
}
|
||||
|
||||
function keyboardHide() {
|
||||
console.debug('keyboardHide');
|
||||
console.log('keyboardHide');
|
||||
ionic.keyboard.isOpen = false;
|
||||
|
||||
ionic.trigger('resetScrollView', {
|
||||
@@ -178,10 +178,10 @@ function keyboardOrientationChange() {
|
||||
}
|
||||
|
||||
updatedViewportHeight = window.innerHeight;
|
||||
|
||||
|
||||
if (updatedViewportHeight !== keyboardViewportHeight){
|
||||
if (updatedViewportHeight < keyboardViewportHeight){
|
||||
ionic.keyboard.landscape = true;
|
||||
ionic.keyboard.landscape = true;
|
||||
}
|
||||
else {
|
||||
ionic.keyboard.landscape = false;
|
||||
@@ -194,7 +194,7 @@ function keyboardOrientationChange() {
|
||||
}, 50);
|
||||
}
|
||||
else {
|
||||
keyboardViewportHeight = updatedViewportHeight;
|
||||
keyboardViewportHeight = updatedViewportHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
(function(window, document, ionic) {
|
||||
|
||||
var IOS = 'ios';
|
||||
var ANDROID = 'android';
|
||||
var WINDOWS_PHONE = 'windowsphone';
|
||||
|
||||
/**
|
||||
* @ngdoc utility
|
||||
* @name ionic.Platform
|
||||
@@ -142,7 +146,7 @@
|
||||
* @returns {boolean} Whether we are running on iOS.
|
||||
*/
|
||||
isIOS: function() {
|
||||
return this.is('ios');
|
||||
return this.is(IOS);
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
@@ -150,7 +154,15 @@
|
||||
* @returns {boolean} Whether we are running on Android.
|
||||
*/
|
||||
isAndroid: function() {
|
||||
return this.is('android');
|
||||
return this.is(ANDROID);
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name ionic.Platform#isWindowsPhone
|
||||
* @returns {boolean} Whether we are running on Windows Phone.
|
||||
*/
|
||||
isWindowsPhone: function() {
|
||||
return this.is(WINDOWS_PHONE);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -171,11 +183,13 @@
|
||||
if(typeof n != 'undefined' && n !== null && n.length) {
|
||||
platformName = n.toLowerCase();
|
||||
} else if(this.ua.indexOf('Android') > 0) {
|
||||
platformName = 'android';
|
||||
platformName = ANDROID;
|
||||
} else if(this.ua.indexOf('iPhone') > -1 || this.ua.indexOf('iPad') > -1 || this.ua.indexOf('iPod') > -1) {
|
||||
platformName = 'ios';
|
||||
platformName = IOS;
|
||||
} else if(this.ua.indexOf('Windows Phone') > -1) {
|
||||
platformName = WINDOWS_PHONE;
|
||||
} else {
|
||||
platformName = window.navigator.platform && window.navigator.platform.toLowerCase().split(' ')[0] || '';
|
||||
platformName = window.navigator.platform && navigator.platform.toLowerCase().split(' ')[0] || '';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -209,7 +223,8 @@
|
||||
var pName = this.platform();
|
||||
var versionMatch = {
|
||||
'android': /Android (\d+).(\d+)?/,
|
||||
'ios': /OS (\d+)_(\d+)?/
|
||||
'ios': /OS (\d+)_(\d+)?/,
|
||||
'windowsphone': /Windows Phone (\d+).(\d+)?/
|
||||
};
|
||||
if(versionMatch[pName]) {
|
||||
v = this.ua.match( versionMatch[pName] );
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
// transform
|
||||
var i, keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform',
|
||||
'-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform'];
|
||||
'-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];
|
||||
|
||||
for(i = 0; i < keys.length; i++) {
|
||||
if(document.documentElement.style[keys[i]] !== undefined) {
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
// transition
|
||||
keys = ['webkitTransition', 'mozTransition', 'transition'];
|
||||
keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];
|
||||
for(i = 0; i < keys.length; i++) {
|
||||
if(document.documentElement.style[keys[i]] !== undefined) {
|
||||
ionic.CSS.TRANSITION = keys[i];
|
||||
|
||||
@@ -216,7 +216,7 @@ function tapClick(e) {
|
||||
|
||||
var c = getPointerCoordinates(e);
|
||||
|
||||
console.debug('tapClick', e.type, ele.tagName, '('+c.x+','+c.y+')');
|
||||
console.log('tapClick', e.type, ele.tagName, '('+c.x+','+c.y+')');
|
||||
triggerMouseEvent('click', ele, c.x, c.y);
|
||||
|
||||
// if it's an input, focus in on the target, otherwise blur
|
||||
@@ -240,7 +240,7 @@ function tapClickGateKeeper(e) {
|
||||
// do not allow through any click events that were not created by ionic.tap
|
||||
if( (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target) ) ||
|
||||
(!e.isIonicTap && !ionic.tap.requiresNativeClick(e.target)) ) {
|
||||
console.debug('clickPrevent', e.target.tagName);
|
||||
console.log('clickPrevent', e.target.tagName);
|
||||
e.stopPropagation();
|
||||
|
||||
if( !ionic.tap.isLabelWithTextInput(e.target) ) {
|
||||
@@ -256,7 +256,7 @@ function tapMouseDown(e) {
|
||||
if(e.isIonicTap || tapIgnoreEvent(e)) return;
|
||||
|
||||
if(tapEnabledTouchEvents) {
|
||||
console.debug('mousedown', 'stop event');
|
||||
console.log('mousedown', 'stop event');
|
||||
e.stopPropagation();
|
||||
|
||||
if( !ionic.tap.isTextInput(e.target) ) {
|
||||
@@ -412,7 +412,7 @@ function tapHandleFocus(ele) {
|
||||
function tapFocusOutActive() {
|
||||
var ele = tapActiveElement();
|
||||
if(ele && (/input|textarea|select/i).test(ele.tagName) ) {
|
||||
console.debug('tapFocusOutActive', ele.tagName);
|
||||
console.log('tapFocusOutActive', ele.tagName);
|
||||
ele.blur();
|
||||
}
|
||||
tapActiveElement(null);
|
||||
@@ -432,7 +432,7 @@ function tapFocusIn(e) {
|
||||
// 2) There is an active element which is a text input
|
||||
// 3) A text input was just set to be focused on by a touch event
|
||||
// 4) A new focus has been set, however the target isn't the one the touch event wanted
|
||||
console.debug('focusin', 'tapTouchFocusedInput');
|
||||
console.log('focusin', 'tapTouchFocusedInput');
|
||||
tapTouchFocusedInput.focus();
|
||||
tapTouchFocusedInput = null;
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
||||
//middle of the scrollview, where we want to scroll to
|
||||
var scrollViewMidpointOffset = container.clientHeight * 0.5;
|
||||
var scrollTop = e.detail.keyboardTopOffset + scrollViewMidpointOffset;
|
||||
console.debug('scrollChildIntoView', scrollTop);
|
||||
console.log('scrollChildIntoView', scrollTop);
|
||||
ionic.tap.cloneFocusedInput(container, self);
|
||||
self.scrollBy(0, scrollTop, true);
|
||||
self.onScroll();
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 1px $button-padding 0 $button-padding;
|
||||
padding: 0 $button-padding;
|
||||
|
||||
min-width: ($button-padding * 3) + $button-font-size;
|
||||
min-height: $button-height + 5px;
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
.icon {
|
||||
vertical-align: top;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.icon:before,
|
||||
@@ -51,7 +52,8 @@
|
||||
padding: 0 0 $button-border-width 0;
|
||||
vertical-align: inherit;
|
||||
font-size: $button-icon-size;
|
||||
line-height: $button-height - $button-border-width + 1;
|
||||
line-height: $button-height - $button-border-width;
|
||||
pointer-events: none;
|
||||
}
|
||||
&.icon-left:before {
|
||||
float: left;
|
||||
@@ -125,18 +127,19 @@
|
||||
}
|
||||
|
||||
.button-small {
|
||||
padding: 0 $button-small-padding;
|
||||
padding: 2px $button-small-padding 1px;
|
||||
min-width: $button-small-height;
|
||||
min-height: $button-small-height + 3;
|
||||
min-height: $button-small-height + 2;
|
||||
font-size: $button-small-font-size;
|
||||
line-height: $button-small-height - $button-border-width + 1;
|
||||
line-height: $button-small-height - $button-border-width - 1;
|
||||
|
||||
.icon:before,
|
||||
&.icon:before,
|
||||
&.icon-left:before,
|
||||
&.icon-right:before {
|
||||
font-size: $button-small-icon-size;
|
||||
line-height: $button-small-height - $button-border-width - 1;
|
||||
line-height: $button-small-icon-size + 3;
|
||||
margin-top: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ textarea {
|
||||
.item-input-inset .item-input-wrapper input {
|
||||
padding-left: 4px;
|
||||
height: 29px;
|
||||
background: inherit;
|
||||
background: transparent;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
@include box-sizing(border-box);
|
||||
}
|
||||
|
||||
html {
|
||||
overflow: hidden;
|
||||
-ms-touch-action: manipulation;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
body,
|
||||
.ionic-body {
|
||||
@include touch-callout(none);
|
||||
@@ -64,8 +70,8 @@ body.grade-c {
|
||||
}
|
||||
|
||||
.scroll-view {
|
||||
display: block;
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
|
||||
// Hide the top border if any
|
||||
@@ -179,8 +185,8 @@ body.grade-c {
|
||||
|
||||
.text-refreshing,
|
||||
.text-pulling {
|
||||
line-height: 16px;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
&.ionic-refresher-with-text {
|
||||
bottom: 10px;
|
||||
@@ -196,12 +202,12 @@ body.grade-c {
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
.icon-pulling {
|
||||
-webkit-transform: translate3d(0,0,0) rotate(0deg);
|
||||
transform: translate3d(0,0,0) rotate(0deg);
|
||||
@include animation-name(refresh-spin-back);
|
||||
@include animation-duration(200ms);
|
||||
@include animation-timing-function(linear);
|
||||
@include animation-fill-mode(none);
|
||||
-webkit-transform: translate3d(0,0,0) rotate(0deg);
|
||||
transform: translate3d(0,0,0) rotate(0deg);
|
||||
}
|
||||
.icon-refreshing,
|
||||
.text-refreshing {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -71,6 +71,14 @@ describe('Ionic Platform Service', function() {
|
||||
expect(ionic.Platform.version()).toEqual(2.2);
|
||||
});
|
||||
|
||||
it('set windowsphone with user agent', function() {
|
||||
ionic.Platform.ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch;';
|
||||
ionic.Platform.setPlatform(undefined);
|
||||
ionic.Platform.setVersion(undefined);
|
||||
expect(ionic.Platform.platform()).toEqual('windowsphone');
|
||||
expect(ionic.Platform.version()).toEqual(8);
|
||||
});
|
||||
|
||||
it('set ios with iPhone user agent', function() {
|
||||
ionic.Platform.ua = 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25';
|
||||
ionic.Platform.setPlatform(undefined);
|
||||
|
||||
@@ -82,7 +82,7 @@ Tested on:
|
||||
|
||||
*/
|
||||
|
||||
window.console.debug = function(){};
|
||||
window.console.log = function(){};
|
||||
|
||||
describe('Ionic Tap', function() {
|
||||
var deregisterTap;
|
||||
|
||||
Reference in New Issue
Block a user