デジカフェ日記ダウンロード

ツールを作っていた。置いときます。細かい使い方は書きません。js ファイルの文字エンコードUTF-8 です。2 つの js ファイルを「===============」で区切ってあります。ライセンスは Apache 2.0 でお願いします。
http://www.bhelpuri.net/Trixie/ を使ってます。

===============
// Copyright (c) 2010 ILoveMisuzuchin
//
// ==UserScript==
// @name DigicafeLogCopyOpener
// @namespace http://d.hatena.ne.jp/ILoveMisuzuchin/
// @description DigicafeLogCopyOpener
// @include http://www.digicafe.jp/
// ==/UserScript==
//
// 使用するにあたって
// Windows7, IE8 で動作確認してある
// Trixie をインストールし適切に設定する
// 保護モードを無効にする
// ポップアップブロックを無効にする
// 全てのサイトのアクティブスクリプトを有効にする
// デジカフェを信頼済みサイトにする

(function(){
if (!location.href.match(/^http:\/\/www\.digicafe\.jp\/??$/))
return;

try {
if (window.opener.digicafeLogCopyFlag == '' || window.opener.digicafeLogCopyFlag == '1')
return;
} catch(e) {
}

window.digicafeLogCopyFlag = '';
window.digicafeLogCopyToDate = '';
window.digicafeLogCopyField = '';

window.open("http://www.digicafe.jp", "mainChild");
})();
===============
// Copyright (c) 2010 ILoveMisuzuchin
//
// ==UserScript==
// @name DigicafeLogCopy
// @namespace http://d.hatena.ne.jp/ILoveMisuzuchin/
// @description DigicafeLogCopy
// @include http://www.digicafe.jp/php/
// ==/UserScript==

(function(){
if (!location.href.match(/^http:\/\/www\.digicafe\.jp\/php\/diary\.php\?action=mydetail.*/))
return;

var dataStore = window.opener;

var targetElement =
document.
body.
getElementsByTagName('table')[1].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[1].
getElementsByTagName('table')[0].
getElementsByTagName('tr')[3].
getElementsByTagName('td')[0].
getElementsByTagName('div')[1];
var targetDate =
targetElement.
getElementsByTagName('table')[0].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[1].
getElementsByTagName('span')[0].
childNodes[0].data;
var targetTitle =
targetElement.
getElementsByTagName('table')[1].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[0].
getElementsByTagName('table')[0].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[1].
getElementsByTagName('span')[0].
childNodes[0].data;
var targetContents =
targetElement.
getElementsByTagName('table')[1].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[0].
getElementsByTagName('table')[0].
getElementsByTagName('tr')[1].
getElementsByTagName('td')[1].
getElementsByTagName('span')[0].
innerHTML;

targetDate = targetDate.replace(/\r|\n/g, "");
targetTitle = targetTitle.replace(/\r|\n/g, "");
targetContents = targetContents.replace(/^(\r|\n)+/, "");
targetContents = targetContents.replace(/(\r|\n| )+$/, "");

if (dataStore.digicafeLogCopyFlag == "1") {
var targetDateShort;
if (targetDate.match(/\+\+ (\d{2}) 月 (\d{2}) 日の日記 \+\+/))
targetDateShort = RegExp.$1 + RegExp.$2;
else if (targetDate.match(/\+\+ (\d{2}) 月 (\d{2}) 日のウラログ \+\+/))
targetDateShort = RegExp.$1 + RegExp.$2;
else
targetDateShort = '9999';

if (targetDateShort <= dataStore.digicafeLogCopyToDate) {
dataStore.digicafeLogCopyField +=
targetDate +
"\r\nタイトル " + targetTitle +
"\r\n本 文 " + targetContents +
"\r\n\r\n";

if (targetDateShort < dataStore.digicafeLogCopyToDate) {
try {
var nextDay =
targetElement.
getElementsByTagName('div')[0].
getElementsByTagName('div')[1].
getElementsByTagName('a')[1].href;
if (nextDay == '')
throw '';
location.href = nextDay;
} catch(e) {
try {
var nextDayA =
targetElement.
getElementsByTagName('div')[0].
getElementsByTagName('div')[1].
getElementsByTagName('a')[0];
if (nextDayA.innerHTML != '次の日&gt;')
throw '';
var nextDay = nextDayA.href;
if (nextDay == '')
throw '';
location.href = nextDay;
} catch(e) {
targetDateShort = '9999';
}
}
}
}
if (targetDateShort >= dataStore.digicafeLogCopyToDate) {
clipboardData.setData("Text", dataStore.digicafeLogCopyField);

dataStore.digicafeLogCopyFlag = "";
}
} else {
appendTarget =
targetElement.
getElementsByTagName('table')[0].
getElementsByTagName('tr')[0].
getElementsByTagName('td')[1];

var inputBox = document.createElement('input');
inputBox.setAttribute('type', 'text');
appendTarget.appendChild(inputBox);

var runButton = document.createElement('button');
runButton.setAttribute('onclick', function(){
if (inputBox.value.match(/^\d{4}$/)) {
dataStore.digicafeLogCopyFlag = "1";
dataStore.digicafeLogCopyToDate = inputBox.value;
dataStore.digicafeLogCopyField = '';
location.href = location.href;
}
});
runButton.appendChild(document.createTextNode('Renzoku Torikomi!'));
appendTarget.appendChild(runButton);
}
})();
===============