Skip to content

Commit

Permalink
Merge pull request senchalabs#174 from sindre/master
Browse files Browse the repository at this point in the history
Added Support for multiple icons for different device resolutions, available in iOS 4.2 and later.
  • Loading branch information
thomasyip committed Jun 24, 2011
2 parents 25b3333 + 6fad9a5 commit 2007139
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions jqtouch/jqtouch.js
Expand Up @@ -57,7 +57,8 @@
fullScreenClass: 'fullscreen',
hoverDelay: 50,
icon: null,
icon4: null, // experimental
iconPad: null, // available in iOS 4.2 and later.
icon4: null, // available in iOS 4.2 and later.
moveThreshold: 10,
preloadImages: false,
pressDelay: 1000,
Expand Down Expand Up @@ -346,22 +347,17 @@
};
}

// Set appropriate icon (retina display stuff is experimental)
if (jQTSettings.icon || jQTSettings.icon4) {
var precomposed, appropriateIcon;
if (jQTSettings.icon4 && window.devicePixelRatio && window.devicePixelRatio === 2) {
appropriateIcon = jQTSettings.icon4;
} else if (jQTSettings.icon) {
appropriateIcon = jQTSettings.icon;
} else {
appropriateIcon = false;
}
if (appropriateIcon) {
precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed';
hairExtensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + appropriateIcon + '" />';
}
// Set appropriate icon (retina display available in iOS 4.2 and later.)
var precomposed = (jQTSettings.addGlossToIcon) ? '' : '-precomposed';
if (jQTSettings.icon) {
hairExtensions += '<link rel="apple-touch-icon' + precomposed + '" href="' + jQTSettings.icon + '" />';
}
if (jQTSettings.iconPad) {
hairExtensions += '<link rel="apple-touch-icon' + precomposed + '" sizes="72x72" href="' + jQTSettings.iconPad + '" />';
}
if (jQTSettings.icon4) {
hairExtensions += '<link rel="apple-touch-icon' + precomposed + '" sizes="114x114" href="' + jQTSettings.icon4 + '" />';
}

// Set startup screen
if (jQTSettings.startupScreen) {
hairExtensions += '<link rel="apple-touch-startup-image" href="' + jQTSettings.startupScreen + '" />';
Expand Down

0 comments on commit 2007139

Please sign in to comment.