Mercurial > hg > digilib-old
changeset 798:b07d1824ca2a jquery
fullscreen mode works without reload on browsers supporting history.pushstate!
author | robcast |
---|---|
date | Fri, 18 Feb 2011 20:09:15 +0100 |
parents | 6914ddedaca7 |
children | 12f790cb30de |
files | client/digitallibrary/jquery/jquery.digilib.js |
diffstat | 1 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/jquery/jquery.digilib.js Fri Feb 18 19:46:09 2011 +0100 +++ b/client/digitallibrary/jquery/jquery.digilib.js Fri Feb 18 20:09:15 2011 +0100 @@ -869,11 +869,20 @@ // update location.href (browser URL) in fullscreen mode var url = getDigilibUrl(data); var history = window.history; - if (typeof(history.pushState) === 'function') { - console.debug("we could modify history, but we don't..."); - } - // reload window - window.location = url; + if (typeof history.pushState === 'function') { + console.debug("faking reload to "+url); + // change url without reloading (stateObj, title, url) + history.pushState({}, '', url); + // change img src + var imgurl = getScalerUrl(data); + data.$img.attr('src', imgurl); + highlightButtons(data); + // send event + $(data).trigger('redisplay'); + } else { + // reload window + window.location = url; + } } else { // embedded mode -- just change img src var url = getScalerUrl(data); @@ -1614,7 +1623,7 @@ var args = Array.prototype.slice.call(arguments, 1); args.unshift(data); return actions[action].apply(this, args); - } else if (typeof(action) === 'object' || !action) { + } else if (typeof action === 'object' || !action) { // call init on this return actions.init.apply(this, arguments); } else {