Ad Block Plus Blocking jQuery Script?

Everything about using Adblock Plus on Mozilla Firefox, Thunderbird and SeaMonkey
Post Reply
Ernie358
Posts: 1
Joined: Wed Jan 09, 2019 12:14 pm

Ad Block Plus Blocking jQuery Script?

Post by Ernie358 »

I have a script that pulls data from my CMS and then allows a person to vote on a poll. The script works fine. However, I have Ad Block Plus Plugin installed in Firefox. When that is enabled to blocks the script from submitting the form correctly. It appears to submit correctly in the front end but is never registered in the back end.

Why does Ad Block Plus block my script that has nothing to do with ads?

The script is below:

Code: Select all

$(document).ready(function () {

    var Engine = {
        ui: {
            buildChart: function() {

                if ($("#pieChart").size() === 0) {
                    return;
                }

                var pieChartData = [],
                    totalVotes = 0,
                    $dataItems = $("ul.key li");

                // grab total votes
                $dataItems.each(function (index, item) {
                    totalVotes += parseInt($(item).data('votes'));
                });

                // iterate through items to draw pie chart
                // and populate % in dom
                $dataItems.each(function (index, item) {
                    var votes = parseInt($(item).data('votes')),
                        votePercentage = votes / totalVotes * 100,
                        roundedPrecentage = Math.round(votePercentage * 10) / 10;

                    $(this).find(".vote-percentage").text(roundedPrecentage);

                    pieChartData.push({
                        value: roundedPrecentage,
                        color: $(item).data('color')
                    });
                });

                var ctx = $("#pieChart").get(0).getContext("2d");
                var myNewChart = new Chart(ctx).Pie(pieChartData, {});

            }, // buildChart

            pollSubmit: function() {

                if ($("#pollAnswers").size() === 0) {
                    return;
                }

                var $form = $("#pollAnswers"),
                    $radioOptions = $form.find("input[type='radio']"),
                    $existingDataWrapper = $(".web-app-item-data"),
                    $webAppItemName = $existingDataWrapper.data("item-name"),
                    $formButton = $form.find("button"),
                    bcField_1 = "CAT_Custom_1",
                    bcField_2 = "CAT_Custom_2",
                    bcField_3 = "CAT_Custom_3",
                    $formSubmitData = "";

                $radioOptions.on("change", function() {

                    $formButton.removeAttr("disabled"); // enable button

                    var chosenField = $(this).data("field"), // gather value
                        answer_1 = parseInt($existingDataWrapper.data("answer-1")),
                        answer_2 = parseInt($existingDataWrapper.data("answer-2")),
                        answer_3 = parseInt($existingDataWrapper.data("answer-3"));

                    if (chosenField == bcField_1) {
                        answer_1 = answer_1 + 1;
                        $formSubmitData = {
                            ItemName: $webAppItemName,
                            CAT_Custom_1: answer_1,
                            CAT_Custom_2: answer_2,
                            CAT_Custom_3: answer_3
                        };
                    }

                    if (chosenField == bcField_2) {
                        answer_2 = answer_2 + 1;
                        $formSubmitData = {
                            ItemName: $webAppItemName,
                            CAT_Custom_1: answer_1,
                            CAT_Custom_2: answer_2,
                            CAT_Custom_3: answer_3
                        };
                    }

                    if (chosenField == bcField_3) {
                        answer_3 = answer_3 + 1;
                        $formSubmitData = {
                            ItemName: $webAppItemName,
                            CAT_Custom_1: answer_1,
                            CAT_Custom_2: answer_2,
                            CAT_Custom_3: answer_3
                        };
                    }

                    prepForm($formSubmitData);

                });


                function prepForm(formSubmitData) {

                    $formButton.click(function(e) {
                        e.preventDefault();
                        logAnonUserIn("anon", "anon", formSubmitData); // log user in

                    }); // submit

                } // prepForm

                function logAnonUserIn(username, password, formSubmitData) {
                    $.ajax({
                        type: 'POST',
                        url: '/ZoneProcess.aspx?ZoneID=-1&Username=' + username + '&Password=' + password,
                        async: true,
                        beforeSend: function () {},
                        success: function () {},
                        complete: function () {
                            fireForm(formSubmitData);
                        }
                    });
                } // logAnonUserIn

                function fireForm(formSubmitData) {
                    // submit the form

                    var url = "/CustomContentProcess.aspx?A=EditSave&CCID=13998&OID=3931634&OTYPE=35";

                    $.ajax({
                        type: 'POST',
                        url: url,
                        data: formSubmitData,
                        async: true,
                        success: function () {},
                        error: function () {},
                        complete: function () {
                            window.location = "/";
                        }
                    });
                }

            } // pollSubmit

        } // end ui

    };

    Engine.ui.buildChart();
    Engine.ui.pollSubmit();

});
Last edited by Ernie358 on Thu Feb 21, 2019 11:30 am, edited 1 time in total.
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Ad Block Plus Blocking jQuery Script?

Post by mapx »

Where - which page - does happen ?
sbell
ABP Technical Support Specialist
Posts: 522
Joined: Wed Jul 05, 2017 8:08 pm

Re: Ad Block Plus Blocking jQuery Script?

Post by sbell »

@all on which page does the issue occur?

Thanks
Shannon
ABP Support Team
Post Reply