Skip to content

Instantly share code, notes, and snippets.

@KarneAsada
Created August 13, 2018 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KarneAsada/5aace3960bdd60a44fde3ea1f4bc9b7c to your computer and use it in GitHub Desktop.
Save KarneAsada/5aace3960bdd60a44fde3ea1f4bc9b7c to your computer and use it in GitHub Desktop.
diff --git a/src/components/utils.js b/src/components/utils.js
index 3904618..80069ed 100644
--- a/src/components/utils.js
+++ b/src/components/utils.js
@@ -42,6 +42,10 @@ const Utils = {
isIE() {
return window.MSInputMethodContext && document.documentMode
},
+ isSnap() {
+ const ua = navigator.userAgent.toLowerCase()
+ return ua.indexOf('snapchat') > -1
+ },
load: (url, cb) => {
const xhttp = new XMLHttpRequest()
xhttp.onreadystatechange = () => {
diff --git a/src/player.css b/src/player.css
index eeca5ba..527f09a 100644
--- a/src/player.css
+++ b/src/player.css
@@ -405,3 +405,8 @@
left: 48px;
}
}
+
+/* Browser specific styles */
+.ar-snapchat .ar-player .ar-mute {
+ bottom: 40px;
+}
diff --git a/src/player.js b/src/player.js
index 4201d0b..c6480b3 100644
--- a/src/player.js
+++ b/src/player.js
@@ -58,6 +58,11 @@ const ArturoPlayer = ((document, window) => {
elements.swiperContainer = Utils.create('div', 'swiper-container', elements.content)
elements.swiperWrapper = Utils.create('div', 'swiper-wrapper', elements.swiperContainer)
+ // Add browser-specific classes
+ if (Utils.isSnap()) {
+ document.body.className += ' ar-snapchat'
+ }
+
// support deep links using search params
const searchRegExp = new RegExp(`&?${arturoSearchParam}=(\\w+)`)
const searchMatch = window.location.search.match(searchRegExp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment