Loco Translate - Version 1.2

Version Description

  • Added settings screen with gettext config
  • Fixed msgfmt hanging bug
Download this release

Release Info

Developer timwhitlock
Plugin Icon 128x128 Loco Translate
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.3 to 1.2

languages/loco-translate-nl_BE.mo CHANGED
Binary file
languages/loco-translate-nl_BE.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: Loco Translate 1.1.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
6
- "PO-Revision-Date: Sat Aug 31 2013 15:15:20 GMT+0100 (BST)\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "Language: Dutch (Belgium)\n"
@@ -29,6 +29,9 @@ msgctxt "Message label"
29
  msgid "OK"
30
  msgstr "OK"
31
 
 
 
 
32
  msgid "New PO file"
33
  msgstr "Nieuw PO-bestand"
34
 
@@ -95,6 +98,9 @@ msgstr "%s onvertaald"
95
  msgid "Loco, Translation Management"
96
  msgstr "Loco, vertalingsbeheer"
97
 
 
 
 
98
  msgid "Manage Translations"
99
  msgstr "Beheer vertalingen"
100
 
@@ -173,6 +179,15 @@ msgstr "Ondersteund door"
173
  msgid "Packages"
174
  msgstr "Pakketten"
175
 
 
 
 
 
 
 
 
 
 
176
  msgid "Template file"
177
  msgstr "Sjabloonbestand"
178
 
3
  "Project-Id-Version: Loco Translate 1.1.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
6
+ "PO-Revision-Date: Mon Oct 28 2013 18:08:03 GMT+0000 (GMT)\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "Language: Dutch (Belgium)\n"
29
  msgid "OK"
30
  msgstr "OK"
31
 
32
+ msgid "Settings saved"
33
+ msgstr ""
34
+
35
  msgid "New PO file"
36
  msgstr "Nieuw PO-bestand"
37
 
98
  msgid "Loco, Translation Management"
99
  msgstr "Loco, vertalingsbeheer"
100
 
101
+ msgid "Translation"
102
+ msgstr ""
103
+
104
  msgid "Manage Translations"
105
  msgstr "Beheer vertalingen"
106
 
179
  msgid "Packages"
180
  msgstr "Pakketten"
181
 
182
+ msgid "Settings"
183
+ msgstr ""
184
+
185
+ msgid "Path to msgfmt program for compiling MO files"
186
+ msgstr ""
187
+
188
+ msgid "Save settings"
189
+ msgstr ""
190
+
191
  msgid "Template file"
192
  msgstr "Sjabloonbestand"
193
 
languages/loco-translate-nl_NL.mo CHANGED
Binary file
languages/loco-translate-nl_NL.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: Loco Translate 1.1.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
6
- "PO-Revision-Date: Sat Aug 31 2013 15:04:18 GMT+0100 (BST)\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "Language: Dutch\n"
@@ -29,6 +29,9 @@ msgctxt "Message label"
29
  msgid "OK"
30
  msgstr "OK"
31
 
 
 
 
32
  msgid "New PO file"
33
  msgstr "Nieuw PO-bestand"
34
 
@@ -95,6 +98,9 @@ msgstr "%s onvertaald"
95
  msgid "Loco, Translation Management"
96
  msgstr "Loco, vertalingsbeheer"
97
 
 
 
 
98
  msgid "Manage Translations"
99
  msgstr "Beheer vertalingen"
100
 
@@ -173,6 +179,15 @@ msgstr "Ondersteund door"
173
  msgid "Packages"
174
  msgstr "Pakketten"
175
 
 
 
 
 
 
 
 
 
 
176
  msgid "Template file"
177
  msgstr "Sjabloonbestand"
178
 
3
  "Project-Id-Version: Loco Translate 1.1.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
6
+ "PO-Revision-Date: Mon Oct 28 2013 18:08:26 GMT+0000 (GMT)\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "Language: Dutch\n"
29
  msgid "OK"
30
  msgstr "OK"
31
 
32
+ msgid "Settings saved"
33
+ msgstr ""
34
+
35
  msgid "New PO file"
36
  msgstr "Nieuw PO-bestand"
37
 
98
  msgid "Loco, Translation Management"
99
  msgstr "Loco, vertalingsbeheer"
100
 
101
+ msgid "Translation"
102
+ msgstr ""
103
+
104
  msgid "Manage Translations"
105
  msgstr "Beheer vertalingen"
106
 
179
  msgid "Packages"
180
  msgstr "Pakketten"
181
 
182
+ msgid "Settings"
183
+ msgstr ""
184
+
185
+ msgid "Path to msgfmt program for compiling MO files"
186
+ msgstr ""
187
+
188
+ msgid "Save settings"
189
+ msgstr ""
190
+
191
  msgid "Template file"
192
  msgstr "Sjabloonbestand"
193
 
languages/loco-translate.pot CHANGED
@@ -5,7 +5,7 @@ msgstr ""
5
  "Project-Id-Version: Loco Translate 1.1.2\n"
6
  "Report-Msgid-Bugs-To: \n"
7
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
8
- "POT-Revision-Date: Sat Aug 31 2013 14:39:04 GMT+0100 (BST)\n"
9
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
  "Last-Translator: \n"
11
  "Language-Team: \n"
@@ -30,6 +30,9 @@ msgctxt "Message label"
30
  msgid "OK"
31
  msgstr ""
32
 
 
 
 
33
  msgid "New PO file"
34
  msgstr ""
35
 
@@ -94,6 +97,9 @@ msgstr ""
94
  msgid "Loco, Translation Management"
95
  msgstr ""
96
 
 
 
 
97
  msgid "Manage Translations"
98
  msgstr ""
99
 
@@ -166,6 +172,15 @@ msgstr ""
166
  msgid "Packages"
167
  msgstr ""
168
 
 
 
 
 
 
 
 
 
 
169
  msgid "Template file"
170
  msgstr ""
171
 
5
  "Project-Id-Version: Loco Translate 1.1.2\n"
6
  "Report-Msgid-Bugs-To: \n"
7
  "POT-Creation-Date: Sat Aug 31 2013 14:15:24 GMT+0100 (BST)\n"
8
+ "POT-Revision-Date: Mon Oct 28 2013 18:07:30 GMT+0000 (GMT)\n"
9
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
  "Last-Translator: \n"
11
  "Language-Team: \n"
30
  msgid "OK"
31
  msgstr ""
32
 
33
+ msgid "Settings saved"
34
+ msgstr ""
35
+
36
  msgid "New PO file"
37
  msgstr ""
38
 
97
  msgid "Loco, Translation Management"
98
  msgstr ""
99
 
100
+ msgid "Translation"
101
+ msgstr ""
102
+
103
  msgid "Manage Translations"
104
  msgstr ""
105
 
172
  msgid "Packages"
173
  msgstr ""
174
 
175
+ msgid "Settings"
176
+ msgstr ""
177
+
178
+ msgid "Path to msgfmt program for compiling MO files"
179
+ msgstr ""
180
+
181
+ msgid "Save settings"
182
+ msgstr ""
183
+
184
  msgid "Template file"
185
  msgstr ""
186
 
lib/build/gettext-compiled.php CHANGED
@@ -2,6 +2,6 @@
2
  /**
3
  * Compiled source code - DO NOT EDIT!
4
  * @author Tim Whitlock http://timwhitlock.info/
5
- * @date Thu, 19 Sep 2013 19:49:11 +0100
6
  */
7
- class LocoArray implements Iterator { private $i; private $length; private $keys; private $vals; private $index; public function __construct( array $data = array() ){ $this->keys = array_keys( $data ); $this->vals = array_values( $data ); $this->index = array_flip( array_map( 'strtolower', $this->keys ) ); $this->length = count( $this->keys ); $this->rewind(); } public function add( $key, $val ){ $k = strtolower($key); if( isset($this->index[$k]) ){ $this->keys[ $this->index[$k] ] = $key; $this->vals[ $this->index[$k] ] = $val; } else { $this->index[$k] = $this->length++; $this->keys[] = $key; $this->vals[] = $val; } return $this; } public function to_array(){ return array_combine( $this->keys, $this->vals ); } public function count(){ return $this->length; } public function trimmed( $prop ){ return trim( $this->__get($prop) ); } public function has( $key ){ return isset( $this->index[ strtolower($key) ] ); } public function __get( $key ){ $key = strtolower( $key ); return isset($this->index[$key]) ? $this->vals[ $this->index[$key] ] : null; } public function rewind(){ $this->i = reset( $this->index ); } public function key(){ return is_int($this->i) ? $this->keys[$this->i] : null; } public function current(){ return is_int($this->i) ? $this->vals[$this->i] : null; } public function valid(){ return is_int($this->i); } public function next(){ $this->i = next( $this->index ); } } function loco_parse_po( $src ){ $i = -1; $key = ''; $entries = array(); $template = array( '#' => array(), 'id' => array(), 'str' => array(), 'ctxt' => array() ); foreach( preg_split('/[\r\n]+/', $src) as $line ){ while( $line = trim($line) ){ $c = $line{0}; if( '"' === $c ){ if( $key && isset($entry) ){ $entry[$key][$idx][] = loco_po_unquote( $line ); } } else if( '#' === $c ){ if( isset($entry['i']) ){ unset( $entry ); $entry = $template; } $f = empty($line{1}) ? ' ' : $line{1}; $entry['#'][$f][] = substr( $line, 1+strlen($f) ); } else if( preg_match('/^msg(id|str|ctxt|id_plural)(?:\[(\d+)\])?[ \t]+/', $line, $r ) ){ $key = $r[1]; $idx = isset($r[2]) ? (int) $r[2] : 0; if( 'str' === $key ){ if( ! isset($entry['i']) ){ $entry['i'] = ++$i; $entries[$i] = &$entry; } } else if( ! isset($entry) || isset($entry['i']) ){ unset( $entry ); $entry = $template; } $line = substr( $line, strlen($r[0]) ); continue; } continue 2; } } unset( $entry ); $assets = array(); foreach( $entries as $i => $entry ){ $asset = array ( 'id' => '', 'source' => implode('',$entry['id'][0]), 'target' => implode('',$entry['str'][0]), ); if( isset($entry['ctxt'][0]) ){ $asset['context'] = implode('',$entry['ctxt'][0]); } if( isset($entry['#'][' ']) ){ $asset['comment'] = implode("\n", $entry['#'][' ']); } if( isset($entry['#'][',']) ){ foreach( $entry['#'][','] as $flag ){ if( $flag = loco_po_parse_flag($flag) ){ $asset['flag'] = $flag; break; } } } $pidx = count($assets); $assets[] = $asset; if( isset($entry['id_plural']) || isset($entry['str'][1]) ){ $idx = 0; $num = max( 2, count($entry['str']) ); while( ++$idx < $num ){ $assets[] = array ( 'id' => '', 'parent' => $pidx, 'plural' => $idx, 'source' => isset($entry['id_plural'][0]) ? implode('',$entry['id_plural'][0]) : '', 'target' => isset($entry['str'][$idx]) ? implode('',$entry['str'][$idx]) : '', ); } } } return $assets; } function loco_po_parse_flag( $text, $flag = 0 ){ static $map; if( ! isset($map) ){ $map = unserialize('a:1:{i:4;s:8:"#, fuzzy";}'); } foreach( explode(',',$text) as $needle ){ if( $needle = trim($needle) ){ foreach( $map as $loco_flag => $haystack ){ if( false !== stripos($haystack, $needle) ){ $flag |= $loco_flag; break; } } } } return $flag; } function loco_po_unquote( $str ){ return substr( stripcslashes($str), 1, -1 ); } function loco_parse_po_headers( $str ){ $headers = new LocoArray( array() ); foreach( explode("\n",$str) as $line ){ $i = strpos($line,':') and $key = trim( substr($line,0,$i) ) and $headers->add( $key, trim( substr($line,++$i) ) ); } return $headers; } define( 'LOCO_FLAG_OK', 0 ); define( 'LOCO_FLAG_ERROR', 1 ); define( 'LOCO_FLAG_REVIEW', 2 ); define( 'LOCO_FLAG_PENDING', 3 ); define( 'LOCO_FLAG_FUZZY', 4 ); function loco_flags(){ static $flags = array ( LOCO_FLAG_OK => 'Translated', LOCO_FLAG_ERROR => 'Incorrect', LOCO_FLAG_REVIEW => 'Needs review', LOCO_FLAG_PENDING => 'Pending sign-off', LOCO_FLAG_FUZZY => 'Fuzzy', ); return $flags; } function loco_flag( $f ){ $flags = loco_flags(); if( ! isset($flags[$f]) ){ throw new Exception('Invalid LOCO_FLAG_ constant ', var_export($f,1) ); } return $flags[$f]; } final class PHPTokens implements Iterator { private $tokens; private $i; private $skip_tokens = array(); private $skip_strings = array(); public function __construct( array $tokens ){ $this->tokens = $tokens; $this->rewind(); } public function ignore(){ foreach( func_get_args() as $t ){ if( is_int($t) ){ $this->skip_tokens[$t] = true; } else { $this->skip_strings[$t] = true; } } return $this; } public function advance(){ $this->next(); return $this->current(); } public function rewind(){ $this->i = false === reset($this->tokens) ? null : key($this->tokens); } public function valid(){ return isset($this->i); } public function key(){ return $this->i; } public function next(){ $this->i = false === next($this->tokens) ? null : key($this->tokens); } public function current(){ while( isset($this->i) ){ $tok = $this->tokens[$this->i]; if( is_array($tok) ){ if( isset($this->skip_tokens[$tok[0]]) ){ $this->next(); } else { return $tok; } } else if( isset($this->skip_strings[$tok]) ){ $this->next(); } else { return $tok; } } return false; } } function loco_parse_comment($comment){ if( '*' === $comment{1} ){ $lines = array(); foreach( explode("\n", $comment) as $line ){ $line and $lines[] = trim($line,"/* \r\t"); } return implode(" ", $lines); } return trim( $comment,"/ \n\r\t" ); } function decapse_string( $s ){ if( empty($s) ){ return ''; } $q = $s{0}; switch( $q ){ case "'": case '"': $s = substr( $s, 1, -1 ); if( '"' === $q ){ return stripcslashes($s); } return str_replace( array( '\\'.$q, '\\\\' ), array( $q, '\\' ), $s ); default: trigger_error( "Bad quote character ($q) at offset 0", E_USER_NOTICE ); return $s; } } function loco_extract_php( array $tokens, $fileref = '' ){ $extractor = new LocoPHPExtractor; return $extractor->extract( $tokens, $fileref ); } final class LocoPHPExtractor { private static $rules = array ( '_' => 's', 'gettext' => 's', 'dgettext' => '_s', 'ngettext' => 'sp', 'dngettext' => '_sp', '__' => 's', '_e' => 's', '_c' => 's', '_n' => 'sp', '_n_noop' => 'sp', '_nc' => 'sp', '__ngettext' => 'sp', '__ngettext_noop' => 'sp', '_x' => 'sc', '_ex' => 'sc', '_nx' => 'sp_c', '_nx_noop' => 'spc', '_n_js' => 'sp', '_nx_js' => 'spc', 'esc_attr__' => 's', 'esc_html__' => 's', 'esc_attr_e' => 's', 'esc_html_e' => 's', 'esc_attr_x' => 'sc', 'esc_html_x' => 'sc', 'comments_number_link' => '_sp', 't' => 's', 'st' => 's', 'trans' => 's', 'transChoice' => 'sp', ); private $exp = array(); private $reg = array(); public function extract( array $tokens, $fileref = '' ){ $tokens = new PHPTokens( $tokens ); $tokens->ignore( T_WHITESPACE ); $comment = ''; foreach( $tokens as $tok ){ if( isset($args) ){ if( ')' === $tok ){ isset($arg) and $arg and $args[] = $arg; $this->push( $rule, $args, $comment, $ref ); unset($args,$arg); $comment = ''; } else if( ',' === $tok ){ isset($arg) and $arg and $args[] = $arg; unset($arg); } else if( isset($arg) ){ $arg[] = $tok; } else { $arg = array( $tok ); } } else if( is_array($tok) ){ list($t,$s) = $tok; if( T_COMMENT === $t || T_DOC_COMMENT === $t ){ $comment = $s; } else if( T_STRING === $t && isset(self::$rules[$s]) && '(' === $tokens->advance() ){ $rule = self::$rules[$s]; $args = array(); $ref = $fileref ? $fileref.':'.$tok[2]: ''; } else if( $comment && false === stripos($comment, 'translators') ){ $comment = ''; } } } return $this->exp; } private function push( $rule, array $args, $comment = '', $ref = '' ){ $s = strpos( $rule, 's'); $p = strpos( $rule, 'p'); $c = strpos( $rule, 'c'); foreach( $args as $i => $tokens ){ if( 1 === count($tokens) && is_array($tokens[0]) && T_CONSTANT_ENCAPSED_STRING === $tokens[0][0] ){ $args[$i] = decapse_string( $tokens[0][1] ); } else { $args[$i] = null; } } $key = $msgid = $args[$s]; if( ! $msgid ){ return null; } $entry = array ( 'id' => '', 'source' => $msgid, 'target' => '', ); if( $c && isset($args[$c]) ){ $entry['context'] = $args[$c]; $key .= "\0". $args[$c]; } if( $ref ){ $entry['refs'] = $ref; } if( $comment ){ $entry['comment'] = loco_parse_comment($comment); } if( isset($this->reg[$key]) ){ $index = $this->reg[$key]; $a = array(); isset($this->exp[$index]['refs']) and $a[] = $this->exp[$index]['refs']; isset($entry['refs']) and $a[] = $entry['refs']; $a && $this->exp[$index]['refs'] = implode(" ", $a ); $a = array(); isset($this->exp[$index]['comment']) and $a[] = $this->exp[$index]['comment']; isset($entry['comment']) and $a[] = $entry['comment']; $a && $this->exp[$index]['comment'] = implode("\n", $a ); } else { $index = count($this->exp); $this->reg[$key] = $index; $this->exp[] = $entry; } if( $p && isset($args[$p]) ){ $msgid_plural = $args[$p]; $entry = array ( 'id' => '', 'source' => $msgid_plural, 'target' => '', 'plural' => 1, 'parent' => $index, ); $key = $msgid_plural."\0\0"; if( isset($this->reg[$key]) ){ $plural_index = $this->reg[$key]; $this->exp[$plural_index] = $entry; } else { $plural_index = count($this->exp); $this->reg[$key] = $plural_index; $this->exp[] = $entry; } } return $index; } public function get_xgettext( $input = '-' ){ $cmd = defined('WHICH_XGETTEXT') ? WHICH_XGETTEXT : 'xgettext'; $cmd.= ' -LPHP -c -o-'; if( $k = $this->get_xgettext_keywords() ){ $cmd.= ' -k'.implode(' -k', $k ); } return $cmd.' '.$input; } public function get_xgettext_keywords(){ $ks = array(); foreach( self::$rules as $word => $rule ){ $s = strpos( $rule, 's'); $k = $word.':'.++$s; if( false !== $p = strpos( $rule, 'p') ){ $k.= ','.++$p; } if( false !== $p = strpos( $rule, 'c') ){ $k.= ','.++$p.'c'; } $ks[] = $k; } return $ks; } } define('WHICH_MSGFMT','/usr/bin/msgfmt'); function loco_compile_mo( $po ){ $descriptorspec = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'), ); $cmd = WHICH_MSGFMT.' -o - -'; $process = proc_open($cmd, $descriptorspec, $pipes ); if( ! $process ){ throw new Exception('Failed to open process to '.$cmd); } fwrite($pipes[0], $po); fclose($pipes[0]); $err = stream_get_contents($pipes[2]); fclose($pipes[2]); $mo = stream_get_contents($pipes[1]); fclose($pipes[1]); $e = proc_close($process); if( 0 !== $e ){ $err and trigger_error( $err, E_USER_WARNING ); throw new Exception('Gettext msgfmt exited with code '.sprintf('%d',$e).'; Got '.strlen($mo).' bytes from '.strlen($po).' bytes'); } return $mo; } function loco_po_stats( array $po ){ $t = $n = $f = $u = 0; foreach( $po as $r ){ if( ! isset($r['source']) || '' === $r['source'] ){ continue; } if( isset($r['parent']) && is_int($r['parent']) ){ continue; } $t++; if( '' === $r['target'] ){ $u++; } else if( isset($r['flag']) && LOCO_FLAG_FUZZY === $r['flag'] ){ $f++; } else { $n++; } } $r = $t && $n ? $n / $t : 0; $p = (string) round( $r * 100 ); return compact('t','p','f','u'); }
2
  /**
3
  * Compiled source code - DO NOT EDIT!
4
  * @author Tim Whitlock http://timwhitlock.info/
5
+ * @date Mon, 28 Oct 2013 16:29:24 +0000
6
  */
7
+ class LocoArray implements Iterator { private $i; private $length; private $keys; private $vals; private $index; public function __construct( array $data = array() ){ $this->keys = array_keys( $data ); $this->vals = array_values( $data ); $this->index = array_flip( array_map( 'strtolower', $this->keys ) ); $this->length = count( $this->keys ); $this->rewind(); } public function add( $key, $val ){ $k = strtolower($key); if( isset($this->index[$k]) ){ $this->keys[ $this->index[$k] ] = $key; $this->vals[ $this->index[$k] ] = $val; } else { $this->index[$k] = $this->length++; $this->keys[] = $key; $this->vals[] = $val; } return $this; } public function to_array(){ return array_combine( $this->keys, $this->vals ); } public function count(){ return $this->length; } public function trimmed( $prop ){ return trim( $this->__get($prop) ); } public function has( $key ){ return isset( $this->index[ strtolower($key) ] ); } public function __get( $key ){ $key = strtolower( $key ); return isset($this->index[$key]) ? $this->vals[ $this->index[$key] ] : null; } public function rewind(){ $this->i = reset( $this->index ); } public function key(){ return is_int($this->i) ? $this->keys[$this->i] : null; } public function current(){ return is_int($this->i) ? $this->vals[$this->i] : null; } public function valid(){ return is_int($this->i); } public function next(){ $this->i = next( $this->index ); } } function loco_parse_po( $src ){ $i = -1; $key = ''; $entries = array(); $template = array( '#' => array(), 'id' => array(), 'str' => array(), 'ctxt' => array() ); foreach( preg_split('/[\r\n]+/', $src) as $line ){ while( $line = trim($line) ){ $c = $line{0}; if( '"' === $c ){ if( $key && isset($entry) ){ $entry[$key][$idx][] = loco_po_unquote( $line ); } } else if( '#' === $c ){ if( isset($entry['i']) ){ unset( $entry ); $entry = $template; } $f = empty($line{1}) ? ' ' : $line{1}; $entry['#'][$f][] = substr( $line, 1+strlen($f) ); } else if( preg_match('/^msg(id|str|ctxt|id_plural)(?:\[(\d+)\])?[ \t]+/', $line, $r ) ){ $key = $r[1]; $idx = isset($r[2]) ? (int) $r[2] : 0; if( 'str' === $key ){ if( ! isset($entry['i']) ){ $entry['i'] = ++$i; $entries[$i] = &$entry; } } else if( ! isset($entry) || isset($entry['i']) ){ unset( $entry ); $entry = $template; } $line = substr( $line, strlen($r[0]) ); continue; } continue 2; } } unset( $entry ); $assets = array(); foreach( $entries as $i => $entry ){ $asset = array ( 'id' => '', 'source' => implode('',$entry['id'][0]), 'target' => implode('',$entry['str'][0]), ); if( isset($entry['ctxt'][0]) ){ $asset['context'] = implode('',$entry['ctxt'][0]); } if( isset($entry['#'][' ']) ){ $asset['comment'] = implode("\n", $entry['#'][' ']); } if( isset($entry['#'][',']) ){ foreach( $entry['#'][','] as $flag ){ if( $flag = loco_po_parse_flag($flag) ){ $asset['flag'] = $flag; break; } } } $pidx = count($assets); $assets[] = $asset; if( isset($entry['id_plural']) || isset($entry['str'][1]) ){ $idx = 0; $num = max( 2, count($entry['str']) ); while( ++$idx < $num ){ $assets[] = array ( 'id' => '', 'parent' => $pidx, 'plural' => $idx, 'source' => isset($entry['id_plural'][0]) ? implode('',$entry['id_plural'][0]) : '', 'target' => isset($entry['str'][$idx]) ? implode('',$entry['str'][$idx]) : '', ); } } } return $assets; } function loco_po_parse_flag( $text, $flag = 0 ){ static $map; if( ! isset($map) ){ $map = unserialize('a:1:{i:4;s:8:"#, fuzzy";}'); } foreach( explode(',',$text) as $needle ){ if( $needle = trim($needle) ){ foreach( $map as $loco_flag => $haystack ){ if( false !== stripos($haystack, $needle) ){ $flag |= $loco_flag; break; } } } } return $flag; } function loco_po_unquote( $str ){ return substr( stripcslashes($str), 1, -1 ); } function loco_parse_po_headers( $str ){ $headers = new LocoArray( array() ); foreach( explode("\n",$str) as $line ){ $i = strpos($line,':') and $key = trim( substr($line,0,$i) ) and $headers->add( $key, trim( substr($line,++$i) ) ); } return $headers; } define( 'LOCO_FLAG_OK', 0 ); define( 'LOCO_FLAG_ERROR', 1 ); define( 'LOCO_FLAG_REVIEW', 2 ); define( 'LOCO_FLAG_PENDING', 3 ); define( 'LOCO_FLAG_FUZZY', 4 ); function loco_flags(){ static $flags = array ( LOCO_FLAG_OK => 'Translated', LOCO_FLAG_ERROR => 'Incorrect', LOCO_FLAG_REVIEW => 'Needs review', LOCO_FLAG_PENDING => 'Pending sign-off', LOCO_FLAG_FUZZY => 'Fuzzy', ); return $flags; } function loco_flag( $f ){ $flags = loco_flags(); if( ! isset($flags[$f]) ){ throw new Exception('Invalid LOCO_FLAG_ constant ', var_export($f,1) ); } return $flags[$f]; } final class PHPTokens implements Iterator { private $tokens; private $i; private $skip_tokens = array(); private $skip_strings = array(); public function __construct( array $tokens ){ $this->tokens = $tokens; $this->rewind(); } public function ignore(){ foreach( func_get_args() as $t ){ if( is_int($t) ){ $this->skip_tokens[$t] = true; } else { $this->skip_strings[$t] = true; } } return $this; } public function advance(){ $this->next(); return $this->current(); } public function rewind(){ $this->i = false === reset($this->tokens) ? null : key($this->tokens); } public function valid(){ return isset($this->i); } public function key(){ return $this->i; } public function next(){ $this->i = false === next($this->tokens) ? null : key($this->tokens); } public function current(){ while( isset($this->i) ){ $tok = $this->tokens[$this->i]; if( is_array($tok) ){ if( isset($this->skip_tokens[$tok[0]]) ){ $this->next(); } else { return $tok; } } else if( isset($this->skip_strings[$tok]) ){ $this->next(); } else { return $tok; } } return false; } } function loco_parse_comment($comment){ if( '*' === $comment{1} ){ $lines = array(); foreach( explode("\n", $comment) as $line ){ $line and $lines[] = trim($line,"/* \r\t"); } return implode(" ", $lines); } return trim( $comment,"/ \n\r\t" ); } function decapse_string( $s ){ if( empty($s) ){ return ''; } $q = $s{0}; switch( $q ){ case "'": case '"': $s = substr( $s, 1, -1 ); if( '"' === $q ){ return stripcslashes($s); } return str_replace( array( '\\'.$q, '\\\\' ), array( $q, '\\' ), $s ); default: trigger_error( "Bad quote character ($q) at offset 0", E_USER_NOTICE ); return $s; } } function loco_extract_php( array $tokens, $fileref = '' ){ $extractor = new LocoPHPExtractor; return $extractor->extract( $tokens, $fileref ); } final class LocoPHPExtractor { private static $rules = array ( '_' => 's', 'gettext' => 's', 'dgettext' => '_s', 'ngettext' => 'sp', 'dngettext' => '_sp', '__' => 's', '_e' => 's', '_c' => 's', '_n' => 'sp', '_n_noop' => 'sp', '_nc' => 'sp', '__ngettext' => 'sp', '__ngettext_noop' => 'sp', '_x' => 'sc', '_ex' => 'sc', '_nx' => 'sp_c', '_nx_noop' => 'spc', '_n_js' => 'sp', '_nx_js' => 'spc', 'esc_attr__' => 's', 'esc_html__' => 's', 'esc_attr_e' => 's', 'esc_html_e' => 's', 'esc_attr_x' => 'sc', 'esc_html_x' => 'sc', 'comments_number_link' => '_sp', 't' => 's', 'st' => 's', 'trans' => 's', 'transChoice' => 'sp', ); private $exp = array(); private $reg = array(); public function extract( array $tokens, $fileref = '' ){ $tokens = new PHPTokens( $tokens ); $tokens->ignore( T_WHITESPACE ); $comment = ''; foreach( $tokens as $tok ){ if( isset($args) ){ if( ')' === $tok ){ isset($arg) and $arg and $args[] = $arg; $this->push( $rule, $args, $comment, $ref ); unset($args,$arg); $comment = ''; } else if( ',' === $tok ){ isset($arg) and $arg and $args[] = $arg; unset($arg); } else if( isset($arg) ){ $arg[] = $tok; } else { $arg = array( $tok ); } } else if( is_array($tok) ){ list($t,$s) = $tok; if( T_COMMENT === $t || T_DOC_COMMENT === $t ){ $comment = $s; } else if( T_STRING === $t && isset(self::$rules[$s]) && '(' === $tokens->advance() ){ $rule = self::$rules[$s]; $args = array(); $ref = $fileref ? $fileref.':'.$tok[2]: ''; } else if( $comment && false === stripos($comment, 'translators') ){ $comment = ''; } } } return $this->exp; } private function push( $rule, array $args, $comment = '', $ref = '' ){ $s = strpos( $rule, 's'); $p = strpos( $rule, 'p'); $c = strpos( $rule, 'c'); foreach( $args as $i => $tokens ){ if( 1 === count($tokens) && is_array($tokens[0]) && T_CONSTANT_ENCAPSED_STRING === $tokens[0][0] ){ $args[$i] = decapse_string( $tokens[0][1] ); } else { $args[$i] = null; } } $key = $msgid = $args[$s]; if( ! $msgid ){ return null; } $entry = array ( 'id' => '', 'source' => $msgid, 'target' => '', ); if( $c && isset($args[$c]) ){ $entry['context'] = $args[$c]; $key .= "\0". $args[$c]; } if( $ref ){ $entry['refs'] = $ref; } if( $comment ){ $entry['comment'] = loco_parse_comment($comment); } if( isset($this->reg[$key]) ){ $index = $this->reg[$key]; $a = array(); isset($this->exp[$index]['refs']) and $a[] = $this->exp[$index]['refs']; isset($entry['refs']) and $a[] = $entry['refs']; $a && $this->exp[$index]['refs'] = implode(" ", $a ); $a = array(); isset($this->exp[$index]['comment']) and $a[] = $this->exp[$index]['comment']; isset($entry['comment']) and $a[] = $entry['comment']; $a && $this->exp[$index]['comment'] = implode("\n", $a ); } else { $index = count($this->exp); $this->reg[$key] = $index; $this->exp[] = $entry; } if( $p && isset($args[$p]) ){ $msgid_plural = $args[$p]; $entry = array ( 'id' => '', 'source' => $msgid_plural, 'target' => '', 'plural' => 1, 'parent' => $index, ); $key = $msgid_plural."\0\0"; if( isset($this->reg[$key]) ){ $plural_index = $this->reg[$key]; $this->exp[$plural_index] = $entry; } else { $plural_index = count($this->exp); $this->reg[$key] = $plural_index; $this->exp[] = $entry; } } return $index; } public function get_xgettext( $input = '-' ){ $cmd = defined('WHICH_XGETTEXT') ? WHICH_XGETTEXT : 'xgettext'; $cmd.= ' -LPHP -c -o-'; if( $k = $this->get_xgettext_keywords() ){ $cmd.= ' -k'.implode(' -k', $k ); } return $cmd.' '.$input; } public function get_xgettext_keywords(){ $ks = array(); foreach( self::$rules as $word => $rule ){ $s = strpos( $rule, 's'); $k = $word.':'.++$s; if( false !== $p = strpos( $rule, 'p') ){ $k.= ','.++$p; } if( false !== $p = strpos( $rule, 'c') ){ $k.= ','.++$p.'c'; } $ks[] = $k; } return $ks; } } function loco_compile_mo( $po ){ $descriptorspec = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'a'), ); $cmd = WHICH_MSGFMT.' -o - -'; $process = proc_open($cmd, $descriptorspec, $pipes ); if( ! $process ){ throw new Exception('Failed to open process to '.$cmd); } fwrite($pipes[0], $po); fclose($pipes[0]); $err = stream_get_contents($pipes[2]); fclose($pipes[2]); $mo = stream_get_contents($pipes[1]); fclose($pipes[1]); $e = proc_close($process); if( 0 !== $e ){ $err and trigger_error( $err, E_USER_WARNING ); throw new Exception('Gettext msgfmt exited with code '.sprintf('%d',$e).'; Got '.strlen($mo).' bytes from '.strlen($po).' bytes'); } return $mo; } function loco_compile_mo_file( $source ){ $descriptorspec = array ( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'a'), ); $dest = $source.'.mo'; $cmd = WHICH_MSGFMT.' -o '.escapeshellarg($dest).' '.escapeshellarg($source); $process = proc_open($cmd, $descriptorspec, $pipes ); if( ! $process ){ throw new Exception('Failed to open process to '.$cmd); } $err = stream_get_contents($pipes[0]); fclose($pipes[0]); $e = proc_close($process); if( 0 !== $e ){ $err and trigger_error( $err, E_USER_WARNING ); throw new Exception('Gettext msgfmt exited with code '.sprintf('%d',$e).';'); } return $dest; } function loco_po_stats( array $po ){ $t = $n = $f = $u = 0; foreach( $po as $r ){ if( ! isset($r['source']) || '' === $r['source'] ){ continue; } if( isset($r['parent']) && is_int($r['parent']) ){ continue; } $t++; if( '' === $r['target'] ){ $u++; } else if( isset($r['flag']) && LOCO_FLAG_FUZZY === $r['flag'] ){ $f++; } else { $n++; } } $r = $t && $n ? $n / $t : 0; $p = (string) round( $r * 100 ); return compact('t','p','f','u'); }
lib/build/locales-compiled.php CHANGED
@@ -2,6 +2,6 @@
2
  /**
3
  * Compiled source code - DO NOT EDIT!
4
  * @author Tim Whitlock http://timwhitlock.info/
5
- * @date Thu, 19 Sep 2013 18:45:49 +0100
6
  */
