MCPcopy Create free account
hub / github.com/LabPy/lantz / add_sidebar_button

Function add_sidebar_button

docs/_themes/lantz/static/sidebar.js:86–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84 }
85
86 function add_sidebar_button() {
87 sidebarwrapper.css({
88 'float': 'left',
89 'margin-right': '0',
90 'width': ssb_width_expanded - 28
91 });
92 // create the button
93 sidebar.append(
94 '<div id="sidebarbutton"><span>&laquo;</span></div>'
95 );
96 var sidebarbutton = $('#sidebarbutton');
97 // find the height of the viewport to center the '<<' in the page
98 var viewport_height;
99 if (window.innerHeight)
100 viewport_height = window.innerHeight;
101 else
102 viewport_height = $(window).height();
103 var sidebar_offset = sidebar.offset().top;
104 var sidebar_height = Math.max(bodywrapper.height(), sidebar.height());
105 sidebarbutton.find('span').css({
106 'display': 'block',
107 'position': 'fixed',
108 'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10
109 });
110
111 sidebarbutton.click(toggle_sidebar);
112 sidebarbutton.attr('title', _('Collapse sidebar'));
113 sidebarbutton.css({
114 'border-radius': '5px',
115 'color': '#ffffff', //'#444444',
116 'background-color': '#4E9CB5',
117 'font-size': '1.2em',
118 'cursor': 'pointer',
119 'height': sidebar_height,
120 'padding-top': '1px',
121 'padding-left': '1px',
122 'margin-left': ssb_width_expanded - 12
123 });
124
125 sidebarbutton.hover(
126 function () {
127 $(this).css('background-color', dark_color);
128 },
129 function () {
130 $(this).css('background-color', light_color);
131 }
132 );
133 }
134
135 function set_position_from_cookie() {
136 if (!document.cookie)

Callers 1

sidebar.jsFile · 0.85

Calls 3

offsetMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected