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.

927 lines
28 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
11 years ago
10 years ago
10 years ago
11 years ago
10 years ago
  1. /*
  2. * # Semantic - Popup
  3. * http://github.com/jlukic/semantic-ui/
  4. *
  5. *
  6. * Copyright 2014 Contributor
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. */
  11. ;(function ($, window, document, undefined) {
  12. $.fn.popup = function(parameters) {
  13. var
  14. $allModules = $(this),
  15. $document = $(document),
  16. moduleSelector = $allModules.selector || '',
  17. time = new Date().getTime(),
  18. performance = [],
  19. query = arguments[0],
  20. methodInvoked = (typeof query == 'string'),
  21. queryArguments = [].slice.call(arguments, 1),
  22. returnedValue
  23. ;
  24. $allModules
  25. .each(function() {
  26. var
  27. settings = ( $.isPlainObject(parameters) )
  28. ? $.extend(true, {}, $.fn.popup.settings, parameters)
  29. : $.extend({}, $.fn.popup.settings),
  30. selector = settings.selector,
  31. className = settings.className,
  32. error = settings.error,
  33. metadata = settings.metadata,
  34. namespace = settings.namespace,
  35. eventNamespace = '.' + settings.namespace,
  36. moduleNamespace = 'module-' + namespace,
  37. $module = $(this),
  38. $context = $(settings.context),
  39. $target = (settings.target)
  40. ? $(settings.target)
  41. : $module,
  42. $window = $(window),
  43. $body = $('body'),
  44. $popup = (settings.popup)
  45. ? $(settings.popup)
  46. : (settings.inline)
  47. ? $target.next(settings.selector.popup)
  48. : $context.find(settings.selector.popup).last(),
  49. $offsetParent = (settings.popup)
  50. ? $popup.offsetParent()
  51. : (settings.inline)
  52. ? $target.offsetParent()
  53. : $body,
  54. searchDepth = 0,
  55. element = this,
  56. instance = $module.data(moduleNamespace),
  57. module
  58. ;
  59. module = {
  60. // binds events
  61. initialize: function() {
  62. module.debug('Initializing module', $module);
  63. if(settings.on == 'click') {
  64. $module
  65. .on('click', module.toggle)
  66. ;
  67. }
  68. else if( module.get.startEvent() ) {
  69. $module
  70. .on(module.get.startEvent() + eventNamespace, module.event.start)
  71. .on(module.get.endEvent() + eventNamespace, module.event.end)
  72. ;
  73. }
  74. if(settings.target) {
  75. module.debug('Target set to element', $target);
  76. }
  77. $window
  78. .on('resize' + eventNamespace, module.event.resize)
  79. ;
  80. if( !module.exists() ) {
  81. module.create();
  82. }
  83. else if(settings.hoverable) {
  84. module.bind.popup();
  85. }
  86. module.instantiate();
  87. },
  88. instantiate: function() {
  89. module.verbose('Storing instance of module', module);
  90. instance = module;
  91. $module
  92. .data(moduleNamespace, instance)
  93. ;
  94. },
  95. refresh: function() {
  96. if(settings.popup) {
  97. $popup = $(settings.popup);
  98. $offsetParent = $popup.offsetParent();
  99. }
  100. else if(settings.inline) {
  101. $popup = $target.next(selector.popup);
  102. $offsetParent = $target.offsetParent();
  103. }
  104. else {
  105. $popup = $context.find(selector.popup).last();
  106. }
  107. },
  108. destroy: function() {
  109. module.debug('Destroying previous module');
  110. $popup
  111. .remove()
  112. ;
  113. $module
  114. .off(eventNamespace)
  115. .removeData(moduleNamespace)
  116. ;
  117. },
  118. event: {
  119. start: function(event) {
  120. var
  121. delay = ($.isPlainObject(settings.delay))
  122. ? settings.delay.show
  123. : settings.delay
  124. ;
  125. clearTimeout(module.hideTimer);
  126. module.showTimer = setTimeout(function() {
  127. if( module.is.hidden() ) {
  128. module.show();
  129. }
  130. }, delay);
  131. },
  132. end: function() {
  133. var
  134. delay = ($.isPlainObject(settings.delay))
  135. ? settings.delay.hide
  136. : settings.delay
  137. ;
  138. clearTimeout(module.showTimer);
  139. module.hideTimer = setTimeout(function() {
  140. if( module.is.visible() ) {
  141. module.hide();
  142. }
  143. }, delay);
  144. },
  145. resize: function() {
  146. if( module.is.visible() ) {
  147. module.set.position();
  148. }
  149. }
  150. },
  151. // generates popup html from metadata
  152. create: function() {
  153. module.debug('Creating pop-up html');
  154. var
  155. html = $module.data(metadata.html) || settings.html,
  156. variation = $module.data(metadata.variation) || settings.variation,
  157. title = $module.data(metadata.title) || settings.title,
  158. content = $module.data(metadata.content) || $module.attr('title') || settings.content
  159. ;
  160. if(html || content || title) {
  161. if(!html) {
  162. html = settings.template({
  163. title : title,
  164. content : content
  165. });
  166. }
  167. $popup = $('<div/>')
  168. .addClass(className.popup)
  169. .addClass(variation)
  170. .html(html)
  171. ;
  172. if(variation) {
  173. $popup
  174. .addClass(variation)
  175. ;
  176. }
  177. if(settings.inline) {
  178. module.verbose('Inserting popup element inline', $popup);
  179. $popup
  180. .insertAfter($module)
  181. ;
  182. }
  183. else {
  184. module.verbose('Appending popup element to body', $popup);
  185. $popup
  186. .appendTo( $context )
  187. ;
  188. }
  189. if(settings.hoverable && module.cache === undefined ) {
  190. module.bind.popup();
  191. }
  192. $.proxy(settings.onCreate, $popup)();
  193. }
  194. else {
  195. module.error(error.content, element);
  196. }
  197. },
  198. // determines popup state
  199. toggle: function() {
  200. module.debug('Toggling pop-up');
  201. if( module.is.hidden() ) {
  202. module.debug('Popup is hidden, showing pop-up');
  203. module.unbind.close();
  204. module.hideAll();
  205. module.show();
  206. }
  207. else {
  208. module.debug('Popup is visible, hiding pop-up');
  209. module.hide();
  210. }
  211. },
  212. show: function(callback) {
  213. callback = callback || function(){};
  214. module.debug('Showing pop-up', settings.transition);
  215. if(!settings.preserve && !settings.popup) {
  216. module.refresh();
  217. }
  218. if( !module.exists() ) {
  219. module.create();
  220. }
  221. if( module.set.position() ) {
  222. module.save.conditions();
  223. module.animate.show(callback);
  224. }
  225. },
  226. hide: function(callback) {
  227. callback = callback || function(){};
  228. $module
  229. .removeClass(className.visible)
  230. ;
  231. module.unbind.close();
  232. if( module.is.visible() ) {
  233. module.restore.conditions();
  234. module.animate.hide(callback);
  235. }
  236. },
  237. hideAll: function() {
  238. $(selector.popup)
  239. .filter(':visible')
  240. .popup('hide')
  241. ;
  242. },
  243. hideGracefully: function(event) {
  244. // don't close on clicks inside popup
  245. if(event && $(event.target).closest(selector.popup).size() === 0) {
  246. module.debug('Click occurred outside popup hiding popup');
  247. module.hide();
  248. }
  249. else {
  250. module.debug('Click was inside popup, keeping popup open');
  251. }
  252. },
  253. exists: function() {
  254. if(settings.inline) {
  255. return ( $popup.size() !== 0 );
  256. }
  257. else {
  258. return ( $popup.closest($context).size() );
  259. }
  260. },
  261. remove: function() {
  262. module.debug('Removing popup');
  263. $popup
  264. .remove()
  265. ;
  266. },
  267. save: {
  268. conditions: function() {
  269. module.cache = {
  270. title: $module.attr('title')
  271. };
  272. if (module.cache.title) {
  273. $module.removeAttr('title');
  274. }
  275. module.verbose('Saving original attributes', module.cache.title);
  276. }
  277. },
  278. restore: {
  279. conditions: function() {
  280. if(module.cache && module.cache.title) {
  281. $module.attr('title', module.cache.title);
  282. module.verbose('Restoring original attributes', module.cache.title);
  283. }
  284. return true;
  285. }
  286. },
  287. animate: {
  288. show: function(callback) {
  289. callback = callback || function(){};
  290. $module
  291. .addClass(className.visible)
  292. ;
  293. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  294. $popup
  295. .transition(settings.transition + ' in', settings.duration, function() {
  296. module.bind.close();
  297. $.proxy(callback, element)();
  298. })
  299. ;
  300. }
  301. else {
  302. $popup
  303. .stop()
  304. .fadeIn(settings.duration, settings.easing, function() {
  305. module.bind.close();
  306. $.proxy(callback, element)();
  307. })
  308. ;
  309. }
  310. $.proxy(settings.onShow, element)();
  311. },
  312. hide: function(callback) {
  313. callback = callback || function(){};
  314. module.debug('Hiding pop-up');
  315. if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
  316. $popup
  317. .transition(settings.transition + ' out', settings.duration, function() {
  318. module.reset();
  319. callback();
  320. })
  321. ;
  322. }
  323. else {
  324. $popup
  325. .stop()
  326. .fadeOut(settings.duration, settings.easing, function() {
  327. module.reset();
  328. callback();
  329. })
  330. ;
  331. }
  332. $.proxy(settings.onHide, element)();
  333. }
  334. },
  335. get: {
  336. startEvent: function() {
  337. if(settings.on == 'hover') {
  338. return 'mouseenter';
  339. }
  340. else if(settings.on == 'focus') {
  341. return 'focus';
  342. }
  343. return false;
  344. },
  345. endEvent: function() {
  346. if(settings.on == 'hover') {
  347. return 'mouseleave';
  348. }
  349. else if(settings.on == 'focus') {
  350. return 'blur';
  351. }
  352. return false;
  353. },
  354. offstagePosition: function() {
  355. var
  356. boundary = {
  357. top : $(window).scrollTop(),
  358. bottom : $(window).scrollTop() + $(window).height(),
  359. left : 0,
  360. right : $(window).width()
  361. },
  362. popup = {
  363. width : $popup.width(),
  364. height : $popup.outerHeight(),
  365. position : $popup.offset()
  366. },
  367. offstage = {},
  368. offstagePositions = []
  369. ;
  370. if(popup.position) {
  371. offstage = {
  372. top : (popup.position.top < boundary.top),
  373. bottom : (popup.position.top + popup.height > boundary.bottom),
  374. right : (popup.position.left + popup.width > boundary.right),
  375. left : (popup.position.left < boundary.left)
  376. };
  377. }
  378. module.verbose('Checking if outside viewable area', popup.position);
  379. // return only boundaries that have been surpassed
  380. $.each(offstage, function(direction, isOffstage) {
  381. if(isOffstage) {
  382. offstagePositions.push(direction);
  383. }
  384. });
  385. return (offstagePositions.length > 0)
  386. ? offstagePositions.join(' ')
  387. : false
  388. ;
  389. },
  390. nextPosition: function(position) {
  391. switch(position) {
  392. case 'top left':
  393. position = 'bottom left';
  394. break;
  395. case 'bottom left':
  396. position = 'top right';
  397. break;
  398. case 'top right':
  399. position = 'bottom right';
  400. break;
  401. case 'bottom right':
  402. position = 'top center';
  403. break;
  404. case 'top center':
  405. position = 'bottom center';
  406. break;
  407. case 'bottom center':
  408. position = 'right center';
  409. break;
  410. case 'right center':
  411. position = 'left center';
  412. break;
  413. case 'left center':
  414. position = 'top center';
  415. break;
  416. }
  417. return position;
  418. }
  419. },
  420. set: {
  421. position: function(position, arrowOffset) {
  422. var
  423. windowWidth = $(window).width(),
  424. windowHeight = $(window).height(),
  425. width = $target.outerWidth(),
  426. height = $target.outerHeight(),
  427. popupWidth = $popup.width(),
  428. popupHeight = $popup.outerHeight(),
  429. parentWidth = $offsetParent.outerWidth(),
  430. parentHeight = $offsetParent.outerHeight(),
  431. distanceAway = settings.distanceAway,
  432. offset = (settings.inline)
  433. ? $target.position()
  434. : $target.offset(),
  435. positioning,
  436. offstagePosition
  437. ;
  438. position = position || $module.data(metadata.position) || settings.position;
  439. arrowOffset = arrowOffset || $module.data(metadata.offset) || settings.offset;
  440. // adjust for margin when inline
  441. if(settings.inline) {
  442. if(position == 'left center' || position == 'right center') {
  443. arrowOffset += parseInt( window.getComputedStyle(element).getPropertyValue('margin-top'), 10);
  444. distanceAway += -parseInt( window.getComputedStyle(element).getPropertyValue('margin-left'), 10);
  445. }
  446. else {
  447. arrowOffset += parseInt( window.getComputedStyle(element).getPropertyValue('margin-left'), 10);
  448. distanceAway += parseInt( window.getComputedStyle(element).getPropertyValue('margin-top'), 10);
  449. }
  450. }
  451. module.debug('Calculating offset for position', position);
  452. switch(position) {
  453. case 'top left':
  454. positioning = {
  455. top : 'auto',
  456. bottom : parentHeight - offset.top + distanceAway,
  457. left : offset.left + arrowOffset,
  458. right : 'auto'
  459. };
  460. break;
  461. case 'top center':
  462. positioning = {
  463. bottom : parentHeight - offset.top + distanceAway,
  464. left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
  465. top : 'auto',
  466. right : 'auto'
  467. };
  468. break;
  469. case 'top right':
  470. positioning = {
  471. bottom : parentHeight - offset.top + distanceAway,
  472. right : parentWidth - offset.left - width - arrowOffset,
  473. top : 'auto',
  474. left : 'auto'
  475. };
  476. break;
  477. case 'left center':
  478. positioning = {
  479. top : offset.top + (height / 2) - (popupHeight / 2) + arrowOffset,
  480. right : parentWidth - offset.left + distanceAway,
  481. left : 'auto',
  482. bottom : 'auto'
  483. };
  484. break;
  485. case 'right center':
  486. positioning = {
  487. top : offset.top + (height / 2) - (popupHeight / 2) + arrowOffset,
  488. left : offset.left + width + distanceAway,
  489. bottom : 'auto',
  490. right : 'auto'
  491. };
  492. break;
  493. case 'bottom left':
  494. positioning = {
  495. top : offset.top + height + distanceAway,
  496. left : offset.left + arrowOffset,
  497. bottom : 'auto',
  498. right : 'auto'
  499. };
  500. break;
  501. case 'bottom center':
  502. positioning = {
  503. top : offset.top + height + distanceAway,
  504. left : offset.left + (width / 2) - (popupWidth / 2) + arrowOffset,
  505. bottom : 'auto',
  506. right : 'auto'
  507. };
  508. break;
  509. case 'bottom right':
  510. positioning = {
  511. top : offset.top + height + distanceAway,
  512. right : parentWidth - offset.left - width - arrowOffset,
  513. left : 'auto',
  514. bottom : 'auto'
  515. };
  516. break;
  517. }
  518. if(positioning === undefined) {
  519. module.error(error.invalidPosition);
  520. }
  521. // tentatively place on stage
  522. $popup
  523. .css(positioning)
  524. .removeClass(className.position)
  525. .addClass(position)
  526. .addClass(className.loading)
  527. ;
  528. // check if is offstage
  529. offstagePosition = module.get.offstagePosition();
  530. // recursively find new positioning
  531. if(offstagePosition) {
  532. module.debug('Element is outside boundaries', offstagePosition);
  533. if(searchDepth < settings.maxSearchDepth) {
  534. position = module.get.nextPosition(position);
  535. searchDepth++;
  536. module.debug('Trying new position', position);
  537. return module.set.position(position);
  538. }
  539. else {
  540. module.error(error.recursion);
  541. searchDepth = 0;
  542. module.reset();
  543. $popup.removeClass(className.loading);
  544. return false;
  545. }
  546. }
  547. else {
  548. module.debug('Position is on stage', position);
  549. searchDepth = 0;
  550. $popup.removeClass(className.loading);
  551. return true;
  552. }
  553. }
  554. },
  555. bind: {
  556. popup: function() {
  557. if(settings.hoverable) {
  558. module.verbose('Allowing hover events on popup to prevent closing');
  559. $popup
  560. .on('mouseenter', module.event.start)
  561. .on('mouseleave', module.event.end)
  562. ;
  563. }
  564. },
  565. close:function() {
  566. if(settings.on == 'click' && settings.closable) {
  567. module.verbose('Binding popup close event to document');
  568. $document
  569. .on('click' + eventNamespace, function(event) {
  570. module.verbose('Pop-up clickaway intent detected');
  571. $.proxy(module.hideGracefully, this)(event);
  572. })
  573. ;
  574. }
  575. }
  576. },
  577. unbind: {
  578. close: function() {
  579. if(settings.on == 'click' && settings.closable) {
  580. module.verbose('Removing close event from document');
  581. $document
  582. .off('click' + eventNamespace)
  583. ;
  584. }
  585. }
  586. },
  587. is: {
  588. animating: function() {
  589. return ( $popup.is(':animated') || $popup.hasClass(className.animating) );
  590. },
  591. visible: function() {
  592. return $popup.is(':visible');
  593. },
  594. hidden: function() {
  595. return !module.is.visible();
  596. }
  597. },
  598. reset: function() {
  599. $popup
  600. .removeClass(className.visible)
  601. ;
  602. if(settings.preserve || settings.popup) {
  603. if($.fn.transition !== undefined) {
  604. $popup
  605. .transition('remove transition')
  606. ;
  607. }
  608. }
  609. else {
  610. module.remove();
  611. }
  612. },
  613. setting: function(name, value) {
  614. if( $.isPlainObject(name) ) {
  615. $.extend(true, settings, name);
  616. }
  617. else if(value !== undefined) {
  618. settings[name] = value;
  619. }
  620. else {
  621. return settings[name];
  622. }
  623. },
  624. internal: function(name, value) {
  625. if( $.isPlainObject(name) ) {
  626. $.extend(true, module, name);
  627. }
  628. else if(value !== undefined) {
  629. module[name] = value;
  630. }
  631. else {
  632. return module[name];
  633. }
  634. },
  635. debug: function() {
  636. if(settings.debug) {
  637. if(settings.performance) {
  638. module.performance.log(arguments);
  639. }
  640. else {
  641. module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
  642. module.debug.apply(console, arguments);
  643. }
  644. }
  645. },
  646. verbose: function() {
  647. if(settings.verbose && settings.debug) {
  648. if(settings.performance) {
  649. module.performance.log(arguments);
  650. }
  651. else {
  652. module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
  653. module.verbose.apply(console, arguments);
  654. }
  655. }
  656. },
  657. error: function() {
  658. module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
  659. module.error.apply(console, arguments);
  660. },
  661. performance: {
  662. log: function(message) {
  663. var
  664. currentTime,
  665. executionTime,
  666. previousTime
  667. ;
  668. if(settings.performance) {
  669. currentTime = new Date().getTime();
  670. previousTime = time || currentTime;
  671. executionTime = currentTime - previousTime;
  672. time = currentTime;
  673. performance.push({
  674. 'Element' : element,
  675. 'Name' : message[0],
  676. 'Arguments' : [].slice.call(message, 1) || '',
  677. 'Execution Time' : executionTime
  678. });
  679. }
  680. clearTimeout(module.performance.timer);
  681. module.performance.timer = setTimeout(module.performance.display, 100);
  682. },
  683. display: function() {
  684. var
  685. title = settings.name + ':',
  686. totalTime = 0
  687. ;
  688. time = false;
  689. clearTimeout(module.performance.timer);
  690. $.each(performance, function(index, data) {
  691. totalTime += data['Execution Time'];
  692. });
  693. title += ' ' + totalTime + 'ms';
  694. if(moduleSelector) {
  695. title += ' \'' + moduleSelector + '\'';
  696. }
  697. if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
  698. console.groupCollapsed(title);
  699. if(console.table) {
  700. console.table(performance);
  701. }
  702. else {
  703. $.each(performance, function(index, data) {
  704. console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
  705. });
  706. }
  707. console.groupEnd();
  708. }
  709. performance = [];
  710. }
  711. },
  712. invoke: function(query, passedArguments, context) {
  713. var
  714. object = instance,
  715. maxDepth,
  716. found,
  717. response
  718. ;
  719. passedArguments = passedArguments || queryArguments;
  720. context = element || context;
  721. if(typeof query == 'string' && object !== undefined) {
  722. query = query.split(/[\. ]/);
  723. maxDepth = query.length - 1;
  724. $.each(query, function(depth, value) {
  725. var camelCaseValue = (depth != maxDepth)
  726. ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
  727. : query
  728. ;
  729. if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
  730. object = object[camelCaseValue];
  731. }
  732. else if( object[camelCaseValue] !== undefined ) {
  733. found = object[camelCaseValue];
  734. return false;
  735. }
  736. else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
  737. object = object[value];
  738. }
  739. else if( object[value] !== undefined ) {
  740. found = object[value];
  741. return false;
  742. }
  743. else {
  744. return false;
  745. }
  746. });
  747. }
  748. if ( $.isFunction( found ) ) {
  749. response = found.apply(context, passedArguments);
  750. }
  751. else if(found !== undefined) {
  752. response = found;
  753. }
  754. if($.isArray(returnedValue)) {
  755. returnedValue.push(response);
  756. }
  757. else if(returnedValue !== undefined) {
  758. returnedValue = [returnedValue, response];
  759. }
  760. else if(response !== undefined) {
  761. returnedValue = response;
  762. }
  763. return found;
  764. }
  765. };
  766. if(methodInvoked) {
  767. if(instance === undefined) {
  768. module.initialize();
  769. }
  770. module.invoke(query);
  771. }
  772. else {
  773. if(instance !== undefined) {
  774. module.destroy();
  775. }
  776. module.initialize();
  777. }
  778. })
  779. ;
  780. return (returnedValue !== undefined)
  781. ? returnedValue
  782. : this
  783. ;
  784. };
  785. $.fn.popup.settings = {
  786. name : 'Popup',
  787. debug : true,
  788. verbose : true,
  789. performance : true,
  790. namespace : 'popup',
  791. onCreate : function(){},
  792. onRemove : function(){},
  793. onShow : function(){},
  794. onHide : function(){},
  795. variation : 'inverted',
  796. content : false,
  797. html : false,
  798. title : false,
  799. on : 'hover',
  800. closable : true,
  801. context : 'body',
  802. position : 'top center',
  803. delay : {
  804. show : 50,
  805. hide : 0
  806. },
  807. target : false,
  808. popup : false,
  809. inline : false,
  810. preserve : false,
  811. hoverable : false,
  812. duration : 200,
  813. easing : 'easeOutQuint',
  814. transition : 'scale',
  815. distanceAway : 0,
  816. offset : 0,
  817. maxSearchDepth : 10,
  818. error: {
  819. content : 'Your popup has no content specified',
  820. invalidPosition : 'The position you specified is not a valid position',
  821. method : 'The method you called is not defined.',
  822. recursion : 'Popup attempted to reposition element to fit, but could not find an adequate position.'
  823. },
  824. metadata: {
  825. content : 'content',
  826. html : 'html',
  827. offset : 'offset',
  828. position : 'position',
  829. title : 'title',
  830. variation : 'variation'
  831. },
  832. className : {
  833. animating : 'animating',
  834. loading : 'loading',
  835. popup : 'ui popup',
  836. position : 'top left center bottom right',
  837. visible : 'visible'
  838. },
  839. selector : {
  840. popup : '.ui.popup'
  841. },
  842. template: function(text) {
  843. var html = '';
  844. if(typeof text !== undefined) {
  845. if(typeof text.title !== undefined && text.title) {
  846. html += '<div class="header">' + text.title + '</div class="header">';
  847. }
  848. if(typeof text.content !== undefined && text.content) {
  849. html += '<div class="content">' + text.content + '</div>';
  850. }
  851. }
  852. return html;
  853. }
  854. };
  855. // Adds easing
  856. $.extend( $.easing, {
  857. easeOutQuad: function (x, t, b, c, d) {
  858. return -c *(t/=d)*(t-2) + b;
  859. }
  860. });
  861. })( jQuery, window , document );