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.

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