PageSourceSearch

https://school.teachingbooks.net/js/sora_wishlist.js.pagespeed.ce.4XnGrr9yT7.js

js teachingbooks.net collected 2026-09-24 08:48:31 UTC 3,437 bytes, 121 lines download raw bytes

1$(document).ready(function() {
2	$('body').on('change', '#sw_grade_level', function() {
3		let sw_grade_level = $('#sw_grade_level').val();
4		if (sw_grade_level == '1008') {
5			$('.adultOnly').show();
6		} else {
7			$('.adultOnly').hide();
8			$('#sw_first_name').val('');
9			$('#sw_last_name').val('');
10			$('#sw_email').val('');
11		}
12	});
13});
14
15function soraWishlist(e) {
16	e.preventDefault();
17	dialogTriggerElement = e.target;
18	let sw_title_id = $(e.target).data('tid');
19	if (!sw_title_id) {
20		sw_title_id = $(e.target).closest('.soraWishlistTrigger').data('tid');
21		if (!sw_title_id) {
22			return;
23		}
24	}
25
26	$.post('/tb.cgi',
27		{ 'soraWishlist': 1, 'sw_title_id': sw_title_id },
28		function(result) {
29			var data = JSON.parse(result);
30			if (data.error) {
31				$('#soraWishlistDialog').html(`<div class="alert alert-danger mb-3 mt-3">${data.error}</div>`);
32			}
33			else if (data.html) {
34				let html =`<button type="button" class="sbm-close" autofocus><span class="icon-close"></span><span class="sr-only">Close</span></button>` + data.html;
35				$('#soraWishlistDialog').html(html);
36				loghit('soraWishlist');
37			}
38			else {
39				$('#soraWishlistDialog').html('<p>Error adding to wish list.</p>');
40			}
41
42			let dialog = document.getElementById('soraWishlistDialog');
43			dialog.showModal();
44			setTimeout(function() {
45				$('#soraWishlistDialog').find('.sbm-close').first().focus();
46			}, 0);
47
48		}
49	);
50
51}
52
53function submitSoraWishlist() {
54	let sw_title_id = $('#sw_title_id').val();
55	let sw_division_id = $('#sw_division_id').val();
56	let sw_user_id = $('#sw_user_id').val();
57	let sw_grade_level = $('#sw_grade_level').val();
58	let sw_notes = $('#sw_notes').val();
59	let sw_first_name = $('#sw_first_name').val();
60	let sw_last_name = $('#sw_last_name').val();
61	let sw_email = $('#sw_email').val();
62
63	let sw_key = $('input[name="sw_key"]:checked').map(function() {
64		return this.value;
65	}).get().join('~');
66
67	let sw_purpose = $('input[name="sw_purpose"]:checked').val();
68
69	let error = '';
70	if (!sw_user_id && !sw_grade_level) {
71		error += 'Please select your grade. ';
72	}
73	if (!sw_key) {
74		error += 'Please select a format. ';
75	}
76	if (sw_user_id && !sw_purpose) {
77		error += 'Please select a purpose. ';
78	}
79
80	if (error) {
81		$('#soraWishlistStatus').html(`<div class="alert alert-danger">${error}</div>`);
82		$('#soraWishlistStatusRow').show();
83		return;
84	}
85
86	$('#soraWishlistStatus').html(`<p><img id="sorawishlistModalSpinner" src="/images/ajax-loader.gif">Submitting...</p>`);
87	$('#soraWishlistStatusRow').show();
88	$('.soraWishlistButton').attr('disabled', true);
89	$.post('/tb.cgi',
90		{
91			'soraWishlist': 1,
92			'save': 1,
93			'sw_title_id': sw_title_id,
94			'sw_key': sw_key,
95			'sw_purpose': sw_purpose,
96			'sw_grade_level': sw_grade_level,
97			'sw_notes': sw_notes,
98			'sw_first_name': sw_first_name,
99			'sw_last_name': sw_last_name,
100			'sw_email': sw_email,
101		},
102		function(result) {
103			$('.soraWishlistButton').attr('disabled', false);
104			var data = JSON.parse(result);
105			if (data?.error) {
106				$('#soraWishlistStatus').html(`<div class="alert alert-danger">${data.error}</div>`);
107			}
108
109			else if (data?.html) {
110				let html =`<button type="button" class="sbm-close" autofocus><span class="icon-close"></span><span class="sr-only">Close</span></button>` + data.html;
111				$('#soraWishlistDialog').html(html);
112			}
113
114			else {
115				$('#soraWishlistStatus').html(`<div class="alert alert-danger">Error submitting request.</div>`);
116			}
117		}
118	);
119
120
121  }

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.