From 35ca329e122f830c3370ec5fe5cba4076ab147bb Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Wed, 12 Mar 2003 13:42:24 +0000 Subject: [PATCH] Modified scroll variable handling. Inserted a BR node; made BR and IFRAME children of the added SPAN. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196078 13f79535-47bb-0310-9956-ffa450edef68 --- .../scripts/design/alt.design/codedisplay.js | 21 +++++++++++-------- .../alt.design/properties/codedisplay.js | 21 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/documentation/resources/scripts/design/alt.design/codedisplay.js b/src/documentation/resources/scripts/design/alt.design/codedisplay.js index 03df70dbb..f45bab796 100644 --- a/src/documentation/resources/scripts/design/alt.design/codedisplay.js +++ b/src/documentation/resources/scripts/design/alt.design/codedisplay.js @@ -1,7 +1,7 @@ // $Id$ var showing = new Array(); -var x = -1; // scrollX -var y = -1; // scrollY +var x = new Array(); // scrollX +var y = new Array(); // scrollY function toggleCode(id, src, height, width) { //alert('In toggleCode'); @@ -16,19 +16,22 @@ function showCode(id, src, height, width) { //alert('In showCode'); if (showing[id]) { return; } if (document.getElementById && document.createElement) { - if (window.scrollX) { - x = window.scrollX; - y = window.scrollY; + if (window.scrollX != undefined) { + x[id] = window.scrollX; + y[id] = window.scrollY; } var parent = document.getElementById(id); var span = document.createElement('SPAN'); parent.appendChild(span); + var br = document.createElement('BR'); var iframe = document.createElement('IFRAME'); iframe.setAttribute('src', src); iframe.setAttribute('height', height); iframe.setAttribute('width', width); - parent.replaceChild(iframe, parent.lastChild); - // window.scrollTo(x,y); + span.appendChild(br); + span.appendChild(iframe); + //parent.replaceChild(iframe, parent.lastChild); + // window.scrollTo(x[id],y[id]); showing[id] = true; } else { alert( @@ -43,8 +46,8 @@ function hideCode(id) { if (document.getElementById && document.createElement) { var parent = document.getElementById(id); parent.removeChild(parent.lastChild); - if (x >= 0) { - window.scrollTo(x,y); + if (x[id] != undefined) { + window.scrollTo(x[id],y[id]); } showing[id] = false; } else { diff --git a/src/documentation/resources/scripts/design/alt.design/properties/codedisplay.js b/src/documentation/resources/scripts/design/alt.design/properties/codedisplay.js index 03df70dbb..f45bab796 100644 --- a/src/documentation/resources/scripts/design/alt.design/properties/codedisplay.js +++ b/src/documentation/resources/scripts/design/alt.design/properties/codedisplay.js @@ -1,7 +1,7 @@ // $Id$ var showing = new Array(); -var x = -1; // scrollX -var y = -1; // scrollY +var x = new Array(); // scrollX +var y = new Array(); // scrollY function toggleCode(id, src, height, width) { //alert('In toggleCode'); @@ -16,19 +16,22 @@ function showCode(id, src, height, width) { //alert('In showCode'); if (showing[id]) { return; } if (document.getElementById && document.createElement) { - if (window.scrollX) { - x = window.scrollX; - y = window.scrollY; + if (window.scrollX != undefined) { + x[id] = window.scrollX; + y[id] = window.scrollY; } var parent = document.getElementById(id); var span = document.createElement('SPAN'); parent.appendChild(span); + var br = document.createElement('BR'); var iframe = document.createElement('IFRAME'); iframe.setAttribute('src', src); iframe.setAttribute('height', height); iframe.setAttribute('width', width); - parent.replaceChild(iframe, parent.lastChild); - // window.scrollTo(x,y); + span.appendChild(br); + span.appendChild(iframe); + //parent.replaceChild(iframe, parent.lastChild); + // window.scrollTo(x[id],y[id]); showing[id] = true; } else { alert( @@ -43,8 +46,8 @@ function hideCode(id) { if (document.getElementById && document.createElement) { var parent = document.getElementById(id); parent.removeChild(parent.lastChild); - if (x >= 0) { - window.scrollTo(x,y); + if (x[id] != undefined) { + window.scrollTo(x[id],y[id]); } showing[id] = false; } else { -- 2.39.5