PageSourceSearch

http://uayeb.com/wp-content/plugins/collapsing-pages/collapsFunctions.js?ver=1.6

js uayeb.com collected 2026-10-07 18:45:53 UTC 5,061 bytes, 167 lines download raw bytes

1/*  Collapse Functions, version 1.6
2 *
3 *--------------------------------------------------------------------------*/
4String.prototype.trim = function() {
5  return this.replace(/^\s+|\s+$/g,"");
6}
7
8function createCookie(name,value,days) {
9  if (days) {
10    var date = new Date();
11    date.setTime(date.getTime()+(days*24*60*60*1000));
12    var expires = "; expires="+date.toGMTString();
13  } else {
14    var expires = "";
15  }
16  document.cookie = name+"="+value+expires+"; path=/";
17}
18
19function readCookie(name) {
20  var nameEQ = name + "=";
21  var ca = document.cookie.split(';');
22  for(var i=0;i < ca.length;i++) {
23    var c = ca[i];
24    while (c.charAt(0)==' ') {
25      c = c.substring(1,c.length);
26    }
27    if (c.indexOf(nameEQ) == 0) {
28      return c.substring(nameEQ.length,c.length);
29    }
30  }
31  return null;
32}
33
34function eraseCookie(name) {
35  createCookie(name,"",-1);
36}
37function collapsAddLoadEvent(func) {
38  var oldonload = window.onload;
39  if (typeof window.onload != 'function') {
40    window.onload = func;
41  } else {
42    window.onload = function() {
43      if (oldonload) {
44        oldonload();
45      }
46      func();
47    }
48  }
49}
50function autoExpandCollapse(collapsClass) {
51  var cookies = document.cookie.split(';');
52  var cookiePattern = new RegExp(collapsClass+'(-[0-9]+|List-[0-9]+-[0-9]+|List-[0-9]+)');
53  var classPattern = new RegExp('^' + collapsClass);
54  var hide = collapsClass + ' ' + 'collapse'
55  var show = collapsClass + ' ' + 'expand'
56  for (var cookieIndex=0; cookieIndex<cookies.length; cookieIndex++) {
57    var cookieparts= cookies[cookieIndex].split('=');
58    
59    var cookiename=cookieparts[0].trim();
60    if (cookiename.match(cookiePattern)) {
61      var cookievalue=cookieparts[1].trim();
62      var expand= document.getElementById(cookiename);
63      if (expand) {
64        var thisli = expand.parentNode;
65        for (var childI=0; childI< thisli.childNodes.length; childI++) {
66          if (thisli.childNodes[childI].nodeName.toLowerCase() == 'span') {
67            theSpan=thisli.childNodes[childI];
68            if (theSpan.className.match(classPattern)) {
69              if ((theSpan.className == show && cookievalue ==1) ||
70                  (theSpan.className == hide && cookievalue ==0)) {
71                var theOnclick=theSpan.onclick+"";
72                var matches=theOnclick.match(/.*\(event, ?"([^"]*)", ?"([^"]*)".*\)/);
73                var expand=matches[1].replace(/\\u25BA/, '\u25BA');
74                expand=expand.replace(/\\u25B6/, '\u25B6');
75                var collapse=matches[2].replace(/\\u25BC/, '\u25BC');
76                collapse=collapse.replace(/\\u2014/, '\u2014');
77                expandCollapse(theSpan,expand,collapse,0,collapsClass);
78              }
79            }
80          }
81        } 
82      }
83    }
84  }
85}
86
87function expandCollapse( e, expand,collapse, animate, collapsClass ) {
88  var classPattern= new RegExp('^' + collapsClass);
89  if (expand=='expandImg') {
90    expand=expandSym;
91  }
92  if (collapse=='collapseImg') {
93    collapse=collapseSym;
94  }
95  if( e.target ) {
96    src = e.target;
97  } else if (e.className && e.className.match(classPattern)) {
98    src=e;
99  } else {
100    try {
101      src = window.event.srcElement;
102    } catch (err) {
103    }
104  }
105
106  srcList = src.parentNode;
107  if (src.nodeName.toLowerCase() == 'img' ||
108      src.parentNode.nodeName.toLowerCase() == 'h2') {
109    srcList = src.parentNode.parentNode;
110    src=src.parentNode;
111  } else if (src.parentNode.parentNode.nodeName.toLowerCase() == 'h2') {
112    src=src.parentNode;
113    srcList = src.parentNode.parentNode;
114  }
115  if (srcList.nodeName.toLowerCase() == 'span') {
116    srcList= srcList.parentNode;
117    src= src.parentNode;
118  }
119  if (srcList.nodeName.toLowerCase() == 'h2') {
120    srcList=srcList.parentNode;
121  }
122  childList = null;
123
124  for( i = 0; i < srcList.childNodes.length; i++ ) {
125    if( srcList.childNodes[i].nodeName.toLowerCase() == 'ul' ) {
126      childList = srcList.childNodes[i];
127    }
128  }
129  var hide = collapsClass + ' ' + 'collapse'
130  var show = collapsClass + ' ' + 'expand'
131  var theSpan = src.childNodes[0];
132  var theId= childList.getAttribute('id');
133  if (theSpan.className!='sym') {
134    theSpan = theSpan.childNodes[0];
135    //alert(childList.getAttribute('id'));
136    theId = childList.childNodes[0].getAttribute('id');
137  }
138  if( src.getAttribute( 'class' ) == hide ) {
139    createCookie(theId,0,7);
140    src.setAttribute('class',show);
141    src.setAttribute('title','click to expand');
142    theSpan.innerHTML=expand;
143    if (animate==1) {
144      //Effect.BlindUp(childList, {duration: 0.5});
145      jQuery(childList).hide('blind', '', 500);
146    } else {
147      childList.style.display = 'none';
148    }
149  } else {
150    createCookie(theId,1,7);
151    src.setAttribute('class',hide);
152    src.setAttribute('title','click to collapse');
153    theSpan.innerHTML=collapse;
154    if (animate==1) {
155      //Effect.BlindDown(childList, {duration: 0.5});
156      jQuery(childList).show('blind', '', 500);
157    } else {
158      childList.style.display = 'block';
159    }
160  }
161
162  if( e.preventDefault ) {
163    e.preventDefault();
164  }
165
166  return false
vendor: 4 bytes, lines 166-167
166;
167}

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.