Rev 1603 | Rev 1607 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1601 | runge | 1 | |
| 1604 | runge | 2 | var legacy = false; |
| 3 | |||
| 1601 | runge | 4 | function Start() |
| 5 | { |
||
| 1604 | runge | 6 | if (legacy) |
| 7 | { |
||
| 8 | LoadScript("legacy/System/Base.js"); |
||
| 9 | LoadScript("legacy/System/Startup.js"); |
||
| 10 | LoadScript("legacy/Autostart.js"); |
||
| 11 | } |
||
| 12 | else |
||
| 13 | { |
||
| 14 | LoadScript("user/autostart.js"); |
||
| 15 | } |
||
| 1601 | runge | 16 | } |
| 1603 | runge | 17 | |
| 18 | function Extend(descendant, parent) |
||
| 19 | { |
||
| 20 | var s_constructor = parent.toString(); |
||
| 21 | var a_match = s_constructor.match(/\s*function (.*)\(/); |
||
| 22 | |||
| 23 | if (a_match != null) |
||
| 24 | { |
||
| 25 | descendant.prototype[a_match[1]] = parent; |
||
| 26 | } |
||
| 27 | |||
| 28 | for (var m in parent.prototype) |
||
| 29 | { |
||
| 30 | descendant.prototype[m] = parent.prototype[m]; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | String.prototype.ltrim = function(charlist) |
||
| 35 | { |
||
| 36 | charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1'); |
||
| 37 | var re = new RegExp('^[' + charlist + ']+', 'g'); |
||
| 38 | return this.replace(re, ''); |
||
| 39 | } |
||
| 40 | |||
| 41 | String.prototype.rtrim = function(charlist) |
||
| 42 | { |
||
| 43 | charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1'); |
||
| 44 | var re = new RegExp('[' + charlist + ']+$', 'g'); |
||
| 45 | return this.replace(re, ''); |
||
| 46 | } |
||
| 47 | |||
| 48 | String.prototype.trim = function(charlist) |
||
| 49 | { |
||
| 50 | var str = this.ltrim(charlist); |
||
| 51 | return str.rtrim(charlist); |
||
| 52 | } |
||
| 53 | |||
| 54 | function EventBase() |
||
| 55 | { |
||
| 56 | this.callbacks_ = new Array(); |
||
| 57 | } |
||
| 58 | |||
| 59 | EventBase.prototype.callbacks_ = null; |
||
| 60 | |||
| 61 | EventBase.prototype.Bind = function(event_name, callback) |
||
| 62 | { |
||
| 63 | if (typeof this.callbacks_[event_name] == 'undefined') |
||
| 64 | { |
||
| 65 | this.callbacks_[event_name] = new Array(); |
||
| 66 | } |
||
| 67 | |||
| 68 | this.callbacks_[event_name].push(callback); |
||
| 69 | } |
||
| 70 | |||
| 71 | EventBase.prototype.Trigger = function(event_name) |
||
| 72 | { |
||
| 73 | if (typeof this.callbacks_[event_name] != 'undefined') |
||
| 74 | { |
||
| 75 | for (var n = 0; n < this.callbacks_[event_name].length; n++) |
||
| 76 | { |
||
| 77 | this.callbacks_[event_name][n].apply(null, Array.prototype.slice.call(arguments, 0)); |
||
| 78 | } |
||
| 79 | } |
||
| 80 | } |