ulvis.paste.net - pastebin

Paste Search Dynamic
Recent pastes
/AC_RunActiveContent.js
  1. //v1.0
  2. //Copyright 2006 Adobe Systems, Inc. All rights reserved.
  3. function AC_AddExtension(src, ext)
  4. {
  5.   if (src.indexOf('?') != -1)
  6.     return src.replace(/\?/, ext+'?');
  7.   else
  8.     return src + ext;
  9. }
  10.  
  11. function AC_Generateobj(objAttrs, params, embedAttrs)
  12. {
  13.   var str = '<object ';
  14.   for (var i in objAttrs)
  15.     str += i + '="' + objAttrs[i] + '" ';
  16.   str += '>';
  17.   for (var i in params)
  18.     str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  19.   str += '<embed ';
  20.   for (var i in embedAttrs)
  21.     str += i + '="' + embedAttrs[i] + '" ';
  22.   str += ' ></embed></object>';
  23.  
  24.   document.write(str);
  25. }
  26.  
  27. function AC_FL_RunContent(){
  28.   var ret =
  29.     AC_GetArgs
  30.     (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
  31.      , "application/x-shockwave-flash"
  32.     );
  33.   AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
  34. }
  35.  
  36. function AC_SW_RunContent(){
  37.   var ret =
  38.     AC_GetArgs
  39.     (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
  40.      , null
  41.     );
  42.   AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
  43. }
  44.  
  45. function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  46.   var ret = new Object();
  47.   ret.embedAttrs = new Object();
  48.   ret.params = new Object();
  49.   ret.objAttrs = new Object();
  50.   for (var i=0; i < args.length; i=i+2){
  51.     var currArg = args[i].toLowerCase();    
  52.  
  53.     switch (currArg){   
  54.       case "classid":
  55.         break;
  56.       case "pluginspage":
  57.         ret.embedAttrs[args[i]] = args[i+1];
  58.         break;
  59.       case "src":
  60.       case "movie":     
  61.         args[i+1] = AC_AddExtension(args[i+1], ext);
  62.         ret.embedAttrs["src"] = args[i+1];
  63.         ret.params[srcParamName] = args[i+1];
  64.         break;
  65.       case "onafterupdate":
  66.       case "onbeforeupdate":
  67.       case "onblur":
  68.       case "oncellchange":
  69.       case "onclick":
  70.       case "ondblClick":
  71.       case "ondrag":
  72.       case "ondragend":
  73.       case "ondragenter":
  74.       case "ondragleave":
  75.       case "ondragover":
  76.       case "ondrop":
  77.       case "onfinish":
  78.       case "onfocus":
  79.       case "onhelp":
  80.       case "onmousedown":
  81.       case "onmouseup":
  82.       case "onmouseover":
  83.       case "onmousemove":
  84.       case "onmouseout":
  85.       case "onkeypress":
  86.       case "onkeydown":
  87.       case "onkeyup":
  88.       case "onload":
  89.       case "onlosecapture":
  90.       case "onpropertychange":
  91.       case "onreadystatechange":
  92.       case "onrowsdelete":
  93.       case "onrowenter":
  94.       case "onrowexit":
  95.       case "onrowsinserted":
  96.       case "onstart":
  97.       case "onscroll":
  98.       case "onbeforeeditfocus":
  99.       case "onactivate":
  100.       case "onbeforedeactivate":
  101.       case "ondeactivate":
  102.       case "type":
  103.       case "codebase":
  104.         ret.objAttrs[args[i]] = args[i+1];
  105.         break;
  106.       case "width":
  107.       case "height":
  108.       case "align":
  109.       case "vspace":
  110.       case "hspace":
  111.       case "class":
  112.       case "title":
  113.       case "accesskey":
  114.       case "name":
  115.       case "id":
  116.       case "tabindex":
  117.         ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
  118.         break;
  119.       default:
  120.         ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
  121.     }
  122.   }
  123.   ret.objAttrs["classid"] = classid;
  124.   if (mimeType) ret.embedAttrs["type"] = mimeType;
  125.   return ret;
  126. }
Parsed in 0.026 seconds