| 1 |
|
| 2 |
/* basic.in.js */ |
| 3 |
|
| 4 |
/* 1 */ /*! is.js |
| 5 |
/* 2 *| |
| 6 |
/* 3 *| (c) 2001 Douglas Crockford |
| 7 |
/* 4 *| 2001 June 3 |
| 8 |
/* 5 *| */ |
| 9 |
/* 6 */ |
| 10 |
/* 7 */ // is |
| 11 |
/* 8 */ |
| 12 |
/* 9 */ // The -is- object is used to identify the browser. Every browser edition |
| 13 |
/* 10 */ // identifies itself, but there is no standard way of doing it, and some of |
| 14 |
/* 11 */ // the identification is deceptive. This is because the authors of web |
| 15 |
/* 12 */ // browsers are liars. For example, Microsoft's IE browsers claim to be |
| 16 |
/* 13 */ // Mozilla 4. Netscape 6 claims to be version 5. |
| 17 |
/* 14 */ |
| 18 |
/* 15 */ var is = { |
| 19 |
/* 16 */ ie: navigator.appName == 'Microsoft Internet Explorer', |
| 20 |
/* 17 */ java: navigator.javaEnabled(), |
| 21 |
/* 18 */ ns: navigator.appName == 'Netscape', |
| 22 |
/* 19 */ ua: navigator.userAgent.toLowerCase(), |
| 23 |
/* 20 */ version: parseFloat(navigator.appVersion.substr(21)) || |
| 24 |
/* 21 */ parseFloat(navigator.appVersion), |
| 25 |
/* 22 */ win: navigator.platform == 'Win32' |
| 26 |
/* 23 */ } |
| 27 |
/* 24 */ /*!* |
| 28 |
/* 25 *| * preserve this comment, too |
| 29 |
/* 26 *| */ |
| 30 |
/* 27 */ is.mac = is.ua.indexOf('mac') >= 0; |
| 31 |
/* 28 */ if (is.ua.indexOf('opera') >= 0) { |
| 32 |
/* 29 */ is.ie = is.ns = false; |
| 33 |
/* 30 */ is.opera = true; |
| 34 |
/* 31 */ } |
| 35 |
/* 32 */ if (is.ua.indexOf('gecko') >= 0) { |
| 36 |
/* 33 */ is.ie = is.ns = false; |
| 37 |
/* 34 */ is.gecko = true; |
| 38 |
/* 35 */ } |
| 39 |
/* 36 */ |
| 40 |
/* 37 */ /*@cc_on |
| 41 |
/* 38 *| /*@if (@_win32) |
| 42 |
/* 39 *| if (is.ie && is.win) |
| 43 |
/* 40 *| document.write("PASS: IE/win honored conditional comment.<br>"); |
| 44 |
/* 41 *| @else @*/ |
| 45 |
/* 42 */ if (is.ie && is.win) |
| 46 |
/* 43 */ document.write("FAIL: IE/win did not honor multi-line conditional comment.<br>"); |
| 47 |
/* 44 */ else |
| 48 |
/* 45 */ document.write("PASS: Non-IE/win browser ignores multi-line conditional comment.<br>"); |
| 49 |
/* 46 */ /*@end |
| 50 |
/* 47 *| @*/ |
| 51 |
/* 48 */ |
| 52 |
/* 49 */ var recognizesCondComm = true; |
| 53 |
/* 50 */ //@cc_on/* |
| 54 |
|
| 55 |
/* basic.in.js */ |
| 56 |
|
| 57 |
/* 51 */ recognizesCondComm = false; |
| 58 |
/* 52 */ //@cc_on*/ |
| 59 |
/* 53 */ |
| 60 |
/* 54 */ if ((is.ie && is.win) == recognizesCondComm) |
| 61 |
/* 55 */ document.write("PASS: IE/win honored single-line conditional comment.<br>"); |
| 62 |
/* 56 */ else |
| 63 |
/* 57 */ document.write("FAIL: Non-IE/win browser did not ignore single-line conditional comment.<br>"); |
| 64 |
/* 58 */ |
| 65 |
/* 59 */ // hello |
| 66 |
/* 60 */ //@cc_on/* |
| 67 |
/* 61 */ // world |
| 68 |
/* 62 */ //@cc_on*/ |
| 69 |
/* 63 */ //@cc_on/* |
| 70 |
/* 64 */ 'hello'; |
| 71 |
/* 65 */ /*!* preserved */ |
| 72 |
/* 66 */ /*!* preserved */ |
| 73 |
|