// Generate a random string of the specified length
// Useful for generating one-time-use div names
-function randomString(length) {
- var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz'.split('');
- var str = '';
-
- if (!length) {
- length = Math.floor(Math.random() * chars.length);
- }
- for (var i = 0; i < length; i++) {
- str += chars[Math.floor(Math.random() * chars.length)];
- }
- return str;
+function randomString() {
+ return Math.random().toString(36).replace('0.','ctdl_' || '');
}
if (msgs.length > messages_per_page) {
msgs = msgs.slice(msgs.length - messages_per_page);
}
- new_old_div_name = randomString(10);
+ new_old_div_name = randomString();
if (msgs.length < 1) {
newlt = lt_msg;
}
}
// The messages will go here.
- let msgs_div_name = randomString(10);
+ let msgs_div_name = randomString();
target_div.innerHTML += "<div id=\"" + msgs_div_name + "\"> </div>" ;
if (lt_msg == 9999999999) {
- new_new_div_name = randomString(10);
+ new_new_div_name = randomString();
if (msgs.length <= 0) {
newgt = gt_msg;
}
function forum_render_one(msg) {
let div = document.createElement("div");
- mdiv = randomString(10); // div name for this message
+ mdiv = randomString(); // div name for this message
div.id = mdiv;
try {
// Open a reply box directly below a specific message
function open_reply_box(parent_div, is_quoted, references, msgid) {
let new_div = document.createElement("div");
- let new_div_name = randomString(10);
+ let new_div_name = randomString();
new_div.id = new_div_name;
document.getElementById(parent_div).append(new_div);
+ "/dummy_name_for_new_message"
+ "?wefw=" + wefw
+ "&subj=" + subj
- boundary = randomString(20);
+ boundary = randomString();
body_text =
"--" + boundary + "\r\n"
+ "Content-type: text/html\r\n"