- Timestamp:
- 07/03/07 11:40:48 (17 months ago)
- Files:
-
- 1 modified
-
util/smartlinks.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
util/smartlinks.pl
r16545 r16806 69 69 element['on' + type] = handleEvent; 70 70 } 71 71 72 72 // store the event handler in the hash table 73 73 handlers[handler.$$guid] = handler; … … 89 89 // grab the event object (IE uses a global event object) 90 90 event = event || fixEvent(window.event); 91 91 92 92 var returnValue = true; 93 93 94 94 // get a reference to the hash table of event handlers 95 95 var handlers = this.events[event.type]; … … 134 134 var matches = this.id.match(/smartlink_toggle(\d+)/); 135 135 var num = matches[1]; 136 136 137 137 var id = 'smartlink_' + num; 138 138 var div = document.getElementById(id); 139 139 div.style.display = (div.style.display == 'none') ? '' : 'none'; 140 140 141 141 var text = this.firstChild; 142 142 text.nodeValue = text.nodeValue.replace(/^- (Show|Hide)/, function (full, p1) { return "- " + ((p1 == 'Show') ? 'Hide' : 'Show') }); // this may be unnecessarily complicated, or it may not. you get to decide. :-) 143 143 144 144 e.stopPropagation(); 145 145 e.preventDefault(); … … 162 162 addEvent(window, 'load', function () { 163 163 var divs = collectionToArray(document.getElementsByTagName('div')); 164 164 165 165 for (var i = 0, j = divs.length; i < j; i++) { 166 166 var curr = divs[i]; … … 176 176 177 177 var p = curr.previousSibling; 178 178 179 179 while (p.nodeType != 1) { p = p.previousSibling; } // ignore any whitespace-only nodes 180 180 181 181 var text = p.firstChild; 182 182 text.nodeValue = text.nodeValue.replace(/^From/, '- Show'); 183 183 184 184 var link = document.createElement('a'); 185 185 186 186 var child; 187 187 while (child = p.firstChild) { 188 188 link.appendChild(child); 189 189 } 190 190 191 191 var end = link.lastChild; 192 192 if ((end.nodeType == 3) && (end.nodeValue.search(/:$/) > -1)) { 193 193 end.nodeValue = end.nodeValue.replace(/:$/, ' -'); 194 194 } 195 195 196 196 link.href = '#'; 197 197 link.id = 'smartlink_toggle' + num; 198 198 addEvent(link, 'click', toggle_snippet); 199 199 200 200 p.appendChild(link); 201 201 curr.parentNode.insertBefore(p, curr); … … 613 613 # S26 is in Pod6, we treat it specifically for now. 614 614 if ($syn_id == 26) { 615 return if $check; 615 616 eval "use Perl6::Perldoc 0.000005; use Perl6::Perldoc::Parser; use Perl6::Perldoc::To::Xhtml;"; 616 617 if ($@) {
