https://theclergydatabase.org.uk/wp-content/plugins/collapse-page-…/collapse-page-category-plugin.js
1/* 2Plugin Name: Collapse Page and Category Plugin 3Plugin URI: http://www.BlogsEye.com/ 4Description: Uses Javascript to collapse children on Pages and Categories or any List that uses the css class 'children' 5Version: 1.5 6Author: Keith P. Graham 7Author URI: http://www.BlogsEye.com/ 8 9This software is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12*/ 13 function kpg_colpage_context(event) { 14 var ev=event||window.event; 15 var targ=ev.srcElement||ev.target; 16 var nodes=targ.parentNode.childNodes; 17 for (var i = 0; i < nodes.length; i++) { 18 if (nodes[i].className=="children") { 19 if (nodes[i].style.display=="none") { 20 nodes[i].style.display="block"; 21 nodes[i].style.visibility="visible"; 22 if(ev.stopPropagation) {ev.stopPropagation();} 23 ev.cancelBubble = true; 24 targ.innerHTML='△ ' 25 targ.id='ktriangledn'; 26 return false; 27 } else { 28 nodes[i].style.visibility="hidden"; 29 nodes[i].style.display="none"; 30 if(ev.stopPropagation) {ev.stopPropagation();} 31 ev.cancelBubble = true; 32 targ.innerHTML='▽ ' 33 targ.id='ktriangleup'; 34 return false; 35 } 36 } 37 } 38 return false; 39 } 40 function kpg_colpage_action(event) { 41 var clicker='<a href="#" class="expand" onclick="return kpg_colpage_context(event);">▽ </a>'; 42 // right triangle is ▹ 43 // filed triangles are one less than open ones. 44 try { 45 var b=document.getElementsByTagName("UL"); // case sensitive XML 46 for (var i=0;i<b.length;i++) { 47 // make parent clickable and the child no display 48 if (b[i].className=="children") { 49 // search for parent li - check a few times incase the ul tags are heavily formatted 50 var p=b[i].parentNode; 51 b[i].style.visibility="hidden"; 52 b[i].style.display="none"; 53 // set the p object with a character before with a click item attached to it. 54 p.innerHTML=clicker+p.innerHTML; 55 // code thanks to Jette!! 56 var m = p.className.match(/current_page_/); 57 if (m !=null) { 58 b[i].style.visibility="visible"; 59 b[i].style.display="block"; 60 } 61 } 62 } 63 } catch (ee) {} 64 } 65 if (!document.all) { 66 HTMLElement.prototype.click = function() { 67 var evt = this.ownerDocument.createEvent('MouseEvents'); 68 evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); 69 this.dispatchEvent(evt); 70 } 71 } 72 // set the onload event 73 if (document.addEventListener) { 74 document.addEventListener("DOMContentLoaded", function(event) { kpg_colpage_action(event); }, false); 75 } else if (window.attachEvent) { 76 window.attachEvent("onload", function(event) { kpg_colpage_action(event); }); 77 } else { 78 var oldFunc = window.onload; 79 window.onload = function() { 80 if (oldFunc) { 81 oldFunc(); 82 } 83 kpg_colpage_action('load'); 84 }; 85 }
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.