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.

832 lines
26 KiB

9 years ago
8 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
  1. /*!
  2. * # Semantic UI 2.2.0 - Checkbox
  3. * http://github.com/semantic-org/semantic-ui/
  4. *
  5. *
  6. * Copyright 2015 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ($, window, document, undefined) {
  12. "use strict";
  13. window = (typeof window != 'undefined' && window.Math == Math)
  14. ? window
  15. : (typeof self != 'undefined' && self.Math == Math)
  16. ? self
  17. : Function('return this')()
  18. ;
  19. $.fn.checkbox = function(parameters) {
  20. var
  21. $allModules = $(this),
  22. moduleSelector = $allModules.selector || '',
  23. time = new Date().getTime(),
  24. performance = [],
  25. query = arguments[0],
  26. methodInvoked = (typeof query == 'string'),
  27. queryArguments = [].slice.call(arguments, 1),
  28. returnedValue
  29. ;
  30. $allModules
  31. .each(function() {
  32. var
  33. settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
  34. className = settings.className,
  35. namespace = settings.namespace,
  36. selector = settings.selector,
  37. error = settings.error,
  38. eventNamespace = '.' + namespace,
  39. moduleNamespace = 'module-' + namespace,
  40. $module = $(this),
  41. $label = $(this).children(selector.label),
  42. $input = $(this).children(selector.input),
  43. input = $input[0],
  44. initialLoad = false,
  45. shortcutPressed = false,
  46. instance = $module.data(moduleNamespace),
  47. observer,
  48. element = this,
  49. module
  50. ;
  51. module = {
  52. initialize: function() {
  53. module.verbose('Initializing checkbox', settings);
  54. module.create.label();
  55. module.bind.events();
  56. module.set.tabbable();
  57. module.hide.input();
  58. module.observeChanges();
  59. module.instantiate();
  60. module.setup();
  61. },
  62. instantiate: function() {
  63. module.verbose('Storing instance of module', module);
  64. instance = module;
  65. $module
  66. .data(moduleNamespace, module)
  67. ;
  68. },
  69. destroy: function() {
  70. module.verbose('Destroying module');
  71. module.unbind.events();
  72. module.show.input();
  73. $module.removeData(moduleNamespace);
  74. },
  75. fix: {
  76. reference: function() {
  77. if( $module.is(selector.input) ) {
  78. module.debug('Behavior called on <input> adjusting invoked element');
  79. $module = $module.closest(selector.checkbox);
  80. module.refresh();
  81. }
  82. }
  83. },
  84. setup: function() {
  85. module.set.initialLoad();
  86. if( module.is.indeterminate() ) {
  87. module.debug('Initial value is indeterminate');
  88. module.indeterminate();
  89. }
  90. else if( module.is.checked() ) {
  91. module.debug('Initial value is checked');
  92. module.check();
  93. }
  94. else {
  95. module.debug('Initial value is unchecked');
  96. module.uncheck();
  97. }
  98. module.remove.initialLoad();
  99. },
  100. refresh: function() {
  101. $label = $module.children(selector.label);
  102. $input = $module.children(selector.input);
  103. input = $input[0];
  104. },
  105. hide: {
  106. input: function() {
  107. module.verbose('Modifying <input> z-index to be unselectable');
  108. $input.addClass(className.hidden);
  109. }
  110. },
  111. show: {
  112. input: function() {
  113. module.verbose('Modifying <input> z-index to be selectable');
  114. $input.removeClass(className.hidden);
  115. }
  116. },
  117. observeChanges: function() {
  118. if('MutationObserver' in window) {
  119. observer = new MutationObserver(function(mutations) {
  120. module.debug('DOM tree modified, updating selector cache');
  121. module.refresh();
  122. });
  123. observer.observe(element, {
  124. childList : true,
  125. subtree : true
  126. });
  127. module.debug('Setting up mutation observer', observer);
  128. }
  129. },
  130. attachEvents: function(selector, event) {
  131. var
  132. $element = $(selector)
  133. ;
  134. event = $.isFunction(module[event])
  135. ? module[event]
  136. : module.toggle
  137. ;
  138. if($element.length > 0) {
  139. module.debug('Attaching checkbox events to element', selector, event);
  140. $element
  141. .on('click' + eventNamespace, event)
  142. ;
  143. }
  144. else {
  145. module.error(error.notFound);
  146. }
  147. },
  148. event: {
  149. click: function(event) {
  150. var
  151. $target = $(event.target)
  152. ;
  153. if( $target.is(selector.input) ) {
  154. module.verbose('Using default check action on initialized checkbox');
  155. return;
  156. }
  157. if( $target.is(selector.link) ) {
  158. module.debug('Clicking link inside checkbox, skipping toggle');
  159. return;
  160. }
  161. module.toggle();
  162. $input.focus();
  163. event.preventDefault();
  164. },
  165. keydown: function(event) {
  166. var
  167. key = event.which,
  168. keyCode = {
  169. enter : 13,
  170. space : 32,
  171. escape : 27
  172. }
  173. ;
  174. if(key == keyCode.escape) {
  175. module.verbose('Escape key pressed blurring field');
  176. $input.blur();
  177. shortcutPressed = true;
  178. }
  179. else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) {
  180. module.verbose('Enter/space key pressed, toggling checkbox');
  181. module.toggle();
  182. shortcutPressed = true;
  183. }
  184. else {
  185. shortcutPressed = false;
  186. }
  187. },
  188. keyup: function(event) {
  189. if(shortcutPressed) {
  190. event.preventDefault();
  191. }
  192. }
  193. },
  194. check: function() {
  195. if( !module.should.allowCheck() ) {
  196. return;
  197. }
  198. module.debug('Checking checkbox', $input);
  199. module.set.checked();
  200. if( !module.should.ignoreCallbacks() ) {
  201. settings.onChecked.call(input);
  202. settings.onChange.call(input);
  203. }
  204. },
  205. uncheck: function() {
  206. if( !module.should.allowUncheck() ) {
  207. return;
  208. }
  209. module.debug('Unchecking checkbox');
  210. module.set.unchecked();
  211. if( !module.should.ignoreCallbacks() ) {
  212. settings.onUnchecked.call(input);
  213. settings.onChange.call(input);
  214. }
  215. },
  216. indeterminate: function() {
  217. if( module.should.allowIndeterminate() ) {
  218. module.debug('Checkbox is already indeterminate');
  219. return;
  220. }
  221. module.debug('Making checkbox indeterminate');
  222. module.set.indeterminate();
  223. if( !module.should.ignoreCallbacks() ) {
  224. settings.onIndeterminate.call(input);
  225. settings.onChange.call(input);
  226. }
  227. },
  228. determinate: function() {
  229. if( module.should.allowDeterminate() ) {
  230. module.debug('Checkbox is already determinate');
  231. return;
  232. }
  233. module.debug('Making checkbox determinate');
  234. module.set.determinate();
  235. if( !module.should.ignoreCallbacks() ) {
  236. settings.onDeterminate.call(input);
  237. settings.onChange.call(input);
  238. }
  239. },
  240. enable: function() {
  241. if( module.is.enabled() ) {
  242. module.debug('Checkbox is already enabled');
  243. return;
  244. }
  245. module.debug('Enabling checkbox');
  246. module.set.enabled();
  247. settings.onEnable.call(input);
  248. // preserve legacy callbacks
  249. settings.onEnabled.call(input);
  250. },
  251. disable: function() {
  252. if( module.is.disabled() ) {
  253. module.debug('Checkbox is already disabled');
  254. return;
  255. }
  256. module.debug('Disabling checkbox');
  257. module.set.disabled();
  258. settings.onDisable.call(input);
  259. // preserve legacy callbacks
  260. settings.onDisabled.call(input);
  261. },
  262. get: {
  263. radios: function() {
  264. var
  265. name = module.get.name()
  266. ;
  267. return $('input[name="' + name + '"]').closest(selector.checkbox);
  268. },
  269. otherRadios: function() {
  270. return module.get.radios().not($module);
  271. },
  272. name: function() {
  273. return $input.attr('name');
  274. }
  275. },
  276. is: {
  277. initialLoad: function() {
  278. return initialLoad;
  279. },
  280. radio: function() {
  281. return ($input.hasClass(className.radio) || $input.attr('type') == 'radio');
  282. },
  283. indeterminate: function() {
  284. return $input.prop('indeterminate') !== undefined && $input.prop('indeterminate');
  285. },
  286. checked: function() {
  287. return $input.prop('checked') !== undefined && $input.prop('checked');
  288. },
  289. disabled: function() {
  290. return $input.prop('disabled') !== undefined && $input.prop('disabled');
  291. },
  292. enabled: function() {
  293. return !module.is.disabled();
  294. },
  295. determinate: function() {
  296. return !module.is.indeterminate();
  297. },
  298. unchecked: function() {
  299. return !module.is.checked();
  300. }
  301. },
  302. should: {
  303. allowCheck: function() {
  304. if(module.is.determinate() && module.is.checked() && !module.should.forceCallbacks() ) {
  305. module.debug('Should not allow check, checkbox is already checked');
  306. return false;
  307. }
  308. if(settings.beforeChecked.apply(input) === false) {
  309. module.debug('Should not allow check, beforeChecked cancelled');
  310. return false;
  311. }
  312. return true;
  313. },
  314. allowUncheck: function() {
  315. if(module.is.determinate() && module.is.unchecked() && !module.should.forceCallbacks() ) {
  316. module.debug('Should not allow uncheck, checkbox is already unchecked');
  317. return false;
  318. }
  319. if(settings.beforeUnchecked.apply(input) === false) {
  320. module.debug('Should not allow uncheck, beforeUnchecked cancelled');
  321. return false;
  322. }
  323. return true;
  324. },
  325. allowIndeterminate: function() {
  326. if(module.is.indeterminate() && !module.should.forceCallbacks() ) {
  327. module.debug('Should not allow indeterminate, checkbox is already indeterminate');
  328. return false;
  329. }
  330. if(settings.beforeIndeterminate.apply(input) === false) {
  331. module.debug('Should not allow indeterminate, beforeIndeterminate cancelled');
  332. return false;
  333. }
  334. return true;
  335. },
  336. allowDeterminate: function() {
  337. if(module.is.determinate() && !module.should.forceCallbacks() ) {
  338. module.debug('Should not allow determinate, checkbox is already determinate');
  339. return false;
  340. }
  341. if(settings.beforeDeterminate.apply(input) === false) {
  342. module.debug('Should not allow determinate, beforeDeterminate cancelled');
  343. return false;
  344. }
  345. return true;
  346. },
  347. forceCallbacks: function() {
  348. return (module.is.initialLoad() && settings.fireOnInit);
  349. },
  350. ignoreCallbacks: function() {
  351. return (initialLoad && !settings.fireOnInit);
  352. }
  353. },
  354. can: {
  355. change: function() {
  356. return !( $module.hasClass(className.disabled) || $module.hasClass(className.readOnly) || $input.prop('disabled') || $input.prop('readonly') );
  357. },
  358. uncheck: function() {
  359. return (typeof settings.uncheckable === 'boolean')
  360. ? settings.uncheckable
  361. : !module.is.radio()
  362. ;
  363. }
  364. },
  365. set: {
  366. initialLoad: function() {
  367. initialLoad = true;
  368. },
  369. checked: function() {
  370. module.verbose('Setting class to checked');
  371. $module
  372. .removeClass(className.indeterminate)
  373. .addClass(className.checked)
  374. ;
  375. if( module.is.radio() ) {
  376. module.uncheckOthers();
  377. }
  378. if(!module.is.indeterminate() && module.is.checked()) {
  379. module.debug('Input is already checked, skipping input property change');
  380. return;
  381. }
  382. module.verbose('Setting state to checked', input);
  383. $input
  384. .prop('indeterminate', false)
  385. .prop('checked', true)
  386. ;
  387. module.trigger.change();
  388. },
  389. unchecked: function() {
  390. module.verbose('Removing checked class');
  391. $module
  392. .removeClass(className.indeterminate)
  393. .removeClass(className.checked)
  394. ;
  395. if(!module.is.indeterminate() && module.is.unchecked() ) {
  396. module.debug('Input is already unchecked');
  397. return;
  398. }
  399. module.debug('Setting state to unchecked');
  400. $input
  401. .prop('indeterminate', false)
  402. .prop('checked', false)
  403. ;
  404. module.trigger.change();
  405. },
  406. indeterminate: function() {
  407. module.verbose('Setting class to indeterminate');
  408. $module
  409. .addClass(className.indeterminate)
  410. ;
  411. if( module.is.indeterminate() ) {
  412. module.debug('Input is already indeterminate, skipping input property change');
  413. return;
  414. }
  415. module.debug('Setting state to indeterminate');
  416. $input
  417. .prop('indeterminate', true)
  418. ;
  419. module.trigger.change();
  420. },
  421. determinate: function() {
  422. module.verbose('Removing indeterminate class');
  423. $module
  424. .removeClass(className.indeterminate)
  425. ;
  426. if( module.is.determinate() ) {
  427. module.debug('Input is already determinate, skipping input property change');
  428. return;
  429. }
  430. module.debug('Setting state to determinate');
  431. $input
  432. .prop('indeterminate', false)
  433. ;
  434. },
  435. disabled: function() {
  436. module.verbose('Setting class to disabled');
  437. $module
  438. .addClass(className.disabled)
  439. ;
  440. if( module.is.disabled() ) {
  441. module.debug('Input is already disabled, skipping input property change');
  442. return;
  443. }
  444. module.debug('Setting state to disabled');
  445. $input
  446. .prop('disabled', 'disabled')
  447. ;
  448. module.trigger.change();
  449. },
  450. enabled: function() {
  451. module.verbose('Removing disabled class');
  452. $module.removeClass(className.disabled);
  453. if( module.is.enabled() ) {
  454. module.debug('Input is already enabled, skipping input property change');
  455. return;
  456. }
  457. module.debug('Setting state to enabled');
  458. $input
  459. .prop('disabled', false)
  460. ;
  461. module.trigger.change();
  462. },
  463. tabbable: function() {
  464. module.verbose('Adding tabindex to checkbox');
  465. if( $input.attr('tabindex') === undefined) {
  466. $input.attr('tabindex', 0);
  467. }
  468. }
  469. },
  470. remove: {
  471. initialLoad: function() {
  472. initialLoad = false;
  473. }
  474. },
  475. trigger: {
  476. change: function() {
  477. var
  478. events = document.createEvent('HTMLEvents'),
  479. inputElement = $input[0]
  480. ;
  481. if(inputElement) {
  482. module.verbose('Triggering native change event');
  483. events.initEvent('change', true, false);
  484. inputElement.dispatchEvent(events);
  485. }
  486. }
  487. },
  488. create: {
  489. label: function() {
  490. if($input.prevAll(selector.label).length > 0) {
  491. $input.prev(selector.label).detach().insertAfter($input);
  492. module.debug('Moving existing label', $label);
  493. }
  494. else if( !module.has.label() ) {
  495. $label = $('<label>').insertAfter($input);
  496. module.debug('Creating label', $label);
  497. }
  498. }
  499. },
  500. has: {
  501. label: function() {
  502. return ($label.length > 0);
  503. }
  504. },
  505. bind: {
  506. events: function() {
  507. module.verbose('Attaching checkbox events');
  508. $module
  509. .on('click' + eventNamespace, module.event.click)
  510. .on('keydown' + eventNamespace, selector.input, module.event.keydown)
  511. .on('keyup' + eventNamespace, selector.input, module.event.keyup)
  512. ;
  513. }
  514. },
  515. unbind: {
  516. events: function() {
  517. module.debug('Removing events');
  518. $module
  519. .off(eventNamespace)
  520. ;
  521. }
  522. },
  523. uncheckOthers: function() {
  524. var
  525. $radios = module.get.otherRadios()
  526. ;
  527. module.debug('Unchecking other radios', $radios);
  528. $radios.removeClass(className.checked);
  529. },
  530. toggle: function() {
  531. if( !module.can.change() ) {
  532. if(!module.is.radio()) {
  533. module.debug('Checkbox is read-only or disabled, ignoring toggle');
  534. }
  535. return;
  536. }
  537. if( module.is.indeterminate() || module.is.unchecked() ) {
  538. module.debug('Currently unchecked');
  539. module.check();
  540. }
  541. else if( module.is.checked() && module.can.uncheck() ) {
  542. module.debug('Currently checked');
  543. module.uncheck();
  544. }
  545. },
  546. setting: function(name, value) {
  547. module.debug('Changing setting', name, value);
  548. if( $.isPlainObject(name) ) {
  549. $.extend(true, settings, name);
  550. }
  551. else if(value !== undefined) {
  552. if($.isPlainObject(settings[name])) {
  553. $.extend(true, settings[name], value);
  554. }
  555. else {
  556. settings[name] = value;
  557. }
  558. }
  559. else {
  560. return settings[name];
  561. }
  562. },
  563. internal: function(name, value) {
  564. if( $.isPlainObject(name) ) {
  565. $.extend(true, module, name);
  566. }
  567. else if(value !== undefined) {
  568. module[name] = value;
  569. }
  570. else {
  571. return module[name];
  572. }
  573. },
  574. debug: function() {
  575. if(!settings.silent && settings.debug) {
  576. if(settings.performance) {
  577. module.performance.log(arguments);
  578. }
  579. else {
  580. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  581. module.debug.apply(console, arguments);
  582. }
  583. }
  584. },
  585. verbose: function() {
  586. if(!settings.silent && settings.verbose && settings.debug) {
  587. if(settings.performance) {
  588. module.performance.log(arguments);
  589. }
  590. else {
  591. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  592. module.verbose.apply(console, arguments);
  593. }
  594. }
  595. },
  596. error: function() {
  597. if(!settings.silent) {
  598. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  599. module.error.apply(console, arguments);
  600. }
  601. },
  602. performance: {
  603. log: function(message) {
  604. var
  605. currentTime,
  606. executionTime,
  607. previousTime
  608. ;
  609. if(settings.performance) {
  610. currentTime = new Date().getTime();
  611. previousTime = time || currentTime;
  612. executionTime = currentTime - previousTime;
  613. time = currentTime;
  614. performance.push({
  615. 'Name' : message[0],
  616. 'Arguments' : [].slice.call(message, 1) || '',
  617. 'Element' : element,
  618. 'Execution Time' : executionTime
  619. });
  620. }
  621. clearTimeout(module.performance.timer);
  622. module.performance.timer = setTimeout(module.performance.display, 500);
  623. },
  624. display: function() {
  625. var
  626. title = settings.name + ':',
  627. totalTime = 0
  628. ;
  629. time = false;
  630. clearTimeout(module.performance.timer);
  631. $.each(performance, function(index, data) {
  632. totalTime += data['Execution Time'];
  633. });
  634. title += ' ' + totalTime + 'ms';
  635. if(moduleSelector) {
  636. title += ' \'' + moduleSelector + '\'';
  637. }
  638. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  639. console.groupCollapsed(title);
  640. if(console.table) {
  641. console.table(performance);
  642. }
  643. else {
  644. $.each(performance, function(index, data) {
  645. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  646. });
  647. }
  648. console.groupEnd();
  649. }
  650. performance = [];
  651. }
  652. },
  653. invoke: function(query, passedArguments, context) {
  654. var
  655. object = instance,
  656. maxDepth,
  657. found,
  658. response
  659. ;
  660. passedArguments = passedArguments || queryArguments;
  661. context = element || context;
  662. if(typeof query == 'string' && object !== undefined) {
  663. query = query.split(/[\. ]/);
  664. maxDepth = query.length - 1;
  665. $.each(query, function(depth, value) {
  666. var camelCaseValue = (depth != maxDepth)
  667. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  668. : query
  669. ;
  670. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  671. object = object[camelCaseValue];
  672. }
  673. else if( object[camelCaseValue] !== undefined ) {
  674. found = object[camelCaseValue];
  675. return false;
  676. }
  677. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  678. object = object[value];
  679. }
  680. else if( object[value] !== undefined ) {
  681. found = object[value];
  682. return false;
  683. }
  684. else {
  685. module.error(error.method, query);
  686. return false;
  687. }
  688. });
  689. }
  690. if ( $.isFunction( found ) ) {
  691. response = found.apply(context, passedArguments);
  692. }
  693. else if(found !== undefined) {
  694. response = found;
  695. }
  696. if($.isArray(returnedValue)) {
  697. returnedValue.push(response);
  698. }
  699. else if(returnedValue !== undefined) {
  700. returnedValue = [returnedValue, response];
  701. }
  702. else if(response !== undefined) {
  703. returnedValue = response;
  704. }
  705. return found;
  706. }
  707. };
  708. if(methodInvoked) {
  709. if(instance === undefined) {
  710. module.initialize();
  711. }
  712. module.invoke(query);
  713. }
  714. else {
  715. if(instance !== undefined) {
  716. instance.invoke('destroy');
  717. }
  718. module.initialize();
  719. }
  720. })
  721. ;
  722. return (returnedValue !== undefined)
  723. ? returnedValue
  724. : this
  725. ;
  726. };
  727. $.fn.checkbox.settings = {
  728. name : 'Checkbox',
  729. namespace : 'checkbox',
  730. silent : false,
  731. debug : false,
  732. verbose : true,
  733. performance : true,
  734. // delegated event context
  735. uncheckable : 'auto',
  736. fireOnInit : false,
  737. onChange : function(){},
  738. beforeChecked : function(){},
  739. beforeUnchecked : function(){},
  740. beforeDeterminate : function(){},
  741. beforeIndeterminate : function(){},
  742. onChecked : function(){},
  743. onUnchecked : function(){},
  744. onDeterminate : function() {},
  745. onIndeterminate : function() {},
  746. onEnable : function(){},
  747. onDisable : function(){},
  748. // preserve misspelled callbacks (will be removed in 3.0)
  749. onEnabled : function(){},
  750. onDisabled : function(){},
  751. className : {
  752. checked : 'checked',
  753. indeterminate : 'indeterminate',
  754. disabled : 'disabled',
  755. hidden : 'hidden',
  756. radio : 'radio',
  757. readOnly : 'read-only'
  758. },
  759. error : {
  760. method : 'The method you called is not defined'
  761. },
  762. selector : {
  763. checkbox : '.ui.checkbox',
  764. label : 'label, .box',
  765. input : 'input[type="checkbox"], input[type="radio"]',
  766. link : 'a[href]'
  767. }
  768. };
  769. })( jQuery, window, document );