singulink.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.
  2. function toggleMenu() {
  3. var sidebar = document.getElementById("sidebar");
  4. var blackout = document.getElementById("blackout");
  5. if (sidebar.style.left === "0px")
  6. {
  7. sidebar.style.left = "-" + sidebar.offsetWidth + "px";
  8. blackout.classList.remove("showThat");
  9. blackout.classList.add("hideThat");
  10. }
  11. else
  12. {
  13. sidebar.style.left = "0px";
  14. blackout.classList.remove("hideThat");
  15. blackout.classList.add("showThat");
  16. }
  17. }
  18. $(function() {
  19. $('table').each(function(a, tbl) {
  20. var currentTableRows = $(tbl).find('tbody tr').length;
  21. $(tbl).find('th').each(function(i) {
  22. var remove = 0;
  23. var currentTable = $(this).parents('table');
  24. var tds = currentTable.find('tr td:nth-child(' + (i + 1) + ')');
  25. tds.each(function(j) { if ($(this).text().trim() === '') remove++; });
  26. if (remove == currentTableRows) {
  27. $(this).hide();
  28. tds.hide();
  29. }
  30. });
  31. });
  32. function scrollToc() {
  33. var activeTocItem = $('.sidebar .sidebar-item.active:last')[0]
  34. if (activeTocItem) {
  35. activeTocItem.scrollIntoView({ block: "center" });
  36. }
  37. else{
  38. setTimeout(scrollToc, 500);
  39. }
  40. }
  41. setTimeout(scrollToc, 500);
  42. });