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
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
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
9 years ago
10 years ago
  1. /*!
  2. * # Semantic UI 2.1.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 && 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. if(settings.autofocus) {
  311. module.set.autofocus();
  312. }
  313. callback();
  314. }
  315. })
  316. ;
  317. }
  318. else {
  319. module.error(error.noTransition);
  320. }
  321. }
  322. }
  323. else {
  324. module.debug('Modal is already visible');
  325. }
  326. },
  327. hideModal: function(callback, keepDimmed) {
  328. callback = $.isFunction(callback)
  329. ? callback
  330. : function(){}
  331. ;
  332. module.debug('Hiding modal');
  333. settings.onHide.call(element);
  334. if( module.is.animating() || module.is.active() ) {
  335. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  336. module.remove.active();
  337. $module
  338. .transition({
  339. debug : settings.debug,
  340. animation : settings.transition + ' out',
  341. queue : settings.queue,
  342. duration : settings.duration,
  343. useFailSafe : true,
  344. onStart : function() {
  345. if(!module.others.active() && !keepDimmed) {
  346. module.hideDimmer();
  347. }
  348. module.remove.keyboardShortcuts();
  349. },
  350. onComplete : function() {
  351. settings.onHidden.call(element);
  352. module.restore.focus();
  353. callback();
  354. }
  355. })
  356. ;
  357. }
  358. else {
  359. module.error(error.noTransition);
  360. }
  361. }
  362. },
  363. showDimmer: function() {
  364. if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
  365. module.debug('Showing dimmer');
  366. $dimmable.dimmer('show');
  367. }
  368. else {
  369. module.debug('Dimmer already visible');
  370. }
  371. },
  372. hideDimmer: function() {
  373. if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
  374. $dimmable.dimmer('hide', function() {
  375. module.remove.clickaway();
  376. module.remove.screenHeight();
  377. });
  378. }
  379. else {
  380. module.debug('Dimmer is not visible cannot hide');
  381. return;
  382. }
  383. },
  384. hideAll: function(callback) {
  385. var
  386. $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
  387. ;
  388. callback = $.isFunction(callback)
  389. ? callback
  390. : function(){}
  391. ;
  392. if( $visibleModals.length > 0 ) {
  393. module.debug('Hiding all visible modals');
  394. module.hideDimmer();
  395. $visibleModals
  396. .modal('hide modal', callback)
  397. ;
  398. }
  399. },
  400. hideOthers: function(callback) {
  401. var
  402. $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
  403. ;
  404. callback = $.isFunction(callback)
  405. ? callback
  406. : function(){}
  407. ;
  408. if( $visibleModals.length > 0 ) {
  409. module.debug('Hiding other modals', $otherModals);
  410. $visibleModals
  411. .modal('hide modal', callback, true)
  412. ;
  413. }
  414. },
  415. others: {
  416. active: function() {
  417. return ($otherModals.filter('.' + className.active).length > 0);
  418. },
  419. animating: function() {
  420. return ($otherModals.filter('.' + className.animating).length > 0);
  421. }
  422. },
  423. add: {
  424. keyboardShortcuts: function() {
  425. module.verbose('Adding keyboard shortcuts');
  426. $document
  427. .on('keyup' + eventNamespace, module.event.keyboard)
  428. ;
  429. }
  430. },
  431. save: {
  432. focus: function() {
  433. $focusedElement = $(document.activeElement).blur();
  434. }
  435. },
  436. restore: {
  437. focus: function() {
  438. if($focusedElement && $focusedElement.length > 0) {
  439. $focusedElement.focus();
  440. }
  441. }
  442. },
  443. remove: {
  444. active: function() {
  445. $module.removeClass(className.active);
  446. },
  447. clickaway: function() {
  448. if(settings.closable) {
  449. $dimmer
  450. .off('click' + elementNamespace)
  451. ;
  452. }
  453. },
  454. bodyStyle: function() {
  455. if($body.attr('style') === '') {
  456. module.verbose('Removing style attribute');
  457. $body.removeAttr('style');
  458. }
  459. },
  460. screenHeight: function() {
  461. module.debug('Removing page height');
  462. $body
  463. .css('height', '')
  464. ;
  465. },
  466. keyboardShortcuts: function() {
  467. module.verbose('Removing keyboard shortcuts');
  468. $document
  469. .off('keyup' + eventNamespace)
  470. ;
  471. },
  472. scrolling: function() {
  473. $dimmable.removeClass(className.scrolling);
  474. $module.removeClass(className.scrolling);
  475. }
  476. },
  477. cacheSizes: function() {
  478. var
  479. modalHeight = $module.outerHeight()
  480. ;
  481. if(module.cache === undefined || modalHeight !== 0) {
  482. module.cache = {
  483. pageHeight : $(document).outerHeight(),
  484. height : modalHeight + settings.offset,
  485. contextHeight : (settings.context == 'body')
  486. ? $(window).height()
  487. : $dimmable.height()
  488. };
  489. }
  490. module.debug('Caching modal and container sizes', module.cache);
  491. },
  492. can: {
  493. fit: function() {
  494. return ( ( module.cache.height + (settings.padding * 2) ) < module.cache.contextHeight);
  495. }
  496. },
  497. is: {
  498. active: function() {
  499. return $module.hasClass(className.active);
  500. },
  501. animating: function() {
  502. return $module.transition('is supported')
  503. ? $module.transition('is animating')
  504. : $module.is(':visible')
  505. ;
  506. },
  507. scrolling: function() {
  508. return $dimmable.hasClass(className.scrolling);
  509. },
  510. modernBrowser: function() {
  511. // appName for IE11 reports 'Netscape' can no longer use
  512. return !(window.ActiveXObject || "ActiveXObject" in window);
  513. }
  514. },
  515. set: {
  516. autofocus: function() {
  517. var
  518. $inputs = $module.find(':input').filter(':visible'),
  519. $autofocus = $inputs.filter('[autofocus]'),
  520. $input = ($autofocus.length > 0)
  521. ? $autofocus.first()
  522. : $inputs.first()
  523. ;
  524. if($input.length > 0) {
  525. $input.focus();
  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 );