Skip to content

Commit 53d57ab

Browse files
committed
added shortcut buttons
1 parent 1c138ff commit 53d57ab

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

public/css/sas.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313
.ui-autocomplete li:hover {
1414
background-color: #ccc;
1515
}
16-
.ui-helper-hidden-accessible { display:none; }
16+
.ui-helper-hidden-accessible { display:none; }
17+
18+
.group-gap { margin-left:50px;}

public/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@
5454
<div class="panel panel-default">
5555
<div class="panel-heading">
5656
Add an index from URL
57+
58+
<div class="btn-group group-gap">
59+
<button type="button" class="btn btn-info btn-shortcut" data-url="https://raw.githubusercontent.com/glynnbird/simple-autocomplete-service/master/data/countries.txt" data-name="countries">Countries (194)</button>
60+
</div>
61+
<div class="btn-group">
62+
<button type="button" class="btn btn-info btn-shortcut" data-url="https://raw.githubusercontent.com/glynnbird/simple-autocomplete-service/master/data/uktowns.txt" data-name="towns">UK Towns (992)</button>
63+
</div>
64+
<div class="btn-group">
65+
<button type="button" class="btn btn-info btn-shortcut" data-url="https://raw.githubusercontent.com/glynnbird/simple-autocomplete-service/master/data/uspresidents.txt" data-name="presidents">US Presidents (43)</button>
66+
</div>
67+
<div class="btn-group">
68+
<button type="button" class="btn btn-info btn-shortcut" data-url="https://raw.githubusercontent.com/glynnbird/simple-autocomplete-service/master/data/names.txt" data-name="names">Names (4995)</button>
69+
</div>
5770
</div>
5871
<div class="panel-body">
5972
<form id="submiturlform" class="form" action="/api/uploadurl" method="post" enctype="multipart/form-data">

public/js/sas.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ $(function() {
9292
$('#uploadform').submit( function(e) {
9393
e.preventDefault();
9494
var name = $('#name').val() || "";
95+
$('#submitbutton').prop("disabled", true);
9596
submitTheForm(this, name, function(err, data) {
9697
if (err) {
9798
alert(err);
@@ -108,6 +109,7 @@ $(function() {
108109
$('#submiturlform').submit( function(e) {
109110
e.preventDefault();
110111
var name = $('#urlname').val() || "";
112+
$('#submiturlbutton').prop("disabled", true);
111113
submitTheForm(this, name, function(err, data) {
112114
if (err) {
113115
alert(err);
@@ -118,4 +120,12 @@ $(function() {
118120
$('#submiturlbutton').prop("disabled", false);
119121
});
120122
});
123+
124+
$('.btn-shortcut').on('click', function() {
125+
var url = this.getAttribute("data-url");
126+
var name = this.getAttribute("data-name");
127+
$('#urlname').val(name);
128+
$('#url').val(url);
129+
})
130+
121131
});

0 commit comments

Comments
 (0)