묻고답하기

function RecordingsList(id) {
  if (arguments.length > 0)
    this.init(id);
}

RecordingsList.prototype.init = function(id) {
  this.id = id;

  this.idElt = document.getElementById(id);
  if (this.idElt == undefined)   return;

  this.idStyle = document.defaultView.getComputedStyle(this.idElt, null);

  this.listElt = this.idElt.getElementsByTagName("ul")[0];
  this.listItemElt = this.listElt.getElementsByTagName("li");
  this.listLength = this.listItemElt.length;

  this.listItemStyle = document.defaultView.getComputedStyle(this.listItemElt[0], null);
  this.listItemHeight = parseInt(this.listItemStyle.height)
  + parseInt(this.listItemStyle.paddingTop)
  + parseInt(this.listItemStyle.paddingBottom)
  + parseInt(this.listItemStyle.borderTopWidth)
  + parseInt(this.listItemStyle.borderBottomWidth)
  + parseInt(this.listItemStyle.marginTop)
  + parseInt(this.listItemStyle.marginBottom);

  this.addHighlight();
  this.addFaders();
  this.addVideoPreviews();
  this.addFocusHandlers();

  // Nav left and nav right should do nothing for any list item.
  for (var li = 0; li < this.listLength; li++) {
    this.listItemElt[li].style.navLeft = "#" + this.listItemElt[li].id;
    this.listItemElt[li].style.navRight = "#" + this.listItemElt[li].id;
  }

  // Down from bottom goes to top, and vice versa
//  this.listItemElt[0].style.navUp = "#" + this.listItemElt[this.listLength - 1].id;
//  this.listItemElt[this.listLength - 1].style.navDown = "#" + this.listItemElt[0].id;

  this.scroller = new VerticalScroller(this.listElt);

  // Make sure the first list item is under the highlight and has focus.
  this.listItemElt[0].focus();
//  document.getElementById("corvette").focus();
}

// The highlight is styled and positioned by CSS.
// We just add the appropriate element to the document.
// NB it'+ '+ 's added to the document, NOT into the div.
// This is to ensure it isn't affected by any styles set for
// the div itself.
RecordingsList.prototype.addHighlight = function() {
  var highlight = document.createElement("div");
  highlight.className = "highlight";
  document.body.appendChild(highlight);

  // We'll need to know where it's actually positioned, relative
  // to the top of the list, so that we can move list items into
  // the appropriate position.
  this.highlightDelta =
    parseInt(document.defaultView.getComputedStyle(highlight, null).top)
    - parseInt(this.idStyle.top);
}

// Same applies to the two faders.
RecordingsList.prototype.addFaders = function() {
  var topFader = document.createElement("div");
  var botFader = document.createElement("div");

  topFader.className = "fade top";
  botFader.className = "fade bottom";

  document.body.appendChild(topFader);
  document.body.appendChild(botFader);
}

// Create an array of Image objects, holding video previews.
// Add an img element to the document with the appropriate id.
// These are then tied together in the showVideo method.
// A more exotic example might create an img element for each image
// and animate between the images.
RecordingsList.prototype.addVideoPreviews = function() {
  this.vidPreview = new Array();

  for (var li = 0; li < this.listLength; li++) {
    var id = this.listItemElt[li].id;
    var imgPath = "images/show-" + id + ".png";

    this.vidPreview[id] = document.createElement("img");
    this.vidPreview[id].id = "vidPreview-"+id;
    this.vidPreview[id].src = imgPath;
    this.vidPreview[id].className = "vidPreview";
  
    document.body.appendChild(this.vidPreview[id]);
  }
}

// When a list item receives focus, it is moved into the highlight area.
RecordingsList.prototype.addFocusHandlers = function() {
  var me = this;
  for (var li = 0; li < this.listLength; li++) {
    this.listItemElt[li].itemDelta = li * this.listItemHeight; // handy
    this.listItemElt[li].addEventListener("focus",
      function(e) { me.highlightElt(e.target) }, false);

    // Show and hide the video preview appropriately.
    this.listItemElt[li].addEventListener("focus",
      function(e) { me.showVideo(e.target) }, false);
    this.listItemElt[li].addEventListener("blur",
      function(e) { me.hideVideo(e.target) }, false);
  }
  
}

// Move the list so that elt sits inside the highlight area.
RecordingsList.prototype.highlightElt = function(elt) {
  this.scroller.scrollTo(this.highlightDelta - elt.itemDelta);
}

// Show the video preview for this recording.
RecordingsList.prototype.showVideo = function(elt) {
  this.vidPreview[elt.id].style.display = "block";

}

// Hide the video preview for this recording.
RecordingsList.prototype.hideVideo = function(elt) {
  this.vidPreview[elt.id].style.display = "none";
}


