add format setting javascript

pull/1/head
eric 2016-08-26 12:27:48 -04:00
parent d1951bab75
commit dcda9f8f89
1 changed files with 20 additions and 0 deletions

View File

@ -6,7 +6,27 @@
<link rel="stylesheet" href="/static/css/ui-lightness/jquery-ui-1.8.16.custom.css" type="text/css" media="screen"> <link rel="stylesheet" href="/static/css/ui-lightness/jquery-ui-1.8.16.custom.css" type="text/css" media="screen">
<script type="text/javascript" src="{{ jquery_ui_home }}" ></script> <script type="text/javascript" src="{{ jquery_ui_home }}" ></script>
<script type="text/javascript">
onload = function(){
var urlInput = document.getElementById('id_url');
var formatInput = document.getElementById('id_format');
urlInput.oninput = function(){
if(urlInput.value.endsWith('.pdf')){
formatInput.value = 'pdf'
}
else if(urlInput.value.endsWith('.epub')){
formatInput.value = 'epub'
}
else if(urlInput.value.endsWith('.mobi')){
formatInput.value = 'mobi'
}
else if(urlInput.value.endsWith('.html')){
formatInput.value = 'html'
};
};
};
</script>
{% endblock %} {% endblock %}
{% block doccontent %} {% block doccontent %}