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, { 39 height: this.height 40 }); 41 } 42 }, 43 44 events: ['load', 'resize'] 45 46 } 47 48 ], 49 50 methods: { 51 52 initialize: function() { 53 54 this.selector = '.tm-header ~ [class*="uk-section"], .tm-header ~ * > [class*="uk-section"]'; 55 this.section = $(this.selector); 56 this.sticky = $('[uk-sticky]', this.$el); 57 this.modifier = attr(this.section, 'tm-header-transparent'); 58 59 if (!this.modifier || !this.section) { 60 return; 61 } 62 63 addClass(this.$el, 'tm-header-transparent'); 64 65 this.placeholder = util.hasAttr(this.section, 'tm-header-transparent-placeholder') && 66 util.before($('[uk-grid]', this.section), '<div class="tm-header-placeholder uk-margin-remove-adjacent" style="height: ' + this.$el.offsetHeight + 'px"></div>'); 67 68 var container = $('.uk-navbar-container', this.$el), 69 navbar = $('[uk-navbar]', this.$el), 70 cls = 'uk-navbar-transparent uk-' + this.modifier; 71 72 addClass($('.tm-headerbar-top, .tm-headerbar-bottom'), 'uk-' + this.modifier); 73 74 if (attr(navbar, 'dropbar-mode') === 'push') { 75 attr(navbar, 'dropbar-mode', 'slide'); 76 } 77 78 if (!this.sticky) { 79 addClass(container, cls); 80 } else { 81 attr(this.sticky, { 82 animation: 'uk-animation-slide-top', 83 top: this.selector, 84 'cls-inactive': cls 85 }); 86 } 87 } 88 89 } 90 91 }); 92 93 if (util.isRtl) { 94 95 var mixin = { 96 97 init: function() { 98 this.$props.pos = util.swap(this.$props.pos, 'left', 'right'); 99 } 100 101 }; 102 103 UIkit.mixin(mixin, 'drop'); 104 UIkit.mixin(mixin, 'tooltip'); 105 106 } 107 108})(UIkit, UIkit.util); 109 110 111 112 113 114// Vue 115
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.