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.

882 lines
26 KiB

9 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
9 years ago
10 years ago
10 years ago
9 years ago
9 years ago
10 years ago
9 years ago
10 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
10 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 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
9 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 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
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
9 years ago
10 years ago
9 years ago
10 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
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
10 years ago
10 years ago
9 years ago
10 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
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
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
10 years ago
  1. /*!
  2. * # Semantic UI 2.0.0 - Modal
  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. $.fn.modal = function(parameters) {
  14. var
  15. $allModules = $(this),
  16. $window = $(window),
  17. $document = $(document),
  18. $body = $('body'),
  19. moduleSelector = $allModules.selector || '',
  20. time = new Date().getTime(),
  21. performance = [],
  22. query = arguments[0],
  23. methodInvoked = (typeof query == 'string'),
  24. queryArguments = [].slice.call(arguments, 1),
  25. requestAnimationFrame = window.requestAnimationFrame
  26. || window.mozRequestAnimationFrame
  27. || window.webkitRequestAnimationFrame
  28. || window.msRequestAnimationFrame
  29. || function(callback) { setTimeout(callback, 0); },
  30. returnedValue
  31. ;
  32. $allModules
  33. .each(function() {
  34. var
  35. settings = ( $.isPlainObject(parameters) )
  36. ? $.extend(true, {}, $.fn.modal.settings, parameters)
  37. : $.extend({}, $.fn.modal.settings),
  38. selector = settings.selector,
  39. className = settings.className,
  40. namespace = settings.namespace,
  41. error = settings.error,
  42. eventNamespace = '.' + namespace,
  43. moduleNamespace = 'module-' + namespace,
  44. $module = $(this),
  45. $context = $(settings.context),
  46. $close = $module.find(selector.close),
  47. $allModals,
  48. $otherModals,
  49. $focusedElement,
  50. $dimmable,
  51. $dimmer,
  52. element = this,
  53. instance = $module.data(moduleNamespace),
  54. elementNamespace,
  55. id,
  56. observer,
  57. module
  58. ;
  59. module = {
  60. initialize: function() {
  61. module.verbose('Initializing dimmer', $context);
  62. module.create.id();
  63. module.create.dimmer();
  64. module.refreshModals();
  65. module.bind.events();
  66. if(settings.observeChanges) {
  67. module.observeChanges();
  68. }
  69. module.instantiate();
  70. },
  71. instantiate: function() {
  72. module.verbose('Storing instance of modal');
  73. instance = module;
  74. $module
  75. .data(moduleNamespace, instance)
  76. ;
  77. },
  78. create: {
  79. dimmer: function() {
  80. var
  81. defaultSettings = {
  82. debug : settings.debug,
  83. dimmerName : 'modals',
  84. duration : {
  85. show : settings.duration,
  86. hide : settings.duration
  87. }
  88. },
  89. dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
  90. ;
  91. if(settings.inverted) {
  92. dimmerSettings.variation = (dimmerSettings.variation !== undefined)
  93. ? dimmerSettings.variation + ' inverted'
  94. : 'inverted'
  95. ;
  96. }
  97. if($.fn.dimmer === undefined) {
  98. module.error(error.dimmer);
  99. return;
  100. }
  101. module.debug('Creating dimmer with settings', dimmerSettings);
  102. $dimmable = $context.dimmer(dimmerSettings);
  103. if(settings.detachable) {
  104. module.verbose('Modal is detachable, moving content into dimmer');
  105. $dimmable.dimmer('add content', $module);
  106. }
  107. else {
  108. module.set.undetached();
  109. }
  110. if(settings.blurring) {
  111. $dimmable.addClass(className.blurring);
  112. }
  113. $dimmer = $dimmable.dimmer('get dimmer');
  114. },
  115. id: function() {
  116. id = (Math.random().toString(16) + '000000000').substr(2,8);
  117. elementNamespace = '.' + id;
  118. module.verbose('Creating unique id for element', id);
  119. }
  120. },
  121. destroy: function() {
  122. module.verbose('Destroying previous modal');
  123. $module
  124. .removeData(moduleNamespace)
  125. .off(eventNamespace)
  126. ;
  127. $window.off(elementNamespace);
  128. $close.off(eventNamespace);
  129. $context.dimmer('destroy');
  130. },
  131. observeChanges: function() {
  132. if('MutationObserver' in window) {
  133. observer = new MutationObserver(function(mutations) {
  134. module.debug('DOM tree modified, refreshing');
  135. module.refresh();
  136. });
  137. observer.observe(element, {
  138. childList : true,
  139. subtree : true
  140. });
  141. module.debug('Setting up mutation observer', observer);
  142. }
  143. },
  144. refresh: function() {
  145. module.remove.scrolling();
  146. module.cacheSizes();
  147. module.set.screenHeight();
  148. module.set.type();
  149. module.set.position();
  150. },
  151. refreshModals: function() {
  152. $otherModals = $module.siblings(selector.modal);
  153. $allModals = $otherModals.add($module);
  154. },
  155. attachEvents: function(selector, event) {
  156. var
  157. $toggle = $(selector)
  158. ;
  159. event = $.isFunction(module[event])
  160. ? module[event]
  161. : module.toggle
  162. ;
  163. if($toggle.length > 0) {
  164. module.debug('Attaching modal events to element', selector, event);
  165. $toggle
  166. .off(eventNamespace)
  167. .on('click' + eventNamespace, event)
  168. ;
  169. }
  170. else {
  171. module.error(error.notFound, selector);
  172. }
  173. },
  174. bind: {
  175. events: function() {
  176. module.verbose('Attaching events');
  177. $module
  178. .on('click' + eventNamespace, selector.close, module.event.close)
  179. .on('click' + eventNamespace, selector.approve, module.event.approve)
  180. .on('click' + eventNamespace, selector.deny, module.event.deny)
  181. ;
  182. $window
  183. .on('resize' + elementNamespace, module.event.resize)
  184. ;
  185. }
  186. },
  187. get: {
  188. id: function() {
  189. return (Math.random().toString(16) + '000000000').substr(2,8);
  190. }
  191. },
  192. event: {
  193. approve: function() {
  194. if(settings.onApprove.call(element, $(this)) === false) {
  195. module.verbose('Approve callback returned false cancelling hide');
  196. return;
  197. }
  198. module.hide();
  199. },
  200. deny: function() {
  201. if(settings.onDeny.call(element, $(this)) === false) {
  202. module.verbose('Deny callback returned false cancelling hide');
  203. return;
  204. }
  205. module.hide();
  206. },
  207. close: function() {
  208. module.hide();
  209. },
  210. click: function(event) {
  211. var
  212. $target = $(event.target),
  213. isInModal = ($target.closest(selector.modal).length > 0),
  214. isInDOM = $.contains(document.documentElement, event.target)
  215. ;
  216. if(!isInModal && isInDOM) {
  217. module.debug('Dimmer clicked, hiding all modals');
  218. if( module.is.active() ) {
  219. module.remove.clickaway();
  220. if(settings.allowMultiple) {
  221. module.hide();
  222. }
  223. else {
  224. module.hideAll();
  225. }
  226. }
  227. }
  228. },
  229. debounce: function(method, delay) {
  230. clearTimeout(module.timer);
  231. module.timer = setTimeout(method, delay);
  232. },
  233. keyboard: function(event) {
  234. var
  235. keyCode = event.which,
  236. escapeKey = 27
  237. ;
  238. if(keyCode == escapeKey) {
  239. if(settings.closable) {
  240. module.debug('Escape key pressed hiding modal');
  241. module.hide();
  242. }
  243. else {
  244. module.debug('Escape key pressed, but closable is set to false');
  245. }
  246. event.preventDefault();
  247. }
  248. },
  249. resize: function() {
  250. if( $dimmable.dimmer('is active') ) {
  251. requestAnimationFrame(module.refresh);
  252. }
  253. }
  254. },
  255. toggle: function() {
  256. if( module.is.active() || module.is.animating() ) {
  257. module.hide();
  258. }
  259. else {
  260. module.show();
  261. }
  262. },
  263. show: function(callback) {
  264. callback = $.isFunction(callback)
  265. ? callback
  266. : function(){}
  267. ;
  268. module.refreshModals();
  269. module.showModal(callback);
  270. },
  271. hide: function(callback) {
  272. callback = $.isFunction(callback)
  273. ? callback
  274. : function(){}
  275. ;
  276. module.refreshModals();
  277. module.hideModal(callback);
  278. },
  279. showModal: function(callback) {
  280. callback = $.isFunction(callback)
  281. ? callback
  282. : function(){}
  283. ;
  284. if( module.is.animating() || !module.is.active() ) {
  285. module.showDimmer();
  286. module.cacheSizes();
  287. module.set.position();
  288. module.set.screenHeight();
  289. module.set.type();
  290. module.set.clickaway();
  291. if( !settings.allowMultiple && $otherModals.filter('.' + className.active).length > 0) {
  292. module.debug('Other modals visible, queueing show animation');
  293. module.hideOthers(module.showModal);
  294. }
  295. else {
  296. settings.onShow.call(element);
  297. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  298. module.debug('Showing modal with css animations');
  299. $module
  300. .transition({
  301. debug : settings.debug,
  302. animation : settings.transition + ' in',
  303. queue : settings.queue,
  304. duration : settings.duration,
  305. useFailSafe : true,
  306. onComplete : function() {
  307. settings.onVisible.apply(element);
  308. module.add.keyboardShortcuts();
  309. module.save.focus();
  310. module.set.active();
  311. module.set.autofocus();
  312. callback();
  313. }
  314. })
  315. ;
  316. }
  317. else {
  318. module.error(error.noTransition);
  319. }
  320. }
  321. }
  322. else {
  323. module.debug('Modal is already visible');
  324. }
  325. },
  326. hideModal: function(callback, keepDimmed) {
  327. callback = $.isFunction(callback)
  328. ? callback
  329. : function(){}
  330. ;
  331. module.debug('Hiding modal');
  332. settings.onHide.call(element);
  333. if( module.is.animating() || module.is.active() ) {
  334. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  335. module.remove.active();
  336. $module
  337. .transition({
  338. debug : settings.debug,
  339. animation : settings.transition + ' out',
  340. queue : settings.queue,
  341. duration : settings.duration,
  342. useFailSafe : true,
  343. onStart : function() {
  344. if(!module.othersActive() && !keepDimmed) {
  345. module.hideDimmer();
  346. }
  347. module.remove.keyboardShortcuts();
  348. },
  349. onComplete : function() {
  350. settings.onHidden.call(element);
  351. module.restore.focus();
  352. callback();
  353. }
  354. })
  355. ;
  356. }
  357. else {
  358. module.error(error.noTransition);
  359. }
  360. }
  361. },
  362. showDimmer: function() {
  363. if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
  364. module.debug('Showing dimmer');
  365. $dimmable.dimmer('show');
  366. }
  367. else {
  368. module.debug('Dimmer already visible');
  369. }
  370. },
  371. hideDimmer: function() {
  372. if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
  373. $dimmable.dimmer('hide', function() {
  374. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  375. module.remove.clickaway();
  376. module.remove.screenHeight();
  377. }
  378. });
  379. }
  380. else {
  381. module.debug('Dimmer is not visible cannot hide');
  382. return;
  383. }
  384. },
  385. hideAll: function(callback) {
  386. var
  387. $visibleModals = $allModals.filter(':visible')
  388. ;
  389. callback = $.isFunction(callback)
  390. ? callback
  391. : function(){}
  392. ;
  393. if( $visibleModals.length > 0 ) {
  394. module.debug('Hiding all visible modals');
  395. module.hideDimmer();
  396. $visibleModals
  397. .modal('hide modal', callback)
  398. ;
  399. }
  400. },
  401. hideOthers: function(callback) {
  402. var
  403. $visibleModals = $otherModals.filter(':visible')
  404. ;
  405. callback = $.isFunction(callback)
  406. ? callback
  407. : function(){}
  408. ;
  409. if( $visibleModals.length > 0 ) {
  410. module.debug('Hiding other modals', $otherModals);
  411. $visibleModals
  412. .modal('hide modal', callback, true)
  413. ;
  414. }
  415. },
  416. othersActive: function() {
  417. return ($otherModals.filter('.' + className.active + ', .' + className.animating).length > 0);
  418. },
  419. add: {
  420. keyboardShortcuts: function() {
  421. module.verbose('Adding keyboard shortcuts');
  422. $document
  423. .on('keyup' + eventNamespace, module.event.keyboard)
  424. ;
  425. }
  426. },
  427. save: {
  428. focus: function() {
  429. $focusedElement = $(document.activeElement).blur();
  430. }
  431. },
  432. restore: {
  433. focus: function() {
  434. if($focusedElement && $focusedElement.length > 0) {
  435. $focusedElement.focus();
  436. }
  437. }
  438. },
  439. remove: {
  440. active: function() {
  441. $module.removeClass(className.active);
  442. },
  443. clickaway: function() {
  444. if(settings.closable) {
  445. $dimmer
  446. .off('click' + elementNamespace)
  447. ;
  448. }
  449. },
  450. screenHeight: function() {
  451. if(module.cache.height > module.cache.pageHeight) {
  452. module.debug('Removing page height');
  453. $body
  454. .css('height', '')
  455. ;
  456. }
  457. },
  458. keyboardShortcuts: function() {
  459. module.verbose('Removing keyboard shortcuts');
  460. $document
  461. .off('keyup' + eventNamespace)
  462. ;
  463. },
  464. scrolling: function() {
  465. $dimmable.removeClass(className.scrolling);
  466. $module.removeClass(className.scrolling);
  467. }
  468. },
  469. cacheSizes: function() {
  470. var
  471. modalHeight = $module.outerHeight()
  472. ;
  473. if(module.cache === undefined || modalHeight !== 0) {
  474. module.cache = {
  475. pageHeight : $(document).outerHeight(),
  476. height : modalHeight + settings.offset,
  477. contextHeight : (settings.context == 'body')
  478. ? $(window).height()
  479. : $dimmable.height()
  480. };
  481. }
  482. module.debug('Caching modal and container sizes', module.cache);
  483. },
  484. can: {
  485. fit: function() {
  486. return ( ( module.cache.height + (settings.padding * 2) ) < module.cache.contextHeight);
  487. }
  488. },
  489. is: {
  490. active: function() {
  491. return $module.hasClass(className.active);
  492. },
  493. animating: function() {
  494. return $module.transition('is supported')
  495. ? $module.transition('is animating')
  496. : $module.is(':visible')
  497. ;
  498. },
  499. scrolling: function() {
  500. return $dimmable.hasClass(className.scrolling);
  501. },
  502. modernBrowser: function() {
  503. // appName for IE11 reports 'Netscape' can no longer use
  504. return !(window.ActiveXObject || "ActiveXObject" in window);
  505. }
  506. },
  507. set: {
  508. autofocus: function() {
  509. if(settings.autofocus) {
  510. var
  511. $inputs = $module.filter(':input').filter(':visible'),
  512. $autofocus = $inputs.filter('[autofocus]'),
  513. $input = ($autofocus.length > 0)
  514. ? $autofocus.first()
  515. : $inputs.first()
  516. ;
  517. if($input.length > 0) {
  518. $input.focus();
  519. }
  520. }
  521. },
  522. clickaway: function() {
  523. if(settings.closable) {
  524. $dimmer
  525. .on('click' + elementNamespace, module.event.click)
  526. ;
  527. }
  528. },
  529. screenHeight: function() {
  530. if( module.can.fit() ) {
  531. $body.css('height', '');
  532. }
  533. else {
  534. module.debug('Modal is taller than page content, resizing page height');
  535. $body
  536. .css('height', module.cache.height + (settings.padding * 2) )
  537. ;
  538. }
  539. },
  540. active: function() {
  541. $module.addClass(className.active);
  542. },
  543. scrolling: function() {
  544. $dimmable.addClass(className.scrolling);
  545. $module.addClass(className.scrolling);
  546. },
  547. type: function() {
  548. if(module.can.fit()) {
  549. module.verbose('Modal fits on screen');
  550. if(!module.othersActive()) {
  551. module.remove.scrolling();
  552. }
  553. }
  554. else {
  555. module.verbose('Modal cannot fit on screen setting to scrolling');
  556. module.set.scrolling();
  557. }
  558. },
  559. position: function() {
  560. module.verbose('Centering modal on page', module.cache);
  561. if(module.can.fit()) {
  562. $module
  563. .css({
  564. top: '',
  565. marginTop: -(module.cache.height / 2)
  566. })
  567. ;
  568. }
  569. else {
  570. $module
  571. .css({
  572. marginTop : '',
  573. top : $document.scrollTop()
  574. })
  575. ;
  576. }
  577. },
  578. undetached: function() {
  579. $dimmable.addClass(className.undetached);
  580. }
  581. },
  582. setting: function(name, value) {
  583. module.debug('Changing setting', name, value);
  584. if( $.isPlainObject(name) ) {
  585. $.extend(true, settings, name);
  586. }
  587. else if(value !== undefined) {
  588. settings[name] = value;
  589. }
  590. else {
  591. return settings[name];
  592. }
  593. },
  594. internal: function(name, value) {
  595. if( $.isPlainObject(name) ) {
  596. $.extend(true, module, name);
  597. }
  598. else if(value !== undefined) {
  599. module[name] = value;
  600. }
  601. else {
  602. return module[name];
  603. }
  604. },
  605. debug: function() {
  606. if(settings.debug) {
  607. if(settings.performance) {
  608. module.performance.log(arguments);
  609. }
  610. else {
  611. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  612. module.debug.apply(console, arguments);
  613. }
  614. }
  615. },
  616. verbose: function() {
  617. if(settings.verbose && settings.debug) {
  618. if(settings.performance) {
  619. module.performance.log(arguments);
  620. }
  621. else {
  622. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  623. module.verbose.apply(console, arguments);
  624. }
  625. }
  626. },
  627. error: function() {
  628. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  629. module.error.apply(console, arguments);
  630. },
  631. performance: {
  632. log: function(message) {
  633. var
  634. currentTime,
  635. executionTime,
  636. previousTime
  637. ;
  638. if(settings.performance) {
  639. currentTime = new Date().getTime();
  640. previousTime = time || currentTime;
  641. executionTime = currentTime - previousTime;
  642. time = currentTime;
  643. performance.push({
  644. 'Name' : message[0],
  645. 'Arguments' : [].slice.call(message, 1) || '',
  646. 'Element' : element,
  647. 'Execution Time' : executionTime
  648. });
  649. }
  650. clearTimeout(module.performance.timer);
  651. module.performance.timer = setTimeout(module.performance.display, 500);
  652. },
  653. display: function() {
  654. var
  655. title = settings.name + ':',
  656. totalTime = 0
  657. ;
  658. time = false;
  659. clearTimeout(module.performance.timer);
  660. $.each(performance, function(index, data) {
  661. totalTime += data['Execution Time'];
  662. });
  663. title += ' ' + totalTime + 'ms';
  664. if(moduleSelector) {
  665. title += ' \'' + moduleSelector + '\'';
  666. }
  667. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  668. console.groupCollapsed(title);
  669. if(console.table) {
  670. console.table(performance);
  671. }
  672. else {
  673. $.each(performance, function(index, data) {
  674. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  675. });
  676. }
  677. console.groupEnd();
  678. }
  679. performance = [];
  680. }
  681. },
  682. invoke: function(query, passedArguments, context) {
  683. var
  684. object = instance,
  685. maxDepth,
  686. found,
  687. response
  688. ;
  689. passedArguments = passedArguments || queryArguments;
  690. context = element || context;
  691. if(typeof query == 'string' && object !== undefined) {
  692. query = query.split(/[\. ]/);
  693. maxDepth = query.length - 1;
  694. $.each(query, function(depth, value) {
  695. var camelCaseValue = (depth != maxDepth)
  696. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  697. : query
  698. ;
  699. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  700. object = object[camelCaseValue];
  701. }
  702. else if( object[camelCaseValue] !== undefined ) {
  703. found = object[camelCaseValue];
  704. return false;
  705. }
  706. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  707. object = object[value];
  708. }
  709. else if( object[value] !== undefined ) {
  710. found = object[value];
  711. return false;
  712. }
  713. else {
  714. return false;
  715. }
  716. });
  717. }
  718. if ( $.isFunction( found ) ) {
  719. response = found.apply(context, passedArguments);
  720. }
  721. else if(found !== undefined) {
  722. response = found;
  723. }
  724. if($.isArray(returnedValue)) {
  725. returnedValue.push(response);
  726. }
  727. else if(returnedValue !== undefined) {
  728. returnedValue = [returnedValue, response];
  729. }
  730. else if(response !== undefined) {
  731. returnedValue = response;
  732. }
  733. return found;
  734. }
  735. };
  736. if(methodInvoked) {
  737. if(instance === undefined) {
  738. module.initialize();
  739. }
  740. module.invoke(query);
  741. }
  742. else {
  743. if(instance !== undefined) {
  744. instance.invoke('destroy');
  745. }
  746. module.initialize();
  747. }
  748. })
  749. ;
  750. return (returnedValue !== undefined)
  751. ? returnedValue
  752. : this
  753. ;
  754. };
  755. $.fn.modal.settings = {
  756. name : 'Modal',
  757. namespace : 'modal',
  758. debug : false,
  759. verbose : false,
  760. performance : true,
  761. observeChanges : false,
  762. allowMultiple : false,
  763. detachable : true,
  764. closable : true,
  765. autofocus : true,
  766. inverted : false,
  767. blurring : false,
  768. dimmerSettings : {
  769. closable : false,
  770. useCSS : true
  771. },
  772. context : 'body',
  773. queue : false,
  774. duration : 500,
  775. offset : 0,
  776. transition : 'scale',
  777. // padding with edge of page
  778. padding : 50,
  779. // called before show animation
  780. onShow : function(){},
  781. // called after show animation
  782. onVisible : function(){},
  783. // called before hide animation
  784. onHide : function(){},
  785. // called after hide animation
  786. onHidden : function(){},
  787. // called after approve selector match
  788. onApprove : function(){ return true; },
  789. // called after deny selector match
  790. onDeny : function(){ return true; },
  791. selector : {
  792. close : '.close',
  793. approve : '.actions .positive, .actions .approve, .actions .ok',
  794. deny : '.actions .negative, .actions .deny, .actions .cancel',
  795. modal : '.ui.modal'
  796. },
  797. error : {
  798. dimmer : 'UI Dimmer, a required component is not included in this page',
  799. method : 'The method you called is not defined.',
  800. notFound : 'The element you specified could not be found'
  801. },
  802. className : {
  803. active : 'active',
  804. animating : 'animating',
  805. blurring : 'blurring',
  806. scrolling : 'scrolling',
  807. undetached : 'undetached'
  808. }
  809. };
  810. })( jQuery, window , document );