Browse Source

@guohh@内蒙项目@同步框架js改动

guohh 3 years ago
parent
commit
0976c71244
1 changed files with 17 additions and 8 deletions
  1. 17 8
      2021/nm-zsyt/ipu/js/frame/ipu-mobile.js

+ 17 - 8
2021/nm-zsyt/ipu/js/frame/ipu-mobile.js

@ -6,6 +6,16 @@
6 6
7 7
  console.log('ipu frame');
8 8
9
  try {
10
    // 当前窗口不是顶层窗口,且顶层窗口有IpuMobile对象
11
    if (window.top != window && window.top.IpuMobile) {  // 子窗口应该使用顶层窗口的 IpuMobile
12
      window.IpuMobile = window.top.IpuMobile;
13
      return;
14
    }
15
  } catch (e) {
16
    console.log('访问顶层父窗口异常,可能是跨域')
17
  }
18
9 19
  //终端类型,a为android,i为ios
10 20
  var deviceType = (function () {
11 21
    /*
@ -451,15 +461,14 @@
451 461
  var storageCallback = IpuMobile.callback.storageCallback;
452 462
453 463
  /**物理按键监听start**/
454
  IpuMobile.setKeyListener = function (key, callback) {
455
    if (key == "back") {
456
      document.addEventListener("back", callback, false);
457
    } else if (key == "menu") {
458
      document.addEventListener("menu", callback, false);
459
    } else if (key == "home") {
460
      document.addEventListener("home", callback, false);
464
  IpuMobile.setKeyListener = function (key, callback, isOverload) {
465
    if (key == "back" || key == "menu" || key == "home") {
466
      document.addEventListener(key, callback, false);
467
      if (isOverload != null) {
468
        execute("setKeyDownFlag", [key, isOverload]);
469
      }
461 470
    }
462
  }
471
  };
463 472
464 473
  IpuMobile.event = (function () {
465 474
    if (IpuMobile.isApp()) {