');
55 |
56 | window.parent.scrolling = 'yes';
57 | var fileInput = document.getElementById('file');
58 | fileInput.multiple = 'multiple';
59 | var label = document.getElementsByTagName('label')[0];
60 | label.innerText = 'Find your image(s):';
61 | document.getElementById('container').removeChild(document.getElementById('name').parentNode);
62 |
63 | $('#upload-button').click(function() {
64 | var assetTypeId = document.getElementById('assetTypeId').value;
65 | var groupId = document.getElementById('groupId').value;
66 | var requestVerificationToken = document.getElementsByName('__RequestVerificationToken')[0].value;
67 | var files = document.getElementById('file').files;
68 |
69 | $('#loading-container').show();
70 | $('#success-count').hide();
71 | $('#error-count').hide();
72 | var successCount = 0;
73 | var errorCount = 0;
74 |
75 | var cboardids = [];
76 |
77 | for (var i = 0; i < files.length; i++) (function(i) {
78 | var data = new FormData();
79 | data.append('assetTypeId', assetTypeId);
80 | data.append('groupId', groupId);
81 | data.append('__RequestVerificationToken', requestVerificationToken);
82 | data.append('file', files[i], files[i].name);
83 | var fileNameWithoutExtension = files[i].name.split('.')[0]; // everything up to the first period
84 | data.append('name', fileNameWithoutExtension);
85 |
86 | $.ajax({
87 | type: 'POST',
88 | url: '/build/upload',
89 | data: data,
90 | contentType: false,
91 | processData: false,
92 | success: function(html) {
93 | var result = $(html).find('#upload-result');
94 | $('#loading-container').hide();
95 | if (result.hasClass('status-confirm')) {
96 | successCount++;
97 | var successUrl = '/develop'
98 | if (groupId > 0) {
99 | successUrl += '/groups/' + groupId;
100 | }
101 | successUrl += '?View=' + assetTypeId;
102 | if (groupId > 0 && !onDevelopPage && assetTypeId != '13') {
103 | successUrl = $('a:contains("all group items")', window.parent.document).attr('href');
104 | }
105 | $('#success-count').html('
' + successCount + ' successful uploads');
106 | $('#success-count').click(function() {
107 | window.top.location.href = successUrl;
108 | });
109 | $('#success-count').css('display', 'inline-block');
110 |
111 | // get the assetid of the image
112 | var assetid = getAssetId(result[0].innerHTML, 10);
113 | var indexmatches = files[i].name.match(/\d+/g);
114 | var indexid = Number(indexmatches[indexmatches.length - 1]);
115 | cboardids[indexid - 1] = assetid;
116 | } else {
117 | errorCount++;
118 | $('#error-count').text(errorCount + ' failed uploads');
119 | $('#error-count').show();
120 | }
121 | if (successCount + errorCount == files.length && successCount > 0 && onDevelopPage) {
122 | // we're on the develop page, refresh the view
123 | var url = '/build/assets?assetTypeId=' + assetTypeId;
124 | if (groupId) {
125 | url += '&groupId=' + groupId;
126 | }
127 | url += '&_=' + new Date().getTime();
128 | $('.tab-active .items-container', window.parent.document).load(url);
129 | }
130 | }
131 | });
132 | })(i);
133 |
134 | $(document).ajaxStop(function () {
135 | var cboard = "module.atlases = {"
136 | for (var i = 0; i < cboardids.length; i++){
137 | cboard += "\n\t[" + (i + 1) + "] = \"rbxassetid://" + cboardids[i] + "\";";
138 | }
139 | cboard += "\n}";
140 | console.log(cboard);
141 | });
142 | });
143 | }
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/FontInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 |
5 | namespace CustomFontRenderingForm
6 | {
7 | class FontInfo
8 | {
9 | public string fontName;
10 | public int fontSize, lineHeight, firstAdjust;
11 |
12 | public List
characters = new List();
13 | public Dictionary> kerning = new Dictionary>();
14 |
15 | public FontInfo(string fontName, int fontSize)
16 | {
17 | this.fontName = fontName;
18 | this.fontSize = fontSize;
19 | }
20 |
21 | public void addCharacter(CharacterInfo info)
22 | {
23 | characters.Add(info);
24 | }
25 |
26 | public void addKerning(KerningInfo info)
27 | {
28 | if (!kerning.ContainsKey(info.character1))
29 | {
30 | kerning[info.character1] = new Dictionary();
31 | }
32 | kerning[info.character1][info.character2] = info;
33 | }
34 |
35 | public string makeJSON(string indent)
36 | {
37 | string indent2 = indent + "\t";
38 | string indent3 = indent + "\t\t";
39 | string indent4 = indent + "\t\t\t";
40 |
41 | string json = indent + "\"" + fontSize + "\" : {\n"
42 | + indent2 + "\"lineHeight\" : " + lineHeight + ",\n"
43 | + indent2 + "\"firstAdjust\" : " + firstAdjust + ",\n"
44 | + indent2 + "\"characters\" : {\n";
45 |
46 | // Reflection is pretty dope!
47 | int count = 0;
48 | foreach (CharacterInfo info in characters)
49 | {
50 | count++;
51 | string line = indent3 + "\"" + (byte)info.character + "\" : { ";
52 | FieldInfo[] fields = typeof(CharacterInfo).GetFields();
53 | int count2 = 0;
54 | for (int i = 0; i < fields.Length; i++)
55 | {
56 | FieldInfo f = fields[i];
57 | string prop = f.Name;
58 | if (prop != "character")
59 | {
60 | count2++;
61 | object value = f.GetValue(info);
62 | line += "\"" + prop + "\" : " + value + (count2 < (fields.Length - 1) ? ", " : " ");
63 | }
64 | }
65 | line += "}" + (count < characters.Count ? ",\n" : "\n");
66 | json += line;
67 | }
68 | json += indent2 + "},\n" + indent2 + "\"kerning\" : {\n";
69 |
70 | count = 0;
71 | foreach (KeyValuePair> kvp in kerning)
72 | {
73 | count++;
74 | int count2 = 0;
75 | string line = indent3 + "\"" + (byte)kvp.Key + "\" : {\n";
76 | foreach (KeyValuePair kvp2 in kvp.Value)
77 | {
78 | count2++;
79 | KerningInfo info = kvp2.Value;
80 | line += indent4 + "\"" + (byte)info.character2 + "\" : { "
81 | + "\"kernX\" : " + info.kernX
82 | + ", \"kernY\" : " + info.kernY + " }"
83 | + (count2 < kvp.Value.Count ? "," : "") + "\n";
84 | }
85 | line += indent3 + "}" + (count < kerning.Count ? "," : "") + "\n";
86 | json += line;
87 | }
88 | json += indent2 + "}\n" + indent + "}";
89 | return json;
90 | }
91 |
92 | public string makeLua(string indent)
93 | {
94 | string indent2 = indent + "\t";
95 | string indent3 = indent + "\t\t";
96 | string indent4 = indent + "\t\t\t";
97 |
98 | string json = indent + "[\"" + fontSize + "\"] = {\n"
99 | + indent2 + "lineHeight = " + lineHeight + ",\n"
100 | + indent2 + "firstAdjust = " + firstAdjust + ",\n"
101 | + indent2 + "characters = {\n";
102 |
103 | // Reflection is pretty dope!
104 | int count = 0;
105 | foreach (CharacterInfo info in characters)
106 | {
107 | count++;
108 | string line = indent3 + "[\"" + (byte)info.character + "\"] = { ";
109 | FieldInfo[] fields = typeof(CharacterInfo).GetFields();
110 | int count2 = 0;
111 | for (int i = 0; i < fields.Length; i++)
112 | {
113 | FieldInfo f = fields[i];
114 | string prop = f.Name;
115 | if (prop != "character")
116 | {
117 | count2++;
118 | object value = f.GetValue(info);
119 | line += prop + " = " + value + (count2 < (fields.Length - 1) ? ", " : " ");
120 | }
121 | }
122 | line += "}" + (count < characters.Count ? ",\n" : "\n");
123 | json += line;
124 | }
125 | json += indent2 + "},\n" + indent2 + "kerning = {\n";
126 |
127 | count = 0;
128 | foreach (KeyValuePair> kvp in kerning)
129 | {
130 | count++;
131 | int count2 = 0;
132 | string line = indent3 + "[\"" + (byte)kvp.Key + "\"] = {\n";
133 | foreach (KeyValuePair kvp2 in kvp.Value)
134 | {
135 | count2++;
136 | KerningInfo info = kvp2.Value;
137 | line += indent4 + "[\"" + (byte)info.character2 + "\"] = { "
138 | + "kernX = " + info.kernX
139 | + ", kernY = " + info.kernY + " }"
140 | + (count2 < kvp.Value.Count ? "," : "") + "\n";
141 | }
142 | line += indent3 + "}" + (count < kerning.Count ? "," : "") + "\n";
143 | json += line;
144 | }
145 | json += indent2 + "}\n" + indent + "}";
146 | return json;
147 | }
148 | }
149 |
150 | class CharacterInfo
151 | {
152 | public char character;
153 | public int x, y, width, height, xadvance, yoffset, atlas;
154 |
155 | public CharacterInfo(char character, int x, int y, int width, int height, int xadvance, int yoffset, int atlas)
156 | {
157 | this.character = character;
158 | this.x = x;
159 | this.y = y;
160 | this.width = width;
161 | this.height = height;
162 | this.xadvance = xadvance;
163 | this.yoffset = yoffset;
164 | this.atlas = atlas;
165 | }
166 | }
167 |
168 | class KerningInfo
169 | {
170 | public char character1, character2;
171 | public int kernX, kernY;
172 |
173 | public KerningInfo(char character1, char character2, int kernX, int kernY)
174 | {
175 | this.character1 = character1;
176 | this.character2 = character2;
177 | this.kernX = kernX;
178 | this.kernY = kernY;
179 | }
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/CustomFontRenderingForm.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Debug
8 | AnyCPU
9 | {C6FBDF10-3F8A-488D-8548-2DEFB56056E8}
10 | WinExe
11 | Properties
12 | CustomFontRenderingForm
13 | CustomFontRenderingForm
14 | v4.6.1
15 | 512
16 | true
17 |
18 |
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 | Resources\style.ico
41 |
42 |
43 |
44 | ..\packages\SharpFont.4.0.1\lib\net45\SharpFont.dll
45 | True
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | Form
63 |
64 |
65 | InputGUI.cs
66 |
67 |
68 |
69 |
70 |
71 | InputGUI.cs
72 |
73 |
74 | ResXFileCodeGenerator
75 | Resources.Designer.cs
76 | Designer
77 |
78 |
79 | True
80 | Resources.resx
81 |
82 |
83 |
84 | SettingsSingleFileGenerator
85 | Settings.Designer.cs
86 |
87 |
88 | True
89 | Settings.settings
90 | True
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
103 |
104 |
105 |
106 |
107 |
114 |
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/InputGUI.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 |
123 | AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAA
124 | AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
125 | /wD///8A////AP///wD///8A////AN2JR/Ldjk3/3IxN/9yITP/RZjLGxEkRCf///wDRZDbR2HxK/th8
126 | Sv/Ye0r/1ndH+f///wD///8A////AP///wDNVxYzzFUVc9yGR/Dchkj1yE4TU8dMEgX///8AxEgRIcNG
127 | EIDWeUb10mw948BCDl////8A////AP///wD///8A////AP///wDSayms4p5g/8lTFoPITxMK////AP//
128 | /wDESRFT2HlE8M9bLsDBRA8i////AP///wD///8A////AP///wD///8Az1sXNtl/O9PdjUr2z1oel8lQ
129 | FHDIThNsz1onruCZY//PXy7Bw0YQKP///wD///8A////AP///wD///8A////AP///wDQXRdc459b/+Si
130 | Y//hnFz/3o5N/96TV//hnWT/0F4qtMRKERPnuYj36sGW/+a1g/TbmGO2////ALxHFDPYjFPJ7MKm/96S
131 | W//kpGH/zVgWff///wDLVBRL35VX/9BjK7T///8Ay2McLuOsa9LqwJLqxFIYMf///wD///8AvUkVJ9yY
132 | YtHemmjg35NG796QRunPWhY7zVcWUuGZWf/QYSWm////AM9vHgTMaRxd7syk89yWTr3FVRlZw1EYU8FO
133 | F27ovJXt3Ztk081gGWjlpFz/3YY909BdF0fjnVj/z1ocjf///wD///8A////ANWEMpny17P87sme8OrA
134 | kOjrwZjt8tnA/92aXczAShYe2oAvr+KeUP7djULd5KZh/89bGIPNVxYG////AP///wDTeiAl6Ll01e7L
135 | mezMZhw2yV8bLOvBlOvblE/A0GkbQ9l4I5Pjnkzz6LFr/+isaf/YdSyu0F0Xdv///wD///8A////ANSA
136 | IGHz2bH61H4rj81rHTjnuHrb2ZBGtNJrGzvagymc3o03wd2JNLvchTS72oU2wdZ1Kab///8A////AP//
137 | /wDYiSIB2ZAvkfDUovHblDui5rVt0deJOaLLYxwT////AP///wD///8A////AP///wD///8A////AP//
138 | /wD///8A////ANmNI0jsx37Z9uXG//bjxf/dmUGqz28eKcxpHAH///8A////AP///wD///8A////AP//
139 | /wD///8A////AN2aJgziqma56Lx+7uvGlv3qwpD557l/7+CjYsvQdR8g////AP///wD///8A////AP//
140 | /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
141 | /wD///8A//8AAPAgAADwIAAA/DAAAPwAAAD+AAAACBEAAAwBAAAAAQAAwAAAAMAAAADgAAAA4D8AAPAf
142 | AADgHwAA//8AAA==
143 |
144 |
145 |
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/SpriteSheet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Imaging;
6 | using System.Collections.Generic;
7 | using SharpFont;
8 |
9 | namespace CustomFontRenderingForm
10 | {
11 | class SpriteSheet
12 | {
13 | private Face[] faces;
14 | private int[] sizes;
15 | private int[] defaultSizes = new int[] { 96, 60, 48, 42, 36, 32, 28, 24, 18, 14, 12, 11, 10, 9, 8 };
16 |
17 | private uint extraSize = 0;
18 | private int padX = 5, padY = 5;
19 |
20 | public string family;
21 | public string characters;
22 |
23 | public SpriteSheet(Face[] faces, string characters, int[] sizes, string family)
24 | {
25 | this.faces = faces;
26 | this.characters = characters;
27 | this.sizes = sizes;
28 | this.family = family;
29 | }
30 |
31 | private void getKernWidthHeight(Face face, FontInfo info, out int width, out int maxHeight, out int firstAdjust)
32 | {
33 | width = 0;
34 | maxHeight = 0;
35 | firstAdjust = 0;
36 |
37 | for (int i = 0; i < characters.Length; i++)
38 | {
39 | char character1 = characters[i];
40 | uint index1 = face.GetCharIndex(character1);
41 |
42 | face.LoadGlyph(index1, LoadFlags.Default, LoadTarget.Normal);
43 | GlyphMetrics metrics = face.Glyph.Metrics;
44 |
45 | int yoffset = metrics.VerticalAdvance.ToInt32() - metrics.HorizontalBearingY.ToInt32();
46 | int nheight = yoffset + metrics.Height.ToInt32();
47 | int height = metrics.Height.ToInt32();
48 | if (height > maxHeight)
49 | {
50 | maxHeight = height; //nheight;
51 | firstAdjust = yoffset;
52 | }
53 |
54 | for (int j = 0; j < characters.Length; j++)
55 | {
56 | char character2 = characters[j];
57 | uint index2 = face.GetCharIndex(character2);
58 |
59 | FTVector26Dot6 kern = face.GetKerning(index1, index2, KerningMode.Default);
60 | int kernX = kern.X.ToInt32();
61 | int kernY = kern.Y.ToInt32();
62 | if (kernX != 0 || kernY != 0)
63 | {
64 | info.addKerning(new KerningInfo(character1, character2, kernX, kernY));
65 | }
66 | }
67 |
68 | if (i + 1 == characters.Length)
69 | {
70 | width += metrics.Width.ToInt32() + metrics.HorizontalBearingX.ToInt32() + padX;
71 | }
72 | else
73 | {
74 | width += metrics.HorizontalAdvance.ToInt32() + padX;
75 | }
76 | }
77 | }
78 |
79 | private int renderCharacter(Face face, char character, int posX, int posY, int atlas, FontInfo info, Graphics graphics)
80 | {
81 | uint index = face.GetCharIndex(character);
82 | face.LoadGlyph(index, LoadFlags.Default, LoadTarget.Normal);
83 | face.Glyph.RenderGlyph(RenderMode.Normal);
84 |
85 | GlyphMetrics metrics = face.Glyph.Metrics;
86 | int width = metrics.Width.ToInt32() + metrics.HorizontalBearingX.ToInt32();
87 | int xAdvance = metrics.HorizontalAdvance.ToInt32();
88 | int yoffset = metrics.VerticalAdvance.ToInt32() - metrics.HorizontalBearingY.ToInt32();
89 | int charHeight = metrics.Height.ToInt32();
90 |
91 | if (face.Glyph.Bitmap.Width > 0)
92 | {
93 | FTBitmap ftbmp = face.Glyph.Bitmap;
94 | Bitmap copy = ftbmp.ToGdipBitmap(Color.White);
95 | graphics.DrawImageUnscaled(copy, posX + metrics.HorizontalBearingX.ToInt32(), posY);
96 | }
97 |
98 | info.addCharacter(new CharacterInfo(character, posX, posY, width, charHeight, xAdvance, yoffset, atlas));
99 |
100 | return width;
101 | }
102 |
103 | private string[] getStyles()
104 | {
105 | int i = 0;
106 | string[] styles = new string[faces.Length];
107 | foreach (Face face in faces)
108 | {
109 | styles[i] = "\"" + face.StyleName + "\"";
110 | i++;
111 | }
112 | return styles;
113 | }
114 |
115 | private string useEnums()
116 | {
117 | bool isenum = Enumerable.SequenceEqual(sizes, defaultSizes);
118 | return isenum ? "true" : "false";
119 | }
120 |
121 | private string prepOutputDataJSON()
122 | {
123 | string output = "{\n\t\"information\" : {\n";
124 | output += "\t\t\"family\" : \"" + family + "\",\n";
125 | output += "\t\t\"styles\" : [" + string.Join(", ", getStyles()) + "],\n";
126 | output += "\t\t\"sizes\" : [" + string.Join(", ", sizes) + "],\n";
127 | output += "\t\t\"useEnums\" : " + useEnums() + "\n\t},\n";
128 | output += "\t\"styles\" : {\n";
129 | return output;
130 | }
131 |
132 | private string prepOutputDataLua()
133 | {
134 | string output = "{\n\tinformation = {\n";
135 | output += "\t\tfamily = \"" + family + "\",\n";
136 | output += "\t\tstyles = {" + string.Join(", ", getStyles()) + "},\n";
137 | output += "\t\tsizes = {" + string.Join(", ", sizes) + "},\n";
138 | output += "\t\tuseEnums = " + useEnums() + "\n\t},\n";
139 | output += "\tstyles = {\n";
140 | return output;
141 | }
142 |
143 | public void generateAtlases(string outputPath, int maxWidth, int maxHeight, bool genJSON, bool genRBXLua)
144 | {
145 | int atlas = 0;
146 | int posX = 0, posY = 0;
147 |
148 | List bitmaps = new List();
149 | Dictionary> infos = new Dictionary>();
150 |
151 | Bitmap bitmap = new Bitmap(maxWidth, maxHeight, PixelFormat.Format32bppArgb);
152 | Graphics graphics = Graphics.FromImage(bitmap);
153 | graphics.Clear(Color.Transparent);
154 |
155 | foreach (Face face in faces)
156 | {
157 | infos[face.StyleName] = new List();
158 | for (int i = 0; i < sizes.Length; i++)
159 | {
160 | int size = sizes[i];
161 | FontInfo info = new FontInfo(face.StyleName, size);
162 |
163 | int width = 0;
164 | int height = 0;
165 | int lineHeight = 0;
166 | int firstAdjust = 0;
167 |
168 | face.SetPixelSizes((uint)size + extraSize, (uint)size + extraSize);
169 | face.SetUnpatentedHinting(true);
170 |
171 | getKernWidthHeight(face, info, out width, out lineHeight, out firstAdjust);
172 |
173 | if (width > maxWidth)
174 | {
175 | int overlaps = (int)Math.Truncate((float)(width / maxWidth));
176 | width = maxWidth;
177 | height = (overlaps + 1) * (lineHeight + padY);
178 | }
179 | else
180 | {
181 | width = maxWidth;
182 | height = lineHeight + padY;
183 | }
184 |
185 | for (int j = 0; j < characters.Length; j++)
186 | {
187 | char character = characters[j];
188 | uint index = face.GetCharIndex(character);
189 | face.LoadGlyph(index, LoadFlags.Default, LoadTarget.Normal);
190 | face.Glyph.RenderGlyph(RenderMode.Normal);
191 |
192 | // case where the glyph won't fit horizontally
193 | if (posX + face.Glyph.Metrics.Width + face.Glyph.BitmapLeft + padX > width)
194 | {
195 | posX = 0;
196 | posY += lineHeight + padY;
197 | }
198 | // case where the glyph won't fit vertically
199 | if (posY > maxHeight - (lineHeight + padY))
200 | {
201 | bitmaps.Add(bitmap);
202 |
203 | bitmap = new Bitmap(maxWidth, maxHeight, PixelFormat.Format32bppArgb);
204 | graphics = Graphics.FromImage(bitmap);
205 | graphics.Clear(Color.Transparent);
206 |
207 | posX = 0;
208 | posY = 0;
209 | atlas++;
210 | }
211 |
212 | // draw the character
213 | posX += renderCharacter(face, characters[j], posX, posY, atlas, info, graphics) + padX;
214 | }
215 |
216 | // new font size means resetting some stuff
217 | posX = 0;
218 | posY += lineHeight + padY;
219 |
220 | // set the info line height and first adjust
221 | info.lineHeight = lineHeight;
222 | info.firstAdjust = firstAdjust;
223 |
224 | // add the info to the list
225 | infos[face.StyleName].Add(info);
226 | }
227 | }
228 |
229 | // add the current bitmap
230 | bitmaps.Add(bitmap);
231 | graphics.Dispose();
232 |
233 | // export
234 | int count = 0;
235 | foreach (Bitmap bmp in bitmaps)
236 | {
237 | count++;
238 | bmp.Save(outputPath + "\\" + family + "_" + count + ".png");
239 | }
240 |
241 | // export data
242 | if (genJSON)
243 | {
244 | int c = 0;
245 | string output = prepOutputDataJSON();
246 | foreach (Face face in faces)
247 | {
248 | c++;
249 | output += "\t\t\"" + face.StyleName + "\" : {\n";
250 | int c2 = 0;
251 | foreach (FontInfo info in infos[face.StyleName])
252 | {
253 | c2++;
254 | output += info.makeJSON("\t\t\t") + (c2 < infos[face.StyleName].Count ? "," : "") + "\n";
255 | }
256 | output += "\t\t}" + (c < faces.Length ? "," : "") + "\n";
257 | }
258 | output += "\t}\n}";
259 | // write json file
260 | File.WriteAllText(outputPath + "\\" + family + ".json", output);
261 | }
262 |
263 | if (genRBXLua)
264 | {
265 | int c = 0;
266 | string output = prepOutputDataLua();
267 | foreach (Face face in faces)
268 | {
269 | c++;
270 | output += "\t\t[\"" + face.StyleName + "\"] = {\n";
271 | int c2 = 0;
272 | foreach (FontInfo info in infos[face.StyleName])
273 | {
274 | c2++;
275 | output += info.makeLua("\t\t\t") + (c2 < infos[face.StyleName].Count ? "," : "") + "\n";
276 | }
277 | output += "\t\t}" + (c < faces.Length ? "," : "") + "\n";
278 | }
279 | output += "\t}\n}";
280 |
281 | // Setup module
282 | string header = "--[[\n\t@Font " + family + "\n";
283 | header += "\t@Sizes {" + string.Join(", ", sizes) + "}\n";
284 | header += "\t@Author N/A\n";
285 | header += "\t@Link N/A\n--]]\n\n";
286 |
287 | header += "local module = {}\n\n";
288 | header += "module.atlases = {\n";
289 |
290 | for (int i = 1; i <= count; i++)
291 | {
292 | header += "\t[" + i + "] = \"rbxassetid://\";\n";
293 | }
294 |
295 | header += "};\n\nmodule.font = " + output;
296 | header += "\n\nreturn module";
297 |
298 | // write Lua file
299 | File.WriteAllText(outputPath + "\\" + family + ".lua", header);
300 | }
301 | }
302 | }
303 | }
--------------------------------------------------------------------------------
/CustomFontRenderingForm/CustomFontRenderingForm/InputGUI.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CustomFontRenderingForm
2 | {
3 | partial class InputGUI
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InputGUI));
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.fontBox = new System.Windows.Forms.TextBox();
34 | this.fontButton = new System.Windows.Forms.Button();
35 | this.outputButton = new System.Windows.Forms.Button();
36 | this.outputBox = new System.Windows.Forms.TextBox();
37 | this.label2 = new System.Windows.Forms.Label();
38 | this.label3 = new System.Windows.Forms.Label();
39 | this.widthBox = new System.Windows.Forms.TextBox();
40 | this.label4 = new System.Windows.Forms.Label();
41 | this.heightBox = new System.Windows.Forms.TextBox();
42 | this.label5 = new System.Windows.Forms.Label();
43 | this.characterBox = new System.Windows.Forms.TextBox();
44 | this.label6 = new System.Windows.Forms.Label();
45 | this.label7 = new System.Windows.Forms.Label();
46 | this.sizeBox = new System.Windows.Forms.TextBox();
47 | this.generateButton = new System.Windows.Forms.Button();
48 | this.JSONCheckBox = new System.Windows.Forms.CheckBox();
49 | this.RBXLuaCheckBox = new System.Windows.Forms.CheckBox();
50 | this.outputMessage = new System.Windows.Forms.Label();
51 | this.SuspendLayout();
52 | //
53 | // label1
54 | //
55 | this.label1.AutoSize = true;
56 | this.label1.Location = new System.Drawing.Point(13, 13);
57 | this.label1.Name = "label1";
58 | this.label1.Size = new System.Drawing.Size(52, 13);
59 | this.label1.TabIndex = 0;
60 | this.label1.Text = "Font Files";
61 | //
62 | // fontBox
63 | //
64 | this.fontBox.Enabled = false;
65 | this.fontBox.Location = new System.Drawing.Point(111, 10);
66 | this.fontBox.Name = "fontBox";
67 | this.fontBox.ReadOnly = true;
68 | this.fontBox.Size = new System.Drawing.Size(230, 20);
69 | this.fontBox.TabIndex = 1;
70 | //
71 | // fontButton
72 | //
73 | this.fontButton.Location = new System.Drawing.Point(347, 8);
74 | this.fontButton.Name = "fontButton";
75 | this.fontButton.Size = new System.Drawing.Size(75, 23);
76 | this.fontButton.TabIndex = 2;
77 | this.fontButton.Text = "Choose";
78 | this.fontButton.UseVisualStyleBackColor = true;
79 | this.fontButton.Click += new System.EventHandler(this.fontButton_Click);
80 | //
81 | // outputButton
82 | //
83 | this.outputButton.Location = new System.Drawing.Point(347, 38);
84 | this.outputButton.Name = "outputButton";
85 | this.outputButton.Size = new System.Drawing.Size(75, 23);
86 | this.outputButton.TabIndex = 3;
87 | this.outputButton.Text = "Choose";
88 | this.outputButton.UseVisualStyleBackColor = true;
89 | this.outputButton.Click += new System.EventHandler(this.outputButton_Click);
90 | //
91 | // outputBox
92 | //
93 | this.outputBox.Enabled = false;
94 | this.outputBox.Location = new System.Drawing.Point(111, 40);
95 | this.outputBox.Name = "outputBox";
96 | this.outputBox.ReadOnly = true;
97 | this.outputBox.Size = new System.Drawing.Size(230, 20);
98 | this.outputBox.TabIndex = 4;
99 | //
100 | // label2
101 | //
102 | this.label2.AutoSize = true;
103 | this.label2.Location = new System.Drawing.Point(13, 43);
104 | this.label2.Name = "label2";
105 | this.label2.Size = new System.Drawing.Size(71, 13);
106 | this.label2.TabIndex = 5;
107 | this.label2.Text = "Output Folder";
108 | //
109 | // label3
110 | //
111 | this.label3.AutoSize = true;
112 | this.label3.Location = new System.Drawing.Point(12, 77);
113 | this.label3.Name = "label3";
114 | this.label3.Size = new System.Drawing.Size(90, 13);
115 | this.label3.TabIndex = 6;
116 | this.label3.Text = "Max Image Width";
117 | //
118 | // widthBox
119 | //
120 | this.widthBox.Location = new System.Drawing.Point(111, 74);
121 | this.widthBox.MaxLength = 10;
122 | this.widthBox.Name = "widthBox";
123 | this.widthBox.Size = new System.Drawing.Size(56, 20);
124 | this.widthBox.TabIndex = 7;
125 | this.widthBox.Text = "1024";
126 | this.widthBox.Leave += new System.EventHandler(this.widthBox_Leave);
127 | //
128 | // label4
129 | //
130 | this.label4.AutoSize = true;
131 | this.label4.Location = new System.Drawing.Point(173, 77);
132 | this.label4.Name = "label4";
133 | this.label4.Size = new System.Drawing.Size(38, 13);
134 | this.label4.TabIndex = 8;
135 | this.label4.Text = "Height";
136 | //
137 | // heightBox
138 | //
139 | this.heightBox.Location = new System.Drawing.Point(217, 74);
140 | this.heightBox.MaxLength = 10;
141 | this.heightBox.Name = "heightBox";
142 | this.heightBox.Size = new System.Drawing.Size(56, 20);
143 | this.heightBox.TabIndex = 9;
144 | this.heightBox.Text = "1024";
145 | this.heightBox.Leave += new System.EventHandler(this.heightBox_Leave);
146 | //
147 | // label5
148 | //
149 | this.label5.AutoSize = true;
150 | this.label5.Location = new System.Drawing.Point(12, 112);
151 | this.label5.Name = "label5";
152 | this.label5.Size = new System.Drawing.Size(72, 13);
153 | this.label5.TabIndex = 10;
154 | this.label5.Text = "Character Set";
155 | //
156 | // characterBox
157 | //
158 | this.characterBox.Location = new System.Drawing.Point(111, 109);
159 | this.characterBox.Name = "characterBox";
160 | this.characterBox.Size = new System.Drawing.Size(311, 20);
161 | this.characterBox.TabIndex = 37;
162 | this.characterBox.Leave += new System.EventHandler(this.characterBox_Leave);
163 | //
164 | // label6
165 | //
166 | this.label6.AutoSize = true;
167 | this.label6.Location = new System.Drawing.Point(116, 132);
168 | this.label6.Name = "label6";
169 | this.label6.Size = new System.Drawing.Size(306, 13);
170 | this.label6.TabIndex = 47;
171 | this.label6.Text = "Leave blank for default: bytes 32-126 (standard printable ASCII)";
172 | //
173 | // label7
174 | //
175 | this.label7.AutoSize = true;
176 | this.label7.Location = new System.Drawing.Point(12, 164);
177 | this.label7.Name = "label7";
178 | this.label7.Size = new System.Drawing.Size(56, 13);
179 | this.label7.TabIndex = 48;
180 | this.label7.Text = "Font Sizes";
181 | //
182 | // sizeBox
183 | //
184 | this.sizeBox.Location = new System.Drawing.Point(111, 161);
185 | this.sizeBox.Name = "sizeBox";
186 | this.sizeBox.Size = new System.Drawing.Size(311, 20);
187 | this.sizeBox.TabIndex = 49;
188 | this.sizeBox.Leave += new System.EventHandler(this.sizeBox_Leave);
189 | //
190 | // generateButton
191 | //
192 | this.generateButton.Location = new System.Drawing.Point(347, 191);
193 | this.generateButton.Name = "generateButton";
194 | this.generateButton.Size = new System.Drawing.Size(75, 23);
195 | this.generateButton.TabIndex = 50;
196 | this.generateButton.Text = "Generate";
197 | this.generateButton.UseVisualStyleBackColor = true;
198 | this.generateButton.Click += new System.EventHandler(this.generateButton_Click);
199 | //
200 | // JSONCheckBox
201 | //
202 | this.JSONCheckBox.AutoSize = true;
203 | this.JSONCheckBox.Checked = true;
204 | this.JSONCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
205 | this.JSONCheckBox.Location = new System.Drawing.Point(287, 195);
206 | this.JSONCheckBox.Name = "JSONCheckBox";
207 | this.JSONCheckBox.Size = new System.Drawing.Size(54, 17);
208 | this.JSONCheckBox.TabIndex = 51;
209 | this.JSONCheckBox.Text = "JSON";
210 | this.JSONCheckBox.UseVisualStyleBackColor = true;
211 | //
212 | // RBXLuaCheckBox
213 | //
214 | this.RBXLuaCheckBox.AutoSize = true;
215 | this.RBXLuaCheckBox.Location = new System.Drawing.Point(212, 195);
216 | this.RBXLuaCheckBox.Name = "RBXLuaCheckBox";
217 | this.RBXLuaCheckBox.Size = new System.Drawing.Size(69, 17);
218 | this.RBXLuaCheckBox.TabIndex = 52;
219 | this.RBXLuaCheckBox.Text = "RBX.Lua";
220 | this.RBXLuaCheckBox.UseVisualStyleBackColor = true;
221 | //
222 | // outputMessage
223 | //
224 | this.outputMessage.AutoSize = true;
225 | this.outputMessage.Location = new System.Drawing.Point(13, 196);
226 | this.outputMessage.Name = "outputMessage";
227 | this.outputMessage.Size = new System.Drawing.Size(0, 13);
228 | this.outputMessage.TabIndex = 53;
229 | this.outputMessage.Click += new System.EventHandler(this.outputMessage_Click);
230 | //
231 | // InputGUI
232 | //
233 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
234 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
235 | this.ClientSize = new System.Drawing.Size(434, 226);
236 | this.Controls.Add(this.outputMessage);
237 | this.Controls.Add(this.RBXLuaCheckBox);
238 | this.Controls.Add(this.JSONCheckBox);
239 | this.Controls.Add(this.generateButton);
240 | this.Controls.Add(this.sizeBox);
241 | this.Controls.Add(this.label7);
242 | this.Controls.Add(this.label6);
243 | this.Controls.Add(this.characterBox);
244 | this.Controls.Add(this.label5);
245 | this.Controls.Add(this.heightBox);
246 | this.Controls.Add(this.label4);
247 | this.Controls.Add(this.widthBox);
248 | this.Controls.Add(this.label3);
249 | this.Controls.Add(this.label2);
250 | this.Controls.Add(this.outputBox);
251 | this.Controls.Add(this.outputButton);
252 | this.Controls.Add(this.fontButton);
253 | this.Controls.Add(this.fontBox);
254 | this.Controls.Add(this.label1);
255 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
256 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
257 | this.Name = "InputGUI";
258 | this.Text = "Custom Font generator";
259 | this.ResumeLayout(false);
260 | this.PerformLayout();
261 |
262 | }
263 |
264 | #endregion
265 |
266 | private System.Windows.Forms.Label label1;
267 | private System.Windows.Forms.TextBox fontBox;
268 | private System.Windows.Forms.Button fontButton;
269 | private System.Windows.Forms.Button outputButton;
270 | private System.Windows.Forms.TextBox outputBox;
271 | private System.Windows.Forms.Label label2;
272 | private System.Windows.Forms.Label label3;
273 | private System.Windows.Forms.TextBox widthBox;
274 | private System.Windows.Forms.Label label4;
275 | private System.Windows.Forms.TextBox heightBox;
276 | private System.Windows.Forms.Label label5;
277 | private System.Windows.Forms.TextBox characterBox;
278 | private System.Windows.Forms.Label label6;
279 | private System.Windows.Forms.Label label7;
280 | private System.Windows.Forms.TextBox sizeBox;
281 | private System.Windows.Forms.Button generateButton;
282 | private System.Windows.Forms.CheckBox JSONCheckBox;
283 | private System.Windows.Forms.CheckBox RBXLuaCheckBox;
284 | private System.Windows.Forms.Label outputMessage;
285 | }
286 | }
287 |
288 |
--------------------------------------------------------------------------------
/_.mod.lua:
--------------------------------------------------------------------------------
1 | --[[
2 | Custom Font Tools
3 | A system that uses spritesheets to produce unique font style for use in game
4 | @author EgoMoose
5 | @link http://www.roblox.com/Rbx-CustomFont-item?id=230767320
6 | @date 19/10/2016
7 | --]]
8 |
9 | -- Github : https://github.com/EgoMoose/Rbx_CustomFont
10 | -- Fonts : https://github.com/EgoMoose/Rbx_CustomFont/wiki/Creating-your-own-font
11 |
12 | ------------------------------------------------------------------------------------------------------------------------------
13 | --// Setup
14 |
15 | local fonts = script;
16 | local content = game:GetService("ContentProvider");
17 |
18 | ------------------------------------------------------------------------------------------------------------------------------
19 | --// Built-in local declerations
20 |
21 | local next = next;
22 | local type = type;
23 | local pcall = pcall;
24 | local unpack = unpack;
25 | local tostring = tostring;
26 | local tonumber = tonumber;
27 |
28 | local abs = math.abs;
29 | local min = math.min;
30 | local max = math.max;
31 |
32 | local sub = string.sub;
33 | local rep = string.rep;
34 | local byte = string.byte;
35 | local gsub = string.gsub;
36 | local find = string.find;
37 | local char = string.char;
38 | local match = string.match;
39 | local upper = string.upper;
40 | local gmatch = string.gmatch;
41 |
42 | local sort = table.sort;
43 | local insert = table.insert;
44 |
45 | local udim2 = UDim2.new;
46 | local color3 = Color3.new;
47 | local vector2 = Vector2.new;
48 | local instance = Instance.new;
49 |
50 | ------------------------------------------------------------------------------------------------------------------------------
51 | --// Other declerations
52 |
53 | local IMGFRAME = instance("ImageLabel");
54 | IMGFRAME.Size = udim2(0, 0, 0, 0);
55 | IMGFRAME.BackgroundTransparency = 1;
56 | IMGFRAME.ScaleType = Enum.ScaleType.Stretch;
57 |
58 | local REPLACE = string.byte("?");
59 |
60 | local justify1 = {
61 | ["Right"] = true;
62 | ["Bottom"] = true
63 | };
64 |
65 | local justify0 = {
66 | ["Left"] = true;
67 | ["Top"] = true
68 | };
69 |
70 | local redraws = {
71 | ["AbsoluteSize"] = true;
72 | ["TextWrapped"] = true;
73 | ["TextScaled"] = true;
74 | ["TextXAlignment"] = true;
75 | ["TextYAlignment"] = true;
76 | };
77 |
78 | local overwrites = {
79 | ["TextTransparency"] = true;
80 | ["TextStrokeTransparency"] = true;
81 | ["BackgroundTransparency"] = true;
82 | };
83 |
84 | local noReplicate = {
85 | ["AbsolutePosition"] = true;
86 | ["AbsoluteSize"] = true;
87 | ["Position"] = true;
88 | ["Size"] = true;
89 | ["Rotation"] = true;
90 | ["Parent"] = true;
91 | };
92 |
93 | local customProperties = {
94 | ["FontName"] = true;
95 | ["Style"] = true;
96 | };
97 |
98 | ------------------------------------------------------------------------------------------------------------------------------
99 | --// Static functions
100 |
101 | local function getAlignMultiplier(enum)
102 | return (justify1[enum.Name] and 1) or (justify0[enum.Name] and 0) or 0.5;
103 | end;
104 |
105 | local function getClosestNumber(n, set)
106 | sort(set, function(a, b) return abs(n - a) < abs(n - b); end);
107 | return set[1];
108 | end;
109 |
110 | -- wrapper function
111 |
112 | local function wrapper(child, addition)
113 | local this = newproxy(true);
114 | local mt = getmetatable(this);
115 | mt.__index = function(t, k) return addition[k] or child[k]; end;
116 | mt.__newindex = function(t, k, v) if addition[k] then addition[k] = v; else child[k] = v; end; end;
117 | mt.__call = function() return child; end;
118 | mt.__tostring = function(t) return tostring(child); end;
119 | mt.__metatable = "The metatable is locked.";
120 | return this;
121 | end;
122 |
123 | -- background stuff
124 |
125 | local function defaultHide(child)
126 | child.TextTransparency = 2;
127 | child.BackgroundTransparency = 2;
128 | child.TextStrokeTransparency = 2;
129 | end;
130 |
131 | local function newBackground(child, class)
132 | local frame = instance("Frame", child);
133 | frame.Name = "_background";
134 | frame.Size = udim2(1, 0, 1, 0);
135 | frame.BackgroundTransparency = child.BackgroundTransparency;
136 | frame.BackgroundColor3 = child.BackgroundColor3;
137 | frame.BorderSizePixel = child.BorderSizePixel;
138 | frame.BorderColor3 = child.BorderColor3;
139 | frame.ZIndex = child.ZIndex;
140 | if (class == "TextButton") then
141 | frame.MouseEnter:connect(function()
142 | if child.AutoButtonColor then
143 | local origin = child.BackgroundColor3;
144 | frame.BackgroundColor3 = color3(origin.r - 75/255, origin.g - 75/255, origin.b - 75/255);
145 | end;
146 | end);
147 | child.MouseLeave:connect(function()
148 | if child.AutoButtonColor then
149 | frame.BackgroundColor3 = child.BackgroundColor3;
150 | end;
151 | end);
152 | end;
153 | return frame;
154 | end;
155 |
156 | -- functions for grabbing data from input strings
157 |
158 | local function split(text, pattern)
159 | local t = {};
160 | local lp = 0;
161 | while (true) do
162 | local p = find(text, pattern, lp, true);
163 | if (p) then
164 | insert(t, sub(text, lp, p - 1));
165 | lp = p + 1;
166 | else
167 | insert(t, sub(text, lp));
168 | break;
169 | end;
170 | end;
171 | return t;
172 | end;
173 |
174 | local function getLines(text)
175 | local text = gsub(text, "\t", rep(" ", 4));
176 | return split(text, "\n");
177 | end;
178 |
179 | local function getWords(text, includeNewLines)
180 | local text = gsub(text, "\t", rep(" ", 4));
181 | local lines , words = split(text, "\n"), {};
182 | local nlines = #lines;
183 | for i = 1, nlines do
184 | local line = lines[i];
185 | for word in gmatch(line, " *[^%s]+ *") do
186 | insert(words, word);
187 | end;
188 | if (includeNewLines and i < nlines) then
189 | insert(words, "\n");
190 | end;
191 | end;
192 | return words;
193 | end;
194 |
195 | -- functions for calculating data for text from spritesheets
196 |
197 | local function getStringWidth(text, sizeSet)
198 | local length, ntext = 0, #text;
199 | for i = 1, ntext do
200 | local i2 = i + 1 <= #text and i + 1;
201 | local b = byte(sub(text, i, i));
202 | local b2 = i2 and byte(sub(text, i2, i2));
203 | local character = sizeSet.characters[b];
204 | local kernx = 0
205 | if (b2 and sizeSet.kerning[b] and sizeSet.kerning[b][b2]) then
206 | kernx = sizeSet.kerning[b][b2].x;
207 | end;
208 | length = length + sizeSet.characters[b].xadvance + kernx;
209 | end;
210 | return length;
211 | end;
212 |
213 | local function getMaxHeight(text, sizeSet)
214 | local mheight, ntext = 0, #text;
215 | for i = 1, ntext do
216 | local b = byte(sub(text, i, i));
217 | local character = sizeSet.characters[b];
218 | local height = sizeSet.characters[b].height + sizeSet.characters[b].yoffset;
219 | if (height > mheight) then
220 | mheight = height;
221 | end;
222 | end;
223 | return mheight;
224 | end;
225 |
226 | -- functions for formatting spritesheet strings
227 |
228 | local function wrapText(text, size, settings)
229 | local index = 1;
230 | local lines, words = {""}, getWords(text, true);
231 | local lineWidth, maxWidth = 0, abs(settings.child.AbsoluteSize.x);
232 | for i = 1, #words do
233 | local word = words[i];
234 | if (word ~= "\n") then
235 | local width = getStringWidth(word, settings.styles[settings.style][size]);
236 | if (width + lineWidth <= maxWidth) then
237 | lines[index] = lines[index] .. word;
238 | else
239 | lineWidth = 0;
240 | index = index + 1;
241 | lines[index] = word;
242 | end;
243 | lineWidth = lineWidth + width;
244 | else
245 | lineWidth = 0;
246 | index = index + 1;
247 | lines[index] = "";
248 | end;
249 | end;
250 | return lines;
251 | end;
252 |
253 | function scaleText(text, settings)
254 | local child = settings.child;
255 | local attached = settings.attached;
256 |
257 | sort(settings.information.sizes, function(a, b) return a > b; end);
258 | local bestSize = settings.information.sizes[1];
259 | local broke = false;
260 |
261 | for i = 1, #settings.information.sizes do
262 | local size = settings.information.sizes[i];
263 | local sizeSet = settings.styles[settings.style][size];
264 | local lines = child.TextWrapped and wrapText(text, size, settings) or getLines(text);
265 |
266 | local widths = {};
267 | local height = -sizeSet.firstAdjust;
268 | for j = 1, #lines do
269 | local line = lines[j];
270 | height = height + getMaxHeight(line, sizeSet)
271 | insert(widths, getStringWidth(line, sizeSet));
272 | end;
273 |
274 | local width = max(unpack(widths));
275 | if (width <= abs(child.AbsoluteSize.x) and height <= abs(child.AbsoluteSize.y)) then
276 | bestSize = size;
277 | broke = true;
278 | break;
279 | end;
280 | end;
281 |
282 | return broke and bestSize or settings.information.sizes[#settings.information.sizes];
283 | end;
284 |
285 | -- functions for drawing
286 |
287 | local function drawSprite(byte, nextByte, settings)
288 | local sprite = IMGFRAME:Clone();
289 | local child = settings.child;
290 | local attached = settings.attached;
291 |
292 | local sizeSet = settings.styles[settings.style][settings.size];
293 | local character = sizeSet.characters[byte];
294 |
295 | -- fill in the defining properties
296 | sprite.Name = byte;
297 | sprite.ImageColor3 = child.TextColor3;
298 | sprite.ImageTransparency = attached.TextTransparency;
299 | sprite.ZIndex = child.ZIndex;
300 |
301 | -- setup the image
302 | sprite.Image = settings.atlases[character.atlas + 1];
303 | sprite.ImageRectSize = vector2(character.width, character.height);
304 | sprite.ImageRectOffset = vector2(character.x, character.y);
305 |
306 | -- kerning
307 | local kernx, kerny = 0, 0
308 | if (nextByte and sizeSet.kerning[byte] and sizeSet.kerning[byte][nextByte]) then
309 | local k = sizeSet.kerning[byte][nextByte];
310 | kernx = k.x;
311 | kerny = k.y;
312 | end;
313 |
314 | -- positioning
315 | sprite.Position = udim2(0, kernx, 0, character.yoffset + kerny);
316 | sprite.Size = udim2(0, character.width, 0, character.height);
317 |
318 | return sprite, kernx, kerny + character.yoffset + character.height;
319 | end;
320 |
321 | local function drawLine(text, height, gsprites, settings)
322 | local width = 0;
323 | local maxheight = 0;
324 | local sprites = {};
325 |
326 | local child = settings.child;
327 | local attached = settings.attached;
328 |
329 | local ntext = #text;
330 | local sizeSet = settings.styles[settings.style][settings.size];
331 |
332 | for i = 1, ntext do
333 | local i2 = i + 1 <= ntext and i + 1;
334 | local b = byte(sub(text, i, i));
335 | local b2 = i2 and byte(sub(text, i2, i2));
336 | local character, kernx, mheight = drawSprite(b, b2, settings);
337 | maxheight = mheight > maxheight and mheight or maxheight
338 | character.Position = character.Position + udim2(0, width, 0, height);
339 | width = width + (i2 and sizeSet.characters[b].xadvance or sizeSet.characters[b].width) + kernx;
340 | insert(sprites, character);
341 | insert(gsprites, character);
342 | end;
343 |
344 | local xalign = getAlignMultiplier(child.TextXAlignment);
345 | local adjust = (abs(child.AbsoluteSize.x) - width) * xalign;
346 | for i = 1, ntext do
347 | local character = sprites[i];
348 | character.Position = character.Position + udim2(0, adjust, 0, 0);
349 | end;
350 |
351 | return width, maxheight;
352 | end;
353 |
354 | local function drawLines(text, settings, parent)
355 | local child = settings.child;
356 |
357 | if (child.TextScaled) then
358 | settings.size = scaleText(text, settings);
359 | end;
360 |
361 | local lines = child.TextWrapped and wrapText(text, settings.size, settings) or getLines(text);
362 | local lineHeight = settings.styles[settings.style][settings.size].lineHeight;
363 |
364 | local widths = {0};
365 | local height = -settings.styles[settings.style][settings.size].firstAdjust;
366 | local sprites = {};
367 |
368 | for i = 1, #lines do
369 | local line = lines[i];
370 | local width, lh = drawLine(line, height, sprites, settings);
371 | height = height + lh;
372 | insert(widths, width);
373 | end;
374 |
375 | local yalign = getAlignMultiplier(child.TextYAlignment);
376 | local adjust = (abs(child.AbsoluteSize.y) - height) * yalign;
377 | for i = 1, #sprites do
378 | local character = sprites[i];
379 | character.Position = character.Position + udim2(0, 0, 0, adjust);
380 | character.Parent = parent;
381 | end;
382 |
383 | return sprites;
384 | end;
385 | ------------------------------------------------------------------------------------------------------------------------------
386 | --// Classes
387 |
388 | local event = {};
389 |
390 | function event.new(t)
391 | local evnts = {};
392 | local self = setmetatable({},{
393 | __index = t;
394 | __newindex = function(tt, k, v)
395 | if (t[k] ~= v) then
396 | t[k] = v;
397 | if (type(evnts[k]) == "function") then
398 | evnts[k](v);
399 | end;
400 | end;
401 | end;
402 | __metatable = "The metatable is locked.";
403 | });
404 |
405 | function self:connect(k, f)
406 | evnts[k] = f;
407 | end;
408 |
409 | return self;
410 | end;
411 |
412 | local settings = {};
413 |
414 | function settings.new(fontModule, attached, child)
415 | local self = setmetatable({}, {__index = settings});
416 |
417 | settings.child = child;
418 | settings.attached = attached;
419 |
420 | -- place data in new format for easy access
421 | self.information = fontModule.font.information;
422 | self.atlases = fontModule.atlases;
423 | self.styles = fontModule.font.styles;
424 |
425 | -- sort from least to greatest
426 | sort(self.information.sizes, function(a, b) return a > b; end);
427 |
428 | -- establish some settings variables
429 | self.style = self.information.styles[1];
430 | self.size = child.TextSize;
431 |
432 | -- failsafes
433 | for styleName, style in next, self.styles do
434 | -- characters that DNE
435 | for sizeName, size in next, style do
436 | setmetatable(size.characters, {
437 | __index = function(t, k)
438 | local k = tostring(k);
439 | local v = rawget(t, k)
440 | if (not v) then
441 | warn(k, "is not a valid character. Replaced with, \"" .. char(REPLACE) .. "\"");
442 | return rawget(t, tostring(REPLACE));
443 | end;
444 | return v;
445 | end;
446 | })
447 | end;
448 | -- sizes that DNE
449 | setmetatable(style, {
450 | __index = function(t, k)
451 | local k = tostring(k);
452 | local v = rawget(t, k);
453 | if (not v) then
454 | local closest = getClosestNumber(k, self.information.sizes);
455 | self.size = closest;
456 | child.TextSize = closest;
457 | warn(k, "is not a valid size. Using the closest size,", closest);
458 | return rawget(t, tostring(closest));
459 | end;
460 | return v;
461 | end;
462 | });
463 | end;
464 | -- styles that DNE
465 | setmetatable(self.styles, {
466 | __index = function(t, k)
467 | local v = rawget(t, k);
468 | if (not v) then
469 | local nstyle = self.information.styles[1];
470 | self.style = nstyle;
471 | attached.Style = nstyle;
472 | warn(k, "is not a valid style. Using first style found", nstyle);
473 | return rawget(t, nstyle);
474 | end;
475 | return v;
476 | end;
477 | });
478 |
479 | return self;
480 | end;
481 |
482 | function settings:preload()
483 | for _, atlas in next, self.atlases do
484 | content:Preload(atlas);
485 | end;
486 | end;
487 |
488 | -- custom font class (this is what the player interacts with)
489 |
490 | local customFont = {};
491 |
492 | function customFont.new(fontName, class, isButton)
493 | local self = event.new {};
494 |
495 | local exists = not (type(class) == "string");
496 | local child = exists and class or instance(class);
497 | local fontModule = fonts:FindFirstChild(fontName);
498 | --local folder = instance("Folder", child);
499 |
500 | local settings = settings.new(require(fontModule), self, child);
501 | settings:preload();
502 |
503 | local events = {};
504 | local properties = {};
505 | local propertyobjects = {};
506 | local drawncharacters = {};
507 |
508 | self.FontName = fontName;
509 | self.Style = settings.style;
510 | self.TextTransparency = child.TextTransparency;
511 | self.TextStrokeTransparency = child.TextStrokeTransparency;
512 | self.BackgroundTransparency = child.BackgroundTransparency;
513 | self.TextFits = false;
514 |
515 | -- create the physical representation of the custom properties
516 | for name, _ in next, customProperties do
517 | local property = self[name];
518 | local t = type(property);
519 | local className = upper(sub(t, 1, 1)) .. sub(t, 2) .. "Value";
520 | local physicalProperty = Instance.new(className, child);
521 |
522 | physicalProperty.Name = name;
523 | physicalProperty.Value = property;
524 |
525 | physicalProperty.Changed:connect(function(newValue)
526 | self[name] = newValue;
527 | end);
528 |
529 | propertyobjects[physicalProperty.Name] = physicalProperty;
530 | properties[physicalProperty] = true;
531 | end;
532 |
533 | local background = newBackground(child, isButton and "TextButton");
534 | defaultHide(child);
535 |
536 | -- common function
537 |
538 | local function drawText()
539 | background:ClearAllChildren();
540 | drawncharacters = drawLines(child.Text, settings, background);
541 | end;
542 |
543 | -- custom events
544 |
545 | self:connect("FontName", function(value) drawText(); end);
546 | self:connect("TextStrokeTransparency", function(value) drawText(); end);
547 |
548 | self:connect("BackgroundTransparency", function(value)
549 | background.BackgroundTransparency = value;
550 | end);
551 |
552 | self:connect("Style", function(value)
553 | settings.style = value;
554 | propertyobjects["Style"].Value = value;
555 | drawText();
556 | end);
557 |
558 | self:connect("TextTransparency", function(value)
559 | for i = 1, #drawncharacters do
560 | drawncharacters[i].ImageTransparency = value;
561 | end;
562 | end);
563 |
564 | self:connect("FontName", function(value)
565 | local fontModule = fonts:FindFirstChild(value);
566 | settings = settings.new(require(fontModule), self, child);
567 | settings:preload();
568 | propertyobjects["FontName"].Value = value;
569 | if (not child.TextScaled) then
570 | settings.size = child.TextSize;
571 | end;
572 | settings.style = self.Style;
573 | drawText();
574 | end);
575 |
576 | -- real events
577 |
578 | insert(events, child.Changed:connect(function(property)
579 | if (overwrites[property]) then
580 | if (child[property] ~= 2) then
581 | self[property] = child[property]
582 | end;
583 | child[property] = 2;
584 | elseif (property == "TextSize") then
585 | settings.size = child[property];
586 | drawText();
587 | elseif (property == "TextColor3") then
588 | for _, sprite in next, drawncharacters do
589 | sprite.ImageColor3 = child[property];
590 | end;
591 | elseif (property == "ZIndex") then
592 | background.ZIndex = child[property];
593 | for _, sprite in next, drawncharacters do
594 | sprite.ZIndex = child[property];
595 | end;
596 | elseif (property == "Text") then
597 | drawText();
598 | elseif (redraws[property]) then
599 | if (property == "TextScaled" and not child[property]) then
600 | settings.size = child.TextSize;
601 | end;
602 | drawText();
603 | elseif (not match(property, "Text") and not noReplicate[property]) then
604 | pcall(function() background[property] = child[property]; end);
605 | end;
606 | end));
607 |
608 | if (child:IsA("TextBox")) then
609 | insert(events, child.Focused:connect(function()
610 | if (child.ClearTextOnFocus) then
611 | child.Text = "";
612 | end;
613 | end));
614 | end;
615 |
616 | -- methods
617 |
618 | function self:Revert()
619 | for _, property in next, propertyobjects do property:Destroy(); end;
620 | for _, event in next, events do event:disconnect(); end;
621 | background:Destroy();
622 | child.TextTransparency = self.TextTransparency;
623 | child.BackgroundTransparency = self.BackgroundTransparency;
624 | self, properties, propertyobjects, events = nil, nil, nil, nil;
625 | return child;
626 | end;
627 |
628 | function self:GetChildren()
629 | local children = {};
630 | for _, kid in next, child:GetChildren() do
631 | if (kid ~= background and not properties[kid]) then
632 | insert(children, kid);
633 | end;
634 | end;
635 | return children;
636 | end;
637 |
638 | function self:ClearAllChildren()
639 | for _, kid in next, child:GetChildren() do
640 | if (kid ~= background and not properties[kid]) then
641 | kid:Destroy();
642 | end;
643 | end;
644 | end;
645 |
646 | function self:Destroy()
647 | self:Revert():Destroy();
648 | end;
649 |
650 | -- return
651 | drawText();
652 | return wrapper(child, self);
653 | end;
654 |
655 | ------------------------------------------------------------------------------------------------------------------------------
656 | --// Module
657 |
658 | local module = {};
659 |
660 | for _, class in next, {"TextLabel", "TextBox", "TextButton", "TextReplace"} do
661 | module[string.sub(class, 5)] = function(fontName, child)
662 | return customFont.new(fontName, class == "TextReplace" and child or class, class == "TextButton" or (class == "TextReplace" and child:IsA("TextButton")));
663 | end;
664 | end;
665 |
666 | wait(); -- top bar can mess with stuff if fonts called instantly
667 |
668 | return module;
--------------------------------------------------------------------------------
/chrome_extension/jquery-3.1.1.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */
2 | !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),
3 | a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/