Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3918 from DFurnes/tile-quickfix
Browse files Browse the repository at this point in the history
Temporary fix for video tiles on Mobile Safari.
  • Loading branch information
DFurnes committed Feb 9, 2015
2 parents 8f6e226 + 20395d8 commit 32a8500
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/themes/dosomething/paraneue_dosomething/js/tiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,25 @@ define(function(require) {
});
});


/**
* This is a temporary fix until the next Neue release!
* @TODO: Remove when Neue 6.0.0-beta5 is merged in!
*
* Replace the `video` tag in a tile with a static image, based on either the `poster`
* attribute of the video, or an included `img` fallback source.
*/
function replaceVideoWithImage() {
var poster = $(this).attr('poster') || $(this).find('img').attr('src');
$(this).replaceWith($("<img>").attr('src', poster));
}

// On Mobile Safari, we need to replace `<video>` with a static image so the "play" control does not appear.
// Yes, this is browser sniffing - but we're fixing a browser-specific quirk so I don't think it's evil.
if (window.navigator.userAgent.match(/iPad/i) || window.navigator.userAgent.match(/iPhone/i)) {
$(function() {
$(".tile video").each(replaceVideoWithImage);
});
}

});

0 comments on commit 32a8500

Please sign in to comment.