diff options
author | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2011-05-23 19:58:54 +0100 |
---|---|---|
committer | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2011-05-23 19:58:54 +0100 |
commit | 6a94c5de94b8755fe21babd4f854a7106dd157c8 (patch) | |
tree | 75770f0622a96c44d65dfeea418163589aa8ba9e /static/index.html | |
parent | 3cef5e4b232c127f12d35b77192c1f7192260405 (diff) | |
download | etherpad-lite-6a94c5de94b8755fe21babd4f854a7106dd157c8.zip |
Create random pad name on the client side, this makes it possible to use it with ep-lite with https
Diffstat (limited to 'static/index.html')
-rw-r--r-- | static/index.html | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/static/index.html b/static/index.html index 3526be1b..7eec0266 100644 --- a/static/index.html +++ b/static/index.html @@ -55,21 +55,38 @@ } </style> <script type="text/javascript"> - function go() + function go2Name() { var padname = document.getElementById("padname").value; if(padname.length > 0) { - window.location = "http://" + window.location.host + "/p/" + padname; + window.location = window.location.protocol + "//" + window.location.host + "/p/" + padname; } } + + function go2Random() + { + window.location = window.location.protocol + "//" + window.location.host + "/p/" + randomPadName() ; + } + + function randomPadName() + { + var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; + var string_length = 10; + var randomstring = ''; + for (var i=0; i<string_length; i++) { + var rnum = Math.floor(Math.random() * chars.length); + randomstring += chars.substring(rnum,rnum+1); + } + return randomstring; + } </script> </head> <body> <div id="wrapper"> - <a href="/newpad" id="button"><span>New Pad</span></a> + <a href="javascript:go2Random()" id="button"><span>New Pad</span></a> <div id="nameWrapper"><form> - <span><br>or create a Pad with the name <br></span> <input type="text" id="padname"/> <input type="submit" value="OK" onclick="go();return false;"> + <span><br>or create a Pad with the name <br></span> <input type="text" id="padname"/> <input type="submit" value="OK" onclick="go2Name();return false;"> </form></div></a> </div> </body> |