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

Committer:
dan_ackme
Date:
Tue Aug 12 02:34:46 2014 -0700
Revision:
11:ea484e1b7fc4
Parent:
10:735194df0097
Child:
13:2b51f5267c92
updated documnetation

Who changed what in which revision?

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