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.

933 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
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. select: 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. activate: 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. combo: function(text, value) {
  271. value = (value !== undefined)
  272. ? value
  273. : text
  274. ;
  275. module.set.selected(value);
  276. module.set.value(value);
  277. module.hide();
  278. },
  279. /* Deprecated */
  280. auto: function(text, value) {
  281. value = (value !== undefined)
  282. ? value
  283. : text
  284. ;
  285. module.set.selected(value);
  286. module.set.value(value);
  287. module.hide();
  288. },
  289. /* Deprecated */
  290. changeText: function(text, value) {
  291. value = (value !== undefined)
  292. ? value
  293. : text
  294. ;
  295. module.set.selected(value);
  296. module.hide();
  297. },
  298. /* Deprecated */
  299. updateForm: function(text, value) {
  300. value = (value !== undefined)
  301. ? value
  302. : text
  303. ;
  304. module.set.selected(value);
  305. module.set.value(value);
  306. module.hide();
  307. }
  308. },
  309. get: {
  310. text: function() {
  311. return $text.text();
  312. },
  313. value: function() {
  314. return ($input.size() > 0)
  315. ? $input.val()
  316. : $module.data(metadata.value)
  317. ;
  318. },
  319. item: function(value) {
  320. var
  321. $selectedItem = false
  322. ;
  323. value = (value !== undefined)
  324. ? value
  325. : ( module.get.value() !== undefined)
  326. ? module.get.value()
  327. : module.get.text()
  328. ;
  329. if(value !== undefined) {
  330. $item
  331. .each(function() {
  332. var
  333. $choice = $(this),
  334. optionText = ( $choice.data(metadata.text) !== undefined )
  335. ? $choice.data(metadata.text)
  336. : $choice.text(),
  337. optionValue = ( $choice.data(metadata.value) !== undefined )
  338. ? $choice.data(metadata.value)
  339. : optionText.toLowerCase()
  340. ;
  341. if( optionValue == value ) {
  342. $selectedItem = $(this);
  343. }
  344. else if( !$selectedItem && optionText == value ) {
  345. $selectedItem = $(this);
  346. }
  347. })
  348. ;
  349. }
  350. else {
  351. value = module.get.text();
  352. }
  353. return $selectedItem || false;
  354. }
  355. },
  356. restore: {
  357. defaults: function() {
  358. module.restore.defaultText();
  359. module.restore.defaultValue();
  360. },
  361. defaultText: function() {
  362. var
  363. defaultText = $module.data(metadata.defaultText)
  364. ;
  365. module.debug('Restoring default text', defaultText);
  366. module.set.text(defaultText);
  367. },
  368. defaultValue: function() {
  369. var
  370. defaultValue = $module.data(metadata.defaultValue)
  371. ;
  372. if(defaultValue !== undefined) {
  373. module.debug('Restoring default value', defaultValue);
  374. module.set.selected(defaultValue);
  375. module.set.value(defaultValue);
  376. }
  377. }
  378. },
  379. save: {
  380. defaults: function() {
  381. module.save.defaultText();
  382. module.save.defaultValue();
  383. },
  384. defaultValue: function() {
  385. $module.data(metadata.defaultValue, module.get.value() );
  386. },
  387. defaultText: function() {
  388. $module.data(metadata.defaultText, $text.text() );
  389. }
  390. },
  391. set: {
  392. text: function(text) {
  393. if(settings.action == 'combo') {
  394. module.debug('Changing combo button text', text, $combo);
  395. $combo
  396. .text(text)
  397. ;
  398. }
  399. else if(settings.action !== 'select') {
  400. module.debug('Changing text', text, $text);
  401. $text.removeClass(className.placeholder);
  402. $text.text(text);
  403. }
  404. },
  405. value: function(value) {
  406. module.debug('Adding selected value to hidden input', value, $input);
  407. if($input.size() > 0) {
  408. $input.val(value);
  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)
  811. ? returnedValue
  812. : this
  813. ;
  814. };
  815. $.fn.dropdown.settings = {
  816. name : 'Dropdown',
  817. namespace : 'dropdown',
  818. verbose : true,
  819. debug : 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. item : '.menu > .item',
  847. text : '> .text',
  848. input : '> input[type="hidden"]'
  849. },
  850. className : {
  851. active : 'active',
  852. placeholder : 'default',
  853. disabled : 'disabled',
  854. visible : 'visible',
  855. selection : 'selection'
  856. }
  857. };
  858. // Adds easing
  859. $.extend( $.easing, {
  860. easeOutQuad: function (x, t, b, c, d) {
  861. return -c *(t/=d)*(t-2) + b;
  862. },
  863. });
  864. })( jQuery, window , document );