Mercurial > repos > yating-l > hac
annotate doc/_build/html/_static/sidebar.js @ 0:0bca8a6364a7 draft default tip
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
| author | yating-l | 
|---|---|
| date | Wed, 21 Dec 2016 17:21:18 -0500 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 0 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 1 /* | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 2 * sidebar.js | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 3 * ~~~~~~~~~~ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 4 * | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 5 * This script makes the Sphinx sidebar collapsible. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 6 * | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 7 * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 8 * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 9 * used to collapse and expand the sidebar. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 10 * | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 11 * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 12 * and the width of the sidebar and the margin-left of the document | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 13 * are decreased. When the sidebar is expanded the opposite happens. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 14 * This script saves a per-browser/per-session cookie used to | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 15 * remember the position of the sidebar among the pages. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 16 * Once the browser is closed the cookie is deleted and the position | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 17 * reset to the default (expanded). | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 18 * | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 19 * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 20 * :license: BSD, see LICENSE for details. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 21 * | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 22 */ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 23 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 24 $(function() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 25 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 26 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 27 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 28 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 29 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 30 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 31 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 32 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 33 // global elements used by the functions. | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 34 // the 'sidebarbutton' element is defined as global after its | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 35 // creation, in the add_sidebar_button function | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 36 var bodywrapper = $('.bodywrapper'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 37 var sidebar = $('.sphinxsidebar'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 38 var sidebarwrapper = $('.sphinxsidebarwrapper'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 39 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 40 // for some reason, the document has no sidebar; do not run into errors | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 41 if (!sidebar.length) return; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 42 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 43 // original margin-left of the bodywrapper and width of the sidebar | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 44 // with the sidebar expanded | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 45 var bw_margin_expanded = bodywrapper.css('margin-left'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 46 var ssb_width_expanded = sidebar.width(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 47 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 48 // margin-left of the bodywrapper and width of the sidebar | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 49 // with the sidebar collapsed | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 50 var bw_margin_collapsed = '.8em'; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 51 var ssb_width_collapsed = '.8em'; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 52 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 53 // colors used by the current theme | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 54 var dark_color = $('.related').css('background-color'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 55 var light_color = $('.document').css('background-color'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 56 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 57 function sidebar_is_collapsed() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 58 return sidebarwrapper.is(':not(:visible)'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 59 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 60 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 61 function toggle_sidebar() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 62 if (sidebar_is_collapsed()) | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 63 expand_sidebar(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 64 else | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 65 collapse_sidebar(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 66 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 67 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 68 function collapse_sidebar() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 69 sidebarwrapper.hide(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 70 sidebar.css('width', ssb_width_collapsed); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 71 bodywrapper.css('margin-left', bw_margin_collapsed); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 72 sidebarbutton.css({ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 73 'margin-left': '0', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 74 'height': bodywrapper.height() | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 75 }); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 76 sidebarbutton.find('span').text('»'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 77 sidebarbutton.attr('title', _('Expand sidebar')); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 78 document.cookie = 'sidebar=collapsed'; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 79 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 80 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 81 function expand_sidebar() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 82 bodywrapper.css('margin-left', bw_margin_expanded); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 83 sidebar.css('width', ssb_width_expanded); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 84 sidebarwrapper.show(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 85 sidebarbutton.css({ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 86 'margin-left': ssb_width_expanded-12, | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 87 'height': bodywrapper.height() | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 88 }); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 89 sidebarbutton.find('span').text('«'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 90 sidebarbutton.attr('title', _('Collapse sidebar')); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 91 document.cookie = 'sidebar=expanded'; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 92 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 93 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 94 function add_sidebar_button() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 95 sidebarwrapper.css({ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 96 'float': 'left', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 97 'margin-right': '0', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 98 'width': ssb_width_expanded - 28 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 99 }); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 100 // create the button | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 101 sidebar.append( | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 102 '<div id="sidebarbutton"><span>«</span></div>' | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 103 ); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 104 var sidebarbutton = $('#sidebarbutton'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 105 light_color = sidebarbutton.css('background-color'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 106 // find the height of the viewport to center the '<<' in the page | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 107 var viewport_height; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 108 if (window.innerHeight) | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 109 viewport_height = window.innerHeight; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 110 else | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 111 viewport_height = $(window).height(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 112 sidebarbutton.find('span').css({ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 113 'display': 'block', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 114 'margin-top': (viewport_height - sidebar.position().top - 20) / 2 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 115 }); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 116 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 117 sidebarbutton.click(toggle_sidebar); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 118 sidebarbutton.attr('title', _('Collapse sidebar')); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 119 sidebarbutton.css({ | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 120 'color': '#FFFFFF', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 121 'border-left': '1px solid ' + dark_color, | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 122 'font-size': '1.2em', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 123 'cursor': 'pointer', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 124 'height': bodywrapper.height(), | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 125 'padding-top': '1px', | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 126 'margin-left': ssb_width_expanded - 12 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 127 }); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 128 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 129 sidebarbutton.hover( | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 130 function () { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 131 $(this).css('background-color', dark_color); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 132 }, | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 133 function () { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 134 $(this).css('background-color', light_color); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 135 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 136 ); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 137 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 138 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 139 function set_position_from_cookie() { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 140 if (!document.cookie) | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 141 return; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 142 var items = document.cookie.split(';'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 143 for(var k=0; k<items.length; k++) { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 144 var key_val = items[k].split('='); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 145 var key = key_val[0].replace(/ /, ""); // strip leading spaces | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 146 if (key == 'sidebar') { | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 147 var value = key_val[1]; | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 148 if ((value == 'collapsed') && (!sidebar_is_collapsed())) | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 149 collapse_sidebar(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 150 else if ((value == 'expanded') && (sidebar_is_collapsed())) | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 151 expand_sidebar(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 152 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 153 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 154 } | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 155 | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 156 add_sidebar_button(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 157 var sidebarbutton = $('#sidebarbutton'); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 158 set_position_from_cookie(); | 
| 
0bca8a6364a7
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
 yating-l parents: diff
changeset | 159 }); | 