7
  return unserialize('a:130:{s:5:"af_ZA";s:24:"Afrikaans (South Africa)";s:5:"ar_AE";s:29:"Arabic (United Arab Emirates)";s:5:"ar_IL";s:15:"Arabic (Israel)";s:5:"az_TR";s:20:"Azerbaijani (Turkey)";s:5:"bg_BG";s:9:"Bulgarian";s:5:"bn_BD";s:20:"Bengali (Bangladesh)";s:5:"bs_BA";s:30:"Bosnian (Bosnia & Herzegovina)";s:5:"cs_CZ";s:5:"Czech";s:5:"cy_GB";s:5:"Welsh";s:5:"da_DK";s:6:"Danish";s:5:"de_AT";s:16:"German (Austria)";s:5:"de_CH";s:20:"German (Switzerland)";s:5:"de_DE";s:6:"German";s:5:"el_CY";s:14:"Greek (Cyprus)";s:5:"el_GR";s:5:"Greek";s:5:"en_AE";s:30:"English (United Arab Emirates)";s:5:"en_AU";s:19:"English (Australia)";s:5:"en_CA";s:16:"English (Canada)";s:5:"en_GB";s:12:"English (UK)";s:5:"en_HK";s:19:"English (Hong Kong)";s:5:"en_IE";s:17:"English (Ireland)";s:5:"en_IN";s:15:"English (India)";s:5:"en_NZ";s:21:"English (New Zealand)";s:5:"en_SG";s:19:"English (Singapore)";s:5:"en_US";s:13:"English (USA)";s:5:"en_ZA";s:22:"English (South Africa)";s:5:"es_AR";s:19:"Spanish (Argentina)";s:5:"es_BO";s:17:"Spanish (Bolivia)";s:5:"es_CL";s:15:"Spanish (Chile)";s:5:"es_CO";s:18:"Spanish (Colombia)";s:5:"es_CR";s:20:"Spanish (Costa Rica)";s:5:"es_CU";s:14:"Spanish (Cuba)";s:5:"es_DO";s:28:"Spanish (Dominican Republic)";s:5:"es_EC";s:17:"Spanish (Ecuador)";s:5:"es_ES";s:7:"Spanish";s:5:"es_GT";s:19:"Spanish (Guatemala)";s:5:"es_HN";s:18:"Spanish (Honduras)";s:5:"es_MX";s:16:"Spanish (Mexico)";s:5:"es_NI";s:19:"Spanish (Nicaragua)";s:5:"es_PA";s:16:"Spanish (Panama)";s:5:"es_PE";s:14:"Spanish (Peru)";s:5:"es_PY";s:18:"Spanish (Paraguay)";s:5:"es_SV";s:21:"Spanish (El Salvador)";s:5:"es_UY";s:17:"Spanish (Uruguay)";s:5:"es_VE";s:19:"Spanish (Venezuela)";s:5:"et_EE";s:8:"Estonian";s:5:"fa_AF";s:21:"Persian (Afghanistan)";s:5:"fa_IR";s:14:"Persian (Iran)";s:5:"fi_FI";s:7:"Finnish";s:5:"fo_DK";s:17:"Faroese (Denmark)";s:5:"fo_FO";s:23:"Faroese (Faroe Islands)";s:5:"fr_BE";s:16:"French (Belgium)";s:5:"fr_CA";s:15:"French (Canada)";s:5:"fr_CH";s:20:"French (Switzerland)";s:5:"fr_FR";s:6:"French";s:5:"fr_HT";s:14:"French (Haiti)";s:5:"ga_IE";s:15:"Irish (Ireland)";s:5:"gl_ES";s:16:"Galician (Spain)";s:5:"gn_PY";s:18:"Guarani (Paraguay)";s:5:"he_IL";s:15:"Hebrew (Israel)";s:5:"hi_IN";s:13:"Hindi (India)";s:5:"hr_HR";s:8:"Croatian";s:5:"ht_HT";s:14:"Haitian Creole";s:5:"hu_HU";s:9:"Hungarian";s:5:"hy_AM";s:8:"Armenian";s:5:"id_ID";s:10:"Indonesian";s:5:"is_IS";s:9:"Icelandic";s:5:"it_CH";s:21:"Italian (Switzerland)";s:5:"it_IT";s:7:"Italian";s:5:"ja_JP";s:8:"Japanese";s:5:"jv_ID";s:20:"Javanese (Indonesia)";s:5:"ka_GE";s:8:"Georgian";s:5:"kk_KZ";s:6:"Kazakh";s:5:"kn_IN";s:15:"Kannada (India)";s:5:"ko_KR";s:6:"Korean";s:5:"lb_LU";s:13:"Luxembourgish";s:5:"li_NL";s:24:"Limburgish (Netherlands)";s:5:"lo_LA";s:10:"Lao (Laos)";s:5:"lt_LT";s:10:"Lithuanian";s:5:"lv_LV";s:7:"Latvian";s:5:"mg_MG";s:21:"Malagasy (Madagascar)";s:5:"ms_MY";s:16:"Malay (Malaysia)";s:5:"mt_MT";s:7:"Maltese";s:5:"my_MM";s:17:"Burmese (Myanmar)";s:5:"nb_NO";s:7:"Bokmål";s:5:"ne_NP";s:6:"Nepali";s:5:"nl_BE";s:15:"Dutch (Belgium)";s:5:"nl_NL";s:5:"Dutch";s:5:"nn_NO";s:7:"Nynorsk";s:5:"no_NO";s:9:"Norwegian";s:5:"os_GE";s:18:"Ossetian (Georgia)";s:5:"os_RU";s:17:"Ossetian (Russia)";s:5:"os_TR";s:17:"Ossetian (Turkey)";s:5:"pa_IN";s:15:"Punjabi (India)";s:5:"pl_PL";s:6:"Polish";s:5:"pt_BR";s:19:"Portuguese (Brazil)";s:5:"pt_PT";s:10:"Portuguese";s:5:"ro_RO";s:8:"Romanian";s:5:"ru_RU";s:7:"Russian";s:5:"ru_UA";s:17:"Russian (Ukraine)";s:5:"sa_IN";s:16:"Sanskrit (India)";s:5:"sc_IT";s:17:"Sardinian (Italy)";s:5:"sd_PK";s:17:"Sindhi (Pakistan)";s:5:"si_LK";s:19:"Sinhala (Sri Lanka)";s:5:"sk_SK";s:6:"Slovak";s:5:"sl_SI";s:9:"Slovenian";s:5:"so_SO";s:6:"Somali";s:5:"sq_AL";s:18:"Albanian (Albania)";s:5:"sr_RS";s:7:"Serbian";s:5:"su_ID";s:21:"Sundanese (Indonesia)";s:5:"sv_SE";s:7:"Swedish";s:5:"sw_KE";s:15:"Swahili (Kenya)";s:5:"sw_KM";s:17:"Swahili (Comoros)";s:5:"sw_TZ";s:18:"Swahili (Tanzania)";s:5:"sw_UG";s:16:"Swahili (Uganda)";s:5:"ta_IN";s:13:"Tamil (India)";s:5:"ta_LK";s:17:"Tamil (Sri Lanka)";s:5:"te_IN";s:14:"Telugu (India)";s:5:"tg_TJ";s:18:"Tajik (Tajikistan)";s:5:"th_TW";s:13:"Thai (Taiwan)";s:5:"tr_TR";s:7:"Turkish";s:5:"ug_CN";s:14:"Uyghur (China)";s:5:"uk_UA";s:19:"Ukrainian (Ukraine)";s:5:"ur_IN";s:12:"Urdu (India)";s:5:"ur_PK";s:15:"Urdu (Pakistan)";s:5:"uz_UZ";s:18:"Uzbek (Uzbekistan)";s:5:"vi_VN";s:10:"Vietnamese";s:5:"zh_CN";s:7:"Chinese";s:5:"zh_HK";s:19:"Chinese (Hong Kong)";s:5:"zh_TW";s:16:"Chinese (Taiwan)";}');
2
  /**
3
  * Compiled source code - DO NOT EDIT!
4
  * @author Tim Whitlock http://timwhitlock.info/
5
+ * @date Mon, 28 Oct 2013 16:29:24 +0000
6
  */
7
  return unserialize('a:130:{s:5:"af_ZA";s:24:"Afrikaans (South Africa)";s:5:"ar_AE";s:29:"Arabic (United Arab Emirates)";s:5:"ar_IL";s:15:"Arabic (Israel)";s:5:"az_TR";s:20:"Azerbaijani (Turkey)";s:5:"bg_BG";s:9:"Bulgarian";s:5:"bn_BD";s:20:"Bengali (Bangladesh)";s:5:"bs_BA";s:30:"Bosnian (Bosnia & Herzegovina)";s:5:"cs_CZ";s:5:"Czech";s:5:"cy_GB";s:5:"Welsh";s:5:"da_DK";s:6:"Danish";s:5:"de_AT";s:16:"German (Austria)";s:5:"de_CH";s:20:"German (Switzerland)";s:5:"de_DE";s:6:"German";s:5:"el_CY";s:14:"Greek (Cyprus)";s:5:"el_GR";s:5:"Greek";s:5:"en_AE";s:30:"English (United Arab Emirates)";s:5:"en_AU";s:19:"English (Australia)";s:5:"en_CA";s:16:"English (Canada)";s:5:"en_GB";s:12:"English (UK)";s:5:"en_HK";s:19:"English (Hong Kong)";s:5:"en_IE";s:17:"English (Ireland)";s:5:"en_IN";s:15:"English (India)";s:5:"en_NZ";s:21:"English (New Zealand)";s:5:"en_SG";s:19:"English (Singapore)";s:5:"en_US";s:13:"English (USA)";s:5:"en_ZA";s:22:"English (South Africa)";s:5:"es_AR";s:19:"Spanish (Argentina)";s:5:"es_BO";s:17:"Spanish (Bolivia)";s:5:"es_CL";s:15:"Spanish (Chile)";s:5:"es_CO";s:18:"Spanish (Colombia)";s:5:"es_CR";s:20:"Spanish (Costa Rica)";s:5:"es_CU";s:14:"Spanish (Cuba)";s:5:"es_DO";s:28:"Spanish (Dominican Republic)";s:5:"es_EC";s:17:"Spanish (Ecuador)";s:5:"es_ES";s:7:"Spanish";s:5:"es_GT";s:19:"Spanish (Guatemala)";s:5:"es_HN";s:18:"Spanish (Honduras)";s:5:"es_MX";s:16:"Spanish (Mexico)";s:5:"es_NI";s:19:"Spanish (Nicaragua)";s:5:"es_PA";s:16:"Spanish (Panama)";s:5:"es_PE";s:14:"Spanish (Peru)";s:5:"es_PY";s:18:"Spanish (Paraguay)";s:5:"es_SV";s:21:"Spanish (El Salvador)";s:5:"es_UY";s:17:"Spanish (Uruguay)";s:5:"es_VE";s:19:"Spanish (Venezuela)";s:5:"et_EE";s:8:"Estonian";s:5:"fa_AF";s:21:"Persian (Afghanistan)";s:5:"fa_IR";s:14:"Persian (Iran)";s:5:"fi_FI";s:7:"Finnish";s:5:"fo_DK";s:17:"Faroese (Denmark)";s:5:"fo_FO";s:23:"Faroese (Faroe Islands)";s:5:"fr_BE";s:16:"French (Belgium)";s:5:"fr_CA";s:15:"French (Canada)";s:5:"fr_CH";s:20:"French (Switzerland)";s:5:"fr_FR";s:6:"French";s:5:"fr_HT";s:14:"French (Haiti)";s:5:"ga_IE";s:15:"Irish (Ireland)";s:5:"gl_ES";s:16:"Galician (Spain)";s:5:"gn_PY";s:18:"Guarani (Paraguay)";s:5:"he_IL";s:15:"Hebrew (Israel)";s:5:"hi_IN";s:13:"Hindi (India)";s:5:"hr_HR";s:8:"Croatian";s:5:"ht_HT";s:14:"Haitian Creole";s:5:"hu_HU";s:9:"Hungarian";s:5:"hy_AM";s:8:"Armenian";s:5:"id_ID";s:10:"Indonesian";s:5:"is_IS";s:9:"Icelandic";s:5:"it_CH";s:21:"Italian (Switzerland)";s:5:"it_IT";s:7:"Italian";s:5:"ja_JP";s:8:"Japanese";s:5:"jv_ID";s:20:"Javanese (Indonesia)";s:5:"ka_GE";s:8:"Georgian";s:5:"kk_KZ";s:6:"Kazakh";s:5:"kn_IN";s:15:"Kannada (India)";s:5:"ko_KR";s:6:"Korean";s:5:"lb_LU";s:13:"Luxembourgish";s:5:"li_NL";s:24:"Limburgish (Netherlands)";s:5:"lo_LA";s:10:"Lao (Laos)";s:5:"lt_LT";s:10:"Lithuanian";s:5:"lv_LV";s:7:"Latvian";s:5:"mg_MG";s:21:"Malagasy (Madagascar)";s:5:"ms_MY";s:16:"Malay (Malaysia)";s:5:"mt_MT";s:7:"Maltese";s:5:"my_MM";s:17:"Burmese (Myanmar)";s:5:"nb_NO";s:7:"Bokmål";s:5:"ne_NP";s:6:"Nepali";s:5:"nl_BE";s:15:"Dutch (Belgium)";s:5:"nl_NL";s:5:"Dutch";s:5:"nn_NO";s:7:"Nynorsk";s:5:"no_NO";s:9:"Norwegian";s:5:"os_GE";s:18:"Ossetian (Georgia)";s:5:"os_RU";s:17:"Ossetian (Russia)";s:5:"os_TR";s:17:"Ossetian (Turkey)";s:5:"pa_IN";s:15:"Punjabi (India)";s:5:"pl_PL";s:6:"Polish";s:5:"pt_BR";s:19:"Portuguese (Brazil)";s:5:"pt_PT";s:10:"Portuguese";s:5:"ro_RO";s:8:"Romanian";s:5:"ru_RU";s:7:"Russian";s:5:"ru_UA";s:17:"Russian (Ukraine)";s:5:"sa_IN";s:16:"Sanskrit (India)";s:5:"sc_IT";s:17:"Sardinian (Italy)";s:5:"sd_PK";s:17:"Sindhi (Pakistan)";s:5:"si_LK";s:19:"Sinhala (Sri Lanka)";s:5:"sk_SK";s:6:"Slovak";s:5:"sl_SI";s:9:"Slovenian";s:5:"so_SO";s:6:"Somali";s:5:"sq_AL";s:18:"Albanian (Albania)";s:5:"sr_RS";s:7:"Serbian";s:5:"su_ID";s:21:"Sundanese (Indonesia)";s:5:"sv_SE";s:7:"Swedish";s:5:"sw_KE";s:15:"Swahili (Kenya)";s:5:"sw_KM";s:17:"Swahili (Comoros)";s:5:"sw_TZ";s:18:"Swahili (Tanzania)";s:5:"sw_UG";s:16:"Swahili (Uganda)";s:5:"ta_IN";s:13:"Tamil (India)";s:5:"ta_LK";s:17:"Tamil (Sri Lanka)";s:5:"te_IN";s:14:"Telugu (India)";s:5:"tg_TJ";s:18:"Tajik (Tajikistan)";s:5:"th_TW";s:13:"Thai (Taiwan)";s:5:"tr_TR";s:7:"Turkish";s:5:"ug_CN";s:14:"Uyghur (China)";s:5:"uk_UA";s:19:"Ukrainian (Ukraine)";s:5:"ur_IN";s:12:"Urdu (India)";s:5:"ur_PK";s:15:"Urdu (Pakistan)";s:5:"uz_UZ";s:18:"Uzbek (Uzbekistan)";s:5:"vi_VN";s:10:"Vietnamese";s:5:"zh_CN";s:7:"Chinese";s:5:"zh_HK";s:19:"Chinese (Hong Kong)";s:5:"zh_TW";s:16:"Chinese (Taiwan)";}');
lib/loco-admin.php CHANGED
@@ -35,11 +35,28 @@ abstract class LocoAdmin {
35
  }
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  /**
40
- * Main admin page render call
41
  */
