1// ###################################################################### 2 3// ## flipMenu 5.0.0 (c) J. Reijers 4// ## Last modifications: 23 March 2007 5 6// ###################################################################### 7 8// ## Degree of indentation from the left. 9 flipIndentation = "0px"; 10 11// ## Padding inbetween menu items. 12 flipVerticalPadding = "0px"; 13 14// ## Margin between the left of the browser and the menu. 15 flipLeftMargin = "16px"; 16 17// ## Margin between the top of the browser and the menu. 18 flipTopMargin = "0px"; 19 20// ## Allow multiple menus to fold out without closing all the other open ones. 21 flipOpenMultipleMenus = false; 22 23// ## Preserve the current state of the menu (requires cookies). 24 flipSaveMenuState = true; 25 26// ## Use custom images for bullets 27 flipImages = true; 28 29// ## Images to use (specify full path) 30 flipImg_open = "images/arrow_down.gif"; 31 flipImg_closed = "images/arrow_right.gif"; 32 flipImg_static = "images/flip_static.gif"; 33 34// ## Initialise all flipMenus onload 35 flipInitOnLoad = true; 36 37// ## Message to display in status bar while loading 38 flipLoadingMessage = "Loading..."; 39 40// ###################################################################### 41 42function alterSize(someSize, alterAmount) { 43 someSize = String(someSize); 44 var tmpNr = parseFloat(someSize.replace(/\D/g, "")); 45 var tmpChar = someSize.replace(/\d/g, ""); 46 return isNaN(tmpNr) ? someSize : ((tmpNr + alterAmount) + tmpChar); 47} 48 49isIE = (String(navigator.appVersion).indexOf("MSIE") > -1); 50if (!isIE) flipIndentation = alterSize(flipIndentation, -16); 51if (!isIE) flipLeftMargin = alterSize(flipLeftMargin, -16); 52 53document.write( 54 "<style type=\"text/css\">" + 55 56 "ul.flipMenu { margin-top: " + flipTopMargin + "; margin-left: " + flipLeftMargin + "; " + (flipImages ? "" : "list-style-type: none;") + " }" + 57 "ul.flipMenu ul, ul.flipMenu li { padding-top: " + flipVerticalPadding + "; margin-left: " + flipIndentation + "; margin_right: 0px; " + (flipImages ? "" : "list-style-type: none;") + " }" + 58 59 "li.flipFolderOpen { cursor: pointer; " + (flipImages ? "list-style-image: url(" + flipImg_open + ");" : "") + " }" + 60 "li.flipFolderClosed { cursor: pointer; " + (flipImages ? "list-style-image: url(" + flipImg_closed + ");" : "") + " }" + 61 62 "</style>" 63); 64 65if (flipImages) { 66 aFlipPreloads = []; 67 aFlipPreloads[0] = new Image; 68 aFlipPreloads[0].src = flipImg_open; 69 aFlipPreloads[1] = new Image; 70 aFlipPreloads[1].src = flipImg_closed; 71 aFlipPreloads[2] = new Image; 72 aFlipPreloads[2].src = flipImg_static; 73} 74 75function addEvent(someObj, someEvent, someFunction) { 76 if (someObj.addEventListener) { someObj.addEventListener(someEvent, someFunction, true); return true; } else if (someObj.attachEvent) return someObj.attachEvent("on" + someEvent, someFunction); else return false; 77} 78 79function openCloseFlip(theItem, newSetting, openParents) { 80 if (theItem.flipID) { 81 if (openParents) { 82 var tmpItem = theItem; 83 while (tmpItem.parentElement || tmpItem.parentNode) { 84 tmpItem = (tmpItem.parentElement) ? tmpItem.parentElement : tmpItem.parentNode; 85 openCloseFlip(tmpItem, newSetting); 86 } 87 } 88 if ((theItem.className == "flipFolderOpen" && newSetting == "closed") || (theItem.className == "flipFolderClosed" && newSetting == "open")) { 89 if (!theItem.childrenInitialised) { 90 for (var j = 0; j < theItem.childNodes.length; j++) if (theItem.childNodes[j].nodeName == "UL" && !theItem.childNodes[j].initialised) initFlip(theItem.childNodes[j]); 91 theItem.childrenInitialised = true; 92 } 93 theItem.getElementsByTagName("UL")[0].style.display = (newSetting == "open") ? "" : "none"; 94 theItem.className = newSetting == "open" ? "flipFolderOpen" : "flipFolderClosed"; 95 } 96 } 97} 98 99function openFlip(theItem, openParents) { 100 openCloseFlip(theItem, "open", openParents); 101} 102 103function closeFlip(theItem, closeParents) { 104 openCloseFlip(theItem, "closed", closeParents); 105} 106 107function toggleFlip(theElement) { 108 if (theElement.flipID) { 109 var theItem = theElement; 110 var isContained = true; 111 } else { 112 if (theElement && theElement.button > 0) return false; 113 var theItem = (isIE) ? event.srcElement : theElement.target; 114 115 var isContained = false;
116 if (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") isContained = true; else while (theItem.parentElement || theItem.parentNode) { 117 if (theItem.className == "flipStatic" || theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed") { 118 isContained = (theItem.className == "flipFolderOpen" || theItem.className == "flipFolderClosed"); 119 break; 120 } 121 theItem = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode; 122 } 123 } 124 125 var toOpenFlip = (isContained && theItem.className == "flipFolderClosed"); 126 127 if (!flipOpenMultipleMenus && (toOpenFlip || theItem.className == "flipStatic")) { 128 if (theItem.parentElement || theItem.parentNode) { 129 var parentUL = (theItem.parentElement) ? theItem.parentElement : theItem.parentNode; 130 for (var i = 0; i < parentUL.childNodes.length; i++) closeFlip(parentUL.childNodes[i]); 131 } 132 } 133 134 if (isContained) { 135 if (toOpenFlip) openFlip(theItem); else closeFlip(theItem); 136 } 137} 138 139function setAllFlips(startElement, newSetting) { 140 if (typeof startElement == "undefined") var startElement = document; 141 if (typeof newSetting == "undefined") var newSetting = "closed"; 142 143 var aUL = startElement.getElementsByTagName("UL"); 144 for (var i = 0; i < aUL.length; i++) { 145 var parentFlip = aUL[i].parentElement ? aUL[i].parentElement : aUL[i].parentNode; 146 openCloseFlip(parentFlip, newSetting); 147 } 148} 149 150function openAllFlips(startElement) { 151 setAllFlips(startElement, "open"); 152} 153 154function closeAllFlips(startElement) { 155 setAllFlips(startElement, "closed"); 156} 157 158function initFlip(startElement) { 159 if (!document.createElement) return false; 160 161 if (!startElement || !startElement.nodeName) { 162 var aUL = document.getElementsByTagName("UL"); 163 for (var i = 0; i < aUL.length; i++) { 164 if (flipLoadingMessage != "") window.status = flipLoadingMessage + " " + parseInt((i / (aUL.length - 1)) * 100, 10) + "%"; 165 var curUL = aUL[i]; 166 if (curUL.className == "flipMenu") { 167 initFlip(curUL); 168 169 // ## Fix text selecting problem in Mozilla 170 curUL.onselectstart = new Function("return false"); 171 curUL.onmousedown = new Function("return false"); 172 curUL.onclick = new Function("return true"); 173 } 174 } 175 176 if (flipSaveMenuState) loadMenuState(); 177 178 if (flipLoadingMessage != "") window.status = ""; 179 return true; 180 } 181 182 if (startElement.className == "flipMenu") startElement.style.display = ""; 183 184 if (!startElement.childNodes || startElement.childNodes.length == 0) return false; 185 186 if (typeof flipIDCur == "undefined") flipIDCur = 0; 187 if (!startElement.initialised) { 188 var aUL = startElement.getElementsByTagName("UL"); 189 for (var i = 0; i < aUL.length; i++) aUL[i].style.display = "none"; 190 } 191 192 for (var i = 0; i < startElement.childNodes.length; i++) { 193 var curNode = startElement.childNodes[i]; 194 if (curNode.nodeName == "LI") { 195 flipIDCur++; 196 curNode.flipID = flipIDCur; 197 198 var nodeHasChildren = curNode.getElementsByTagName("UL").length > 0; 199 if (nodeHasChildren) { 200 if (flipImages && curNode.flipClosed) curNode.style.listStyleImage = "url(" + curNode.flipClosed + ")"; 201 202 if (curNode.className == null || curNode.className == "") curNode.className = "flipFolderClosed"; 203 } else { 204 curNode.className = "flipStatic"; 205 if (flipImages && !curNode.style.listStyleImage) { 206 if (!curNode.flipStatic) curNode.flipStatic = flipImg_static; 207 curNode.style.listStyleImage = "url(" + curNode.flipStatic + ")"; 208 } 209 } 210 211 if (!curNode.flipOpen) curNode.flipOpen = flipImg_open; 212 if (!curNode.flipClosed) curNode.flipClosed = flipImg_closed; 213 214 if (curNode.flipIsOpen) openFlip(curNode); 215 } 216 } 217 218 startElement.initialised = true; 219} 220 221function rootOfFlip(flipID, startElement) { 222 223 function containsFlip(startElement, flipID) { 224 var flipFound = false; 225 var i = 0; 226 while (i < startElement.childNodes.length && !flipFound) { 227 var curNode = startElement.childNodes[i]; 228 flipFound = (curNode.flipID == flipID) ? true : containsFlip(curNode, flipID); 229 i++; 230 } 231 return flipFound; 232 } 233 234 var rootFlip = null; 235 236 if (!startElement || !startElement.nodeName) { 237 var aUL = document.getElementsByTagName("UL"); 238 var i = 0; 239 while (rootFlip == null && i < aUL.length) { 240 var curUL = aUL[i]; 241 if (curUL.nodeName == "UL" && curUL.className == "flipMenu") rootFlip = rootOfFlip(flipID, curUL); 242 i++; 243 } 244 return rootFlip; 245 } 246 247 if (startElement.childNodes) for (var i = 0; i < startElement.childNodes.length; i++) { 248 var curNode = startElement.childNodes[i]; 249 if (curNode.flipID == flipID || containsFlip(curNode, flipID)) rootFlip = curNode;
250 } 251 252 return rootFlip; 253} 254 255function getCookie(cookieName) { 256 var allCookies = document.cookie; 257 var indexStr = allCookies.indexOf(cookieName + "="); 258 if (indexStr == -1) return ""; 259 indexStr = allCookies.indexOf("=", indexStr) + 1; 260 var endStr = allCookies.indexOf(";", indexStr); 261 if (endStr == -1) endStr = allCookies.length; 262 return unescape(allCookies.substring(indexStr, endStr)); 263} 264 265function inArray(someID, someArray) { 266 for (var i = 0; i < someArray.length; i++) if (someArray[i] == someID) return true; 267 return false; 268} 269 270function getMenuState(startElement) { 271 if (!startElement.childNodes || startElement.childNodes.length == 0) return ""; 272 273 var openItems = ""; 274 var aUL = startElement.getElementsByTagName("UL"); 275 for (var i = 0; i < aUL.length; i++) { 276 var curNode = aUL[i]; 277 var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode; 278 if (curNode.style.display == "" && parentFlip.flipID) openItems += " " + parentFlip.flipID; 279 } 280 return openItems; 281} 282 283function putMenuState(startElement) { 284 if (!startElement.childNodes || startElement.childNodes.length == 0) return false; 285 286 var aUL = startElement.getElementsByTagName("UL"); 287 for (var i = 0; i < aUL.length; i++) { 288 var curNode = aUL[i]; 289 var parentFlip = (curNode.parentElement) ? curNode.parentElement : curNode.parentNode; 290 if (inArray(parentFlip.flipID, aOpenItems)) { 291 openFlip(parentFlip); 292 if (typeof prevFlipRoot == "undefined") { 293 var testRoot = rootOfFlip(parentFlip.flipID); 294 if (testRoot.flipID == parentFlip.flipID) prevFlipRoot = testRoot; 295 } 296 } 297 } 298} 299 300function saveMenuState() { 301 if (flipSaveMenuState) { 302 var aUL = document.getElementsByTagName("UL"); 303 for (var i = 0; i < aUL.length; i++) { 304 var curUL = aUL[i]; 305 var curID = curUL.id ? curUL.id : i; 306 if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=" + getMenuState(curUL) + ";"; 307 } 308 } 309} 310 311function loadMenuState() { 312 var aUL = document.getElementsByTagName("UL"); 313 for (var i = 0; i < aUL.length; i++) { 314 var curUL = aUL[i]; 315 var curID = curUL.id ? curUL.id : i; 316 if (curUL.className == "flipMenu") { 317 var savedState = String(getCookie(cookiePrefix + curID)); 318 if (savedState != "") { 319 aOpenItems = savedState.split(" "); 320 putMenuState(curUL); 321 } 322 } 323 } 324 325 addEvent(window, "unload", saveMenuState); 326} 327 328function clearMenuState(flipMenuID) { 329 if (typeof flipMenuID == "undefined") { 330 var aUL = document.getElementsByTagName("UL"); 331 for (var i = 0; i < aUL.length; i++) { 332 var curUL = aUL[i]; 333 var curID = curUL.id ? curUL.id : i; 334 if (curUL.className == "flipMenu") document.cookie = cookiePrefix + curID + "=;"; 335 } 336 } else document.cookie = cookiePrefix + flipMenuID + "=;"; 337} 338 339cookiePrefix = document.location.pathname + "_"; 340 341addEvent(document, "click", toggleFlip); 342if (flipInitOnLoad) addEvent(window, "load", initFlip);
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.