Implemented feedback and moved JS to a file.

See https://fc.oscp.info/display/beanow/245480
This commit is contained in:
Beanow 2015-02-25 14:58:50 +01:00
parent a54e512669
commit 6becf45e73
5 changed files with 19 additions and 9 deletions

15
assets/js/main.js Normal file
View File

@ -0,0 +1,15 @@
jQuery(function($){
//Mobile menu, hamburger button.
$('body').on('click', '.hamburger', function(e){
e.preventDefault();
$('nav#links').toggleClass('open');
});
//Forces the reset to empty the search field, not reset it to the PHP given value.
$('.search-wrapper').on('click', '.reset', function(e){
e.preventDefault();
$(e.target).closest('.search-wrapper').find('.search-field').val('');
});
});

View File

@ -133,6 +133,7 @@ nav#links a{
}
nav#links a,
.sub-menu-outer a,
.profiles a{
text-decoration:none;
}

View File

@ -6,11 +6,4 @@
<a href="/stats">Stats</a>
<a href="/help">Help</a>
</div>
</nav>
<script type="text/javascript">
jQuery('.hamburger').on('click', function(e){
e.preventDefault();
jQuery('nav#links').toggleClass('open');
})
</script>
</nav>

View File

@ -1,6 +1,6 @@
<form action="/search" method="get" class="search-form">
<div class="search-wrapper">
<input class="search-field" type="text" name="query" placeholder="<?php echo $query ? $query : 'Search your friends'; ?>" tabindex="1" autofocus />
<input class="search-field" type="text" name="query" placeholder="Search your friends" tabindex="1" value="<?php echo $query; ?>" />
<input class="reset" type="reset" value="&#xf00d;" tabindex="3" />
<input class="search" type="submit" value="Search" tabindex="2" />
</div>

View File

@ -14,6 +14,7 @@
<link href="/assets/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="/assets/js/main.js"></script>
</head>
<body>
<?php if(isset($topBar)) echo $topBar; ?>