MediaWiki: Common.js
From Chinese Food Wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
/**
* CFWK — site favicon / apple-touch icons
*/
(function () {
function upsert(rel, attrs) {
var link = document.head.querySelector('link[rel="' + rel + '"]');
if (!link) {
link = document.createElement('link');
link.setAttribute('rel', rel);
document.head.appendChild(link);
}
Object.keys(attrs).forEach(function (k) {
link.setAttribute(k, attrs[k]);
});
}
upsert('icon', {
type: 'image/png',
sizes: '32x32',
href: '/images/8/85/ChineseFoodWiki_favicon_32.png'
});
upsert('icon', {
type: 'image/png',
sizes: '192x192',
href: '/images/c/c8/ChineseFoodWiki_favicon_192.png'
});
upsert('apple-touch-icon', {
sizes: '180x180',
href: '/images/a/ae/ChineseFoodWiki_apple_touch_icon.png'
});
upsert('shortcut icon', {
type: 'image/png',
href: '/images/8/85/ChineseFoodWiki_favicon_32.png'
});
}());