ie_adapter.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. (function(){
  2. debugger;
  3. if (Browser.iecomp){
  4. // if (!document.body.addEvent){
  5. // document.body.addEvent = function(type, fn){
  6. // if (window.attachEvent && !window.addEventListener){
  7. // collected[Slick.uidOf(this)] = this;
  8. // }
  9. // if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  10. // else this.attachEvent('on' + type, fn);
  11. // return this;
  12. // };
  13. // }
  14. if (!Element.prototype.addEvent){
  15. Element.prototype.addEvent = function(type, fn){
  16. if (window.attachEvent && !window.addEventListener){
  17. collected[Slick.uidOf(this)] = this;
  18. }
  19. if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]);
  20. else this.attachEvent('on' + type, fn);
  21. return this;
  22. };
  23. }
  24. var setStyleFun = Element.prototype.setStyle || null;
  25. Element.implement({
  26. "get": function(prop){
  27. var property = Element.Properties[prop];
  28. var p = (property && property.get) ? property.get.apply(this) : this.getProperty(prop);
  29. if (!p){
  30. property = Element.Properties[prop.toString().toLowerCase()];
  31. p = (property && property.get) ? property.get.apply(this) : this.getProperty(prop.toString().toLowerCase());
  32. }
  33. return p;
  34. }.overloadGetter(),
  35. "setStyle": function(property, value){
  36. if (setStyleFun){
  37. try{
  38. setStyleFun.apply(this, [property, value]);
  39. }catch(e){}
  40. }
  41. return this;
  42. },
  43. // "addEventListener": function(e, listener, capture){
  44. // this.addEvent(e, listener, capture);
  45. // }
  46. });
  47. // var insertRow = HTMLTableElement.prototype.insertRow;
  48. // var insertCell = HTMLTableRowElement.prototype.insertCell;
  49. // HTMLTableElement.prototype.insertRow = function(n){ return $(insertRow.call(this,n))};
  50. // HTMLTableRowElement.prototype.insertCell = function(n){ return $(insertCell.call(this,n))};
  51. // if (!HTMLGenericElement.prototype.addEventListener){
  52. // HTMLGenericElement.prototype.addEventListener = function(e, listener, capture){
  53. // this.attachEvent("on"+e, listener);
  54. // //$(this).addEvent(e, listener, capture)
  55. // }
  56. // }
  57. if (!Object.create){
  58. Object.create = function(o){
  59. return Object.clone(o);
  60. }
  61. }
  62. if (!document.createElementNS){
  63. document.createElementNS = function(uri, tag){
  64. var o = document.createElement(tag);
  65. o.setAttribute("xmlns", uri);
  66. return o;
  67. }
  68. }
  69. if (!Array.isArray){
  70. Array.isArray = function(o){
  71. return (typeOf(o)==="array");
  72. }
  73. }
  74. FormData = new Class({
  75. initialize: function(){
  76. this.items = [];
  77. this.type = "o2_formdata";
  78. },
  79. append: function(key, d){
  80. var o = {
  81. "name": key,
  82. "value": d
  83. };
  84. this.items.push(o);
  85. }
  86. });
  87. FormData.expiredIE = true;
  88. if (!Object.defineProperties){
  89. Object.defineProperties = MWF.defineProperties;
  90. }
  91. if (!Object.defineProperty || (Browser.name=="ie" && Browser.version==8)){
  92. Object.defineProperty = MWF.defineProperty;
  93. }
  94. o2.defineProperties(HTMLInputElement.prototype, {"files": {
  95. "get": function(){
  96. o2.require("o2.widget.contentType", null, false);
  97. var v = this.value;
  98. var tmpv = v.replace(/\\/g, "/");
  99. var i = tmpv.lastIndexOf("/");
  100. var name = (i===-1) ? v : v.substr(i+1, tmpv.length-i);
  101. var el = this;
  102. var data = {
  103. "path": v,
  104. "name": name,
  105. "size": 0,
  106. "type": MWFContentType.get(v),
  107. "el": el
  108. };
  109. return {
  110. "length": (v) ? 1 : 0,
  111. "data": data,
  112. "item": function(){ return this.data; }
  113. };
  114. }
  115. }});
  116. WebSocket = window.WebSocket || function(){};
  117. WebSocket.prototype = {
  118. 'readyState': 0,
  119. 'close': function(){}
  120. };
  121. HTMLCanvasElement = window.HTMLCanvasElement||function(){};
  122. }
  123. })();
  124. //debugger;
  125. // (function(){
  126. //
  127. // })();
  128. //
  129. //
  130. //
  131. // if (Browser.iecomp){
  132. //
  133. // }