+ $container.attr('data-infinite-content-href', null);
+ spinner = '<div class="spinner spinner-32px spinner-h-center"></div>';
+ if ($container.is('table,tbody,thead,tfoot')) {
+ // Hack to determine how many columns a new tr should have
+ // in order to reach full width.
+ colspan = $container.closest('table').
+ find('tr').eq(0).find('td,th').length;
+ if (colspan == 0)
+ colspan = '*';
+ spinner = ('<tr class="spinner"><td colspan="' + colspan + '">' +
+ spinner +
+ '</td></tr>');
+ }
+ $container.find(".spinner").detach();
+ $container.append(spinner);
+ $container.attr('data-infinite-serial', serial);
+
+ // Combine infiniteContentParams from multiple sources. This
+ // mechanism allows each of several components to set and
+ // update its own set of filters, without having to worry
+ // about stomping on some other component's filters.
+ //
+ // For example, filterable.js writes filters in
+ // infiniteContentParamsFilterable ("search for text foo")
+ // without worrying about clobbering the filters set up by the
+ // tab pane ("only show jobs and pipelines in this tab").
+ params = {};
+ $.each($container.data(), function(datakey, datavalue) {
+ // Note: We attach these data to DOM elements using
+ // <element data-foo-bar="baz">. We store/retrieve them
+ // using $('element').data('foo-bar'), although
+ // .data('fooBar') would also work. The "all data" hash
+ // returned by $('element').data(), however, always has
+ // keys like 'fooBar'. In other words, where we have a
+ // choice, we stick with the 'foo-bar' style to be
+ // consistent with HTML. Here, our only option is
+ // 'fooBar'.
+ if (/^infiniteContentParams/.exec(datakey)) {
+ if (datavalue instanceof Object) {
+ $.each(datavalue, function(hkey, hvalue) {
+ if (hvalue instanceof Array) {
+ params[hkey] = (params[hkey] || []).concat(hvalue);
+ } else if (hvalue instanceof Object) {
+ $.extend(params[hkey], hvalue);
+ } else {
+ params[hkey] = hvalue;
+ }
+ });
+ }
+ }
+ });
+ $.each(params, function(k,v) {
+ if (v instanceof Object) {
+ params[k] = JSON.stringify(v);
+ }
+ });
+