// A VerticalScroller object scrolls an element up or down smoothly.
// Instantiate it with an element, and call the scrollTo method
// to scroll that element to a new position.
function VerticalScroller(elt) {
  if (arguments.length > 0)
    this.init(elt);
}

VerticalScroller.prototype.init = function(elt) {
  this.elt = elt;

  // How far the list is moved up or down from its top=0 position.
  // Initially, the style sheet determines this. We store locally
  // to avoid calling getComputedStyle repeatedly.
  this.currentDelta = parseInt(document.defaultView.getComputedStyle(this.elt, null).top);
  // Holds a timeout handle so we can cancel scrolling when we need to.
  this.scrollHandle = null;

}

VerticalScroller.prototype.scrollTo = function(targetDelta) {
  if (this.scrollHandle)   clearTimeout(this.scrollHandle);

  var diff = targetDelta - this.currentDelta;
  this.scrollAnim(diff, 8); // magic move factor
}

// To get a move-past-target-and-spring-back effect we note that
// 8+7+6+5+4+3+2+1+0-1-2-3 = 30
// So decrementing a moveFactor from 8 to -3, and moving
// moveFactor/30 of the total distance each time, eventually gets
// us there. We could just scroll a fixed amount each time, of course,
// but this looks prettier.
VerticalScroller.prototype.scrollAnim = function(diff, moveFactor) {
  var me = this;

  this.currentDelta += (moveFactor * diff) / 30;
  this.elt.style.top = this.currentDelta + "px";
  
  if (moveFactor != -3)
    this.scrollHandle = setTimeout(function() { me.scrollAnim(diff, moveFactor - 1) }, 35);
}



// Initialise the page
function initPage() {
  var stateList = new RecordingsList("rec-list");

  if (top.loadListener) top.loadListener.hasLoaded();
}

function play1()
{
    var form = document.DATA;
    form.action = "http://127.0.0.1/cgi-bin/act.cgi?file=:554//Video/HD/HD-Texas.mpg"; // +"?"+now.getSeconds();
    form.submit();
}




window.onload = initPage;

--

알려주세요^^*
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
circus 레이아웃을 다운받고서 그 다음이 또 문제입니다 [1] 2007.08.10
정용우 php에서 메뉴로 변수값전달해서 인쿨르드시키기.. [1] 2007.08.10
UPANGEL 혹시해킹? [6] 2007.08.10
권영 NZEO 홈페이지 처럼 게시판을 메인 중간에 붙이는 법? [4] 2007.08.10
에디 이미지,파일 업로드 [1] 2007.08.10
에디 이미지,파일 업로드  
이병진 mysql_fetch_array 이것때문에 도와주세여 [1] 2007.08.10
최법철 버튼에 이메일 전송 기능 추가하기.  
김선회 게시판 변형에 대하여 질문드립니다. [1] 2007.08.10
정지웅 RSS(XML)를 읽어서, TXT로 바꿔주는 유틸은 없나요?  
실시라 울트라 에디터 사용하는데요.  
최법철 폼에서 이메일로 작성된글을 보내기  
이명근 드림위버에서 프레임 나누기 질문 드립니다. [1] 2007.08.10
캘리 익스플로러에서 스위시파일 [3] 2007.08.10
김성일 자바스크립트 소스 수정 질문드립니다. [1] 2007.08.10
김성일 자바스크립트 소스 수정 질문드립니다. [1] 2007.08.10
완규 보안 관련해서 간단한 질문합니다  
이창진 [PHP] switch 구문 질문 [1] 2007.08.10
로보로보 제로보드와 결제시스템 연동! [1] 2007.08.10
이건우 [초급] 프레임나누기..?? 이걸 어떻게 잘라야하죠..? [1] 2007.08.10
설레임 제로보드에서도 견적신청을 보낼수이을까요 .. [1] 2007.08.10
에디 팝업창 체크해도 열리는 이유...  
에디 하루동안 안열리게하는 팝업창이 체크해도 계속 열리네요 [1] 2007.08.10
DeificatioN PHP에 ''->'',''define'' 질문입니다. [3] 2007.08.10
이사기*^^* 이게 무슨 소스 일까요? [1] 2007.08.10
김종민 플래시 메뉴 삽입후 빈 공간이 생깁니다. [1] 2007.08.10
L330 엔지오사이트는 해상도에 관계없이 어떻게 화면에 꽉차게 나올수 있죠? [1] 2007.08.10
장원준 메뉴바가 로그인 하면움직입니다. [2] 2007.08.10
문준석 소스 질문입니다~급해용^^;; [1] 2007.08.10
신순성 하이퍼링크와 함께 질문합니다. [1] 2007.08.10