Rev 1614 | Rev 1625 | 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 | |
| 1619 | runge | 4 | LoadScript("common/json.js"); |
| 5 | |||
| 1609 | runge | 6 | function Start(legacy) |
| 1601 | runge | 7 | { |
| 1609 | runge | 8 | global_legacy = legacy; |
| 9 | |||
| 10 | if (global_legacy) |
||
| 1604 | runge | 11 | { |
| 12 | LoadScript("legacy/System/Base.js"); |
||
| 13 | LoadScript("legacy/System/Startup.js"); |
||
| 14 | LoadScript("legacy/Autostart.js"); |
||
| 1607 | runge | 15 | |
| 16 | autostart(); |
||
| 1604 | runge | 17 | } |
| 18 | else |
||
| 19 | { |
||
| 20 | LoadScript("user/autostart.js"); |
||
| 21 | } |
||
| 1601 | runge | 22 | } |
| 1603 | runge | 23 | |
| 24 | function Extend(descendant, parent) |
||
| 25 | { |
||
| 26 | var s_constructor = parent.toString(); |
||
| 27 | var a_match = s_constructor.match(/\s*function (.*)\(/); |
||
| 28 | |||
| 29 | if (a_match != null) |
||
| 30 | { |
||
| 31 | descendant.prototype[a_match[1]] = parent; |
||
| 32 | } |
||
| 33 | |||
| 34 | for (var m in parent.prototype) |
||
| 35 | { |
||
| 36 | descendant.prototype[m] = parent.prototype[m]; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 1619 | runge | 40 | function ArrayContains(array, item) |
| 1614 | runge | 41 | { |
| 1619 | runge | 42 | for (var n in array) |
| 1614 | runge | 43 | { |
| 1619 | runge | 44 | if (array[n] == item) |
| 1614 | runge | 45 | { |
| 46 | return true; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | return false; |
||
| 51 | } |
||
| 52 | |||
| 1603 | runge | 53 | String.prototype.ltrim = function(charlist) |
| 54 | { |
||
| 55 | charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1'); |
||
| 56 | var re = new RegExp('^[' + charlist + ']+', 'g'); |
||
| 57 | return this.replace(re, ''); |
||
| 58 | } |
||
| 59 | |||
| 60 | String.prototype.rtrim = function(charlist) |
||
| 61 | { |
||
| 62 | charlist = !charlist ? ' \s\xA0' : charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1'); |
||
| 63 | var re = new RegExp('[' + charlist + ']+$', 'g'); |
||
| 64 | return this.replace(re, ''); |
||
| 65 | } |
||
| 66 | |||
| 67 | String.prototype.trim = function(charlist) |
||
| 68 | { |
||
| 69 | var str = this.ltrim(charlist); |
||
| 70 | return str.rtrim(charlist); |
||
| 71 | } |
||
| 72 | |||
| 73 | function EventBase() |
||
| 74 | { |
||
| 75 | this.callbacks_ = new Array(); |
||
| 76 | } |
||
| 77 | |||
| 78 | EventBase.prototype.callbacks_ = null; |
||
| 79 | |||
| 80 | EventBase.prototype.Bind = function(event_name, callback) |
||
| 81 | { |
||
| 82 | if (typeof this.callbacks_[event_name] == 'undefined') |
||
| 83 | { |
||
| 84 | this.callbacks_[event_name] = new Array(); |
||
| 85 | } |
||
| 86 | |||
| 87 | this.callbacks_[event_name].push(callback); |
||
| 88 | } |
||
| 89 | |||
| 90 | EventBase.prototype.Trigger = function(event_name) |
||
| 91 | { |
||
| 92 | if (typeof this.callbacks_[event_name] != 'undefined') |
||
| 93 | { |
||
| 94 | for (var n = 0; n < this.callbacks_[event_name].length; n++) |
||
| 95 | { |
||
| 96 | this.callbacks_[event_name][n].apply(null, Array.prototype.slice.call(arguments, 0)); |
||
| 97 | } |
||
| 98 | } |
||
| 99 | } |