MDIBrowser の スクリプト

※ 使用するには、ファイルの拡張子を.jsとして保存し、MDIBrowserのscriptsフォルダに置く


表示ページをFirefoxで開く

※ 表示ページが無い時は、単にFirefoxを起動する

/* 表示ページをFirefoxで開く 2006.07.08 dokas_mg (update 2007.08.31) */
(function() {
  var mdi = new ActiveXObject('MDIBrowser.API');
  var doc = mdi.GetDocumentObject(mdi.ActiveTabIndex());
  var ff = 'firefox.exe';
  if (doc) ff += ' ' + doc.URL;
  (new ActiveXObject('WScript.Shell')).Run(ff, 1, false);
})()

表示ページをInternetExplorerで開く

※ 表示ページが無い時は、単にIEを起動する

/* 表示ページをInternetExplorerで開く 2006.07.08 dokas_mg (update 2007.08.31) */
(function() {
  var mdi = new ActiveXObject('MDIBrowser.API');
  var doc = mdi.GetDocumentObject(mdi.ActiveTabIndex());
  var ie = new ActiveXObject('InternetExplorer.Application');
  ie.Visible = true;
  if (doc) ie.Navigate(doc.URL);
})()

URLの最後の数字+1

※ 現在のURLの最後の数字を+1したURLに移動する

/* URLの最後の数字+1 2006.07.08 dokas_mg (update 2007.09.02) */
(function() {
  var mdi = new ActiveXObject('MDIBrowser.API');
  var doc = mdi.GetDocumentObject(mdi.ActiveTabIndex());
  if (doc) {
    if (doc.URL.match(/(\d+)(\D*)$/i)) {
      var strL = RegExp.leftContext;
      var strN = RegExp.$1;
      var strR = RegExp.$2;
      var s;
      if (strN.match(/([^9])(9*)$/i))
        s = RegExp.leftContext + String.fromCharCode(RegExp.$1.charCodeAt(0) + 1) + RegExp.$2.replace(/9/g, '0');
      else s = '1' + strN.replace(/9/g, '0');
      doc.URL = strL + s + strR;
    } 
  }
})()

URLの最後の数字-1

※ 現在のURLの最後の数字を-1したURLに移動する
※ ただし特殊な場合として、数字部分が0のときは9、00のときは99、というように移動する

/* URLの最後の数字-1 2006.07.08 dokas_mg (update 2007.09.02) */
(function(){
  var mdi = new ActiveXObject('MDIBrowser.API');
  var doc = mdi.GetDocumentObject(mdi.ActiveTabIndex());
  if (doc) {
    if (doc.URL.match(/(\d+)(\D*)$/i)) {
      var strL = RegExp.leftContext;
      var strN = RegExp.$1;
      var strR = RegExp.$2;
      var s;
      if (strN.match(/([^0])(0*)$/i))
        s = RegExp.leftContext + String.fromCharCode(RegExp.$1.charCodeAt(0) - 1) + RegExp.$2.replace(/0/g, '9');
      else s = strN.replace(/0/g, '9');
      doc.URL = strL + s + strR;
    } 
  }
})()