(function(scripts, callback, errorback) { if (typeof errorback != 'function') errorback = function(url) { alert('jsloader load error: ' + url) }; var cssRegexp = /.css$/; var load = function(url) { if (cssRegexp.test(url)) { var link = document.createElement('link'); link.href = url; link.type = 'text/css'; link.rel = 'stylesheet'; (document.getElementsByTagName('head')[0] || document.body).appendChild(link); if (scripts.length) { load(scripts.shift()); } else { callback(); } } else { var script = document.createElement('script'); script.type = 'text/javascript'; script.charset = 'utf-8'; var current_callback; if (scripts.length) { var u = scripts.shift(); current_callback = function() { load(u) } } else { current_callback = callback; } if (window.ActiveXObject) { // IE script.onreadystatechange = function() { if (script.readyState == 'complete' || script.readyState == 'loaded') { current_callback(); } } } else { script.onload = current_callback; script.onerror = function() { errorback(url) }; } script.src = url; document.body.appendChild(script); } } load(scripts.shift()); })(["http://code.jquery.com/jquery-1.4.2.min.js"], function() { /* * @title ツタヤ在庫一括表示 * @description TSUTAYAの店頭在庫検索結果でこれを使うと表示されてる店舗の在庫を一括で取得し結果を表示します 巡回速度1/(0.5+res)[page/s]にしてあるので20件最短10秒かかります 詳しい使い方の説明は http://1mu.info/texts/tsutayalet/ * @include * @license * @require jQuery */ var wait = 500; if (!location.href.indexOf('http://as.chizumaru.com/tsutaya/articleList?')) { document.body.innerHTML = '
3秒後移動します。移動先でもう一度実行してください'; setTimeout(function() { location.href = 'http://store-tsutaya.tsite.jp' + location.href.substr(23); }, 3000); } else if (!/^http:\/\/(?:store-tsutaya\.tsite\.jp|store\.tsutaya\.co\.jp)\/tsutaya\/articleList\?/.test(location.href)) { if (confirm('TSUTAYAのページに移動しますか')) location.href = 'http://store.tsutaya.co.jp/'; } else if (window.tsutayaletIsProcessing) { window.tsutayaletIsProcessing = !confirm('取得を中止しますか'); } else { var dispListArticle = document.getElementById('DispListArticle'); var storeLinks = [], getStockInfo = function () { if (!window.tsutayaletIsProcessing) return; if (!( (storeLinks.length && dispListArticle.contains(storeLinks[0])) || (storeLinks = $('#DispListArticle table a.zaiko_btn').get())[0] )) { var nextPage = $('#DispListArticle span.next.last').get(0) if (nextPage) { dispListArticle.parentNode.insertBefore($('#DispListArticle table').get(0), dispListArticle); nextPage.parentNode.onclick(); } else { document.title = '取得完了 - ツタヤ在庫一括表示'; 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>/)||{1:'抽出失敗'})[1];}, error: function () { t.nodeValue = '取得失敗';}, complete: getStockInfo }); }, wait); }; 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); }; } window.tsutayaletIsProcessing = true; getStockInfo(); } });