From f9547b6dc8a90ec32b5f35eb68f3c9f99b359cd1 Mon Sep 17 00:00:00 2001 From: Kload Date: Wed, 23 Oct 2013 11:01:14 +0000 Subject: [PATCH] Panel bugfixes --- access.lua | 5 +++- conf.json | 21 +---------------- portal/panel.ms | 63 ++++++++++++++++++++++++------------------------- 3 files changed, 36 insertions(+), 53 deletions(-) diff --git a/access.lua b/access.lua index 4c24df7..711b1d6 100644 --- a/access.lua +++ b/access.lua @@ -130,7 +130,10 @@ end function set_headers (user) user = user or ngx.var.cookie_SSOwAuthUser - if not cache[user] or not cache[user]["mail"] then + if not cache[user] then + cache[user] = {} + end + if not cache[user]["mail"] then ldap = lualdap.open_simple("localhost") for dn, attribs in ldap:search { base = "uid=".. user ..",ou=users,dc=yunohost,dc=org", diff --git a/conf.json b/conf.json index 203d6e0..0967ef4 100644 --- a/conf.json +++ b/conf.json @@ -1,20 +1 @@ -{ - "portal_scheme": "https", - "portal_domain": "mydomain.com", - "portal_path": "/ssowat/", - "domains": [ - "mydomain.com", - "myotherdomain.com" - ], - "skipped_urls": [ - "mydomain.com/megusta", - "myotherdomain.com/somuchwin" - ], - "unprotected_urls": ["mydomain.com/yunoprotect"], - "additional_headers": { - "Auth-User": "uid", - "Remote-User": "uid", - "Email": "mail", - "Name": "cn" - } -} +{} diff --git a/portal/panel.ms b/portal/panel.ms index 8608c39..d63fb6c 100644 --- a/portal/panel.ms +++ b/portal/panel.ms @@ -20,6 +20,8 @@ var ynh = {}; ynh.jquery = jQuery.noConflict(); (function( $ ) { + preventFire = false; + preventRefire = false; function datScroll(to) { preventRefire = true; $("body,html").animate({scrollTop:to}, '100', 'swing', function() { @@ -30,15 +32,15 @@ ynh.jquery = jQuery.noConflict(); $("#ynhtoggle").removeClass("ynhopen"); } preventRefire = false; - }, 300); + }, 200); }); } - preventRefire = false; function checkScroll (direction) { if(preventRefire) return; if((direction == "top") && ($("body").scrollTop() == 107 || $("html").scrollTop() == 107) && $("#ynhtoggle.ynhopen").length == 0) { + if(preventFire) return; datScroll(0); } else if((direction == "bottom") && $("#ynhtoggle.ynhopen").length > 0) { datScroll(h); @@ -46,42 +48,39 @@ ynh.jquery = jQuery.noConflict(); } $( document ).ready(function($) { - scroll = $("body").scrollTop(); h = 107; - $('body').children().filter(function() { - return $(this).css("position") === 'absolute' || $(this).css("position") === 'fixed'; - }).css({top: function(index, value) { - return parseFloat(value) + h + 3; - }}); - if ($(window).height() > $("html").height()) { - alert('moualé'); - $("html").css('min-height', $(window).height() + h ); - } - $("body").append('
YunoHost
'); - $("body").css({marginTop: function(index, value) { - return parseFloat(value) + h + 3; - }}); - if (scroll == 0) { - $("body,html").animate({scrollTop:h}, '100', 'swing', function() { - setTimeout(function() { - $("#ynhtoggle").removeClass("ynhopen"); - }, 300); - //window.scrollTo(0, h); - }); - } - $("#ynhtoggle").on("click", function() { - if ($("body").scrollTop() == 0 && $("html").scrollTop() == 0) { - datScroll(h); - } else { - datScroll(0); - } - }); $("#glu").load(function() { + + setTimeout(function() { + $('body').children().filter(function() { + return $(this).css("position") === 'absolute' || $(this).css("position") === 'fixed'; + }).css({top: function(index, value) { + return parseFloat(value) + h + 3; + }}); + $("body").append('
YunoHost
'); + $("body").css({marginTop: function(index, value) { + return parseFloat(value) + h + 3; + }}); + if ($("body").scrollTop() == 0) { + $("body,html").scrollTop(h); + $("#ynhtoggle").removeClass("ynhopen"); + } + $("#ynhtoggle").on("click", function() { + preventFire = false; + checkScroll("bottom"); + checkScroll("top"); + }); + }, 10); + $( $(this)[0].contentWindow ).bind("DOMMouseScroll mousewheel scroll", function(event) { - if (event.currentTarget.scrollY > 0) { + if ((event.type == "DOMMouseScroll" && event.originalEvent.detail > 0) + || (event.type == "mousewheel" && event.originalEvent.wheelDeltaY < 0) + || event.currentTarget.scrollY > 0 ) { checkScroll("bottom"); + preventFire = true; } else { + setTimeout(function() { preventFire = false; }, 200); checkScroll("top"); } });