github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

yui / yui3

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 411
    • 96
  • Source
  • Commits
  • Network (96)
  • Downloads (1,698)
  • Graphs
  • Tree: 7cf949b

click here to add a description

click here to add a homepage

  • Switch Branches (1)
    • master
  • Switch Tags (1,698)
    • yui3-1950
    • yui3-1949
    • yui3-1948
    • yui3-1947
    • yui3-1946
    • yui3-1945
    • yui3-1944
    • yui3-1943
    • yui3-1942
    • yui3-1941
    • yui3-1940
    • yui3-1939
    • yui3-1938
    • yui3-1937
    • yui3-1936
    • yui3-1935
    • yui3-1934
    • yui3-1933
    • yui3-1932
    • yui3-1931
    • yui3-1930
    • yui3-1929
    • yui3-1928
    • yui3-1927
    • yui3-1926
    • yui3-1925
    • yui3-1924
    • yui3-1923
    • yui3-1922
    • yui3-1921
    • yui3-1920
    • yui3-1919
    • yui3-1918
    • yui3-1917
    • yui3-1916
    • yui3-1915
    • yui3-1914
    • yui3-1913
    • yui3-1912
    • yui3-1911
    • yui3-1910
    • yui3-1909
    • yui3-1908
    • yui3-1907
    • yui3-1906
    • yui3-1905
    • yui3-1904
    • yui3-1903
    • yui3-1902
    • yui3-1901
    • yui3-1900
    • yui3-1899
    • yui3-1898
    • yui3-1897
    • yui3-1896
    • yui3-1895
    • yui3-1894
    • yui3-1893
    • yui3-1892
    • yui3-1891
    • yui3-1890
    • yui3-1889
    • yui3-1888
    • yui3-1887
    • yui3-1886
    • yui3-1885
    • yui3-1884
    • yui3-1883
    • yui3-1882
    • yui3-1881
    • yui3-1880
    • yui3-1879
    • yui3-1878
    • yui3-1877
    • yui3-1876
    • yui3-1875
    • yui3-1874
    • yui3-1873
    • yui3-1872
    • yui3-1871
    • yui3-1870
    • yui3-1869
    • yui3-1868
    • yui3-1867
    • yui3-1866
    • yui3-1865
    • yui3-1864
    • yui3-1863
    • yui3-1862
    • yui3-1861
    • yui3-1860
    • yui3-1859
    • yui3-1858
    • yui3-1857
    • yui3-1856
    • yui3-1855
    • yui3-1854
    • yui3-1853
    • yui3-1852
    • yui3-1851
    • yui3-1850
    • yui3-1849
    • yui3-1848
    • yui3-1847
    • yui3-1846
    • yui3-1845
    • yui3-1844
    • yui3-1843
    • yui3-1842
    • yui3-1841
    • yui3-1840
    • yui3-1839
    • yui3-1838
    • yui3-1837
    • yui3-1836
    • yui3-1835
    • yui3-1834
    • yui3-1833
    • yui3-1832
    • yui3-1831
    • yui3-1830
    • yui3-1829
    • yui3-1828
    • yui3-1827
    • yui3-1826
    • yui3-1825
    • yui3-1824
    • yui3-1823
    • yui3-1822
    • yui3-1821
    • yui3-1820
    • yui3-1819
    • yui3-1818
    • yui3-1817
    • yui3-1816
    • yui3-1815
    • yui3-1814
    • yui3-1813
    • yui3-1812
    • yui3-1811
    • yui3-1810
    • yui3-1809
    • yui3-1808
    • yui3-1807
    • yui3-1806
    • yui3-1805
    • yui3-1804
    • yui3-1803
    • yui3-1802
    • yui3-1801
    • yui3-1800
    • yui3-1799
    • yui3-1798
    • yui3-1797
    • yui3-1796
    • yui3-1795
    • yui3-1794
    • yui3-1792
    • yui3-1791
    • yui3-1790
    • yui3-1789
    • yui3-1788
    • yui3-1787
    • yui3-1786
    • yui3-1785
    • yui3-1784
    • yui3-1783
    • yui3-1782
    • yui3-1781
    • yui3-1780
    • yui3-1779
    • yui3-1778
    • yui3-1777
    • yui3-1776
    • yui3-1775
    • yui3-1774
    • yui3-1773
    • yui3-1772
    • yui3-1771
    • yui3-1770
    • yui3-1769
    • yui3-1768
    • yui3-1767
    • yui3-1766
    • yui3-1765
    • yui3-1764
    • yui3-1763
    • yui3-1762
    • yui3-1761
    • yui3-1760
    • yui3-1759
    • yui3-1758
    • yui3-1757
    • yui3-1756
    • yui3-1755
    • yui3-1754
    • yui3-1753
    • yui3-1752
    • yui3-1751
    • yui3-1750
    • yui3-1749
    • yui3-1748
    • yui3-1747
    • yui3-1746
    • yui3-1745
    • yui3-1744
    • yui3-1743
    • yui3-1742
    • yui3-1741
    • yui3-1740
    • yui3-1739
    • yui3-1738
    • yui3-1737
    • yui3-1736
    • yui3-1735
    • yui3-1734
    • yui3-1733
    • yui3-1732
    • yui3-1731
    • yui3-1730
    • yui3-1729
    • yui3-1728
    • yui3-1727
    • yui3-1726
    • yui3-1725
    • yui3-1724
    • yui3-1723
    • yui3-1722
    • yui3-1721
    • yui3-1720
    • yui3-1719
    • yui3-1718
    • yui3-1717
    • yui3-1716
    • yui3-1715
    • yui3-1714
    • yui3-1713
    • yui3-1712
    • yui3-1711
    • yui3-1710
    • yui3-1709
    • yui3-1708
    • yui3-1707
    • yui3-1706
    • yui3-1705
    • yui3-1704
    • yui3-1703
    • yui3-1702
    • yui3-1701
    • yui3-1700
    • yui3-1699
    • yui3-1698
    • yui3-1697
    • yui3-1696
    • yui3-1695
    • yui3-1694
    • yui3-1693
    • yui3-1692
    • yui3-1691
    • yui3-1690
    • yui3-1689
    • yui3-1688
    • yui3-1687
    • yui3-1686
    • yui3-1685
    • yui3-1684
    • yui3-1683
    • yui3-1682
    • yui3-1681
    • yui3-1680
    • yui3-1679
    • yui3-1678
    • yui3-1677
    • yui3-1676
    • yui3-1675
    • yui3-1674
    • yui3-1673
    • yui3-1672
    • yui3-1671
    • yui3-1670
    • yui3-1669
    • yui3-1668
    • yui3-1667
    • yui3-1666
    • yui3-1665
    • yui3-1664
    • yui3-1663
    • yui3-1662
    • yui3-1661
    • yui3-1660
    • yui3-1659
    • yui3-1658
    • yui3-1657
    • yui3-1656
    • yui3-1655
    • yui3-1654
    • yui3-1653
    • yui3-1652
    • yui3-1651
    • yui3-1650
    • yui3-1649
    • yui3-1648
    • yui3-1647
    • yui3-1646
    • yui3-1645
    • yui3-1644
    • yui3-1643
    • yui3-1642
    • yui3-1641
    • yui3-1640
    • yui3-1639
    • yui3-1638
    • yui3-1637
    • yui3-1636
    • yui3-1635
    • yui3-1634
    • yui3-1633
    • yui3-1632
    • yui3-1631
    • yui3-1630
    • yui3-1629
    • yui3-1628
    • yui3-1627
    • yui3-1626
    • yui3-1625
    • yui3-1624
    • yui3-1623
    • yui3-1622
    • yui3-1621
    • yui3-1620
    • yui3-1619
    • yui3-1618
    • yui3-1617
    • yui3-1616
    • yui3-1615
    • yui3-1614
    • yui3-1613
    • yui3-1612
    • yui3-1611
    • yui3-1610
    • yui3-1609
    • yui3-1608
    • yui3-1607
    • yui3-1606
    • yui3-1605
    • yui3-1604
    • yui3-1603
    • yui3-1602
    • yui3-1601
    • yui3-1600
    • yui3-1599
    • yui3-1598
    • yui3-1597
    • yui3-1596
    • yui3-1595
    • yui3-1594
    • yui3-1593
    • yui3-1592
    • yui3-1591
    • yui3-1590
    • yui3-1589
    • yui3-1588
    • yui3-1587
    • yui3-1586
    • yui3-1585
    • yui3-1584
    • yui3-1583
    • yui3-1582
    • yui3-1581
    • yui3-1580
    • yui3-1579
    • yui3-1578
    • yui3-1577
    • yui3-1576
    • yui3-1575
    • yui3-1574
    • yui3-1573
    • yui3-1572
    • yui3-1571
    • yui3-1570
    • yui3-1569
    • yui3-1568
    • yui3-1567
    • yui3-1566
    • yui3-1565
    • yui3-1564
    • yui3-1563
    • yui3-1562
    • yui3-1561
    • yui3-1560
    • yui3-1559
    • yui3-1558
    • yui3-1557
    • yui3-1556
    • yui3-1555
    • yui3-1554
    • yui3-1553
    • yui3-1552
    • yui3-1551
    • yui3-1550
    • yui3-1549
    • yui3-1548
    • yui3-1547
    • yui3-1546
    • yui3-1545
    • yui3-1544
    • yui3-1543
    • yui3-1542
    • yui3-1541
    • yui3-1540
    • yui3-1539
    • yui3-1538
    • yui3-1537
    • yui3-1536
    • yui3-1535
    • yui3-1534
    • yui3-1533
    • yui3-1532
    • yui3-1531
    • yui3-1530
    • yui3-1529
    • yui3-1528
    • yui3-1527
    • yui3-1526
    • yui3-1525
    • yui3-1524
    • yui3-1523
    • yui3-1522
    • yui3-1521
    • yui3-1520
    • yui3-1519
    • yui3-1518
    • yui3-1517
    • yui3-1516
    • yui3-1515
    • yui3-1514
    • yui3-1513
    • yui3-1512
    • yui3-1511
    • yui3-1510
    • yui3-1509
    • yui3-1508
    • yui3-1507
    • yui3-1506
    • yui3-1505
    • yui3-1504
    • yui3-1503
    • yui3-1502
    • yui3-1501
    • yui3-1500
    • yui3-1499
    • yui3-1498
    • yui3-1497
    • yui3-1496
    • yui3-1495
    • yui3-1494
    • yui3-1493
    • yui3-1492
    • yui3-1491
    • yui3-1490
    • yui3-1489
    • yui3-1488
    • yui3-1487
    • yui3-1486
    • yui3-1485
    • yui3-1484
    • yui3-1483
    • yui3-1482
    • yui3-1481
    • yui3-1480
    • yui3-1479
    • yui3-1478
    • yui3-1477
    • yui3-1476
    • yui3-1475
    • yui3-1474
    • yui3-1473
    • yui3-1472
    • yui3-1471
    • yui3-1470
    • yui3-1469
    • yui3-1468
    • yui3-1467
    • yui3-1466
    • yui3-1465
    • yui3-1464
    • yui3-1463
    • yui3-1462
    • yui3-1461
    • yui3-1460
    • yui3-1459
    • yui3-1458
    • yui3-1457
    • yui3-1456
    • yui3-1455
    • yui3-1454
    • yui3-1453
    • yui3-1452
    • yui3-1451
    • yui3-1450
    • yui3-1449
    • yui3-1448
    • yui3-1447
    • yui3-1446
    • yui3-1445
    • yui3-1444
    • yui3-1443
    • yui3-1442
    • yui3-1441
    • yui3-1440
    • yui3-1439
    • yui3-1438
    • yui3-1437
    • yui3-1436
    • yui3-1435
    • yui3-1434
    • yui3-1433
    • yui3-1432
    • yui3-1431
    • yui3-1430
    • yui3-1429
    • yui3-1428
    • yui3-1427
    • yui3-1426
    • yui3-1425
    • yui3-1424
    • yui3-1423
    • yui3-1422
    • yui3-1421
    • yui3-1420
    • yui3-1419
    • yui3-1418
    • yui3-1417
    • yui3-1416
    • yui3-1415
    • yui3-1414
    • yui3-1413
    • yui3-1412
    • yui3-1411
    • yui3-1410
    • yui3-1409
    • yui3-1408
    • yui3-1407
    • yui3-1406
    • yui3-1405
    • yui3-1404
    • yui3-1403
    • yui3-1402
    • yui3-1401
    • yui3-1400
    • yui3-1399
    • yui3-1398
    • yui3-1397
    • yui3-1396
    • yui3-1395
    • yui3-1394
    • yui3-1393
    • yui3-1392
    • yui3-1391
    • yui3-1390
    • yui3-1389
    • yui3-1388
    • yui3-1387
    • yui3-1386
    • yui3-1385
    • yui3-1384
    • yui3-1383
    • yui3-1382
    • yui3-1381
    • yui3-1380
    • yui3-1379
    • yui3-1378
    • yui3-1377
    • yui3-1376
    • yui3-1375
    • yui3-1374
    • yui3-1373
    • yui3-1372
    • yui3-1371
    • yui3-1370
    • yui3-1369
    • yui3-1368
    • yui3-1367
    • yui3-1366
    • yui3-1365
    • yui3-1364
    • yui3-1363
    • yui3-1362
    • yui3-1361
    • yui3-1360
    • yui3-1359
    • yui3-1358
    • yui3-1357
    • yui3-1356
    • yui3-1355
    • yui3-1354
    • yui3-1353
    • yui3-1352
    • yui3-1351
    • yui3-1350
    • yui3-1349
    • yui3-1348
    • yui3-1347
    • yui3-1346
    • yui3-1345
    • yui3-1344
    • yui3-1343
    • yui3-1342
    • yui3-1341
    • yui3-1340
    • yui3-1339
    • yui3-1338
    • yui3-1337
    • yui3-1336
    • yui3-1335
    • yui3-1334
    • yui3-1333
    • yui3-1332
    • yui3-1331
    • yui3-1330
    • yui3-1329
    • yui3-1328
    • yui3-1327
    • yui3-1326
    • yui3-1325
    • yui3-1324
    • yui3-1323
    • yui3-1322
    • yui3-1321
    • yui3-1320
    • yui3-1319
    • yui3-1318
    • yui3-1317
    • yui3-1316
    • yui3-1315
    • yui3-1314
    • yui3-1313
    • yui3-1312
    • yui3-1311
    • yui3-1310
    • yui3-1309
    • yui3-1308
    • yui3-1307
    • yui3-1306
    • yui3-1305
    • yui3-1304
    • yui3-1303
    • yui3-1302
    • yui3-1301
    • yui3-1300
    • yui3-1299
    • yui3-1298
    • yui3-1297
    • yui3-1296
    • yui3-1295
    • yui3-1294
    • yui3-1293
    • yui3-1292
    • yui3-1291
    • yui3-1290
    • yui3-1289
    • yui3-1288
    • yui3-1287
    • yui3-1286
    • yui3-1285
    • yui3-1284
    • yui3-1283
    • yui3-1282
    • yui3-1281
    • yui3-1280
    • yui3-1279
    • yui3-1278
    • yui3-1277
    • yui3-1276
    • yui3-1275
    • yui3-1274
    • yui3-1273
    • yui3-1272
    • yui3-1271
    • yui3-1270
    • yui3-1269
    • yui3-1268
    • yui3-1267
    • yui3-1266
    • yui3-1265
    • yui3-1264
    • yui3-1263
    • yui3-1262
    • yui3-1261
    • yui3-1260
    • yui3-1259
    • yui3-1258
    • yui3-1257
    • yui3-1256
    • yui3-1255
    • yui3-1254
    • yui3-1253
    • yui3-1252
    • yui3-1251
    • yui3-1250
    • yui3-1249
    • yui3-1248
    • yui3-1247
    • yui3-1246
    • yui3-1245
    • yui3-1244
    • yui3-1243
    • yui3-1242
    • yui3-1241
    • yui3-1240
    • yui3-1239
    • yui3-1238
    • yui3-1237
    • yui3-1236
    • yui3-1235
    • yui3-1234
    • yui3-1233
    • yui3-1232
    • yui3-1231
    • yui3-1230
    • yui3-1229
    • yui3-1228
    • yui3-1227
    • yui3-1226
    • yui3-1225
    • yui3-1224
    • yui3-1223
    • yui3-1222
    • yui3-1221
    • yui3-1220
    • yui3-1219
    • yui3-1218
    • yui3-1216
    • yui3-1215
    • yui3-1214
    • yui3-1213
    • yui3-1212
    • yui3-1211
    • yui3-1210
    • yui3-1209
    • yui3-1208
    • yui3-1207
    • yui3-1206
    • yui3-1205
    • yui3-1204
    • yui3-1203
    • yui3-1202
    • yui3-1201
    • yui3-1200
    • yui3-1199
    • yui3-1198
    • yui3-1197
    • yui3-1196
    • yui3-1195
    • yui3-1194
    • yui3-1193
    • yui3-1192
    • yui3-1191
    • yui3-1190
    • yui3-1189
    • yui3-1188
    • yui3-1187
    • yui3-1186
    • yui3-1185
    • yui3-1184
    • yui3-1183
    • yui3-1182
    • yui3-1181
    • yui3-1180
    • yui3-1179
    • yui3-1178
    • yui3-1177
    • yui3-1176
    • yui3-1175
    • yui3-1174
    • yui3-1173
    • yui3-1172
    • yui3-1171
    • yui3-1170
    • yui3-1169
    • yui3-1168
    • yui3-1167
    • yui3-1166
    • yui3-1165
    • yui3-1164
    • yui3-1163
    • yui3-1162
    • yui3-1161
    • yui3-1160
    • yui3-1159
    • yui3-1158
    • yui3-1157
    • yui3-1156
    • yui3-1155
    • yui3-1154
    • yui3-1153
    • yui3-1152
    • yui3-1151
    • yui3-1150
    • yui3-1149
    • yui3-1148
    • yui3-1147
    • yui3-1146
    • yui3-1145
    • yui3-1144
    • yui3-1143
    • yui3-1142
    • yui3-1141
    • yui3-1140
    • yui3-1139
    • yui3-1138
    • yui3-1137
    • yui3-1136
    • yui3-1135
    • yui3-1134
    • yui3-1133
    • yui3-1132
    • yui3-1131
    • yui3-1130
    • yui3-1129
    • yui3-1128
    • yui3-1127
    • yui3-1126
    • yui3-1125
    • yui3-1124
    • yui3-1123
    • yui3-1122
    • yui3-1121
    • yui3-1120
    • yui3-1119
    • yui3-1118
    • yui3-1117
    • yui3-1116
    • yui3-1115
    • yui3-1114
    • yui3-1113
    • yui3-1112
    • yui3-1111
    • yui3-1110
    • yui3-1109
    • yui3-1108
    • yui3-1107
    • yui3-1106
    • yui3-1105
    • yui3-1104
    • yui3-1103
    • yui3-1102
    • yui3-1101
    • yui3-1100
    • yui3-1099
    • yui3-1098
    • yui3-1097
    • yui3-1096
    • yui3-1095
    • yui3-1094
    • yui3-1093
    • yui3-1092
    • yui3-1091
    • yui3-1090
    • yui3-1089
    • yui3-1088
    • yui3-1087
    • yui3-1086
    • yui3-1085
    • yui3-1084
    • yui3-1083
    • yui3-1082
    • yui3-1081
    • yui3-1080
    • yui3-1079
    • yui3-1078
    • yui3-1077
    • yui3-1076
    • yui3-1075
    • yui3-1074
    • yui3-1073
    • yui3-1072
    • yui3-1071
    • yui3-1070
    • yui3-1069
    • yui3-1068
    • yui3-1067
    • yui3-1066
    • yui3-1065
    • yui3-1064
    • yui3-1063
    • yui3-1062
    • yui3-1061
    • yui3-1060
    • yui3-1059
    • yui3-1058
    • yui3-1057
    • yui3-1056
    • yui3-1055
    • yui3-1054
    • yui3-1053
    • yui3-1052
    • yui3-1051
    • yui3-1050
    • yui3-1049
    • yui3-1048
    • yui3-1047
    • yui3-1046
    • yui3-1045
    • yui3-1044
    • yui3-1043
    • yui3-1042
    • yui3-1041
    • yui3-1040
    • yui3-1034
    • yui3-1033
    • yui3-1032
    • yui3-1031
    • yui3-1030
    • yui3-1029
    • yui3-1028
    • yui3-1027
    • yui3-1026
    • yui3-1025
    • yui3-1024
    • yui3-1023
    • yui3-1022
    • yui3-1021
    • yui3-1020
    • yui3-1019
    • yui3-1018
    • yui3-1017
    • yui3-1016
    • yui3-1015
    • yui3-1014
    • yui3-1013
    • yui3-1012
    • yui3-1011
    • yui3-1010
    • yui3-1009
    • yui3-1008
    • yui3-1007
    • yui3-1006
    • yui3-1005
    • yui3-1004
    • yui3-1003
    • yui3-1002
    • yui3-1001
    • yui3-1000
    • yui3-999
    • yui3-998
    • yui3-997
    • yui3-996
    • yui3-995
    • yui3-994
    • yui3-993
    • yui3-992
    • yui3-991
    • yui3-990
    • yui3-989
    • yui3-988
    • yui3-987
    • yui3-986
    • yui3-985
    • yui3-984
    • yui3-983
    • yui3-982
    • yui3-981
    • yui3-980
    • yui3-979
    • yui3-978
    • yui3-977
    • yui3-976
    • yui3-975
    • yui3-974
    • yui3-973
    • yui3-972
    • yui3-971
    • yui3-970
    • yui3-969
    • yui3-968
    • yui3-967
    • yui3-966
    • yui3-965
    • yui3-964
    • yui3-963
    • yui3-962
    • yui3-961
    • yui3-960
    • yui3-959
    • yui3-958
    • yui3-957
    • yui3-956
    • yui3-955
    • yui3-954
    • yui3-953
    • yui3-952
    • yui3-951
    • yui3-950
    • yui3-949
    • yui3-948
    • yui3-947
    • yui3-946
    • yui3-945
    • yui3-944
    • yui3-943
    • yui3-942
    • yui3-941
    • yui3-940
    • yui3-939
    • yui3-938
    • yui3-937
    • yui3-936
    • yui3-935
    • yui3-934
    • yui3-933
    • yui3-932
    • yui3-931
    • yui3-930
    • yui3-929
    • yui3-928
    • yui3-927
    • yui3-926
    • yui3-925
    • yui3-924
    • yui3-923
    • yui3-922
    • yui3-921
    • yui3-920
    • yui3-919
    • yui3-918
    • yui3-917
    • yui3-916
    • yui3-915
    • yui3-914
    • yui3-913
    • yui3-912
    • yui3-911
    • yui3-910
    • yui3-909
    • yui3-908
    • yui3-907
    • yui3-906
    • yui3-905
    • yui3-904
    • yui3-903
    • yui3-902
    • yui3-901
    • yui3-900
    • yui3-899
    • yui3-898
    • yui3-897
    • yui3-896
    • yui3-895
    • yui3-894
    • yui3-893
    • yui3-892
    • yui3-891
    • yui3-890
    • yui3-889
    • yui3-888
    • yui3-887
    • yui3-886
    • yui3-885
    • yui3-884
    • yui3-883
    • yui3-882
    • yui3-881
    • yui3-880
    • yui3-879
    • yui3-878
    • yui3-877
    • yui3-876
    • yui3-875
    • yui3-874
    • yui3-873
    • yui3-872
    • yui3-871
    • yui3-870
    • yui3-869
    • yui3-868
    • yui3-867
    • yui3-866
    • yui3-865
    • yui3-864
    • yui3-863
    • yui3-862
    • yui3-861
    • yui3-860
    • yui3-859
    • yui3-858
    • yui3-857
    • yui3-856
    • yui3-855
    • yui3-854
    • yui3-853
    • yui3-852
    • yui3-851
    • yui3-850
    • yui3-849
    • yui3-848
    • yui3-847
    • yui3-846
    • yui3-845
    • yui3-844
    • yui3-843
    • yui3-842
    • yui3-841
    • yui3-840
    • yui3-839
    • yui3-838
    • yui3-837
    • yui3-836
    • yui3-835
    • yui3-834
    • yui3-833
    • yui3-832
    • yui3-831
    • yui3-830
    • yui3-829
    • yui3-828
    • yui3-827
    • yui3-826
    • yui3-825
    • yui3-824
    • yui3-823
    • yui3-822
    • yui3-821
    • yui3-820
    • yui3-819
    • yui3-818
    • yui3-817
    • yui3-816
    • yui3-815
    • yui3-814
    • yui3-813
    • yui3-812
    • yui3-811
    • yui3-810
    • yui3-809
    • yui3-808
    • yui3-807
    • yui3-806
    • yui3-805
    • yui3-804
    • yui3-803
    • yui3-802
    • yui3-801
    • yui3-800
    • yui3-799
    • yui3-798
    • yui3-797
    • yui3-796
    • yui3-795
    • yui3-794
    • yui3-793
    • yui3-792
    • yui3-791
    • yui3-790
    • yui3-789
    • yui3-788
    • yui3-787
    • yui3-786
    • yui3-785
    • yui3-784
    • yui3-783
    • yui3-782
    • yui3-781
    • yui3-780
    • yui3-779
    • yui3-778
    • yui3-777
    • yui3-776
    • yui3-775
    • yui3-774
    • yui3-773
    • yui3-772
    • yui3-771
    • yui3-770
    • yui3-769
    • yui3-768
    • yui3-767
    • yui3-766
    • yui3-765
    • yui3-764
    • yui3-763
    • yui3-762
    • yui3-761
    • yui3-760
    • yui3-759
    • yui3-758
    • yui3-757
    • yui3-756
    • yui3-755
    • yui3-754
    • yui3-753
    • yui3-752
    • yui3-751
    • yui3-750
    • yui3-749
    • yui3-748
    • yui3-747
    • yui3-746
    • yui3-745
    • yui3-744
    • yui3-743
    • yui3-742
    • yui3-741
    • yui3-740
    • yui3-739
    • yui3-738
    • yui3-737
    • yui3-736
    • yui3-735
    • yui3-734
    • yui3-733
    • yui3-732
    • yui3-731
    • yui3-730
    • yui3-729
    • yui3-728
    • yui3-727
    • yui3-726
    • yui3-725
    • yui3-724
    • yui3-723
    • yui3-722
    • yui3-721
    • yui3-720
    • yui3-719
    • yui3-718
    • yui3-717
    • yui3-716
    • yui3-715
    • yui3-714
    • yui3-713
    • yui3-712
    • yui3-711
    • yui3-710
    • yui3-709
    • yui3-708
    • yui3-707
    • yui3-706
    • yui3-705
    • yui3-704
    • yui3-703
    • yui3-702
    • yui3-701
    • yui3-700
    • yui3-699
    • yui3-698
    • yui3-697
    • yui3-696
    • yui3-695
    • yui3-694
    • yui3-693
    • yui3-692
    • yui3-691
    • yui3-690
    • yui3-689
    • yui3-688
    • yui3-687
    • yui3-686
    • yui3-685
    • yui3-684
    • yui3-683
    • yui3-682
    • yui3-681
    • yui3-680
    • yui3-679
    • yui3-678
    • yui3-677
    • yui3-676
    • yui3-675
    • yui3-674
    • yui3-673
    • yui3-672
    • yui3-671
    • yui3-670
    • yui3-669
    • yui3-668
    • yui3-667
    • yui3-666
    • yui3-665
    • yui3-664
    • yui3-663
    • yui3-662
    • yui3-661
    • yui3-660
    • yui3-659
    • yui3-658
    • yui3-657
    • yui3-656
    • yui3-655
    • yui3-654
    • yui3-653
    • yui3-652
    • yui3-651
    • yui3-650
    • yui3-649
    • yui3-648
    • yui3-647
    • yui3-646
    • yui3-645
    • yui3-644
    • yui3-643
    • yui3-642
    • yui3-641
    • yui3-640
    • yui3-639
    • yui3-638
    • yui3-637
    • yui3-636
    • yui3-635
    • yui3-634
    • yui3-633
    • yui3-632
    • yui3-631
    • yui3-630
    • yui3-629
    • yui3-628
    • yui3-627
    • yui3-626
    • yui3-625
    • yui3-624
    • yui3-623
    • yui3-622
    • yui3-621
    • yui3-620
    • yui3-619
    • yui3-618
    • yui3-617
    • yui3-616
    • yui3-615
    • yui3-614
    • yui3-613
    • yui3-612
    • yui3-611
    • yui3-610
    • yui3-609
    • yui3-608
    • yui3-607
    • yui3-606
    • yui3-605
    • yui3-604
    • yui3-603
    • yui3-602
    • yui3-601
    • yui3-600
    • yui3-599
    • yui3-598
    • yui3-597
    • yui3-596
    • yui3-595
    • yui3-594
    • yui3-593
    • yui3-592
    • yui3-591
    • yui3-590
    • yui3-589
    • yui3-588
    • yui3-587
    • yui3-586
    • yui3-585
    • yui3-584
    • yui3-583
    • yui3-582
    • yui3-581
    • yui3-580
    • yui3-579
    • yui3-578
    • yui3-577
    • yui3-576
    • yui3-575
    • yui3-574
    • yui3-573
    • yui3-572
    • yui3-571
    • yui3-570
    • yui3-569
    • yui3-568
    • yui3-567
    • yui3-566
    • yui3-565
    • yui3-564
    • yui3-563
    • yui3-562
    • yui3-561
    • yui3-560
    • yui3-559
    • yui3-558
    • yui3-557
    • yui3-556
    • yui3-555
    • yui3-554
    • yui3-553
    • yui3-552
    • yui3-551
    • yui3-550
    • yui3-549
    • yui3-548
    • yui3-547
    • yui3-546
    • yui3-545
    • yui3-544
    • yui3-543
    • yui3-542
    • yui3-541
    • yui3-540
    • yui3-539
    • yui3-538
    • yui3-537
    • yui3-536
    • yui3-535
    • yui3-534
    • yui3-533
    • yui3-532
    • yui3-531
    • yui3-530
    • yui3-529
    • yui3-528
    • yui3-527
    • yui3-526
    • yui3-525
    • yui3-524
    • yui3-523
    • yui3-522
    • yui3-521
    • yui3-520
    • yui3-519
    • yui3-518
    • yui3-517
    • yui3-516
    • yui3-515
    • yui3-514
    • yui3-513
    • yui3-512
    • yui3-511
    • yui3-510
    • yui3-509
    • yui3-508
    • yui3-507
    • yui3-506
    • yui3-505
    • yui3-504
    • yui3-503
    • yui3-502
    • yui3-501
    • yui3-500
    • yui3-499
    • yui3-498
    • yui3-497
    • yui3-496
    • yui3-495
    • yui3-494
    • yui3-493
    • yui3-492
    • yui3-491
    • yui3-490
    • yui3-489
    • yui3-488
    • yui3-487
    • yui3-486
    • yui3-485
    • yui3-484
    • yui3-483
    • yui3-482
    • yui3-481
    • yui3-480
    • yui3-479
    • yui3-478
    • yui3-477
    • yui3-476
    • yui3-475
    • yui3-474
    • yui3-473
    • yui3-472
    • yui3-471
    • yui3-470
    • yui3-469
    • yui3-468
    • yui3-467
    • yui3-466
    • yui3-465
    • yui3-464
    • yui3-463
    • yui3-462
    • yui3-461
    • yui3-460
    • yui3-459
    • yui3-458
    • yui3-457
    • yui3-456
    • yui3-455
    • yui3-454
    • yui3-453
    • yui3-452
    • yui3-451
    • yui3-450
    • yui3-449
    • yui3-448
    • yui3-447
    • yui3-446
    • yui3-445
    • yui3-444
    • yui3-443
    • yui3-442
    • yui3-441
    • yui3-440
    • yui3-439
    • yui3-438
    • yui3-437
    • yui3-436
    • yui3-435
    • yui3-434
    • yui3-433
    • yui3-432
    • yui3-431
    • yui3-430
    • yui3-429
    • yui3-428
    • yui3-427
    • yui3-426
    • yui3-425
    • yui3-424
    • yui3-423
    • yui3-422
    • yui3-421
    • yui3-420
    • yui3-419
    • yui3-418
    • yui3-417
    • yui3-416
    • yui3-415
    • yui3-414
    • yui3-413
    • yui3-412
    • yui3-411
    • yui3-410
    • yui3-409
    • yui3-408
    • yui3-407
    • yui3-406
    • yui3-405
    • yui3-404
    • yui3-403
    • yui3-402
    • yui3-401
    • yui3-400
    • yui3-399
    • yui3-398
    • yui3-397
    • yui3-396
    • yui3-395
    • yui3-394
    • yui3-393
    • yui3-392
    • yui3-391
    • yui3-390
    • yui3-389
    • yui3-388
    • yui3-387
    • yui3-386
    • yui3-385
    • yui3-384
    • yui3-383
    • yui3-382
    • yui3-381
    • yui3-380
    • yui3-379
    • yui3-378
    • yui3-377
    • yui3-376
    • yui3-375
    • yui3-374
    • yui3-373
    • yui3-372
    • yui3-371
    • yui3-370
    • yui3-369
    • yui3-368
    • yui3-367
    • yui3-366
    • yui3-365
    • yui3-364
    • yui3-363
    • yui3-362
    • yui3-361
    • yui3-360
    • yui3-359
    • yui3-358
    • yui3-357
    • yui3-356
    • yui3-355
    • yui3-354
    • yui3-353
    • yui3-352
    • yui3-351
    • yui3-350
    • yui3-349
    • yui3-348
    • yui3-347
    • yui3-346
    • yui3-345
    • yui3-344
    • yui3-343
    • yui3-342
    • yui3-341
    • yui3-340
    • yui3-339
    • yui3-338
    • yui3-337
    • yui3-336
    • yui3-335
    • yui3-334
    • yui3-333
    • yui3-332
    • yui3-331
    • yui3-330
    • yui3-329
    • yui3-328
    • yui3-327
    • yui3-326
    • yui3-325
    • yui3-324
    • yui3-323
    • yui3-322
    • yui3-321
    • yui3-320
    • yui3-319
    • yui3-318
    • yui3-317
    • yui3-316
    • yui3-315
    • yui3-314
    • yui3-313
    • yui3-312
    • yui3-311
    • yui3-310
    • yui3-309
    • yui3-308
    • yui3-307
    • yui3-306
    • yui3-305
    • yui3-304
    • yui3-303
    • yui3-302
    • yui3-301
    • yui3-300
    • yui3-299
    • yui3-298
    • yui3-297
    • yui3-296
    • yui3-295
    • yui3-294
    • yui3-293
    • yui3-292
    • yui3-291
    • yui3-290
    • yui3-289
    • yui3-288
    • yui3-287
    • yui3-286
    • yui3-285
    • yui3-284
    • yui3-283
    • yui3-282
    • yui3-281
    • yui3-280
    • yui3-279
    • yui3-278
    • yui3-277
    • yui3-276
    • yui3-275
    • yui3-274
    • yui3-273
    • yui3-272
    • yui3-271
    • yui3-270
    • yui3-269
    • yui3-268
    • yui3-267
    • yui3-266
    • yui3-265
    • yui3-264
    • yui3-263
    • yui3-262
    • yui3-261
    • yui3-260
    • yui3-259
    • yui3-258
    • yui3-257
    • yui3-256
    • yui3-255
    • yui3-254
    • 3.1.0pr2
    • 3.1.0pr1
    • 3.0.0pr2
    • 3.0.0beta1m3
    • 3.0.0beta1m2
    • 3.0.0beta1m1
    • 3.0.0b1
    • 3.0.0
  • Comments
