github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/docs/source/theme/swiftopensource/static/js/docs.js (about)

     1  // Toggle main sections
     2  $(".docs-sidebar-section-title").click(function () {
     3      $('.docs-sidebar-section').not(this).closest('.docs-sidebar-section').removeClass('active');
     4      $(this).closest('.docs-sidebar-section').toggleClass('active');
     5  // Bug #1422454
     6  // Commenting out next line, the default behavior which was preventing links
     7  // from working.
     8  //    event.preventDefault();
     9  });
    10  
    11  /* Bug #1422454
    12     The toggle functions below enable the expand/collapse, but for now
    13     there's no easy way to get deeper links from other guides. So,
    14     commenting both toggle functions out.
    15  // Toggle 1st sub-sections
    16  $(".docs-sidebar-section ol lh").click(function () {
    17      $('.docs-sidebar-section ol').not(this).closest('.docs-sidebar-section ol').removeClass('active');
    18      $(this).closest('.docs-sidebar-section ol').toggleClass('active');
    19      if ($('.docs-has-sub').hasClass('active')) {
    20        $(this).closest('.docs-sidebar-section ol li').addClass('open');
    21      }
    22      event.preventDefault();
    23  });
    24  
    25  // Toggle 2nd sub-sections
    26  $(".docs-sidebar-section ol > li > a").click(function () {
    27      $('.docs-sidebar-section ol li').not(this).removeClass('active').removeClass('open');
    28      $(this).closest('.docs-sidebar-section ol li').toggleClass('active');
    29      if ($('.docs-has-sub').hasClass('active')) {
    30        $(this).closest('.docs-sidebar-section ol li').addClass('open');
    31      }
    32      event.preventDefault();
    33  });
    34  
    35  /* Bug #1417291
    36     The rule below creates a shaded plus sign next to
    37     a numbered sublist of a bulleted list.
    38     It's probably there to implement expand/collapse of
    39     list items, but unfortunately it affects also those
    40     lists where expand/collapse is not intended.
    41  
    42     I am commenting it out to fix this bug. If it causes
    43     problems elsewhere, they have to be fixed elsewhere. */
    44  
    45  // $('ol > li:has(ul)').addClass('docs-has-sub');
    46  
    47  // webui popover
    48  $(document).ready(function() {
    49      function checkWidth() {
    50          var windowSize = $(window).width();
    51  
    52          if (windowSize <= 767) {
    53              $('.gloss').webuiPopover({placement:'auto',trigger:'click'});
    54          }
    55          else if (windowSize >= 768) {
    56              $('.gloss').webuiPopover({placement:'auto',trigger:'hover'});
    57          }
    58      }
    59  
    60      // Execute on load
    61      checkWidth();
    62      // Bind event listener
    63      $(window).resize(checkWidth);
    64  });
    65  
    66  // Bootstrap stuff
    67  $('.docs-actions i').tooltip();
    68  $('.docs-sidebar-home').tooltip();
    69  
    70  // Hide/Toggle definitions
    71  $("#toggle-definitions").click(function () {
    72    $(this).toggleClass('docs-info-off');
    73    if ($('.gloss').hasClass('on')) {
    74        $('.gloss').removeClass('on').addClass('off').webuiPopover('destroy');
    75    } else if ($('.gloss').hasClass('off')) {
    76        $('.gloss').removeClass('off').addClass('on').webuiPopover();
    77    }
    78  });
    79  
    80  /* BB 150310
    81     openstackdocstheme provides three types of admonitions, important, note
    82     and warning. We decorate their title paragraphs with Font Awesome icons
    83     by adding the appropriate FA classes.                               */
    84  
    85  $('div.important > p.admonition-title').prepend('<div class="fa fa-fw fa-check-circle">&nbsp;</div>');
    86  $('div.note > p.admonition-title').prepend('<div class="fa fa-fw fa-check-circle">&nbsp;</div>');
    87  $('div.seealso > p.admonition-title').prepend('<div class="fa fa-fw fa-info-circle">&nbsp;</div>');
    88  $('div.warning > p.admonition-title').prepend('<div class="fa fa-fw fa-exclamation-triangle">&nbsp;</div>');
    89  $('div.versionadded > p').prepend('<div class="fa fa-fw fa-plus-circle">&nbsp;</div>');
    90  $('div.versionchanged > p').prepend('<div class="fa fa-fw fa-info-circle">&nbsp;</div>');
    91  $('div.deprecated > p').prepend('<div class="fa fa-fw fa-minus-circle">&nbsp;</div>');
    92  
    93  /* BB 150310
    94     We also insert a space between the icon and the admonition title
    95     ("Note", "Warning", "Important" or their i18n equivalents).
    96  
    97     This could be done with a single clause $('p.admonition-title')....,
    98     affecting all types of admonitions. I play it safe here and explicitly
    99     work on the three openstackdocstheme admonitions.
   100  
   101     The first parameter of the text() callback is not needed here (it's
   102     the index of the HTML element that we are modifying)                 */
   103  
   104  // Gives the log a bug icon the information it needs to generate the bug in
   105  // Launchpad with pre-filled information such as git SHA, git.openstack.org
   106  // source URL, published document URL and tag.
   107  function logABug(bugTitle, bugProject, fieldComment, fieldTags) {
   108  
   109      var lineFeed = "%0A";
   110  
   111      var bugChecklist = "This bug tracker is for errors with the documentation, " +
   112          "use the following as a template and remove or add fields as " +
   113          "you see fit. Convert [ ] into [x] to check boxes:" + lineFeed + lineFeed +
   114          "- [ ] This doc is inaccurate in this way: ______" + lineFeed +
   115          "- [ ] This is a doc addition request." + lineFeed +
   116          "- [ ] I have a fix to the document that I can paste below including example: " +
   117          "input and output. " + lineFeed + lineFeed +
   118          "If you have a troubleshooting or support issue, use the following " +
   119          " resources:" + lineFeed + lineFeed +
   120          " - Ask OpenStack: http://ask.openstack.org" + lineFeed +
   121          " - The mailing list: http://lists.openstack.org" + lineFeed +
   122          " - IRC: 'openstack' channel on Freenode"+ lineFeed;
   123  
   124      var urlBase = "https://bugs.launchpad.net/" + bugProject + "/+filebug?field.title=";
   125      var currentURL = "URL: " + window.location.href;
   126      var bugLink = "";
   127      if (useStoryboard) {
   128          var urlBase = "https://storyboard.openstack.org/#!/project/";
   129          bugLink = urlBase + bugProject;
   130      } else {
   131          bugLink = urlBase  + encodeURIComponent(bugTitle) +
   132          "&field.comment=" + lineFeed + lineFeed +  lineFeed +
   133          bugChecklist + lineFeed + "-----------------------------------" + lineFeed + fieldComment +
   134          lineFeed + currentURL +
   135          "&field.tags=" + fieldTags;
   136      }
   137      document.getElementById("logABugLink1").href=bugLink;
   138      document.getElementById("logABugLink2").href=bugLink;
   139      document.getElementById("logABugLink3").href=bugLink;
   140  }