Mercurial > hg > digilib-old
comparison client/digitallibrary/jquery/jquery.digilib.js @ 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 |
comparison
equal
deleted
inserted
replaced
797:6914ddedaca7 | 798:b07d1824ca2a |
---|---|
867 var settings = data.settings; | 867 var settings = data.settings; |
868 if (settings.interactionMode === 'fullscreen') { | 868 if (settings.interactionMode === 'fullscreen') { |
869 // update location.href (browser URL) in fullscreen mode | 869 // update location.href (browser URL) in fullscreen mode |
870 var url = getDigilibUrl(data); | 870 var url = getDigilibUrl(data); |
871 var history = window.history; | 871 var history = window.history; |
872 if (typeof(history.pushState) === 'function') { | 872 if (typeof history.pushState === 'function') { |
873 console.debug("we could modify history, but we don't..."); | 873 console.debug("faking reload to "+url); |
874 } | 874 // change url without reloading (stateObj, title, url) |
875 // reload window | 875 history.pushState({}, '', url); |
876 window.location = url; | 876 // change img src |
877 var imgurl = getScalerUrl(data); | |
878 data.$img.attr('src', imgurl); | |
879 highlightButtons(data); | |
880 // send event | |
881 $(data).trigger('redisplay'); | |
882 } else { | |
883 // reload window | |
884 window.location = url; | |
885 } | |
877 } else { | 886 } else { |
878 // embedded mode -- just change img src | 887 // embedded mode -- just change img src |
879 var url = getScalerUrl(data); | 888 var url = getScalerUrl(data); |
880 data.$img.attr('src', url); | 889 data.$img.attr('src', url); |
881 highlightButtons(data); | 890 highlightButtons(data); |
1612 var $elem = $(this); | 1621 var $elem = $(this); |
1613 var data = $elem.data('digilib'); | 1622 var data = $elem.data('digilib'); |
1614 var args = Array.prototype.slice.call(arguments, 1); | 1623 var args = Array.prototype.slice.call(arguments, 1); |
1615 args.unshift(data); | 1624 args.unshift(data); |
1616 return actions[action].apply(this, args); | 1625 return actions[action].apply(this, args); |
1617 } else if (typeof(action) === 'object' || !action) { | 1626 } else if (typeof action === 'object' || !action) { |
1618 // call init on this | 1627 // call init on this |
1619 return actions.init.apply(this, arguments); | 1628 return actions.init.apply(this, arguments); |
1620 } else { | 1629 } else { |
1621 $.error('action ' + action + ' does not exist on jQuery.digilib'); | 1630 $.error('action ' + action + ' does not exist on jQuery.digilib'); |
1622 } | 1631 } |