Giter Site home page Giter Site logo

projectajax's Introduction

projectAjax

ajax jquery wrapper

$(document).on('click', 'a.no-ajax', function (e) {
            e.preventDefault();
});
excludePjaxArrayElem = ['class1','class2','class3'];
$(document).off('click', 'a:not(.no-ajax)');
$(document).on('click', 'a:not(.no-ajax)', function (e) {
            if (e.isDefaultPrevented()) {
                console.log('Событие уже обрабатывается другим обработчиком');
                return;
            }
            if (self.hasClassPrevented(e.currentTarget)) {
                console.log('Совпадение по названию класса');
                return;
            }
            e.preventDefault();
            e.stopPropagation();

            console.log(e.currentTarget, 'e.currentTarget Ajax query handler starts');

            if ($(e.currentTarget).attr('type') == 'button') {
                return;
            }
            if ($(e.currentTarget).attr('href') === undefined) {
                return;
            }
            if (self.helper.stripos($(e.currentTarget).attr('href'), '/rights') !== false) {
                self.ajax.forceRefresh($(e.currentTarget).attr('href'));
                return;
            }
            var i = 0,
                j = 0,
                flagNoQuery = false,
                strClass;

            if (strClass = $(this).attr('class')) {
                var arrClass = strClass.split(' ');
                for (j; j <= arrClass.length; j++) {
                    if (self.helper.in_array(arrClass[i], self.excludePjaxArrayElem) !== false) {
                        flagNoQuery = true;
                        break;
                    }
                }
            }
            // если не совпало
            if (false === flagNoQuery) {
                var url;
                if (url = self.getUrl(e.currentTarget)) {
                    // url, container, callback, context, callbackArgs
                    self.ajax.query(url, null, null, self, [], $(e.currentTarget));
                }
            }
            return false;
});

projectajax's People

Contributors

yuriefin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.