src/cm/media/js/lib/yui/yui_3.10.3/build/swfdetect/swfdetect-debug.js
changeset 525 89ef5ed3c48b
equal deleted inserted replaced
524:322d0feea350 525:89ef5ed3c48b
       
     1 /*
       
     2 YUI 3.10.3 (build 2fb5187)
       
     3 Copyright 2013 Yahoo! Inc. All rights reserved.
       
     4 Licensed under the BSD License.
       
     5 http://yuilibrary.com/license/
       
     6 */
       
     7 
       
     8 YUI.add('swfdetect', function (Y, NAME) {
       
     9 
       
    10 /**
       
    11  * Utility for Flash version detection
       
    12  * @module swfdetect
       
    13  */
       
    14 
       
    15 // Shortcuts and helper methods
       
    16 var version = 0,
       
    17     uA = Y.UA,
       
    18     lG = Y.Lang,
       
    19     sF = "ShockwaveFlash",
       
    20     mF, eP, vS, ax6, ax;
       
    21 
       
    22 function makeInt(n) {
       
    23     return parseInt(n, 10);
       
    24 }
       
    25 
       
    26 function parseFlashVersion (flashVer) {
       
    27     if (lG.isNumber(makeInt(flashVer[0]))) {
       
    28         uA.flashMajor = flashVer[0];
       
    29     }
       
    30     
       
    31     if (lG.isNumber(makeInt(flashVer[1]))) {
       
    32         uA.flashMinor = flashVer[1];
       
    33     }
       
    34     
       
    35     if (lG.isNumber(makeInt(flashVer[2]))) {
       
    36         uA.flashRev = flashVer[2];
       
    37     }
       
    38 }
       
    39 
       
    40 if (uA.gecko || uA.webkit || uA.opera) {
       
    41    if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) {
       
    42       if ((eP = mF.enabledPlugin)) {
       
    43          vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.');
       
    44          Y.log(vS[0]);
       
    45          parseFlashVersion(vS);
       
    46       }
       
    47    }
       
    48 }
       
    49 else if(uA.ie) {
       
    50     try
       
    51     {
       
    52         ax6 = new ActiveXObject(sF + "." + sF + ".6");
       
    53         ax6.AllowScriptAccess = "always";
       
    54     }
       
    55     catch (e)
       
    56     {
       
    57         if(ax6 !== null)
       
    58         {
       
    59             version = 6.0;
       
    60         }
       
    61     }
       
    62     if (version === 0) {
       
    63     try
       
    64     {
       
    65         ax = new ActiveXObject(sF + "." + sF);
       
    66         vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(',');
       
    67         parseFlashVersion(vS);
       
    68     } catch (e2) {}
       
    69     }
       
    70 }
       
    71 
       
    72 /** Create a calendar view to represent a single or multiple
       
    73   * month range of dates, rendered as a grid with date and
       
    74   * weekday labels.
       
    75   * 
       
    76   * @class SWFDetect
       
    77   * @constructor
       
    78   */
       
    79 
       
    80         
       
    81 Y.SWFDetect = {
       
    82 
       
    83     /**
       
    84      * Returns the version of either the Flash Player plugin (in Mozilla/WebKit/Opera browsers),
       
    85      * or the Flash Player ActiveX control (in IE), as a String of the form "MM.mm.rr", where
       
    86      * MM is the major version, mm is the minor version, and rr is the revision.
       
    87      * @method getFlashVersion
       
    88      */ 
       
    89     
       
    90     getFlashVersion : function () {
       
    91         return (String(uA.flashMajor) + "." + String(uA.flashMinor) + "." + String(uA.flashRev));
       
    92     },
       
    93 
       
    94     /**
       
    95      * Checks whether the version of the Flash player installed on the user's machine is greater
       
    96      * than or equal to the one specified. If it is, this method returns true; it is false otherwise.
       
    97      * @method isFlashVersionAtLeast
       
    98      * @return {Boolean} Whether the Flash player version is greater than or equal to the one specified.
       
    99      * @param flashMajor {int} The Major version of the Flash player to compare against.
       
   100      * @param flashMinor {int} The Minor version of the Flash player to compare against.
       
   101      * @param flashRev {int} The Revision version of the Flash player to compare against.
       
   102      */ 
       
   103     isFlashVersionAtLeast : function (flashMajor, flashMinor, flashRev) {
       
   104         var uaMajor    = makeInt(uA.flashMajor),
       
   105             uaMinor    = makeInt(uA.flashMinor),
       
   106             uaRev      = makeInt(uA.flashRev);
       
   107             
       
   108         flashMajor = makeInt(flashMajor || 0);
       
   109         flashMinor = makeInt(flashMinor || 0);
       
   110         flashRev   = makeInt(flashRev || 0);
       
   111 
       
   112         if (flashMajor === uaMajor) {
       
   113             if (flashMinor === uaMinor) {
       
   114                 return flashRev <= uaRev;
       
   115             }
       
   116             return flashMinor < uaMinor;
       
   117         }
       
   118         return flashMajor < uaMajor;
       
   119     }           
       
   120 };
       
   121 
       
   122 
       
   123 }, '3.10.3', {"requires": ["yui-base"]});