Fix for UBSan build
[platform/upstream/doxygen.git] / src / resize_js.h
1 "var cookie_namespace = 'doxygen'; \n"
2 "var sidenav,navtree,content,header;\n"
3 "\n"
4 "function readCookie(cookie) \n"
5 "{\n"
6 "  var myCookie = cookie_namespace+\"_\"+cookie+\"=\";\n"
7 "  if (document.cookie) \n"
8 "  {\n"
9 "    var index = document.cookie.indexOf(myCookie);\n"
10 "    if (index != -1) \n"
11 "    {\n"
12 "      var valStart = index + myCookie.length;\n"
13 "      var valEnd = document.cookie.indexOf(\";\", valStart);\n"
14 "      if (valEnd == -1) \n"
15 "      {\n"
16 "        valEnd = document.cookie.length;\n"
17 "      }\n"
18 "      var val = document.cookie.substring(valStart, valEnd);\n"
19 "      return val;\n"
20 "    }\n"
21 "  }\n"
22 "  return 0;\n"
23 "}\n"
24 "\n"
25 "function writeCookie(cookie, val, expiration) \n"
26 "{\n"
27 "  if (val==undefined) return;\n"
28 "  if (expiration == null) \n"
29 "  {\n"
30 "    var date = new Date();\n"
31 "    date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week\n"
32 "    expiration = date.toGMTString();\n"
33 "  }\n"
34 "  document.cookie = cookie_namespace + \"_\" + cookie + \"=\" + val + \"; expires=\" + expiration+\"; path=/\";\n"
35 "}\n"
36 " \n"
37 "function resizeWidth() \n"
38 "{\n"
39 "  var windowWidth = $(window).width() + \"px\";\n"
40 "  var sidenavWidth = $(sidenav).width();\n"
41 "  content.css({marginLeft:parseInt(sidenavWidth)+6+\"px\"}); //account for 6px-wide handle-bar\n"
42 "  writeCookie('width',sidenavWidth, null);\n"
43 "}\n"
44 "\n"
45 "function restoreWidth(navWidth)\n"
46 "{\n"
47 "  var windowWidth = $(window).width() + \"px\";\n"
48 "  content.css({marginLeft:parseInt(navWidth)+6+\"px\"});\n"
49 "  sidenav.css({width:navWidth + \"px\"});\n"
50 "}\n"
51 "\n"
52 "function resizeHeight() \n"
53 "{\n"
54 "  var headerHeight = header.height();\n"
55 "  var footerHeight = footer.height();\n"
56 "  var windowHeight = $(window).height() - headerHeight - footerHeight;\n"
57 "  content.css({height:windowHeight + \"px\"});\n"
58 "  navtree.css({height:windowHeight + \"px\"});\n"
59 "  sidenav.css({height:windowHeight + \"px\",top: headerHeight+\"px\"});\n"
60 "}\n"
61 "\n"
62 "function initResizable()\n"
63 "{\n"
64 "  header  = $(\"#top\");\n"
65 "  sidenav = $(\"#side-nav\");\n"
66 "  content = $(\"#doc-content\");\n"
67 "  navtree = $(\"#nav-tree\");\n"
68 "  footer  = $(\"#nav-path\");\n"
69 "  $(\".side-nav-resizable\").resizable({resize: function(e, ui) { resizeWidth(); } });\n"
70 "  $(window).resize(function() { resizeHeight(); });\n"
71 "  var width = readCookie('width');\n"
72 "  if (width) { restoreWidth(width); } else { resizeWidth(); }\n"
73 "  resizeHeight();\n"
74 "  var url = location.href;\n"
75 "  var i=url.indexOf(\"#\");\n"
76 "  if (i>=0) window.location.hash=url.substr(i);\n"
77 "  var _preventDefault = function(evt) { evt.preventDefault(); };\n"
78 "  $(\"#splitbar\").bind(\"dragstart\", _preventDefault).bind(\"selectstart\", _preventDefault);\n"
79 "  $(document).bind('touchmove',function(e){\n"
80 "    try {\n"
81 "      var target = e.target;\n"
82 "      while (target) {\n"
83 "        if ($(target).css('-webkit-overflow-scrolling')=='touch') return;\n"
84 "        target = target.parentNode;\n"
85 "      }\n"
86 "      e.preventDefault();\n"
87 "    } catch(err) {\n"
88 "      e.preventDefault();\n"
89 "    }\n"
90 "  });\n"
91 "}\n"
92 "\n"
93 "\n"