Commit 85652d54 authored by Alexander.Trofimov's avatar Alexander.Trofimov

asc_CHandlersList перевел на prototype

DrawingContext перевел на prototype

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56953 954022d7-b5bf-4e40-9824-e11837661b57
parent b13afa75
This diff is collapsed.
...@@ -34,7 +34,7 @@ function Common_CopyObj(Obj) ...@@ -34,7 +34,7 @@ function Common_CopyObj(Obj)
} }
} }
return c; return c;
}; }
var vector_koef = 25.4 / 72; var vector_koef = 25.4 / 72;
......
...@@ -17,80 +17,63 @@ ...@@ -17,80 +17,63 @@
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
var asc = window["Asc"], var asc = window["Asc"],
asc_typeOf = asc.typeOf; asc_typeOf = asc.typeOf;
/** @constructor */ /** @constructor */
function asc_CHandlersList(handlers) { function asc_CHandlersList(handlers) {
if ( !(this instanceof asc_CHandlersList) ) {
return new asc_CHandlersList(handlers);
}
this.handlers = handlers || {}; this.handlers = handlers || {};
return this; return this;
} }
asc_CHandlersList.prototype = { asc_CHandlersList.prototype.trigger = function (eventName) {
var h = this.handlers[eventName], t = asc_typeOf(h), a = Array.prototype.slice.call(arguments, 1), i;
trigger: function (eventName) { if (t === "function") {
var h = this.handlers[eventName], t = asc_typeOf(h), a = Array.prototype.slice.call(arguments, 1), i; return h.apply(this, a);
if (t === "function") { }
return h.apply(this, a); if (t === "array") {
for (i = 0; i < h.length; i += 1) {
if (asc_typeOf(h[i]) === "function") {h[i].apply(this, a);}
} }
if (t === "array") { return true;
for (i = 0; i < h.length; i += 1) { }
if (asc_typeOf(h[i]) === "function") {h[i].apply(this, a);} return false;
} };
return true; asc_CHandlersList.prototype.add = function (eventName, eventHandler, replaceOldHandler) {
var th = this.handlers, h, old, t;
if (replaceOldHandler || !th.hasOwnProperty(eventName)) {
th[eventName] = eventHandler;
} else {
old = h = th[eventName];
t = asc_typeOf(old);
if (t !== "array") {
h = th[eventName] = [];
if (t === "function") {h.push(old);}
} }
return false; h.push(eventHandler);
}, }
};
add: function (eventName, eventHandler, replaceOldHandler) { asc_CHandlersList.prototype.remove = function (eventName, eventHandler) {
var th = this.handlers, h, old, t; var th = this.handlers, h = th[eventName], i;
if (replaceOldHandler || !th.hasOwnProperty(eventName)) { if (th.hasOwnProperty(eventName)) {
th[eventName] = eventHandler; if (asc_typeOf(h) !== "array" || asc_typeOf(eventHandler) !== "function") {
} else { delete th[eventName];
old = h = th[eventName]; return true;
t = asc_typeOf(old);
if (t !== "array") {
h = th[eventName] = [];
if (t === "function") {h.push(old);}
}
h.push(eventHandler);
} }
}, for (i = h.length - 1; i >= 0; i -= 1) {
if (h[i] === eventHandler) {
remove: function (eventName, eventHandler) { delete h[i];
var th = this.handlers, h = th[eventName], i;
if (th.hasOwnProperty(eventName)) {
if (asc_typeOf(h) !== "array" || asc_typeOf(eventHandler) !== "function") {
delete th[eventName];
return true; return true;
} }
for (i = h.length - 1; i >= 0; i -= 1) {
if (h[i] === eventHandler) {
delete h[i];
return true;
}
}
} }
return false;
} }
return false;
}; };
/* /*
* Export * Export
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
var prot; asc.asc_CHandlersList = asc_CHandlersList;
window["Asc"]["asc_CHandlersList"] = window["Asc"].asc_CHandlersList = asc_CHandlersList;
prot = asc_CHandlersList.prototype;
prot["trigger"] = prot.trigger = prot.trigger;
prot["add"] = prot.add = prot.add;
prot["remove"] = prot.remove = prot.remove;
} }
)(jQuery, window); )(jQuery, window);
\ No newline at end of file
...@@ -1988,13 +1988,10 @@ ...@@ -1988,13 +1988,10 @@
if (!this.maxDigitWidth) {throw "Error: can't measure text string";} if (!this.maxDigitWidth) {throw "Error: can't measure text string";}
}; };
/* /*
* Export * Export
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
window["Asc"].WorkbookView = WorkbookView; window["Asc"].WorkbookView = WorkbookView;
} }
)(jQuery, window); )(jQuery, window);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment