Skip to content

Commit

Permalink
made unlink its own html element
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoung19 committed Nov 27, 2020
1 parent 28b36bf commit 0e9f27c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
9 changes: 9 additions & 0 deletions css/welcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ body {
margin-bottom: 0px;
}

#unlink
{
font-family: "Norwester", "Helvetica Neue", "Lucida Grande", sans-serif;
font-size: 1.1em;
font-weight: normal !important;
color: green !important;
margin-bottom: 0px;
}

p
{
color: white !important;
Expand Down
20 changes: 10 additions & 10 deletions scripts/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ $("#hook_button").on('click', ()=>{
}
});

$("#unlink a").on('click', () => {
unlink_repo();
$("#unlink").hide();
$("#success").hide();
});

/* Detect mode type */
chrome.storage.sync.get("mode_type", data=>{
const mode = data.mode_type;
Expand Down Expand Up @@ -200,12 +206,9 @@ var link_repo = (token, name)=>{
/* Change mode type to commit */
chrome.storage.sync.set({"mode_type": "commit"}, data=>{
$("#error").hide();
$("#success").html(`Successfully linked <a target="blank" href="${res['html_url']}">${name}</a> to LeetHub. Start <a href="http://leetcode.com">LeetCoding</a> now! <br /> Linked the wrong repo? <a id="unlink">Unlink</a>.`);
$("#unlink").on('click', () => {
unlink_repo();
$("#success").hide();
});
$("#success").html(`Successfully linked <a target="blank" href="${res['html_url']}">${name}</a> to LeetHub. Start <a href="http://leetcode.com">LeetCoding</a> now!`);
$("#success").show();
$("#unlink").show();
});
/* Set Repo Hook */
chrome.storage.sync.set({"leethub_hook": res['full_name']}, data=>{
Expand Down Expand Up @@ -315,12 +318,9 @@ var status_code = (res, status, name)=>{
/* Change mode type to commit */
chrome.storage.sync.set({"mode_type": "commit"}, data=>{
$("#error").hide();
$("#success").html(`Successfully created <a target="blank" href="${res['html_url']}">${name}</a>. Start <a href="http://leetcode.com">LeetCoding</a>! <br /> Linked the wrong repo? <a id="unlink">Unlink</a>.`);
$("#unlink").on('click', () => {
unlink_repo();
$("#success").hide();
});
$("#success").html(`Successfully created <a target="blank" href="${res['html_url']}">${name}</a>. Start <a href="http://leetcode.com">LeetCoding</a>!`);
$("#success").show();
$("#unlink").show();
/* Show new layout */
document.getElementById("hook_mode").style.display = "none";
document.getElementById("commit_mode").style.display = "inherit";
Expand Down
3 changes: 3 additions & 0 deletions welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<br><br><br><br><br><br><br><br>
<p hidden id="error"></p>
<p hidden id="success"></p>
<p hidden id="unlink">
Linked the wrong repo? <a>Unlink</a>.
</p>
</div>

<!-- Create Hook -->
Expand Down

0 comments on commit 0e9f27c

Please sign in to comment.