mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-06 10:06:19 +00:00
31 lines
1.3 KiB
JavaScript
Executable File
31 lines
1.3 KiB
JavaScript
Executable File
// Browser detection... In a very few places, there's nothing else for it but to know what browser we're using.
|
|
config.userAgent = navigator.userAgent.toLowerCase();
|
|
config.browser = {
|
|
isIE: config.userAgent.indexOf("msie") != -1 && config.userAgent.indexOf("opera") == -1,
|
|
isGecko: navigator.product == "Gecko" && config.userAgent.indexOf("WebKit") == -1,
|
|
ieVersion: /MSIE (\d.\d)/i.exec(config.userAgent), // config.browser.ieVersion[1], if it exists, will be the IE version string, eg "6.0"
|
|
isSafari: config.userAgent.indexOf("applewebkit") != -1,
|
|
isBadSafari: !((new RegExp("[\u0150\u0170]","g")).test("\u0150")),
|
|
firefoxDate: /gecko\/(\d{8})/i.exec(config.userAgent), // config.browser.firefoxDate[1], if it exists, will be Firefox release date as "YYYYMMDD"
|
|
isOpera: config.userAgent.indexOf("opera") != -1,
|
|
isChrome: config.userAgent.indexOf('chrome') > -1,
|
|
isLinux: config.userAgent.indexOf("linux") != -1,
|
|
isUnix: config.userAgent.indexOf("x11") != -1,
|
|
isMac: config.userAgent.indexOf("mac") != -1,
|
|
isWindows: config.userAgent.indexOf("win") != -1
|
|
};
|
|
|
|
merge(config.glyphs,{
|
|
browsers: [
|
|
function() {return config.browser.isIE;},
|
|
function() {return true;}
|
|
],
|
|
codes: {
|
|
downTriangle: ["\u25BC","\u25BE"],
|
|
downArrow: ["\u2193","\u2193"],
|
|
bentArrowLeft: ["\u2190","\u21A9"],
|
|
bentArrowRight: ["\u2192","\u21AA"]
|
|
}
|
|
});
|
|
|