Skip to content

Commit

Permalink
allowing username/repo and trimming whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMyst committed Jun 3, 2020
1 parent b674493 commit cfd45b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ window.addEventListener("load", async () =>

document.querySelector(".url-input input[type=button]").addEventListener("click", async () =>
{
let url = document.getElementById("repo-url").value;
let url = document.getElementById("repo-url").value.trim();

let match = /https:\/\/(?:www\.)?github\.com\/(.*?)\/(.*?)(?:\/|\?|$)/.exec(url);
let match = /(?:https:\/\/(?:www\.)?github\.com\/)?(.*?)\/(.*?)(?:\/|\?|$)/.exec(url);

if (match)
{
Expand Down
2 changes: 1 addition & 1 deletion templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<p class="description">don't know what issue to work on next? we'll pick a random one for you, just enter the repo url (works only for public repos).</p>

<div class="url-input">
<input type="text" name="repo-url" id="repo-url" placeholder="repo url">
<input type="text" name="repo-url" id="repo-url" placeholder="repo url or username/repo">
<input type="button" value="fetch a random issue">
</div>

Expand Down

0 comments on commit cfd45b2

Please sign in to comment.