254月/05
tDiaryのアンカーリンク時にドキュメントタイトルを表示する その5 (04:14)
決定版とか言っておきながら、まだいじっている。セクションアンカーの文字列長を、ちゃんと@confから持ってくるようにした。これで曖昧な部分がなくなったんじゃないでしょうか。
23,29d22
<
< if (highlightElem.tagName == 'H3') {
< var diary_title = "#{@conf.html_title.gsub(/"/, '\\"')} (#{@date.strftime('%Y-%m-%d')})";
< var sanchor_length = #{@conf.section_anchor.gsub(/<[^>]+?>/, '').length};
< var section_title = highlightElem.innerHTML.replace(/<[^>]+?>/g, '').substr(sanchor_length);
< document.title = section_title + ' - ' + diary_title;
< }