magic_grid 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (360) hide show
  1. data/lib/assets/javascripts/magic_grid.js +4 -1
  2. data/lib/magic_grid/definition.rb +2 -6
  3. data/lib/magic_grid/helpers.rb +21 -16
  4. data/lib/magic_grid/version.rb +1 -1
  5. data/test/dummy/config/database.yml +1 -1
  6. data/test/dummy/db/test.sqlite3 +0 -0
  7. data/test/dummy/log/development.log +506 -0
  8. data/test/dummy/log/test.log +21 -21
  9. data/test/dummy/tmp/cache/assets/C8C/B80/sprockets%2F371bf96e99717688ed7313a0c53f4212 +0 -0
  10. data/test/dummy/tmp/cache/assets/CAA/620/sprockets%2F87b209c0c9da28094a8d5581a21262c6 +0 -0
  11. data/test/dummy/tmp/cache/assets/CC7/220/sprockets%2Fd066c004d1fd26ae76a61303a7a18145 +0 -0
  12. data/test/dummy/tmp/cache/assets/CC9/CD0/sprockets%2Fd14b4504301b7b44b32bbb81929e419a +0 -0
  13. data/test/dummy/tmp/cache/assets/CD5/B70/sprockets%2F416150dc3ac35079c94273cc46e90aa6 +0 -0
  14. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  15. data/test/dummy/tmp/cache/assets/CD8/B70/sprockets%2F4050a4e5062ab95c9f32e9b6940821ea +0 -0
  16. data/test/dummy/tmp/cache/assets/CF0/1D0/sprockets%2F6fc757c2c8329244ca95d6909865bbc2 +0 -0
  17. data/test/dummy/tmp/cache/assets/D1A/310/sprockets%2F5384ad85f52d3272dbc64d46ef3876a4 +0 -0
  18. data/test/dummy/tmp/cache/assets/D30/820/sprockets%2Ffbb017837adf4b4486b10683c4c1af30 +0 -0
  19. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  20. data/test/dummy/tmp/cache/assets/D46/650/sprockets%2Ff56253b5f374fff1a33fbbc9881c9124 +0 -0
  21. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  22. data/test/dummy/tmp/cache/assets/D59/BC0/sprockets%2Fb3a75b50e55b5cc61ca234ea3e684a30 +0 -0
  23. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  24. data/test/dummy/tmp/cache/assets/D5F/9C0/sprockets%2Fa3922762ba5091b4a27f1c09f2fbb4fb +0 -0
  25. data/test/dummy/tmp/cache/assets/D67/B60/sprockets%2F5f1a0d05e77ca8b9a1fc2a47e17a8174 +0 -0
  26. data/test/dummy/tmp/cache/assets/D71/EE0/sprockets%2Fca1606e8fd72d043cc6746bad760b9f7 +0 -0
  27. data/test/dummy/tmp/cache/assets/D8E/B70/sprockets%2F5175c0aae5001ef8abf8671aa2456cdd +0 -0
  28. data/test/dummy/tmp/cache/assets/D9C/CD0/sprockets%2Fc85016e7bbd4f3adbb7635d01f85d39b +0 -0
  29. data/test/dummy/tmp/cache/assets/DA1/E20/sprockets%2F84c2bd8ba93beb86bb554f84b37bf710 +0 -0
  30. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  31. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  32. data/test/dummy/tmp/tarantula/images/header_bg.jpg +0 -0
  33. data/test/dummy/tmp/tarantula/images/logo.png +0 -0
  34. data/test/dummy/tmp/tarantula/images/tagline.png +0 -0
  35. data/test/dummy/tmp/tarantula/index.html +7834 -0
  36. data/test/dummy/tmp/tarantula/javascripts/jquery-1.2.3.js +3408 -0
  37. data/test/dummy/tmp/tarantula/javascripts/jquery-ui-tabs.js +890 -0
  38. data/test/dummy/tmp/tarantula/javascripts/jquery.tablesorter.js +861 -0
  39. data/test/dummy/tmp/tarantula/javascripts/tarantula.js +10 -0
  40. data/test/dummy/tmp/tarantula/stylesheets/tarantula.css +346 -0
  41. data/test/dummy/tmp/tarantula/test_posts/1.html +71 -0
  42. data/test/dummy/tmp/tarantula/test_posts/10.html +71 -0
  43. data/test/dummy/tmp/tarantula/test_posts/11.html +71 -0
  44. data/test/dummy/tmp/tarantula/test_posts/12.html +71 -0
  45. data/test/dummy/tmp/tarantula/test_posts/13.html +71 -0
  46. data/test/dummy/tmp/tarantula/test_posts/14.html +71 -0
  47. data/test/dummy/tmp/tarantula/test_posts/15.html +71 -0
  48. data/test/dummy/tmp/tarantula/test_posts/16.html +71 -0
  49. data/test/dummy/tmp/tarantula/test_posts/17.html +71 -0
  50. data/test/dummy/tmp/tarantula/test_posts/18.html +71 -0
  51. data/test/dummy/tmp/tarantula/test_posts/19.html +71 -0
  52. data/test/dummy/tmp/tarantula/test_posts/2.html +71 -0
  53. data/test/dummy/tmp/tarantula/test_posts/20.html +71 -0
  54. data/test/dummy/tmp/tarantula/test_posts/21.html +71 -0
  55. data/test/dummy/tmp/tarantula/test_posts/22.html +71 -0
  56. data/test/dummy/tmp/tarantula/test_posts/23.html +71 -0
  57. data/test/dummy/tmp/tarantula/test_posts/24.html +71 -0
  58. data/test/dummy/tmp/tarantula/test_posts/25.html +71 -0
  59. data/test/dummy/tmp/tarantula/test_posts/26.html +71 -0
  60. data/test/dummy/tmp/tarantula/test_posts/27.html +71 -0
  61. data/test/dummy/tmp/tarantula/test_posts/28.html +71 -0
  62. data/test/dummy/tmp/tarantula/test_posts/29.html +71 -0
  63. data/test/dummy/tmp/tarantula/test_posts/3.html +71 -0
  64. data/test/dummy/tmp/tarantula/test_posts/30.html +71 -0
  65. data/test/dummy/tmp/tarantula/test_posts/31.html +71 -0
  66. data/test/dummy/tmp/tarantula/test_posts/32.html +71 -0
  67. data/test/dummy/tmp/tarantula/test_posts/4.html +71 -0
  68. data/test/dummy/tmp/tarantula/test_posts/5.html +69 -0
  69. data/test/dummy/tmp/tarantula/test_posts/6.html +71 -0
  70. data/test/dummy/tmp/tarantula/test_posts/7.html +71 -0
  71. data/test/dummy/tmp/tarantula/test_posts/8.html +71 -0
  72. data/test/dummy/tmp/tarantula/test_posts/9.html +71 -0
  73. data/test/dummy/tmp/tarantula/test_users/100.html +71 -0
  74. data/test/dummy/tmp/tarantula/test_users/101.html +71 -0
  75. data/test/dummy/tmp/tarantula/test_users/102.html +71 -0
  76. data/test/dummy/tmp/tarantula/test_users/103.html +71 -0
  77. data/test/dummy/tmp/tarantula/test_users/104.html +71 -0
  78. data/test/dummy/tmp/tarantula/test_users/105.html +71 -0
  79. data/test/dummy/tmp/tarantula/test_users/106.html +71 -0
  80. data/test/dummy/tmp/tarantula/test_users/107.html +71 -0
  81. data/test/dummy/tmp/tarantula/test_users/108.html +71 -0
  82. data/test/dummy/tmp/tarantula/test_users/109.html +71 -0
  83. data/test/dummy/tmp/tarantula/test_users/110.html +71 -0
  84. data/test/dummy/tmp/tarantula/test_users/111.html +71 -0
  85. data/test/dummy/tmp/tarantula/test_users/112.html +71 -0
  86. data/test/dummy/tmp/tarantula/test_users/113.html +71 -0
  87. data/test/dummy/tmp/tarantula/test_users/114.html +71 -0
  88. data/test/dummy/tmp/tarantula/test_users/115.html +71 -0
  89. data/test/dummy/tmp/tarantula/test_users/116.html +71 -0
  90. data/test/dummy/tmp/tarantula/test_users/117.html +71 -0
  91. data/test/dummy/tmp/tarantula/test_users/118.html +71 -0
  92. data/test/dummy/tmp/tarantula/test_users/119.html +71 -0
  93. data/test/dummy/tmp/tarantula/test_users/120.html +71 -0
  94. data/test/dummy/tmp/tarantula/test_users/121.html +71 -0
  95. data/test/dummy/tmp/tarantula/test_users/122.html +71 -0
  96. data/test/dummy/tmp/tarantula/test_users/123.html +71 -0
  97. data/test/dummy/tmp/tarantula/test_users/124.html +71 -0
  98. data/test/dummy/tmp/tarantula/test_users/125.html +71 -0
  99. data/test/dummy/tmp/tarantula/test_users/126.html +71 -0
  100. data/test/dummy/tmp/tarantula/test_users/127.html +71 -0
  101. data/test/dummy/tmp/tarantula/test_users/128.html +71 -0
  102. data/test/dummy/tmp/tarantula/test_users/129.html +71 -0
  103. data/test/dummy/tmp/tarantula/test_users/130.html +71 -0
  104. data/test/dummy/tmp/tarantula/test_users/131.html +71 -0
  105. data/test/dummy/tmp/tarantula/test_users/132.html +71 -0
  106. data/test/dummy/tmp/tarantula/test_users/133.html +71 -0
  107. data/test/dummy/tmp/tarantula/test_users/134.html +71 -0
  108. data/test/dummy/tmp/tarantula/test_users/135.html +71 -0
  109. data/test/dummy/tmp/tarantula/test_users/136.html +71 -0
  110. data/test/dummy/tmp/tarantula/test_users/137.html +71 -0
  111. data/test/dummy/tmp/tarantula/test_users/138.html +71 -0
  112. data/test/dummy/tmp/tarantula/test_users/139.html +71 -0
  113. data/test/dummy/tmp/tarantula/test_users/140.html +71 -0
  114. data/test/dummy/tmp/tarantula/test_users/141.html +71 -0
  115. data/test/dummy/tmp/tarantula/test_users/142.html +71 -0
  116. data/test/dummy/tmp/tarantula/test_users/143.html +71 -0
  117. data/test/dummy/tmp/tarantula/test_users/144.html +71 -0
  118. data/test/dummy/tmp/tarantula/test_users/145.html +71 -0
  119. data/test/dummy/tmp/tarantula/test_users/146.html +71 -0
  120. data/test/dummy/tmp/tarantula/test_users/147.html +71 -0
  121. data/test/dummy/tmp/tarantula/test_users/148.html +71 -0
  122. data/test/dummy/tmp/tarantula/test_users/149.html +71 -0
  123. data/test/dummy/tmp/tarantula/test_users/150.html +71 -0
  124. data/test/dummy/tmp/tarantula/test_users/151.html +71 -0
  125. data/test/dummy/tmp/tarantula/test_users/152.html +71 -0
  126. data/test/dummy/tmp/tarantula/test_users/153.html +71 -0
  127. data/test/dummy/tmp/tarantula/test_users/154.html +71 -0
  128. data/test/dummy/tmp/tarantula/test_users/155.html +71 -0
  129. data/test/dummy/tmp/tarantula/test_users/156.html +71 -0
  130. data/test/dummy/tmp/tarantula/test_users/157.html +71 -0
  131. data/test/dummy/tmp/tarantula/test_users/158.html +71 -0
  132. data/test/dummy/tmp/tarantula/test_users/159.html +71 -0
  133. data/test/dummy/tmp/tarantula/test_users/160.html +71 -0
  134. data/test/dummy/tmp/tarantula/test_users/161.html +71 -0
  135. data/test/dummy/tmp/tarantula/test_users/162.html +71 -0
  136. data/test/dummy/tmp/tarantula/test_users/163.html +71 -0
  137. data/test/dummy/tmp/tarantula/test_users/164.html +71 -0
  138. data/test/dummy/tmp/tarantula/test_users/165.html +71 -0
  139. data/test/dummy/tmp/tarantula/test_users/166.html +71 -0
  140. data/test/dummy/tmp/tarantula/test_users/167.html +71 -0
  141. data/test/dummy/tmp/tarantula/test_users/168.html +71 -0
  142. data/test/dummy/tmp/tarantula/test_users/169.html +71 -0
  143. data/test/dummy/tmp/tarantula/test_users/170.html +71 -0
  144. data/test/dummy/tmp/tarantula/test_users/171.html +71 -0
  145. data/test/dummy/tmp/tarantula/test_users/172.html +71 -0
  146. data/test/dummy/tmp/tarantula/test_users/173.html +71 -0
  147. data/test/dummy/tmp/tarantula/test_users/174.html +71 -0
  148. data/test/dummy/tmp/tarantula/test_users/175.html +71 -0
  149. data/test/dummy/tmp/tarantula/test_users/176.html +71 -0
  150. data/test/dummy/tmp/tarantula/test_users/177.html +71 -0
  151. data/test/dummy/tmp/tarantula/test_users/178.html +71 -0
  152. data/test/dummy/tmp/tarantula/test_users/179.html +71 -0
  153. data/test/dummy/tmp/tarantula/test_users/180.html +71 -0
  154. data/test/dummy/tmp/tarantula/test_users/181.html +71 -0
  155. data/test/dummy/tmp/tarantula/test_users/182.html +71 -0
  156. data/test/dummy/tmp/tarantula/test_users/183.html +71 -0
  157. data/test/dummy/tmp/tarantula/test_users/184.html +71 -0
  158. data/test/dummy/tmp/tarantula/test_users/185.html +71 -0
  159. data/test/dummy/tmp/tarantula/test_users/186.html +71 -0
  160. data/test/dummy/tmp/tarantula/test_users/187.html +71 -0
  161. data/test/dummy/tmp/tarantula/test_users/188.html +71 -0
  162. data/test/dummy/tmp/tarantula/test_users/189.html +71 -0
  163. data/test/dummy/tmp/tarantula/test_users/190.html +71 -0
  164. data/test/dummy/tmp/tarantula/test_users/191.html +71 -0
  165. data/test/dummy/tmp/tarantula/test_users/192.html +71 -0
  166. data/test/dummy/tmp/tarantula/test_users/193.html +71 -0
  167. data/test/dummy/tmp/tarantula/test_users/194.html +71 -0
  168. data/test/dummy/tmp/tarantula/test_users/195.html +71 -0
  169. data/test/dummy/tmp/tarantula/test_users/196.html +71 -0
  170. data/test/dummy/tmp/tarantula/test_users/197.html +71 -0
  171. data/test/dummy/tmp/tarantula/test_users/198.html +71 -0
  172. data/test/dummy/tmp/tarantula/test_users/199.html +71 -0
  173. data/test/dummy/tmp/tarantula/test_users/200.html +71 -0
  174. data/test/dummy/tmp/tarantula/test_users/201.html +71 -0
  175. data/test/dummy/tmp/tarantula/test_users/202.html +71 -0
  176. data/test/dummy/tmp/tarantula/test_users/203.html +71 -0
  177. data/test/dummy/tmp/tarantula/test_users/204.html +71 -0
  178. data/test/dummy/tmp/tarantula/test_users/205.html +71 -0
  179. data/test/dummy/tmp/tarantula/test_users/206.html +71 -0
  180. data/test/dummy/tmp/tarantula/test_users/207.html +71 -0
  181. data/test/dummy/tmp/tarantula/test_users/208.html +71 -0
  182. data/test/dummy/tmp/tarantula/test_users/209.html +71 -0
  183. data/test/dummy/tmp/tarantula/test_users/210.html +71 -0
  184. data/test/dummy/tmp/tarantula/test_users/211.html +71 -0
  185. data/test/dummy/tmp/tarantula/test_users/212.html +71 -0
  186. data/test/dummy/tmp/tarantula/test_users/213.html +71 -0
  187. data/test/dummy/tmp/tarantula/test_users/214.html +71 -0
  188. data/test/dummy/tmp/tarantula/test_users/215.html +71 -0
  189. data/test/dummy/tmp/tarantula/test_users/216.html +71 -0
  190. data/test/dummy/tmp/tarantula/test_users/217.html +71 -0
  191. data/test/dummy/tmp/tarantula/test_users/218.html +71 -0
  192. data/test/dummy/tmp/tarantula/test_users/219.html +71 -0
  193. data/test/dummy/tmp/tarantula/test_users/220.html +71 -0
  194. data/test/dummy/tmp/tarantula/test_users/221.html +71 -0
  195. data/test/dummy/tmp/tarantula/test_users/222.html +71 -0
  196. data/test/dummy/tmp/tarantula/test_users/223.html +71 -0
  197. data/test/dummy/tmp/tarantula/test_users/224.html +71 -0
  198. data/test/dummy/tmp/tarantula/test_users/225.html +71 -0
  199. data/test/dummy/tmp/tarantula/test_users/226.html +71 -0
  200. data/test/dummy/tmp/tarantula/test_users/227.html +71 -0
  201. data/test/dummy/tmp/tarantula/test_users/228.html +71 -0
  202. data/test/dummy/tmp/tarantula/test_users/229.html +71 -0
  203. data/test/dummy/tmp/tarantula/test_users/230.html +71 -0
  204. data/test/dummy/tmp/tarantula/test_users/231.html +71 -0
  205. data/test/dummy/tmp/tarantula/test_users/232.html +71 -0
  206. data/test/dummy/tmp/tarantula/test_users/233.html +71 -0
  207. data/test/dummy/tmp/tarantula/test_users/234.html +71 -0
  208. data/test/dummy/tmp/tarantula/test_users/235.html +71 -0
  209. data/test/dummy/tmp/tarantula/test_users/236.html +71 -0
  210. data/test/dummy/tmp/tarantula/test_users/237.html +71 -0
  211. data/test/dummy/tmp/tarantula/test_users/238.html +71 -0
  212. data/test/dummy/tmp/tarantula/test_users/239.html +71 -0
  213. data/test/dummy/tmp/tarantula/test_users/240.html +71 -0
  214. data/test/dummy/tmp/tarantula/test_users/241.html +71 -0
  215. data/test/dummy/tmp/tarantula/test_users/242.html +71 -0
  216. data/test/dummy/tmp/tarantula/test_users/243.html +71 -0
  217. data/test/dummy/tmp/tarantula/test_users/244.html +71 -0
  218. data/test/dummy/tmp/tarantula/test_users/245.html +71 -0
  219. data/test/dummy/tmp/tarantula/test_users/246.html +71 -0
  220. data/test/dummy/tmp/tarantula/test_users/247.html +71 -0
  221. data/test/dummy/tmp/tarantula/test_users/248.html +71 -0
  222. data/test/dummy/tmp/tarantula/test_users/249.html +71 -0
  223. data/test/dummy/tmp/tarantula/test_users/250.html +71 -0
  224. data/test/dummy/tmp/tarantula/test_users/251.html +71 -0
  225. data/test/dummy/tmp/tarantula/test_users/252.html +71 -0
  226. data/test/dummy/tmp/tarantula/test_users/253.html +71 -0
  227. data/test/dummy/tmp/tarantula/test_users/254.html +71 -0
  228. data/test/dummy/tmp/tarantula/test_users/255.html +71 -0
  229. data/test/dummy/tmp/tarantula/test_users/256.html +71 -0
  230. data/test/dummy/tmp/tarantula/test_users/257.html +71 -0
  231. data/test/dummy/tmp/tarantula/test_users/258.html +71 -0
  232. data/test/dummy/tmp/tarantula/test_users/259.html +71 -0
  233. data/test/dummy/tmp/tarantula/test_users/260.html +71 -0
  234. data/test/dummy/tmp/tarantula/test_users/261.html +71 -0
  235. data/test/dummy/tmp/tarantula/test_users/262.html +71 -0
  236. data/test/dummy/tmp/tarantula/test_users/263.html +71 -0
  237. data/test/dummy/tmp/tarantula/test_users/264.html +71 -0
  238. data/test/dummy/tmp/tarantula/test_users/265.html +71 -0
  239. data/test/dummy/tmp/tarantula/test_users/266.html +71 -0
  240. data/test/dummy/tmp/tarantula/test_users/267.html +71 -0
  241. data/test/dummy/tmp/tarantula/test_users/268.html +71 -0
  242. data/test/dummy/tmp/tarantula/test_users/269.html +71 -0
  243. data/test/dummy/tmp/tarantula/test_users/270.html +71 -0
  244. data/test/dummy/tmp/tarantula/test_users/271.html +71 -0
  245. data/test/dummy/tmp/tarantula/test_users/272.html +71 -0
  246. data/test/dummy/tmp/tarantula/test_users/273.html +71 -0
  247. data/test/dummy/tmp/tarantula/test_users/274.html +71 -0
  248. data/test/dummy/tmp/tarantula/test_users/275.html +71 -0
  249. data/test/dummy/tmp/tarantula/test_users/276.html +71 -0
  250. data/test/dummy/tmp/tarantula/test_users/277.html +71 -0
  251. data/test/dummy/tmp/tarantula/test_users/278.html +71 -0
  252. data/test/dummy/tmp/tarantula/test_users/279.html +71 -0
  253. data/test/dummy/tmp/tarantula/test_users/280.html +71 -0
  254. data/test/dummy/tmp/tarantula/test_users/281.html +71 -0
  255. data/test/dummy/tmp/tarantula/test_users/282.html +71 -0
  256. data/test/dummy/tmp/tarantula/test_users/283.html +71 -0
  257. data/test/dummy/tmp/tarantula/test_users/284.html +71 -0
  258. data/test/dummy/tmp/tarantula/test_users/285.html +71 -0
  259. data/test/dummy/tmp/tarantula/test_users/286.html +71 -0
  260. data/test/dummy/tmp/tarantula/test_users/287.html +71 -0
  261. data/test/dummy/tmp/tarantula/test_users/288.html +71 -0
  262. data/test/dummy/tmp/tarantula/test_users/289.html +71 -0
  263. data/test/dummy/tmp/tarantula/test_users/290.html +71 -0
  264. data/test/dummy/tmp/tarantula/test_users/291.html +71 -0
  265. data/test/dummy/tmp/tarantula/test_users/292.html +71 -0
  266. data/test/dummy/tmp/tarantula/test_users/293.html +71 -0
  267. data/test/dummy/tmp/tarantula/test_users/294.html +71 -0
  268. data/test/dummy/tmp/tarantula/test_users/295.html +71 -0
  269. data/test/dummy/tmp/tarantula/test_users/296.html +71 -0
  270. data/test/dummy/tmp/tarantula/test_users/297.html +71 -0
  271. data/test/dummy/tmp/tarantula/test_users/298.html +71 -0
  272. data/test/dummy/tmp/tarantula/test_users/299.html +71 -0
  273. data/test/dummy/tmp/tarantula/test_users/300.html +71 -0
  274. data/test/dummy/tmp/tarantula/test_users/301.html +71 -0
  275. data/test/dummy/tmp/tarantula/test_users/302.html +71 -0
  276. data/test/dummy/tmp/tarantula/test_users/303.html +71 -0
  277. data/test/dummy/tmp/tarantula/test_users/304.html +71 -0
  278. data/test/dummy/tmp/tarantula/test_users/305.html +71 -0
  279. data/test/dummy/tmp/tarantula/test_users/306.html +71 -0
  280. data/test/dummy/tmp/tarantula/test_users/307.html +71 -0
  281. data/test/dummy/tmp/tarantula/test_users/308.html +71 -0
  282. data/test/dummy/tmp/tarantula/test_users/309.html +71 -0
  283. data/test/dummy/tmp/tarantula/test_users/31.html +71 -0
  284. data/test/dummy/tmp/tarantula/test_users/310.html +71 -0
  285. data/test/dummy/tmp/tarantula/test_users/311.html +71 -0
  286. data/test/dummy/tmp/tarantula/test_users/312.html +71 -0
  287. data/test/dummy/tmp/tarantula/test_users/313.html +71 -0
  288. data/test/dummy/tmp/tarantula/test_users/314.html +71 -0
  289. data/test/dummy/tmp/tarantula/test_users/315.html +71 -0
  290. data/test/dummy/tmp/tarantula/test_users/316.html +71 -0
  291. data/test/dummy/tmp/tarantula/test_users/32.html +71 -0
  292. data/test/dummy/tmp/tarantula/test_users/33.html +71 -0
  293. data/test/dummy/tmp/tarantula/test_users/34.html +71 -0
  294. data/test/dummy/tmp/tarantula/test_users/35.html +71 -0
  295. data/test/dummy/tmp/tarantula/test_users/36.html +71 -0
  296. data/test/dummy/tmp/tarantula/test_users/37.html +69 -0
  297. data/test/dummy/tmp/tarantula/test_users/38.html +71 -0
  298. data/test/dummy/tmp/tarantula/test_users/39.html +71 -0
  299. data/test/dummy/tmp/tarantula/test_users/40.html +71 -0
  300. data/test/dummy/tmp/tarantula/test_users/41.html +71 -0
  301. data/test/dummy/tmp/tarantula/test_users/42.html +71 -0
  302. data/test/dummy/tmp/tarantula/test_users/43.html +71 -0
  303. data/test/dummy/tmp/tarantula/test_users/44.html +71 -0
  304. data/test/dummy/tmp/tarantula/test_users/45.html +71 -0
  305. data/test/dummy/tmp/tarantula/test_users/46.html +71 -0
  306. data/test/dummy/tmp/tarantula/test_users/47.html +71 -0
  307. data/test/dummy/tmp/tarantula/test_users/48.html +71 -0
  308. data/test/dummy/tmp/tarantula/test_users/49.html +71 -0
  309. data/test/dummy/tmp/tarantula/test_users/50.html +71 -0
  310. data/test/dummy/tmp/tarantula/test_users/51.html +71 -0
  311. data/test/dummy/tmp/tarantula/test_users/52.html +71 -0
  312. data/test/dummy/tmp/tarantula/test_users/53.html +71 -0
  313. data/test/dummy/tmp/tarantula/test_users/54.html +71 -0
  314. data/test/dummy/tmp/tarantula/test_users/55.html +71 -0
  315. data/test/dummy/tmp/tarantula/test_users/56.html +71 -0
  316. data/test/dummy/tmp/tarantula/test_users/57.html +71 -0
  317. data/test/dummy/tmp/tarantula/test_users/58.html +71 -0
  318. data/test/dummy/tmp/tarantula/test_users/59.html +71 -0
  319. data/test/dummy/tmp/tarantula/test_users/60.html +71 -0
  320. data/test/dummy/tmp/tarantula/test_users/61.html +71 -0
  321. data/test/dummy/tmp/tarantula/test_users/62.html +71 -0
  322. data/test/dummy/tmp/tarantula/test_users/63.html +71 -0
  323. data/test/dummy/tmp/tarantula/test_users/64.html +71 -0
  324. data/test/dummy/tmp/tarantula/test_users/65.html +71 -0
  325. data/test/dummy/tmp/tarantula/test_users/66.html +71 -0
  326. data/test/dummy/tmp/tarantula/test_users/67.html +71 -0
  327. data/test/dummy/tmp/tarantula/test_users/68.html +71 -0
  328. data/test/dummy/tmp/tarantula/test_users/69.html +71 -0
  329. data/test/dummy/tmp/tarantula/test_users/70.html +71 -0
  330. data/test/dummy/tmp/tarantula/test_users/71.html +71 -0
  331. data/test/dummy/tmp/tarantula/test_users/72.html +71 -0
  332. data/test/dummy/tmp/tarantula/test_users/73.html +71 -0
  333. data/test/dummy/tmp/tarantula/test_users/74.html +71 -0
  334. data/test/dummy/tmp/tarantula/test_users/75.html +71 -0
  335. data/test/dummy/tmp/tarantula/test_users/76.html +71 -0
  336. data/test/dummy/tmp/tarantula/test_users/77.html +71 -0
  337. data/test/dummy/tmp/tarantula/test_users/78.html +71 -0
  338. data/test/dummy/tmp/tarantula/test_users/79.html +71 -0
  339. data/test/dummy/tmp/tarantula/test_users/80.html +71 -0
  340. data/test/dummy/tmp/tarantula/test_users/81.html +71 -0
  341. data/test/dummy/tmp/tarantula/test_users/82.html +71 -0
  342. data/test/dummy/tmp/tarantula/test_users/83.html +71 -0
  343. data/test/dummy/tmp/tarantula/test_users/84.html +71 -0
  344. data/test/dummy/tmp/tarantula/test_users/85.html +71 -0
  345. data/test/dummy/tmp/tarantula/test_users/86.html +71 -0
  346. data/test/dummy/tmp/tarantula/test_users/87.html +71 -0
  347. data/test/dummy/tmp/tarantula/test_users/88.html +71 -0
  348. data/test/dummy/tmp/tarantula/test_users/89.html +71 -0
  349. data/test/dummy/tmp/tarantula/test_users/90.html +71 -0
  350. data/test/dummy/tmp/tarantula/test_users/91.html +71 -0
  351. data/test/dummy/tmp/tarantula/test_users/92.html +71 -0
  352. data/test/dummy/tmp/tarantula/test_users/93.html +71 -0
  353. data/test/dummy/tmp/tarantula/test_users/94.html +71 -0
  354. data/test/dummy/tmp/tarantula/test_users/95.html +71 -0
  355. data/test/dummy/tmp/tarantula/test_users/96.html +71 -0
  356. data/test/dummy/tmp/tarantula/test_users/97.html +71 -0
  357. data/test/dummy/tmp/tarantula/test_users/98.html +71 -0
  358. data/test/dummy/tmp/tarantula/test_users/99.html +71 -0
  359. data/test/test_helper.rb +2 -1
  360. metadata +708 -2
