묻고답하기

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 남기남
이온디 Parse error: syntax error, unexpected T_STRING in 에러 [1] 2013.08.24 by sejin7940
nike077 무료 SSL 을 할지.. 유료SSL 을 할지 고민입니다. 조언좀 부탁드립니다! [2] 2013.08.24 by Fidelity
유타군 로그인이자꾸풀려요ㅜ [1] 2013.08.24 by sejin7940
구큰타 SocialXE 에서 회원정보... 소셜 설정이 안뜰 경우 [1] file 2013.08.24 by sejin7940
비로코 구글 웹로그 분석 설치 [2] 2013.08.24 by 컴퓨터매니아
nike077 startssl 이 정말 평생 무료인가요? 아니면 [1] 2013.08.24 by 컴퓨터매니아
nike077 SSL 관련 질문 드립니다! (본인의 웹서버타입과 CSR) [1] 2013.08.24 by 컴퓨터매니아
도로시짜응 메인화면 이미지 슬라이드 문의 [2] file 2013.08.24 by 이동화309
이동화309 새글이 있는 탭에 New아이콘 표시 - content 위젯 or content 확장 위젯 [2] 2013.08.24 by 이동화309
마쵸 메뉴의 다국어 설정 [1] 2013.08.24 by sejin7940
미식가 라르게덴님의 멀티도메인 모듈을 사용중인데 로그인이 안 됩니다. [1] 2013.08.24 by 라르게덴
수신제가 상단메뉴 작성중인데요,XE 고수님들께서 좀 도와주세요. [2] file 2013.08.24 by 윈컴이
아싸리방가 XE폴더를 삭제해버렸는데 [2] 2013.08.23 by 윈컴이
문화사랑 좌측 하단에 항상 메뉴 보이게 하려면... [1] file 2013.08.23 by 씨즈부스
myungsu88 모파일페이지 질문드립니다 [1] file 2013.08.23 by 씨즈부스
늅늅이 짧은 주소를 사용해도 [2] 2013.08.23 by 씨즈부스
신대숙 설치 다하자. 마지막에 404 Not found [3] 2013.08.23 by 쿨럭이
애드바이러스 게시판에 답변하기 모드 이건 없어진것인가요? [1] file 2013.08.23 by Fidelity
Fidelity XE 고수님들...!  
오락실주인 RadarURL :: 동시접속자수(동접수) 출력 애드온