This repository has been archived by the owner on Sep 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfields.html
74 lines (63 loc) · 2.99 KB
/
fields.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
<script type="text/javascript">
function bufferCounter(textarea) {
var countField = document.getElementById('buffer-counter');
var maxlimit = 256;
if (textarea.value.length > maxlimit) {
countField.className = 'exceeding';
} else {
countField.className = '';
}
subTotal = maxlimit - textarea.value.length;
// Update counter for [url] reference
urlRef = textarea.value.match(/\[url\]/i);
if (urlRef != null && urlRef.length > 0) {
// As we add the url explicitly, we add back the 24 characters of the url
// in the count
subTotal += 24;
subTotal -= ( 24 - 5 ) * urlRef.length;
}
// Update counter for [orig] reference
origRef = textarea.value.match(/\[orig\]/i);
if (origRef != null && origRef.length > 0) {
subTotal -= ( 24 - 5 ) * origRef.length;
}
countField.innerHTML = subTotal + ' chars left';
}
function appendText(str) {
var textarea = document.getElementById('buffer-text');
textarea.value = textarea.value + str;
bufferCounter(textarea);
}
function appendElementValueById(id) {
var val = document.getElementById(id).value;
appendText(val);
}
</script>
<fieldset>
<legend>Buffer</legend>
<label for="buffer-text"><i>Text <small>(link is appended at the end of the text or via [url])</small></i></label>
<div class="buffer-text">
<textarea id="buffer-text" oninput="bufferCounter(this)" name="lf_buffer_text" rows="4" cols="25"></textarea>
<span id="buffer-counter"></span>
</div>
<div class="buffer-helpers">
<button type="button" onclick="appendElementValueById('lf_description');appendText(' — ');appendElementValueById('lf_title');appendText(' [url]');"><em>d - t u</em></button>
<button type="button" onclick="appendElementValueById('lf_title')">title</button>
<button type="button" onclick="appendElementValueById('lf_description')">description</button>
<button type="button" onclick="appendText(' [url]')">url</button>
<button type="button" onclick="appendText(' /via [orig]')">via</button>
<button type="button" onclick="appendText('… ')">…</button>
<button type="button" onclick="appendText(' — ')">—</button>
<button type="button" onclick="appendText('« ')">«</button>
<button type="button" onclick="appendText(' »')">»</button>
</div>
<label><i>Share strategy</i></label>
<div class="buffer-strategies">
<label><input type="radio" name="lf_buffer_strategy" value="schedule" class="lf_input"> schedule</label>
<label><input type="radio" name="lf_buffer_strategy" value="schedule_top" class="lf_input"> schedule on top</label>
<label><input type="radio" name="lf_buffer_strategy" value="now" class="lf_input"> now</label>
<label><input type="radio" name="lf_buffer_strategy" value="rand1h" class="lf_input"> ± 1 hour</label>
<label><input type="radio" name="lf_buffer_strategy" value="rand4h" class="lf_input"> ± 4 hours</label>
<label><input type="radio" name="lf_buffer_strategy" value="ignore" checked="checked" class="lf_input"> ignore</label>
</div>
</fieldset>