Remove jQuery dependency

This commit is contained in:
kbparagua 2016-03-01 19:07:36 +08:00
parent 6be685b5e6
commit e9cf4e9aff
5 changed files with 17 additions and 21 deletions

View File

@ -2,4 +2,5 @@ source 'https://rubygems.org'
gem 'selenium-webdriver'
gem 'jquery-turbolinks'
gemspec :path => '../'
gem 'test-unit'
gemspec :path => '../'

View File

@ -56,6 +56,9 @@ NotFoos.prototype.otherAction = function(){};
$(document).ready(function(){
Paloma.engine.start();
$('#js-ajax-link').on('click', function(e){
e.preventDefault();

View File

@ -40,9 +40,6 @@
var createConstructor = function(){
var constructor = function(params){ this.params = params; }
$.extend(constructor, Paloma.Controller);
$.extend(constructor.prototype, Paloma.Controller.prototype);
return constructor;
};
@ -52,4 +49,4 @@
Paloma.ControllerFactory = ControllerFactory;
})(window.Paloma);
})(window.Paloma);

View File

@ -18,14 +18,9 @@ else {
};
}
$(document).ready(function(){
// Do not continue if Paloma not found.
if (window['Paloma'] === undefined) {
if (window['console'] !== undefined) {
console.warn("Paloma not found. Require it in your application.js.");
}
return true;
}
Paloma.engine.start();
});
if ( !window['Paloma'] ){
if (window['console'] !== undefined){
console.warn("Paloma not found. Require it in your application.js.");
}
}

View File

@ -16,15 +16,15 @@
Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory});
Paloma.executeHook = function(){
var $hook = $('.js-paloma-hook:first script:first');
var hook = document.getElementsByClassName('js-paloma-hook')[0];
if (!hook) return;
if ($hook.length == 0){ return; }
var script = hook.getElementsByTagName('script')[0];
if (!script) return;
var hook = $hook.html();
eval(hook);
eval(script.innerHTML);
};
})(window.Paloma);
})(window.Paloma);