Sha256: 4a3a140e1766d1c89305250a3ee8b71c12d846e67ae6b82cc63f56547d95b893

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 Bytes

Contents

$(document).ready(function(){
  // activate tabs
  $('#tabs').tabs({
    beforeLoad: function (event, ui) {
      var keepLoading = true;

      // Is the <a> tag is classified with 'cache'?
      if (ui.tab.children("a").first().hasClass("cache")) {
        keepLoading = (ui.panel.html() == "");
      }

      if(ui.panel.html() == "") {
        ui.panel.html('Loading...');
      }

      return keepLoading;
    },
  });

  $('article').on('click', '.toggle', function(event){
    $("#" + $(this).data('target')).toggle();
  });
});

function updatePage(name) {
  if (name) {
    var idx = $("#tabs > ul > li:contains("+name+")").index();
  }
  else {
    var idx = $("#tabs").tabs("option","active");
  }

  // force a hard reload if we're already on the desired page
  if ($("#tabs").tabs("option","active") == idx) {
    location.reload(true);
  }
  else {
    $("#tabs").tabs('load', idx);
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppetfactory-0.6.5 public/js/scripts.js
puppetfactory-0.6.4 public/js/scripts.js
puppetfactory-0.6.3 public/js/scripts.js