1// Theme JavaScript 2(function (UIkit, util) { 3 4 var $ = util.$, 5 attr = util.attr, 6 css = util.css, 7 addClass = util.addClass; 8 9 var selector = '.tm-header ~ [class*="uk-section"], .tm-header ~ * > [class*="uk-section"]'; 10 11 UIkit.component('header', { 12 13 update: [ 14 15 { 16 17 read: function (data) { 18 19 var section = $(selector); 20 var modifier = attr(section, 'tm-header-transparent'); 21 22 if (!modifier || !section) { 23 return false; 24 } 25 26 data.prevHeight = this.height; 27 data.height = this.$el.offsetHeight; 28 29 var sticky = UIkit.getComponent($('[uk-sticky]', this.$el), 'sticky'); 30 if (sticky) { 31 32 var dat = sticky.$options.data; 33 if (dat.animation !== 'uk-animation-slide-top') { 34 util.each({ 35 animation: 'uk-animation-slide-top', 36 top: selector, 37 clsInactive: 'uk-navbar-transparent uk-' + modifier 38 }, function (value, key) { 39 dat[key] = sticky[key] = sticky.$props[key] = value; 40 }); 41 } 42 43 sticky.$props.top = section.offsetHeight <= window.innerHeight 44 ? selector 45 : util.offset(section).top + 300; 46 } 47 48 }, 49 50 write: function (data) { 51 52 if (!this.placeholder) { 53 54 var section = $(selector); 55 var modifier = attr(section, 'tm-header-transparent'); 56 57 addClass(this.$el, 'tm-header-transparent'); 58 addClass($('.tm-headerbar-top, .tm-headerbar-bottom'), 'uk-' + modifier); 59 60 this.placeholder = util.hasAttr(section, 'tm-header-transparent-placeholder') 61 && util.before($('[uk-grid]', section), '<div class="tm-header-placeholder uk-margin-remove-adjacent"></div>'); 62 63 var navbar = $('[uk-navbar]', this.$el); 64 if (attr(navbar, 'dropbar-mode') === 'push') { 65 attr(navbar, 'dropbar-mode', 'slide'); 66 } 67 68 if (!$('[uk-sticky]', this.$el)) { 69 addClass($('.uk-navbar-container', this.$el), 'uk-navbar-transparent uk-' + modifier); 70 } 71 72 } 73 74 if (this.placeholder && data.prevHeight !== data.height) { 75 css(this.placeholder, {height: data.height}); 76 } 77 }, 78 79 events: ['load', 'resize'] 80 81 } 82 83 ] 84 85 }); 86 87 if (util.isRtl) { 88 89 var mixin = { 90 91 init: function () { 92 this.$props.pos = util.swap(this.$props.pos, 'left', 'right'); 93 } 94 95 }; 96 97 UIkit.mixin(mixin, 'drop'); 98 UIkit.mixin(mixin, 'tooltip'); 99 100 } 101 102})(UIkit, UIkit.util);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.