ie_adapter.js 4.4 KB

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