forked from aterhaar/ArticleBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.html
92 lines (66 loc) · 2.74 KB
/
Main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
{% autoescape true %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Article Search</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
{% for aPost in Posts %}
<div class="container">
<div class="col-md-6">
<a href="{{aPost.Link}}">{{aPost.Title}}</a>
</div>
<form id="{{aPost.Key}}">
<div class="col-md-3">
<input type="hidden" name="Key" value="{{aPost.Key}}">
<select name="Tag">
<option value="{{aPost.Scan}}">{{aPost.Scan}}</option>
{% for aFilter in Filter %}
<option value="{{aFilter.code}}">{{aFilter.Name}}</option>
{% endfor %}
</select>
</div>
<div class="col-md-3"><input type="submit"></form></div>
<br><br>
</div>
<br>
{% endfor %}
<script>
$( "form" ).submit(function( event ) {
event.preventDefault();
//var $inputs = $('#aPost.Key :input');
// not sure if you wanted this, but I thought I'd add it.
// get an associative array of just the values.
var a1 = event.target[0].value;
var arrayMaxLength = event.target[1].length
var a2
for (var index = 0; index<arrayMaxLength; index++){
a2 = event.target[1][index];
if (a2.selected==true){
a2 = a2.text
break;
}
}
//var v1 = $( "input:first" ).val()
//var v2 = $( "select:first" ).val()
$.ajax({
type: 'POST',
url: "/addTag",
data: {
Key:a1,
Tag:a2,
},
}).done(function(data) {
})
});
</script>
{% endautoescape %}