nitro 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +752 -543
- data/INSTALL +38 -38
- data/README +264 -225
- data/Rakefile +48 -49
- data/bin/nitro +3 -3
- data/bin/nitrogen +6 -6
- data/doc/AUTHORS +10 -10
- data/doc/CHANGELOG.1 +1939 -1939
- data/doc/CHANGELOG.2 +954 -954
- data/doc/LICENSE +3 -3
- data/doc/MIGRATION +28 -0
- data/doc/RELEASES +814 -643
- data/doc/config.txt +5 -5
- data/install.rb +7 -17
- data/lib/nitro.rb +38 -9
- data/lib/nitro/adapter/cgi.rb +311 -312
- data/lib/nitro/adapter/fastcgi.rb +18 -25
- data/lib/nitro/adapter/webrick.rb +128 -137
- data/lib/nitro/adapter/wee.rb +51 -0
- data/lib/nitro/caching.rb +20 -20
- data/lib/nitro/caching/actions.rb +43 -43
- data/lib/nitro/caching/fragments.rb +46 -46
- data/lib/nitro/caching/invalidation.rb +11 -11
- data/lib/nitro/caching/output.rb +65 -65
- data/lib/nitro/caching/stores.rb +67 -67
- data/lib/nitro/compiler.rb +262 -0
- data/lib/nitro/compiler/elements.rb +0 -0
- data/lib/nitro/compiler/errors.rb +65 -0
- data/lib/nitro/compiler/localization.rb +25 -0
- data/lib/nitro/compiler/markup.rb +19 -0
- data/lib/nitro/compiler/shaders.rb +206 -0
- data/lib/nitro/compiler/squeeze.rb +20 -0
- data/lib/nitro/compiler/xslt.rb +61 -0
- data/lib/nitro/context.rb +87 -88
- data/lib/nitro/controller.rb +151 -158
- data/lib/nitro/cookie.rb +34 -34
- data/lib/nitro/dispatcher.rb +195 -186
- data/lib/nitro/element.rb +132 -126
- data/lib/nitro/element/java_script.rb +6 -6
- data/lib/nitro/flash.rb +66 -66
- data/lib/nitro/mail.rb +192 -192
- data/lib/nitro/mixin/buffer.rb +66 -0
- data/lib/nitro/mixin/debug.rb +16 -16
- data/lib/nitro/mixin/form.rb +88 -0
- data/lib/nitro/mixin/helper.rb +2 -2
- data/lib/nitro/mixin/javascript.rb +108 -108
- data/lib/nitro/mixin/markup.rb +144 -0
- data/lib/nitro/mixin/pager.rb +202 -202
- data/lib/nitro/mixin/rss.rb +67 -0
- data/lib/nitro/mixin/table.rb +63 -0
- data/lib/nitro/mixin/xhtml.rb +75 -0
- data/lib/nitro/mixin/xml.rb +124 -0
- data/lib/nitro/render.rb +183 -359
- data/lib/nitro/request.rb +140 -140
- data/lib/nitro/response.rb +27 -27
- data/lib/nitro/routing.rb +21 -21
- data/lib/nitro/scaffold.rb +124 -118
- data/lib/nitro/server.rb +117 -80
- data/lib/nitro/server/runner.rb +341 -0
- data/lib/nitro/service.rb +12 -12
- data/lib/nitro/service/xmlrpc.rb +22 -22
- data/lib/nitro/session.rb +122 -120
- data/lib/nitro/session/drb.rb +9 -9
- data/lib/nitro/session/drbserver.rb +34 -34
- data/lib/nitro/template.rb +171 -155
- data/lib/nitro/testing/assertions.rb +90 -90
- data/lib/nitro/testing/context.rb +16 -16
- data/lib/nitro/testing/testcase.rb +34 -34
- data/proto/conf/lhttpd.conf +9 -9
- data/proto/public/error.xhtml +75 -75
- data/proto/public/index.xhtml +18 -18
- data/proto/public/js/behaviour.js +65 -65
- data/proto/public/js/controls.js +1 -1
- data/proto/public/js/prototype.js +3 -3
- data/proto/public/settings.xhtml +61 -61
- data/proto/run.rb +1 -5
- data/test/nitro/adapter/raw_post1.bin +0 -0
- data/test/nitro/adapter/tc_cgi.rb +57 -57
- data/test/nitro/adapter/tc_webrick.rb +4 -4
- data/test/nitro/mixin/tc_pager.rb +25 -25
- data/test/nitro/mixin/tc_rss.rb +24 -0
- data/test/nitro/mixin/tc_table.rb +31 -0
- data/test/nitro/mixin/tc_xhtml.rb +13 -0
- data/test/nitro/tc_caching.rb +10 -10
- data/test/nitro/tc_context.rb +8 -8
- data/test/nitro/tc_controller.rb +48 -48
- data/test/nitro/tc_cookie.rb +6 -6
- data/test/nitro/tc_dispatcher.rb +64 -64
- data/test/nitro/tc_element.rb +27 -27
- data/test/nitro/tc_flash.rb +31 -31
- data/test/nitro/tc_mail.rb +63 -63
- data/test/nitro/tc_server.rb +26 -26
- data/test/nitro/tc_session.rb +9 -9
- data/test/nitro/tc_template.rb +19 -19
- data/test/public/blog/list.xhtml +1 -1
- metadata +31 -37
- data/lib/nitro/buffering.rb +0 -45
- data/lib/nitro/builder/form.rb +0 -104
- data/lib/nitro/builder/rss.rb +0 -104
- data/lib/nitro/builder/table.rb +0 -80
- data/lib/nitro/builder/xhtml.rb +0 -132
- data/lib/nitro/builder/xml.rb +0 -131
- data/lib/nitro/conf.rb +0 -36
- data/lib/nitro/environment.rb +0 -21
- data/lib/nitro/errors.rb +0 -69
- data/lib/nitro/localization.rb +0 -153
- data/lib/nitro/markup.rb +0 -147
- data/lib/nitro/output.rb +0 -24
- data/lib/nitro/runner.rb +0 -348
- data/lib/nitro/shaders.rb +0 -206
- data/test/nitro/builder/tc_rss.rb +0 -23
- data/test/nitro/builder/tc_table.rb +0 -30
- data/test/nitro/builder/tc_xhtml.rb +0 -39
- data/test/nitro/builder/tc_xml.rb +0 -56
- data/test/nitro/tc_localization.rb +0 -49
|
@@ -17,22 +17,22 @@ end
|
|
|
17
17
|
|
|
18
18
|
module Response
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
def status_ok?
|
|
21
|
+
@status == 200
|
|
22
|
+
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
def redirect?
|
|
25
|
+
(300..399).include?(@status)
|
|
26
|
+
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
def redirect_url
|
|
29
|
+
@response_headers['location']
|
|
30
|
+
end
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
def response_cookie(name)
|
|
33
|
+
return nil unless @response_cookies
|
|
34
|
+
@response_cookies.find { |c| c.name == name }
|
|
35
|
+
end
|
|
36
36
|
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -40,9 +40,9 @@ end
|
|
|
40
40
|
# to include methods useful for testing.
|
|
41
41
|
|
|
42
42
|
class Context
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
def session
|
|
44
|
+
@session || @session = {}
|
|
45
|
+
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
end
|
|
@@ -8,41 +8,41 @@ require 'nitro/conf'
|
|
|
8
8
|
require 'nitro/testing/context'
|
|
9
9
|
|
|
10
10
|
module Test::Unit
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
class TestCase
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
13
|
+
include Nitro
|
|
14
|
+
|
|
15
|
+
attr_accessor :conf
|
|
16
|
+
attr_accessor :context
|
|
17
|
+
|
|
18
|
+
def handle(path, request = {}, session = nil, headers = {})
|
|
19
|
+
@conf ||= Conf.new({})
|
|
20
|
+
@conf.public_root ||= File.join(File.dirname(__FILE__), '..', 'public')
|
|
21
|
+
@conf.template_root ||= File.join(File.dirname(__FILE__), '..', 'public')
|
|
22
|
+
|
|
23
|
+
begin
|
|
24
|
+
context = Context.new(@conf)
|
|
25
|
+
|
|
26
|
+
# context.in = StringIO.new(req.body || "")
|
|
27
|
+
|
|
28
|
+
context.params = request
|
|
29
|
+
context.headers ||= headers
|
|
30
|
+
context.session = session if session
|
|
31
|
+
|
|
32
|
+
context.headers['REQUEST_URI'] = path
|
|
33
|
+
# CgiUtils.parse_params(context)
|
|
34
|
+
# CgiUtils.parse_cookies(context)
|
|
35
|
+
|
|
36
|
+
context.render(path)
|
|
37
|
+
|
|
38
|
+
@context = context
|
|
39
|
+
|
|
40
|
+
return context
|
|
41
|
+
ensure
|
|
42
|
+
Og.manager.put_store if defined?(Og) and Og.manager
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
alias_method :process, :handle
|
|
46
46
|
|
|
47
47
|
end
|
|
48
48
|
|
data/proto/conf/lhttpd.conf
CHANGED
|
@@ -20,15 +20,15 @@ url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
|
|
|
20
20
|
server.error-handler-404 = "/fcgi.rb"
|
|
21
21
|
|
|
22
22
|
fastcgi.server = ( ".rb" =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
( "localhost" =>
|
|
24
|
+
(
|
|
25
|
+
"min-procs" => 1,
|
|
26
|
+
"max-procs" => 5,
|
|
27
|
+
"socket" => "/tmp/blog.fcgi.socket",
|
|
28
|
+
"bin-path" => "/home/gmosx/public/nitro/proto/public/fcgi.rb"
|
|
29
|
+
"bin-environment" => ( "NITRO_ENV" => "development" )
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
mimetype.assign = (
|
data/proto/public/error.xhtml
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
<html>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
<head>
|
|
3
|
+
<title>Error</title>
|
|
4
|
+
<style>
|
|
5
|
+
.path {
|
|
6
|
+
padding: 5px;
|
|
7
|
+
font-size: 140%;
|
|
8
|
+
background: #ddd;
|
|
9
|
+
}
|
|
10
|
+
.error {
|
|
11
|
+
padding: 5px;
|
|
12
|
+
padding-top: 15px;
|
|
13
|
+
font-size: 140%;
|
|
14
|
+
color: #f00;
|
|
15
|
+
}
|
|
16
|
+
.load {
|
|
17
|
+
padding: 5px;
|
|
18
|
+
color: #555;
|
|
19
|
+
}
|
|
20
|
+
.source {
|
|
21
|
+
border: 1px solid #ccc;
|
|
22
|
+
padding: 10px;
|
|
23
|
+
margin-top: 10px; margin-bottom: 10px;
|
|
24
|
+
}
|
|
25
|
+
h2 {
|
|
26
|
+
padding-left: 5px;
|
|
27
|
+
background: #eee;
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<h1>Error</h1>
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
34
|
+
<?r for error, path in @context.rendering_errors ?>
|
|
35
|
+
<div class="path"><strong>Path:</strong> #{path}</div>
|
|
36
|
+
<div class="error"><strong>#{error.to_s}</strong></div>
|
|
37
|
+
<div class="load">Click here to <strong><a href="#{request.uri}">reload</a></strong>.</div>
|
|
38
|
+
<div class="load">Click here to go to the <strong><a href="#{request.referer}">referer</a></strong> or the <strong><a href="/">home page</a></strong>.</div>
|
|
39
|
+
<?r if error.respond_to?(:source_extract) ?>
|
|
40
|
+
<div class="source">
|
|
41
|
+
<?r
|
|
42
|
+
extract = error.source_extract.split("\n")
|
|
43
|
+
extract.each_with_index do |line, idx|
|
|
44
|
+
line = Nitro::Markup.expand(line)
|
|
45
|
+
if 4 == idx
|
|
46
|
+
?>
|
|
47
|
+
<div style="background: #eee">#{line}</div>
|
|
48
|
+
<?r else ?>
|
|
49
|
+
<div>#{line}</div>
|
|
50
|
+
<?r
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
?>
|
|
54
|
+
</div>
|
|
55
|
+
<?r end ?>
|
|
56
|
+
<h2><a href="#" onclick="document.getElementById('trace').style.display = 'block'; return false">Stack Trace</a></h2>
|
|
57
|
+
<p id="trace" style="display: none">#{error.backtrace.join('<br />')}</p>
|
|
58
|
+
<?r end ?>
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
<h2><a href="#" onclick="document.getElementById('request').style.display = 'block'; return false">Request</a></h2>
|
|
61
|
+
<div id="request" style="display: none">
|
|
62
|
+
<p><strong>Parameters:</strong> #{request.params.reject{ |k,v| k == :__RELOADED__ }.inspect}</p>
|
|
63
|
+
<p><strong>Cookies:</strong> #{request.cookies.inspect}</p>
|
|
64
|
+
<p><strong>Headers:</strong><br />#{request.headers.collect { |k, v| "#{k} => #{v}" }.join('<br />')}</p>
|
|
65
|
+
</div>
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
<h2><a href="#" onclick="document.getElementById('response').style.display = 'block'; return false">Response</a></h2>
|
|
68
|
+
<div id="response" style="display: none">
|
|
69
|
+
<p><strong>Headers:</strong> #{request.response_headers.inspect}</p>
|
|
70
|
+
<p><strong>Cookies:</strong> #{request.response_cookies.inspect}</p>
|
|
71
|
+
</div>
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
<h2><a href="#" onclick="document.getElementById('session').style.display = 'block'; return false">Session</a></h2>
|
|
74
|
+
<div id="session" style="display: none">
|
|
75
|
+
<p><strong>Values:</strong> #{session.inspect}</p>
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<br /><br />
|
|
79
|
+
Powered by <a href="http://www.nitrohq.com">Nitro</a> version #{Nitro::Version}
|
|
80
|
+
</body>
|
|
81
81
|
</html>
|
data/proto/public/index.xhtml
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
line-height: 18px;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
h1 { margin-top: 15px; margin-bottom: 45px; }
|
|
16
16
|
|
|
17
17
|
li {
|
|
18
18
|
margin-bottom: 7px;
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
a:visited { color: #666; }
|
|
29
29
|
a:hover { color: #fff; background-color:#000; }
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
img { border: none; }
|
|
32
32
|
</style>
|
|
33
33
|
</head>
|
|
34
34
|
<body>
|
|
@@ -50,32 +50,32 @@
|
|
|
50
50
|
<p>Have a look at the <b>examples</b>:</p>
|
|
51
51
|
|
|
52
52
|
<ol>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
<li><b>examples/blog</b>: A simple Blog, featuring a nice XSLT based template.</li>
|
|
54
|
+
<li><b>examples/no_xsl_blog</b>: The same example without using XSLT (easier to setup under Windows).</li>
|
|
55
|
+
<li><b>examples/why_wiki</b>: A conversion of why_'s wiki.</li>
|
|
56
|
+
<li><b>examples/wee_style</b>: A Wee-style (ruby code only) example.</li>
|
|
57
|
+
<li><b>examples/ajax</b>: Implement Google suggest-style functionality using ajax techniques.</li>
|
|
58
|
+
<li><b>examples/tiny</b>: A small example to verify your installation.</li>
|
|
59
59
|
</ol>
|
|
60
60
|
|
|
61
61
|
<p>Here is <b>what do next</b>:</p>
|
|
62
62
|
|
|
63
63
|
<ol>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
<li>Add your xhtml files in the 'public' directory. Those files are
|
|
65
|
+
automagically converted to controller actions by Nitro
|
|
66
|
+
</li>
|
|
67
|
+
<li>Place additional media files, css, or xsl files in the public directory.</li>
|
|
68
|
+
<li>Create your models and controllers.</li>
|
|
69
|
+
<li>Develop your application utilizing Nitro's powerful features.</li>
|
|
70
70
|
</ol>
|
|
71
71
|
|
|
72
72
|
<br />
|
|
73
73
|
|
|
74
74
|
<p>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
<b>Having problems getting up and running?</b><br />
|
|
76
|
+
First try debugging it yourself by looking at the log files.
|
|
77
|
+
If you get stuck, post your problem to the <a href="http://rubyforge.org/mailman/listinfo/nitro-general">Nitro Mailing
|
|
78
|
+
List</a> at <a href="http://www.rubyforge.com">Rubyforge</a>.
|
|
79
79
|
</p>
|
|
80
80
|
|
|
81
81
|
<br /><br />
|
|
@@ -3,81 +3,81 @@
|
|
|
3
3
|
of Simon Willison (see comments by Simon below).
|
|
4
4
|
|
|
5
5
|
Description:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
|
|
7
|
+
Uses css selectors to apply javascript behaviours to enable
|
|
8
|
+
unobtrusive javascript in html documents.
|
|
9
|
+
|
|
10
10
|
Usage:
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
var myrules = {
|
|
13
|
+
'b.someclass' : function(element){
|
|
14
|
+
element.onclick = function(){
|
|
15
|
+
alert(this.innerHTML);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
'#someid u' : function(element){
|
|
19
|
+
element.onmouseover = function(){
|
|
20
|
+
this.innerHTML = "BLAH!";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
Behaviour.register(myrules);
|
|
26
|
+
|
|
27
|
+
// Call Behaviour.apply() to re-apply the rules (if you
|
|
28
|
+
// update the dom, etc).
|
|
29
29
|
|
|
30
30
|
License:
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
My stuff is BSD licensed. Not sure about Simon's.
|
|
33
|
+
|
|
34
34
|
More information:
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
http://ripcord.co.nz/behaviour/
|
|
37
37
|
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
var Behaviour = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
list : new Array,
|
|
42
|
+
|
|
43
|
+
register : function(sheet){
|
|
44
|
+
Behaviour.list.push(sheet);
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
start : function(){
|
|
48
|
+
Behaviour.addLoadEvent(function(){
|
|
49
|
+
Behaviour.apply();
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
apply : function(){
|
|
54
|
+
for (h=0;sheet=Behaviour.list[h];h++){
|
|
55
|
+
for (selector in sheet){
|
|
56
|
+
list = document.getElementsBySelector(selector);
|
|
57
|
+
|
|
58
|
+
if (!list){
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
for (i=0;element=list[i];i++){
|
|
63
|
+
sheet[selector](element);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
addLoadEvent : function(func){
|
|
70
|
+
var oldonload = window.onload;
|
|
71
|
+
|
|
72
|
+
if (typeof window.onload != 'function') {
|
|
73
|
+
window.onload = func;
|
|
74
|
+
} else {
|
|
75
|
+
window.onload = function() {
|
|
76
|
+
oldonload();
|
|
77
|
+
func();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
Behaviour.start();
|
|
@@ -225,7 +225,7 @@ document.getElementsBySelector = function(selector) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
if (!currentContext[0]){
|
|
228
|
-
|
|
228
|
+
return;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
// If we get here, token is JUST an element (not a class or ID selector)
|