add js to hide nav-menus, when clicked outside

This commit is contained in:
tommy tomson 2012-03-09 18:15:27 +01:00
parent 9f441731af
commit 8fe4645a5d
5 changed files with 134 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 501 B

View file

@ -0,0 +1,66 @@
<?php
/*
* Name: Diabook
* Description: Diabook: report bugs and request here: http://pad.toktan.org/p/diabook or contact me : thomas_bierey@friendica.eu
* Version:
* Author:
*/
$a->theme_info = array(
'extends' => 'diabook',
);
$a->page['htmlhead'] .= <<< EOT
<script>
//contacts
$('html').click(function() {
$('#nav-contacts-linkmenu').removeClass('selected');
document.getElementById( "nav-contacts-menu" ).style.display = "none";
});
$('#nav-contacts-linkmenu').click(function(event){
event.stopPropagation();
});
//messages
$('html').click(function() {
$('#nav-messages-linkmenu').removeClass('selected');
document.getElementById( "nav-messages-menu" ).style.display = "none";
});
$('#nav-messages-linkmenu').click(function(event){
event.stopPropagation();
});
//notifications
$('html').click(function() {
$('#nav-notifications-linkmenu').removeClass('selected');
document.getElementById( "nav-notifications-menu" ).style.display = "none";
});
$('#nav-notifications-linkmenu').click(function(event){
event.stopPropagation();
});
//usermenu
$('html').click(function() {
$('#nav-user-linkmenu').removeClass('selected');
document.getElementById( "nav-user-menu" ).style.display = "none";
});
$('#nav-user-linkmenu').click(function(event){
event.stopPropagation();
});
//settingsmenu
$('html').click(function() {
$('#nav-site-linkmenu').removeClass('selected');
document.getElementById( "nav-site-menu" ).style.display = "none";
});
$('#nav-site-linkmenu').click(function(event){
event.stopPropagation();
});
</script>
EOT;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 501 B

View file

@ -26,6 +26,7 @@
<li id="nav-contacts-all"><a href="contacts">$nav.contacts.1</a></li>
</ul>
</li>
{{ endif }}
{{ if $nav.messages }}
@ -145,6 +146,7 @@
<ul id="nav-notifications-template" style="display:none;" rel="template">
<li class="{4}"><a href="{0}"><img src="{1}">{2} <span class="notif-when">{3}</span></a></li>
</ul>

66
view/theme/diabook/theme.php Executable file
View file

@ -0,0 +1,66 @@
<?php
/*
* Name: Diabook
* Description: Diabook: report bugs and request here: http://pad.toktan.org/p/diabook or contact me : thomas_bierey@friendica.eu
* Version:
* Author:
*/
$a->theme_info = array(
'extends' => 'diabook',
);
$a->page['htmlhead'] .= <<< EOT
<script>
//contacts
$('html').click(function() {
$('#nav-contacts-linkmenu').removeClass('selected');
document.getElementById( "nav-contacts-menu" ).style.display = "none";
});
$('#nav-contacts-linkmenu').click(function(event){
event.stopPropagation();
});
//messages
$('html').click(function() {
$('#nav-messages-linkmenu').removeClass('selected');
document.getElementById( "nav-messages-menu" ).style.display = "none";
});
$('#nav-messages-linkmenu').click(function(event){
event.stopPropagation();
});
//notifications
$('html').click(function() {
$('#nav-notifications-linkmenu').removeClass('selected');
document.getElementById( "nav-notifications-menu" ).style.display = "none";
});
$('#nav-notifications-linkmenu').click(function(event){
event.stopPropagation();
});
//usermenu
$('html').click(function() {
$('#nav-user-linkmenu').removeClass('selected');
document.getElementById( "nav-user-menu" ).style.display = "none";
});
$('#nav-user-linkmenu').click(function(event){
event.stopPropagation();
});
//settingsmenu
$('html').click(function() {
$('#nav-site-linkmenu').removeClass('selected');
document.getElementById( "nav-site-menu" ).style.display = "none";
});
$('#nav-site-linkmenu').click(function(event){
event.stopPropagation();
});
</script>
EOT;