home *** CD-ROM | disk | FTP | other *** search
- var curElement;
- var curParentDiv;
- var curPickDiv;
- var nStartX = 0;
- var nStartY = 0;
- var nStartLeft = 0;
- var nStartTop = 0;
- var oldCursor = "hand";
- var IsShowVideoBorder = false;
-
- var bDebugVersion = false;
-
- function MyTest(strID)
- {
- var oldParentDiv = curParentDiv;
- var oldElement = curElement;
-
- onClickElement(document.all[strID]);
-
- if (oldParentDiv != curParentDiv)
- {
- if (oldParentDiv != null)
- {
- oldParentDiv.style.borderWidth = "0px";
- oldParentDiv.style.pixelLeft += 5;
- oldParentDiv.style.pixelTop += 5;
- // oldParentDiv.style.pixelWidth -= 10;
- // oldParentDiv.style.pixelHeight -= 10;
- if (oldElement != null)
- oldElement.style.cursor = oldCursor;
- }
-
- if (curParentDiv != null)
- {
- curParentDiv.style.borderWidth = "5px";
- // curParentDiv.style.pixelLeft -= 5;
- // curParentDiv.style.pixelTop -= 5;
-
- // curParentDiv.style.pixelWidth = curParentDiv.clientWidth + 10;
- // curParentDiv.style.pixelHeight = curParentDiv.clientHeight + 10;
-
- // oldCursor = curElement.style.cursor;
- oldCursor = "hand";
- curElement.style.cursor = "move";
- }
- }
-
- if (curParentDiv != null)
- {
- // nStartX = event.clientX;
- // nStartY = event.clientY;
- // nStartLeft = curParentDiv.style.pixelLeft;
- // nStartTop = curParentDiv.style.pixelTop;
- }
- }
-
- function UpdateVideoBorder()
- {
- var pLayer = document.all("VideoLayer");
- var pBorder = document.all("VideoBorder");
-
- if(pLayer && pBorder)
- {
- if(pLayer == curParentDiv)
- pBorder.style.visibility = pLayer.style.visibility;
- else
- pBorder.style.visibility = "hidden";
- }
- }
-
- function ShowDebugMessage(str)
- {
- if (bDebugVersion == true)
- window.alert(str);
- }
-
- function doMouseMove()
- {
- var nNewLeft=0, nNewTop = 0
-
- event.returnValue = false;
- event.cancelBubble = true;
-
- if (curPickDiv == null)
- return;
-
- if (event.clientX < 0 ||
- event.clientY < 0 ||
- event.clientX >= document.body.clientWidth ||
- event.clientY >= document.body.clientHeight)
- {
- return;
- }
-
- if ((event.button==1) && (curParentDiv!=null))
- {
- // position alien
- nNewLeft = nStartLeft + (event.clientX - nStartX);
- curParentDiv.style.pixelLeft = nNewLeft;
- // if(VideoBorder)
- // VideoBorder.style.pixelLeft = nNewLeft - 5;
-
- nNewTop = nStartTop + (event.clientY - nStartY);
- curParentDiv.style.pixelTop = nNewTop;
- // if(VideoBorder)
- // VideoBorder.style.pixelTop = nNewTop - 5;
- }
- }
-
-
- function doDragStart()
- {
- // Don't do default drag operation.
- if ("IMG"==event.srcElement.tagName)
- event.returnValue=false;
- }
-
- function doMouseUp()
- {
- event.returnValue = false;
- event.cancelBubble = true;
-
- if (curPickDiv != null) {
- if ((event.button==1) && (curParentDiv!=null)) {
- if (curParentDiv.style.pixelLeft < 0)
- curParentDiv.style.pixelLeft = 0;
- if (curParentDiv.style.pixelTop < 0)
- curParentDiv.style.pixelTop = 0;
- }
-
- curPickDiv = null;
- }
- }
-
- function ReplaceVideo(str)
- {
- uVideo01.outerHTML = str;
- }
-
- var nAkuo=0;
-
-
- function SelectNone()
- {
- var oldParentDiv = curParentDiv;
- var oldElement = curElement;
-
- curElement = null;
- curParentDiv = null;
-
- if (oldParentDiv != curParentDiv) {
- if (oldParentDiv != null) {
- oldParentDiv.style.borderWidth = "0px";
- oldParentDiv.style.pixelLeft += 5;
- oldParentDiv.style.pixelTop += 5;
- // oldParentDiv.style.pixelWidth -= 10;
- // oldParentDiv.style.pixelHieght -= 10;
- if (oldElement != null)
- oldElement.style.cursor = oldCursor;
- }
- }
- }
-
- function onClickElement(srcElement)
- {
- var ElementClicked;
-
- if (srcElement == null)
- ElementClicked = event.srcElement;
- else
- ElementClicked = srcElement;
-
- // alert(ElementClicked.id);
- // alert(ElementClicked.tagName);
-
- if (ElementClicked.tagName == "BODY" ||
- ElementClicked.tagName == "body") {
- // alert("Body");
- ElementClicked = null;
- }
- else {
- var bHasID = false;
- var strID = "";
-
- if (ElementClicked.id != null &&
- ElementClicked.id != "" &&
- ElementClicked.id != "undefined") {
- bHasID = true;
- strID = ElementClicked.id;
- }
-
- if (!bHasID &&
- ElementClicked.name != null &&
- ElementClicked.name != "" &&
- ElementClicked.name != "undefined") {
- bHasID = true;
- strID = ElementClicked.name;
- }
-
- if (!bHasID) {
- ShowDebugMessage("The element you clicked does not have an ID or NAME, so it cannot be selected.");
- // alert("No ID");
- ElementClicked = null;
- }
- else if (strID.indexOf("u") != 0)
- {
- ShowDebugMessage("The element you clicked does not have an ID start with \'u\', so it cannot be selected.");
- // alert("U");
- ElementClicked = null;
- }
- else
- {
- var strClass = ElementClicked.className;
- var strSub = strClass.substring(0, 5);
- if (strSub == "Fixed")
- {
- ShowDebugMessage("The element you clicked is a fixed decoration element.");
- // alert(ElementClicked.id);
- // alert(ElementClicked.tagName);
- // alert("Fixed");
- ElementClicked = null;
- }
-
- strSub = strClass.substring(0, 7);
- if (strSub == "Dynamic")
- {
- ShowDebugMessage("The element you clicked is a dynamic element.");
- // alert("Dynamic");
- ElementClicked = null;
- }
- }
- }
-
- curParentDiv = null;
-
- if (ElementClicked != null) {
- var Parent;
-
- if (ElementClicked.tagName == "DIV" ||
- ElementClicked.tagName == "div")
- curParentDiv = ElementClicked;
-
- Parent = ElementClicked.parentElement;
- while (Parent != null) {
- if (Parent.tagName == "DIV" ||
- Parent.tagName == "div")
- curParentDiv = Parent;
- Parent = Parent.parentElement;
- }
-
- if (curParentDiv == null) {
- if (ElementClicked.tagName != "BODY" &&
- ElementClicked.tagName != "body")
- ShowDebugMessage("The element you clicked does not have a DIV parent element. This is a design error.");
- ElementClicked = null;
- }
-
- curPickDiv = curParentDiv;
-
- }
-
-
- status = "Liao Cheng Kuo"; // begin of ulead private string
-
- if (ElementClicked == null)
- status = "Akuo";
- else {
- curElement = ElementClicked;
-
- status = "TagName~" + curElement.tagName;
-
- status = "ID~" + curElement.id;
-
- status = "Name~" + curElement.name;
-
- status = "Src~" + curElement.src;
-
- status = "DynSrc~" + curElement.dynsrc;
-
- if (curElement.href)
- status = "Href~" + curElement.href;
-
- status = "InnerText~" + curElement.innerText;
-
- status = "OuterText~" + curElement.outerText;
-
- status = "InnerHTML~" + curElement.innerHTML;
-
- status = "OuterHTML~" + curElement.outerHTML;
- }
-
- status = "Kuo Cheng Liao"; // end of ulead private string
- }
-
-
- function doMouseDown()
- {
- event.returnValue = false;
- event.cancelBubble = true;
-
- if (event.clientX <= 0 ||
- event.clientY <= 0 ||
- event.clientX >= document.body.clientWidth ||
- event.clientY >= document.body.clientHeight)
- return;
-
- if ((event.button==1)){// && ) {
- var oldParentDiv = curParentDiv;
- var oldElement = curElement;
-
- onClickElement(null)
-
- if (oldParentDiv != curParentDiv) {
- if (oldParentDiv != null) {
- if(-1 == oldParentDiv.id.indexOf("VideoLayer"))
- {
- oldParentDiv.style.borderWidth = "0px";
- oldParentDiv.style.pixelLeft += 5;
- oldParentDiv.style.pixelTop += 5;
- // oldParentDiv.style.pixelWidth -= 10;
- // oldParentDiv.style.pixelHeight -= 10;
- }
- else
- {
- if(VideoBorder)
- VideoBorder.style.visibility = "hidden";
- }
- if (oldElement != null)
- oldElement.style.cursor = oldCursor;
- }
-
- if (curParentDiv != null) {
- if(-1 == curParentDiv.id.indexOf("VideoLayer"))
- {
- // alert(curParentDiv.id);
- curParentDiv.style.borderWidth = "5px";
- curParentDiv.style.pixelLeft -= 5;
- curParentDiv.style.pixelTop -= 5;
- // curParentDiv.style.pixelWidth += 10;
- // curParentDiv.style.pixelHeight += 10;
- }
- else
- {
- if(VideoBorder)
- {
- VideoBorder.style.pixelLeft = curParentDiv.style.pixelLeft - 5;
- VideoBorder.style.pixelTop = curParentDiv.style.pixelTop - 5;
- VideoBorder.style.pixelWidth = curParentDiv.clientWidth + 10;
- VideoBorder.style.pixelHeight = curParentDiv.clientHeight + 10;
- VideoBorder.style.visibility = "visible";
- }
- }
-
- oldCursor = curElement.style.cursor;
- curElement.style.cursor = "move";
- }
- }
-
- if (curParentDiv != null) {
- nStartX = event.clientX;
- nStartY = event.clientY;
- nStartLeft = curParentDiv.style.pixelLeft;
- nStartTop = curParentDiv.style.pixelTop;
- }
- }
- }
-
- function doMouseOver()
- {
- }
-
-
- function doKeyDown()
- {
- var nNewLeft=0, nNewTop = 0
-
- if (curParentDiv == null)
- return;
-
- nNewTop = curParentDiv.style.pixelTop;
- nNewLeft = curParentDiv.style.pixelLeft;
-
- if (event.keyCode == 37)
- nNewLeft -= 1;
- else if (event.keyCode == 38)
- nNewTop -= 1;
- else if (event.keyCode == 39)
- nNewLeft += 1;
- else if (event.keyCode == 40)
- nNewTop += 1;
- else
- return;
-
- event.returnValue = false;
- event.cancelBubble = true;
-
- if (nNewLeft >= 0)
- curParentDiv.style.pixelLeft = nNewLeft;
-
- if (nNewTop >= 0)
- curParentDiv.style.pixelTop = nNewTop;
- }
-
- document.ondragstart = doDragStart;
- document.onmousedown = doMouseDown;
- document.onmousemove = doMouseMove;
- document.onmouseover = doMouseOver;
- document.onmouseup = doMouseUp;
- document.onkeydown = doKeyDown;
-
-
-
-