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