Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Issue #8 home page form #38

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,18 @@ nav ul li a, nav ul li span, header .action { display: block; padding: 0.5rem; }
right: 0;
border: 0;
z-index: 42;
}

#notebookUrl{
font-size: 18px;
width: 90%;
}

#submitUrlButton{
font-size: 18px;
background-color:#cae6f6;
}

#redirectToUrlForm{
margin:1em;
}
23 changes: 22 additions & 1 deletion src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,28 @@ <h2><a href="#idea">Idea</a></h2>


<h2><a href="#how">How</a></h2>
Just replace <code>https://github.com/</code> with <code>http://tf2up.ml</code>.
Just copy and paste the ipynd notebook's url here
<form id="redirectToUrlForm" onsubmit="redirectToUrlFromInput(event)">
<input id="notebookUrl" type="text">
<button id="submitUrlButton" type="submit">Convert</button>
</form>
<script>
function redirectToUrlFromInput(event){
event.preventDefault();
hostUrl = location.port.toString().length > 0 ? location.protocol+location.hostname +':'+ location.port : location.protocol+location.hostname ;
parsedUrl = document.getElementById("notebookUrl").value.toString();
if(parsedUrl.match(/.*github\.com\/(.*)/) !== null){
var notebookUrl = parsedUrl.replace(/.*github\.com\/(.*)/,hostUrl+'/\$1');
console.log(notebookUrl);
window.location.href = notebookUrl;
}else{
alert("Please provide a GitHub url");
}


}
</script>
Or just replace <code>https://github.com/</code> with <code>http://tf2up.ml</code>.
For example, you would like to upgrade
<code class="scrollable">http://github.com/tensorflow/docs/blob/master/site/en/tutorials/keras/save_and_restore_models.ipynb</code>
you would need to replace url to
Expand Down