From 49fc521a1647a033ff16b22373dd2672813cbde4 Mon Sep 17 00:00:00 2001 From: "scotty.b.brown@gmail.com" Date: Sat, 18 Jun 2011 23:38:16 +0000 Subject: [PATCH] (Fixes issue 349) Added detection of Chrome 12 git-svn-id: https://beef.googlecode.com/svn/trunk@998 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- core/main/client/browser.js | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/core/main/client/browser.js b/core/main/client/browser.js index 760b852ee..038c47c4f 100644 --- a/core/main/client/browser.js +++ b/core/main/client/browser.js @@ -167,12 +167,20 @@ beef.browser = { return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==11)?true:false); }, + /** + * Returns true if Chrome 12. + * @example: beef.browser.isC12() + */ + isC12: function() { + return (!!window.chrome && !window.webkitPerformance) && ((parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10)==12)?true:false); + }, + /** * Returns true if Chrome. * @example: beef.browser.isC() */ isC: function() { - return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11(); + return this.isC5() || this.isC6() || this.isC7() || this.isC8() || this.isC9() || this.isC10() || this.isC11() || this.isC12(); }, /** @@ -229,24 +237,25 @@ beef.browser = { C7: this.isC7(), // Chrome 7 C8: this.isC8(), // Chrome 8 C9: this.isC9(), // Chrome 9 - C10: this.isC10(), // Chrome 10 - C11: this.isC11(), //Chrome 11 - C: this.isC(), // Chrome any version - FF2: this.isFF2(), // Firefox 2 - FF3: this.isFF3(), // Firefox 3 + C10: this.isC10(), // Chrome 10 + C11: this.isC11(), // Chrome 11 + C11: this.isC12(), // Chrome 12 + C: this.isC(), // Chrome any version + FF2: this.isFF2(), // Firefox 2 + FF3: this.isFF3(), // Firefox 3 FF35: this.isFF35(), // Firefox 3.5 FF36: this.isFF36(), // Firefox 3.6 - FF4: this.isFF4(), // Firefox 4 + FF4: this.isFF4(), // Firefox 4 FF: this.isFF(), // Firefox any version - IE6: this.isIE6(), // Internet Explorer 6 - IE9: this.isIE9(), // Internet Explorer 9 - IE8: this.isIE8(), // Internet Explorer 8 - IE7: this.isIE7(), // Internet Explorer 7 + IE6: this.isIE6(), // Internet Explorer 6 + IE9: this.isIE9(), // Internet Explorer 9 + IE8: this.isIE8(), // Internet Explorer 8 + IE7: this.isIE7(), // Internet Explorer 7 IE: this.isIE(), // Internet Explorer any version O952: this.isO952(), // Opera 9.50 trough 9.52 O960: this.isO960(), // Opera 9.60 trough 9.64 - O10: this.isO10(), // Opera 10.xx - O11: this.isO11(), // Opera 11.xx + O10: this.isO10(), // Opera 10.xx + O11: this.isO11(), // Opera 11.xx O: this.isO(), // Opera any version S: this.isS() // Safari any version } @@ -265,21 +274,22 @@ beef.browser = { if (this.isC7()) { return '7' }; // Chrome 7 if (this.isC8()) { return '8' }; // Chrome 8 if (this.isC9()) { return '9' }; // Chrome 9 - if (this.isC10()) { return '10' }; // Chrome 10 - if (this.isC11()) { return '11'}; //Chrome 11 + if (this.isC10()) { return '10' }; // Chrome 10 + if (this.isC11()) { return '11' }; // Chrome 11 + if (this.isC12()) { return '12' }; // Chrome 12 if (this.isFF2()) { return '2' }; // Firefox 2 if (this.isFF3()) { return '3' }; // Firefox 3 - if (this.isFF35()) { return '3.5' }; // Firefox 3.5 - if (this.isFF36()) { return '3.6' }; // Firefox 3.6 + if (this.isFF35()) { return '3.5'}; // Firefox 3.5 + if (this.isFF36()) { return '3.6'}; // Firefox 3.6 if (this.isFF4()) { return '4' }; // Firefox 4 if (this.isIE6()) { return '6' }; // Internet Explorer 6 if (this.isIE9()) { return '9' }; // Internet Explorer 9 if (this.isIE8()) { return '8' }; // Internet Explorer 8 if (this.isIE7()) { return '7' }; // Internet Explorer 7 - if (this.isO952()) { return '9.5' }; // Opera 9.5x - if (this.isO960()) { return '9.6' }; // Opera 9.6 - if (this.isO10()) { return '10' }; // Opera 10.xx - if (this.isO11()) { return '11' }; // Opera 11.xx + if (this.isO952()) { return '9.5'}; // Opera 9.5x + if (this.isO960()) { return '9.6'}; // Opera 9.6 + if (this.isO10()) { return '10' }; // Opera 10.xx + if (this.isO11()) { return '11' }; // Opera 11.xx return 'UNKNOWN'; // Unknown UA }, @@ -292,8 +302,8 @@ beef.browser = { getBrowserName: function() { if (this.isC()) { return 'C' }; // Chrome any version - if (this.isFF()) { return 'FF' }; // Firefox any version - if (this.isIE()) { return 'IE' }; // Internet Explorer any version + if (this.isFF()) { return 'FF'}; // Firefox any version + if (this.isIE()) { return 'IE'}; // Internet Explorer any version if (this.isO()) { return 'O' }; // Opera any version if (this.isS()) { return 'S' }; // Safari any version return 'UN'; // Unknown UA