42
- public static function render_page(){
43
  do {
44
  try {
45
 
@@ -765,9 +782,15 @@ function _loco_hook__admin_print_styles(){
765
  * Admin menu registration callback
766
  */
767
  function _loco_hook__admin_menu() {
768
- $page = array( 'LocoAdmin', 'render_page' );
769
- $hook = add_management_page( Loco::__('Loco, Translation Management'), Loco::__('Manage Translations'), LOCO::CAPABILITY, Loco::NS, $page );
 
 
 
 
 
770
  add_action('admin_print_styles', '_loco_hook__admin_print_styles' );
 
771
  }
772
 
773
 
35
  }
36
 
37
 
38
+
39
+ /**
40
+ * Admin settings page render call
41
+ */
42
+ public static function render_page_options(){
43
+ // update applicaion settings if posted
44
+ if( isset($_POST['loco']) && is_array( $update = $_POST['loco'] ) ){
45
+ $args = Loco::config( $update );
46
+ $args['success'] = Loco::__('Settings saved');
47
+ }
48
+ else {
49
+ $args = Loco::config();
50
+ }
51
+ Loco::render('admin-opts', $args );
52
+ }
53
+
54
+
55
 
56
  /**
57
+ * Admin tools page render call
58
  */
59
+ public static function render_page_tools(){
60
  do {
61
  try {
62
 
782
  * Admin menu registration callback
783
  */
784
  function _loco_hook__admin_menu() {
785
+ // Settings menu
786
+ $title = Loco::__('Loco, Translation Management');
787
+ $page = array( 'LocoAdmin', 'render_page_options' );
788
+ add_options_page( $title, Loco::__('Translation'), 'manage_options', Loco::NS, $page );
789
+ // Tools menu
790
+ $page = array( 'LocoAdmin', 'render_page_tools' );
791
+ $hook = add_management_page( $title, Loco::__('Manage Translations'), LOCO::CAPABILITY, Loco::NS, $page );
792
  add_action('admin_print_styles', '_loco_hook__admin_print_styles' );
793
+
794
  }
795
 
796
 
lib/loco-boot.php CHANGED
@@ -8,7 +8,7 @@ abstract class Loco {
8
  /** plugin namespace */
9
  const NS = 'loco-translate';
10
 
11
- const VERSION = '1.1.2';
12
  const CAPABILITY = 'manage_options';
13
 
14
  /* whether to enable APC cache */
@@ -227,6 +227,31 @@ abstract class Loco {
227
  return $key;
228
  }
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  }
231
 
232
 
8
  /** plugin namespace */
9
  const NS = 'loco-translate';
10
 
11
+ const VERSION = '1.1.3';
12
  const CAPABILITY = 'manage_options';
13
 
14
  /* whether to enable APC cache */
227
  return $key;
228
  }
229
 
230
+
231
+ /**
232
+ * Plugin option getter/setter
233
+ */
234
+ public static function config( array $update = array() ){
235
+ static $conf;
236
+ if( ! isset($conf) ){
237
+ $conf = array (
238
+ 'which_msgfmt' => '/usr/bin/msgfmt',
239
+ );
240
+ foreach( $conf as $key => $val ){
241
+ $conf[$key] = get_option( Loco::NS.'-'.$key);
242
+ if( empty($conf[$key]) && ! is_string($conf[$key]) ){
243
+ $conf[$key] = $val;
244
+ }
245
+ }
246
+ }
247
+ foreach( $update as $key => $val ){
248
+ if( isset($conf[$key]) ){
249
+ update_option( Loco::NS.'-'.$key, $val );
250
+ $conf[$key] = $val;
251
+ }
252
+ }
253
+ return $conf;
254
+ }
255
  }
256
 
257
 
loco.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Loco Translate
4
  Plugin URI: http://wordpress.org/extend/plugins/loco-translate
5
  Description: Translate Wordpress plugins and themes directly in your browser
6
  Author: Tim Whitlock
7
- Version: 1.1.3
8
  Author URI: http://localise.biz/help/wordpress/translate-plugin
9
  */
10
 
4
  Plugin URI: http://wordpress.org/extend/plugins/loco-translate
5
  Description: Translate Wordpress plugins and themes directly in your browser
6
  Author: Tim Whitlock
7
+ Version: 1.2
8
  Author URI: http://localise.biz/help/wordpress/translate-plugin
9
  */
10
 
php/loco-posave.php CHANGED
@@ -50,22 +50,27 @@
50
  // attempt to write MO file also, but may fail for numerous reasons.
51
  if( ! $ispot ){
52
  try {
53
- $path = str_replace( '.po', '.mo', $path );
54
- if( ! file_exists($path) && ! is_writable( dirname($path) ) ){
55
- throw new Exception('Cannot create MO file');
56
- }
57
- else if( file_exists($path) && ! is_writable($path) ){
58
- throw new Exception('Cannot overwrite MO file');
59
- }
60
- // attempt to shell out to msgfmt, assuming it's under $PATH
61
- define( 'WHICH_MSGFMT', 'msgfmt' );
62
- function_exists('loco_compile_mo') or loco_require('build/gettext-compiled');
63
- $mo = loco_compile_mo( $po );
64
- if( ! $mo ){
65
- throw new Exception('Zero bytes from msgfmt');
 
 
 
 
 
 
 
66
  }
67
- $bytes = file_put_contents( $path, $mo );
68
- $response['compiled'] = $bytes;
69
  }
70
  catch( Exception $e ){
71
  $response['compiled'] = $e->getMessage();
50
  // attempt to write MO file also, but may fail for numerous reasons.
51
  if( ! $ispot ){
52
  try {
53
+ // establish msgfmt settings
54
+ $conf = Loco::config();
55
+ if( $conf['which_msgfmt'] ){
56
+ define( 'WHICH_MSGFMT', $conf['which_msgfmt'] );
57
+
58
+ $path = str_replace( '.po', '.mo', $path );
59
+ if( ! file_exists($path) && ! is_writable( dirname($path) ) ){
60
+ throw new Exception('Cannot create MO file');
61
+ }
62
+ else if( file_exists($path) && ! is_writable($path) ){
63
+ throw new Exception('Cannot overwrite MO file');
64
+ }
65
+ // attempt to shell out to msgfmt
66
+ function_exists('loco_compile_mo') or loco_require('build/gettext-compiled');
67
+ $mo = loco_compile_mo( $po );
68
+ if( ! $mo ){
69
+ throw new Exception('Zero bytes from '.WHICH_MSGFMT);
70
+ }
71
+ $bytes = file_put_contents( $path, $mo );
72
+ $response['compiled'] = $bytes;
73
  }
 
 
74
  }
75
  catch( Exception $e ){
76
  $response['compiled'] = $e->getMessage();
pub/js/build/admin-poedit.js CHANGED
@@ -1,24 +1,24 @@
1
- (function(u,C,d,S){function N(c){c.stopPropagation();c.preventDefault();return!1}function aa(c,a){function l(){e();k=setTimeout(function(){d(c).fadeOut(1E3,a)},f)}function e(){k&&clearTimeout(k);k=null}var k,f=5E3;l();d(c).mouseenter(e).mouseleave(l)}function V(c,a){function l(a){d(c).remove();d(u).triggerHandler("resize");return a&&N(a)}d('<a class="dismiss" href="#">&times;</a>').appendTo(c).click(l);a||aa(c,l)}function W(c,a,l,e){var k="loco-js-"+l;l=C.getElementById(k)||d('<div id="'+k+'" class="loco-message '+
2
- (e||l)+'"></div>').insertBefore(d("#loco-poedit"));c=d(C.createElement("p")).text(c);a=d(C.createElement("strong")).text(a+": ");c.prepend(a).appendTo(d(l).html(""));d(u).triggerHandler("resize");V(l);d("div.loco-warning").remove()}function X(c){return W(c,U("OK"),"updated loco-success")}function Y(){var c=F.stats(),a=c.t,l=c.f,e=c.u,a=a+" string"+(1===a?"":"s"),k=[];T&&(a=c.p+" translated, "+a,l&&k.push(l+" fuzzy"),e&&k.push(e+" untranslated"),k.length&&(a+=" ("+k.join(", ")+")"));d("#loco-po-status").text(a)}
3
- function Z(c,a,l){function e(c,a,b){b=b||U("Unknown Ajax error");W(b,U("Error"),"error");l&&l(c,a,b)}return d.ajax({url:ba,type:c.method,data:d(c).serialize(),dataType:"json",error:e,success:function(c,f,b){!c||c.error?e(b,f,c&&c.error&&c.error.message):a&&a(c,f,b)}})}var q=function(){var c={};return{register:function(a,d){c[a]=d},require:function(a,d){var e=c[a];if(!e)throw Error('CommonJS error: failed to require("'+d+'")');return e}}}();q.register("$1",function(c,a,d){Array.prototype.indexOf||
4
- (Array.prototype.indexOf=function(c){if(null==this)throw new TypeError;var a,f=Object(this),b=f.length>>>0;if(0===b)return-1;a=0;1<arguments.length&&(a=Number(arguments[1]),a!=a?a=0:0!=a&&Infinity!=a&&-Infinity!=a&&(a=(0<a||-1)*Math.floor(Math.abs(a))));if(a>=b)return-1;for(a=0<=a?a:Math.max(b-Math.abs(a),0);a<b;a++)if(a in f&&f[a]===c)return a;return-1});return c}({},u,C));q.register("$7",function(c,a,d){function e(a){this.reIndex([]);if(a)for(var c in a)this.add(c,a[c])}c.init=function(a){return new e(a)};
5
  a=e.prototype;a.reIndex=function(a){var c=-1;for(this.ords={};++c<a.length;)this.ords[a[c]]=c;this.keys=a;this.length=c};a.key=function(a,c){if(null==c)return this.keys[a];var b=this.keys[a],g=this.ords[c];if(c!==b){if(null!=g)throw Error("Clash with item at ["+g+"]");this.keys[a]=c;delete this.ords[b];this.ords[c]=a}return a};a.indexOf=function(a){a=this.ords[a];return null==a?-1:a};a.add=function(a,c){var b=this.ords[a];null==b&&(this.keys[this.length]=a,b=this.ords[a]=this.length++);this[b]=c;
6
- return b};a.get=function(a){return this[this.ords[a]]};a.cut=function(a,c){var b=[].splice.call(this,a,c);this.keys.splice(a,c);this.reIndex(this.keys);return b};a.each=function(a){for(var c=-1;++c<this.length;)a(this.keys[c],this[c],c);return this};a=null;return c}({},u,C));q.register("$2",function(c,a,d){function e(b){return{"Project-Id-Version":"PACKAGE VERSION","Report-Msgid-Bugs-To":"","POT-Creation-Date":b||"","POT-Revision-Date":b||"","PO-Revision-Date":b||"","Last-Translator":"","Language-Team":"",
7
  Language:"","Plural-Forms":"","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Poedit-SourceCharset":"UTF-8"}}function k(b,a){var c=b||"";a&&(c+="\x00"+a);return c}function f(){return q.require("$7","collection.js").init()}function b(b){if(!b)return'""';for(var a=b.replace("\r\n","\n").split("\n"),c=a.length-1,h=[],f=-1,d;++f<a.length;){b=a[f];for(c&&c!==f&&(b+="\n");b&&b.charAt(79);){for(d=80;--d;)if(-1!==" \n\r.?!,;:-".indexOf(b.charAt(d))){d++;
8
  break}d||(d=79);h.push(g(b.substr(0,d)));b=b.substr(d)}b&&h.push(g(b))}h[1]&&h.unshift("");return'"'+h.join('"\n"')+'"'}function g(b){return b.replace(/(["\\])/g,"\\$1").replace(/\n/g,"\\n")}function h(b){this.head={};this.headers(e(this.now()));this.locale(b);this.length=0;this.rows=f()}function s(b,a){this.src=[b||""];this.msg=[a||""];this.cmt="";this.status=0}c.create=function(b){return new h(b)};a=h.prototype;a.now=function(){return(new Date).toString()};a.header=function(b,a){if(null==a)return this.headers()[b]||
9
  "";this.head[b]=a||"";return this};a.headers=function(b){var a;if(null!=b){for(a in b)this.head[a]=b[a];return this}var c=this.locale(),g=this.now();b={};for(a in this.head)b[a]=String(this.head[a]);c?(b.Language=c.label||"Unknown locale",b["Plural-Forms"]="nplurals="+(c.nplurals||"2")+"; plural="+(c.pluraleq||"n!=1"),b["X-Loco-Target-Locale"]=(c.lang||"en")+"_"+(c.region||"GB"),b["PO-Revision-Date"]=g,delete b["POT-Revision-Date"]):(b.Language="",b["Plural-Forms"]="nplurals=INTEGER; plural=EXPRESSION",
10
  b["POT-Revision-Date"]=g,b["PO-Revision-Date"]="YEAR-MO-DA HO:MI+ZONE");b["X-Generator"]="Loco - https://localise.biz/";return b};a.locale=function(b){if(null==b)return this.loc;this.loc=b||{lang:"en",region:"GB",nplurals:2,pluraleq:"n == 1 ? 0 : 1",label:"English"};this.loc.toString=function(){return this.lang+"_"+this.region};return this};a.lock=function(b){this.locale(b||!1);return this.loc};a.unlock=function(){var b=this.loc;this.loc=null;return b};a.reIndex=function(b,a){var c=this.indexOf(b),
11
  g=b.hash(),h=this.rows.indexOf(g);return h===c?c:-1!==h?(a=(a||0)+1,b.source("Error, duplicate "+String(a)+": "+b.source()),this.reIndex(b,a)):this.rows.key(c,g)};a.get=function(b,a){var c=k(b,a);return this.rows.get(c)};a.indexOf=function(b){null==b.idx&&(b.idx=this.rows.indexOf(b.hash()));return b.idx};a.del=function(b){b=this.indexOf(b);if(-1!==b){var a=this.rows.cut(b,1);if(a&&a.length)return this.length=this.rows.length,this.rows.each(function(b,a,c){a.idx=c}),b}};a.add=function(b,a){b instanceof
12
- s||(b=new s(b));a&&b.context(a);var c=b.hash();if(this.rows.get(c))throw Error("Duplicate message at index "+this.indexOf(b));b.idx=this.rows.add(c,b);this.length=this.rows.length;return b};a.each=function(b){this.rows.each(b);return this};a.load=function(b){for(var a=-1,c,g,h,f,d=[],z=[],p=[],w=[];++a<b.length;)if(c=b[a],null==c.parent){if(g=c.source||c.id,h=c.context,g||h)f=new s(g,c.target||""),h&&f.context(h),c.flag&&f.flag(c.flag,!0),c.comment&&f.comment(c.comment),c.message=f,f.translation()?
13
- f.fuzzy()?p.push(f):z.push(f):w.push(f)}else d.push(c);for(a=-1;++a<d.length;)try{c=d[a];g=c.source||c.id;f=b[c.parent]&&b[c.parent].message;if(!f)throw Error("parent missing for plural "+g);1===c.plural&&f.plural(g);f.translate(c.target||"",c.plural)}catch(k){}g=[w,p,z];for(a=0;3>a;a++)for(c=g[a],b=-1;++b<c.length;)try{this.add(c[b])}catch(e){}return this};a.merge=function(b){var a,c=this.rows,g=f(),h={add:[],del:[]};b=b.rows;this.rows.each(function(a,c){b.get(a)||h.del.push(c)});b.each(function(b,
14
- f){try{a=c.get(b),a||(a=f,h.add.push(a)),a.idx=g.add(b,a)}catch(z){}});this.rows=g;this.length=g.length;return h};a.row=function(b){return this.rows[b]};a.toString=function(){var b,a=[],c=[],g=this.headers(),h=!this.loc;for(b in g)c.push(b+": "+g[b]);c=new s("",c.join("\n"));h&&(c.comment("Loco Gettext template"),c.fuzzy(!0));a.push(c.toString());a.push("");this.rows.each(function(b,c){a.push(c.toString(h));a.push("")});return a.join("\n")};a=s.prototype;a.hash=function(){return k(this.source(),this.context())};
15
  a.flag=function(b,a){var c=b===(b&this.status);if(null==a)return c;a?this.status|=b:c&&(this.status^=b);return this};a.fuzzy=function(b){return this.flag(4,b)};a.source=function(b,a){if(null==b)return this.src[0];this.src[0]=b;this.plural(a);return this};a.plural=function(b){if(null==b)return this.src[1];this.src[1]=b||"";return this};a.each=function(b){for(var a=-1;++a<this.msg.length;)b(a,this.msg[a]);return this};a.translate=function(b,a){this.msg[a||0]=b||"";return this};a.translation=function(b){return this.msg[b||
16
  0]||""};a.comment=function(b){if(null==b)return this.cmt||"";this.cmt=b||"";return this};a.context=function(b){if(null==b)return this.src[2]||"";this.src[2]=b||"";return this};a.toString=function(a){var c,g=[];this.cmt&&(g=["# "+this.cmt.replace("\r\n","\n").split("\n").join("\n# ")]);!a&&this.fuzzy()&&g.push("#, fuzzy");this.src[2]&&g.push("msgctxt "+b(this.src[2]));g.push("msgid "+b(this.src[0]));if(null==this.src[1])g.push("msgstr "+b(a?"":this.msg[0]));else for(c=-1,g.push("msgid_plural "+b(this.src[1]));++c<
17
  this.msg.length;)g.push("msgstr["+c+"] "+b(a?"":this.msg[c]));return g.join("\n")};a.toText=function(){return this.src.join(" ")+" "+this.msg.join(" ")};a.weight=function(){var b=0;this.translation()||(b+=2);this.fuzzy()&&(b+=1);return b};a.compare=function(b,a){var c=this.weight(),g=b.weight();if(c>g)return 1;if(c<g)return-1;if(a){c=this.hash().toLowerCase();g=b.hash().toLowerCase();if(c<g)return 1;if(c>g)return-1}return 0};a.equals=function(b){return this===b||this.source()===b.source()&&this.context()===
18
- b.context()};a=a=null;return c}({},u,C));q.register("$3",function(c,a,d){function e(){var a,c;this.clear=function(){this.length=0;a={};c=[]};this.getTree=function(){return a};this.getData=function(){return c};this.clear()}c.create=function(){return new e};a=e.prototype;a.depth=0;a.matchall=!0;a.ignorecase=!0;a.nonword=/[\-.?!;:,_*^+=~`"'(){}<>[\]\/\\\u00a0\u1680\u180e\u2000-\u206f\u2e00-\u2e7f\u3000-\u303f]+/g;a.translit=function(a,c){function b(b){return a[b]||b}c=c||/[^a-z0-9]/g;this.trans=function(a){return a.replace(c,
19
- b)}};a.stoppers=function(a){this.stopped=function(c){return Boolean(a[c])}};a.add=function(a,c){null==c&&(c=String(a));var b=-1,g,h,d,e,n,y=this.normalize(c);g=this.getData();var m=g.length;g.push(a);for(this.length++;++b<y.length;)if(g=y[b],!this.stopped(g)){h=this.getTree();d=Math.min(g.length,this.depth)||g.length;for(e=0;e<d;e++)n=g.charAt(e),h=h[n]||(h[n]={});g=h[" "]||(h[" "]=[]);g.push(m)}return this};a.find=function(a,c){function b(a,c){var g,h,z;for(y in a)if(z=a[y]," "===y)for(g in z)m=
20
- z[g],h=t[m]||(t[m]={length:0,words:{}}),h.length+=h.words[c]?0:1,h.words[c]=1+(h.words[c]||0);else b(z,c)}var g=-1,h,d,e,n,y,m,t={},l=[],r=this.normalize(a),z=this.getData();a:for(;++g<r.length;){h=r[g];d=this.getTree();e=Math.min(h.length,this.depth)||h.length;for(n=0;n<e;n++){y=h.charAt(n);if(!d[y])continue a;d=d[y]}b(d,h)}for(m in t)this.matchall&&t[m].length<r.length||l.push(z[m]);c&&(c.query=a,c.words=r);return l};a.normalize=function(a){for(var c=-1,b={},g=[],h=this.split(a);++c<h.length;)if(a=
21
- h[c])if(this.ignorecase&&(a=a.toLowerCase()),a=this.strip(a))this.trans&&(a=this.trans(a)),b[a]||(g.push(a),b[a]=!0);return g};a.stopped=function(a){return 1===a.length};a.split=function(a){return a.split(/\s+/)};a.strip=function(a){return a.replace(this.nonword,"")};a=null;return c}({},u,C));q.register("$4",{"\u0131":"i","\u03b1":"a","\u03b2":"b","\u03c8":"c","\u03b4":"d","\u03b5":"e","\u03c6":"f","\u03b3":"g","\u03b7":"h","\u03b9":"i","\u03be":"j","\u03ba":"k","\u03bb":"l","\u03bc":"m","\u03bd":"n",
22
  "\u03bf":"o","\u03c0":"p","\u03c1":"r","\u03c3":"s","\u03c4":"t","\u03b8":"u","\u03c9":"v","\u03c2":"s","\u03c7":"x","\u03c5":"y","\u03b6":"z","\u0444":"a","\u0438":"b","\u0441":"c","\u0432":"d","\u0443":"e","\u0430":"f","\u043f":"g","\u0440":"h","\u0448":"i","\u043e":"j","\u043b":"k","\u0434":"l","\u044c":"m","\u0442":"n","\u0449":"o","\u0437":"p","\u0439":"\ua647","\u043a":"r","\u044b":"s","\u0435":"t","\u0433":"u","\u043c":"v","\u0446":"w","\u0447":"x","\u043d":"y","\u044f":"z","\u00aa":"a","\u00e1":"a",
23
  "\u00e0":"a","\u0103":"a","\u1eaf":"a","\u1eb1":"a","\u1eb5":"a","\u1eb3":"a","\u00e2":"a","\u1ea5":"a","\u1ea7":"a","\u1eab":"a","\u1ea9":"a","\u01ce":"a","\u00e5":"a","\u01fb":"a","\u00e4":"a","\u01df":"a","\u00e3":"a","\u0227":"a","\u01e1":"a","\u0105":"a","\u0101":"a","\u1ea3":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1eb7":"a","\u1ead":"a","\u1e01":"a","\ua733":"a","\u00e6":"a","\u01fd":"a","\u01e3":"a","\ua735":"a","\ua737":"a","\ua739":"a","\ua73b":"a","\ua73d":"a","\u1e9a":"a","\u2c65":"\u2c65",
24
  "\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"\u0180","\u0183":"\u0183","\u0107":"c","\u0109":"c","\u010d":"c","\u010b":"c","\u00e7":"c","\u1e09":"c","\u023c":"\u023c","\ua792":"\ua793","\u0188":"\u0188","\ua73f":"\ua73f","\u010f":"d","\u1e0b":"d","\u1e11":"d","\u1e0d":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u00f0":"d","\ua77a":"d","\u0238":"d","\u01f3":"d","\u01f2":"d","\u01c6":"d","\u01c5":"d","\u018c":"\u018c","\u00e9":"e","\u00e8":"e","\u0115":"e","\u00ea":"e","\u1ebf":"e","\u1ec1":"e",
@@ -54,35 +54,35 @@ h[c])if(this.ignorecase&&(a=a.toLowerCase()),a=this.strip(a))this.trans&&(a=this
54
  "\u04b5":"\u04b5","\ua691":"\ua691","\u2df1":"x","\ua693":"\ua693","\u04f5":"\ua693","\u04b7":"\u04b7","\u04cc":"\u04cc","\u04b9":"\u04b9","\ua687":"\ua687","\u04bd":"\u04bd","\u04bf":"\u04bf","\u045f":"\u045f","\u2df2":"i","\ua697":"\ua697","\u2df3":"o","\ua64f":"\ua64f","\ua678":"\u044a","\u044a":"\u044a","\ua651":"\ua651","\ua679":"s","\u04f9":"s","\ua67a":"m","\u048d":"\u048d","\u2dfa":"\u0463","\u0463":"\u0463","\ua653":"\ua653","\u044d":"\u044d","\u04ed":"\u044d","\u2dfb":"\u044e","\u044e":"\u044e",
55
  "\ua655":"\ua655","\u2dfc":"\ua657","\ua657":"\ua657","\u0519":"\u0519","\ua69f":"\u0465","\u0465":"\u0465","\u2dfd":"\u0467","\u0467":"\u0467","\ua659":"\ua659","\u2dfe":"\u046b","\u046b":"\u046b","\ua65b":"\ua65b","\u0469":"\u0469","\ua65d":"\ua65d","\u2dff":"\u046d","\u046d":"\u046d","\u046f":"\u046f","\u0471":"\u0471","\u2df4":"\u0473","\u0473":"\u0473","\u0475":"\u0475","\u0477":"\u0475","\ua65f":"\ua65f","\u04a9":"\u04a9","\u051d":"\u051d","\u04cf":"\u04cf"});q.register("$5",function(c,a,l){c.listen=
56
  function(a,c){function f(){n[s?"show":"hide"]()}function b(){a.value!==s&&(g&&clearTimeout(g),s=a.value,G&&a.setAttribute("size",s.length||1),f(),g=setTimeout(function(){c(s)},h))}a=a instanceof jQuery?a[0]:a;var g,h=150,s=a.value,G=1===Number(a.size),n=d('<a href="#clear" tabindex="-1" class="icon clear"><span>clear</span></a>').click(function(c){a.value="";b();return!1});d(a).keyup(function(a){b();return!0}).after(n);f();return{ping:b,val:function(b){if(null==b)return s;g&&clearTimeout(g);a.value=
57
- s=b;f()}}};return c}({},u,C));q.register("$18",function(c,a,d){function e(g){b||a._gat&&(b=_gat._createTracker(k,"loco"));if(b){var h=g.shift();b[h].apply(b,g)}else f&&f.push(g);return c}var k,f,b;c._init=function(b){if(k=b.code){f=a._gaq||(a._gaq=[]);f.push(["_setAccount",k]);f.push(["_trackPageview"]);f.push(["_setDomainName",b.host]);b=d.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"==d.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var h=
58
- d.getElementsByTagName("script")[0];h.parentNode.insertBefore(b,h)}return c};c.event=function(b,a,c,d){return e(["_trackEvent",b||"",a||"",c||"",d||0])};c.page=function(b,a){return e(["_trackPageview",{page:b||location.pathname+location.hash,title:a||d.title}])};return c}({},u,C));q.register("$19",function(c,a,d){function e(b,g){if(k)k[b](g);else a.ga&&ga(b,g);return c}var k,f;c._init=function(b){b.code&&(function(b,a,c,d,f,e,m){b.GoogleAnalyticsObject=f;b[f]=b[f]||function(){(b[f].q=b[f].q||[]).push(arguments)};
59
  b[f].l=1*new Date;e=a.createElement(c);m=a.getElementsByTagName(c)[0];e.async=1;e.src=d;m.parentNode.insertBefore(e,m)}(a,d,"script","//www.google-analytics.com/analytics.js","ga"),ga("create",b.code,{alwaysSendReferrer:!0}),b.custom&&e("set",b.custom),c.page(),ga(function(b){k=b}));return c};c.event=function(b,a,c,d){return e("send",{hitType:"event",eventCategory:b||"",eventAction:a||"",eventLabel:c||"",eventValue:Number(d||0)})};c.page=function(b,a){var c={hitType:"pageview",page:b||location.pathname+
60
- location.hash,title:a||d.title};c.location=location.protocol+"//"+location.hostname+c.page;f&&e("set",{referrer:f});f=c.location;return e("send",c)};c.reset=function(){f=location.href;e("set",{page:location.pathname+location.hash,title:d.title,location:f});return c};return c}({},u,C));q.register("$11",function(c,a,l){var e;c.init=function(a){!e&&a&&(a.host||(a.host=location.hostname),e=a.legacy?q.require("$18","legacy.js"):q.require("$19","universal.js"),e._init(a));return c};c.link=function(a){var f,
61
- b=a.getAttribute("href");if(!b||"#"===b)return c;if(0===b.indexOf("#"))f="anchor";else{if(0!==b.indexOf("http")&&0!==b.indexOf("//")||-1!==b.indexOf())return c;f="external";a.setAttribute("target","_blank")}d(a).click(function(){e.event(f,"click",b);return!0});a=null;return c};c.page=function(){e&&e.page.apply(e,arguments);return c};c.event=function(){e&&e.event.apply(e,arguments);return c};c.reset=function(){e&&e.reset&&e.reset();return c};return c}({},u,C));q.register("$23",function(c,a,l){function e(b,
62
- a,c,e,k){function n(){t&&clearTimeout(t);v&&v.fadeOut(400,function(){d(this).remove();v=null});return!1}function y(){m();-1!==e&&(t=setTimeout(n,e||2E3));v.unbind("mouseleave");v.mouseenter(m)}function m(){t&&clearTimeout(t);t=null;v.unbind("mouseenter");v.mouseleave(y)}var t;f||(f=l.createElement("div"),f.id="growls",l.body.appendChild(f));var v=d('<div class="growl growl-'+c+'"><div><a class="close" href="#"><span>X</span></a><span class="badge"></span><p class="message"></p><small class="caption"></small></div></div>');
63
- v.find("p").text(b||"Empty message");a?v.find("small").text(a):v.find("small").remove();if(k.length){k.push({label:"Cancel",callback:n,css:"cancel"});var r,z=d('<form action="#" class="dialog"></form>');a=function(b,a){r=d('<input type="button" value="'+a.label+'" class="butt '+(a.css||"")+'" />');r.click(function(b){"function"===typeof a.callback&&a.callback(b,{close:n})});z.append(r);return r};for(b=0;b<k.length;b++)a(b,k[b]);v.append(z)}d(f).prepend(v.hide().fadeIn(400));v.find("a").click(n);y()}
64
  var k,f;c.init=function(){if(!k)return k=a.alert,a.alert=function(b){b=String(b).split("\n");var a=b[1]&&b.slice(1).join("\n");c.alert(b[0],a)},c};c.debug=function(b){k(b);return c};c.alert=function(b,c,d,f,G){try{return e(b,c||"",d||"alert",f||4E3,G||[]),!0}catch(n){return b+="\n\n--\n"+(n.message||n),k.call(a,b),!1}};c.success=function(b,a,d){return c.alert(b,a,"success",d||2E3)};c.dialog=function(b,a,d,f){return c.alert(b,a,f||"alert",-1,d)};c.login=function(b,a,d,f){c.dialog(a||"You're not logged in",
65
- d||"Please log in to continue",[{label:f||"Log in",callback:function(a,c){location.assign(b||"/session/auth/login?r="+encodeURIComponent(location.href))}}])};return c}({},u,C));q.register("$21",function(c,a,l){function e(b){return 27===b.keyCode&&y&&m?(q(),b.preventDefault(),!1):!0}function k(c){if(y){var z=Math.max(b.height(),g.outerHeight(!0));z&&s.css("height",z+"px");c&&(p=d(a).innerWidth(),B(w))}return!0}function f(b){b?(G.show(),h.addClass("has-title")):(G.hide(),h.removeClass("has-title"))}
66
- var b,g,h,s,G,n,y=!1,m=!1,t=!1,v,r,z,p,w,A=c.init=function(){if(!b){b=d('<div id="overlay"></div>');g=d('<div class="overlay-frame"></div>');h=d('<div class="overlay-container"></div>');G=d('<div class="overlay-title"><span class="title">Untitled</span></div>');n=d('<a class="overlay-close" href="#"><span>x</span></a>');s=d('<div class="overlay-bg"></div>');b.append(g.append(h)).append(s).prependTo(l.body);d(l).bind("keydown",e);d(a).resize(k);z=h.outerWidth(!0)-h.width()+(g.innerWidth()-g.width());
67
- h.outerHeight(!0);h.outerHeight(!1);g.innerHeight();g.height();p=d(a).innerWidth();v=parseInt(h.css("width"));if(!v||isNaN(v))v=h.width();r=parseInt(h.css("height"));if(!r||isNaN(r))r=h.height();G.append(n.hide()).hide().prependTo(g);b.hide()}return b},B=c.width=function(a){A();if(null===a)g.css("width",""),h.css("width","");else{a=a||v||640;x=a+z;w=a;var d=p;x>d?(x=d,a=x-z,b.addClass("spill")):b.removeClass("spill");g.css("width",x+"px");h.css("width",a+"px")}return c};c.autoSize=function(){A();
68
- k();var b=v||0;h.children().each(function(a,c){b=Math.max(b,d(c).outerWidth(!0))});B(b);return c};c.css=function(b){A().attr("class",b);return c};c.html=function(b){A();a.innerShiv&&(b=innerShiv(b,!1));return h.html(b)};c.append=function(b){A();b instanceof jQuery||(b=d(b));h.append(b);return c};var q=c.close=function(a){if(y){var g=function(){A().hide();d(l.body).removeClass("has-overlay");y=!1;h.html("");y=null;b.trigger("overlayClosed",[c])};null==a&&(a=300);a?b.fadeOut(a,g):g()}return c};c.title=
69
- function(b){A();t=b||"";G.find("span.title").text(t);null!=b?f(!0):m||f(!1);return c};c.enableClose=function(){A();m=!0;n.unbind("click").bind("click",function(b){q();return!1});f(!0);n.show();return c};c.disableClose=function(){A();m=!1;n.hide();y&&t||f(!1);return c};c.open=function(){A();h.html("");B(v);b.attr("class","");d(l.body).addClass("has-overlay");A().show();y=!0;k();c.title(null);m&&f(!0);b.trigger("overlayOpened",[c]);return c};c.listen=function(b){A().bind("overlayClosed",b);return c};
70
- c.unlisten=function(b){A().unbind("overlayClosed",b);return c};return c}({},u,C));q.register("$20",function(c,a,l){var e={401:"You've been logged out",404:"Not Found",500:"Server Error",502:"Bad Gateway",503:"Service unavailable",504:"Gateway timeout"};c.getErrors=function(){return e};c.jsonLink=function(a){if(!a)return"";a=a.split("?");a[0]=a[0].replace(/(\.[a-z0-9]{1,4})?$/i,".json");return a.join("?")};c.errorData=function(a,c,b){var g,h;b=a.responseText;c=a.status;if(!b&&0===c)return null;try{g=
71
  d.parseJSON(b)||{}}catch(s){g={},h=s.message||s}h||(h=g.statusText||a.statusText||e[c]||"Unknown Error");g.error=h;return g};c.ajax=function(e,f,b,g){function h(){b&&b()}function s(b){b.alert&&alert(b.alert);var c=b.success;c&&q.require("$23","growl.js").success.apply(this,c.push?c:[c]);c=g||d(l.body);c.trigger("locoAjaxSuccess",[b]);var f=b.events;if(f&&f.length)for(var e,s=q.require("$11","ga.js");e=f.shift();)c.trigger(e,[b]),s.event("ajax",e);b.modal&&q.require("$13","LocoModal.js").replace(b.modal);
72
  if(b.download)a.location.assign(b.download);else if(b.redirect)return a.location.assign(b.redirect),!1;h();return!0}function G(b,a,g){401===b.status?(q.require("$23","growl.js").login(),h()):(a=c.errorData(b,a,g),null!=a&&(g=a.error,"function"===typeof f&&!1===f(null,g,b.status)?h():a&&a.data&&!s(a.data)||(alert(g||"Unknown error"),h())))}e.error=G;e.success=function(b,a,c){if(!b)return G(c,"unknown");b.status&&alert(b.statusText||"Unknown error");"function"===typeof f&&!1===f(b&&b.data?b.data:b)?
73
- h():b&&b.data?s(b.data):h()};d.ajax(e)};return c}({},u,C));q.register("$13",function(c,a,l){function e(b,a){f.autoSize();var c=f.init();q.require("$9","html.js").init(c);c.find("[data-script]").each(function(b,c){c=d(c);for(var z=-1,f,h=c.attr("data-script").split(" ");++z<h.length;)f=h[z],g[f]?g[f](c,a||{}):alert("Unknown script "+f)});c.trigger("locoModalLoaded",[f,b||"",a||{}]);var h,e=c.find("form")[0];if(e)a:for(c=0;c<e.elements.length;c++)switch(h=e.elements[c],h.type){case "text":case "textarea":d(h).focus();
74
  break a}}function k(b){var a=d(b.currentTarget),c=a.attr("data-modal");if("close"===c){s();var g=a.attr("href");if(g&&-1!==g.indexOf("#!"))return!0}else{var e="submit"===b.type,k=a.attr("title")||a.attr("data-title"),g=a.attr("href")||a.attr("action"),l=e?a.serialize():"",a=e?a.attr("method"):"get";h(g,k,a,l);c||(c=g.split("/").slice(1,4).join("-"));c="modal "+c;f.width(null).css(c).autoSize()}b.stopPropagation();b.preventDefault();return!1}var f=q.require("$21","overlay.js"),b=q.require("$11","ga.js"),
75
  g={},h=c.load=function(a,g,h,m){f.open().title("Loading ..").disableClose().css("modal").html('<div class="overlay-placeholder"></div>');var s=q.require("$20","http.js");h={type:h||"get",data:m||"",url:s.jsonLink(a)};s.ajax(h,function(c,h,z){var p=c&&c.html;if(!p)return c=d('<h3 class="error"></h3>').text(h||"Unknown error"),f.enableClose().title("Error "+z||"?").html("").append(c),!1;g=c.title||g||"Untitled";f.enableClose().title(g).html(p);e(a,c.js);b.page(a,g);f.init().one("overlayClosed",function(){b.reset()});
76
  return!0});return c},s=c.close=function(){f.close();return c};c.initLink=function(b){b.click(k)};c.initForm=function(b){d(b).submit(k)};c.replace=function(b){var a=b&&b.html,c=b&&b.url,g=b&&b.title;c?(h(c,g),b=b&&b.css||c.split("/").slice(1,4).join("-"),f.width(null).css(" modal "+b).autoSize()):a&&(f.open().html(a),g&&f.enableClose().title(g),e("",b&&b.js))};c.find=function(b){return f.init().find(b)};c.script=function(b,a){if(a){if("function"!==typeof a.run)throw Error(b+" macro has no run function");
77
- g[b]=a.run;return c}return g[b]};return c}({},u,C));q.register("$14",function(c,a,l){function e(a){this.url="/auto/"+a+".json?q=";this.dead={}}function k(){this.dict=q.require("$3","dict.js").create()}c.init=function(a){function b(){if("hint"!==E){var b=B.val()&&!(L&&L.val())&&null==w&&!r;$[b?"addClass":"removeClass"]("error")}}function c(){K.show();var b=B.outerWidth(!1),a=B.outerHeight(!1),g=B.css("margin-top");g&&(g=parseInt(g),isNaN(g)||(a+=g));b-=2;K.css("top",a+"px").css("width",b+"px");r=!0}
78
- function h(){K.hide();r=!1}function s(){K.html("");h();v=0;A=w=null}function l(a){s();var h;for(h=0;h<a.length;h++){var f=h,p=a[h],e=d('<span class="label"></span>').text(p.label),w=d('<div class="auto-comp-result"></div>'),m=void 0;for(m in p)w.attr("data-"+m,p[m]);p.icon&&w.append(d("<span></span>").attr("class",p.icon));w.append(e);n(f,w)}(v=a.length)?(z&&c(),y(0)):(y(null),b())}function n(b,a){K.append(a);a.click(function(c){c.stopPropagation();y(b,a);t();return!1});return a}function y(b,a){A&&
79
- (A.removeClass("selected"),A=null);w=null;null==b?L&&L.val(""):(a||(a=K.find("div.auto-comp-result").eq(b)),a.length&&(a.addClass("selected"),w=b,A=a))}function m(b){if(v){var a=v-1;null==w?b=0<b?0:a:(b=w+b,0>b?b=a:b>a&&(b=0));return y(b)}}function t(){if(null==w)u.val(""),L&&L.val("");else{var a=K.find("div.auto-comp-result").eq(w),c=a.attr("data-value"),g=a.attr("data-label");L&&L.val(c);u.val(g);h();a=a.clone();s();n(0,a);v=1;y(0,a);b();a.trigger("locoAutocomp",[c,g,a])}}var v=0,r=!1,z=!1,p=a.form,
80
- w=null,A=null,B=d(a),J=B.attr("name"),E=B.attr("data-mode"),D=B.attr("data-provider"),L="hint"!==E&&d('<input type="hidden" value="" name="'+J+'" />').appendTo(p),$=d('<div class="auto-comp-wrap"></div>').replaceAll(B),K=d('<div class="auto-comp-drop"></div>');D&&(D=new e(D));L&&B.attr("name","_"+J);B.attr("autocomplete","off");$.append(B).append(K);h();B.focus(function(b){z=!0;1<v&&c()}).blur(function(a){z=!1;b()}).keydown(function(b){function a(){b.preventDefault();b.stopPropagation();return!1}
81
- switch(b.keyCode){case 27:r&&(b.stopPropagation(),h(),B.blur());break;case 40:v&&(r?m(1):c());break;case 38:r&&m(-1);break;case 13:if(r)return t(),a();if(!w&&"hint"!==E)return a()}return!0});var u=q.require("$5","LocoTextListener.js").listen(B,function(b){D&&D.fetch(b,l)});(p=B.attr("data-pre"))&&(p=d.parseJSON(p))&&p.value&&p.label?(l([p]),t()):!a.value||L&&L.val()||!D||D.fetch(a.value,function(b){l(b);t()});return{$:B,clear:s,reset:function(){s();B.val("");L&&L.val("");u.ping()},preload:function(b){v&&
82
  s();D=new k;var a,c;for(a in b)c=b[a],D.add(c)},mode:function(b){E=b}}};e.prototype.fetch=function(a,b){if(!a)return b&&b([]),this;var c,d=this.dead;for(c in d)if(0===a.indexOf(c))return b&&b([]),this;c={dataType:"json",url:this.url+encodeURIComponent(a)};q.require("$20","http.js").ajax(c,function(c){var g=c&&c.results;g&&(b&&c.query&&c.query===a&&b(c.results),g.length||(d[a]=0));return!0});return this};k.prototype.add=function(a){var b=a.fulltext||a.label||a.value;b&&this.dict.add(a,b)};k.prototype.fetch=
83
- function(a,b){if(!a)return b&&b([]),this;var c=this.dict.find(a);b(c)};return c}({},u,C));q.register("$15",function(c,a,l){function e(b){b.stopPropagation();b.preventDefault();return!1}function k(b,a,c){if(c=c||b.getElement(a))c.unbind().mouseup(function(c){c.stopPropagation();b.selectIndex(a,!0);return!1}).mouseover(function(){d(this).addClass("over");b.hover=a;return!0}).mouseout(function(){d(this).removeClass("over");b.hover=-1;return!0}),c=null;return b}function f(b){if(b){var a=this,c=b[0];a.id=
84
- c.id||"";a.name=c.name||"";a.prefix=c.getAttribute("data-prefix");a.defaultIcon=c.getAttribute("data-icon")||"jshide";var f=c.selectedIndex,e=[],n,k,m;for(k=0;k<c.options.length;k++)n=c.options[k],m=n.disabled,n=d(n),e.push([n.val(),n.text(),n.attr("data-icon")||"",m]);a.hidden=d('<input type="hidden" name="'+a.name+'" value="" />').appendTo(c.form);a.list=d('<ul class="clearfix"></ul>');a.icon=d('<span class="icon"> </span>');a.selection=d("<label></label>");a.handle=d('<a class="handle" href="#"></a>').attr("tabindex",
85
- b.attr("tabindex")||"").append(a.icon).append(a.selection);a.wrapper=d("<div></div>").addClass(c.className).addClass("selector").append(a.handle).append(a.list).replaceAll(c);this.id&&a.wrapper.attr("id",this.id);for(a.clearOptions();n=e.shift();)a.addOption.apply(a,n);a.handle.click(function(b){b.preventDefault();return!1}).mouseover(function(b){return a.onRollover(b)}).mouseout(function(b){return a.onRollout(b)}).mousedown(function(b){return a.onPress(b)}).keydown(function(b){return a.onKeydown(b)});
86
  d(l.body).mouseup(function(b){return a.onRelease(b)}).keydown(function(b){return a.onGlobalKeydown(b)});a.close();a.selectIndex(f)}}c.create=function(b){return new f(b)};c.extend=function(b){b.prototype=new f};a=f.prototype;a.onRollover=function(b){return this.over=!0};a.onRollout=function(b){this.over=!1;return!0};a.onPress=function(b){return this.active?this.over?(this.close(),b.stopPropagation(),b.preventDefault(),!1):!0:(this.open(),b.stopPropagation(),b.preventDefault(),this.handle.focus(),!1)};
87
  a.onRelease=function(b){this.active&&!this.over&&this.close();return!0};a.onGlobalKeydown=function(b){if(this.active)switch(b.keyCode){case 27:return this.close(),e(b);case 40:return this.hoverNext(1),e(b);case 38:return this.hoverNext(-1),e(b);case 13:if(-1!=this.hover)return this.selectIndex(this.hover,!0),this.hoverItem(-1),this.close(),e(b)}return!0};a.onKeydown=function(b){return this.active||40!==b.keyCode?!0:(this.open(),e(b))};a.open=function(){this.active=!0;this.hover=-1;this.wrapper.addClass("active");
88
  var b=this.handle.outerHeight()||0;this.list.show().css("top",b+"px");var b=this.handle.outerWidth()||0,a=this.list.outerWidth()||0;b>a&&(a-=this.list.width(),this.list.css("min-width",String(b-a)+"px"))};a.close=function(){this.list.hide();this.active=!1;-1!==this.hover&&(this.getElement(this.hover).removeClass("over"),this.hover=-1);this.wrapper.removeClass("active")};a.hoverItem=function(b,a){-1!==this.hover&&this.getElement(this.hover).removeClass("over");this.hover=b;-1!==b&&(a=a||this.getElement(b),
@@ -90,57 +90,57 @@ a.addClass("over"))};a.hoverNext=function(b){var a=this.options.length;if(a){a-=
90
  "jshide"),l=d("<label></label>").text(a||b),n=d("<li></li>").append(n).append(l).appendTo(this.list);n.attr("data-option",e);this.options[e]={value:b,text:a,icon:c};this.index[b]=e;this.length=e+1;f?this.disableIndex(e):k(this,e,n);return e};a.disableOption=function(b){return this.disableIndex(this.index[b])};a.disableIndex=function(b){(b=this.getElement(b))&&b.addClass("disabled").unbind();return this};a.enableOption=function(b){return this.enableIndex(this.index[b])};a.enableIndex=function(b){return k(this,
91
  b)};a.reIndex=function(){this.index={};this.length=0;for(var b=this.options.length;-1<--b;)this.index[this.options[b].value]=b,this.length++};a.selectValue=function(b,a){return this.selectIndex(this.index[b],a)};a.selectIndex=function(b,a){var c=this.options[b];c&&(this.hidden.val(c.value),b!==this.idx&&(this.idx=b,this.setLabel(c.text),this.icon.attr("class",c.icon||this.defaultIcon),a&&this.change()),this.active&&this.close());return this};a.setLabel=function(b){this.selection.text(b);this.prefix&&
92
  this.selection.prepend(d('<span class="prefix"></span>').text(this.prefix))};a.val=function(){var b=this.options[this.idx];return b&&b.value};a.change=function(){var b=this.eventName||"change",a=this.eventData&&this.eventData.slice()||[];a.unshift(this.val());this.wrapper.trigger(b,a);return this};a.renameOption=function(b,a){var c=this.index[b],d=this.options[c];d&&(d.text=a,this.getElement(c).find("label").text(a),c===this.idx&&this.setLabel(a));return this};a.removeOption=function(b){var a=this.index[b],
93
- c=this.options[a];c&&(b=this.val(),this.getElement(a).remove(),this.options.splice(a,1),this.reIndex(),b===c.value?this.selectIndex(0,!0):this.selectValue(b,!1))};a.getElement=function(b){return this.list.find("li").eq(b)};a=null;return c}({},u,C));q.register("$22",function(c,a,d){function e(b){k&&(b=f[b]||b);return b}var k=navigator.msPointerEnabled,f={touchstart:"MSPointerDown",touchmove:"MSPointerMove",touchend:"MSPointerUp"};c.bind=function(b,a,d){b=e(b);a.addEventListener&&a.addEventListener(b,
94
- d,!1);return c};c.unbind=function(b,a,d){b=e(b);a.removeEventListener&&a.removeEventListener(b,d,!1);return c};return c}({},u,C));q.register("$16",function(c,a,l){function e(){g&&clearTimeout(g);g=null}function k(b){b.preventDefault();b.stopPropagation();return!1}var f,b,g,h=100,s=100,G=!1,n=!1,y;c.delays=function(b,a){h=b||0;s=a||0};c.kill=function(){b&&b.hide().stop().remove();b=null;f&&f.hide().html("")};c.text=function(a){b&&b.find("label.tip").text(a)};c.init=function(m){function t(){f||(f=d('<div id="tipholder"></div>').appendTo(l.body));
95
- return f}function v(){e();A?g=setTimeout(r,A):r()}function r(){e();G||n||p()}function z(){e();b&&(b.stop(),b.remove());var a=m.offset();b=J.clone();t().show().append(b);var c=Math.round(a.left),a=Math.round(a.top);b.hasClass("tooltip-right")&&(c-=b.outerWidth(!1),c+=m.outerWidth(!1));a=b.hasClass("tooltip-top")?a-b.outerHeight():a+m.outerHeight();t().css("left",c+"px").css("top",a+"px");b.mouseenter(function(){G=!0;return!1}).mouseleave(function(){G=!1;v();return!0});Boolean(b.find("form").length|
96
- b.find("a").length)||b.click(w);m.trigger("tooltipOpen",[b])}function p(){function a(){c.kill()}b?b.fadeOut(500,a):a();m.trigger("tooltipClose",[b])}function w(){!1!==m.triggerHandler("click")&&D&&(location.href=D);return!1}var A=Number(m.attr("data-hide-delay")||s),B=Number(m.attr("data-show-delay")||h),J=m.find("div.tooltip"),E=m.attr("title");if(!J.length){if(!E)return;J=d('<div class="tooltip"></div>').append(d('<label class="tip"></label>').text(E));m.hasClass("hastip-top")&&J.addClass("tooltip-top");
97
- m.hasClass("hastip-right")&&J.addClass("tooltip-right");m.prepend(J)}E&&(m.attr("data-title")&&J.children("label.tip").text(E),m.attr("data-title",E),m.attr("title",""));var D=m.attr("href");"#"===D&&(D="");E=q.require("$22","touch.js").bind("touchstart",m[0],k).bind("touchmove",m[0],k).bind("touchend",m[0],function(b){setTimeout(w,300);return k(b)});null==y&&(y=!1,E.bind("touchstart",a,function(){return y=!0}).bind("touchend",a,function(){setTimeout(function(){y=!1},300);return!0}));m.mouseover(function(){y||
98
- (n=!0,e(),b?z():B?g=setTimeout(z,B):z());return!0}).mouseout(function(){y||(n=!1,v());return!0});D&&m.click(function(){n=!1;p();return!0})};return c}({},u,C));q.register("$9",function(c,a,l){var e=0;a.attachEvent&&/MSIE ([\d\.]+)/.exec(navigator.appVersion)&&(e=parseInt(RegExp.$1));c.ie=function(a){return a?e<=a:e};var k=c.init=function(a){a?a instanceof jQuery||(a=d(a)):a=d(l.body);var b=q.require("$11","ga.js"),g=q.require("$12","forms.js"),h=q.require("$13","LocoModal.js"),s=q.require("$14","LocoAutoComplete.js"),
99
- G=q.require("$15","LocoSelector.js"),n=q.require("$16","tooltip.js");a.find("form").each(function(b,a){var c=d(a);e&&10>e&&g.placeholders(c);a.getAttribute("data-modal")?h.initForm(a):a.action&&0!==a.action.indexOf("#")&&!a.target&&g.jsonify(a);c.hasClass("hasreveal")&&g.revealify(c);c.find("input.button").each(function(b,a){g.linkify(a)});c.find("input.auto-comp").each(function(a,b){s.init(b)});c.find("select.selector").each(function(b,a){G.create(d(a))})});a.find("a").each(function(a,g){-1!==g.className.indexOf("hastip")&&
100
- n.init(d(g));if(-1!==g.href.indexOf("/modal/")||g.getAttribute("data-modal"))h.initLink(d(g));else{b.link(g);var e=g.getAttribute("data-ajax-target");e&&(e=d("#"+e),d(g).click(function(a){a.preventDefault();e.addClass("loading");d.get(g.href,function(a){a=c.$(a).replaceAll(e);k(a);a.trigger("locoAhah")});return!1}))}});g=h=s=a=null;return c};c.$=function(c){return d(a.innerShiv?innerShiv(c,!1):c)};d.fn._html=function(c){return null!=c?(c=this.html(a.innerShiv?innerShiv(c,!1):c),k(this),c):j.html()};
101
- d.fn.macro=function(a,b){if("function"!==typeof a.run)throw Error("macro has no run function");a.run(this,b||{});return this};c.el=function(a,b){var c=l.createElement(a||"div");b&&(c.className=b);return c};c.txt=function(a){return l.createTextNode(a||"")};return c}({},u,C));q.register("$12",function(c,a,l){function e(a){function c(){a.value===k&&(a.value="",f.removeClass("placeheld"));return!0}function e(){""===a.value&&(a.value=k,f.addClass("placeheld"));return!0}var f=d(a);if(!f.hasClass("auto-comp")){var k=
102
- f.attr("placeholder");if(k)return f.focus(c).blur(e),e(),{kill:function(){c();f.unbind("focus",c).unbind("blur",e)}}}}var k=c.enable=function(b){function d(a,b){b.getAttribute("data-was-disabled")||(b.disabled=!1)}b.find(".button").removeClass("loading");b.find("input").each(d);b.find("select").each(d);b.find("textarea").each(d);a.attachEvent&&b.hasClass("has-placeholders")&&c.placeholders(b)},f=c.disable=function(a){function c(a,b){b.disabled?b.setAttribute("data-was-disabled","true"):b.disabled=
103
  !0}a.find(".button").addClass("loading");a.find("input").each(c);a.find("select").each(c);a.find("textarea").each(c)};c.jsonify=function(b,c,e){b instanceof jQuery||(b=d(b));b.disable||(d.fn.disable=function(){f(this);return this},d.fn.enable=function(){k(this);this.placehold&&this.placehold();return this});var l="";b.find('[type="submit"]').click(function(a){a&&a.target&&a.target.name&&(l=encodeURIComponent(a.target.name)+"="+encodeURIComponent(a.target.value));return!0});b.submit(function(d){if(d&&
104
  d.isDefaultPrevented&&d.isDefaultPrevented()||e&&!1===e(d))return!1;var f=a.tinyMCE;f&&b.find("textarea.editor").each(function(a,b){var c=f.get(b.id);c&&c.save()});var k=b.serialize();l&&(k&&(k+="&"),k+=l,l="");b.disable();var n=q.require("$20","http.js"),k={url:n.jsonLink(b.attr("action")),type:b.attr("method"),data:k};n.ajax(k,c,function(){b.enable()},b);d.preventDefault();d.stopPropagation();return!1});if(b.hasClass("autopost")){var G,n=Number(b.attr("data-autopost-delay")||500);b.find('input[type="checkbox"]').change(function(){G&&
105
  clearTimeout(G);G=setTimeout(function(){b.submit()},n);return!0})}};c.revealify=function(a){a.find("div[data-reveal-if]").each(function(c,e){function f(a){var b;r=r||a.target;if("."===t)b=Boolean(r&&r[q]);else if("="===t){var c,e;b=d(r.form).serializeArray();for(e in b)b[e].name===m&&(c=b[e].value);b=q===c}if(b!==l)if(l=b,a)k[l?"slideDown":"slideUp"](200);else k[l?"show":"hide"]();return!0}var k=d(e),n=/^([_\w\-\[\]]+)(\.|=)(.+)$/.exec(k.attr("data-reveal-if"));if(n){var l,m=n[1],t=n[2],q=n[3],n=
106
  a[0][m];n.length||(n=[n]);var r;for(c=0;c<n.length;c++)r=n[c],f(),d(r).change(f).removeClass("jshide");n=n=r=null}});a=null};c.linkify=function(a){var c=a.getAttribute("data-icon");if(c){var e=d(a),f=d("<a> </a>");f.attr("href",a.form.action);f.attr("class",e.attr("class"));f.attr("tabindex",e.attr("tabindex"));e.attr("tabindex","-1");f.text(e.val());c&&d("<span></span>").prependTo(f).addClass(c);e.hide().after(f);f.click(function(a){e.click();return!1})}};c.placeholders=function(a){var c,d=[];a.find("input[placeholder]").each(function(a,
107
- b){"password"!==b.type&&(c=e(b))&&d.push(c)});d.length&&(a.submit(function(){for(var a in d)d[a].kill()}),a.addClass("has-placeholders"),c=i=null)};return c}({},u,C));q.register("$17",function(c,a,d){var e=a.requestAnimationFrame,k=a.cancelAnimationFrame,f=0;if(!e||!k)for(var b in{ms:1,moz:1,webkit:1,o:1})if(e=a[b+"RequestAnimationFrame"])if(k=a[b+"CancelAnimationFrame"]||a[b+"CancelRequestAnimationFrame"])break;e&&k||(e=function(b){var c=g();timeToCall=Math.max(0,16-(c-f));nextTime=c+timeToCall;
108
- timerId=a.setTimeout(function(){b(nextTime)},timeToCall);f=nextTime;return timerId},k=function(a){clearTimeout(a)});var g=Date.now||function(){return(new Date).getTime()};c.loop=function(a,b){function c(){f=e(c,b);a(d++)}var d=0,f;c();return{stop:function(){f&&k(f);f=null}}};return c}({},u,C));q.register("$10",function(c,a,d){function e(a,c){if(b)a.MSPOINTER_TYPE_TOUCH===a.pointerType&&c(0,a);else for(var d=-1,e=(a.originalEvent||a).changedTouches||[];++d<e.length;)c(d,e[d])}function k(a){a.preventDefault();
109
  a.stopPropagation();return!1}var f,b=a.navigator.msPointerEnabled,g=b?"MSPointerDown":"touchstart",h=b?"MSPointerMove":"touchmove",s=b?"MSPointerUp":"touchend";c.ok=function(a){null==f&&(f="function"===typeof d.body.addEventListener);f&&a&&a(c);return f};c.dragger=function(a,b){function c(b){a.addEventListener(b,f[b],!1)}function d(b){a.removeEventListener(b,f[b],!1)}var f={};f[g]=function(a){e(a,function(c,d){d.type=g;b(a,d,l)});c(h);c(s);return!0};f[s]=function(a){d(h);d(s);e(a,function(c,d){d.type=
110
- s;b(a,d,l)});return!0};f[h]=function(a){e(a,function(c,d){d.type=h;b(a,d,l)});return k(a)};c(g);var l={kill:function(){d(g);d(h);d(s);a=l=b=null}};return l};c.swiper=function(a,c,d){function f(b){a.addEventListener(b,A[b],!1)}function l(b){a.removeEventListener(b,A[b],!1)}function r(){z&&z.stop();z=null}var z,p,w,A={},B=[],J=[],E=[];A[g]=function(b){p=!1;r();var c=u();e(b,function(a,b){B[a]=c;J[a]=b.clientX;E[a]=b.clientY});w=a.scrollLeft;return!0};A[s]=function(a){e(a,function(a,b){var d=u()-B[a],
111
- e=J[a]-b.clientX,d=Math.abs(e)/d;c(d,e?0>e?-1:1:0)});w=null;return!0};A[h]=function(b){var c,d;null==w||e(b,function(a,b){c=J[a]-b.clientX;d=E[a]-b.clientY});if(d&&Math.abs(d)>Math.abs(c))return p=!0;c&&(p=!0,a.scrollLeft=Math.max(0,w+c));return k(b)};if(!b||d)f(g),f(h),f(s),b&&(a.className+=" mstouch");return{kill:function(){l(g);l(h);l(s);r()},swiped:function(){return p},ms:function(){return b},snap:function(c){b&&!d&&(a.style["-ms-scroll-snap-points-x"]="snapInterval(0px,"+c+"px)",a.style["-ms-scroll-snap-type"]=
112
- "mandatory",a.style["-ms-scroll-chaining"]="none")},scroll:function(b,c,d){r();var e=a.scrollLeft,f=b>e?1:-1,g=Math[1===f?"min":"max"],p=Math.round(16*c*f);return z=q.require("$17","fps.js").loop(function(c){c&&(e=Math.max(0,g(b,e+p)),a.scrollLeft=e,b===e&&(r(),d&&d(e)))},a)}}};var u=Date.now||function(){return(new Date).getTime()};return c}({},u,C));q.register("$8",function(c,a,l){function e(a,b){var c=a.id,d=c&&v[c],e=d&&d.parent();if(!d||!e)return null;var f=(c=e.dir===t)?"X":"Y",c=c?s:u,g=c(e.el),
113
  h=b["offset"+f];null==h&&(h=b["page"+f]-c(a));h&&(g+=h);return{move:function(a){e.resize(a["page"+f]-g,d);return!0}}}function k(a,b){function c(){d(l).unbind("mousemove",f);r=null;return!0}function f(a){r?r.move(a):c();return!0}if(r)return!0;r=e(a.target,a);if(!r)return!0;d(l).one("mouseup",c).mousemove(f);return h(a)}function f(a,b){var c=b.type;"touchmove"===c?r&&r.move(b):"touchstart"===c?r=e(a.target,b):"touchend"===c&&r&&(r=null)}function b(a){var b=d(a.target).closest("div.wg-tr"),c=b.length&&
114
- b.closest("div.is-table");(c=c&&v[c.attr("id")])&&c.selectRow(Number(b.attr("data-row")));return h(a)}function g(a){var b=a.keyCode;if(b=40===b?1:38===b?-1:0){var c=d(a.target),e=c.data("row");if(-1<e&&(c=(c=c.closest("div.is-table"))&&v[c.attr("id")])){for(;!1===c.selectRow(e+=b););return h(a)}}return!0}function h(a){a.stopPropagation();a.preventDefault();return!1}function s(a,b){b||(b=l.body);for(var c=a.offsetLeft||0;(a=a.offsetParent)&&a!==b;)c+=a.offsetLeft||0;return c}function u(a,b){b||(b=
115
- l.body);for(var c=a.offsetTop||0;(a=a.offsetParent)&&a!==b;)c+=a.offsetTop||0;return c}function n(a){function b(){var c=a.innerHTML;c!==e&&(e=c,d(a).trigger("wgChange",[c]));return!0}var c=m.ie()?["keyup","paste"]:["input"],e=a.innerHTML,f=e;return d(a).attr("contenteditable","true").focus(function(){for(var e=d(a),f=-1;++f<c.length;)e.bind(c[f],b);return!0}).blur(function(){for(var g=d(a),h=-1;++h<c.length;)g.unbind(c[h]);b();f!==e&&d(a).trigger("wgChanged",[a]);return!0})}function y(a){this.el=
116
- a;this.id=a.id;this.pos=this.index=0;this.css=["wg-cell"];v[a.id]=this;this.clear()}var m=q.require("$9","html.js"),t=1,v={},r=!1;c.init=function(a){var b=new y(a);b.restyle().redraw();b.root=!0;q.require("$10","touch.js").ok(function(b){b.dragger(a,f)});d(a).mousedown(k);return b};a=y.prototype;a.each=function(a){for(var b=-1;++b<this.length;)a(b,this.cells[b]);return this};a.bind=function(){return this.$("bind",arguments)};a.unbind=function(){return this.$("unbind",arguments)};a.$=function(a,b){d.fn[a].apply(d(this.el),
117
- b);return this};a.parent=function(){return this.pid&&v[this.pid]};a.splitx=function(){return this._split(t,arguments)};a.splity=function(){return this._split(2,arguments)};a._split=function(a,b){this.dir&&this.dir!==a&&this.clear();this.dir=a;var c=-1,d,e=this.length,f=b.length,g=1/(e+f),h=0;if(e)throw Error("Todo: implement re-split");for(;++c<f;){d=m.el();this.body.appendChild(d);for(var k=d,l=b[c],n=l,q=1;v[l];)l=n+"-"+ ++q;k.id=l;d=new y(d);d.index=e+c;d.pid=this.id;d.pos=h;h+=g;this.cells.push(d);
118
- this.length++}this.restyle().redraw();return this.cells};a.clear=function(){for(var a=-1,b;++a<this.length;)b=this.cells[a].clear(),delete v[b.id];this.cells=[];this.length=0;this.nav&&this.el.removeChild(this.nav);this.nav=null;this.body&&(this.field&&m.ie()&&(d(this.body).triggerHandler("blur"),this.field=null),this.table&&(this.table=null),this.el.removeChild(this.body));this.body=this.el.appendChild(m.el("","wg-body"));return this};a.resize=function(a,b){if(!b&&(b=this.cells[1],!b))return;var c=
119
  b.index,e=d(this.el)[this.dir===t?"width":"height"](),f=this.cells[c+1],c=this.cells[c-1];pad=(b.body||b.el.firstChild).offsetTop||0;max=(f?f.pos*e:e)-pad;min=c?c.pos*e:0;b.pos=Math.min(max,Math.max(min,a))/e;(e=this.parent())&&e.table?e.redraw():this.redraw();return this};a.distribute=function(){for(var a,b=0;b<arguments.length;)a=Math.max(0,Math.min(1,arguments[b++])),this.cells[b].pos=a;this.redraw();return this};a.restyle=function(){var a=this.css.slice();this.root&&a.push("wg-root");0===this.index?
120
  a.push("first"):a.push("not-first");this.dir&&(a.push("wg-split"),2===this.dir?a.push("wg-split-y"):a.push("wg-split-x"));this.t&&a.push("has-title");this.nav&&a.push("has-nav");this.table?a.push("is-table"):null!=this.field&&(a.push("is-field"),this.field||a.push("readonly"));this.el.className=a.join(" ");return this};a.redraw=function(){if(this.body){var a=this.el.clientHeight||0,b=this.body.offsetTop||0;b<a&&(a-=b);this.body.style.height=String(a)+"px"}for(var a=this.length,c,e=1,f=2===this.dir?
121
  "height":"width";0<=--a;)b=this.cells[a],this.nav?c=1:(b.fixed&&(b.pos=b.fixed/d(this.el)[f]()),c=e-b.pos,e=b.pos),b.el.style[f]=String(100*c)+"%",b.restyle().redraw();this.table&&this.redrawTable();return this};a.redrawTable=function(){var a=-1,b=this.cells[0],c=this.cells[1],a=d(c.body).width(),e=c.body.firstChild,c=e.childNodes;e.style.width=a+"px";for(var a=b.length,f=1;0<=--a;)e=b.cells[a],c[a].style.width=String(100*(f-e.pos))+"%",f=e.pos;return!0};a.contents=function(a){if(null===a)return this.body.innerHTML;
122
  this.cells.length?this.clear():this.body&&this.el.removeChild(this.body);this.body=this.el.appendChild(m.el("","wg-content"));"string"===typeof a?d(this.body)._html(a):this.append(a);this.redraw();return this};a.textarea=function(a,b){var c=m.txt(a);this.contents(c);(this.field=b)&&n(this.body);this.restyle();return this};a.append=function(a){a.nodeType?m.init(this.body.appendChild(a)):m.init(d(a).appendTo(this.body));return this};a.header=function(a){if(!arguments.length)return this.el.getElementsByTagName("h2")[0];
123
  this.t=m.txt(a||"");this.el.insertBefore(m.el("h2","wg-title"),this.body).appendChild(this.t);this.restyle().redraw();return this};a.title=function(a){this.t?this.t.nodeValue=a||"":this.header(a);return this.t};a.tabulate=function(a){var c=this.id,e=[],f=[];rows=this.splity(c+"-thead",c+"-body");thead=rows[0];tbody=rows[1];thead.css.push("wg-thead");tbody.css.push("wg-tbody");a.eachCol(function(a,b){e.push(c+"-col"+a);f.push(b)});for(var h=-1,k,l=m.el("","wg-cols"),n=thead._split(t,e);++h<n.length;)k=
124
- n[h],k.header(f[h]),l.appendChild(m.el("","wg-col "+(0===h?"":"not-")+"first"));tbody.contents(l);a.eachRow(function(a,b,c){tbody._addRow(b,c)});d(tbody.el).mousedown(b);this.lock();this.table=a;this.restyle().redraw();k=thead.cells[0];tbody.fixed=u(k.body,k.el)||20;this.resize(tbody.fixed);d(l).attr("tabindex","-1").keydown(g);return l};a.lock=function(){this.body.className+=" locked";return this};a.addRow=function(a,b){this.table&&this.cells[1]&&this.cells[1]._addRow(a,b);return this};a._addRow=
125
  function(a,b){var c,d=this.body.firstChild.childNodes,e=d.length,f=d[0].childNodes.length,g=-1;for(b=b&&"wg-tr "+b||"wg-tr";++g<e;)c=d[g].appendChild(m.el("",b)),c.setAttribute("data-row",f),c=c.appendChild(m.el("","wg-td")),a[g]&&/\S/.test(a[g])?c.appendChild(m.txt(a[g])):c.innerHTML="&nbsp;";return d};a.tr=function(a){for(var b=-1,c,d=[],e=this.cells[1].body.firstChild.childNodes;++b<e.length;)(c=e[b].childNodes[a])&&d.push(c);return d};a.td=function(a,b){try{return this.cells[1].body.firstChild.childNodes[b].childNodes[a].firstChild}catch(c){return null}};
126
  a.selectRow=function(a,b){var c=this.table&&this.table.row(a);if(!c)return null;var e=this.tr(a);if(e.length){var e=d(e),f=this.cells[1],g=f.body,h=d(g.firstChild);if(h.hasClass("filtered")&&!e.hasClass("filtered"))return!1;h.find("div.selected").removeClass("selected");e.addClass("selected");h.data("row",a);if(b)f.scrollTo(e[0],!0);else{var k=g.scrollTop;h.focus();k&&(g.scrollTop=k);f.scrollTo(e[0])}h.trigger("wgRowSelect",[a,c])}return this};a.deselectRow=function(){if(this.table){var a=d(this.cells[1].body.firstChild),
127
- b=a.data("row");a.find("div.selected").removeClass("selected");a.data("row",null);a.trigger("wgRowDeselect",[b])}};a.filterRows=function(a){var b=-1,c;c=d(this.cells[1].body.firstChild);if(!a)return c.removeClass("filtered"),this;for(c.addClass("filtered").find("div.filtered").removeClass("filtered");++b<a.length;)c=a[b],c=this.tr(c),c.length&&d(c).addClass("filtered");return this};a.scrollTo=function(a,b){var c,e=this.body.scrollTop,f=this.body.clientHeight+e,g=u(a,this.body),h=g+d(a).outerHeight();
128
  e>g?c=g:f<h&&(c=h-this.body.clientHeight);null!=c&&(b?this.body.scrollTop=c:d(this.body).animate({scrollTop:c},300));return this};a.navigize=function(a){function b(a,c){e=a.show();f=c.addClass("active");a.trigger("wgTabSelect",[a.data("index")]);return a}var c=this;c.nav&&c.el.removeChild(c.nav);c.nav=c.el.insertBefore(m.el("nav","wg-tabs"),c.body);var e,f,g=d(c.nav).click(function(a){var g=d(a.target),k=g.data("tab");if(k){var l=f;e&&e.hide();l&&l.removeClass("active");b(k,g).children().focus();
129
- c.redraw();return h(a)}});c.each(function(c,f){f.pos=0;var h=d(f.el).data("index",c),k=d('<a href="#'+f.id+'"></a>').data("tab",h).text(a[c]).appendTo(g);e?h&&h.hide():b(h,k)});c.lock();c.restyle().redraw();g=null;return c};a=null;return c}({},u,C));q.register("$6",function(c,a,l){function e(a){var c=l.createElement("pre");c.innerHTML=a.replace(/<(p|div|br) ?\/?>/ig,"\n<$1>").replace(/(^\n+|\n+$)/g,"");a="string"===typeof c.textContent?c.textContent:"string"===typeof c.innerText?c.innerText:d(c).text();
130
- return a}c.init=function(c){function f(){var a=p.length,b=0,c=0,d=0;p.each(function(a,e){e.translation()?e.fuzzy()?d++:b++:c++});return{t:a,p:String(b?Math.round(100*(b/a)):0)+"%",f:d,u:c}}function b(){w.clear();p.each(function(a,b,c){w.add(c,b.toText())});A="";B=p.length}function g(a,b){var c,d={};if(A===a)return B||0;if(!p.length)return 0;if(a){if(A&&!B&&0===a.indexOf(A))return 0;c=w.find(a,d);d.words.length||(a="")}A=a;B=c?c.length:p.length;I.filterRows(c);d=D?p.indexOf(D):-1;if(-1===d||c&&-1===
131
- c.indexOf(d))c?c.length?I.selectRow(c[0],!0):I.deselectRow():I.selectRow(0,!0);b||t("poFilter",[A,B]);return B}function h(a){if(!a)return["",""];var b=[a.source()||"",a.translation()||""];(a=a.context())&&(b[0]+=" [ "+a+" ]");return b}function l(a){if(a=a||D){var b=p.indexOf(a),b=I.tr(b),c=b[0].className.replace(/\s*po-[a-z]+/g,""),c=c+(" "+n(a)+" po-unsaved");d(b).attr("class",c);t("poUnsaved",[++F])}}function u(a,b){b=b||D;if(!b)return null;var c=b.fuzzy();null!=a&&c!=a&&(b.fuzzy(a),t("poFuzzy",
132
- [b,a]),t(H,[b]),l(b));return c}function n(a){var b=[];a&&(a.fuzzy()&&b.push("po-fuzzy"),a.translation()||b.push("po-empty"),a.comment()&&b.push("po-comment"));return b.join(" ")}function y(a,b){var c=h(a)[b||0],e=p.indexOf(a),e=I.td(e,b);c&&/\S/.test(c)?d(e).text(c.replace("\n"," ")):d(e).html("&nbsp;")}function m(a){a!==C&&(E=(C=a)?p.lock(E):p.unlock()||E,t("poLock",[a,E]),D&&z(D))}function t(a,b){return d(c).trigger(a,b||[])}function v(){if(p&&p.row){A&&(A="",B=p.length,t("poFilter",[A,B]));var a;
133
  I.table&&(a=K?K.parentNode.scrollTop:0,I.clear());K=I.tabulate(M);a&&(K.parentNode.scrollTop=a);t("poLoad");(a=p.locale())?(E=a,m(!0)):m(!1);return!!p.length}I.clear().header("Error").contents("Invalid PO")}function r(){Q.unbind().clear();P.unbind().clear();S.unbind();D&&(t("poDeselected",[D]),D=null)}function z(a){function c(){var d=E&&E.lang&&"en"!==E.lang&&E.label;P.title(d?d+" translation:":"Translation:");if(m){var h=[],k=q.require("$7","collection.js").init();a.each(function(a,b){h.push("Form "+
134
- a);k.add("plural-"+a,b)});O=P.splitx.apply(P,k.keys);P.each(function(a,b){b.textarea(k[a],g)});P.navigize(h).bind("wgTabSelect",function(a,b){f=b})}else P.textarea(a.translation(),g);P.bind("wgChange",function(b,c){var d=e(c);a.translate(d,f);0===f&&y(a,1);a.fuzzy()?u(!1,a):l(a)}).bind("wgChanged",function(c){w&&b();t(H,[a])})}function d(){P.title("Context:");P.textarea(a.context(),!0);P.bind("wgChange",function(b,c){var d=e(c);a.context(d);a.source();y(a,0);l(a)}).bind("wgChanged",function(){p.reIndex(a);
135
- w&&b();t(H,[a])})}r();D=a;S.textarea(a.comment(),!0).bind("wgChange",function(b,c){var d=e(c);a.comment(d);t("poComment",[a,d]);l(a)});var f=0,g=C,h=!C,k=a.source()||"",m=a.plural()||"";(function(){m?(O=Q.splity(Q.id+"-singular",Q.id+"-plural"),O[0].header("Singular:").textarea(k,h),O[1].header("Plural:").textarea(m,h),Q.lock()):Q.textarea(k,h);Q.title("Source text:");h&&Q.bind("wgChange",function(b,c){var d=e(c);Q.id+"-plural"===b.target.parentNode.id?a.plural(d):(a.source(d),y(a,0));l(a)}).bind("wgChanged",
136
- function(c){Q.id+"-plural"===c.target.parentNode.id||p.reIndex(a);w&&b();t(H,[a])})})();g?c():d();t("poSelected",[a]);data=null}var p,w,A,B,C,E,D,F=0,H="poUpdate",K,M={row:function(a){return h(p.row(a))},eachCol:function(a){a(0,"Source text");a(1,"Translation")},eachRow:function(a){var b=0;p.each(function(c,d){a(b++,h(d),n(d))})}},N=q.require("$8","LocoWinGrid.js").init(c),O=N.splity("po-list","po-edit"),I=O[0],R=O[1],O=R.splitx("po-trans","po-comment"),T=O[0],S=O[1].header("Comment:"),O=T.splity("po-source",
137
- "po-target"),Q=O[0].header("Source text:"),P=O[1].header("Translation:");N.distribute(0.34);R.distribute(0.8);d(a).resize(function(){N.redraw(!0);return!0});I.bind("wgRowSelect",function(a,b,c){a=p.row(b);z(a);return!0}).bind("wgRowDeselect",function(){r();S.textarea("",!1);Q.textarea("",!1).title("Source text not loaded:");P.textarea("",!1).title("Translation not loaded:");t("poSelected",[null]);return!0});return{bind:function(a,b){return d(c).bind(a,b)},load:function(a){p=a;w&&b();v()&&I.selectRow(0)},
138
- save:function(a){if(F||a)d(K).find("div.po-unsaved").removeClass("po-unsaved"),t("poSave");F=0;return p},fuzzy:function(a){return u(a)},del:function(a,c){var d=arguments.length?p.get(a,c):D;if(d){var e=A,f=p.del(d);null!=f&&(t("poDel",[d]),t(H,[d]),v(),w&&b(),D&&D.equals(d)&&r(),p.length&&(e&&g(e),D||(f=Math.min(f,p.length-1),I.selectRow(f))))}},add:function(a,b){var c,d=p.get(a,b);d?c=p.indexOf(d):(c=p.length,d=p.add(a,b),I.addRow(M.row(c),n(d)),l(d),w&&w.add(p.indexOf(d),d.toText()),t("poAdd",[d]),
139
- t(H,[d]));A&&g("");I.selectRow(c);return d},lock:function(){m(!0)},unlock:function(){m(!1)},locked:function(){return Boolean(C)},filter:function(a){return w&&p&&p.length&&g(a,!0)},searchable:function(a){a&&(w=a,p&&b());return w&&!0},stats:function(){return f()}}};return c}({},u,C));q.require("$1","array.js");var ba=u.ajaxurl||"/wp-admin/admin-ajax.php";S=(u.loco||{}).conf||{};var T=S.locale,M=q.require("$2","po.js").create(T),H={},R=C.getElementById("loco-poedit-inner"),U=u.loco__||function(c){return c};
140
- d(u).resize(function(){function c(){var c;c=R;for(var k=c.offsetTop||0;(c=c.offsetParent)&&void 0!==c;)k+=c.offsetTop||0;c=k;k=d(u).innerHeight();c=Math.max(l,k-c-a);R.style.height=String(c)+"px";return!0}var a=20,l=parseInt(d(R).css("min-height")||0);c();return c}());H.save=function(c){function a(){c.disabled=!1}a();F.bind("poUnsaved",function(){d(c).addClass("button-primary loco-flagged")}).bind("poSave",function(){d(c).removeClass("button-primary loco-flagged")});d(c.form).submit(function(l){var e=
141
- l.target;l.target.po.value=M.toString();c.disabled=!0;Z(e,function(c){a();d("#loco-po-modified").text(c.modified);F.save(!0);X(U("File saved")+", "+c.filename)},a);return N(l)});return!0};H.download=function(c){c.disabled=!1;d(c).click(function(){c.form.po.value=M.toString();d(R).trigger("poSave");return!0});return!0};H.add=!T&&function(c){c.disabled=!1;d(c).click(function(a){var c=1,d;for(d="New message";M.get(d);)c=/(\d+)/.exec(d)?Math.max(c,RegExp.$1):c,d="New message "+ ++c;F.add(d);return N(a)});
142
- return!0};H.del=!T&&function(c){c.disabled=!1;d(c).click(function(a){F.del();return N(a)});return!0};H.fuzzy=T&&function(c){function a(a){c.disabled=null==a;d(c)[a?"addClass":"removeClass"]("loco-inverted")}F.bind("poSelected",function(c,d){a(d&&F.locked()?d.fuzzy():null)}).bind("poFuzzy",function(c,d,k){a(F.locked()?k:null)});d(c).click(function(a){var c=!F.fuzzy();F.fuzzy(c);return N(a)});return!0};H.sync=function(c){function a(){c.disabled=!1}a();F.bind("poUnsaved",function(){c.disabled=!0}).bind("poSave",
143
- function(){a()});d(c.form).submit(function(l){c.disabled=!0;Z(l.target,function(c){a();var k=q.require("$2","po.js").create(void 0);k.load(c.exp);var f=[],b=M.merge(k),k=b.add.length,b=b.del.length;F.load(M);k||b?(f.push("Merged from "+(c.pot||"source code")),k&&f.push(k+" new string"+(1===k?"":"s")+" added"),b&&f.push(b+" obsolete string"+(1===b?"":"s")+" removed"),d(R).trigger("poUnsaved",[])):f.push("Already up to date with "+(c.pot||"source code"));M.headers(c.headers||{});X(f.join(". "))},a);
144
- return N(l)});return!0};H.revert=function(c){F.bind("poUnsaved",function(){c.disabled=!1}).bind("poSave",function(){c.disabled=!0});d(c).click(function(a){location.reload();return N(a)});return!0};H.help=function(){return!0};R.innerHTML="";var F=q.require("$6","poedit.js").init(R);d("#loco-nav").find("button").each(function(c,a){var l=a.getAttribute("data-loco");H[l]&&H[l](a)||d(a).hide()});H=null;(function(c){d(c.form).submit(function(a){return N(a)});var a=q.require("$3","dict.js").create();a.depth=
145
- 10;a.translit(q.require("$4","translit.json"));F.searchable(a);c.disabled=!1;c.value="";var l=q.require("$5","LocoTextListener.js").listen(c,function(a){F.filter(a)});F.bind("poFilter",function(a,c){l.val(c)});c=a=null})(C.getElementById("loco-search"));F.bind("poUnsaved",function(){u.onbeforeunload=function(){return U("Your changes will be lost if you continue without saving")}}).bind("poSave",function(){u.onbeforeunload=null}).bind("poUpdate",Y);T?M.load(S.po||{}):M.load(S.pot||{});M.headers(S.headers);
146
- F.load(M);Y();d("#wpbody-content").find("div.loco-message").each(function(c,a){V(a,!0)})})(window,document,window.jQuery);
1
+ (function(v,C,d,U){function N(c){c.stopPropagation();c.preventDefault();return!1}function aa(c,a){function l(){e();k=setTimeout(function(){d(c).fadeOut(1E3,a)},f)}function e(){k&&clearTimeout(k);k=null}var k,f=5E3;l();d(c).mouseenter(e).mouseleave(l)}function W(c,a){function l(a){d(c).remove();d(v).triggerHandler("resize");return a&&N(a)}d('<a class="dismiss" href="#">&times;</a>').appendTo(c).click(l);a||aa(c,l)}function V(c,a,l,e){var k="loco-js-"+l;l=C.getElementById(k)||d('<div id="'+k+'" class="loco-message '+
2
+ (e||l)+'"></div>').insertBefore(d("#loco-poedit"));c=d(C.createElement("p")).text(c);a=d(C.createElement("strong")).text(a+": ");c.prepend(a).appendTo(d(l).html(""));d(v).triggerHandler("resize");W(l);d("div.loco-warning").remove()}function X(c){return V(c,R("OK"),"updated loco-success")}function Y(){var c=F.stats(),a=c.t,l=c.f,e=c.u,a=a+" string"+(1===a?"":"s"),k=[];S&&(a=c.p+" translated, "+a,l&&k.push(l+" fuzzy"),e&&k.push(e+" untranslated"),k.length&&(a+=" ("+k.join(", ")+")"));d("#loco-po-status").text(a)}
3
+ function Z(c,a,l){function e(c,a,b){b=b||R("Unknown Ajax error");V(b,R("Error"),"error");l&&l(c,a,b)}return d.ajax({url:ba,type:c.method,data:d(c).serialize(),dataType:"json",error:e,success:function(c,f,b){!c||c.error?e(b,f,c&&c.error&&c.error.message):a&&a(c,f,b)}})}var q=function(){var c={};return{register:function(a,d){c[a]=d},require:function(a,d){var e=c[a];if(!e)throw Error('CommonJS error: failed to require("'+d+'")');return e}}}();q.register("$1",function(c,a,d){Array.prototype.indexOf||
4
+ (Array.prototype.indexOf=function(c){if(null==this)throw new TypeError;var a,f=Object(this),b=f.length>>>0;if(0===b)return-1;a=0;1<arguments.length&&(a=Number(arguments[1]),a!=a?a=0:0!=a&&Infinity!=a&&-Infinity!=a&&(a=(0<a||-1)*Math.floor(Math.abs(a))));if(a>=b)return-1;for(a=0<=a?a:Math.max(b-Math.abs(a),0);a<b;a++)if(a in f&&f[a]===c)return a;return-1});return c}({},v,C));q.register("$7",function(c,a,d){function e(a){this.reIndex([]);if(a)for(var c in a)this.add(c,a[c])}c.init=function(a){return new e(a)};
5
  a=e.prototype;a.reIndex=function(a){var c=-1;for(this.ords={};++c<a.length;)this.ords[a[c]]=c;this.keys=a;this.length=c};a.key=function(a,c){if(null==c)return this.keys[a];var b=this.keys[a],g=this.ords[c];if(c!==b){if(null!=g)throw Error("Clash with item at ["+g+"]");this.keys[a]=c;delete this.ords[b];this.ords[c]=a}return a};a.indexOf=function(a){a=this.ords[a];return null==a?-1:a};a.add=function(a,c){var b=this.ords[a];null==b&&(this.keys[this.length]=a,b=this.ords[a]=this.length++);this[b]=c;
6
+ return b};a.get=function(a){return this[this.ords[a]]};a.cut=function(a,c){var b=[].splice.call(this,a,c);this.keys.splice(a,c);this.reIndex(this.keys);return b};a.each=function(a){for(var c=-1;++c<this.length;)a(this.keys[c],this[c],c);return this};a=null;return c}({},v,C));q.register("$2",function(c,a,d){function e(b){return{"Project-Id-Version":"PACKAGE VERSION","Report-Msgid-Bugs-To":"","POT-Creation-Date":b||"","POT-Revision-Date":b||"","PO-Revision-Date":b||"","Last-Translator":"","Language-Team":"",
7
  Language:"","Plural-Forms":"","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Poedit-SourceCharset":"UTF-8"}}function k(b,a){var c=b||"";a&&(c+="\x00"+a);return c}function f(){return q.require("$7","collection.js").init()}function b(b){if(!b)return'""';for(var a=b.replace("\r\n","\n").split("\n"),c=a.length-1,h=[],f=-1,d;++f<a.length;){b=a[f];for(c&&c!==f&&(b+="\n");b&&b.charAt(79);){for(d=80;--d;)if(-1!==" \n\r.?!,;:-".indexOf(b.charAt(d))){d++;
8
  break}d||(d=79);h.push(g(b.substr(0,d)));b=b.substr(d)}b&&h.push(g(b))}h[1]&&h.unshift("");return'"'+h.join('"\n"')+'"'}function g(b){return b.replace(/(["\\])/g,"\\$1").replace(/\n/g,"\\n")}function h(b){this.head={};this.headers(e(this.now()));this.locale(b);this.length=0;this.rows=f()}function s(b,a){this.src=[b||""];this.msg=[a||""];this.cmt="";this.status=0}c.create=function(b){return new h(b)};a=h.prototype;a.now=function(){return(new Date).toString()};a.header=function(b,a){if(null==a)return this.headers()[b]||
9
  "";this.head[b]=a||"";return this};a.headers=function(b){var a;if(null!=b){for(a in b)this.head[a]=b[a];return this}var c=this.locale(),g=this.now();b={};for(a in this.head)b[a]=String(this.head[a]);c?(b.Language=c.label||"Unknown locale",b["Plural-Forms"]="nplurals="+(c.nplurals||"2")+"; plural="+(c.pluraleq||"n!=1"),b["X-Loco-Target-Locale"]=(c.lang||"en")+"_"+(c.region||"GB"),b["PO-Revision-Date"]=g,delete b["POT-Revision-Date"]):(b.Language="",b["Plural-Forms"]="nplurals=INTEGER; plural=EXPRESSION",
10
  b["POT-Revision-Date"]=g,b["PO-Revision-Date"]="YEAR-MO-DA HO:MI+ZONE");b["X-Generator"]="Loco - https://localise.biz/";return b};a.locale=function(b){if(null==b)return this.loc;this.loc=b||{lang:"en",region:"GB",nplurals:2,pluraleq:"n == 1 ? 0 : 1",label:"English"};this.loc.toString=function(){return this.lang+"_"+this.region};return this};a.lock=function(b){this.locale(b||!1);return this.loc};a.unlock=function(){var b=this.loc;this.loc=null;return b};a.reIndex=function(b,a){var c=this.indexOf(b),
11
  g=b.hash(),h=this.rows.indexOf(g);return h===c?c:-1!==h?(a=(a||0)+1,b.source("Error, duplicate "+String(a)+": "+b.source()),this.reIndex(b,a)):this.rows.key(c,g)};a.get=function(b,a){var c=k(b,a);return this.rows.get(c)};a.indexOf=function(b){null==b.idx&&(b.idx=this.rows.indexOf(b.hash()));return b.idx};a.del=function(b){b=this.indexOf(b);if(-1!==b){var a=this.rows.cut(b,1);if(a&&a.length)return this.length=this.rows.length,this.rows.each(function(b,a,c){a.idx=c}),b}};a.add=function(b,a){b instanceof
12
+ s||(b=new s(b));a&&b.context(a);var c=b.hash();if(this.rows.get(c))throw Error("Duplicate message at index "+this.indexOf(b));b.idx=this.rows.add(c,b);this.length=this.rows.length;return b};a.each=function(b){this.rows.each(b);return this};a.load=function(b){for(var a=-1,c,g,h,f,d=[],z=[],p=[],y=[];++a<b.length;)if(c=b[a],null==c.parent){if(g=c.source||c.id,h=c.context,g||h)f=new s(g,c.target||""),h&&f.context(h),c.flag&&f.flag(c.flag,!0),c.comment&&f.comment(c.comment),c.message=f,f.translation()?
13
+ f.fuzzy()?p.push(f):z.push(f):y.push(f)}else d.push(c);for(a=-1;++a<d.length;)try{c=d[a];g=c.source||c.id;f=b[c.parent]&&b[c.parent].message;if(!f)throw Error("parent missing for plural "+g);1===c.plural&&f.plural(g);f.translate(c.target||"",c.plural)}catch(k){}g=[y,p,z];for(a=0;3>a;a++)for(c=g[a],b=-1;++b<c.length;)try{this.add(c[b])}catch(e){}return this};a.merge=function(b){var a,c=this.rows,g=f(),h={add:[],del:[]};b=b.rows;this.rows.each(function(a,c){b.get(a)||h.del.push(c)});b.each(function(b,
14
+ f){try{a=c.get(b),a||(a=f,h.add.push(a)),a.idx=g.add(b,a)}catch(z){}});this.rows=g;this.length=g.length;return h};a.row=function(b){return this.rows[b]};a.toString=function(){var b,a=[],c=[],g=this.headers(),f=!this.loc;for(b in g)c.push(b+": "+g[b]);c=new s("",c.join("\n"));f&&(c.comment("Loco Gettext template"),c.fuzzy(!0));a.push(c.toString());a.push("");this.rows.each(function(b,c){a.push(c.toString(f));a.push("")});return a.join("\n")};a=s.prototype;a.hash=function(){return k(this.source(),this.context())};
15
  a.flag=function(b,a){var c=b===(b&this.status);if(null==a)return c;a?this.status|=b:c&&(this.status^=b);return this};a.fuzzy=function(b){return this.flag(4,b)};a.source=function(b,a){if(null==b)return this.src[0];this.src[0]=b;this.plural(a);return this};a.plural=function(b){if(null==b)return this.src[1];this.src[1]=b||"";return this};a.each=function(b){for(var a=-1;++a<this.msg.length;)b(a,this.msg[a]);return this};a.translate=function(b,a){this.msg[a||0]=b||"";return this};a.translation=function(b){return this.msg[b||
16
  0]||""};a.comment=function(b){if(null==b)return this.cmt||"";this.cmt=b||"";return this};a.context=function(b){if(null==b)return this.src[2]||"";this.src[2]=b||"";return this};a.toString=function(a){var c,g=[];this.cmt&&(g=["# "+this.cmt.replace("\r\n","\n").split("\n").join("\n# ")]);!a&&this.fuzzy()&&g.push("#, fuzzy");this.src[2]&&g.push("msgctxt "+b(this.src[2]));g.push("msgid "+b(this.src[0]));if(null==this.src[1])g.push("msgstr "+b(a?"":this.msg[0]));else for(c=-1,g.push("msgid_plural "+b(this.src[1]));++c<
17
  this.msg.length;)g.push("msgstr["+c+"] "+b(a?"":this.msg[c]));return g.join("\n")};a.toText=function(){return this.src.join(" ")+" "+this.msg.join(" ")};a.weight=function(){var b=0;this.translation()||(b+=2);this.fuzzy()&&(b+=1);return b};a.compare=function(b,a){var c=this.weight(),g=b.weight();if(c>g)return 1;if(c<g)return-1;if(a){c=this.hash().toLowerCase();g=b.hash().toLowerCase();if(c<g)return 1;if(c>g)return-1}return 0};a.equals=function(b){return this===b||this.source()===b.source()&&this.context()===
18
+ b.context()};a=a=null;return c}({},v,C));q.register("$3",function(c,a,d){function e(){var a,c;this.clear=function(){this.length=0;a={};c=[]};this.getTree=function(){return a};this.getData=function(){return c};this.clear()}c.create=function(){return new e};a=e.prototype;a.depth=0;a.matchall=!0;a.ignorecase=!0;a.nonword=/[\-.?!;:,_*^+=~`"'(){}<>[\]\/\\\u00a0\u1680\u180e\u2000-\u206f\u2e00-\u2e7f\u3000-\u303f]+/g;a.translit=function(a,c){function b(b){return a[b]||b}c=c||/[^a-z0-9]/g;this.trans=function(a){return a.replace(c,
19
+ b)}};a.stoppers=function(a){this.stopped=function(c){return Boolean(a[c])}};a.add=function(a,c){null==c&&(c=String(a));var b=-1,g,h,d,e,n,u=this.normalize(c);g=this.getData();var m=g.length;g.push(a);for(this.length++;++b<u.length;)if(g=u[b],!this.stopped(g)){h=this.getTree();d=Math.min(g.length,this.depth)||g.length;for(e=0;e<d;e++)n=g.charAt(e),h=h[n]||(h[n]={});g=h[" "]||(h[" "]=[]);g.push(m)}return this};a.find=function(a,c){function b(a,c){var g,h,z;for(u in a)if(z=a[u]," "===u)for(g in z)m=
20
+ z[g],h=t[m]||(t[m]={length:0,words:{}}),h.length+=h.words[c]?0:1,h.words[c]=1+(h.words[c]||0);else b(z,c)}var g=-1,h,d,e,n,u,m,t={},l=[],r=this.normalize(a),z=this.getData();a:for(;++g<r.length;){h=r[g];d=this.getTree();e=Math.min(h.length,this.depth)||h.length;for(n=0;n<e;n++){u=h.charAt(n);if(!d[u])continue a;d=d[u]}b(d,h)}for(m in t)this.matchall&&t[m].length<r.length||l.push(z[m]);c&&(c.query=a,c.words=r);return l};a.normalize=function(a){for(var c=-1,b={},g=[],h=this.split(a);++c<h.length;)if(a=
21
+ h[c])if(this.ignorecase&&(a=a.toLowerCase()),a=this.strip(a))this.trans&&(a=this.trans(a)),b[a]||(g.push(a),b[a]=!0);return g};a.stopped=function(a){return 1===a.length};a.split=function(a){return a.split(/\s+/)};a.strip=function(a){return a.replace(this.nonword,"")};a=null;return c}({},v,C));q.register("$4",{"\u0131":"i","\u03b1":"a","\u03b2":"b","\u03c8":"c","\u03b4":"d","\u03b5":"e","\u03c6":"f","\u03b3":"g","\u03b7":"h","\u03b9":"i","\u03be":"j","\u03ba":"k","\u03bb":"l","\u03bc":"m","\u03bd":"n",
22
  "\u03bf":"o","\u03c0":"p","\u03c1":"r","\u03c3":"s","\u03c4":"t","\u03b8":"u","\u03c9":"v","\u03c2":"s","\u03c7":"x","\u03c5":"y","\u03b6":"z","\u0444":"a","\u0438":"b","\u0441":"c","\u0432":"d","\u0443":"e","\u0430":"f","\u043f":"g","\u0440":"h","\u0448":"i","\u043e":"j","\u043b":"k","\u0434":"l","\u044c":"m","\u0442":"n","\u0449":"o","\u0437":"p","\u0439":"\ua647","\u043a":"r","\u044b":"s","\u0435":"t","\u0433":"u","\u043c":"v","\u0446":"w","\u0447":"x","\u043d":"y","\u044f":"z","\u00aa":"a","\u00e1":"a",
23
  "\u00e0":"a","\u0103":"a","\u1eaf":"a","\u1eb1":"a","\u1eb5":"a","\u1eb3":"a","\u00e2":"a","\u1ea5":"a","\u1ea7":"a","\u1eab":"a","\u1ea9":"a","\u01ce":"a","\u00e5":"a","\u01fb":"a","\u00e4":"a","\u01df":"a","\u00e3":"a","\u0227":"a","\u01e1":"a","\u0105":"a","\u0101":"a","\u1ea3":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1eb7":"a","\u1ead":"a","\u1e01":"a","\ua733":"a","\u00e6":"a","\u01fd":"a","\u01e3":"a","\ua735":"a","\ua737":"a","\ua739":"a","\ua73b":"a","\ua73d":"a","\u1e9a":"a","\u2c65":"\u2c65",
24
  "\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"\u0180","\u0183":"\u0183","\u0107":"c","\u0109":"c","\u010d":"c","\u010b":"c","\u00e7":"c","\u1e09":"c","\u023c":"\u023c","\ua792":"\ua793","\u0188":"\u0188","\ua73f":"\ua73f","\u010f":"d","\u1e0b":"d","\u1e11":"d","\u1e0d":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u00f0":"d","\ua77a":"d","\u0238":"d","\u01f3":"d","\u01f2":"d","\u01c6":"d","\u01c5":"d","\u018c":"\u018c","\u00e9":"e","\u00e8":"e","\u0115":"e","\u00ea":"e","\u1ebf":"e","\u1ec1":"e",
54
  "\u04b5":"\u04b5","\ua691":"\ua691","\u2df1":"x","\ua693":"\ua693","\u04f5":"\ua693","\u04b7":"\u04b7","\u04cc":"\u04cc","\u04b9":"\u04b9","\ua687":"\ua687","\u04bd":"\u04bd","\u04bf":"\u04bf","\u045f":"\u045f","\u2df2":"i","\ua697":"\ua697","\u2df3":"o","\ua64f":"\ua64f","\ua678":"\u044a","\u044a":"\u044a","\ua651":"\ua651","\ua679":"s","\u04f9":"s","\ua67a":"m","\u048d":"\u048d","\u2dfa":"\u0463","\u0463":"\u0463","\ua653":"\ua653","\u044d":"\u044d","\u04ed":"\u044d","\u2dfb":"\u044e","\u044e":"\u044e",
55
  "\ua655":"\ua655","\u2dfc":"\ua657","\ua657":"\ua657","\u0519":"\u0519","\ua69f":"\u0465","\u0465":"\u0465","\u2dfd":"\u0467","\u0467":"\u0467","\ua659":"\ua659","\u2dfe":"\u046b","\u046b":"\u046b","\ua65b":"\ua65b","\u0469":"\u0469","\ua65d":"\ua65d","\u2dff":"\u046d","\u046d":"\u046d","\u046f":"\u046f","\u0471":"\u0471","\u2df4":"\u0473","\u0473":"\u0473","\u0475":"\u0475","\u0477":"\u0475","\ua65f":"\ua65f","\u04a9":"\u04a9","\u051d":"\u051d","\u04cf":"\u04cf"});q.register("$5",function(c,a,l){c.listen=
56
  function(a,c){function f(){n[s?"show":"hide"]()}function b(){a.value!==s&&(g&&clearTimeout(g),s=a.value,G&&a.setAttribute("size",s.length||1),f(),g=setTimeout(function(){c(s)},h))}a=a instanceof jQuery?a[0]:a;var g,h=150,s=a.value,G=1===Number(a.size),n=d('<a href="#clear" tabindex="-1" class="icon clear"><span>clear</span></a>').click(function(c){a.value="";b();return!1});d(a).keyup(function(a){b();return!0}).after(n);f();return{ping:b,val:function(b){if(null==b)return s;g&&clearTimeout(g);a.value=
57
+ s=b;f()}}};return c}({},v,C));q.register("$18",function(c,a,d){function e(g){b||a._gat&&(b=_gat._createTracker(k,"loco"));if(b){var h=g.shift();b[h].apply(b,g)}else f&&f.push(g);return c}var k,f,b;c._init=function(b){if(k=b.code){f=a._gaq||(a._gaq=[]);f.push(["_setAccount",k]);f.push(["_trackPageview"]);f.push(["_setDomainName",b.host]);b=d.createElement("script");b.type="text/javascript";b.async=!0;b.src=("https:"==d.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var h=
58
+ d.getElementsByTagName("script")[0];h.parentNode.insertBefore(b,h)}return c};c.event=function(b,a,c,d){return e(["_trackEvent",b||"",a||"",c||"",d||0])};c.page=function(b,a){return e(["_trackPageview",{page:b||location.pathname+location.hash,title:a||d.title}])};return c}({},v,C));q.register("$19",function(c,a,d){function e(b,g){if(k)k[b](g);else a.ga&&ga(b,g);return c}var k,f;c._init=function(b){b.code&&(function(b,a,c,d,f,e,m){b.GoogleAnalyticsObject=f;b[f]=b[f]||function(){(b[f].q=b[f].q||[]).push(arguments)};
59
  b[f].l=1*new Date;e=a.createElement(c);m=a.getElementsByTagName(c)[0];e.async=1;e.src=d;m.parentNode.insertBefore(e,m)}(a,d,"script","//www.google-analytics.com/analytics.js","ga"),ga("create",b.code,{alwaysSendReferrer:!0}),b.custom&&e("set",b.custom),c.page(),ga(function(b){k=b}));return c};c.event=function(b,a,c,d){return e("send",{hitType:"event",eventCategory:b||"",eventAction:a||"",eventLabel:c||"",eventValue:Number(d||0)})};c.page=function(b,a){var c={hitType:"pageview",page:b||location.pathname+
60
+ location.hash,title:a||d.title};c.location=location.protocol+"//"+location.hostname+c.page;f&&e("set",{referrer:f});f=c.location;return e("send",c)};c.reset=function(){f=location.href;e("set",{page:location.pathname+location.hash,title:d.title,location:f});return c};return c}({},v,C));q.register("$11",function(c,a,l){var e;c.init=function(a){!e&&a&&(a.host||(a.host=location.hostname),e=a.legacy?q.require("$18","legacy.js"):q.require("$19","universal.js"),e._init(a));return c};c.link=function(a){var f,
61
+ b=a.getAttribute("href");if(!b||"#"===b)return c;if(0===b.indexOf("#"))f="anchor";else{if(0!==b.indexOf("http")&&0!==b.indexOf("//")||-1!==b.indexOf())return c;f="external";a.setAttribute("target","_blank")}d(a).click(function(){e.event(f,"click",b);return!0});a=null;return c};c.page=function(){e&&e.page.apply(e,arguments);return c};c.event=function(){e&&e.event.apply(e,arguments);return c};c.reset=function(){e&&e.reset&&e.reset();return c};return c}({},v,C));q.register("$23",function(c,a,l){function e(b,
62
+ a,c,e,k){function n(){t&&clearTimeout(t);w&&w.fadeOut(400,function(){d(this).remove();w=null});return!1}function u(){m();-1!==e&&(t=setTimeout(n,e||2E3));w.unbind("mouseleave");w.mouseenter(m)}function m(){t&&clearTimeout(t);t=null;w.unbind("mouseenter");w.mouseleave(u)}var t;f||(f=l.createElement("div"),f.id="growls",l.body.appendChild(f));var w=d('<div class="growl growl-'+c+'"><div><a class="close" href="#"><span>X</span></a><span class="badge"></span><p class="message"></p><small class="caption"></small></div></div>');
63
+ w.find("p").text(b||"Empty message");a?w.find("small").text(a):w.find("small").remove();if(k.length){k.push({label:"Cancel",callback:n,css:"cancel"});var r,z=d('<form action="#" class="dialog"></form>');a=function(b,a){r=d('<input type="button" value="'+a.label+'" class="butt '+(a.css||"")+'" />');r.click(function(b){"function"===typeof a.callback&&a.callback(b,{close:n})});z.append(r);return r};for(b=0;b<k.length;b++)a(b,k[b]);w.append(z)}d(f).prepend(w.hide().fadeIn(400));w.find("a").click(n);u()}
64
  var k,f;c.init=function(){if(!k)return k=a.alert,a.alert=function(b){b=String(b).split("\n");var a=b[1]&&b.slice(1).join("\n");c.alert(b[0],a)},c};c.debug=function(b){k(b);return c};c.alert=function(b,c,d,f,G){try{return e(b,c||"",d||"alert",f||4E3,G||[]),!0}catch(n){return b+="\n\n--\n"+(n.message||n),k.call(a,b),!1}};c.success=function(b,a,d){return c.alert(b,a,"success",d||2E3)};c.dialog=function(b,a,d,f){return c.alert(b,a,f||"alert",-1,d)};c.login=function(b,a,d,f){c.dialog(a||"You're not logged in",
65
+ d||"Please log in to continue",[{label:f||"Log in",callback:function(a,c){location.assign(b||"/session/auth/login?r="+encodeURIComponent(location.href))}}])};return c}({},v,C));q.register("$21",function(c,a,l){function e(b){return 27===b.keyCode&&u&&m?(q(),b.preventDefault(),!1):!0}function k(c){if(u){var z=Math.max(b.height(),g.outerHeight(!0));z&&s.css("height",z+"px");c&&(p=d(a).innerWidth(),B(y))}return!0}function f(b){b?(G.show(),h.addClass("has-title")):(G.hide(),h.removeClass("has-title"))}
66
+ var b,g,h,s,G,n,u=!1,m=!1,t=!1,w,r,z,p,y,A=c.init=function(){if(!b){b=d('<div id="overlay"></div>');g=d('<div class="overlay-frame"></div>');h=d('<div class="overlay-container"></div>');G=d('<div class="overlay-title"><span class="title">Untitled</span></div>');n=d('<a class="overlay-close" href="#"><span>x</span></a>');s=d('<div class="overlay-bg"></div>');b.append(g.append(h)).append(s).prependTo(l.body);d(l).bind("keydown",e);d(a).resize(k);z=h.outerWidth(!0)-h.width()+(g.innerWidth()-g.width());
67
+ h.outerHeight(!0);h.outerHeight(!1);g.innerHeight();g.height();p=d(a).innerWidth();w=parseInt(h.css("width"));if(!w||isNaN(w))w=h.width();r=parseInt(h.css("height"));if(!r||isNaN(r))r=h.height();G.append(n.hide()).hide().prependTo(g);b.hide()}return b},B=c.width=function(a){A();if(null===a)g.css("width",""),h.css("width","");else{a=a||w||640;x=a+z;y=a;var d=p;x>d?(x=d,a=x-z,b.addClass("spill")):b.removeClass("spill");g.css("width",x+"px");h.css("width",a+"px")}return c};c.autoSize=function(){A();
68
+ k();var b=w||0;h.children().each(function(a,c){b=Math.max(b,d(c).outerWidth(!0))});B(b);return c};c.css=function(b){A().attr("class",b);return c};c.html=function(b){A();a.innerShiv&&(b=innerShiv(b,!1));return h.html(b)};c.append=function(b){A();b instanceof jQuery||(b=d(b));h.append(b);return c};var q=c.close=function(a){if(u){var g=function(){A().hide();d(l.body).removeClass("has-overlay");u=!1;h.html("");u=null;b.trigger("overlayClosed",[c])};null==a&&(a=300);a?b.fadeOut(a,g):g()}return c};c.title=
69
+ function(b){A();t=b||"";G.find("span.title").text(t);null!=b?f(!0):m||f(!1);return c};c.enableClose=function(){A();m=!0;n.unbind("click").bind("click",function(b){q();return!1});f(!0);n.show();return c};c.disableClose=function(){A();m=!1;n.hide();u&&t||f(!1);return c};c.open=function(){A();h.html("");B(w);b.attr("class","");d(l.body).addClass("has-overlay");A().show();u=!0;k();c.title(null);m&&f(!0);b.trigger("overlayOpened",[c]);return c};c.listen=function(b){A().bind("overlayClosed",b);return c};
70
+ c.unlisten=function(b){A().unbind("overlayClosed",b);return c};return c}({},v,C));q.register("$20",function(c,a,l){var e={401:"You've been logged out",404:"Not Found",500:"Server Error",502:"Bad Gateway",503:"Service unavailable",504:"Gateway timeout"};c.getErrors=function(){return e};c.jsonLink=function(a){if(!a)return"";a=a.split("?");a[0]=a[0].replace(/(\.[a-z0-9]{1,4})?$/i,".json");return a.join("?")};c.errorData=function(a,c,b){var g,h;b=a.responseText;c=a.status;if(!b&&0===c)return null;try{g=
71
  d.parseJSON(b)||{}}catch(s){g={},h=s.message||s}h||(h=g.statusText||a.statusText||e[c]||"Unknown Error");g.error=h;return g};c.ajax=function(e,f,b,g){function h(){b&&b()}function s(b){b.alert&&alert(b.alert);var c=b.success;c&&q.require("$23","growl.js").success.apply(this,c.push?c:[c]);c=g||d(l.body);c.trigger("locoAjaxSuccess",[b]);var f=b.events;if(f&&f.length)for(var e,s=q.require("$11","ga.js");e=f.shift();)c.trigger(e,[b]),s.event("ajax",e);b.modal&&q.require("$13","LocoModal.js").replace(b.modal);
72
  if(b.download)a.location.assign(b.download);else if(b.redirect)return a.location.assign(b.redirect),!1;h();return!0}function G(b,a,g){401===b.status?(q.require("$23","growl.js").login(),h()):(a=c.errorData(b,a,g),null!=a&&(g=a.error,"function"===typeof f&&!1===f(null,g,b.status)?h():a&&a.data&&!s(a.data)||(alert(g||"Unknown error"),h())))}e.error=G;e.success=function(b,a,c){if(!b)return G(c,"unknown");b.status&&alert(b.statusText||"Unknown error");"function"===typeof f&&!1===f(b&&b.data?b.data:b)?
73
+ h():b&&b.data?s(b.data):h()};d.ajax(e)};return c}({},v,C));q.register("$13",function(c,a,l){function e(b,a){f.autoSize();var c=f.init();q.require("$9","html.js").init(c);c.find("[data-script]").each(function(b,c){c=d(c);for(var z=-1,f,h=c.attr("data-script").split(" ");++z<h.length;)f=h[z],g[f]?g[f](c,a||{}):alert("Unknown script "+f)});c.trigger("locoModalLoaded",[f,b||"",a||{}]);var h,e=c.find("form")[0];if(e)a:for(c=0;c<e.elements.length;c++)switch(h=e.elements[c],h.type){case "text":case "textarea":d(h).focus();
74
  break a}}function k(b){var a=d(b.currentTarget),c=a.attr("data-modal");if("close"===c){s();var g=a.attr("href");if(g&&-1!==g.indexOf("#!"))return!0}else{var e="submit"===b.type,k=a.attr("title")||a.attr("data-title"),g=a.attr("href")||a.attr("action"),l=e?a.serialize():"",a=e?a.attr("method"):"get";h(g,k,a,l);c||(c=g.split("/").slice(1,4).join("-"));c="modal "+c;f.width(null).css(c).autoSize()}b.stopPropagation();b.preventDefault();return!1}var f=q.require("$21","overlay.js"),b=q.require("$11","ga.js"),
75
  g={},h=c.load=function(a,g,h,m){f.open().title("Loading ..").disableClose().css("modal").html('<div class="overlay-placeholder"></div>');var s=q.require("$20","http.js");h={type:h||"get",data:m||"",url:s.jsonLink(a)};s.ajax(h,function(c,h,z){var p=c&&c.html;if(!p)return c=d('<h3 class="error"></h3>').text(h||"Unknown error"),f.enableClose().title("Error "+z||"?").html("").append(c),!1;g=c.title||g||"Untitled";f.enableClose().title(g).html(p);e(a,c.js);b.page(a,g);f.init().one("overlayClosed",function(){b.reset()});
76
  return!0});return c},s=c.close=function(){f.close();return c};c.initLink=function(b){b.click(k)};c.initForm=function(b){d(b).submit(k)};c.replace=function(b){var a=b&&b.html,c=b&&b.url,g=b&&b.title;c?(h(c,g),b=b&&b.css||c.split("/").slice(1,4).join("-"),f.width(null).css(" modal "+b).autoSize()):a&&(f.open().html(a),g&&f.enableClose().title(g),e("",b&&b.js))};c.find=function(b){return f.init().find(b)};c.script=function(b,a){if(a){if("function"!==typeof a.run)throw Error(b+" macro has no run function");
77
+ g[b]=a.run;return c}return g[b]};return c}({},v,C));q.register("$14",function(c,a,l){function e(a){this.url="/auto/"+a+".json?q=";this.dead={}}function k(){this.dict=q.require("$3","dict.js").create()}c.init=function(a){function b(){if("hint"!==E){var b=B.val()&&!(L&&L.val())&&null==y&&!r;$[b?"addClass":"removeClass"]("error")}}function c(){K.show();var b=B.outerWidth(!1),a=B.outerHeight(!1),g=B.css("margin-top");g&&(g=parseInt(g),isNaN(g)||(a+=g));b-=2;K.css("top",a+"px").css("width",b+"px");r=!0}
78
+ function h(){K.hide();r=!1}function s(){K.html("");h();w=0;A=y=null}function l(a){s();var h;for(h=0;h<a.length;h++){var f=h,p=a[h],e=d('<span class="label"></span>').text(p.label),y=d('<div class="auto-comp-result"></div>'),m=void 0;for(m in p)y.attr("data-"+m,p[m]);p.icon&&y.append(d("<span></span>").attr("class",p.icon));y.append(e);n(f,y)}(w=a.length)?(z&&c(),u(0)):(u(null),b())}function n(b,a){K.append(a);a.click(function(c){c.stopPropagation();u(b,a);t();return!1});return a}function u(b,a){A&&
79
+ (A.removeClass("selected"),A=null);y=null;null==b?L&&L.val(""):(a||(a=K.find("div.auto-comp-result").eq(b)),a.length&&(a.addClass("selected"),y=b,A=a))}function m(b){if(w){var a=w-1;null==y?b=0<b?0:a:(b=y+b,0>b?b=a:b>a&&(b=0));return u(b)}}function t(){if(null==y)v.val(""),L&&L.val("");else{var a=K.find("div.auto-comp-result").eq(y),c=a.attr("data-value"),g=a.attr("data-label");L&&L.val(c);v.val(g);h();a=a.clone();s();n(0,a);w=1;u(0,a);b();a.trigger("locoAutocomp",[c,g,a])}}var w=0,r=!1,z=!1,p=a.form,
80
+ y=null,A=null,B=d(a),J=B.attr("name"),E=B.attr("data-mode"),D=B.attr("data-provider"),L="hint"!==E&&d('<input type="hidden" value="" name="'+J+'" />').appendTo(p),$=d('<div class="auto-comp-wrap"></div>').replaceAll(B),K=d('<div class="auto-comp-drop"></div>');D&&(D=new e(D));L&&B.attr("name","_"+J);B.attr("autocomplete","off");$.append(B).append(K);h();B.focus(function(b){z=!0;1<w&&c()}).blur(function(a){z=!1;b()}).keydown(function(b){function a(){b.preventDefault();b.stopPropagation();return!1}
81
+ switch(b.keyCode){case 27:r&&(b.stopPropagation(),h(),B.blur());break;case 40:w&&(r?m(1):c());break;case 38:r&&m(-1);break;case 13:if(r)return t(),a();if(!y&&"hint"!==E)return a()}return!0});var v=q.require("$5","LocoTextListener.js").listen(B,function(b){D&&D.fetch(b,l)});(p=B.attr("data-pre"))&&(p=d.parseJSON(p))&&p.value&&p.label?(l([p]),t()):!a.value||L&&L.val()||!D||D.fetch(a.value,function(b){l(b);t()});return{$:B,clear:s,reset:function(){s();B.val("");L&&L.val("");v.ping()},preload:function(b){w&&
82
  s();D=new k;var a,c;for(a in b)c=b[a],D.add(c)},mode:function(b){E=b}}};e.prototype.fetch=function(a,b){if(!a)return b&&b([]),this;var c,d=this.dead;for(c in d)if(0===a.indexOf(c))return b&&b([]),this;c={dataType:"json",url:this.url+encodeURIComponent(a)};q.require("$20","http.js").ajax(c,function(c){var g=c&&c.results;g&&(b&&c.query&&c.query===a&&b(c.results),g.length||(d[a]=0));return!0});return this};k.prototype.add=function(a){var b=a.fulltext||a.label||a.value;b&&this.dict.add(a,b)};k.prototype.fetch=
83
+ function(a,b){if(!a)return b&&b([]),this;var c=this.dict.find(a);b(c)};return c}({},v,C));q.register("$15",function(c,a,l){function e(b){b.stopPropagation();b.preventDefault();return!1}function k(b,a,c){if(c=c||b.getElement(a))c.unbind().mouseup(function(c){c.stopPropagation();b.selectIndex(a,!0);return!1}).mouseover(function(){d(this).addClass("over");b.hover=a;return!0}).mouseout(function(){d(this).removeClass("over");b.hover=-1;return!0}),c=null;return b}function f(b){if(b){var a=this,c=b[0];a.id=
84
+ c.id||"";a.name=c.name||"";a.prefix=c.getAttribute("data-prefix");a.defaultIcon=c.getAttribute("data-icon")||"jshide";var f=c.selectedIndex,e=[],k,u,m;for(u=0;u<c.options.length;u++)k=c.options[u],m=k.disabled,k=d(k),e.push([k.val(),k.text(),k.attr("data-icon")||"",m]);a.hidden=d('<input type="hidden" name="'+a.name+'" value="" />').appendTo(c.form);a.list=d('<ul class="clearfix"></ul>');a.icon=d('<span class="icon"> </span>');a.selection=d("<label></label>");a.handle=d('<a class="handle" href="#"></a>').attr("tabindex",
85
+ b.attr("tabindex")||"").append(a.icon).append(a.selection);a.wrapper=d("<div></div>").addClass(c.className).addClass("selector").append(a.handle).append(a.list).replaceAll(c);this.id&&a.wrapper.attr("id",this.id);for(a.clearOptions();k=e.shift();)a.addOption.apply(a,k);a.handle.click(function(b){b.preventDefault();return!1}).mouseover(function(b){return a.onRollover(b)}).mouseout(function(b){return a.onRollout(b)}).mousedown(function(b){return a.onPress(b)}).keydown(function(b){return a.onKeydown(b)});
86
  d(l.body).mouseup(function(b){return a.onRelease(b)}).keydown(function(b){return a.onGlobalKeydown(b)});a.close();a.selectIndex(f)}}c.create=function(b){return new f(b)};c.extend=function(b){b.prototype=new f};a=f.prototype;a.onRollover=function(b){return this.over=!0};a.onRollout=function(b){this.over=!1;return!0};a.onPress=function(b){return this.active?this.over?(this.close(),b.stopPropagation(),b.preventDefault(),!1):!0:(this.open(),b.stopPropagation(),b.preventDefault(),this.handle.focus(),!1)};
87
  a.onRelease=function(b){this.active&&!this.over&&this.close();return!0};a.onGlobalKeydown=function(b){if(this.active)switch(b.keyCode){case 27:return this.close(),e(b);case 40:return this.hoverNext(1),e(b);case 38:return this.hoverNext(-1),e(b);case 13:if(-1!=this.hover)return this.selectIndex(this.hover,!0),this.hoverItem(-1),this.close(),e(b)}return!0};a.onKeydown=function(b){return this.active||40!==b.keyCode?!0:(this.open(),e(b))};a.open=function(){this.active=!0;this.hover=-1;this.wrapper.addClass("active");
88
  var b=this.handle.outerHeight()||0;this.list.show().css("top",b+"px");var b=this.handle.outerWidth()||0,a=this.list.outerWidth()||0;b>a&&(a-=this.list.width(),this.list.css("min-width",String(b-a)+"px"))};a.close=function(){this.list.hide();this.active=!1;-1!==this.hover&&(this.getElement(this.hover).removeClass("over"),this.hover=-1);this.wrapper.removeClass("active")};a.hoverItem=function(b,a){-1!==this.hover&&this.getElement(this.hover).removeClass("over");this.hover=b;-1!==b&&(a=a||this.getElement(b),
90
  "jshide"),l=d("<label></label>").text(a||b),n=d("<li></li>").append(n).append(l).appendTo(this.list);n.attr("data-option",e);this.options[e]={value:b,text:a,icon:c};this.index[b]=e;this.length=e+1;f?this.disableIndex(e):k(this,e,n);return e};a.disableOption=function(b){return this.disableIndex(this.index[b])};a.disableIndex=function(b){(b=this.getElement(b))&&b.addClass("disabled").unbind();return this};a.enableOption=function(b){return this.enableIndex(this.index[b])};a.enableIndex=function(b){return k(this,
91
  b)};a.reIndex=function(){this.index={};this.length=0;for(var b=this.options.length;-1<--b;)this.index[this.options[b].value]=b,this.length++};a.selectValue=function(b,a){return this.selectIndex(this.index[b],a)};a.selectIndex=function(b,a){var c=this.options[b];c&&(this.hidden.val(c.value),b!==this.idx&&(this.idx=b,this.setLabel(c.text),this.icon.attr("class",c.icon||this.defaultIcon),a&&this.change()),this.active&&this.close());return this};a.setLabel=function(b){this.selection.text(b);this.prefix&&
92
  this.selection.prepend(d('<span class="prefix"></span>').text(this.prefix))};a.val=function(){var b=this.options[this.idx];return b&&b.value};a.change=function(){var b=this.eventName||"change",a=this.eventData&&this.eventData.slice()||[];a.unshift(this.val());this.wrapper.trigger(b,a);return this};a.renameOption=function(b,a){var c=this.index[b],d=this.options[c];d&&(d.text=a,this.getElement(c).find("label").text(a),c===this.idx&&this.setLabel(a));return this};a.removeOption=function(b){var a=this.index[b],
93
+ c=this.options[a];c&&(b=this.val(),this.getElement(a).remove(),this.options.splice(a,1),this.reIndex(),b===c.value?this.selectIndex(0,!0):this.selectValue(b,!1))};a.getElement=function(b){return this.list.find("li").eq(b)};a=null;return c}({},v,C));q.register("$22",function(c,a,d){function e(b){k&&(b=f[b]||b);return b}var k=navigator.msPointerEnabled,f={touchstart:"MSPointerDown",touchmove:"MSPointerMove",touchend:"MSPointerUp"};c.bind=function(b,a,d){b=e(b);a.addEventListener&&a.addEventListener(b,
94
+ d,!1);return c};c.unbind=function(b,a,d){b=e(b);a.removeEventListener&&a.removeEventListener(b,d,!1);return c};return c}({},v,C));q.register("$16",function(c,a,l){function e(){g&&clearTimeout(g);g=null}function k(b){b.preventDefault();b.stopPropagation();return!1}var f,b,g,h=100,s=100,G=!1,n=!1,u;c.delays=function(b,a){h=b||0;s=a||0};c.kill=function(){b&&b.hide().stop().remove();b=null;f&&f.hide().html("")};c.text=function(a){b&&b.find("label.tip").text(a)};c.init=function(m){function t(){f||(f=d('<div id="tipholder"></div>').appendTo(l.body));
95
+ return f}function w(){e();A?g=setTimeout(r,A):r()}function r(){e();G||n||p()}function z(){e();b&&(b.stop(),b.remove());var a=m.offset();b=J.clone();t().show().append(b);var c=Math.round(a.left),a=Math.round(a.top);b.hasClass("tooltip-right")&&(c-=b.outerWidth(!1),c+=m.outerWidth(!1));a=b.hasClass("tooltip-top")?a-b.outerHeight():a+m.outerHeight();t().css("left",c+"px").css("top",a+"px");b.mouseenter(function(){G=!0;return!1}).mouseleave(function(){G=!1;w();return!0});Boolean(b.find("form").length|
96
+ b.find("a").length)||b.click(y);m.trigger("tooltipOpen",[b])}function p(){function a(){c.kill()}b?b.fadeOut(500,a):a();m.trigger("tooltipClose",[b])}function y(){!1!==m.triggerHandler("click")&&D&&(location.href=D);return!1}var A=Number(m.attr("data-hide-delay")||s),B=Number(m.attr("data-show-delay")||h),J=m.find("div.tooltip"),E=m.attr("title");if(!J.length){if(!E)return;J=d('<div class="tooltip"></div>').append(d('<label class="tip"></label>').text(E));m.hasClass("hastip-top")&&J.addClass("tooltip-top");
97
+ m.hasClass("hastip-right")&&J.addClass("tooltip-right");m.prepend(J)}E&&(m.attr("data-title")&&J.children("label.tip").text(E),m.attr("data-title",E),m.attr("title",""));var D=m.attr("href");"#"===D&&(D="");E=q.require("$22","touch.js").bind("touchstart",m[0],k).bind("touchmove",m[0],k).bind("touchend",m[0],function(b){setTimeout(y,300);return k(b)});null==u&&(u=!1,E.bind("touchstart",a,function(){return u=!0}).bind("touchend",a,function(){setTimeout(function(){u=!1},300);return!0}));m.mouseover(function(){u||
98
+ (n=!0,e(),b?z():B?g=setTimeout(z,B):z());return!0}).mouseout(function(){u||(n=!1,w());return!0});D&&m.click(function(){n=!1;p();return!0})};return c}({},v,C));q.register("$9",function(c,a,l){var e=0;a.attachEvent&&/MSIE ([\d\.]+)/.exec(navigator.appVersion)&&(e=parseInt(RegExp.$1));c.ie=function(a){return a?e<=a:e};var k=c.init=function(a){a?a instanceof jQuery||(a=d(a)):a=d(l.body);var b=q.require("$11","ga.js"),g=q.require("$12","forms.js"),h=q.require("$13","LocoModal.js"),s=q.require("$14","LocoAutoComplete.js"),
99
+ G=q.require("$15","LocoSelector.js"),n=q.require("$16","tooltip.js");a.find("form").each(function(b,a){var c=d(a);e&&10>e&&g.placeholders(c);a.getAttribute("data-modal")?h.initForm(a):a.action&&0!==a.action.indexOf("#")&&!a.target&&g.jsonify(a);c.hasClass("hasreveal")&&g.revealify(c);c.find("input.button").each(function(b,a){g.linkify(a)});c.find("input.auto-comp").each(function(b,a){s.init(a)});c.find("select.selector").each(function(b,a){G.create(d(a))})});a.find("a").each(function(a,g){-1!==g.className.indexOf("hastip")&&
100
+ n.init(d(g));if(-1!==g.href.indexOf("/modal/")||g.getAttribute("data-modal"))h.initLink(d(g));else{b.link(g);var e=g.getAttribute("data-ajax-target");e&&(e=d("#"+e),d(g).click(function(b){b.preventDefault();e.addClass("loading");d.get(g.href,function(b){b=c.$(b).replaceAll(e);k(b);b.trigger("locoAhah")});return!1}))}});g=h=s=a=null;return c};c.$=function(c){return d(a.innerShiv?innerShiv(c,!1):c)};d.fn._html=function(c){return null!=c?(c=this.html(a.innerShiv?innerShiv(c,!1):c),k(this),c):j.html()};
101
+ d.fn.macro=function(a,b){if("function"!==typeof a.run)throw Error("macro has no run function");a.run(this,b||{});return this};c.el=function(a,b){var c=l.createElement(a||"div");b&&(c.className=b);return c};c.txt=function(a){return l.createTextNode(a||"")};return c}({},v,C));q.register("$12",function(c,a,l){function e(b){function a(){b.value===f&&(b.value="",e.removeClass("placeheld"));return!0}function c(){""===b.value&&(b.value=f,e.addClass("placeheld"));return!0}var e=d(b);if(!e.hasClass("auto-comp")){var f=
102
+ e.attr("placeholder");if(f)return e.focus(a).blur(c),c(),{kill:function(){a();e.unbind("focus",a).unbind("blur",c)}}}}var k=c.enable=function(b){function d(a,b){b.getAttribute("data-was-disabled")||(b.disabled=!1)}b.find(".button").removeClass("loading");b.find("input").each(d);b.find("select").each(d);b.find("textarea").each(d);a.attachEvent&&b.hasClass("has-placeholders")&&c.placeholders(b)},f=c.disable=function(a){function c(a,b){b.disabled?b.setAttribute("data-was-disabled","true"):b.disabled=
103
  !0}a.find(".button").addClass("loading");a.find("input").each(c);a.find("select").each(c);a.find("textarea").each(c)};c.jsonify=function(b,c,e){b instanceof jQuery||(b=d(b));b.disable||(d.fn.disable=function(){f(this);return this},d.fn.enable=function(){k(this);this.placehold&&this.placehold();return this});var l="";b.find('[type="submit"]').click(function(a){a&&a.target&&a.target.name&&(l=encodeURIComponent(a.target.name)+"="+encodeURIComponent(a.target.value));return!0});b.submit(function(d){if(d&&
104
  d.isDefaultPrevented&&d.isDefaultPrevented()||e&&!1===e(d))return!1;var f=a.tinyMCE;f&&b.find("textarea.editor").each(function(a,b){var c=f.get(b.id);c&&c.save()});var k=b.serialize();l&&(k&&(k+="&"),k+=l,l="");b.disable();var n=q.require("$20","http.js"),k={url:n.jsonLink(b.attr("action")),type:b.attr("method"),data:k};n.ajax(k,c,function(){b.enable()},b);d.preventDefault();d.stopPropagation();return!1});if(b.hasClass("autopost")){var G,n=Number(b.attr("data-autopost-delay")||500);b.find('input[type="checkbox"]').change(function(){G&&
105
  clearTimeout(G);G=setTimeout(function(){b.submit()},n);return!0})}};c.revealify=function(a){a.find("div[data-reveal-if]").each(function(c,e){function f(a){var b;r=r||a.target;if("."===t)b=Boolean(r&&r[q]);else if("="===t){var c,e;b=d(r.form).serializeArray();for(e in b)b[e].name===m&&(c=b[e].value);b=q===c}if(b!==l)if(l=b,a)k[l?"slideDown":"slideUp"](200);else k[l?"show":"hide"]();return!0}var k=d(e),n=/^([_\w\-\[\]]+)(\.|=)(.+)$/.exec(k.attr("data-reveal-if"));if(n){var l,m=n[1],t=n[2],q=n[3],n=
106
  a[0][m];n.length||(n=[n]);var r;for(c=0;c<n.length;c++)r=n[c],f(),d(r).change(f).removeClass("jshide");n=n=r=null}});a=null};c.linkify=function(a){var c=a.getAttribute("data-icon");if(c){var e=d(a),f=d("<a> </a>");f.attr("href",a.form.action);f.attr("class",e.attr("class"));f.attr("tabindex",e.attr("tabindex"));e.attr("tabindex","-1");f.text(e.val());c&&d("<span></span>").prependTo(f).addClass(c);e.hide().after(f);f.click(function(a){e.click();return!1})}};c.placeholders=function(a){var c,d=[];a.find("input[placeholder]").each(function(a,
107
+ b){"password"!==b.type&&(c=e(b))&&d.push(c)});d.length&&(a.submit(function(){for(var a in d)d[a].kill()}),a.addClass("has-placeholders"),c=i=null)};return c}({},v,C));q.register("$17",function(c,a,d){var e=a.requestAnimationFrame,k=a.cancelAnimationFrame,f=0;if(!e||!k)for(var b in{ms:1,moz:1,webkit:1,o:1})if(e=a[b+"RequestAnimationFrame"])if(k=a[b+"CancelAnimationFrame"]||a[b+"CancelRequestAnimationFrame"])break;e&&k||(e=function(b){var c=g();timeToCall=Math.max(0,16-(c-f));nextTime=c+timeToCall;
108
+ timerId=a.setTimeout(function(){b(nextTime)},timeToCall);f=nextTime;return timerId},k=function(a){clearTimeout(a)});var g=Date.now||function(){return(new Date).getTime()};c.loop=function(a,b){function c(){f=e(c,b);a(d++)}var d=0,f;c();return{stop:function(){f&&k(f);f=null}}};return c}({},v,C));q.register("$10",function(c,a,d){function e(a,c){if(b)a.MSPOINTER_TYPE_TOUCH===a.pointerType&&c(0,a);else for(var d=-1,e=(a.originalEvent||a).changedTouches||[];++d<e.length;)c(d,e[d])}function k(a){a.preventDefault();
109
  a.stopPropagation();return!1}var f,b=a.navigator.msPointerEnabled,g=b?"MSPointerDown":"touchstart",h=b?"MSPointerMove":"touchmove",s=b?"MSPointerUp":"touchend";c.ok=function(a){null==f&&(f="function"===typeof d.body.addEventListener);f&&a&&a(c);return f};c.dragger=function(a,b){function c(b){a.addEventListener(b,f[b],!1)}function d(b){a.removeEventListener(b,f[b],!1)}var f={};f[g]=function(a){e(a,function(c,d){d.type=g;b(a,d,l)});c(h);c(s);return!0};f[s]=function(a){d(h);d(s);e(a,function(c,d){d.type=
110
+ s;b(a,d,l)});return!0};f[h]=function(a){e(a,function(c,d){d.type=h;b(a,d,l)});return k(a)};c(g);var l={kill:function(){d(g);d(h);d(s);a=l=b=null}};return l};c.swiper=function(a,c,d){function f(b){a.addEventListener(b,A[b],!1)}function l(b){a.removeEventListener(b,A[b],!1)}function r(){z&&z.stop();z=null}var z,p,y,A={},B=[],J=[],E=[];A[g]=function(b){p=!1;r();var c=v();e(b,function(a,b){B[a]=c;J[a]=b.clientX;E[a]=b.clientY});y=a.scrollLeft;return!0};A[s]=function(a){e(a,function(a,b){var d=v()-B[a],
111
+ e=J[a]-b.clientX,d=Math.abs(e)/d;c(d,e?0>e?-1:1:0)});y=null;return!0};A[h]=function(b){var c,d;null==y||e(b,function(a,b){c=J[a]-b.clientX;d=E[a]-b.clientY});if(d&&Math.abs(d)>Math.abs(c))return p=!0;c&&(p=!0,a.scrollLeft=Math.max(0,y+c));return k(b)};if(!b||d)f(g),f(h),f(s),b&&(a.className+=" mstouch");return{kill:function(){l(g);l(h);l(s);r()},swiped:function(){return p},ms:function(){return b},snap:function(c){b&&!d&&(a.style["-ms-scroll-snap-points-x"]="snapInterval(0px,"+c+"px)",a.style["-ms-scroll-snap-type"]=
112
+ "mandatory",a.style["-ms-scroll-chaining"]="none")},scroll:function(b,c,d){r();var e=a.scrollLeft,f=b>e?1:-1,g=Math[1===f?"min":"max"],p=Math.round(16*c*f);return z=q.require("$17","fps.js").loop(function(c){c&&(e=Math.max(0,g(b,e+p)),a.scrollLeft=e,b===e&&(r(),d&&d(e)))},a)}}};var v=Date.now||function(){return(new Date).getTime()};return c}({},v,C));q.register("$8",function(c,a,l){function e(a,b){var c=a.id,d=c&&w[c],e=d&&d.parent();if(!d||!e)return null;var f=(c=e.dir===t)?"X":"Y",c=c?s:v,g=c(e.el),
113
  h=b["offset"+f];null==h&&(h=b["page"+f]-c(a));h&&(g+=h);return{move:function(a){e.resize(a["page"+f]-g,d);return!0}}}function k(a,b){function c(){d(l).unbind("mousemove",f);r=null;return!0}function f(a){r?r.move(a):c();return!0}if(r)return!0;r=e(a.target,a);if(!r)return!0;d(l).one("mouseup",c).mousemove(f);return h(a)}function f(a,b){var c=b.type;"touchmove"===c?r&&r.move(b):"touchstart"===c?r=e(a.target,b):"touchend"===c&&r&&(r=null)}function b(a){var b=d(a.target).closest("div.wg-tr"),c=b.length&&
114
+ b.closest("div.is-table");(c=c&&w[c.attr("id")])&&c.selectRow(Number(b.attr("data-row")));return h(a)}function g(a){var b=a.keyCode;if(b=40===b?1:38===b?-1:0){var c=d(a.target),e=c.data("row");if(-1<e&&(c=(c=c.closest("div.is-table"))&&w[c.attr("id")])){for(;!1===c.selectRow(e+=b););return h(a)}}return!0}function h(a){a.stopPropagation();a.preventDefault();return!1}function s(a,b){b||(b=l.body);for(var c=a.offsetLeft||0;(a=a.offsetParent)&&a!==b;)c+=a.offsetLeft||0;return c}function v(a,b){b||(b=
115
+ l.body);for(var c=a.offsetTop||0;(a=a.offsetParent)&&a!==b;)c+=a.offsetTop||0;return c}function n(a){function b(){var c=a.innerHTML;c!==e&&(e=c,d(a).trigger("wgChange",[c]));return!0}var c=m.ie()?["keyup","paste"]:["input"],e=a.innerHTML,f=e;return d(a).attr("contenteditable","true").focus(function(){for(var e=d(a),f=-1;++f<c.length;)e.bind(c[f],b);return!0}).blur(function(){for(var g=d(a),h=-1;++h<c.length;)g.unbind(c[h]);b();f!==e&&d(a).trigger("wgChanged",[a]);return!0})}function u(a){this.el=
116
+ a;this.id=a.id;this.pos=this.index=0;this.css=["wg-cell"];w[a.id]=this;this.clear()}var m=q.require("$9","html.js"),t=1,w={},r=!1;c.init=function(a){var b=new u(a);b.restyle().redraw();b.root=!0;q.require("$10","touch.js").ok(function(b){b.dragger(a,f)});d(a).mousedown(k);return b};a=u.prototype;a.each=function(a){for(var b=-1;++b<this.length;)a(b,this.cells[b]);return this};a.bind=function(){return this.$("bind",arguments)};a.unbind=function(){return this.$("unbind",arguments)};a.$=function(a,b){d.fn[a].apply(d(this.el),
117
+ b);return this};a.parent=function(){return this.pid&&w[this.pid]};a.splitx=function(){return this._split(t,arguments)};a.splity=function(){return this._split(2,arguments)};a._split=function(a,b){this.dir&&this.dir!==a&&this.clear();this.dir=a;var c=-1,d,e=this.length,f=b.length,g=1/(e+f),h=0;if(e)throw Error("Todo: implement re-split");for(;++c<f;){d=m.el();this.body.appendChild(d);for(var k=d,l=b[c],n=l,q=1;w[l];)l=n+"-"+ ++q;k.id=l;d=new u(d);d.index=e+c;d.pid=this.id;d.pos=h;h+=g;this.cells.push(d);
118
+ this.length++}this.restyle().redraw();return this.cells};a.clear=function(){for(var a=-1,b;++a<this.length;)b=this.cells[a].clear(),delete w[b.id];this.cells=[];this.length=0;this.nav&&this.el.removeChild(this.nav);this.nav=null;this.body&&(this.field&&m.ie()&&(d(this.body).triggerHandler("blur"),this.field=null),this.table&&(this.table=null),this.el.removeChild(this.body));this.body=this.el.appendChild(m.el("","wg-body"));return this};a.resize=function(a,b){if(!b&&(b=this.cells[1],!b))return;var c=
119
  b.index,e=d(this.el)[this.dir===t?"width":"height"](),f=this.cells[c+1],c=this.cells[c-1];pad=(b.body||b.el.firstChild).offsetTop||0;max=(f?f.pos*e:e)-pad;min=c?c.pos*e:0;b.pos=Math.min(max,Math.max(min,a))/e;(e=this.parent())&&e.table?e.redraw():this.redraw();return this};a.distribute=function(){for(var a,b=0;b<arguments.length;)a=Math.max(0,Math.min(1,arguments[b++])),this.cells[b].pos=a;this.redraw();return this};a.restyle=function(){var a=this.css.slice();this.root&&a.push("wg-root");0===this.index?
120
  a.push("first"):a.push("not-first");this.dir&&(a.push("wg-split"),2===this.dir?a.push("wg-split-y"):a.push("wg-split-x"));this.t&&a.push("has-title");this.nav&&a.push("has-nav");this.table?a.push("is-table"):null!=this.field&&(a.push("is-field"),this.field||a.push("readonly"));this.el.className=a.join(" ");return this};a.redraw=function(){if(this.body){var a=this.el.clientHeight||0,b=this.body.offsetTop||0;b<a&&(a-=b);this.body.style.height=String(a)+"px"}for(var a=this.length,c,e=1,f=2===this.dir?
121
  "height":"width";0<=--a;)b=this.cells[a],this.nav?c=1:(b.fixed&&(b.pos=b.fixed/d(this.el)[f]()),c=e-b.pos,e=b.pos),b.el.style[f]=String(100*c)+"%",b.restyle().redraw();this.table&&this.redrawTable();return this};a.redrawTable=function(){var a=-1,b=this.cells[0],c=this.cells[1],a=d(c.body).width(),e=c.body.firstChild,c=e.childNodes;e.style.width=a+"px";for(var a=b.length,f=1;0<=--a;)e=b.cells[a],c[a].style.width=String(100*(f-e.pos))+"%",f=e.pos;return!0};a.contents=function(a){if(null===a)return this.body.innerHTML;
122
  this.cells.length?this.clear():this.body&&this.el.removeChild(this.body);this.body=this.el.appendChild(m.el("","wg-content"));"string"===typeof a?d(this.body)._html(a):this.append(a);this.redraw();return this};a.textarea=function(a,b){var c=m.txt(a);this.contents(c);(this.field=b)&&n(this.body);this.restyle();return this};a.append=function(a){a.nodeType?m.init(this.body.appendChild(a)):m.init(d(a).appendTo(this.body));return this};a.header=function(a){if(!arguments.length)return this.el.getElementsByTagName("h2")[0];
123
  this.t=m.txt(a||"");this.el.insertBefore(m.el("h2","wg-title"),this.body).appendChild(this.t);this.restyle().redraw();return this};a.title=function(a){this.t?this.t.nodeValue=a||"":this.header(a);return this.t};a.tabulate=function(a){var c=this.id,e=[],f=[];rows=this.splity(c+"-thead",c+"-body");thead=rows[0];tbody=rows[1];thead.css.push("wg-thead");tbody.css.push("wg-tbody");a.eachCol(function(a,b){e.push(c+"-col"+a);f.push(b)});for(var h=-1,k,l=m.el("","wg-cols"),n=thead._split(t,e);++h<n.length;)k=
124
+ n[h],k.header(f[h]),l.appendChild(m.el("","wg-col "+(0===h?"":"not-")+"first"));tbody.contents(l);a.eachRow(function(a,b,c){tbody._addRow(b,c)});d(tbody.el).mousedown(b);this.lock();this.table=a;this.restyle().redraw();k=thead.cells[0];tbody.fixed=v(k.body,k.el)||20;this.resize(tbody.fixed);d(l).attr("tabindex","-1").keydown(g);return l};a.lock=function(){this.body.className+=" locked";return this};a.addRow=function(a,b){this.table&&this.cells[1]&&this.cells[1]._addRow(a,b);return this};a._addRow=
125
  function(a,b){var c,d=this.body.firstChild.childNodes,e=d.length,f=d[0].childNodes.length,g=-1;for(b=b&&"wg-tr "+b||"wg-tr";++g<e;)c=d[g].appendChild(m.el("",b)),c.setAttribute("data-row",f),c=c.appendChild(m.el("","wg-td")),a[g]&&/\S/.test(a[g])?c.appendChild(m.txt(a[g])):c.innerHTML="&nbsp;";return d};a.tr=function(a){for(var b=-1,c,d=[],e=this.cells[1].body.firstChild.childNodes;++b<e.length;)(c=e[b].childNodes[a])&&d.push(c);return d};a.td=function(a,b){try{return this.cells[1].body.firstChild.childNodes[b].childNodes[a].firstChild}catch(c){return null}};
126
  a.selectRow=function(a,b){var c=this.table&&this.table.row(a);if(!c)return null;var e=this.tr(a);if(e.length){var e=d(e),f=this.cells[1],g=f.body,h=d(g.firstChild);if(h.hasClass("filtered")&&!e.hasClass("filtered"))return!1;h.find("div.selected").removeClass("selected");e.addClass("selected");h.data("row",a);if(b)f.scrollTo(e[0],!0);else{var k=g.scrollTop;h.focus();k&&(g.scrollTop=k);f.scrollTo(e[0])}h.trigger("wgRowSelect",[a,c])}return this};a.deselectRow=function(){if(this.table){var a=d(this.cells[1].body.firstChild),
127
+ b=a.data("row");a.find("div.selected").removeClass("selected");a.data("row",null);a.trigger("wgRowDeselect",[b])}};a.filterRows=function(a){var b=-1,c;c=d(this.cells[1].body.firstChild);if(!a)return c.removeClass("filtered"),this;for(c.addClass("filtered").find("div.filtered").removeClass("filtered");++b<a.length;)c=a[b],c=this.tr(c),c.length&&d(c).addClass("filtered");return this};a.scrollTo=function(a,b){var c,e=this.body.scrollTop,f=this.body.clientHeight+e,g=v(a,this.body),h=g+d(a).outerHeight();
128
  e>g?c=g:f<h&&(c=h-this.body.clientHeight);null!=c&&(b?this.body.scrollTop=c:d(this.body).animate({scrollTop:c},300));return this};a.navigize=function(a){function b(a,c){e=a.show();f=c.addClass("active");a.trigger("wgTabSelect",[a.data("index")]);return a}var c=this;c.nav&&c.el.removeChild(c.nav);c.nav=c.el.insertBefore(m.el("nav","wg-tabs"),c.body);var e,f,g=d(c.nav).click(function(a){var g=d(a.target),k=g.data("tab");if(k){var l=f;e&&e.hide();l&&l.removeClass("active");b(k,g).children().focus();
129
+ c.redraw();return h(a)}});c.each(function(c,f){f.pos=0;var h=d(f.el).data("index",c),k=d('<a href="#'+f.id+'"></a>').data("tab",h).text(a[c]).appendTo(g);e?h&&h.hide():b(h,k)});c.lock();c.restyle().redraw();g=null;return c};a=null;return c}({},v,C));q.register("$6",function(c,a,l){function e(a){var c=l.createElement("pre");c.innerHTML=a.replace(/<(p|div|br) ?\/?>/ig,"\n<$1>").replace(/(^\n+|\n+$)/g,"");a="string"===typeof c.textContent?c.textContent:"string"===typeof c.innerText?c.innerText:d(c).text();
130
+ return a}c.init=function(c){function f(){var a=p.length,b=0,c=0,d=0;p.each(function(a,e){e.translation()?e.fuzzy()?d++:b++:c++});return{t:a,p:String(b?Math.round(100*(b/a)):0)+"%",f:d,u:c}}function b(){y.clear();p.each(function(a,b,c){y.add(c,b.toText())});A="";B=p.length}function g(a,b){var c,d={};if(A===a)return B||0;if(!p.length)return 0;if(a){if(A&&!B&&0===a.indexOf(A))return 0;c=y.find(a,d);d.words.length||(a="")}A=a;B=c?c.length:p.length;I.filterRows(c);d=D?p.indexOf(D):-1;if(-1===d||c&&-1===
131
+ c.indexOf(d))c?c.length?I.selectRow(c[0],!0):I.deselectRow():I.selectRow(0,!0);b||t("poFilter",[A,B]);return B}function h(a){if(!a)return["",""];var b=[a.source()||"",a.translation()||""];(a=a.context())&&(b[0]+=" [ "+a+" ]");return b}function l(a){if(a=a||D){var b=p.indexOf(a),b=I.tr(b),c=b[0].className.replace(/\s*po-[a-z]+/g,""),c=c+(" "+n(a)+" po-unsaved");d(b).attr("class",c);t("poUnsaved",[++F])}}function v(a,b){b=b||D;if(!b)return null;var c=b.fuzzy();null!=a&&c!=a&&(b.fuzzy(a),t("poFuzzy",
132
+ [b,a]),t(H,[b]),l(b));return c}function n(a){var b=[];a&&(a.fuzzy()&&b.push("po-fuzzy"),a.translation()||b.push("po-empty"),a.comment()&&b.push("po-comment"));return b.join(" ")}function u(a,b){var c=h(a)[b||0],e=p.indexOf(a),e=I.td(e,b);c&&/\S/.test(c)?d(e).text(c.replace("\n"," ")):d(e).html("&nbsp;")}function m(a){a!==C&&(E=(C=a)?p.lock(E):p.unlock()||E,t("poLock",[a,E]),D&&z(D))}function t(a,b){return d(c).trigger(a,b||[])}function w(){if(p&&p.row){A&&(A="",B=p.length,t("poFilter",[A,B]));var a;
133
  I.table&&(a=K?K.parentNode.scrollTop:0,I.clear());K=I.tabulate(M);a&&(K.parentNode.scrollTop=a);t("poLoad");(a=p.locale())?(E=a,m(!0)):m(!1);return!!p.length}I.clear().header("Error").contents("Invalid PO")}function r(){Q.unbind().clear();P.unbind().clear();S.unbind();D&&(t("poDeselected",[D]),D=null)}function z(a){function c(){var d=E&&E.lang&&"en"!==E.lang&&E.label;P.title(d?d+" translation:":"Translation:");if(m){var h=[],k=q.require("$7","collection.js").init();a.each(function(a,b){h.push("Form "+
134
+ a);k.add("plural-"+a,b)});O=P.splitx.apply(P,k.keys);P.each(function(a,b){b.textarea(k[a],g)});P.navigize(h).bind("wgTabSelect",function(a,b){f=b})}else P.textarea(a.translation(),g);P.bind("wgChange",function(b,c){var d=e(c);a.translate(d,f);0===f&&u(a,1);a.fuzzy()?v(!1,a):l(a)}).bind("wgChanged",function(c){y&&b();t(H,[a])})}function d(){P.title("Context:");P.textarea(a.context(),!0);P.bind("wgChange",function(b,c){var d=e(c);a.context(d);a.source();u(a,0);l(a)}).bind("wgChanged",function(){p.reIndex(a);
135
+ y&&b();t(H,[a])})}r();D=a;S.textarea(a.comment(),!0).bind("wgChange",function(b,c){var d=e(c);a.comment(d);t("poComment",[a,d]);l(a)});var f=0,g=C,h=!C,k=a.source()||"",m=a.plural()||"";(function(){m?(O=Q.splity(Q.id+"-singular",Q.id+"-plural"),O[0].header("Singular:").textarea(k,h),O[1].header("Plural:").textarea(m,h),Q.lock()):Q.textarea(k,h);Q.title("Source text:");h&&Q.bind("wgChange",function(b,c){var d=e(c);Q.id+"-plural"===b.target.parentNode.id?a.plural(d):(a.source(d),u(a,0));l(a)}).bind("wgChanged",
136
+ function(c){Q.id+"-plural"===c.target.parentNode.id||p.reIndex(a);y&&b();t(H,[a])})})();g?c():d();t("poSelected",[a]);data=null}var p,y,A,B,C,E,D,F=0,H="poUpdate",K,M={row:function(a){return h(p.row(a))},eachCol:function(a){a(0,"Source text");a(1,"Translation")},eachRow:function(a){var b=0;p.each(function(c,d){a(b++,h(d),n(d))})}},N=q.require("$8","LocoWinGrid.js").init(c),O=N.splity("po-list","po-edit"),I=O[0],R=O[1],O=R.splitx("po-trans","po-comment"),T=O[0],S=O[1].header("Comment:"),O=T.splity("po-source",
137
+ "po-target"),Q=O[0].header("Source text:"),P=O[1].header("Translation:");N.distribute(0.34);R.distribute(0.8);d(a).resize(function(){N.redraw(!0);return!0});I.bind("wgRowSelect",function(a,b,c){a=p.row(b);z(a);return!0}).bind("wgRowDeselect",function(){r();S.textarea("",!1);Q.textarea("",!1).title("Source text not loaded:");P.textarea("",!1).title("Translation not loaded:");t("poSelected",[null]);return!0});return{bind:function(a,b){return d(c).bind(a,b)},load:function(a){p=a;y&&b();w()&&I.selectRow(0)},
138
+ save:function(a){if(F||a)d(K).find("div.po-unsaved").removeClass("po-unsaved"),t("poSave");F=0;return p},fuzzy:function(a){return v(a)},del:function(a,c){var d=arguments.length?p.get(a,c):D;if(d){var e=A,f=p.del(d);null!=f&&(t("poDel",[d]),t(H,[d]),w(),y&&b(),D&&D.equals(d)&&r(),p.length&&(e&&g(e),D||(f=Math.min(f,p.length-1),I.selectRow(f))))}},add:function(a,b){var c,d=p.get(a,b);d?c=p.indexOf(d):(c=p.length,d=p.add(a,b),I.addRow(M.row(c),n(d)),l(d),y&&y.add(p.indexOf(d),d.toText()),t("poAdd",[d]),
139
+ t(H,[d]));A&&g("");I.selectRow(c);return d},lock:function(){m(!0)},unlock:function(){m(!1)},locked:function(){return Boolean(C)},filter:function(a){return y&&p&&p.length&&g(a,!0)},searchable:function(a){a&&(y=a,p&&b());return y&&!0},stats:function(){return f()}}};return c}({},v,C));q.require("$1","array.js");var ba=v.ajaxurl||"/wp-admin/admin-ajax.php";U=(v.loco||{}).conf||{};var S=U.locale,M=q.require("$2","po.js").create(S),H={},T=C.getElementById("loco-poedit-inner"),R=v.loco__||function(c){return c};
140
+ d(v).resize(function(){function c(){var c;c=T;for(var k=c.offsetTop||0;(c=c.offsetParent)&&void 0!==c;)k+=c.offsetTop||0;c=k;k=d(v).innerHeight();c=Math.max(l,k-c-a);T.style.height=String(c)+"px";return!0}var a=20,l=parseInt(d(T).css("min-height")||0);c();return c}());H.save=function(c){function a(){c.disabled=!1}a();F.bind("poUnsaved",function(){d(c).addClass("button-primary loco-flagged")}).bind("poSave",function(){d(c).removeClass("button-primary loco-flagged")});d(c.form).submit(function(l){var e=
141
+ l.target;l.target.po.value=M.toString();c.disabled=!0;Z(e,function(c){a();d("#loco-po-modified").text(c.modified);F.save(!0);var e=R("PO file saved"),b=c.filename;c=c.compiled;null!=c&&(/\D/.test(c)?V(c,R("Error"),"error"):(e+=" "+R("and MO file compiled"),b=b.replace(/\.po$/i,".mo")));X(e+" - "+b)},a);return N(l)});return!0};H.download=function(c){c.disabled=!1;d(c).click(function(){c.form.po.value=M.toString();d(T).trigger("poSave");return!0});return!0};H.add=!S&&function(c){c.disabled=!1;d(c).click(function(a){var c=
142
+ 1,d;for(d="New message";M.get(d);)c=/(\d+)/.exec(d)?Math.max(c,RegExp.$1):c,d="New message "+ ++c;F.add(d);return N(a)});return!0};H.del=!S&&function(c){c.disabled=!1;d(c).click(function(a){F.del();return N(a)});return!0};H.fuzzy=S&&function(c){function a(a){c.disabled=null==a;d(c)[a?"addClass":"removeClass"]("loco-inverted")}F.bind("poSelected",function(c,d){a(d&&F.locked()?d.fuzzy():null)}).bind("poFuzzy",function(c,d,k){a(F.locked()?k:null)});d(c).click(function(a){var c=!F.fuzzy();F.fuzzy(c);
143
+ return N(a)});return!0};H.sync=function(c){function a(){c.disabled=!1}a();F.bind("poUnsaved",function(){c.disabled=!0}).bind("poSave",function(){a()});d(c.form).submit(function(l){c.disabled=!0;Z(l.target,function(c){a();var k=q.require("$2","po.js").create(void 0);k.load(c.exp);var f=[],b=M.merge(k),k=b.add.length,b=b.del.length;F.load(M);k||b?(f.push("Merged from "+(c.pot||"source code")),k&&f.push(k+" new string"+(1===k?"":"s")+" added"),b&&f.push(b+" obsolete string"+(1===b?"":"s")+" removed"),
144
+ d(T).trigger("poUnsaved",[])):f.push("Already up to date with "+(c.pot||"source code"));M.headers(c.headers||{});X(f.join(". "))},a);return N(l)});return!0};H.revert=function(c){F.bind("poUnsaved",function(){c.disabled=!1}).bind("poSave",function(){c.disabled=!0});d(c).click(function(a){location.reload();return N(a)});return!0};H.help=function(){return!0};T.innerHTML="";var F=q.require("$6","poedit.js").init(T);d("#loco-nav").find("button").each(function(c,a){var l=a.getAttribute("data-loco");H[l]&&
145
+ H[l](a)||d(a).hide()});H=null;(function(c){d(c.form).submit(function(a){return N(a)});var a=q.require("$3","dict.js").create();a.depth=10;a.translit(q.require("$4","translit.json"));F.searchable(a);c.disabled=!1;c.value="";var l=q.require("$5","LocoTextListener.js").listen(c,function(a){F.filter(a)});F.bind("poFilter",function(a,c){l.val(c)});c=a=null})(C.getElementById("loco-search"));F.bind("poUnsaved",function(){v.onbeforeunload=function(){return R("Your changes will be lost if you continue without saving")}}).bind("poSave",
146
+ function(){v.onbeforeunload=null}).bind("poUpdate",Y);S?M.load(U.po||{}):M.load(U.pot||{});M.headers(U.headers);F.load(M);Y();d("#wpbody-content").find("div.loco-message").each(function(c,a){W(a,!0)})})(window,document,window.jQuery);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: timwhitlock
3
  Tags: translation, translators, localization, l10n, i18n, Gettext, POEdit
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
- Stable tag: 1.1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -88,6 +88,10 @@ Ensure that the web server is able to write the file to disk, and also ensure th
88
 
89
  == Changelog ==
90
 
 
 
 
 
91
  = 1.1.3 =
92
  * Improved PHP strings extraction
93
  * Fixed strict warning
@@ -112,8 +116,8 @@ Ensure that the web server is able to write the file to disk, and also ensure th
112
 
113
  == Upgrade Notice ==
114
 
115
- = 1.1.3 =
116
- * Bug fixes and minor improvements.
117
 
118
 
119
 
3
  Tags: translation, translators, localization, l10n, i18n, Gettext, POEdit
4
  Requires at least: 3.5
5
  Tested up to: 3.5
6
+ Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.2 =
92
+ * Added settings screen with gettext config
93
+ * Fixed msgfmt hanging bug
94
+
95
  = 1.1.3 =
96
  * Improved PHP strings extraction
97
  * Fixed strict warning
116
 
117
  == Upgrade Notice ==
118
 
119
+ = 1.2 =
120
+ * Bug fixes and improvements.
121
 
122
 
123
 
tpl/admin-opts.tpl.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin options screen - changes loco plugin settings
4
+ */
5
+ $nav = array (
6
+ Loco::__('Packages') => str_replace( 'options-general', 'tools', LocoAdmin::uri() ),
7
+ Loco::__('Settings') => '',
8
+ );
9
+ ?>
10
+
11
+ <div class="wrap">
12
+
13
+
14
+ <?php Loco::render('admin-nav', compact('nav') )?>
15
+
16
+ <?php isset($success) and LocoAdmin::success( $success )?>
17
+
18
+ <form action="" method="post">
19
+ <p>
20
+ <label for="loco--which_msgfmt">
21
+ <strong>Gettext msgfmt</strong><br />
22
+ <?php Loco::h( Loco::__('Path to msgfmt program for compiling MO files') )?>:
23
+ </label>
24
+ <br />
25
+ <input type="text" size="32" name="loco[which_msgfmt]" id="loco--which_msgfmt" value="<?php Loco::h($which_msgfmt)?>" />
26
+ </p>
27
+ <p class="submit">
28
+ <input type="submit" class="button-primary" value="<?php Loco::h( Loco::__('Save settings') )?>" />
29
+ </p>
30
+ </form>
31
+
32
+ </div>
tpl/admin-root.tpl.php CHANGED
@@ -4,6 +4,7 @@
4
  */
5
  $nav = array (
6
  Loco::__('Packages') => '',
 
7
  );
8
  ?>
9
 
4
  */
5
  $nav = array (
6
  Loco::__('Packages') => '',
7
+ Loco::__('Settings') => str_replace( 'tools', 'options-general', LocoAdmin::uri() ),
8
  );
9
  ?>
10