fomantic-ui 2.9.1-beta.14 → 2.9.1-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +14 -12
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +15 -12
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +1 -1
- package/dist/components/calendar.js +21 -21
- package/dist/components/calendar.min.css +1 -1
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +7 -7
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +8 -8
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +23 -23
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +4 -4
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +1 -1
- package/dist/components/flyout.js +26 -24
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +1 -1
- package/dist/components/form.js +15 -15
- package/dist/components/form.min.css +1 -1
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +138 -8
- package/dist/components/input.min.css +2 -2
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +30 -28
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +6 -6
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +9 -9
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +8 -8
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +4 -4
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +12 -12
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +5 -5
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +9 -9
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +10 -15
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.js +18 -13
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +4 -4
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +4 -1
- package/dist/components/statistic.min.css +2 -2
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +10 -9
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +11 -11
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +28 -25
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +1 -1
- package/dist/components/transition.js +4 -4
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +5 -5
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +258 -57
- package/dist/semantic.js +307 -294
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/package.json +2 -2
- package/src/definitions/behaviors/api.js +14 -11
- package/src/definitions/behaviors/form.js +14 -14
- package/src/definitions/behaviors/state.js +3 -3
- package/src/definitions/behaviors/visibility.js +4 -4
- package/src/definitions/elements/input.less +14 -5
- package/src/definitions/globals/site.js +9 -14
- package/src/definitions/modules/accordion.js +13 -11
- package/src/definitions/modules/calendar.js +20 -20
- package/src/definitions/modules/checkbox.js +6 -6
- package/src/definitions/modules/dimmer.js +7 -7
- package/src/definitions/modules/dropdown.js +22 -22
- package/src/definitions/modules/embed.js +3 -3
- package/src/definitions/modules/flyout.js +25 -23
- package/src/definitions/modules/modal.js +29 -27
- package/src/definitions/modules/nag.js +5 -5
- package/src/definitions/modules/popup.js +8 -8
- package/src/definitions/modules/progress.js +7 -7
- package/src/definitions/modules/rating.js +3 -3
- package/src/definitions/modules/search.js +11 -11
- package/src/definitions/modules/shape.js +4 -4
- package/src/definitions/modules/sidebar.js +8 -8
- package/src/definitions/modules/slider.js +17 -12
- package/src/definitions/modules/sticky.js +9 -8
- package/src/definitions/modules/tab.js +10 -10
- package/src/definitions/modules/toast.js +27 -24
- package/src/definitions/modules/transition.js +3 -3
- package/src/definitions/views/statistic.less +5 -0
- package/src/themes/default/globals/variation.variables +1 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.16+7071e59 - Sticky
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
function isFunction(obj) {
|
16
16
|
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
-
}
|
17
|
+
}
|
18
18
|
|
19
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
20
20
|
? window
|
@@ -26,6 +26,7 @@ window = (typeof window != 'undefined' && window.Math == Math)
|
|
26
26
|
$.fn.sticky = function(parameters) {
|
27
27
|
var
|
28
28
|
$allModules = $(this),
|
29
|
+
$document = $(document),
|
29
30
|
moduleSelector = $allModules.selector || '',
|
30
31
|
|
31
32
|
time = new Date().getTime(),
|
@@ -53,7 +54,7 @@ $.fn.sticky = function(parameters) {
|
|
53
54
|
|
54
55
|
$module = $(this),
|
55
56
|
$window = $(window),
|
56
|
-
$scroll = [window,document].indexOf(settings.scrollContext) < 0 ? $
|
57
|
+
$scroll = [window,document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
|
57
58
|
$container,
|
58
59
|
$context,
|
59
60
|
|
@@ -139,7 +140,7 @@ $.fn.sticky = function(parameters) {
|
|
139
140
|
|
140
141
|
determineContainer: function() {
|
141
142
|
if(settings.container) {
|
142
|
-
$container = [window,document].indexOf(settings.container) < 0 ? $
|
143
|
+
$container = [window,document].indexOf(settings.container) < 0 ? $document.find(settings.container) : $(settings.container);
|
143
144
|
}
|
144
145
|
else {
|
145
146
|
$container = $module.offsetParent();
|
@@ -148,7 +149,7 @@ $.fn.sticky = function(parameters) {
|
|
148
149
|
|
149
150
|
determineContext: function() {
|
150
151
|
if(settings.context) {
|
151
|
-
$context = [window,document].indexOf(settings.context) < 0 ? $
|
152
|
+
$context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
|
152
153
|
}
|
153
154
|
else {
|
154
155
|
$context = $container;
|
@@ -430,13 +431,13 @@ $.fn.sticky = function(parameters) {
|
|
430
431
|
if( module.is.top() ) {
|
431
432
|
$module
|
432
433
|
.css('bottom', '')
|
433
|
-
.css('top', -scroll)
|
434
|
+
.css('top', (-scroll) + 'px')
|
434
435
|
;
|
435
436
|
}
|
436
437
|
if( module.is.bottom() ) {
|
437
438
|
$module
|
438
439
|
.css('top', '')
|
439
|
-
.css('bottom', scroll)
|
440
|
+
.css('bottom', scroll + 'px')
|
440
441
|
;
|
441
442
|
}
|
442
443
|
},
|
@@ -855,7 +856,7 @@ $.fn.sticky = function(parameters) {
|
|
855
856
|
}
|
856
857
|
});
|
857
858
|
}
|
858
|
-
if (
|
859
|
+
if ( isFunction( found ) ) {
|
859
860
|
response = found.apply(context, passedArguments);
|
860
861
|
}
|
861
862
|
else if(found !== undefined) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.9.1-beta.
|
2
|
+
* # Fomantic UI - 2.9.1-beta.16+7071e59
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(T,w,B,F){"use strict";T.isFunction=T.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},w=void 0!==w&&w.Math==Math?w:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),T.fn.sticky=function(b){var v,e=T(this),x=e.selector||"",C=(new Date).getTime(),S=[],y=b,k="string"==typeof y,z=[].slice.call(arguments,1);return e.each(function(){var t,n,e,o,c=T.isPlainObject(b)?T.extend(!0,{},T.fn.sticky.settings,b):T.extend({},T.fn.sticky.settings),i=c.className,s=c.namespace,r=c.error,l="."+s,a="module-"+s,f=T(this),m=T(w),u=[w,B].indexOf(c.scrollContext)<0?T(B).find(c.scrollContext):T(c.scrollContext),d=f.data(a),h=w.requestAnimationFrame||w.mozRequestAnimationFrame||w.webkitRequestAnimationFrame||w.msRequestAnimationFrame||function(e){setTimeout(e,0)},g=this,p={initialize:function(){p.determineContainer(),p.determineContext(),p.verbose("Initializing sticky",c,t),p.save.positions(),p.checkErrors(),p.bind.events(),c.observeChanges&&p.observeChanges(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),d=p,f.data(a,p)},destroy:function(){p.verbose("Destroying previous instance"),p.reset(),e&&e.disconnect(),o&&o.disconnect(),m.off("load"+l,p.event.load).off("resize"+l,p.event.resize),u.off("scrollchange"+l,p.event.scrollchange),f.removeData(a)},observeChanges:function(){"MutationObserver"in w&&(e=new MutationObserver(p.event.documentChanged),o=new MutationObserver(p.event.changed),e.observe(B,{childList:!0,subtree:!0}),o.observe(g,{childList:!0,subtree:!0}),o.observe(n[0],{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",o))},determineContainer:function(){t=c.container?[w,B].indexOf(c.container)<0?T(B).find(c.container):T(c.container):f.offsetParent()},determineContext:function(){0===(n=c.context?[w,B].indexOf(c.context)<0?T(B).find(c.context):T(c.context):t).length&&p.error(r.invalidContext,c.context,f)},checkErrors:function(){p.is.hidden()&&p.error(r.visible,f),p.cache.element.height>p.cache.context.height&&(p.reset(),p.error(r.elementSize,f))},bind:{events:function(){m.on("load"+l,p.event.load).on("resize"+l,p.event.resize),u.off("scroll"+l).on("scroll"+l,p.event.scroll).on("scrollchange"+l,p.event.scrollchange)}},event:{changed:function(e){clearTimeout(p.timer),p.timer=setTimeout(function(){p.verbose("DOM tree modified, updating sticky menu",e),p.refresh()},100)},documentChanged:function(e){[].forEach.call(e,function(e){e.removedNodes&&[].forEach.call(e.removedNodes,function(e){(e==g||0<T(e).find(g).length)&&(p.debug("Element removed from DOM, tearing down events"),p.destroy())})})},load:function(){p.verbose("Page contents finished loading"),h(p.refresh)},resize:function(){p.verbose("Window resized"),h(p.refresh)},scroll:function(){h(function(){u.triggerHandler("scrollchange"+l,u.scrollTop())})},scrollchange:function(e,t){p.stick(t),c.onScroll.call(g)}},refresh:function(e){p.reset(),c.context||p.determineContext(),e&&p.determineContainer(),p.save.positions(),p.stick(),c.onReposition.call(g)},supports:{sticky:function(){var e=T("<div/>");return e.addClass(i.supported),e.css("position").match("sticky")}},save:{lastScroll:function(e){p.lastScroll=e},elementScroll:function(e){p.elementScroll=e},positions:function(){var e={height:u.height()},t={margin:{top:parseInt(f.css("margin-top"),10),bottom:parseInt(f.css("margin-bottom"),10)},offset:f.offset(),width:f.outerWidth(),height:f.outerHeight()},o={offset:n.offset(),height:n.outerHeight()};p.is.standardScroll()||(p.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=u.scrollTop(),e.left=u.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),p.cache={fits:t.height+c.offset<=e.height,sameHeight:t.height==o.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},p.set.containerSize(),p.stick(),p.debug("Caching element positions",p.cache)}},get:{direction:function(e){var t="down";return e=e||u.scrollTop(),t=p.lastScroll&&p.lastScroll>e?"up":t},scrollChange:function(e){return e=e||u.scrollTop(),p.lastScroll?e-p.lastScroll:0},currentElementScroll:function(){return p.elementScroll||(p.is.top()?Math.abs(parseInt(f.css("top"),10))||0:Math.abs(parseInt(f.css("bottom"),10))||0)},elementScroll:function(e){e=e||u.scrollTop();var t=p.cache.element,o=p.cache.scrollContext,e=p.get.scrollChange(e),t=t.height-o.height+c.offset,o=p.get.currentElementScroll(),e=o+e;return o=p.cache.fits||e<0?0:t<e?t:e}},remove:{lastScroll:function(){delete p.lastScroll},elementScroll:function(){delete p.elementScroll},minimumSize:function(){t.css("min-height","")},offset:function(){f.css("margin-top","")}},set:{offset:function(){p.verbose("Setting offset on element",c.offset),f.css("margin-top",c.offset)},containerSize:function(){var e=t[0].tagName;"HTML"===e||"body"===e?p.determineContainer():((e=Math.max(p.cache.context.height,p.cache.element.height))-t.outerHeight()>c.jitter?(p.debug("Context is taller than container. Specifying exact height for container",p.cache.context.height),t.css({height:e})):t.css({height:""}),Math.abs(t.outerHeight()-p.cache.context.height)>c.jitter&&(p.debug("Context has padding, specifying exact height for container",p.cache.context.height),t.css({height:p.cache.context.height})))},minimumSize:function(){var e=p.cache.element;t.css("min-height",e.height)},scroll:function(e){p.debug("Setting scroll on element",e),p.elementScroll!=e&&(p.is.top()&&f.css("bottom","").css("top",-e),p.is.bottom()&&f.css("top","").css("bottom",e))},size:function(){0!==p.cache.element.height&&0!==p.cache.element.width&&(g.style.setProperty("width",p.cache.element.width+"px","important"),g.style.setProperty("height",p.cache.element.height+"px","important"))}},is:{standardScroll:function(){return u[0]==w},top:function(){return f.hasClass(i.top)},bottom:function(){return f.hasClass(i.bottom)},initialPosition:function(){return!p.is.fixed()&&!p.is.bound()},hidden:function(){return!f.is(":visible")},bound:function(){return f.hasClass(i.bound)},fixed:function(){return f.hasClass(i.fixed)}},stick:function(e){var e=e||u.scrollTop(),t=p.cache,o=t.fits,n=t.sameHeight,i=t.element,s=t.scrollContext,t=t.context,r=p.is.bottom()&&c.pushing?c.bottomOffset:c.offset,e={top:e+r,bottom:e+r+s.height},r=o?0:p.get.elementScroll(e.top),s=!o;0===i.height||n||(p.is.initialPosition()?e.top>=t.bottom?(p.debug("Initial element position is bottom of container"),p.bindBottom()):e.top>i.top&&(i.height+e.top-r>=t.bottom&&i.height<t.height?(p.debug("Initial element position is bottom of container"),p.bindBottom()):(p.debug("Initial element position is fixed"),p.fixTop())):p.is.fixed()?p.is.top()?e.top<=i.top?(p.debug("Fixed element reached top of container"),p.setInitialPosition()):i.height+e.top-r>=t.bottom?(p.debug("Fixed element reached bottom of container"),p.bindBottom()):s&&(p.set.scroll(r),p.save.lastScroll(e.top),p.save.elementScroll(r)):p.is.bottom()&&(e.bottom-i.height<=i.top?(p.debug("Bottom fixed rail has reached top of container"),p.setInitialPosition()):e.bottom>=t.bottom?(p.debug("Bottom fixed rail has reached bottom of container"),p.bindBottom()):s&&(p.set.scroll(r),p.save.lastScroll(e.top),p.save.elementScroll(r))):p.is.bottom()&&(e.top<=i.top?(p.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),p.setInitialPosition()):c.pushing?p.is.bound()&&e.bottom<=t.bottom&&(p.debug("Fixing bottom attached element to bottom of browser."),p.fixBottom()):p.is.bound()&&e.top<=t.bottom-i.height&&(p.debug("Fixing bottom attached element to top of browser."),p.fixTop())))},bindTop:function(){p.debug("Binding element to top of parent container"),p.remove.offset(),c.setSize&&p.set.size(),f.css({left:"",top:"",marginBottom:""}).removeClass(i.fixed).removeClass(i.bottom).addClass(i.bound).addClass(i.top),c.onTop.call(g),c.onUnstick.call(g)},bindBottom:function(){p.debug("Binding element to bottom of parent container"),p.remove.offset(),c.setSize&&p.set.size(),f.css({left:"",top:""}).removeClass(i.fixed).removeClass(i.top).addClass(i.bound).addClass(i.bottom),c.onBottom.call(g),c.onUnstick.call(g)},setInitialPosition:function(){p.debug("Returning to initial position"),p.unfix(),p.unbind()},fixTop:function(){p.debug("Fixing element to top of page"),c.setSize&&p.set.size(),p.set.minimumSize(),p.set.offset(),f.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(i.bound).removeClass(i.bottom).addClass(i.fixed).addClass(i.top),c.onStick.call(g)},fixBottom:function(){p.debug("Sticking element to bottom of page"),c.setSize&&p.set.size(),p.set.minimumSize(),p.set.offset(),f.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(i.bound).removeClass(i.top).addClass(i.fixed).addClass(i.bottom),c.onStick.call(g)},unbind:function(){p.is.bound()&&(p.debug("Removing container bound position on element"),p.remove.offset(),f.removeClass(i.bound).removeClass(i.top).removeClass(i.bottom))},unfix:function(){p.is.fixed()&&(p.debug("Removing fixed position on element"),p.remove.minimumSize(),p.remove.offset(),f.removeClass(i.fixed).removeClass(i.top).removeClass(i.bottom),c.onUnstick.call(g))},reset:function(){p.debug("Resetting elements position"),p.unbind(),p.unfix(),p.resetCSS(),p.remove.offset(),p.remove.lastScroll()},resetCSS:function(){f.css({width:"",height:""}),t.css({height:""})},setting:function(e,t){if(T.isPlainObject(e))T.extend(!0,c,e);else{if(t===F)return c[e];c[e]=t}},internal:function(e,t){if(T.isPlainObject(e))T.extend(!0,p,e);else{if(t===F)return p[e];p[e]=t}},debug:function(){!c.silent&&c.debug&&(c.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,c.name+":"),p.debug.apply(console,arguments)))},verbose:function(){!c.silent&&c.verbose&&c.debug&&(c.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),p.verbose.apply(console,arguments)))},error:function(){c.silent||(p.error=Function.prototype.bind.call(console.error,console,c.name+":"),p.error.apply(console,arguments))},performance:{log:function(e){var t,o;c.performance&&(o=(t=(new Date).getTime())-(C||t),C=t,S.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:g,"Execution Time":o})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,0)},display:function(){var e=c.name+":",o=0;C=!1,clearTimeout(p.performance.timer),T.each(S,function(e,t){o+=t["Execution Time"]}),e+=" "+o+"ms",x&&(e+=" '"+x+"'"),(console.group!==F||console.table!==F)&&0<S.length&&(console.groupCollapsed(e),console.table?console.table(S):T.each(S,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),S=[]}},invoke:function(n,e,t){var i,s,o,r=d;return e=e||z,t=t||g,"string"==typeof n&&r!==F&&(n=n.split(/[\. ]/),i=n.length-1,T.each(n,function(e,t){var o=e!=i?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(T.isPlainObject(r[o])&&e!=i)r=r[o];else{if(r[o]!==F)return s=r[o],!1;{if(!T.isPlainObject(r[t])||e==i)return r[t]!==F&&(s=r[t]),!1;r=r[t]}}})),T.isFunction(s)?o=s.apply(t,e):s!==F&&(o=s),Array.isArray(v)?v.push(o):v!==F?v=[v,o]:o!==F&&(v=o),s}};k?(d===F&&p.initialize(),p.invoke(y)):(d!==F&&d.invoke("destroy"),p.initialize())}),v!==F?v:this},T.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:w,offset:0,bottomOffset:0,jitter:5,setSize:!0,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
|
11
|
+
!function(w,B,O,P){"use strict";B=void 0!==B&&B.Math==Math?B:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),w.fn.sticky=function(b){var v,e=w(this),x=w(O),C=e.selector||"",S=(new Date).getTime(),y=[],k=b,z="string"==typeof k,T=[].slice.call(arguments,1);return e.each(function(){var t,n,e,o,c=w.isPlainObject(b)?w.extend(!0,{},w.fn.sticky.settings,b):w.extend({},w.fn.sticky.settings),i=c.className,s=c.namespace,r=c.error,l="."+s,a="module-"+s,f=w(this),m=w(B),u=[B,O].indexOf(c.scrollContext)<0?x.find(c.scrollContext):w(c.scrollContext),d=f.data(a),h=B.requestAnimationFrame||B.mozRequestAnimationFrame||B.webkitRequestAnimationFrame||B.msRequestAnimationFrame||function(e){setTimeout(e,0)},g=this,p={initialize:function(){p.determineContainer(),p.determineContext(),p.verbose("Initializing sticky",c,t),p.save.positions(),p.checkErrors(),p.bind.events(),c.observeChanges&&p.observeChanges(),p.instantiate()},instantiate:function(){p.verbose("Storing instance of module",p),d=p,f.data(a,p)},destroy:function(){p.verbose("Destroying previous instance"),p.reset(),e&&e.disconnect(),o&&o.disconnect(),m.off("load"+l,p.event.load).off("resize"+l,p.event.resize),u.off("scrollchange"+l,p.event.scrollchange),f.removeData(a)},observeChanges:function(){"MutationObserver"in B&&(e=new MutationObserver(p.event.documentChanged),o=new MutationObserver(p.event.changed),e.observe(O,{childList:!0,subtree:!0}),o.observe(g,{childList:!0,subtree:!0}),o.observe(n[0],{childList:!0,subtree:!0}),p.debug("Setting up mutation observer",o))},determineContainer:function(){t=c.container?[B,O].indexOf(c.container)<0?x.find(c.container):w(c.container):f.offsetParent()},determineContext:function(){0===(n=c.context?[B,O].indexOf(c.context)<0?x.find(c.context):w(c.context):t).length&&p.error(r.invalidContext,c.context,f)},checkErrors:function(){p.is.hidden()&&p.error(r.visible,f),p.cache.element.height>p.cache.context.height&&(p.reset(),p.error(r.elementSize,f))},bind:{events:function(){m.on("load"+l,p.event.load).on("resize"+l,p.event.resize),u.off("scroll"+l).on("scroll"+l,p.event.scroll).on("scrollchange"+l,p.event.scrollchange)}},event:{changed:function(e){clearTimeout(p.timer),p.timer=setTimeout(function(){p.verbose("DOM tree modified, updating sticky menu",e),p.refresh()},100)},documentChanged:function(e){[].forEach.call(e,function(e){e.removedNodes&&[].forEach.call(e.removedNodes,function(e){(e==g||0<w(e).find(g).length)&&(p.debug("Element removed from DOM, tearing down events"),p.destroy())})})},load:function(){p.verbose("Page contents finished loading"),h(p.refresh)},resize:function(){p.verbose("Window resized"),h(p.refresh)},scroll:function(){h(function(){u.triggerHandler("scrollchange"+l,u.scrollTop())})},scrollchange:function(e,t){p.stick(t),c.onScroll.call(g)}},refresh:function(e){p.reset(),c.context||p.determineContext(),e&&p.determineContainer(),p.save.positions(),p.stick(),c.onReposition.call(g)},supports:{sticky:function(){var e=w("<div/>");return e.addClass(i.supported),e.css("position").match("sticky")}},save:{lastScroll:function(e){p.lastScroll=e},elementScroll:function(e){p.elementScroll=e},positions:function(){var e={height:u.height()},t={margin:{top:parseInt(f.css("margin-top"),10),bottom:parseInt(f.css("margin-bottom"),10)},offset:f.offset(),width:f.outerWidth(),height:f.outerHeight()},o={offset:n.offset(),height:n.outerHeight()};p.is.standardScroll()||(p.debug("Non-standard scroll. Removing scroll offset from element offset"),e.top=u.scrollTop(),e.left=u.scrollLeft(),t.offset.top+=e.top,o.offset.top+=e.top,t.offset.left+=e.left,o.offset.left+=e.left),p.cache={fits:t.height+c.offset<=e.height,sameHeight:t.height==o.height,scrollContext:{height:e.height},element:{margin:t.margin,top:t.offset.top-t.margin.top,left:t.offset.left,width:t.width,height:t.height,bottom:t.offset.top+t.height},context:{top:o.offset.top,height:o.height,bottom:o.offset.top+o.height}},p.set.containerSize(),p.stick(),p.debug("Caching element positions",p.cache)}},get:{direction:function(e){var t="down";return e=e||u.scrollTop(),t=p.lastScroll&&p.lastScroll>e?"up":t},scrollChange:function(e){return e=e||u.scrollTop(),p.lastScroll?e-p.lastScroll:0},currentElementScroll:function(){return p.elementScroll||(p.is.top()?Math.abs(parseInt(f.css("top"),10))||0:Math.abs(parseInt(f.css("bottom"),10))||0)},elementScroll:function(e){e=e||u.scrollTop();var t=p.cache.element,o=p.cache.scrollContext,e=p.get.scrollChange(e),t=t.height-o.height+c.offset,o=p.get.currentElementScroll(),e=o+e;return o=p.cache.fits||e<0?0:t<e?t:e}},remove:{lastScroll:function(){delete p.lastScroll},elementScroll:function(){delete p.elementScroll},minimumSize:function(){t.css("min-height","")},offset:function(){f.css("margin-top","")}},set:{offset:function(){p.verbose("Setting offset on element",c.offset),f.css("margin-top",c.offset)},containerSize:function(){var e=t[0].tagName;"HTML"===e||"body"===e?p.determineContainer():((e=Math.max(p.cache.context.height,p.cache.element.height))-t.outerHeight()>c.jitter?(p.debug("Context is taller than container. Specifying exact height for container",p.cache.context.height),t.css({height:e})):t.css({height:""}),Math.abs(t.outerHeight()-p.cache.context.height)>c.jitter&&(p.debug("Context has padding, specifying exact height for container",p.cache.context.height),t.css({height:p.cache.context.height})))},minimumSize:function(){var e=p.cache.element;t.css("min-height",e.height)},scroll:function(e){p.debug("Setting scroll on element",e),p.elementScroll!=e&&(p.is.top()&&f.css("bottom","").css("top",-e+"px"),p.is.bottom()&&f.css("top","").css("bottom",e+"px"))},size:function(){0!==p.cache.element.height&&0!==p.cache.element.width&&(g.style.setProperty("width",p.cache.element.width+"px","important"),g.style.setProperty("height",p.cache.element.height+"px","important"))}},is:{standardScroll:function(){return u[0]==B},top:function(){return f.hasClass(i.top)},bottom:function(){return f.hasClass(i.bottom)},initialPosition:function(){return!p.is.fixed()&&!p.is.bound()},hidden:function(){return!f.is(":visible")},bound:function(){return f.hasClass(i.bound)},fixed:function(){return f.hasClass(i.fixed)}},stick:function(e){var e=e||u.scrollTop(),t=p.cache,o=t.fits,n=t.sameHeight,i=t.element,s=t.scrollContext,t=t.context,r=p.is.bottom()&&c.pushing?c.bottomOffset:c.offset,e={top:e+r,bottom:e+r+s.height},r=o?0:p.get.elementScroll(e.top),s=!o;0===i.height||n||(p.is.initialPosition()?e.top>=t.bottom?(p.debug("Initial element position is bottom of container"),p.bindBottom()):e.top>i.top&&(i.height+e.top-r>=t.bottom&&i.height<t.height?(p.debug("Initial element position is bottom of container"),p.bindBottom()):(p.debug("Initial element position is fixed"),p.fixTop())):p.is.fixed()?p.is.top()?e.top<=i.top?(p.debug("Fixed element reached top of container"),p.setInitialPosition()):i.height+e.top-r>=t.bottom?(p.debug("Fixed element reached bottom of container"),p.bindBottom()):s&&(p.set.scroll(r),p.save.lastScroll(e.top),p.save.elementScroll(r)):p.is.bottom()&&(e.bottom-i.height<=i.top?(p.debug("Bottom fixed rail has reached top of container"),p.setInitialPosition()):e.bottom>=t.bottom?(p.debug("Bottom fixed rail has reached bottom of container"),p.bindBottom()):s&&(p.set.scroll(r),p.save.lastScroll(e.top),p.save.elementScroll(r))):p.is.bottom()&&(e.top<=i.top?(p.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"),p.setInitialPosition()):c.pushing?p.is.bound()&&e.bottom<=t.bottom&&(p.debug("Fixing bottom attached element to bottom of browser."),p.fixBottom()):p.is.bound()&&e.top<=t.bottom-i.height&&(p.debug("Fixing bottom attached element to top of browser."),p.fixTop())))},bindTop:function(){p.debug("Binding element to top of parent container"),p.remove.offset(),c.setSize&&p.set.size(),f.css({left:"",top:"",marginBottom:""}).removeClass(i.fixed).removeClass(i.bottom).addClass(i.bound).addClass(i.top),c.onTop.call(g),c.onUnstick.call(g)},bindBottom:function(){p.debug("Binding element to bottom of parent container"),p.remove.offset(),c.setSize&&p.set.size(),f.css({left:"",top:""}).removeClass(i.fixed).removeClass(i.top).addClass(i.bound).addClass(i.bottom),c.onBottom.call(g),c.onUnstick.call(g)},setInitialPosition:function(){p.debug("Returning to initial position"),p.unfix(),p.unbind()},fixTop:function(){p.debug("Fixing element to top of page"),c.setSize&&p.set.size(),p.set.minimumSize(),p.set.offset(),f.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(i.bound).removeClass(i.bottom).addClass(i.fixed).addClass(i.top),c.onStick.call(g)},fixBottom:function(){p.debug("Sticking element to bottom of page"),c.setSize&&p.set.size(),p.set.minimumSize(),p.set.offset(),f.css({left:p.cache.element.left,bottom:"",marginBottom:""}).removeClass(i.bound).removeClass(i.top).addClass(i.fixed).addClass(i.bottom),c.onStick.call(g)},unbind:function(){p.is.bound()&&(p.debug("Removing container bound position on element"),p.remove.offset(),f.removeClass(i.bound).removeClass(i.top).removeClass(i.bottom))},unfix:function(){p.is.fixed()&&(p.debug("Removing fixed position on element"),p.remove.minimumSize(),p.remove.offset(),f.removeClass(i.fixed).removeClass(i.top).removeClass(i.bottom),c.onUnstick.call(g))},reset:function(){p.debug("Resetting elements position"),p.unbind(),p.unfix(),p.resetCSS(),p.remove.offset(),p.remove.lastScroll()},resetCSS:function(){f.css({width:"",height:""}),t.css({height:""})},setting:function(e,t){if(w.isPlainObject(e))w.extend(!0,c,e);else{if(t===P)return c[e];c[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,p,e);else{if(t===P)return p[e];p[e]=t}},debug:function(){!c.silent&&c.debug&&(c.performance?p.performance.log(arguments):(p.debug=Function.prototype.bind.call(console.info,console,c.name+":"),p.debug.apply(console,arguments)))},verbose:function(){!c.silent&&c.verbose&&c.debug&&(c.performance?p.performance.log(arguments):(p.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),p.verbose.apply(console,arguments)))},error:function(){c.silent||(p.error=Function.prototype.bind.call(console.error,console,c.name+":"),p.error.apply(console,arguments))},performance:{log:function(e){var t,o;c.performance&&(o=(t=(new Date).getTime())-(S||t),S=t,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:g,"Execution Time":o})),clearTimeout(p.performance.timer),p.performance.timer=setTimeout(p.performance.display,0)},display:function(){var e=c.name+":",o=0;S=!1,clearTimeout(p.performance.timer),w.each(y,function(e,t){o+=t["Execution Time"]}),e+=" "+o+"ms",C&&(e+=" '"+C+"'"),(console.group!==P||console.table!==P)&&0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):w.each(y,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(n,e,t){var i,s,o,r,c=d;return e=e||T,t=t||g,"string"==typeof n&&c!==P&&(n=n.split(/[\. ]/),i=n.length-1,w.each(n,function(e,t){var o=e!=i?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(w.isPlainObject(c[o])&&e!=i)c=c[o];else{if(c[o]!==P)return s=c[o],!1;{if(!w.isPlainObject(c[t])||e==i)return c[t]!==P&&(s=c[t]),!1;c=c[t]}}})),"function"==typeof(r=s)&&"number"!=typeof r.nodeType?o=s.apply(t,e):s!==P&&(o=s),Array.isArray(v)?v.push(o):v!==P?v=[v,o]:o!==P&&(v=o),s}};z?(d===P&&p.initialize(),p.invoke(k)):(d!==P&&d.invoke("destroy"),p.initialize())}),v!==P?v:this},w.fn.sticky.settings={name:"Sticky",namespace:"sticky",silent:!1,debug:!1,verbose:!0,performance:!0,pushing:!1,context:!1,container:!1,scrollContext:B,offset:0,bottomOffset:0,jitter:5,setSize:!0,observeChanges:!1,onReposition:function(){},onScroll:function(){},onStick:function(){},onUnstick:function(){},onTop:function(){},onBottom:function(){},error:{container:"Sticky element must be inside a relative container",visible:"Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.",method:"The method you called is not defined.",invalidContext:"Context specified does not exist",elementSize:"Sticky element is larger than its container, cannot create sticky."},className:{bound:"bound",fixed:"fixed",supported:"native",top:"top",bottom:"bottom"}}}(jQuery,window,document);
|
package/dist/components/tab.css
CHANGED
package/dist/components/tab.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.16+7071e59 - Tab
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -12,12 +12,12 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
function isWindow(obj) {
|
16
16
|
return obj != null && obj === obj.window;
|
17
|
-
}
|
18
|
-
|
17
|
+
}
|
18
|
+
function isFunction(obj) {
|
19
19
|
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
20
|
-
}
|
20
|
+
}
|
21
21
|
|
22
22
|
window = (typeof window != 'undefined' && window.Math == Math)
|
23
23
|
? window
|
@@ -30,10 +30,10 @@ $.fn.tab = function(parameters) {
|
|
30
30
|
|
31
31
|
var
|
32
32
|
// use window context if none specified
|
33
|
-
$allModules =
|
33
|
+
$allModules = isFunction(this)
|
34
34
|
? $(window)
|
35
35
|
: $(this),
|
36
|
-
|
36
|
+
$document = $(document),
|
37
37
|
moduleSelector = $allModules.selector || '',
|
38
38
|
time = new Date().getTime(),
|
39
39
|
performance = [],
|
@@ -135,7 +135,7 @@ $.fn.tab = function(parameters) {
|
|
135
135
|
bind: {
|
136
136
|
events: function() {
|
137
137
|
// if using $.tab don't add events
|
138
|
-
if(
|
138
|
+
if( !isWindow( element ) ) {
|
139
139
|
module.debug('Attaching tab activation events to element', $module);
|
140
140
|
$module
|
141
141
|
.on('click' + eventNamespace, module.event.click)
|
@@ -162,7 +162,7 @@ $.fn.tab = function(parameters) {
|
|
162
162
|
module.verbose('Determined parent element for creating context', $context);
|
163
163
|
}
|
164
164
|
else if(settings.context) {
|
165
|
-
$context = [window,document].indexOf(settings.context) < 0 ? $
|
165
|
+
$context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
|
166
166
|
module.verbose('Using selector for tab context', settings.context, $context);
|
167
167
|
}
|
168
168
|
else {
|
@@ -453,7 +453,7 @@ $.fn.tab = function(parameters) {
|
|
453
453
|
;
|
454
454
|
if(scrollOffset !== false) {
|
455
455
|
module.debug('Forcing scroll to an in-page link in a hidden tab', scrollOffset, $element);
|
456
|
-
$
|
456
|
+
$document.scrollTop(scrollOffset);
|
457
457
|
}
|
458
458
|
},
|
459
459
|
|
@@ -897,7 +897,7 @@ $.fn.tab = function(parameters) {
|
|
897
897
|
}
|
898
898
|
});
|
899
899
|
}
|
900
|
-
if (
|
900
|
+
if ( isFunction( found ) ) {
|
901
901
|
response = found.apply(context, passedArguments);
|
902
902
|
}
|
903
903
|
else if(found !== undefined) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.9.1-beta.
|
2
|
+
* # Fomantic UI - 2.9.1-beta.16+7071e59
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(O,j,k,I){"use strict";O.isWindow=O.isWindow||function(e){return null!=e&&e===e.window},O.isFunction=O.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},j=void 0!==j&&j.Math==Math?j:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),O.fn.tab=function(c){var l,d=O.isFunction(this)?O(j):O(this),u=d.selector||"",g=(new Date).getTime(),P=[],F=c,w="string"==typeof F,S=[].slice.call(arguments,1),E=!1;return d.each(function(){var b,i,f,h,p,v=O.isPlainObject(c)?O.extend(!0,{},O.fn.tab.settings,c):O.extend({},O.fn.tab.settings),m=v.className,y=v.metadata,t=v.selector,T=v.error,a=v.regExp,e="."+v.namespace,n="module-"+v.namespace,L=O(this),o={},x=!0,r=0,A=this,s=L.data(n),C={initialize:function(){C.debug("Initializing tab menu item",L),C.fix.callbacks(),C.determineTabs(),C.debug("Determining tabs",v.context,i),v.auto&&C.set.auto(),C.bind.events(),v.history&&!E&&(C.initializeHistory(),E=!0);var e,t=C.determine.activeTab();v.autoTabActivation&&s===I&&null==t&&(t=!0===v.autoTabActivation?C.get.initialPath():v.autoTabActivation,C.debug("No active tab detected, setting tab active",t),C.changeTab(t)),null!=t&&v.history&&(e=O.address.autoUpdate(),O.address.autoUpdate(!1),O.address.value(t),O.address.autoUpdate(e)),C.instantiate()},instantiate:function(){C.verbose("Storing instance of module",C),s=C,L.data(n,C)},destroy:function(){C.debug("Destroying tabs",L),L.removeData(n).off(e)},bind:{events:function(){O.isWindow(A)||(C.debug("Attaching tab activation events to element",L),L.on("click"+e,C.event.click))}},determineTabs:function(){var e;"parent"===v.context?(0<L.closest(t.ui).length?(e=L.closest(t.ui),C.verbose("Using closest UI element as parent",e)):e=L,b=e.parent(),C.verbose("Determined parent element for creating context",b)):v.context?(b=[j,k].indexOf(v.context)<0?O(k).find(v.context):O(v.context),C.verbose("Using selector for tab context",v.context,b)):b=O("body"),v.childrenOnly?(i=b.children(t.tabs),C.debug("Searching tab context children for tabs",b,i)):(i=b.find(t.tabs),C.debug("Searching tab context for tabs",b,i))},fix:{callbacks:function(){O.isPlainObject(c)&&(c.onTabLoad||c.onTabInit)&&(c.onTabLoad&&(c.onLoad=c.onTabLoad,delete c.onTabLoad,C.error(T.legacyLoad,c.onLoad)),c.onTabInit&&(c.onFirstLoad=c.onTabInit,delete c.onTabInit,C.error(T.legacyInit,c.onFirstLoad)),v=O.extend(!0,{},O.fn.tab.settings,c))}},initializeHistory:function(){if(C.debug("Initializing page state"),O.address===I)return C.error(T.state),!1;if("state"==v.historyType){if(C.debug("Using HTML5 to manage state"),!1===v.path)return C.error(T.path),!1;O.address.history(!0).state(v.path),O(j).trigger("popstate")}O.address.bind("change",C.event.history.change)},event:{click:function(e){var t=O(this).data(y.tab);t!==I?(v.history?(C.verbose("Updating page state",e),O.address.value(t)):(C.verbose("Changing tab",e),C.changeTab(t)),e.preventDefault()):C.debug("No tab specified")},history:{change:function(e){var t=e.pathNames.join("/")||C.get.initialPath(),a=v.templates.determineTitle(t)||!1;C.performance.display(),C.debug("History change event",t,e),p=e,t!==I&&C.changeTab(t),a&&O.address.title(a)}}},refresh:function(){f&&(C.debug("Refreshing tab",f),C.changeTab(f))},cache:{read:function(e){return e!==I&&o[e]},add:function(e,t){e=e||f,C.debug("Adding cached content for",e),o[e]=t},remove:function(e){e=e||f,C.debug("Removing cached content for",e),delete o[e]}},escape:{string:function(e){return(e=String(e)).replace(a.escape,"\\$&")}},set:{auto:function(){var e="string"==typeof v.path?v.path.replace(/\/$/,"")+"/{$tab}":"/{$tab}";C.verbose("Setting up automatic tab retrieval from server",e),O.isPlainObject(v.apiSettings)?v.apiSettings.url=e:v.apiSettings={url:e}},loading:function(e){var t=C.get.tabElement(e);t.hasClass(m.loading)||(C.verbose("Setting loading state for",t),t.addClass(m.loading).siblings(i).removeClass(m.active+" "+m.loading),0<t.length&&v.onRequest.call(t[0],e))},state:function(e){O.address.value(e)}},changeTab:function(l){var d=j.history&&j.history.pushState&&v.ignoreFirstLoad&&x,u=v.auto||O.isPlainObject(v.apiSettings),g=u&&!d?C.utilities.pathToArray(l):C.get.defaultPathArray(l);l=C.utilities.arrayToPath(g),O.each(g,function(e,t){var a,n,i=g.slice(0,e+1),o=C.utilities.arrayToPath(i),r=C.is.tab(o),s=e+1==g.length,c=C.get.tabElement(o);return C.verbose("Looking for tab",t),r?(C.verbose("Tab was found",t),f=o,h=C.utilities.filterArray(g,i),s?n=!0:(r=g.slice(0,e+2),t=C.utilities.arrayToPath(r),(n=!C.is.tab(t))&&C.verbose("Tab parameters found",r)),!1===v.onBeforeChange.call(A,o)?(C.debug("onBeforeChange returned false, cancelling tab change",c),!1):n&&u?(d?(C.debug("Ignoring remote content on first tab load",o),x=!1,C.cache.add(l,c.html()),C.activate.all(o),v.onFirstLoad.call(c[0],o,h,p),v.onLoad.call(c[0],o,h,p)):(C.activate.navigation(o),C.fetch.content(o,l)),!1):(C.debug("Opened local tab",o),C.activate.all(o),C.cache.read(o)||(C.cache.add(o,!0),C.debug("First time tab loaded calling tab init"),v.onFirstLoad.call(c[0],o,h,p)),void v.onLoad.call(c[0],o,h,p))):-1!=l.search("/")||""===l?(C.error(T.missingTab,L,b,o),!1):(l=C.escape.string(l),o=(a=O("#"+l+', a[name="'+l+'"]')).closest("[data-tab]").data(y.tab),c=C.get.tabElement(o),a&&0<a.length&&o?(C.debug("Anchor link used, opening parent tab",c,a),!1===v.onBeforeChange.call(A,o)?C.debug("onBeforeChange returned false, cancelling tab change",c):(c.hasClass(m.active)||setTimeout(function(){C.scrollTo(a)},0),C.activate.all(o),C.cache.read(o)||(C.cache.add(o,!0),C.debug("First time tab loaded calling tab init"),v.onFirstLoad.call(c[0],o,h,p)),v.onLoad.call(c[0],o,h,p)),!1):void 0)})},scrollTo:function(e){var t=!!(e&&0<e.length)&&e.offset().top;!1!==t&&(C.debug("Forcing scroll to an in-page link in a hidden tab",t,e),O(k).scrollTop(t))},update:{content:function(e,t,a){var n=C.get.tabElement(e),i=n[0];a=a!==I?a:v.evaluateScripts,"string"==typeof v.cacheType&&"dom"==v.cacheType.toLowerCase()&&"string"!=typeof t?n.empty().append(O(t).clone(!0)):a?(C.debug("Updating HTML and evaluating inline scripts",e,t),n.html(t)):(C.debug("Updating HTML",e,t),i.innerHTML=t)}},fetch:{content:function(t,a){var e,n=C.get.tabElement(t),i={dataType:"html",encodeParameters:!1,on:"now",cache:v.alwaysRefresh,headers:{"X-Remote":!0},onSuccess:function(e){"response"==v.cacheType&&C.cache.add(a,e),C.update.content(t,e),t==f?(C.debug("Content loaded",t),C.activate.tab(t)):C.debug("Content loaded in background",t),v.onFirstLoad.call(n[0],t,h,p),v.onLoad.call(n[0],t,h,p),v.loadOnce?C.cache.add(a,!0):"string"==typeof v.cacheType&&"dom"==v.cacheType.toLowerCase()&&0<n.children().length?setTimeout(function(){var e=(e=n.children().clone(!0)).not("script");C.cache.add(a,e)},0):C.cache.add(a,n.html())},urlData:{tab:a}},o=n.api("get request")||!1,o=o&&"pending"===o.state();a=a||t,e=C.cache.read(a),v.cache&&e?(C.activate.tab(t),C.debug("Adding cached content",a),v.loadOnce||("once"==v.evaluateScripts?C.update.content(t,e,!1):C.update.content(t,e)),v.onLoad.call(n[0],t,h,p)):o?(C.set.loading(t),C.debug("Content is already loading",a)):O.api!==I?(e=O.extend(!0,{},v.apiSettings,i),C.debug("Retrieving remote content",a,e),C.set.loading(t),n.api(e)):C.error(T.api)}},activate:{all:function(e){C.activate.tab(e),C.activate.navigation(e)},tab:function(e){var t=C.get.tabElement(e),a="siblings"==v.deactivate?t.siblings(i):i.not(t),n=t.hasClass(m.active);C.verbose("Showing tab content for",t),n||(t.addClass(m.active),a.removeClass(m.active+" "+m.loading),0<t.length&&v.onVisible.call(t[0],e))},navigation:function(e){var t=C.get.navElement(e),a="siblings"==v.deactivate?t.siblings(d):d.not(t),n=t.hasClass(m.active);C.verbose("Activating tab navigation for",t,e),n||(t.addClass(m.active),a.removeClass(m.active+" "+m.loading))}},deactivate:{all:function(){C.deactivate.navigation(),C.deactivate.tabs()},navigation:function(){d.removeClass(m.active)},tabs:function(){i.removeClass(m.active+" "+m.loading)}},is:{tab:function(e){return e!==I&&0<C.get.tabElement(e).length}},get:{initialPath:function(){return d.eq(0).data(y.tab)||i.eq(0).data(y.tab)},path:function(){return O.address.value()},defaultPathArray:function(e){return C.utilities.pathToArray(C.get.defaultPath(e))},defaultPath:function(e){var t=d.filter("[data-"+y.tab+'^="'+C.escape.string(e)+'/"]').eq(0).data(y.tab)||!1;if(t){if(C.debug("Found default tab",t),r<v.maxDepth)return r++,C.get.defaultPath(t);C.error(T.recursion)}else C.debug("No default tabs found for",e,i);return r=0,e},navElement:function(e){return e=e||f,d.filter("[data-"+y.tab+'="'+C.escape.string(e)+'"]')},tabElement:function(e){var t;return e=e||f,t=C.utilities.pathToArray(e),t=C.utilities.last(t),e=i.filter("[data-"+y.tab+'="'+C.escape.string(e)+'"]'),t=i.filter("[data-"+y.tab+'="'+C.escape.string(t)+'"]'),0<e.length?e:t},tab:function(){return f}},determine:{activeTab:function(){var a=null;return i.each(function(e,t){O(t).hasClass(m.active)&&(t=O(this).data(y.tab),d.filter("[data-"+y.tab+'="'+C.escape.string(t)+'"]').hasClass(m.active)&&(a=t))}),a}},utilities:{filterArray:function(e,t){return O.grep(e,function(e){return-1==O.inArray(e,t)})},last:function(e){return!!Array.isArray(e)&&e[e.length-1]},pathToArray:function(e){return"string"==typeof(e=e===I?f:e)?e.split("/"):[e]},arrayToPath:function(e){return!!Array.isArray(e)&&e.join("/")}},setting:function(e,t){if(C.debug("Changing setting",e,t),O.isPlainObject(e))O.extend(!0,v,e);else{if(t===I)return v[e];O.isPlainObject(v[e])?O.extend(!0,v[e],t):v[e]=t}},internal:function(e,t){if(O.isPlainObject(e))O.extend(!0,C,e);else{if(t===I)return C[e];C[e]=t}},debug:function(){!v.silent&&v.debug&&(v.performance?C.performance.log(arguments):(C.debug=Function.prototype.bind.call(console.info,console,v.name+":"),C.debug.apply(console,arguments)))},verbose:function(){!v.silent&&v.verbose&&v.debug&&(v.performance?C.performance.log(arguments):(C.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),C.verbose.apply(console,arguments)))},error:function(){v.silent||(C.error=Function.prototype.bind.call(console.error,console,v.name+":"),C.error.apply(console,arguments))},performance:{log:function(e){var t,a;v.performance&&(a=(t=(new Date).getTime())-(g||t),g=t,P.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":a})),clearTimeout(C.performance.timer),C.performance.timer=setTimeout(C.performance.display,500)},display:function(){var e=v.name+":",a=0;g=!1,clearTimeout(C.performance.timer),O.each(P,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",u&&(e+=" '"+u+"'"),(console.group!==I||console.table!==I)&&0<P.length&&(console.groupCollapsed(e),console.table?console.table(P):O.each(P,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),P=[]}},invoke:function(n,e,t){var i,o,a,r=s;return e=e||S,t=t||A,"string"==typeof n&&r!==I&&(n=n.split(/[\. ]/),i=n.length-1,O.each(n,function(e,t){var a=e!=i?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(O.isPlainObject(r[a])&&e!=i)r=r[a];else{if(r[a]!==I)return o=r[a],!1;{if(!O.isPlainObject(r[t])||e==i)return r[t]!==I?o=r[t]:C.error(T.method,n),!1;r=r[t]}}})),O.isFunction(o)?a=o.apply(t,e):o!==I&&(a=o),Array.isArray(l)?l.push(a):l!==I?l=[l,a]:a!==I&&(l=a),o}};w?(s===I&&C.initialize(),C.invoke(F)):(s!==I&&s.invoke("destroy"),C.initialize())}),l!==I?l:this},O.tab=function(){O(j).tab.apply(this,arguments)},O.fn.tab.settings={name:"Tab",namespace:"tab",silent:!1,debug:!1,verbose:!1,performance:!0,auto:!1,history:!1,historyType:"hash",path:!1,context:!1,childrenOnly:!1,maxDepth:25,deactivate:"siblings",alwaysRefresh:!1,cache:!0,loadOnce:!1,cacheType:"response",ignoreFirstLoad:!1,apiSettings:!1,evaluateScripts:"once",autoTabActivation:!0,onFirstLoad:function(e,t,a){},onLoad:function(e,t,a){},onVisible:function(e,t,a){},onRequest:function(e,t,a){},onBeforeChange:function(e){},templates:{determineTitle:function(e){}},error:{api:"You attempted to load content without API module",method:"The method you called is not defined",missingTab:"Activated tab cannot be found. Tabs are case-sensitive.",noContent:"The tab you specified is missing a content url.",path:"History enabled, but no path was specified",recursion:"Max recursive depth reached",legacyInit:"onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",legacyLoad:"onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",state:"History requires Asual's Address library <https://github.com/asual/jquery-address>"},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s:=@]/g},metadata:{tab:"tab",loaded:"loaded",promise:"promise"},className:{loading:"loading",active:"active"},selector:{tabs:".ui.tab",ui:".ui"}}}(jQuery,window,document);
|
11
|
+
!function(w,k,I,U){"use strict";function D(e){return"function"==typeof e&&"number"!=typeof e.nodeType}k=void 0!==k&&k.Math==Math?k:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),w.fn.tab=function(c){var l,d=D(this)?w(k):w(this),u=w(I),g=d.selector||"",P=(new Date).getTime(),F=[],S=c,E="string"==typeof S,O=[].slice.call(arguments,1),j=!1;return d.each(function(){var b,i,f,h,p,v=w.isPlainObject(c)?w.extend(!0,{},w.fn.tab.settings,c):w.extend({},w.fn.tab.settings),m=v.className,y=v.metadata,t=v.selector,T=v.error,a=v.regExp,n="."+v.namespace,e="module-"+v.namespace,L=w(this),o={},x=!0,r=0,A=this,s=L.data(e),C={initialize:function(){C.debug("Initializing tab menu item",L),C.fix.callbacks(),C.determineTabs(),C.debug("Determining tabs",v.context,i),v.auto&&C.set.auto(),C.bind.events(),v.history&&!j&&(C.initializeHistory(),j=!0);var e,t=C.determine.activeTab();v.autoTabActivation&&s===U&&null==t&&(t=!0===v.autoTabActivation?C.get.initialPath():v.autoTabActivation,C.debug("No active tab detected, setting tab active",t),C.changeTab(t)),null!=t&&v.history&&(e=w.address.autoUpdate(),w.address.autoUpdate(!1),w.address.value(t),w.address.autoUpdate(e)),C.instantiate()},instantiate:function(){C.verbose("Storing instance of module",C),s=C,L.data(e,C)},destroy:function(){C.debug("Destroying tabs",L),L.removeData(e).off(n)},bind:{events:function(){var e;null!=(e=A)&&e===e.window||(C.debug("Attaching tab activation events to element",L),L.on("click"+n,C.event.click))}},determineTabs:function(){var e;"parent"===v.context?(0<L.closest(t.ui).length?(e=L.closest(t.ui),C.verbose("Using closest UI element as parent",e)):e=L,b=e.parent(),C.verbose("Determined parent element for creating context",b)):v.context?(b=[k,I].indexOf(v.context)<0?u.find(v.context):w(v.context),C.verbose("Using selector for tab context",v.context,b)):b=w("body"),v.childrenOnly?(i=b.children(t.tabs),C.debug("Searching tab context children for tabs",b,i)):(i=b.find(t.tabs),C.debug("Searching tab context for tabs",b,i))},fix:{callbacks:function(){w.isPlainObject(c)&&(c.onTabLoad||c.onTabInit)&&(c.onTabLoad&&(c.onLoad=c.onTabLoad,delete c.onTabLoad,C.error(T.legacyLoad,c.onLoad)),c.onTabInit&&(c.onFirstLoad=c.onTabInit,delete c.onTabInit,C.error(T.legacyInit,c.onFirstLoad)),v=w.extend(!0,{},w.fn.tab.settings,c))}},initializeHistory:function(){if(C.debug("Initializing page state"),w.address===U)return C.error(T.state),!1;if("state"==v.historyType){if(C.debug("Using HTML5 to manage state"),!1===v.path)return C.error(T.path),!1;w.address.history(!0).state(v.path),w(k).trigger("popstate")}w.address.bind("change",C.event.history.change)},event:{click:function(e){var t=w(this).data(y.tab);t!==U?(v.history?(C.verbose("Updating page state",e),w.address.value(t)):(C.verbose("Changing tab",e),C.changeTab(t)),e.preventDefault()):C.debug("No tab specified")},history:{change:function(e){var t=e.pathNames.join("/")||C.get.initialPath(),a=v.templates.determineTitle(t)||!1;C.performance.display(),C.debug("History change event",t,e),p=e,t!==U&&C.changeTab(t),a&&w.address.title(a)}}},refresh:function(){f&&(C.debug("Refreshing tab",f),C.changeTab(f))},cache:{read:function(e){return e!==U&&o[e]},add:function(e,t){e=e||f,C.debug("Adding cached content for",e),o[e]=t},remove:function(e){e=e||f,C.debug("Removing cached content for",e),delete o[e]}},escape:{string:function(e){return(e=String(e)).replace(a.escape,"\\$&")}},set:{auto:function(){var e="string"==typeof v.path?v.path.replace(/\/$/,"")+"/{$tab}":"/{$tab}";C.verbose("Setting up automatic tab retrieval from server",e),w.isPlainObject(v.apiSettings)?v.apiSettings.url=e:v.apiSettings={url:e}},loading:function(e){var t=C.get.tabElement(e);t.hasClass(m.loading)||(C.verbose("Setting loading state for",t),t.addClass(m.loading).siblings(i).removeClass(m.active+" "+m.loading),0<t.length&&v.onRequest.call(t[0],e))},state:function(e){w.address.value(e)}},changeTab:function(l){var d=k.history&&k.history.pushState&&v.ignoreFirstLoad&&x,u=v.auto||w.isPlainObject(v.apiSettings),g=u&&!d?C.utilities.pathToArray(l):C.get.defaultPathArray(l);l=C.utilities.arrayToPath(g),w.each(g,function(e,t){var a,n,i=g.slice(0,e+1),o=C.utilities.arrayToPath(i),r=C.is.tab(o),s=e+1==g.length,c=C.get.tabElement(o);return C.verbose("Looking for tab",t),r?(C.verbose("Tab was found",t),f=o,h=C.utilities.filterArray(g,i),s?n=!0:(r=g.slice(0,e+2),t=C.utilities.arrayToPath(r),(n=!C.is.tab(t))&&C.verbose("Tab parameters found",r)),!1===v.onBeforeChange.call(A,o)?(C.debug("onBeforeChange returned false, cancelling tab change",c),!1):n&&u?(d?(C.debug("Ignoring remote content on first tab load",o),x=!1,C.cache.add(l,c.html()),C.activate.all(o),v.onFirstLoad.call(c[0],o,h,p),v.onLoad.call(c[0],o,h,p)):(C.activate.navigation(o),C.fetch.content(o,l)),!1):(C.debug("Opened local tab",o),C.activate.all(o),C.cache.read(o)||(C.cache.add(o,!0),C.debug("First time tab loaded calling tab init"),v.onFirstLoad.call(c[0],o,h,p)),void v.onLoad.call(c[0],o,h,p))):-1!=l.search("/")||""===l?(C.error(T.missingTab,L,b,o),!1):(l=C.escape.string(l),o=(a=w("#"+l+', a[name="'+l+'"]')).closest("[data-tab]").data(y.tab),c=C.get.tabElement(o),a&&0<a.length&&o?(C.debug("Anchor link used, opening parent tab",c,a),!1===v.onBeforeChange.call(A,o)?C.debug("onBeforeChange returned false, cancelling tab change",c):(c.hasClass(m.active)||setTimeout(function(){C.scrollTo(a)},0),C.activate.all(o),C.cache.read(o)||(C.cache.add(o,!0),C.debug("First time tab loaded calling tab init"),v.onFirstLoad.call(c[0],o,h,p)),v.onLoad.call(c[0],o,h,p)),!1):void 0)})},scrollTo:function(e){var t=!!(e&&0<e.length)&&e.offset().top;!1!==t&&(C.debug("Forcing scroll to an in-page link in a hidden tab",t,e),u.scrollTop(t))},update:{content:function(e,t,a){var n=C.get.tabElement(e),i=n[0];a=a!==U?a:v.evaluateScripts,"string"==typeof v.cacheType&&"dom"==v.cacheType.toLowerCase()&&"string"!=typeof t?n.empty().append(w(t).clone(!0)):a?(C.debug("Updating HTML and evaluating inline scripts",e,t),n.html(t)):(C.debug("Updating HTML",e,t),i.innerHTML=t)}},fetch:{content:function(t,a){var e,n=C.get.tabElement(t),i={dataType:"html",encodeParameters:!1,on:"now",cache:v.alwaysRefresh,headers:{"X-Remote":!0},onSuccess:function(e){"response"==v.cacheType&&C.cache.add(a,e),C.update.content(t,e),t==f?(C.debug("Content loaded",t),C.activate.tab(t)):C.debug("Content loaded in background",t),v.onFirstLoad.call(n[0],t,h,p),v.onLoad.call(n[0],t,h,p),v.loadOnce?C.cache.add(a,!0):"string"==typeof v.cacheType&&"dom"==v.cacheType.toLowerCase()&&0<n.children().length?setTimeout(function(){var e=(e=n.children().clone(!0)).not("script");C.cache.add(a,e)},0):C.cache.add(a,n.html())},urlData:{tab:a}},o=n.api("get request")||!1,o=o&&"pending"===o.state();a=a||t,e=C.cache.read(a),v.cache&&e?(C.activate.tab(t),C.debug("Adding cached content",a),v.loadOnce||("once"==v.evaluateScripts?C.update.content(t,e,!1):C.update.content(t,e)),v.onLoad.call(n[0],t,h,p)):o?(C.set.loading(t),C.debug("Content is already loading",a)):w.api!==U?(e=w.extend(!0,{},v.apiSettings,i),C.debug("Retrieving remote content",a,e),C.set.loading(t),n.api(e)):C.error(T.api)}},activate:{all:function(e){C.activate.tab(e),C.activate.navigation(e)},tab:function(e){var t=C.get.tabElement(e),a="siblings"==v.deactivate?t.siblings(i):i.not(t),n=t.hasClass(m.active);C.verbose("Showing tab content for",t),n||(t.addClass(m.active),a.removeClass(m.active+" "+m.loading),0<t.length&&v.onVisible.call(t[0],e))},navigation:function(e){var t=C.get.navElement(e),a="siblings"==v.deactivate?t.siblings(d):d.not(t),n=t.hasClass(m.active);C.verbose("Activating tab navigation for",t,e),n||(t.addClass(m.active),a.removeClass(m.active+" "+m.loading))}},deactivate:{all:function(){C.deactivate.navigation(),C.deactivate.tabs()},navigation:function(){d.removeClass(m.active)},tabs:function(){i.removeClass(m.active+" "+m.loading)}},is:{tab:function(e){return e!==U&&0<C.get.tabElement(e).length}},get:{initialPath:function(){return d.eq(0).data(y.tab)||i.eq(0).data(y.tab)},path:function(){return w.address.value()},defaultPathArray:function(e){return C.utilities.pathToArray(C.get.defaultPath(e))},defaultPath:function(e){var t=d.filter("[data-"+y.tab+'^="'+C.escape.string(e)+'/"]').eq(0).data(y.tab)||!1;if(t){if(C.debug("Found default tab",t),r<v.maxDepth)return r++,C.get.defaultPath(t);C.error(T.recursion)}else C.debug("No default tabs found for",e,i);return r=0,e},navElement:function(e){return e=e||f,d.filter("[data-"+y.tab+'="'+C.escape.string(e)+'"]')},tabElement:function(e){var t;return e=e||f,t=C.utilities.pathToArray(e),t=C.utilities.last(t),e=i.filter("[data-"+y.tab+'="'+C.escape.string(e)+'"]'),t=i.filter("[data-"+y.tab+'="'+C.escape.string(t)+'"]'),0<e.length?e:t},tab:function(){return f}},determine:{activeTab:function(){var a=null;return i.each(function(e,t){w(t).hasClass(m.active)&&(t=w(this).data(y.tab),d.filter("[data-"+y.tab+'="'+C.escape.string(t)+'"]').hasClass(m.active)&&(a=t))}),a}},utilities:{filterArray:function(e,t){return w.grep(e,function(e){return-1==w.inArray(e,t)})},last:function(e){return!!Array.isArray(e)&&e[e.length-1]},pathToArray:function(e){return"string"==typeof(e=e===U?f:e)?e.split("/"):[e]},arrayToPath:function(e){return!!Array.isArray(e)&&e.join("/")}},setting:function(e,t){if(C.debug("Changing setting",e,t),w.isPlainObject(e))w.extend(!0,v,e);else{if(t===U)return v[e];w.isPlainObject(v[e])?w.extend(!0,v[e],t):v[e]=t}},internal:function(e,t){if(w.isPlainObject(e))w.extend(!0,C,e);else{if(t===U)return C[e];C[e]=t}},debug:function(){!v.silent&&v.debug&&(v.performance?C.performance.log(arguments):(C.debug=Function.prototype.bind.call(console.info,console,v.name+":"),C.debug.apply(console,arguments)))},verbose:function(){!v.silent&&v.verbose&&v.debug&&(v.performance?C.performance.log(arguments):(C.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),C.verbose.apply(console,arguments)))},error:function(){v.silent||(C.error=Function.prototype.bind.call(console.error,console,v.name+":"),C.error.apply(console,arguments))},performance:{log:function(e){var t,a;v.performance&&(a=(t=(new Date).getTime())-(P||t),P=t,F.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:A,"Execution Time":a})),clearTimeout(C.performance.timer),C.performance.timer=setTimeout(C.performance.display,500)},display:function(){var e=v.name+":",a=0;P=!1,clearTimeout(C.performance.timer),w.each(F,function(e,t){a+=t["Execution Time"]}),e+=" "+a+"ms",g&&(e+=" '"+g+"'"),(console.group!==U||console.table!==U)&&0<F.length&&(console.groupCollapsed(e),console.table?console.table(F):w.each(F,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),F=[]}},invoke:function(n,e,t){var i,o,a,r=s;return e=e||O,t=t||A,"string"==typeof n&&r!==U&&(n=n.split(/[\. ]/),i=n.length-1,w.each(n,function(e,t){var a=e!=i?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(w.isPlainObject(r[a])&&e!=i)r=r[a];else{if(r[a]!==U)return o=r[a],!1;{if(!w.isPlainObject(r[t])||e==i)return r[t]!==U?o=r[t]:C.error(T.method,n),!1;r=r[t]}}})),D(o)?a=o.apply(t,e):o!==U&&(a=o),Array.isArray(l)?l.push(a):l!==U?l=[l,a]:a!==U&&(l=a),o}};E?(s===U&&C.initialize(),C.invoke(S)):(s!==U&&s.invoke("destroy"),C.initialize())}),l!==U?l:this},w.tab=function(){w(k).tab.apply(this,arguments)},w.fn.tab.settings={name:"Tab",namespace:"tab",silent:!1,debug:!1,verbose:!1,performance:!0,auto:!1,history:!1,historyType:"hash",path:!1,context:!1,childrenOnly:!1,maxDepth:25,deactivate:"siblings",alwaysRefresh:!1,cache:!0,loadOnce:!1,cacheType:"response",ignoreFirstLoad:!1,apiSettings:!1,evaluateScripts:"once",autoTabActivation:!0,onFirstLoad:function(e,t,a){},onLoad:function(e,t,a){},onVisible:function(e,t,a){},onRequest:function(e,t,a){},onBeforeChange:function(e){},templates:{determineTitle:function(e){}},error:{api:"You attempted to load content without API module",method:"The method you called is not defined",missingTab:"Activated tab cannot be found. Tabs are case-sensitive.",noContent:"The tab you specified is missing a content url.",path:"History enabled, but no path was specified",recursion:"Max recursive depth reached",legacyInit:"onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",legacyLoad:"onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",state:"History requires Asual's Address library <https://github.com/asual/jquery-address>"},regExp:{escape:/[-[\]{}()*+?.,\\^$|#\s:=@]/g},metadata:{tab:"tab",loaded:"loaded",promise:"promise"},className:{loading:"loading",active:"active"},selector:{tabs:".ui.tab",ui:".ui"}}}(jQuery,window,document);
|
package/dist/components/text.css
CHANGED
package/dist/components/toast.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.16+7071e59 - Toast
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
function isFunction(obj) {
|
16
16
|
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
-
}
|
17
|
+
}
|
18
18
|
|
19
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
20
20
|
? window
|
@@ -195,7 +195,7 @@ $.toast = $.fn.toast = function(parameters) {
|
|
195
195
|
.addClass(settings.class + ' ' + className.toast)
|
196
196
|
.append($content)
|
197
197
|
;
|
198
|
-
$toast.css('opacity', settings.opacity);
|
198
|
+
$toast.css('opacity', String(settings.opacity));
|
199
199
|
if (settings.closeIcon) {
|
200
200
|
$close = $('<i/>', {class: className.close + ' ' + (typeof settings.closeIcon === 'string' ? settings.closeIcon : ''), role: 'button', tabindex: 0, 'aria-label': settings.text.close});
|
201
201
|
if($close.hasClass(className.left)) {
|
@@ -243,17 +243,19 @@ $.toast = $.fn.toast = function(parameters) {
|
|
243
243
|
var icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
|
244
244
|
text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
|
245
245
|
cls = module.helpers.deQuote(el[fields.class] || ''),
|
246
|
-
click = el[fields.click] &&
|
246
|
+
click = el[fields.click] && isFunction(el[fields.click]) ? el[fields.click] : function () {};
|
247
247
|
$actions.append($('<button/>', {
|
248
248
|
html: icon + text,
|
249
249
|
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
|
250
250
|
class: className.button + ' ' + cls,
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
251
|
+
on: {
|
252
|
+
click: function () {
|
253
|
+
var $button = $(this);
|
254
|
+
if ($button.is(selector.approve) || $button.is(selector.deny) || click.call(element, $module) === false) {
|
255
|
+
return;
|
256
|
+
}
|
257
|
+
module.close();
|
255
258
|
}
|
256
|
-
module.close();
|
257
259
|
}
|
258
260
|
}));
|
259
261
|
});
|
@@ -382,7 +384,7 @@ $.toast = $.fn.toast = function(parameters) {
|
|
382
384
|
|
383
385
|
animate: {
|
384
386
|
show: function(callback) {
|
385
|
-
callback =
|
387
|
+
callback = isFunction(callback) ? callback : function(){};
|
386
388
|
if(settings.transition && module.can.useElement('transition') && $module.transition('is supported')) {
|
387
389
|
module.set.visible();
|
388
390
|
$toastBox
|
@@ -402,7 +404,7 @@ $.toast = $.fn.toast = function(parameters) {
|
|
402
404
|
}
|
403
405
|
},
|
404
406
|
close: function(callback) {
|
405
|
-
callback =
|
407
|
+
callback = isFunction(callback) ? callback : function(){};
|
406
408
|
if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
|
407
409
|
$toastBox
|
408
410
|
.transition({
|
@@ -415,10 +417,10 @@ $.toast = $.fn.toast = function(parameters) {
|
|
415
417
|
interval : 50,
|
416
418
|
|
417
419
|
onBeforeHide: function(callback){
|
418
|
-
callback =
|
420
|
+
callback = isFunction(callback)?callback : function(){};
|
419
421
|
if(settings.transition.closeEasing !== ''){
|
420
422
|
if($toastBox) {
|
421
|
-
$toastBox.css('opacity', 0);
|
423
|
+
$toastBox.css('opacity', '0');
|
422
424
|
$toastBox.wrap('<div/>').parent().hide(settings.transition.closeDuration, settings.transition.closeEasing, function () {
|
423
425
|
if ($toastBox) {
|
424
426
|
$toastBox.parent().remove();
|
@@ -736,7 +738,7 @@ $.toast = $.fn.toast = function(parameters) {
|
|
736
738
|
}
|
737
739
|
});
|
738
740
|
}
|
739
|
-
if (
|
741
|
+
if ( isFunction( found ) ) {
|
740
742
|
response = found.apply(context, passedArguments);
|
741
743
|
}
|
742
744
|
else if(found !== undefined) {
|
@@ -906,16 +908,17 @@ $.fn.toast.settings = {
|
|
906
908
|
};
|
907
909
|
|
908
910
|
$.extend( $.easing, {
|
909
|
-
easeOutBounce: function (x
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
911
|
+
easeOutBounce: function (x) {
|
912
|
+
var n1 = 7.5625, d1 = 2.75;
|
913
|
+
if (x < 1 / d1) {
|
914
|
+
return n1 * x * x;
|
915
|
+
} else if (x < 2 / d1) {
|
916
|
+
return n1 * (x -= 1.5 / d1) * x + 0.75;
|
917
|
+
} else if (x < 2.5 / d1) {
|
918
|
+
return n1 * (x -= 2.25 / d1) * x + 0.9375;
|
919
|
+
} else {
|
920
|
+
return n1 * (x -= 2.625 / d1) * x + 0.984375;
|
921
|
+
}
|
919
922
|
},
|
920
923
|
easeOutCubic: function (t) {
|
921
924
|
return (--t)*t*t+1;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.9.1-beta.
|
2
|
+
* # Fomantic UI - 2.9.1-beta.16+7071e59
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(D,E,H,z){"use strict";D.isFunction=D.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},E=void 0!==E&&E.Math==Math?E:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),D.toast=D.fn.toast=function(x){var k,e=D(this),T=e.selector||"",I=(new Date).getTime(),P=[],M=x,O="string"==typeof M,A=[].slice.call(arguments,1);return e.each(function(){var t,o,a,s,i,c,l,e,r=D.isPlainObject(x)?D.extend(!0,{},D.fn.toast.settings,x):D.extend({},D.fn.toast.settings),u=r.className,d=r.selector,p=r.error,n=r.namespace,f=r.fields,g="."+n,m=n+"-module",h=D(this),b=r.context?[E,H].indexOf(r.context)<0?D(H).find(r.context):D(r.context):D("body"),v=h.hasClass("toast")||h.hasClass("message")||h.hasClass("card"),C=this,y=v?h.data(m):z,w={initialize:function(){w.verbose("Initializing element"),w.create.id(),w.has.container()||w.create.container(),(v||""!==r.message||""!==r.title||""!==w.get.iconClass()||r.showImage||w.has.configActions())&&("string"==typeof r.showProgress&&-1!==[u.top,u.bottom].indexOf(r.showProgress)||(r.showProgress=!1),w.create.toast(),r.closeOnClick&&(r.closeIcon||0<D(o).find(d.input).length||w.has.configActions())&&(r.closeOnClick=!1),r.closeOnClick||t.addClass(u.unclickable),w.bind.events()),w.instantiate(),t&&w.show()},instantiate:function(){w.verbose("Storing instance of toast"),y=w,h.data(m,y)},destroy:function(){t&&(w.debug("Removing toast",t),w.unbind.events(),t.remove(),c=o=t=z,r.onRemove.call(t,C),l=i=s=z),h.removeData(m)},show:function(e){!1===r.onShow.call(t,C)?w.debug("onShow callback returned false, cancelling toast animation"):(e=e||function(){},w.debug("Showing toast"),w.animate.show(e))},close:function(e){!1===r.onHide.call(t,C)?w.debug("onHide callback returned false, cancelling toast animation"):(e=e||function(){},w.debug("Closing toast"),w.remove.visible(),w.unbind.events(),w.animate.close(e))},create:{container:function(){w.verbose("Creating container"),b.append(D("<div/>",{class:r.position+" "+u.container+" "+(r.horizontal?u.horizontal:"")+" "+(r.context&&"body"!==r.context?u.absolute:"")}))},id:function(){e=(Math.random().toString(16)+"000000000").slice(2,10),w.verbose("Creating unique id for element",e)},toast:function(){t=D("<div/>",{class:u.box});var e,n=w.get.iconClass();v?(o=r.cloneModule?h.clone().removeAttr("id"):h,l=o.find("> i"+w.helpers.toClass(u.close)),r.closeIcon=0<l.length,""!==n&&o.find(d.icon).attr("class",n+" "+u.icon),r.showImage&&o.find(d.image).attr("src",r.showImage),""!==r.title&&o.find(d.title).html(w.helpers.escape(r.title,r.preserveHTML)),""!==r.message&&o.find(d.message).html(w.helpers.escape(r.message,r.preserveHTML))):(w.verbose("Creating toast"),o=D("<div/>",{role:"alert"}),e=D("<div/>",{class:u.content}),""!==n&&o.append(D("<i/>",{class:n+" "+u.icon})),r.showImage&&o.append(D("<img>",{class:u.image+" "+r.classImage,src:r.showImage})),""!==r.title&&(n="_"+w.get.id()+"title",o.attr("aria-labelledby",n),e.append(D("<div/>",{class:u.title,id:n,html:w.helpers.escape(r.title,r.preserveHTML)}))),n="_"+w.get.id()+"desc",o.attr("aria-describedby",n),e.append(D("<div/>",{class:u.message,id:n,html:w.helpers.escape(r.message,r.preserveHTML)})),o.addClass(r.class+" "+u.toast).append(e),o.css("opacity",r.opacity),r.closeIcon&&((l=D("<i/>",{class:u.close+" "+("string"==typeof r.closeIcon?r.closeIcon:""),role:"button",tabindex:0,"aria-label":r.text.close})).hasClass(u.left)?o.prepend(l):o.append(l))),o.hasClass(u.compact)&&(r.compact=!0),o.hasClass("card")&&(r.compact=!1),a=o.find(".actions"),w.has.configActions()&&(0===a.length&&(a=D("<div/>",{class:u.actions+" "+(r.classActions||"")}).appendTo(o)),o.hasClass("card")&&!a.hasClass(u.attached)&&(a.addClass(u.extraContent),a.hasClass(u.vertical)&&(a.removeClass(u.vertical),w.error(p.verticalCard))),r.actions.forEach(function(e){var n=e[f.icon]?"<i "+(e[f.text]?'aria-hidden="true"':"")+' class="'+w.helpers.deQuote(e[f.icon])+' icon"></i>':"",t=w.helpers.escape(e[f.text]||"",r.preserveHTML),o=w.helpers.deQuote(e[f.class]||""),s=e[f.click]&&D.isFunction(e[f.click])?e[f.click]:function(){};a.append(D("<button/>",{html:n+t,"aria-label":(e[f.text]||e[f.icon]||"").replace(/<[^>]+(>|$)/g,""),class:u.button+" "+o,click:function(){var e=D(this);e.is(d.approve)||e.is(d.deny)||!1===s.call(C,h)||w.close()}}))})),a&&a.hasClass(u.vertical)&&o.addClass(u.vertical),0<a.length&&!a.hasClass(u.attached)&&(!a||a.hasClass(u.basic)&&!a.hasClass(u.left)||o.addClass(u.actions)),"auto"===r.displayTime&&(r.displayTime=Math.max(r.minDisplayTime,o.text().split(" ").length/r.wordsPerMinute*6e4)),t.append(o),0<a.length&&a.hasClass(u.attached)&&(a.addClass(u.buttons),a.detach(),o.addClass(u.attached),a.hasClass(u.vertical)?(o.wrap(D("<div/>",{class:u.vertical+" "+u.attached+" "+(r.compact?u.compact:"")})),a.hasClass(u.left)?o.addClass(u.left).parent().addClass(u.left).prepend(a):o.parent().append(a)):a.hasClass(u.top)?(t.prepend(a),o.addClass(u.bottom)):(t.append(a),o.addClass(u.top))),h!==o&&(C=(h=o)[0]),0<r.displayTime&&(n=u.progressing+" "+(r.pauseOnHover?u.pausable:""),r.showProgress&&(s=D("<div/>",{class:u.progress+" "+(r.classProgress||r.class),"data-percent":""}),r.classProgress||(o.hasClass("toast")&&!o.hasClass(u.inverted)?s.addClass(u.inverted):s.removeClass(u.inverted)),i=D("<div/>",{class:"bar "+(r.progressUp?"up ":"down ")+n}),s.addClass(r.showProgress).append(i),s.hasClass(u.top)?t.prepend(s):t.append(s),i.css("animation-duration",r.displayTime/1e3+"s")),(c=D("<span/>",{class:"wait "+n})).css("animation-duration",r.displayTime/1e3+"s"),c.appendTo(o)),r.compact&&(t.addClass(u.compact),o.addClass(u.compact),s&&s.addClass(u.compact)),r.newestOnTop?t.prependTo(w.get.container()):t.appendTo(w.get.container())}},bind:{events:function(){w.debug("Binding events to toast"),r.closeIcon&&l.on("click"+g,w.event.close),o.on("click"+g,w.event.click),c&&c.on("animationend"+g,w.event.close),t.on("click"+g,d.approve,w.event.approve).on("click"+g,d.deny,w.event.deny)}},unbind:{events:function(){w.debug("Unbinding events to toast"),r.closeIcon&&l.off("click"+g),o.off("click"+g),c&&c.off("animationend"+g),t.off("click"+g)}},animate:{show:function(e){e=D.isFunction(e)?e:function(){},r.transition&&w.can.useElement("transition")&&h.transition("is supported")&&(w.set.visible(),t.transition({animation:r.transition.showMethod+" in",queue:!1,debug:r.debug,verbose:r.verbose,silent:r.silent,duration:r.transition.showDuration,onComplete:function(){e.call(t,C),r.onVisible.call(t,C)}}))},close:function(e){e=D.isFunction(e)?e:function(){},r.transition&&D.fn.transition!==z&&h.transition("is supported")?t.transition({animation:r.transition.hideMethod+" out",queue:!1,duration:r.transition.hideDuration,debug:r.debug,verbose:r.verbose,silent:r.silent,interval:50,onBeforeHide:function(e){e=D.isFunction(e)?e:function(){},""!==r.transition.closeEasing?t&&(t.css("opacity",0),t.wrap("<div/>").parent().hide(r.transition.closeDuration,r.transition.closeEasing,function(){t&&(t.parent().remove(),e.call(t))})):e.call(t)},onComplete:function(){e.call(t,C),r.onHidden.call(t,C),w.destroy()}}):w.error(p.noTransition)},pause:function(){c.css("animationPlayState","paused"),i&&i.css("animationPlayState","paused")},continue:function(){c.css("animationPlayState","running"),i&&i.css("animationPlayState","running")}},has:{container:function(){return w.verbose("Determining if there is already a container"),0<w.get.containers().length},toast:function(){return!!w.get.toast()},toasts:function(){return 0<w.get.toasts().length},configActions:function(){return Array.isArray(r.actions)&&0<r.actions.length}},get:{id:function(){return e},containers:function(){return b.children(w.helpers.toClass(r.position)+d.container+(r.horizontal?w.helpers.toClass(u.horizontal):":not("+w.helpers.toClass(u.horizontal)+")")+(r.context&&"body"!==r.context?w.helpers.toClass(u.absolute):":not("+w.helpers.toClass(u.absolute)+")"))},container:function(){return w.get.containers()[0]},toastBox:function(){return t||null},toast:function(){return o||null},toasts:function(){return D(w.get.container()).find(d.box)},iconClass:function(){return"string"==typeof r.showIcon?r.showIcon:r.showIcon&&r.icons[r.class]?r.icons[r.class]:""},remainingTime:function(){return c?c.css("opacity")*r.displayTime:0}},set:{visible:function(){o.addClass(u.visible)}},remove:{visible:function(){o.removeClass(u.visible)}},event:{close:function(){w.close()},click:function(e){0===D(e.target).closest(d.clickable).length&&(!1!==r.onClick.call(t,C)&&r.closeOnClick?w.close():w.verbose("Click callback returned false or close denied by setting cancelling close"))},approve:function(){!1===r.onApprove.call(C,h)?w.verbose("Approve callback returned false cancelling close"):w.close()},deny:function(){!1===r.onDeny.call(C,h)?w.verbose("Deny callback returned false cancelling close"):w.close()}},helpers:{toClass:function(e){var e=e.trim().split(/\s+/),n="";return e.forEach(function(e){n+="."+e}),n},deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,n){if(n)return e;var t={"<":"<",">":">",'"':""","'":"'","`":"`"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,12};)/gi,"&")).replace(/[<>"'`]/g,function(e){return t[e]}):e}},can:{useElement:function(e){return D.fn[e]!==z||(w.error(p.noElement.replace("{element}",e)),!1)}},setting:function(e,n){if(w.debug("Changing setting",e,n),D.isPlainObject(e))D.extend(!0,r,e);else{if(n===z)return r[e];D.isPlainObject(r[e])?D.extend(!0,r[e],n):r[e]=n}},internal:function(e,n){if(D.isPlainObject(e))D.extend(!0,w,e);else{if(n===z)return w[e];w[e]=n}},debug:function(){!r.silent&&r.debug&&(r.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,r.name+":"),w.debug.apply(console,arguments)))},verbose:function(){!r.silent&&r.verbose&&r.debug&&(r.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),w.verbose.apply(console,arguments)))},error:function(){r.silent||(w.error=Function.prototype.bind.call(console.error,console,r.name+":"),w.error.apply(console,arguments))},performance:{log:function(e){var n,t;r.performance&&(t=(n=(new Date).getTime())-(I||n),I=n,P.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:C,"Execution Time":t})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var e=r.name+":",t=0;I=!1,clearTimeout(w.performance.timer),D.each(P,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",T&&(e+=" '"+T+"'"),(console.group!==z||console.table!==z)&&0<P.length&&(console.groupCollapsed(e),console.table?console.table(P):D.each(P,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),P=[]}},invoke:function(o,e,n){var s,a,t,i=y;return e=e||A,n=n||C,"string"==typeof o&&i!==z&&(o=o.split(/[\. ]/),s=o.length-1,D.each(o,function(e,n){var t=e!=s?n+o[e+1].charAt(0).toUpperCase()+o[e+1].slice(1):o;if(D.isPlainObject(i[t])&&e!=s)i=i[t];else{if(i[t]!==z)return a=i[t],!1;{if(!D.isPlainObject(i[n])||e==s)return i[n]!==z?a=i[n]:w.error(p.method,o),!1;i=i[n]}}})),D.isFunction(a)?t=a.apply(n,e):a!==z&&(t=a),Array.isArray(k)?k.push(t):k!==z?k=[k,t]:t!==z&&(k=t),a}};O?(y===z&&w.initialize(),w.invoke(M)):(y!==z&&y.invoke("destroy"),w.initialize(),k=h)}),k!==z?k:this},D.fn.toast.settings={name:"Toast",namespace:"toast",silent:!1,debug:!1,verbose:!1,performance:!0,context:"body",position:"top right",horizontal:!1,class:"neutral",classProgress:!1,classActions:!1,classImage:"mini",title:"",message:"",displayTime:3e3,minDisplayTime:1e3,wordsPerMinute:120,showIcon:!1,newestOnTop:!1,showProgress:!1,pauseOnHover:!0,progressUp:!1,opacity:1,compact:!0,closeIcon:!1,closeOnClick:!0,cloneModule:!0,actions:!1,preserveHTML:!0,showImage:!1,transition:{showMethod:"scale",showDuration:500,hideMethod:"scale",hideDuration:500,closeEasing:"easeOutCubic",closeDuration:500},error:{method:"The method you called is not defined.",noElement:"This module requires ui {element}",verticalCard:"Vertical but not attached actions are not supported for card layout"},className:{container:"ui toast-container",absolute:"absolute",box:"floating toast-box",progress:"ui attached active progress",toast:"ui toast",icon:"centered icon",visible:"visible",content:"content",title:"ui header",message:"message",actions:"actions",extraContent:"extra content",button:"ui button",buttons:"ui buttons",close:"close icon",image:"ui image",vertical:"vertical",horizontal:"horizontal",attached:"attached",inverted:"inverted",compact:"compact",pausable:"pausable",progressing:"progressing",top:"top",bottom:"bottom",left:"left",basic:"basic",unclickable:"unclickable"},text:{close:"Close"},icons:{info:"info",success:"checkmark",warning:"warning",error:"times"},selector:{container:".ui.toast-container",box:".toast-box",toast:".ui.toast",title:".header",message:".message:not(.ui)",image:"> img.image, > .image > img",icon:"> i.icon",input:'input:not([type="hidden"]), textarea, select, button, .ui.button, ui.dropdown',clickable:"a, details, .ui.accordion",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel"},fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onClick:function(){},onHide:function(){},onHidden:function(){},onRemove:function(){},onApprove:function(){},onDeny:function(){}},D.extend(D.easing,{easeOutBounce:function(e,n,t,o,s){return(n/=s)<1/2.75?o*(7.5625*n*n)+t:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+t:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+t:o*(7.5625*(n-=2.625/2.75)*n+.984375)+t},easeOutCubic:function(e){return--e*e*e+1}})}(jQuery,window,document);
|
11
|
+
!function(D,E,H,z){"use strict";function S(e){return"function"==typeof e&&"number"!=typeof e.nodeType}E=void 0!==E&&E.Math==Math?E:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),D.toast=D.fn.toast=function(x){var k,e=D(this),T=e.selector||"",I=(new Date).getTime(),P=[],M=x,O="string"==typeof M,A=[].slice.call(arguments,1);return e.each(function(){var t,o,a,s,i,c,l,e,r=D.isPlainObject(x)?D.extend(!0,{},D.fn.toast.settings,x):D.extend({},D.fn.toast.settings),d=r.className,u=r.selector,p=r.error,n=r.namespace,f=r.fields,g="."+n,m=n+"-module",h=D(this),b=r.context?[E,H].indexOf(r.context)<0?D(H).find(r.context):D(r.context):D("body"),v=h.hasClass("toast")||h.hasClass("message")||h.hasClass("card"),C=this,y=v?h.data(m):z,w={initialize:function(){w.verbose("Initializing element"),w.create.id(),w.has.container()||w.create.container(),(v||""!==r.message||""!==r.title||""!==w.get.iconClass()||r.showImage||w.has.configActions())&&("string"==typeof r.showProgress&&-1!==[d.top,d.bottom].indexOf(r.showProgress)||(r.showProgress=!1),w.create.toast(),r.closeOnClick&&(r.closeIcon||0<D(o).find(u.input).length||w.has.configActions())&&(r.closeOnClick=!1),r.closeOnClick||t.addClass(d.unclickable),w.bind.events()),w.instantiate(),t&&w.show()},instantiate:function(){w.verbose("Storing instance of toast"),y=w,h.data(m,y)},destroy:function(){t&&(w.debug("Removing toast",t),w.unbind.events(),t.remove(),c=o=t=z,r.onRemove.call(t,C),l=i=s=z),h.removeData(m)},show:function(e){!1===r.onShow.call(t,C)?w.debug("onShow callback returned false, cancelling toast animation"):(e=e||function(){},w.debug("Showing toast"),w.animate.show(e))},close:function(e){!1===r.onHide.call(t,C)?w.debug("onHide callback returned false, cancelling toast animation"):(e=e||function(){},w.debug("Closing toast"),w.remove.visible(),w.unbind.events(),w.animate.close(e))},create:{container:function(){w.verbose("Creating container"),b.append(D("<div/>",{class:r.position+" "+d.container+" "+(r.horizontal?d.horizontal:"")+" "+(r.context&&"body"!==r.context?d.absolute:"")}))},id:function(){e=(Math.random().toString(16)+"000000000").slice(2,10),w.verbose("Creating unique id for element",e)},toast:function(){t=D("<div/>",{class:d.box});var e,n=w.get.iconClass();v?(o=r.cloneModule?h.clone().removeAttr("id"):h,l=o.find("> i"+w.helpers.toClass(d.close)),r.closeIcon=0<l.length,""!==n&&o.find(u.icon).attr("class",n+" "+d.icon),r.showImage&&o.find(u.image).attr("src",r.showImage),""!==r.title&&o.find(u.title).html(w.helpers.escape(r.title,r.preserveHTML)),""!==r.message&&o.find(u.message).html(w.helpers.escape(r.message,r.preserveHTML))):(w.verbose("Creating toast"),o=D("<div/>",{role:"alert"}),e=D("<div/>",{class:d.content}),""!==n&&o.append(D("<i/>",{class:n+" "+d.icon})),r.showImage&&o.append(D("<img>",{class:d.image+" "+r.classImage,src:r.showImage})),""!==r.title&&(n="_"+w.get.id()+"title",o.attr("aria-labelledby",n),e.append(D("<div/>",{class:d.title,id:n,html:w.helpers.escape(r.title,r.preserveHTML)}))),n="_"+w.get.id()+"desc",o.attr("aria-describedby",n),e.append(D("<div/>",{class:d.message,id:n,html:w.helpers.escape(r.message,r.preserveHTML)})),o.addClass(r.class+" "+d.toast).append(e),o.css("opacity",String(r.opacity)),r.closeIcon&&((l=D("<i/>",{class:d.close+" "+("string"==typeof r.closeIcon?r.closeIcon:""),role:"button",tabindex:0,"aria-label":r.text.close})).hasClass(d.left)?o.prepend(l):o.append(l))),o.hasClass(d.compact)&&(r.compact=!0),o.hasClass("card")&&(r.compact=!1),a=o.find(".actions"),w.has.configActions()&&(0===a.length&&(a=D("<div/>",{class:d.actions+" "+(r.classActions||"")}).appendTo(o)),o.hasClass("card")&&!a.hasClass(d.attached)&&(a.addClass(d.extraContent),a.hasClass(d.vertical)&&(a.removeClass(d.vertical),w.error(p.verticalCard))),r.actions.forEach(function(e){var n=e[f.icon]?"<i "+(e[f.text]?'aria-hidden="true"':"")+' class="'+w.helpers.deQuote(e[f.icon])+' icon"></i>':"",t=w.helpers.escape(e[f.text]||"",r.preserveHTML),o=w.helpers.deQuote(e[f.class]||""),s=e[f.click]&&S(e[f.click])?e[f.click]:function(){};a.append(D("<button/>",{html:n+t,"aria-label":(e[f.text]||e[f.icon]||"").replace(/<[^>]+(>|$)/g,""),class:d.button+" "+o,on:{click:function(){var e=D(this);e.is(u.approve)||e.is(u.deny)||!1===s.call(C,h)||w.close()}}}))})),a&&a.hasClass(d.vertical)&&o.addClass(d.vertical),0<a.length&&!a.hasClass(d.attached)&&(!a||a.hasClass(d.basic)&&!a.hasClass(d.left)||o.addClass(d.actions)),"auto"===r.displayTime&&(r.displayTime=Math.max(r.minDisplayTime,o.text().split(" ").length/r.wordsPerMinute*6e4)),t.append(o),0<a.length&&a.hasClass(d.attached)&&(a.addClass(d.buttons),a.detach(),o.addClass(d.attached),a.hasClass(d.vertical)?(o.wrap(D("<div/>",{class:d.vertical+" "+d.attached+" "+(r.compact?d.compact:"")})),a.hasClass(d.left)?o.addClass(d.left).parent().addClass(d.left).prepend(a):o.parent().append(a)):a.hasClass(d.top)?(t.prepend(a),o.addClass(d.bottom)):(t.append(a),o.addClass(d.top))),h!==o&&(C=(h=o)[0]),0<r.displayTime&&(n=d.progressing+" "+(r.pauseOnHover?d.pausable:""),r.showProgress&&(s=D("<div/>",{class:d.progress+" "+(r.classProgress||r.class),"data-percent":""}),r.classProgress||(o.hasClass("toast")&&!o.hasClass(d.inverted)?s.addClass(d.inverted):s.removeClass(d.inverted)),i=D("<div/>",{class:"bar "+(r.progressUp?"up ":"down ")+n}),s.addClass(r.showProgress).append(i),s.hasClass(d.top)?t.prepend(s):t.append(s),i.css("animation-duration",r.displayTime/1e3+"s")),(c=D("<span/>",{class:"wait "+n})).css("animation-duration",r.displayTime/1e3+"s"),c.appendTo(o)),r.compact&&(t.addClass(d.compact),o.addClass(d.compact),s&&s.addClass(d.compact)),r.newestOnTop?t.prependTo(w.get.container()):t.appendTo(w.get.container())}},bind:{events:function(){w.debug("Binding events to toast"),r.closeIcon&&l.on("click"+g,w.event.close),o.on("click"+g,w.event.click),c&&c.on("animationend"+g,w.event.close),t.on("click"+g,u.approve,w.event.approve).on("click"+g,u.deny,w.event.deny)}},unbind:{events:function(){w.debug("Unbinding events to toast"),r.closeIcon&&l.off("click"+g),o.off("click"+g),c&&c.off("animationend"+g),t.off("click"+g)}},animate:{show:function(e){e=S(e)?e:function(){},r.transition&&w.can.useElement("transition")&&h.transition("is supported")&&(w.set.visible(),t.transition({animation:r.transition.showMethod+" in",queue:!1,debug:r.debug,verbose:r.verbose,silent:r.silent,duration:r.transition.showDuration,onComplete:function(){e.call(t,C),r.onVisible.call(t,C)}}))},close:function(e){e=S(e)?e:function(){},r.transition&&D.fn.transition!==z&&h.transition("is supported")?t.transition({animation:r.transition.hideMethod+" out",queue:!1,duration:r.transition.hideDuration,debug:r.debug,verbose:r.verbose,silent:r.silent,interval:50,onBeforeHide:function(e){e=S(e)?e:function(){},""!==r.transition.closeEasing?t&&(t.css("opacity","0"),t.wrap("<div/>").parent().hide(r.transition.closeDuration,r.transition.closeEasing,function(){t&&(t.parent().remove(),e.call(t))})):e.call(t)},onComplete:function(){e.call(t,C),r.onHidden.call(t,C),w.destroy()}}):w.error(p.noTransition)},pause:function(){c.css("animationPlayState","paused"),i&&i.css("animationPlayState","paused")},continue:function(){c.css("animationPlayState","running"),i&&i.css("animationPlayState","running")}},has:{container:function(){return w.verbose("Determining if there is already a container"),0<w.get.containers().length},toast:function(){return!!w.get.toast()},toasts:function(){return 0<w.get.toasts().length},configActions:function(){return Array.isArray(r.actions)&&0<r.actions.length}},get:{id:function(){return e},containers:function(){return b.children(w.helpers.toClass(r.position)+u.container+(r.horizontal?w.helpers.toClass(d.horizontal):":not("+w.helpers.toClass(d.horizontal)+")")+(r.context&&"body"!==r.context?w.helpers.toClass(d.absolute):":not("+w.helpers.toClass(d.absolute)+")"))},container:function(){return w.get.containers()[0]},toastBox:function(){return t||null},toast:function(){return o||null},toasts:function(){return D(w.get.container()).find(u.box)},iconClass:function(){return"string"==typeof r.showIcon?r.showIcon:r.showIcon&&r.icons[r.class]?r.icons[r.class]:""},remainingTime:function(){return c?c.css("opacity")*r.displayTime:0}},set:{visible:function(){o.addClass(d.visible)}},remove:{visible:function(){o.removeClass(d.visible)}},event:{close:function(){w.close()},click:function(e){0===D(e.target).closest(u.clickable).length&&(!1!==r.onClick.call(t,C)&&r.closeOnClick?w.close():w.verbose("Click callback returned false or close denied by setting cancelling close"))},approve:function(){!1===r.onApprove.call(C,h)?w.verbose("Approve callback returned false cancelling close"):w.close()},deny:function(){!1===r.onDeny.call(C,h)?w.verbose("Deny callback returned false cancelling close"):w.close()}},helpers:{toClass:function(e){var e=e.trim().split(/\s+/),n="";return e.forEach(function(e){n+="."+e}),n},deQuote:function(e){return String(e).replace(/"/g,"")},escape:function(e,n){if(n)return e;var t={"<":"<",">":">",'"':""","'":"'","`":"`"};return/[&<>"'`]/.test(e)?(e=e.replace(/&(?![a-z0-9#]{1,12};)/gi,"&")).replace(/[<>"'`]/g,function(e){return t[e]}):e}},can:{useElement:function(e){return D.fn[e]!==z||(w.error(p.noElement.replace("{element}",e)),!1)}},setting:function(e,n){if(w.debug("Changing setting",e,n),D.isPlainObject(e))D.extend(!0,r,e);else{if(n===z)return r[e];D.isPlainObject(r[e])?D.extend(!0,r[e],n):r[e]=n}},internal:function(e,n){if(D.isPlainObject(e))D.extend(!0,w,e);else{if(n===z)return w[e];w[e]=n}},debug:function(){!r.silent&&r.debug&&(r.performance?w.performance.log(arguments):(w.debug=Function.prototype.bind.call(console.info,console,r.name+":"),w.debug.apply(console,arguments)))},verbose:function(){!r.silent&&r.verbose&&r.debug&&(r.performance?w.performance.log(arguments):(w.verbose=Function.prototype.bind.call(console.info,console,r.name+":"),w.verbose.apply(console,arguments)))},error:function(){r.silent||(w.error=Function.prototype.bind.call(console.error,console,r.name+":"),w.error.apply(console,arguments))},performance:{log:function(e){var n,t;r.performance&&(t=(n=(new Date).getTime())-(I||n),I=n,P.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:C,"Execution Time":t})),clearTimeout(w.performance.timer),w.performance.timer=setTimeout(w.performance.display,500)},display:function(){var e=r.name+":",t=0;I=!1,clearTimeout(w.performance.timer),D.each(P,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",T&&(e+=" '"+T+"'"),(console.group!==z||console.table!==z)&&0<P.length&&(console.groupCollapsed(e),console.table?console.table(P):D.each(P,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),P=[]}},invoke:function(o,e,n){var s,a,t,i=y;return e=e||A,n=n||C,"string"==typeof o&&i!==z&&(o=o.split(/[\. ]/),s=o.length-1,D.each(o,function(e,n){var t=e!=s?n+o[e+1].charAt(0).toUpperCase()+o[e+1].slice(1):o;if(D.isPlainObject(i[t])&&e!=s)i=i[t];else{if(i[t]!==z)return a=i[t],!1;{if(!D.isPlainObject(i[n])||e==s)return i[n]!==z?a=i[n]:w.error(p.method,o),!1;i=i[n]}}})),S(a)?t=a.apply(n,e):a!==z&&(t=a),Array.isArray(k)?k.push(t):k!==z?k=[k,t]:t!==z&&(k=t),a}};O?(y===z&&w.initialize(),w.invoke(M)):(y!==z&&y.invoke("destroy"),w.initialize(),k=h)}),k!==z?k:this},D.fn.toast.settings={name:"Toast",namespace:"toast",silent:!1,debug:!1,verbose:!1,performance:!0,context:"body",position:"top right",horizontal:!1,class:"neutral",classProgress:!1,classActions:!1,classImage:"mini",title:"",message:"",displayTime:3e3,minDisplayTime:1e3,wordsPerMinute:120,showIcon:!1,newestOnTop:!1,showProgress:!1,pauseOnHover:!0,progressUp:!1,opacity:1,compact:!0,closeIcon:!1,closeOnClick:!0,cloneModule:!0,actions:!1,preserveHTML:!0,showImage:!1,transition:{showMethod:"scale",showDuration:500,hideMethod:"scale",hideDuration:500,closeEasing:"easeOutCubic",closeDuration:500},error:{method:"The method you called is not defined.",noElement:"This module requires ui {element}",verticalCard:"Vertical but not attached actions are not supported for card layout"},className:{container:"ui toast-container",absolute:"absolute",box:"floating toast-box",progress:"ui attached active progress",toast:"ui toast",icon:"centered icon",visible:"visible",content:"content",title:"ui header",message:"message",actions:"actions",extraContent:"extra content",button:"ui button",buttons:"ui buttons",close:"close icon",image:"ui image",vertical:"vertical",horizontal:"horizontal",attached:"attached",inverted:"inverted",compact:"compact",pausable:"pausable",progressing:"progressing",top:"top",bottom:"bottom",left:"left",basic:"basic",unclickable:"unclickable"},text:{close:"Close"},icons:{info:"info",success:"checkmark",warning:"warning",error:"times"},selector:{container:".ui.toast-container",box:".toast-box",toast:".ui.toast",title:".header",message:".message:not(.ui)",image:"> img.image, > .image > img",icon:"> i.icon",input:'input:not([type="hidden"]), textarea, select, button, .ui.button, ui.dropdown',clickable:"a, details, .ui.accordion",approve:".actions .positive, .actions .approve, .actions .ok",deny:".actions .negative, .actions .deny, .actions .cancel"},fields:{class:"class",text:"text",icon:"icon",click:"click"},onShow:function(){},onVisible:function(){},onClick:function(){},onHide:function(){},onHidden:function(){},onRemove:function(){},onApprove:function(){},onDeny:function(){}},D.extend(D.easing,{easeOutBounce:function(e){var n=7.5625,t=2.75;return e<1/t?n*e*e:e<2/t?n*(e-=1.5/t)*e+.75:e<2.5/t?n*(e-=2.25/t)*e+.9375:n*(e-=2.625/t)*e+.984375},easeOutCubic:function(e){return--e*e*e+1}})}(jQuery,window,document);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.16+7071e59 - Transition
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
15
|
+
function isFunction(obj) {
|
16
16
|
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
-
}
|
17
|
+
}
|
18
18
|
|
19
19
|
window = (typeof window != 'undefined' && window.Math == Math)
|
20
20
|
? window
|
@@ -992,7 +992,7 @@ $.fn.transition = function() {
|
|
992
992
|
}
|
993
993
|
});
|
994
994
|
}
|
995
|
-
if (
|
995
|
+
if ( isFunction( found ) ) {
|
996
996
|
response = found.apply(context, passedArguments);
|
997
997
|
}
|
998
998
|
else if(found !== undefined) {
|