1!function(window, document, undefined) { 2 "use strict"; 3 var Util = {}; 4 Util.throttle = function(fn, threshhold, scope) { 5 threshhold || (threshhold = 250); 6 var last, deferTimer; 7 return function() { 8 var context = scope || this, 9 now = +new Date, 10 args = arguments; 11 last && last + threshhold > now ? (clearTimeout(deferTimer), deferTimer = setTimeout(function() { 12 last = now, fn.apply(context, args) 13 }, threshhold)) : (last = now, fn.apply(context, args)) 14 } 15 }, Util.debounce = function(fn, delay) { 16 var timeout = null; 17 return function() { 18 var context = this, 19 args = arguments; 20 clearTimeout(timeout), timeout = setTimeout(function() { 21 fn.apply(context, args) 22 }, delay) 23 } 24 }, Util.extend = function() { 25 for (var i = 1; i < arguments.length; i++) 26 for (var key in arguments[i]) arguments[i].hasOwnProperty(key) && (arguments[0][key] = arguments[i][key]); 27 return arguments[0] 28 }, Util.isElement = function(obj) { 29 return !(!obj || 1 !== obj.nodeType) 30 }, Util.hasClass = function(item, className) { 31 return item.className.indexOf(className) > -1 32 }, Util.isSmallScreen = function() { 33 return window.innerWidth <= this.options.navBreakpoint 34 }, Util.handleResize = function() { 35 Util.throttle(this.reflowNavigation.bind(this), delay), Util.debounce(this.reflowNavigation.bind(this), delay); 36 var condition = this.isSmallScreen(), 37 change = !1; 38 return !this.smallScreen && !condition || this.smallScreen && condition || (this.smallScreen = condition, change = !0), change ? void 0 : !1 39 }, window.Util = Util 40}(window, document), 41function(window, document, undefined) { 42 "use strict"; 43 var Util = {}; 44 Util.throttle = function(fn, threshhold, scope) { 45 threshhold || (threshhold = 250); 46 var last, deferTimer; 47 return function() { 48 var context = scope || this, 49 now = +new Date, 50 args = arguments; 51 last && last + threshhold > now ? (clearTimeout(deferTimer), deferTimer = setTimeout(function() { 52 last = now, fn.apply(context, args) 53 }, threshhold)) : (last = now, fn.apply(context, args)) 54 } 55 }, Util.debounce = function(fn, delay) { 56 var timeout = null; 57 return function() { 58 var context = this, 59 args = arguments; 60 clearTimeout(timeout), timeout = setTimeout(function() { 61 fn.apply(context, args) 62 }, delay) 63 } 64 }, Util.extend = function() { 65 for (var i = 1; i < arguments.length; i++) 66 for (var key in arguments[i]) arguments[i].hasOwnProperty(key) && (arguments[0][key] = arguments[i][key]); 67 return arguments[0] 68 }, Util.isElement = function(obj) { 69 return !(!obj || 1 !== obj.nodeType) 70 }, Util.hasClass = function(item, className) { 71 return item.className.indexOf(className) > -1 72 }, Util.isSmallScreen = function() { 73 return window.innerWidth <= this.options.navBreakpoint 74 }, Util.handleResize = function() { 75 Util.throttle(this.reflowNavigation.bind(this), delay), Util.debounce(this.reflowNavigation.bind(this), delay); 76 var condition = this.isSmallScreen(), 77 change = !1; 78 return !this.smallScreen && !condition || this.smallScreen && condition || (this.smallScreen = condition, change = !0), change ? void 0 : !1 79 }, window.Util = Util 80}(window, document), window.matchMedia = window.matchMedia || function(doc, undefined) { 81 var docElem = doc.documentElement, 82 refNode = docElem.firstElementChild || docElem.firstChild, 83 fakeBody = doc.createElement("body"), 84 div = doc.createElement("div"); 85 div.id = "mq-test-1", div.style.cssText = "position:absolute;top:-100em", fakeBody.style.background = "none", fakeBody.appendChild(div); 86 var eminpx, mqRun = function(mq) { 87 return div.innerHTML = '­<style media="' + mq + '"> #mq-test-1 { width: 42px; }</style>
87', docElem.insertBefore(fakeBody, refNode), bool = 42 === div.offsetWidth, docElem.removeChild(fakeBody), { 88 matches: bool, 89 media: mq 90 } 91 }, 92 getEmValue = function() { 93 var ret, body = docElem.body, 94 fakeUsed = !1; 95 return div.style.cssText = "position:absolute;font-size:1em;width:1em", body || (body = fakeUsed = doc.createElement("body"), body.style.background = "none"), body.appendChild(div), docElem.insertBefore(body, docElem.firstChild), fakeUsed ? docElem.removeChild(body) : body.removeChild(div), ret = eminpx = parseFloat(div.offsetWidth) 96 }, 97 mqSupport = mqRun("(min-width: 0px)").matches; 98 return function(mq) { 99 if (mqSupport) return mqRun(mq); 100 var min = mq.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 101 max = mq.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), 102 minnull = null === min, 103 maxnull = null === max, 104 currWidth = doc.body.offsetWidth, 105 em = "em"; 106 return min && (min = parseFloat(min) * (min.indexOf(em) > -1 ? eminpx || getEmValue() : 1)), max && (max = parseFloat(max) * (max.indexOf(em) > -1 ? eminpx || getEmValue() : 1)), bool = (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || max >= currWidth), { 107 matches: bool, 108 media: mq 109 } 110 } 111}(document); 112var BreakpointSwitcher = function(window, Util, matchMedia, document, undefined) { 113 "use strict"; 114 var BreakpointSwitcher = function(options) { 115 this.breakpoints = Util.extend({}, "object" == typeof options && options), this.currentView = null, window.addEventListener("resize", Util.throttle(this["switch"], 20, this)), window.addEventListener("load", Util.throttle(this["switch"], 20, this)) 116 }; 117 return BreakpointSwitcher.create = function(options) { 118 if (!matchMedia) throw new Error("matchMedia is required for BreakpointSwitcher"); 119 if ("object" == typeof options) return new BreakpointSwitcher(options); 120 throw new Error("Options object has to be passed to the constructor") 121 }, BreakpointSwitcher.prototype.matchView = function(breakpoints) { 122 var view = null; 123 for (var key in breakpoints) matchMedia("(min-width: " + key + ")").matches && (view = breakpoints[key]); 124 return view 125 }, BreakpointSwitcher.prototype["switch"] = function() { 126 var view = this.matchView(this.breakpoints); 127 return this.currentView !== view ? (this.currentView && "function" == typeof this.currentView && this.currentView.call(window, !1), "function" == typeof view && view.call(window, !0), this.currentView = view) : null 128 }, BreakpointSwitcher 129}(window, window.Util, window.matchMedia, document); 130! function(window, Util, document, undefined) { 131 "use strict"; 132 var delay = 10, 133 instances = [], 134 NavPriority = function(element, options) { 135 this.options = options, this.element = "string" == typeof element ? document.querySelector(element) : element, this.resizeListener = null, this.container = this.options.containerSelector ? this.element.querySelectorAll(this.options.containerSelector)[0] : this.element, this.navList = this.element.querySelectorAll("ul")[0], this.overflowMenu = this.createOverflowMenu(), this.overflowList = this.overflowMenu.querySelectorAll("ul")[0], this.overflowDropdown = this.element.parentNode.querySelector("[data-nav-priority-toggle]"), this.overflowBreakpoints = [], this.elementStyle = window.getComputedStyle(this.element), this.breakpoints = this.getBreakpoints(), this.setupEventListeners(), this.reflowNavigation() 136 }; 137 return NavPriority.DEFAULTS = { 138 dropdownLabel: 'More <i class="caret"></i>', 139 dropdownMenuClass: "dropdown-menu dropdown-menu-right", 140 dropdownMenuTemplate: '<li data-nav-priority-menu class="navbar-nav-more dropdown" aria-hidden="true"><a id="{{dropdownMenuId}}" href="#" class="navbar-toggle-more nav-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-nav-priority-toggle>{{dropdownLabel}}</a><ul class="{{dropdownMenuClass}}" aria-labelledby="{{dropdownMenuId}}"></ul></li>', 141 containerSelector: "ul", 142 containerWidthOffset: 10, 143 threshold: 4 144 }, NavPriority.create = function(element, options) { 145 var listItems = element.querySelectorAll("li"), 146 isValid = !0; 147 if (!Util.isElement(element)) throw isValid = !1, new Error("element has to be DOM Element"); 148 return (0 === listItems.length || listItems.length <= options.threshold) && (isValid = !1), isValid ? new NavPriority(element, options) : null 149 }, NavPriority.prototype.createOverflowMenu = function() { 150 var overflowMenu = this.navList.querySelector("[data-nav-priority-menu]"); 151 if (!overflowMenu) { 152 var menuDOM, menuId = "nav-link-more-" + instances.length, 153 menuHtml = this.options.dropdownMenuTemplate, 154 listItems = this.navList.children, 155 listItemsLength = this.navList.children.length, 156 lastItem = listItems[listItemsLength - 1]; 157 menuHtml = menuHtml.replace("{{dropdownLabel}}", this.options.dropdownLabel).replace("{{dropdownMenuClass}}", this.options.dropdownMenuClass).replace(new RegExp("{{dropdownMenuId}}", "g"), menuId), menuDOM = document.createElement("div"), menuDOM.innerHTML = menuHtml, lastItem.setAttribute("class", lastItem.className + " is-last"), this.navList.appendChild(menuDOM.firstChild), overflowMenu = this.navList.querySelector("[data-nav-priority-menu]") 158 } 159 if (!overflowMenu) throw new Error("overflowMenu does not exist, check your custom dropdownMenuTemplate parameter"); 160 return overflowMenu 161 }
161, NavPriority.prototype.getBreakpoints = function() { 162 for (var breakpoints = [], navListItems = this.navList.children, itemsLength = navListItems.length, dropdownMenuWidth = Math.ceil(this.overflowDropdown.getBoundingClientRect().width), itemBreakpoint = dropdownMenuWidth, i = 0; itemsLength > i; i++) { 163 var item = navListItems[i]; 164 Util.hasClass(item, "navbar-nav-more") || (itemBreakpoint += Math.ceil(item.getBoundingClientRect().width), breakpoints.push(itemBreakpoint)) 165 } 166 return breakpoints[breakpoints.length - 1] -= dropdownMenuWidth, breakpoints 167 }, NavPriority.prototype.setupEventListeners = function() { 168 this.resizeListener = Util.throttle(this.reflowNavigation, delay, this), window.addEventListener("resize", this.resizeListener) 169 }, NavPriority.prototype.addToOverflow = function(item, breakpoint) { 170 return this.overflowList.insertBefore(item, this.overflowList.firstChild), this.overflowBreakpoints.unshift(breakpoint), this.breakpoints.pop(), this.overflowBreakpoints 171 }, NavPriority.prototype.removeFromOverflow = function(item, breakpoint) { 172 return this.breakpoints.push(breakpoint), this.overflowBreakpoints.shift(), this.navList.insertBefore(item, this.overflowDropdown.parentNode), this.overflowBreakpoints 173 }, NavPriority.prototype.toggleOverflowDropdown = function(condition) { 174 return this.overflowMenu.setAttribute("aria-hidden", condition) 175 }, NavPriority.prototype.reflowNavigation = function() { 176 if (!this.resizeListener) return !1; 177 for (var containerWidth = Math.ceil(this.container.getBoundingClientRect().width - this.options.containerWidthOffset), navListItems = this.navList.children, menuIndex = navListItems.length; menuIndex--;) 178 if (!Util.hasClass(navListItems[menuIndex], "navbar-nav-more")) { 179 var itemBreakpoint = this.breakpoints[menuIndex]; 180 itemBreakpoint >= containerWidth && this.addToOverflow(navListItems[menuIndex], itemBreakpoint) 181 } for (var overflowIndex = this.overflowList.children.length; overflowIndex--;) this.overflowBreakpoints[0] < containerWidth && this.removeFromOverflow(this.overflowList.children[0], this.overflowBreakpoints[0]); 182 this.toggleOverflowDropdown(0 == this.overflowList.children.length) 183 }, NavPriority.prototype.destroy = function() { 184 this.element.removeAttribute("data-nav-priority"), window.removeEventListener("resize", this.resizeListener), this.resizeListener = null; 185 var overflowIndex = this.overflowList.children.length; 186 if (overflowIndex) 187 for (; this.overflowList.children.length;) this.removeFromOverflow(this.overflowList.children[0], this.overflowBreakpoints[0]); 188 return this.toggleOverflowDropdown(0 == this.overflowList.children.length), this.element 189 }, window.navPriority = function(selector, option) { 190 var elements = document.querySelectorAll(selector); 191 if ("string" == typeof option && "destroy" == option) { 192 for (var i = 0; i < instances.length; i++) { 193 var data = instances[i]; 194 data.destroy.call(data) 195 } 196 instances = [] 197 } 198 if ("string" != typeof option) 199 for (var i = 0; i < elements.length; i++) { 200 var self = elements[i], 201 options = Util.extend({}, NavPriority.DEFAULTS, "object" == typeof option && option), 202 data = self.getAttribute("data-nav-priority"); 203 if (!data) { 204 var navPriority = NavPriority.create(self, options); 205 instances.push(navPriority), data = self.setAttribute("data-nav-priority", !0) 206 } 207 } 208 return instances 209 }, NavPriority 210}(window, window.Util, document); 211 212 213 214// Translations 215var { __, _x, _n, _nx } = wp.i18n; 216 217 218 219// navPriority 220var bs = BreakpointSwitcher.create( 221{ 222 '991px': function(enter) 223 { 224 if (enter) 225 { 226 window.navPriority('[data-nav="priority"]', 227 { 228 dropdownLabel: '<i class="fa fa-ellipsis-h"></i>', 229 containerSelector: null, 230 containerWidthOffset: 100, 231 dropdownMenuTemplate: '<li data-nav-priority-menu class="navbar-nav-more dropdown nav-item" aria-hidden="true"><a id="{{dropdownMenuId}}" href="#" class="navbar-toggle-more nav-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-nav-priority-toggle title="' + __('More', 'wtbTF') + '">{{dropdownLabel}}</a><ul class="{{dropdownMenuClass}}" aria-labelledby="{{dropdownMenuId}}"></ul></li>', 232 }); 233 } 234 else 235 { 236 window.navPriority('[data-nav="priority"]', 'destroy'); 237 } 238 } 239}); 240 241 242 243$(window).load(function() 244{ 245 // Trigger Resize for Priority Navigation 246 247 // jQuery 248 $(window).trigger('resize'); 249 250 // Vanilla 1 251 var resizeEvent = window.document.createEvent('UIEvents'); 252 resizeEvent .initUIEvent('resize', true, false, window, 0); 253 window.dispatchEvent(resizeEvent); 254 255 window.dispatchEvent(new Event('resize'));
256 257 // Vanilla 2 258 var el = document; // This can be your element on which to trigger the event 259 var event = document.createEvent('HTMLEvents'); 260 event.initEvent('resize', true, false); 261 el.dispatchEvent(event); 262 263 // Tooltip 264 $(function() 265 { 266 $('.navbar-nav-more .navbar-toggle-more').tooltip({ 267 placement: 'top', 268 }); 269 }) 270 271 // Tooltip: Hide on Click 272 // $(document).on('click', '.navbar-nav-more .navbar-toggle-more', function(event) 273 // { 274 // $(this).tooltip('hide'); 275 // }); 276});
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.