-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathVote.html
131 lines (93 loc) · 3.81 KB
/
Vote.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!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>
<div class="container">
<div class="col-md-6">
<a href="{{Post.Link}}">{{Post.Title}}</a>
</div>
<form id="Vote">
<div class="col-md-3">
{% if LoggedIn == True %}
<input type="hidden" name="Key" value="{{Post.Key}}">
<select name="Tag">
<option value="{{Vote.ScanKey}}">{{Vote.Scan}}</option>
{% for aFilter in Filter %}
<option value="{{aFilter.ScanKey}}">{{aFilter.Scan}}</option>
{% endfor %}
</select>
{% endif %}
</div>
<div class="col-md-3">{% if LoggedIn == True %}<input type="submit">{% endif %}</form></div>
<br><br>
</div>
<div class="container">
<div class="col-md-3"><a href="{{Post.Link}}" target=_parent>Full Screen</a></div>
{% if LoggedIn == True %}
<div class="col-md-3"><a href="/Tag?Key={{Post.Key}}" target=_parent>Create Tag</a></div>
<div class="col-md-3" id="removeMeText"><a onclick="removeTag('{{Vote.ScanKey}}','{{Post.Key}}')" href="javascript:void(0);">Not {{Vote.Scan}}</a></div>
{% endif %}
{% if LoggedIn == False %}
<div class="col-md-3"></div>
<div class="col-md-3"></div>
{% endif %}
<div class="col-md-3">
{% if LoggedIn == False %}<a href="/Login?Key={{Post.Key}}" target=_parent>Login</a>{% endif %}
{% if LoggedIn == True %}<a href="{{Logout}}" target=_parent>Log Out</a>{% endif %}
</div>
</div>
<br>
<script>
function removeTag(theTag,theKey){
$.ajax({
type: 'POST',
url: "/removeTag",
data: {
Key:theKey,
Tag:theTag,
},
}).done(function(data) {
$('#removeMeText').text(data);
})
}
$( "#Vote" ).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 %}