Version Description
Fix broken update, Fix Google proxy
Download this release
Release Info
Developer | oferwald |
Plugin | Transposh WordPress Translation |
Version | 0.9.4 |
Comparing to | |
See all releases |
Code changes from version 0.9.2 to 0.9.4
- core/constants.php +13 -7
- core/logging.php +2 -2
- core/parser.php +3 -27
- core/utils.php +2 -2
- img/flags53.png +0 -0
- img/flags58.png +0 -0
- img/flags59.png +0 -0
- img/flags60.png +0 -0
- img/flags65.png +0 -0
- img/flags66.png +0 -0
- img/flags66b.png +0 -0
- js/admin/backendtranslate.js +2 -2
- js/admin/commentslang.js +2 -2
- js/admin/contexthelp.js +2 -2
- js/admin/languages.js +2 -2
- js/admin/utils.js +2 -2
- js/admin/warningclose.js +2 -2
- js/l/de.js +2 -2
- js/l/es.js +2 -2
- js/l/fa.js +2 -2
- js/l/he.js +2 -2
- js/l/it.js +2 -2
- js/l/nl.js +2 -2
- js/l/ru.js +2 -2
- js/l/tr.js +2 -2
- js/transposh.js +2 -2
- js/transposhedit.js +4 -4
- readme.txt +18 -3
- transposh.php +170 -84
- widgets/default/tpw_default.php +2 -2
- widgets/dropdown/arrow.png +0 -0
- widgets/dropdown/tpw_image_dropdown.css +0 -20
- widgets/dropdown/tpw_image_dropdown.js +0 -26
- widgets/dropdown/tpw_image_dropdown.php +0 -55
- widgets/flags/flags66b.png +0 -0
- widgets/flags/tpw_flags.css +0 -30
- widgets/flags/tpw_flags.php +0 -51
- widgets/flags/tpw_flags_css.css +0 -103
- widgets/flags/tpw_flags_css.php +0 -42
- widgets/flagslist/tpw_list_with_flags.php +0 -55
- widgets/flagslist/tpw_list_with_flags_css.php +0 -51
- widgets/select2/select2.css +0 -524
- widgets/select2/select2.js +0 -2407
- widgets/select2/select2.min.js +0 -82
- widgets/select2/select2.png +0 -0
- widgets/select2/select2x2.png +0 -0
- widgets/select2/spinner.gif +0 -0
- widgets/select2/tpw_select2.js +0 -21
- widgets/select2/tpw_select2.php +0 -51
- wp/transposh_3rdparty.php +3 -3
- wp/transposh_admin.php +15 -8
- wp/transposh_ajax.php +2 -2
- wp/transposh_backup.php +3 -7
- wp/transposh_db.php +2 -2
- wp/transposh_options.php +8 -5
- wp/transposh_postpublish.php +2 -2
- wp/transposh_widget.php +2 -32
core/constants.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
//Language indicator in URL. i.e. lang=en
|
@@ -36,6 +36,11 @@ define('TP_GTXT_IBRK', chr(2)); // Gettext inner breaker (around %s)
|
|
36 |
define('TP_GTXT_BRK_CLOSER', chr(3)); // Gettext breaker closer
|
37 |
define('TP_GTXT_IBRK_CLOSER', chr(4)); // Gettext inner breaker closer
|
38 |
|
|
|
|
|
|
|
|
|
|
|
39 |
/**
|
40 |
* Holds our arrays staticly to reduce chance of namespace collision
|
41 |
*/
|
@@ -81,7 +86,8 @@ class transposh_consts {
|
|
81 |
'it' => 'Italian,Italiano,it,it_IT',
|
82 |
'ja' => 'Japanese,日本語,jp,',
|
83 |
'kn' => 'Kannada,ಕನ್ನಡ,in,',
|
84 |
-
'
|
|
|
85 |
'lo' => 'Lao,ພາສາລາວ,la,',
|
86 |
'la' => 'Latin,Latīna,va,',
|
87 |
'lv' => 'Latvian,Latviešu valoda,lv,',
|
@@ -131,7 +137,8 @@ class transposh_consts {
|
|
131 |
// @updated 2011-Nov-04
|
132 |
// @updated 2012-Feb-24 (eo)
|
133 |
// @updated 2012-Sep-17 (la)
|
134 |
-
|
|
|
135 |
// Bing supported languages
|
136 |
// (got this using Microsoft.Translator.GetLanguages() - fixed to match our codes)
|
137 |
// @updated 2012-Feb-14 (mww)
|
@@ -147,10 +154,9 @@ class transposh_consts {
|
|
147 |
//Chinese Mandarin-Traditional zh-cn-cmn-t
|
148 |
//Dari fa-af
|
149 |
//Kazakh kk-kz
|
150 |
-
//Khmer km-kh
|
151 |
//Pashto ps
|
152 |
//Uzbek uz-uz
|
153 |
-
public static $oht_languages = array('en', 'sq', 'ar', 'bn', 'bg', 'ca', 'zh', 'zh-tw', 'hr', 'cs', 'da', 'nl', 'et', 'fa', 'fi', 'fr', 'ka', 'de', 'el', 'he', 'hi', 'hu', 'id', 'it', 'jp', 'ko', 'lo', 'lv', 'lt', 'mk', 'ms', 'no', 'pl', 'pt', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'sv', 'tl', 'ta', 'th', 'tr', 'uk', 'ur', 'vi');
|
154 |
// Array for holding po domains we have problems with
|
155 |
public static $ignored_po_domains = array('MailPress');
|
156 |
// Array holding list of jQueryUI themes
|
@@ -164,7 +170,7 @@ class transposh_consts {
|
|
164 |
define('TRANSLATOR', 'translator');
|
165 |
|
166 |
//Define for transposh plugin version
|
167 |
-
define('TRANSPOSH_PLUGIN_VER', '0.9.
|
168 |
|
169 |
//Current jQuery UI
|
170 |
define('JQUERYUI_VER', '1.9.2');
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
//Language indicator in URL. i.e. lang=en
|
36 |
define('TP_GTXT_BRK_CLOSER', chr(3)); // Gettext breaker closer
|
37 |
define('TP_GTXT_IBRK_CLOSER', chr(4)); // Gettext inner breaker closer
|
38 |
|
39 |
+
//External services
|
40 |
+
define('TRANSPOSH_BACKUP_SERVICE_URL', 'http://svc.transposh.org/backup');
|
41 |
+
define('TRANSPOSH_RESTORE_SERVICE_URL', 'http://svc.transposh.org/restore');
|
42 |
+
define('TRANSPOSH_UPDATE_SERVICE_URL', 'http://svc.transposh.org/update-check');
|
43 |
+
|
44 |
/**
|
45 |
* Holds our arrays staticly to reduce chance of namespace collision
|
46 |
*/
|
86 |
'it' => 'Italian,Italiano,it,it_IT',
|
87 |
'ja' => 'Japanese,日本語,jp,',
|
88 |
'kn' => 'Kannada,ಕನ್ನಡ,in,',
|
89 |
+
'km' => 'Khmer,ភាសាខ្មែរ,kh,',
|
90 |
+
'ko' => 'Korean,한국어,kr,ko_KR',
|
91 |
'lo' => 'Lao,ພາສາລາວ,la,',
|
92 |
'la' => 'Latin,Latīna,va,',
|
93 |
'lv' => 'Latvian,Latviešu valoda,lv,',
|
137 |
// @updated 2011-Nov-04
|
138 |
// @updated 2012-Feb-24 (eo)
|
139 |
// @updated 2012-Sep-17 (la)
|
140 |
+
// @updated 2013-Apr-19 (km)
|
141 |
+
public static $google_languages = array('en', 'af', 'sq', 'ar', 'be', 'bg', 'ca', 'zh', 'zh-tw', 'hr', 'cs', 'da', 'nl', 'et', 'fi', 'fr', 'gl', 'de', 'el', 'ht', 'he', 'hi', 'hu', 'id', 'it', 'is', 'ga', 'ja', 'ko', 'lo', 'lv', 'lt', 'mk', 'ms', 'mt', 'no', 'fa', 'pl', 'pt', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'sw', 'sv', 'tl', 'th', 'tr', 'uk', 'vi', 'cy', 'yi', 'hy', 'az', 'eu', 'ka', 'la', 'ur', 'ta', 'te', 'kn', 'bn', 'gu', 'eo', 'km');
|
142 |
// Bing supported languages
|
143 |
// (got this using Microsoft.Translator.GetLanguages() - fixed to match our codes)
|
144 |
// @updated 2012-Feb-14 (mww)
|
154 |
//Chinese Mandarin-Traditional zh-cn-cmn-t
|
155 |
//Dari fa-af
|
156 |
//Kazakh kk-kz
|
|
|
157 |
//Pashto ps
|
158 |
//Uzbek uz-uz
|
159 |
+
public static $oht_languages = array('en', 'sq', 'ar', 'bn', 'bg', 'ca', 'zh', 'zh-tw', 'hr', 'cs', 'da', 'nl', 'et', 'fa', 'fi', 'fr', 'ka', 'de', 'el', 'he', 'hi', 'hu', 'id', 'it', 'jp', 'ko', 'lo', 'lv', 'lt', 'mk', 'ms', 'no', 'pl', 'pt', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'sv', 'tl', 'ta', 'th', 'tr', 'uk', 'ur', 'vi', 'km');
|
160 |
// Array for holding po domains we have problems with
|
161 |
public static $ignored_po_domains = array('MailPress');
|
162 |
// Array holding list of jQueryUI themes
|
170 |
define('TRANSLATOR', 'translator');
|
171 |
|
172 |
//Define for transposh plugin version
|
173 |
+
define('TRANSPOSH_PLUGIN_VER', '0.9.3');
|
174 |
|
175 |
//Current jQuery UI
|
176 |
define('JQUERYUI_VER', '1.9.2');
|
core/logging.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
core/parser.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
require_once("shd/simple_html_dom.php");
|
@@ -133,7 +133,6 @@ class parser {
|
|
133 |
|
134 |
/** @var boolean should we attempt to handle page as json */
|
135 |
public $might_json = false;
|
136 |
-
public $allow_ad = false;
|
137 |
//first three are html, later 3 come from feeds xml (link is problematic...)
|
138 |
protected $ignore_tags = array('script' => 1, 'style' => 1, 'code' => 1, 'wfw:commentrss' => 1, 'comments' => 1, 'guid' => 1);
|
139 |
|
@@ -605,24 +604,6 @@ class parser {
|
|
605 |
return $span;
|
606 |
}
|
607 |
|
608 |
-
/**
|
609 |
-
* This function does some ad replacement for transposh benefit
|
610 |
-
*/
|
611 |
-
function do_ad_switch() {
|
612 |
-
if (isset($this->html->noise) && is_array($this->html->noise)) {
|
613 |
-
foreach ($this->html->noise as $key => $value) {
|
614 |
-
if (strpos($value, 'google_ad_client') !== false) {
|
615 |
-
$publoc = strpos($value, 'pub-');
|
616 |
-
$sufloc = strpos($value, '"', $publoc);
|
617 |
-
if (!$sufloc) $sufloc = strpos($value, "'", $publoc);
|
618 |
-
echo $publoc . ' ' . $sufloc;
|
619 |
-
if ($publoc && $sufloc)
|
620 |
-
$this->html->noise[$key] = substr($value, 0, $publoc) . 'pub-7523823497771676' . substr($value, $sufloc);
|
621 |
-
}
|
622 |
-
}
|
623 |
-
}
|
624 |
-
}
|
625 |
-
|
626 |
/**
|
627 |
* Allow changing of parsing rules, yeah, I caved
|
628 |
* @param type $puncts
|
@@ -917,12 +898,7 @@ class parser {
|
|
917 |
$body = $this->html->find('body', 0);
|
918 |
if ($body != null) $body->lastChild()->outertext .= $hiddenspans;
|
919 |
}
|
920 |
-
|
921 |
-
if (($this->allow_ad && !$this->default_lang && mt_rand(1, 100) > 95) || // 5 of 100 for translated non default language pages
|
922 |
-
($this->allow_ad && $this->default_lang && mt_rand(1, 100) > 99) || // 1 of 100 for translated default languages pages
|
923 |
-
(!$this->allow_ad && mt_rand(1, 1000) > 999)) { // 1 of 1000 otherwise
|
924 |
-
$this->do_ad_switch();
|
925 |
-
}
|
926 |
// This adds a meta tag with our statistics json-encoded inside...
|
927 |
$this->stats->stop_timing();
|
928 |
$head = $this->html->find('head', 0);
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
require_once("shd/simple_html_dom.php");
|
133 |
|
134 |
/** @var boolean should we attempt to handle page as json */
|
135 |
public $might_json = false;
|
|
|
136 |
//first three are html, later 3 come from feeds xml (link is problematic...)
|
137 |
protected $ignore_tags = array('script' => 1, 'style' => 1, 'code' => 1, 'wfw:commentrss' => 1, 'comments' => 1, 'guid' => 1);
|
138 |
|
604 |
return $span;
|
605 |
}
|
606 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
/**
|
608 |
* Allow changing of parsing rules, yeah, I caved
|
609 |
* @param type $puncts
|
898 |
$body = $this->html->find('body', 0);
|
899 |
if ($body != null) $body->lastChild()->outertext .= $hiddenspans;
|
900 |
}
|
901 |
+
|
|
|
|
|
|
|
|
|
|
|
902 |
// This adds a meta tag with our statistics json-encoded inside...
|
903 |
$this->stats->stop_timing();
|
904 |
$head = $this->html->find('head', 0);
|
core/utils.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/**
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/**
|
img/flags53.png
DELETED
Binary file
|
img/flags58.png
DELETED
Binary file
|
img/flags59.png
DELETED
Binary file
|
img/flags60.png
DELETED
Binary file
|
img/flags65.png
DELETED
Binary file
|
img/flags66.png
DELETED
Binary file
|
img/flags66b.png
DELETED
Binary file
|
js/admin/backendtranslate.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(e){function t(b,a){n+=1;e("#progress_bar").progressbar("value",n/o*100);e("#p").text("("+a+") "+b);n===o&&e("#tr_loading").data("done",true)}function j(b,a,c,f){a=e("<div>"+e.trim(a)+"</div>").text();t(a,c);clearTimeout(p);l+=1;k.push(b);g.push(a);h.push(c);i.push(f);p=setTimeout(function(){var a={action:"tp_translation",items:l},d;for(d=0;d<l;d+=1)k[d]!==k[d-1]&&(a["tk"+d]=k[d]),h[d]!==h[d-1]&&(a["ln"+d]=h[d]),g[d]!==g[d-1]&&(a["tr"+d]=g[d]),i[d]!==i[d-1]&&(a["sr"+d]=i[d]);e.ajax({type:"POST",
|
12 |
url:t_jp.ajaxurl,data:a,success:function(){},error:function(){}});l=0;g=[];k=[];h=[];i=[]},200)}function u(b,a,c){var f=c;f==="zh"?f="zh-chs":f==="zh-tw"&&(f="zh-cht");t_jp.dmt(a,function(a){e(a).each(function(a){j(b[a],this.TranslatedText,c,2)})},f)}function v(b,a,c){t_jp.dat(a,function(a){a.responseStatus>=200&&a.responseStatus<300&&(a.responseData.translatedText!==void 0?j(b[0],a.responseData.translatedText):e(a.responseData).each(function(a){this.responseStatus===200&&j(b[a],this.responseData.translatedText,
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(e){function t(b,a){n+=1;e("#progress_bar").progressbar("value",n/o*100);e("#p").text("("+a+") "+b);n===o&&e("#tr_loading").data("done",true)}function j(b,a,c,f){a=e("<div>"+e.trim(a)+"</div>").text();t(a,c);clearTimeout(p);l+=1;k.push(b);g.push(a);h.push(c);i.push(f);p=setTimeout(function(){var a={action:"tp_translation",items:l},d;for(d=0;d<l;d+=1)k[d]!==k[d-1]&&(a["tk"+d]=k[d]),h[d]!==h[d-1]&&(a["ln"+d]=h[d]),g[d]!==g[d-1]&&(a["tr"+d]=g[d]),i[d]!==i[d-1]&&(a["sr"+d]=i[d]);e.ajax({type:"POST",
|
12 |
url:t_jp.ajaxurl,data:a,success:function(){},error:function(){}});l=0;g=[];k=[];h=[];i=[]},200)}function u(b,a,c){var f=c;f==="zh"?f="zh-chs":f==="zh-tw"&&(f="zh-cht");t_jp.dmt(a,function(a){e(a).each(function(a){j(b[a],this.TranslatedText,c,2)})},f)}function v(b,a,c){t_jp.dat(a,function(a){a.responseStatus>=200&&a.responseStatus<300&&(a.responseData.translatedText!==void 0?j(b[0],a.responseData.translatedText):e(a.responseData).each(function(a){this.responseStatus===200&&j(b[a],this.responseData.translatedText,
|
js/admin/commentslang.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){var c={en:"English - English",af:"Afrikaans - Afrikaans",sq:"Albanian - Shqip",ar:"Arabic - \u0627\u0644\u0639\u0631\u0628\u064a\u0629",hy:"Armenian - \u0540\u0561\u0575\u0565\u0580\u0565\u0576",az:"Azerbaijani - az\u0259rbaycan dili",eu:"Basque - Euskara",be:"Belarusian - \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f",bn:"Bengali - \u09ac\u09be\u0982\u09b2\u09be",bg:"Bulgarian - \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438",ca:"Catalan - Catal\u00e0",zh:"Chinese (Simplified) - \u4e2d\u6587(\u7b80\u4f53)",
|
12 |
"zh-tw":"Chinese (Traditional) - \u4e2d\u6587(\u6f22\u5b57)",hr:"Croatian - Hrvatski",cs:"Czech - \u010ce\u0161tina",da:"Danish - Dansk",nl:"Dutch - Nederlands",eo:"Esperanto - Esperanto",et:"Estonian - Eesti keel",fi:"Finnish - Suomi",fr:"French - Fran\u00e7ais",gl:"Galician - Galego",ka:"Georgian - \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8",de:"German - Deutsch",el:"Greek - \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",gu:"Gujarati - \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0",ht:"Haitian - Krey\u00f2l ayisyen",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){var c={en:"English - English",af:"Afrikaans - Afrikaans",sq:"Albanian - Shqip",ar:"Arabic - \u0627\u0644\u0639\u0631\u0628\u064a\u0629",hy:"Armenian - \u0540\u0561\u0575\u0565\u0580\u0565\u0576",az:"Azerbaijani - az\u0259rbaycan dili",eu:"Basque - Euskara",be:"Belarusian - \u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f",bn:"Bengali - \u09ac\u09be\u0982\u09b2\u09be",bg:"Bulgarian - \u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438",ca:"Catalan - Catal\u00e0",zh:"Chinese (Simplified) - \u4e2d\u6587(\u7b80\u4f53)",
|
12 |
"zh-tw":"Chinese (Traditional) - \u4e2d\u6587(\u6f22\u5b57)",hr:"Croatian - Hrvatski",cs:"Czech - \u010ce\u0161tina",da:"Danish - Dansk",nl:"Dutch - Nederlands",eo:"Esperanto - Esperanto",et:"Estonian - Eesti keel",fi:"Finnish - Suomi",fr:"French - Fran\u00e7ais",gl:"Galician - Galego",ka:"Georgian - \u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8",de:"German - Deutsch",el:"Greek - \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",gu:"Gujarati - \u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0",ht:"Haitian - Krey\u00f2l ayisyen",
|
js/admin/contexthelp.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){a(".tp_help").live("click",function(b){b.preventDefault();window.scrollTo(0,0);a("#tab-link-"+jQuery(this).attr("rel")+" a").trigger("click");a("#contextual-help-link").hasClass("screen-meta-active")||a("#contextual-help-link").trigger("click")})})(jQuery);
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){a(".tp_help").live("click",function(b){b.preventDefault();window.scrollTo(0,0);a("#tab-link-"+jQuery(this).attr("rel")+" a").trigger("click");a("#contextual-help-link").hasClass("screen-meta-active")||a("#contextual-help-link").trigger("click")})})(jQuery);
|
js/admin/languages.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){a(function(){a("#sortable").sortable({placeholder:"highlight",update:function(c,b){b.item.unbind("click");b.item.one("click",function(b){b.stopImmediatePropagation();a(this).click(clickfunction)})}});a("#sortable").disableSelection();a("#changename").click(function(){a(".langname").toggleClass("hidden");return false});a("#selectall").click(function(){a("#sortable .languages").addClass("lng_active");a("#sortable .lng_active").each(function(){a("input",this).val(a(this).attr("id")+",v")});
|
12 |
return false});clickfunction=function(){a(this).attr("id")!=a("#default_list li").attr("id")&&(a(this).toggleClass("lng_active"),a("input",this).val(a(this).attr("id")+(a(this).hasClass("lng_active")?",v":",")))};a(".languages").dblclick(clickfunction).click(clickfunction);a("#default_lang").droppable({accept:".languages",activeClass:"highlight_default",drop:function(c,b){a("#default_list").empty();a(b.draggable.clone().removeAttr("style").removeClass("lng_active")).appendTo("#default_list").show("slow");
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){a(function(){a("#sortable").sortable({placeholder:"highlight",update:function(c,b){b.item.unbind("click");b.item.one("click",function(b){b.stopImmediatePropagation();a(this).click(clickfunction)})}});a("#sortable").disableSelection();a("#changename").click(function(){a(".langname").toggleClass("hidden");return false});a("#selectall").click(function(){a("#sortable .languages").addClass("lng_active");a("#sortable .lng_active").each(function(){a("input",this).val(a(this).attr("id")+",v")});
|
12 |
return false});clickfunction=function(){a(this).attr("id")!=a("#default_list li").attr("id")&&(a(this).toggleClass("lng_active"),a("input",this).val(a(this).attr("id")+(a(this).hasClass("lng_active")?",v":",")))};a(".languages").dblclick(clickfunction).click(clickfunction);a("#default_lang").droppable({accept:".languages",activeClass:"highlight_default",drop:function(c,b){a("#default_list").empty();a(b.draggable.clone().removeAttr("style").removeClass("lng_active")).appendTo("#default_list").show("slow");
|
js/admin/utils.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){a(function(){a.ajaxSetup({cache:false});a("#transposh-reset-options").click(function(){if(!confirm("Are you sure you want to do this?"))return false;if(!confirm("Are you REALLY sure you want to do this, your configuration will be reset?"))return false;a.post(ajaxurl,{action:"tp_reset"})});backupclick=function(){a("#transposh-backup").unbind("click").click(function(){return false}).text("Backup In Progress");a.post(ajaxurl,{action:"tp_backup"},function(b){var c="red";b[0]=="2"&&(c="green");
|
12 |
a("#backup_result").html(b).css("color",c);a("#transposh-backup").unbind("click").click(backupclick).text("Do Backup Now")});return false};a("#transposh-backup").click(backupclick);cleanautoclick=function(b,c){if(!confirm("Are you sure you want to do this?"))return false;if(b==0&&!confirm("Are you REALLY sure you want to do this?"))return false;var d=c.text();c.unbind("click").click(function(){return false}).text("Cleanup in progress");a.post(ajaxurl,{action:"tp_cleanup",days:b},function(){c.unbind("click").click(function(){cleanautoclick(b,
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){a(function(){a.ajaxSetup({cache:false});a("#transposh-reset-options").click(function(){if(!confirm("Are you sure you want to do this?"))return false;if(!confirm("Are you REALLY sure you want to do this, your configuration will be reset?"))return false;a.post(ajaxurl,{action:"tp_reset"})});backupclick=function(){a("#transposh-backup").unbind("click").click(function(){return false}).text("Backup In Progress");a.post(ajaxurl,{action:"tp_backup"},function(b){var c="red";b[0]=="2"&&(c="green");
|
12 |
a("#backup_result").html(b).css("color",c);a("#transposh-backup").unbind("click").click(backupclick).text("Do Backup Now")});return false};a("#transposh-backup").click(backupclick);cleanautoclick=function(b,c){if(!confirm("Are you sure you want to do this?"))return false;if(b==0&&!confirm("Are you REALLY sure you want to do this?"))return false;var d=c.text();c.unbind("click").click(function(){return false}).text("Cleanup in progress");a.post(ajaxurl,{action:"tp_cleanup",days:b},function(){c.unbind("click").click(function(){cleanautoclick(b,
|
js/admin/warningclose.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){a(function(){a(".warning-close").click(function(){a(this).parents("div:first").hide();a.post(ajaxurl,{action:"tp_close_warning",id:a(this).attr("id")})})})})(jQuery);
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){a(function(){a(".warning-close").click(function(){a(this).parents("div:first").hide();a.post(ajaxurl,{action:"tp_close_warning",id:a(this).attr("id")})})})})(jQuery);
|
js/l/de.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Schlie\u00dfen ohne Speichern?","You have made a change to the translation. Are you sure you want to discard it?":"Sie haben die \u00dcbersetzung bearbeitet. Sind Sie sicher, dass Sie abbrechen wollen?",History:"Verlauf","Loading...":"Laden...",Translated:"\u00dcbersetzt",By:"von",At:"\u00fcber",google:"Google",bing:"Bing",apertium:"Apertium","manual translation":"manuelle \u00dcbersetzung","bing suggest":"Bing Suggest","google suggest":"Google Suggest","apertium suggest":"Apertium Suggest",
|
12 |
"Edit Translation":"\u00dcbersetzung bearbeiten","Original text":"Originaltext","read alternate translations":"alternative \u00dcbersetzung lesen","previous translation":"Vorherige","find on page":"Auf Seite suchen","next translation":"N\u00e4chste","Translate to":"\u00dcbersetzen nach","view translation log":"\u00dcbersetzungsprotokoll anzeigen","virtual keyboard":"virtuelle Tastatur","approve translation":"\u00dcbersetzung genehmigen","delete":"L\u00f6schen",Discard:"Verwerfen",Cancel:"Abbrechen"};
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Schlie\u00dfen ohne Speichern?","You have made a change to the translation. Are you sure you want to discard it?":"Sie haben die \u00dcbersetzung bearbeitet. Sind Sie sicher, dass Sie abbrechen wollen?",History:"Verlauf","Loading...":"Laden...",Translated:"\u00dcbersetzt",By:"von",At:"\u00fcber",google:"Google",bing:"Bing",apertium:"Apertium","manual translation":"manuelle \u00dcbersetzung","bing suggest":"Bing Suggest","google suggest":"Google Suggest","apertium suggest":"Apertium Suggest",
|
12 |
"Edit Translation":"\u00dcbersetzung bearbeiten","Original text":"Originaltext","read alternate translations":"alternative \u00dcbersetzung lesen","previous translation":"Vorherige","find on page":"Auf Seite suchen","next translation":"N\u00e4chste","Translate to":"\u00dcbersetzen nach","view translation log":"\u00dcbersetzungsprotokoll anzeigen","virtual keyboard":"virtuelle Tastatur","approve translation":"\u00dcbersetzung genehmigen","delete":"L\u00f6schen",Discard:"Verwerfen",Cancel:"Abbrechen"};
|
js/l/es.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Cerrar sin guardar?","You have made a change to the translation. Are you sure you want to discard it?":"Has cambiado la traducion. Estas seguro que lo quieres eliminar?",History:"Historia","Loading...":"Cargando...",Translated:"Traducido",By:"Por",At:"En",google:"google",bing:"bing",apertium:"apertium","manual translation":"traducci\u00f3n manual","bing suggest":"sugerencia de bing","google suggest":"sugerencia de google","apertium suggest":"sugerencia de apertium",
|
12 |
"Edit Translation":"Editar traducci\u00f3n","Original text":"Texto original","read alternate translations":"lee traducci\u00f3nes alternativas","previous translation":"traducci\u00f3n anterior","find on page":"encuentra en la pagina","next translation":"siguiente traducci\u00f3n","Translate to":"Traducir a","view translation log":"muestra diario de traducion","virtual keyboard":"teclado virtual","approve translation":"aprueba traducion","delete":"eliminar",Discard:"Descartar",Cancel:"Cancelar"};
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Cerrar sin guardar?","You have made a change to the translation. Are you sure you want to discard it?":"Has cambiado la traducion. Estas seguro que lo quieres eliminar?",History:"Historia","Loading...":"Cargando...",Translated:"Traducido",By:"Por",At:"En",google:"google",bing:"bing",apertium:"apertium","manual translation":"traducci\u00f3n manual","bing suggest":"sugerencia de bing","google suggest":"sugerencia de google","apertium suggest":"sugerencia de apertium",
|
12 |
"Edit Translation":"Editar traducci\u00f3n","Original text":"Texto original","read alternate translations":"lee traducci\u00f3nes alternativas","previous translation":"traducci\u00f3n anterior","find on page":"encuentra en la pagina","next translation":"siguiente traducci\u00f3n","Translate to":"Traducir a","view translation log":"muestra diario de traducion","virtual keyboard":"teclado virtual","approve translation":"aprueba traducion","delete":"eliminar",Discard:"Descartar",Cancel:"Cancelar"};
|
js/l/fa.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u0628\u062f\u0648\u0646 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc \u0628\u0628\u0646\u062f\u06cc\u0645\u061f","You have made a change to the translation. Are you sure you want to discard it?":"\u0634\u0645\u0627 \u062f\u0631 \u062a\u0631\u062c\u0645\u0647 \u06cc\u06a9 \u062f\u06af\u0631\u06af\u0648\u0646\u06cc \u0633\u0627\u062e\u062a\u0647 \u0627\u06cc\u062f \u0622\u06cc\u0627 \u0622\u06af\u0627\u0647\u0627\u0646\u0647 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u062f \u0622\u0646 \u0631\u0627 \u062f\u0648\u0631 \u0628\u06cc\u0646\u062f\u0627\u0632\u06cc\u062f\u061f ",
|
12 |
History:"\u067e\u06cc\u0634\u06cc\u0646\u0647","Loading...":"\u0628\u0627\u0631\u06af\u06cc\u0631\u06cc...",Translated:"\u062a\u0631\u062c\u0645\u0647 \u0634\u062f\u0647",By:"\u0628\u0627",At:"\u062f\u0631",google:"\u06af\u0648\u06af\u0644",bing:"\u0628\u06cc\u0646\u06af",apertium:"\u0627\u0650\u06cc \u067e\u0650\u0631\u0634\u0650\u0645","manual translation":"\u062a\u0631\u062c\u0645\u0647 \u06cc \u062f\u0633\u062a\u06cc","bing suggest":"\u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0628\u06cc\u0646\u06af",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u0628\u062f\u0648\u0646 \u0646\u06af\u0647 \u062f\u0627\u0631\u06cc \u0628\u0628\u0646\u062f\u06cc\u0645\u061f","You have made a change to the translation. Are you sure you want to discard it?":"\u0634\u0645\u0627 \u062f\u0631 \u062a\u0631\u062c\u0645\u0647 \u06cc\u06a9 \u062f\u06af\u0631\u06af\u0648\u0646\u06cc \u0633\u0627\u062e\u062a\u0647 \u0627\u06cc\u062f \u0622\u06cc\u0627 \u0622\u06af\u0627\u0647\u0627\u0646\u0647 \u0645\u06cc \u062e\u0648\u0627\u0647\u06cc\u062f \u0622\u0646 \u0631\u0627 \u062f\u0648\u0631 \u0628\u06cc\u0646\u062f\u0627\u0632\u06cc\u062f\u061f ",
|
12 |
History:"\u067e\u06cc\u0634\u06cc\u0646\u0647","Loading...":"\u0628\u0627\u0631\u06af\u06cc\u0631\u06cc...",Translated:"\u062a\u0631\u062c\u0645\u0647 \u0634\u062f\u0647",By:"\u0628\u0627",At:"\u062f\u0631",google:"\u06af\u0648\u06af\u0644",bing:"\u0628\u06cc\u0646\u06af",apertium:"\u0627\u0650\u06cc \u067e\u0650\u0631\u0634\u0650\u0645","manual translation":"\u062a\u0631\u062c\u0645\u0647 \u06cc \u062f\u0633\u062a\u06cc","bing suggest":"\u067e\u06cc\u0634\u0646\u0647\u0627\u062f \u0628\u06cc\u0646\u06af",
|
js/l/he.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u05dc\u05e1\u05d2\u05d5\u05e8 \u05d1\u05dc\u05d9 \u05dc\u05e9\u05de\u05d5\u05e8?","You have made a change to the translation. Are you sure you want to discard it?":"\u05d1\u05d9\u05e6\u05e2\u05ea \u05e9\u05d9\u05e0\u05d5\u05d9 \u05d1\u05ea\u05e8\u05d2\u05d5\u05dd, \u05d4\u05d0\u05dd \u05d0\u05ea\u05d4 \u05d1\u05d8\u05d5\u05d7 \u05e9\u05d0\u05ea\u05d4 \u05e8\u05d5\u05e6\u05d4 \u05dc\u05d5\u05d5\u05ea\u05e8 \u05e2\u05dc\u05d9\u05d5?",History:"\u05d4\u05d9\u05e1\u05d8\u05d5\u05e8\u05d9\u05d4",
|
12 |
"Loading...":"\u05d8\u05d5\u05e2\u05df...",Translated:"\u05ea\u05d5\u05e8\u05d2\u05dd",By:"\u05e2\u05dc \u05d9\u05d3\u05d9",At:"\u05d1",google:"\u05d2\u05d5\u05d2\u05dc",bing:"\u05d1\u05d9\u05e0\u05d2",apertium:"\u05d0\u05e4\u05e8\u05d8\u05d9\u05d5\u05dd","manual translation":"\u05ea\u05e8\u05d2\u05d5\u05dd \u05d9\u05d3\u05e0\u05d9","bing suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d1\u05d9\u05e0\u05d2","google suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d2\u05d5\u05d2\u05dc","apertium suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d0\u05e4\u05e8\u05d8\u05d9\u05d5\u05dd",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u05dc\u05e1\u05d2\u05d5\u05e8 \u05d1\u05dc\u05d9 \u05dc\u05e9\u05de\u05d5\u05e8?","You have made a change to the translation. Are you sure you want to discard it?":"\u05d1\u05d9\u05e6\u05e2\u05ea \u05e9\u05d9\u05e0\u05d5\u05d9 \u05d1\u05ea\u05e8\u05d2\u05d5\u05dd, \u05d4\u05d0\u05dd \u05d0\u05ea\u05d4 \u05d1\u05d8\u05d5\u05d7 \u05e9\u05d0\u05ea\u05d4 \u05e8\u05d5\u05e6\u05d4 \u05dc\u05d5\u05d5\u05ea\u05e8 \u05e2\u05dc\u05d9\u05d5?",History:"\u05d4\u05d9\u05e1\u05d8\u05d5\u05e8\u05d9\u05d4",
|
12 |
"Loading...":"\u05d8\u05d5\u05e2\u05df...",Translated:"\u05ea\u05d5\u05e8\u05d2\u05dd",By:"\u05e2\u05dc \u05d9\u05d3\u05d9",At:"\u05d1",google:"\u05d2\u05d5\u05d2\u05dc",bing:"\u05d1\u05d9\u05e0\u05d2",apertium:"\u05d0\u05e4\u05e8\u05d8\u05d9\u05d5\u05dd","manual translation":"\u05ea\u05e8\u05d2\u05d5\u05dd \u05d9\u05d3\u05e0\u05d9","bing suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d1\u05d9\u05e0\u05d2","google suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d2\u05d5\u05d2\u05dc","apertium suggest":"\u05d4\u05e6\u05e2\u05d5\u05ea \u05d0\u05e4\u05e8\u05d8\u05d9\u05d5\u05dd",
|
js/l/it.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Chiudere senza salvare?","You have made a change to the translation. Are you sure you want to discard it?":"È stata fatta una modifica alla traduzione. Si è sicuri di volerla scartare?",History:"Storia","Loading...":"Caricamento...",Translated:"Tradotto",By:"Da",At:"A",google:"google",bing:"bing",apertium:"apertium","manual translation":"traduzione manuale","bing suggest":"bing suggerisce","google suggest":"google suggerisce","apertium suggest":"apertium suggerisce",
|
12 |
"Edit Translation":"Modifica Traduzione","Original text":"Testo Originale","read alternate translations":"leggi le traduzioni alternative","previous translation":"traduzione precedente","find on page":"trova nella pagina","next translation":"prossima traduzione","Translate to":"Tradotto in","view translation log":"guarda il log delle traduzioni","virtual keyboard":"tastiera virtuale","approve translation":"approva traduzione","delete":"cancella",Discard:"Scarta",Cancel:"Cancella"};
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Chiudere senza salvare?","You have made a change to the translation. Are you sure you want to discard it?":"È stata fatta una modifica alla traduzione. Si è sicuri di volerla scartare?",History:"Storia","Loading...":"Caricamento...",Translated:"Tradotto",By:"Da",At:"A",google:"google",bing:"bing",apertium:"apertium","manual translation":"traduzione manuale","bing suggest":"bing suggerisce","google suggest":"google suggerisce","apertium suggest":"apertium suggerisce",
|
12 |
"Edit Translation":"Modifica Traduzione","Original text":"Testo Originale","read alternate translations":"leggi le traduzioni alternative","previous translation":"traduzione precedente","find on page":"trova nella pagina","next translation":"prossima traduzione","Translate to":"Tradotto in","view translation log":"guarda il log delle traduzioni","virtual keyboard":"tastiera virtuale","approve translation":"approva traduzione","delete":"cancella",Discard:"Scarta",Cancel:"Cancella"};
|
js/l/nl.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Sluiten zonder op te slaan?","You have made a change to the translation. Are you sure you want to discard it?":"Je hebt de vertaling aangepast. Weet je zeker dat je dat wilt annuleren?",History:"Geschiedenis","Loading...":"Aan het laden...",Translated:"Vertaald",By:"Door",At:"Op",google:"google",bing:"bing",apertium:"apertium","manual translation":"eigen vertaling","bing suggest":"bing suggestie","google suggest":"google suggestie","apertium suggest":"apertium suggestie",
|
12 |
"Edit Translation":"Vertaling aanpassen","Original text":"Oorspronkelijke tekst","read alternate translations":"bekijk alternatieve vertaling","previous translation":"vorige","find on page":"laat op de pagina zien","next translation":"volgende","Translate to":"Vertaal naar","view translation log":"Bekijk vertaallog","virtual keyboard":"virtueel toetsenbord","approve translation":"vertaling goedkeuren","delete":"verwijder",Discard:"weggooien",Cancel:"Annuleren"};
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Sluiten zonder op te slaan?","You have made a change to the translation. Are you sure you want to discard it?":"Je hebt de vertaling aangepast. Weet je zeker dat je dat wilt annuleren?",History:"Geschiedenis","Loading...":"Aan het laden...",Translated:"Vertaald",By:"Door",At:"Op",google:"google",bing:"bing",apertium:"apertium","manual translation":"eigen vertaling","bing suggest":"bing suggestie","google suggest":"google suggestie","apertium suggest":"apertium suggestie",
|
12 |
"Edit Translation":"Vertaling aanpassen","Original text":"Oorspronkelijke tekst","read alternate translations":"bekijk alternatieve vertaling","previous translation":"vorige","find on page":"laat op de pagina zien","next translation":"volgende","Translate to":"Vertaal naar","view translation log":"Bekijk vertaallog","virtual keyboard":"virtueel toetsenbord","approve translation":"vertaling goedkeuren","delete":"verwijder",Discard:"weggooien",Cancel:"Annuleren"};
|
js/l/ru.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u0431\u0435\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f?","You have made a change to the translation. Are you sure you want to discard it?":"\u0412\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435. \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u044d\u0442\u043e?",
|
12 |
History:"\u0418\u0441\u0442\u043e\u0440\u0438\u044f","Loading...":"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430...",Translated:"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043e",By:"",At:"\u0412",google:"",bing:"",apertium:"","manual translation":"\u0440\u0443\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434","bing suggest":"\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 bing","google suggest":"\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 google",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u0431\u0435\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f?","You have made a change to the translation. Are you sure you want to discard it?":"\u0412\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435. \u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u044d\u0442\u043e?",
|
12 |
History:"\u0418\u0441\u0442\u043e\u0440\u0438\u044f","Loading...":"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430...",Translated:"\u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043e",By:"",At:"\u0412",google:"",bing:"",apertium:"","manual translation":"\u0440\u0443\u0447\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434","bing suggest":"\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 bing","google suggest":"\u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 google",
|
js/l/tr.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Kaydetmeden \u00e7\u0131k\u0131\u015f yap?","You have made a change to the translation. Are you sure you want to discard it?":"\u00c7eviride de\u011fi\u015flikler yapt\u0131n\u0131z. Kaydetmeden \u00e7\u0131k\u0131\u015f yapmak istedi\u011finizden emin misiniz?",History:"Ge\u00e7mi\u015f","Loading...":"Y\u00fckleniyor...",Translated:"\u00c7evirildi",By:"\u00c7eviren:",At:"\u00c7evirildi\u011fi Sistem:",google:"google",bing:"bing",apertium:"apertium","manual translation":"manuel \u00e7eviri",
|
12 |
"bing suggest":"bing tavsiyesi","google suggest":"google tavsiyesi","apertium suggest":"apertium tavsiyesi","Edit Translation":"\u00c7eviriyi D\u00fczenle","Original text":"Orjinal yaz\u0131","read alternate translations":"alternatif \u00e7evirileri oku ","previous translation":"ge\u00e7mi\u015f \u00e7eviri","find on page":"sayfada aroma yap","next translation":"gelecek \u00e7eviri","Translate to":"\u015eu dile \u00e7evir","view translation log":"\u00e7eviri log verilerini g\u00f6r\u00fcnt\u00fcle",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
t_jp.l={"Close without saving?":"Kaydetmeden \u00e7\u0131k\u0131\u015f yap?","You have made a change to the translation. Are you sure you want to discard it?":"\u00c7eviride de\u011fi\u015flikler yapt\u0131n\u0131z. Kaydetmeden \u00e7\u0131k\u0131\u015f yapmak istedi\u011finizden emin misiniz?",History:"Ge\u00e7mi\u015f","Loading...":"Y\u00fckleniyor...",Translated:"\u00c7evirildi",By:"\u00c7eviren:",At:"\u00c7evirildi\u011fi Sistem:",google:"google",bing:"bing",apertium:"apertium","manual translation":"manuel \u00e7eviri",
|
12 |
"bing suggest":"bing tavsiyesi","google suggest":"google tavsiyesi","apertium suggest":"apertium tavsiyesi","Edit Translation":"\u00c7eviriyi D\u00fczenle","Original text":"Orjinal yaz\u0131","read alternate translations":"alternatif \u00e7evirileri oku ","previous translation":"ge\u00e7mi\u015f \u00e7eviri","find on page":"sayfada aroma yap","next translation":"gelecek \u00e7eviri","Translate to":"\u015eu dile \u00e7evir","view translation log":"\u00e7eviri log verilerini g\u00f6r\u00fcnt\u00fcle",
|
js/transposh.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(c){function A(b,a){if(c.trim(a).length!==0){var d=function(){var b=c(this).attr("id").substr(c(this).attr("id").lastIndexOf("_")+1),a=c("#"+e+"img_"+b);c("#"+e+b).attr("data-source",1);a.removeClass("tr-icon-yellow").removeClass("tr-icon-green").addClass("tr-icon-yellow")};c("*[data-token='"+b+"'][data-hidden!='y']").html(a).each(d);c("*[data-token='"+b+"'][data-hidden='y']").attr("data-trans",a).each(d)}}function B(b,a){clearTimeout(q);h.push(b);o.push(a);A(b,a);q=setTimeout(function(){var b=
|
12 |
{ln0:t_jp.lang,sr0:p,action:"tp_translation",items:h.length},a;for(a=0;a<h.length;a+=1)b["tk"+a]=h[a],b["tr"+a]=o[a],r+=c("*[data-token='"+h[a]+"']").size();c.ajax({type:"POST",url:t_jp.ajaxurl,data:b,success:function(){var b=r/i*100;t_jp.progress&&c("#"+k).progressbar("value",b)}});o=[];h=[]},200)}function j(b,a){B(b,c("<div>"+c.trim(a)+"</div>").text());var d=(i-c("."+e+'[data-source=""]').size())/i*100;t_jp.progress&&c("#"+l).progressbar("value",d)}function s(b,a,d){c.ajax({url:t_jp.ajaxurl,dataType:"json",
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(c){function A(b,a){if(c.trim(a).length!==0){var d=function(){var b=c(this).attr("id").substr(c(this).attr("id").lastIndexOf("_")+1),a=c("#"+e+"img_"+b);c("#"+e+b).attr("data-source",1);a.removeClass("tr-icon-yellow").removeClass("tr-icon-green").addClass("tr-icon-yellow")};c("*[data-token='"+b+"'][data-hidden!='y']").html(a).each(d);c("*[data-token='"+b+"'][data-hidden='y']").attr("data-trans",a).each(d)}}function B(b,a){clearTimeout(q);h.push(b);o.push(a);A(b,a);q=setTimeout(function(){var b=
|
12 |
{ln0:t_jp.lang,sr0:p,action:"tp_translation",items:h.length},a;for(a=0;a<h.length;a+=1)b["tk"+a]=h[a],b["tr"+a]=o[a],r+=c("*[data-token='"+h[a]+"']").size();c.ajax({type:"POST",url:t_jp.ajaxurl,data:b,success:function(){var b=r/i*100;t_jp.progress&&c("#"+k).progressbar("value",b)}});o=[];h=[]},200)}function j(b,a){B(b,c("<div>"+c.trim(a)+"</div>").text());var d=(i-c("."+e+'[data-source=""]').size())/i*100;t_jp.progress&&c("#"+l).progressbar("value",d)}function s(b,a,d){c.ajax({url:t_jp.ajaxurl,dataType:"json",
|
js/transposhedit.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
/*
|
2 |
-
* Transposh v0.9.
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
-
* Date: Mon,
|
10 |
*/
|
11 |
(function(a){function e(a){var b;return typeof t_jp.l==="object"&&(b=t_jp.l[a])?b:a}function n(c,d,e){a.trim(d).length===0&&(d=a("[data-token='"+c+"']").attr("data-orig"));var f=function(){var c=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),d=a(b+"img_"+c);a(b+c).attr("data-source",e);d.removeClass("tr-icon-yellow").removeClass("tr-icon-green");e==0?d.addClass("tr-icon-green"):e&&d.addClass("tr-icon-yellow")};a("*[data-token='"+c+"'][data-hidden!='y']").html(d).each(f);a("*[data-token='"+
|
12 |
c+"'][data-hidden='y']").attr("data-trans",d).each(f);a(b+"translation").data("origval",d);a(b+"translation").keyup()}function o(b,d){n(b,d,0);a.ajax({type:"POST",url:t_jp.ajaxurl,data:{action:"tp_translation",ln0:t_jp.lang,sr0:0,items:1,tk0:b,tr0:d},error:function(a){n(b,"",1);alert("Problem saving translation, contact support.\n\nServer's message: "+a.statusText)}})}function y(){t_jp.google_key?t_jp.dgt(a(b+"original").val(),function(c){a(b+"translation").val(a("<div>"+a.trim(c.data.translations[0].translatedText)+
|
@@ -36,5 +36,5 @@ da:"Danish - Dansk",nl:"Dutch - Nederlands",eo:"Esperanto - Esperanto",et:"Eston
|
|
36 |
hu:"Hungarian - Magyar",is:"Icelandic - \u00cdslenska",id:"Indonesian - Bahasa Indonesia",ga:"Irish - Gaeilge",it:"Italian - Italiano",ja:"Japanese - \u65e5\u672c\u8a9e",kn:"Kannada - \u0c95\u0ca8\u0ccd\u0ca8\u0ca1",ko:"Korean - \uc6b0\ub9ac\ub9d0",lo:"Lao - \u0e9e\u0eb2\u0eaa\u0eb2\u0ea5\u0eb2\u0ea7",la:"Latin - Lat\u012bna",lv:"Latvian - Latvie\u0161u valoda",lt:"Lithuanian - Lietuvi\u0173 kalba",mk:"Macedonian - \u043c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438 \u0458\u0430\u0437\u0438\u043a",
|
37 |
ms:"Malay - Bahasa Melayu",mt:"Maltese - Malti",no:"Norwegian - Norsk",fa:"Persian - \u067e\u0627\u0631\u0633\u06cc",pl:"Polish - Polski",pt:"Portuguese - Portugu\u00eas",ro:"Romanian - Rom\u00e2n\u0103",ru:"Russian - \u0420\u0443\u0441\u0441\u043a\u0438\u0439",sr:"Serbian - C\u0440\u043f\u0441\u043a\u0438 \u0458\u0435\u0437\u0438\u043a",sk:"Slovak - Sloven\u010dina",sl:"Slovene - Sloven\u0161\u010dina",es:"Spanish - Espa\u00f1ol",sw:"Swahili - Kiswahili",sv:"Swedish - Svenska",tl:"Tagalog - Tagalog",
|
38 |
ta:"Tamil - \u0ba4\u0bae\u0bbf\u0bb4\u0bcd",te:"Telugu - \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41",th:"Thai - \u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",tr:"Turkish - T\u00fcrk\u00e7e",uk:"Ukrainian - \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur:"Urdu - \u0627\u0631\u062f\u0648",vi:"Vietnamese - Ti\u1ebfng Vi\u1ec7t",cy:"Welsh - Cymraeg",yi:"Yiddish - \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9"},d=t_jp.prefix,b="#"+d,x=false,t="prev",u="next",k="right",i="left",w=39,v=37;a("html").attr("dir")===
|
39 |
-
"rtl"&&(k="left",i="right",v=39,w=37,t="next",u="prev");a("."+d).each(function(){var c=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),e;a(this).after('<span id="'+d+"img_"+c+'" class="tr-icon" title="'+a(this).attr("data-orig")+'"></span>');e=a(b+"img_"+c);var i=function(){t_jp.locale&&!x?a.getScript(t_jp.plugin_url+"/js/l/"+t_jp.lang+".js",function(){x=true;s(c)}):s(c)};e.click(function(){t_jp.tfju(function(){i()});return false}).css({border:"0px",
|
40 |
-
"0"?e.addClass("tr-icon-green"):a(this).attr("data-source")&&e.addClass("tr-icon-yellow");a(this).attr("data-hidden")==="y"&&e.css({opacity:"0.6"})})})(jQuery);
|
1 |
/*
|
2 |
+
* Transposh v0.9.3
|
3 |
* http://transposh.org/
|
4 |
*
|
5 |
* Copyright 2013, Team Transposh
|
6 |
* Licensed under the GPL Version 2 or higher.
|
7 |
* http://transposh.org/license
|
8 |
*
|
9 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
10 |
*/
|
11 |
(function(a){function e(a){var b;return typeof t_jp.l==="object"&&(b=t_jp.l[a])?b:a}function n(c,d,e){a.trim(d).length===0&&(d=a("[data-token='"+c+"']").attr("data-orig"));var f=function(){var c=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),d=a(b+"img_"+c);a(b+c).attr("data-source",e);d.removeClass("tr-icon-yellow").removeClass("tr-icon-green");e==0?d.addClass("tr-icon-green"):e&&d.addClass("tr-icon-yellow")};a("*[data-token='"+c+"'][data-hidden!='y']").html(d).each(f);a("*[data-token='"+
|
12 |
c+"'][data-hidden='y']").attr("data-trans",d).each(f);a(b+"translation").data("origval",d);a(b+"translation").keyup()}function o(b,d){n(b,d,0);a.ajax({type:"POST",url:t_jp.ajaxurl,data:{action:"tp_translation",ln0:t_jp.lang,sr0:0,items:1,tk0:b,tr0:d},error:function(a){n(b,"",1);alert("Problem saving translation, contact support.\n\nServer's message: "+a.statusText)}})}function y(){t_jp.google_key?t_jp.dgt(a(b+"original").val(),function(c){a(b+"translation").val(a("<div>"+a.trim(c.data.translations[0].translatedText)+
|
36 |
hu:"Hungarian - Magyar",is:"Icelandic - \u00cdslenska",id:"Indonesian - Bahasa Indonesia",ga:"Irish - Gaeilge",it:"Italian - Italiano",ja:"Japanese - \u65e5\u672c\u8a9e",kn:"Kannada - \u0c95\u0ca8\u0ccd\u0ca8\u0ca1",ko:"Korean - \uc6b0\ub9ac\ub9d0",lo:"Lao - \u0e9e\u0eb2\u0eaa\u0eb2\u0ea5\u0eb2\u0ea7",la:"Latin - Lat\u012bna",lv:"Latvian - Latvie\u0161u valoda",lt:"Lithuanian - Lietuvi\u0173 kalba",mk:"Macedonian - \u043c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438 \u0458\u0430\u0437\u0438\u043a",
|
37 |
ms:"Malay - Bahasa Melayu",mt:"Maltese - Malti",no:"Norwegian - Norsk",fa:"Persian - \u067e\u0627\u0631\u0633\u06cc",pl:"Polish - Polski",pt:"Portuguese - Portugu\u00eas",ro:"Romanian - Rom\u00e2n\u0103",ru:"Russian - \u0420\u0443\u0441\u0441\u043a\u0438\u0439",sr:"Serbian - C\u0440\u043f\u0441\u043a\u0438 \u0458\u0435\u0437\u0438\u043a",sk:"Slovak - Sloven\u010dina",sl:"Slovene - Sloven\u0161\u010dina",es:"Spanish - Espa\u00f1ol",sw:"Swahili - Kiswahili",sv:"Swedish - Svenska",tl:"Tagalog - Tagalog",
|
38 |
ta:"Tamil - \u0ba4\u0bae\u0bbf\u0bb4\u0bcd",te:"Telugu - \u0c24\u0c46\u0c32\u0c41\u0c17\u0c41",th:"Thai - \u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",tr:"Turkish - T\u00fcrk\u00e7e",uk:"Ukrainian - \u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur:"Urdu - \u0627\u0631\u062f\u0648",vi:"Vietnamese - Ti\u1ebfng Vi\u1ec7t",cy:"Welsh - Cymraeg",yi:"Yiddish - \u05d9\u05d9\u05b4\u05d3\u05d9\u05e9"},d=t_jp.prefix,b="#"+d,x=false,t="prev",u="next",k="right",i="left",w=39,v=37;a("html").attr("dir")===
|
39 |
+
"rtl"&&(k="left",i="right",v=39,w=37,t="next",u="prev");a("."+d).each(function(){if(typeof a(this).attr("id")!=="undefined"){var c=a(this).attr("id").substr(a(this).attr("id").lastIndexOf("_")+1),e;a(this).after('<span id="'+d+"img_"+c+'" class="tr-icon" title="'+a(this).attr("data-orig")+'"></span>');e=a(b+"img_"+c);var i=function(){t_jp.locale&&!x?a.getScript(t_jp.plugin_url+"/js/l/"+t_jp.lang+".js",function(){x=true;s(c)}):s(c)};e.click(function(){t_jp.tfju(function(){i()});return false}).css({border:"0px",
|
40 |
+
margin:"1px",padding:"0px"});a(this).attr("data-source")==="0"?e.addClass("tr-icon-green"):a(this).attr("data-source")&&e.addClass("tr-icon-yellow");a(this).attr("data-hidden")==="y"&&e.css({opacity:"0.6"})}})})(jQuery);
|
readme.txt
CHANGED
@@ -3,10 +3,10 @@ Contributors: oferwald
|
|
3 |
Donate link: http://transposh.org/donate/
|
4 |
Tags: translation, translate, i18n, widget, filter, buddypress, bilingual, multilingual, transposh, language, crowdsourcing, google translate, bing translate, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
|
5 |
Requires at least: 3.3
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 0.9.
|
8 |
|
9 |
-
Transposh adds best of breed translation support to wordpress,
|
10 |
|
11 |
== Description ==
|
12 |
Transposh translation filter for WordPress offers a unique approach to blog translation. It allows your blog to combine automatic translation with human translation aided by your users with an easy to use in-context interface.
|
@@ -69,6 +69,10 @@ You can find them on our site [here](http://transposh.org/faq)
|
|
69 |
5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
|
70 |
|
71 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
72 |
= 0.9.2 =
|
73 |
Update for some bugs in parsing
|
74 |
= 0.8.0 =
|
@@ -119,6 +123,17 @@ This version allows sorting of languages within the widget
|
|
119 |
* Portuguese (Brazil) translation by [Amilton Junior](http://www.dicasemgeral.com)
|
120 |
|
121 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
= 2013/03/11 - 0.9.2 =
|
123 |
* Basic Woocommerce support
|
124 |
* Override the case when other plugins or themes cause the process_page to be called prematurely
|
3 |
Donate link: http://transposh.org/donate/
|
4 |
Tags: translation, translate, i18n, widget, filter, buddypress, bilingual, multilingual, transposh, language, crowdsourcing, google translate, bing translate, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
|
5 |
Requires at least: 3.3
|
6 |
+
Tested up to: 3.7.1
|
7 |
+
Stable tag: 0.9.4
|
8 |
|
9 |
+
Transposh adds best of breed translation support to wordpress, 67 languages are automatically translated and can be manually corrected with ease.
|
10 |
|
11 |
== Description ==
|
12 |
Transposh translation filter for WordPress offers a unique approach to blog translation. It allows your blog to combine automatic translation with human translation aided by your users with an easy to use in-context interface.
|
69 |
5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
|
70 |
|
71 |
== Upgrade Notice ==
|
72 |
+
= 0.9.4 =
|
73 |
+
Fix broken update, Fix Google proxy
|
74 |
+
= 0.9.3 =
|
75 |
+
Really, no need to upgrade here, please read how to keep your widgets on our site
|
76 |
= 0.9.2 =
|
77 |
Update for some bugs in parsing
|
78 |
= 0.8.0 =
|
123 |
* Portuguese (Brazil) translation by [Amilton Junior](http://www.dicasemgeral.com)
|
124 |
|
125 |
== Changelog ==
|
126 |
+
= 2013/10/31 - 0.9.4 =
|
127 |
+
* Fix broken Google translate internal Proxy
|
128 |
+
* Fix update mechanism to support 3.7+
|
129 |
+
= 2013/05/06 - 0.9.3 =
|
130 |
+
* Removed any linking to Transposh and ad sharing mechnism
|
131 |
+
* Added Khmer
|
132 |
+
* Removed all widgets except the default version
|
133 |
+
* Allow to remove the rel=alternate language marking
|
134 |
+
* Allow to update to complete version from transposh.org
|
135 |
+
* All widgets except the default are no longer included, you may choose to upgrade or get them from our site
|
136 |
+
* This version, while fully functional, has a limit of 5 languages selection
|
137 |
= 2013/03/11 - 0.9.2 =
|
138 |
* Basic Woocommerce support
|
139 |
* Override the case when other plugins or themes cause the process_page to be called prematurely
|
transposh.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
Plugin URI: http://transposh.org/
|
6 |
Description: Translation filter for WordPress, After enabling please set languages at the <a href="admin.php?page=tp_main">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
|
7 |
Author: Team Transposh
|
8 |
-
Version: 0.9.
|
9 |
Author URI: http://transposh.org/
|
10 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
Text Domain: transposh
|
@@ -13,14 +13,14 @@
|
|
13 |
*/
|
14 |
|
15 |
/*
|
16 |
-
* Transposh v0.9.
|
17 |
* http://transposh.org/
|
18 |
*
|
19 |
* Copyright 2013, Team Transposh
|
20 |
* Licensed under the GPL Version 2 or higher.
|
21 |
* http://transposh.org/license
|
22 |
*
|
23 |
-
* Date: Mon,
|
24 |
*/
|
25 |
|
26 |
//avoid direct calls to this file where wp core files not present
|
@@ -79,6 +79,9 @@ class transposh_plugin {
|
|
79 |
/** @var string The directory of the plugin */
|
80 |
public $transposh_plugin_dir;
|
81 |
|
|
|
|
|
|
|
82 |
/** @var boolean Enable rewriting of URLs */
|
83 |
public $enable_permalinks_rewrite;
|
84 |
|
@@ -109,6 +112,9 @@ class transposh_plugin {
|
|
109 |
/** @var boolean Did we get to process but got an empty buffer with no language? (someone flushed us) */
|
110 |
private $tried_buffer = false;
|
111 |
|
|
|
|
|
|
|
112 |
/**
|
113 |
* class constructor
|
114 |
*/
|
@@ -144,15 +150,18 @@ class transposh_plugin {
|
|
144 |
$this->transposh_plugin_dir = plugin_dir_path(__FILE__);
|
145 |
|
146 |
if ($this->options->debug_enable)
|
147 |
-
|
148 |
|
|
|
149 |
//Register some functions into wordpress
|
150 |
-
if ($this->options->debug_enable)
|
151 |
-
|
152 |
-
|
|
|
|
|
153 |
|
154 |
-
// TODO: get_class_methods to replace said mess, other way?
|
155 |
-
add_filter('plugin_action_links_' .
|
156 |
add_filter('query_vars', array(&$this, 'parameter_queryvars'));
|
157 |
add_filter('rewrite_rules_array', array(&$this, 'update_rewrite_rules'));
|
158 |
if ($this->options->enable_url_translate) {
|
@@ -167,8 +176,9 @@ class transposh_plugin {
|
|
167 |
add_action('shutdown', array(&$this, 'on_shutdown'));
|
168 |
add_action('wp_print_styles', array(&$this, 'add_transposh_css'));
|
169 |
add_action('wp_print_scripts', array(&$this, 'add_transposh_js'));
|
170 |
-
|
171 |
-
|
|
|
172 |
// add_action('wp_head', array(&$this,'add_transposh_async'));
|
173 |
add_action('transposh_backup_event', array(&$this, 'run_backup'));
|
174 |
add_action('transposh_oht_event', array(&$this, 'run_oht'));
|
@@ -215,6 +225,13 @@ class transposh_plugin {
|
|
215 |
add_filter('locale', array(&$this, 'transposh_locale_filter'));
|
216 |
}
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
// debug function for bad redirects
|
219 |
add_filter('wp_redirect', array(&$this, 'on_wp_redirect'), 10, 2);
|
220 |
add_filter('redirect_canonical', array(&$this, 'on_redirect_canonical'), 10, 2);
|
@@ -242,9 +259,10 @@ class transposh_plugin {
|
|
242 |
*/
|
243 |
function on_wp_redirect($location, $status) {
|
244 |
// no point in mangling redirection if its our own or its the default language
|
245 |
-
if ($this->transposh_redirect)
|
|
|
246 |
if ($this->options->is_default_language($this->target_language))
|
247 |
-
|
248 |
tp_logger($status . ' ' . $location);
|
249 |
// $trace = debug_backtrace();
|
250 |
// tp_logger($trace);
|
@@ -273,7 +291,8 @@ class transposh_plugin {
|
|
273 |
function on_redirect_canonical($red, $req) {
|
274 |
tp_logger("$red .. $req", 4);
|
275 |
// if the urls are actually the same, don't redirect (same - if it had our proper take care of)
|
276 |
-
if ($this->rewrite_url($red) == urldecode($req))
|
|
|
277 |
// if this is not the default language, we need to make sure it redirects to what we believe is the proper url
|
278 |
if (!$this->options->is_default_language($this->target_language)) {
|
279 |
$red = str_replace(array('%2F', '%3A', '%3B', '%3F', '%3D', '%26'), array('/', ':', ';', '?', '=', '&'), urlencode($this->rewrite_url($red)));
|
@@ -282,7 +301,8 @@ class transposh_plugin {
|
|
282 |
}
|
283 |
|
284 |
function get_clean_url() {
|
285 |
-
if (isset($this->clean_url))
|
|
|
286 |
//remove any language identifier and find the "clean" url, used for posting and calculating urls if needed
|
287 |
$this->clean_url = transposh_utils::cleanup_url($_SERVER['REQUEST_URI'], $this->home_url, true);
|
288 |
// we need this if we are using url translations
|
@@ -292,7 +312,7 @@ class transposh_plugin {
|
|
292 |
return $this->clean_url;
|
293 |
}
|
294 |
|
295 |
-
// function update() {
|
296 |
// require_once('./admin-header.php');
|
297 |
|
298 |
/* $nonce = 'upgrade-plugin_' . $plugin;
|
@@ -370,7 +390,6 @@ class transposh_plugin {
|
|
370 |
$parse->is_edit_mode = $this->edit_mode;
|
371 |
$parse->might_json = $this->attempt_json;
|
372 |
$parse->is_auto_translate = $this->is_auto_translate_permitted();
|
373 |
-
$parse->allow_ad = $this->options->widget_remove_logo;
|
374 |
// TODO - check this!
|
375 |
if (stripos($_SERVER['REQUEST_URI'], '/feed/') !== FALSE) {
|
376 |
tp_logger("in rss feed!", 2);
|
@@ -415,6 +434,12 @@ class transposh_plugin {
|
|
415 |
$this->attempt_json = true;
|
416 |
}
|
417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
// load translation files for transposh
|
419 |
load_plugin_textdomain(TRANSPOSH_TEXT_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/langs');
|
420 |
|
@@ -505,7 +530,8 @@ class transposh_plugin {
|
|
505 |
tp_logger($wp->query_vars);
|
506 |
|
507 |
// fix for custom-permalink (and others that might be double parsing?)
|
508 |
-
if ($this->target_language)
|
|
|
509 |
|
510 |
// first we get the target language
|
511 |
/* $this->target_language = (isset($wp->query_vars[LANG_PARAM])) ? $wp->query_vars[LANG_PARAM] : '';
|
@@ -515,7 +541,7 @@ class transposh_plugin {
|
|
515 |
// TODO TOCHECK!!!!!!!!!!!!!!!!!!!!!!!!!!1
|
516 |
$this->target_language = $this->tgl;
|
517 |
if (!$this->target_language)
|
518 |
-
|
519 |
tp_logger("requested language: {$this->target_language}", 3);
|
520 |
|
521 |
if ($this->tried_buffer) {
|
@@ -536,7 +562,8 @@ class transposh_plugin {
|
|
536 |
!($this->is_special_page($_SERVER['REQUEST_URI']) || (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false)) &&
|
537 |
!(transposh_utils::is_bot())) {
|
538 |
// we are starting a session if needed
|
539 |
-
if (!session_id())
|
|
|
540 |
// no redirections if we already redirected in this session or we suspect cyclic redirections
|
541 |
if (!isset($_SESSION['TR_REDIRECTED']) && !(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] == $_SERVER['REQUEST_URI'])) {
|
542 |
tp_logger('session redirection never happened (yet)', 2);
|
@@ -548,7 +575,7 @@ class transposh_plugin {
|
|
548 |
$url = transposh_utils::rewrite_url_lang_param($_SERVER["REQUEST_URI"], $this->home_url, $this->enable_permalinks_rewrite, $_COOKIE['TR_LNG'], $this->edit_mode);
|
549 |
if ($this->options->is_default_language($_COOKIE['TR_LNG']))
|
550 |
//TODO - fix wrt translation
|
551 |
-
|
552 |
tp_logger("redirected to $url because of cookie", 4);
|
553 |
$this->tp_redirect($url);
|
554 |
exit;
|
@@ -560,7 +587,7 @@ class transposh_plugin {
|
|
560 |
$url = transposh_utils::rewrite_url_lang_param($_SERVER['REQUEST_URI'], $this->home_url, $this->enable_permalinks_rewrite, $bestlang, $this->edit_mode);
|
561 |
if ($this->options->is_default_language($bestlang))
|
562 |
//TODO - fix wrt translation
|
563 |
-
|
564 |
tp_logger("redirected to $url because of bestlang", 4);
|
565 |
$this->tp_redirect($url);
|
566 |
exit;
|
@@ -631,7 +658,7 @@ class transposh_plugin {
|
|
631 |
|
632 |
tp_logger("plugin_activate exit: " . dirname(__FILE__), 1);
|
633 |
tp_logger("testing name:" . plugin_basename(__FILE__), 4);
|
634 |
-
tp_logger("testing name2:" . $this->get_plugin_name(), 4);
|
635 |
//activate_plugin($plugin);
|
636 |
}
|
637 |
|
@@ -659,7 +686,8 @@ class transposh_plugin {
|
|
659 |
|
660 |
if (function_exists('deactivate_plugins')) {
|
661 |
// FIXME :wtf?
|
662 |
-
deactivate_plugins(array(&$this, 'get_plugin_name'), "translate.php");
|
|
|
663 |
echo '<br> This plugin has been automatically deactivated.';
|
664 |
}
|
665 |
|
@@ -706,15 +734,15 @@ class transposh_plugin {
|
|
706 |
* TODO - check!!!
|
707 |
* @return string
|
708 |
*/
|
709 |
-
function get_plugin_name() {
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
|
719 |
/**
|
720 |
* Add custom css, i.e. transposh.css
|
@@ -722,9 +750,10 @@ class transposh_plugin {
|
|
722 |
function add_transposh_css() {
|
723 |
//translation not allowed - no need for the transposh.css
|
724 |
if (!$this->is_editing_permitted() && !$this->is_auto_translate_permitted())
|
725 |
-
|
726 |
// actually - this is only needed when editing
|
727 |
-
if (!$this->edit_mode)
|
|
|
728 |
|
729 |
//include the transposh.css
|
730 |
wp_enqueue_style('transposh', $this->transposh_plugin_url . '/' . TRANSPOSH_DIR_CSS . '/transposh.css', array(), TRANSPOSH_PLUGIN_VER);
|
@@ -739,7 +768,7 @@ class transposh_plugin {
|
|
739 |
//not in any translation mode - no need for any js.
|
740 |
if (!($this->edit_mode || $this->is_auto_translate_permitted() || is_admin() || $this->options->widget_allow_set_deflang))
|
741 |
// TODO: need to include if allowing of setting default language - but smaller!
|
742 |
-
|
743 |
wp_register_script('transposh', $this->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/transposh.js', array('jquery'), TRANSPOSH_PLUGIN_VER, $this->options->enable_footer_scripts);
|
744 |
// true -> 1, false -> nothing
|
745 |
$script_params = array(
|
@@ -765,14 +794,16 @@ class transposh_plugin {
|
|
765 |
$script_params['google_key'] = $this->options->google_key;
|
766 |
}
|
767 |
if ($this->options->google_key || function_exists('curl_init'))
|
768 |
-
|
769 |
}
|
770 |
if (in_array($this->target_language, transposh_consts::$apertium_languages))
|
771 |
-
|
772 |
if ($this->options->oht_id && $this->options->oht_key && in_array($this->target_language, transposh_consts::$oht_languages) && current_user_can('manage_options'))
|
773 |
-
|
774 |
-
if ($this->options->widget_progressbar)
|
775 |
-
|
|
|
|
|
776 |
|
777 |
// load translations needed for edit interface
|
778 |
if ($this->edit_mode) {
|
@@ -804,7 +835,8 @@ class transposh_plugin {
|
|
804 |
* Implements - http://googlewebmastercentral.blogspot.com/2010/09/unifying-content-under-multilingual.html
|
805 |
*/
|
806 |
function add_rel_alternate() {
|
807 |
-
if (is_404())
|
|
|
808 |
$widget_args = $this->widget->create_widget_args($this->get_clean_url());
|
809 |
tp_logger($widget_args, 4);
|
810 |
foreach ($widget_args as $lang) {
|
@@ -822,10 +854,11 @@ class transposh_plugin {
|
|
822 |
// TODO????
|
823 |
function is_editing_permitted() {
|
824 |
// editing is permitted for translators only
|
825 |
-
if (!$this->is_translator())
|
|
|
826 |
// and only on the non-default lang (unless strictly specified)
|
827 |
if (!$this->options->enable_default_translate && $this->options->is_default_language($this->target_language))
|
828 |
-
|
829 |
|
830 |
return $this->options->is_active_language($this->target_language);
|
831 |
}
|
@@ -840,10 +873,11 @@ class transposh_plugin {
|
|
840 |
function is_auto_translate_permitted() {
|
841 |
tp_logger("checking auto translatability", 4);
|
842 |
|
843 |
-
if (!$this->options->enable_autotranslate)
|
|
|
844 |
// auto translate is not enabled for default target language when enable default is disabled
|
845 |
if (!$this->options->enable_default_translate && $this->options->is_default_language($this->target_language))
|
846 |
-
|
847 |
|
848 |
return $this->options->is_active_language($this->target_language);
|
849 |
}
|
@@ -878,8 +912,10 @@ class transposh_plugin {
|
|
878 |
$href = parse_url($href, PHP_URL_PATH);
|
879 |
$parts = explode('/', $href);
|
880 |
foreach ($parts as $part) {
|
881 |
-
if (!$part)
|
882 |
-
|
|
|
|
|
883 |
$ret[] = $part;
|
884 |
if ($part != str_replace('-', ' ', $part)) {
|
885 |
$ret[] = str_replace('-', ' ', $part);
|
@@ -996,12 +1032,12 @@ class transposh_plugin {
|
|
996 |
}
|
997 |
$term = $GLOBALS['wpdb']->escape($q['s']);
|
998 |
if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'])
|
999 |
-
|
1000 |
|
1001 |
if (!empty($search)) {
|
1002 |
$search = " AND ({$search}) ";
|
1003 |
if (!is_user_logged_in())
|
1004 |
-
|
1005 |
}
|
1006 |
}
|
1007 |
tp_logger($search, 3);
|
@@ -1033,7 +1069,7 @@ class transposh_plugin {
|
|
1033 |
*/
|
1034 |
function add_comment_meta_settings($post_id) {
|
1035 |
if (transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url))
|
1036 |
-
|
1037 |
}
|
1038 |
|
1039 |
/**
|
@@ -1074,7 +1110,8 @@ class transposh_plugin {
|
|
1074 |
* @return string wrapped text
|
1075 |
*/
|
1076 |
function post_content_wrap($text) {
|
1077 |
-
if (!isset($GLOBALS['id']))
|
|
|
1078 |
$lang = get_post_meta($GLOBALS['id'], 'tp_language', true);
|
1079 |
if ($lang) {
|
1080 |
$text = "<span lang =\"$lang\">" . $text . "</span>";
|
@@ -1092,7 +1129,8 @@ class transposh_plugin {
|
|
1092 |
*/
|
1093 |
function post_wrap($text, $id = 0) {
|
1094 |
$id = (is_object($id)) ? $id->ID : $id;
|
1095 |
-
if (!$id)
|
|
|
1096 |
$lang = get_post_meta($id, 'tp_language', true);
|
1097 |
if ($lang) {
|
1098 |
if (strpos($_SERVER['REQUEST_URI'], 'wp-admin/edit') !== false) {
|
@@ -1145,7 +1183,7 @@ class transposh_plugin {
|
|
1145 |
tp_logger("($translation, $orig, $domain)", 5);
|
1146 |
// HACK - TODO - FIX
|
1147 |
if (in_array($domain, transposh_consts::$ignored_po_domains))
|
1148 |
-
|
1149 |
if ($translation != $orig) {
|
1150 |
$translation = TP_GTXT_BRK . $translation . TP_GTXT_BRK_CLOSER;
|
1151 |
}
|
@@ -1162,10 +1200,10 @@ class transposh_plugin {
|
|
1162 |
*/
|
1163 |
function transposh_ngettext_filter($translation, $single, $plural, $domain) {
|
1164 |
if ($this->is_special_page($_SERVER['REQUEST_URI']) || ($this->options->is_default_language($this->tgl) && !$this->options->enable_default_translate))
|
1165 |
-
|
1166 |
tp_logger("($translation, $single, $plural, $domain)", 4);
|
1167 |
if (in_array($domain, transposh_consts::$ignored_po_domains))
|
1168 |
-
|
1169 |
if ($translation != $single && $translation != $plural) {
|
1170 |
$translation = TP_GTXT_BRK . $translation . TP_GTXT_BRK_CLOSER;
|
1171 |
}
|
@@ -1250,16 +1288,19 @@ class transposh_plugin {
|
|
1250 |
function on_ajax_nopriv_tp_gsp() {
|
1251 |
$i = 0;
|
1252 |
// we need curl for this proxy
|
1253 |
-
if (!function_exists('curl_init'))
|
|
|
1254 |
transposh_utils::allow_cors();
|
1255 |
-
$tl = $_GET['tl'];
|
1256 |
// we want to avoid unneeded work or dos attacks on languages we don't support
|
1257 |
if (!in_array($tl, transposh_consts::$google_languages) || !$this->options->is_active_language($tl))
|
1258 |
-
|
1259 |
$sl = 'auto';
|
1260 |
-
if (isset($_GET['sl']))
|
|
|
1261 |
$q = urlencode(stripslashes($_GET['q']));
|
1262 |
-
if (!$q)
|
|
|
1263 |
$url = 'http://translate.google.com/translate_a/t?client=a&q=' . $q . '&tl=' . $tl . '&sl=' . $sl;
|
1264 |
$ch = curl_init();
|
1265 |
curl_setopt($ch, CURLOPT_URL, $url);
|
@@ -1298,16 +1339,20 @@ class transposh_plugin {
|
|
1298 |
// Proxied translation for google translate
|
1299 |
function on_ajax_nopriv_tp_gp() {
|
1300 |
// we need curl for this proxy
|
1301 |
-
if (!function_exists('curl_init'))
|
|
|
|
|
1302 |
transposh_utils::allow_cors();
|
1303 |
// target language
|
1304 |
$tl = $_GET['tl'];
|
1305 |
// we want to avoid unneeded work or dos attacks on languages we don't support
|
1306 |
if (!in_array($tl, transposh_consts::$google_languages) || !$this->options->is_active_language($tl))
|
1307 |
-
|
1308 |
// source language
|
1309 |
$sl = 'auto';
|
1310 |
-
if (isset($_GET['sl']))
|
|
|
|
|
1311 |
// item count
|
1312 |
$i = 0;
|
1313 |
$q = '';
|
@@ -1324,7 +1369,7 @@ class transposh_plugin {
|
|
1324 |
// we avoid curling we had all results prehand
|
1325 |
if ($q) {
|
1326 |
$url = 'http://translate.google.com/translate_a/t?client=a' . $q . '&tl=' . $tl . '&sl=' . $sl;
|
1327 |
-
|
1328 |
$ch = curl_init();
|
1329 |
curl_setopt($ch, CURLOPT_URL, $url);
|
1330 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
@@ -1336,24 +1381,34 @@ class transposh_plugin {
|
|
1336 |
die();
|
1337 |
}
|
1338 |
curl_close($ch);
|
1339 |
-
|
1340 |
$jsonarr = json_decode($output);
|
1341 |
if (!$jsonarr) {
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
$
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1355 |
}
|
1356 |
-
//die();
|
1357 |
}
|
1358 |
header('Content-type: text/html; charset=utf-8');
|
1359 |
|
@@ -1365,6 +1420,8 @@ class transposh_plugin {
|
|
1365 |
} else {
|
1366 |
if (isset($jsonarr->results[$k]->sentences[0]->trans)) {
|
1367 |
$jsonout->results[] = $jsonarr->results[$k]->sentences[0]->trans;
|
|
|
|
|
1368 |
} else {
|
1369 |
$jsonout->results[] = $_GET['q'][$j];
|
1370 |
}
|
@@ -1404,7 +1461,7 @@ class transposh_plugin {
|
|
1404 |
}
|
1405 |
$oht = get_option(TRANSPOSH_OPTIONS_OHT, array());
|
1406 |
if (!isset($_GET['orglang']))
|
1407 |
-
|
1408 |
$key = $_GET['token'] . '@' . $_GET['lang'] . '@' . $_GET['orglang'];
|
1409 |
if (isset($oht[$key])) {
|
1410 |
unset($oht[$key]);
|
@@ -1524,6 +1581,35 @@ class transposh_plugin {
|
|
1524 |
die();
|
1525 |
}
|
1526 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1527 |
}
|
1528 |
|
1529 |
$my_transposh_plugin = new transposh_plugin();
|
@@ -1534,9 +1620,9 @@ $my_transposh_plugin = new transposh_plugin();
|
|
1534 |
* Function provided for old widget include code compatability
|
1535 |
* @param array $args Not needed
|
1536 |
*/
|
1537 |
-
function transposh_widget($args = array(), $instance = array('title' => 'Translation')) {
|
1538 |
global $my_transposh_plugin;
|
1539 |
-
$my_transposh_plugin->widget->widget($args, $instance);
|
1540 |
}
|
1541 |
|
1542 |
/**
|
@@ -1569,7 +1655,7 @@ function transposh_echo($default, $altarray) {
|
|
1569 |
function tp_logger($msg, $severity = 3, $do_backtrace = false) {
|
1570 |
global $my_transposh_plugin;
|
1571 |
if (isset($my_transposh_plugin) && is_object($my_transposh_plugin) && !$my_transposh_plugin->options->debug_enable)
|
1572 |
-
|
1573 |
$GLOBALS['tp_logger']->do_log($msg, $severity, $do_backtrace);
|
1574 |
}
|
1575 |
|
5 |
Plugin URI: http://transposh.org/
|
6 |
Description: Translation filter for WordPress, After enabling please set languages at the <a href="admin.php?page=tp_main">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
|
7 |
Author: Team Transposh
|
8 |
+
Version: 0.9.4
|
9 |
Author URI: http://transposh.org/
|
10 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
Text Domain: transposh
|
13 |
*/
|
14 |
|
15 |
/*
|
16 |
+
* Transposh v0.9.3
|
17 |
* http://transposh.org/
|
18 |
*
|
19 |
* Copyright 2013, Team Transposh
|
20 |
* Licensed under the GPL Version 2 or higher.
|
21 |
* http://transposh.org/license
|
22 |
*
|
23 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
24 |
*/
|
25 |
|
26 |
//avoid direct calls to this file where wp core files not present
|
79 |
/** @var string The directory of the plugin */
|
80 |
public $transposh_plugin_dir;
|
81 |
|
82 |
+
/** @var string Plugin main file and dir */
|
83 |
+
public $transposh_plugin_basename;
|
84 |
+
|
85 |
/** @var boolean Enable rewriting of URLs */
|
86 |
public $enable_permalinks_rewrite;
|
87 |
|
112 |
/** @var boolean Did we get to process but got an empty buffer with no language? (someone flushed us) */
|
113 |
private $tried_buffer = false;
|
114 |
|
115 |
+
/** @var boolean Do I need to check for updates by myself? After wordpress checked his */
|
116 |
+
private $do_update_check = false;
|
117 |
+
|
118 |
/**
|
119 |
* class constructor
|
120 |
*/
|
150 |
$this->transposh_plugin_dir = plugin_dir_path(__FILE__);
|
151 |
|
152 |
if ($this->options->debug_enable)
|
153 |
+
tp_logger('Transposh object created: ' . $_SERVER['REQUEST_URI'], 3);
|
154 |
|
155 |
+
$this->transposh_plugin_basename = plugin_basename(__FILE__);
|
156 |
//Register some functions into wordpress
|
157 |
+
if ($this->options->debug_enable) {
|
158 |
+
//tp_logger(preg_replace('|^' . preg_quote(WP_PLUGIN_DIR, '|') . '/|', '', __FILE__), 4); // includes transposh dir and php
|
159 |
+
// tp_logger($this->get_plugin_name());
|
160 |
+
tp_logger(plugin_basename(__FILE__));
|
161 |
+
}
|
162 |
|
163 |
+
// TODO: get_class_methods to replace said mess, other way?
|
164 |
+
add_filter('plugin_action_links_' . $this->transposh_plugin_basename, array(&$this, 'plugin_action_links'));
|
165 |
add_filter('query_vars', array(&$this, 'parameter_queryvars'));
|
166 |
add_filter('rewrite_rules_array', array(&$this, 'update_rewrite_rules'));
|
167 |
if ($this->options->enable_url_translate) {
|
176 |
add_action('shutdown', array(&$this, 'on_shutdown'));
|
177 |
add_action('wp_print_styles', array(&$this, 'add_transposh_css'));
|
178 |
add_action('wp_print_scripts', array(&$this, 'add_transposh_js'));
|
179 |
+
if (!$this->options->dont_add_rel_alternate) {
|
180 |
+
add_action('wp_head', array(&$this, 'add_rel_alternate'));
|
181 |
+
}
|
182 |
// add_action('wp_head', array(&$this,'add_transposh_async'));
|
183 |
add_action('transposh_backup_event', array(&$this, 'run_backup'));
|
184 |
add_action('transposh_oht_event', array(&$this, 'run_oht'));
|
225 |
add_filter('locale', array(&$this, 'transposh_locale_filter'));
|
226 |
}
|
227 |
|
228 |
+
// internal update mechnism
|
229 |
+
if ($this->options->allow_full_version_upgrade) {
|
230 |
+
add_filter('http_request_args', array(&$this, 'filter_wordpress_org_update'), 10, 2);
|
231 |
+
add_filter('pre_set_site_transient_update_plugins', array(&$this, 'check_for_plugin_update'));
|
232 |
+
//add_filter('plugins_api', array(&$this, 'plugin_api_call'), 10, 3);
|
233 |
+
}
|
234 |
+
|
235 |
// debug function for bad redirects
|
236 |
add_filter('wp_redirect', array(&$this, 'on_wp_redirect'), 10, 2);
|
237 |
add_filter('redirect_canonical', array(&$this, 'on_redirect_canonical'), 10, 2);
|
259 |
*/
|
260 |
function on_wp_redirect($location, $status) {
|
261 |
// no point in mangling redirection if its our own or its the default language
|
262 |
+
if ($this->transposh_redirect)
|
263 |
+
return $location;
|
264 |
if ($this->options->is_default_language($this->target_language))
|
265 |
+
return $location;
|
266 |
tp_logger($status . ' ' . $location);
|
267 |
// $trace = debug_backtrace();
|
268 |
// tp_logger($trace);
|
291 |
function on_redirect_canonical($red, $req) {
|
292 |
tp_logger("$red .. $req", 4);
|
293 |
// if the urls are actually the same, don't redirect (same - if it had our proper take care of)
|
294 |
+
if ($this->rewrite_url($red) == urldecode($req))
|
295 |
+
return false;
|
296 |
// if this is not the default language, we need to make sure it redirects to what we believe is the proper url
|
297 |
if (!$this->options->is_default_language($this->target_language)) {
|
298 |
$red = str_replace(array('%2F', '%3A', '%3B', '%3F', '%3D', '%26'), array('/', ':', ';', '?', '=', '&'), urlencode($this->rewrite_url($red)));
|
301 |
}
|
302 |
|
303 |
function get_clean_url() {
|
304 |
+
if (isset($this->clean_url))
|
305 |
+
return $this->clean_url;
|
306 |
//remove any language identifier and find the "clean" url, used for posting and calculating urls if needed
|
307 |
$this->clean_url = transposh_utils::cleanup_url($_SERVER['REQUEST_URI'], $this->home_url, true);
|
308 |
// we need this if we are using url translations
|
312 |
return $this->clean_url;
|
313 |
}
|
314 |
|
315 |
+
// function update() {file_location
|
316 |
// require_once('./admin-header.php');
|
317 |
|
318 |
/* $nonce = 'upgrade-plugin_' . $plugin;
|
390 |
$parse->is_edit_mode = $this->edit_mode;
|
391 |
$parse->might_json = $this->attempt_json;
|
392 |
$parse->is_auto_translate = $this->is_auto_translate_permitted();
|
|
|
393 |
// TODO - check this!
|
394 |
if (stripos($_SERVER['REQUEST_URI'], '/feed/') !== FALSE) {
|
395 |
tp_logger("in rss feed!", 2);
|
434 |
$this->attempt_json = true;
|
435 |
}
|
436 |
|
437 |
+
tp_logger($_SERVER['REQUEST_URI'], 5);
|
438 |
+
if (strpos($_SERVER['REQUEST_URI'], '/wpv-ajax-pagination/') === true) {
|
439 |
+
tp_logger('wpv pagination', 5);
|
440 |
+
$this->target_language = transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url);
|
441 |
+
}
|
442 |
+
|
443 |
// load translation files for transposh
|
444 |
load_plugin_textdomain(TRANSPOSH_TEXT_DOMAIN, false, dirname(plugin_basename(__FILE__)) . '/langs');
|
445 |
|
530 |
tp_logger($wp->query_vars);
|
531 |
|
532 |
// fix for custom-permalink (and others that might be double parsing?)
|
533 |
+
if ($this->target_language)
|
534 |
+
return;
|
535 |
|
536 |
// first we get the target language
|
537 |
/* $this->target_language = (isset($wp->query_vars[LANG_PARAM])) ? $wp->query_vars[LANG_PARAM] : '';
|
541 |
// TODO TOCHECK!!!!!!!!!!!!!!!!!!!!!!!!!!1
|
542 |
$this->target_language = $this->tgl;
|
543 |
if (!$this->target_language)
|
544 |
+
$this->target_language = $this->options->default_language;
|
545 |
tp_logger("requested language: {$this->target_language}", 3);
|
546 |
|
547 |
if ($this->tried_buffer) {
|
562 |
!($this->is_special_page($_SERVER['REQUEST_URI']) || (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false)) &&
|
563 |
!(transposh_utils::is_bot())) {
|
564 |
// we are starting a session if needed
|
565 |
+
if (!session_id())
|
566 |
+
session_start();
|
567 |
// no redirections if we already redirected in this session or we suspect cyclic redirections
|
568 |
if (!isset($_SESSION['TR_REDIRECTED']) && !(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] == $_SERVER['REQUEST_URI'])) {
|
569 |
tp_logger('session redirection never happened (yet)', 2);
|
575 |
$url = transposh_utils::rewrite_url_lang_param($_SERVER["REQUEST_URI"], $this->home_url, $this->enable_permalinks_rewrite, $_COOKIE['TR_LNG'], $this->edit_mode);
|
576 |
if ($this->options->is_default_language($_COOKIE['TR_LNG']))
|
577 |
//TODO - fix wrt translation
|
578 |
+
$url = transposh_utils::cleanup_url($_SERVER["REQUEST_URI"], $this->home_url);
|
579 |
tp_logger("redirected to $url because of cookie", 4);
|
580 |
$this->tp_redirect($url);
|
581 |
exit;
|
587 |
$url = transposh_utils::rewrite_url_lang_param($_SERVER['REQUEST_URI'], $this->home_url, $this->enable_permalinks_rewrite, $bestlang, $this->edit_mode);
|
588 |
if ($this->options->is_default_language($bestlang))
|
589 |
//TODO - fix wrt translation
|
590 |
+
$url = transposh_utils::cleanup_url($_SERVER['REQUEST_URI'], $this->home_url);
|
591 |
tp_logger("redirected to $url because of bestlang", 4);
|
592 |
$this->tp_redirect($url);
|
593 |
exit;
|
658 |
|
659 |
tp_logger("plugin_activate exit: " . dirname(__FILE__), 1);
|
660 |
tp_logger("testing name:" . plugin_basename(__FILE__), 4);
|
661 |
+
// tp_logger("testing name2:" . $this->get_plugin_name(), 4);
|
662 |
//activate_plugin($plugin);
|
663 |
}
|
664 |
|
686 |
|
687 |
if (function_exists('deactivate_plugins')) {
|
688 |
// FIXME :wtf?
|
689 |
+
//deactivate_plugins(array(&$this, 'get_plugin_name'), "translate.php");
|
690 |
+
////!!! deactivate_plugins($this->transposh_plugin_basename, "translate.php");
|
691 |
echo '<br> This plugin has been automatically deactivated.';
|
692 |
}
|
693 |
|
734 |
* TODO - check!!!
|
735 |
* @return string
|
736 |
*/
|
737 |
+
/* function get_plugin_name() {
|
738 |
+
$file = __FILE__;
|
739 |
+
$file = str_replace('\\', '/', $file); // sanitize for Win32 installs
|
740 |
+
$file = preg_replace('|/+|', '/', $file); // remove any duplicate slash
|
741 |
+
//keep only the file name and its parent directory
|
742 |
+
$file = preg_replace('/.*\/([^\/]+\/[^\/]+)$/', '$1', $file);
|
743 |
+
tp_logger("Plugin path - $file", 4);
|
744 |
+
return $file;
|
745 |
+
} */
|
746 |
|
747 |
/**
|
748 |
* Add custom css, i.e. transposh.css
|
750 |
function add_transposh_css() {
|
751 |
//translation not allowed - no need for the transposh.css
|
752 |
if (!$this->is_editing_permitted() && !$this->is_auto_translate_permitted())
|
753 |
+
return;
|
754 |
// actually - this is only needed when editing
|
755 |
+
if (!$this->edit_mode)
|
756 |
+
return;
|
757 |
|
758 |
//include the transposh.css
|
759 |
wp_enqueue_style('transposh', $this->transposh_plugin_url . '/' . TRANSPOSH_DIR_CSS . '/transposh.css', array(), TRANSPOSH_PLUGIN_VER);
|
768 |
//not in any translation mode - no need for any js.
|
769 |
if (!($this->edit_mode || $this->is_auto_translate_permitted() || is_admin() || $this->options->widget_allow_set_deflang))
|
770 |
// TODO: need to include if allowing of setting default language - but smaller!
|
771 |
+
return; // TODO, check just for settings page admin and pages with our translate
|
772 |
wp_register_script('transposh', $this->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/transposh.js', array('jquery'), TRANSPOSH_PLUGIN_VER, $this->options->enable_footer_scripts);
|
773 |
// true -> 1, false -> nothing
|
774 |
$script_params = array(
|
794 |
$script_params['google_key'] = $this->options->google_key;
|
795 |
}
|
796 |
if ($this->options->google_key || function_exists('curl_init'))
|
797 |
+
$script_params['google'] = 1;
|
798 |
}
|
799 |
if (in_array($this->target_language, transposh_consts::$apertium_languages))
|
800 |
+
$script_params['apertium'] = 1;
|
801 |
if ($this->options->oht_id && $this->options->oht_key && in_array($this->target_language, transposh_consts::$oht_languages) && current_user_can('manage_options'))
|
802 |
+
$script_params['oht'] = 1;
|
803 |
+
if ($this->options->widget_progressbar)
|
804 |
+
$script_params['progress'] = 1;
|
805 |
+
if (!$this->options->enable_autotranslate)
|
806 |
+
$script_params['noauto'] = 1;
|
807 |
|
808 |
// load translations needed for edit interface
|
809 |
if ($this->edit_mode) {
|
835 |
* Implements - http://googlewebmastercentral.blogspot.com/2010/09/unifying-content-under-multilingual.html
|
836 |
*/
|
837 |
function add_rel_alternate() {
|
838 |
+
if (is_404())
|
839 |
+
return;
|
840 |
$widget_args = $this->widget->create_widget_args($this->get_clean_url());
|
841 |
tp_logger($widget_args, 4);
|
842 |
foreach ($widget_args as $lang) {
|
854 |
// TODO????
|
855 |
function is_editing_permitted() {
|
856 |
// editing is permitted for translators only
|
857 |
+
if (!$this->is_translator())
|
858 |
+
return false;
|
859 |
// and only on the non-default lang (unless strictly specified)
|
860 |
if (!$this->options->enable_default_translate && $this->options->is_default_language($this->target_language))
|
861 |
+
return false;
|
862 |
|
863 |
return $this->options->is_active_language($this->target_language);
|
864 |
}
|
873 |
function is_auto_translate_permitted() {
|
874 |
tp_logger("checking auto translatability", 4);
|
875 |
|
876 |
+
if (!$this->options->enable_autotranslate)
|
877 |
+
return false;
|
878 |
// auto translate is not enabled for default target language when enable default is disabled
|
879 |
if (!$this->options->enable_default_translate && $this->options->is_default_language($this->target_language))
|
880 |
+
return false;
|
881 |
|
882 |
return $this->options->is_active_language($this->target_language);
|
883 |
}
|
912 |
$href = parse_url($href, PHP_URL_PATH);
|
913 |
$parts = explode('/', $href);
|
914 |
foreach ($parts as $part) {
|
915 |
+
if (!$part)
|
916 |
+
continue;
|
917 |
+
if (is_numeric($part))
|
918 |
+
continue;
|
919 |
$ret[] = $part;
|
920 |
if ($part != str_replace('-', ' ', $part)) {
|
921 |
$ret[] = str_replace('-', ' ', $part);
|
1032 |
}
|
1033 |
$term = $GLOBALS['wpdb']->escape($q['s']);
|
1034 |
if (empty($q['sentence']) && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'])
|
1035 |
+
$search .= " OR ({$GLOBALS['wpdb']->posts}.post_title LIKE '{$n}{$term}{$n}') OR ({$GLOBALS['wpdb']->posts}.post_content LIKE '{$n}{$term}{$n}')";
|
1036 |
|
1037 |
if (!empty($search)) {
|
1038 |
$search = " AND ({$search}) ";
|
1039 |
if (!is_user_logged_in())
|
1040 |
+
$search .= " AND ({$GLOBALS['wpdb']->posts}.post_password = '') ";
|
1041 |
}
|
1042 |
}
|
1043 |
tp_logger($search, 3);
|
1069 |
*/
|
1070 |
function add_comment_meta_settings($post_id) {
|
1071 |
if (transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url))
|
1072 |
+
add_comment_meta($post_id, 'tp_language', transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url), true);
|
1073 |
}
|
1074 |
|
1075 |
/**
|
1110 |
* @return string wrapped text
|
1111 |
*/
|
1112 |
function post_content_wrap($text) {
|
1113 |
+
if (!isset($GLOBALS['id']))
|
1114 |
+
return $text;
|
1115 |
$lang = get_post_meta($GLOBALS['id'], 'tp_language', true);
|
1116 |
if ($lang) {
|
1117 |
$text = "<span lang =\"$lang\">" . $text . "</span>";
|
1129 |
*/
|
1130 |
function post_wrap($text, $id = 0) {
|
1131 |
$id = (is_object($id)) ? $id->ID : $id;
|
1132 |
+
if (!$id)
|
1133 |
+
return $text;
|
1134 |
$lang = get_post_meta($id, 'tp_language', true);
|
1135 |
if ($lang) {
|
1136 |
if (strpos($_SERVER['REQUEST_URI'], 'wp-admin/edit') !== false) {
|
1183 |
tp_logger("($translation, $orig, $domain)", 5);
|
1184 |
// HACK - TODO - FIX
|
1185 |
if (in_array($domain, transposh_consts::$ignored_po_domains))
|
1186 |
+
return $translation;
|
1187 |
if ($translation != $orig) {
|
1188 |
$translation = TP_GTXT_BRK . $translation . TP_GTXT_BRK_CLOSER;
|
1189 |
}
|
1200 |
*/
|
1201 |
function transposh_ngettext_filter($translation, $single, $plural, $domain) {
|
1202 |
if ($this->is_special_page($_SERVER['REQUEST_URI']) || ($this->options->is_default_language($this->tgl) && !$this->options->enable_default_translate))
|
1203 |
+
return $translation;
|
1204 |
tp_logger("($translation, $single, $plural, $domain)", 4);
|
1205 |
if (in_array($domain, transposh_consts::$ignored_po_domains))
|
1206 |
+
return $translation;
|
1207 |
if ($translation != $single && $translation != $plural) {
|
1208 |
$translation = TP_GTXT_BRK . $translation . TP_GTXT_BRK_CLOSER;
|
1209 |
}
|
1288 |
function on_ajax_nopriv_tp_gsp() {
|
1289 |
$i = 0;
|
1290 |
// we need curl for this proxy
|
1291 |
+
if (!function_exists('curl_init'))
|
1292 |
+
return;
|
1293 |
transposh_utils::allow_cors();
|
1294 |
+
$tl = $_GET['tl']; // CHECK GET (ajax change to post case..)
|
1295 |
// we want to avoid unneeded work or dos attacks on languages we don't support
|
1296 |
if (!in_array($tl, transposh_consts::$google_languages) || !$this->options->is_active_language($tl))
|
1297 |
+
return;
|
1298 |
$sl = 'auto';
|
1299 |
+
if (isset($_GET['sl']))
|
1300 |
+
$sl = $_GET['sl'];
|
1301 |
$q = urlencode(stripslashes($_GET['q']));
|
1302 |
+
if (!$q)
|
1303 |
+
return; // avoid unneeded curling
|
1304 |
$url = 'http://translate.google.com/translate_a/t?client=a&q=' . $q . '&tl=' . $tl . '&sl=' . $sl;
|
1305 |
$ch = curl_init();
|
1306 |
curl_setopt($ch, CURLOPT_URL, $url);
|
1339 |
// Proxied translation for google translate
|
1340 |
function on_ajax_nopriv_tp_gp() {
|
1341 |
// we need curl for this proxy
|
1342 |
+
if (!function_exists('curl_init')) {
|
1343 |
+
return;
|
1344 |
+
}
|
1345 |
transposh_utils::allow_cors();
|
1346 |
// target language
|
1347 |
$tl = $_GET['tl'];
|
1348 |
// we want to avoid unneeded work or dos attacks on languages we don't support
|
1349 |
if (!in_array($tl, transposh_consts::$google_languages) || !$this->options->is_active_language($tl))
|
1350 |
+
return;
|
1351 |
// source language
|
1352 |
$sl = 'auto';
|
1353 |
+
if (isset($_GET['sl'])) {
|
1354 |
+
$sl = $_GET['sl'];
|
1355 |
+
}
|
1356 |
// item count
|
1357 |
$i = 0;
|
1358 |
$q = '';
|
1369 |
// we avoid curling we had all results prehand
|
1370 |
if ($q) {
|
1371 |
$url = 'http://translate.google.com/translate_a/t?client=a' . $q . '&tl=' . $tl . '&sl=' . $sl;
|
1372 |
+
tp_logger($url, 5);
|
1373 |
$ch = curl_init();
|
1374 |
curl_setopt($ch, CURLOPT_URL, $url);
|
1375 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
1381 |
die();
|
1382 |
}
|
1383 |
curl_close($ch);
|
1384 |
+
tp_logger($output, 5);
|
1385 |
$jsonarr = json_decode($output);
|
1386 |
if (!$jsonarr) {
|
1387 |
+
tp_logger("google didn't return JSON, lets try to recover", 4);
|
1388 |
+
$newout = str_replace(',,', ',"",', $output);
|
1389 |
+
$jsonarrt = json_decode($newout);
|
1390 |
+
@$jsonarr->results = array();
|
1391 |
+
foreach ($jsonarrt[0] as $result) {
|
1392 |
+
array_push($jsonarr->results, $result[0][0][0]);
|
1393 |
+
}
|
1394 |
+
// If there is still no JSON
|
1395 |
+
if (!$jsonarr) {
|
1396 |
+
echo 'Not JSON';
|
1397 |
+
die();
|
1398 |
+
}
|
1399 |
+
} else {
|
1400 |
+
if (!isset($jsonarr->results)) {
|
1401 |
+
$jsonarr2->results[] = $jsonarr;
|
1402 |
+
$jsonarr = $jsonarr2;
|
1403 |
+
}
|
1404 |
+
foreach ($jsonarr->results as $result) {
|
1405 |
+
unset($result->sentences[0]->orig);
|
1406 |
+
unset($result->sentences[0]->translit);
|
1407 |
+
unset($result->sentences[0]->src_translit);
|
1408 |
+
unset($result->src);
|
1409 |
+
unset($result->server_time);
|
1410 |
+
}
|
1411 |
}
|
|
|
1412 |
}
|
1413 |
header('Content-type: text/html; charset=utf-8');
|
1414 |
|
1420 |
} else {
|
1421 |
if (isset($jsonarr->results[$k]->sentences[0]->trans)) {
|
1422 |
$jsonout->results[] = $jsonarr->results[$k]->sentences[0]->trans;
|
1423 |
+
} elseif (isset($jsonarr->results[$k]) && $jsonarr->results[$k]) {
|
1424 |
+
$jsonout->results[] = $jsonarr->results[$k];
|
1425 |
} else {
|
1426 |
$jsonout->results[] = $_GET['q'][$j];
|
1427 |
}
|
1461 |
}
|
1462 |
$oht = get_option(TRANSPOSH_OPTIONS_OHT, array());
|
1463 |
if (!isset($_GET['orglang']))
|
1464 |
+
$_GET['orglang'] = $this->options->default_language;
|
1465 |
$key = $_GET['token'] . '@' . $_GET['lang'] . '@' . $_GET['orglang'];
|
1466 |
if (isset($oht[$key])) {
|
1467 |
unset($oht[$key]);
|
1581 |
die();
|
1582 |
}
|
1583 |
|
1584 |
+
// Catch the wordpress.org update post
|
1585 |
+
function filter_wordpress_org_update($arr, $url) {
|
1586 |
+
if (strpos($url, "api.wordpress.org/plugins/update-check/") !== false) {
|
1587 |
+
// now we should add our update data
|
1588 |
+
$this->do_update_check = true;
|
1589 |
+
}
|
1590 |
+
return $arr;
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
function check_for_plugin_update($checked_data) {
|
1594 |
+
global $wp_version;
|
1595 |
+
tp_logger('should we suggest an upgrade?', 4);
|
1596 |
+
if (!$this->do_update_check)
|
1597 |
+
return;
|
1598 |
+
$this->do_update_check = false; // for next time
|
1599 |
+
// Do response
|
1600 |
+
tp_logger($checked_data);
|
1601 |
+
$response = (object) array(
|
1602 |
+
'slug' => 'transposh-translation-filter-for-wordpress',
|
1603 |
+
'new_version' => 'full version to be downloaded and installed from http://transposh.org',
|
1604 |
+
'url' => 'http://transposh.org/',
|
1605 |
+
'package' => 'http://svc.transposh.org/transposh.latest.zip');
|
1606 |
+
|
1607 |
+
$checked_data->response[$this->transposh_plugin_basename] = $response;
|
1608 |
+
tp_logger($checked_data);
|
1609 |
+
|
1610 |
+
return $checked_data;
|
1611 |
+
}
|
1612 |
+
|
1613 |
}
|
1614 |
|
1615 |
$my_transposh_plugin = new transposh_plugin();
|
1620 |
* Function provided for old widget include code compatability
|
1621 |
* @param array $args Not needed
|
1622 |
*/
|
1623 |
+
function transposh_widget($args = array(), $instance = array('title' => 'Translation'), $extcall = false) {
|
1624 |
global $my_transposh_plugin;
|
1625 |
+
$my_transposh_plugin->widget->widget($args, $instance, $extcall); //TODO!!!
|
1626 |
}
|
1627 |
|
1628 |
/**
|
1655 |
function tp_logger($msg, $severity = 3, $do_backtrace = false) {
|
1656 |
global $my_transposh_plugin;
|
1657 |
if (isset($my_transposh_plugin) && is_object($my_transposh_plugin) && !$my_transposh_plugin->options->debug_enable)
|
1658 |
+
return;
|
1659 |
$GLOBALS['tp_logger']->do_log($msg, $severity, $do_backtrace);
|
1660 |
}
|
1661 |
|
widgets/default/tpw_default.php
CHANGED
@@ -11,14 +11,14 @@
|
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
-
* Transposh v0.9.
|
15 |
* http://transposh.org/
|
16 |
*
|
17 |
* Copyright 2013, Team Transposh
|
18 |
* Licensed under the GPL Version 2 or higher.
|
19 |
* http://transposh.org/license
|
20 |
*
|
21 |
-
* Date: Mon,
|
22 |
*/
|
23 |
|
24 |
/*
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
* Transposh v0.9.3
|
15 |
* http://transposh.org/
|
16 |
*
|
17 |
* Copyright 2013, Team Transposh
|
18 |
* Licensed under the GPL Version 2 or higher.
|
19 |
* http://transposh.org/license
|
20 |
*
|
21 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
22 |
*/
|
23 |
|
24 |
/*
|
widgets/dropdown/arrow.png
DELETED
Binary file
|
widgets/dropdown/tpw_image_dropdown.css
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Widget's css
|
3 |
-
*/
|
4 |
-
/* Code adapted from: http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx */
|
5 |
-
|
6 |
-
.dropdown, .dropdown dd, .dropdown dt, .dropdown ul, .dropdown li { margin:0px !important; padding:0px !important; }
|
7 |
-
.dropdown dd { position:relative; z-index:9999;}
|
8 |
-
.dropdown a, .dropdown a:visited { color:#816c5b; text-decoration:none; outline:none;}
|
9 |
-
.dropdown a:hover { color:#5d4617;}
|
10 |
-
.dropdown dt a:hover, .dropdown dt a:focus { color:#5d4617; border: 1px solid #5d4617;}
|
11 |
-
.dropdown dt a {background:#e4dfcb url(arrow.png) no-repeat scroll right center; display:block; padding-right:20px;
|
12 |
-
border:1px solid #d4ca9a; width:150px;}
|
13 |
-
.dropdown dt a span {cursor:pointer; display:block; padding:5px;}
|
14 |
-
.dropdown dd ul { background:#e4dfcb none repeat scroll 0 0; border:1px solid #d4ca9a; color:#C5C0B0; display:none;
|
15 |
-
padding:5px 0px; position:absolute; top:2px; width:auto; min-width:170px; list-style:none;}
|
16 |
-
.dropdown span.value { display:none;}
|
17 |
-
.dropdown dd ul li a { padding:5px; display:block;}
|
18 |
-
.dropdown dd ul li a:hover { background-color:#d0c9af;}
|
19 |
-
|
20 |
-
.dropdown img.flag { border:none; vertical-align:middle; margin:0 3px;box-shadow:0 0;border-radius:0 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/dropdown/tpw_image_dropdown.js
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
// Code adapted from: http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx
|
2 |
-
|
3 |
-
(function ($) { // closure
|
4 |
-
|
5 |
-
$(function() {
|
6 |
-
$(".dropdown dt a").click(function() {
|
7 |
-
$(this).parents(".dropdown").find("dd ul").toggle();
|
8 |
-
return false;
|
9 |
-
});
|
10 |
-
|
11 |
-
$(".dropdown dd ul li a").click(function() {
|
12 |
-
var text = $(this).html();
|
13 |
-
$(this).parents(".dropdown").find("dt a span").html(text);
|
14 |
-
$(this).parents(".dropdown").find("dd ul").hide();
|
15 |
-
|
16 |
-
document.location.href=$(this).parents(".dropdown").find("dt a span.value").html();
|
17 |
-
return false;
|
18 |
-
});
|
19 |
-
|
20 |
-
$(document).bind('click', function(e) {
|
21 |
-
var $clicked = $(e.target);
|
22 |
-
if (! $clicked.parents().hasClass("dropdown"))
|
23 |
-
$(".dropdown dd ul").hide();
|
24 |
-
});
|
25 |
-
});
|
26 |
-
}(jQuery)); // end of closure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/dropdown/tpw_image_dropdown.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Dropdown selection with image
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: A widget using javascript to present a dropdown selection box with images - adapted from: http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.asp
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
class tpw_image_dropdown extends transposh_base_widget {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* This function makes sure that the jquery dependency will be met
|
28 |
-
* @global transposh_plugin $my_transposh_plugin
|
29 |
-
*/
|
30 |
-
static function tp_widget_js($file, $dir, $url) {
|
31 |
-
wp_enqueue_script("transposh_widget", "$url/widgets/dropdown/tpw_image_dropdown.js", array('jquery'), TRANSPOSH_PLUGIN_VER);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* This function does the actual HTML for the widget
|
36 |
-
* @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
|
37 |
-
*/
|
38 |
-
static function tp_widget_do($args) {
|
39 |
-
global $my_transposh_plugin;
|
40 |
-
// we calculate the plugin path part, so we can link the images there
|
41 |
-
$plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
|
42 |
-
|
43 |
-
echo '<dl class="tp_dropdown dropdown">';
|
44 |
-
/* TRANSLATORS: this is what appears in the select box in dropdown subwidget */
|
45 |
-
echo '<dt><a href="#"><span>' . __('Select language', TRANSPOSH_TEXT_DOMAIN) . '</span></a></dt><dd><ul class="' . NO_TRANSLATE_CLASS . '">';
|
46 |
-
foreach ($args as $langrecord) {
|
47 |
-
// $is_selected = $langrecord['active'] ? " selected=\"selected\"" : "";
|
48 |
-
echo '<li><a href="#"><img class="flag" src="' . "$plugpath/img/flags/{$langrecord['flag']}" . '.png" alt="' . $langrecord['langorig'] . '"/> ' . $langrecord['langorig'] . '<span class="value">' . $langrecord['url'] . '</span></a></li>';
|
49 |
-
}
|
50 |
-
echo '</ul></dd></dl>';
|
51 |
-
}
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flags/flags66b.png
DELETED
Binary file
|
widgets/flags/tpw_flags.css
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Widget's css for flags
|
3 |
-
*/
|
4 |
-
.transposh_flags {
|
5 |
-
direction: ltr; /* we don't want the flags to change direction on rtl */
|
6 |
-
line-height: 0;
|
7 |
-
}
|
8 |
-
.transposh_flags a {
|
9 |
-
/* line-height:11px;*/
|
10 |
-
display: inline;
|
11 |
-
/*background: transparent;*/ /* ie8 quirk */
|
12 |
-
}
|
13 |
-
|
14 |
-
.transposh_flags a:hover {
|
15 |
-
/* ie8 quirk */
|
16 |
-
background:transparent
|
17 |
-
}
|
18 |
-
|
19 |
-
.transposh_flags a span, .transposh_flags a img {
|
20 |
-
border:transparent;
|
21 |
-
border-style:solid;
|
22 |
-
border-width:1px 3px;
|
23 |
-
box-shadow:0 0;
|
24 |
-
border-radius:0;
|
25 |
-
padding:0;
|
26 |
-
}
|
27 |
-
|
28 |
-
.transposh_flags a span:hover, .transposh_flags a img:hover {
|
29 |
-
border-color:blue
|
30 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flags/tpw_flags.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Flags
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: Widget with flags links
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
/**
|
25 |
-
* This function allows the widget to tell the invoker if it needs to calculate different urls per language, here it is needed
|
26 |
-
* @return boolean
|
27 |
-
*/
|
28 |
-
class tpw_flags extends transposh_base_widget {
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Creates the list of flags
|
32 |
-
* @global transposh_plugin $my_transposh_plugin
|
33 |
-
* @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
|
34 |
-
*/
|
35 |
-
static function tp_widget_do($args) {
|
36 |
-
global $my_transposh_plugin;
|
37 |
-
// we calculate the plugin path part, so we can link the images there
|
38 |
-
$plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
|
39 |
-
|
40 |
-
echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
|
41 |
-
foreach ($args as $langrecord) {
|
42 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
|
43 |
-
transposh_utils::display_flag("$plugpath/img/flags", $langrecord['flag'], $langrecord['langorig'], false) .
|
44 |
-
"</a>";
|
45 |
-
}
|
46 |
-
echo "</div>";
|
47 |
-
}
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flags/tpw_flags_css.css
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* Widget's css (always needed in flags widget use)
|
3 |
-
*/
|
4 |
-
.transposh_flags {
|
5 |
-
direction: ltr; /* we don't want the flags to change direction on rtl */
|
6 |
-
line-height: 0;
|
7 |
-
}
|
8 |
-
.transposh_flags a {
|
9 |
-
/* line-height:11px;*/
|
10 |
-
display: inline;
|
11 |
-
/*background: transparent;*/ /* ie8 quirk */
|
12 |
-
}
|
13 |
-
|
14 |
-
.transposh_flags a:hover {
|
15 |
-
/* ie8 quirk */
|
16 |
-
background:transparent
|
17 |
-
}
|
18 |
-
|
19 |
-
.transposh_flags a span, .transposh_flags a img {
|
20 |
-
border-color:transparent;
|
21 |
-
border-style:solid;
|
22 |
-
border-width:1px 3px;
|
23 |
-
box-shadow:0 0;
|
24 |
-
border-radius:0;
|
25 |
-
padding: 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
.transposh_flags a span:hover, .transposh_flags a img:hover {
|
29 |
-
border-color:blue
|
30 |
-
}
|
31 |
-
|
32 |
-
/* define the .css sprites here */
|
33 |
-
.trf {
|
34 |
-
background-image:url(flags66b.png);
|
35 |
-
height:11px;
|
36 |
-
width:16px;
|
37 |
-
background-repeat:no-repeat;
|
38 |
-
overflow:hidden;
|
39 |
-
display:inline-block;
|
40 |
-
}
|
41 |
-
|
42 |
-
.trf-za {background-position: -24px 0}
|
43 |
-
.trf-al {background-position: -48px 0}
|
44 |
-
.trf-sa {background-position: -72px 0}
|
45 |
-
.trf-am {background-position: -96px 0}
|
46 |
-
.trf-az {background-position: -120px 0}
|
47 |
-
.trf-basque {background-position: -144px 0}
|
48 |
-
.trf-by {background-position: -168px 0}
|
49 |
-
.trf-bd {background-position: -192px 0}
|
50 |
-
.trf-bg {background-position: -216px 0}
|
51 |
-
.trf-catalonia {background-position: -240px 0}
|
52 |
-
.trf-cn {background-position: -264px 0}
|
53 |
-
.trf-tw {background-position: -288px 0}
|
54 |
-
.trf-hr {background-position: -312px 0}
|
55 |
-
.trf-cz {background-position: -336px 0}
|
56 |
-
.trf-dk {background-position: -360px 0}
|
57 |
-
.trf-nl {background-position: -384px 0}
|
58 |
-
.trf-esperanto {background-position: -408px 0}
|
59 |
-
.trf-ee {background-position: -432px 0}
|
60 |
-
.trf-fi {background-position: -456px 0}
|
61 |
-
.trf-fr {background-position: -480px 0}
|
62 |
-
.trf-galicia {background-position: -504px 0}
|
63 |
-
.trf-ge {background-position: -528px 0}
|
64 |
-
.trf-de {background-position: -552px 0}
|
65 |
-
.trf-gr {background-position: -576px 0}
|
66 |
-
.trf-in {background-position: -600px 0}
|
67 |
-
.trf-ht {background-position: -624px 0}
|
68 |
-
.trf-la {background-position: -648px 0}
|
69 |
-
.trf-il {background-position: -672px 0}
|
70 |
-
.trf-hu {background-position: -696px 0}
|
71 |
-
.trf-is {background-position: -720px 0}
|
72 |
-
.trf-id {background-position: -744px 0}
|
73 |
-
.trf-ie {background-position: -768px 0}
|
74 |
-
.trf-it {background-position: -792px 0}
|
75 |
-
.trf-jp {background-position: -816px 0}
|
76 |
-
.trf-kr {background-position: -840px 0}
|
77 |
-
.trf-va {background-position: -864px 0}
|
78 |
-
.trf-lv {background-position: -888px 0}
|
79 |
-
.trf-lt {background-position: -912px 0}
|
80 |
-
.trf-mk {background-position: -936px 0}
|
81 |
-
.trf-my {background-position: -960px 0}
|
82 |
-
.trf-mt {background-position: -984px 0}
|
83 |
-
.trf-no {background-position: -1008px 0}
|
84 |
-
.trf-ir {background-position: -1032px 0}
|
85 |
-
.trf-pl {background-position: -1056px 0}
|
86 |
-
.trf-pt {background-position: -1080px 0}
|
87 |
-
.trf-ro {background-position: -1104px 0}
|
88 |
-
.trf-ru {background-position: -1128px 0}
|
89 |
-
.trf-rs {background-position: -1152px 0}
|
90 |
-
.trf-sk {background-position: -1176px 0}
|
91 |
-
.trf-si {background-position: -1200px 0}
|
92 |
-
.trf-es {background-position: -1224px 0}
|
93 |
-
.trf-tz {background-position: -1248px 0}
|
94 |
-
.trf-se {background-position: -1272px 0}
|
95 |
-
.trf-ph {background-position: -1296px 0}
|
96 |
-
.trf-lk {background-position: -1320px 0}
|
97 |
-
.trf-th {background-position: -1344px 0}
|
98 |
-
.trf-tr {background-position: -1368px 0}
|
99 |
-
.trf-ua {background-position: -1392px 0}
|
100 |
-
.trf-pk {background-position: -1416px 0}
|
101 |
-
.trf-vn {background-position: -1440px 0}
|
102 |
-
.trf-wales {background-position: -1464px 0}
|
103 |
-
.trf-europeanunion {background-position: -1488px 0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flags/tpw_flags_css.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Flags (With CSS)
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: Widget with flags links (Using css sprites)
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
class tpw_flags_css extends transposh_base_widget {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Creates the list of flags (with css)
|
28 |
-
* @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
|
29 |
-
*/
|
30 |
-
static function tp_widget_do($args) {
|
31 |
-
echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
|
32 |
-
foreach ($args as $langrecord) {
|
33 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
|
34 |
-
transposh_utils::display_flag("", $langrecord['flag'], $langrecord['langorig'], true) .
|
35 |
-
"</a>";
|
36 |
-
}
|
37 |
-
echo "</div>";
|
38 |
-
}
|
39 |
-
|
40 |
-
}
|
41 |
-
|
42 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flagslist/tpw_list_with_flags.php
DELETED
@@ -1,55 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: List with flags
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: Widget with flags links followed by language name
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
class tpw_list_with_flags extends transposh_base_widget {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Instructs usage of a different .css file
|
28 |
-
* @global transposh_plugin $my_transposh_plugin
|
29 |
-
*/
|
30 |
-
static function tp_widget_css($file, $dir, $url) {
|
31 |
-
wp_enqueue_style("flags_tpw_flags", "$url/widgets/flags/tpw_flags.css", array(), TRANSPOSH_PLUGIN_VER);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Creates the list of flags - followed by a language name link
|
36 |
-
* @global transposh_plugin $my_transposh_plugin
|
37 |
-
* @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
|
38 |
-
*/
|
39 |
-
static function tp_widget_do($args) {
|
40 |
-
global $my_transposh_plugin;
|
41 |
-
// we calculate the plugin path part, so we can link the images there
|
42 |
-
$plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
|
43 |
-
|
44 |
-
echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
|
45 |
-
foreach ($args as $langrecord) {
|
46 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
|
47 |
-
transposh_utils::display_flag("$plugpath/img/flags", $langrecord['flag'], $langrecord['langorig'], false) . "</a>";
|
48 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' . "{$langrecord['langorig']}</a><br/>";
|
49 |
-
}
|
50 |
-
echo "</div>";
|
51 |
-
}
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/flagslist/tpw_list_with_flags_css.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: List with flags (CSS)
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: Widget with flags links (using css sprites) followed by language name
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0.1
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
class tpw_list_with_flags_css extends transposh_base_widget {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Instructs usage of a different .css file
|
28 |
-
* @global transposh_plugin $my_transposh_plugin
|
29 |
-
*/
|
30 |
-
static function tp_widget_css($file, $dir, $url) {
|
31 |
-
wp_enqueue_style("flags_tpw_flags_css", "$url/widgets/flags/tpw_flags_css.css", array(), TRANSPOSH_PLUGIN_VER);
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Creates the list of flags (using css sprites) - followed by a language name link
|
36 |
-
* @global transposh_plugin $my_transposh_plugin
|
37 |
-
* @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
|
38 |
-
*/
|
39 |
-
static function tp_widget_do($args) {
|
40 |
-
echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
|
41 |
-
foreach ($args as $langrecord) {
|
42 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
|
43 |
-
transposh_utils::display_flag('', $langrecord['flag'], $langrecord['langorig'], true) . '</a>';
|
44 |
-
echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' . "{$langrecord['langorig']}</a><br/>";
|
45 |
-
}
|
46 |
-
echo "</div>";
|
47 |
-
}
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/select2/select2.css
DELETED
@@ -1,524 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012
|
3 |
-
*/
|
4 |
-
.select2-container {
|
5 |
-
position: relative;
|
6 |
-
display: inline-block;
|
7 |
-
/* inline-block for ie7 */
|
8 |
-
zoom: 1;
|
9 |
-
*display: inline;
|
10 |
-
vertical-align: top;
|
11 |
-
}
|
12 |
-
|
13 |
-
.select2-container,
|
14 |
-
.select2-drop,
|
15 |
-
.select2-search,
|
16 |
-
.select2-search input{
|
17 |
-
/*
|
18 |
-
Force border-box so that % widths fit the parent
|
19 |
-
container without overlap because of margin/padding.
|
20 |
-
|
21 |
-
More Info : http://www.quirksmode.org/css/box.html
|
22 |
-
*/
|
23 |
-
-moz-box-sizing: border-box; /* firefox */
|
24 |
-
-ms-box-sizing: border-box; /* ie */
|
25 |
-
-webkit-box-sizing: border-box; /* webkit */
|
26 |
-
-khtml-box-sizing: border-box; /* konqueror */
|
27 |
-
box-sizing: border-box; /* css3 */
|
28 |
-
}
|
29 |
-
|
30 |
-
.select2-container .select2-choice {
|
31 |
-
background-color: #fff;
|
32 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
|
33 |
-
background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
|
34 |
-
background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
|
35 |
-
background-image: -o-linear-gradient(bottom, #eeeeee 0%, #ffffff 50%);
|
36 |
-
background-image: -ms-linear-gradient(top, #eeeeee 0%, #ffffff 50%);
|
37 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#ffffff', GradientType = 0);
|
38 |
-
background-image: linear-gradient(top, #eeeeee 0%, #ffffff 50%);
|
39 |
-
-webkit-border-radius: 4px;
|
40 |
-
-moz-border-radius: 4px;
|
41 |
-
border-radius: 4px;
|
42 |
-
-moz-background-clip: padding;
|
43 |
-
-webkit-background-clip: padding-box;
|
44 |
-
background-clip: padding-box;
|
45 |
-
border: 1px solid #aaa;
|
46 |
-
display: block;
|
47 |
-
overflow: hidden;
|
48 |
-
white-space: nowrap;
|
49 |
-
position: relative;
|
50 |
-
height: 26px;
|
51 |
-
line-height: 26px;
|
52 |
-
padding: 0 0 0 8px;
|
53 |
-
color: #444;
|
54 |
-
text-decoration: none;
|
55 |
-
}
|
56 |
-
|
57 |
-
.select2-container.select2-drop-above .select2-choice
|
58 |
-
{
|
59 |
-
border-bottom-color: #aaa;
|
60 |
-
-webkit-border-radius:0px 0px 4px 4px;
|
61 |
-
-moz-border-radius:0px 0px 4px 4px;
|
62 |
-
border-radius:0px 0px 4px 4px;
|
63 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.9, white));
|
64 |
-
background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 90%);
|
65 |
-
background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 90%);
|
66 |
-
background-image: -o-linear-gradient(bottom, #eeeeee 0%, white 90%);
|
67 |
-
background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 90%);
|
68 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
|
69 |
-
background-image: linear-gradient(top, #eeeeee 0%,#ffffff 90%);
|
70 |
-
}
|
71 |
-
|
72 |
-
.select2-container .select2-choice span {
|
73 |
-
margin-right: 26px;
|
74 |
-
display: block;
|
75 |
-
overflow: hidden;
|
76 |
-
white-space: nowrap;
|
77 |
-
-o-text-overflow: ellipsis;
|
78 |
-
-ms-text-overflow: ellipsis;
|
79 |
-
text-overflow: ellipsis;
|
80 |
-
}
|
81 |
-
|
82 |
-
.select2-container .select2-choice abbr {
|
83 |
-
display: block;
|
84 |
-
position: absolute;
|
85 |
-
right: 26px;
|
86 |
-
top: 8px;
|
87 |
-
width: 12px;
|
88 |
-
height: 12px;
|
89 |
-
font-size: 1px;
|
90 |
-
background: url('select2.png') right top no-repeat;
|
91 |
-
cursor: pointer;
|
92 |
-
text-decoration: none;
|
93 |
-
border:0;
|
94 |
-
outline: 0;
|
95 |
-
}
|
96 |
-
.select2-container .select2-choice abbr:hover {
|
97 |
-
background-position: right -11px;
|
98 |
-
cursor: pointer;
|
99 |
-
}
|
100 |
-
|
101 |
-
.select2-drop {
|
102 |
-
background: #fff;
|
103 |
-
color: #000;
|
104 |
-
border: 1px solid #aaa;
|
105 |
-
border-top: 0;
|
106 |
-
position: absolute;
|
107 |
-
top: 100%;
|
108 |
-
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
109 |
-
-moz-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
110 |
-
-o-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
111 |
-
box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
|
112 |
-
z-index: 9999;
|
113 |
-
width:100%;
|
114 |
-
margin-top:-1px;
|
115 |
-
|
116 |
-
-webkit-border-radius: 0 0 4px 4px;
|
117 |
-
-moz-border-radius: 0 0 4px 4px;
|
118 |
-
border-radius: 0 0 4px 4px;
|
119 |
-
}
|
120 |
-
|
121 |
-
.select2-drop.select2-drop-above {
|
122 |
-
-webkit-border-radius: 4px 4px 0px 0px;
|
123 |
-
-moz-border-radius: 4px 4px 0px 0px;
|
124 |
-
border-radius: 4px 4px 0px 0px;
|
125 |
-
margin-top:1px;
|
126 |
-
border-top: 1px solid #aaa;
|
127 |
-
border-bottom: 0;
|
128 |
-
|
129 |
-
-webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
130 |
-
-moz-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
131 |
-
-o-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
132 |
-
box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
|
133 |
-
}
|
134 |
-
|
135 |
-
.select2-container .select2-choice div {
|
136 |
-
-webkit-border-radius: 0 4px 4px 0;
|
137 |
-
-moz-border-radius: 0 4px 4px 0;
|
138 |
-
border-radius: 0 4px 4px 0;
|
139 |
-
-moz-background-clip: padding;
|
140 |
-
-webkit-background-clip: padding-box;
|
141 |
-
background-clip: padding-box;
|
142 |
-
background: #ccc;
|
143 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
|
144 |
-
background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
145 |
-
background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
|
146 |
-
background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
|
147 |
-
background-image: -ms-linear-gradient(top, #cccccc 0%, #eeeeee 60%);
|
148 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#cccccc', endColorstr = '#eeeeee', GradientType = 0);
|
149 |
-
background-image: linear-gradient(top, #cccccc 0%, #eeeeee 60%);
|
150 |
-
border-left: 1px solid #aaa;
|
151 |
-
position: absolute;
|
152 |
-
right: 0;
|
153 |
-
top: 0;
|
154 |
-
display: block;
|
155 |
-
height: 100%;
|
156 |
-
width: 18px;
|
157 |
-
}
|
158 |
-
|
159 |
-
.select2-container .select2-choice div b {
|
160 |
-
background: url('select2.png') no-repeat 0 1px;
|
161 |
-
display: block;
|
162 |
-
width: 100%;
|
163 |
-
height: 100%;
|
164 |
-
}
|
165 |
-
|
166 |
-
.select2-search {
|
167 |
-
display: inline-block;
|
168 |
-
white-space: nowrap;
|
169 |
-
z-index: 10000;
|
170 |
-
min-height: 26px;
|
171 |
-
width: 100%;
|
172 |
-
margin: 0;
|
173 |
-
padding-left: 4px;
|
174 |
-
padding-right: 4px;
|
175 |
-
}
|
176 |
-
|
177 |
-
.select2-search-hidden {
|
178 |
-
display: block;
|
179 |
-
position: absolute;
|
180 |
-
left: -10000px;
|
181 |
-
}
|
182 |
-
|
183 |
-
.select2-search input {
|
184 |
-
background: #fff url('select2.png') no-repeat 100% -22px;
|
185 |
-
background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
|
186 |
-
background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
|
187 |
-
background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
|
188 |
-
background: url('select2.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
|
189 |
-
background: url('select2.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%);
|
190 |
-
background: url('select2.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%, #eeeeee 99%);
|
191 |
-
padding: 4px 20px 4px 5px;
|
192 |
-
outline: 0;
|
193 |
-
border: 1px solid #aaa;
|
194 |
-
font-family: sans-serif;
|
195 |
-
font-size: 1em;
|
196 |
-
width:100%;
|
197 |
-
margin:0;
|
198 |
-
height:auto !important;
|
199 |
-
min-height: 26px;
|
200 |
-
-webkit-box-shadow: none;
|
201 |
-
-moz-box-shadow: none;
|
202 |
-
box-shadow: none;
|
203 |
-
border-radius: 0;
|
204 |
-
-moz-border-radius: 0;
|
205 |
-
-webkit-border-radius: 0;
|
206 |
-
}
|
207 |
-
|
208 |
-
.select2-drop.select2-drop-above .select2-search input
|
209 |
-
{
|
210 |
-
margin-top:4px;
|
211 |
-
}
|
212 |
-
|
213 |
-
.select2-search input.select2-active {
|
214 |
-
background: #fff url('spinner.gif') no-repeat 100%;
|
215 |
-
background: url('spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
|
216 |
-
background: url('spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
|
217 |
-
background: url('spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
|
218 |
-
background: url('spinner.gif') no-repeat 100%, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
|
219 |
-
background: url('spinner.gif') no-repeat 100%, -ms-linear-gradient(top, #ffffff 85%, #eeeeee 99%);
|
220 |
-
background: url('spinner.gif') no-repeat 100%, linear-gradient(top, #ffffff 85%, #eeeeee 99%);
|
221 |
-
}
|
222 |
-
|
223 |
-
|
224 |
-
.select2-container-active .select2-choice,
|
225 |
-
.select2-container-active .select2-choices {
|
226 |
-
-webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
|
227 |
-
-moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
|
228 |
-
-o-box-shadow : 0 0 5px rgba(0,0,0,.3);
|
229 |
-
box-shadow : 0 0 5px rgba(0,0,0,.3);
|
230 |
-
border: 1px solid #5897fb;
|
231 |
-
outline: none;
|
232 |
-
}
|
233 |
-
|
234 |
-
.select2-dropdown-open .select2-choice {
|
235 |
-
border: 1px solid #aaa;
|
236 |
-
border-bottom-color: transparent;
|
237 |
-
-webkit-box-shadow: 0 1px 0 #fff inset;
|
238 |
-
-moz-box-shadow : 0 1px 0 #fff inset;
|
239 |
-
-o-box-shadow : 0 1px 0 #fff inset;
|
240 |
-
box-shadow : 0 1px 0 #fff inset;
|
241 |
-
background-color: #eee;
|
242 |
-
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
|
243 |
-
background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%);
|
244 |
-
background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
|
245 |
-
background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
|
246 |
-
background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%);
|
247 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
|
248 |
-
background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
|
249 |
-
-webkit-border-bottom-left-radius : 0;
|
250 |
-
-webkit-border-bottom-right-radius: 0;
|
251 |
-
-moz-border-radius-bottomleft : 0;
|
252 |
-
-moz-border-radius-bottomright: 0;
|
253 |
-
border-bottom-left-radius : 0;
|
254 |
-
border-bottom-right-radius: 0;
|
255 |
-
}
|
256 |
-
|
257 |
-
.select2-dropdown-open .select2-choice div {
|
258 |
-
background: transparent;
|
259 |
-
border-left: none;
|
260 |
-
}
|
261 |
-
.select2-dropdown-open .select2-choice div b {
|
262 |
-
background-position: -18px 1px;
|
263 |
-
}
|
264 |
-
|
265 |
-
/* results */
|
266 |
-
.select2-results {
|
267 |
-
margin: 4px 4px 4px 0;
|
268 |
-
padding: 0 0 0 4px;
|
269 |
-
position: relative;
|
270 |
-
overflow-x: hidden;
|
271 |
-
overflow-y: auto;
|
272 |
-
max-height: 200px;
|
273 |
-
}
|
274 |
-
|
275 |
-
.select2-results ul.select2-result-sub {
|
276 |
-
margin: 0 0 0 0;
|
277 |
-
}
|
278 |
-
|
279 |
-
.select2-results ul.select2-result-sub > li .select2-result-label { padding-left: 20px }
|
280 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 40px }
|
281 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 60px }
|
282 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 80px }
|
283 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 100px }
|
284 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 110px }
|
285 |
-
.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label { padding-left: 120px }
|
286 |
-
|
287 |
-
.select2-results li {
|
288 |
-
list-style: none;
|
289 |
-
display: list-item;
|
290 |
-
}
|
291 |
-
|
292 |
-
.select2-results li.select2-result-with-children > .select2-result-label {
|
293 |
-
font-weight: bold;
|
294 |
-
}
|
295 |
-
|
296 |
-
.select2-results .select2-result-label {
|
297 |
-
padding: 3px 7px 4px;
|
298 |
-
margin: 0;
|
299 |
-
cursor: pointer;
|
300 |
-
}
|
301 |
-
|
302 |
-
.select2-results .select2-highlighted {
|
303 |
-
background: #3875d7;
|
304 |
-
color: #fff;
|
305 |
-
}
|
306 |
-
.select2-results li em {
|
307 |
-
background: #feffde;
|
308 |
-
font-style: normal;
|
309 |
-
}
|
310 |
-
.select2-results .select2-highlighted em {
|
311 |
-
background: transparent;
|
312 |
-
}
|
313 |
-
.select2-results .select2-no-results,
|
314 |
-
.select2-results .select2-searching,
|
315 |
-
.select2-results .select2-selection-limit {
|
316 |
-
background: #f4f4f4;
|
317 |
-
display: list-item;
|
318 |
-
}
|
319 |
-
|
320 |
-
/*
|
321 |
-
disabled look for already selected choices in the results dropdown
|
322 |
-
.select2-results .select2-disabled.select2-highlighted {
|
323 |
-
color: #666;
|
324 |
-
background: #f4f4f4;
|
325 |
-
display: list-item;
|
326 |
-
cursor: default;
|
327 |
-
}
|
328 |
-
.select2-results .select2-disabled {
|
329 |
-
background: #f4f4f4;
|
330 |
-
display: list-item;
|
331 |
-
cursor: default;
|
332 |
-
}
|
333 |
-
*/
|
334 |
-
.select2-results .select2-disabled {
|
335 |
-
display: none;
|
336 |
-
}
|
337 |
-
|
338 |
-
.select2-more-results.select2-active {
|
339 |
-
background: #f4f4f4 url('spinner.gif') no-repeat 100%;
|
340 |
-
}
|
341 |
-
|
342 |
-
.select2-more-results {
|
343 |
-
background: #f4f4f4;
|
344 |
-
display: list-item;
|
345 |
-
}
|
346 |
-
|
347 |
-
/* disabled styles */
|
348 |
-
|
349 |
-
.select2-container.select2-container-disabled .select2-choice {
|
350 |
-
background-color: #f4f4f4;
|
351 |
-
background-image: none;
|
352 |
-
border: 1px solid #ddd;
|
353 |
-
cursor: default;
|
354 |
-
}
|
355 |
-
|
356 |
-
.select2-container.select2-container-disabled .select2-choice div {
|
357 |
-
background-color: #f4f4f4;
|
358 |
-
background-image: none;
|
359 |
-
border-left: 0;
|
360 |
-
}
|
361 |
-
|
362 |
-
|
363 |
-
/* multiselect */
|
364 |
-
|
365 |
-
.select2-container-multi .select2-choices {
|
366 |
-
background-color: #fff;
|
367 |
-
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
368 |
-
background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
|
369 |
-
background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
|
370 |
-
background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
|
371 |
-
background-image: -ms-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
|
372 |
-
background-image: linear-gradient(top, #eeeeee 1%, #ffffff 15%);
|
373 |
-
border: 1px solid #aaa;
|
374 |
-
margin: 0;
|
375 |
-
padding: 0;
|
376 |
-
cursor: text;
|
377 |
-
overflow: hidden;
|
378 |
-
height: auto !important;
|
379 |
-
height: 1%;
|
380 |
-
position: relative;
|
381 |
-
}
|
382 |
-
|
383 |
-
.select2-container-multi .select2-choices {
|
384 |
-
min-height: 26px;
|
385 |
-
}
|
386 |
-
|
387 |
-
.select2-container-multi.select2-container-active .select2-choices {
|
388 |
-
-webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
|
389 |
-
-moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
|
390 |
-
-o-box-shadow : 0 0 5px rgba(0,0,0,.3);
|
391 |
-
box-shadow : 0 0 5px rgba(0,0,0,.3);
|
392 |
-
border: 1px solid #5897fb;
|
393 |
-
outline: none;
|
394 |
-
}
|
395 |
-
.select2-container-multi .select2-choices li {
|
396 |
-
float: left;
|
397 |
-
list-style: none;
|
398 |
-
}
|
399 |
-
.select2-container-multi .select2-choices .select2-search-field {
|
400 |
-
white-space: nowrap;
|
401 |
-
margin: 0;
|
402 |
-
padding: 0;
|
403 |
-
}
|
404 |
-
|
405 |
-
.select2-container-multi .select2-choices .select2-search-field input {
|
406 |
-
color: #666;
|
407 |
-
background: transparent !important;
|
408 |
-
font-family: sans-serif;
|
409 |
-
font-size: 100%;
|
410 |
-
height: 15px;
|
411 |
-
padding: 5px;
|
412 |
-
margin: 1px 0;
|
413 |
-
outline: 0;
|
414 |
-
border: 0;
|
415 |
-
-webkit-box-shadow: none;
|
416 |
-
-moz-box-shadow : none;
|
417 |
-
-o-box-shadow : none;
|
418 |
-
box-shadow : none;
|
419 |
-
}
|
420 |
-
|
421 |
-
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
422 |
-
background: #fff url('spinner.gif') no-repeat 100% !important;
|
423 |
-
}
|
424 |
-
|
425 |
-
.select2-default {
|
426 |
-
color: #999 !important;
|
427 |
-
}
|
428 |
-
|
429 |
-
.select2-container-multi .select2-choices .select2-search-choice {
|
430 |
-
-webkit-border-radius: 3px;
|
431 |
-
-moz-border-radius : 3px;
|
432 |
-
border-radius : 3px;
|
433 |
-
-moz-background-clip : padding;
|
434 |
-
-webkit-background-clip: padding-box;
|
435 |
-
background-clip : padding-box;
|
436 |
-
background-color: #e4e4e4;
|
437 |
-
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
|
438 |
-
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
439 |
-
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
440 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
441 |
-
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
442 |
-
background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
443 |
-
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
444 |
-
-webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
|
445 |
-
-moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
|
446 |
-
box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
|
447 |
-
color: #333;
|
448 |
-
border: 1px solid #aaaaaa;
|
449 |
-
line-height: 13px;
|
450 |
-
padding: 3px 5px 3px 18px;
|
451 |
-
margin: 3px 0 3px 5px;
|
452 |
-
position: relative;
|
453 |
-
cursor: default;
|
454 |
-
}
|
455 |
-
.select2-container-multi .select2-choices .select2-search-choice span {
|
456 |
-
cursor: default;
|
457 |
-
}
|
458 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus {
|
459 |
-
background: #d4d4d4;
|
460 |
-
}
|
461 |
-
|
462 |
-
.select2-search-choice-close {
|
463 |
-
display: block;
|
464 |
-
position: absolute;
|
465 |
-
right: 3px;
|
466 |
-
top: 4px;
|
467 |
-
width: 12px;
|
468 |
-
height: 13px;
|
469 |
-
font-size: 1px;
|
470 |
-
background: url('select2.png') right top no-repeat;
|
471 |
-
outline: none;
|
472 |
-
}
|
473 |
-
|
474 |
-
.select2-container-multi .select2-search-choice-close {
|
475 |
-
left: 3px;
|
476 |
-
}
|
477 |
-
|
478 |
-
|
479 |
-
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
|
480 |
-
background-position: right -11px;
|
481 |
-
}
|
482 |
-
.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
|
483 |
-
background-position: right -11px;
|
484 |
-
}
|
485 |
-
|
486 |
-
/* disabled styles */
|
487 |
-
|
488 |
-
.select2-container-multi.select2-container-disabled .select2-choices{
|
489 |
-
background-color: #f4f4f4;
|
490 |
-
background-image: none;
|
491 |
-
border: 1px solid #ddd;
|
492 |
-
cursor: default;
|
493 |
-
}
|
494 |
-
|
495 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
|
496 |
-
background-image: none;
|
497 |
-
background-color: #f4f4f4;
|
498 |
-
border: 1px solid #ddd;
|
499 |
-
padding: 3px 5px 3px 5px;
|
500 |
-
}
|
501 |
-
|
502 |
-
.select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close {
|
503 |
-
display: none;
|
504 |
-
}
|
505 |
-
/* end multiselect */
|
506 |
-
|
507 |
-
.select2-result-selectable .select2-match,
|
508 |
-
.select2-result-unselectable .select2-result-selectable .select2-match { text-decoration: underline; }
|
509 |
-
.select2-result-unselectable .select2-match { text-decoration: none; }
|
510 |
-
|
511 |
-
.select2-offscreen { position: absolute; left: -10000px; }
|
512 |
-
|
513 |
-
/* Retina-ize icons */
|
514 |
-
|
515 |
-
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
|
516 |
-
.select2-search input, .select2-search-choice-close, .select2-container .select2-choice abbr, .select2-container .select2-choice div b {
|
517 |
-
background-image: url(select2x2.png) !important;
|
518 |
-
background-repeat: no-repeat !important;
|
519 |
-
background-size: 60px 40px !important;
|
520 |
-
}
|
521 |
-
.select2-search input {
|
522 |
-
background-position: 100% -21px !important;
|
523 |
-
}
|
524 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/select2/select2.js
DELETED
@@ -1,2407 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
Copyright 2012 Igor Vaynberg
|
3 |
-
|
4 |
-
Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012
|
5 |
-
|
6 |
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in
|
7 |
-
compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
|
8 |
-
|
9 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
|
11 |
-
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
12 |
-
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
See the License for the specific language governing permissions and limitations under the License.
|
14 |
-
*/
|
15 |
-
(function ($) {
|
16 |
-
if(typeof $.fn.each2 == "undefined"){
|
17 |
-
$.fn.extend({
|
18 |
-
/*
|
19 |
-
* 4-10 times faster .each replacement
|
20 |
-
* use it carefully, as it overrides jQuery context of element on each iteration
|
21 |
-
*/
|
22 |
-
each2 : function (c) {
|
23 |
-
var j = $([0]), i = -1, l = this.length;
|
24 |
-
while (
|
25 |
-
++i < l
|
26 |
-
&& (j.context = j[0] = this[i])
|
27 |
-
&& c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
|
28 |
-
);
|
29 |
-
return this;
|
30 |
-
}
|
31 |
-
});
|
32 |
-
}
|
33 |
-
})(jQuery);
|
34 |
-
|
35 |
-
(function ($, undefined) {
|
36 |
-
"use strict";
|
37 |
-
/*global document, window, jQuery, console */
|
38 |
-
|
39 |
-
if (window.Select2 !== undefined) {
|
40 |
-
return;
|
41 |
-
}
|
42 |
-
|
43 |
-
var KEY, AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer;
|
44 |
-
|
45 |
-
KEY = {
|
46 |
-
TAB: 9,
|
47 |
-
ENTER: 13,
|
48 |
-
ESC: 27,
|
49 |
-
SPACE: 32,
|
50 |
-
LEFT: 37,
|
51 |
-
UP: 38,
|
52 |
-
RIGHT: 39,
|
53 |
-
DOWN: 40,
|
54 |
-
SHIFT: 16,
|
55 |
-
CTRL: 17,
|
56 |
-
ALT: 18,
|
57 |
-
PAGE_UP: 33,
|
58 |
-
PAGE_DOWN: 34,
|
59 |
-
HOME: 36,
|
60 |
-
END: 35,
|
61 |
-
BACKSPACE: 8,
|
62 |
-
DELETE: 46,
|
63 |
-
isArrow: function (k) {
|
64 |
-
k = k.which ? k.which : k;
|
65 |
-
switch (k) {
|
66 |
-
case KEY.LEFT:
|
67 |
-
case KEY.RIGHT:
|
68 |
-
case KEY.UP:
|
69 |
-
case KEY.DOWN:
|
70 |
-
return true;
|
71 |
-
}
|
72 |
-
return false;
|
73 |
-
},
|
74 |
-
isControl: function (e) {
|
75 |
-
var k = e.which;
|
76 |
-
switch (k) {
|
77 |
-
case KEY.SHIFT:
|
78 |
-
case KEY.CTRL:
|
79 |
-
case KEY.ALT:
|
80 |
-
return true;
|
81 |
-
}
|
82 |
-
|
83 |
-
if (e.metaKey) return true;
|
84 |
-
|
85 |
-
return false;
|
86 |
-
},
|
87 |
-
isFunctionKey: function (k) {
|
88 |
-
k = k.which ? k.which : k;
|
89 |
-
return k >= 112 && k <= 123;
|
90 |
-
}
|
91 |
-
};
|
92 |
-
|
93 |
-
nextUid=(function() { var counter=1; return function() { return counter++; }; }());
|
94 |
-
|
95 |
-
function indexOf(value, array) {
|
96 |
-
var i = 0, l = array.length, v;
|
97 |
-
|
98 |
-
if (typeof value === "undefined") {
|
99 |
-
return -1;
|
100 |
-
}
|
101 |
-
|
102 |
-
if (value.constructor === String) {
|
103 |
-
for (; i < l; i = i + 1) if (value.localeCompare(array[i]) === 0) return i;
|
104 |
-
} else {
|
105 |
-
for (; i < l; i = i + 1) {
|
106 |
-
v = array[i];
|
107 |
-
if (v.constructor === String) {
|
108 |
-
if (v.localeCompare(value) === 0) return i;
|
109 |
-
} else {
|
110 |
-
if (v === value) return i;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
return -1;
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Compares equality of a and b taking into account that a and b may be strings, in which case localeCompare is used
|
119 |
-
* @param a
|
120 |
-
* @param b
|
121 |
-
*/
|
122 |
-
function equal(a, b) {
|
123 |
-
if (a === b) return true;
|
124 |
-
if (a === undefined || b === undefined) return false;
|
125 |
-
if (a === null || b === null) return false;
|
126 |
-
if (a.constructor === String) return a.localeCompare(b) === 0;
|
127 |
-
if (b.constructor === String) return b.localeCompare(a) === 0;
|
128 |
-
return false;
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Splits the string into an array of values, trimming each value. An empty array is returned for nulls or empty
|
133 |
-
* strings
|
134 |
-
* @param string
|
135 |
-
* @param separator
|
136 |
-
*/
|
137 |
-
function splitVal(string, separator) {
|
138 |
-
var val, i, l;
|
139 |
-
if (string === null || string.length < 1) return [];
|
140 |
-
val = string.split(separator);
|
141 |
-
for (i = 0, l = val.length; i < l; i = i + 1) val[i] = $.trim(val[i]);
|
142 |
-
return val;
|
143 |
-
}
|
144 |
-
|
145 |
-
function getSideBorderPadding(element) {
|
146 |
-
return element.outerWidth() - element.width();
|
147 |
-
}
|
148 |
-
|
149 |
-
function installKeyUpChangeEvent(element) {
|
150 |
-
var key="keyup-change-value";
|
151 |
-
element.bind("keydown", function () {
|
152 |
-
if ($.data(element, key) === undefined) {
|
153 |
-
$.data(element, key, element.val());
|
154 |
-
}
|
155 |
-
});
|
156 |
-
element.bind("keyup", function () {
|
157 |
-
var val= $.data(element, key);
|
158 |
-
if (val !== undefined && element.val() !== val) {
|
159 |
-
$.removeData(element, key);
|
160 |
-
element.trigger("keyup-change");
|
161 |
-
}
|
162 |
-
});
|
163 |
-
}
|
164 |
-
|
165 |
-
$(document).delegate("body", "mousemove", function (e) {
|
166 |
-
$.data(document, "select2-lastpos", {x: e.pageX, y: e.pageY});
|
167 |
-
});
|
168 |
-
|
169 |
-
/**
|
170 |
-
* filters mouse events so an event is fired only if the mouse moved.
|
171 |
-
*
|
172 |
-
* filters out mouse events that occur when mouse is stationary but
|
173 |
-
* the elements under the pointer are scrolled.
|
174 |
-
*/
|
175 |
-
function installFilteredMouseMove(element) {
|
176 |
-
element.bind("mousemove", function (e) {
|
177 |
-
var lastpos = $.data(document, "select2-lastpos");
|
178 |
-
if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
|
179 |
-
$(e.target).trigger("mousemove-filtered", e);
|
180 |
-
}
|
181 |
-
});
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
|
186 |
-
* within the last quietMillis milliseconds.
|
187 |
-
*
|
188 |
-
* @param quietMillis number of milliseconds to wait before invoking fn
|
189 |
-
* @param fn function to be debounced
|
190 |
-
* @param ctx object to be used as this reference within fn
|
191 |
-
* @return debounced version of fn
|
192 |
-
*/
|
193 |
-
function debounce(quietMillis, fn, ctx) {
|
194 |
-
ctx = ctx || undefined;
|
195 |
-
var timeout;
|
196 |
-
return function () {
|
197 |
-
var args = arguments;
|
198 |
-
window.clearTimeout(timeout);
|
199 |
-
timeout = window.setTimeout(function() {
|
200 |
-
fn.apply(ctx, args);
|
201 |
-
}, quietMillis);
|
202 |
-
};
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* A simple implementation of a thunk
|
207 |
-
* @param formula function used to lazily initialize the thunk
|
208 |
-
* @return {Function}
|
209 |
-
*/
|
210 |
-
function thunk(formula) {
|
211 |
-
var evaluated = false,
|
212 |
-
value;
|
213 |
-
return function() {
|
214 |
-
if (evaluated === false) { value = formula(); evaluated = true; }
|
215 |
-
return value;
|
216 |
-
};
|
217 |
-
};
|
218 |
-
|
219 |
-
function installDebouncedScroll(threshold, element) {
|
220 |
-
var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
|
221 |
-
element.bind("scroll", function (e) {
|
222 |
-
if (indexOf(e.target, element.get()) >= 0) notify(e);
|
223 |
-
});
|
224 |
-
}
|
225 |
-
|
226 |
-
function killEvent(event) {
|
227 |
-
event.preventDefault();
|
228 |
-
event.stopPropagation();
|
229 |
-
}
|
230 |
-
|
231 |
-
function measureTextWidth(e) {
|
232 |
-
if (!sizer){
|
233 |
-
var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
|
234 |
-
sizer = $("<div></div>").css({
|
235 |
-
position: "absolute",
|
236 |
-
left: "-10000px",
|
237 |
-
top: "-10000px",
|
238 |
-
display: "none",
|
239 |
-
fontSize: style.fontSize,
|
240 |
-
fontFamily: style.fontFamily,
|
241 |
-
fontStyle: style.fontStyle,
|
242 |
-
fontWeight: style.fontWeight,
|
243 |
-
letterSpacing: style.letterSpacing,
|
244 |
-
textTransform: style.textTransform,
|
245 |
-
whiteSpace: "nowrap"
|
246 |
-
});
|
247 |
-
$("body").append(sizer);
|
248 |
-
}
|
249 |
-
sizer.text(e.val());
|
250 |
-
return sizer.width();
|
251 |
-
}
|
252 |
-
|
253 |
-
function markMatch(text, term, markup) {
|
254 |
-
var match=text.toUpperCase().indexOf(term.toUpperCase()),
|
255 |
-
tl=term.length;
|
256 |
-
|
257 |
-
if (match<0) {
|
258 |
-
markup.push(text);
|
259 |
-
return;
|
260 |
-
}
|
261 |
-
|
262 |
-
markup.push(text.substring(0, match));
|
263 |
-
markup.push("<span class='select2-match'>");
|
264 |
-
markup.push(text.substring(match, match + tl));
|
265 |
-
markup.push("</span>");
|
266 |
-
markup.push(text.substring(match + tl, text.length));
|
267 |
-
}
|
268 |
-
|
269 |
-
/**
|
270 |
-
* Produces an ajax-based query function
|
271 |
-
*
|
272 |
-
* @param options object containing configuration paramters
|
273 |
-
* @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
|
274 |
-
* @param options.url url for the data
|
275 |
-
* @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
|
276 |
-
* @param options.dataType request data type: ajax, jsonp, other datatatypes supported by jQuery's $.ajax function or the transport function if specified
|
277 |
-
* @param options.traditional a boolean flag that should be true if you wish to use the traditional style of param serialization for the ajax request
|
278 |
-
* @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
|
279 |
-
* @param options.results a function(remoteData, pageNumber) that converts data returned form the remote request to the format expected by Select2.
|
280 |
-
* The expected format is an object containing the following keys:
|
281 |
-
* results array of objects that will be used as choices
|
282 |
-
* more (optional) boolean indicating whether there are more results available
|
283 |
-
* Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
|
284 |
-
*/
|
285 |
-
function ajax(options) {
|
286 |
-
var timeout, // current scheduled but not yet executed request
|
287 |
-
requestSequence = 0, // sequence used to drop out-of-order responses
|
288 |
-
handler = null,
|
289 |
-
quietMillis = options.quietMillis || 100;
|
290 |
-
|
291 |
-
return function (query) {
|
292 |
-
window.clearTimeout(timeout);
|
293 |
-
timeout = window.setTimeout(function () {
|
294 |
-
requestSequence += 1; // increment the sequence
|
295 |
-
var requestNumber = requestSequence, // this request's sequence number
|
296 |
-
data = options.data, // ajax data function
|
297 |
-
transport = options.transport || $.ajax,
|
298 |
-
traditional = options.traditional || false,
|
299 |
-
type = options.type || 'GET'; // set type of request (GET or POST)
|
300 |
-
|
301 |
-
data = data.call(this, query.term, query.page, query.context);
|
302 |
-
|
303 |
-
if( null !== handler) { handler.abort(); }
|
304 |
-
|
305 |
-
handler = transport.call(null, {
|
306 |
-
url: options.url,
|
307 |
-
dataType: options.dataType,
|
308 |
-
data: data,
|
309 |
-
type: type,
|
310 |
-
traditional: traditional,
|
311 |
-
success: function (data) {
|
312 |
-
if (requestNumber < requestSequence) {
|
313 |
-
return;
|
314 |
-
}
|
315 |
-
// TODO 3.0 - replace query.page with query so users have access to term, page, etc.
|
316 |
-
var results = options.results(data, query.page);
|
317 |
-
query.callback(results);
|
318 |
-
}
|
319 |
-
});
|
320 |
-
}, quietMillis);
|
321 |
-
};
|
322 |
-
}
|
323 |
-
|
324 |
-
/**
|
325 |
-
* Produces a query function that works with a local array
|
326 |
-
*
|
327 |
-
* @param options object containing configuration parameters. The options parameter can either be an array or an
|
328 |
-
* object.
|
329 |
-
*
|
330 |
-
* If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
|
331 |
-
*
|
332 |
-
* If the object form is used ti is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
|
333 |
-
* an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
|
334 |
-
* key can either be a String in which case it is expected that each element in the 'data' array has a key with the
|
335 |
-
* value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
|
336 |
-
* the text.
|
337 |
-
*/
|
338 |
-
function local(options) {
|
339 |
-
var data = options, // data elements
|
340 |
-
dataText,
|
341 |
-
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
|
342 |
-
|
343 |
-
if (!$.isArray(data)) {
|
344 |
-
text = data.text;
|
345 |
-
// if text is not a function we assume it to be a key name
|
346 |
-
if (!$.isFunction(text)) {
|
347 |
-
dataText = data.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
|
348 |
-
text = function (item) { return item[dataText]; };
|
349 |
-
}
|
350 |
-
data = data.results;
|
351 |
-
}
|
352 |
-
|
353 |
-
return function (query) {
|
354 |
-
var t = query.term, filtered = { results: [] }, process;
|
355 |
-
if (t === "") {
|
356 |
-
query.callback({results: data});
|
357 |
-
return;
|
358 |
-
}
|
359 |
-
|
360 |
-
process = function(datum, collection) {
|
361 |
-
var group, attr;
|
362 |
-
datum = datum[0];
|
363 |
-
if (datum.children) {
|
364 |
-
group = {};
|
365 |
-
for (attr in datum) {
|
366 |
-
if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
|
367 |
-
}
|
368 |
-
group.children=[];
|
369 |
-
$(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
|
370 |
-
if (group.children.length) {
|
371 |
-
collection.push(group);
|
372 |
-
}
|
373 |
-
} else {
|
374 |
-
if (query.matcher(t, text(datum))) {
|
375 |
-
collection.push(datum);
|
376 |
-
}
|
377 |
-
}
|
378 |
-
};
|
379 |
-
|
380 |
-
$(data).each2(function(i, datum) { process(datum, filtered.results); });
|
381 |
-
query.callback(filtered);
|
382 |
-
};
|
383 |
-
}
|
384 |
-
|
385 |
-
// TODO javadoc
|
386 |
-
function tags(data) {
|
387 |
-
// TODO even for a function we should probably return a wrapper that does the same object/string check as
|
388 |
-
// the function for arrays. otherwise only functions that return objects are supported.
|
389 |
-
if ($.isFunction(data)) {
|
390 |
-
return data;
|
391 |
-
}
|
392 |
-
|
393 |
-
// if not a function we assume it to be an array
|
394 |
-
|
395 |
-
return function (query) {
|
396 |
-
var t = query.term, filtered = {results: []};
|
397 |
-
$(data).each(function () {
|
398 |
-
var isObject = this.text !== undefined,
|
399 |
-
text = isObject ? this.text : this;
|
400 |
-
if (t === "" || query.matcher(t, text)) {
|
401 |
-
filtered.results.push(isObject ? this : {id: this, text: this});
|
402 |
-
}
|
403 |
-
});
|
404 |
-
query.callback(filtered);
|
405 |
-
};
|
406 |
-
}
|
407 |
-
|
408 |
-
/**
|
409 |
-
* Checks if the formatter function should be used.
|
410 |
-
*
|
411 |
-
* Throws an error if it is not a function. Returns true if it should be used,
|
412 |
-
* false if no formatting should be performed.
|
413 |
-
*
|
414 |
-
* @param formatter
|
415 |
-
*/
|
416 |
-
function checkFormatter(formatter, formatterName) {
|
417 |
-
if ($.isFunction(formatter)) return true;
|
418 |
-
if (!formatter) return false;
|
419 |
-
throw new Error("formatterName must be a function or a falsy value");
|
420 |
-
}
|
421 |
-
|
422 |
-
function evaluate(val) {
|
423 |
-
return $.isFunction(val) ? val() : val;
|
424 |
-
}
|
425 |
-
|
426 |
-
function countResults(results) {
|
427 |
-
var count = 0;
|
428 |
-
$.each(results, function(i, item) {
|
429 |
-
if (item.children) {
|
430 |
-
count += countResults(item.children);
|
431 |
-
} else {
|
432 |
-
count++;
|
433 |
-
}
|
434 |
-
});
|
435 |
-
return count;
|
436 |
-
}
|
437 |
-
|
438 |
-
/**
|
439 |
-
* Default tokenizer. This function uses breaks the input on substring match of any string from the
|
440 |
-
* opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
|
441 |
-
* two options have to be defined in order for the tokenizer to work.
|
442 |
-
*
|
443 |
-
* @param input text user has typed so far or pasted into the search field
|
444 |
-
* @param selection currently selected choices
|
445 |
-
* @param selectCallback function(choice) callback tho add the choice to selection
|
446 |
-
* @param opts select2's opts
|
447 |
-
* @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
|
448 |
-
*/
|
449 |
-
function defaultTokenizer(input, selection, selectCallback, opts) {
|
450 |
-
var original = input, // store the original so we can compare and know if we need to tell the search to update its text
|
451 |
-
dupe = false, // check for whether a token we extracted represents a duplicate selected choice
|
452 |
-
token, // token
|
453 |
-
index, // position at which the separator was found
|
454 |
-
i, l, // looping variables
|
455 |
-
separator; // the matched separator
|
456 |
-
|
457 |
-
if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
|
458 |
-
|
459 |
-
while (true) {
|
460 |
-
index = -1;
|
461 |
-
|
462 |
-
for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
|
463 |
-
separator = opts.tokenSeparators[i];
|
464 |
-
index = input.indexOf(separator);
|
465 |
-
if (index >= 0) break;
|
466 |
-
}
|
467 |
-
|
468 |
-
if (index < 0) break; // did not find any token separator in the input string, bail
|
469 |
-
|
470 |
-
token = input.substring(0, index);
|
471 |
-
input = input.substring(index + separator.length);
|
472 |
-
|
473 |
-
if (token.length > 0) {
|
474 |
-
token = opts.createSearchChoice(token, selection);
|
475 |
-
if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
|
476 |
-
dupe = false;
|
477 |
-
for (i = 0, l = selection.length; i < l; i++) {
|
478 |
-
if (equal(opts.id(token), opts.id(selection[i]))) {
|
479 |
-
dupe = true; break;
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
if (!dupe) selectCallback(token);
|
484 |
-
}
|
485 |
-
}
|
486 |
-
}
|
487 |
-
|
488 |
-
if (original.localeCompare(input) != 0) return input;
|
489 |
-
}
|
490 |
-
|
491 |
-
/**
|
492 |
-
* blurs any Select2 container that has focus when an element outside them was clicked or received focus
|
493 |
-
*
|
494 |
-
* also takes care of clicks on label tags that point to the source element
|
495 |
-
*/
|
496 |
-
$(document).ready(function () {
|
497 |
-
$(document).delegate("body", "mousedown touchend", function (e) {
|
498 |
-
var target = $(e.target).closest("div.select2-container").get(0), attr;
|
499 |
-
if (target) {
|
500 |
-
$(document).find("div.select2-container-active").each(function () {
|
501 |
-
if (this !== target) $(this).data("select2").blur();
|
502 |
-
});
|
503 |
-
} else {
|
504 |
-
target = $(e.target).closest("div.select2-drop").get(0);
|
505 |
-
$(document).find("div.select2-drop-active").each(function () {
|
506 |
-
if (this !== target) $(this).data("select2").blur();
|
507 |
-
});
|
508 |
-
}
|
509 |
-
|
510 |
-
target=$(e.target);
|
511 |
-
attr = target.attr("for");
|
512 |
-
if ("LABEL" === e.target.tagName && attr && attr.length > 0) {
|
513 |
-
target = $("#"+attr);
|
514 |
-
target = target.data("select2");
|
515 |
-
if (target !== undefined) { target.focus(); e.preventDefault();}
|
516 |
-
}
|
517 |
-
});
|
518 |
-
});
|
519 |
-
|
520 |
-
/**
|
521 |
-
* Creates a new class
|
522 |
-
*
|
523 |
-
* @param superClass
|
524 |
-
* @param methods
|
525 |
-
*/
|
526 |
-
function clazz(SuperClass, methods) {
|
527 |
-
var constructor = function () {};
|
528 |
-
constructor.prototype = new SuperClass;
|
529 |
-
constructor.prototype.constructor = constructor;
|
530 |
-
constructor.prototype.parent = SuperClass.prototype;
|
531 |
-
constructor.prototype = $.extend(constructor.prototype, methods);
|
532 |
-
return constructor;
|
533 |
-
}
|
534 |
-
|
535 |
-
AbstractSelect2 = clazz(Object, {
|
536 |
-
|
537 |
-
// abstract
|
538 |
-
bind: function (func) {
|
539 |
-
var self = this;
|
540 |
-
return function () {
|
541 |
-
func.apply(self, arguments);
|
542 |
-
};
|
543 |
-
},
|
544 |
-
|
545 |
-
// abstract
|
546 |
-
init: function (opts) {
|
547 |
-
var results, search, resultsSelector = ".select2-results";
|
548 |
-
|
549 |
-
// prepare options
|
550 |
-
this.opts = opts = this.prepareOpts(opts);
|
551 |
-
|
552 |
-
this.id=opts.id;
|
553 |
-
|
554 |
-
// destroy if called on an existing component
|
555 |
-
if (opts.element.data("select2") !== undefined &&
|
556 |
-
opts.element.data("select2") !== null) {
|
557 |
-
this.destroy();
|
558 |
-
}
|
559 |
-
|
560 |
-
this.enabled=true;
|
561 |
-
this.container = this.createContainer();
|
562 |
-
|
563 |
-
this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
|
564 |
-
this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
|
565 |
-
this.container.attr("id", this.containerId);
|
566 |
-
|
567 |
-
// cache the body so future lookups are cheap
|
568 |
-
this.body = thunk(function() { return opts.element.closest("body"); });
|
569 |
-
|
570 |
-
if (opts.element.attr("class") !== undefined) {
|
571 |
-
this.container.addClass(opts.element.attr("class").replace(/validate\[[\S ]+] ?/, ''));
|
572 |
-
}
|
573 |
-
|
574 |
-
this.container.css(evaluate(opts.containerCss));
|
575 |
-
this.container.addClass(evaluate(opts.containerCssClass));
|
576 |
-
|
577 |
-
// swap container for the element
|
578 |
-
this.opts.element
|
579 |
-
.data("select2", this)
|
580 |
-
.hide()
|
581 |
-
.before(this.container);
|
582 |
-
this.container.data("select2", this);
|
583 |
-
|
584 |
-
this.dropdown = this.container.find(".select2-drop");
|
585 |
-
this.dropdown.addClass(evaluate(opts.dropdownCssClass));
|
586 |
-
this.dropdown.data("select2", this);
|
587 |
-
|
588 |
-
this.results = results = this.container.find(resultsSelector);
|
589 |
-
this.search = search = this.container.find("input.select2-input");
|
590 |
-
|
591 |
-
search.attr("tabIndex", this.opts.element.attr("tabIndex"));
|
592 |
-
|
593 |
-
this.resultsPage = 0;
|
594 |
-
this.context = null;
|
595 |
-
|
596 |
-
// initialize the container
|
597 |
-
this.initContainer();
|
598 |
-
this.initContainerWidth();
|
599 |
-
|
600 |
-
installFilteredMouseMove(this.results);
|
601 |
-
this.dropdown.delegate(resultsSelector, "mousemove-filtered", this.bind(this.highlightUnderEvent));
|
602 |
-
|
603 |
-
installDebouncedScroll(80, this.results);
|
604 |
-
this.dropdown.delegate(resultsSelector, "scroll-debounced", this.bind(this.loadMoreIfNeeded));
|
605 |
-
|
606 |
-
// if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
|
607 |
-
if ($.fn.mousewheel) {
|
608 |
-
results.mousewheel(function (e, delta, deltaX, deltaY) {
|
609 |
-
var top = results.scrollTop(), height;
|
610 |
-
if (deltaY > 0 && top - deltaY <= 0) {
|
611 |
-
results.scrollTop(0);
|
612 |
-
killEvent(e);
|
613 |
-
} else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
|
614 |
-
results.scrollTop(results.get(0).scrollHeight - results.height());
|
615 |
-
killEvent(e);
|
616 |
-
}
|
617 |
-
});
|
618 |
-
}
|
619 |
-
|
620 |
-
installKeyUpChangeEvent(search);
|
621 |
-
search.bind("keyup-change", this.bind(this.updateResults));
|
622 |
-
search.bind("focus", function () { search.addClass("select2-focused"); if (search.val() === " ") search.val(""); });
|
623 |
-
search.bind("blur", function () { search.removeClass("select2-focused");});
|
624 |
-
|
625 |
-
this.dropdown.delegate(resultsSelector, "mouseup", this.bind(function (e) {
|
626 |
-
if ($(e.target).closest(".select2-result-selectable:not(.select2-disabled)").length > 0) {
|
627 |
-
this.highlightUnderEvent(e);
|
628 |
-
this.selectHighlighted(e);
|
629 |
-
} else {
|
630 |
-
this.focusSearch();
|
631 |
-
}
|
632 |
-
killEvent(e);
|
633 |
-
}));
|
634 |
-
|
635 |
-
// trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
|
636 |
-
// for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
|
637 |
-
// dom it will trigger the popup close, which is not what we want
|
638 |
-
this.dropdown.bind("click mouseup mousedown", function (e) { e.stopPropagation(); });
|
639 |
-
|
640 |
-
if ($.isFunction(this.opts.initSelection)) {
|
641 |
-
// initialize selection based on the current value of the source element
|
642 |
-
this.initSelection();
|
643 |
-
|
644 |
-
// if the user has provided a function that can set selection based on the value of the source element
|
645 |
-
// we monitor the change event on the element and trigger it, allowing for two way synchronization
|
646 |
-
this.monitorSource();
|
647 |
-
}
|
648 |
-
|
649 |
-
if (opts.element.is(":disabled") || opts.element.is("[readonly='readonly']")) this.disable();
|
650 |
-
},
|
651 |
-
|
652 |
-
// abstract
|
653 |
-
destroy: function () {
|
654 |
-
var select2 = this.opts.element.data("select2");
|
655 |
-
if (select2 !== undefined) {
|
656 |
-
select2.container.remove();
|
657 |
-
select2.dropdown.remove();
|
658 |
-
select2.opts.element
|
659 |
-
.removeData("select2")
|
660 |
-
.unbind(".select2")
|
661 |
-
.show();
|
662 |
-
}
|
663 |
-
},
|
664 |
-
|
665 |
-
// abstract
|
666 |
-
prepareOpts: function (opts) {
|
667 |
-
var element, select, idKey, ajaxUrl;
|
668 |
-
|
669 |
-
element = opts.element;
|
670 |
-
|
671 |
-
if (element.get(0).tagName.toLowerCase() === "select") {
|
672 |
-
this.select = select = opts.element;
|
673 |
-
}
|
674 |
-
|
675 |
-
if (select) {
|
676 |
-
// these options are not allowed when attached to a select because they are picked up off the element itself
|
677 |
-
$.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
|
678 |
-
if (this in opts) {
|
679 |
-
throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.");
|
680 |
-
}
|
681 |
-
});
|
682 |
-
}
|
683 |
-
|
684 |
-
opts = $.extend({}, {
|
685 |
-
populateResults: function(container, results, query) {
|
686 |
-
var populate, data, result, children, id=this.opts.id, self=this;
|
687 |
-
|
688 |
-
populate=function(results, container, depth) {
|
689 |
-
|
690 |
-
var i, l, result, selectable, compound, node, label, innerContainer, formatted;
|
691 |
-
for (i = 0, l = results.length; i < l; i = i + 1) {
|
692 |
-
|
693 |
-
result=results[i];
|
694 |
-
selectable=id(result) !== undefined;
|
695 |
-
compound=result.children && result.children.length > 0;
|
696 |
-
|
697 |
-
node=$("<li></li>");
|
698 |
-
node.addClass("select2-results-dept-"+depth);
|
699 |
-
node.addClass("select2-result");
|
700 |
-
node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
|
701 |
-
if (compound) { node.addClass("select2-result-with-children"); }
|
702 |
-
node.addClass(self.opts.formatResultCssClass(result));
|
703 |
-
|
704 |
-
label=$("<div></div>");
|
705 |
-
label.addClass("select2-result-label");
|
706 |
-
|
707 |
-
formatted=opts.formatResult(result, label, query);
|
708 |
-
if (formatted!==undefined) {
|
709 |
-
label.html(self.opts.escapeMarkup(formatted));
|
710 |
-
}
|
711 |
-
|
712 |
-
node.append(label);
|
713 |
-
|
714 |
-
if (compound) {
|
715 |
-
|
716 |
-
innerContainer=$("<ul></ul>");
|
717 |
-
innerContainer.addClass("select2-result-sub");
|
718 |
-
populate(result.children, innerContainer, depth+1);
|
719 |
-
node.append(innerContainer);
|
720 |
-
}
|
721 |
-
|
722 |
-
node.data("select2-data", result);
|
723 |
-
container.append(node);
|
724 |
-
}
|
725 |
-
};
|
726 |
-
|
727 |
-
populate(results, container, 0);
|
728 |
-
}
|
729 |
-
}, $.fn.select2.defaults, opts);
|
730 |
-
|
731 |
-
if (typeof(opts.id) !== "function") {
|
732 |
-
idKey = opts.id;
|
733 |
-
opts.id = function (e) { return e[idKey]; };
|
734 |
-
}
|
735 |
-
|
736 |
-
if (select) {
|
737 |
-
opts.query = this.bind(function (query) {
|
738 |
-
var data = { results: [], more: false },
|
739 |
-
term = query.term,
|
740 |
-
children, firstChild, process;
|
741 |
-
|
742 |
-
process=function(element, collection) {
|
743 |
-
var group;
|
744 |
-
if (element.is("option")) {
|
745 |
-
if (query.matcher(term, element.text(), element)) {
|
746 |
-
collection.push({id:element.attr("value"), text:element.text(), element: element.get(), css: element.attr("class")});
|
747 |
-
}
|
748 |
-
} else if (element.is("optgroup")) {
|
749 |
-
group={text:element.attr("label"), children:[], element: element.get(), css: element.attr("class")};
|
750 |
-
element.children().each2(function(i, elm) { process(elm, group.children); });
|
751 |
-
if (group.children.length>0) {
|
752 |
-
collection.push(group);
|
753 |
-
}
|
754 |
-
}
|
755 |
-
};
|
756 |
-
|
757 |
-
children=element.children();
|
758 |
-
|
759 |
-
// ignore the placeholder option if there is one
|
760 |
-
if (this.getPlaceholder() !== undefined && children.length > 0) {
|
761 |
-
firstChild = children[0];
|
762 |
-
if ($(firstChild).text() === "") {
|
763 |
-
children=children.not(firstChild);
|
764 |
-
}
|
765 |
-
}
|
766 |
-
|
767 |
-
children.each2(function(i, elm) { process(elm, data.results); });
|
768 |
-
|
769 |
-
query.callback(data);
|
770 |
-
});
|
771 |
-
// this is needed because inside val() we construct choices from options and there id is hardcoded
|
772 |
-
opts.id=function(e) { return e.id; };
|
773 |
-
opts.formatResultCssClass = function(data) { return data.css; }
|
774 |
-
} else {
|
775 |
-
if (!("query" in opts)) {
|
776 |
-
if ("ajax" in opts) {
|
777 |
-
ajaxUrl = opts.element.data("ajax-url");
|
778 |
-
if (ajaxUrl && ajaxUrl.length > 0) {
|
779 |
-
opts.ajax.url = ajaxUrl;
|
780 |
-
}
|
781 |
-
opts.query = ajax(opts.ajax);
|
782 |
-
} else if ("data" in opts) {
|
783 |
-
opts.query = local(opts.data);
|
784 |
-
} else if ("tags" in opts) {
|
785 |
-
opts.query = tags(opts.tags);
|
786 |
-
opts.createSearchChoice = function (term) { return {id: term, text: term}; };
|
787 |
-
opts.initSelection = function (element, callback) {
|
788 |
-
var data = [];
|
789 |
-
$(splitVal(element.val(), opts.separator)).each(function () {
|
790 |
-
var id = this, text = this, tags=opts.tags;
|
791 |
-
if ($.isFunction(tags)) tags=tags();
|
792 |
-
$(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } });
|
793 |
-
data.push({id: id, text: text});
|
794 |
-
});
|
795 |
-
|
796 |
-
callback(data);
|
797 |
-
};
|
798 |
-
}
|
799 |
-
}
|
800 |
-
}
|
801 |
-
if (typeof(opts.query) !== "function") {
|
802 |
-
throw "query function not defined for Select2 " + opts.element.attr("id");
|
803 |
-
}
|
804 |
-
|
805 |
-
return opts;
|
806 |
-
},
|
807 |
-
|
808 |
-
/**
|
809 |
-
* Monitor the original element for changes and update select2 accordingly
|
810 |
-
*/
|
811 |
-
// abstract
|
812 |
-
monitorSource: function () {
|
813 |
-
this.opts.element.bind("change.select2", this.bind(function (e) {
|
814 |
-
if (this.opts.element.data("select2-change-triggered") !== true) {
|
815 |
-
this.initSelection();
|
816 |
-
}
|
817 |
-
}));
|
818 |
-
},
|
819 |
-
|
820 |
-
/**
|
821 |
-
* Triggers the change event on the source element
|
822 |
-
*/
|
823 |
-
// abstract
|
824 |
-
triggerChange: function (details) {
|
825 |
-
|
826 |
-
details = details || {};
|
827 |
-
details= $.extend({}, details, { type: "change", val: this.val() });
|
828 |
-
// prevents recursive triggering
|
829 |
-
this.opts.element.data("select2-change-triggered", true);
|
830 |
-
this.opts.element.trigger(details);
|
831 |
-
this.opts.element.data("select2-change-triggered", false);
|
832 |
-
|
833 |
-
// some validation frameworks ignore the change event and listen instead to keyup, click for selects
|
834 |
-
// so here we trigger the click event manually
|
835 |
-
this.opts.element.click();
|
836 |
-
|
837 |
-
// ValidationEngine ignorea the change event and listens instead to blur
|
838 |
-
// so here we trigger the blur event manually if so desired
|
839 |
-
if (this.opts.blurOnChange)
|
840 |
-
this.opts.element.blur();
|
841 |
-
},
|
842 |
-
|
843 |
-
|
844 |
-
// abstract
|
845 |
-
enable: function() {
|
846 |
-
if (this.enabled) return;
|
847 |
-
|
848 |
-
this.enabled=true;
|
849 |
-
this.container.removeClass("select2-container-disabled");
|
850 |
-
},
|
851 |
-
|
852 |
-
// abstract
|
853 |
-
disable: function() {
|
854 |
-
if (!this.enabled) return;
|
855 |
-
|
856 |
-
this.close();
|
857 |
-
|
858 |
-
this.enabled=false;
|
859 |
-
this.container.addClass("select2-container-disabled");
|
860 |
-
},
|
861 |
-
|
862 |
-
// abstract
|
863 |
-
opened: function () {
|
864 |
-
return this.container.hasClass("select2-dropdown-open");
|
865 |
-
},
|
866 |
-
|
867 |
-
// abstract
|
868 |
-
positionDropdown: function() {
|
869 |
-
var offset = this.container.offset(),
|
870 |
-
height = this.container.outerHeight(),
|
871 |
-
width = this.container.outerWidth(),
|
872 |
-
dropHeight = this.dropdown.outerHeight(),
|
873 |
-
viewportBottom = $(window).scrollTop() + document.documentElement.clientHeight,
|
874 |
-
dropTop = offset.top + height,
|
875 |
-
dropLeft = offset.left,
|
876 |
-
enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
|
877 |
-
enoughRoomAbove = (offset.top - dropHeight) >= this.body().scrollTop(),
|
878 |
-
aboveNow = this.dropdown.hasClass("select2-drop-above"),
|
879 |
-
bodyOffset,
|
880 |
-
above,
|
881 |
-
css;
|
882 |
-
|
883 |
-
// console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
|
884 |
-
// console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body().scrollTop(), "enough?", enoughRoomAbove);
|
885 |
-
|
886 |
-
// fix positioning when body has an offset and is not position: static
|
887 |
-
|
888 |
-
if (this.body().css('position') !== 'static') {
|
889 |
-
bodyOffset = this.body().offset();
|
890 |
-
dropTop -= bodyOffset.top;
|
891 |
-
dropLeft -= bodyOffset.left;
|
892 |
-
}
|
893 |
-
|
894 |
-
// always prefer the current above/below alignment, unless there is not enough room
|
895 |
-
|
896 |
-
if (aboveNow) {
|
897 |
-
above = true;
|
898 |
-
if (!enoughRoomAbove && enoughRoomBelow) above = false;
|
899 |
-
} else {
|
900 |
-
above = false;
|
901 |
-
if (!enoughRoomBelow && enoughRoomAbove) above = true;
|
902 |
-
}
|
903 |
-
|
904 |
-
if (above) {
|
905 |
-
dropTop = offset.top - dropHeight;
|
906 |
-
this.container.addClass("select2-drop-above");
|
907 |
-
this.dropdown.addClass("select2-drop-above");
|
908 |
-
}
|
909 |
-
else {
|
910 |
-
this.container.removeClass("select2-drop-above");
|
911 |
-
this.dropdown.removeClass("select2-drop-above");
|
912 |
-
}
|
913 |
-
|
914 |
-
css = $.extend({
|
915 |
-
top: dropTop,
|
916 |
-
left: dropLeft,
|
917 |
-
width: width
|
918 |
-
}, evaluate(this.opts.dropdownCss));
|
919 |
-
|
920 |
-
this.dropdown.css(css);
|
921 |
-
},
|
922 |
-
|
923 |
-
// abstract
|
924 |
-
shouldOpen: function() {
|
925 |
-
var event;
|
926 |
-
|
927 |
-
if (this.opened()) return false;
|
928 |
-
|
929 |
-
event = $.Event("open");
|
930 |
-
this.opts.element.trigger(event);
|
931 |
-
return !event.isDefaultPrevented();
|
932 |
-
},
|
933 |
-
|
934 |
-
// abstract
|
935 |
-
clearDropdownAlignmentPreference: function() {
|
936 |
-
// clear the classes used to figure out the preference of where the dropdown should be opened
|
937 |
-
this.container.removeClass("select2-drop-above");
|
938 |
-
this.dropdown.removeClass("select2-drop-above");
|
939 |
-
},
|
940 |
-
|
941 |
-
/**
|
942 |
-
* Opens the dropdown
|
943 |
-
*
|
944 |
-
* @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
|
945 |
-
* the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
|
946 |
-
*/
|
947 |
-
// abstract
|
948 |
-
open: function () {
|
949 |
-
|
950 |
-
if (!this.shouldOpen()) return false;
|
951 |
-
|
952 |
-
window.setTimeout(this.bind(this.opening), 1);
|
953 |
-
|
954 |
-
return true;
|
955 |
-
},
|
956 |
-
|
957 |
-
/**
|
958 |
-
* Performs the opening of the dropdown
|
959 |
-
*/
|
960 |
-
// abstract
|
961 |
-
opening: function() {
|
962 |
-
var cid = this.containerId, selector = this.containerSelector,
|
963 |
-
scroll = "scroll." + cid, resize = "resize." + cid;
|
964 |
-
|
965 |
-
this.container.parents().each(function() {
|
966 |
-
$(this).bind(scroll, function() {
|
967 |
-
var s2 = $(selector);
|
968 |
-
if (s2.length == 0) {
|
969 |
-
$(this).unbind(scroll);
|
970 |
-
}
|
971 |
-
s2.select2("close");
|
972 |
-
});
|
973 |
-
});
|
974 |
-
|
975 |
-
$(window).bind(resize, function() {
|
976 |
-
var s2 = $(selector);
|
977 |
-
if (s2.length == 0) {
|
978 |
-
$(window).unbind(resize);
|
979 |
-
}
|
980 |
-
s2.select2("close");
|
981 |
-
});
|
982 |
-
|
983 |
-
this.clearDropdownAlignmentPreference();
|
984 |
-
|
985 |
-
if (this.search.val() === " ") { this.search.val(""); }
|
986 |
-
|
987 |
-
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
|
988 |
-
|
989 |
-
this.updateResults(true);
|
990 |
-
|
991 |
-
if(this.dropdown[0] !== this.body().children().last()[0]) {
|
992 |
-
this.dropdown.detach().appendTo(this.body());
|
993 |
-
}
|
994 |
-
|
995 |
-
this.dropdown.show();
|
996 |
-
|
997 |
-
this.positionDropdown();
|
998 |
-
this.dropdown.addClass("select2-drop-active");
|
999 |
-
|
1000 |
-
this.ensureHighlightVisible();
|
1001 |
-
|
1002 |
-
this.focusSearch();
|
1003 |
-
},
|
1004 |
-
|
1005 |
-
// abstract
|
1006 |
-
close: function () {
|
1007 |
-
if (!this.opened()) return;
|
1008 |
-
|
1009 |
-
var self = this;
|
1010 |
-
|
1011 |
-
this.container.parents().each(function() {
|
1012 |
-
$(this).unbind("scroll." + self.containerId);
|
1013 |
-
});
|
1014 |
-
$(window).unbind("resize." + this.containerId);
|
1015 |
-
|
1016 |
-
this.clearDropdownAlignmentPreference();
|
1017 |
-
|
1018 |
-
this.dropdown.hide();
|
1019 |
-
this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
|
1020 |
-
this.results.empty();
|
1021 |
-
this.clearSearch();
|
1022 |
-
|
1023 |
-
this.opts.element.trigger($.Event("close"));
|
1024 |
-
},
|
1025 |
-
|
1026 |
-
// abstract
|
1027 |
-
clearSearch: function () {
|
1028 |
-
|
1029 |
-
},
|
1030 |
-
|
1031 |
-
// abstract
|
1032 |
-
ensureHighlightVisible: function () {
|
1033 |
-
var results = this.results, children, index, child, hb, rb, y, more;
|
1034 |
-
|
1035 |
-
index = this.highlight();
|
1036 |
-
|
1037 |
-
if (index < 0) return;
|
1038 |
-
|
1039 |
-
if (index == 0) {
|
1040 |
-
|
1041 |
-
// if the first element is highlighted scroll all the way to the top,
|
1042 |
-
// that way any unselectable headers above it will also be scrolled
|
1043 |
-
// into view
|
1044 |
-
|
1045 |
-
results.scrollTop(0);
|
1046 |
-
return;
|
1047 |
-
}
|
1048 |
-
|
1049 |
-
children = results.find(".select2-result-selectable");
|
1050 |
-
|
1051 |
-
child = $(children[index]);
|
1052 |
-
|
1053 |
-
hb = child.offset().top + child.outerHeight();
|
1054 |
-
|
1055 |
-
// if this is the last child lets also make sure select2-more-results is visible
|
1056 |
-
if (index === children.length - 1) {
|
1057 |
-
more = results.find("li.select2-more-results");
|
1058 |
-
if (more.length > 0) {
|
1059 |
-
hb = more.offset().top + more.outerHeight();
|
1060 |
-
}
|
1061 |
-
}
|
1062 |
-
|
1063 |
-
rb = results.offset().top + results.outerHeight();
|
1064 |
-
if (hb > rb) {
|
1065 |
-
results.scrollTop(results.scrollTop() + (hb - rb));
|
1066 |
-
}
|
1067 |
-
y = child.offset().top - results.offset().top;
|
1068 |
-
|
1069 |
-
// make sure the top of the element is visible
|
1070 |
-
if (y < 0) {
|
1071 |
-
results.scrollTop(results.scrollTop() + y); // y is negative
|
1072 |
-
}
|
1073 |
-
},
|
1074 |
-
|
1075 |
-
// abstract
|
1076 |
-
moveHighlight: function (delta) {
|
1077 |
-
var choices = this.results.find(".select2-result-selectable"),
|
1078 |
-
index = this.highlight();
|
1079 |
-
|
1080 |
-
while (index > -1 && index < choices.length) {
|
1081 |
-
index += delta;
|
1082 |
-
var choice = $(choices[index]);
|
1083 |
-
if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled")) {
|
1084 |
-
this.highlight(index);
|
1085 |
-
break;
|
1086 |
-
}
|
1087 |
-
}
|
1088 |
-
},
|
1089 |
-
|
1090 |
-
// abstract
|
1091 |
-
highlight: function (index) {
|
1092 |
-
var choices = this.results.find(".select2-result-selectable").not(".select2-disabled");
|
1093 |
-
|
1094 |
-
if (arguments.length === 0) {
|
1095 |
-
return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
if (index >= choices.length) index = choices.length - 1;
|
1099 |
-
if (index < 0) index = 0;
|
1100 |
-
|
1101 |
-
choices.removeClass("select2-highlighted");
|
1102 |
-
|
1103 |
-
$(choices[index]).addClass("select2-highlighted");
|
1104 |
-
this.ensureHighlightVisible();
|
1105 |
-
|
1106 |
-
},
|
1107 |
-
|
1108 |
-
// abstract
|
1109 |
-
countSelectableResults: function() {
|
1110 |
-
return this.results.find(".select2-result-selectable").not(".select2-disabled").length;
|
1111 |
-
},
|
1112 |
-
|
1113 |
-
// abstract
|
1114 |
-
highlightUnderEvent: function (event) {
|
1115 |
-
var el = $(event.target).closest(".select2-result-selectable");
|
1116 |
-
if (el.length > 0 && !el.is(".select2-highlighted")) {
|
1117 |
-
var choices = this.results.find('.select2-result-selectable');
|
1118 |
-
this.highlight(choices.index(el));
|
1119 |
-
} else if (el.length == 0) {
|
1120 |
-
// if we are over an unselectable item remove al highlights
|
1121 |
-
this.results.find(".select2-highlighted").removeClass("select2-highlighted");
|
1122 |
-
}
|
1123 |
-
},
|
1124 |
-
|
1125 |
-
// abstract
|
1126 |
-
loadMoreIfNeeded: function () {
|
1127 |
-
var results = this.results,
|
1128 |
-
more = results.find("li.select2-more-results"),
|
1129 |
-
below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
|
1130 |
-
offset = -1, // index of first element without data
|
1131 |
-
page = this.resultsPage + 1,
|
1132 |
-
self=this,
|
1133 |
-
term=this.search.val(),
|
1134 |
-
context=this.context;
|
1135 |
-
|
1136 |
-
if (more.length === 0) return;
|
1137 |
-
below = more.offset().top - results.offset().top - results.height();
|
1138 |
-
|
1139 |
-
if (below <= 0) {
|
1140 |
-
more.addClass("select2-active");
|
1141 |
-
this.opts.query({
|
1142 |
-
term: term,
|
1143 |
-
page: page,
|
1144 |
-
context: context,
|
1145 |
-
matcher: this.opts.matcher,
|
1146 |
-
callback: this.bind(function (data) {
|
1147 |
-
|
1148 |
-
// ignore a response if the select2 has been closed before it was received
|
1149 |
-
if (!self.opened()) return;
|
1150 |
-
|
1151 |
-
|
1152 |
-
self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
|
1153 |
-
|
1154 |
-
if (data.more===true) {
|
1155 |
-
more.detach().appendTo(results).text(self.opts.formatLoadMore(page+1));
|
1156 |
-
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
|
1157 |
-
} else {
|
1158 |
-
more.remove();
|
1159 |
-
}
|
1160 |
-
self.positionDropdown();
|
1161 |
-
self.resultsPage = page;
|
1162 |
-
})});
|
1163 |
-
}
|
1164 |
-
},
|
1165 |
-
|
1166 |
-
/**
|
1167 |
-
* Default tokenizer function which does nothing
|
1168 |
-
*/
|
1169 |
-
tokenize: function() {
|
1170 |
-
|
1171 |
-
},
|
1172 |
-
|
1173 |
-
/**
|
1174 |
-
* @param initial whether or not this is the call to this method right after the dropdown has been opened
|
1175 |
-
*/
|
1176 |
-
// abstract
|
1177 |
-
updateResults: function (initial) {
|
1178 |
-
var search = this.search, results = this.results, opts = this.opts, data, self=this, input;
|
1179 |
-
|
1180 |
-
// if the search is currently hidden we do not alter the results
|
1181 |
-
if (initial !== true && (this.showSearchInput === false || !this.opened())) {
|
1182 |
-
return;
|
1183 |
-
}
|
1184 |
-
|
1185 |
-
search.addClass("select2-active");
|
1186 |
-
|
1187 |
-
function postRender() {
|
1188 |
-
results.scrollTop(0);
|
1189 |
-
search.removeClass("select2-active");
|
1190 |
-
self.positionDropdown();
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
function render(html) {
|
1194 |
-
results.html(self.opts.escapeMarkup(html));
|
1195 |
-
postRender();
|
1196 |
-
}
|
1197 |
-
|
1198 |
-
if (opts.maximumSelectionSize >=1) {
|
1199 |
-
data = this.data();
|
1200 |
-
if ($.isArray(data) && data.length >= opts.maximumSelectionSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
|
1201 |
-
render("<li class='select2-selection-limit'>" + opts.formatSelectionTooBig(opts.maximumSelectionSize) + "</li>");
|
1202 |
-
return;
|
1203 |
-
}
|
1204 |
-
}
|
1205 |
-
|
1206 |
-
if (search.val().length < opts.minimumInputLength && checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
|
1207 |
-
render("<li class='select2-no-results'>" + opts.formatInputTooShort(search.val(), opts.minimumInputLength) + "</li>");
|
1208 |
-
return;
|
1209 |
-
}
|
1210 |
-
else {
|
1211 |
-
render("<li class='select2-searching'>" + opts.formatSearching() + "</li>");
|
1212 |
-
}
|
1213 |
-
|
1214 |
-
// give the tokenizer a chance to pre-process the input
|
1215 |
-
input = this.tokenize();
|
1216 |
-
if (input != undefined && input != null) {
|
1217 |
-
search.val(input);
|
1218 |
-
}
|
1219 |
-
|
1220 |
-
this.resultsPage = 1;
|
1221 |
-
opts.query({
|
1222 |
-
term: search.val(),
|
1223 |
-
page: this.resultsPage,
|
1224 |
-
context: null,
|
1225 |
-
matcher: opts.matcher,
|
1226 |
-
callback: this.bind(function (data) {
|
1227 |
-
var def; // default choice
|
1228 |
-
|
1229 |
-
// ignore a response if the select2 has been closed before it was received
|
1230 |
-
if (!this.opened()) return;
|
1231 |
-
|
1232 |
-
// save context, if any
|
1233 |
-
this.context = (data.context===undefined) ? null : data.context;
|
1234 |
-
|
1235 |
-
// create a default choice and prepend it to the list
|
1236 |
-
if (this.opts.createSearchChoice && search.val() !== "") {
|
1237 |
-
def = this.opts.createSearchChoice.call(null, search.val(), data.results);
|
1238 |
-
if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
|
1239 |
-
if ($(data.results).filter(
|
1240 |
-
function () {
|
1241 |
-
return equal(self.id(this), self.id(def));
|
1242 |
-
}).length === 0) {
|
1243 |
-
data.results.unshift(def);
|
1244 |
-
}
|
1245 |
-
}
|
1246 |
-
}
|
1247 |
-
|
1248 |
-
if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
|
1249 |
-
render("<li class='select2-no-results'>" + opts.formatNoMatches(search.val()) + "</li>");
|
1250 |
-
return;
|
1251 |
-
}
|
1252 |
-
|
1253 |
-
results.empty();
|
1254 |
-
self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
|
1255 |
-
|
1256 |
-
if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
|
1257 |
-
results.append("<li class='select2-more-results'>" + self.opts.escapeMarkup(opts.formatLoadMore(this.resultsPage)) + "</li>");
|
1258 |
-
window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
this.postprocessResults(data, initial);
|
1262 |
-
|
1263 |
-
postRender();
|
1264 |
-
})});
|
1265 |
-
},
|
1266 |
-
|
1267 |
-
// abstract
|
1268 |
-
cancel: function () {
|
1269 |
-
this.close();
|
1270 |
-
},
|
1271 |
-
|
1272 |
-
// abstract
|
1273 |
-
blur: function () {
|
1274 |
-
this.close();
|
1275 |
-
this.container.removeClass("select2-container-active");
|
1276 |
-
this.dropdown.removeClass("select2-drop-active");
|
1277 |
-
// synonymous to .is(':focus'), which is available in jquery >= 1.6
|
1278 |
-
if (this.search[0] === document.activeElement) { this.search.blur(); }
|
1279 |
-
this.clearSearch();
|
1280 |
-
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
1281 |
-
},
|
1282 |
-
|
1283 |
-
// abstract
|
1284 |
-
focusSearch: function () {
|
1285 |
-
// need to do it here as well as in timeout so it works in IE
|
1286 |
-
this.search.show();
|
1287 |
-
this.search.focus();
|
1288 |
-
|
1289 |
-
/* we do this in a timeout so that current event processing can complete before this code is executed.
|
1290 |
-
this makes sure the search field is focussed even if the current event would blur it */
|
1291 |
-
window.setTimeout(this.bind(function () {
|
1292 |
-
// reset the value so IE places the cursor at the end of the input box
|
1293 |
-
this.search.show();
|
1294 |
-
this.search.focus();
|
1295 |
-
this.search.val(this.search.val());
|
1296 |
-
}), 10);
|
1297 |
-
},
|
1298 |
-
|
1299 |
-
// abstract
|
1300 |
-
selectHighlighted: function () {
|
1301 |
-
var index=this.highlight(),
|
1302 |
-
highlighted=this.results.find(".select2-highlighted").not(".select2-disabled"),
|
1303 |
-
data = highlighted.closest('.select2-result-selectable').data("select2-data");
|
1304 |
-
if (data) {
|
1305 |
-
highlighted.addClass("select2-disabled");
|
1306 |
-
this.highlight(index);
|
1307 |
-
this.onSelect(data);
|
1308 |
-
}
|
1309 |
-
},
|
1310 |
-
|
1311 |
-
// abstract
|
1312 |
-
getPlaceholder: function () {
|
1313 |
-
return this.opts.element.attr("placeholder") ||
|
1314 |
-
this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
|
1315 |
-
this.opts.element.data("placeholder") ||
|
1316 |
-
this.opts.placeholder;
|
1317 |
-
},
|
1318 |
-
|
1319 |
-
/**
|
1320 |
-
* Get the desired width for the container element. This is
|
1321 |
-
* derived first from option `width` passed to select2, then
|
1322 |
-
* the inline 'style' on the original element, and finally
|
1323 |
-
* falls back to the jQuery calculated element width.
|
1324 |
-
*/
|
1325 |
-
// abstract
|
1326 |
-
initContainerWidth: function () {
|
1327 |
-
function resolveContainerWidth() {
|
1328 |
-
var style, attrs, matches, i, l;
|
1329 |
-
|
1330 |
-
if (this.opts.width === "off") {
|
1331 |
-
return null;
|
1332 |
-
} else if (this.opts.width === "element"){
|
1333 |
-
return this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px';
|
1334 |
-
} else if (this.opts.width === "copy" || this.opts.width === "resolve") {
|
1335 |
-
// check if there is inline style on the element that contains width
|
1336 |
-
style = this.opts.element.attr('style');
|
1337 |
-
if (style !== undefined) {
|
1338 |
-
attrs = style.split(';');
|
1339 |
-
for (i = 0, l = attrs.length; i < l; i = i + 1) {
|
1340 |
-
matches = attrs[i].replace(/\s/g, '')
|
1341 |
-
.match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/);
|
1342 |
-
if (matches !== null && matches.length >= 1)
|
1343 |
-
return matches[1];
|
1344 |
-
}
|
1345 |
-
}
|
1346 |
-
|
1347 |
-
if (this.opts.width === "resolve") {
|
1348 |
-
// next check if css('width') can resolve a width that is percent based, this is sometimes possible
|
1349 |
-
// when attached to input type=hidden or elements hidden via css
|
1350 |
-
style = this.opts.element.css('width');
|
1351 |
-
if (style.indexOf("%") > 0) return style;
|
1352 |
-
|
1353 |
-
// finally, fallback on the calculated width of the element
|
1354 |
-
return (this.opts.element.outerWidth() === 0 ? 'auto' : this.opts.element.outerWidth() + 'px');
|
1355 |
-
}
|
1356 |
-
|
1357 |
-
return null;
|
1358 |
-
} else if ($.isFunction(this.opts.width)) {
|
1359 |
-
return this.opts.width();
|
1360 |
-
} else {
|
1361 |
-
return this.opts.width;
|
1362 |
-
}
|
1363 |
-
};
|
1364 |
-
|
1365 |
-
var width = resolveContainerWidth.call(this);
|
1366 |
-
if (width !== null) {
|
1367 |
-
this.container.attr("style", "width: "+width);
|
1368 |
-
}
|
1369 |
-
}
|
1370 |
-
});
|
1371 |
-
|
1372 |
-
SingleSelect2 = clazz(AbstractSelect2, {
|
1373 |
-
|
1374 |
-
// single
|
1375 |
-
|
1376 |
-
createContainer: function () {
|
1377 |
-
var container = $("<div></div>", {
|
1378 |
-
"class": "select2-container"
|
1379 |
-
}).html([
|
1380 |
-
" <a href='#' onclick='return false;' class='select2-choice'>",
|
1381 |
-
" <span></span><abbr class='select2-search-choice-close' style='display:none;'></abbr>",
|
1382 |
-
" <div><b></b></div>" ,
|
1383 |
-
"</a>",
|
1384 |
-
" <div class='select2-drop select2-offscreen'>" ,
|
1385 |
-
" <div class='select2-search'>" ,
|
1386 |
-
" <input type='text' autocomplete='off' class='select2-input'/>" ,
|
1387 |
-
" </div>" ,
|
1388 |
-
" <ul class='select2-results'>" ,
|
1389 |
-
" </ul>" ,
|
1390 |
-
"</div>"].join(""));
|
1391 |
-
return container;
|
1392 |
-
},
|
1393 |
-
|
1394 |
-
// single
|
1395 |
-
opening: function () {
|
1396 |
-
this.search.show();
|
1397 |
-
this.parent.opening.apply(this, arguments);
|
1398 |
-
this.dropdown.removeClass("select2-offscreen");
|
1399 |
-
},
|
1400 |
-
|
1401 |
-
// single
|
1402 |
-
close: function () {
|
1403 |
-
if (!this.opened()) return;
|
1404 |
-
this.parent.close.apply(this, arguments);
|
1405 |
-
this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show();
|
1406 |
-
},
|
1407 |
-
|
1408 |
-
// single
|
1409 |
-
focus: function () {
|
1410 |
-
this.close();
|
1411 |
-
this.selection.focus();
|
1412 |
-
},
|
1413 |
-
|
1414 |
-
// single
|
1415 |
-
isFocused: function () {
|
1416 |
-
return this.selection[0] === document.activeElement;
|
1417 |
-
},
|
1418 |
-
|
1419 |
-
// single
|
1420 |
-
cancel: function () {
|
1421 |
-
this.parent.cancel.apply(this, arguments);
|
1422 |
-
this.selection.focus();
|
1423 |
-
},
|
1424 |
-
|
1425 |
-
// single
|
1426 |
-
initContainer: function () {
|
1427 |
-
|
1428 |
-
var selection,
|
1429 |
-
container = this.container,
|
1430 |
-
dropdown = this.dropdown,
|
1431 |
-
clickingInside = false;
|
1432 |
-
|
1433 |
-
this.selection = selection = container.find(".select2-choice");
|
1434 |
-
|
1435 |
-
this.search.bind("keydown", this.bind(function (e) {
|
1436 |
-
if (!this.enabled) return;
|
1437 |
-
|
1438 |
-
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
|
1439 |
-
// prevent the page from scrolling
|
1440 |
-
killEvent(e);
|
1441 |
-
return;
|
1442 |
-
}
|
1443 |
-
|
1444 |
-
if (this.opened()) {
|
1445 |
-
switch (e.which) {
|
1446 |
-
case KEY.UP:
|
1447 |
-
case KEY.DOWN:
|
1448 |
-
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
|
1449 |
-
killEvent(e);
|
1450 |
-
return;
|
1451 |
-
case KEY.TAB:
|
1452 |
-
case KEY.ENTER:
|
1453 |
-
this.selectHighlighted();
|
1454 |
-
killEvent(e);
|
1455 |
-
return;
|
1456 |
-
case KEY.ESC:
|
1457 |
-
this.cancel(e);
|
1458 |
-
killEvent(e);
|
1459 |
-
return;
|
1460 |
-
}
|
1461 |
-
} else {
|
1462 |
-
|
1463 |
-
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
|
1464 |
-
return;
|
1465 |
-
}
|
1466 |
-
|
1467 |
-
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
|
1468 |
-
return;
|
1469 |
-
}
|
1470 |
-
|
1471 |
-
this.open();
|
1472 |
-
|
1473 |
-
if (e.which === KEY.ENTER) {
|
1474 |
-
// do not propagate the event otherwise we open, and propagate enter which closes
|
1475 |
-
return;
|
1476 |
-
}
|
1477 |
-
}
|
1478 |
-
}));
|
1479 |
-
|
1480 |
-
this.search.bind("focus", this.bind(function() {
|
1481 |
-
this.selection.attr("tabIndex", "-1");
|
1482 |
-
}));
|
1483 |
-
this.search.bind("blur", this.bind(function() {
|
1484 |
-
if (!this.opened()) this.container.removeClass("select2-container-active");
|
1485 |
-
window.setTimeout(this.bind(function() { this.selection.attr("tabIndex", this.opts.element.attr("tabIndex")); }), 10);
|
1486 |
-
}));
|
1487 |
-
|
1488 |
-
selection.bind("mousedown", this.bind(function (e) {
|
1489 |
-
clickingInside = true;
|
1490 |
-
|
1491 |
-
if (this.opened()) {
|
1492 |
-
this.close();
|
1493 |
-
this.selection.focus();
|
1494 |
-
} else if (this.enabled) {
|
1495 |
-
this.open();
|
1496 |
-
}
|
1497 |
-
|
1498 |
-
clickingInside = false;
|
1499 |
-
}));
|
1500 |
-
|
1501 |
-
dropdown.bind("mousedown", this.bind(function() { this.search.focus(); }));
|
1502 |
-
|
1503 |
-
selection.bind("focus", this.bind(function() {
|
1504 |
-
this.container.addClass("select2-container-active");
|
1505 |
-
// hide the search so the tab key does not focus on it
|
1506 |
-
this.search.attr("tabIndex", "-1");
|
1507 |
-
}));
|
1508 |
-
|
1509 |
-
selection.bind("blur", this.bind(function() {
|
1510 |
-
if (!this.opened()) {
|
1511 |
-
this.container.removeClass("select2-container-active");
|
1512 |
-
}
|
1513 |
-
window.setTimeout(this.bind(function() { this.search.attr("tabIndex", this.opts.element.attr("tabIndex")); }), 10);
|
1514 |
-
}));
|
1515 |
-
|
1516 |
-
selection.bind("keydown", this.bind(function(e) {
|
1517 |
-
if (!this.enabled) return;
|
1518 |
-
|
1519 |
-
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
|
1520 |
-
// prevent the page from scrolling
|
1521 |
-
killEvent(e);
|
1522 |
-
return;
|
1523 |
-
}
|
1524 |
-
|
1525 |
-
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|
1526 |
-
|| e.which === KEY.ESC) {
|
1527 |
-
return;
|
1528 |
-
}
|
1529 |
-
|
1530 |
-
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
|
1531 |
-
return;
|
1532 |
-
}
|
1533 |
-
|
1534 |
-
if (e.which == KEY.DELETE) {
|
1535 |
-
if (this.opts.allowClear) {
|
1536 |
-
this.clear();
|
1537 |
-
}
|
1538 |
-
return;
|
1539 |
-
}
|
1540 |
-
|
1541 |
-
this.open();
|
1542 |
-
|
1543 |
-
if (e.which === KEY.ENTER) {
|
1544 |
-
// do not propagate the event otherwise we open, and propagate enter which closes
|
1545 |
-
killEvent(e);
|
1546 |
-
return;
|
1547 |
-
}
|
1548 |
-
|
1549 |
-
// do not set the search input value for non-alpha-numeric keys
|
1550 |
-
// otherwise pressing down results in a '(' being set in the search field
|
1551 |
-
if (e.which < 48 ) { // '0' == 48
|
1552 |
-
killEvent(e);
|
1553 |
-
return;
|
1554 |
-
}
|
1555 |
-
|
1556 |
-
var keyWritten = String.fromCharCode(e.which).toLowerCase();
|
1557 |
-
|
1558 |
-
if (e.shiftKey) {
|
1559 |
-
keyWritten = keyWritten.toUpperCase();
|
1560 |
-
}
|
1561 |
-
|
1562 |
-
// focus the field before calling val so the cursor ends up after the value instead of before
|
1563 |
-
this.search.focus();
|
1564 |
-
this.search.val(keyWritten);
|
1565 |
-
|
1566 |
-
// prevent event propagation so it doesnt replay on the now focussed search field and result in double key entry
|
1567 |
-
killEvent(e);
|
1568 |
-
}));
|
1569 |
-
|
1570 |
-
selection.delegate("abbr", "mousedown", this.bind(function (e) {
|
1571 |
-
if (!this.enabled) return;
|
1572 |
-
this.clear();
|
1573 |
-
killEvent(e);
|
1574 |
-
this.close();
|
1575 |
-
this.triggerChange();
|
1576 |
-
this.selection.focus();
|
1577 |
-
}));
|
1578 |
-
|
1579 |
-
this.setPlaceholder();
|
1580 |
-
|
1581 |
-
this.search.bind("focus", this.bind(function() {
|
1582 |
-
this.container.addClass("select2-container-active");
|
1583 |
-
}));
|
1584 |
-
},
|
1585 |
-
|
1586 |
-
// single
|
1587 |
-
clear: function() {
|
1588 |
-
this.opts.element.val("");
|
1589 |
-
this.selection.find("span").empty();
|
1590 |
-
this.selection.removeData("select2-data");
|
1591 |
-
this.setPlaceholder();
|
1592 |
-
},
|
1593 |
-
|
1594 |
-
/**
|
1595 |
-
* Sets selection based on source element's value
|
1596 |
-
*/
|
1597 |
-
// single
|
1598 |
-
initSelection: function () {
|
1599 |
-
var selected;
|
1600 |
-
if (this.opts.element.val() === "") {
|
1601 |
-
this.close();
|
1602 |
-
this.setPlaceholder();
|
1603 |
-
} else {
|
1604 |
-
var self = this;
|
1605 |
-
this.opts.initSelection.call(null, this.opts.element, function(selected){
|
1606 |
-
if (selected !== undefined && selected !== null) {
|
1607 |
-
self.updateSelection(selected);
|
1608 |
-
self.close();
|
1609 |
-
self.setPlaceholder();
|
1610 |
-
}
|
1611 |
-
});
|
1612 |
-
}
|
1613 |
-
},
|
1614 |
-
|
1615 |
-
// single
|
1616 |
-
prepareOpts: function () {
|
1617 |
-
var opts = this.parent.prepareOpts.apply(this, arguments);
|
1618 |
-
|
1619 |
-
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
1620 |
-
// install the selection initializer
|
1621 |
-
opts.initSelection = function (element, callback) {
|
1622 |
-
var selected = element.find(":selected");
|
1623 |
-
// a single select box always has a value, no need to null check 'selected'
|
1624 |
-
if ($.isFunction(callback))
|
1625 |
-
callback({id: selected.attr("value"), text: selected.text()});
|
1626 |
-
};
|
1627 |
-
}
|
1628 |
-
|
1629 |
-
return opts;
|
1630 |
-
},
|
1631 |
-
|
1632 |
-
// single
|
1633 |
-
setPlaceholder: function () {
|
1634 |
-
var placeholder = this.getPlaceholder();
|
1635 |
-
|
1636 |
-
if (this.opts.element.val() === "" && placeholder !== undefined) {
|
1637 |
-
|
1638 |
-
// check for a first blank option if attached to a select
|
1639 |
-
if (this.select && this.select.find("option:first").text() !== "") return;
|
1640 |
-
|
1641 |
-
this.selection.find("span").html(this.opts.escapeMarkup(placeholder));
|
1642 |
-
|
1643 |
-
this.selection.addClass("select2-default");
|
1644 |
-
|
1645 |
-
this.selection.find("abbr").hide();
|
1646 |
-
}
|
1647 |
-
},
|
1648 |
-
|
1649 |
-
// single
|
1650 |
-
postprocessResults: function (data, initial) {
|
1651 |
-
var selected = 0, self = this, showSearchInput = true;
|
1652 |
-
|
1653 |
-
// find the selected element in the result list
|
1654 |
-
|
1655 |
-
this.results.find(".select2-result-selectable").each2(function (i, elm) {
|
1656 |
-
if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
|
1657 |
-
selected = i;
|
1658 |
-
return false;
|
1659 |
-
}
|
1660 |
-
});
|
1661 |
-
|
1662 |
-
// and highlight it
|
1663 |
-
|
1664 |
-
this.highlight(selected);
|
1665 |
-
|
1666 |
-
// hide the search box if this is the first we got the results and there are a few of them
|
1667 |
-
|
1668 |
-
if (initial === true) {
|
1669 |
-
showSearchInput = this.showSearchInput = countResults(data.results) >= this.opts.minimumResultsForSearch;
|
1670 |
-
this.dropdown.find(".select2-search")[showSearchInput ? "removeClass" : "addClass"]("select2-search-hidden");
|
1671 |
-
|
1672 |
-
//add "select2-with-searchbox" to the container if search box is shown
|
1673 |
-
$(this.dropdown, this.container)[showSearchInput ? "addClass" : "removeClass"]("select2-with-searchbox");
|
1674 |
-
}
|
1675 |
-
|
1676 |
-
},
|
1677 |
-
|
1678 |
-
// single
|
1679 |
-
onSelect: function (data) {
|
1680 |
-
var old = this.opts.element.val();
|
1681 |
-
|
1682 |
-
this.opts.element.val(this.id(data));
|
1683 |
-
this.updateSelection(data);
|
1684 |
-
this.close();
|
1685 |
-
this.selection.focus();
|
1686 |
-
|
1687 |
-
if (!equal(old, this.id(data))) { this.triggerChange(); }
|
1688 |
-
},
|
1689 |
-
|
1690 |
-
// single
|
1691 |
-
updateSelection: function (data) {
|
1692 |
-
|
1693 |
-
var container=this.selection.find("span"), formatted;
|
1694 |
-
|
1695 |
-
this.selection.data("select2-data", data);
|
1696 |
-
|
1697 |
-
container.empty();
|
1698 |
-
formatted=this.opts.formatSelection(data, container);
|
1699 |
-
if (formatted !== undefined) {
|
1700 |
-
container.append(this.opts.escapeMarkup(formatted));
|
1701 |
-
}
|
1702 |
-
|
1703 |
-
this.selection.removeClass("select2-default");
|
1704 |
-
|
1705 |
-
if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
|
1706 |
-
this.selection.find("abbr").show();
|
1707 |
-
}
|
1708 |
-
},
|
1709 |
-
|
1710 |
-
// single
|
1711 |
-
val: function () {
|
1712 |
-
var val, data = null, self = this;
|
1713 |
-
|
1714 |
-
if (arguments.length === 0) {
|
1715 |
-
return this.opts.element.val();
|
1716 |
-
}
|
1717 |
-
|
1718 |
-
val = arguments[0];
|
1719 |
-
|
1720 |
-
if (this.select) {
|
1721 |
-
this.select
|
1722 |
-
.val(val)
|
1723 |
-
.find(":selected").each2(function (i, elm) {
|
1724 |
-
data = {id: elm.attr("value"), text: elm.text()};
|
1725 |
-
return false;
|
1726 |
-
});
|
1727 |
-
this.updateSelection(data);
|
1728 |
-
this.setPlaceholder();
|
1729 |
-
} else {
|
1730 |
-
if (this.opts.initSelection === undefined) {
|
1731 |
-
throw new Error("cannot call val() if initSelection() is not defined");
|
1732 |
-
}
|
1733 |
-
// val is an id. !val is true for [undefined,null,'']
|
1734 |
-
if (!val) {
|
1735 |
-
this.clear();
|
1736 |
-
return;
|
1737 |
-
}
|
1738 |
-
this.opts.element.val(val);
|
1739 |
-
this.opts.initSelection(this.opts.element, function(data){
|
1740 |
-
self.opts.element.val(!data ? "" : self.id(data));
|
1741 |
-
self.updateSelection(data);
|
1742 |
-
self.setPlaceholder();
|
1743 |
-
});
|
1744 |
-
}
|
1745 |
-
},
|
1746 |
-
|
1747 |
-
// single
|
1748 |
-
clearSearch: function () {
|
1749 |
-
this.search.val("");
|
1750 |
-
},
|
1751 |
-
|
1752 |
-
// single
|
1753 |
-
data: function(value) {
|
1754 |
-
var data;
|
1755 |
-
|
1756 |
-
if (arguments.length === 0) {
|
1757 |
-
data = this.selection.data("select2-data");
|
1758 |
-
if (data == undefined) data = null;
|
1759 |
-
return data;
|
1760 |
-
} else {
|
1761 |
-
if (!value || value === "") {
|
1762 |
-
this.clear();
|
1763 |
-
} else {
|
1764 |
-
this.opts.element.val(!value ? "" : this.id(value));
|
1765 |
-
this.updateSelection(value);
|
1766 |
-
}
|
1767 |
-
}
|
1768 |
-
}
|
1769 |
-
});
|
1770 |
-
|
1771 |
-
MultiSelect2 = clazz(AbstractSelect2, {
|
1772 |
-
|
1773 |
-
// multi
|
1774 |
-
createContainer: function () {
|
1775 |
-
var container = $("<div></div>", {
|
1776 |
-
"class": "select2-container select2-container-multi"
|
1777 |
-
}).html([
|
1778 |
-
" <ul class='select2-choices'>",
|
1779 |
-
//"<li class='select2-search-choice'><span>California</span><a href="javascript:void(0)" class="select2-search-choice-close"></a></li>" ,
|
1780 |
-
" <li class='select2-search-field'>" ,
|
1781 |
-
" <input type='text' autocomplete='off' class='select2-input'>" ,
|
1782 |
-
" </li>" ,
|
1783 |
-
"</ul>" ,
|
1784 |
-
"<div class='select2-drop select2-drop-multi' style='display:none;'>" ,
|
1785 |
-
" <ul class='select2-results'>" ,
|
1786 |
-
" </ul>" ,
|
1787 |
-
"</div>"].join(""));
|
1788 |
-
return container;
|
1789 |
-
},
|
1790 |
-
|
1791 |
-
// multi
|
1792 |
-
prepareOpts: function () {
|
1793 |
-
var opts = this.parent.prepareOpts.apply(this, arguments);
|
1794 |
-
|
1795 |
-
// TODO validate placeholder is a string if specified
|
1796 |
-
|
1797 |
-
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
1798 |
-
// install sthe selection initializer
|
1799 |
-
opts.initSelection = function (element,callback) {
|
1800 |
-
|
1801 |
-
var data = [];
|
1802 |
-
element.find(":selected").each2(function (i, elm) {
|
1803 |
-
data.push({id: elm.attr("value"), text: elm.text()});
|
1804 |
-
});
|
1805 |
-
|
1806 |
-
if ($.isFunction(callback))
|
1807 |
-
callback(data);
|
1808 |
-
};
|
1809 |
-
}
|
1810 |
-
|
1811 |
-
return opts;
|
1812 |
-
},
|
1813 |
-
|
1814 |
-
// multi
|
1815 |
-
initContainer: function () {
|
1816 |
-
|
1817 |
-
var selector = ".select2-choices", selection;
|
1818 |
-
|
1819 |
-
this.searchContainer = this.container.find(".select2-search-field");
|
1820 |
-
this.selection = selection = this.container.find(selector);
|
1821 |
-
|
1822 |
-
this.search.bind("keydown", this.bind(function (e) {
|
1823 |
-
if (!this.enabled) return;
|
1824 |
-
|
1825 |
-
if (e.which === KEY.BACKSPACE && this.search.val() === "") {
|
1826 |
-
this.close();
|
1827 |
-
|
1828 |
-
var choices,
|
1829 |
-
selected = selection.find(".select2-search-choice-focus");
|
1830 |
-
if (selected.length > 0) {
|
1831 |
-
this.unselect(selected.first());
|
1832 |
-
this.search.width(10);
|
1833 |
-
killEvent(e);
|
1834 |
-
return;
|
1835 |
-
}
|
1836 |
-
|
1837 |
-
choices = selection.find(".select2-search-choice");
|
1838 |
-
if (choices.length > 0) {
|
1839 |
-
choices.last().addClass("select2-search-choice-focus");
|
1840 |
-
}
|
1841 |
-
} else {
|
1842 |
-
selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
1843 |
-
}
|
1844 |
-
|
1845 |
-
if (this.opened()) {
|
1846 |
-
switch (e.which) {
|
1847 |
-
case KEY.UP:
|
1848 |
-
case KEY.DOWN:
|
1849 |
-
this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
|
1850 |
-
killEvent(e);
|
1851 |
-
return;
|
1852 |
-
case KEY.ENTER:
|
1853 |
-
case KEY.TAB:
|
1854 |
-
this.selectHighlighted();
|
1855 |
-
killEvent(e);
|
1856 |
-
return;
|
1857 |
-
case KEY.ESC:
|
1858 |
-
this.cancel(e);
|
1859 |
-
killEvent(e);
|
1860 |
-
return;
|
1861 |
-
}
|
1862 |
-
}
|
1863 |
-
|
1864 |
-
if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
|
1865 |
-
|| e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
|
1866 |
-
return;
|
1867 |
-
}
|
1868 |
-
|
1869 |
-
if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
|
1870 |
-
return;
|
1871 |
-
}
|
1872 |
-
|
1873 |
-
this.open();
|
1874 |
-
|
1875 |
-
if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
|
1876 |
-
// prevent the page from scrolling
|
1877 |
-
killEvent(e);
|
1878 |
-
}
|
1879 |
-
}));
|
1880 |
-
|
1881 |
-
this.search.bind("keyup", this.bind(this.resizeSearch));
|
1882 |
-
|
1883 |
-
this.search.bind("blur", this.bind(function(e) {
|
1884 |
-
this.container.removeClass("select2-container-active");
|
1885 |
-
this.search.removeClass("select2-focused");
|
1886 |
-
this.clearSearch();
|
1887 |
-
e.stopImmediatePropagation();
|
1888 |
-
}));
|
1889 |
-
|
1890 |
-
this.container.delegate(selector, "mousedown", this.bind(function (e) {
|
1891 |
-
if (!this.enabled) return;
|
1892 |
-
if ($(e.target).closest(".select2-search-choice").length > 0) {
|
1893 |
-
// clicked inside a select2 search choice, do not open
|
1894 |
-
return;
|
1895 |
-
}
|
1896 |
-
this.clearPlaceholder();
|
1897 |
-
this.open();
|
1898 |
-
this.focusSearch();
|
1899 |
-
e.preventDefault();
|
1900 |
-
}));
|
1901 |
-
|
1902 |
-
this.container.delegate(selector, "focus", this.bind(function () {
|
1903 |
-
if (!this.enabled) return;
|
1904 |
-
this.container.addClass("select2-container-active");
|
1905 |
-
this.dropdown.addClass("select2-drop-active");
|
1906 |
-
this.clearPlaceholder();
|
1907 |
-
}));
|
1908 |
-
|
1909 |
-
// set the placeholder if necessary
|
1910 |
-
this.clearSearch();
|
1911 |
-
},
|
1912 |
-
|
1913 |
-
// multi
|
1914 |
-
enable: function() {
|
1915 |
-
if (this.enabled) return;
|
1916 |
-
|
1917 |
-
this.parent.enable.apply(this, arguments);
|
1918 |
-
|
1919 |
-
this.search.removeAttr("disabled");
|
1920 |
-
},
|
1921 |
-
|
1922 |
-
// multi
|
1923 |
-
disable: function() {
|
1924 |
-
if (!this.enabled) return;
|
1925 |
-
|
1926 |
-
this.parent.disable.apply(this, arguments);
|
1927 |
-
|
1928 |
-
this.search.attr("disabled", true);
|
1929 |
-
},
|
1930 |
-
|
1931 |
-
// multi
|
1932 |
-
initSelection: function () {
|
1933 |
-
var data;
|
1934 |
-
if (this.opts.element.val() === "") {
|
1935 |
-
this.updateSelection([]);
|
1936 |
-
this.close();
|
1937 |
-
// set the placeholder if necessary
|
1938 |
-
this.clearSearch();
|
1939 |
-
}
|
1940 |
-
if (this.select || this.opts.element.val() !== "") {
|
1941 |
-
var self = this;
|
1942 |
-
this.opts.initSelection.call(null, this.opts.element, function(data){
|
1943 |
-
if (data !== undefined && data !== null) {
|
1944 |
-
self.updateSelection(data);
|
1945 |
-
self.close();
|
1946 |
-
// set the placeholder if necessary
|
1947 |
-
self.clearSearch();
|
1948 |
-
}
|
1949 |
-
});
|
1950 |
-
}
|
1951 |
-
},
|
1952 |
-
|
1953 |
-
// multi
|
1954 |
-
clearSearch: function () {
|
1955 |
-
var placeholder = this.getPlaceholder();
|
1956 |
-
|
1957 |
-
if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
|
1958 |
-
this.search.val(placeholder).addClass("select2-default");
|
1959 |
-
// stretch the search box to full width of the container so as much of the placeholder is visible as possible
|
1960 |
-
this.resizeSearch();
|
1961 |
-
} else {
|
1962 |
-
// we set this to " " instead of "" and later clear it on focus() because there is a firefox bug
|
1963 |
-
// that does not properly render the caret when the field starts out blank
|
1964 |
-
this.search.val(" ").width(10);
|
1965 |
-
}
|
1966 |
-
},
|
1967 |
-
|
1968 |
-
// multi
|
1969 |
-
clearPlaceholder: function () {
|
1970 |
-
if (this.search.hasClass("select2-default")) {
|
1971 |
-
this.search.val("").removeClass("select2-default");
|
1972 |
-
} else {
|
1973 |
-
// work around for the space character we set to avoid firefox caret bug
|
1974 |
-
if (this.search.val() === " ") this.search.val("");
|
1975 |
-
}
|
1976 |
-
},
|
1977 |
-
|
1978 |
-
// multi
|
1979 |
-
opening: function () {
|
1980 |
-
this.parent.opening.apply(this, arguments);
|
1981 |
-
|
1982 |
-
this.clearPlaceholder();
|
1983 |
-
this.resizeSearch();
|
1984 |
-
this.focusSearch();
|
1985 |
-
},
|
1986 |
-
|
1987 |
-
// multi
|
1988 |
-
close: function () {
|
1989 |
-
if (!this.opened()) return;
|
1990 |
-
this.parent.close.apply(this, arguments);
|
1991 |
-
},
|
1992 |
-
|
1993 |
-
// multi
|
1994 |
-
focus: function () {
|
1995 |
-
this.close();
|
1996 |
-
this.search.focus();
|
1997 |
-
},
|
1998 |
-
|
1999 |
-
// multi
|
2000 |
-
isFocused: function () {
|
2001 |
-
return this.search.hasClass("select2-focused");
|
2002 |
-
},
|
2003 |
-
|
2004 |
-
// multi
|
2005 |
-
updateSelection: function (data) {
|
2006 |
-
var ids = [], filtered = [], self = this;
|
2007 |
-
|
2008 |
-
// filter out duplicates
|
2009 |
-
$(data).each(function () {
|
2010 |
-
if (indexOf(self.id(this), ids) < 0) {
|
2011 |
-
ids.push(self.id(this));
|
2012 |
-
filtered.push(this);
|
2013 |
-
}
|
2014 |
-
});
|
2015 |
-
data = filtered;
|
2016 |
-
|
2017 |
-
this.selection.find(".select2-search-choice").remove();
|
2018 |
-
$(data).each(function () {
|
2019 |
-
self.addSelectedChoice(this);
|
2020 |
-
});
|
2021 |
-
self.postprocessResults();
|
2022 |
-
},
|
2023 |
-
|
2024 |
-
tokenize: function() {
|
2025 |
-
var input = this.search.val();
|
2026 |
-
input = this.opts.tokenizer(input, this.data(), this.bind(this.onSelect), this.opts);
|
2027 |
-
if (input != null && input != undefined) {
|
2028 |
-
this.search.val(input);
|
2029 |
-
if (input.length > 0) {
|
2030 |
-
this.open();
|
2031 |
-
}
|
2032 |
-
}
|
2033 |
-
|
2034 |
-
},
|
2035 |
-
|
2036 |
-
// multi
|
2037 |
-
onSelect: function (data) {
|
2038 |
-
this.addSelectedChoice(data);
|
2039 |
-
if (this.select) { this.postprocessResults(); }
|
2040 |
-
|
2041 |
-
if (this.opts.closeOnSelect) {
|
2042 |
-
this.close();
|
2043 |
-
this.search.width(10);
|
2044 |
-
} else {
|
2045 |
-
if (this.countSelectableResults()>0) {
|
2046 |
-
this.search.width(10);
|
2047 |
-
this.resizeSearch();
|
2048 |
-
this.positionDropdown();
|
2049 |
-
} else {
|
2050 |
-
// if nothing left to select close
|
2051 |
-
this.close();
|
2052 |
-
}
|
2053 |
-
}
|
2054 |
-
|
2055 |
-
// since its not possible to select an element that has already been
|
2056 |
-
// added we do not need to check if this is a new element before firing change
|
2057 |
-
this.triggerChange({ added: data });
|
2058 |
-
|
2059 |
-
this.focusSearch();
|
2060 |
-
},
|
2061 |
-
|
2062 |
-
// multi
|
2063 |
-
cancel: function () {
|
2064 |
-
this.close();
|
2065 |
-
this.focusSearch();
|
2066 |
-
},
|
2067 |
-
|
2068 |
-
// multi
|
2069 |
-
addSelectedChoice: function (data) {
|
2070 |
-
var choice=$(
|
2071 |
-
"<li class='select2-search-choice'>" +
|
2072 |
-
" <div></div>" +
|
2073 |
-
" <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a>" +
|
2074 |
-
"</li>"),
|
2075 |
-
id = this.id(data),
|
2076 |
-
val = this.getVal(),
|
2077 |
-
formatted;
|
2078 |
-
|
2079 |
-
formatted=this.opts.formatSelection(data, choice);
|
2080 |
-
choice.find("div").replaceWith("<div>"+this.opts.escapeMarkup(formatted)+"</div>");
|
2081 |
-
choice.find(".select2-search-choice-close")
|
2082 |
-
.bind("mousedown", killEvent)
|
2083 |
-
.bind("click dblclick", this.bind(function (e) {
|
2084 |
-
if (!this.enabled) return;
|
2085 |
-
|
2086 |
-
$(e.target).closest(".select2-search-choice").fadeOut('fast', this.bind(function(){
|
2087 |
-
this.unselect($(e.target));
|
2088 |
-
this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
|
2089 |
-
this.close();
|
2090 |
-
this.focusSearch();
|
2091 |
-
})).dequeue();
|
2092 |
-
killEvent(e);
|
2093 |
-
})).bind("focus", this.bind(function () {
|
2094 |
-
if (!this.enabled) return;
|
2095 |
-
this.container.addClass("select2-container-active");
|
2096 |
-
this.dropdown.addClass("select2-drop-active");
|
2097 |
-
}));
|
2098 |
-
|
2099 |
-
choice.data("select2-data", data);
|
2100 |
-
choice.insertBefore(this.searchContainer);
|
2101 |
-
|
2102 |
-
val.push(id);
|
2103 |
-
this.setVal(val);
|
2104 |
-
},
|
2105 |
-
|
2106 |
-
// multi
|
2107 |
-
unselect: function (selected) {
|
2108 |
-
var val = this.getVal(),
|
2109 |
-
data,
|
2110 |
-
index;
|
2111 |
-
|
2112 |
-
selected = selected.closest(".select2-search-choice");
|
2113 |
-
|
2114 |
-
if (selected.length === 0) {
|
2115 |
-
throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
|
2116 |
-
}
|
2117 |
-
|
2118 |
-
data = selected.data("select2-data");
|
2119 |
-
|
2120 |
-
index = indexOf(this.id(data), val);
|
2121 |
-
|
2122 |
-
if (index >= 0) {
|
2123 |
-
val.splice(index, 1);
|
2124 |
-
this.setVal(val);
|
2125 |
-
if (this.select) this.postprocessResults();
|
2126 |
-
}
|
2127 |
-
selected.remove();
|
2128 |
-
this.triggerChange({ removed: data });
|
2129 |
-
},
|
2130 |
-
|
2131 |
-
// multi
|
2132 |
-
postprocessResults: function () {
|
2133 |
-
var val = this.getVal(),
|
2134 |
-
choices = this.results.find(".select2-result-selectable"),
|
2135 |
-
compound = this.results.find(".select2-result-with-children"),
|
2136 |
-
self = this;
|
2137 |
-
|
2138 |
-
choices.each2(function (i, choice) {
|
2139 |
-
var id = self.id(choice.data("select2-data"));
|
2140 |
-
if (indexOf(id, val) >= 0) {
|
2141 |
-
choice.addClass("select2-disabled").removeClass("select2-result-selectable");
|
2142 |
-
} else {
|
2143 |
-
choice.removeClass("select2-disabled").addClass("select2-result-selectable");
|
2144 |
-
}
|
2145 |
-
});
|
2146 |
-
|
2147 |
-
compound.each2(function(i, e) {
|
2148 |
-
if (e.find(".select2-result-selectable").length==0) {
|
2149 |
-
e.addClass("select2-disabled");
|
2150 |
-
} else {
|
2151 |
-
e.removeClass("select2-disabled");
|
2152 |
-
}
|
2153 |
-
});
|
2154 |
-
|
2155 |
-
choices.each2(function (i, choice) {
|
2156 |
-
if (!choice.hasClass("select2-disabled") && choice.hasClass("select2-result-selectable")) {
|
2157 |
-
self.highlight(0);
|
2158 |
-
return false;
|
2159 |
-
}
|
2160 |
-
});
|
2161 |
-
|
2162 |
-
},
|
2163 |
-
|
2164 |
-
// multi
|
2165 |
-
resizeSearch: function () {
|
2166 |
-
|
2167 |
-
var minimumWidth, left, maxWidth, containerLeft, searchWidth,
|
2168 |
-
sideBorderPadding = getSideBorderPadding(this.search);
|
2169 |
-
|
2170 |
-
minimumWidth = measureTextWidth(this.search) + 10;
|
2171 |
-
|
2172 |
-
left = this.search.offset().left;
|
2173 |
-
|
2174 |
-
maxWidth = this.selection.width();
|
2175 |
-
containerLeft = this.selection.offset().left;
|
2176 |
-
|
2177 |
-
searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
|
2178 |
-
if (searchWidth < minimumWidth) {
|
2179 |
-
searchWidth = maxWidth - sideBorderPadding;
|
2180 |
-
}
|
2181 |
-
|
2182 |
-
if (searchWidth < 40) {
|
2183 |
-
searchWidth = maxWidth - sideBorderPadding;
|
2184 |
-
}
|
2185 |
-
this.search.width(searchWidth);
|
2186 |
-
},
|
2187 |
-
|
2188 |
-
// multi
|
2189 |
-
getVal: function () {
|
2190 |
-
var val;
|
2191 |
-
if (this.select) {
|
2192 |
-
val = this.select.val();
|
2193 |
-
return val === null ? [] : val;
|
2194 |
-
} else {
|
2195 |
-
val = this.opts.element.val();
|
2196 |
-
return splitVal(val, this.opts.separator);
|
2197 |
-
}
|
2198 |
-
},
|
2199 |
-
|
2200 |
-
// multi
|
2201 |
-
setVal: function (val) {
|
2202 |
-
var unique;
|
2203 |
-
if (this.select) {
|
2204 |
-
this.select.val(val);
|
2205 |
-
} else {
|
2206 |
-
unique = [];
|
2207 |
-
// filter out duplicates
|
2208 |
-
$(val).each(function () {
|
2209 |
-
if (indexOf(this, unique) < 0) unique.push(this);
|
2210 |
-
});
|
2211 |
-
this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
|
2212 |
-
}
|
2213 |
-
},
|
2214 |
-
|
2215 |
-
// multi
|
2216 |
-
val: function () {
|
2217 |
-
var val, data = [], self=this;
|
2218 |
-
|
2219 |
-
if (arguments.length === 0) {
|
2220 |
-
return this.getVal();
|
2221 |
-
}
|
2222 |
-
|
2223 |
-
val = arguments[0];
|
2224 |
-
|
2225 |
-
if (!val) {
|
2226 |
-
this.opts.element.val("");
|
2227 |
-
this.updateSelection([]);
|
2228 |
-
this.clearSearch();
|
2229 |
-
return;
|
2230 |
-
}
|
2231 |
-
|
2232 |
-
// val is a list of ids
|
2233 |
-
this.setVal(val);
|
2234 |
-
|
2235 |
-
if (this.select) {
|
2236 |
-
this.select.find(":selected").each(function () {
|
2237 |
-
data.push({id: $(this).attr("value"), text: $(this).text()});
|
2238 |
-
});
|
2239 |
-
this.updateSelection(data);
|
2240 |
-
} else {
|
2241 |
-
if (this.opts.initSelection === undefined) {
|
2242 |
-
throw new Error("val() cannot be called if initSelection() is not defined")
|
2243 |
-
}
|
2244 |
-
|
2245 |
-
this.opts.initSelection(this.opts.element, function(data){
|
2246 |
-
var ids=$(data).map(self.id);
|
2247 |
-
self.setVal(ids);
|
2248 |
-
self.updateSelection(data);
|
2249 |
-
self.clearSearch();
|
2250 |
-
});
|
2251 |
-
}
|
2252 |
-
this.clearSearch();
|
2253 |
-
},
|
2254 |
-
|
2255 |
-
// multi
|
2256 |
-
onSortStart: function() {
|
2257 |
-
if (this.select) {
|
2258 |
-
throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
|
2259 |
-
}
|
2260 |
-
|
2261 |
-
// collapse search field into 0 width so its container can be collapsed as well
|
2262 |
-
this.search.width(0);
|
2263 |
-
// hide the container
|
2264 |
-
this.searchContainer.hide();
|
2265 |
-
},
|
2266 |
-
|
2267 |
-
// multi
|
2268 |
-
onSortEnd:function() {
|
2269 |
-
|
2270 |
-
var val=[], self=this;
|
2271 |
-
|
2272 |
-
// show search and move it to the end of the list
|
2273 |
-
this.searchContainer.show();
|
2274 |
-
// make sure the search container is the last item in the list
|
2275 |
-
this.searchContainer.appendTo(this.searchContainer.parent());
|
2276 |
-
// since we collapsed the width in dragStarted, we resize it here
|
2277 |
-
this.resizeSearch();
|
2278 |
-
|
2279 |
-
// update selection
|
2280 |
-
|
2281 |
-
this.selection.find(".select2-search-choice").each(function() {
|
2282 |
-
val.push(self.opts.id($(this).data("select2-data")));
|
2283 |
-
});
|
2284 |
-
this.setVal(val);
|
2285 |
-
this.triggerChange();
|
2286 |
-
},
|
2287 |
-
|
2288 |
-
// multi
|
2289 |
-
data: function(values) {
|
2290 |
-
var self=this, ids;
|
2291 |
-
if (arguments.length === 0) {
|
2292 |
-
return this.selection
|
2293 |
-
.find(".select2-search-choice")
|
2294 |
-
.map(function() { return $(this).data("select2-data"); })
|
2295 |
-
.get();
|
2296 |
-
} else {
|
2297 |
-
if (!values) { values = []; }
|
2298 |
-
ids = $.map(values, function(e) { return self.opts.id(e)});
|
2299 |
-
this.setVal(ids);
|
2300 |
-
this.updateSelection(values);
|
2301 |
-
this.clearSearch();
|
2302 |
-
}
|
2303 |
-
}
|
2304 |
-
});
|
2305 |
-
|
2306 |
-
$.fn.select2 = function () {
|
2307 |
-
|
2308 |
-
var args = Array.prototype.slice.call(arguments, 0),
|
2309 |
-
opts,
|
2310 |
-
select2,
|
2311 |
-
value, multiple, allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "onSortStart", "onSortEnd", "enable", "disable", "positionDropdown", "data"];
|
2312 |
-
|
2313 |
-
this.each(function () {
|
2314 |
-
if (args.length === 0 || typeof(args[0]) === "object") {
|
2315 |
-
opts = args.length === 0 ? {} : $.extend({}, args[0]);
|
2316 |
-
opts.element = $(this);
|
2317 |
-
|
2318 |
-
if (opts.element.get(0).tagName.toLowerCase() === "select") {
|
2319 |
-
multiple = opts.element.attr("multiple");
|
2320 |
-
} else {
|
2321 |
-
multiple = opts.multiple || false;
|
2322 |
-
if ("tags" in opts) {opts.multiple = multiple = true;}
|
2323 |
-
}
|
2324 |
-
|
2325 |
-
select2 = multiple ? new MultiSelect2() : new SingleSelect2();
|
2326 |
-
select2.init(opts);
|
2327 |
-
} else if (typeof(args[0]) === "string") {
|
2328 |
-
|
2329 |
-
if (indexOf(args[0], allowedMethods) < 0) {
|
2330 |
-
throw "Unknown method: " + args[0];
|
2331 |
-
}
|
2332 |
-
|
2333 |
-
value = undefined;
|
2334 |
-
select2 = $(this).data("select2");
|
2335 |
-
if (select2 === undefined) return;
|
2336 |
-
if (args[0] === "container") {
|
2337 |
-
value=select2.container;
|
2338 |
-
} else {
|
2339 |
-
value = select2[args[0]].apply(select2, args.slice(1));
|
2340 |
-
}
|
2341 |
-
if (value !== undefined) {return false;}
|
2342 |
-
} else {
|
2343 |
-
throw "Invalid arguments to select2 plugin: " + args;
|
2344 |
-
}
|
2345 |
-
});
|
2346 |
-
return (value === undefined) ? this : value;
|
2347 |
-
};
|
2348 |
-
|
2349 |
-
// plugin defaults, accessible to users
|
2350 |
-
$.fn.select2.defaults = {
|
2351 |
-
width: "copy",
|
2352 |
-
closeOnSelect: true,
|
2353 |
-
openOnEnter: true,
|
2354 |
-
containerCss: {},
|
2355 |
-
dropdownCss: {},
|
2356 |
-
containerCssClass: "",
|
2357 |
-
dropdownCssClass: "",
|
2358 |
-
formatResult: function(result, container, query) {
|
2359 |
-
var markup=[];
|
2360 |
-
markMatch(result.text, query.term, markup);
|
2361 |
-
return markup.join("");
|
2362 |
-
},
|
2363 |
-
formatSelection: function (data, container) {
|
2364 |
-
return data ? data.text : undefined;
|
2365 |
-
},
|
2366 |
-
formatResultCssClass: function(data) {return undefined;},
|
2367 |
-
formatNoMatches: function () { return "No matches found"; },
|
2368 |
-
formatInputTooShort: function (input, min) { return "Please enter " + (min - input.length) + " more characters"; },
|
2369 |
-
formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
|
2370 |
-
formatLoadMore: function (pageNumber) { return "Loading more results..."; },
|
2371 |
-
formatSearching: function () { return "Searching..."; },
|
2372 |
-
minimumResultsForSearch: 0,
|
2373 |
-
minimumInputLength: 0,
|
2374 |
-
maximumSelectionSize: 0,
|
2375 |
-
id: function (e) { return e.id; },
|
2376 |
-
matcher: function(term, text) {
|
2377 |
-
return text.toUpperCase().indexOf(term.toUpperCase()) >= 0;
|
2378 |
-
},
|
2379 |
-
separator: ",",
|
2380 |
-
tokenSeparators: [],
|
2381 |
-
tokenizer: defaultTokenizer,
|
2382 |
-
escapeMarkup: function (markup) {
|
2383 |
-
if (markup && typeof(markup) === "string") {
|
2384 |
-
return markup.replace(/&/g, "&");
|
2385 |
-
}
|
2386 |
-
return markup;
|
2387 |
-
},
|
2388 |
-
blurOnChange: false
|
2389 |
-
};
|
2390 |
-
|
2391 |
-
// exports
|
2392 |
-
window.Select2 = {
|
2393 |
-
query: {
|
2394 |
-
ajax: ajax,
|
2395 |
-
local: local,
|
2396 |
-
tags: tags
|
2397 |
-
}, util: {
|
2398 |
-
debounce: debounce,
|
2399 |
-
markMatch: markMatch
|
2400 |
-
}, "class": {
|
2401 |
-
"abstract": AbstractSelect2,
|
2402 |
-
"single": SingleSelect2,
|
2403 |
-
"multi": MultiSelect2
|
2404 |
-
}
|
2405 |
-
};
|
2406 |
-
|
2407 |
-
}(jQuery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/select2/select2.min.js
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
Copyright 2012 Igor Vaynberg
|
3 |
-
|
4 |
-
Version: 3.2 Timestamp: Mon Sep 10 10:38:04 PDT 2012
|
5 |
-
|
6 |
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in
|
7 |
-
compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
|
8 |
-
|
9 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
|
11 |
-
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
12 |
-
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
See the License for the specific language governing permissions and limitations under the License.
|
14 |
-
*/
|
15 |
-
(function(e){"undefined"==typeof e.fn.each2&&e.fn.extend({each2:function(g){for(var i=e([0]),m=-1,s=this.length;++m<s&&(i.context=i[0]=this[m])&&!1!==g.call(i[0],m,i););return this}})})(jQuery);
|
16 |
-
(function(e,g){function i(a,b){var c=0,d=b.length,j;if("undefined"===typeof a)return-1;if(a.constructor===String)for(;c<d;c+=1){if(0===a.localeCompare(b[c]))return c}else for(;c<d;c+=1)if(j=b[c],j.constructor===String){if(0===j.localeCompare(a))return c}else if(j===a)return c;return-1}function m(a,b){return a===b?!0:a===g||b===g||null===a||null===b?!1:a.constructor===String?0===a.localeCompare(b):b.constructor===String?0===b.localeCompare(a):!1}function s(a,b){var c,d,j;if(null===a||1>a.length)return[];
|
17 |
-
c=a.split(b);d=0;for(j=c.length;d<j;d+=1)c[d]=e.trim(c[d]);return c}function A(a,b,c){var c=c||g,d;return function(){var j=arguments;window.clearTimeout(d);d=window.setTimeout(function(){b.apply(c,j)},a)}}function l(a){a.preventDefault();a.stopPropagation()}function B(a,b,c){var d=a.toUpperCase().indexOf(b.toUpperCase()),b=b.length;0>d?c.push(a):(c.push(a.substring(0,d)),c.push("<span class='select2-match'>"),c.push(a.substring(d,d+b)),c.push("</span>"),c.push(a.substring(d+b,a.length)))}function C(a){var b,
|
18 |
-
c=0,d=null,j=a.quietMillis||100;return function(h){window.clearTimeout(b);b=window.setTimeout(function(){var b=c+=1,j=a.data,n=a.transport||e.ajax,f=a.traditional||!1,g=a.type||"GET",j=j.call(this,h.term,h.page,h.context);null!==d&&d.abort();d=n.call(null,{url:a.url,dataType:a.dataType,data:j,type:g,traditional:f,success:function(d){b<c||(d=a.results(d,h.page),h.callback(d))}})},j)}}function D(a){var b=a,c,d=function(a){return""+a.text};e.isArray(b)||(d=b.text,e.isFunction(d)||(c=b.text,d=function(a){return a[c]}),
|
19 |
-
b=b.results);return function(a){var c=a.term,f={results:[]},k;if(c==="")a.callback({results:b});else{k=function(b,f){var g,t,b=b[0];if(b.children){g={};for(t in b)b.hasOwnProperty(t)&&(g[t]=b[t]);g.children=[];e(b.children).each2(function(a,b){k(b,g.children)});g.children.length&&f.push(g)}else a.matcher(c,d(b))&&f.push(b)};e(b).each2(function(a,b){k(b,f.results)});a.callback(f)}}}function E(a){return e.isFunction(a)?a:function(b){var c=b.term,d={results:[]};e(a).each(function(){var a=this.text!==
|
20 |
-
g,e=a?this.text:this;if(""===c||b.matcher(c,e))d.results.push(a?this:{id:this,text:this})});b.callback(d)}}function u(a){if(e.isFunction(a))return!0;if(!a)return!1;throw Error("formatterName must be a function or a falsy value");}function v(a){return e.isFunction(a)?a():a}function F(a){var b=0;e.each(a,function(a,d){d.children?b+=F(d.children):b++});return b}function H(a,b,c,d){var e=a,h=!1,f,k,n,o;if(!d.createSearchChoice||!d.tokenSeparators||1>d.tokenSeparators.length)return g;for(;;){h=-1;k=0;
|
21 |
-
for(n=d.tokenSeparators.length;k<n&&!(o=d.tokenSeparators[k],h=a.indexOf(o),0<=h);k++);if(0>h)break;f=a.substring(0,h);a=a.substring(h+o.length);if(0<f.length&&(f=d.createSearchChoice(f,b),f!==g&&null!==f&&d.id(f)!==g&&null!==d.id(f))){h=!1;k=0;for(n=b.length;k<n;k++)if(m(d.id(f),d.id(b[k]))){h=!0;break}h||c(f)}}if(0!=e.localeCompare(a))return a}function x(a,b){var c=function(){};c.prototype=new a;c.prototype.constructor=c;c.prototype.parent=a.prototype;c.prototype=e.extend(c.prototype,b);return c}
|
22 |
-
if(window.Select2===g){var f,w,y,z,G,q;f={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){a=a.which?a.which:a;switch(a){case f.LEFT:case f.RIGHT:case f.UP:case f.DOWN:return!0}return!1},isControl:function(a){switch(a.which){case f.SHIFT:case f.CTRL:case f.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){a=a.which?a.which:a;return 112<=a&&123>=a}};var I=1;G=function(){return I++};
|
23 |
-
e(document).delegate("body","mousemove",function(a){e.data(document,"select2-lastpos",{x:a.pageX,y:a.pageY})});e(document).ready(function(){e(document).delegate("body","mousedown touchend",function(a){var b=e(a.target).closest("div.select2-container").get(0),c;b?e(document).find("div.select2-container-active").each(function(){this!==b&&e(this).data("select2").blur()}):(b=e(a.target).closest("div.select2-drop").get(0),e(document).find("div.select2-drop-active").each(function(){this!==b&&e(this).data("select2").blur()}));
|
24 |
-
b=e(a.target);c=b.attr("for");"LABEL"===a.target.tagName&&(c&&0<c.length)&&(b=e("#"+c),b=b.data("select2"),b!==g&&(b.focus(),a.preventDefault()))})});w=x(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(a){var b,c;this.opts=a=this.prepareOpts(a);this.id=a.id;a.element.data("select2")!==g&&null!==a.element.data("select2")&&this.destroy();this.enabled=!0;this.container=this.createContainer();this.containerId="s2id_"+(a.element.attr("id")||"autogen"+G());this.containerSelector=
|
25 |
-
"#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1");this.container.attr("id",this.containerId);var d=!1,j;this.body=function(){!1===d&&(j=a.element.closest("body"),d=!0);return j};a.element.attr("class")!==g&&this.container.addClass(a.element.attr("class").replace(/validate\[[\S ]+] ?/,""));this.container.css(v(a.containerCss));this.container.addClass(v(a.containerCssClass));this.opts.element.data("select2",this).hide().before(this.container);this.container.data("select2",
|
26 |
-
this);this.dropdown=this.container.find(".select2-drop");this.dropdown.addClass(v(a.dropdownCssClass));this.dropdown.data("select2",this);this.results=b=this.container.find(".select2-results");this.search=c=this.container.find("input.select2-input");c.attr("tabIndex",this.opts.element.attr("tabIndex"));this.resultsPage=0;this.context=null;this.initContainer();this.initContainerWidth();this.results.bind("mousemove",function(a){var b=e.data(document,"select2-lastpos");(b===g||b.x!==a.pageX||b.y!==a.pageY)&&
|
27 |
-
e(a.target).trigger("mousemove-filtered",a)});this.dropdown.delegate(".select2-results","mousemove-filtered",this.bind(this.highlightUnderEvent));var h=this.results,f=A(80,function(a){h.trigger("scroll-debounced",a)});h.bind("scroll",function(a){0<=i(a.target,h.get())&&f(a)});this.dropdown.delegate(".select2-results","scroll-debounced",this.bind(this.loadMoreIfNeeded));e.fn.mousewheel&&b.mousewheel(function(a,c,d,e){c=b.scrollTop();0<e&&0>=c-e?(b.scrollTop(0),l(a)):0>e&&b.get(0).scrollHeight-b.scrollTop()+
|
28 |
-
e<=b.height()&&(b.scrollTop(b.get(0).scrollHeight-b.height()),l(a))});c.bind("keydown",function(){e.data(c,"keyup-change-value")===g&&e.data(c,"keyup-change-value",c.val())});c.bind("keyup",function(){var a=e.data(c,"keyup-change-value");a!==g&&c.val()!==a&&(e.removeData(c,"keyup-change-value"),c.trigger("keyup-change"))});c.bind("keyup-change",this.bind(this.updateResults));c.bind("focus",function(){c.addClass("select2-focused");" "===c.val()&&c.val("")});c.bind("blur",function(){c.removeClass("select2-focused")});
|
29 |
-
this.dropdown.delegate(".select2-results","mouseup",this.bind(function(a){0<e(a.target).closest(".select2-result-selectable:not(.select2-disabled)").length?(this.highlightUnderEvent(a),this.selectHighlighted(a)):this.focusSearch();l(a)}));this.dropdown.bind("click mouseup mousedown",function(a){a.stopPropagation()});e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource());(a.element.is(":disabled")||a.element.is("[readonly='readonly']"))&&this.disable()},destroy:function(){var a=
|
30 |
-
this.opts.element.data("select2");a!==g&&(a.container.remove(),a.dropdown.remove(),a.opts.element.removeData("select2").unbind(".select2").show())},prepareOpts:function(a){var b,c,d;b=a.element;"select"===b.get(0).tagName.toLowerCase()&&(this.select=c=a.element);c&&e.each("id multiple ajax query createSearchChoice initSelection data tags".split(" "),function(){if(this in a)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.");});a=e.extend({},{populateResults:function(b,
|
31 |
-
c,d){var f,n=this.opts.id,o=this;f=function(b,c,j){var h,l,i,m,r,p,q;h=0;for(l=b.length;h<l;h=h+1){i=b[h];m=n(i)!==g;r=i.children&&i.children.length>0;p=e("<li></li>");p.addClass("select2-results-dept-"+j);p.addClass("select2-result");p.addClass(m?"select2-result-selectable":"select2-result-unselectable");r&&p.addClass("select2-result-with-children");p.addClass(o.opts.formatResultCssClass(i));m=e("<div></div>");m.addClass("select2-result-label");q=a.formatResult(i,m,d);q!==g&&m.html(o.opts.escapeMarkup(q));
|
32 |
-
p.append(m);if(r){r=e("<ul></ul>");r.addClass("select2-result-sub");f(i.children,r,j+1);p.append(r)}p.data("select2-data",i);c.append(p)}};f(c,b,0)}},e.fn.select2.defaults,a);"function"!==typeof a.id&&(d=a.id,a.id=function(a){return a[d]});if(c)a.query=this.bind(function(a){var c={results:[],more:false},d=a.term,f,n,o;o=function(b,c){var e;if(b.is("option"))a.matcher(d,b.text(),b)&&c.push({id:b.attr("value"),text:b.text(),element:b.get(),css:b.attr("class")});else if(b.is("optgroup")){e={text:b.attr("label"),
|
33 |
-
children:[],element:b.get(),css:b.attr("class")};b.children().each2(function(a,b){o(b,e.children)});e.children.length>0&&c.push(e)}};f=b.children();if(this.getPlaceholder()!==g&&f.length>0){n=f[0];e(n).text()===""&&(f=f.not(n))}f.each2(function(a,b){o(b,c.results)});a.callback(c)}),a.id=function(a){return a.id},a.formatResultCssClass=function(a){return a.css};else if(!("query"in a))if("ajax"in a){if((c=a.element.data("ajax-url"))&&0<c.length)a.ajax.url=c;a.query=C(a.ajax)}else"data"in a?a.query=D(a.data):
|
34 |
-
"tags"in a&&(a.query=E(a.tags),a.createSearchChoice=function(a){return{id:a,text:a}},a.initSelection=function(b,c){var d=[];e(s(b.val(),a.separator)).each(function(){var b=this,c=this,j=a.tags;e.isFunction(j)&&(j=j());e(j).each(function(){if(m(this.id,b)){c=this.text;return false}});d.push({id:b,text:c})});c(d)});if("function"!==typeof a.query)throw"query function not defined for Select2 "+a.element.attr("id");return a},monitorSource:function(){this.opts.element.bind("change.select2",this.bind(function(){!0!==
|
35 |
-
this.opts.element.data("select2-change-triggered")&&this.initSelection()}))},triggerChange:function(a){a=a||{};a=e.extend({},a,{type:"change",val:this.val()});this.opts.element.data("select2-change-triggered",!0);this.opts.element.trigger(a);this.opts.element.data("select2-change-triggered",!1);this.opts.element.click();this.opts.blurOnChange&&this.opts.element.blur()},enable:function(){this.enabled||(this.enabled=!0,this.container.removeClass("select2-container-disabled"))},disable:function(){this.enabled&&
|
36 |
-
(this.close(),this.enabled=!1,this.container.addClass("select2-container-disabled"))},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var a=this.container.offset(),b=this.container.outerHeight(),c=this.container.outerWidth(),d=this.dropdown.outerHeight(),j=e(window).scrollTop()+document.documentElement.clientHeight,b=a.top+b,f=a.left,j=b+d<=j,g=a.top-d>=this.body().scrollTop(),k=this.dropdown.hasClass("select2-drop-above"),n;"static"!==this.body().css("position")&&
|
37 |
-
(n=this.body().offset(),b-=n.top,f-=n.left);k?(k=!0,!g&&j&&(k=!1)):(k=!1,!j&&g&&(k=!0));k?(b=a.top-d,this.container.addClass("select2-drop-above"),this.dropdown.addClass("select2-drop-above")):(this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above"));a=e.extend({top:b,left:f,width:c},v(this.opts.dropdownCss));this.dropdown.css(a)},shouldOpen:function(){var a;if(this.opened())return!1;a=e.Event("open");this.opts.element.trigger(a);return!a.isDefaultPrevented()},
|
38 |
-
clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above");this.dropdown.removeClass("select2-drop-above")},open:function(){if(!this.shouldOpen())return!1;window.setTimeout(this.bind(this.opening),1);return!0},opening:function(){var a=this.containerId,b=this.containerSelector,c="scroll."+a,d="resize."+a;this.container.parents().each(function(){e(this).bind(c,function(){var a=e(b);0==a.length&&e(this).unbind(c);a.select2("close")})});e(window).bind(d,function(){var a=
|
39 |
-
e(b);0==a.length&&e(window).unbind(d);a.select2("close")});this.clearDropdownAlignmentPreference();" "===this.search.val()&&this.search.val("");this.container.addClass("select2-dropdown-open").addClass("select2-container-active");this.updateResults(!0);this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body());this.dropdown.show();this.positionDropdown();this.dropdown.addClass("select2-drop-active");this.ensureHighlightVisible();this.focusSearch()},close:function(){if(this.opened()){var a=
|
40 |
-
this;this.container.parents().each(function(){e(this).unbind("scroll."+a.containerId)});e(window).unbind("resize."+this.containerId);this.clearDropdownAlignmentPreference();this.dropdown.hide();this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");this.results.empty();this.clearSearch();this.opts.element.trigger(e.Event("close"))}},clearSearch:function(){},ensureHighlightVisible:function(){var a=this.results,b,c,d,f;c=this.highlight();0>c||(0==c?a.scrollTop(0):
|
41 |
-
(b=a.find(".select2-result-selectable"),d=e(b[c]),f=d.offset().top+d.outerHeight(),c===b.length-1&&(b=a.find("li.select2-more-results"),0<b.length&&(f=b.offset().top+b.outerHeight())),b=a.offset().top+a.outerHeight(),f>b&&a.scrollTop(a.scrollTop()+(f-b)),d=d.offset().top-a.offset().top,0>d&&a.scrollTop(a.scrollTop()+d)))},moveHighlight:function(a){for(var b=this.results.find(".select2-result-selectable"),c=this.highlight();-1<c&&c<b.length;){var c=c+a,d=e(b[c]);if(d.hasClass("select2-result-selectable")&&
|
42 |
-
!d.hasClass("select2-disabled")){this.highlight(c);break}}},highlight:function(a){var b=this.results.find(".select2-result-selectable").not(".select2-disabled");if(0===arguments.length)return i(b.filter(".select2-highlighted")[0],b.get());a>=b.length&&(a=b.length-1);0>a&&(a=0);b.removeClass("select2-highlighted");e(b[a]).addClass("select2-highlighted");this.ensureHighlightVisible()},countSelectableResults:function(){return this.results.find(".select2-result-selectable").not(".select2-disabled").length},
|
43 |
-
highlightUnderEvent:function(a){a=e(a.target).closest(".select2-result-selectable");if(0<a.length&&!a.is(".select2-highlighted")){var b=this.results.find(".select2-result-selectable");this.highlight(b.index(a))}else 0==a.length&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var a=this.results,b=a.find("li.select2-more-results"),c,d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-
|
44 |
-
a.height(),0>=c&&(b.addClass("select2-active"),this.opts.query({term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),!0===c.more?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d)})})))},tokenize:function(){},updateResults:function(a){function b(){f.scrollTop(0);d.removeClass("select2-active");
|
45 |
-
k.positionDropdown()}function c(a){f.html(k.opts.escapeMarkup(a));b()}var d=this.search,f=this.results,h=this.opts,i,k=this;if(!(!0!==a&&(!1===this.showSearchInput||!this.opened()))){d.addClass("select2-active");if(1<=h.maximumSelectionSize&&(i=this.data(),e.isArray(i)&&i.length>=h.maximumSelectionSize&&u(h.formatSelectionTooBig,"formatSelectionTooBig"))){c("<li class='select2-selection-limit'>"+h.formatSelectionTooBig(h.maximumSelectionSize)+"</li>");return}d.val().length<h.minimumInputLength&&u(h.formatInputTooShort,
|
46 |
-
"formatInputTooShort")?c("<li class='select2-no-results'>"+h.formatInputTooShort(d.val(),h.minimumInputLength)+"</li>"):(c("<li class='select2-searching'>"+h.formatSearching()+"</li>"),i=this.tokenize(),i!=g&&null!=i&&d.val(i),this.resultsPage=1,h.query({term:d.val(),page:this.resultsPage,context:null,matcher:h.matcher,callback:this.bind(function(i){var l;this.opened()&&((this.context=i.context===g?null:i.context,this.opts.createSearchChoice&&""!==d.val()&&(l=this.opts.createSearchChoice.call(null,
|
47 |
-
d.val(),i.results),l!==g&&null!==l&&k.id(l)!==g&&null!==k.id(l)&&0===e(i.results).filter(function(){return m(k.id(this),k.id(l))}).length&&i.results.unshift(l)),0===i.results.length&&u(h.formatNoMatches,"formatNoMatches"))?c("<li class='select2-no-results'>"+h.formatNoMatches(d.val())+"</li>"):(f.empty(),k.opts.populateResults.call(this,f,i.results,{term:d.val(),page:this.resultsPage,context:null}),!0===i.more&&u(h.formatLoadMore,"formatLoadMore")&&(f.append("<li class='select2-more-results'>"+k.opts.escapeMarkup(h.formatLoadMore(this.resultsPage))+
|
48 |
-
"</li>"),window.setTimeout(function(){k.loadMoreIfNeeded()},10)),this.postprocessResults(i,a),b()))})}))}},cancel:function(){this.close()},blur:function(){this.close();this.container.removeClass("select2-container-active");this.dropdown.removeClass("select2-drop-active");this.search[0]===document.activeElement&&this.search.blur();this.clearSearch();this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){this.search.show();this.search.focus();
|
49 |
-
window.setTimeout(this.bind(function(){this.search.show();this.search.focus();this.search.val(this.search.val())}),10)},selectHighlighted:function(){var a=this.highlight(),b=this.results.find(".select2-highlighted").not(".select2-disabled"),c=b.closest(".select2-result-selectable").data("select2-data");c&&(b.addClass("select2-disabled"),this.highlight(a),this.onSelect(c))},getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||
|
50 |
-
this.opts.placeholder},initContainerWidth:function(){var a=function(){var a,c,d,f;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth()?"auto":this.opts.element.outerWidth()+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){a=this.opts.element.attr("style");if(a!==g){a=a.split(";");d=0;for(f=a.length;d<f;d+=1)if(c=a[d].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/),null!==c&&1<=c.length)return c[1]}return"resolve"===
|
51 |
-
this.opts.width?(a=this.opts.element.css("width"),0<a.indexOf("%")?a:0===this.opts.element.outerWidth()?"auto":this.opts.element.outerWidth()+"px"):null}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}.call(this);null!==a&&this.container.attr("style","width: "+a)}});y=x(w,{createContainer:function(){return e("<div></div>",{"class":"select2-container"}).html(" <a href='#' onclick='return false;' class='select2-choice'> <span></span><abbr class='select2-search-choice-close' style='display:none;'></abbr> <div><b></b></div></a> <div class='select2-drop select2-offscreen'> <div class='select2-search'> <input type='text' autocomplete='off' class='select2-input'/> </div> <ul class='select2-results'> </ul></div>")},
|
52 |
-
opening:function(){this.search.show();this.parent.opening.apply(this,arguments);this.dropdown.removeClass("select2-offscreen")},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show())},focus:function(){this.close();this.selection.focus()},isFocused:function(){return this.selection[0]===document.activeElement},cancel:function(){this.parent.cancel.apply(this,arguments);this.selection.focus()},
|
53 |
-
initContainer:function(){var a,b=this.dropdown;this.selection=a=this.container.find(".select2-choice");this.search.bind("keydown",this.bind(function(a){if(this.enabled)if(a.which===f.PAGE_UP||a.which===f.PAGE_DOWN)l(a);else if(this.opened())switch(a.which){case f.UP:case f.DOWN:this.moveHighlight(a.which===f.UP?-1:1);l(a);break;case f.TAB:case f.ENTER:this.selectHighlighted();l(a);break;case f.ESC:this.cancel(a),l(a)}else a.which===f.TAB||f.isControl(a)||f.isFunctionKey(a)||a.which===f.ESC||!1===
|
54 |
-
this.opts.openOnEnter&&a.which===f.ENTER||this.open()}));this.search.bind("focus",this.bind(function(){this.selection.attr("tabIndex","-1")}));this.search.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active");window.setTimeout(this.bind(function(){this.selection.attr("tabIndex",this.opts.element.attr("tabIndex"))}),10)}));a.bind("mousedown",this.bind(function(){this.opened()?(this.close(),this.selection.focus()):this.enabled&&this.open()}));b.bind("mousedown",
|
55 |
-
this.bind(function(){this.search.focus()}));a.bind("focus",this.bind(function(){this.container.addClass("select2-container-active");this.search.attr("tabIndex","-1")}));a.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active");window.setTimeout(this.bind(function(){this.search.attr("tabIndex",this.opts.element.attr("tabIndex"))}),10)}));a.bind("keydown",this.bind(function(a){if(this.enabled)if(a.which===f.PAGE_UP||a.which===f.PAGE_DOWN)l(a);else if(!(a.which===
|
56 |
-
f.TAB||f.isControl(a)||f.isFunctionKey(a)||a.which===f.ESC)&&!(!1===this.opts.openOnEnter&&a.which===f.ENTER))if(a.which==f.DELETE)this.opts.allowClear&&this.clear();else{this.open();if(a.which!==f.ENTER&&!(48>a.which)){var b=String.fromCharCode(a.which).toLowerCase();a.shiftKey&&(b=b.toUpperCase());this.search.focus();this.search.val(b)}l(a)}}));a.delegate("abbr","mousedown",this.bind(function(a){this.enabled&&(this.clear(),l(a),this.close(),this.triggerChange(),this.selection.focus())}));this.setPlaceholder();
|
57 |
-
this.search.bind("focus",this.bind(function(){this.container.addClass("select2-container-active")}))},clear:function(){this.opts.element.val("");this.selection.find("span").empty();this.selection.removeData("select2-data");this.setPlaceholder()},initSelection:function(){if(""===this.opts.element.val())this.close(),this.setPlaceholder();else{var a=this;this.opts.initSelection.call(null,this.opts.element,function(b){b!==g&&null!==b&&(a.updateSelection(b),a.close(),a.setPlaceholder())})}},prepareOpts:function(){var a=
|
58 |
-
this.parent.prepareOpts.apply(this,arguments);"select"===a.element.get(0).tagName.toLowerCase()&&(a.initSelection=function(a,c){var d=a.find(":selected");e.isFunction(c)&&c({id:d.attr("value"),text:d.text()})});return a},setPlaceholder:function(){var a=this.getPlaceholder();""===this.opts.element.val()&&a!==g&&!(this.select&&""!==this.select.find("option:first").text())&&(this.selection.find("span").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.selection.find("abbr").hide())},
|
59 |
-
postprocessResults:function(a,b){var c=0,d=this,f=!0;this.results.find(".select2-result-selectable").each2(function(a,b){if(m(d.id(b.data("select2-data")),d.opts.element.val()))return c=a,!1});this.highlight(c);!0===b&&(f=this.showSearchInput=F(a.results)>=this.opts.minimumResultsForSearch,this.dropdown.find(".select2-search")[f?"removeClass":"addClass"]("select2-search-hidden"),e(this.dropdown,this.container)[f?"addClass":"removeClass"]("select2-with-searchbox"))},onSelect:function(a){var b=this.opts.element.val();
|
60 |
-
this.opts.element.val(this.id(a));this.updateSelection(a);this.close();this.selection.focus();m(b,this.id(a))||this.triggerChange()},updateSelection:function(a){var b=this.selection.find("span");this.selection.data("select2-data",a);b.empty();a=this.opts.formatSelection(a,b);a!==g&&b.append(this.opts.escapeMarkup(a));this.selection.removeClass("select2-default");this.opts.allowClear&&this.getPlaceholder()!==g&&this.selection.find("abbr").show()},val:function(){var a,b=null,c=this;if(0===arguments.length)return this.opts.element.val();
|
61 |
-
a=arguments[0];if(this.select)this.select.val(a).find(":selected").each2(function(a,c){b={id:c.attr("value"),text:c.text()};return!1}),this.updateSelection(b),this.setPlaceholder();else{if(this.opts.initSelection===g)throw Error("cannot call val() if initSelection() is not defined");a?(this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){c.opts.element.val(!a?"":c.id(a));c.updateSelection(a);c.setPlaceholder()})):this.clear()}},clearSearch:function(){this.search.val("")},
|
62 |
-
data:function(a){var b;if(0===arguments.length)return b=this.selection.data("select2-data"),b==g&&(b=null),b;!a||""===a?this.clear():(this.opts.element.val(!a?"":this.id(a)),this.updateSelection(a))}});z=x(w,{createContainer:function(){return e("<div></div>",{"class":"select2-container select2-container-multi"}).html(" <ul class='select2-choices'> <li class='select2-search-field'> <input type='text' autocomplete='off' class='select2-input'> </li></ul><div class='select2-drop select2-drop-multi' style='display:none;'> <ul class='select2-results'> </ul></div>")},
|
63 |
-
prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments);"select"===a.element.get(0).tagName.toLowerCase()&&(a.initSelection=function(a,c){var d=[];a.find(":selected").each2(function(a,b){d.push({id:b.attr("value"),text:b.text()})});e.isFunction(c)&&c(d)});return a},initContainer:function(){var a;this.searchContainer=this.container.find(".select2-search-field");this.selection=a=this.container.find(".select2-choices");this.search.bind("keydown",this.bind(function(b){if(this.enabled){if(b.which===
|
64 |
-
f.BACKSPACE&&""===this.search.val()){this.close();var c;c=a.find(".select2-search-choice-focus");if(0<c.length){this.unselect(c.first());this.search.width(10);l(b);return}c=a.find(".select2-search-choice");0<c.length&&c.last().addClass("select2-search-choice-focus")}else a.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");if(this.opened())switch(b.which){case f.UP:case f.DOWN:this.moveHighlight(b.which===f.UP?-1:1);l(b);return;case f.ENTER:case f.TAB:this.selectHighlighted();
|
65 |
-
l(b);return;case f.ESC:this.cancel(b);l(b);return}if(!(b.which===f.TAB||f.isControl(b)||f.isFunctionKey(b)||b.which===f.BACKSPACE||b.which===f.ESC)&&!(!1===this.opts.openOnEnter&&b.which===f.ENTER))this.open(),(b.which===f.PAGE_UP||b.which===f.PAGE_DOWN)&&l(b)}}));this.search.bind("keyup",this.bind(this.resizeSearch));this.search.bind("blur",this.bind(function(a){this.container.removeClass("select2-container-active");this.search.removeClass("select2-focused");this.clearSearch();a.stopImmediatePropagation()}));
|
66 |
-
this.container.delegate(".select2-choices","mousedown",this.bind(function(a){this.enabled&&!(0<e(a.target).closest(".select2-search-choice").length)&&(this.clearPlaceholder(),this.open(),this.focusSearch(),a.preventDefault())}));this.container.delegate(".select2-choices","focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())}));this.clearSearch()},enable:function(){this.enabled||(this.parent.enable.apply(this,
|
67 |
-
arguments),this.search.removeAttr("disabled"))},disable:function(){this.enabled&&(this.parent.disable.apply(this,arguments),this.search.attr("disabled",!0))},initSelection:function(){""===this.opts.element.val()&&(this.updateSelection([]),this.close(),this.clearSearch());if(this.select||""!==this.opts.element.val()){var a=this;this.opts.initSelection.call(null,this.opts.element,function(b){if(b!==g&&b!==null){a.updateSelection(b);a.close();a.clearSearch()}})}},clearSearch:function(){var a=this.getPlaceholder();
|
68 |
-
a!==g&&0===this.getVal().length&&!1===this.search.hasClass("select2-focused")?(this.search.val(a).addClass("select2-default"),this.resizeSearch()):this.search.val(" ").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")?this.search.val("").removeClass("select2-default"):" "===this.search.val()&&this.search.val("")},opening:function(){this.parent.opening.apply(this,arguments);this.clearPlaceholder();this.resizeSearch();this.focusSearch()},close:function(){this.opened()&&
|
69 |
-
this.parent.close.apply(this,arguments)},focus:function(){this.close();this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(a){var b=[],c=[],d=this;e(a).each(function(){0>i(d.id(this),b)&&(b.push(d.id(this)),c.push(this))});a=c;this.selection.find(".select2-search-choice").remove();e(a).each(function(){d.addSelectedChoice(this)});d.postprocessResults()},tokenize:function(){var a=this.search.val(),a=this.opts.tokenizer(a,this.data(),this.bind(this.onSelect),
|
70 |
-
this.opts);null!=a&&a!=g&&(this.search.val(a),0<a.length&&this.open())},onSelect:function(a){this.addSelectedChoice(a);this.select&&this.postprocessResults();this.opts.closeOnSelect?(this.close(),this.search.width(10)):0<this.countSelectableResults()?(this.search.width(10),this.resizeSearch(),this.positionDropdown()):this.close();this.triggerChange({added:a});this.focusSearch()},cancel:function(){this.close();this.focusSearch()},addSelectedChoice:function(a){var b=e("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),
|
71 |
-
c=this.id(a),d=this.getVal(),f;f=this.opts.formatSelection(a,b);b.find("div").replaceWith("<div>"+this.opts.escapeMarkup(f)+"</div>");b.find(".select2-search-choice-close").bind("mousedown",l).bind("click dblclick",this.bind(function(a){this.enabled&&(e(a.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(e(a.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");this.close();this.focusSearch()})).dequeue(),
|
72 |
-
l(a))})).bind("focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))}));b.data("select2-data",a);b.insertBefore(this.searchContainer);d.push(c);this.setVal(d)},unselect:function(a){var b=this.getVal(),c,d,a=a.closest(".select2-search-choice");if(0===a.length)throw"Invalid argument: "+a+". Must be .select2-search-choice";c=a.data("select2-data");d=i(this.id(c),b);0<=d&&(b.splice(d,1),this.setVal(b),this.select&&
|
73 |
-
this.postprocessResults());a.remove();this.triggerChange({removed:c})},postprocessResults:function(){var a=this.getVal(),b=this.results.find(".select2-result-selectable"),c=this.results.find(".select2-result-with-children"),d=this;b.each2(function(b,c){var e=d.id(c.data("select2-data"));0<=i(e,a)?c.addClass("select2-disabled").removeClass("select2-result-selectable"):c.removeClass("select2-disabled").addClass("select2-result-selectable")});c.each2(function(a,b){0==b.find(".select2-result-selectable").length?
|
74 |
-
b.addClass("select2-disabled"):b.removeClass("select2-disabled")});b.each2(function(a,b){if(!b.hasClass("select2-disabled")&&b.hasClass("select2-result-selectable"))return d.highlight(0),!1})},resizeSearch:function(){var a,b,c,d,f=this.search.outerWidth()-this.search.width();a=this.search;q||(c=a[0].currentStyle||window.getComputedStyle(a[0],null),q=e("<div></div>").css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,
|
75 |
-
fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),e("body").append(q));q.text(a.val());a=q.width()+10;b=this.search.offset().left;c=this.selection.width();d=this.selection.offset().left;b=c-(b-d)-f;b<a&&(b=c-f);40>b&&(b=c-f);this.search.width(b)},getVal:function(){var a;if(this.select)return a=this.select.val(),null===a?[]:a;a=this.opts.element.val();return s(a,this.opts.separator)},setVal:function(a){var b;this.select?this.select.val(a):(b=
|
76 |
-
[],e(a).each(function(){0>i(this,b)&&b.push(this)}),this.opts.element.val(0===b.length?"":b.join(this.opts.separator)))},val:function(){var a,b=[],c=this;if(0===arguments.length)return this.getVal();if(a=arguments[0])if(this.setVal(a),this.select)this.select.find(":selected").each(function(){b.push({id:e(this).attr("value"),text:e(this).text()})}),this.updateSelection(b);else{if(this.opts.initSelection===g)throw Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,
|
77 |
-
function(a){var b=e(a).map(c.id);c.setVal(b);c.updateSelection(a);c.clearSearch()})}else this.opts.element.val(""),this.updateSelection([]);this.clearSearch()},onSortStart:function(){if(this.select)throw Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0);this.searchContainer.hide()},onSortEnd:function(){var a=[],b=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();
|
78 |
-
this.selection.find(".select2-search-choice").each(function(){a.push(b.opts.id(e(this).data("select2-data")))});this.setVal(a);this.triggerChange()},data:function(a){var b=this,c;if(0===arguments.length)return this.selection.find(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get();a||(a=[]);c=e.map(a,function(a){return b.opts.id(a)});this.setVal(c);this.updateSelection(a);this.clearSearch()}});e.fn.select2=function(){var a=Array.prototype.slice.call(arguments,0),b,
|
79 |
-
c,d,f,h="val destroy opened open close focus isFocused container onSortStart onSortEnd enable disable positionDropdown data".split(" ");this.each(function(){if(0===a.length||"object"===typeof a[0])b=0===a.length?{}:e.extend({},a[0]),b.element=e(this),"select"===b.element.get(0).tagName.toLowerCase()?f=b.element.attr("multiple"):(f=b.multiple||!1,"tags"in b&&(b.multiple=f=!0)),c=f?new z:new y,c.init(b);else if("string"===typeof a[0]){if(0>i(a[0],h))throw"Unknown method: "+a[0];d=g;c=e(this).data("select2");
|
80 |
-
if(c!==g&&(d="container"===a[0]?c.container:c[a[0]].apply(c,a.slice(1)),d!==g))return!1}else throw"Invalid arguments to select2 plugin: "+a;});return d===g?this:d};e.fn.select2.defaults={width:"copy",closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c){b=[];B(a.text,c.term,b);return b.join("")},formatSelection:function(a){return a?a.text:g},formatResultCssClass:function(){return g},formatNoMatches:function(){return"No matches found"},
|
81 |
-
formatInputTooShort:function(a,b){return"Please enter "+(b-a.length)+" more characters"},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return 0<=b.toUpperCase().indexOf(a.toUpperCase())},separator:",",tokenSeparators:[],tokenizer:H,
|
82 |
-
escapeMarkup:function(a){return a&&"string"===typeof a?a.replace(/&/g,"&"):a},blurOnChange:!1};window.Select2={query:{ajax:C,local:D,tags:E},util:{debounce:A,markMatch:B},"class":{"abstract":w,single:y,multi:z}}}})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/select2/select2.png
DELETED
Binary file
|
widgets/select2/select2x2.png
DELETED
Binary file
|
widgets/select2/spinner.gif
DELETED
Binary file
|
widgets/select2/tpw_select2.js
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
(function ($) { // closure
|
2 |
-
$(function () {
|
3 |
-
function format(language) {
|
4 |
-
var originalOption = language.element;
|
5 |
-
var img = '<span class="trf trf-'+$(originalOption).data('flag')+'" title="'+$(originalOption).data('lang')+'"></span> ';
|
6 |
-
return img + language.text;
|
7 |
-
}
|
8 |
-
|
9 |
-
function format2(language) {
|
10 |
-
var originalOption = $(this.element).children('[value="'+language.id+'"]');
|
11 |
-
var img = '<span style="display: inline-block; margin: 0" class="trf trf-'+$(originalOption).data('flag')+'" title="'+$(originalOption).data('lang')+'"></span> ';
|
12 |
-
return img + language.text;
|
13 |
-
}
|
14 |
-
|
15 |
-
jQuery(".tp_lang2").select2({
|
16 |
-
formatResult: format,
|
17 |
-
formatSelection: format2
|
18 |
-
});
|
19 |
-
});
|
20 |
-
|
21 |
-
}(jQuery)); // end of closure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
widgets/select2/tpw_select2.php
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Select2 based Dropdown
|
5 |
-
Plugin URI: http://transposh.org/
|
6 |
-
Description: A nice select2 based widget based on the select2 library (http://ivaynberg.github.com/select2/index.html)
|
7 |
-
Author: Team Transposh
|
8 |
-
Version: 1.0
|
9 |
-
Author URI: http://transposh.org/
|
10 |
-
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
11 |
-
*/
|
12 |
-
|
13 |
-
/*
|
14 |
-
* Transposh v0.9.2
|
15 |
-
* http://transposh.org/
|
16 |
-
*
|
17 |
-
* Copyright 2013, Team Transposh
|
18 |
-
* Licensed under the GPL Version 2 or higher.
|
19 |
-
* http://transposh.org/license
|
20 |
-
*
|
21 |
-
* Date: Mon, 11 Mar 2013 02:28:05 +0200
|
22 |
-
*/
|
23 |
-
|
24 |
-
class tpw_select2 extends transposh_base_widget {
|
25 |
-
|
26 |
-
static function tp_widget_js($file, $dir, $url) {
|
27 |
-
wp_enqueue_script("select2", "$url/widgets/select2/select2.min.js", array('jquery'), TRANSPOSH_PLUGIN_VER);
|
28 |
-
wp_enqueue_script("transposh_widget_select2", "$url/widgets/select2/tpw_select2.js", array('jquery'), TRANSPOSH_PLUGIN_VER);
|
29 |
-
}
|
30 |
-
|
31 |
-
static function tp_widget_css($file, $dir, $url) {
|
32 |
-
wp_enqueue_style("flags_tpw_flags_css", "$url/widgets/flags/tpw_flags_css.css", array(), TRANSPOSH_PLUGIN_VER);
|
33 |
-
wp_enqueue_style("select2", "$url/widgets/select2/select2.css", array(), TRANSPOSH_PLUGIN_VER);
|
34 |
-
}
|
35 |
-
|
36 |
-
static function tp_widget_do($args) {
|
37 |
-
echo '<span class="' . NO_TRANSLATE_CLASS . '">';
|
38 |
-
|
39 |
-
echo '<select style="width:100%" name="lang" class="tp_lang2" onchange="document.location.href=this.options[this.selectedIndex].value;">';
|
40 |
-
foreach ($args as $langrecord) {
|
41 |
-
$is_selected = $langrecord['active'] ? " selected=\"selected\"" : "";
|
42 |
-
echo "<option value=\"{$langrecord['url']}\" data-flag=\"{$langrecord['flag']}\" data-lang=\"{$langrecord['lang']}\"{$is_selected}>{$langrecord['langorig']}</option>";
|
43 |
-
}
|
44 |
-
echo "</select><br/>";
|
45 |
-
|
46 |
-
echo "</span>";
|
47 |
-
}
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wp/transposh_3rdparty.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
@@ -128,7 +128,7 @@ class transposh_3rdparty {
|
|
128 |
* @param BP_Activity_Activity $activity
|
129 |
* @return string modified content
|
130 |
*/
|
131 |
-
function bp_get_activity_content_body($content, $activity) {
|
132 |
$activity_lang = bp_activity_get_meta($activity->id, 'tp_language');
|
133 |
if ($activity_lang) {
|
134 |
$content = "<span lang =\"$activity_lang\">" . $content . "</span>";
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
128 |
* @param BP_Activity_Activity $activity
|
129 |
* @return string modified content
|
130 |
*/
|
131 |
+
function bp_get_activity_content_body($content, $activity = "") { //XXX
|
132 |
$activity_lang = bp_activity_get_meta($activity->id, 'tp_language');
|
133 |
if ($activity_lang) {
|
134 |
$content = "<span lang =\"$activity_lang\">" . $content . "</span>";
|
wp/transposh_admin.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
@@ -91,6 +91,7 @@ class transposh_plugin_admin {
|
|
91 |
}
|
92 |
}
|
93 |
|
|
|
94 |
$this->transposh->options->viewable_languages = implode(',', $viewable_langs);
|
95 |
$this->transposh->options->sorted_languages = implode(',', $sorted_langs);
|
96 |
break;
|
@@ -103,6 +104,8 @@ class transposh_plugin_admin {
|
|
103 |
else $role->remove_cap(TRANSLATOR);
|
104 |
}
|
105 |
|
|
|
|
|
106 |
// anonymous needs to be handled differently as it does not have a role
|
107 |
tp_logger($_POST['anonymous']);
|
108 |
$this->transposh->options->allow_anonymous_translation = $_POST['anonymous'];
|
@@ -144,11 +147,11 @@ class transposh_plugin_admin {
|
|
144 |
case "tp_widget":
|
145 |
$this->transposh->options->widget_progressbar = TP_FROM_POST;
|
146 |
$this->transposh->options->widget_allow_set_deflang = TP_FROM_POST;
|
147 |
-
$this->transposh->options->widget_remove_logo = TP_FROM_POST;
|
148 |
$this->transposh->options->widget_theme = TP_FROM_POST;
|
149 |
break;
|
150 |
case "tp_advanced":
|
151 |
$this->transposh->options->enable_url_translate = TP_FROM_POST;
|
|
|
152 |
$this->transposh->options->jqueryui_override = TP_FROM_POST;
|
153 |
$this->transposh->options->parser_dont_break_puncts = TP_FROM_POST;
|
154 |
$this->transposh->options->parser_dont_break_numbers = TP_FROM_POST;
|
@@ -374,7 +377,7 @@ class transposh_plugin_admin {
|
|
374 |
// this is the default language location
|
375 |
list ($langname, $langorigname, $flag) = explode(",", transposh_consts::$languages[$this->transposh->options->default_language]);
|
376 |
echo '<div id="default_lang" style="overflow:auto;padding-bottom:10px;">';
|
377 |
-
$this->header(__('Default Language (drag another language here to make it default)', TRANSPOSH_TEXT_DOMAIN),'languages');
|
378 |
echo '<ul id="default_list"><li id="' . $this->transposh->options->default_language . '" class="languages">'
|
379 |
. transposh_utils::display_flag("{$this->transposh->transposh_plugin_url}/img/flags", $flag, $langorigname, false/* $this->transposh->options->get_widget_css_flags() */)
|
380 |
. '<input type="hidden" name="languages[]" value="' . $this->transposh->options->default_language . '" />'
|
@@ -383,6 +386,7 @@ class transposh_plugin_admin {
|
|
383 |
// list of languages
|
384 |
echo '<div style="overflow:auto; clear: both;">';
|
385 |
$this->header(__('Available Languages (Click to toggle language state - Drag to sort in the widget)', TRANSPOSH_TEXT_DOMAIN));
|
|
|
386 |
echo '<ul id="sortable">';
|
387 |
foreach ($this->transposh->options->get_sorted_langs() as $langcode => $langrecord) {
|
388 |
tp_logger($langcode, 5);
|
@@ -417,6 +421,11 @@ class transposh_plugin_admin {
|
|
417 |
|
418 |
// Show normal settings
|
419 |
function tp_settings() {
|
|
|
|
|
|
|
|
|
|
|
420 |
$this->section(__('Translation related settings', TRANSPOSH_TEXT_DOMAIN));
|
421 |
|
422 |
/*
|
@@ -498,7 +507,7 @@ class transposh_plugin_admin {
|
|
498 |
|
499 |
$this->textinput($this->transposh->options->oht_key_o
|
500 |
, array('ohticon.png', __('One Hour Translation secret key', TRANSPOSH_TEXT_DOMAIN))
|
501 |
-
, __('
|
502 |
|
503 |
$oht = get_option(TRANSPOSH_OPTIONS_OHT, array());
|
504 |
if (!empty($oht) && wp_next_scheduled('transposh_oht_event')) {
|
@@ -521,15 +530,13 @@ class transposh_plugin_admin {
|
|
521 |
$this->checkbox($this->transposh->options->widget_allow_set_deflang_o, __('Allow user to set current language as default', TRANSPOSH_TEXT_DOMAIN)
|
522 |
, __('Widget will allow setting this language as user default', TRANSPOSH_TEXT_DOMAIN));
|
523 |
|
524 |
-
$this->checkbox($this->transposh->options->widget_remove_logo_o, __('Remove transposh logo (see <a href="http://transposh.org/logoterms">terms</a>)', TRANSPOSH_TEXT_DOMAIN)
|
525 |
-
, __('Transposh logo will not appear on widget', TRANSPOSH_TEXT_DOMAIN));
|
526 |
-
|
527 |
$this->select($this->transposh->options->widget_theme_o, __('Edit interface (and progress bar) theme:', TRANSPOSH_TEXT_DOMAIN), __('Edit interface (and progress bar) theme:', TRANSPOSH_TEXT_DOMAIN), transposh_consts::$jqueryui_themes, false);
|
528 |
}
|
529 |
|
530 |
function tp_advanced() {
|
531 |
$this->checkbox($this->transposh->options->enable_url_translate_o, __('Enable url translation', TRANSPOSH_TEXT_DOMAIN) . ' (' . __('experimental', TRANSPOSH_TEXT_DOMAIN) . ')', __('Allow translation of permalinks and urls', TRANSPOSH_TEXT_DOMAIN));
|
532 |
$this->textinput($this->transposh->options->jqueryui_override_o, __('Override jQueryUI version', TRANSPOSH_TEXT_DOMAIN), __('Version', TRANSPOSH_TEXT_DOMAIN));
|
|
|
533 |
$this->section(__('Parser related settings', TRANSPOSH_TEXT_DOMAIN)
|
534 |
, __('This is extremely dangerous, will break your current translations, and might cause severe hickups, only proceed if you really know what you are doing.', TRANSPOSH_TEXT_DOMAIN));
|
535 |
$this->checkbox($this->transposh->options->parser_dont_break_puncts_o, __('Disable punctuations break', TRANSPOSH_TEXT_DOMAIN)
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
91 |
}
|
92 |
}
|
93 |
|
94 |
+
$viewable_langs = array_slice($viewable_langs, 0, 5);
|
95 |
$this->transposh->options->viewable_languages = implode(',', $viewable_langs);
|
96 |
$this->transposh->options->sorted_languages = implode(',', $sorted_langs);
|
97 |
break;
|
104 |
else $role->remove_cap(TRANSLATOR);
|
105 |
}
|
106 |
|
107 |
+
$this->transposh->options->allow_full_version_upgrade = TP_FROM_POST;
|
108 |
+
|
109 |
// anonymous needs to be handled differently as it does not have a role
|
110 |
tp_logger($_POST['anonymous']);
|
111 |
$this->transposh->options->allow_anonymous_translation = $_POST['anonymous'];
|
147 |
case "tp_widget":
|
148 |
$this->transposh->options->widget_progressbar = TP_FROM_POST;
|
149 |
$this->transposh->options->widget_allow_set_deflang = TP_FROM_POST;
|
|
|
150 |
$this->transposh->options->widget_theme = TP_FROM_POST;
|
151 |
break;
|
152 |
case "tp_advanced":
|
153 |
$this->transposh->options->enable_url_translate = TP_FROM_POST;
|
154 |
+
$this->transposh->options->dont_add_rel_alternate = TP_FROM_POST;
|
155 |
$this->transposh->options->jqueryui_override = TP_FROM_POST;
|
156 |
$this->transposh->options->parser_dont_break_puncts = TP_FROM_POST;
|
157 |
$this->transposh->options->parser_dont_break_numbers = TP_FROM_POST;
|
377 |
// this is the default language location
|
378 |
list ($langname, $langorigname, $flag) = explode(",", transposh_consts::$languages[$this->transposh->options->default_language]);
|
379 |
echo '<div id="default_lang" style="overflow:auto;padding-bottom:10px;">';
|
380 |
+
$this->header(__('Default Language (drag another language here to make it default)', TRANSPOSH_TEXT_DOMAIN), 'languages');
|
381 |
echo '<ul id="default_list"><li id="' . $this->transposh->options->default_language . '" class="languages">'
|
382 |
. transposh_utils::display_flag("{$this->transposh->transposh_plugin_url}/img/flags", $flag, $langorigname, false/* $this->transposh->options->get_widget_css_flags() */)
|
383 |
. '<input type="hidden" name="languages[]" value="' . $this->transposh->options->default_language . '" />'
|
386 |
// list of languages
|
387 |
echo '<div style="overflow:auto; clear: both;">';
|
388 |
$this->header(__('Available Languages (Click to toggle language state - Drag to sort in the widget)', TRANSPOSH_TEXT_DOMAIN));
|
389 |
+
$this->header(__('Only first five will be saved! Upgrade to full free version by choosing the option at the settings', TRANSPOSH_TEXT_DOMAIN));
|
390 |
echo '<ul id="sortable">';
|
391 |
foreach ($this->transposh->options->get_sorted_langs() as $langcode => $langrecord) {
|
392 |
tp_logger($langcode, 5);
|
421 |
|
422 |
// Show normal settings
|
423 |
function tp_settings() {
|
424 |
+
$this->section(__('Upgrade to full version', TRANSPOSH_TEXT_DOMAIN));
|
425 |
+
$this->checkbox($this->transposh->options->allow_full_version_upgrade_o, __('Allow upgrading to full version', TRANSPOSH_TEXT_DOMAIN)
|
426 |
+
, __('Allow upgrading to full version from http://transposh.org, which has no limit on languages used and includes a full set of widgets', TRANSPOSH_TEXT_DOMAIN));
|
427 |
+
$this->sectionstop();
|
428 |
+
|
429 |
$this->section(__('Translation related settings', TRANSPOSH_TEXT_DOMAIN));
|
430 |
|
431 |
/*
|
507 |
|
508 |
$this->textinput($this->transposh->options->oht_key_o
|
509 |
, array('ohticon.png', __('One Hour Translation secret key', TRANSPOSH_TEXT_DOMAIN))
|
510 |
+
, __('Secret Key', TRANSPOSH_TEXT_DOMAIN), 35, 'keys');
|
511 |
|
512 |
$oht = get_option(TRANSPOSH_OPTIONS_OHT, array());
|
513 |
if (!empty($oht) && wp_next_scheduled('transposh_oht_event')) {
|
530 |
$this->checkbox($this->transposh->options->widget_allow_set_deflang_o, __('Allow user to set current language as default', TRANSPOSH_TEXT_DOMAIN)
|
531 |
, __('Widget will allow setting this language as user default', TRANSPOSH_TEXT_DOMAIN));
|
532 |
|
|
|
|
|
|
|
533 |
$this->select($this->transposh->options->widget_theme_o, __('Edit interface (and progress bar) theme:', TRANSPOSH_TEXT_DOMAIN), __('Edit interface (and progress bar) theme:', TRANSPOSH_TEXT_DOMAIN), transposh_consts::$jqueryui_themes, false);
|
534 |
}
|
535 |
|
536 |
function tp_advanced() {
|
537 |
$this->checkbox($this->transposh->options->enable_url_translate_o, __('Enable url translation', TRANSPOSH_TEXT_DOMAIN) . ' (' . __('experimental', TRANSPOSH_TEXT_DOMAIN) . ')', __('Allow translation of permalinks and urls', TRANSPOSH_TEXT_DOMAIN));
|
538 |
$this->textinput($this->transposh->options->jqueryui_override_o, __('Override jQueryUI version', TRANSPOSH_TEXT_DOMAIN), __('Version', TRANSPOSH_TEXT_DOMAIN));
|
539 |
+
$this->checkbox($this->transposh->options->dont_add_rel_alternate_o, __('Disable adding rel=alternate to the html', TRANSPOSH_TEXT_DOMAIN), __('Disable the feature that adds the alternate language list to your page html header', TRANSPOSH_TEXT_DOMAIN));
|
540 |
$this->section(__('Parser related settings', TRANSPOSH_TEXT_DOMAIN)
|
541 |
, __('This is extremely dangerous, will break your current translations, and might cause severe hickups, only proceed if you really know what you are doing.', TRANSPOSH_TEXT_DOMAIN));
|
542 |
$this->checkbox($this->transposh->options->parser_dont_break_puncts_o, __('Disable punctuations break', TRANSPOSH_TEXT_DOMAIN)
|
wp/transposh_ajax.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
wp/transposh_backup.php
CHANGED
@@ -1,24 +1,20 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
15 |
* Provide the backup service class
|
16 |
*/
|
17 |
|
18 |
-
define('TRANSPOSH_BACKUP_SERVICE_URL', 'http://svc.transposh.org/backup');
|
19 |
-
define('TRANSPOSH_RESTORE_SERVICE_URL', 'http://svc.transposh.org/restore');
|
20 |
-
|
21 |
-
//define ("TRANSPOSH_BACKUP_SERVICE_URL" , "http://ofergen:8888/backup");
|
22 |
//class that reperesent the admin page
|
23 |
class transposh_backup {
|
24 |
|
@@ -35,7 +31,7 @@ class transposh_backup {
|
|
35 |
$body['home_url'] = $this->transposh->home_url;
|
36 |
$body['key'] = $this->transposh->options->transposh_key;
|
37 |
$body['v'] = '2';
|
38 |
-
$body['tpv'] = '0.9.
|
39 |
return $body;
|
40 |
}
|
41 |
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
15 |
* Provide the backup service class
|
16 |
*/
|
17 |
|
|
|
|
|
|
|
|
|
18 |
//class that reperesent the admin page
|
19 |
class transposh_backup {
|
20 |
|
31 |
$body['home_url'] = $this->transposh->home_url;
|
32 |
$body['key'] = $this->transposh->options->transposh_key;
|
33 |
$body['v'] = '2';
|
34 |
+
$body['tpv'] = '0.9.3';
|
35 |
return $body;
|
36 |
}
|
37 |
|
wp/transposh_db.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/**
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/**
|
wp/transposh_options.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
// This magic value will cause the option to be set from post
|
@@ -77,6 +77,8 @@ class transposh_option {
|
|
77 |
*
|
78 |
* Settings
|
79 |
*
|
|
|
|
|
80 |
* @property boolean $allow_anonymous_translation Option defining whether anonymous translation is allowed
|
81 |
* @property transposh_option $allow_anonymous_translation_o
|
82 |
* @property boolean $enable_default_translate Option to enable/disable default language translation
|
@@ -125,8 +127,6 @@ class transposh_option {
|
|
125 |
* @property transposh_option $widget_progressbar_o
|
126 |
* @property boolean $widget_allow_set_deflang Allows user to set his default language per #63 @since 0.3.8
|
127 |
* @property transposh_option $widget_allow_set_deflang_o
|
128 |
-
* @property boolean $widget_remove_logo Allows removing of transposh logo in exchange for an ad @since 0.6.0
|
129 |
-
* @property transposh_option $widget_remove_logo_o
|
130 |
* @property string $widget_theme Allows theming of the progressbar and edit window @since 0.7.0
|
131 |
* @property transposh_option $widget_theme_o
|
132 |
*
|
@@ -136,6 +136,8 @@ class transposh_option {
|
|
136 |
* @property transposh_option $enable_url_translate_o
|
137 |
* @property string $jqueryui_override Option to override the jQueryUI version @since 0.9.1
|
138 |
* @property transposh_option $jqueryui_override_o
|
|
|
|
|
139 |
* @property boolean $parser_dont_break_puncts Option to allow punctuations such as , . ( not to break @since 0.9.0
|
140 |
* @property transposh_option $parser_dont_break_puncts_o
|
141 |
* @property boolean $parser_dont_break_numbers Option to allow numbers not to break @since 0.9.0
|
@@ -216,6 +218,7 @@ class transposh_plugin_options {
|
|
216 |
$this->register_option('viewable_languages', TP_OPT_STRING);
|
217 |
$this->register_option('sorted_languages', TP_OPT_STRING);
|
218 |
|
|
|
219 |
$this->register_option('allow_anonymous_translation', TP_OPT_BOOLEAN, 1);
|
220 |
$this->register_option('enable_default_translate', TP_OPT_BOOLEAN, 0);
|
221 |
$this->register_option('enable_search_translate', TP_OPT_BOOLEAN, 1);
|
@@ -241,11 +244,11 @@ class transposh_plugin_options {
|
|
241 |
|
242 |
$this->register_option('widget_progressbar', TP_OPT_BOOLEAN, 0);
|
243 |
$this->register_option('widget_allow_set_deflang', TP_OPT_BOOLEAN, 0);
|
244 |
-
$this->register_option('widget_remove_logo', TP_OPT_BOOLEAN, 0);
|
245 |
$this->register_option('widget_theme', TP_OPT_STRING, 'ui-lightness');
|
246 |
|
247 |
$this->register_option('enable_url_translate', TP_OPT_BOOLEAN, 0);
|
248 |
$this->register_option('jqueryui_override', TP_OPT_STRING);
|
|
|
249 |
$this->register_option('parser_dont_break_puncts', TP_OPT_BOOLEAN, 0);
|
250 |
$this->register_option('parser_dont_break_numbers', TP_OPT_BOOLEAN, 0);
|
251 |
$this->register_option('parser_dont_break_entities', TP_OPT_BOOLEAN, 0);
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
// This magic value will cause the option to be set from post
|
77 |
*
|
78 |
* Settings
|
79 |
*
|
80 |
+
* @property boolean $allow_full_version_upgrade Option to allow to upgrade to full version
|
81 |
+
* @property transposh_option $allow_full_version_upgrade_o
|
82 |
* @property boolean $allow_anonymous_translation Option defining whether anonymous translation is allowed
|
83 |
* @property transposh_option $allow_anonymous_translation_o
|
84 |
* @property boolean $enable_default_translate Option to enable/disable default language translation
|
127 |
* @property transposh_option $widget_progressbar_o
|
128 |
* @property boolean $widget_allow_set_deflang Allows user to set his default language per #63 @since 0.3.8
|
129 |
* @property transposh_option $widget_allow_set_deflang_o
|
|
|
|
|
130 |
* @property string $widget_theme Allows theming of the progressbar and edit window @since 0.7.0
|
131 |
* @property transposh_option $widget_theme_o
|
132 |
*
|
136 |
* @property transposh_option $enable_url_translate_o
|
137 |
* @property string $jqueryui_override Option to override the jQueryUI version @since 0.9.1
|
138 |
* @property transposh_option $jqueryui_override_o
|
139 |
+
* @property boolean $dont_add_rel_alternate Option to disable the rel=alternate adding to the page @since 0.9.2
|
140 |
+
* @property transposh_option $dont_add_rel_alternate_o
|
141 |
* @property boolean $parser_dont_break_puncts Option to allow punctuations such as , . ( not to break @since 0.9.0
|
142 |
* @property transposh_option $parser_dont_break_puncts_o
|
143 |
* @property boolean $parser_dont_break_numbers Option to allow numbers not to break @since 0.9.0
|
218 |
$this->register_option('viewable_languages', TP_OPT_STRING);
|
219 |
$this->register_option('sorted_languages', TP_OPT_STRING);
|
220 |
|
221 |
+
$this->register_option('allow_full_version_upgrade', TP_OPT_BOOLEAN, 0);
|
222 |
$this->register_option('allow_anonymous_translation', TP_OPT_BOOLEAN, 1);
|
223 |
$this->register_option('enable_default_translate', TP_OPT_BOOLEAN, 0);
|
224 |
$this->register_option('enable_search_translate', TP_OPT_BOOLEAN, 1);
|
244 |
|
245 |
$this->register_option('widget_progressbar', TP_OPT_BOOLEAN, 0);
|
246 |
$this->register_option('widget_allow_set_deflang', TP_OPT_BOOLEAN, 0);
|
|
|
247 |
$this->register_option('widget_theme', TP_OPT_STRING, 'ui-lightness');
|
248 |
|
249 |
$this->register_option('enable_url_translate', TP_OPT_BOOLEAN, 0);
|
250 |
$this->register_option('jqueryui_override', TP_OPT_STRING);
|
251 |
+
$this->register_option('dont_add_rel_alternate', TP_OPT_BOOLEAN, 0);
|
252 |
$this->register_option('parser_dont_break_puncts', TP_OPT_BOOLEAN, 0);
|
253 |
$this->register_option('parser_dont_break_numbers', TP_OPT_BOOLEAN, 0);
|
254 |
$this->register_option('parser_dont_break_entities', TP_OPT_BOOLEAN, 0);
|
wp/transposh_postpublish.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
wp/transposh_widget.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
-
* Transposh v0.9.
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
-
* Date: Mon,
|
12 |
*/
|
13 |
|
14 |
/*
|
@@ -320,37 +320,7 @@ class transposh_plugin_widget extends WP_Widget {
|
|
320 |
// last - you can now remove the logo in exchange to a few percentage of ad and affiliate revenues on your pages, isn't that better?
|
321 |
$plugpath = parse_url($this->transposh->transposh_plugin_url, PHP_URL_PATH);
|
322 |
|
323 |
-
if (!$this->transposh->options->widget_remove_logo) {
|
324 |
-
$tagline = esc_attr__('Transposh', TRANSPOSH_TEXT_DOMAIN) . ' - ';
|
325 |
-
switch (ord(md5($_SERVER['REQUEST_URI'])) % 5) {
|
326 |
-
case 0:
|
327 |
-
$tagline .= esc_attr__('translation plugin for wordpress', TRANSPOSH_TEXT_DOMAIN);
|
328 |
-
break;
|
329 |
-
case 1:
|
330 |
-
$tagline .= esc_attr__('wordpress translation plugin', TRANSPOSH_TEXT_DOMAIN);
|
331 |
-
break;
|
332 |
-
case 2:
|
333 |
-
$tagline .= esc_attr__('translate your blog to 60+ languages', TRANSPOSH_TEXT_DOMAIN);
|
334 |
-
break;
|
335 |
-
case 3:
|
336 |
-
$tagline .= esc_attr__('website crowdsourcing translation plugin', TRANSPOSH_TEXT_DOMAIN);
|
337 |
-
break;
|
338 |
-
case 4:
|
339 |
-
$tagline .= esc_attr__('google translate and bing translate plugin for wordpress', TRANSPOSH_TEXT_DOMAIN);
|
340 |
-
break;
|
341 |
-
}
|
342 |
-
|
343 |
-
$extralang = '';
|
344 |
-
if ($this->transposh->target_language != 'en') {
|
345 |
-
$extralang = $this->transposh->target_language . '/';
|
346 |
-
}
|
347 |
-
}
|
348 |
-
|
349 |
echo '<div id="' . SPAN_PREFIX . 'credit' . self::$draw_calls . '">';
|
350 |
-
if (!$this->transposh->options->widget_remove_logo) {
|
351 |
-
echo 'by <a href="http://tran' . 'sposh.org/' . $extralang . '"><img height="16" width="16" src="' .
|
352 |
-
$plugpath . '/img/tplog' . 'o.png" style="padding:1px;border:0;box-shadow:0 0;border-radius:0" title="' . $tagline . '" alt="' . $tagline . '"/></a>';
|
353 |
-
}
|
354 |
echo '</div>';
|
355 |
if (isset($after_widget)) echo $after_widget;
|
356 |
// increase the number of calls for unique IDs
|
1 |
<?php
|
2 |
|
3 |
/*
|
4 |
+
* Transposh v0.9.3
|
5 |
* http://transposh.org/
|
6 |
*
|
7 |
* Copyright 2013, Team Transposh
|
8 |
* Licensed under the GPL Version 2 or higher.
|
9 |
* http://transposh.org/license
|
10 |
*
|
11 |
+
* Date: Mon, 06 May 2013 02:15:55 +0300
|
12 |
*/
|
13 |
|
14 |
/*
|
320 |
// last - you can now remove the logo in exchange to a few percentage of ad and affiliate revenues on your pages, isn't that better?
|
321 |
$plugpath = parse_url($this->transposh->transposh_plugin_url, PHP_URL_PATH);
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
echo '<div id="' . SPAN_PREFIX . 'credit' . self::$draw_calls . '">';
|
|
|
|
|
|
|
|
|
324 |
echo '</div>';
|
325 |
if (isset($after_widget)) echo $after_widget;
|
326 |
// increase the number of calls for unique IDs
|