Post by Peter on Oct 29, 2004 10:29:16 GMT
Code created by fla5hba5h[/color]
Anyways, here's the code:
main footers
Configuration
var max_sig_height=200 // the maximum height
var max_sig_width=400 // the maximum width
Edit those lines in the code. The comments and variable names should be pretty self-explanatory. No quotes please.
The "Change Profile" button will be disabled until the user clicks the "Check Signature" button. (unless of course, a signature image doesn't meet the requirements)
If an image in the signature doesn't exist, an alert box will pop up.
If the image is too big, an alert box will pop up. It might be different if the width isn't within the limits.
this was a request.
Please tell me if it doesn't work.
Anyways, here's the code:
<script>
/*
* Signature Limitations
* by Fla5hba5H
* http://www.fla5hba5h.tk
* Main Footers
* Please don't post this code without my permission.
*/
var max_sig_height=200 // the maximum height
var max_sig_width=400 // the maximum width
if (location.href.match("action=profile")&&!location.href.match("action=profile2")){
var tds=document.getElementsByTagName('td')
function checksig(){
var imagesize=""
if(document.creator.signature.value.match(/\[img\]/i)){
var sigsplit=document.creator.signature.value.split(/\[img\]/gi)
for(s=0;s<sigsplit.length;s++){
var imagesinsig=new Array()
imagesinsig[s-1]=sigsplit[s].split("[\/img]")[0]
var body=document.getElementsByTagName('body')[0]
var checkimage=document.createElement('img')
checkimage.src=imagesinsig[s-1]
checkimage.style.cssText="visibility:hidden;position:absolute;top:0px;"
body.appendChild(checkimage)
if(checkimage.fileSize<=0){alert("This image does not exist: "+imagesinsig[s-1]+"\n\n Please correct the URL.");break}
else {imagesize="ok"}
if(checkimage.height>max_sig_height){alert("This image's height is too big: "+imagesinsig[s-1]+"\n\n It's height is "+checkimage.height+" and the maximum signature height is "+max_sig_height+".");imagesize="notok";break}
if(checkimage.width>max_sig_width){alert("This image's width is too big: "+imagesinsig[s-1]+"\n\n It's width is "+checkimage.width+" and the maximum signature width is "+max_sig_width+".");imagesize="notok";break}
body.removeChild(checkimage)
}}
else {
imagesize="ok"
}
if(imagesize=="ok"){document.creator.moda[0].disabled=false}
}
for (x=0;x<tds.length;x++) {
if (tds[x].innerHTML.match(/<font size=2><b>Signature:<\/b><\/font>/i)&&tds[x].width=="320"){
var sigtd=x+1
tds[x+1].innerHTML+="<font size=1>The maximum width of a signature image: "+max_sig_width+".<br />The maximum height of a signature image: "+max_sig_height+".<br /><br /><input value='Check Signature' type='button' onclick='checksig\(\)' /><br />Please click here so we can make sure your signature image(s) is(are) within the size restrictions.</font>"
}}
function disableSubmit(){document.creator.moda[0].disabled=true}
document.creator.signature.onkeypress=function(){disableSubmit()}
disableSubmit()
}
</script>
main footers
Configuration
var max_sig_height=200 // the maximum height
var max_sig_width=400 // the maximum width
Edit those lines in the code. The comments and variable names should be pretty self-explanatory. No quotes please.
The "Change Profile" button will be disabled until the user clicks the "Check Signature" button. (unless of course, a signature image doesn't meet the requirements)
If an image in the signature doesn't exist, an alert box will pop up.
If the image is too big, an alert box will pop up. It might be different if the width isn't within the limits.
this was a request.
Please tell me if it doesn't work.