-
Notifications
You must be signed in to change notification settings - Fork 0
/
linkchecker-form.tag
50 lines (42 loc) · 1.57 KB
/
linkchecker-form.tag
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
<linkchecker-form>
<form onsubmit="{ submit }" style="margin-bottom: 20px;">
<div class="form-group">
<label>Website URL</label>
<input ref="websiteURL" type="url" class="form-control" placeholder="The URL of the website to check, for example 'https://www.marcobeierer.com'." disabled="{ disabled }" required>
</div>
<div class="form-group">
<label>Token</label>
<textarea ref="token" class="form-control" style="min-height: 100px" placeholder="A token is only necessary to check a website with more than 500 internal or external links or if you like to use the paid extra features." disabled="{ disabled }"></textarea>
</div>
<button class="btn btn-default" type="submit" if="{ !disabled }">Check your website</button>
<button class="btn btn-danger" onclick="{ stopCheck }" if="{ disabled }">Stop website check</button>
</form>
<script>
var self = this;
self.disabled = false;
self.on('mount', function() {
if (opts.websiteUrl != undefined) {
this.refs.websiteURL.value = opts.websiteUrl;
}
if (opts.token != undefined) {
this.refs.token.value = opts.token;
opts.linkchecker.trigger('token-loaded', this.refs.token.value);
}
});
submit(e) {
e.preventDefault();
opts.linkchecker.trigger('start', this.refs.websiteURL.value, this.refs.token.value);
}
stopCheck(e) {
e.preventDefault();
opts.linkchecker.trigger('stop');
}
opts.linkchecker.on('started', function() {
self.disabled = true;
});
opts.linkchecker.on('stopped', function() {
self.disabled = false;
self.update();
});
</script>
</linkchecker-form>