You can now paste GitHub URLs in the search box

This commit is contained in:
Matthieu Napoli
2014-09-19 15:49:46 +12:00
parent 66708122b7
commit b8f5eaec72
2 changed files with 9 additions and 0 deletions

View File

@@ -34,6 +34,10 @@
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<form id="search">
<p>
Paste a GitHub project URL, or the repository ("user/repository"):
</p>
<div class="form-group input-group input-group-lg">
<input id="search-input" type="text" class="form-control" placeholder="user/repository">
<span class="input-group-btn">

View File

@@ -9,6 +9,11 @@ jQuery(function ($) {
var repository = $(this).find('#search-input').val();
if (repository.indexOf('https://github.com/') !== -1) {
repository = repository.slice('https://github.com/'.length);
console.log(repository);
}
if (repository.length === 0 || repository.indexOf('/') === -1) {
$(this).find('.alert-warning').show();
return;