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.

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