ぽっぺん日記@karashi.org
2006-11-15(Wed) [長年日記]
_ 「?from=rssなどを除去して、選択した文字列をタイトルの前に付加する」Scuttle用Bookmarkletパッチ
otsuneさんのvoid GraphicWizardsLair( void ); // 「?from=rssなどを除去して、選択した文字列をタイトルの前に付加する」はてなブックマーク用ブックマークレットのマネ。
パッチを貼ってもなんだか訳が分からんので、diffファイルも置いておきます。
--- templates/editbookmark.tpl.php.orig Wed Nov 15 11:47:42 2006
+++ templates/editbookmark.tpl.php Wed Nov 15 12:36:50 2006
@@ -103,8 +103,8 @@
selection = 'document.selection.createRange().text';
}
document.write('<ul>');
-document.write('<li><a href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');location.href=\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&address=\'+a+\'&title=\'+t+\'&description=\'+d;void 0;"><?php echo sprintf(T_('Post to %s'), $GLOBALS['sitename']); ?><\/a><\/li>');
-document.write('<li><a href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&popup=1&address=\'+a+\'&title=\'+t+\'&description=\'+d,\'<?php echo $GLOBALS['sitename']; ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=730,height=465,left=\'+(screen.width-730)/2+\',top=\'+(screen.height-425)/2);void 0;"><?php echo sprintf(T_('Post to %s (Pop-up)'), $GLOBALS['sitename']); ?><\/a><\/li>');
+document.write('<li><a href="javascript:x=document;a=encodeURIComponent(x.location.href.replace(/(\\?|&)(ref|from|f)=(rss.*|atom)/,\'\'));t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');;q=\'\';if(d!=\'\'){q=d+\'%EF%BC%9A\'};location.href=\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&address=\'+a+\'&title=\'+q+t+\'&description=\'+d;void 0;"><?php echo sprintf(T_('Post to %s'), $GLOBALS['sitename']); ?><\/a><\/li>');
+document.write('<li><a href="javascript:x=document;a=encodeURIComponent(x.location.href.replace(/(\\?|&)(ref|from|f)=(rss.*|atom)/,\'\'));t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');q=\'\';if(d!=\'\'){q=d+\'%EF%BC%9A\'};open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&popup=1&address=\'+a+\'&title=\'+q+t+\'&description=\'+d,\'<?php echo $GLOBALS['sitename']; ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=730,height=465,left=\'+(screen.width-730)/2+\',top=\'+(screen.height-425)/2);void 0;"><?php echo sprintf(T_('Post to %s (Pop-up)'), $GLOBALS['sitename']); ?><\/a><\/li>');
document.write('<\/ul>');
</script>
_ Haskellことはじめ(4) - 『ふつうのHaskellプログラミング』第4章
昨日は帰宅したら眠くて、Haskellの勉強をしなかった。いかん、いかん。
と言うことで、今日は第4章。
練習問題2のuniqがちと難しかったかな。
ちとメモ。
unlines $ 処理 $ lines 文字列
は文字列を行単位で扱い、処理するための定石。
[ツッコミを入れる]
[]
本日のPingbacks(全0件)




まで頂ければ幸いです。