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 UIkit.component('header', { 10 11 connected: function () { 12 this.initialize(); 13 }, 14 15 ready: function () { 16 if (!this.section) { 17 this.initialize(); 18 } 19 }, 20 21 update: [ 22 23 { 24 25 read: function () { 26 this.prevHeight = this.height; 27 this.height = this.$el.offsetHeight; 28 var sticky = this.modifier && UIkit.getComponent(this.sticky, 'sticky'); 29 if (sticky) { 30 sticky.$props.top = this.section.offsetHeight <= window.innerHeight 31 ? this.selector 32 : util.offset(this.section).top + 300; 33 } 34 }, 35 36 write: function () { 37 if (this.placeholder && this.prevHeight !== this.height) { 38 css(this.placeholder, {height: this.height}); 39 } 40 }, 41 42 events: ['load', 'resize'] 43 44 } 45 46 ], 47 48 methods: { 49 50 initialize: function () { 51 52 this.selector = '.tm-header ~ [class*="uk-section"], .tm-header ~ * > [class*="uk-section"]'; 53 this.section = $(this.selector); 54 this.sticky = $('[uk-sticky]', this.$el); 55 this.modifier = attr(this.section, 'tm-header-transparent'); 56 57 if (!this.modifier || !this.section) { 58 return; 59 } 60 61 addClass(this.$el, 'tm-header-transparent'); 62 63 this.placeholder = util.hasAttr(this.section, 'tm-header-transparent-placeholder') 64 && util.before($('[uk-grid]', this.section), '<div class="tm-header-placeholder uk-margin-remove-adjacent" style="height: ' + this.$el.offsetHeight + 'px"></div>'); 65 66 var container = $('.uk-navbar-container', this.$el), 67 navbar = $('[uk-navbar]', this.$el), 68 cls = 'uk-navbar-transparent uk-' + this.modifier; 69 70 addClass($('.tm-headerbar-top, .tm-headerbar-bottom'), 'uk-' + this.modifier); 71 72 if (attr(navbar, 'dropbar-mode') === 'push') { 73 attr(navbar, 'dropbar-mode', 'slide'); 74 } 75 76 if (!this.sticky) { 77 addClass(container, cls); 78 } else { 79 attr(this.sticky, { 80 animation: 'uk-animation-slide-top', 81 top: this.selector, 82 'cls-inactive': cls 83 }); 84 } 85 } 86 87 } 88 89 }); 90 91 if (util.isRtl) { 92 93 var mixin = { 94 95 init: function () { 96 this.$props.pos = util.swap(this.$props.pos, 'left', 'right'); 97 } 98 99 }; 100 101 UIkit.mixin(mixin, 'drop'); 102 UIkit.mixin(mixin, 'tooltip'); 103 104 } 105 106})(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.