Compare commits
837 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb30cb0cb6 | ||
|
|
b211fae85c | ||
|
|
93b4774903 | ||
|
|
236b55fce6 | ||
|
|
c34bf50c39 | ||
|
|
b8f921dab2 | ||
|
|
fc79be3010 | ||
|
|
63d08eeed2 | ||
|
|
7fa39f645d | ||
|
|
535677fc8e | ||
|
|
2dfff50031 | ||
|
|
c335b6b7fb | ||
|
|
a81c4c7a75 | ||
|
|
e2ada5e6b2 | ||
|
|
43ae4ac317 | ||
|
|
5f0ee6d95e | ||
|
|
0947172391 | ||
|
|
0fb9680f72 | ||
|
|
ba94a3bba0 | ||
|
|
11963e263d | ||
|
|
3f15cb8fff | ||
|
|
eca4f8e06d | ||
|
|
358be2ee92 | ||
|
|
acd8f949e7 | ||
|
|
a1574af5e0 | ||
|
|
525e73e179 | ||
|
|
abe1745642 | ||
|
|
eda925e617 | ||
|
|
5ab3f7ba16 | ||
|
|
cb12bdad2d | ||
|
|
2a6c2fc273 | ||
|
|
216c04b3f1 | ||
|
|
0ecb6ea1aa | ||
|
|
f3fff8543d | ||
|
|
2d75b57195 | ||
|
|
7ebd73916e | ||
|
|
cafa9d521a | ||
|
|
a5b395d888 | ||
|
|
c214640bb1 | ||
|
|
d7a8b35ded | ||
|
|
bcc86e160f | ||
|
|
5b14389c6e | ||
|
|
0ba4803154 | ||
|
|
e58f9cae28 | ||
|
|
1d5c049c01 | ||
|
|
0d01b4a2ea | ||
|
|
d43a758a37 | ||
|
|
d886372f11 | ||
|
|
838d44bd5c | ||
|
|
8f997eb4f3 | ||
|
|
65b3fc56ef | ||
|
|
6e061cbc30 | ||
|
|
9e44b76214 | ||
|
|
d1e928e068 | ||
|
|
2c2249d96b | ||
|
|
d87e932030 | ||
|
|
44cac8a7e1 | ||
|
|
736d3c8744 | ||
|
|
3104065437 | ||
|
|
444695a908 | ||
|
|
eba6f4eaf2 | ||
|
|
e3b4f0b159 | ||
|
|
5c55939765 | ||
|
|
bd69d00182 | ||
|
|
7312789e12 | ||
|
|
4e765e64ca | ||
|
|
660f86018a | ||
|
|
b5050acba0 | ||
|
|
2fa780236b | ||
|
|
831770e7d8 | ||
|
|
c50102e153 | ||
|
|
54088daa67 | ||
|
|
169312f021 | ||
|
|
62ab717772 | ||
|
|
6273bcdd3f | ||
|
|
5b894794dd | ||
|
|
b31c41fdda | ||
|
|
2c6bcacb25 | ||
|
|
ed9b9881b6 | ||
|
|
2d2945cc5c | ||
|
|
3b1a1fbbe2 | ||
|
|
be2f15f77b | ||
|
|
3c4872c231 | ||
|
|
8c605674f3 | ||
|
|
c1549faca1 | ||
|
|
f4b98cd4ff | ||
|
|
cbeac572f5 | ||
|
|
f94371f16c | ||
|
|
7111a2aee3 | ||
|
|
cc82304996 | ||
|
|
3d91b8ab13 | ||
|
|
9a4ae52df0 | ||
|
|
466b6bb1dd | ||
|
|
facf511621 | ||
|
|
c4cada924e | ||
|
|
99b8a02c0e | ||
|
|
b74ed1490a | ||
|
|
02f64e318d | ||
|
|
2938014b33 | ||
|
|
45040555f0 | ||
|
|
591ec57c49 | ||
|
|
d5626ab7df | ||
|
|
2a25efba1a | ||
|
|
9197d24fff | ||
|
|
9fa87c5141 | ||
|
|
dddf2e9ea1 | ||
|
|
69ea8838cd | ||
|
|
33ea31f1fa | ||
|
|
e2adcabc5b | ||
|
|
a33ded4409 | ||
|
|
6161518d8b | ||
|
|
bf40cb2009 | ||
|
|
12f8315a84 | ||
|
|
0f460483f3 | ||
|
|
bf22cd1638 | ||
|
|
e656c89ba1 | ||
|
|
b8416ed4c1 | ||
|
|
62b8e18c9e | ||
|
|
1e09ccbc0c | ||
|
|
76717f6141 | ||
|
|
33308688aa | ||
|
|
df481aaf07 | ||
|
|
82190b330b | ||
|
|
19d8103806 | ||
|
|
30b6120582 | ||
|
|
b7aa8bd56c | ||
|
|
4aad818888 | ||
|
|
68a51af239 | ||
|
|
80d64ae4e0 | ||
|
|
cd295e2315 | ||
|
|
80bdd6761b | ||
|
|
bf0798d397 | ||
|
|
e130a87e81 | ||
|
|
34e22c63a0 | ||
|
|
70db2a15f4 | ||
|
|
aaa7be7bff | ||
|
|
000fda848b | ||
|
|
c0f0595ad7 | ||
|
|
62ad6dde67 | ||
|
|
8750fe7a43 | ||
|
|
b0f0bb10ec | ||
|
|
e05f276b6a | ||
|
|
a075934168 | ||
|
|
5898ebb5f0 | ||
|
|
d122c83535 | ||
|
|
2025e8f10b | ||
|
|
3339a63268 | ||
|
|
3d2eef2a69 | ||
|
|
aa9f1074bd | ||
|
|
545ba36db4 | ||
|
|
53b8979861 | ||
|
|
0569a4b633 | ||
|
|
cc306475b2 | ||
|
|
3f0982dd7c | ||
|
|
017ef727ab | ||
|
|
1f1635ede3 | ||
|
|
f2f2e780b0 | ||
|
|
f32e7df86a | ||
|
|
030e219cbd | ||
|
|
111e8c82c4 | ||
|
|
d0aad8589d | ||
|
|
c7eb890ffe | ||
|
|
47a9bde70b | ||
|
|
7abadcc6c3 | ||
|
|
8a52bcfec2 | ||
|
|
81770d2182 | ||
|
|
0ed030fae3 | ||
|
|
a8dd0632f2 | ||
|
|
04f7e84642 | ||
|
|
efda17ecfa | ||
|
|
11c9bf39ff | ||
|
|
c41cfe5ae2 | ||
|
|
61c6270edd | ||
|
|
1fe5e6ad8e | ||
|
|
8c7fbcd7d4 | ||
|
|
6746fdb98e | ||
|
|
4cf48bb50f | ||
|
|
80a4e54802 | ||
|
|
c19a958629 | ||
|
|
9b969087a5 | ||
|
|
121de8090f | ||
|
|
ae18a10fd8 | ||
|
|
05b0ef75c9 | ||
|
|
8dfad0aa5d | ||
|
|
b07f2e9633 | ||
|
|
6ecc435b85 | ||
|
|
a0a70495f0 | ||
|
|
29981dfd52 | ||
|
|
86735ac3b7 | ||
|
|
e5a1a10101 | ||
|
|
f362a83cfa | ||
|
|
df902fb08e | ||
|
|
29de36f348 | ||
|
|
92e7603aa5 | ||
|
|
e3431f201c | ||
|
|
5c7a6bbf8f | ||
|
|
d6a82d1962 | ||
|
|
a7a5ada4d9 | ||
|
|
6ff50cb42d | ||
|
|
7ffc89f41b | ||
|
|
8c1131442b | ||
|
|
c49acc9084 | ||
|
|
f03cfcb0e3 | ||
|
|
460d7c5aea | ||
|
|
50fd681420 | ||
|
|
70c8ca3a55 | ||
|
|
1234f789a4 | ||
|
|
25fd009be3 | ||
|
|
9ffab47f83 | ||
|
|
38c46f3d5c | ||
|
|
3a0c33c5cf | ||
|
|
5d6b057361 | ||
|
|
8fcbdc8ea0 | ||
|
|
a774f9052d | ||
|
|
2d79b5a988 | ||
|
|
86ae5e14b4 | ||
|
|
8153d4a139 | ||
|
|
3e80d86628 | ||
|
|
a097330772 | ||
|
|
5545743bd8 | ||
|
|
ccd212f839 | ||
|
|
5697625a7d | ||
|
|
3d54005332 | ||
|
|
a5894dfae8 | ||
|
|
b3aa6e37b9 | ||
|
|
e4e7661a3d | ||
|
|
9fe38ad649 | ||
|
|
a8a03a831a | ||
|
|
0df4db9286 | ||
|
|
e4599e3076 | ||
|
|
1a0d8933dc | ||
|
|
00af30281c | ||
|
|
8c85b3098d | ||
|
|
000607f8e0 | ||
|
|
82e3698dd2 | ||
|
|
0dd9535a5b | ||
|
|
088b3f60ea | ||
|
|
c118159121 | ||
|
|
5fad745220 | ||
|
|
02b41bfbdc | ||
|
|
82ab3faca3 | ||
|
|
df74757e83 | ||
|
|
a21772f3c2 | ||
|
|
cbd930a340 | ||
|
|
9f129c9781 | ||
|
|
18931e94b0 | ||
|
|
1520828dff | ||
|
|
43223d1677 | ||
|
|
3fb9836fc8 | ||
|
|
8cd5a10ea8 | ||
|
|
da1850896b | ||
|
|
336ef01dee | ||
|
|
246bf189b5 | ||
|
|
825effadd9 | ||
|
|
51f53855f8 | ||
|
|
65fa29fbb8 | ||
|
|
5bcfa06e19 | ||
|
|
b01218958f | ||
|
|
7887f0e7a1 | ||
|
|
f522502938 | ||
|
|
c7f533cf0a | ||
|
|
a3107de33e | ||
|
|
e69a3249e5 | ||
|
|
f3c24f05e0 | ||
|
|
20364bb1d7 | ||
|
|
3d1c92dae4 | ||
|
|
4048895c6b | ||
|
|
991908bd8d | ||
|
|
8ff559dbef | ||
|
|
d7d483ef9c | ||
|
|
b11064e3a8 | ||
|
|
409d35b29b | ||
|
|
811cf40cd7 | ||
|
|
3aa9d23ac6 | ||
|
|
9c8bb08454 | ||
|
|
2c28af0dd7 | ||
|
|
cc6bd40b15 | ||
|
|
5221ba0959 | ||
|
|
61f132327d | ||
|
|
826730e88b | ||
|
|
5cdb08c35f | ||
|
|
9806d3705a | ||
|
|
55e6e66df6 | ||
|
|
0d38b23a60 | ||
|
|
07fd0ab6bf | ||
|
|
6036b0635d | ||
|
|
74f678076a | ||
|
|
ef157d71f2 | ||
|
|
0b718e0fbf | ||
|
|
809af86c16 | ||
|
|
449e8e2c4a | ||
|
|
01c8a10463 | ||
|
|
27da7ed0fe | ||
|
|
685116c555 | ||
|
|
0c4741c793 | ||
|
|
4da7024f91 | ||
|
|
b49a2cc52d | ||
|
|
c0fe50cd2f | ||
|
|
497efaabf0 | ||
|
|
2ee777739f | ||
|
|
deb3ad5359 | ||
|
|
3f1801ef2b | ||
|
|
ca8e92e443 | ||
|
|
c514e4a1ad | ||
|
|
ec28de40c9 | ||
|
|
14053fbfdd | ||
|
|
464030808c | ||
|
|
d2377bff34 | ||
|
|
d3f378f6bd | ||
|
|
09e1562fbc | ||
|
|
4e14ac6d9b | ||
|
|
97882f0c60 | ||
|
|
482a5cfb11 | ||
|
|
f73dee1103 | ||
|
|
9034e1ad45 | ||
|
|
7e35481b62 | ||
|
|
2f87f2adc3 | ||
|
|
6b345ac041 | ||
|
|
19e18f6a10 | ||
|
|
f181cef9e9 | ||
|
|
dd19c39cf8 | ||
|
|
5887a9c755 | ||
|
|
ca35084160 | ||
|
|
644eee0aca | ||
|
|
510a0c1087 | ||
|
|
4afbe4c2fc | ||
|
|
6cf36cc99c | ||
|
|
b98127e83a | ||
|
|
f7f195f083 | ||
|
|
22e6228a08 | ||
|
|
b757e42c88 | ||
|
|
fdf1ef1cb7 | ||
|
|
4797ff84d8 | ||
|
|
3937d733f0 | ||
|
|
0328643c7c | ||
|
|
80c73523e3 | ||
|
|
8c5747798d | ||
|
|
bdf6dbd096 | ||
|
|
0eaef469f9 | ||
|
|
f2d3615e26 | ||
|
|
24f05a1c03 | ||
|
|
570642d820 | ||
|
|
fd794f99d2 | ||
|
|
9a95bae6ba | ||
|
|
1b04504617 | ||
|
|
2a2cd81149 | ||
|
|
2bb961b7a8 | ||
|
|
01b035d7af | ||
|
|
8d0de398fd | ||
|
|
2ebec54476 | ||
|
|
b66d5fe8d3 | ||
|
|
0f989f249f | ||
|
|
6980bdcf7f | ||
|
|
975a016974 | ||
|
|
4be1b45896 | ||
|
|
8e10824189 | ||
|
|
1a881b4eaf | ||
|
|
2a9e91dd55 | ||
|
|
725ea8999a | ||
|
|
3427b736ec | ||
|
|
1dde9d0198 | ||
|
|
7577c3552d | ||
|
|
30de655fb2 | ||
|
|
09cf5589f5 | ||
|
|
b206f8ab78 | ||
|
|
f358cdea5b | ||
|
|
14fe45bda8 | ||
|
|
72ff461b45 | ||
|
|
96fe7d46ba | ||
|
|
d40cdeb65e | ||
|
|
4130df7bf9 | ||
|
|
6e176cdda7 | ||
|
|
bdb171dc6d | ||
|
|
801471a105 | ||
|
|
f86cb53bd9 | ||
|
|
435e1b3b4b | ||
|
|
4b17d76144 | ||
|
|
d96ebe4282 | ||
|
|
e5c5e7dc5e | ||
|
|
fe593dcb09 | ||
|
|
b1056a19a3 | ||
|
|
048c47f7f3 | ||
|
|
a4bb1605ce | ||
|
|
c4d24c0a4c | ||
|
|
99dedb61cb | ||
|
|
702c3d069f | ||
|
|
8ec8efe967 | ||
|
|
4aa0260399 | ||
|
|
f24aaf1396 | ||
|
|
00ddd056af | ||
|
|
2438fbb13d | ||
|
|
20832c3dcc | ||
|
|
725461f04e | ||
|
|
a3edd7bdf9 | ||
|
|
8d9d330678 | ||
|
|
d46fa3012b | ||
|
|
75e9f916ec | ||
|
|
f71277008f | ||
|
|
184a9d223b | ||
|
|
b4c45e33e9 | ||
|
|
eea960bcbd | ||
|
|
609e4397db | ||
|
|
b8bfbc5f6a | ||
|
|
4b274f959e | ||
|
|
e66811a4e2 | ||
|
|
139bfe775c | ||
|
|
feb26af4bf | ||
|
|
27d75f810a | ||
|
|
bc251d8c2b | ||
|
|
bde9010000 | ||
|
|
91314f423f | ||
|
|
2bb0a361aa | ||
|
|
5517bf80f9 | ||
|
|
f141e6f7a7 | ||
|
|
7220288460 | ||
|
|
d9f4955736 | ||
|
|
13255bc58b | ||
|
|
2988de5501 | ||
|
|
70a69f1c3b | ||
|
|
7cce0bf865 | ||
|
|
16e3e92c4a | ||
|
|
5f1b78ea1d | ||
|
|
9f36a8e5f8 | ||
|
|
89a2212408 | ||
|
|
9ed344d22d | ||
|
|
642db4c5b9 | ||
|
|
2a93778df7 | ||
|
|
c11500b791 | ||
|
|
ee0303dc06 | ||
|
|
0d55f3bd81 | ||
|
|
0e377c1aff | ||
|
|
388bd7cefa | ||
|
|
8234b3b063 | ||
|
|
573a07026d | ||
|
|
880e04d760 | ||
|
|
683752762d | ||
|
|
79a78e0a58 | ||
|
|
c33bea997a | ||
|
|
a2f8d9bc43 | ||
|
|
80d717b4dc | ||
|
|
e14a8df6a0 | ||
|
|
4be0067852 | ||
|
|
30a97ed4db | ||
|
|
1257ed0174 | ||
|
|
c717dd7bba | ||
|
|
e0a7893578 | ||
|
|
6df5adf0f1 | ||
|
|
7e773e5d0a | ||
|
|
c3dbc4187f | ||
|
|
6c004c3010 | ||
|
|
96054295a0 | ||
|
|
640c0e9c4a | ||
|
|
ce04ef36da | ||
|
|
677e90ed6b | ||
|
|
c2fcdd6b9f | ||
|
|
d89cd59c8b | ||
|
|
ae0d933588 | ||
|
|
15a092ce87 | ||
|
|
e23fc7d15a | ||
|
|
0c07937d45 | ||
|
|
2694a06876 | ||
|
|
66ca709da9 | ||
|
|
a01d770044 | ||
|
|
bdfa5b6141 | ||
|
|
0d9116b9dc | ||
|
|
5c8f11bfe3 | ||
|
|
a32f04a4e3 | ||
|
|
133317efdb | ||
|
|
58f8834041 | ||
|
|
71ff5d3058 | ||
|
|
fb82fcdb20 | ||
|
|
3837e18af2 | ||
|
|
c4a431bd2f | ||
|
|
9ff868a2d4 | ||
|
|
7a44e5db9a | ||
|
|
9ec77d62cc | ||
|
|
fd974c7bb7 | ||
|
|
ed0bad79ad | ||
|
|
021a217f2c | ||
|
|
0c2ab575a1 | ||
|
|
338ca3bb24 | ||
|
|
7c718b5131 | ||
|
|
cbeb595f48 | ||
|
|
293d3aa259 | ||
|
|
21d1c1f9ba | ||
|
|
ef6bf6e4df | ||
|
|
aa6cfcc76e | ||
|
|
924919fb6f | ||
|
|
15b4793d32 | ||
|
|
22a1305cb1 | ||
|
|
7c3cc891f3 | ||
|
|
158e03b5fd | ||
|
|
e2aefab2ae | ||
|
|
4027ecee5a | ||
|
|
b1ca05fec3 | ||
|
|
21ef12f143 | ||
|
|
6cf1def982 | ||
|
|
2c1e032f38 | ||
|
|
56887c9f1f | ||
|
|
8715f79251 | ||
|
|
d8ff32f888 | ||
|
|
d0315891b7 | ||
|
|
a796dc2376 | ||
|
|
eb4cc629a3 | ||
|
|
280320ef9a | ||
|
|
328ddeb46d | ||
|
|
13df2cb182 | ||
|
|
bf73a03125 | ||
|
|
8c98e13984 | ||
|
|
c159e9326e | ||
|
|
662bd1188d | ||
|
|
b3e57075de | ||
|
|
c6a08896f0 | ||
|
|
8cfe6b557c | ||
|
|
8ce1da9485 | ||
|
|
c44b1689b3 | ||
|
|
dcf2571437 | ||
|
|
c9aca08d4e | ||
|
|
fe8486d456 | ||
|
|
b31dc5fb16 | ||
|
|
160ee475fd | ||
|
|
dca9e6a88a | ||
|
|
4172f7d157 | ||
|
|
7a2275b3fb | ||
|
|
76ac21a92d | ||
|
|
f21012202f | ||
|
|
c0eb4172a2 | ||
|
|
2ed832c729 | ||
|
|
bfbf84ca24 | ||
|
|
5747825c14 | ||
|
|
67cbc08b60 | ||
|
|
be0c8088ce | ||
|
|
c36b7d842d | ||
|
|
74534641aa | ||
|
|
f7e1ce7b50 | ||
|
|
dab73a3eb2 | ||
|
|
24fe2bb81e | ||
|
|
1cd1529e28 | ||
|
|
72386c94a9 | ||
|
|
262efb40bb | ||
|
|
85dfe6f5fa | ||
|
|
53cee56a9d | ||
|
|
76224c40fe | ||
|
|
f12b4914e6 | ||
|
|
989b0a602d | ||
|
|
7664f1ea74 | ||
|
|
1d3d5fa56b | ||
|
|
f69edba862 | ||
|
|
20bd4d81ec | ||
|
|
aeac737c84 | ||
|
|
bea1afc01c | ||
|
|
8cbc5d79d4 | ||
|
|
d51f050d6e | ||
|
|
b485e1ce4e | ||
|
|
5de12ce651 | ||
|
|
2d455a2fcf | ||
|
|
7b5f5ae5ce | ||
|
|
853981b3b0 | ||
|
|
2449a059f0 | ||
|
|
d1e2cf4850 | ||
|
|
e89a80ea1a | ||
|
|
ef44be8240 | ||
|
|
81fc8495b2 | ||
|
|
3dc7c62559 | ||
|
|
41e99372f7 | ||
|
|
9ac6ce909d | ||
|
|
9eebbc011e | ||
|
|
8c62d3eb28 | ||
|
|
7576511841 | ||
|
|
58423bfd18 | ||
|
|
aae759c901 | ||
|
|
4fe333e335 | ||
|
|
7634f9c6d5 | ||
|
|
6dd7c4abeb | ||
|
|
f1aa201425 | ||
|
|
964449660d | ||
|
|
5b3af56bd8 | ||
|
|
4c1acb8206 | ||
|
|
a9dd713809 | ||
|
|
d67c25aab5 | ||
|
|
7a0f8c5d98 | ||
|
|
46cd326f09 | ||
|
|
08898a7334 | ||
|
|
f2facff418 | ||
|
|
ef55c48dd1 | ||
|
|
f9411f0500 | ||
|
|
26e54dc2a2 | ||
|
|
a6891e1817 | ||
|
|
de35d2fe15 | ||
|
|
eeffd207be | ||
|
|
047daf4e44 | ||
|
|
b0012bee27 | ||
|
|
f81ea9fe57 | ||
|
|
5f5ebd12a4 | ||
|
|
a63b9e3ff4 | ||
|
|
d256b35a67 | ||
|
|
a3e553c04f | ||
|
|
dadf055a54 | ||
|
|
8d2f7da823 | ||
|
|
61a6c86ae2 | ||
|
|
2c958deebf | ||
|
|
0b4871c299 | ||
|
|
1fa86272d6 | ||
|
|
97f430b2b7 | ||
|
|
9c6be944fc | ||
|
|
f04cdad89d | ||
|
|
862777f067 | ||
|
|
4eb6ffc618 | ||
|
|
b75118b4c2 | ||
|
|
529f7198b1 | ||
|
|
5d08a963d5 | ||
|
|
0ee2193b3c | ||
|
|
e6bc582e16 | ||
|
|
6d23133101 | ||
|
|
11c3d77513 | ||
|
|
d9baa76804 | ||
|
|
88cd0996ec | ||
|
|
93726f9bb3 | ||
|
|
fb7eccee3d | ||
|
|
7fb596a744 | ||
|
|
ab43714359 | ||
|
|
4928b0087e | ||
|
|
9d23e4cfba | ||
|
|
57fd479a9c | ||
|
|
91e30ef9bd | ||
|
|
8af42aa7ac | ||
|
|
b9921e155b | ||
|
|
d7ed877ebd | ||
|
|
436630b5c8 | ||
|
|
5d2edc911d | ||
|
|
f0dcf68f8f | ||
|
|
caca296562 | ||
|
|
948978b5e1 | ||
|
|
a1c7a54172 | ||
|
|
38254f51d1 | ||
|
|
fe8c94bb90 | ||
|
|
891aff80ed | ||
|
|
cfa77ab0a4 | ||
|
|
7ecbc2c407 | ||
|
|
f185438b08 | ||
|
|
d413370104 | ||
|
|
2b54b192ed | ||
|
|
0296379cfa | ||
|
|
e4e9217d84 | ||
|
|
bf06a64734 | ||
|
|
7429ec9576 | ||
|
|
176c8fc557 | ||
|
|
d2e5476432 | ||
|
|
c53b0ba3ad | ||
|
|
e2137b3503 | ||
|
|
dc051e993b | ||
|
|
a0dbbbe397 | ||
|
|
a5d473c546 | ||
|
|
2204a15350 | ||
|
|
971cd573fc | ||
|
|
d3ba467e6a | ||
|
|
eb68960dca | ||
|
|
1297705b53 | ||
|
|
1a81c0b918 | ||
|
|
dd351eeaa5 | ||
|
|
c505f4249d | ||
|
|
26340a0d54 | ||
|
|
6779ec9ab8 | ||
|
|
9a4944f91d | ||
|
|
5a2f004c20 | ||
|
|
939eed7b3e | ||
|
|
e7515b0fdb | ||
|
|
3eb97098bb | ||
|
|
e4fd3927fa | ||
|
|
a5e7452673 | ||
|
|
6a1796a284 | ||
|
|
aaac445d84 | ||
|
|
fd9021190a | ||
|
|
5c35c18e49 | ||
|
|
89777eebcf | ||
|
|
18b2a1a65f | ||
|
|
edc5a9ea0a | ||
|
|
72edcc692b | ||
|
|
6e6a0dae96 | ||
|
|
c6224c4a4a | ||
|
|
76f9c9dd7c | ||
|
|
d75c7f9f50 | ||
|
|
cc7887d452 | ||
|
|
29f431cd78 | ||
|
|
1a97623dee | ||
|
|
79bd665b92 | ||
|
|
0de026fc2b | ||
|
|
cb3f87d4d9 | ||
|
|
f9ec7b7138 | ||
|
|
77e0e1d51f | ||
|
|
c28cd3506e | ||
|
|
7dd3c36867 | ||
|
|
4dd36c5130 | ||
|
|
f00628539a | ||
|
|
fcc5896926 | ||
|
|
75881d1c9f | ||
|
|
9597b057a6 | ||
|
|
7d209a1c58 | ||
|
|
490ca1c1c3 | ||
|
|
95c0aa1812 | ||
|
|
9cbb9f7529 | ||
|
|
c8a73fa56e | ||
|
|
29dff39bf1 | ||
|
|
ef8190612f | ||
|
|
55d547d947 | ||
|
|
e80825ac3a | ||
|
|
8d8edc171c | ||
|
|
c1f4740b68 | ||
|
|
d6a5f486d7 | ||
|
|
807cc53fa8 | ||
|
|
2237c91067 | ||
|
|
98a08fddf8 | ||
|
|
21cdcb20b4 | ||
|
|
47547b2ae8 | ||
|
|
6e9af92471 | ||
|
|
cc7df4222a | ||
|
|
25b5af50c2 | ||
|
|
7c8c728ad4 | ||
|
|
655fef4baa | ||
|
|
a27db58031 | ||
|
|
7c0cb2d1c3 | ||
|
|
229a089d45 | ||
|
|
49ca9d75f9 | ||
|
|
745903d133 | ||
|
|
54bf805548 | ||
|
|
2ac674f5c6 | ||
|
|
2b5a16be70 | ||
|
|
1fbe9df342 | ||
|
|
1217d2d05e | ||
|
|
432795026c | ||
|
|
ab23eaa6ff | ||
|
|
4583c0c713 | ||
|
|
d3a961f13f | ||
|
|
7a97af2c1d | ||
|
|
750cc59fd5 | ||
|
|
dfcf54d412 | ||
|
|
5fd1c35d85 | ||
|
|
21b61bd027 | ||
|
|
7fa28c6d8b | ||
|
|
97e396794a | ||
|
|
b096ef3606 | ||
|
|
74b0d86c36 | ||
|
|
319c509318 | ||
|
|
5703a040be | ||
|
|
6752b8ef50 | ||
|
|
7062560eaa | ||
|
|
3be433c910 | ||
|
|
bd0969e870 | ||
|
|
ffbac321a4 | ||
|
|
222f6589a9 | ||
|
|
a2245775a9 | ||
|
|
d594050166 | ||
|
|
2665055558 | ||
|
|
3e41afb0a6 | ||
|
|
f1ec4a2453 | ||
|
|
98f1ace910 | ||
|
|
401a3a7abb | ||
|
|
6a0cc816a9 | ||
|
|
4bafb3aaa1 | ||
|
|
782aac54e4 | ||
|
|
06dd46c24f | ||
|
|
bc50886250 | ||
|
|
4264c479ad | ||
|
|
b3afe9458e | ||
|
|
1382277c74 | ||
|
|
d1df67338d | ||
|
|
ccc5b9d30a | ||
|
|
86142ca5f1 | ||
|
|
b55fe4856c | ||
|
|
d5df587cc3 | ||
|
|
0665d10a7c | ||
|
|
43f7089106 | ||
|
|
fcb7722a55 | ||
|
|
7c5a005784 | ||
|
|
abd61689f1 | ||
|
|
acbe46b013 | ||
|
|
bbf169907a | ||
|
|
1d3af5c62d | ||
|
|
d095e6a5fe | ||
|
|
96df3ac91b | ||
|
|
38fe4fd85e | ||
|
|
95ac9b50e0 | ||
|
|
1f26ddaf3d | ||
|
|
64231d7f01 | ||
|
|
656c10e5cf | ||
|
|
f0d4ef75d3 | ||
|
|
ec27eb53bc | ||
|
|
6512d4895b | ||
|
|
de81341452 | ||
|
|
97e6906f17 | ||
|
|
feeb3907bf | ||
|
|
955d7714a2 | ||
|
|
e506d5a535 | ||
|
|
09ff2f279d | ||
|
|
e17a240661 | ||
|
|
a6e244a82f | ||
|
|
491fb4c243 | ||
|
|
ca46e36e5a | ||
|
|
09e3ece5a7 | ||
|
|
57e820501a | ||
|
|
1577118643 | ||
|
|
856a0c9f31 | ||
|
|
c621479709 | ||
|
|
b7769e6203 | ||
|
|
b1e27282a9 | ||
|
|
c19df45ec1 | ||
|
|
0ca29f9201 | ||
|
|
e208b45a88 | ||
|
|
b8f7be6376 | ||
|
|
5ae958e349 | ||
|
|
7237ef8c69 | ||
|
|
215a4ab362 | ||
|
|
8c83378b8b | ||
|
|
9d14ca1eb2 | ||
|
|
78067a8dec | ||
|
|
d12ea02c42 | ||
|
|
3ceb519b8a | ||
|
|
5508cd1074 | ||
|
|
d2bf52e5a3 | ||
|
|
f39b8e2a35 | ||
|
|
8c97be00dc | ||
|
|
83085c4c1f | ||
|
|
8adec9a48b | ||
|
|
c177374d23 | ||
|
|
334ced8627 | ||
|
|
d8229d79a5 | ||
|
|
c8665584e9 | ||
|
|
c56af14f52 | ||
|
|
ed8fb0dd67 | ||
|
|
f906b41cd2 | ||
|
|
1491e24039 | ||
|
|
30dbad53a7 | ||
|
|
b129bc39cb | ||
|
|
5ffba58802 | ||
|
|
3cd5b99edd | ||
|
|
89b1b51097 | ||
|
|
6b5c95fc3a |
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
error-log.txt
|
||||||
|
backups/*.zip
|
||||||
|
lib/config.php
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# CodeMirror 2
|
|
||||||
|
|
||||||
CodeMirror 2 is a rewrite of [CodeMirror
|
|
||||||
1](http://github.com/marijnh/CodeMirror). The docs live
|
|
||||||
[here](http://codemirror.net/doc/manual.html), and the project page is
|
|
||||||
[http://codemirror.net/](http://codemirror.net/).
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
// TODO number prefixes
|
|
||||||
(function() {
|
|
||||||
// Really primitive kill-ring implementation.
|
|
||||||
var killRing = [];
|
|
||||||
function addToRing(str) {
|
|
||||||
killRing.push(str);
|
|
||||||
if (killRing.length > 50) killRing.shift();
|
|
||||||
}
|
|
||||||
function getFromRing() { return killRing[killRing.length - 1] || ""; }
|
|
||||||
function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }
|
|
||||||
|
|
||||||
CodeMirror.keyMap.emacs = {
|
|
||||||
"Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");},
|
|
||||||
"Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
|
|
||||||
"Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");},
|
|
||||||
"Alt-W": function(cm) {addToRing(cm.getSelection());},
|
|
||||||
"Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());},
|
|
||||||
"Alt-Y": function(cm) {cm.replaceSelection(popFromRing());},
|
|
||||||
"Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd",
|
|
||||||
"Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace",
|
|
||||||
"Ctrl-Z": "undo", "Cmd-Z": "undo",
|
|
||||||
fallthrough: ["basic", "emacsy"]
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["emacs-Ctrl-X"] = {
|
|
||||||
"Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close",
|
|
||||||
auto: "emacs", catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
@@ -1,347 +0,0 @@
|
|||||||
(function() {
|
|
||||||
var count = "";
|
|
||||||
var sdir = "f";
|
|
||||||
var buf = "";
|
|
||||||
var yank = 0;
|
|
||||||
var mark = [];
|
|
||||||
function emptyBuffer() { buf = ""; }
|
|
||||||
function pushInBuffer(str) { buf += str; };
|
|
||||||
function pushCountDigit(digit) { return function(cm) {count += digit;} }
|
|
||||||
function popCount() { var i = parseInt(count); count = ""; return i || 1; }
|
|
||||||
function countTimes(func) {
|
|
||||||
if (typeof func == "string") func = CodeMirror.commands[func];
|
|
||||||
return function(cm) { for (var i = 0, c = popCount(); i < c; ++i) func(cm); }
|
|
||||||
}
|
|
||||||
|
|
||||||
function iterObj(o, f) {
|
|
||||||
for (var prop in o) if (o.hasOwnProperty(prop)) f(prop, o[prop]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var word = [/\w/, /[^\w\s]/], bigWord = [/\S/];
|
|
||||||
function findWord(line, pos, dir, regexps) {
|
|
||||||
var stop = 0, next = -1;
|
|
||||||
if (dir > 0) { stop = line.length; next = 0; }
|
|
||||||
var start = stop, end = stop;
|
|
||||||
// Find bounds of next one.
|
|
||||||
outer: for (; pos != stop; pos += dir) {
|
|
||||||
for (var i = 0; i < regexps.length; ++i) {
|
|
||||||
if (regexps[i].test(line.charAt(pos + next))) {
|
|
||||||
start = pos;
|
|
||||||
for (; pos != stop; pos += dir) {
|
|
||||||
if (!regexps[i].test(line.charAt(pos + next))) break;
|
|
||||||
}
|
|
||||||
end = pos;
|
|
||||||
break outer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {from: Math.min(start, end), to: Math.max(start, end)};
|
|
||||||
}
|
|
||||||
function moveToWord(cm, regexps, dir, where) {
|
|
||||||
var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line), word;
|
|
||||||
while (true) {
|
|
||||||
word = findWord(line, ch, dir, regexps);
|
|
||||||
ch = word[where == "end" ? "to" : "from"];
|
|
||||||
if (ch == cur.ch && word.from != word.to) ch = word[dir < 0 ? "from" : "to"];
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
cm.setCursor(cur.line, word[where == "end" ? "to" : "from"], true);
|
|
||||||
}
|
|
||||||
function joinLineNext(cm) {
|
|
||||||
var cur = cm.getCursor(), ch = cur.ch, line = cm.getLine(cur.line);
|
|
||||||
CodeMirror.commands.goLineEnd(cm);
|
|
||||||
if (cur.line != cm.lineCount()) {
|
|
||||||
CodeMirror.commands.goLineEnd(cm);
|
|
||||||
cm.replaceSelection(" ", "end");
|
|
||||||
CodeMirror.commands.delCharRight(cm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function editCursor(mode) {
|
|
||||||
if (mode == "vim-insert") {
|
|
||||||
// put in your cursor css changing code
|
|
||||||
} else if (mode == "vim") {
|
|
||||||
// put in your cursor css changing code
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function delTillMark(cm, cHar) {
|
|
||||||
var i = mark[cHar], l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
|
|
||||||
cm.setCursor(start);
|
|
||||||
for (var c = start; c <= end; c++) {
|
|
||||||
pushInBuffer("\n"+cm.getLine(start));
|
|
||||||
cm.removeLine(start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function yankTillMark(cm, cHar) {
|
|
||||||
var i = mark[cHar], l = cm.getCursor().line, start = i > l ? l : i, end = i > l ? i : l;
|
|
||||||
for (var c = start; c <= end; c++) {
|
|
||||||
pushInBuffer("\n"+cm.getLine(c));
|
|
||||||
}
|
|
||||||
cm.setCursor(start);
|
|
||||||
}
|
|
||||||
|
|
||||||
var map = CodeMirror.keyMap.vim = {
|
|
||||||
"0": function(cm) {count.length > 0 ? pushCountDigit("0")(cm) : CodeMirror.commands.goLineStart(cm);},
|
|
||||||
"A": function(cm) {popCount(); cm.setCursor(cm.getCursor().line, cm.getCursor().ch+1, true); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"Shift-A": function(cm) {popCount(); CodeMirror.commands.goLineEnd(cm); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"I": function(cm) {popCount(); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"Shift-I": function(cm) {popCount(); CodeMirror.commands.goLineStartSmart(cm); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"O": function(cm) {popCount(); CodeMirror.commands.goLineEnd(cm); cm.replaceSelection("\n", "end"); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"Shift-O": function(cm) {popCount(); CodeMirror.commands.goLineStart(cm); cm.replaceSelection("\n", "start"); cm.setOption("keyMap", "vim-insert"); editCursor("vim-insert");},
|
|
||||||
"G": function(cm) {cm.setOption("keyMap", "vim-prefix-g");},
|
|
||||||
"D": function(cm) {cm.setOption("keyMap", "vim-prefix-d"); emptyBuffer();},
|
|
||||||
"M": function(cm) {cm.setOption("keyMap", "vim-prefix-m"); mark = [];},
|
|
||||||
"Y": function(cm) {cm.setOption("keyMap", "vim-prefix-y"); emptyBuffer(); yank = 0;},
|
|
||||||
"/": function(cm) {var f = CodeMirror.commands.find; f && f(cm); sdir = "f"},
|
|
||||||
"Shift-/": function(cm) {
|
|
||||||
var f = CodeMirror.commands.find;
|
|
||||||
if (f) { f(cm); CodeMirror.commands.findPrev(cm); sdir = "r"; }
|
|
||||||
},
|
|
||||||
"N": function(cm) {
|
|
||||||
var fn = CodeMirror.commands.findNext;
|
|
||||||
if (fn) sdir != "r" ? fn(cm) : CodeMirror.commands.findPrev(cm);
|
|
||||||
},
|
|
||||||
"Shift-N": function(cm) {
|
|
||||||
var fn = CodeMirror.commands.findNext;
|
|
||||||
if (fn) sdir != "r" ? CodeMirror.commands.findPrev(cm) : fn.findNext(cm);
|
|
||||||
},
|
|
||||||
"Shift-G": function(cm) {count == "" ? cm.setCursor(cm.lineCount()) : cm.setCursor(parseInt(count)-1); popCount(); CodeMirror.commands.goLineStart(cm);},
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
// Add bindings for number keys
|
|
||||||
for (var i = 1; i < 10; ++i) map[i] = pushCountDigit(i);
|
|
||||||
// Add bindings that are influenced by number keys
|
|
||||||
iterObj({"H": "goColumnLeft", "L": "goColumnRight", "J": "goLineDown", "K": "goLineUp",
|
|
||||||
"Left": "goColumnLeft", "Right": "goColumnRight", "Down": "goLineDown", "Up": "goLineUp",
|
|
||||||
"Backspace": "goCharLeft", "Space": "goCharRight",
|
|
||||||
"B": function(cm) {moveToWord(cm, word, -1, "end");},
|
|
||||||
"E": function(cm) {moveToWord(cm, word, 1, "end");},
|
|
||||||
"W": function(cm) {moveToWord(cm, word, 1, "start");},
|
|
||||||
"Shift-B": function(cm) {moveToWord(cm, bigWord, -1, "end");},
|
|
||||||
"Shift-E": function(cm) {moveToWord(cm, bigWord, 1, "end");},
|
|
||||||
"Shift-W": function(cm) {moveToWord(cm, bigWord, 1, "start");},
|
|
||||||
"X": function(cm) {CodeMirror.commands.delCharRight(cm)},
|
|
||||||
"P": function(cm) {
|
|
||||||
var cur = cm.getCursor().line;
|
|
||||||
if (buf!= "") {
|
|
||||||
CodeMirror.commands.goLineEnd(cm);
|
|
||||||
cm.replaceSelection(buf, "end");
|
|
||||||
}
|
|
||||||
cm.setCursor(cur+1);
|
|
||||||
},
|
|
||||||
"Shift-X": function(cm) {CodeMirror.commands.delCharLeft(cm)},
|
|
||||||
"Shift-J": function(cm) {joinLineNext(cm)},
|
|
||||||
"Shift-`": function(cm) {
|
|
||||||
var cur = cm.getCursor(), cHar = cm.getRange({line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
|
|
||||||
cHar = cHar != cHar.toLowerCase() ? cHar.toLowerCase() : cHar.toUpperCase();
|
|
||||||
cm.replaceRange(cHar, {line: cur.line, ch: cur.ch}, {line: cur.line, ch: cur.ch+1});
|
|
||||||
cm.setCursor(cur.line, cur.ch+1);
|
|
||||||
},
|
|
||||||
"Ctrl-B": function(cm) {CodeMirror.commands.goPageUp(cm)},
|
|
||||||
"Ctrl-F": function(cm) {CodeMirror.commands.goPageDown(cm)},
|
|
||||||
"Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
|
||||||
"U": "undo", "Ctrl-R": "redo", "Shift-4": "goLineEnd"},
|
|
||||||
function(key, cmd) { map[key] = countTimes(cmd); });
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-g"] = {
|
|
||||||
"E": countTimes(function(cm) { moveToWord(cm, word, -1, "start");}),
|
|
||||||
"Shift-E": countTimes(function(cm) { moveToWord(cm, bigWord, -1, "start");}),
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-m"] = {
|
|
||||||
"A": function(cm) {mark["A"] = cm.getCursor().line;},
|
|
||||||
"Shift-A": function(cm) {mark["Shift-A"] = cm.getCursor().line;},
|
|
||||||
"B": function(cm) {mark["B"] = cm.getCursor().line;},
|
|
||||||
"Shift-B": function(cm) {mark["Shift-B"] = cm.getCursor().line;},
|
|
||||||
"C": function(cm) {mark["C"] = cm.getCursor().line;},
|
|
||||||
"Shift-C": function(cm) {mark["Shift-C"] = cm.getCursor().line;},
|
|
||||||
"D": function(cm) {mark["D"] = cm.getCursor().line;},
|
|
||||||
"Shift-D": function(cm) {mark["Shift-D"] = cm.getCursor().line;},
|
|
||||||
"E": function(cm) {mark["E"] = cm.getCursor().line;},
|
|
||||||
"Shift-E": function(cm) {mark["Shift-E"] = cm.getCursor().line;},
|
|
||||||
"F": function(cm) {mark["F"] = cm.getCursor().line;},
|
|
||||||
"Shift-F": function(cm) {mark["Shift-F"] = cm.getCursor().line;},
|
|
||||||
"G": function(cm) {mark["G"] = cm.getCursor().line;},
|
|
||||||
"Shift-G": function(cm) {mark["Shift-G"] = cm.getCursor().line;},
|
|
||||||
"H": function(cm) {mark["H"] = cm.getCursor().line;},
|
|
||||||
"Shift-H": function(cm) {mark["Shift-H"] = cm.getCursor().line;},
|
|
||||||
"I": function(cm) {mark["I"] = cm.getCursor().line;},
|
|
||||||
"Shift-I": function(cm) {mark["Shift-I"] = cm.getCursor().line;},
|
|
||||||
"J": function(cm) {mark["J"] = cm.getCursor().line;},
|
|
||||||
"Shift-J": function(cm) {mark["Shift-J"] = cm.getCursor().line;},
|
|
||||||
"K": function(cm) {mark["K"] = cm.getCursor().line;},
|
|
||||||
"Shift-K": function(cm) {mark["Shift-K"] = cm.getCursor().line;},
|
|
||||||
"L": function(cm) {mark["L"] = cm.getCursor().line;},
|
|
||||||
"Shift-L": function(cm) {mark["Shift-L"] = cm.getCursor().line;},
|
|
||||||
"M": function(cm) {mark["M"] = cm.getCursor().line;},
|
|
||||||
"Shift-M": function(cm) {mark["Shift-M"] = cm.getCursor().line;},
|
|
||||||
"N": function(cm) {mark["N"] = cm.getCursor().line;},
|
|
||||||
"Shift-N": function(cm) {mark["Shift-N"] = cm.getCursor().line;},
|
|
||||||
"O": function(cm) {mark["O"] = cm.getCursor().line;},
|
|
||||||
"Shift-O": function(cm) {mark["Shift-O"] = cm.getCursor().line;},
|
|
||||||
"P": function(cm) {mark["P"] = cm.getCursor().line;},
|
|
||||||
"Shift-P": function(cm) {mark["Shift-P"] = cm.getCursor().line;},
|
|
||||||
"Q": function(cm) {mark["Q"] = cm.getCursor().line;},
|
|
||||||
"Shift-Q": function(cm) {mark["Shift-Q"] = cm.getCursor().line;},
|
|
||||||
"R": function(cm) {mark["R"] = cm.getCursor().line;},
|
|
||||||
"Shift-R": function(cm) {mark["Shift-R"] = cm.getCursor().line;},
|
|
||||||
"S": function(cm) {mark["S"] = cm.getCursor().line;},
|
|
||||||
"Shift-S": function(cm) {mark["Shift-S"] = cm.getCursor().line;},
|
|
||||||
"T": function(cm) {mark["T"] = cm.getCursor().line;},
|
|
||||||
"Shift-T": function(cm) {mark["Shift-T"] = cm.getCursor().line;},
|
|
||||||
"U": function(cm) {mark["U"] = cm.getCursor().line;},
|
|
||||||
"Shift-U": function(cm) {mark["Shift-U"] = cm.getCursor().line;},
|
|
||||||
"V": function(cm) {mark["V"] = cm.getCursor().line;},
|
|
||||||
"Shift-V": function(cm) {mark["Shift-V"] = cm.getCursor().line;},
|
|
||||||
"W": function(cm) {mark["W"] = cm.getCursor().line;},
|
|
||||||
"Shift-W": function(cm) {mark["Shift-W"] = cm.getCursor().line;},
|
|
||||||
"X": function(cm) {mark["X"] = cm.getCursor().line;},
|
|
||||||
"Shift-X": function(cm) {mark["Shift-X"] = cm.getCursor().line;},
|
|
||||||
"Y": function(cm) {mark["Y"] = cm.getCursor().line;},
|
|
||||||
"Shift-Y": function(cm) {mark["Shift-Y"] = cm.getCursor().line;},
|
|
||||||
"Z": function(cm) {mark["Z"] = cm.getCursor().line;},
|
|
||||||
"Shift-Z": function(cm) {mark["Shift-Z"] = cm.getCursor().line;},
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-d"] = {
|
|
||||||
"D": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line)); cm.removeLine(cm.getCursor().line); }),
|
|
||||||
"'": function(cm) {cm.setOption("keyMap", "vim-prefix-d'"); emptyBuffer();},
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-d'"] = {
|
|
||||||
"A": function(cm) {delTillMark(cm,"A");},
|
|
||||||
"Shift-A": function(cm) {delTillMark(cm,"Shift-A");},
|
|
||||||
"B": function(cm) {delTillMark(cm,"B");},
|
|
||||||
"Shift-B": function(cm) {delTillMark(cm,"Shift-B");},
|
|
||||||
"C": function(cm) {delTillMark(cm,"C");},
|
|
||||||
"Shift-C": function(cm) {delTillMark(cm,"Shift-C");},
|
|
||||||
"D": function(cm) {delTillMark(cm,"D");},
|
|
||||||
"Shift-D": function(cm) {delTillMark(cm,"Shift-D");},
|
|
||||||
"E": function(cm) {delTillMark(cm,"E");},
|
|
||||||
"Shift-E": function(cm) {delTillMark(cm,"Shift-E");},
|
|
||||||
"F": function(cm) {delTillMark(cm,"F");},
|
|
||||||
"Shift-F": function(cm) {delTillMark(cm,"Shift-F");},
|
|
||||||
"G": function(cm) {delTillMark(cm,"G");},
|
|
||||||
"Shift-G": function(cm) {delTillMark(cm,"Shift-G");},
|
|
||||||
"H": function(cm) {delTillMark(cm,"H");},
|
|
||||||
"Shift-H": function(cm) {delTillMark(cm,"Shift-H");},
|
|
||||||
"I": function(cm) {delTillMark(cm,"I");},
|
|
||||||
"Shift-I": function(cm) {delTillMark(cm,"Shift-I");},
|
|
||||||
"J": function(cm) {delTillMark(cm,"J");},
|
|
||||||
"Shift-J": function(cm) {delTillMark(cm,"Shift-J");},
|
|
||||||
"K": function(cm) {delTillMark(cm,"K");},
|
|
||||||
"Shift-K": function(cm) {delTillMark(cm,"Shift-K");},
|
|
||||||
"L": function(cm) {delTillMark(cm,"L");},
|
|
||||||
"Shift-L": function(cm) {delTillMark(cm,"Shift-L");},
|
|
||||||
"M": function(cm) {delTillMark(cm,"M");},
|
|
||||||
"Shift-M": function(cm) {delTillMark(cm,"Shift-M");},
|
|
||||||
"N": function(cm) {delTillMark(cm,"N");},
|
|
||||||
"Shift-N": function(cm) {delTillMark(cm,"Shift-N");},
|
|
||||||
"O": function(cm) {delTillMark(cm,"O");},
|
|
||||||
"Shift-O": function(cm) {delTillMark(cm,"Shift-O");},
|
|
||||||
"P": function(cm) {delTillMark(cm,"P");},
|
|
||||||
"Shift-P": function(cm) {delTillMark(cm,"Shift-P");},
|
|
||||||
"Q": function(cm) {delTillMark(cm,"Q");},
|
|
||||||
"Shift-Q": function(cm) {delTillMark(cm,"Shift-Q");},
|
|
||||||
"R": function(cm) {delTillMark(cm,"R");},
|
|
||||||
"Shift-R": function(cm) {delTillMark(cm,"Shift-R");},
|
|
||||||
"S": function(cm) {delTillMark(cm,"S");},
|
|
||||||
"Shift-S": function(cm) {delTillMark(cm,"Shift-S");},
|
|
||||||
"T": function(cm) {delTillMark(cm,"T");},
|
|
||||||
"Shift-T": function(cm) {delTillMark(cm,"Shift-T");},
|
|
||||||
"U": function(cm) {delTillMark(cm,"U");},
|
|
||||||
"Shift-U": function(cm) {delTillMark(cm,"Shift-U");},
|
|
||||||
"V": function(cm) {delTillMark(cm,"V");},
|
|
||||||
"Shift-V": function(cm) {delTillMark(cm,"Shift-V");},
|
|
||||||
"W": function(cm) {delTillMark(cm,"W");},
|
|
||||||
"Shift-W": function(cm) {delTillMark(cm,"Shift-W");},
|
|
||||||
"X": function(cm) {delTillMark(cm,"X");},
|
|
||||||
"Shift-X": function(cm) {delTillMark(cm,"Shift-X");},
|
|
||||||
"Y": function(cm) {delTillMark(cm,"Y");},
|
|
||||||
"Shift-Y": function(cm) {delTillMark(cm,"Shift-Y");},
|
|
||||||
"Z": function(cm) {delTillMark(cm,"Z");},
|
|
||||||
"Shift-Z": function(cm) {delTillMark(cm,"Shift-Z");},
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-y'"] = {
|
|
||||||
"A": function(cm) {yankTillMark(cm,"A");},
|
|
||||||
"Shift-A": function(cm) {yankTillMark(cm,"Shift-A");},
|
|
||||||
"B": function(cm) {yankTillMark(cm,"B");},
|
|
||||||
"Shift-B": function(cm) {yankTillMark(cm,"Shift-B");},
|
|
||||||
"C": function(cm) {yankTillMark(cm,"C");},
|
|
||||||
"Shift-C": function(cm) {yankTillMark(cm,"Shift-C");},
|
|
||||||
"D": function(cm) {yankTillMark(cm,"D");},
|
|
||||||
"Shift-D": function(cm) {yankTillMark(cm,"Shift-D");},
|
|
||||||
"E": function(cm) {yankTillMark(cm,"E");},
|
|
||||||
"Shift-E": function(cm) {yankTillMark(cm,"Shift-E");},
|
|
||||||
"F": function(cm) {yankTillMark(cm,"F");},
|
|
||||||
"Shift-F": function(cm) {yankTillMark(cm,"Shift-F");},
|
|
||||||
"G": function(cm) {yankTillMark(cm,"G");},
|
|
||||||
"Shift-G": function(cm) {yankTillMark(cm,"Shift-G");},
|
|
||||||
"H": function(cm) {yankTillMark(cm,"H");},
|
|
||||||
"Shift-H": function(cm) {yankTillMark(cm,"Shift-H");},
|
|
||||||
"I": function(cm) {yankTillMark(cm,"I");},
|
|
||||||
"Shift-I": function(cm) {yankTillMark(cm,"Shift-I");},
|
|
||||||
"J": function(cm) {yankTillMark(cm,"J");},
|
|
||||||
"Shift-J": function(cm) {yankTillMark(cm,"Shift-J");},
|
|
||||||
"K": function(cm) {yankTillMark(cm,"K");},
|
|
||||||
"Shift-K": function(cm) {yankTillMark(cm,"Shift-K");},
|
|
||||||
"L": function(cm) {yankTillMark(cm,"L");},
|
|
||||||
"Shift-L": function(cm) {yankTillMark(cm,"Shift-L");},
|
|
||||||
"M": function(cm) {yankTillMark(cm,"M");},
|
|
||||||
"Shift-M": function(cm) {yankTillMark(cm,"Shift-M");},
|
|
||||||
"N": function(cm) {yankTillMark(cm,"N");},
|
|
||||||
"Shift-N": function(cm) {yankTillMark(cm,"Shift-N");},
|
|
||||||
"O": function(cm) {yankTillMark(cm,"O");},
|
|
||||||
"Shift-O": function(cm) {yankTillMark(cm,"Shift-O");},
|
|
||||||
"P": function(cm) {yankTillMark(cm,"P");},
|
|
||||||
"Shift-P": function(cm) {yankTillMark(cm,"Shift-P");},
|
|
||||||
"Q": function(cm) {yankTillMark(cm,"Q");},
|
|
||||||
"Shift-Q": function(cm) {yankTillMark(cm,"Shift-Q");},
|
|
||||||
"R": function(cm) {yankTillMark(cm,"R");},
|
|
||||||
"Shift-R": function(cm) {yankTillMark(cm,"Shift-R");},
|
|
||||||
"S": function(cm) {yankTillMark(cm,"S");},
|
|
||||||
"Shift-S": function(cm) {yankTillMark(cm,"Shift-S");},
|
|
||||||
"T": function(cm) {yankTillMark(cm,"T");},
|
|
||||||
"Shift-T": function(cm) {yankTillMark(cm,"Shift-T");},
|
|
||||||
"U": function(cm) {yankTillMark(cm,"U");},
|
|
||||||
"Shift-U": function(cm) {yankTillMark(cm,"Shift-U");},
|
|
||||||
"V": function(cm) {yankTillMark(cm,"V");},
|
|
||||||
"Shift-V": function(cm) {yankTillMark(cm,"Shift-V");},
|
|
||||||
"W": function(cm) {yankTillMark(cm,"W");},
|
|
||||||
"Shift-W": function(cm) {yankTillMark(cm,"Shift-W");},
|
|
||||||
"X": function(cm) {yankTillMark(cm,"X");},
|
|
||||||
"Shift-X": function(cm) {yankTillMark(cm,"Shift-X");},
|
|
||||||
"Y": function(cm) {yankTillMark(cm,"Y");},
|
|
||||||
"Shift-Y": function(cm) {yankTillMark(cm,"Shift-Y");},
|
|
||||||
"Z": function(cm) {yankTillMark(cm,"Z");},
|
|
||||||
"Shift-Z": function(cm) {yankTillMark(cm,"Shift-Z");},
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-prefix-y"] = {
|
|
||||||
"Y": countTimes(function(cm) { pushInBuffer("\n"+cm.getLine(cm.getCursor().line+yank)); yank++; }),
|
|
||||||
"'": function(cm) {cm.setOption("keyMap", "vim-prefix-y'"); emptyBuffer();},
|
|
||||||
auto: "vim",
|
|
||||||
catchall: function(cm) {/*ignore*/}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.keyMap["vim-insert"] = {
|
|
||||||
"Esc": function(cm) {
|
|
||||||
cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1, true);
|
|
||||||
cm.setOption("keyMap", "vim");
|
|
||||||
editCursor("vim");
|
|
||||||
},
|
|
||||||
"Ctrl-N": function(cm) {/* Code to bring up autocomplete hint */},
|
|
||||||
"Ctrl-P": function(cm) {/* Code to bring up autocomplete hint */},
|
|
||||||
fallthrough: ["default"]
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
.CodeMirror {
|
|
||||||
line-height: 1em;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-scroll {
|
|
||||||
overflow: auto;
|
|
||||||
height: 300px;
|
|
||||||
/* This is needed to prevent an IE[67] bug where the scrolled content
|
|
||||||
is visible outside of the scrolling box. */
|
|
||||||
position: relative;
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-gutter {
|
|
||||||
position: absolute; left: 0; top: 0;
|
|
||||||
z-index: 10;
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
border-right: 1px solid #eee;
|
|
||||||
min-width: 2em;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.CodeMirror-gutter-text {
|
|
||||||
color: #aaa;
|
|
||||||
text-align: right;
|
|
||||||
padding: .4em .2em .4em .4em;
|
|
||||||
white-space: pre !important;
|
|
||||||
}
|
|
||||||
.CodeMirror-lines {
|
|
||||||
padding: .4em;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror pre {
|
|
||||||
-moz-border-radius: 0;
|
|
||||||
-webkit-border-radius: 0;
|
|
||||||
-o-border-radius: 0;
|
|
||||||
border-radius: 0;
|
|
||||||
border-width: 0; margin: 0; padding: 0; background: transparent;
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: inherit;
|
|
||||||
padding: 0; margin: 0;
|
|
||||||
white-space: pre;
|
|
||||||
word-wrap: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-wrap pre {
|
|
||||||
word-wrap: break-word;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
.CodeMirror-wrap .CodeMirror-scroll {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror textarea {
|
|
||||||
outline: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror pre.CodeMirror-cursor {
|
|
||||||
z-index: 10;
|
|
||||||
position: absolute;
|
|
||||||
visibility: hidden;
|
|
||||||
border-left: 1px solid black;
|
|
||||||
border-right:none;
|
|
||||||
width:0;
|
|
||||||
}
|
|
||||||
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
|
|
||||||
.CodeMirror-focused pre.CodeMirror-cursor {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.CodeMirror-selected { background: #d9d9d9; }
|
|
||||||
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
|
|
||||||
|
|
||||||
.CodeMirror-searching {
|
|
||||||
background: #ffa;
|
|
||||||
background: rgba(255, 255, 0, .4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default theme */
|
|
||||||
|
|
||||||
.cm-s-default span.cm-keyword {color: #708;}
|
|
||||||
.cm-s-default span.cm-atom {color: #219;}
|
|
||||||
.cm-s-default span.cm-number {color: #164;}
|
|
||||||
.cm-s-default span.cm-def {color: #00f;}
|
|
||||||
.cm-s-default span.cm-variable {color: black;}
|
|
||||||
.cm-s-default span.cm-variable-2 {color: #05a;}
|
|
||||||
.cm-s-default span.cm-variable-3 {color: #085;}
|
|
||||||
.cm-s-default span.cm-property {color: black;}
|
|
||||||
.cm-s-default span.cm-operator {color: black;}
|
|
||||||
.cm-s-default span.cm-comment {color: #a50;}
|
|
||||||
.cm-s-default span.cm-string {color: #a11;}
|
|
||||||
.cm-s-default span.cm-string-2 {color: #f50;}
|
|
||||||
.cm-s-default span.cm-meta {color: #555;}
|
|
||||||
.cm-s-default span.cm-error {color: #f00;}
|
|
||||||
.cm-s-default span.cm-qualifier {color: #555;}
|
|
||||||
.cm-s-default span.cm-builtin {color: #30a;}
|
|
||||||
.cm-s-default span.cm-bracket {color: #cc7;}
|
|
||||||
.cm-s-default span.cm-tag {color: #170;}
|
|
||||||
.cm-s-default span.cm-attribute {color: #00c;}
|
|
||||||
.cm-s-default span.cm-header {color: #a0a;}
|
|
||||||
.cm-s-default span.cm-quote {color: #090;}
|
|
||||||
.cm-s-default span.cm-hr {color: #999;}
|
|
||||||
.cm-s-default span.cm-link {color: #00c;}
|
|
||||||
|
|
||||||
span.cm-header, span.cm-strong {font-weight: bold;}
|
|
||||||
span.cm-em {font-style: italic;}
|
|
||||||
span.cm-emstrong {font-style: italic; font-weight: bold;}
|
|
||||||
span.cm-link {text-decoration: underline;}
|
|
||||||
|
|
||||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
|
||||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
/**
|
|
||||||
* Tag-closer extension for CodeMirror.
|
|
||||||
*
|
|
||||||
* This extension adds a "closeTag" utility function that can be used with key bindings to
|
|
||||||
* insert a matching end tag after the ">" character of a start tag has been typed. It can
|
|
||||||
* also complete "</" if a matching start tag is found. It will correctly ignore signal
|
|
||||||
* characters for empty tags, comments, CDATA, etc.
|
|
||||||
*
|
|
||||||
* The function depends on internal parser state to identify tags. It is compatible with the
|
|
||||||
* following CodeMirror modes and will ignore all others:
|
|
||||||
* - htmlmixed
|
|
||||||
* - xml
|
|
||||||
* - xmlpure
|
|
||||||
*
|
|
||||||
* See demos/closetag.html for a usage example.
|
|
||||||
*
|
|
||||||
* @author Nathan Williams <nathan@nlwillia.net>
|
|
||||||
* Contributed under the same license terms as CodeMirror.
|
|
||||||
*/
|
|
||||||
(function() {
|
|
||||||
/** Option that allows tag closing behavior to be toggled. Default is true. */
|
|
||||||
CodeMirror.defaults['closeTagEnabled'] = true;
|
|
||||||
|
|
||||||
/** Array of tag names to add indentation after the start tag for. Default is the list of block-level html tags. */
|
|
||||||
CodeMirror.defaults['closeTagIndent'] = ['applet', 'blockquote', 'body', 'button', 'div', 'dl', 'fieldset', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'iframe', 'layer', 'legend', 'object', 'ol', 'p', 'select', 'table', 'ul'];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call during key processing to close tags. Handles the key event if the tag is closed, otherwise throws CodeMirror.Pass.
|
|
||||||
* - cm: The editor instance.
|
|
||||||
* - ch: The character being processed.
|
|
||||||
* - indent: Optional. Omit or pass true to use the default indentation tag list defined in the 'closeTagIndent' option.
|
|
||||||
* Pass false to disable indentation. Pass an array to override the default list of tag names.
|
|
||||||
*/
|
|
||||||
CodeMirror.defineExtension("closeTag", function(cm, ch, indent) {
|
|
||||||
if (!cm.getOption('closeTagEnabled')) {
|
|
||||||
throw CodeMirror.Pass;
|
|
||||||
}
|
|
||||||
|
|
||||||
var mode = cm.getOption('mode');
|
|
||||||
|
|
||||||
if (mode == 'text/html') {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Relevant structure of token:
|
|
||||||
*
|
|
||||||
* htmlmixed
|
|
||||||
* className
|
|
||||||
* state
|
|
||||||
* htmlState
|
|
||||||
* type
|
|
||||||
* context
|
|
||||||
* tagName
|
|
||||||
* mode
|
|
||||||
*
|
|
||||||
* xml
|
|
||||||
* className
|
|
||||||
* state
|
|
||||||
* tagName
|
|
||||||
* type
|
|
||||||
*/
|
|
||||||
|
|
||||||
var pos = cm.getCursor();
|
|
||||||
var tok = cm.getTokenAt(pos);
|
|
||||||
var state = tok.state;
|
|
||||||
|
|
||||||
if (state.mode && state.mode != 'html') {
|
|
||||||
throw CodeMirror.Pass; // With htmlmixed, we only care about the html sub-mode.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch == '>') {
|
|
||||||
var type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
|
||||||
|
|
||||||
if (tok.className == 'tag' && type == 'closeTag') {
|
|
||||||
throw CodeMirror.Pass; // Don't process the '>' at the end of an end-tag.
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.replaceSelection('>'); // Mode state won't update until we finish the tag.
|
|
||||||
pos = {line: pos.line, ch: pos.ch + 1};
|
|
||||||
cm.setCursor(pos);
|
|
||||||
|
|
||||||
tok = cm.getTokenAt(cm.getCursor());
|
|
||||||
state = tok.state;
|
|
||||||
type = state.htmlState ? state.htmlState.type : state.type; // htmlmixed : xml
|
|
||||||
|
|
||||||
if (tok.className == 'tag' && type != 'selfcloseTag') {
|
|
||||||
var tagName = state.htmlState ? state.htmlState.context.tagName : state.tagName; // htmlmixed : xml
|
|
||||||
if (tagName.length > 0) {
|
|
||||||
insertEndTag(cm, indent, pos, tagName);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Undo the '>' insert and allow cm to handle the key instead.
|
|
||||||
cm.setSelection({line: pos.line, ch: pos.ch - 1}, pos);
|
|
||||||
cm.replaceSelection("");
|
|
||||||
|
|
||||||
} else if (ch == '/') {
|
|
||||||
if (tok.className == 'tag' && tok.string == '<') {
|
|
||||||
var tagName = state.htmlState ? (state.htmlState.context ? state.htmlState.context.tagName : '') : state.context.tagName; // htmlmixed : xml # extra htmlmized check is for '</' edge case
|
|
||||||
if (tagName.length > 0) {
|
|
||||||
completeEndTag(cm, pos, tagName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (mode == 'xmlpure') {
|
|
||||||
|
|
||||||
var pos = cm.getCursor();
|
|
||||||
var tok = cm.getTokenAt(pos);
|
|
||||||
var tagName = tok.state.context.tagName;
|
|
||||||
|
|
||||||
if (ch == '>') {
|
|
||||||
// <foo> tagName=foo, string=foo
|
|
||||||
// <foo /> tagName=foo, string=/ # ignore
|
|
||||||
// <foo></foo> tagName=foo, string=/foo # ignore
|
|
||||||
if (tok.string == tagName) {
|
|
||||||
cm.replaceSelection('>'); // parity w/html modes
|
|
||||||
pos = {line: pos.line, ch: pos.ch + 1};
|
|
||||||
cm.setCursor(pos);
|
|
||||||
|
|
||||||
insertEndTag(cm, indent, pos, tagName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (ch == '/') {
|
|
||||||
// <foo / tagName=foo, string= # ignore
|
|
||||||
// <foo></ tagName=foo, string=<
|
|
||||||
if (tok.string == '<') {
|
|
||||||
completeEndTag(cm, pos, tagName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw CodeMirror.Pass; // Bubble if not handled
|
|
||||||
});
|
|
||||||
|
|
||||||
function insertEndTag(cm, indent, pos, tagName) {
|
|
||||||
if (shouldIndent(cm, indent, tagName)) {
|
|
||||||
cm.replaceSelection('\n\n</' + tagName + '>', 'end');
|
|
||||||
cm.indentLine(pos.line + 1);
|
|
||||||
cm.indentLine(pos.line + 2);
|
|
||||||
cm.setCursor({line: pos.line + 1, ch: cm.getLine(pos.line + 1).length});
|
|
||||||
} else {
|
|
||||||
cm.replaceSelection('</' + tagName + '>');
|
|
||||||
cm.setCursor(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function shouldIndent(cm, indent, tagName) {
|
|
||||||
if (typeof indent == 'undefined' || indent == null || indent == true) {
|
|
||||||
indent = cm.getOption('closeTagIndent');
|
|
||||||
}
|
|
||||||
if (!indent) {
|
|
||||||
indent = [];
|
|
||||||
}
|
|
||||||
return indexOf(indent, tagName.toLowerCase()) != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// C&P from codemirror.js...would be nice if this were visible to utilities.
|
|
||||||
function indexOf(collection, elt) {
|
|
||||||
if (collection.indexOf) return collection.indexOf(elt);
|
|
||||||
for (var i = 0, e = collection.length; i < e; ++i)
|
|
||||||
if (collection[i] == elt) return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function completeEndTag(cm, pos, tagName) {
|
|
||||||
cm.replaceSelection('/' + tagName + '>');
|
|
||||||
cm.setCursor({line: pos.line, ch: pos.ch + tagName.length + 2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
})();
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
.CodeMirror-dialog {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-dialog > div {
|
|
||||||
position: absolute;
|
|
||||||
top: 0; left: 0; right: 0;
|
|
||||||
background: white;
|
|
||||||
border-bottom: 1px solid #eee;
|
|
||||||
z-index: 15;
|
|
||||||
padding: .1em .8em;
|
|
||||||
overflow: hidden;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-dialog input {
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
background: transparent;
|
|
||||||
width: 20em;
|
|
||||||
color: inherit;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
function dialogDiv(cm, template) {
|
|
||||||
var wrap = cm.getWrapperElement();
|
|
||||||
var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild);
|
|
||||||
dialog.className = "CodeMirror-dialog";
|
|
||||||
dialog.innerHTML = '<div>' + template + '</div>';
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.defineExtension("openDialog", function(template, callback) {
|
|
||||||
var dialog = dialogDiv(this, template);
|
|
||||||
var closed = false, me = this;
|
|
||||||
function close() {
|
|
||||||
if (closed) return;
|
|
||||||
closed = true;
|
|
||||||
dialog.parentNode.removeChild(dialog);
|
|
||||||
}
|
|
||||||
var inp = dialog.getElementsByTagName("input")[0];
|
|
||||||
if (inp) {
|
|
||||||
CodeMirror.connect(inp, "keydown", function(e) {
|
|
||||||
if (e.keyCode == 13 || e.keyCode == 27) {
|
|
||||||
CodeMirror.e_stop(e);
|
|
||||||
close();
|
|
||||||
me.focus();
|
|
||||||
if (e.keyCode == 13) callback(inp.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
inp.focus();
|
|
||||||
CodeMirror.connect(inp, "blur", close);
|
|
||||||
}
|
|
||||||
return close;
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineExtension("openConfirm", function(template, callbacks) {
|
|
||||||
var dialog = dialogDiv(this, template);
|
|
||||||
var buttons = dialog.getElementsByTagName("button");
|
|
||||||
var closed = false, me = this, blurring = 1;
|
|
||||||
function close() {
|
|
||||||
if (closed) return;
|
|
||||||
closed = true;
|
|
||||||
dialog.parentNode.removeChild(dialog);
|
|
||||||
me.focus();
|
|
||||||
}
|
|
||||||
buttons[0].focus();
|
|
||||||
for (var i = 0; i < buttons.length; ++i) {
|
|
||||||
var b = buttons[i];
|
|
||||||
(function(callback) {
|
|
||||||
CodeMirror.connect(b, "click", function(e) {
|
|
||||||
CodeMirror.e_preventDefault(e);
|
|
||||||
close();
|
|
||||||
if (callback) callback(me);
|
|
||||||
});
|
|
||||||
})(callbacks[i]);
|
|
||||||
CodeMirror.connect(b, "blur", function() {
|
|
||||||
--blurring;
|
|
||||||
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
|
||||||
});
|
|
||||||
CodeMirror.connect(b, "focus", function() { ++blurring; });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
// the tagRangeFinder function is
|
|
||||||
// Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org>
|
|
||||||
// released under the MIT license (../../LICENSE) like the rest of CodeMirror
|
|
||||||
CodeMirror.tagRangeFinder = function(cm, line) {
|
|
||||||
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
||||||
var nameChar = nameStartChar + "\-\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
||||||
var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*");
|
|
||||||
|
|
||||||
var lineText = cm.getLine(line);
|
|
||||||
var found = false;
|
|
||||||
var tag = null;
|
|
||||||
var pos = 0;
|
|
||||||
while (!found) {
|
|
||||||
pos = lineText.indexOf("<", pos);
|
|
||||||
if (-1 == pos) // no tag on line
|
|
||||||
return;
|
|
||||||
if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag
|
|
||||||
pos++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// ok we weem to have a start tag
|
|
||||||
if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name...
|
|
||||||
pos++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
var gtPos = lineText.indexOf(">", pos + 1);
|
|
||||||
if (-1 == gtPos) { // end of start tag not in line
|
|
||||||
var l = line + 1;
|
|
||||||
var foundGt = false;
|
|
||||||
var lastLine = cm.lineCount();
|
|
||||||
while (l < lastLine && !foundGt) {
|
|
||||||
var lt = cm.getLine(l);
|
|
||||||
var gt = lt.indexOf(">");
|
|
||||||
if (-1 != gt) { // found a >
|
|
||||||
foundGt = true;
|
|
||||||
var slash = lt.lastIndexOf("/", gt);
|
|
||||||
if (-1 != slash && slash < gt) {
|
|
||||||
var str = lineText.substr(slash, gt - slash + 1);
|
|
||||||
if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l++;
|
|
||||||
}
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var slashPos = lineText.lastIndexOf("/", gtPos);
|
|
||||||
if (-1 == slashPos) { // cannot be empty tag
|
|
||||||
found = true;
|
|
||||||
// don't continue
|
|
||||||
}
|
|
||||||
else { // empty tag?
|
|
||||||
// check if really empty tag
|
|
||||||
var str = lineText.substr(slashPos, gtPos - slashPos + 1);
|
|
||||||
if (!str.match( /\/\s*\>/ )) { // finally not empty
|
|
||||||
found = true;
|
|
||||||
// don't continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
var subLine = lineText.substr(pos + 1);
|
|
||||||
tag = subLine.match(xmlNAMERegExp);
|
|
||||||
if (tag) {
|
|
||||||
// we have an element name, wooohooo !
|
|
||||||
tag = tag[0];
|
|
||||||
// do we have the close tag on same line ???
|
|
||||||
if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep
|
|
||||||
{
|
|
||||||
found = false;
|
|
||||||
}
|
|
||||||
// we don't, so we have a candidate...
|
|
||||||
}
|
|
||||||
else
|
|
||||||
found = false;
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found) {
|
|
||||||
var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)";
|
|
||||||
var startTagRegExp = new RegExp(startTag, "g");
|
|
||||||
var endTag = "</" + tag + ">";
|
|
||||||
var depth = 1;
|
|
||||||
var l = line + 1;
|
|
||||||
var lastLine = cm.lineCount();
|
|
||||||
while (l < lastLine) {
|
|
||||||
lineText = cm.getLine(l);
|
|
||||||
var match = lineText.match(startTagRegExp);
|
|
||||||
if (match) {
|
|
||||||
for (var i = 0; i < match.length; i++) {
|
|
||||||
if (match[i] == endTag)
|
|
||||||
depth--;
|
|
||||||
else
|
|
||||||
depth++;
|
|
||||||
if (!depth)
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
l++;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.braceRangeFinder = function(cm, line) {
|
|
||||||
var lineText = cm.getLine(line);
|
|
||||||
var startChar = lineText.lastIndexOf("{");
|
|
||||||
if (startChar < 0 || lineText.lastIndexOf("}") > startChar) return;
|
|
||||||
var tokenType = cm.getTokenAt({line: line, ch: startChar}).className;
|
|
||||||
var count = 1, lastLine = cm.lineCount(), end;
|
|
||||||
outer: for (var i = line + 1; i < lastLine; ++i) {
|
|
||||||
var text = cm.getLine(i), pos = 0;
|
|
||||||
for (;;) {
|
|
||||||
var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos);
|
|
||||||
if (nextOpen < 0) nextOpen = text.length;
|
|
||||||
if (nextClose < 0) nextClose = text.length;
|
|
||||||
pos = Math.min(nextOpen, nextClose);
|
|
||||||
if (pos == text.length) break;
|
|
||||||
if (cm.getTokenAt({line: i, ch: pos + 1}).className == tokenType) {
|
|
||||||
if (pos == nextOpen) ++count;
|
|
||||||
else if (!--count) { end = i; break outer; }
|
|
||||||
}
|
|
||||||
++pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (end == null || end == line + 1) return;
|
|
||||||
return end;
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.indentRangeFinder = function(cm, line) {
|
|
||||||
var tabSize = cm.getOption("tabSize");
|
|
||||||
var myIndent = cm.getLineHandle(line).indentation(tabSize), last;
|
|
||||||
for (var i = line + 1, end = cm.lineCount(); i < end; ++i) {
|
|
||||||
var handle = cm.getLineHandle(i);
|
|
||||||
if (!/^\s*$/.test(handle.text)) {
|
|
||||||
if (handle.indentation(tabSize) <= myIndent) break;
|
|
||||||
last = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!last) return null;
|
|
||||||
return last + 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.newFoldFunction = function(rangeFinder, markText, hideEnd) {
|
|
||||||
var folded = [];
|
|
||||||
if (markText == null) markText = '<div style="position: absolute; left: 2px; color:#600">▼</div>%N%';
|
|
||||||
|
|
||||||
function isFolded(cm, n) {
|
|
||||||
for (var i = 0; i < folded.length; ++i) {
|
|
||||||
var start = cm.lineInfo(folded[i].start);
|
|
||||||
if (!start) folded.splice(i--, 1);
|
|
||||||
else if (start.line == n) return {pos: i, region: folded[i]};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function expand(cm, region) {
|
|
||||||
cm.clearMarker(region.start);
|
|
||||||
for (var i = 0; i < region.hidden.length; ++i)
|
|
||||||
cm.showLine(region.hidden[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return function(cm, line) {
|
|
||||||
cm.operation(function() {
|
|
||||||
var known = isFolded(cm, line);
|
|
||||||
if (known) {
|
|
||||||
folded.splice(known.pos, 1);
|
|
||||||
expand(cm, known.region);
|
|
||||||
} else {
|
|
||||||
var end = rangeFinder(cm, line);
|
|
||||||
if (rangeFinder !== CodeMirror.indentRangeFinder && hideEnd === true) end++;
|
|
||||||
console.log(rangeFinder !== CodeMirror.indentRangeFinder);
|
|
||||||
if (end == null) return;
|
|
||||||
var hidden = [];
|
|
||||||
for (var i = line + 1; i < end; ++i) {
|
|
||||||
var handle = cm.hideLine(i);
|
|
||||||
if (handle) hidden.push(handle);
|
|
||||||
}
|
|
||||||
var first = cm.setMarker(line, markText);
|
|
||||||
var region = {start: first, hidden: hidden};
|
|
||||||
cm.onDeleteLine(first, function() { expand(cm, region); });
|
|
||||||
folded.push(region);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,294 +0,0 @@
|
|||||||
// ============== Formatting extensions ============================
|
|
||||||
// A common storage for all mode-specific formatting features
|
|
||||||
if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {};
|
|
||||||
|
|
||||||
// Returns the extension of the editor's current mode
|
|
||||||
CodeMirror.defineExtension("getModeExt", function () {
|
|
||||||
var mname = CodeMirror.resolveMode(this.getOption("mode")).name;
|
|
||||||
var ext = CodeMirror.modeExtensions[mname];
|
|
||||||
if (!ext) throw new Error("No extensions found for mode " + mname);
|
|
||||||
return ext;
|
|
||||||
});
|
|
||||||
|
|
||||||
// If the current mode is 'htmlmixed', returns the extension of a mode located at
|
|
||||||
// the specified position (can be htmlmixed, css or javascript). Otherwise, simply
|
|
||||||
// returns the extension of the editor's current mode.
|
|
||||||
CodeMirror.defineExtension("getModeExtAtPos", function (pos) {
|
|
||||||
var token = this.getTokenAt(pos);
|
|
||||||
if (token && token.state && token.state.mode)
|
|
||||||
return CodeMirror.modeExtensions[token.state.mode == "html" ? "htmlmixed" : token.state.mode];
|
|
||||||
else
|
|
||||||
return this.getModeExt();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Comment/uncomment the specified range
|
|
||||||
CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
|
|
||||||
var curMode = this.getModeExtAtPos(this.getCursor());
|
|
||||||
if (isComment) { // Comment range
|
|
||||||
var commentedText = this.getRange(from, to);
|
|
||||||
this.replaceRange(curMode.commentStart + this.getRange(from, to) + curMode.commentEnd
|
|
||||||
, from, to);
|
|
||||||
if (from.line == to.line && from.ch == to.ch) { // An empty comment inserted - put cursor inside
|
|
||||||
this.setCursor(from.line, from.ch + curMode.commentStart.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // Uncomment range
|
|
||||||
var selText = this.getRange(from, to);
|
|
||||||
var startIndex = selText.indexOf(curMode.commentStart);
|
|
||||||
var endIndex = selText.lastIndexOf(curMode.commentEnd);
|
|
||||||
if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
|
|
||||||
// Take string till comment start
|
|
||||||
selText = selText.substr(0, startIndex)
|
|
||||||
// From comment start till comment end
|
|
||||||
+ selText.substring(startIndex + curMode.commentStart.length, endIndex)
|
|
||||||
// From comment end till string end
|
|
||||||
+ selText.substr(endIndex + curMode.commentEnd.length);
|
|
||||||
}
|
|
||||||
this.replaceRange(selText, from, to);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Applies automatic mode-aware indentation to the specified range
|
|
||||||
CodeMirror.defineExtension("autoIndentRange", function (from, to) {
|
|
||||||
var cmInstance = this;
|
|
||||||
this.operation(function () {
|
|
||||||
for (var i = from.line; i <= to.line; i++) {
|
|
||||||
cmInstance.indentLine(i, "smart");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Applies automatic formatting to the specified range
|
|
||||||
CodeMirror.defineExtension("autoFormatRange", function (from, to) {
|
|
||||||
var absStart = this.indexFromPos(from);
|
|
||||||
var absEnd = this.indexFromPos(to);
|
|
||||||
// Insert additional line breaks where necessary according to the
|
|
||||||
// mode's syntax
|
|
||||||
var res = this.getModeExt().autoFormatLineBreaks(this.getValue(), absStart, absEnd);
|
|
||||||
var cmInstance = this;
|
|
||||||
|
|
||||||
// Replace and auto-indent the range
|
|
||||||
this.operation(function () {
|
|
||||||
cmInstance.replaceRange(res, from, to);
|
|
||||||
var startLine = cmInstance.posFromIndex(absStart).line;
|
|
||||||
var endLine = cmInstance.posFromIndex(absStart + res.length).line;
|
|
||||||
for (var i = startLine; i <= endLine; i++) {
|
|
||||||
cmInstance.indentLine(i, "smart");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Define extensions for a few modes
|
|
||||||
|
|
||||||
CodeMirror.modeExtensions["css"] = {
|
|
||||||
commentStart: "/*",
|
|
||||||
commentEnd: "*/",
|
|
||||||
wordWrapChars: [";", "\\{", "\\}"],
|
|
||||||
autoFormatLineBreaks: function (text) {
|
|
||||||
return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.modeExtensions["javascript"] = {
|
|
||||||
commentStart: "/*",
|
|
||||||
commentEnd: "*/",
|
|
||||||
wordWrapChars: [";", "\\{", "\\}"],
|
|
||||||
|
|
||||||
getNonBreakableBlocks: function (text) {
|
|
||||||
var nonBreakableRegexes = [
|
|
||||||
new RegExp("for\\s*?\\(([\\s\\S]*?)\\)"),
|
|
||||||
new RegExp("'([\\s\\S]*?)('|$)"),
|
|
||||||
new RegExp("\"([\\s\\S]*?)(\"|$)"),
|
|
||||||
new RegExp("//.*([\r\n]|$)")
|
|
||||||
];
|
|
||||||
var nonBreakableBlocks = new Array();
|
|
||||||
for (var i = 0; i < nonBreakableRegexes.length; i++) {
|
|
||||||
var curPos = 0;
|
|
||||||
while (curPos < text.length) {
|
|
||||||
var m = text.substr(curPos).match(nonBreakableRegexes[i]);
|
|
||||||
if (m != null) {
|
|
||||||
nonBreakableBlocks.push({
|
|
||||||
start: curPos + m.index,
|
|
||||||
end: curPos + m.index + m[0].length
|
|
||||||
});
|
|
||||||
curPos += m.index + Math.max(1, m[0].length);
|
|
||||||
}
|
|
||||||
else { // No more matches
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nonBreakableBlocks.sort(function (a, b) {
|
|
||||||
return a.start - b.start;
|
|
||||||
});
|
|
||||||
|
|
||||||
return nonBreakableBlocks;
|
|
||||||
},
|
|
||||||
|
|
||||||
autoFormatLineBreaks: function (text) {
|
|
||||||
var curPos = 0;
|
|
||||||
var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g");
|
|
||||||
var nonBreakableBlocks = this.getNonBreakableBlocks(text);
|
|
||||||
if (nonBreakableBlocks != null) {
|
|
||||||
var res = "";
|
|
||||||
for (var i = 0; i < nonBreakableBlocks.length; i++) {
|
|
||||||
if (nonBreakableBlocks[i].start > curPos) { // Break lines till the block
|
|
||||||
res += text.substring(curPos, nonBreakableBlocks[i].start).replace(reLinesSplitter, "$1\n$2");
|
|
||||||
curPos = nonBreakableBlocks[i].start;
|
|
||||||
}
|
|
||||||
if (nonBreakableBlocks[i].start <= curPos
|
|
||||||
&& nonBreakableBlocks[i].end >= curPos) { // Skip non-breakable block
|
|
||||||
res += text.substring(curPos, nonBreakableBlocks[i].end);
|
|
||||||
curPos = nonBreakableBlocks[i].end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (curPos < text.length - 1) {
|
|
||||||
res += text.substr(curPos).replace(reLinesSplitter, "$1\n$2");
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return text.replace(reLinesSplitter, "$1\n$2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.modeExtensions["xml"] = {
|
|
||||||
commentStart: "<!--",
|
|
||||||
commentEnd: "-->",
|
|
||||||
wordWrapChars: [">"],
|
|
||||||
|
|
||||||
autoFormatLineBreaks: function (text) {
|
|
||||||
var lines = text.split("\n");
|
|
||||||
var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
|
|
||||||
var reOpenBrackets = new RegExp("<", "g");
|
|
||||||
var reCloseBrackets = new RegExp("(>)([^\r\n])", "g");
|
|
||||||
for (var i = 0; i < lines.length; i++) {
|
|
||||||
var mToProcess = lines[i].match(reProcessedPortion);
|
|
||||||
if (mToProcess != null && mToProcess.length > 3) { // The line starts with whitespaces and ends with whitespaces
|
|
||||||
lines[i] = mToProcess[1]
|
|
||||||
+ mToProcess[2].replace(reOpenBrackets, "\n$&").replace(reCloseBrackets, "$1\n$2")
|
|
||||||
+ mToProcess[3];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lines.join("\n");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.modeExtensions["htmlmixed"] = {
|
|
||||||
commentStart: "<!--",
|
|
||||||
commentEnd: "-->",
|
|
||||||
wordWrapChars: [">", ";", "\\{", "\\}"],
|
|
||||||
|
|
||||||
getModeInfos: function (text, absPos) {
|
|
||||||
var modeInfos = new Array();
|
|
||||||
modeInfos[0] =
|
|
||||||
{
|
|
||||||
pos: 0,
|
|
||||||
modeExt: CodeMirror.modeExtensions["xml"],
|
|
||||||
modeName: "xml"
|
|
||||||
};
|
|
||||||
|
|
||||||
var modeMatchers = new Array();
|
|
||||||
modeMatchers[0] =
|
|
||||||
{
|
|
||||||
regex: new RegExp("<style[^>]*>([\\s\\S]*?)(</style[^>]*>|$)", "i"),
|
|
||||||
modeExt: CodeMirror.modeExtensions["css"],
|
|
||||||
modeName: "css"
|
|
||||||
};
|
|
||||||
modeMatchers[1] =
|
|
||||||
{
|
|
||||||
regex: new RegExp("<script[^>]*>([\\s\\S]*?)(</script[^>]*>|$)", "i"),
|
|
||||||
modeExt: CodeMirror.modeExtensions["javascript"],
|
|
||||||
modeName: "javascript"
|
|
||||||
};
|
|
||||||
|
|
||||||
var lastCharPos = (typeof (absPos) !== "undefined" ? absPos : text.length - 1);
|
|
||||||
// Detect modes for the entire text
|
|
||||||
for (var i = 0; i < modeMatchers.length; i++) {
|
|
||||||
var curPos = 0;
|
|
||||||
while (curPos <= lastCharPos) {
|
|
||||||
var m = text.substr(curPos).match(modeMatchers[i].regex);
|
|
||||||
if (m != null) {
|
|
||||||
if (m.length > 1 && m[1].length > 0) {
|
|
||||||
// Push block begin pos
|
|
||||||
var blockBegin = curPos + m.index + m[0].indexOf(m[1]);
|
|
||||||
modeInfos.push(
|
|
||||||
{
|
|
||||||
pos: blockBegin,
|
|
||||||
modeExt: modeMatchers[i].modeExt,
|
|
||||||
modeName: modeMatchers[i].modeName
|
|
||||||
});
|
|
||||||
// Push block end pos
|
|
||||||
modeInfos.push(
|
|
||||||
{
|
|
||||||
pos: blockBegin + m[1].length,
|
|
||||||
modeExt: modeInfos[0].modeExt,
|
|
||||||
modeName: modeInfos[0].modeName
|
|
||||||
});
|
|
||||||
curPos += m.index + m[0].length;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
curPos += m.index + Math.max(m[0].length, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // No more matches
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Sort mode infos
|
|
||||||
modeInfos.sort(function sortModeInfo(a, b) {
|
|
||||||
return a.pos - b.pos;
|
|
||||||
});
|
|
||||||
|
|
||||||
return modeInfos;
|
|
||||||
},
|
|
||||||
|
|
||||||
autoFormatLineBreaks: function (text, startPos, endPos) {
|
|
||||||
var modeInfos = this.getModeInfos(text);
|
|
||||||
var reBlockStartsWithNewline = new RegExp("^\\s*?\n");
|
|
||||||
var reBlockEndsWithNewline = new RegExp("\n\\s*?$");
|
|
||||||
var res = "";
|
|
||||||
// Use modes info to break lines correspondingly
|
|
||||||
if (modeInfos.length > 1) { // Deal with multi-mode text
|
|
||||||
for (var i = 1; i <= modeInfos.length; i++) {
|
|
||||||
var selStart = modeInfos[i - 1].pos;
|
|
||||||
var selEnd = (i < modeInfos.length ? modeInfos[i].pos : endPos);
|
|
||||||
|
|
||||||
if (selStart >= endPos) { // The block starts later than the needed fragment
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (selStart < startPos) {
|
|
||||||
if (selEnd <= startPos) { // The block starts earlier than the needed fragment
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
selStart = startPos;
|
|
||||||
}
|
|
||||||
if (selEnd > endPos) {
|
|
||||||
selEnd = endPos;
|
|
||||||
}
|
|
||||||
var textPortion = text.substring(selStart, selEnd);
|
|
||||||
if (modeInfos[i - 1].modeName != "xml") { // Starting a CSS or JavaScript block
|
|
||||||
if (!reBlockStartsWithNewline.test(textPortion)
|
|
||||||
&& selStart > 0) { // The block does not start with a line break
|
|
||||||
textPortion = "\n" + textPortion;
|
|
||||||
}
|
|
||||||
if (!reBlockEndsWithNewline.test(textPortion)
|
|
||||||
&& selEnd < text.length - 1) { // The block does not end with a line break
|
|
||||||
textPortion += "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
res += modeInfos[i - 1].modeExt.autoFormatLineBreaks(textPortion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // Single-mode text
|
|
||||||
res = modeInfos[0].modeExt.autoFormatLineBreaks(text.substring(startPos, endPos));
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
(function () {
|
|
||||||
function forEach(arr, f) {
|
|
||||||
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function arrayContains(arr, item) {
|
|
||||||
if (!Array.prototype.indexOf) {
|
|
||||||
var i = arr.length;
|
|
||||||
while (i--) {
|
|
||||||
if (arr[i] === item) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return arr.indexOf(item) != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scriptHint(editor, keywords, getToken) {
|
|
||||||
// Find the token at the cursor
|
|
||||||
var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
|
|
||||||
// If it's not a 'word-style' token, ignore the token.
|
|
||||||
if (!/^[\w$_]*$/.test(token.string)) {
|
|
||||||
token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
|
||||||
className: token.string == "." ? "property" : null};
|
|
||||||
}
|
|
||||||
// If it is a property, find out what it is a property of.
|
|
||||||
while (tprop.className == "property") {
|
|
||||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
||||||
if (tprop.string != ".") return;
|
|
||||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
||||||
if (tprop.string == ')') {
|
|
||||||
var level = 1;
|
|
||||||
do {
|
|
||||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
||||||
switch (tprop.string) {
|
|
||||||
case ')': level++; break;
|
|
||||||
case '(': level--; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
} while (level > 0)
|
|
||||||
tprop = getToken(editor, {line: cur.line, ch: tprop.start});
|
|
||||||
if (tprop.className == 'variable')
|
|
||||||
tprop.className = 'function';
|
|
||||||
else return; // no clue
|
|
||||||
}
|
|
||||||
if (!context) var context = [];
|
|
||||||
context.push(tprop);
|
|
||||||
}
|
|
||||||
return {list: getCompletions(token, context, keywords),
|
|
||||||
from: {line: cur.line, ch: token.start},
|
|
||||||
to: {line: cur.line, ch: token.end}};
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.javascriptHint = function(editor) {
|
|
||||||
return scriptHint(editor, javascriptKeywords,
|
|
||||||
function (e, cur) {return e.getTokenAt(cur);});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCoffeeScriptToken(editor, cur) {
|
|
||||||
// This getToken, it is for coffeescript, imitates the behavior of
|
|
||||||
// getTokenAt method in javascript.js, that is, returning "property"
|
|
||||||
// type and treat "." as indepenent token.
|
|
||||||
var token = editor.getTokenAt(cur);
|
|
||||||
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
|
||||||
token.end = token.start;
|
|
||||||
token.string = '.';
|
|
||||||
token.className = "property";
|
|
||||||
}
|
|
||||||
else if (/^\.[\w$_]*$/.test(token.string)) {
|
|
||||||
token.className = "property";
|
|
||||||
token.start++;
|
|
||||||
token.string = token.string.replace(/\./, '');
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.coffeescriptHint = function(editor) {
|
|
||||||
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
|
||||||
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
|
||||||
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
|
||||||
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
|
||||||
var funcProps = "prototype apply call bind".split(" ");
|
|
||||||
var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
|
|
||||||
"if in instanceof new null return switch throw true try typeof var void while with").split(" ");
|
|
||||||
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
|
||||||
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
|
|
||||||
|
|
||||||
function getCompletions(token, context, keywords) {
|
|
||||||
var found = [], start = token.string;
|
|
||||||
function maybeAdd(str) {
|
|
||||||
if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
|
|
||||||
}
|
|
||||||
function gatherCompletions(obj) {
|
|
||||||
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
|
||||||
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
|
||||||
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
|
||||||
for (var name in obj) maybeAdd(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context) {
|
|
||||||
// If this is a property, see if it belongs to some object we can
|
|
||||||
// find in the current environment.
|
|
||||||
var obj = context.pop(), base;
|
|
||||||
if (obj.className == "variable")
|
|
||||||
base = window[obj.string];
|
|
||||||
else if (obj.className == "string")
|
|
||||||
base = "";
|
|
||||||
else if (obj.className == "atom")
|
|
||||||
base = 1;
|
|
||||||
else if (obj.className == "function") {
|
|
||||||
if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
|
||||||
(typeof window.jQuery == 'function'))
|
|
||||||
base = window.jQuery();
|
|
||||||
else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
|
|
||||||
base = window._();
|
|
||||||
}
|
|
||||||
while (base != null && context.length)
|
|
||||||
base = base[context.pop().string];
|
|
||||||
if (base != null) gatherCompletions(base);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// If not, just look in the window object and any local scope
|
|
||||||
// (reading into JS mode internals to get at the local variables)
|
|
||||||
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
|
||||||
gatherCompletions(window);
|
|
||||||
forEach(keywords, maybeAdd);
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
// Define match-highlighter commands. Depends on searchcursor.js
|
|
||||||
// Use by attaching the following function call to the onCursorActivity event:
|
|
||||||
//myCodeMirror.matchHighlight(minChars);
|
|
||||||
// And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var DEFAULT_MIN_CHARS = 2;
|
|
||||||
|
|
||||||
function MatchHighlightState() {
|
|
||||||
this.marked = [];
|
|
||||||
}
|
|
||||||
function getMatchHighlightState(cm) {
|
|
||||||
return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearMarks(cm) {
|
|
||||||
var state = getMatchHighlightState(cm);
|
|
||||||
for (var i = 0; i < state.marked.length; ++i)
|
|
||||||
state.marked[i].clear();
|
|
||||||
state.marked = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function markDocument(cm, className, minChars) {
|
|
||||||
clearMarks(cm);
|
|
||||||
minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
|
|
||||||
if (cm.somethingSelected() && cm.getSelection().length >= minChars) {
|
|
||||||
var state = getMatchHighlightState(cm);
|
|
||||||
var query = cm.getSelection();
|
|
||||||
cm.operation(function() {
|
|
||||||
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
|
|
||||||
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
|
|
||||||
//Only apply matchhighlight to the matches other than the one actually selected
|
|
||||||
if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
|
|
||||||
state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
|
|
||||||
markDocument(this, className, minChars);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
// Utility function that allows modes to be combined. The mode given
|
|
||||||
// as the base argument takes care of most of the normal mode
|
|
||||||
// functionality, but a second (typically simple) mode is used, which
|
|
||||||
// can override the style of text. Both modes get to parse all of the
|
|
||||||
// text, but when both assign a non-null style to a piece of code, the
|
|
||||||
// overlay wins, unless the combine argument was true, in which case
|
|
||||||
// the styles are combined.
|
|
||||||
|
|
||||||
CodeMirror.overlayParser = function(base, overlay, combine) {
|
|
||||||
return {
|
|
||||||
startState: function() {
|
|
||||||
return {
|
|
||||||
base: CodeMirror.startState(base),
|
|
||||||
overlay: CodeMirror.startState(overlay),
|
|
||||||
basePos: 0, baseCur: null,
|
|
||||||
overlayPos: 0, overlayCur: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
copyState: function(state) {
|
|
||||||
return {
|
|
||||||
base: CodeMirror.copyState(base, state.base),
|
|
||||||
overlay: CodeMirror.copyState(overlay, state.overlay),
|
|
||||||
basePos: state.basePos, baseCur: null,
|
|
||||||
overlayPos: state.overlayPos, overlayCur: null
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (stream.start == state.basePos) {
|
|
||||||
state.baseCur = base.token(stream, state.base);
|
|
||||||
state.basePos = stream.pos;
|
|
||||||
}
|
|
||||||
if (stream.start == state.overlayPos) {
|
|
||||||
stream.pos = stream.start;
|
|
||||||
state.overlayCur = overlay.token(stream, state.overlay);
|
|
||||||
state.overlayPos = stream.pos;
|
|
||||||
}
|
|
||||||
stream.pos = Math.min(state.basePos, state.overlayPos);
|
|
||||||
if (stream.eol()) state.basePos = state.overlayPos = 0;
|
|
||||||
|
|
||||||
if (state.overlayCur == null) return state.baseCur;
|
|
||||||
if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur;
|
|
||||||
else return state.overlayCur;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
return base.indent(state.base, textAfter);
|
|
||||||
},
|
|
||||||
electricChars: base.electricChars
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
CodeMirror.runMode = function(string, modespec, callback, options) {
|
|
||||||
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
|
|
||||||
var isNode = callback.nodeType == 1;
|
|
||||||
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
|
|
||||||
if (isNode) {
|
|
||||||
var node = callback, accum = [], col = 0;
|
|
||||||
callback = function(text, style) {
|
|
||||||
if (text == "\n") {
|
|
||||||
accum.push("<br>");
|
|
||||||
col = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var escaped = "";
|
|
||||||
// HTML-escape and replace tabs
|
|
||||||
for (var pos = 0;;) {
|
|
||||||
var idx = text.indexOf("\t", pos);
|
|
||||||
if (idx == -1) {
|
|
||||||
escaped += CodeMirror.htmlEscape(text.slice(pos));
|
|
||||||
col += text.length - pos;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
col += idx - pos;
|
|
||||||
escaped += CodeMirror.htmlEscape(text.slice(pos, idx));
|
|
||||||
var size = tabSize - col % tabSize;
|
|
||||||
col += size;
|
|
||||||
for (var i = 0; i < size; ++i) escaped += " ";
|
|
||||||
pos = idx + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (style)
|
|
||||||
accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + escaped + "</span>");
|
|
||||||
else
|
|
||||||
accum.push(escaped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
|
|
||||||
for (var i = 0, e = lines.length; i < e; ++i) {
|
|
||||||
if (i) callback("\n");
|
|
||||||
var stream = new CodeMirror.StringStream(lines[i]);
|
|
||||||
while (!stream.eol()) {
|
|
||||||
var style = mode.token(stream, state);
|
|
||||||
callback(stream.current(), style, i, stream.start);
|
|
||||||
stream.start = stream.pos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isNode)
|
|
||||||
node.innerHTML = accum.join("");
|
|
||||||
};
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
// Define search commands. Depends on dialog.js or another
|
|
||||||
// implementation of the openDialog method.
|
|
||||||
|
|
||||||
// Replace works a little oddly -- it will do the replace on the next
|
|
||||||
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
|
|
||||||
// replace by making sure the match is no longer selected when hitting
|
|
||||||
// Ctrl-G.
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
function SearchState() {
|
|
||||||
this.posFrom = this.posTo = this.query = null;
|
|
||||||
this.marked = [];
|
|
||||||
}
|
|
||||||
function getSearchState(cm) {
|
|
||||||
return cm._searchState || (cm._searchState = new SearchState());
|
|
||||||
}
|
|
||||||
function dialog(cm, text, shortText, f) {
|
|
||||||
if (cm.openDialog) cm.openDialog(text, f);
|
|
||||||
else f(prompt(shortText, ""));
|
|
||||||
}
|
|
||||||
function confirmDialog(cm, text, shortText, fs) {
|
|
||||||
if (cm.openConfirm) cm.openConfirm(text, fs);
|
|
||||||
else if (confirm(shortText)) fs[0]();
|
|
||||||
}
|
|
||||||
function parseQuery(query) {
|
|
||||||
var isRE = query.match(/^\/(.*)\/$/);
|
|
||||||
return isRE ? new RegExp(isRE[1]) : query;
|
|
||||||
}
|
|
||||||
var queryDialog =
|
|
||||||
'Search: <input type="text" style="width: 10em"> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
|
|
||||||
function doSearch(cm, rev) {
|
|
||||||
var state = getSearchState(cm);
|
|
||||||
if (state.query) return findNext(cm, rev);
|
|
||||||
dialog(cm, queryDialog, "Search for:", function(query) {
|
|
||||||
cm.operation(function() {
|
|
||||||
if (!query || state.query) return;
|
|
||||||
state.query = parseQuery(query);
|
|
||||||
if (cm.lineCount() < 2000) { // This is too expensive on big documents.
|
|
||||||
for (var cursor = cm.getSearchCursor(query); cursor.findNext();)
|
|
||||||
state.marked.push(cm.markText(cursor.from(), cursor.to(), "CodeMirror-searching"));
|
|
||||||
}
|
|
||||||
state.posFrom = state.posTo = cm.getCursor();
|
|
||||||
findNext(cm, rev);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function findNext(cm, rev) {cm.operation(function() {
|
|
||||||
var state = getSearchState(cm);
|
|
||||||
var cursor = cm.getSearchCursor(state.query, rev ? state.posFrom : state.posTo);
|
|
||||||
if (!cursor.find(rev)) {
|
|
||||||
cursor = cm.getSearchCursor(state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0});
|
|
||||||
if (!cursor.find(rev)) return;
|
|
||||||
}
|
|
||||||
cm.setSelection(cursor.from(), cursor.to());
|
|
||||||
state.posFrom = cursor.from(); state.posTo = cursor.to();
|
|
||||||
})}
|
|
||||||
function clearSearch(cm) {cm.operation(function() {
|
|
||||||
var state = getSearchState(cm);
|
|
||||||
if (!state.query) return;
|
|
||||||
state.query = null;
|
|
||||||
for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear();
|
|
||||||
state.marked.length = 0;
|
|
||||||
})}
|
|
||||||
|
|
||||||
var replaceQueryDialog =
|
|
||||||
'Replace: <input type="text" style="width: 10em"> <span style="color: #888">(Use /re/ syntax for regexp search)</span>';
|
|
||||||
var replacementQueryDialog = 'With: <input type="text" style="width: 10em">';
|
|
||||||
var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>";
|
|
||||||
function replace(cm, all) {
|
|
||||||
dialog(cm, replaceQueryDialog, "Replace:", function(query) {
|
|
||||||
if (!query) return;
|
|
||||||
query = parseQuery(query);
|
|
||||||
dialog(cm, replacementQueryDialog, "Replace with:", function(text) {
|
|
||||||
if (all) {
|
|
||||||
cm.operation(function() {
|
|
||||||
for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
|
|
||||||
if (typeof query != "string") {
|
|
||||||
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
|
||||||
cursor.replace(text.replace(/\$(\d)/, function(w, i) {return match[i];}));
|
|
||||||
} else cursor.replace(text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
clearSearch(cm);
|
|
||||||
var cursor = cm.getSearchCursor(query, cm.getCursor());
|
|
||||||
function advance() {
|
|
||||||
var start = cursor.from(), match;
|
|
||||||
if (!(match = cursor.findNext())) {
|
|
||||||
cursor = cm.getSearchCursor(query);
|
|
||||||
if (!(match = cursor.findNext()) ||
|
|
||||||
(cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
|
|
||||||
}
|
|
||||||
cm.setSelection(cursor.from(), cursor.to());
|
|
||||||
confirmDialog(cm, doReplaceConfirm, "Replace?",
|
|
||||||
[function() {doReplace(match);}, advance]);
|
|
||||||
}
|
|
||||||
function doReplace(match) {
|
|
||||||
cursor.replace(typeof query == "string" ? text :
|
|
||||||
text.replace(/\$(\d)/, function(w, i) {return match[i];}));
|
|
||||||
advance();
|
|
||||||
}
|
|
||||||
advance();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
|
|
||||||
CodeMirror.commands.findNext = doSearch;
|
|
||||||
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
|
|
||||||
CodeMirror.commands.clearSearch = clearSearch;
|
|
||||||
CodeMirror.commands.replace = replace;
|
|
||||||
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
|
|
||||||
})();
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
(function(){
|
|
||||||
function SearchCursor(cm, query, pos, caseFold) {
|
|
||||||
this.atOccurrence = false; this.cm = cm;
|
|
||||||
if (caseFold == null) caseFold = typeof query == "string" && query == query.toLowerCase();
|
|
||||||
|
|
||||||
pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0};
|
|
||||||
this.pos = {from: pos, to: pos};
|
|
||||||
|
|
||||||
// The matches method is filled in based on the type of query.
|
|
||||||
// It takes a position and a direction, and returns an object
|
|
||||||
// describing the next occurrence of the query, or null if no
|
|
||||||
// more matches were found.
|
|
||||||
if (typeof query != "string") // Regexp match
|
|
||||||
this.matches = function(reverse, pos) {
|
|
||||||
if (reverse) {
|
|
||||||
var line = cm.getLine(pos.line).slice(0, pos.ch), match = line.match(query), start = 0;
|
|
||||||
while (match) {
|
|
||||||
var ind = line.indexOf(match[0]);
|
|
||||||
start += ind;
|
|
||||||
line = line.slice(ind + 1);
|
|
||||||
var newmatch = line.match(query);
|
|
||||||
if (newmatch) match = newmatch;
|
|
||||||
else break;
|
|
||||||
start++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var line = cm.getLine(pos.line).slice(pos.ch), match = line.match(query),
|
|
||||||
start = match && pos.ch + line.indexOf(match[0]);
|
|
||||||
}
|
|
||||||
if (match)
|
|
||||||
return {from: {line: pos.line, ch: start},
|
|
||||||
to: {line: pos.line, ch: start + match[0].length},
|
|
||||||
match: match};
|
|
||||||
};
|
|
||||||
else { // String query
|
|
||||||
if (caseFold) query = query.toLowerCase();
|
|
||||||
var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
|
|
||||||
var target = query.split("\n");
|
|
||||||
// Different methods for single-line and multi-line queries
|
|
||||||
if (target.length == 1)
|
|
||||||
this.matches = function(reverse, pos) {
|
|
||||||
var line = fold(cm.getLine(pos.line)), len = query.length, match;
|
|
||||||
if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1)
|
|
||||||
: (match = line.indexOf(query, pos.ch)) != -1)
|
|
||||||
return {from: {line: pos.line, ch: match},
|
|
||||||
to: {line: pos.line, ch: match + len}};
|
|
||||||
};
|
|
||||||
else
|
|
||||||
this.matches = function(reverse, pos) {
|
|
||||||
var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln));
|
|
||||||
var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
|
|
||||||
if (reverse ? offsetA >= pos.ch || offsetA != match.length
|
|
||||||
: offsetA <= pos.ch || offsetA != line.length - match.length)
|
|
||||||
return;
|
|
||||||
for (;;) {
|
|
||||||
if (reverse ? !ln : ln == cm.lineCount() - 1) return;
|
|
||||||
line = fold(cm.getLine(ln += reverse ? -1 : 1));
|
|
||||||
match = target[reverse ? --idx : ++idx];
|
|
||||||
if (idx > 0 && idx < target.length - 1) {
|
|
||||||
if (line != match) return;
|
|
||||||
else continue;
|
|
||||||
}
|
|
||||||
var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
|
|
||||||
if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
|
|
||||||
return;
|
|
||||||
var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB};
|
|
||||||
return {from: reverse ? end : start, to: reverse ? start : end};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SearchCursor.prototype = {
|
|
||||||
findNext: function() {return this.find(false);},
|
|
||||||
findPrevious: function() {return this.find(true);},
|
|
||||||
|
|
||||||
find: function(reverse) {
|
|
||||||
var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to);
|
|
||||||
function savePosAndFail(line) {
|
|
||||||
var pos = {line: line, ch: 0};
|
|
||||||
self.pos = {from: pos, to: pos};
|
|
||||||
self.atOccurrence = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if (this.pos = this.matches(reverse, pos)) {
|
|
||||||
this.atOccurrence = true;
|
|
||||||
return this.pos.match || true;
|
|
||||||
}
|
|
||||||
if (reverse) {
|
|
||||||
if (!pos.line) return savePosAndFail(0);
|
|
||||||
pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var maxLine = this.cm.lineCount();
|
|
||||||
if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
|
|
||||||
pos = {line: pos.line+1, ch: 0};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
from: function() {if (this.atOccurrence) return this.pos.from;},
|
|
||||||
to: function() {if (this.atOccurrence) return this.pos.to;},
|
|
||||||
|
|
||||||
replace: function(newText) {
|
|
||||||
var self = this;
|
|
||||||
if (this.atOccurrence)
|
|
||||||
self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
|
||||||
return new SearchCursor(this, query, pos, caseFold);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
.CodeMirror-completions {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 10;
|
|
||||||
overflow: hidden;
|
|
||||||
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
}
|
|
||||||
.CodeMirror-completions select {
|
|
||||||
background: #fafafa;
|
|
||||||
outline: none;
|
|
||||||
border: none;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
(function() {
|
|
||||||
CodeMirror.simpleHint = function(editor, getHints) {
|
|
||||||
// We want a single cursor position.
|
|
||||||
if (editor.somethingSelected()) return;
|
|
||||||
var result = getHints(editor);
|
|
||||||
if (!result || !result.list.length) return;
|
|
||||||
var completions = result.list;
|
|
||||||
function insert(str) {
|
|
||||||
editor.replaceRange(str, result.from, result.to);
|
|
||||||
}
|
|
||||||
// When there is only one completion, use it directly.
|
|
||||||
if (completions.length == 1) {insert(completions[0]); return true;}
|
|
||||||
|
|
||||||
// Build the select widget
|
|
||||||
var complete = document.createElement("div");
|
|
||||||
complete.className = "CodeMirror-completions";
|
|
||||||
var sel = complete.appendChild(document.createElement("select"));
|
|
||||||
// Opera doesn't move the selection when pressing up/down in a
|
|
||||||
// multi-select, but it does properly support the size property on
|
|
||||||
// single-selects, so no multi-select is necessary.
|
|
||||||
if (!window.opera) sel.multiple = true;
|
|
||||||
for (var i = 0; i < completions.length; ++i) {
|
|
||||||
var opt = sel.appendChild(document.createElement("option"));
|
|
||||||
opt.appendChild(document.createTextNode(completions[i]));
|
|
||||||
}
|
|
||||||
sel.firstChild.selected = true;
|
|
||||||
sel.size = Math.min(10, completions.length);
|
|
||||||
var pos = editor.cursorCoords();
|
|
||||||
complete.style.left = pos.x + "px";
|
|
||||||
complete.style.top = pos.yBot + "px";
|
|
||||||
document.body.appendChild(complete);
|
|
||||||
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
|
||||||
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
|
|
||||||
if(winW - pos.x < sel.clientWidth)
|
|
||||||
complete.style.left = (pos.x - sel.clientWidth) + "px";
|
|
||||||
// Hack to hide the scrollbar.
|
|
||||||
if (completions.length <= 10)
|
|
||||||
complete.style.width = (sel.clientWidth - 1) + "px";
|
|
||||||
|
|
||||||
var done = false;
|
|
||||||
function close() {
|
|
||||||
if (done) return;
|
|
||||||
done = true;
|
|
||||||
complete.parentNode.removeChild(complete);
|
|
||||||
}
|
|
||||||
function pick() {
|
|
||||||
insert(completions[sel.selectedIndex]);
|
|
||||||
close();
|
|
||||||
setTimeout(function(){editor.focus();}, 50);
|
|
||||||
}
|
|
||||||
CodeMirror.connect(sel, "blur", close);
|
|
||||||
CodeMirror.connect(sel, "keydown", function(event) {
|
|
||||||
var code = event.keyCode;
|
|
||||||
// Enter
|
|
||||||
if (code == 13) {CodeMirror.e_stop(event); pick();}
|
|
||||||
// Escape
|
|
||||||
else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
|
|
||||||
else if (code != 38 && code != 40) {
|
|
||||||
close(); editor.focus();
|
|
||||||
// Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
|
|
||||||
editor.triggerOnKeyDown(event);
|
|
||||||
setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CodeMirror.connect(sel, "dblclick", pick);
|
|
||||||
|
|
||||||
sel.focus();
|
|
||||||
// Opera sometimes ignores focusing a freshly created node
|
|
||||||
if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
@@ -1,234 +0,0 @@
|
|||||||
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|
||||||
var indentUnit = config.indentUnit,
|
|
||||||
keywords = parserConfig.keywords || {},
|
|
||||||
blockKeywords = parserConfig.blockKeywords || {},
|
|
||||||
atoms = parserConfig.atoms || {},
|
|
||||||
hooks = parserConfig.hooks || {},
|
|
||||||
multiLineStrings = parserConfig.multiLineStrings;
|
|
||||||
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
|
||||||
|
|
||||||
var curPunc;
|
|
||||||
|
|
||||||
function tokenBase(stream, state) {
|
|
||||||
var ch = stream.next();
|
|
||||||
if (hooks[ch]) {
|
|
||||||
var result = hooks[ch](stream, state);
|
|
||||||
if (result !== false) return result;
|
|
||||||
}
|
|
||||||
if (ch == '"' || ch == "'") {
|
|
||||||
state.tokenize = tokenString(ch);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
|
||||||
curPunc = ch;
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
if (/\d/.test(ch)) {
|
|
||||||
stream.eatWhile(/[\w\.]/);
|
|
||||||
return "number";
|
|
||||||
}
|
|
||||||
if (ch == "/") {
|
|
||||||
if (stream.eat("*")) {
|
|
||||||
state.tokenize = tokenComment;
|
|
||||||
return tokenComment(stream, state);
|
|
||||||
}
|
|
||||||
if (stream.eat("/")) {
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "comment";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isOperatorChar.test(ch)) {
|
|
||||||
stream.eatWhile(isOperatorChar);
|
|
||||||
return "operator";
|
|
||||||
}
|
|
||||||
stream.eatWhile(/[\w\$_]/);
|
|
||||||
var cur = stream.current();
|
|
||||||
if (keywords.propertyIsEnumerable(cur)) {
|
|
||||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
|
||||||
return "keyword";
|
|
||||||
}
|
|
||||||
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
|
||||||
return "word";
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenString(quote) {
|
|
||||||
return function(stream, state) {
|
|
||||||
var escaped = false, next, end = false;
|
|
||||||
while ((next = stream.next()) != null) {
|
|
||||||
if (next == quote && !escaped) {end = true; break;}
|
|
||||||
escaped = !escaped && next == "\\";
|
|
||||||
}
|
|
||||||
if (end || !(escaped || multiLineStrings))
|
|
||||||
state.tokenize = null;
|
|
||||||
return "string";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenComment(stream, state) {
|
|
||||||
var maybeEnd = false, ch;
|
|
||||||
while (ch = stream.next()) {
|
|
||||||
if (ch == "/" && maybeEnd) {
|
|
||||||
state.tokenize = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
maybeEnd = (ch == "*");
|
|
||||||
}
|
|
||||||
return "comment";
|
|
||||||
}
|
|
||||||
|
|
||||||
function Context(indented, column, type, align, prev) {
|
|
||||||
this.indented = indented;
|
|
||||||
this.column = column;
|
|
||||||
this.type = type;
|
|
||||||
this.align = align;
|
|
||||||
this.prev = prev;
|
|
||||||
}
|
|
||||||
function pushContext(state, col, type) {
|
|
||||||
return state.context = new Context(state.indented, col, type, null, state.context);
|
|
||||||
}
|
|
||||||
function popContext(state) {
|
|
||||||
var t = state.context.type;
|
|
||||||
if (t == ")" || t == "]" || t == "}")
|
|
||||||
state.indented = state.context.indented;
|
|
||||||
return state.context = state.context.prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interface
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function(basecolumn) {
|
|
||||||
return {
|
|
||||||
tokenize: null,
|
|
||||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
|
||||||
indented: 0,
|
|
||||||
startOfLine: true
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
var ctx = state.context;
|
|
||||||
if (stream.sol()) {
|
|
||||||
if (ctx.align == null) ctx.align = false;
|
|
||||||
state.indented = stream.indentation();
|
|
||||||
state.startOfLine = true;
|
|
||||||
}
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
curPunc = null;
|
|
||||||
var style = (state.tokenize || tokenBase)(stream, state);
|
|
||||||
if (style == "comment" || style == "meta") return style;
|
|
||||||
if (ctx.align == null) ctx.align = true;
|
|
||||||
|
|
||||||
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
|
|
||||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
|
||||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
|
||||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
|
||||||
else if (curPunc == "}") {
|
|
||||||
while (ctx.type == "statement") ctx = popContext(state);
|
|
||||||
if (ctx.type == "}") ctx = popContext(state);
|
|
||||||
while (ctx.type == "statement") ctx = popContext(state);
|
|
||||||
}
|
|
||||||
else if (curPunc == ctx.type) popContext(state);
|
|
||||||
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
|
|
||||||
pushContext(state, stream.column(), "statement");
|
|
||||||
state.startOfLine = false;
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
|
||||||
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
|
||||||
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
|
||||||
var closing = firstChar == ctx.type;
|
|
||||||
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
|
|
||||||
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
|
||||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: "{}"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
function words(str) {
|
|
||||||
var obj = {}, words = str.split(" ");
|
|
||||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
|
|
||||||
"double static else struct entry switch extern typedef float union for unsigned " +
|
|
||||||
"goto while enum void const signed volatile";
|
|
||||||
|
|
||||||
function cppHook(stream, state) {
|
|
||||||
if (!state.startOfLine) return false;
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "meta";
|
|
||||||
}
|
|
||||||
|
|
||||||
// C#-style strings where "" escapes a quote.
|
|
||||||
function tokenAtString(stream, state) {
|
|
||||||
var next;
|
|
||||||
while ((next = stream.next()) != null) {
|
|
||||||
if (next == '"' && !stream.eat('"')) {
|
|
||||||
state.tokenize = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "string";
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-csrc", {
|
|
||||||
name: "clike",
|
|
||||||
keywords: words(cKeywords),
|
|
||||||
blockKeywords: words("case do else for if switch while struct"),
|
|
||||||
atoms: words("null"),
|
|
||||||
hooks: {"#": cppHook}
|
|
||||||
});
|
|
||||||
CodeMirror.defineMIME("text/x-c++src", {
|
|
||||||
name: "clike",
|
|
||||||
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
|
||||||
"static_cast typeid catch operator template typename class friend private " +
|
|
||||||
"this using const_cast inline public throw virtual delete mutable protected " +
|
|
||||||
"wchar_t"),
|
|
||||||
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
|
||||||
atoms: words("true false null"),
|
|
||||||
hooks: {"#": cppHook}
|
|
||||||
});
|
|
||||||
CodeMirror.defineMIME("text/x-java", {
|
|
||||||
name: "clike",
|
|
||||||
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
|
||||||
"do double else enum extends final finally float for goto if implements import " +
|
|
||||||
"instanceof int interface long native new package private protected public " +
|
|
||||||
"return short static strictfp super switch synchronized this throw throws transient " +
|
|
||||||
"try void volatile while"),
|
|
||||||
blockKeywords: words("catch class do else finally for if switch try while"),
|
|
||||||
atoms: words("true false null"),
|
|
||||||
hooks: {
|
|
||||||
"@": function(stream, state) {
|
|
||||||
stream.eatWhile(/[\w\$_]/);
|
|
||||||
return "meta";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CodeMirror.defineMIME("text/x-csharp", {
|
|
||||||
name: "clike",
|
|
||||||
keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
|
|
||||||
" default delegate do double else enum event explicit extern finally fixed float for" +
|
|
||||||
" foreach goto if implicit in int interface internal is lock long namespace new object" +
|
|
||||||
" operator out override params private protected public readonly ref return sbyte sealed short" +
|
|
||||||
" sizeof stackalloc static string struct switch this throw try typeof uint ulong unchecked" +
|
|
||||||
" unsafe ushort using virtual void volatile while add alias ascending descending dynamic from get" +
|
|
||||||
" global group into join let orderby partial remove select set value var yield"),
|
|
||||||
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
|
||||||
atoms: words("true false null"),
|
|
||||||
hooks: {
|
|
||||||
"@": function(stream, state) {
|
|
||||||
if (stream.eat('"')) {
|
|
||||||
state.tokenize = tokenAtString;
|
|
||||||
return tokenAtString(stream, state);
|
|
||||||
}
|
|
||||||
stream.eatWhile(/[\w\$_]/);
|
|
||||||
return "meta";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: C-like mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="clike.js"></script>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
<style>.CodeMirror {border: 2px inset #dee;}</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: C-like mode</h1>
|
|
||||||
|
|
||||||
<form><textarea id="code" name="code">
|
|
||||||
/* C demo code */
|
|
||||||
|
|
||||||
#include <zmq.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <semaphore.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
void* arg_socket;
|
|
||||||
zmq_msg_t* arg_msg;
|
|
||||||
char* arg_string;
|
|
||||||
unsigned long arg_len;
|
|
||||||
int arg_int, arg_command;
|
|
||||||
|
|
||||||
int signal_fd;
|
|
||||||
int pad;
|
|
||||||
void* context;
|
|
||||||
sem_t sem;
|
|
||||||
} acl_zmq_context;
|
|
||||||
|
|
||||||
#define p(X) (context->arg_##X)
|
|
||||||
|
|
||||||
void* zmq_thread(void* context_pointer) {
|
|
||||||
acl_zmq_context* context = (acl_zmq_context*)context_pointer;
|
|
||||||
char ok = 'K', err = 'X';
|
|
||||||
int res;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
while ((res = sem_wait(&context->sem)) == EINTR);
|
|
||||||
if (res) {write(context->signal_fd, &err, 1); goto cleanup;}
|
|
||||||
switch(p(command)) {
|
|
||||||
case 0: goto cleanup;
|
|
||||||
case 1: p(socket) = zmq_socket(context->context, p(int)); break;
|
|
||||||
case 2: p(int) = zmq_close(p(socket)); break;
|
|
||||||
case 3: p(int) = zmq_bind(p(socket), p(string)); break;
|
|
||||||
case 4: p(int) = zmq_connect(p(socket), p(string)); break;
|
|
||||||
case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;
|
|
||||||
case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
|
|
||||||
case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
|
|
||||||
case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
|
|
||||||
case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
|
|
||||||
}
|
|
||||||
p(command) = errno;
|
|
||||||
write(context->signal_fd, &ok, 1);
|
|
||||||
}
|
|
||||||
cleanup:
|
|
||||||
close(context->signal_fd);
|
|
||||||
free(context_pointer);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* zmq_thread_init(void* zmq_context, int signal_fd) {
|
|
||||||
acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
|
|
||||||
pthread_t thread;
|
|
||||||
|
|
||||||
context->context = zmq_context;
|
|
||||||
context->signal_fd = signal_fd;
|
|
||||||
sem_init(&context->sem, 1, 0);
|
|
||||||
pthread_create(&thread, 0, &zmq_thread, context);
|
|
||||||
pthread_detach(thread);
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
</textarea></form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
||||||
lineNumbers: true,
|
|
||||||
matchBrackets: true,
|
|
||||||
mode: "text/x-csrc"
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p>Simple mode that tries to handle C-like languages as well as it
|
|
||||||
can. Takes two configuration parameters: <code>keywords</code>, an
|
|
||||||
object whose property names are the keywords in the language,
|
|
||||||
and <code>useCPP</code>, which determines whether C preprocessor
|
|
||||||
directives are recognized.</p>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
|
|
||||||
(C code), <code>text/x-c++src</code> (C++
|
|
||||||
code), <code>text/x-java</code> (Java
|
|
||||||
code), <code>text/x-csharp</code> (C#).</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
CodeMirror.defineMode("css", function(config) {
|
|
||||||
var indentUnit = config.indentUnit, type;
|
|
||||||
function ret(style, tp) {type = tp; return style;}
|
|
||||||
|
|
||||||
function tokenBase(stream, state) {
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
|
|
||||||
else if (ch == "/" && stream.eat("*")) {
|
|
||||||
state.tokenize = tokenCComment;
|
|
||||||
return tokenCComment(stream, state);
|
|
||||||
}
|
|
||||||
else if (ch == "<" && stream.eat("!")) {
|
|
||||||
state.tokenize = tokenSGMLComment;
|
|
||||||
return tokenSGMLComment(stream, state);
|
|
||||||
}
|
|
||||||
else if (ch == "=") ret(null, "compare");
|
|
||||||
else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
|
|
||||||
else if (ch == "\"" || ch == "'") {
|
|
||||||
state.tokenize = tokenString(ch);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
else if (ch == "#") {
|
|
||||||
stream.eatWhile(/[\w\\\-]/);
|
|
||||||
return ret("atom", "hash");
|
|
||||||
}
|
|
||||||
else if (ch == "!") {
|
|
||||||
stream.match(/^\s*\w*/);
|
|
||||||
return ret("keyword", "important");
|
|
||||||
}
|
|
||||||
else if (/\d/.test(ch)) {
|
|
||||||
stream.eatWhile(/[\w.%]/);
|
|
||||||
return ret("number", "unit");
|
|
||||||
}
|
|
||||||
else if (/[,.+>*\/]/.test(ch)) {
|
|
||||||
return ret(null, "select-op");
|
|
||||||
}
|
|
||||||
else if (/[;{}:\[\]]/.test(ch)) {
|
|
||||||
return ret(null, ch);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stream.eatWhile(/[\w\\\-]/);
|
|
||||||
return ret("variable", "variable");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenCComment(stream, state) {
|
|
||||||
var maybeEnd = false, ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (maybeEnd && ch == "/") {
|
|
||||||
state.tokenize = tokenBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
maybeEnd = (ch == "*");
|
|
||||||
}
|
|
||||||
return ret("comment", "comment");
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenSGMLComment(stream, state) {
|
|
||||||
var dashes = 0, ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (dashes >= 2 && ch == ">") {
|
|
||||||
state.tokenize = tokenBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
dashes = (ch == "-") ? dashes + 1 : 0;
|
|
||||||
}
|
|
||||||
return ret("comment", "comment");
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenString(quote) {
|
|
||||||
return function(stream, state) {
|
|
||||||
var escaped = false, ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (ch == quote && !escaped)
|
|
||||||
break;
|
|
||||||
escaped = !escaped && ch == "\\";
|
|
||||||
}
|
|
||||||
if (!escaped) state.tokenize = tokenBase;
|
|
||||||
return ret("string", "string");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function(base) {
|
|
||||||
return {tokenize: tokenBase,
|
|
||||||
baseIndent: base || 0,
|
|
||||||
stack: []};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
var style = state.tokenize(stream, state);
|
|
||||||
|
|
||||||
var context = state.stack[state.stack.length-1];
|
|
||||||
if (type == "hash" && context != "rule") style = "string-2";
|
|
||||||
else if (style == "variable") {
|
|
||||||
if (context == "rule") style = "number";
|
|
||||||
else if (!context || context == "@media{") style = "tag";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context == "rule" && /^[\{\};]$/.test(type))
|
|
||||||
state.stack.pop();
|
|
||||||
if (type == "{") {
|
|
||||||
if (context == "@media") state.stack[state.stack.length-1] = "@media{";
|
|
||||||
else state.stack.push("{");
|
|
||||||
}
|
|
||||||
else if (type == "}") state.stack.pop();
|
|
||||||
else if (type == "@media") state.stack.push("@media");
|
|
||||||
else if (context == "{" && type != "comment") state.stack.push("rule");
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
var n = state.stack.length;
|
|
||||||
if (/^\}/.test(textAfter))
|
|
||||||
n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
|
|
||||||
return state.baseIndent + n * indentUnit;
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: "}"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/css", "css");
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: CSS mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="css.js"></script>
|
|
||||||
<style>.CodeMirror {background: #f8f8f8;}</style>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: CSS mode</h1>
|
|
||||||
<form><textarea id="code" name="code">
|
|
||||||
/* Some example CSS */
|
|
||||||
|
|
||||||
@import url("something.css");
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 3em 6em;
|
|
||||||
font-family: tahoma, arial, sans-serif;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
#navigation a {
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 1.7em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1:before, h2:before {
|
|
||||||
content: "::";
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: courier, monospace;
|
|
||||||
font-size: 80%;
|
|
||||||
color: #418A8A;
|
|
||||||
}
|
|
||||||
</textarea></form>
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>text/css</code>.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: JavaScript mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="javascript.js"></script>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: JavaScript mode</h1>
|
|
||||||
|
|
||||||
<div><textarea id="code" name="code">
|
|
||||||
// Demo code (the actual new parser character stream implementation)
|
|
||||||
|
|
||||||
function StringStream(string) {
|
|
||||||
this.pos = 0;
|
|
||||||
this.string = string;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringStream.prototype = {
|
|
||||||
done: function() {return this.pos >= this.string.length;},
|
|
||||||
peek: function() {return this.string.charAt(this.pos);},
|
|
||||||
next: function() {
|
|
||||||
if (this.pos < this.string.length)
|
|
||||||
return this.string.charAt(this.pos++);
|
|
||||||
},
|
|
||||||
eat: function(match) {
|
|
||||||
var ch = this.string.charAt(this.pos);
|
|
||||||
if (typeof match == "string") var ok = ch == match;
|
|
||||||
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
|
||||||
if (ok) {this.pos++; return ch;}
|
|
||||||
},
|
|
||||||
eatWhile: function(match) {
|
|
||||||
var start = this.pos;
|
|
||||||
while (this.eat(match));
|
|
||||||
if (this.pos > start) return this.string.slice(start, this.pos);
|
|
||||||
},
|
|
||||||
backUp: function(n) {this.pos -= n;},
|
|
||||||
column: function() {return this.pos;},
|
|
||||||
eatSpace: function() {
|
|
||||||
var start = this.pos;
|
|
||||||
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
|
||||||
return this.pos - start;
|
|
||||||
},
|
|
||||||
match: function(pattern, consume, caseInsensitive) {
|
|
||||||
if (typeof pattern == "string") {
|
|
||||||
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
|
||||||
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
|
||||||
if (consume !== false) this.pos += str.length;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var match = this.string.slice(this.pos).match(pattern);
|
|
||||||
if (match && consume !== false) this.pos += match[0].length;
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</textarea></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
||||||
lineNumbers: true,
|
|
||||||
matchBrackets: true
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p>JavaScript mode supports a single configuration
|
|
||||||
option, <code>json</code>, which will set the mode to expect JSON
|
|
||||||
data rather than a JavaScript program.</p>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,360 +0,0 @@
|
|||||||
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
||||||
var indentUnit = config.indentUnit;
|
|
||||||
var jsonMode = parserConfig.json;
|
|
||||||
|
|
||||||
// Tokenizer
|
|
||||||
|
|
||||||
var keywords = function(){
|
|
||||||
function kw(type) {return {type: type, style: "keyword"};}
|
|
||||||
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
|
||||||
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
|
||||||
return {
|
|
||||||
"if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
|
||||||
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
|
||||||
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
|
||||||
"function": kw("function"), "catch": kw("catch"),
|
|
||||||
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
|
||||||
"in": operator, "typeof": operator, "instanceof": operator,
|
|
||||||
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom
|
|
||||||
};
|
|
||||||
}();
|
|
||||||
|
|
||||||
var isOperatorChar = /[+\-*&%=<>!?|]/;
|
|
||||||
|
|
||||||
function chain(stream, state, f) {
|
|
||||||
state.tokenize = f;
|
|
||||||
return f(stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
function nextUntilUnescaped(stream, end) {
|
|
||||||
var escaped = false, next;
|
|
||||||
while ((next = stream.next()) != null) {
|
|
||||||
if (next == end && !escaped)
|
|
||||||
return false;
|
|
||||||
escaped = !escaped && next == "\\";
|
|
||||||
}
|
|
||||||
return escaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used as scratch variables to communicate multiple values without
|
|
||||||
// consing up tons of objects.
|
|
||||||
var type, content;
|
|
||||||
function ret(tp, style, cont) {
|
|
||||||
type = tp; content = cont;
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
|
|
||||||
function jsTokenBase(stream, state) {
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == '"' || ch == "'")
|
|
||||||
return chain(stream, state, jsTokenString(ch));
|
|
||||||
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
|
|
||||||
return ret(ch);
|
|
||||||
else if (ch == "0" && stream.eat(/x/i)) {
|
|
||||||
stream.eatWhile(/[\da-f]/i);
|
|
||||||
return ret("number", "number");
|
|
||||||
}
|
|
||||||
else if (/\d/.test(ch)) {
|
|
||||||
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
|
||||||
return ret("number", "number");
|
|
||||||
}
|
|
||||||
else if (ch == "/") {
|
|
||||||
if (stream.eat("*")) {
|
|
||||||
return chain(stream, state, jsTokenComment);
|
|
||||||
}
|
|
||||||
else if (stream.eat("/")) {
|
|
||||||
stream.skipToEnd();
|
|
||||||
return ret("comment", "comment");
|
|
||||||
}
|
|
||||||
else if (state.reAllowed) {
|
|
||||||
nextUntilUnescaped(stream, "/");
|
|
||||||
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
|
||||||
return ret("regexp", "string-2");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stream.eatWhile(isOperatorChar);
|
|
||||||
return ret("operator", null, stream.current());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ch == "#") {
|
|
||||||
stream.skipToEnd();
|
|
||||||
return ret("error", "error");
|
|
||||||
}
|
|
||||||
else if (isOperatorChar.test(ch)) {
|
|
||||||
stream.eatWhile(isOperatorChar);
|
|
||||||
return ret("operator", null, stream.current());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stream.eatWhile(/[\w\$_]/);
|
|
||||||
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
|
||||||
return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
|
|
||||||
ret("variable", "variable", word);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function jsTokenString(quote) {
|
|
||||||
return function(stream, state) {
|
|
||||||
if (!nextUntilUnescaped(stream, quote))
|
|
||||||
state.tokenize = jsTokenBase;
|
|
||||||
return ret("string", "string");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function jsTokenComment(stream, state) {
|
|
||||||
var maybeEnd = false, ch;
|
|
||||||
while (ch = stream.next()) {
|
|
||||||
if (ch == "/" && maybeEnd) {
|
|
||||||
state.tokenize = jsTokenBase;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
maybeEnd = (ch == "*");
|
|
||||||
}
|
|
||||||
return ret("comment", "comment");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parser
|
|
||||||
|
|
||||||
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
|
|
||||||
|
|
||||||
function JSLexical(indented, column, type, align, prev, info) {
|
|
||||||
this.indented = indented;
|
|
||||||
this.column = column;
|
|
||||||
this.type = type;
|
|
||||||
this.prev = prev;
|
|
||||||
this.info = info;
|
|
||||||
if (align != null) this.align = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
function inScope(state, varname) {
|
|
||||||
for (var v = state.localVars; v; v = v.next)
|
|
||||||
if (v.name == varname) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseJS(state, style, type, content, stream) {
|
|
||||||
var cc = state.cc;
|
|
||||||
// Communicate our context to the combinators.
|
|
||||||
// (Less wasteful than consing up a hundred closures on every call.)
|
|
||||||
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
|
||||||
|
|
||||||
if (!state.lexical.hasOwnProperty("align"))
|
|
||||||
state.lexical.align = true;
|
|
||||||
|
|
||||||
while(true) {
|
|
||||||
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
|
||||||
if (combinator(type, content)) {
|
|
||||||
while(cc.length && cc[cc.length - 1].lex)
|
|
||||||
cc.pop()();
|
|
||||||
if (cx.marked) return cx.marked;
|
|
||||||
if (type == "variable" && inScope(state, content)) return "variable-2";
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Combinator utils
|
|
||||||
|
|
||||||
var cx = {state: null, column: null, marked: null, cc: null};
|
|
||||||
function pass() {
|
|
||||||
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
|
||||||
}
|
|
||||||
function cont() {
|
|
||||||
pass.apply(null, arguments);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
function register(varname) {
|
|
||||||
var state = cx.state;
|
|
||||||
if (state.context) {
|
|
||||||
cx.marked = "def";
|
|
||||||
for (var v = state.localVars; v; v = v.next)
|
|
||||||
if (v.name == varname) return;
|
|
||||||
state.localVars = {name: varname, next: state.localVars};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Combinators
|
|
||||||
|
|
||||||
var defaultVars = {name: "this", next: {name: "arguments"}};
|
|
||||||
function pushcontext() {
|
|
||||||
if (!cx.state.context) cx.state.localVars = defaultVars;
|
|
||||||
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
|
||||||
}
|
|
||||||
function popcontext() {
|
|
||||||
cx.state.localVars = cx.state.context.vars;
|
|
||||||
cx.state.context = cx.state.context.prev;
|
|
||||||
}
|
|
||||||
function pushlex(type, info) {
|
|
||||||
var result = function() {
|
|
||||||
var state = cx.state;
|
|
||||||
state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info)
|
|
||||||
};
|
|
||||||
result.lex = true;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
function poplex() {
|
|
||||||
var state = cx.state;
|
|
||||||
if (state.lexical.prev) {
|
|
||||||
if (state.lexical.type == ")")
|
|
||||||
state.indented = state.lexical.indented;
|
|
||||||
state.lexical = state.lexical.prev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
poplex.lex = true;
|
|
||||||
|
|
||||||
function expect(wanted) {
|
|
||||||
return function expecting(type) {
|
|
||||||
if (type == wanted) return cont();
|
|
||||||
else if (wanted == ";") return pass();
|
|
||||||
else return cont(arguments.callee);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function statement(type) {
|
|
||||||
if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
|
|
||||||
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
|
||||||
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
|
||||||
if (type == "{") return cont(pushlex("}"), block, poplex);
|
|
||||||
if (type == ";") return cont();
|
|
||||||
if (type == "function") return cont(functiondef);
|
|
||||||
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
|
|
||||||
poplex, statement, poplex);
|
|
||||||
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
|
||||||
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
|
||||||
block, poplex, poplex);
|
|
||||||
if (type == "case") return cont(expression, expect(":"));
|
|
||||||
if (type == "default") return cont(expect(":"));
|
|
||||||
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
|
||||||
statement, poplex, popcontext);
|
|
||||||
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
|
||||||
}
|
|
||||||
function expression(type) {
|
|
||||||
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
|
|
||||||
if (type == "function") return cont(functiondef);
|
|
||||||
if (type == "keyword c") return cont(maybeexpression);
|
|
||||||
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
|
|
||||||
if (type == "operator") return cont(expression);
|
|
||||||
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
|
|
||||||
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
|
|
||||||
return cont();
|
|
||||||
}
|
|
||||||
function maybeexpression(type) {
|
|
||||||
if (type.match(/[;\}\)\],]/)) return pass();
|
|
||||||
return pass(expression);
|
|
||||||
}
|
|
||||||
|
|
||||||
function maybeoperator(type, value) {
|
|
||||||
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
|
||||||
if (type == "operator") return cont(expression);
|
|
||||||
if (type == ";") return;
|
|
||||||
if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
|
|
||||||
if (type == ".") return cont(property, maybeoperator);
|
|
||||||
if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
|
|
||||||
}
|
|
||||||
function maybelabel(type) {
|
|
||||||
if (type == ":") return cont(poplex, statement);
|
|
||||||
return pass(maybeoperator, expect(";"), poplex);
|
|
||||||
}
|
|
||||||
function property(type) {
|
|
||||||
if (type == "variable") {cx.marked = "property"; return cont();}
|
|
||||||
}
|
|
||||||
function objprop(type) {
|
|
||||||
if (type == "variable") cx.marked = "property";
|
|
||||||
if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
|
|
||||||
}
|
|
||||||
function commasep(what, end) {
|
|
||||||
function proceed(type) {
|
|
||||||
if (type == ",") return cont(what, proceed);
|
|
||||||
if (type == end) return cont();
|
|
||||||
return cont(expect(end));
|
|
||||||
}
|
|
||||||
return function commaSeparated(type) {
|
|
||||||
if (type == end) return cont();
|
|
||||||
else return pass(what, proceed);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function block(type) {
|
|
||||||
if (type == "}") return cont();
|
|
||||||
return pass(statement, block);
|
|
||||||
}
|
|
||||||
function vardef1(type, value) {
|
|
||||||
if (type == "variable"){register(value); return cont(vardef2);}
|
|
||||||
return cont();
|
|
||||||
}
|
|
||||||
function vardef2(type, value) {
|
|
||||||
if (value == "=") return cont(expression, vardef2);
|
|
||||||
if (type == ",") return cont(vardef1);
|
|
||||||
}
|
|
||||||
function forspec1(type) {
|
|
||||||
if (type == "var") return cont(vardef1, forspec2);
|
|
||||||
if (type == ";") return pass(forspec2);
|
|
||||||
if (type == "variable") return cont(formaybein);
|
|
||||||
return pass(forspec2);
|
|
||||||
}
|
|
||||||
function formaybein(type, value) {
|
|
||||||
if (value == "in") return cont(expression);
|
|
||||||
return cont(maybeoperator, forspec2);
|
|
||||||
}
|
|
||||||
function forspec2(type, value) {
|
|
||||||
if (type == ";") return cont(forspec3);
|
|
||||||
if (value == "in") return cont(expression);
|
|
||||||
return cont(expression, expect(";"), forspec3);
|
|
||||||
}
|
|
||||||
function forspec3(type) {
|
|
||||||
if (type != ")") cont(expression);
|
|
||||||
}
|
|
||||||
function functiondef(type, value) {
|
|
||||||
if (type == "variable") {register(value); return cont(functiondef);}
|
|
||||||
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext);
|
|
||||||
}
|
|
||||||
function funarg(type, value) {
|
|
||||||
if (type == "variable") {register(value); return cont();}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Interface
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function(basecolumn) {
|
|
||||||
return {
|
|
||||||
tokenize: jsTokenBase,
|
|
||||||
reAllowed: true,
|
|
||||||
kwAllowed: true,
|
|
||||||
cc: [],
|
|
||||||
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
|
||||||
localVars: parserConfig.localVars,
|
|
||||||
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
|
||||||
indented: 0
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (stream.sol()) {
|
|
||||||
if (!state.lexical.hasOwnProperty("align"))
|
|
||||||
state.lexical.align = false;
|
|
||||||
state.indented = stream.indentation();
|
|
||||||
}
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
var style = state.tokenize(stream, state);
|
|
||||||
if (type == "comment") return style;
|
|
||||||
state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
|
|
||||||
state.kwAllowed = type != '.';
|
|
||||||
return parseJS(state, style, type, content, stream);
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
if (state.tokenize != jsTokenBase) return 0;
|
|
||||||
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
|
|
||||||
type = lexical.type, closing = firstChar == type;
|
|
||||||
if (type == "vardef") return lexical.indented + 4;
|
|
||||||
else if (type == "form" && firstChar == "{") return lexical.indented;
|
|
||||||
else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
|
|
||||||
else if (lexical.info == "switch" && !closing)
|
|
||||||
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
|
||||||
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
|
||||||
else return lexical.indented + (closing ? 0 : indentUnit);
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: ":{}"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/javascript", "javascript");
|
|
||||||
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: PHP mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="../xml/xml.js"></script>
|
|
||||||
<script src="../javascript/javascript.js"></script>
|
|
||||||
<script src="../css/css.js"></script>
|
|
||||||
<script src="../clike/clike.js"></script>
|
|
||||||
<script src="php.js"></script>
|
|
||||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: PHP mode</h1>
|
|
||||||
|
|
||||||
<form><textarea id="code" name="code">
|
|
||||||
<?php
|
|
||||||
function hello($who) {
|
|
||||||
return "Hello " . $who;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<p>The program says <?= hello("World") ?>.</p>
|
|
||||||
<script>
|
|
||||||
alert("And here is some JS code"); // also colored
|
|
||||||
</script>
|
|
||||||
</textarea></form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
||||||
lineNumbers: true,
|
|
||||||
matchBrackets: true,
|
|
||||||
mode: "application/x-httpd-php",
|
|
||||||
indentUnit: 4,
|
|
||||||
indentWithTabs: true,
|
|
||||||
enterMode: "keep",
|
|
||||||
tabMode: "shift"
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p>Simple HTML/PHP mode based on
|
|
||||||
the <a href="../clike/">C-like</a> mode. Depends on XML,
|
|
||||||
JavaScript, CSS, and C-like modes.</p>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
(function() {
|
|
||||||
function keywords(str) {
|
|
||||||
var obj = {}, words = str.split(" ");
|
|
||||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
function heredoc(delim) {
|
|
||||||
return function(stream, state) {
|
|
||||||
if (stream.match(delim)) state.tokenize = null;
|
|
||||||
else stream.skipToEnd();
|
|
||||||
return "string";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var phpConfig = {
|
|
||||||
name: "clike",
|
|
||||||
keywords: keywords("abstract and array as break case catch class clone const continue declare default " +
|
|
||||||
"do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " +
|
|
||||||
"for foreach function global goto if implements interface instanceof namespace " +
|
|
||||||
"new or private protected public static switch throw trait try use var while xor " +
|
|
||||||
"die echo empty exit eval include include_once isset list require require_once return " +
|
|
||||||
"print unset __halt_compiler self static parent"),
|
|
||||||
blockKeywords: keywords("catch do else elseif for foreach if switch try while"),
|
|
||||||
atoms: keywords("true false null TRUE FALSE NULL"),
|
|
||||||
multiLineStrings: true,
|
|
||||||
hooks: {
|
|
||||||
"$": function(stream, state) {
|
|
||||||
stream.eatWhile(/[\w\$_]/);
|
|
||||||
return "variable-2";
|
|
||||||
},
|
|
||||||
"<": function(stream, state) {
|
|
||||||
if (stream.match(/<</)) {
|
|
||||||
stream.eatWhile(/[\w\.]/);
|
|
||||||
state.tokenize = heredoc(stream.current().slice(3));
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
"#": function(stream, state) {
|
|
||||||
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
|
||||||
return "comment";
|
|
||||||
},
|
|
||||||
"/": function(stream, state) {
|
|
||||||
if (stream.eat("/")) {
|
|
||||||
while (!stream.eol() && !stream.match("?>", false)) stream.next();
|
|
||||||
return "comment";
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.defineMode("php", function(config, parserConfig) {
|
|
||||||
var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true});
|
|
||||||
var jsMode = CodeMirror.getMode(config, "javascript");
|
|
||||||
var cssMode = CodeMirror.getMode(config, "css");
|
|
||||||
var phpMode = CodeMirror.getMode(config, phpConfig);
|
|
||||||
|
|
||||||
function dispatch(stream, state) { // TODO open PHP inside text/css
|
|
||||||
var isPHP = state.mode == "php";
|
|
||||||
if (stream.sol() && state.pending != '"') state.pending = null;
|
|
||||||
if (state.curMode == htmlMode) {
|
|
||||||
if (stream.match(/^<\?\w*/)) {
|
|
||||||
state.curMode = phpMode;
|
|
||||||
state.curState = state.php;
|
|
||||||
state.curClose = "?>";
|
|
||||||
state.mode = "php";
|
|
||||||
return "meta";
|
|
||||||
}
|
|
||||||
if (state.pending == '"') {
|
|
||||||
while (!stream.eol() && stream.next() != '"') {}
|
|
||||||
var style = "string";
|
|
||||||
} else if (state.pending && stream.pos < state.pending.end) {
|
|
||||||
stream.pos = state.pending.end;
|
|
||||||
var style = state.pending.style;
|
|
||||||
} else {
|
|
||||||
var style = htmlMode.token(stream, state.curState);
|
|
||||||
}
|
|
||||||
state.pending = null;
|
|
||||||
var cur = stream.current(), openPHP = cur.search(/<\?/);
|
|
||||||
if (openPHP != -1) {
|
|
||||||
if (style == "string" && /\"$/.test(cur) && !/\?>/.test(cur)) state.pending = '"';
|
|
||||||
else state.pending = {end: stream.pos, style: style};
|
|
||||||
stream.backUp(cur.length - openPHP);
|
|
||||||
} else if (style == "tag" && stream.current() == ">" && state.curState.context) {
|
|
||||||
if (/^script$/i.test(state.curState.context.tagName)) {
|
|
||||||
state.curMode = jsMode;
|
|
||||||
state.curState = jsMode.startState(htmlMode.indent(state.curState, ""));
|
|
||||||
state.curClose = /^<\/\s*script\s*>/i;
|
|
||||||
state.mode = "javascript";
|
|
||||||
}
|
|
||||||
else if (/^style$/i.test(state.curState.context.tagName)) {
|
|
||||||
state.curMode = cssMode;
|
|
||||||
state.curState = cssMode.startState(htmlMode.indent(state.curState, ""));
|
|
||||||
state.curClose = /^<\/\s*style\s*>/i;
|
|
||||||
state.mode = "css";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
} else if ((!isPHP || state.php.tokenize == null) &&
|
|
||||||
stream.match(state.curClose, isPHP)) {
|
|
||||||
state.curMode = htmlMode;
|
|
||||||
state.curState = state.html;
|
|
||||||
state.curClose = null;
|
|
||||||
state.mode = "html";
|
|
||||||
if (isPHP) return "meta";
|
|
||||||
else return dispatch(stream, state);
|
|
||||||
} else {
|
|
||||||
return state.curMode.token(stream, state.curState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function() {
|
|
||||||
var html = htmlMode.startState();
|
|
||||||
return {html: html,
|
|
||||||
php: phpMode.startState(),
|
|
||||||
curMode: parserConfig.startOpen ? phpMode : htmlMode,
|
|
||||||
curState: parserConfig.startOpen ? phpMode.startState() : html,
|
|
||||||
curClose: parserConfig.startOpen ? /^\?>/ : null,
|
|
||||||
mode: parserConfig.startOpen ? "php" : "html",
|
|
||||||
pending: null}
|
|
||||||
},
|
|
||||||
|
|
||||||
copyState: function(state) {
|
|
||||||
var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
|
|
||||||
php = state.php, phpNew = CodeMirror.copyState(phpMode, php), cur;
|
|
||||||
if (state.curState == html) cur = htmlNew;
|
|
||||||
else if (state.curState == php) cur = phpNew;
|
|
||||||
else cur = CodeMirror.copyState(state.curMode, state.curState);
|
|
||||||
return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
|
|
||||||
curClose: state.curClose, mode: state.mode,
|
|
||||||
pending: state.pending};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: dispatch,
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
|
|
||||||
(state.curMode == phpMode && /^\?>/.test(textAfter)))
|
|
||||||
return htmlMode.indent(state.html, textAfter);
|
|
||||||
return state.curMode.indent(state.curState, textAfter);
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: "/{}:"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
|
||||||
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
|
||||||
CodeMirror.defineMIME("text/x-php", phpConfig);
|
|
||||||
})();
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
Copyright (c) 2011, Ubalo, Inc.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
* Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
* Neither the name of the Ubalo, Inc. nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived
|
|
||||||
from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: Ruby mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="ruby.js"></script>
|
|
||||||
<style>
|
|
||||||
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
|
||||||
.cm-s-default span.cm-arrow { color: red; }
|
|
||||||
</style>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: Ruby mode</h1>
|
|
||||||
<form><textarea id="code" name="code">
|
|
||||||
# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
|
|
||||||
#
|
|
||||||
# This program evaluates polynomials. It first asks for the coefficients
|
|
||||||
# of a polynomial, which must be entered on one line, highest-order first.
|
|
||||||
# It then requests values of x and will compute the value of the poly for
|
|
||||||
# each x. It will repeatly ask for x values, unless you the user enters
|
|
||||||
# a blank line. It that case, it will ask for another polynomial. If the
|
|
||||||
# user types quit for either input, the program immediately exits.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Function to evaluate a polynomial at x. The polynomial is given
|
|
||||||
# as a list of coefficients, from the greatest to the least.
|
|
||||||
def polyval(x, coef)
|
|
||||||
sum = 0
|
|
||||||
coef = coef.clone # Don't want to destroy the original
|
|
||||||
while true
|
|
||||||
sum += coef.shift # Add and remove the next coef
|
|
||||||
break if coef.empty? # If no more, done entirely.
|
|
||||||
sum *= x # This happens the right number of times.
|
|
||||||
end
|
|
||||||
return sum
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Function to read a line containing a list of integers and return
|
|
||||||
# them as an array of integers. If the string conversion fails, it
|
|
||||||
# throws TypeError. If the input line is the word 'quit', then it
|
|
||||||
# converts it to an end-of-file exception
|
|
||||||
def readints(prompt)
|
|
||||||
# Read a line
|
|
||||||
print prompt
|
|
||||||
line = readline.chomp
|
|
||||||
raise EOFError.new if line == 'quit' # You can also use a real EOF.
|
|
||||||
|
|
||||||
# Go through each item on the line, converting each one and adding it
|
|
||||||
# to retval.
|
|
||||||
retval = [ ]
|
|
||||||
for str in line.split(/\s+/)
|
|
||||||
if str =~ /^\-?\d+$/
|
|
||||||
retval.push(str.to_i)
|
|
||||||
else
|
|
||||||
raise TypeError.new
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Take a coeff and an exponent and return the string representation, ignoring
|
|
||||||
# the sign of the coefficient.
|
|
||||||
def term_to_str(coef, exp)
|
|
||||||
ret = ""
|
|
||||||
|
|
||||||
# Show coeff, unless it's 1 or at the right
|
|
||||||
coef = coef.abs
|
|
||||||
ret = coef.to_s unless coef == 1 && exp > 0
|
|
||||||
ret += "x" if exp > 0 # x if exponent not 0
|
|
||||||
ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
|
|
||||||
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create a string of the polynomial in sort-of-readable form.
|
|
||||||
def polystr(p)
|
|
||||||
# Get the exponent of first coefficient, plus 1.
|
|
||||||
exp = p.length
|
|
||||||
|
|
||||||
# Assign exponents to each term, making pairs of coeff and exponent,
|
|
||||||
# Then get rid of the zero terms.
|
|
||||||
p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
|
|
||||||
|
|
||||||
# If there's nothing left, it's a zero
|
|
||||||
return "0" if p.empty?
|
|
||||||
|
|
||||||
# *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
|
|
||||||
|
|
||||||
# Convert the first term, preceded by a "-" if it's negative.
|
|
||||||
result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
|
|
||||||
|
|
||||||
# Convert the rest of the terms, in each case adding the appropriate
|
|
||||||
# + or - separating them.
|
|
||||||
for term in p[1...p.length]
|
|
||||||
# Add the separator then the rep. of the term.
|
|
||||||
result += (if term[0] < 0 then " - " else " + " end) +
|
|
||||||
term_to_str(*term)
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
#
|
|
||||||
# Run until some kind of endfile.
|
|
||||||
begin
|
|
||||||
# Repeat until an exception or quit gets us out.
|
|
||||||
while true
|
|
||||||
# Read a poly until it works. An EOF will except out of the
|
|
||||||
# program.
|
|
||||||
print "\n"
|
|
||||||
begin
|
|
||||||
poly = readints("Enter a polynomial coefficients: ")
|
|
||||||
rescue TypeError
|
|
||||||
print "Try again.\n"
|
|
||||||
retry
|
|
||||||
end
|
|
||||||
break if poly.empty?
|
|
||||||
|
|
||||||
# Read and evaluate x values until the user types a blank line.
|
|
||||||
# Again, an EOF will except out of the pgm.
|
|
||||||
while true
|
|
||||||
# Request an integer.
|
|
||||||
print "Enter x value or blank line: "
|
|
||||||
x = readline.chomp
|
|
||||||
break if x == ''
|
|
||||||
raise EOFError.new if x == 'quit'
|
|
||||||
|
|
||||||
# If it looks bad, let's try again.
|
|
||||||
if x !~ /^\-?\d+$/
|
|
||||||
print "That doesn't look like an integer. Please try again.\n"
|
|
||||||
next
|
|
||||||
end
|
|
||||||
|
|
||||||
# Convert to an integer and print the result.
|
|
||||||
x = x.to_i
|
|
||||||
print "p(x) = ", polystr(poly), "\n"
|
|
||||||
print "p(", x, ") = ", polyval(x, poly), "\n"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
rescue EOFError
|
|
||||||
print "\n=== EOF ===\n"
|
|
||||||
rescue Interrupt, SignalException
|
|
||||||
print "\n=== Interrupted ===\n"
|
|
||||||
else
|
|
||||||
print "--- Bye ---\n"
|
|
||||||
end
|
|
||||||
</textarea></form>
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
||||||
mode: "text/x-ruby",
|
|
||||||
tabMode: "indent",
|
|
||||||
matchBrackets: true,
|
|
||||||
indentUnit: 4
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
|
|
||||||
|
|
||||||
<p>Development of the CodeMirror Ruby mode was kindly sponsored
|
|
||||||
by <a href="http://ubalo.com/">Ubalo</a>, who hold
|
|
||||||
the <a href="LICENSE">license</a>.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
CodeMirror.defineMode("ruby", function(config, parserConfig) {
|
|
||||||
function wordObj(words) {
|
|
||||||
var o = {};
|
|
||||||
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
var keywords = wordObj([
|
|
||||||
"alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
|
|
||||||
"elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
|
|
||||||
"redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
|
|
||||||
"until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
|
|
||||||
"caller", "lambda", "proc", "public", "protected", "private", "require", "load",
|
|
||||||
"require_relative", "extend", "autoload"
|
|
||||||
]);
|
|
||||||
var indentWords = wordObj(["def", "class", "case", "for", "while", "do", "module", "then",
|
|
||||||
"catch", "loop", "proc", "begin"]);
|
|
||||||
var dedentWords = wordObj(["end", "until"]);
|
|
||||||
var matching = {"[": "]", "{": "}", "(": ")"};
|
|
||||||
var curPunc;
|
|
||||||
|
|
||||||
function chain(newtok, stream, state) {
|
|
||||||
state.tokenize.push(newtok);
|
|
||||||
return newtok(stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenBase(stream, state) {
|
|
||||||
curPunc = null;
|
|
||||||
if (stream.sol() && stream.match("=begin") && stream.eol()) {
|
|
||||||
state.tokenize.push(readBlockComment);
|
|
||||||
return "comment";
|
|
||||||
}
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == "`" || ch == "'" || ch == '"' ||
|
|
||||||
(ch == "/" && !stream.eol() && stream.peek() != " ")) {
|
|
||||||
return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
|
|
||||||
} else if (ch == "%") {
|
|
||||||
var style, embed = false;
|
|
||||||
if (stream.eat("s")) style = "atom";
|
|
||||||
else if (stream.eat(/[WQ]/)) { style = "string"; embed = true; }
|
|
||||||
else if (stream.eat(/[wxqr]/)) style = "string";
|
|
||||||
var delim = stream.eat(/[^\w\s]/);
|
|
||||||
if (!delim) return "operator";
|
|
||||||
if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
|
|
||||||
return chain(readQuoted(delim, style, embed, true), stream, state);
|
|
||||||
} else if (ch == "#") {
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "comment";
|
|
||||||
} else if (ch == "<" && stream.eat("<")) {
|
|
||||||
stream.eat("-");
|
|
||||||
stream.eat(/[\'\"\`]/);
|
|
||||||
var match = stream.match(/^\w+/);
|
|
||||||
stream.eat(/[\'\"\`]/);
|
|
||||||
if (match) return chain(readHereDoc(match[0]), stream, state);
|
|
||||||
return null;
|
|
||||||
} else if (ch == "0") {
|
|
||||||
if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
|
|
||||||
else if (stream.eat("b")) stream.eatWhile(/[01]/);
|
|
||||||
else stream.eatWhile(/[0-7]/);
|
|
||||||
return "number";
|
|
||||||
} else if (/\d/.test(ch)) {
|
|
||||||
stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
|
|
||||||
return "number";
|
|
||||||
} else if (ch == "?") {
|
|
||||||
while (stream.match(/^\\[CM]-/)) {}
|
|
||||||
if (stream.eat("\\")) stream.eatWhile(/\w/);
|
|
||||||
else stream.next();
|
|
||||||
return "string";
|
|
||||||
} else if (ch == ":") {
|
|
||||||
if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
|
|
||||||
if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
|
|
||||||
stream.eatWhile(/[\w\?]/);
|
|
||||||
return "atom";
|
|
||||||
} else if (ch == "@") {
|
|
||||||
stream.eat("@");
|
|
||||||
stream.eatWhile(/[\w\?]/);
|
|
||||||
return "variable-2";
|
|
||||||
} else if (ch == "$") {
|
|
||||||
stream.next();
|
|
||||||
stream.eatWhile(/[\w\?]/);
|
|
||||||
return "variable-3";
|
|
||||||
} else if (/\w/.test(ch)) {
|
|
||||||
stream.eatWhile(/[\w\?]/);
|
|
||||||
if (stream.eat(":")) return "atom";
|
|
||||||
return "ident";
|
|
||||||
} else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
|
|
||||||
curPunc = "|";
|
|
||||||
return null;
|
|
||||||
} else if (/[\(\)\[\]{}\\;]/.test(ch)) {
|
|
||||||
curPunc = ch;
|
|
||||||
return null;
|
|
||||||
} else if (ch == "-" && stream.eat(">")) {
|
|
||||||
return "arrow";
|
|
||||||
} else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
|
|
||||||
stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
|
|
||||||
return "operator";
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function tokenBaseUntilBrace() {
|
|
||||||
var depth = 1;
|
|
||||||
return function(stream, state) {
|
|
||||||
if (stream.peek() == "}") {
|
|
||||||
depth--;
|
|
||||||
if (depth == 0) {
|
|
||||||
state.tokenize.pop();
|
|
||||||
return state.tokenize[state.tokenize.length-1](stream, state);
|
|
||||||
}
|
|
||||||
} else if (stream.peek() == "{") {
|
|
||||||
depth++;
|
|
||||||
}
|
|
||||||
return tokenBase(stream, state);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function readQuoted(quote, style, embed, unescaped) {
|
|
||||||
return function(stream, state) {
|
|
||||||
var escaped = false, ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (ch == quote && (unescaped || !escaped)) {
|
|
||||||
state.tokenize.pop();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (embed && ch == "#" && !escaped && stream.eat("{")) {
|
|
||||||
state.tokenize.push(tokenBaseUntilBrace(arguments.callee));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
escaped = !escaped && ch == "\\";
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function readHereDoc(phrase) {
|
|
||||||
return function(stream, state) {
|
|
||||||
if (stream.match(phrase)) state.tokenize.pop();
|
|
||||||
else stream.skipToEnd();
|
|
||||||
return "string";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function readBlockComment(stream, state) {
|
|
||||||
if (stream.sol() && stream.match("=end") && stream.eol())
|
|
||||||
state.tokenize.pop();
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "comment";
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function() {
|
|
||||||
return {tokenize: [tokenBase],
|
|
||||||
indented: 0,
|
|
||||||
context: {type: "top", indented: -config.indentUnit},
|
|
||||||
continuedLine: false,
|
|
||||||
lastTok: null,
|
|
||||||
varList: false};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (stream.sol()) state.indented = stream.indentation();
|
|
||||||
var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
|
|
||||||
if (style == "ident") {
|
|
||||||
var word = stream.current();
|
|
||||||
style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
|
|
||||||
: /^[A-Z]/.test(word) ? "tag"
|
|
||||||
: (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
|
|
||||||
: "variable";
|
|
||||||
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
|
|
||||||
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
|
|
||||||
else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
|
|
||||||
kwtype = "indent";
|
|
||||||
}
|
|
||||||
if (curPunc || (style && style != "comment")) state.lastTok = word || curPunc || style;
|
|
||||||
if (curPunc == "|") state.varList = !state.varList;
|
|
||||||
|
|
||||||
if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
|
|
||||||
state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
|
|
||||||
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
|
|
||||||
state.context = state.context.prev;
|
|
||||||
|
|
||||||
if (stream.eol())
|
|
||||||
state.continuedLine = (curPunc == "\\" || style == "operator");
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
|
||||||
if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
|
|
||||||
var firstChar = textAfter && textAfter.charAt(0);
|
|
||||||
var ct = state.context;
|
|
||||||
var closing = ct.type == matching[firstChar] ||
|
|
||||||
ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
|
|
||||||
return ct.indented + (closing ? 0 : config.indentUnit) +
|
|
||||||
(state.continuedLine ? config.indentUnit : 0);
|
|
||||||
},
|
|
||||||
electricChars: "}de" // enD and rescuE
|
|
||||||
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>CodeMirror: XML mode</title>
|
|
||||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
||||||
<script src="../../lib/codemirror.js"></script>
|
|
||||||
<script src="xml.js"></script>
|
|
||||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
||||||
<link rel="stylesheet" href="../../doc/docs.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>CodeMirror: XML mode</h1>
|
|
||||||
<form><textarea id="code" name="code">
|
|
||||||
<html style="color: green">
|
|
||||||
<!-- this is a comment -->
|
|
||||||
<head>
|
|
||||||
<title>HTML Example</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
The indentation tries to be <em>somewhat &quot;do what
|
|
||||||
I mean&quot;</em>... but might not match your style.
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
</textarea></form>
|
|
||||||
<script>
|
|
||||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
||||||
mode: {name: "xml", alignCDATA: true},
|
|
||||||
lineNumbers: true
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<p>The XML mode supports two configuration parameters:</p>
|
|
||||||
<dl>
|
|
||||||
<dt><code>htmlMode (boolean)</code></dt>
|
|
||||||
<dd>This switches the mode to parse HTML instead of XML. This
|
|
||||||
means attributes do not have to be quoted, and some elements
|
|
||||||
(such as <code>br</code>) do not require a closing tag.</dd>
|
|
||||||
<dt><code>alignCDATA (boolean)</code></dt>
|
|
||||||
<dd>Setting this to true will force the opening tag of CDATA
|
|
||||||
blocks to not be indented.</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,268 +0,0 @@
|
|||||||
CodeMirror.defineMode("xml", function(config, parserConfig) {
|
|
||||||
var indentUnit = config.indentUnit;
|
|
||||||
var Kludges = parserConfig.htmlMode ? {
|
|
||||||
autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true,
|
|
||||||
"meta": true, "col": true, "frame": true, "base": true, "area": true},
|
|
||||||
doNotIndent: {"pre": true},
|
|
||||||
allowUnquoted: true,
|
|
||||||
allowMissing: false
|
|
||||||
} : {autoSelfClosers: {}, doNotIndent: {}, allowUnquoted: false, allowMissing: false};
|
|
||||||
var alignCDATA = parserConfig.alignCDATA;
|
|
||||||
|
|
||||||
// Return variables for tokenizers
|
|
||||||
var tagName, type;
|
|
||||||
|
|
||||||
function inText(stream, state) {
|
|
||||||
function chain(parser) {
|
|
||||||
state.tokenize = parser;
|
|
||||||
return parser(stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == "<") {
|
|
||||||
if (stream.eat("!")) {
|
|
||||||
if (stream.eat("[")) {
|
|
||||||
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
else if (stream.match("--")) return chain(inBlock("comment", "-->"));
|
|
||||||
else if (stream.match("DOCTYPE", true, true)) {
|
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
|
||||||
return chain(doctype(1));
|
|
||||||
}
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
else if (stream.eat("?")) {
|
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
|
||||||
state.tokenize = inBlock("meta", "?>");
|
|
||||||
return "meta";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
type = stream.eat("/") ? "closeTag" : "openTag";
|
|
||||||
stream.eatSpace();
|
|
||||||
tagName = "";
|
|
||||||
var c;
|
|
||||||
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
|
|
||||||
state.tokenize = inTag;
|
|
||||||
return "tag";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ch == "&") {
|
|
||||||
var ok;
|
|
||||||
if (stream.eat("#")) {
|
|
||||||
if (stream.eat("x")) {
|
|
||||||
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
|
||||||
} else {
|
|
||||||
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
|
||||||
}
|
|
||||||
return ok ? "atom" : "error";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stream.eatWhile(/[^&<]/);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inTag(stream, state) {
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
type = ch == ">" ? "endTag" : "selfcloseTag";
|
|
||||||
return "tag";
|
|
||||||
}
|
|
||||||
else if (ch == "=") {
|
|
||||||
type = "equals";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else if (/[\'\"]/.test(ch)) {
|
|
||||||
state.tokenize = inAttribute(ch);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stream.eatWhile(/[^\s\u00a0=<>\"\'\/?]/);
|
|
||||||
return "word";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inAttribute(quote) {
|
|
||||||
return function(stream, state) {
|
|
||||||
while (!stream.eol()) {
|
|
||||||
if (stream.next() == quote) {
|
|
||||||
state.tokenize = inTag;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "string";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function inBlock(style, terminator) {
|
|
||||||
return function(stream, state) {
|
|
||||||
while (!stream.eol()) {
|
|
||||||
if (stream.match(terminator)) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
stream.next();
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function doctype(depth) {
|
|
||||||
return function(stream, state) {
|
|
||||||
var ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (ch == "<") {
|
|
||||||
state.tokenize = doctype(depth + 1);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
} else if (ch == ">") {
|
|
||||||
if (depth == 1) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
state.tokenize = doctype(depth - 1);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "meta";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var curState, setStyle;
|
|
||||||
function pass() {
|
|
||||||
for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
|
|
||||||
}
|
|
||||||
function cont() {
|
|
||||||
pass.apply(null, arguments);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushContext(tagName, startOfLine) {
|
|
||||||
var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
|
|
||||||
curState.context = {
|
|
||||||
prev: curState.context,
|
|
||||||
tagName: tagName,
|
|
||||||
indent: curState.indented,
|
|
||||||
startOfLine: startOfLine,
|
|
||||||
noIndent: noIndent
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function popContext() {
|
|
||||||
if (curState.context) curState.context = curState.context.prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
function element(type) {
|
|
||||||
if (type == "openTag") {
|
|
||||||
curState.tagName = tagName;
|
|
||||||
return cont(attributes, endtag(curState.startOfLine));
|
|
||||||
} else if (type == "closeTag") {
|
|
||||||
var err = false;
|
|
||||||
if (curState.context) {
|
|
||||||
err = curState.context.tagName != tagName;
|
|
||||||
} else {
|
|
||||||
err = true;
|
|
||||||
}
|
|
||||||
if (err) setStyle = "error";
|
|
||||||
return cont(endclosetag(err));
|
|
||||||
}
|
|
||||||
return cont();
|
|
||||||
}
|
|
||||||
function endtag(startOfLine) {
|
|
||||||
return function(type) {
|
|
||||||
if (type == "selfcloseTag" ||
|
|
||||||
(type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(curState.tagName.toLowerCase())))
|
|
||||||
return cont();
|
|
||||||
if (type == "endTag") {pushContext(curState.tagName, startOfLine); return cont();}
|
|
||||||
return cont();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function endclosetag(err) {
|
|
||||||
return function(type) {
|
|
||||||
if (err) setStyle = "error";
|
|
||||||
if (type == "endTag") { popContext(); return cont(); }
|
|
||||||
setStyle = "error";
|
|
||||||
return cont(arguments.callee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function attributes(type) {
|
|
||||||
if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
|
|
||||||
if (type == "endTag" || type == "selfcloseTag") return pass();
|
|
||||||
setStyle = "error";
|
|
||||||
return cont(attributes);
|
|
||||||
}
|
|
||||||
function attribute(type) {
|
|
||||||
if (type == "equals") return cont(attvalue, attributes);
|
|
||||||
if (!Kludges.allowMissing) setStyle = "error";
|
|
||||||
return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
|
|
||||||
}
|
|
||||||
function attvalue(type) {
|
|
||||||
if (type == "string") return cont(attvaluemaybe);
|
|
||||||
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
|
|
||||||
setStyle = "error";
|
|
||||||
return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
|
|
||||||
}
|
|
||||||
function attvaluemaybe(type) {
|
|
||||||
if (type == "string") return cont(attvaluemaybe);
|
|
||||||
else return pass();
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function() {
|
|
||||||
return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (stream.sol()) {
|
|
||||||
state.startOfLine = true;
|
|
||||||
state.indented = stream.indentation();
|
|
||||||
}
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
|
|
||||||
setStyle = type = tagName = null;
|
|
||||||
var style = state.tokenize(stream, state);
|
|
||||||
state.type = type;
|
|
||||||
if ((style || type) && style != "comment") {
|
|
||||||
curState = state;
|
|
||||||
while (true) {
|
|
||||||
var comb = state.cc.pop() || element;
|
|
||||||
if (comb(type || style)) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.startOfLine = false;
|
|
||||||
return setStyle || style;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter, fullLine) {
|
|
||||||
var context = state.context;
|
|
||||||
if ((state.tokenize != inTag && state.tokenize != inText) ||
|
|
||||||
context && context.noIndent)
|
|
||||||
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
|
||||||
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
|
||||||
if (context && /^<\//.test(textAfter))
|
|
||||||
context = context.prev;
|
|
||||||
while (context && !context.startOfLine)
|
|
||||||
context = context.prev;
|
|
||||||
if (context) return context.indent + indentUnit;
|
|
||||||
else return 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
compareStates: function(a, b) {
|
|
||||||
if (a.indented != b.indented || a.tokenize != b.tokenize) return false;
|
|
||||||
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
|
|
||||||
if (!ca || !cb) return ca == cb;
|
|
||||||
if (ca.tagName != cb.tagName) return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: "/"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("application/xml", "xml");
|
|
||||||
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
|
||||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (C) 2011 by Marijn Haverbeke <marijnh@gmail.com>
|
Copyright (C) 2013 by Marijn Haverbeke <marijnh@gmail.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
38
CodeMirror-3.12/addon/hint/show-hint.css
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
.CodeMirror-hints {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 10;
|
||||||
|
overflow: hidden;
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
margin: 0;
|
||||||
|
padding: 2px;
|
||||||
|
|
||||||
|
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||||
|
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||||
|
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid silver;
|
||||||
|
|
||||||
|
background: white;
|
||||||
|
font-size: 90%;
|
||||||
|
font-family: monospace;
|
||||||
|
|
||||||
|
max-height: 20em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-hint {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 4px;
|
||||||
|
border-radius: 2px;
|
||||||
|
max-width: 19em;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: pre;
|
||||||
|
color: black;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-hint-active {
|
||||||
|
background: #08f;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
7
CodeMirror-3.12/lib/codemirror-compressed.js
Normal file
246
CodeMirror-3.12/lib/codemirror.css
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
/* BASICS */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
/* Set height, width, borders, and global font properties here */
|
||||||
|
font-family: monospace;
|
||||||
|
height: 300px;
|
||||||
|
}
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
/* Set scrolling behaviour here */
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PADDING */
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
padding: 4px 0; /* Vertical padding around content */
|
||||||
|
}
|
||||||
|
.CodeMirror pre {
|
||||||
|
padding: 0 4px; /* Horizontal padding of content */
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
background-color: white; /* The little square between H and V scrollbars */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GUTTER */
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
border-right: 1px solid #ddd;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
}
|
||||||
|
.CodeMirror-linenumbers {}
|
||||||
|
.CodeMirror-linenumber {
|
||||||
|
padding: 0 3px 0 5px;
|
||||||
|
min-width: 20px;
|
||||||
|
text-align: right;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* CURSOR */
|
||||||
|
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
border-left: 1px solid black;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
/* Shown when moving in bi-directional text */
|
||||||
|
.CodeMirror div.CodeMirror-secondarycursor {
|
||||||
|
border-left: 1px solid silver;
|
||||||
|
}
|
||||||
|
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
|
||||||
|
width: auto;
|
||||||
|
border: 0;
|
||||||
|
background: #7e7;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
/* Can style cursor different in overwrite (non-insert) mode */
|
||||||
|
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
|
||||||
|
|
||||||
|
.cm-tab { display: inline-block; }
|
||||||
|
|
||||||
|
/* DEFAULT THEME */
|
||||||
|
|
||||||
|
.cm-s-default .cm-keyword {color: #708;}
|
||||||
|
.cm-s-default .cm-atom {color: #219;}
|
||||||
|
.cm-s-default .cm-number {color: #164;}
|
||||||
|
.cm-s-default .cm-def {color: #00f;}
|
||||||
|
.cm-s-default .cm-variable {color: black;}
|
||||||
|
.cm-s-default .cm-variable-2 {color: #05a;}
|
||||||
|
.cm-s-default .cm-variable-3 {color: #085;}
|
||||||
|
.cm-s-default .cm-property {color: black;}
|
||||||
|
.cm-s-default .cm-operator {color: black;}
|
||||||
|
.cm-s-default .cm-comment {color: #a50;}
|
||||||
|
.cm-s-default .cm-string {color: #a11;}
|
||||||
|
.cm-s-default .cm-string-2 {color: #f50;}
|
||||||
|
.cm-s-default .cm-meta {color: #555;}
|
||||||
|
.cm-s-default .cm-error {color: #f00;}
|
||||||
|
.cm-s-default .cm-qualifier {color: #555;}
|
||||||
|
.cm-s-default .cm-builtin {color: #30a;}
|
||||||
|
.cm-s-default .cm-bracket {color: #997;}
|
||||||
|
.cm-s-default .cm-tag {color: #170;}
|
||||||
|
.cm-s-default .cm-attribute {color: #00c;}
|
||||||
|
.cm-s-default .cm-header {color: blue;}
|
||||||
|
.cm-s-default .cm-quote {color: #090;}
|
||||||
|
.cm-s-default .cm-hr {color: #999;}
|
||||||
|
.cm-s-default .cm-link {color: #00c;}
|
||||||
|
|
||||||
|
.cm-negative {color: #d44;}
|
||||||
|
.cm-positive {color: #292;}
|
||||||
|
.cm-header, .cm-strong {font-weight: bold;}
|
||||||
|
.cm-em {font-style: italic;}
|
||||||
|
.cm-link {text-decoration: underline;}
|
||||||
|
|
||||||
|
.cm-invalidchar {color: #f00;}
|
||||||
|
|
||||||
|
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||||
|
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
||||||
|
|
||||||
|
/* STOP */
|
||||||
|
|
||||||
|
/* The rest of this file contains styles related to the mechanics of
|
||||||
|
the editor. You probably shouldn't touch them. */
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
line-height: 1;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-scroll {
|
||||||
|
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||||
|
/* See overflow: hidden in .CodeMirror */
|
||||||
|
margin-bottom: -30px; margin-right: -30px;
|
||||||
|
padding-bottom: 30px; padding-right: 30px;
|
||||||
|
height: 100%;
|
||||||
|
outline: none; /* Prevent dragging from highlighting the element */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.CodeMirror-sizer {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||||
|
before actuall scrolling happens, thus preventing shaking and
|
||||||
|
flickering artifacts. */
|
||||||
|
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 6;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.CodeMirror-vscrollbar {
|
||||||
|
right: 0; top: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-hscrollbar {
|
||||||
|
bottom: 0; left: 0;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: scroll;
|
||||||
|
}
|
||||||
|
.CodeMirror-scrollbar-filler {
|
||||||
|
right: 0; bottom: 0;
|
||||||
|
z-index: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-gutters {
|
||||||
|
position: absolute; left: 0; top: 0;
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter {
|
||||||
|
height: 100%;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
margin-bottom: -32px;
|
||||||
|
display: inline-block;
|
||||||
|
/* Hack to make IE7 behave */
|
||||||
|
*zoom:1;
|
||||||
|
*display:inline;
|
||||||
|
}
|
||||||
|
.CodeMirror-gutter-elt {
|
||||||
|
position: absolute;
|
||||||
|
cursor: default;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
.CodeMirror pre {
|
||||||
|
/* Reset some styles that the rest of the page might have set */
|
||||||
|
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||||
|
border-width: 0;
|
||||||
|
background: transparent;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre;
|
||||||
|
word-wrap: normal;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
z-index: 2;
|
||||||
|
position: relative;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.CodeMirror-wrap pre {
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
.CodeMirror-linebackground {
|
||||||
|
position: absolute;
|
||||||
|
left: 0; right: 0; top: 0; bottom: 0;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-linewidget {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-widget {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-wrap .CodeMirror-scroll {
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-measure {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%; height: 0px;
|
||||||
|
overflow: hidden;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.CodeMirror-measure pre { position: static; }
|
||||||
|
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
position: absolute;
|
||||||
|
visibility: hidden;
|
||||||
|
border-right: none;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
|
.CodeMirror-focused div.CodeMirror-cursor {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-selected { background: #d9d9d9; }
|
||||||
|
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
||||||
|
|
||||||
|
.cm-searching {
|
||||||
|
background: #ffa;
|
||||||
|
background: rgba(255, 255, 0, .4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
||||||
|
.CodeMirror span { *vertical-align: text-bottom; }
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
/* Hide the cursor when printing */
|
||||||
|
.CodeMirror div.CodeMirror-cursor {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
/* Port of TextMate's Blackboard theme */
|
/* Port of TextMate's Blackboard theme */
|
||||||
|
|
||||||
.cm-s-blackboard { background: #0C1021; color: #F8F8F8; }
|
.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
|
||||||
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
|
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
|
||||||
.cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; }
|
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
|
||||||
.cm-s-blackboard .CodeMirror-gutter-text { color: #888; }
|
.cm-s-blackboard .CodeMirror-linenumber { color: #888; }
|
||||||
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
|
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
|
||||||
|
|
||||||
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
|
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
|
.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
|
||||||
.cm-s-blackboard .cm-header { color: #FF6400; }
|
.cm-s-blackboard .cm-header { color: #FF6400; }
|
||||||
.cm-s-blackboard .cm-hr { color: #AEAEAE; }
|
.cm-s-blackboard .cm-hr { color: #AEAEAE; }
|
||||||
.cm-s-blackboard .cm-link { color: #8DA6CE; }
|
.cm-s-blackboard .cm-link { color: #8DA6CE; }
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
.cm-s-cobalt { background: #002240; color: white; }
|
.cm-s-cobalt.CodeMirror { background: #002240; color: white; }
|
||||||
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
|
.cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; }
|
||||||
.cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
|
.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
.cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
|
.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
|
.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
.cm-s-cobalt span.cm-comment { color: #08f; }
|
.cm-s-cobalt span.cm-comment { color: #08f; }
|
||||||
@@ -20,6 +20,6 @@
|
|||||||
.cm-s-eclipse span.cm-link {color: #219;}
|
.cm-s-eclipse span.cm-link {color: #219;}
|
||||||
|
|
||||||
.cm-s-eclipse .CodeMirror-matchingbracket {
|
.cm-s-eclipse .CodeMirror-matchingbracket {
|
||||||
border:1px solid grey;
|
outline:1px solid grey;
|
||||||
color:black !important;;
|
color:black !important;
|
||||||
}
|
}
|
||||||
21
CodeMirror-3.12/theme/erlang-dark.css
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
|
||||||
|
.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
|
.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-erlang-dark span.cm-atom { color: #845dc4; }
|
||||||
|
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
|
||||||
|
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
|
||||||
|
.cm-s-erlang-dark span.cm-builtin { color: #eaa; }
|
||||||
|
.cm-s-erlang-dark span.cm-comment { color: #77f; }
|
||||||
|
.cm-s-erlang-dark span.cm-def { color: #e7a; }
|
||||||
|
.cm-s-erlang-dark span.cm-error { color: #9d1e15; }
|
||||||
|
.cm-s-erlang-dark span.cm-keyword { color: #ffee80; }
|
||||||
|
.cm-s-erlang-dark span.cm-meta { color: #50fefe; }
|
||||||
|
.cm-s-erlang-dark span.cm-number { color: #ffd0d0; }
|
||||||
|
.cm-s-erlang-dark span.cm-operator { color: #d11; }
|
||||||
|
.cm-s-erlang-dark span.cm-string { color: #3ad900; }
|
||||||
|
.cm-s-erlang-dark span.cm-tag { color: #9effff; }
|
||||||
|
.cm-s-erlang-dark span.cm-variable { color: #50fe50; }
|
||||||
|
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
|
||||||
@@ -2,28 +2,27 @@
|
|||||||
http://lesscss.org/ dark theme
|
http://lesscss.org/ dark theme
|
||||||
Ported to CodeMirror by Peter Kroon
|
Ported to CodeMirror by Peter Kroon
|
||||||
*/
|
*/
|
||||||
.CodeMirror{
|
.cm-s-lesser-dark {
|
||||||
line-height: 15px;
|
line-height: 1.3em;
|
||||||
}
|
}
|
||||||
.cm-s-lesser-dark {
|
.cm-s-lesser-dark {
|
||||||
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
|
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
|
||||||
font-size:12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
|
.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
|
||||||
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
|
.cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/
|
||||||
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
.cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/
|
.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
|
||||||
|
|
||||||
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
|
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
|
||||||
|
|
||||||
.cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; }
|
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
|
||||||
.cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; }
|
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
|
||||||
|
|
||||||
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
|
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
|
||||||
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
|
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
|
||||||
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
|
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
|
||||||
.cm-s-lesser-dark span.cm-def {color: color: white;}
|
.cm-s-lesser-dark span.cm-def {color: white;}
|
||||||
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
|
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
|
||||||
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
|
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
|
||||||
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
|
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
|
||||||
52
CodeMirror-3.12/theme/midnight.css
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
|
||||||
|
|
||||||
|
/*<!--breakpoint-->*/
|
||||||
|
.breakpoints {width: .8em;}
|
||||||
|
.breakpoint { color: #822; }
|
||||||
|
|
||||||
|
/*<!--match-->*/
|
||||||
|
span.CodeMirror-matchhighlight { background: #494949 }
|
||||||
|
.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67; !important }
|
||||||
|
|
||||||
|
/*<!--activeline-->*/
|
||||||
|
.activeline {background: #253540 !important;}
|
||||||
|
|
||||||
|
.cm-s-midnight.CodeMirror {
|
||||||
|
background: #0F192A;
|
||||||
|
color: #D1EDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||||
|
|
||||||
|
.cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;}
|
||||||
|
.cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;}
|
||||||
|
.cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;}
|
||||||
|
.cm-s-midnight .CodeMirror-cursor {
|
||||||
|
border-left: 1px solid #F8F8F0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-comment {color: #428BDD;}
|
||||||
|
.cm-s-midnight span.cm-atom {color: #AE81FF;}
|
||||||
|
.cm-s-midnight span.cm-number {color: #D1EDFF;}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-property, .cm-s-tropicaleve span.cm-attribute {color: #A6E22E;}
|
||||||
|
.cm-s-midnight span.cm-keyword {color: #E83737;}
|
||||||
|
.cm-s-midnight span.cm-string {color: #1DC116;}
|
||||||
|
|
||||||
|
.cm-s-midnight span.cm-variable {color: #FFAA3E;}
|
||||||
|
.cm-s-midnight span.cm-variable-2 {color: #FFAA3E;}
|
||||||
|
.cm-s-midnight span.cm-def {color: #4DD;}
|
||||||
|
.cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;}
|
||||||
|
.cm-s-midnight span.cm-bracket {color: #D1EDFF;}
|
||||||
|
.cm-s-midnight span.cm-tag {color: #008;}
|
||||||
|
.cm-s-midnight span.cm-link {color: #AE81FF;}
|
||||||
|
|
||||||
|
.cm-s-midnight .CodeMirror-matchingbracket {
|
||||||
|
text-decoration: underline;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.typ { color: #FFAA3E; }
|
||||||
|
.atn { color: #606; }
|
||||||
|
.atv { color: #080; }
|
||||||
|
.dec { color: #606; }
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
/* Based on Sublime Text's Monokai theme */
|
/* Based on Sublime Text's Monokai theme */
|
||||||
|
|
||||||
.cm-s-monokai {background: #272822; color: #f8f8f2;}
|
.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
|
||||||
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
|
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
|
||||||
.cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;}
|
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
|
||||||
.cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;}
|
.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
|
||||||
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
|
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
|
||||||
|
|
||||||
.cm-s-monokai span.cm-comment {color: #75715e;}
|
.cm-s-monokai span.cm-comment {color: #75715e;}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
/* Loosely based on the Midnight Textmate theme */
|
/* Loosely based on the Midnight Textmate theme */
|
||||||
|
|
||||||
.cm-s-night { background: #0a001f; color: #f8f8f8; }
|
.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||||
.cm-s-night div.CodeMirror-selected { background: #a8f !important; }
|
.cm-s-night div.CodeMirror-selected { background: #447 !important; }
|
||||||
.cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
|
||||||
.cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
|
.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
|
||||||
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
|
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
.cm-s-night span.cm-comment { color: #6900a1; }
|
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
.cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
.cm-s-rubyblue { font-family: Trebuchet, Verdana, sans-serif; } /* - customized editor font - */
|
||||||
|
|
||||||
.cm-s-rubyblue { background: #112435; color: white; }
|
.cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
|
||||||
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
|
.cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; }
|
||||||
.cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; }
|
.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
|
||||||
.cm-s-rubyblue .CodeMirror-gutter-text { color: white; }
|
.cm-s-rubyblue .CodeMirror-linenumber { color: white; }
|
||||||
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
|
.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
|
.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
|
||||||
207
CodeMirror-3.12/theme/solarized.css
Normal file
26
CodeMirror-3.12/theme/twilight.css
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
|
||||||
|
.cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/
|
||||||
|
|
||||||
|
.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
|
||||||
|
.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
|
||||||
|
.cm-s-twilight .cm-atom { color: #FC0; }
|
||||||
|
.cm-s-twilight .cm-number { color: #ca7841; } /**/
|
||||||
|
.cm-s-twilight .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
|
||||||
|
.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
|
||||||
|
.cm-s-twilight .cm-operator { color: #cda869; } /**/
|
||||||
|
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
|
||||||
|
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
|
||||||
|
.cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/
|
||||||
|
.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
|
||||||
|
.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
|
||||||
|
.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
|
||||||
|
.cm-s-twilight .cm-tag { color: #997643; } /**/
|
||||||
|
.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
|
||||||
|
.cm-s-twilight .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-twilight .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
|
||||||
|
|
||||||
27
CodeMirror-3.12/theme/vibrant-ink.css
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/* Taken from the popular Visual Studio Vibrant Ink Schema */
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; }
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
|
||||||
|
.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
|
.cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
|
||||||
|
.cm-s-vibrant-ink .cm-atom { color: #FC0; }
|
||||||
|
.cm-s-vibrant-ink .cm-number { color: #FFEE98; }
|
||||||
|
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D }
|
||||||
|
.cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D }
|
||||||
|
.cm-s-vibrant-ink .cm-operator { color: #888; }
|
||||||
|
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
|
||||||
|
.cm-s-vibrant-ink .cm-string { color: #A5C25C }
|
||||||
|
.cm-s-vibrant-ink .cm-string-2 { color: red }
|
||||||
|
.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
|
||||||
|
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
|
||||||
|
.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
|
||||||
|
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
|
||||||
|
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
|
||||||
|
.cm-s-vibrant-ink .cm-link { color: blue; }
|
||||||
@@ -20,10 +20,10 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
.cm-s-xq-dark { background: #0a001f; color: #f8f8f8; }
|
.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
|
||||||
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
.cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; }
|
||||||
.cm-s-xq-dark .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
|
.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
|
||||||
.cm-s-xq-dark .CodeMirror-gutter-text { color: #f8f8f8; }
|
.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
|
||||||
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||||
|
|
||||||
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
.cm-s-xq-dark span.cm-keyword {color: #FFBD40;}
|
||||||
43
CodeMirror-3.12/theme/xq-light.css
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Copyright (C) 2011 by MarkLogic Corporation
|
||||||
|
Author: Mike Brevoort <mike@brevoort.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
.cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; }
|
||||||
|
.cm-s-xq-light span.cm-atom {color: #6C8CD5;}
|
||||||
|
.cm-s-xq-light span.cm-number {color: #164;}
|
||||||
|
.cm-s-xq-light span.cm-def {text-decoration:underline;}
|
||||||
|
.cm-s-xq-light span.cm-variable {color: black; }
|
||||||
|
.cm-s-xq-light span.cm-variable-2 {color:black;}
|
||||||
|
.cm-s-xq-light span.cm-variable-3 {color: black; }
|
||||||
|
.cm-s-xq-light span.cm-property {}
|
||||||
|
.cm-s-xq-light span.cm-operator {}
|
||||||
|
.cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;}
|
||||||
|
.cm-s-xq-light span.cm-string {color: red;}
|
||||||
|
.cm-s-xq-light span.cm-meta {color: yellow;}
|
||||||
|
.cm-s-xq-light span.cm-error {color: #f00;}
|
||||||
|
.cm-s-xq-light span.cm-qualifier {color: grey}
|
||||||
|
.cm-s-xq-light span.cm-builtin {color: #7EA656;}
|
||||||
|
.cm-s-xq-light span.cm-bracket {color: #cc7;}
|
||||||
|
.cm-s-xq-light span.cm-tag {color: #3F7F7F;}
|
||||||
|
.cm-s-xq-light span.cm-attribute {color: #7F007F;}
|
||||||
|
|
||||||
|
.cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;}
|
||||||
|
.cm-s-xq-light .CodeMirror-matchingbracket {border:1px solid grey;color:black !important;background:yellow;}
|
||||||
30
LICENSE.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Copyright: © 2013 Matt Pass
|
||||||
|
Website: mattpass.com
|
||||||
|
Email: matt@mattpass.com
|
||||||
|
Twitter: @mattpass
|
||||||
|
|
||||||
|
#ICEcoder License
|
||||||
|
##Standard Open Source Initiative MIT License
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
|
||||||
|
```
|
||||||
|
Please note that this LICENSE file covers the ICEcoder shell IDE only and 3rd
|
||||||
|
party code, in subfolders such as CodeMirror and plugins, may contain their
|
||||||
|
own LICENSE files, and may not also be an MIT licence.
|
||||||
|
```
|
||||||
78
README.md
@@ -1,27 +1,79 @@
|
|||||||
ICE coder :: Matt Pass
|
#ICEcoder
|
||||||
|
##Web IDE / browser code editor awesomeness
|
||||||
|
|
||||||
Demo: http://www.mattpass.com/_coder
|
ICEcoder is a web IDE / browser based code editor, which allows you to develop websites directly within the web browser. It uses the brilliant CodeMirror for code highlighting & editing, with a slick IDE wrapped around it to make the whole thing work.
|
||||||
|
|
||||||
Early version of the web based IDE which allows for creation of websites in the web browser.
|
<img src="http://icecoder.net/images/icecoder-v2-4-browser-code-editor.png" alt="ICEcoder web IDE">
|
||||||
|
|
||||||
Uses the brilliant CodeMirror plus some other PHP & JS code to deal with file handling and make the whole thing work. Also has the extra plugin 'Adminer' for DB management.
|
###Requirements
|
||||||
|
You can run ICEcoder either online or locally, on Linux, Windows or Mac based platforms. The only requirement is to have PHP 5 available (5.3 recommended). You can have this either as a vanilla installation or via a program such as WAMP or XAMPP (for Windows) or MAMP (for Mac).
|
||||||
|
|
||||||
Is fully open source and I'd encourage you to take it, make it your own and customise to your hearts content! :)
|
###Features you'd expect
|
||||||
|
* Context aware code highlighting
|
||||||
|
* Supports HTML, CSS, LESS, JavaScript, CoffeeScript, PHP, Python, Ruby, Markdown & more
|
||||||
|
* Smart tab key system (selected text indents line)
|
||||||
|
* File manager
|
||||||
|
* Find & replace/replace all
|
||||||
|
* Document tabs indicate current doc & changes made
|
||||||
|
* Code folding
|
||||||
|
* Open last files on load
|
||||||
|
* Web based, access from anywhere
|
||||||
|
* Free, open source & customisable
|
||||||
|
|
||||||
Suitable for commercial & non-commercial projects, just let me know if it's useful to you and any cool customisations you make to it.
|
###Cool features you wouldn't expect
|
||||||
|
* Find & replace in current doc, open docs, files & filenames
|
||||||
|
* Found match & current position counter
|
||||||
|
* Indicates content type cursor is on
|
||||||
|
* Account login to keep certain files secure
|
||||||
|
* Restrict files, ban files and restrict by IP
|
||||||
|
* Settings to change functionality & editor theme
|
||||||
|
* Code Assist system
|
||||||
|
* Displays nest position of text cursor, hover to select, click to set cursor
|
||||||
|
* Nest structure OK/broken indicator
|
||||||
|
* Highlight word and press CTRL+I to Google search that
|
||||||
|
* Adds end tags as you type and in a context aware way
|
||||||
|
* Can rename open files (whoaah!)
|
||||||
|
* CTRL+Enter open current webpage in new tab
|
||||||
|
* Window to view live edits
|
||||||
|
* ESC = Comment/Uncomment line, incl partial lines
|
||||||
|
* Image viewer
|
||||||
|
* Colour preview block on CSS colours, ie red, #f00 or RGBA(255,0,0,0.5)
|
||||||
|
* MySQL Database management via Adminer plugin
|
||||||
|
* Backs up files every 30 mins or on click of backup plugin icon
|
||||||
|
* Github repo syncing with ICErepo plugin
|
||||||
|
* Linux terminal
|
||||||
|
* JS Hint validation as you type
|
||||||
|
* Emmet snippet typing booster
|
||||||
|
* HTML & JavaScript code hinting
|
||||||
|
* Alphanumeric tab sorting
|
||||||
|
* Tag wrappers
|
||||||
|
* Config template
|
||||||
|
* Farbtastic color picker integrated
|
||||||
|
|
||||||
Please feel free to assist with the development of this and maybe in time we can produce a fantastic web based IDE for web devs.
|
###Installation
|
||||||
|
|
||||||
INSTALLATION
|
####Step 1: Clone the repo
|
||||||
|
|
||||||
1.Open /lib/settings.php and adjust variables to suit
|
```
|
||||||
|
$ git clone git@github:mattpass/ICEcoder
|
||||||
|
```
|
||||||
|
|
||||||
2.Upload all the files to a Linux or Windows host under a new sub-dir URL such as yourdomain.com/_coder. Set public write permissions on the settings.php file
|
####Step 2: Place in your document root (online or local)
|
||||||
|
```
|
||||||
|
Put in a new sub-dir URL such as yourdomain.com/_coder or localhost/_coder
|
||||||
|
Set write permissions (757 or 775 depending on your system) on the 'backups', 'lib' and 'test' folders plus 'test/test-file1.txt'
|
||||||
|
```
|
||||||
|
|
||||||
3.Visit this URL in your browser and set a password
|
####Step 3: Start coding
|
||||||
|
```
|
||||||
|
Visit the sub-dir URL in your browser and enter a password
|
||||||
|
Now you're setup, auto-logged in and ready to code!
|
||||||
|
```
|
||||||
|
|
||||||
4.Now you have top level access and can save (CTRL+S), delete (DEL) etc
|
Suitable for commercial & non-commercial projects, just let me know if it's useful to you and any cool customisations you make to it. I take no responsibility for anything, your usage is all down to you.
|
||||||
|
|
||||||
Plenty of comments included in the code to assist with understanding.
|
It's fully open source and MIT licensed. I'm happy for you to take it, make it your own and customise to your hearts content and/or contribute to this main repo! :)
|
||||||
|
|
||||||
|
Plenty of comments included in the code to assist with understanding, customising etc.
|
||||||
|
|
||||||
Comments, improvements & feedback welcomed!
|
Comments, improvements & feedback welcomed!
|
||||||
0
backups/.gitkeep
Normal file
330
editor.php
@@ -1,136 +1,240 @@
|
|||||||
|
<?php include("lib/settings.php");?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html style="margin: 0px">
|
<html style="margin: 0" onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'editor');top.ICEcoder.canResizeFilesW()}">
|
||||||
<head>
|
<head>
|
||||||
<title>CodeMirror 2: ICE Coders Editor of Choice</title>
|
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> editor</title>
|
||||||
<?php include("lib/settings.php");?>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<link rel="stylesheet" href="<?php echo $codeMirrorDir; ?>/lib/codemirror.css">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/lib/codemirror.js"></script>
|
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror.css">
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/xml/xml.js"></script>
|
<link rel="stylesheet" href="<?php echo $ICEcoder["codeMirrorDir"]; ?>/addon/hint/show-hint.css">
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/javascript/javascript.js"></script>
|
<!--
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/css/css.js"></script>
|
codemirror-compressed.js
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/clike/clike.js"></script>
|
incls: codemirror
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/php/php.js"></script>
|
modes: clike, coffeescript, css, htmlmixed, javascript, less, markdown, php, python, ruby & xml
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/mode/ruby/ruby.js"></script>
|
utils: closetag, foldcode, xml-fold, brace-fold, show-hint, javascript-hint, html-hint, searchcursor, match-highlighter
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/searchcursor.js"></script>
|
//-->
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/match-highlighter.js"></script>
|
<script src="<?php echo $ICEcoder["codeMirrorDir"]; ?>/lib/codemirror-compressed.js"></script>
|
||||||
<script src="<?php echo $codeMirrorDir; ?>/lib/util/foldcode.js"></script>
|
<script src="lib/mmd.js"></script>
|
||||||
<?php
|
<?php
|
||||||
if ($theme=="default") {
|
if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
|
||||||
echo '<link rel="stylesheet" href="lib/editor.css">';
|
echo '<script src="plugins/emmet/emmet.min.js"></script>';
|
||||||
} else {
|
};?>
|
||||||
echo '<link rel="stylesheet" href="'.$codeMirrorDir.'/theme/'.$theme.'.css">';
|
<link rel="stylesheet" href="<?php
|
||||||
}
|
if ($ICEcoder["theme"]=="default") {echo 'lib/editor.css';} else {echo $ICEcoder["codeMirrorDir"].'/theme/'.$ICEcoder["theme"].'.css';};
|
||||||
?>
|
$activeLineBG = array_search($ICEcoder["theme"],array("eclipse","elegant","neat")) !== false ? "#ccc" : "#000";
|
||||||
|
?>">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.CodeMirror {position: absolute; width: 0px; background-color: #ffffff}
|
/* Make sure this next one remains the 1st item, updated with JS */
|
||||||
.CodeMirror-scroll {width: 100px; height: 100px;}
|
.CodeMirror {position: absolute; top: 0px; width: 100%; font-size: <?php echo $ICEcoder["fontSize"];?>; z-index: 1}
|
||||||
.cm-s-visible {display: block; top: 0px}
|
.CodeMirror-scroll {} /* was: height: auto; overflow: visible */
|
||||||
.cm-s-hidden {display: none; top: 4000px}
|
/* Make sure this next one remains the 3rd item, updated with JS */
|
||||||
.cm-s-activeLine {background: #002 !important;}
|
.cm-s-activeLine {background: <?php echo $activeLineBG;?> !important}
|
||||||
<?php if ($visibleTabs) {?>
|
.cm-matchhighlight, .CodeMirror-focused .cm-matchhighlight {color: #fff !important; background: #06c !important}
|
||||||
.cm-tab:after {position: relative; display: inline-block; width: 0px; left: -1.4em; overflow: visible; color: #aaa; content: "\21e5";}
|
/* Make sure this next one remains the 5th item, updated with JS */
|
||||||
<?;};?>
|
.cm-tab:after {position: relative; display: inline-block; width: 0; left: -1.4em; overflow: visible; color: #aaa; content: "<?php if($ICEcoder["visibleTabs"]) {echo '\\21e5';};?>";}
|
||||||
span.CodeMirror-matchhighlight {background: #555555}
|
.lint-error {font-family: arial; font-size: 80%; background: #ccc; color: #b00; padding: 3px 5px}
|
||||||
.CodeMirror-focused span.CodeMirror-matchhighlight {color: #000000; background: #555555; !important}
|
.lint-error-icon {background: #b00; color: #fff; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 5px}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="margin: 0px" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
<body style="color: #fff; margin: 0" onKeyDown="return top.ICEcoder.interceptKeys('content', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||||
|
|
||||||
|
<?php if ($ICEcoder['demoMode']) {?>
|
||||||
|
<div style="position: absolute; display: inline-block; width: 99px; height: 50px; top: 0; right: 30px; background: url('images/big-arrow.gif') 0 -10px no-repeat; text-align: center; font-family: arial; font-size: 10px; padding-top: 60px"><b>Click logo<br>for help &<br>usage info</b></div>
|
||||||
|
<?php ;}; ?>
|
||||||
|
|
||||||
|
<div style="display: none; margin: 32px 43px 0 43px; padding: 10px; width: 500px; font-family: arial; font-size: 10px; color: #ddd; background: #333" id="dataMessage"></div>
|
||||||
|
|
||||||
|
<div style="margin: 20px 43px 32px 43px; font-family: arial; font-size: 10px; color: #ddd">
|
||||||
|
<div style="float: left; margin-right: 50px">
|
||||||
|
<h2 style="color: rgba(0,198,255,0.7)">server</h2>
|
||||||
|
<span style="color:#888">Server name, OS & IP:</span><br>
|
||||||
|
<?php echo $_SERVER['SERVER_NAME']."   ".$_SERVER['SERVER_SOFTWARE']."   ".$_SERVER['SERVER_ADDR'];?><br><br>
|
||||||
|
<span style="color:#888">Root:</span><br>
|
||||||
|
<?php echo $docRoot;?><br><br>
|
||||||
|
<span style="color:#888">ICEcoder root:</span><br>
|
||||||
|
<?php echo $docRoot.$iceRoot;?><br><br>
|
||||||
|
<span style="color:#888">PHP version:</span><br>
|
||||||
|
<?php echo phpversion();?><br><br>
|
||||||
|
<span style="color:#888">Date & time:</span><br>
|
||||||
|
<span id="serverDT"></span><br><br><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="float: left">
|
||||||
|
<h2 style="color: rgba(0,198,255,0.7)">files</h2>
|
||||||
|
<span style="color:#888">Last 10 files opened:</span><br>
|
||||||
|
<?php
|
||||||
|
$last10FilesArray = explode(",",$ICEcoder["last10Files"]);
|
||||||
|
for ($i=0;$i<count($last10FilesArray);$i++) {
|
||||||
|
if ($ICEcoder["last10Files"]=="") {
|
||||||
|
echo '[none]<br><br>';
|
||||||
|
} else {
|
||||||
|
echo '<a style="cursor:pointer" onClick="top.ICEcoder.openFile(\''.str_replace("|","/",$last10FilesArray[$i]).'\')">';
|
||||||
|
echo str_replace($docRoot,"",str_replace("|","/",$last10FilesArray[$i]));
|
||||||
|
echo '</a><br>'.PHP_EOL;
|
||||||
|
if ($i==count($last10FilesArray)-1) {echo '<br>'.PHP_EOL;};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="clear: both">
|
||||||
|
<h2 style="color: rgba(0,198,255,0.7)">your device</h2>
|
||||||
|
<span style="color:#888">Browser:</span><br>
|
||||||
|
<?php echo $_SERVER['HTTP_USER_AGENT'];?><br><br>
|
||||||
|
<span style="color:#888">Your IP:</span><br>
|
||||||
|
<?php echo $_SERVER['REMOTE_ADDR'];?>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var nDT=<?php echo time()*1000;?>;
|
||||||
|
setInterval(function(){
|
||||||
|
var s=(new Date(nDT+=1e3)+'').split(' '),
|
||||||
|
d=s[2]*1,
|
||||||
|
t=s[4].split(':'),
|
||||||
|
p=t[0]>11?'pm':'am',
|
||||||
|
e=d%20==1|d>30?'st':d%20==2?'nd':d%20==3?'rd':'th';
|
||||||
|
t[0]=--t[0]%12+1;
|
||||||
|
if (document.getElementById('serverDT')) {
|
||||||
|
document.getElementById('serverDT').innerHTML=[s[0],d+e,s[1],s[3],t.join(':')+p].join(' ');
|
||||||
|
}
|
||||||
|
},1000);
|
||||||
|
</script>
|
||||||
|
<?php if(is_dir('test') && !$ICEcoder['demoMode']) {?>
|
||||||
|
<div style="clear: both">
|
||||||
|
<br><br>
|
||||||
|
<h2 style="color: rgba(0,198,255,0.7)">test suite</h2>
|
||||||
|
<span style="color:#888">Run unit tests:</span><br>
|
||||||
|
<a href="javascript:top.ICEcoder.filesFrame.contentWindow.frames['testControl'].location.href = 'test'" style="color: #fff">Run unit tests</a><div id="unitTestResults"></div>
|
||||||
|
</div>
|
||||||
|
<?php ;};?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
CodeMirror.keyMap.ICEcoder = {
|
||||||
|
// "Tab": "defaultTab", **Now used by Emmet**
|
||||||
|
"Shift-Tab": "indentLess",
|
||||||
|
"Ctrl-Space": "autocomplete",
|
||||||
|
fallthrough: ["default"]
|
||||||
|
};
|
||||||
|
CodeMirror.commands.autocomplete = function(cm) {
|
||||||
|
if (top.ICEcoder.caretLocType=="JavaScript") {
|
||||||
|
CodeMirror.showHint(cm, CodeMirror.javascriptHint);
|
||||||
|
} else {
|
||||||
|
CodeMirror.showHint(cm, CodeMirror.htmlHint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createNewCMInstance(num) {
|
function createNewCMInstance(num) {
|
||||||
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
var fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||||
var codeFold = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder,'<span style=\"display: inline-block; width: 13px; height: 13px; background-color: #bb0000; color: #ffffff; text-align: center; cursor: pointer\"><span style="position: relative; top: -1px">+</span></span> %N%');
|
top.ICEcoder['cM'+num+'waiting'] = "";
|
||||||
var codeFold_JS_PHP_Ruby = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder,'<span style=\"display: inline-block; width: 13px; height: 13px; background-color: #bb0000; color: #ffffff; text-align: center; cursor: pointer\"><span style="position: relative; top: -1px">+</span></span> %N%');
|
top.ICEcoder['cM'+num+'widgets'] = [];
|
||||||
|
|
||||||
window['cM'+num] = CodeMirror(document.body, {
|
window['cM'+num] = CodeMirror(document.body, {
|
||||||
mode: "application/x-httpd-php",
|
mode: "application/x-httpd-php",
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
lineWrapping: true,
|
lineWrapping: top.ICEcoder.lineWrapping,
|
||||||
indentUnit: 4,
|
indentWithTabs: top.ICEcoder.indentWithTabs,
|
||||||
tabSize: 4,
|
indentUnit: top.ICEcoder.indentSize,
|
||||||
indentWithTabs: true,
|
tabSize: top.ICEcoder.indentSize,
|
||||||
electricChars: false,
|
electricChars: false,
|
||||||
onCursorActivity: function() {
|
autoCloseTags: true,
|
||||||
top.ICEcoder.getCaretPosition();
|
highlightSelectionMatches: true,
|
||||||
top.ICEcoder.updateCharDisplay();
|
keyMap: "ICEcoder",
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab], null);
|
onKeyEvent: function(thisCM, e) {
|
||||||
if(!window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].somethingSelected()) {
|
top.ICEcoder.redoChangedContent(e);
|
||||||
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor().line, "cm-s-activeLine");
|
top.ICEcoder.findReplace(top.document.getElementById('find').value,true,false);
|
||||||
|
top.ICEcoder.getCaretPosition();
|
||||||
|
top.ICEcoder.updateCharDisplay();
|
||||||
|
tok = thisCM.getTokenAt(thisCM.getCursor());
|
||||||
}
|
}
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].matchHighlight("CodeMirror-matchhighlight");
|
|
||||||
top.ICEcoder.cssColorPreview();
|
|
||||||
},
|
|
||||||
onChange: function() {
|
|
||||||
// If we're not loading the file, it's a change, so update tab
|
|
||||||
if (!top.ICEcoder.loadingFile) {
|
|
||||||
top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 1;
|
|
||||||
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
|
|
||||||
}
|
|
||||||
top.ICEcoder.getCaretPosition();
|
|
||||||
top.ICEcoder.dontUpdateNest = false;
|
|
||||||
top.ICEcoder.updateCharDisplay();
|
|
||||||
top.ICEcoder.updateNestingIndicator();
|
|
||||||
if (top.ICEcoder.findMode) {
|
|
||||||
top.ICEcoder.results.splice(top.ICEcoder.findResult,1);
|
|
||||||
top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results";
|
|
||||||
top.ICEcoder.findMode = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onKeyEvent: function(instance, e) {
|
|
||||||
top.ICEcoder.redoChangedContent(event);
|
|
||||||
top.ICEcoder.findReplace('find',true);
|
|
||||||
top.ICEcoder.getCaretPosition();
|
|
||||||
top.ICEcoder.updateCharDisplay();
|
|
||||||
tok = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getTokenAt(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor());
|
|
||||||
if (tok.string!=">") {lastString=tok.string};
|
|
||||||
if (e.type=="keyup"&&e.keyCode=="16"&&lastKeyCode=="190") {
|
|
||||||
canDoEndTag=true;
|
|
||||||
for (i=0;i<top.ICEcoder.tagNestExceptions.length;i++) {
|
|
||||||
if(top.ICEcoder.tagString!="script" && top.ICEcoder.tagString==top.ICEcoder.tagNestExceptions[i]) {
|
|
||||||
canDoEndTag=false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(top.ICEcoder.tagString.slice(0,1)=="/"||top.ICEcoder.tagString.slice(0,1)=="?") {
|
|
||||||
canDoEndTag=false;
|
|
||||||
}
|
|
||||||
if (!top.ICEcoder.codeAssist||fileName.indexOf(".js")>0||fileName.indexOf(".css")>0) {
|
|
||||||
canDoEndTag=false;
|
|
||||||
}
|
|
||||||
contentType = top.ICEcoder.caretLocType;
|
|
||||||
if (canDoEndTag && (contentType!="JavaScript"||(contentType=="JavaScript"&&top.ICEcoder.tagString=="script"))) {
|
|
||||||
numTabs = top.ICEcoder.htmlTagArray.length;
|
|
||||||
if (top.ICEcoder.htmlTagArray[0]=="html") {numTabs--};
|
|
||||||
tabs = "";
|
|
||||||
for (i=0;i<numTabs-1;i++) {
|
|
||||||
tabs += "\t";
|
|
||||||
}
|
|
||||||
//endTag = "</" + top.ICEcoder.htmlTagArray[top.ICEcoder.htmlTagArray.length-1] + ">";
|
|
||||||
endTag = "</" + top.ICEcoder.tagString + ">";
|
|
||||||
if (top.ICEcoder.tagString=="script") {endTag="</"+"script>"};
|
|
||||||
if(top.ICEcoder.tagString=="title"||top.ICEcoder.tagString=="a"||top.ICEcoder.tagString=="li"||top.ICEcoder.tagString=="span"||(top.ICEcoder.tagString.slice(0,1)=="h"&&parseInt(top.ICEcoder.tagString.slice(1,2),10)>=1&&parseInt(top.ICEcoder.tagString.slice(1,2),10)<=7)) {
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].replaceSelection(endTag);
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setCursor(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor().line,window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor().ch-top.ICEcoder.tagString.length-3);
|
|
||||||
} else if(top.ICEcoder.tagString=="html"||top.ICEcoder.tagString=="head") {
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].replaceSelection("\n\n"+endTag);
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setCursor(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor().line-1,numTabs);
|
|
||||||
} else {
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].replaceSelection("\n"+tabs+"\t\n"+tabs+endTag);
|
|
||||||
window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setCursor(window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].getCursor().line-1,numTabs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
lastKeyCode = e.keyCode;
|
|
||||||
},
|
|
||||||
onGutterClick: !fileName || (fileName && fileName.indexOf(".js") == -1 && fileName.indexOf(".php") && fileName.indexOf(".rb") == -1) ? codeFold : codeFold_JS_PHP_Ruby,
|
|
||||||
extraKeys: {"Tab": "indentMore", "Shift-Tab": "indentLess"}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window['cM'+num].on("cursorActivity", function(thisCM) {
|
||||||
|
top.ICEcoder.getCaretPosition();
|
||||||
|
top.ICEcoder.updateCharDisplay();
|
||||||
|
window['cM'+num].removeLineClass(top.ICEcoder['cMActiveLine'+num], "background");
|
||||||
|
if(window['cM'+num].getCursor('start').line == window['cM'+num].getCursor().line) {
|
||||||
|
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(window['cM'+num].getCursor().line, "background","cm-s-activeLine");
|
||||||
|
}
|
||||||
|
top.ICEcoder.cssColorPreview();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
window['cM'+num].on("change", function(thisCM, changeObj) {
|
||||||
|
// If we're not loading the file, it's a change, so update tab
|
||||||
|
if (!top.ICEcoder.loadingFile) {
|
||||||
|
top.ICEcoder.changedContent[top.ICEcoder.selectedTab-1] = 1;
|
||||||
|
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
|
||||||
|
}
|
||||||
|
top.ICEcoder.getCaretPosition();
|
||||||
|
top.ICEcoder.dontUpdateNest = false;
|
||||||
|
top.ICEcoder.updateCharDisplay();
|
||||||
|
top.ICEcoder.updateNestingIndicator();
|
||||||
|
if (top.ICEcoder.findMode) {
|
||||||
|
top.ICEcoder.results.splice(top.ICEcoder.findResult,1);
|
||||||
|
top.document.getElementById('results').innerHTML = top.ICEcoder.results.length + " results";
|
||||||
|
top.ICEcoder.findMode = false;
|
||||||
|
}
|
||||||
|
if (top.ICEcoder.codeAssist) {
|
||||||
|
clearTimeout(window['cM'+num+'waiting']);
|
||||||
|
window['cM'+num+'waiting'] = setTimeout(top.ICEcoder.updateHints, 100);
|
||||||
|
}
|
||||||
|
var filepath = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
|
||||||
|
var filename = filepath.substr(filepath.lastIndexOf("/")+1);
|
||||||
|
var fileExt = filename.substr(filename.lastIndexOf(".")+1);
|
||||||
|
// Update HTML edited files live
|
||||||
|
if (top.ICEcoder.previewWindow.location) {
|
||||||
|
if (top.ICEcoder.previewWindow.location.pathname==filepath) {
|
||||||
|
top.ICEcoder.previewWindow.document.documentElement.innerHTML =
|
||||||
|
["htm","html","txt"].indexOf(fileExt) > -1
|
||||||
|
? window['cM'+num].getValue()
|
||||||
|
: ["md"].indexOf(fileExt) > -1
|
||||||
|
? mmd(window['cM'+num].getValue())
|
||||||
|
: false;
|
||||||
|
} else if (["css"].indexOf(fileExt) > -1) {
|
||||||
|
if (top.ICEcoder.previewWindow.document.documentElement.innerHTML.indexOf(filename) > -1) {
|
||||||
|
var css = window['cM'+num].getValue();
|
||||||
|
var style = document.createElement('style');
|
||||||
|
style.type = 'text/css';
|
||||||
|
style.id = "ICEcoder"+filepath.replace(/\//g,"_");
|
||||||
|
if (style.styleSheet){
|
||||||
|
style.styleSheet.cssText = css;
|
||||||
|
} else {
|
||||||
|
style.appendChild(document.createTextNode(css));
|
||||||
|
}
|
||||||
|
if (top.ICEcoder.previewWindow.document.getElementById(style.id)) {
|
||||||
|
top.ICEcoder.previewWindow.document.documentElement.removeChild(top.ICEcoder.previewWindow.document.getElementById(style.id));
|
||||||
|
}
|
||||||
|
top.ICEcoder.previewWindow.document.documentElement.appendChild(style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
window['cM'+num].on("scroll", function(thisCM) {
|
||||||
|
top.ICEcoder.mouseDown=false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
window['cM'+num].on("gutterClick", function(thisCM, line, gutter, clickEvent) {
|
||||||
|
["JavaScript","CoffeeScript","PHP","Python","Ruby"].indexOf(top.ICEcoder.caretLocType) > -1
|
||||||
|
? codeFoldBrace(window['cM'+num], line) : codeFoldTag(window['cM'+num], line);
|
||||||
|
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", document.createTextNode("+ "+(line+1)));
|
||||||
|
setTimeout(function() {
|
||||||
|
window['cM'+num].setGutterMarker(line, "CodeMirror-linenumbers", null);
|
||||||
|
},1000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// Now create the active line for this CodeMirror object
|
// Now create the active line for this CodeMirror object
|
||||||
top.ICEcoder['cMActiveLine'+top.ICEcoder.selectedTab] = window['cM'+top.ICEcoder.cMInstances[top.ICEcoder.selectedTab-1]].setLineClass(0, "cm-s-activeLine");
|
top.ICEcoder['cMActiveLine'+num] = window['cM'+num].addLineClass(0, "background", "cm-s-activeLine");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// var top.ICEcoder.foldStyle = '<span style="position: absolute; display: inline-block; width: 13px; height: 13px; left: 0; background-color: #b00; color: #fff; text-align: center; cursor: pointer"><span style="position: relative; left: -1px">+</span></span> %N%';
|
||||||
|
var codeFoldTag = CodeMirror.newFoldFunction(CodeMirror.tagRangeFinder);
|
||||||
|
var codeFoldBrace = CodeMirror.newFoldFunction(CodeMirror.braceRangeFinder);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
341
farbtastic/LICENSE.txt
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
36
farbtastic/farbtastic.css
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
.picker {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.farbtastic {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.farbtastic * {
|
||||||
|
position: absolute;
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
.farbtastic, .farbtastic .wheel {
|
||||||
|
width: 195px;
|
||||||
|
height: 195px;
|
||||||
|
}
|
||||||
|
.farbtastic .color, .farbtastic .overlay {
|
||||||
|
top: 47px;
|
||||||
|
left: 47px;
|
||||||
|
width: 101px;
|
||||||
|
height: 101px;
|
||||||
|
}
|
||||||
|
.farbtastic .wheel {
|
||||||
|
background: url(wheel.png) no-repeat;
|
||||||
|
width: 195px;
|
||||||
|
height: 195px;
|
||||||
|
}
|
||||||
|
.farbtastic .overlay {
|
||||||
|
background: url(mask.png) no-repeat;
|
||||||
|
}
|
||||||
|
.farbtastic .marker {
|
||||||
|
width: 17px;
|
||||||
|
height: 17px;
|
||||||
|
margin: -8px 0 0 -8px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: url(marker.png) no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
252
farbtastic/farbtastic.js
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
/*!
|
||||||
|
* Farbtastic: NON jQuery color picker plug-in v1.4, based on v1.3u
|
||||||
|
*
|
||||||
|
* Licensed under the GPL license:
|
||||||
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
farbtasticFunc = function (options) {
|
||||||
|
farbtastic(this, options);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
farbtastic = function (container, callback) {
|
||||||
|
var container = document.getElementById(container);
|
||||||
|
var callback = document.getElementById(callback);
|
||||||
|
return container.farbtastic || (container.farbtastic = new _farbtastic(container, callback));
|
||||||
|
};
|
||||||
|
|
||||||
|
_farbtastic = function (container, callback) {
|
||||||
|
// Store farbtastic object
|
||||||
|
var fb = this;
|
||||||
|
|
||||||
|
// Insert markup
|
||||||
|
container.innerHTML = '<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>';
|
||||||
|
fb.wheel = document.getElementsByClassName('wheel')[0];
|
||||||
|
// Dimensions
|
||||||
|
fb.radius = 84;
|
||||||
|
fb.square = 100;
|
||||||
|
fb.width = 194;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link to the given element(s) or callback.
|
||||||
|
*/
|
||||||
|
fb.linkTo = function (callback) {
|
||||||
|
// Unbind previous nodes
|
||||||
|
if (typeof fb.callback == 'object') {
|
||||||
|
console.log("Doesn't do anything?");
|
||||||
|
fb.callback.removeEventListener('keyup', fb.updateValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset color
|
||||||
|
fb.color = null;
|
||||||
|
|
||||||
|
// Bind callback or elements
|
||||||
|
if (typeof callback == 'function') {
|
||||||
|
fb.callback = callback;
|
||||||
|
}
|
||||||
|
else if (typeof callback == 'object' || typeof callback == 'string') {
|
||||||
|
fb.callback = callback;
|
||||||
|
fb.callback.addEventListener('keyup',fb.updateValue);
|
||||||
|
if (fb.callback.value) {
|
||||||
|
fb.setColor(fb.callback.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
fb.updateValue = function (event) {
|
||||||
|
if (this.value && this.value != fb.color) {
|
||||||
|
fb.setColor(this.value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change color with HTML syntax #123456
|
||||||
|
*/
|
||||||
|
fb.setColor = function (color) {
|
||||||
|
var unpack = fb.unpack(color);
|
||||||
|
if (fb.color != color && unpack) {
|
||||||
|
fb.color = color;
|
||||||
|
fb.rgb = unpack;
|
||||||
|
fb.hsl = fb.RGBToHSL(fb.rgb);
|
||||||
|
fb.updateDisplay();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change color with HSL triplet [0..1, 0..1, 0..1]
|
||||||
|
*/
|
||||||
|
fb.setHSL = function (hsl) {
|
||||||
|
fb.hsl = hsl;
|
||||||
|
fb.rgb = fb.HSLToRGB(hsl);
|
||||||
|
fb.color = fb.pack(fb.rgb);
|
||||||
|
fb.updateDisplay();
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the coordinates of the given event relative to the center
|
||||||
|
* of the widget.
|
||||||
|
*/
|
||||||
|
fb.widgetCoords = function (event) {
|
||||||
|
return { x: (event.pageX - fb.wheel.offsetParent.offsetLeft) - fb.width / 2, y: (event.pageY - fb.wheel.offsetParent.offsetTop) - fb.width / 2 };
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mousedown handler
|
||||||
|
*/
|
||||||
|
fb.mousedown = function (event) {
|
||||||
|
// Capture mouse
|
||||||
|
if (!document.dragging) {
|
||||||
|
document.addEventListener('mousemove', fb.mousemove);
|
||||||
|
document.addEventListener('mouseup', fb.mouseup);
|
||||||
|
document.dragging = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check which area is being dragged
|
||||||
|
var pos = fb.widgetCoords(event);
|
||||||
|
fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
|
||||||
|
|
||||||
|
// Process
|
||||||
|
fb.mousemove(event);
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mousemove handler
|
||||||
|
*/
|
||||||
|
fb.mousemove = function (event) {
|
||||||
|
// Get coordinates relative to color picker center
|
||||||
|
var pos = fb.widgetCoords(event);
|
||||||
|
|
||||||
|
// Set new HSL parameters
|
||||||
|
if (fb.circleDrag) {
|
||||||
|
var hue = Math.atan2(pos.x, -pos.y) / 6.28;
|
||||||
|
if (hue < 0) hue += 1;
|
||||||
|
fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
|
||||||
|
var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
|
||||||
|
fb.setHSL([fb.hsl[0], sat, lum]);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouseup handler
|
||||||
|
*/
|
||||||
|
fb.mouseup = function () {
|
||||||
|
// Uncapture mouse
|
||||||
|
document.removeEventListener('mousemove', fb.mousemove);
|
||||||
|
document.removeEventListener('mouseup', fb.mouseup);
|
||||||
|
document.dragging = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the markers and styles
|
||||||
|
*/
|
||||||
|
fb.updateDisplay = function () {
|
||||||
|
// Markers
|
||||||
|
var angle = fb.hsl[0] * 6.28;
|
||||||
|
document.getElementsByClassName('h-marker')[0].style.left = Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px';
|
||||||
|
document.getElementsByClassName('h-marker')[0].style.top = Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px';
|
||||||
|
|
||||||
|
document.getElementsByClassName('sl-marker')[0].style.left = Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px';
|
||||||
|
document.getElementsByClassName('sl-marker')[0].style.top = Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px';
|
||||||
|
|
||||||
|
// Saturation/Luminance gradient
|
||||||
|
document.getElementsByClassName('color')[0].style.backgroundColor = fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]));
|
||||||
|
|
||||||
|
// Linked elements or callback
|
||||||
|
if (typeof fb.callback == 'object') {
|
||||||
|
// Set background/foreground color
|
||||||
|
document.getElementById(fb.callback.id).style.backgroundColor = fb.color;
|
||||||
|
document.getElementById(fb.callback.id).style.color = fb.hsl[2] > 0.5 ? '#000' : '#fff';
|
||||||
|
|
||||||
|
// Change linked value
|
||||||
|
if (callback.value && callback.value != fb.color) {
|
||||||
|
callback.value = fb.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (typeof fb.callback == 'function') {
|
||||||
|
fb.callback.call(fb, fb.color);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Various color utility functions */
|
||||||
|
fb.pack = function (rgb) {
|
||||||
|
var r = Math.round(rgb[0] * 255);
|
||||||
|
var g = Math.round(rgb[1] * 255);
|
||||||
|
var b = Math.round(rgb[2] * 255);
|
||||||
|
return '#' + (r < 16 ? '0' : '') + r.toString(16) +
|
||||||
|
(g < 16 ? '0' : '') + g.toString(16) +
|
||||||
|
(b < 16 ? '0' : '') + b.toString(16);
|
||||||
|
};
|
||||||
|
|
||||||
|
fb.unpack = function (color) {
|
||||||
|
if (color.length == 7) {
|
||||||
|
return [parseInt('0x' + color.substring(1, 3)) / 255,
|
||||||
|
parseInt('0x' + color.substring(3, 5)) / 255,
|
||||||
|
parseInt('0x' + color.substring(5, 7)) / 255];
|
||||||
|
}
|
||||||
|
else if (color.length == 4) {
|
||||||
|
return [parseInt('0x' + color.substring(1, 2)) / 15,
|
||||||
|
parseInt('0x' + color.substring(2, 3)) / 15,
|
||||||
|
parseInt('0x' + color.substring(3, 4)) / 15];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fb.HSLToRGB = function (hsl) {
|
||||||
|
var m1, m2, r, g, b;
|
||||||
|
var h = hsl[0], s = hsl[1], l = hsl[2];
|
||||||
|
m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
|
||||||
|
m1 = l * 2 - m2;
|
||||||
|
return [this.hueToRGB(m1, m2, h+0.33333),
|
||||||
|
this.hueToRGB(m1, m2, h),
|
||||||
|
this.hueToRGB(m1, m2, h-0.33333)];
|
||||||
|
};
|
||||||
|
|
||||||
|
fb.hueToRGB = function (m1, m2, h) {
|
||||||
|
h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
|
||||||
|
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
||||||
|
if (h * 2 < 1) return m2;
|
||||||
|
if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
|
||||||
|
return m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
fb.RGBToHSL = function (rgb) {
|
||||||
|
var min, max, delta, h, s, l;
|
||||||
|
var r = rgb[0], g = rgb[1], b = rgb[2];
|
||||||
|
min = Math.min(r, Math.min(g, b));
|
||||||
|
max = Math.max(r, Math.max(g, b));
|
||||||
|
delta = max - min;
|
||||||
|
l = (min + max) / 2;
|
||||||
|
s = 0;
|
||||||
|
if (l > 0 && l < 1) {
|
||||||
|
s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
|
||||||
|
}
|
||||||
|
h = 0;
|
||||||
|
if (delta > 0) {
|
||||||
|
if (max == r && max != g) h += (g - b) / delta;
|
||||||
|
if (max == g && max != b) h += (2 + (b - r) / delta);
|
||||||
|
if (max == b && max != r) h += (4 + (r - g) / delta);
|
||||||
|
h /= 6;
|
||||||
|
}
|
||||||
|
return [h, s, l];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Install mousedown handler (the others are set on the document on-demand)
|
||||||
|
document.getElementsByClassName('farbtastic')[0].onmousedown = fb.mousedown;
|
||||||
|
|
||||||
|
// Init color
|
||||||
|
fb.setColor('#000000');
|
||||||
|
|
||||||
|
// Set linked elements/callback
|
||||||
|
if (callback) {
|
||||||
|
fb.linkTo(callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
BIN
farbtastic/marker.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
farbtastic/mask.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
farbtastic/wheel.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
favicon.png
Normal file
|
After Width: | Height: | Size: 255 B |
164
files.php
@@ -1,161 +1,25 @@
|
|||||||
<?php
|
<?php include("lib/settings.php");?>
|
||||||
function fileManager($directory, $return_link) {
|
|
||||||
$code = "";
|
|
||||||
// Generates a list of all directories, sub-directories, and files in $directory
|
|
||||||
// Remove trailing slash
|
|
||||||
if(substr($directory, -1) == "/" ) {$directory = substr($directory, 0, strlen($directory)-1);};
|
|
||||||
$code .= fileManager_dir($directory, $return_link);
|
|
||||||
return $code;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fileManager_dir($directory, $return_link, $first_call=true) {
|
|
||||||
if (!isset($_SESSION['restrictedFiles'])) {include("lib/settings.php");};
|
|
||||||
$restrictedFiles = $_SESSION['restrictedFiles'];
|
|
||||||
$bannedFiles = $_SESSION['bannedFiles'];
|
|
||||||
$docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']);
|
|
||||||
if (strrpos($_SERVER['DOCUMENT_ROOT'],":")) {
|
|
||||||
$serverType = "Windows";
|
|
||||||
} else {
|
|
||||||
$serverType = "Linux";
|
|
||||||
}
|
|
||||||
// Chop off trailing slash
|
|
||||||
if (strrpos($docRoot,"/")==strlen($docRoot)-1) {$docRoot = substr($docRoot,0,strlen($docRoot)-1);};
|
|
||||||
$fileManager = "";
|
|
||||||
|
|
||||||
// Recursive function called by fileManager() to list directories/files
|
|
||||||
// Get and sort directories/files
|
|
||||||
if(function_exists("scandir")) {$file = scandir($directory);} else {$file = php4_scandir($directory);};
|
|
||||||
natcasesort($file);
|
|
||||||
|
|
||||||
// Make directories first
|
|
||||||
$files = $dirs = array();
|
|
||||||
foreach($file as $this_file) {
|
|
||||||
if(is_dir("$directory/$this_file")) {$dirs[] = $this_file;} else {$files[] = $this_file;};
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = array_merge($dirs, $files);
|
|
||||||
|
|
||||||
// Filter unwanted files
|
|
||||||
if(!empty($bannedFiles)) {
|
|
||||||
foreach(array_keys($file) as $key) {
|
|
||||||
$fileFolder = $file[$key];
|
|
||||||
for ($i=0;$i<count($bannedFiles);$i++) {
|
|
||||||
if(strpos($fileFolder,$bannedFiles[$i])!==false) {unset($file[$key]);};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(count($file) > 2) { // To ignore . and .. directories
|
|
||||||
if($first_call) {
|
|
||||||
// Root Directory
|
|
||||||
$dirRep = str_replace("\\","/",$directory);
|
|
||||||
$link = str_replace("[link]", "$dirRep/", $return_link);
|
|
||||||
$link = str_replace("//","/",$link);
|
|
||||||
$fileAtts = "";
|
|
||||||
|
|
||||||
if ($serverType=="Linux") {
|
|
||||||
$chmodInfo = substr(sprintf('%o', fileperms($link)), -4);
|
|
||||||
$fileAtts = '<span style="color: #888888; font-size: 8px">'.$chmodInfo.'</span>';
|
|
||||||
}
|
|
||||||
$fileManager = "<ul class=\"fileManager\">";
|
|
||||||
$fileManager .= "<li class=\"pft-directory\"><a href=\"#\" onMouseOver=\"top.ICEcoder.overFileFolder('folder','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('folder','')\" style=\"position: relative; left:-22px\"> <span id=\"|\">/ [ROOT]</span> ".$fileAtts."</a>";
|
|
||||||
$fileManager .= $fileManager .= fileManager_dir("$directory/", $return_link ,false);
|
|
||||||
$fileManager .= "</li>";
|
|
||||||
$first_call = false;
|
|
||||||
} else {
|
|
||||||
$fileManager = "<ul>";
|
|
||||||
}
|
|
||||||
foreach( $file as $this_file ) {
|
|
||||||
$bannedFile=false;
|
|
||||||
for ($i=0;$i<count($bannedFiles);$i++) {
|
|
||||||
if (strpos($directory,$bannedFiles[$i])!=""||strpos($this_file,$bannedFiles[$i])!="") {
|
|
||||||
$bannedFile=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( $this_file != "." && $this_file != ".." && $bannedFile == false) {
|
|
||||||
if( is_dir("$directory/$this_file") ) {
|
|
||||||
// Directory
|
|
||||||
$dirRep = str_replace("\\","/",$directory);
|
|
||||||
$link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link);
|
|
||||||
$link = str_replace("//","/",$link);
|
|
||||||
|
|
||||||
$restrictedFile=false;
|
|
||||||
for ($i=0;$i<count($restrictedFiles);$i++) {
|
|
||||||
if (strpos($link,$restrictedFiles[$i])!="") {
|
|
||||||
$restrictedFile=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fileAtts = "";
|
|
||||||
if ($serverType=="Linux") {
|
|
||||||
$chmodInfo = substr(sprintf('%o', fileperms($link)), -4);
|
|
||||||
$fileAtts = '<span style="color: #888888; font-size: 8px">'.$chmodInfo.'</span>';
|
|
||||||
}
|
|
||||||
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $restrictedFile==false)) {
|
|
||||||
$fileManager .= "<li class=\"pft-directory\"><a href=\"#\" onMouseOver=\"top.ICEcoder.overFileFolder('folder','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('folder','')\" style=\"position: relative; left:-22px\"> <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a>";
|
|
||||||
$fileManager .= fileManager_dir("$directory/$this_file", $return_link , false);
|
|
||||||
$fileManager .= "</li>";
|
|
||||||
} else {
|
|
||||||
$fileManager .= "<li class=\"pft-directory\" style=\"cursor: pointer\"><span style=\"position: relative; left:-22px; color: #888888\"> [HIDDEN] ".$fileAtts."</span></li>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// File
|
|
||||||
// Get extension (prefix 'ext-' to prevent invalid classes from extensions that begin with numbers)
|
|
||||||
$ext = "ext-" . substr($this_file, strrpos($this_file, ".") + 1);
|
|
||||||
$dirRep = str_replace("\\","/",$directory);
|
|
||||||
$link = str_replace("[link]", "$dirRep/" . urlencode($this_file), $return_link);
|
|
||||||
$link = str_replace("//","/",$link);
|
|
||||||
|
|
||||||
$restrictedFile=false;
|
|
||||||
for ($i=0;$i<count($restrictedFiles);$i++) {
|
|
||||||
if (strpos($link,$restrictedFiles[$i])!="") {
|
|
||||||
$restrictedFile=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($_SESSION['userLevel'] == 10 || ($_SESSION['userLevel'] < 10 && $restrictedFile==false)) {
|
|
||||||
$fileAtts = "";
|
|
||||||
if ($serverType=="Linux") {
|
|
||||||
$chmodInfo = substr(sprintf('%o', fileperms($link)), -4);
|
|
||||||
$fileAtts = '<span style="color: #888888; font-size: 8px">'.$chmodInfo.'</span>';
|
|
||||||
}
|
|
||||||
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\"><a nohref onMouseOver=\"top.ICEcoder.overFileFolder('file','$link')\" onMouseOut=\"top.ICEcoder.overFileFolder('file','')\" style=\"position: relative; left:-22px; cursor: pointer\"> <span id=\"".str_replace("/","|",str_replace($docRoot,"",$link))."\">" . htmlspecialchars($this_file) . "</span> ".$fileAtts."</a></li>";
|
|
||||||
} else {
|
|
||||||
$fileAtts = "<img src=\"images/file-manager-icons/padlock.png\" style=\"cursor: pointer\" onClick=\"alert('Sorry, you need higher admin level rights to view.')\">";
|
|
||||||
$fileManager .= "<li class=\"pft-file " . strtolower($ext) . "\" style=\"cursor: default\"><span style=\"position: relative; left:-22px; color: #888888\"> [HIDDEN] ".$fileAtts."</span></li>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$fileManager .= "</ul>";
|
|
||||||
}
|
|
||||||
return $fileManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For PHP4 compatibility
|
|
||||||
function php4_scandir($dir) {
|
|
||||||
$dh = opendir($dir);
|
|
||||||
while( false !== ($filename = readdir($dh)) ) {
|
|
||||||
$files[] = $filename;
|
|
||||||
}
|
|
||||||
sort($files);
|
|
||||||
return($files);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false" onMouseMove="top.ICEcoder.getMouseXY(event);top.ICEcoder.canResizeFilesW()" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu()" onClick="top.ICEcoder.selectFileFolder()">
|
<html onMouseDown="top.ICEcoder.mouseDown=true" onMouseUp="top.ICEcoder.mouseDown=false; if (!top.ICEcoder.overCloseLink) {top.ICEcoder.tabDragEnd()}" onMouseMove="if(top.ICEcoder) {top.ICEcoder.getMouseXY(event,'files');top.ICEcoder.canResizeFilesW()}" onContextMenu="top.ICEcoder.rightClickedFile=top.ICEcoder.thisFileFolderLink; return top.ICEcoder.showMenu(event)" onClick="top.ICEcoder.selectFileFolder(event)">
|
||||||
<head>
|
<head>
|
||||||
<title>ICE Coder File Manager</title>
|
<title>ICEcoder v <?php echo $ICEcoder["versionNo"];?> file manager</title>
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<link rel="stylesheet" type="text/css" href="lib/files.css">
|
<link rel="stylesheet" type="text/css" href="lib/files.css">
|
||||||
<script src="lib/coder.js" type="text/javascript"></script>
|
<script src="lib/ice-coder<?php if (!$ICEcoder['devMode']) {echo '.min';};?>.js" type="text/javascript"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onLoad="top.ICEcoder.fileManager()" onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
<body onDblClick="top.ICEcoder.openFile()" onKeyDown="return top.ICEcoder.interceptKeys('files', event);" onKeyUp="top.ICEcoder.resetKeys(event);">
|
||||||
<div onClick="top.ICEcoder.refreshFileManager()" class="refresh"><img src="images/file-manager-icons/refresh.png"></div>
|
|
||||||
<?php
|
<div title="Refresh" onClick="top.ICEcoder.refreshFileManager()" class="refresh"></div>
|
||||||
echo fileManager($_SERVER['DOCUMENT_ROOT'], "[link]");
|
|
||||||
?>
|
<ul class="fileManager">
|
||||||
|
<li class="pft-directory dirOpen"><a nohref title="/" onMouseOver="top.ICEcoder.overFileFolder('folder','/')" onMouseOut="top.ICEcoder.overFileFolder('folder','')" onClick="top.ICEcoder.openCloseDir(this)" style="position: relative; left:-22px"> <span id="|">/ <?php echo $iceRoot == "" ? "[ROOT]" : trim($iceRoot,"/");?></span> <span style="color: #888; font-size: 8px" id="|_perms"><?php echo $serverType=="Linux" ? substr(sprintf('%o', fileperms($docRoot.$iceRoot)), -3) : "";?></span></a></li><?php include("lib/get-branch.php");?>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<iframe name="fileControl" style="display: none"></iframe>
|
<iframe name="fileControl" style="display: none"></iframe>
|
||||||
|
|
||||||
|
<iframe name="testControl" style="display: none"></iframe>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
BIN
images/Thumbs.db
BIN
images/big-arrow.gif
Normal file
|
After Width: | Height: | Size: 430 B |
BIN
images/blank.gif
Normal file
|
After Width: | Height: | Size: 55 B |
BIN
images/checkerboard.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
images/color-picker.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 739 B |
BIN
images/file-folder-icons.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
images/file-manager-icons.png
Normal file
|
After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 579 B |
|
Before Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 651 B |
|
Before Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 653 B |
|
Before Width: | Height: | Size: 582 B |
|
Before Width: | Height: | Size: 734 B |
|
Before Width: | Height: | Size: 633 B |
|
Before Width: | Height: | Size: 668 B |
|
Before Width: | Height: | Size: 385 B |
|
Before Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 752 B |
|
Before Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 538 B |
|
Before Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 626 B |
|
Before Width: | Height: | Size: 859 B |
|
Before Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 663 B |
|
Before Width: | Height: | Size: 386 B |