From: Steven Chan Date: Wed, 10 Sep 2014 20:46:56 +0000 (-0700) Subject: Change how download button works to allow for right-clicking to work X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5d594c9fd67b30942152d56644e0c253e6938c08;p=contrib%2Foverdrive-eg-opac.git Change how download button works to allow for right-clicking to work On user clicking a download button, we convert the download URL to a content URL, and then convert the button to a link with a new message. This will allow the link to be used directly, ie, right-clicking to open in a new tab. The interaction is not perfect, for example, the content link will be useful for only 60 seconds. A more elaborate interaction will need to be devised. Signed-off-by: Steven Chan --- diff --git a/src/od_action.coffee b/src/od_action.coffee index 31b5ffc..3c399be 100644 --- a/src/od_action.coffee +++ b/src/od_action.coffee @@ -449,6 +449,8 @@ define [ # _download_format: -> @on 'click', 'td.formats a', (ev) -> + $a = $(@) + return unless $a.hasClass 'opac-button' ev.preventDefault() # We will return to the current page to handle errors @@ -460,11 +462,11 @@ define [ od.api dl .then( (x) -> - window.open( - x.links.contentlink.href # url - '_blank' #'Overdrive Read format' # title - 'resizable, scrollbars, status, menubar, toolbar, personalbar' # features - ) + $a + .prop 'href', x.links.contentlink.href + .text 'Content is ready. Right-click to download in a new tab or window' + .removeClass 'opac-button' + return -> console.log 'failed to get download link' ) .then(