aboutsummaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorhakimel <hakim.elhattab@gmail.com>2012-08-03 21:49:29 -0400
committerhakimel <hakim.elhattab@gmail.com>2012-08-03 21:50:06 -0400
commit9a657e26768a3724e6edf9e5fbdd72a4e54da8f4 (patch)
treefa2b1848adff80914ea4c4ca4039c3e198ded0f4 /lib/js
parent6bc92af17c3e08ae6deef43a625b5e9007199627 (diff)
downloadperl-software-in-gnu-guix-9a657e26768a3724e6edf9e5fbdd72a4e54da8f4.tar
perl-software-in-gnu-guix-9a657e26768a3724e6edf9e5fbdd72a4e54da8f4.tar.gz
ie8 support (closes #96)
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/data-markdown.js34
-rw-r--r--lib/js/html5shiv.js7
2 files changed, 25 insertions, 16 deletions
diff --git a/lib/js/data-markdown.js b/lib/js/data-markdown.js
index 8972475..b10592a 100644
--- a/lib/js/data-markdown.js
+++ b/lib/js/data-markdown.js
@@ -2,24 +2,26 @@
// Modified by Hakim to handle markdown indented with tabs
(function(){
- [].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){
-
- // strip leading whitespace so it isn't evaluated as code
- var text = elem.innerHTML;
-
- var leadingWs = text.match(/^\n?(\s*)/)[1].length,
- leadingTabs = text.match(/^\n?(\t*)/)[1].length;
+ var slides = document.querySelectorAll('[data-markdown]');
- if( leadingTabs > 0 ) {
- text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
- }
- else if( leadingWs > 1 ) {
- text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
- }
+ for( var i = 0, len = slides.length; i < len; i++ ) {
+ var elem = slides[i];
+
+ // strip leading whitespace so it isn't evaluated as code
+ var text = elem.innerHTML;
- // here, have sum HTML
- elem.innerHTML = (new Showdown.converter()).makeHtml(text);
+ var leadingWs = text.match(/^\n?(\s*)/)[1].length,
+ leadingTabs = text.match(/^\n?(\t*)/)[1].length;
- });
+ if( leadingTabs > 0 ) {
+ text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
+ }
+ else if( leadingWs > 1 ) {
+ text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
+ }
+
+ // here, have sum HTML
+ elem.innerHTML = (new Showdown.converter()).makeHtml(text);
+ }
})(); \ No newline at end of file
diff --git a/lib/js/html5shiv.js b/lib/js/html5shiv.js
new file mode 100644
index 0000000..50649b9
--- /dev/null
+++ b/lib/js/html5shiv.js
@@ -0,0 +1,7 @@
+document.createElement('header');
+document.createElement('nav');
+document.createElement('section');
+document.createElement('article');
+document.createElement('aside');
+document.createElement('footer');
+document.createElement('hgroup'); \ No newline at end of file