本館粉絲專頁

使用者:Digipunk/mw-common.js:修訂版本之間的差異

分享此網頁到Facebook
分享此網頁到Plurk
分享此網頁到百度搜藏
分享此網頁到Twitter
分享此網頁到Del.icio.us
台灣棒球維基館
跳轉到: 導覽搜尋
第1行: 第1行:
 
// importScript() 為舊版寫法,新版需改用 mw.loader.load() 或直接在 LocalSettings.php 裡建立 importScript()
 
// importScript() 為舊版寫法,新版需改用 mw.loader.load() 或直接在 LocalSettings.php 裡建立 importScript()
importScript('User:Digipunk/FC/func.js'); // floating calendar
+
importScript('User:Digipunk/FC/func.js');     // floating calendar
importScript('User:Digipunk/SC/func.js'); // timezone conversion, JS-RNK
+
importScript('User:Digipunk/SC/func.js');     // timezone conversion, JS-RNK
 +
importScript('User:Digipunk/TeamX/func.js');  // TeamX stuff
  
 
// 處理新版 MW 在 </DIV><BR> 後面強行加入 <P><BR></P>
 
// 處理新版 MW 在 </DIV><BR> 後面強行加入 <P><BR></P>
第206行: 第207行:
 
}}}
 
}}}
  
 +
// url of file
 +
function dgpk_get_fileurl(wiki_filename) {{{
 +
  return mw.config.get('wgScript') + '/Special:Filepath/' + wiki_filename;
 +
}}}
 +
 +
// normalize raw object
 
