PageSourceSearch

https://www.discountschoolsupply.com/_ui/addons/donationwishlistad…/common/js/donationwishlistaddon.js?v=S530

js discountschoolsupply.com collected 2026-09-25 18:19:09 UTC 41,948 bytes, 1,109 lines download raw bytes

1ACC.donationwishlistaddon = {
2
3	_autoload: [
4		"bindSchoolSearch",
5		"initPageEvents",
6		["bindAddToCartFromWishlist",$("#add_to_cart_from_wishlist").length != 0],
7        "wlqasvalidateaddress"
8	],
9
10	bindSchoolSearch: function(){
11        if ($("input[type='text'][name='schoolName']").length > 0) {
12            $("input[type='text'][name='schoolName']").autocomplete({
13                source: function (request, response) {
14                var element = this.element;
15                    $.ajax({
16                        url: ACC.config.encodedContextPath + '/wishlist/school/'+element.val(),
17                        dataType: "json",
18                        success: function (data) {
19                            response($.map(data, function (item) {
20                                if (item.isEmpty){
21                                    return {
22                                        name: item.name,
23                                        isEmpty:true,
24                                    }
25                                }
26                                addressNotNull = (item.address !== null);
27                                return {
28                                    name: item.name,
29                                    schoolTypeCode: item.typeCode,
30                                    schoolCode: item.code,
31                                    addressId: addressNotNull ? item.address.id : '',
32                                    addressline1: addressNotNull ? item.address.line1 : '',
33                                    addressline2: addressNotNull ? item.address.line2 : '',
34                                    townCity: addressNotNull ? item.address.town : '',
35                                    regionIso: addressNotNull ? (item.address.region !== null ? item.address.region.isocode : '') : '',
36                                    postCode: addressNotNull ? item.address.postalCode : '',
37                                    isEmpty: false,
38                                };
39                            }));
40                        }
41                    });
42                },
43                minLength: 3,
44                appendTo: "#schoolAutoComplete",
45                select: function (event, ui) {
46                    event.preventDefault();
47                    if (ui.item.name === null) {
48                        return;
49                    }
50                    if(!ui.item.isEmpty){
51                        $(this).val(ui.item.name);
52                    }
53
54                    // removing schooltype from whishlist profile create page
55                    //$("select[name='schoolType']").val(ui.item.schoolTypeCode || "");
56                    //$("select[name='schoolType']").trigger('change');
57                    $("#schoolCode").val(ui.item.schoolCode || "").valid();
58                    $("#address\\.line1").val(ui.item.addressline1 || "").valid();
59                    $("#address\\.line2").val(ui.item.addressline2 || "").valid();
60                    $("#address\\.townCity").val(ui.item.townCity || "").valid();
61                    $("#address\\.regionIso").val(ui.item.regionIso || "");
62                    $("#address\\.regionIso").trigger('change');
63                    $("#address\\.postcode").val(ui.item.postCode || "").valid();
64                    $("#address\\.addressId").val(ui.item.addressId || "").valid();
65
66                }
67            }).data("ui-autocomplete")._renderItem = function (ul, item) {
68                if (item.isEmpty) {
69                        return $("<li></li>").data("item.autocomplete", item).append($("<span class='name noresult'>").text(item.name))
70                            .appendTo(ul);
71                    }
72                return $("<li></li>").data("item.autocomplete", item).append($('<span>').addClass('name').html(item.name.replace(new RegExp(this.element.val(), "gi"), (match) => `<b>${match}</b>`)),
73                    $('<span>').addClass('addressline1').text(item.addressline1),
74                    $('<span>').addClass('townCity').text(item.townCity),
75                    $('<span>').addClass('regionIso').text(item.regionIso)).appendTo(ul);
76            };
77        }
78	},
79
80    checkQtySelector: function (self, mode) {
81        var $qtySelector = $(document).find(self).parents(".js-qty-selector-wishlist");
82        var input = $qtySelector.find(".js-qty-selector-input");
83        var inputVal = parseInt(input.val());
84        var max = input.data("max");
85        var min = input.data("min");
86        var minusBtn = $qtySelector.find(".js-qty-selector-minus");
87        var plusBtn = $qtySelector.find(".js-qty-selector-plus");
88
89        $qtySelector.find(".btn").removeAttr("disabled");
90
91        if (mode == "minus") {
92             console.log(inputVal)
93            ACC.donationwishlistaddon.updateQtyValue(self, inputVal - 1)
94            if (inputVal - 1 == min) {
95                minusBtn.attr("disabled", "disabled")
96            }
97
98        } else if (mode == "reset") {
99            ACC.donationwishlistaddon.updateQtyValue(self, 1)
100
101        } else if (mode == "plus") {
102            if(max == "FORCE_IN_STOCK") {
103                ACC.donationwishlistaddon.updateQtyValue(self, inputVal + 1)
104            } else if (inputVal <= max) {
105                ACC.donationwishlistaddon.updateQtyValue(self, inputVal + 1)
106                if (inputVal + 1 == max) {
107                    plusBtn.attr("disabled", "disabled")
108                }
109            } else {
110                plusBtn.attr("disabled", "disabled")
111            }
112        } else if (mode == "input") {
113            if (inputVal == 0) {
114                minusBtn.attr("disabled", "disabled")
115            } else if(max == "FORCE_IN_STOCK" && inputVal > 0) {
116                ACC.donationwishlistaddon.updateQtyValue(self, inputVal)
117            } else if (inputVal == max) {
118                plusBtn.attr("disabled", "disabled")
119            } else if (inputVal < 1) {
120                ACC.donationwishlistaddon.updateQtyValue(self, 0)
121                minusBtn.attr("disabled", "disabled")
122            } else if (inputVal > max) {
123                ACC.donationwishlistaddon.updateQtyValue(self, max)
124                plusBtn.attr("disabled", "disabled")
125            }
126        } else if (mode == "focusout") {
127            if (isNaN(inputVal)){
128                ACC.donationwishlistaddon.updateQtyValue(self, 1);
129                minusBtn.attr("disabled", "disabled");
130            } else if(inputVal >= max) {
131                plusBtn.attr("disabled", "disabled");
132            }
133        }
134    },
135
136    updateQtyValue: function (self, value) {
137        var qtySelector = $(document).find(self).parents(".js-qty-selector-wishlist");
138            //for pdp lets handle how we were before
139            var input = $(document).find(self).parents(".js-qty-selector-wishlist").find(".js-qty-selector-input");
140            var addtocartQty = $(document).find(self).parents(".addtocart-component").find("#addToCartForm").find(".js-qty-selector-input");
141            var configureQty = $(document).find(self).parents(".addtocart-component").find("#configureForm").find(".js-qty-selector-input");
142            input.val(value);
143            addtocartQty.val(value);
144            configureQty.val(value);
145            ACC.donationwishlistaddon.showSaveButton($('.js-wishlist-product'));
146    },
147
148    bindSuggestedForms:function(){
149        $('.js-edit-entered-address').click(function(e)
150        {
151            ACC.colorbox.close();
152        });
153
154        $('.use-entered-address').click(function(e)
155        {
156            var wlForm = $('#wishListProfileForm');
157            wlForm.find('#enteredAddressUsed').val(true);
158            $('#wishListProfileForm').submit();
159        });
160
161        $('.use-corrected-address').click(function(e)
162        {
163            var wlForm = $('#wishListProfileForm');
164            wlForm.find('#address\\.line1').val($('#suggestedLine1').val());
165            wlForm.find('#address\\.line2').val($('#suggestedLine2').val());
166            wlForm.find('#address\\.townCity').val($('#suggestedCity').val());
167            wlForm.find('#address\\.regionIso').val('US-' + $('#suggestedBillState').val());
168            wlForm.find('#address\\.postcode').val($('#suggestedZipCode').val());
169            wlForm.find('#deliveryPtCode').val($('#deliveryPointBarcode').val());
170            wlForm.find('#chkDigit').val($('#checkDigit').val());
171            wlForm.find('#correctedAddressUsed').val(true);
172            $('#wishListProfileForm').submit();
173        });
174    },
175    getAddressQasString: function (){
176        var addressForm = $('#wishListProfileForm');
177        var addressLine1 = addressForm.find('#address\\.line1').val();
178        var addressLine2 = addressForm.find('#address\\.line2').val();
179        var addressCity = addressForm.find('#address\\.townCity').val();
180        var addressRegion = addressForm.find('#address\\.regionIso').val();
181        addressRegion = addressRegion.replace('US-', '');
182        var addressPostcode = addressForm.find('#address\\.postcode').val();
183        if(addressLine1 != undefined){
184            addressLine1 = addressLine1.replace(/\s+/g, ":");
185        }
186        if(addressLine2 != undefined){
187            addressLine2 = addressLine2.replace(/\s+/g, ":");
188        }
189        if(addressCity != undefined){
190            addressCity = addressCity.replace(/\s+/g, ":");
191        }
192        if(addressPostcode != undefined) {
193            addressPostcode = addressPostcode.replace(/\s+/g, ":");
194        }
195
196        return [addressLine1,addressLine2,addressCity,addressRegion,addressPostcode].filter(Boolean).join(';');
197    },
198
199    wlqasvalidateaddress: function(){
200        $('#wlAddressSubmit').on('click',function(){
201            var country = $('#country').val();
202            if($('.add_edit_delivery_address_id').val() != "" && $('.editAddress').val() == "false") {
203                $('#wishListProfileForm').submit();
204            } else {
205                if($('#wishListProfileForm').valid()) {
206                    var addressString = ACC.donationwishlistaddon.getAddressQasString();
207                    $.ajax({
208                        url: ACC.config.encodedContextPath + '/qas/verify?addressString='+addressString+'&country='+country,
209                        type: 'GET',
210                        success: function (response) {
211                            if(response === "") {
212                                $('.ajax-global-error-message').removeClass("hidden").show();
213                                $('.ajax-global-error-message').html('<div class="alert alert-danger alert-dismissable getAccAlert">'+messages.invalidManualAddress+'</div>');
214                            } else {
215                                $('.ajax-global-error-message').hide();
216                                var responseHtml = $(response);
217                                var skipConfirmationPrompt = responseHtml.find('#skipConfirmationPrompt').val()==='true';
218
219                                if(skipConfirmationPrompt){
220                                    var wlForm = $('#wishListProfileForm');
221                                    wlForm.find('#address\\.line1').val(responseHtml.find('#suggestedLine1').val());
222                                    wlForm.find('#address\\.line2').val(responseHtml.find('#suggestedLine2').val());
223                                    wlForm.find('#address\\.townCity').val(responseHtml.find('#suggestedCity').val());
224                                    wlForm.find('#address\\.regionIso').val('US-' + responseHtml.find('#suggestedBillState').val());
225                                    wlForm.find('#address\\.postcode').val(responseHtml.find('#suggestedZipCode').val());
226                                    wlForm.find('#deliveryPtCode').val(responseHtml.find('#deliveryPointBarcode').val());
227                                    wlForm.find('#chkDigit').val(responseHtml.find('#checkDigit').val());
228                                    wlForm.find('#correctedAddressUsed').val(true);
229                                    $('#wishListProfileForm').submit();
230                                } else {
231                                    ACC.colorbox.open("Address Verification",{
232                                        html:response,
233                                        maxWidth:"100%",
234                                        className:"suggested-address",
235                                        width:"700px",
236                                        height:"100%",
237                                        top:"10%",
238                                        onOpen: {},
239                                        onComplete: function() {
240                                            setTimeout(function() {
241                                                _autoload : [   ]
242                                            }, 800);
243                                            ACC.colorbox.resize();
244                                            ACC.donationwishlistaddon.bindSuggestedForms();
245                                            ACC.colorbox.resize();
246                                        }
247                                    });
248                                }
249                            }
250                        },
251                        error: function (jqXHR, textStatus, errorThrown) {
252                            // log the error to the console
253                            console.log("The following error occured: " + textStatus, errorThrown);
254                        }
255                    });
256                 }else {
257                    $('html, body').animate({
258                        scrollTop: $(".has-error .help-block").first().offset().top-200
259                    }, 2000);
260                }
261            }
262        });
263    },
264
265    initPageEvents: function () {
266        $(document).on("click", '.js-qty-selector-wishlist .js-qty-selector-minus', function () {
267            ACC.donationwishlistaddon.checkQtySelector(this, "minus");
268        })
269
270        $(document).on("click", '.js-qty-selector-wishlist .js-qty-selector-plus', function () {
271            ACC.donationwishlistaddon.checkQtySelector(this, "plus");
272        })
273
274        $(document).on("keydown", '.js-qty-selector-wishlist .js-qty-selector-input', function (e) {
275            if (($(this).val() != " " && ((e.which >= 48 && e.which <= 57 ) || (e.which >= 96 && e.which <= 105 ))  ) || e.which == 8 || e.which == 46 || e.which == 37 || e.
275which == 39 || e.which == 9) {
276            }
277            else if (e.which == 38) {
278                ACC.donationwishlistaddon.checkQtySelector(this, "plus");
279            }
280            else if (e.which == 40) {
281                ACC.donationwishlistaddon.checkQtySelector(this, "minus");
282            }
283            else {
284                e.preventDefault();
285            }
286        })
287
288        $(document).on("keyup", '.js-qty-selector-wishlist .js-qty-selector-input', function (e) {
289            ACC.donationwishlistaddon.checkQtySelector(this, "input");
290            ACC.donationwishlistaddon.updateQtyValue(this, $(this).val());
291
292        })
293
294        $(document).on("focusout", '.js-qty-selector-wishlist .js-qty-selector-input', function (e) {
295            ACC.donationwishlistaddon.checkQtySelector(this, "focusout");
296            ACC.donationwishlistaddon.updateQtyValue(this, $(this).val());
297        })
298    },
299    bindAddToCartFromWishlist: function(){
300        $(".add_to_cart_from_wishlist").submit(function(e){
301            $form = $(this);
302    		var count = 0;
303            $(".js-qty-selector-input").each(function(){
304            	var quantity = $(this).val();
305            	if(parseInt(quantity) > 0){
306            		$form.append('<input type="hidden" name="addToCartForms['+count+'].productCode" value="'+$(this).data('productcode')+'"/>');
307                    $form.append('<input type="hidden" name="addToCartForms['+count+'].qty" value="'+quantity+'"/>');
308                    addWishListDataToGTM($(this));
309                    count++;
310            	}
311            });
312            return count > 0;
313        });
314    },
315    showSaveButton: function(domSelector){
316        // check if teacher's flow
317        if(isTeacherFlow && domSelector.hasClass("display-none")){
318            domSelector.removeClass("display-none").addClass("flex");;
319        }
320    },
321    updateWishlist: function(input, isShare){
322        $.ajax({
323            url: '/wishlist/update-wishlist',
324            type: 'post',
325            dataType: 'json',
326            contentType: 'application/json',
327            success: function (data) {
328                if(isShare){
329                    if(data.key){
330                        window.location = "/wishlist/share-wishlist/" + data.key;
331                    }else{
332                        $('.custom-note').text('The customizing link is already used, please enter a new customizing link. Your custom link must contain at least 5 letters or numbers. Please do not use spaces or symbols.');
333                    }
334                }else{
335                	if(input.published == true || input.published == false) {
336                	}
337                	else {
338                   		window.location.reload();
339                   	}
340                }
341            },
342            data: JSON.stringify(input)
343        });
344    }
345};
346
347$(document).ready(function(){
348// override jquery validate plugin defaults
349$.validator.setDefaults({
350    highlight: function(element) {
351       $(element).closest('.form-inline').addClass('has-error');
352       $(element).closest('.form-group').addClass('has-error');
353    },
354    unhighlight: function(element) {
355     $(element).closest('.form-inline').removeClass('has-error');
356     $(element).closest('.form-group').removeClass('has-error');
357    },
358    errorElement: 'div',
359    errorClass: 'help-block',
360    errorPlacement: function(error, element) {
361        if(element.parent('.input-group').length) {
362            error.insertAfter(element.parent());
363        } else if (element.parent().hasClass('cuz-link-input')){
364            error.appendTo(".cuz-link-input");
365        }else if(!element.parent().hasClass('form-group')) {
366            error.insertAfter(element.parent());
367        }else if(element.parent().hasClass('form-inline')){
368            error.appendTo(element.next());
369        }else{
370            error.insertAfter(element);
371        }
372    }
373});
374
375$.validator.addMethod('filesize', function (value, element, param) {
376    return this.optional(element) || (element.files[0].size <= param * 1024 * 1024)
377}, 'File size must be less than {0} MB');
378
379$('.v1-form-layout select.v1-select').select2({}).on("change", function (e) {
380  $(this).valid();
381});
382
383$("#imageUpload, #imageUploadWishlist").change(function() {
384  $(this).valid();
385});
386
387const maximumLength = parseInt($("#maxLength").val(), 10);
388/** Validations */
389 $("#wishListProfileForm").validate({
390     ignore: [],
391     onchange: function(element) {
392        $(element).valid();
393     },
394     onkeyup: function(element) {
395        //To avoid ontyping validation
396         //$(element).valid();
397     },
398     messages: {
399         profilePic: {
400            required:"Please upload profile picture",
401         },
402         name: {
403            required:"Please enter your name",
404         },
405         role: {
406            required:"Please select your role",
407         },
408         nickName:{
409            required: "Please enter your nick name",
410         },
411         aboutMe: {
412            required: "Please enter about your self",
413         },
414         schoolName: {
415            required: "Please enter your school name",
416         },
417         "address.line1": {
418            required: "Please enter your address",
419            maxlength: "The address length should not exceed " + maximumLength +  " characters."
420         },
421         "address.line2": {
422            maxlength: "The address length should not exceed " + maximumLength +  " characters."
423         },
424         "address.townCity":{
425            required: "Please enter your city",
426         },
427         "address.regionIso": {
428            required: "Please select your region code",
429         },
430         "address.postcode": {
431            required: "Please enter your postal code",
432         },
433         "address.phone": {
434             required: "Please enter your phone",
435             minlength: "Please enter your 10 digits phone number",
436             digits:"Please enter digits only",
437              maxlength :"Please enter your 10 digits phone number"
438              }
439       },
440     rules: {
441         profilePic:{
442              required: true,
443              filesize: 5,
444         },
445         role:{
446             required: true
447         },
448         schoolType:{
449             required:true
450         },
451         nickName:{
452            required: true
453         },
454         aboutMe:{
455            required: true
456         },
457         schoolName:{
458            required: true
459         },
460         "address.line1": {
461            required: true,
462            maxlength:maximumLength
463         },
464         "address.line2": {
465            maxlength:maximumLength
466         },
467         "address.townCity":{
468            required: true
469         },
470         "address.regionIso": {
471            required: true
472         },
473         "address.postcode": {
474            required: true
475         },
476         "address.phone": {
477              required: true,
478              digits:true,
479             minlength: 10,
480             maxlength:10
481             }
482     },
483     submitHandler: function(form) {
484       form.submit();
485     }
486 });
487
488
489
490 $("#donationWishListForm").validate({
491     ignore: [],
492     onchange: function(element) {
493        $(element).valid();
494     },
495
496     messages: {
497         wishListPicture: {
498            required:"Please upload wishlist picture",
499         },
500         name: {
501            required:"Please enter your wishlist name",
502            maxlength:"Please enter no more than 500 characters"
503         },
504         aboutWishList: {
505            required: "Please enter about your wishlist",
506         },
507       },
508     rules: {
509         wishListPicture:{
510            required: true,
511            filesize: 5,
512         },
513         name: {
514             minlength: 5,
515             required: true,
516             maxlength:500
517         },
518         aboutWishList:{
519             required: true
520         },
521     },
522     submitHandler: function(form) {
523       form.submit();
524     }
525 });
526
527 $("#cuz-link").validate({
528     ignore: [],
529     onchange: function(element) {
530        $(element).valid();
531     },
532     onkeyup: function(element) {
533             $(element).valid();
534          },
535     messages: {
536         uid: {
537            required:"Please enter Customized Link",
538         }
539       },
540     rules: {
541         uid:{
542              required: true,
543              minlength: 5
544         },
545     },
546     submitHandler: function(form) {
547        var replace = "[^A-Za-z0-9]";
548        var re = new RegExp(replace,"g");
549        var newUid = $("#new-uid").val();
550        newUid= newUid.replace(re, "");
551        var dataUpdate = {
552            newkey: newUid,
553            name: $("#new-uid").data("name"),
554            key: $("#new-uid").data("key")
555           }
556        ACC.donationwishlistaddon.updateWishlist(dataUpdate, true);
557     }
558 });
559
560$("#edit_wishlistName").click(function(){
561    var val = $('#wishlistName').data("wishlist-name");
562    $("#wishlistName").html('<div class="form-group flex center-h my-40" style="float:none;width: 25%;"><input id="wishlist_Name" style="float:none;" name="wishlist_Name" class="form-control" type="text" maxlength="1000" spellcheck="false" value="'+val+'"/></div>');
563    $(".wishlistName").toggle();
564});
565
566 $("#wishlist-name-form").validate({
567     ignore: [],
568     onchange: function(element) {
569        $(element).valid();
570     },
571     onkeyup: function(element) {
572             $(element).valid();
573          },
574     messages: {
575         wishlist_Name: {
576            required:"Please enter wishlist name",
577         }
578       },
579     rules: {
580         wishlist_Name:{
581              required: true,
582              maxlength: 500
583         },
584     },
585     submitHandler: function(form) {
586       var dataUpdate = {
587		key: $("#wishlist-name-action").data("key"),
588		name: $("#wishlist_Name").val()
589       }
590       ACC.donationwishlistaddon.updateWishlist(dataUpdate);
591     }
592 });
593
594
595$("#edit_aboutWishList").click(function(){
596    var val = $('#about-wishlist').data("about-wishlist");
597    $("#about-wishlist").html('<div class="form-group" style="float:none;"><textarea id="aboutWishList" style="float:none;" name="aboutWishList" class="form-control" rows="4" maxlength="1000" spellcheck="false">'+val+'</textarea></div>');
598    $(".aboutWishList").toggle();
599});
600
601 $("#about-wishlist-form").validate({
602     ignore: [],
603     onchange: function(element) {
604        $(element).valid();
605     },
606     onkeyup: function(element) {
607             $(element).valid();
608          },
609     messages: {
610         aboutWishList: {
611            required:"Please enter about wishlist",
612         }
613       },
614     rules: {
615         aboutWishList:{
616              required: true,
617         },
618     },
619     submitHandler: function(form) {
620       var dataUpdate = {
621		key: $("#about-wishlist-action").data("key"),
622		aboutWishList: $("#aboutWishList").val()
623       }
624       ACC.donationwishlistaddon.updateWishlist(dataUpdate);
625     }
626 });
627
628 $("#edit_aboutProfileWishList").click(function(){
629     	var val = $('#about-profile-wishlist').data("about-profile-wishlist");
630        	$("#about-profile-wishlist").html('<div class="form-group" style="float:none;"><textarea id="aboutProfileWishList" style="float:none;"  name="aboutProfileWishList" class="form-control" rows="4"  maxlength="1000" spellcheck="false">'+val+'</textarea></div>');
631    		$(".aboutProfileWishList").toggle();
632     });
633
634
635
636  $("#about-profile-wishlist-form").validate({
637      ignore: [],
638      onchange: function(element) {
639         $(element).valid();
640      },
641      onkeyup: function(element) {
642              $(element).valid();
643           },
644      messages: {
645          aboutProfileWishList: {
646             required:"Please enter about wishlist profile",
647          }
648        },
649      rules: {
650          aboutProfileWishList:{
651               required: true,
652          },
653      },
654      submitHandler: function(form) {
655       var dataUpdate = {
656			aboutMe: $("#aboutProfileWishList").val()
657       }
658       $.ajax({
659	        url: '/wishlist/update-profile',
660	        type: 'post',
661	        dataType: 'json',
662	        contentType: 'application/json',
663	        success: function (data) {
664	            console.log(data);
665	            window.location.reload();
666	        },
667	        data: JSON.stringify(dataUpdate)
668	    });
669      }
670  });
671
672var locationObjects = []
673$("#donor-search,#donor-search-mobile").click(function(){
674	var refinements ='';
675	var pricerange ='';
676	var location = '';
677	var search = '';
678	var near ='';
679	var locations = [];
680	var zoom = 3;
681    var localStorageObj= {};
682	var lat = $("#lat").val();
683	var lng = $("#lng").val();
684
685	var isModal = $(this).data('is-modal');
686
687	if(isModal) {
688		location = $("#donor-city-mobile").val();
689		search = $("#donor-teacher-mobile").val();
690		if(!location){
691			lat = '';
692			lng = '';
693		}
694	}
695	else {
696		location = $("#donor-city").val();
697		search = $("#donor-teacher").val();
698		if(!location){
699			lat = '';
700			lng = '';
701		}
702	}
703
704	if(typeof search === 'undefined'){
705	   search = '';
706	}
707	if(typeof lat != 'undefined' && lat) {
708		near = lat+'%7C'+lng+'%7C100';
709		zoom = 8;
710	}
711	localStorageObj["isModal"] = isModal;
712    localStorageObj["search"] = search
713    localStorageObj["lat"] = lat;
714    localStorageObj["lng"] = lng;
715    localStorageObj["location"] = location;
716	var length = $('input[name="subject"]:checked').length;
717	localStorageObj["subjectarea"] = [];
718	$('input[name="subjectarea"]:checked').each(function(index,element) {
719	     localStorageObj.subjectarea.push(element.id);
720		if (index === (length - 1)) {
721			refinements += this.value;
722		}else {
723			refinements += this.value+'%7C';
724		}
725	});
726    localStorageObj.age = [];
727	var agelength = $('input[name="agegroup"]:checked').length;
728	$('input[name="agegrade"]:checked').each(function(index,element) {
729	   localStorageObj.age.push(element.id);
730		if (index === (agelength - 1)) {
731		  if(refinements) {
732				refinements += '%7C'+this.value;
733		  }
734		  else {
735		  	 refinements+= this.value;
736		  }
737		}else {
738			refinements += this.value+'%7C';
739		}
740	});
741	localStorageObj.school = [];
742	var schoolength = $('input[name="schooltype"]:checked').length;
743	$('input[name="schooltype"]:checked').each(function(index,element) {
744	   localStorageObj.school.push(element.id);
745		if (index === (schoolength - 1)) {
746		  if(refinements) {
747				refinements += '%7C'+this.value;
748		  }
749		  else {
750		  	 refinements+= this.value;
751		  }
752		}else {
753			refinements += this.value+'%7C';
754		}
755	});
756	localStorageObj.price = [];
757	var pricelength = $('input[name="pricerange"]:checked').length;
758	$('input[name="pricerange"]:checked').each(function(index,element) {
759	   localStorageObj.price.push(element.id);
760		if (index === (pricelength - 1)) {
761			pricerange += this.value;
762		}else {
763			pricerange += this.value+'%7C';
764		}
765	});
766	$("#location").replaceWith('<span id="location">'+location+'</span>');
767	$(".wishlist-sub-title").show();
768	localStorageObj["near"]=near;
769	var pageNum = $("#pageNumberHidden").val();
770	$.ajax({
771		url: '/donor/search/?term='+search+'&refinements='+refinements+'&near='+near+'&pricerange='+pricerange+'&page='+pageNum,
772		type: 'get',
773		dataType: 'json',
774		contentType: 'application/json',
775		success: function (data) {
776		var paginationObj = data.pagination;
777        var data = data.results;
778		console.log(data);
779			//if(isModal) {
780			//	$("#wishlist-count-mobile").html(data.length);
781			//	$("#wishlist-count-mobile").parent().show();
782			//}
783
784			if(data.length == 0 && pageNum ==1){
785               titleText = "No Search Results Found"
786            }
787
788			if(data.length > 0){
789                titleText=paginationObj.totalNumberOfResults + ' Wish Lists Near You!'
790			}
791			var updateCount = '<h1 class="wishlist-title" id="updateWishlistCount">'+titleText+'</h1>';
792            $("#updateWishlistCount").replaceWith(updateCount);
793
794			var list=''
795			if(data.length > 0 && pageNum == 1){
796			 $("#donorlanding").css("display","none");
797            list = '<div class="review-banner top-curve" id="wishlist">'+
798                  '<div class="content">';
799			} else if(data.length == 0 && pageNum == 1)  {
800			   $("#donorlanding").css('display',"block");
801                $("#wishlist").css("display","none");
802			}
803
804            var nextPageNum = parseInt(pageNum)+1;
805			$("#pageNumberHidden").val(nextPageNum);
806			if(data.length == 0 && pageNum > 1){
807                $("#pageNumberHidden").val(1);
808                locationObjects = [];
809			}
810
811           localStorage.removeItem("donorfilter");
812            $(window).data('ajaxready', true);
813            var vl = JSON.stringify(localStorageObj)
814            for(var i=0;i<data.length;i++){
815            	percentage = Math.round(((data[i].requested-data[i].remaining)/data[i].requested)*100);
816				list += '<div class="review-curved-section-content flex center-v" id='+data[i].key+'>'+
817							'<div class="donar-profile">'+
818								'<img src="'+data[i].image.url+'">'+
819							'</div>'+
820							'<div class="donar-info">'+
821								'<a href="/wishlist/'+ ACC.sanitizer.sanitize( data[i].key ) +'" class="donar-title-new underline-none" data-obj='+vl+'><h1 class="wishlist-title dss-product-color" title='+ACC.sanitizer.sanitize( data[i].name )+'>'+ ACC.sanitizer.sanitize( data[i].name ) +'</h1></a>'+
822
823								'<div class="range-slider pos-rel">'+
824									'<div id="range" class="per-range cntr"  data-review-key="'+data[i].key+'" data-days-left="'+data[i].daysLeft+'" data-expiry-date="'+data[i].expiryDate+'" data-duration="'+data[i].wishListDuration+'"></div>'+
825								'</div>'+
826								'<div class="review-content-info">'+
827									'<h4 class="content-typo">A wish list for <span class="light">' + ACC.sanitizer.sanitize( data[i].profile.name ) +'\'s</span>'+
828									'</h4>'+
829									'<h4 class="content-typo" title="'+ACC.sanitizer.sanitize(data[i].profile.role)+' at '+ACC.sanitizer.sanitize(data[i].profile.schoolName ) +'-'+ACC.sanitizer.sanitize( data[i].profile.address.town )+','+ACC.sanitizer.sanitize(data[i].profile.address.region.isocodeShort)+'">
829' + ACC.sanitizer.sanitize(data[i].profile.role) +' at <span class="light">' + ACC.sanitizer.sanitize(data[i].profile.schoolName ) +'</span>- ' + ACC.sanitizer.sanitize( data[i].profile.address.town )+','+ ACC.sanitizer.sanitize(data[i].profile.address.region.isocodeShort) +'  </h4>'+
830								'</div>'+
831							'</div>'+
832							'<div class="content-typo donar-stats">'+
833							   '<div>'+
834									'<div class="light">$'+new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(Math.round(data[i].remaining))+'</div>'+
835									' <div>Remaining</div>'+
836							   '</div>'+
837							   '<div class="inner-circle-radius pos-rel">                              <div id="custom" data-text="'+percentage+'%" data-percent="'+percentage+'"></div>                           </div>'+
838							'<div>'+
839							'<div class="light">'+data[i].donors+'</div>'+
840								'<div>Donors</div>'+
841							'</div>'+
842						'</div>'+
843					'</div>';
844				var temp = [data[i].name,data[i].latitude,data[i].longitude,i,data[i].profile.schoolName,data[i].profile.address.formattedAddress,data[i].key];
845				locations.push(temp);
846			}
847			if (data.length > 0 && pageNum == 1){
848			    list += '</div>';
849			    list += '</div>';
850			    $("#wishlist").replaceWith(list);
851			}else if (pageNum > 1){
852                $('#wishlist .content').append(list);
853            }
854
855            $('#custom,.inner-circle-radius > .percircle-view').percircle({
856            	percent: 75,
857            	text: "75%",
858            	progressBarColor: "#2C91B3"
859        	});
860
861             $(".donar-title-new").click(function(){
862                  var ls = $(this).data("obj");
863                  localStorage.setItem("donorfilter",  JSON.stringify(ls));
864             });
865
866
867            $(".per-range,.range-slider-bar").slider({
868	            range: "min",
869	            min: 0,
870	            create: function( event, ui ) {
871	               	var exp = getDiff(event.target);
872	                var duration = $(event.target).data("duration");
873	        		var percentage = (exp/duration)*100;
874	        		if(!duration){
875		            	duration = 100;
876		            }
877	        		if(!percentage){
878		            	percentage = 75;
879		            }
880	                $(event.target).slider("option","value",percentage);
881	                //$(event.target).slider("option","max",duration);
882	                if(exp < 14){
883                        $(event.target).children(".ui-slider-handle").addClass("adjust-left-14")
884                    }
885	                return $(event.target).children(".ui-slider-handle").html(exp + " Days Left!");
886	            },
887	            slide: function(e, ui) {
888	                return false;
889	            }
890			});
891
892
893            $(".ui-slider-handle").click(function(){
894             var key = $(this).parent().data("review-key");
895             if(key){
896                window.location = "/wishlist/" + key;
897             }
898            });
899
900			function getDiff(input){
901	            return  $(input).data("days-left");
902			}
903	        var infowindow = new google.maps.InfoWindow();
904
905            if(locations.length > 0){
906            locationObjects.push(...locations);
907            locations = locationObjects;
908			$(".js-donorsearch-map").attr("id","donor-search-map")
909			var mapOptions = {
910				zoom: zoom,
911				zoomControl: true,
912				panControl: true,
913				streetViewControl: false,
914				mapTypeId: google.maps.MapTypeId.ROADMAP,
915                mapId: "DEMO_MAP_ID"
916			}
917			var image = 'http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png';
918			var map = new google.maps.Map(document.getElementById("donor-search-map"), mapOptions);
919
920
921            	setMarkers(map,locations)
922            }
923			function setMarkers(map,locations){
924				var marker, i;
925		  		for (i = 0; i < locations.length; i++)
926 				{
927					var name = locations[i][0]
928					var lat = locations[i][1]
929					var long = locations[i][2]
930					var add =  locations[i][3]
931					var school =  locations[i][4]
932					var schoolAddress =  locations[i][5]
933					var key =  locations[i][6]
934
935					latlngset = new google.maps.LatLng(lat, long);
936
937					var marker = new google.maps.marker.AdvancedMarkerElement({
938			          map: map, title: name , position: latlngset
939			        });
940			        map.setCenter(marker.getPosition())
941
942			        var content = `<b><a href="javascript:void(0)" class="scroll-wishlist" data-key="${key}">${name}</a></b><br>${school}<br>${schoolAddress}`;
943
944					var infowindow = new google.maps.InfoWindow()
945
946					google.maps.event.addListener(marker,'click', (function(marker,content,infowindow){
947						return function() {
948						   infowindow.setContent(content);
949						   infowindow.open(map,marker);
950						};
951					})(marker,content,infowindow));
952
953					google.maps.event.addDomListener(infowindow, 'domready', function() {
954                        $('.scroll-wishlist').click(function() {
955                            var key=$(this).data("key");
956                            if(key){
957                                 $('html,body').animate({
958                                      scrollTop: $('#'+key).offset().top - 115
959                                  }, 0);
960                            }
961                        });
962                    });
963
964				}
965		    }
966		    if(data.length == 0  && pageNum == 1) {
967 				 $(".js-donorsearch-map").attr("id","donor-search-map")
968		         var centerPoint = new google.maps.LatLng(storeInformation["latitude"], storeInformation["longitude"]);
969		         var mapOptions = {
970		            zoom: 11,
971		            zoomControl: true,
972		            panControl: true,
973		            streetViewControl: false,
974		            mapTypeId: google.maps.MapTypeId.ROADMAP,
975		            center: centerPoint,
976                     mapId: "DEMO_MAP_ID"
977		         }
978		         if(storeInformation["nomarker"]){
979                      mapOptions["zoom"]=4
980                  }
981		         var image = 'http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png';
982		         var map = new google.maps.Map(document.getElementById("donor-search-map"), mapOptions);
983                 const img = document.createElement("img");
984                 img.src = "https://maps.google.com/mapfiles/markerA.png";
985		         var marker = new google.maps.marker.AdvancedMarkerElement({
986		            map: map,
987		            content:img
988		         });
989		         google.maps.event.addListener(marker, 'click', function (){
990		            //Later use
991		         });
992            }
993        },
994	});
995	if(isModal) {
996	 	$("#donor-search-filter").modal('hide');
997	}
998});
999
1000$(".social-media-link").click(function(){
1001	var uid = $(".social-media-link").data("uid");
1002	var dataUpdate = {
1003		category: 'SHARE',
1004    }
1005	$.ajax({
1006	        url: '/wishlist/'+uid+'/activity',
1007	        type: 'post',
1008	        dataType: 'json',
1009	        contentType: 'application/json',
1010	        success: function (data) {
1011	            console.log(data);
1012	        },
1013	        data: JSON.stringify(dataUpdate)
1014    });
1015});
1016$(".send-replay-button").click(function(){
1017	var uid = $(this).data("uid");
1018	var key = $(this).data("key");
1019	var msg = $("#reply-"+key).val();
1020	var dataUpdate = {
1021		key : key,
1022		message : msg
1023    }
1024	$.ajax({
1025        url: '/wishlist/'+uid+'/activity',
1026        type: 'post',
1027        dataType: 'json',
1028        contentType: 'application/json',
1029        success: function (data) {
1030            $("#activity-"+key).hide();
1031       	 	$('#'+key).css('display', 'none');
1032       	 	console.log(data);
1033        },
1034        data: JSON.stringify(dataUpdate)
1035    });
1036});
1037$('input[name="pricerange"]').change(function() {
1038	if ($("input[name='pricerange']:checked").length == 0) {
1039		$('input[name="pricerange"]').prop('disabled', false);
1040	} else {
1041		$('input[name="pricerange"]').prop('disabled', true);
1042		$('input[name="pricerange"]:checked').prop('disabled', false);
1043	}
1044});
1045
1046$(document).ready(function(){
1047    var locObj = localStorage.getItem('donorfilter');
1048    var url = window.location.href
1049    if(locObj && url.indexOf('/donor/search') > 0){
1050        locObj = JSON.parse(locObj);
1051        console.log("came inside lets dig it");
1052          $("#lat").val(locObj.lat);
1053          $("#lng").val(locObj.lng);
1054        if(locObj.isModal) {
1055            $("#donor-city-mobile").val(locObj.location);
1056            $("#donor-teacher-mobile").val(locObj.search);
1057        } else {
1058            $("#donor-city").val(locObj.location);
1059            $("#donor-teacher").val(locObj.search);
1060        }
1061
1062        $.each(locObj.subjectarea, function( index, value ) {
1063          $(value).prop('checked', true);
1064        });
1065
1066        $.each(locObj.age, function( index, value ) {
1067          $(value).prop('checked', true);
1068        });
1069
1070        $.each(locObj.school, function( index, value ) {
1071            $(value).prop('checked', true);
1072        });
1073
1074        $.each(locObj.price, function( index, value ) {
1075            $(value).prop('checked', true);
1076        });
1077
1078        $("#donor-search").click();
1079    }
1080});
1081});
1082
1083$(document).ready(function () {
1084    if($("body").hasClass("page-wishListReviewPage")){
1085        console.log("match-height")
1086        $(".js-wishlist-entry").matchHeight();
1087    }
1088    if ($("body").hasClass("page-donorSearchPage")) {
1089        console.log("load-scroll")
1090         $(window).on('scroll', function() {
1091        if ($(window).scrollTop() >= $(
1092            '#wishlist').offset().top + $('#wishlist').
1093            outerHeight() - window.innerHeight) {
1094             if ($(window).data('ajaxready') === false)
1095                    return;
1096                var pagNum = $('#pageNumberHidden').val()
1097                if (pagNum > 1){
1098                     $(window).data('ajaxready', false);
1099                     setTimeout(function(){
1100                     $("#donor-search").click();
1101                     }, 1500);
1102                }
1103            }
1104         });
1105    }
1106});
1107
1108
1109

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.