Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
doc/html/navtree.js@13:2b51f5267c92, 2014-08-13 (annotated)
- Committer:
- dan_ackme
- Date:
- Wed Aug 13 03:14:30 2014 -0700
- Revision:
- 13:2b51f5267c92
- Parent:
- 11:ea484e1b7fc4
- Child:
- 17:7268f365676b
doc updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan_ackme | 10:735194df0097 | 1 | var NAVTREE = |
dan_ackme | 10:735194df0097 | 2 | [ |
dan_ackme | 13:2b51f5267c92 | 3 | [ "WiConnect Host Library", "index.html", [ |
dan_ackme | 13:2b51f5267c92 | 4 | [ "Library Overview", "index.html", [ |
dan_ackme | 10:735194df0097 | 5 | [ "Overview", "index.html#Overview", null ], |
dan_ackme | 10:735194df0097 | 6 | [ "Important Notes", "index.html#notes", null ], |
dan_ackme | 10:735194df0097 | 7 | [ "Library Settings", "index.html#features", [ |
dan_ackme | 10:735194df0097 | 8 | [ "Blocking / Non-blocking Modes", "index.html#setting_blocking_modes", [ |
dan_ackme | 10:735194df0097 | 9 | [ "Blocking Mode", "index.html#setting_blocking_mode", null ], |
dan_ackme | 10:735194df0097 | 10 | [ "Non-Blocking Mode", "index.html#setting_nonblocking_mode", null ] |
dan_ackme | 10:735194df0097 | 11 | ] ], |
dan_ackme | 10:735194df0097 | 12 | [ "Dynamic / Static Allocation", "index.html#setting_alloc", null ], |
dan_ackme | 10:735194df0097 | 13 | [ "Asynchronous Processing", "index.html#setting_async_processing", null ] |
dan_ackme | 10:735194df0097 | 14 | ] ], |
dan_ackme | 10:735194df0097 | 15 | [ "Sending Commands To WiFi Module", "index.html#send_command_desc", null ] |
dan_ackme | 10:735194df0097 | 16 | ] ], |
dan_ackme | 13:2b51f5267c92 | 17 | [ "Library API", "modules.html", "modules" ], |
dan_ackme | 13:2b51f5267c92 | 18 | [ "API Examples", "examples.html", "examples" ], |
dan_ackme | 10:735194df0097 | 19 | [ "Classes", null, [ |
dan_ackme | 10:735194df0097 | 20 | [ "Class List", "annotated.html", "annotated" ], |
dan_ackme | 10:735194df0097 | 21 | [ "Class Index", "classes.html", null ], |
dan_ackme | 11:ea484e1b7fc4 | 22 | [ "Class Hierarchy", "hierarchy.html", "hierarchy" ], |
dan_ackme | 10:735194df0097 | 23 | [ "Class Members", "functions.html", [ |
dan_ackme | 10:735194df0097 | 24 | [ "All", "functions.html", null ], |
dan_ackme | 11:ea484e1b7fc4 | 25 | [ "Functions", "functions_func.html", null ], |
dan_ackme | 11:ea484e1b7fc4 | 26 | [ "Variables", "functions_vars.html", null ] |
dan_ackme | 10:735194df0097 | 27 | ] ] |
dan_ackme | 13:2b51f5267c92 | 28 | ] ], |
dan_ackme | 13:2b51f5267c92 | 29 | [ "WiConnect Reference Manual", "^http://wiconnect.ack.me/1.2/general_overview", null ], |
dan_ackme | 13:2b51f5267c92 | 30 | [ "ACKme Website", "^http://www.ack.me/WiConnect", null ] |
dan_ackme | 10:735194df0097 | 31 | ] ] |
dan_ackme | 10:735194df0097 | 32 | ]; |
dan_ackme | 10:735194df0097 | 33 | |
dan_ackme | 10:735194df0097 | 34 | var NAVTREEINDEX = |
dan_ackme | 10:735194df0097 | 35 | [ |
dan_ackme | 11:ea484e1b7fc4 | 36 | "annotated.html", |
dan_ackme | 13:2b51f5267c92 | 37 | "group__api__socket__http.html#ga949cee4543c91951219652bd6282049f" |
dan_ackme | 10:735194df0097 | 38 | ]; |
dan_ackme | 10:735194df0097 | 39 | |
dan_ackme | 10:735194df0097 | 40 | var SYNCONMSG = 'click to disable panel synchronisation'; |
dan_ackme | 10:735194df0097 | 41 | var SYNCOFFMSG = 'click to enable panel synchronisation'; |
dan_ackme | 10:735194df0097 | 42 | var navTreeSubIndices = new Array(); |
dan_ackme | 10:735194df0097 | 43 | |
dan_ackme | 10:735194df0097 | 44 | function getData(varName) |
dan_ackme | 10:735194df0097 | 45 | { |
dan_ackme | 10:735194df0097 | 46 | var i = varName.lastIndexOf('/'); |
dan_ackme | 10:735194df0097 | 47 | var n = i>=0 ? varName.substring(i+1) : varName; |
dan_ackme | 10:735194df0097 | 48 | return eval(n.replace(/\-/g,'_')); |
dan_ackme | 10:735194df0097 | 49 | } |
dan_ackme | 10:735194df0097 | 50 | |
dan_ackme | 10:735194df0097 | 51 | function stripPath(uri) |
dan_ackme | 10:735194df0097 | 52 | { |
dan_ackme | 10:735194df0097 | 53 | return uri.substring(uri.lastIndexOf('/')+1); |
dan_ackme | 10:735194df0097 | 54 | } |
dan_ackme | 10:735194df0097 | 55 | |
dan_ackme | 10:735194df0097 | 56 | function stripPath2(uri) |
dan_ackme | 10:735194df0097 | 57 | { |
dan_ackme | 10:735194df0097 | 58 | var i = uri.lastIndexOf('/'); |
dan_ackme | 10:735194df0097 | 59 | var s = uri.substring(i+1); |
dan_ackme | 10:735194df0097 | 60 | var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); |
dan_ackme | 10:735194df0097 | 61 | return m ? uri.substring(i-6) : s; |
dan_ackme | 10:735194df0097 | 62 | } |
dan_ackme | 10:735194df0097 | 63 | |
dan_ackme | 10:735194df0097 | 64 | function hashValue() |
dan_ackme | 10:735194df0097 | 65 | { |
dan_ackme | 10:735194df0097 | 66 | return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); |
dan_ackme | 10:735194df0097 | 67 | } |
dan_ackme | 10:735194df0097 | 68 | |
dan_ackme | 10:735194df0097 | 69 | function hashUrl() |
dan_ackme | 10:735194df0097 | 70 | { |
dan_ackme | 10:735194df0097 | 71 | return '#'+hashValue(); |
dan_ackme | 10:735194df0097 | 72 | } |
dan_ackme | 10:735194df0097 | 73 | |
dan_ackme | 10:735194df0097 | 74 | function pathName() |
dan_ackme | 10:735194df0097 | 75 | { |
dan_ackme | 10:735194df0097 | 76 | return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); |
dan_ackme | 10:735194df0097 | 77 | } |
dan_ackme | 10:735194df0097 | 78 | |
dan_ackme | 10:735194df0097 | 79 | function localStorageSupported() |
dan_ackme | 10:735194df0097 | 80 | { |
dan_ackme | 10:735194df0097 | 81 | try { |
dan_ackme | 10:735194df0097 | 82 | return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; |
dan_ackme | 10:735194df0097 | 83 | } |
dan_ackme | 10:735194df0097 | 84 | catch(e) { |
dan_ackme | 10:735194df0097 | 85 | return false; |
dan_ackme | 10:735194df0097 | 86 | } |
dan_ackme | 10:735194df0097 | 87 | } |
dan_ackme | 10:735194df0097 | 88 | |
dan_ackme | 10:735194df0097 | 89 | |
dan_ackme | 10:735194df0097 | 90 | function storeLink(link) |
dan_ackme | 10:735194df0097 | 91 | { |
dan_ackme | 10:735194df0097 | 92 | if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { |
dan_ackme | 10:735194df0097 | 93 | window.localStorage.setItem('navpath',link); |
dan_ackme | 10:735194df0097 | 94 | } |
dan_ackme | 10:735194df0097 | 95 | } |
dan_ackme | 10:735194df0097 | 96 | |
dan_ackme | 10:735194df0097 | 97 | function deleteLink() |
dan_ackme | 10:735194df0097 | 98 | { |
dan_ackme | 10:735194df0097 | 99 | if (localStorageSupported()) { |
dan_ackme | 10:735194df0097 | 100 | window.localStorage.setItem('navpath',''); |
dan_ackme | 10:735194df0097 | 101 | } |
dan_ackme | 10:735194df0097 | 102 | } |
dan_ackme | 10:735194df0097 | 103 | |
dan_ackme | 10:735194df0097 | 104 | function cachedLink() |
dan_ackme | 10:735194df0097 | 105 | { |
dan_ackme | 10:735194df0097 | 106 | if (localStorageSupported()) { |
dan_ackme | 10:735194df0097 | 107 | return window.localStorage.getItem('navpath'); |
dan_ackme | 10:735194df0097 | 108 | } else { |
dan_ackme | 10:735194df0097 | 109 | return ''; |
dan_ackme | 10:735194df0097 | 110 | } |
dan_ackme | 10:735194df0097 | 111 | } |
dan_ackme | 10:735194df0097 | 112 | |
dan_ackme | 10:735194df0097 | 113 | function getScript(scriptName,func,show) |
dan_ackme | 10:735194df0097 | 114 | { |
dan_ackme | 10:735194df0097 | 115 | var head = document.getElementsByTagName("head")[0]; |
dan_ackme | 10:735194df0097 | 116 | var script = document.createElement('script'); |
dan_ackme | 10:735194df0097 | 117 | script.id = scriptName; |
dan_ackme | 10:735194df0097 | 118 | script.type = 'text/javascript'; |
dan_ackme | 10:735194df0097 | 119 | script.onload = func; |
dan_ackme | 10:735194df0097 | 120 | script.src = scriptName+'.js'; |
dan_ackme | 10:735194df0097 | 121 | if ($.browser.msie && $.browser.version<=8) { |
dan_ackme | 10:735194df0097 | 122 | // script.onload does not work with older versions of IE |
dan_ackme | 10:735194df0097 | 123 | script.onreadystatechange = function() { |
dan_ackme | 10:735194df0097 | 124 | if (script.readyState=='complete' || script.readyState=='loaded') { |
dan_ackme | 10:735194df0097 | 125 | func(); if (show) showRoot(); |
dan_ackme | 10:735194df0097 | 126 | } |
dan_ackme | 10:735194df0097 | 127 | } |
dan_ackme | 10:735194df0097 | 128 | } |
dan_ackme | 10:735194df0097 | 129 | head.appendChild(script); |
dan_ackme | 10:735194df0097 | 130 | } |
dan_ackme | 10:735194df0097 | 131 | |
dan_ackme | 10:735194df0097 | 132 | function createIndent(o,domNode,node,level) |
dan_ackme | 10:735194df0097 | 133 | { |
dan_ackme | 10:735194df0097 | 134 | var level=-1; |
dan_ackme | 10:735194df0097 | 135 | var n = node; |
dan_ackme | 10:735194df0097 | 136 | while (n.parentNode) { level++; n=n.parentNode; } |
dan_ackme | 10:735194df0097 | 137 | if (node.childrenData) { |
dan_ackme | 10:735194df0097 | 138 | var imgNode = document.createElement("img"); |
dan_ackme | 10:735194df0097 | 139 | imgNode.style.paddingLeft=(16*level).toString()+'px'; |
dan_ackme | 10:735194df0097 | 140 | imgNode.width = 16; |
dan_ackme | 10:735194df0097 | 141 | imgNode.height = 22; |
dan_ackme | 10:735194df0097 | 142 | imgNode.border = 0; |
dan_ackme | 10:735194df0097 | 143 | node.plus_img = imgNode; |
dan_ackme | 10:735194df0097 | 144 | node.expandToggle = document.createElement("a"); |
dan_ackme | 10:735194df0097 | 145 | node.expandToggle.href = "javascript:void(0)"; |
dan_ackme | 10:735194df0097 | 146 | node.expandToggle.onclick = function() { |
dan_ackme | 10:735194df0097 | 147 | if (node.expanded) { |
dan_ackme | 10:735194df0097 | 148 | $(node.getChildrenUL()).slideUp("fast"); |
dan_ackme | 10:735194df0097 | 149 | node.plus_img.src = node.relpath+"ftv2pnode.png"; |
dan_ackme | 10:735194df0097 | 150 | node.expanded = false; |
dan_ackme | 10:735194df0097 | 151 | } else { |
dan_ackme | 10:735194df0097 | 152 | expandNode(o, node, false, false); |
dan_ackme | 10:735194df0097 | 153 | } |
dan_ackme | 10:735194df0097 | 154 | } |
dan_ackme | 10:735194df0097 | 155 | node.expandToggle.appendChild(imgNode); |
dan_ackme | 10:735194df0097 | 156 | domNode.appendChild(node.expandToggle); |
dan_ackme | 10:735194df0097 | 157 | imgNode.src = node.relpath+"ftv2pnode.png"; |
dan_ackme | 10:735194df0097 | 158 | } else { |
dan_ackme | 10:735194df0097 | 159 | var span = document.createElement("span"); |
dan_ackme | 10:735194df0097 | 160 | span.style.display = 'inline-block'; |
dan_ackme | 10:735194df0097 | 161 | span.style.width = 16*(level+1)+'px'; |
dan_ackme | 10:735194df0097 | 162 | span.style.height = '22px'; |
dan_ackme | 10:735194df0097 | 163 | span.innerHTML = ' '; |
dan_ackme | 10:735194df0097 | 164 | domNode.appendChild(span); |
dan_ackme | 10:735194df0097 | 165 | } |
dan_ackme | 10:735194df0097 | 166 | } |
dan_ackme | 10:735194df0097 | 167 | |
dan_ackme | 10:735194df0097 | 168 | var animationInProgress = false; |
dan_ackme | 10:735194df0097 | 169 | |
dan_ackme | 10:735194df0097 | 170 | function gotoAnchor(anchor,aname,updateLocation) |
dan_ackme | 10:735194df0097 | 171 | { |
dan_ackme | 10:735194df0097 | 172 | var pos, docContent = $('#doc-content'); |
dan_ackme | 10:735194df0097 | 173 | var ancParent = $(anchor.parent()); |
dan_ackme | 10:735194df0097 | 174 | if (ancParent.hasClass('memItemLeft') || |
dan_ackme | 10:735194df0097 | 175 | ancParent.hasClass('fieldname') || |
dan_ackme | 10:735194df0097 | 176 | ancParent.hasClass('fieldtype') || |
dan_ackme | 10:735194df0097 | 177 | ancParent.is(':header')) |
dan_ackme | 10:735194df0097 | 178 | { |
dan_ackme | 10:735194df0097 | 179 | pos = ancParent.position().top; |
dan_ackme | 10:735194df0097 | 180 | } else if (anchor.position()) { |
dan_ackme | 10:735194df0097 | 181 | pos = anchor.position().top; |
dan_ackme | 10:735194df0097 | 182 | } |
dan_ackme | 10:735194df0097 | 183 | if (pos) { |
dan_ackme | 10:735194df0097 | 184 | var dist = Math.abs(Math.min( |
dan_ackme | 10:735194df0097 | 185 | pos-docContent.offset().top, |
dan_ackme | 10:735194df0097 | 186 | docContent[0].scrollHeight- |
dan_ackme | 10:735194df0097 | 187 | docContent.height()-docContent.scrollTop())); |
dan_ackme | 10:735194df0097 | 188 | animationInProgress=true; |
dan_ackme | 10:735194df0097 | 189 | docContent.animate({ |
dan_ackme | 10:735194df0097 | 190 | scrollTop: pos + docContent.scrollTop() - docContent.offset().top |
dan_ackme | 10:735194df0097 | 191 | },Math.max(50,Math.min(500,dist)),function(){ |
dan_ackme | 10:735194df0097 | 192 | if (updateLocation) window.location.href=aname; |
dan_ackme | 10:735194df0097 | 193 | animationInProgress=false; |
dan_ackme | 10:735194df0097 | 194 | }); |
dan_ackme | 10:735194df0097 | 195 | } |
dan_ackme | 10:735194df0097 | 196 | } |
dan_ackme | 10:735194df0097 | 197 | |
dan_ackme | 10:735194df0097 | 198 | function newNode(o, po, text, link, childrenData, lastNode) |
dan_ackme | 10:735194df0097 | 199 | { |
dan_ackme | 10:735194df0097 | 200 | var node = new Object(); |
dan_ackme | 10:735194df0097 | 201 | node.children = Array(); |
dan_ackme | 10:735194df0097 | 202 | node.childrenData = childrenData; |
dan_ackme | 10:735194df0097 | 203 | node.depth = po.depth + 1; |
dan_ackme | 10:735194df0097 | 204 | node.relpath = po.relpath; |
dan_ackme | 10:735194df0097 | 205 | node.isLast = lastNode; |
dan_ackme | 10:735194df0097 | 206 | |
dan_ackme | 10:735194df0097 | 207 | node.li = document.createElement("li"); |
dan_ackme | 10:735194df0097 | 208 | po.getChildrenUL().appendChild(node.li); |
dan_ackme | 10:735194df0097 | 209 | node.parentNode = po; |
dan_ackme | 10:735194df0097 | 210 | |
dan_ackme | 10:735194df0097 | 211 | node.itemDiv = document.createElement("div"); |
dan_ackme | 10:735194df0097 | 212 | node.itemDiv.className = "item"; |
dan_ackme | 10:735194df0097 | 213 | |
dan_ackme | 10:735194df0097 | 214 | node.labelSpan = document.createElement("span"); |
dan_ackme | 10:735194df0097 | 215 | node.labelSpan.className = "label"; |
dan_ackme | 10:735194df0097 | 216 | |
dan_ackme | 10:735194df0097 | 217 | createIndent(o,node.itemDiv,node,0); |
dan_ackme | 10:735194df0097 | 218 | node.itemDiv.appendChild(node.labelSpan); |
dan_ackme | 10:735194df0097 | 219 | node.li.appendChild(node.itemDiv); |
dan_ackme | 10:735194df0097 | 220 | |
dan_ackme | 10:735194df0097 | 221 | var a = document.createElement("a"); |
dan_ackme | 10:735194df0097 | 222 | node.labelSpan.appendChild(a); |
dan_ackme | 10:735194df0097 | 223 | node.label = document.createTextNode(text); |
dan_ackme | 10:735194df0097 | 224 | node.expanded = false; |
dan_ackme | 10:735194df0097 | 225 | a.appendChild(node.label); |
dan_ackme | 10:735194df0097 | 226 | if (link) { |
dan_ackme | 10:735194df0097 | 227 | var url; |
dan_ackme | 10:735194df0097 | 228 | if (link.substring(0,1)=='^') { |
dan_ackme | 10:735194df0097 | 229 | url = link.substring(1); |
dan_ackme | 10:735194df0097 | 230 | link = url; |
dan_ackme | 10:735194df0097 | 231 | } else { |
dan_ackme | 10:735194df0097 | 232 | url = node.relpath+link; |
dan_ackme | 10:735194df0097 | 233 | } |
dan_ackme | 10:735194df0097 | 234 | a.className = stripPath(link.replace('#',':')); |
dan_ackme | 10:735194df0097 | 235 | if (link.indexOf('#')!=-1) { |
dan_ackme | 10:735194df0097 | 236 | var aname = '#'+link.split('#')[1]; |
dan_ackme | 10:735194df0097 | 237 | var srcPage = stripPath(pathName()); |
dan_ackme | 10:735194df0097 | 238 | var targetPage = stripPath(link.split('#')[0]); |
dan_ackme | 10:735194df0097 | 239 | a.href = srcPage!=targetPage ? url : "javascript:void(0)"; |
dan_ackme | 10:735194df0097 | 240 | a.onclick = function(){ |
dan_ackme | 10:735194df0097 | 241 | storeLink(link); |
dan_ackme | 10:735194df0097 | 242 | if (!$(a).parent().parent().hasClass('selected')) |
dan_ackme | 10:735194df0097 | 243 | { |
dan_ackme | 10:735194df0097 | 244 | $('.item').removeClass('selected'); |
dan_ackme | 10:735194df0097 | 245 | $('.item').removeAttr('id'); |
dan_ackme | 10:735194df0097 | 246 | $(a).parent().parent().addClass('selected'); |
dan_ackme | 10:735194df0097 | 247 | $(a).parent().parent().attr('id','selected'); |
dan_ackme | 10:735194df0097 | 248 | } |
dan_ackme | 10:735194df0097 | 249 | var anchor = $(aname); |
dan_ackme | 10:735194df0097 | 250 | gotoAnchor(anchor,aname,true); |
dan_ackme | 10:735194df0097 | 251 | }; |
dan_ackme | 10:735194df0097 | 252 | } else { |
dan_ackme | 10:735194df0097 | 253 | a.href = url; |
dan_ackme | 10:735194df0097 | 254 | a.onclick = function() { storeLink(link); } |
dan_ackme | 10:735194df0097 | 255 | } |
dan_ackme | 10:735194df0097 | 256 | } else { |
dan_ackme | 10:735194df0097 | 257 | if (childrenData != null) |
dan_ackme | 10:735194df0097 | 258 | { |
dan_ackme | 10:735194df0097 | 259 | a.className = "nolink"; |
dan_ackme | 10:735194df0097 | 260 | a.href = "javascript:void(0)"; |
dan_ackme | 10:735194df0097 | 261 | a.onclick = node.expandToggle.onclick; |
dan_ackme | 10:735194df0097 | 262 | } |
dan_ackme | 10:735194df0097 | 263 | } |
dan_ackme | 10:735194df0097 | 264 | |
dan_ackme | 10:735194df0097 | 265 | node.childrenUL = null; |
dan_ackme | 10:735194df0097 | 266 | node.getChildrenUL = function() { |
dan_ackme | 10:735194df0097 | 267 | if (!node.childrenUL) { |
dan_ackme | 10:735194df0097 | 268 | node.childrenUL = document.createElement("ul"); |
dan_ackme | 10:735194df0097 | 269 | node.childrenUL.className = "children_ul"; |
dan_ackme | 10:735194df0097 | 270 | node.childrenUL.style.display = "none"; |
dan_ackme | 10:735194df0097 | 271 | node.li.appendChild(node.childrenUL); |
dan_ackme | 10:735194df0097 | 272 | } |
dan_ackme | 10:735194df0097 | 273 | return node.childrenUL; |
dan_ackme | 10:735194df0097 | 274 | }; |
dan_ackme | 10:735194df0097 | 275 | |
dan_ackme | 10:735194df0097 | 276 | return node; |
dan_ackme | 10:735194df0097 | 277 | } |
dan_ackme | 10:735194df0097 | 278 | |
dan_ackme | 10:735194df0097 | 279 | function showRoot() |
dan_ackme | 10:735194df0097 | 280 | { |
dan_ackme | 10:735194df0097 | 281 | var headerHeight = $("#top").height(); |
dan_ackme | 10:735194df0097 | 282 | var footerHeight = $("#nav-path").height(); |
dan_ackme | 10:735194df0097 | 283 | var windowHeight = $(window).height() - headerHeight - footerHeight; |
dan_ackme | 10:735194df0097 | 284 | (function (){ // retry until we can scroll to the selected item |
dan_ackme | 10:735194df0097 | 285 | try { |
dan_ackme | 10:735194df0097 | 286 | var navtree=$('#nav-tree'); |
dan_ackme | 10:735194df0097 | 287 | navtree.scrollTo('#selected',0,{offset:-windowHeight/2}); |
dan_ackme | 10:735194df0097 | 288 | } catch (err) { |
dan_ackme | 10:735194df0097 | 289 | setTimeout(arguments.callee, 0); |
dan_ackme | 10:735194df0097 | 290 | } |
dan_ackme | 10:735194df0097 | 291 | })(); |
dan_ackme | 10:735194df0097 | 292 | } |
dan_ackme | 10:735194df0097 | 293 | |
dan_ackme | 10:735194df0097 | 294 | function expandNode(o, node, imm, showRoot) |
dan_ackme | 10:735194df0097 | 295 | { |
dan_ackme | 10:735194df0097 | 296 | if (node.childrenData && !node.expanded) { |
dan_ackme | 10:735194df0097 | 297 | if (typeof(node.childrenData)==='string') { |
dan_ackme | 10:735194df0097 | 298 | var varName = node.childrenData; |
dan_ackme | 10:735194df0097 | 299 | getScript(node.relpath+varName,function(){ |
dan_ackme | 10:735194df0097 | 300 | node.childrenData = getData(varName); |
dan_ackme | 10:735194df0097 | 301 | expandNode(o, node, imm, showRoot); |
dan_ackme | 10:735194df0097 | 302 | }, showRoot); |
dan_ackme | 10:735194df0097 | 303 | } else { |
dan_ackme | 10:735194df0097 | 304 | if (!node.childrenVisited) { |
dan_ackme | 10:735194df0097 | 305 | getNode(o, node); |
dan_ackme | 10:735194df0097 | 306 | } if (imm || ($.browser.msie && $.browser.version>8)) { |
dan_ackme | 10:735194df0097 | 307 | // somehow slideDown jumps to the start of tree for IE9 :-( |
dan_ackme | 10:735194df0097 | 308 | $(node.getChildrenUL()).show(); |
dan_ackme | 10:735194df0097 | 309 | } else { |
dan_ackme | 10:735194df0097 | 310 | $(node.getChildrenUL()).slideDown("fast"); |
dan_ackme | 10:735194df0097 | 311 | } |
dan_ackme | 10:735194df0097 | 312 | if (node.isLast) { |
dan_ackme | 10:735194df0097 | 313 | node.plus_img.src = node.relpath+"ftv2mlastnode.png"; |
dan_ackme | 10:735194df0097 | 314 | } else { |
dan_ackme | 10:735194df0097 | 315 | node.plus_img.src = node.relpath+"ftv2mnode.png"; |
dan_ackme | 10:735194df0097 | 316 | } |
dan_ackme | 10:735194df0097 | 317 | node.expanded = true; |
dan_ackme | 10:735194df0097 | 318 | } |
dan_ackme | 10:735194df0097 | 319 | } |
dan_ackme | 10:735194df0097 | 320 | } |
dan_ackme | 10:735194df0097 | 321 | |
dan_ackme | 10:735194df0097 | 322 | function glowEffect(n,duration) |
dan_ackme | 10:735194df0097 | 323 | { |
dan_ackme | 10:735194df0097 | 324 | n.addClass('glow').delay(duration).queue(function(next){ |
dan_ackme | 10:735194df0097 | 325 | $(this).removeClass('glow');next(); |
dan_ackme | 10:735194df0097 | 326 | }); |
dan_ackme | 10:735194df0097 | 327 | } |
dan_ackme | 10:735194df0097 | 328 | |
dan_ackme | 10:735194df0097 | 329 | function highlightAnchor() |
dan_ackme | 10:735194df0097 | 330 | { |
dan_ackme | 10:735194df0097 | 331 | var aname = hashUrl(); |
dan_ackme | 10:735194df0097 | 332 | var anchor = $(aname); |
dan_ackme | 10:735194df0097 | 333 | if (anchor.parent().attr('class')=='memItemLeft'){ |
dan_ackme | 10:735194df0097 | 334 | var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); |
dan_ackme | 10:735194df0097 | 335 | glowEffect(rows.children(),300); // member without details |
dan_ackme | 10:735194df0097 | 336 | } else if (anchor.parent().attr('class')=='fieldname'){ |
dan_ackme | 10:735194df0097 | 337 | glowEffect(anchor.parent().parent(),1000); // enum value |
dan_ackme | 10:735194df0097 | 338 | } else if (anchor.parent().attr('class')=='fieldtype'){ |
dan_ackme | 10:735194df0097 | 339 | glowEffect(anchor.parent().parent(),1000); // struct field |
dan_ackme | 10:735194df0097 | 340 | } else if (anchor.parent().is(":header")) { |
dan_ackme | 10:735194df0097 | 341 | glowEffect(anchor.parent(),1000); // section header |
dan_ackme | 10:735194df0097 | 342 | } else { |
dan_ackme | 10:735194df0097 | 343 | glowEffect(anchor.next(),1000); // normal member |
dan_ackme | 10:735194df0097 | 344 | } |
dan_ackme | 10:735194df0097 | 345 | gotoAnchor(anchor,aname,false); |
dan_ackme | 10:735194df0097 | 346 | } |
dan_ackme | 10:735194df0097 | 347 | |
dan_ackme | 10:735194df0097 | 348 | function selectAndHighlight(hash,n) |
dan_ackme | 10:735194df0097 | 349 | { |
dan_ackme | 10:735194df0097 | 350 | var a; |
dan_ackme | 10:735194df0097 | 351 | if (hash) { |
dan_ackme | 10:735194df0097 | 352 | var link=stripPath(pathName())+':'+hash.substring(1); |
dan_ackme | 10:735194df0097 | 353 | a=$('.item a[class$="'+link+'"]'); |
dan_ackme | 10:735194df0097 | 354 | } |
dan_ackme | 10:735194df0097 | 355 | if (a && a.length) { |
dan_ackme | 10:735194df0097 | 356 | a.parent().parent().addClass('selected'); |
dan_ackme | 10:735194df0097 | 357 | a.parent().parent().attr('id','selected'); |
dan_ackme | 10:735194df0097 | 358 | highlightAnchor(); |
dan_ackme | 10:735194df0097 | 359 | } else if (n) { |
dan_ackme | 10:735194df0097 | 360 | $(n.itemDiv).addClass('selected'); |
dan_ackme | 10:735194df0097 | 361 | $(n.itemDiv).attr('id','selected'); |
dan_ackme | 10:735194df0097 | 362 | } |
dan_ackme | 10:735194df0097 | 363 | if ($('#nav-tree-contents .item:first').hasClass('selected')) { |
dan_ackme | 10:735194df0097 | 364 | $('#nav-sync').css('top','30px'); |
dan_ackme | 10:735194df0097 | 365 | } else { |
dan_ackme | 10:735194df0097 | 366 | $('#nav-sync').css('top','5px'); |
dan_ackme | 10:735194df0097 | 367 | } |
dan_ackme | 10:735194df0097 | 368 | showRoot(); |
dan_ackme | 10:735194df0097 | 369 | } |
dan_ackme | 10:735194df0097 | 370 | |
dan_ackme | 10:735194df0097 | 371 | function showNode(o, node, index, hash) |
dan_ackme | 10:735194df0097 | 372 | { |
dan_ackme | 10:735194df0097 | 373 | if (node && node.childrenData) { |
dan_ackme | 10:735194df0097 | 374 | if (typeof(node.childrenData)==='string') { |
dan_ackme | 10:735194df0097 | 375 | var varName = node.childrenData; |
dan_ackme | 10:735194df0097 | 376 | getScript(node.relpath+varName,function(){ |
dan_ackme | 10:735194df0097 | 377 | node.childrenData = getData(varName); |
dan_ackme | 10:735194df0097 | 378 | showNode(o,node,index,hash); |
dan_ackme | 10:735194df0097 | 379 | },true); |
dan_ackme | 10:735194df0097 | 380 | } else { |
dan_ackme | 10:735194df0097 | 381 | if (!node.childrenVisited) { |
dan_ackme | 10:735194df0097 | 382 | getNode(o, node); |
dan_ackme | 10:735194df0097 | 383 | } |
dan_ackme | 10:735194df0097 | 384 | $(node.getChildrenUL()).css({'display':'block'}); |
dan_ackme | 10:735194df0097 | 385 | if (node.isLast) { |
dan_ackme | 10:735194df0097 | 386 | node.plus_img.src = node.relpath+"ftv2mlastnode.png"; |
dan_ackme | 10:735194df0097 | 387 | } else { |
dan_ackme | 10:735194df0097 | 388 | node.plus_img.src = node.relpath+"ftv2mnode.png"; |
dan_ackme | 10:735194df0097 | 389 | } |
dan_ackme | 10:735194df0097 | 390 | node.expanded = true; |
dan_ackme | 10:735194df0097 | 391 | var n = node.children[o.breadcrumbs[index]]; |
dan_ackme | 10:735194df0097 | 392 | if (index+1<o.breadcrumbs.length) { |
dan_ackme | 10:735194df0097 | 393 | showNode(o,n,index+1,hash); |
dan_ackme | 10:735194df0097 | 394 | } else { |
dan_ackme | 10:735194df0097 | 395 | if (typeof(n.childrenData)==='string') { |
dan_ackme | 10:735194df0097 | 396 | var varName = n.childrenData; |
dan_ackme | 10:735194df0097 | 397 | getScript(n.relpath+varName,function(){ |
dan_ackme | 10:735194df0097 | 398 | n.childrenData = getData(varName); |
dan_ackme | 10:735194df0097 | 399 | node.expanded=false; |
dan_ackme | 10:735194df0097 | 400 | showNode(o,node,index,hash); // retry with child node expanded |
dan_ackme | 10:735194df0097 | 401 | },true); |
dan_ackme | 10:735194df0097 | 402 | } else { |
dan_ackme | 10:735194df0097 | 403 | var rootBase = stripPath(o.toroot.replace(/\..+$/, '')); |
dan_ackme | 10:735194df0097 | 404 | if (rootBase=="index" || rootBase=="pages" || rootBase=="search") { |
dan_ackme | 10:735194df0097 | 405 | expandNode(o, n, true, true); |
dan_ackme | 10:735194df0097 | 406 | } |
dan_ackme | 10:735194df0097 | 407 | selectAndHighlight(hash,n); |
dan_ackme | 10:735194df0097 | 408 | } |
dan_ackme | 10:735194df0097 | 409 | } |
dan_ackme | 10:735194df0097 | 410 | } |
dan_ackme | 10:735194df0097 | 411 | } else { |
dan_ackme | 10:735194df0097 | 412 | selectAndHighlight(hash); |
dan_ackme | 10:735194df0097 | 413 | } |
dan_ackme | 10:735194df0097 | 414 | } |
dan_ackme | 10:735194df0097 | 415 | |
dan_ackme | 10:735194df0097 | 416 | function removeToInsertLater(element) { |
dan_ackme | 10:735194df0097 | 417 | var parentNode = element.parentNode; |
dan_ackme | 10:735194df0097 | 418 | var nextSibling = element.nextSibling; |
dan_ackme | 10:735194df0097 | 419 | parentNode.removeChild(element); |
dan_ackme | 10:735194df0097 | 420 | return function() { |
dan_ackme | 10:735194df0097 | 421 | if (nextSibling) { |
dan_ackme | 10:735194df0097 | 422 | parentNode.insertBefore(element, nextSibling); |
dan_ackme | 10:735194df0097 | 423 | } else { |
dan_ackme | 10:735194df0097 | 424 | parentNode.appendChild(element); |
dan_ackme | 10:735194df0097 | 425 | } |
dan_ackme | 10:735194df0097 | 426 | }; |
dan_ackme | 10:735194df0097 | 427 | } |
dan_ackme | 10:735194df0097 | 428 | |
dan_ackme | 10:735194df0097 | 429 | function getNode(o, po) |
dan_ackme | 10:735194df0097 | 430 | { |
dan_ackme | 10:735194df0097 | 431 | var insertFunction = removeToInsertLater(po.li); |
dan_ackme | 10:735194df0097 | 432 | po.childrenVisited = true; |
dan_ackme | 10:735194df0097 | 433 | var l = po.childrenData.length-1; |
dan_ackme | 10:735194df0097 | 434 | for (var i in po.childrenData) { |
dan_ackme | 10:735194df0097 | 435 | var nodeData = po.childrenData[i]; |
dan_ackme | 10:735194df0097 | 436 | po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], |
dan_ackme | 10:735194df0097 | 437 | i==l); |
dan_ackme | 10:735194df0097 | 438 | } |
dan_ackme | 10:735194df0097 | 439 | insertFunction(); |
dan_ackme | 10:735194df0097 | 440 | } |
dan_ackme | 10:735194df0097 | 441 | |
dan_ackme | 10:735194df0097 | 442 | function gotoNode(o,subIndex,root,hash,relpath) |
dan_ackme | 10:735194df0097 | 443 | { |
dan_ackme | 10:735194df0097 | 444 | var nti = navTreeSubIndices[subIndex][root+hash]; |
dan_ackme | 10:735194df0097 | 445 | o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]); |
dan_ackme | 10:735194df0097 | 446 | if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index |
dan_ackme | 10:735194df0097 | 447 | navTo(o,NAVTREE[0][1],"",relpath); |
dan_ackme | 10:735194df0097 | 448 | $('.item').removeClass('selected'); |
dan_ackme | 10:735194df0097 | 449 | $('.item').removeAttr('id'); |
dan_ackme | 10:735194df0097 | 450 | } |
dan_ackme | 10:735194df0097 | 451 | if (o.breadcrumbs) { |
dan_ackme | 10:735194df0097 | 452 | o.breadcrumbs.unshift(0); // add 0 for root node |
dan_ackme | 10:735194df0097 | 453 | showNode(o, o.node, 0, hash); |
dan_ackme | 10:735194df0097 | 454 | } |
dan_ackme | 10:735194df0097 | 455 | } |
dan_ackme | 10:735194df0097 | 456 | |
dan_ackme | 10:735194df0097 | 457 | function navTo(o,root,hash,relpath) |
dan_ackme | 10:735194df0097 | 458 | { |
dan_ackme | 10:735194df0097 | 459 | var link = cachedLink(); |
dan_ackme | 10:735194df0097 | 460 | if (link) { |
dan_ackme | 10:735194df0097 | 461 | var parts = link.split('#'); |
dan_ackme | 10:735194df0097 | 462 | root = parts[0]; |
dan_ackme | 10:735194df0097 | 463 | if (parts.length>1) hash = '#'+parts[1].replace(/[^\w\-]/g,''); |
dan_ackme | 10:735194df0097 | 464 | else hash=''; |
dan_ackme | 10:735194df0097 | 465 | } |
dan_ackme | 10:735194df0097 | 466 | if (hash.match(/^#l\d+$/)) { |
dan_ackme | 10:735194df0097 | 467 | var anchor=$('a[name='+hash.substring(1)+']'); |
dan_ackme | 10:735194df0097 | 468 | glowEffect(anchor.parent(),1000); // line number |
dan_ackme | 10:735194df0097 | 469 | hash=''; // strip line number anchors |
dan_ackme | 10:735194df0097 | 470 | } |
dan_ackme | 10:735194df0097 | 471 | var url=root+hash; |
dan_ackme | 10:735194df0097 | 472 | var i=-1; |
dan_ackme | 10:735194df0097 | 473 | while (NAVTREEINDEX[i+1]<=url) i++; |
dan_ackme | 10:735194df0097 | 474 | if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index |
dan_ackme | 10:735194df0097 | 475 | if (navTreeSubIndices[i]) { |
dan_ackme | 10:735194df0097 | 476 | gotoNode(o,i,root,hash,relpath) |
dan_ackme | 10:735194df0097 | 477 | } else { |
dan_ackme | 10:735194df0097 | 478 | getScript(relpath+'navtreeindex'+i,function(){ |
dan_ackme | 10:735194df0097 | 479 | navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); |
dan_ackme | 10:735194df0097 | 480 | if (navTreeSubIndices[i]) { |
dan_ackme | 10:735194df0097 | 481 | gotoNode(o,i,root,hash,relpath); |
dan_ackme | 10:735194df0097 | 482 | } |
dan_ackme | 10:735194df0097 | 483 | },true); |
dan_ackme | 10:735194df0097 | 484 | } |
dan_ackme | 10:735194df0097 | 485 | } |
dan_ackme | 10:735194df0097 | 486 | |
dan_ackme | 10:735194df0097 | 487 | function showSyncOff(n,relpath) |
dan_ackme | 10:735194df0097 | 488 | { |
dan_ackme | 10:735194df0097 | 489 | n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>'); |
dan_ackme | 10:735194df0097 | 490 | } |
dan_ackme | 10:735194df0097 | 491 | |
dan_ackme | 10:735194df0097 | 492 | function showSyncOn(n,relpath) |
dan_ackme | 10:735194df0097 | 493 | { |
dan_ackme | 10:735194df0097 | 494 | n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>'); |
dan_ackme | 10:735194df0097 | 495 | } |
dan_ackme | 10:735194df0097 | 496 | |
dan_ackme | 10:735194df0097 | 497 | function toggleSyncButton(relpath) |
dan_ackme | 10:735194df0097 | 498 | { |
dan_ackme | 10:735194df0097 | 499 | var navSync = $('#nav-sync'); |
dan_ackme | 10:735194df0097 | 500 | if (navSync.hasClass('sync')) { |
dan_ackme | 10:735194df0097 | 501 | navSync.removeClass('sync'); |
dan_ackme | 10:735194df0097 | 502 | showSyncOff(navSync,relpath); |
dan_ackme | 10:735194df0097 | 503 | storeLink(stripPath2(pathName())+hashUrl()); |
dan_ackme | 10:735194df0097 | 504 | } else { |
dan_ackme | 10:735194df0097 | 505 | navSync.addClass('sync'); |
dan_ackme | 10:735194df0097 | 506 | showSyncOn(navSync,relpath); |
dan_ackme | 10:735194df0097 | 507 | deleteLink(); |
dan_ackme | 10:735194df0097 | 508 | } |
dan_ackme | 10:735194df0097 | 509 | } |
dan_ackme | 10:735194df0097 | 510 | |
dan_ackme | 10:735194df0097 | 511 | function initNavTree(toroot,relpath) |
dan_ackme | 10:735194df0097 | 512 | { |
dan_ackme | 10:735194df0097 | 513 | var o = new Object(); |
dan_ackme | 10:735194df0097 | 514 | o.toroot = toroot; |
dan_ackme | 10:735194df0097 | 515 | o.node = new Object(); |
dan_ackme | 10:735194df0097 | 516 | o.node.li = document.getElementById("nav-tree-contents"); |
dan_ackme | 10:735194df0097 | 517 | o.node.childrenData = NAVTREE; |
dan_ackme | 10:735194df0097 | 518 | o.node.children = new Array(); |
dan_ackme | 10:735194df0097 | 519 | o.node.childrenUL = document.createElement("ul"); |
dan_ackme | 10:735194df0097 | 520 | o.node.getChildrenUL = function() { return o.node.childrenUL; }; |
dan_ackme | 10:735194df0097 | 521 | o.node.li.appendChild(o.node.childrenUL); |
dan_ackme | 10:735194df0097 | 522 | o.node.depth = 0; |
dan_ackme | 10:735194df0097 | 523 | o.node.relpath = relpath; |
dan_ackme | 10:735194df0097 | 524 | o.node.expanded = false; |
dan_ackme | 10:735194df0097 | 525 | o.node.isLast = true; |
dan_ackme | 10:735194df0097 | 526 | o.node.plus_img = document.createElement("img"); |
dan_ackme | 10:735194df0097 | 527 | o.node.plus_img.src = relpath+"ftv2pnode.png"; |
dan_ackme | 10:735194df0097 | 528 | o.node.plus_img.width = 16; |
dan_ackme | 10:735194df0097 | 529 | o.node.plus_img.height = 22; |
dan_ackme | 10:735194df0097 | 530 | |
dan_ackme | 10:735194df0097 | 531 | if (localStorageSupported()) { |
dan_ackme | 10:735194df0097 | 532 | var navSync = $('#nav-sync'); |
dan_ackme | 10:735194df0097 | 533 | if (cachedLink()) { |
dan_ackme | 10:735194df0097 | 534 | showSyncOff(navSync,relpath); |
dan_ackme | 10:735194df0097 | 535 | navSync.removeClass('sync'); |
dan_ackme | 10:735194df0097 | 536 | } else { |
dan_ackme | 10:735194df0097 | 537 | showSyncOn(navSync,relpath); |
dan_ackme | 10:735194df0097 | 538 | } |
dan_ackme | 10:735194df0097 | 539 | navSync.click(function(){ toggleSyncButton(relpath); }); |
dan_ackme | 10:735194df0097 | 540 | } |
dan_ackme | 10:735194df0097 | 541 | |
dan_ackme | 10:735194df0097 | 542 | $(window).load(function(){ |
dan_ackme | 10:735194df0097 | 543 | navTo(o,toroot,hashUrl(),relpath); |
dan_ackme | 10:735194df0097 | 544 | showRoot(); |
dan_ackme | 10:735194df0097 | 545 | }); |
dan_ackme | 10:735194df0097 | 546 | |
dan_ackme | 10:735194df0097 | 547 | $(window).bind('hashchange', function(){ |
dan_ackme | 10:735194df0097 | 548 | if (window.location.hash && window.location.hash.length>1){ |
dan_ackme | 10:735194df0097 | 549 | var a; |
dan_ackme | 10:735194df0097 | 550 | if ($(location).attr('hash')){ |
dan_ackme | 10:735194df0097 | 551 | var clslink=stripPath(pathName())+':'+hashValue(); |
dan_ackme | 10:735194df0097 | 552 | a=$('.item a[class$="'+clslink.replace(/</g,'\\3c ')+'"]'); |
dan_ackme | 10:735194df0097 | 553 | } |
dan_ackme | 10:735194df0097 | 554 | if (a==null || !$(a).parent().parent().hasClass('selected')){ |
dan_ackme | 10:735194df0097 | 555 | $('.item').removeClass('selected'); |
dan_ackme | 10:735194df0097 | 556 | $('.item').removeAttr('id'); |
dan_ackme | 10:735194df0097 | 557 | } |
dan_ackme | 10:735194df0097 | 558 | var link=stripPath2(pathName()); |
dan_ackme | 10:735194df0097 | 559 | navTo(o,link,hashUrl(),relpath); |
dan_ackme | 10:735194df0097 | 560 | } else if (!animationInProgress) { |
dan_ackme | 10:735194df0097 | 561 | $('#doc-content').scrollTop(0); |
dan_ackme | 10:735194df0097 | 562 | $('.item').removeClass('selected'); |
dan_ackme | 10:735194df0097 | 563 | $('.item').removeAttr('id'); |
dan_ackme | 10:735194df0097 | 564 | navTo(o,toroot,hashUrl(),relpath); |
dan_ackme | 10:735194df0097 | 565 | } |
dan_ackme | 10:735194df0097 | 566 | }) |
dan_ackme | 10:735194df0097 | 567 | } |
dan_ackme | 10:735194df0097 | 568 |