diff options
35 files changed, 2573 insertions, 300 deletions
diff --git a/jquery/.gitignore b/jquery/.gitignore new file mode 100644 index 0000000..8436b24 --- /dev/null +++ b/jquery/.gitignore @@ -0,0 +1,4 @@ +.sass-cache +*-min.js +doxmenu*.css +jquery.js diff --git a/jquery/Makefile b/jquery/Makefile index 996f472..02cdd34 100644 --- a/jquery/Makefile +++ b/jquery/Makefile @@ -3,6 +3,8 @@ JQUERY_UI_VERSION = 1.8.18 HASHCHANGE_VERSION = 1.3 SCROLL_VERSION = 1.4.2 POWERTIP_VERSION = 1.2.0 +TOUCHPUNCH_VERSION = 0.2.3 +SMARTMENUS_VERSION = 1.0.0 MINIFIER ?= /usr/local/bin/yuicompressor-2.4.7 SCRIPTS = jquery-$(JQUERY_VERSION).js \ @@ -12,23 +14,36 @@ SCRIPTS = jquery-$(JQUERY_VERSION).js \ jquery.ui-$(JQUERY_UI_VERSION).resizable.js \ jquery.ba-$(HASHCHANGE_VERSION)-hashchange.js \ jquery.scrollTo-$(SCROLL_VERSION).js \ - jquery.powertip-$(POWERTIP_VERSION).js -RESULTS = jquery.js + jquery.powertip-$(POWERTIP_VERSION).js \ + jquery.ui-$(TOUCHPUNCH_VERSION).touch-punch.js \ + jquery.smartmenus-$(SMARTMENUS_VERSION).js +RESULTS = jquery.js doxmenu-min.css SCRIPTS_MIN = $(SCRIPTS:%.js=%-min.js) all: $(RESULTS) install: $(RESULTS) - cp $(RESULTS) ../templates/html/ + cp jquery.js ../templates/html/jquery.js + cp doxmenu-min.css ../templates/html/tabs.css -jquery.js: scripts +jquery.js: $(SCRIPTS_MIN) cat $(SCRIPTS_MIN) > jquery.js +doxmenu-min.css: sm-core-css.css \ + sass/sm-dox.scss \ + sass/_round-corners-last-item.scss \ + sass/_sm-dox.scss \ + sass/_sub-items-indentation.scss + compass compile --css-dir . --force sass/sm-dox.scss + cat sm-core-css.css sm-dox.css > doxmenu.css + java -jar $(MINIFIER).jar doxmenu.css > doxmenu-min.css + rm -f sm-dox.css doxmenu.css + scripts: $(SCRIPTS_MIN) clean: - rm -f $(SCRIPTS_MIN) $(RESULTS) + rm -rf $(SCRIPTS_MIN) $(RESULTS) doxmenu.css .sass-cache jquery.js %-min.js: %.js java -jar $(MINIFIER).jar $^ > $@ diff --git a/jquery/README b/jquery/README index 5e385a5..21590ff 100644 --- a/jquery/README +++ b/jquery/README @@ -7,8 +7,10 @@ packages: - jquery.ui.widget - jquery.ui.mouse - jquery.ui.resizable -- jquery.hashchange: 1.3: http://benalman.com/projects/jquery-hashchange-plugin/ -- jquery.scrollTo: 1.4.2: https://github.com/flesler/jquery.scrollTo -- jquery.powertip: 1.2.0: http://stevenbenner.github.io/jquery-powertip/ +- jquery.hashchange: 1.3: http://benalman.com/projects/jquery-hashchange-plugin/ +- jquery.scrollTo: 1.4.2: https://github.com/flesler/jquery.scrollTo +- jquery.powertip: 1.2.0: http://stevenbenner.github.io/jquery-powertip/ +- jquery.touchpunch: 0.2.3: http://touchpunch.furf.com/ +- jquery.smartmenus: 1.0.0: http://www.smartmenus.org/ The Makefile will built the jquery.js files used by doxygen. diff --git a/jquery/jquery.smartmenus-1.0.0.js b/jquery/jquery.smartmenus-1.0.0.js new file mode 100644 index 0000000..9c3a494 --- /dev/null +++ b/jquery/jquery.smartmenus-1.0.0.js @@ -0,0 +1,1214 @@ +/*! + * SmartMenus jQuery Plugin - v1.0.0 - January 27, 2016 + * http://www.smartmenus.org/ + * + * Copyright Vasil Dinkov, Vadikom Web Ltd. + * http://vadikom.com + * + * Licensed MIT + */ + +(function(factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['jquery'], factory); + } else if (typeof module === 'object' && typeof module.exports === 'object') { + // CommonJS + module.exports = factory(require('jquery')); + } else { + // Global jQuery + factory(jQuery); + } +} (function($) { + + var menuTrees = [], + IE = !!window.createPopup, // detect it for the iframe shim + mouse = false, // optimize for touch by default - we will detect for mouse input + touchEvents = 'ontouchstart' in window, // we use this just to choose between toucn and pointer events, not for touch screen detection + mouseDetectionEnabled = false, + requestAnimationFrame = window.requestAnimationFrame || function(callback) { return setTimeout(callback, 1000 / 60); }, + cancelAnimationFrame = window.cancelAnimationFrame || function(id) { clearTimeout(id); }; + + // Handle detection for mouse input (i.e. desktop browsers, tablets with a mouse, etc.) + function initMouseDetection(disable) { + var eNS = '.smartmenus_mouse'; + if (!mouseDetectionEnabled && !disable) { + // if we get two consecutive mousemoves within 2 pixels from each other and within 300ms, we assume a real mouse/cursor is present + // in practice, this seems like impossible to trick unintentianally with a real mouse and a pretty safe detection on touch devices (even with older browsers that do not support touch events) + var firstTime = true, + lastMove = null; + $(document).bind(getEventsNS([ + ['mousemove', function(e) { + var thisMove = { x: e.pageX, y: e.pageY, timeStamp: new Date().getTime() }; + if (lastMove) { + var deltaX = Math.abs(lastMove.x - thisMove.x), + deltaY = Math.abs(lastMove.y - thisMove.y); + if ((deltaX > 0 || deltaY > 0) && deltaX <= 2 && deltaY <= 2 && thisMove.timeStamp - lastMove.timeStamp <= 300) { + mouse = true; + // if this is the first check after page load, check if we are not over some item by chance and call the mouseenter handler if yes + if (firstTime) { + var $a = $(e.target).closest('a'); + if ($a.is('a')) { + $.each(menuTrees, function() { + if ($.contains(this.$root[0], $a[0])) { + this.itemEnter({ currentTarget: $a[0] }); + return false; + } + }); + } + firstTime = false; + } + } + } + lastMove = thisMove; + }], + [touchEvents ? 'touchstart' : 'pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut', function(e) { + if (isTouchEvent(e.originalEvent)) { + mouse = false; + } + }] + ], eNS)); + mouseDetectionEnabled = true; + } else if (mouseDetectionEnabled && disable) { + $(document).unbind(eNS); + mouseDetectionEnabled = false; + } + } + + function isTouchEvent(e) { + return !/^(4|mouse)$/.test(e.pointerType); + } + + // returns a jQuery bind() ready object + function getEventsNS(defArr, eNS) { + if (!eNS) { + eNS = ''; + } + var obj = {}; + $.each(defArr, function(index, value) { + obj[value[0].split(' ').join(eNS + ' ') + eNS] = value[1]; + }); + return obj; + } + + $.SmartMenus = function(elm, options) { + this.$root = $(elm); + this.opts = options; + this.rootId = ''; // internal + this.accessIdPrefix = ''; + this.$subArrow = null; + this.activatedItems = []; // stores last activated A's for each level + this.visibleSubMenus = []; // stores visible sub menus UL's (might be in no particular order) + this.showTimeout = 0; + this.hideTimeout = 0; + this.scrollTimeout = 0; + this.clickActivated = false; + this.focusActivated = false; + this.zIndexInc = 0; + this.idInc = 0; + this.$firstLink = null; // we'll use these for some tests + this.$firstSub = null; // at runtime so we'll cache them + this.disabled = false; + this.$disableOverlay = null; + this.$touchScrollingSub = null; + this.cssTransforms3d = 'perspective' in elm.style || 'webkitPerspective' in elm.style; + this.wasCollapsible = false; + this.init(); + }; + + $.extend($.SmartMenus, { + hideAll: function() { + $.each(menuTrees, function() { + this.menuHideAll(); + }); + }, + destroy: function() { + while (menuTrees.length) { + menuTrees[0].destroy(); + } + initMouseDetection(true); + }, + prototype: { + init: function(refresh) { + var self = this; + + if (!refresh) { + menuTrees.push(this); + + this.rootId = (new Date().getTime() + Math.random() + '').replace(/\D/g, ''); + this.accessIdPrefix = 'sm-' + this.rootId + '-'; + + if (this.$root.hasClass('sm-rtl')) { + this.opts.rightToLeftSubMenus = true; + } + + // init root (main menu) + var eNS = '.smartmenus'; + this.$root + .data('smartmenus', this) + .attr('data-smartmenus-id', this.rootId) + .dataSM('level', 1) + .bind(getEventsNS([ + ['mouseover focusin', $.proxy(this.rootOver, this)], + ['mouseout focusout', $.proxy(this.rootOut, this)], + ['keydown', $.proxy(this.rootKeyDown, this)] + ], eNS)) + .delegate('a', getEventsNS([ + ['mouseenter', $.proxy(this.itemEnter, this)], + ['mouseleave', $.proxy(this.itemLeave, this)], + ['mousedown', $.proxy(this.itemDown, this)], + ['focus', $.proxy(this.itemFocus, this)], + ['blur', $.proxy(this.itemBlur, this)], + ['click', $.proxy(this.itemClick, this)] + ], eNS)); + + // hide menus on tap or click outside the root UL + eNS += this.rootId; + if (this.opts.hideOnClick) { + $(document).bind(getEventsNS([ + ['touchstart', $.proxy(this.docTouchStart, this)], + ['touchmove', $.proxy(this.docTouchMove, this)], + ['touchend', $.proxy(this.docTouchEnd, this)], + // for Opera Mobile < 11.5, webOS browser, etc. we'll check click too + ['click', $.proxy(this.docClick, this)] + ], eNS)); + } + // hide sub menus on resize + $(window).bind(getEventsNS([['resize orientationchange', $.proxy(this.winResize, this)]], eNS)); + + if (this.opts.subIndicators) { + this.$subArrow = $('<span/>').addClass('sub-arrow'); + if (this.opts.subIndicatorsText) { + this.$subArrow.html(this.opts.subIndicatorsText); + } + } + + // make sure mouse detection is enabled + initMouseDetection(); + } + + // init sub menus + this.$firstSub = this.$root.find('ul').each(function() { self.menuInit($(this)); }).eq(0); + + this.$firstLink = this.$root.find('a').eq(0); + + // find current item + if (this.opts.markCurrentItem) { + var reDefaultDoc = /(index|default)\.[^#\?\/]*/i, + reHash = /#.*/, + locHref = window.location.href.replace(reDefaultDoc, ''), + locHrefNoHash = locHref.replace(reHash, ''); + this.$root.find('a').each(function() { + var href = this.href.replace(reDefaultDoc, ''), + $this = $(this); + if (href == locHref || href == locHrefNoHash) { + $this.addClass('current'); + if (self.opts.markCurrentTree) { + $this.parentsUntil('[data-smartmenus-id]', 'ul').each(function() { + $(this).dataSM('parent-a').addClass('current'); + }); + } + } + }); + } + + // save initial state + this.wasCollapsible = this.isCollapsible(); + }, + destroy: function(refresh) { + if (!refresh) { + var eNS = '.smartmenus'; + this.$root + .removeData('smartmenus') + .removeAttr('data-smartmenus-id') + .removeDataSM('level') + .unbind(eNS) + .undelegate(eNS); + eNS += this.rootId; + $(document).unbind(eNS); + $(window).unbind(eNS); + if (this.opts.subIndicators) { + this.$subArrow = null; + } + } + this.menuHideAll(); + var self = this; + this.$root.find('ul').each(function() { + var $this = $(this); + if ($this.dataSM('scroll-arrows')) { + $this.dataSM('scroll-arrows').remove(); + } + if ($this.dataSM('shown-before')) { + if (self.opts.subMenusMinWidth || self.opts.subMenusMaxWidth) { + $this.css({ width: '', minWidth: '', maxWidth: '' }).removeClass('sm-nowrap'); + } + if ($this.dataSM('scroll-arrows')) { + $this.dataSM('scroll-arrows').remove(); + } + $this.css({ zIndex: '', top: '', left: '', marginLeft: '', marginTop: '', display: '' }); + } + if (($this.attr('id') || '').indexOf(self.accessIdPrefix) == 0) { + $this.removeAttr('id'); + } + }) + .removeDataSM('in-mega') + .removeDataSM('shown-before') + .removeDataSM('ie-shim') + .removeDataSM('scroll-arrows') + .removeDataSM('parent-a') + .removeDataSM('level') + .removeDataSM('beforefirstshowfired') + .removeAttr('role') + .removeAttr('aria-hidden') + .removeAttr('aria-labelledby') + .removeAttr('aria-expanded'); + this.$root.find('a.has-submenu').each(function() { + var $this = $(this); + if ($this.attr('id').indexOf(self.accessIdPrefix) == 0) { + $this.removeAttr('id'); + } + }) + .removeClass('has-submenu') + .removeDataSM('sub') + .removeAttr('aria-haspopup') + .removeAttr('aria-controls') + .removeAttr('aria-expanded') + .closest('li').removeDataSM('sub'); + if (this.opts.subIndicators) { + this.$root.find('span.sub-arrow').remove(); + } + if (this.opts.markCurrentItem) { + this.$root.find('a.current').removeClass('current'); + } + if (!refresh) { + this.$root = null; + this.$firstLink = null; + this.$firstSub = null; + if (this.$disableOverlay) { + this.$disableOverlay.remove(); + this.$disableOverlay = null; + } + menuTrees.splice($.inArray(this, menuTrees), 1); + } + }, + disable: function(noOverlay) { + if (!this.disabled) { + this.menuHideAll(); + // display overlay over the menu to prevent interaction + if (!noOverlay && !this.opts.isPopup && this.$root.is(':visible')) { + var pos = this.$root.offset(); + this.$disableOverlay = $('<div class="sm-jquery-disable-overlay"/>').css({ + position: 'absolute', + top: pos.top, + left: pos.left, + width: this.$root.outerWidth(), + height: this.$root.outerHeight(), + zIndex: this.getStartZIndex(true), + opacity: 0 + }).appendTo(document.body); + } + this.disabled = true; + } + }, + docClick: function(e) { + if (this.$touchScrollingSub) { + this.$touchScrollingSub = null; + return; + } + // hide on any click outside the menu or on a menu link + if (this.visibleSubMenus.length && !$.contains(this.$root[0], e.target) || $(e.target).is('a')) { + this.menuHideAll(); + } + }, + docTouchEnd: function(e) { + if (!this.lastTouch) { + return; + } + if (this.visibleSubMenus.length && (this.lastTouch.x2 === undefined || this.lastTouch.x1 == this.lastTouch.x2) && (this.lastTouch.y2 === undefined || this.lastTouch.y1 == this.lastTouch.y2) && (!this.lastTouch.target || !$.contains(this.$root[0], this.lastTouch.target))) { + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + // hide with a delay to prevent triggering accidental unwanted click on some page element + var self = this; + this.hideTimeout = setTimeout(function() { self.menuHideAll(); }, 350); + } + this.lastTouch = null; + }, + docTouchMove: function(e) { + if (!this.lastTouch) { + return; + } + var touchPoint = e.originalEvent.touches[0]; + this.lastTouch.x2 = touchPoint.pageX; + this.lastTouch.y2 = touchPoint.pageY; + }, + docTouchStart: function(e) { + var touchPoint = e.originalEvent.touches[0]; + this.lastTouch = { x1: touchPoint.pageX, y1: touchPoint.pageY, target: touchPoint.target }; + }, + enable: function() { + if (this.disabled) { + if (this.$disableOverlay) { + this.$disableOverlay.remove(); + this.$disableOverlay = null; + } + this.disabled = false; + } + }, + getClosestMenu: function(elm) { + var $closestMenu = $(elm).closest('ul'); + while ($closestMenu.dataSM('in-mega')) { + $closestMenu = $closestMenu.parent().closest('ul'); + } + return $closestMenu[0] || null; + }, + getHeight: function($elm) { + return this.getOffset($elm, true); + }, + // returns precise width/height float values + getOffset: function($elm, height) { + var old; + if ($elm.css('display') == 'none') { + old = { position: $elm[0].style.position, visibility: $elm[0].style.visibility }; + $elm.css({ position: 'absolute', visibility: 'hidden' }).show(); + } + var box = $elm[0].getBoundingClientRect && $elm[0].getBoundingClientRect(), + val = box && (height ? box.height || box.bottom - box.top : box.width || box.right - box.left); + if (!val && val !== 0) { + val = height ? $elm[0].offsetHeight : $elm[0].offsetWidth; + } + if (old) { + $elm.hide().css(old); + } + return val; + }, + getStartZIndex: function(root) { + var zIndex = parseInt(this[root ? '$root' : '$firstSub'].css('z-index')); + if (!root && isNaN(zIndex)) { + zIndex = parseInt(this.$root.css('z-index')); + } + return !isNaN(zIndex) ? zIndex : 1; + }, + getTouchPoint: function(e) { + return e.touches && e.touches[0] || e.changedTouches && e.changedTouches[0] || e; + }, + getViewport: function(height) { + var name = height ? 'Height' : 'Width', + val = document.documentElement['client' + name], + val2 = window['inner' + name]; + if (val2) { + val = Math.min(val, val2); + } + return val; + }, + getViewportHeight: function() { + return this.getViewport(true); + }, + getViewportWidth: function() { + return this.getViewport(); + }, + getWidth: function($elm) { + return this.getOffset($elm); + }, + handleEvents: function() { + return !this.disabled && this.isCSSOn(); + }, + handleItemEvents: function($a) { + return this.handleEvents() && !this.isLinkInMegaMenu($a); + }, + isCollapsible: function() { + return this.$firstSub.css('position') == 'static'; + }, + isCSSOn: function() { + return this.$firstLink.css('display') == 'block'; + }, + isFixed: function() { + var isFixed = this.$root.css('position') == 'fixed'; + if (!isFixed) { + this.$root.parentsUntil('body').each(function() { + if ($(this).css('position') == 'fixed') { + isFixed = true; + return false; + } + }); + } + return isFixed; + }, + isLinkInMegaMenu: function($a) { + return $(this.getClosestMenu($a[0])).hasClass('mega-menu'); + }, + isTouchMode: function() { + return !mouse || this.opts.noMouseOver || this.isCollapsible(); + }, + itemActivate: function($a, focus) { + var $ul = $a.closest('ul'), + level = $ul.dataSM('level'); + // if for some reason the parent item is not activated (e.g. this is an API call to activate the item), activate all parent items first + if (level > 1 && (!this.activatedItems[level - 2] || this.activatedItems[level - 2][0] != $ul.dataSM('parent-a')[0])) { + var self = this; + $($ul.parentsUntil('[data-smartmenus-id]', 'ul').get().reverse()).add($ul).each(function() { + self.itemActivate($(this).dataSM('parent-a')); + }); + } + // hide any visible deeper level sub menus + if (!this.isCollapsible() || focus) { + this.menuHideSubMenus(!this.activatedItems[level - 1] || this.activatedItems[level - 1][0] != $a[0] ? level - 1 : level); + } + // save new active item for this level + this.activatedItems[level - 1] = $a; + if (this.$root.triggerHandler('activate.smapi', $a[0]) === false) { + return; + } + // show the sub menu if this item has one + var $sub = $a.dataSM('sub'); + if ($sub && (this.isTouchMode() || (!this.opts.showOnClick || this.clickActivated))) { + this.menuShow($sub); + } + }, + itemBlur: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + this.$root.triggerHandler('blur.smapi', $a[0]); + }, + itemClick: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + if (this.$touchScrollingSub && this.$touchScrollingSub[0] == $a.closest('ul')[0]) { + this.$touchScrollingSub = null; + e.stopPropagation(); + return false; + } + if (this.$root.triggerHandler('click.smapi', $a[0]) === false) { + return false; + } + var subArrowClicked = $(e.target).is('span.sub-arrow'), + $sub = $a.dataSM('sub'), + firstLevelSub = $sub ? $sub.dataSM('level') == 2 : false; + // if the sub is not visible + if ($sub && !$sub.is(':visible')) { + if (this.opts.showOnClick && firstLevelSub) { + this.clickActivated = true; + } + // try to activate the item and show the sub + this.itemActivate($a); + // if "itemActivate" showed the sub, prevent the click so that the link is not loaded + // if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded + if ($sub.is(':visible')) { + this.focusActivated = true; + return false; + } + } else if (this.isCollapsible() && subArrowClicked) { + this.itemActivate($a); + this.menuHide($sub); + return false; + } + if (this.opts.showOnClick && firstLevelSub || $a.hasClass('disabled') || this.$root.triggerHandler('select.smapi', $a[0]) === false) { + return false; + } + }, + itemDown: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + $a.dataSM('mousedown', true); + }, + itemEnter: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + if (!this.isTouchMode()) { + if (this.showTimeout) { + clearTimeout(this.showTimeout); + this.showTimeout = 0; + } + var self = this; + this.showTimeout = setTimeout(function() { self.itemActivate($a); }, this.opts.showOnClick && $a.closest('ul').dataSM('level') == 1 ? 1 : this.opts.showTimeout); + } + this.$root.triggerHandler('mouseenter.smapi', $a[0]); + }, + itemFocus: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + // fix (the mousedown check): in some browsers a tap/click produces consecutive focus + click events so we don't need to activate the item on focus + if (this.focusActivated && (!this.isTouchMode() || !$a.dataSM('mousedown')) && (!this.activatedItems.length || this.activatedItems[this.activatedItems.length - 1][0] != $a[0])) { + this.itemActivate($a, true); + } + this.$root.triggerHandler('focus.smapi', $a[0]); + }, + itemLeave: function(e) { + var $a = $(e.currentTarget); + if (!this.handleItemEvents($a)) { + return; + } + if (!this.isTouchMode()) { + $a[0].blur(); + if (this.showTimeout) { + clearTimeout(this.showTimeout); + this.showTimeout = 0; + } + } + $a.removeDataSM('mousedown'); + this.$root.triggerHandler('mouseleave.smapi', $a[0]); + }, + menuHide: function($sub) { + if (this.$root.triggerHandler('beforehide.smapi', $sub[0]) === false) { + return; + } + $sub.stop(true, true); + if ($sub.css('display') != 'none') { + var complete = function() { + // unset z-index + $sub.css('z-index', ''); + }; + // if sub is collapsible (mobile view) + if (this.isCollapsible()) { + if (this.opts.collapsibleHideFunction) { + this.opts.collapsibleHideFunction.call(this, $sub, complete); + } else { + $sub.hide(this.opts.collapsibleHideDuration, complete); + } + } else { + if (this.opts.hideFunction) { + this.opts.hideFunction.call(this, $sub, complete); + } else { + $sub.hide(this.opts.hideDuration, complete); + } + } + // remove IE iframe shim + if ($sub.dataSM('ie-shim')) { + $sub.dataSM('ie-shim').remove().css({ '-webkit-transform': '', transform: '' }); + } + // deactivate scrolling if it is activated for this sub + if ($sub.dataSM('scroll')) { + this.menuScrollStop($sub); + $sub.css({ 'touch-action': '', '-ms-touch-action': '', '-webkit-transform': '', transform: '' }) + .unbind('.smartmenus_scroll').removeDataSM('scroll').dataSM('scroll-arrows').hide(); + } + // unhighlight parent item + accessibility + $sub.dataSM('parent-a').removeClass('highlighted').attr('aria-expanded', 'false'); + $sub.attr({ + 'aria-expanded': 'false', + 'aria-hidden': 'true' + }); + var level = $sub.dataSM('level'); + this.activatedItems.splice(level - 1, 1); + this.visibleSubMenus.splice($.inArray($sub, this.visibleSubMenus), 1); + this.$root.triggerHandler('hide.smapi', $sub[0]); + } + }, + menuHideAll: function() { + if (this.showTimeout) { + clearTimeout(this.showTimeout); + this.showTimeout = 0; + } + // hide all subs + // if it's a popup, this.visibleSubMenus[0] is the root UL + var level = this.opts.isPopup ? 1 : 0; + for (var i = this.visibleSubMenus.length - 1; i >= level; i--) { + this.menuHide(this.visibleSubMenus[i]); + } + // hide root if it's popup + if (this.opts.isPopup) { + this.$root.stop(true, true); + if (this.$root.is(':visible')) { + if (this.opts.hideFunction) { + this.opts.hideFunction.call(this, this.$root); + } else { + this.$root.hide(this.opts.hideDuration); + } + // remove IE iframe shim + if (this.$root.dataSM('ie-shim')) { + this.$root.dataSM('ie-shim').remove(); + } + } + } + this.activatedItems = []; + this.visibleSubMenus = []; + this.clickActivated = false; + this.focusActivated = false; + // reset z-index increment + this.zIndexInc = 0; + this.$root.triggerHandler('hideAll.smapi'); + }, + menuHideSubMenus: function(level) { + for (var i = this.activatedItems.length - 1; i >= level; i--) { + var $sub = this.activatedItems[i].dataSM('sub'); + if ($sub) { + this.menuHide($sub); + } + } + }, + menuIframeShim: function($ul) { + // create iframe shim for the menu + if (IE && this.opts.overlapControlsInIE && !$ul.dataSM('ie-shim')) { + $ul.dataSM('ie-shim', $('<iframe/>').attr({ src: 'javascript:0', tabindex: -9 }) + .css({ position: 'absolute', top: 'auto', left: '0', opacity: 0, border: '0' }) + ); + } + }, + menuInit: function($ul) { + if (!$ul.dataSM('in-mega')) { + // mark UL's in mega drop downs (if any) so we can neglect them + if ($ul.hasClass('mega-menu')) { + $ul.find('ul').dataSM('in-mega', true); + } + // get level (much faster than, for example, using parentsUntil) + var level = 2, + par = $ul[0]; + while ((par = par.parentNode.parentNode) != this.$root[0]) { + level++; + } + // cache stuff for quick access + var $a = $ul.prevAll('a').eq(-1); + // if the link is nested (e.g. in a heading) + if (!$a.length) { + $a = $ul.prevAll().find('a').eq(-1); + } + $a.addClass('has-submenu').dataSM('sub', $ul); + $ul.dataSM('parent-a', $a) + .dataSM('level', level) + .parent().dataSM('sub', $ul); + // accessibility + var aId = $a.attr('id') || this.accessIdPrefix + (++this.idInc), + ulId = $ul.attr('id') || this.accessIdPrefix + (++this.idInc); + $a.attr({ + id: aId, + 'aria-haspopup': 'true', + 'aria-controls': ulId, + 'aria-expanded': 'false' + }); + $ul.attr({ + id: ulId, + 'role': 'group', + 'aria-hidden': 'true', + 'aria-labelledby': aId, + 'aria-expanded': 'false' + }); + // add sub indicator to parent item + if (this.opts.subIndicators) { + $a[this.opts.subIndicatorsPos](this.$subArrow.clone()); + } + } + }, + menuPosition: function($sub) { + var $a = $sub.dataSM('parent-a'), + $li = $a.closest('li'), + $ul = $li.parent(), + level = $sub.dataSM('level'), + subW = this.getWidth($sub), + subH = this.getHeight($sub), + itemOffset = $a.offset(), + itemX = itemOffset.left, + itemY = itemOffset.top, + itemW = this.getWidth($a), + itemH = this.getHeight($a), + $win = $(window), + winX = $win.scrollLeft(), + winY = $win.scrollTop(), + winW = this.getViewportWidth(), + winH = this.getViewportHeight(), + horizontalParent = $ul.parent().is('[data-sm-horizontal-sub]') || level == 2 && !$ul.hasClass('sm-vertical'), + rightToLeft = this.opts.rightToLeftSubMenus && !$li.is('[data-sm-reverse]') || !this.opts.rightToLeftSubMenus && $li.is('[data-sm-reverse]'), + subOffsetX = level == 2 ? this.opts.mainMenuSubOffsetX : this.opts.subMenusSubOffsetX, + subOffsetY = level == 2 ? this.opts.mainMenuSubOffsetY : this.opts.subMenusSubOffsetY, + x, y; + if (horizontalParent) { + x = rightToLeft ? itemW - subW - subOffsetX : subOffsetX; + y = this.opts.bottomToTopSubMenus ? -subH - subOffsetY : itemH + subOffsetY; + } else { + x = rightToLeft ? subOffsetX - subW : itemW - subOffsetX; + y = this.opts.bottomToTopSubMenus ? itemH - subOffsetY - subH : subOffsetY; + } + if (this.opts.keepInViewport) { + var absX = itemX + x, + absY = itemY + y; + if (rightToLeft && absX < winX) { + x = horizontalParent ? winX - absX + x : itemW - subOffsetX; + } else if (!rightToLeft && absX + subW > winX + winW) { + x = horizontalParent ? winX + winW - subW - absX + x : subOffsetX - subW; + } + if (!horizontalParent) { + if (subH < winH && absY + subH > winY + winH) { + y += winY + winH - subH - absY; + } else if (subH >= winH || absY < winY) { + y += winY - absY; + } + } + // do we need scrolling? + // 0.49 used for better precision when dealing with float values + if (horizontalParent && (absY + subH > winY + winH + 0.49 || absY < winY) || !horizontalParent && subH > winH + 0.49) { + var self = this; + if (!$sub.dataSM('scroll-arrows')) { + $sub.dataSM('scroll-arrows', $([$('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0], $('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]) + .bind({ + mouseenter: function() { + $sub.dataSM('scroll').up = $(this).hasClass('scroll-up'); + self.menuScroll($sub); + }, + mouseleave: function(e) { + self.menuScrollStop($sub); + self.menuScrollOut($sub, e); + }, + 'mousewheel DOMMouseScroll': function(e) { e.preventDefault(); } + }) + .insertAfter($sub) + ); + } + // bind scroll events and save scroll data for this sub + var eNS = '.smartmenus_scroll'; + $sub.dataSM('scroll', { + y: this.cssTransforms3d ? 0 : y - itemH, + step: 1, + // cache stuff for faster recalcs later + itemH: itemH, + subH: subH, + arrowDownH: this.getHeight($sub.dataSM('scroll-arrows').eq(1)) + }) + .bind(getEventsNS([ + ['mouseover', function(e) { self.menuScrollOver($sub, e); }], + ['mouseout', function(e) { self.menuScrollOut($sub, e); }], + ['mousewheel DOMMouseScroll', function(e) { self.menuScrollMousewheel($sub, e); }] + ], eNS)) + .dataSM('scroll-arrows').css({ top: 'auto', left: '0', marginLeft: x + (parseInt($sub.css('border-left-width')) || 0), width: subW - (parseInt($sub.css('border-left-width')) || 0) - (parseInt($sub.css('border-right-width')) || 0), zIndex: $sub.css('z-index') }) + .eq(horizontalParent && this.opts.bottomToTopSubMenus ? 0 : 1).show(); + // when a menu tree is fixed positioned we allow scrolling via touch too + // since there is no other way to access such long sub menus if no mouse is present + if (this.isFixed()) { + $sub.css({ 'touch-action': 'none', '-ms-touch-action': 'none' }) + .bind(getEventsNS([ + [touchEvents ? 'touchstart touchmove touchend' : 'pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp', function(e) { + self.menuScrollTouch($sub, e); + }] + ], eNS)); + } + } + } + $sub.css({ top: 'auto', left: '0', marginLeft: x, marginTop: y - itemH }); + // IE iframe shim + this.menuIframeShim($sub); + if ($sub.dataSM('ie-shim')) { + $sub.dataSM('ie-shim').css({ zIndex: $sub.css('z-index'), width: subW, height: subH, marginLeft: x, marginTop: y - itemH }); + } + }, + menuScroll: function($sub, once, step) { + var data = $sub.dataSM('scroll'), + $arrows = $sub.dataSM('scroll-arrows'), + end = data.up ? data.upEnd : data.downEnd, + diff; + if (!once && data.momentum) { + data.momentum *= 0.92; + diff = data.momentum; + if (diff < 0.5) { + this.menuScrollStop($sub); + return; + } + } else { + diff = step || (once || !this.opts.scrollAccelerate ? this.opts.scrollStep : Math.floor(data.step)); + } + // hide any visible deeper level sub menus + var level = $sub.dataSM('level'); + if (this.activatedItems[level - 1] && this.activatedItems[level - 1].dataSM('sub') && this.activatedItems[level - 1].dataSM('sub').is(':visible')) { + this.menuHideSubMenus(level - 1); + } + data.y = data.up && end <= data.y || !data.up && end >= data.y ? data.y : (Math.abs(end - data.y) > diff ? data.y + (data.up ? diff : -diff) : end); + $sub.add($sub.dataSM('ie-shim')).css(this.cssTransforms3d ? { '-webkit-transform': 'translate3d(0, ' + data.y + 'px, 0)', transform: 'translate3d(0, ' + data.y + 'px, 0)' } : { marginTop: data.y }); + // show opposite arrow if appropriate + if (mouse && (data.up && data.y > data.downEnd || !data.up && data.y < data.upEnd)) { + $arrows.eq(data.up ? 1 : 0).show(); + } + // if we've reached the end + if (data.y == end) { + if (mouse) { + $arrows.eq(data.up ? 0 : 1).hide(); + } + this.menuScrollStop($sub); + } else if (!once) { + if (this.opts.scrollAccelerate && data.step < this.opts.scrollStep) { + data.step += 0.2; + } + var self = this; + this.scrollTimeout = requestAnimationFrame(function() { self.menuScroll($sub); }); + } + }, + menuScrollMousewheel: function($sub, e) { + if (this.getClosestMenu(e.target) == $sub[0]) { + e = e.originalEvent; + var up = (e.wheelDelta || -e.detail) > 0; + if ($sub.dataSM('scroll-arrows').eq(up ? 0 : 1).is(':visible')) { + $sub.dataSM('scroll').up = up; + this.menuScroll($sub, true); + } + } + e.preventDefault(); + }, + menuScrollOut: function($sub, e) { + if (mouse) { + if (!/^scroll-(up|down)/.test((e.relatedTarget || '').className) && ($sub[0] != e.relatedTarget && !$.contains($sub[0], e.relatedTarget) || this.getClosestMenu(e.relatedTarget) != $sub[0])) { + $sub.dataSM('scroll-arrows').css('visibility', 'hidden'); + } + } + }, + menuScrollOver: function($sub, e) { + if (mouse) { + if (!/^scroll-(up|down)/.test(e.target.className) && this.getClosestMenu(e.target) == $sub[0]) { + this.menuScrollRefreshData($sub); + var data = $sub.dataSM('scroll'), + upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH; + $sub.dataSM('scroll-arrows').eq(0).css('margin-top', upEnd).end() + .eq(1).css('margin-top', upEnd + this.getViewportHeight() - data.arrowDownH).end() + .css('visibility', 'visible'); + } + } + }, + menuScrollRefreshData: function($sub) { + var data = $sub.dataSM('scroll'), + upEnd = $(window).scrollTop() - $sub.dataSM('parent-a').offset().top - data.itemH; + if (this.cssTransforms3d) { + upEnd = -(parseFloat($sub.css('margin-top')) - upEnd); + } + $.extend(data, { + upEnd: upEnd, + downEnd: upEnd + this.getViewportHeight() - data.subH + }); + }, + menuScrollStop: function($sub) { + if (this.scrollTimeout) { + cancelAnimationFrame(this.scrollTimeout); + this.scrollTimeout = 0; + $sub.dataSM('scroll').step = 1; + return true; + } + }, + menuScrollTouch: function($sub, e) { + e = e.originalEvent; + if (isTouchEvent(e)) { + var touchPoint = this.getTouchPoint(e); + // neglect event if we touched a visible deeper level sub menu + if (this.getClosestMenu(touchPoint.target) == $sub[0]) { + var data = $sub.dataSM('scroll'); + if (/(start|down)$/i.test(e.type)) { + if (this.menuScrollStop($sub)) { + // if we were scrolling, just stop and don't activate any link on the first touch + e.preventDefault(); + this.$touchScrollingSub = $sub; + } else { + this.$touchScrollingSub = null; + } + // update scroll data since the user might have zoomed, etc. + this.menuScrollRefreshData($sub); + // extend it with the touch properties + $.extend(data, { + touchStartY: touchPoint.pageY, + touchStartTime: e.timeStamp + }); + } else if (/move$/i.test(e.type)) { + var prevY = data.touchY !== undefined ? data.touchY : data.touchStartY; + if (prevY !== undefined && prevY != touchPoint.pageY) { + this.$touchScrollingSub = $sub; + var up = prevY < touchPoint.pageY; + // changed direction? reset... + if (data.up !== undefined && data.up != up) { + $.extend(data, { + touchStartY: touchPoint.pageY, + touchStartTime: e.timeStamp + }); + } + $.extend(data, { + up: up, + touchY: touchPoint.pageY + }); + this.menuScroll($sub, true, Math.abs(touchPoint.pageY - prevY)); + } + e.preventDefault(); + } else { // touchend/pointerup + if (data.touchY !== undefined) { + if (data.momentum = Math.pow(Math.abs(touchPoint.pageY - data.touchStartY) / (e.timeStamp - data.touchStartTime), 2) * 15) { + this.menuScrollStop($sub); + this.menuScroll($sub); + e.preventDefault(); + } + delete data.touchY; + } + } + } + } + }, + menuShow: function($sub) { + if (!$sub.dataSM('beforefirstshowfired')) { + $sub.dataSM('beforefirstshowfired', true); + if (this.$root.triggerHandler('beforefirstshow.smapi', $sub[0]) === false) { + return; + } + } + if (this.$root.triggerHandler('beforeshow.smapi', $sub[0]) === false) { + return; + } + $sub.dataSM('shown-before', true) + .stop(true, true); + if (!$sub.is(':visible')) { + // highlight parent item + var $a = $sub.dataSM('parent-a'); + if (this.opts.keepHighlighted || this.isCollapsible()) { + $a.addClass('highlighted'); + } + if (this.isCollapsible()) { + $sub.removeClass('sm-nowrap').css({ zIndex: '', width: 'auto', minWidth: '', maxWidth: '', top: '', left: '', marginLeft: '', marginTop: '' }); + } else { + // set z-index + $sub.css('z-index', this.zIndexInc = (this.zIndexInc || this.getStartZIndex()) + 1); + // min/max-width fix - no way to rely purely on CSS as all UL's are nested + if (this.opts.subMenusMinWidth || this.opts.subMenusMaxWidth) { + $sub.css({ width: 'auto', minWidth: '', maxWidth: '' }).addClass('sm-nowrap'); + if (this.opts.subMenusMinWidth) { + $sub.css('min-width', this.opts.subMenusMinWidth); + } + if (this.opts.subMenusMaxWidth) { + var noMaxWidth = this.getWidth($sub); + $sub.css('max-width', this.opts.subMenusMaxWidth); + if (noMaxWidth > this.getWidth($sub)) { + $sub.removeClass('sm-nowrap').css('width', this.opts.subMenusMaxWidth); + } + } + } + this.menuPosition($sub); + // insert IE iframe shim + if ($sub.dataSM('ie-shim')) { + $sub.dataSM('ie-shim').insertBefore($sub); + } + } + var complete = function() { + // fix: "overflow: hidden;" is not reset on animation complete in jQuery < 1.9.0 in Chrome when global "box-sizing: border-box;" is used + $sub.css('overflow', ''); + }; + // if sub is collapsible (mobile view) + if (this.isCollapsible()) { + if (this.opts.collapsibleShowFunction) { + this.opts.collapsibleShowFunction.call(this, $sub, complete); + } else { + $sub.show(this.opts.collapsibleShowDuration, complete); + } + } else { + if (this.opts.showFunction) { + this.opts.showFunction.call(this, $sub, complete); + } else { + $sub.show(this.opts.showDuration, complete); + } + } + // accessibility + $a.attr('aria-expanded', 'true'); + $sub.attr({ + 'aria-expanded': 'true', + 'aria-hidden': 'false' + }); + // store sub menu in visible array + this.visibleSubMenus.push($sub); + this.$root.triggerHandler('show.smapi', $sub[0]); + } + }, + popupHide: function(noHideTimeout) { + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + var self = this; + this.hideTimeout = setTimeout(function() { + self.menuHideAll(); + }, noHideTimeout ? 1 : this.opts.hideTimeout); + }, + popupShow: function(left, top) { + if (!this.opts.isPopup) { + alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'); + return; + } + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + this.$root.dataSM('shown-before', true) + .stop(true, true); + if (!this.$root.is(':visible')) { + this.$root.css({ left: left, top: top }); + // IE iframe shim + this.menuIframeShim(this.$root); + if (this.$root.dataSM('ie-shim')) { + this.$root.dataSM('ie-shim').css({ zIndex: this.$root.css('z-index'), width: this.getWidth(this.$root), height: this.getHeight(this.$root), left: left, top: top }).insertBefore(this.$root); + } + // show menu + var self = this, + complete = function() { + self.$root.css('overflow', ''); + }; + if (this.opts.showFunction) { + this.opts.showFunction.call(this, this.$root, complete); + } else { + this.$root.show(this.opts.showDuration, complete); + } + this.visibleSubMenus[0] = this.$root; + } + }, + refresh: function() { + this.destroy(true); + this.init(true); + }, + rootKeyDown: function(e) { + if (!this.handleEvents()) { + return; + } + switch (e.keyCode) { + case 27: // reset on Esc + var $activeTopItem = this.activatedItems[0]; + if ($activeTopItem) { + this.menuHideAll(); + $activeTopItem[0].focus(); + var $sub = $activeTopItem.dataSM('sub'); + if ($sub) { + this.menuHide($sub); + } + } + break; + case 32: // activate item's sub on Space + var $target = $(e.target); + if ($target.is('a') && this.handleItemEvents($target)) { + var $sub = $target.dataSM('sub'); + if ($sub && !$sub.is(':visible')) { + this.itemClick({ currentTarget: e.target }); + e.preventDefault(); + } + } + break; + } + }, + rootOut: function(e) { + if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) { + return; + } + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + if (!this.opts.showOnClick || !this.opts.hideOnClick) { + var self = this; + this.hideTimeout = setTimeout(function() { self.menuHideAll(); }, this.opts.hideTimeout); + } + }, + rootOver: function(e) { + if (!this.handleEvents() || this.isTouchMode() || e.target == this.$root[0]) { + return; + } + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + this.hideTimeout = 0; + } + }, + winResize: function(e) { + if (!this.handleEvents()) { + // we still need to resize the disable overlay if it's visible + if (this.$disableOverlay) { + var pos = this.$root.offset(); + this.$disableOverlay.css({ + top: pos.top, + left: pos.left, + width: this.$root.outerWidth(), + height: this.$root.outerHeight() + }); + } + return; + } + // hide sub menus on resize - on mobile do it only on orientation change + if (!('onorientationchange' in window) || e.type == 'orientationchange') { + var isCollapsible = this.isCollapsible(); + // if it was collapsible before resize and still is, don't do it + if (!(this.wasCollapsible && isCollapsible)) { + if (this.activatedItems.length) { + this.activatedItems[this.activatedItems.length - 1][0].blur(); + } + this.menuHideAll(); + } + this.wasCollapsible = isCollapsible; + } + } + } + }); + + $.fn.dataSM = function(key, val) { + if (val) { + return this.data(key + '_smartmenus', val); + } + return this.data(key + '_smartmenus'); + } + + $.fn.removeDataSM = function(key) { + return this.removeData(key + '_smartmenus'); + } + + $.fn.smartmenus = function(options) { + if (typeof options == 'string') { + var args = arguments, + method = options; + Array.prototype.shift.call(args); + return this.each(function() { + var smartmenus = $(this).data('smartmenus'); + if (smartmenus && smartmenus[method]) { + smartmenus[method].apply(smartmenus, args); + } + }); + } + var opts = $.extend({}, $.fn.smartmenus.defaults, options); + return this.each(function() { + new $.SmartMenus(this, opts); + }); + } + + // default settings + $.fn.smartmenus.defaults = { + isPopup: false, // is this a popup menu (can be shown via the popupShow/popupHide methods) or a permanent menu bar + mainMenuSubOffsetX: 0, // pixels offset from default position + mainMenuSubOffsetY: 0, // pixels offset from default position + subMenusSubOffsetX: 0, // pixels offset from default position + subMenusSubOffsetY: 0, // pixels offset from default position + subMenusMinWidth: '10em', // min-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored + subMenusMaxWidth: '20em', // max-width for the sub menus (any CSS unit) - if set, the fixed width set in CSS will be ignored + subIndicators: true, // create sub menu indicators - creates a SPAN and inserts it in the A + subIndicatorsPos: 'prepend', // position of the SPAN relative to the menu item content ('prepend', 'append') + subIndicatorsText: '+', // [optionally] add text in the SPAN (e.g. '+') (you may want to check the CSS for the sub indicators too) + scrollStep: 30, // pixels step when scrolling long sub menus that do not fit in the viewport height + scrollAccelerate: true, // accelerate scrolling or use a fixed step + showTimeout: 250, // timeout before showing the sub menus + hideTimeout: 500, // timeout before hiding the sub menus + showDuration: 0, // duration for show animation - set to 0 for no animation - matters only if showFunction:null + showFunction: null, // custom function to use when showing a sub menu (the default is the jQuery 'show') + // don't forget to call complete() at the end of whatever you do + // e.g.: function($ul, complete) { $ul.fadeIn(250, complete); } + hideDuration: 0, // duration for hide animation - set to 0 for no animation - matters only if hideFunction:null + hideFunction: function($ul, complete) { $ul.fadeOut(200, complete); }, // custom function to use when hiding a sub menu (the default is the jQuery 'hide') + // don't forget to call complete() at the end of whatever you do + // e.g.: function($ul, complete) { $ul.fadeOut(250, complete); } + collapsibleShowDuration:0, // duration for show animation for collapsible sub menus - matters only if collapsibleShowFunction:null + collapsibleShowFunction:function($ul, complete) { $ul.slideDown(200, complete); }, // custom function to use when showing a collapsible sub menu + // (i.e. when mobile styles are used to make the sub menus collapsible) + collapsibleHideDuration:0, // duration for hide animation for collapsible sub menus - matters only if collapsibleHideFunction:null + collapsibleHideFunction:function($ul, complete) { $ul.slideUp(200, complete); }, // custom function to use when hiding a collapsible sub menu + // (i.e. when mobile styles are used to make the sub menus collapsible) + showOnClick: false, // show the first-level sub menus onclick instead of onmouseover (i.e. mimic desktop app menus) (matters only for mouse input) + hideOnClick: true, // hide the sub menus on click/tap anywhere on the page + noMouseOver: false, // disable sub menus activation onmouseover (i.e. behave like in touch mode - use just mouse clicks) (matters only for mouse input) + keepInViewport: true, // reposition the sub menus if needed to make sure they always appear inside the viewport + keepHighlighted: true, // keep all ancestor items of the current sub menu highlighted (adds the 'highlighted' class to the A's) + markCurrentItem: false, // automatically add the 'current' class to the A element of the item linking to the current URL + markCurrentTree: true, // add the 'current' class also to the A elements of all ancestor items of the current item + rightToLeftSubMenus: false, // right to left display of the sub menus (check the CSS for the sub indicators' position) + bottomToTopSubMenus: false, // bottom to top display of the sub menus + overlapControlsInIE: true // make sure sub menus appear on top of special OS controls in IE (i.e. SELECT, OBJECT, EMBED, etc.) + }; + + return $; +})); diff --git a/jquery/jquery.ui-0.2.3.touch-punch.js b/jquery/jquery.ui-0.2.3.touch-punch.js new file mode 100644 index 0000000..16ce41d --- /dev/null +++ b/jquery/jquery.ui-0.2.3.touch-punch.js @@ -0,0 +1,180 @@ +/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function ($) { + + // Detect touch support + $.support.touch = 'ontouchend' in document; + + // Ignore browsers without touch support + if (!$.support.touch) { + return; + } + + var mouseProto = $.ui.mouse.prototype, + _mouseInit = mouseProto._mouseInit, + _mouseDestroy = mouseProto._mouseDestroy, + touchHandled; + + /** + * Simulate a mouse event based on a corresponding touch event + * @param {Object} event A touch event + * @param {String} simulatedType The corresponding mouse event + */ + function simulateMouseEvent (event, simulatedType) { + + // Ignore multi-touch events + if (event.originalEvent.touches.length > 1) { + return; + } + + event.preventDefault(); + + var touch = event.originalEvent.changedTouches[0], + simulatedEvent = document.createEvent('MouseEvents'); + + // Initialize the simulated mouse event using the touch event's coordinates + simulatedEvent.initMouseEvent( + simulatedType, // type + true, // bubbles + true, // cancelable + window, // view + 1, // detail + touch.screenX, // screenX + touch.screenY, // screenY + touch.clientX, // clientX + touch.clientY, // clientY + false, // ctrlKey + false, // altKey + false, // shiftKey + false, // metaKey + 0, // button + null // relatedTarget + ); + + // Dispatch the simulated event to the target element + event.target.dispatchEvent(simulatedEvent); + } + + /** + * Handle the jQuery UI widget's touchstart events + * @param {Object} event The widget element's touchstart event + */ + mouseProto._touchStart = function (event) { + + var self = this; + + // Ignore the event if another widget is already being handled + if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) { + return; + } + + // Set the flag to prevent other widgets from inheriting the touch event + touchHandled = true; + + // Track movement to determine if interaction was a click + self._touchMoved = false; + + // Simulate the mouseover event + simulateMouseEvent(event, 'mouseover'); + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + + // Simulate the mousedown event + simulateMouseEvent(event, 'mousedown'); + }; + + /** + * Handle the jQuery UI widget's touchmove events + * @param {Object} event The document's touchmove event + */ + mouseProto._touchMove = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Interaction was not a click + this._touchMoved = true; + + // Simulate the mousemove event + simulateMouseEvent(event, 'mousemove'); + }; + + /** + * Handle the jQuery UI widget's touchend events + * @param {Object} event The document's touchend event + */ + mouseProto._touchEnd = function (event) { + + // Ignore event if not handled + if (!touchHandled) { + return; + } + + // Simulate the mouseup event + simulateMouseEvent(event, 'mouseup'); + + // Simulate the mouseout event + simulateMouseEvent(event, 'mouseout'); + + // If the touch interaction did not move, it should trigger a click + if (!this._touchMoved) { + + // Simulate the click event + simulateMouseEvent(event, 'click'); + } + + // Unset the flag to allow other widgets to inherit the touch event + touchHandled = false; + }; + + /** + * A duck punch of the $.ui.mouse _mouseInit method to support touch events. + * This method extends the widget with bound touch event handlers that + * translate touch events to mouse events and pass them to the widget's + * original mouse event handling methods. + */ + mouseProto._mouseInit = function () { + + var self = this; + + // Delegate the touch handlers to the widget's element + self.element.bind({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse init method + _mouseInit.call(self); + }; + + /** + * Remove the touch event handlers + */ + mouseProto._mouseDestroy = function () { + + var self = this; + + // Delegate the touch handlers to the widget's element + self.element.unbind({ + touchstart: $.proxy(self, '_touchStart'), + touchmove: $.proxy(self, '_touchMove'), + touchend: $.proxy(self, '_touchEnd') + }); + + // Call the original $.ui.mouse destroy method + _mouseDestroy.call(self); + }; + +})(jQuery);
\ No newline at end of file diff --git a/jquery/sass/_round-corners-last-item.scss b/jquery/sass/_round-corners-last-item.scss new file mode 100644 index 0000000..70a8391 --- /dev/null +++ b/jquery/sass/_round-corners-last-item.scss @@ -0,0 +1,23 @@ +// Generate rules to round the corners of the last collapsible item + +@mixin sm-dox__round-corners-last-item($amount, $chainable: 'ul > li:last-child > ', $level: 4, $chain_prefix: '> li:last-child > ', $chain: '', $selector: '') { + $chain: $chain_prefix; + $selector: $chain + 'a, ' + $chain + '*:not(ul) a, ' + $chain + 'ul'; + @for $i from 1 through $level { + $chain: $chain + $chainable; + $selector: $selector + ', ' + $chain + ' a, ' + $chain + '*:not(ul) a, ' + $chain + ' ul'; + } + #{$selector} { + @include border-radius(0 0 $amount $amount); + } + // highlighted items, don't need rounding since their sub is open + $chain: $chain_prefix; + $selector: $chain + 'a.highlighted, ' + $chain + '*:not(ul) a.highlighted'; + @for $i from 1 through $level { + $chain: $chain + $chainable; + $selector: $selector + ', ' + $chain + ' a.highlighted, ' + $chain + '*:not(ul) a.highlighted'; + } + #{$selector} { + @include border-radius(0); + } +} diff --git a/jquery/sass/_sm-dox.scss b/jquery/sass/_sm-dox.scss new file mode 100644 index 0000000..81a4e74 --- /dev/null +++ b/jquery/sass/_sm-dox.scss @@ -0,0 +1,594 @@ +@import 'compass'; + +// This file is best viewed with Tab size 4 code indentation + + +// ----------------------------------------------------------------------------------------------------------------- +// 1. Theme Quick Settings (Variables) +// (for further control, you will need to dig into the actual CSS in 2.) +// ----------------------------------------------------------------------------------------------------------------- + + +// ---------------------------------------------------------- +// :: 1.1. Colors +// ---------------------------------------------------------- + +$sm-dox__white: #fff !default; +$sm-dox__gray: darken($sm-dox__white, 6.5%) !default; +$sm-dox__gray-dark: darken($sm-dox__white, 26.5%) !default; +$sm-dox__gray-darker: darken($sm-dox__white, 66.5%) !default; +$sm-dox__red: #D23600 !default; + +$sm-dox__box-shadow: rgba(0, 0, 0, 0.2) !default; + + +// ---------------------------------------------------------- +// :: 1.2. Breakpoints +// ---------------------------------------------------------- + +$sm-dox__desktop-vp: 768px !default; // switch from collapsible to desktop + + +// ---------------------------------------------------------- +// :: 1.3. Typography +// ---------------------------------------------------------- + +$sm-dox__font-family: "Lucida Grande", "Geneva", "Helvetica", Arial, sans-serif !default; +$sm-dox__font-size-base: 13px !default; +$sm-dox__font-size-small: 12px !default; +$sm-dox__line-height: 15px !default; + + +// ---------------------------------------------------------- +// :: 1.4. Borders +// ---------------------------------------------------------- + +$sm-dox__border-width: 1px !default; +$sm-dox__border-radius: 5px !default; + + +// ---------------------------------------------------------- +// :: 1.5. Collapsible main menu +// ---------------------------------------------------------- + +// Menu box +//$sm-dox__collapsible-bg: $sm-dox__gray !default; +$sm-dox__collapsible-bg: url('tab_b.png') !default; +$sm-dox__collapsible-border-radius: $sm-dox__border-radius !default; + +// Items +$sm-dox__collapsible-item-color: $sm-dox__gray-darker !default; +$sm-dox__collapsible-item-current-color: $sm-dox__red !default; +$sm-dox__collapsible-item-disabled-color: darken($sm-dox__gray, 20%) !default; +$sm-dox__collapsible-item-padding-vertical: 0px !default; +$sm-dox__collapsible-item-padding-horizontal: 12px !default; + +// Items separators +$sm-dox__collapsible-separators-color: rgba(0, 0, 0, 0.05) !default; + +// Toggle button (sub menu indicators) +$sm-dox__collapsible-toggle-bg: rgba(255, 255, 255, 0.5) !default; + + +// ---------------------------------------------------------- +// :: 1.6. Collapsible sub menus +// ---------------------------------------------------------- + +// Menu box +$sm-dox__collapsible-sub-bg: rgba(darken($sm-dox__gray, 30%), 0.1) !default; + +// Items text indentation for deeper levels +$sm-dox__collapsible-sub-item-indentation: 8px !default; + + +// ---------------------------------------------------------- +// :: 1.7. Desktop main menu +// ---------------------------------------------------------- + +// Menu box +//$sm-dox__desktop-bg: $sm-dox__gray !default; +$sm-dox__desktop-bg: url('tab_b.png') !default; +//$sm-dox__desktop-border-radius: 100px !default; +$sm-dox__desktop-padding-horizontal: 10px !default; + +// Items +$sm-dox__desktop-item-color: $sm-dox__gray_darker !default; +$sm-dox__desktop-item-hover-color: $sm-dox__red !default; +$sm-dox__desktop-item-current-color: $sm-dox__red !default; +$sm-dox__desktop-item-disabled-color: darken($sm-dox__gray, 20%) !default; +$sm-dox__desktop-item-padding-vertical: 0px !default; +$sm-dox__desktop-item-padding-horizontal: 12px !default; + +// Sub menu indicators +$sm-dox__desktop-arrow-size: 4px !default; // border-width +$sm-dox__desktop-arrow-color: $sm-dox__gray-darker !default; +$sm-dox__desktop-arrow-spacing: 4px !default; + +// Vertical menu box +$sm-dox__desktop-vertical-border-radius: $sm-dox__border-radius !default; +$sm-dox__desktop-vertical-padding-vertical: 10px !default; + +// Vertical items +$sm-dox__desktop-vertical-item-hover-bg: $sm-dox__white !default; +$sm-dox__desktop-vertical-item-padding-vertical: 10px !default; +$sm-dox__desktop-vertical-item-padding-horizontal: 20px !default; + +$sm-dox__main-text-color: #283A5D !default; +$sm-dox__main-highlight-color: white !default; + +// ---------------------------------------------------------- +// :: 1.8. Desktop sub menus +// ---------------------------------------------------------- + +// Menu box +$sm-dox__desktop-sub-bg: $sm-dox__white !default; +$sm-dox__desktop-sub-border-color: $sm-dox__gray-dark !default; +$sm-dox__desktop-sub-border-radius: $sm-dox__border-radius !default; +$sm-dox__desktop-sub-box-shadow: 0 5px 9px $sm-dox__box-shadow !default; +$sm-dox__desktop-sub-padding-vertical: 5px !default; +$sm-dox__desktop-sub-padding-horizontal: 0 !default; + +// Items +$sm-dox__desktop-sub-item-color: $sm-dox__gray_darker !default; +$sm-dox__desktop-sub-item-hover-color: $sm-dox__red !default; +$sm-dox__desktop-sub-item-hover-bg: $sm-dox__gray !default; +$sm-dox__desktop-sub-item-current-color: $sm-dox__red !default; +$sm-dox__desktop-sub-item-disabled-color: darken($sm-dox__white, 20%) !default; +$sm-dox__desktop-sub-item-padding-vertical: 10px !default; +$sm-dox__desktop-sub-item-padding-horizontal: 20px !default; + +// Sub menu indicators +$sm-dox__desktop-sub-arrow-size: 5px !default; // border-width + +// Sub menu carets +$sm-dox__desktop-sub-caret-size: 8px !default; // border-width +$sm-dox__desktop-sub-caret-left: 30px !default; + +$sm-dox__main-row-height: 36px !default; + +// ----------------------------------------------------------------------------------------------------------------- +// 2. Theme CSS +// ----------------------------------------------------------------------------------------------------------------- + + +// ---------------------------------------------------------- +// :: 2.1. Collapsible mode (mobile first) +// ---------------------------------------------------------- + +// calc item height and sub menus toggle button size +$sm-dox__item-height: $sm-dox__line-height + $sm-dox__collapsible-item-padding-vertical * 2; +// set toggle button size to 80% of item height +$sm-dox__toggle-size: floor($sm-dox__main-row-height * 0.8); +$sm-dox__toggle-spacing: floor($sm-dox__main-row-height * 0.1); + +// Main menu box +.sm-dox { + background-image: $sm-dox__collapsible-bg; + //@include border-radius($sm-dox__collapsible-border-radius); + + // Main menu items + a { + &, + &:focus, + &:hover, + &:active { + padding: $sm-dox__collapsible-item-padding-vertical $sm-dox__collapsible-item-padding-horizontal; + /* make room for the toggle button (sub indicator) */ + padding-right: $sm-dox__collapsible-item-padding-horizontal + $sm-dox__toggle-size + $sm-dox__toggle-spacing; + /* color: $sm-dox__collapsible-item-color; */ + font-family: $sm-dox__font-family; + font-size: $sm-dox__font-size-base; + font-weight: bold; + line-height: 36px; //$sm-dox__line-height; + text-decoration: none; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + color: $sm-dox__main-text-color; + outline: none; + } + + &:hover { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: $sm-dox__main-highlight-color; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + } + + &.current { + color: $sm-dox__collapsible-item-current-color; + } + + &.disabled { + color: $sm-dox__collapsible-item-disabled-color; + } + + // Toggle buttons (sub menu indicators) + span.sub-arrow { + position: absolute; + top: 50%; + margin-top: -(ceil($sm-dox__toggle-size / 2)); + left: auto; + right: $sm-dox__toggle-spacing; + width: $sm-dox__toggle-size; + height: $sm-dox__toggle-size; + overflow: hidden; + font: bold #{$sm-dox__font-size-small}/#{$sm-dox__toggle-size} monospace !important; + text-align: center; + text-shadow: none; + background: $sm-dox__collapsible-toggle-bg; + @include border-radius($sm-dox__border-radius); + } + // Change + to - on sub menu expand + &.highlighted span.sub-arrow:before { + display: block; + content: '-'; + } + } + + // round the corners of the first item + > li:first-child > a, > li:first-child > :not(ul) a { + @include border-radius($sm-dox__collapsible-border-radius $sm-dox__collapsible-border-radius 0 0); + } + // round the corners of the last item + @include sm-dox__round-corners-last-item($sm-dox__collapsible-border-radius); + + // Main menu items separators + //li { + // /*border-top: 1px solid $sm-dox__collapsible-separators-color;*/ + // border-top: 0; + //} + //> li:first-child { + // border-top: 0; + //} + + // Sub menus box + ul { + background: $sm-dox__collapsible-sub-bg; + + // Sub menus items + a { + &, + &:focus, + &:hover, + &:active { + font-size: $sm-dox__font-size-small; + // add indentation for sub menus text + border-left: $sm-dox__collapsible-sub-item-indentation solid transparent; + //line-height: $sm-dox__line-height; + line-height: $sm-dox__main-row-height; + text-shadow: none; + background-color: white; + background-image: none; + } + + &:hover { + // color: $sm-dox__collapsible-item-current-color; + // background-color: $sm-dox__gray; + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: $sm-dox__main-highlight-color; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + } + + } + + // Add indentation for sub menus text for deeper levels + @include sm-dox__sub-items-indentation($sm-dox__collapsible-sub-item-indentation); + } +} + + +// ---------------------------------------------------------- +// :: 2.2. Desktop mode +// ---------------------------------------------------------- + +@media (min-width: $sm-dox__desktop-vp) { + + /* Switch to desktop layout + ----------------------------------------------- + These transform the menu tree from + collapsible to desktop (navbar + dropdowns) + -----------------------------------------------*/ + /* start... (it's not recommended editing these rules) */ + .sm-dox ul{position:absolute;width:12em;} + .sm-dox li{float:left;} + .sm-dox.sm-rtl li{float:right;} + .sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none;} + .sm-dox a{white-space:nowrap;} + .sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal;} + .sm-dox .sm-nowrap > li > a,.sm-dox .sm-nowrap > li > :not(ul) a{white-space:nowrap;} + /* ...end */ + + // Main menu box + .sm-dox { + padding: 0 $sm-dox__desktop-padding-horizontal; + background-image: $sm-dox__desktop-bg; + line-height: 36px; + //@include border-radius($sm-dox__desktop-border-radius); + + // Main menu items + a { + // Sub menu indicators + span.sub-arrow { + top: 50%; + margin-top: -(ceil($sm-dox__desktop-arrow-size / 2)); + right: $sm-dox__desktop-item-padding-horizontal; + width: 0; + height: 0; + border-width: $sm-dox__desktop-arrow-size; + border-style: solid dashed dashed dashed; + border-color: $sm-dox__main-text-color transparent transparent transparent; + background: transparent; + @include border-radius(0); + } + + &, + &:focus, + &:active, + &:hover, + &.highlighted { + padding: $sm-dox__desktop-item-padding-vertical $sm-dox__desktop-item-padding-horizontal; + /*color: $sm-dox__desktop-item-color;*/ + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + @include border-radius(0 !important); + } + &:hover { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: $sm-dox__main-highlight-color; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + span.sub-arrow { + border-color: $sm-dox__main-highlight-color transparent transparent transparent; + } + } + + // Make room for the sub arrows + &.has-submenu { + padding-right: $sm-dox__desktop-item-padding-horizontal + $sm-dox__desktop-arrow-size * 2 + $sm-dox__desktop-arrow-spacing; + } + } + + // No main menu items separators + li { + border-top: 0; + } + + // First sub level carets + > li > ul:before, + > li > ul:after { + content: ''; + position: absolute; + top: -($sm-dox__desktop-sub-caret-size * 2 + $sm-dox__border-width * 2); + left: $sm-dox__desktop-sub-caret-left; + width: 0; + height: 0; + overflow: hidden; + border-width: ($sm-dox__desktop-sub-caret-size + $sm-dox__border-width); + border-style: dashed dashed solid dashed; + border-color: transparent transparent $sm-dox__gray-dark transparent; + } + > li > ul:after { + top: -($sm-dox__desktop-sub-caret-size * 2); + left: ($sm-dox__desktop-sub-caret-left + $sm-dox__border-width); + border-width: $sm-dox__desktop-sub-caret-size; + border-color: transparent transparent $sm-dox__desktop-sub-bg transparent; + } + + // Sub menus box + ul { + border: $sm-dox__border-width solid $sm-dox__gray-dark; + padding: $sm-dox__desktop-sub-padding-vertical $sm-dox__desktop-sub-padding-horizontal; + background: $sm-dox__desktop-sub-bg; + @include border-radius($sm-dox__desktop-sub-border-radius !important); + @include box-shadow($sm-dox__desktop-sub-box-shadow); + + // Sub menus items + a { + span.sub-arrow { + right: 8px; + top: 50%; + margin-top: -$sm-dox__desktop-sub-arrow-size; + border-width: $sm-dox__desktop-sub-arrow-size; + border-color: transparent transparent transparent $sm-dox__desktop-sub-item-color; + border-style: dashed dashed dashed solid; + } + + &, + &:hover, + &:focus, + &:active, + &.highlighted { + color: $sm-dox__desktop-sub-item-color; + background-image:none; + border: 0 !important; + color: $sm-dox__desktop-sub-item-color; + background-image:none; + } + + &:hover { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: $sm-dox__main-highlight-color; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + span.sub-arrow { + border-color: transparent transparent transparent $sm-dox__main-highlight-color; + } + } + } + } + + // Scrolling arrows containers for tall sub menus - test sub menu: "Sub test" -> "more..." in the default download package + span.scroll-up, + span.scroll-down { + position: absolute; + display: none; + visibility: hidden; + overflow: hidden; + background: $sm-dox__desktop-sub-bg; + height: 36px; + // width and position will be set automatically by the script + + &:hover { + background: $sm-dox__desktop-sub-item-hover-bg; + } + } + span.scroll-up:hover span.scroll-up-arrow { + border-color: transparent transparent $sm-dox__desktop-sub-item-hover-color transparent; + } + span.scroll-down:hover span.scroll-down-arrow { + border-color: $sm-dox__desktop-sub-item-hover-color transparent transparent transparent; + } + span.scroll-up-arrow { + position: absolute; + top: 0; + left: 50%; + margin-left: -6px; + // we will use one-side border to create a triangle so that we don't use a real background image, of course, you can use a real image if you like too + width: 0; + height: 0; + overflow: hidden; + border-width: 6px; // tweak size of the arrow + border-style: dashed dashed solid dashed; + border-color: transparent transparent $sm-dox__desktop-sub-item-color transparent; + } + span.scroll-down-arrow { + @extend span.scroll-up-arrow; + top: 8px; + border-style: solid dashed dashed dashed; + border-color: $sm-dox__desktop-sub-item-color transparent transparent transparent; + } + + + // Rigth-to-left + + // Main menu box + &.sm-rtl { + + // Main menu items + a { + + // Make room for the sub arrows + &.has-submenu { + padding-right: $sm-dox__desktop-item-padding-horizontal; + padding-left: $sm-dox__desktop-item-padding-horizontal + $sm-dox__desktop-arrow-size * 2 + $sm-dox__desktop-arrow-spacing; + } + + // Sub menu indicators + span.sub-arrow { + right: auto; + left: $sm-dox__desktop-item-padding-horizontal; + } + } + + // Vertical main menu items + &.sm-vertical { + a { + + // No need for additional room for the sub arrows + &.has-submenu { + padding: $sm-dox__desktop-vertical-item-padding-vertical $sm-dox__desktop-vertical-item-padding-horizontal; + } + + // Sub menu indicators + span.sub-arrow { + right: auto; + left: 8px; + border-style: dashed solid dashed dashed; + border-color: transparent $sm-dox__desktop-arrow-color transparent transparent; + } + } + } + + // First sub level carets + > li > ul:before { + left: auto; + right: $sm-dox__desktop-sub-caret-left; + } + > li > ul:after { + left: auto; + right: ($sm-dox__desktop-sub-caret-left + $sm-dox__border-width); + } + + // Sub menus box + ul { + a { + + // No need for additional room for the sub arrows + &.has-submenu { + padding: $sm-dox__desktop-sub-item-padding-vertical $sm-dox__desktop-sub-item-padding-horizontal !important; + } + + // Sub menu indicators + span.sub-arrow { + right: auto; + left: 8px; + border-style: dashed solid dashed dashed; + border-color: transparent $sm-dox__desktop-arrow-color transparent transparent; + } + } + } + } + + + // Vertical main menu + + // Main menu box + &.sm-vertical { + padding: $sm-dox__desktop-vertical-padding-vertical 0; + @include border-radius($sm-dox__desktop-vertical-border-radius); + + // Main menu items + a { + padding: $sm-dox__desktop-vertical-item-padding-vertical $sm-dox__desktop-vertical-item-padding-horizontal; + + &:hover, + &:focus, + &:active, + &.highlighted { + background: $sm-dox__desktop-vertical-item-hover-bg; + } + + &.disabled { + background-image: $sm-dox__desktop-bg; + } + + // Sub menu indicators + span.sub-arrow { + right: 8px; + top: 50%; + margin-top: -$sm-dox__desktop-sub-arrow-size; + border-width: $sm-dox__desktop-sub-arrow-size; + border-style: dashed dashed dashed solid; + border-color: transparent transparent transparent $sm-dox__desktop-arrow-color; + } + } + + // No sub level carets + > li > ul:before, + > li > ul:after { + display: none; + } + + // Sub menus box + ul { + + // Sub menus items + a { + padding: $sm-dox__desktop-sub-item-padding-vertical $sm-dox__desktop-sub-item-padding-horizontal; + + &:hover, + &:focus, + &:active, + &.highlighted { + background: $sm-dox__desktop-sub-item-hover-bg; + } + + &.disabled { + background: $sm-dox__desktop-sub-bg; + } + } + } + } + } +} diff --git a/jquery/sass/_sub-items-indentation.scss b/jquery/sass/_sub-items-indentation.scss new file mode 100644 index 0000000..5e43999 --- /dev/null +++ b/jquery/sass/_sub-items-indentation.scss @@ -0,0 +1,15 @@ +// Generate rules to indent sub menus text +// +// We'll use left border to avoid messing with the padding. + +@mixin sm-dox__sub-items-indentation($amount, $chainable: 'ul ', $level: 4, $chain: '') { + @for $i from 1 through $level { + $chain: $chain + $chainable; + #{$chain} a, + #{$chain} a:hover, + #{$chain} a:focus, + #{$chain} a:active { + border-left: ($amount * ($i + 1)) solid transparent; + } + } +} diff --git a/jquery/sass/sm-dox.scss b/jquery/sass/sm-dox.scss new file mode 100644 index 0000000..19fb444 --- /dev/null +++ b/jquery/sass/sm-dox.scss @@ -0,0 +1,5 @@ +@import '_sub-items-indentation.scss'; +@import '_round-corners-last-item.scss'; + +// the variables + the CSS +@import '_sm-dox.scss'; diff --git a/jquery/sm-core-css.css b/jquery/sm-core-css.css new file mode 100644 index 0000000..c586599 --- /dev/null +++ b/jquery/sm-core-css.css @@ -0,0 +1,10 @@ +.sm{position:relative;z-index:9999;} +.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0);} +.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right;} +.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0;} +.sm ul{display:none;} +.sm li,.sm a{position:relative;} +.sm a{display:block;} +.sm a.disabled{cursor:not-allowed;} +.sm:after{content:"\00a0";display:block;height:0;font:0px/0 serif;clear:both;visibility:hidden;overflow:hidden;} +.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;} diff --git a/qtools/Doxyfile b/qtools/Doxyfile index 2943270..597001a 100644 --- a/qtools/Doxyfile +++ b/qtools/Doxyfile @@ -175,7 +175,7 @@ QHG_LOCATION = GENERATE_ECLIPSEHELP = YES ECLIPSE_DOC_ID = org.doxygen.qtools DISABLE_INDEX = NO -GENERATE_TREEVIEW = YES +GENERATE_TREEVIEW = NO ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 0180eec..e1f8440 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11674,7 +11674,7 @@ void generateOutput() QString oldDir = QDir::currentDirPath(); QDir::setCurrent(Config_getString(HTML_OUTPUT)); portable_sysTimerStart(); - if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))) + if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1) { err("failed to run html help compiler on index.hhp\n"); } diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 239a9fe..54820ec 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -292,7 +292,6 @@ static QCString substituteHtmlKeywords(const QCString &s, "<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n" "<script type=\"text/javascript\">\n" " $(document).ready(initResizable);\n" - " $(window).load(resizeHeight);\n" "</script>"; } @@ -305,19 +304,25 @@ static QCString substituteHtmlKeywords(const QCString &s, } searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n"; - if (!serverBasedSearch) + if (!serverBasedSearch) { - searchCssJs += "<script type=\"text/javascript\">\n" - " $(document).ready(function() { init_search(); });\n" - "</script>"; + if (disableIndex) + { + searchCssJs += "<script type=\"text/javascript\">\n" + " $(document).ready(function() { init_search(); });\n" + "</script>"; + } } - else + else { - searchCssJs += "<script type=\"text/javascript\">\n" - " $(document).ready(function() {\n" - " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n" - " });\n" - "</script>\n"; + if (disableIndex) + { + searchCssJs += "<script type=\"text/javascript\">\n" + " $(document).ready(function() {\n" + " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n" + " });\n" + "</script>\n"; + } // OPENSEARCH_PROVIDER { searchCssJs += "<link rel=\"search\" href=\"" + relPath + @@ -727,6 +732,10 @@ void HtmlGenerator::init() { mgr.copyResource("svgpan.js",dname); } + if (!Config_getBool(DISABLE_INDEX)) + { + mgr.copyResource("menu.js",dname); + } { QFile f(dname+"/dynsections.js"); @@ -1017,7 +1026,7 @@ void HtmlGenerator::startDoxyAnchor(const char *,const char *, const char *anchor, const char *, const char *) { - t << "<a class=\"anchor\" id=\"" << anchor << "\"></a>"; + t << "<a id=\"" << anchor << "\"></a>"; } void HtmlGenerator::endDoxyAnchor(const char *,const char *) @@ -1193,7 +1202,7 @@ void HtmlGenerator::startSection(const char *lab,const char *,SectionInfo::Secti case SectionInfo::Paragraph: t << "\n\n<h5>"; break; default: ASSERT(0); break; } - t << "<a class=\"anchor\" id=\"" << lab << "\"></a>"; + t << "<a id=\"" << lab << "\"></a>"; } void HtmlGenerator::endSection(const char *,SectionInfo::SectionType type) @@ -2070,59 +2079,35 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact, const char *file, const QCString &relPath) { + static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); + static bool searchEngine = Config_getBool(SEARCHENGINE); LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry(); - LayoutNavEntry::Kind kind = (LayoutNavEntry::Kind)-1; - LayoutNavEntry::Kind altKind = (LayoutNavEntry::Kind)-1; // fall back for the old layout file - bool highlightParent=FALSE; - switch (hli) // map HLI enums to LayoutNavEntry::Kind enums - { - case HLI_Main: kind = LayoutNavEntry::MainPage; break; - case HLI_Modules: kind = LayoutNavEntry::Modules; break; - //case HLI_Directories: kind = LayoutNavEntry::Dirs; break; - case HLI_Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break; - case HLI_Hierarchy: kind = LayoutNavEntry::ClassHierarchy; break; - case HLI_Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break; - case HLI_Annotated: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break; - case HLI_Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break; - case HLI_NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break; - case HLI_Functions: kind = LayoutNavEntry::ClassMembers; break; - case HLI_Globals: kind = LayoutNavEntry::FileGlobals; break; - case HLI_Pages: kind = LayoutNavEntry::Pages; break; - case HLI_Examples: kind = LayoutNavEntry::Examples; break; - case HLI_UserGroup: kind = LayoutNavEntry::UserGroup; break; - case HLI_ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; - highlightParent = TRUE; break; - case HLI_NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; - highlightParent = TRUE; break; - case HLI_FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; - highlightParent = TRUE; break; - case HLI_None: break; - case HLI_Search: break; - } - + if (compact) { - // find highlighted index item - LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : 0); - if (!hlEntry && altKind!=(LayoutNavEntry::Kind)-1) { hlEntry=root->find(altKind); kind=altKind; } - if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index... + t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>" << endl; + t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>" << endl; + t << "<script type=\"text/javascript\">" << endl; + t << "$(function() {" << endl; + t << " initMenu('" << relPath << "'," + << (searchEngine?"true":"false") << ",'" + << theTranslator->trSearch() << "');" << endl; + if (Config_getBool(SEARCHENGINE)) { - highlightParent=TRUE; - hlEntry = root->children().getFirst(); - if (hlEntry==0) + if (!serverBasedSearch) { - return; // argl, empty index! + t << " $(document).ready(function() { init_search(); });\n"; } - } - if (kind==LayoutNavEntry::UserGroup) - { - LayoutNavEntry *e = hlEntry->children().getFirst(); - if (e) + else { - hlEntry = e; + t << " $(document).ready(function() {\n" + << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n" + << " });\n"; } } - renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HLI_Search); + t << "});" << endl; + t << "</script>" << endl; + t << "<div id=\"main-nav\"></div>" << endl; } else { @@ -2258,9 +2243,7 @@ void HtmlGenerator::writeSearchPage() // Write empty navigation path, to make footer connect properly if (generateTreeView) { - t << "</div><!-- doc-contents -->\n"; - //t << "<div id=\"nav-path\" class=\"navpath\">\n"; - //t << " <ul>\n"; + t << "</div><!-- doc-content -->\n"; } writePageFooter(t,"Search","",""); @@ -2281,6 +2264,7 @@ void HtmlGenerator::writeSearchPage() void HtmlGenerator::writeExternalSearchPage() { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); + static bool disableIndex = Config_getBool(DISABLE_INDEX); QCString fileName = Config_getString(HTML_OUTPUT)+"/search"+Doxygen::htmlFileExtension; QFile f(fileName); if (f.open(IO_WriteOnly)) @@ -2323,10 +2307,11 @@ void HtmlGenerator::writeExternalSearchPage() if (generateTreeView) { - t << "</div><!-- doc-contents -->" << endl; + t << "</div><!-- doc-content -->" << endl; } writePageFooter(t,"Search","",""); + } QCString scriptName = Config_getString(HTML_OUTPUT)+"/search/search.js"; QFile sf(scriptName); diff --git a/src/index.cpp b/src/index.cpp index 8c7452e..2e94085 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2571,6 +2571,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h if (!disableIndex) { ol.writeQuickLinks(TRUE,HLI_Functions,0); +#if 0 startQuickIndexList(ol); // index item for global member list @@ -2601,6 +2602,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h writeQuickMemberIndex(ol,g_memberIndexLetterUsed[hl],page, getCmhlInfo(hl)->fname,multiPageIndex); } +#endif } ol.endQuickIndices(); ol.writeSplitBar(fileName); @@ -2743,6 +2745,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) if (!disableIndex) { ol.writeQuickLinks(TRUE,HLI_Globals,0); +#if 0 startQuickIndexList(ol); // index item for all file member lists @@ -2771,6 +2774,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl) writeQuickMemberIndex(ol,g_fileIndexLetterUsed[hl],page, getFmhlInfo(hl)->fname,multiPageIndex); } +#endif } ol.endQuickIndices(); ol.writeSplitBar(fileName); @@ -2911,6 +2915,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, if (!disableIndex) { ol.writeQuickLinks(TRUE,HLI_NamespaceMembers,0); +#if 0 startQuickIndexList(ol); // index item for all namespace member lists @@ -2939,7 +2944,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol, writeQuickMemberIndex(ol,g_namespaceIndexLetterUsed[hl],page, getNmhlInfo(hl)->fname,multiPageIndex); } - +#endif } ol.endQuickIndices(); ol.writeSplitBar(fileName); @@ -4277,8 +4282,166 @@ static void writeIndexHierarchyEntries(OutputList &ol,const QList<LayoutNavEntry } } +static bool quickLinkVisible(LayoutNavEntry::Kind kind) +{ + static bool showFiles = Config_getBool(SHOW_FILES); + static bool showNamespaces = Config_getBool(SHOW_NAMESPACES); + switch (kind) + { + case LayoutNavEntry::MainPage: return TRUE; + case LayoutNavEntry::User: return TRUE; + case LayoutNavEntry::UserGroup: return TRUE; + case LayoutNavEntry::Pages: return indexedPages>0; + case LayoutNavEntry::Modules: return documentedGroups>0; + case LayoutNavEntry::Namespaces: return documentedNamespaces>0 && showNamespaces; + case LayoutNavEntry::NamespaceList: return documentedNamespaces>0 && showNamespaces; + case LayoutNavEntry::NamespaceMembers: return documentedNamespaceMembers[NMHL_All]>0; + case LayoutNavEntry::Classes: return annotatedClasses>0; + case LayoutNavEntry::ClassList: return annotatedClasses>0; + case LayoutNavEntry::ClassIndex: return annotatedClasses>0; + case LayoutNavEntry::ClassHierarchy: return hierarchyClasses>0; + case LayoutNavEntry::ClassMembers: return documentedClassMembers[CMHL_All]>0; + case LayoutNavEntry::Files: return documentedHtmlFiles>0 && showFiles; + case LayoutNavEntry::FileList: return documentedHtmlFiles>0 && showFiles; + case LayoutNavEntry::FileGlobals: return documentedFileMembers[FMHL_All]>0; + //case LayoutNavEntry::Dirs: return documentedDirs>0; + case LayoutNavEntry::Examples: return Doxygen::exampleSDict->count()>0; + } + return FALSE; +} + +template<class T> +void renderMemberIndicesAsJs(FTextStream &t, + int total,const int *numDocumented,const LetterToIndexMap<MemberIndexList> *memberLists, + const T *(*getInfo)(int hl)) +{ + // index items per category member lists + bool firstMember=TRUE; + for (int i=0;i<total;i++) + { + if (numDocumented[i]>0) + { + t << ","; + if (firstMember) + { + t << "children:["; + firstMember=FALSE; + } + t << endl << "{text:'" << convertToJSString(getInfo(i)->title) << "',url:'" + << convertToJSString(getInfo(i)->fname+Doxygen::htmlFileExtension) << "'"; + + // Check if we have many members, then add sub entries per letter... + // quick alphabetical index + bool quickIndex = numDocumented[i]>maxItemsBeforeQuickIndex; + if (quickIndex) + { + bool multiPageIndex=FALSE; + if (numDocumented[i]>MAX_ITEMS_BEFORE_MULTIPAGE_INDEX) + { + multiPageIndex=TRUE; + } + t << ",children:[" << endl; + bool firstLetter=TRUE; + SIntDict<MemberIndexList>::Iterator it(memberLists[i]); + MemberIndexList *ml; + for (it.toFirst();(ml=it.current());++it) + { + if (!firstLetter) t << "," << endl; + uint letter = ml->letter(); + QCString is = letterToLabel(letter); + QCString ci = QString(QChar(letter)).utf8(); + QCString anchor; + QCString extension=Doxygen::htmlFileExtension; + QCString fullName = getInfo(i)->fname; + if (!multiPageIndex || firstLetter) + anchor=fullName+extension+"#index_"; + else // other pages of multi page index + anchor=fullName+"_"+is+extension+"#index_"; + t << "{text:'" << convertToJSString(ci) << "',url:'" + << convertToJSString(anchor+is) << "'}"; + firstLetter=FALSE; + } + t << "]"; + } + t << "}"; + } + } + if (!firstMember) + { + t << "]"; + } +} + +static bool renderQuickLinksAsJs(FTextStream &t,LayoutNavEntry *root,bool first) +{ + QListIterator<LayoutNavEntry> li(root->children()); + LayoutNavEntry *entry; + int count=0; + for (li.toFirst();(entry=li.current());++li) + { + if (entry->visible() && quickLinkVisible(entry->kind())) count++; + } + if (count>0) // at least one item is visible + { + bool firstChild = TRUE; + if (!first) t << ","; + t << "children:[" << endl; + for (li.toFirst();(entry=li.current());++li) + { + if (entry->visible() && quickLinkVisible(entry->kind())) + { + if (!firstChild) t << "," << endl; + firstChild=FALSE; + QCString url = entry->url(); + t << "{text:'" << convertToJSString(entry->title()) << "',url:'" + << convertToJSString(url) << "'"; + bool hasChildren=FALSE; + if (entry->kind()==LayoutNavEntry::NamespaceMembers) + { + renderMemberIndicesAsJs(t,NMHL_Total,documentedNamespaceMembers, + g_namespaceIndexLetterUsed,getNmhlInfo); + } + else if (entry->kind()==LayoutNavEntry::ClassMembers) + { + renderMemberIndicesAsJs(t,CMHL_Total,documentedClassMembers, + g_memberIndexLetterUsed,getCmhlInfo); + } + else if (entry->kind()==LayoutNavEntry::FileGlobals) + { + renderMemberIndicesAsJs(t,FMHL_Total,documentedFileMembers, + g_fileIndexLetterUsed,getFmhlInfo); + } + else // recursive into child list + { + hasChildren = renderQuickLinksAsJs(t,entry,FALSE); + } + if (hasChildren) t << "]"; + t << "}"; + } + } + } + return count>0; +} + +static void writeMenuData() +{ + if (!Config_getBool(GENERATE_HTML) || Config_getBool(DISABLE_INDEX)) return; + QCString outputDir = Config_getBool(HTML_OUTPUT); + QFile f(outputDir+"/menudata.js"); + LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry(); + if (f.open(IO_WriteOnly)) + { + FTextStream t(&f); + t << "var menudata={"; + bool hasChildren = renderQuickLinksAsJs(t,root,TRUE); + if (hasChildren) t << "]"; + t << "}" << endl; + } +} + void writeIndexHierarchy(OutputList &ol) { + writeMenuData(); LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry(); if (lne) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 0f403d1..2c88898 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -2078,9 +2078,7 @@ void MemberDef::_writeCallGraph(OutputList &ol) msg("Generating call graph for function %s\n",qPrint(qualifiedName())); ol.disable(OutputGenerator::Man); ol.startCallGraph(); - ol.startParagraph(); ol.parseText(theTranslator->trCallGraph()); - ol.endParagraph(); ol.endCallGraph(callGraph); ol.enableAll(); } @@ -2103,9 +2101,7 @@ void MemberDef::_writeCallerGraph(OutputList &ol) msg("Generating caller graph for function %s\n",qPrint(qualifiedName())); ol.disable(OutputGenerator::Man); ol.startCallGraph(); - ol.startParagraph(); ol.parseText(theTranslator->trCallerGraph()); - ol.endParagraph(); ol.endCallGraph(callerGraph); ol.enableAll(); } diff --git a/templates/html/doxygen.css b/templates/html/doxygen.css index 490b0f9..f1e2ec4 100644 --- a/templates/html/doxygen.css +++ b/templates/html/doxygen.css @@ -173,7 +173,7 @@ pre.fragment { } div.fragment { - padding: 4px 6px; + padding: 0px; margin: 4px 8px 4px 2px; background-color: ##FC; border: 1px solid ##CC; diff --git a/templates/html/htmlbase.tpl b/templates/html/htmlbase.tpl index aacaf92..2825249 100644 --- a/templates/html/htmlbase.tpl +++ b/templates/html/htmlbase.tpl @@ -5,6 +5,7 @@ <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen {{ doxygen.version }}"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> <title>{{ config.PROJECT_NAME }}: {{ page.title }}</title> <link href="{{ page.relPath }}tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="{{ page.relPath }}jquery.js"></script> @@ -16,7 +17,15 @@ <script type="text/javascript" src="{{ page.relPath }}navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); - $(window).load(resizeHeight); +</script> +{% endif %} +{% if not config.DISABLE_INDEX %} +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',{% if config.SEARCHENGINE %}true{% else %}false{% endif %},'{{ tr.search }}'); +}); </script> {% endif %} {% if config.SEARCHENGINE %} @@ -34,7 +43,7 @@ <link rel="search" href="{{ page.relPath }}search-opensearch.php?v=opensearch.xml" type="application/opensearchdescription+xml" title="{{ config.PROJECT_NAME }}"/> {% else %} <script type="text/javascript"> - $(document).ready(function() { searchBox.OnSelectItem(0); }); + $(document).ready(function() { init_search(); }); </script> {% endif %} {% endif %} @@ -129,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "{{ page.relPath }}search",false,'{{ {% block tabs %} {% if not config.DISABLE_INDEX %} -{% include 'htmltabs.tpl' %} +<div id="main-nav"></div> {% endif %} {% endblock %} diff --git a/templates/html/htmlclmembers.tpl b/templates/html/htmlclmembers.tpl index 29d495e..41be99c 100644 --- a/templates/html/htmlclmembers.tpl +++ b/templates/html/htmlclmembers.tpl @@ -1,9 +1,5 @@ {# inputs: page, list #} {% extend 'htmlbase.tpl' %} -{% block tabs %} -{{ block.super }} -{% include 'htmlmembertabs.tpl %} -{% endblock %} {% block content %} <div class="contents"> diff --git a/templates/html/htmlclmembersindex.tpl b/templates/html/htmlclmembersindex.tpl deleted file mode 100644 index 2f15c12..0000000 --- a/templates/html/htmlclmembersindex.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{% with page=namespaceMembersIndex %} - {# all members #} - {% with list=namespaceMembersIndex.all section='' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# functions #} - {% with list=namespaceMembersIndex.functions section='_func' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# variables #} - {% with list=namespaceMembersIndex.variables section='_vars' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# typedefs #} - {% with list=namespaceMembersIndex.typedefs section='_type' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# enums #} - {% with list=namespaceMembersIndex.enums section='_enum' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# enumValues #} - {% with list=namespaceMembersIndex.enumValues section='_eval' template='htmlclmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} -{% endwith %} diff --git a/templates/html/htmlflmembers.tpl b/templates/html/htmlflmembers.tpl index e2c781a..f158b67 100644 --- a/templates/html/htmlflmembers.tpl +++ b/templates/html/htmlflmembers.tpl @@ -1,9 +1,5 @@ {# inputs: page, list #} {% extend 'htmlbase.tpl' %} -{% block tabs %} -{{ block.super }} -{% include 'htmlmembertabs.tpl %} -{% endblock %} {% block content %} <div class="contents"> diff --git a/templates/html/htmljsmenudata.tpl b/templates/html/htmljsmenudata.tpl new file mode 100644 index 0000000..2cfbbb0 --- /dev/null +++ b/templates/html/htmljsmenudata.tpl @@ -0,0 +1,52 @@ +var menudata={children:[ +{text:'{{ tr.mainPage }}',url:'index{{ config.HTML_FILE_EXTENSION }}'} +{% if pageTree.tree %} +,{text:'{{ tr.pages }}',url:'pages{{ config.HTML_FILE_EXTENSION }}'} +{% endif %} +{% if moduleTree.tree %} +,{text:'{{ tr.modules }}',url:'modules{{ config.HTML_FILE_EXTENSION }}'} +{% endif %} +{% if namespaceList %} +,{text:'{{ tr.namespaces }}',url:'namespaces{{ config.HTML_FILE_EXTENSION }}',children:[ + {text:'{{ tr.namespaceList }}',url:'namespaces{{ config.HTML_FILE_EXTENSION }}'} +{% if namespaceMembersIndex.all %} +,{text:'{{ tr.namespaceMembers }}',url:'namespacemembers{{ config.HTML_FILE_EXTENSION }}',children:[ + {% with page=namespaceMembersIndex %} + {% include 'htmljsmenumembersdata.tpl' %} + {% endwith %} + ]} +{% endif %} +]} +{% endif %} +{% if classList %} +,{text:'{{ tr.classes }}',url:'annotated{{ config.HTML_FILE_EXTENSION }}',children:[ + {text:'{{ tr.classList }}',url:'annotated{{ config.HTML_FILE_EXTENSION }}'} +{% if classHierarchy.tree %} +,{text:'{{ tr.classHierarchy }}',url:'hierarchy{{ config.HTML_FILE_EXTENSION }}'} +{% endif %} +{% if classMembersIndex.all %} +,{text:'{{ tr.classMembers }}',url:'functions{{ config.HTML_FILE_EXTENSION }}',children:[ + {% with page=classMembersIndex %} + {% include 'htmljsmenumembersdata.tpl' %} + {% endwith %} +]} +{% endif %} +]} +{% endif %} +{% if fileList %} +,{text:'{{ tr.files }}',url:'files{{ config.HTML_FILE_EXTENSION }}',children[ + {text:'{{ tr.fileList }}',url:'files{{ config.HTML_FILE_EXTENSION }}'} +{% if fileMemberIndex.all %} +,{text:'{{ tr.fileMembers }}',url'globals{{ config.HTML_FILE_EXTENSION }}',children:[ + {% with page=fileMembersIndex %} + {% include 'htmljsmenumembersdata.tpl' %} + {% endwith %} +]} +{% endif %} +]} +{% endif %} +{% if exampleTree.tree %} +,{text:'{{ tr.examples }}',url:'examples{{ config.HTML_FILE_EXTENSION }}'} +{% endif %} +]} + diff --git a/templates/html/htmljsmenuletterdata.tpl b/templates/html/htmljsmenuletterdata.tpl new file mode 100644 index 0000000..ded3402 --- /dev/null +++ b/templates/html/htmljsmenuletterdata.tpl @@ -0,0 +1,12 @@ +{# inputs: page, list, section, text #} +{text:'{{ text }}',url:'{{ page.fileName }}{{ section }}{{ config.HTML_FILE_EXTENSION }}' +{% if list|length>maxItemsForMultiPageList %} +,children:[ + {% with index=list|alphaIndex:'name' %} + {% for sect in index %} + {text:'{{ sect.letter }}',url:'{{ page.fileName }}{{ section }}_{{ sect.label }}{{ config.HTML_FILE_EXTENSION }}'}{% if not forloop.last %},{% endif %} + {% endfor %} + {% endwith %} +] +{% endif %} +} diff --git a/templates/html/htmljsmenumembersdata.tpl b/templates/html/htmljsmenumembersdata.tpl new file mode 100644 index 0000000..fa2ab66 --- /dev/null +++ b/templates/html/htmljsmenumembersdata.tpl @@ -0,0 +1,58 @@ +{# all members #} +{% with list=page.all section='' text=tr.all %} + {% include 'htmljsmenuletterdata.tpl' %} +{% endwith %} +{# functions #} +{% if page.functions %} + {% with list=page.functions section='_func' text=tr.functions %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# variables #} +{% if page.variables %} + {% with list=page.variables section='_vars' text=tr.variables %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# typedefs #} +{% if page.typedefs %} + {% with list=page.typedefs section='_type' text=tr.typedefs %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# enums #} +{% if page.enums %} + {% with list=page.enums section='_enum' text=tr.enums %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# enumValues #} +{% if page.enumValues %} + {% with list=page.enumValues section='_eval' text=tr.enumValues %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# macros #} +{% if page.macros %} + {% with list=page.macros section='_defs' text=tr.macros %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# properties #} +{% if page.properties %} + {% with list=page.properties section='_prop' text=tr.properties %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# events #} +{% if page.events %} + {% with list=page.events section='_evnt' text=tr.events %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} +{# related #} +{% if page.related %} + {% with list=page.related section='_rela' text=tr.related %} + ,{% include 'htmljsmenuletterdata.tpl' %} + {% endwith %} +{% endif %} diff --git a/templates/html/htmljssearchdata.tpl b/templates/html/htmljssearchdata.tpl index c48ea1d..802795e 100644 --- a/templates/html/htmljssearchdata.tpl +++ b/templates/html/htmljssearchdata.tpl @@ -19,7 +19,7 @@ var indexSectionNames = {% endif %} {% endfor %} }; -var IndexSectionLabels = +var indexSectionLabels = { {% set count=0 %} {% for idx in searchIndices %} diff --git a/templates/html/htmllayout.tpl b/templates/html/htmllayout.tpl index 52883a3..dd88612 100644 --- a/templates/html/htmllayout.tpl +++ b/templates/html/htmllayout.tpl @@ -26,6 +26,7 @@ {% resource 'navtree.css' %} {% resource 'navtree.js' %} {% resource 'resize.js' %} +{% resource 'menu.js' %} {% resource 'doc.luma' %} {% resource 'folderopen.luma' %} {% resource 'folderclosed.luma' %} @@ -272,4 +273,9 @@ {% create 'navtreedata.js' from 'htmljsnavtree.tpl' %} {% endif %} +{# write menu data #} +{% if not config.DISABLE_INDEX %} + {% create 'menudata.js' from 'htmljsmenudata.tpl' %} +{% endif %} + {% msg %}----- End generating HTML output for {{ config.PROJECT_NAME }} from template ----{% endmsg %} diff --git a/templates/html/htmlnavtree.tpl b/templates/html/htmlnavtree.tpl deleted file mode 100644 index 9713232..0000000 --- a/templates/html/htmlnavtree.tpl +++ /dev/null @@ -1,22 +0,0 @@ -var NAVTREE = -[ - [ "{% if mainPage.title %}mainPage.title|jsstring{% else %}{{ tr.mainPage }}{% endif %}", - "index{{ config.HTML_FILE_EXTENSION }}", - ] -]; - -var NAVTREEINDEX = -[ -{# write first entry of each sub index #} -{% for entries in navTree.subindices %} - "{{ entries[0].url }}"{% if not forloop.last %},{% endif %} -{% endfor %} - ] -]; - -{# write all sub indices #} -{% for entries in navTree.subindices %} - {% with idx=forloop.counter0 %} - {% create idx|prepend:'navtreeindex'|append:'.js' from 'htmlnavindex.tpl' %} - {% endwith %} -{% endfor %} diff --git a/templates/html/htmlnsmembers.tpl b/templates/html/htmlnsmembers.tpl index 3f4c0bd..97ba2c2 100644 --- a/templates/html/htmlnsmembers.tpl +++ b/templates/html/htmlnsmembers.tpl @@ -1,9 +1,5 @@ {# inputs: page, list #} {% extend 'htmlbase.tpl' %} -{% block tabs %} -{{ block.super }} -{% include 'htmlmembertabs.tpl' %} -{% endblock %} {% block content %} <div class="contents"> diff --git a/templates/html/htmlnsmembersindex.tpl b/templates/html/htmlnsmembersindex.tpl deleted file mode 100644 index dc3bfd4..0000000 --- a/templates/html/htmlnsmembersindex.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{% with page=namespaceMembersIndex %} - {# all members #} - {% with list=namespaceMembersIndex.all section='' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# functions #} - {% with list=namespaceMembersIndex.functions section='_func' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# variables #} - {% with list=namespaceMembersIndex.variables section='_vars' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# typedefs #} - {% with list=namespaceMembersIndex.typedefs section='_type' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# enums #} - {% with list=namespaceMembersIndex.enums section='_enum' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} - {# enumValues #} - {% with list=namespaceMembersIndex.enumValues section='_eval' template='htmlnsmembers.tpl' %} - {% include 'htmlindexpages.tpl' %} - {% endwith %} -{% endwith %} diff --git a/templates/html/jquery.js b/templates/html/jquery.js index 1f4d0b4..f5343ed 100644 --- a/templates/html/jquery.js +++ b/templates/html/jquery.js @@ -65,4 +65,23 @@ Released under MIT license. https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt */ -(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P<N.intentSensitivity){F.showTip(K)}else{c.previousX=c.currentX;c.previousY=c.currentY;L()}}function M(){J=clearTimeout(J);c.delayInProgress=false}function H(){F.resetPosition(K)}this.show=L;this.hide=G;this.cancel=M;this.resetPosition=H}function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(q(M)){I=H(M,K)}else{I=F(M,K)}switch(L){case"n":N.set("left",I.left-(J/2));N.set("bottom",c.windowHeight-I.top+P);break;case"e":N.set("left",I.left+P);N.set("top",I.top-(O/2));break;case"s":N.set("left",I.left-(J/2));N.set("top",I.top+P);break;case"w":N.set("top",I.top-(O/2));N.set("right",c.windowWidth-I.left+P);break;case"nw":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"nw-alt":N.set("left",I.left);N.set("bottom",c.windowHeight-I.top+P);break;case"ne":N.set("left",I.left-20);N.set("bottom",c.windowHeight-I.top+P);break;case"ne-alt":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left);break;case"sw":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"sw-alt":N.set("left",I.left);N.set("top",I.top+P);break;case"se":N.set("left",I.left-20);N.set("top",I.top+P);break;case"se-alt":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left);break}return N}function F(K,J){var O=K.offset(),N=K.outerWidth(),I=K.outerHeight(),M,L;switch(J){case"n":M=O.left+N/2;L=O.top;break;case"e":M=O.left+N;L=O.top+I/2;break;case"s":M=O.left+N/2;L=O.top+I;break;case"w":M=O.left;L=O.top+I/2;break;case"nw":M=O.left;L=O.top;break;case"ne":M=O.left+N;L=O.top;break;case"sw":M=O.left;L=O.top+I;break;case"se":M=O.left+N;L=O.top+I;break}return{top:L,left:M}}function H(O,K){var S=O.closest("svg")[0],N=O[0],W=S.createSVGPoint(),L=N.getBBox(),V=N.getScreenCTM(),M=L.width/2,Q=L.height/2,P=[],I=["nw","n","ne","e","se","s","sw","w"],U,X,R,T;function J(){P.push(W.matrixTransform(V))}W.x=L.x;W.y=L.y;J();W.x+=M;J();W.x+=M;J();W.y+=Q;J();W.y+=Q;J();W.x-=M;J();W.x-=M;J();W.y-=Q;J();if(P[0].y!==P[1].y||P[0].x!==P[7].x){X=Math.atan2(V.b,V.a)*E;R=Math.ceil(((X%360)-22.5)/45);if(R<1){R+=8}while(R--){I.push(I.shift())}}for(T=0;T<P.length;T++){if(I[T]===K){U=P[T];break}}return{top:U.y+c.scrollTop,left:U.x+c.scrollLeft}}this.compute=G}function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<div/>",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.top<G||Math.abs(M.bottom-c.windowHeight)-K<G){H|=p.top}if(M.top+K>I||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.left<J||M.right+L>F){H|=p.left}if(M.left+L>F||M.right<J){H|=p.right}return H}function a(G){var F=0;while(G){G&=G-1;F++}return F}}));
\ No newline at end of file +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{a(jQuery)}}(function(k){var A=k(document),s=k(window),w=k("body");var n="displayController",e="hasActiveHover",d="forcedOpen",u="hasMouseMove",f="mouseOnToPopup",g="originalTitle",y="powertip",o="powertipjq",l="powertiptarget",E=180/Math.PI;var c={isTipOpen:false,isFixedTipOpen:false,isClosing:false,tipOpenImminent:false,activeHover:null,currentX:0,currentY:0,previousX:0,previousY:0,desyncTimeout:null,mouseTrackingActive:false,delayInProgress:false,windowWidth:0,windowHeight:0,scrollTop:0,scrollLeft:0};var p={none:0,top:1,bottom:2,left:4,right:8};k.fn.powerTip=function(F,N){if(!this.length){return this}if(k.type(F)==="string"&&k.powerTip[F]){return k.powerTip[F].call(this,this,N)}var O=k.extend({},k.fn.powerTip.defaults,F),G=new x(O);h();this.each(function M(){var R=k(this),Q=R.data(y),P=R.data(o),T=R.data(l),S;if(R.data(n)){k.powerTip.destroy(R)}S=R.attr("title");if(!Q&&!T&&!P&&S){R.data(y,S);R.data(g,S);R.removeAttr("title")}R.data(n,new t(R,O,G))});if(!O.manual){this.on({"mouseenter.powertip":function J(P){k.powerTip.show(this,P)},"mouseleave.powertip":function L(){k.powerTip.hide(this)},"focus.powertip":function K(){k.powerTip.show(this)},"blur.powertip":function H(){k.powerTip.hide(this,true)},"keydown.powertip":function I(P){if(P.keyCode===27){k.powerTip.hide(this,true)}}})}return this};k.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false};k.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se","n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};k.powerTip={show:function z(F,G){if(G){i(G);c.previousX=G.pageX;c.previousY=G.pageY;k(F).data(n).show()}else{k(F).first().data(n).show(true,true)}return F},reposition:function r(F){k(F).first().data(n).resetPosition();return F},hide:function D(G,F){if(G){k(G).first().data(n).hide(F)}else{if(c.activeHover){c.activeHover.data(n).hide(true)}}return G},destroy:function C(G){k(G).off(".powertip").each(function F(){var I=k(this),H=[g,n,e,d];if(I.data(g)){I.attr("title",I.data(g));H.push(y)}I.removeData(H)});return G}};k.powerTip.showTip=k.powerTip.show;k.powerTip.closeTip=k.powerTip.hide;function b(){var F=this;F.top="auto";F.left="auto";F.right="auto";F.bottom="auto";F.set=function(H,G){if(k.isNumeric(G)){F[H]=Math.round(G)}}}function t(K,N,F){var J=null;function L(P,Q){M();if(!K.data(e)){if(!P){c.tipOpenImminent=true;J=setTimeout(function O(){J=null;I()},N.intentPollInterval)}else{if(Q){K.data(d,true)}F.showTip(K)}}}function G(P){M();c.tipOpenImminent=false;if(K.data(e)){K.data(d,false);if(!P){c.delayInProgress=true;J=setTimeout(function O(){J=null;F.hideTip(K);c.delayInProgress=false},N.closeDelay)}else{F.hideTip(K)}}}function I(){var Q=Math.abs(c.previousX-c.currentX),O=Math.abs(c.previousY-c.currentY),P=Q+O;if(P<N.intentSensitivity){F.showTip(K)}else{c.previousX=c.currentX;c.previousY=c.currentY;L()}}function M(){J=clearTimeout(J);c.delayInProgress=false}function H(){F.resetPosition(K)}this.show=L;this.hide=G;this.cancel=M;this.resetPosition=H}function j(){function G(M,L,J,O,P){var K=L.split("-")[0],N=new b(),I;if(q(M)){I=H(M,K)}else{I=F(M,K)}switch(L){case"n":N.set("left",I.left-(J/2));N.set("bottom",c.windowHeight-I.top+P);break;case"e":N.set("left",I.left+P);N.set("top",I.top-(O/2));break;case"s":N.set("left",I.left-(J/2));N.set("top",I.top+P);break;case"w":N.set("top",I.top-(O/2));N.set("right",c.windowWidth-I.left+P);break;case"nw":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"nw-alt":N.set("left",I.left);N.set("bottom",c.windowHeight-I.top+P);break;case"ne":N.set("left",I.left-20);N.set("bottom",c.windowHeight-I.top+P);break;case"ne-alt":N.set("bottom",c.windowHeight-I.top+P);N.set("right",c.windowWidth-I.left);break;case"sw":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left-20);break;case"sw-alt":N.set("left",I.left);N.set("top",I.top+P);break;case"se":N.set("left",I.left-20);N.set("top",I.top+P);break;case"se-alt":N.set("top",I.top+P);N.set("right",c.windowWidth-I.left);break}return N}function F(K,J){var O=K.offset(),N=K.outerWidth(),I=K.outerHeight(),M,L;switch(J){case"n":M=O.left+N/2;L=O.top;break;case"e":M=O.left+N;L=O.top+I/2;break;case"s":M=O.left+N/2;L=O.top+I;break;case"w":M=O.left;L=O.top+I/2;break;case"nw":M=O.left;L=O.top;break;case"ne":M=O.left+N;L=O.top;break;case"sw":M=O.left;L=O.top+I;break;case"se":M=O.left+N;L=O.top+I;break}return{top:L,left:M}}function H(O,K){var S=O.closest("svg")[0],N=O[0],W=S.createSVGPoint(),L=N.getBBox(),V=N.getScreenCTM(),M=L.width/2,Q=L.height/2,P=[],I=["nw","n","ne","e","se","s","sw","w"],U,X,R,T;function J(){P.push(W.matrixTransform(V))}W.x=L.x;W.y=L.y;J();W.x+=M;J();W.x+=M;J();W.y+=Q;J();W.y+=Q;J();W.x-=M;J();W.x-=M;J();W.y-=Q;J();if(P[0].y!==P[1].y||P[0].x!==P[7].x){X=Math.atan2(V.b,V.a)*E;R=Math.ceil(((X%360)-22.5)/45);if(R<1){R+=8}while(R--){I.push(I.shift())}}for(T=0;T<P.length;T++){if(I[T]===K){U=P[T];break}}return{top:U.y+c.scrollTop,left:U.x+c.scrollLeft}}this.compute=G}function x(Q){var P=new j(),O=k("#"+Q.popupId);if(O.length===0){O=k("<div/>",{id:Q.popupId});if(w.length===0){w=k("body")}w.append(O)}if(Q.followMouse){if(!O.data(u)){A.on("mousemove",M);s.on("scroll",M);O.data(u,true)}}if(Q.mouseOnToPopup){O.on({mouseenter:function L(){if(O.data(f)){if(c.activeHover){c.activeHover.data(n).cancel()}}},mouseleave:function N(){if(c.activeHover){c.activeHover.data(n).hide()}}})}function I(S){S.data(e,true);O.queue(function R(T){H(S);T()})}function H(S){var U;if(!S.data(e)){return}if(c.isTipOpen){if(!c.isClosing){K(c.activeHover)}O.delay(100).queue(function R(V){H(S);V()});return}S.trigger("powerTipPreRender");U=B(S);if(U){O.empty().append(U)}else{return}S.trigger("powerTipRender");c.activeHover=S;c.isTipOpen=true;O.data(f,Q.mouseOnToPopup);if(!Q.followMouse){G(S);c.isFixedTipOpen=true}else{M()}O.fadeIn(Q.fadeInTime,function T(){if(!c.desyncTimeout){c.desyncTimeout=setInterval(J,500)}S.trigger("powerTipOpen")})}function K(R){c.isClosing=true;c.activeHover=null;c.isTipOpen=false;c.desyncTimeout=clearInterval(c.desyncTimeout);R.data(e,false);R.data(d,false);O.fadeOut(Q.fadeOutTime,function S(){var T=new b();c.isClosing=false;c.isFixedTipOpen=false;O.removeClass();T.set("top",c.currentY+Q.offset);T.set("left",c.currentX+Q.offset);O.css(T);R.trigger("powerTipClose")})}function M(){if(!c.isFixedTipOpen&&(c.isTipOpen||(c.tipOpenImminent&&O.data(u)))){var R=O.outerWidth(),V=O.outerHeight(),U=new b(),S,T;U.set("top",c.currentY+Q.offset);U.set("left",c.currentX+Q.offset);S=m(U,R,V);if(S!==p.none){T=a(S);if(T===1){if(S===p.right){U.set("left",c.windowWidth-R)}else{if(S===p.bottom){U.set("top",c.scrollTop+c.windowHeight-V)}}}else{U.set("left",c.currentX-R-Q.offset);U.set("top",c.currentY-V-Q.offset)}}O.css(U)}}function G(S){var R,T;if(Q.smartPlacement){R=k.fn.powerTip.smartPlacementLists[Q.placement];k.each(R,function(U,W){var V=m(F(S,W),O.outerWidth(),O.outerHeight());T=W;if(V===p.none){return false}})}else{F(S,Q.placement);T=Q.placement}O.addClass(T)}function F(U,T){var R=0,S,W,V=new b();V.set("top",0);V.set("left",0);O.css(V);do{S=O.outerWidth();W=O.outerHeight();V=P.compute(U,T,S,W,Q.offset);O.css(V)}while(++R<=5&&(S!==O.outerWidth()||W!==O.outerHeight()));return V}function J(){var R=false;if(c.isTipOpen&&!c.isClosing&&!c.delayInProgress){if(c.activeHover.data(e)===false||c.activeHover.is(":disabled")){R=true}else{if(!v(c.activeHover)&&!c.activeHover.is(":focus")&&!c.activeHover.data(d)){if(O.data(f)){if(!v(O)){R=true}}else{R=true}}}if(R){K(c.activeHover)}}}this.showTip=I;this.hideTip=K;this.resetPosition=G}function q(F){return window.SVGElement&&F[0] instanceof SVGElement}function h(){if(!c.mouseTrackingActive){c.mouseTrackingActive=true;k(function H(){c.scrollLeft=s.scrollLeft();c.scrollTop=s.scrollTop();c.windowWidth=s.width();c.windowHeight=s.height()});A.on("mousemove",i);s.on({resize:function G(){c.windowWidth=s.width();c.windowHeight=s.height()},scroll:function F(){var I=s.scrollLeft(),J=s.scrollTop();if(I!==c.scrollLeft){c.currentX+=I-c.scrollLeft;c.scrollLeft=I}if(J!==c.scrollTop){c.currentY+=J-c.scrollTop;c.scrollTop=J}}})}}function i(F){c.currentX=F.pageX;c.currentY=F.pageY}function v(F){var H=F.offset(),J=F[0].getBoundingClientRect(),I=J.right-J.left,G=J.bottom-J.top;return c.currentX>=H.left&&c.currentX<=H.left+I&&c.currentY>=H.top&&c.currentY<=H.top+G}function B(I){var G=I.data(y),F=I.data(o),K=I.data(l),H,J;if(G){if(k.isFunction(G)){G=G.call(I[0])}J=G}else{if(F){if(k.isFunction(F)){F=F.call(I[0])}if(F.length>0){J=F.clone(true,true)}}else{if(K){H=k("#"+K);if(H.length>0){J=H.html()}}}}return J}function m(M,L,K){var G=c.scrollTop,J=c.scrollLeft,I=G+c.windowHeight,F=J+c.windowWidth,H=p.none;if(M.top<G||Math.abs(M.bottom-c.windowHeight)-K<G){H|=p.top}if(M.top+K>I||Math.abs(M.bottom-c.windowHeight)>I){H|=p.bottom}if(M.left<J||M.right+L>F){H|=p.left}if(M.left+L>F||M.right<J){H|=p.right}return H}function a(G){var F=0;while(G){G&=G-1;F++}return F}}));/*! + * jQuery UI Touch Punch 0.2.3 + * + * Copyright 2011–2014, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var d=b.ui.mouse.prototype,f=d._mouseInit,c=d._mouseDestroy,a;function e(h,i){if(h.originalEvent.touches.length>1){return}h.preventDefault();var j=h.originalEvent.changedTouches[0],g=document.createEvent("MouseEvents");g.initMouseEvent(i,true,true,window,1,j.screenX,j.screenY,j.clientX,j.clientY,false,false,false,false,0,null);h.target.dispatchEvent(g)}d._touchStart=function(h){var g=this;if(a||!g._mouseCapture(h.originalEvent.changedTouches[0])){return}a=true;g._touchMoved=false;e(h,"mouseover");e(h,"mousemove");e(h,"mousedown")};d._touchMove=function(g){if(!a){return}this._touchMoved=true;e(g,"mousemove")};d._touchEnd=function(g){if(!a){return}e(g,"mouseup");e(g,"mouseout");if(!this._touchMoved){e(g,"click")}a=false};d._mouseInit=function(){var g=this;g.element.bind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});f.call(g)};d._mouseDestroy=function(){var g=this;g.element.unbind({touchstart:b.proxy(g,"_touchStart"),touchmove:b.proxy(g,"_touchMove"),touchend:b.proxy(g,"_touchEnd")});c.call(g)}})(jQuery);/*! + * SmartMenus jQuery Plugin - v1.0.0 - January 27, 2016 + * http://www.smartmenus.org/ + * + * Copyright Vasil Dinkov, Vadikom Web Ltd. + * http://vadikom.com + * + * Licensed MIT + */ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(a){var b=[],e=!!window.createPopup,f=false,d="ontouchstart" in window,h=false,g=window.requestAnimationFrame||function(l){return setTimeout(l,1000/60)},c=window.cancelAnimationFrame||function(l){clearTimeout(l)};function k(m){var n=".smartmenus_mouse";if(!h&&!m){var o=true,l=null;a(document).bind(i([["mousemove",function(s){var t={x:s.pageX,y:s.pageY,timeStamp:new Date().getTime()};if(l){var q=Math.abs(l.x-t.x),p=Math.abs(l.y-t.y);if((q>0||p>0)&&q<=2&&p<=2&&t.timeStamp-l.timeStamp<=300){f=true;if(o){var r=a(s.target).closest("a");if(r.is("a")){a.each(b,function(){if(a.contains(this.$root[0],r[0])){this.itemEnter({currentTarget:r[0]});return false}})}o=false}}}l=t}],[d?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function(p){if(j(p.originalEvent)){f=false}}]],n));h=true}else{if(h&&m){a(document).unbind(n);h=false}}}function j(l){return !/^(4|mouse)$/.test(l.pointerType)}function i(l,n){if(!n){n=""}var m={};a.each(l,function(o,p){m[p[0].split(" ").join(n+" ")+n]=p[1]});return m}a.SmartMenus=function(m,l){this.$root=a(m);this.opts=l;this.rootId="";this.accessIdPrefix="";this.$subArrow=null;this.activatedItems=[];this.visibleSubMenus=[];this.showTimeout=0;this.hideTimeout=0;this.scrollTimeout=0;this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.idInc=0;this.$firstLink=null;this.$firstSub=null;this.disabled=false;this.$disableOverlay=null;this.$touchScrollingSub=null;this.cssTransforms3d="perspective" in m.style||"webkitPerspective" in m.style;this.wasCollapsible=false;this.init()};a.extend(a.SmartMenus,{hideAll:function(){a.each(b,function(){this.menuHideAll()})},destroy:function(){while(b.length){b[0].destroy()}k(true)},prototype:{init:function(n){var l=this;if(!n){b.push(this);this.rootId=(new Date().getTime()+Math.random()+"").replace(/\D/g,"");this.accessIdPrefix="sm-"+this.rootId+"-";if(this.$root.hasClass("sm-rtl")){this.opts.rightToLeftSubMenus=true}var r=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind(i([["mouseover focusin",a.proxy(this.rootOver,this)],["mouseout focusout",a.proxy(this.rootOut,this)],["keydown",a.proxy(this.rootKeyDown,this)]],r)).delegate("a",i([["mouseenter",a.proxy(this.itemEnter,this)],["mouseleave",a.proxy(this.itemLeave,this)],["mousedown",a.proxy(this.itemDown,this)],["focus",a.proxy(this.itemFocus,this)],["blur",a.proxy(this.itemBlur,this)],["click",a.proxy(this.itemClick,this)]],r));r+=this.rootId;if(this.opts.hideOnClick){a(document).bind(i([["touchstart",a.proxy(this.docTouchStart,this)],["touchmove",a.proxy(this.docTouchMove,this)],["touchend",a.proxy(this.docTouchEnd,this)],["click",a.proxy(this.docClick,this)]],r))}a(window).bind(i([["resize orientationchange",a.proxy(this.winResize,this)]],r));if(this.opts.subIndicators){this.$subArrow=a("<span/>").addClass("sub-arrow");if(this.opts.subIndicatorsText){this.$subArrow.html(this.opts.subIndicatorsText)}}k()}this.$firstSub=this.$root.find("ul").each(function(){l.menuInit(a(this))}).eq(0);this.$firstLink=this.$root.find("a").eq(0);if(this.opts.markCurrentItem){var p=/(index|default)\.[^#\?\/]*/i,m=/#.*/,q=window.location.href.replace(p,""),o=q.replace(m,"");this.$root.find("a").each(function(){var s=this.href.replace(p,""),t=a(this);if(s==q||s==o){t.addClass("current");if(l.opts.markCurrentTree){t.parentsUntil("[data-smartmenus-id]","ul").each(function(){a(this).dataSM("parent-a").addClass("current")})}}})}this.wasCollapsible=this.isCollapsible()},destroy:function(m){if(!m){var n=".smartmenus";this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(n).undelegate(n);n+=this.rootId;a(document).unbind(n);a(window).unbind(n);if(this.opts.subIndicators){this.$subArrow=null}}this.menuHideAll();var l=this;this.$root.find("ul").each(function(){var o=a(this);if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}if(o.dataSM("shown-before")){if(l.opts.subMenusMinWidth||l.opts.subMenusMaxWidth){o.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap")}if(o.dataSM("scroll-arrows")){o.dataSM("scroll-arrows").remove()}o.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})}if((o.attr("id")||"").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded");this.$root.find("a.has-submenu").each(function(){var o=a(this);if(o.attr("id").indexOf(l.accessIdPrefix)==0){o.removeAttr("id")}}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub");if(this.opts.subIndicators){this.$root.find("span.sub-arrow").remove()}if(this.opts.markCurrentItem){this.$root.find("a.current").removeClass("current")}if(!m){this.$root=null;this.$firstLink=null;this.$firstSub=null;if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}b.splice(a.inArray(this,b),1)}},disable:function(l){if(!this.disabled){this.menuHideAll();if(!l&&!this.opts.isPopup&&this.$root.is(":visible")){var m=this.$root.offset();this.$disableOverlay=a('<div class="sm-jquery-disable-overlay"/>').css({position:"absolute",top:m.top,left:m.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(true),opacity:0}).appendTo(document.body)}this.disabled=true}},docClick:function(l){if(this.$touchScrollingSub){this.$touchScrollingSub=null;return}if(this.visibleSubMenus.length&&!a.contains(this.$root[0],l.target)||a(l.target).is("a")){this.menuHideAll()}},docTouchEnd:function(m){if(!this.lastTouch){return}if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!a.contains(this.$root[0],this.lastTouch.target))){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},350)}this.lastTouch=null},docTouchMove:function(m){if(!this.lastTouch){return}var l=m.originalEvent.touches[0];this.lastTouch.x2=l.pageX;this.lastTouch.y2=l.pageY},docTouchStart:function(m){var l=m.originalEvent.touches[0];this.lastTouch={x1:l.pageX,y1:l.pageY,target:l.target}},enable:function(){if(this.disabled){if(this.$disableOverlay){this.$disableOverlay.remove();this.$disableOverlay=null}this.disabled=false}},getClosestMenu:function(m){var l=a(m).closest("ul");while(l.dataSM("in-mega")){l=l.parent().closest("ul")}return l[0]||null},getHeight:function(l){return this.getOffset(l,true)},getOffset:function(n,l){var m;if(n.css("display")=="none"){m={position:n[0].style.position,visibility:n[0].style.visibility};n.css({position:"absolute",visibility:"hidden"}).show()}var o=n[0].getBoundingClientRect&&n[0].getBoundingClientRect(),p=o&&(l?o.height||o.bottom-o.top:o.width||o.right-o.left);if(!p&&p!==0){p=l?n[0].offsetHeight:n[0].offsetWidth}if(m){n.hide().css(m)}return p},getStartZIndex:function(l){var m=parseInt(this[l?"$root":"$firstSub"].css("z-index"));if(!l&&isNaN(m)){m=parseInt(this.$root.css("z-index"))}return !isNaN(m)?m:1},getTouchPoint:function(l){return l.touches&&l.touches[0]||l.changedTouches&&l.changedTouches[0]||l},getViewport:function(l){var m=l?"Height":"Width",o=document.documentElement["client"+m],n=window["inner"+m];if(n){o=Math.min(o,n)}return o},getViewportHeight:function(){return this.getViewport(true)},getViewportWidth:function(){return this.getViewport()},getWidth:function(l){return this.getOffset(l)},handleEvents:function(){return !this.disabled&&this.isCSSOn()},handleItemEvents:function(l){return this.handleEvents()&&!this.isLinkInMegaMenu(l)},isCollapsible:function(){return this.$firstSub.css("position")=="static"},isCSSOn:function(){return this.$firstLink.css("display")=="block"},isFixed:function(){var l=this.$root.css("position")=="fixed";if(!l){this.$root.parentsUntil("body").each(function(){if(a(this).css("position")=="fixed"){l=true;return false}})}return l},isLinkInMegaMenu:function(l){return a(this.getClosestMenu(l[0])).hasClass("mega-menu")},isTouchMode:function(){return !f||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(p,l){var n=p.closest("ul"),q=n.dataSM("level");if(q>1&&(!this.activatedItems[q-2]||this.activatedItems[q-2][0]!=n.dataSM("parent-a")[0])){var m=this;a(n.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(n).each(function(){m.itemActivate(a(this).dataSM("parent-a"))})}if(!this.isCollapsible()||l){this.menuHideSubMenus(!this.activatedItems[q-1]||this.activatedItems[q-1][0]!=p[0]?q-1:q)}this.activatedItems[q-1]=p;if(this.$root.triggerHandler("activate.smapi",p[0])===false){return}var o=p.dataSM("sub");if(o&&(this.isTouchMode()||(!this.opts.showOnClick||this.clickActivated))){this.menuShow(o)}},itemBlur:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}this.$root.triggerHandler("blur.smapi",l[0])},itemClick:function(o){var n=a(o.currentTarget);if(!this.handleItemEvents(n)){return}if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==n.closest("ul")[0]){this.$touchScrollingSub=null;o.stopPropagation();return false}if(this.$root.triggerHandler("click.smapi",n[0])===false){return false}var p=a(o.target).is("span.sub-arrow"),m=n.dataSM("sub"),l=m?m.dataSM("level")==2:false;if(m&&!m.is(":visible")){if(this.opts.showOnClick&&l){this.clickActivated=true}this.itemActivate(n);if(m.is(":visible")){this.focusActivated=true;return false}}else{if(this.isCollapsible()&&p){this.itemActivate(n);this.menuHide(m);return false}}if(this.opts.showOnClick&&l||n.hasClass("disabled")||this.$root.triggerHandler("select.smapi",n[0])===false){return false}},itemDown:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}l.dataSM("mousedown",true)},itemEnter:function(n){var m=a(n.currentTarget);if(!this.handleItemEvents(m)){return}if(!this.isTouchMode()){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var l=this;this.showTimeout=setTimeout(function(){l.itemActivate(m)},this.opts.showOnClick&&m.closest("ul").dataSM("level")==1?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",m[0])},itemFocus:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(this.focusActivated&&(!this.isTouchMode()||!l.dataSM("mousedown"))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=l[0])){this.itemActivate(l,true)}this.$root.triggerHandler("focus.smapi",l[0])},itemLeave:function(m){var l=a(m.currentTarget);if(!this.handleItemEvents(l)){return}if(!this.isTouchMode()){l[0].blur();if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}}l.removeDataSM("mousedown");this.$root.triggerHandler("mouseleave.smapi",l[0])},menuHide:function(m){if(this.$root.triggerHandler("beforehide.smapi",m[0])===false){return}m.stop(true,true);if(m.css("display")!="none"){var l=function(){m.css("z-index","")};if(this.isCollapsible()){if(this.opts.collapsibleHideFunction){this.opts.collapsibleHideFunction.call(this,m,l)}else{m.hide(this.opts.collapsibleHideDuration,l)}}else{if(this.opts.hideFunction){this.opts.hideFunction.call(this,m,l)}else{m.hide(this.opts.hideDuration,l)}}if(m.dataSM("ie-shim")){m.dataSM("ie-shim").remove().css({"-webkit-transform":"",transform:""})}if(m.dataSM("scroll")){this.menuScrollStop(m);m.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()}m.dataSM("parent-a").removeClass("highlighted").attr("aria-expanded","false");m.attr({"aria-expanded":"false","aria-hidden":"true"});var n=m.dataSM("level");this.activatedItems.splice(n-1,1);this.visibleSubMenus.splice(a.inArray(m,this.visibleSubMenus),1);this.$root.triggerHandler("hide.smapi",m[0])}},menuHideAll:function(){if(this.showTimeout){clearTimeout(this.showTimeout);this.showTimeout=0}var m=this.opts.isPopup?1:0;for(var l=this.visibleSubMenus.length-1;l>=m;l--){this.menuHide(this.visibleSubMenus[l])}if(this.opts.isPopup){this.$root.stop(true,true);if(this.$root.is(":visible")){if(this.opts.hideFunction){this.opts.hideFunction.call(this,this.$root)}else{this.$root.hide(this.opts.hideDuration)}if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").remove()}}}this.activatedItems=[];this.visibleSubMenus=[];this.clickActivated=false;this.focusActivated=false;this.zIndexInc=0;this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(n){for(var l=this.activatedItems.length-1;l>=n;l--){var m=this.activatedItems[l].dataSM("sub");if(m){this.menuHide(m)}}},menuIframeShim:function(l){if(e&&this.opts.overlapControlsInIE&&!l.dataSM("ie-shim")){l.dataSM("ie-shim",a("<iframe/>").attr({src:"javascript:0",tabindex:-9}).css({position:"absolute",top:"auto",left:"0",opacity:0,border:"0"}))}},menuInit:function(l){if(!l.dataSM("in-mega")){if(l.hasClass("mega-menu")){l.find("ul").dataSM("in-mega",true)}var q=2,m=l[0];while((m=m.parentNode.parentNode)!=this.$root[0]){q++}var n=l.prevAll("a").eq(-1);if(!n.length){n=l.prevAll().find("a").eq(-1)}n.addClass("has-submenu").dataSM("sub",l);l.dataSM("parent-a",n).dataSM("level",q).parent().dataSM("sub",l);var o=n.attr("id")||this.accessIdPrefix+(++this.idInc),p=l.attr("id")||this.accessIdPrefix+(++this.idInc);n.attr({id:o,"aria-haspopup":"true","aria-controls":p,"aria-expanded":"false"});l.attr({id:p,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"});if(this.opts.subIndicators){n[this.opts.subIndicatorsPos](this.$subArrow.clone())}}},menuPosition:function(K){var r=K.dataSM("parent-a"),D=r.closest("li"),E=D.parent(),l=K.dataSM("level"),t=this.getWidth(K),J=this.getHeight(K),u=r.offset(),o=u.left,m=u.top,q=this.getWidth(r),F=this.getHeight(r),H=a(window),v=H.scrollLeft(),s=H.scrollTop(),z=this.getViewportWidth(),L=this.getViewportHeight(),w=E.parent().is("[data-sm-horizontal-sub]")||l==2&&!E.hasClass("sm-vertical"),B=this.opts.rightToLeftSubMenus&&!D.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&D.is("[data-sm-reverse]"),p=l==2?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,n=l==2?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,C,A;if(w){C=B?q-t-p:p;A=this.opts.bottomToTopSubMenus?-J-n:F+n}else{C=B?p-t:q-p;A=this.opts.bottomToTopSubMenus?F-n-J:n}if(this.opts.keepInViewport){var N=o+C,M=m+A;if(B&&N<v){C=w?v-N+C:q-p}else{if(!B&&N+t>v+z){C=w?v+z-t-N+C:p-t}}if(!w){if(J<L&&M+J>s+L){A+=s+L-J-M}else{if(J>=L||M<s){A+=s-M}}}if(w&&(M+J>s+L+0.49||M<s)||!w&&J>L+0.49){var G=this;if(!K.dataSM("scroll-arrows")){K.dataSM("scroll-arrows",a([a('<span class="scroll-up"><span class="scroll-up-arrow"></span></span>')[0],a('<span class="scroll-down"><span class="scroll-down-arrow"></span></span>')[0]]).bind({mouseenter:function(){K.dataSM("scroll").up=a(this).hasClass("scroll-up");G.menuScroll(K)},mouseleave:function(x){G.menuScrollStop(K);G.menuScrollOut(K,x)},"mousewheel DOMMouseScroll":function(x){x.preventDefault()}}).insertAfter(K))}var I=".smartmenus_scroll";K.dataSM("scroll",{y:this.cssTransforms3d?0:A-F,step:1,itemH:F,subH:J,arrowDownH:this.getHeight(K.dataSM("scroll-arrows").eq(1))}).bind(i([["mouseover",function(x){G.menuScrollOver(K,x)}],["mouseout",function(x){G.menuScrollOut(K,x)}],["mousewheel DOMMouseScroll",function(x){G.menuScrollMousewheel(K,x)}]],I)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:C+(parseInt(K.css("border-left-width"))||0),width:t-(parseInt(K.css("border-left-width"))||0)-(parseInt(K.css("border-right-width"))||0),zIndex:K.css("z-index")}).eq(w&&this.opts.bottomToTopSubMenus?0:1).show();if(this.isFixed()){K.css({"touch-action":"none","-ms-touch-action":"none"}).bind(i([[d?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp",function(x){G.menuScrollTouch(K,x)}]],I))}}}K.css({top:"auto",left:"0",marginLeft:C,marginTop:A-F});this.menuIframeShim(K);if(K.dataSM("ie-shim")){K.dataSM("ie-shim").css({zIndex:K.css("z-index"),width:t,height:J,marginLeft:C,marginTop:A-F})}},menuScroll:function(r,m,n){var p=r.dataSM("scroll"),q=r.dataSM("scroll-arrows"),o=p.up?p.upEnd:p.downEnd,s;if(!m&&p.momentum){p.momentum*=0.92;s=p.momentum;if(s<0.5){this.menuScrollStop(r);return}}else{s=n||(m||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(p.step))}var l=r.dataSM("level");if(this.activatedItems[l-1]&&this.activatedItems[l-1].dataSM("sub")&&this.activatedItems[l-1].dataSM("sub").is(":visible")){this.menuHideSubMenus(l-1)}p.y=p.up&&o<=p.y||!p.up&&o>=p.y?p.y:(Math.abs(o-p.y)>s?p.y+(p.up?s:-s):o);r.add(r.dataSM("ie-shim")).css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+p.y+"px, 0)",transform:"translate3d(0, "+p.y+"px, 0)"}:{marginTop:p.y});if(f&&(p.up&&p.y>p.downEnd||!p.up&&p.y<p.upEnd)){q.eq(p.up?1:0).show()}if(p.y==o){if(f){q.eq(p.up?0:1).hide()}this.menuScrollStop(r)}else{if(!m){if(this.opts.scrollAccelerate&&p.step<this.opts.scrollStep){p.step+=0.2}var t=this;this.scrollTimeout=g(function(){t.menuScroll(r)})}}},menuScrollMousewheel:function(m,n){if(this.getClosestMenu(n.target)==m[0]){n=n.originalEvent;var l=(n.wheelDelta||-n.detail)>0;if(m.dataSM("scroll-arrows").eq(l?0:1).is(":visible")){m.dataSM("scroll").up=l;this.menuScroll(m,true)}}n.preventDefault()},menuScrollOut:function(l,m){if(f){if(!/^scroll-(up|down)/.test((m.relatedTarget||"").className)&&(l[0]!=m.relatedTarget&&!a.contains(l[0],m.relatedTarget)||this.getClosestMenu(m.relatedTarget)!=l[0])){l.dataSM("scroll-arrows").css("visibility","hidden")}}},menuScrollOver:function(n,o){if(f){if(!/^scroll-(up|down)/.test(o.target.className)&&this.getClosestMenu(o.target)==n[0]){this.menuScrollRefreshData(n);var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;n.dataSM("scroll-arrows").eq(0).css("margin-top",l).end().eq(1).css("margin-top",l+this.getViewportHeight()-m.arrowDownH).end().css("visibility","visible")}}},menuScrollRefreshData:function(n){var m=n.dataSM("scroll"),l=a(window).scrollTop()-n.dataSM("parent-a").offset().top-m.itemH;if(this.cssTransforms3d){l=-(parseFloat(n.css("margin-top"))-l)}a.extend(m,{upEnd:l,downEnd:l+this.getViewportHeight()-m.subH})},menuScrollStop:function(l){if(this.scrollTimeout){c(this.scrollTimeout);this.scrollTimeout=0;l.dataSM("scroll").step=1;return true}},menuScrollTouch:function(p,q){q=q.originalEvent;if(j(q)){var m=this.getTouchPoint(q);if(this.getClosestMenu(m.target)==p[0]){var o=p.dataSM("scroll");if(/(start|down)$/i.test(q.type)){if(this.menuScrollStop(p)){q.preventDefault();this.$touchScrollingSub=p}else{this.$touchScrollingSub=null}this.menuScrollRefreshData(p);a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}else{if(/move$/i.test(q.type)){var n=o.touchY!==undefined?o.touchY:o.touchStartY;if(n!==undefined&&n!=m.pageY){this.$touchScrollingSub=p;var l=n<m.pageY;if(o.up!==undefined&&o.up!=l){a.extend(o,{touchStartY:m.pageY,touchStartTime:q.timeStamp})}a.extend(o,{up:l,touchY:m.pageY});this.menuScroll(p,true,Math.abs(m.pageY-n))}q.preventDefault()}else{if(o.touchY!==undefined){if(o.momentum=Math.pow(Math.abs(m.pageY-o.touchStartY)/(q.timeStamp-o.touchStartTime),2)*15){this.menuScrollStop(p);this.menuScroll(p);q.preventDefault()}delete o.touchY}}}}}},menuShow:function(n){if(!n.dataSM("beforefirstshowfired")){n.dataSM("beforefirstshowfired",true);if(this.$root.triggerHandler("beforefirstshow.smapi",n[0])===false){return}}if(this.$root.triggerHandler("beforeshow.smapi",n[0])===false){return}n.dataSM("shown-before",true).stop(true,true);if(!n.is(":visible")){var m=n.dataSM("parent-a");if(this.opts.keepHighlighted||this.isCollapsible()){m.addClass("highlighted")}if(this.isCollapsible()){n.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""})}else{n.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1);if(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth){n.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap");if(this.opts.subMenusMinWidth){n.css("min-width",this.opts.subMenusMinWidth)}if(this.opts.subMenusMaxWidth){var o=this.getWidth(n);n.css("max-width",this.opts.subMenusMaxWidth);if(o>this.getWidth(n)){n.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}}}this.menuPosition(n);if(n.dataSM("ie-shim")){n.dataSM("ie-shim").insertBefore(n)}}var l=function(){n.css("overflow","")};if(this.isCollapsible()){if(this.opts.collapsibleShowFunction){this.opts.collapsibleShowFunction.call(this,n,l)}else{n.show(this.opts.collapsibleShowDuration,l)}}else{if(this.opts.showFunction){this.opts.showFunction.call(this,n,l)}else{n.show(this.opts.showDuration,l)}}m.attr("aria-expanded","true");n.attr({"aria-expanded":"true","aria-hidden":"false"});this.visibleSubMenus.push(n);this.$root.triggerHandler("show.smapi",n[0])}},popupHide:function(l){if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}var m=this;this.hideTimeout=setTimeout(function(){m.menuHideAll()},l?1:this.opts.hideTimeout)},popupShow:function(o,n){if(!this.opts.isPopup){alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.');return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}this.$root.dataSM("shown-before",true).stop(true,true);if(!this.$root.is(":visible")){this.$root.css({left:o,top:n});this.menuIframeShim(this.$root);if(this.$root.dataSM("ie-shim")){this.$root.dataSM("ie-shim").css({zIndex:this.$root.css("z-index"),width:this.getWidth(this.$root),height:this.getHeight(this.$root),left:o,top:n}).insertBefore(this.$root)}var m=this,l=function(){m.$root.css("overflow","")};if(this.opts.showFunction){this.opts.showFunction.call(this,this.$root,l)}else{this.$root.show(this.opts.showDuration,l)}this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(true);this.init(true)},rootKeyDown:function(o){if(!this.handleEvents()){return}switch(o.keyCode){case 27:var m=this.activatedItems[0];if(m){this.menuHideAll();m[0].focus();var n=m.dataSM("sub");if(n){this.menuHide(n)}}break;case 32:var l=a(o.target);if(l.is("a")&&this.handleItemEvents(l)){var n=l.dataSM("sub");if(n&&!n.is(":visible")){this.itemClick({currentTarget:o.target});o.preventDefault()}}break}},rootOut:function(m){if(!this.handleEvents()||this.isTouchMode()||m.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}if(!this.opts.showOnClick||!this.opts.hideOnClick){var l=this;this.hideTimeout=setTimeout(function(){l.menuHideAll()},this.opts.hideTimeout)}},rootOver:function(l){if(!this.handleEvents()||this.isTouchMode()||l.target==this.$root[0]){return}if(this.hideTimeout){clearTimeout(this.hideTimeout);this.hideTimeout=0}},winResize:function(m){if(!this.handleEvents()){if(this.$disableOverlay){var n=this.$root.offset();this.$disableOverlay.css({top:n.top,left:n.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}return}if(!("onorientationchange" in window)||m.type=="orientationchange"){var l=this.isCollapsible();if(!(this.wasCollapsible&&l)){if(this.activatedItems.length){this.activatedItems[this.activatedItems.length-1][0].blur()}this.menuHideAll()}this.wasCollapsible=l}}}});a.fn.dataSM=function(l,m){if(m){return this.data(l+"_smartmenus",m)}return this.data(l+"_smartmenus")};a.fn.removeDataSM=function(l){return this.removeData(l+"_smartmenus")};a.fn.smartmenus=function(m){if(typeof m=="string"){var l=arguments,o=m;Array.prototype.shift.call(l);return this.each(function(){var p=a(this).data("smartmenus");if(p&&p[o]){p[o].apply(p,l)}})}var n=a.extend({},a.fn.smartmenus.defaults,m);return this.each(function(){new a.SmartMenus(this,n)})};a.fn.smartmenus.defaults={isPopup:false,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:true,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:30,scrollAccelerate:true,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(m,l){m.fadeOut(200,l)},collapsibleShowDuration:0,collapsibleShowFunction:function(m,l){m.slideDown(200,l)},collapsibleHideDuration:0,collapsibleHideFunction:function(m,l){m.slideUp(200,l)},showOnClick:false,hideOnClick:true,noMouseOver:false,keepInViewport:true,keepHighlighted:true,markCurrentItem:false,markCurrentTree:true,rightToLeftSubMenus:false,bottomToTopSubMenus:false,overlapControlsInIE:true};return a}));
\ No newline at end of file diff --git a/templates/html/menu.js b/templates/html/menu.js new file mode 100644 index 0000000..8ea4097 --- /dev/null +++ b/templates/html/menu.js @@ -0,0 +1,22 @@ +function initMenu(relPath,searchEnabled,search) { + function makeTree(data,relPath) { + var result=''; + if ('children' in data) { + result+='<ul>'; + for (var i in data.children) { + result+='<li><a href="'+relPath+data.children[i].url+'">'+ + data.children[i].text+'</a>'+ + makeTree(data.children[i],relPath)+'</li>'; + } + result+='</ul>'; + } + return result; + } + + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + if (searchEnabled) { + $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>'); + } + $('#main-menu').smartmenus(); +} diff --git a/templates/html/navtree.css b/templates/html/navtree.css index c618811..d6b54b5 100644 --- a/templates/html/navtree.css +++ b/templates/html/navtree.css @@ -94,8 +94,11 @@ } .ui-resizable-e { - background:url("splitbar.png") repeat scroll right center transparent; - cursor:e-resize; + background-image:url("splitbar.png"); + background-size:100%; + background-repeat:no-repeat + background-attachment: scroll; + cursor:ew-resize; height:100%; right:0; top:0; diff --git a/templates/html/navtree.js b/templates/html/navtree.js index 9df45a7..287659a 100644 --- a/templates/html/navtree.js +++ b/templates/html/navtree.js @@ -71,17 +71,17 @@ function cachedLink() function getScript(scriptName,func,show) { - var head = document.getElementsByTagName("head")[0]; + var head = document.getElementsByTagName("head")[0]; var script = document.createElement('script'); script.id = scriptName; script.type = 'text/javascript'; - script.onload = func; - script.src = scriptName+'.js'; - if ($.browser.msie && $.browser.version<=8) { + script.onload = func; + script.src = scriptName+'.js'; + if ($.browser.msie && $.browser.version<=8) { // script.onload does not work with older versions of IE script.onreadystatechange = function() { - if (script.readyState=='complete' || script.readyState=='loaded') { - func(); if (show) showRoot(); + if (script.readyState=='complete' || script.readyState=='loaded') { + func(); if (show) showRoot(); } } } @@ -121,7 +121,7 @@ function createIndent(o,domNode,node,level) span.style.height = '22px'; span.innerHTML = ' '; domNode.appendChild(span); - } + } } var animationInProgress = false; @@ -195,7 +195,7 @@ function newNode(o, po, text, link, childrenData, lastNode) var aname = '#'+link.split('#')[1]; var srcPage = stripPath(pathName()); var targetPage = stripPath(link.split('#')[0]); - a.href = srcPage!=targetPage ? url : "javascript:void(0)"; + a.href = srcPage!=targetPage ? url : "javascript:void(0)"; a.onclick = function(){ storeLink(link); if (!$(a).parent().parent().hasClass('selected')) @@ -213,7 +213,7 @@ function newNode(o, po, text, link, childrenData, lastNode) a.onclick = function() { storeLink(link); } } } else { - if (childrenData != null) + if (childrenData != null) { a.className = "nolink"; a.href = "javascript:void(0)"; @@ -262,7 +262,7 @@ function expandNode(o, node, imm, showRoot) } else { if (!node.childrenVisited) { getNode(o, node); - } if (imm || ($.browser.msie && $.browser.version>8)) { + } if (imm || ($.browser.msie && $.browser.version>8)) { // somehow slideDown jumps to the start of tree for IE9 :-( $(node.getChildrenUL()).show(); } else { diff --git a/templates/html/resize.js b/templates/html/resize.js index 76c1a6b..2066667 100644 --- a/templates/html/resize.js +++ b/templates/html/resize.js @@ -1,84 +1,114 @@ -var cookie_namespace = 'doxygen'; -var sidenav,navtree,content,header; - -function readCookie(cookie) +function initResizable() { - var myCookie = cookie_namespace+"_"+cookie+"="; - if (document.cookie) + var cookie_namespace = 'doxygen'; + var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight; + + function readCookie(cookie) { - var index = document.cookie.indexOf(myCookie); - if (index != -1) - { - var valStart = index + myCookie.length; - var valEnd = document.cookie.indexOf(";", valStart); - if (valEnd == -1) - { - valEnd = document.cookie.length; + var myCookie = cookie_namespace+"_"+cookie+"="; + if (document.cookie) { + var index = document.cookie.indexOf(myCookie); + if (index != -1) { + var valStart = index + myCookie.length; + var valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + var val = document.cookie.substring(valStart, valEnd); + return val; } - var val = document.cookie.substring(valStart, valEnd); - return val; } + return 0; } - return 0; -} -function writeCookie(cookie, val, expiration) -{ - if (val==undefined) return; - if (expiration == null) + function writeCookie(cookie, val, expiration) { - var date = new Date(); - date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week - expiration = date.toGMTString(); + if (val==undefined) return; + if (expiration == null) { + var date = new Date(); + date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week + expiration = date.toGMTString(); + } + document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; } - document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/"; -} - -function resizeWidth() -{ - var windowWidth = $(window).width() + "px"; - var sidenavWidth = $(sidenav).outerWidth(); - content.css({marginLeft:parseInt(sidenavWidth)+"px"}); - writeCookie('width',sidenavWidth, null); -} -function restoreWidth(navWidth) -{ - var windowWidth = $(window).width() + "px"; - content.css({marginLeft:parseInt(navWidth)+6+"px"}); - sidenav.css({width:navWidth + "px"}); -} + function resizeWidth() + { + var windowWidth = $(window).width() + "px"; + var sidenavWidth = $(sidenav).outerWidth(); + content.css({marginLeft:parseInt(sidenavWidth)+"px"}); + writeCookie('width',sidenavWidth-barWidth, null); + } -function resizeHeight() -{ - var headerHeight = header.outerHeight(); - var footerHeight = footer.outerHeight(); - var windowHeight = $(window).height() - headerHeight - footerHeight; - content.css({height:windowHeight + "px"}); - navtree.css({height:windowHeight + "px"}); - sidenav.css({height:windowHeight + "px"}); -} + function restoreWidth(navWidth) + { + var windowWidth = $(window).width() + "px"; + content.css({marginLeft:parseInt(navWidth)+barWidth+"px"}); + sidenav.css({width:navWidth + "px"}); + } + + function resizeHeight() + { + var headerHeight = header.outerHeight(); + var footerHeight = footer.outerHeight(); + var windowHeight = $(window).height() - headerHeight - footerHeight; + content.css({height:windowHeight + "px"}); + navtree.css({height:windowHeight + "px"}); + sidenav.css({height:windowHeight + "px"}); + var width=$(window).width(); + if (width!=collapsedWidth) { + if (width<desktop_vp && collapsedWidth>=desktop_vp) { + if (!collapsed) { + collapseExpand(); + } + } else if (width>desktop_vp && collapsedWidth<desktop_vp) { + if (collapsed) { + collapseExpand(); + } + } + collapsedWidth=width; + } + } + + function collapseExpand() + { + if (sidenav.width()>0) { + restoreWidth(0); + collapsed=true; + } + else { + var width = readCookie('width'); + if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); } + collapsed=false; + } + } -function initResizable() -{ header = $("#top"); sidenav = $("#side-nav"); content = $("#doc-content"); navtree = $("#nav-tree"); footer = $("#nav-path"); $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); + $(sidenav).resizable({ minWidth: 0 }); $(window).resize(function() { resizeHeight(); }); + var device = navigator.userAgent.toLowerCase(); + var ios_or_android = device.match(/(iphone|ipod|ipad|android)/); + if (ios_or_android) { /* wider split bar for touch only devices */ + $(sidenav).css({ paddingRight:'20px' }); + $('.ui-resizable-e').css({ width:'20px' }); + console.log('ui='+$('.ui-resizable-e').width()); + $('#nav-sync').css({ right:'34px' }); + barWidth=20; + } var width = readCookie('width'); if (width) { restoreWidth(width); } else { resizeWidth(); } - resizeHeight(); var url = location.href; var i=url.indexOf("#"); if (i>=0) window.location.hash=url.substr(i); var _preventDefault = function(evt) { evt.preventDefault(); }; $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); + $(".ui-resizable-handle").dblclick(collapseExpand); $(document).bind('touchmove',function(e){ - var device = navigator.userAgent.toLowerCase(); - var ios_or_android = device.match(/(iphone|ipod|ipad|android)/); if (ios_or_android) { try { var target = e.target; @@ -92,6 +122,7 @@ function initResizable() } } }); + $(window).load(resizeHeight); } diff --git a/templates/html/search.css b/templates/html/search.css index a77ab21..e3cb50d 100644 --- a/templates/html/search.css +++ b/templates/html/search.css @@ -6,14 +6,12 @@ #MSearchBox { white-space : nowrap; - position: absolute; float: none; - display: inline; margin-top: 8px; right: 0px; width: 170px; + height: 24px; z-index: 102; - background-color: white; } #MSearchBox .left @@ -54,6 +52,7 @@ color: #909090; outline: none; font: 9pt Arial, Verdana, sans-serif; + -webkit-border-radius: 0px; } #FSearchBox #MSearchField { @@ -64,7 +63,7 @@ display:block; position:absolute; right:10px; - top:0px; + top:8px; width:20px; height:19px; background:url('search_r.png') no-repeat; @@ -102,7 +101,7 @@ left: 0; top: 0; border: 1px solid ##A0; background-color: ##FA; - z-index: 1; + z-index: 10001; padding-top: 4px; padding-bottom: 4px; -moz-border-radius: 4px; @@ -165,6 +164,7 @@ iframe#MSearchResults { left: 0; top: 0; border: 1px solid #000; background-color: ##F0; + z-index:10000; } /* ----------------------------------- */ diff --git a/templates/html/tabs.css b/templates/html/tabs.css index 737d559..a28614b 100644 --- a/templates/html/tabs.css +++ b/templates/html/tabs.css @@ -1,60 +1 @@ -.tabs, .tabs2, .tabs3 { - background-image: url('tab_b.png'); - width: 100%; - z-index: 101; - font-size: 13px; - font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; -} - -.tabs2 { - font-size: 10px; -} -.tabs3 { - font-size: 9px; -} - -.tablist { - margin: 0; - padding: 0; - display: table; -} - -.tablist li { - float: left; - display: table-cell; - background-image: url('tab_b.png'); - line-height: 36px; - list-style: none; -} - -.tablist a { - display: block; - padding: 0 20px; - font-weight: bold; - background-image:url('tab_s.png'); - background-repeat:no-repeat; - background-position:right; - color: ##30; - text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - text-decoration: none; - outline: none; -} - -.tabs3 .tablist a { - padding: 0 10px; -} - -.tablist a:hover { - background-image: url('tab_h.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); - text-decoration: none; -} - -.tablist li.current a { - background-image: url('tab_a.png'); - background-repeat:repeat-x; - color: #fff; - text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); -} +.sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#doc-content{overflow:auto;display:block;padding:0;margin:0;-webkit-overflow-scrolling:touch}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace!important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0!important;-webkit-border-radius:0;border-radius:0!important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px!important;-webkit-border-radius:5px;border-radius:5px!important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0!important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px!important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}}
\ No newline at end of file |