aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/js/weabot.js1
-rw-r--r--static/js/weabotxt.js32
2 files changed, 14 insertions, 19 deletions
diff --git a/static/js/weabot.js b/static/js/weabot.js
index 1f8db2e..a79834d 100644
--- a/static/js/weabot.js
+++ b/static/js/weabot.js
@@ -140,7 +140,6 @@ function expandimg(e) {
while(img_cont.lastChild) img_cont.removeChild(img_cont.lastChild);
img_cont.appendChild(new_img);
- e.preventDefault();
}
}
diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js
index 5cf205e..670ce50 100644
--- a/static/js/weabotxt.js
+++ b/static/js/weabotxt.js
@@ -7,7 +7,7 @@ var hiddenposts = Array();
function set_stylesheet(styletitle) {
var css=document.getElementById("css");
- if(css) css.href = "/static/css/txt/"+styletitle.toLowerCase()+".css";
+ if(css) css.href="/static/css/txt/"+styletitle.toLowerCase()+".css";
localStorage.setItem(style_cookie,styletitle);
}
@@ -25,15 +25,14 @@ if (!Array.prototype.indexOf) {
function getPassword() {
if (weabot.password) return weabot.password;
- var char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- var pass="";
- for (var i=0;i<8;i++) {
- var rnd = Math.floor(Math.random()*char.length);
- pass += char.substring(rnd, rnd+1);
- }
- weabot.password = pass;
+ var pass="";
+ var char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!-_.";
+ while (pass.length<10) {
+ pass += char[Math.floor(Math.random()*char.length)];
+ }
+ weabot.password = pass;
localStorage.setItem("weabot", JSON.stringify(weabot));
- return(pass);
+ return(pass);
}
function saveInputs(e) {
@@ -56,12 +55,6 @@ function setInputs(id) {
}
}
-function setPassword(id) {
- if (document.getElementById(id).password)
- with (document.getElementById(id))
- if(!password.value) password.value = getPassword("weabot_password");
-}
-
// Textboard data
function insert(text) {
var textarea=document.forms.postform.message;
@@ -210,9 +203,12 @@ document.addEventListener("DOMContentLoaded", function() {
else weabot = {"name":null,"email":null,"password":null};
board = document.body.dataset.brd;
- var b = document.getElementById("main_nav").getElementsByTagName("a");
- for(var i=0; i<b.length; i++) {
- if (b[i].getAttribute("href") == "/"+board+"/") { b[i].className = "cur_brd"; break; }
+ var main = document.getElementById("main_nav");
+ if (main) {
+ var b = main.getElementsByTagName("a");
+ for(var i=0; i<b.length; i++) {
+ if (b[i].getAttribute("href") == "/"+board+"/") { b[i].className = "cur_brd"; break; }
+ }
}
var forms = document.getElementsByTagName("form");