+ e.stopPropagation();
+
+ // '$anchor' is the event target, which is a .pane-anchor or a bootstrap
+ // tab anchor. This is the element that stores the state of the pane. The
+ // actual element that will contain the content is pointed to in the 'href'
+ // attribute of etarget.
+ var $anchor = $(e.target);
+
+ if ($anchor.hasClass('pane-loading')) {
+ // Already loading, mark stale to schedule a reload after this one.
+ $anchor.addClass('pane-stale');
+ return;
+ }
+
+ if ($anchor.hasClass('pane-no-auto-reload') && $anchor.hasClass('pane-loaded')) {
+ // Have to explicitly remove pane-loaded if we want it to reload.
+ return;
+ }
+
+ var throttle = $anchor.attr('data-load-throttle');
+ if (!throttle) {
+ throttle = 3000;
+ }
+ var now = (new Date()).getTime();
+ var loaded_at = $anchor.attr('data-loaded-at');
+ var since_last_load = now - loaded_at;
+ if (loaded_at && (since_last_load < throttle)) {
+ if (!$anchor.hasClass('pane-reload-pending')) {
+ $anchor.addClass('pane-reload-pending');
+ setTimeout((function() {
+ $anchor.trigger('arv:pane:reload');
+ }), throttle - since_last_load);
+ }
+ return;
+ }
+
+ // We know this doesn't have 'pane-loading' because we tested for it above
+ $anchor.removeClass('pane-reload-pending');
+ $anchor.removeClass('pane-loaded');
+ $anchor.removeClass('pane-stale');
+
+ // $pane is the actual content area that is going to be updated.
+ var $pane = $($anchor.attr('href'));