localstorage feature test in notes plugin, fixes speaker view error in safari
This commit is contained in:
		@@ -675,7 +675,7 @@
 | 
				
			|||||||
					document.body.setAttribute( 'data-speaker-layout', value );
 | 
										document.body.setAttribute( 'data-speaker-layout', value );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// Persist locally
 | 
										// Persist locally
 | 
				
			||||||
					if( window.localStorage ) {
 | 
										if( supportsLocalStorage() ) {
 | 
				
			||||||
						window.localStorage.setItem( 'reveal-speaker-layout', value );
 | 
											window.localStorage.setItem( 'reveal-speaker-layout', value );
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -687,7 +687,7 @@
 | 
				
			|||||||
				 */
 | 
									 */
 | 
				
			||||||
				function getLayout() {
 | 
									function getLayout() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if( window.localStorage ) {
 | 
										if( supportsLocalStorage() ) {
 | 
				
			||||||
						var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
 | 
											var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
 | 
				
			||||||
						if( layout ) {
 | 
											if( layout ) {
 | 
				
			||||||
							return layout;
 | 
												return layout;
 | 
				
			||||||
@@ -701,6 +701,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									function supportsLocalStorage() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										try {
 | 
				
			||||||
 | 
											localStorage.setItem('test', 'test');
 | 
				
			||||||
 | 
											localStorage.removeItem('test');
 | 
				
			||||||
 | 
											return true;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										catch( e ) {
 | 
				
			||||||
 | 
											return false;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				function zeroPadInteger( num ) {
 | 
									function zeroPadInteger( num ) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					var str = '00' + parseInt( num );
 | 
										var str = '00' + parseInt( num );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user