PageSourceSearch

https://americantheatrewing.org/wp-content/themes/atw/js/atw/util.js?ver=1.0

js americantheatrewing.org collected 2026-09-24 17:17:49 UTC 2,765 bytes, 122 lines download raw bytes

1/**
2 *		ATW JS module:
3 *			util.js
4 *
5 *		Desc:
6 *			Provides general utilities
7 *
8 *		Requires:
9 *			jQuery
10 */
11
12var krnl = ( function( app, $ ) {
13
14	"use strict";
15
16	/* define new module */
17	app.util = ( function( $ ) {
18
19		// private vars
20		var _name = 'Util',
21			_initialized = false,
22			debug = null
23		;
24
25		/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26
27		function _init() {
28
29			if ( _initialized ) {
30
31				return;
32
33			}
34
35			debug = _debug;
36
37			/* * * * * * * * * * * * * * * * * * * */
38
39			_initialized = true;
40
41		}
42
43		/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
44
45		function _debug( obj ) {
46
47			if ( ( typeof console === "object" ) && ( console.log ) ) {
48
49				console.log( obj );
50
51			}
52
53		}
54
55		/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
56
57		/*
58		*	load_ajax(options)
59		*		Makes an ajax request, handles response.
60		*/
61		
62		function load_ajax(options) {
63
64			if (typeof options == 'undefined') return false;
65
66			var ajax_options = {
67				url : options.url
68			};
69
70			// request type
71			ajax_options.type = (typeof options.type != 'undefined') ? options.type : 'get';
72
73			// data sent to the server
74			ajax_options.data = (typeof options.data != 'undefined') ? options.data : {};
75
76			// are we expecting a particular data type from the server?
77			if (typeof options.dataType != 'undefined') ajax_options.dataType = options.dataType;
78
79			// timeout params; default to 10 seconds
80			ajax_options.timeout = (typeof options.timeout != 'undefined') ? options.timeout : (20 * 1000) ;
81
82			// error callback
83			ajax_options.error = (typeof options.error != 'undefined') ? options.error : function( e, textStatus, errorThrown ){
84
85				debug( 'error loading: ' + ajax_options.url );
86				debug( 'error textStatus: ' + textStatus );
87				debug( 'error errorThrown: ' + errorThrown );
88
89			};
90
91			// success callback
92			ajax_options.success = (typeof options.success != 'undefined') ? options.success : function( data ){
93
94				debug( 'data received from '+ ajax_options.url +':' );
95				debug( data );
96
97			};
98
99			// finally, make request
100			$.ajax( ajax_options );
101
102		}
103
104		/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
105
106		/* return public-facing methods and/or vars */
107		return {
108			init        : _init,
109			debug       : _debug,
110			load_ajax   : load_ajax
111		};
112		
113	}($));
114	
115	return app; /* return augmented app object */
116	
117}( krnl || {}, jQuery ) ); /* import app if exists, or create new; import jQuery */
118
119/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120
121// register this module for initialization
122krnl.bootstrap.register( krnl.util.init );

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.