Created
July 25, 2018 00:50
-
-
Save wickdninja/234370f4d729f4debac514eaf6e51f10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var IFrameClassAppender = (function (window, $, self, undefined) { | |
// ReSharper disable once InconsistentNaming | |
var isFrame, body, ua, iOS, iOS8; | |
self.init = function () { | |
isFrame = (window.top !== window.self); | |
if (isFrame) { | |
body = $('body'); | |
body.addClass('iframe'); | |
ua = navigator.userAgent.toLowerCase(); | |
iOS = /(iphone|ipod|ipad)/.test(ua); | |
iOS8 = /(iphone|ipod|ipad).* os 8_/.test(ua); | |
if (iOS && !iOS8) { | |
body.addClass('legacyApple'); | |
} | |
} | |
}; | |
self.isFrame = isFrame; | |
return self; | |
}(window, jQuery, IFrameClassAppender || {})); | |
$(document).ready(function() { | |
IFrameClassAppender.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment