Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 1183x 11x 11x 11x 11x 11x 11x 11x 11x 58x 58x 6x 6x 6x 6x 6x 58x 1183x 58x 58x 58x 58x 58x 58x 58x | define(
['jquery'],
function ($) {
'use strict';
var formId;
var cb;
function saveFormState() {
var $form = $('#' + formId);
var activeTab = $form.find('#form-navbar').find('li.active').find('a').attr('href');
var $activeGroup = $form.find('.tab-pane.active').find('.tab-groups').find('li.active').find('a');
var activeGroup;
Iif ($activeGroup.length) {
activeGroup = $activeGroup.attr('href');
if (!activeGroup || activeGroup === '#' || activeGroup.indexOf('javascript') === 0) {
activeGroup = $activeGroup.attr('id') ? '#' + $activeGroup.attr('id') : null;
}
} else {
activeGroup = null;
}
Eif (activeTab) {
sessionStorage[formId + '_activeTab'] = activeTab;
}
Iif (activeGroup) {
sessionStorage[formId + '_activeGroup'] = activeGroup;
}
}
function restoreFormState() {
Iif (sessionStorage.redirectTab) {
var $redirectTab = $('a[href="' + sessionStorage.redirectTab + '"]');
if ($redirectTab.length && !$('.loading-mask').is(':visible')) {
$redirectTab.tab('show');
if (cb) {
cb($redirectTab);
}
sessionStorage.removeItem('redirectTab');
}
} else if (sessionStorage[formId + '_activeTab']) {
var $activeTab = $('a[href="' + sessionStorage[formId + '_activeTab'] + '"]');
Eif ($activeTab.length) {
$activeTab.tab('show');
Eif (cb) {
cb($activeTab);
}
}
}
Iif (sessionStorage[formId + '_activeGroup']) {
var $activeGroup = $('a[href="' + sessionStorage[formId + '_activeGroup'] + '"]');
if ($activeGroup.length && !$('.loading-mask').is(':visible')) {
$activeGroup.tab('show');
if (cb) {
cb($activeGroup);
}
} else {
var $tree = $('div[data-selected-tree]');
if ($tree.length && !$('.loading-mask').is(':visible')) {
$tree.attr('data-selected-tree', sessionStorage[formId + '_activeGroup'].match(/\d/g).join(''));
}
}
}
}
return function (id, callback) {
Iif (typeof Storage === 'undefined') {
return;
}
Iif (!id || !$('#' + id).length) {
return;
}
formId = id;
cb = callback;
restoreFormState();
$('#' + formId).on('shown', 'a[data-toggle="tab"]', saveFormState);
$('#' + formId).on('tab.loaded', restoreFormState);
};
}
);
|