Вход Регистрация
Файл: framework/thirdparty/jquery-entwine/src/jquery.entwine.eventcapture.js
Строк: 172
<?php
(function($) {

    $.
entwine.Namespace.addMethods({
        
bind_capture: function(selectoreventnamecapture) {
            var 
store  this.captures || (this.captures = {});
            var 
rulelists store[event] || (store[event] = {});
            var 
rulelist rulelists[name] || (rulelists[name] = $.entwine.RuleList());

            
rule rulelist.addRule(selectorevent);
            
rule.handler name;

            
this.bind_proxy(selectornamecapture);
        }
    });

    var 
bindings = $.entwine.capture_bindings = {};

    var 
event_proxy = function(event) {
        return function(
e) {
            var namespace, 
capturelistsforeventcapturelistrulehandlersel;

            for (var 
k in $.entwine.namespaces) {
                namespace = $.
entwine.namespaces[k];
                
capturelists = namespace.captures;

                if (
capturelists && (forevent capturelists[event])) {
                    for (var 
k in forevent) {
                        var 
capturelist forevent[k];
                        var 
triggered = namespace.$([]);

                        
// Stepping through each selector from most to least specific
                        
var capturelist.length;
                        while (
j--) {
                            
rule capturelist[j];
                            
handler rule.handler;
                            
sel rule.selector.selector;

                            var 
matching = namespace.$(sel).not(triggered);
                            
matching[handler].apply(matchingarguments);

                            
triggered triggered.add(matching);
                        }
                    }
                }
            }
        }
    };

    var 
selector_proxy = function(selectorhandlerincludechildren) {
        var 
matcher = $.selector(selector);
        return function(
e){
            if (
matcher.matches(e.target)) return handler.apply(thisarguments);
        }
    };

    var 
document_proxy = function(selectorhandlerincludechildren) {
        return function(
e){
            if (
e.target === document) return handler.apply(thisarguments);
        }
    };

    var 
window_proxy = function(selectorhandlerincludechildren) {
        return function(
e){
            if (
e.target === window) return handler.apply(thisarguments);
        }
    };

    var 
property_proxy = function(propertyhandlerincludechildren) {
        var 
matcher;

        return function(
e){
            var 
match this['get'+property]();

            if (
typeof(match) == 'string') {
                var 
matcher = (matcher && match == matcher.selector) ? matcher : $.selector(match);
                if (
matcher.matches(e.target)) return handler.apply(thisarguments);
            }
            else {
                if ($.
inArray(e.targetmatch) !== -1) return handler.apply(thisarguments);
            }
        }
    };

    $.
entwine.Namespace.addHandler({
        
order10,

        
bind: function(selectorkv) {
            var 
match;
            if ($.
isPlainObject(v) && (match k.match(/^froms*(.*)/))) {
                var 
from match[1];
                var 
proxyGen;

                if (
from.match(/[^w]/)) proxyGen selector_proxy;
                else if (
from == 'Window' || from == 'window'proxyGen window_proxy;
                else if (
from == 'Document' || from == 'document'proxyGen document_proxy;
                else 
proxyGen property_proxy;

                for (var 
onevent in v) {
                    var 
handler v[onevent];
                    
match onevent.match(/^on(.*)/);
                    var 
event match[1];

                    
this.bind_capture(selectorevent'_' eventproxyGen(fromhandler));

                    if (!
bindings[event]) {
                        var 
namespaced event.replace(/(s+|$)/g'.entwine$1');
                        
bindings[event] = event_proxy(event);

                        $(
proxyGen == window_proxy window document).bind(namespacedbindings[event]);
                    }
                }

                return 
true;
            }
        }
    });

})(
jQuery);
?>
Онлайн: 1
Реклама