Peaceful conflict resolution

This commit is contained in:
imakewebthings 2012-07-13 19:52:41 +08:00
commit bf768811e8
2 changed files with 6 additions and 4 deletions

View file

@ -110,6 +110,7 @@ slide.
/* Update permalink, address bar, and state class on a slide change */
.bind('deck.change', function(e, from, to) {
var hash = '#' + $[deck]('getSlide', to).attr('id'),
hashPath = window.location.href.replace(/#.*/, '') + hash,
opts = $[deck]('getOptions'),
osp = opts.classes.onPrefix,
$c = $[deck]('getContainer');
@ -117,9 +118,9 @@ slide.
$c.removeClass(osp + $[deck]('getSlide', from).attr('id'));
$c.addClass(osp + $[deck]('getSlide', to).attr('id'));
$(opts.selectors.hashLink).attr('href', hash);
$(opts.selectors.hashLink).attr('href', hashPath);
if (Modernizr.history) {
window.history.replaceState({}, "", hash);
window.history.replaceState({}, "", hashPath);
}
});

View file

@ -18,15 +18,16 @@ This module adds clickable previous and next links to the deck.
last = $[deck]('getSlides').length - 1,
prevSlide = $[deck]('getSlide', to - 1),
nextSlide = $[deck]('getSlide', to + 1),
hrefBase = window.location.href.replace(/#.*/, ''),
prevId = prevSlide ? prevSlide.attr('id') : undefined,
nextId = nextSlide ? nextSlide.attr('id') : undefined;
$(opts.selectors.previousLink)
.toggleClass(opts.classes.navDisabled, !to)
.attr('href', '#' + (prevId ? prevId : ''));
.attr('href', hrefBase + '#' + (prevId ? prevId : ''));
$(opts.selectors.nextLink)
.toggleClass(opts.classes.navDisabled, to === last)
.attr('href', '#' + (nextId ? nextId : ''));
.attr('href', hrefBase + '#' + (nextId ? nextId : ''));
};
/*