imagesize 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +0 -6
- data/README.txt +48 -2
- data/Rakefile +1 -0
- data/lib/image_size.rb +301 -3
- data/lib/image_size/version.rb +1 -1
- metadata +2 -8
- data/lib/image_size/image_size.rb +0 -284
- data/website/index.html +0 -80
- data/website/index.txt +0 -31
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -129
- data/website/template.rhtml +0 -48
data/Manifest.txt
CHANGED
@@ -4,7 +4,6 @@ README.txt
|
|
4
4
|
Rakefile
|
5
5
|
lib/image_size.rb
|
6
6
|
lib/image_size/version.rb
|
7
|
-
lib/image_size/image_size.rb
|
8
7
|
scripts/txt2html
|
9
8
|
setup.rb
|
10
9
|
test/test_helper.rb
|
@@ -21,8 +20,3 @@ test/test.xpm
|
|
21
20
|
test/tiff.tiff
|
22
21
|
test/tokyo_tower.jpg
|
23
22
|
test/tower_e.gif.psd
|
24
|
-
website/index.html
|
25
|
-
website/index.txt
|
26
|
-
website/javascripts/rounded_corners_lite.inc.js
|
27
|
-
website/stylesheets/screen.css
|
28
|
-
website/template.rhtml
|
data/README.txt
CHANGED
@@ -1,3 +1,49 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
= image_size -- measure image size(GIF, PNG, JPEG ,,, etc)
|
2
|
+
|
3
|
+
measure image (GIF, PNG, JPEG ,,, etc) size code by Pure Ruby
|
4
|
+
["PCX", "PSD", "XPM", "TIFF", "XBM", "PGM", "PBM", "PPM", "BMP", "JPEG", "PNG", "GIF", "SWF"]
|
5
|
+
|
6
|
+
== Download
|
7
|
+
|
8
|
+
The latest version of image_size can be found at
|
9
|
+
|
10
|
+
* http://rubyforge.org/projects/imagesize
|
11
|
+
|
12
|
+
== Installation
|
13
|
+
|
14
|
+
=== Normal Installation
|
15
|
+
|
16
|
+
You can install image_size with the following command.
|
17
|
+
|
18
|
+
% ruby setup.rb
|
19
|
+
|
20
|
+
from its distribution directory.
|
21
|
+
|
22
|
+
=== GEM Installation
|
23
|
+
|
24
|
+
Download and install image_size with the following.
|
25
|
+
|
26
|
+
gem install imagesize
|
27
|
+
|
28
|
+
== image_size References
|
29
|
+
|
30
|
+
* image_size Project Page: http://rubyforge.org/projects/imagesize
|
31
|
+
* image_size API Documents: http://imagesize.rubyforge.org
|
32
|
+
|
33
|
+
== Simple Example
|
34
|
+
|
35
|
+
ruby "rubygems" # you use rubygems
|
36
|
+
ruby "image_size"
|
37
|
+
ruby "open-uri"
|
38
|
+
open("http://www.rubycgi.org/image/ruby_gtk_book_title.jpg", "rb") do |fh|
|
39
|
+
p ImageSize.new(fh.read).get_size
|
40
|
+
end
|
41
|
+
|
42
|
+
== Licence
|
43
|
+
|
44
|
+
This code is free to use under the terms of the Ruby's licence.
|
45
|
+
|
46
|
+
== Contact
|
47
|
+
|
48
|
+
Comments are welcome. Send an email to "Keisuke Minami":mailto:keisuke@rccn.com
|
3
49
|
|
data/Rakefile
CHANGED
data/lib/image_size.rb
CHANGED
@@ -1,5 +1,303 @@
|
|
1
|
-
|
1
|
+
#!ruby
|
2
2
|
|
3
|
-
|
4
|
-
require
|
3
|
+
class ImageSize
|
4
|
+
require "stringio"
|
5
|
+
|
6
|
+
# Image Type Constants
|
7
|
+
module Type
|
8
|
+
OTHER = "OTHER"
|
9
|
+
GIF = "GIF"
|
10
|
+
PNG = "PNG"
|
11
|
+
JPEG = "JPEG"
|
12
|
+
BMP = "BMP"
|
13
|
+
PPM = "PPM" # PPM is like PBM, PGM, & XV
|
14
|
+
PBM = "PBM"
|
15
|
+
PGM = "PGM"
|
16
|
+
# XV = "XV"
|
17
|
+
XBM = "XBM"
|
18
|
+
TIFF = "TIFF"
|
19
|
+
XPM = "XPM"
|
20
|
+
PSD = "PSD"
|
21
|
+
PCX = "PCX"
|
22
|
+
SWF = "SWF"
|
23
|
+
end
|
24
|
+
|
25
|
+
JpegCodeCheck = [
|
26
|
+
"\xc0", "\xc1", "\xc2", "\xc3",
|
27
|
+
"\xc5", "\xc6", "\xc7",
|
28
|
+
"\xc9", "\xca", "\xcb",
|
29
|
+
"\xcd", "\xce", "\xcf",
|
30
|
+
]
|
31
|
+
|
32
|
+
# image type list
|
33
|
+
def ImageSize.type_list
|
34
|
+
Type.constants
|
35
|
+
end
|
36
|
+
|
37
|
+
# receive image & make size
|
38
|
+
# argument is image String, StringIO or IO
|
39
|
+
def initialize(img_data, img_type = nil)
|
40
|
+
@img_data = img_data.dup
|
41
|
+
@img_wedth = nil
|
42
|
+
@img_height = nil
|
43
|
+
@img_type = nil
|
44
|
+
|
45
|
+
if @img_data.is_a?(IO)
|
46
|
+
img_top = @img_data.read(1024)
|
47
|
+
img_io = def_read_o(@img_data)
|
48
|
+
elsif @img_data.is_a?(StringIO)
|
49
|
+
img_top = @img_data.read(1024)
|
50
|
+
img_io = def_read_o(@img_data)
|
51
|
+
elsif @img_data.is_a?(String)
|
52
|
+
img_top = @img_data[0, 1024]
|
53
|
+
# img_io = StringIO.open(@img_data){|sio| io = def_read_o(sio); io }
|
54
|
+
img_io = StringIO.open(@img_data)
|
55
|
+
img_io = def_read_o(img_io)
|
56
|
+
else
|
57
|
+
raise "argument class error!! #{img_data.type}"
|
58
|
+
end
|
59
|
+
|
60
|
+
if @img_type.nil?
|
61
|
+
@img_type = check_type(img_top)
|
62
|
+
else
|
63
|
+
type = Type.constants.find{|t| img_type == t }
|
64
|
+
raise("type is failed. #{img_type}\n") if !type
|
65
|
+
@img_type = img_type
|
66
|
+
end
|
67
|
+
|
68
|
+
if @img_type != Type::OTHER
|
69
|
+
@img_width, @img_height = self.__send__("measure_#{@img_type}", img_io)
|
70
|
+
else
|
71
|
+
@img_width, @img_height = [nil, nil]
|
72
|
+
end
|
73
|
+
|
74
|
+
if @img_data.is_a?(String)
|
75
|
+
img_io.close
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# get image type
|
80
|
+
# ex. "GIF", "PNG", "JPEG"
|
81
|
+
def get_type; @img_type; end
|
82
|
+
|
83
|
+
# get image height
|
84
|
+
def get_height
|
85
|
+
if @img_type == Type::OTHER then nil else @img_height end
|
86
|
+
end
|
87
|
+
|
88
|
+
# get image height
|
89
|
+
def get_width
|
90
|
+
if @img_type == Type::OTHER then nil else @img_width end
|
91
|
+
end
|
92
|
+
|
93
|
+
# get image wight and height(Array)
|
94
|
+
def get_size
|
95
|
+
[self.get_width, self.get_height]
|
96
|
+
end
|
97
|
+
|
98
|
+
alias :height :get_height
|
99
|
+
alias :h :get_height
|
100
|
+
|
101
|
+
alias :width :get_width
|
102
|
+
alias :w :get_width
|
103
|
+
|
104
|
+
alias :size :get_size
|
105
|
+
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
# define read_o
|
110
|
+
def def_read_o(io)
|
111
|
+
io.seek(0, 0)
|
112
|
+
# define Singleton-method definition to IO (byte, offset)
|
113
|
+
def io.read_o(length = 1, offset = nil)
|
114
|
+
self.seek(offset, 0) if offset
|
115
|
+
ret = self.read(length)
|
116
|
+
raise "cannot read!!" unless ret
|
117
|
+
ret
|
118
|
+
end
|
119
|
+
io
|
120
|
+
end
|
121
|
+
|
122
|
+
def check_type(img_top)
|
123
|
+
if img_top =~ /^GIF8[7,9]a/ then Type::GIF
|
124
|
+
elsif img_top[0, 8] == "\x89PNG\x0d\x0a\x1a\x0a" then Type::PNG
|
125
|
+
elsif img_top[0, 2] == "\xFF\xD8" then Type::JPEG
|
126
|
+
elsif img_top[0, 2] == 'BM' then Type::BMP
|
127
|
+
elsif img_top =~ /^P[1-7]/ then Type::PPM
|
128
|
+
elsif img_top =~ /\#define\s+\S+\s+\d+/ then Type::XBM
|
129
|
+
elsif img_top[0, 4] == "MM\x00\x2a" then Type::TIFF
|
130
|
+
elsif img_top[0, 4] == "II\x2a\x00" then Type::TIFF
|
131
|
+
elsif img_top =~ /\/\* XPM \*\// then Type::XPM
|
132
|
+
elsif img_top[0, 4] == "8BPS" then Type::PSD
|
133
|
+
elsif img_top[1, 2] == "WS" then Type::SWF
|
134
|
+
elsif img_top[0] == 10 then Type::PCX
|
135
|
+
else Type::OTHER
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def measure_GIF(img_io)
|
140
|
+
img_io.read_o(6)
|
141
|
+
img_io.read_o(4).unpack('vv')
|
142
|
+
end
|
143
|
+
|
144
|
+
def measure_PNG(img_io)
|
145
|
+
img_io.read_o(12)
|
146
|
+
raise "This file is not PNG." unless img_io.read_o(4) == "IHDR"
|
147
|
+
img_io.read_o(8).unpack('NN')
|
148
|
+
end
|
149
|
+
|
150
|
+
def measure_JPEG(img_io)
|
151
|
+
c_marker = "\xFF" # Section marker.
|
152
|
+
img_io.read_o(2)
|
153
|
+
while(true)
|
154
|
+
marker, code, length = img_io.read_o(4).unpack('aan')
|
155
|
+
raise "JPEG marker not found!" if marker != c_marker
|
156
|
+
|
157
|
+
if JpegCodeCheck.include?(code)
|
158
|
+
height, width = img_io.read_o(5).unpack('xnn')
|
159
|
+
return([width, height])
|
160
|
+
end
|
161
|
+
img_io.read_o(length - 2)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
def measure_BMP(img_io)
|
166
|
+
img_io.read_o(26).unpack("x18VV");
|
167
|
+
end
|
168
|
+
|
169
|
+
def measure_PPM(img_io)
|
170
|
+
header = img_io.read_o(1024)
|
171
|
+
header.gsub!(/^\#[^\n\r]*/m, "")
|
172
|
+
header =~ /^(P[1-6])\s+?(\d+)\s+?(\d+)/m
|
173
|
+
width = $2.to_i; height = $3.to_i
|
174
|
+
case $1
|
175
|
+
when "P1", "P4" then @img_type = "PBM"
|
176
|
+
when "P2", "P5" then @img_type = "PGM"
|
177
|
+
when "P3", "P6" then @img_type = "PPM"
|
178
|
+
# when "P7"
|
179
|
+
# @img_type = "XV"
|
180
|
+
# header =~ /IMGINFO:(\d+)x(\d+)/m
|
181
|
+
# width = $1.to_i; height = $2.to_i
|
182
|
+
end
|
183
|
+
[width, height]
|
184
|
+
end
|
185
|
+
|
186
|
+
alias :measure_PGM :measure_PPM
|
187
|
+
alias :measure_PBM :measure_PPM
|
188
|
+
|
189
|
+
def measure_XBM(img_io)
|
190
|
+
img_io.read_o(1024) =~ /^\#define\s*\S*\s*(\d+)\s*\n\#define\s*\S*\s*(\d+)/mi
|
191
|
+
[$1.to_i, $2.to_i]
|
192
|
+
end
|
193
|
+
|
194
|
+
def measure_XPM(img_io)
|
195
|
+
width = height = nil
|
196
|
+
while(line = img_io.read_o(1024))
|
197
|
+
if line =~ /"\s*(\d+)\s+(\d+)(\s+\d+\s+\d+){1,2}\s*"/m
|
198
|
+
width = $1.to_i; height = $2.to_i
|
199
|
+
break
|
200
|
+
end
|
201
|
+
end
|
202
|
+
[width, height]
|
203
|
+
end
|
204
|
+
|
205
|
+
def measure_PSD(img_io)
|
206
|
+
img_io.read_o(26).unpack("x14NN")
|
207
|
+
end
|
208
|
+
|
209
|
+
def measure_TIFF(img_io)
|
210
|
+
endian = if (img_io.read_o(4) =~ /II\x2a\x00/o) then 'v' else 'n' end
|
211
|
+
# 'v' little-endian 'n' default to big-endian
|
212
|
+
|
213
|
+
packspec = [
|
214
|
+
nil, # nothing (shouldn't happen)
|
215
|
+
'C', # BYTE (8-bit unsigned integer)
|
216
|
+
nil, # ASCII
|
217
|
+
endian, # SHORT (16-bit unsigned integer)
|
218
|
+
endian.upcase, # LONG (32-bit unsigned integer)
|
219
|
+
nil, # RATIONAL
|
220
|
+
'c', # SBYTE (8-bit signed integer)
|
221
|
+
nil, # UNDEFINED
|
222
|
+
endian, # SSHORT (16-bit unsigned integer)
|
223
|
+
endian.upcase, # SLONG (32-bit unsigned integer)
|
224
|
+
]
|
225
|
+
|
226
|
+
offset = img_io.read_o(4).unpack(endian.upcase)[0] # Get offset to IFD
|
227
|
+
|
228
|
+
ifd = img_io.read_o(2, offset)
|
229
|
+
num_dirent = ifd.unpack(endian)[0] # Make it useful
|
230
|
+
offset += 2
|
231
|
+
num_dirent = offset + (num_dirent * 12); # Calc. maximum offset of IFD
|
232
|
+
|
233
|
+
ifd = width = height = nil
|
234
|
+
while(width.nil? || height.nil?)
|
235
|
+
ifd = img_io.read_o(12, offset) # Get first directory entry
|
236
|
+
break if (ifd.nil? || (offset > num_dirent))
|
237
|
+
offset += 12
|
238
|
+
tag = ifd.unpack(endian)[0] # ...and decode its tag
|
239
|
+
type = ifd[2, 2].unpack(endian)[0] # ...and the data type
|
240
|
+
|
241
|
+
# Check the type for sanity.
|
242
|
+
next if (type > packspec.size + 0) || (packspec[type].nil?)
|
243
|
+
if tag == 0x0100 # Decode the value
|
244
|
+
width = ifd[8, 4].unpack(packspec[type])[0]
|
245
|
+
elsif tag == 0x0101 # Decode the value
|
246
|
+
height = ifd[8, 4].unpack(packspec[type])[0]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
raise "#{if width.nil? then 'width not defined.' end} #{if height.nil? then 'height not defined.' end}" if width.nil? || height.nil?
|
251
|
+
[width, height]
|
252
|
+
end
|
253
|
+
|
254
|
+
def measure_PCX(img_io)
|
255
|
+
header = img_io.read_o(128)
|
256
|
+
head_part = header.unpack('C4S4')
|
257
|
+
width = head_part[6] - head_part[4] + 1
|
258
|
+
height = head_part[7] - head_part[5] + 1
|
259
|
+
[width, height]
|
260
|
+
end
|
261
|
+
|
262
|
+
def measure_SWF(img_io)
|
263
|
+
header = img_io.read_o(9)
|
264
|
+
|
265
|
+
sig1 = header[0,1]
|
266
|
+
sig2 = header[1,1]
|
267
|
+
sig3 = header[2,1]
|
268
|
+
|
269
|
+
if !((sig1 == 'F' || sig1 == 'C') && sig2 == 'W' && sig3 == 'S')
|
270
|
+
raise("This file is not SWF.")
|
271
|
+
end
|
272
|
+
|
273
|
+
bit_length = Integer("0b#{header.unpack('@8B5')}")
|
274
|
+
header << img_io.read_o(bit_length*4/8+1)
|
275
|
+
str = header.unpack("@8B#{5+bit_length*4}")[0]
|
276
|
+
last = 5
|
277
|
+
x_min = Integer("0b#{str[last,bit_length]}")
|
278
|
+
x_max = Integer("0b#{str[(last += bit_length),bit_length]}")
|
279
|
+
y_min = Integer("0b#{str[(last += bit_length),bit_length]}")
|
280
|
+
y_max = Integer("0b#{str[(last += bit_length),bit_length]}")
|
281
|
+
width = (x_max - x_min)/20
|
282
|
+
height = (y_max - y_min)/20
|
283
|
+
[width, height]
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
if __FILE__ == $0
|
289
|
+
print "TypeList: #{ImageSize.type.inspect}\n"
|
290
|
+
|
291
|
+
Dir.glob("*").each do |file|
|
292
|
+
print "#{file} (string)\n"
|
293
|
+
open(file, "rb") do |fh|
|
294
|
+
img = ImageSize.new(fh.read)
|
295
|
+
print <<-EOF
|
296
|
+
type: #{img.get_type.inspect}
|
297
|
+
width: #{img.get_width.inspect}
|
298
|
+
height: #{img.get_height.inspect}
|
299
|
+
EOF
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
5
303
|
|
data/lib/image_size/version.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: imagesize
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-04-
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2007-04-23 00:00:00 +09:00
|
8
8
|
summary: measure image size(GIF, PNG, JPEG ,,, etc)
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- lib/image_size.rb
|
37
37
|
- lib/image_size/version.rb
|
38
|
-
- lib/image_size/image_size.rb
|
39
38
|
- scripts/txt2html
|
40
39
|
- setup.rb
|
41
40
|
- test/test_helper.rb
|
@@ -52,11 +51,6 @@ files:
|
|
52
51
|
- test/tiff.tiff
|
53
52
|
- test/tokyo_tower.jpg
|
54
53
|
- test/tower_e.gif.psd
|
55
|
-
- website/index.html
|
56
|
-
- website/index.txt
|
57
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
58
|
-
- website/stylesheets/screen.css
|
59
|
-
- website/template.rhtml
|
60
54
|
test_files:
|
61
55
|
- test/test_helper.rb
|
62
56
|
- test/test_image_size.rb
|
@@ -1,284 +0,0 @@
|
|
1
|
-
#!ruby
|
2
|
-
|
3
|
-
class ImageSize
|
4
|
-
# Image Type Constants
|
5
|
-
module Type
|
6
|
-
OTHER = "OTHER"
|
7
|
-
GIF = "GIF"
|
8
|
-
PNG = "PNG"
|
9
|
-
JPEG = "JPEG"
|
10
|
-
BMP = "BMP"
|
11
|
-
PPM = "PPM" # PPM is like PBM, PGM, & XV
|
12
|
-
PBM = "PBM"
|
13
|
-
PGM = "PGM"
|
14
|
-
# XV = "XV"
|
15
|
-
XBM = "XBM"
|
16
|
-
TIFF = "TIFF"
|
17
|
-
XPM = "XPM"
|
18
|
-
PSD = "PSD"
|
19
|
-
PCX = "PCX"
|
20
|
-
SWF = "SWF"
|
21
|
-
end
|
22
|
-
|
23
|
-
JpegCodeCheck = [
|
24
|
-
"\xc0", "\xc1", "\xc2", "\xc3",
|
25
|
-
"\xc5", "\xc6", "\xc7",
|
26
|
-
"\xc9", "\xca", "\xcb",
|
27
|
-
"\xcd", "\xce", "\xcf",
|
28
|
-
]
|
29
|
-
|
30
|
-
# image type list
|
31
|
-
def ImageSize.type_list
|
32
|
-
Type.constants
|
33
|
-
end
|
34
|
-
|
35
|
-
# receive image & make size
|
36
|
-
# argument is image String or IO
|
37
|
-
def initialize(img_data, img_type = nil)
|
38
|
-
@img_data = img_data.dup
|
39
|
-
@img_wedth = nil
|
40
|
-
@img_height = nil
|
41
|
-
|
42
|
-
if @img_data.is_a?(IO)
|
43
|
-
@img_top = @img_data.read(128)
|
44
|
-
@img_data.seek(0, 0)
|
45
|
-
# define Singleton-method definition to IO (byte, offset)
|
46
|
-
def @img_data.read_o(length = 1, offset = nil)
|
47
|
-
self.seek(offset, 0) if offset
|
48
|
-
ret = self.read(length)
|
49
|
-
raise "cannot read!!" unless ret
|
50
|
-
ret
|
51
|
-
end
|
52
|
-
elsif @img_data.is_a?(String)
|
53
|
-
@img_top = @img_data[0, 128]
|
54
|
-
# define Singleton-method definition to String (byte, offset)
|
55
|
-
def @img_data.read_o(length = 1, offset = nil)
|
56
|
-
@img_offset = 0 if !(defined?(@img_offset))
|
57
|
-
@img_offset = offset if offset
|
58
|
-
ret = self[@img_offset, length]
|
59
|
-
@img_offset += length
|
60
|
-
ret
|
61
|
-
end
|
62
|
-
else
|
63
|
-
raise "argument class error!! #{img_data.type}"
|
64
|
-
end
|
65
|
-
|
66
|
-
if img_type.nil?
|
67
|
-
@img_type = check_type()
|
68
|
-
else
|
69
|
-
match = false
|
70
|
-
Type.constants.each do |t|
|
71
|
-
match = true if img_type == t
|
72
|
-
end
|
73
|
-
raise("img_type is failed. #{img_type}\n") if match == false
|
74
|
-
@img_type = img_type
|
75
|
-
end
|
76
|
-
|
77
|
-
eval("@img_width, @img_height = measure_" + @img_type + "()") if @img_type != Type::OTHER
|
78
|
-
end
|
79
|
-
|
80
|
-
# get parameter
|
81
|
-
def get_type; @img_type; end
|
82
|
-
def get_height
|
83
|
-
if @img_type == Type::OTHER then nil else @img_height end
|
84
|
-
end
|
85
|
-
def get_width
|
86
|
-
if @img_type == Type::OTHER then nil else @img_width end
|
87
|
-
end
|
88
|
-
|
89
|
-
def check_type()
|
90
|
-
if @img_top =~ /^GIF8[7,9]a/ then Type::GIF
|
91
|
-
elsif @img_top[0, 8] == "\x89PNG\x0d\x0a\x1a\x0a" then Type::PNG
|
92
|
-
elsif @img_top[0, 2] == "\xFF\xD8" then Type::JPEG
|
93
|
-
elsif @img_top[0, 2] == 'BM' then Type::BMP
|
94
|
-
elsif @img_top =~ /^P[1-7]/ then Type::PPM
|
95
|
-
elsif @img_top =~ /\#define\s+\S+\s+\d+/ then Type::XBM
|
96
|
-
elsif @img_top[0, 4] == "MM\x00\x2a" then Type::TIFF
|
97
|
-
elsif @img_top[0, 4] == "II\x2a\x00" then Type::TIFF
|
98
|
-
elsif @img_top =~ /\/\* XPM \*\// then Type::XPM
|
99
|
-
elsif @img_top[0, 4] == "8BPS" then Type::PSD
|
100
|
-
elsif @img_top[1, 2] == "WS" then Type::SWF
|
101
|
-
elsif @img_top[0] == 10 then Type::PCX
|
102
|
-
else Type::OTHER
|
103
|
-
end
|
104
|
-
end
|
105
|
-
private(:check_type)
|
106
|
-
|
107
|
-
def measure_GIF()
|
108
|
-
@img_data.read_o(6)
|
109
|
-
@img_data.read_o(4).unpack('vv')
|
110
|
-
end
|
111
|
-
private(:measure_GIF)
|
112
|
-
|
113
|
-
def measure_PNG()
|
114
|
-
@img_data.read_o(12)
|
115
|
-
raise "This file is not PNG." unless @img_data.read_o(4) == "IHDR"
|
116
|
-
@img_data.read_o(8).unpack('NN')
|
117
|
-
end
|
118
|
-
private(:measure_PNG)
|
119
|
-
|
120
|
-
def measure_JPEG()
|
121
|
-
c_marker = "\xFF" # Section marker.
|
122
|
-
@img_data.read_o(2)
|
123
|
-
while(true)
|
124
|
-
marker, code, length = @img_data.read_o(4).unpack('aan')
|
125
|
-
raise "JPEG marker not found!" if marker != c_marker
|
126
|
-
|
127
|
-
if JpegCodeCheck.include?(code)
|
128
|
-
height, width = @img_data.read_o(5).unpack('xnn')
|
129
|
-
return([width, height])
|
130
|
-
end
|
131
|
-
@img_data.read_o(length - 2)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
private(:measure_JPEG)
|
135
|
-
|
136
|
-
def measure_BMP()
|
137
|
-
@img_data.read_o(26).unpack("x18VV");
|
138
|
-
end
|
139
|
-
private(:measure_BMP)
|
140
|
-
|
141
|
-
def measure_PPM()
|
142
|
-
header = @img_data.read_o(1024)
|
143
|
-
header.gsub!(/^\#[^\n\r]*/m, "")
|
144
|
-
header =~ /^(P[1-6])\s+?(\d+)\s+?(\d+)/m
|
145
|
-
width = $2.to_i; height = $3.to_i
|
146
|
-
case $1
|
147
|
-
when "P1", "P4" then @img_type = "PBM"
|
148
|
-
when "P2", "P5" then @img_type = "PGM"
|
149
|
-
when "P3", "P6" then @img_type = "PPM"
|
150
|
-
# when "P7"
|
151
|
-
# @img_type = "XV"
|
152
|
-
# header =~ /IMGINFO:(\d+)x(\d+)/m
|
153
|
-
# width = $1.to_i; height = $2.to_i
|
154
|
-
end
|
155
|
-
[width, height]
|
156
|
-
end
|
157
|
-
private(:measure_PPM)
|
158
|
-
|
159
|
-
alias :measure_PGM :measure_PPM
|
160
|
-
private(:measure_PGM)
|
161
|
-
alias :measure_PBM :measure_PPM
|
162
|
-
private(:measure_PBM)
|
163
|
-
|
164
|
-
def measure_XBM()
|
165
|
-
@img_data.read_o(1024) =~ /^\#define\s*\S*\s*(\d+)\s*\n\#define\s*\S*\s*(\d+)/mi
|
166
|
-
[$1.to_i, $2.to_i]
|
167
|
-
end
|
168
|
-
private(:measure_XBM)
|
169
|
-
|
170
|
-
def measure_XPM()
|
171
|
-
width = height = nil
|
172
|
-
while(line = @img_data.read_o(1024))
|
173
|
-
if line =~ /"\s*(\d+)\s+(\d+)(\s+\d+\s+\d+){1,2}\s*"/m
|
174
|
-
width = $1.to_i; height = $2.to_i
|
175
|
-
break
|
176
|
-
end
|
177
|
-
end
|
178
|
-
[width, height]
|
179
|
-
end
|
180
|
-
private(:measure_XPM)
|
181
|
-
|
182
|
-
def measure_PSD()
|
183
|
-
@img_data.read_o(26).unpack("x14NN")
|
184
|
-
end
|
185
|
-
private(:measure_PSD)
|
186
|
-
|
187
|
-
def measure_TIFF()
|
188
|
-
endian = if (@img_data.read_o(4) =~ /II\x2a\x00/o) then 'v' else 'n' end
|
189
|
-
# 'v' little-endian 'n' default to big-endian
|
190
|
-
|
191
|
-
packspec = [
|
192
|
-
nil, # nothing (shouldn't happen)
|
193
|
-
'C', # BYTE (8-bit unsigned integer)
|
194
|
-
nil, # ASCII
|
195
|
-
endian, # SHORT (16-bit unsigned integer)
|
196
|
-
endian.upcase, # LONG (32-bit unsigned integer)
|
197
|
-
nil, # RATIONAL
|
198
|
-
'c', # SBYTE (8-bit signed integer)
|
199
|
-
nil, # UNDEFINED
|
200
|
-
endian, # SSHORT (16-bit unsigned integer)
|
201
|
-
endian.upcase, # SLONG (32-bit unsigned integer)
|
202
|
-
]
|
203
|
-
|
204
|
-
offset = @img_data.read_o(4).unpack(endian.upcase)[0] # Get offset to IFD
|
205
|
-
|
206
|
-
ifd = @img_data.read_o(2, offset)
|
207
|
-
num_dirent = ifd.unpack(endian)[0] # Make it useful
|
208
|
-
offset += 2
|
209
|
-
num_dirent = offset + (num_dirent * 12); # Calc. maximum offset of IFD
|
210
|
-
|
211
|
-
ifd = width = height = nil
|
212
|
-
while(width.nil? || height.nil?)
|
213
|
-
ifd = @img_data.read_o(12, offset) # Get first directory entry
|
214
|
-
break if (ifd.nil? || (offset > num_dirent))
|
215
|
-
offset += 12
|
216
|
-
tag = ifd.unpack(endian)[0] # ...and decode its tag
|
217
|
-
type = ifd[2, 2].unpack(endian)[0] # ...and the data type
|
218
|
-
|
219
|
-
# Check the type for sanity.
|
220
|
-
next if (type > packspec.size + 0) || (packspec[type].nil?)
|
221
|
-
if tag == 0x0100 # Decode the value
|
222
|
-
width = ifd[8, 4].unpack(packspec[type])[0]
|
223
|
-
elsif tag == 0x0101 # Decode the value
|
224
|
-
height = ifd[8, 4].unpack(packspec[type])[0]
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
raise "#{if width.nil? then 'width not defined.' end} #{if height.nil? then 'height not defined.' end}" if width.nil? || height.nil?
|
229
|
-
[width, height]
|
230
|
-
end
|
231
|
-
private(:measure_TIFF)
|
232
|
-
|
233
|
-
def measure_PCX()
|
234
|
-
header = @img_data.read_o(128)
|
235
|
-
head_part = header.unpack('C4S4')
|
236
|
-
width = head_part[6] - head_part[4] + 1
|
237
|
-
height = head_part[7] - head_part[5] + 1
|
238
|
-
[width, height]
|
239
|
-
end
|
240
|
-
private(:measure_PCX)
|
241
|
-
|
242
|
-
def measure_SWF()
|
243
|
-
header = @img_data.read_o(9)
|
244
|
-
|
245
|
-
sig1 = header[0,1]
|
246
|
-
sig2 = header[1,1]
|
247
|
-
sig3 = header[2,1]
|
248
|
-
|
249
|
-
if !((sig1 == 'F' || sig1 == 'C') && sig2 == 'W' && sig3 == 'S')
|
250
|
-
raise("This file is not SWF.")
|
251
|
-
end
|
252
|
-
|
253
|
-
bit_length = Integer("0b#{header.unpack('@8B5')}")
|
254
|
-
header << @img_data.read_o(bit_length*4/8+1)
|
255
|
-
str = header.unpack("@8B#{5+bit_length*4}")[0]
|
256
|
-
last = 5
|
257
|
-
x_min = Integer("0b#{str[last,bit_length]}")
|
258
|
-
x_max = Integer("0b#{str[(last += bit_length),bit_length]}")
|
259
|
-
y_min = Integer("0b#{str[(last += bit_length),bit_length]}")
|
260
|
-
y_max = Integer("0b#{str[(last += bit_length),bit_length]}")
|
261
|
-
width = (x_max - x_min)/20
|
262
|
-
height = (y_max - y_min)/20
|
263
|
-
[width, height]
|
264
|
-
end
|
265
|
-
private(:measure_PCX)
|
266
|
-
end
|
267
|
-
|
268
|
-
|
269
|
-
if __FILE__ == $0
|
270
|
-
print "TypeList: #{ImageSize.type.inspect}\n"
|
271
|
-
|
272
|
-
Dir.glob("*").each do |file|
|
273
|
-
print "#{file} (string)\n"
|
274
|
-
open(file, "rb") do |fh|
|
275
|
-
img = ImageSize.new(fh.read)
|
276
|
-
print <<-EOF
|
277
|
-
type: #{img.get_type.inspect}
|
278
|
-
width: #{img.get_width.inspect}
|
279
|
-
height: #{img.get_height.inspect}
|
280
|
-
EOF
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
284
|
-
|
data/website/index.html
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>
|
8
|
-
imagesize
|
9
|
-
</title>
|
10
|
-
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
-
<style>
|
12
|
-
|
13
|
-
</style>
|
14
|
-
<script type="text/javascript">
|
15
|
-
window.onload = function() {
|
16
|
-
settings = {
|
17
|
-
tl: { radius: 10 },
|
18
|
-
tr: { radius: 10 },
|
19
|
-
bl: { radius: 10 },
|
20
|
-
br: { radius: 10 },
|
21
|
-
antiAlias: true,
|
22
|
-
autoPad: true,
|
23
|
-
validTags: ["div"]
|
24
|
-
}
|
25
|
-
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
-
versionBox.applyCornersToAll();
|
27
|
-
}
|
28
|
-
</script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="main">
|
32
|
-
|
33
|
-
<h1>imagesize</h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/imagesize"; return false'>
|
35
|
-
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/imagesize" class="numbers">0.0.1</a>
|
37
|
-
</div>
|
38
|
-
<h1>→ ‘imagesize’</h1>
|
39
|
-
|
40
|
-
|
41
|
-
<h2>What</h2>
|
42
|
-
|
43
|
-
|
44
|
-
<h2>Installing</h2>
|
45
|
-
|
46
|
-
|
47
|
-
<pre syntax="ruby">sudo gem install imagesize</pre>
|
48
|
-
|
49
|
-
<h2>The basics</h2>
|
50
|
-
|
51
|
-
|
52
|
-
<h2>Demonstration of usage</h2>
|
53
|
-
|
54
|
-
|
55
|
-
<h2>Forum</h2>
|
56
|
-
|
57
|
-
|
58
|
-
<p><a href="http://rubyforge.org/projects/imagesize/">http://rubyforge.org/projects/imagesize/</a></p>
|
59
|
-
|
60
|
-
|
61
|
-
<h2>Licence</h2>
|
62
|
-
|
63
|
-
|
64
|
-
<p>This code is free to use under the terms of the <span class="caps">MIT</span> licence.</p>
|
65
|
-
|
66
|
-
|
67
|
-
<h2>Contact</h2>
|
68
|
-
|
69
|
-
|
70
|
-
<p>Comments are welcome. Send an email to <a href="mailto:keisuke@rccn.com">Keisuke Minami</a></p>
|
71
|
-
<p class="coda">
|
72
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 19th April 2007<br>
|
73
|
-
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
74
|
-
</p>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
78
|
-
|
79
|
-
</body>
|
80
|
-
</html>
|
data/website/index.txt
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
h1. imagesize
|
2
|
-
|
3
|
-
h1. → 'imagesize'
|
4
|
-
|
5
|
-
|
6
|
-
h2. What
|
7
|
-
|
8
|
-
|
9
|
-
h2. Installing
|
10
|
-
|
11
|
-
<pre syntax="ruby">sudo gem install imagesize</pre>
|
12
|
-
|
13
|
-
h2. The basics
|
14
|
-
|
15
|
-
|
16
|
-
h2. Demonstration of usage
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
h2. Forum
|
21
|
-
|
22
|
-
"http://rubyforge.org/projects/imagesize/":http://rubyforge.org/projects/imagesize/
|
23
|
-
|
24
|
-
h2. Licence
|
25
|
-
|
26
|
-
This code is free to use under the terms of the MIT licence.
|
27
|
-
|
28
|
-
h2. Contact
|
29
|
-
|
30
|
-
Comments are welcome. Send an email to "Keisuke Minami":mailto:keisuke@rccn.com
|
31
|
-
|
@@ -1,285 +0,0 @@
|
|
1
|
-
|
2
|
-
/****************************************************************
|
3
|
-
* *
|
4
|
-
* curvyCorners *
|
5
|
-
* ------------ *
|
6
|
-
* *
|
7
|
-
* This script generates rounded corners for your divs. *
|
8
|
-
* *
|
9
|
-
* Version 1.2.9 *
|
10
|
-
* Copyright (c) 2006 Cameron Cooke *
|
11
|
-
* By: Cameron Cooke and Tim Hutchison. *
|
12
|
-
* *
|
13
|
-
* *
|
14
|
-
* Website: http://www.curvycorners.net *
|
15
|
-
* Email: info@totalinfinity.com *
|
16
|
-
* Forum: http://www.curvycorners.net/forum/ *
|
17
|
-
* *
|
18
|
-
* *
|
19
|
-
* This library is free software; you can redistribute *
|
20
|
-
* it and/or modify it under the terms of the GNU *
|
21
|
-
* Lesser General Public License as published by the *
|
22
|
-
* Free Software Foundation; either version 2.1 of the *
|
23
|
-
* License, or (at your option) any later version. *
|
24
|
-
* *
|
25
|
-
* This library is distributed in the hope that it will *
|
26
|
-
* be useful, but WITHOUT ANY WARRANTY; without even the *
|
27
|
-
* implied warranty of MERCHANTABILITY or FITNESS FOR A *
|
28
|
-
* PARTICULAR PURPOSE. See the GNU Lesser General Public *
|
29
|
-
* License for more details. *
|
30
|
-
* *
|
31
|
-
* You should have received a copy of the GNU Lesser *
|
32
|
-
* General Public License along with this library; *
|
33
|
-
* Inc., 59 Temple Place, Suite 330, Boston, *
|
34
|
-
* MA 02111-1307 USA *
|
35
|
-
* *
|
36
|
-
****************************************************************/
|
37
|
-
|
38
|
-
var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1; var isMoz = document.implementation && document.implementation.createDocument; var isSafari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false; function curvyCorners()
|
39
|
-
{ if(typeof(arguments[0]) != "object") throw newCurvyError("First parameter of curvyCorners() must be an object."); if(typeof(arguments[1]) != "object" && typeof(arguments[1]) != "string") throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name."); if(typeof(arguments[1]) == "string")
|
40
|
-
{ var startIndex = 0; var boxCol = getElementsByClass(arguments[1]);}
|
41
|
-
else
|
42
|
-
{ var startIndex = 1; var boxCol = arguments;}
|
43
|
-
var curvyCornersCol = new Array(); if(arguments[0].validTags)
|
44
|
-
var validElements = arguments[0].validTags; else
|
45
|
-
var validElements = ["div"]; for(var i = startIndex, j = boxCol.length; i < j; i++)
|
46
|
-
{ var currentTag = boxCol[i].tagName.toLowerCase(); if(inArray(validElements, currentTag) !== false)
|
47
|
-
{ curvyCornersCol[curvyCornersCol.length] = new curvyObject(arguments[0], boxCol[i]);}
|
48
|
-
}
|
49
|
-
this.objects = curvyCornersCol; this.applyCornersToAll = function()
|
50
|
-
{ for(var x = 0, k = this.objects.length; x < k; x++)
|
51
|
-
{ this.objects[x].applyCorners();}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
function curvyObject()
|
55
|
-
{ this.box = arguments[1]; this.settings = arguments[0]; this.topContainer = null; this.bottomContainer = null; this.masterCorners = new Array(); this.contentDIV = null; var boxHeight = get_style(this.box, "height", "height"); var boxWidth = get_style(this.box, "width", "width"); var borderWidth = get_style(this.box, "borderTopWidth", "border-top-width"); var borderColour = get_style(this.box, "borderTopColor", "border-top-color"); var boxColour = get_style(this.box, "backgroundColor", "background-color"); var backgroundImage = get_style(this.box, "backgroundImage", "background-image"); var boxPosition = get_style(this.box, "position", "position"); var boxPadding = get_style(this.box, "paddingTop", "padding-top"); this.boxHeight = parseInt(((boxHeight != "" && boxHeight != "auto" && boxHeight.indexOf("%") == -1)? boxHeight.substring(0, boxHeight.indexOf("px")) : this.box.scrollHeight)); this.boxWidth = parseInt(((boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1)? boxWidth.substring(0, boxWidth.indexOf("px")) : this.box.scrollWidth)); this.borderWidth = parseInt(((borderWidth != "" && borderWidth.indexOf("px") !== -1)? borderWidth.slice(0, borderWidth.indexOf("px")) : 0)); this.boxColour = format_colour(boxColour); this.boxPadding = parseInt(((boxPadding != "" && boxPadding.indexOf("px") !== -1)? boxPadding.slice(0, boxPadding.indexOf("px")) : 0)); this.borderColour = format_colour(borderColour); this.borderString = this.borderWidth + "px" + " solid " + this.borderColour; this.backgroundImage = ((backgroundImage != "none")? backgroundImage : ""); this.boxContent = this.box.innerHTML; if(boxPosition != "absolute") this.box.style.position = "relative"; this.box.style.padding = "0px"; if(isIE && boxWidth == "auto" && boxHeight == "auto") this.box.style.width = "100%"; if(this.settings.autoPad == true && this.boxPadding > 0)
|
56
|
-
this.box.innerHTML = ""; this.applyCorners = function()
|
57
|
-
{ for(var t = 0; t < 2; t++)
|
58
|
-
{ switch(t)
|
59
|
-
{ case 0:
|
60
|
-
if(this.settings.tl || this.settings.tr)
|
61
|
-
{ var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var topMaxRadius = Math.max(this.settings.tl ? this.settings.tl.radius : 0, this.settings.tr ? this.settings.tr.radius : 0); newMainContainer.style.height = topMaxRadius + "px"; newMainContainer.style.top = 0 - topMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.topContainer = this.box.appendChild(newMainContainer);}
|
62
|
-
break; case 1:
|
63
|
-
if(this.settings.bl || this.settings.br)
|
64
|
-
{ var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var botMaxRadius = Math.max(this.settings.bl ? this.settings.bl.radius : 0, this.settings.br ? this.settings.br.radius : 0); newMainContainer.style.height = botMaxRadius + "px"; newMainContainer.style.bottom = 0 - botMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.bottomContainer = this.box.appendChild(newMainContainer);}
|
65
|
-
break;}
|
66
|
-
}
|
67
|
-
if(this.topContainer) this.box.style.borderTopWidth = "0px"; if(this.bottomContainer) this.box.style.borderBottomWidth = "0px"; var corners = ["tr", "tl", "br", "bl"]; for(var i in corners)
|
68
|
-
{ if(i > -1 < 4)
|
69
|
-
{ var cc = corners[i]; if(!this.settings[cc])
|
70
|
-
{ if(((cc == "tr" || cc == "tl") && this.topContainer != null) || ((cc == "br" || cc == "bl") && this.bottomContainer != null))
|
71
|
-
{ var newCorner = document.createElement("DIV"); newCorner.style.position = "relative"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; if(this.backgroundImage == "")
|
72
|
-
newCorner.style.backgroundColor = this.boxColour; else
|
73
|
-
newCorner.style.backgroundImage = this.backgroundImage; switch(cc)
|
74
|
-
{ case "tl":
|
75
|
-
newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.tr.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.left = -this.borderWidth + "px"; break; case "tr":
|
76
|
-
newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.tl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; newCorner.style.left = this.borderWidth + "px"; break; case "bl":
|
77
|
-
newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.br.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = -this.borderWidth + "px"; newCorner.style.backgroundPosition = "-" + (this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break; case "br":
|
78
|
-
newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.bl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = this.borderWidth + "px"
|
79
|
-
newCorner.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break;}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
else
|
83
|
-
{ if(this.masterCorners[this.settings[cc].radius])
|
84
|
-
{ var newCorner = this.masterCorners[this.settings[cc].radius].cloneNode(true);}
|
85
|
-
else
|
86
|
-
{ var newCorner = document.createElement("DIV"); newCorner.style.height = this.settings[cc].radius + "px"; newCorner.style.width = this.settings[cc].radius + "px"; newCorner.style.position = "absolute"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; var borderRadius = parseInt(this.settings[cc].radius - this.borderWidth); for(var intx = 0, j = this.settings[cc].radius; intx < j; intx++)
|
87
|
-
{ if((intx +1) >= borderRadius)
|
88
|
-
var y1 = -1; else
|
89
|
-
var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx+1), 2))) - 1); if(borderRadius != j)
|
90
|
-
{ if((intx) >= borderRadius)
|
91
|
-
var y2 = -1; else
|
92
|
-
var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius,2) - Math.pow(intx, 2))); if((intx+1) >= j)
|
93
|
-
var y3 = -1; else
|
94
|
-
var y3 = (Math.floor(Math.sqrt(Math.pow(j ,2) - Math.pow((intx+1), 2))) - 1);}
|
95
|
-
if((intx) >= j)
|
96
|
-
var y4 = -1; else
|
97
|
-
var y4 = Math.ceil(Math.sqrt(Math.pow(j ,2) - Math.pow(intx, 2))); if(y1 > -1) this.drawPixel(intx, 0, this.boxColour, 100, (y1+1), newCorner, -1, this.settings[cc].radius); if(borderRadius != j)
|
98
|
-
{ for(var inty = (y1 + 1); inty < y2; inty++)
|
99
|
-
{ if(this.settings.antiAlias)
|
100
|
-
{ if(this.backgroundImage != "")
|
101
|
-
{ var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if(borderFract < 30)
|
102
|
-
{ this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, 0, this.settings[cc].radius);}
|
103
|
-
else
|
104
|
-
{ this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, -1, this.settings[cc].radius);}
|
105
|
-
}
|
106
|
-
else
|
107
|
-
{ var pixelcolour = BlendColour(this.boxColour, this.borderColour, pixelFraction(intx, inty, borderRadius)); this.drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, this.settings[cc].radius, cc);}
|
108
|
-
}
|
109
|
-
}
|
110
|
-
if(this.settings.antiAlias)
|
111
|
-
{ if(y3 >= y2)
|
112
|
-
{ if (y2 == -1) y2 = 0; this.drawPixel(intx, y2, this.borderColour, 100, (y3 - y2 + 1), newCorner, 0, 0);}
|
113
|
-
}
|
114
|
-
else
|
115
|
-
{ if(y3 >= y1)
|
116
|
-
{ this.drawPixel(intx, (y1 + 1), this.borderColour, 100, (y3 - y1), newCorner, 0, 0);}
|
117
|
-
}
|
118
|
-
var outsideColour = this.borderColour;}
|
119
|
-
else
|
120
|
-
{ var outsideColour = this.boxColour; var y3 = y1;}
|
121
|
-
if(this.settings.antiAlias)
|
122
|
-
{ for(var inty = (y3 + 1); inty < y4; inty++)
|
123
|
-
{ this.drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty , j) * 100), 1, newCorner, ((this.borderWidth > 0)? 0 : -1), this.settings[cc].radius);}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
this.masterCorners[this.settings[cc].radius] = newCorner.cloneNode(true);}
|
127
|
-
if(cc != "br")
|
128
|
-
{ for(var t = 0, k = newCorner.childNodes.length; t < k; t++)
|
129
|
-
{ var pixelBar = newCorner.childNodes[t]; var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px"))); var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px"))); var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px"))); if(cc == "tl" || cc == "bl"){ pixelBar.style.left = this.settings[cc].radius -pixelBarLeft -1 + "px";}
|
130
|
-
if(cc == "tr" || cc == "tl"){ pixelBar.style.top = this.settings[cc].radius -pixelBarHeight -pixelBarTop + "px";}
|
131
|
-
switch(cc)
|
132
|
-
{ case "tr":
|
133
|
-
pixelBar.style.backgroundPosition = "-" + Math.abs((this.boxWidth - this.settings[cc].radius + this.borderWidth) + pixelBarLeft) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "tl":
|
134
|
-
pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "bl":
|
135
|
-
pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs((this.boxHeight + this.settings[cc].radius + pixelBarTop) -this.borderWidth) + "px"; break;}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
}
|
139
|
-
if(newCorner)
|
140
|
-
{ switch(cc)
|
141
|
-
{ case "tl":
|
142
|
-
if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "tr":
|
143
|
-
if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "bl":
|
144
|
-
if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break; case "br":
|
145
|
-
if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break;}
|
146
|
-
}
|
147
|
-
}
|
148
|
-
}
|
149
|
-
var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(this.settings.tl.radius - this.settings.tr.radius)
|
150
|
-
radiusDiff["b"] = Math.abs(this.settings.bl.radius - this.settings.br.radius); for(z in radiusDiff)
|
151
|
-
{ if(z == "t" || z == "b")
|
152
|
-
{ if(radiusDiff[z])
|
153
|
-
{ var smallerCornerType = ((this.settings[z + "l"].radius < this.settings[z + "r"].radius)? z +"l" : z +"r"); var newFiller = document.createElement("DIV"); newFiller.style.height = radiusDiff[z] + "px"; newFiller.style.width = this.settings[smallerCornerType].radius+ "px"
|
154
|
-
newFiller.style.position = "absolute"; newFiller.style.fontSize = "1px"; newFiller.style.overflow = "hidden"; newFiller.style.backgroundColor = this.boxColour; switch(smallerCornerType)
|
155
|
-
{ case "tl":
|
156
|
-
newFiller.style.bottom = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.topContainer.appendChild(newFiller); break; case "tr":
|
157
|
-
newFiller.style.bottom = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.topContainer.appendChild(newFiller); break; case "bl":
|
158
|
-
newFiller.style.top = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.bottomContainer.appendChild(newFiller); break; case "br":
|
159
|
-
newFiller.style.top = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.bottomContainer.appendChild(newFiller); break;}
|
160
|
-
}
|
161
|
-
var newFillerBar = document.createElement("DIV"); newFillerBar.style.position = "relative"; newFillerBar.style.fontSize = "1px"; newFillerBar.style.overflow = "hidden"; newFillerBar.style.backgroundColor = this.boxColour; newFillerBar.style.backgroundImage = this.backgroundImage; switch(z)
|
162
|
-
{ case "t":
|
163
|
-
if(this.topContainer)
|
164
|
-
{ if(this.settings.tl.radius && this.settings.tr.radius)
|
165
|
-
{ newFillerBar.style.height = topMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.tl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.tr.radius - this.borderWidth + "px"; newFillerBar.style.borderTop = this.borderString; if(this.backgroundImage != "")
|
166
|
-
newFillerBar.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; this.topContainer.appendChild(newFillerBar);}
|
167
|
-
this.box.style.backgroundPosition = "0px -" + (topMaxRadius - this.borderWidth) + "px";}
|
168
|
-
break; case "b":
|
169
|
-
if(this.bottomContainer)
|
170
|
-
{ if(this.settings.bl.radius && this.settings.br.radius)
|
171
|
-
{ newFillerBar.style.height = botMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.bl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.br.radius - this.borderWidth + "px"; newFillerBar.style.borderBottom = this.borderString; if(this.backgroundImage != "")
|
172
|
-
newFillerBar.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (topMaxRadius + this.borderWidth)) + "px"; this.bottomContainer.appendChild(newFillerBar);}
|
173
|
-
}
|
174
|
-
break;}
|
175
|
-
}
|
176
|
-
}
|
177
|
-
if(this.settings.autoPad == true && this.boxPadding > 0)
|
178
|
-
{ var contentContainer = document.createElement("DIV"); contentContainer.style.position = "relative"; contentContainer.innerHTML = this.boxContent; contentContainer.className = "autoPadDiv"; var topPadding = Math.abs(topMaxRadius - this.boxPadding); var botPadding = Math.abs(botMaxRadius - this.boxPadding); if(topMaxRadius < this.boxPadding)
|
179
|
-
contentContainer.style.paddingTop = topPadding + "px"; if(botMaxRadius < this.boxPadding)
|
180
|
-
contentContainer.style.paddingBottom = botMaxRadius + "px"; contentContainer.style.paddingLeft = this.boxPadding + "px"; contentContainer.style.paddingRight = this.boxPadding + "px"; this.contentDIV = this.box.appendChild(contentContainer);}
|
181
|
-
}
|
182
|
-
this.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius)
|
183
|
-
{ var pixel = document.createElement("DIV"); pixel.style.height = height + "px"; pixel.style.width = "1px"; pixel.style.position = "absolute"; pixel.style.fontSize = "1px"; pixel.style.overflow = "hidden"; var topMaxRadius = Math.max(this.settings["tr"].radius, this.settings["tl"].radius); if(image == -1 && this.backgroundImage != "")
|
184
|
-
{ pixel.style.backgroundImage = this.backgroundImage; pixel.style.backgroundPosition = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) -this.borderWidth) + "px";}
|
185
|
-
else
|
186
|
-
{ pixel.style.backgroundColor = colour;}
|
187
|
-
if (transAmount != 100)
|
188
|
-
setOpacity(pixel, transAmount); pixel.style.top = inty + "px"; pixel.style.left = intx + "px"; newCorner.appendChild(pixel);}
|
189
|
-
}
|
190
|
-
function insertAfter(parent, node, referenceNode)
|
191
|
-
{ parent.insertBefore(node, referenceNode.nextSibling);}
|
192
|
-
function BlendColour(Col1, Col2, Col1Fraction)
|
193
|
-
{ var red1 = parseInt(Col1.substr(1,2),16); var green1 = parseInt(Col1.substr(3,2),16); var blue1 = parseInt(Col1.substr(5,2),16); var red2 = parseInt(Col2.substr(1,2),16); var green2 = parseInt(Col2.substr(3,2),16); var blue2 = parseInt(Col2.substr(5,2),16); if(Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if(endRed > 255) endRed = 255; if(endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if(endGreen > 255) endGreen = 255; if(endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if(endBlue > 255) endBlue = 255; if(endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed)+ IntToHex(endGreen)+ IntToHex(endBlue);}
|
194
|
-
function IntToHex(strNum)
|
195
|
-
{ base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS;}
|
196
|
-
function MakeHex(x)
|
197
|
-
{ if((x >= 0) && (x <= 9))
|
198
|
-
{ return x;}
|
199
|
-
else
|
200
|
-
{ switch(x)
|
201
|
-
{ case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F";}
|
202
|
-
}
|
203
|
-
}
|
204
|
-
function pixelFraction(x, y, r)
|
205
|
-
{ var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x,2))); if ((intersect >= y) && (intersect < (y+1)))
|
206
|
-
{ whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1;}
|
207
|
-
var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y+1,2))); if ((intersect >= x) && (intersect < (x+1)))
|
208
|
-
{ whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1;}
|
209
|
-
var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x+1,2))); if ((intersect >= y) && (intersect < (y+1)))
|
210
|
-
{ whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1;}
|
211
|
-
var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y,2))); if ((intersect >= x) && (intersect < (x+1)))
|
212
|
-
{ whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0;}
|
213
|
-
switch (whatsides)
|
214
|
-
{ case "LeftRight":
|
215
|
-
pixelfraction = Math.min(yvalues[0],yvalues[1]) + ((Math.max(yvalues[0],yvalues[1]) - Math.min(yvalues[0],yvalues[1]))/2); break; case "TopRight":
|
216
|
-
pixelfraction = 1-(((1-xvalues[0])*(1-yvalues[1]))/2); break; case "TopBottom":
|
217
|
-
pixelfraction = Math.min(xvalues[0],xvalues[1]) + ((Math.max(xvalues[0],xvalues[1]) - Math.min(xvalues[0],xvalues[1]))/2); break; case "LeftBottom":
|
218
|
-
pixelfraction = (yvalues[0]*xvalues[1])/2; break; default:
|
219
|
-
pixelfraction = 1;}
|
220
|
-
return pixelfraction;}
|
221
|
-
function rgb2Hex(rgbColour)
|
222
|
-
{ try{ var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue);}
|
223
|
-
catch(e){ alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");}
|
224
|
-
return hexColour;}
|
225
|
-
function rgb2Array(rgbColour)
|
226
|
-
{ var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray;}
|
227
|
-
function setOpacity(obj, opacity)
|
228
|
-
{ opacity = (opacity == 100)?99.999:opacity; if(isSafari && obj.tagName != "IFRAME")
|
229
|
-
{ var rgbArray = rgb2Array(obj.style.backgroundColor); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";}
|
230
|
-
else if(typeof(obj.style.opacity) != "undefined")
|
231
|
-
{ obj.style.opacity = opacity/100;}
|
232
|
-
else if(typeof(obj.style.MozOpacity) != "undefined")
|
233
|
-
{ obj.style.MozOpacity = opacity/100;}
|
234
|
-
else if(typeof(obj.style.filter) != "undefined")
|
235
|
-
{ obj.style.filter = "alpha(opacity:" + opacity + ")";}
|
236
|
-
else if(typeof(obj.style.KHTMLOpacity) != "undefined")
|
237
|
-
{ obj.style.KHTMLOpacity = opacity/100;}
|
238
|
-
}
|
239
|
-
function inArray(array, value)
|
240
|
-
{ for(var i = 0; i < array.length; i++){ if (array[i] === value) return i;}
|
241
|
-
return false;}
|
242
|
-
function inArrayKey(array, value)
|
243
|
-
{ for(key in array){ if(key === value) return true;}
|
244
|
-
return false;}
|
245
|
-
function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true;}
|
246
|
-
else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r;}
|
247
|
-
else { elm['on' + evType] = fn;}
|
248
|
-
}
|
249
|
-
function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture); return true;} else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType, fn); return r;} else { alert("Handler could not be removed");}
|
250
|
-
}
|
251
|
-
function format_colour(colour)
|
252
|
-
{ var returnColour = "#ffffff"; if(colour != "" && colour != "transparent")
|
253
|
-
{ if(colour.substr(0, 3) == "rgb")
|
254
|
-
{ returnColour = rgb2Hex(colour);}
|
255
|
-
else if(colour.length == 4)
|
256
|
-
{ returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4);}
|
257
|
-
else
|
258
|
-
{ returnColour = colour;}
|
259
|
-
}
|
260
|
-
return returnColour;}
|
261
|
-
function get_style(obj, property, propertyNS)
|
262
|
-
{ try
|
263
|
-
{ if(obj.currentStyle)
|
264
|
-
{ var returnVal = eval("obj.currentStyle." + property);}
|
265
|
-
else
|
266
|
-
{ if(isSafari && obj.style.display == "none")
|
267
|
-
{ obj.style.display = ""; var wasHidden = true;}
|
268
|
-
var returnVal = document.defaultView.getComputedStyle(obj, '').getPropertyValue(propertyNS); if(isSafari && wasHidden)
|
269
|
-
{ obj.style.display = "none";}
|
270
|
-
}
|
271
|
-
}
|
272
|
-
catch(e)
|
273
|
-
{ }
|
274
|
-
return returnVal;}
|
275
|
-
function getElementsByClass(searchClass, node, tag)
|
276
|
-
{ var classElements = new Array(); if(node == null)
|
277
|
-
node = document; if(tag == null)
|
278
|
-
tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)"); for (i = 0, j = 0; i < elsLen; i++)
|
279
|
-
{ if(pattern.test(els[i].className))
|
280
|
-
{ classElements[j] = els[i]; j++;}
|
281
|
-
}
|
282
|
-
return classElements;}
|
283
|
-
function newCurvyError(errorMessage)
|
284
|
-
{ return new Error("curvyCorners Error:\n" + errorMessage)
|
285
|
-
}
|
@@ -1,129 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #E1D1F1;
|
3
|
-
font-family: "Georgia", sans-serif;
|
4
|
-
font-size: 16px;
|
5
|
-
line-height: 1.6em;
|
6
|
-
padding: 1.6em 0 0 0;
|
7
|
-
color: #333;
|
8
|
-
}
|
9
|
-
h1, h2, h3, h4, h5, h6 {
|
10
|
-
color: #444;
|
11
|
-
}
|
12
|
-
h1 {
|
13
|
-
font-family: sans-serif;
|
14
|
-
font-weight: normal;
|
15
|
-
font-size: 4em;
|
16
|
-
line-height: 0.8em;
|
17
|
-
letter-spacing: -0.1ex;
|
18
|
-
margin: 5px;
|
19
|
-
}
|
20
|
-
li {
|
21
|
-
padding: 0;
|
22
|
-
margin: 0;
|
23
|
-
list-style-type: square;
|
24
|
-
}
|
25
|
-
a {
|
26
|
-
color: #5E5AFF;
|
27
|
-
background-color: #DAC;
|
28
|
-
font-weight: normal;
|
29
|
-
text-decoration: underline;
|
30
|
-
}
|
31
|
-
blockquote {
|
32
|
-
font-size: 90%;
|
33
|
-
font-style: italic;
|
34
|
-
border-left: 1px solid #111;
|
35
|
-
padding-left: 1em;
|
36
|
-
}
|
37
|
-
.caps {
|
38
|
-
font-size: 80%;
|
39
|
-
}
|
40
|
-
|
41
|
-
#main {
|
42
|
-
width: 45em;
|
43
|
-
padding: 0;
|
44
|
-
margin: 0 auto;
|
45
|
-
}
|
46
|
-
.coda {
|
47
|
-
text-align: right;
|
48
|
-
color: #77f;
|
49
|
-
font-size: smaller;
|
50
|
-
}
|
51
|
-
|
52
|
-
table {
|
53
|
-
font-size: 90%;
|
54
|
-
line-height: 1.4em;
|
55
|
-
color: #ff8;
|
56
|
-
background-color: #111;
|
57
|
-
padding: 2px 10px 2px 10px;
|
58
|
-
border-style: dashed;
|
59
|
-
}
|
60
|
-
|
61
|
-
th {
|
62
|
-
color: #fff;
|
63
|
-
}
|
64
|
-
|
65
|
-
td {
|
66
|
-
padding: 2px 10px 2px 10px;
|
67
|
-
}
|
68
|
-
|
69
|
-
.success {
|
70
|
-
color: #0CC52B;
|
71
|
-
}
|
72
|
-
|
73
|
-
.failed {
|
74
|
-
color: #E90A1B;
|
75
|
-
}
|
76
|
-
|
77
|
-
.unknown {
|
78
|
-
color: #995000;
|
79
|
-
}
|
80
|
-
pre, code {
|
81
|
-
font-family: monospace;
|
82
|
-
font-size: 90%;
|
83
|
-
line-height: 1.4em;
|
84
|
-
color: #ff8;
|
85
|
-
background-color: #111;
|
86
|
-
padding: 2px 10px 2px 10px;
|
87
|
-
}
|
88
|
-
.comment { color: #aaa; font-style: italic; }
|
89
|
-
.keyword { color: #eff; font-weight: bold; }
|
90
|
-
.punct { color: #eee; font-weight: bold; }
|
91
|
-
.symbol { color: #0bb; }
|
92
|
-
.string { color: #6b4; }
|
93
|
-
.ident { color: #ff8; }
|
94
|
-
.constant { color: #66f; }
|
95
|
-
.regex { color: #ec6; }
|
96
|
-
.number { color: #F99; }
|
97
|
-
.expr { color: #227; }
|
98
|
-
|
99
|
-
#version {
|
100
|
-
float: right;
|
101
|
-
text-align: right;
|
102
|
-
font-family: sans-serif;
|
103
|
-
font-weight: normal;
|
104
|
-
background-color: #B3ABFF;
|
105
|
-
color: #141331;
|
106
|
-
padding: 15px 20px 10px 20px;
|
107
|
-
margin: 0 auto;
|
108
|
-
margin-top: 15px;
|
109
|
-
border: 3px solid #141331;
|
110
|
-
}
|
111
|
-
|
112
|
-
#version .numbers {
|
113
|
-
display: block;
|
114
|
-
font-size: 4em;
|
115
|
-
line-height: 0.8em;
|
116
|
-
letter-spacing: -0.1ex;
|
117
|
-
}
|
118
|
-
|
119
|
-
#version a {
|
120
|
-
text-decoration: none;
|
121
|
-
color: #141331;
|
122
|
-
background-color: #B3ABFF;
|
123
|
-
}
|
124
|
-
|
125
|
-
.clickable {
|
126
|
-
cursor: pointer;
|
127
|
-
cursor: hand;
|
128
|
-
}
|
129
|
-
|
data/website/template.rhtml
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>
|
8
|
-
<%= title %>
|
9
|
-
</title>
|
10
|
-
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
-
<style>
|
12
|
-
|
13
|
-
</style>
|
14
|
-
<script type="text/javascript">
|
15
|
-
window.onload = function() {
|
16
|
-
settings = {
|
17
|
-
tl: { radius: 10 },
|
18
|
-
tr: { radius: 10 },
|
19
|
-
bl: { radius: 10 },
|
20
|
-
br: { radius: 10 },
|
21
|
-
antiAlias: true,
|
22
|
-
autoPad: true,
|
23
|
-
validTags: ["div"]
|
24
|
-
}
|
25
|
-
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
-
versionBox.applyCornersToAll();
|
27
|
-
}
|
28
|
-
</script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="main">
|
32
|
-
|
33
|
-
<h1><%= title %></h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "<%= download %>"; return false'>
|
35
|
-
Get Version
|
36
|
-
<a href="<%= download %>" class="numbers"><%= version %></a>
|
37
|
-
</div>
|
38
|
-
<%= body %>
|
39
|
-
<p class="coda">
|
40
|
-
<a href="mailto:keisuke@rccn.com">Keisuke Minami</a>, <%= modified.pretty %><br>
|
41
|
-
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
42
|
-
</p>
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
46
|
-
|
47
|
-
</body>
|
48
|
-
</html>
|