Browse Source

ie8 support (closes #96)

hakimel 12 năm trước cách đây
mục cha
commit
9a657e2676
6 tập tin đã thay đổi với 37 bổ sung20 xóa
  1. 1 0
      README.md
  2. 0 1
      css/main.css
  3. 4 0
      index.html
  4. 7 3
      js/reveal.js
  5. 18 16
      lib/js/data-markdown.js
  6. 7 0
      lib/js/html5shiv.js

+ 1 - 0
README.md

@@ -202,6 +202,7 @@ You can change the appearance of the speaker notes by editing the file at `plugi
 - Added support for slides written using markdown
 - Added helped method ```Reveal.getQueryHash()```
 - Added EOT font for IE support
+- IE8 support
 
 #### 1.4
 - Main ```#reveal container``` is now selected via a class instead of ID

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 1
css/main.css


+ 4 - 0
index.html

@@ -19,6 +19,10 @@
 		<link rel="stylesheet" href="css/print.css" type="text/css" media="print">
 
 		<link rel="stylesheet" href="lib/css/zenburn.css">
+
+		<!--[if lt IE 9]>
+		<script src="lib/js/html5shiv.js"></script>
+		<![endif]-->
 	</head>
 	
 	<body>

+ 7 - 3
js/reveal.js

@@ -1,5 +1,5 @@
 /*!
- * reveal.js 1.5 r8
+ * reveal.js 1.5 r9
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
@@ -1028,10 +1028,14 @@ var Reveal = (function(){
 
 		// Forward event binding to the reveal DOM element
 		addEventListener: function( type, listener, useCapture ) {
-			( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture );
+			if( 'addEventListener' in window ) {
+				( dom.wrapper || document.querySelector( '.reveal' ) ).addEventListener( type, listener, useCapture );
+			}
 		},
 		removeEventListener: function( type, listener, useCapture ) {
-			( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture );
+			if( 'addEventListener' in window ) {
+				( dom.wrapper || document.querySelector( '.reveal' ) ).removeEventListener( type, listener, useCapture );
+			}
 		}
 	};
 	

+ 18 - 16
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);
+    }
 
 })();

+ 7 - 0
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');

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác