PageSourceSearch

https://www.seaschool.co.il/js/custom.js

js seaschool.co.il collected 2026-10-01 23:46:03 UTC 14,392 bytes, 490 lines download raw bytes

1//custom js
2
3function preload(arrayOfImages) {
4
5    $(arrayOfImages).each(function(){
6
7        $('<img/>')[0].src = this;
8
9        // Alternatively you could use:
10
11        // (new Image()).src = this;
12
13    });
14
15}
16
17
18
19$(document).ready(function(){
20
21
22
23	$('#mega-menu').css('right', -($('#mega-menu').width()));
24
25
26
27    $(window).bind('scroll', function(){
28
29        if($(this).scrollTop() > 70) { // show after 200 px of user scrolling
30
31            $('.pg100 #mainhead').addClass('fixed');
32
33        }
34
35
36
37        if($(this).scrollTop() < 71) { // show after 200 px of user scrolling
38
39            $('.pg100 #mainhead').removeClass('fixed');
40
41        }
42
43
44
45    });
46
47
48
49	//main menu
50
51	$('.menu-btn a').on('click', function(e){
52
53		e.preventDefault();
54
55
56
57		$(this).parents('#main-navigation').toggleClass('submenu-active');
58
59		$('body').toggleClass('mega-menu-opened');
60
61	});
62
63
64
65	$('span.menu-overlay').css('height', $('body').height());
66
67
68
69	$('span.menu-overlay').on('click', function(e){
70
71		e.preventDefault();
72
73		$('#main-navigation').toggleClass('submenu-active');
74
75		$('body').toggleClass('mega-menu-opened');
76
77	});
78
79
80
81	//plugin bootstrap minus and plus
82
83	$('.btn-number').click(function(e){
84
85		e.preventDefault();
86
87
88
89		fieldName = $(this).attr('data-field');
90
91		type      = $(this).attr('data-type');
92
93		var input = $("input[name='"+fieldName+"']");
94
95		var currentVal = parseInt(input.val());
96
97		if (!isNaN(currentVal)) {
98
99			if(type == 'minus') {
100
101
102
103				if(currentVal > input.attr('min')) {
104
105					input.val(currentVal - 1).change();
106
107				}
108
109				if(parseInt(input.val()) == input.attr('min')) {
110
111					$(this).attr('disabled', true);
112
113				}
114
115
116
117			} else if(type == 'plus') {
118
119
120
121				if(currentVal < input.attr('max')) {
122
123					input.val(currentVal + 1).change();
124
125				}
126
127				if(parseInt(input.val()) == input.attr('max')) {
128
129					$(this).attr('disabled', true);
130
131				}
132
133
134
135			}
136
137		} else {
138
139			input.val(0);
140
141		}
142
143	});
144
145	$('.input-number').focusin(function(){
146
147	   $(this).data('oldValue', $(this).val());
148
149	});
150
151	$('.input-number').change(function() {
152
153
154
155		minValue =  parseInt($(this).attr('min'));
156
157		maxValue =  parseInt($(this).attr('max'));
158
159		valueCurrent = parseInt($(this).val());
160
161
162
163		name = $(this).attr('name');
164
165		if(valueCurrent >= minValue) {
166
167			$(".btn-number[data-type='minus'][data-field='"+name+"']").removeAttr('disabled')
168
169		} else {
170
171			alert('Sorry, the minimum value was reached');
172
173			$(this).val($(this).data('oldValue'));
174
175		}
176
177		if(valueCurrent <= maxValue) {
178
179			$(".btn-number[data-type='plus'][data-field='"+name+"']").removeAttr('disabled')
180
181		} else {
182
183			alert('Sorry, the maximum value was reached');
184
185			$(this).val($(this).data('oldValue'));
186
187		}
188
189
190
191
192
193	});
194
195	$(".input-number").keydown(function (e) {
196
197        // Allow: backspace, delete, tab, escape, enter and .
198
199        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
200
201             // Allow: Ctrl+A
202
203            (e.keyCode == 65 && e.ctrlKey === true) || 
204
205             // Allow: home, end, left, right
206
207            (e.keyCode >= 35 && e.keyCode <= 39)) {
208
209                 // let it happen, don't do anything
210
211                 return;
212
213        }
214
215        // Ensure that it is a number and stop the keypress
216
217        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
218
219            e.preventDefault();
220
221        }
222
223    });
224    
225    //comments section
226    function getStorage(status) {
227        var myStorage = window.localStorage;
228        if(typeof myStorage.commentstorage == 'undefined') {
229            return false;
230        } else {
231            var commentsdata = JSON.parse(myStorage.commentstorage);
232        }
233        if(typeof commentsdata[status] == 'undefined') {
234            return false;
235        }
236        var i, divId, commentsDiv;
237        
238        for (i = 0; i < commentsdata[status].length; i++) {
239            divId = commentsdata[status][i];
240            commentsDiv = $('.ArticleComment[data-id="'+divId+'"]');
241            if(status == 'liked') {
242                commentsDiv.addClass('liked');
243                commentsDiv.find('.likeSvg').attr("class", "likeSvg likePressed");
244            }
245            if(status == 'disliked') {
246                commentsDiv.addClass('disliked');
247                commentsDiv.find('.dislikeSvg').attr("class", "dislikeSvg dislikePressed");
248            }
249        }
250    }
251
252    getStorage('liked');
253    getStorage('disliked');
254        
255    function setStorage(objectId, status) {
256        var myStorage = window.localStorage;
257        if(typeof myStorage.commentstorage == 'undefined') {
258            var commentsdata = [];
259        } else {
260            var commentsdata = JSON.parse(myStorage.commentstorage);
261        }
262        if(typeof commentsdata[status] == 'undefined') {
263            commentsdata[status] = [];
264        }
265
266        commentsdata[status].push(objectId);
267
268        myStorage.setItem('commentstorage', JSON.stringify(Object.assign({}, commentsdata ) ));
269    }
270    
271    $('.topView').click(function(){
272      //  $(this).closest('#PremiumArticleComment').toggleClass('expanded');
273    });
274    
275    $('#commentsContainer').on('click', '.likeSvg', function() {
276        if($(this).closest('.ArticleComment').hasClass('liked')) {
277            return false;
278        }
279        $(this).attr("class", "likeSvg likePressed");
280        $(this).closest('.ArticleComment').addClass('liked');
281        var likenum = $(this).closest('.ArticleComment').find('.likesCounter:not(.unlikesCounter)').html();
282        likenum = parseInt(likenum) + 1;
283        $(this).closest('.ArticleComment').find('.likesCounter:not(.unlikesCounter)').html(likenum);        
284        var commentId = $(this).closest('.ArticleComment').attr('data-id');
285        setStorage(commentId, 'liked');
286        $.ajax({
287            url: '/caj.php',
288            data: {action:'upvote', id : commentId},
289            type: 'POST', 
290            success: function(data) {
291
292			}
293		});
294    });
295
296    $('#commentsContainer').on('click', '.dislikeSvg', function() {
297        if($(this).closest('.ArticleComment').hasClass('disliked')) {
298            return false;
299        }
300        $(this).attr("class", "dislikeSvg dislikePressed");
301        $(this).closest('.ArticleComment').addClass('disliked');
302        var dislikenum = $(this).closest('.ArticleComment').find('.unlikesCounter').html();
303        dislikenum = parseInt(dislikenum) + 1;
304        $(this).closest('.ArticleComment').find('.unlikesCounter').html(dislikenum);        
305        var commentId = $(this).closest('.ArticleComment').attr('data-id');
306        setStorage(commentId, 'disliked');
307        $.ajax({
308            url: '/caj.php',
309            data: {action:'downvote', id : commentId},
310            type: 'POST', 
311            success: function(data) {
312			}
313		});
314    }); 
315    
316    $('#comments_section').on('click', '.newCommentBtn', function() {
317        $('.mainform').find('.PremiumAddCommentFormUI').removeClass('hide');
318        $('.mainform').find('.PremiumAddCommentFormUI').addClass('fadeIn');
319        $('.mainform').find('.newCommentBtn').addClass('hide');
320    }); 
321
322    $('#commentsContainer').on('click', '.commentToComent', function() {
323        $(this).closest('#PremiumArticleComment').find('.PremiumAddCommentFormUI').removeClass('hide');
324        $(this).closest('#PremiumArticleComment').find('.PremiumAddCommentFormUI').addClass('fadeIn');
325        $(this).closest('#PremiumArticleComment').find('.commentToComent').addClass('hide');
326    }); 
327
328    $('.container').on('click', '.closeBtnWrapper.mainform', function() {
329        $('.mainform').find('.PremiumAddCommentFormUI').removeClass('fadeIn');
330        $('.mainform').find('.PremiumAddCommentFormUI').addClass('hide');
331        $('.mainform').find('.commentSentMessageWrapepr').addClass('hide');
332        $('.mainform').find('.newCommentBtn').removeClass('hide');
333    });
334
335    $('#commentsContainer').on('click', '.closeBtnWrapper.answerform', function() {    
336        $(this).closest('#PremiumArticleComment').find('.PremiumAddCommentFormUI').removeClass('fadeIn');
337        $(this).closest('#PremiumArticleComment').find('.PremiumAddCommentFormUI').addClass('hide');
338        $(this).closest('#PremiumArticleComment').find('.commentSentMessageWrapepr').addClass('hide');
339        $(this).closest('#PremiumArticleComment').find('.commentToComent').removeClass('hide');
340    });
341    
342    $('.container').on('click', '.thankYouWrapper .closeTextWrapper', function() {
343        $(this).closest('.commentSentMessageWrapepr').closest('.PremiumAddCommentFormUI').removeClass('fadeIn');
344        $(this).closest('.commentSentMessageWrapepr').closest('.PremiumAddCommentFormUI').addClass('hide');
345    });
346/*
347    $('#commentsContainer').on('click', '.addCommentSendButton', function() { 
348        // $(this).attr('disabled','disabled');
349        var title = $(this).closest('.AddCommentForm').find('input.title').val();
350        if (!title) {
351            alert('חובה להכניס כותרת');
352            return false;
353        }
354        
355        if ($(this).attr('data-parentCommentId')) {
356            parentCommentId = $(this).attr('data-parentCommentId');
357            username = $('#comment_owner_name').html();
358            phone =  $('#comment_owner_phone').html();
359            email = $('#comment_owner_email').html();
360
361        } else {
362            parentCommentId  = null;
363            phone = $(this).closest('.AddCommentForm').find('input.phone').val(); 
364            email = $(this).closest('.AddCommentForm').find('input.email').val();
365            username = $(this).closest('.AddCommentForm').find('input.name').val(); 
366                  
367            var phoneformat = /^[0-9\+][0-9\-]*$/;
368            if (!phone || !phone.match(phoneformat)) {
369                alert('נא להזין מספר טלפון');
370                return false;
371            }
372
373            var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
374            if (!email || !email.match(mailformat)) {
375                alert('נא להזין כתובת דוא"ל תקינה');
376                return false;
377            }
378        }
379        
380        $.ajax({
381            url: '/caj.php',
382            data: {
383                action:'comment', 
384                pageid : $(this).attr('data-pageid'),
385                parentCommentId : parentCommentId, 
386                name: username,
387                email: email,
388                phone: phone,
389                title: title,
390                content: $(this).closest('.AddCommentForm').find('textarea.comment').val(),
391                rating: $(this).closest('.AddCommentForm').find('[name="rating2"]:checked').val(), 
392            },
393            type: 'POST', 
394            success: function(data) {
395                if(parentCommentId) {
396                    $("div[data-id='"+parentCommentId+"']").after(data);
397                    $("div[data-id='"+parentCommentId+"']").find('.answerform').addClass('hide'); 
398                } else {
399			        $('.mainform .AddCommentFormContainer').addClass('hide');
400                    $('.mainform .commentSentMessageWrapepr').removeClass('hide');
401                    $('.mainform .topPanel .newCommentBtn').addClass('hide');
402                }
403            }
404		});
405        
406    });
407*/        
408    $('.container').on('click', '.addCommentSendButton', function() { 
409        // $(this).attr('disabled','disabled');
410        var title = $(this).closest('.AddCommentForm').find('input.title').val();
411        if (!title) {
412            alert('חובה להכניס כותרת');
413            return false;
414        }
415        
416        if ($(this).attr('data-parentCommentId')) {
417            parentCommentId = $(this).attr('data-parentCommentId');
418            username = $('#comment_owner_name').html();
419            phone =  $('#comment_owner_phone').html();
420            email = $('#comment_owner_email').html();
421
422        } else {
423            parentCommentId  = null;
424            phone = $(this).closest('.AddCommentForm').find('input.phone').val(); 
425            email = $(this).closest('.AddCommentForm').find('input.email').val();
426            username = $(this).closest('.AddCommentForm').find('input.name').val(); 
427                  
428            var phoneformat = /^[0-9\+][0-9\-]*$/;
429            if (!phone || !phone.match(phoneformat)) {
430                alert('נא להזין מספר טלפון');
431                return false;
432            }
433
434            var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
435            if (!email || !email.match(mailformat)) {
436                alert('נא להזין כתובת דוא"ל תקינה');
437                return false;
438            }
439        }
440        
441        $.ajax({
442            url: '/caj.php',
443            data: {
444                action:'comment', 
445                pageid : $(this).attr('data-pageid'),
446                parentCommentId : parentCommentId, 
447                name: username,
448                email: email,
449                phone: phone,
450                title: title,
451                content: $(this).closest('.AddCommentForm').find('textarea.comment').val(),
452                rating: $(this).closest('.AddCommentForm').find('[name="rating2"]:checked').val(), 
453            },
454            type: 'POST', 
455            success: function(data) {
456                if(parentCommentId) {
457                    $("div[data-id='"+parentCommentId+"']").after(data);
458                    $("div[data-id='"+parentCommentId+"']").find('.answerform').addClass('hide'); 
459                } else {
460			        $('.mainform .AddCommentFormContainer').addClass('hide');
461                    $('.mainform .commentSentMessageWrapepr').removeClass('hide');
462                    $('.mainform .topPanel .newCommentBtn').addClass('hide');
463                }
464            }
465		});
466        
467    });
468    
469    $('.showMoreCommentsButton').click(function() {
470        var pageid = $('#addCommentSendButton').attr('data-pageid'); 
471        $(this).remove();
472        $.ajax({
473            url: '/caj.php',
474            data: {
475                action:'loadmore', 
476                pageid : pageid 
477            },
478            type: 'POST', 
479            success: function(data) {
480			    $('#commentsContainer').append(data);
481                $('#morecomments').remove();
482                
483                getStorage('liked');
484                getStorage('disliked');         
485                
486            }
487		});
488    }); 
489
490});

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.