1 |
package Frey::jQuery; |
2 |
use Moose::Role; |
3 |
|
4 |
has jquery_path => ( |
5 |
is => 'rw', |
6 |
default => 'static/js/jquery/jquery-1.2.6.js', |
7 |
); |
8 |
|
9 |
=head2 depends |
10 |
|
11 |
Load C<jquery> and our log extension from local filesystem |
12 |
or from google hosted jquery |
13 |
|
14 |
=cut |
15 |
|
16 |
sub depends { |
17 |
my ($self) = @_; |
18 |
warn "# depends"; |
19 |
if ( -e $self->jquery_path ) { |
20 |
$self->add_js( $self->jquery_path ); |
21 |
} else { |
22 |
$self->add_js( 'http://www.google.com/jsapi' ); |
23 |
$self->add_js(q| |
24 |
google.load("jquery", "1"); |
25 |
google.setOnLoadCallback(function(){ |
26 |
console.log('jquery loaded'); |
27 |
}); |
28 |
|); |
29 |
} |
30 |
$self->add_js ( 'static/Frey/jQuery/log.js' ); |
31 |
$self->add_css( 'static/Frey/jQuery/log.css' ); |
32 |
} |
33 |
|
34 |
1; |