PageSourceSearch

https://www.oaklandparkonline.us/Scripts/credits/CommonCart.js

js oaklandparkonline.us collected 2026-10-04 21:21:38 UTC 12,347 bytes, 335 lines download raw bytes

1//var protocol ="https://"  ;
2var buycrediturl = document.location.protocol + '//' + document.domain + '/buy-credits/';
3
4function AddtoCart(Packageid, credits, obj, clientid, listingid, service, callback,amount,isfromcart) {
5    listingid = listingid ? listingid : 0;
6    var d = getCookieCredit('user_id');
7    if (d == '' && (clientid == '' || clientid == undefined)) {
8        CheckUSALogin(buycrediturl + "AddtoCart" + ":$:" + Packageid + ":$:" + credits + ":$:" + clientid + ":$:" + listingid + ":$:" + service);
9        return;
10    }
11    if (service == "T" || service == "O") {
12        TributePackageAvailable(d, service); //To check if tribute/obituary paid package is available//
13        if (PackageAvailable == 'Y') {
14            return;
15        }
16    }
17    if (obj != '') {
18        SetPosition($(obj), '#dwnarrow');
19        SetFinalPosition('#jq_mycart', '#dwnarrow');
20    }
21    $.ajax({
22        cache: false,
23        async: false,
24        url: buycrediturl + 'AdToCart',
25        data: { Packageid: Packageid, quantity: 1, credits: credits, clientid: clientid, listingid: listingid, amount: amount, isfromcart: isfromcart },
26        dataType: "html",
27        beforeSend: function () {
28            $("#leadbackloading").show();
29            $("#backgroundleadbackloading").show();
30        },
31        success: function (data) {
32            $("#leadbackloading").hide();
33            $("#backgroundleadbackloading").hide();
34            if (isfromcart) {
35                $("#cartPart").html(data);
36                $("#txt_creditinput").val('');
37                $("#calculatediv").hide();
38                $("#co_maindiv").show();
39                $("#totalwallet").text($("#WalletAmount").val());
40                $('[data-attr="reqcredit"]').text($("#PayableAmount").val())
41                $("#walletpay").html('Your cart contains credit package. You can not purchase credit package by using UsaOnline Wallet Credit System');
42            }
43            else if (window.location.href.includes('buy-credits'))
44            {
45                $('#jq_mycart').html('');
46            }
47            else {
48                $('#jq_mycart').html(data);
49            }
50            if (callback) {
51                try {
52                    callback();
53                }
54                catch (ex) {
55                    console.info('add to cart callback ex ' + ex);
56                }
57            }
58        },
59        error: function () {
60            $('#leadbackloading').hide();
61            $('#div_getcreditfilterplan').append('Some error occoured please try again.');
62        }
63    });
64}
65
66function BuyNow(Packageid, credits, userid, stateid, cityid, Externalpkgid, service) {
67    //alert('Externalpkgid 222 :' + Externalpkgid);
68    var d = getCookieCredit('user_id');
69    if (d == '' && (userid == '' || userid == undefined)) {
70        CheckUSALogin(buycrediturl + "BuyNow" + ":$:" + Packageid + ":$:" + credits, stateid, cityid);
71        return;
72    }
73    if (service == "T" || service == "O") {
74        TributePackageAvailable(d, service); //To check if tribute/obituary paid package is available//
75        if (PackageAvailable == 'Y') {
76            return;
77        }
78    }
79
80    //deepak singh
81    var hf_stateid = "0";
82    var hf_cityid = "0";
83    if (document.location.href.indexOf('local.usaonline.us/getonline') > -1) {
84        hf_stateid = $('#ns_id').val();
85        hf_cityid = $('#nc_id').val();
86    }
87    //
88    //alert(buycrediturl + 'AdToCart');
89    //return false;
90    $.ajax({
91        cache: false,
92        url: buycrediturl + 'AdToCart',
93        data: { Packageid: Packageid, quantity: 1, credits: credits, clientid: userid, 'stateid': hf_stateid, 'cityid': hf_cityid, 'ExternalPackageID': Externalpkgid, 'source': 'us' },
94        dataType: "html",
95        beforeSend: function () {
96            $("#leadbackloading").show();
97            $("#backgroundleadbackloading").show();
98        },
99        success: function (data) {
100            $("#leadbackloading").hide();
101            $("#backgroundleadbackloading").hide();
102
103            //deepak singh //02 mar 2016
104            // send data [redirectLocationOverride;<locationToRedirect>] from server if move to diffrent location
105            if (data.indexOf('redirectLocationOverride;') > -1) {
106                $('#divLoading').hide();
107                $('#Logindialog').modal('hide');
108                $("#CustomConfirmModal").attr("data-keyboard", "false");
109                $("#CustomConfirmModal").attr("data-backdrop", "static");
110                CustomConfirmModal('Confirm', 'info', 'You can not change your plan from here. You may upgrade your plan from dashboard.\n Are you sure you want to go to dashboard?', function () { window.location.href = 'https://local.usaonline.us/myadmin?msg=1'; }, function () { window.location.href = window.location.href; });
111
112            }
113            else {
114                window.location = 'https://www.usaonline.us/my-cart';
115            }
116
117            // window.location = '/my-cart';
118        },
119        error: function () {
120            $('#leadbackloading').hide();
121            $('#div_getcreditfilterplan').append('Some error occoured please try again.');
122        }
123    });
124}
125
126function AddtoCart_BuyCredits(Packageid, credits, obj, clientid, ListingID, token) {
127    //alert(buycrediturl);
128    var d = getCookieCredit('user_id');
129    //alert('d : ' + d);
130    if (token || (d && d != '' && d != '0' && d != ' ')) {
131        if (!token)
132            token = '';
133        if (!ListingID)
134            ListingID = 0;
135
136        SetPosition($(obj), '#dwnarrow');
137        SetFinalPosition('#jq_mycart', '#dwnarrow');
138        $.ajax({
139            cache: false,
140            async: false,
141            url: buycrediturl + 'AdToCart',
142            data: { Packageid: Packageid, quantity: 1, credits: credits, clientid: clientid, ListingID: ListingID, token: token },
143            dataType: "html",
144            beforeSend: function () {
145                $("#leadbackloading").show();
146                $("#backgroundleadbackloading").show();
147            },
148            success: function (data) {
149
150                $("#leadbackloading").hide();
151                $("#backgroundleadbackloading").hide();
152                $('#jq_mycart').html(data);
153            },
154            error: function () {
155
156                $('#leadbackloading').hide();
157                $('#div_getcreditfilterplan').append('Some error occoured please try again.');
158            }
159        });
160    }
161    else {
162        var callbackDataAfterLogin =
163        {
164            "Action": "addtocartCommonCart",
165            "Packageid": Packageid,
166            "clientid": clientid,
167            "credits": credits,
168            "obj": obj,
169            "ListingID": ListingID
170        };
171        CheckUSALogin('', 0, 0, callbackDataAfterLogin);
172    }
173}
174
175function BuyNow_BuyCredits(Packageid, credits, obj, token) {
176    var d = getCookieCredit('user_id');
177
178    if (token || (d && d != '' && d != '0' && d != ' ')) {
179
180        if (!token)
181            token = '';
182        $.ajax({
183            cache: false,
184            url: buycrediturl + 'AdToCart',
185            data: { Packageid: Packageid, quantity: 1, credits: credits, token: token },
186            dataType: "html",
187            beforeSend: function () {
188                $("#leadbackloading").show();
189                $("#backgroundleadbackloading").show();
190            },
191            success: function () {
192                $("#leadbackloading").hide();
193                $("#backgroundleadbackloading").hide();
194                window.location = 'https://www.usaonline.us/my-cart';
195            },
196            error: function () {
197                $('#leadbackloading').hide();
198                $('#div_getcreditfilterplan').append('Some error occoured please try again.');
199            }
200        });
201    }
202    else {
203
204        var callbackDataAfterLogin =
205        {
206            "Action": "buynowCommonCart",
207            "Packageid": Packageid,
208            "credits": credits
209        };
210
211        CheckUSALogin('', 0, 0, callbackDataAfterLogin);
212    }
213}
214//// get position of an element
215
216function getElementTopPosition(obj) {
217    var pos = $(obj).offset();
218    return pos ? pos.top : 0;
219}
220function getElementLeftPosition(obj) {
221    var pos = $(obj).offset();
222    return pos ? pos.left : 0;
223}
224
225function SetPosition(obj, imgid) {
226    var toptpos = getElementTopPosition(obj);
227    var leftpos = getElementLeftPosition(obj);
228    //alert(leftpos + ', ' + toptpos);
229    $(imgid).css({ 'left': leftpos, 'top': toptpos });
230    $(imgid).css({ 'width': 30, 'height': 30, 'display': 'none' });
231}
232var t;
233function SetFinalPosition(cartid, imgid) {
234    $(imgid).css({ 'width': 30, 'height': 30, 'display': 'block' });
235    var toptpos = getElementTopPosition(cartid);
236    var leftpos = getElementLeftPosition(cartid);
237    $(imgid).css({ 'left': leftpos, 'top': toptpos });
238    t = setTimeout(function () { setWidth(toptpos, imgid); }, 10);
239}
240
241function setWidth(finalpos, imgid) {
242    var currentpos = getElementTopPosition(imgid);
243    if (currentpos == finalpos) {
244        $(imgid).css({ 'display': 'none' });
245        clearInterval(t);
246    }
247    else
248        t = setTimeout(function () { setWidth(finalpos, imgid); }, 10);
249}
250
251
252/// get cookie
253
254//function getCookieCredit(cname) {
255//    var name = cname + "=";
256//    var ca = document.cookie.split(';');
257//    for (var i = 0; i < ca.length; i++) {
258//        var c = $.trim(ca[i]);
259//        if (c.indexOf(name) == 0) return c.substring(name.length, c.length);
260//    }
261//    return "";
262//};
263
264function getCookieCredit(name) {
265    //  debugger
266    var nameEQ = name + "=";
267    var ca = document.cookie.split(';');
268    for (var i = 0; i < ca.length; i++) {
269        var c = ca[i];
270        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
271        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
272    }
273    return "";
274}
275////////////// remove from cart
276function IsSafari() {
277    var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); ///Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);///^((?!chrome|android).)*safari/i.test(navigator.userAgent);
278    return is_safari;
279
280}
281//$('[data-id="removecart"]').on(touchEvent, RemoveCartItem($(e.target).attr('data-cartid')));
282//$('body').on('click touchstart', '[data-id="removecart"]', function (e) {
283//    RemoveCartItem($(e.target).attr('data-cartid'))
284//});
285
286
287$(document).on("click", "[data-attr='removecart']",function (e) {
288
289    RemoveCartItem($(e.target).attr('data-cartid'))
290});
291function RemoveCartItem(shoppingcart) {
292    if (IsSafari()) {
293        alert("in safari");
294    }
295    var c = confirm('Are you sure you want to remove this item?');
296    if (c) {
297        $("#leadbackloading").show();
298        $("#backgroundleadbackloading").show();
299        $.ajax({
300            url: buycrediturl + 'RemoveCartItemFromViewCart',
301            type: 'Get',
302            dataType: "json",
303            data: { shoppingcart: shoppingcart },
304            beforeSend: function () {
305                $("#leadbackloading").show();
306            },
307            success: function (data) {
308                //$('#leadbackloading').hide();
309                if (data.Data == 1) {
310                    location.reload();
311                    //ShowAlert('Success', '', 'Changes are successfully updated.'); location.reload();
312                } else {
313                    alert('Error', '', 'Some error occoured please try again.');
314                    $("#leadbackloading").hide();
315                    $("#backgroundleadbackloading").hide();
316                }
317
318            },
319            error: function () {
320                $('#leadbackloading').hide();
321                alert('Error', '', 'Some error occoured please try again.');
322                //  $('.overlay').hide();
323
324            }
325        });
326    }
327    else { return; }
328}
329
330function deepaksinghfunction() {
331    var hf_stateid = $('#hf_stateid_for_commonlogin').val();
332    var hf_cityid = $('#hf_cityid_for_commonlogin').val();
333    alert(hf_stateid);
334    alert(hf_cityid);
335}

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.