ie_adapter.js 4.9 KB

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