Last active
March 15, 2018 00:21
-
-
Save mightyhorst/35a582ed1abbc3be7385a2e5b602d409 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // -- Jquery - if needed | |
| // document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' | |
| function SwiftCtrl(){ | |
| this.queryUrl = function(name, url) { | |
| if (!url) url = window.location.href; | |
| name = name.replace(/[\[\]]/g, "\\$&"); | |
| var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
| results = regex.exec(url); | |
| if (!results) return null; | |
| if (!results[2]) return ''; | |
| return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
| } | |
| this.swiftView = function(){ | |
| this.private.removeHeader(); | |
| this.private.removeGetBeam(); | |
| this.private.removeSubscribe(); | |
| this.private.removeFooter(); | |
| } | |
| this.private = { | |
| removeHeader: function(){ | |
| var domHeader = document.getElementsByTagName('HEADER')[0]; | |
| domHeader.remove(); | |
| }, | |
| removeGetBeam: function(){ | |
| var domGetBeam = document.getElementById('get-beam'); | |
| domGetBeam.remove(); | |
| }, | |
| removeSubscribe: function(){ | |
| var domSubscribe = document.getElementsByClassName('subscribe')[0]; | |
| domSubscribe.remove(); | |
| }, | |
| removeFooter: function(){ | |
| var domFooter = document.getElementsByTagName('FOOTER')[0]; | |
| domFooter.remove(); | |
| } | |
| } | |
| } | |
| window.addEventListener("load", function(){ | |
| var ctrl = new SwiftCtrl(); | |
| var isSwiftDevice = ctrl.queryUrl('isSwiftDevice'); | |
| if(isSwiftDevice){ | |
| ctrl.swiftView(); | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment