mouse trails fever!.htm

来自「DW动态插件」· HTM 代码 · 共 261 行

HTM
261
字号
<html>
<head>
<title>Mouse Trails Fever!</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>

//If there is a document, the command can run
function canAcceptCommand(){
	return (dw.getFocus() == 'document');
}

function commandButtons(){

	return new Array("Cheese Please","putIn()","No Thanks","window.close()")

	}

/*  function commandButtons(){
	return new Array("Insert the script","scriptinsert()","Cancel","window.close()")
	}*/
	
// ---------- Main Functions  ---------	

function scriptInsert(){

    //define the script to insert	
    MyScript="\r"
	MyScript+="/* \r"
	MyScript+="SviiTrailer \r"
	MyScript+="*/ \r"
	MyScript+=" \r"
	MyScript+="var x,y \r"
	MyScript+="var step=20 \r"
	MyScript+="var flag=0 \r"
	MyScript+=" \r"
	MyScript+="var message=\""+document.forms[0].trailText.value+" \" \r"
	MyScript+="message=message.split(\"\") \r"
	MyScript+=" \r"
	MyScript+="var xpos=new Array() \r"
	MyScript+="for (i=0;i<=message.length-1;i++) { \r"
	MyScript+="        xpos[i]=-50 \r"
	MyScript+=" \r"
	MyScript+="} \r"
	MyScript+=" \r"
	MyScript+="var ypos=new Array() \r"
	MyScript+="for (i=0;i<=message.length-1;i++) { \r"
	MyScript+="        ypos[i]=-50 \r"
	MyScript+=" \r"
	MyScript+="} \r"
	MyScript+=" \r"
	MyScript+="function SviiTrailer(e){ \r"
	MyScript+="        x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX \r"
	MyScript+="        y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY \r"
	MyScript+="        flag=1 \r"
	MyScript+=" \r"
	MyScript+="} \r"
	MyScript+=" \r"
	MyScript+="function HappyTrails() { \r"
	MyScript+="        if (flag==1 && document.all) { \r"
	MyScript+="        for (i=message.length-1; i>=1; i--) { \r"
	MyScript+="                        xpos[i]=xpos[i-1]+step \r"
	MyScript+="                        ypos[i]=ypos[i-1] \r"
	MyScript+="        } \r"
	MyScript+="                xpos[0]=x+step \r"
	MyScript+="                ypos[0]=y \r"
	MyScript+="         \r"
	MyScript+="                for (i=0; i<message.length-1; i++) { \r"
	MyScript+="                var thisspan = eval(\"span\"+(i)+\".style\") \r"
	MyScript+="                thisspan.posLeft=xpos[i] \r"
	MyScript+="                        thisspan.posTop=ypos[i] \r"
	MyScript+="        } \r"
	MyScript+="        } \r"
	MyScript+="         \r"
	MyScript+="        else if (flag==1 && document.layers) { \r"
	MyScript+="        for (i=message.length-1; i>=1; i--) { \r"
	MyScript+="                        xpos[i]=xpos[i-1]+step \r"
	MyScript+="                        ypos[i]=ypos[i-1] \r"
	MyScript+="        } \r"
	MyScript+="                xpos[0]=x+step \r"
	MyScript+="                ypos[0]=y \r"
	MyScript+="         \r"
	MyScript+="                for (i=0; i<message.length-1; i++) { \r"
	MyScript+="                var thisspan = eval(\"document.span\"+i) \r"
	MyScript+="                thisspan.left=xpos[i] \r"
	MyScript+="                        thisspan.top=ypos[i] \r"
	MyScript+="        } \r"
	MyScript+="        } \r"
	MyScript+="                var timer=setTimeout(\"HappyTrails()\","+document.forms[0].delay.value+") \r"
	MyScript+=" \r"
	MyScript+="} \r"
	MyScript+=" \r"

	MyStyle="\r"
	MyStyle+="/* \r"
	MyStyle+="SviiTrailer \r"
	MyStyle+="*/ \r"
	MyStyle+=" \r"
	MyStyle+=" \r"
	MyStyle+=".spanstyle{position:absolute;visibility:visible;top:-50px;font-size:10px;font-family:\"Trebuchet MS\", Verdana, Arial, sans-serif;font-weight:bold;color:#CCCCCC;}  \r";

	thePageDom=dreamweaver.getDocumentDOM("document")
	theScriptNodes=thePageDom.getElementsByTagName("SCRIPT")
	theBody=thePageDom.getElementsByTagName("BODY")
	theStyle=thePageDom.getElementsByTagName("STYLE")
	

	theHeadNode=thePageDom.getElementsByTagName("HEAD")
	isThere=theHeadNode.item(0).innerHTML.indexOf("SviiTrailer")!="-1"	

	if(isThere){
	alert('Dem traily mouses already exist in this document')
	window.close()}
	
	else{

	// need a new script tag inside the head 
	theHeadNode=thePageDom.getElementsByTagName("HEAD")

	//create the new tags and put the script inside
    theHeadNode.item(0).innerHTML = theHeadNode.item(0).innerHTML+"<script language=\"JavaScript\">"+MyScript+"\r</s"+"cript>";
    theBody.item(0).setAttribute("style","width:100%;overflow-x:hidden;overflow-y:hidden");
    theBody.item(0).setAttribute("onLoad","HappyTrails();");

if(theStyle=="")
{
theHeadNode.item(0).innerHTML = theHeadNode.item(0).innerHTML+"<style type=\"text/css\">"+MyStyle+"\r</s"+"tyle>";
}
else{

    theStyle.item(0).innerHTML = theStyle.item(0).innerHTML+""+MyStyle+"\r"+"";}}
	window.close()
}

