From: Chris Porter Date: Mon, 2 Feb 2009 22:19:53 +0000 (+0000) Subject: . in nick now adds a random number. X-Git-Url: https://jfr.im/git/irc/quakenet/qwebirc.git/commitdiff_plain/05d4b0b57bef08c0356c5ea553931e480c50ea10 . in nick now adds a random number. --- diff --git a/js/qwebircinterface.js b/js/qwebircinterface.js index 100ad19..9c9e088 100644 --- a/js/qwebircinterface.js +++ b/js/qwebircinterface.js @@ -54,8 +54,8 @@ qwebirc.ui.Interface = new Class({ } if($defined(nick)) - inick = nick; - + inick = this.randSub(nick); + if(args["randomnick"] && args["randomnick"] == 1) inick = this.options.initialNickname; @@ -88,5 +88,17 @@ qwebirc.ui.Interface = new Class({ var details = ui_.loginBox(callback, inick, ichans, autoConnect, usingAutoNick); }.bind(this)); + }, + randSub: function(nick) { + var getDigit = function() { return Math.floor(Math.random() * 10); } + + return nick.split("").map(function(v) { + if(v == ".") { + return getDigit(); + } else { + return v; + } + }).join(""); + } }); diff --git a/js/ui/panes/embed.js b/js/ui/panes/embed.js index 8e7a8c3..9d4867d 100644 --- a/js/ui/panes/embed.js +++ b/js/ui/panes/embed.js @@ -1,3 +1,4 @@ +/* NEEDS converting to plain HTML! */ qwebirc.ui.EmbedWizardStep = new Class({ Implements: [Options, Events], options: { @@ -150,7 +151,7 @@ qwebirc.ui.EmbedWizard = new Class({ this.nicknameBox.addClass("text"); this.nickname = this.newStep({ "title": "Set nickname", - "first": "Enter the nickname you would like the client to use by default:", + "first": "Enter the nickname you would like the client to use by default (use a . for a random number):", "premove": function() { if(this.nicknameBox.value == "") { alert("You must supply a nickname.");