Authored by htoooth

fix ie8 wrong

42.5 KB | W: | H:

608 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -5,8 +5,10 @@ @@ -5,8 +5,10 @@
5 */ 5 */
6 var $ = require('yoho-jquery'); 6 var $ = require('yoho-jquery');
7 7
8 -var areaSelect = {  
9 - isIE8: window.navigator.appName === 'Microsoft Internet Explorer' && window.navigator.appVersion.match(/8./i) === '8.', // eslint-disable-line 8 +require('../../common'); // eslint-disable-line
  9 +
  10 +var areaSelect = { // eslint-disable-line
  11 + isIE8: window.isIE8,
10 init: function($el, areaCode) { 12 init: function($el, areaCode) {
11 var city, province, area; 13 var city, province, area;
12 14
@@ -215,6 +215,28 @@ function isLogin() { @@ -215,6 +215,28 @@ function isLogin() {
215 } 215 }
216 } 216 }
217 217
  218 +function isIE() {
  219 + return /msie|trident/i.test(navigator.userAgent);
  220 +}
  221 +
  222 +function isIEVer(version) {
  223 + var ver = '';
  224 +
  225 + var getVersion = function(regex) {
  226 + var ua = navigator.userAgent;
  227 + var match = ua && ua.match(regex);
  228 +
  229 + return (match && match.length > 1 && match[1]) || '';
  230 + };
  231 +
  232 + if (isIE()) {
  233 + ver = getVersion(/(?:msie |rv:)(\d+(\.\d+)?)/i);
  234 + return ver === version;
  235 + }
  236 +
  237 + return false;
  238 +}
  239 +
218 // 品友 240 // 品友
219 function addPyEvent(eventName, val) { 241 function addPyEvent(eventName, val) {
220 if (typeof window.py === 'function') { 242 if (typeof window.py === 'function') {
@@ -247,6 +269,10 @@ window.registerUrl = registerUrl; @@ -247,6 +269,10 @@ window.registerUrl = registerUrl;
247 269
248 window.jumpUrl = jumpUrl; 270 window.jumpUrl = jumpUrl;
249 271
  272 +window.isIE = isIE;
  273 +
  274 +window.isIE8 = isIEVer('8.0');
  275 +
250 window.once = once; 276 window.once = once;
251 window.addPyEvent = addPyEvent; 277 window.addPyEvent = addPyEvent;
252 278