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.

907 lines
27 KiB

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