X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/blobdiff_plain/8d2bf7d06e14cdc822340b169dcab2088b25c8b9..885c700662410d28c11424a90809bc3082c0b3e9:/js/jslib.js diff --git a/js/jslib.js b/js/jslib.js index aeef5ee..c8e8664 100644 --- a/js/jslib.js +++ b/js/jslib.js @@ -260,12 +260,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 = ""; @@ -274,8 +274,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" : ""); }); }); @@ -285,10 +285,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) @@ -415,4 +416,19 @@ qwebirc.util.deviceHasKeyboard = function() { qwebirc.util.generateID_ID = 0; qwebirc.util.generateID = function() { return "qqa-" + qwebirc.util.generateID_ID++; -} \ No newline at end of file +}; + +qwebirc.util.arrayCmp = function(a, b) { + for(var p=0;p