From 91ecca1a7acc15f859b34164c4025ef355653ec6 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Sat, 4 Sep 2010 17:08:43 -0300 Subject: [PATCH] Fix menus in old layout --- app/views/layouts/application.rhtml | 4 ---- app/views/shared/assets_menu.rhtml | 6 ------ app/views/shared/user_menu.rhtml | 45 +++++++++++++++++++++------------------------ public/images/icons-bar/photo.png | Bin 781 -> 0 bytes public/javascripts/application.js | 2 +- public/javascripts/auto-open-menu.js | 70 ---------------------------------------------------------------------- public/javascripts/menu-config.js | 7 ------- public/javascripts/menu.js | 129 --------------------------------------------------------------------------------------------------------------------------------- public/stylesheets/application.css | 2 -- 9 files changed, 22 insertions(+), 243 deletions(-) delete mode 100644 public/images/icons-bar/photo.png delete mode 100644 public/javascripts/auto-open-menu.js delete mode 100644 public/javascripts/menu-config.js delete mode 100644 public/javascripts/menu.js diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index dca8365..513046e 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -9,7 +9,6 @@ <%= yield(:feeds) %> <%= noosfero_javascript %> - <%= javascript_include_tag 'menu', 'auto-open-menu', 'menu-config', :cache => 'cache-menu' %> <%= theme_javascript %> <%= @@ -88,9 +87,6 @@ <% end %> <%= render :file => 'shared/assets_menu' %> -
<%= language_chooser(:element => 'dropdown') %> diff --git a/app/views/shared/assets_menu.rhtml b/app/views/shared/assets_menu.rhtml index 342d360..52c45ee 100644 --- a/app/views/shared/assets_menu.rhtml +++ b/app/views/shared/assets_menu.rhtml @@ -7,9 +7,3 @@
- - diff --git a/app/views/shared/user_menu.rhtml b/app/views/shared/user_menu.rhtml index bccbfd6..a749414 100644 --- a/app/views/shared/user_menu.rhtml +++ b/app/views/shared/user_menu.rhtml @@ -1,52 +1,48 @@
- <% if logged_in? %> +
+ + + +
-<%= javascript_tag 'setAutoOpenMenu( $("user_menu") )' if theme_option( :menu_login ) != 'full_form' %> +
+ diff --git a/public/images/icons-bar/photo.png b/public/images/icons-bar/photo.png deleted file mode 100644 index efb2cb7..0000000 Binary files a/public/images/icons-bar/photo.png and /dev/null differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 5ae4ccf..788daca 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -444,7 +444,7 @@ jQuery(function($) { $(this).find('a[href]').each(function() { $(this).attr('href', $(this).attr('href').replace('%{login}', data.login)) }); - var html = $(this).html().replace('%{login}', data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); + var html = $(this).html().replace(/%{login}/g, data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); $(this).html(html).fadeIn(); if (data.is_admin) { $('#user .admin-link').show(); diff --git a/public/javascripts/auto-open-menu.js b/public/javascripts/auto-open-menu.js deleted file mode 100644 index b608b16..0000000 --- a/public/javascripts/auto-open-menu.js +++ /dev/null @@ -1,70 +0,0 @@ - -function setAutoOpenMenu( menu ) { - - var mul = menu.getElementsByTagName("ul")[0]; - if ( !mul ) return false; - - mul.h = mul.clientHeight; // remember the current height to a faster animation - mul.minSize = mul.clientHeight; - var vli = mul.getElementsByTagName("li"); - mul.paddingBottom = parseInt( menu.className.replace( /^.*AOM_paddingBottom_([^\s]+).*$/, "$1" ) ); - mul.maxSize = ( vli.length * ( vli[1].offsetTop - vli[0].offsetTop ) ); - mul.inc = 1; - - window["autoOpenMenu-"+menu.id] = menu; - menu.mul = mul; - - if ( mul.minSize == 1 ) { - // Work arround bug for IE - ie sux - ie sux - ie sux - ie sux -ie sux -ie sux -ie sux - ie sux!!! - mul.h = 3; - setTimeout('m = window[\'autoOpenMenu-'+menu.id+'\']; m.onmouseout()', 10); - } - - menu.isIE = ( navigator.appName.indexOf("Microsoft") > -1 ); - - menu.onmouseover = function () { - clearTimeout( this.timeoutClose ); - this.className = this.className.replace( / closed/g, "" ); - if ( !/menu-opened/.test(this.className) ) { this.className += " opened" } - var mul = this.mul; - mul.style.display = "block"; - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = mul.paddingBottom +"px"; - if ( mul.h < mul.maxSize ) { - mul.h += mul.inc; - mul.inc += 2; - mul.style.height = mul.h +"px"; - this.timeoutOpen = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseover()", 33 ); - } else { - mul.h = mul.maxSize; - mul.style.height = mul.h +"px"; - mul.inc = 1; - } - } - - menu.onmouseout = function ( doIt, firstDoIt ) { - clearTimeout( this.timeoutOpen ); - var mul = this.mul; - if ( firstDoIt ) mul.inc = 1; - if ( doIt == true ) { - if ( mul.h > mul.minSize ) { - mul.h -= mul.inc++; - if ( mul.h < 0 ) mul.h = 0; - if ( mul.h == 0 ) mul.style.display = "none"; - if ( this.isIE ) if ( mul.h < 1 ) mul.h = 1; - mul.style.height = mul.h +"px"; - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true)", 33 ); - } else { - mul.h = mul.minSize; - mul.style.height = mul.h +"px"; - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = "0px"; - mul.inc = 2; - this.className = this.className.replace( / opened/g, "" ); - this.className += " closed" - } - } else { - // Work arround IE bug - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true, true)", 200 ); - } - } - -} diff --git a/public/javascripts/menu-config.js b/public/javascripts/menu-config.js deleted file mode 100644 index 349db61..0000000 --- a/public/javascripts/menu-config.js +++ /dev/null @@ -1,7 +0,0 @@ - -// The configurable options are seted here and can be -// replaced by specific theme scripts. - -assetsMenu = { - autoOpen : true -} diff --git a/public/javascripts/menu.js b/public/javascripts/menu.js deleted file mode 100644 index cdcc594..0000000 --- a/public/javascripts/menu.js +++ /dev/null @@ -1,129 +0,0 @@ -function prepareMenu(id, options) { - - window.menuCloseTimeout = options.timeout || 333; - - if ( document.all ) { - // add a class for work arround msie's css bugs - $(id).className += " msie"; - } - $(id).className += " menuRoot"; - - var zIndex = 10; - - $$("#" + id + " ul ul").each( function( ul ) { // para cada UL de sub-menu faça: - // Pega o link que abre este sub-menu: - var linkText = ul.parentNode.firstChild; - // Retira espaço em branco sobrando nas bordas deste: - linkText.nodeValue = linkText.nodeValue.replace( /^\s*|\s*$/g, "" ); - - // Create a link to open this sub-menu: - var link = document.createElement("a"); - link.href = "#"; - link.className = "linkSubMenu"; - linkText.parentNode.insertBefore( link, linkText ); - link.parentNode.style.zIndex = zIndex++; - link.subMenu = ul; - var span = document.createElement("span"); - span.appendChild( linkText ); - link.appendChild( span ); - ul.linkControle = link; - link.openSubMenu = - function ( isMouseClick ) { - if( this.subMenu.style.display == "block" ) { - if( isMouseClick ) { - this.subMenu.style.display = "none"; - } else { - clearTimeout(this.timeOutClose); - clearTimeout(this.subMenu.timeOutClose); - return false; - } - } else { - if ( window.openedMenu ) window.openedMenu.closeSubMenu(); - window.openedMenu = this.subMenu; - this.className += " menu-opened" - this.subMenu.style.display = "block"; - clearTimeout(this.timeOutClose); - clearTimeout(this.subMenu.timeOutClose); - } - } - link.closeSubMenu = - function(){ - this.subMenu.style.display = "none"; - //link.className = link.className.replace( / menu-opened/g, "" ); - this.className = this.className.replace( / menu-opened/g, "" ); - } - - //link.onclick = function(){ this.openSubMenu(true); return false }Is not working - - // onmouseout e onmouseover manipulam o menu para pessoas normais - // onblur e onfocus manipulam o menu para pessoas que precisam navegar com tab - - link.onmouseover = link.onfocus = - function () { - this.openSubMenu(false); - }; - link.onmouseout = link.onblur = - function () { - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); - }; - - //ul.closeSubMenu = function(){ this.style.display = "none" } - ul.closeSubMenu = function(){ this.linkControle.closeSubMenu() } - - ul.onmouseover = ul.onfocus = - function () { - this.blurCalledByIEWorkArroundBug = false; - clearTimeout(this.timeOutClose); - clearTimeout(this.linkControle.timeOutClose); - }; - ul.onmouseout = ul.onblur = - function () { - if ( this.blurCalledByIEWorkArroundBug ) { return false } - this.blurCalledByIEWorkArroundBug = true; - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); - }; - }); - - - // **** begin of workaround for Microsoft Internet Explorer **** - // MS IE sucks, BTW. - if ( document.all ) { - function forceUlFocusFromLink ( a ) { - /*var stop = false; - a.ancestors().each( function(el) { - if ( el.id == "menu" ) { stop = true } - if ( ! stop && el.onfocus ) { el.onfocus() } - } );*/ - var el = a.parentNode; - while ( / menuRoot/.test(el.className) ) el = el.parentNode; - if ( el.onfocus ) { el.onfocus() } - } - function forceUlBlurFromLink ( a ) { - /*var stop = false; - a.ancestors().each( function(el) { - if ( el.id == "menu" ) { stop = true } - if ( ! stop && el.onblur ) { el.onblur() } - } );*/ - var el = a.parentNode; - while ( / menuRoot/.test(el.className) ) el = el.parentNode; - if ( el.onblur ) { el.onblur() } - } - $$("#" + id + " ul ul a").each( function( a ) { - // os links do sub menu forçarão o foco do ul - if ( a.className == "linkSubMenu" ) { - a.onfocus = function() { - forceUlFocusFromLink(this); - this.openSubMenu(false); - }; - a.onblur = function() { - forceUlBlurFromLink(this); - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); - }; - } else { - a.onfocus = function() { forceUlFocusFromLink(this) }; - a.onblur = function() { forceUlBlurFromLink(this) }; - } - }); - } // ** end of workaround for Microsoft Internet Explorer. - -} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 8692ce6..f75edcf 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -907,7 +907,6 @@ code input { #user_menu { border: none; /* work arround IE Bug */ - background: transparent; /* work arround IE Bug */ } #user_menu_head { @@ -928,7 +927,6 @@ code input { margin-left: 4px; } #user_menu a#link_login:hover { - background: none; } #user_box a#link_go_home { -- libgit2 0.21.2