##Preview
Display your iOS App Rating info. It uses iTunes Store website as the source.
##Usage
##Preview
Display your iOS App Rating info. It uses iTunes Store website as the source.
##Usage
| if(!window['UTIL']) window['UTIL'] = {}; | |
| UTIL.LocalStorage = function() { | |
| var context = {}; | |
| return $.extend(context, { | |
| get : function(key) { | |
| try { | |
| return JSON.parse(localStorage.getItem(key)) | |
| } | |
| catch(e) { | |
| return localStorage.getItem(key) |
| function _getScreenOrientation() { | |
| /* | |
| returns screen orientation(landscape|portrait) and | |
| set the attribute on the body "data-landscape[true|false]" | |
| */ | |
| if ( window.orientation == ( -90 || 180 ) ) { | |
| document.body.setAttribute('data-landscape', 'true'); | |
| return 'landscape'; |
| function _getViewportDimensions() { | |
| var dEl = document.documentElement, | |
| clientH = dEl['clientHeight'], | |
| innerH = window['innerHeight'], | |
| clientW = dEl['clientWidth'], | |
| innerW = window['innerWidth']; | |
| return { | |
| height : ( clientH < innerH ) ? innerH : clientH, | |
| width : ( clientW < innerW ) ? innerW : clientW |
| // Determine if an element is in the visible viewport | |
| function isInViewport(element) { | |
| var rect = element.getBoundingClientRect(); | |
| var html = document.documentElement; | |
| return ( | |
| rect.top >= 0 && | |
| rect.left >= 0 && | |
| rect.bottom <= (window.innerHeight || html.clientHeight) && | |
| rect.right <= (window.innerWidth || html.clientWidth) | |
| ); |
| /** | |
| navigator.connection is supported on: android 2.2+, Chrome 30+ | |
| */ | |
| var connection = navigator.connection || {'type':'0'}, // create a custom object if navigator.connection isn't available | |
| connectionSpeed; | |
| // determine connection speed | |
| switch(connection.type) { | |
| case connection.CELL_3G: // 3G |
| <!-- non-retina iPhone pre iOS 7 --> | |
| <link rel="apple-touch-icon" href="icon57.png" sizes="57x57"> | |
| <!-- non-retina iPad pre iOS 7 --> | |
| <link rel="apple-touch-icon" href="icon72.png" sizes="72x72"> | |
| <!-- non-retina iPad iOS 7 --> | |
| <link rel="apple-touch-icon" href="icon76.png" sizes="76x76"> | |
| <!-- retina iPhone pre iOS 7 --> | |
| <link rel="apple-touch-icon" href="icon114.png" sizes="114x114"> | |
| <!-- retina iPhone iOS 7 --> | |
| <link rel="apple-touch-icon" href="icon120.png" sizes="120x120"> |
| function getUA() { | |
| static $browser; //No accident can arise from depending on an unset variable. | |
| if ( !isset($browser) ) { | |
| $browser = get_browser($_SERVER['HTTP_USER_AGENT']); | |
| } | |
| return $browser; | |
| } |
| function getCreditCardType(creditCardNumber) { | |
| // start without knowing the credit card type | |
| var result = "unknown"; | |
| // first check for MasterCard | |
| if (/^5[1-5]/.test(creditCardNumber)) { | |
| result = "mastercard"; | |
| } | |
| // then check for Visa | |
| else if (/^4/.test(creditCardNumber)) { |