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

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 'selenium-webdriver'
gem 'jquery-turbolinks' gem 'jquery-turbolinks'
gem 'test-unit'
gemspec :path => '../' gemspec :path => '../'

View file

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

View file

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

View file

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

View file

@ -16,14 +16,14 @@
Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory}); Paloma.engine = new Paloma.Engine({factory: Paloma._controllerFactory});
Paloma.executeHook = function(){ 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(script.innerHTML);
eval(hook);
}; };