You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

923 lines
28 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. /*
  2. * # Semantic - Dropdown
  3. * http://github.com/jlukic/semantic-ui/
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ( $, window, document, undefined ) {
  12. $.fn.dropdown = function(parameters) {
  13. var
  14. $allModules = $(this),
  15. $document = $(document),
  16. moduleSelector = $allModules.selector || '',
  17. hasTouch = ('ontouchstart' in document.documentElement),
  18. time = new Date().getTime(),
  19. performance = [],
  20. query = arguments[0],
  21. methodInvoked = (typeof query == 'string'),
  22. queryArguments = [].slice.call(arguments, 1),
  23. returnedValue
  24. ;
  25. $allModules
  26. .each(function() {
  27. var
  28. settings = ( $.isPlainObject(parameters) )
  29. ? $.extend(true, {}, $.fn.dropdown.settings, parameters)
  30. : $.extend({}, $.fn.dropdown.settings),
  31. className = settings.className,
  32. metadata = settings.metadata,
  33. namespace = settings.namespace,
  34. selector = settings.selector,
  35. error = settings.error,
  36. eventNamespace = '.' + namespace,
  37. moduleNamespace = 'module-' + namespace,
  38. $module = $(this),
  39. $item = $module.find(selector.item),
  40. $text = $module.find(selector.text),
  41. $input = $module.find(selector.input),
  42. $combo = ($module.prev().find(selector.text).size() > 0)
  43. ? $module.prev().find(selector.text)
  44. : $module.prev(),
  45. $menu = $module.children(selector.menu),
  46. element = this,
  47. instance = $module.data(moduleNamespace),
  48. module
  49. ;
  50. module = {
  51. initialize: function() {
  52. module.debug('Initializing dropdown', settings);
  53. module.save.defaults();
  54. module.set.selected();
  55. if(hasTouch) {
  56. module.bind.touchEvents();
  57. }
  58. module.bind.mouseEvents();
  59. module.instantiate();
  60. },
  61. instantiate: function() {
  62. module.verbose('Storing instance of dropdown', module);
  63. instance = module;
  64. $module
  65. .data(moduleNamespace, module)
  66. ;
  67. },
  68. destroy: function() {
  69. module.verbose('Destroying previous dropdown for', $module);
  70. $item
  71. .off(eventNamespace)
  72. ;
  73. $module
  74. .off(eventNamespace)
  75. .removeData(moduleNamespace)
  76. ;
  77. },
  78. bind: {
  79. touchEvents: function() {
  80. module.debug('Touch device detected binding touch events');
  81. $module
  82. .on('touchstart' + eventNamespace, module.event.test.toggle)
  83. ;
  84. $item
  85. .on('touchstart' + eventNamespace, module.event.item.mouseenter)
  86. .on('touchstart' + eventNamespace, module.event.item.click)
  87. ;
  88. },
  89. mouseEvents: function() {
  90. module.verbose('Mouse detected binding mouse events');
  91. if(settings.on == 'click') {
  92. $module
  93. .on('click' + eventNamespace, module.event.test.toggle)
  94. ;
  95. }
  96. else if(settings.on == 'hover') {
  97. $module
  98. .on('mouseenter' + eventNamespace, module.delay.show)
  99. .on('mouseleave' + eventNamespace, module.delay.hide)
  100. ;
  101. }
  102. else {
  103. $module
  104. .on(settings.on + eventNamespace, module.toggle)
  105. ;
  106. }
  107. $item
  108. .on('mouseenter' + eventNamespace, module.event.item.mouseenter)
  109. .on('mouseleave' + eventNamespace, module.event.item.mouseleave)
  110. .on('click' + eventNamespace, module.event.item.click)
  111. ;
  112. },
  113. intent: function() {
  114. module.verbose('Binding hide intent event to document');
  115. if(hasTouch) {
  116. $document
  117. .on('touchstart' + eventNamespace, module.event.test.touch)
  118. .on('touchmove' + eventNamespace, module.event.test.touch)
  119. ;
  120. }
  121. $document
  122. .on('click' + eventNamespace, module.event.test.hide)
  123. ;
  124. }
  125. },
  126. unbind: {
  127. intent: function() {
  128. module.verbose('Removing hide intent event from document');
  129. if(hasTouch) {
  130. $document
  131. .off('touchstart' + eventNamespace)
  132. .off('touchmove' + eventNamespace)
  133. ;
  134. }
  135. $document
  136. .off('click' + eventNamespace)
  137. ;
  138. }
  139. },
  140. event: {
  141. test: {
  142. toggle: function(event) {
  143. if( module.determine.intent(event, module.toggle) ) {
  144. event.preventDefault();
  145. }
  146. },
  147. touch: function(event) {
  148. module.determine.intent(event, function() {
  149. if(event.type == 'touchstart') {
  150. module.timer = setTimeout(module.hide, settings.delay.touch);
  151. }
  152. else if(event.type == 'touchmove') {
  153. clearTimeout(module.timer);
  154. }
  155. });
  156. event.stopPropagation();
  157. },
  158. hide: function(event) {
  159. module.determine.intent(event, module.hide);
  160. }
  161. },
  162. item: {
  163. mouseenter: function(event) {
  164. var
  165. $currentMenu = $(this).find(selector.menu),
  166. $otherMenus = $(this).siblings(selector.item).children(selector.menu)
  167. ;
  168. if( $currentMenu.size() > 0 ) {
  169. clearTimeout(module.itemTimer);
  170. module.itemTimer = setTimeout(function() {
  171. module.animate.hide(false, $otherMenus);
  172. module.verbose('Showing sub-menu', $currentMenu);
  173. module.animate.show(false, $currentMenu);
  174. }, settings.delay.show * 2);
  175. event.preventDefault();
  176. }
  177. },
  178. mouseleave: function(event) {
  179. var
  180. $currentMenu = $(this).find(selector.menu)
  181. ;
  182. if($currentMenu.size() > 0) {
  183. clearTimeout(module.itemTimer);
  184. module.itemTimer = setTimeout(function() {
  185. module.verbose('Hiding sub-menu', $currentMenu);
  186. module.animate.hide(false, $currentMenu);
  187. }, settings.delay.hide);
  188. }
  189. },
  190. click: function (event) {
  191. var
  192. $choice = $(this),
  193. text = ( $choice.data(metadata.text) !== undefined )
  194. ? $choice.data(metadata.text)
  195. : $choice.text(),
  196. value = ( $choice.data(metadata.value) !== undefined)
  197. ? $choice.data(metadata.value)
  198. : text.toLowerCase(),
  199. callback = function() {
  200. module.determine.selectAction(text, value);
  201. $.proxy(settings.onChange, element)(value, text);
  202. }
  203. ;
  204. if( $choice.find(selector.menu).size() === 0 ) {
  205. if(event.type == 'touchstart') {
  206. $choice.one('click', callback);
  207. }
  208. else {
  209. callback();
  210. }
  211. }
  212. }
  213. },
  214. resetStyle: function() {
  215. $(this).removeAttr('style');
  216. }
  217. },
  218. determine: {
  219. selectAction: function(text, value) {
  220. module.verbose('Determining action', settings.action);
  221. if( $.isFunction( module.action[settings.action] ) ) {
  222. module.verbose('Triggering preset action', settings.action, text, value);
  223. module.action[ settings.action ](text, value);
  224. }
  225. else if( $.isFunction(settings.action) ) {
  226. module.verbose('Triggering user action', settings.action, text, value);
  227. settings.action(text, value);
  228. }
  229. else {
  230. module.error(error.action, settings.action);
  231. }
  232. },
  233. intent: function(event, callback) {
  234. module.debug('Determining whether event occurred in dropdown', event.target);
  235. callback = callback || function(){};
  236. if( $(event.target).closest($menu).size() === 0 ) {
  237. module.verbose('Triggering event', callback);
  238. callback();
  239. return true;
  240. }
  241. else {
  242. module.verbose('Event occurred in dropdown, canceling callback');
  243. return false;
  244. }
  245. }
  246. },
  247. action: {
  248. nothing: function() {},
  249. hide: function() {
  250. module.hide();
  251. },
  252. activate: function(text, value) {
  253. value = (value !== undefined)
  254. ? value
  255. : text
  256. ;
  257. module.set.selected(value);
  258. module.set.value(value);
  259. module.hide();
  260. },
  261. combo: function(text, value) {
  262. value = (value !== undefined)
  263. ? value
  264. : text
  265. ;
  266. module.set.selected(value);
  267. module.set.value(value);
  268. module.hide();
  269. },
  270. /* Deprecated */
  271. auto: function(text, value) {
  272. value = (value !== undefined)
  273. ? value
  274. : text
  275. ;
  276. module.set.selected(value);
  277. module.set.value(value);
  278. module.hide();
  279. },
  280. /* Deprecated */
  281. changeText: function(text, value) {
  282. value = (value !== undefined)
  283. ? value
  284. : text
  285. ;
  286. module.set.selected(value);
  287. module.hide();
  288. },
  289. /* Deprecated */
  290. updateForm: function(text, value) {
  291. value = (value !== undefined)
  292. ? value
  293. : text
  294. ;
  295. module.set.selected(value);
  296. module.set.value(value);
  297. module.hide();
  298. }
  299. },
  300. get: {
  301. text: function() {
  302. return $text.text();
  303. },
  304. value: function() {
  305. return ($input.size() > 0)
  306. ? $input.val()
  307. : $module.data(metadata.value)
  308. ;
  309. },
  310. item: function(value) {
  311. var
  312. $selectedItem = false
  313. ;
  314. value = (value !== undefined)
  315. ? value
  316. : ( module.get.value() !== undefined)
  317. ? module.get.value()
  318. : module.get.text()
  319. ;
  320. if(value !== undefined) {
  321. $item
  322. .each(function() {
  323. var
  324. $choice = $(this),
  325. optionText = ( $choice.data(metadata.text) !== undefined )
  326. ? $choice.data(metadata.text)
  327. : $choice.text(),
  328. optionValue = ( $choice.data(metadata.value) !== undefined )
  329. ? $choice.data(metadata.value)
  330. : optionText.toLowerCase()
  331. ;
  332. if( optionValue == value ) {
  333. $selectedItem = $(this);
  334. }
  335. else if( !$selectedItem && optionText == value ) {
  336. $selectedItem = $(this);
  337. }
  338. })
  339. ;
  340. }
  341. else {
  342. value = module.get.text();
  343. }
  344. return $selectedItem || false;
  345. }
  346. },
  347. restore: {
  348. defaults: function() {
  349. module.restore.defaultText();
  350. module.restore.defaultValue();
  351. },
  352. defaultText: function() {
  353. var
  354. defaultText = $module.data(metadata.defaultText)
  355. ;
  356. module.debug('Restoring default text', defaultText);
  357. module.set.text(defaultText);
  358. },
  359. defaultValue: function() {
  360. var
  361. defaultValue = $module.data(metadata.defaultValue)
  362. ;
  363. if(defaultValue !== undefined) {
  364. module.debug('Restoring default value', defaultValue);
  365. module.set.selected(defaultValue);
  366. module.set.value(defaultValue);
  367. }
  368. }
  369. },
  370. save: {
  371. defaults: function() {
  372. module.save.defaultText();
  373. module.save.defaultValue();
  374. },
  375. defaultValue: function() {
  376. $module.data(metadata.defaultValue, module.get.value() );
  377. },
  378. defaultText: function() {
  379. $module.data(metadata.defaultText, $text.text() );
  380. }
  381. },
  382. set: {
  383. text: function(text) {
  384. if(settings.action == 'combo') {
  385. module.debug('Changing combo button text', text, $combo);
  386. $combo
  387. .text(text)
  388. ;
  389. }
  390. else {
  391. module.debug('Changing text', text, $text);
  392. $text.removeClass(className.placeholder);
  393. $text.text(text);
  394. }
  395. },
  396. value: function(value) {
  397. module.debug('Adding selected value to hidden input', value, $input);
  398. if($input.size() > 0) {
  399. $input.val(value);
  400. }
  401. else {
  402. $module.data(metadata.value, value);
  403. }
  404. },
  405. active: function() {
  406. $module.addClass(className.active);
  407. },
  408. visible: function() {
  409. $module.addClass(className.visible);
  410. },
  411. selected: function(value) {
  412. var
  413. $selectedItem = module.get.item(value),
  414. selectedText
  415. ;
  416. if($selectedItem) {
  417. module.debug('Setting selected menu item to', $selectedItem);
  418. selectedText = ($selectedItem.data(metadata.text) !== undefined)
  419. ? $selectedItem.data(metadata.text)
  420. : $selectedItem.text()
  421. ;
  422. $item
  423. .removeClass(className.active)
  424. ;
  425. $selectedItem
  426. .addClass(className.active)
  427. ;
  428. module.set.text(selectedText);
  429. }
  430. }
  431. },
  432. remove: {
  433. active: function() {
  434. $module.removeClass(className.active);
  435. },
  436. visible: function() {
  437. $module.removeClass(className.visible);
  438. }
  439. },
  440. is: {
  441. selection: function() {
  442. return $module.hasClass(className.selection);
  443. },
  444. animated: function($subMenu) {
  445. return ($subMenu)
  446. ? $subMenu.is(':animated') || $subMenu.transition('is animating')
  447. : $menu.is(':animated') || $menu.transition('is animating')
  448. ;
  449. },
  450. visible: function($subMenu) {
  451. return ($subMenu)
  452. ? $subMenu.is(':visible')
  453. : $menu.is(':visible')
  454. ;
  455. },
  456. hidden: function($subMenu) {
  457. return ($subMenu)
  458. ? $subMenu.is(':not(:visible)')
  459. : $menu.is(':not(:visible)')
  460. ;
  461. }
  462. },
  463. can: {
  464. click: function() {
  465. return (hasTouch || settings.on == 'click');
  466. },
  467. show: function() {
  468. return !$module.hasClass(className.disabled);
  469. }
  470. },
  471. animate: {
  472. show: function(callback, $subMenu) {
  473. var
  474. $currentMenu = $subMenu || $menu
  475. ;
  476. callback = callback || function(){};
  477. if( module.is.hidden($currentMenu) ) {
  478. module.verbose('Doing menu show animation', $currentMenu);
  479. if(settings.transition == 'none') {
  480. callback();
  481. }
  482. else if($.fn.transition !== undefined && $module.transition('is supported')) {
  483. $currentMenu
  484. .transition({
  485. animation : settings.transition + ' in',
  486. duration : settings.duration,
  487. complete : callback,
  488. queue : false
  489. })
  490. ;
  491. }
  492. else if(settings.transition == 'slide down') {
  493. $currentMenu
  494. .hide()
  495. .clearQueue()
  496. .children()
  497. .clearQueue()
  498. .css('opacity', 0)
  499. .delay(50)
  500. .animate({
  501. opacity : 1
  502. }, settings.duration, 'easeOutQuad', module.event.resetStyle)
  503. .end()
  504. .slideDown(100, 'easeOutQuad', function() {
  505. $.proxy(module.event.resetStyle, this)();
  506. callback();
  507. })
  508. ;
  509. }
  510. else if(settings.transition == 'fade') {
  511. $currentMenu
  512. .hide()
  513. .clearQueue()
  514. .fadeIn(settings.duration, function() {
  515. $.proxy(module.event.resetStyle, this)();
  516. callback();
  517. })
  518. ;
  519. }
  520. else {
  521. module.error(error.transition, settings.transition);
  522. }
  523. }
  524. },
  525. hide: function(callback, $subMenu) {
  526. var
  527. $currentMenu = $subMenu || $menu
  528. ;
  529. callback = callback || function(){};
  530. if(module.is.visible($currentMenu) ) {
  531. module.verbose('Doing menu hide animation', $currentMenu);
  532. if($.fn.transition !== undefined && $module.transition('is supported')) {
  533. $currentMenu
  534. .transition({
  535. animation : settings.transition + ' out',
  536. duration : settings.duration,
  537. complete : callback,
  538. queue : false
  539. })
  540. ;
  541. }
  542. else if(settings.transition == 'none') {
  543. callback();
  544. }
  545. else if(settings.transition == 'slide down') {
  546. $currentMenu
  547. .show()
  548. .clearQueue()
  549. .children()
  550. .clearQueue()
  551. .css('opacity', 1)
  552. .animate({
  553. opacity : 0
  554. }, 100, 'easeOutQuad', module.event.resetStyle)
  555. .end()
  556. .delay(50)
  557. .slideUp(100, 'easeOutQuad', function() {
  558. $.proxy(module.event.resetStyle, this)();
  559. callback();
  560. })
  561. ;
  562. }
  563. else if(settings.transition == 'fade') {
  564. $currentMenu
  565. .show()
  566. .clearQueue()
  567. .fadeOut(150, function() {
  568. $.proxy(module.event.resetStyle, this)();
  569. callback();
  570. })
  571. ;
  572. }
  573. else {
  574. module.error(error.transition);
  575. }
  576. }
  577. }
  578. },
  579. show: function() {
  580. module.debug('Checking if dropdown can show');
  581. if( module.is.hidden() ) {
  582. module.hideOthers();
  583. module.set.active();
  584. module.animate.show(function() {
  585. if( module.can.click() ) {
  586. module.bind.intent();
  587. }
  588. module.set.visible();
  589. });
  590. $.proxy(settings.onShow, element)();
  591. }
  592. },
  593. hide: function() {
  594. if( !module.is.animated() && module.is.visible() ) {
  595. module.debug('Hiding dropdown');
  596. if( module.can.click() ) {
  597. module.unbind.intent();
  598. }
  599. module.remove.active();
  600. module.animate.hide(module.remove.visible);
  601. $.proxy(settings.onHide, element)();
  602. }
  603. },
  604. delay: {
  605. show: function() {
  606. module.verbose('Delaying show event to ensure user intent');
  607. clearTimeout(module.timer);
  608. module.timer = setTimeout(module.show, settings.delay.show);
  609. },
  610. hide: function() {
  611. module.verbose('Delaying hide event to ensure user intent');
  612. clearTimeout(module.timer);
  613. module.timer = setTimeout(module.hide, settings.delay.hide);
  614. }
  615. },
  616. hideOthers: function() {
  617. module.verbose('Finding other dropdowns to hide');
  618. $allModules
  619. .not($module)
  620. .has(selector.menu + ':visible')
  621. .dropdown('hide')
  622. ;
  623. },
  624. toggle: function() {
  625. module.verbose('Toggling menu visibility');
  626. if( module.is.hidden() ) {
  627. module.show();
  628. }
  629. else {
  630. module.hide();
  631. }
  632. },
  633. setting: function(name, value) {
  634. if( $.isPlainObject(name) ) {
  635. $.extend(true, settings, name);
  636. }
  637. else if(value !== undefined) {
  638. settings[name] = value;
  639. }
  640. else {
  641. return settings[name];
  642. }
  643. },
  644. internal: function(name, value) {
  645. if( $.isPlainObject(name) ) {
  646. $.extend(true, module, name);
  647. }
  648. else if(value !== undefined) {
  649. module[name] = value;
  650. }
  651. else {
  652. return module[name];
  653. }
  654. },
  655. debug: function() {
  656. if(settings.debug) {
  657. if(settings.performance) {
  658. module.performance.log(arguments);
  659. }
  660. else {
  661. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  662. module.debug.apply(console, arguments);
  663. }
  664. }
  665. },
  666. verbose: function() {
  667. if(settings.verbose && settings.debug) {
  668. if(settings.performance) {
  669. module.performance.log(arguments);
  670. }
  671. else {
  672. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  673. module.verbose.apply(console, arguments);
  674. }
  675. }
  676. },
  677. error: function() {
  678. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  679. module.error.apply(console, arguments);
  680. },
  681. performance: {
  682. log: function(message) {
  683. var
  684. currentTime,
  685. executionTime,
  686. previousTime
  687. ;
  688. if(settings.performance) {
  689. currentTime = new Date().getTime();
  690. previousTime = time || currentTime;
  691. executionTime = currentTime - previousTime;
  692. time = currentTime;
  693. performance.push({
  694. 'Element' : element,
  695. 'Name' : message[0],
  696. 'Arguments' : [].slice.call(message, 1) || '',
  697. 'Execution Time' : executionTime
  698. });
  699. }
  700. clearTimeout(module.performance.timer);
  701. module.performance.timer = setTimeout(module.performance.display, 100);
  702. },
  703. display: function() {
  704. var
  705. title = settings.name + ':',
  706. totalTime = 0
  707. ;
  708. time = false;
  709. clearTimeout(module.performance.timer);
  710. $.each(performance, function(index, data) {
  711. totalTime += data['Execution Time'];
  712. });
  713. title += ' ' + totalTime + 'ms';
  714. if(moduleSelector) {
  715. title += ' \'' + moduleSelector + '\'';
  716. }
  717. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  718. console.groupCollapsed(title);
  719. if(console.table) {
  720. console.table(performance);
  721. }
  722. else {
  723. $.each(performance, function(index, data) {
  724. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  725. });
  726. }
  727. console.groupEnd();
  728. }
  729. performance = [];
  730. }
  731. },
  732. invoke: function(query, passedArguments, context) {
  733. var
  734. object = instance,
  735. maxDepth,
  736. found,
  737. response
  738. ;
  739. passedArguments = passedArguments || queryArguments;
  740. context = element || context;
  741. if(typeof query == 'string' && object !== undefined) {
  742. query = query.split(/[\. ]/);
  743. maxDepth = query.length - 1;
  744. $.each(query, function(depth, value) {
  745. var camelCaseValue = (depth != maxDepth)
  746. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  747. : query
  748. ;
  749. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  750. object = object[camelCaseValue];
  751. }
  752. else if( object[camelCaseValue] !== undefined ) {
  753. found = object[camelCaseValue];
  754. return false;
  755. }
  756. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  757. object = object[value];
  758. }
  759. else if( object[value] !== undefined ) {
  760. found = object[value];
  761. return false;
  762. }
  763. else {
  764. module.error(error.method, query);
  765. return false;
  766. }
  767. });
  768. }
  769. if ( $.isFunction( found ) ) {
  770. response = found.apply(context, passedArguments);
  771. }
  772. else if(found !== undefined) {
  773. response = found;
  774. }
  775. if($.isArray(returnedValue)) {
  776. returnedValue.push(response);
  777. }
  778. else if(returnedValue !== undefined) {
  779. returnedValue = [returnedValue, response];
  780. }
  781. else if(response !== undefined) {
  782. returnedValue = response;
  783. }
  784. return found;
  785. }
  786. };
  787. if(methodInvoked) {
  788. if(instance === undefined) {
  789. module.initialize();
  790. }
  791. module.invoke(query);
  792. }
  793. else {
  794. if(instance !== undefined) {
  795. module.destroy();
  796. }
  797. module.initialize();
  798. }
  799. })
  800. ;
  801. return (returnedValue)
  802. ? returnedValue
  803. : this
  804. ;
  805. };
  806. $.fn.dropdown.settings = {
  807. name : 'Dropdown',
  808. namespace : 'dropdown',
  809. verbose : true,
  810. debug : true,
  811. performance : true,
  812. on : 'click',
  813. action : 'activate',
  814. delay: {
  815. show : 200,
  816. hide : 300,
  817. touch : 50
  818. },
  819. transition : 'slide down',
  820. duration : 250,
  821. onChange : function(value, text){},
  822. onShow : function(){},
  823. onHide : function(){},
  824. error : {
  825. action : 'You called a dropdown action that was not defined',
  826. method : 'The method you called is not defined.',
  827. transition : 'The requested transition was not found'
  828. },
  829. metadata: {
  830. defaultText : 'defaultText',
  831. defaultValue : 'defaultValue',
  832. text : 'text',
  833. value : 'value'
  834. },
  835. selector : {
  836. menu : '.menu',
  837. item : '.menu > .item',
  838. text : '> .text',
  839. input : '> input[type="hidden"]'
  840. },
  841. className : {
  842. active : 'active',
  843. placeholder : 'default',
  844. disabled : 'disabled',
  845. visible : 'visible',
  846. selection : 'selection'
  847. }
  848. };
  849. // Adds easing
  850. $.extend( $.easing, {
  851. easeOutQuad: function (x, t, b, c, d) {
  852. return -c *(t/=d)*(t-2) + b;
  853. },
  854. });
  855. })( jQuery, window , document );