textile to slides
by
joma
2012-06-02 [2012/06/02 13:51:39]
textileフォーマットのテキストをhtml5slidesにするブックマークレット
-
/*
* @title textile to slides
* @description textileフォーマットのテキストをhtml5slidesにするブックマークレット
* @include http://*
* @license MIT License
* @require http://www.ben-daglish.net/textile/textile.js
* @require http://html5slides.googlecode.com/svn/trunk/slides.js
*/
function textiletoslides(){
var content = document.getElementsByTagName('pre')[0];
content.innerHTML = convert(content.innerText);
content.style.display = "none";
var slides = document.createElement('section');
slides.className = "slides layout-regular template-default";
document.body.appendChild(slides);
var article = null;
while(child = content.childNodes.item()){
if( ["H1", "H2", "H3"].indexOf(child.tagName) > -1 ){ // is H1,2,3
article = document.createElement('article');
article.appendChild(child);
slides.appendChild(article);
} else {
if( article == null ){
article = document.createElement('article');
slides.appendChild(article);
}
article.appendChild(child);
}
}
handleDomLoaded();
}
textiletoslides();
-
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。