PageSourceSearch

https://www.shvoong.co.il/wp-content/themes/svoong-new-2020/js/scripts.js?ver=4.2.2

js shvoong.co.il collected 2026-10-02 10:23:08 UTC 42,044 bytes, 1,108 lines download raw bytes

1/*==================================================================================
2 * ohav scripts
3 * Author: Oren Havshush
4 * Date:  05-06-2013
5 *===================================================================================*/
6(function ($) {
7
8    $(window).load(function () {
9        // force the social bar to be inside teh div
10        //        if($('.dd_outer').length > 0 ){
11        //            $('.dd_outer').appendTo('#social-float');
12        //        }
13
14        var style = jQuery('body').attr("style");
15
16        //jQuery('.trigger-event-register >a').click(function(e){ e.preventDefault();jQuery('.dropdown-menu').slideToggle()});
17
18
19        if (typeof style !== typeof undefined && style && style.match("^background-image") != '') {
20            jQuery('body').addClass('full-ads-image');
21
22        }
23    })
24
25    function oh_clear_events_category_ddl() {
26        // private area clean legend
27
28        var items = jQuery('#event-cat-filter option');
29        if (items.length > 0) {
30            var list = jQuery('#event-cat-list li');
31            var arr = [];
32            items.each(function (e) { arr[e] = jQuery(this).text() });
33            list.each(function (e) { if (jQuery.inArray(jQuery(this).find('span').text(), arr) < 0) { jQuery(this).remove() } });
34        }
35
36
37    }
38
39    // event ajax paginate // not in use as customer asked to move to paginate
40    jQuery(document).ready(function ($) {
41        var btn = $("#load-more");
42        // The number of the next page to load (/page/x/).
43        var pageNum = parseInt(btn.data('current-page')) + 1;
44        btn.attr('data-current-page', pageNum);
45
46        // The maximum number of pages the current query can return.
47        var max = parseInt(btn.data('max-pages'));
48
49        // The link of the next page of posts.
50        var nextLink = btn.attr('href');
51
52        /**
53         * Replace the traditional navigation with our own,
54         * but only if there is at least one page of new posts to load.
55         */
56        if (pageNum <= max) {
57            $('#load-events-placeholder').append('<div class="events-placeholder-' + pageNum + '"></div>');
58            // Remove the traditional navigation.
59            //  $('.navigation').remove();
60        } else {
61            //   btn.hide();
62        }
63
64        var btn_text = btn.html();
65        /**
66         * Load new posts when the link is clicked.
67         */
68        btn.click(function () {
69
70            // Are there more posts to load?
71            if (pageNum <= max) {
72
73                // Show that we're working.
74                btn.text('טוען...');
75
76                $('.events-placeholder-' + pageNum).load(nextLink + ' #load-events-placeholder',
77                    function () {
78                        var pp = $('#no-of-items').data('items-pp') != '' ? $('#no-of-items').data('items-pp') : 20;
79                        var tn = pageNum < max ? pageNum * pp : $('#no-of-items').data('max');
80
81                        $('#no-of-items').data('items-pp') != '' ? $('#no2').html(tn) : $('#no2').html('1-' + tn);
82                        // Update page number and nextLink.
83
84                        if (btn.data('single-image-gallery')) {
85                            pageNum++;
86                            btn.attr('data-current-page', pageNum);
87                            nextLink = $('.wp-pagenavi a').eq(parseInt(pageNum)).attr('href');
88                            console.log('single image link, Pga e num: ' + pageNum);
89                            btn.attr('href', nextLink);
90                        } else {
91                            nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/' + pageNum);
92                        }
93
94
95
96                        // Add a new placeholder, for when user clicks again.
97                        $('#load-events-placeholder')
98                            .append('<div class="events-placeholder-' + pageNum + '"></div>');
99                        // Update the button message.
100                        if (pageNum <= max) {
101                            btn.text(btn_text);
102                        } else {
103                            btn.hide();
104                        }
105                    }
106                );
107            } else {
108                $('#pbd-alp-load-posts a').append('.');
109            }
110
111            return false;
112        });
113    });
114
115
116    // as the page loads, call these scripts
117    $(document).ready(function ($) {
118
119        oh_clear_events_category_ddl();
120        if ($('.events-tabs-inner').find('.nav-tabs').length > 0) {
121            $('.events-tabs-inner').tabs();
122        }
123
124        $('.fancybox').fancybox();
125        // private area link click - trigger ajax load
126        $('.private-area-nav a').click(function (e) {
127            $(this).replaceWith('<div style="padding-top: 25px;text-align: center"><span class="ajax-loader"></span></div>');
128        });
129        // block click for disable link
130        $('.private-area-nav.disabled a').click(function (e) { e.preventDefault() });
131        //  $('.fancybox').fancybox();
132
133
134        // $('.gallery-list-items.fancybox a').fancybox();
135
136        $('#pager-gallery1 ').bxSlider({
137            minSlides: 1,
138            maxSlides: 40,
139            slideMargin: 7,
140            infiniteLoop: false,
141            hideControlOnEnd: true,
142            pager: true
143
144        }
145
146        );
147
148        // user profile ajax function
149
150        if ($('#Country').length > 0) {
151            // run images filters function
152            $('#Country').change(function (e) {
153                if ($(this).val() != 'ישראל') {
154                    $('#City').prop('disabled', true);
155                    $('#City').addClass('disabled');
156                    $('#City').val(-1);
157                } else {
158                    $('#City').prop('disabled', false);
159                    $('#City').removeClass('disabled');
160                }
161
162            });
163        }
164
165        // Shvoong images filter functions
166
167        $.conditionalize = function (sourceSelect, conditionalSelect) {
168            var options = conditionalSelect.children().clone();
169
170            sourceSelect.change(function () {
171                var value = $(this).val();
172                conditionalSelect.children().remove();
173                options.clone().filter("[value=0]").appendTo(conditionalSelect);
174                if (0 != value) {
175                    options.clone().filter("[data-year=" + value + "]").appendTo(conditionalSelect);
176                } else {
177                    options.clone().appendTo(conditionalSelect);
178                }
179
180            });
181        }
182
183        // gallery page filters
184        $('#image-year-filter-gallery').change(function () {
185            $(this).closest('form').submit();
186        });
187        $('#image-event-filter-gallery').change(function () {
188            $(this).closest('form').submit();
189        });
190
191        // Used like this:
192        $.conditionalize($("#image-year-filter"), $("#image-event-filter"));
193        if ($('#site-images-page').length > 0) {
194
195            $('#image-year-filter').change(function (e) {
196                $('#image-event-filter').val("0");
197                var select = $(this).val();
198
199
200                //  items.hide();
201                //$("option[data-year="+select+"]").show();
202                //$("option[value=0]").show();
203
204
205                if (select == 0) {
206                    $('.event-gallery-wrapper').removeClass('hide');
207                } else {
208                    $('.event-gallery-wrapper').addClass('hide');
209                    $('*[data-year="' + select + '"]').removeClass('hide');
210                }
211            });
212
213            $('#image-event-filter').change(function (e) {
214                //$('#image-year-filter').val("0");
215                var select = $(this).val();
216
217                if (select == 0) {
218                    $('.event-gallery-wrapper').removeClass('hide');
219                } else {
220                    $('.event-gallery-wrapper').addClass('hide');
221                    $('*[data-event="' + select + '"]').removeClass('hide');
222                }
223            });
224        }
225
226
227
228        if ($('#my-images').length > 0 || $('#site-images-page').length > 0) {
229
230            function reset_paginate(current_page) {
231                console.log(obj);
232                var max = 20;
233                var page = 1;
234                var count = obj.not('.hide').length;
235                var paginate = '<div id="paginate" class="wp-pagenavi">';
236                var pages = Math.ceil(count / max);
237                var before, after;
238                before = count / (page - 1);
239                after = count / page;
240
241                if (max != current_page) {
242                    var prev_page = current_page == 1 ? 2 : current_page + 1;
243                    paginate += '<a class="nextpostslink" data-page="' + prev_page + '" href="#">&lt;</a>';
244                }
245                for (var i = 1; i <= pages; i++) {
246                    if (i == current_page) {
247                        paginate += '<span class="current">' + i + '</span>';
248                    } else {
249                        $hide = Math.abs(i - current_page) > 11 ? ' hide ' : '';
250                        paginate += '<a class="page larger' + $hide + '" data-page="' + i + '" href="#">
250' + i + '</a>';
251                    }
252
253                }
254                if (1 != current_page) {
255                    var next_page = current_page - 1;
256                    paginate += '<a class="nextpostslink" data-page="' + next_page + '" href="#">&gt;</a>';
257                }
258
259                obj.removeAttr('data-page');
260
261                var items = obj.not('.hide');
262
263                items.each(function (index) {
264                    if (index == (max * page)) {
265                        page++;
266                    }
267                    $(this).attr('data-page', page);
268                });
269                items.show();
270                obj.not("[data-page='" + current_page + "']").hide();
271
272                $('#paginate').replaceWith(paginate);
273                $('#paginate>a').click(function (e) {
274                    e.preventDefault();
275                    reset_paginate($(this).data('page'));
276                });
277            }
278            var obj = $('#my-images').length > 0 ? $('.picture-box-wrapper') : $('.event-gallery-wrapper');
279            reset_paginate(1);
280
281
282
283
284            // run images filters function
285            $('#image-type-filter').change(function (e) {
286                $('#image-year-filter').val("0");
287                $('#image-event-filter').val("0");
288                $('#image-gallery-filter').val("0");
289
290                var select = $(this).val();
291                $('.picture-box-wrapper').addClass('hide');
292                if (select == 1) {
293                    // purchase only
294                    $('*[data-purchase="1"]').removeClass('hide');
295                } else if (select == 2) {
296                    // favorite only
297                    $('*[data-fav="1"]').removeClass('hide');
298                } else {
299                    $('.picture-box-wrapper').removeClass('hide');
300                }
301                reset_paginate(1);
302            });
303
304            $('#image-year-filter').change(function (e) {
305                $('#image-type-filter').val("0");
306                $('#image-event-filter').val("0");
307                $('#image-gallery-filter').val("0");
308                var select = $(this).val();
309                console.log(select);
310                if (select == 0) {
311                    $('.picture-box-wrapper').removeClass('hide');
312                } else {
313                    $('.picture-box-wrapper').addClass('hide');
314                    $('*[data-year="' + select + '"]').removeClass('hide');
315                }
316                reset_paginate(1);
317            });
318
319            $('#image-event-filter').change(function (e) {
320                //  $('#image-year-filter').val("0");
321                $('#image-type-filter').val("0");
322
323                var select = $(this).val();
324                console.log(select);
325                if (select == 0) {
326                    $('.picture-box-wrapper').removeClass('hide');
327                } else {
328                    $('.picture-box-wrapper').addClass('hide');
329                    $('*[data-event="' + select + '"]').removeClass('hide');
330                    $.ajax({
331                        type: 'POST',
332                        url: oh.ajaxurl,
333                        data: {
334                            'action': 'get_event_gallery',
335                            'event-id': select
336                        },
337                        success: function (data) {
338                            $('#image-gallery-filter').html(data);
339                        }
340                    });
341                }
342                reset_paginate(1);
343            });
344
345            $('#image-gallery-filter').change(function (e) {
346                $('#image-type-filter').val("0");
347                $('#image-year-filter').val("0");
348                var select = $(this).val();
349                if (select == 0) {
350                    $('.picture-box-wrapper').removeClass('hide');
351                } else {
352                    $('.picture-box-wrapper').addClass('hide');
353                    $('*[data-gallery="' + select + '"]').removeClass('hide');
354                }
355                reset_paginate(1);
356            });
357
358
359        }
360
361
362        if ($('#years-select').length > 0) {
363            $('#years-select').change(function (e) {
364
365                var select = $(this).val();
366                if (select == 0) {
367                    $('.fav-article').show();
368                } else {
369                    $('.fav-article').hide();
370                    $('*[data-year="' + select + '"]').show();
371                }
372            });
373            $('#fav-cat-filter').change(function (e) {
374                var select = $(this).val();
375                if (select == 0) {
376                    $('.fav-article').show();
377                } else {
378                    $('.fav-article').hide();
379                    $('*[data-catid="' + select + '"]').show();
380                }
381            });
382        }
383
384        $('#event-cat-filter').change(function (e) {
385            $('.cat-filter').hide();
386            var select = $(this).val();
387            if (select == 0) {
388                $('.cat-filter').show();
389            } else {
390                console.log(select);
391                $('*[data-catid="' + select + '"]').show();
392            }
393        });
394
395
396        if ($('.results-table').length > 0) {
397            $('#years-select').change(function (e) {
398                var select = $(this).val();
399                if (select == 0) {
400                    $('.results-table tbody tr').show();
401                } else {
402                    $('.results-table tbody tr').hide();
403                    $('*[data-year="' + select + '"]').show();
404                }
405            });
406
407        }
408
409
410        if ($('.icon-fav2').length > 0) {
411            if (!$('body').hasClass('logged-in')) {
412                $('.icon-fav2').popover({ 'content': oh.favorite_not_login, 'placement': 'top', 'container': '.icon-fav2' });
413
414            }
415            $('.icon-fav2').click(function (e) {
416                e.preventDefault();
417
418
419                var obj = $(this);
420                var action = obj.hasClass('active') ? 'image_favorite_remove' : 'image_favorite_add';
421                obj.hasClass('active') ? obj.parent().parent().parent().attr("data-fav", '') : obj.parent().parent().parent().attr("data-fav", '1');
422
423                $.ajax({
424                    type: 'POST',
425                    url: oh.ajaxurl,
426                    data: {
427                        'action': action,
428                        'image-id': $(this).data('image-id')
429                    },
430                    success: function (data) {
431                        obj.toggleClass('active');
432
433                    }
434                });
435
436            });
437        }
438
439
440
441
442        if (screen.width < 767) {
443            $("#site-header").addClass('fixed')
444        } else {
445
446        }
447
448
449
450
451        // login action
452        if ($('#loginform-custom').length > 0) {
453            $('#loginform-custom').submit(function (e) {
454                e.preventDefault();
455                var form = $('#loginform-custom'),
456                    username = $('#username'),
457                    password = $('#pass'),
458                    security = $('#security');
459                if (username.val() == username.attr('placeholder')) {
460                    alert(oh.empty_username);
461                    return false;
462                } else if (password.val() == password.attr('placeholder')) {
463                    alert(oh.empty_password);
464                    return false;
465                }
466                // Perform AJAX login on form submit
467
468                $('#loginform-custom p.status').show().text(oh.loadingmessage);
469                $.ajax({
470                    type: 'POST',
471                    dataType: 'json',
472                    url: oh.ajaxurl,
473                    data: {
474                        'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
475                        'username': username.val(),
476                        'password': password.val(),
477                        'security': security.val()
478                    },
479                    success: function (data) {
480                        $('#loginform-custom p.status').text(data.message);
481                        if (data.loggedin == true) {
482                            //                         document.location.href = oh.redirecturl;
483                            location.reload();
484                        }
485                    }
486                });
487                e.preventDefault();
488
489            });
490        }
491
492        // login action
493        if ($('#loginform-custom_mobile').length > 0) {
494            $('#loginform-custom_mobile').submit(function (e) {
495                e.preventDefault();
496                var form = $('#loginform-custom_mobile'),
497                    username = $('#username_mobile'),
498                    password = $('#pass_mobile'),
499                    security = $('#security');
500                if (username.val() == username.attr('placeholder')) {
501                    alert(oh.empty_username);
502                    return false;
503                } else if (password.val() == password.attr('placeholder')) {
504                    alert(oh.empty_password);
505                    return false;
506                }
507                // Perform AJAX login on form submit
508
509                $('#loginform-custom_mobile p.status').show().text(oh.loadingmessage);
510                $.ajax({
511                    type: 'POST',
512                    dataType: 'json',
513                    url: oh.ajaxurl,
514                    data: {
515                        'action': 'ajaxlogin', //calls wp_ajax_nopriv_ajaxlogin
516                        'username': username.val(),
517                        'password': password.val(),
518                        'security': security.val()
519                    },
520                    success: function (data) {
521                        $('#loginform-custom_mobile p.status').text(data.message);
522                        if (data.loggedin == true) {
523                            //                         document.location.href = oh.redirecturl;
524                            location.reload();
525                        }
526                    }
527                });
528                e.preventDefault();
529
530            });
531        }
532
533        $('#facebook-login a').click(function (e) {
534            if ($('.wp-user-form').length > 0) {
535                // register page
536                $('.wp-user-form').replaceWith('<p><span class="ajax-loader"></span>' + oh.facebook_loading_message + '</p>');
537            } else {
538                // login in the  header
539            }
540            connectToFacebook(onConnected, onCanceled);
541            e.preventDefault();
542
543        });
544        if ($('#password_reset_form').length > 0) {
545            $('#password_reset_form').submit(function (e) {
546
547                e.preventDefault();
548                var form = $('#password_reset_form'),
549                    username = form.find('#username'),
550                    security = $('#pass_reset_security');
551                if (username.val() == username.attr('placeholder')) {
552                    alert('please enter user name');
553                    return false;
554                }
555                // Perform AJAX login on form submit
556
557                $('#password_reset_form p.status').show().text(oh.loadingmessage);
558                $.ajax({
559                    type: 'POST',
560                    dataType: 'json',
561                    url: oh.ajaxurl,
562                    data: {
563                        'action': 'ajax_password_reset', //calls wp_ajax_nopriv_ajaxlogin
564                        'username': username.val(),
565                        'security': security.val()
566                    },
567                    success: function (data) {
568                        console.log(data);
569                        $('#password_reset_form p.status').text(data.message);
570                        if (data.loggedin == true) {
571                            //document.location.href = oh.redirecturl;
572                        }
573                    }
574                });
575                e.preventDefault();
576
577            });
578        }
579
580
581
582
583        if ($('.favorite').length > 0) {
584            if (!$('body').hasClass('logged-in')) {
585                $('.favorite').popover({ 'content': oh.favorite_not_login, 'placement': 'top', 'container': '.favorite' });
586
587            }
588            $('.favorite').click(function (e) {
589                console.log('click favorite');
590                e.preventDefault();
591
592                var obj = $(this);
593                if ($('.page-template-private-areapage-events-php').length > 0) {
594                    obj.closest('.col-md-4').remove();
595                }
596                jQuery.post(
597                    oh.ajaxurl,
598                    {
599                        'action': 'add_to_favorite',
600                        'data': obj.data('id'),
601                        'post-type': obj.data('post-type')
602                    },
603                    function (response) {
604                        if (response == '1') {
605                            // I used again the dom as we might have more then one fav object
606                            $("a[data-id='" + obj.data('id') + "']").addClass('remove-favorite');
607                        } else {
608                            //                       obj.removeClass('remove-favorite');
609                            $("a[data-id='" + obj.data('id') + "']").removeClass('remove-favorite');
610                        }
611                    }
612                );
613            });
614        }
615
616
617        // single event page H2 toggle view
618        $('.toggle-title').click(function () {
619            $(this).next().stop().slideToggle('slow');
620            $(this).toggleClass('closed');
621        });
622        // events page toggle view click
623        $('#box-view').click(function (e) {
624            $('.events-block').removeClass('events-list');
625            $(this).addClass('active');
626            $('#list-view').removeClass('active');
627            $('.events-block').find('article').find('.event-title').addClass('col-md-5');
628            $('.events-block').find('article').find('.event-title').removeClass('col-md-9');
629            $('.events-block').find('article').addClass('white gradient');
630
631        });
632        // events page toggle view click
633        $('#list-view').click(function (e) {
634            $('.events-block').addClass('events-list');
635            $(this).addClass('active');
636            $('#box-view').removeClass('active');
637            $('.events-block.events-list').find('article').find('.event-title').addClass('col-md-9');
638            $('.events-block.events-list').find('article').find('.event-title').removeClass('col-md-5');
639            $('.events-block.events-list').find('article').removeClass('white gradient');
640
641        });
642
643        // events page toggle view click
644        $('.small-view #list-view').click(function (e) {
645            console.log('click on list view');
646            $(this).addClass('active');
647            $('#box-view').removeClass('active');
648            var obj = $('.box-view-item');
649            obj.removeClass('box-view-item').addClass('list-view-item');
650            obj.removeClass('col-md-4').addClass('list-item');
651            obj.find('.hidden').removeClass('hidden');
652            // start hiding elements
653            //     obj.find('.round-shadow').addClass('hidden');
654            //    obj.find('.single-event-date').addClass('hidden');
655        });
656
657        $('.small-view #box-view').click(function (e) {
658            console.log('click on box view');
659            $(this).addClass('active');
660            $('#list-view').removeClass('active');
661            var obj = $('.list-view-item');
662            obj.removeClass('list-view-item').addClass('box-view-item');
663            obj.addClass('col-md-4').removeClass('list-item');
664            //       obj.find('.hidden').removeClass('hidden');
665
666
667            // obj.find('.date.icon').addClass('hidden');
668        });
669
670
671
672        $('#meta_oh_event_date').datepicker({
673            format: "dd/mm/yyyy",
674            language: "he",
675            autoclose: true
676        });
677        $('.input-append.date').datepicker({
678            format: "dd/mm/yyyy",
679            language: "he",
680            autoclose: true
681        });
682        $('.authors-slider').bxSlider({
683            minSlides: 6,
684            maxSlides: 6,
685            slideWidth: 132,
686            slideMargin: 20,
687            infiniteLoop: false,
688            hideControlOnEnd: true,
689            pager: false,
690            nextText: '',
691            prevText: ''
692        }
693
694        );
695        $('.sticky-slider').show().bxSlider({
696            controls: false,
697            nextText: '',
698            prevText: ''
699        });
700        $('.feature-sticky-slider').bxSlider({
701            minSlides: 1,
702            maxSlides: 4,
703            slideWidth: 234,
704            slideMargin: 15,
705            controls: true,
706            infiniteLoop: false,
707            hideControlOnEnd: true,
708            pager: false,
709            nextText: '>',
710            prevText: '<'
711        }
712
713        );
714
715        $('#menu-mobile >li').click(function () {
716            $(this).find('.sub-menu').slideToggle('fast');
717        });
718
719        $("#login-btn").click(function () {
720            if ($('#forgotpw-form-wrapper').is(':hidden')) {
721                $("#login-form-wrapper").slideToggle('slow');
722            } else {
723                $("#forgotpw-form-wrapper").slideUp();
724            }
725        });
726
727        $("#login-btn-mobile").click(function () {
728            $("#login-form-wrapper").remove();
729            if ($('#forgotpw-form-wrapper-mobile').is(':hidden')) {
730                $("#login-form-wrapper-mobile").slideDown();
731            } else {
732                $("#forgotpw-form-wrapper-mobile").slideUp();
733            }
734        });
735        // link in the register page
736        $("#link-login").click(function (e) {
737            e.preventDefault();
738            if ($('#forgotpw-form-wrapper').is(':hidden')) {
739                $("#login-form-wrapper").slideToggle('slow');
740            }
741        });
742        $(".forgot-password-link").click(function () {
743            $("#login-form-wrapper").slideUp();
744            $("#forgotpw-form-wrapper").slideDown();
745            $("#login-form-wrapper-mobile").slideUp();
746            $("#forgotpw-form-wrapper-mobile").removeClass('hidden')
747        });
748        $(".forgot-password-link-back").click(function () {
749            $("#login-form-wrapper").slideDown();
750            $("#forgotpw-form-wrapper").slideUp();
751            $("#login-form-wrapper-mobile").slideDown();
752            $("#forgotpw-form-wrapper-mobile").addClass("hidden")
753        });
754
755        /* private area event functions */
756        $('#event-type').change(function () {
757            window.location.href = $(this).val();
758            $('<span class="ajax-loader"></span>').insertBefore($(this));
759        });
760        /* END private area event functions */
761
762
763        $('.trigger-event-register span').click(function () {
764            $(this).parent().find('.events-register').slideToggle('slow');
765        });
766
767        // back to top
768        $('a[href=#top]').click(function () {
769            $('html, body').animate({ scrollTop: 0 }, 'slow');
770            return false;
771        });
772
773        // modify tag cloud links to match up with twitter bootstrap
774        $("#tag-cloud a").each(function () {
775            addTwitterBSClass(this);
776            return true;
777        });
778
779        $("p.tags a").each(function () {
780            addTwitterBSClass(this);
781            return true;
782        });
783
784        $("ol.commentlist a.comment-reply-link").each(function () {
785            $(this).addClass('btn btn-success btn-mini');
786            return true;
787        });
788
789        $('#cancel-comment-reply-link').each(function () {
790            $(this).addClass('btn btn-danger btn-mini');
791            return true;
792        });
793
794        $('article.post').hover(function () {
795            $('a.edit-post').show();
796        }, function () {
797            $('a.edit-post').hide();
798        });
799
800        //// Input placeholder text fix for IE
801        //$('[placeholder]').focus(function() {
802        //  var input = $(this);
803        //  if (input.val() == input.attr('placeholder')) {
804        //	input.val('');
805        //	input.removeClass('placeholder');
806        //  }
807        //}).blur(function() {
808        //  var input = $(this);
809        //  if (input.val() == '' || input.val() == input.attr('placeholder')) {
810        //	input.addClass('placeholder');
811        //	input.val(input.attr('placeholder'));
812        //  }
813        //}).blur();
814        //
815        //// Prevent submission of empty form
816        //$('[placeholder]').parents('form').submit(function() {
817        //  $(this).find('[placeholder]').each(function() {
818        //	var input = $(this);
819        //	if (input.val() == input.attr('placeholder')) {
820        //	  input.val('');
821        //	}
822        //  })
823        //});
824
825        $('#s').focus(function () {
826            if ($(window).width() < 940) {
827                $(this).animate({ width: '200px' });
828            }
829        });
830
831        $('#s').blur(function () {
832            if ($(window).width() < 940) {
833                $(this).animate({ width: '100px' });
834            }
835        });
836
837        $('.alert-message').alert();
838
839        $('.dropdown-toggle').dropdown();
840
841        $('.map-title').click(function () {
842            $(this).toggleClass('plus');
843            $(this).toggleClass('minus');
844            var id = $("." + $(this).data('item'));
845            id.toggleClass('hide');
846        });
847
848
849
850
851        //    $('#facebook-login2 a').click(function(e){
852        //        $.ajaxSetup({ cache: true });
853        //        $.getScript('//connect.facebook.net/en_UK/all.js', function(){
854        //            FB.init({
855        //                appId: '351083924934635'
856        //            });
857        //
858        //            FB.Event.subscribe('auth.authResponseChange', auth_response_change_callback);
859        //        });
860        //// In your JavaScript
861        //        var auth_response_change_callback = function(response) {
862        //            var email = false;
863        //            var signedRequest = '';
864        //            FB.api('/me', function(userInfo) {
865        //                console.log(userInfo.email);
866        //            });
867        //            signedRequest= response.authResponse.signedRequest ;
868        //            do_facebook_login( signedRequest, email );
869        //        }
870        //        var key = (is_fb_login());
871        //        console.log(key);
872        //        e.preventDefault();
873        //    });
874        //
875        //
876        //    function testing(){
877        //        console.log('function finish');
878        //    }
879
880        //    function is_fb_login(){
881        //     var $key ;
882        //        FB.getLoginStatus(function(response) {
883        //            if (response.status === 'connected') {
884        //                var uid = response.authResponse.userID;
885        //                var accessToken = response.authResponse.accessToken;
886        //                $key =  response.authResponse.signedRequest;
887        //
888        //            } else if (response.status === 'not_authorized') {
889        //                // the user is logged in to Facebook,
890        //                // but has not authenticated your app
891        //                callFBLogin();
892        //                $key =  FB.getAuthResponse();
893        //
894        //            } else {
895        //                callFBLogin();
896        //                $key =  FB.getAuthResponse();
897        //            }
898        //
899        //
900        //        });
901        //
902        //        return $key;
903        //
904        //    }
905        //
906        //
907        //    function getCurrentUserInfo() {
908        //
909        //        FB.api('/me', function(userInfo) {
910        //          user ( userInfo );
911        //        });
912        //    }
913        //    function do_facebook_login( signedRequest, email ){
914        //        $.ajax({
915        //            type: 'POST',
916        //            dataType: 'json',
917        //            url: oh.ajaxurl,
918        //            data: {
919        //                'action': 'ajax_facebook_login', //calls wp_ajax_nopriv_ajaxlogin
920        //                'signedRequest': signedRequest,
921        //                'email': email
922        //            },
923        //            success: function(data){
924        //                console.log(data);
925        //                if (data.loggedin == true){
926        //                    document.location.href = oh.redirecturl;
927        //                }
928        //            }
929        //        });
930        //    }
931        //
932        //    function callFBLogin(){
933        //
934        //       return FB.login(function(response) {
935        //            if (response.authResponse) {
936        //                FB.api('/me', function(response) {
937        //                    return response;
938        //                });
939        //            }else{
940        //                alert("Access not authorized.");
941        //            }
942        //        },{scope: 'email'});
943        //    }
944
945
946
947    }); /* end of as page load scripts */
948
949
950    // add twitter bootstrap classes and color based on how many times tag is used
951    function addTwitterBSClass(thisObj) {
952        var title = $(thisObj).attr('title');
953        if (title) {
954            var titles = title.split(' ');
955            if (titles[0]) {
956                var num = parseInt(titles[0]);
957                if (num > 0)
958                    $(thisObj).addClass('label');
959                if (num == 2)
960                    $(thisObj).addClass('label label-info');
961                if (num > 2 && num < 4)
962                    $(thisObj).addClass('label label-success');
963                if (num >= 5 && num < 10)
964                    $(thisObj).addClass('label label-warning');
965                if (num >= 10)
966                    $(thisObj).addClass('label label-important');
967            }
968        }
969        else
970            $(thisObj).addClass('label');
971        return true;
972    }
973
974})(jQuery);
975
976
977//window.fbAsyncInit = function() {
978//    FB.init({
979//        appId      : '351083924934635',
980//        status     : true, // check login status
981//        cookie     : true, // enable cookies to allow the server to access the session
982//        xfbml      : true  // parse XFBML
983//    });
984//
985//    FB.Event.subscribe('auth.authResponseChange', auth_response_change_callback);
986//
987//};
988
989
990function SendLinkByMail(subject, body) {
991    var uri = "mailto:?subject=";
992    uri += encodeURIComponent(subject);
993    uri += "&body=";
994    uri += encodeURIComponent(body);
995    window.open(uri);
996}
997
998
999
1000// verify user register form
1001jQuery(document).ready(function ($) {
1002    var form = $('#user-register-form1');
1003
1004    if (form.length > 0) {
1005        var submit = form.find('#wp-submit'),
1006            success = true;
1007        submit.click(function (e) {
1008            e.preventDefault();
1009
1010            $('span.error').remove();
1011            var fname = form.find('#fname'),
1012                lname = form.find('#lname'),
1013                email = form.find('#email'),
1014                pass = form.find('#pass'),
1015                pass2 = form.find('#pass2'),
1016                current_pass = form.find('#oldpass');
1017
1018            if ('' == fname.val()) {
1019                fname.addClass('error');
1020                fname.after('<span class="error">' + fname.data('error-text') + '</span>');
1021                success = false;
1022            }
1023            if ('' == lname.val()) {
1024                lname.addClass('error');
1025                lname.after('<span class="error">' + lname.data('error-text') + '</span>');
1026                success = false;
1027            }
1028            if ('' == email.val() || !isValidEmailAddress(email.val())) {
1029                email.addClass('error');
1030                email.after('<span class="error">' + email.data('error-text') + '</span>');
1031                success = false;
1032            }
1033            if ('true' == pass.data('required')) {
1034                // on register page  - password is required!!
1035                if ('' == pass.val()) {
1036                    pass.addClass('error');
1037                    pass.after('<span class="error">' + pass.data('error-text') + '</span>');
1038                    success = false;
1039                } else if (pass.val() != pass2.val()) {
1040                    pass.addClass('error');
1041                    pass.after('<span class="error">' + pass.data('error-match-text') + '</span>');
1042                    success = false;
1043                }
1044            } else {
1045                // profile page check if update password done
1046                if ('' != current_pass.val() || '' != pass.val() || '' != pass2.val()) { // user trigger password change
1047                    current_pass.addClass('error');
1048                    pass.addClass('error');
1049                    pass2.addClass('error');
1050                    pass2.after('<span class="error">' + pass.data('error-text') + '</span>');
1051                    success = false;
1052                } else if (pass.val() != pass2.val()) {
1053                    pass.addClass('error');
1054                    pass.after('<span class="error">' + pass.data('error-match-text') + '</span>');
1055                    success = false;
1056                }
1057            }
1058
1059            if (success) {
1060                $('<p><span class="ajax-loader"></span>' + oh.register_message + '</p>').insertAfter(form);
1061                form.hide();
1062                form.submit();
1063            }
1064
1065        });
1066
1067
1068
1069        return success;
1070    }
1071
1072
1073});
1074
1075// verify update profile parameter
1076
1077
1078
1079
1080
1081function isValidEmailAddress(emailAddress) {
1082    var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
1083    return pattern.test(emailAddress);
1084};
1085
1086
1087$(".mobile-slider .rsImg").click(function () {
1088    window.location.href = $(this).parent().find('a').attr('href');
1089});
1090
1091
1092function emailCurrentPage() {
1093    window.location.href = "mailto:?subject=" + document.title + "&body=" + escape(window.location.href);
1094}
1095
1096
1097// sponsered span for articles
1098
1099$(document).ready(function ($) {
1100
1101    $(window).load(function () {
1102        jQuery(".sponsered").find(".tag").append("<span class='sponsered-tag'> | בשיתוף  Taboola</span>")
1103        jQuery('#mega-menu-primary').append('<li class=" search-icon mega-menu-item mega-menu-item-type-custom mega-menu-item-object-custom mega-align-bottom-left mega-menu-flyout mega-menu-item-137424" id="mega-menu-item-137424"><a class="mega-menu-link" href="#" data-toggle="modal" data-target="#searchpopup" tabindex="0"><span> חיפוש <svg  class="d-none d-md-inline-block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29.79 29.79"><defs></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><g id="Group_2" data-name="Group 2"><path id="Path_3" data-name="Path 3" d="M12,24a11.94,11.94,0,0,0,7.35-2.52l7.92,7.92a1.49,1.49,0,0,0,2.11-2.1l-7.92-7.92A12,12,0,1,0,12,24ZM5.62,5.61a9,9,0,1,1,0,12.73h0a9,9,0,0,1,0-12.68h0Z" /></g></g></g></svg></span></a></li>')
1104          jQuery('#mega-menu-top').append('<li class=" search-icon mega-menu-item mega-menu-item-type-custom mega-menu-item-object-custom mega-align-bottom-left mega-menu-flyout mega-menu-item-137424" id="mega-menu-item-137424"><a class="mega-menu-link" href="#" data-toggle="modal" data-target="#searchpopup" tabindex="0"><span> <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve"><style type="text/css"> .st0{fill:#FFFFFF;}</style><g><g><path class="st0" d="M505.7,475.6L360.1,330c28.2-34.8,45.2-79.1,45.2-127.3C405.3,90.9,314.4,0,202.7,0S0,90.9,0,202.7 s90.9,202.7,202.7,202.7c48.2,0,92.5-17,127.3-45.2l145.6,145.6c4.2,4.2,9.6,6.3,15.1,6.3s10.9-2.1,15.1-6.3 C514.1,497.4,514.1,483.9,505.7,475.6z M202.7,362.7c-88.2,0-160-71.8-160-160s71.8-160,160-160s160,71.8,160,160 S290.9,362.7,202.7,362.7z"/></g></g></svg> </span></a></li>')
1105    })
1106
1107
1108}
1108)

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.