ÿþ/ / j Q u e r y   T r a n s l a t e   p l u g i n   a n d   r e l a t e d   c o m p o n e n t s 
 
 
 
 
 
 / * !   
 
   *   j Q u e r y   n o d e s C o n t a i n i n g T e x t   p l u g i n   
 
   *   
 
   *   V e r s i o n :   1 . 1 . 2 
 
   *   
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   *   
 
   *   C o p y r i g h t   ( c )   2 0 0 9   B a l a z s   E n d r e s z   ( b a l a z s . e n d r e s z @ g m a i l . c o m ) 
 
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   a n d   G P L   l i c e n s e s . 
 
   *   
 
   * / 
 
   
 
 ; ( f u n c t i o n ( $ ) { 
 
 
 
 f u n c t i o n   N c t ( ) { } 
 
 
 
 N c t . p r o t o t y p e   =   { 
 
 	 i n i t :   f u n c t i o n ( j q ,   o ) { 
 
 	 	 t h i s . t e x t A r r a y   =   [ ] ; 
 
 	 	 t h i s . e l e m e n t s   =   [ ] ; 
 
 	 	 t h i s . o p t i o n s   =   o ; 
 
 	 	 t h i s . j q u e r y   =   j q ; 
 
 	 	 t h i s . n   =   - 1 ; 
 
 	 	 i f ( o . a s y n c   = = =   t r u e ) 
 
 	 	 	 o . a s y n c   =   2 ; 
 
 	 	 
 
 	 	 i f ( o . n o t ) { 
 
 	 	 	 j q   =   j q . n o t ( o . n o t ) ; 
 
 	 	 	 j q   =   j q . a d d (   j q . f i n d ( " * " ) . n o t ( o . n o t )   ) . n o t (   $ ( o . n o t ) . f i n d ( " * " )   ) ; 
 
 	 	 } e l s e 
 
 	 	 	 j q   =   j q . a d d (   j q . f i n d ( " * " )   ) ; 
 
 
 
 	 	 t h i s . j q   =   j q ; 
 
 	 	 t h i s . j q l   =   t h i s . j q . l e n g t h ; 
 
 	 	 r e t u r n   t h i s . p r o c e s s ( ) ; 
 
 
 
 	 } , 
 
 
 
 	 p r o c e s s :   f u n c t i o n ( ) { 
 
 	 	 t h i s . n + + ; 
 
 	 	 v a r   t h a t   =   t h i s ,   o   =   t h i s . o p t i o n s ,   t e x t   =   " " ,   h a s T e x t N o d e   =   f a l s e , 
 
 	 	 	 h a s C h i l d N o d e   =   f a l s e ,   e l   =   t h i s . j q [ t h i s . n ] ,   e ,   c ,   r e t ; 
 
 	 	 
 
 	 	 i f ( t h i s . n   = = =   t h i s . j q l ) { 
 
 	 	 	 r e t   =   t h i s . j q u e r y . p u s h S t a c k ( t h i s . e l e m e n t s ,   " n o d e s C o n t a i n i n g T e x t " ) ; 
 
 	 	 	 o . c o m p l e t e . c a l l ( r e t ,   r e t ,   t h i s . t e x t A r r a y ) ; 
 
 	 	 	 
 
 	 	 	 i f ( o . r e t u r n A l l   = = =   f a l s e   & &   o . w a l k   = = =   f a l s e ) 
 
 	 	 	 	 r e t u r n   t h i s . j q u e r y ; 
 
 	 	 	 r e t u r n   r e t ; 
 
 	 	 } 
 
 	 	 
 
 	 	 i f ( ! e l ) 
 
 	 	 	 r e t u r n   t h i s . p r o c e s s ( ) ; 
 
 	 	 e = $ ( e l ) ; 
 
 
 
 	 	 v a r   n o d e N a m e   =   e l . n o d e N a m e . t o U p p e r C a s e ( ) , 
 
 	 	 	 t y p e   =   n o d e N a m e   = = =   " I N P U T "   & &   $ . a t t r ( e l ,   " t y p e " ) . t o L o w e r C a s e ( ) ; 
 
 	 	 
 
 	 	 i f (   ( { S C R I P T : 1 ,   N O S C R I P T : 1 ,   S T Y L E : 1 ,   O B J E C T : 1 ,   I F R A M E : 1 } ) [   n o d e N a m e   ]   ) 
 
 	 	 	 r e t u r n   t h i s . p r o c e s s ( ) ; 
 
 	 	 
 
 	 	 i f ( t y p e o f   o . s u b j e c t   = = =   " s t r i n g " ) { 
 
 	 	 	 t e x t = e . a t t r ( o . s u b j e c t ) ; 
 
 	 	 } e l s e { 	 
 
 	 	 	 i f ( o . a l t A n d V a l   & &   ( n o d e N a m e   = = =   " I M G "   | |   t y p e   = = =   " i m a g e "   )   ) 
 
 	 	 	 	 t e x t   =   e . a t t r ( " a l t " ) ; 
 
 	 	 	 e l s e   i f (   o . a l t A n d V a l   & &   ( { t e x t : 1 ,   b u t t o n : 1 ,   s u b m i t : 1 } ) [   t y p e   ]   ) 
 
 	 	 	 	 t e x t   =   e . v a l ( ) ; 
 
 	 	 	 e l s e   i f ( n o d e N a m e   = = =   " T E X T A R E A " ) 
 
 	 	 	 	 t e x t   =   e . v a l ( ) ; 
 
 	 	 	 e l s e { 
 
 	 	 	 	 / / c h e c k   c h i l d N o d e s : 
 
 	 	 	 	 c   =   e l . f i r s t C h i l d ; 
 
 	 	 	 	 i f ( o . w a l k   ! = =   t r u e ) 
 
 	 	 	 	 	 h a s C h i l d N o d e   =   t r u e ; 
 
 	 	 	 	 e l s e { 
 
 	 	 	 	 	 w h i l e ( c ) { 
 
 	 	 	 	 	 	 i f ( c . n o d e T y p e   = =   1 ) { 
 
 	 	 	 	 	 	 	 h a s C h i l d N o d e   =   t r u e ; 
 
 	 	 	 	 	 	 	 b r e a k ; 
 
 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 c = c . n e x t S i b l i n g ; 
 
 	 	 	 	 	 } 
 
 	 	 	 	 } 
 
 
 
 	 	 	 	 i f ( ! h a s C h i l d N o d e ) 
 
 	 	 	 	 	 t e x t   =   e . t e x t ( ) ; 
 
 	 	 	 	 e l s e { / / c h e c k   t e x t N o d e s : 
 
 	 	 	 	 	 i f ( o . w a l k   ! = =   t r u e ) 
 
 	 	 	 	 	 	 h a s T e x t N o d e   =   t r u e ; 
 
 	 	 	 	 	 
 
 	 	 	 	 	 c = e l . f i r s t C h i l d ; 
 
 	 	 	 	 	 w h i l e ( c ) { 
 
 	 	 	 	 	 	 i f ( c . n o d e T y p e   = =   3   & &   c . n o d e V a l u e . m a t c h ( / \ S / )   ! = =   n u l l ) { / / t e x t n o d e s   w i t h   t e x t 
 
 	 	 	 	 	 	 	 / * j s l i n t   s k i p L i n e s * / 
 
 	 	 	 	 	 	 	 i f ( c . n o d e V a l u e . m a t c h ( / < ! [   \ r \ n \ t ] * ( - - ( [ ^ \ - ] | [ \ r \ n ] | - [ ^ \ - ] ) * - - [   \ r \ n \ t ] * ) > / )   ! = =   n u l l ) { 
 
 	 	 	 	 	 	 	 	 i f ( c . n o d e V a l u e . m a t c h ( / ( \ S + ( ? = . * < ) ) | ( > ( ? = . * \ S + ) ) / )   ! = =   n u l l ) { 
 
 	 	 	 	 	 	 	 	 	 h a s T e x t N o d e   =   t r u e ; 
 
 	 	 	 	 	 	 	 	 	 b r e a k ; 
 
 	 	 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 	 } e l s e { 
 
 	 	 	 	 	 	 	 	 h a s T e x t N o d e   =   t r u e ; 
 
 	 	 	 	 	 	 	 	 b r e a k ; 
 
 	 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 	 / * j s l i n t   s k i p L i n e s E n d * / 
 
 	 	 	 	 	 	 } 
 
 	 	 	 	 	 	 c   =   c . n e x t S i b l i n g ; 
 
 	 	 	 	 	 } 
 
 
 
 	 	 	 	 	 i f ( h a s T e x t N o d e ) { / / r e m o v e   c h i l d   n o d e s   f r o m   j q 
 
 	 	 	 	 	 	 / / r e m o v e   s c r i p t s : 
 
 	 	 	 	 	 	 t e x t   =   e . h t m l ( ) ; 
 
 	 	 	 	 	 	 / * j s l i n t   s k i p L i n e s * / 
 
 	 	 	 	 	 	 t e x t   =   o . s t r i p S c r i p t s   ?   t e x t . r e p l a c e ( / < s c r i p t [ ^ > ] * > ( [ \ s \ S ] * ? ) < \ / s c r i p t > / g i ,   " " )   :   t e x t ; 
 
 	 	 	 	 	 	 / * j s l i n t   s k i p L i n e s E n d * / 
 
 	 	 	 	 	 	 t h i s . j q   =   t h i s . j q . n o t (   e . f i n d ( " * " )   ) ; 
 
 	 	 	 	 	 } 
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 } 
 
 
 
 	 	 i f ( ! t e x t ) 
 
 	 	 	 r e t u r n   t h i s . p r o c e s s ( ) ; 
 
 	 	 t h i s . e l e m e n t s . p u s h ( e l ) ; 
 
 	 	 t h i s . t e x t A r r a y . p u s h ( t e x t ) ; 
 
 
 
 	 	 o . e a c h . c a l l ( e l ,   t h i s . e l e m e n t s . l e n g t h   -   1 ,   e l ,   t e x t ) ; 
 
 	 	 
 
 	 	 i f ( o . a s y n c ) { 
 
 	 	 	 s e t T i m e o u t ( f u n c t i o n ( ) { t h a t . p r o c e s s ( ) ; } ,   o . a s y n c ) ; 
 
 	 	 	 r e t u r n   t h i s . j q u e r y ; 
 
 	 	 } e l s e 
 
 	 	 	 r e t u r n   t h i s . p r o c e s s ( ) ; 
 
 	 	 
 
 	 } 
 
 } ; 
 
 
 
 v a r   d e f a u l t s   =   { 
 
 	 n o t :   " " , 
 
 	 a s y n c :   f a l s e , 
 
 	 e a c h :   f u n c t i o n ( ) { } , 
 
 	 c o m p l e t e :   f u n c t i o n ( ) { } , 
 
 	 c o m m e n t s :   f a l s e , 
 
 	 r e t u r n A l l :   t r u e , 
 
 	 w a l k :   t r u e , 
 
 	 a l t A n d V a l :   f a l s e , 
 
 	 s u b j e c t :   t r u e , 
 
 	 s t r i p S c r i p t s :   t r u e 
 
 } ; 
 
 
 
 $ . f n . n o d e s C o n t a i n i n g T e x t   =   f u n c t i o n ( o ) { 
 
 	 o   =   $ . e x t e n d ( { } ,   d e f a u l t s ,   $ . f n . n o d e s C o n t a i n i n g T e x t . d e f a u l t s ,   o ) ; 
 
 	 r e t u r n   n e w   N c t ( ) . i n i t ( t h i s ,   o ) ; 
 
 } ; 
 
 
 
 $ . f n . n o d e s C o n t a i n i n g T e x t . d e f a u l t s   =   d e f a u l t s ; 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! 
 
   *   T e x t n o d e   T r a n s l a t o r 
 
   *   A r i e l   F l e s l e r   -   h t t p : / / f l e s l e r . b l o g s p o t . c o m / 2 0 0 8 / 0 5 / t e x t n o d e - t r a n s l a t o r - f o r - j a v a s c r i p t . h t m l 
 
   * / 
 
 / / T h i s   i s   n o w   o n l y   a   p l a c e h o l d e r ,   t h e   o r i g i n a l   s c r i p t   h a s   b e e n   m o d i f i e d   
 
 / / a n d   t h e   T r a n s l a t o r   c l a s s   i s   n o   l o n g e r   e x p o s e d 
 
 
 
 / * !   
 
   *   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   *   
 
   *   C o p y r i g h t   ( c )   2 0 0 9   B a l a z s   E n d r e s z   ( b a l a z s . e n d r e s z @ g m a i l . c o m ) 
 
   *   D u a l   l i c e n s e d   u n d e r   t h e   M I T   a n d   G P L   l i c e n s e s . 
 
   *   
 
   *   T h i s   p l u g i n   u s e s   t h e   ' G o o g l e   A J A X   L a n g u a g e   A P I '   ( h t t p : / / c o d e . g o o g l e . c o m / a p i s / a j a x l a n g u a g e / ) 
 
   *   Y o u   c a n   r e a d   t h e   t e r m s   o f   u s e   a t   h t t p : / / c o d e . g o o g l e . c o m / a p i s / a j a x l a n g u a g e / t e r m s . h t m l 
 
   *   
 
   * / 
 
 ; ( f u n c t i o n ( $ ) { 
 
 	 	       
 
 f u n c t i o n   $ f u n c t i o n ( ) { } 
 
 
 
 v a r   T r u e   =   t r u e ,   F a l s e   =   f a l s e ,   u n d e f i n e d ,   r e p l a c e   =   " " . r e p l a c e , 
 
 	 S t r   =   S t r i n g ,   F n   =   F u n c t i o n ,   O b j   =   O b j e c t , 
 
 	 G L ,   G L L ,   t o L a n g C o d e ,   i n v e r s e L a n g u a g e s   =   { } , 
 
 	 l o a d i n g ,   r e a d y L i s t   =   [ ] , 
 
 	 d e f a u l t s   =   { 
 
 	 	 f r o m :   " " , 
 
 	 	 t o :   " " , 
 
 	 	 s t a r t :   $ f u n c t i o n , 
 
 	 	 e r r o r :   $ f u n c t i o n , 
 
 	 	 e a c h :   $ f u n c t i o n , 
 
 	 	 c o m p l e t e :   $ f u n c t i o n , 
 
 	 	 o n T i m e o u t :   $ f u n c t i o n , 
 
 	 	 t i m e o u t :   0 , 
 
 	 	 
 
 	 	 s t r i p C o m m e n t s :   T r u e , 
 
 	 	 s t r i p W h i t e s p a c e :   T r u e , 
 
 	 	 s t r i p S c r i p t s :   T r u e , 
 
 	 	 s e p a r a t o r s :   / \ . \ ? \ ! ; : / , 
 
 	 	 l i m i t :   1 7 5 0 , 
 
 	 	 
 
 
 
 	 	 w a l k :   T r u e , 
 
 	 	 r e t u r n A l l :   F a l s e , 
 
 	 	 r e p l a c e :   T r u e , 
 
 	 	 r e b i n d :   T r u e , 
 
 	 	 d a t a :   T r u e , 
 
 	 	 s e t L a n g A t t r :   F a l s e , 
 
 	 	 s u b j e c t :   T r u e , 
 
 	 	 n o t :   " " , 
 
 	 	 a l t A n d V a l : T r u e , 
 
 	 	 a s y n c :   F a l s e , 
 
 	 	 t o g g l e :   F a l s e , 
 
 	 	 f r o m O r i g i n a l :   T r u e , 
 
 	 	 
 
 	 	 p a r a l l e l :   f a l s e , 
 
 	 	 t r i m :   t r u e , 
 
 	 	 a l w a y s R e p l a c e :   f a l s e 
 
 	 	 / / , r e s p o n s e :   $ f u n c t i o n 
 
 	 	 
 
 	 } ; 
 
 
 
 
 
 f u n c t i o n   l o a d e d ( ) { 
 
 	 $ . t r a n s l a t e . G L   =   G L   =   g o o g l e . l a n g u a g e ; 
 
 	 $ . t r a n s l a t e . G L L   =   G L L   =   G L . L a n g u a g e s ; 
 
 	 t o L a n g C o d e   =   $ . t r a n s l a t e . t o L a n g u a g e C o d e ; 
 
 	 
 
 	 $ . e a c h ( G L L ,   f u n c t i o n ( l ,   l c ) { 
 
 	 	 i n v e r s e L a n g u a g e s [   l c . t o U p p e r C a s e ( )   ]   =   l ; 
 
 	 } ) ; 
 
 	 
 
 	 $ . t r a n s l a t e . i s R e a d y   =   T r u e ; 
 
 	 v a r   f n ; 
 
 	 w h i l e ( ( f n   =   r e a d y L i s t . s h i f t ( ) ) )   f n ( ) ; 
 
 } 
 
 
 
 f u n c t i o n   f i l t e r ( o b j ,   f n ) { 
 
 	 v a r   n e w O b j   =   { } ; 
 
 	 $ . e a c h ( o b j ,   f u n c t i o n ( l a n g ,   l a n g C o d e ) { 
 
 	 	 i f (   f n ( l a n g C o d e ,   l a n g )   = = =   T r u e )   n e w O b j [   l a n g   ]   =   l a n g C o d e ; 
 
 	 } ) ; 
 
 	 r e t u r n   n e w O b j ; 
 
 } 
 
 
 
 f u n c t i o n   b i n d ( f n ,   t h i s O b j ,   a r g s ) { 
 
 	 r e t u r n   f u n c t i o n ( ) { 
 
 	 	 r e t u r n   f n . a p p l y ( t h i s O b j   = = =   T r u e   ?   a r g u m e n t s [ 0 ]   :   t h i s O b j ,   a r g s   | |   a r g u m e n t s ) ; 
 
 	 } ; 
 
 } 
 
 
 
 f u n c t i o n   i s S e t ( e ) { 
 
 	 r e t u r n   e   ! = =   u n d e f i n e d ; 
 
 } 
 
 
 
 f u n c t i o n   v a l i d a t e ( _ a r g s ,   o v e r l o a d ,   e r r o r ) { 
 
 	 v a r   m a t c h e d ,   o b j   =   { } ,   a r g s   =   $ . g r e p ( _ a r g s ,   i s S e t ) ; 
 
 	 
 
 	 $ . e a c h ( o v e r l o a d ,   f u n c t i o n ( _ ,   e l ) { 
 
 	 	 v a r   m a t c h e s   =   $ . g r e p ( e l [ 0 ] ,   f u n c t i o n ( e ,   i ) { 
 
 	 	 	 	 r e t u r n   i s S e t ( a r g s [ i ] )   & &   a r g s [ i ] . c o n s t r u c t o r   = = =   e ; 
 
 	 	 	 } ) . l e n g t h ; 
 
 	 	 i f ( m a t c h e s   = = =   a r g s . l e n g t h   & &   m a t c h e s   = = =   e l [ 0 ] . l e n g t h   & &   ( m a t c h e d   =   T r u e ) ) { 
 
 	 	 	 $ . e a c h ( e l [ 1 ] ,   f u n c t i o n ( i ,   p r o p ) { 
 
 	 	 	 	 o b j [ p r o p ]   =   a r g s [ i ] ; 
 
 	 	 	 } ) ; 
 
 	 	 	 r e t u r n   F a l s e ; 
 
 	 	 } 
 
 	 } ) ; 
 
 	 / / T O D O 
 
 	 i f ( ! m a t c h e d )   t h r o w   e r r o r ; 
 
 	 r e t u r n   o b j ; 
 
 } 
 
 
 
 
 
 f u n c t i o n   g e t O p t ( a r g s 0 ,   _ d e f a u l t s ) { 
 
 	 / / a r g s 0 = [ ] . s l i c e . c a l l ( a r g s 0 ,   0 ) 
 
 	 v a r   a r g s   =   v a l i d a t e ( a r g s 0   ,   $ . t r a n s l a t e . o v e r l o a d ,   " j Q u e r y . t r a n s l a t e :   I n v a l i d   a r g u m e n t s "   ) , 
 
 	 	 o   =   a r g s . o p t i o n s   | |   { } ; 
 
 	 d e l e t e   a r g s . o p t i o n s ; 
 
 	 o   =   $ . e x t e n d ( { } ,   d e f a u l t s ,   _ d e f a u l t s ,   $ . e x t e n d ( o ,   a r g s ) ) ; 
 
 	 
 
 	 i f ( o . f r o m O r i g i n a l )   o . t o g g l e   =   T r u e ; 
 
 	 i f ( o . t o g g l e )   o . d a t a   =   T r u e ; 
 
 	 i f ( o . a s y n c   = = =   T r u e )   o . a s y n c   =   2 ; 
 
 	 
 
 	 r e t u r n   o ; 
 
 } 
 
 
 
 
 
 f u n c t i o n   T ( ) { 
 
 	 / / c o p y   o v e r   s t a t i c   m e t h o d s   d u r i n g   e a c h   i n s t a n t i a t i o n 
 
 	 / / f o r   b a c k w a r d   c o m p a t i b i l i t y   a n d   a c c e s s   i n s i d e   c a l l b a c k   f u n c t i o n s 
 
 	 t h i s . e x t e n d ( $ . t r a n s l a t e ) ; 
 
 	 d e l e t e   t h i s . d e f a u l t s ; 
 
 	 d e l e t e   t h i s . f n ; 
 
 } 
 
 
 
 T . p r o t o t y p e   =   { 
 
 	 v e r s i o n :   " 1 . 4 . 7 " , 
 
 	 
 
 	 _ i n i t :   f u n c t i o n ( t ,   o ) { 
 
 	 	 v a r   s e p a r a t o r   =   o . s e p a r a t o r s . s o u r c e   | |   o . s e p a r a t o r s , 
 
 	 	 	 i s S t r i n g   =   t h i s . i s S t r i n g   =   t y p e o f   t   = = =   " s t r i n g " , 
 
 	 	 	 l a s t p o s   =   0 ,   s u b s t r ; 
 
 	 	 
 
 	 	 $ . e a c h ( [ " s t r i p C o m m e n t s " ,   " s t r i p S c r i p t s " ,   " s t r i p W h i t e s p a c e " ] ,   f u n c t i o n ( i ,   n a m e ) { 
 
 	 	 	 v a r   f n   =   $ . t r a n s l a t e [ n a m e ] ; 
 
 	 	 	 i f (   o [ n a m e ]   ) 
 
 	 	 	 	 t   =   i s S t r i n g   ?   f n ( t )   :   $ . m a p ( t ,   f n ) ; 
 
 	 	 } ) ; 
 
 
 
 	 	 t h i s . r a w S o u r c e   =   " < d i v > "   +   ( i s S t r i n g   ?   t   :   t . j o i n ( " < / d i v > < d i v > " ) )   +   " < / d i v > " ; 
 
 	 	 t h i s . _ m 3   =   n e w   R e g E x p ( " [ "   +   s e p a r a t o r   +   " ] ( ? ! [ ^ "   +   s e p a r a t o r   +   " ] * [ "   +   s e p a r a t o r   +   " ] ) " ) ; 
 
 	 	 t h i s . o p t i o n s   =   o ; 
 
 	 	 t h i s . f r o m   =   o . f r o m   =   t o L a n g C o d e ( o . f r o m )   | |   " " ; 
 
 	 	 t h i s . t o   =   o . t o   =   t o L a n g C o d e ( o . t o )   | |   " " ; 
 
 	 	 t h i s . s o u r c e   =   t ; 
 
 	 	 t h i s . r a w T r a n s l a t i o n   =   " " ; 
 
 	 	 t h i s . t r a n s l a t i o n   =   [ ] ; 
 
 	 	 t h i s . i   =   0 ; 
 
 	 	 t h i s . s t o p p e d   =   F a l s e ; 
 
 	 	 t h i s . e l e m e n t s   =   o . n o d e s ; 
 
 	 	 
 
 	 	 / / t h i s . _ n r e s   =   0 ; 
 
 	 	 / / t h i s . _ p r o g r e s s   =   0 ; 
 
 	 	 t h i s . _ i   =   - 1 ;   / / T O D O :   r e n a m e 
 
 	 	 t h i s . r a w S o u r c e s   =   [ ] ; 
 
 	 	 
 
 	 	 w h i l e ( T r u e ) { 
 
 	 	 	 s u b s t r   =   t h i s . t r u n c a t e (   t h i s . r a w S o u r c e . s u b s t r ( l a s t p o s ) ,   o . l i m i t ) ; 
 
 	 	 	 i f ( ! s u b s t r )   b r e a k ; 
 
 	 	 	 t h i s . r a w S o u r c e s . p u s h ( s u b s t r ) ; 
 
 	 	 	 l a s t p o s   + =   s u b s t r . l e n g t h ; 
 
 	 	 } 
 
 	 	 t h i s . q u e u e   =   n e w   A r r a y ( t h i s . r a w S o u r c e s . l e n g t h ) ; 
 
 	 	 t h i s . d o n e   =   0 ; 
 
 	 	 
 
 	 	 o . s t a r t . c a l l ( t h i s ,   t   ,   o . f r o m ,   o . t o ,   o ) ; 
 
 	 	 
 
 	 	 i f ( o . t i m e o u t ) 
 
 	 	 	 t h i s . t i m e o u t   =   s e t T i m e o u t ( b i n d ( o . o n T i m e o u t ,   t h i s ,   [ t ,   o . f r o m ,   o . t o ,   o ] ) ,   o . t i m e o u t ) ; 
 
 	 	 
 
 	 	 ( o . t o g g l e   & &   o . n o d e s )   ? 	 
 
 	 	 	 ( o . t e x t N o d e s   ?   t h i s . _ t o g g l e T e x t N o d e s ( )   :   t h i s . _ t o g g l e ( ) )   :   
 
 	 	 	 t h i s . _ p r o c e s s ( ) ; 
 
 	 } , 
 
 	 
 
 	 _ p r o c e s s :   f u n c t i o n ( ) { 
 
 	 	 i f ( t h i s . s t o p p e d ) 
 
 	 	 	 r e t u r n ; 
 
 	 	 v a r   o   =   t h i s . o p t i o n s , 
 
 	 	 	 i   =   t h i s . r a w T r a n s l a t i o n . l e n g t h , 
 
 	 	 	 l a s t p o s ,   s u b s t ,   d i v s t ,   d i v c l ; 
 
 	 	 v a r   t h a t   =   t h i s ; 
 
 	 	 
 
 	 	 w h i l e (   ( l a s t p o s   =   t h i s . r a w T r a n s l a t i o n . l a s t I n d e x O f ( " < / d i v > " ,   i ) )   >   - 1 ) { 
 
 
 
 	 	 	 i   =   l a s t p o s   -   1 ; 
 
 	 	 	 s u b s t   =   t h i s . r a w T r a n s l a t i o n . s u b s t r ( 0 ,   i   +   1 ) ; 
 
 	 	 	 / * j s l i n t   s k i p L i n e s * / 	 	 
 
 	 	 	 d i v s t   =   s u b s t . m a t c h ( / < d i v [ >   ] / g i ) ; 	 
 
 	 	 	 d i v c l   =   s u b s t . m a t c h ( / < \ / d i v > / g i ) ; 
 
 	 	 	 / * j s l i n t   s k i p L i n e s E n d * / 
 
 	 	 	 
 
 	 	 	 d i v s t   =   d i v s t   ?   d i v s t . l e n g t h   :   0 ; 
 
 	 	 	 d i v c l   =   d i v c l   ?   d i v c l . l e n g t h   :   0 ; 
 
 	 	 	 
 
 	 	 	 i f ( d i v s t   ! = =   d i v c l   +   1 )   c o n t i n u e ;   / / i f   t h e r e   a r e   s o m e   u n c l o s e d   d i v s 
 
 
 
 	 	 	 v a r   d i v s c o m p l   =   $ (   t h i s . r a w T r a n s l a t i o n . s u b s t r ( 0 ,   i   +   7 )   ) ,   
 
 	 	 	 	 d i v l e n   =   d i v s c o m p l . l e n g t h ,   
 
 	 	 	 	 l   =   t h i s . i ; 
 
 	 	 	 
 
 	 	 	 i f ( l   = = =   d i v l e n )   b r e a k ;   / / i f   n o   n e w   e l e m e n t s   h a v e   b e e n   c o m p l e t e l y   t r a n s l a t e d 
 
 	 	 	 
 
 	 	 	 d i v s c o m p l . s l i c e ( l ,   d i v l e n ) . e a c h (   b i n d ( f u n c t i o n ( j ,   e ) { 
 
 	 	 	 	 i f ( t h i s . s t o p p e d ) 
 
 	 	 	 	 	 r e t u r n   F a l s e ; 
 
 	 	 	 	 v a r   e _ h t m l   =   $ ( e ) . h t m l ( ) ,   t r   =   o . t r i m   ?   $ . t r i m ( e _ h t m l )   :   e _ h t m l , 
 
 	 	 	 	 	 i   =   l   +   j ,   s r c   =   t h i s . s o u r c e , 
 
 	 	 	 	 	 f r o m   =   ! t h i s . f r o m   & &   t h i s . d e t e c t e d S o u r c e L a n g u a g e   | |   t h i s . f r o m ; 
 
 	 	 	 	 t h i s . t r a n s l a t i o n [ i ]   =   t r ; / / c r e a t e   a n   a r r a y   f o r   c o m p l e t e   c a l l b a c k 
 
 	 	 	 	 t h i s . i s S t r i n g   ?   t h i s . t r a n s l a t i o n   =   t r   :   s r c   =   t h i s . s o u r c e [ i ] ; 
 
 	 	 	 	 
 
 	 	 	 	 o . e a c h . c a l l ( t h i s ,   i ,   t r ,   s r c ,   f r o m ,   t h i s . t o ,   o ) ; 
 
 	 	 	 	 
 
 	 	 	 	 t h i s . i + + ; 
 
 	 	 	 } ,   t h i s ) ) ; 
 
 	 	 	 
 
 	 	 	 b r e a k ; 
 
 	 	 } 
 
 	 	 
 
 	 	 i f ( t h i s . r a w S o u r c e s . l e n g t h   -   1   = =   t h i s . _ i ) 
 
 	 	 	 t h i s . _ c o m p l e t e ( ) ; 
 
 	 	 
 
 	 	 v a r   _ t r a n s l a t e   =   b i n d ( t h i s . _ t r a n s l a t e ,   t h i s ) ; 
 
 	 	 
 
 	 	 i f ( o . p a r a l l e l ) { 
 
 	 	 	 i f ( t h i s . _ i   <   0 ) { 
 
 	 	 	 	 i f ( ! o . p a r a l l e l ) { 
 
 	 	 	 	 	 $ . e a c h ( t h i s . r a w S o u r c e s ,   _ t r a n s l a t e ) ; 
 
 	 	 	 	 } e l s e { 
 
 	 	 	 	 	 v a r   j   =   0 ,   n   =   t h i s . r a w S o u r c e s . l e n g t h ; 
 
 	 	 	 	 	 f u n c t i o n   s e q ( ) { 
 
 	 	 	 	 	 	 _ t r a n s l a t e ( ) ; 
 
 	 	 	 	 	 	 i f ( j   <   n ) 
 
 	 	 	 	 	 	 	 s e t T i m e o u t (   s e q ,   o . p a r a l l e l   ) ; 
 
 	 	 	 	 	 } 
 
 	 	 	 	 	 s e q ( ) ; 
 
 	 	 	 	 } 
 
 	 	 	 } 
 
 	 	 } e l s e 
 
 	 	 	 _ t r a n s l a t e ( ) ; 
 
 	 	 	 
 
 	 } , 
 
 	 
 
 	 _ t r a n s l a t e :   f u n c t i o n ( ) { 
 
 	 	 t h i s . _ i + + ; 	 	 
 
 	 	 v a r   i   =   t h i s . _ i ,   s r c   =   t h i s . r a w S o u r c e S u b   =   t h i s . r a w S o u r c e s [ i ] ; 
 
 	 	 i f ( ! s r c )   r e t u r n ; 
 
 	 	 
 
 	 	 G L . t r a n s l a t e ( s r c ,   t h i s . f r o m ,   t h i s . t o ,   b i n d ( f u n c t i o n ( r e s u l t ) { 
 
 	 	 	 / / t h i s . _ p r o g r e s s   =   1 0 0   *   ( + + t h i s . _ n r e s )   /   t h i s . r a w S o u r c e s . l e n g t h ; 
 
 	 	 	 / / t h i s . o p t i o n s . r e s p o n s e . c a l l ( t h i s ,   t h i s . _ p r o g r e s s ,   r e s u l t ) ; 
 
 	 	 	 i f ( r e s u l t . e r r o r ) 
 
 	 	 	 	 r e t u r n   t h i s . o p t i o n s . e r r o r . c a l l ( t h i s ,   r e s u l t . e r r o r ,   t h i s . r a w S o u r c e S u b ,   t h i s . f r o m ,   t h i s . t o ,   t h i s . o p t i o n s ) ; 
 
 	 	 	 
 
 	 	 	 t h i s . q u e u e [ i ]   =   r e s u l t . t r a n s l a t i o n   | |   t h i s . r a w S o u r c e S u b ; 
 
 	 	 	 t h i s . d e t e c t e d S o u r c e L a n g u a g e   =   r e s u l t . d e t e c t e d S o u r c e L a n g u a g e ; 
 
 	 	 	 t h i s . _ c h e c k ( ) ; 
 
 	 	 } ,   t h i s ) ) ; 
 
 
 
 	 } , 
 
 	 
 
 	 _ c h e c k :   f u n c t i o n ( ) { 
 
 	 	 i f ( ! t h i s . o p t i o n s . p a r a l l e l ) { 
 
 	 	 	 t h i s . r a w T r a n s l a t i o n   + =   t h i s . q u e u e [ t h i s . _ i ] ; 
 
 	 	 	 t h i s . _ p r o c e s s ( ) ; 
 
 	 	 	 r e t u r n ; 
 
 	 	 } 
 
 	 	 
 
 	 	 v a r   d o n e   =   0 ; 
 
 	 	 j Q u e r y . e a c h ( t h i s . q u e u e ,   f u n c t i o n ( i ,   n )   { 
 
 	 	 	 i f   ( n   ! =   u n d e f i n e d )   d o n e   =   i ; 
 
 	 	 	 e l s e   r e t u r n   f a l s e ; 
 
 	 	 } ) ; 	 	 	 
 
 	 	 
 
 	 	 i f   ( ( d o n e   >   t h i s . d o n e )   | |   ( d o n e   = = =   t h i s . q u e u e . l e n g t h   -   1 ) )   { 
 
 	 	 	 f o r ( v a r   i   =   0 ;   i   < =   d o n e ;   i + + ) 
 
 	 	 	 	 t h i s . r a w T r a n s l a t i o n   + =   t h i s . q u e u e [ i ] ; 
 
 	 	 	 t h i s . _ p r o c e s s ( ) ; 
 
 	 	 } 
 
 	 	 t h i s . d o n e   =   d o n e ; 
 
 	 	 
 
 	 } , 
 
 	 
 
 	 _ c o m p l e t e :   f u n c t i o n ( ) { 
 
 	 	 c l e a r T i m e o u t ( t h i s . t i m e o u t ) ; 
 
 
 
 	 	 t h i s . o p t i o n s . c o m p l e t e . c a l l ( t h i s ,   t h i s . t r a n s l a t i o n ,   t h i s . s o u r c e ,   
 
 	 	 	 ! t h i s . f r o m   & &   t h i s . d e t e c t e d S o u r c e L a n g u a g e   | |   t h i s . f r o m ,   t h i s . t o ,   t h i s . o p t i o n s ) ; 
 
 	 } , 
 
 	 
 
 	 s t o p :   f u n c t i o n ( ) { 
 
 	 	 i f ( t h i s . s t o p p e d ) 
 
 	 	 	 r e t u r n   t h i s ; 
 
 	 	 t h i s . s t o p p e d   =   T r u e ; 
 
 	 	 t h i s . o p t i o n s . e r r o r . c a l l ( t h i s ,   { m e s s a g e : " s t o p p e d " } ) ; 
 
 	 	 r e t u r n   t h i s ; 
 
 	 } 
 
 } ; 
 
 
 
 
 
 
 
 $ . t r a n s l a t e   =   f u n c t i o n ( t ,   a ) { 
 
 	 i f ( t   = =   u n d e f i n e d ) 
 
 	 	 r e t u r n   n e w   T ( ) ; 
 
 	 i f (   $ . i s F u n c t i o n ( t )   ) 
 
 	 	 r e t u r n   $ . t r a n s l a t e . r e a d y ( t ,   a ) ; 
 
 	 v a r   t h a t   =   n e w   T ( ) ; 
 
 	 
 
 	 v a r   a r g s   =   [ ] . s l i c e . c a l l ( a r g u m e n t s ,   0 ) ; 
 
 	 a r g s . s h i f t ( ) ; 
 
 	 r e t u r n   $ . t r a n s l a t e . r e a d y (   b i n d ( t h a t . _ i n i t ,   t h a t ,   [ t ,   g e t O p t ( a r g s ,   $ . t r a n s l a t e . d e f a u l t s ) ]   ) ,   F a l s e ,   t h a t   ) ; 
 
 } ; 
 
 
 
 
 
 $ . t r a n s l a t e . f n   =   $ . t r a n s l a t e . p r o t o t y p e   =   T . p r o t o t y p e ; 
 
 
 
 $ . t r a n s l a t e . f n . e x t e n d   =   $ . t r a n s l a t e . e x t e n d   =   $ . e x t e n d ; 
 
 
 
 
 
 $ . t r a n s l a t e . e x t e n d ( { 
 
 	 
 
 	 _ b i n d :   b i n d , 
 
 	 
 
 	 _ f i l t e r :   f i l t e r , 
 
 	 
 
 	 _ v a l i d a t e :   v a l i d a t e , 
 
 	 
 
 	 _ g e t O p t :   g e t O p t , 
 
 	 
 
 	 _ d e f a u l t s :   d e f a u l t s ,   / / b a s e   d e f a u l t s   u s e d   b y   o t h e r   c o m p o n e n t s   a s   w e l l   / / T O D O 
 
 	 
 
 	 d e f a u l t s :   $ . e x t e n d ( { } ,   d e f a u l t s ) , 
 
 	 
 
 	 c a p i t a l i z e :   f u n c t i o n ( t ) {   r e t u r n   t . c h a r A t ( 0 ) . t o U p p e r C a s e ( )   +   t . s u b s t r ( 1 ) . t o L o w e r C a s e ( ) ;   } , 
 
 	 
 
 	 t r u n c a t e :   f u n c t i o n ( t e x t ,   l i m i t ) { 
 
 	 	 v a r   i ,   m 1 ,   m 2 ,   m 3 ,   m 4 ,   t ,   e n c o d e d   =   e n c o d e U R I C o m p o n e n t (   t e x t   ) ; 
 
 	 	 
 
 	 	 f o r ( i   =   0 ;   i   <   1 0 ;   i + + ) { 
 
 	 	 	 t r y   {   
 
 	 	 	 	 t   =   d e c o d e U R I C o m p o n e n t (   e n c o d e d . s u b s t r ( 0 ,   l i m i t   -   i )   ) ; 
 
 	 	 	 }   c a t c h ( e ) {   c o n t i n u e ;   } 
 
 	 	 	 i f ( t )   b r e a k ; 
 
 	 	 } 
 
 	 	 
 
 	 	 r e t u r n   (   ! (   m 1   =   / < ( ? ! [ ^ < ] * > ) / . e x e c ( t )   )   )   ?   (     / / i f   n o   b r o k e n   t a g   p r e s e n t 
 
 	 	 	 (   ! (   m 2   =   / > \ s * $ / . e x e c ( t )   )   )   ?   (     / / i f   d o e s n ' t   e n d   w i t h   ' > ' 
 
 	 	 	 	 (   m 3   =   t h i s . _ m 3 . e x e c ( t )   )   ?   (     / / i f   b r o k e n   s e n t e n c e   p r e s e n t 
 
 	 	 	 	 	 (   m 4   =   / > ( ? ! [ ^ > ] * < ) / . e x e c ( t )   )   ?   (   
 
 	 	 	 	 	 	 m 3 . i n d e x   >   m 4 . i n d e x   ?   t . s u b s t r i n g ( 0 ,   m 3 . i n d e x + 1 )   :   t . s u b s t r i n g ( 0 ,   m 4 . i n d e x + 1 ) 
 
 	 	 	 	 	 )   :   t . s u b s t r i n g ( 0 ,   m 3 . i n d e x + 1 )   )   :   t   )   :   t   )   :   t . s u b s t r i n g ( 0 ,   m 1 . i n d e x ) ; 
 
 	 } , 
 
 
 
 	 g e t L a n g u a g e s :   f u n c t i o n ( a ,   b ) { 
 
 	 	 i f ( a   = =   u n d e f i n e d   | |   ( b   = =   u n d e f i n e d   & &   ! a ) ) 
 
 	 	 	 r e t u r n   G L L ; 
 
 	 	 
 
 	 	 v a r   n e w O b j   =   { } ,   t y p e o f _ a   =   t y p e o f   a , 
 
 	 	 	 l a n g u a g e s   =   b   ?   $ . t r a n s l a t e . g e t L a n g u a g e s ( a )   :   G L L , 
 
 	 	 	 f i l t e r A r g   =   (   t y p e o f _ a     = = =   " o b j e c t "   | |   t y p e o f _ a     = = =   " f u n c t i o n "   )   ?   a   :   b ; 
 
 	 	 	 	 
 
 	 	 i f ( f i l t e r A r g ) 
 
 	 	 	 i f ( f i l t e r A r g . c a l l )   / / i f   i t ' s   a   f i l t e r   f u n c t i o n 
 
 	 	 	 	 n e w O b j   =   f i l t e r ( l a n g u a g e s ,   f i l t e r A r g ) ; 
 
 	 	 	 e l s e   / / i f   i t ' s   a n   a r r a y   o f   l a n g u a g e s 
 
 	 	 	 	 f o r ( v a r   i   =   0 ,   l e n g t h   =   f i l t e r A r g . l e n g t h ,   l a n g ;   i   <   l e n g t h ;   i + + ) { 
 
 	 	 	 	 	 l a n g   =   $ . t r a n s l a t e . t o L a n g u a g e ( f i l t e r A r g [ i ] ) ; 
 
 	 	 	 	 	 i f ( l a n g u a g e s [ l a n g ]   ! =   u n d e f i n e d ) 
 
 	 	 	 	 	 	 n e w O b j [ l a n g ]   =   l a n g u a g e s [ l a n g ] ; 
 
 	 	 	 	 } 
 
 	 	 e l s e   / / i f   t h e   f i r s t   a r g u m e n t   i s   t r u e   - >   o n l y   t r a n s l a t a b l e   l a n g u a g e s 
 
 	 	 	 n e w O b j   =   f i l t e r ( G L L ,   G L . i s T r a n s l a t a b l e ) ; 
 
 	 	 
 
 	 	 r e t u r n   n e w O b j ; 
 
 	 } , 
 
 	 
 
 
 
 	 t o L a n g u a g e :   f u n c t i o n ( a ,   f o r m a t ) { 
 
 	 	 v a r   u   =   a . t o U p p e r C a s e ( ) ; 
 
 	 	 v a r   l   =   i n v e r s e L a n g u a g e s [ u ]   | |   
 
 	 	 	 ( G L L [ u ]   ?   u   :   u n d e f i n e d )   | |   
 
 	 	 	 i n v e r s e L a n g u a g e s [ ( $ . t r a n s l a t e . l a n g u a g e C o d e M a p [ a . t o L o w e r C a s e ( ) ] | | " " ) . t o U p p e r C a s e ( ) ] ; 
 
 	 	 r e t u r n   l   = =   u n d e f i n e d   ?   u n d e f i n e d   : 
 
 	 	 	 f o r m a t   = = =   " l o w e r c a s e "   ?   l . t o L o w e r C a s e ( )   :   f o r m a t   = = =   " c a p i t a l i z e "   ?   $ . t r a n s l a t e . c a p i t a l i z e ( l )   :   l ; 	 	 	 	 
 
 	 } , 
 
 	 
 
 	 t o L a n g u a g e C o d e :   f u n c t i o n ( a ) { 
 
 	 	 r e t u r n   G L L [ a ]   | |   
 
 	 	 	 G L L [   $ . t r a n s l a t e . t o L a n g u a g e ( a )   ]   | |   
 
 	 	 	 $ . t r a n s l a t e . l a n g u a g e C o d e M a p [ a . t o L o w e r C a s e ( ) ] ; 
 
 	 } , 
 
 	 	 
 
 	 s a m e :   f u n c t i o n ( a ,   b ) { 
 
 	 	 r e t u r n   a   = = =   b   | |   t o L a n g C o d e ( a )   = = =   t o L a n g C o d e ( b ) ; 
 
 	 } , 
 
 	 	 
 
 	 i s T r a n s l a t a b l e :   f u n c t i o n ( l ) { 
 
 	 	 r e t u r n   G L . i s T r a n s l a t a b l e (   t o L a n g C o d e ( l )   ) ; 
 
 	 } , 
 
 
 
 	 / / k e y s   m u s t   b e   l o w e r   c a s e ,   a n d   v a l u e s   m u s t   e q u a l   t o   a   
 
 	 / / l a n g u a g e   c o d e   s p e c i f i e d   i n   t h e   L a n g u a g e   A P I 
 
 	 l a n g u a g e C o d e M a p :   { 
 
 	 	 " p t " :   " p t - P T " , 
 
 	 	 " p t - b r " :   " p t - P T " , 	 	 
 
 	 	 " h e " :   " i w " , 
 
 	 	 " z l m " :   " m s " , 
 
 	 	 " z h - h a n s " :   " z h - C N " , 
 
 	 	 " z h - h a n t " :   " z h - T W " 
 
 	 	 / / , " z h - s g " : " z h - C N " 
 
 	 	 / / , " z h - h k " : " z h - T W " 
 
 	 	 / / , " z h - m o " : " z h - T W " 
 
 	 } , 
 
 	 
 
 	 / / u s e   o n l y   l a n g u a g e   c o d e s   s p e c i f i e d   i n   t h e   L a n g u a g e   A P I 
 
 	 i s R t l :   { 
 
 	 	 " a r " :   T r u e , 
 
 	 	 " i w " :   T r u e , 
 
 	 	 " f a " :   T r u e , 
 
 	 	 " u r " :   T r u e , 
 
 	 	 " y i " :   T r u e 
 
 	 } , 
 
 	 
 
 	 g e t B r a n d i n g :   f u n c t i o n ( ) { 
 
 	 	 r e t u r n   $ (   G L . g e t B r a n d i n g . a p p l y ( G L ,   a r g u m e n t s )   ) ; 
 
 	 } , 
 
 	 
 
 	 l o a d :   f u n c t i o n ( k e y ,   v e r s i o n ) { 
 
 	 	 l o a d i n g   =   T r u e ; 
 
 	 	 f u n c t i o n   _ l o a d ( ) {   
 
 	 	 	 g o o g l e . l o a d ( " l a n g u a g e " ,   v e r s i o n   | |   " 1 " ,   { " c a l l b a c k "   :   l o a d e d } ) ; 
 
 	 	 } 
 
 	 	 
 
 	 	 i f ( t y p e o f   g o o g l e   ! = =   " u n d e f i n e d "   & &   g o o g l e . l o a d ) 
 
 	 	 	 _ l o a d ( ) ; 
 
 	 	 e l s e 
 
 	 	 	 $ . g e t S c r i p t ( ( ( d o c u m e n t . l o c a t i o n . p r o t o c o l   = =   " h t t p s : " )   ?   " h t t p s : / / "   :   " h t t p : / / " )   + 
 
 	 	 	 	 	 	 " w w w . g o o g l e . c o m / j s a p i "   +   ( k e y   ?   " ? k e y = "   +   k e y   :   " " ) ,   _ l o a d ) ; 
 
 	 	 r e t u r n   $ . t r a n s l a t e ; 
 
 	 } , 
 
 	 
 
 	 r e a d y :   f u n c t i o n ( f n ,   p r e v e n t A u t o l o a d ,   t h a t ) { 
 
 	 	 $ . t r a n s l a t e . i s R e a d y   ?   f n ( )   :   r e a d y L i s t . p u s h ( f n ) ; 
 
 	 	 i f ( ! l o a d i n g   & &   ! p r e v e n t A u t o l o a d ) 
 
 	 	 	 $ . t r a n s l a t e . l o a d ( ) ; 
 
 	 	 r e t u r n   t h a t   | |   $ . t r a n s l a t e ; 
 
 	 } , 
 
 	 
 
 	 i s R e a d y :   F a l s e , 
 
 	 
 
 	 o v e r l o a d :   [ 
 
 	         [ [ ] , [ ] ] , 
 
 	 	 [ [ S t r ,   S t r ,   O b j ] , 	 [ " f r o m " ,   " t o " ,   " o p t i o n s " ] 	 ] , 
 
 	 	 [ [ S t r ,   O b j ] ,   	 	 [ " t o " ,   " o p t i o n s " ] 	 	 	 ] , 
 
 	 	 [ [ O b j ] ,   	 	 	 [ " o p t i o n s " ] 	 	 	 	 	 ] , 
 
 	 	 [ [ S t r ,   S t r ] ,   	 	 [ " f r o m " ,   " t o " ] 	 	 	 	 ] , 
 
 	 	 [ [ S t r ] ,   	 	 	 [ " t o " ] 	 	 	 	 	 	 ] , 
 
 	 	 [ [ S t r ,   S t r ,   F n ] , 	 [ " f r o m " ,   " t o " ,   " c o m p l e t e " ] 	 ] , 
 
 	 	 [ [ S t r ,   F n ] ,   	 	 [ " t o " ,   " c o m p l e t e " ] 	 	 	 ] 
 
 	 	   / / T O D O 
 
 	 	 / / , [ [ S t r ,   S t r ,   F n ,   F n ] ,   [ " f r o m " ,   " t o " ,   " e a c h " ,   " c o m p l e t e " ] ] 
 
 	 ] 
 
 	 / * j s l i n t   s k i p L i n e s * / 
 
 	 , 
 
 	 / / j s l i n t   d o e s n ' t   s e e m   t o   b e   a b l e   t o   p a r s e   s o m e   r e g e x e s   c o r r e c t l y   i f   u s e d   o n   t h e   s e r v e r , 
 
 	 / / h o w e v e r   i t   w o r k s   f i n e   i f   i t ' s   r u n   o n   t h e   c o m m a n d   l i n e :   j a v a   - j a r   r h i n o . j a r   j s l i n t . j s   f i l e . j s 
 
 	 s t r i p S c r i p t s :   b i n d ( r e p l a c e ,   T r u e ,   [ / < s c r i p t [ ^ > ] * > ( [ \ s \ S ] * ? ) < \ / s c r i p t > / g i ,   " " ] ) , 
 
 	 
 
 	 s t r i p W h i t e s p a c e :   b i n d ( r e p l a c e ,   T r u e ,   [ / \ s \ s + / g ,   "   " ] ) , 
 
 	 
 
 	 s t r i p C o m m e n t s :   b i n d ( r e p l a c e ,   T r u e ,   [ / < ! [   \ r \ n \ t ] * ( - - ( [ ^ \ - ] | [ \ r \ n ] | - [ ^ \ - ] ) * - - [   \ r \ n \ t ] * ) > / g ,   " " ] ) 
 
 	 / * j s l i n t   s k i p L i n e s E n d * / 
 
 } ) ; 
 
 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! - 
 
   *   j Q u e r y . f n . n o d e s C o n t a i n i n g T e x t   a d a p t e r   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 ; ( f u n c t i o n ( $ ) { 
 
 
 
 v a r   T r u e   =   t r u e , 
 
 	 i s I n p u t   =   { t e x t : T r u e ,   b u t t o n : T r u e ,   s u b m i t : T r u e } , 
 
 	 d o n t C o p y E v e n t s   =   { S C R I P T : T r u e ,   N O S C R I P T : T r u e ,   S T Y L E : T r u e ,   O B J E C T : T r u e ,   I F R A M E : T r u e } , 
 
 	 $ f l y   =   $ ( [ ] ) ; 
 
 
 
 $ f l y . l e n g t h   =   1 ; 
 
 
 
 f u n c t i o n   g e t D o c ( n o d e ) { 
 
         w h i l e   ( n o d e   & &   n o d e . n o d e T y p e   ! =   9 ) 
 
         	 n o d e   =   n o d e . p a r e n t N o d e ; 
 
         r e t u r n   n o d e ; 
 
 } 
 
 
 
 f u n c t i o n   t o g g l e D i r ( e ,   d i r ) { 
 
 	 v a r   a l i g n   =   e . c s s ( " t e x t - a l i g n " ) ; 
 
 	 e . c s s ( " d i r e c t i o n " ,   d i r ) ; 
 
 	 i f ( a l i g n   = = =   " r i g h t " )   e . c s s ( " t e x t - a l i g n " ,   " l e f t " ) ; 
 
 	 i f ( a l i g n   = = =   " l e f t " )   e . c s s ( " t e x t - a l i g n " ,   " r i g h t " ) ; 
 
 } 
 
 
 
 f u n c t i o n   g e t T y p e ( e l ,   o ) { 
 
 	 v a r   n o d e N a m e   =   e l . n o d e N a m e . t o U p p e r C a s e ( ) , 
 
 	 	 t y p e   =   n o d e N a m e   = = =   ' I N P U T '   & &   $ . a t t r ( e l ,   ' t y p e ' ) . t o L o w e r C a s e ( ) ; 
 
 	 o   =   o   | |   { a l t A n d V a l : T r u e ,   s u b j e c t : T r u e } ; 
 
 	 r e t u r n   t y p e o f   o . s u b j e c t   = = =   " s t r i n g "   ?   o . s u b j e c t   : 
 
 	 	 o . a l t A n d V a l   & &   ( n o d e N a m e   = = =   ' I M G '   | |   t y p e   = = =   " i m a g e "   )     ?   " a l t "   : 
 
 	 	 o . a l t A n d V a l   & &   i s I n p u t [   t y p e   ]   ?   " $ v a l "   : 
 
 	 	 n o d e N a m e   = = =   " T E X T A R E A "   ?   " $ v a l "   :   " $ h t m l " ; 
 
 } 
 
 
 
 $ . t r a n s l a t e . f n . _ t o g g l e   =   f u n c t i o n ( ) { 
 
 	 v a r   o   =   t h i s . o p t i o n s ,   t o   =   o . t o ,   s t o p ; 
 
 	 
 
 	 t h i s . e l e m e n t s . e a c h ( $ . t r a n s l a t e . _ b i n d ( f u n c t i o n ( i ,   e l ) { 
 
 	 	 t h i s . i   =   i ; 
 
 	 	 v a r   e   =   $ ( e l ) ,   t r   =   $ . t r a n s l a t e . g e t D a t a ( e ,   t o ,   o ) ; 
 
 	 	 
 
 	 	 i f ( ! t r )   r e t u r n   ! ( s t o p   =   T r u e ) ; 
 
 	 	 
 
 	 	 t h i s . t r a n s l a t i o n . p u s h ( t r ) ; 
 
 
 
 	 	 o . e a c h . c a l l ( t h i s ,   i ,   e l ,   t r ,   t h i s . s o u r c e [ i ] ,   t h i s . f r o m ,   t o ,   o ) ; 
 
 	 	 / / ' f r o m '   w i l l   b e   u n d e f i n e d   i f   i t   w a s n ' t   s e t 
 
 	 } ,   t h i s ) ) ; 
 
 	 
 
 	 ! s t o p   ?   t h i s . _ c o m p l e t e ( )   :   t h i s . _ p r o c e s s ( ) ; 
 
 	 / / o . c o m p l e t e . c a l l ( t h i s ,   o . n o d e s ,   t h i s . t r a n s l a t i o n ,   t h i s . s o u r c e ,   t h i s . f r o m ,   t h i s . t o ,   o ) 
 
 } ; 
 
 
 
 
 
 
 
 $ . t r a n s l a t e . e x t e n d ( { 
 
 	 _ g e t T y p e :   g e t T y p e , 
 
 	 
 
 	 e a c h :   f u n c t i o n ( i ,   e l ,   t ,   s ,   f r o m ,   t o ,   o ) { 
 
 	 	 $ f l y [ 0 ]   =   e l ; 
 
 	 	 $ . t r a n s l a t e . s e t D a t a ( $ f l y ,   t o ,   t ,   f r o m ,   s ,   o ) ; 
 
 	 	 $ . t r a n s l a t e . r e p l a c e ( $ f l y ,   t ,   t o ,   o ) ; 
 
 	 	 $ . t r a n s l a t e . s e t L a n g A t t r ( $ f l y ,   t o ,   o ) ; 
 
 	 } , 
 
 	 
 
 	 g e t D a t a :   f u n c t i o n ( e ,   l a n g ,   o ) { 
 
 	 	 v a r   e l   =   e [ 0 ]   | |   e ,   d a t a   =   $ . d a t a ( e l ,   " t r a n s l a t i o n " ) ; 
 
 	 	 r e t u r n   d a t a   & &   d a t a [ l a n g ]   & &   d a t a [ l a n g ] [   g e t T y p e ( e l ,   o )   ] ; 
 
 	 } , 
 
 	 
 
 	 s e t D a t a :   f u n c t i o n ( e ,   t o ,   t ,   f r o m ,   s ,   o ) { 
 
 	 	 i f ( o   & &   ! o . d a t a )   r e t u r n ; 
 
 	 	 
 
 	 	 v a r   e l   =   e [ 0 ]   | |   e , 
 
 	 	 	 t y p e   =   g e t T y p e ( e l ,   o ) , 
 
 	 	 	 d a t a   =   $ . d a t a ( e l ,   " t r a n s l a t i o n " ) ; 
 
 	 	 
 
 	 	 d a t a   =   d a t a   | |   $ . d a t a ( e l ,   " t r a n s l a t i o n " ,   { } ) ; 
 
 	 	 ( d a t a [ f r o m ]   =   d a t a [ f r o m ]   | |   { } ) [ t y p e ]   =   s ; 
 
 	 	 ( d a t a [ t o ]   =   d a t a [ t o ]   | |   { } ) [ t y p e ]   =   t ; 
 
 	 } , 
 
 	 
 
 	 
 
 	 r e p l a c e :   f u n c t i o n ( e ,   t ,   t o ,   o ) { 
 
 	 	 
 
 	 	 i f ( o   & &   ! o . r e p l a c e )   r e t u r n ; 
 
 	 	 
 
 	 	 i f ( o   & &   t y p e o f   o . s u b j e c t   = = =   " s t r i n g " ) 
 
 	 	 	 r e t u r n   e . a t t r ( o . s u b j e c t ,   t ) ; 
 
 
 
 	 	 v a r   e l   =   e [ 0 ]   | |   e ,   
 
 	 	 	 n o d e N a m e   =   e l . n o d e N a m e . t o U p p e r C a s e ( ) , 
 
 	 	 	 t y p e   =   n o d e N a m e   = = =   ' I N P U T '   & &   $ . a t t r ( e l ,   ' t y p e ' ) . t o L o w e r C a s e ( ) , 
 
 	 	 	 i s R t l   =   $ . t r a n s l a t e . i s R t l , 
 
 	 	 	 l a n g   =   $ . d a t a ( e l ,   " l a n g " ) ; 
 
 	 	 
 
 	 	 / / h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / i s s u e s / d e t a i l ? i d = 3 8 
 
 	 	 i f ( ! o . a l w a y s R e p l a c e ) 
 
 	 	 	 i f (   l a n g   = = =   t o   ) 
 
 	 	 	 	 r e t u r n ; 
 
 	 	 
 
 	 	 i f (   i s R t l [   t o   ]   ! = =   i s R t l [   l a n g   | |   o   & &   o . f r o m   ]   ) { 
 
 	 	 	 i f (   i s R t l [   t o   ]   ) 
 
 	 	 	 	 t o g g l e D i r ( e ,   " r t l " ) ; 
 
 	 	 	 e l s e   i f (   e . c s s ( " d i r e c t i o n " )   = = =   " r t l "   ) 
 
 	 	 	 	 t o g g l e D i r ( e ,   " l t r " ) ; 
 
 	 	 } 
 
 	 	 
 
 	 	 i f (   ( ! o   | |   o . a l t A n d V a l )   & &   ( n o d e N a m e   = = =   ' I M G '   | |   t y p e   = = =   " i m a g e "   )   ) 
 
 	 	 	 e . a t t r ( " a l t " ,   t ) ; 
 
 	 	 e l s e   i f (   n o d e N a m e   = = =   " T E X T A R E A "   | |   ( ! o   | |   o . a l t A n d V a l )   & &   i s I n p u t [   t y p e   ]   ) 
 
 	 	 	 e . v a l ( t ) ; 
 
 	 	 e l s e { 
 
 	 	 	 i f ( ! o   | |   o . r e b i n d ) { 
 
 	 	 	 	 t h i s . d o c   =   t h i s . d o c   | |   g e t D o c ( e l ) ; 
 
 	 	 	 	 v a r   o r i g C o n t e n t s   =   e . f i n d ( " * " ) . n o t ( " s c r i p t " ) , 
 
 	 	 	 	 	 n e w E l e m   =   $ ( t h i s . d o c . c r e a t e E l e m e n t ( " d i v " ) ) . h t m l ( t ) ; 
 
 	 	 	 	 $ . t r a n s l a t e . c o p y E v e n t s (   o r i g C o n t e n t s ,   n e w E l e m . f i n d ( " * " )   ) ; 
 
 	 	 	 	 e . h t m l (   n e w E l e m . c o n t e n t s ( )   ) ; 
 
 	 	 	 } e l s e 
 
 	 	 	 	 e . h t m l ( t ) ; 
 
 	 	 } 
 
 	 	 
 
 	 	 / / u s e d   f o r   d e t e r m i n i n g   i f   t h e   t e x t - a l i g n   p r o p e r t y   s h o u l d   b e   c h a n g e d , 
 
 	 	 / / i t ' s   m u c h   f a s t e r   t h a n   s e t t i n g   t h e   " l a n g "   a t t r i b u t e ,   s e e   b u g   # 1 3 
 
 	 	 $ . d a t a ( e l ,   " l a n g " ,   t o ) ; 
 
 	 } , 
 
 	 
 
 	 s e t L a n g A t t r :   f u n c t i o n ( e ,   t o ,   o ) { 	 
 
 	 	 i f ( ! o   | |   o . s e t L a n g A t t r ) 
 
 	 	 	 e . a t t r ( ( ! o   | |   o . s e t L a n g A t t r   = = =   T r u e )   ?   " l a n g "   :   o . s e t L a n g A t t r ,   t o ) ; 
 
 	 } , 
 
 	 
 
 	 c o p y E v e n t s :   f u n c t i o n ( f r o m ,   t o ) { 
 
 	 	 t o . e a c h ( f u n c t i o n ( i ,   t o _ i ) { 
 
 	 	 	 v a r   f r o m _ i   =   f r o m [ i ] ; 
 
 	 	 	 i f (   ! t o _ i   | |   ! f r o m _ i   )   / / i n   s o m e   r a r e   c a s e s   t h e   t r a n s l a t e d   h t m l   s t r u c t u r e   c a n   b e   s l i g h t l y   d i f f e r e n t 
 
 	 	 	 	 r e t u r n   f a l s e ; 
 
 	 	 	 i f (   d o n t C o p y E v e n t s [   f r o m _ i . n o d e N a m e . t o U p p e r C a s e ( )   ] ) 
 
 	 	 	 	 r e t u r n   T r u e ; 
 
 	 	 	 v a r   e v e n t s   =   $ . d a t a ( f r o m _ i ,   " e v e n t s " ) ; 
 
 	 	 	 i f ( ! e v e n t s ) 
 
 	 	 	 	 r e t u r n   T r u e ; 
 
 	 	 	 f o r ( v a r   t y p e   i n   e v e n t s ) 
 
 	 	 	 	 f o r ( v a r   h a n d l e r   i n   e v e n t s [ t y p e ] ) 
 
 	 	 	 	 	 $ . e v e n t . a d d ( t o _ i ,   t y p e ,   e v e n t s [ t y p e ] [ h a n d l e r ] ,   e v e n t s [ t y p e ] [ h a n d l e r ] . d a t a ) ; 
 
 	 	 } ) ; 
 
 	 } 
 
 	 
 
 } ) ; 
 
 
 
 
 
 $ . f n . t r a n s l a t e   =   f u n c t i o n ( a ,   b ,   c ) { 
 
 	 v a r   o   =   $ . t r a n s l a t e . _ g e t O p t ( a r g u m e n t s ,   $ . f n . t r a n s l a t e . d e f a u l t s ) , 
 
 	 	 n c t o   =   $ . e x t e n d (   { } ,   $ . t r a n s l a t e . _ d e f a u l t s ,   $ . f n . t r a n s l a t e . d e f a u l t s ,   o , 
 
 	 	 	 {   c o m p l e t e : f u n c t i o n ( e , t ) { $ . t r a n s l a t e ( f u n c t i o n ( ) { 
 
 	 	 	 	 
 
 	 	 	 	 v a r   f r o m   =   $ . t r a n s l a t e . t o L a n g u a g e C o d e ( o . f r o m ) ; 
 
 
 
 	 	 	 	 i f ( o . f r o m O r i g i n a l ) 
 
 	 	 	 	 	 e . e a c h ( f u n c t i o n ( i ,   e l ) { 
 
 	 	 	 	 	 	 $ f l y [ 0 ]   =   e l ; 
 
 	 	 	 	 	 	 v a r   d a t a   =   $ . t r a n s l a t e . g e t D a t a ( $ f l y ,   f r o m ,   o ) ; 
 
 	 	 	 	 	 	 i f (   ! d a t a   )   r e t u r n   t r u e ; 
 
 	 	 	 	 	 	 t [ i ]   =   d a t a ; 
 
 	 	 	 	 	 } ) ; 
 
 	 	 	 	 
 
 	 	 	 	 
 
 	 	 	 	 v a r   e a c h   =   o . e a c h ; 
 
 	 	 	 	 
 
 	 	 	 	 f u n c t i o n   u n s h i f t A r g s ( m e t h o d ) { 
 
 	 	 	 	 	 r e t u r n   f u n c t i o n ( ) { 
 
 	 	 	 	 	 	 [ ] . u n s h i f t . c a l l ( a r g u m e n t s ,   t h i s . e l e m e n t s ) ; 
 
 	 	 	 	 	 	 m e t h o d . a p p l y ( t h i s ,   a r g u m e n t s ) ; 
 
 	 	 	 	 	 } ; 
 
 	 	 	 	 } 
 
 	 	 	 	 
 
 	 	 	 	 / / T O D O :   s e t   a s   i n s t a n c e   p r o p e r t y 
 
 	 	 	 	 o . n o d e s   =   e ; 
 
 	 	 	 	 o . s t a r t   =   u n s h i f t A r g s ( o . s t a r t ) ; 
 
 	 	 	 	 o . o n T i m e o u t   =   u n s h i f t A r g s ( o . o n T i m e o u t ) ; 
 
 	 	 	 	 o . c o m p l e t e   =   u n s h i f t A r g s ( o . c o m p l e t e ) ; 
 
 	 	 	 	 
 
 	 	 	 	 o . e a c h   =   f u n c t i o n ( i ) { 
 
 	 	 	 	 	 v a r   a r g s   =   a r g u m e n t s ; 
 
 	 	 	 	 	 i f ( a r g u m e n t s . l e n g t h   ! = =   7 )   / / i f   i s n ' t   c a l l e d   f r o m   _ t o g g l e 
 
 	 	 	 	 	 	 [ ] . s p l i c e . c a l l ( a r g s ,   1 ,   0 ,   t h i s . e l e m e n t s [ i ] ) ; 
 
 	 	 	 	 	 t h i s . e a c h . a p p l y ( t h i s ,   a r g s ) ; 
 
 	 	 	 	 	 e a c h . a p p l y ( t h i s ,   a r g s ) ; 
 
 	 	 	 	 } ; 
 
 	 	 	 	 
 
 	 	 	 	 $ . t r a n s l a t e ( t ,   o ) ; 
 
 	 	 	 	 
 
 	 	 	 } ) ; } , 
 
 	 	 	 
 
 	 	 	 e a c h :   f u n c t i o n ( ) { } 
 
 	 	 } ) ; 
 
 
 
 	 i f ( t h i s . n o d e s C o n t a i n i n g T e x t ) 
 
 	 	 r e t u r n   t h i s . n o d e s C o n t a i n i n g T e x t ( n c t o ) ; 
 
 	 
 
 	 / / f a l l b a c k   i f   n o d e s C o n t a i n i n g T e x t   m e t h o d   i s   n o t   p r e s e n t : 
 
 	 o . n o d e s   =   t h i s ; 
 
 	 $ . t r a n s l a t e ( $ . m a p ( t h i s ,   f u n c t i o n ( e ) {   r e t u r n   $ ( e ) . h t m l ( )   | |   $ ( e ) . v a l ( ) ;   } ) ,   o ) ; 
 
 	 r e t u r n   t h i s ; 
 
 } ; 
 
 
 
 $ . f n . t r a n s l a t e . d e f a u l t s   =   $ . e x t e n d ( { } ,   $ . t r a n s l a t e . _ d e f a u l t s ) ; 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! - 
 
   *   T e x t N o d e   T r a n s l a t o r   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 
 
 ; ( f u n c t i o n ( $ ) { 
 
 
 
 
 
 f u n c t i o n   g e t T e x t N o d e s (   r o o t ,   _ f i l t e r   ) { 
 
 
 
 	 v a r   n o d e s   =   [ ] , 
 
 	 	 s k i p   =   { S C R I P T : 1 ,   N O S C R I P T : 1 ,   S T Y L E : 1 ,   I F R A M E : 1 } , 
 
 	 	 n o t T y p e   =   t y p e o f   _ f i l t e r , 
 
 	 	 f i l t e r   =   n o t T y p e   = = =   " s t r i n g "   ?   f u n c t i o n ( n o d e ) {   r e t u r n   ! $ ( n o d e ) . i s ( _ f i l t e r ) ;   }   : 
 
 	 	 	 	   n o t T y p e   = = =   " f u n c t i o n "   ?   _ f i l t e r   :     / / e . g .   f u n c t i o n ( n o d e ) {   r e t u r n   n o d e . n o d e N a m e   ! =   ' A ' ;   } 
 
 	 	 	 	   n u l l ; 
 
 	 
 
 	 f u n c t i o n   r e c u r s e ( _ ,   r o o t ) { 
 
 	 	 v a r   i   =   0 ,   c h i l d r e n   =   r o o t . c h i l d N o d e s ,   l   =   c h i l d r e n . l e n g t h ,   n o d e ; 
 
 	 	 f o r ( ;   i   <   l ;   i + + ) { 
 
 	 	 	 n o d e   =   c h i l d r e n [ i ] ; 
 
 	 	 	 
 
 	 	 	 i f ( n o d e . n o d e T y p e   = =   3   & &   / \ S / . t e s t ( n o d e . n o d e V a l u e ) ) 
 
 	 	 	 	 n o d e s . p u s h ( n o d e ) ; 
 
 	 	 	 e l s e   i f (   n o d e . n o d e T y p e   = =   1   & & 
 
 	 	 	 	 	 ! s k i p [   n o d e . n o d e N a m e . t o U p p e r C a s e ( )   ]   & &   
 
 	 	 	 	 	 ( ! f i l t e r   | |   f i l t e r ( n o d e ) ) ) 
 
 	 	 	 	 r e c u r s e ( n u l l ,   n o d e ) ; 
 
 	 	 } 
 
 	 } 
 
 	 
 
 	 $ . e a c h ( ( r o o t . l e n g t h   & &   ! r o o t . n o d e N a m e )   ?   r o o t   :   [ r o o t ] ,   r e c u r s e ) ; 
 
 
 
 	 r e t u r n   n o d e s ; 
 
 } 
 
 
 
 f u n c t i o n   t o g g l e D i r ( e ,   d i r ) { 
 
 	 v a r   a l i g n   =   e . c s s ( " t e x t - a l i g n " ) ; 
 
 	 e . c s s ( " d i r e c t i o n " ,   d i r ) ; 
 
 	 i f ( a l i g n   = = =   " r i g h t " )   e . c s s ( " t e x t - a l i g n " ,   " l e f t " ) ; 
 
 	 i f ( a l i g n   = = =   " l e f t " )   e . c s s ( " t e x t - a l i g n " ,   " r i g h t " ) ; 
 
 } 
 
 
 
 f u n c t i o n   s e t L a n g A t t r ( e ,   t o ,   o ) { 	 
 
 	 i f ( ! o   | |   o . s e t L a n g A t t r ) 
 
 	 	 $ ( e ) . a t t r ( ( ! o   | |   o . s e t L a n g A t t r   = = =   t r u e )   ?   " l a n g "   :   o . s e t L a n g A t t r ,   t o ) ; 
 
 } 
 
 	 
 
 f u n c t i o n   r e p l a c e ( p a r e n t ,   n o d e ,   t e x t ,   t o ,   o ) { 
 
 	 i f ( ! o . r e p l a c e )   r e t u r n ; 
 
 	 v a r   i s R t l   =   $ . t r a n s l a t e . i s R t l , 
 
 	 	 l a n g   =   $ . d a t a ( p a r e n t ,   " l a n g " ) ; 
 
 	 
 
 	 i f (   i s R t l [   t o   ]   ! = =   i s R t l [   l a n g   | |   o   & &   o . f r o m   ]   ) { 
 
 	 	 v a r   $ p a r e n t   =   $ ( p a r e n t ) ; 
 
 	 	 i f (   i s R t l [   t o   ]   ) 
 
 	 	 	 t o g g l e D i r ( $ p a r e n t ,   " r t l " ) ; 
 
 	 	 e l s e   i f (   $ p a r e n t . c s s ( " d i r e c t i o n " )   = = =   " r t l "   ) 
 
 	 	 	 t o g g l e D i r ( $ p a r e n t ,   " l t r " ) ; 
 
 	 } 
 
 	 
 
 	 $ . d a t a ( p a r e n t ,   " l a n g " ,   t o ) ; 
 
 	 
 
 	 i f ( t e x t   ! =   n o d e . n o d e V a l u e ) { 
 
 	 	 v a r   n e w T e x t N o d e   =   d o c u m e n t . c r e a t e T e x t N o d e ( t e x t ) ; 
 
 	 	 p a r e n t . r e p l a c e C h i l d ( n e w T e x t N o d e ,   n o d e ) ; 
 
 	 	 r e t u r n   n e w T e x t N o d e ; 
 
 	 } 
 
 	 
 
 	 r e t u r n   n o d e ; 
 
 } 
 
 
 
 f u n c t i o n   s e t D a t a ( p a r e n t ,   o ,   s r c ,   t r n s l ) { 
 
 	 i f ( o . d a t a ) { 
 
 	 	 v a r   T R   =   " t r a n s l a t i o n " ; 
 
 	 	 i f ( ! $ . d a t a ( p a r e n t ,   T R ) ) 
 
 	 	 	 $ . d a t a ( p a r e n t ,   T R ,   { } ) ; 
 
 	 	 
 
 	 	 i f ( ! $ . d a t a ( p a r e n t ,   T R ) [ o . f r o m ] ) 
 
 	 	 	 $ . d a t a ( p a r e n t ,   T R ) [ o . f r o m ]   =   [ ] ; 
 
 	 	 [ ] . p u s h . c a l l ( $ . d a t a ( p a r e n t ,   T R ) [ o . f r o m ] ,   s r c ) ; 	 
 
 	 	 
 
 	 	 i f ( ! $ . d a t a ( p a r e n t ,   T R ) [ o . t o ] ) 
 
 	 	 	 $ . d a t a ( p a r e n t ,   T R ) [ o . t o ]   =   [ ] ; 
 
 	 	 [ ] . p u s h . c a l l ( $ . d a t a ( p a r e n t ,   T R ) [ o . t o ] ,   t r n s l ) ; 	 
 
 	 } 
 
 } 
 
 
 
 f u n c t i o n   g e t D a t a ( p a r e n t ,   l a n g ,   t h a t ) { 
 
 	 t h a t . _ c h i l d I n d e x   =   t h a t . _ p r e v P a r e n t   = = =   p a r e n t   ?   t h a t . _ c h i l d I n d e x   +   1   :   0 ; 
 
 	 v a r   t r   =   $ . d a t a ( p a r e n t ,   " t r a n s l a t i o n " ) ; 
 
 	 t h a t . _ p r e v P a r e n t   =   p a r e n t ; 
 
 	 r e t u r n   t r   & &   t r [ l a n g ]   & &   t r [ l a n g ] [ t h a t . _ c h i l d I n d e x ] ; 
 
 	 
 
 } 
 
 
 
 f u n c t i o n   _ e a c h ( i ,   t e x t N o d e ,   t ,   s ,   f r o m ,   t o ,   o ) { 
 
 	 t   =   t . r e p l a c e ( / & l t ; / g ,   ' < ' ) 
 
 	 	 . r e p l a c e ( / & g t ; / g ,   ' > ' ) 
 
 	 	 . r e p l a c e ( / & a m p ; / g ,   ' & ' ) 
 
 	 	 . r e p l a c e ( / & q u o t ; / g ,   ' " ' ) 
 
 	 	 . r e p l a c e ( / & # 3 9 ; | & a p o s ; / g ,   " ' " ) ; 
 
 	 
 
 	 v a r   p a r e n t   =   t e x t N o d e . p a r e n t N o d e ; 
 
 	 s e t D a t a ( p a r e n t ,   o ,   s ,   t ) ; 
 
 	 v a r   n e w T e x t N o d e   =   r e p l a c e ( p a r e n t ,   t e x t N o d e ,   t ,   t o ,   o ) ; 
 
 	 s e t L a n g A t t r ( p a r e n t ,   o . t o ,   o ) ; 
 
 	 
 
 	 r e t u r n   n e w T e x t N o d e ; 
 
 } 
 
 
 
 $ . t r a n s l a t e T e x t N o d e s   =   f u n c t i o n ( r o o t ) {   
 
 	 v a r   a r g s   =   [ ] . s l i c e . c a l l ( a r g u m e n t s , 0 ) ; 
 
 	 a r g s . s h i f t ( ) ; 
 
 	 
 
 $ . t r a n s l a t e ( f u n c t i o n ( ) { 
 
 	 v a r   o   =   $ . t r a n s l a t e . _ g e t O p t ( a r g s ,   $ . t r a n s l a t e T e x t N o d e s . d e f a u l t s ) , 
 
 	 	 e a c h   =   o . e a c h , 
 
 	 	 n o d e s   =   g e t T e x t N o d e s ( r o o t ,   o . n o t ) , 
 
 	 	 c o n t e n t s   =   $ . m a p ( n o d e s ,   f u n c t i o n ( n ) {   r e t u r n   n . n o d e V a l u e ;   } ) , 
 
 	 	 f r o m   =   $ . t r a n s l a t e . t o L a n g u a g e C o d e ( o . f r o m ) , 
 
 	 	 o b j   =   { } ; 
 
 	 
 
 	 o . n o d e s   =   n o d e s ; 
 
 	 o . t e x t N o d e s   =   t r u e ; 
 
 	 o . t r i m   =   f a l s e ; 
 
 
 
 	 i f ( o . f r o m O r i g i n a l ) 
 
 	 	 $ . e a c h ( n o d e s ,   f u n c t i o n ( i ,   t e x t N o d e ) { 
 
 	 	 	 v a r   d a t a   =   g e t D a t a ( t e x t N o d e . p a r e n t N o d e ,   f r o m ,   o b j ) ; 
 
 	 	 	 i f (   ! d a t a   )   r e t u r n   t r u e ; 
 
 	 	 	 c o n t e n t s [ i ]   =   d a t a ; 
 
 	 	 } ) ; 
 
 	 
 
 	 f u n c t i o n   u n s h i f t A r g s ( m e t h o d ) { 
 
 	 	 r e t u r n   f u n c t i o n ( ) { 
 
 	 	 	 [ ] . u n s h i f t . c a l l ( a r g u m e n t s ,   t h i s . e l e m e n t s ) ; 
 
 	 	 	 m e t h o d . a p p l y ( t h i s ,   a r g u m e n t s ) ; 
 
 	 	 } ; 
 
 	 } 
 
 	 
 
 	 o . s t a r t   =   u n s h i f t A r g s ( o . s t a r t ) ; 
 
 	 o . o n T i m e o u t   =   u n s h i f t A r g s ( o . o n T i m e o u t ) ; 
 
 	 o . c o m p l e t e   =   u n s h i f t A r g s ( o . c o m p l e t e ) ; 
 
 	 
 
 	 o . e a c h   =   f u n c t i o n ( i ) { 
 
 	 	 v a r   a r g s   =   a r g u m e n t s ; 
 
 	 	 i f ( a r g u m e n t s . l e n g t h   ! = =   7 )   / / i f   i s n ' t   c a l l e d   f r o m   _ t o g g l e 
 
 	 	 	 [ ] . s p l i c e . c a l l ( a r g s ,   1 ,   0 ,   t h i s . e l e m e n t s [ i ] ) ; 	 	 
 
 	 	 t h i s . e l e m e n t s [ i ]   =   a r g s [ 1 ]   =   _ e a c h . a p p l y ( t h i s ,   a r g s ) ; 
 
 	 	 
 
 	 	 e a c h . a p p l y ( t h i s ,   a r g s ) ; 
 
 	 } ; 
 
 	 
 
 	 $ . t r a n s l a t e ( c o n t e n t s ,   o ) ; 
 
 	 
 
 } ) ; 
 
 } ; 
 
 
 
 $ . t r a n s l a t e . f n . _ t o g g l e T e x t N o d e s   =   f u n c t i o n ( ) { 
 
 	 v a r   o   =   t h i s . o p t i o n s ,   t o   =   o . t o ,   s t o p ; 
 
 	 
 
 	 $ . e a c h ( t h i s . e l e m e n t s ,   $ . t r a n s l a t e . _ b i n d ( f u n c t i o n ( i ,   t e x t N o d e ) { 
 
 	 	 t h i s . i   =   i ; 
 
 	 	 v a r   p a r e n t   =   t e x t N o d e . p a r e n t N o d e ,   
 
 	 	         t r   =   g e t D a t a ( p a r e n t ,   t o ,   t h i s ) ; 
 
 	 	 
 
 	 	 i f ( ! t r )   r e t u r n   ! ( s t o p   =   t r u e ) ; 
 
 	 	 
 
 	 	 t h i s . t r a n s l a t i o n . p u s h ( t r ) ; 
 
 	 	 
 
 	 	 o . e a c h . c a l l ( t h i s ,   i ,   t e x t N o d e ,   t r ,   t h i s . s o u r c e [ i ] ,   t h i s . f r o m ,   t o ,   o ) ; 
 
 	 	 / / ' f r o m '   w i l l   b e   u n d e f i n e d   i f   i t   w a s n ' t   s e t 
 
 	 } ,   t h i s ) ) ; 
 
 	 
 
 	 ! s t o p   ?   t h i s . _ c o m p l e t e ( )   :   t h i s . _ p r o c e s s ( ) ; 
 
 	 / / o . c o m p l e t e . c a l l ( t h i s ,   t h i s . e l e m e n t s ,   t h i s . t r a n s l a t i o n ,   t h i s . s o u r c e ,   t h i s . f r o m ,   t h i s . t o ,   o ) ; 
 
 } ; 
 
 
 
 $ . f n . t r a n s l a t e T e x t N o d e s   =   f u n c t i o n ( a ,   b ,   c ) { 
 
 	 [ ] . u n s h i f t . c a l l ( a r g u m e n t s ,   t h i s ) ; 
 
 	 $ . t r a n s l a t e T e x t N o d e s . a p p l y ( n u l l ,   a r g u m e n t s ) ; 
 
 	 r e t u r n   t h i s ; 
 
 } ; 
 
 
 
 $ . t r a n s l a t e T e x t N o d e s . d e f a u l t s   =   $ . f n . t r a n s l a t e T e x t N o d e s . d e f a u l t s   =   $ . e x t e n d ( { } ,   $ . t r a n s l a t e . _ d e f a u l t s ) ; 
 
 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! - 
 
   *   S i m p l e   u s e r   i n t e r f a c e   e x t e n s i o n   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 ; ( f u n c t i o n ( $ ) { 
 
 
 
 v a r   d e f a u l t s   =   { 
 
 	 t a g s :   [ " s e l e c t " ,   " o p t i o n " ] , 
 
 	 f i l t e r :   $ . t r a n s l a t e . i s T r a n s l a t a b l e , 
 
 	 l a b e l :   $ . t r a n s l a t e . t o N a t i v e L a n g u a g e   | |   
 
 	 	 f u n c t i o n ( l a n g C o d e ,   l a n g ) { 
 
 	 	 	 r e t u r n   $ . t r a n s l a t e . c a p i t a l i z e ( l a n g ) ; 
 
 	 	 } , 
 
 	 i n c l u d e U n k n o w n :   f a l s e 
 
 } ; 
 
 
 
 $ . t r a n s l a t e . u i   =   f u n c t i o n ( ) { 
 
 	 v a r   o   =   { } ,   s t r = ' ' ,   c s = ' ' ,   c l = ' ' ; 
 
 	 
 
 	 i f ( t y p e o f   a r g u m e n t s [ 0 ]   = = =   " s t r i n g " ) 
 
 	 	 o . t a g s   =   $ . m a k e A r r a y ( a r g u m e n t s ) ; 
 
 	 e l s e   o   =   a r g u m e n t s [ 0 ] ; 
 
 	 
 
 	 o   =   $ . e x t e n d ( { } ,   d e f a u l t s ,   $ . t r a n s l a t e . u i . d e f a u l t s ,   o ) ; 
 
 	 	 
 
 	 i f ( o . t a g s [ 2 ] ) { 
 
 	 	 c s   =   ' < '   +   o . t a g s [ 2 ]   +   ' > ' ; 
 
 	 	 c l   =   ' < / '   +   o . t a g s [ 2 ]   +   ' > ' ; 
 
 	 } 
 
 	 
 
 	 v a r   l a n g u a g e s   =   $ . t r a n s l a t e . g e t L a n g u a g e s ( o . f i l t e r ) ; 
 
 	 i f ( ! o . i n c l u d e U n k n o w n )   d e l e t e   l a n g u a g e s . U N K N O W N ; 
 
 	 
 
 	 $ . e a c h (   l a n g u a g e s ,   f u n c t i o n ( l ,   l c ) { 
 
 	 	 s t r   + =   ( ' < '   +   o . t a g s [ 1 ]   +   "   v a l u e = "   +   l c   +   ' > '   +   c s   + 
 
 	 	 	 / / $ . t r a n s l a t e . c a p i t a l i z e ( l )   +   "   -   "   +   
 
 	 	 	 o . l a b e l ( l c ,   l )   + 
 
 	 	 	 c l   +   ' < / '   +   o . t a g s [ 1 ]   +   ' > ' ) ; 
 
 	 } ) ; 
 
 
 
 	 r e t u r n   $ ( ' < '   +   o . t a g s [ 0 ]   +   '   c l a s s = " j q - t r a n s l a t e - u i " > '   +   s t r   +   ' < / '   +   o . t a g s [ 0 ]   +   ' > ' ) ; 
 
 
 
 } ; 
 
 
 
 $ . t r a n s l a t e . u i . d e f a u l t s   =   $ . e x t e n d ( { } ,   d e f a u l t s ) ; 
 
 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! - 
 
   *   P r o g r e s s   i n d i c a t o r   e x t e n s i o n   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 
 
 ; j Q u e r y . t r a n s l a t e . f n . p r o g r e s s   =   f u n c t i o n ( s e l e c t o r ,   o p t i o n s ) { 
 
 	 i f ( ! t h i s . i )   t h i s . _ p r   =   0 ; 
 
 	 t h i s . _ p r   + =   t h i s . s o u r c e [ t h i s . i ] . l e n g t h ; 
 
 	 v a r   p r o g r e s s   =   1 0 0   *   t h i s . _ p r   /   (   t h i s . r a w S o u r c e . l e n g t h   -   (   1 1   *   ( t h i s . i   +   1 )   )   ) ; 
 
 
 
 	 i f ( s e l e c t o r ) { 
 
 	 	 v a r   e   =   j Q u e r y ( s e l e c t o r ) ; 
 
 	 	 i f (   ! t h i s . i   & &   ! e . h a s C l a s s ( " u i - p r o g r e s s b a r " )   ) 
 
 	 	 	 e . p r o g r e s s b a r ( o p t i o n s ) ; 
 
 	 	 e . p r o g r e s s b a r (   " o p t i o n " ,   " v a l u e " ,   p r o g r e s s   ) ; 
 
 	 } 
 
 	 
 
 	 r e t u r n   p r o g r e s s ; 
 
 } ; 
 
 
 
 / * ! - 
 
   *   N a t i v e   l a n g u a g e   n a m e s   e x t e n s i o n   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 ; ( f u n c t i o n ( $ ) { 
 
 $ . t r a n s l a t e . e x t e n d ( { 
 
 
 
 	 t o N a t i v e L a n g u a g e :   f u n c t i o n ( l a n g ) {   
 
 	 	 r e t u r n   $ . t r a n s l a t e . n a t i v e L a n g u a g e s [   l a n g   ]   | |   
 
 	 	 	 $ . t r a n s l a t e . n a t i v e L a n g u a g e s [   $ . t r a n s l a t e . t o L a n g u a g e C o d e ( l a n g )   ] ; 
 
 	 } , 
 
 	 
 
 	 n a t i v e L a n g u a g e s :   { 
 
 	 	 " a f " : " A f r i k a a n s " , 
 
 	 	 " b e " : " 5;0@CA:0O" , 
 
 	 	 " i s " : " Í s l e n s k a " , 
 
 	 	 " g a " : " G a e i l g e " , 
 
 	 	 " m k " : " 0:54>=A:8" , 
 
 	 	 " m s " : " B a h a s a   M e l a y u " , 
 
 	 	 " s w " : " K i s w a h i l i " , 
 
 	 	 " c y " : " C y m r a e g " , 
 
 	 	 " y i " : " ÙÙ´ÓÙé" , 
 
 	 	 
 
 	 	 " s q " : " S h q i p e " , 
 
 	 	 " a r " : " 'D91(J)" , 
 
 	 	 " b g " : " J;30@A:8" , 
 
 	 	 " c a " : " C a t a l à " , 
 
 	 	 " z h " : " -N‡e" , 
 
 	 	 " z h - C N " : " €{SO-N‡e" , 
 
 	 	 " z h - T W " : " A~Ôš-N‡e" , 
 
 	 	 " h r " : " H r v a t s k i " , 
 
 	 	 " c s " : " e at i n a " , 
 
 	 	 " d a " : " D a n s k " , 
 
 	 	 " n l " : " N e d e r l a n d s " , 
 
 	 	 " e n " : " E n g l i s h " , 
 
 	 	 " e t " : " E e s t i " , 
 
 	 	 " t l " : " T a g a l o g " , 
 
 	 	 " f i " : " S u o m i " , 
 
 	 	 " f r " : " F r a n ç a i s " , 
 
 	 	 " g l " : " G a l e g o " , 
 
 	 	 " d e " : " D e u t s c h " , 
 
 	 	 " e l " : " •»»·½¹º¬" , 
 
 	 	 " i w " : " âÑèÙê" , 
 
 	 	 " h i " : " 9	?	(	M	&	@	" , 
 
 	 	 " h u " : " M a g y a r " , 
 
 	 	 " i d " : " B a h a s a   I n d o n e s i a " , 
 
 	 	 " i t " : " I t a l i a n o " , 
 
 	 	 " j a " : " åe,gžŠ" , 
 
 	 	 " k o " : " \Õm­´Å" , 
 
 	 	 " l v " : " L a t v i e au " , 
 
 	 	 " l t " : " L i e t u v i s" , 
 
 	 	 " m t " : " M a l t i " , 
 
 	 	 " n o " : " N o r s k " , 
 
 	 	 " f a " : " A'13Ì" , 
 
 	 	 " p l " : " P o l s k i " , 
 
 	 	 " p t - P T " : " P o r t u g u ê s " , 
 
 	 	 " r o " : " R o m â n " , 
 
 	 	 " r u " : "  CAA:89" , 
 
 	 	 " s r " : " !@?A:8" , 
 
 	 	 " s k " : " S l o v e n s k ý " , 
 
 	 	 " s l " : " S l o v e n s k i " , 
 
 	 	 " e s " : " E s p a ñ o l " , 
 
 	 	 " s v " : " S v e n s k a " , 
 
 	 	 " t h " : " D"" , 
 
 	 	 " t r " : " T ü r k ç e " , 
 
 	 	 " u k " : " #:@0W=AL:0" , 
 
 	 	 " v i " : " T i ¿n g   V i Çt " 
 
 	 } 
 
 
 
 } ) ; 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
 
 / * ! - 
 
   *   P a r a l e l l   e x t e n s i o n   f o r   t h e   j Q u e r y   T r a n s l a t e   p l u g i n   
 
   *   V e r s i o n :   1 . 4 . 7 
 
   *   h t t p : / / c o d e . g o o g l e . c o m / p / j q u e r y - t r a n s l a t e / 
 
   * / 
 
 
 
 ; ( f u n c t i o n ( $ ) { 
 
 $ . t r a n s l a t e . e x t e n d ( { 
 
 	 d e f e r :   f u n c t i o n ( ) { 
 
 	 	 r e t u r n   $ . t r a n s l a t e . _ b i n d ( $ . t r a n s l a t e ,   n u l l ,   a r g u m e n t s ) ; 
 
 	 } , 
 
 	 
 
 	 r u n :   f u n c t i o n ( a r r a y ,   f i n i s h e d ) { 
 
 	 	 v a r   c o u n t   =   a r r a y . l e n g t h ; 
 
 	 	 $ . e a c h ( a r r a y ,   f u n c t i o n ( ) { 
 
 	 	 	 v a r   i n s t   =   t h i s ( ) , 
 
 	 	 	 	 c o m p l e t e   =   i n s t . o p t i o n s . c o m p l e t e ; 
 
 	 	 	 i n s t . o p t i o n s . c o m p l e t e   =   f u n c t i o n ( ) { 
 
 	 	 	 	 c o m p l e t e . a p p l y ( t h i s ,   a r g u m e n t s ) ; 
 
 	 	 	 	 i f ( ! - - c o u n t )   f i n i s h e d ( ) ; 
 
 	 	 	 } ; 
 
 	 	 } ) ; 
 
 	 } 
 
 } ) ; 
 
 
 
 } ) ( j Q u e r y ) ; 
 
 
