aboutsummaryrefslogtreecommitdiffstats
path: root/resize.js
diff options
context:
space:
mode:
Diffstat (limited to 'resize.js')
-rw-r--r--resize.js153
1 files changed, 68 insertions, 85 deletions
diff --git a/resize.js b/resize.js
index 56e4a023..304fcb6b 100644
--- a/resize.js
+++ b/resize.js
@@ -1,104 +1,73 @@
-function initResizable()
-{
- var cookie_namespace = 'doxygen';
- var sidenav,navtree,content,header,collapsed,collapsedWidth=0,barWidth=6,desktop_vp=768,titleHeight;
+var cookie_namespace = 'doxygen';
+var sidenav,navtree,content,header;
- function readCookie(cookie)
+function readCookie(cookie)
+{
+ var myCookie = cookie_namespace+"_"+cookie+"=";
+ if (document.cookie)
{
- var myCookie = cookie_namespace+"_"+cookie+"=";
- if (document.cookie) {
- var index = document.cookie.indexOf(myCookie);
- if (index != -1) {
- var valStart = index + myCookie.length;
- var valEnd = document.cookie.indexOf(";", valStart);
- if (valEnd == -1) {
- valEnd = document.cookie.length;
- }
- var val = document.cookie.substring(valStart, valEnd);
- return val;
+ var index = document.cookie.indexOf(myCookie);
+ if (index != -1)
+ {
+ var valStart = index + myCookie.length;
+ var valEnd = document.cookie.indexOf(";", valStart);
+ if (valEnd == -1)
+ {
+ valEnd = document.cookie.length;
}
+ var val = document.cookie.substring(valStart, valEnd);
+ return val;
}
- return 0;
- }
-
- function writeCookie(cookie, val, expiration)
- {
- if (val==undefined) return;
- if (expiration == null) {
- var date = new Date();
- date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
- expiration = date.toGMTString();
- }
- document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
- }
-
- function resizeWidth()
- {
- var windowWidth = $(window).width() + "px";
- var sidenavWidth = $(sidenav).outerWidth();
- content.css({marginLeft:parseInt(sidenavWidth)+"px"});
- writeCookie('width',sidenavWidth-barWidth, null);
}
+ return 0;
+}
- function restoreWidth(navWidth)
+function writeCookie(cookie, val, expiration)
+{
+ if (val==undefined) return;
+ if (expiration == null)
{
- var windowWidth = $(window).width() + "px";
- content.css({marginLeft:parseInt(navWidth)+barWidth+"px"});
- sidenav.css({width:navWidth + "px"});
+ var date = new Date();
+ date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
+ expiration = date.toGMTString();
}
+ document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
+}
+
+function resizeWidth()
+{
+ var windowWidth = $(window).width() + "px";
+ var sidenavWidth = $(sidenav).outerWidth();
+ content.css({marginLeft:parseInt(sidenavWidth)+"px"});
+ writeCookie('width',sidenavWidth, null);
+}
- function resizeHeight()
- {
- var headerHeight = header.outerHeight();
- var footerHeight = footer.outerHeight();
- var windowHeight = $(window).height() - headerHeight - footerHeight;
- content.css({height:windowHeight + "px"});
- navtree.css({height:windowHeight + "px"});
- sidenav.css({height:windowHeight + "px"});
- var width=$(window).width();
- if (width!=collapsedWidth) {
- if (width<desktop_vp && collapsedWidth>=desktop_vp) {
- if (!collapsed) {
- collapseExpand();
- }
- } else if (width>desktop_vp && collapsedWidth<desktop_vp) {
- if (collapsed) {
- collapseExpand();
- }
- }
- collapsedWidth=width;
- }
- }
+function restoreWidth(navWidth)
+{
+ var windowWidth = $(window).width() + "px";
+ content.css({marginLeft:parseInt(navWidth)+6+"px"});
+ sidenav.css({width:navWidth + "px"});
+}
- function collapseExpand()
- {
- if (sidenav.width()>0) {
- restoreWidth(0);
- collapsed=true;
- }
- else {
- var width = readCookie('width');
- if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); }
- collapsed=false;
- }
- }
+function resizeHeight()
+{
+ var headerHeight = header.outerHeight();
+ var footerHeight = footer.outerHeight();
+ var windowHeight = $(window).height() - headerHeight - footerHeight;
+ content.css({height:windowHeight + "px"});
+ navtree.css({height:windowHeight + "px"});
+ sidenav.css({height:windowHeight + "px",top: headerHeight+"px"});
+}
+function initResizable()
+{
header = $("#top");
sidenav = $("#side-nav");
content = $("#doc-content");
navtree = $("#nav-tree");
footer = $("#nav-path");
$(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
- $(sidenav).resizable({ minWidth: 0 });
$(window).resize(function() { resizeHeight(); });
- var device = navigator.userAgent.toLowerCase();
- var touch_device = device.match(/(iphone|ipod|ipad|android)/);
- if (touch_device) { /* wider split bar for touch only devices */
- $(sidenav).css({ paddingRight:'20px' });
- $('.ui-resizable-e').css({ width:'20px' });
- $('#nav-sync').css({ right:'34px' });
- barWidth=20;
- }
var width = readCookie('width');
if (width) { restoreWidth(width); } else { resizeWidth(); }
resizeHeight();
@@ -107,8 +76,22 @@ function initResizable()
if (i>=0) window.location.hash=url.substr(i);
var _preventDefault = function(evt) { evt.preventDefault(); };
$("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
- $(".ui-resizable-handle").dblclick(collapseExpand);
- $(window).load(resizeHeight);
+ $(document).bind('touchmove',function(e){
+ var device = navigator.userAgent.toLowerCase();
+ var ios = device.match(/(iphone|ipod|ipad)/);
+ if (ios) {
+ try {
+ var target = e.target;
+ while (target) {
+ if ($(target).css('-webkit-overflow-scrolling')=='touch') return;
+ target = target.parentNode;
+ }
+ e.preventDefault();
+ } catch(err) {
+ e.preventDefault();
+ }
+ }
+ });
}