ie9ify - The IE9 jQuery Plugin
by bsatrom
JavaScript
(function($) {
var methods = {
init: function(options) {
var defaultOptions = {
applicationName: document.title.toString(),
favIcon: 'http://' + location.host + '/favicon.ico',
navColor: '',
startUrl: 'http://' + location.host,
tooltip: document.title.toString(),
window: 'width=800;height=600',
tasks: []
};
options = $.extend({}, defaultOptions, options);
return this.each(function() {
if ($('link[type^=image]').length === 0) {
$('<link>').attr('rel', 'shortcut icon').attr('type', 'image/ico').attr('href', options.favIcon).appendTo(this);
}
createMetaTag('application-name', options.applicationName, this);
createMetaTag('msapplication-tooltip', options.tooltip, this);
createMetaTag('msapplication-starturl', options.startUrl, this);
createMetaTag('msapplication-navbutton-color', options.navColor, this);
createMetaTag('msapplication-window', options.window, this);
var taskList = options.tasks;
for (var i = 0; i < taskList.length; i++) {
var task = taskList[i];
createMetaTag('msapplication-task', 'name=' + task.name + ';action-uri=' + task.action + ';icon-uri=' + task.icon, this);
}
});
},
enablePinning: function(title) {
return this.each(function() {
if (title === undefined) {
title = "Drag this image to your Windows 7 Taskbar to pin this site with IE9";
}
$(this).addClass('msPinSite').attr("title", title);
});
},
enableIESiteMode: function(eventName) {
if (!eventName) {
eventName = 'click';
}
...