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