Post by iAlex on Apr 4, 2008 1:22:30 GMT -5
This code will create an input box in your profile where each user is able to input their deviantART username. An image will then appear in their mini profile linking to their deviant art web page.
Here is the icon that will be used, you may continue using the one hosted by me or change it to your own:
Cross Browser.
Global Footer.
Open Source.
<script type="text/javascript">
<!--
/*deviantART Icon in Mini Profile - By iAlex - Open Source*/
var iDevIcon="http://img257.imageshack.us/img257/325/deviantarticonrb6.gif"; //deviantART mini profile icon
if(document.modifyForm){
var iAim=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iDevTr=iAim.cloneNode(true);
iDevTr.childNodes[0].firstChild.innerHTML='deviantART:';
iDevTr.childNodes[1].firstChild.innerHTML='<input type="text" size="35" maxlength="25" id="iDevInp" />';
iDevTr.childNodes[2].firstChild.innerHTML='Your deviantART username here.';
iAim.parentNode.insertBefore(iDevTr, iAim);
var iPerTe=document.modifyForm.personaltext;
var iDevInp=document.getElementById('iDevInp');
if(iPerTe.value.match(/\[D3v:(.+?)\]/)){
iDevInp.value=RegExp.$1;
iPerTe.value=iPerTe.value.replace(/\[D3v:(.+?)\]/, '');
}
function iSaFa(){
if(iDevInp.value!=""){
iPerTe.value=iPerTe.value+'[D3v:'+iDevInp.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iSaFa, false);
}
else{
document.modifyForm.attachEvent('onsubmit', iSaFa);
}
}
if(location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|search2|pmview)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).innerHTML.match(/\[D3v:(.+?)\]/)){
var iCentre=iTd.item(i).getElementsByTagName('center');
var iDevSpan=document.createElement('span');
iDevSpan.innerHTML='<a href="http://'+RegExp.$1+'.deviantart.com/" target="_blank"><img src="'+iDevIcon+'" border="0" alt="deviantART" title="deviantART" /></a>';
iCentre.item(iCentre.length-1).appendChild(iDevSpan);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[D3v:(.+?)\]/, '');
}
}
}
//-->
</script>
Here is the icon that will be used, you may continue using the one hosted by me or change it to your own:
Cross Browser.
Global Footer.
Open Source.
<script type="text/javascript">
<!--
/*deviantART Icon in Mini Profile - By iAlex - Open Source*/
var iDevIcon="http://img257.imageshack.us/img257/325/deviantarticonrb6.gif"; //deviantART mini profile icon
if(document.modifyForm){
var iAim=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iDevTr=iAim.cloneNode(true);
iDevTr.childNodes[0].firstChild.innerHTML='deviantART:';
iDevTr.childNodes[1].firstChild.innerHTML='<input type="text" size="35" maxlength="25" id="iDevInp" />';
iDevTr.childNodes[2].firstChild.innerHTML='Your deviantART username here.';
iAim.parentNode.insertBefore(iDevTr, iAim);
var iPerTe=document.modifyForm.personaltext;
var iDevInp=document.getElementById('iDevInp');
if(iPerTe.value.match(/\[D3v:(.+?)\]/)){
iDevInp.value=RegExp.$1;
iPerTe.value=iPerTe.value.replace(/\[D3v:(.+?)\]/, '');
}
function iSaFa(){
if(iDevInp.value!=""){
iPerTe.value=iPerTe.value+'[D3v:'+iDevInp.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iSaFa, false);
}
else{
document.modifyForm.attachEvent('onsubmit', iSaFa);
}
}
if(location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|search2|pmview)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).innerHTML.match(/\[D3v:(.+?)\]/)){
var iCentre=iTd.item(i).getElementsByTagName('center');
var iDevSpan=document.createElement('span');
iDevSpan.innerHTML='<a href="http://'+RegExp.$1+'.deviantart.com/" target="_blank"><img src="'+iDevIcon+'" border="0" alt="deviantART" title="deviantART" /></a>';
iCentre.item(iCentre.length-1).appendChild(iDevSpan);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[D3v:(.+?)\]/, '');
}
}
}
//-->
</script>