Root/systemscripts.skin
Sourcecode in Root/systemscripts.skin:
1:   Antville = {};
2:   Antville.prefix = "Antville_";
3:   
4:   Antville.pixel = new Image();
5:   Antville.pixel.src = "<% image name="/pixel" as="url" %>";
6:   
7:   Antville.colors = {"aliceblue": true, "antiquewhite": true, "aqua": true,  "aquamarine": true, "azure": true, "beige": true, "bisque": true,  "black": true, "blanchedalmond": true, "blue": true, "blueviolet": true,  "brown": true, "burlywood": true, "cadetblue": true, "chartreuse": true,  "chocolate": true, "coral": true, "cornflowerblue": true,  "cornsilk": true, "crimson": true, "cyan": true, "darkblue": true,  "darkcyan": true, "darkgoldenrod": true, "darkgray": true,  "darkgreen": true, "darkkhaki": true, "darkmagenta": true,  "darkolivegreen": true, "darkorange": true, "darkorchid": true,  "darkred": true, "darksalmon": true, "darkseagreen": true,  "darkslateblue": true, "darkslategray": true, "darkturquoise": true,  "darkviolet": true, "deeppink": true, "deepskyblue": true, "dimgray": true,  "dodgerblue": true, "firebrick": true, "floralwhite": true, "forestgreen": true, "fuchsia": true, "gainsboro": true, "ghostwhite": true, "gold": true, "goldenrod": true, "gray": true, "green": true, "greenyellow": true, "honeydew": true, "hotpink": true, "indianred ": true, "indigo ": true, "ivory": true, "khaki": true, "lavender": true, "lavenderblush": true, "lawngreen": true, "lemonchiffon": true, "lightblue": true, "lightcoral": true, "lightcyan": true, "lightgoldenrodyellow": true, "lightgrey": true, "lightgreen": true, "lightpink": true, "lightsalmon": true, "lightseagreen": true, "lightskyblue": true, "lightslateblue": true, "lightslategray": true, "lightsteelblue": true, "lightyellow": true, "lime": true, "limegreen": true, "linen": true, "magenta": true, "maroon": true, "mediumaquamarine": true, "mediumblue": true, "mediumorchid": true, "mediumpurple": true, "mediumseagreen": true, "mediumslateblue": true, "mediumspringgreen": true, "mediumturquoise": true, "mediumvioletred": true, "midnightblue": true, "mintcream": true, "mistyrose": true, "moccasin": true, "navajowhite": true, "navy": true, "oldlace": true, "olive": true, "olivedrab": true, "orange": true, "orangered": true, "orchid": true, "palegoldenrod": true, "palegreen": true, "paleturquoise": true, "palevioletred": true, "papayawhip": true, "peachpuff": true, "peru": true, "pink": true, "plum": true, "powderblue": true, "purple": true, "red": true, "rosybrown": true, "royalblue": true, "saddlebrown": true, "salmon": true, "sandybrown": true, "seagreen": true, "seashell": true, "sienna": true, "silver": true, "skyblue": true, "slateblue": true, "slategray": true, "snow": true, "springgreen": true, "steelblue": true, "tan": true, "teal": true, "thistle": true, "tomato": true, "turquoise": true, "violet": true, "violetred": true, "wheat": true, "white": true, "whitesmoke": true, "yellow": true, "yellowgreen": true};
8:   
9:   Antville.ColorPickerFactory = function() {
10:     this.prefix = Antville.prefix + "ColorPicker_";
11:     this.valuePrefix = Antville.prefix + "ColorValue_";
12:  
13:     this.open = function(name, text, skin) {
14:        if (skin == "colorpickerExt")
15:           var cpWindow = window.open("<% context.url action="colorpicker" %>?name=" + name + "&text=" + text + "&skin=" + skin, Antville.ColorPicker.prefix, "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,width=480,height=360");
16:        else
17:           var cpWindow = window.open("<% context.url action="colorpicker" %>?name=" + name + "&text=" + text + "&skin=" + skin, Antville.ColorPicker.prefix, "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,width=350,height=320");
18:     }
19:  
20:     this.set = function(name, color) {
21:        var prefix = Antville.ColorPicker.prefix;
22:        var valuePrefix = Antville.ColorPicker.valuePrefix;
23:        var color = Antville.parseColor(color);
24:        if (color)
25:           document.getElementById(prefix + name).style.backgroundColor = color;
26:        else
27:           color = Antville.parseColor(document.getElementById(prefix + name).style.backgroundColor);
28:        if (color.indexOf("#") == 0)
29:           color = color.substr(1,color.length-1);
30:        document.getElementById(valuePrefix + name).value = color;
31:        return;
32:     }
33:  
34:     return this;
35:  }
36:  
37:  Antville.ColorPicker = new Antville.ColorPickerFactory();
38:  
39:  Antville.encode = function(str) {
40:     var chars = ["&", "<", ">", '"'];
41:     for (var i in chars) {
42:        var c = chars[i];
43:        var re = new RegExp(c, "g");
44:        str = str.replace(re, "&#" + c.charCodeAt() + ";");
45:     }
46:     return str;
47:  }
48:  
49:  Antville.decode = function(str) {
50:     return str.replace(/&amp;/g, "&");
51:  }
52:  
53:  Antville.parseColor = function(color) {
54:     var c = color.toLowerCase();
55:     if (Antville.colors[c])
56:        return c;
57:     var rgb = new RegExp("rgb ?\\( ?([0-9^,]*), ?([0-9^,]*), ?([0-9^ \\)]*) ?\\)");
58:     var result = color.match(rgb);
59:     if (result) {
60:        var R = parseInt(result[1]).toString(16);
61:        var G = parseInt(result[2]).toString(16);
62:        var B = parseInt(result[3]).toString(16);
63:        if (R.length == 1) R="0"+R;
64:        if (G.length == 1) G="0"+G;
65:        if (B.length == 1) B="0"+B;
66:        return "#"+R+G+B;
67:     }
68:     if (c.indexOf("#") == 0)
69:        c = c.substr(1,c.length-1);
70:     if (c.length == 6) {
71:        var nonhex = new RegExp("[^0-9,a-f]");
72:        nonhex.ignoreCase = true;
73:        var found = c.match(nonhex);
74:        if (!found)
75:           return "#" + c;
76:     }
77:     return;
78:  }
79:  
80:  Antville.Referrer = function(url, text, count) {
81:     this.url = url;
82:     this.text = text;
83:     this.count = count;
84:     this.compose = function(key, prefix) {
85:        var query = new Antville.Query(this.url);
86:        if (query[key]) {
87:           if (prefix == null)
88:              prefix = "";
89:           return prefix + Antville.encode(query[key]);
90:        }
91:        return this.text;
92:     }
93:     return this;
94:  }
95:  
96:  Antville.Query = function(str) {
97:     if (str == undefined)
98:        var str = location.search.substring(1);
99:     else if (str.indexOf("?") > -1)
100:       var str = str.split("?")[1];
101:    if (str == "")
102:       return this;
103:    var parts = Antville.decode(unescape(str)).split("&");
104:    for (var i in parts) {
105:       var pair = parts[i].split("=");
106:       var key = pair[0];
107:       if (key) {
108:          key = key.replace(/\+/g, " ");
109:          var value = pair[1];
110:          if (value)
111:             value = value.replace(/\+/g, " ");
112:          this[key] = value;
113:       }
114:    }
115:    return this;
116: }
117: 
118: Antville.Filter = function(def, key) {
119:    this.key = key;
120:    if (def == null)
121:       this.items = [];
122:    else if (def instanceof Array)
123:       this.items = def;
124:    else
125:       this.items = def.replace(/\r/g, "\n").split("\n");
126:    this.test = function(str) {
127:       if (!str)
128:          return false;
129:       for (var n in this.items) {
130:          var re = new RegExp(this.items[n], "i");
131:          if (re.test(str))
132:             return true;
133:       }
134:       return false;
135:    }
136:    return this;
137: }
138: