X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/d8b8b93720f3697577449531fa2a2ac6e2411da5..2126d43f70fbd806109bb80d7e133d75fac1c6c2:/js/jslib.js diff --git a/js/jslib.js b/js/jslib.js index 2d2d5fe..1094ff2 100644 --- a/js/jslib.js +++ b/js/jslib.js @@ -264,12 +264,12 @@ qwebirc.util.importJS = function(name, watchFor, onload) { qwebirc.util.createInput = function(type, parent, name, selected, id) { var created = false; var r; - if(name) + if (name) name = "__input" + name; - if(Browser.Engine.trident) { + if (Browser.Engine.trident) { var name2; - if(name) { + if (name) { name2 = " name=\"" + escape(name) + "\""; } else { name2 = ""; @@ -278,8 +278,8 @@ qwebirc.util.createInput = function(type, parent, name, selected, id) { var h = ""; r = $(document.createElement(h)); if (type == "radio") { - r.addEvent("click", function() { - $(document.body).getElements("input[name=" + name + "]").forEach(function(x) { + r.addEvent("click", function () { + $(document.body).getElements("input[name=" + name + "]").forEach(function (x) { x.setAttribute("defaultChecked", x.checked ? "defaultChecked" : ""); }); }); @@ -289,10 +289,11 @@ qwebirc.util.createInput = function(type, parent, name, selected, id) { /* fallthough, trying it the proper way... */ } } - if(!created) - r = new Element("input"); - r.setAttribute("type", type); + if(!created) { + r = new Element("input"); + r.setAttribute("type", type); + } if(name) r.setAttribute("name", name); if(id) @@ -419,7 +420,22 @@ qwebirc.util.deviceHasKeyboard = function() { qwebirc.util.generateID_ID = 0; qwebirc.util.generateID = function() { return "qqa-" + qwebirc.util.generateID_ID++; -} +}; + +qwebirc.util.arrayCmp = function(a, b) { + for(var p=0;p