Skip to content

Commit

Permalink
Task #27 Disabling bookmark links for browsers that don't support loc…
Browse files Browse the repository at this point in the history
…alStorage.
  • Loading branch information
jesgs committed Sep 23, 2015
1 parent 7d59ca2 commit 3590a2f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions assets/js/bookmark.js
@@ -1,20 +1,27 @@
(function ($) {
if (typeof(localStorage) != 'object') {
console.log('Browser does not support LocalStorage');
return;
}

$(function() {
var $bookmark = $('#bookmark-comic'),
$bookmarkComicHistory = $('#bookmark-comic-history');

if (typeof(localStorage) != 'object') {
console.log('Browser does not support LocalStorage');
$bookmark.hide();
$bookmarkComicHistory.hide();
return;
}

Bookmark.init();

// KISS
$('#bookmark-comic').on('click', function (e) {
$bookmark.on('click', function (e) {
e.preventDefault();

// store date, page title, and URL
Bookmark.bookmark();
});

$('#bookmark-comic-history').on('click', function (e) {
$bookmarkComicHistory.on('click', function (e) {
// show a list of recently bookmarked comics, starting with most recent
e.preventDefault();
Bookmark.history();
Expand All @@ -30,6 +37,7 @@
$bookmarkNav : null,
$bookmarkHistory : null,
init: function() {

this.storage = localStorage;
this.checkItem();

Expand Down

0 comments on commit 3590a2f

Please sign in to comment.