[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-358-g11ffd66
Thomas Sibley
trs at bestpractical.com
Mon Dec 6 13:28:24 EST 2010
The branch, 3.9-trunk has been updated
via 11ffd66a8cdb89163f45e4e3af43ce1a7724ffb0 (commit)
from cb32d9a66c5e9b8c6de05a7087962c9a398cba30 (commit)
Summary of changes:
etc/RT_Config.pm.in | 1 +
share/html/NoAuth/css/aileron/InHeader | 2 +-
share/html/NoAuth/css/web2/InHeader | 7 +-
share/html/NoAuth/js/jquery.supposition.js | 83 ++++++++++++++++++++++++++++
4 files changed, 89 insertions(+), 4 deletions(-)
create mode 100644 share/html/NoAuth/js/jquery.supposition.js
- Log -----------------------------------------------------------------
commit 11ffd66a8cdb89163f45e4e3af43ce1a7724ffb0
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Dec 6 13:27:46 2010 -0500
Use the jQuery plugin Supposition to help keep menus in the viewport
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index b33d165..997421a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2196,6 +2196,7 @@ Set(@JSFilesInHead, qw/
jquery.event.hover-1.0.js
superfish.js
supersubs.js
+ jquery.supposition.js
history-folding.js
late.js
/);
diff --git a/share/html/NoAuth/css/aileron/InHeader b/share/html/NoAuth/css/aileron/InHeader
index af33955..4dba1de 100644
--- a/share/html/NoAuth/css/aileron/InHeader
+++ b/share/html/NoAuth/css/aileron/InHeader
@@ -64,6 +64,6 @@ jQuery(document).ready(function(){
};
jQuery("#app-nav.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish();
- jQuery("#page-menu.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ autoArrows: false, dropShadows: false });
+ jQuery("#page-menu.toplevel").addClass('sf-menu sf-js-enabled sf-shadow').supersubs().superfish({ autoArrows: false, dropShadows: false }).supposition();
});
</script>
diff --git a/share/html/NoAuth/css/web2/InHeader b/share/html/NoAuth/css/web2/InHeader
index f2696f6..d756953 100644
--- a/share/html/NoAuth/css/web2/InHeader
+++ b/share/html/NoAuth/css/web2/InHeader
@@ -63,14 +63,15 @@ jQuery(document).ready(function(){
jQuery("#li-page-bookmark").detach().appendTo("#li-page-actions>ul");
jQuery("#li-page-actions>ul").attr("id","page-action-menu").detach().insertAfter("#topactions");
+
jQuery.fn.supersubs.defaults = {
maxWidth: 30,
extraWidth: 2
};
- jQuery("#page-menu.toplevel").addClass("sf-menu sf-js-enabled").supersubs().superfish();
- jQuery("#app-nav.toplevel").addClass("sf-menu sf-vertical sf-js-enabled").supersubs().superfish();
- jQuery("#prefs-menu").addClass("sf-menu sf-js-enabled").supersubs().superfish();
+ jQuery("#page-menu.toplevel").addClass("sf-menu sf-js-enabled").supersubs().superfish().supposition();
+ jQuery("#app-nav.toplevel").addClass("sf-menu sf-vertical sf-js-enabled").supersubs().superfish().supposition();
+ jQuery("#prefs-menu").addClass("sf-menu sf-js-enabled").supersubs().superfish().supposition();
});
</script>
<!--[if lt IE 9]>
diff --git a/share/html/NoAuth/js/jquery.supposition.js b/share/html/NoAuth/js/jquery.supposition.js
new file mode 100644
index 0000000..0ce5730
--- /dev/null
+++ b/share/html/NoAuth/js/jquery.supposition.js
@@ -0,0 +1,83 @@
+/* This file was modified to look for superfish in $.fn.superfish instead of $.superfish */
+
+/*
+ * Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget
+ *
+ * Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him.
+ * Special thanks to Karl Swedberg for valuable input.
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
+(function($){
+
+ $.fn.supposition = function(){
+ var $w = $(window), /*do this once instead of every onBeforeShow call*/
+ _offset = function(dir) {
+ return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
+ || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft']
+ || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft'];
+ },
+ onInit = function(){
+ /* I haven't touched this bit - needs work as there are still z-index issues */
+ $topNav = $('li',this);
+ var cZ=parseInt($topNav.css('z-index')) + $topNav.length;
+ $topNav.each(function() {
+ $(this).css({zIndex:--cZ});
+ });
+ },
+ onHide = function(){
+ this.css({marginTop:'',marginLeft:''});
+ },
+ onBeforeShow = function(){
+ this.each(function(){
+ var $u = $(this);
+ $u.css('display','block');
+ var menuWidth = $u.width(),
+ parentWidth = $u.parents('ul').width(),
+ totalRight = $w.width() + _offset('x'),
+ menuRight = $u.offset().left + menuWidth;
+ if (menuRight > totalRight) {
+ $u.css('margin-left', ($u.parents('ul').length == 1 ? totalRight - menuRight : -(menuWidth + parentWidth)) + 'px');
+ }
+
+ var windowHeight = $w.height(),
+ offsetTop = $u.offset().top,
+ menuHeight = $u.height(),
+ baseline = windowHeight + _offset('y');
+ var expandUp = (offsetTop + menuHeight > baseline);
+ if (expandUp) {
+ $u.css('margin-top',baseline - (menuHeight + offsetTop));
+ }
+ $u.css('display','none');
+ });
+ };
+
+ return this.each(function() {
+ var o = $.fn.superfish.o[this.serial]; /* get this menu's options */
+
+ /* if callbacks already set, store them */
+ var _onInit = o.onInit,
+ _onBeforeShow = o.onBeforeShow,
+ _onHide = o.onHide;
+
+ $.extend($.fn.superfish.o[this.serial],{
+ onInit : function() {
+ onInit.call(this); /* fire our Supposition callback */
+ _onInit.call(this); /* fire stored callbacks */
+ },
+ onBeforeShow: function() {
+ onBeforeShow.call(this); /* fire our Supposition callback */
+ _onBeforeShow.call(this); /* fire stored callbacks */
+ },
+ onHide : function() {
+ onHide.call(this); /* fire our Supposition callback */
+ _onHide.call(this); /* fire stored callbacks */
+ }
+ });
+ });
+ };
+
+})(jQuery);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list