Sending Request…

YUI 3.x Source Tree — Read more

  Cancel

http://developer.yahoo.com/yui/3/

  Cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Removed autocomplete src/build from yui3 (it wasn't building). The working 
version of autocomplete exists in yui gallery
Satyen Desai (author)
Mon Feb 08 11:32:14 -0800 2010
commit  7cf949b568ccca7123bf07f34acf306bae24acc0
tree    71fb90cbeaab3af130514b878f31ef1ac755bd2a
parent  a926202402478ee669a5c2f4b82ee16088ee0950
D build/ac-plugin/ac-plugin-debug.js 197 •••••
D build/ac-plugin/ac-plugin-min.js 1 •
D build/ac-plugin/ac-plugin.js 197 •••••
D build/ac-widget/ac-widget-debug.js 229 •••••
D build/ac-widget/ac-widget-min.js 1 •
D build/ac-widget/ac-widget.js 228 •••••
D build/autocomplete/autocomplete-debug.js 430 •••••
D build/autocomplete/autocomplete-min.js 1 •
D build/autocomplete/autocomplete.js 429 •••••
D src/autocomplete/ac-plugin.properties 5 •••••
D src/autocomplete/ac-plugin.xml 6 •••••
D src/autocomplete/ac-widget.properties 4 ••••
D src/autocomplete/ac-widget.xml 6 •••••
D src/autocomplete/build.properties 10 •••••
D src/autocomplete/build.xml 7 •••••
D src/autocomplete/js/ac-plugin.js 283 •••••
D src/autocomplete/js/ac-widget.js 365 •••••
D src/autocomplete/test/ac-delimited.js 30 •••••
D src/autocomplete/test/ac-inline.js 22 •••••
D src/autocomplete/test/ac-plugin.html 218 •••••
D src/autocomplete/test/ac-plugin.js 194 •••••
D src/autocomplete/test/ac-widget.html 122 •••••
D src/autocomplete/test/ac-widget.js 222 •••••
D src/autocomplete/test/stories.md 59 •••••
D src/autocomplete/test/test-widget.html 140 •••••
D src/autocomplete/test/ysearch/all-min.js 1 •
D src/autocomplete/test/ysearch/all-min.js.gz 0
D src/autocomplete/test/ysearch/autocomplete-min.js 1 •
D src/autocomplete/test/ysearch/build.sh 25 •••••
D src/autocomplete/test/ysearch/value-change-min.js 1 •
D src/autocomplete/test/ysearch/widget-min.js 2 ••
0
build/ac-plugin/ac-plugin-debug.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,197 +0,0 @@
0
-YUI.add('ac-plugin', function(Y) {
0
-
0
-
0
-
0
-var autocomplete = "autocomplete",
0
-    YLang = Y.Lang,
0
-    YArrayeach = Y.Array.each,
0
-    eventDefaultBehavior = {
0
-        query : function (e) {
0
-            var self = this,
0
-                ds = self.get("dataSource"),
0
-                query = e.value,
0
-                handler = Y.bind(handleQueryResponse, self);
0
-            // if we have a datasource, then make the request.
0
-            if (ds) ds.sendRequest({
0
-                request : self.get("queryTemplate")(query),
0
-                callback : {
0
-                    success : handler,
0
-                    failure : handler
0
-                }
0
-            });
0
-        }
0
-    };
0
-
0
-
0
-function ACPlugin () { ACPlugin.superclass.constructor.apply(this, arguments) };
0
-
0
-Y.extend(
0
-    (Y.Plugin.ACPlugin = Y.augment(ACPlugin, Y.EventTarget)),
0
-    Y.Plugin.Base,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this,
0
-                host = self.get("host");
0
-            self.handles = attachHandles(self, host);
0
-
0
-            // publish events:
0
-            // keep it simple
0
-            // "query" for when value changes.
0
-            // "load" for when data returns.
0
-            // "show" for when it's time to show something
0
-            // "hide" for when it's time to hide
0
-            var defaults = eventDefaultBehavior;
0
-            YArrayeach([
0
-                "query",
0
-                "load",
0
-                "show",
0
-                "hide",
0
-                "next",
0
-                "previous"
0
-            ], function (ev) { self.publish("ac:"+ev, {
0
-                broadcast : 1,
0
-                bubbles : 1,
0
-                context : self,
0
-                preventable : true,
0
-                defaultFn : defaults[ev] || null,
0
-                prefix : "ac"
0
-            }) }, self);
0
-
0
-            // manage the browser's autocomplete, since that'll interefere,
0
-            // but we need to make sure that we don't prevent pre-filling 
0
-            // when the user navs back to the page, unless the developer has
0
-            // specifically disabled that feature in the markup.
0
-            manageBrowserAC(host);
0
-        },
0
-        destructor : function () {
0
-            YArrayeach(this.handles, function (h) { h.detach() });
0
-        },
0
-        open : function () { this.fire("ac:show") },
0
-        next : function (e) { e.preventDefault(); this.fire("ac:next") },
0
-        previous : function (e) { e.preventDefault(); this.fire("ac:previous") },
0
-        close : function () { this.fire("ac:hide") }
0
-    },
0
-    { // statics
0
-        NAME : "ACPlugin",
0
-        NS : "ac",
0
-        ATTRS : {
0
-            queryValue : {
0
-                // override these in the other AC modules as necessary.
0
-                // for instance, the delimited getter could get the cursor location,
0
-                // split on the delimiter, and then return the selected one.
0
-                // the inline-replacing setter could set-and-select the rest of the word.
0
-                getter : function () {
0
-                    return this.get("host").get("value");
0
-                },
0
-                setter : function (q) {
0
-                    this.get("host").set("value", q);
0
-                    // keep track of what it has been explicitly set to, so that we don't
0
-                    // try to make a query repeatedly when the user hasn't done anything.
0
-                    return (this._cachedValue = q);
0
-                }
0
-            },
0
-
0
-            // data source object
0
-            dataSource : {
0
-                validator : function (ds) {
0
-                    // quack.
0
-                    return ds && YLang.isFunction(ds.sendRequest);
0
-                }
0
-            },
0
-
0
-            // minimum number of chars before we'll query
0
-            minQueryLength : {
0
-                value : 3,
0
-                validator : YLang.isNumber
0
-            },
0
-
0
-            // convert a value into a request for the DS
0
-            // Can be either a string containg "{query}" somewhere,
0
-            // or a function that takes and returns a string.
0
-            queryTemplate : {
0
-                value : encodeURIComponent,
0
-                setter : function (q) {
0
-                    return (
0
-                        YLang.isFunction(q) ? q
0
-                        : function (query) {
0
-                            // exchange {query} with the query,
0
-                            // but turn \{query} into {query}, if for some reason that
0
-                            // string needs to appear in the URL.
0
-                            return q
0
-                                .replace(
0
-                                    /(^|[^\\])((\\{2})*)\{query\}/,
0
-                                    '$1$2'+encodeURIComponent(query)
0
-                                ).replace(
0
-                                    /(^|[^\\])((\\{2})*)\\(\{query\})/,
0
-                                    '$1$2$4'
0
-                                );
0
-                        }
0
-                    );
0
-                }
0
-            }
0
-
0
-        } // end attrs
0
-    } // end statics
0
-);
0
-
0
-// helpers below
0
-
0
-function attachHandles (self, host) {
0
-    return [
0
-        // query on valueChange
0
-        Y.on("valueChange", valueChangeHandler, host, self),
0
-        // next/open on down
0
-        Y.on("key", self.next, host, "down:40", self),
0
-        // previous on up
0
-        Y.on("key", self.previous, host, "down:38", self),
0
-        // close on escape
0
-        Y.on("key", self.close, host, "down:27", self)
0
-    ];
0
-};
0
-
0
-function valueChangeHandler (e) {
0
-    var value = e.value;
0
-    if (!value) return this.close();
0
-    if (value === this._cachedValue || value.length < this.get("minQueryLength")) return;
0
-    this._cachedValue = value;
0
-    this.fire( "ac:query", { value : e.value });
0
-};
0
-
0
-
0
-function browserACFixer (domnode) { return function () {
0
-    if (domnode) domnode.setAttribute(autocomplete, "on");
0
-    domnode = null;
0
-}};
0
-
0
-function manageBrowserAC (host) {
0
-    // turn off the browser's autocomplete, but take note of it to turn
0
-    // it back on later.
0
-    var domnode = Y.Node.getDOMNode(host),
0
-        bac = domnode.getAttribute(autocomplete);
0
-
0
-    // turn the autocomplete back on so back button works, but only
0
-    // if the user hasn't disabled it in the first place.
0
-    if ((bac && bac !== "off") || bac === null || bac === undefined) {
0
-        var bacf = browserACFixer(domnode);
0
-        // hook onto both.  Concession to browser craziness.
0
-        Y.on("beforeunload", bacf, window);
0
-        Y.on("unload", bacf, window);
0
-    }
0
-
0
-    // turn off the browser's autocomplete feature, since that'll interfere.
0
-    domnode.setAttribute(autocomplete, "off");
0
-};
0
-
0
-function handleQueryResponse (e) {
0
-    var res = (e && e.response && e.response.results) ? e.response.results : e;
0
-    
0
-    // if there is a result, and it's not an empty array
0
-    if (res && !(res && ("length" in res) && res.length === 0)) this.fire("ac:load", {
0
-        results : res,
0
-        query : this.get("queryValue")
0
-    });
0
-};
0
-
0
-
0
-
0
-}, '@VERSION@' ,{requires:['node', 'plugin', 'value-change', 'event-key'], optional:['event-custom']});
0
build/ac-plugin/ac-plugin-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("ac-plugin",function(C){var B="autocomplete",K=C.Lang,D=C.Array.each,F={query:function(P){var L=this,O=L.get("dataSource"),N=P.value,M=C.bind(G,L);if(O){O.sendRequest({request:L.get("queryTemplate")(N),callback:{success:M,failure:M}});}}};function E(){E.superclass.constructor.apply(this,arguments);}C.extend((C.Plugin.ACPlugin=C.augment(E,C.EventTarget)),C.Plugin.Base,{initializer:function(){var L=this,M=L.get("host");L.handles=I(L,M);var N=F;D(["query","load","show","hide","next","previous"],function(O){L.publish("ac:"+O,{broadcast:1,bubbles:1,context:L,preventable:true,defaultFn:N[O]||null,prefix:"ac"});},L);J(M);},destructor:function(){D(this.handles,function(L){L.detach();});},open:function(){this.fire("ac:show");},next:function(L){L.preventDefault();this.fire("ac:next");},previous:function(L){L.preventDefault();this.fire("ac:previous");},close:function(){this.fire("ac:hide");}},{NAME:"ACPlugin",NS:"ac",ATTRS:{queryValue:{getter:function(){return this.get("host").get("value");},setter:function(L){this.get("host").set("value",L);return(this._cachedValue=L);}},dataSource:{validator:function(L){return L&&K.isFunction(L.sendRequest);}},minQueryLength:{value:3,validator:K.isNumber},queryTemplate:{value:encodeURIComponent,setter:function(L){return(K.isFunction(L)?L:function(M){return L.replace(/(^|[^\\])((\\{2})*)\{query\}/,"$1$2"+encodeURIComponent(M)).replace(/(^|[^\\])((\\{2})*)\\(\{query\})/,"$1$2$4");});}}}});function I(L,M){return[C.on("valueChange",H,M,L),C.on("key",L.next,M,"down:40",L),C.on("key",L.previous,M,"down:38",L),C.on("key",L.close,M,"down:27",L)];}function H(M){var L=M.value;if(!L){return this.close();}if(L===this._cachedValue||L.length<this.get("minQueryLength")){return;}this._cachedValue=L;this.fire("ac:query",{value:M.value});}function A(L){return function(){if(L){L.setAttribute(B,"on");}L=null;};}function J(L){var N=C.Node.getDOMNode(L),O=N.getAttribute(B);if((O&&O!=="off")||O===null||O===undefined){var M=A(N);C.on("beforeunload",M,window);C.on("unload",M,window);}N.setAttribute(B,"off");}function G(M){var L=(M&&M.response&&M.response.results)?M.response.results:M;if(L&&!(L&&("length" in L)&&L.length===0)){this.fire("ac:load",{results:L,query:this.get("queryValue")});}}},"@VERSION@",{requires:["node","plugin","value-change","event-key"],optional:["event-custom"]});
0
\ No newline at end of file
0
build/ac-plugin/ac-plugin.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,197 +0,0 @@
0
-YUI.add('ac-plugin', function(Y) {
0
-
0
-
0
-
0
-var autocomplete = "autocomplete",
0
-    YLang = Y.Lang,
0
-    YArrayeach = Y.Array.each,
0
-    eventDefaultBehavior = {
0
-        query : function (e) {
0
-            var self = this,
0
-                ds = self.get("dataSource"),
0
-                query = e.value,
0
-                handler = Y.bind(handleQueryResponse, self);
0
-            // if we have a datasource, then make the request.
0
-            if (ds) ds.sendRequest({
0
-                request : self.get("queryTemplate")(query),
0
-                callback : {
0
-                    success : handler,
0
-                    failure : handler
0
-                }
0
-            });
0
-        }
0
-    };
0
-
0
-
0
-function ACPlugin () { ACPlugin.superclass.constructor.apply(this, arguments) };
0
-
0
-Y.extend(
0
-    (Y.Plugin.ACPlugin = Y.augment(ACPlugin, Y.EventTarget)),
0
-    Y.Plugin.Base,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this,
0
-                host = self.get("host");
0
-            self.handles = attachHandles(self, host);
0
-
0
-            // publish events:
0
-            // keep it simple
0
-            // "query" for when value changes.
0
-            // "load" for when data returns.
0
-            // "show" for when it's time to show something
0
-            // "hide" for when it's time to hide
0
-            var defaults = eventDefaultBehavior;
0
-            YArrayeach([
0
-                "query",
0
-                "load",
0
-                "show",
0
-                "hide",
0
-                "next",
0
-                "previous"
0
-            ], function (ev) { self.publish("ac:"+ev, {
0
-                broadcast : 1,
0
-                bubbles : 1,
0
-                context : self,
0
-                preventable : true,
0
-                defaultFn : defaults[ev] || null,
0
-                prefix : "ac"
0
-            }) }, self);
0
-
0
-            // manage the browser's autocomplete, since that'll interefere,
0
-            // but we need to make sure that we don't prevent pre-filling 
0
-            // when the user navs back to the page, unless the developer has
0
-            // specifically disabled that feature in the markup.
0
-            manageBrowserAC(host);
0
-        },
0
-        destructor : function () {
0
-            YArrayeach(this.handles, function (h) { h.detach() });
0
-        },
0
-        open : function () { this.fire("ac:show") },
0
-        next : function (e) { e.preventDefault(); this.fire("ac:next") },
0
-        previous : function (e) { e.preventDefault(); this.fire("ac:previous") },
0
-        close : function () { this.fire("ac:hide") }
0
-    },
0
-    { // statics
0
-        NAME : "ACPlugin",
0
-        NS : "ac",
0
-        ATTRS : {
0
-            queryValue : {
0
-                // override these in the other AC modules as necessary.
0
-                // for instance, the delimited getter could get the cursor location,
0
-                // split on the delimiter, and then return the selected one.
0
-                // the inline-replacing setter could set-and-select the rest of the word.
0
-                getter : function () {
0
-                    return this.get("host").get("value");
0
-                },
0
-                setter : function (q) {
0
-                    this.get("host").set("value", q);
0
-                    // keep track of what it has been explicitly set to, so that we don't
0
-                    // try to make a query repeatedly when the user hasn't done anything.
0
-                    return (this._cachedValue = q);
0
-                }
0
-            },
0
-
0
-            // data source object
0
-            dataSource : {
0
-                validator : function (ds) {
0
-                    // quack.
0
-                    return ds && YLang.isFunction(ds.sendRequest);
0
-                }
0
-            },
0
-
0
-            // minimum number of chars before we'll query
0
-            minQueryLength : {
0
-                value : 3,
0
-                validator : YLang.isNumber
0
-            },
0
-
0
-            // convert a value into a request for the DS
0
-            // Can be either a string containg "{query}" somewhere,
0
-            // or a function that takes and returns a string.
0
-            queryTemplate : {
0
-                value : encodeURIComponent,
0
-                setter : function (q) {
0
-                    return (
0
-                        YLang.isFunction(q) ? q
0
-                        : function (query) {
0
-                            // exchange {query} with the query,
0
-                            // but turn \{query} into {query}, if for some reason that
0
-                            // string needs to appear in the URL.
0
-                            return q
0
-                                .replace(
0
-                                    /(^|[^\\])((\\{2})*)\{query\}/,
0
-                                    '$1$2'+encodeURIComponent(query)
0
-                                ).replace(
0
-                                    /(^|[^\\])((\\{2})*)\\(\{query\})/,
0
-                                    '$1$2$4'
0
-                                );
0
-                        }
0
-                    );
0
-                }
0
-            }
0
-
0
-        } // end attrs
0
-    } // end statics
0
-);
0
-
0
-// helpers below
0
-
0
-function attachHandles (self, host) {
0
-    return [
0
-        // query on valueChange
0
-        Y.on("valueChange", valueChangeHandler, host, self),
0
-        // next/open on down
0
-        Y.on("key", self.next, host, "down:40", self),
0
-        // previous on up
0
-        Y.on("key", self.previous, host, "down:38", self),
0
-        // close on escape
0
-        Y.on("key", self.close, host, "down:27", self)
0
-    ];
0
-};
0
-
0
-function valueChangeHandler (e) {
0
-    var value = e.value;
0
-    if (!value) return this.close();
0
-    if (value === this._cachedValue || value.length < this.get("minQueryLength")) return;
0
-    this._cachedValue = value;
0
-    this.fire( "ac:query", { value : e.value });
0
-};
0
-
0
-
0
-function browserACFixer (domnode) { return function () {
0
-    if (domnode) domnode.setAttribute(autocomplete, "on");
0
-    domnode = null;
0
-}};
0
-
0
-function manageBrowserAC (host) {
0
-    // turn off the browser's autocomplete, but take note of it to turn
0
-    // it back on later.
0
-    var domnode = Y.Node.getDOMNode(host),
0
-        bac = domnode.getAttribute(autocomplete);
0
-
0
-    // turn the autocomplete back on so back button works, but only
0
-    // if the user hasn't disabled it in the first place.
0
-    if ((bac && bac !== "off") || bac === null || bac === undefined) {
0
-        var bacf = browserACFixer(domnode);
0
-        // hook onto both.  Concession to browser craziness.
0
-        Y.on("beforeunload", bacf, window);
0
-        Y.on("unload", bacf, window);
0
-    }
0
-
0
-    // turn off the browser's autocomplete feature, since that'll interfere.
0
-    domnode.setAttribute(autocomplete, "off");
0
-};
0
-
0
-function handleQueryResponse (e) {
0
-    var res = (e && e.response && e.response.results) ? e.response.results : e;
0
-    
0
-    // if there is a result, and it's not an empty array
0
-    if (res && !(res && ("length" in res) && res.length === 0)) this.fire("ac:load", {
0
-        results : res,
0
-        query : this.get("queryValue")
0
-    });
0
-};
0
-
0
-
0
-
0
-}, '@VERSION@' ,{requires:['node', 'plugin', 'value-change', 'event-key'], optional:['event-custom']});
0
build/ac-widget/ac-widget-debug.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,229 +0,0 @@
0
-YUI.add('ac-widget', function(Y) {
0
-
0
-// just a default display widget for the autocomplete component
0
-// this is the one you expect when you say "autocomplete"
0
-
0
-function ACWidget () { ACWidget.superclass.constructor.apply(this, arguments) };
0
-
0
-var HANDLES = "_handles",
0
-    selectedIndex = "selectedIndex",
0
-    _selectedIndex = "_selectedIndex",
0
-    _originalValue = "_originalValue",
0
-    YArrayeach = Y.Array.each,
0
-    queryValue = "queryValue";
0
-
0
-
0
-Y.ACWidget = Y.extend(
0
-    ACWidget,
0
-    Y.Widget,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this;
0
-            self.after("queryChanged", self.syncUI, self);
0
-            self.after("dataChanged", self.syncUI, self);
0
-            self.hide();
0
-        },
0
-        renderUI : function () {
0
-            var ac = this.get("ac");
0
-            if (!ac) {
0
-                Y.log("Attach before attempting to render the widget", "error", "ac-widget");
0
-                return;
0
-            }
0
-            var input = ac.get("host");
0
-            insertAfter(this.get("boundingBox"), input);
0
-            return this.setSize();
0
-        },
0
-        setSize : function () {            
0
-            return this.set("width", this.get("ac").get("host").getComputedStyle("width"));
0
-        },
0
-        bindUI : function (ac) {
0
-            var widget = this,
0
-                cb = widget.get("contentBox"), //INHERITED
0
-                ac = ac || widget.get("ac");
0
-            if (widget[HANDLES]) {
0
-                YArrayeach(widget[HANDLES], function (handle) { handle.detach() });
0
-                widget[HANDLES] = 0; // small and falsey
0
-            }
0
-            if (ac) widget[HANDLES] = [
0
-                cb.delegate("click", widget.click, "li", widget),
0
-                Y.on("click", widget.hide, document), //INHERITED
0
-                ac.on("ac:load", function (e) {
0
-                    widget
0
-                        .set("query", e.query)
0
-                        .set("data", e.results)
0
-                        .syncUI()
0
-                        .show();
0
-                }),
0
-                ac.on("ac:query", function (e) {
0
-                    widget.set("query", e.value).syncUI();
0
-                }),
0
-                ac.on("ac:next", widget.next, widget),
0
-                ac.on("ac:previous", widget.previous, widget),
0
-                ac.on("ac:hide", widget.hide, widget) //INHERITED
0
-            ];
0
-            return widget;
0
-        },
0
-        syncUI : function () {
0
-            var self = this,
0
-                data = self.get("data"),
0
-                query = self.get("query");
0
-            if (!data) return self;
0
-            self[_selectedIndex] = -1;
0
-            self[_originalValue] = "";
0
-            self.get("contentBox").set("innerHTML", self.getListMarkup(data)); //INHERITED
0
-            return self;
0
-        },
0
-        getListMarkup : function (data) {
0
-            var self = this,
0
-                listTemplate = self.get("listTpl"),
0
-                markup = [];
0
-            YArrayeach(data, function (item) {
0
-                markup.push(self.getItemMarkup(item));
0
-            });
0
-            return listTemplate.replace(/\{list\}/g, markup.join(""));
0
-        },
0
-        getItemMarkup : function (item) {
0
-            return this.get("itemTpl")
0
-                .replace(/\{term\}/g, item)
0
-                .replace(/\{hilite\}/g, this.getHiliteMarkup(item))
0
-                // .replace(/<([^<>]*)<[^>]*>([^<>]*)>/g, '<$1$2>');
0
-        },
0
-        getHiliteMarkup : function (item) {
0
-            var self = this,
0
-                queryTerms = self.get("query").split(/\s+/)
0
-                out = item;
0
-            YArrayeach(queryTerms, function (term) {
0
-                if (!term) return;
0
-                term = regexpEscape(term);
0
-                out = out.replace(
0
-                    new RegExp(term, "g"),
0
-                    self.get("hiliteTpl").replace(/\{term\}/g, term)
0
-                );
0
-            });
0
-            return out;
0
-        },
0
-        next : function () {
0
-            var self = this;
0
-            if (self.get("visible")) return self.selectNext();
0
-            if (self.get("data")) self.show();
0
-            return self;
0
-        },
0
-        selectNext : function () {
0
-            var si = this.get(selectedIndex);
0
-            return this.set(selectedIndex, si + 1);
0
-        },
0
-        selectPrevious : function () {
0
-            var si = this.get(selectedIndex);
0
-            return this.set(selectedIndex, si - 1);
0
-        },
0
-        previous : function () {
0
-            if (this.get("visible")) this.selectPrevious();
0
-            return this;
0
-        },
0
-        item : function (n) {
0
-            return this.get("contentBox")
0
-                .one(this.get("itemSelector").replace(/\{n\}/g, regexpEscape(n + 1)));
0
-        },
0
-        click : function (e) {
0
-            var self = this,
0
-                ac = self.get("ac"),
0
-                val = e.currentTarget.get("text");
0
-            ac.set(queryValue, val);
0
-            self[_selectedIndex] = -1;
0
-            self._currentValue = val;
0
-            ac.get("host").focus();
0
-            self.hide();
0
-        }
0
-    },
0
-    { // statics
0
-        NAME : "ACWidget",
0
-        ATTRS : {
0
-            ac : {
0
-                setter : function (ac) {
0
-                    if (!this[HANDLES]) return; // it'll get bound when it renders
0
-                    this.bindUI(ac);
0
-                },
0
-                validator : function (ac) {
0
-                    // TODO: Add some testing here.
0
-                    return true
0
-                }
0
-            },
0
-            data : {
0
-                validator : function (d) { return d && d.length > 0 }
0
-            },
0
-            query : { value : "" },
0
-            listTpl : { value : "<ul>{list}</ul>" },
0
-            itemTpl : { value : "<li>{hilite}</li>" },
0
-            itemSelector : { value : "ul li:nth-child({n})" },
0
-            hiliteTpl : { value : "<em>{term}</em>" }
0
-        } // ATTRS
0
-    } // statics
0
-);
0
-// don't define this one inline, so that we can compress the key
0
-ACWidget.ATTRS[selectedIndex] = {
0
-    value : -1,
0
-    validator : function (si) {
0
-        var d = this.get("data");
0
-        return d && Y.Lang.isNumber(si);
0
-    },
0
-    getter : function () { return this[_selectedIndex] },
0
-    setter : function (si) {
0
-        var self = this,
0
-            current = self.get(selectedIndex),
0
-            d = self.get("data"),
0
-            l = d && d.length,
0
-            ac = self.get("ac"),
0
-            selClass = this.getClassName("selected"); //INHERITED
0
-        if (isNaN(current)) current = -1;
0
-        if (!d || !l) return;
0
-        
0
-        // first normalize them both to a number between
0
-        // (-1)..(d.length - 1) where -1 means "what the user typed"
0
-        // this should probably be a function, rather than copy pasta.
0
-        // but for this small a snippet of code, it's fewer bytes to just
0
-        // copy, especially when gzip gets at it.
0
-        while (si < -1) si += l + 1;
0
-        si = (si + 1) % (l + 1) - 1;
0
-        current = (current + 1) % (l + 1) - 1;
0
-                            
0
-        // actually set it, the rest is just monkey business.
0
-        self[_selectedIndex] = si;
0
-        
0
-        // hang onto this, we'll need it later.
0
-        if (current === -1) {
0
-            self[_originalValue] = ac.get(queryValue);
0
-        }
0
-        
0
-        // nothing changing!
0
-        if (current === si) return;
0
-        
0
-        // undo the current one, but only if it's not -1
0
-        var curItem = self.get("contentBox").one("."+selClass);
0
-        if (curItem) curItem.removeClass(selClass);
0
-        
0
-        // handle the new thing
0
-        if (si === -1) {
0
-            // back to the start
0
-            ac.set(queryValue, this[_originalValue]);
0
-        } else {
0
-            var newItem = self.item(si);
0
-            if (newItem) newItem.addClass(selClass);
0
-            ac.set(queryValue, d[si]);
0
-        }
0
-        return si;
0
-    }
0
-}; // selectedIndex
0
-
0
-function regexpEscape (text) {
0
-    return (""+text).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g, '\\$1');
0
-}
0
-
0
-function insertAfter (node, ref) {
0
-    var p = ref.get("parentNode");
0
-    p.insertBefore(node, ref);
0
-    p.insertBefore(ref, node);
0
-};
0
-
0
-
0
-
0
-}, '@VERSION@' ,{requires:['widget','ac-plugin']});
0
build/ac-widget/ac-widget-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("ac-widget",function(A){function D(){D.superclass.constructor.apply(this,arguments);}var C="_handles",E="selectedIndex",J="_selectedIndex",G="_originalValue",B=A.Array.each,F="queryValue";A.ACWidget=A.extend(D,A.Widget,{initializer:function(){var K=this;K.after("queryChanged",K.syncUI,K);K.after("dataChanged",K.syncUI,K);K.hide();},renderUI:function(){var L=this.get("ac");if(!L){return;}var K=L.get("host");H(this.get("boundingBox"),K);return this.setSize();},setSize:function(){return this.set("width",this.get("ac").get("host").getComputedStyle("width"));},bindUI:function(L){var M=this,K=M.get("contentBox"),L=L||M.get("ac");if(M[C]){B(M[C],function(N){N.detach();});M[C]=0;}if(L){M[C]=[K.delegate("click",M.click,"li",M),A.on("click",M.hide,document),L.on("ac:load",function(N){M.set("query",N.query).set("data",N.results).syncUI().show();}),L.on("ac:query",function(N){M.set("query",N.value).syncUI();}),L.on("ac:next",M.next,M),L.on("ac:previous",M.previous,M),L.on("ac:hide",M.hide,M)];}return M;},syncUI:function(){var K=this,M=K.get("data"),L=K.get("query");if(!M){return K;}K[J]=-1;K[G]="";K.get("contentBox").set("innerHTML",K.getListMarkup(M));return K;},getListMarkup:function(N){var M=this,K=M.get("listTpl"),L=[];B(N,function(O){L.push(M.getItemMarkup(O));});return K.replace(/\{list\}/g,L.join(""));},getItemMarkup:function(K){return this.get("itemTpl").replace(/\{term\}/g,K).replace(/\{hilite\}/g,this.getHiliteMarkup(K));},getHiliteMarkup:function(M){var L=this,K=L.get("query").split(/\s+/);out=M;B(K,function(N){if(!N){return;}N=I(N);out=out.replace(new RegExp(N,"g"),L.get("hiliteTpl").replace(/\{term\}/g,N));});return out;},next:function(){var K=this;if(K.get("visible")){return K.selectNext();}if(K.get("data")){K.show();}return K;},selectNext:function(){var K=this.get(E);return this.set(E,K+1);},selectPrevious:function(){var K=this.get(E);return this.set(E,K-1);},previous:function(){if(this.get("visible")){this.selectPrevious();}return this;},item:function(K){return this.get("contentBox").one(this.get("itemSelector").replace(/\{n\}/g,I(K+1)));},click:function(M){var K=this,L=K.get("ac"),N=M.currentTarget.get("text");L.set(F,N);K[J]=-1;K._currentValue=N;L.get("host").focus();K.hide();}},{NAME:"ACWidget",ATTRS:{ac:{setter:function(K){if(!this[C]){return;}this.bindUI(K);},validator:function(K){return true;}},data:{validator:function(K){return K&&K.length>0;}},query:{value:""},listTpl:{value:"<ul>{list}</ul>"},itemTpl:{value:"<li>{hilite}</li>"},itemSelector:{value:"ul li:nth-child({n})"},hiliteTpl:{value:"<em>{term}</em>"}}});D.ATTRS[E]={value:-1,validator:function(K){var L=this.get("data");return L&&A.Lang.isNumber(K);},getter:function(){return this[J];},setter:function(M){var R=this,O=R.get(E),P=R.get("data"),K=P&&P.length,Q=R.get("ac"),L=this.getClassName("selected");if(isNaN(O)){O=-1;}if(!P||!K){return;}while(M<-1){M+=K+1;}M=(M+1)%(K+1)-1;O=(O+1)%(K+1)-1;R[J]=M;if(O===-1){R[G]=Q.get(F);}if(O===M){return;}var S=R.get("contentBox").one("."+L);if(S){S.removeClass(L);}if(M===-1){Q.set(F,this[G]);}else{var N=R.item(M);if(N){N.addClass(L);}Q.set(F,P[M]);}return M;}};function I(K){return(""+K).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,"\\$1");}function H(L,K){var M=K.get("parentNode");M.insertBefore(L,K);M.insertBefore(K,L);}},"@VERSION@",{requires:["widget","ac-plugin"]});
0
\ No newline at end of file
0
build/ac-widget/ac-widget.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,228 +0,0 @@
0
-YUI.add('ac-widget', function(Y) {
0
-
0
-// just a default display widget for the autocomplete component
0
-// this is the one you expect when you say "autocomplete"
0
-
0
-function ACWidget () { ACWidget.superclass.constructor.apply(this, arguments) };
0
-
0
-var HANDLES = "_handles",
0
-    selectedIndex = "selectedIndex",
0
-    _selectedIndex = "_selectedIndex",
0
-    _originalValue = "_originalValue",
0
-    YArrayeach = Y.Array.each,
0
-    queryValue = "queryValue";
0
-
0
-
0
-Y.ACWidget = Y.extend(
0
-    ACWidget,
0
-    Y.Widget,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this;
0
-            self.after("queryChanged", self.syncUI, self);
0
-            self.after("dataChanged", self.syncUI, self);
0
-            self.hide();
0
-        },
0
-        renderUI : function () {
0
-            var ac = this.get("ac");
0
-            if (!ac) {
0
-                return;
0
-            }
0
-            var input = ac.get("host");
0
-            insertAfter(this.get("boundingBox"), input);
0
-            return this.setSize();
0
-        },
0
-        setSize : function () {            
0
-            return this.set("width", this.get("ac").get("host").getComputedStyle("width"));
0
-        },
0
-        bindUI : function (ac) {
0
-            var widget = this,
0
-                cb = widget.get("contentBox"), //INHERITED
0
-                ac = ac || widget.get("ac");
0
-            if (widget[HANDLES]) {
0
-                YArrayeach(widget[HANDLES], function (handle) { handle.detach() });
0
-                widget[HANDLES] = 0; // small and falsey
0
-            }
0
-            if (ac) widget[HANDLES] = [
0
-                cb.delegate("click", widget.click, "li", widget),
0
-                Y.on("click", widget.hide, document), //INHERITED
0
-                ac.on("ac:load", function (e) {
0
-                    widget
0
-                        .set("query", e.query)
0
-                        .set("data", e.results)
0
-                        .syncUI()
0
-                        .show();
0
-                }),
0
-                ac.on("ac:query", function (e) {
0
-                    widget.set("query", e.value).syncUI();
0
-                }),
0
-                ac.on("ac:next", widget.next, widget),
0
-                ac.on("ac:previous", widget.previous, widget),
0
-                ac.on("ac:hide", widget.hide, widget) //INHERITED
0
-            ];
0
-            return widget;
0
-        },
0
-        syncUI : function () {
0
-            var self = this,
0
-                data = self.get("data"),
0
-                query = self.get("query");
0
-            if (!data) return self;
0
-            self[_selectedIndex] = -1;
0
-            self[_originalValue] = "";
0
-            self.get("contentBox").set("innerHTML", self.getListMarkup(data)); //INHERITED
0
-            return self;
0
-        },
0
-        getListMarkup : function (data) {
0
-            var self = this,
0
-                listTemplate = self.get("listTpl"),
0
-                markup = [];
0
-            YArrayeach(data, function (item) {
0
-                markup.push(self.getItemMarkup(item));
0
-            });
0
-            return listTemplate.replace(/\{list\}/g, markup.join(""));
0
-        },
0
-        getItemMarkup : function (item) {
0
-            return this.get("itemTpl")
0
-                .replace(/\{term\}/g, item)
0
-                .replace(/\{hilite\}/g, this.getHiliteMarkup(item))
0
-                // .replace(/<([^<>]*)<[^>]*>([^<>]*)>/g, '<$1$2>');
0
-        },
0
-        getHiliteMarkup : function (item) {
0
-            var self = this,
0
-                queryTerms = self.get("query").split(/\s+/)
0
-                out = item;
0
-            YArrayeach(queryTerms, function (term) {
0
-                if (!term) return;
0
-                term = regexpEscape(term);
0
-                out = out.replace(
0
-                    new RegExp(term, "g"),
0
-                    self.get("hiliteTpl").replace(/\{term\}/g, term)
0
-                );
0
-            });
0
-            return out;
0
-        },
0
-        next : function () {
0
-            var self = this;
0
-            if (self.get("visible")) return self.selectNext();
0
-            if (self.get("data")) self.show();
0
-            return self;
0
-        },
0
-        selectNext : function () {
0
-            var si = this.get(selectedIndex);
0
-            return this.set(selectedIndex, si + 1);
0
-        },
0
-        selectPrevious : function () {
0
-            var si = this.get(selectedIndex);
0
-            return this.set(selectedIndex, si - 1);
0
-        },
0
-        previous : function () {
0
-            if (this.get("visible")) this.selectPrevious();
0
-            return this;
0
-        },
0
-        item : function (n) {
0
-            return this.get("contentBox")
0
-                .one(this.get("itemSelector").replace(/\{n\}/g, regexpEscape(n + 1)));
0
-        },
0
-        click : function (e) {
0
-            var self = this,
0
-                ac = self.get("ac"),
0
-                val = e.currentTarget.get("text");
0
-            ac.set(queryValue, val);
0
-            self[_selectedIndex] = -1;
0
-            self._currentValue = val;
0
-            ac.get("host").focus();
0
-            self.hide();
0
-        }
0
-    },
0
-    { // statics
0
-        NAME : "ACWidget",
0
-        ATTRS : {
0
-            ac : {
0
-                setter : function (ac) {
0
-                    if (!this[HANDLES]) return; // it'll get bound when it renders
0
-                    this.bindUI(ac);
0
-                },
0
-                validator : function (ac) {
0
-                    // TODO: Add some testing here.
0
-                    return true
0
-                }
0
-            },
0
-            data : {
0
-                validator : function (d) { return d && d.length > 0 }
0
-            },
0
-            query : { value : "" },
0
-            listTpl : { value : "<ul>{list}</ul>" },
0
-            itemTpl : { value : "<li>{hilite}</li>" },
0
-            itemSelector : { value : "ul li:nth-child({n})" },
0
-            hiliteTpl : { value : "<em>{term}</em>" }
0
-        } // ATTRS
0
-    } // statics
0
-);
0
-// don't define this one inline, so that we can compress the key
0
-ACWidget.ATTRS[selectedIndex] = {
0
-    value : -1,
0
-    validator : function (si) {
0
-        var d = this.get("data");
0
-        return d && Y.Lang.isNumber(si);
0
-    },
0
-    getter : function () { return this[_selectedIndex] },
0
-    setter : function (si) {
0
-        var self = this,
0
-            current = self.get(selectedIndex),
0
-            d = self.get("data"),
0
-            l = d && d.length,
0
-            ac = self.get("ac"),
0
-            selClass = this.getClassName("selected"); //INHERITED
0
-        if (isNaN(current)) current = -1;
0
-        if (!d || !l) return;
0
-        
0
-        // first normalize them both to a number between
0
-        // (-1)..(d.length - 1) where -1 means "what the user typed"
0
-        // this should probably be a function, rather than copy pasta.
0
-        // but for this small a snippet of code, it's fewer bytes to just
0
-        // copy, especially when gzip gets at it.
0
-        while (si < -1) si += l + 1;
0
-        si = (si + 1) % (l + 1) - 1;
0
-        current = (current + 1) % (l + 1) - 1;
0
-                            
0
-        // actually set it, the rest is just monkey business.
0
-        self[_selectedIndex] = si;
0
-        
0
-        // hang onto this, we'll need it later.
0
-        if (current === -1) {
0
-            self[_originalValue] = ac.get(queryValue);
0
-        }
0
-        
0
-        // nothing changing!
0
-        if (current === si) return;
0
-        
0
-        // undo the current one, but only if it's not -1
0
-        var curItem = self.get("contentBox").one("."+selClass);
0
-        if (curItem) curItem.removeClass(selClass);
0
-        
0
-        // handle the new thing
0
-        if (si === -1) {
0
-            // back to the start
0
-            ac.set(queryValue, this[_originalValue]);
0
-        } else {
0
-            var newItem = self.item(si);
0
-            if (newItem) newItem.addClass(selClass);
0
-            ac.set(queryValue, d[si]);
0
-        }
0
-        return si;
0
-    }
0
-}; // selectedIndex
0
-
0
-function regexpEscape (text) {
0
-    return (""+text).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g, '\\$1');
0
-}
0
-
0
-function insertAfter (node, ref) {
0
-    var p = ref.get("parentNode");
0
-    p.insertBefore(node, ref);
0
-    p.insertBefore(ref, node);
0
-};
0
-
0
-
0
-
0
-}, '@VERSION@' ,{requires:['widget','ac-plugin']});
0
build/autocomplete/autocomplete-debug.js
0 additions, 430 deletions not shown
0
build/autocomplete/autocomplete-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("ac-plugin",function(C){var B="autocomplete",K=C.Lang,D=C.Array.each,F={query:function(P){var L=this,O=L.get("dataSource"),N=P.value,M=C.bind(G,L);if(O){O.sendRequest({request:L.get("queryTemplate")(N),callback:{success:M,failure:M}});}}};function E(){E.superclass.constructor.apply(this,arguments);}C.extend((C.Plugin.ACPlugin=C.augment(E,C.EventTarget)),C.Plugin.Base,{initializer:function(){var L=this,M=L.get("host");L.handles=I(L,M);var N=F;D(["query","load","show","hide","next","previous"],function(O){L.publish("ac:"+O,{broadcast:1,bubbles:1,context:L,preventable:true,defaultFn:N[O]||null,prefix:"ac"});},L);J(M);},destructor:function(){D(this.handles,function(L){L.detach();});},open:function(){this.fire("ac:show");},next:function(L){L.preventDefault();this.fire("ac:next");},previous:function(L){L.preventDefault();this.fire("ac:previous");},close:function(){this.fire("ac:hide");}},{NAME:"ACPlugin",NS:"ac",ATTRS:{queryValue:{getter:function(){return this.get("host").get("value");},setter:function(L){this.get("host").set("value",L);return(this._cachedValue=L);}},dataSource:{validator:function(L){return L&&K.isFunction(L.sendRequest);}},minQueryLength:{value:3,validator:K.isNumber},queryTemplate:{value:encodeURIComponent,setter:function(L){return(K.isFunction(L)?L:function(M){return L.replace(/(^|[^\\])((\\{2})*)\{query\}/,"$1$2"+encodeURIComponent(M)).replace(/(^|[^\\])((\\{2})*)\\(\{query\})/,"$1$2$4");});}}}});function I(L,M){return[C.on("valueChange",H,M,L),C.on("key",L.next,M,"down:40",L),C.on("key",L.previous,M,"down:38",L),C.on("key",L.close,M,"down:27",L)];}function H(M){var L=M.value;if(!L){return this.close();}if(L===this._cachedValue||L.length<this.get("minQueryLength")){return;}this._cachedValue=L;this.fire("ac:query",{value:M.value});}function A(L){return function(){if(L){L.setAttribute(B,"on");}L=null;};}function J(L){var N=C.Node.getDOMNode(L),O=N.getAttribute(B);if((O&&O!=="off")||O===null||O===undefined){var M=A(N);C.on("beforeunload",M,window);C.on("unload",M,window);}N.setAttribute(B,"off");}function G(M){var L=(M&&M.response&&M.response.results)?M.response.results:M;if(L&&!(L&&("length" in L)&&L.length===0)){this.fire("ac:load",{results:L,query:this.get("queryValue")});}}},"@VERSION@",{requires:["node","plugin","value-change","event-key"],optional:["event-custom"]});YUI.add("ac-widget",function(A){function D(){D.superclass.constructor.apply(this,arguments);}var C="_handles",E="selectedIndex",J="_selectedIndex",G="_originalValue",B=A.Array.each,F="queryValue";A.ACWidget=A.extend(D,A.Widget,{initializer:function(){var K=this;K.after("queryChanged",K.syncUI,K);K.after("dataChanged",K.syncUI,K);K.hide();},renderUI:function(){var L=this.get("ac");if(!L){return;}var K=L.get("host");H(this.get("boundingBox"),K);return this.setSize();},setSize:function(){return this.set("width",this.get("ac").get("host").getComputedStyle("width"));},bindUI:function(L){var M=this,K=M.get("contentBox"),L=L||M.get("ac");if(M[C]){B(M[C],function(N){N.detach();});M[C]=0;}if(L){M[C]=[K.delegate("click",M.click,"li",M),A.on("click",M.hide,document),L.on("ac:load",function(N){M.set("query",N.query).set("data",N.results).syncUI().show();}),L.on("ac:query",function(N){M.set("query",N.value).syncUI();}),L.on("ac:next",M.next,M),L.on("ac:previous",M.previous,M),L.on("ac:hide",M.hide,M)];}return M;},syncUI:function(){var K=this,M=K.get("data"),L=K.get("query");if(!M){return K;}K[J]=-1;K[G]="";K.get("contentBox").set("innerHTML",K.getListMarkup(M));return K;},getListMarkup:function(N){var M=this,K=M.get("listTpl"),L=[];B(N,function(O){L.push(M.getItemMarkup(O));});return K.replace(/\{list\}/g,L.join(""));},getItemMarkup:function(K){return this.get("itemTpl").replace(/\{term\}/g,K).replace(/\{hilite\}/g,this.getHiliteMarkup(K));},getHiliteMarkup:function(M){var L=this,K=L.get("query").split(/\s+/);out=M;B(K,function(N){if(!N){return;}N=I(N);out=out.replace(new RegExp(N,"g"),L.get("hiliteTpl").replace(/\{term\}/g,N));});return out;},next:function(){var K=this;if(K.get("visible")){return K.selectNext();}if(K.get("data")){K.show();}return K;},selectNext:function(){var K=this.get(E);return this.set(E,K+1);},selectPrevious:function(){var K=this.get(E);return this.set(E,K-1);},previous:function(){if(this.get("visible")){this.selectPrevious();}return this;},item:function(K){return this.get("contentBox").one(this.get("itemSelector").replace(/\{n\}/g,I(K+1)));},click:function(M){var K=this,L=K.get("ac"),N=M.currentTarget.get("text");L.set(F,N);K[J]=-1;K._currentValue=N;L.get("host").focus();K.hide();}},{NAME:"ACWidget",ATTRS:{ac:{setter:function(K){if(!this[C]){return;}this.bindUI(K);},validator:function(K){return true;}},data:{validator:function(K){return K&&K.length>0;}},query:{value:""},listTpl:{value:"<ul>{list}</ul>"},itemTpl:{value:"<li>{hilite}</li>"},itemSelector:{value:"ul li:nth-child({n})"},hiliteTpl:{value:"<em>{term}</em>"}}});D.ATTRS[E]={value:-1,validator:function(K){var L=this.get("data");return L&&A.Lang.isNumber(K);},getter:function(){return this[J];},setter:function(M){var R=this,O=R.get(E),P=R.get("data"),K=P&&P.length,Q=R.get("ac"),L=this.getClassName("selected");if(isNaN(O)){O=-1;}if(!P||!K){return;}while(M<-1){M+=K+1;}M=(M+1)%(K+1)-1;O=(O+1)%(K+1)-1;R[J]=M;if(O===-1){R[G]=Q.get(F);}if(O===M){return;}var S=R.get("contentBox").one("."+L);if(S){S.removeClass(L);}if(M===-1){Q.set(F,this[G]);}else{var N=R.item(M);if(N){N.addClass(L);}Q.set(F,P[M]);}return M;}};function I(K){return(""+K).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,"\\$1");}function H(L,K){var M=K.get("parentNode");M.insertBefore(L,K);M.insertBefore(K,L);}},"@VERSION@",{requires:["widget","ac-plugin"]});YUI.add("autocomplete",function(A){},"@VERSION@",{use:["ac-plugin"]});
0
\ No newline at end of file
0
build/autocomplete/autocomplete.js
0 additions, 429 deletions not shown
0
src/autocomplete/ac-plugin.properties
...
1
2
3
4
5
6
...
 
 
 
 
 
