묻고답하기

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 남기남
마쵸 메뉴의 다국어 설정 [1] 2013.08.24 by sejin7940
이동화309 새글이 있는 탭에 New아이콘 표시 - content 위젯 or content 확장 위젯 [2] 2013.08.24 by 이동화309
도로시짜응 메인화면 이미지 슬라이드 문의 [2] file 2013.08.24 by 이동화309
nike077 SSL 관련 질문 드립니다! (본인의 웹서버타입과 CSR) [1] 2013.08.24 by 컴퓨터매니아
nike077 startssl 이 정말 평생 무료인가요? 아니면 [1] 2013.08.24 by 컴퓨터매니아
비로코 구글 웹로그 분석 설치 [2] 2013.08.24 by 컴퓨터매니아
구큰타 SocialXE 에서 회원정보... 소셜 설정이 안뜰 경우 [1] file 2013.08.24 by sejin7940
유타군 로그인이자꾸풀려요ㅜ [1] 2013.08.24 by sejin7940
nike077 무료 SSL 을 할지.. 유료SSL 을 할지 고민입니다. 조언좀 부탁드립니다! [2] 2013.08.24 by Fidelity
이온디 Parse error: syntax error, unexpected T_STRING in 에러 [1] 2013.08.24 by sejin7940
902 상단메뉴바에서 1차메뉴의 링크를 없애는 방법을 알고 싶습니다. [1] file 2013.08.24 by 쿡래빗
꿀꺽2 페이지-내용직접추가에서 html을 인클루드시키는 방법. [1] 2013.08.24 by sejin7940
후아아아~ 게시판 주소를 없애고 싶은데요.. 어떻게 해야 할까요? [2] file 2013.08.24 by Spooky
pa64 게시판 에러에 대해서 문의드립니다. [2] 2013.08.24 by pa64
미르르 확장자가 안보이는 외부이미지를 썸네일로 사용가능한가여? [1] 2013.08.24 by sejin7940
제로초보2 최신글 제목에 색상 넣는방법좀 알려주세요 ㅠ,ㅠ [1] file 2013.08.24 by sejin7940
오뚜기88 쉬운설치관련 에러문제.. [1] 2013.08.24 by sejin7940
몽실아빠 IE에서 console이 정의되지 않았습니다. 에러가 발생합니다. [1] 2013.08.24 by sejin7940
화랑529 모바일 페이지 적용 방법 좀 부탁드려요. [1] 2013.08.24 by sejin7940
PodongS2 스케치북 게시판 하단설정.. [1] file 2013.08.25 by sejin7940
tiram2sue SCM플레이어 사용시 복권/쿠폰 모듈 에러 [1] 2013.08.25 by 귀머거리하늘
Posibility 간단한 로드밸런싱의 개념에 대해서 질문드립니다.  
신대숙 xe설치하자마자 나오는 에러.. [1] 2013.08.25 by nike077
Arisae ssl 사용시 socialxe 사용방법 [1] 2013.08.25 by nike077
경호씨 다중 분류 또는 다중 태그 게시판 구성이 가능할까요?  
chiakac 1.5에서 1.7로 업데이트 하면 나타나는 오류 메세지 [1] 2013.08.25 by sejin7940
비로코 레이아웃 헤드 저장 실제 위치가? [1] 2013.08.25 by 비로코
moring 미디어 영상올리는대요 file  
바이바이준 추천기능 사용하는 게시판에만 노출이 되게할순없나요? [1] 2013.08.25 by sejin7940
오뚜기88 제로보드와 파일질라 [1] 2013.08.25 by sejin7940