[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/2in3/2.9.0/build/yui2-swfdetect/ -> yui2-swfdetect-debug.js (source)

   1  YUI.add('yui2-swfdetect', function(Y) {
   2      var YAHOO    = Y.YUI2;
   3      /*
   4  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
   5  Code licensed under the BSD License:
   6  http://developer.yahoo.com/yui/license.html
   7  version: 2.9.0
   8  */
   9  /**
  10   * Utility for Flash version detection
  11   * @namespace YAHOO.util
  12   * @module swfdetect
  13   */
  14  YAHOO.namespace("util");
  15  
  16  /**
  17   * Flafh detection utility.
  18   * @class SWFDetect
  19   * @static
  20   */
  21  (function () {
  22      
  23  var version = 0;
  24  var uA = YAHOO.env.ua;
  25  var sF = "ShockwaveFlash";
  26  var mF, eP;
  27  
  28       if (uA.gecko || uA.webkit || uA.opera) {
  29             if ((mF = navigator.mimeTypes['application/x-shockwave-flash'])) {
  30                if ((eP = mF.enabledPlugin)) {
  31                   var vS = [];
  32                   vS = eP.description.replace(/\s[rd]/g, '.').replace(/[A-Za-z\s]+/g, '').split('.');
  33                  version = vS[0] + '.';
  34                  switch((vS[2].toString()).length)
  35                  {
  36                      case 1:
  37                      version += "00";
  38                      break;
  39                      case 2: 
  40                      version += "0";
  41                      break;
  42                  }
  43                   version +=  vS[2];
  44                  version = parseFloat(version);
  45                }
  46             }
  47          }
  48          else if(uA.ie) {
  49              try
  50              {
  51                  var ax6 = new ActiveXObject(sF + "." + sF + ".6");
  52                  ax6.AllowScriptAccess = "always";
  53              }
  54              catch(e)
  55              {
  56                  if(ax6 != null)
  57                  {
  58                      version = 6.0;
  59                  }
  60              }
  61              if (version == 0) {
  62              try
  63              {
  64                  var ax  = new ActiveXObject(sF + "." + sF);
  65                     var vS = [];
  66                  vS = ax.GetVariable("$version").replace(/[A-Za-z\s]+/g, '').split(',');
  67                  version = vS[0] + '.';
  68                  switch((vS[2].toString()).length)
  69                  {
  70                      case 1:
  71                      version += "00";
  72                      break;
  73                      case 2: 
  74                      version += "0";
  75                      break;
  76                  }
  77                   version +=  vS[2];
  78                  version = parseFloat(version);
  79                  
  80              } catch (e) {}
  81              }
  82          }
  83          
  84          uA.flash = version;
  85          
  86  YAHOO.util.SWFDetect = {        
  87          getFlashVersion : function () {
  88              return version;
  89          },
  90          
  91          isFlashVersionAtLeast : function (ver) {
  92              return version >= ver;
  93          },
  94          
  95          parseFlashVersion : function (ver)
  96          {
  97              var flashVersion = ver;
  98              if(YAHOO.lang.isString(ver))
  99              {
 100                  var verSplit = ver.split(".");
 101                  if(verSplit.length > 2)
 102                  {
 103                      flashVersion = parseInt(verSplit[0]);
 104                      flashVersion += parseInt(verSplit[2]) * .001;
 105                  }
 106                  else
 107                  {
 108                      flashVersion = parseFloat(ver);
 109                  }                    
 110              }
 111              return YAHOO.lang.isNumber(flashVersion) ? flashVersion : null;
 112          }            
 113      };
 114  })();
 115  YAHOO.register("swfdetect", YAHOO.util.SWFDetect, {version: "2.9.0", build: "2800"});
 116  
 117  }, '2.9.0' ,{"requires": ["yui2-yahoo"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1