0
0
@@ -1,5 +0,0 @@
0
-builddir=./../../../builder/componentbuild
0
-component=ac-plugin
0
-component.jsfiles=ac-plugin.js
0
-component.requires=node, plugin, value-change, event-key
0
-component.optional=event-custom
0
\ No newline at end of file
0
src/autocomplete/ac-plugin.xml
...
1
2
3
4
5
6
7
...
 
 
 
 
 
 
0
0
@@ -1,6 +0,0 @@
0
-<?xml version="1.0" encoding="UTF-8"?>
0
-<project name="YuiBase" default="local">
0
-    <description>AutoComplete Plugin</description>
0
-    <property file="ac-plugin.properties" />
0
-    <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
0
-</project>
0
\ No newline at end of file
0
src/autocomplete/ac-widget.properties
...
1
2
3
4
5
...
 
 
 
 
0
0
@@ -1,4 +0,0 @@
0
-builddir=./../../../builder/componentbuild
0
-component=ac-widget
0
-component.jsfiles=ac-widget.js
0
-component.requires=widget,ac-plugin
0
\ No newline at end of file
0
src/autocomplete/ac-widget.xml
...
1
2
3
4
5
6
7
...
 
 
 
 
 
 
0
0
@@ -1,6 +0,0 @@
0
-<?xml version="1.0" encoding="UTF-8"?>
0
-<project name="YuiBase" default="local">
0
-    <description>AutoComplete Widget</description>
0
-    <property file="ac-widget.properties" />
0
-    <import file="${builddir}/3.x/bootstrap.xml" description="Default Build Properties and Targets" />
0
-</project>
0
\ No newline at end of file
0
src/autocomplete/build.properties
...
1
2
3
4
5
6
7
8
9
10
11
...
 
 
 
 
 
 
 
 
 
 
0
0
@@ -1,10 +0,0 @@
0
-builddir=../../../builder/componentbuild
0
-
0
-component=autocomplete
0
-component.rollup=true
0
-
0
-# Path to sub-module build files
0
-component.rollup.modules.buildfiles=ac-plugin.xml,ac-widget.xml
0
-
0
-# Rollup registration options
0
-component.use=ac-plugin
0
\ No newline at end of file
0
src/autocomplete/build.xml
...
1
2
3
4
5
6
7
...
 
 
 
 
 
 
 
