aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2017-07-13 20:19:16 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2017-07-13 20:19:16 +0200
commit87255938051dae52f895aca2ccdeb7d0679b0b05 (patch)
tree35b724fd2cbe445d14af482f54276c33a3923585
parentb04489b129210c3160d34023d384f8377ecba552 (diff)
downloadperl-software-in-gnu-guix-87255938051dae52f895aca2ccdeb7d0679b0b05.tar
perl-software-in-gnu-guix-87255938051dae52f895aca2ccdeb7d0679b0b05.tar.gz
localstorage feature test in notes plugin, fixes speaker view error in safari
-rw-r--r--plugin/notes/notes.html17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index e368a5f..4c5b799 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -675,7 +675,7 @@
document.body.setAttribute( 'data-speaker-layout', value );
// Persist locally
- if( window.localStorage ) {
+ if( supportsLocalStorage() ) {
window.localStorage.setItem( 'reveal-speaker-layout', value );
}
@@ -687,7 +687,7 @@
*/
function getLayout() {
- if( window.localStorage ) {
+ if( supportsLocalStorage() ) {
var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
if( 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 ) {
var str = '00' + parseInt( num );