Created
January 10, 2012 17:14
-
-
Save meehow/1590070 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
var mobile_url = 'http://m.bankier.pl/art/{ID}/'; | |
var desktop_url = /-(\d+)\.html/; | |
var agent = navigator.userAgent.toLowerCase(); | |
var isUAMobile =!!(agent.match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i)); | |
var isUATablet =!!(agent.match(/(iPad|SCH-I800|xoom|kindle)/i)); | |
var page = document.location.pathname.match(desktop_url); | |
if (page && (isUAMobile || isUATablet)) { | |
document.location.href = mobile_url.replace(/{ID}/, page[1]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment