1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Execute only the first hook found on DOM

This commit is contained in:
kbparagua 2016-03-02 13:42:41 +08:00
parent a892d26f08
commit 430fa37ee8

View file

@ -17,15 +17,8 @@
Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory}); Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory});
Paloma._executeHook = function(){ Paloma._executeHook = function(){
var hooks = document.getElementsByClassName('js-paloma-hook'); var hook = document.querySelector('.js-paloma-hook script');
if (hooks.length == 0) return; if (hook) eval(hook.innerHTML);
for (var i = 0, n = hooks.length; i < n; i++){
var hook = hooks[i],
script = hook.getElementsByTagName('script')[0];
if (script) eval(script.innerHTML);
}
}; };
Paloma.start = function(){ Paloma.start = function(){