aboutsummaryrefslogtreecommitdiffstats
path: root/extlib
diff options
context:
space:
mode:
Diffstat (limited to 'extlib')
-rw-r--r--extlib/README15
-rwxr-xr-xextlib/exif/EXIF.py219
-rw-r--r--extlib/exif/changes.txt131
-rw-r--r--extlib/freesound/audioprocessing.py2
-rw-r--r--extlib/html5shiv/html5shiv.js3
-rw-r--r--extlib/jquery/MIT-LICENSE.txt (renamed from extlib/html5shiv/MIT.txt)3
-rw-r--r--extlib/jquery/MIT.txt20
m---------extlib/pdf.js0
-rw-r--r--extlib/thingiview.js/LICENSE165
-rw-r--r--extlib/thingiview.js/Three.js202
-rw-r--r--extlib/thingiview.js/binaryReader.js126
-rw-r--r--extlib/thingiview.js/plane.js62
-rw-r--r--extlib/thingiview.js/stats.js2
-rw-r--r--extlib/thingiview.js/thingiloader.js318
-rw-r--r--extlib/thingiview.js/thingiview.js898
-rw-r--r--extlib/video-js/LGPLv3-LICENSE.txt165
-rw-r--r--extlib/video-js/demo.html23
-rw-r--r--extlib/video-js/video-js.css427
-rw-r--r--extlib/video-js/video-js.min.css2
-rw-r--r--extlib/video-js/video-js.pngbin7460 -> 8235 bytes
-rw-r--r--extlib/video-js/video-js.swfbin9612 -> 0 bytes
-rw-r--r--extlib/video-js/video.js3744
-rw-r--r--extlib/video-js/video.min.js4
23 files changed, 2263 insertions, 4268 deletions
diff --git a/extlib/README b/extlib/README
index c690beac..45ee5b46 100644
--- a/extlib/README
+++ b/extlib/README
@@ -17,7 +17,7 @@ unwittingly interfere with other software that depends on the
canonical release versions of those same libraries!
Forking upstream software for trivial reasons makes us bad citizens in
-the Open Source community and adds unnecessary heartache for our
+the Free Software community and adds unnecessary heartache for our
users. Don't make us "that" project.
@@ -63,6 +63,19 @@ FAQ
This is a last resort; consult with the rest of the dev group
before taking this radical step.
+:Q: What about submodules?
+
+:A: pdf.js is supplied as a submodule, and other software may use that too,
+ to add a new submodule:
+ git submodule add <git-repo-of-fun-project> extlib/fun-project
+
+ Use it just like a snapshotted extlib directory. When a new clone of mediagoblin
+ is made you need to run
+
+ git submodule init
+ git submodule update
+
+ As noted in HackingHowto
Thanks
======
diff --git a/extlib/exif/EXIF.py b/extlib/exif/EXIF.py
index ed4192af..a188154e 100755
--- a/extlib/exif/EXIF.py
+++ b/extlib/exif/EXIF.py
@@ -1,8 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Library to extract EXIF information from digital camera image files
-# http://sourceforge.net/projects/exif-py/
+#
+# Library to extract EXIF information from digital camera image files.
+# https://github.com/ianare/exif-py
+#
#
# VERSION 1.1.0
#
@@ -22,7 +24,6 @@
#
# These 2 are useful when you are retrieving a large list of images
#
-#
# To return an error on invalid tags,
# pass the -s or --strict argument, or as
# tags = EXIF.process_file(f, strict=True)
@@ -48,7 +49,7 @@
# 'EXIF DateTimeOriginal', 'Image Orientation', 'MakerNote FocusMode'
#
# Copyright (c) 2002-2007 Gene Cash All rights reserved
-# Copyright (c) 2007-2008 Ianaré Sévi All rights reserved
+# Copyright (c) 2007-2012 Ianaré Sévi All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -102,7 +103,7 @@ def make_string_uc(seq):
seq = seq[8:]
# Of course, this is only correct if ASCII, and the standard explicitly
# allows JIS and Unicode.
- return make_string(seq)
+ return make_string( make_string(seq) )
# field type descriptions as (length, abbreviation, full name) tuples
FIELD_TYPES = (
@@ -171,9 +172,9 @@ EXIF_TAGS = {
3: 'Rotated 180',
4: 'Mirrored vertical',
5: 'Mirrored horizontal then rotated 90 CCW',
- 6: 'Rotated 90 CW',
+ 6: 'Rotated 90 CCW',
7: 'Mirrored horizontal then rotated 90 CW',
- 8: 'Rotated 90 CCW'}),
+ 8: 'Rotated 90 CW'}),
0x0115: ('SamplesPerPixel', ),
0x0116: ('RowsPerStrip', ),
0x0117: ('StripByteCounts', ),
@@ -251,40 +252,54 @@ EXIF_TAGS = {
2: 'CenterWeightedAverage',
3: 'Spot',
4: 'MultiSpot',
- 5: 'Pattern'}),
+ 5: 'Pattern',
+ 6: 'Partial',
+ 255: 'other'}),
0x9208: ('LightSource',
{0: 'Unknown',
1: 'Daylight',
2: 'Fluorescent',
- 3: 'Tungsten',
- 9: 'Fine Weather',
- 10: 'Flash',
+ 3: 'Tungsten (incandescent light)',
+ 4: 'Flash',
+ 9: 'Fine weather',
+ 10: 'Cloudy weather',
11: 'Shade',
- 12: 'Daylight Fluorescent',
- 13: 'Day White Fluorescent',
- 14: 'Cool White Fluorescent',
- 15: 'White Fluorescent',
- 17: 'Standard Light A',
- 18: 'Standard Light B',
- 19: 'Standard Light C',
+ 12: 'Daylight fluorescent (D 5700 - 7100K)',
+ 13: 'Day white fluorescent (N 4600 - 5400K)',
+ 14: 'Cool white fluorescent (W 3900 - 4500K)',
+ 15: 'White fluorescent (WW 3200 - 3700K)',
+ 17: 'Standard light A',
+ 18: 'Standard light B',
+ 19: 'Standard light C',
20: 'D55',
21: 'D65',
22: 'D75',
- 255: 'Other'}),
+ 23: 'D50',
+ 24: 'ISO studio tungsten',
+ 255: 'other light source',}),
0x9209: ('Flash',
- {0: 'No',
- 1: 'Fired',
- 5: 'Fired (?)', # no return sensed
- 7: 'Fired (!)', # return sensed
- 9: 'Fill Fired',
- 13: 'Fill Fired (?)',
- 15: 'Fill Fired (!)',
- 16: 'Off',
- 24: 'Auto Off',
- 25: 'Auto Fired',
- 29: 'Auto Fired (?)',
- 31: 'Auto Fired (!)',
- 32: 'Not Available'}),
+ {0: 'Flash did not fire',
+ 1: 'Flash fired',
+ 5: 'Strobe return light not detected',
+ 7: 'Strobe return light detected',
+ 9: 'Flash fired, compulsory flash mode',
+ 13: 'Flash fired, compulsory flash mode, return light not detected',
+ 15: 'Flash fired, compulsory flash mode, return light detected',
+ 16: 'Flash did not fire, compulsory flash mode',
+ 24: 'Flash did not fire, auto mode',
+ 25: 'Flash fired, auto mode',
+ 29: 'Flash fired, auto mode, return light not detected',
+ 31: 'Flash fired, auto mode, return light detected',
+ 32: 'No flash function',
+ 65: 'Flash fired, red-eye reduction mode',
+ 69: 'Flash fired, red-eye reduction mode, return light not detected',
+ 71: 'Flash fired, red-eye reduction mode, return light detected',
+ 73: 'Flash fired, compulsory flash mode, red-eye reduction mode',
+ 77: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
+ 79: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
+ 89: 'Flash fired, auto mode, red-eye reduction mode',
+ 93: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
+ 95: 'Flash fired, auto mode, return light detected, red-eye reduction mode'}),
0x920A: ('FocalLength', ),
0x9214: ('SubjectArea', ),
0x927C: ('MakerNote', ),
@@ -410,7 +425,10 @@ GPS_TAGS = {
0x0018: ('GPSDestBearing', ),
0x0019: ('GPSDestDistanceRef', ),
0x001A: ('GPSDestDistance', ),
+ 0x001B: ('GPSProcessingMethod', ),
+ 0x001C: ('GPSAreaInformation', ),
0x001D: ('GPSDate', ),
+ 0x001E: ('GPSDifferential', ),
}
# Ignore these tags when quick processing
@@ -1231,10 +1249,17 @@ class IFD_Tag:
return self.printable
def __repr__(self):
- return '(0x%04X) %s=%s @ %d' % (self.tag,
+ try:
+ s= '(0x%04X) %s=%s @ %d' % (self.tag,
FIELD_TYPES[self.field_type][2],
self.printable,
self.field_offset)
+ except:
+ s= '(%s) %s=%s @ %s' % (str(self.tag),
+ FIELD_TYPES[self.field_type][2],
+ self.printable,
+ str(self.field_offset))
+ return s
# class that handles an EXIF header
class EXIF_header:
@@ -1283,7 +1308,11 @@ class EXIF_header:
# return pointer to next IFD
def next_IFD(self, ifd):
entries=self.s2n(ifd, 2)
- return self.s2n(ifd+2+12*entries, 4)
+ next_ifd = self.s2n(ifd+2+12*entries, 4)
+ if next_ifd == ifd:
+ return 0
+ else:
+ return next_ifd
# return list of IFDs in header
def list_IFDs(self):
@@ -1348,14 +1377,15 @@ class EXIF_header:
# special case: null-terminated ASCII string
# XXX investigate
# sometimes gets too big to fit in int value
- if count != 0 and count < (2**31):
- self.file.seek(self.offset + offset)
- values = self.file.read(count)
- #print values
- # Drop any garbage after a null.
- values = values.split('\x00', 1)[0]
- else:
- values = ''
+ if count != 0: # and count < (2**31): # 2E31 is hardware dependant. --gd
+ try:
+ self.file.seek(self.offset + offset)
+ values = self.file.read(count)
+ #print values
+ # Drop any garbage after a null.
+ values = values.split('\x00', 1)[0]
+ except OverflowError:
+ values = ''
else:
values = []
signed = (field_type in [6, 8, 9, 10])
@@ -1567,7 +1597,8 @@ class EXIF_header:
dict=MAKERNOTE_CANON_TAGS)
for i in (('MakerNote Tag 0x0001', MAKERNOTE_CANON_TAG_0x001),
('MakerNote Tag 0x0004', MAKERNOTE_CANON_TAG_0x004)):
- self.canon_decode_tag(self.tags[i[0]].values, i[1])
+ if i[0] in self.tags:
+ self.canon_decode_tag(self.tags[i[0]].values, i[1])
return
@@ -1613,26 +1644,124 @@ def process_file(f, stop_tag='UNDEF', details=True, strict=False, debug=False):
offset = 0
elif data[0:2] == '\xFF\xD8':
# it's a JPEG file
+ if debug: print "JPEG format recognized data[0:2] == '0xFFD8'."
+ base = 2
while data[2] == '\xFF' and data[6:10] in ('JFIF', 'JFXX', 'OLYM', 'Phot'):
+ if debug: print "data[2] == 0xxFF data[3]==%x and data[6:10] = %s"%(ord(data[3]),data[6:10])
length = ord(data[4])*256+ord(data[5])
+ if debug: print "Length offset is",length
f.read(length-8)
# fake an EXIF beginning of file
+ # I don't think this is used. --gd
data = '\xFF\x00'+f.read(10)
fake_exif = 1
- if data[2] == '\xFF' and data[6:10] == 'Exif':
+ if base>2:
+ if debug: print "added to base "
+ base = base + length + 4 -2
+ else:
+ if debug: print "added to zero "
+ base = length + 4
+ if debug: print "Set segment base to",base
+
+ # Big ugly patch to deal with APP2 (or other) data coming before APP1
+ f.seek(0)
+ data = f.read(base+4000) # in theory, this could be insufficient since 64K is the maximum size--gd
+ # base = 2
+ while 1:
+ if debug: print "Segment base 0x%X" % base
+ if data[base:base+2]=='\xFF\xE1':
+ # APP1
+ if debug: print "APP1 at base",hex(base)
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if data[base+4:base+8] == "Exif":
+ if debug: print "Decrement base by",2,"to get to pre-segment header (for compatibility with later code)"
+ base = base-2
+ break
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ elif data[base:base+2]=='\xFF\xE0':
+ # APP0
+ if debug: print "APP0 at base",hex(base)
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ elif data[base:base+2]=='\xFF\xE2':
+ # APP2
+ if debug: print "APP2 at base",hex(base)
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ elif data[base:base+2]=='\xFF\xEE':
+ # APP14
+ if debug: print "APP14 Adobe segment at base",hex(base)
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ print "There is useful EXIF-like data here, but we have no parser for it."
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ elif data[base:base+2]=='\xFF\xDB':
+ if debug: print "JPEG image data at base",hex(base),"No more segments are expected."
+ # sys.exit(0)
+ break
+ elif data[base:base+2]=='\xFF\xD8':
+ # APP12
+ if debug: print "FFD8 segment at base",hex(base)
+ if debug: print "Got",hex(ord(data[base])), hex(ord(data[base+1])),"and", data[4+base:10+base], "instead."
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ elif data[base:base+2]=='\xFF\xEC':
+ # APP12
+ if debug: print "APP12 XMP (Ducky) or Pictureinfo segment at base",hex(base)
+ if debug: print "Got",hex(ord(data[base])), hex(ord(data[base+1])),"and", data[4+base:10+base], "instead."
+ if debug: print "Length",hex(ord(data[base+2])), hex(ord(data[base+3]))
+ if debug: print "Code",data[base+4:base+8]
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ print "There is useful EXIF-like data here (quality, comment, copyright), but we have no parser for it."
+ base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ else:
+ try:
+ if debug: print "Unexpected/unhandled segment type or file content."
+ if debug: print "Got",hex(ord(data[base])), hex(ord(data[base+1])),"and", data[4+base:10+base], "instead."
+ if debug: print "Increment base by",ord(data[base+2])*256+ord(data[base+3])+2
+ except: pass
+ try: base=base+ord(data[base+2])*256+ord(data[base+3])+2
+ except: pass
+
+ f.seek(base+12)
+ if data[2+base] == '\xFF' and data[6+base:10+base] == 'Exif':
# detected EXIF header
offset = f.tell()
endian = f.read(1)
+ #HACK TEST: endian = 'M'
+ elif data[2+base] == '\xFF' and data[6+base:10+base+1] == 'Ducky':
+ # detected Ducky header.
+ if debug: print "EXIF-like header (normally 0xFF and code):",hex(ord(data[2+base])) , "and", data[6+base:10+base+1]
+ offset = f.tell()
+ endian = f.read(1)
+ elif data[2+base] == '\xFF' and data[6+base:10+base+1] == 'Adobe':
+ # detected APP14 (Adobe)
+ if debug: print "EXIF-like header (normally 0xFF and code):",hex(ord(data[2+base])) , "and", data[6+base:10+base+1]
+ offset = f.tell()
+ endian = f.read(1)
else:
# no EXIF information
+ if debug: print "No EXIF header expected data[2+base]==0xFF and data[6+base:10+base]===Exif (or Duck)"
+ if debug: print " but got",hex(ord(data[2+base])) , "and", data[6+base:10+base+1]
return {}
else:
# file format not recognized
+ if debug: print "file format not recognized"
return {}
# deal with the EXIF info we found
if debug:
- print {'I': 'Intel', 'M': 'Motorola'}[endian], 'format'
+ print "Endian format is ",endian
+ print {'I': 'Intel', 'M': 'Motorola', '\x01':'Adobe Ducky', 'd':'XMP/Adobe unknown' }[endian], 'format'
hdr = EXIF_header(f, endian, offset, fake_exif, strict, debug)
ifd_list = hdr.list_IFDs()
ctr = 0
diff --git a/extlib/exif/changes.txt b/extlib/exif/changes.txt
new file mode 100644
index 00000000..d1b18e6c
--- /dev/null
+++ b/extlib/exif/changes.txt
@@ -0,0 +1,131 @@
+~ EXIF.py Changelog ~
+
+2012-11-30 - Gregory Dudek (date of merge).
+Patches and changes:
+ Overflow error fixes added (related to 2**31 size)
+ GPS tags added.
+
+2012-09-26 - Ianaré Sévi
+Merge patches:
+ Add GPS tags
+ Add better endian debug info
+
+2012-06-13 - Ianaré Sévi
+Merge patches:
+ Support malformed last IFD by fhats
+ Light source, Flash and Metering mode dictionaries update by gryfik
+
+2008-07-31 - Ianaré Sévi
+Wikipedia Commons hunt for suitable test case images,
+testing new code additions.
+
+2008-07-09 - Stephen H. Olson
+Fix a problem with reading MakerNotes out of NEF files.
+Add some more Nikon MakerNote tags.
+
+2008-07-08 - Stephen H. Olson
+An error check for large tags totally borked MakerNotes.
+ With Nikon anyway, valid MakerNotes can be pretty big.
+Add error check for a crash caused by nikon_ev_bias being
+ called with the wrong args.
+Drop any garbage after a null character in string
+ (patch from Andrew McNabb <amcnabb@google.com>).
+
+2008-02-12 - Ianaré Sévi
+Fix crash on invalid MakerNote
+Fix crash on huge Makernote (temp fix)
+Add printIM tag 0xC4A5, needs decoding info
+Add 0x9C9B-F range of tags
+Add a bunch of tag definitions from:
+ http://owl.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
+Add 'strict' variable and command line option
+
+2008-01-18 - Gunter Ohrner
+Add 'GPSDate' tag
+
+2007-12-12 - Ianaré Sévi
+Fix quick option on certain image types
+Add note on tag naming in documentation
+
+2007-11-30 - Ianaré Sévi
+Changed -s option to -t
+Put changelog into separate file
+
+2007-10-28 - Ianaré Sévi
+Merged changes from MoinMoin:ReimarBauer
+Added command line option for debug, stop
+processing on tag.
+
+2007-09-27 - Ianaré Sévi
+Add some Olympus Makernote tags.
+
+2007-09-26 - Stephen H. Olson
+Don't error out on invalid Olympus 'SpecialMode'.
+Add a few more Olympus/Minolta tags.
+
+2007-09-22 - Stephen H. Olson
+Don't error on invalid string
+Improved Nikon MakerNote support
+
+2007-05-03 - Martin Stone <mj_stone@users.sourceforge.net>
+Fix for inverted detailed flag and Photoshop header
+
+2007-03-24 - Ianaré Sévi
+Can now ignore MakerNotes Tags for faster processing.
+
+2007-01-18 - Ianaré Sévi <ianare@gmail.com>
+Fixed a couple errors and assuming maintenance of the library.
+
+2006-08-04 MoinMoin:ReimarBauer
+Added an optional parameter name to process_file and dump_IFD. Using this parameter the
+loop is breaked after that tag_name is processed.
+some PEP8 changes
+
+---------------------------- original notices -------------------------
+
+Contains code from "exifdump.py" originally written by Thierry Bousch
+<bousch@topo.math.u-psud.fr> and released into the public domain.
+
+Updated and turned into general-purpose library by Gene Cash
+
+Patch Contributors:
+* Simon J. Gerraty <sjg@crufty.net>
+s2n fix & orientation decode
+* John T. Riedl <riedl@cs.umn.edu>
+Added support for newer Nikon type 3 Makernote format for D70 and some
+other Nikon cameras.
+* Joerg Schaefer <schaeferj@gmx.net>
+Fixed subtle bug when faking an EXIF header, which affected maker notes
+using relative offsets, and a fix for Nikon D100.
+
+1999-08-21 TB Last update by Thierry Bousch to his code.
+
+2002-01-17 CEC Discovered code on web.
+ Commented everything.
+ Made small code improvements.
+ Reformatted for readability.
+
+2002-01-19 CEC Added ability to read TIFFs and JFIF-format JPEGs.
+ Added ability to extract JPEG formatted thumbnail.
+ Added ability to read GPS IFD (not tested).
+ Converted IFD data structure to dictionaries indexed by
+ tag name.
+ Factored into library returning dictionary of IFDs plus
+ thumbnail, if any.
+
+2002-01-20 CEC Added MakerNote processing logic.
+ Added Olympus MakerNote.
+ Converted data structure to single-level dictionary, avoiding
+ tag name collisions by prefixing with IFD name. This makes
+ it much easier to use.
+2002-01-23 CEC Trimmed nulls from end of string values.
+
+2002-01-25 CEC Discovered JPEG thumbnail in Olympus TIFF MakerNote.
+
+2002-01-26 CEC Added ability to extract TIFF thumbnails.
+ Added Nikon, Fujifilm, Casio MakerNotes.
+
+2003-11-30 CEC Fixed problem with canon_decode_tag() not creating an
+ IFD_Tag() object.
+
+2004-02-15 CEC Finally fixed bit shift warning by converting Y to 0L.
diff --git a/extlib/freesound/audioprocessing.py b/extlib/freesound/audioprocessing.py
index c1dfe2eb..2c2b35b5 100644
--- a/extlib/freesound/audioprocessing.py
+++ b/extlib/freesound/audioprocessing.py
@@ -20,7 +20,7 @@
# Bram de Jong <bram.dejong at domain.com where domain in gmail>
# 2012, Joar Wandborg <first name at last name dot se>
-import Image, ImageDraw, ImageColor #@UnresolvedImport
+from PIL import Image, ImageDraw, ImageColor #@UnresolvedImport
from functools import partial
import math
import numpy
diff --git a/extlib/html5shiv/html5shiv.js b/extlib/html5shiv/html5shiv.js
deleted file mode 100644
index 8de0ff54..00000000
--- a/extlib/html5shiv/html5shiv.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// HTML5 Shiv v3 | @jon_neal @afarkas @rem | MIT/GPL2 Licensed
-// Uncompressed source: https://github.com/aFarkas/html5shiv
-(function(a,b){var c=function(a){return a.innerHTML="<x-element></x-element>",a.childNodes.length===1}(b.createElement("a")),d=function(a,b,c){return b.appendChild(a),(c=(c?c(a):a.currentStyle).display)&&b.removeChild(a)&&c==="block"}(b.createElement("nav"),b.documentElement,a.getComputedStyle),e={elements:"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),shivDocument:function(a){a=a||b;if(a.documentShived)return;a.documentShived=!0;var f=a.createElement,g=a.createDocumentFragment,h=a.getElementsByTagName("head")[0],i=function(a){f(a)};c||(e.elements.join(" ").replace(/\w+/g,i),a.createElement=function(a){var b=f(a);return b.canHaveChildren&&e.shivDocument(b.document),b},a.createDocumentFragment=function(){return e.shivDocument(g())});if(!d&&h){var j=f("div");j.innerHTML=["x<style>","article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}","audio{display:none}","canvas,video{display:inline-block;*display:inline;*zoom:1}","[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}","mark{background:#FF0;color:#000}","</style>"].join(""),h.insertBefore(j.lastChild,h.firstChild)}return a}};e.shivDocument(b),a.html5=e})(this,document) \ No newline at end of file
diff --git a/extlib/html5shiv/MIT.txt b/extlib/jquery/MIT-LICENSE.txt
index 5a2aeb47..957f26d3 100644
--- a/extlib/html5shiv/MIT.txt
+++ b/extlib/jquery/MIT-LICENSE.txt
@@ -1,4 +1,5 @@
-Copyright (c) <year> <copyright holders>
+Copyright 2013 jQuery Foundation and other contributors
+http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/extlib/jquery/MIT.txt b/extlib/jquery/MIT.txt
deleted file mode 100644
index 5a2aeb47..00000000
--- a/extlib/jquery/MIT.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) <year> <copyright holders>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/extlib/pdf.js b/extlib/pdf.js
new file mode 160000
+Subproject 369b81b63f560b5d729da26752ca541503d8151
diff --git a/extlib/thingiview.js/LICENSE b/extlib/thingiview.js/LICENSE
new file mode 100644
index 00000000..65c5ca88
--- /dev/null
+++ b/extlib/thingiview.js/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/extlib/thingiview.js/Three.js b/extlib/thingiview.js/Three.js
new file mode 100644
index 00000000..5c21380c
--- /dev/null
+++ b/extlib/thingiview.js/Three.js
@@ -0,0 +1,202 @@
+// Three.js r32 - http://github.com/mrdoob/three.js
+var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
+THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
+THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
+THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
+cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
+-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
+THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
+THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
+return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
+THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(h,o){return h.distance-o.distance});return g},intersectObject:function(a){function c(K,p,U,F){F=F.clone().subSelf(p);U=U.clone().subSelf(p);var f=K.clone().subSelf(p);K=F.dot(F);p=F.dot(U);F=F.dot(f);var j=U.dot(U);U=U.dot(f);f=1/(K*j-p*p);j=(j*F-p*U)*f;K=(K*U-p*F)*f;return j>0&&K>0&&j+K<1}var d,e,g,h,o,b,i,k,y,z,
+u,x=a.geometry,H=x.vertices,J=[];d=0;for(e=x.faces.length;d<e;d++){g=x.faces[d];z=this.origin.clone();u=this.direction.clone();h=a.matrix.multiplyVector3(H[g.a].position.clone());o=a.matrix.multiplyVector3(H[g.b].position.clone());b=a.matrix.multiplyVector3(H[g.c].position.clone());i=g instanceof THREE.Face4?a.matrix.multiplyVector3(H[g.d].position.clone()):null;k=a.rotationMatrix.multiplyVector3(g.normal.clone());y=u.dot(k);if(y<0){k=k.dot((new THREE.Vector3).sub(h,z))/y;z=z.addSelf(u.multiplyScalar(k));
+if(g instanceof THREE.Face3){if(c(z,h,o,b)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};J.push(g)}}else if(g instanceof THREE.Face4)if(c(z,h,o,i)||c(z,o,b,i)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};J.push(g)}}}return J}};
+THREE.Rectangle=function(){function a(){h=e-c;o=g-d}var c,d,e,g,h,o,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return o};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(i,k,y,z){b=false;c=i;d=k;e=y;g=z;a()};this.addPoint=function(i,k){if(b){b=false;c=i;d=k;e=i;g=k}else{c=c<i?c:i;d=d<k?d:k;e=e>i?e:i;g=g>k?
+g:k}a()};this.add3Points=function(i,k,y,z,u,x){if(b){b=false;c=i<y?i<u?i:u:y<u?y:u;d=k<z?k<x?k:x:z<x?z:x;e=i>y?i>u?i:u:y>u?y:u;g=k>z?k>x?k:x:z>x?z:x}else{c=i<y?i<u?i<c?i:c:u<c?u:c:y<u?y<c?y:c:u<c?u:c;d=k<z?k<x?k<d?k:d:x<d?x:d:z<x?z<d?z:d:x<d?x:d;e=i>y?i>u?i>e?i:e:u>e?u:e:y>u?y>e?y:e:u>e?u:e;g=k>z?k>x?k>g?k:g:x>g?x:g:z>x?z>g?z:g:x>g?x:g}a()};this.addRectangle=function(i){if(b){b=false;c=i.getLeft();d=i.getTop();e=i.getRight();g=i.getBottom()}else{c=c<i.getLeft()?c:i.getLeft();d=d<i.getTop()?d:i.getTop();
+e=e>i.getRight()?e:i.getRight();g=g>i.getBottom()?g:i.getBottom()}a()};this.inflate=function(i){c-=i;d-=i;e+=i;g+=i;a()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e<i.getRight()?e:i.getRight();g=g<i.getBottom()?g:i.getBottom();a()};this.instersects=function(i){return Math.min(e,i.getRight())-Math.max(c,i.getLeft())>=0&&Math.min(g,i.getBottom())-Math.max(d,i.getTop())>=0};this.empty=function(){b=true;g=e=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
+function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+h+", height: "+o+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
+THREE.Matrix4=function(a,c,d,e,g,h,o,b,i,k,y,z,u,x,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=o||0;this.n24=b||0;this.n31=i||0;this.n32=k||0;this.n33=y||1;this.n34=z||0;this.n41=u||0;this.n42=x||0;this.n43=H||0;this.n44=J||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,h,o,b,i,k,y,z,u,x,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=h;this.n23=o;this.n24=b;this.n31=i;this.n32=k;this.n33=y;this.n34=z;this.n41=u;this.n42=x;this.n43=H;this.n44=J;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,c).normalize();e.cross(d,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
+this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23*
+e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,h=a.n14,o=a.n21,b=a.n22,i=a.n23,k=a.n24,y=a.n31,
+z=a.n32,u=a.n33,x=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,U=c.n11,F=c.n12,f=c.n13,j=c.n14,q=c.n21,l=c.n22,r=c.n23,C=c.n24,m=c.n31,t=c.n32,v=c.n33,s=c.n34,n=c.n41,E=c.n42,A=c.n43,O=c.n44;this.n11=d*U+e*q+g*m+h*n;this.n12=d*F+e*l+g*t+h*E;this.n13=d*f+e*r+g*v+h*A;this.n14=d*j+e*C+g*s+h*O;this.n21=o*U+b*q+i*m+k*n;this.n22=o*F+b*l+i*t+k*E;this.n23=o*f+b*r+i*v+k*A;this.n24=o*j+b*C+i*s+k*O;this.n31=y*U+z*q+u*m+x*n;this.n32=y*F+z*l+u*t+x*E;this.n33=y*f+z*r+u*v+x*A;this.n34=y*j+z*C+u*s+x*O;this.n41=H*U+J*q+
+K*m+p*n;this.n42=H*F+J*l+K*t+p*E;this.n43=H*f+J*r+K*v+p*A;this.n44=H*j+J*C+K*s+p*O;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,o=this.n22,b=this.n23,i=this.n24,k=this.n31,y=this.n32,z=this.n33,u=this.n34,x=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,U=a.n21,F=a.n31,f=a.n41,j=a.n12,q=a.n22,l=a.n32,r=a.n42,C=a.n13,m=a.n23,t=a.n33,v=a.n43,s=a.n14,n=a.n24,E=a.n34;a=a.n44;this.n11=c*p+d*U+e*F+g*f;this.n12=c*j+d*q+e*l+g*r;this.n13=c*C+d*m+e*t+g*
+v;this.n14=c*s+d*n+e*E+g*a;this.n21=h*p+o*U+b*F+i*f;this.n22=h*j+o*q+b*l+i*r;this.n23=h*C+o*m+b*t+i*v;this.n24=h*s+o*n+b*E+i*a;this.n31=k*p+y*U+z*F+u*f;this.n32=k*j+y*q+z*l+u*r;this.n33=k*C+y*m+z*t+u*v;this.n34=k*s+y*n+z*E+u*a;this.n41=x*p+H*U+J*F+K*f;this.n42=x*j+H*q+J*l+K*r;this.n43=x*C+H*m+J*t+K*v;this.n44=x*s+H*n+J*E+K*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=
+a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,g=this.n21,h=this.n22,o=this.n23,b=this.n24,i=this.n31,k=this.n32,y=this.n33,z=this.n34,u=this.n41,x=this.n42,H=this.n43,J=this.n44;return e*o*k*u-d*b*k*u-e*h*y*u+c*b*y*u+d*h*z*u-c*o*z*u-e*o*i*x+d*b*i*x+e*g*y*x-a*b*y*x-d*g*z*x+a*o*z*x+e*h*i*H-c*b*i*H-e*g*k*H+a*b*k*H+c*g*z*H-a*h*z*H-d*h*i*J+c*o*i*J+d*g*k*J-a*o*k*J-c*g*y*J+a*h*y*J},transpose:function(){function a(c,d,
+e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;
+a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
+Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,h=a.x,o=a.y,b=a.z,i=g*h,k=g*o;this.set(i*h+d,i*o-e*b,i*b+e*o,0,i*o+e*b,k*o+d,k*b-e*h,0,i*b-e*o,k*b+e*h,g*b*b+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
+THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
+THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,o=a.n22,b=a.n23,i=a.n24,k=a.n31,y=a.n32,z=a.n33,u=a.n34,x=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=b*u*H-i*z*H+i*y*J-o*u*J-b*y*K+o*z*K;p.n12=g*z*H-e*u*H-g*y*J+d*u*J+e*y*K-d*z*K;p.n13=e*i*H-g*b*H+g*o*J-d*i*J-e*o*K+d*b*K;p.n14=g*b*y-e*i*y-g*o*z+d*i*z+e*o*u-d*b*u;p.n21=i*z*x-b*u*x-i*k*J+h*u*J+b*k*K-h*z*K;p.n22=e*u*x-g*z*x+g*k*J-c*u*J-e*k*K+c*z*K;p.n23=g*b*x-e*i*x-g*h*J+c*i*J+e*h*K-c*b*K;p.n24=e*i*k-g*b*k+
+g*h*z-c*i*z-e*h*u+c*b*u;p.n31=o*u*x-i*y*x+i*k*H-h*u*H-o*k*K+h*y*K;p.n32=g*y*x-d*u*x-g*k*H+c*u*H+d*k*K-c*y*K;p.n33=e*i*x-g*o*x+g*h*H-c*i*H-d*h*K+c*o*K;p.n34=g*o*k-d*i*k-g*h*y+c*i*y+d*h*u-c*o*u;p.n41=b*y*x-o*z*x-b*k*H+h*z*H+o*k*J-h*y*J;p.n42=d*z*x-e*y*x+e*k*H-c*z*H-d*k*J+c*y*J;p.n43=e*o*x-d*b*x-e*h*H+c*b*H+d*h*J-c*o*J;p.n44=d*b*k-e*o*k+e*h*y-c*b*y-d*h*z+c*o*z;p.multiplyScalar(1/a.determinant());return p};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],h=c[6]*c[1]-c[2]*c[5],o=-c[10]*c[4]+c[6]*c[8],b=c[10]*c[0]-c[2]*c[8],i=-c[6]*c[0]+c[2]*c[4],k=c[9]*c[4]-c[5]*c[8],y=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*o+c[2]*k;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*h;d[3]=c*o;d[4]=c*b;d[5]=c*i;d[6]=c*k;d[7]=c*y;d[8]=c*z;return a};
+THREE.Matrix4.makeFrustum=function(a,c,d,e,g,h){var o,b,i;o=new THREE.Matrix4;b=2*g/(c-a);i=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(h+g)/(h-g);g=-2*h*g/(h-g);o.n11=b;o.n12=0;o.n13=a;o.n14=0;o.n21=0;o.n22=i;o.n23=d;o.n24=0;o.n31=0;o.n32=0;o.n33=e;o.n34=g;o.n41=0;o.n42=0;o.n43=-1;o.n44=0;return o};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,c,d,e,g,h){var o,b,i,k;o=new THREE.Matrix4;b=c-a;i=d-e;k=h-g;a=(c+a)/b;d=(d+e)/i;g=(h+g)/k;o.n11=2/b;o.n12=0;o.n13=0;o.n14=-a;o.n21=0;o.n22=2/i;o.n23=0;o.n24=-d;o.n31=0;o.n32=0;o.n33=-2/k;o.n34=-g;o.n41=0;o.n42=0;o.n43=0;o.n44=1;return o};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
+THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
+THREE.Face4=function(a,c,d,e,g,h){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
+THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
+THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,g,h,o,b=new THREE.Vector3,i=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];if(a&&h.vertexNormals.length){b.set(0,0,0);c=0;for(d=h.normal.length;c<d;c++)b.addSelf(h.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];o=this.vertices[h.c];b.sub(o.position,
+d.position);i.sub(c.position,d.position);b.crossSelf(i)}b.isZero()||b.normalize();h.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
+c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(s,n,E,A,O,N,G){h=s.vertices[n].position;o=s.vertices[E].position;b=s.vertices[A].position;i=g[O];k=g[N];y=g[G];z=o.x-h.x;u=b.x-h.x;x=o.y-h.y;H=b.y-h.y;
+J=o.z-h.z;K=b.z-h.z;p=k.u-i.u;U=y.u-i.u;F=k.v-i.v;f=y.v-i.v;j=1/(p*f-U*F);r.set((f*z-F*u)*j,(f*x-F*H)*j,(f*J-F*K)*j);C.set((p*u-U*z)*j,(p*H-U*x)*j,(p*K-U*J)*j);q[n].addSelf(r);q[E].addSelf(r);q[A].addSelf(r);l[n].addSelf(C);l[E].addSelf(C);l[A].addSelf(C)}var c,d,e,g,h,o,b,i,k,y,z,u,x,H,J,K,p,U,F,f,j,q=[],l=[],r=new THREE.Vector3,C=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,v=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){q[c]=new THREE.Vector3;l[c]=new THREE.Vector3}c=0;
+for(d=this.faces.length;c<d;c++){e=this.faces[c];g=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){v.copy(this.vertices[c].normal);e=q[c];m.copy(e);m.subSelf(v.multiplyScalar(v.dot(e))).normalize();t.cross(this.vertices[c].normal,e);e=t.dot(l[c]);e=e<0?-1:1;this.vertices[c].tangent.set(m.x,m.y,m.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(y){var z=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?z.push("undefined"):z.push(y[c].toString());return z.join("_")}var c,d,e,g,h,o,b,i,k={};e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];
+o=h.materials;b=a(o);if(k[b]==undefined)k[b]={hash:b,counter:0};i=k[b].hash+"_"+k[b].counter;if(this.geometryChunks[i]==undefined)this.geometryChunks[i]={faces:[],materials:o,vertices:0};h=h instanceof THREE.Face3?3:4;if(this.geometryChunks[i].vertices+h>65535){k[b].counter+=1;i=k[b].hash+"_"+k[b].counter;if(this.geometryChunks[i]==undefined)this.geometryChunks[i]={faces:[],materials:o,vertices:0}}this.geometryChunks[i].faces.push(e);this.geometryChunks[i].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
+THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
+this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
+THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
+THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
+THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0};
+THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
+THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
+THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
+THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
+THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
+undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
+THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+
+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
+undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=
+this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
+undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
+THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
+THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
+THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
+undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
+THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
+THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
+THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
+THREE.Texture=function(a,c,d,e,g,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter};
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
+THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
+THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
+THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
+THREE.Projector=function(){function a(l,r){return r.z-l.z}function c(l,r){var C=0,m=1,t=l.z+l.w,v=r.z+r.w,s=-l.z+l.w,n=-r.z+r.w;if(t>=0&&v>=0&&s>=0&&n>=0)return true;else if(t<0&&v<0||s<0&&n<0)return false;else{if(t<0)C=Math.max(C,t/(t-v));else if(v<0)m=Math.min(m,t/(t-v));if(s<0)C=Math.max(C,s/(s-n));else if(n<0)m=Math.min(m,s/(s-n));if(m<C)return false;else{l.lerpSelf(r,C);r.lerpSelf(l,1-m);return true}}}var d,e,g=[],h,o,b,i=[],k,y,z=[],u,x,H=[],J=new THREE.Vector4,K=new THREE.Vector4,p=new THREE.Matrix4,
+U=new THREE.Matrix4,F=[],f=new THREE.Vector4,j=new THREE.Vector4,q;this.projectObjects=function(l,r,C){var m=[],t,v;e=0;p.multiply(r.projectionMatrix,r.matrix);F[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);F[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);F[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);F[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);F[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
+p.n33,p.n44-p.n34);F[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);r=0;for(t=F.length;r<t;r++){v=F[r];v.divideScalar(Math.sqrt(v.x*v.x+v.y*v.y+v.z*v.z))}t=l.objects;l=0;for(r=t.length;l<r;l++){v=t[l];var s;if(!(s=!v.visible)){if(s=v instanceof THREE.Mesh){a:{s=void 0;for(var n=v.position,E=-v.geometry.boundingSphere.radius*Math.max(v.scale.x,Math.max(v.scale.y,v.scale.z)),A=0;A<6;A++){s=F[A].x*n.x+F[A].y*n.y+F[A].z*n.z+F[A].w;if(s<=E){s=false;break a}}s=true}s=!s}s=s}if(!s){d=
+g[e]=g[e]||new THREE.RenderableObject;J.copy(v.position);p.multiplyVector3(J);d.object=v;d.z=J.z;m.push(d);e++}}C&&m.sort(a);return m};this.projectScene=function(l,r,C){var m=[],t=r.near,v=r.far,s,n,E,A,O,N,G,W,P,I,L,V,S,w,M,Q;b=y=x=0;r.autoUpdateMatrix&&r.updateMatrix();p.multiply(r.projectionMatrix,r.matrix);N=this.projectObjects(l,r,true);l=0;for(s=N.length;l<s;l++){G=N[l].object;if(G.visible){G.autoUpdateMatrix&&G.updateMatrix();W=G.matrix;P=G.rotationMatrix;I=G.materials;L=G.overdraw;if(G instanceof
+THREE.Mesh){V=G.geometry;S=V.vertices;n=0;for(E=S.length;n<E;n++){w=S[n];w.positionWorld.copy(w.position);W.multiplyVector3(w.positionWorld);A=w.positionScreen;A.copy(w.positionWorld);p.multiplyVector4(A);A.x/=A.w;A.y/=A.w;w.__visible=A.z>t&&A.z<v}V=V.faces;n=0;for(E=V.length;n<E;n++){w=V[n];if(w instanceof THREE.Face3){A=S[w.a];O=S[w.b];M=S[w.c];if(A.__visible&&O.__visible&&M.__visible)if(G.doubleSided||G.flipSided!=(M.positionScreen.x-A.positionScreen.x)*(O.positionScreen.y-A.positionScreen.y)-
+(M.positionScreen.y-A.positionScreen.y)*(O.positionScreen.x-A.positionScreen.x)<0){h=i[b]=i[b]||new THREE.RenderableFace3;h.v1.positionWorld.copy(A.positionWorld);h.v2.positionWorld.copy(O.positionWorld);h.v3.positionWorld.copy(M.positionWorld);h.v1.positionScreen.copy(A.positionScreen);h.v2.positionScreen.copy(O.positionScreen);h.v3.positionScreen.copy(M.positionScreen);h.normalWorld.copy(w.normal);P.multiplyVector3(h.normalWorld);h.centroidWorld.copy(w.centroid);W.multiplyVector3(h.centroidWorld);
+h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);M=w.vertexNormals;q=h.vertexNormalsWorld;A=0;for(O=M.length;A<O;A++){Q=q[A]=q[A]||new THREE.Vector3;Q.copy(M[A]);P.multiplyVector3(Q)}h.z=h.centroidScreen.z;h.meshMaterials=I;h.faceMaterials=w.materials;h.overdraw=L;if(G.geometry.uvs[n]){h.uvs[0]=G.geometry.uvs[n][0];h.uvs[1]=G.geometry.uvs[n][1];h.uvs[2]=G.geometry.uvs[n][2]}m.push(h);b++}}else if(w instanceof THREE.Face4){A=S[w.a];O=S[w.b];M=S[w.c];Q=S[w.d];if(A.__visible&&
+O.__visible&&M.__visible&&Q.__visible)if(G.doubleSided||G.flipSided!=((Q.positionScreen.x-A.positionScreen.x)*(O.positionScreen.y-A.positionScreen.y)-(Q.positionScreen.y-A.positionScreen.y)*(O.positionScreen.x-A.positionScreen.x)<0||(O.positionScreen.x-M.positionScreen.x)*(Q.positionScreen.y-M.positionScreen.y)-(O.positionScreen.y-M.positionScreen.y)*(Q.positionScreen.x-M.positionScreen.x)<0)){h=i[b]=i[b]||new THREE.RenderableFace3;h.v1.positionWorld.copy(A.positionWorld);h.v2.positionWorld.copy(O.positionWorld);
+h.v3.positionWorld.copy(Q.positionWorld);h.v1.positionScreen.copy(A.positionScreen);h.v2.positionScreen.copy(O.positionScreen);h.v3.positionScreen.copy(Q.positionScreen);h.normalWorld.copy(w.normal);P.multiplyVector3(h.normalWorld);h.centroidWorld.copy(w.centroid);W.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=I;h.faceMaterials=w.materials;h.overdraw=L;if(G.geometry.uvs[n]){h.uvs[0]=G.geometry.uvs[n][0];
+h.uvs[1]=G.geometry.uvs[n][1];h.uvs[2]=G.geometry.uvs[n][3]}m.push(h);b++;o=i[b]=i[b]||new THREE.RenderableFace3;o.v1.positionWorld.copy(O.positionWorld);o.v2.positionWorld.copy(M.positionWorld);o.v3.positionWorld.copy(Q.positionWorld);o.v1.positionScreen.copy(O.positionScreen);o.v2.positionScreen.copy(M.positionScreen);o.v3.positionScreen.copy(Q.positionScreen);o.normalWorld.copy(h.normalWorld);o.centroidWorld.copy(h.centroidWorld);o.centroidScreen.copy(h.centroidScreen);o.z=o.centroidScreen.z;o.meshMaterials=
+I;o.faceMaterials=w.materials;o.overdraw=L;if(G.geometry.uvs[n]){o.uvs[0]=G.geometry.uvs[n][1];o.uvs[1]=G.geometry.uvs[n][2];o.uvs[2]=G.geometry.uvs[n][3]}m.push(o);b++}}}}else if(G instanceof THREE.Line){U.multiply(p,W);S=G.geometry.vertices;w=S[0];w.positionScreen.copy(w.position);U.multiplyVector4(w.positionScreen);n=1;for(E=S.length;n<E;n++){A=S[n];A.positionScreen.copy(A.position);U.multiplyVector4(A.positionScreen);O=S[n-1];f.copy(A.positionScreen);j.copy(O.positionScreen);if(c(f,j)){f.multiplyScalar(1/
+f.w);j.multiplyScalar(1/j.w);k=z[y]=z[y]||new THREE.RenderableLine;k.v1.positionScreen.copy(f);k.v2.positionScreen.copy(j);k.z=Math.max(f.z,j.z);k.materials=G.materials;m.push(k);y++}}}else if(G instanceof THREE.Particle){K.set(G.position.x,G.position.y,G.position.z,1);p.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){u=H[x]=H[x]||new THREE.RenderableParticle;u.x=K.x/K.w;u.y=K.y/K.w;u.z=K.z;u.rotation=G.rotation.z;u.scale.x=G.scale.x*Math.abs(u.x-(K.x+r.projectionMatrix.n11)/(K.w+r.projectionMatrix.n14));
+u.scale.y=G.scale.y*Math.abs(u.y-(K.y+r.projectionMatrix.n22)/(K.w+r.projectionMatrix.n24));u.materials=G.materials;m.push(u);x++}}}}C&&m.sort(a);return m};this.unprojectVector=function(l,r){var C=THREE.Matrix4.makeInvert(r.matrix);C.multiplySelf(THREE.Matrix4.makeInvert(r.projectionMatrix));C.multiplyVector3(l);return l}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,h;this.domElement=document.createElement("div");this.setSize=function(o,b){d=o;e=b;g=d/2;h=e/2};this.render=function(o,b){var i,k,y,z,u,x,H,J;a=c.projectScene(o,b);i=0;for(k=a.length;i<k;i++){u=a[i];if(u instanceof THREE.RenderableParticle){H=u.x*g+g;J=u.y*h+h;y=0;for(z=u.material.length;y<z;y++){x=u.material[y];if(x instanceof THREE.ParticleDOMMaterial){x=x.domElement;x.style.left=H+"px";x.style.top=J+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ea){if(u!=ea)k.globalAlpha=u=ea}function c(ea){if(x!=ea){switch(ea){case THREE.NormalBlending:k.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:k.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:k.globalCompositeOperation="darker"}x=ea}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),h,o,b,i,k=g.getContext("2d"),y=new THREE.Color(0),z=0,u=1,x=0,H=null,J=null,K=1,p,U,F,f,j,q,l,r,C,m=new THREE.Color,
+t=new THREE.Color,v=new THREE.Color,s=new THREE.Color,n=new THREE.Color,E,A,O,N,G,W,P,I,L,V=new THREE.Rectangle,S=new THREE.Rectangle,w=new THREE.Rectangle,M=false,Q=new THREE.Color,da=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ja=Math.PI*2,Y=new THREE.Vector3,qa,ka,fa,ha,sa,ua,va=16;qa=document.createElement("canvas");qa.width=qa.height=2;ka=qa.getContext("2d");ka.fillStyle="rgba(0,0,0,1)";ka.fillRect(0,0,2,2);fa=ka.getImageData(0,0,2,2);ha=fa.data;sa=document.createElement("canvas");sa.width=
+sa.height=va;ua=sa.getContext("2d");ua.translate(-va/2,-va/2);ua.scale(va,va);va--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ea,ra){h=ea;o=ra;b=h/2;i=o/2;g.width=h;g.height=o;V.set(-b,-i,b,i);u=1;x=0;J=H=null;K=1};this.setClearColor=function(ea,ra){y.setHex(ea);z=ra;S.set(-b,-i,b,i);k.setTransform(1,0,0,-1,b,i);this.clear()};this.clear=function(){if(!S.isEmpty()){S.inflate(1);S.minSelf(V);if(y.hex==0&&z==0)k.clearRect(S.getX(),S.getY(),S.getWidth(),
+S.getHeight());else{c(THREE.NormalBlending);a(1);k.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+z+")";k.fillRect(S.getX(),S.getY(),S.getWidth(),S.getHeight())}S.empty()}};this.render=function(ea,ra){function Ma(B){var X,T,D,R=B.lights;da.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);B=0;for(X=R.length;B<X;B++){T=R[B];D=T.color;if(T instanceof THREE.AmbientLight){da.r+=D.r;da.g+=D.g;da.b+=D.b}else if(T instanceof THREE.DirectionalLight){ba.r+=D.r;ba.g+=
+D.g;ba.b+=D.b}else if(T instanceof THREE.PointLight){Z.r+=D.r;Z.g+=D.g;Z.b+=D.b}}}function Aa(B,X,T,D){var R,$,ca,ga,ia=B.lights;B=0;for(R=ia.length;B<R;B++){$=ia[B];ca=$.color;ga=$.intensity;if($ instanceof THREE.DirectionalLight){$=T.dot($.position)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=T.dot(Y)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}}}function Na(B,X,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var D,
+R,$,ca,ga,ia;if(T instanceof THREE.ParticleBasicMaterial){if(T.map){ca=T.map;ga=ca.width>>1;ia=ca.height>>1;R=X.scale.x*b;$=X.scale.y*i;T=R*ga;D=$*ia;w.set(B.x-T,B.y-D,B.x+T,B.y+D);if(V.instersects(w)){k.save();k.translate(B.x,B.y);k.rotate(-X.rotation);k.scale(R,-$);k.translate(-ga,-ia);k.drawImage(ca,0,0);k.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(M){Q.r=da.r+ba.r+Z.r;Q.g=da.g+ba.g+Z.g;Q.b=da.b+ba.b+Z.b;m.r=T.color.r*Q.r;m.g=T.color.g*Q.g;m.b=T.color.b*Q.b;m.updateStyleString()}else m.__styleString=
+T.color.__styleString;T=X.scale.x*b;D=X.scale.y*i;w.set(B.x-T,B.y-D,B.x+T,B.y+D);if(V.instersects(w)){R=m.__styleString;if(J!=R)k.fillStyle=J=R;k.save();k.translate(B.x,B.y);k.rotate(-X.rotation);k.scale(T,D);k.beginPath();k.arc(0,0,1,0,ja,true);k.closePath();k.fill();k.restore()}}}}function Oa(B,X,T,D){if(D.opacity!=0){a(D.opacity);c(D.blending);k.beginPath();k.moveTo(B.positionScreen.x,B.positionScreen.y);k.lineTo(X.positionScreen.x,X.positionScreen.y);k.closePath();if(D instanceof THREE.LineBasicMaterial){m.__styleString=
+D.color.__styleString;B=D.linewidth;if(K!=B)k.lineWidth=K=B;B=m.__styleString;if(H!=B)k.strokeStyle=H=B;k.stroke();w.inflate(D.linewidth*2)}}}function Ia(B,X,T,D,R,$){if(R.opacity!=0){a(R.opacity);c(R.blending);f=B.positionScreen.x;j=B.positionScreen.y;q=X.positionScreen.x;l=X.positionScreen.y;r=T.positionScreen.x;C=T.positionScreen.y;k.beginPath();k.moveTo(f,j);k.lineTo(q,l);k.lineTo(r,C);k.lineTo(f,j);k.closePath();if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.image.loaded&&R.map.mapping instanceof
+THREE.UVMapping&&xa(f,j,q,l,r,C,R.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(R.env_map){if(R.env_map.image.loaded)if(R.env_map.mapping instanceof THREE.SphericalReflectionMapping){B=ra.matrix;Y.copy(D.vertexNormalsWorld[0]);N=(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;G=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[1]);W=(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;P=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[2]);I=
+(Y.x*B.n11+Y.y*B.n12+Y.z*B.n13)*0.5+0.5;L=-(Y.x*B.n21+Y.y*B.n22+Y.z*B.n23)*0.5+0.5;xa(f,j,q,l,r,C,R.env_map.image,N,G,W,P,I,L)}}else R.wireframe?Ba(R.color.__styleString,R.wireframe_linewidth):Ca(R.color.__styleString);else if(R instanceof THREE.MeshLambertMaterial){if(R.map&&!R.wireframe){R.map.mapping instanceof THREE.UVMapping&&xa(f,j,q,l,r,C,R.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(M)if(!R.wireframe&&R.shading==THREE.SmoothShading&&
+D.vertexNormalsWorld.length==3){t.r=v.r=s.r=da.r;t.g=v.g=s.g=da.g;t.b=v.b=s.b=da.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],t);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],v);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],s);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f,j,q,l,r,C,O,0,0,1,0,0,1)}else{Q.r=da.r;Q.g=da.g;Q.b=da.b;Aa($,D.centroidWorld,D.normalWorld,Q);m.r=R.color.r*Q.r;m.g=R.color.g*Q.g;m.b=R.color.b*Q.b;m.updateStyleString();R.wireframe?Ba(m.__styleString,
+R.wireframe_linewidth):Ca(m.__styleString)}else R.wireframe?Ba(R.color.__styleString,R.wireframe_linewidth):Ca(R.color.__styleString)}else if(R instanceof THREE.MeshDepthMaterial){E=ra.near;A=ra.far;t.r=t.g=t.b=1-Ea(B.positionScreen.z,E,A);v.r=v.g=v.b=1-Ea(X.positionScreen.z,E,A);s.r=s.g=s.b=1-Ea(T.positionScreen.z,E,A);n.r=(v.r+s.r)*0.5;n.g=(v.g+s.g)*0.5;n.b=(v.b+s.b)*0.5;O=Ja(t,v,s,n);xa(f,j,q,l,r,C,O,0,0,1,0,0,1)}else if(R instanceof THREE.MeshNormalMaterial){m.r=Fa(D.normalWorld.x);m.g=Fa(D.normalWorld.y);
+m.b=Fa(D.normalWorld.z);m.updateStyleString();R.wireframe?Ba(m.__styleString,R.wireframe_linewidth):Ca(m.__styleString)}}}function Ba(B,X){if(H!=B)k.strokeStyle=H=B;if(K!=X)k.lineWidth=K=X;k.stroke();w.inflate(X*2)}function Ca(B){if(J!=B)k.fillStyle=J=B;k.fill()}function xa(B,X,T,D,R,$,ca,ga,ia,na,la,oa,ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;T-=B;D-=X;R-=B;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*T-la*R)*pa;la=(ya*D-la*$)*pa;T=(na*R-
+oa*T)*pa;D=(na*$-oa*D)*pa;B=B-ta*ga-T*ia;X=X-la*ga-D*ia;k.save();k.transform(ta,la,T,D,B,X);k.clip();k.drawImage(ca,0,0);k.restore()}function Ja(B,X,T,D){var R=~~(B.r*255),$=~~(B.g*255);B=~~(B.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(T.r*255),na=~~(T.g*255);T=~~(T.b*255);var la=~~(D.r*255),oa=~~(D.g*255);D=~~(D.b*255);ha[0]=R<0?0:R>255?255:R;ha[1]=$<0?0:$>255?255:$;ha[2]=B<0?0:B>255?255:B;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia<
+0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=T<0?0:T>255?255:T;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=D<0?0:D>255?255:D;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(B,X,T){B=(B-X)/(T-X);return B*B*(3-2*B)}function Fa(B){B=(B+1)*0.5;return B<0?0:B>1?1:B}function Ga(B,X){var T=X.x-B.x,D=X.y-B.y,R=1/Math.sqrt(T*T+D*D);T*=R;D*=R;X.x+=T;X.y+=D;B.x-=T;B.y-=D}var Da,Ka,aa,ma,wa,Ha,La,za;k.setTransform(1,0,0,-1,b,i);this.autoClear&&this.clear();d=e.projectScene(ea,
+ra,this.sortElements);(M=ea.lights.length>0)&&Ma(ea);Da=0;for(Ka=d.length;Da<Ka;Da++){aa=d[Da];w.empty();if(aa instanceof THREE.RenderableParticle){p=aa;p.x*=b;p.y*=i;ma=0;for(wa=aa.materials.length;ma<wa;ma++)Na(p,aa,aa.materials[ma],ea)}else if(aa instanceof THREE.RenderableLine){p=aa.v1;U=aa.v2;p.positionScreen.x*=b;p.positionScreen.y*=i;U.positionScreen.x*=b;U.positionScreen.y*=i;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(U.positionScreen.x,U.positionScreen.y);if(V.instersects(w)){ma=
+0;for(wa=aa.materials.length;ma<wa;)Oa(p,U,aa,aa.materials[ma++],ea)}}else if(aa instanceof THREE.RenderableFace3){p=aa.v1;U=aa.v2;F=aa.v3;p.positionScreen.x*=b;p.positionScreen.y*=i;U.positionScreen.x*=b;U.positionScreen.y*=i;F.positionScreen.x*=b;F.positionScreen.y*=i;if(aa.overdraw){Ga(p.positionScreen,U.positionScreen);Ga(U.positionScreen,F.positionScreen);Ga(F.positionScreen,p.positionScreen)}w.add3Points(p.positionScreen.x,p.positionScreen.y,U.positionScreen.x,U.positionScreen.y,F.positionScreen.x,
+F.positionScreen.y);if(V.instersects(w)){ma=0;for(wa=aa.meshMaterials.length;ma<wa;){za=aa.meshMaterials[ma++];if(za instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(za=aa.faceMaterials[Ha++])&&Ia(p,U,F,aa,za,ea)}else Ia(p,U,F,aa,za,ea)}}}S.addRectangle(w)}k.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(N,G,W){var P,I,L,V;P=0;for(I=N.lights.length;P<I;P++){L=N.lights[P];if(L instanceof THREE.DirectionalLight){V=G.normalWorld.dot(L.position)*L.intensity;if(V>0){W.r+=L.color.r*V;W.g+=L.color.g*V;W.b+=L.color.b*V}}else if(L instanceof THREE.PointLight){C.sub(L.position,G.centroidWorld);C.normalize();V=G.normalWorld.dot(C)*L.intensity;if(V>0){W.r+=L.color.r*V;W.g+=L.color.g*V;W.b+=L.color.b*V}}}}function c(N,G,W,P,I,L){s=e(n++);s.setAttribute("d","M "+N.positionScreen.x+
+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(U){f.r=j.r;f.g=j.g;f.b=j.b;a(L,P,f);F.r=I.color.r*f.r;F.g=I.color.g*f.g;F.b=I.color.b*f.b;F.updateStyleString()}else F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){r=1-I.__2near/(I.__farPlusNear-P.z*I.__farMinusNear);
+F.setRGB(r,r,r)}else I instanceof THREE.MeshNormalMaterial&&F.setRGB(g(P.normalWorld.x),g(P.normalWorld.y),g(P.normalWorld.z));I.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(s)}function d(N,G,W,P,I,L,V){s=e(n++);s.setAttribute("d",
+"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshLambertMaterial)if(U){f.r=j.r;f.g=j.g;f.b=j.b;a(V,I,f);F.r=L.color.r*f.r;F.g=L.color.g*f.g;F.b=L.color.b*f.b;F.updateStyleString()}else F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshDepthMaterial){r=
+1-L.__2near/(L.__farPlusNear-I.z*L.__farMinusNear);F.setRGB(r,r,r)}else L instanceof THREE.MeshNormalMaterial&&F.setRGB(g(I.normalWorld.x),g(I.normalWorld.y),g(I.normalWorld.z));L.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+L.wireframe_linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframe_linecap+"; stroke-linejoin: "+L.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+L.opacity);b.appendChild(s)}
+function e(N){if(m[N]==null){m[N]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&m[N].setAttribute("shape-rendering","crispEdges");return m[N]}return m[N]}function g(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var h=null,o=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,k,y,z,u,x,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,U=false,F=new THREE.Color(16777215),f=new THREE.Color(16777215),j=new THREE.Color(0),q=new THREE.Color(0),
+l=new THREE.Color(0),r,C=new THREE.Vector3,m=[],t=[],v=[],s,n,E,A,O=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":O=1;break;case "low":O=0}};this.setSize=function(N,G){i=N;k=G;y=i/2;z=k/2;b.setAttribute("viewBox",-y+" "+-z+" "+i+" "+k);b.setAttribute("width",i);b.setAttribute("height",k);K.set(-y,-z,y,z)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(N,G){var W,P,
+I,L,V,S,w,M;this.autoClear&&this.clear();h=o.projectScene(N,G,this.sortElements);A=E=n=0;if(U=N.lights.length>0){w=N.lights;j.setRGB(0,0,0);q.setRGB(0,0,0);l.setRGB(0,0,0);W=0;for(P=w.length;W<P;W++){I=w[W];L=I.color;if(I instanceof THREE.AmbientLight){j.r+=L.r;j.g+=L.g;j.b+=L.b}else if(I instanceof THREE.DirectionalLight){q.r+=L.r;q.g+=L.g;q.b+=L.b}else if(I instanceof THREE.PointLight){l.r+=L.r;l.g+=L.g;l.b+=L.b}}}W=0;for(P=h.length;W<P;W++){w=h[W];p.empty();if(w instanceof THREE.RenderableParticle){u=
+w;u.x*=y;u.y*=-z;I=0;for(L=w.materials.length;I<L;I++)if(M=w.materials[I]){V=u;S=w;M=M;var Q=E++;if(t[Q]==null){t[Q]=document.createElementNS("http://www.w3.org/2000/svg","circle");O==0&&t[Q].setAttribute("shape-rendering","crispEdges")}s=t[Q];s.setAttribute("cx",V.x);s.setAttribute("cy",V.y);s.setAttribute("r",S.scale.x*y);if(M instanceof THREE.ParticleCircleMaterial){if(U){f.r=j.r+q.r+l.r;f.g=j.g+q.g+l.g;f.b=j.b+q.b+l.b;F.r=M.color.r*f.r;F.g=M.color.g*f.g;F.b=M.color.b*f.b;F.updateStyleString()}else F=
+M.color;s.setAttribute("style","fill: "+F.__styleString)}b.appendChild(s)}}else if(w instanceof THREE.RenderableLine){u=w.v1;x=w.v2;u.positionScreen.x*=y;u.positionScreen.y*=-z;x.positionScreen.x*=y;x.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(x.positionScreen.x,x.positionScreen.y);if(K.instersects(p)){I=0;for(L=w.materials.length;I<L;)if(M=w.materials[I++]){V=u;S=x;M=M;Q=A++;if(v[Q]==null){v[Q]=document.createElementNS("http://www.w3.org/2000/svg","line");O==
+0&&v[Q].setAttribute("shape-rendering","crispEdges")}s=v[Q];s.setAttribute("x1",V.positionScreen.x);s.setAttribute("y1",V.positionScreen.y);s.setAttribute("x2",S.positionScreen.x);s.setAttribute("y2",S.positionScreen.y);if(M instanceof THREE.LineBasicMaterial){F.__styleString=M.color.__styleString;s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin);b.appendChild(s)}}}}else if(w instanceof
+THREE.RenderableFace3){u=w.v1;x=w.v2;H=w.v3;u.positionScreen.x*=y;u.positionScreen.y*=-z;x.positionScreen.x*=y;x.positionScreen.y*=-z;H.positionScreen.x*=y;H.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(x.positionScreen.x,x.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(K.instersects(p)){I=0;for(L=w.meshMaterials.length;I<L;){M=w.meshMaterials[I++];if(M instanceof THREE.MeshFaceMaterial){V=0;for(S=w.faceMaterials.length;V<S;)(M=w.faceMaterials[V++])&&
+c(u,x,H,w,M,N)}else M&&c(u,x,H,w,M,N)}}}else if(w instanceof THREE.RenderableFace4){u=w.v1;x=w.v2;H=w.v3;J=w.v4;u.positionScreen.x*=y;u.positionScreen.y*=-z;x.positionScreen.x*=y;x.positionScreen.y*=-z;H.positionScreen.x*=y;H.positionScreen.y*=-z;J.positionScreen.x*=y;J.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(x.positionScreen.x,x.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(J.positionScreen.x,J.positionScreen.y);if(K.instersects(p)){I=
+0;for(L=w.meshMaterials.length;I<L;){M=w.meshMaterials[I++];if(M instanceof THREE.MeshFaceMaterial){V=0;for(S=w.faceMaterials.length;V<S;)(M=w.faceMaterials[V++])&&d(u,x,H,J,w,M,N)}else M&&d(u,x,H,J,w,M,N)}}}}}};
+THREE.WebGLRenderer=function(a){function c(f,j){f.fragment_shader=j.fragment_shader;f.vertex_shader=j.vertex_shader;f.uniforms=Uniforms.clone(j.uniforms)}function d(f,j){f.uniforms.color.value.setRGB(f.color.r*f.opacity,f.color.g*f.opacity,f.color.b*f.opacity);f.uniforms.opacity.value=f.opacity;f.uniforms.map.texture=f.map;f.uniforms.env_map.texture=f.env_map;f.uniforms.reflectivity.value=f.reflectivity;f.uniforms.refraction_ratio.value=f.refraction_ratio;f.uniforms.combine.value=f.combine;f.uniforms.useRefract.value=
+f.env_map&&f.env_map.mapping instanceof THREE.CubeRefractionMapping;if(j){f.uniforms.fogColor.value.setHex(j.color.hex);if(j instanceof THREE.Fog){f.uniforms.fogNear.value=j.near;f.uniforms.fogFar.value=j.far}else if(j instanceof THREE.FogExp2)f.uniforms.fogDensity.value=j.density}}function e(f,j){f.uniforms.color.value.setRGB(f.color.r*f.opacity,f.color.g*f.opacity,f.color.b*f.opacity);f.uniforms.opacity.value=f.opacity;if(j){f.uniforms.fogColor.value.setHex(j.color.hex);if(j instanceof THREE.Fog){f.uniforms.fogNear.value=
+j.near;f.uniforms.fogFar.value=j.far}else if(j instanceof THREE.FogExp2)f.uniforms.fogDensity.value=j.density}}function g(f,j){var q;if(f=="fragment")q=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")q=b.createShader(b.VERTEX_SHADER);b.shaderSource(q,j);b.compileShader(q);if(!b.getShaderParameter(q,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(q));return null}return q}function h(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
+case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
+case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var o=document.createElement("canvas"),b,i=null,k=null,y=new THREE.Matrix4,z,u=new Float32Array(16),x=new Float32Array(16),H=new Float32Array(16),J=new Float32Array(9),
+K=new Float32Array(16),p=true,U=new THREE.Color(0),F=0;if(a){if(a.antialias!==undefined)p=a.antialias;a.clearColor!==undefined&&U.setHex(a.clearColor);if(a.clearAlpha!==undefined)F=a.clearAlpha}this.domElement=o;this.autoClear=true;(function(f,j,q){try{b=o.getContext("experimental-webgl",{antialias:f})}catch(l){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);
+b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,q)})(p,U,F);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){o.width=f;o.height=j;b.viewport(0,0,o.width,o.height)};this.setClearColor=function(f,j){var q=new THREE.Color(f);b.clearColor(q.r,q.g,q.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
+function(f,j){var q,l,r,C=0,m=0,t=0,v,s,n,E=this.lights,A=E.directional.colors,O=E.directional.positions,N=E.point.colors,G=E.point.positions,W=0,P=0;q=0;for(l=j.length;q<l;q++){r=j[q];v=r.color;s=r.position;n=r.intensity;if(r instanceof THREE.AmbientLight){C+=v.r;m+=v.g;t+=v.b}else if(r instanceof THREE.DirectionalLight){A[W*3]=v.r*n;A[W*3+1]=v.g*n;A[W*3+2]=v.b*n;O[W*3]=s.x;O[W*3+1]=s.y;O[W*3+2]=s.z;W+=1}else if(r instanceof THREE.PointLight){N[P*3]=v.r*n;N[P*3+1]=v.g*n;N[P*3+2]=v.b*n;G[P*3]=s.x;
+G[P*3+1]=s.y;G[P*3+2]=s.z;P+=1}}E.point.length=P;E.directional.length=W;E.ambient[0]=C;E.ambient[1]=m;E.ambient[2]=t};this.createParticleBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLNormalBuffer=b.createBuffer();f.__webGLTangentBuffer=b.createBuffer();f.__webGLUVBuffer=
+b.createBuffer();f.__webGLFaceBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(f){var j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__lineArray=new Uint16Array(j);f.__webGLLineCount=j};this.initMeshBuffers=function(f,j){var q,l,r=0,C=0,m=0,t=j.geometry.faces,v=f.faces;q=0;for(l=v.length;q<l;q++){fi=v[q];face=t[fi];if(face instanceof THREE.Face3){r+=3;C+=1;m+=3}else if(face instanceof THREE.Face4){r+=4;C+=2;m+=4}}f.__vertexArray=new Float32Array(r*
+3);f.__normalArray=new Float32Array(r*3);f.__tangentArray=new Float32Array(r*4);f.__uvArray=new Float32Array(r*2);f.__faceArray=new Uint16Array(C*3);f.__lineArray=new Uint16Array(m*2);r=false;q=0;for(l=j.materials.length;q<l;q++){t=j.materials[q];if(t instanceof THREE.MeshFaceMaterial){t=0;for(v=f.materials.length;t<v;t++)if(f.materials[t]&&f.materials[t].shading!=undefined&&f.materials[t].shading==THREE.SmoothShading){r=true;break}}else if(t&&t.shading!=undefined&&t.shading==THREE.SmoothShading){r=
+true;break}if(r)break}f.__needsSmoothNormals=r;f.__webGLFaceCount=C*3;f.__webGLLineCount=m*2};this.setMeshBuffers=function(f,j,q,l,r,C,m,t){var v,s,n,E,A,O,N,G,W,P=0,I=0,L=0,V=0,S=0,w=0,M=0,Q=f.__vertexArray,da=f.__uvArray,ba=f.__normalArray,Z=f.__tangentArray,ja=f.__faceArray,Y=f.__lineArray,qa=f.__needsSmoothNormals,ka=j.geometry,fa=ka.vertices,ha=f.faces,sa=ka.faces,ua=ka.uvs;j=0;for(v=ha.length;j<v;j++){s=ha[j];n=sa[s];s=ua[s];E=n.vertexNormals;A=n.normal;if(n instanceof THREE.Face3){if(l){O=
+fa[n.a].position;N=fa[n.b].position;G=fa[n.c].position;Q[I]=O.x;Q[I+1]=O.y;Q[I+2]=O.z;Q[I+3]=N.x;Q[I+4]=N.y;Q[I+5]=N.z;Q[I+6]=G.x;Q[I+7]=G.y;Q[I+8]=G.z;I+=9}if(t&&ka.hasTangents){O=fa[n.a].tangent;N=fa[n.b].tangent;G=fa[n.c].tangent;Z[w]=O.x;Z[w+1]=O.y;Z[w+2]=O.z;Z[w+3]=O.w;Z[w+4]=N.x;Z[w+5]=N.y;Z[w+6]=N.z;Z[w+7]=N.w;Z[w+8]=G.x;Z[w+9]=G.y;Z[w+10]=G.z;Z[w+11]=G.w;w+=12}if(m)if(E.length==3&&qa)for(n=0;n<3;n++){A=E[n];ba[S]=A.x;ba[S+1]=A.y;ba[S+2]=A.z;S+=3}else for(n=0;n<3;n++){ba[S]=A.x;ba[S+1]=A.y;
+ba[S+2]=A.z;S+=3}if(C&&s)for(n=0;n<3;n++){E=s[n];da[L]=E.u;da[L+1]=E.v;L+=2}if(r){ja[V]=P;ja[V+1]=P+1;ja[V+2]=P+2;V+=3;Y[M]=P;Y[M+1]=P+1;Y[M+2]=P;Y[M+3]=P+2;Y[M+4]=P+1;Y[M+5]=P+2;M+=6;P+=3}}else if(n instanceof THREE.Face4){if(l){O=fa[n.a].position;N=fa[n.b].position;G=fa[n.c].position;W=fa[n.d].position;Q[I]=O.x;Q[I+1]=O.y;Q[I+2]=O.z;Q[I+3]=N.x;Q[I+4]=N.y;Q[I+5]=N.z;Q[I+6]=G.x;Q[I+7]=G.y;Q[I+8]=G.z;Q[I+9]=W.x;Q[I+10]=W.y;Q[I+11]=W.z;I+=12}if(t&&ka.hasTangents){O=fa[n.a].tangent;N=fa[n.b].tangent;
+G=fa[n.c].tangent;n=fa[n.d].tangent;Z[w]=O.x;Z[w+1]=O.y;Z[w+2]=O.z;Z[w+3]=O.w;Z[w+4]=N.x;Z[w+5]=N.y;Z[w+6]=N.z;Z[w+7]=N.w;Z[w+8]=G.x;Z[w+9]=G.y;Z[w+10]=G.z;Z[w+11]=G.w;Z[w+12]=n.x;Z[w+13]=n.y;Z[w+14]=n.z;Z[w+15]=n.w;w+=16}if(m)if(E.length==4&&qa)for(n=0;n<4;n++){A=E[n];ba[S]=A.x;ba[S+1]=A.y;ba[S+2]=A.z;S+=3}else for(n=0;n<4;n++){ba[S]=A.x;ba[S+1]=A.y;ba[S+2]=A.z;S+=3}if(C&&s)for(n=0;n<4;n++){E=s[n];da[L]=E.u;da[L+1]=E.v;L+=2}if(r){ja[V]=P;ja[V+1]=P+1;ja[V+2]=P+2;ja[V+3]=P;ja[V+4]=P+2;ja[V+5]=P+3;
+V+=6;Y[M]=P;Y[M+1]=P+1;Y[M+2]=P;Y[M+3]=P+3;Y[M+4]=P+1;Y[M+5]=P+2;Y[M+6]=P+2;Y[M+7]=P+3;M+=8;P+=4}}}if(l){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,Q,q)}if(m){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ba,q)}if(t&&ka.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,q)}if(C&&L>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,da,q)}if(r){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,q)}};this.setLineBuffers=function(f,j,q,l){var r,C,m=f.vertices,t=m.length,v=f.__vertexArray,s=f.__lineArray;if(q)for(q=0;q<t;q++){r=m[q].position;C=q*3;v[C]=r.x;v[C+1]=r.y;v[C+2]=r.z}if(l)for(q=0;q<t;q++)s[q]=q;b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,v,j);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);
+b.bufferData(b.ELEMENT_ARRAY_BUFFER,s,j)};this.setParticleBuffers=function(){};this.renderBuffer=function(f,j,q,l,r,C){var m,t,v,s;if(!l.program){if(l instanceof THREE.MeshDepthMaterial){c(l,THREE.ShaderLib.depth);l.uniforms.mNear.value=f.near;l.uniforms.mFar.value=f.far}else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial){c(l,THREE.ShaderLib.basic);d(l,q)}else if(l instanceof THREE.MeshLambertMaterial){c(l,THREE.ShaderLib.lambert);
+d(l,q)}else if(l instanceof THREE.MeshPhongMaterial){c(l,THREE.ShaderLib.phong);d(l,q)}else if(l instanceof THREE.LineBasicMaterial){c(l,THREE.ShaderLib.basic);e(l,q)}var n,E,A;n=s=t=0;for(E=j.length;n<E;n++){A=j[n];A instanceof THREE.DirectionalLight&&s++;A instanceof THREE.PointLight&&t++}if(t+s<=4){n=s;t=t}else{n=Math.ceil(4*s/(t+s));t=4-n}t={directional:n,point:t};s={fog:q,map:l.map,env_map:l.env_map,maxDirLights:t.directional,maxPointLights:t.point};t=l.fragment_shader;n=l.vertex_shader;E=b.createProgram();
+A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.fog?"#define USE_FOG":"",s.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");s=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,
+s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(E,g("fragment",A+t));b.attachShader(E,g("vertex",s+n));b.linkProgram(E);b.getProgramParameter(E,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
+b.getProgramParameter(E,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");E.uniforms={};E.attributes={};l.program=E;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(m in l.uniforms)t.push(m);m=l.program;n=0;for(E=t.length;n<E;n++){A=t[n];m.uniforms[A]=b.getUniformLocation(m,A)}m=l.program;t=["position","normal","uv","tangent"];n=0;for(E=t.length;n<E;n++){A=t[n];m.attributes[A]=b.getAttribLocation(m,A)}}m=l.program;if(m!=i){b.useProgram(m);
+i=m}this.loadCamera(m,f);this.loadMatrices(m);if(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial){this.setupLights(m,j);f=this.lights;l.uniforms.enableLighting.value=f.directional.length+f.point.length;l.uniforms.ambientLightColor.value=f.ambient;l.uniforms.directionalLightColor.value=f.directional.colors;l.uniforms.directionalLightDirection.value=f.directional.positions;l.uniforms.pointLightColor.value=f.point.colors;l.uniforms.pointLightPosition.value=f.point.positions}if(l instanceof
+THREE.MeshBasicMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshPhongMaterial)d(l,q);l instanceof THREE.LineBasicMaterial&&e(l,q);if(l instanceof THREE.MeshPhongMaterial){l.uniforms.ambient.value.setRGB(l.ambient.r,l.ambient.g,l.ambient.b);l.uniforms.specular.value.setRGB(l.specular.r,l.specular.g,l.specular.b);l.uniforms.shininess.value=l.shininess}q=l.uniforms;for(v in q)if(n=m.uniforms[v]){j=q[v];t=j.type;f=j.value;if(t=="i")b.uniform1i(n,f);else if(t=="f")b.uniform1f(n,
+f);else if(t=="fv1")b.uniform1fv(n,f);else if(t=="fv")b.uniform3fv(n,f);else if(t=="v2")b.uniform2f(n,f.x,f.y);else if(t=="v3")b.uniform3f(n,f.x,f.y,f.z);else if(t=="c")b.uniform3f(n,f.r,f.g,f.b);else if(t=="t"){b.uniform1i(n,f);if(j=j.texture)if(j.image instanceof Array&&j.image.length==6){j=j;f=f;if(j.image.length==6){if(!j.image.__webGLTextureCube&&!j.image.__cubeMapInitialized&&j.image.loadCount==6){j.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,j.image.__webGLTextureCube);
+b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(t=0;t<6;++t)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,j.image[t]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);j.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+
+f);b.bindTexture(b.TEXTURE_CUBE_MAP,j.image.__webGLTextureCube)}}else{j=j;f=f;if(!j.__webGLTexture&&j.image.loaded){j.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,j.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,j.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h(j.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h(j.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,h(j.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,h(j.min_filter));
+b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,j.__webGLTexture)}}}v=m.attributes;b.bindBuffer(b.ARRAY_BUFFER,r.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.position);if(v.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.normal)}if(v.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLTangentBuffer);
+b.vertexAttribPointer(v.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.tangent)}if(v.uv>=0)if(r.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUVBuffer);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.uv)}else b.disableVertexAttribArray(v.uv);if(l.wireframe||l instanceof THREE.LineBasicMaterial){v=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&C.type==THREE.LineStrip?
+b.LINE_STRIP:b.LINES;b.lineWidth(v);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);b.drawElements(l,r.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,r.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,j,q,l,r,C,m){var t,v,s,n,E;s=0;for(n=l.materials.length;s<n;s++){t=l.materials[s];if(t instanceof THREE.MeshFaceMaterial){t=0;for(v=r.materials.length;t<v;t++)if((E=r.materials[t])&&E.blending==C&&
+E.opacity<1==m){this.setBlending(E.blending);this.renderBuffer(f,j,q,E,r,l)}}else if((E=t)&&E.blending==C&&E.opacity<1==m){this.setBlending(E.blending);this.renderBuffer(f,j,q,E,r,l)}}};this.render=function(f,j,q,l){var r,C,m,t=f.lights,v=f.fog;this.initWebGLObjects(f);l=l!==undefined?l:true;if(q&&!q.__webGLFramebuffer){q.__webGLFramebuffer=b.createFramebuffer();q.__webGLRenderbuffer=b.createRenderbuffer();q.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,q.__webGLRenderbuffer);
+b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,q.width,q.height);b.bindTexture(b.TEXTURE_2D,q.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h(q.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h(q.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,h(q.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,h(q.min_filter));b.texImage2D(b.TEXTURE_2D,0,h(q.format),q.width,q.height,0,h(q.format),h(q.type),null);b.bindFramebuffer(b.FRAMEBUFFER,q.__webGLFramebuffer);
+b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,q.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,q.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(q){r=q.__webGLFramebuffer;m=q.width;C=q.height}else{r=null;m=o.width;C=o.height}if(r!=k){b.bindFramebuffer(b.FRAMEBUFFER,r);b.viewport(0,0,m,C);l&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);k=r}this.autoClear&&
+this.clear();j.autoUpdateMatrix&&j.updateMatrix();u.set(j.matrix.flatten());H.set(j.projectionMatrix.flatten());l=0;for(r=f.__webGLObjects.length;l<r;l++){C=f.__webGLObjects[l];m=C.object;C=C.buffer;if(m.visible){this.setupMatrices(m,j);this.renderPass(j,t,v,m,C,THREE.NormalBlending,false)}}l=0;for(r=f.__webGLObjects.length;l<r;l++){C=f.__webGLObjects[l];m=C.object;C=C.buffer;if(m.visible){this.setupMatrices(m,j);if(m.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);m.flipSided?b.frontFace(b.CW):
+b.frontFace(b.CCW)}this.renderPass(j,t,v,m,C,THREE.AdditiveBlending,false);this.renderPass(j,t,v,m,C,THREE.SubtractiveBlending,false);this.renderPass(j,t,v,m,C,THREE.AdditiveBlending,true);this.renderPass(j,t,v,m,C,THREE.SubtractiveBlending,true);this.renderPass(j,t,v,m,C,THREE.NormalBlending,true)}}if(q&&q.min_filter!==THREE.NearestFilter&&q.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,q.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
+function(f){function j(s,n,E,A){if(s[n]==undefined){f.__webGLObjects.push({buffer:E,object:A});s[n]=1}}var q,l,r,C,m,t,v;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={}}q=0;for(l=f.objects.length;q<l;q++){r=f.objects[q];m=r.geometry;if(f.__webGLObjectsMap[r.id]==undefined)f.__webGLObjectsMap[r.id]={};v=f.__webGLObjectsMap[r.id];if(r instanceof THREE.Mesh){for(C in m.geometryChunks){t=m.geometryChunks[C];if(!t.__webGLVertexBuffer){this.createMeshBuffers(t);this.initMeshBuffers(t,r);
+m.__dirtyVertices=true;m.__dirtyElements=true;m.__dirtyUvs=true;m.__dirtyNormals=true;m.__dirtyTangents=true}if(m.__dirtyVertices||m.__dirtyElements||m.__dirtyUvs)this.setMeshBuffers(t,r,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements,m.__dirtyUvs,m.__dirtyNormals,m.__dirtyTangents);j(v,C,t,r)}m.__dirtyVertices=false;m.__dirtyElements=false;m.__dirtyUvs=false;m.__dirtyNormals=false;m.__dirtyTangents=false}else if(r instanceof THREE.Line){if(!m.__webGLVertexBuffer){this.createLineBuffers(m);this.initLineBuffers(m);
+m.__dirtyVertices=true;m.__dirtyElements=true}m.__dirtyVertices&&this.setLineBuffers(m,b.DYNAMIC_DRAW,m.__dirtyVertices,m.__dirtyElements);j(v,0,m,r);m.__dirtyVertices=false;m.__dirtyElements=false}else if(r instanceof THREE.ParticleSystem){m.__webGLVertexBuffer||this.createParticleBuffers(m);j(v,0,m,r)}}};this.removeObject=function(f,j){var q,l;for(q=f.__webGLObjects.length-1;q>=0;q--){l=f.__webGLObjects[q].object;j==l&&f.__webGLObjects.splice(q,1)}};this.setupMatrices=function(f,j){f.autoUpdateMatrix&&
+f.updateMatrix();y.multiply(j.matrix,f.matrix);x.set(y.flatten());z=THREE.Matrix4.makeInvert3x3(y).transpose();J.set(z.m);K.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,u);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,x);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,H);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,j){b.uniform3f(f.uniforms.cameraPosition,
+j.position.x,j.position.y,j.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,j){if(f){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
+b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
+envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
+map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
+THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",
+value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}}};
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
+vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
+THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
+THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
+THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
+shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
+"gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
+THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
diff --git a/extlib/thingiview.js/binaryReader.js b/extlib/thingiview.js/binaryReader.js
new file mode 100644
index 00000000..f99a2379
--- /dev/null
+++ b/extlib/thingiview.js/binaryReader.js
@@ -0,0 +1,126 @@
+// BinaryReader
+// Refactored by Vjeux <vjeuxx@gmail.com>
+// http://blog.vjeux.com/2010/javascript/javascript-binary-reader.html
+
+// Original
+//+ Jonas Raoni Soares Silva
+//@ http://jsfromhell.com/classes/binary-parser [rev. #1]
+
+BinaryReader = function (data) {
+ this._buffer = data;
+ this._pos = 0;
+};
+
+BinaryReader.prototype = {
+
+ /* Public */
+
+ readInt8: function (){ return this._decodeInt(8, true); },
+ readUInt8: function (){ return this._decodeInt(8, false); },
+ readInt16: function (){ return this._decodeInt(16, true); },
+ readUInt16: function (){ return this._decodeInt(16, false); },
+ readInt32: function (){ return this._decodeInt(32, true); },
+ readUInt32: function (){ return this._decodeInt(32, false); },
+
+ readFloat: function (){ return this._decodeFloat(23, 8); },
+ readDouble: function (){ return this._decodeFloat(52, 11); },
+
+ readChar: function () { return this.readString(1); },
+ readString: function (length) {
+ this._checkSize(length * 8);
+ var result = this._buffer.substr(this._pos, length);
+ this._pos += length;
+ return result;
+ },
+
+ seek: function (pos) {
+ this._pos = pos;
+ this._checkSize(0);
+ },
+
+ getPosition: function () {
+ return this._pos;
+ },
+
+ getSize: function () {
+ return this._buffer.length;
+ },
+
+
+ /* Private */
+
+ _decodeFloat: function(precisionBits, exponentBits){
+ var length = precisionBits + exponentBits + 1;
+ var size = length >> 3;
+ this._checkSize(length);
+
+ var bias = Math.pow(2, exponentBits - 1) - 1;
+ var signal = this._readBits(precisionBits + exponentBits, 1, size);
+ var exponent = this._readBits(precisionBits, exponentBits, size);
+ var significand = 0;
+ var divisor = 2;
+ // var curByte = length + (-precisionBits >> 3) - 1;
+ var curByte = 0;
+ do {
+ var byteValue = this._readByte(++curByte, size);
+ var startBit = precisionBits % 8 || 8;
+ var mask = 1 << startBit;
+ while (mask >>= 1) {
+ if (byteValue & mask) {
+ significand += 1 / divisor;
+ }
+ divisor *= 2;
+ }
+ } while (precisionBits -= startBit);
+
+ this._pos += size;
+
+ return exponent == (bias << 1) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity
+ : (1 + signal * -2) * (exponent || significand ? !exponent ? Math.pow(2, -bias + 1) * significand
+ : Math.pow(2, exponent - bias) * (1 + significand) : 0);
+ },
+
+ _decodeInt: function(bits, signed){
+ var x = this._readBits(0, bits, bits / 8), max = Math.pow(2, bits);
+ var result = signed && x >= max / 2 ? x - max : x;
+
+ this._pos += bits / 8;
+ return result;
+ },
+
+ //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni)
+ _shl: function (a, b){
+ for (++b; --b; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1);
+ return a;
+ },
+
+ _readByte: function (i, size) {
+ return this._buffer.charCodeAt(this._pos + size - i - 1) & 0xff;
+ },
+
+ _readBits: function (start, length, size) {
+ var offsetLeft = (start + length) % 8;
+ var offsetRight = start % 8;
+ var curByte = size - (start >> 3) - 1;
+ var lastByte = size + (-(start + length) >> 3);
+ var diff = curByte - lastByte;
+
+ var sum = (this._readByte(curByte, size) >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1);
+
+ if (diff && offsetLeft) {
+ sum += (this._readByte(lastByte++, size) & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight;
+ }
+
+ while (diff) {
+ sum += this._shl(this._readByte(lastByte++, size), (diff-- << 3) - offsetRight);
+ }
+
+ return sum;
+ },
+
+ _checkSize: function (neededBits) {
+ if (!(this._pos + Math.ceil(neededBits / 8) < this._buffer.length)) {
+ throw new Error("Index out of bound");
+ }
+ }
+}; \ No newline at end of file
diff --git a/extlib/thingiview.js/plane.js b/extlib/thingiview.js/plane.js
new file mode 100644
index 00000000..9f970be0
--- /dev/null
+++ b/extlib/thingiview.js/plane.js
@@ -0,0 +1,62 @@
+/**
+ * @author mr.doob / http://mrdoob.com/
+ * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
+ */
+
+var Plane = function ( width, height, segments_width, segments_height ) {
+
+ THREE.Geometry.call( this );
+
+ var ix, iy,
+ width_half = width / 2,
+ height_half = height / 2,
+ gridX = segments_width || 1,
+ gridY = segments_height || 1,
+ gridX1 = gridX + 1,
+ gridY1 = gridY + 1,
+ segment_width = width / gridX,
+ segment_height = height / gridY;
+
+
+ for( iy = 0; iy < gridY1; iy++ ) {
+
+ for( ix = 0; ix < gridX1; ix++ ) {
+
+ var x = ix * segment_width - width_half;
+ var y = iy * segment_height - height_half;
+
+ this.vertices.push( new THREE.Vertex( new THREE.Vector3( x, - y, 0 ) ) );
+
+ }
+
+ }
+
+ for( iy = 0; iy < gridY; iy++ ) {
+
+ for( ix = 0; ix < gridX; ix++ ) {
+
+ var a = ix + gridX1 * iy;
+ var b = ix + gridX1 * ( iy + 1 );
+ var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
+ var d = ( ix + 1 ) + gridX1 * iy;
+
+ this.faces.push( new THREE.Face4( a, b, c, d ) );
+ this.uvs.push( [
+ new THREE.UV( ix / gridX, iy / gridY ),
+ new THREE.UV( ix / gridX, ( iy + 1 ) / gridY ),
+ new THREE.UV( ( ix + 1 ) / gridX, ( iy + 1 ) / gridY ),
+ new THREE.UV( ( ix + 1 ) / gridX, iy / gridY )
+ ] );
+
+ }
+
+ }
+
+ this.computeCentroids();
+ this.computeFaceNormals();
+ this.sortFacesByMaterial();
+
+};
+
+Plane.prototype = new THREE.Geometry();
+Plane.prototype.constructor = Plane;
diff --git a/extlib/thingiview.js/stats.js b/extlib/thingiview.js/stats.js
new file mode 100644
index 00000000..270d1ce3
--- /dev/null
+++ b/extlib/thingiview.js/stats.js
@@ -0,0 +1,2 @@
+// stats.js r5 - http://github.com/mrdoob/stats.js
+var Stats=function(){var j=0,u=2,r,C=0,E=new Date().getTime(),w=E,f=E,m=0,e=1000,i=0,F,q,c,d,B,k=0,G=1000,a=0,A,t,p,D,l,v=0,o=1000,s=0,h,n,z,g,b,y={fps:{bg:{r:16,g:16,b:48},fg:{r:0,g:255,b:255}},ms:{bg:{r:16,g:48,b:16},fg:{r:0,g:255,b:0}},mem:{bg:{r:48,g:16,b:26},fg:{r:255,g:0,b:128}}};r=document.createElement("div");r.style.fontFamily="Helvetica, Arial, sans-serif";r.style.textAlign="left";r.style.fontSize="9px";r.style.opacity="0.9";r.style.width="80px";r.style.cursor="pointer";r.addEventListener("click",H,false);F=document.createElement("div");F.style.backgroundColor="rgb("+Math.floor(y.fps.bg.r/2)+","+Math.floor(y.fps.bg.g/2)+","+Math.floor(y.fps.bg.b/2)+")";F.style.padding="2px 0px 3px 0px";r.appendChild(F);q=document.createElement("div");q.innerHTML="<strong>FPS</strong>";q.style.color="rgb("+y.fps.fg.r+","+y.fps.fg.g+","+y.fps.fg.b+")";q.style.margin="0px 0px 1px 3px";F.appendChild(q);c=document.createElement("canvas");c.width=74;c.height=30;c.style.display="block";c.style.marginLeft="3px";F.appendChild(c);d=c.getContext("2d");d.fillStyle="rgb("+y.fps.bg.r+","+y.fps.bg.g+","+y.fps.bg.b+")";d.fillRect(0,0,c.width,c.height);B=d.getImageData(0,0,c.width,c.height);A=document.createElement("div");A.style.backgroundColor="rgb("+Math.floor(y.ms.bg.r/2)+","+Math.floor(y.ms.bg.g/2)+","+Math.floor(y.ms.bg.b/2)+")";A.style.padding="2px 0px 3px 0px";A.style.display="none";r.appendChild(A);t=document.createElement("div");t.innerHTML="<strong>MS</strong>";t.style.color="rgb("+y.ms.fg.r+","+y.ms.fg.g+","+y.ms.fg.b+")";t.style.margin="0px 0px 1px 3px";A.appendChild(t);p=document.createElement("canvas");p.width=74;p.height=30;p.style.display="block";p.style.marginLeft="3px";A.appendChild(p);D=p.getContext("2d");D.fillStyle="rgb("+y.ms.bg.r+","+y.ms.bg.g+","+y.ms.bg.b+")";D.fillRect(0,0,p.width,p.height);l=D.getImageData(0,0,p.width,p.height);try{if(webkitPerformance&&webkitPerformance.memory.totalJSHeapSize){u=3}}catch(x){}h=document.createElement("div");h.style.backgroundColor="rgb("+Math.floor(y.mem.bg.r/2)+","+Math.floor(y.mem.bg.g/2)+","+Math.floor(y.mem.bg.b/2)+")";h.style.padding="2px 0px 3px 0px";h.style.display="none";r.appendChild(h);n=document.createElement("div");n.innerHTML="<strong>MEM</strong>";n.style.color="rgb("+y.mem.fg.r+","+y.mem.fg.g+","+y.mem.fg.b+")";n.style.margin="0px 0px 1px 3px";h.appendChild(n);z=document.createElement("canvas");z.width=74;z.height=30;z.style.display="block";z.style.marginLeft="3px";h.appendChild(z);g=z.getContext("2d");g.fillStyle="#301010";g.fillRect(0,0,z.width,z.height);b=g.getImageData(0,0,z.width,z.height);function I(N,M,K){var J,O,L;for(O=0;O<30;O++){for(J=0;J<73;J++){L=(J+O*74)*4;N[L]=N[L+4];N[L+1]=N[L+5];N[L+2]=N[L+6]}}for(O=0;O<30;O++){L=(73+O*74)*4;if(O<M){N[L]=y[K].bg.r;N[L+1]=y[K].bg.g;N[L+2]=y[K].bg.b}else{N[L]=y[K].fg.r;N[L+1]=y[K].fg.g;N[L+2]=y[K].fg.b}}}function H(){j++;j==u?j=0:j;F.style.display="none";A.style.display="none";h.style.display="none";switch(j){case 0:F.style.display="block";break;case 1:A.style.display="block";break;case 2:h.style.display="block";break}}return{domElement:r,update:function(){C++;E=new Date().getTime();k=E-w;G=Math.min(G,k);a=Math.max(a,k);I(l.data,Math.min(30,30-(k/200)*30),"ms");t.innerHTML="<strong>"+k+" MS</strong> ("+G+"-"+a+")";D.putImageData(l,0,0);w=E;if(E>f+1000){m=Math.round((C*1000)/(E-f));e=Math.min(e,m);i=Math.max(i,m);I(B.data,Math.min(30,30-(m/100)*30),"fps");q.innerHTML="<strong>"+m+" FPS</strong> ("+e+"-"+i+")";d.putImageData(B,0,0);if(u==3){v=webkitPerformance.memory.usedJSHeapSize*9.54e-7;o=Math.min(o,v);s=Math.max(s,v);I(b.data,Math.min(30,30-(v/2)),"mem");n.innerHTML="<strong>"+Math.round(v)+" MEM</strong> ("+Math.round(o)+"-"+Math.round(s)+")";g.putImageData(b,0,0)}f=E;C=0}}}}; \ No newline at end of file
diff --git a/extlib/thingiview.js/thingiloader.js b/extlib/thingiview.js/thingiloader.js
new file mode 100644
index 00000000..3791a49c
--- /dev/null
+++ b/extlib/thingiview.js/thingiloader.js
@@ -0,0 +1,318 @@
+Thingiloader = function(event) {
+ // Code from https://developer.mozilla.org/En/Using_XMLHttpRequest#Receiving_binary_data
+ this.load_binary_resource = function(url) {
+ var req = new XMLHttpRequest();
+ req.open('GET', url, false);
+ // The following line says we want to receive data as Binary and not as Unicode
+ req.overrideMimeType('text/plain; charset=x-user-defined');
+ req.send(null);
+ if (req.status != 200) return '';
+
+ return req.responseText;
+ };
+
+ this.loadSTL = function(url) {
+ var looksLikeBinary = function(reader) {
+ // STL files don't specify a way to distinguish ASCII from binary.
+ // The usual way is checking for "solid" at the start of the file --
+ // but Thingiverse has seen at least one binary STL file in the wild
+ // that breaks this.
+
+ // The approach here is different: binary STL files contain a triangle
+ // count early in the file. If this correctly predicts the file's length,
+ // it is most probably a binary STL file.
+
+ reader.seek(80); // skip the header
+ var count = reader.readUInt32();
+
+ var predictedSize = 80 /* header */ + 4 /* count */ + 50 * count;
+ return reader.getSize() == predictedSize;
+ };
+
+ workerFacadeMessage({'status':'message', 'content':'Downloading ' + url});
+ var file = this.load_binary_resource(url);
+ var reader = new BinaryReader(file);
+
+ if (looksLikeBinary(reader)) {
+ this.loadSTLBinary(reader);
+ } else {
+ this.loadSTLString(file);
+ }
+ };
+
+ this.loadOBJ = function(url) {
+ workerFacadeMessage({'status':'message', 'content':'Downloading ' + url});
+ var file = this.load_binary_resource(url);
+ this.loadOBJString(file);
+ };
+
+ this.loadJSON = function(url) {
+ workerFacadeMessage({'status':'message', 'content':'Downloading ' + url});
+ var file = this.load_binary_resource(url);
+ this.loadJSONString(file);
+ };
+
+ this.loadPLY = function(url) {
+ workerFacadeMessage({'status':'message', 'content':'Downloading ' + url});
+
+ var file = this.load_binary_resource(url);
+
+ if (file.match(/format ascii/i)) {
+ this.loadPLYString(file);
+ } else {
+ this.loadPLYBinary(file);
+ }
+ };
+
+ this.loadSTLString = function(STLString) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing STL String...'});
+ workerFacadeMessage({'status':'complete', 'content':this.ParseSTLString(STLString)});
+ };
+
+ this.loadSTLBinary = function(STLBinary) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing STL Binary...'});
+ workerFacadeMessage({'status':'complete', 'content':this.ParseSTLBinary(STLBinary)});
+ };
+
+ this.loadOBJString = function(OBJString) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing OBJ String...'});
+ workerFacadeMessage({'status':'complete', 'content':this.ParseOBJString(OBJString)});
+ };
+
+ this.loadJSONString = function(JSONString) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing JSON String...'});
+ workerFacadeMessage({'status':'complete', 'content':eval(JSONString)});
+ };
+
+ this.loadPLYString = function(PLYString) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing PLY String...'});
+ workerFacadeMessage({'status':'complete_points', 'content':this.ParsePLYString(PLYString)});
+ };
+
+ this.loadPLYBinary = function(PLYBinary) {
+ workerFacadeMessage({'status':'message', 'content':'Parsing PLY Binary...'});
+ workerFacadeMessage({'status':'complete_points', 'content':this.ParsePLYBinary(PLYBinary)});
+ };
+
+ this.ParsePLYString = function(input) {
+ var properties = [];
+ var vertices = [];
+ var colors = [];
+
+ var vertex_count = 0;
+
+ var header = /ply\n([\s\S]+)\nend_header/ig.exec(input)[1];
+ var data = /end_header\n([\s\S]+)$/ig.exec(input)[1];
+
+ // workerFacadeMessage({'status':'message', 'content':'header:\n' + header});
+ // workerFacadeMessage({'status':'message', 'content':'data:\n' + data});
+
+ header_parts = header.split("\n");
+
+ for (i in header_parts) {
+ if (/element vertex/i.test(header_parts[i])) {
+ vertex_count = /element vertex (\d+)/i.exec(header_parts[i])[1];
+ } else if (/property/i.test(header_parts[i])) {
+ properties.push(/property (.*) (.*)/i.exec(header_parts[i])[2]);
+ }
+ }
+
+ // workerFacadeMessage({'status':'message', 'content':'properties: ' + properties});
+
+ data_parts = data.split("\n");
+
+ for (i in data_parts) {
+ data_line = data_parts[i];
+ data_line_parts = data_line.split(" ");
+
+ vertices.push([
+ parseFloat(data_line_parts[properties.indexOf("x")]),
+ parseFloat(data_line_parts[properties.indexOf("y")]),
+ parseFloat(data_line_parts[properties.indexOf("z")])
+ ]);
+
+ colors.push([
+ parseInt(data_line_parts[properties.indexOf("red")]),
+ parseInt(data_line_parts[properties.indexOf("green")]),
+ parseInt(data_line_parts[properties.indexOf("blue")])
+ ]);
+ }
+
+ // workerFacadeMessage({'status':'message', 'content':'vertices: ' + vertices});
+
+ return [vertices, colors];
+ };
+
+ this.ParsePLYBinary = function(input) {
+ return false;
+ };
+
+ this.ParseSTLBinary = function(input) {
+ // Skip the header.
+ input.seek(80);
+
+ // Load the number of vertices.
+ var count = input.readUInt32();
+
+ // During the parse loop we maintain the following data structures:
+ var vertices = []; // Append-only list of all unique vertices.
+ var vert_hash = {}; // Mapping from vertex to index in 'vertices', above.
+ var faces = []; // List of triangle descriptions, each a three-element
+ // list of indices in 'vertices', above.
+
+ for (var i = 0; i < count; i++) {
+ if (i % 100 == 0) {
+ workerFacadeMessage({
+ 'status':'message',
+ 'content':'Parsing ' + (i+1) + ' of ' + count + ' polygons...'
+ });
+ workerFacadeMessage({
+ 'status':'progress',
+ 'content':parseInt(i / count * 100) + '%'
+ });
+ }
+
+ // Skip the normal (3 single-precision floats)
+ input.seek(input.getPosition() + 12);
+
+ var face_indices = [];
+ for (var x = 0; x < 3; x++) {
+ var vertex = [input.readFloat(), input.readFloat(), input.readFloat()];
+
+ var vertexIndex = vert_hash[vertex];
+ if (vertexIndex == null) {
+ vertexIndex = vertices.length;
+ vertices.push(vertex);
+ vert_hash[vertex] = vertexIndex;
+ }
+
+ face_indices.push(vertexIndex);
+ }
+ faces.push(face_indices);
+
+ // Skip the "attribute" field (unused in common models)
+ input.readUInt16();
+ }
+
+ return [vertices, faces];
+ };
+
+ // build stl's vertex and face arrays
+ this.ParseSTLString = function(STLString) {
+ var vertexes = [];
+ var faces = [];
+
+ var face_vertexes = [];
+ var vert_hash = {}
+
+ // console.log(STLString);
+
+ // strip out extraneous stuff
+ STLString = STLString.replace(/\r/, "\n");
+ STLString = STLString.replace(/^solid[^\n]*/, "");
+ STLString = STLString.replace(/\n/g, " ");
+ STLString = STLString.replace(/facet normal /g,"");
+ STLString = STLString.replace(/outer loop/g,"");
+ STLString = STLString.replace(/vertex /g,"");
+ STLString = STLString.replace(/endloop/g,"");
+ STLString = STLString.replace(/endfacet/g,"");
+ STLString = STLString.replace(/endsolid[^\n]*/, "");
+ STLString = STLString.replace(/\s+/g, " ");
+ STLString = STLString.replace(/^\s+/, "");
+
+ // console.log(STLString);
+
+ var facet_count = 0;
+ var block_start = 0;
+
+ var points = STLString.split(" ");
+
+ workerFacadeMessage({'status':'message', 'content':'Parsing vertices...'});
+ for (var i=0; i<points.length/12-1; i++) {
+ if ((i % 100) == 0) {
+ workerFacadeMessage({'status':'progress', 'content':parseInt(i / (points.length/12-1) * 100) + '%'});
+ }
+
+ var face_indices = [];
+ for (var x=0; x<3; x++) {
+ var vertex = [parseFloat(points[block_start+x*3+3]), parseFloat(points[block_start+x*3+4]), parseFloat(points[block_start+x*3+5])];
+
+ var vertexIndex = vert_hash[vertex];
+ if (vertexIndex == null) {
+ vertexIndex = vertexes.length;
+ vertexes.push(vertex);
+ vert_hash[vertex] = vertexIndex;
+ }
+
+ face_indices.push(vertexIndex);
+ }
+ faces.push(face_indices);
+
+ block_start = block_start + 12;
+ }
+
+ return [vertexes, faces];
+ };
+
+ this.ParseOBJString = function(OBJString) {
+ var vertexes = [];
+ var faces = [];
+
+ var lines = OBJString.split("\n");
+
+ // var normal_position = 0;
+
+ for (var i=0; i<lines.length; i++) {
+ workerFacadeMessage({'status':'progress', 'content':parseInt(i / lines.length * 100) + '%'});
+
+ line_parts = lines[i].replace(/\s+/g, " ").split(" ");
+
+ if (line_parts[0] == "v") {
+ vertexes.push([parseFloat(line_parts[1]), parseFloat(line_parts[2]), parseFloat(line_parts[3])]);
+ } else if (line_parts[0] == "f") {
+ faces.push([parseFloat(line_parts[1].split("/")[0])-1, parseFloat(line_parts[2].split("/")[0])-1, parseFloat(line_parts[3].split("/")[0]-1), 0])
+ }
+ }
+
+ return [vertexes, faces];
+ };
+
+ switch(event.data.cmd) {
+ case "loadSTL":
+ this.loadSTL(event.data.param);
+ break;
+ case "loadSTLString":
+ this.loadSTLString(event.data.param);
+ break;
+ case "loadSTLBinary":
+ this.loadSTLBinary(event.data.param);
+ break;
+ case "loadOBJ":
+ this.loadOBJ(event.data.param);
+ break;
+ case "loadOBJString":
+ this.loadOBJString(event.data.param);
+ break;
+ case "loadJSON":
+ this.loadJSON(event.data.param);
+ break;
+ case "loadPLY":
+ this.loadPLY(event.data.param);
+ break;
+ case "loadPLYString":
+ this.loadPLYString(event.data.param);
+ break;
+ case "loadPLYBinary":
+ this.loadPLYBinary(event.data.param);
+ break;
+ }
+
+};
+
+if (typeof(window) === "undefined") {
+ onmessage = Thingiloader;
+ workerFacadeMessage = postMessage;
+ importScripts('binaryReader.js');
+} else {
+ workerFacadeMessage = WorkerFacade.add(thingiurlbase + "/thingiloader.js", Thingiloader);
+}
diff --git a/extlib/thingiview.js/thingiview.js b/extlib/thingiview.js/thingiview.js
new file mode 100644
index 00000000..5eb30335
--- /dev/null
+++ b/extlib/thingiview.js/thingiview.js
@@ -0,0 +1,898 @@
+Thingiview = function(containerId) {
+ scope = this;
+
+ this.containerId = containerId;
+ var container = document.getElementById(containerId);
+
+ // var stats = null;
+ var camera = null;
+ var scene = null;
+ var renderer = null;
+ var object = null;
+ var plane = null;
+
+ var ambientLight = null;
+ var directionalLight = null;
+ var pointLight = null;
+
+ var targetXRotation = 0;
+ var targetXRotationOnMouseDown = 0;
+ var mouseX = 0;
+ var mouseXOnMouseDown = 0;
+
+ var targetYRotation = 0;
+ var targetYRotationOnMouseDown = 0;
+ var mouseY = 0;
+ var mouseYOnMouseDown = 0;
+
+ var mouseDown = false;
+ var mouseOver = false;
+
+ var windowHalfX = window.innerWidth / 2;
+ var windowHalfY = window.innerHeight / 2
+
+ var view = null;
+ var infoMessage = null;
+ var progressBar = null;
+ var alertBox = null;
+
+ var timer = null;
+
+ var rotateTimer = null;
+ var rotateListener = null;
+ var wasRotating = null;
+
+ var cameraView = 'diagonal';
+ var cameraZoom = 0;
+ var rotate = false;
+ var backgroundColor = '#606060';
+ var objectMaterial = 'solid';
+ var objectColor = 0xffffff;
+ var showPlane = true;
+ var isWebGl = false;
+
+ if (document.defaultView && document.defaultView.getComputedStyle) {
+ var width = parseFloat(document.defaultView.getComputedStyle(container,null).getPropertyValue('width'));
+ var height = parseFloat(document.defaultView.getComputedStyle(container,null).getPropertyValue('height'));
+ } else {
+ var width = parseFloat(container.currentStyle.width);
+ var height = parseFloat(container.currentStyle.height);
+ }
+
+ var geometry;
+
+ this.initScene = function() {
+ container.style.position = 'relative';
+ container.innerHTML = '';
+
+ camera = new THREE.Camera(45, width/ height, 1, 100000);
+ camera.updateMatrix();
+
+ scene = new THREE.Scene();
+
+ ambientLight = new THREE.AmbientLight(0x202020);
+ scene.addLight(ambientLight);
+
+ directionalLight = new THREE.DirectionalLight(0xffffff, 0.75);
+ directionalLight.position.x = 1;
+ directionalLight.position.y = 1;
+ directionalLight.position.z = 2;
+ directionalLight.position.normalize();
+ scene.addLight(directionalLight);
+
+ pointLight = new THREE.PointLight(0xffffff, 0.3);
+ pointLight.position.x = 0;
+ pointLight.position.y = -25;
+ pointLight.position.z = 10;
+ scene.addLight(pointLight);
+
+ progressBar = document.createElement('div');
+ progressBar.style.position = 'absolute';
+ progressBar.style.top = '0px';
+ progressBar.style.left = '0px';
+ progressBar.style.backgroundColor = 'red';
+ progressBar.style.padding = '5px';
+ progressBar.style.display = 'none';
+ progressBar.style.overflow = 'visible';
+ progressBar.style.whiteSpace = 'nowrap';
+ progressBar.style.zIndex = 100;
+ container.appendChild(progressBar);
+
+ alertBox = document.createElement('div');
+ alertBox.id = 'alertBox';
+ alertBox.style.position = 'absolute';
+ alertBox.style.top = '25%';
+ alertBox.style.left = '25%';
+ alertBox.style.width = '50%';
+ alertBox.style.height = '50%';
+ alertBox.style.backgroundColor = '#dddddd';
+ alertBox.style.padding = '10px';
+ // alertBox.style.overflowY = 'scroll';
+ alertBox.style.display = 'none';
+ alertBox.style.zIndex = 100;
+ container.appendChild(alertBox);
+
+ // load a blank object
+ // this.loadSTLString('');
+
+ if (showPlane) {
+ loadPlaneGeometry();
+ }
+
+ this.setCameraView(cameraView);
+ this.setObjectMaterial(objectMaterial);
+
+ testCanvas = document.createElement('canvas');
+ try {
+ if (testCanvas.getContext('experimental-webgl')) {
+ // showPlane = false;
+ isWebGl = true;
+ renderer = new THREE.WebGLRenderer();
+ // renderer = new THREE.CanvasRenderer();
+ } else {
+ renderer = new THREE.CanvasRenderer();
+ }
+ } catch(e) {
+ renderer = new THREE.CanvasRenderer();
+ // log("failed webgl detection");
+ }
+
+ // renderer.setSize(container.innerWidth, container.innerHeight);
+
+ renderer.setSize(width, height);
+ renderer.domElement.style.backgroundColor = backgroundColor;
+ container.appendChild(renderer.domElement);
+
+ // stats = new Stats();
+ // stats.domElement.style.position = 'absolute';
+ // stats.domElement.style.top = '0px';
+ // container.appendChild(stats.domElement);
+
+ // TODO: figure out how to get the render window to resize when window resizes
+ // window.addEventListener('resize', onContainerResize(), false);
+ // container.addEventListener('resize', onContainerResize(), false);
+
+ // renderer.domElement.addEventListener('mousemove', onRendererMouseMove, false);
+ window.addEventListener('mousemove', onRendererMouseMove, false);
+ renderer.domElement.addEventListener('mouseover', onRendererMouseOver, false);
+ renderer.domElement.addEventListener('mouseout', onRendererMouseOut, false);
+ renderer.domElement.addEventListener('mousedown', onRendererMouseDown, false);
+ // renderer.domElement.addEventListener('mouseup', onRendererMouseUp, false);
+ window.addEventListener('mouseup', onRendererMouseUp, false);
+
+ renderer.domElement.addEventListener('touchstart', onRendererTouchStart, false);
+ renderer.domElement.addEventListener('touchend', onRendererTouchEnd, false);
+ renderer.domElement.addEventListener('touchmove', onRendererTouchMove, false);
+
+ renderer.domElement.addEventListener('DOMMouseScroll', onRendererScroll, false);
+ renderer.domElement.addEventListener('mousewheel', onRendererScroll, false);
+ renderer.domElement.addEventListener('gesturechange', onRendererGestureChange, false);
+ }
+
+ // FIXME
+ // onContainerResize = function(event) {
+ // width = parseFloat(document.defaultView.getComputedStyle(container,null).getPropertyValue('width'));
+ // height = parseFloat(document.defaultView.getComputedStyle(container,null).getPropertyValue('height'));
+ //
+ // // log("resized width: " + width + ", height: " + height);
+ //
+ // if (renderer) {
+ // renderer.setSize(width, height);
+ // camera.projectionMatrix = THREE.Matrix4.makePerspective(70, width / height, 1, 10000);
+ // sceneLoop();
+ // }
+ // };
+
+ onRendererScroll = function(event) {
+ event.preventDefault();
+
+ var rolled = 0;
+
+ if (event.wheelDelta === undefined) {
+ // Firefox
+ // The measurement units of the detail and wheelDelta properties are different.
+ rolled = -40 * event.detail;
+ } else {
+ rolled = event.wheelDelta;
+ }
+
+ if (rolled > 0) {
+ // up
+ scope.setCameraZoom(+10);
+ } else {
+ // down
+ scope.setCameraZoom(-10);
+ }
+ }
+
+ onRendererGestureChange = function(event) {
+ event.preventDefault();
+
+ if (event.scale > 1) {
+ scope.setCameraZoom(+5);
+ } else {
+ scope.setCameraZoom(-5);
+ }
+ }
+
+ onRendererMouseOver = function(event) {
+ mouseOver = true;
+ // targetRotation = object.rotation.z;
+ if (timer == null) {
+ // log('starting loop');
+ timer = setInterval(sceneLoop, 1000/60);
+ }
+ }
+
+ onRendererMouseDown = function(event) {
+ // log("down");
+
+ event.preventDefault();
+ mouseDown = true;
+
+ if(scope.getRotation()){
+ wasRotating = true;
+ scope.setRotation(false);
+ } else {
+ wasRotating = false;
+ }
+
+ mouseXOnMouseDown = event.clientX - windowHalfX;
+ mouseYOnMouseDown = event.clientY - windowHalfY;
+
+ targetXRotationOnMouseDown = targetXRotation;
+ targetYRotationOnMouseDown = targetYRotation;
+ }
+
+ onRendererMouseMove = function(event) {
+ // log("move");
+
+ if (mouseDown) {
+ mouseX = event.clientX - windowHalfX;
+ // targetXRotation = targetXRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.02;
+ xrot = targetXRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.02;
+
+ mouseY = event.clientY - windowHalfY;
+ // targetYRotation = targetYRotationOnMouseDown + (mouseY - mouseYOnMouseDown) * 0.02;
+ yrot = targetYRotationOnMouseDown + (mouseY - mouseYOnMouseDown) * 0.02;
+
+ targetXRotation = xrot;
+ targetYRotation = yrot;
+ }
+ }
+
+ onRendererMouseUp = function(event) {
+ // log("up");
+ if (mouseDown) {
+ mouseDown = false;
+ if (!mouseOver) {
+ clearInterval(timer);
+ timer = null;
+ }
+ if (wasRotating) {
+ scope.setRotation(true);
+ }
+ }
+ }
+
+ onRendererMouseOut = function(event) {
+ if (!mouseDown) {
+ clearInterval(timer);
+ timer = null;
+ }
+ mouseOver = false;
+ }
+
+ onRendererTouchStart = function(event) {
+ targetXRotation = object.rotation.z;
+ targetYRotation = object.rotation.x;
+
+ timer = setInterval(sceneLoop, 1000/60);
+
+ if (event.touches.length == 1) {
+ event.preventDefault();
+
+ mouseXOnMouseDown = event.touches[0].pageX - windowHalfX;
+ targetXRotationOnMouseDown = targetXRotation;
+
+ mouseYOnMouseDown = event.touches[0].pageY - windowHalfY;
+ targetYRotationOnMouseDown = targetYRotation;
+ }
+ }
+
+ onRendererTouchEnd = function(event) {
+ clearInterval(timer);
+ timer = null;
+ // targetXRotation = object.rotation.z;
+ // targetYRotation = object.rotation.x;
+ }
+
+ onRendererTouchMove = function(event) {
+ if (event.touches.length == 1) {
+ event.preventDefault();
+
+ mouseX = event.touches[0].pageX - windowHalfX;
+ targetXRotation = targetXRotationOnMouseDown + (mouseX - mouseXOnMouseDown) * 0.05;
+
+ mouseY = event.touches[0].pageY - windowHalfY;
+ targetYRotation = targetYRotationOnMouseDown + (mouseY - mouseYOnMouseDown) * 0.05;
+ }
+ }
+
+ sceneLoop = function() {
+ if (object) {
+ // if (view == 'bottom') {
+ // if (showPlane) {
+ // plane.rotation.z = object.rotation.z -= (targetRotation + object.rotation.z) * 0.05;
+ // } else {
+ // object.rotation.z -= (targetRotation + object.rotation.z) * 0.05;
+ // }
+ // } else {
+ // if (showPlane) {
+ // plane.rotation.z = object.rotation.z += (targetRotation - object.rotation.z) * 0.05;
+ // } else {
+ // object.rotation.z += (targetRotation - object.rotation.z) * 0.05;
+ // }
+ // }
+
+ if (showPlane) {
+ plane.rotation.z = object.rotation.z = (targetXRotation - object.rotation.z) * 0.2;
+ plane.rotation.x = object.rotation.x = (targetYRotation - object.rotation.x) * 0.2;
+ } else {
+ object.rotation.z = (targetXRotation - object.rotation.z) * 0.2;
+ object.rotation.x = (targetYRotation - object.rotation.x) * 0.2;
+ }
+
+ // log(object.rotation.x);
+
+ camera.updateMatrix();
+ object.updateMatrix();
+
+ if (showPlane) {
+ plane.updateMatrix();
+ }
+
+ renderer.render(scene, camera);
+ // stats.update();
+ }
+ }
+
+ rotateLoop = function() {
+ // targetRotation += 0.01;
+ targetXRotation += 0.05;
+ sceneLoop();
+ }
+
+ this.getShowPlane = function(){
+ return showPlane;
+ }
+
+ this.setShowPlane = function(show) {
+ showPlane = show;
+
+ if (show) {
+ if (scene && !plane) {
+ loadPlaneGeometry();
+ }
+ plane.material[0].opacity = 1;
+ // plane.updateMatrix();
+ } else {
+ if (scene && plane) {
+ // alert(plane.material[0].opacity);
+ plane.material[0].opacity = 0;
+ // plane.updateMatrix();
+ }
+ }
+
+ sceneLoop();
+ }
+
+ this.getRotation = function() {
+ return rotateTimer !== null;
+ }
+
+ this.resetRotation = function () {
+ if (rotate) {
+ this.setRotation(false);
+ this.setRotation(true);
+ }
+ }
+
+ this.setRotation = function(rotate) {
+ rotation = rotate;
+
+ if (rotate) {
+ rotateTimer = setInterval(rotateLoop, 1000/60);
+ } else {
+ clearInterval(rotateTimer);
+ rotateTimer = null;
+ }
+
+ scope.onSetRotation();
+ }
+
+ this.onSetRotation = function(callback) {
+ if(callback === undefined){
+ if(rotateListener !== null){
+ try{
+ rotateListener(scope.getRotation());
+ } catch(ignored) {}
+ }
+ } else {
+ rotateListener = callback;
+ }
+ }
+
+ this.setCameraView = function(dir) {
+ cameraView = dir;
+
+ targetXRotation = 0;
+ targetYRotation = 0;
+
+ if (object) {
+ object.rotation.x = 0;
+ object.rotation.y = 0;
+ object.rotation.z = 0;
+ }
+
+ if (showPlane && object) {
+ plane.rotation.x = object.rotation.x;
+ plane.rotation.y = object.rotation.y;
+ plane.rotation.z = object.rotation.z;
+ }
+
+ if (dir == 'top') {
+ // camera.position.y = 0;
+ // camera.position.z = 100;
+ // camera.target.position.z = 0;
+ if (showPlane) {
+ plane.flipSided = false;
+ }
+ } else if (dir == 'side') {
+ // camera.position.y = -70;
+ // camera.position.z = 70;
+ // camera.target.position.z = 0;
+ targetYRotation = -4.5;
+ if (showPlane) {
+ plane.flipSided = false;
+ }
+ } else if (dir == 'bottom') {
+ // camera.position.y = 0;
+ // camera.position.z = -100;
+ // camera.target.position.z = 0;
+ if (showPlane) {
+ plane.flipSided = true;
+ }
+ } else {
+ // camera.position.y = -70;
+ // camera.position.z = 70;
+ // camera.target.position.z = 0;
+ if (showPlane) {
+ plane.flipSided = false;
+ }
+ }
+
+ mouseX = targetXRotation;
+ mouseXOnMouseDown = targetXRotation;
+
+ mouseY = targetYRotation;
+ mouseYOnMouseDown = targetYRotation;
+
+ scope.centerCamera();
+
+ sceneLoop();
+ }
+
+ this.setCameraZoom = function(factor) {
+ cameraZoom = factor;
+
+ if (cameraView == 'bottom') {
+ if (camera.position.z + factor > 0) {
+ factor = 0;
+ }
+ } else {
+ if (camera.position.z - factor < 0) {
+ factor = 0;
+ }
+ }
+
+ if (cameraView == 'top') {
+ camera.position.z -= factor;
+ } else if (cameraView == 'bottom') {
+ camera.position.z += factor;
+ } else if (cameraView == 'side') {
+ camera.position.y += factor;
+ camera.position.z -= factor;
+ } else {
+ camera.position.y += factor;
+ camera.position.z -= factor;
+ }
+
+ sceneLoop();
+ }
+
+ this.getObjectMaterial = function() {
+ return objectMaterial;
+ }
+
+ this.setObjectMaterial = function(type) {
+ objectMaterial = type;
+
+ loadObjectGeometry();
+ }
+
+ this.setBackgroundColor = function(color) {
+ backgroundColor = color
+
+ if (renderer) {
+ renderer.domElement.style.backgroundColor = color;
+ }
+ }
+
+ this.setObjectColor = function(color) {
+ objectColor = parseInt(color.replace(/\#/g, ''), 16);
+
+ loadObjectGeometry();
+ }
+
+ this.loadSTL = function(url) {
+ scope.newWorker('loadSTL', url);
+ }
+
+ this.loadOBJ = function(url) {
+ scope.newWorker('loadOBJ', url);
+ }
+
+ this.loadSTLString = function(STLString) {
+ scope.newWorker('loadSTLString', STLString);
+ }
+
+ this.loadSTLBinary = function(STLBinary) {
+ scope.newWorker('loadSTLBinary', STLBinary);
+ }
+
+ this.loadOBJString = function(OBJString) {
+ scope.newWorker('loadOBJString', OBJString);
+ }
+
+ this.loadJSON = function(url) {
+ scope.newWorker('loadJSON', url);
+ }
+
+ this.loadPLY = function(url) {
+ scope.newWorker('loadPLY', url);
+ }
+
+ this.loadPLYString = function(PLYString) {
+ scope.newWorker('loadPLYString', PLYString);
+ }
+
+ this.loadPLYBinary = function(PLYBinary) {
+ scope.newWorker('loadPLYBinary', PLYBinary);
+ }
+
+ this.centerCamera = function() {
+ if (geometry) {
+ // Using method from http://msdn.microsoft.com/en-us/library/bb197900(v=xnagamestudio.10).aspx
+ // log("bounding sphere radius = " + geometry.boundingSphere.radius);
+
+ // look at the center of the object
+ camera.target.position.x = geometry.center_x;
+ camera.target.position.y = geometry.center_y;
+ camera.target.position.z = geometry.center_z;
+
+ // set camera position to center of sphere
+ camera.position.x = geometry.center_x;
+ camera.position.y = geometry.center_y;
+ camera.position.z = geometry.center_z;
+
+ // find distance to center
+ distance = geometry.boundingSphere.radius / Math.sin((camera.fov/2) * (Math.PI / 180));
+
+ // zoom backwards about half that distance, I don't think I'm doing the math or backwards vector calculation correctly?
+ // scope.setCameraZoom(-distance/1.8);
+ // scope.setCameraZoom(-distance/1.5);
+ scope.setCameraZoom(-distance/1.9);
+
+ directionalLight.position.x = geometry.min_y * 2;
+ directionalLight.position.y = geometry.min_y * 2;
+ directionalLight.position.z = geometry.max_z * 2;
+
+ pointLight.position.x = geometry.center_y;
+ pointLight.position.y = geometry.center_y;
+ pointLight.position.z = geometry.max_z * 2;
+ } else {
+ // set to any valid position so it doesn't fail before geometry is available
+ camera.position.y = -70;
+ camera.position.z = 70;
+ camera.target.position.z = 0;
+ }
+ }
+
+ this.loadArray = function(array) {
+ log("loading array...");
+ geometry = new STLGeometry(array);
+ loadObjectGeometry();
+ scope.resetRotation();
+ scope.centerCamera();
+ log("finished loading " + geometry.faces.length + " faces.");
+ }
+
+ this.newWorker = function(cmd, param) {
+ scope.setRotation(false);
+
+ var worker = new WorkerFacade(thingiurlbase + '/thingiloader.js');
+
+ worker.onmessage = function(event) {
+ if (event.data.status == "complete") {
+ progressBar.innerHTML = 'Initializing geometry...';
+ // scene.removeObject(object);
+ geometry = new STLGeometry(event.data.content);
+ loadObjectGeometry();
+ progressBar.innerHTML = '';
+ progressBar.style.display = 'none';
+
+ scope.resetRotation();
+ log("finished loading " + geometry.faces.length + " faces.");
+ scope.centerCamera();
+ } else if (event.data.status == "complete_points") {
+ progressBar.innerHTML = 'Initializing points...';
+
+ geometry = new THREE.Geometry();
+
+ var material = new THREE.ParticleBasicMaterial( { color: 0xff0000, opacity: 1 } );
+
+ // material = new THREE.ParticleBasicMaterial( { size: 35, sizeAttenuation: false} );
+ // material.color.setHSV( 1.0, 0.2, 0.8 );
+
+ for (i in event.data.content[0]) {
+ // for (var i=0; i<10; i++) {
+ vector = new THREE.Vector3( event.data.content[0][i][0], event.data.content[0][i][1], event.data.content[0][i][2] );
+ geometry.vertices.push( new THREE.Vertex( vector ) );
+ }
+
+ particles = new THREE.ParticleSystem( geometry, material );
+ particles.sortParticles = true;
+ particles.updateMatrix();
+ scene.addObject( particles );
+
+ camera.updateMatrix();
+ renderer.render(scene, camera);
+
+ progressBar.innerHTML = '';
+ progressBar.style.display = 'none';
+
+ scope.resetRotation();
+ log("finished loading " + event.data.content[0].length + " points.");
+ // scope.centerCamera();
+ } else if (event.data.status == "progress") {
+ progressBar.style.display = 'block';
+ progressBar.style.width = event.data.content;
+ // log(event.data.content);
+ } else if (event.data.status == "message") {
+ progressBar.style.display = 'block';
+ progressBar.innerHTML = event.data.content;
+ log(event.data.content);
+ } else if (event.data.status == "alert") {
+ scope.displayAlert(event.data.content);
+ } else {
+ alert('Error: ' + event.data);
+ log('Unknown Worker Message: ' + event.data);
+ }
+ }
+
+ worker.onerror = function(error) {
+ log(error);
+ error.preventDefault();
+ }
+
+ worker.postMessage({'cmd':cmd, 'param':param});
+ }
+
+ this.displayAlert = function(msg) {
+ msg = msg + "<br/><br/><center><input type=\"button\" value=\"Ok\" onclick=\"document.getElementById('alertBox').style.display='none'\"></center>"
+
+ alertBox.innerHTML = msg;
+ alertBox.style.display = 'block';
+
+ // log(msg);
+ }
+
+ function loadPlaneGeometry() {
+ // TODO: switch to lines instead of the Plane object so we can get rid of the horizontal lines in canvas renderer...
+ plane = new THREE.Mesh(new Plane(100, 100, 10, 10), new THREE.MeshBasicMaterial({color:0xafafaf,wireframe:true}));
+ scene.addObject(plane);
+ }
+
+ function loadObjectGeometry() {
+ if (scene && geometry) {
+ if (objectMaterial == 'wireframe') {
+ // material = new THREE.MeshColorStrokeMaterial(objectColor, 1, 1);
+ material = new THREE.MeshBasicMaterial({color:objectColor,wireframe:true});
+ } else {
+ if (isWebGl) {
+ // material = new THREE.MeshPhongMaterial(objectColor, objectColor, 0xffffff, 50, 1.0);
+ // material = new THREE.MeshColorFillMaterial(objectColor);
+ // material = new THREE.MeshLambertMaterial({color:objectColor});
+ material = new THREE.MeshLambertMaterial({color:objectColor, shading: THREE.FlatShading});
+ } else {
+ // material = new THREE.MeshColorFillMaterial(objectColor);
+ material = new THREE.MeshLambertMaterial({color:objectColor, shading: THREE.FlatShading});
+ }
+ }
+
+ // scene.removeObject(object);
+
+ if (object) {
+ // shouldn't be needed, but this fixes a bug with webgl not removing previous object when loading a new one dynamically
+ object.materials = [new THREE.MeshBasicMaterial({color:0xffffff, opacity:0})];
+ scene.removeObject(object);
+ // object.geometry = geometry;
+ // object.materials = [material];
+ }
+
+ object = new THREE.Mesh(geometry, material);
+ scene.addObject(object);
+
+ if (objectMaterial != 'wireframe') {
+ object.overdraw = true;
+ object.doubleSided = true;
+ }
+
+ object.updateMatrix();
+
+ targetXRotation = 0;
+ targetYRotation = 0;
+
+ sceneLoop();
+ }
+ }
+
+};
+
+var STLGeometry = function(stlArray) {
+ // log("building geometry...");
+ THREE.Geometry.call(this);
+
+ var scope = this;
+
+ // var vertexes = stlArray[0];
+ // var normals = stlArray[1];
+ // var faces = stlArray[2];
+
+ for (var i=0; i<stlArray[0].length; i++) {
+ v(stlArray[0][i][0], stlArray[0][i][1], stlArray[0][i][2]);
+ }
+
+ for (var i=0; i<stlArray[1].length; i++) {
+ f3(stlArray[1][i][0], stlArray[1][i][1], stlArray[1][i][2]);
+ }
+
+ function v(x, y, z) {
+ // log("adding vertex: " + x + "," + y + "," + z);
+ scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
+ }
+
+ function f3(a, b, c) {
+ // log("adding face: " + a + "," + b + "," + c)
+ scope.faces.push( new THREE.Face3( a, b, c ) );
+ }
+
+ // log("computing centroids...");
+ this.computeCentroids();
+ // log("computing normals...");
+ // this.computeNormals();
+ this.computeFaceNormals();
+ this.sortFacesByMaterial();
+ // log("finished building geometry");
+
+ scope.min_x = 0;
+ scope.min_y = 0;
+ scope.min_z = 0;
+
+ scope.max_x = 0;
+ scope.max_y = 0;
+ scope.max_z = 0;
+
+ for (var v = 0, vl = scope.vertices.length; v < vl; v ++) {
+ scope.max_x = Math.max(scope.max_x, scope.vertices[v].position.x);
+ scope.max_y = Math.max(scope.max_y, scope.vertices[v].position.y);
+ scope.max_z = Math.max(scope.max_z, scope.vertices[v].position.z);
+
+ scope.min_x = Math.min(scope.min_x, scope.vertices[v].position.x);
+ scope.min_y = Math.min(scope.min_y, scope.vertices[v].position.y);
+ scope.min_z = Math.min(scope.min_z, scope.vertices[v].position.z);
+}
+
+ scope.center_x = (scope.max_x + scope.min_x)/2;
+ scope.center_y = (scope.max_y + scope.min_y)/2;
+ scope.center_z = (scope.max_z + scope.min_z)/2;
+}
+
+STLGeometry.prototype = new THREE.Geometry();
+STLGeometry.prototype.constructor = STLGeometry;
+
+function log(msg) {
+ if (this.console) {
+ console.log(msg);
+ }
+}
+
+/* A facade for the Web Worker API that fakes it in case it's missing.
+Good when web workers aren't supported in the browser, but it's still fast enough, so execution doesn't hang too badly (e.g. Opera 10.5).
+By Stefan Wehrmeyer, licensed under MIT
+*/
+
+var WorkerFacade;
+if(!!window.Worker){
+ WorkerFacade = (function(){
+ return function(path){
+ return new window.Worker(path);
+ };
+ }());
+} else {
+ WorkerFacade = (function(){
+ var workers = {}, masters = {}, loaded = false;
+ var that = function(path){
+ var theworker = {}, loaded = false, callings = [];
+ theworker.postToWorkerFunction = function(args){
+ try{
+ workers[path]({"data":args});
+ }catch(err){
+ theworker.onerror(err);
+ }
+ };
+ theworker.postMessage = function(params){
+ if(!loaded){
+ callings.push(params);
+ return;
+ }
+ theworker.postToWorkerFunction(params);
+ };
+ masters[path] = theworker;
+ var scr = document.createElement("SCRIPT");
+ scr.src = path;
+ scr.type = "text/javascript";
+ scr.onload = function(){
+ loaded = true;
+ while(callings.length > 0){
+ theworker.postToWorkerFunction(callings[0]);
+ callings.shift();
+ }
+ };
+ document.body.appendChild(scr);
+
+ var binaryscr = document.createElement("SCRIPT");
+ binaryscr.src = thingiurlbase + '/binaryReader.js';
+ binaryscr.type = "text/javascript";
+ document.body.appendChild(binaryscr);
+
+ return theworker;
+ };
+ that.fake = true;
+ that.add = function(pth, worker){
+ workers[pth] = worker;
+ return function(param){
+ masters[pth].onmessage({"data": param});
+ };
+ };
+ that.toString = function(){
+ return "FakeWorker('"+path+"')";
+ };
+ return that;
+ }());
+}
+
+/* Then just use WorkerFacade instead of Worker (or alias it)
+
+The Worker code must should use a custom function (name it how you want) instead of postMessage.
+Put this at the end of the Worker:
+
+if(typeof(window) === "undefined"){
+ onmessage = nameOfWorkerFunction;
+ customPostMessage = postMessage;
+} else {
+ customPostMessage = WorkerFacade.add("path/to/thisworker.js", nameOfWorkerFunction);
+}
+
+*/
diff --git a/extlib/video-js/LGPLv3-LICENSE.txt b/extlib/video-js/LGPLv3-LICENSE.txt
new file mode 100644
index 00000000..65c5ca88
--- /dev/null
+++ b/extlib/video-js/LGPLv3-LICENSE.txt
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/extlib/video-js/demo.html b/extlib/video-js/demo.html
deleted file mode 100644
index a8393af0..00000000
--- a/extlib/video-js/demo.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Video.js | HTML5 Video Player</title>
-
- <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" type="text/css">
-
- <!-- video.js must be in the <head> for older IEs to work. -->
- <script src="http://vjs.zencdn.net/c/video.js"></script>
-
-</head>
-<body>
-
- <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264"
- poster="http://video-js.zencoder.com/oceans-clip.png"
- data-setup="{}">
- <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
- <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
- <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
- </video>
-
-</body>
-</html>
diff --git a/extlib/video-js/video-js.css b/extlib/video-js/video-js.css
deleted file mode 100644
index a1a18a00..00000000
--- a/extlib/video-js/video-js.css
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
-VideoJS Default Styles (http://videojs.com)
-Version 3.1.0
-*/
-
-/*
-REQUIRED STYLES (be careful overriding)
-================================================================================ */
-/* When loading the player, the video tag is replaced with a DIV,
- that will hold the video tag or object tag for other playback methods.
- The div contains the video playback element (Flash or HTML5) and controls, and sets the width and height of the video.
-
- ** If you want to add some kind of border/padding (e.g. a frame), or special positioning, use another containing element.
- Otherwise you risk messing up control positioning and full window mode. **
-*/
-.video-js {
- background-color: #000; position: relative; padding: 0;
-
- /* Start with 10px for base font size so other dimensions can be em based and easily calculable. */
- font-size: 10px;
-
- /* Allow poster to be vertially aligned. */
- vertical-align: middle;
- /* display: table-cell; */ /*This works in Safari but not Firefox.*/
-}
-
-/* Playback technology elements expand to the width/height of the containing div. <video> or <object> */
-.video-js .vjs-tech { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-
-/* Fix for Firefox 9 fullscreen (only if it is enabled). Not needed when checking fullScreenEnabled. */
-.video-js:-moz-full-screen { position: absolute; }
-
-/* Fullscreen Styles */
-body.vjs-full-window {
- padding: 0; margin: 0;
- height: 100%; overflow-y: auto; /* Fix for IE6 full-window. http://www.cssplay.co.uk/layouts/fixed.html */
-}
-.video-js.vjs-fullscreen {
- position: fixed; overflow: hidden; z-index: 1000; left: 0; top: 0; bottom: 0; right: 0; width: 100% !important; height: 100% !important;
- _position: absolute; /* IE6 Full-window (underscore hack) */
-}
-.video-js:-webkit-full-screen {
- width: 100% !important; height: 100% !important;
-}
-
-/* Poster Styles */
-.vjs-poster {
- margin: 0 auto; padding: 0; cursor: pointer;
-
- /* Scale with the size of the player div. Works when poster is vertically shorter, but stretches when it's less wide. */
- position: relative; width: 100%; max-height: 100%;
-}
-
-/* Subtiles Styles */
-.video-js .vjs-subtitles { color: #fff; font-size: 20px; text-align: center; position: absolute; bottom: 40px; left: 0; right: 0; }
-
-/* Fading sytles, used to fade control bar. */
-.vjs-fade-in {
- visibility: visible !important; /* Needed to make sure things hide in older browsers too. */
- opacity: 1 !important;
-
- -webkit-transition: visibility 0s linear 0s, opacity 0.3s linear;
- -moz-transition: visibility 0s linear 0s, opacity 0.3s linear;
- -ms-transition: visibility 0s linear 0s, opacity 0.3s linear;
- -o-transition: visibility 0s linear 0s, opacity 0.3s linear;
- transition: visibility 0s linear 0s, opacity 0.3s linear;
-}
-.vjs-fade-out {
- visibility: hidden !important;
- opacity: 0 !important;
-
- -webkit-transition: visibility 0s linear 1.5s,opacity 1.5s linear;
- -moz-transition: visibility 0s linear 1.5s,opacity 1.5s linear;
- -ms-transition: visibility 0s linear 1.5s,opacity 1.5s linear;
- -o-transition: visibility 0s linear 1.5s,opacity 1.5s linear;
- transition: visibility 0s linear 1.5s,opacity 1.5s linear;
-}
-
-/* DEFAULT SKIN (override in another file to create new skins)
-================================================================================
-Instead of editing this file, I recommend creating your own skin CSS file to be included after this file,
-so you can upgrade to newer versions easier. You can remove all these styles by removing the 'vjs-default-skin' class from the tag. */
-
-/* The default control bar. Created by bar.js */
-.vjs-default-skin .vjs-controls {
- position: absolute;
- bottom: 0; /* Distance from the bottom of the box/video. Keep 0. Use height to add more bottom margin. */
- left: 0; right: 0; /* 100% width of div */
- margin: 0; padding: 0; /* Controls are absolutely position, so no padding necessary */
- height: 2.6em; /* Including any margin you want above or below control items */
- color: #fff; border-top: 1px solid #404040;
-
- /* CSS Gradient */
- /* Can use the Ultimate CSS Gradient Generator: http://www.colorzilla.com/gradient-editor/ */
- background: #242424; /* Old browsers */
- background: -moz-linear-gradient(top, #242424 50%, #1f1f1f 50%, #171717 100%); /* FF3.6+ */
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(50%,#242424), color-stop(50%,#1f1f1f), color-stop(100%,#171717)); /* Chrome,Safari4+ */
- background: -webkit-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* Chrome10+,Safari5.1+ */
- background: -o-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* Opera11.10+ */
- background: -ms-linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* IE10+ */
- /* Filter was causing a lot of weird issues in IE. Elements would stop showing up, or other styles would break. */
- /*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242424', endColorstr='#171717',GradientType=0 );*/ /* IE6-9 */
- background: linear-gradient(top, #242424 50%,#1f1f1f 50%,#171717 100%); /* W3C */
-
- /* Start hidden and with 0 opacity. Opacity is used to fade in modern browsers. */
- /* Can't use display block to hide initially because widths of slider handles aren't calculated and avaialbe for positioning correctly. */
- visibility: hidden;
- opacity: 0;
-}
-
-/* General styles for individual controls. */
-.vjs-default-skin .vjs-control {
- position: relative; float: left;
- text-align: center; margin: 0; padding: 0;
- height: 2.6em; width: 2.6em;
-}
-
-.vjs-default-skin .vjs-control:focus {
- outline: 0;
-}
-
-/* Hide control text visually, but have it available for screenreaders: h5bp.com/v */
-.vjs-default-skin .vjs-control-text { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
-
-
-/* Play/Pause
--------------------------------------------------------------------------------- */
-.vjs-default-skin .vjs-play-control { width: 5em; cursor: pointer !important; }
-/* Play Icon */
-.vjs-default-skin.vjs-paused .vjs-play-control div { width: 15px; height: 17px; background: url('video-js.png'); margin: 0.5em auto 0; }
-.vjs-default-skin.vjs-playing .vjs-play-control div { width: 15px; height: 17px; background: url('video-js.png') -25px 0; margin: 0.5em auto 0; }
-
-/* Rewind
--------------------------------------------------------------------------------- */
-.vjs-default-skin .vjs-rewind-control { width: 5em; cursor: pointer !important; }
-.vjs-default-skin .vjs-rewind-control div { width: 19px; height: 16px; background: url('video-js.png'); margin: 0.5em auto 0; }
-
-/* Volume/Mute
--------------------------------------------------------------------------------- */
-.vjs-default-skin .vjs-mute-control { width: 3.8em; cursor: pointer !important; float: right; }
-.vjs-default-skin .vjs-mute-control div { width: 22px; height: 16px; background: url('video-js.png') -75px -25px; margin: 0.5em auto 0; }
-.vjs-default-skin .vjs-mute-control.vjs-vol-0 div { background: url('video-js.png') 0 -25px; }
-.vjs-default-skin .vjs-mute-control.vjs-vol-1 div { background: url('video-js.png') -25px -25px; }
-.vjs-default-skin .vjs-mute-control.vjs-vol-2 div { background: url('video-js.png') -50px -25px; }
-
-
-.vjs-default-skin .vjs-volume-control { width: 5em; float: right; }
-.vjs-default-skin .vjs-volume-bar {
- position: relative; width: 5em; height: 0.6em; margin: 1em auto 0; cursor: pointer !important;
-
- -moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
-
- background: #666;
- background: -moz-linear-gradient(top, #333, #666);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333), to(#666));
- background: -webkit-linear-gradient(top, #333, #666);
- background: -o-linear-gradient(top, #333, #666);
- background: -ms-linear-gradient(top, #333, #666);
- background: linear-gradient(top, #333, #666);
-}
-.vjs-default-skin .vjs-volume-level {
- position: absolute; top: 0; left: 0; height: 0.6em;
-
- -moz-border-radius: 0.3em; -webkit-border-radius: 0.3em; border-radius: 0.3em;
-
- background: #fff;
- background: -moz-linear-gradient(top, #fff, #ccc);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ccc));
- background: -webkit-linear-gradient(top, #fff, #ccc);
- background: -o-linear-gradient(top, #fff, #ccc);
- background: -ms-linear-gradient(top, #fff, #ccc);
- background: linear-gradient(top, #fff, #ccc);
-}
-.vjs-default-skin .vjs-volume-handle {
- position: absolute; top: -0.2em; width: 0.8em; height: 0.8em; background: #ccc; left: 0;
- border: 1px solid #fff;
- -moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
-}
-
-/* Progress
--------------------------------------------------------------------------------- */
-.vjs-default-skin div.vjs-progress-control {
- position: absolute;
- left: 4.8em; right: 4.8em; /* Leave room for time displays. */
- height: 1.0em; width: auto;
- top: -1.3em; /* Set above the rest of the controls. And leave room for 2px of borders (progress bottom and controls top). */
- border-bottom: 1px solid #1F1F1F;
- border-top: 1px solid #222;
-
- /* CSS Gradient */
- background: #333;
- background: -moz-linear-gradient(top, #222, #333);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#222), to(#333));
- background: -webkit-linear-gradient(top, #222, #333);
- background: -o-linear-gradient(top, #333, #222);
- background: -ms-linear-gradient(top, #333, #222);
- background: linear-gradient(top, #333, #222);
-
-
- /* 1px top shadow */
-/* -webkit-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15);*/
-}
-
-/* Box containing play and load progresses. Also acts as seek scrubber. */
-.vjs-default-skin .vjs-progress-holder {
- position: relative; cursor: pointer !important; /*overflow: hidden;*/
- padding: 0; margin: 0; /* Placement within the progress control item */
- height: 1.0em;
- -moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
-
- /* CSS Gradient */
- background: #111;
- background: -moz-linear-gradient(top, #111, #262626);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#111), to(#262626));
- background: -webkit-linear-gradient(top, #111, #262626);
- background: -o-linear-gradient(top, #111, #262626);
- background: -ms-linear-gradient(top, #111, #262626);
- background: linear-gradient(top, #111, #262626);
-}
-.vjs-default-skin .vjs-progress-holder .vjs-play-progress,
-.vjs-default-skin .vjs-progress-holder .vjs-load-progress { /* Progress Bars */
- position: absolute; display: block; height: 1.0em; margin: 0; padding: 0;
- left: 0; top: 0; /*Needed for IE6*/
- -moz-border-radius: 0.6em; -webkit-border-radius: 0.6em; border-radius: 0.6em;
-
- /*width: 0;*/
-}
-
-.vjs-default-skin .vjs-play-progress {
- /* CSS Gradient. */
- background: #fff; /* Old browsers */
- background: -moz-linear-gradient(top, #fff 0%, #d6d6d6 50%, #fff 100%);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#fff), color-stop(50%,#d6d6d6), color-stop(100%,#fff));
- background: -webkit-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
- background: -o-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
- background: -ms-linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
- background: linear-gradient(top, #fff 0%,#d6d6d6 50%,#fff 100%);
-
- background: #efefef;
- background: -moz-linear-gradient(top, #efefef 0%, #f5f5f5 50%, #dbdbdb 50%, #f1f1f1 100%);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#efefef), color-stop(50%,#f5f5f5), color-stop(50%,#dbdbdb), color-stop(100%,#f1f1f1));
- background: -webkit-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
- background: -o-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
- background: -ms-linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#f1f1f1',GradientType=0 );
- background: linear-gradient(top, #efefef 0%,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);
-}
-.vjs-default-skin .vjs-load-progress {
- opacity: 0.8;
-
- /* CSS Gradient */
- background: #666;
- background: -moz-linear-gradient(top, #666, #333);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#666), to(#333));
- background: -webkit-linear-gradient(top, #666, #333);
- background: -o-linear-gradient(top, #666, #333);
- background: -ms-linear-gradient(top, #666, #333);
- background: linear-gradient(top, #666, #333);
-}
-
-.vjs-default-skin div.vjs-seek-handle {
- position: absolute;
- width: 16px; height: 16px; /* Match img pixles */
- margin-top: -0.3em;
- left: 0; top: 0; /*Needed for IE6*/
-
- background: url('video-js.png') 0 -50px;
- /* CSS Curved Corners. Needed to make shadows curved. */
- -moz-border-radius: 0.8em; -webkit-border-radius: 0.8em; border-radius: 0.8em;
- /* CSS Shadows */
- -webkit-box-shadow: 0 2px 4px 0 #000; -moz-box-shadow: 0 2px 4px 0 #000; box-shadow: 0 2px 4px 0 #000;
-}
-/* Time Display
--------------------------------------------------------------------------------- */
-.vjs-default-skin .vjs-time-controls {
- position: absolute;
- right: 0;
- height: 1.0em; width: 4.8em;
- top: -1.3em;
- border-bottom: 1px solid #1F1F1F;
- border-top: 1px solid #222;
- background-color: #333;
-
- font-size: 1em; line-height: 1.0em; font-weight: normal; font-family: Helvetica, Arial, sans-serif;
-
- background: #333;
- background: -moz-linear-gradient(top, #222, #333);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#222), to(#333));
- background: -webkit-linear-gradient(top, #222, #333);
- background: -o-linear-gradient(top, #333, #222);
- background: -ms-linear-gradient(top, #333, #222);
- background: linear-gradient(top, #333, #222);
-
- /* 1px top shadow */
-/* -webkit-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); -moz-box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15); box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.15);*/
-}
-
-.vjs-default-skin .vjs-current-time { left: 0; }
-
-.vjs-default-skin .vjs-duration { right: 0; display: none; }
-.vjs-default-skin .vjs-remaining-time { right: 0; }
-
-.vjs-time-divider { display:none; }
-
-.vjs-default-skin .vjs-time-control { font-size: 1em; line-height: 1; font-weight: normal; font-family: Helvetica, Arial, sans-serif; }
-.vjs-default-skin .vjs-time-control span { line-height: 25px; /* Centering vertically */ }
-
-/* Fullscreen
--------------------------------------------------------------------------------- */
-.vjs-secondary-controls { float: right; }
-
-.vjs-default-skin .vjs-fullscreen-control { width: 3.8em; cursor: pointer !important; float: right; }
-.vjs-default-skin .vjs-fullscreen-control div { width: 16px; height: 16px; background: url('video-js.png') -50px 0; margin: 0.5em auto 0; }
-
-.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control div { background: url('video-js.png') -75px 0; }
-
-
-/* Big Play Button (at start)
----------------------------------------------------------*/
-.vjs-default-skin .vjs-big-play-button {
- display: block; /* Start hidden */ z-index: 2;
- position: absolute; top: 50%; left: 50%; width: 8.0em; height: 8.0em; margin: -43px 0 0 -43px; text-align: center; vertical-align: center; cursor: pointer !important;
- border: 0.3em solid #fff; opacity: 0.95;
- -webkit-border-radius: 25px; -moz-border-radius: 25px; border-radius: 25px;
-
- background: #454545;
- background: -moz-linear-gradient(top, #454545 0%, #232323 50%, #161616 50%, #3f3f3f 100%);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%,#454545), color-stop(50%,#232323), color-stop(50%,#161616), color-stop(100%,#3f3f3f));
- background: -webkit-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
- background: -o-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
- background: -ms-linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#454545', endColorstr='#3f3f3f',GradientType=0 );
- background: linear-gradient(top, #454545 0%,#232323 50%,#161616 50%,#3f3f3f 100%);
-
- /* CSS Shadows */
- -webkit-box-shadow: 4px 4px 8px #000; -moz-box-shadow: 4px 4px 8px #000; box-shadow: 4px 4px 8px #000;
-}
-
-.vjs-default-skin div.vjs-big-play-button:hover {
- -webkit-box-shadow: 0 0 80px #fff; -moz-box-shadow: 0 0 80px #fff; box-shadow: 0 0 80px #fff;
-}
-
-.vjs-default-skin div.vjs-big-play-button span {
- position: absolute; top: 50%; left: 50%;
- display: block; width: 35px; height: 42px;
- margin: -20px 0 0 -15px; /* Using negative margin to center image. */
- background: url('video-js.png') -100px 0;
-}
-
-/* Loading Spinner
----------------------------------------------------------*/
-/* CSS Spinners by Kilian Valkhof - http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/ */
-.vjs-loading-spinner {
- display: none;
- position: absolute; top: 50%; left: 50%; width: 55px; height: 55px;
- margin: -28px 0 0 -28px;
- -webkit-animation-name: rotatethis;
- -webkit-animation-duration:1s;
- -webkit-animation-iteration-count:infinite;
- -webkit-animation-timing-function:linear;
- -moz-animation-name: rotatethis;
- -moz-animation-duration:1s;
- -moz-animation-iteration-count:infinite;
- -moz-animation-timing-function:linear;
-}
-
-@-webkit-keyframes rotatethis {
- 0% {-webkit-transform:scale(0.6) rotate(0deg); }
- 12.5% {-webkit-transform:scale(0.6) rotate(0deg); }
- 12.51% {-webkit-transform:scale(0.6) rotate(45deg); }
- 25% {-webkit-transform:scale(0.6) rotate(45deg); }
- 25.01% {-webkit-transform:scale(0.6) rotate(90deg);}
- 37.5% {-webkit-transform:scale(0.6) rotate(90deg);}
- 37.51% {-webkit-transform:scale(0.6) rotate(135deg);}
- 50% {-webkit-transform:scale(0.6) rotate(135deg);}
- 50.01% {-webkit-transform:scale(0.6) rotate(180deg);}
- 62.5% {-webkit-transform:scale(0.6) rotate(180deg);}
- 62.51% {-webkit-transform:scale(0.6) rotate(225deg);}
- 75% {-webkit-transform:scale(0.6) rotate(225deg);}
- 75.01% {-webkit-transform:scale(0.6) rotate(270deg);}
- 87.5% {-webkit-transform:scale(0.6) rotate(270deg);}
- 87.51% {-webkit-transform:scale(0.6) rotate(315deg);}
- 100% {-webkit-transform:scale(0.6) rotate(315deg);}
-}
-
-@-moz-keyframes rotatethis {
- 0% {-moz-transform:scale(0.6) rotate(0deg);}
- 12.5% {-moz-transform:scale(0.6) rotate(0deg);}
- 12.51% {-moz-transform:scale(0.6) rotate(45deg);}
- 25% {-moz-transform:scale(0.6) rotate(45deg);}
- 25.01% {-moz-transform:scale(0.6) rotate(90deg);}
- 37.5% {-moz-transform:scale(0.6) rotate(90deg);}
- 37.51% {-moz-transform:scale(0.6) rotate(135deg);}
- 50% {-moz-transform:scale(0.6) rotate(135deg);}
- 50.01% {-moz-transform:scale(0.6) rotate(180deg);}
- 62.5% {-moz-transform:scale(0.6) rotate(180deg);}
- 62.51% {-moz-transform:scale(0.6) rotate(225deg);}
- 75% {-moz-transform:scale(0.6) rotate(225deg);}
- 75.01% {-moz-transform:scale(0.6) rotate(270deg);}
- 87.5% {-moz-transform:scale(0.6) rotate(270deg);}
- 87.51% {-moz-transform:scale(0.6) rotate(315deg);}
- 100% {-moz-transform:scale(0.6) rotate(315deg);}
-}
-/* Each circle */
-div.vjs-loading-spinner .ball1 { opacity: 0.12; position:absolute; left: 20px; top: 0px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball2 { opacity: 0.25; position:absolute; left: 34px; top: 6px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball3 { opacity: 0.37; position:absolute; left: 40px; top: 20px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball4 { opacity: 0.50; position:absolute; left: 34px; top: 34px; width: 13px; height: 13px; background: #fff;
- border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 15px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball5 { opacity: 0.62; position:absolute; left: 20px; top: 40px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball6 { opacity: 0.75; position:absolute; left: 6px; top: 34px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball7 { opacity: 0.87; position:absolute; left: 0px; top: 20px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
-
-div.vjs-loading-spinner .ball8 { opacity: 1.00; position:absolute; left: 6px; top: 6px; width: 13px; height: 13px; background: #fff;
- border-radius: 13px; -webkit-border-radius: 13px; -moz-border-radius: 13px; border: 1px solid #ccc; }
diff --git a/extlib/video-js/video-js.min.css b/extlib/video-js/video-js.min.css
index 4394cdd7..06c0e6b4 100644
--- a/extlib/video-js/video-js.min.css
+++ b/extlib/video-js/video-js.min.css
@@ -1 +1 @@
-.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js:-moz-full-screen{position:absolute}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0;width:100%!important;height:100%!important;_position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.vjs-poster{margin:0 auto;padding:0;cursor:pointer;position:relative;width:100%;max-height:100%}.video-js .vjs-subtitles{color:#fff;font-size:20px;text-align:center;position:absolute;bottom:40px;left:0;right:0}.vjs-fade-in{visibility:visible!important;opacity:1!important;-webkit-transition:visibility 0s linear 0s,opacity .3s linear;-moz-transition:visibility 0s linear 0s,opacity .3s linear;-ms-transition:visibility 0s linear 0s,opacity .3s linear;-o-transition:visibility 0s linear 0s,opacity .3s linear;transition:visibility 0s linear 0s,opacity .3s linear}.vjs-fade-out{visibility:hidden!important;opacity:0!important;-webkit-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-moz-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-ms-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-o-transition:visibility 0s linear 1.5s,opacity 1.5s linear;transition:visibility 0s linear 1.5s,opacity 1.5s linear}.vjs-default-skin .vjs-controls{position:absolute;bottom:0;left:0;right:0;margin:0;padding:0;height:2.6em;color:#fff;border-top:1px solid #404040;background:#242424;background:-moz-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(50%,#242424),color-stop(50%,#1f1f1f),color-stop(100%,#171717));background:-webkit-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-o-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-ms-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);visibility:hidden;opacity:0}.vjs-default-skin .vjs-control{position:relative;float:left;text-align:center;margin:0;padding:0;height:2.6em;width:2.6em}.vjs-default-skin .vjs-control:focus{outline:0}.vjs-default-skin .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-default-skin .vjs-play-control{width:5em;cursor:pointer!important}.vjs-default-skin.vjs-paused .vjs-play-control div{width:15px;height:17px;background:url('video-js.png');margin:.5em auto 0}.vjs-default-skin.vjs-playing .vjs-play-control div{width:15px;height:17px;background:url('video-js.png') -25px 0;margin:.5em auto 0}.vjs-default-skin .vjs-rewind-control{width:5em;cursor:pointer!important}.vjs-default-skin .vjs-rewind-control div{width:19px;height:16px;background:url('video-js.png');margin:.5em auto 0}.vjs-default-skin .vjs-mute-control{width:3.8em;cursor:pointer!important;float:right}.vjs-default-skin .vjs-mute-control div{width:22px;height:16px;background:url('video-js.png') -75px -25px;margin:.5em auto 0}.vjs-default-skin .vjs-mute-control.vjs-vol-0 div{background:url('video-js.png') 0 -25px}.vjs-default-skin .vjs-mute-control.vjs-vol-1 div{background:url('video-js.png') -25px -25px}.vjs-default-skin .vjs-mute-control.vjs-vol-2 div{background:url('video-js.png') -50px -25px}.vjs-default-skin .vjs-volume-control{width:5em;float:right}.vjs-default-skin .vjs-volume-bar{position:relative;width:5em;height:.6em;margin:1em auto 0;cursor:pointer!important;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-radius:.3em;background:#666;background:-moz-linear-gradient(top,#333,#666);background:-webkit-gradient(linear,0% 0,0% 100%,from(#333),to(#666));background:-webkit-linear-gradient(top,#333,#666);background:-o-linear-gradient(top,#333,#666);background:-ms-linear-gradient(top,#333,#666);background:linear-gradient(top,#333,#666)}.vjs-default-skin .vjs-volume-level{position:absolute;top:0;left:0;height:.6em;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-radius:.3em;background:#fff;background:-moz-linear-gradient(top,#fff,#ccc);background:-webkit-gradient(linear,0% 0,0% 100%,from(#fff),to(#ccc));background:-webkit-linear-gradient(top,#fff,#ccc);background:-o-linear-gradient(top,#fff,#ccc);background:-ms-linear-gradient(top,#fff,#ccc);background:linear-gradient(top,#fff,#ccc)}.vjs-default-skin .vjs-volume-handle{position:absolute;top:-0.2em;width:.8em;height:.8em;background:#ccc;left:0;border:1px solid #fff;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.vjs-default-skin div.vjs-progress-control{position:absolute;left:4.8em;right:4.8em;height:1.0em;width:auto;top:-1.3em;border-bottom:1px solid #1f1f1f;border-top:1px solid #222;background:#333;background:-moz-linear-gradient(top,#222,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));background:-webkit-linear-gradient(top,#222,#333);background:-o-linear-gradient(top,#333,#222);background:-ms-linear-gradient(top,#333,#222);background:linear-gradient(top,#333,#222)}.vjs-default-skin .vjs-progress-holder{position:relative;cursor:pointer!important;padding:0;margin:0;height:1.0em;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em;background:#111;background:-moz-linear-gradient(top,#111,#262626);background:-webkit-gradient(linear,0% 0,0% 100%,from(#111),to(#262626));background:-webkit-linear-gradient(top,#111,#262626);background:-o-linear-gradient(top,#111,#262626);background:-ms-linear-gradient(top,#111,#262626);background:linear-gradient(top,#111,#262626)}.vjs-default-skin .vjs-progress-holder .vjs-play-progress,.vjs-default-skin .vjs-progress-holder .vjs-load-progress{position:absolute;display:block;height:1.0em;margin:0;padding:0;left:0;top:0;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.vjs-default-skin .vjs-play-progress{background:#fff;background:-moz-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#fff),color-stop(50%,#d6d6d6),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-o-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-ms-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:#efefef;background:-moz-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#efefef),color-stop(50%,#f5f5f5),color-stop(50%,#dbdbdb),color-stop(100%,#f1f1f1));background:-webkit-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-o-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-ms-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef',endColorstr='#f1f1f1',GradientType=0);background:linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%)}.vjs-default-skin .vjs-load-progress{opacity:.8;background:#666;background:-moz-linear-gradient(top,#666,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#666),to(#333));background:-webkit-linear-gradient(top,#666,#333);background:-o-linear-gradient(top,#666,#333);background:-ms-linear-gradient(top,#666,#333);background:linear-gradient(top,#666,#333)}.vjs-default-skin div.vjs-seek-handle{position:absolute;width:16px;height:16px;margin-top:-0.3em;left:0;top:0;background:url('video-js.png') 0 -50px;-moz-border-radius:.8em;-webkit-border-radius:.8em;border-radius:.8em;-webkit-box-shadow:0 2px 4px 0 #000;-moz-box-shadow:0 2px 4px 0 #000;box-shadow:0 2px 4px 0 #000}.vjs-default-skin .vjs-time-controls{position:absolute;right:0;height:1.0em;width:4.8em;top:-1.3em;border-bottom:1px solid #1f1f1f;border-top:1px solid #222;background-color:#333;font-size:1em;line-height:1.0em;font-weight:normal;font-family:Helvetica,Arial,sans-serif;background:#333;background:-moz-linear-gradient(top,#222,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));background:-webkit-linear-gradient(top,#222,#333);background:-o-linear-gradient(top,#333,#222);background:-ms-linear-gradient(top,#333,#222);background:linear-gradient(top,#333,#222)}.vjs-default-skin .vjs-current-time{left:0}.vjs-default-skin .vjs-duration{right:0;display:none}.vjs-default-skin .vjs-remaining-time{right:0}.vjs-time-divider{display:none}.vjs-default-skin .vjs-time-control{font-size:1em;line-height:1;font-weight:normal;font-family:Helvetica,Arial,sans-serif}.vjs-default-skin .vjs-time-control span{line-height:25px}.vjs-secondary-controls{float:right}.vjs-default-skin .vjs-fullscreen-control{width:3.8em;cursor:pointer!important;float:right}.vjs-default-skin .vjs-fullscreen-control div{width:16px;height:16px;background:url('video-js.png') -50px 0;margin:.5em auto 0}.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control div{background:url('video-js.png') -75px 0}.vjs-default-skin .vjs-big-play-button{display:block;z-index:2;position:absolute;top:50%;left:50%;width:8.0em;height:8.0em;margin:-43px 0 0 -43px;text-align:center;vertical-align:center;cursor:pointer!important;border:.3em solid #fff;opacity:.95;-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;background:#454545;background:-moz-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#454545),color-stop(50%,#232323),color-stop(50%,#161616),color-stop(100%,#3f3f3f));background:-webkit-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-o-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-ms-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545',endColorstr='#3f3f3f',GradientType=0);background:linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);-webkit-box-shadow:4px 4px 8px #000;-moz-box-shadow:4px 4px 8px #000;box-shadow:4px 4px 8px #000}.vjs-default-skin div.vjs-big-play-button:hover{-webkit-box-shadow:0 0 80px #fff;-moz-box-shadow:0 0 80px #fff;box-shadow:0 0 80px #fff}.vjs-default-skin div.vjs-big-play-button span{position:absolute;top:50%;left:50%;display:block;width:35px;height:42px;margin:-20px 0 0 -15px;background:url('video-js.png') -100px 0}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;width:55px;height:55px;margin:-28px 0 0 -28px;-webkit-animation-name:rotatethis;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-moz-animation-name:rotatethis;-moz-animation-duration:1s;-moz-animation-iteration-count:infinite;-moz-animation-timing-function:linear}@-webkit-keyframes rotatethis{0%{-webkit-transform:scale(0.6) rotate(0deg)}12.5%{-webkit-transform:scale(0.6) rotate(0deg)}12.51%{-webkit-transform:scale(0.6) rotate(45deg)}25%{-webkit-transform:scale(0.6) rotate(45deg)}25.01%{-webkit-transform:scale(0.6) rotate(90deg)}37.5%{-webkit-transform:scale(0.6) rotate(90deg)}37.51%{-webkit-transform:scale(0.6) rotate(135deg)}50%{-webkit-transform:scale(0.6) rotate(135deg)}50.01%{-webkit-transform:scale(0.6) rotate(180deg)}62.5%{-webkit-transform:scale(0.6) rotate(180deg)}62.51%{-webkit-transform:scale(0.6) rotate(225deg)}75%{-webkit-transform:scale(0.6) rotate(225deg)}75.01%{-webkit-transform:scale(0.6) rotate(270deg)}87.5%{-webkit-transform:scale(0.6) rotate(270deg)}87.51%{-webkit-transform:scale(0.6) rotate(315deg)}100%{-webkit-transform:scale(0.6) rotate(315deg)}}@-moz-keyframes rotatethis{0%{-moz-transform:scale(0.6) rotate(0deg)}12.5%{-moz-transform:scale(0.6) rotate(0deg)}12.51%{-moz-transform:scale(0.6) rotate(45deg)}25%{-moz-transform:scale(0.6) rotate(45deg)}25.01%{-moz-transform:scale(0.6) rotate(90deg)}37.5%{-moz-transform:scale(0.6) rotate(90deg)}37.51%{-moz-transform:scale(0.6) rotate(135deg)}50%{-moz-transform:scale(0.6) rotate(135deg)}50.01%{-moz-transform:scale(0.6) rotate(180deg)}62.5%{-moz-transform:scale(0.6) rotate(180deg)}62.51%{-moz-transform:scale(0.6) rotate(225deg)}75%{-moz-transform:scale(0.6) rotate(225deg)}75.01%{-moz-transform:scale(0.6) rotate(270deg)}87.5%{-moz-transform:scale(0.6) rotate(270deg)}87.51%{-moz-transform:scale(0.6) rotate(315deg)}100%{-moz-transform:scale(0.6) rotate(315deg)}}div.vjs-loading-spinner .ball1{opacity:.12;position:absolute;left:20px;top:0;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball2{opacity:.25;position:absolute;left:34px;top:6px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball3{opacity:.37;position:absolute;left:40px;top:20px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball4{opacity:.50;position:absolute;left:34px;top:34px;width:13px;height:13px;background:#fff;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:15px;border:1px solid #ccc}div.vjs-loading-spinner .ball5{opacity:.62;position:absolute;left:20px;top:40px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball6{opacity:.75;position:absolute;left:6px;top:34px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball7{opacity:.87;position:absolute;left:0;top:20px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball8{opacity:1.00;position:absolute;left:6px;top:6px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc} \ No newline at end of file
+.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js:-moz-full-screen{position:absolute}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0;width:100%!important;height:100%!important;_position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.vjs-poster{margin:0 auto;padding:0;cursor:pointer;position:relative;width:100%;max-height:100%}.video-js .vjs-text-track-display{text-align:center;position:absolute;bottom:4em;left:1em;right:1em;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.video-js .vjs-text-track{display:none;color:#fff;font-size:1.4em;text-align:center;margin-bottom:.1em;background:#000;background:rgba(0,0,0,0.50)}.video-js .vjs-subtitles{color:#fff}.video-js .vjs-captions{color:#fc6}.vjs-tt-cue{display:block}.vjs-fade-in{visibility:visible!important;opacity:1!important;-webkit-transition:visibility 0s linear 0s,opacity .3s linear;-moz-transition:visibility 0s linear 0s,opacity .3s linear;-ms-transition:visibility 0s linear 0s,opacity .3s linear;-o-transition:visibility 0s linear 0s,opacity .3s linear;transition:visibility 0s linear 0s,opacity .3s linear}.vjs-fade-out{visibility:hidden!important;opacity:0!important;-webkit-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-moz-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-ms-transition:visibility 0s linear 1.5s,opacity 1.5s linear;-o-transition:visibility 0s linear 1.5s,opacity 1.5s linear;transition:visibility 0s linear 1.5s,opacity 1.5s linear}.vjs-default-skin .vjs-controls{position:absolute;bottom:0;left:0;right:0;margin:0;padding:0;height:2.6em;color:#fff;border-top:1px solid #404040;background:#242424;background:-moz-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(50%,#242424),color-stop(50%,#1f1f1f),color-stop(100%,#171717));background:-webkit-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-o-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:-ms-linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);background:linear-gradient(top,#242424 50%,#1f1f1f 50%,#171717 100%);visibility:hidden;opacity:0}.vjs-default-skin .vjs-control{position:relative;float:left;text-align:center;margin:0;padding:0;height:2.6em;width:2.6em}.vjs-default-skin .vjs-control:focus{outline:0}.vjs-default-skin .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-default-skin .vjs-play-control{width:5em;cursor:pointer!important}.vjs-default-skin.vjs-paused .vjs-play-control div{width:15px;height:17px;background:url('video-js.png');margin:.5em auto 0}.vjs-default-skin.vjs-playing .vjs-play-control div{width:15px;height:17px;background:url('video-js.png') -25px 0;margin:.5em auto 0}.vjs-default-skin .vjs-rewind-control{width:5em;cursor:pointer!important}.vjs-default-skin .vjs-rewind-control div{width:19px;height:16px;background:url('video-js.png');margin:.5em auto 0}.vjs-default-skin .vjs-mute-control{width:3.8em;cursor:pointer!important;float:right}.vjs-default-skin .vjs-mute-control div{width:22px;height:16px;background:url('video-js.png') -75px -25px;margin:.5em auto 0}.vjs-default-skin .vjs-mute-control.vjs-vol-0 div{background:url('video-js.png') 0 -25px}.vjs-default-skin .vjs-mute-control.vjs-vol-1 div{background:url('video-js.png') -25px -25px}.vjs-default-skin .vjs-mute-control.vjs-vol-2 div{background:url('video-js.png') -50px -25px}.vjs-default-skin .vjs-volume-control{width:5em;float:right}.vjs-default-skin .vjs-volume-bar{position:relative;width:5em;height:.6em;margin:1em auto 0;cursor:pointer!important;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-radius:.3em;background:#666;background:-moz-linear-gradient(top,#333,#666);background:-webkit-gradient(linear,0% 0,0% 100%,from(#333),to(#666));background:-webkit-linear-gradient(top,#333,#666);background:-o-linear-gradient(top,#333,#666);background:-ms-linear-gradient(top,#333,#666);background:linear-gradient(top,#333,#666)}.vjs-default-skin .vjs-volume-level{position:absolute;top:0;left:0;height:.6em;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-radius:.3em;background:#fff;background:-moz-linear-gradient(top,#fff,#ccc);background:-webkit-gradient(linear,0% 0,0% 100%,from(#fff),to(#ccc));background:-webkit-linear-gradient(top,#fff,#ccc);background:-o-linear-gradient(top,#fff,#ccc);background:-ms-linear-gradient(top,#fff,#ccc);background:linear-gradient(top,#fff,#ccc)}.vjs-default-skin .vjs-volume-handle{position:absolute;top:-0.2em;width:.8em;height:.8em;background:#ccc;left:0;border:1px solid #fff;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.vjs-default-skin div.vjs-progress-control{position:absolute;left:4.8em;right:4.8em;height:1.0em;width:auto;top:-1.3em;border-bottom:1px solid #1f1f1f;border-top:1px solid #222;background:#333;background:-moz-linear-gradient(top,#222,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));background:-webkit-linear-gradient(top,#222,#333);background:-o-linear-gradient(top,#333,#222);background:-ms-linear-gradient(top,#333,#222);background:linear-gradient(top,#333,#222)}.vjs-default-skin .vjs-progress-holder{position:relative;cursor:pointer!important;padding:0;margin:0;height:1.0em;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em;background:#111;background:-moz-linear-gradient(top,#111,#262626);background:-webkit-gradient(linear,0% 0,0% 100%,from(#111),to(#262626));background:-webkit-linear-gradient(top,#111,#262626);background:-o-linear-gradient(top,#111,#262626);background:-ms-linear-gradient(top,#111,#262626);background:linear-gradient(top,#111,#262626)}.vjs-default-skin .vjs-progress-holder .vjs-play-progress,.vjs-default-skin .vjs-progress-holder .vjs-load-progress{position:absolute;display:block;height:1.0em;margin:0;padding:0;left:0;top:0;-moz-border-radius:.6em;-webkit-border-radius:.6em;border-radius:.6em}.vjs-default-skin .vjs-play-progress{background:#fff;background:-moz-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#fff),color-stop(50%,#d6d6d6),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-o-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:-ms-linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:linear-gradient(top,#fff 0,#d6d6d6 50%,#fff 100%);background:#efefef;background:-moz-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#efefef),color-stop(50%,#f5f5f5),color-stop(50%,#dbdbdb),color-stop(100%,#f1f1f1));background:-webkit-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-o-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);background:-ms-linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef',endColorstr='#f1f1f1',GradientType=0);background:linear-gradient(top,#efefef 0,#f5f5f5 50%,#dbdbdb 50%,#f1f1f1 100%)}.vjs-default-skin .vjs-load-progress{opacity:.8;background:#666;background:-moz-linear-gradient(top,#666,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#666),to(#333));background:-webkit-linear-gradient(top,#666,#333);background:-o-linear-gradient(top,#666,#333);background:-ms-linear-gradient(top,#666,#333);background:linear-gradient(top,#666,#333)}.vjs-default-skin div.vjs-seek-handle{position:absolute;width:16px;height:16px;margin-top:-0.3em;left:0;top:0;background:url('video-js.png') 0 -50px;-moz-border-radius:.8em;-webkit-border-radius:.8em;border-radius:.8em;-webkit-box-shadow:0 2px 4px 0 #000;-moz-box-shadow:0 2px 4px 0 #000;box-shadow:0 2px 4px 0 #000}.vjs-default-skin .vjs-time-controls{position:absolute;right:0;height:1.0em;width:4.8em;top:-1.3em;border-bottom:1px solid #1f1f1f;border-top:1px solid #222;background-color:#333;font-size:1em;line-height:1.0em;font-weight:normal;font-family:Helvetica,Arial,sans-serif;background:#333;background:-moz-linear-gradient(top,#222,#333);background:-webkit-gradient(linear,0% 0,0% 100%,from(#222),to(#333));background:-webkit-linear-gradient(top,#222,#333);background:-o-linear-gradient(top,#333,#222);background:-ms-linear-gradient(top,#333,#222);background:linear-gradient(top,#333,#222)}.vjs-default-skin .vjs-current-time{left:0}.vjs-default-skin .vjs-duration{right:0;display:none}.vjs-default-skin .vjs-remaining-time{right:0}.vjs-time-divider{display:none}.vjs-default-skin .vjs-time-control{font-size:1em;line-height:1;font-weight:normal;font-family:Helvetica,Arial,sans-serif}.vjs-default-skin .vjs-time-control span{line-height:25px}.vjs-secondary-controls{float:right}.vjs-default-skin .vjs-fullscreen-control{width:3.8em;cursor:pointer!important;float:right}.vjs-default-skin .vjs-fullscreen-control div{width:16px;height:16px;background:url('video-js.png') -50px 0;margin:.5em auto 0}.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control div{background:url('video-js.png') -75px 0}.vjs-default-skin .vjs-big-play-button{display:block;z-index:2;position:absolute;top:50%;left:50%;width:8.0em;height:8.0em;margin:-42px 0 0 -42px;text-align:center;vertical-align:center;cursor:pointer!important;border:.2em solid #fff;opacity:.95;-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;background:#454545;background:-moz-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-webkit-gradient(linear,0% 0,0% 100%,color-stop(0%,#454545),color-stop(50%,#232323),color-stop(50%,#161616),color-stop(100%,#3f3f3f));background:-webkit-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-o-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);background:-ms-linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545',endColorstr='#3f3f3f',GradientType=0);background:linear-gradient(top,#454545 0,#232323 50%,#161616 50%,#3f3f3f 100%);-webkit-box-shadow:4px 4px 8px #000;-moz-box-shadow:4px 4px 8px #000;box-shadow:4px 4px 8px #000}.vjs-default-skin div.vjs-big-play-button:hover{-webkit-box-shadow:0 0 80px #fff;-moz-box-shadow:0 0 80px #fff;box-shadow:0 0 80px #fff}.vjs-default-skin div.vjs-big-play-button span{position:absolute;top:50%;left:50%;display:block;width:35px;height:42px;margin:-20px 0 0 -15px;background:url('video-js.png') -100px 0}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;width:55px;height:55px;margin:-28px 0 0 -28px;-webkit-animation-name:rotatethis;-webkit-animation-duration:1s;-webkit-animation-iteration-count:infinite;-webkit-animation-timing-function:linear;-moz-animation-name:rotatethis;-moz-animation-duration:1s;-moz-animation-iteration-count:infinite;-moz-animation-timing-function:linear}@-webkit-keyframes rotatethis{0%{-webkit-transform:scale(0.6) rotate(0deg)}12.5%{-webkit-transform:scale(0.6) rotate(0deg)}12.51%{-webkit-transform:scale(0.6) rotate(45deg)}25%{-webkit-transform:scale(0.6) rotate(45deg)}25.01%{-webkit-transform:scale(0.6) rotate(90deg)}37.5%{-webkit-transform:scale(0.6) rotate(90deg)}37.51%{-webkit-transform:scale(0.6) rotate(135deg)}50%{-webkit-transform:scale(0.6) rotate(135deg)}50.01%{-webkit-transform:scale(0.6) rotate(180deg)}62.5%{-webkit-transform:scale(0.6) rotate(180deg)}62.51%{-webkit-transform:scale(0.6) rotate(225deg)}75%{-webkit-transform:scale(0.6) rotate(225deg)}75.01%{-webkit-transform:scale(0.6) rotate(270deg)}87.5%{-webkit-transform:scale(0.6) rotate(270deg)}87.51%{-webkit-transform:scale(0.6) rotate(315deg)}100%{-webkit-transform:scale(0.6) rotate(315deg)}}@-moz-keyframes rotatethis{0%{-moz-transform:scale(0.6) rotate(0deg)}12.5%{-moz-transform:scale(0.6) rotate(0deg)}12.51%{-moz-transform:scale(0.6) rotate(45deg)}25%{-moz-transform:scale(0.6) rotate(45deg)}25.01%{-moz-transform:scale(0.6) rotate(90deg)}37.5%{-moz-transform:scale(0.6) rotate(90deg)}37.51%{-moz-transform:scale(0.6) rotate(135deg)}50%{-moz-transform:scale(0.6) rotate(135deg)}50.01%{-moz-transform:scale(0.6) rotate(180deg)}62.5%{-moz-transform:scale(0.6) rotate(180deg)}62.51%{-moz-transform:scale(0.6) rotate(225deg)}75%{-moz-transform:scale(0.6) rotate(225deg)}75.01%{-moz-transform:scale(0.6) rotate(270deg)}87.5%{-moz-transform:scale(0.6) rotate(270deg)}87.51%{-moz-transform:scale(0.6) rotate(315deg)}100%{-moz-transform:scale(0.6) rotate(315deg)}}div.vjs-loading-spinner .ball1{opacity:.12;position:absolute;left:20px;top:0;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball2{opacity:.25;position:absolute;left:34px;top:6px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball3{opacity:.37;position:absolute;left:40px;top:20px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball4{opacity:.50;position:absolute;left:34px;top:34px;width:13px;height:13px;background:#fff;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:15px;border:1px solid #ccc}div.vjs-loading-spinner .ball5{opacity:.62;position:absolute;left:20px;top:40px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball6{opacity:.75;position:absolute;left:6px;top:34px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball7{opacity:.87;position:absolute;left:0;top:20px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}div.vjs-loading-spinner .ball8{opacity:1.00;position:absolute;left:6px;top:6px;width:13px;height:13px;background:#fff;border-radius:13px;-webkit-border-radius:13px;-moz-border-radius:13px;border:1px solid #ccc}.vjs-default-skin .vjs-menu-button{float:right;margin:.2em .5em 0 0;padding:0;width:3em;height:2em;cursor:pointer!important;border:1px solid #111;-moz-border-radius:.3em;-webkit-border-radius:.3em;border-radius:.3em;background:#4d4d4d;background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%)}.vjs-default-skin .vjs-menu-button div{background:url('video-js.png') 0 -75px no-repeat;width:16px;height:16px;margin:.2em auto 0;padding:0}.vjs-default-skin .vjs-menu-button ul{display:none;opacity:.8;padding:0;margin:0;position:absolute;width:10em;bottom:2em;max-height:15em;left:-3.5em;background-color:#111;border:2px solid #333;-moz-border-radius:.7em;-webkit-border-radius:1em;border-radius:.5em;-webkit-box-shadow:0 2px 4px 0 #000;-moz-box-shadow:0 2px 4px 0 #000;box-shadow:0 2px 4px 0 #000;overflow:auto}.vjs-default-skin .vjs-menu-button:focus ul,.vjs-default-skin .vjs-menu-button:hover ul{display:block;list-style:none}.vjs-default-skin .vjs-menu-button ul li{list-style:none;margin:0;padding:.3em 0 .3em 20px;line-height:1.4em;font-size:1.2em;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;text-align:left}.vjs-default-skin .vjs-menu-button ul li.vjs-selected{text-decoration:underline;background:url('video-js.png') -125px -50px no-repeat}.vjs-default-skin .vjs-menu-button ul li:focus,.vjs-default-skin .vjs-menu-button ul li:hover,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:hover{background-color:#ccc;color:#111;outline:0}.vjs-default-skin .vjs-menu-button ul li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em 0;color:#fff;font-weight:bold;cursor:default;background:#4d4d4d;background:-moz-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#4d4d4d),color-stop(50%,#3f3f3f),color-stop(50%,#333),color-stop(100%,#252525));background:-webkit-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-o-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:-ms-linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%);background:linear-gradient(top,#4d4d4d 0,#3f3f3f 50%,#333 50%,#252525 100%)}.vjs-default-skin .vjs-captions-button div{background-position:-25px -75px}.vjs-default-skin .vjs-chapters-button div{background-position:-100px -75px}.vjs-default-skin .vjs-chapters-button ul{width:20em;left:-8.5em} \ No newline at end of file
diff --git a/extlib/video-js/video-js.png b/extlib/video-js/video-js.png
index c692d123..100bc7f8 100644
--- a/extlib/video-js/video-js.png
+++ b/extlib/video-js/video-js.png
Binary files differ
diff --git a/extlib/video-js/video-js.swf b/extlib/video-js/video-js.swf
deleted file mode 100644
index 3273af5a..00000000
--- a/extlib/video-js/video-js.swf
+++ /dev/null
Binary files differ
diff --git a/extlib/video-js/video.js b/extlib/video-js/video.js
deleted file mode 100644
index c41cceec..00000000
--- a/extlib/video-js/video.js
+++ /dev/null
@@ -1,3744 +0,0 @@
-/*!
-Video.js - HTML5 Video Player
-Version 3.1.0
-
-LGPL v3 LICENSE INFO
-This file is part of Video.js. Copyright 2011 Zencoder, Inc.
-
-Video.js is free software: you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-Video.js is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with Video.js. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-// Self-executing function to prevent global vars and help with minification
-;(function(window, undefined){
- var document = window.document;// HTML5 Shiv. Must be in <head> to support older browsers.
-document.createElement("video");document.createElement("audio");
-
-var VideoJS = function(id, addOptions, ready){
- var tag; // Element of ID
-
- // Allow for element or ID to be passed in
- // String ID
- if (typeof id == "string") {
-
- // Adjust for jQuery ID syntax
- if (id.indexOf("#") === 0) {
- id = id.slice(1);
- }
-
- // If a player instance has already been created for this ID return it.
- if (_V_.players[id]) {
- return _V_.players[id];
-
- // Otherwise get element for ID
- } else {
- tag = _V_.el(id)
- }
-
- // ID is a media element
- } else {
- tag = id;
- }
-
- // Check for a useable element
- if (!tag || !tag.nodeName) { // re: nodeName, could be a box div also
- throw new TypeError("The element or ID supplied is not valid. (VideoJS)"); // Returns
- }
-
- // Element may have a player attr referring to an already created player instance.
- // If not, set up a new player and return the instance.
- return tag.player || new _V_.Player(tag, addOptions, ready);
-},
-
-// Shortcut
-_V_ = VideoJS,
-
-// CDN Version. Used to target right flash swf.
-CDN_VERSION = "3.1";
-
-VideoJS.players = {};
-
-VideoJS.options = {
-
- // Default order of fallback technology
- techOrder: ["html5","flash"],
- // techOrder: ["flash","html5"],
-
- html5: {},
- flash: { swf: "http://vjs.zencdn.net/c/video-js.swf" },
-
- // Default of web browser is 300x150. Should rely on source width/height.
- width: "auto",
- height: "auto",
-
- // defaultVolume: 0.85,
- defaultVolume: 0.00, // The freakin seaguls are driving me crazy!
-
- // Included control sets
- components: {
- "poster": {},
- "loadingSpinner": {},
- "bigPlayButton": {},
- "controlBar": {},
- "subtitlesDisplay": {}
- }
-
- // components: [
- // "poster",
- // "loadingSpinner",
- // "bigPlayButton",
- // { name: "controlBar", options: {
- // components: [
- // "playToggle",
- // "fullscreenToggle",
- // "currentTimeDisplay",
- // "timeDivider",
- // "durationDisplay",
- // "remainingTimeDisplay",
- // { name: "progressControl", options: {
- // components: [
- // { name: "seekBar", options: {
- // components: [
- // "loadProgressBar",
- // "playProgressBar",
- // "seekHandle"
- // ]}
- // }
- // ]}
- // },
- // { name: "volumeControl", options: {
- // components: [
- // { name: "volumeBar", options: {
- // components: [
- // "volumeLevel",
- // "volumeHandle"
- // ]}
- // }
- // ]}
- // },
- // "muteToggle"
- // ]
- // }},
- // "subtitlesDisplay"/*, "replay"*/
- // ]
-};
-
-// Set CDN Version of swf
-if (CDN_VERSION != "GENERATED_CDN_VSN") {
- _V_.options.flash.swf = "http://vjs.zencdn.net/"+CDN_VERSION+"/video-js.swf"
-}
-
-// Automatically set up any tags that have a data-setup attribute
-_V_.autoSetup = function(){
- var options, vid, player,
- vids = document.getElementsByTagName("video");
-
- // Check if any media elements exist
- if (vids && vids.length > 0) {
-
- for (var i=0,j=vids.length; i<j; i++) {
- vid = vids[i];
-
- // Check if element exists, has getAttribute func.
- // IE seems to consider typeof el.getAttribute == "object" instead of "function" like expected, at least when loading the player immediately.
- if (vid && vid.getAttribute) {
-
- // Make sure this player hasn't already been set up.
- if (vid.player === undefined) {
- options = vid.getAttribute("data-setup");
-
- // Check if data-setup attr exists.
- // We only auto-setup if they've added the data-setup attr.
- if (options !== null) {
-
- // Parse options JSON
- // If empty string, make it a parsable json object.
- options = JSON.parse(options || "{}");
-
- // Create new video.js instance.
- player = _V_(vid, options);
- }
- }
-
- // If getAttribute isn't defined, we need to wait for the DOM.
- } else {
- _V_.autoSetupTimeout(1);
- break;
- }
- }
-
- // No videos were found, so keep looping unless page is finisehd loading.
- } else if (!_V_.windowLoaded) {
- _V_.autoSetupTimeout(1);
- }
-};
-
-// Pause to let the DOM keep processing
-_V_.autoSetupTimeout = function(wait){
- setTimeout(_V_.autoSetup, wait);
-};
-_V_.merge = function(obj1, obj2, safe){
- // Make sure second object exists
- if (!obj2) { obj2 = {}; };
-
- for (var attrname in obj2){
- if (obj2.hasOwnProperty(attrname) && (!safe || !obj1.hasOwnProperty(attrname))) { obj1[attrname]=obj2[attrname]; }
- }
- return obj1;
-};
-_V_.extend = function(obj){ this.merge(this, obj, true); };
-
-_V_.extend({
- tech: {}, // Holder for playback technology settings
- controlSets: {}, // Holder for control set definitions
-
- // Device Checks
- isIE: function(){ return !+"\v1"; },
- isFF: function(){ return !!_V_.ua.match("Firefox") },
- isIPad: function(){ return navigator.userAgent.match(/iPad/i) !== null; },
- isIPhone: function(){ return navigator.userAgent.match(/iPhone/i) !== null; },
- isIOS: function(){ return VideoJS.isIPhone() || VideoJS.isIPad(); },
- iOSVersion: function() {
- var match = navigator.userAgent.match(/OS (\d+)_/i);
- if (match && match[1]) { return match[1]; }
- },
- isAndroid: function(){ return navigator.userAgent.match(/Android.*AppleWebKit/i) !== null; },
- androidVersion: function() {
- var match = navigator.userAgent.match(/Android (\d+)\./i);
- if (match && match[1]) { return match[1]; }
- },
-
- testVid: document.createElement("video"),
- ua: navigator.userAgent,
- support: {},
-
- each: function(arr, fn){
- if (!arr || arr.length === 0) { return; }
- for (var i=0,j=arr.length; i<j; i++) {
- fn.call(this, arr[i], i);
- }
- },
-
- eachProp: function(obj, fn){
- if (!obj) { return; }
- for (var name in obj) {
- if (obj.hasOwnProperty(name)) {
- fn.call(this, name, obj[name]);
- }
- }
- },
-
- el: function(id){ return document.getElementById(id); },
- createElement: function(tagName, attributes){
- var el = document.createElement(tagName),
- attrname;
- for (attrname in attributes){
- if (attributes.hasOwnProperty(attrname)) {
- if (attrname.indexOf("-") !== -1) {
- el.setAttribute(attrname, attributes[attrname]);
- } else {
- el[attrname] = attributes[attrname];
- }
- }
- }
- return el;
- },
-
- insertFirst: function(node, parent){
- if (parent.firstChild) {
- parent.insertBefore(node, parent.firstChild);
- } else {
- parent.appendChild(node);
- }
- },
-
- addClass: function(element, classToAdd){
- if ((" "+element.className+" ").indexOf(" "+classToAdd+" ") == -1) {
- element.className = element.className === "" ? classToAdd : element.className + " " + classToAdd;
- }
- },
-
- removeClass: function(element, classToRemove){
- if (element.className.indexOf(classToRemove) == -1) { return; }
- var classNames = element.className.split(" ");
- classNames.splice(classNames.indexOf(classToRemove),1);
- element.className = classNames.join(" ");
- },
-
- remove: function(item, array){
- if (!array) return;
- var i = array.indexOf(item);
- if (i != -1) {
- return array.splice(i, 1)
- };
- },
-
- // Attempt to block the ability to select text while dragging controls
- blockTextSelection: function(){
- document.body.focus();
- document.onselectstart = function () { return false; };
- },
- // Turn off text selection blocking
- unblockTextSelection: function(){ document.onselectstart = function () { return true; }; },
-
- // Return seconds as H:MM:SS or M:SS
- // Supplying a guide (in seconds) will include enough leading zeros to cover the length of the guide
- formatTime: function(seconds, guide) {
- guide = guide || seconds; // Default to using seconds as guide
- var s = Math.floor(seconds % 60),
- m = Math.floor(seconds / 60 % 60),
- h = Math.floor(seconds / 3600),
- gm = Math.floor(guide / 60 % 60),
- gh = Math.floor(guide / 3600);
-
- // Check if we need to show hours
- h = (h > 0 || gh > 0) ? h + ":" : "";
-
- // If hours are showing, we may need to add a leading zero.
- // Always show at least one digit of minutes.
- m = (((h || gm >= 10) && m < 10) ? "0" + m : m) + ":";
-
- // Check if leading zero is need for seconds
- s = (s < 10) ? "0" + s : s;
-
- return h + m + s;
- },
-
- capitalize: function(string){
- return string.charAt(0).toUpperCase() + string.slice(1);
- },
-
- // Return the relative horizonal position of an event as a value from 0-1
- getRelativePosition: function(x, relativeElement){
- return Math.max(0, Math.min(1, (x - _V_.findPosX(relativeElement)) / relativeElement.offsetWidth));
- },
-
- getComputedStyleValue: function(element, style){
- return window.getComputedStyle(element, null).getPropertyValue(style);
- },
-
- trim: function(string){ return string.toString().replace(/^\s+/, "").replace(/\s+$/, ""); },
- round: function(num, dec) {
- if (!dec) { dec = 0; }
- return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
- },
-
- isEmpty: function(object) {
- for (var prop in object) {
- return false;
- }
- return true;
- },
-
- // Mimic HTML5 TimeRange Spec.
- createTimeRange: function(start, end){
- return {
- length: 1,
- start: function() { return start; },
- end: function() { return end; }
- };
- },
-
- /* Element Data Store. Allows for binding data to an element without putting it directly on the element.
- Ex. Event listneres are stored here.
- (also from jsninja.com)
- ================================================================================ */
- cache: {}, // Where the data is stored
- guid: 1, // Unique ID for the element
- expando: "vdata" + (new Date).getTime(), // Unique attribute to store element's guid in
-
- // Returns the cache object where data for the element is stored
- getData: function(elem){
- var id = elem[_V_.expando];
- if (!id) {
- id = elem[_V_.expando] = _V_.guid++;
- _V_.cache[id] = {};
- }
- return _V_.cache[id];
- },
- // Delete data for the element from the cache and the guid attr from element
- removeData: function(elem){
- var id = elem[_V_.expando];
- if (!id) { return; }
- // Remove all stored data
- delete _V_.cache[id];
- // Remove the expando property from the DOM node
- try {
- delete elem[_V_.expando];
- } catch(e) {
- if (elem.removeAttribute) {
- elem.removeAttribute(_V_.expando);
- } else {
- // IE doesn't appear to support removeAttribute on the document element
- elem[_V_.expando] = null;
- }
- }
- },
-
- /* Proxy (a.k.a Bind or Context). A simple method for changing the context of a function
- It also stores a unique id on the function so it can be easily removed from events
- ================================================================================ */
- proxy: function(context, fn) {
- // Make sure the function has a unique ID
- if (!fn.guid) { fn.guid = _V_.guid++; }
- // Create the new function that changes the context
- var ret = function() {
- return fn.apply(context, arguments);
- };
-
- // Give the new function the same ID
- // (so that they are equivalent and can be easily removed)
- ret.guid = fn.guid;
-
- return ret;
- },
-
- get: function(url, onSuccess, onError){
- // if (netscape.security.PrivilegeManager.enablePrivilege) {
- // netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
- // }
-
- var local = (url.indexOf("file:") == 0 || (window.location.href.indexOf("file:") == 0 && url.indexOf("http:") == -1));
-
- if (typeof XMLHttpRequest == "undefined") {
- XMLHttpRequest = function () {
- try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {}
- try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (f) {}
- try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (g) {}
- throw new Error("This browser does not support XMLHttpRequest.");
- };
- }
-
- var request = new XMLHttpRequest();
-
- try {
- request.open("GET", url);
- } catch(e) {
- _V_.log("VideoJS XMLHttpRequest (open)", e);
- // onError(e);
- return false;
- }
-
- request.onreadystatechange = _V_.proxy(this, function() {
- if (request.readyState == 4) {
- if (request.status == 200 || local && request.status == 0) {
- onSuccess(request.responseText);
- } else {
- if (onError) {
- onError();
- }
- }
- }
- });
-
- try {
- request.send();
- } catch(e) {
- _V_.log("VideoJS XMLHttpRequest (send)", e);
- if (onError) {
- onError(e);
- }
- }
- },
-
- /* Local Storage
- ================================================================================ */
- setLocalStorage: function(key, value){
- // IE was throwing errors referencing the var anywhere without this
- var localStorage = localStorage || false;
- if (!localStorage) { return; }
- try {
- localStorage[key] = value;
- } catch(e) {
- if (e.code == 22 || e.code == 1014) { // Webkit == 22 / Firefox == 1014
- _V_.log("LocalStorage Full (VideoJS)", e);
- } else {
- _V_.log("LocalStorage Error (VideoJS)", e);
- }
- }
- }
-
-});
-
-// usage: log('inside coolFunc', this, arguments);
-// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
-_V_.log = function(){
- _V_.log.history = _V_.log.history || [];// store logs to an array for reference
- _V_.log.history.push(arguments);
- if(window.console) {
- arguments.callee = arguments.callee.caller;
- var newarr = [].slice.call(arguments);
- (typeof console.log === 'object' ? _V_.log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));
- }
-};
-
-// make it safe to use console.log always
-(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
-{console.log();return window.console;}catch(err){return window.console={};}})());
-
-// Offset Left
-// getBoundingClientRect technique from John Resig http://ejohn.org/blog/getboundingclientrect-is-awesome/
-if ("getBoundingClientRect" in document.documentElement) {
- _V_.findPosX = function(el) {
- var box;
-
- try {
- box = el.getBoundingClientRect();
- } catch(e) {}
-
- if (!box) { return 0; }
-
- var docEl = document.documentElement,
- body = document.body,
- clientLeft = docEl.clientLeft || body.clientLeft || 0,
- scrollLeft = window.pageXOffset || body.scrollLeft,
- left = box.left + scrollLeft - clientLeft;
-
- return left;
- };
-} else {
- _V_.findPosX = function(el) {
- var curleft = el.offsetLeft;
- // _V_.log(obj.className, obj.offsetLeft)
- while(el = obj.offsetParent) {
- if (el.className.indexOf("video-js") == -1) {
- // _V_.log(el.offsetParent, "OFFSETLEFT", el.offsetLeft)
- // _V_.log("-webkit-full-screen", el.webkitMatchesSelector("-webkit-full-screen"));
- // _V_.log("-webkit-full-screen", el.querySelectorAll(".video-js:-webkit-full-screen"));
- } else {
- }
- curleft += el.offsetLeft;
- }
- return curleft;
- };
-}// Using John Resig's Class implementation http://ejohn.org/blog/simple-javascript-inheritance/
-// (function(){var initializing=false, fnTest=/xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/; _V_.Class = function(){}; _V_.Class.extend = function(prop) { var _super = this.prototype; initializing = true; var prototype = new this(); initializing = false; for (var name in prop) { prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn){ return function() { var tmp = this._super; this._super = _super[name]; var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } function Class() { if ( !initializing && this.init ) this.init.apply(this, arguments); } Class.prototype = prototype; Class.constructor = Class; Class.extend = arguments.callee; return Class;};})();
-(function(){
- var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
- _V_.Class = function(){};
- _V_.Class.extend = function(prop) {
- var _super = this.prototype;
- initializing = true;
- var prototype = new this();
- initializing = false;
- for (var name in prop) {
- prototype[name] = typeof prop[name] == "function" &&
- typeof _super[name] == "function" && fnTest.test(prop[name]) ?
- (function(name, fn){
- return function() {
- var tmp = this._super;
- this._super = _super[name];
- var ret = fn.apply(this, arguments);
- this._super = tmp;
- return ret;
- };
- })(name, prop[name]) :
- prop[name];
- }
- function Class() {
- if ( !initializing && this.init ) {
- return this.init.apply(this, arguments);
-
- // Attempting to recreate accessing function form of class.
- } else if (!initializing) {
- return arguments.callee.prototype.init()
- }
- }
- Class.prototype = prototype;
- Class.constructor = Class;
- Class.extend = arguments.callee;
- return Class;
- };
-})();
-
-/* Player Component- Base class for all UI objects
-================================================================================ */
-_V_.Component = _V_.Class.extend({
-
- init: function(player, options){
- this.player = player;
-
- // Allow for overridding default component options
- options = this.options = _V_.merge(this.options || {}, options);
-
- // Create element if one wasn't provided in options
- if (options.el) {
- this.el = options.el;
- } else {
- this.el = this.createElement();
- }
-
- // Add any components in options
- this.initComponents();
- },
-
- destroy: function(){},
-
- createElement: function(type, attrs){
- return _V_.createElement(type || "div", attrs);
- },
-
- buildCSSClass: function(){
- // Child classes can include a function that does:
- // return "CLASS NAME" + this._super();
- return "";
- },
-
- initComponents: function(){
- var options = this.options;
- if (options && options.components) {
- // Loop through components and add them to the player
- this.eachProp(options.components, function(name, opts){
-
- // Allow waiting to add components until a specific event is called
- var tempAdd = this.proxy(function(){
- this.addComponent(name, opts);
- });
-
- if (opts.loadEvent) {
- this.one(opts.loadEvent, tempAdd)
- } else {
- tempAdd();
- }
- });
- }
- },
-
- // Add child components to this component.
- // Will generate a new child component and then append child component's element to this component's element.
- // Takes either the name of the UI component class, or an object that contains a name, UI Class, and options.
- addComponent: function(name, options){
- var componentClass, component;
-
- // Make sure options is at least an empty object to protect against errors
- options = options || {};
-
- // Assume name of set is a lowercased name of the UI Class (PlayButton, etc.)
- componentClass = options.componentClass || _V_.capitalize(name);
-
- // Create a new object & element for this controls set
- // If there's no .player, this is a player
- component = new _V_[componentClass](this.player || this, options);
-
- // Add the UI object's element to the container div (box)
- this.el.appendChild(component.el);
-
- // Set property name on player. Could cause conflicts with other prop names, but it's worth making refs easy.
- this[name] = component;
- },
-
- /* Display
- ================================================================================ */
- show: function(){
- this.el.style.display = "block";
- },
-
- hide: function(){
- this.el.style.display = "none";
- },
-
- fadeIn: function(){
- this.removeClass("vjs-fade-out");
- this.addClass("vjs-fade-in");
- },
-
- fadeOut: function(){
- this.removeClass("vjs-fade-in");
- this.addClass("vjs-fade-out");
- },
-
- addClass: function(classToAdd){
- _V_.addClass(this.el, classToAdd);
- },
-
- removeClass: function(classToRemove){
- _V_.removeClass(this.el, classToRemove);
- },
-
- /* Events
- ================================================================================ */
- addEvent: function(type, fn){
- return _V_.addEvent(this.el, type, _V_.proxy(this, fn));
- },
- removeEvent: function(type, fn){
- return _V_.removeEvent(this.el, type, fn);
- },
- triggerEvent: function(type, e){
- return _V_.triggerEvent(this.el, type, e);
- },
- one: function(type, fn) {
- _V_.one.call(this, this.el, type, fn);
- },
-
- /* Ready - Trigger functions when component is ready
- ================================================================================ */
- ready: function(fn){
- if (!fn) return this;
-
- if (this.isReady) {
- fn.call(this);
- } else {
- if (this.readyQueue === undefined) {
- this.readyQueue = [];
- }
- this.readyQueue.push(fn);
- }
-
- return this;
- },
-
- triggerReady: function(){
- this.isReady = true;
- if (this.readyQueue && this.readyQueue.length > 0) {
- // Call all functions in ready queue
- this.each(this.readyQueue, function(fn){
- fn.call(this);
- });
-
- // Reset Ready Queue
- this.readyQueue = [];
- }
- },
-
- /* Utility
- ================================================================================ */
- each: function(arr, fn){ _V_.each.call(this, arr, fn); },
-
- eachProp: function(obj, fn){ _V_.eachProp.call(this, obj, fn); },
-
- extend: function(obj){ _V_.merge(this, obj) },
-
- // More easily attach 'this' to functions
- proxy: function(fn){ return _V_.proxy(this, fn); }
-
-});/* Control - Base class for all control elements
-================================================================================ */
-_V_.Control = _V_.Component.extend({
-
- buildCSSClass: function(){
- return "vjs-control " + this._super();
- }
-
-});
-
-/* Button - Base class for all buttons
-================================================================================ */
-_V_.Button = _V_.Control.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- this.addEvent("click", this.onClick);
- this.addEvent("focus", this.onFocus);
- this.addEvent("blur", this.onBlur);
- },
-
- createElement: function(type, attrs){
- // Add standard Aria and Tabindex info
- attrs = _V_.merge({
- className: this.buildCSSClass(),
- innerHTML: '<div><span class="vjs-control-text">' + (this.buttonText || "Need Text") + '</span></div>',
- role: "button",
- tabIndex: 0
- }, attrs);
-
- return this._super(type, attrs);
- },
-
- // Click - Override with specific functionality for button
- onClick: function(){},
-
- // Focus - Add keyboard functionality to element
- onFocus: function(){
- _V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
- },
-
- // KeyPress (document level) - Trigger click when keys are pressed
- onKeyPress: function(event){
- // Check for space bar (32) or enter (13) keys
- if (event.which == 32 || event.which == 13) {
- event.preventDefault();
- this.onClick();
- }
- },
-
- // Blur - Remove keyboard triggers
- onBlur: function(){
- _V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
- }
-
-});
-
-/* Play Button
-================================================================================ */
-_V_.PlayButton = _V_.Button.extend({
-
- buttonText: "Play",
-
- buildCSSClass: function(){
- return "vjs-play-button " + this._super();
- },
-
- onClick: function(){
- this.player.play();
- }
-
-});
-
-/* Pause Button
-================================================================================ */
-_V_.PauseButton = _V_.Button.extend({
-
- buttonText: "Pause",
-
- buildCSSClass: function(){
- return "vjs-pause-button " + this._super();
- },
-
- onClick: function(){
- this.player.pause();
- }
-
-});
-
-/* Play Toggle - Play or Pause Media
-================================================================================ */
-_V_.PlayToggle = _V_.Button.extend({
-
- buttonText: "Play",
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("play", _V_.proxy(this, this.onPlay));
- player.addEvent("pause", _V_.proxy(this, this.onPause));
- },
-
- buildCSSClass: function(){
- return "vjs-play-control " + this._super();
- },
-
- // OnClick - Toggle between play and pause
- onClick: function(){
- if (this.player.paused()) {
- this.player.play();
- } else {
- this.player.pause();
- }
- },
-
- // OnPlay - Add the vjs-playing class to the element so it can change appearance
- onPlay: function(){
- _V_.removeClass(this.el, "vjs-paused");
- _V_.addClass(this.el, "vjs-playing");
- },
-
- // OnPause - Add the vjs-paused class to the element so it can change appearance
- onPause: function(){
- _V_.removeClass(this.el, "vjs-playing");
- _V_.addClass(this.el, "vjs-paused");
- }
-
-});
-
-
-/* Fullscreen Toggle Behaviors
-================================================================================ */
-_V_.FullscreenToggle = _V_.Button.extend({
-
- buttonText: "Fullscreen",
-
- buildCSSClass: function(){
- return "vjs-fullscreen-control " + this._super();
- },
-
- onClick: function(){
- if (!this.player.isFullScreen) {
- this.player.requestFullScreen();
- } else {
- this.player.cancelFullScreen();
- }
- }
-
-});
-
-/* Big Play Button
-================================================================================ */
-_V_.BigPlayButton = _V_.Button.extend({
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("play", _V_.proxy(this, this.hide));
- player.addEvent("ended", _V_.proxy(this, this.show));
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-big-play-button",
- innerHTML: "<span></span>"
- });
- },
-
- onClick: function(){
- // Go back to the beginning if big play button is showing at the end.
- // Have to check for current time otherwise it might throw a 'not ready' error.
- if(this.player.currentTime()) {
- this.player.currentTime(0);
- }
- this.player.play();
- }
-});
-
-/* Loading Spinner
-================================================================================ */
-_V_.LoadingSpinner = _V_.Component.extend({
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("canplay", _V_.proxy(this, this.hide));
- player.addEvent("canplaythrough", _V_.proxy(this, this.hide));
- player.addEvent("playing", _V_.proxy(this, this.hide));
-
- player.addEvent("seeking", _V_.proxy(this, this.show));
- player.addEvent("error", _V_.proxy(this, this.show));
-
- // Not showing spinner on stalled any more. Browsers may stall and then not trigger any events that would remove the spinner.
- // Checked in Chrome 16 and Safari 5.1.2. http://help.videojs.com/discussions/problems/883-why-is-the-download-progress-showing
- // player.addEvent("stalled", _V_.proxy(this, this.show));
-
- player.addEvent("waiting", _V_.proxy(this, this.show));
- },
-
- createElement: function(){
-
- var classNameSpinner, innerHtmlSpinner;
-
- if ( typeof this.player.el.style.WebkitBorderRadius == "string"
- || typeof this.player.el.style.MozBorderRadius == "string"
- || typeof this.player.el.style.KhtmlBorderRadius == "string"
- || typeof this.player.el.style.borderRadius == "string")
- {
- classNameSpinner = "vjs-loading-spinner";
- innerHtmlSpinner = "<div class='ball1'></div><div class='ball2'></div><div class='ball3'></div><div class='ball4'></div><div class='ball5'></div><div class='ball6'></div><div class='ball7'></div><div class='ball8'></div>";
- } else {
- classNameSpinner = "vjs-loading-spinner-fallback";
- innerHtmlSpinner = "";
- }
-
- return this._super("div", {
- className: classNameSpinner,
- innerHTML: innerHtmlSpinner
- });
- }
-});
-
-/* Control Bar
-================================================================================ */
-_V_.ControlBar = _V_.Component.extend({
-
- options: {
- loadEvent: "play",
- components: {
- "playToggle": {},
- "fullscreenToggle": {},
- "currentTimeDisplay": {},
- "timeDivider": {},
- "durationDisplay": {},
- "remainingTimeDisplay": {},
- "progressControl": {},
- "volumeControl": {},
- "muteToggle": {}
- }
- },
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("play", this.proxy(function(){
- this.fadeIn();
- this.player.addEvent("mouseover", this.proxy(this.fadeIn));
- this.player.addEvent("mouseout", this.proxy(this.fadeOut));
- }));
- },
-
- createElement: function(){
- return _V_.createElement("div", {
- className: "vjs-controls"
- });
- },
-
- fadeIn: function(){
- this._super();
- this.player.triggerEvent("controlsvisible");
- },
-
- fadeOut: function(){
- this._super();
- this.player.triggerEvent("controlshidden");
- }
-});
-
-/* Time
-================================================================================ */
-_V_.CurrentTimeDisplay = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
- },
-
- createElement: function(){
- var el = this._super("div", {
- className: "vjs-current-time vjs-time-controls vjs-control"
- });
-
- this.content = _V_.createElement("div", {
- className: "vjs-current-time-display",
- innerHTML: '0:00'
- });
-
- el.appendChild(_V_.createElement("div").appendChild(this.content));
- return el;
- },
-
- updateContent: function(){
- // Allows for smooth scrubbing, when player can't keep up.
- var time = (this.player.scrubbing) ? this.player.values.currentTime : this.player.currentTime();
- this.content.innerHTML = _V_.formatTime(time, this.player.duration());
- }
-
-});
-
-_V_.DurationDisplay = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
- },
-
- createElement: function(){
- var el = this._super("div", {
- className: "vjs-duration vjs-time-controls vjs-control"
- });
-
- this.content = _V_.createElement("div", {
- className: "vjs-duration-display",
- innerHTML: '0:00'
- });
-
- el.appendChild(_V_.createElement("div").appendChild(this.content));
- return el;
- },
-
- updateContent: function(){
- if (this.player.duration()) { this.content.innerHTML = _V_.formatTime(this.player.duration()); }
- }
-
-});
-
-// Time Separator (Not used in main skin, but still available, and could be used as a 'spare element')
-_V_.TimeDivider = _V_.Component.extend({
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-time-divider",
- innerHTML: '<div><span>/</span></div>'
- });
- }
-
-});
-
-_V_.RemainingTimeDisplay = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("timeupdate", _V_.proxy(this, this.updateContent));
- },
-
- createElement: function(){
- var el = this._super("div", {
- className: "vjs-remaining-time vjs-time-controls vjs-control"
- });
-
- this.content = _V_.createElement("div", {
- className: "vjs-remaining-time-display",
- innerHTML: '-0:00'
- });
-
- el.appendChild(_V_.createElement("div").appendChild(this.content));
- return el;
- },
-
- updateContent: function(){
- if (this.player.duration()) { this.content.innerHTML = "-"+_V_.formatTime(this.player.remainingTime()); }
-
- // Allows for smooth scrubbing, when player can't keep up.
- // var time = (this.player.scrubbing) ? this.player.values.currentTime : this.player.currentTime();
- // this.content.innerHTML = _V_.formatTime(time, this.player.duration());
- }
-
-});
-
-/* Slider - Parent for seek bar and volume slider
-================================================================================ */
-_V_.Slider = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent(this.playerEvent, _V_.proxy(this, this.update));
-
- this.addEvent("mousedown", this.onMouseDown);
- this.addEvent("focus", this.onFocus);
- this.addEvent("blur", this.onBlur);
-
- this.player.addEvent("controlsvisible", this.proxy(this.update));
-
- // This is actually to fix the volume handle position. http://twitter.com/#!/gerritvanaaken/status/159046254519787520
- // this.player.one("timeupdate", this.proxy(this.update));
-
- this.update();
- },
-
- createElement: function(type, attrs) {
- attrs = _V_.merge({
- role: "slider",
- "aria-valuenow": 0,
- "aria-valuemin": 0,
- "aria-valuemax": 100,
- tabIndex: 0
- }, attrs);
-
- return this._super(type, attrs);
- },
-
- onMouseDown: function(event){
- event.preventDefault();
- _V_.blockTextSelection();
-
- _V_.addEvent(document, "mousemove", _V_.proxy(this, this.onMouseMove));
- _V_.addEvent(document, "mouseup", _V_.proxy(this, this.onMouseUp));
-
- this.onMouseMove(event);
- },
-
- onMouseUp: function(event) {
- _V_.unblockTextSelection();
- _V_.removeEvent(document, "mousemove", this.onMouseMove, false);
- _V_.removeEvent(document, "mouseup", this.onMouseUp, false);
-
- this.update();
- },
-
- update: function(){
- // If scrubbing, we could use a cached value to make the handle keep up with the user's mouse.
- // On HTML5 browsers scrubbing is really smooth, but some flash players are slow, so we might want to utilize this later.
- // var progress = (this.player.scrubbing) ? this.player.values.currentTime / this.player.duration() : this.player.currentTime() / this.player.duration();
-
- var barProgress,
- progress = this.getPercent();
- handle = this.handle,
- bar = this.bar;
-
- // Protect against no duration and other division issues
- if (isNaN(progress)) { progress = 0; }
-
- barProgress = progress;
-
- // If there is a handle, we need to account for the handle in our calculation for progress bar
- // so that it doesn't fall short of or extend past the handle.
- if (handle) {
-
- var box = this.el,
- boxWidth = box.offsetWidth,
-
- handleWidth = handle.el.offsetWidth,
-
- // The width of the handle in percent of the containing box
- // In IE, widths may not be ready yet causing NaN
- handlePercent = (handleWidth) ? handleWidth / boxWidth : 0,
-
- // Get the adjusted size of the box, considering that the handle's center never touches the left or right side.
- // There is a margin of half the handle's width on both sides.
- boxAdjustedPercent = 1 - handlePercent;
-
- // Adjust the progress that we'll use to set widths to the new adjusted box width
- adjustedProgress = progress * boxAdjustedPercent,
-
- // The bar does reach the left side, so we need to account for this in the bar's width
- barProgress = adjustedProgress + (handlePercent / 2);
-
- // Move the handle from the left based on the adjected progress
- handle.el.style.left = _V_.round(adjustedProgress * 100, 2) + "%";
- }
-
- // Set the new bar width
- bar.el.style.width = _V_.round(barProgress * 100, 2) + "%";
- },
-
- calculateDistance: function(event){
- var box = this.el,
- boxX = _V_.findPosX(box),
- boxW = box.offsetWidth,
- handle = this.handle;
-
- if (handle) {
- var handleW = handle.el.offsetWidth;
-
- // Adjusted X and Width, so handle doesn't go outside the bar
- boxX = boxX + (handleW / 2);
- boxW = boxW - handleW;
- }
-
- // Percent that the click is through the adjusted area
- return Math.max(0, Math.min(1, (event.pageX - boxX) / boxW));
- },
-
- onFocus: function(event){
- _V_.addEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
- },
-
- onKeyPress: function(event){
- if (event.which == 37) { // Left Arrow
- event.preventDefault();
- this.stepBack();
- } else if (event.which == 39) { // Right Arrow
- event.preventDefault();
- this.stepForward();
- }
- },
-
- onBlur: function(event){
- _V_.removeEvent(document, "keyup", _V_.proxy(this, this.onKeyPress));
- }
-});
-
-
-/* Progress
-================================================================================ */
-
-// Progress Control: Seek, Load Progress, and Play Progress
-_V_.ProgressControl = _V_.Component.extend({
-
- options: {
- components: {
- "seekBar": {}
- }
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-progress-control vjs-control"
- });
- }
-
-});
-
-// Seek Bar and holder for the progress bars
-_V_.SeekBar = _V_.Slider.extend({
-
- options: {
- components: {
- "loadProgressBar": {},
-
- // Set property names to bar and handle to match with the parent Slider class is looking for
- "bar": { componentClass: "PlayProgressBar" },
- "handle": { componentClass: "SeekHandle" }
- }
- },
-
- playerEvent: "timeupdate",
-
- init: function(player, options){
- this._super(player, options);
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-progress-holder"
- });
- },
-
- getPercent: function(){
- return this.player.currentTime() / this.player.duration();
- },
-
- onMouseDown: function(event){
- this._super(event);
-
- this.player.scrubbing = true;
-
- this.videoWasPlaying = !this.player.paused();
- this.player.pause();
- },
-
- onMouseMove: function(event){
- var newTime = this.calculateDistance(event) * this.player.duration();
-
- // Don't let video end while scrubbing.
- if (newTime == this.player.duration()) { newTime = newTime - 0.1; }
-
- // Set new time (tell player to seek to new time)
- this.player.currentTime(newTime);
- },
-
- onMouseUp: function(event){
- this._super(event);
-
- this.player.scrubbing = false;
- if (this.videoWasPlaying) {
- this.player.play();
- }
- },
-
- stepForward: function(){
- this.player.currentTime(this.player.currentTime() + 1);
- },
-
- stepBack: function(){
- this.player.currentTime(this.player.currentTime() - 1);
- }
-
-});
-
-// Load Progress Bar
-_V_.LoadProgressBar = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
- player.addEvent("progress", _V_.proxy(this, this.update));
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-load-progress",
- innerHTML: '<span class="vjs-control-text">Loaded: 0%</span>'
- });
- },
-
- update: function(){
- if (this.el.style) { this.el.style.width = _V_.round(this.player.bufferedPercent() * 100, 2) + "%"; }
- }
-
-});
-
-// Play Progress Bar
-_V_.PlayProgressBar = _V_.Component.extend({
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-play-progress",
- innerHTML: '<span class="vjs-control-text">Progress: 0%</span>'
- });
- }
-
-});
-
-// Seek Handle
-// SeekBar Behavior includes play progress bar, and seek handle
-// Needed so it can determine seek position based on handle position/size
-_V_.SeekHandle = _V_.Component.extend({
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-seek-handle",
- innerHTML: '<span class="vjs-control-text">00:00</span>'
- });
- }
-
-});
-
-/* Volume Scrubber
-================================================================================ */
-// Progress Control: Seek, Load Progress, and Play Progress
-_V_.VolumeControl = _V_.Component.extend({
-
- options: {
- components: {
- "volumeBar": {}
- }
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-volume-control vjs-control"
- });
- }
-
-});
-
-_V_.VolumeBar = _V_.Slider.extend({
-
- options: {
- components: {
- "bar": { componentClass: "VolumeLevel" },
- "handle": { componentClass: "VolumeHandle" }
- }
- },
-
- playerEvent: "volumechange",
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-volume-bar"
- });
- },
-
- onMouseMove: function(event) {
- this.player.volume(this.calculateDistance(event));
- },
-
- getPercent: function(){
- return this.player.volume();
- },
-
- stepForward: function(){
- this.player.volume(this.player.volume() + 0.1);
- },
-
- stepBack: function(){
- this.player.volume(this.player.volume() - 0.1);
- }
-});
-
-_V_.VolumeLevel = _V_.Component.extend({
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-volume-level",
- innerHTML: '<span class="vjs-control-text"></span>'
- });
- }
-
-});
-
-_V_.VolumeHandle = _V_.Component.extend({
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-volume-handle",
- innerHTML: '<span class="vjs-control-text"></span>'
- // tabindex: 0,
- // role: "slider", "aria-valuenow": 0, "aria-valuemin": 0, "aria-valuemax": 100
- });
- }
-
-});
-
-_V_.MuteToggle = _V_.Button.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent("volumechange", _V_.proxy(this, this.update));
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-mute-control vjs-control",
- innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
- });
- },
-
- onClick: function(event){
- this.player.muted( this.player.muted() ? false : true );
- },
-
- update: function(event){
- var vol = this.player.volume(),
- level = 3;
-
- if (vol == 0 || this.player.muted()) {
- level = 0;
- } else if (vol < 0.33) {
- level = 1;
- } else if (vol < 0.67) {
- level = 2;
- }
-
- /* TODO improve muted icon classes */
- _V_.each.call(this, [0,1,2,3], function(i){
- _V_.removeClass(this.el, "vjs-vol-"+i);
- });
- _V_.addClass(this.el, "vjs-vol-"+level);
- }
-
-});
-
-
-/* Poster Image
-================================================================================ */
-_V_.Poster = _V_.Button.extend({
- init: function(player, options){
- this._super(player, options);
-
- if (!this.player.options.poster) {
- this.hide();
- }
-
- player.addEvent("play", _V_.proxy(this, this.hide));
- },
-
- createElement: function(){
- return _V_.createElement("img", {
- className: "vjs-poster",
- src: this.player.options.poster,
-
- // Don't want poster to be tabbable.
- tabIndex: -1
- });
- },
-
- onClick: function(){
- this.player.play();
- }
-});
-
-
-/* Text Track Displays
-================================================================================ */
-// Create a behavior type for each text track type (subtitlesDisplay, captionsDisplay, etc.).
-// Then you can easily do something like.
-// player.addBehavior(myDiv, "subtitlesDisplay");
-// And the myDiv's content will be updated with the text change.
-
-// Base class for all track displays. Should not be instantiated on its own.
-_V_.TextTrackDisplay = _V_.Component.extend({
-
- init: function(player, options){
- this._super(player, options);
-
- player.addEvent(this.trackType + "update", _V_.proxy(this, this.update));
- },
-
- createElement: function(){
- return this._super("div", {
- className: "vjs-" + this.trackType
- });
- },
-
- update: function(){
- this.el.innerHTML = this.player.textTrackValue(this.trackType);
- }
-
-});
-
-_V_.SubtitlesDisplay = _V_.TextTrackDisplay.extend({
-
- trackType: "subtitles"
-
-});
-
-_V_.CaptionsDisplay = _V_.TextTrackDisplay.extend({
-
- trackType: "captions"
-
-});
-
-_V_.ChaptersDisplay = _V_.TextTrackDisplay.extend({
-
- trackType: "chapters"
-
-});
-
-_V_.DescriptionsDisplay = _V_.TextTrackDisplay.extend({
-
- trackType: "descriptions"
-
-});// ECMA-262 is the standard for javascript.
-// The following methods are impelemented EXACTLY as described in the standard (according to Mozilla Docs), and do not override the default method if one exists.
-// This may conflict with other libraries that modify the array prototype, but those libs should update to use the standard.
-
-// [].indexOf
-// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
-if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
- "use strict";
- if (this === void 0 || this === null) {
- throw new TypeError();
- }
- var t = Object(this);
- var len = t.length >>> 0;
- if (len === 0) {
- return -1;
- }
- var n = 0;
- if (arguments.length > 0) {
- n = Number(arguments[1]);
- if (n !== n) { // shortcut for verifying if it's NaN
- n = 0;
- } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- }
- }
- if (n >= len) {
- return -1;
- }
- var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
- for (; k < len; k++) {
- if (k in t && t[k] === searchElement) {
- return k;
- }
- }
- return -1;
- }
-}
-
-// NOT NEEDED YET
-// [].lastIndexOf
-// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
-// if (!Array.prototype.lastIndexOf)
-// {
-// Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/)
-// {
-// "use strict";
-//
-// if (this === void 0 || this === null)
-// throw new TypeError();
-//
-// var t = Object(this);
-// var len = t.length >>> 0;
-// if (len === 0)
-// return -1;
-//
-// var n = len;
-// if (arguments.length > 1)
-// {
-// n = Number(arguments[1]);
-// if (n !== n)
-// n = 0;
-// else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0))
-// n = (n > 0 || -1) * Math.floor(Math.abs(n));
-// }
-//
-// var k = n >= 0
-// ? Math.min(n, len - 1)
-// : len - Math.abs(n);
-//
-// for (; k >= 0; k--)
-// {
-// if (k in t && t[k] === searchElement)
-// return k;
-// }
-// return -1;
-// };
-// }
-
-
-// NOT NEEDED YET
-// Array forEach per ECMA standard https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/foreach
-// Production steps of ECMA-262, Edition 5, 15.4.4.18
-// Reference: http://es5.github.com/#x15.4.4.18
-// if ( !Array.prototype.forEach ) {
-//
-// Array.prototype.forEach = function( callback, thisArg ) {
-//
-// var T, k;
-//
-// if ( this == null ) {
-// throw new TypeError( " this is null or not defined" );
-// }
-//
-// // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
-// var O = Object(this);
-//
-// // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
-// // 3. Let len be ToUint32(lenValue).
-// var len = O.length >>> 0;
-//
-// // 4. If IsCallable(callback) is false, throw a TypeError exception.
-// // See: http://es5.github.com/#x9.11
-// if ( {}.toString.call(callback) != "[object Function]" ) {
-// throw new TypeError( callback + " is not a function" );
-// }
-//
-// // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
-// if ( thisArg ) {
-// T = thisArg;
-// }
-//
-// // 6. Let k be 0
-// k = 0;
-//
-// // 7. Repeat, while k < len
-// while( k < len ) {
-//
-// var kValue;
-//
-// // a. Let Pk be ToString(k).
-// // This is implicit for LHS operands of the in operator
-// // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
-// // This step can be combined with c
-// // c. If kPresent is true, then
-// if ( k in O ) {
-//
-// // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
-// kValue = O[ Pk ];
-//
-// // ii. Call the Call internal method of callback with T as the this value and
-// // argument list containing kValue, k, and O.
-// callback.call( T, kValue, k, O );
-// }
-// // d. Increase k by 1.
-// k++;
-// }
-// // 8. return undefined
-// };
-// }
-
-
-// NOT NEEDED YET
-// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/map
-// Production steps of ECMA-262, Edition 5, 15.4.4.19
-// Reference: http://es5.github.com/#x15.4.4.19
-// if (!Array.prototype.map) {
-// Array.prototype.map = function(callback, thisArg) {
-//
-// var T, A, k;
-//
-// if (this == null) {
-// throw new TypeError(" this is null or not defined");
-// }
-//
-// // 1. Let O be the result of calling ToObject passing the |this| value as the argument.
-// var O = Object(this);
-//
-// // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length".
-// // 3. Let len be ToUint32(lenValue).
-// var len = O.length >>> 0;
-//
-// // 4. If IsCallable(callback) is false, throw a TypeError exception.
-// // See: http://es5.github.com/#x9.11
-// if ({}.toString.call(callback) != "[object Function]") {
-// throw new TypeError(callback + " is not a function");
-// }
-//
-// // 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
-// if (thisArg) {
-// T = thisArg;
-// }
-//
-// // 6. Let A be a new array created as if by the expression new Array(len) where Array is
-// // the standard built-in constructor with that name and len is the value of len.
-// A = new Array(len);
-//
-// // 7. Let k be 0
-// k = 0;
-//
-// // 8. Repeat, while k < len
-// while(k < len) {
-//
-// var kValue, mappedValue;
-//
-// // a. Let Pk be ToString(k).
-// // This is implicit for LHS operands of the in operator
-// // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk.
-// // This step can be combined with c
-// // c. If kPresent is true, then
-// if (k in O) {
-//
-// // i. Let kValue be the result of calling the Get internal method of O with argument Pk.
-// kValue = O[ k ];
-//
-// // ii. Let mappedValue be the result of calling the Call internal method of callback
-// // with T as the this value and argument list containing kValue, k, and O.
-// mappedValue = callback.call(T, kValue, k, O);
-//
-// // iii. Call the DefineOwnProperty internal method of A with arguments
-// // Pk, Property Descriptor {Value: mappedValue, Writable: true, Enumerable: true, Configurable: true},
-// // and false.
-//
-// // In browsers that support Object.defineProperty, use the following:
-// // Object.defineProperty(A, Pk, { value: mappedValue, writable: true, enumerable: true, configurable: true });
-//
-// // For best browser support, use the following:
-// A[ k ] = mappedValue;
-// }
-// // d. Increase k by 1.
-// k++;
-// }
-//
-// // 9. return A
-// return A;
-// };
-// }
-// Event System (J.Resig - Secrets of a JS Ninja http://jsninja.com/ [Go read it, really])
-// (Book version isn't completely usable, so fixed some things and borrowed from jQuery where it's working)
-//
-// This should work very similarly to jQuery's events, however it's based off the book version which isn't as
-// robust as jquery's, so there's probably some differences.
-//
-// When you add an event listener using _V_.addEvent,
-// it stores the handler function in seperate cache object,
-// and adds a generic handler to the element's event,
-// along with a unique id (guid) to the element.
-
-_V_.extend({
-
- // Add an event listener to element
- // It stores the handler function in a separate cache object
- // and adds a generic handler to the element's event,
- // along with a unique id (guid) to the element.
- addEvent: function(elem, type, fn){
- var data = _V_.getData(elem), handlers;
-
- // We only need to generate one handler per element
- if (data && !data.handler) {
- // Our new meta-handler that fixes the event object and the context
- data.handler = function(event){
- event = _V_.fixEvent(event);
- var handlers = _V_.getData(elem).events[event.type];
- // Go through and call all the real bound handlers
- if (handlers) {
-
- // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.
- var handlersCopy = [];
- _V_.each(handlers, function(handler, i){
- handlersCopy[i] = handler;
- })
-
- for (var i = 0, l = handlersCopy.length; i < l; i++) {
- handlersCopy[i].call(elem, event);
- }
- }
- };
- }
-
- // We need a place to store all our event data
- if (!data.events) { data.events = {}; }
-
- // And a place to store the handlers for this event type
- handlers = data.events[type];
-
- if (!handlers) {
- handlers = data.events[ type ] = [];
-
- // Attach our meta-handler to the element, since one doesn't exist
- if (document.addEventListener) {
- elem.addEventListener(type, data.handler, false);
- } else if (document.attachEvent) {
- elem.attachEvent("on" + type, data.handler);
- }
- }
-
- if (!fn.guid) { fn.guid = _V_.guid++; }
-
- handlers.push(fn);
- },
-
- removeEvent: function(elem, type, fn) {
- var data = _V_.getData(elem), handlers;
- // If no events exist, nothing to unbind
- if (!data.events) { return; }
-
- // Are we removing all bound events?
- if (!type) {
- for (type in data.events) {
- _V_.cleanUpEvents(elem, type);
- }
- return;
- }
-
- // And a place to store the handlers for this event type
- handlers = data.events[type];
-
- // If no handlers exist, nothing to unbind
- if (!handlers) { return; }
-
- // See if we're only removing a single handler
- if (fn && fn.guid) {
- for (var i = 0; i < handlers.length; i++) {
- // We found a match (don't stop here, there could be a couple bound)
- if (handlers[i].guid === fn.guid) {
- // Remove the handler from the array of handlers
- handlers.splice(i--, 1);
- }
- }
- }
-
- _V_.cleanUpEvents(elem, type);
- },
-
- cleanUpEvents: function(elem, type) {
- var data = _V_.getData(elem);
- // Remove the events of a particular type if there are none left
-
- if (data.events[type].length === 0) {
- delete data.events[type];
-
- // Remove the meta-handler from the element
- if (document.removeEventListener) {
- elem.removeEventListener(type, data.handler, false);
- } else if (document.detachEvent) {
- elem.detachEvent("on" + type, data.handler);
- }
- }
-
- // Remove the events object if there are no types left
- if (_V_.isEmpty(data.events)) {
- delete data.events;
- delete data.handler;
- }
-
- // Finally remove the expando if there is no data left
- if (_V_.isEmpty(data)) {
- _V_.removeData(elem);
- }
- },
-
- fixEvent: function(event) {
- if (event[_V_.expando]) { return event; }
- // store a copy of the original event object
- // and "clone" to set read-only properties
- var originalEvent = event;
- event = new _V_.Event(originalEvent);
-
- for ( var i = _V_.Event.props.length, prop; i; ) {
- prop = _V_.Event.props[ --i ];
- event[prop] = originalEvent[prop];
- }
-
- // Fix target property, if necessary
- if (!event.target) { event.target = event.srcElement || document; }
-
- // check if target is a textnode (safari)
- if (event.target.nodeType === 3) { event.target = event.target.parentNode; }
-
- // Add relatedTarget, if necessary
- if (!event.relatedTarget && event.fromElement) {
- event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
- }
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && event.clientX != null ) {
- var eventDocument = event.target.ownerDocument || document,
- doc = eventDocument.documentElement,
- body = eventDocument.body;
-
- event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
- event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- // Add which for key events
- if (event.which == null && (event.charCode != null || event.keyCode != null)) {
- event.which = event.charCode != null ? event.charCode : event.keyCode;
- }
-
- // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
- if ( !event.metaKey && event.ctrlKey ) {
- event.metaKey = event.ctrlKey;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && event.button !== undefined ) {
- event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
- }
-
- return event;
- },
-
- triggerEvent: function(elem, event) {
- var data = _V_.getData(elem),
- parent = elem.parentNode || elem.ownerDocument,
- type = event.type || event,
- handler;
-
- if (data) { handler = data.handler }
-
- // Added in attion to book. Book code was broke.
- event = typeof event === "object" ?
- event[_V_.expando] ?
- event :
- new _V_.Event(type, event) :
- new _V_.Event(type);
-
- event.type = type;
- if (handler) {
- handler.call(elem, event);
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- event.target = elem;
-
- // Bubble the event up the tree to the document,
- // Unless it's been explicitly stopped
- // if (parent && !event.isPropagationStopped()) {
- // _V_.triggerEvent(parent, event);
- //
- // // We're at the top document so trigger the default action
- // } else if (!parent && !event.isDefaultPrevented()) {
- // // log(type);
- // var targetData = _V_.getData(event.target);
- // // log(targetData);
- // var targetHandler = targetData.handler;
- // // log("2");
- // if (event.target[event.type]) {
- // // Temporarily disable the bound handler,
- // // don't want to execute it twice
- // if (targetHandler) {
- // targetData.handler = function(){};
- // }
- //
- // // Trigger the native event (click, focus, blur)
- // event.target[event.type]();
- //
- // // Restore the handler
- // if (targetHandler) {
- // targetData.handler = targetHandler;
- // }
- // }
- // }
- },
-
- one: function(elem, type, fn) {
- _V_.addEvent(elem, type, function(){
- _V_.removeEvent(elem, type, arguments.callee)
- fn.apply(this, arguments);
- });
- }
-});
-
-// Custom Event object for standardizing event objects between browsers.
-_V_.Event = function(src, props){
- // Event object
- if (src && src.type) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if (props) { _V_.merge(this, props); }
-
- this.timeStamp = (new Date).getTime();
-
- // Mark it as fixed
- this[_V_.expando] = true;
-};
-
-_V_.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if (!e) { return; }
-
- // if preventDefault exists run it on the original event
- if (e.preventDefault) {
- e.preventDefault();
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if (!e) { return; }
- // if stopPropagation exists run it on the original event
- if (e.stopPropagation) { e.stopPropagation(); }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-_V_.Event.props = "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");
-
-function returnTrue(){ return true; }
-function returnFalse(){ return false; }
-
-// Javascript JSON implementation
-// (Parse Method Only)
-// https://github.com/douglascrockford/JSON-js/blob/master/json2.js
-
-var JSON;
-if (!JSON) { JSON = {}; }
-
-(function(){
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
- var j;
-
- function walk(holder, key) {
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
- j = eval('(' + text + ')');
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
-/* UI Component- Base class for all UI objects
-================================================================================ */
-_V_.Player = _V_.Component.extend({
-
- init: function(tag, addOptions, ready){
-
- this.tag = tag; // Store the original tag used to set options
-
- var el = this.el = _V_.createElement("div"), // Div to contain video and controls
- options = this.options = {},
- width = options.width = tag.getAttribute('width'),
- height = options.height = tag.getAttribute('height'),
-
- // Browsers default to 300x150 if there's no width/height or video size data.
- initWidth = width || 300,
- initHeight = height || 150;
-
- // Make player findable on elements
- tag.player = el.player = this;
-
- // Add callback to ready queue
- this.ready(ready);
-
- // Wrap video tag in div (el/box) container
- tag.parentNode.insertBefore(el, tag);
- el.appendChild(tag); // Breaks iPhone, fixed in HTML5 setup.
-
- // Give video tag properties to box
- el.id = this.id = tag.id; // ID will now reference box, not the video tag
- el.className = tag.className;
- // Update tag id/class for use as HTML5 playback tech
- tag.id += "_html5_api";
- tag.className = "vjs-tech";
-
- // Make player easily findable by ID
- _V_.players[el.id] = this;
-
- // Make box use width/height of tag, or default 300x150
- el.setAttribute("width", initWidth);
- el.setAttribute("height", initHeight);
- // Enforce with CSS since width/height attrs don't work on divs
- el.style.width = initWidth+"px";
- el.style.height = initHeight+"px";
- // Remove width/height attrs from tag so CSS can make it 100% width/height
- tag.removeAttribute("width");
- tag.removeAttribute("height");
-
- // Set Options
- _V_.merge(options, _V_.options); // Copy Global Defaults
- _V_.merge(options, this.getVideoTagSettings()); // Override with Video Tag Options
- _V_.merge(options, addOptions); // Override/extend with options from setup call
-
- // Store controls setting, and then remove immediately so native controls don't flash.
- tag.removeAttribute("controls");
-
- // Poster will be handled by a manual <img>
- tag.removeAttribute("poster");
-
- // Empty video tag sources and tracks so the built in player doesn't use them also.
- if (tag.hasChildNodes()) {
- for (var i=0,j=tag.childNodes;i<j.length;i++) {
- if (j[i].nodeName == "SOURCE" || j[i].nodeName == "TRACK") {
- tag.removeChild(j[i]);
- }
- }
- }
-
- // Holder for playback tech components
- this.techs = {};
-
- // Cache for video property values.
- this.values = {};
-
- this.addClass("vjs-paused");
-
- this.addEvent("ended", this.onEnded);
- this.addEvent("play", this.onPlay);
- this.addEvent("pause", this.onPause);
- this.addEvent("error", this.onError);
-
- // When the API is ready, loop through the components and add to the player.
- if (options.controls) {
- this.ready(function(){
- this.initComponents();
- });
- }
-
- // If there are no sources when the player is initialized,
- // load the first supported playback technology.
- if (!options.sources || options.sources.length == 0) {
- for (var i=0,j=options.techOrder; i<j.length; i++) {
- var techName = j[i],
- tech = _V_[techName];
-
- // Check if the browser supports this technology
- if (tech.isSupported()) {
- this.loadTech(techName);
- break;
- }
- }
- } else {
- // Loop through playback technologies (HTML5, Flash) and check for support
- // Then load the best source.
- this.src(options.sources);
- }
- },
-
- // Cache for video property values.
- values: {},
-
- destroy: function(){
- // Ensure that tracking progress and time progress will stop and plater deleted
- this.stopTrackingProgress();
- this.stopTrackingCurrentTime();
- delete _V_.players[this.id]
- },
-
- createElement: function(type, options){
-
- },
-
- getVideoTagSettings: function(){
- var options = {
- sources: [],
- tracks: []
- };
-
- options.src = this.tag.getAttribute("src");
- options.controls = this.tag.getAttribute("controls") !== null;
- options.poster = this.tag.getAttribute("poster");
- options.preload = this.tag.getAttribute("preload");
- options.autoplay = this.tag.getAttribute("autoplay") !== null; // hasAttribute not IE <8 compatible
- options.loop = this.tag.getAttribute("loop") !== null;
- options.muted = this.tag.getAttribute("muted") !== null;
-
- if (this.tag.hasChildNodes()) {
- for (var c,i=0,j=this.tag.childNodes;i<j.length;i++) {
- c = j[i];
- if (c.nodeName == "SOURCE") {
- options.sources.push({
- src: c.getAttribute('src'),
- type: c.getAttribute('type'),
- media: c.getAttribute('media'),
- title: c.getAttribute('title')
- });
- }
- if (c.nodeName == "TRACK") {
- options.tracks.push(new _V_.Track({
- src: c.getAttribute("src"),
- kind: c.getAttribute("kind"),
- srclang: c.getAttribute("srclang"),
- label: c.getAttribute("label"),
- 'default': c.getAttribute("default") !== null,
- title: c.getAttribute("title")
- }, this));
-
- }
- }
- }
- return options;
- },
-
- /* PLayback Technology (tech)
- ================================================================================ */
- // Load/Create an instance of playback technlogy including element and API methods
- // And append playback element in player div.
- loadTech: function(techName, source){
-
- // Pause and remove current playback technology
- if (this.tech) {
- this.unloadTech();
-
- // If the first time loading, HTML5 tag will exist but won't be initialized
- // So we need to remove it if we're not loading HTML5
- } else if (techName != "html5" && this.tag) {
- this.el.removeChild(this.tag);
- this.tag = false;
- }
-
- this.techName = techName;
-
- // Turn off API access because we're loading a new tech that might load asynchronously
- this.isReady = false;
-
- var techReady = function(){
- this.player.triggerReady();
-
- // Manually track progress in cases where the browser/flash player doesn't report it.
- if (!this.support.progressEvent) {
- this.player.manualProgressOn();
- }
-
- // Manually track timeudpates in cases where the browser/flash player doesn't report it.
- if (!this.support.timeupdateEvent) {
- this.player.manualTimeUpdatesOn();
- }
- }
-
- // Grab tech-specific options from player options and add source and parent element to use.
- var techOptions = _V_.merge({ source: source, parentEl: this.el }, this.options[techName])
-
- if (source) {
- if (source.src == this.values.src && this.values.currentTime > 0) {
- techOptions.startTime = this.values.currentTime;
- }
-
- this.values.src = source.src;
- }
-
- // Initialize tech instance
- this.tech = new _V_[techName](this, techOptions);
- this.tech.ready(techReady);
- },
-
- unloadTech: function(){
- this.tech.destroy();
-
- // Turn off any manual progress or timeupdate tracking
- if (this.manualProgress) { this.manualProgressOff(); }
-
- if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
-
- this.tech = false;
- },
-
- // There's many issues around changing the size of a Flash (or other plugin) object.
- // First is a plugin reload issue in Firefox that has been around for 11 years: https://bugzilla.mozilla.org/show_bug.cgi?id=90268
- // Then with the new fullscreen API, Mozilla and webkit browsers will reload the flash object after going to fullscreen.
- // To get around this, we're unloading the tech, caching source and currentTime values, and reloading the tech once the plugin is resized.
- // reloadTech: function(betweenFn){
- // _V_.log("unloadingTech")
- // this.unloadTech();
- // _V_.log("unloadedTech")
- // if (betweenFn) { betweenFn.call(); }
- // _V_.log("LoadingTech")
- // this.loadTech(this.techName, { src: this.values.src })
- // _V_.log("loadedTech")
- // },
-
- /* Fallbacks for unsupported event types
- ================================================================================ */
- // Manually trigger progress events based on changes to the buffered amount
- // Many flash players and older HTML5 browsers don't send progress or progress-like events
- manualProgressOn: function(){
- this.manualProgress = true;
-
- // Trigger progress watching when a source begins loading
- this.trackProgress();
-
- // Watch for a native progress event call on the tech element
- // In HTML5, some older versions don't support the progress event
- // So we're assuming they don't, and turning off manual progress if they do.
- this.tech.addEvent("progress", function(){
-
- // Remove this listener from the element
- this.removeEvent("progress", arguments.callee);
-
- // Update known progress support for this playback technology
- this.support.progressEvent = true;
-
- // Turn off manual progress tracking
- this.player.manualProgressOff();
- });
- },
-
- manualProgressOff: function(){
- this.manualProgress = false;
- this.stopTrackingProgress();
- },
-
- trackProgress: function(){
- this.progressInterval = setInterval(_V_.proxy(this, function(){
- // Don't trigger unless buffered amount is greater than last time
- // log(this.values.bufferEnd, this.buffered().end(0), this.duration())
- /* TODO: update for multiple buffered regions */
- if (this.values.bufferEnd < this.buffered().end(0)) {
- this.triggerEvent("progress");
- } else if (this.bufferedPercent() == 1) {
- this.stopTrackingProgress();
- this.triggerEvent("progress"); // Last update
- }
- }), 500);
- },
- stopTrackingProgress: function(){ clearInterval(this.progressInterval); },
-
- /* Time Tracking -------------------------------------------------------------- */
- manualTimeUpdatesOn: function(){
- this.manualTimeUpdates = true;
-
- this.addEvent("play", this.trackCurrentTime);
- this.addEvent("pause", this.stopTrackingCurrentTime);
- // timeupdate is also called by .currentTime whenever current time is set
-
- // Watch for native timeupdate event
- this.tech.addEvent("timeupdate", function(){
-
- // Remove this listener from the element
- this.removeEvent("timeupdate", arguments.callee);
-
- // Update known progress support for this playback technology
- this.support.timeupdateEvent = true;
-
- // Turn off manual progress tracking
- this.player.manualTimeUpdatesOff();
- });
- },
-
- manualTimeUpdatesOff: function(){
- this.manualTimeUpdates = false;
- this.stopTrackingCurrentTime();
- this.removeEvent("play", this.trackCurrentTime);
- this.removeEvent("pause", this.stopTrackingCurrentTime);
- },
-
- trackCurrentTime: function(){
- if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
- this.currentTimeInterval = setInterval(_V_.proxy(this, function(){
- this.triggerEvent("timeupdate");
- }), 250); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15
- },
-
- // Turn off play progress tracking (when paused or dragging)
- stopTrackingCurrentTime: function(){ clearInterval(this.currentTimeInterval); },
-
- /* Player event handlers (how the player reacts to certain events)
- ================================================================================ */
- onEnded: function(){
- if (this.options.loop) {
- this.currentTime(0);
- this.play();
- } else {
- this.pause();
- this.currentTime(0);
- this.pause();
- }
- },
-
- onPlay: function(){
- _V_.removeClass(this.el, "vjs-paused");
- _V_.addClass(this.el, "vjs-playing");
- },
-
- onPause: function(){
- _V_.removeClass(this.el, "vjs-playing");
- _V_.addClass(this.el, "vjs-paused");
- },
-
- onError: function(e) {
- _V_.log("Video Error", e);
- },
-
-/* Player API
-================================================================================ */
-
- apiCall: function(method, arg){
- if (this.isReady) {
- return this.tech[method](arg);
- } else {
- _V_.log("The playback technology API is not ready yet. Use player.ready(myFunction)."+" ["+method+"]", arguments.callee.caller.arguments.callee.caller.arguments.callee.caller)
- return false;
- // throw new Error("The playback technology API is not ready yet. Use player.ready(myFunction)."+" ["+method+"]");
- }
- },
-
- play: function(){
- this.apiCall("play"); return this;
- },
- pause: function(){
- this.apiCall("pause"); return this;
- },
- paused: function(){
- return this.apiCall("paused");
- },
-
- currentTime: function(seconds){
- if (seconds !== undefined) {
-
- // Cache the last set value for smoother scrubbing.
- this.values.lastSetCurrentTime = seconds;
-
- this.apiCall("setCurrentTime", seconds);
-
- if (this.manualTimeUpdates) {
- this.triggerEvent("timeupdate");
- }
- return this;
- }
-
- // Cache last currentTime and return
- return this.values.currentTime = this.apiCall("currentTime");
- },
- duration: function(){
- return this.apiCall("duration");
- },
- remainingTime: function(){
- return this.duration() - this.currentTime();
- },
-
- buffered: function(){
- var buffered = this.apiCall("buffered"),
- start = 0, end = this.values.bufferEnd = this.values.bufferEnd || 0,
- timeRange;
-
- if (buffered && buffered.length > 0 && buffered.end(0) !== end) {
- end = buffered.end(0);
- // Storing values allows them be overridden by setBufferedFromProgress
- this.values.bufferEnd = end;
- }
-
- return _V_.createTimeRange(start, end);
- },
-
- // Calculates amount of buffer is full
- bufferedPercent: function(){
- return (this.duration()) ? this.buffered().end(0) / this.duration() : 0;
- },
-
- volume: function(percentAsDecimal){
- if (percentAsDecimal !== undefined) {
- var vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal))); // Force value to between 0 and 1
- this.values.volume = vol;
- this.apiCall("setVolume", vol);
- _V_.setLocalStorage("volume", vol);
- return this;
- }
- // if (this.values.volume) { return this.values.volume; }
- return this.apiCall("volume");
- },
- muted: function(muted){
- if (muted !== undefined) {
- this.apiCall("setMuted", muted);
- return this;
- }
- return this.apiCall("muted");
- },
-
- width: function(width, skipListeners){
- if (width !== undefined) {
- this.el.width = width;
- this.el.style.width = width+"px";
- if (!skipListeners) { this.triggerEvent("resize"); }
- return this;
- }
- return parseInt(this.el.getAttribute("width"));
- },
- height: function(height){
- if (height !== undefined) {
- this.el.height = height;
- this.el.style.height = height+"px";
- this.triggerEvent("resize");
- return this;
- }
- return parseInt(this.el.getAttribute("height"));
- },
- size: function(width, height){
- // Skip resize listeners on width for optimization
- return this.width(width, true).height(height);
- },
-
- supportsFullScreen: function(){ return this.apiCall("supportsFullScreen"); },
-
- // Turn on fullscreen (or window) mode
- requestFullScreen: function(){
- var requestFullScreen = _V_.support.requestFullScreen;
-
- this.isFullScreen = true;
-
- // Check for browser element fullscreen support
- if (requestFullScreen) {
-
- // Flash and other plugins get reloaded when you take their parent to fullscreen.
- // To fix that we'll remove the tech, and reload it after the resize has finished.
- if (this.tech.support.fullscreenResize === false && this.options.flash.iFrameMode != true) {
-
- this.pause();
- this.unloadTech();
-
- _V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
- _V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
- this.loadTech(this.techName, { src: this.values.src });
- }));
-
- this.el[requestFullScreen.requestFn]();
-
- } else {
- this.el[requestFullScreen.requestFn]();
- }
-
- // In case the user presses escape to exit fullscreen, we need to update fullscreen status
- _V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
- this.isFullScreen = document[requestFullScreen.isFullScreen];
- }));
-
- } else if (this.tech.supportsFullScreen()) {
- this.apiCall("enterFullScreen");
-
- } else {
- this.enterFullWindow();
- }
-
- this.triggerEvent("fullscreenchange");
-
- return this;
- },
-
- cancelFullScreen: function(){
- var requestFullScreen = _V_.support.requestFullScreen;
-
- // Check for browser element fullscreen support
- if (requestFullScreen) {
-
- // Flash and other plugins get reloaded when you take their parent to fullscreen.
- // To fix that we'll remove the tech, and reload it after the resize has finished.
- if (this.tech.support.fullscreenResize === false && this.options.flash.iFrameMode != true) {
-
- this.pause();
- this.unloadTech();
-
- _V_.addEvent(document, requestFullScreen.eventName, this.proxy(function(){
- _V_.removeEvent(document, requestFullScreen.eventName, arguments.callee);
- this.loadTech(this.techName, { src: this.values.src })
- }));
-
- document[requestFullScreen.cancelFn]();
-
- } else {
- document[requestFullScreen.cancelFn]();
- }
-
- } else if (this.tech.supportsFullScreen()) {
- this.apiCall("exitFullScreen");
-
- } else {
- this.exitFullWindow();
- }
-
- this.isFullScreen = false;
- this.triggerEvent("fullscreenchange");
-
- return this;
- },
-
- enterFullWindow: function(){
- this.isFullWindow = true;
-
- // Storing original doc overflow value to return to when fullscreen is off
- this.docOrigOverflow = document.documentElement.style.overflow;
-
- // Add listener for esc key to exit fullscreen
- _V_.addEvent(document, "keydown", _V_.proxy(this, this.fullWindowOnEscKey));
-
- // Hide any scroll bars
- document.documentElement.style.overflow = 'hidden';
-
- // Apply fullscreen styles
- _V_.addClass(document.body, "vjs-full-window");
- _V_.addClass(this.el, "vjs-fullscreen");
-
- this.triggerEvent("enterFullWindow");
- },
-
- fullWindowOnEscKey: function(event){
- if (event.keyCode == 27) {
- if (this.isFullScreen == true) {
- this.cancelFullScreen();
- } else {
- this.exitFullWindow();
- }
- }
- },
-
- exitFullWindow: function(){
- this.isFullWindow = false;
- _V_.removeEvent(document, "keydown", this.fullWindowOnEscKey);
-
- // Unhide scroll bars.
- document.documentElement.style.overflow = this.docOrigOverflow;
-
- // Remove fullscreen styles
- _V_.removeClass(document.body, "vjs-full-window");
- _V_.removeClass(this.el, "vjs-fullscreen");
-
- // Resize the box, controller, and poster to original sizes
- // this.positionAll();
- this.triggerEvent("exitFullWindow");
- },
-
- // src is a pretty powerful function
- // If you pass it an array of source objects, it will find the best source to play and use that object.src
- // If the new source requires a new playback technology, it will switch to that.
- // If you pass it an object, it will set the source to object.src
- // If you pass it anything else (url string) it will set the video source to that
- src: function(source){
- // Case: Array of source objects to choose from and pick the best to play
- if (source instanceof Array) {
-
- var sources = source;
-
- techLoop: // Named loop for breaking both loops
- // Loop through each playback technology in the options order
- for (var i=0,j=this.options.techOrder;i<j.length;i++) {
- var techName = j[i],
- tech = _V_[techName];
- // tech = _V_.tech[techName];
-
- // Check if the browser supports this technology
- if (tech.isSupported()) {
-
- // Loop through each source object
- for (var a=0,b=sources;a<b.length;a++) {
- var source = b[a];
-
- // Check if source can be played with this technology
- if (tech.canPlaySource.call(this, source)) {
-
- // If this technology is already loaded, set source
- if (techName == this.techName) {
- this.src(source); // Passing the source object
-
- // Otherwise load this technology with chosen source
- } else {
- this.loadTech(techName, source);
- }
-
- break techLoop; // Break both loops
- }
- }
- }
- }
-
- // Case: Source object { src: "", type: "" ... }
- } else if (source instanceof Object) {
- if (_V_[this.techName].canPlaySource(source)) {
- this.src(source.src);
- } else {
- // Send through tech loop to check for a compatible technology.
- this.src([source]);
- }
- // Case: URL String (http://myvideo...)
- } else {
- // Cache for getting last set source
- this.values.src = source;
-
- if (!this.isReady) {
- this.ready(function(){
- this.src(source);
- });
- } else {
- this.apiCall("src", source);
- if (this.options.preload == "auto") {
- this.load();
- }
- if (this.options.autoplay) {
- this.play();
- }
- }
- }
- return this;
- },
-
- // Begin loading the src data
- load: function(){
- this.apiCall("load");
- return this;
- },
- currentSrc: function(){
- return this.apiCall("currentSrc");
- },
-
- textTrackValue: function(kind, value){
- if (value !== undefined) {
- this.values[kind] = value;
- this.triggerEvent(kind+"update");
- return this;
- }
- return this.values[kind];
- },
-
- // Attributes/Options
- preload: function(value){
- if (value !== undefined) {
- this.apiCall("setPreload", value);
- this.options.preload = value;
- return this;
- }
- return this.apiCall("preload", value);
- },
- autoplay: function(value){
- if (value !== undefined) {
- this.apiCall("setAutoplay", value);
- this.options.autoplay = value;
- return this;
- }
- return this.apiCall("autoplay", value);
- },
- loop: function(value){
- if (value !== undefined) {
- this.apiCall("setLoop", value);
- this.options.loop = value;
- return this;
- }
- return this.apiCall("loop", value);
- },
-
- controls: function(){ return this.options.controls; },
- textTracks: function(){ return this.options.tracks; },
- poster: function(){ return this.apiCall("poster"); },
-
- error: function(){ return this.apiCall("error"); },
- networkState: function(){ return this.apiCall("networkState"); },
- readyState: function(){ return this.apiCall("readyState"); },
- seeking: function(){ return this.apiCall("seeking"); },
- initialTime: function(){ return this.apiCall("initialTime"); },
- startOffsetTime: function(){ return this.apiCall("startOffsetTime"); },
- played: function(){ return this.apiCall("played"); },
- seekable: function(){ return this.apiCall("seekable"); },
- ended: function(){ return this.apiCall("ended"); },
- videoTracks: function(){ return this.apiCall("videoTracks"); },
- audioTracks: function(){ return this.apiCall("audioTracks"); },
- videoWidth: function(){ return this.apiCall("videoWidth"); },
- videoHeight: function(){ return this.apiCall("videoHeight"); },
- defaultPlaybackRate: function(){ return this.apiCall("defaultPlaybackRate"); },
- playbackRate: function(){ return this.apiCall("playbackRate"); },
- // mediaGroup: function(){ return this.apiCall("mediaGroup"); },
- // controller: function(){ return this.apiCall("controller"); },
- controls: function(){ return this.apiCall("controls"); },
- defaultMuted: function(){ return this.apiCall("defaultMuted"); }
-});
-
-// RequestFullscreen API
-(function(){
- var requestFn,
- cancelFn,
- eventName,
- isFullScreen,
- playerProto = _V_.Player.prototype;
-
- // Current W3C Spec
- // http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
- // Mozilla Draft: https://wiki.mozilla.org/Gecko:FullScreenAPI#fullscreenchange_event
- if (document.cancelFullscreen !== undefined) {
- requestFn = "requestFullscreen";
- cancelFn = "exitFullscreen";
- eventName = "fullscreenchange";
- isFullScreen = "fullScreen";
-
- // Webkit (Chrome/Safari) and Mozilla (Firefox) have working implementaitons
- // that use prefixes and vary slightly from the new W3C spec. Specifically, using 'exit' instead of 'cancel',
- // and lowercasing the 'S' in Fullscreen.
- // Other browsers don't have any hints of which version they might follow yet, so not going to try to predict by loopeing through all prefixes.
- } else {
-
- _V_.each(["moz", "webkit"], function(prefix){
-
- // https://github.com/zencoder/video-js/pull/128
- if ((prefix != "moz" || document.mozFullScreenEnabled) && document[prefix + "CancelFullScreen"] !== undefined) {
- requestFn = prefix + "RequestFullScreen";
- cancelFn = prefix + "CancelFullScreen";
- eventName = prefix + "fullscreenchange";
-
- if (prefix == "webkit") {
- isFullScreen = prefix + "IsFullScreen";
- } else {
- _V_.log("moz here")
- isFullScreen = prefix + "FullScreen";
- }
- }
-
- });
-
- }
-
- if (requestFn) {
- _V_.support.requestFullScreen = {
- requestFn: requestFn,
- cancelFn: cancelFn,
- eventName: eventName,
- isFullScreen: isFullScreen
- };
- }
-
-})();/* Playback Technology - Base class for playback technologies
-================================================================================ */
-_V_.PlaybackTech = _V_.Component.extend({
- init: function(player, options){
- // this._super(player, options);
-
- // Make playback element clickable
- // _V_.addEvent(this.el, "click", _V_.proxy(this, _V_.PlayToggle.prototype.onClick));
-
- // this.addEvent("click", this.proxy(this.onClick));
-
- // player.triggerEvent("techready");
- },
- // destroy: function(){},
- // createElement: function(){},
- onClick: function(){
- if (this.player.options.controls) {
- _V_.PlayToggle.prototype.onClick.call(this);
- }
- }
-});
-
-// Create placeholder methods for each that warn when a method isn't supported by the current playback technology
-_V_.apiMethods = "play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");
-_V_.each(_V_.apiMethods, function(methodName){
- _V_.PlaybackTech.prototype[methodName] = function(){
- throw new Error("The '"+method+"' method is not available on the playback technology's API");
- }
-});
-
-/* HTML5 Playback Technology - Wrapper for HTML5 Media API
-================================================================================ */
-_V_.html5 = _V_.PlaybackTech.extend({
-
- init: function(player, options, ready){
- this.player = player;
- this.el = this.createElement();
- this.ready(ready);
-
- this.addEvent("click", this.proxy(this.onClick));
-
- var source = options.source;
-
- // If the element source is already set, we may have missed the loadstart event, and want to trigger it.
- // We don't want to set the source again and interrupt playback.
- if (source && this.el.currentSrc == source.src) {
- player.triggerEvent("loadstart");
-
- // Otherwise set the source if one was provided.
- } else if (source) {
- this.el.src = source.src;
- }
-
- // Chrome and Safari both have issues with autoplay.
- // In Safari (5.1.1), when we move the video element into the container div, autoplay doesn't work.
- // In Chrome (15), if you have autoplay + a poster + no controls, the video gets hidden (but audio plays)
- // This fixes both issues. Need to wait for API, so it updates displays correctly
- player.ready(function(){
- if (this.options.autoplay && this.paused()) {
- this.tag.poster = null; // Chrome Fix. Fixed in Chrome v16.
- this.play();
- }
- });
-
- this.setupTriggers();
-
- this.triggerReady();
- },
-
- destroy: function(){
- this.player.tag = false;
- this.removeTriggers();
- this.el.parentNode.removeChild(this.el);
- },
-
- createElement: function(){
- var html5 = _V_.html5,
- player = this.player,
-
- // If possible, reuse original tag for HTML5 playback technology element
- el = player.tag,
- newEl;
-
- // Check if this browser supports moving the element into the box.
- // On the iPhone video will break if you move the element,
- // So we have to create a brand new element.
- if (!el || this.support.movingElementInDOM === false) {
-
- // If the original tag is still there, remove it.
- if (el) {
- player.el.removeChild(el);
- }
-
- newEl = _V_.createElement("video", {
- id: el.id || player.el.id + "_html5_api",
- className: el.className || "vjs-tech"
- });
-
- el = newEl;
- _V_.insertFirst(el, player.el);
- }
-
- // Update tag settings, in case they were overridden
- _V_.each(["autoplay","preload","loop","muted"], function(attr){ // ,"poster"
- el[attr] = player.options[attr];
- }, this);
-
- return el;
- },
-
- // Make video events trigger player events
- // May seem verbose here, but makes other APIs possible.
- setupTriggers: function(){
- _V_.each.call(this, _V_.html5.events, function(type){
- _V_.addEvent(this.el, type, _V_.proxy(this.player, this.eventHandler));
- });
- },
- removeTriggers: function(){
- _V_.each.call(this, _V_.html5.events, function(type){
- _V_.removeEvent(this.el, type, _V_.proxy(this.player, this.eventHandler));
- });
- },
- eventHandler: function(e){
- e.stopPropagation();
- this.triggerEvent(e);
- },
-
- play: function(){ this.el.play(); },
- pause: function(){ this.el.pause(); },
- paused: function(){ return this.el.paused; },
-
- currentTime: function(){ return this.el.currentTime; },
- setCurrentTime: function(seconds){
- try {
- this.el.currentTime = seconds;
- } catch(e) {
- _V_.log(e, "Video isn't ready. (VideoJS)");
- // this.warning(VideoJS.warnings.videoNotReady);
- }
- },
-
- duration: function(){ return this.el.duration || 0; },
- buffered: function(){ return this.el.buffered; },
-
- volume: function(){ return this.el.volume; },
- setVolume: function(percentAsDecimal){ this.el.volume = percentAsDecimal; },
- muted: function(){ return this.el.muted; },
- setMuted: function(muted){ this.el.muted = muted },
-
- width: function(){ return this.el.offsetWidth; },
- height: function(){ return this.el.offsetHeight; },
-
- supportsFullScreen: function(){
- if (typeof this.el.webkitEnterFullScreen == 'function') {
-
- // Seems to be broken in Chromium/Chrome && Safari in Leopard
- if (!navigator.userAgent.match("Chrome") && !navigator.userAgent.match("Mac OS X 10.5")) {
- return true;
- }
- }
- return false;
- },
-
- enterFullScreen: function(){
- try {
- this.el.webkitEnterFullScreen();
- } catch (e) {
- if (e.code == 11) {
- // this.warning(VideoJS.warnings.videoNotReady);
- _V_.log("VideoJS: Video not ready.")
- }
- }
- },
- src: function(src){ this.el.src = src; },
- load: function(){ this.el.load(); },
- currentSrc: function(){ return this.el.currentSrc; },
-
- preload: function(){ return this.el.preload; },
- setPreload: function(val){ this.el.preload = val; },
- autoplay: function(){ return this.el.autoplay; },
- setAutoplay: function(val){ this.el.autoplay = val; },
- loop: function(){ return this.el.loop; },
- setLoop: function(val){ this.el.loop = val; },
-
- error: function(){ return this.el.error; },
- // networkState: function(){ return this.el.networkState; },
- // readyState: function(){ return this.el.readyState; },
- seeking: function(){ return this.el.seeking; },
- // initialTime: function(){ return this.el.initialTime; },
- // startOffsetTime: function(){ return this.el.startOffsetTime; },
- // played: function(){ return this.el.played; },
- // seekable: function(){ return this.el.seekable; },
- ended: function(){ return this.el.ended; },
- // videoTracks: function(){ return this.el.videoTracks; },
- // audioTracks: function(){ return this.el.audioTracks; },
- // videoWidth: function(){ return this.el.videoWidth; },
- // videoHeight: function(){ return this.el.videoHeight; },
- // textTracks: function(){ return this.el.textTracks; },
- // defaultPlaybackRate: function(){ return this.el.defaultPlaybackRate; },
- // playbackRate: function(){ return this.el.playbackRate; },
- // mediaGroup: function(){ return this.el.mediaGroup; },
- // controller: function(){ return this.el.controller; },
- controls: function(){ return this.player.options.controls; },
- defaultMuted: function(){ return this.el.defaultMuted; }
-});
-
-/* HTML5 Support Testing -------------------------------------------------------- */
-
-_V_.html5.isSupported = function(){
- return !!document.createElement("video").canPlayType;
-};
-
-_V_.html5.canPlaySource = function(srcObj){
- return !!document.createElement("video").canPlayType(srcObj.type);
- // TODO: Check Type
- // If no Type, check ext
- // Check Media Type
-};
-
-// List of all HTML5 events (various uses).
-_V_.html5.events = "loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(",");
-
-/* HTML5 Device Fixes ---------------------------------------------------------- */
-
-_V_.html5.prototype.support = {
-
- // Support for tech specific full screen. (webkitEnterFullScreen, not requestFullscreen)
- // http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLVideoElementClassReference/HTMLVideoElement/HTMLVideoElement.html
- // Seems to be broken in Chromium/Chrome && Safari in Leopard
- fullscreen: (typeof _V_.testVid.webkitEnterFullScreen !== undefined) ? (!_V_.ua.match("Chrome") && !_V_.ua.match("Mac OS X 10.5") ? true : false) : false,
-
- // In iOS, if you move a video element in the DOM, it breaks video playback.
- movingElementInDOM: !_V_.isIOS()
-
-};
-
-// Android
-if (_V_.isAndroid()) {
-
- // Override Android 2.2 and less canPlayType method which is broken
- if (_V_.androidVersion() < 3) {
- document.createElement("video").constructor.prototype.canPlayType = function(type){
- return (type && type.toLowerCase().indexOf("video/mp4") != -1) ? "maybe" : "";
- };
- }
-}
-
-
-/* VideoJS-SWF - Custom Flash Player with HTML5-ish API - https://github.com/zencoder/video-js-swf
-================================================================================ */
-_V_.flash = _V_.PlaybackTech.extend({
-
- init: function(player, options){
- this.player = player;
-
- var source = options.source,
-
- // Which element to embed in
- parentEl = options.parentEl,
-
- // Create a temporary element to be replaced by swf object
- placeHolder = this.el = _V_.createElement("div", { id: parentEl.id + "_temp_flash" }),
-
- // Generate ID for swf object
- objId = player.el.id+"_flash_api",
-
- // Store player options in local var for optimization
- playerOptions = player.options,
-
- // Merge default flashvars with ones passed in to init
- flashVars = _V_.merge({
-
- // SWF Callback Functions
- readyFunction: "_V_.flash.onReady",
- eventProxyFunction: "_V_.flash.onEvent",
- errorEventProxyFunction: "_V_.flash.onError",
-
- // Player Settings
- autoplay: playerOptions.autoplay,
- preload: playerOptions.preload,
- loop: playerOptions.loop,
- muted: playerOptions.muted
-
- }, options.flashVars),
-
- // Merge default parames with ones passed in
- params = _V_.merge({
- wmode: "opaque", // Opaque is needed to overlay controls, but can affect playback performance
- bgcolor: "#000000" // Using bgcolor prevents a white flash when the object is loading
- }, options.params),
-
- // Merge default attributes with ones passed in
- attributes = _V_.merge({
- id: objId,
- name: objId, // Both ID and Name needed or swf to identifty itself
- 'class': 'vjs-tech'
- }, options.attributes)
- ;
-
- // If source was supplied pass as a flash var.
- if (source) {
- flashVars.src = encodeURIComponent(source.src);
- }
-
- // Add placeholder to player div
- _V_.insertFirst(placeHolder, parentEl);
-
- // Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
- // This allows resetting the playhead when we catch the reload
- if (options.startTime) {
- this.ready(function(){
- this.load();
- this.play();
- this.currentTime(options.startTime);
- });
- }
-
- // Flash iFrame Mode
- // In web browsers there are multiple instances where changing the parent element or visibility of a plugin causes the plugin to reload.
- // - Firefox just about always. https://bugzilla.mozilla.org/show_bug.cgi?id=90268 (might be fixed by version 13)
- // - Webkit when hiding the plugin
- // - Webkit and Firefox when using requestFullScreen on a parent element
- // Loading the flash plugin into a dynamically generated iFrame gets around most of these issues.
- // Issues that remain include hiding the element and requestFullScreen in Firefox specifically
-
- // There's on particularly annoying issue with this method which is that Firefox throws a security error on an offsite Flash object loaded into a dynamically created iFrame.
- // Even though the iframe was inserted into a page on the web, Firefox + Flash considers it a local app trying to access an internet file.
- // I tried mulitple ways of setting the iframe src attribute but couldn't find a src that worked well. Tried a real/fake source, in/out of domain.
- // Also tried a method from stackoverflow that caused a security error in all browsers. http://stackoverflow.com/questions/2486901/how-to-set-document-domain-for-a-dynamically-generated-iframe
- // In the end the solution I found to work was setting the iframe window.location.href right before doing a document.write of the Flash object.
- // The only downside of this it seems to trigger another http request to the original page (no matter what's put in the href). Not sure why that is.
-
- // NOTE (2012-01-29): Cannot get Firefox to load the remote hosted SWF into a dynamically created iFrame
- // Firefox 9 throws a security error, unleess you call location.href right before doc.write.
- // Not sure why that even works, but it causes the browser to look like it's continuously trying to load the page.
- // Firefox 3.6 keeps calling the iframe onload function anytime I write to it, causing an endless loop.
-
- if (options.iFrameMode == true && !_V_.isFF) {
-
- // Create iFrame with vjs-tech class so it's 100% width/height
- var iFrm = _V_.createElement("iframe", {
- id: objId + "_iframe",
- name: objId + "_iframe",
- className: "vjs-tech",
- scrolling: "no",
- marginWidth: 0,
- marginHeight: 0,
- frameBorder: 0
- });
-
- // Update ready function names in flash vars for iframe window
- flashVars.readyFunction = "ready";
- flashVars.eventProxyFunction = "events";
- flashVars.errorEventProxyFunction = "errors";
-
- // Tried multiple methods to get this to work in all browsers
-
- // Tried embedding the flash object in the page first, and then adding a place holder to the iframe, then replacing the placeholder with the page object.
- // The goal here was to try to load the swf URL in the parent page first and hope that got around the firefox security error
- // var newObj = _V_.flash.embed(options.swf, placeHolder, flashVars, params, attributes);
- // (in onload)
- // var temp = _V_.createElement("a", { id:"asdf", innerHTML: "asdf" } );
- // iDoc.body.appendChild(temp);
-
- // Tried embedding the flash object through javascript in the iframe source.
- // This works in webkit but still triggers the firefox security error
- // iFrm.src = "javascript: document.write('"+_V_.flash.getEmbedCode(options.swf, flashVars, params, attributes)+"');";
-
- // Tried an actual local iframe just to make sure that works, but it kills the easiness of the CDN version if you require the user to host an iframe
- // We should add an option to host the iframe locally though, because it could help a lot of issues.
- // iFrm.src = "iframe.html";
-
- // Wait until iFrame has loaded to write into it.
- _V_.addEvent(iFrm, "load", _V_.proxy(this, function(){
-
- var iDoc, objTag, swfLoc,
- iWin = iFrm.contentWindow,
- varString = "";
-
-
- // The one working method I found was to use the iframe's document.write() to create the swf object
- // This got around the security issue in all browsers except firefox.
- // I did find a hack where if I call the iframe's window.location.href="", it would get around the security error
- // However, the main page would look like it was loading indefinitely (URL bar loading spinner would never stop)
- // Plus Firefox 3.6 didn't work no matter what I tried.
- // if (_V_.ua.match("Firefox")) {
- // iWin.location.href = "";
- // }
-
- // Get the iFrame's document depending on what the browser supports
- iDoc = iFrm.contentDocument ? iFrm.contentDocument : iFrm.contentWindow.document;
-
- // Tried ensuring both document domains were the same, but they already were, so that wasn't the issue.
- // Even tried adding /. that was mentioned in a browser security writeup
- // document.domain = document.domain+"/.";
- // iDoc.domain = document.domain+"/.";
-
- // Tried adding the object to the iframe doc's innerHTML. Security error in all browsers.
- // iDoc.body.innerHTML = swfObjectHTML;
-
- // Tried appending the object to the iframe doc's body. Security error in all browsers.
- // iDoc.body.appendChild(swfObject);
-
- // Using document.write actually got around the security error that browsers were throwing.
- // Again, it's a dynamically generated (same domain) iframe, loading an external Flash swf.
- // Not sure why that's a security issue, but apparently it is.
- iDoc.write(_V_.flash.getEmbedCode(options.swf, flashVars, params, attributes));
-
- // Setting variables on the window needs to come after the doc write because otherwise they can get reset in some browsers
- // So far no issues with swf ready event being called before it's set on the window.
- iWin.player = this.player;
-
- // Create swf ready function for iFrame window
- iWin.ready = _V_.proxy(this.player, function(currSwf){
- var el = iDoc.getElementById(currSwf),
- player = this,
- tech = player.tech;
-
- // Update reference to playback technology element
- tech.el = el;
-
- // Now that the element is ready, make a click on the swf play the video
- _V_.addEvent(el, "click", tech.proxy(tech.onClick));
-
- // Make sure swf is actually ready. Sometimes the API isn't actually yet.
- _V_.flash.checkReady(tech);
- });
-
- // Create event listener for all swf events
- iWin.events = _V_.proxy(this.player, function(swfID, eventName, other){
- var player = this;
- if (player && player.techName == "flash") {
- player.triggerEvent(eventName);
- }
- });
-
- // Create error listener for all swf errors
- iWin.errors = _V_.proxy(this.player, function(swfID, eventName){
- _V_.log("Flash Error", eventName);
- });
-
- }));
-
- // Replace placeholder with iFrame (it will load now)
- placeHolder.parentNode.replaceChild(iFrm, placeHolder);
-
- // If not using iFrame mode, embed as normal object
- } else {
- _V_.flash.embed(options.swf, placeHolder, flashVars, params, attributes);
- }
- },
-
- destroy: function(){
- this.el.parentNode.removeChild(this.el);
- },
-
- // setupTriggers: function(){}, // Using global onEvent func to distribute events
-
- play: function(){ this.el.vjs_play(); },
- pause: function(){ this.el.vjs_pause(); },
- src: function(src){
- this.el.vjs_src(src);
-
- // Currently the SWF doesn't autoplay if you load a source later.
- // e.g. Load player w/ no source, wait 2s, set src.
- if (this.player.autoplay) {
- var tech = this;
- setTimeout(function(){ tech.play(); }, 0);
- }
- },
- load: function(){ this.el.vjs_load(); },
- poster: function(){ this.el.vjs_getProperty("poster"); },
-
- buffered: function(){
- return _V_.createTimeRange(0, this.el.vjs_getProperty("buffered"));
- },
-
- supportsFullScreen: function(){
- return false; // Flash does not allow fullscreen through javascript
- },
- enterFullScreen: function(){
- return false;
- }
-});
-
-// Create setters and getters for attributes
-(function(){
-
- var api = _V_.flash.prototype,
- readWrite = "preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),
- readOnly = "error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks".split(","),
- callOnly = "load,play,pause".split(",");
- // Overridden: buffered
-
- createSetter = function(attr){
- var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
- api["set"+attrUpper] = function(val){ return this.el.vjs_setProperty(attr, val); };
- },
-
- createGetter = function(attr){
- api[attr] = function(){ return this.el.vjs_getProperty(attr); };
- }
- ;
-
- // Create getter and setters for all read/write attributes
- _V_.each(readWrite, function(attr){
- createGetter(attr);
- createSetter(attr);
- });
-
- // Create getters for read-only attributes
- _V_.each(readOnly, function(attr){
- createGetter(attr);
- });
-
-})();
-
-/* Flash Support Testing -------------------------------------------------------- */
-
-_V_.flash.isSupported = function(){
- return _V_.flash.version()[0] >= 10;
- // return swfobject.hasFlashPlayerVersion("10");
-};
-
-_V_.flash.canPlaySource = function(srcObj){
- if (srcObj.type in _V_.flash.prototype.support.formats) { return "maybe"; }
-};
-
-_V_.flash.prototype.support = {
- formats: {
- "video/flv": "FLV",
- "video/x-flv": "FLV",
- "video/mp4": "MP4",
- "video/m4v": "MP4"
- },
-
- // Optional events that we can manually mimic with timers
- progressEvent: false,
- timeupdateEvent: false,
-
- // Resizing plugins using request fullscreen reloads the plugin
- fullscreenResize: false,
-
- // Resizing plugins in Firefox always reloads the plugin (e.g. full window mode)
- parentResize: !(_V_.ua.match("Firefox"))
-};
-
-_V_.flash.onReady = function(currSwf){
-
- var el = _V_.el(currSwf);
-
- // Get player from box
- // On firefox reloads, el might already have a player
- var player = el.player || el.parentNode.player,
- tech = player.tech;
-
- // Reference player on tech element
- el.player = player;
-
- // Update reference to playback technology element
- tech.el = el;
-
- // Now that the element is ready, make a click on the swf play the video
- tech.addEvent("click", tech.onClick);
-
- _V_.flash.checkReady(tech);
-};
-
-// The SWF isn't alwasy ready when it says it is. Sometimes the API functions still need to be added to the object.
-// If it's not ready, we set a timeout to check again shortly.
-_V_.flash.checkReady = function(tech){
-
- // Check if API property exists
- if (tech.el.vjs_getProperty) {
-
- // If so, tell tech it's ready
- tech.triggerReady();
-
- // Otherwise wait longer.
- } else {
-
- setTimeout(function(){
- _V_.flash.checkReady(tech);
- }, 50);
-
- }
-};
-
-// Trigger events from the swf on the player
-_V_.flash.onEvent = function(swfID, eventName){
- var player = _V_.el(swfID).player;
- player.triggerEvent(eventName);
-};
-
-// Log errors from the swf
-_V_.flash.onError = function(swfID, err){
- _V_.log("Flash Error", err, swfID);
-};
-
-// Flash Version Check
-_V_.flash.version = function(){
- var version = '0,0,0'
-
- // IE
- try {
- version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
-
- // other browsers
- } catch(e) {
- try {
- if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
- version = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
- }
- } catch(e) {}
- }
- return version.split(",");
-}
-
-// Flash embedding method. Only used in non-iframe mode
-_V_.flash.embed = function(swf, placeHolder, flashVars, params, attributes){
- var code = _V_.flash.getEmbedCode(swf, flashVars, params, attributes),
-
- // Get element by embedding code and retrieving created element
- obj = _V_.createElement("div", { innerHTML: code }).childNodes[0],
-
- par = placeHolder.parentNode
- ;
-
- placeHolder.parentNode.replaceChild(obj, placeHolder);
-
- // IE6 seems to have an issue where it won't initialize the swf object after injecting it.
- // This is a dumb temporary fix
- if (_V_.isIE()) {
- var newObj = par.childNodes[0];
- setTimeout(function(){
- newObj.style.display = "block";
- }, 1000);
- }
-
- return obj;
-
-};
-
-_V_.flash.getEmbedCode = function(swf, flashVars, params, attributes){
-
- var objTag = '<object type="application/x-shockwave-flash"',
- flashVarsString = '',
- paramsString = ''
- attrsString = '';
-
- // Convert flash vars to string
- if (flashVars) {
- _V_.eachProp(flashVars, function(key, val){
- flashVarsString += (key + "=" + val + "&amp;");
- });
- }
-
- // Add swf, flashVars, and other default params
- params = _V_.merge({
- movie: swf,
- flashvars: flashVarsString,
- allowScriptAccess: "always", // Required to talk to swf
- allowNetworking: "all" // All should be default, but having security issues.
- }, params);
-
- // Create param tags string
- _V_.eachProp(params, function(key, val){
- paramsString += '<param name="'+key+'" value="'+val+'" />';
- });
-
- attributes = _V_.merge({
- // Add swf to attributes (need both for IE and Others to work)
- data: swf,
-
- // Default to 100% width/height
- width: "100%",
- height: "100%"
-
- }, attributes);
-
- // Create Attributes string
- _V_.eachProp(attributes, function(key, val){
- attrsString += (key + '="' + val + '" ');
- });
-
- return objTag + attrsString + '>' + paramsString + '</object>';
-}
-_V_.Track = function(attributes, player){
- // Store reference to the parent player
- this.player = player;
-
- this.src = attributes.src;
- this.kind = attributes.kind;
- this.srclang = attributes.srclang;
- this.label = attributes.label;
- this["default"] = attributes["default"]; // 'default' is reserved-ish
- this.title = attributes.title;
-
- this.cues = [];
- this.currentCue = false;
- this.lastCueIndex = 0;
-
- // Update current cue on timeupdate
- player.addEvent("timeupdate", _V_.proxy(this, this.update));
-
- // Reset cue time on media end
- player.addEvent("ended", _V_.proxy(this, function() { this.lastCueIndex = 0; }));
-
- // Load Track File
- _V_.get(attributes.src, _V_.proxy(this, this.parseCues));
-};
-
-_V_.Track.prototype = {
-
- parseCues: function(srcContent) {
- var cue, time, text,
- lines = srcContent.split("\n"),
- line = "";
-
- for (var i=0; i<lines.length; i++) {
- line = _V_.trim(lines[i]); // Trim whitespace and linebreaks
- if (line) { // Loop until a line with content
-
- // First line - Number
- cue = {
- id: line, // Cue Number
- index: this.cues.length // Position in Array
- };
-
- // Second line - Time
- line = _V_.trim(lines[++i]);
- time = line.split(" --> ");
- cue.startTime = this.parseCueTime(time[0]);
- cue.endTime = this.parseCueTime(time[1]);
-
- // Additional lines - Cue Text
- text = [];
- for (var j=i; j<lines.length; j++) { // Loop until a blank line or end of lines
- line = _V_.trim(lines[++i]);
- if (!line) { break; }
- text.push(line);
- }
- cue.text = text.join('<br/>');
-
- // Add this cue
- this.cues.push(cue);
- }
- }
- },
-
- parseCueTime: function(timeText) {
- var parts = timeText.split(':'),
- time = 0;
- // hours => seconds
- time += parseFloat(parts[0])*60*60;
- // minutes => seconds
- time += parseFloat(parts[1])*60;
- // get seconds
- var seconds = parts[2].split(/\.|,/); // Either . or ,
- time += parseFloat(seconds[0]);
- // add miliseconds
- ms = parseFloat(seconds[1]);
- if (ms) { time += ms/1000; }
- return time;
- },
-
- update: function(){
- // Assuming all cues are in order by time, and do not overlap
- if (this.cues && this.cues.length > 0) {
- var time = this.player.currentTime();
- // If current cue should stay showing, don't do anything. Otherwise, find new cue.
- if (!this.currentCue || this.currentCue.startTime >= time || this.currentCue.endTime < time) {
- var newSubIndex = false,
- // Loop in reverse if lastCue is after current time (optimization)
- // Meaning the user is scrubbing in reverse or rewinding
- reverse = (this.cues[this.lastCueIndex].startTime > time),
- // If reverse, step back 1 becase we know it's not the lastCue
- i = this.lastCueIndex - (reverse ? 1 : 0);
- while (true) { // Loop until broken
- if (reverse) { // Looping in reverse
- // Stop if no more, or this cue ends before the current time (no earlier cues should apply)
- if (i < 0 || this.cues[i].endTime < time) { break; }
- // End is greater than time, so if start is less, show this cue
- if (this.cues[i].startTime < time) {
- newSubIndex = i;
- break;
- }
- i--;
- } else { // Looping forward
- // Stop if no more, or this cue starts after time (no later cues should apply)
- if (i >= this.cues.length || this.cues[i].startTime > time) { break; }
- // Start is less than time, so if end is later, show this cue
- if (this.cues[i].endTime > time) {
- newSubIndex = i;
- break;
- }
- i++;
- }
- }
-
- // Set or clear current cue
- if (newSubIndex !== false) {
- this.currentCue = this.cues[newSubIndex];
- this.lastCueIndex = newSubIndex;
- this.updatePlayer(this.currentCue.text);
- } else if (this.currentCue) {
- this.currentCue = false;
- this.updatePlayer("");
- }
- }
- }
- },
-
- // Update the stored value for the current track kind
- // and trigger an event to update all text track displays.
- updatePlayer: function(text){
- this.player.textTrackValue(this.kind, text);
- }
-};
-_V_.addEvent(window, "load", function(){
- _V_.windowLoaded = true;
-});
-
-// Run Auto-load players
-_V_.autoSetup();
-// Expose to global
-window.VideoJS = window._V_ = VideoJS;
-
-// End self-executing function
-})(window);
diff --git a/extlib/video-js/video.min.js b/extlib/video-js/video.min.js
index 026a0126..1c33af55 100644
--- a/extlib/video-js/video.min.js
+++ b/extlib/video-js/video.min.js
@@ -1,6 +1,6 @@
/*!
Video.js - HTML5 Video Player
-Version 3.1.0
+Version GENERATED_AT_BUILD
LGPL v3 LICENSE INFO
This file is part of Video.js. Copyright 2011 Zencoder, Inc.
@@ -18,4 +18,4 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Video.js. If not, see <http://www.gnu.org/licenses/>.
*/
-(function(window,undefined){var document=window.document;document.createElement("video");document.createElement("audio");var VideoJS=function(id,addOptions,ready){var tag;if(typeof id=="string"){if(id.indexOf("#")===0){id=id.slice(1)}if(_V_.players[id]){return _V_.players[id]}else{tag=_V_.el(id)}}else{tag=id}if(!tag||!tag.nodeName){throw new TypeError("The element or ID supplied is not valid. (VideoJS)")}return tag.player||new _V_.Player(tag,addOptions,ready)},_V_=VideoJS,CDN_VERSION="3.1";VideoJS.players={};VideoJS.options={techOrder:["html5","flash"],html5:{},flash:{swf:"http://vjs.zencdn.net/c/video-js.swf"},width:"auto",height:"auto",defaultVolume:0,components:{poster:{},loadingSpinner:{},bigPlayButton:{},controlBar:{},subtitlesDisplay:{}}};if(CDN_VERSION!="GENERATED_CDN_VSN"){_V_.options.flash.swf="http://vjs.zencdn.net/"+CDN_VERSION+"/video-js.swf"}_V_.autoSetup=function(){var options,vid,player,vids=document.getElementsByTagName("video");if(vids&&vids.length>0){for(var i=0,j=vids.length;i<j;i++){vid=vids[i];if(vid&&vid.getAttribute){if(vid.player===undefined){options=vid.getAttribute("data-setup");if(options!==null){options=JSON.parse(options||"{}");player=_V_(vid,options)}}}else{_V_.autoSetupTimeout(1);break}}}else{if(!_V_.windowLoaded){_V_.autoSetupTimeout(1)}}};_V_.autoSetupTimeout=function(wait){setTimeout(_V_.autoSetup,wait)};_V_.merge=function(obj1,obj2,safe){if(!obj2){obj2={}}for(var attrname in obj2){if(obj2.hasOwnProperty(attrname)&&(!safe||!obj1.hasOwnProperty(attrname))){obj1[attrname]=obj2[attrname]}}return obj1};_V_.extend=function(obj){this.merge(this,obj,true)};_V_.extend({tech:{},controlSets:{},isIE:function(){return !+"\v1"},isFF:function(){return !!_V_.ua.match("Firefox")},isIPad:function(){return navigator.userAgent.match(/iPad/i)!==null},isIPhone:function(){return navigator.userAgent.match(/iPhone/i)!==null},isIOS:function(){return VideoJS.isIPhone()||VideoJS.isIPad()},iOSVersion:function(){var match=navigator.userAgent.match(/OS (\d+)_/i);if(match&&match[1]){return match[1]}},isAndroid:function(){return navigator.userAgent.match(/Android.*AppleWebKit/i)!==null},androidVersion:function(){var match=navigator.userAgent.match(/Android (\d+)\./i);if(match&&match[1]){return match[1]}},testVid:document.createElement("video"),ua:navigator.userAgent,support:{},each:function(arr,fn){if(!arr||arr.length===0){return}for(var i=0,j=arr.length;i<j;i++){fn.call(this,arr[i],i)}},eachProp:function(obj,fn){if(!obj){return}for(var name in obj){if(obj.hasOwnProperty(name)){fn.call(this,name,obj[name])}}},el:function(id){return document.getElementById(id)},createElement:function(tagName,attributes){var el=document.createElement(tagName),attrname;for(attrname in attributes){if(attributes.hasOwnProperty(attrname)){if(attrname.indexOf("-")!==-1){el.setAttribute(attrname,attributes[attrname])}else{el[attrname]=attributes[attrname]}}}return el},insertFirst:function(node,parent){if(parent.firstChild){parent.insertBefore(node,parent.firstChild)}else{parent.appendChild(node)}},addClass:function(element,classToAdd){if((" "+element.className+" ").indexOf(" "+classToAdd+" ")==-1){element.className=element.className===""?classToAdd:element.className+" "+classToAdd}},removeClass:function(element,classToRemove){if(element.className.indexOf(classToRemove)==-1){return}var classNames=element.className.split(" ");classNames.splice(classNames.indexOf(classToRemove),1);element.className=classNames.join(" ")},remove:function(item,array){if(!array){return}var i=array.indexOf(item);if(i!=-1){return array.splice(i,1)}},blockTextSelection:function(){document.body.focus();document.onselectstart=function(){return false}},unblockTextSelection:function(){document.onselectstart=function(){return true}},formatTime:function(seconds,guide){guide=guide||seconds;var s=Math.floor(seconds%60),m=Math.floor(seconds/60%60),h=Math.floor(seconds/3600),gm=Math.floor(guide/60%60),gh=Math.floor(guide/3600);h=(h>0||gh>0)?h+":":"";m=(((h||gm>=10)&&m<10)?"0"+m:m)+":";s=(s<10)?"0"+s:s;return h+m+s},capitalize:function(string){return string.charAt(0).toUpperCase()+string.slice(1)},getRelativePosition:function(x,relativeElement){return Math.max(0,Math.min(1,(x-_V_.findPosX(relativeElement))/relativeElement.offsetWidth))},getComputedStyleValue:function(element,style){return window.getComputedStyle(element,null).getPropertyValue(style)},trim:function(string){return string.toString().replace(/^\s+/,"").replace(/\s+$/,"")},round:function(num,dec){if(!dec){dec=0}return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},isEmpty:function(object){for(var prop in object){return false}return true},createTimeRange:function(start,end){return{length:1,start:function(){return start},end:function(){return end}}},cache:{},guid:1,expando:"vdata"+(new Date).getTime(),getData:function(elem){var id=elem[_V_.expando];if(!id){id=elem[_V_.expando]=_V_.guid++;_V_.cache[id]={}}return _V_.cache[id]},removeData:function(elem){var id=elem[_V_.expando];if(!id){return}delete _V_.cache[id];try{delete elem[_V_.expando]}catch(e){if(elem.removeAttribute){elem.removeAttribute(_V_.expando)}else{elem[_V_.expando]=null}}},proxy:function(context,fn){if(!fn.guid){fn.guid=_V_.guid++}var ret=function(){return fn.apply(context,arguments)};ret.guid=fn.guid;return ret},get:function(url,onSuccess,onError){var local=(url.indexOf("file:")==0||(window.location.href.indexOf("file:")==0&&url.indexOf("http:")==-1));if(typeof XMLHttpRequest=="undefined"){XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(g){}throw new Error("This browser does not support XMLHttpRequest.")}}var request=new XMLHttpRequest();try{request.open("GET",url)}catch(e){_V_.log("VideoJS XMLHttpRequest (open)",e);return false}request.onreadystatechange=_V_.proxy(this,function(){if(request.readyState==4){if(request.status==200||local&&request.status==0){onSuccess(request.responseText)}else{if(onError){onError()}}}});try{request.send()}catch(e){_V_.log("VideoJS XMLHttpRequest (send)",e);if(onError){onError(e)}}},setLocalStorage:function(key,value){var localStorage=localStorage||false;if(!localStorage){return}try{localStorage[key]=value}catch(e){if(e.code==22||e.code==1014){_V_.log("LocalStorage Full (VideoJS)",e)}else{_V_.log("LocalStorage Error (VideoJS)",e)}}}});_V_.log=function(){_V_.log.history=_V_.log.history||[];_V_.log.history.push(arguments);if(window.console){arguments.callee=arguments.callee.caller;var newarr=[].slice.call(arguments);(typeof console.log==="object"?_V_.log.apply.call(console.log,console,newarr):console.log.apply(console,newarr))}};(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try{console.log();return window.console}catch(err){return window.console={}}})());if("getBoundingClientRect" in document.documentElement){_V_.findPosX=function(el){var box;try{box=el.getBoundingClientRect()}catch(e){}if(!box){return 0}var docEl=document.documentElement,body=document.body,clientLeft=docEl.clientLeft||body.clientLeft||0,scrollLeft=window.pageXOffset||body.scrollLeft,left=box.left+scrollLeft-clientLeft;return left}}else{_V_.findPosX=function(el){var curleft=el.offsetLeft;while(el=obj.offsetParent){if(el.className.indexOf("video-js")==-1){}else{}curleft+=el.offsetLeft}return curleft}}(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;_V_.Class=function(){};_V_.Class.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret}})(name,prop[name]):prop[name]}function Class(){if(!initializing&&this.init){return this.init.apply(this,arguments)}else{if(!initializing){return arguments.callee.prototype.init()}}}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class}})();_V_.Component=_V_.Class.extend({init:function(player,options){this.player=player;options=this.options=_V_.merge(this.options||{},options);if(options.el){this.el=options.el}else{this.el=this.createElement()}this.initComponents()},destroy:function(){},createElement:function(type,attrs){return _V_.createElement(type||"div",attrs)},buildCSSClass:function(){return""},initComponents:function(){var options=this.options;if(options&&options.components){this.eachProp(options.components,function(name,opts){var tempAdd=this.proxy(function(){this.addComponent(name,opts)});if(opts.loadEvent){this.one(opts.loadEvent,tempAdd)}else{tempAdd()}})}},addComponent:function(name,options){var componentClass,component;options=options||{};componentClass=options.componentClass||_V_.capitalize(name);component=new _V_[componentClass](this.player||this,options);this.el.appendChild(component.el);this[name]=component},show:function(){this.el.style.display="block"},hide:function(){this.el.style.display="none"},fadeIn:function(){this.removeClass("vjs-fade-out");this.addClass("vjs-fade-in")},fadeOut:function(){this.removeClass("vjs-fade-in");this.addClass("vjs-fade-out")},addClass:function(classToAdd){_V_.addClass(this.el,classToAdd)},removeClass:function(classToRemove){_V_.removeClass(this.el,classToRemove)},addEvent:function(type,fn){return _V_.addEvent(this.el,type,_V_.proxy(this,fn))},removeEvent:function(type,fn){return _V_.removeEvent(this.el,type,fn)},triggerEvent:function(type,e){return _V_.triggerEvent(this.el,type,e)},one:function(type,fn){_V_.one.call(this,this.el,type,fn)},ready:function(fn){if(!fn){return this}if(this.isReady){fn.call(this)}else{if(this.readyQueue===undefined){this.readyQueue=[]}this.readyQueue.push(fn)}return this},triggerReady:function(){this.isReady=true;if(this.readyQueue&&this.readyQueue.length>0){this.each(this.readyQueue,function(fn){fn.call(this)});this.readyQueue=[]}},each:function(arr,fn){_V_.each.call(this,arr,fn)},eachProp:function(obj,fn){_V_.eachProp.call(this,obj,fn)},extend:function(obj){_V_.merge(this,obj)},proxy:function(fn){return _V_.proxy(this,fn)}});_V_.Control=_V_.Component.extend({buildCSSClass:function(){return"vjs-control "+this._super()}});_V_.Button=_V_.Control.extend({init:function(player,options){this._super(player,options);this.addEvent("click",this.onClick);this.addEvent("focus",this.onFocus);this.addEvent("blur",this.onBlur)},createElement:function(type,attrs){attrs=_V_.merge({className:this.buildCSSClass(),innerHTML:'<div><span class="vjs-control-text">'+(this.buttonText||"Need Text")+"</span></div>",role:"button",tabIndex:0},attrs);return this._super(type,attrs)},onClick:function(){},onFocus:function(){_V_.addEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))},onKeyPress:function(event){if(event.which==32||event.which==13){event.preventDefault();this.onClick()}},onBlur:function(){_V_.removeEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))}});_V_.PlayButton=_V_.Button.extend({buttonText:"Play",buildCSSClass:function(){return"vjs-play-button "+this._super()},onClick:function(){this.player.play()}});_V_.PauseButton=_V_.Button.extend({buttonText:"Pause",buildCSSClass:function(){return"vjs-pause-button "+this._super()},onClick:function(){this.player.pause()}});_V_.PlayToggle=_V_.Button.extend({buttonText:"Play",init:function(player,options){this._super(player,options);player.addEvent("play",_V_.proxy(this,this.onPlay));player.addEvent("pause",_V_.proxy(this,this.onPause))},buildCSSClass:function(){return"vjs-play-control "+this._super()},onClick:function(){if(this.player.paused()){this.player.play()}else{this.player.pause()}},onPlay:function(){_V_.removeClass(this.el,"vjs-paused");_V_.addClass(this.el,"vjs-playing")},onPause:function(){_V_.removeClass(this.el,"vjs-playing");_V_.addClass(this.el,"vjs-paused")}});_V_.FullscreenToggle=_V_.Button.extend({buttonText:"Fullscreen",buildCSSClass:function(){return"vjs-fullscreen-control "+this._super()},onClick:function(){if(!this.player.isFullScreen){this.player.requestFullScreen()}else{this.player.cancelFullScreen()}}});_V_.BigPlayButton=_V_.Button.extend({init:function(player,options){this._super(player,options);player.addEvent("play",_V_.proxy(this,this.hide));player.addEvent("ended",_V_.proxy(this,this.show))},createElement:function(){return this._super("div",{className:"vjs-big-play-button",innerHTML:"<span></span>"})},onClick:function(){if(this.player.currentTime()){this.player.currentTime(0)}this.player.play()}});_V_.LoadingSpinner=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("canplay",_V_.proxy(this,this.hide));player.addEvent("canplaythrough",_V_.proxy(this,this.hide));player.addEvent("playing",_V_.proxy(this,this.hide));player.addEvent("seeking",_V_.proxy(this,this.show));player.addEvent("error",_V_.proxy(this,this.show));player.addEvent("waiting",_V_.proxy(this,this.show))},createElement:function(){var classNameSpinner,innerHtmlSpinner;if(typeof this.player.el.style.WebkitBorderRadius=="string"||typeof this.player.el.style.MozBorderRadius=="string"||typeof this.player.el.style.KhtmlBorderRadius=="string"||typeof this.player.el.style.borderRadius=="string"){classNameSpinner="vjs-loading-spinner";innerHtmlSpinner="<div class='ball1'></div><div class='ball2'></div><div class='ball3'></div><div class='ball4'></div><div class='ball5'></div><div class='ball6'></div><div class='ball7'></div><div class='ball8'></div>"}else{classNameSpinner="vjs-loading-spinner-fallback";innerHtmlSpinner=""}return this._super("div",{className:classNameSpinner,innerHTML:innerHtmlSpinner})}});_V_.ControlBar=_V_.Component.extend({options:{loadEvent:"play",components:{playToggle:{},fullscreenToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},volumeControl:{},muteToggle:{}}},init:function(player,options){this._super(player,options);player.addEvent("play",this.proxy(function(){this.fadeIn();this.player.addEvent("mouseover",this.proxy(this.fadeIn));this.player.addEvent("mouseout",this.proxy(this.fadeOut))}))},createElement:function(){return _V_.createElement("div",{className:"vjs-controls"})},fadeIn:function(){this._super();this.player.triggerEvent("controlsvisible")},fadeOut:function(){this._super();this.player.triggerEvent("controlshidden")}});_V_.CurrentTimeDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-current-time-display",innerHTML:"0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){var time=(this.player.scrubbing)?this.player.values.currentTime:this.player.currentTime();this.content.innerHTML=_V_.formatTime(time,this.player.duration())}});_V_.DurationDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-duration-display",innerHTML:"0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){if(this.player.duration()){this.content.innerHTML=_V_.formatTime(this.player.duration())}}});_V_.TimeDivider=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})}});_V_.RemainingTimeDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-remaining-time-display",innerHTML:"-0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){if(this.player.duration()){this.content.innerHTML="-"+_V_.formatTime(this.player.remainingTime())}}});_V_.Slider=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent(this.playerEvent,_V_.proxy(this,this.update));this.addEvent("mousedown",this.onMouseDown);this.addEvent("focus",this.onFocus);this.addEvent("blur",this.onBlur);this.player.addEvent("controlsvisible",this.proxy(this.update));this.update()},createElement:function(type,attrs){attrs=_V_.merge({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},attrs);return this._super(type,attrs)},onMouseDown:function(event){event.preventDefault();_V_.blockTextSelection();_V_.addEvent(document,"mousemove",_V_.proxy(this,this.onMouseMove));_V_.addEvent(document,"mouseup",_V_.proxy(this,this.onMouseUp));this.onMouseMove(event)},onMouseUp:function(event){_V_.unblockTextSelection();_V_.removeEvent(document,"mousemove",this.onMouseMove,false);_V_.removeEvent(document,"mouseup",this.onMouseUp,false);this.update()},update:function(){var barProgress,progress=this.getPercent();handle=this.handle,bar=this.bar;if(isNaN(progress)){progress=0}barProgress=progress;if(handle){var box=this.el,boxWidth=box.offsetWidth,handleWidth=handle.el.offsetWidth,handlePercent=(handleWidth)?handleWidth/boxWidth:0,boxAdjustedPercent=1-handlePercent;adjustedProgress=progress*boxAdjustedPercent,barProgress=adjustedProgress+(handlePercent/2);handle.el.style.left=_V_.round(adjustedProgress*100,2)+"%"}bar.el.style.width=_V_.round(barProgress*100,2)+"%"},calculateDistance:function(event){var box=this.el,boxX=_V_.findPosX(box),boxW=box.offsetWidth,handle=this.handle;if(handle){var handleW=handle.el.offsetWidth;boxX=boxX+(handleW/2);boxW=boxW-handleW}return Math.max(0,Math.min(1,(event.pageX-boxX)/boxW))},onFocus:function(event){_V_.addEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))},onKeyPress:function(event){if(event.which==37){event.preventDefault();this.stepBack()}else{if(event.which==39){event.preventDefault();this.stepForward()}}},onBlur:function(event){_V_.removeEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))}});_V_.ProgressControl=_V_.Component.extend({options:{components:{seekBar:{}}},createElement:function(){return this._super("div",{className:"vjs-progress-control vjs-control"})}});_V_.SeekBar=_V_.Slider.extend({options:{components:{loadProgressBar:{},bar:{componentClass:"PlayProgressBar"},handle:{componentClass:"SeekHandle"}}},playerEvent:"timeupdate",init:function(player,options){this._super(player,options)},createElement:function(){return this._super("div",{className:"vjs-progress-holder"})},getPercent:function(){return this.player.currentTime()/this.player.duration()},onMouseDown:function(event){this._super(event);this.player.scrubbing=true;this.videoWasPlaying=!this.player.paused();this.player.pause()},onMouseMove:function(event){var newTime=this.calculateDistance(event)*this.player.duration();if(newTime==this.player.duration()){newTime=newTime-0.1}this.player.currentTime(newTime)},onMouseUp:function(event){this._super(event);this.player.scrubbing=false;if(this.videoWasPlaying){this.player.play()}},stepForward:function(){this.player.currentTime(this.player.currentTime()+1)},stepBack:function(){this.player.currentTime(this.player.currentTime()-1)}});_V_.LoadProgressBar=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("progress",_V_.proxy(this,this.update))},createElement:function(){return this._super("div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})},update:function(){if(this.el.style){this.el.style.width=_V_.round(this.player.bufferedPercent()*100,2)+"%"}}});_V_.PlayProgressBar=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})}});_V_.SeekHandle=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-seek-handle",innerHTML:'<span class="vjs-control-text">00:00</span>'})}});_V_.VolumeControl=_V_.Component.extend({options:{components:{volumeBar:{}}},createElement:function(){return this._super("div",{className:"vjs-volume-control vjs-control"})}});_V_.VolumeBar=_V_.Slider.extend({options:{components:{bar:{componentClass:"VolumeLevel"},handle:{componentClass:"VolumeHandle"}}},playerEvent:"volumechange",createElement:function(){return this._super("div",{className:"vjs-volume-bar"})},onMouseMove:function(event){this.player.volume(this.calculateDistance(event))},getPercent:function(){return this.player.volume()},stepForward:function(){this.player.volume(this.player.volume()+0.1)},stepBack:function(){this.player.volume(this.player.volume()-0.1)}});_V_.VolumeLevel=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})}});_V_.VolumeHandle=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-volume-handle",innerHTML:'<span class="vjs-control-text"></span>'})}});_V_.MuteToggle=_V_.Button.extend({init:function(player,options){this._super(player,options);player.addEvent("volumechange",_V_.proxy(this,this.update))},createElement:function(){return this._super("div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})},onClick:function(event){this.player.muted(this.player.muted()?false:true)},update:function(event){var vol=this.player.volume(),level=3;if(vol==0||this.player.muted()){level=0}else{if(vol<0.33){level=1}else{if(vol<0.67){level=2}}}_V_.each.call(this,[0,1,2,3],function(i){_V_.removeClass(this.el,"vjs-vol-"+i)});_V_.addClass(this.el,"vjs-vol-"+level)}});_V_.Poster=_V_.Button.extend({init:function(player,options){this._super(player,options);if(!this.player.options.poster){this.hide()}player.addEvent("play",_V_.proxy(this,this.hide))},createElement:function(){return _V_.createElement("img",{className:"vjs-poster",src:this.player.options.poster,tabIndex:-1})},onClick:function(){this.player.play()}});_V_.TextTrackDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent(this.trackType+"update",_V_.proxy(this,this.update))},createElement:function(){return this._super("div",{className:"vjs-"+this.trackType})},update:function(){this.el.innerHTML=this.player.textTrackValue(this.trackType)}});_V_.SubtitlesDisplay=_V_.TextTrackDisplay.extend({trackType:"subtitles"});_V_.CaptionsDisplay=_V_.TextTrackDisplay.extend({trackType:"captions"});_V_.ChaptersDisplay=_V_.TextTrackDisplay.extend({trackType:"chapters"});_V_.DescriptionsDisplay=_V_.TextTrackDisplay.extend({trackType:"descriptions"});if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement){if(this===void 0||this===null){throw new TypeError()}var t=Object(this);var len=t.length>>>0;if(len===0){return -1}var n=0;if(arguments.length>0){n=Number(arguments[1]);if(n!==n){n=0}else{if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*Math.floor(Math.abs(n))}}}if(n>=len){return -1}var k=n>=0?n:Math.max(len-Math.abs(n),0);for(;k<len;k++){if(k in t&&t[k]===searchElement){return k}}return -1}}_V_.extend({addEvent:function(elem,type,fn){var data=_V_.getData(elem),handlers;if(data&&!data.handler){data.handler=function(event){event=_V_.fixEvent(event);var handlers=_V_.getData(elem).events[event.type];if(handlers){var handlersCopy=[];_V_.each(handlers,function(handler,i){handlersCopy[i]=handler});for(var i=0,l=handlersCopy.length;i<l;i++){handlersCopy[i].call(elem,event)}}}}if(!data.events){data.events={}}handlers=data.events[type];if(!handlers){handlers=data.events[type]=[];if(document.addEventListener){elem.addEventListener(type,data.handler,false)}else{if(document.attachEvent){elem.attachEvent("on"+type,data.handler)}}}if(!fn.guid){fn.guid=_V_.guid++}handlers.push(fn)},removeEvent:function(elem,type,fn){var data=_V_.getData(elem),handlers;if(!data.events){return}if(!type){for(type in data.events){_V_.cleanUpEvents(elem,type)}return}handlers=data.events[type];if(!handlers){return}if(fn&&fn.guid){for(var i=0;i<handlers.length;i++){if(handlers[i].guid===fn.guid){handlers.splice(i--,1)}}}_V_.cleanUpEvents(elem,type)},cleanUpEvents:function(elem,type){var data=_V_.getData(elem);if(data.events[type].length===0){delete data.events[type];if(document.removeEventListener){elem.removeEventListener(type,data.handler,false)}else{if(document.detachEvent){elem.detachEvent("on"+type,data.handler)}}}if(_V_.isEmpty(data.events)){delete data.events;delete data.handler}if(_V_.isEmpty(data)){_V_.removeData(elem)}},fixEvent:function(event){if(event[_V_.expando]){return event}var originalEvent=event;event=new _V_.Event(originalEvent);for(var i=_V_.Event.props.length,prop;i;){prop=_V_.Event.props[--i];event[prop]=originalEvent[prop]}if(!event.target){event.target=event.srcElement||document}if(event.target.nodeType===3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var eventDocument=event.target.ownerDocument||document,doc=eventDocument.documentElement,body=eventDocument.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}if(event.which==null&&(event.charCode!=null||event.keyCode!=null)){event.which=event.charCode!=null?event.charCode:event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))}return event},triggerEvent:function(elem,event){var data=_V_.getData(elem),parent=elem.parentNode||elem.ownerDocument,type=event.type||event,handler;if(data){handler=data.handler}event=typeof event==="object"?event[_V_.expando]?event:new _V_.Event(type,event):new _V_.Event(type);event.type=type;if(handler){handler.call(elem,event)}event.result=undefined;event.target=elem},one:function(elem,type,fn){_V_.addEvent(elem,type,function(){_V_.removeEvent(elem,type,arguments.callee);fn.apply(this,arguments)})}});_V_.Event=function(src,props){if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=(src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault())?returnTrue:returnFalse}else{this.type=src}if(props){_V_.merge(this,props)}this.timeStamp=(new Date).getTime();this[_V_.expando]=true};_V_.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return}if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return}if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};_V_.Event.props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");function returnTrue(){return true}function returnFalse(){return false}var JSON;if(!JSON){JSON={}}(function(){var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());_V_.Player=_V_.Component.extend({init:function(tag,addOptions,ready){this.tag=tag;var el=this.el=_V_.createElement("div"),options=this.options={},width=options.width=tag.getAttribute("width"),height=options.height=tag.getAttribute("height"),initWidth=width||300,initHeight=height||150;tag.player=el.player=this;this.ready(ready);tag.parentNode.insertBefore(el,tag);el.appendChild(tag);el.id=this.id=tag.id;el.className=tag.className;tag.id+="_html5_api";tag.className="vjs-tech";_V_.players[el.id]=this;el.setAttribute("width",initWidth);el.setAttribute("height",initHeight);el.style.width=initWidth+"px";el.style.height=initHeight+"px";tag.removeAttribute("width");tag.removeAttribute("height");_V_.merge(options,_V_.options);_V_.merge(options,this.getVideoTagSettings());_V_.merge(options,addOptions);tag.removeAttribute("controls");tag.removeAttribute("poster");if(tag.hasChildNodes()){for(var i=0,j=tag.childNodes;i<j.length;i++){if(j[i].nodeName=="SOURCE"||j[i].nodeName=="TRACK"){tag.removeChild(j[i])}}}this.techs={};this.values={};this.addClass("vjs-paused");this.addEvent("ended",this.onEnded);this.addEvent("play",this.onPlay);this.addEvent("pause",this.onPause);this.addEvent("error",this.onError);if(options.controls){this.ready(function(){this.initComponents()})}if(!options.sources||options.sources.length==0){for(var i=0,j=options.techOrder;i<j.length;i++){var techName=j[i],tech=_V_[techName];if(tech.isSupported()){this.loadTech(techName);break}}}else{this.src(options.sources)}},values:{},destroy:function(){this.stopTrackingProgress();this.stopTrackingCurrentTime();delete _V_.players[this.id]},createElement:function(type,options){},getVideoTagSettings:function(){var options={sources:[],tracks:[]};options.src=this.tag.getAttribute("src");options.controls=this.tag.getAttribute("controls")!==null;options.poster=this.tag.getAttribute("poster");options.preload=this.tag.getAttribute("preload");options.autoplay=this.tag.getAttribute("autoplay")!==null;options.loop=this.tag.getAttribute("loop")!==null;options.muted=this.tag.getAttribute("muted")!==null;if(this.tag.hasChildNodes()){for(var c,i=0,j=this.tag.childNodes;i<j.length;i++){c=j[i];if(c.nodeName=="SOURCE"){options.sources.push({src:c.getAttribute("src"),type:c.getAttribute("type"),media:c.getAttribute("media"),title:c.getAttribute("title")})}if(c.nodeName=="TRACK"){options.tracks.push(new _V_.Track({src:c.getAttribute("src"),kind:c.getAttribute("kind"),srclang:c.getAttribute("srclang"),label:c.getAttribute("label"),"default":c.getAttribute("default")!==null,title:c.getAttribute("title")},this))}}}return options},loadTech:function(techName,source){if(this.tech){this.unloadTech()}else{if(techName!="html5"&&this.tag){this.el.removeChild(this.tag);this.tag=false}}this.techName=techName;this.isReady=false;var techReady=function(){this.player.triggerReady();if(!this.support.progressEvent){this.player.manualProgressOn()}if(!this.support.timeupdateEvent){this.player.manualTimeUpdatesOn()}};var techOptions=_V_.merge({source:source,parentEl:this.el},this.options[techName]);if(source){if(source.src==this.values.src&&this.values.currentTime>0){techOptions.startTime=this.values.currentTime}this.values.src=source.src}this.tech=new _V_[techName](this,techOptions);this.tech.ready(techReady)},unloadTech:function(){this.tech.destroy();if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}this.tech=false},manualProgressOn:function(){this.manualProgress=true;this.trackProgress();this.tech.addEvent("progress",function(){this.removeEvent("progress",arguments.callee);this.support.progressEvent=true;this.player.manualProgressOff()})},manualProgressOff:function(){this.manualProgress=false;this.stopTrackingProgress()},trackProgress:function(){this.progressInterval=setInterval(_V_.proxy(this,function(){if(this.values.bufferEnd<this.buffered().end(0)){this.triggerEvent("progress")}else{if(this.bufferedPercent()==1){this.stopTrackingProgress();this.triggerEvent("progress")}}}),500)},stopTrackingProgress:function(){clearInterval(this.progressInterval)},manualTimeUpdatesOn:function(){this.manualTimeUpdates=true;this.addEvent("play",this.trackCurrentTime);this.addEvent("pause",this.stopTrackingCurrentTime);this.tech.addEvent("timeupdate",function(){this.removeEvent("timeupdate",arguments.callee);this.support.timeupdateEvent=true;this.player.manualTimeUpdatesOff()})},manualTimeUpdatesOff:function(){this.manualTimeUpdates=false;this.stopTrackingCurrentTime();this.removeEvent("play",this.trackCurrentTime);this.removeEvent("pause",this.stopTrackingCurrentTime)},trackCurrentTime:function(){if(this.currentTimeInterval){this.stopTrackingCurrentTime()}this.currentTimeInterval=setInterval(_V_.proxy(this,function(){this.triggerEvent("timeupdate")}),250)},stopTrackingCurrentTime:function(){clearInterval(this.currentTimeInterval)},onEnded:function(){if(this.options.loop){this.currentTime(0);this.play()}else{this.pause();this.currentTime(0);this.pause()}},onPlay:function(){_V_.removeClass(this.el,"vjs-paused");_V_.addClass(this.el,"vjs-playing")},onPause:function(){_V_.removeClass(this.el,"vjs-playing");_V_.addClass(this.el,"vjs-paused")},onError:function(e){_V_.log("Video Error",e)},apiCall:function(method,arg){if(this.isReady){return this.tech[method](arg)}else{_V_.log("The playback technology API is not ready yet. Use player.ready(myFunction). ["+method+"]",arguments.callee.caller.arguments.callee.caller.arguments.callee.caller);return false}},play:function(){this.apiCall("play");return this},pause:function(){this.apiCall("pause");return this},paused:function(){return this.apiCall("paused")},currentTime:function(seconds){if(seconds!==undefined){this.values.lastSetCurrentTime=seconds;this.apiCall("setCurrentTime",seconds);if(this.manualTimeUpdates){this.triggerEvent("timeupdate")}return this}return this.values.currentTime=this.apiCall("currentTime")},duration:function(){return this.apiCall("duration")},remainingTime:function(){return this.duration()-this.currentTime()},buffered:function(){var buffered=this.apiCall("buffered"),start=0,end=this.values.bufferEnd=this.values.bufferEnd||0,timeRange;if(buffered&&buffered.length>0&&buffered.end(0)!==end){end=buffered.end(0);this.values.bufferEnd=end}return _V_.createTimeRange(start,end)},bufferedPercent:function(){return(this.duration())?this.buffered().end(0)/this.duration():0},volume:function(percentAsDecimal){if(percentAsDecimal!==undefined){var vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal)));this.values.volume=vol;this.apiCall("setVolume",vol);_V_.setLocalStorage("volume",vol);return this}return this.apiCall("volume")},muted:function(muted){if(muted!==undefined){this.apiCall("setMuted",muted);return this}return this.apiCall("muted")},width:function(width,skipListeners){if(width!==undefined){this.el.width=width;this.el.style.width=width+"px";if(!skipListeners){this.triggerEvent("resize")}return this}return parseInt(this.el.getAttribute("width"))},height:function(height){if(height!==undefined){this.el.height=height;this.el.style.height=height+"px";this.triggerEvent("resize");return this}return parseInt(this.el.getAttribute("height"))},size:function(width,height){return this.width(width,true).height(height)},supportsFullScreen:function(){return this.apiCall("supportsFullScreen")},requestFullScreen:function(){var requestFullScreen=_V_.support.requestFullScreen;this.isFullScreen=true;if(requestFullScreen){if(this.tech.support.fullscreenResize===false&&this.options.flash.iFrameMode!=true){this.pause();this.unloadTech();_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){_V_.removeEvent(document,requestFullScreen.eventName,arguments.callee);this.loadTech(this.techName,{src:this.values.src})}));this.el[requestFullScreen.requestFn]()}else{this.el[requestFullScreen.requestFn]()}_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){this.isFullScreen=document[requestFullScreen.isFullScreen]}))}else{if(this.tech.supportsFullScreen()){this.apiCall("enterFullScreen")}else{this.enterFullWindow()}}this.triggerEvent("fullscreenchange");return this},cancelFullScreen:function(){var requestFullScreen=_V_.support.requestFullScreen;if(requestFullScreen){if(this.tech.support.fullscreenResize===false&&this.options.flash.iFrameMode!=true){this.pause();this.unloadTech();_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){_V_.removeEvent(document,requestFullScreen.eventName,arguments.callee);this.loadTech(this.techName,{src:this.values.src})}));document[requestFullScreen.cancelFn]()}else{document[requestFullScreen.cancelFn]()}}else{if(this.tech.supportsFullScreen()){this.apiCall("exitFullScreen")}else{this.exitFullWindow()}}this.isFullScreen=false;this.triggerEvent("fullscreenchange");return this},enterFullWindow:function(){this.isFullWindow=true;this.docOrigOverflow=document.documentElement.style.overflow;_V_.addEvent(document,"keydown",_V_.proxy(this,this.fullWindowOnEscKey));document.documentElement.style.overflow="hidden";_V_.addClass(document.body,"vjs-full-window");_V_.addClass(this.el,"vjs-fullscreen");this.triggerEvent("enterFullWindow")},fullWindowOnEscKey:function(event){if(event.keyCode==27){if(this.isFullScreen==true){this.cancelFullScreen()}else{this.exitFullWindow()}}},exitFullWindow:function(){this.isFullWindow=false;_V_.removeEvent(document,"keydown",this.fullWindowOnEscKey);document.documentElement.style.overflow=this.docOrigOverflow;_V_.removeClass(document.body,"vjs-full-window");_V_.removeClass(this.el,"vjs-fullscreen");this.triggerEvent("exitFullWindow")},src:function(source){if(source instanceof Array){var sources=source;techLoop:for(var i=0,j=this.options.techOrder;i<j.length;i++){var techName=j[i],tech=_V_[techName];if(tech.isSupported()){for(var a=0,b=sources;a<b.length;a++){var source=b[a];if(tech.canPlaySource.call(this,source)){if(techName==this.techName){this.src(source)}else{this.loadTech(techName,source)}break techLoop}}}}}else{if(source instanceof Object){if(_V_[this.techName].canPlaySource(source)){this.src(source.src)}else{this.src([source])}}else{this.values.src=source;if(!this.isReady){this.ready(function(){this.src(source)})}else{this.apiCall("src",source);if(this.options.preload=="auto"){this.load()}if(this.options.autoplay){this.play()}}}}return this},load:function(){this.apiCall("load");return this},currentSrc:function(){return this.apiCall("currentSrc")},textTrackValue:function(kind,value){if(value!==undefined){this.values[kind]=value;this.triggerEvent(kind+"update");return this}return this.values[kind]},preload:function(value){if(value!==undefined){this.apiCall("setPreload",value);this.options.preload=value;return this}return this.apiCall("preload",value)},autoplay:function(value){if(value!==undefined){this.apiCall("setAutoplay",value);this.options.autoplay=value;return this}return this.apiCall("autoplay",value)},loop:function(value){if(value!==undefined){this.apiCall("setLoop",value);this.options.loop=value;return this}return this.apiCall("loop",value)},controls:function(){return this.options.controls},textTracks:function(){return this.options.tracks},poster:function(){return this.apiCall("poster")},error:function(){return this.apiCall("error")},networkState:function(){return this.apiCall("networkState")},readyState:function(){return this.apiCall("readyState")},seeking:function(){return this.apiCall("seeking")},initialTime:function(){return this.apiCall("initialTime")},startOffsetTime:function(){return this.apiCall("startOffsetTime")},played:function(){return this.apiCall("played")},seekable:function(){return this.apiCall("seekable")},ended:function(){return this.apiCall("ended")},videoTracks:function(){return this.apiCall("videoTracks")},audioTracks:function(){return this.apiCall("audioTracks")},videoWidth:function(){return this.apiCall("videoWidth")},videoHeight:function(){return this.apiCall("videoHeight")},defaultPlaybackRate:function(){return this.apiCall("defaultPlaybackRate")},playbackRate:function(){return this.apiCall("playbackRate")},controls:function(){return this.apiCall("controls")},defaultMuted:function(){return this.apiCall("defaultMuted")}});(function(){var requestFn,cancelFn,eventName,isFullScreen,playerProto=_V_.Player.prototype;if(document.cancelFullscreen!==undefined){requestFn="requestFullscreen";cancelFn="exitFullscreen";eventName="fullscreenchange";isFullScreen="fullScreen"}else{_V_.each(["moz","webkit"],function(prefix){if((prefix!="moz"||document.mozFullScreenEnabled)&&document[prefix+"CancelFullScreen"]!==undefined){requestFn=prefix+"RequestFullScreen";cancelFn=prefix+"CancelFullScreen";eventName=prefix+"fullscreenchange";if(prefix=="webkit"){isFullScreen=prefix+"IsFullScreen"}else{_V_.log("moz here");isFullScreen=prefix+"FullScreen"}}})}if(requestFn){_V_.support.requestFullScreen={requestFn:requestFn,cancelFn:cancelFn,eventName:eventName,isFullScreen:isFullScreen}}})();_V_.PlaybackTech=_V_.Component.extend({init:function(player,options){},onClick:function(){if(this.player.options.controls){_V_.PlayToggle.prototype.onClick.call(this)}}});_V_.apiMethods="play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");_V_.each(_V_.apiMethods,function(methodName){_V_.PlaybackTech.prototype[methodName]=function(){throw new Error("The '"+method+"' method is not available on the playback technology's API")}});_V_.html5=_V_.PlaybackTech.extend({init:function(player,options,ready){this.player=player;this.el=this.createElement();this.ready(ready);this.addEvent("click",this.proxy(this.onClick));var source=options.source;if(source&&this.el.currentSrc==source.src){player.triggerEvent("loadstart")}else{if(source){this.el.src=source.src}}player.ready(function(){if(this.options.autoplay&&this.paused()){this.tag.poster=null;this.play()}});this.setupTriggers();this.triggerReady()},destroy:function(){this.player.tag=false;this.removeTriggers();this.el.parentNode.removeChild(this.el)},createElement:function(){var html5=_V_.html5,player=this.player,el=player.tag,newEl;if(!el||this.support.movingElementInDOM===false){if(el){player.el.removeChild(el)}newEl=_V_.createElement("video",{id:el.id||player.el.id+"_html5_api",className:el.className||"vjs-tech"});el=newEl;_V_.insertFirst(el,player.el)}_V_.each(["autoplay","preload","loop","muted"],function(attr){el[attr]=player.options[attr]},this);return el},setupTriggers:function(){_V_.each.call(this,_V_.html5.events,function(type){_V_.addEvent(this.el,type,_V_.proxy(this.player,this.eventHandler))})},removeTriggers:function(){_V_.each.call(this,_V_.html5.events,function(type){_V_.removeEvent(this.el,type,_V_.proxy(this.player,this.eventHandler))})},eventHandler:function(e){e.stopPropagation();this.triggerEvent(e)},play:function(){this.el.play()},pause:function(){this.el.pause()},paused:function(){return this.el.paused},currentTime:function(){return this.el.currentTime},setCurrentTime:function(seconds){try{this.el.currentTime=seconds}catch(e){_V_.log(e,"Video isn't ready. (VideoJS)")}},duration:function(){return this.el.duration||0},buffered:function(){return this.el.buffered},volume:function(){return this.el.volume},setVolume:function(percentAsDecimal){this.el.volume=percentAsDecimal},muted:function(){return this.el.muted},setMuted:function(muted){this.el.muted=muted},width:function(){return this.el.offsetWidth},height:function(){return this.el.offsetHeight},supportsFullScreen:function(){if(typeof this.el.webkitEnterFullScreen=="function"){if(!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")){return true}}return false},enterFullScreen:function(){try{this.el.webkitEnterFullScreen()}catch(e){if(e.code==11){_V_.log("VideoJS: Video not ready.")}}},src:function(src){this.el.src=src},load:function(){this.el.load()},currentSrc:function(){return this.el.currentSrc},preload:function(){return this.el.preload},setPreload:function(val){this.el.preload=val},autoplay:function(){return this.el.autoplay},setAutoplay:function(val){this.el.autoplay=val},loop:function(){return this.el.loop},setLoop:function(val){this.el.loop=val},error:function(){return this.el.error},seeking:function(){return this.el.seeking},ended:function(){return this.el.ended},controls:function(){return this.player.options.controls},defaultMuted:function(){return this.el.defaultMuted}});_V_.html5.isSupported=function(){return !!document.createElement("video").canPlayType};_V_.html5.canPlaySource=function(srcObj){return !!document.createElement("video").canPlayType(srcObj.type)};_V_.html5.events="loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(",");_V_.html5.prototype.support={fullscreen:(typeof _V_.testVid.webkitEnterFullScreen!==undefined)?(!_V_.ua.match("Chrome")&&!_V_.ua.match("Mac OS X 10.5")?true:false):false,movingElementInDOM:!_V_.isIOS()};if(_V_.isAndroid()){if(_V_.androidVersion()<3){document.createElement("video").constructor.prototype.canPlayType=function(type){return(type&&type.toLowerCase().indexOf("video/mp4")!=-1)?"maybe":""}}}_V_.flash=_V_.PlaybackTech.extend({init:function(player,options){this.player=player;var source=options.source,parentEl=options.parentEl,placeHolder=this.el=_V_.createElement("div",{id:parentEl.id+"_temp_flash"}),objId=player.el.id+"_flash_api",playerOptions=player.options,flashVars=_V_.merge({readyFunction:"_V_.flash.onReady",eventProxyFunction:"_V_.flash.onEvent",errorEventProxyFunction:"_V_.flash.onError",autoplay:playerOptions.autoplay,preload:playerOptions.preload,loop:playerOptions.loop,muted:playerOptions.muted},options.flashVars),params=_V_.merge({wmode:"opaque",bgcolor:"#000000"},options.params),attributes=_V_.merge({id:objId,name:objId,"class":"vjs-tech"},options.attributes);if(source){flashVars.src=encodeURIComponent(source.src)}_V_.insertFirst(placeHolder,parentEl);if(options.startTime){this.ready(function(){this.load();this.play();this.currentTime(options.startTime)})}if(options.iFrameMode==true&&!_V_.isFF){var iFrm=_V_.createElement("iframe",{id:objId+"_iframe",name:objId+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});flashVars.readyFunction="ready";flashVars.eventProxyFunction="events";flashVars.errorEventProxyFunction="errors";_V_.addEvent(iFrm,"load",_V_.proxy(this,function(){var iDoc,objTag,swfLoc,iWin=iFrm.contentWindow,varString="";iDoc=iFrm.contentDocument?iFrm.contentDocument:iFrm.contentWindow.document;iDoc.write(_V_.flash.getEmbedCode(options.swf,flashVars,params,attributes));iWin.player=this.player;iWin.ready=_V_.proxy(this.player,function(currSwf){var el=iDoc.getElementById(currSwf),player=this,tech=player.tech;tech.el=el;_V_.addEvent(el,"click",tech.proxy(tech.onClick));_V_.flash.checkReady(tech)});iWin.events=_V_.proxy(this.player,function(swfID,eventName,other){var player=this;if(player&&player.techName=="flash"){player.triggerEvent(eventName)}});iWin.errors=_V_.proxy(this.player,function(swfID,eventName){_V_.log("Flash Error",eventName)})}));placeHolder.parentNode.replaceChild(iFrm,placeHolder)}else{_V_.flash.embed(options.swf,placeHolder,flashVars,params,attributes)}},destroy:function(){this.el.parentNode.removeChild(this.el)},play:function(){this.el.vjs_play()},pause:function(){this.el.vjs_pause()},src:function(src){this.el.vjs_src(src);if(this.player.autoplay){var tech=this;setTimeout(function(){tech.play()},0)}},load:function(){this.el.vjs_load()},poster:function(){this.el.vjs_getProperty("poster")},buffered:function(){return _V_.createTimeRange(0,this.el.vjs_getProperty("buffered"))},supportsFullScreen:function(){return false},enterFullScreen:function(){return false}});(function(){var api=_V_.flash.prototype,readWrite="preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),readOnly="error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks".split(","),callOnly="load,play,pause".split(",");createSetter=function(attr){var attrUpper=attr.charAt(0).toUpperCase()+attr.slice(1);api["set"+attrUpper]=function(val){return this.el.vjs_setProperty(attr,val)}},createGetter=function(attr){api[attr]=function(){return this.el.vjs_getProperty(attr)}};_V_.each(readWrite,function(attr){createGetter(attr);createSetter(attr)});_V_.each(readOnly,function(attr){createGetter(attr)})})();_V_.flash.isSupported=function(){return _V_.flash.version()[0]>=10};_V_.flash.canPlaySource=function(srcObj){if(srcObj.type in _V_.flash.prototype.support.formats){return"maybe"}};_V_.flash.prototype.support={formats:{"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},progressEvent:false,timeupdateEvent:false,fullscreenResize:false,parentResize:!(_V_.ua.match("Firefox"))};_V_.flash.onReady=function(currSwf){var el=_V_.el(currSwf);var player=el.player||el.parentNode.player,tech=player.tech;el.player=player;tech.el=el;tech.addEvent("click",tech.onClick);_V_.flash.checkReady(tech)};_V_.flash.checkReady=function(tech){if(tech.el.vjs_getProperty){tech.triggerReady()}else{setTimeout(function(){_V_.flash.checkReady(tech)},50)}};_V_.flash.onEvent=function(swfID,eventName){var player=_V_.el(swfID).player;player.triggerEvent(eventName)};_V_.flash.onError=function(swfID,err){_V_.log("Flash Error",err,swfID)};_V_.flash.version=function(){var version="0,0,0";try{version=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){version=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(e){}}return version.split(",")};_V_.flash.embed=function(swf,placeHolder,flashVars,params,attributes){var code=_V_.flash.getEmbedCode(swf,flashVars,params,attributes),obj=_V_.createElement("div",{innerHTML:code}).childNodes[0],par=placeHolder.parentNode;placeHolder.parentNode.replaceChild(obj,placeHolder);if(_V_.isIE()){var newObj=par.childNodes[0];setTimeout(function(){newObj.style.display="block"},1000)}return obj};_V_.flash.getEmbedCode=function(swf,flashVars,params,attributes){var objTag='<object type="application/x-shockwave-flash"',flashVarsString="",paramsString="";attrsString="";if(flashVars){_V_.eachProp(flashVars,function(key,val){flashVarsString+=(key+"="+val+"&amp;")})}params=_V_.merge({movie:swf,flashvars:flashVarsString,allowScriptAccess:"always",allowNetworking:"all"},params);_V_.eachProp(params,function(key,val){paramsString+='<param name="'+key+'" value="'+val+'" />'});attributes=_V_.merge({data:swf,width:"100%",height:"100%"},attributes);_V_.eachProp(attributes,function(key,val){attrsString+=(key+'="'+val+'" ')});return objTag+attrsString+">"+paramsString+"</object>"};_V_.Track=function(attributes,player){this.player=player;this.src=attributes.src;this.kind=attributes.kind;this.srclang=attributes.srclang;this.label=attributes.label;this["default"]=attributes["default"];this.title=attributes.title;this.cues=[];this.currentCue=false;this.lastCueIndex=0;player.addEvent("timeupdate",_V_.proxy(this,this.update));player.addEvent("ended",_V_.proxy(this,function(){this.lastCueIndex=0}));_V_.get(attributes.src,_V_.proxy(this,this.parseCues))};_V_.Track.prototype={parseCues:function(srcContent){var cue,time,text,lines=srcContent.split("\n"),line="";for(var i=0;i<lines.length;i++){line=_V_.trim(lines[i]);if(line){cue={id:line,index:this.cues.length};line=_V_.trim(lines[++i]);time=line.split(" --> ");cue.startTime=this.parseCueTime(time[0]);cue.endTime=this.parseCueTime(time[1]);text=[];for(var j=i;j<lines.length;j++){line=_V_.trim(lines[++i]);if(!line){break}text.push(line)}cue.text=text.join("<br/>");this.cues.push(cue)}}},parseCueTime:function(timeText){var parts=timeText.split(":"),time=0;time+=parseFloat(parts[0])*60*60;time+=parseFloat(parts[1])*60;var seconds=parts[2].split(/\.|,/);time+=parseFloat(seconds[0]);ms=parseFloat(seconds[1]);if(ms){time+=ms/1000}return time},update:function(){if(this.cues&&this.cues.length>0){var time=this.player.currentTime();if(!this.currentCue||this.currentCue.startTime>=time||this.currentCue.endTime<time){var newSubIndex=false,reverse=(this.cues[this.lastCueIndex].startTime>time),i=this.lastCueIndex-(reverse?1:0);while(true){if(reverse){if(i<0||this.cues[i].endTime<time){break}if(this.cues[i].startTime<time){newSubIndex=i;break}i--}else{if(i>=this.cues.length||this.cues[i].startTime>time){break}if(this.cues[i].endTime>time){newSubIndex=i;break}i++}}if(newSubIndex!==false){this.currentCue=this.cues[newSubIndex];this.lastCueIndex=newSubIndex;this.updatePlayer(this.currentCue.text)}else{if(this.currentCue){this.currentCue=false;this.updatePlayer("")}}}}},updatePlayer:function(text){this.player.textTrackValue(this.kind,text)}};_V_.addEvent(window,"load",function(){_V_.windowLoaded=true});_V_.autoSetup();window.VideoJS=window._V_=VideoJS})(window);
+(function(window,undefined){var document=window.document;document.createElement("video");document.createElement("audio");var VideoJS=function(id,addOptions,ready){var tag;if(typeof id=="string"){if(id.indexOf("#")===0){id=id.slice(1)}if(_V_.players[id]){return _V_.players[id]}else{tag=_V_.el(id)}}else{tag=id}if(!tag||!tag.nodeName){throw new TypeError("The element or ID supplied is not valid. (VideoJS)")}return tag.player||new _V_.Player(tag,addOptions,ready)},_V_=VideoJS,CDN_VERSION="GENERATED_CDN_VSN";VideoJS.players={};VideoJS.options={techOrder:["html5","flash"],html5:{},flash:{swf:"http://vjs.zencdn.net/c/video-js.swf"},width:300,height:150,defaultVolume:0,components:{posterImage:{},textTrackDisplay:{},loadingSpinner:{},bigPlayButton:{},controlBar:{}}};if(CDN_VERSION!="GENERATED_CDN_VSN"){_V_.options.flash.swf="http://vjs.zencdn.net/"+CDN_VERSION+"/video-js.swf"}_V_.merge=function(obj1,obj2,safe){if(!obj2){obj2={}}for(var attrname in obj2){if(obj2.hasOwnProperty(attrname)&&(!safe||!obj1.hasOwnProperty(attrname))){obj1[attrname]=obj2[attrname]}}return obj1};_V_.extend=function(obj){this.merge(this,obj,true)};_V_.extend({tech:{},controlSets:{},isIE:function(){return !+"\v1"},isFF:function(){return !!_V_.ua.match("Firefox")},isIPad:function(){return navigator.userAgent.match(/iPad/i)!==null},isIPhone:function(){return navigator.userAgent.match(/iPhone/i)!==null},isIOS:function(){return VideoJS.isIPhone()||VideoJS.isIPad()},iOSVersion:function(){var match=navigator.userAgent.match(/OS (\d+)_/i);if(match&&match[1]){return match[1]}},isAndroid:function(){return navigator.userAgent.match(/Android.*AppleWebKit/i)!==null},androidVersion:function(){var match=navigator.userAgent.match(/Android (\d+)\./i);if(match&&match[1]){return match[1]}},testVid:document.createElement("video"),ua:navigator.userAgent,support:{},each:function(arr,fn){if(!arr||arr.length===0){return}for(var i=0,j=arr.length;i<j;i++){fn.call(this,arr[i],i)}},eachProp:function(obj,fn){if(!obj){return}for(var name in obj){if(obj.hasOwnProperty(name)){fn.call(this,name,obj[name])}}},el:function(id){return document.getElementById(id)},createElement:function(tagName,attributes){var el=document.createElement(tagName),attrname;for(attrname in attributes){if(attributes.hasOwnProperty(attrname)){if(attrname.indexOf("-")!==-1){el.setAttribute(attrname,attributes[attrname])}else{el[attrname]=attributes[attrname]}}}return el},insertFirst:function(node,parent){if(parent.firstChild){parent.insertBefore(node,parent.firstChild)}else{parent.appendChild(node)}},addClass:function(element,classToAdd){if((" "+element.className+" ").indexOf(" "+classToAdd+" ")==-1){element.className=element.className===""?classToAdd:element.className+" "+classToAdd}},removeClass:function(element,classToRemove){if(element.className.indexOf(classToRemove)==-1){return}var classNames=element.className.split(" ");classNames.splice(classNames.indexOf(classToRemove),1);element.className=classNames.join(" ")},remove:function(item,array){if(!array){return}var i=array.indexOf(item);if(i!=-1){return array.splice(i,1)}},blockTextSelection:function(){document.body.focus();document.onselectstart=function(){return false}},unblockTextSelection:function(){document.onselectstart=function(){return true}},formatTime:function(seconds,guide){guide=guide||seconds;var s=Math.floor(seconds%60),m=Math.floor(seconds/60%60),h=Math.floor(seconds/3600),gm=Math.floor(guide/60%60),gh=Math.floor(guide/3600);h=(h>0||gh>0)?h+":":"";m=(((h||gm>=10)&&m<10)?"0"+m:m)+":";s=(s<10)?"0"+s:s;return h+m+s},uc:function(string){return string.charAt(0).toUpperCase()+string.slice(1)},getRelativePosition:function(x,relativeElement){return Math.max(0,Math.min(1,(x-_V_.findPosX(relativeElement))/relativeElement.offsetWidth))},getComputedStyleValue:function(element,style){return window.getComputedStyle(element,null).getPropertyValue(style)},trim:function(string){return string.toString().replace(/^\s+/,"").replace(/\s+$/,"")},round:function(num,dec){if(!dec){dec=0}return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},isEmpty:function(object){for(var prop in object){return false}return true},createTimeRange:function(start,end){return{length:1,start:function(){return start},end:function(){return end}}},cache:{},guid:1,expando:"vdata"+(new Date).getTime(),getData:function(elem){var id=elem[_V_.expando];if(!id){id=elem[_V_.expando]=_V_.guid++;_V_.cache[id]={}}return _V_.cache[id]},removeData:function(elem){var id=elem[_V_.expando];if(!id){return}delete _V_.cache[id];try{delete elem[_V_.expando]}catch(e){if(elem.removeAttribute){elem.removeAttribute(_V_.expando)}else{elem[_V_.expando]=null}}},proxy:function(context,fn,uid){if(!fn.guid){fn.guid=_V_.guid++}var ret=function(){return fn.apply(context,arguments)};ret.guid=(uid)?uid+"_"+fn.guid:fn.guid;return ret},get:function(url,onSuccess,onError){var local=(url.indexOf("file:")==0||(window.location.href.indexOf("file:")==0&&url.indexOf("http:")==-1));if(typeof XMLHttpRequest=="undefined"){XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(g){}throw new Error("This browser does not support XMLHttpRequest.")}}var request=new XMLHttpRequest();try{request.open("GET",url)}catch(e){_V_.log("VideoJS XMLHttpRequest (open)",e);return false}request.onreadystatechange=_V_.proxy(this,function(){if(request.readyState==4){if(request.status==200||local&&request.status==0){onSuccess(request.responseText)}else{if(onError){onError()}}}});try{request.send()}catch(e){_V_.log("VideoJS XMLHttpRequest (send)",e);if(onError){onError(e)}}},setLocalStorage:function(key,value){var localStorage=window.localStorage||false;if(!localStorage){return}try{localStorage[key]=value}catch(e){if(e.code==22||e.code==1014){_V_.log("LocalStorage Full (VideoJS)",e)}else{_V_.log("LocalStorage Error (VideoJS)",e)}}},getAbsoluteURL:function(url){if(!url.match(/^https?:\/\//)){url=_V_.createElement("div",{innerHTML:'<a href="'+url+'">x</a>'}).firstChild.href}return url}});_V_.log=function(){_V_.log.history=_V_.log.history||[];_V_.log.history.push(arguments);if(window.console){arguments.callee=arguments.callee.caller;var newarr=[].slice.call(arguments);(typeof console.log==="object"?_V_.log.apply.call(console.log,console,newarr):console.log.apply(console,newarr))}};(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try{console.log();return window.console}catch(err){return window.console={}}})());if("getBoundingClientRect" in document.documentElement){_V_.findPosX=function(el){var box;try{box=el.getBoundingClientRect()}catch(e){}if(!box){return 0}var docEl=document.documentElement,body=document.body,clientLeft=docEl.clientLeft||body.clientLeft||0,scrollLeft=window.pageXOffset||body.scrollLeft,left=box.left+scrollLeft-clientLeft;return left}}else{_V_.findPosX=function(el){var curleft=el.offsetLeft;while(el=obj.offsetParent){if(el.className.indexOf("video-js")==-1){}else{}curleft+=el.offsetLeft}return curleft}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement){if(this===void 0||this===null){throw new TypeError()}var t=Object(this);var len=t.length>>>0;if(len===0){return -1}var n=0;if(arguments.length>0){n=Number(arguments[1]);if(n!==n){n=0}else{if(n!==0&&n!==(1/0)&&n!==-(1/0)){n=(n>0||-1)*Math.floor(Math.abs(n))}}}if(n>=len){return -1}var k=n>=0?n:Math.max(len-Math.abs(n),0);for(;k<len;k++){if(k in t&&t[k]===searchElement){return k}}return -1}}var JSON;if(!JSON){JSON={}}(function(){var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());_V_.extend({addEvent:function(elem,type,fn){var data=_V_.getData(elem),handlers;if(data&&!data.handler){data.handler=function(event){event=_V_.fixEvent(event);var handlers=_V_.getData(elem).events[event.type];if(handlers){var handlersCopy=[];_V_.each(handlers,function(handler,i){handlersCopy[i]=handler});for(var i=0,l=handlersCopy.length;i<l;i++){handlersCopy[i].call(elem,event)}}}}if(!data.events){data.events={}}handlers=data.events[type];if(!handlers){handlers=data.events[type]=[];if(document.addEventListener){elem.addEventListener(type,data.handler,false)}else{if(document.attachEvent){elem.attachEvent("on"+type,data.handler)}}}if(!fn.guid){fn.guid=_V_.guid++}handlers.push(fn)},removeEvent:function(elem,type,fn){var data=_V_.getData(elem),handlers;if(!data.events){return}if(!type){for(type in data.events){_V_.cleanUpEvents(elem,type)}return}handlers=data.events[type];if(!handlers){return}if(fn&&fn.guid){for(var i=0;i<handlers.length;i++){if(handlers[i].guid===fn.guid){handlers.splice(i--,1)}}}_V_.cleanUpEvents(elem,type)},cleanUpEvents:function(elem,type){var data=_V_.getData(elem);if(data.events[type].length===0){delete data.events[type];if(document.removeEventListener){elem.removeEventListener(type,data.handler,false)}else{if(document.detachEvent){elem.detachEvent("on"+type,data.handler)}}}if(_V_.isEmpty(data.events)){delete data.events;delete data.handler}if(_V_.isEmpty(data)){_V_.removeData(elem)}},fixEvent:function(event){if(event[_V_.expando]){return event}var originalEvent=event;event=new _V_.Event(originalEvent);for(var i=_V_.Event.props.length,prop;i;){prop=_V_.Event.props[--i];event[prop]=originalEvent[prop]}if(!event.target){event.target=event.srcElement||document}if(event.target.nodeType===3){event.target=event.target.parentNode}if(!event.relatedTarget&&event.fromElement){event.relatedTarget=event.fromElement===event.target?event.toElement:event.fromElement}if(event.pageX==null&&event.clientX!=null){var eventDocument=event.target.ownerDocument||document,doc=eventDocument.documentElement,body=eventDocument.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc&&doc.clientLeft||body&&body.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc&&doc.clientTop||body&&body.clientTop||0)}if(event.which==null&&(event.charCode!=null||event.keyCode!=null)){event.which=event.charCode!=null?event.charCode:event.keyCode}if(!event.metaKey&&event.ctrlKey){event.metaKey=event.ctrlKey}if(!event.which&&event.button!==undefined){event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)))}return event},triggerEvent:function(elem,event){var data=_V_.getData(elem),parent=elem.parentNode||elem.ownerDocument,type=event.type||event,handler;if(data){handler=data.handler}event=typeof event==="object"?event[_V_.expando]?event:new _V_.Event(type,event):new _V_.Event(type);event.type=type;if(handler){handler.call(elem,event)}event.result=undefined;event.target=elem},one:function(elem,type,fn){_V_.addEvent(elem,type,function(){_V_.removeEvent(elem,type,arguments.callee);fn.apply(this,arguments)})}});_V_.Event=function(src,props){if(src&&src.type){this.originalEvent=src;this.type=src.type;this.isDefaultPrevented=(src.defaultPrevented||src.returnValue===false||src.getPreventDefault&&src.getPreventDefault())?returnTrue:returnFalse}else{this.type=src}if(props){_V_.merge(this,props)}this.timeStamp=(new Date).getTime();this[_V_.expando]=true};_V_.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e){return}if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e){return}if(e.stopPropagation){e.stopPropagation()}e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};_V_.Event.props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" ");function returnTrue(){return true}function returnFalse(){return false}(function(){var initializing=false,fnTest=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;_V_.Class=function(){};_V_.Class.extend=function(prop){var _super=this.prototype;initializing=true;var prototype=new this();initializing=false;for(var name in prop){prototype[name]=typeof prop[name]=="function"&&typeof _super[name]=="function"&&fnTest.test(prop[name])?(function(name,fn){return function(){var tmp=this._super;this._super=_super[name];var ret=fn.apply(this,arguments);this._super=tmp;return ret}})(name,prop[name]):prop[name]}function Class(){if(!initializing&&this.init){return this.init.apply(this,arguments)}else{if(!initializing){return arguments.callee.prototype.init()}}}Class.prototype=prototype;Class.constructor=Class;Class.extend=arguments.callee;return Class}})();_V_.Component=_V_.Class.extend({init:function(player,options){this.player=player;options=this.options=_V_.merge(this.options||{},options);if(options.el){this.el=options.el}else{this.el=this.createElement()}this.initComponents()},destroy:function(){},createElement:function(type,attrs){return _V_.createElement(type||"div",attrs)},buildCSSClass:function(){return""},initComponents:function(){var options=this.options;if(options&&options.components){this.eachProp(options.components,function(name,opts){var tempAdd=this.proxy(function(){this[name]=this.addComponent(name,opts)});if(opts.loadEvent){this.one(opts.loadEvent,tempAdd)}else{tempAdd()}})}},addComponent:function(name,options){var component,componentClass;if(typeof name=="string"){options=options||{};componentClass=options.componentClass||_V_.uc(name);component=new _V_[componentClass](this.player||this,options)}else{component=name}this.el.appendChild(component.el);return component},removeComponent:function(component){this.el.removeChild(component.el)},show:function(){this.el.style.display="block"},hide:function(){this.el.style.display="none"},fadeIn:function(){this.removeClass("vjs-fade-out");this.addClass("vjs-fade-in")},fadeOut:function(){this.removeClass("vjs-fade-in");this.addClass("vjs-fade-out")},lockShowing:function(){var style=this.el.style;style.display="block";style.opacity=1;style.visiblity="visible"},unlockShowing:function(){var style=this.el.style;style.display="";style.opacity="";style.visiblity=""},addClass:function(classToAdd){_V_.addClass(this.el,classToAdd)},removeClass:function(classToRemove){_V_.removeClass(this.el,classToRemove)},addEvent:function(type,fn,uid){return _V_.addEvent(this.el,type,_V_.proxy(this,fn))},removeEvent:function(type,fn){return _V_.removeEvent(this.el,type,fn)},triggerEvent:function(type,e){return _V_.triggerEvent(this.el,type,e)},one:function(type,fn){_V_.one(this.el,type,_V_.proxy(this,fn))},ready:function(fn){if(!fn){return this}if(this.isReady){fn.call(this)}else{if(this.readyQueue===undefined){this.readyQueue=[]}this.readyQueue.push(fn)}return this},triggerReady:function(){this.isReady=true;if(this.readyQueue&&this.readyQueue.length>0){this.each(this.readyQueue,function(fn){fn.call(this)});this.readyQueue=[];this.triggerEvent("ready")}},each:function(arr,fn){_V_.each.call(this,arr,fn)},eachProp:function(obj,fn){_V_.eachProp.call(this,obj,fn)},extend:function(obj){_V_.merge(this,obj)},proxy:function(fn,uid){return _V_.proxy(this,fn,uid)}});_V_.Player=_V_.Component.extend({init:function(tag,addOptions,ready){this.tag=tag;var el=this.el=_V_.createElement("div"),options=this.options={};_V_.merge(options,_V_.options);_V_.merge(options,this.getVideoTagSettings());_V_.merge(options,addOptions);this.ready(ready);tag.removeAttribute("controls");tag.removeAttribute("poster");tag.player=el.player=this;tag.parentNode.insertBefore(el,tag);el.appendChild(tag);this.id=el.id=tag.id;el.className=tag.className;tag.id+="_html5_api";tag.className="vjs-tech";_V_.players[el.id]=this;el.setAttribute("width",options.width);el.setAttribute("height",options.height);el.style.width=options.width+"px";el.style.height=options.height+"px";tag.removeAttribute("width");tag.removeAttribute("height");if(tag.hasChildNodes()){for(var i=0,j=tag.childNodes;i<j.length;i++){if(j[i].nodeName=="SOURCE"||j[i].nodeName=="TRACK"){tag.removeChild(j[i])}}}this.values={};this.addClass("vjs-paused");this.addEvent("ended",this.onEnded);this.addEvent("play",this.onPlay);this.addEvent("pause",this.onPause);this.addEvent("progress",this.onProgress);this.addEvent("error",this.onError);if(options.controls){this.ready(function(){this.initComponents()})}this.textTracks=[];if(options.tracks&&options.tracks.length>0){this.addTextTracks(options.tracks)}if(!options.sources||options.sources.length==0){for(var i=0,j=options.techOrder;i<j.length;i++){var techName=j[i],tech=_V_[techName];if(tech.isSupported()){this.loadTech(techName);break}}}else{this.src(options.sources)}},values:{},destroy:function(){this.stopTrackingProgress();this.stopTrackingCurrentTime();_V_.players[this.id]=null;delete _V_.players[this.id];this.tech.destroy();this.el.parentNode.removeChild(this.el)},createElement:function(type,options){},getVideoTagSettings:function(){var options={sources:[],tracks:[]},tag=this.tag,getAttribute="getAttribute";options.src=tag[getAttribute]("src");options.controls=tag[getAttribute]("controls")!==null;options.poster=tag[getAttribute]("poster");options.preload=tag[getAttribute]("preload");options.autoplay=tag[getAttribute]("autoplay")!==null;options.loop=tag[getAttribute]("loop")!==null;options.muted=tag[getAttribute]("muted")!==null;if(this.tag.hasChildNodes()){for(var c,i=0,j=this.tag.childNodes;i<j.length;i++){c=j[i];if(c.nodeName=="SOURCE"){options.sources.push({src:c[getAttribute]("src"),type:c[getAttribute]("type"),media:c[getAttribute]("media"),title:c[getAttribute]("title")})}if(c.nodeName=="TRACK"){options.tracks.push({src:c[getAttribute]("src"),kind:c[getAttribute]("kind"),srclang:c[getAttribute]("srclang"),label:c[getAttribute]("label"),"default":c[getAttribute]("default")!==null,title:c[getAttribute]("title")})}}}return options},loadTech:function(techName,source){if(this.tech){this.unloadTech()}else{if(techName!="html5"&&this.tag){this.el.removeChild(this.tag);this.tag=false}}this.techName=techName;this.isReady=false;var techReady=function(){this.player.triggerReady();if(!this.support.progressEvent){this.player.manualProgressOn()}if(!this.support.timeupdateEvent){this.player.manualTimeUpdatesOn()}};var techOptions=_V_.merge({source:source,parentEl:this.el},this.options[techName]);if(source){if(source.src==this.values.src&&this.values.currentTime>0){techOptions.startTime=this.values.currentTime}this.values.src=source.src}this.tech=new _V_[techName](this,techOptions);this.tech.ready(techReady)},unloadTech:function(){this.tech.destroy();if(this.manualProgress){this.manualProgressOff()}if(this.manualTimeUpdates){this.manualTimeUpdatesOff()}this.tech=false},manualProgressOn:function(){this.manualProgress=true;this.trackProgress();this.tech.addEvent("progress",function(){this.removeEvent("progress",arguments.callee);this.support.progressEvent=true;this.player.manualProgressOff()})},manualProgressOff:function(){this.manualProgress=false;this.stopTrackingProgress()},trackProgress:function(){this.progressInterval=setInterval(_V_.proxy(this,function(){if(this.values.bufferEnd<this.buffered().end(0)){this.triggerEvent("progress")}else{if(this.bufferedPercent()==1){this.stopTrackingProgress();this.triggerEvent("progress")}}}),500)},stopTrackingProgress:function(){clearInterval(this.progressInterval)},manualTimeUpdatesOn:function(){this.manualTimeUpdates=true;this.addEvent("play",this.trackCurrentTime);this.addEvent("pause",this.stopTrackingCurrentTime);this.tech.addEvent("timeupdate",function(){this.removeEvent("timeupdate",arguments.callee);this.support.timeupdateEvent=true;this.player.manualTimeUpdatesOff()})},manualTimeUpdatesOff:function(){this.manualTimeUpdates=false;this.stopTrackingCurrentTime();this.removeEvent("play",this.trackCurrentTime);this.removeEvent("pause",this.stopTrackingCurrentTime)},trackCurrentTime:function(){if(this.currentTimeInterval){this.stopTrackingCurrentTime()}this.currentTimeInterval=setInterval(_V_.proxy(this,function(){this.triggerEvent("timeupdate")}),250)},stopTrackingCurrentTime:function(){clearInterval(this.currentTimeInterval)},onEnded:function(){if(this.options.loop){this.currentTime(0);this.play()}else{this.pause();this.currentTime(0);this.pause()}},onPlay:function(){_V_.removeClass(this.el,"vjs-paused");_V_.addClass(this.el,"vjs-playing")},onPause:function(){_V_.removeClass(this.el,"vjs-playing");_V_.addClass(this.el,"vjs-paused")},onProgress:function(){if(this.bufferedPercent()==1){this.triggerEvent("loadedalldata")}},onError:function(e){_V_.log("Video Error",e)},techCall:function(method,arg){if(!this.tech.isReady){this.tech.ready(function(){this[method](arg)})}else{try{this.tech[method](arg)}catch(e){_V_.log(e)}}},techGet:function(method){if(this.tech.isReady){try{return this.tech[method]()}catch(e){if(this.tech[method]===undefined){_V_.log("Video.js: "+method+" method not defined for "+this.techName+" playback technology.",e)}else{if(e.name=="TypeError"){_V_.log("Video.js: "+method+" unavailable on "+this.techName+" playback technology element.",e);this.tech.isReady=false}else{_V_.log(e)}}}}return},play:function(){this.techCall("play");return this},pause:function(){this.techCall("pause");return this},paused:function(){return(this.techGet("paused")===false)?false:true},currentTime:function(seconds){if(seconds!==undefined){this.values.lastSetCurrentTime=seconds;this.techCall("setCurrentTime",seconds);if(this.manualTimeUpdates){this.triggerEvent("timeupdate")}return this}return this.values.currentTime=(this.techGet("currentTime")||0)},duration:function(){return parseFloat(this.techGet("duration"))},remainingTime:function(){return this.duration()-this.currentTime()},buffered:function(){var buffered=this.techGet("buffered"),start=0,end=this.values.bufferEnd=this.values.bufferEnd||0,timeRange;if(buffered&&buffered.length>0&&buffered.end(0)!==end){end=buffered.end(0);this.values.bufferEnd=end}return _V_.createTimeRange(start,end)},bufferedPercent:function(){return(this.duration())?this.buffered().end(0)/this.duration():0},volume:function(percentAsDecimal){var vol;if(percentAsDecimal!==undefined){vol=Math.max(0,Math.min(1,parseFloat(percentAsDecimal)));this.values.volume=vol;this.techCall("setVolume",vol);_V_.setLocalStorage("volume",vol);return this}vol=parseFloat(this.techGet("volume"));return(isNaN(vol))?1:vol},muted:function(muted){if(muted!==undefined){this.techCall("setMuted",muted);return this}return this.techGet("muted")||false},width:function(width,skipListeners){if(width!==undefined){this.el.width=width;this.el.style.width=width+"px";if(!skipListeners){this.triggerEvent("resize")}return this}return parseInt(this.el.getAttribute("width"))},height:function(height){if(height!==undefined){this.el.height=height;this.el.style.height=height+"px";this.triggerEvent("resize");return this}return parseInt(this.el.getAttribute("height"))},size:function(width,height){return this.width(width,true).height(height)},supportsFullScreen:function(){return this.techGet("supportsFullScreen")||false},requestFullScreen:function(){var requestFullScreen=_V_.support.requestFullScreen;this.isFullScreen=true;if(requestFullScreen){_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){this.isFullScreen=document[requestFullScreen.isFullScreen];if(this.isFullScreen==false){_V_.removeEvent(document,requestFullScreen.eventName,arguments.callee)}this.triggerEvent("fullscreenchange")}));if(this.tech.support.fullscreenResize===false&&this.options.flash.iFrameMode!=true){this.pause();this.unloadTech();_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){_V_.removeEvent(document,requestFullScreen.eventName,arguments.callee);this.loadTech(this.techName,{src:this.values.src})}));this.el[requestFullScreen.requestFn]()}else{this.el[requestFullScreen.requestFn]()}}else{if(this.tech.supportsFullScreen()){this.triggerEvent("fullscreenchange");this.techCall("enterFullScreen")}else{this.triggerEvent("fullscreenchange");this.enterFullWindow()}}return this},cancelFullScreen:function(){var requestFullScreen=_V_.support.requestFullScreen;this.isFullScreen=false;if(requestFullScreen){if(this.tech.support.fullscreenResize===false&&this.options.flash.iFrameMode!=true){this.pause();this.unloadTech();_V_.addEvent(document,requestFullScreen.eventName,this.proxy(function(){_V_.removeEvent(document,requestFullScreen.eventName,arguments.callee);this.loadTech(this.techName,{src:this.values.src})}));document[requestFullScreen.cancelFn]()}else{document[requestFullScreen.cancelFn]()}}else{if(this.tech.supportsFullScreen()){this.techCall("exitFullScreen");this.triggerEvent("fullscreenchange")}else{this.exitFullWindow();this.triggerEvent("fullscreenchange")}}return this},enterFullWindow:function(){this.isFullWindow=true;this.docOrigOverflow=document.documentElement.style.overflow;_V_.addEvent(document,"keydown",_V_.proxy(this,this.fullWindowOnEscKey));document.documentElement.style.overflow="hidden";_V_.addClass(document.body,"vjs-full-window");_V_.addClass(this.el,"vjs-fullscreen");this.triggerEvent("enterFullWindow")},fullWindowOnEscKey:function(event){if(event.keyCode==27){if(this.isFullScreen==true){this.cancelFullScreen()}else{this.exitFullWindow()}}},exitFullWindow:function(){this.isFullWindow=false;_V_.removeEvent(document,"keydown",this.fullWindowOnEscKey);document.documentElement.style.overflow=this.docOrigOverflow;_V_.removeClass(document.body,"vjs-full-window");_V_.removeClass(this.el,"vjs-fullscreen");this.triggerEvent("exitFullWindow")},selectSource:function(sources){for(var i=0,j=this.options.techOrder;i<j.length;i++){var techName=j[i],tech=_V_[techName];if(tech.isSupported()){for(var a=0,b=sources;a<b.length;a++){var source=b[a];if(tech.canPlaySource.call(this,source)){return{source:source,tech:techName}}}}}return false},src:function(source){if(source instanceof Array){var sourceTech=this.selectSource(source),source,techName;if(sourceTech){source=sourceTech.source;techName=sourceTech.tech;if(techName==this.techName){this.src(source)}else{this.loadTech(techName,source)}}else{_V_.log("No compatible source and playback technology were found.")}}else{if(source instanceof Object){if(_V_[this.techName].canPlaySource(source)){this.src(source.src)}else{this.src([source])}}else{this.values.src=source;if(!this.isReady){this.ready(function(){this.src(source)})}else{this.techCall("src",source);if(this.options.preload=="auto"){this.load()}if(this.options.autoplay){this.play()}}}}return this},load:function(){this.techCall("load");return this},currentSrc:function(){return this.techGet("currentSrc")||this.values.src||""},preload:function(value){if(value!==undefined){this.techCall("setPreload",value);this.options.preload=value;return this}return this.techGet("preload")},autoplay:function(value){if(value!==undefined){this.techCall("setAutoplay",value);this.options.autoplay=value;return this}return this.techGet("autoplay",value)},loop:function(value){if(value!==undefined){this.techCall("setLoop",value);this.options.loop=value;return this}return this.techGet("loop")},controls:function(){return this.options.controls},poster:function(){return this.techGet("poster")},error:function(){return this.techGet("error")},ended:function(){return this.techGet("ended")}});(function(){var requestFn,cancelFn,eventName,isFullScreen,playerProto=_V_.Player.prototype;if(document.cancelFullscreen!==undefined){requestFn="requestFullscreen";cancelFn="exitFullscreen";eventName="fullscreenchange";isFullScreen="fullScreen"}else{_V_.each(["moz","webkit"],function(prefix){if((prefix!="moz"||document.mozFullScreenEnabled)&&document[prefix+"CancelFullScreen"]!==undefined){requestFn=prefix+"RequestFullScreen";cancelFn=prefix+"CancelFullScreen";eventName=prefix+"fullscreenchange";if(prefix=="webkit"){isFullScreen=prefix+"IsFullScreen"}else{isFullScreen=prefix+"FullScreen"}}})}if(requestFn){_V_.support.requestFullScreen={requestFn:requestFn,cancelFn:cancelFn,eventName:eventName,isFullScreen:isFullScreen}}})();_V_.PlaybackTech=_V_.Component.extend({init:function(player,options){},onClick:function(){if(this.player.options.controls){_V_.PlayToggle.prototype.onClick.call(this)}}});_V_.apiMethods="play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted".split(",");_V_.each(_V_.apiMethods,function(methodName){_V_.PlaybackTech.prototype[methodName]=function(){throw new Error("The '"+methodName+"' method is not available on the playback technology's API")}});_V_.html5=_V_.PlaybackTech.extend({init:function(player,options,ready){this.player=player;this.el=this.createElement();this.ready(ready);this.addEvent("click",this.proxy(this.onClick));var source=options.source;if(source&&this.el.currentSrc==source.src){player.triggerEvent("loadstart")}else{if(source){this.el.src=source.src}}player.ready(function(){if(this.options.autoplay&&this.paused()){this.tag.poster=null;this.play()}});this.setupTriggers();this.triggerReady()},destroy:function(){this.player.tag=false;this.removeTriggers();this.el.parentNode.removeChild(this.el)},createElement:function(){var html5=_V_.html5,player=this.player,el=player.tag,newEl;if(!el||this.support.movingElementInDOM===false){if(el){player.el.removeChild(el)}newEl=_V_.createElement("video",{id:el.id||player.el.id+"_html5_api",className:el.className||"vjs-tech"});el=newEl;_V_.insertFirst(el,player.el)}_V_.each(["autoplay","preload","loop","muted"],function(attr){if(player.options[attr]!==null){el[attr]=player.options[attr]}},this);return el},setupTriggers:function(){_V_.each.call(this,_V_.html5.events,function(type){_V_.addEvent(this.el,type,_V_.proxy(this.player,this.eventHandler))})},removeTriggers:function(){_V_.each.call(this,_V_.html5.events,function(type){_V_.removeEvent(this.el,type,_V_.proxy(this.player,this.eventHandler))})},eventHandler:function(e){e.stopPropagation();this.triggerEvent(e)},play:function(){this.el.play()},pause:function(){this.el.pause()},paused:function(){return this.el.paused},currentTime:function(){return this.el.currentTime},setCurrentTime:function(seconds){try{this.el.currentTime=seconds}catch(e){_V_.log(e,"Video isn't ready. (VideoJS)")}},duration:function(){return this.el.duration||0},buffered:function(){return this.el.buffered},volume:function(){return this.el.volume},setVolume:function(percentAsDecimal){this.el.volume=percentAsDecimal},muted:function(){return this.el.muted},setMuted:function(muted){this.el.muted=muted},width:function(){return this.el.offsetWidth},height:function(){return this.el.offsetHeight},supportsFullScreen:function(){if(typeof this.el.webkitEnterFullScreen=="function"){if(!navigator.userAgent.match("Chrome")&&!navigator.userAgent.match("Mac OS X 10.5")){return true}}return false},enterFullScreen:function(){try{this.el.webkitEnterFullScreen()}catch(e){if(e.code==11){_V_.log("VideoJS: Video not ready.")}}},src:function(src){this.el.src=src},load:function(){this.el.load()},currentSrc:function(){return this.el.currentSrc},preload:function(){return this.el.preload},setPreload:function(val){this.el.preload=val},autoplay:function(){return this.el.autoplay},setAutoplay:function(val){this.el.autoplay=val},loop:function(){return this.el.loop},setLoop:function(val){this.el.loop=val},error:function(){return this.el.error},seeking:function(){return this.el.seeking},ended:function(){return this.el.ended},controls:function(){return this.player.options.controls},defaultMuted:function(){return this.el.defaultMuted}});_V_.html5.isSupported=function(){return !!document.createElement("video").canPlayType};_V_.html5.canPlaySource=function(srcObj){return !!document.createElement("video").canPlayType(srcObj.type)};_V_.html5.events="loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange".split(",");_V_.html5.prototype.support={fullscreen:(typeof _V_.testVid.webkitEnterFullScreen!==undefined)?(!_V_.ua.match("Chrome")&&!_V_.ua.match("Mac OS X 10.5")?true:false):false,movingElementInDOM:!_V_.isIOS()};if(_V_.isAndroid()){if(_V_.androidVersion()<3){document.createElement("video").constructor.prototype.canPlayType=function(type){return(type&&type.toLowerCase().indexOf("video/mp4")!=-1)?"maybe":""}}}_V_.flash=_V_.PlaybackTech.extend({init:function(player,options){this.player=player;var source=options.source,parentEl=options.parentEl,placeHolder=this.el=_V_.createElement("div",{id:parentEl.id+"_temp_flash"}),objId=player.el.id+"_flash_api",playerOptions=player.options,flashVars=_V_.merge({readyFunction:"_V_.flash.onReady",eventProxyFunction:"_V_.flash.onEvent",errorEventProxyFunction:"_V_.flash.onError",autoplay:playerOptions.autoplay,preload:playerOptions.preload,loop:playerOptions.loop,muted:playerOptions.muted},options.flashVars),params=_V_.merge({wmode:"opaque",bgcolor:"#000000"},options.params),attributes=_V_.merge({id:objId,name:objId,"class":"vjs-tech"},options.attributes);if(source){flashVars.src=encodeURIComponent(_V_.getAbsoluteURL(source.src))}_V_.insertFirst(placeHolder,parentEl);if(options.startTime){this.ready(function(){this.load();this.play();this.currentTime(options.startTime)})}if(options.iFrameMode==true&&!_V_.isFF){var iFrm=_V_.createElement("iframe",{id:objId+"_iframe",name:objId+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});flashVars.readyFunction="ready";flashVars.eventProxyFunction="events";flashVars.errorEventProxyFunction="errors";_V_.addEvent(iFrm,"load",_V_.proxy(this,function(){var iDoc,objTag,swfLoc,iWin=iFrm.contentWindow,varString="";iDoc=iFrm.contentDocument?iFrm.contentDocument:iFrm.contentWindow.document;iDoc.write(_V_.flash.getEmbedCode(options.swf,flashVars,params,attributes));iWin.player=this.player;iWin.ready=_V_.proxy(this.player,function(currSwf){var el=iDoc.getElementById(currSwf),player=this,tech=player.tech;tech.el=el;_V_.addEvent(el,"click",tech.proxy(tech.onClick));_V_.flash.checkReady(tech)});iWin.events=_V_.proxy(this.player,function(swfID,eventName,other){var player=this;if(player&&player.techName=="flash"){player.triggerEvent(eventName)}});iWin.errors=_V_.proxy(this.player,function(swfID,eventName){_V_.log("Flash Error",eventName)})}));placeHolder.parentNode.replaceChild(iFrm,placeHolder)}else{_V_.flash.embed(options.swf,placeHolder,flashVars,params,attributes)}},destroy:function(){this.el.parentNode.removeChild(this.el)},play:function(){this.el.vjs_play()},pause:function(){this.el.vjs_pause()},src:function(src){src=_V_.getAbsoluteURL(src);this.el.vjs_src(src);if(this.player.autoplay()){var tech=this;setTimeout(function(){tech.play()},0)}},load:function(){this.el.vjs_load()},poster:function(){this.el.vjs_getProperty("poster")},buffered:function(){return _V_.createTimeRange(0,this.el.vjs_getProperty("buffered"))},supportsFullScreen:function(){return false},enterFullScreen:function(){return false}});(function(){var api=_V_.flash.prototype,readWrite="preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted".split(","),readOnly="error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks".split(","),callOnly="load,play,pause".split(",");createSetter=function(attr){var attrUpper=attr.charAt(0).toUpperCase()+attr.slice(1);api["set"+attrUpper]=function(val){return this.el.vjs_setProperty(attr,val)}},createGetter=function(attr){api[attr]=function(){return this.el.vjs_getProperty(attr)}};_V_.each(readWrite,function(attr){createGetter(attr);createSetter(attr)});_V_.each(readOnly,function(attr){createGetter(attr)})})();_V_.flash.isSupported=function(){return _V_.flash.version()[0]>=10};_V_.flash.canPlaySource=function(srcObj){if(srcObj.type in _V_.flash.prototype.support.formats){return"maybe"}};_V_.flash.prototype.support={formats:{"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},progressEvent:false,timeupdateEvent:false,fullscreenResize:false,parentResize:!(_V_.ua.match("Firefox"))};_V_.flash.onReady=function(currSwf){var el=_V_.el(currSwf);var player=el.player||el.parentNode.player,tech=player.tech;el.player=player;tech.el=el;tech.addEvent("click",tech.onClick);_V_.flash.checkReady(tech)};_V_.flash.checkReady=function(tech){if(tech.el.vjs_getProperty){tech.triggerReady()}else{setTimeout(function(){_V_.flash.checkReady(tech)},50)}};_V_.flash.onEvent=function(swfID,eventName){var player=_V_.el(swfID).player;player.triggerEvent(eventName)};_V_.flash.onError=function(swfID,err){var player=_V_.el(swfID).player;player.triggerEvent("error");_V_.log("Flash Error",err,swfID)};_V_.flash.version=function(){var version="0,0,0";try{version=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){version=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(e){}}return version.split(",")};_V_.flash.embed=function(swf,placeHolder,flashVars,params,attributes){var code=_V_.flash.getEmbedCode(swf,flashVars,params,attributes),obj=_V_.createElement("div",{innerHTML:code}).childNodes[0],par=placeHolder.parentNode;placeHolder.parentNode.replaceChild(obj,placeHolder);if(_V_.isIE()){var newObj=par.childNodes[0];setTimeout(function(){newObj.style.display="block"},1000)}return obj};_V_.flash.getEmbedCode=function(swf,flashVars,params,attributes){var objTag='<object type="application/x-shockwave-flash"',flashVarsString="",paramsString="";attrsString="";if(flashVars){_V_.eachProp(flashVars,function(key,val){flashVarsString+=(key+"="+val+"&amp;")})}params=_V_.merge({movie:swf,flashvars:flashVarsString,allowScriptAccess:"always",allowNetworking:"all"},params);_V_.eachProp(params,function(key,val){paramsString+='<param name="'+key+'" value="'+val+'" />'});attributes=_V_.merge({data:swf,width:"100%",height:"100%"},attributes);_V_.eachProp(attributes,function(key,val){attrsString+=(key+'="'+val+'" ')});return objTag+attrsString+">"+paramsString+"</object>"};_V_.Control=_V_.Component.extend({buildCSSClass:function(){return"vjs-control "+this._super()}});_V_.ControlBar=_V_.Component.extend({options:{loadEvent:"play",components:{playToggle:{},fullscreenToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},volumeControl:{},muteToggle:{}}},init:function(player,options){this._super(player,options);player.one("play",this.proxy(function(){this.fadeIn();this.player.addEvent("mouseover",this.proxy(this.fadeIn));this.player.addEvent("mouseout",this.proxy(this.fadeOut))}))},createElement:function(){return _V_.createElement("div",{className:"vjs-controls"})},fadeIn:function(){this._super();this.player.triggerEvent("controlsvisible")},fadeOut:function(){this._super();this.player.triggerEvent("controlshidden")},lockShowing:function(){this.el.style.opacity="1"}});_V_.Button=_V_.Control.extend({init:function(player,options){this._super(player,options);this.addEvent("click",this.onClick);this.addEvent("focus",this.onFocus);this.addEvent("blur",this.onBlur)},createElement:function(type,attrs){attrs=_V_.merge({className:this.buildCSSClass(),innerHTML:'<div><span class="vjs-control-text">'+(this.buttonText||"Need Text")+"</span></div>",role:"button",tabIndex:0},attrs);return this._super(type,attrs)},onClick:function(){},onFocus:function(){_V_.addEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))},onKeyPress:function(event){if(event.which==32||event.which==13){event.preventDefault();this.onClick()}},onBlur:function(){_V_.removeEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))}});_V_.PlayButton=_V_.Button.extend({buttonText:"Play",buildCSSClass:function(){return"vjs-play-button "+this._super()},onClick:function(){this.player.play()}});_V_.PauseButton=_V_.Button.extend({buttonText:"Pause",buildCSSClass:function(){return"vjs-pause-button "+this._super()},onClick:function(){this.player.pause()}});_V_.PlayToggle=_V_.Button.extend({buttonText:"Play",init:function(player,options){this._super(player,options);player.addEvent("play",_V_.proxy(this,this.onPlay));player.addEvent("pause",_V_.proxy(this,this.onPause))},buildCSSClass:function(){return"vjs-play-control "+this._super()},onClick:function(){if(this.player.paused()){this.player.play()}else{this.player.pause()}},onPlay:function(){_V_.removeClass(this.el,"vjs-paused");_V_.addClass(this.el,"vjs-playing")},onPause:function(){_V_.removeClass(this.el,"vjs-playing");_V_.addClass(this.el,"vjs-paused")}});_V_.FullscreenToggle=_V_.Button.extend({buttonText:"Fullscreen",buildCSSClass:function(){return"vjs-fullscreen-control "+this._super()},onClick:function(){if(!this.player.isFullScreen){this.player.requestFullScreen()}else{this.player.cancelFullScreen()}}});_V_.BigPlayButton=_V_.Button.extend({init:function(player,options){this._super(player,options);player.addEvent("play",_V_.proxy(this,this.hide));player.addEvent("ended",_V_.proxy(this,this.show))},createElement:function(){return this._super("div",{className:"vjs-big-play-button",innerHTML:"<span></span>"})},onClick:function(){if(this.player.currentTime()){this.player.currentTime(0)}this.player.play()}});_V_.LoadingSpinner=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("canplay",_V_.proxy(this,this.hide));player.addEvent("canplaythrough",_V_.proxy(this,this.hide));player.addEvent("playing",_V_.proxy(this,this.hide));player.addEvent("seeking",_V_.proxy(this,this.show));player.addEvent("seeked",_V_.proxy(this,this.hide));player.addEvent("error",_V_.proxy(this,this.show));player.addEvent("waiting",_V_.proxy(this,this.show))},createElement:function(){var classNameSpinner,innerHtmlSpinner;if(typeof this.player.el.style.WebkitBorderRadius=="string"||typeof this.player.el.style.MozBorderRadius=="string"||typeof this.player.el.style.KhtmlBorderRadius=="string"||typeof this.player.el.style.borderRadius=="string"){classNameSpinner="vjs-loading-spinner";innerHtmlSpinner="<div class='ball1'></div><div class='ball2'></div><div class='ball3'></div><div class='ball4'></div><div class='ball5'></div><div class='ball6'></div><div class='ball7'></div><div class='ball8'></div>"}else{classNameSpinner="vjs-loading-spinner-fallback";innerHtmlSpinner=""}return this._super("div",{className:classNameSpinner,innerHTML:innerHtmlSpinner})}});_V_.CurrentTimeDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-current-time-display",innerHTML:"0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){var time=(this.player.scrubbing)?this.player.values.currentTime:this.player.currentTime();this.content.innerHTML=_V_.formatTime(time,this.player.duration())}});_V_.DurationDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-duration-display",innerHTML:"0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){if(this.player.duration()){this.content.innerHTML=_V_.formatTime(this.player.duration())}}});_V_.TimeDivider=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})}});_V_.RemainingTimeDisplay=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("timeupdate",_V_.proxy(this,this.updateContent))},createElement:function(){var el=this._super("div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=_V_.createElement("div",{className:"vjs-remaining-time-display",innerHTML:"-0:00"});el.appendChild(_V_.createElement("div").appendChild(this.content));return el},updateContent:function(){if(this.player.duration()){this.content.innerHTML="-"+_V_.formatTime(this.player.remainingTime())}}});_V_.Slider=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent(this.playerEvent,_V_.proxy(this,this.update));this.addEvent("mousedown",this.onMouseDown);this.addEvent("focus",this.onFocus);this.addEvent("blur",this.onBlur);this.player.addEvent("controlsvisible",this.proxy(this.update));this.update()},createElement:function(type,attrs){attrs=_V_.merge({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},attrs);return this._super(type,attrs)},onMouseDown:function(event){event.preventDefault();_V_.blockTextSelection();_V_.addEvent(document,"mousemove",_V_.proxy(this,this.onMouseMove));_V_.addEvent(document,"mouseup",_V_.proxy(this,this.onMouseUp));this.onMouseMove(event)},onMouseUp:function(event){_V_.unblockTextSelection();_V_.removeEvent(document,"mousemove",this.onMouseMove,false);_V_.removeEvent(document,"mouseup",this.onMouseUp,false);this.update()},update:function(){var barProgress,progress=this.getPercent();handle=this.handle,bar=this.bar;if(isNaN(progress)){progress=0}barProgress=progress;if(handle){var box=this.el,boxWidth=box.offsetWidth,handleWidth=handle.el.offsetWidth,handlePercent=(handleWidth)?handleWidth/boxWidth:0,boxAdjustedPercent=1-handlePercent;adjustedProgress=progress*boxAdjustedPercent,barProgress=adjustedProgress+(handlePercent/2);handle.el.style.left=_V_.round(adjustedProgress*100,2)+"%"}bar.el.style.width=_V_.round(barProgress*100,2)+"%"},calculateDistance:function(event){var box=this.el,boxX=_V_.findPosX(box),boxW=box.offsetWidth,handle=this.handle;if(handle){var handleW=handle.el.offsetWidth;boxX=boxX+(handleW/2);boxW=boxW-handleW}return Math.max(0,Math.min(1,(event.pageX-boxX)/boxW))},onFocus:function(event){_V_.addEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))},onKeyPress:function(event){if(event.which==37){event.preventDefault();this.stepBack()}else{if(event.which==39){event.preventDefault();this.stepForward()}}},onBlur:function(event){_V_.removeEvent(document,"keyup",_V_.proxy(this,this.onKeyPress))}});_V_.ProgressControl=_V_.Component.extend({options:{components:{seekBar:{}}},createElement:function(){return this._super("div",{className:"vjs-progress-control vjs-control"})}});_V_.SeekBar=_V_.Slider.extend({options:{components:{loadProgressBar:{},bar:{componentClass:"PlayProgressBar"},handle:{componentClass:"SeekHandle"}}},playerEvent:"timeupdate",init:function(player,options){this._super(player,options)},createElement:function(){return this._super("div",{className:"vjs-progress-holder"})},getPercent:function(){return this.player.currentTime()/this.player.duration()},onMouseDown:function(event){this._super(event);this.player.scrubbing=true;this.videoWasPlaying=!this.player.paused();this.player.pause()},onMouseMove:function(event){var newTime=this.calculateDistance(event)*this.player.duration();if(newTime==this.player.duration()){newTime=newTime-0.1}this.player.currentTime(newTime)},onMouseUp:function(event){this._super(event);this.player.scrubbing=false;if(this.videoWasPlaying){this.player.play()}},stepForward:function(){this.player.currentTime(this.player.currentTime()+1)},stepBack:function(){this.player.currentTime(this.player.currentTime()-1)}});_V_.LoadProgressBar=_V_.Component.extend({init:function(player,options){this._super(player,options);player.addEvent("progress",_V_.proxy(this,this.update))},createElement:function(){return this._super("div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})},update:function(){if(this.el.style){this.el.style.width=_V_.round(this.player.bufferedPercent()*100,2)+"%"}}});_V_.PlayProgressBar=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})}});_V_.SeekHandle=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-seek-handle",innerHTML:'<span class="vjs-control-text">00:00</span>'})}});_V_.VolumeControl=_V_.Component.extend({options:{components:{volumeBar:{}}},createElement:function(){return this._super("div",{className:"vjs-volume-control vjs-control"})}});_V_.VolumeBar=_V_.Slider.extend({options:{components:{bar:{componentClass:"VolumeLevel"},handle:{componentClass:"VolumeHandle"}}},playerEvent:"volumechange",createElement:function(){return this._super("div",{className:"vjs-volume-bar"})},onMouseMove:function(event){this.player.volume(this.calculateDistance(event))},getPercent:function(){return this.player.volume()},stepForward:function(){this.player.volume(this.player.volume()+0.1)},stepBack:function(){this.player.volume(this.player.volume()-0.1)}});_V_.VolumeLevel=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})}});_V_.VolumeHandle=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-volume-handle",innerHTML:'<span class="vjs-control-text"></span>'})}});_V_.MuteToggle=_V_.Button.extend({init:function(player,options){this._super(player,options);player.addEvent("volumechange",_V_.proxy(this,this.update))},createElement:function(){return this._super("div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})},onClick:function(event){this.player.muted(this.player.muted()?false:true)},update:function(event){var vol=this.player.volume(),level=3;if(vol==0||this.player.muted()){level=0}else{if(vol<0.33){level=1}else{if(vol<0.67){level=2}}}_V_.each.call(this,[0,1,2,3],function(i){_V_.removeClass(this.el,"vjs-vol-"+i)});_V_.addClass(this.el,"vjs-vol-"+level)}});_V_.PosterImage=_V_.Button.extend({init:function(player,options){this._super(player,options);if(!this.player.options.poster){this.hide()}player.addEvent("play",_V_.proxy(this,this.hide))},createElement:function(){return _V_.createElement("img",{className:"vjs-poster",src:this.player.options.poster,tabIndex:-1})},onClick:function(){this.player.play()}});_V_.Menu=_V_.Component.extend({init:function(player,options){this._super(player,options)},addItem:function(component){this.addComponent(component);component.addEvent("click",this.proxy(function(){this.unlockShowing()}))},createElement:function(){return this._super("ul",{className:"vjs-menu"})}});_V_.MenuItem=_V_.Button.extend({init:function(player,options){this._super(player,options);if(options.selected){this.addClass("vjs-selected")}},createElement:function(type,attrs){return this._super("li",_V_.merge({className:"vjs-menu-item",innerHTML:this.options.label},attrs))},onClick:function(){this.selected(true)},selected:function(selected){if(selected){this.addClass("vjs-selected")}else{this.removeClass("vjs-selected")}}});_V_.merge(_V_.Player.prototype,{addTextTracks:function(trackObjects){var tracks=this.textTracks=(this.textTracks)?this.textTracks:[],i=0,j=trackObjects.length,track,Kind;for(;i<j;i++){Kind=_V_.uc(trackObjects[i].kind||"subtitles");track=new _V_[Kind+"Track"](this,trackObjects[i]);tracks.push(track);if(track["default"]){this.ready(_V_.proxy(track,track.show))}}return this},showTextTrack:function(id,disableSameKind){var tracks=this.textTracks,i=0,j=tracks.length,track,showTrack,kind;for(;i<j;i++){track=tracks[i];if(track.id===id){track.show();showTrack=track}else{if(disableSameKind&&track.kind==disableSameKind&&track.mode>0){track.disable()}}}kind=(showTrack)?showTrack.kind:((disableSameKind)?disableSameKind:false);if(kind){this.triggerEvent(kind+"trackchange")}return this}});_V_.Track=_V_.Component.extend({init:function(player,options){this._super(player,options);_V_.merge(this,{id:options.id||("vjs_"+options.kind+"_"+options.language+"_"+_V_.guid++),src:options.src,"default":options["default"],title:options.title,language:options.srclang,label:options.label,cues:[],activeCues:[],readyState:0,mode:0})},createElement:function(){return this._super("div",{className:"vjs-"+this.kind+" vjs-text-track"})},show:function(){this.activate();this.mode=2;this._super()},hide:function(){this.activate();this.mode=1;this._super()},disable:function(){if(this.mode==2){this.hide()}this.deactivate();this.mode=0},activate:function(){if(this.readyState==0){this.load()}if(this.mode==0){this.player.addEvent("timeupdate",this.proxy(this.update,this.id));this.player.addEvent("ended",this.proxy(this.reset,this.id));if(this.kind=="captions"||this.kind=="subtitles"){this.player.textTrackDisplay.addComponent(this)}}},deactivate:function(){this.player.removeEvent("timeupdate",this.proxy(this.update,this.id));this.player.removeEvent("ended",this.proxy(this.reset,this.id));this.reset();this.player.textTrackDisplay.removeComponent(this)},load:function(){if(this.readyState==0){this.readyState=1;_V_.get(this.src,this.proxy(this.parseCues),this.proxy(this.onError))}},onError:function(err){this.error=err;this.readyState=3;this.triggerEvent("error")},parseCues:function(srcContent){var cue,time,text,lines=srcContent.split("\n"),line="",id;for(var i=1,j=lines.length;i<j;i++){line=_V_.trim(lines[i]);if(line){if(line.indexOf("-->")==-1){id=line;line=_V_.trim(lines[++i])}else{id=this.cues.length}cue={id:id,index:this.cues.length};time=line.split(" --> ");cue.startTime=this.parseCueTime(time[0]);cue.endTime=this.parseCueTime(time[1]);text=[];while(lines[++i]&&(line=_V_.trim(lines[i]))){text.push(line)}cue.text=text.join("<br/>");this.cues.push(cue)}}this.readyState=2;this.triggerEvent("loaded")},parseCueTime:function(timeText){var parts=timeText.split(":"),time=0,hours,minutes,other,seconds,ms,flags;if(parts.length==3){hours=parts[0];minutes=parts[1];other=parts[2]}else{hours=0;minutes=parts[0];other=parts[1]}other=other.split(/\s+/);seconds=other.splice(0,1)[0];seconds=seconds.split(/\.|,/);ms=parseFloat(seconds[1]);seconds=seconds[0];time+=parseFloat(hours)*3600;time+=parseFloat(minutes)*60;time+=parseFloat(seconds);if(ms){time+=ms/1000}return time},update:function(){if(this.cues.length>0){var time=this.player.currentTime();if(this.prevChange===undefined||time<this.prevChange||this.nextChange<=time){var cues=this.cues,newNextChange=this.player.duration(),newPrevChange=0,reverse=false,newCues=[],firstActiveIndex,lastActiveIndex,html="",cue,i,j;if(time>=this.nextChange||this.nextChange===undefined){i=(this.firstActiveIndex!==undefined)?this.firstActiveIndex:0}else{reverse=true;i=(this.lastActiveIndex!==undefined)?this.lastActiveIndex:cues.length-1}while(true){cue=cues[i];if(cue.endTime<=time){newPrevChange=Math.max(newPrevChange,cue.endTime);if(cue.active){cue.active=false}}else{if(time<cue.startTime){newNextChange=Math.min(newNextChange,cue.startTime);if(cue.active){cue.active=false}if(!reverse){break}}else{if(reverse){newCues.splice(0,0,cue);if(lastActiveIndex===undefined){lastActiveIndex=i}firstActiveIndex=i}else{newCues.push(cue);if(firstActiveIndex===undefined){firstActiveIndex=i}lastActiveIndex=i}newNextChange=Math.min(newNextChange,cue.endTime);newPrevChange=Math.max(newPrevChange,cue.startTime);cue.active=true}}if(reverse){if(i===0){break}else{i--}}else{if(i===cues.length-1){break}else{i++}}}this.activeCues=newCues;this.nextChange=newNextChange;this.prevChange=newPrevChange;this.firstActiveIndex=firstActiveIndex;this.lastActiveIndex=lastActiveIndex;this.updateDisplay();this.triggerEvent("cuechange")}}},updateDisplay:function(){var cues=this.activeCues,html="",i=0,j=cues.length;for(;i<j;i++){html+="<span class='vjs-tt-cue'>"+cues[i].text+"</span>"}this.el.innerHTML=html},reset:function(){this.nextChange=0;this.prevChange=this.player.duration();this.firstActiveIndex=0;this.lastActiveIndex=0}});_V_.CaptionsTrack=_V_.Track.extend({kind:"captions"});_V_.SubtitlesTrack=_V_.Track.extend({kind:"subtitles"});_V_.ChaptersTrack=_V_.Track.extend({kind:"chapters"});_V_.TextTrackDisplay=_V_.Component.extend({createElement:function(){return this._super("div",{className:"vjs-text-track-display"})}});_V_.TextTrackMenuItem=_V_.MenuItem.extend({init:function(player,options){var track=this.track=options.track;options.label=track.label;options.selected=track["default"];this._super(player,options);this.player.addEvent(track.kind+"trackchange",_V_.proxy(this,this.update))},onClick:function(){this._super();this.player.showTextTrack(this.track.id,this.track.kind)},update:function(){if(this.track.mode==2){this.selected(true)}else{this.selected(false)}}});_V_.OffTextTrackMenuItem=_V_.TextTrackMenuItem.extend({init:function(player,options){options.track={kind:options.kind,player:player,label:"Off"};this._super(player,options)},onClick:function(){this._super();this.player.showTextTrack(this.track.id,this.track.kind)},update:function(){var tracks=this.player.textTracks,i=0,j=tracks.length,track,off=true;for(;i<j;i++){track=tracks[i];if(track.kind==this.track.kind&&track.mode==2){off=false}}if(off){this.selected(true)}else{this.selected(false)}}});_V_.TextTrackButton=_V_.Button.extend({init:function(player,options){this._super(player,options);this.menu=this.createMenu();if(this.items.length===0){this.hide()}},createMenu:function(){var menu=new _V_.Menu(this.player);menu.el.appendChild(_V_.createElement("li",{className:"vjs-menu-title",innerHTML:_V_.uc(this.kind)}));menu.addItem(new _V_.OffTextTrackMenuItem(this.player,{kind:this.kind}));this.items=this.createItems();this.each(this.items,function(item){menu.addItem(item)});this.addComponent(menu);return menu},createItems:function(){var items=[];this.each(this.player.textTracks,function(track){if(track.kind===this.kind){items.push(new _V_.TextTrackMenuItem(this.player,{track:track}))}});return items},buildCSSClass:function(){return this.className+" vjs-menu-button "+this._super()},onFocus:function(){this.menu.lockShowing();_V_.one(this.menu.el.childNodes[this.menu.el.childNodes.length-1],"blur",this.proxy(function(){this.menu.unlockShowing()}))},onBlur:function(){},onClick:function(){this.one("mouseout",this.proxy(function(){this.menu.unlockShowing();this.el.blur()}))}});_V_.CaptionsButton=_V_.TextTrackButton.extend({kind:"captions",buttonText:"Captions",className:"vjs-captions-button"});_V_.SubtitlesButton=_V_.TextTrackButton.extend({kind:"subtitles",buttonText:"Subtitles",className:"vjs-subtitles-button"});_V_.ChaptersButton=_V_.TextTrackButton.extend({kind:"chapters",buttonText:"Chapters",className:"vjs-chapters-button",createItems:function(chaptersTrack){var items=[];this.each(this.player.textTracks,function(track){if(track.kind===this.kind){items.push(new _V_.TextTrackMenuItem(this.player,{track:track}))}});return items},createMenu:function(){var tracks=this.player.textTracks,i=0,j=tracks.length,track,chaptersTrack,items=this.items=[];for(;i<j;i++){track=tracks[i];if(track.kind==this.kind&&track["default"]){if(track.readyState<2){this.chaptersTrack=track;track.addEvent("loaded",this.proxy(this.createMenu));return}else{chaptersTrack=track;break}}}var menu=this.menu=new _V_.Menu(this.player);menu.el.appendChild(_V_.createElement("li",{className:"vjs-menu-title",innerHTML:_V_.uc(this.kind)}));if(chaptersTrack){var cues=chaptersTrack.cues,i=0,j=cues.length,cue,mi;for(;i<j;i++){cue=cues[i];mi=new _V_.ChaptersTrackMenuItem(this.player,{track:chaptersTrack,cue:cue});items.push(mi);menu.addComponent(mi)}}this.addComponent(menu);if(this.items.length>0){this.show()}return menu}});_V_.ChaptersTrackMenuItem=_V_.MenuItem.extend({init:function(player,options){var track=this.track=options.track,cue=this.cue=options.cue,currentTime=player.currentTime();options.label=cue.text;options.selected=(cue.startTime<=currentTime&&currentTime<cue.endTime);this._super(player,options);track.addEvent("cuechange",_V_.proxy(this,this.update))},onClick:function(){this._super();this.player.currentTime(this.cue.startTime);this.update(this.cue.startTime)},update:function(time){var cue=this.cue,currentTime=this.player.currentTime();if(cue.startTime<=currentTime&&currentTime<cue.endTime){this.selected(true)}else{this.selected(false)}}});_V_.merge(_V_.ControlBar.prototype.options.components,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});_V_.autoSetup=function(){var options,vid,player,vids=document.getElementsByTagName("video");if(vids&&vids.length>0){for(var i=0,j=vids.length;i<j;i++){vid=vids[i];if(vid&&vid.getAttribute){if(vid.player===undefined){options=vid.getAttribute("data-setup");if(options!==null){options=JSON.parse(options||"{}");player=_V_(vid,options)}}}else{_V_.autoSetupTimeout(1);break}}}else{if(!_V_.windowLoaded){_V_.autoSetupTimeout(1)}}};_V_.autoSetupTimeout=function(wait){setTimeout(_V_.autoSetup,wait)};_V_.addEvent(window,"load",function(){_V_.windowLoaded=true});_V_.autoSetup();window.VideoJS=window._V_=VideoJS})(window); \ No newline at end of file