function scriptRemove(){
	var alternateFile;
	alternateFile = printVersion(dreamweaver.getDocumentDOM());
	//If the link element is there, get the href out of it and populate the form
	if(alternateFile){
		alternateFile.outerHTML = "";
	}
}

function insert_in_Body(){
    MyScript2="\r"
	MyScript2+="/* \r"
	MyScript2+="SviiTrailer \r"
	MyScript2+="*/ \r"
	MyScript2+=" \r"
	MyScript2+=" \r"
    MyScript2+="for (i=0;i<=message.length-1;i++) { \r"
	MyScript2+="    document.write(\"<span id='span\"+i+\"' class='spanstyle'>\") \r"
	MyScript2+="        document.write(message[i]) \r"
	MyScript2+="    document.write(\"</span>\") \r"
	MyScript2+=" \r"
	MyScript2+="} \r"
	MyScript2+=" \r"
	MyScript2+="if (document.layers){ \r"
	MyScript2+="        document.captureEvents(Event.MOUSEMOVE); \r"
	MyScript2+=" \r"
	MyScript2+="} \r"
	MyScript2+="document.onmousemove = SviiTrailer; \r";


// put script in the body tag
	thePageDom=dreamweaver.getDocumentDOM("document")
	theBodyNode=thePageDom.getElementsByTagName("BODY")
    theBodyNode.item(0).innerHTML = theBodyNode.item(0).innerHTML +"<script>\r"+MyScript2+"\r</s"+"cript>"
   }
   
function putIn(){
insert_in_Body();
scriptInsert();
window.close();
}

// ---------- DOM Functions  ---------

//Filter an array of objects to check for a given attribute and his value
//Return a new array of matching objects
function matchAttributeValue(theObjectsArray,theAttibute,theValue){//1.2
	var filteredObjectsArray = new Array();
	for (var h=0;h<theObjectsArray.length;h++){
		var attributeValue;
		attributeValue = theObjectsArray[h].getAttribute(theAttibute);
		if(attributeValue && attributeValue.toLowerCase()==theValue){
			filteredObjectsArray.push(theObjectsArray[h]);
		}
	}	
	return filteredObjectsArray;
}

//Get the DOM of any file and return the first link element that has:
//attribute "rel" = "alternate"
//and
//attribute "media" = "print"
function printVersion(theDom){
	var linksArray,relLinks,printLinks;
	linksArray = theDom.getElementsByTagName("LINK");
	relLinks = matchAttributeValue(linksArray,"rel","alternate");
	printLinks = matchAttributeValue(relLinks,"media","print");
	return printLinks[0];
}

// ---------- UI Functions  ---------

function browseFile(fieldToStoreURL){
  var fileName = "";
  fileName = browseForFileURL();  //returns a local filename
  if (fileName) fieldToStoreURL.value = fileName;
}

//Populate the UI if the link is already inside the document 
function initializeUI(){
	var alternateFile;
	alternateFile = printVersion(dreamweaver.getDocumentDOM());
	//If the link element is there, get the href out of it and populate the form
	if(alternateFile){
		document.forms[0].trailText.value = alternateFile.getAttribute("HREF");
	}
	//Set focus on textbox
	document.forms[0].trailText.focus();
	//Set insertion point into textbox
	document.forms[0].trailText.select(); 	
}


</script>
</head>

<BODY onLoad="initializeUI()">
<font color="navy"><b>Mouse Trails Fever!</b></font> 
<p>Creates a line of text which follows the pointer all around the page. The style 
  of the text can be changed via the CSS Styles palette in the usual way.<br>
  Please (I beg of you) use this effect sparingly! 
<hr size="1" width="100%" noshade>
<form name="theForm">
  <table border="0" cellspacing="0" cellpadding="0" width="412">
    <tr valign="baseline"> 
      <td nowrap width="85">Trailing text</td>
      <td nowrap width="327"> 
        <input type="text" name="trailText" size="40">
      </td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap width="85">Speed</td>
      <td nowrap width="327"> 
        <input type="text" name="delay" value="60" size="4">
      </td>
    </tr>
  </table>
</form>
<hr size="1" width="100%" noshade>
<div align="right"> 
  <p>version 2.0 - dru@dreamweaverfever.com<br>
    Hacked together by Al Sparber, Eddie Traversa &amp; Drew McLellan. Forgive 
    us.</p>
</div>
</BODY>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?