function dgpk_arrange_raw_object(obj) {{{
 
function dgpk_arrange_raw_object(obj) {{{
 
   for (var j in obj) {
 
   for (var j in obj) {
第211行: 第218行:
 
       obj[j] = dgpk_arrange_raw_object(obj[j]);
 
       obj[j] = dgpk_arrange_raw_object(obj[j]);
 
     } else {
 
     } else {
       if (!isNaN(obj[j])) {
+
       if (obj[j] !== '' && !isNaN(obj[j])) {
 
         obj[j] = parseFloat(obj[j]);
 
         obj[j] = parseFloat(obj[j]);
 
       } else if (typeof obj[j] == 'string') {
 
       } else if (typeof obj[j] == 'string') {
第303行: 第310行:
 
function dgpk_ajax_sync_get(url, data) {{{
 
function dgpk_ajax_sync_get(url, data) {{{
 
   return __dgpk_ajax_connection('GET', url, data, false);
 
   return __dgpk_ajax_connection('GET', url, data, false);
 +
}}}
 +
 +
 +
function dgpk_strip_tags(val) {{{
 +
  if (typeof(val) == 'string') {
 +
    return val.replace(/<\/?[^>]+>/g, '');
 +
  } else {
 +
    return val;
 +
  }
 +
}}}
 +
 +
 +
function dgpk_round(v, n) {{{
 +
  if (n == null || n <= 0) return Math.round(v);
 +
  var zerostr = '0000000000'.substr(0, n);
 +
 +
  v = '' + (Math.round(parseFloat(v) * Math.pow(10, n)) / Math.pow(10, n));
 +
  if (v.indexOf('.') < 0) {
 +
    return v + '.' + zerostr;
 +
  } else {
 +
    var tmp = v.split('.');
 +
    return (tmp[0] + '.' + ('' + tmp[1] + zerostr).substr(0, n));
 +
  }
 
}}}
 
}}}
  

2019年12月5日 (四) 03:06的修訂版本

// importScript() 為舊版寫法,新版需改用 mw.loader.load() 或直接在 LocalSettings.php 裡建立 importScript()
importScript('User:Digipunk/FC/func.js');     // floating calendar
importScript('User:Digipunk/SC/func.js');     // timezone conversion, JS-RNK
importScript('User:Digipunk/TeamX/func.js');  // TeamX stuff
 
// 處理新版 MW 在 </DIV><BR> 後面強行加入 <P><BR></P>
if (mw.config.get('wgVersion').localeCompare('1.3') >= 0) {
  document.body.innerHTML = document.body.innerHTML.replace(/<\/div>([\r\n]*)<p><br[ \/]*>\s*<\/p>/ig, '</div>$1<br />');
}
 
var dgpk_async_subpages = false;//true;  // async subpages
// 雖然 sync 會被瀏覽器所討厭,但在 subpages 這個應用裡 sync 比較恰當且單純,載入時不會明顯上下跳動
 
window.addEventListener("load", function(event) {
  if (dgpk_async_subpages == true) {
    DGPKJS_ASYNC_SUBPAGES(0);
  } else {
    DGPK_DO_ACTIONS();
  }
}, false);
 
function DGPK_DO_ACTIONS() {
  DGPK_ONLOAD_ACTIONS();
  DGPK_CHECK_PREVIEW();
}
function DGPK_ONLOAD_ACTIONS() {{{
  if (dgpk_async_subpages == false) {
    try { DGPKJS_SYNC_SUBPAGES();   } catch (e) { console.log(e); }
  }
 
  try { DGPKJS_CSS_JS();   } catch (e) { console.log(e); }
  try { DGPKJS_FC();       } catch (e) { console.log(e); }
  try { DGPKJS_SC();       } catch (e) { console.log(e); }
 
  try { DGPKJS_STATS();    } catch (e) { console.log(e); }
  try { DGPKJS_MOVER();    } catch (e) { console.log(e); }  // TR.mover highlight
  try { DGPKJS_SORTALBE(); } catch (e) { console.log(e); }  // TABLE.sortable TD.fixed-ord sno
  try { DGPKJS_NEWS();     } catch (e) { console.log(e); }
 
  //try { DGPKJS_GETTY_IMAGES(); } catch (e) { console.log(e); }  // enable Getty Images embedding syntax
  try { DGPKJS_EDIT_RESTRICTION(); } catch (e) { console.log(e); }
}}}
 
 
//--------------------------------------------------
// deal with the built-in AJAX preview
//--------------------------------------------------
function DGPK_CHECK_PREVIEW() {{{
  var WE = document.getElementsByClassName('wikiEditor-ui-tabs');
  var PV = document.getElementsByClassName('wikiEditor-ui-view-preview');
 
  if (WE.length > 0 && PV.length > 0) {
    var A = WE[0].getElementsByTagName('A');
 
    for (var i = 0, ii = A.length; i < ii; i++) {
      if (A[i].innerHTML == '預覽') {
        var PVC = PV[0].getElementsByClassName('wikiEditor-preview-contents');  // preview content
        if (PVC.length > 0) {
          A[i].addEventListener("mousedown", function(event) {
            setTimeout(function() {
              __dgpk_preview(PVC[0], 0);
            }, 200);
          }, false);
        }
        break;
      }
    }
  }
}}}
 
function __dgpk_preview(pvc, counter) {{{
  if (pvc.innerHTML == '' && counter < 50) {
    setTimeout(function() {
      __dgpk_preview(pvc, ++counter);
    }, 100);
  } else {
    DGPK_ONLOAD_ACTIONS();
  }
}}}
 
 
//--------------------------------------------------
// insert CSS rules to individual page
// and eval script snippet
//--------------------------------------------------
function DGPKJS_CSS_JS() {{{
  var CSS = document.getElementsByClassName('DGPK-css');
  var n = CSS.length;
  if (n > 0) {
    var style = (function() {
      var el = document.createElement('style');
      el.appendChild(document.createTextNode('')); // WebKit hack
      el.type  = 'text/css';
      el.rel   = 'stylesheet';
      el.media = 'screen';
      // el.id    = id;
      document.head.appendChild(el);
      return el.sheet;
    })();
 
    for (var i = n - 1; i >= 0; i--) {
      //var rules = CSS[i].innerHTML.replace(/<\/?[^>]+>/g, '').split("\n");
      var rules = CSS[i].innerText.split("}");
      for (var j = 0, jj = rules.length; j < jj; j++) {
        if (rules[j].trim() == '') continue;
        style.insertRule(rules[j] + '}');
      }
      CSS[i].parentNode.removeChild(CSS[i]);
    }
  }
 
  var JS = document.getElementsByClassName('DGPK-js');
  for (var zzi = JS.length - 1; zzi >= 0; zzi--) {
    (function () { eval(JS[zzi].innerText); }());  // 丟到函式裡執行,避免 eval 裡的變數影響這裡
    JS[zzi].parentNode.removeChild(JS[zzi]);
  }
}}}
 
 
function DGPKJS_STATS() {{{
  var CLS = ['TBL-DATA-B', 'TBL-DATA-P'];
  for (var i = 0; i < 2; i++) {
    var TBL = document.getElementsByClassName(CLS[i]);
    for (var j = 0, jj = TBL.length; j < jj; j++) {
      for (var k = 0, kk = TBL[j].tBodies.length; k < kk; k++) {
        for (var x = 0, xx = TBL[j].tBodies[k].children.length; x < xx; x++) {
          if (TBL[j].tBodies[k].children[x].tagName == 'TR' && ['mover-x', 'title', 'column', 'sortbottom'].indexOf(TBL[j].tBodies[k].children[x].className) < 0) {
            TBL[j].tBodies[k].children[x].className += ' mover';
            TBL[j].tBodies[k].children[x].innerHTML = TBL[j].tBodies[k].children[x].innerHTML.replace(/>(\s*)(\d+)\//g, function(m, a, b) {
              return '>' + a + '<S>' + ('00' + b).substr(-3) + '</S>' + b + '/';
            });
            if (TBL[j].tBodies[k].children[x].children.length > 0) {
              //TBL[j].tBodies[k].children[x].children[0].className += ' fixed-ord';
              // 乾脆這裡一次解決,fixed-ord 留給外部彈性使用
              TBL[j].tBodies[k].children[x].children[0].innerHTML = '<S>' + ('00' + x).substr(-3) + '</S>' + TBL[j].tBodies[k].children[x].children[0].innerHTML;
            }
          }
        }
      }
    }
  }
}}}
 
// 在 TABLE.sortable 裡,自動為 TD.fixed-ord 加上隱藏序號
function DGPKJS_SORTALBE() {{{
  var SORTABLE = document.getElementsByClassName('sortable');
  for (var i = 0, ii = SORTABLE.length; i < ii; i++) {
    var elmts = SORTABLE[i].getElementsByClassName('fixed-ord');
    for (var j = 0, jj = elmts.length; j < jj; j++) {
      elmts[j].innerHTML = '<SPAN STYLE="display:none">' + ('00' + j).substr(-3) + '</SPAN>' + elmts[j].innerHTML;
    }
  }
}}}
 
//------------------------------------
// mouseover highlight
// 針對 [TABLE|TR].[mover|mover-f]
// 加在 TABLE 就套用於所有 TR,除了 TR.mover-x
//------------------------------------
function DGPKJS_MOVER() {{{
  var CLS = ['mover', 'mover-f'];
  for (var i = 0; i < 2; i++) {
    var OBJS = document.getElementsByClassName(CLS[i]);
    for (var j = 0, jj = OBJS.length; j < jj; j++) {
      if (OBJS[j].tagName == 'TABLE') {
        for (var k = 0, kk = OBJS[j].tBodies.length; k < kk; k++) {
          for (var x = 0, xx = OBJS[j].tBodies[k].children.length; x < xx; x++) {
            var obj = OBJS[j].tBodies[k].children[x];
            if (obj.tagName == 'TR' && obj.className.indexOf('mover-x') /*mover|mover-f|mover-x*/ < 0) {
              __dgpk_mover(obj, i);
            }
          }
        }
      } else if (OBJS[j].tagName == 'TR') {
        __dgpk_mover(OBJS[j], i);
      }
    }
  }
}}}
 
function __dgpk_mover(tr, force) {{{
  tr.addEventListener("mouseover", function(event) {
    this.className += ' mev-over' + (force ? '-f' : '');
  }, false);
 
  tr.addEventListener("mouseout", function(event) {
    if (force) {
      this.className = this.className.replace(/ mev-over-f/g, '');
    } else {
      this.className = this.className.replace(/ mev-over/g, '');
    }
  }, false);
}}}
 
 
//--------------------------------------------------
// Utilities
//--------------------------------------------------
// normalize uri to conform to wiki format
function dgpk_wikilink(str) {{{
  var pos = str.indexOf('#');
  if (pos < 0) {
    return encodeURI(str);
  } else {
    return encodeURI(str.substr(0, pos)) + '#' + encodeURIComponent(str.substr(pos + 1)).replace(/%/g, '.');
  }
}}}
 
// url of file
function dgpk_get_fileurl(wiki_filename) {{{
  return mw.config.get('wgScript') + '/Special:Filepath/' + wiki_filename;
}}}
 
// normalize raw object
function dgpk_arrange_raw_object(obj) {{{
  for (var j in obj) {
    if (typeof obj[j] == 'object') {
      obj[j] = dgpk_arrange_raw_object(obj[j]);
    } else {
      if (obj[j] !== '' && !isNaN(obj[j])) {
        obj[j] = parseFloat(obj[j]);
      } else if (typeof obj[j] == 'string') {
        obj[j] = decodeURIComponent(obj[j].replace(/\+/g, ' ')).trim();
      }
    }
  }
  return obj;
}}}
 
function dgpk_to_array(str, tok, no_empty) {{{
  if (!str) return [];
 
  if (tok == null) tok = '/';
  if (no_empty == null) no_empty = 0;
 
  var arr, arr2 = [];
 
  arr = str.split(tok);
  for (var i = 0; i < arr.length; i++) {
    var val = arr[i].trim();
    if (!isNaN(val)) {
      val = parseFloat(val);
    }
 
    if (no_empty == 1) {
      if (val !== '') {
        arr2.push(val);
      }
    } else {
      arr2[i] = val;
    }
  }
 
  return arr2;
}}}
 
 
// [cookie]
function dgpk_set_cookie(name, value) {{{  // arg[2] == null 現行目錄
  var date = new Date();
  var path = (arguments.length > 2 ? ';path=' + arguments[2] : '');
  date.setTime(date.getTime() + (arguments.length > 3 ? arguments[3] * 1000 : 365*10*86400*1000));
  var expires = '; expires=' + date.toGMTString();
  document.cookie = name + '=' + value + expires + path;
}}}
function dgpk_get_cookie(cname) {{{
  var name = cname + '=';
  var ca = document.cookie.split(';');
  for(var i = 0; i < ca.length; i++) {
    var c = ca[i].trim();
    if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
  }
  return '';
}}}
 
 
// [ajax]
function __dgpk_create_http_request() {{{
  var http_request = null;
  if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    http_request = new XMLHttpRequest();
  } else {// code for IE6, IE5
    http_request = new ActiveXObject('Microsoft.XMLHTTP');
  }
  return http_request;
}}}
function __dgpk_ajax_connection(m, url, data, async, cb_completed, cb_args) {{{
  var http_req = null;
  var method = m.toUpperCase();
  try {
    if ((http_req = __dgpk_create_http_request()) == null) return null;
    http_req.open(method, url, async);
    if (async) {
      //http_req.onload = cb_completed;
      http_req.onload = function() { cb_completed && cb_completed.call(this, this.responseText, cb_args) };
      http_req.send(data);
      return true;
    } else {
      http_req.send(data);
      return http_req.responseText;
    }
  } catch (err) {
    console.log('連線發生問題:' + err.message);
  }
  return null;
}}}
function dgpk_ajax_async_get(url, data, cb_completed, arg1, arg2) {{{
  return __dgpk_ajax_connection('GET', url, data, true, cb_completed, arg1, arg2);
}}}
function dgpk_ajax_sync_get(url, data) {{{
  return __dgpk_ajax_connection('GET', url, data, false);
}}}
 
 
function dgpk_strip_tags(val) {{{
  if (typeof(val) == 'string') {
    return val.replace(/<\/?[^>]+>/g, '');
  } else {
    return val;
  }
}}}
 
 
function dgpk_round(v, n) {{{
  if (n == null || n <= 0) return Math.round(v);
  var zerostr = '0000000000'.substr(0, n);
 
  v = '' + (Math.round(parseFloat(v) * Math.pow(10, n)) / Math.pow(10, n));
  if (v.indexOf('.') < 0) {
    return v + '.' + zerostr;
  } else {
    var tmp = v.split('.');
    return (tmp[0] + '.' + ('' + tmp[1] + zerostr).substr(0, n));
  }
}}}
 
 
//--------------------------------------------------
// [2019-05-13] 
// enable Getty Images embedding syntax
// Format: <a ...>Embed from Getty Images</a><script>...</script><script src=...></script>
// 簡單限定在 gettyimages.com,此限制不嚴謹,先暫時如此處理
//--------------------------------------------------
/* 因版權問題,取消此功能
function DGPKJS_GETTY_IMAGES() {{{
  var GETTY_IMAGES = document.getElementsByClassName('DGPK-Getty-Images');
  for (var zzi = GETTY_IMAGES.length - 1; zzi >= 0; zzi--) {
    // restore http/src links rewritten by wiki
    var str = GETTY_IMAGES[zzi].innerHTML.replace(/<a [^>]*href="([^"]+)">[^<>]*<\/a>/g, '$1').replace(/&gt;/g, '>').replace(/&lt;/g, '<').trim();
    var mat = null;
 
    if (str.indexOf('gettyimages.com') < 0) continue;
    if (str.indexOf('<iframe ') >= 0) {
      //console.log('Getty Images - Lagacy Code');
      GETTY_IMAGES[zzi].outerHTML = str;  // replace element
    } else if (str.indexOf('<script') >= 0) {
      //console.log('Getty Images - Standard');
      // remote JS - do once
      if ((mat = str.match(/<script [^>]*src=['"]([^'"]+)['"][^>]*><\/script>/)) != null) {
        getty_images_js = true;
        var imported = document.createElement('script');
        imported.src = mat[1];
        document.head.appendChild(imported);
 
        str = str.replace(mat[0], '');
      }
 
      // local JS
      if ((mat = str.match(/<script>(.*)<\/script>/)) != null) {
        eval(mat[1]);
        str = str.replace(mat[0], '');
      }
 
      //GETTY_IMAGES[zzi].parentNode.removeChild(GETTY_IMAGES[zzi]);
      GETTY_IMAGES[zzi].outerHTML = str;  // replace element
    }
  }
}}}
*/
 
//--------------------------------------------------
// [2019-08-24] 
// edit restriction via JS
//--------------------------------------------------
function DGPKJS_EDIT_RESTRICTION() {{{
  var dd = new Date();
  var dd_mon = dd.getMonth() + 1;
  var dd_day = dd.getDate();
  if (dd_mon < 10) dd_mon = '0' + dd_mon;
  if (dd_day < 10) dd_day = '0' + dd_day;
  var today = dd.getFullYear() + '-' + dd_mon + '-' + dd_day;
 
  if (mw.config.get('wgTitle').indexOf('二十九屆亞洲棒球錦標賽') > 0 &&
      mw.config.get('wgUserGroups').indexOf('sysop') < 0 &&
      //mw.config.get('wgUserGroups').indexOf('bureaucrat') < 0 &&
      ['Digipunk', 'Good boy'].indexOf(mw.config.get('wgUserName')) < 0 &&
      mw.config.get('wgAction') == 'edit' &&
      //document.getElementById('editform') != null &&
      document.getElementById('wpTextbox1') != null &&
      (
        document.getElementById('wpTextbox1').innerHTML.indexOf('{{SBDW') >= 0 ||
        document.getElementById('wpTextbox1').innerHTML.indexOf('{{賽程表') >= 0 ||
        document.getElementById('wpTextbox1').innerHTML.indexOf('MODE=ROSTER-BEGIN') >= 0 ||
        //document.getElementById('wpTextbox1').innerHTML.indexOf('DGPK-awards') >= 0 ||
        //document.getElementById('wpTextbox1').innerHTML.indexOf('=={{TeamX|') >= 0 ||
        0
      ) &&
      today >= '2019-10-03' && today <= '2019-10-20') {
    document.getElementById('editform').onsubmit = function() {
      window.location.href = mw.config.get('wgServer') + mw.config.get('wgScript') + '/' + mw.config.get('wgPageName');
      return false;
    };
  }
}}}
 
//--------------------------------------------------
// [2019-09-08] 
// format the content of external links in DGPK-news
//--------------------------------------------------
function DGPKJS_NEWS() {{{
  var NEWS = document.getElementsByClassName('DGPK-news');
  for (var i = 0, ii = NEWS.length; i < ii; i++) {
    var A = NEWS[i].getElementsByTagName('A');
    for (var j = 0, jj = A.length; j < jj; j++) {
      if (A[j].className.indexOf('external') >= 0) {
        var mat = A[j].innerHTML.match(/^(\d\d\d\d-\d\d-\d\d)\s+(.*)$/);
        if (mat) {
          var descr = '';
          if (mat[2]) {
            descr = mat[2];
            if (descr.split(/\s+/).length = 2) {
              descr = descr.replace(' ', ' ');
            }
          }
          //A[j].innerHTML = '<S>' + mat[1] + '</S> ' + descr;
          A[j].innerHTML = '<tt>[' + mat[1] + ']</tt> ' + descr;
        }
      }
    }
  }
}}}
 
 
//--------------------------------------------------
// [2019-11-18] 
// insert subpages via ajax
//   main page: <DIV CLASS="DGPK-subpages" DATA-SUBPAGE="{$subpage_name}"></DIV>  (may be multiple occurrences)
//   sub pages: <DIV CLASS="DGPK-subpage-start"></DIV> ... <DIV CLASS="DGPK-subpage-end"></DIV>  (may be multiple occurrences)
//--------------------------------------------------
//--------
// async
//--------
var dgpk_subpages = 0;
function DGPKJS_ASYNC_SUBPAGES(round) {{{
  var tok1 = '<div class="DGPK-subpage-start"></div>';
  var tok2 = '<div class="DGPK-subpage-end"></div>';
  var len1 = tok1.length;
  var SUBP = document.getElementsByClassName('DGPK-subpages');
 
  var PAGE = [];
  for (var i = 0, ii = SUBP.length; i < ii; i++) {
    if (SUBP[i].getAttribute('data-subpage')) {
      SUBP[i].id = 'DGPK-SUBP-' + PAGE.length;
      PAGE.push(SUBP[i].getAttribute('data-subpage'));
    }
  }
  var num = PAGE.length;
  dgpk_subpages += num;
 
  for (var i = 0; i < num; i++) {
    var url = window.location.href.replace('?title=', '/').split('#')[0].split('?')[0].split('&')[0] + '/' + PAGE[i];
    dgpk_ajax_async_get(url, null, function(resp, args) {
      if (resp) {
        var pos1 = pos2 = 0;
        var html = '';
 
        while ((pos1 = resp.indexOf(tok1, pos2)) > 0 && (pos2 = resp.indexOf(tok2, pos1)) > 0) {
          html += resp.substr(pos1 + len1, pos2 - pos1 - len1);
        }
        var subp = document.getElementById('DGPK-SUBP-' + args.idx);
        subp.outerHTML = '<DIV STYLE="visibility:none;width:0;height:0;overflow:hidden">' + subp.innerHTML + '</DIV>' + html;
      }
 
      if (--dgpk_subpages == 0) { // all done
        if (DGPKJS_ASYNC_SUBPAGES(i) == 0) {  // and no deeper-level subpages
          DGPK_DO_ACTIONS();
          var mv = dgpk_get_cookie('dgpkmv');
          if (mv) window.scrollTo(0, mv);
        }
      }
    }, {idx:i} );
  }
 
  if (round == 0) {
    if (num > 0) {  // 若有 subpages,記錄 reload 前的捲動距離
      window.addEventListener("beforeunload", function(event) {
        var mv = window.pageYOffset || window.document.documentElement.scrollTop || window.document.body.scrollTop || 0;
        dgpk_set_cookie('dgpkmv', mv, '', 300);
      }, false);
    } else {
      DGPK_DO_ACTIONS();
    }
  }
 
  return num;
}}}
//----------
// sync
//----------
function DGPKJS_SYNC_SUBPAGES() {{{
  var tok1 = '<div class="DGPK-subpage-start"></div>';
  var tok2 = '<div class="DGPK-subpage-end"></div>';
  var len1 = tok1.length;
  var PAGE = document.getElementsByClassName('DGPK-subpages');
 
  var ok = 0;
  var url = window.location.href.replace('?title=', '/').split('#')[0].split('?')[0].split('&')[0] + '/';
 
  for (var i = PAGE.length - 1; i >= 0; i--) {
    var resp = dgpk_ajax_sync_get(url + PAGE[i].getAttribute('data-subpage'));
    if (resp) {
      var pos1 = pos2 = 0;
      var html = '';
      while ((pos1 = resp.indexOf(tok1, pos2)) > 0 && (pos2 = resp.indexOf(tok2, pos1)) > 0) {
        html += resp.substr(pos1 + len1, pos2 - pos1 - len1);
        ok++;
      }
      PAGE[i].outerHTML = '<DIV STYLE="visibility:none;width:0;height:0;overflow:hidden">' + PAGE[i].innerHTML + '</DIV>' + html;
    }
  }
 
  if (ok > 0) DGPKJS_SYNC_SUBPAGES();  // deal with multi-level subpages
}}}