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.

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