Mercurial > forge
view doc/javascript.jsin @ 12671:20e8aca47b2c octave-forge
prepare for release
author | cdf |
---|---|
date | Mon, 17 Aug 2015 10:19:39 +0000 |
parents | be71508d4218 |
children |
line wrap: on
line source
var cookie_name = "octave_forge_cookie"; function set_cookie(val) { if (document.cookie != document.cookie) { index = document.cookie.indexOf(cookie_name); } else { index = -1; } if (index == -1) { var cval = cookie_name + "=" + val + "; "; var d = new Date(); d.setSeconds(d.getSeconds()+30); cval = cval + "expires=" + d.toString() + ";"; document.cookie = cval; } } function get_cookie() { var retval = -1; if (document.cookie) { var index = document.cookie.indexOf(cookie_name); if (index != -1) { var start = document.cookie.indexOf("=", index) + 1; stop = document.cookie.indexOf(";", start); if (stop == -1) { stop = document.cookie.length; } retval = document.cookie.substring(start, stop); } } return retval; } function goto_url (selSelectObject) { if (selSelectObject.options[selSelectObject.selectedIndex].value != "-1") { location.href=selSelectObject.options[selSelectObject.selectedIndex].value; } } function unfold(id) { if (document.getElementById(id+"_detailed").style.display == "none") { document.getElementById(id+"_detailed").style.display = "block"; document.getElementById(id+"_im").src ="hide.png" } else { document.getElementById(id+"_detailed").style.display = "none"; document.getElementById(id+"_im").src ="show.png" } } function fold(id) { document.getElementById(id+"_detailed").style.display = "none"; document.getElementById(id).style.display = "block"; } function switch_to(id) { set_cookie(id); if (id == "cat") { other = "alpha-tab"; left = "2"; right = "1"; } else { // id == "alpha" other = "cat-tab"; left = "1"; right = "2"; } id = id + "-tab"; var tab1 = document.getElementById(id); var tab2 = document.getElementById(other); tab1.style.borderTop = "2px solid black"; tab1.style.borderLeft = "2px solid black"; tab1.style.borderRight = right+"px solid black"; tab1.style.borderBottom = "2px solid #EEEEEE"; tab2.style.borderTop = "1px solid black"; tab2.style.borderLeft = left+"px solid black"; tab2.style.borderRight = "1px solid black"; tab2.style.borderBottom = "2px solid black"; tab1.style.fontWeight = "bold"; tab2.style.fontWeight = "normal"; tab1.style.background = "#EEEEEC"; tab2.style.background = "transparent"; } function switch_to_cat() { switch_to("cat"); var d = document.getElementById("menu-contents"); d.innerHTML = '\ m4_include([[[htdocs/doc/menu.include]]])'; } function switch_to_alpha() { switch_to("alpha"); var d = document.getElementById("menu-contents"); d.innerHTML = '\ m4_include([[[htdocs/doc/alphabetic.include]]])'; } function write_left_menu() { // Only do this if we are running non-IE browsers if (navigator.appVersion.indexOf('MSIE') == -1) { menuhtml = '<div id="left-switcher">\ <div class="tab" id="cat-tab" onclick="javascript:switch_to_cat()">\ <a href="javascript:switch_to_cat();" style="text-decoration: none;">Categorical</a>\ </div>\ <div class="tab" id="alpha-tab" onclick="javascript:switch_to_alpha()">\ <a href="javascript:switch_to_alpha();" style="text-decoration: none;">Alphabetical</a>\ </div>\ <div id="menu-contents" class="left-menu" style="position: fixed; overflow: auto;">\ </div>\ </div>'; var left_menu_span = document.getElementById("left-menu-span"); left_menu_span.innerHTML = menuhtml; var cat_tab = document.getElementById("cat-tab"); var alpha_tab = document.getElementById("alpha-tab"); cat_tab.style.width = "7.5em"; cat_tab.style.position = "absolute"; cat_tab.style.bottom = "-4px"; alpha_tab.style.width = "7.5em"; alpha_tab.style.position = "absolute"; alpha_tab.style.bottom = "-4px"; } // end non-IE var tab = get_cookie(); if (tab == "alpha") { switch_to_alpha(); } else { switch_to_cat(); } }