PageSourceSearch

https://exedsse.se/wp-content/themes/ifl/script/HHS/IFL/Form/ProgramToolsForm.js?ver=2.8.93

js exedsse.se collected 2026-10-06 00:45:21 UTC 2,441 bytes, 100 lines download raw bytes

1/**
2 * Changes the tab for an item if there's a querystring matching the tab.
3 *
4 * @file            ProgramToolForm.js
5 * @package         HHS.IFL.Form.ProgramToolForm
6 * @dependencies    jQuery
7 */
8
9;(function(App, window, document, undefined) {
10	'use strict';
11
12	/**
13	 * Changes the tab for an item if there's a querystring matching the tab.
14	 */
15	App.ProgramToolsForm = function() {
16
17		/**
18		 * Initializer, sets up the object.
19		 *
20		 * @return void.
21		 */
22		this.initialize = function() {
23			this.setupEvents();
24		};
25
26		/**
27		 * Sets up click events on close buttons.
28		 * @return void
29		 */
30		this.setupEvents = function() {
31			this.setupFormEvents('hash', 'complete-text');
32		};
33
34		/**
35		 * Hides a form, replaces the title and opens the tab corresponding to the
36		 * querystring hash.
37		 *
38		 * @param {string} name    The name of the query string.
39		 * @param {string} dataTextAttr The name of the data-attribute that should replace the heading.
40		 *
41		 * @return void.
42		 */
43		this.setupFormEvents = function(paramName, dataTextAttr) {
44			var param = this.parseQueryString(paramName);
45
46			if (!param) {
47				return;
48			}
49
50			var hasErrors = param.indexOf('error') >= 0;
51			var index = param.substring(param.indexOf('-') + 1);
52			var type = param.substring(0, param.indexOf('-'));
53
54			var tabButton = $('.program-tools [data-tab-button-number="'+index+'"]');
55			var tab = $('.program-tools [data-tab-panel-number="'+index+'"]');
56			var heading = tab.find('.section-title');
57
58			tabButton.click();
59
60			if (dataTextAttr && !hasErrors) {
61				tab.find('#registration-term-list').hide();
62				tab.find('form').hide();
63				heading.text(heading.data(dataTextAttr));
64			}
65		};
66
67		/**
68		 * Fetches the value of a query string item.
69		 *
70		 * @param {string} name The name of the query string.
71		 *
72		 * @return {Mixed} Either an object with all values or a string with a single value.
73		 */
74		this.parseQueryString = function (name) {
75			var vars = {};
76
77			var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
78				if (vars[key]) {
79					if (vars[key] instanceof Array) {
80						vars[key].push(value);
81					} else {
82						vars[key] = [vars[key], value];
83					}
84				} else {
85					vars[key] = value;
86				}
87			});
88
89			if (name) {
90				return vars[name];
91			} else {
92				return vars;
93			}
94		};
95
96		// Initialize the object on creation.
97		this.initialize();
98	};
99
100}(namespace('HHS.IFL.Form'), window, document));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.