/[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.6 by wakaba, Sun Aug 10 11:49:43 2008 UTC revision 1.7 by wakaba, Thu Aug 14 07:19:44 2008 UTC
# Line 84  function addSourceToParseErrorList (idPr Line 84  function addSourceToParseErrorList (idPr
84    }    }
85  } // addSourceToParseErrorList  } // addSourceToParseErrorList
86    
87  function insertNavSections () {  function insertNavSections (parentId) {
88      parentId = parentId || '';
89    var el = document.createElement ('nav');    var el = document.createElement ('nav');
90    el.id = 'nav-sections';    el.id = parentId + 'nav-sections';
91    el.innerHTML = '<ul></ul>';    el.innerHTML = '<ul></ul>';
92    document.body.appendChild (el);    
93    document.webhaccSections = {};    if (parentId == '') {
94    document.body.setAttribute ('data-scripted', '');      document.body.appendChild (el);
95        document.webhaccSections = {};
96        document.body.setAttribute ('data-scripted', '');
97      } else {
98        var section = document.getElementById (parentId);
99        section.appendChild (el);
100        section.webhaccSections = {};
101      }
102  } // insertNavSections  } // insertNavSections
103    
104  function addSectionLink (id, label) {  function addSectionLink (id, label, parentId) {
105      parentId = parentId || '';
106    
107    var el = document.createElement ('li');    var el = document.createElement ('li');
108    el.innerHTML = '<a></a>';    el.innerHTML = '<a></a>';
109    el.firstChild.href = '#' + id;    el.firstChild.href = '#' + id;
110    el.firstChild.innerHTML = label;    el.firstChild.innerHTML = label;
111    document.getElementById ('nav-sections').firstChild.appendChild (el);    document.getElementById (parentId + 'nav-sections')
112    document.webhaccSections[id] = document.getElementById (id);        .firstChild.appendChild (el);
113    document.webhaccSections[id].tabElement = el;  
114    if (id == 'input') {    var sections = document.webhaccSections;
115      //    if (parentId != '') sections = sections[parentId].webhaccSections;
116      sections[id] = document.getElementById (id);
117      sections[id].tabElement = el;
118    
119      if (id == 'input' || id == 'input-url') {
120        showTab (id);
121        document.webhaccNavigated = false;
122    } else if (id == 'document-info' && !document.webhaccNavigated) {    } else if (id == 'document-info' && !document.webhaccNavigated) {
123      showTab ('document-info');      showTab (id);
124      document.webhaccNavigated = false;      document.webhaccNavigated = false;
125    } else {    } else {
126      document.webhaccSections[id].style.display = 'none';      sections[id].style.display = 'none';
127    }    }
128  } // addSectionLink  } // addSectionLink
129    
# Line 121  function showTab (id) { Line 137  function showTab (id) {
137      id = m[1];      id = m[1];
138    }    }
139    
140    if (document.webhaccSections[id]) {    if (id.match (/^input-/)) {
141      for (var i in document.webhaccSections) {      _showTab (document.webhaccSections.input.webhaccSections, id);
142        document.webhaccSections[i].style.display = 'none';      _showTab (document.webhaccSections, 'input');
143        document.webhaccSections[i].tabElement.removeAttribute ('data-active');    } else {
144        _showTab (document.webhaccSections, id);
145      }
146    } // showTab
147    
148    function _showTab (sections, id) {
149      if (sections[id]) {
150        for (var i in sections) {
151          sections[i].style.display = 'none';
152          sections[i].tabElement.removeAttribute ('data-active');
153      }      }
154      document.webhaccSections[id].style.display = 'block';      sections[id].style.display = 'block';
155      document.webhaccSections[id].tabElement.setAttribute ('data-active', '');      sections[id].tabElement.setAttribute ('data-active', '');
156    
157      document.webhaccNavigated = true;      document.webhaccNavigated = true;
158    }    }
159    } // _showTab
 } // showTab  
160    
161  function getAncestorAnchorElement (e) {  function getAncestorAnchorElement (e) {
162    do {    do {

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24