tinycm annotate lib/functions.js @ rev 60

Improve dashboard and plugin integration
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 01 01:28:51 2014 +0100 (2014-02-01)
parents 7914154807bb
children d6f01c5019bb
rev   line source
pankso@4 1
paul@8 2 // Insert HTML code into editor text area.
pankso@4 3 function addCode(code) {
pankso@4 4 document.forms["editor"]["content"].value =
pankso@4 5 document.forms["editor"]["content"].value += code;
pankso@4 6 document.forms["editor"]["content"].focus();
pankso@4 7 }
pankso@4 8
pankso@4 9 // Check form to avoid empty values and bad email.
pankso@4 10 function checkSignup() {
pankso@4 11 if(document.forms["signup"]["name"].value == "")
pankso@4 12 {
pankso@4 13 alert("Please enter your real name");
pankso@4 14 document.forms["signup"]["name"].focus();
pankso@4 15 return false;
pankso@4 16 }
pankso@4 17 if(document.forms["signup"]["user"].value == "")
pankso@4 18 {
pankso@4 19 alert("Please fill in your user name");
pankso@4 20 document.forms["signup"]["user"].focus();
pankso@4 21 return false;
pankso@4 22 }
pankso@4 23 var x=document.forms["signup"]["mail"].value;
pankso@4 24 var atpos=x.indexOf("@");
pankso@4 25 var dotpos=x.lastIndexOf(".");
pankso@4 26 if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
pankso@4 27 {
pankso@4 28 alert("Missing or not a valid email address");
pankso@4 29 return false;
pankso@4 30 }
pankso@4 31 }