-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocumentation_scripts
31 lines (27 loc) · 1.33 KB
/
documentation_scripts
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
<script>
document.addEventListener("DOMContentLoaded", function(event) {
"use strict";
function display (u32) {return ("0000000" + u32.toString (16)).substr (-8);}
function generate_id_unadorned () {
var array = new Uint32Array (2);
window.crypto.getRandomValues (array);
return display (array [0]) + display (array [1]);
}
function generate_id () {
return "(0x" + generate_id_unadorned () + ")";
}
function replace_id_boxes() {
$(".random_ids").each (function (element) {
$(this).html ("Here are some good random IDs you can use. They are regenerated whenever you load the page or copy one:<br/><pre>ColumnId" + generate_id() + "<br/>ColumnId" + generate_id() + "<br/>ColumnId" + generate_id() + "<br/>EventId" + generate_id() + "<br/>EventId" + generate_id() + "<br/>EventId" + generate_id() + "<br/>PredictorId" + generate_id() + "<br/>PredictorId" + generate_id() + "<br/>PredictorId" + generate_id()+"</pre>");
});
$(".inline_random_id").each (function (element) {
$(this).html (", e.g. <code>" + $(this).data ("idtype") + generate_id() + "</code>");
});
$("span.number:contains('defacab1e_bad_1d')").each (function (element) {
$(this).text($(this).text().replace ('defacab1e_bad_1d', generate_id_unadorned()));
});
}
replace_id_boxes();
document.addEventListener("copy", function() {window.setTimeout (replace_id_boxes,30)});
});
</script>