PageSourceSearch

https://www.basketballjobmarket.com/jm/wp-content/plugins/csjmarket2/jmarket/js/player.js?ver=1791027036

js basketballjobmarket.com collected 2026-10-04 13:27:04 UTC 16,192 bytes, 466 lines download raw bytes

1/***
2 *
3 * javascript for player
4 * RM 2012-08-18
5 * 	- added player mail functions
6 * HHE 2013-04-05
7 * 	- changes in player form validation
8 * HHE 2013-04-06
9 * 	- added '- did not play -' functionality, indication: source_type = '0'
10 * HHE 2013-05-21
11 * 	- weight no longer required
12 * HHE 2014-04-29
13 * 	- college info no longer required
14 *
15 * 23.03.2015
16 * adrian cotorobai
17 *
18 * 	- changed open_email_form()
19 *
20 *
21 */
22
23// ### Player mail functions
24
25function check_empty_id(id,msg) {
26    //alert('check_empty_Id');
27
28	var val = '';
29    if (document.getElementById(id)) {
30        obj = document.getElementById(id);
31        val = obj.value;
32    }
33
34    //alert('val=>' + val);
35	if (val == '') {
36		alert(msg);
37		document.getElementById(id).focus();
38		return false;
39    }
40    else
41        return true;
42}
43
44function valid_player_email() {
45    //alert('valid_player_email');
46    var res = true;
47
48    if (res) res = check_empty_id('from_name','Please enter your name');
49    if (res) res = check_empty_id('to_email','Please enter an email adres');
50    if (res) res = check_empty_id('emailtext','Please enter email text');
51
52     //alert('all checked');
53     return res;
54}
55
56
57function open_email_form() {
58
59	var emailPlayerBtn = $('#email_player_button a');
60	var emailPlayerBtnContainer = $('#email_player_button');
61	var emailFormWrapper = $('#email_form_wrapper');
62	var emailForm = $('#email_form');
63
64	emailForm.hide();
65
66	emailPlayerBtn.on('click', function(e) {
67		e.preventDefault();
68		$('body,html').animate({
69			scrollTop: emailFormWrapper.offset().top
70		}, 800);
71
72		emailForm.delay(1000).show();
73		emailPlayerBtnContainer.hide();
74	});
75
76
77
78
79}
80
81
82function ScrollToId(id){
83    //alert('ScrollToId->' + id);
84    if (document.getElementById(id)) {
85        obj = document.getElementById(id);
86        sp = findPosY(obj);
87        window.scrollTo(0, sp);
88        //alert('sp->' + sp);
89	}
90	else {
91		alert('id->' + id + ' not found');
92	}
93}
94
95function findPosY(obj)
96  {
97    var curtop = 0;
98    if(obj.offsetParent)
99        while(1)
100        {
101          curtop += obj.offsetTop;
102          if(!obj.offsetParent)
103            break;
104          obj = obj.offsetParent;
105        }
106    else if(obj.y)
107        curtop += obj.y;
108    return curtop;
109}
110
111
112// ### Other functions
113
114function trim(str) {
115	var str = str.replace(/^\s\s*/, ''), ws = /\s/, i = str.length;
116	while (ws.test(str.charAt(--i)))
117		;
118	return str.slice(0, i + 1);
119}
120var do_check_3_positions = true ;
121function check_3_positions() {
122	var positions = document.getElementById('positions').value.split('/');
123	document.getElementById('position_1').value = ( positions[0]?positions[0]:'');
124	document.getElementById('position_2').value = ( positions[1]?positions[1]:'');
125	document.getElementById('position_3').value = ( positions[2]?positions[2]:'');
126	var position1=document.getElementById('position_1').value;
127	var position2=document.getElementById('position_2').value;
128	var position3=document.getElementById('position_3').value;
129	if ( do_check_3_positions && position1 && position2 && position3 ) {
130		//do_check_3_positions = false ;
131		alert( 'You filled in THREE different positions.'
132			+ ' Filling in multiple positions does NOT improve your chances on the job market.'
133			+ ' On the contrary. Teams usually look for imports who are specialists in something.'
134			+ ' The position field simply gives you the OPTION to fill in three positions, but also two, or one.'
135			+ ' Make sure that the position(s) you fill in are a true and accurate description of your game.'
136			) ;
137	}
138}
139function valid_profile_txt() {
140	var pt_field = document.getElementById('profile_txt') ;
141	var profile_txt = ( pt_field ? trim(pt_field.value) : "" ) ;
142	var profile_txt_lc = profile_txt.toLowerCase() ;
143/*
144	if (profile_txt == '') {
145		alert('Please enter your profile text');
146		document.getElementById('profile_txt').focus();
147		return false;
148*/
149	if ( profile_txt.length>1500 ) {
150		alert('Your profile text is too long. It should not exceed 1500 characters.');
151		document.getElementById('profile_txt').focus();
152		return false;
153	} else if ( profile_txt.indexOf( '@' ) >= 0 ) {
154		alert( "It is not allowed to place email adresses in your profile.\nWe have a message system to communicate with job owners.");
155		document.getElementById('profile_txt').focus();
156		return false;
157	} else if ( profile_txt_lc.indexOf( 'http://' ) >= 0 || profile_txt_lc.indexOf( 'https://' ) >= 0 || profile_txt_lc.indexOf( 'www.' ) >= 0 ) {
158		alert("Do not put any links in your profile.\nThey do not belong here but under the video tab of the profile.\nYou will get there after you have filled in the data on this page and the statistics on the next page.");
159		document.getElementById('profile_txt').focus();
160		return false;
161	} else if ( profile_txt.indexOf( '%' ) >= 0 ) {
162		alert( "Do not put staticstics in your profile.\nThey do not belong here but in the statistics table.\nYou will get there after you have filled in the data on this page.");
163		document.getElementById('profile_txt').focus();
164		return false;
165	} else {
166		return true ;
167	}
168}
169
170function valid_player() {
171
172	// var pub_status=document.getElementById('pub_status').value;
173	var gender = valButton(document.getElementsByName('gender'));
174	var fname = trim(document.getElementById('fname').value);
175	var lname = trim(document.getElementById('lname').value);
176	var frmMonth = document.getElementById('frmMonth').value;
177	var frmDay = document.getElementById('frmDay').value;
178	var frmYear = document.getElementById('frmYear').value;
179	var birthplace = trim(document.getElementById('birthplace').value);
180	var country = document.getElementById('country').value;
181	var nationality = document.getElementById('nationality').value;
182	var position_1 = document.getElementById('position_1').value;
183	var position_2 = document.getElementById('position_2').value;
184	var position_3 = document.getElementById('position_3').value;
185	var height = document.getElementById('height').value;
186	var weight = document.getElementById('weight').value;
187
188	var univ_ncaa = valButton(document.getElementsByName('univ_ncaa'));
189	//var university = trim(document.getElementById('university').value);
190	//var graYear = document.getElementById('graYear').value;
191	var nba_drafted = valButton(document.getElementsByName('nba_drafted'));
192	var nbaYear = document.getElementById('nbaYear').value;
193	var pos_draft = document.getElementById('pos_draft').value;
194	var status = document.getElementById('status').value;
195	var currency_f = document.getElementById('currency') ;
196	var currency = currency_f ? currency_f.value : "-" ;
197	var sal = currency_f ? trim(document.getElementById('sal').value) : "0" ;
198	var reg = /^[0-9]+$/;
199	var agent = valButton(document.getElementsByName('agent'));
200	var agency_det = trim(document.getElementById('agency_det').value);
201
202	var reg_email = /\S+@\S+\.\S+/ ;
203
204	if (fname == '') {
205		alert('Please enter your first name');
206		document.getElementById('fname').focus();
207		return false;
208	}
208 else if (lname == '') {
209		alert('Please enter your last name');
210		document.getElementById('lname').focus();
211		return false;
212	} else if (gender == null) {
213		alert('Please select your gender');
214		document.getElementById('gender').focus();
215		return false;
216	} else if (!isValidDate(frmDay, frmMonth, frmYear)) {
217		alert('The date you entered is not a valid date');
218		document.getElementById('frmDay').focus();
219		return false;
220	} else if (birthplace == '') {
221		alert('Please enter your birth place');
222		document.getElementById('birthplace').focus();
223		return false;
224	} else if (country == '') {
225		alert('Please select your country of birth');
226		document.getElementById('country').focus();
227		return false;
228	} else if (nationality == '') {
229		alert('Please select your Nationality');
230		document.getElementById('nationality').focus();
231		return false;
232	} else if (height == '') {
233		alert('Please select your height');
234		document.getElementById('height').focus();
235		return false;
236	} else if (false && weight == '') {
237		alert('Please select your weight');
238		document.getElementById('weight').focus();
239		return false;
240	} else if(position_1 == '' && position_2 == '' && position_3 == '' ) {
241		alert('Please select at least one position');
242		return false;
243	}
244	else if(position_1==position_2 && position_1!="" && position_2!="" )
245	{
246		alert("You have selected the same position more then once, please modify.\n(only one position is required)");
247		document.getElementById('position_1').focus();
248		return false;
249	}
250	else if(position_2==position_3 && position_2!="" && position_3!="")
251	{
252		alert("You have selected the same position more then once, please modify.\n(only one position is required)");
253		document.getElementById('position_1').focus();
254		return false;
255	}
256	else if(position_1==position_3 && position_1!="" && position_3!="")
257	{
258		alert("You have selected the same position more then once, please modify.\n(only one position is required)");
259		document.getElementById('position_1').focus();
260		return false;
261	} else if (status == '0') {
262		alert('Please select your current status');
263		document.getElementById('status').focus();
264		return false;
265	} else if ( currency_f && currency == '') {
266		alert('Please select currency');
267		document.getElementById('currency').focus();
268		return false;
269	} else if (currency_f && sal == '') {
270		alert('Please enter a monthly salary indication');
271		document.getElementById('sal').focus();
272		return false;
273	} else if (currency_f && !reg.test(sal)) {
274		alert("Please enter a valid number as a salary indication\n\n" +
275				"Do not use dots or comma's or letter characters.\n\n" +
276				"For example, one thousand should be written as 1000");
277		document.getElementById('sal').focus();
278		document.getElementById('sal').value = '';
279		return false;
280	} else if (agent == null) {
281		alert('Please select are you represented by an agent/agency or not');
282		document.getElementById('agent').focus();
283		return false;
284	} else if (agent == '1' && agency_det == '') {
285		alert('Please enter agent/agency details');
286		document.getElementById('agency_det').focus();
287		return false;
288/*
289	} else if (profile_txt == '') {
290		alert('Please enter your profile text');
291		document.getElementById('profile_txt').focus();
292		return false;
293*/
294	} else if (nba_drafted == null) {
295		alert('Please select you ever drafted by an NBA team');
296		document.getElementById('nba_drafted').focus();
297		return false;
298	} else if (nba_drafted == '1' && nbaYear == '0') {
299		alert('Please select in which year NBA drafted in ');
300		document.getElementById('nbaYear').focus();
301		return false;
302	} else if (nba_drafted == '1' && pos_draft == '0') {
303		alert('Please select position in draft');
304		document.getElementById('pos_draft').focus();
305		return false;
306	} else if (document.getElementById('univ_ncaa') && univ_ncaa == null) {
307		alert('Please enter whether did you play college basketball');
308		document.getElementById('univ_ncaa').focus();
309		return false;
310// HHE 2014-04-29: we do not ask for college info here anymore
311//	} else if (univ_ncaa == '1' && university == '') {
312//		alert('Please enter the college you attended ');
313//		document.getElementById('university').focus();
314//		return false;
315//	} else if (univ_ncaa == '1' && graYear == '0') {
316//		alert('Please select Last year that you played with your University/College');
317//		document.getElementById('graYear').focus();
318//		return false;
319	} else {
320		return valid_profile_txt() ;
321	}
322}
323
324function valid_video() {
325	var home_team = trim(document.getElementById('home_team').value);
326	var away_team = trim(document.getElementById('away_team').value);
327	var frmMonth = document.getElementById('frmMonth').value;
328	var frmDay = document.getElementById('frmDay').value;
329	var frmYear = document.getElementById('frmYear').value;
330	var jersey_color = trim(document.getElementById('jersey_color').value);
331	var jersey_num = trim(document.getElementById('jersey_num').value);
332	var reg = /^[0-9]+$/;
333
334	if (home_team == '') {
335		alert('Please enter your home team');
336		document.getElementById('home_team').focus();
337		return false;
338	} else if (away_team == '') {
339		alert('Please enter your away team');
340		document.getElementById('away_team').focus();
341		return false;
342	} else if (!isValidDate(frmDay, frmMonth, frmYear)) {
343		alert('The date you entered is not a valid date');
344		document.getElementById('frmDay').focus();
345		return false;
346	} else if (jersey_color == '') {
347		alert('Please enter jersey color');
348		document.getElementById('jersey_color').focus();
349		return false;
350	} else if (jersey_num == '') {
351		alert('Please enter jersey number');
352		document.getElementById('jersey_num').focus();
353		return false;
354	} else if (!reg.test(jersey_num)) {
355		alert("Please enter jersey number only numeric form");
356		document.getElementById('jersey_num').focus();
357		document.getElementById('jersey_num').value = '';
358		return false;
359	} else if (jersey_num != '' && jersey_num > 100) {
360		alert('Please enter jersey number less than 100');
361		document.getElementById('jersey_num').focus();
362		document.getElementById('jersey_num').value = '';
363		return false;
364	} else
365		return check_video_urls();
366}
367
368function valButton(btn) {
369	var cnt = -1;
370	for ( var i = btn.length - 1; i > -1; i--) {
371		if (btn[i].checked) {
372			cnt = i;
373			i = -1;
374		}
375	}
376	if (cnt > -1)
377		return btn[cnt].value;
378	else
379		return null;
380}
381function isValidDate(day, month, year) {
382	/*
383	 * Purpose: return true if the date is valid, false otherwise
384	 *
385	 * Arguments: day integer representing day of month month integer
386	 * representing month of year year integer representing year
387	 *
388	 * Variables: dteDate - date object
389	 *
390	 */
391	var dteDate;
392
393	// set up a Date object based on the day, month and year arguments
394	// javascript months start at 0 (0-11 instead of 1-12)
395	month = month - 1;
396	dteDate = new Date(year, month, day);
397
398	/*
399	 * Javascript Dates are a little too forgiving and will change the date to a
400	 * reasonable guess if it's invalid. We'll use this to our advantage by
401	 * creating the date object and then comparing it to the details we put it.
402	 * If the Date object is different, then it must have been an invalid date
403	 * to start with...
404	 */
405
406	return ((day == dteDate.getDate()) && (month == dteDate.getMonth()) && (year == dteDate
407			.getFullYear()));
408}
409function isValidateURL(textval) {
410
411	// this is not really working ... so forget it for now
412	// return true ;
413
414	var urlregex = new RegExp(
415			"^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$");
416	var result = urlregex.test(textval);
417	return result;
418}
419var myVideoWindow ;
420function test_link( id ){
421	var vf = document.getElementById( 'video'+id );
422	var url = trim((/^.*\:\/\/*/.test(vf.value) ? vf.value : 'http://' + vf.value));
423	if (!isValidateURL( url )) {
424		alert('The link is not a proper address of a video');
425	} else {
426		if (typeof myVideoWindow !== 'undefined' ) { myVideoWindow.close() ; }
427		myVideoWindow = window.open( url, 'video_test' ) ;
428		myVideoWindow.focus() ;
429	}
430}
431function check_video_urls() {
432	var vf = document.getElementById('video1');
433	var video1 = trim((/^.*\:\/\/*/.test(vf.value) ? vf.value : 'http://'
434			+ vf.value));
435	if (!isValidateURL(video1)) {
436		alert('The link to the first video is not a proper address of a video');
437		document.getElementById('video1').focus();
438		return false;
439	} else {
440		vf.value = video1;
441	}
442	var vf = document.getElementById('video2');
443	if (vf.value !== '') {
444		var video2 = trim((/^.*\:\/\/*/.test(vf.value) ? vf.value : 'http://'
445				+ vf.value));
446		if (!(video2 == '' || isValidateURL(video2))) {
447			alert('The link to the second video is not a proper address of a video');
448			document.getElementById('video2').focus();
449			return false;
450		} else {
451			vf.value = video2;
452		}
453	}
454	return true;
455}
456
457$(document).ready(function(){
458	open_email_form();
459
460
461	$('#open-info-modal').on('click', function(e){
462		e.preventDefault();
463		$('#modal_pop').modal();
464	});
465
466});

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.