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.

921 lines
27 KiB

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