Skip to content

Commit

Permalink
Overrides the styling applied to the IFrame when the UV is in full-sc…
Browse files Browse the repository at this point in the history
…reen mode for WebKit-based browsers
  • Loading branch information
jrgriffiniii committed Apr 24, 2018
1 parent 216f71c commit 9262f95
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 44 deletions.
84 changes: 42 additions & 42 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,49 +60,49 @@ GIT

GIT
remote: git://github.com/pulibrary/pul_uv_rails.git
revision: 7060d5eac7005573a93aac0335b365e29a576a54
revision: e3dd14a13aa8468751dd5d870b3647bafc0db9ff
branch: master
specs:
pul_uv_rails (1.8.42)
pul_uv_rails (2.0.1)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.6)
actionpack (= 5.0.6)
actioncable (5.0.7)
actionpack (= 5.0.7)
nio4r (>= 1.2, < 3.0)
websocket-driver (~> 0.6.1)
actionmailer (5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
actionmailer (5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.6)
actionview (= 5.0.6)
activesupport (= 5.0.6)
actionpack (5.0.7)
actionview (= 5.0.7)
activesupport (= 5.0.7)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.6)
activesupport (= 5.0.6)
actionview (5.0.7)
activesupport (= 5.0.7)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.6)
activesupport (= 5.0.6)
activejob (5.0.7)
activesupport (= 5.0.7)
globalid (>= 0.3.6)
activemodel (5.0.6)
activesupport (= 5.0.6)
activerecord (5.0.6)
activemodel (= 5.0.6)
activesupport (= 5.0.6)
activemodel (5.0.7)
activesupport (= 5.0.7)
activerecord (5.0.7)
activemodel (= 5.0.7)
activesupport (= 5.0.7)
arel (~> 7.0)
activesupport (5.0.6)
activesupport (5.0.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
acts-as-taggable-on (5.0.0)
Expand Down Expand Up @@ -255,7 +255,7 @@ GEM
hashie (3.5.7)
honeybadger (2.7.2)
httpauth (0.2.1)
i18n (0.9.5)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
iiif-presentation (0.1.0)
activesupport (>= 3.2.18)
Expand Down Expand Up @@ -318,7 +318,7 @@ GEM
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.2.0)
nio4r (2.2.0)
nio4r (2.3.0)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
normalize-rails (3.0.3)
Expand All @@ -334,7 +334,7 @@ GEM
nokogiri (~> 1.5)
omniauth (~> 1.2)
open_uri_redirections (0.2.1)
openseadragon (0.3.2)
openseadragon (0.4.0)
rails (> 3.2.0)
orm_adapter (0.5.0)
paper_trail (7.1.3)
Expand All @@ -359,22 +359,22 @@ GEM
pry-rails (0.3.4)
pry (>= 0.9.10)
public_suffix (2.0.5)
rack (2.0.4)
rack (2.0.5)
rack-protection (1.5.5)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.6)
actioncable (= 5.0.6)
actionmailer (= 5.0.6)
actionpack (= 5.0.6)
actionview (= 5.0.6)
activejob (= 5.0.6)
activemodel (= 5.0.6)
activerecord (= 5.0.6)
activesupport (= 5.0.6)
rails (5.0.7)
actioncable (= 5.0.7)
actionmailer (= 5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
activemodel (= 5.0.7)
activerecord (= 5.0.7)
activesupport (= 5.0.7)
bundler (>= 1.3.0)
railties (= 5.0.6)
railties (= 5.0.7)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.1)
actionpack (~> 5.x)
Expand All @@ -383,16 +383,16 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.0.6)
actionpack (= 5.0.6)
activesupport (= 5.0.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.0.7)
actionpack (= 5.0.7)
activesupport (= 5.0.7)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (12.3.0)
rake (12.3.1)
rdoc (4.2.2)
json (~> 1.4)
redcarpet (3.4.0)
Expand Down
25 changes: 23 additions & 2 deletions app/assets/javascripts/universal_viewer.es6
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,26 @@ export default class UniversalViewer {
}
}

/**
/**
* Accessor for the IFrame element
*
*/
getIFrame() {
let elements = document.getElementsByTagName("iframe")
return elements[0]
}

/**
* Overrides the style applied to the IFrame when the OpenSeadragon Viewer is no longer in full-screen mode
*
*/
exitWebKit() {
let frame = this.getIFrame()
frame.style.top = 0
frame.style.left = 0
}

/**
* Asynchronously removes styling from the universal viewer iframe after a timeout.
* This is a workaround for issues related to exiting fullscreen mode by pressing the
* escape key.
Expand All @@ -21,10 +40,12 @@ export default class UniversalViewer {
let fullscreen = document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement
if (fullscreen !== true) {
this.sleep(200).then(() => {
let frame = document.getElementsByTagName("iframe")[0]
let frame = this.getIFrame()
frame.style.top = null
frame.style.left = null
})
} else if (document.webkitIsFullScreen) {
this.exitWebKit()
}
}

Expand Down

0 comments on commit 9262f95

Please sign in to comment.