summaryrefslogtreecommitdiffstats
path: root/src/navtree_js.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/navtree_js.h')
-rw-r--r--src/navtree_js.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/navtree_js.h b/src/navtree_js.h
index fee88b3..aa57a13 100644
--- a/src/navtree_js.h
+++ b/src/navtree_js.h
@@ -22,9 +22,15 @@
"\n"
"function localStorageSupported()\n"
"{\n"
-" return 'localStorage' in window && window['localStorage'] !== null;\n"
+" try {\n"
+" return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;\n"
+" }\n"
+" catch(e) {\n"
+" return false;\n"
+" }\n"
"}\n"
"\n"
+"\n"
"function storeLink(link)\n"
"{\n"
" if (!$(\"#nav-sync\").hasClass('sync') && localStorageSupported()) {\n"
@@ -411,16 +417,26 @@
" }\n"
"}\n"
"\n"
+"function showSyncOff(n,relpath)\n"
+"{\n"
+" n.html('<img src=\"'+relpath+'sync_off.png\" title=\"'+SYNCOFFMSG+'\"/>');\n"
+"}\n"
+"\n"
+"function showSyncOn(n,relpath)\n"
+"{\n"
+" n.html('<img src=\"'+relpath+'sync_on.png\"/ title=\"'+SYNCONMSG+'\">');\n"
+"}\n"
+"\n"
"function toggleSyncButton(relpath)\n"
"{\n"
" var navSync = $('#nav-sync');\n"
" if (navSync.hasClass('sync')) {\n"
" navSync.removeClass('sync');\n"
-" navSync.html('<img src=\"'+relpath+'sync_off.png\"/>');\n"
+" showSyncOff(navSync,relpath);\n"
" storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));\n"
" } else {\n"
" navSync.addClass('sync');\n"
-" navSync.html('<img src=\"'+relpath+'sync_on.png\"/>');\n"
+" showSyncOn(navSync,relpath);\n"
" deleteLink();\n"
" }\n"
"}\n"
@@ -448,10 +464,10 @@
" if (localStorageSupported()) {\n"
" var navSync = $('#nav-sync');\n"
" if (cachedLink()) {\n"
-" navSync.html('<img src=\"'+relpath+'sync_off.png\"/>');\n"
+" showSyncOff(navSync,relpath);\n"
" navSync.removeClass('sync');\n"
" } else {\n"
-" navSync.html('<img src=\"'+relpath+'sync_on.png\"/>');\n"
+" showSyncOn(navSync,relpath);\n"
" }\n"
" navSync.click(function(){ toggleSyncButton(relpath); });\n"
" }\n"