ツタヤ在庫一括表示

    @@ -13,17 +13,9 @@ } else if (!location.href.indexOf('http://store-tsutaya.tsite.jp/item/')) { - var tsutayaletSearchURL, matches, reverse; location.href = ( - (window.localStorage || alert('このブラウザは検索の記憶に対応していません')) && - (tsutayaletSearchURL = localStorage.getItem('tsutayaletSearchURL')) && - (matches = tsutayaletSearchURL.match(/(?:&|\?)(kkw001|adr)=([^&]+)(?:.*?&(?:adr|kkw001)=([^&]+))?/)) && - confirm( - (matches[3 - (reverse = matches[1] === 'adr')] ? '都道府県ID:' + matches[3 - reverse] : '全国') + - '、「' + decodeURIComponent(matches[2 + reverse] || '') + '」で検索しますか' - ) - ? tsutayaletSearchURL - : 'http://store-tsutaya.tsite.jp/tsutaya/top?account=tsutaya&accmd=1' + ((window.localStorage || alert('このブラウザは検索の記憶に対応していません')) && localStorage.getItem('tsutayaletSearchURL')) || + 'http://store-tsutaya.tsite.jp/tsutaya/top?account=tsutaya&accmd=1' ) + '&arg=' + encodeURIComponent(location.href.replace(/\?.*$/, '')); } else if (!/^http:\/\/store-tsutaya\.tsite\.jp\/tsutaya\/articleList\?/.test(location.href)) { @@ -95,7 +87,7 @@ } if (window.localStorage) - localStorage.setItem('tsutayaletSearchURL', location.href.replace(/(&|\?)arg=[^&]+&?/, '$1')); + localStorage.setItem('tsutayaletSearchURL', location.href.replace(/(\?)arg=[^&]+&|&+arg=[^&]+(&|$)/, '$1$2')); window.tsutayaletIsProcessing = true; getStockInfo();
  • /*
     * @title ツタヤ在庫一括表示
     * @description TSUTAYAの店頭在庫検索結果でこれを使うと表示されてる店舗の在庫を一括で取得し結果を表示します 連続取得は巡回速度1/(1+res)[page/s]にしてあるので取得に1秒かかる場合は20件40秒かかります 詳しい使い方の説明は http://1mu.info/texts/tsutayalet/
     * @include 
     * @license 
     * @require jQuery
     */
    
    if (/^http:\/\/(?:as\.chizumaru\.com|store\.tsutaya\.co\.jp)\/tsutaya\/articleList\?/.test(location.href)) {
    
      alert('このアドレスは古いので新しいアドレスに移動します。移動先でもう一度実行してください');
      location.href = 'http://store-tsutaya.tsite.jp' + location.pathname + location.search;
    
    } else if (!location.href.indexOf('http://store-tsutaya.tsite.jp/item/')) {
    
      location.href = (
        ((window.localStorage || alert('このブラウザは検索の記憶に対応していません')) && localStorage.getItem('tsutayaletSearchURL')) ||
        'http://store-tsutaya.tsite.jp/tsutaya/top?account=tsutaya&accmd=1'
      ) + '&arg=' + encodeURIComponent(location.href.replace(/\?.*$/, ''));
    
    } else if (!/^http:\/\/store-tsutaya\.tsite\.jp\/tsutaya\/articleList\?/.test(location.href)) {
    
      if (confirm('TSUTAYAのページに移動しますか'))
        location.href = 'http://store-tsutaya.tsite.jp/';
    
    } else if (window.tsutayaletIsProcessing) {
    
      window.tsutayaletIsProcessing = !confirm('取得を中止しますか');
    
    } else {
    
      var dispListArticle = document.getElementById('DispListArticle');
      var storeLinks = [], getStockInfo = function () {
    
        if (!window.tsutayaletIsProcessing)
          return;
        
        var nonstopProcessing = document.getElementById('nonstopProcessing').checked;
        
        if (storeLinks.length && dispListArticle.contains(storeLinks[0])) {
          if (storeLinks[0].className !== 'zaiko_btn')
            return;
          document.title = $('h1:first-child').text();
        } else if (!(storeLinks = $('#DispListArticle table a.zaiko_btn').get())[0]) {
          var nextPage;
          if (nonstopProcessing && (nextPage = $('#DispListArticle span.next.last').get(0))) {
            dispListArticle.parentNode.insertBefore($('#DispListArticle table').get(0), dispListArticle);
            nextPage.parentNode.onclick();
          } else {
            document.title = '取得完了 - ' + $('h1:first-child').text();
            window.tsutayaletIsProcessing = false;
          }
          return;
        }
    
        var link = storeLinks.shift(), t = link.parentNode.insertBefore(document.createTextNode('取得中...'), link);
        link.className = '';
        setTimeout(function () {
          $.ajax({
            type: 'GET',
            url: link,
            dataType: 'text',
            success: function (data) {
              t.nodeValue =
                (data.match(/在庫状況:<span>([^<]+)<\/span>/) || {1 : '抽出失敗'})[1] +
                (data.match(/レンタル返却予定日:\d+年\d+月\d+日/) || {0 : ''})[0];
              var itemName;
              if ($('h1:first-child span').get(0) && (itemName = (data.match(/<title>([^<]*)<\/title>/) || {})[1]))
                $('h1:first-child').text(itemName);
            },
            error: function () { t.nodeValue = '取得失敗';},
            complete: getStockInfo
          });
        }, nonstopProcessing ? 1000 : 500);
      };
    
      if (window.tsutayaletIsProcessing === undefined) {
        var originalElementUpdate = Element_update;
        window.Element_update = function (element) {
          if (element && element.id === 'DispListArticle')
            setTimeout(getStockInfo, 0);
          return originalElementUpdate.apply(this, arguments);
        };
        $('h1:first-child').after(
          '<p><input type="checkbox" id="nonstopProcessing" checked="checked"><label for="nonstopProcessing">連続取得</label></p>'
        );
      }
    
      if (window.localStorage)
        localStorage.setItem('tsutayaletSearchURL', location.href.replace(/(\?)arg=[^&]+&|&+arg=[^&]+(&|$)/, '$1$2'));
      window.tsutayaletIsProcessing = true;
      getStockInfo();
    
    }
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/11/29 12:40:03 - 2018-11-29
  2. 2017/02/26 21:48:18 - 2017-02-26
  3. 2016/11/01 22:19:13 - 2016-11-01
  4. 2016/10/28 17:51:18 - 2016-10-28
  5. 2016/10/06 10:10:19 - 2016-10-06
  6. 2016/10/06 04:26:13 - 2016-10-06
  7. 2016/10/05 10:15:07 - 2016-10-05
  8. 2016/10/05 10:13:50 - 2016-10-05
  9. 2014/10/21 19:05:18 - 2014-10-21
  10. 2014/02/18 01:23:43 - 2014-02-18
  11. 2013/11/02 13:44:16 - 2013-11-02
  12. 2013/04/11 15:54:12 - 2013-04-11
  13. 2013/03/10 16:26:30 - 2013-03-10
  14. 2012/11/10 11:01:24 - 2012-11-10
  15. 2011/12/06 15:24:48 - 2011-12-06
  16. 2011/12/06 15:06:07 - 2011-12-06