mirror of
https://github.com/kbparagua/paloma
synced 2023-03-27 23:21:17 -04:00
Remove jQuery dependency
This commit is contained in:
parent
6be685b5e6
commit
e9cf4e9aff
5 changed files with 17 additions and 21 deletions
|
@ -2,4 +2,5 @@ source 'https://rubygems.org'
|
|||
|
||||
gem 'selenium-webdriver'
|
||||
gem 'jquery-turbolinks'
|
||||
gem 'test-unit'
|
||||
gemspec :path => '../'
|
|
@ -56,6 +56,9 @@ NotFoos.prototype.otherAction = function(){};
|
|||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
Paloma.engine.start();
|
||||
|
||||
$('#js-ajax-link').on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
9
vendor/assets/javascripts/paloma/init.js
vendored
9
vendor/assets/javascripts/paloma/init.js
vendored
|
@ -18,14 +18,9 @@ else {
|
|||
};
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
// Do not continue if Paloma not found.
|
||||
if (window['Paloma'] === undefined) {
|
||||
|
||||
if ( !window['Paloma'] ){
|
||||
if (window['console'] !== undefined){
|
||||
console.warn("Paloma not found. Require it in your application.js.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Paloma.engine.start();
|
||||
});
|
10
vendor/assets/javascripts/paloma/paloma.js
vendored
10
vendor/assets/javascripts/paloma/paloma.js
vendored
|
@ -16,14 +16,14 @@
|
|||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue