()
| 96 | } |
| 97 | |
| 98 | function add_sidebar_button() { |
| 99 | sidebarwrapper.css({ |
| 100 | 'float': 'left', |
| 101 | 'margin-right': '0', |
| 102 | 'width': ssb_width_expanded - 28 |
| 103 | }); |
| 104 | // create the button |
| 105 | sidebar.append( |
| 106 | '<div id="sidebarbutton"><span>«</span></div>' |
| 107 | ); |
| 108 | var sidebarbutton = $('#sidebarbutton'); |
| 109 | // find the height of the viewport to center the '<<' in the page |
| 110 | var viewport_height = get_viewport_height(); |
| 111 | var sidebar_offset = sidebar.offset().top; |
| 112 | var sidebar_height = Math.max(bodywrapper.height(), sidebar.height()); |
| 113 | sidebarbutton.find('span').css({ |
| 114 | 'display': 'block', |
| 115 | 'position': 'fixed', |
| 116 | 'top': Math.min(viewport_height/2, sidebar_height/2 + sidebar_offset) - 10 |
| 117 | }); |
| 118 | |
| 119 | sidebarbutton.click(toggle_sidebar); |
| 120 | sidebarbutton.attr('title', _('Collapse sidebar')); |
| 121 | sidebarbutton.css({ |
| 122 | 'border-radius': '0 5px 5px 0', |
| 123 | 'color': '#444444', |
| 124 | 'background-color': '#CCCCCC', |
| 125 | 'font-size': '1.2em', |
| 126 | 'cursor': 'pointer', |
| 127 | 'height': sidebar_height, |
| 128 | 'padding-top': '1px', |
| 129 | 'padding-left': '1px', |
| 130 | 'margin-left': ssb_width_expanded - 12 |
| 131 | }); |
| 132 | |
| 133 | sidebarbutton.hover( |
| 134 | function () { |
| 135 | $(this).css('background-color', dark_color); |
| 136 | }, |
| 137 | function () { |
| 138 | $(this).css('background-color', light_color); |
| 139 | } |
| 140 | ); |
| 141 | } |
| 142 | |
| 143 | function set_position_from_cookie() { |
| 144 | if (!document.cookie) |
no test coverage detected