/[suikacvs]/test/html-webhacc/cc-script.js
Suika

Diff of /test/html-webhacc/cc-script.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by wakaba, Thu Aug 14 07:19:44 2008 UTC revision 1.8 by wakaba, Thu Aug 14 09:16:52 2008 UTC
# Line 112  function addSectionLink (id, label, pare Line 112  function addSectionLink (id, label, pare
112        .firstChild.appendChild (el);        .firstChild.appendChild (el);
113    
114    var sections = document.webhaccSections;    var sections = document.webhaccSections;
115    if (parentId != '') sections = sections[parentId].webhaccSections;    if (parentId != '') {
116        sections = document.getElementById (parentId).webhaccSections;
117      }
118    sections[id] = document.getElementById (id);    sections[id] = document.getElementById (id);
119    sections[id].tabElement = el;    sections[id].tabElement = el;
120    
# Line 122  function addSectionLink (id, label, pare Line 124  function addSectionLink (id, label, pare
124    } else if (id == 'document-info' && !document.webhaccNavigated) {    } else if (id == 'document-info' && !document.webhaccNavigated) {
125      showTab (id);      showTab (id);
126      document.webhaccNavigated = false;      document.webhaccNavigated = false;
127      } else if (id.match (/-document-info$/)) {
128        sections[id].tabElement.setAttribute ('data-active', '');
129    } else {    } else {
130      sections[id].style.display = 'none';      sections[id].style.display = 'none';
131    }    }
132  } // addSectionLink  } // addSectionLink
133    
134  function showTab (id) {  function showTab (id) {
135    var m;    var ids = [];
136    if (id.match (/^line-/)) {    if (id.match (/^line-/)) {
137      id = 'source-string';      ids = ['source-string'];
138    } else if (id.match (/^node-/)) {    } else if (id.match (/^node-/)) {
139      id = 'document-tree';      ids = ['document-tree'];
140    } else if (m = id.match (/^(subdoc-\d+-)/)) {    } else if (id.match (/^subdoc-[^-]+-/)) {
141      id = m[1];      var m;
142        ids = [''];
143        while (true) {
144          if (m = id.match (/^subdoc-[^-]+-/)) {
145            ids.push (ids[ids.length - 1] + m[0]);
146            id = id.substring (m[0].length);
147          } else {
148            break;
149          }
150        }
151        if (id.length > 0) {
152          if (id.match (/^line-/)) {
153            ids.push (ids[ids.length - 1] + 'source-string');
154          } else if (id.match (/^node-/)) {
155            ids.push (ids[ids.length - 1] + 'document-tree');
156          } else {
157            ids.push (ids[ids.length - 1] + id);
158          }
159        }
160        ids.shift (); // ''
161      } else if (id.match (/^input-/)) {
162        ids = ['input', id];
163      } else {
164        ids = [id];
165    }    }
166    
167    if (id.match (/^input-/)) {    var sections = document.webhaccSections;
168      _showTab (document.webhaccSections.input.webhaccSections, id);    while (ids.length > 0) {
169      _showTab (document.webhaccSections, 'input');      var myid = ids.shift ();
170    } else {      _showTab (sections, myid);
171      _showTab (document.webhaccSections, id);      sections = sections[myid].webhaccSections;
172        if (!sections) break;
173    }    }
174  } // showTab  } // showTab
175    
# Line 160  function _showTab (sections, id) { Line 188  function _showTab (sections, id) {
188    
189  function getAncestorAnchorElement (e) {  function getAncestorAnchorElement (e) {
190    do {    do {
191      if (e.nodeName == 'A') {      if (e.nodeName == 'A' || e.nodeName == 'AREA') {
192        return e;        return e;
193      }      }
194      e = e.parentNode;      e = e.parentNode;
# Line 188  function onbodyload () { Line 216  function onbodyload () {
216      if (fragment) {      if (fragment) {
217        var id = decodeURIComponent (fragment.substring (1));        var id = decodeURIComponent (fragment.substring (1));
218        showTab (id);        showTab (id);
219          var el = document.getElementById (id);
220          if (el) el.scrollIntoView ();
221      } else if (document.webhaccSections['result-summary']) {      } else if (document.webhaccSections['result-summary']) {
222        showTab ('result-summary');        showTab ('result-summary');
223      } else {      } else {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24