@@ -0,0 +1,861 @@
1
+ /*
2
+ *
3
+ * TableSorter 2.0 - Client-side table sorting with ease!
4
+ * Version 2.0.1
5
+ * @requires jQuery v1.2.1
6
+ *
7
+ * Copyright (c) 2007 Christian Bach
8
+ * Examples and docs at: http://tablesorter.com
9
+ * Dual licensed under the MIT and GPL licenses:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ * http://www.gnu.org/licenses/gpl.html
12
+ *
13
+ */
14
+ /**
15
+ *
16
+ * @description Create a sortable table with multi-column sorting capabilitys
17
+ *
18
+ * @example $('table').tablesorter();
19
+ * @desc Create a simple tablesorter interface.
20
+ *
21
+ * @example $('table').tablesorter({ sortList:[[0,0],[1,0]] });
22
+ * @desc Create a tablesorter interface and sort on the first and secound column in ascending order.
23
+ *
24
+ * @example $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
25
+ * @desc Create a tablesorter interface and disableing the first and secound column headers.
26
+ *
27
+ * @example $('table').tablesorter({ 0: {sorter:"integer"}, 1: {sorter:"currency"} });
28
+ * @desc Create a tablesorter interface and set a column parser for the first and secound column.
29
+ *
30
+ *
31
+ * @param Object settings An object literal containing key/value pairs to provide optional settings.
32
+ *
33
+ * @option String cssHeader (optional) A string of the class name to be appended to sortable tr elements in the thead of the table.
34
+ * Default value: "header"
35
+ *
36
+ * @option String cssAsc (optional) A string of the class name to be appended to sortable tr elements in the thead on a ascending sort.
37
+ * Default value: "headerSortUp"
38
+ *
39
+ * @option String cssDesc (optional) A string of the class name to be appended to sortable tr elements in the thead on a descending sort.
40
+ * Default value: "headerSortDown"
41
+ *
42
+ * @option String sortInitialOrder (optional) A string of the inital sorting order can be asc or desc.
43
+ * Default value: "asc"
44
+ *
45
+ * @option String sortMultisortKey (optional) A string of the multi-column sort key.
46
+ * Default value: "shiftKey"
47
+ *
48
+ * @option String textExtraction (optional) A string of the text-extraction method to use.
49
+ * For complex html structures inside td cell set this option to "complex",
50
+ * on large tables the complex option can be slow.
51
+ * Default value: "simple"
52
+ *
53
+ * @option Object headers (optional) An array containing the forces sorting rules.
54
+ * This option let's you specify a default sorting rule.
55
+ * Default value: null
56
+ *
57
+ * @option Array sortList (optional) An array containing the forces sorting rules.
58
+ * This option let's you specify a default sorting rule.
59
+ * Default value: null
60
+ *
61
+ * @option Array sortForce (optional) An array containing the forces sorting rules.
62
+ * This option let's you specify a default sorting rule.
63
+ * Default value: null
64
+ *
65
+ *
66
+ * @option Boolean widthFixed (optional) Boolean flag indicating if tablesorter should apply fixed widths to the table columns.
67
+ * This is usefull when using the pager companion plugin.
68
+ * This options requires the dimension jquery plugin.
69
+ * Default value: false
70
+ *
71
+ * @option Boolean cancelSelection (optional) Boolean flag indicating if tablesorter should cancel selection of the table headers text.
72
+ * Default value: true
73
+ *
74
+ * @option Boolean debug (optional) Boolean flag indicating if tablesorter should display debuging information usefull for development.
75
+ *
76
+ * @type jQuery
77
+ *
78
+ * @name tablesorter
79
+ *
80
+ * @cat Plugins/Tablesorter
81
+ *
82
+ * @author Christian Bach/christian.bach@polyester.se
83
+ */
84
+
85
+ (function($) {
86
+ $.extend({
87
+ tablesorter: new function() {
88
+
89
+ var parsers = [], widgets = [];
90
+
91
+ this.defaults = {
92
+ cssHeader: "header",
93
+ cssAsc: "headerSortUp",
94
+ cssDesc: "headerSortDown",
95
+ sortInitialOrder: "asc",
96
+ sortMultiSortKey: "shiftKey",
97
+ sortForce: null,
98
+ textExtraction: "simple",
99
+ parsers: {},
100
+ widgets: [],
101
+ widgetZebra: {css: ["even","odd"]},
102
+ headers: {},
103
+ widthFixed: false,
104
+ cancelSelection: true,
105
+ sortList: [],
106
+ headerList: [],
107
+ dateFormat: "us",
108
+ debug: false
109
+ };
110
+
111
+ /* debuging utils */
112
+ function benchmark(s,d) {
113
+ log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
114
+ }
115
+
116
+ this.benchmark = benchmark;
117
+
118
+ function log(s) {
119
+ if (typeof console != "undefined" && typeof console.debug != "undefined") {
120
+ console.log(s);
121
+ } else {
122
+ alert(s);
123
+ }
124
+ }
125
+
126
+ /* parsers utils */
127
+ function buildParserCache(table,$headers) {
128
+
129
+ if(table.config.debug) { var parsersDebug = ""; }
130
+
131
+ var rows = table.tBodies[0].rows;
132
+
133
+ if(table.tBodies[0].rows[0]) {
134
+
135
+ var list = [], cells = rows[0].cells, l = cells.length;
136
+
137
+ for (var i=0;i < l; i++) {
138
+ var p = false;
139
+
140
+ if($.meta && ($($headers[i]).data() && $($headers[i]).data().sorter) ) {
141
+
142
+ p = getParserById($($headers[i]).data().sorter);
143
+
144
+ } else if((table.config.headers[i] && table.config.headers[i].sorter)) {
145
+
146
+ p = getParserById(table.config.headers[i].sorter);
147
+ }
148
+ if(!p) {
149
+ p = detectParserForColumn(table.config,cells[i]);
150
+ }
151
+
152
+ if(table.config.debug) { parsersDebug += "column:" + i + " parser:" +p.id + "\n"; }
153
+
154
+ list.push(p);
155
+ }
156
+ }
157
+
158
+ if(table.config.debug) { log(parsersDebug); }
159
+
160
+ return list;
161
+ };
162
+
163
+ function detectParserForColumn(config,node) {
164
+ var l = parsers.length;
165
+ for(var i=1; i < l; i++) {
166
+ if(parsers[i].is($.trim(getElementText(config,node)))) {
167
+ return parsers[i];
168
+ }
169
+ }
170
+
171
+ // 0 is always the generic parser (text)
172
+ return parsers[0];
173
+ }
174
+
175
+ function getParserById(name) {
176
+ var l = parsers.length;
177
+ for(var i=0; i < l; i++) {
178
+ if(parsers[i].id.toLowerCase() == name.toLowerCase()) {
179
+ return parsers[i];
180
+ }
181
+ }
182
+ return false;
183
+ }
184
+
185
+ /* utils */
186
+ function buildCache(table) {
187
+
188
+ if(table.config.debug) { var cacheTime = new Date(); }
189
+
190
+
191
+ var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
192
+ totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
193
+ parsers = table.config.parsers,
194
+ cache = {row: [], normalized: []};
195
+
196
+ for (var i=0;i < totalRows; ++i) {
197
+
198
+ /** Add the table data to main data array */
199
+ var c = table.tBodies[0].rows[i], cols = [];
200
+
201
+ cache.row.push($(c));
202
+
203
+ for(var j=0; j < totalCells; ++j) {
204
+ cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));
205
+ }
206
+
207
+ cols.push(i); // add position for rowCache
208
+ cache.normalized.push(cols);
209
+ cols = null;
210
+ };
211
+
212
+ if(table.config.debug) { benchmark("Building cache for " + totalRows + " rows:", cacheTime); }
213
+
214
+ return cache;
215
+ };
216
+
217
+ function getElementText(config,node) {
218
+
219
+ if(!node) return "";
220
+
221
+ var t = "";
222
+
223
+ if(config.textExtraction == "simple") {
224
+ if(node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
225
+ t = node.childNodes[0].innerHTML;
226
+ } else {
227
+ t = node.innerHTML;
228
+ }
229
+ } else {
230
+ if(typeof(config.textExtraction) == "function") {
231
+ t = config.textExtraction(node);
232
+ } else {
233
+ t = $(node).text();
234
+ }
235
+ }
236
+ return t;
237
+ }
238
+
239
+ function appendToTable(table,cache) {
240
+
241
+ if(table.config.debug) {var appendTime = new Date()}
242
+
243
+ var c = cache,
244
+ r = c.row,
245
+ n= c.normalized,
246
+ totalRows = n.length,
247
+ checkCell = (n[0].length-1),
248
+ tableBody = $(table.tBodies[0]),
249
+ rows = [];
250
+
251
+ // clear the table body
252
+ //$.tablesorter.clearTableBody(table);
253
+
254
+
255
+
256
+
257
+ for (var i=0;i < totalRows; i++) {
258
+ rows.push(r[n[i][checkCell]]);
259
+ if(!table.config.appender) {
260
+
261
+ var o = r[n[i][checkCell]];
262
+ var l = o.length;
263
+ for(var j=0; j < l; j++) {
264
+
265
+ tableBody[0].appendChild(o[j]);
266
+
267
+ }
268
+
269
+ //tableBody.append(r[n[i][checkCell]]);
270
+ }
271
+ }
272
+
273
+ if(table.config.appender) {
274
+
275
+ table.config.appender(table,rows);
276
+ }
277
+
278
+ rows = null;
279
+
280
+ if(table.config.debug) { benchmark("Rebuilt table:", appendTime); }
281
+
282
+ //apply table widgets
283
+ applyWidget(table);
284
+ };
285
+
286
+ function buildHeaders(table) {
287
+
288
+ if(table.config.debug) { var time = new Date(); }
289
+
290
+ var meta = ($.meta) ? true : false, tableHeadersRows = [];
291
+
292
+ for(var i = 0; i < table.tHead.rows.length; i++) { tableHeadersRows[i]=0; };
293
+
294
+ $tableHeaders = $("thead th",table);
295
+
296
+ $tableHeaders.each(function(index) {
297
+
298
+ this.count = 0;
299
+ this.column = index;
300
+ this.order = formatSortingOrder(table.config.sortInitialOrder);
301
+
302
+ if(checkHeaderMetadata(this) || checkHeaderOptions(table,index)) this.sortDisabled = true;
303
+
304
+ if(!this.sortDisabled) {
305
+ $(this).addClass(table.config.cssHeader);
306
+ }
307
+
308
+ // add cell to headerList
309
+ table.config.headerList[index]= this;
310
+ });
311
+
312
+ if(table.config.debug) { benchmark("Built headers:", time); log($tableHeaders); }
313
+
314
+ return $tableHeaders;
315
+
316
+ };
317
+
318
+ function checkCellColSpan(table, rows, row) {
319
+ var arr = [], r = table.tHead.rows, c = r[row].cells;
320
+
321
+ for(var i=0; i < c.length; i++) {
322
+ var cell = c[i];
323
+
324
+ if ( cell.colSpan > 1) {
325
+ arr = arr.concat(checkCellColSpan(table, headerArr,row++));
326
+ } else {
327
+ if(table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row+1])) {
328
+ arr.push(cell);
329
+ }
330
+ //headerArr[row] = (i+row);
331
+ }
332
+ }
333
+ return arr;
334
+ };
335
+
336
+ function checkHeaderMetadata(cell) {
337
+ if(($.meta) && ($(cell).data().sorter === false)) { return true; };
338
+ return false;
339
+ }
340
+
341
+ function checkHeaderOptions(table,i) {
342
+ if((table.config.headers[i]) && (table.config.headers[i].sorter === false)) { return true; };
343
+ return false;
344
+ }
345
+
346
+ function applyWidget(table) {
347
+ var c = table.config.widgets;
348
+ var l = c.length;
349
+ for(var i=0; i < l; i++) {
350
+
351
+ getWidgetById(c[i]).format(table);
352
+ }
353
+
354
+ }
355
+
356
+ function getWidgetById(name) {
357
+ var l = widgets.length;
358
+ for(var i=0; i < l; i++) {
359
+ if(widgets[i].id.toLowerCase() == name.toLowerCase() ) {
360
+ return widgets[i];
361
+ }
362
+ }
363
+ };
364
+
365
+ function formatSortingOrder(v) {
366
+
367
+ if(typeof(v) != "Number") {
368
+ i = (v.toLowerCase() == "desc") ? 1 : 0;
369
+ } else {
370
+ i = (v == (0 || 1)) ? v : 0;
371
+ }
372
+ return i;
373
+ }
374
+
375
+ function isValueInArray(v, a) {
376
+ var l = a.length;
377
+ for(var i=0; i < l; i++) {
378
+ if(a[i][0] == v) {
379
+ return true;
380
+ }
381
+ }
382
+ return false;
383
+ }
384
+
385
+ function setHeadersCss(table,$headers, list, css) {
386
+ // remove all header information
387
+ $headers.removeClass(css[0]).removeClass(css[1]);
388
+
389
+ var h = [];
390
+ $headers.each(function(offset) {
391
+ if(!this.sortDisabled) {
392
+ h[this.column] = $(this);
393
+ }
394
+ });
395
+
396
+ var l = list.length;
397
+ for(var i=0; i < l; i++) {
398
+ h[list[i][0]].addClass(css[list[i][1]]);
399
+ }
400
+ }
401
+
402
+ function fixColumnWidth(table,$headers) {
403
+ var c = table.config;
404
+ if(c.widthFixed) {
405
+ var colgroup = $('<colgroup>');
406
+ $("tr:first td",table.tBodies[0]).each(function() {
407
+ colgroup.append($('<col>').css('width',$(this).width()));
408
+ });
409
+ $(table).prepend(colgroup);
410
+ };
411
+ }
412
+
413
+ function updateHeaderSortCount(table,sortList) {
414
+ var c = table.config, l = sortList.length;
415
+ for(var i=0; i < l; i++) {
416
+ var s = sortList[i], o = c.headerList[s[0]];
417
+ o.count = s[1];
418
+ o.count++;
419
+ }
420
+ }
421
+
422
+ /* sorting methods */
423
+ function multisort(table,sortList,cache) {
424
+
425
+
426
+ if(table.config.debug) { var sortTime = new Date(); }
427
+
428
+ var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
429
+
430
+ for(var i=0; i < l; i++) {
431
+
432
+ var c = sortList[i][0];
433
+ var order = sortList[i][1];
434
+ var s = (getCachedSortType(table.config.parsers,c) == "text") ? ((order == 0) ? "sortText" : "sortTextDesc") : ((order == 0) ? "sortNumeric" : "sortNumericDesc");
435
+
436
+ var e = "e" + i;
437
+
438
+ dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); ";
439
+ dynamicExp += "if(" + e + ") { return " + e + "; } ";
440
+ dynamicExp += "else { ";
441
+ }
442
+
443
+ // if value is the same keep orignal order
444
+ var orgOrderCol = cache.normalized[0].length - 1;
445
+ dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
446
+
447
+ for(var i=0; i < l; i++) {
448
+ dynamicExp += "}; ";
449
+ }
450
+
451
+ dynamicExp += "return 0; ";
452
+ dynamicExp += "}; ";
453
+
454
+ eval(dynamicExp);
455
+
456
+ cache.normalized.sort(sortWrapper);
457
+
458
+ if(table.config.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order+ " time:", sortTime); }
459
+
460
+ return cache;
461
+ };
462
+
463
+ function sortText(a,b) {
464
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
465
+ };
466
+
467
+ function sortTextDesc(a,b) {
468
+ return ((b < a) ? -1 : ((b > a) ? 1 : 0));
469
+ };
470
+
471
+ function sortNumeric(a,b) {
472
+ return a-b;
473
+ };
474
+
475
+ function sortNumericDesc(a,b) {
476
+ return b-a;
477
+ };
478
+
479
+ function getCachedSortType(parsers,i) {
480
+ return parsers[i].type;
481
+ };
482
+
483
+ /* public methods */
484
+ this.construct = function(settings) {
485
+
486
+ return this.each(function() {
487
+
488
+ if(!this.tHead || !this.tBodies) return;
489
+
490
+ var $this, $document,$headers, cache, config, shiftDown = 0, sortOrder;
491
+
492
+ this.config = {};
493
+
494
+ config = $.extend(this.config, $.tablesorter.defaults, settings);
495
+
496
+ // store common expression for speed
497
+ $this = $(this);
498
+
499
+ // build headers
500
+ $headers = buildHeaders(this);
501
+
502
+ // try to auto detect column type, and store in tables config
503
+ this.config.parsers = buildParserCache(this,$headers);
504
+
505
+
506
+ // build the cache for the tbody cells
507
+ cache = buildCache(this);
508
+
509
+ // get the css class names, could be done else where.
510
+ var sortCSS = [config.cssDesc,config.cssAsc];
511
+
512
+ // fixate columns if the users supplies the fixedWidth option
513
+ fixColumnWidth(this);
514
+
515
+ // apply event handling to headers
516
+ // this is to big, perhaps break it out?
517
+ $headers.click(function(e) {
518
+
519
+ var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
520
+
521
+ if(!this.sortDisabled && totalRows > 0) {
522
+ // store exp, for speed
523
+ var $cell = $(this);
524
+
525
+ // get current column index
526
+ var i = this.column;
527
+
528
+ // get current column sort order
529
+ this.order = this.count++ % 2;
530
+
531
+ // user only whants to sort on one column
532
+ if(!e[config.sortMultiSortKey]) {
533
+
534
+ // flush the sort list
535
+ config.sortList = [];
536
+
537
+ if(config.sortForce != null) {
538
+ var a = config.sortForce;
539
+ for(var j=0; j < a.length; j++) {
540
+ config.sortList.push(a[j]);
541
+ }
542
+ }
543
+
544
+ // add column to sort list
545
+ config.sortList.push([i,this.order]);
546
+
547
+ // multi column sorting
548
+ } else {
549
+ // the user has clicked on an all ready sortet column.
550
+ if(isValueInArray(i,config.sortList)) {
551
+
552
+ // revers the sorting direction for all tables.
553
+ for(var j=0; j < config.sortList.length; j++) {
554
+ var s = config.sortList[j], o = config.headerList[s[0]];
555
+ if(s[0] == i) {
556
+ o.count = s[1];
557
+ o.count++;
558
+ s[1] = o.count % 2;
559
+ }
560
+ }
561
+ } else {
562
+ // add column to sort list array
563
+ config.sortList.push([i,this.order]);
564
+ }
565
+ };
566
+
567
+ // trigger sortstart
568
+ $this.trigger("sortStart");
569
+
570
+ //set css for headers
571
+ setHeadersCss($this[0],$headers,config.sortList,sortCSS);
572
+
573
+ // javascript threading..
574
+ setTimeout(function() {
575
+ // sort the table and append it to the dom
576
+ appendToTable($this[0],multisort($this[0],config.sortList,cache));
577
+ // trigger sortstart
578
+ $this.trigger("sortEnd");
579
+ }, 0);
580
+ // stop normal event by returning false
581
+ return false;
582
+ }
583
+ // cancel selection
584
+ }).mousedown(function() {
585
+ if(config.cancelSelection) {
586
+ this.onselectstart = function() {return false};
587
+ return false;
588
+ }
589
+ });
590
+
591
+ // apply easy methods that trigger binded events
592
+ $this.bind("update",function() {
593
+
594
+ // rebuild parsers.
595
+ this.config.parsers = buildParserCache(this,$headers);
596
+
597
+ // rebuild the cache map
598
+ cache = buildCache(this);
599
+
600
+ }).bind("sorton",function(e,list) {
601
+
602
+ config.sortList = list;
603
+
604
+ // update and store the sortlist
605
+ var sortList = config.sortList;
606
+
607
+ // update header count index
608
+ updateHeaderSortCount(this,sortList);
609
+
610
+ //set css for headers
611
+ setHeadersCss(this,$headers,sortList,sortCSS);
612
+
613
+ // sort the table and append it to the dom
614
+ appendToTable(this,multisort(this,sortList,cache));
615
+
616
+ }).bind("appendCache",function() {
617
+
618
+ appendToTable(this,cache);
619
+
620
+ }).bind("applyWidgetId",function(e,id) {
621
+
622
+ getWidgetById(id).format(this);
623
+
624
+ }).bind("applyWidgets",function() {
625
+ // apply widgets
626
+ applyWidget(this);
627
+ });
628
+
629
+ if($.meta && ($(this).data() && $(this).data().sortlist)) {
630
+ config.sortList = $(this).data().sortlist;
631
+ }
632
+ // if user has supplied a sort list to constructor.
633
+ if(config.sortList.length > 0) {
634
+ $this.trigger("sorton",[config.sortList]);
635
+ }
636
+
637
+ // apply widgets
638
+ applyWidget(this);
639
+ });
640
+ };
641
+
642
+ this.addParser = function(parser) {
643
+ var l = parsers.length, a = true;
644
+ for(var i=0; i < l; i++) {
645
+ if(parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
646
+ a = false;
647
+ }
648
+ }
649
+ if(a) { parsers.push(parser); };
650
+ };
651
+
652
+ this.addWidget = function(widget) {
653
+ widgets.push(widget);
654
+ };
655
+
656
+ this.formatFloat = function(s) {
657
+
658
+ var i = parseFloat(s);
659
+ return (isNaN(i)) ? 0 : i;
660
+ };
661
+ this.formatInt = function(s) {
662
+ var i = parseInt(s);
663
+ return (isNaN(i)) ? 0 : i;
664
+ };
665
+
666
+ this.clearTableBody = function(table) {
667
+
668
+ if($.browser.msie) {
669
+
670
+ function empty() {
671
+
672
+ while ( this.firstChild ) this.removeChild( this.firstChild );
673
+
674
+ }
675
+
676
+ empty.apply(table.tBodies[0]);
677
+
678
+ } else {
679
+ table.tBodies[0].innerHTML = "";
680
+ }
681
+ };
682
+ }
683
+ });
684
+
685
+ // extend plugin scope
686
+ $.fn.extend({
687
+ tablesorter: $.tablesorter.construct
688
+ });
689
+
690
+ var ts = $.tablesorter;
691
+
692
+ // add default parsers
693
+ ts.addParser({
694
+ id: "text",
695
+ is: function(s) {
696
+ return true;
697
+ },
698
+ format: function(s) {
699
+ return $.trim(s.toLowerCase());
700
+ },
701
+ type: "text"
702
+ });
703
+
704
+ ts.addParser({
705
+ id: "integer",
706
+ is: function(s) {
707
+ return /^\d+$/.test(s);
708
+ },
709
+ format: function(s) {
710
+ return $.tablesorter.formatFloat(s);
711
+ },
712
+ type: "numeric"
713
+ });
714
+
715
+ ts.addParser({
716
+ id: "currency",
717
+ is: function(s) {
718
+ return /^[£$€?.]/.test(s);
719
+ },
720
+ format: function(s) {
721
+ return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));
722
+ },
723
+ type: "numeric"
724
+ });
725
+
726
+ ts.addParser({
727
+ id: "floating",
728
+ is: function(s) {
729
+ return s.match(new RegExp(/^(\+|-)?[0-9]+\.[0-9]+((E|e)(\+|-)?[0-9]+)?$/));
730
+ },
731
+ format: function(s) {
732
+ return $.tablesorter.formatFloat(s.replace(new RegExp(/,/),""));
733
+ },
734
+ type: "numeric"
735
+ });
736
+
737
+ ts.addParser({
738
+ id: "ipAddress",
739
+ is: function(s) {
740
+ return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
741
+ },
742
+ format: function(s) {
743
+ var a = s.split("."), r = "", l = a.length;
744
+ for(var i = 0; i < l; i++) {
745
+ var item = a[i];
746
+ if(item.length == 2) {
747
+ r += "0" + item;
748
+ } else {
749
+ r += item;
750
+ }
751
+ }
752
+ return $.tablesorter.formatFloat(r);
753
+ },
754
+ type: "numeric"
755
+ });
756
+
757
+ ts.addParser({
758
+ id: "url",
759
+ is: function(s) {
760
+ return /^(https?|ftp|file):\/\/$/.test(s);
761
+ },
762
+ format: function(s) {
763
+ return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));
764
+ },
765
+ type: "text"
766
+ });
767
+
768
+ ts.addParser({
769
+ id: "isoDate",
770
+ is: function(s) {
771
+ return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
772
+ },
773
+ format: function(s) {
774
+ return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g),"/")).getTime() : "0");
775
+ },
776
+ type: "numeric"
777
+ });
778
+
779
+ ts.addParser({
780
+ id: "percent",
781
+ is: function(s) {
782
+ return /^\d{1,3}%$/.test(s);
783
+ },
784
+ format: function(s) {
785
+ return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));
786
+ },
787
+ type: "numeric"
788
+ });
789
+
790
+ ts.addParser({
791
+ id: "usLongDate",
792
+ is: function(s) {
793
+ return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
794
+ },
795
+ format: function(s) {
796
+ return $.tablesorter.formatFloat(new Date(s).getTime());
797
+ },
798
+ type: "numeric"
799
+ });
800
+
801
+ ts.addParser({
802
+ id: "shortDate",
803
+ is: function(s) {
804
+ return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
805
+ },
806
+ format: function(s,table) {
807
+ var c = table.config;
808
+ s = s.replace(/\-/g,"/");
809
+ if(c.dateFormat == "us") {
810
+ // reformat the string in ISO format
811
+ s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
812
+ } else if(c.dateFormat == "uk") {
813
+ //reformat the string in ISO format
814
+ s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
815
+ } else if(c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
816
+ s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
817
+ }
818
+ return $.tablesorter.formatFloat(new Date(s).getTime());
819
+ },
820
+ type: "numeric"
821
+ });
822
+
823
+ ts.addParser({
824
+ id: "time",
825
+ is: function(s) {
826
+ return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
827
+ },
828
+ format: function(s) {
829
+ return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
830
+ },
831
+ type: "numeric"
832
+ });
833
+
834
+
835
+ ts.addParser({
836
+ id: "metadata",
837
+ is: function(s) {
838
+ return false;
839
+ },
840
+ format: function(s,table,cell) {
841
+ var c = table.config, p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
842
+ return $(cell).data()[p];
843
+ },
844
+ type: "numeric"
845
+ });
846
+
847
+ // add default widgets
848
+ ts.addWidget({
849
+ id: "zebra",
850
+ format: function(table) {
851
+ if(table.config.debug) { var time = new Date(); }
852
+ $("tr:visible",table.tBodies[0])
853
+ .filter(':even')
854
+ .removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0])
855
+ .end().filter(':odd')
856
+ .removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
857
+ if(table.config.debug) { $.tablesorter.benchmark("Applying Zebra widget", time); }
858
+ }
859
+ });
860
+
861
+ })(jQuery);