X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fstartup.js;h=6fa8b3c89a5acf931cf3b0cbab05e3446b38d310;hb=602b95ea0c56a128ff94ea1ac079fa6ddacfaf83;hp=7951af06b82430394080c3423466d0a011a920fe;hpb=1220218f6ea68c73ec35267a06cea64885eaa3aa;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/startup.js b/resources/startup.js index 7951af06b8..6fa8b3c89a 100644 --- a/resources/startup.js +++ b/resources/startup.js @@ -3,31 +3,46 @@ * continue loading the jquery and mediawiki modules. This code should work on * even the most ancient of browsers, so be very careful when editing. */ + /** * Returns false when run in a black-listed browser * * This function will be deleted after it's used, so do not expand it to be - * generally useful beyond startup + * generally useful beyond startup. * - * jQuery has minimum requirements of: - * * Internet Explorer 6.0+ - * * Firefox 3.6+ - * * Safari 5.0+ - * * Opera 11+ - * * Chrome + * See also: + * - https://www.mediawiki.org/wiki/Compatibility#Browser + * - http://jquerymobile.com/gbs/ + * - http://jquery.com/browser-support/ */ -function isCompatible() { - // IE < 6.0 - if ( navigator.appVersion.indexOf( 'MSIE' ) !== -1 - && parseFloat( navigator.appVersion.split( 'MSIE' )[1] ) < 6 ) - { - return false; + +/*jshint unused: false */ +function isCompatible( ua ) { + if ( ua === undefined ) { + ua = navigator.userAgent; } - // @todo FIXME: Firefox < 3.6 - // @todo FIXME: Safari < 5.0 - // @todo FIXME: Opera < 11 - return true; + + // MediaWiki JS or jQuery is known to have issues with: + return !( + // Internet Explorer < 6 + ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[1] ) < 6 ) || + // Firefox < 3 + ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[1] ) < 3 ) || + // BlackBerry < 6 + ua.match( /BlackBerry[^\/]*\/[1-5]\./ ) || + // Open WebOS < 1.5 + ua.match( /webOS\/1\.[0-4]/ ) || + // Anything PlayStation based. + ua.match( /PlayStation/i ) || + // Any Symbian based browsers + ua.match( /SymbianOS|Series60/ ) || + // Any NetFront based browser + ua.match( /NetFront/ ) || + // Opera Mini, all versions + ua.match( /Opera Mini/ ) + ); } + /** - * The startUp() function will be generated and added here (at the bottom) + * The startUp() function will be auto-generated and added below. */