0
@@ -1,7 +0,0 @@
0
-<?xml version="1.0" encoding="UTF-8"?>
0
-<project name="YUI" default="local">
0
-    <description>Rollup build file for AutoComplete components</description>
0
-    <property file="build.properties" />
0
-    <import file="${builddir}/3.x/bootstrap.xml" 
0
-            description="Default Build Properties and Targets" />
0
-</project>
0
src/autocomplete/js/ac-plugin.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,283 +0,0 @@
0
-/**
0
- * ACPlugin - A plugin that exposes the proper events to make AutoComplete work
0
- * on a form element (input or textarea, typically).
0
- * 
0
- * This utility is not intended to be used in isolation, but rather as a glue
0
- * layer to work with ACWidget or some other display mechanism.
0
- **/
0
-function ACPlugin () { ACPlugin.superclass.constructor.apply(this, arguments) };
0
-
0
-
0
-// shorthands
0
-var autocomplete = "autocomplete",
0
-    YLang = Y.Lang,
0
-    YArrayeach = Y.Array.each,
0
-    eventDefaultBehavior = {
0
-        // the default behavior of the query event is to check for a datasource,
0
-        // and then make a request with it.
0
-        query : function (e) {
0
-            var self = this,
0
-                ds = self.get("dataSource"),
0
-                query = e.value,
0
-                handler = Y.bind(handleQueryResponse, self);
0
-            // if we have a datasource, then make the request.
0
-            if (ds) ds.sendRequest({
0
-                request : self.get("queryTemplate")(query),
0
-                callback : {
0
-                    success : handler,
0
-                    failure : handler
0
-                }
0
-            });
0
-        }
0
-    };
0
-
0
-Y.Plugin.ACPlugin = Y.extend(
0
-    ACPlugin,
0
-    Y.Plugin.Base,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this,
0
-                host = self.get("host");
0
-            self.handles = attachHandles(self, host);
0
-
0
-            // publish events:
0
-            // "query" for when value changes.
0
-            // "load" for when data returns.
0
-            // "show" for when it's time to show something
0
-            // "hide" for when it's time to hide
0
-            var defaults = eventDefaultBehavior;
0
-            YArrayeach([
0
-                "query",
0
-                "load",
0
-                "show",
0
-                "hide",
0
-                "next",
0
-                "previous"
0
-            ], function (ev) { self.publish("ac:"+ev, {
0
-                broadcast : 1,
0
-                bubbles : 1,
0
-                context : self,
0
-                preventable : true,
0
-                defaultFn : defaults[ev] || null,
0
-                prefix : "ac"
0
-            }) }, self);
0
-
0
-            // manage the browser's autocomplete, since that'll interefere,
0
-            // but we need to make sure that we don't prevent pre-filling 
0
-            // when the user navs back to the page, unless the developer has
0
-            // specifically disabled that feature in the markup.
0
-            manageBrowserAC(host);
0
-        },
0
-        destructor : function () {
0
-            YArrayeach(this.handles, function (h) { h.detach() });
0
-        },
0
-        open : function () { this.fire("ac:show") },
0
-        next : function (e) { e.preventDefault(); this.fire("ac:next") },
0
-        previous : function (e) { e.preventDefault(); this.fire("ac:previous") },
0
-        close : function () { this.fire("ac:hide") }
0
-    },
0
-    { // statics
0
-        NAME : "ACPlugin",
0
-        NS : "ac",
0
-        ATTRS : {
0
-            /**
0
-             * The value that will be queried.
0
-             * 
0
-             * By default, this is just a proxy to the host's value attr, which in
0
-             * Node objects passes through to the underlying DOM node.
0
-             * 
0
-             * However, in some use cases, it may be useful to override the queryValue
0
-             * getters and setters, for example, in the delimited case.
0
-             *
0
-             * Setting caches the value so that we only make new requests for user-entered
0
-             * data, and not for programmatically-set values.  (For example, when a user
0
-             * is scrolling through the items displayed in an  ACWidget.)
0
-             * 
0
-             * @for ACPlugin
0
-             * @type {String}
0
-             * @public
0
-             **/
0
-            queryValue : {
0
-                // override these in AC plugin children as necessary.
0
-                // for instance, the delimited getter could get the cursor location,
0
-                // split on the delimiter, and then return the selected one.
0
-                // the inline-replacing setter could set-and-select the rest of the word.
0
-                getter : function () {
0
-                    return this.get("host").get("value");
0
-                },
0
-                setter : function (q) {
0
-                    this.get("host").set("value", q);
0
-                    // keep track of what it has been explicitly set to, so that we don't
0
-                    // try to make a query repeatedly when the user hasn't done anything.
0
-                    return (this._cachedValue = q);
0
-                }
0
-            },
0
-
0
-            /**
0
-             * A data source object to be used to make queries and such.
0
-             * It is not required that it be a DataSource object per se, but it
0
-             * must provide a "sendRequest" function that takes the same sort of
0
-             * argument as the DataSource classes.
0
-             * 
0
-             * It is not required to use this, as the implementor can listen to
0
-             * ac:query events and handle them in any ad-hoc way desired.  However,
0
-             * for the 99% use case, it's simpler to just provide a data source
0
-             * and do things in the normal way.
0
-             * 
0
-             * @for ACPlugin
0
-             * @type Object
0
-             **/
0
-            dataSource : {
0
-                validator : function (ds) {
0
-                    // quack.
0
-                    return ds && YLang.isFunction(ds.sendRequest);
0
-                }
0
-            },
0
-
0
-            /**
0
-             * The minimum number of characters required before kicking off a query.
0
-             * @for ACPlugin
0
-             * @public
0
-             * @type Number
0
-             * @default 3
0
-             **/
0
-            minQueryLength : {
0
-                value : 3,
0
-                validator : YLang.isNumber
0
-            },
0
-            
0
-            /**
0
-             * Attribute used to convert a value into a request for the
0
-             * DataSource.  Can be a string containing "{query}" somewhere,
0
-             * or a function that takes a value and returns a string.
0
-             *
0
-             * @for ACPlugin
0
-             * @type {Function|String}
0
-             * @default encodeURIComponent
0
-             * @public
0
-             **/
0
-            queryTemplate : {
0
-                value : encodeURIComponent,
0
-                setter : function (q) {
0
-                    return (
0
-                        YLang.isFunction(q) ? q
0
-                        : function (query) {
0
-                            // exchange {query} with the query,
0
-                            // but turn \{query} into {query}, if for some reason that
0
-                            // string needs to appear in the URL.
0
-                            return q
0
-                                .replace(
0
-                                    /(^|[^\\])((\\{2})*)\{query\}/,
0
-                                    '$1$2'+encodeURIComponent(query)
0
-                                ).replace(
0
-                                    /(^|[^\\])((\\{2})*)\\(\{query\})/,
0
-                                    '$1$2$4'
0
-                                );
0
-                        }
0
-                    );
0
-                }
0
-            }
0
-
0
-        } // end attrs
0
-    } // end statics
0
-);
0
-
0
-// helpers below
0
-
0
-/**
0
- * Attach the required event handles to the host node.
0
- * 
0
- * @param self {Object} The ACPlugin instance
0
- * @param host {Object} The host object
0
- * @return {Array} A list of handles
0
- * @private
0
- **/
0
-function attachHandles (self, host) {
0
-    return [
0
-        // query on valueChange
0
-        Y.on("valueChange", valueChangeHandler, host, self),
0
-        // next/open on down
0
-        Y.on("key", self.next, host, "down:40", self),
0
-        // previous on up
0
-        Y.on("key", self.previous, host, "down:38", self),
0
-        // close on escape
0
-        Y.on("key", self.close, host, "down:27", self)
0
-    ];
0
-};
0
-
0
-/**
0
- * The handler that listens to valueChange events and decides whether or not
0
- * to kick off a new query.
0
- *
0
- * @param {Object} The event object
0
- * @private
0
- **/
0
-function valueChangeHandler (e) {
0
-    var value = e.value;
0
-    if (!value) return this.close();
0
-    if (value === this._cachedValue || value.length < this.get("minQueryLength")) return;
0
-    this._cachedValue = value;
0
-    this.fire( "ac:query", { value : e.value });
0
-};
0
-
0
-
0
-/**
0
- * A factory method that returns a function to re-enable the browser's builtin
0
- * AutoComplete, so that form values will be tracked.
0
- *
0
- * @private
0
- * @param domnode {HTMLElement} The dom node to re-enable on unload
0
- * @return {Function} A function that will re-enable the browser autocomplete
0
- **/
0
-function browserACFixer (domnode) { return function () {
0
-    if (domnode) domnode.setAttribute(autocomplete, "on");
0
-    domnode = null;
0
-}};
0
-
0
-/**
0
- * Manage the browser's builtin AutoComplete behavior, so that form values
0
- * will be tracked in browsers that do that.
0
- * 
0
- * First, disable the browser's autocomplete, since that'll cause issues.
0
- * If the element is not set up to disable the browser's builtin autocomplete,
0
- * then set an unload listener to re-enable it.
0
- * 
0
- * @private
0
- * @param host {Object} The node to manage
0
- * @see {browserACFixer}
0
- **/
0
-function manageBrowserAC (host) {
0
-    // turn off the browser's autocomplete, but take note of it to turn
0
-    // it back on later.
0
-    var domnode = Y.Node.getDOMNode(host),
0
-        bac = domnode.getAttribute(autocomplete);
0
-
0
-    // turn the autocomplete back on so back button works, but only
0
-    // if the user hasn't disabled it in the first place.
0
-    if ((bac && bac !== "off") || bac === null || bac === undefined) {
0
-        var bacf = browserACFixer(domnode);
0
-        // hook onto both.  Concession to browser craziness.
0
-        Y.on("beforeunload", bacf, window);
0
-        Y.on("unload", bacf, window);
0
-    }
0
-
0
-    // turn off the browser's autocomplete feature, since that'll interfere.
0
-    domnode.setAttribute(autocomplete, "off");
0
-};
0
-
0
-/**
0
- * Handle the responses from the DataSource utility, firing ac:load if there
0
- * are results.
0
- *
0
- * @private
0
- **/
0
-function handleQueryResponse (e) {
0
-    var res = (e && e.response && e.response.results) ? e.response.results : e;
0
-    
0
-    // if there is a result, and it's not an empty array
0
-    if (res && !(res && ("length" in res) && res.length === 0)) this.fire("ac:load", {
0
-        results : res,
0
-        query : this.get("queryValue")
0
-    });
0
-};
0
-
0
src/autocomplete/js/ac-widget.js
0 additions, 365 deletions not shown
0
src/autocomplete/test/ac-delimited.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
0
@@ -1,30 +0,0 @@
0
-/*
0
-when setting the value, do you leave the existing bit there, and the new piece selected?
0
-or steal focus?
0
-support for injecting selected suffix between the cursor and delimiter would be 
0
-*/
0
-
0
-YUI.add('ac-delimited', function(Y) {
0
-    
0
-function ACDelimited () {
0
-    ACDelimited.superclass.constructor.apply(this, arguments);
0
-};
0
-Y.namespace("Plugin").ACDelimited = ACDelimited;
0
-ACDelimited.NAME = "ACDelimited";
0
-ACDelimited.NS = "delimited";
0
-Y.extend(ACDelimited, Y.Plugin.Base, {
0
-    initializer : function () {
0
-        var host = this.get("host");
0
-        // this is not the valueChange event, but rather a listener
0
-        // on the host's "value" attribute is set via myAC.set("value")
0
-        
0
-        
0
-    },
0
-    destructor : function () {
0
-        
0
-    }
0
-});
0
-
0
-
0
-    
0
-}, '@VERSION@' ,{requires:['ac-plugin']});
0
\ No newline at end of file
0
src/autocomplete/test/ac-inline.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
0
@@ -1,22 +0,0 @@
0
-Y.add("ac-inline", function (Y) {
0
-
0
-function ACInline () {
0
-    ACInline.superclass.constructor.apply(this, arguments);
0
-};
0
-var ACPlugin = Y.namespace("Plugin").ACPlugin;
0
-ACPlugin.Inline = ACInline;
0
-Y.extend(ACInline, ACPlugin, {
0
-    initializer : function () {
0
-        ACPlugin.prototype.initializer.apply(this, arguments);
0
-        // "open" means to fill in the first item.
0
-        // "next" means to go to the next item
0
-        // "previous" means to go to the previous item.
0
-        // "close" means to remove whatever has been typed into the selected one.
0
-        self.
0
-    }
0
-});
0
-
0
-
0
-
0
-
0
-}, '@VERSION@', {requires:["ac-plugin"]});
0
\ No newline at end of file
0
src/autocomplete/test/ac-plugin.html
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,218 +0,0 @@
0
-<!DOCTYPE html>
0
-<html>
0
-<head>
0
-<title>ac-plugin</title>
0
-
0
-<link rel="stylesheet" href="http://yui.yahooapis.com/3.0.0b1/build/cssfonts/fonts-min.css">
0
-<style>
0
-body {
0
-    font-size:16px;
0
-}
0
-.demoified {
0
-    font-size:200%;
0
-    border:10px solid red;
0
-}
0
-script.mine {
0
-    clear:left;
0
-    white-space:pre;
0
-    display:block;
0
-    font-family:monospace;
0
-    background:#eef;
0
-}
0
-script::before, script::after {
0
-    content:"<script>";
0
-}
0
-script::after {
0
-    content:"</script>";
0
-}
0
-script[src]::before {
0
-    content:"<script src=\"" attr(src) "\">";
0
-    white-space:nowrap;
0
-}
0
-script[src] {
0
-    background:#fff;
0
-}
0
-.lipsum { display:none; }
0
-</style>
0
-
0
-<style>
0
-form {
0
-    position:relative;
0
-}
0
-#aclist {
0
-    position:absolute;
0
-    display:none;
0
-    list-style:none;
0
-    border:1px solid #ccc;
0
-    border-width:1px 1px 0;
0
-    padding:0;
0
-    margin:0;
0
-    background:#fff;
0
-}
0
-#aclist li {
0
-    display:block;
0
-    list-style:none;
0
-    border-bottom:1px solid #ccc;
0
-    padding:3px;
0
-    margin:0;
0
-}
0
-#aclist .selected {
0
-    background:#900;
0
-    color:#fff;
0
-}
0
-</style>
0
-
0
-</head>
0
-<body>
0
-    <form>
0
-        <input class="input" id="input" size="100"><ul id="aclist"></ul>
0
-    </form>
0
-</body>
0
-
0
-<script class="mine" src="../../../build/yui/yui.js"></script>
0
-<script class="mine" src="./ac-plugin.js"></script>
0
-<script class="mine" src="../../value-change/build_tmp/value-change.js"></script>
0
-
0
-<script>
0
-YUI({
0
-    debug: true,
0
-    base : "../../../build/",
0
-    filter : "raw"
0
-}).use('ac-plugin', 'plugin', 'node-base', 'datasource', function (Y) {
0
-    window.Y = Y;
0
-
0
-    var input = window.input = Y.get("#input");
0
-    input.plug(Y.Plugin.ACPlugin);
0
-    
0
-  
0
-    var myDS = new Y.DataSource.Get({
0
-        source : "http://query.yahooapis.com/v1/public/yql?" +
0
-            "format=json&" +
0
-            "env=http%3A%2F%2Fdatatables.org%2Falltables.env&",
0
-        scriptCallbackParam : "callback"
0
-    });
0
-
0
-    myDS.plug({fn : Y.Plugin.DataSourceJSONSchema, cfg : {
0
-        schema : {
0
-            resultListLocator : "query.results.Result"
0
-        }
0
-    }});
0
-
0
-    input.plug(Y.Plugin.ACPlugin, {
0
-        queryTemplate : function (q) { return "q=" + encodeURIComponent(
0
-            "select * from search.suggest where query =\"" +
0
-            q.replace(/(["\\])/g, '\\$1') +
0
-            "\" limit 10"
0
-        )},
0
-        dataSource : myDS
0
-    });
0
-    
0
-    var myWidget = (function () {
0
-        var data = [],
0
-            node = Y.one('#aclist'),
0
-            selected = -1;
0
-        node.delegate("click", function (e) {
0
-            var target = e.currentTarget, index = target.get("className").split('-')[1];
0
-            myWidget.focus(index).select(e);
0
-        }, "li");
0
-        node.delegate("mouseover", function (e) {
0
-            var target = e.currentTarget, index = target.get("className").split('-')[1];
0
-            myWidget.focus(index);
0
-        }, "li");
0
-        Y.on("click", function () { myWidget.hide() }, document);
0
-        
0
-        return {
0
-            setData : function (d) {
0
-                if (d.length) {
0
-                    data = d;
0
-                    selected = -1;
0
-                }
0
-                return this;
0
-            },
0
-            render : function () {
0
-                // console.log("render");
0
-                if (!data.length) return this;
0
-                this.visible = true;
0
-                node.set("innerHTML", "");
0
-                for (var i = 0, l = data.length; i < l; i ++) {
0
-                    node.appendChild(Y.Node.create('<li class="ac-'+i+'">'+data[i]+"</li>"));
0
-                }
0
-                node.setStyle("display", "block");
0
-                return this;
0
-            },
0
-            hide : function () {
0
-                node.setStyle("display", "none");
0
-                this.visible = false;
0
-                selected = -1;
0
-                return this;
0
-            },
0
-            focus : function (i) {
0
-                i = i || selected;
0
-                // console.log("focus on ",i, data, data[i]);
0
-                if (!data.length) return this;
0
-                if (i >= data.length) i = 0;
0
-                if (i < 0) i = data.length - 1;
0
-                
0
-                var list = node.all("li"),
0
-                    current = node.one(".selected"),
0
-                    intent = list.item(i);
0
-                // console.log("list", list, "current", current, "intent", intent, intent === current);
0
-                if (!intent || intent === current) return this;
0
-                selected = i;
0
-                if (current) current.removeClass("selected");
0
-                intent.addClass("selected");
0
-                input.ac.set("queryValue", myWidget.getValue());
0
-                return this;
0
-            },
0
-            next : function () {
0
-                // console.log("mywidget.next",this.visible,selected);
0
-                selected = selected || 0;
0
-                selected ++;
0
-                if (!this.visible) this.render();
0
-                return this.focus(selected);
0
-            },
0
-            previous : function () {
0
-                selected = selected || data.length;
0
-                selected --;
0
-                return this.focus(selected);
0
-            },
0
-            getValue : function () {
0
-                if (!data.length || !data[selected]) return "";
0
-                return data[selected];
0
-            },
0
-            select : function (e) {
0
-                // console.log("enter!", e);
0
-                input.ac.set("queryValue", myWidget.getValue());
0
-                myWidget.hide();
0
-                input.focus();
0
-                e && e.preventDefault();
0
-            }
0
-        };
0
-    })();
0
-        
0
-
0
-    input.ac.on("ac:load", function (e) {
0
-        myWidget.setData(e.results).render();
0
-    });
0
-    input.ac.on("ac:query", function (e) {
0
-        if (myWidget.visible && e.value === myWidget.value) {
0
-            // console.log("Cancelling ac:query");
0
-            e.halt();
0
-        }
0
-        myWidget.value = e.value;
0
-    });
0
-    input.ac.on("ac:show", function () {
0
-        if (!myWidget.visible) myWidget.render();
0
-    }, myWidget);
0
-    // input.ac.on("ac:show", myWidget.render, myWidget);
0
-    input.ac.on("ac:hide", myWidget.hide, myWidget);
0
-    input.ac.on("ac:next", myWidget.next, myWidget);
0
-    input.ac.on("ac:previous", myWidget.previous, myWidget);
0
-    Y.on("key", myWidget.select, input, "down:13,10");
0
-    
0
-});
0
-</script>
0
-
0
-
0
-</body>
0
-</html>
0
src/autocomplete/test/ac-plugin.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,194 +0,0 @@
0
-YUI.add('ac-plugin', function(Y) {
0
-
0
-function ACPlugin () { ACPlugin.superclass.constructor.apply(this, arguments) };
0
-
0
-Y.extend(
0
-    (Y.Plugin.ACPlugin = Y.augment(ACPlugin, Y.EventTarget)),
0
-    Y.Plugin.Base,
0
-    { // prototype
0
-        initializer : function () {
0
-            var self = this,
0
-                host = self.get("host");
0
-            self.handles = attachHandles(self, host);
0
-
0
-            // publish events:
0
-            // keep it simple
0
-            // "query" for when value changes.
0
-            // "load" for when data returns.
0
-            // "show" for when it's time to show something
0
-            // "hide" for when it's time to hide
0
-            var defaults = eventDefaultBehavior;
0
-            Y.Array.each([
0
-                "query",
0
-                "load",
0
-                "show",
0
-                "hide",
0
-                "next",
0
-                "previous"
0
-            ], function (ev) { self.publish("ac:"+ev, {
0
-                broadcast : 1,
0
-                bubbles : 1,
0
-                context : self,
0
-                preventable : true,
0
-                defaultFn : defaults[ev] || null,
0
-                prefix : "ac"
0
-            }) }, self);
0
-
0
-            // manage the browser's autocomplete, since that'll interefere,
0
-            // but we need to make sure that we don't prevent pre-filling 
0
-            // when the user navs back to the page, unless the developer has
0
-            // specifically disabled that feature in the markup.
0
-            manageBrowserAC(host);
0
-        },
0
-        destructor : function () {
0
-            Y.Array.each(this.handles, function (h) { h.detach() });
0
-        },
0
-        open : function () { this.fire("ac:show") },
0
-        next : function (e) { e.preventDefault(); this.fire("ac:next") },
0
-        previous : function (e) { e.preventDefault(); this.fire("ac:previous") },
0
-        close : function () { this.fire("ac:hide") }
0
-    },
0
-    { // statics
0
-        NAME : "ACPlugin",
0
-        NS : "ac",
0
-        ATTRS : {
0
-            queryValue : {
0
-                // override these in the other AC modules as necessary.
0
-                // for instance, the delimited getter could get the cursor location,
0
-                // split on the delimiter, and then return the selected one.
0
-                // the inline-replacing setter could set-and-select the rest of the word.
0
-                getter : function () {
0
-                    return this.get("host").get("value");
0
-                },
0
-                setter : function (q) {
0
-                    this.get("host").set("value", q);
0
-                    // keep track of what it has been explicitly set to, so that we don't
0
-                    // try to make a query repeatedly when the user hasn't done anything.
0
-                    return (this._cachedValue = q);
0
-                }
0
-            },
0
-
0
-            // data source object
0
-            dataSource : {
0
-                validator : function (ds) {
0
-                    // quack.
0
-                    return ds && Y.Lang.isFunction(ds.sendRequest);
0
-                }
0
-            },
0
-
0
-            // minimum number of chars before we'll query
0
-            minQueryLength : {
0
-                value : 3,
0
-                validator : Y.Lang.isNumber
0
-            },
0
-
0
-            // convert a value into a request for the DS
0
-            // Can be either a string containg "{query}" somewhere,
0
-            // or a function that takes and returns a string.
0
-            queryTemplate : {
0
-                value : encodeURIComponent,
0
-                setter : function (q) {
0
-                    return (
0
-                        Y.Lang.isFunction(q) ? q
0
-                        : function (query) {
0
-                            // exchange {query} with the query,
0
-                            // but turn \{query} into {query}, if for some reason that
0
-                            // string needs to appear in the URL.
0
-                            return q
0
-                                .replace(
0
-                                    /(^|[^\\])((\\{2})*)\{query\}/,
0
-                                    '$1$2'+encodeURIComponent(query)
0
-                                ).replace(
0
-                                    /(^|[^\\])((\\{2})*)\\(\{query\})/,
0
-                                    '$1$2$4'
0
-                                );
0
-                        }
0
-                    );
0
-                }
0
-            }
0
-
0
-        } // end attrs
0
-    } // end statics
0
-);
0
-
0
-// helpers below
0
-
0
-function attachHandles (self, host) {
0
-    return [
0
-        // query on valueChange
0
-        Y.on("valueChange", valueChangeHandler, host, self),
0
-        // next/open on down
0
-        Y.on("key", self.next, host, "down:40", self),
0
-        // previous on up
0
-        Y.on("key", self.previous, host, "down:38", self),
0
-        // close on escape
0
-        Y.on("key", self.close, host, "down:27", self)
0
-    ];
0
-};
0
-
0
-function valueChangeHandler (e) {
0
-    var value = e.value;
0
-    if (!value) return this.close();
0
-    if (value === this._cachedValue || value.length < this.get("minQueryLength")) return;
0
-    this._cachedValue = value;
0
-    this.fire( "ac:query", { value : e.value });
0
-};
0
-
0
-function browserACFixer (domnode) { return function () {
0
-    if (domnode) domnode.setAttribute(autocomplete, "on");
0
-    domnode = null;
0
-}};
0
-
0
-function manageBrowserAC (host) {
0
-    // turn off the browser's autocomplete, but take note of it to turn
0
-    // it back on later.
0
-    var domnode = Y.Node.getDOMNode(host),
0
-        autocomplete = "autocomplete",
0
-        bac = domnode.getAttribute(autocomplete);
0
-
0
-    // turn the autocomplete back on so back button works, but only
0
-    // if the user hasn't disabled it in the first place.
0
-    if ((bac && bac !== "off") || bac === null || bac === undefined) {
0
-        var bacf = browserACFixer(domnode);
0
-        // hook onto both.  Concession to browser craziness.
0
-        Y.on("beforeunload", bacf, window);
0
-        Y.on("unload", bacf, window);
0
-    }
0
-
0
-    // turn off the browser's autocomplete feature, since that'll interfere.
0
-    domnode.setAttribute(autocomplete, "off");
0
-};
0
-
0
-function handleQueryResponse (e) {
0
-    var res = (e && e.response && e.response.results) ? e.response.results : e;
0
-    
0
-    // if there is a result, and it's not an empty array
0
-    if (res && !(res && ("length" in res) && res.length === 0)) this.fire("ac:load", {
0
-        results : res,
0
-        query : this.get("queryValue")
0
-    });
0
-};
0
-
0
-var eventDefaultBehavior = {
0
-    query : function (e) {
0
-        var self = this,
0
-            ds = self.get("dataSource"),
0
-            query = e.value,
0
-            handler = Y.bind(handleQueryResponse, self);
0
-        var request = {
0
-            request : self.get("queryTemplate")(query),
0
-            callback : {
0
-                success : handler,
0
-                failure : handler
0
-            }
0
-        };
0
-        // if we have a datasource, then make the request.
0
-        if (ds) ds.sendRequest(request);
0
-    }
0
-};
0
-
0
-
0
-}, '@VERSION@', {
0
-    optional:["event-custom"],
0
-    requires:['node', 'plugin', 'value-change', 'event-key']
0
-});
0
src/autocomplete/test/ac-widget.html
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,122 +0,0 @@
0
-<!DOCTYPE html>
0
-<html>
0
-<head>
0
-<title>ac-widget</title>
0
-
0
-<link rel="stylesheet" href="http://yui.yahooapis.com/3.0.0b1/build/cssfonts/fonts-min.css">
0
-<style>
0
-body {
0
-    font-size:16px;
0
-}
0
-.demoified {
0
-    font-size:200%;
0
-    border:10px solid red;
0
-}
0
-script.mine {
0
-    clear:left;
0
-    white-space:pre;
0
-    display:block;
0
-    font-family:monospace;
0
-    background:#eef;
0
-}
0
-script::before, script::after {
0
-    content:"<script>";
0
-}
0
-script::after {
0
-    content:"</script>";
0
-}
0
-script[src]::before {
0
-    content:"<script src=\"" attr(src) "\">";
0
-    white-space:nowrap;
0
-}
0
-script[src] {
0
-    background:#fff;
0
-}
0
-.lipsum { display:none; }
0
-</style>
0
-
0
-<style>
0
-.yui-acwidget {
0
-    position:absolute;
0
-    background:#414E67;
0
-    color:#fff;
0
-    font-size:12px;
0
-}
0
-.yui-acwidget .yui-acwidget-selected {
0
-    border-color:#838DA2;
0
-}
0
-.yui-acwidget em {
0
-    font-weight:bold;
0
-    font-style:normal;
0
-    color:#9AB3BC;
0
-}
0
-.yui-acwidget ul, .yui-acwidget li {
0
-    list-style: none;
0
-    margin:0;
0
-    padding:3px;
0
-}
0
-.yui-acwidget li {
0
-    border:1px solid #414E67;
0
-}
0
-.yui-acwidget li:hover {
0
-    background:#636F89;
0
-    border-color:#414E67;
0
-}
0
-
0
-.yui-acwidget-hidden { display:none }
0
-/*.yui-acwidget-hidden { opacity:0.5 }*/
0
-</style>
0
-
0
-
0
-</head>
0
-<body>
0
-    <form>
0
-        <input class="input" id="input" size="100"><ul id="aclist"></ul>
0
-    </form>
0
-</body>
0
-
0
-<script class="mine" src="../../../build/yui/yui.js"></script>
0
-<script class="mine" src="../../../build/autocomplete/autocomplete.js"></script>
0
-<script class="mine" src="../../../build/value-change/value-change.js"></script>
0
-
0
-<script>
0
-YUI({
0
-    debug: true,
0
-    base : "../../../build/",
0
-    filter : "raw"
0
-}).use('ac-plugin', 'ac-widget', 'datasource', function (Y) {
0
-    window.Y = Y;
0
-
0
-    var input = window.input = Y.get("#input");
0
-    input.plug(Y.Plugin.ACPlugin);
0
-    
0
-    var myDS = new Y.DataSource.Get({
0
-        source : "http://query.yahooapis.com/v1/public/yql?" +
0
-            "format=json&" +
0
-            "env=http%3A%2F%2Fdatatables.org%2Falltables.env&",
0
-        scriptCallbackParam : "callback"
0
-    });
0
-
0
-    myDS.plug({fn : Y.Plugin.DataSourceJSONSchema, cfg : {
0
-        schema : { resultListLocator : "query.results.Result" }
0
-    }});
0
-    
0
-    
0
-    input.plug(Y.Plugin.ACPlugin, {
0
-        queryTemplate : function (q) { return "q=" + encodeURIComponent(
0
-            "select * from search.suggest where query =\"" +
0
-            q.replace(/(["\\])/g, '\\$1') +
0
-            "\" limit 10"
0
-        )},
0
-        dataSource : myDS
0
-    });
0
-    
0
-    window.acw = new Y.ACWidget({ ac : input.ac });
0
-    acw.render();
0
-        
0
-});
0
-</script>
0
-
0
-
0
-</body>
0
-</html>
0
src/autocomplete/test/ac-widget.js
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,222 +0,0 @@
0
-// just a default display widget for the autocomplete component
0
-// this is the one you expect when you say "autocomplete"
0
-YUI.add('ac-widget', function(Y) {
0
-
0
-function regexpEscape (text) {
0
-    return (""+text).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g, '\\$1');
0
-}
0
-
0
-function insertAfter (node, ref) {
0
-    var p = ref.get("parentNode");
0
-    p.insertBefore(node, ref);
0
-    p.insertBefore(ref, node);
0
-};
0
-
0
-function bind (widget, ac) {
0
-    if (!widget._handles) widget._handles = {};
0
-    else unbind(widget);
0
-    widget._bound = true;
0
-    var h = widget._handles,
0
-        cb = widget.get("contentBox"),
0
-        ac = widget.get("ac");
0
-    h.click = cb.delegate("click", widget.click, "li", widget);
0
-    h.docclick = Y.on("click", widget.hide, document);
0
-    h.acload = ac.on("ac:load", function (e) {
0
-        widget
0
-            .set("query", e.query)
0
-            .set("data", e.results)
0
-            .syncUI()
0
-            .show();
0
-    });
0
-    h.onchange = ac.on("ac:query", function (e) {
0
-        widget.set("query", e.value).syncUI();
0
-    });
0
-    h.acnext = ac.on("ac:next", widget.next, widget);
0
-    h.acprevious = ac.on("ac:previous", widget.previous, widget);
0
-    h.achide = ac.on("ac:hide", widget.hide, widget);
0
-};
0
-function unbind (widget) {
0
-    for (var i in widget._handles) {
0
-        widget._handles[i].detach();
0
-        delete(widget._handles[i]);
0
-    }
0
-    widget._bound = false;
0
-};
0
-
0
-function ACWidget () { ACWidget.superclass.constructor.apply(this, arguments) };
0
-
0
-Y.ACWidget = Y.extend(
0
-    ACWidget,
0
-    Y.Widget,
0
-    { // prototype
0
-        initializer : function () {
0
-            this.after("queryChanged", this.syncUI, this);
0
-            this.after("dataChanged", this.syncUI, this);
0
-            this.hide();
0
-        },
0
-        renderUI : function () {
0
-            var ac = this.get("ac");
0
-            if (!ac) throw new Error(
0
-                "Attempting to render ACWidget before it has been attached "+
0
-                "to an ACPlugin of some sort."
0
-            );
0
-            var input = ac.get("host");
0
-            insertAfter(this.get("boundingBox"), input);
0
-            return this.setSize();
0
-        },
0
-        setSize : function () {            
0
-            return this.set("width", this.get("ac").get("host").getComputedStyle("width"));
0
-        },
0
-        bindUI : function () {
0
-            bind(this, this.get("ac"));
0
-            return this;
0
-        },
0
-        syncUI : function () {
0
-            var data = this.get("data"),
0
-                query = this.get("query");
0
-            if (!data) return this;
0
-            this._selectedIndex = -1;
0
-            this._originalValue = "";
0
-            this.get("contentBox").set("innerHTML", this.getListMarkup(data));
0
-            return this;
0
-        },
0
-        getListMarkup : function (data) {
0
-            var listTemplate = this.get("listTpl"),
0
-                markup = [],
0
-                self = this;
0
-            Y.Array.each(data, function (item) {
0
-                markup.push(self.getItemMarkup(item));
0
-            });
0
-            return listTemplate.replace(/\{list\}/g, markup.join(""));
0
-        },
0
-        getItemMarkup : function (item) {
0
-            return this.get("itemTpl")
0
-                .replace(/\{term\}/g, item)
0
-                .replace(/\{hilite\}/g, this.getHiliteMarkup(item));
0
-        },
0
-        getHiliteMarkup : function (item) {
0
-            var queryTerms = this.get("query").split(/\s+/)
0
-                out = item,
0
-                self = this;
0
-            Y.Array.each(queryTerms, function (term) {
0
-                if (!term) return;
0
-                term = regexpEscape(term);
0
-                out = out.replace(
0
-                    new RegExp(term, "g"),
0
-                    self.get("hiliteTpl").replace(/\{term\}/g, term)
0
-                );
0
-            });
0
-            return out;
0
-        },
0
-        next : function () {
0
-            if (!this.get("visible")) {
0
-                if (this.get("data")) this.show();
0
-                return this;
0
-            }
0
-            return this.selectNext();
0
-        },
0
-        selectNext : function () {
0
-            var si = this.get("selectedIndex");
0
-            return this.set("selectedIndex", si + 1);
0
-        },
0
-        selectPrevious : function () {
0
-            var si = this.get("selectedIndex");
0
-            return this.set("selectedIndex", si - 1);
0
-        },
0
-        previous : function () {
0
-            if (this.get("visible")) this.selectPrevious();
0
-            return this;
0
-        },
0
-        item : function (n) {
0
-            return this.get("contentBox")
0
-                .one(this.get("itemSelector").replace(/\{n\}/g, regexpEscape(n + 1)));
0
-        },
0
-        click : function (e) {
0
-            var ac = this.get("ac"),
0
-                val = e.currentTarget.get("text");
0
-            ac.set("queryValue", val);
0
-            this._selectedIndex = -1;
0
-            this._currentValue = val;
0
-            ac.get("host").focus();
0
-            this.hide();
0
-        }
0
-    },
0
-    { // statics
0
-        NAME : "ACWidget",
0
-        ATTRS : {
0
-            ac : {
0
-                setter : function (ac) {
0
-                    if (!this._bound) return; // it'll get bound when it renders
0
-                    bind(this, ac);
0
-                },
0
-                validator : function (ac) {
0
-                    // TODO: Add some testing here.
0
-                    return true
0
-                }
0
-            },
0
-            data : {
0
-                validator : function (d) { return d && d.length > 0 }
0
-            },
0
-            query : { value : "" },
0
-            listTpl : { value : "<ul>{list}</ul>" },
0
-            itemTpl : { value : "<li>{hilite}</li>" },
0
-            itemSelector : { value : "ul li:nth-child({n})" },
0
-            hiliteTpl : { value : "<em>{term}</em>" },
0
-            selectedIndex : {
0
-                value : -1,
0
-                validator : function (si) {
0
-                    var d = this.get("data");
0
-                    return d && Y.Lang.isNumber(si);
0
-                },
0
-                getter : function () { return this._selectedIndex },
0
-                setter : function (si) {
0
-                    var current = this.get("selectedIndex"),
0
-                        d = this.get("data"),
0
-                        l = d && d.length,
0
-                        ac = this.get("ac"),
0
-                        selClass = this.getClassName("selected");
0
-                    if (isNaN(current)) current = -1;
0
-                    if (!d || !l) return;
0
-                    
0
-                    // first normalize them both to a number between
0
-                    // (-1)..(d.length - 1) where -1 means "what the user typed"
0
-                    while (si < -1) si += l + 1;
0
-                    si = (si + 1) % (l + 1) - 1;
0
-                    current = (current + 1) % (l + 1) - 1;
0
-                                        
0
-                    // actually set it, the rest is just monkey business.
0
-                    this._selectedIndex = si;
0
-                    
0
-                    // hang onto this, we'll need it later.
0
-                    if (current === -1) {
0
-                        this._originalValue = ac.get("queryValue");
0
-                    }
0
-                    
0
-                    // nothing changing!
0
-                    if (current === si) return;
0
-                    
0
-                    // undo the current one, but only if it's not -1
0
-                    var curItem = this.get("contentBox").one("."+selClass);
0
-                    if (curItem) curItem.removeClass(selClass);
0
-                    
0
-                    // handle the new thing
0
-                    if (si === -1) {
0
-                        // back to the start
0
-                        ac.set("queryValue", this._originalValue);
0
-                    } else {
0
-                        var newItem = this.item(si);
0
-                        if (newItem) {
0
-                            newItem.addClass(selClass);
0
-                        }
0
-                        ac.set("queryValue", d[si]);
0
-                    }
0
-                    return si;
0
-                }
0
-            } // selectedIndex    
0
-        } // ATTRS
0
-    } // statics
0
-);
0
-
0
-}, '@VERSION', {
0
-    requires : ['widget']
0
-});
0
src/autocomplete/test/stories.md
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,59 +0,0 @@
0
-
0
-
0
-1 typetypetype
0
-2 value changes, fire request
0
-3 request comes back
0
-4 show results.
0
-5 press down arrow
0
-6 hilight the first item, put its value in the input, saving the old value, no fetch
0
-7 press down arrow
0
-8 hilight the second item, put its value in the input, no fetch
0
-9 press down arrow
0
-a hilight the third item, put its value in the input, no fetch
0
-b press esc
0
-c put the original value in the input, no fetch
0
-d typetypetype
0
-e goto 2
0
-
0
-
0
-1 typetypetype
0
-2 value changes, fire request
0
-3 request comes back
0
-4 show results
0
-5 mouseover item
0
-6 hilight item
0
-7 click on item
0
-8 put its value in the input, close results, no fetch
0
-
0
-
0
-1 typetypetype
0
-2 value changes, fire request
0
-3 request comes back
0
-4 show results
0
-5 down arrow
0
-6 select the first item
0
-7 put the value in the input, saving the original value
0
-8 typetypetype
0
-9 value changes, fire request, forget original value
0
-a goto 3
0
-
0
-
0
-1 typetypetype
0
-2 value changes, fire request
0
-3 request comes back
0
-4 show results
0
-5 press escape
0
-6 close results
0
-7 press down arrow
0
-8 show results
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
-
0
src/autocomplete/test/test-widget.html
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,140 +0,0 @@
0
-<!DOCTYPE html>
0
-<html>
0
-<head>
0
-<title>demo widget</title>
0
-
0
-<link rel="stylesheet" href="http://yui.yahooapis.com/3.0.0b1/build/cssfonts/fonts-min.css">
0
-<style>
0
-body {
0
-    font-size:16px;
0
-}
0
-.demoified {
0
-    font-size:200%;
0
-    border:10px solid red;
0
-}
0
-script.mine {
0
-    clear:left;
0
-    white-space:pre;
0
-    display:block;
0
-    font-family:monospace;
0
-    background:#eef;
0
-}
0
-script::before, script::after {
0
-    content:"<script>";
0
-}
0
-script::after {
0
-    content:"</script>";
0
-}
0
-script[src]::before {
0
-    content:"<script src=\"" attr(src) "\">";
0
-    white-space:nowrap;
0
-}
0
-script[src] {
0
-    background:#fff;
0
-}
0
-.lipsum { display:none; }
0
-</style>
0
-
0
-<style>
0
-.yui-demowidget { border:10px solid blue; padding:10px; float:left }
0
-.yui-demowidget-content { border : 10px solid red; padding:10px; float:left }
0
-.yui-demowidget .piece { border: 10px solid green; display:block; padding:10px; float:left; margin-right:10px }
0
-.yui-demowidget .piece:last-child { margin-right:0 }
0
-.yui-demowidget-focused, .yui-demowidget-focused * { border-color: yellow !important }
0
-</style>
0
-
0
-</head>
0
-<body>
0
-
0
-<!-- <div id="demo-widget">
0
-    <span class="piece">first piece</span>
0
-    <span class="piece">second piece</span>
0
-</div> -->
0
-
0
-<script class="mine" src="../../../build/yui/yui.js"></script>
0
-<script>
0
-YUI.add("demo-widget", function (Y) {
0
-
0
-function DemoWidget () { DemoWidget.superclass.constructor.apply(this, arguments) };
0
-
0
-Y.DemoWidget = Y.extend(
0
-    DemoWidget,
0
-    Y.Widget,
0
-    {
0
-        initializer : function () {
0
-            this.after("focusedChange", function (e) {
0
-                // console.log("onfocus", this.get("focused"));
0
-                // window.setTimeout(Y.bind(this.blur, this), 500);
0
-                e.type = this.get("focused") ? "focus" : "blur";
0
-                this.fire(e.type, e);
0
-            });
0
-            this.publish("focus");
0
-            this.publish("blur");
0
-            
0
-            this.on("focus", function (e) {
0
-                window.setTimeout(Y.bind(this.blur, this), 250);
0
-            });
0
-            this.on("blur", function (e) {
0
-                window.setTimeout(Y.bind(this.focus, this), 250);
0
-            });
0
-            
0
-            console.log("initializing!", this, arguments);
0
-        },
0
-        renderUI : function () {
0
-            console.log("rendering the UI", arguments);
0
-        },
0
-        bindUI : function () {
0
-            console.log("bindUI", arguments);
0
-        },
0
-        syncUI : function () {
0
-            console.log("syncUI", arguments);
0
-        }
0
-    },
0
-    {
0
-        _onfocus : function (e) {
0
-            // console.log("onfocus", this.get("focused"));
0
-            // window.setTimeout(Y.bind(this.blur, this), 500);
0
-            e.type = this.get("focused") ? "focus" : "blur";
0
-            this.fire(e.type, e);
0
-        },
0
-        NAME : "DemoWidget",
0
-        ATTRS : {
0
-            attrib : {
0
-                value : 0,
0
-                setter : function (n) {
0
-                    console.log("setting attrib", n);
0
-                    return n;
0
-                }
0
-            },
0
-            piece : {
0
-                value : null,
0
-                setter : function (p) {
0
-                    console.log("setting piece", p);
0
-                    return p;
0
-                }
0
-            }
0
-        },
0
-        HTML_PARSER : {
0
-            piece : ".piece"
0
-        }
0
-    }
0
-);
0
-    
0
-}, '@VERSION@', {requires:["widget"]});
0
-</script>
0
-
0
-<script>
0
-YUI({
0
-    debug: true,
0
-    base : "../../../build/",
0
-    filter : "raw"
0
-}).use('demo-widget', function (Y) {
0
-    window.Y = Y;
0
-    var d = window.DW = new Y.DemoWidget();
0
-    d.render("#demo-widget");
0
-});
0
-</script>
0
-
0
-click on it to make it flash and be super annoying
0
-</body>
0
-</html>
0
src/autocomplete/test/ysearch/all-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("ac-plugin",function(C){var B="autocomplete",K=C.Lang,D=C.Array.each,F={query:function(P){var L=this,O=L.get("dataSource"),N=P.value,M=C.bind(G,L);if(O){O.sendRequest({request:L.get("queryTemplate")(N),callback:{success:M,failure:M}});}}};function E(){E.superclass.constructor.apply(this,arguments);}C.extend((C.Plugin.ACPlugin=C.augment(E,C.EventTarget)),C.Plugin.Base,{initializer:function(){var L=this,M=L.get("host");L.handles=I(L,M);var N=F;D(["query","load","show","hide","next","previous"],function(O){L.publish("ac:"+O,{broadcast:1,bubbles:1,context:L,preventable:true,defaultFn:N[O]||null,prefix:"ac"});},L);J(M);},destructor:function(){D(this.handles,function(L){L.detach();});},open:function(){this.fire("ac:show");},next:function(L){L.preventDefault();this.fire("ac:next");},previous:function(L){L.preventDefault();this.fire("ac:previous");},close:function(){this.fire("ac:hide");}},{NAME:"ACPlugin",NS:"ac",ATTRS:{queryValue:{getter:function(){return this.get("host").get("value");},setter:function(L){this.get("host").set("value",L);return(this._cachedValue=L);}},dataSource:{validator:function(L){return L&&K.isFunction(L.sendRequest);}},minQueryLength:{value:3,validator:K.isNumber},queryTemplate:{value:encodeURIComponent,setter:function(L){return(K.isFunction(L)?L:function(M){return L.replace(/(^|[^\\])((\\{2})*)\{query\}/,"$1$2"+encodeURIComponent(M)).replace(/(^|[^\\])((\\{2})*)\\(\{query\})/,"$1$2$4");});}}}});function I(L,M){return[C.on("valueChange",H,M,L),C.on("key",L.next,M,"down:40",L),C.on("key",L.previous,M,"down:38",L),C.on("key",L.close,M,"down:27",L)];}function H(M){var L=M.value;if(!L){return this.close();}if(L===this._cachedValue||L.length<this.get("minQueryLength")){return;}this._cachedValue=L;this.fire("ac:query",{value:M.value});}function A(L){return function(){if(L){L.setAttribute(B,"on");}L=null;};}function J(L){var N=C.Node.getDOMNode(L),O=N.getAttribute(B);if((O&&O!=="off")||O===null||O===undefined){var M=A(N);C.on("beforeunload",M,window);C.on("unload",M,window);}N.setAttribute(B,"off");}function G(M){var L=(M&&M.response&&M.response.results)?M.response.results:M;if(L&&!(L&&("length" in L)&&L.length===0)){this.fire("ac:load",{results:L,query:this.get("queryValue")});}}},"@VERSION@",{requires:["node","plugin","value-change","event-key"],optional:["event-custom"]});YUI.add("ac-widget",function(A){function D(){D.superclass.constructor.apply(this,arguments);}var C="_handles",E="selectedIndex",J="_selectedIndex",G="_originalValue",B=A.Array.each,F="queryValue";A.ACWidget=A.extend(D,A.Widget,{initializer:function(){var K=this;K.after("queryChanged",K.syncUI,K);K.after("dataChanged",K.syncUI,K);K.hide();},renderUI:function(){var L=this.get("ac");if(!L){return;}var K=L.get("host");H(this.get("boundingBox"),K);return this.setSize();},setSize:function(){return this.set("width",this.get("ac").get("host").getComputedStyle("width"));},bindUI:function(L){var M=this,K=M.get("contentBox"),L=L||M.get("ac");if(M[C]){B(M[C],function(N){N.detach();});M[C]=0;}if(L){M[C]=[K.delegate("click",M.click,"li",M),A.on("click",M.hide,document),L.on("ac:load",function(N){M.set("query",N.query).set("data",N.results).syncUI().show();}),L.on("ac:query",function(N){M.set("query",N.value).syncUI();}),L.on("ac:next",M.next,M),L.on("ac:previous",M.previous,M),L.on("ac:hide",M.hide,M)];}return M;},syncUI:function(){var K=this,M=K.get("data"),L=K.get("query");if(!M){return K;}K[J]=-1;K[G]="";K.get("contentBox").set("innerHTML",K.getListMarkup(M));return K;},getListMarkup:function(N){var M=this,K=M.get("listTpl"),L=[];B(N,function(O){L.push(M.getItemMarkup(O));});return K.replace(/\{list\}/g,L.join(""));},getItemMarkup:function(K){return this.get("itemTpl").replace(/\{term\}/g,K).replace(/\{hilite\}/g,this.getHiliteMarkup(K));},getHiliteMarkup:function(M){var L=this,K=L.get("query").split(/\s+/);out=M;B(K,function(N){if(!N){return;}N=I(N);out=out.replace(new RegExp(N,"g"),L.get("hiliteTpl").replace(/\{term\}/g,N));});return out;},next:function(){var K=this;if(K.get("visible")){return K.selectNext();}if(K.get("data")){K.show();}return K;},selectNext:function(){var K=this.get(E);return this.set(E,K+1);},selectPrevious:function(){var K=this.get(E);return this.set(E,K-1);},previous:function(){if(this.get("visible")){this.selectPrevious();}return this;},item:function(K){return this.get("contentBox").one(this.get("itemSelector").replace(/\{n\}/g,I(K+1)));},click:function(M){var K=this,L=K.get("ac"),N=M.currentTarget.get("text");L.set(F,N);K[J]=-1;K._currentValue=N;L.get("host").focus();K.hide();}},{NAME:"ACWidget",ATTRS:{ac:{setter:function(K){if(!this[C]){return;}this.bindUI(K);},validator:function(K){return true;}},data:{validator:function(K){return K&&K.length>0;}},query:{value:""},listTpl:{value:"<ul>{list}</ul>"},itemTpl:{value:"<li>{hilite}</li>"},itemSelector:{value:"ul li:nth-child({n})"},hiliteTpl:{value:"<em>{term}</em>"}}});D.ATTRS[E]={value:-1,validator:function(K){var L=this.get("data");return L&&A.Lang.isNumber(K);},getter:function(){return this[J];},setter:function(M){var R=this,O=R.get(E),P=R.get("data"),K=P&&P.length,Q=R.get("ac"),L=this.getClassName("selected");if(isNaN(O)){O=-1;}if(!P||!K){return;}while(M<-1){M+=K+1;}M=(M+1)%(K+1)-1;O=(O+1)%(K+1)-1;R[J]=M;if(O===-1){R[G]=Q.get(F);}if(O===M){return;}var S=R.get("contentBox").one("."+L);if(S){S.removeClass(L);}if(M===-1){Q.set(F,this[G]);}else{var N=R.item(M);if(N){N.addClass(L);}Q.set(F,P[M]);}return M;}};function I(K){return(""+K).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,"\\$1");}function H(L,K){var M=K.get("parentNode");M.insertBefore(L,K);M.insertBefore(K,L);}},"@VERSION@",{requires:["widget","ac-plugin"]});YUI.add("autocomplete",function(A){},"@VERSION@",{use:["ac-plugin"]});YUI.add("value-change",function(E){function K(N){return((E.Lang.isString(N)||E.Lang.isArray(N))?E.all(N):(N instanceof E.Node)?E.all([N._node]):(N instanceof E.NodeList)?N:E.all([N]));}function H(P,N){var O=E.on("available",function(){O.handle=E.on.apply(E,N);},P);return O;}function B(P,O){O[0]=C(P);O.splice(2,1);P.publish(O[0],{broadcast:true,emitFacade:true});var N=M(P),Q=P.on.apply(P,O);return Q;}function C(N){return E.stamp(N)+"-"+I;}function G(N,Q){var P={};for(var O in N){P[O]=J(O,N[O],Q);}return P;}function M(P){var N=C(P);var O=A[N]=A[N]||{count:0,handles:G(L,P)};O.count++;return O;}function J(P,N,O){var Q=E.on(P,N,O);E.after(E.bind(F,null,O,true),Q,"detach");return Q;}function F(P,Q){var O=A[C(P)];if(!O){return;}O.count--;if(Q){O.count=0;}if(O.count<=0){delete A[C(P)];for(var N in O.handles){O.handles[N].detach();}}}var A={},D={on:function(S,R,Q,T){var O=E.Array(arguments,0,true),N=K(Q);if(N.size()===0){return H(Q,O);}O[3]=T=T||((N.size()===1)?N.item(0):N);var P=[];N.each(function(U){var V=B(U,O);P.push(V);E.after(E.bind(F,null,U),V,"detach");});return{evt:P,sub:N,detach:function(){E.Array.each(P,function(U){U.detach();});}};}},I="valueChange",L=(function(){var P={},S={},N={};function U(X,Y){var W=C(X);T(X);S[W]=setInterval(E.bind(V,null,X,Y),50);N[W]=setTimeout(E.bind(T,null,X),10000);}function T(X){var W=C(X);clearTimeout(N[W]);clearInterval(S[W]);}function V(X,Z){var W=C(X);var Y=X.get("value");if(Y===P[W]){return;}X.fire(W,{type:I,value:Y,oldValue:P[W],_event:Z,target:X,currentTarget:X});P[W]=X.get("value");U(X,Z);}function Q(W){if(W.charCode===229||W.charCode===197){U(W.currentTarget,W);}}function R(W){T(W.currentTarget);}function O(W){U(W.currentTarget,W);}return{keyup:Q,blur:R,keydown:O};})();E.Env.evt.plugins[I]=D;if(E.Node){E.Node.DOM_EVENTS[I]=D;}},"@VERSION@",{optional:["event-custom"],requires:["node-base","event-focus"]});
0
\ No newline at end of file
0
src/autocomplete/test/ysearch/all-min.js.gz
Binary file not shown
0
src/autocomplete/test/ysearch/autocomplete-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("ac-plugin",function(C){var B="autocomplete",K=C.Lang,D=C.Array.each,F={query:function(P){var L=this,O=L.get("dataSource"),N=P.value,M=C.bind(G,L);if(O){O.sendRequest({request:L.get("queryTemplate")(N),callback:{success:M,failure:M}});}}};function E(){E.superclass.constructor.apply(this,arguments);}C.extend((C.Plugin.ACPlugin=C.augment(E,C.EventTarget)),C.Plugin.Base,{initializer:function(){var L=this,M=L.get("host");L.handles=I(L,M);var N=F;D(["query","load","show","hide","next","previous"],function(O){L.publish("ac:"+O,{broadcast:1,bubbles:1,context:L,preventable:true,defaultFn:N[O]||null,prefix:"ac"});},L);J(M);},destructor:function(){D(this.handles,function(L){L.detach();});},open:function(){this.fire("ac:show");},next:function(L){L.preventDefault();this.fire("ac:next");},previous:function(L){L.preventDefault();this.fire("ac:previous");},close:function(){this.fire("ac:hide");}},{NAME:"ACPlugin",NS:"ac",ATTRS:{queryValue:{getter:function(){return this.get("host").get("value");},setter:function(L){this.get("host").set("value",L);return(this._cachedValue=L);}},dataSource:{validator:function(L){return L&&K.isFunction(L.sendRequest);}},minQueryLength:{value:3,validator:K.isNumber},queryTemplate:{value:encodeURIComponent,setter:function(L){return(K.isFunction(L)?L:function(M){return L.replace(/(^|[^\\])((\\{2})*)\{query\}/,"$1$2"+encodeURIComponent(M)).replace(/(^|[^\\])((\\{2})*)\\(\{query\})/,"$1$2$4");});}}}});function I(L,M){return[C.on("valueChange",H,M,L),C.on("key",L.next,M,"down:40",L),C.on("key",L.previous,M,"down:38",L),C.on("key",L.close,M,"down:27",L)];}function H(M){var L=M.value;if(!L){return this.close();}if(L===this._cachedValue||L.length<this.get("minQueryLength")){return;}this._cachedValue=L;this.fire("ac:query",{value:M.value});}function A(L){return function(){if(L){L.setAttribute(B,"on");}L=null;};}function J(L){var N=C.Node.getDOMNode(L),O=N.getAttribute(B);if((O&&O!=="off")||O===null||O===undefined){var M=A(N);C.on("beforeunload",M,window);C.on("unload",M,window);}N.setAttribute(B,"off");}function G(M){var L=(M&&M.response&&M.response.results)?M.response.results:M;if(L&&!(L&&("length" in L)&&L.length===0)){this.fire("ac:load",{results:L,query:this.get("queryValue")});}}},"@VERSION@",{requires:["node","plugin","value-change","event-key"],optional:["event-custom"]});YUI.add("ac-widget",function(A){function D(){D.superclass.constructor.apply(this,arguments);}var C="_handles",E="selectedIndex",J="_selectedIndex",G="_originalValue",B=A.Array.each,F="queryValue";A.ACWidget=A.extend(D,A.Widget,{initializer:function(){var K=this;K.after("queryChanged",K.syncUI,K);K.after("dataChanged",K.syncUI,K);K.hide();},renderUI:function(){var L=this.get("ac");if(!L){return;}var K=L.get("host");H(this.get("boundingBox"),K);return this.setSize();},setSize:function(){return this.set("width",this.get("ac").get("host").getComputedStyle("width"));},bindUI:function(L){var M=this,K=M.get("contentBox"),L=L||M.get("ac");if(M[C]){B(M[C],function(N){N.detach();});M[C]=0;}if(L){M[C]=[K.delegate("click",M.click,"li",M),A.on("click",M.hide,document),L.on("ac:load",function(N){M.set("query",N.query).set("data",N.results).syncUI().show();}),L.on("ac:query",function(N){M.set("query",N.value).syncUI();}),L.on("ac:next",M.next,M),L.on("ac:previous",M.previous,M),L.on("ac:hide",M.hide,M)];}return M;},syncUI:function(){var K=this,M=K.get("data"),L=K.get("query");if(!M){return K;}K[J]=-1;K[G]="";K.get("contentBox").set("innerHTML",K.getListMarkup(M));return K;},getListMarkup:function(N){var M=this,K=M.get("listTpl"),L=[];B(N,function(O){L.push(M.getItemMarkup(O));});return K.replace(/\{list\}/g,L.join(""));},getItemMarkup:function(K){return this.get("itemTpl").replace(/\{term\}/g,K).replace(/\{hilite\}/g,this.getHiliteMarkup(K));},getHiliteMarkup:function(M){var L=this,K=L.get("query").split(/\s+/);out=M;B(K,function(N){if(!N){return;}N=I(N);out=out.replace(new RegExp(N,"g"),L.get("hiliteTpl").replace(/\{term\}/g,N));});return out;},next:function(){var K=this;if(K.get("visible")){return K.selectNext();}if(K.get("data")){K.show();}return K;},selectNext:function(){var K=this.get(E);return this.set(E,K+1);},selectPrevious:function(){var K=this.get(E);return this.set(E,K-1);},previous:function(){if(this.get("visible")){this.selectPrevious();}return this;},item:function(K){return this.get("contentBox").one(this.get("itemSelector").replace(/\{n\}/g,I(K+1)));},click:function(M){var K=this,L=K.get("ac"),N=M.currentTarget.get("text");L.set(F,N);K[J]=-1;K._currentValue=N;L.get("host").focus();K.hide();}},{NAME:"ACWidget",ATTRS:{ac:{setter:function(K){if(!this[C]){return;}this.bindUI(K);},validator:function(K){return true;}},data:{validator:function(K){return K&&K.length>0;}},query:{value:""},listTpl:{value:"<ul>{list}</ul>"},itemTpl:{value:"<li>{hilite}</li>"},itemSelector:{value:"ul li:nth-child({n})"},hiliteTpl:{value:"<em>{term}</em>"}}});D.ATTRS[E]={value:-1,validator:function(K){var L=this.get("data");return L&&A.Lang.isNumber(K);},getter:function(){return this[J];},setter:function(M){var R=this,O=R.get(E),P=R.get("data"),K=P&&P.length,Q=R.get("ac"),L=this.getClassName("selected");if(isNaN(O)){O=-1;}if(!P||!K){return;}while(M<-1){M+=K+1;}M=(M+1)%(K+1)-1;O=(O+1)%(K+1)-1;R[J]=M;if(O===-1){R[G]=Q.get(F);}if(O===M){return;}var S=R.get("contentBox").one("."+L);if(S){S.removeClass(L);}if(M===-1){Q.set(F,this[G]);}else{var N=R.item(M);if(N){N.addClass(L);}Q.set(F,P[M]);}return M;}};function I(K){return(""+K).replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,"\\$1");}function H(L,K){var M=K.get("parentNode");M.insertBefore(L,K);M.insertBefore(K,L);}},"@VERSION@",{requires:["widget","ac-plugin"]});YUI.add("autocomplete",function(A){},"@VERSION@",{use:["ac-plugin"]});
0
\ No newline at end of file
0
src/autocomplete/test/ysearch/build.sh
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
0
@@ -1,25 +0,0 @@
0
-#!/bin/bash
0
-
0
-here=$(pwd)
0
-
0
-echo "building"
0
-
0
-(
0
-  cd ../../../value-change
0
-  ant all
0
-  cd $here
0
-  cd ..
0
-  ant all
0
-  cd $here
0
-) &> /dev/null
0
-
0
-rm *.js{,.gz}
0
-
0
-for i in "value-change" autocomplete widget; do
0
-  cp ../../../../build/$i/${i}-min.js .
0
-done
0
-
0
-cat autocomplete-min.js value-change-min.js > all-min.js
0
-gzip -c all-min.js > all-min.js.gz
0
-
0
-ls -laF *.js{,.gz} | awk '{ print $5 " " $9 }'
0
\ No newline at end of file
0
src/autocomplete/test/ysearch/value-change-min.js
...
1
2
...
 
0
0
@@ -1 +0,0 @@
0
-YUI.add("value-change",function(E){function K(N){return((E.Lang.isString(N)||E.Lang.isArray(N))?E.all(N):(N instanceof E.Node)?E.all([N._node]):(N instanceof E.NodeList)?N:E.all([N]));}function H(P,N){var O=E.on("available",function(){O.handle=E.on.apply(E,N);},P);return O;}function B(P,O){O[0]=C(P);O.splice(2,1);P.publish(O[0],{broadcast:true,emitFacade:true});var N=M(P),Q=P.on.apply(P,O);return Q;}function C(N){return E.stamp(N)+"-"+I;}function G(N,Q){var P={};for(var O in N){P[O]=J(O,N[O],Q);}return P;}function M(P){var N=C(P);var O=A[N]=A[N]||{count:0,handles:G(L,P)};O.count++;return O;}function J(P,N,O){var Q=E.on(P,N,O);E.after(E.bind(F,null,O,true),Q,"detach");return Q;}function F(P,Q){var O=A[C(P)];if(!O){return;}O.count--;if(Q){O.count=0;}if(O.count<=0){delete A[C(P)];for(var N in O.handles){O.handles[N].detach();}}}var A={},D={on:function(S,R,Q,T){var O=E.Array(arguments,0,true),N=K(Q);if(N.size()===0){return H(Q,O);}O[3]=T=T||((N.size()===1)?N.item(0):N);var P=[];N.each(function(U){var V=B(U,O);P.push(V);E.after(E.bind(F,null,U),V,"detach");});return{evt:P,sub:N,detach:function(){E.Array.each(P,function(U){U.detach();});}};}},I="valueChange",L=(function(){var P={},S={},N={};function U(X,Y){var W=C(X);T(X);S[W]=setInterval(E.bind(V,null,X,Y),50);N[W]=setTimeout(E.bind(T,null,X),10000);}function T(X){var W=C(X);clearTimeout(N[W]);clearInterval(S[W]);}function V(X,Z){var W=C(X);var Y=X.get("value");if(Y===P[W]){return;}X.fire(W,{type:I,value:Y,oldValue:P[W],_event:Z,target:X,currentTarget:X});P[W]=X.get("value");U(X,Z);}function Q(W){if(W.charCode===229||W.charCode===197){U(W.currentTarget,W);}}function R(W){T(W.currentTarget);}function O(W){U(W.currentTarget,W);}return{keyup:Q,blur:R,keydown:O};})();E.Env.evt.plugins[I]=D;if(E.Node){E.Node.DOM_EVENTS[I]=D;}},"@VERSION@",{optional:["event-custom"],requires:["node-base","event-focus"]});
0
\ No newline at end of file
0
src/autocomplete/test/ysearch/widget-min.js
...
1
2
3
...
 
 
0
0
@@ -1,2 +0,0 @@
0
-YUI.add("widget",function(C){var Q=C.Lang,K=C.Object,i=C.Node,M=C.ClassNameManager,J="content",d="visible",g="hidden",h="disabled",T="focused",F="width",a="height",k="",b="-",j="boundingBox",W="contentBox",P="parentNode",c="ownerDocument",f="srcNode",e="body",B="tabIndex",E="locale",G="initValue",R="id",S="render",A="rendered",Z="destroyed",V="Change",I="_after",U="_uiSet",H="contentUpdate",X={};function D(O){this._strings={};D.superclass.constructor.apply(this,arguments);var Y=this.get(S),L;if(Y){if(Y!==true){L=Y;}this.render(L);}}D._buildCfg={aggregates:["HTML_PARSER"]};D.NAME="widget";D.UI_SRC="ui";var N=D.UI_SRC;D.ATTRS={id:{valueFn:"_guid",writeOnce:true},rendered:{value:false,readOnly:true},boundingBox:{value:null,setter:"_setBoundingBox",writeOnce:true},contentBox:{value:null,setter:"_setContentBox",writeOnce:true},tabIndex:{value:0,validator:"_validTabIndex"},focused:{value:false,readOnly:true},disabled:{value:false},visible:{value:true},height:{value:k},width:{value:k},moveStyles:{value:false},locale:{value:"en"},strings:{setter:function(L){return this._setStrings(L,this.get(E));},getter:function(){return this.getStrings(this.get(E));}},render:{value:false,writeOnce:true},srcNode:{value:null,setter:C.Node.one,writeOnce:true}};D._NAME=D.NAME.toLowerCase();D.getClassName=function(){var L=C.Array(arguments,0,true);L.splice(0,0,this._NAME);return M.getClassName.apply(M,L);};D.getByNode=function(L){var Y,O=D.getClassName();L=i.get(L);if(L){L=(L.hasClass(O))?L:L.ancestor("."+O);if(L){Y=X[C.stamp(L,true)];}}return Y||null;};D.HTML_PARSER={};C.extend(D,C.Base,{getClassName:function(){var L=C.Array(arguments,0,true);L.splice(0,0,this._name);return M.getClassName.apply(M,L);},initializer:function(L){var O,Y;this._name=this.constructor.NAME.toLowerCase();X[C.stamp(this.get(j))]=this;this.publish(H,{preventable:false});O=this._getSrcNode();Y=this._parseNode(O);L=this._applyParsedConfig(O,L,Y);},destructor:function(){var O=this.get(j);var L=C.stamp(O,true);if(L&&L in X){delete X[L];}O.remove(true);},render:function(L){if(this.get(Z)){return;}if(!this.get(A)){this.publish(S,{queuable:false,defaultFn:this._defRenderFn});L=(L)?i.get(L):null;if(L&&!L.inDoc()){L=null;}this.fire(S,{parentNode:L});}return this;},_defRenderFn:function(L){this._renderUI(L.parentNode);this._bindUI();this._syncUI();this.renderer();this._set(A,true);},renderer:function(){this.renderUI();this.bindUI();this.syncUI();},bindUI:function(){},renderUI:function(){},syncUI:function(){},hide:function(){return this.set(d,false);},show:function(){return this.set(d,true);},focus:function(){return this._set(T,true);},blur:function(){return this._set(T,false);},enable:function(){return this.set(h,false);},disable:function(){return this.set(h,true);},_parseNode:function(O){var L=this._getHtmlParser(),Y,l;if(L&&O){K.each(L,function(n,m,p){l=null;if(Q.isFunction(n)){l=n.call(this,O);}else{if(Q.isArray(n)){l=O.queryAll(n[0]);}else{l=O.query(n);}}if(l!==null&&l!==undefined){Y=Y||{};Y[m]=l;}},this);}return Y;},_getSrcNode:function(){return this.get(f)||this.get(W);},_applyParsedConfig:function(Y,L,O){return(O)?C.aggregate(L,O,false):L;},_moveStyles:function(m,o){var l=this.WRAP_STYLES,p=m.getStyle("position"),O=this.get(W),n=[0,0],Y,L;if(!this.get("height")){Y=O.get("offsetHeight");}if(!this.get("width")){L=O.get("offsetWidth");}if(p==="absolute"){n=m.getXY();o.setStyles({right:"auto",bottom:"auto"});m.setStyles({right:"auto",bottom:"auto"});}C.each(l,function(r,q){var t=m.getStyle(q);o.setStyle(q,t);if(r===false){m.setStyle(q,"");}else{m.setStyle(q,r);}});if(p==="absolute"){o.setXY(n);}if(Y){this.set("height",Y);}if(L){this.set("width",L);}},_renderBox:function(O){var Y=this.get(W),l=this.get(j),n=this.get(f),m=(n&&n.get(c))||l.get(c)||Y.get(c),L;if(n&&!n.compareTo(Y)&&!Y.inDoc(m)){n.replace(Y);}if(!l.compareTo(Y.get(P))&&!l.compareTo(Y)){if(this.get("moveStyles")){this._moveStyles(Y,l);}if(Y.inDoc(m)){Y.replace(l);}l.appendChild(Y);}if(!l.inDoc(m)&&!O){L=i.one(e).insert(l,0);}else{if(O&&!O.compareTo(l.get(P))){O.appendChild(l);}}},_setBoundingBox:function(L){return this._setBox(this.get(R),L,this.BOUNDING_TEMPLATE);},_setContentBox:function(L){if(this.CONTENT_TEMPLATE===null){return this.get(j);}else{return this._setBox(this.get(R)+this.CONTENT_BOX_ID_SUFFIX,L,this.CONTENT_TEMPLATE);}},_setBox:function(Y,O,L){O=i.one(O)||i.create(L);if(!O.get(R)){Y=Y||C.guid();O.set(R,Y);}return O;},_renderUI:function(L){this._renderBoxClassNames();this._renderBox(L);},_renderBoxClassNames:function(){var m=this._getClasses(),Y=this.get(j),L=this.get(W),O,l;Y.addClass(D.getClassName());for(l=m.length-3;l>=0;l--){O=m[l].NAME;if(O){Y.addClass(M.getClassName(O.toLowerCase()));}}L.addClass(this.getClassName(J));},_bindUI:function(){this._bindAttrUI([d,h,a,F,T]);this._bindDOMListeners();},_bindAttrUI:function(Y){for(var m=0,O=Y.length;m<O;m++){var L=Y[m];this.after(L+V,this[I+L.substring(0,1).toUpperCase()+L.substring(1)+V]);}},_syncAttrUI:function(Y){for(var m=0,O=Y.length;m<O;m++){var L=Y[m];this[U+L.substring(0,1).toUpperCase()+L.substring(1)](this.get(L));}},_bindDOMListeners:function(){var L=this.get(j).get(c);L.on("focus",this._onFocus,this);if(C.UA.webkit){L.on("mousedown",this._onDocMouseDown,this);}},_syncUI:function(){this._syncAttrUI([d,h,a,F,T,B]);},_uiSetHeight:function(L){if(Q.isNumber(L)){L=L+this.DEF_UNIT;}this.get(j).setStyle(a,L);},_uiSetWidth:function(L){if(Q.isNumber(L)){L=L+this.DEF_UNIT;}this.get(j).setStyle(F,L);},_uiSetVisible:function(Y){var O=this.get(j),L=this.getClassName(g);if(Y){O.removeClass(L);}else{O.addClass(L);}},_uiSetDisabled:function(Y){var O=this.get(j),L=this.getClassName(h);if(Y){O.addClass(L);}else{O.removeClass(L);}},_uiSetTabIndex:function(O){var L=this.get(j);if(Q.isNumber(O)){L.set(B,O);}else{L.removeAttribute(B);}},_uiSetFocused:function(l,Y){var O=this.get(j),L=this.getClassName(T);if(l){O.addClass(L);if(Y!==N){O.focus();}}else{O.removeClass(L);if(Y!==N){O.blur();}}},_afterVisibleChange:function(L){this._uiSetVisible(L.newVal);
0
-},_afterDisabledChange:function(L){this._uiSetDisabled(L.newVal);},_afterHeightChange:function(L){this._uiSetHeight(L.newVal);},_afterWidthChange:function(L){this._uiSetWidth(L.newVal);},_afterFocusedChange:function(L){this._uiSetFocused(L.newVal,L.src);},_onDocMouseDown:function(L){if(this._hasDOMFocus){this._onFocus(L);}},_onFocus:function(O){var l=O.target,Y=this.get(j),L=(Y.compareTo(l)||Y.contains(l));this._hasDOMFocus=L;this._set(T,L,{src:N});},toString:function(){return this.constructor.NAME+"["+this.get(R)+"]";},DEF_UNIT:"px",CONTENT_TEMPLATE:"<div></div>",BOUNDING_TEMPLATE:"<div></div>",CONTENT_BOX_ID_SUFFIX:"_c",WRAP_STYLES:{height:"100%",width:"100%",zIndex:false,position:"static",top:"0",left:"0",bottom:"",right:"",padding:"",margin:""},_setStrings:function(O,L){var Y=this._strings;L=L.toLowerCase();if(!Y[L]){Y[L]={};}C.aggregate(Y[L],O,true);return Y[L];},_getStrings:function(L){return this._strings[L.toLowerCase()];},getStrings:function(r){r=(r||this.get(E)).toLowerCase();var p=this.getDefaultLocale().toLowerCase(),O=this._getStrings(p),q=(O)?C.merge(O):{},o=r.split(b);if(r!==p||o.length>1){var L="";for(var m=0,Y=o.length;m<Y;++m){L+=o[m];var n=this._getStrings(L);if(n){C.aggregate(q,n,true);}L+=b;}}return q;},getString:function(Y,O){O=(O||this.get(E)).toLowerCase();var l=(this.getDefaultLocale()).toLowerCase(),m=this._getStrings(l)||{},n=m[Y],L=O.lastIndexOf(b);if(O!==l||L!=-1){do{m=this._getStrings(O);if(m&&Y in m){n=m[Y];break;}L=O.lastIndexOf(b);if(L!=-1){O=O.substring(0,L);}}while(L!=-1);}return n;},getDefaultLocale:function(){return this._conf.get(E,G);},_strings:null,_getHtmlParser:function(){if(!this._HTML_PARSER){var O=this._getClasses(),l={},L,Y;for(L=O.length-1;L>=0;L--){Y=O[L].HTML_PARSER;if(Y){C.mix(l,Y,true);}}this._HTML_PARSER=l;}return this._HTML_PARSER;},_guid:function(){return C.guid();},_validTabIndex:function(L){return(Q.isNumber(L)||Q.isNull(L));}});C.Widget=D;},"@VERSION@",{requires:["attribute","event-focus","base","node","classnamemanager"]});
0
\ No newline at end of file

Comments

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server