Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorent Pigout <florent.pigout@gmail.com>2012-03-04 04:38:01 (GMT)
committer Florent Pigout <florent.pigout@gmail.com>2012-03-04 04:38:01 (GMT)
commit021679245d8672fb95258c6d5c686b75f086d4da (patch)
treebaf16e10fa1c6ded968054fe1a8d7a55ab75d908 /src
parentff8d3c8d6a4dcb671b33bedee6cd2cded725491b (diff)
add default pootle static files for custom styling (here olpc-fr)
Diffstat (limited to 'src')
-rw-r--r--src/pootle_it/html/_favicon.icobin0 -> 1150 bytes
-rw-r--r--src/pootle_it/html/admin.css119
-rw-r--r--src/pootle_it/html/fancybox-captcha.css79
-rw-r--r--src/pootle_it/html/favicon.icobin0 -> 1150 bytes
-rw-r--r--src/pootle_it/html/ie.css27
-rw-r--r--src/pootle_it/html/images/accept.pngbin0 -> 366 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-commit.pngbin0 -> 192 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-download.pngbin0 -> 199 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-translate-offline.pngbin0 -> 206 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-translate-online.pngbin0 -> 206 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-update.pngbin0 -> 199 bytes
-rw-r--r--src/pootle_it/html/images/actionlink-upload.pngbin0 -> 194 bytes
-rw-r--r--src/pootle_it/html/images/activity.gifbin0 -> 673 bytes
-rw-r--r--src/pootle_it/html/images/apertium.pngbin0 -> 328 bytes
-rw-r--r--src/pootle_it/html/images/app-32x32.jpgbin0 -> 946 bytes
-rw-r--r--src/pootle_it/html/images/app-32x32.pngbin0 -> 4951 bytes
-rw-r--r--src/pootle_it/html/images/app-64x64.jpgbin0 -> 2207 bytes
-rw-r--r--src/pootle_it/html/images/app-64x64.pngbin0 -> 8001 bytes
-rw-r--r--src/pootle_it/html/images/arrow_refresh.pngbin0 -> 685 bytes
-rw-r--r--src/pootle_it/html/images/arrow_up.pngbin0 -> 372 bytes
-rw-r--r--src/pootle_it/html/images/asc.gifbin0 -> 54 bytes
-rw-r--r--src/pootle_it/html/images/ascdesc.gifbin0 -> 70 bytes
-rw-r--r--src/pootle_it/html/images/bar-fuzzy.pngbin0 -> 95 bytes
-rw-r--r--src/pootle_it/html/images/bar-goodchange.pngbin0 -> 95 bytes
-rw-r--r--src/pootle_it/html/images/bar-translated.pngbin0 -> 95 bytes
-rw-r--r--src/pootle_it/html/images/bar-untranslated.pngbin0 -> 95 bytes
-rw-r--r--src/pootle_it/html/images/block.pngbin0 -> 321 bytes
-rw-r--r--src/pootle_it/html/images/book_next.pngbin0 -> 702 bytes
-rw-r--r--src/pootle_it/html/images/comment_add.pngbin0 -> 530 bytes
-rw-r--r--src/pootle_it/html/images/context.pngbin0 -> 524 bytes
-rw-r--r--src/pootle_it/html/images/copy.pngbin0 -> 374 bytes
-rw-r--r--src/pootle_it/html/images/database_save.pngbin0 -> 755 bytes
-rw-r--r--src/pootle_it/html/images/desc.gifbin0 -> 54 bytes
-rw-r--r--src/pootle_it/html/images/door_in.pngbin0 -> 693 bytes
-rw-r--r--src/pootle_it/html/images/drive_network.pngbin0 -> 585 bytes
-rw-r--r--src/pootle_it/html/images/edit.pngbin0 -> 223 bytes
-rw-r--r--src/pootle_it/html/images/email_go.pngbin0 -> 754 bytes
-rw-r--r--src/pootle_it/html/images/error.pngbin0 -> 331 bytes
-rw-r--r--src/pootle_it/html/images/external-link.pngbin0 -> 338 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/blank.gifbin0 -> 43 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_close.pngbin0 -> 1517 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_loading.pngbin0 -> 10195 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_nav_left.pngbin0 -> 1446 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_nav_right.pngbin0 -> 1454 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_e.pngbin0 -> 107 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_n.pngbin0 -> 106 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_ne.pngbin0 -> 347 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_nw.pngbin0 -> 324 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_s.pngbin0 -> 111 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_se.pngbin0 -> 352 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_sw.pngbin0 -> 340 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_shadow_w.pngbin0 -> 103 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_title_left.pngbin0 -> 503 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_title_main.pngbin0 -> 96 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_title_over.pngbin0 -> 70 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancy_title_right.pngbin0 -> 506 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancybox-x.pngbin0 -> 203 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancybox-y.pngbin0 -> 176 bytes
-rw-r--r--src/pootle_it/html/images/fancybox/fancybox.pngbin0 -> 15287 bytes
-rw-r--r--src/pootle_it/html/images/feed.pngbin0 -> 691 bytes
-rw-r--r--src/pootle_it/html/images/folder.pngbin0 -> 537 bytes
-rw-r--r--src/pootle_it/html/images/footer-bg.jpgbin0 -> 2390 bytes
-rw-r--r--src/pootle_it/html/images/gap.pngbin0 -> 104 bytes
-rw-r--r--src/pootle_it/html/images/generic-web-translate.pngbin0 -> 424 bytes
-rw-r--r--src/pootle_it/html/images/good.pngbin0 -> 1215 bytes
-rw-r--r--src/pootle_it/html/images/google-translate.pngbin0 -> 361 bytes
-rw-r--r--src/pootle_it/html/images/header-background-bottom.pngbin0 -> 345 bytes
-rw-r--r--src/pootle_it/html/images/header-background.pngbin0 -> 311 bytes
-rw-r--r--src/pootle_it/html/images/help.pngbin0 -> 786 bytes
-rw-r--r--src/pootle_it/html/images/information.pngbin0 -> 778 bytes
-rw-r--r--src/pootle_it/html/images/key_go.pngbin0 -> 744 bytes
-rw-r--r--src/pootle_it/html/images/logo.jpgbin0 -> 1388 bytes
-rw-r--r--src/pootle_it/html/images/logo.pngbin0 -> 3791 bytes
-rw-r--r--src/pootle_it/html/images/newspaper_go.pngbin0 -> 779 bytes
-rw-r--r--src/pootle_it/html/images/next.pngbin0 -> 607 bytes
-rw-r--r--src/pootle_it/html/images/next2.pngbin0 -> 736 bytes
-rw-r--r--src/pootle_it/html/images/none.pngbin0 -> 70 bytes
-rw-r--r--src/pootle_it/html/images/page-bg.jpgbin0 -> 7625 bytes
-rw-r--r--src/pootle_it/html/images/page.pngbin0 -> 635 bytes
-rw-r--r--src/pootle_it/html/images/page_get.pngbin0 -> 737 bytes
-rw-r--r--src/pootle_it/html/images/page_refresh.pngbin0 -> 858 bytes
-rw-r--r--src/pootle_it/html/images/pencil.pngbin0 -> 450 bytes
-rw-r--r--src/pootle_it/html/images/prev.pngbin0 -> 614 bytes
-rw-r--r--src/pootle_it/html/images/prev2.pngbin0 -> 745 bytes
-rw-r--r--src/pootle_it/html/images/reject.pngbin0 -> 382 bytes
-rw-r--r--src/pootle_it/html/images/sarrow_down.pngbin0 -> 342 bytes
-rw-r--r--src/pootle_it/html/images/sarrow_down_rtl.pngbin0 -> 326 bytes
-rw-r--r--src/pootle_it/html/images/sarrow_up.pngbin0 -> 339 bytes
-rw-r--r--src/pootle_it/html/images/sarrow_up_rtl.pngbin0 -> 320 bytes
-rw-r--r--src/pootle_it/html/images/script_code.pngbin0 -> 859 bytes
-rw-r--r--src/pootle_it/html/images/search-arrow.pngbin0 -> 304 bytes
-rw-r--r--src/pootle_it/html/images/squiggle.pngbin0 -> 151 bytes
-rw-r--r--src/pootle_it/html/images/suggest.pngbin0 -> 641 bytes
-rw-r--r--src/pootle_it/html/images/tick.pngbin0 -> 537 bytes
-rw-r--r--src/pootle_it/html/images/tipsy.gifbin0 -> 58 bytes
-rw-r--r--src/pootle_it/html/images/user_comment.pngbin0 -> 743 bytes
-rw-r--r--src/pootle_it/html/images/user_go.pngbin0 -> 793 bytes
-rw-r--r--src/pootle_it/html/images/warning.pngbin0 -> 304 bytes
-rw-r--r--src/pootle_it/html/js/README148
-rw-r--r--src/pootle_it/html/js/admin.js66
-rw-r--r--src/pootle_it/html/js/admin_bundle.js3
-rw-r--r--src/pootle_it/html/js/common.js134
-rw-r--r--src/pootle_it/html/js/common_bundle.js186
-rw-r--r--src/pootle_it/html/js/correctpng.js39
-rw-r--r--src/pootle_it/html/js/diff_match_patch.js2247
-rw-r--r--src/pootle_it/html/js/editor.js1815
-rw-r--r--src/pootle_it/html/js/editor_bundle.js139
-rw-r--r--src/pootle_it/html/js/jquery/jquery.bidi.js24
-rw-r--r--src/pootle_it/html/js/jquery/jquery.caret.js69
-rw-r--r--src/pootle_it/html/js/jquery/jquery.cookie.js96
-rw-r--r--src/pootle_it/html/js/jquery/jquery.easing.js205
-rw-r--r--src/pootle_it/html/js/jquery/jquery.fancybox.js1156
-rw-r--r--src/pootle_it/html/js/jquery/jquery.fieldselection.js83
-rw-r--r--src/pootle_it/html/js/jquery/jquery.highlightRegex.js46
-rw-r--r--src/pootle_it/html/js/jquery/jquery.history.js198
-rw-r--r--src/pootle_it/html/js/jquery/jquery.js7179
-rw-r--r--src/pootle_it/html/js/jquery/jquery.jsonp.js261
-rw-r--r--src/pootle_it/html/js/jquery/jquery.serializeObject.js31
-rw-r--r--src/pootle_it/html/js/jquery/jquery.textarea-expander.js95
-rw-r--r--src/pootle_it/html/js/jquery/jquery.tipsy.js212
-rw-r--r--src/pootle_it/html/js/jquery/jquery.tmpl.js486
-rw-r--r--src/pootle_it/html/js/json2.js483
-rw-r--r--src/pootle_it/html/js/mt/apertium.js61
-rw-r--r--src/pootle_it/html/js/mt/google_translate.js97
-rw-r--r--src/pootle_it/html/js/shortcut.js223
-rw-r--r--src/pootle_it/html/js/sorttable.js523
-rw-r--r--src/pootle_it/html/pootle.bundle.css4
-rw-r--r--src/pootle_it/html/style.css2073
-rw-r--r--src/pootle_it/html/translate.css1079
129 files changed, 19686 insertions, 0 deletions
diff --git a/src/pootle_it/html/_favicon.ico b/src/pootle_it/html/_favicon.ico
new file mode 100644
index 0000000..b318c75
--- /dev/null
+++ b/src/pootle_it/html/_favicon.ico
Binary files differ
diff --git a/src/pootle_it/html/admin.css b/src/pootle_it/html/admin.css
new file mode 100644
index 0000000..5693fae
--- /dev/null
+++ b/src/pootle_it/html/admin.css
@@ -0,0 +1,119 @@
+/*
+ * ADMIN DASHBOARD
+ */
+
+/* DEPENDENCY CHECKS */
+
+div#depchecks ul
+{
+ margin-bottom: 1em;
+}
+
+div#depchecks ul#optional,
+div#depchecks ul#optimal
+{
+ font-style: italic;
+ background-color: inherit;
+ color: #4B4740;
+}
+
+div#depchecks ul li
+{
+ background-repeat: no-repeat;
+ padding: 0 2em;
+ margin: 0.5em 0;
+}
+
+div#depchecks ul li.good
+{
+ background-image: url('images/good.png');
+ background-position: left top;
+}
+
+html[dir="rtl"] div#depchecks ul li.good
+{
+ background-position: right top;
+}
+
+div#depchecks ul li.warning
+{
+ background-image: url('images/warning.png');
+ background-position: left top;
+}
+
+html[dir="rtl"] div#depchecks ul li.warning
+{
+ background-position: right top;
+}
+
+div#depchecks ul li.error
+{
+ background-image: url('images/error.png');
+ background-position: left top;
+ font-weight: bold;
+ color: #d54e21;
+}
+
+html[dir="rtl"] div#depchecks ul li.error
+{
+ background-position: right top;
+}
+
+/* ADMIN GENERAL SETTINGS */
+
+textarea#id_DESCRIPTION
+{
+ width: 100%;
+}
+
+/* ADMIN LANGUAGES, FILES */
+
+td.code input
+{
+ width: 5em;
+}
+
+td.fullname {
+ width: 20%;
+}
+
+td.pluralequation
+{
+ width: 50%;
+}
+
+td.fullname input
+{
+ min-width: 10em;
+}
+
+td.specialchars input
+{
+ min-width: 5em;
+}
+
+td.fullname input,
+td.pluralequation input,
+td.specialchars input
+{
+ width: 90%;
+}
+
+td.fullname input,
+td.pluralequation input,
+td.pootle_path
+{
+ direction: ltr;
+}
+
+html[dir="rtl"] td.pootle_path
+{
+ text-align: right;
+}
+
+/* ADMIN BUTTONS */
+
+.admin-buttons-block input
+{
+ margin-bottom: 1em;
+}
diff --git a/src/pootle_it/html/fancybox-captcha.css b/src/pootle_it/html/fancybox-captcha.css
new file mode 100644
index 0000000..d8fa6bd
--- /dev/null
+++ b/src/pootle_it/html/fancybox-captcha.css
@@ -0,0 +1,79 @@
+#fancybox-loading {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ height: 40px;
+ width: 40px;
+ margin-top: -20px;
+ margin-left: -20px;
+ cursor: pointer;
+ overflow: hidden;
+ z-index: 1104;
+ display: none;
+}
+
+* html #fancybox-loading { /* IE6 */
+ position: absolute;
+ margin-top: 0;
+}
+
+#fancybox-loading div {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 40px;
+ height: 480px;
+ background-image: url('images/fancybox/fancybox.png');
+}
+
+#fancybox-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ right: 0;
+ b--ackground: #000;
+ z-index: 1100;
+ display: none;
+}
+
+* html #fancybox-overlay { /* IE6 */
+ position: absolute;
+ width: 100%;
+}
+
+#fancybox-tmp {
+ padding: 0;
+ margin: 0;
+ border: 0;
+ overflow: auto;
+ display: none;
+}
+
+#fancybox-wrap {
+ position: absolute;
+ top: 0;
+ left: 0;
+ margin: 0;
+ p--adding: 20px;
+ z-index: 1101;
+ display: none;
+}
+
+#fancybox-close {
+ position: absolute;
+ top: 35px;
+ right: 20px;
+ width: 30px;
+ height: 30px;
+ background-image: url('images/fancybox/fancybox.png');
+ background-position: -40px 0px;
+ background-color: transparent;
+ cursor: pointer;
+ z-index: 1103;
+ display: none;
+}
+
+#fancybox-inner {
+ padding: 5px;
+}
diff --git a/src/pootle_it/html/favicon.ico b/src/pootle_it/html/favicon.ico
new file mode 100644
index 0000000..f3657d8
--- /dev/null
+++ b/src/pootle_it/html/favicon.ico
Binary files differ
diff --git a/src/pootle_it/html/ie.css b/src/pootle_it/html/ie.css
new file mode 100644
index 0000000..6c690cc
--- /dev/null
+++ b/src/pootle_it/html/ie.css
@@ -0,0 +1,27 @@
+/*
+ * IE-ONLY RULES
+ */
+
+.form {
+ border: 1px solid #aaa;
+ border-bottom-width: 2px; /* imitate shadow */
+}
+
+input[type="submit"]
+{
+ border: 1px solid #aaa;
+ min-width: 90px; /* as it adds up paddings */
+}
+
+#prevnext input[type="submit"]
+{
+ min-width: 80px; /* as it adds up paddings */
+}
+
+
+/* ADMIN PERMISSIONS */
+
+td.positive_permissions select
+{
+ height: 12em;
+}
diff --git a/src/pootle_it/html/images/accept.png b/src/pootle_it/html/images/accept.png
new file mode 100644
index 0000000..dac7e74
--- /dev/null
+++ b/src/pootle_it/html/images/accept.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-commit.png b/src/pootle_it/html/images/actionlink-commit.png
new file mode 100644
index 0000000..673aaec
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-commit.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-download.png b/src/pootle_it/html/images/actionlink-download.png
new file mode 100644
index 0000000..34ba50d
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-download.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-translate-offline.png b/src/pootle_it/html/images/actionlink-translate-offline.png
new file mode 100644
index 0000000..3014d22
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-translate-offline.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-translate-online.png b/src/pootle_it/html/images/actionlink-translate-online.png
new file mode 100644
index 0000000..74d2f46
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-translate-online.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-update.png b/src/pootle_it/html/images/actionlink-update.png
new file mode 100644
index 0000000..7d20bd3
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-update.png
Binary files differ
diff --git a/src/pootle_it/html/images/actionlink-upload.png b/src/pootle_it/html/images/actionlink-upload.png
new file mode 100644
index 0000000..525bc12
--- /dev/null
+++ b/src/pootle_it/html/images/actionlink-upload.png
Binary files differ
diff --git a/src/pootle_it/html/images/activity.gif b/src/pootle_it/html/images/activity.gif
new file mode 100644
index 0000000..1d1628c
--- /dev/null
+++ b/src/pootle_it/html/images/activity.gif
Binary files differ
diff --git a/src/pootle_it/html/images/apertium.png b/src/pootle_it/html/images/apertium.png
new file mode 100644
index 0000000..5d6bda5
--- /dev/null
+++ b/src/pootle_it/html/images/apertium.png
Binary files differ
diff --git a/src/pootle_it/html/images/app-32x32.jpg b/src/pootle_it/html/images/app-32x32.jpg
new file mode 100644
index 0000000..1499f9a
--- /dev/null
+++ b/src/pootle_it/html/images/app-32x32.jpg
Binary files differ
diff --git a/src/pootle_it/html/images/app-32x32.png b/src/pootle_it/html/images/app-32x32.png
new file mode 100644
index 0000000..2c16777
--- /dev/null
+++ b/src/pootle_it/html/images/app-32x32.png
Binary files differ
diff --git a/src/pootle_it/html/images/app-64x64.jpg b/src/pootle_it/html/images/app-64x64.jpg
new file mode 100644
index 0000000..521e3e2
--- /dev/null
+++ b/src/pootle_it/html/images/app-64x64.jpg
Binary files differ
diff --git a/src/pootle_it/html/images/app-64x64.png b/src/pootle_it/html/images/app-64x64.png
new file mode 100644
index 0000000..ce1f7e8
--- /dev/null
+++ b/src/pootle_it/html/images/app-64x64.png
Binary files differ
diff --git a/src/pootle_it/html/images/arrow_refresh.png b/src/pootle_it/html/images/arrow_refresh.png
new file mode 100644
index 0000000..0de2656
--- /dev/null
+++ b/src/pootle_it/html/images/arrow_refresh.png
Binary files differ
diff --git a/src/pootle_it/html/images/arrow_up.png b/src/pootle_it/html/images/arrow_up.png
new file mode 100644
index 0000000..1ebb193
--- /dev/null
+++ b/src/pootle_it/html/images/arrow_up.png
Binary files differ
diff --git a/src/pootle_it/html/images/asc.gif b/src/pootle_it/html/images/asc.gif
new file mode 100644
index 0000000..7415786
--- /dev/null
+++ b/src/pootle_it/html/images/asc.gif
Binary files differ
diff --git a/src/pootle_it/html/images/ascdesc.gif b/src/pootle_it/html/images/ascdesc.gif
new file mode 100644
index 0000000..8ff6344
--- /dev/null
+++ b/src/pootle_it/html/images/ascdesc.gif
Binary files differ
diff --git a/src/pootle_it/html/images/bar-fuzzy.png b/src/pootle_it/html/images/bar-fuzzy.png
new file mode 100644
index 0000000..5183888
--- /dev/null
+++ b/src/pootle_it/html/images/bar-fuzzy.png
Binary files differ
diff --git a/src/pootle_it/html/images/bar-goodchange.png b/src/pootle_it/html/images/bar-goodchange.png
new file mode 100644
index 0000000..39fa6f3
--- /dev/null
+++ b/src/pootle_it/html/images/bar-goodchange.png
Binary files differ
diff --git a/src/pootle_it/html/images/bar-translated.png b/src/pootle_it/html/images/bar-translated.png
new file mode 100644
index 0000000..d1a69c6
--- /dev/null
+++ b/src/pootle_it/html/images/bar-translated.png
Binary files differ
diff --git a/src/pootle_it/html/images/bar-untranslated.png b/src/pootle_it/html/images/bar-untranslated.png
new file mode 100644
index 0000000..24fa693
--- /dev/null
+++ b/src/pootle_it/html/images/bar-untranslated.png
Binary files differ
diff --git a/src/pootle_it/html/images/block.png b/src/pootle_it/html/images/block.png
new file mode 100644
index 0000000..6a763ee
--- /dev/null
+++ b/src/pootle_it/html/images/block.png
Binary files differ
diff --git a/src/pootle_it/html/images/book_next.png b/src/pootle_it/html/images/book_next.png
new file mode 100644
index 0000000..ff2ea1a
--- /dev/null
+++ b/src/pootle_it/html/images/book_next.png
Binary files differ
diff --git a/src/pootle_it/html/images/comment_add.png b/src/pootle_it/html/images/comment_add.png
new file mode 100644
index 0000000..75e78de
--- /dev/null
+++ b/src/pootle_it/html/images/comment_add.png
Binary files differ
diff --git a/src/pootle_it/html/images/context.png b/src/pootle_it/html/images/context.png
new file mode 100644
index 0000000..da5c622
--- /dev/null
+++ b/src/pootle_it/html/images/context.png
Binary files differ
diff --git a/src/pootle_it/html/images/copy.png b/src/pootle_it/html/images/copy.png
new file mode 100644
index 0000000..4a88a1e
--- /dev/null
+++ b/src/pootle_it/html/images/copy.png
Binary files differ
diff --git a/src/pootle_it/html/images/database_save.png b/src/pootle_it/html/images/database_save.png
new file mode 100644
index 0000000..44c06dd
--- /dev/null
+++ b/src/pootle_it/html/images/database_save.png
Binary files differ
diff --git a/src/pootle_it/html/images/desc.gif b/src/pootle_it/html/images/desc.gif
new file mode 100644
index 0000000..3b30b3c
--- /dev/null
+++ b/src/pootle_it/html/images/desc.gif
Binary files differ
diff --git a/src/pootle_it/html/images/door_in.png b/src/pootle_it/html/images/door_in.png
new file mode 100644
index 0000000..41676a0
--- /dev/null
+++ b/src/pootle_it/html/images/door_in.png
Binary files differ
diff --git a/src/pootle_it/html/images/drive_network.png b/src/pootle_it/html/images/drive_network.png
new file mode 100644
index 0000000..63d2d5d
--- /dev/null
+++ b/src/pootle_it/html/images/drive_network.png
Binary files differ
diff --git a/src/pootle_it/html/images/edit.png b/src/pootle_it/html/images/edit.png
new file mode 100644
index 0000000..8197041
--- /dev/null
+++ b/src/pootle_it/html/images/edit.png
Binary files differ
diff --git a/src/pootle_it/html/images/email_go.png b/src/pootle_it/html/images/email_go.png
new file mode 100644
index 0000000..4a6c5d3
--- /dev/null
+++ b/src/pootle_it/html/images/email_go.png
Binary files differ
diff --git a/src/pootle_it/html/images/error.png b/src/pootle_it/html/images/error.png
new file mode 100644
index 0000000..e6f605a
--- /dev/null
+++ b/src/pootle_it/html/images/error.png
Binary files differ
diff --git a/src/pootle_it/html/images/external-link.png b/src/pootle_it/html/images/external-link.png
new file mode 100644
index 0000000..5291b7c
--- /dev/null
+++ b/src/pootle_it/html/images/external-link.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/blank.gif b/src/pootle_it/html/images/fancybox/blank.gif
new file mode 100644
index 0000000..35d42e8
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/blank.gif
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_close.png b/src/pootle_it/html/images/fancybox/fancy_close.png
new file mode 100644
index 0000000..0703530
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_close.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_loading.png b/src/pootle_it/html/images/fancybox/fancy_loading.png
new file mode 100644
index 0000000..2503017
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_loading.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_nav_left.png b/src/pootle_it/html/images/fancybox/fancy_nav_left.png
new file mode 100644
index 0000000..ebaa6a4
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_nav_left.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_nav_right.png b/src/pootle_it/html/images/fancybox/fancy_nav_right.png
new file mode 100644
index 0000000..873294e
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_nav_right.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_e.png b/src/pootle_it/html/images/fancybox/fancy_shadow_e.png
new file mode 100644
index 0000000..2eda089
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_e.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_n.png b/src/pootle_it/html/images/fancybox/fancy_shadow_n.png
new file mode 100644
index 0000000..69aa10e
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_n.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_ne.png b/src/pootle_it/html/images/fancybox/fancy_shadow_ne.png
new file mode 100644
index 0000000..79f6980
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_ne.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_nw.png b/src/pootle_it/html/images/fancybox/fancy_shadow_nw.png
new file mode 100644
index 0000000..7182cd9
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_nw.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_s.png b/src/pootle_it/html/images/fancybox/fancy_shadow_s.png
new file mode 100644
index 0000000..d8858bf
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_s.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_se.png b/src/pootle_it/html/images/fancybox/fancy_shadow_se.png
new file mode 100644
index 0000000..541e3ff
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_se.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_sw.png b/src/pootle_it/html/images/fancybox/fancy_shadow_sw.png
new file mode 100644
index 0000000..b451689
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_sw.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_shadow_w.png b/src/pootle_it/html/images/fancybox/fancy_shadow_w.png
new file mode 100644
index 0000000..8a4e4a8
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_shadow_w.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_title_left.png b/src/pootle_it/html/images/fancybox/fancy_title_left.png
new file mode 100644
index 0000000..6049223
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_title_left.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_title_main.png b/src/pootle_it/html/images/fancybox/fancy_title_main.png
new file mode 100644
index 0000000..8044271
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_title_main.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_title_over.png b/src/pootle_it/html/images/fancybox/fancy_title_over.png
new file mode 100644
index 0000000..d9f458f
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_title_over.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancy_title_right.png b/src/pootle_it/html/images/fancybox/fancy_title_right.png
new file mode 100644
index 0000000..e36d9db
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancy_title_right.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancybox-x.png b/src/pootle_it/html/images/fancybox/fancybox-x.png
new file mode 100644
index 0000000..c2130f8
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancybox-x.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancybox-y.png b/src/pootle_it/html/images/fancybox/fancybox-y.png
new file mode 100644
index 0000000..7ef399b
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancybox-y.png
Binary files differ
diff --git a/src/pootle_it/html/images/fancybox/fancybox.png b/src/pootle_it/html/images/fancybox/fancybox.png
new file mode 100644
index 0000000..65e14f6
--- /dev/null
+++ b/src/pootle_it/html/images/fancybox/fancybox.png
Binary files differ
diff --git a/src/pootle_it/html/images/feed.png b/src/pootle_it/html/images/feed.png
new file mode 100644
index 0000000..315c4f4
--- /dev/null
+++ b/src/pootle_it/html/images/feed.png
Binary files differ
diff --git a/src/pootle_it/html/images/folder.png b/src/pootle_it/html/images/folder.png
new file mode 100644
index 0000000..784e8fa
--- /dev/null
+++ b/src/pootle_it/html/images/folder.png
Binary files differ
diff --git a/src/pootle_it/html/images/footer-bg.jpg b/src/pootle_it/html/images/footer-bg.jpg
new file mode 100644
index 0000000..d5b1616
--- /dev/null
+++ b/src/pootle_it/html/images/footer-bg.jpg
Binary files differ
diff --git a/src/pootle_it/html/images/gap.png b/src/pootle_it/html/images/gap.png
new file mode 100644
index 0000000..cb96bb0
--- /dev/null
+++ b/src/pootle_it/html/images/gap.png
Binary files differ
diff --git a/src/pootle_it/html/images/generic-web-translate.png b/src/pootle_it/html/images/generic-web-translate.png
new file mode 100644
index 0000000..a1b74ac
--- /dev/null
+++ b/src/pootle_it/html/images/generic-web-translate.png
Binary files differ
diff --git a/src/pootle_it/html/images/good.png b/src/pootle_it/html/images/good.png
new file mode 100644
index 0000000..2e7ab2a
--- /dev/null
+++ b/src/pootle_it/html/images/good.png
Binary files differ
diff --git a/src/pootle_it/html/images/google-translate.png b/src/pootle_it/html/images/google-translate.png
new file mode 100644
index 0000000..1618454
--- /dev/null
+++ b/src/pootle_it/html/images/google-translate.png
Binary files differ
diff --git a/src/pootle_it/html/images/header-background-bottom.png b/src/pootle_it/html/images/header-background-bottom.png
new file mode 100644
index 0000000..5718179
--- /dev/null
+++ b/src/pootle_it/html/images/header-background-bottom.png
Binary files differ
diff --git a/src/pootle_it/html/images/header-background.png b/src/pootle_it/html/images/header-background.png
new file mode 100644
index 0000000..2720a86
--- /dev/null
+++ b/src/pootle_it/html/images/header-background.png
Binary files differ
diff --git a/src/pootle_it/html/images/help.png b/src/pootle_it/html/images/help.png
new file mode 100644
index 0000000..5c87017
--- /dev/null
+++ b/src/pootle_it/html/images/help.png
Binary files differ
diff --git a/src/pootle_it/html/images/information.png b/src/pootle_it/html/images/information.png
new file mode 100644
index 0000000..12cd1ae
--- /dev/null
+++ b/src/pootle_it/html/images/information.png
Binary files differ
diff --git a/src/pootle_it/html/images/key_go.png b/src/pootle_it/html/images/key_go.png
new file mode 100644
index 0000000..30b0dc3
--- /dev/null
+++ b/src/pootle_it/html/images/key_go.png
Binary files differ
diff --git a/src/pootle_it/html/images/logo.jpg b/src/pootle_it/html/images/logo.jpg
new file mode 100644
index 0000000..56dd666
--- /dev/null
+++ b/src/pootle_it/html/images/logo.jpg
Binary files differ
diff --git a/src/pootle_it/html/images/logo.png b/src/pootle_it/html/images/logo.png
new file mode 100644
index 0000000..5c03454
--- /dev/null
+++ b/src/pootle_it/html/images/logo.png
Binary files differ
diff --git a/src/pootle_it/html/images/newspaper_go.png b/src/pootle_it/html/images/newspaper_go.png
new file mode 100644
index 0000000..fd61428
--- /dev/null
+++ b/src/pootle_it/html/images/newspaper_go.png
Binary files differ
diff --git a/src/pootle_it/html/images/next.png b/src/pootle_it/html/images/next.png
new file mode 100644
index 0000000..31f7fd3
--- /dev/null
+++ b/src/pootle_it/html/images/next.png
Binary files differ
diff --git a/src/pootle_it/html/images/next2.png b/src/pootle_it/html/images/next2.png
new file mode 100644
index 0000000..4a2f9d4
--- /dev/null
+++ b/src/pootle_it/html/images/next2.png
Binary files differ
diff --git a/src/pootle_it/html/images/none.png b/src/pootle_it/html/images/none.png
new file mode 100644
index 0000000..37c28e7
--- /dev/null
+++ b/src/pootle_it/html/images/none.png
Binary files differ
diff --git a/src/pootle_it/html/images/page-bg.jpg b/src/pootle_it/html/images/page-bg.jpg
new file mode 100644
index 0000000..2286621
--- /dev/null
+++ b/src/pootle_it/html/images/page-bg.jpg
Binary files differ
diff --git a/src/pootle_it/html/images/page.png b/src/pootle_it/html/images/page.png
new file mode 100644
index 0000000..03ddd79
--- /dev/null
+++ b/src/pootle_it/html/images/page.png
Binary files differ
diff --git a/src/pootle_it/html/images/page_get.png b/src/pootle_it/html/images/page_get.png
new file mode 100644
index 0000000..489736b
--- /dev/null
+++ b/src/pootle_it/html/images/page_get.png
Binary files differ
diff --git a/src/pootle_it/html/images/page_refresh.png b/src/pootle_it/html/images/page_refresh.png
new file mode 100644
index 0000000..cf347c7
--- /dev/null
+++ b/src/pootle_it/html/images/page_refresh.png
Binary files differ
diff --git a/src/pootle_it/html/images/pencil.png b/src/pootle_it/html/images/pencil.png
new file mode 100644
index 0000000..0bfecd5
--- /dev/null
+++ b/src/pootle_it/html/images/pencil.png
Binary files differ
diff --git a/src/pootle_it/html/images/prev.png b/src/pootle_it/html/images/prev.png
new file mode 100644
index 0000000..c029447
--- /dev/null
+++ b/src/pootle_it/html/images/prev.png
Binary files differ
diff --git a/src/pootle_it/html/images/prev2.png b/src/pootle_it/html/images/prev2.png
new file mode 100644
index 0000000..15d1584
--- /dev/null
+++ b/src/pootle_it/html/images/prev2.png
Binary files differ
diff --git a/src/pootle_it/html/images/reject.png b/src/pootle_it/html/images/reject.png
new file mode 100644
index 0000000..dabc530
--- /dev/null
+++ b/src/pootle_it/html/images/reject.png
Binary files differ
diff --git a/src/pootle_it/html/images/sarrow_down.png b/src/pootle_it/html/images/sarrow_down.png
new file mode 100644
index 0000000..e303e40
--- /dev/null
+++ b/src/pootle_it/html/images/sarrow_down.png
Binary files differ
diff --git a/src/pootle_it/html/images/sarrow_down_rtl.png b/src/pootle_it/html/images/sarrow_down_rtl.png
new file mode 100644
index 0000000..e779bef
--- /dev/null
+++ b/src/pootle_it/html/images/sarrow_down_rtl.png
Binary files differ
diff --git a/src/pootle_it/html/images/sarrow_up.png b/src/pootle_it/html/images/sarrow_up.png
new file mode 100644
index 0000000..170204b
--- /dev/null
+++ b/src/pootle_it/html/images/sarrow_up.png
Binary files differ
diff --git a/src/pootle_it/html/images/sarrow_up_rtl.png b/src/pootle_it/html/images/sarrow_up_rtl.png
new file mode 100644
index 0000000..916be40
--- /dev/null
+++ b/src/pootle_it/html/images/sarrow_up_rtl.png
Binary files differ
diff --git a/src/pootle_it/html/images/script_code.png b/src/pootle_it/html/images/script_code.png
new file mode 100644
index 0000000..63fe6ce
--- /dev/null
+++ b/src/pootle_it/html/images/script_code.png
Binary files differ
diff --git a/src/pootle_it/html/images/search-arrow.png b/src/pootle_it/html/images/search-arrow.png
new file mode 100644
index 0000000..c7aa318
--- /dev/null
+++ b/src/pootle_it/html/images/search-arrow.png
Binary files differ
diff --git a/src/pootle_it/html/images/squiggle.png b/src/pootle_it/html/images/squiggle.png
new file mode 100644
index 0000000..4d18e12
--- /dev/null
+++ b/src/pootle_it/html/images/squiggle.png
Binary files differ
diff --git a/src/pootle_it/html/images/suggest.png b/src/pootle_it/html/images/suggest.png
new file mode 100644
index 0000000..abdad91
--- /dev/null
+++ b/src/pootle_it/html/images/suggest.png
Binary files differ
diff --git a/src/pootle_it/html/images/tick.png b/src/pootle_it/html/images/tick.png
new file mode 100644
index 0000000..a9925a0
--- /dev/null
+++ b/src/pootle_it/html/images/tick.png
Binary files differ
diff --git a/src/pootle_it/html/images/tipsy.gif b/src/pootle_it/html/images/tipsy.gif
new file mode 100644
index 0000000..74eebae
--- /dev/null
+++ b/src/pootle_it/html/images/tipsy.gif
Binary files differ
diff --git a/src/pootle_it/html/images/user_comment.png b/src/pootle_it/html/images/user_comment.png
new file mode 100644
index 0000000..e54ebeb
--- /dev/null
+++ b/src/pootle_it/html/images/user_comment.png
Binary files differ
diff --git a/src/pootle_it/html/images/user_go.png b/src/pootle_it/html/images/user_go.png
new file mode 100644
index 0000000..0468cf0
--- /dev/null
+++ b/src/pootle_it/html/images/user_go.png
Binary files differ
diff --git a/src/pootle_it/html/images/warning.png b/src/pootle_it/html/images/warning.png
new file mode 100644
index 0000000..2c5bc9d
--- /dev/null
+++ b/src/pootle_it/html/images/warning.png
Binary files differ
diff --git a/src/pootle_it/html/js/README b/src/pootle_it/html/js/README
new file mode 100644
index 0000000..627214d
--- /dev/null
+++ b/src/pootle_it/html/js/README
@@ -0,0 +1,148 @@
+
+/*****************************************************************************/
+
+ This README is an attempt to keep the house clean under the 'js' directory.
+
+/*****************************************************************************/
+
+Directory contents
+-------------------
++ js/
+
+ - admin.js :
+ Code for tasks performed in the administration area.
+
+ Also sorts select elements (both normal and multiple) where language names are
+ involved. This is done in JavaScript because currently it's not possible
+ to sort them within Django.
+ To sort a new select element, add the end of the element id to the 'ids'
+ array.
+
+ - common.js :
+ Common code that is included in every page. This includes:
+ - Code to handle the page zoom feature.
+ - Code to handle the advanced search dropdown. May be merged with other code
+ in the translate page.
+
+ - correctpng.js :
+ Fixes for IE 5.5 & 6 to correctly handle PNG transparencies.
+
+ http://homepage.ntlworld.com/bobosola
+
+ - diff_match_patch.js :
+ Google's Diff, Match, and Patch libraries for plain text.
+ It's used for suggestion's diff highlighting.
+
+ https://code.google.com/p/google-diff-match-patch/
+
+ - editor.js :
+ Code that sets up the editor and handles all the actions involved there.
+ This includes unit navigation, submission, suggestions' handling, copying
+ functions, fuzzy/unfuzzy, and several other helper stuff.
+
+ - json2.min.js :
+ JavaScript library for encoding/decoding data to/from JSON format.
+
+ http://www.json.org/js.html
+
+ - shortcut.js :
+ Small library to ease adding keyboard shortcuts.
+
+ http://www.openjs.com/scripts/events/keyboard_shortcuts/
+
+ - sorttable.js :
+ Sorts tables according to its values. Used in the homepage as well as on the
+ languages and projects listings. It has some customisations to support
+ zebra stripes once the sort is done (using jQuery). The icons used on the
+ table headings are custom code too.
+ We may want to use a table sorter purely written in jQuery, such as
+ tablesorter (http://tablesorter.com/docs/).
+
+ http://www.kryogenix.org/code/browser/sorttable/
+
+ + jquery/
+
+ - jquery.js :
+ The jQuery library, version 1.4.4.
+
+ - jquery.bidi.js :
+ jQuery plugin used to automatically set line direction of news
+ item based on their content.
+
+ http://plugins.jquery.com/project/bidi
+
+ - jquery.caret.js :
+ jQuery plugin to write text on top of the selected text or just after
+ the caret position.
+
+ http://www.jquery-plugin.buss.hk/my-plugins/jquery-caret-plugin
+
+ - jquery.easing.js :
+ jQuery plugin that provides dfferent easing (animation) formulas.
+
+ http://gsgd.co.uk/sandbox/jquery/easing/
+
+ - jquery.fancybox.js :
+ Fancybox plugin for jQuery that adds the ability to display overlay
+ boxes with all sorts of content: images, HTML, AJAX data, ...
+
+ Using version 1.3.4.
+
+ http://fancybox.net/
+
+ - jquery.fieldselection.js :
+ jQuery plugin to retrieve or replace text selections within
+ textareas.
+
+ http://laboratorium.0xab.cd/jquery/fieldselection/0.1.0/
+
+ - jquery.highlighRegex.js :
+ Plugin to highlight text on selected elements using regular expressions.
+
+ https://github.com/jbr/jQuery.highlightRegex
+
+ - jquery.history.js :
+ Plugin to handle AJAX history using hashes.
+
+ http://github.com/tkyk/jquery-history-plugin/
+
+ - jquery.jsonp.js :
+ Alternative solution to jQuery's JSONP support.
+
+ jQuery's JSONP support has some limitations (it can't handle error
+ callbacks, doesn't have an abort method, ...), and this plugin
+ tries to address those issues.
+
+ These features may be implemented in jQuery core at some stage.
+
+ Using version 2.1.4.
+
+ https://code.google.com/p/jquery-jsonp/
+
+ - jquery.serializeObject.js :
+ A method for serializing forms directly into objects.
+
+ Whereas jQuery’s built-in .serializeArray() method serializes a form
+ into an array, .serializeObject() serializes a form into an
+ (arguably more useful) object.
+
+ http://benalman.com/projects/jquery-misc-plugins/#serializeobject
+
+ - jquery.textarea-expander.js :
+ jQuery plugin used in the translate page textareas.
+
+ http://blogs.sitepointstatic.com/examples/tech/textarea-expander/jquery.textarea-expander.js
+
+ - jquery.tmpl.js :
+ jQuery templating engine.
+
+ http://github.com/nje/jquery-tmpl
+
+ + mt/
+
+ - apertium.js :
+ Script to load translation suggestions using the Apertium service.
+
+ - google-translate.js :
+ Script to load translation suggestions using the Google Translate service.
+
diff --git a/src/pootle_it/html/js/admin.js b/src/pootle_it/html/js/admin.js
new file mode 100644
index 0000000..d3af91a
--- /dev/null
+++ b/src/pootle_it/html/js/admin.js
@@ -0,0 +1,66 @@
+$(document).ready(function () {
+ /* Sorts language names within select elements */
+ var ids = ["id_languages", "id_alt_src_langs", "-language",
+ "-source_language"];
+
+ $.each(ids, function (i, id) {
+ var selects = $("select[id$='" + id + "']");
+ $.each(selects, function (i, select) {
+ var select = $(select);
+ var options = $("option", select);
+
+ if (options.length) {
+ if (!select.is("[multiple]")) {
+ var selected = $(":selected", select);
+ }
+ var opsarray = $.makeArray(options);
+ opsarray.sort(function (a,b) {
+ return $(a).text() > $(b).text()
+ });
+ options.remove();
+ select.append($(opsarray));
+ if (!select.is("[multiple]")) {
+ select.get(0).selectedIndex = $(opsarray).index(selected);
+ }
+ }
+ });
+ });
+
+ /* Sliding table within admin dashboard */
+ var slide_table = function (event) {
+ event.preventDefault();
+ $.ajax({
+ url: l('/admin/stats/more'),
+ dataType: 'json',
+ beforeSend: function () {
+ $(".slide").unbind('click', slide_table);
+ },
+ error: function () {
+ $(".slide").bind('click', slide_table);
+ },
+ success: function (data) {
+ var newstats = '';
+ $(data).each(function () {
+ newstats += '<tr><th scope="row">' + this[0] + '</th>'
+ + '<td class="stats-number">' + this[1] + '</td></tr>';
+ });
+ $("tbody.slidethis").append(newstats);
+ $("tbody.slidethis").slideDown("fast");
+ $("tbody.slidethis").next("tbody").remove();
+ }
+ });
+ };
+ $(".slide").bind('click', slide_table);
+
+ /* Sets background color to table rows when checking selects */
+ $("td.DELETE input[type=checkbox]").click(function () {
+ $(this).parents("tr").toggleClass("delete-selected");
+ });
+ $("td[class!=DELETE] input[type=checkbox]").click(function () {
+ if (!$("input[type=checkbox][checked]",
+ $(this).parent().siblings("td[class!=DELETE]")).length) {
+ $(this).parents("tr").toggleClass("other-selected");
+ }
+ });
+
+});
diff --git a/src/pootle_it/html/js/admin_bundle.js b/src/pootle_it/html/js/admin_bundle.js
new file mode 100644
index 0000000..0bc01e4
--- /dev/null
+++ b/src/pootle_it/html/js/admin_bundle.js
@@ -0,0 +1,3 @@
+$(document).ready(function(){$.each(["id_languages","id_alt_src_langs","-language","-source_language"],function(g,c){var b=$("select[id$='"+c+"']");$.each(b,function(k,a){a=$(a);var d=$("option",a);if(d.length){if(!a.is("[multiple]"))var h=$(":selected",a);var e=$.makeArray(d);e.sort(function(i,j){return $(i).text()>$(j).text()});d.remove();a.append($(e));if(!a.is("[multiple]"))a.get(0).selectedIndex=$(e).index(h)}})});var f=function(g){g.preventDefault();$.ajax({url:l("/admin/stats/more"),dataType:"json",
+beforeSend:function(){$(".slide").unbind("click",f)},error:function(){$(".slide").bind("click",f)},success:function(c){var b="";$(c).each(function(){b+='<tr><th scope="row">'+this[0]+'</th><td class="stats-number">'+this[1]+"</td></tr>"});$("tbody.slidethis").append(b);$("tbody.slidethis").slideDown("fast");$("tbody.slidethis").next("tbody").remove()}})};$(".slide").bind("click",f);$("td.DELETE input[type=checkbox]").click(function(){$(this).parents("tr").toggleClass("delete-selected")});$("td[class!=DELETE] input[type=checkbox]").click(function(){$("input[type=checkbox][checked]",
+$(this).parent().siblings("td[class!=DELETE]")).length||$(this).parents("tr").toggleClass("other-selected")})});
diff --git a/src/pootle_it/html/js/common.js b/src/pootle_it/html/js/common.js
new file mode 100644
index 0000000..1ec85aa
--- /dev/null
+++ b/src/pootle_it/html/js/common.js
@@ -0,0 +1,134 @@
+/*
+ * Zoom-related variables and handler functions
+ */
+
+// global variable that stores current zoom level
+var pageZoom = 0;
+
+// converts pageZoom value to an appropriate class name string
+function zoomClassName() {
+ if (pageZoom < 0) {
+ return "zoom-out-" + (pageZoom * -1);
+ } else if (pageZoom > 0) {
+ return "zoom-in-" + pageZoom;
+ } else {
+ return "";
+ }
+}
+
+// initializes zoom and sets up related shortcuts on document load
+function initZoom() {
+ pageZoom = $.cookie('pageZoom');
+
+ $(document.body).addClass(zoomClassName());
+
+ shortcut.add('ctrl+shift+insert', function () {
+ zoom(-1);
+ });
+
+ shortcut.add('ctrl+shift+home', function () {
+ zoom(0);
+ });
+
+ shortcut.add('ctrl+shift+page_up', function () {
+ zoom(1);
+ });
+}
+
+// changes zoom and updates class name of a document body
+function zoom(v) {
+ var oldClassName = zoomClassName();
+
+ if (v == -1) {
+ if (pageZoom == -2) {
+ return; // minimum zoom level reached
+ }
+ pageZoom--;
+ } else if (v == 1) {
+ if (pageZoom == 2) {
+ return; // maximum zoom level reached
+ }
+ pageZoom++;
+ } else if (v == 0) {
+ pageZoom = 0;
+ }
+
+ $.cookie('pageZoom', pageZoom, {path: '/'});
+
+ $(document.body).removeClass(oldClassName).addClass(zoomClassName());
+}
+
+/*
+ * Search control helper
+ */
+
+$(document).ready(function ($) {
+ $('html').ajaxSend(function(event, xhr, settings) {
+ function getCookie(name) {
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
+ if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
+ // Only send the token to relative URLs i.e. locally.
+ xhr.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
+ }
+ });
+
+ /* Search input text */
+ var focused = { color: "#000" }
+ var unfocused = { color: "#aaa" }
+
+ $('label.inputHint').each(function () {
+ var label = $(this);
+ var input = $('#' + label.attr('for'));
+ if (input.attr("defaultValue")) {
+ var initial = input.attr("defaultValue");
+ var search = true;
+ } else {
+ var initial = label.hide().text().replace(':', '');
+ }
+ input.focus(function () {
+ input.css(focused);
+ if (input.val() == initial && !search) {
+ input.val('');
+ }
+ }).blur(function () {
+ if (input.val() == '') {
+ input.val(initial).css(unfocused);
+ } else if (search && input.val() == initial) {
+ input.css(unfocused);
+ }
+ }).css(unfocused).val(initial);
+ });
+
+ /* Dropdown toggling */
+ $("a.advancedlink").click(function (event) {
+ event.preventDefault();
+ $("div.advancedsearch").slideToggle();
+ }).toggle(function () {
+ $("img.togglesearch").toggle();
+ }, function () {
+ $("img.togglesearch").toggle();
+ });
+
+ /* Collapsing functionality */
+ $(".collapse").live("click", function (e) {
+ e.preventDefault();
+ $(this).siblings(".collapsethis").slideToggle("fast");
+ if ($("textarea", $(this).next("div.collapsethis")).length) {
+ $("textarea", $(this).next("div.collapsethis")).focus();
+ }
+ });
+
+});
diff --git a/src/pootle_it/html/js/common_bundle.js b/src/pootle_it/html/js/common_bundle.js
new file mode 100644
index 0000000..efef6af
--- /dev/null
+++ b/src/pootle_it/html/js/common_bundle.js
@@ -0,0 +1,186 @@
+(function(j,q){function r(a,b,e){if(e===q&&a.nodeType===1){e=a.getAttribute("data-"+b);if(typeof e==="string"){try{e=e==="true"?true:e==="false"?false:e==="null"?null:!c.isNaN(e)?parseFloat(e):Ra.test(e)?c.parseJSON(e):e}catch(f){}c.data(a,b,e)}else e=q}return e}function x(){return false}function K(){return true}function J(a,b,e){e[0].type=a;return c.event.handle.apply(b,e)}function N(a){var b,e,f,g,i,p,o,u,F,z,I,L=[];g=[];i=c.data(this,this.nodeType?"events":"__events__");if(typeof i==="function")i=
+i.events;if(!(a.liveFired===this||!i||!i.live||a.button&&a.type==="click")){if(a.namespace)I=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var T=i.live.slice(0);for(o=0;o<T.length;o++){i=T[o];i.origType.replace(la,"")===a.type?g.push(i.selector):T.splice(o--,1)}g=c(a.target).closest(g,a.currentTarget);u=0;for(F=g.length;u<F;u++){z=g[u];for(o=0;o<T.length;o++){i=T[o];if(z.selector===i.selector&&(!I||I.test(i.namespace))){p=z.elem;f=null;if(i.preType==="mouseenter"||
+i.preType==="mouseleave"){a.type=i.preType;f=c(a.relatedTarget).closest(i.selector)[0]}if(!f||f!==p)L.push({elem:p,handleObj:i,level:z.level})}}}u=0;for(F=L.length;u<F;u++){g=L[u];if(e&&g.level>e)break;a.currentTarget=g.elem;a.data=g.handleObj.data;a.handleObj=g.handleObj;I=g.handleObj.origHandler.apply(g.elem,arguments);if(I===false||a.isPropagationStopped()){e=g.level;if(I===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function V(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Sa,
+"`").replace(Ta,"&")}function Q(a,b,e){if(c.isFunction(b))return c.grep(a,function(g,i){return!!b.call(g,i,g)===e});else if(b.nodeType)return c.grep(a,function(g){return g===b===e});else if(typeof b==="string"){var f=c.grep(a,function(g){return g.nodeType===1});if(Ua.test(b))return c.filter(b,f,!e);else b=c.filter(b,f)}return c.grep(a,function(g){return c.inArray(g,b)>=0===e})}function ea(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var f=c.data(a[e++]),g=c.data(this,f);
+if(f=f&&f.events){delete g.handle;g.events={};for(var i in f)for(var p in f[i])c.event.add(this,i,f[i][p],f[i][p].data)}}})}function qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function U(a,b,e){var f=b==="width"?a.offsetWidth:a.offsetHeight;if(e==="border")return f;c.each(b==="width"?Va:Wa,function(){e||(f-=parseFloat(c.css(a,"padding"+this))||0);if(e==="margin")f+=parseFloat(c.css(a,
+"margin"+this))||0;else f-=parseFloat(c.css(a,"border"+this+"Width"))||0});return f}function fa(a,b,e,f){if(c.isArray(b)&&b.length)c.each(b,function(g,i){e||Xa.test(a)?f(a,i):fa(a+"["+(typeof i==="object"||c.isArray(i)?g:"")+"]",i,e,f)});else if(!e&&b!=null&&typeof b==="object")c.isEmptyObject(b)?f(a,""):c.each(b,function(g,i){fa(a+"["+g+"]",i,e,f)});else f(a,b)}function ha(a,b){var e={};c.each(xa.concat.apply([],xa.slice(0,b)),function(){e[this]=a});return e}function ya(a){if(!ra[a]){var b=c("<"+
+a+">").appendTo("body"),e=b.css("display");b.remove();if(e==="none"||e==="")e="block";ra[a]=e}return ra[a]}function sa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var B=j.document,c=function(){function a(){if(!b.isReady){try{B.documentElement.doScroll("left")}catch(n){setTimeout(a,1);return}b.ready()}}var b=function(n,A){return new b.fn.init(n,A)},e=j.jQuery,f=j.$,g,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,p=/\S/,o=/^\s+/,u=/\s+$/,F=/\W/,z=/\d/,I=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+L=/^[\],:{}\s]*$/,T=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,E=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,S=/(?:^|:|,)(?:\s*\[)+/g,X=/(webkit)[ \/]([\w.]+)/,h=/(opera)(?:.*version)?[ \/]([\w.]+)/,l=/(msie) ([\w.]+)/,t=/(mozilla)(?:.*? rv:([\w.]+))?/,s=navigator.userAgent,v=false,w=[],C,G=Object.prototype.toString,O=Object.prototype.hasOwnProperty,Y=Array.prototype.push,Z=Array.prototype.slice,ba=String.prototype.trim,M=Array.prototype.indexOf,ga={};b.fn=b.prototype={init:function(n,
+A){var D,H,R;if(!n)return this;if(n.nodeType){this.context=this[0]=n;this.length=1;return this}if(n==="body"&&!A&&B.body){this.context=B;this[0]=B.body;this.selector="body";this.length=1;return this}if(typeof n==="string")if((D=i.exec(n))&&(D[1]||!A))if(D[1]){R=A?A.ownerDocument||A:B;if(H=I.exec(n))if(b.isPlainObject(A)){n=[B.createElement(H[1])];b.fn.attr.call(n,A,true)}else n=[R.createElement(H[1])];else{H=b.buildFragment([D[1]],[R]);n=(H.cacheable?H.fragment.cloneNode(true):H.fragment).childNodes}return b.merge(this,
+n)}else{if((H=B.getElementById(D[2]))&&H.parentNode){if(H.id!==D[2])return g.find(n);this.length=1;this[0]=H}this.context=B;this.selector=n;return this}else if(!A&&!F.test(n)){this.selector=n;this.context=B;n=B.getElementsByTagName(n);return b.merge(this,n)}else return!A||A.jquery?(A||g).find(n):b(A).find(n);else if(b.isFunction(n))return g.ready(n);if(n.selector!==q){this.selector=n.selector;this.context=n.context}return b.makeArray(n,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
+toArray:function(){return Z.call(this,0)},get:function(n){return n==null?this.toArray():n<0?this.slice(n)[0]:this[n]},pushStack:function(n,A,D){var H=b();b.isArray(n)?Y.apply(H,n):b.merge(H,n);H.prevObject=this;H.context=this.context;if(A==="find")H.selector=this.selector+(this.selector?" ":"")+D;else if(A)H.selector=this.selector+"."+A+"("+D+")";return H},each:function(n,A){return b.each(this,n,A)},ready:function(n){b.bindReady();if(b.isReady)n.call(B,b);else w&&w.push(n);return this},eq:function(n){return n===
+-1?this.slice(n):this.slice(n,+n+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Z.apply(this,arguments),"slice",Z.call(arguments).join(","))},map:function(n){return this.pushStack(b.map(this,function(A,D){return n.call(A,D,A)}))},end:function(){return this.prevObject||b(null)},push:Y,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var n,A,D,H,R,P=arguments[0]||{},W=1,da=arguments.length,ta=
+false;if(typeof P==="boolean"){ta=P;P=arguments[1]||{};W=2}if(typeof P!=="object"&&!b.isFunction(P))P={};if(da===W){P=this;--W}for(;W<da;W++)if((n=arguments[W])!=null)for(A in n){D=P[A];H=n[A];if(P!==H)if(ta&&H&&(b.isPlainObject(H)||(R=b.isArray(H)))){if(R){R=false;D=D&&b.isArray(D)?D:[]}else D=D&&b.isPlainObject(D)?D:{};P[A]=b.extend(ta,D,H)}else if(H!==q)P[A]=H}return P};b.extend({noConflict:function(n){j.$=f;if(n)j.jQuery=e;return b},isReady:false,readyWait:1,ready:function(n){n===true&&b.readyWait--;
+if(!b.readyWait||n!==true&&!b.isReady){if(!B.body)return setTimeout(b.ready,1);b.isReady=true;if(!(n!==true&&--b.readyWait>0))if(w){var A=0,D=w;for(w=null;n=D[A++];)n.call(B,b);b.fn.trigger&&b(B).trigger("ready").unbind("ready")}}},bindReady:function(){if(!v){v=true;if(B.readyState==="complete")return setTimeout(b.ready,1);if(B.addEventListener){B.addEventListener("DOMContentLoaded",C,false);j.addEventListener("load",b.ready,false)}else if(B.attachEvent){B.attachEvent("onreadystatechange",C);j.attachEvent("onload",
+b.ready);var n=false;try{n=j.frameElement==null}catch(A){}B.documentElement.doScroll&&n&&a()}}},isFunction:function(n){return b.type(n)==="function"},isArray:Array.isArray||function(n){return b.type(n)==="array"},isWindow:function(n){return n&&typeof n==="object"&&"setInterval"in n},isNaN:function(n){return n==null||!z.test(n)||isNaN(n)},type:function(n){return n==null?String(n):ga[G.call(n)]||"object"},isPlainObject:function(n){if(!n||b.type(n)!=="object"||n.nodeType||b.isWindow(n))return false;
+if(n.constructor&&!O.call(n,"constructor")&&!O.call(n.constructor.prototype,"isPrototypeOf"))return false;for(var A in n);return A===q||O.call(n,A)},isEmptyObject:function(n){for(var A in n)return false;return true},error:function(n){throw n;},parseJSON:function(n){if(typeof n!=="string"||!n)return null;n=b.trim(n);if(L.test(n.replace(T,"@").replace(E,"]").replace(S,"")))return j.JSON&&j.JSON.parse?j.JSON.parse(n):(new Function("return "+n))();else b.error("Invalid JSON: "+n)},noop:function(){},globalEval:function(n){if(n&&
+p.test(n)){var A=B.getElementsByTagName("head")[0]||B.documentElement,D=B.createElement("script");D.type="text/javascript";if(b.support.scriptEval)D.appendChild(B.createTextNode(n));else D.text=n;A.insertBefore(D,A.firstChild);A.removeChild(D)}},nodeName:function(n,A){return n.nodeName&&n.nodeName.toUpperCase()===A.toUpperCase()},each:function(n,A,D){var H,R=0,P=n.length,W=P===q||b.isFunction(n);if(D)if(W)for(H in n){if(A.apply(n[H],D)===false)break}else for(;R<P;){if(A.apply(n[R++],D)===false)break}else if(W)for(H in n){if(A.call(n[H],
+H,n[H])===false)break}else for(D=n[0];R<P&&A.call(D,R,D)!==false;D=n[++R]);return n},trim:ba?function(n){return n==null?"":ba.call(n)}:function(n){return n==null?"":n.toString().replace(o,"").replace(u,"")},makeArray:function(n,A){var D=A||[];if(n!=null){var H=b.type(n);n.length==null||H==="string"||H==="function"||H==="regexp"||b.isWindow(n)?Y.call(D,n):b.merge(D,n)}return D},inArray:function(n,A){if(A.indexOf)return A.indexOf(n);for(var D=0,H=A.length;D<H;D++)if(A[D]===n)return D;return-1},merge:function(n,
+A){var D=n.length,H=0;if(typeof A.length==="number")for(var R=A.length;H<R;H++)n[D++]=A[H];else for(;A[H]!==q;)n[D++]=A[H++];n.length=D;return n},grep:function(n,A,D){var H=[],R;D=!!D;for(var P=0,W=n.length;P<W;P++){R=!!A(n[P],P);D!==R&&H.push(n[P])}return H},map:function(n,A,D){for(var H=[],R,P=0,W=n.length;P<W;P++){R=A(n[P],P,D);if(R!=null)H[H.length]=R}return H.concat.apply([],H)},guid:1,proxy:function(n,A,D){if(arguments.length===2)if(typeof A==="string"){D=n;n=D[A];A=q}else if(A&&!b.isFunction(A)){D=
+A;A=q}if(!A&&n)A=function(){return n.apply(D||this,arguments)};if(n)A.guid=n.guid=n.guid||A.guid||b.guid++;return A},access:function(n,A,D,H,R,P){var W=n.length;if(typeof A==="object"){for(var da in A)b.access(n,da,A[da],H,R,D);return n}if(D!==q){H=!P&&H&&b.isFunction(D);for(da=0;da<W;da++)R(n[da],A,H?D.call(n[da],da,R(n[da],A)):D,P);return n}return W?R(n[0],A):q},now:function(){return(new Date).getTime()},uaMatch:function(n){n=n.toLowerCase();n=X.exec(n)||h.exec(n)||l.exec(n)||n.indexOf("compatible")<
+0&&t.exec(n)||[];return{browser:n[1]||"",version:n[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(n,A){ga["[object "+A+"]"]=A.toLowerCase()});s=b.uaMatch(s);if(s.browser){b.browser[s.browser]=true;b.browser.version=s.version}if(b.browser.webkit)b.browser.safari=true;if(M)b.inArray=function(n,A){return M.call(A,n)};if(!/\s/.test("\u00a0")){o=/^[\s\xA0]+/;u=/[\s\xA0]+$/}g=b(B);if(B.addEventListener)C=function(){B.removeEventListener("DOMContentLoaded",
+C,false);b.ready()};else if(B.attachEvent)C=function(){if(B.readyState==="complete"){B.detachEvent("onreadystatechange",C);b.ready()}};return j.jQuery=j.$=b}();(function(){c.support={};var a=B.documentElement,b=B.createElement("script"),e=B.createElement("div"),f="script"+c.now();e.style.display="none";e.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var g=e.getElementsByTagName("*"),i=e.getElementsByTagName("a")[0],p=B.createElement("select"),
+o=p.appendChild(B.createElement("option"));if(!(!g||!g.length||!i)){c.support={leadingWhitespace:e.firstChild.nodeType===3,tbody:!e.getElementsByTagName("tbody").length,htmlSerialize:!!e.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:e.getElementsByTagName("input")[0].value==="on",optSelected:o.selected,deleteExpando:true,optDisabled:false,checkClone:false,
+scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};p.disabled=true;c.support.optDisabled=!o.disabled;b.type="text/javascript";try{b.appendChild(B.createTextNode("window."+f+"=1;"))}catch(u){}a.insertBefore(b,a.firstChild);if(j[f]){c.support.scriptEval=true;delete j[f]}try{delete b.test}catch(F){c.support.deleteExpando=false}a.removeChild(b);if(e.attachEvent&&e.fireEvent){e.attachEvent("onclick",function z(){c.support.noCloneEvent=
+false;e.detachEvent("onclick",z)});e.cloneNode(true).fireEvent("onclick")}e=B.createElement("div");e.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=B.createDocumentFragment();a.appendChild(e.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var z=B.createElement("div");z.style.width=z.style.paddingLeft="1px";B.body.appendChild(z);c.boxModel=c.support.boxModel=z.offsetWidth===2;if("zoom"in z.style){z.style.display="inline";z.style.zoom=
+1;c.support.inlineBlockNeedsLayout=z.offsetWidth===2;z.style.display="";z.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=z.offsetWidth!==2}z.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var I=z.getElementsByTagName("td");c.support.reliableHiddenOffsets=I[0].offsetHeight===0;I[0].style.display="";I[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&I[0].offsetHeight===0;z.innerHTML="";B.body.removeChild(z).style.display=
+"none"});a=function(z){var I=B.createElement("div");z="on"+z;var L=z in I;if(!L){I.setAttribute(z,"return;");L=typeof I[z]==="function"}return L};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=e=g=i=null}})();var za={},Ra=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,e){if(c.acceptData(a)){a=a==j?za:a;var f=a.nodeType,g=f?a[c.expando]:null,i=
+c.cache;if(!(f&&!g&&typeof b==="string"&&e===q)){if(f)g||(a[c.expando]=g=++c.uuid);else i=a;if(typeof b==="object")if(f)i[g]=c.extend(i[g],b);else c.extend(i,b);else if(f&&!i[g])i[g]={};a=f?i[g]:i;if(e!==q)a[b]=e;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==j?za:a;var e=a.nodeType,f=e?a[c.expando]:a,g=c.cache,i=e?g[f]:f;if(b){if(i){delete i[b];e&&c.isEmptyObject(i)&&c.removeData(a)}}else if(e&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
+else if(e)delete g[f];else for(var p in a)delete a[p]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var e=null;if(typeof a==="undefined"){if(this.length){var f=this[0].attributes,g;e=c.data(this[0]);for(var i=0,p=f.length;i<p;i++){g=f[i].name;if(g.indexOf("data-")===0){g=g.substr(5);r(this[0],g,e[g])}}}return e}else if(typeof a==="object")return this.each(function(){c.data(this,
+a)});var o=a.split(".");o[1]=o[1]?"."+o[1]:"";if(b===q){e=this.triggerHandler("getData"+o[1]+"!",[o[0]]);if(e===q&&this.length){e=c.data(this[0],a);e=r(this[0],a,e)}return e===q&&o[1]?this.data(o[0]):e}else return this.each(function(){var u=c(this),F=[o[0],b];u.triggerHandler("setData"+o[1]+"!",F);c.data(this,a,b);u.triggerHandler("changeData"+o[1]+"!",F)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,e){if(a){b=(b||"fx")+"queue";var f=
+c.data(a,b);if(!e)return f||[];if(!f||c.isArray(e))f=c.data(a,b,c.makeArray(e));else f.push(e);return f}},dequeue:function(a,b){b=b||"fx";var e=c.queue(a,b),f=e.shift();if(f==="inprogress")f=e.shift();if(f){b==="fx"&&e.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===q)return c.queue(this[0],a);return this.each(function(){var e=c.queue(this,a,b);a==="fx"&&e[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
+a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var e=this;setTimeout(function(){c.dequeue(e,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ua=/\s+/,Ya=/\r/g,Za=/^(?:href|src|style)$/,$a=/^(?:button|input)$/i,ab=/^(?:button|input|object|select|textarea)$/i,cb=/^a(?:rea)?$/i,Ba=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
+colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(F){var z=c(this);z.addClass(a.call(this,F,z.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ua),e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===
+1)if(g.className){for(var i=" "+g.className+" ",p=g.className,o=0,u=b.length;o<u;o++)if(i.indexOf(" "+b[o]+" ")<0)p+=" "+b[o];g.className=c.trim(p)}else g.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(u){var F=c(this);F.removeClass(a.call(this,u,F.attr("class")))});if(a&&typeof a==="string"||a===q)for(var b=(a||"").split(ua),e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){for(var i=(" "+g.className+" ").replace(Aa," "),
+p=0,o=b.length;p<o;p++)i=i.replace(" "+b[p]+" "," ");g.className=c.trim(i)}else g.className=""}return this},toggleClass:function(a,b){var e=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(g){var i=c(this);i.toggleClass(a.call(this,g,i.attr("class"),b),b)});return this.each(function(){if(e==="string")for(var g,i=0,p=c(this),o=b,u=a.split(ua);g=u[i++];){o=f?o:!p.hasClass(g);p[o?"addClass":"removeClass"](g)}else if(e==="undefined"||e==="boolean"){this.className&&c.data(this,
+"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,e=this.length;b<e;b++)if((" "+this[b].className+" ").replace(Aa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var e=b.attributes.value;return!e||e.specified?b.value:b.text}if(c.nodeName(b,"select")){var f=b.selectedIndex;e=[];var g=b.options;b=b.type==="select-one";
+if(f<0)return null;var i=b?f:0;for(f=b?f+1:g.length;i<f;i++){var p=g[i];if(p.selected&&(c.support.optDisabled?!p.disabled:p.getAttribute("disabled")===null)&&(!p.parentNode.disabled||!c.nodeName(p.parentNode,"optgroup"))){a=c(p).val();if(b)return a;e.push(a)}}return e}if(Ba.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Ya,"")}return q}var o=c.isFunction(a);return this.each(function(u){var F=c(this),z=a;if(this.nodeType===1){if(o)z=
+a.call(this,u,F.val());if(z==null)z="";else if(typeof z==="number")z+="";else if(c.isArray(z))z=c.map(z,function(L){return L==null?"":L+""});if(c.isArray(z)&&Ba.test(this.type))this.checked=c.inArray(F.val(),z)>=0;else if(c.nodeName(this,"select")){var I=c.makeArray(z);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),I)>=0});if(!I.length)this.selectedIndex=-1}else this.value=z}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
+attr:function(a,b,e,f){if(!a||a.nodeType===3||a.nodeType===8)return q;if(f&&b in c.attrFn)return c(a)[b](e);f=a.nodeType!==1||!c.isXMLDoc(a);var g=e!==q;b=f&&c.props[b]||b;var i=Za.test(b);if((b in a||a[b]!==q)&&f&&!i){if(g){b==="type"&&$a.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(e===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=e}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
+b.specified?b.value:ab.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:q;return a[b]}if(!c.support.style&&f&&b==="style"){if(g)a.style.cssText=""+e;return a.style.cssText}g&&a.setAttribute(b,""+e);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return q;a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?q:a}});var la=/\.(.*)$/,va=/^(?:textarea|input|select)$/i,Sa=/\./g,Ta=/ /g,db=/[^\w\s.|`]/g,eb=function(a){return a.replace(db,"\\$&")},Ca={focusin:0,focusout:0};
+c.event={add:function(a,b,e,f){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==j&&!a.frameElement)a=j;if(e===false)e=x;else if(!e)return;var g,i;if(e.handler){g=e;e=g.handler}if(!e.guid)e.guid=c.guid++;if(i=c.data(a)){var p=a.nodeType?"events":"__events__",o=i[p],u=i.handle;if(typeof o==="function"){u=o.handle;o=o.events}else if(!o){a.nodeType||(i[p]=i=function(){});i.events=o={}}if(!u)i.handle=u=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(u.elem,
+arguments):q};u.elem=a;b=b.split(" ");for(var F=0,z;p=b[F++];){i=g?c.extend({},g):{handler:e,data:f};if(p.indexOf(".")>-1){z=p.split(".");p=z.shift();i.namespace=z.slice(0).sort().join(".")}else{z=[];i.namespace=""}i.type=p;if(!i.guid)i.guid=e.guid;var I=o[p],L=c.event.special[p]||{};if(!I){I=o[p]=[];if(!L.setup||L.setup.call(a,f,z,u)===false)if(a.addEventListener)a.addEventListener(p,u,false);else a.attachEvent&&a.attachEvent("on"+p,u)}if(L.add){L.add.call(a,i);if(!i.handler.guid)i.handler.guid=
+e.guid}I.push(i);c.event.global[p]=true}a=null}}},global:{},remove:function(a,b,e,f){if(!(a.nodeType===3||a.nodeType===8)){if(e===false)e=x;var g,i,p=0,o,u,F,z,I,L,T=a.nodeType?"events":"__events__",E=c.data(a),S=E&&E[T];if(E&&S){if(typeof S==="function"){E=S;S=S.events}if(b&&b.type){e=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(g in S)c.event.remove(a,g+b)}else{for(b=b.split(" ");g=b[p++];){z=g;o=g.indexOf(".")<0;u=[];if(!o){u=g.split(".");g=u.shift();F=RegExp("(^|\\.)"+
+c.map(u.slice(0).sort(),eb).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(I=S[g])if(e){z=c.event.special[g]||{};for(i=f||0;i<I.length;i++){L=I[i];if(e.guid===L.guid){if(o||F.test(L.namespace)){f==null&&I.splice(i--,1);z.remove&&z.remove.call(a,L)}if(f!=null)break}}if(I.length===0||f!=null&&I.length===1){if(!z.teardown||z.teardown.call(a,u)===false)c.removeEvent(a,g,E.handle);delete S[g]}}else for(i=0;i<I.length;i++){L=I[i];if(o||F.test(L.namespace)){c.event.remove(a,z,L.handler,i);I.splice(i--,1)}}}if(c.isEmptyObject(S)){if(b=
+E.handle)b.elem=null;delete E.events;delete E.handle;if(typeof E==="function")c.removeData(a,T);else c.isEmptyObject(E)&&c.removeData(a)}}}}},trigger:function(a,b,e,f){var g=a.type||a;if(!f){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(g),a):c.Event(g);if(g.indexOf("!")>=0){a.type=g=g.slice(0,-1);a.exclusive=true}if(!e){a.stopPropagation();c.event.global[g]&&c.each(c.cache,function(){this.events&&this.events[g]&&c.event.trigger(a,b,this.handle.elem)})}if(!e||e.nodeType===3||e.nodeType===
+8)return q;a.result=q;a.target=e;b=c.makeArray(b);b.unshift(a)}a.currentTarget=e;(f=e.nodeType?c.data(e,"handle"):(c.data(e,"__events__")||{}).handle)&&f.apply(e,b);f=e.parentNode||e.ownerDocument;try{if(!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()]))if(e["on"+g]&&e["on"+g].apply(e,b)===false){a.result=false;a.preventDefault()}}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){var p;f=a.target;var o=g.replace(la,""),u=c.nodeName(f,"a")&&o===
+"click",F=c.event.special[o]||{};if((!F._default||F._default.call(e,a)===false)&&!u&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[o]){if(p=f["on"+o])f["on"+o]=null;c.event.triggered=true;f[o]()}}catch(z){}if(p)f["on"+o]=p;c.event.triggered=false}}},handle:function(a){var b,e,f,g;e=[];var i=c.makeArray(arguments);a=i[0]=c.event.fix(a||j.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){f=a.type.split(".");a.type=f.shift();e=f.slice(0).sort();f=RegExp("(^|\\.)"+
+e.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||e.join(".");g=c.data(this,this.nodeType?"events":"__events__");if(typeof g==="function")g=g.events;e=(g||{})[a.type];if(g&&e){e=e.slice(0);g=0;for(var p=e.length;g<p;g++){var o=e[g];if(b||f.test(o.namespace)){a.handler=o.handler;a.data=o.data;a.handleObj=o;o=o.handler.apply(this,i);if(o!==q){a.result=o;if(o===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var e=this.props.length,f;e;){f=this.props[--e];a[f]=b[f]}if(!a.target)a.target=a.srcElement||B;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=B.documentElement;e=B.body;a.pageX=a.clientX+(b&&b.scrollLeft||e&&e.scrollLeft||0)-(b&&b.clientLeft||e&&e.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
+e&&e.scrollTop||0)-(b&&b.clientTop||e&&e.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==q)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,V(a.origType,a.selector),c.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
+V(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,e){if(c.isWindow(this))this.onbeforeunload=e},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=B.removeEventListener?function(a,b,e){a.removeEventListener&&a.removeEventListener(b,e,false)}:function(a,b,e){a.detachEvent&&a.detachEvent("on"+b,e)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
+c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K;this.stopPropagation()},isDefaultPrevented:x,isPropagationStopped:x,isImmediatePropagationStopped:x};
+var Da=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(e){}},Ea=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(e){c.event.add(this,b,e&&e.selector?Ea:Da,a)},teardown:function(e){c.event.remove(this,b,e&&e.selector?Ea:Da)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
+"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,e=b.type;if((e==="submit"||e==="image")&&c(b).closest("form").length){a.liveFired=q;return J("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,e=b.type;if((e==="text"||e==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=q;return J("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var ja,
+Fa=function(a){var b=a.type,e=a.value;if(b==="radio"||b==="checkbox")e=a.checked;else if(b==="select-multiple")e=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")e=a.selectedIndex;return e},ma=function(a,b){var e=a.target,f,g;if(!(!va.test(e.nodeName)||e.readOnly)){f=c.data(e,"_change_data");g=Fa(e);if(a.type!=="focusout"||e.type!=="radio")c.data(e,"_change_data",g);if(!(f===q||g===f))if(f!=null||g){a.type="change";a.liveFired=
+q;return c.event.trigger(a,b,e)}}};c.event.special.change={filters:{focusout:ma,beforedeactivate:ma,click:function(a){var b=a.target,e=b.type;if(e==="radio"||e==="checkbox"||b.nodeName.toLowerCase()==="select")return ma.call(this,a)},keydown:function(a){var b=a.target,e=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(e==="checkbox"||e==="radio")||e==="select-multiple")return ma.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",Fa(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in ja)c.event.add(this,a+".specialChange",ja[a]);return va.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return va.test(this.nodeName)}};ja=c.event.special.change.filters;ja.focus=ja.beforeactivate}B.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function e(f){f=c.event.fix(f);f.type=b;return c.event.trigger(f,null,f.target)}c.event.special[b]={setup:function(){Ca[b]++===0&&B.addEventListener(a,e,true)},teardown:function(){--Ca[b]===
+0&&B.removeEventListener(a,e,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(e,f,g){if(typeof e==="object"){for(var i in e)this[b](i,f,e[i],g);return this}if(c.isFunction(f)||f===false){g=f;f=q}var p=b==="one"?c.proxy(g,function(u){c(this).unbind(u,p);return g.apply(this,arguments)}):g;if(e==="unload"&&b!=="one")this.one(e,f,g);else{i=0;for(var o=this.length;i<o;i++)c.event.add(this[i],e,p,f)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var e in a)this.unbind(e,
+a[e]);else{e=0;for(var f=this.length;e<f;e++)c.event.remove(this[e],a,b)}return this},delegate:function(a,b,e,f){return this.live(b,e,f,a)},undelegate:function(a,b,e){return arguments.length===0?this.unbind("live"):this.die(b,null,e,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var e=c.Event(a);e.preventDefault();e.stopPropagation();c.event.trigger(e,b,this[0]);return e.result}},toggle:function(a){for(var b=arguments,e=
+1;e<b.length;)c.proxy(a,b[e++]);return this.click(c.proxy(a,function(f){var g=(c.data(this,"lastToggle"+a.guid)||0)%e;c.data(this,"lastToggle"+a.guid,g+1);f.preventDefault();return b[g].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Ga={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(e,f,g,i){var p,o=0,u,F,z=i||this.selector;i=i?this:c(this.context);if(typeof e===
+"object"&&!e.preventDefault){for(p in e)i[b](p,f,e[p],z);return this}if(c.isFunction(f)){g=f;f=q}for(e=(e||"").split(" ");(p=e[o++])!=null;){u=la.exec(p);F="";if(u){F=u[0];p=p.replace(la,"")}if(p==="hover")e.push("mouseenter"+F,"mouseleave"+F);else{u=p;if(p==="focus"||p==="blur"){e.push(Ga[p]+F);p+=F}else p=(Ga[p]||p)+F;if(b==="live"){F=0;for(var I=i.length;F<I;F++)c.event.add(i[F],"live."+V(p,z),{data:f,selector:z,handler:g,origType:p,origHandler:g,preType:u})}else i.unbind("live."+V(p,z),g)}}return this}});
+c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(e,f){if(f==null){f=e;e=null}return arguments.length>0?this.bind(b,e,f):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});j.attachEvent&&!j.addEventListener&&c(j).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(h,l,t,s,v,w){v=0;for(var C=s.length;v<C;v++){var G=s[v];if(G){var O=false;for(G=G[h];G;){if(G.sizcache===t){O=s[G.sizset];break}if(G.nodeType===1&&!w){G.sizcache=t;G.sizset=v}if(G.nodeName.toLowerCase()===l){O=G;break}G=G[h]}s[v]=O}}}function b(h,l,t,s,v,w){v=0;for(var C=s.length;v<C;v++){var G=s[v];if(G){var O=false;for(G=G[h];G;){if(G.sizcache===t){O=s[G.sizset];break}if(G.nodeType===1){if(!w){G.sizcache=t;G.sizset=v}if(typeof l!=="string"){if(G===l){O=true;break}}else if(o.filter(l,
+[G]).length>0){O=G;break}}G=G[h]}s[v]=O}}}var e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,f=0,g=Object.prototype.toString,i=false,p=true;[0,0].sort(function(){p=false;return 0});var o=function(h,l,t,s){t=t||[];var v=l=l||B;if(l.nodeType!==1&&l.nodeType!==9)return[];if(!h||typeof h!=="string")return t;var w,C,G,O,Y,Z=true,ba=o.isXML(l),M=[],ga=h;do{e.exec("");if(w=e.exec(ga)){ga=w[3];M.push(w[1]);if(w[2]){O=
+w[3];break}}}while(w);if(M.length>1&&F.exec(h))if(M.length===2&&u.relative[M[0]])C=X(M[0]+M[1],l);else for(C=u.relative[M[0]]?[l]:o(M.shift(),l);M.length;){h=M.shift();if(u.relative[h])h+=M.shift();C=X(h,C)}else{if(!s&&M.length>1&&l.nodeType===9&&!ba&&u.match.ID.test(M[0])&&!u.match.ID.test(M[M.length-1])){w=o.find(M.shift(),l,ba);l=w.expr?o.filter(w.expr,w.set)[0]:w.set[0]}if(l){w=s?{expr:M.pop(),set:L(s)}:o.find(M.pop(),M.length===1&&(M[0]==="~"||M[0]==="+")&&l.parentNode?l.parentNode:l,ba);C=w.expr?
+o.filter(w.expr,w.set):w.set;if(M.length>0)G=L(C);else Z=false;for(;M.length;){w=Y=M.pop();if(u.relative[Y])w=M.pop();else Y="";if(w==null)w=l;u.relative[Y](G,w,ba)}}else G=[]}G||(G=C);G||o.error(Y||h);if(g.call(G)==="[object Array]")if(Z)if(l&&l.nodeType===1)for(h=0;G[h]!=null;h++){if(G[h]&&(G[h]===true||G[h].nodeType===1&&o.contains(l,G[h])))t.push(C[h])}else for(h=0;G[h]!=null;h++)G[h]&&G[h].nodeType===1&&t.push(C[h]);else t.push.apply(t,G);else L(G,t);if(O){o(O,v,t,s);o.uniqueSort(t)}return t};
+o.uniqueSort=function(h){if(E){i=p;h.sort(E);if(i)for(var l=1;l<h.length;l++)h[l]===h[l-1]&&h.splice(l--,1)}return h};o.matches=function(h,l){return o(h,null,null,l)};o.matchesSelector=function(h,l){return o(l,null,null,[h]).length>0};o.find=function(h,l,t){var s;if(!h)return[];for(var v=0,w=u.order.length;v<w;v++){var C,G=u.order[v];if(C=u.leftMatch[G].exec(h)){var O=C[1];C.splice(1,1);if(O.substr(O.length-1)!=="\\"){C[1]=(C[1]||"").replace(/\\/g,"");s=u.find[G](C,l,t);if(s!=null){h=h.replace(u.match[G],
+"");break}}}}s||(s=l.getElementsByTagName("*"));return{set:s,expr:h}};o.filter=function(h,l,t,s){for(var v,w,C=h,G=[],O=l,Y=l&&l[0]&&o.isXML(l[0]);h&&l.length;){for(var Z in u.filter)if((v=u.leftMatch[Z].exec(h))!=null&&v[2]){var ba,M,ga=u.filter[Z];M=v[1];w=false;v.splice(1,1);if(M.substr(M.length-1)!=="\\"){if(O===G)G=[];if(u.preFilter[Z])if(v=u.preFilter[Z](v,O,t,G,s,Y)){if(v===true)continue}else w=ba=true;if(v)for(var n=0;(M=O[n])!=null;n++)if(M){ba=ga(M,v,n,O);var A=s^!!ba;if(t&&ba!=null)if(A)w=
+true;else O[n]=false;else if(A){G.push(M);w=true}}if(ba!==q){t||(O=G);h=h.replace(u.match[Z],"");if(!w)return[];break}}}if(h===C)if(w==null)o.error(h);else break;C=h}return O};o.error=function(h){throw"Syntax error, unrecognized expression: "+h;};var u=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(h){return h.getAttribute("href")}},relative:{"+":function(h,l){var t=typeof l==="string",s=t&&!/\W/.test(l);t=t&&!s;if(s)l=l.toLowerCase();s=0;for(var v=h.length,
+w;s<v;s++)if(w=h[s]){for(;(w=w.previousSibling)&&w.nodeType!==1;);h[s]=t||w&&w.nodeName.toLowerCase()===l?w||false:w===l}t&&o.filter(l,h,true)},">":function(h,l){var t,s=typeof l==="string",v=0,w=h.length;if(s&&!/\W/.test(l))for(l=l.toLowerCase();v<w;v++){if(t=h[v]){t=t.parentNode;h[v]=t.nodeName.toLowerCase()===l?t:false}}else{for(;v<w;v++)if(t=h[v])h[v]=s?t.parentNode:t.parentNode===l;s&&o.filter(l,h,true)}},"":function(h,l,t){var s,v=f++,w=b;if(typeof l==="string"&&!/\W/.test(l)){s=l=l.toLowerCase();
+w=a}w("parentNode",l,v,h,s,t)},"~":function(h,l,t){var s,v=f++,w=b;if(typeof l==="string"&&!/\W/.test(l)){s=l=l.toLowerCase();w=a}w("previousSibling",l,v,h,s,t)}},find:{ID:function(h,l,t){if(typeof l.getElementById!=="undefined"&&!t)return(h=l.getElementById(h[1]))&&h.parentNode?[h]:[]},NAME:function(h,l){if(typeof l.getElementsByName!=="undefined"){for(var t=[],s=l.getElementsByName(h[1]),v=0,w=s.length;v<w;v++)s[v].getAttribute("name")===h[1]&&t.push(s[v]);return t.length===0?null:t}},TAG:function(h,
+l){return l.getElementsByTagName(h[1])}},preFilter:{CLASS:function(h,l,t,s,v,w){h=" "+h[1].replace(/\\/g,"")+" ";if(w)return h;w=0;for(var C;(C=l[w])!=null;w++)if(C)if(v^(C.className&&(" "+C.className+" ").replace(/[\t\n]/g," ").indexOf(h)>=0))t||s.push(C);else if(t)l[w]=false;return false},ID:function(h){return h[1].replace(/\\/g,"")},TAG:function(h){return h[1].toLowerCase()},CHILD:function(h){if(h[1]==="nth"){var l=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(h[2]==="even"&&"2n"||h[2]==="odd"&&"2n+1"||!/\D/.test(h[2])&&
+"0n+"+h[2]||h[2]);h[2]=l[1]+(l[2]||1)-0;h[3]=l[3]-0}h[0]=f++;return h},ATTR:function(h,l,t,s,v,w){l=h[1].replace(/\\/g,"");if(!w&&u.attrMap[l])h[1]=u.attrMap[l];if(h[2]==="~=")h[4]=" "+h[4]+" ";return h},PSEUDO:function(h,l,t,s,v){if(h[1]==="not")if((e.exec(h[3])||"").length>1||/^\w/.test(h[3]))h[3]=o(h[3],null,null,l);else{h=o.filter(h[3],l,t,true^v);t||s.push.apply(s,h);return false}else if(u.match.POS.test(h[0])||u.match.CHILD.test(h[0]))return true;return h},POS:function(h){h.unshift(true);return h}},
+filters:{enabled:function(h){return h.disabled===false&&h.type!=="hidden"},disabled:function(h){return h.disabled===true},checked:function(h){return h.checked===true},selected:function(h){return h.selected===true},parent:function(h){return!!h.firstChild},empty:function(h){return!h.firstChild},has:function(h,l,t){return!!o(t[3],h).length},header:function(h){return/h\d/i.test(h.nodeName)},text:function(h){return"text"===h.type},radio:function(h){return"radio"===h.type},checkbox:function(h){return"checkbox"===
+h.type},file:function(h){return"file"===h.type},password:function(h){return"password"===h.type},submit:function(h){return"submit"===h.type},image:function(h){return"image"===h.type},reset:function(h){return"reset"===h.type},button:function(h){return"button"===h.type||h.nodeName.toLowerCase()==="button"},input:function(h){return/input|select|textarea|button/i.test(h.nodeName)}},setFilters:{first:function(h,l){return l===0},last:function(h,l,t,s){return l===s.length-1},even:function(h,l){return l%2===
+0},odd:function(h,l){return l%2===1},lt:function(h,l,t){return l<t[3]-0},gt:function(h,l,t){return l>t[3]-0},nth:function(h,l,t){return t[3]-0===l},eq:function(h,l,t){return t[3]-0===l}},filter:{PSEUDO:function(h,l,t,s){var v=l[1],w=u.filters[v];if(w)return w(h,t,l,s);else if(v==="contains")return(h.textContent||h.innerText||o.getText([h])||"").indexOf(l[3])>=0;else if(v==="not"){l=l[3];t=0;for(s=l.length;t<s;t++)if(l[t]===h)return false;return true}else o.error("Syntax error, unrecognized expression: "+
+v)},CHILD:function(h,l){var t=l[1],s=h;switch(t){case "only":case "first":for(;s=s.previousSibling;)if(s.nodeType===1)return false;if(t==="first")return true;s=h;case "last":for(;s=s.nextSibling;)if(s.nodeType===1)return false;return true;case "nth":t=l[2];var v=l[3];if(t===1&&v===0)return true;var w=l[0],C=h.parentNode;if(C&&(C.sizcache!==w||!h.nodeIndex)){var G=0;for(s=C.firstChild;s;s=s.nextSibling)if(s.nodeType===1)s.nodeIndex=++G;C.sizcache=w}s=h.nodeIndex-v;return t===0?s===0:s%t===0&&s/t>=
+0}},ID:function(h,l){return h.nodeType===1&&h.getAttribute("id")===l},TAG:function(h,l){return l==="*"&&h.nodeType===1||h.nodeName.toLowerCase()===l},CLASS:function(h,l){return(" "+(h.className||h.getAttribute("class"))+" ").indexOf(l)>-1},ATTR:function(h,l){var t=l[1];t=u.attrHandle[t]?u.attrHandle[t](h):h[t]!=null?h[t]:h.getAttribute(t);var s=t+"",v=l[2],w=l[4];return t==null?v==="!=":v==="="?s===w:v==="*="?s.indexOf(w)>=0:v==="~="?(" "+s+" ").indexOf(w)>=0:!w?s&&t!==false:v==="!="?s!==w:v==="^="?
+s.indexOf(w)===0:v==="$="?s.substr(s.length-w.length)===w:v==="|="?s===w||s.substr(0,w.length+1)===w+"-":false},POS:function(h,l,t,s){var v=u.setFilters[l[2]];if(v)return v(h,t,l,s)}}},F=u.match.POS,z=function(h,l){return"\\"+(l-0+1)},I;for(I in u.match){u.match[I]=RegExp(u.match[I].source+/(?![^\[]*\])(?![^\(]*\))/.source);u.leftMatch[I]=RegExp(/(^(?:.|\r|\n)*?)/.source+u.match[I].source.replace(/\\(\d+)/g,z))}var L=function(h,l){h=Array.prototype.slice.call(h,0);if(l){l.push.apply(l,h);return l}return h};
+try{Array.prototype.slice.call(B.documentElement.childNodes,0)}catch(T){L=function(h,l){var t=0,s=l||[];if(g.call(h)==="[object Array]")Array.prototype.push.apply(s,h);else if(typeof h.length==="number")for(var v=h.length;t<v;t++)s.push(h[t]);else for(;h[t];t++)s.push(h[t]);return s}}var E,S;if(B.documentElement.compareDocumentPosition)E=function(h,l){if(h===l){i=true;return 0}if(!h.compareDocumentPosition||!l.compareDocumentPosition)return h.compareDocumentPosition?-1:1;return h.compareDocumentPosition(l)&
+4?-1:1};else{E=function(h,l){var t,s,v=[],w=[];t=h.parentNode;s=l.parentNode;var C=t;if(h===l){i=true;return 0}else if(t===s)return S(h,l);else if(t){if(!s)return 1}else return-1;for(;C;){v.unshift(C);C=C.parentNode}for(C=s;C;){w.unshift(C);C=C.parentNode}t=v.length;s=w.length;for(C=0;C<t&&C<s;C++)if(v[C]!==w[C])return S(v[C],w[C]);return C===t?S(h,w[C],-1):S(v[C],l,1)};S=function(h,l,t){if(h===l)return t;for(h=h.nextSibling;h;){if(h===l)return-1;h=h.nextSibling}return 1}}o.getText=function(h){for(var l=
+"",t,s=0;h[s];s++){t=h[s];if(t.nodeType===3||t.nodeType===4)l+=t.nodeValue;else if(t.nodeType!==8)l+=o.getText(t.childNodes)}return l};(function(){var h=B.createElement("div"),l="script"+(new Date).getTime(),t=B.documentElement;h.innerHTML="<a name='"+l+"'/>";t.insertBefore(h,t.firstChild);if(B.getElementById(l)){u.find.ID=function(s,v,w){if(typeof v.getElementById!=="undefined"&&!w)return(v=v.getElementById(s[1]))?v.id===s[1]||typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id").nodeValue===
+s[1]?[v]:q:[]};u.filter.ID=function(s,v){var w=typeof s.getAttributeNode!=="undefined"&&s.getAttributeNode("id");return s.nodeType===1&&w&&w.nodeValue===v}}t.removeChild(h);t=h=null})();(function(){var h=B.createElement("div");h.appendChild(B.createComment(""));if(h.getElementsByTagName("*").length>0)u.find.TAG=function(l,t){var s=t.getElementsByTagName(l[1]);if(l[1]==="*"){for(var v=[],w=0;s[w];w++)s[w].nodeType===1&&v.push(s[w]);s=v}return s};h.innerHTML="<a href='#'></a>";if(h.firstChild&&typeof h.firstChild.getAttribute!==
+"undefined"&&h.firstChild.getAttribute("href")!=="#")u.attrHandle.href=function(l){return l.getAttribute("href",2)};h=null})();B.querySelectorAll&&function(){var h=o,l=B.createElement("div");l.innerHTML="<p class='TEST'></p>";if(!(l.querySelectorAll&&l.querySelectorAll(".TEST").length===0)){o=function(s,v,w,C){v=v||B;s=s.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!C&&!o.isXML(v))if(v.nodeType===9)try{return L(v.querySelectorAll(s),w)}catch(G){}else if(v.nodeType===1&&v.nodeName.toLowerCase()!==
+"object"){var O=v.getAttribute("id"),Y=O||"__sizzle__";O||v.setAttribute("id",Y);try{return L(v.querySelectorAll("#"+Y+" "+s),w)}catch(Z){}finally{O||v.removeAttribute("id")}}return h(s,v,w,C)};for(var t in h)o[t]=h[t];l=null}}();(function(){var h=B.documentElement,l=h.matchesSelector||h.mozMatchesSelector||h.webkitMatchesSelector||h.msMatchesSelector,t=false;try{l.call(B.documentElement,"[test!='']:sizzle")}catch(s){t=true}if(l)o.matchesSelector=function(v,w){w=w.replace(/\=\s*([^'"\]]*)\s*\]/g,
+"='$1']");if(!o.isXML(v))try{if(t||!u.match.PSEUDO.test(w)&&!/!=/.test(w))return l.call(v,w)}catch(C){}return o(w,null,null,[v]).length>0}})();(function(){var h=B.createElement("div");h.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!h.getElementsByClassName||h.getElementsByClassName("e").length===0)){h.lastChild.className="e";if(h.getElementsByClassName("e").length!==1){u.order.splice(1,0,"CLASS");u.find.CLASS=function(l,t,s){if(typeof t.getElementsByClassName!=="undefined"&&
+!s)return t.getElementsByClassName(l[1])};h=null}}})();o.contains=B.documentElement.contains?function(h,l){return h!==l&&(h.contains?h.contains(l):true)}:B.documentElement.compareDocumentPosition?function(h,l){return!!(h.compareDocumentPosition(l)&16)}:function(){return false};o.isXML=function(h){return(h=(h?h.ownerDocument||h:0).documentElement)?h.nodeName!=="HTML":false};var X=function(h,l){for(var t,s=[],v="",w=l.nodeType?[l]:l;t=u.match.PSEUDO.exec(h);){v+=t[0];h=h.replace(u.match.PSEUDO,"")}h=
+u.relative[h]?h+"*":h;t=0;for(var C=w.length;t<C;t++)o(h,w[t],s);return o.filter(v,s)};c.find=o;c.expr=o.selectors;c.expr[":"]=c.expr.filters;c.unique=o.uniqueSort;c.text=o.getText;c.isXMLDoc=o.isXML;c.contains=o.contains})();var fb=/Until$/,gb=/^(?:parents|prevUntil|prevAll)/,hb=/,/,Ua=/^.[^:#\[\.,]*$/,ib=Array.prototype.slice,jb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),e=0,f=0,g=this.length;f<g;f++){e=b.length;c.find(a,this[f],b);if(f>0)for(var i=e;i<
+b.length;i++)for(var p=0;p<e;p++)if(b[p]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var e=0,f=b.length;e<f;e++)if(c.contains(this,b[e]))return true})},not:function(a){return this.pushStack(Q(this,a,false),"not",a)},filter:function(a){return this.pushStack(Q(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var e=[],f,g,i=this[0];if(c.isArray(a)){var p,o={},u=1;if(i&&a.length){f=0;for(g=a.length;f<
+g;f++){p=a[f];o[p]||(o[p]=c.expr.match.POS.test(p)?c(p,b||this.context):p)}for(;i&&i.ownerDocument&&i!==b;){for(p in o){f=o[p];if(f.jquery?f.index(i)>-1:c(i).is(f))e.push({selector:p,elem:i,level:u})}i=i.parentNode;u++}}return e}p=jb.test(a)?c(a,b||this.context):null;f=0;for(g=this.length;f<g;f++)for(i=this[f];i;)if(p?p.index(i)>-1:c.find.matchesSelector(i,a)){e.push(i);break}else{i=i.parentNode;if(!i||!i.ownerDocument||i===b)break}e=e.length>1?c.unique(e):e;return this.pushStack(e,"closest",a)},
+index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var e=typeof a==="string"?c(a,b||this.context):c.makeArray(a),f=c.merge(this.get(),e);return this.pushStack(!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11||!f[0]||!f[0].parentNode||f[0].parentNode.nodeType===11?f:c.unique(f))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&
+a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,e){return c.dir(a,"parentNode",e)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,e){return c.dir(a,"nextSibling",e)},prevUntil:function(a,b,e){return c.dir(a,"previousSibling",e)},siblings:function(a){return c.sibling(a.parentNode.firstChild,
+a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(e,f){var g=c.map(this,b,e);fb.test(a)||(f=e);if(f&&typeof f==="string")g=c.filter(f,g);g=this.length>1?c.unique(g):g;if((this.length>1||hb.test(f))&&gb.test(a))g=g.reverse();return this.pushStack(g,a,ib.call(arguments).join(","))}});c.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return b.length===
+1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,e){var f=[];for(a=a[b];a&&a.nodeType!==9&&(e===q||a.nodeType!==1||!c(a).is(e));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,e){b=b||1;for(var f=0;a;a=a[e])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var Ha=/ jQuery\d+="(?:\d+|null)"/g,na=/^\s+/,Ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
+Ja=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,Ka=/<(?:script|object|embed|option|style)/i,La=/checked\s*(?:[^=]|=\s*.checked.)/i,mb=/\=([^="'>\s]+\/)>/g,ca={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};ca.optgroup=ca.option;
+ca.tbody=ca.tfoot=ca.colgroup=ca.caption=ca.thead;ca.th=ca.td;if(!c.support.htmlSerialize)ca._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var e=c(this);e.text(a.call(this,b,e.text()))});if(typeof a!=="object"&&a!==q)return this.empty().append((this[0]&&this[0].ownerDocument||B).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(e){c(this).wrapAll(a.call(this,e))});if(this[0]){var b=
+c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var e=this;e.firstChild&&e.firstChild.nodeType===1;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),e=b.contents();e.length?e.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,
+"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());
+return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var e=0,f;(f=this[e])!=null;e++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&
+f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var e=this.outerHTML,f=this.ownerDocument;if(!e){e=f.createElement("div");e.appendChild(this.cloneNode(true));e=e.innerHTML}return c.clean([e.replace(Ha,"").replace(mb,'="$1">').replace(na,"")],f)[0]}else return this.cloneNode(true)});
+if(a===true){ea(this,b);ea(this.find("*"),b.find("*"))}return b},html:function(a){if(a===q)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ha,""):null;else if(typeof a==="string"&&!Ka.test(a)&&(c.support.leadingWhitespace||!na.test(a))&&!ca[(Ja.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ia,"<$1></$2>");try{for(var b=0,e=this.length;b<e;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(f){this.empty().append(a)}}else c.isFunction(a)?
+this.each(function(g){var i=c(this);i.html(a.call(this,g,i.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var e=c(this),f=e.html();e.replaceWith(a.call(this,b,f))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,e=this.parentNode;c(this).remove();b?c(b).before(a):c(e).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,
+true)},domManip:function(a,b,e){var f,g,i,p=a[0],o=[];if(!c.support.checkClone&&arguments.length===3&&typeof p==="string"&&La.test(p))return this.each(function(){c(this).domManip(a,b,e,true)});if(c.isFunction(p))return this.each(function(F){var z=c(this);a[0]=p.call(this,F,b?z.html():q);z.domManip(a,b,e)});if(this[0]){f=p&&p.parentNode;f=c.support.parentNode&&f&&f.nodeType===11&&f.childNodes.length===this.length?{fragment:f}:c.buildFragment(a,this,o);i=f.fragment;if(g=i.childNodes.length===1?i=i.firstChild:
+i.firstChild){b=b&&c.nodeName(g,"tr");g=0;for(var u=this.length;g<u;g++)e.call(b?c.nodeName(this[g],"table")?this[g].getElementsByTagName("tbody")[0]||this[g].appendChild(this[g].ownerDocument.createElement("tbody")):this[g]:this[g],g>0||f.cacheable||this.length>1?i.cloneNode(true):i)}o.length&&c.each(o,qa)}return this}});c.buildFragment=function(a,b,e){var f,g,i;b=b&&b[0]?b[0].ownerDocument||b[0]:B;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===B&&!Ka.test(a[0])&&(c.support.checkClone||
+!La.test(a[0]))){g=true;if(i=c.fragments[a[0]])if(i!==1)f=i}if(!f){f=b.createDocumentFragment();c.clean(a,b,f,e)}if(g)c.fragments[a[0]]=i?f:1;return{fragment:f,cacheable:g}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(e){var f=[];e=c(e);var g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}else{g=0;for(var i=
+e.length;g<i;g++){var p=(g>0?this.clone(true):this).get();c(e[g])[b](p);f=f.concat(p)}return this.pushStack(f,a,e.selector)}}});c.extend({clean:function(a,b,e,f){b=b||B;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||B;for(var g=[],i=0,p;(p=a[i])!=null;i++){if(typeof p==="number")p+="";if(p){if(typeof p==="string"&&!lb.test(p))p=b.createTextNode(p);else if(typeof p==="string"){p=p.replace(Ia,"<$1></$2>");var o=(Ja.exec(p)||["",""])[1].toLowerCase(),u=ca[o]||ca._default,
+F=u[0],z=b.createElement("div");for(z.innerHTML=u[1]+p+u[2];F--;)z=z.lastChild;if(!c.support.tbody){F=kb.test(p);o=o==="table"&&!F?z.firstChild&&z.firstChild.childNodes:u[1]==="<table>"&&!F?z.childNodes:[];for(u=o.length-1;u>=0;--u)c.nodeName(o[u],"tbody")&&!o[u].childNodes.length&&o[u].parentNode.removeChild(o[u])}!c.support.leadingWhitespace&&na.test(p)&&z.insertBefore(b.createTextNode(na.exec(p)[0]),z.firstChild);p=z.childNodes}if(p.nodeType)g.push(p);else g=c.merge(g,p)}}if(e)for(i=0;g[i];i++)if(f&&
+c.nodeName(g[i],"script")&&(!g[i].type||g[i].type.toLowerCase()==="text/javascript"))f.push(g[i].parentNode?g[i].parentNode.removeChild(g[i]):g[i]);else{g[i].nodeType===1&&g.splice.apply(g,[i+1,0].concat(c.makeArray(g[i].getElementsByTagName("script"))));e.appendChild(g[i])}return g},cleanData:function(a){for(var b,e,f=c.cache,g=c.event.special,i=c.support.deleteExpando,p=0,o;(o=a[p])!=null;p++)if(!(o.nodeName&&c.noData[o.nodeName.toLowerCase()]))if(e=o[c.expando]){if((b=f[e])&&b.events)for(var u in b.events)g[u]?
+c.event.remove(o,u):c.removeEvent(o,u,b.handle);if(i)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[e]}}});var Ma=/alpha\([^)]*\)/i,nb=/opacity=([^)]*)/,ob=/-([a-z])/ig,pb=/([A-Z])/g,Na=/^-?\d+(?:px)?$/i,qb=/^-?\d/,rb={position:"absolute",visibility:"hidden",display:"block"},Va=["Left","Right"],Wa=["Top","Bottom"],ka,Oa,oa,sb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===q)return this;return c.access(this,a,b,true,function(e,
+f,g){return g!==q?c.style(e,f,g):c.css(e,f)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var e=ka(a,"opacity","opacity");return e===""?"1":e}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,e,f){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var g,i=c.camelCase(b),p=a.style,o=c.cssHooks[i];b=c.cssProps[i]||i;if(e!==q){if(!(typeof e==="number"&&
+isNaN(e)||e==null)){if(typeof e==="number"&&!c.cssNumber[i])e+="px";if(!o||!("set"in o)||(e=o.set(a,e))!==q)try{p[b]=e}catch(u){}}}else{if(o&&"get"in o&&(g=o.get(a,false,f))!==q)return g;return p[b]}}},css:function(a,b,e){var f,g=c.camelCase(b),i=c.cssHooks[g];b=c.cssProps[g]||g;if(i&&"get"in i&&(f=i.get(a,true,e))!==q)return f;else if(ka)return ka(a,b,g)},swap:function(a,b,e){var f={},g;for(g in b){f[g]=a.style[g];a.style[g]=b[g]}e.call(a);for(g in b)a.style[g]=f[g]},camelCase:function(a){return a.replace(ob,
+sb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(e,f,g){var i;if(f){if(e.offsetWidth!==0)i=U(e,b,g);else c.swap(e,rb,function(){i=U(e,b,g)});if(i<=0){i=ka(e,b,b);if(i==="0px"&&oa)i=oa(e,b,b);if(i!=null)return i===""||i==="auto"?"0px":i}if(i<0||i==null){i=e.style[b];return i===""||i==="auto"?"0px":i}return typeof i==="string"?i:i+"px"}},set:function(e,f){if(Na.test(f)){f=parseFloat(f);if(f>=0)return f+"px"}else return f}}});if(!c.support.opacity)c.cssHooks.opacity=
+{get:function(a,b){return nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var e=a.style;e.zoom=1;var f=c.isNaN(b)?"":"alpha(opacity="+b*100+")",g=e.filter||"";e.filter=Ma.test(g)?g.replace(Ma,f):e.filter+" "+f}};if(B.defaultView&&B.defaultView.getComputedStyle)Oa=function(a,b,e){var f;e=e.replace(pb,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return q;if(b=b.getComputedStyle(a,null)){f=b.getPropertyValue(e);
+if(f===""&&!c.contains(a.ownerDocument.documentElement,a))f=c.style(a,e)}return f};if(B.documentElement.currentStyle)oa=function(a,b){var e,f,g=a.currentStyle&&a.currentStyle[b],i=a.style;if(!Na.test(g)&&qb.test(g)){e=i.left;f=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;i.left=b==="fontSize"?"1em":g||0;g=i.pixelLeft+"px";i.left=e;a.runtimeStyle.left=f}return g===""?"auto":g};ka=Oa||oa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===
+0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var ub=c.now(),vb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,wb=/^(?:select|textarea)/i,xb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,yb=/^(?:GET|HEAD)$/,Xa=/\[\]$/,ia=/\=\?(&|$)/,wa=/\?/,zb=/([?&])_=[^&]*/,Ab=/^(\w+:)?\/\/([^\/?#]+)/,Bb=/%20/g,Cb=/#.*$/,Pa=c.fn.load;c.fn.extend({load:function(a,
+b,e){if(typeof a!=="string"&&Pa)return Pa.apply(this,arguments);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){e=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var i=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(p,o){if(o==="success"||o==="notmodified")i.html(g?c("<div>").append(p.responseText.replace(vb,"")).find(g):p.responseText);e&&i.each(e,[p.responseText,
+o,p])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||wb.test(this.nodeName)||xb.test(this.type))}).map(function(a,b){var e=c(this).val();return e==null?null:c.isArray(e)?c.map(e,function(f){return{name:b.name,value:f}}):{name:b.name,value:e}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),
+function(a,b){c.fn[b]=function(e){return this.bind(b,e)}});c.extend({get:function(a,b,e,f){if(c.isFunction(b)){f=f||e;e=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:e,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,e){return c.get(a,b,e,"json")},post:function(a,b,e,f){if(c.isFunction(b)){f=f||e;e=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:e,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,
+global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new j.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),e,f,g,i=b.type.toUpperCase(),p=yb.test(i);b.url=b.url.replace(Cb,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&
+b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(i==="GET")ia.test(b.url)||(b.url+=(wa.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||!ia.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&ia.test(b.data)||ia.test(b.url))){e=b.jsonpCallback||"jsonp"+ub++;if(b.data)b.data=(b.data+"").replace(ia,"="+e+"$1");b.url=b.url.replace(ia,"="+e+"$1");b.dataType="script";
+var o=j[e];j[e]=function(s){if(c.isFunction(o))o(s);else{j[e]=q;try{delete j[e]}catch(v){}}g=s;c.handleSuccess(b,E,f,g);c.handleComplete(b,E,f,g);z&&z.removeChild(I)}}if(b.dataType==="script"&&b.cache===null)b.cache=false;if(b.cache===false&&p){var u=c.now(),F=b.url.replace(zb,"$1_="+u);b.url=F+(F===b.url?(wa.test(b.url)?"&":"?")+"_="+u:"")}if(b.data&&p)b.url+=(wa.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");u=(u=Ab.exec(b.url))&&(u[1]&&u[1].toLowerCase()!==location.protocol||
+u[2].toLowerCase()!==location.host);if(b.dataType==="script"&&i==="GET"&&u){var z=B.getElementsByTagName("head")[0]||B.documentElement,I=B.createElement("script");if(b.scriptCharset)I.charset=b.scriptCharset;I.src=b.url;if(!e){var L=false;I.onload=I.onreadystatechange=function(){if(!L&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){L=true;c.handleSuccess(b,E,f,g);c.handleComplete(b,E,f,g);I.onload=I.onreadystatechange=null;z&&I.parentNode&&z.removeChild(I)}}}z.insertBefore(I,
+z.firstChild);return q}var T=false,E=b.xhr();if(E){b.username?E.open(i,b.url,b.async,b.username,b.password):E.open(i,b.url,b.async);try{if(b.data!=null&&!p||a&&a.contentType)E.setRequestHeader("Content-Type",b.contentType);if(b.ifModified){c.lastModified[b.url]&&E.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&E.setRequestHeader("If-None-Match",c.etag[b.url])}u||E.setRequestHeader("X-Requested-With","XMLHttpRequest");E.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?
+b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(S){}if(b.beforeSend&&b.beforeSend.call(b.context,E,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");E.abort();return false}b.global&&c.triggerGlobal(b,"ajaxSend",[E,b]);var X=E.onreadystatechange=function(s){if(!E||E.readyState===0||s==="abort"){T||c.handleComplete(b,E,f,g);T=true;if(E)E.onreadystatechange=c.noop}else if(!T&&E&&(E.readyState===4||s==="timeout")){T=true;E.onreadystatechange=c.noop;f=s==="timeout"?"timeout":
+!c.httpSuccess(E)?"error":b.ifModified&&c.httpNotModified(E,b.url)?"notmodified":"success";var v;if(f==="success")try{g=c.httpData(E,b.dataType,b)}catch(w){f="parsererror";v=w}if(f==="success"||f==="notmodified")e||c.handleSuccess(b,E,f,g);else c.handleError(b,E,f,v);e||c.handleComplete(b,E,f,g);s==="timeout"&&E.abort();if(b.async)E=null}};try{var h=E.abort;E.abort=function(){E&&Function.prototype.call.call(h,E);X("abort")}}catch(l){}b.async&&b.timeout>0&&setTimeout(function(){E&&!T&&X("timeout")},
+b.timeout);try{E.send(p||b.data==null?null:b.data)}catch(t){c.handleError(b,E,null,t);c.handleComplete(b,E,f,g)}b.async||X();return E}},param:function(a,b){var e=[],f=function(i,p){p=c.isFunction(p)?p():p;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(p)};if(b===q)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var g in a)fa(g,a[g],b,f);return e.join("&").replace(Bb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,
+b,e,f){a.error&&a.error.call(a.context,b,e,f);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,f])},handleSuccess:function(a,b,e,f){a.success&&a.success.call(a.context,f,e,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,b,e){a.complete&&a.complete.call(a.context,b,e);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,e){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,e)},httpSuccess:function(a){try{return!a.status&&
+location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var e=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(e)c.lastModified[b]=e;if(f)c.etag[b]=f;return a.status===304},httpData:function(a,b,e){var f=a.getResponseHeader("content-type")||"",g=b==="xml"||!b&&f.indexOf("xml")>=0;a=g?a.responseXML:a.responseText;g&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(e&&e.dataFilter)a=
+e.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a}});if(j.ActiveXObject)c.ajaxSettings.xhr=function(){if(j.location.protocol!=="file:")try{return new j.XMLHttpRequest}catch(a){}try{return new j.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ra={},Db=/^(?:toggle|show|hide)$/,Eb=/^([+\-]=)?([\d+.\-]+)(.*)$/,pa,xa=[["height","marginTop",
+"marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,e){if(a||a===0)return this.animate(ha("show",3),a,b,e);else{e=0;for(var f=this.length;e<f;e++){a=this[e];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",ya(a.nodeName))}for(e=0;e<f;e++){a=this[e];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,
+"olddisplay")||""}return this}},hide:function(a,b,e){if(a||a===0)return this.animate(ha("hide",3),a,b,e);else{a=0;for(b=this.length;a<b;a++){e=c.css(this[a],"display");e!=="none"&&c.data(this[a],"olddisplay",e)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,e){var f=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||f?this.each(function(){var g=f?a:c(this).is(":hidden");c(this)[g?"show":"hide"]()}):
+this.animate(ha("toggle",3),a,b,e);return this},fadeTo:function(a,b,e,f){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,e,f)},animate:function(a,b,e,f){var g=c.speed(b,e,f);if(c.isEmptyObject(a))return this.each(g.complete);return this[g.queue===false?"each":"queue"](function(){var i=c.extend({},g),p,o=this.nodeType===1,u=o&&c(this).is(":hidden"),F=this;for(p in a){var z=c.camelCase(p);if(p!==z){a[z]=a[p];delete a[p];p=z}if(a[p]==="hide"&&u||a[p]==="show"&&!u)return i.complete.call(this);
+if(o&&(p==="height"||p==="width")){i.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(ya(this.nodeName)==="inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[p])){(i.specialEasing=i.specialEasing||{})[p]=a[p][1];a[p]=a[p][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=
+c.extend({},a);c.each(a,function(I,L){var T=new c.fx(F,i,I);if(Db.test(L))T[L==="toggle"?u?"show":"hide":L](a);else{var E=Eb.exec(L),S=T.cur()||0;if(E){var X=parseFloat(E[2]),h=E[3]||"px";if(h!=="px"){c.style(F,I,(X||1)+h);S=(X||1)/T.cur()*S;c.style(F,I,S+h)}if(E[1])X=(E[1]==="-="?-1:1)*X+S;T.custom(S,X,h)}else T.custom(S,L,"")}});return true})},stop:function(a,b){var e=c.timers;a&&this.queue([]);this.each(function(){for(var f=e.length-1;f>=0;f--)if(e[f].elem===this){b&&e[f](true);e.splice(f,1)}});
+b||this.dequeue();return this}});c.each({slideDown:ha("show",1),slideUp:ha("hide",1),slideToggle:ha("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(e,f,g){return this.animate(b,e,f,g)}});c.extend({speed:function(a,b,e){var f=a&&typeof a==="object"?c.extend({},a):{complete:e||!e&&b||c.isFunction(a)&&a,duration:a,easing:e&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration==="number"?f.duration:f.duration in c.fx.speeds?
+c.fx.speeds[f.duration]:c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,e,f){return e+f*a},swing:function(a,b,e,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+e}},timers:[],fx:function(a,b,e){this.options=b;this.elem=a;this.prop=e;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},
+cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,e){function f(p){return g.step(p)}var g=this,i=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=e||this.unit||"px";this.now=this.start;this.pos=this.state=0;f.elem=this.elem;if(f()&&c.timers.push(f)&&!pa)pa=setInterval(i.tick,i.interval)},show:function(){this.options.orig[this.prop]=
+c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=c.now(),e=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==
+true)e=false;if(e){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var g=this.elem,i=this.options;c.each(["","X","Y"],function(o,u){g.style["overflow"+u]=i.overflow[o]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var p in this.options.curAnim)c.style(this.elem,p,this.options.orig[p]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");
+this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(pa);pa=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&
+a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};var Fb=/^t(?:able|d|h)$/i,Qa=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in B.documentElement?function(a){var b=this[0],e;if(a)return this.each(function(p){c.offset.setOffset(this,a,p)});if(!b||!b.ownerDocument)return null;
+if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{e=b.getBoundingClientRect()}catch(f){}var g=b.ownerDocument,i=g.documentElement;if(!e||!c.contains(i,b))return e||{top:0,left:0};b=g.body;g=sa(g);return{top:e.top+(g.pageYOffset||c.support.boxModel&&i.scrollTop||b.scrollTop)-(i.clientTop||b.clientTop||0),left:e.left+(g.pageXOffset||c.support.boxModel&&i.scrollLeft||b.scrollLeft)-(i.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(F){c.offset.setOffset(this,
+a,F)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var e,f=b.offsetParent,g=b.ownerDocument,i=g.documentElement,p=g.body;e=(g=g.defaultView)?g.getComputedStyle(b,null):b.currentStyle;for(var o=b.offsetTop,u=b.offsetLeft;(b=b.parentNode)&&b!==p&&b!==i;){if(c.offset.supportsFixedPosition&&e.position==="fixed")break;e=g?g.getComputedStyle(b,null):b.currentStyle;o-=b.scrollTop;u-=b.scrollLeft;if(b===f){o+=b.offsetTop;u+=b.offsetLeft;
+if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&Fb.test(b.nodeName))){o+=parseFloat(e.borderTopWidth)||0;u+=parseFloat(e.borderLeftWidth)||0}f=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&e.overflow!=="visible"){o+=parseFloat(e.borderTopWidth)||0;u+=parseFloat(e.borderLeftWidth)||0}e=e}if(e.position==="relative"||e.position==="static"){o+=p.offsetTop;u+=p.offsetLeft}if(c.offset.supportsFixedPosition&&e.position==="fixed"){o+=Math.max(i.scrollTop,p.scrollTop);
+u+=Math.max(i.scrollLeft,p.scrollLeft)}return{top:o,left:u}};c.offset={initialize:function(){var a=B.body,b=B.createElement("div"),e,f,g,i=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+a.insertBefore(b,a.firstChild);e=b.firstChild;f=e.firstChild;g=e.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=g.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";e.style.overflow="hidden";e.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);
+c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,e=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,"marginTop"))||0;e+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:e}},setOffset:function(a,b,e){var f=c.css(a,"position");if(f==="static")a.style.position="relative";var g=c(a),i=g.offset(),p=c.css(a,"top"),o=c.css(a,"left"),u=f==="absolute"&&c.inArray("auto",[p,o])>-1;f={};var F={};if(u)F=g.position();p=u?F.top:parseInt(p,
+10)||0;o=u?F.left:parseInt(o,10)||0;if(c.isFunction(b))b=b.call(a,e,i);if(b.top!=null)f.top=b.top-i.top+p;if(b.left!=null)f.left=b.left-i.left+o;"using"in b?b.using.call(a,f):g.css(f)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),e=this.offset(),f=Qa.test(b[0].nodeName)?{top:0,left:0}:b.offset();e.top-=parseFloat(c.css(a,"marginTop"))||0;e.left-=parseFloat(c.css(a,"marginLeft"))||0;f.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;f.left+=parseFloat(c.css(b[0],
+"borderLeftWidth"))||0;return{top:e.top-f.top,left:e.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||B.body;a&&!Qa.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var e="scroll"+b;c.fn[e]=function(f){var g=this[0],i;if(!g)return null;if(f!==q)return this.each(function(){if(i=sa(this))i.scrollTo(!a?f:c(i).scrollLeft(),a?f:c(i).scrollTop());else this[e]=f});else return(i=sa(g))?"pageXOffset"in
+i?i[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&i.document.documentElement[e]||i.document.body[e]:g[e]}});c.each(["Height","Width"],function(a,b){var e=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],e,"padding")):null};c.fn["outer"+b]=function(f){return this[0]?parseFloat(c.css(this[0],e,f?"margin":"border")):null};c.fn[e]=function(f){var g=this[0];if(!g)return f==null?null:this;if(c.isFunction(f))return this.each(function(p){var o=c(this);o[e](f.call(this,
+p,o[e]()))});if(c.isWindow(g))return g.document.compatMode==="CSS1Compat"&&g.document.documentElement["client"+b]||g.document.body["client"+b];else if(g.nodeType===9)return Math.max(g.documentElement["client"+b],g.body["scroll"+b],g.documentElement["scroll"+b],g.body["offset"+b],g.documentElement["offset"+b]);else if(f===q){g=c.css(g,e);var i=parseFloat(g);return c.isNaN(i)?g:i}else return this.css(e,typeof f==="string"?f:f+"px")}})})(window);(function(j){function q(r,x){this.$element=j(r);this.options=x;this.enabled=true;this.fixTitle()}q.prototype={show:function(){var r=this.getTitle();if(r&&this.enabled){var x=this.tip();x.find(".tipsy-inner")[this.options.html?"html":"text"](r);x[0].className="tipsy";x.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);r=j.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight});var K=x[0].offsetWidth,J=x[0].offsetHeight,
+N=typeof this.options.gravity=="function"?this.options.gravity.call(this.$element[0]):this.options.gravity,V;switch(N.charAt(0)){case "n":V={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-K/2};break;case "s":V={top:r.top-J-this.options.offset,left:r.left+r.width/2-K/2};break;case "e":V={top:r.top+r.height/2-J/2,left:r.left-K-this.options.offset};break;case "w":V={top:r.top+r.height/2-J/2,left:r.left+r.width+this.options.offset}}if(N.length==2)V.left=N.charAt(1)=="w"?r.left+r.width/2-
+15:r.left+r.width/2-K+15;x.css(V).addClass("tipsy-"+N);this.options.fade?x.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):x.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){j(this).remove()}):this.tip().remove()},fixTitle:function(){var r=this.$element;if(r.attr("title")||typeof r.attr("original-title")!="string")r.attr("original-title",r.attr("title")||"").removeAttr("title")},
+getTitle:function(){var r,x=this.$element,K=this.options;this.fixTitle();K=this.options;if(typeof K.title=="string")r=x.attr(K.title=="title"?"original-title":K.title);else if(typeof K.title=="function")r=K.title.call(x[0]);return(r=(""+r).replace(/(^\s*|\s*$)/,""))||K.fallback},tip:function(){if(!this.$tip)this.$tip=j('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');return this.$tip},validate:function(){if(!this.$element[0].parentNode){this.hide();
+this.options=this.$element=null}},enable:function(){this.enabled=true},disable:function(){this.enabled=false},toggleEnabled:function(){this.enabled=!this.enabled}};j.fn.tipsy=function(r){function x(Q){var ea=j.data(Q,"tipsy");if(!ea){ea=new q(Q,j.fn.tipsy.elementOptions(Q,r));j.data(Q,"tipsy",ea)}return ea}function K(){var Q=x(this);Q.hoverState="in";if(r.delayIn==0)Q.show();else{Q.fixTitle();setTimeout(function(){Q.hoverState=="in"&&Q.show()},r.delayIn)}}function J(){var Q=x(this);Q.hoverState="out";
+r.delayOut==0?Q.hide():setTimeout(function(){Q.hoverState=="out"&&Q.hide()},r.delayOut)}if(r===true)return this.data("tipsy");else if(typeof r=="string"){var N=this.data("tipsy");N&&N[r]();return this}r=j.extend({},j.fn.tipsy.defaults,r);r.live||this.each(function(){x(this)});if(r.trigger!="manual"){N=r.live?"live":"bind";var V=r.trigger=="hover"?"mouseleave":"blur";this[N](r.trigger=="hover"?"mouseenter":"focus",K)[N](V,J)}return this};j.fn.tipsy.defaults={delayIn:0,delayOut:0,fade:false,fallback:"",
+gravity:"n",html:false,live:false,offset:0,opacity:0.8,title:"title",trigger:"hover"};j.fn.tipsy.elementOptions=function(r,x){return j.metadata?j.extend({},x,j(r).metadata()):x};j.fn.tipsy.autoNS=function(){return j(this).offset().top>j(document).scrollTop()+j(window).height()/2?"s":"n"};j.fn.tipsy.autoWE=function(){return j(this).offset().left>j(document).scrollLeft()+j(window).width()/2?"e":"w"};j.fn.tipsy.autoNSedge=function(){var r=j(this).offset().left;return Math.min(r,j(window).width()-r)>
+j(window).width()*0.1?j.fn.tipsy.autoNS.call(this):j.fn.tipsy.autoNS.call(this)+j.fn.tipsy.autoWE.call(this)}})(jQuery);jQuery.cookie=function(j,q,r){if(typeof q!="undefined"){r=r||{};if(q===null){q="";r.expires=-1}var x="";if(r.expires&&(typeof r.expires=="number"||r.expires.toUTCString)){if(typeof r.expires=="number"){x=new Date;x.setTime(x.getTime()+r.expires*24*60*60*1E3)}else x=r.expires;x="; expires="+x.toUTCString()}var K=r.path?"; path="+r.path:"",J=r.domain?"; domain="+r.domain:"";r=r.secure?"; secure":"";document.cookie=[j,"=",encodeURIComponent(q),x,K,J,r].join("")}else{q=null;if(document.cookie&&document.cookie!=
+""){r=document.cookie.split(";");for(x=0;x<r.length;x++){K=jQuery.trim(r[x]);if(K.substring(0,j.length+1)==j+"="){q=decodeURIComponent(K.substring(j.length+1));break}}}return q}};NOT_UNICODE_LETTER=/[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u097B-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C6F\u2C71-\u2C7D\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400\u4DB5\u4E00\u9FC3\uA000-\uA48C\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA90A-\uA925\uA930-\uA946\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAC00\uD7A3\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/g;
+UNICODE_RTL=/^[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]/;(function(j){j.fn.bidi=function(){return this.each(function(){var q=j(this),r=q.text().replace(NOT_UNICODE_LETTER,"");r&&UNICODE_RTL.test(r)?q.css("direction","rtl"):q.css("direction","ltr")})}})(jQuery);var pageZoom=0;function zoomClassName(){return pageZoom<0?"zoom-out-"+pageZoom*-1:pageZoom>0?"zoom-in-"+pageZoom:""}function initZoom(){pageZoom=$.cookie("pageZoom");$(document.body).addClass(zoomClassName());shortcut.add("ctrl+shift+insert",function(){zoom(-1)});shortcut.add("ctrl+shift+home",function(){zoom(0)});shortcut.add("ctrl+shift+page_up",function(){zoom(1)})}
+function zoom(j){var q=zoomClassName();if(j==-1){if(pageZoom==-2)return;pageZoom--}else if(j==1){if(pageZoom==2)return;pageZoom++}else if(j==0)pageZoom=0;$.cookie("pageZoom",pageZoom,{path:"/"});$(document.body).removeClass(q).addClass(zoomClassName())}
+$(document).ready(function(j){var q={color:"#000"},r={color:"#aaa"};j("label.inputHint").each(function(){var x=j(this),K=j("#"+x.attr("for"));if(K.attr("defaultValue"))var J=K.attr("defaultValue"),N=true;else J=x.hide().text().replace(":","");K.focus(function(){K.css(q);K.val()==J&&!N&&K.val("")}).blur(function(){if(K.val()=="")K.val(J).css(r);else N&&K.val()==J&&K.css(r)}).css(r).val(J)});j("a.advancedlink").click(function(x){x.preventDefault();j("div.advancedsearch").slideToggle()}).toggle(function(){j("img.togglesearch").toggle()},
+function(){j("img.togglesearch").toggle()});j(".collapse").live("click",function(x){x.preventDefault();j(this).siblings(".collapsethis").slideToggle("fast");j("textarea",j(this).next("div.collapsethis")).length&&j("textarea",j(this).next("div.collapsethis")).focus()})});var stIsIE=false;
+sorttable={init:function(){if(!arguments.callee.done){arguments.callee.done=true;_timer&&clearInterval(_timer);if(document.createElement&&document.getElementsByTagName){sorttable.DATE_RE=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;forEach(document.getElementsByTagName("table"),function(j){j.className.search(/\bsortable\b/)!=-1&&sorttable.makeSortable(j)})}}},makeSortable:function(j){if(j.getElementsByTagName("thead").length==0){the=document.createElement("thead");the.appendChild(j.rows[0]);j.insertBefore(the,
+j.firstChild)}if(j.tHead==null)j.tHead=j.getElementsByTagName("thead")[0];if(j.tHead.rows.length==1){sortbottomrows=[];for(var q=0;q<j.rows.length;q++)if(j.rows[q].className.search(/\bsortbottom\b/)!=-1)sortbottomrows[sortbottomrows.length]=j.rows[q];if(sortbottomrows){if(j.tFoot==null){tfo=document.createElement("tfoot");j.appendChild(tfo)}for(q=0;q<sortbottomrows.length;q++)tfo.appendChild(sortbottomrows[q]);delete sortbottomrows}headrow=j.tHead.rows[0].cells;for(q=0;q<headrow.length;q++)if(!headrow[q].className.match(/\bsorttable_nosort\b/)){if(mtch=
+headrow[q].className.match(/\bsorttable_([a-z0-9]+)\b/))override=mtch[1];headrow[q].sorttable_sortfunction=mtch&&typeof sorttable["sort_"+override]=="function"?sorttable["sort_"+override]:sorttable.guessType(j,q);headrow[q].sorttable_columnindex=q;headrow[q].sorttable_tbody=j.tBodies[0];unsorted=document.createElement("img");unsorted.className="sorttable_unsorted";unsorted.src=m("images/ascdesc.gif");headrow[q].appendChild(unsorted);dean_addEvent(headrow[q],"click",function(){if(this.className.search(/\bsorttable_sorted\b/)!=
+-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted","sorttable_sorted_reverse");this.removeChild(document.getElementById("sorttable_sortfwdind"));sortrevind=document.createElement("img");sortrevind.id="sorttable_sortrevind";sortrevind.src=m("images/desc.gif");this.appendChild(sortrevind)}else if(this.className.search(/\bsorttable_sorted_reverse\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted_reverse",
+"sorttable_sorted");this.removeChild(document.getElementById("sorttable_sortrevind"));sortfwdind=document.createElement("img");sortfwdind.id="sorttable_sortfwdind";sortfwdind.src=m("images/asc.gif");this.appendChild(sortfwdind)}else{theadrow=this.parentNode;forEach(theadrow.childNodes,function(x){if(x.nodeType==1){if(x.className.search(/\b(sorttable_sorted|sorttable_sorted_reverse)\b/)!=-1){unsorted=document.createElement("img");unsorted.className="sorttable_unsorted";unsorted.src=m("images/ascdesc.gif");
+x.appendChild(unsorted)}x.className=x.className.replace("sorttable_sorted_reverse","");x.className=x.className.replace("sorttable_sorted","")}});(unsorted=$(".sorttable_unsorted",this).get(0))&&unsorted.parentNode.removeChild(unsorted);(sortfwdind=document.getElementById("sorttable_sortfwdind"))&&sortfwdind.parentNode.removeChild(sortfwdind);(sortrevind=document.getElementById("sorttable_sortrevind"))&&sortrevind.parentNode.removeChild(sortrevind);this.className+=" sorttable_sorted";sortfwdind=document.createElement("img");
+sortfwdind.id="sorttable_sortfwdind";sortfwdind.src=m("images/asc.gif");this.appendChild(sortfwdind);row_array=[];col=this.sorttable_columnindex;rows=this.sorttable_tbody.rows;for(var r=0;r<rows.length;r++)row_array[row_array.length]=[sorttable.getInnerText(rows[r].cells[col]),rows[r]];sorttable.shaker_sort(row_array,this.sorttable_sortfunction);tb=this.sorttable_tbody;for(r=0;r<row_array.length;r++)tb.appendChild(row_array[r][1]);sorttable.make_zebra();delete row_array}})}}},guessType:function(j,
+q){sortfn=sorttable.sort_alpha;for(var r=0;r<j.tBodies[0].rows.length;r++){text=sorttable.getInnerText(j.tBodies[0].rows[r].cells[q]);if(text!=""){if(text.match(/^-?[\ufffd$\ufffd]?[\d,.]+%?$/))return sorttable.sort_numeric;if(possdate=text.match(sorttable.DATE_RE)){first=parseInt(possdate[1]);second=parseInt(possdate[2]);if(first>12)return sorttable.sort_ddmm;else if(second>12)return sorttable.sort_mmdd;else sortfn=sorttable.sort_ddmm}}}return sortfn},getInnerText:function(j){hasInputs=typeof j.getElementsByTagName==
+"function"&&j.getElementsByTagName("input").length;if(j.getAttribute("sorttable_customkey")!=null)return j.getAttribute("sorttable_customkey");else if(typeof j.textContent!="undefined"&&!hasInputs)return j.textContent.replace(/^\s+|\s+$/g,"");else if(typeof j.innerText!="undefined"&&!hasInputs)return j.innerText.replace(/^\s+|\s+$/g,"");else if(typeof j.text!="undefined"&&!hasInputs)return j.text.replace(/^\s+|\s+$/g,"");else switch(j.nodeType){case 3:if(j.nodeName.toLowerCase()=="input")return j.value.replace(/^\s+|\s+$/g,
+"");case 4:return j.nodeValue.replace(/^\s+|\s+$/g,"");case 1:case 11:for(var q="",r=0;r<j.childNodes.length;r++)q+=sorttable.getInnerText(j.childNodes[r]);return q.replace(/^\s+|\s+$/g,"");default:return""}},reverse:function(j){newrows=[];for(var q=0;q<j.rows.length;q++)newrows[newrows.length]=j.rows[q];for(q=newrows.length-1;q>=0;q--)j.appendChild(newrows[q]);delete newrows},sort_numeric:function(j,q){aa=parseFloat(j[0].replace(/[^0-9.-]/g,""));if(isNaN(aa))aa=0;bb=parseFloat(q[0].replace(/[^0-9.-]/g,
+""));if(isNaN(bb))bb=0;return aa-bb},sort_alpha:function(j,q){if(j[0]==q[0])return 0;if(j[0]<q[0])return-1;return 1},sort_ddmm:function(j,q){mtch=j[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1)m="0"+m;if(d.length==1)d="0"+d;dt1=y+m+d;mtch=q[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1)m="0"+m;if(d.length==1)d="0"+d;dt2=y+m+d;if(dt1==dt2)return 0;if(dt1<dt2)return-1;return 1},sort_mmdd:function(j,q){mtch=j[0].match(sorttable.DATE_RE);y=mtch[3];
+d=mtch[2];m=mtch[1];if(m.length==1)m="0"+m;if(d.length==1)d="0"+d;dt1=y+m+d;mtch=q[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1)m="0"+m;if(d.length==1)d="0"+d;dt2=y+m+d;if(dt1==dt2)return 0;if(dt1<dt2)return-1;return 1},shaker_sort:function(j,q){for(var r=0,x=j.length-1,K=true;K;){K=false;for(var J=r;J<x;++J)if(q(j[J],j[J+1])>0){K=j[J];j[J]=j[J+1];j[J+1]=K;K=true}x--;if(!K)break;for(J=x;J>r;--J)if(q(j[J],j[J-1])<0){K=j[J];j[J]=j[J-1];j[J-1]=K;K=true}r++}},make_zebra:function(){var j=
+"even",q=true;$("table.sortable tbody tr").each(function(){$(this).addClass(j);j=q?"odd":"even";$(this).removeClass(j);q=!q})}};document.addEventListener&&document.addEventListener("DOMContentLoaded",sorttable.init,false);if(/WebKit/i.test(navigator.userAgent))var _timer=setInterval(function(){/loaded|complete/.test(document.readyState)&&sorttable.init()},10);window.onload=sorttable.init;
+function dean_addEvent(j,q,r){if(j.addEventListener)j.addEventListener(q,r,false);else{if(!r.$$guid)r.$$guid=dean_addEvent.guid++;if(!j.events)j.events={};var x=j.events[q];if(!x){x=j.events[q]={};if(j["on"+q])x[0]=j["on"+q]}x[r.$$guid]=r;j["on"+q]=handleEvent}}dean_addEvent.guid=1;function removeEvent(j,q,r){if(j.removeEventListener)j.removeEventListener(q,r,false);else j.events&&j.events[q]&&delete j.events[q][r.$$guid]}
+function handleEvent(j){var q=true;j=j||fixEvent(((this.ownerDocument||this.document||this).parentWindow||window).event);var r=this.events[j.type],x;for(x in r){this.$$handleEvent=r[x];if(this.$$handleEvent(j)===false)q=false}return q}function fixEvent(j){j.preventDefault=fixEvent.preventDefault;j.stopPropagation=fixEvent.stopPropagation;return j}fixEvent.preventDefault=function(){this.returnValue=false};fixEvent.stopPropagation=function(){this.cancelBubble=true};
+if(!Array.forEach)Array.forEach=function(j,q,r){for(var x=0;x<j.length;x++)q.call(r,j[x],x,j)};Function.prototype.forEach=function(j,q,r){for(var x in j)typeof this.prototype[x]=="undefined"&&q.call(r,j[x],x,j)};String.forEach=function(j,q,r){Array.forEach(j.split(""),function(x,K){q.call(r,x,K,j)})};
+var forEach=function(j,q,r){if(j){var x=Object;if(j instanceof Function)x=Function;else if(j.forEach instanceof Function){j.forEach(q,r);return}else if(typeof j=="string")x=String;else if(typeof j.length=="number")x=Array;x.forEach(j,q,r)}};shortcut={all_shortcuts:{},add:function(j,q,r){var x={type:"keydown",propagate:false,disable_in_input:false,target:document,keycode:false};if(r)for(var K in x){if(typeof r[K]=="undefined")r[K]=x[K]}else r=x;x=r.target;if(typeof r.target=="string")x=document.getElementById(r.target);j=j.toLowerCase();K=function(J){J=J||window.event;if(r.disable_in_input){var N;if(J.target)N=J.target;else if(J.srcElement)N=J.srcElement;if(N.nodeType==3)N=N.parentNode;if(N.tagName=="INPUT"||N.tagName=="TEXTAREA")return}if(J.keyCode)code=
+J.keyCode;else if(J.which)code=J.which;N=String.fromCharCode(code).toLowerCase();if(code==188)N=",";if(code==190)N=".";var V=j.split("+"),Q=0,ea={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},qa={esc:27,escape:27,tab:9,space:32,"return":13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,"break":19,insert:45,
+home:36,"delete":46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},U={shift:{wanted:false,pressed:false},ctrl:{wanted:false,pressed:false},alt:{wanted:false,pressed:false},meta:{wanted:false,pressed:false}};if(J.ctrlKey)U.ctrl.pressed=true;if(J.shiftKey)U.shift.pressed=true;if(J.altKey)U.alt.pressed=true;if(J.metaKey)U.meta.pressed=true;for(var fa=0;k=V[fa],fa<V.length;fa++)if(k==
+"ctrl"||k=="control"){Q++;U.ctrl.wanted=true}else if(k=="shift"){Q++;U.shift.wanted=true}else if(k=="alt"){Q++;U.alt.wanted=true}else if(k=="meta"){Q++;U.meta.wanted=true}else if(k.length>1)qa[k]==code&&Q++;else if(r.keycode)r.keycode==code&&Q++;else if(N==k)Q++;else if(ea[N]&&J.shiftKey){N=ea[N];N==k&&Q++}if(Q==V.length&&U.ctrl.pressed==U.ctrl.wanted&&U.shift.pressed==U.shift.wanted&&U.alt.pressed==U.alt.wanted&&U.meta.pressed==U.meta.wanted){q(J);if(!r.propagate){J.cancelBubble=true;J.returnValue=
+false;if(J.stopPropagation){J.stopPropagation();J.preventDefault()}return false}}};this.all_shortcuts[j]={callback:K,target:x,event:r.type};if(x.addEventListener)x.addEventListener(r.type,K,false);else if(x.attachEvent)x.attachEvent("on"+r.type,K);else x["on"+r.type]=K},remove:function(j){j=j.toLowerCase();var q=this.all_shortcuts[j];delete this.all_shortcuts[j];if(q){j=q.event;var r=q.target;q=q.callback;if(r.detachEvent)r.detachEvent("on"+j,q);else if(r.removeEventListener)r.removeEventListener(j,
+q,false);else r["on"+j]=false}}};
diff --git a/src/pootle_it/html/js/correctpng.js b/src/pootle_it/html/js/correctpng.js
new file mode 100644
index 0000000..ac3947f
--- /dev/null
+++ b/src/pootle_it/html/js/correctpng.js
@@ -0,0 +1,39 @@
+/*
+
+Correctly handle PNG transparency in Win IE 5.5 & 6.
+http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
+
+Use in <HEAD> with DEFER keyword wrapped in conditional comments:
+<!--[if lt IE 7]>
+<script defer type="text/javascript" src="pngfix.js"></script>
+<![endif]-->
+
+*/
+
+var arVersion = navigator.appVersion.split("MSIE")
+var version = parseFloat(arVersion[1])
+
+if ((version >= 5.5) && (document.body.filters))
+{
+ for(var i=0; i<document.images.length; i++)
+ {
+ var img = document.images[i]
+ var imgName = img.src.toUpperCase()
+ if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
+ {
+ var imgID = (img.id) ? "id='" + img.id + "' " : ""
+ var imgClass = (img.className) ? "class='" + img.className + "' " : ""
+ var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
+ var imgStyle = "display:inline-block;" + img.style.cssText
+ if (img.align == "left") imgStyle = "float:left;" + imgStyle
+ if (img.align == "right") imgStyle = "float:right;" + imgStyle
+ if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
+ var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
+ img.outerHTML = strNewHTML
+ i = i-1
+ }
+ }
+}
diff --git a/src/pootle_it/html/js/diff_match_patch.js b/src/pootle_it/html/js/diff_match_patch.js
new file mode 100644
index 0000000..3b0f436
--- /dev/null
+++ b/src/pootle_it/html/js/diff_match_patch.js
@@ -0,0 +1,2247 @@
+/**
+ * Diff Match and Patch
+ *
+ * Copyright 2006 Google Inc.
+ * http://code.google.com/p/google-diff-match-patch/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @fileoverview Computes the difference between two texts to create a patch.
+ * Applies the patch onto another text, allowing for errors.
+ * @author fraser@google.com (Neil Fraser)
+ */
+
+/**
+ * Class containing the diff, match and patch methods.
+ * @constructor
+ */
+function diff_match_patch() {
+
+ // Defaults.
+ // Redefine these in your program to override the defaults.
+
+ // Number of seconds to map a diff before giving up (0 for infinity).
+ this.Diff_Timeout = 1.0;
+ // Cost of an empty edit operation in terms of edit characters.
+ this.Diff_EditCost = 4;
+ // The size beyond which the double-ended diff activates.
+ // Double-ending is twice as fast, but less accurate.
+ this.Diff_DualThreshold = 32;
+ // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
+ this.Match_Threshold = 0.5;
+ // How far to search for a match (0 = exact location, 1000+ = broad match).
+ // A match this many characters away from the expected location will add
+ // 1.0 to the score (0.0 is a perfect match).
+ this.Match_Distance = 1000;
+ // When deleting a large block of text (over ~64 characters), how close does
+ // the contents have to match the expected contents. (0.0 = perfection,
+ // 1.0 = very loose). Note that Match_Threshold controls how closely the
+ // end points of a delete need to match.
+ this.Patch_DeleteThreshold = 0.5;
+ // Chunk size for context length.
+ this.Patch_Margin = 4;
+
+ /**
+ * Compute the number of bits in an int.
+ * The normal answer for JavaScript is 32.
+ * @return {number} Max bits
+ */
+ function getMaxBits() {
+ var maxbits = 0;
+ var oldi = 1;
+ var newi = 2;
+ while (oldi != newi) {
+ maxbits++;
+ oldi = newi;
+ newi = newi << 1;
+ }
+ return maxbits;
+ }
+ // How many bits in a number?
+ this.Match_MaxBits = getMaxBits();
+}
+
+
+// DIFF FUNCTIONS
+
+
+/**
+ * The data structure representing a diff is an array of tuples:
+ * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
+ * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
+ */
+var DIFF_DELETE = -1;
+var DIFF_INSERT = 1;
+var DIFF_EQUAL = 0;
+
+/** @typedef {!Array.<number|string>} */
+diff_match_patch.Diff;
+
+
+/**
+ * Find the differences between two texts. Simplifies the problem by stripping
+ * any common prefix or suffix off the texts before diffing.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean=} opt_checklines Optional speedup flag. If present and false,
+ * then don't run a line-level diff first to identify the changed areas.
+ * Defaults to true, which does a faster, slightly less optimal diff.
+ * @param {number} opt_deadline: Optional time when the diff should be complete
+ * by. Used internally for recursive calls. Users should set DiffTimeout
+ * instead.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ */
+diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
+ opt_deadline) {
+ // Set a deadline by which time the diff must be complete.
+ if (typeof opt_deadline == 'undefined') {
+ if (this.Diff_Timeout <= 0) {
+ opt_deadline = Number.MAX_VALUE;
+ } else {
+ opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;
+ }
+ }
+ var deadline = opt_deadline;
+
+ // Check for null inputs.
+ if (text1 == null || text2 == null) {
+ throw new Error('Null input. (diff_main)');
+ }
+
+ // Check for equality (speedup).
+ if (text1 == text2) {
+ if (text1) {
+ return [[DIFF_EQUAL, text1]];
+ }
+ return [];
+ }
+
+ if (typeof opt_checklines == 'undefined') {
+ opt_checklines = true;
+ }
+ var checklines = opt_checklines;
+
+ // Trim off common prefix (speedup).
+ var commonlength = this.diff_commonPrefix(text1, text2);
+ var commonprefix = text1.substring(0, commonlength);
+ text1 = text1.substring(commonlength);
+ text2 = text2.substring(commonlength);
+
+ // Trim off common suffix (speedup).
+ commonlength = this.diff_commonSuffix(text1, text2);
+ var commonsuffix = text1.substring(text1.length - commonlength);
+ text1 = text1.substring(0, text1.length - commonlength);
+ text2 = text2.substring(0, text2.length - commonlength);
+
+ // Compute the diff on the middle block.
+ var diffs = this.diff_compute(text1, text2, checklines, deadline);
+
+ // Restore the prefix and suffix.
+ if (commonprefix) {
+ diffs.unshift([DIFF_EQUAL, commonprefix]);
+ }
+ if (commonsuffix) {
+ diffs.push([DIFF_EQUAL, commonsuffix]);
+ }
+ this.diff_cleanupMerge(diffs);
+ return diffs;
+};
+
+
+/**
+ * Find the differences between two texts. Assumes that the texts do not
+ * have any common prefix or suffix.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {boolean} checklines Speedup flag. If false, then don't run a
+ * line-level diff first to identify the changed areas.
+ * If true, then run a faster, slightly less optimal diff.
+ * @param {number} deadline Time when the diff should be complete by.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ * @private
+ */
+diff_match_patch.prototype.diff_compute = function(text1, text2, checklines,
+ deadline) {
+ var diffs;
+
+ if (!text1) {
+ // Just add some text (speedup).
+ return [[DIFF_INSERT, text2]];
+ }
+
+ if (!text2) {
+ // Just delete some text (speedup).
+ return [[DIFF_DELETE, text1]];
+ }
+
+ var longtext = text1.length > text2.length ? text1 : text2;
+ var shorttext = text1.length > text2.length ? text2 : text1;
+ var i = longtext.indexOf(shorttext);
+ if (i != -1) {
+ // Shorter text is inside the longer text (speedup).
+ diffs = [[DIFF_INSERT, longtext.substring(0, i)],
+ [DIFF_EQUAL, shorttext],
+ [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
+ // Swap insertions for deletions if diff is reversed.
+ if (text1.length > text2.length) {
+ diffs[0][0] = diffs[2][0] = DIFF_DELETE;
+ }
+ return diffs;
+ }
+ longtext = shorttext = null; // Garbage collect.
+
+ // Check to see if the problem can be split in two.
+ var hm = this.diff_halfMatch(text1, text2);
+ if (hm) {
+ // A half-match was found, sort out the return data.
+ var text1_a = hm[0];
+ var text1_b = hm[1];
+ var text2_a = hm[2];
+ var text2_b = hm[3];
+ var mid_common = hm[4];
+ // Send both pairs off for separate processing.
+ var diffs_a = this.diff_main(text1_a, text2_a, checklines);
+ var diffs_b = this.diff_main(text1_b, text2_b, checklines);
+ // Merge the results.
+ return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
+ }
+
+ // Perform a real diff.
+ if (checklines && (text1.length < 100 || text2.length < 100)) {
+ // Too trivial for the overhead.
+ checklines = false;
+ }
+ /** @type {!Array.<string>} */
+ var linearray;
+ if (checklines) {
+ // Scan the text on a line-by-line basis first.
+ var a = this.diff_linesToChars(text1, text2);
+ text1 = /** @type {string} */(a[0]);
+ text2 = /** @type {string} */(a[1]);
+ linearray = /** @type {!Array.<string>} */(a[2]);
+ }
+
+ diffs = this.diff_map(text1, text2, deadline);
+
+ if (checklines) {
+ // Convert the diff back to original text.
+ this.diff_charsToLines(diffs, linearray);
+ // Eliminate freak matches (e.g. blank lines)
+ this.diff_cleanupSemantic(diffs);
+
+ // Rediff any replacement blocks, this time character-by-character.
+ // Add a dummy entry at the end.
+ diffs.push([DIFF_EQUAL, '']);
+ var pointer = 0;
+ var count_delete = 0;
+ var count_insert = 0;
+ var text_delete = '';
+ var text_insert = '';
+ while (pointer < diffs.length) {
+ switch (diffs[pointer][0]) {
+ case DIFF_INSERT:
+ count_insert++;
+ text_insert += diffs[pointer][1];
+ break;
+ case DIFF_DELETE:
+ count_delete++;
+ text_delete += diffs[pointer][1];
+ break;
+ case DIFF_EQUAL:
+ // Upon reaching an equality, check for prior redundancies.
+ if (count_delete >= 1 && count_insert >= 1) {
+ // Delete the offending records and add the merged ones.
+ var a = this.diff_main(text_delete, text_insert, false, deadline);
+ diffs.splice(pointer - count_delete - count_insert,
+ count_delete + count_insert);
+ pointer = pointer - count_delete - count_insert;
+ for (var j = a.length - 1; j >= 0; j--) {
+ diffs.splice(pointer, 0, a[j]);
+ }
+ pointer = pointer + a.length;
+ }
+ count_insert = 0;
+ count_delete = 0;
+ text_delete = '';
+ text_insert = '';
+ break;
+ }
+ pointer++;
+ }
+ diffs.pop(); // Remove the dummy entry at the end.
+ }
+ return diffs;
+};
+
+
+/**
+ * Split two texts into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {!Array.<string|!Array.<string>>} Three element Array, containing the
+ * encoded text1, the encoded text2 and the array of unique strings. The
+ * zeroth element of the array of unique strings is intentionally blank.
+ * @private
+ */
+diff_match_patch.prototype.diff_linesToChars = function(text1, text2) {
+ var lineArray = []; // e.g. lineArray[4] == 'Hello\n'
+ var lineHash = {}; // e.g. lineHash['Hello\n'] == 4
+
+ // '\x00' is a valid character, but various debuggers don't like it.
+ // So we'll insert a junk entry to avoid generating a null character.
+ lineArray[0] = '';
+
+ /**
+ * Split a text into an array of strings. Reduce the texts to a string of
+ * hashes where each Unicode character represents one line.
+ * Modifies linearray and linehash through being a closure.
+ * @param {string} text String to encode.
+ * @return {string} Encoded string.
+ * @private
+ */
+ function diff_linesToCharsMunge(text) {
+ var chars = '';
+ // Walk the text, pulling out a substring for each line.
+ // text.split('\n') would would temporarily double our memory footprint.
+ // Modifying text would create many large strings to garbage collect.
+ var lineStart = 0;
+ var lineEnd = -1;
+ // Keeping our own length variable is faster than looking it up.
+ var lineArrayLength = lineArray.length;
+ while (lineEnd < text.length - 1) {
+ lineEnd = text.indexOf('\n', lineStart);
+ if (lineEnd == -1) {
+ lineEnd = text.length - 1;
+ }
+ var line = text.substring(lineStart, lineEnd + 1);
+ lineStart = lineEnd + 1;
+
+ if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :
+ (lineHash[line] !== undefined)) {
+ chars += String.fromCharCode(lineHash[line]);
+ } else {
+ chars += String.fromCharCode(lineArrayLength);
+ lineHash[line] = lineArrayLength;
+ lineArray[lineArrayLength++] = line;
+ }
+ }
+ return chars;
+ }
+
+ var chars1 = diff_linesToCharsMunge(text1);
+ var chars2 = diff_linesToCharsMunge(text2);
+ return [chars1, chars2, lineArray];
+};
+
+
+/**
+ * Rehydrate the text in a diff from a string of line hashes to real lines of
+ * text.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @param {!Array.<string>} lineArray Array of unique strings.
+ * @private
+ */
+diff_match_patch.prototype.diff_charsToLines = function(diffs, lineArray) {
+ for (var x = 0; x < diffs.length; x++) {
+ var chars = diffs[x][1];
+ var text = [];
+ for (var y = 0; y < chars.length; y++) {
+ text[y] = lineArray[chars.charCodeAt(y)];
+ }
+ diffs[x][1] = text.join('');
+ }
+};
+
+
+/**
+ * Explore the intersection points between the two texts.
+ * @param {string} text1 Old string to be diffed.
+ * @param {string} text2 New string to be diffed.
+ * @param {number} deadline Time at which to bail if not yet complete.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ * @private
+ */
+diff_match_patch.prototype.diff_map = function(text1, text2, deadline) {
+ // Cache the text lengths to prevent multiple calls.
+ var text1_length = text1.length;
+ var text2_length = text2.length;
+ var max_d = text1_length + text2_length - 1;
+ var doubleEnd = this.Diff_DualThreshold * 2 < max_d;
+ // JavaScript efficiency note: (x << 32) + y doesn't work since numbers are
+ // only 32 bit. Use x + ',' + y to create a hash instead.
+ var v_map1 = [];
+ var v_map2 = [];
+ var v1 = {};
+ var v2 = {};
+ v1[1] = 0;
+ v2[1] = 0;
+ var x, y;
+ var footstep; // Used to track overlapping paths.
+ var footsteps = {};
+ var done = false;
+ // If the total number of characters is odd, then the front path will collide
+ // with the reverse path.
+ var front = (text1_length + text2_length) % 2;
+ for (var d = 0; d < max_d; d++) {
+ // Bail out if deadline is reached.
+ if ((new Date()).getTime() > deadline) {
+ break;
+ }
+
+ // Walk the front path one step.
+ v_map1[d] = {};
+ for (var k = -d; k <= d; k += 2) {
+ if (k == -d || k != d && v1[k - 1] < v1[k + 1]) {
+ x = v1[k + 1];
+ } else {
+ x = v1[k - 1] + 1;
+ }
+ y = x - k;
+ if (doubleEnd) {
+ footstep = x + ',' + y;
+ if (front && footsteps[footstep] !== undefined) {
+ done = true;
+ }
+ if (!front) {
+ footsteps[footstep] = d;
+ }
+ }
+ while (!done && x < text1_length && y < text2_length &&
+ text1.charAt(x) == text2.charAt(y)) {
+ x++;
+ y++;
+ if (doubleEnd) {
+ footstep = x + ',' + y;
+ if (front && footsteps[footstep] !== undefined) {
+ done = true;
+ }
+ if (!front) {
+ footsteps[footstep] = d;
+ }
+ }
+ }
+ v1[k] = x;
+ v_map1[d][x + ',' + y] = true;
+ if (x == text1_length && y == text2_length) {
+ // Reached the end in single-path mode.
+ return this.diff_path1(v_map1, text1, text2);
+ } else if (done) {
+ // Front path ran over reverse path.
+ v_map2 = v_map2.slice(0, footsteps[footstep] + 1);
+ var a = this.diff_path1(v_map1, text1.substring(0, x),
+ text2.substring(0, y));
+ return a.concat(this.diff_path2(v_map2, text1.substring(x),
+ text2.substring(y)));
+ }
+ }
+
+ if (doubleEnd) {
+ // Walk the reverse path one step.
+ v_map2[d] = {};
+ for (var k = -d; k <= d; k += 2) {
+ if (k == -d || k != d && v2[k - 1] < v2[k + 1]) {
+ x = v2[k + 1];
+ } else {
+ x = v2[k - 1] + 1;
+ }
+ y = x - k;
+ footstep = (text1_length - x) + ',' + (text2_length - y);
+ if (!front && footsteps[footstep] !== undefined) {
+ done = true;
+ }
+ if (front) {
+ footsteps[footstep] = d;
+ }
+ while (!done && x < text1_length && y < text2_length &&
+ text1.charAt(text1_length - x - 1) ==
+ text2.charAt(text2_length - y - 1)) {
+ x++;
+ y++;
+ footstep = (text1_length - x) + ',' + (text2_length - y);
+ if (!front && footsteps[footstep] !== undefined) {
+ done = true;
+ }
+ if (front) {
+ footsteps[footstep] = d;
+ }
+ }
+ v2[k] = x;
+ v_map2[d][x + ',' + y] = true;
+ if (done) {
+ // Reverse path ran over front path.
+ v_map1 = v_map1.slice(0, footsteps[footstep] + 1);
+ var a = this.diff_path1(v_map1, text1.substring(0, text1_length - x),
+ text2.substring(0, text2_length - y));
+ return a.concat(this.diff_path2(v_map2,
+ text1.substring(text1_length - x),
+ text2.substring(text2_length - y)));
+ }
+ }
+ }
+ }
+ // Diff took too long and hit the deadline or
+ // number of diffs equals number of characters, no commonality at all.
+ return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
+};
+
+
+/**
+ * Work from the middle back to the start to determine the path.
+ * @param {!Array.<!Object>} v_map Array of paths.
+ * @param {string} text1 Old string fragment to be diffed.
+ * @param {string} text2 New string fragment to be diffed.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ * @private
+ */
+diff_match_patch.prototype.diff_path1 = function(v_map, text1, text2) {
+ var path = [];
+ var x = text1.length;
+ var y = text2.length;
+ /** @type {?number} */
+ var last_op = null;
+ for (var d = v_map.length - 2; d >= 0; d--) {
+ while (true) {
+ if (v_map[d][(x - 1) + ',' + y] !== undefined) {
+ x--;
+ if (last_op === DIFF_DELETE) {
+ path[0][1] = text1.charAt(x) + path[0][1];
+ } else {
+ path.unshift([DIFF_DELETE, text1.charAt(x)]);
+ }
+ last_op = DIFF_DELETE;
+ break;
+ } else if (v_map[d][x + ',' + (y - 1)] !== undefined) {
+ y--;
+ if (last_op === DIFF_INSERT) {
+ path[0][1] = text2.charAt(y) + path[0][1];
+ } else {
+ path.unshift([DIFF_INSERT, text2.charAt(y)]);
+ }
+ last_op = DIFF_INSERT;
+ break;
+ } else {
+ x--;
+ y--;
+ if (text1.charAt(x) != text2.charAt(y)) {
+ throw new Error('No diagonal. Can\'t happen. (diff_path1)');
+ }
+ if (last_op === DIFF_EQUAL) {
+ path[0][1] = text1.charAt(x) + path[0][1];
+ } else {
+ path.unshift([DIFF_EQUAL, text1.charAt(x)]);
+ }
+ last_op = DIFF_EQUAL;
+ }
+ }
+ }
+ return path;
+};
+
+
+/**
+ * Work from the middle back to the end to determine the path.
+ * @param {!Array.<!Object>} v_map Array of paths.
+ * @param {string} text1 Old string fragment to be diffed.
+ * @param {string} text2 New string fragment to be diffed.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ * @private
+ */
+diff_match_patch.prototype.diff_path2 = function(v_map, text1, text2) {
+ var path = [];
+ var pathLength = 0;
+ var x = text1.length;
+ var y = text2.length;
+ /** @type {?number} */
+ var last_op = null;
+ for (var d = v_map.length - 2; d >= 0; d--) {
+ while (true) {
+ if (v_map[d][(x - 1) + ',' + y] !== undefined) {
+ x--;
+ if (last_op === DIFF_DELETE) {
+ path[pathLength - 1][1] += text1.charAt(text1.length - x - 1);
+ } else {
+ path[pathLength++] =
+ [DIFF_DELETE, text1.charAt(text1.length - x - 1)];
+ }
+ last_op = DIFF_DELETE;
+ break;
+ } else if (v_map[d][x + ',' + (y - 1)] !== undefined) {
+ y--;
+ if (last_op === DIFF_INSERT) {
+ path[pathLength - 1][1] += text2.charAt(text2.length - y - 1);
+ } else {
+ path[pathLength++] =
+ [DIFF_INSERT, text2.charAt(text2.length - y - 1)];
+ }
+ last_op = DIFF_INSERT;
+ break;
+ } else {
+ x--;
+ y--;
+ if (text1.charAt(text1.length - x - 1) !=
+ text2.charAt(text2.length - y - 1)) {
+ throw new Error('No diagonal. Can\'t happen. (diff_path2)');
+ }
+ if (last_op === DIFF_EQUAL) {
+ path[pathLength - 1][1] += text1.charAt(text1.length - x - 1);
+ } else {
+ path[pathLength++] =
+ [DIFF_EQUAL, text1.charAt(text1.length - x - 1)];
+ }
+ last_op = DIFF_EQUAL;
+ }
+ }
+ }
+ return path;
+};
+
+
+/**
+ * Determine the common prefix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the start of each
+ * string.
+ */
+diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
+ // Quick check for common null cases.
+ if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
+ return 0;
+ }
+ // Binary search.
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
+ var pointermin = 0;
+ var pointermax = Math.min(text1.length, text2.length);
+ var pointermid = pointermax;
+ var pointerstart = 0;
+ while (pointermin < pointermid) {
+ if (text1.substring(pointerstart, pointermid) ==
+ text2.substring(pointerstart, pointermid)) {
+ pointermin = pointermid;
+ pointerstart = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
+ }
+ return pointermid;
+};
+
+
+/**
+ * Determine the common suffix of two strings.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of each string.
+ */
+diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
+ // Quick check for common null cases.
+ if (!text1 || !text2 || text1.charAt(text1.length - 1) !=
+ text2.charAt(text2.length - 1)) {
+ return 0;
+ }
+ // Binary search.
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
+ var pointermin = 0;
+ var pointermax = Math.min(text1.length, text2.length);
+ var pointermid = pointermax;
+ var pointerend = 0;
+ while (pointermin < pointermid) {
+ if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
+ text2.substring(text2.length - pointermid, text2.length - pointerend)) {
+ pointermin = pointermid;
+ pointerend = pointermin;
+ } else {
+ pointermax = pointermid;
+ }
+ pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
+ }
+ return pointermid;
+};
+
+
+/**
+ * Determine if the suffix of one string is the prefix of another.
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {number} The number of characters common to the end of the first
+ * string and the start of the second string.
+ */
+diff_match_patch.prototype.diff_commonOverlap = function(text1, text2) {
+ // Cache the text lengths to prevent multiple calls.
+ var text1_length = text1.length;
+ var text2_length = text2.length;
+ // Eliminate the null case.
+ if (text1_length == 0 || text2_length == 0) {
+ return 0;
+ }
+ // Truncate the longer string.
+ if (text1_length > text2_length) {
+ text1 = text1.substring(text1_length - text2_length);
+ } else if (text1_length < text2_length) {
+ text2 = text2.substring(0, text1_length);
+ }
+ var text_length = Math.min(text1_length, text2_length);
+ // Quick check for the worst case.
+ if (text1 == text2) {
+ return text_length;
+ }
+
+ // Start by looking for a single character match
+ // and increase length until no match is found.
+ // Performance analysis: http://neil.fraser.name/news/2010/11/04/
+ var best = 0;
+ var length = 1;
+ while (true) {
+ var pattern = text1.substring(text_length - length);
+ var found = text2.indexOf(pattern);
+ if (found == -1) {
+ return best;
+ }
+ length += found;
+ if (found == 0 || text1.substring(text_length - length) ==
+ text2.substring(0, length)) {
+ best = length;
+ length++;
+ }
+ }
+};
+
+
+/**
+ * Do the two texts share a substring which is at least half the length of the
+ * longer text?
+ * @param {string} text1 First string.
+ * @param {string} text2 Second string.
+ * @return {Array.<string>} Five element Array, containing the prefix of
+ * text1, the suffix of text1, the prefix of text2, the suffix of
+ * text2 and the common middle. Or null if there was no match.
+ */
+diff_match_patch.prototype.diff_halfMatch = function(text1, text2) {
+ var longtext = text1.length > text2.length ? text1 : text2;
+ var shorttext = text1.length > text2.length ? text2 : text1;
+ if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
+ return null; // Pointless.
+ }
+ var dmp = this; // 'this' becomes 'window' in a closure.
+
+ /**
+ * Does a substring of shorttext exist within longtext such that the substring
+ * is at least half the length of longtext?
+ * Closure, but does not reference any external variables.
+ * @param {string} longtext Longer string.
+ * @param {string} shorttext Shorter string.
+ * @param {number} i Start index of quarter length substring within longtext
+ * @return {Array.<string>} Five element Array, containing the prefix of
+ * longtext, the suffix of longtext, the prefix of shorttext, the suffix
+ * of shorttext and the common middle. Or null if there was no match.
+ * @private
+ */
+ function diff_halfMatchI(longtext, shorttext, i) {
+ // Start with a 1/4 length substring at position i as a seed.
+ var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
+ var j = -1;
+ var best_common = '';
+ var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
+ while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
+ var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),
+ shorttext.substring(j));
+ var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),
+ shorttext.substring(0, j));
+ if (best_common.length < suffixLength + prefixLength) {
+ best_common = shorttext.substring(j - suffixLength, j) +
+ shorttext.substring(j, j + prefixLength);
+ best_longtext_a = longtext.substring(0, i - suffixLength);
+ best_longtext_b = longtext.substring(i + prefixLength);
+ best_shorttext_a = shorttext.substring(0, j - suffixLength);
+ best_shorttext_b = shorttext.substring(j + prefixLength);
+ }
+ }
+ if (best_common.length >= longtext.length / 2) {
+ return [best_longtext_a, best_longtext_b,
+ best_shorttext_a, best_shorttext_b, best_common];
+ } else {
+ return null;
+ }
+ }
+
+ // First check if the second quarter is the seed for a half-match.
+ var hm1 = diff_halfMatchI(longtext, shorttext,
+ Math.ceil(longtext.length / 4));
+ // Check again based on the third quarter.
+ var hm2 = diff_halfMatchI(longtext, shorttext,
+ Math.ceil(longtext.length / 2));
+ var hm;
+ if (!hm1 && !hm2) {
+ return null;
+ } else if (!hm2) {
+ hm = hm1;
+ } else if (!hm1) {
+ hm = hm2;
+ } else {
+ // Both matched. Select the longest.
+ hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
+ }
+
+ // A half-match was found, sort out the return data.
+ var text1_a, text1_b, text2_a, text2_b;
+ if (text1.length > text2.length) {
+ text1_a = hm[0];
+ text1_b = hm[1];
+ text2_a = hm[2];
+ text2_b = hm[3];
+ } else {
+ text2_a = hm[0];
+ text2_b = hm[1];
+ text1_a = hm[2];
+ text1_b = hm[3];
+ }
+ var mid_common = hm[4];
+ return [text1_a, text1_b, text2_a, text2_b, mid_common];
+};
+
+
+/**
+ * Reduce the number of edits by eliminating semantically trivial equalities.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ */
+diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
+ var changes = false;
+ var equalities = []; // Stack of indices where equalities are found.
+ var equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ /** @type {?string} */
+ var lastequality = null; // Always equal to equalities[equalitiesLength-1][1]
+ var pointer = 0; // Index of current position.
+ // Number of characters that changed prior to the equality.
+ var length_insertions1 = 0;
+ var length_deletions1 = 0;
+ // Number of characters that changed after the equality.
+ var length_insertions2 = 0;
+ var length_deletions2 = 0;
+ while (pointer < diffs.length) {
+ if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
+ equalities[equalitiesLength++] = pointer;
+ length_insertions1 = length_insertions2;
+ length_deletions1 = length_deletions2;
+ length_insertions2 = 0;
+ length_deletions2 = 0;
+ lastequality = /** @type {string} */(diffs[pointer][1]);
+ } else { // An insertion or deletion.
+ if (diffs[pointer][0] == DIFF_INSERT) {
+ length_insertions2 += diffs[pointer][1].length;
+ } else {
+ length_deletions2 += diffs[pointer][1].length;
+ }
+ if (lastequality !== null && (lastequality.length <=
+ Math.max(length_insertions1, length_deletions1)) &&
+ (lastequality.length <= Math.max(length_insertions2,
+ length_deletions2))) {
+ // Duplicate record.
+ diffs.splice(equalities[equalitiesLength - 1], 0,
+ [DIFF_DELETE, lastequality]);
+ // Change second copy to insert.
+ diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
+ // Throw away the equality we just deleted.
+ equalitiesLength--;
+ // Throw away the previous equality (it needs to be reevaluated).
+ equalitiesLength--;
+ pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
+ length_insertions1 = 0; // Reset the counters.
+ length_deletions1 = 0;
+ length_insertions2 = 0;
+ length_deletions2 = 0;
+ lastequality = null;
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ // Normalize the diff.
+ if (changes) {
+ this.diff_cleanupMerge(diffs);
+ }
+ this.diff_cleanupSemanticLossless(diffs);
+
+ // Find any overlaps between deletions and insertions.
+ // e.g: <del>abcxx</del><ins>xxdef</ins>
+ // -> <del>abc</del>xx<ins>def</ins>
+ pointer = 1;
+ while (pointer < diffs.length) {
+ if (diffs[pointer - 1][0] == DIFF_DELETE &&
+ diffs[pointer][0] == DIFF_INSERT) {
+ var deletion = /** @type {string} */(diffs[pointer - 1][1]);
+ var insertion = /** @type {string} */(diffs[pointer][1]);
+ var overlap_length = this.diff_commonOverlap(deletion, insertion);
+ if (overlap_length) {
+ // Overlap found. Insert an equality and trim the surrounding edits.
+ diffs.splice(pointer, 0,
+ [DIFF_EQUAL, insertion.substring(0, overlap_length)]);
+ diffs[pointer - 1][1] =
+ deletion.substring(0, deletion.length - overlap_length);
+ diffs[pointer + 1][1] = insertion.substring(overlap_length);
+ pointer++;
+ }
+ pointer++;
+ }
+ pointer++;
+ }
+};
+
+
+/**
+ * Look for single edits surrounded on both sides by equalities
+ * which can be shifted sideways to align the edit to a word boundary.
+ * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ */
+diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
+ // Define some regex patterns for matching boundaries.
+ var punctuation = /[^a-zA-Z0-9]/;
+ var whitespace = /\s/;
+ var linebreak = /[\r\n]/;
+ var blanklineEnd = /\n\r?\n$/;
+ var blanklineStart = /^\r?\n\r?\n/;
+
+ /**
+ * Given two strings, compute a score representing whether the internal
+ * boundary falls on logical boundaries.
+ * Scores range from 5 (best) to 0 (worst).
+ * Closure, makes reference to regex patterns defined above.
+ * @param {string} one First string.
+ * @param {string} two Second string.
+ * @return {number} The score.
+ */
+ function diff_cleanupSemanticScore(one, two) {
+ if (!one || !two) {
+ // Edges are the best.
+ return 5;
+ }
+
+ // Each port of this function behaves slightly differently due to
+ // subtle differences in each language's definition of things like
+ // 'whitespace'. Since this function's purpose is largely cosmetic,
+ // the choice has been made to use each language's native features
+ // rather than force total conformity.
+ var score = 0;
+ // One point for non-alphanumeric.
+ if (one.charAt(one.length - 1).match(punctuation) ||
+ two.charAt(0).match(punctuation)) {
+ score++;
+ // Two points for whitespace.
+ if (one.charAt(one.length - 1).match(whitespace) ||
+ two.charAt(0).match(whitespace)) {
+ score++;
+ // Three points for line breaks.
+ if (one.charAt(one.length - 1).match(linebreak) ||
+ two.charAt(0).match(linebreak)) {
+ score++;
+ // Four points for blank lines.
+ if (one.match(blanklineEnd) || two.match(blanklineStart)) {
+ score++;
+ }
+ }
+ }
+ }
+ return score;
+ }
+
+ var pointer = 1;
+ // Intentionally ignore the first and last element (don't need checking).
+ while (pointer < diffs.length - 1) {
+ if (diffs[pointer - 1][0] == DIFF_EQUAL &&
+ diffs[pointer + 1][0] == DIFF_EQUAL) {
+ // This is a single edit surrounded by equalities.
+ var equality1 = /** @type {string} */(diffs[pointer - 1][1]);
+ var edit = /** @type {string} */(diffs[pointer][1]);
+ var equality2 = /** @type {string} */(diffs[pointer + 1][1]);
+
+ // First, shift the edit as far left as possible.
+ var commonOffset = this.diff_commonSuffix(equality1, edit);
+ if (commonOffset) {
+ var commonString = edit.substring(edit.length - commonOffset);
+ equality1 = equality1.substring(0, equality1.length - commonOffset);
+ edit = commonString + edit.substring(0, edit.length - commonOffset);
+ equality2 = commonString + equality2;
+ }
+
+ // Second, step character by character right, looking for the best fit.
+ var bestEquality1 = equality1;
+ var bestEdit = edit;
+ var bestEquality2 = equality2;
+ var bestScore = diff_cleanupSemanticScore(equality1, edit) +
+ diff_cleanupSemanticScore(edit, equality2);
+ while (edit.charAt(0) === equality2.charAt(0)) {
+ equality1 += edit.charAt(0);
+ edit = edit.substring(1) + equality2.charAt(0);
+ equality2 = equality2.substring(1);
+ var score = diff_cleanupSemanticScore(equality1, edit) +
+ diff_cleanupSemanticScore(edit, equality2);
+ // The >= encourages trailing rather than leading whitespace on edits.
+ if (score >= bestScore) {
+ bestScore = score;
+ bestEquality1 = equality1;
+ bestEdit = edit;
+ bestEquality2 = equality2;
+ }
+ }
+
+ if (diffs[pointer - 1][1] != bestEquality1) {
+ // We have an improvement, save it back to the diff.
+ if (bestEquality1) {
+ diffs[pointer - 1][1] = bestEquality1;
+ } else {
+ diffs.splice(pointer - 1, 1);
+ pointer--;
+ }
+ diffs[pointer][1] = bestEdit;
+ if (bestEquality2) {
+ diffs[pointer + 1][1] = bestEquality2;
+ } else {
+ diffs.splice(pointer + 1, 1);
+ pointer--;
+ }
+ }
+ }
+ pointer++;
+ }
+};
+
+
+/**
+ * Reduce the number of edits by eliminating operationally trivial equalities.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ */
+diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
+ var changes = false;
+ var equalities = []; // Stack of indices where equalities are found.
+ var equalitiesLength = 0; // Keeping our own length var is faster in JS.
+ var lastequality = ''; // Always equal to equalities[equalitiesLength-1][1]
+ var pointer = 0; // Index of current position.
+ // Is there an insertion operation before the last equality.
+ var pre_ins = false;
+ // Is there a deletion operation before the last equality.
+ var pre_del = false;
+ // Is there an insertion operation after the last equality.
+ var post_ins = false;
+ // Is there a deletion operation after the last equality.
+ var post_del = false;
+ while (pointer < diffs.length) {
+ if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
+ if (diffs[pointer][1].length < this.Diff_EditCost &&
+ (post_ins || post_del)) {
+ // Candidate found.
+ equalities[equalitiesLength++] = pointer;
+ pre_ins = post_ins;
+ pre_del = post_del;
+ lastequality = diffs[pointer][1];
+ } else {
+ // Not a candidate, and can never become one.
+ equalitiesLength = 0;
+ lastequality = '';
+ }
+ post_ins = post_del = false;
+ } else { // An insertion or deletion.
+ if (diffs[pointer][0] == DIFF_DELETE) {
+ post_del = true;
+ } else {
+ post_ins = true;
+ }
+ /*
+ * Five types to be split:
+ * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
+ * <ins>A</ins>X<ins>C</ins><del>D</del>
+ * <ins>A</ins><del>B</del>X<ins>C</ins>
+ * <ins>A</del>X<ins>C</ins><del>D</del>
+ * <ins>A</ins><del>B</del>X<del>C</del>
+ */
+ if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||
+ ((lastequality.length < this.Diff_EditCost / 2) &&
+ (pre_ins + pre_del + post_ins + post_del) == 3))) {
+ // Duplicate record.
+ diffs.splice(equalities[equalitiesLength - 1], 0,
+ [DIFF_DELETE, lastequality]);
+ // Change second copy to insert.
+ diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
+ equalitiesLength--; // Throw away the equality we just deleted;
+ lastequality = '';
+ if (pre_ins && pre_del) {
+ // No changes made which could affect previous entry, keep going.
+ post_ins = post_del = true;
+ equalitiesLength = 0;
+ } else {
+ equalitiesLength--; // Throw away the previous equality.
+ pointer = equalitiesLength > 0 ?
+ equalities[equalitiesLength - 1] : -1;
+ post_ins = post_del = false;
+ }
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+
+ if (changes) {
+ this.diff_cleanupMerge(diffs);
+ }
+};
+
+
+/**
+ * Reorder and merge like edit sections. Merge equalities.
+ * Any edit section can move as long as it doesn't cross an equality.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ */
+diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
+ diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
+ var pointer = 0;
+ var count_delete = 0;
+ var count_insert = 0;
+ var text_delete = '';
+ var text_insert = '';
+ var commonlength;
+ while (pointer < diffs.length) {
+ switch (diffs[pointer][0]) {
+ case DIFF_INSERT:
+ count_insert++;
+ text_insert += diffs[pointer][1];
+ pointer++;
+ break;
+ case DIFF_DELETE:
+ count_delete++;
+ text_delete += diffs[pointer][1];
+ pointer++;
+ break;
+ case DIFF_EQUAL:
+ // Upon reaching an equality, check for prior redundancies.
+ if (count_delete + count_insert > 1) {
+ if (count_delete !== 0 && count_insert !== 0) {
+ // Factor out any common prefixies.
+ commonlength = this.diff_commonPrefix(text_insert, text_delete);
+ if (commonlength !== 0) {
+ if ((pointer - count_delete - count_insert) > 0 &&
+ diffs[pointer - count_delete - count_insert - 1][0] ==
+ DIFF_EQUAL) {
+ diffs[pointer - count_delete - count_insert - 1][1] +=
+ text_insert.substring(0, commonlength);
+ } else {
+ diffs.splice(0, 0, [DIFF_EQUAL,
+ text_insert.substring(0, commonlength)]);
+ pointer++;
+ }
+ text_insert = text_insert.substring(commonlength);
+ text_delete = text_delete.substring(commonlength);
+ }
+ // Factor out any common suffixies.
+ commonlength = this.diff_commonSuffix(text_insert, text_delete);
+ if (commonlength !== 0) {
+ diffs[pointer][1] = text_insert.substring(text_insert.length -
+ commonlength) + diffs[pointer][1];
+ text_insert = text_insert.substring(0, text_insert.length -
+ commonlength);
+ text_delete = text_delete.substring(0, text_delete.length -
+ commonlength);
+ }
+ }
+ // Delete the offending records and add the merged ones.
+ if (count_delete === 0) {
+ diffs.splice(pointer - count_delete - count_insert,
+ count_delete + count_insert, [DIFF_INSERT, text_insert]);
+ } else if (count_insert === 0) {
+ diffs.splice(pointer - count_delete - count_insert,
+ count_delete + count_insert, [DIFF_DELETE, text_delete]);
+ } else {
+ diffs.splice(pointer - count_delete - count_insert,
+ count_delete + count_insert, [DIFF_DELETE, text_delete],
+ [DIFF_INSERT, text_insert]);
+ }
+ pointer = pointer - count_delete - count_insert +
+ (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
+ } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
+ // Merge this equality with the previous one.
+ diffs[pointer - 1][1] += diffs[pointer][1];
+ diffs.splice(pointer, 1);
+ } else {
+ pointer++;
+ }
+ count_insert = 0;
+ count_delete = 0;
+ text_delete = '';
+ text_insert = '';
+ break;
+ }
+ }
+ if (diffs[diffs.length - 1][1] === '') {
+ diffs.pop(); // Remove the dummy entry at the end.
+ }
+
+ // Second pass: look for single edits surrounded on both sides by equalities
+ // which can be shifted sideways to eliminate an equality.
+ // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
+ var changes = false;
+ pointer = 1;
+ // Intentionally ignore the first and last element (don't need checking).
+ while (pointer < diffs.length - 1) {
+ if (diffs[pointer - 1][0] == DIFF_EQUAL &&
+ diffs[pointer + 1][0] == DIFF_EQUAL) {
+ // This is a single edit surrounded by equalities.
+ if (diffs[pointer][1].substring(diffs[pointer][1].length -
+ diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
+ // Shift the edit over the previous equality.
+ diffs[pointer][1] = diffs[pointer - 1][1] +
+ diffs[pointer][1].substring(0, diffs[pointer][1].length -
+ diffs[pointer - 1][1].length);
+ diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
+ diffs.splice(pointer - 1, 1);
+ changes = true;
+ } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
+ diffs[pointer + 1][1]) {
+ // Shift the edit over the next equality.
+ diffs[pointer - 1][1] += diffs[pointer + 1][1];
+ diffs[pointer][1] =
+ diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
+ diffs[pointer + 1][1];
+ diffs.splice(pointer + 1, 1);
+ changes = true;
+ }
+ }
+ pointer++;
+ }
+ // If shifts were made, the diff needs reordering and another shift sweep.
+ if (changes) {
+ this.diff_cleanupMerge(diffs);
+ }
+};
+
+
+/**
+ * loc is a location in text1, compute and return the equivalent location in
+ * text2.
+ * e.g. 'The cat' vs 'The big cat', 1->1, 5->8
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @param {number} loc Location within text1.
+ * @return {number} Location within text2.
+ */
+diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
+ var chars1 = 0;
+ var chars2 = 0;
+ var last_chars1 = 0;
+ var last_chars2 = 0;
+ var x;
+ for (x = 0; x < diffs.length; x++) {
+ if (diffs[x][0] !== DIFF_INSERT) { // Equality or deletion.
+ chars1 += diffs[x][1].length;
+ }
+ if (diffs[x][0] !== DIFF_DELETE) { // Equality or insertion.
+ chars2 += diffs[x][1].length;
+ }
+ if (chars1 > loc) { // Overshot the location.
+ break;
+ }
+ last_chars1 = chars1;
+ last_chars2 = chars2;
+ }
+ // Was the location was deleted?
+ if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {
+ return last_chars2;
+ }
+ // Add the remaining character length.
+ return last_chars2 + (loc - last_chars1);
+};
+
+
+/**
+ * Convert a diff array into a pretty HTML report.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @return {string} HTML representation.
+ */
+diff_match_patch.prototype.diff_prettyHtml = function(diffs) {
+ var html = [];
+ var i = 0;
+ var pattern_amp = /&/g;
+ var pattern_lt = /</g;
+ var pattern_gt = />/g;
+ var pattern_para = /\n/g;
+ for (var x = 0; x < diffs.length; x++) {
+ var op = diffs[x][0]; // Operation (insert, delete, equal)
+ var data = diffs[x][1]; // Text of change.
+ var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')
+ .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<BR>');
+ switch (op) {
+ case DIFF_INSERT:
+ html[x] = '<INS STYLE="background:#E6FFE6;" TITLE="i=' + i + '">' +
+ text + '</INS>';
+ break;
+ case DIFF_DELETE:
+ html[x] = '<DEL STYLE="background:#FFE6E6;" TITLE="i=' + i + '">' +
+ text + '</DEL>';
+ break;
+ case DIFF_EQUAL:
+ html[x] = '<SPAN TITLE="i=' + i + '">' + text + '</SPAN>';
+ break;
+ }
+ if (op !== DIFF_DELETE) {
+ i += data.length;
+ }
+ }
+ return html.join('');
+};
+
+
+/**
+ * Compute and return the source text (all equalities and deletions).
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @return {string} Source text.
+ */
+diff_match_patch.prototype.diff_text1 = function(diffs) {
+ var text = [];
+ for (var x = 0; x < diffs.length; x++) {
+ if (diffs[x][0] !== DIFF_INSERT) {
+ text[x] = diffs[x][1];
+ }
+ }
+ return text.join('');
+};
+
+
+/**
+ * Compute and return the destination text (all equalities and insertions).
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @return {string} Destination text.
+ */
+diff_match_patch.prototype.diff_text2 = function(diffs) {
+ var text = [];
+ for (var x = 0; x < diffs.length; x++) {
+ if (diffs[x][0] !== DIFF_DELETE) {
+ text[x] = diffs[x][1];
+ }
+ }
+ return text.join('');
+};
+
+
+/**
+ * Compute the Levenshtein distance; the number of inserted, deleted or
+ * substituted characters.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @return {number} Number of changes.
+ */
+diff_match_patch.prototype.diff_levenshtein = function(diffs) {
+ var levenshtein = 0;
+ var insertions = 0;
+ var deletions = 0;
+ for (var x = 0; x < diffs.length; x++) {
+ var op = diffs[x][0];
+ var data = diffs[x][1];
+ switch (op) {
+ case DIFF_INSERT:
+ insertions += data.length;
+ break;
+ case DIFF_DELETE:
+ deletions += data.length;
+ break;
+ case DIFF_EQUAL:
+ // A deletion and an insertion is one substitution.
+ levenshtein += Math.max(insertions, deletions);
+ insertions = 0;
+ deletions = 0;
+ break;
+ }
+ }
+ levenshtein += Math.max(insertions, deletions);
+ return levenshtein;
+};
+
+
+/**
+ * Crush the diff into an encoded string which describes the operations
+ * required to transform text1 into text2.
+ * E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'.
+ * Operations are tab-separated. Inserted text is escaped using %xx notation.
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
+ * @return {string} Delta text.
+ */
+diff_match_patch.prototype.diff_toDelta = function(diffs) {
+ var text = [];
+ for (var x = 0; x < diffs.length; x++) {
+ switch (diffs[x][0]) {
+ case DIFF_INSERT:
+ text[x] = '+' + encodeURI(diffs[x][1]);
+ break;
+ case DIFF_DELETE:
+ text[x] = '-' + diffs[x][1].length;
+ break;
+ case DIFF_EQUAL:
+ text[x] = '=' + diffs[x][1].length;
+ break;
+ }
+ }
+ return text.join('\t').replace(/%20/g, ' ');
+};
+
+
+/**
+ * Given the original text1, and an encoded string which describes the
+ * operations required to transform text1 into text2, compute the full diff.
+ * @param {string} text1 Source string for the diff.
+ * @param {string} delta Delta text.
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
+ * @throws {!Error} If invalid input.
+ */
+diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
+ var diffs = [];
+ var diffsLength = 0; // Keeping our own length var is faster in JS.
+ var pointer = 0; // Cursor in text1
+ var tokens = delta.split(/\t/g);
+ for (var x = 0; x < tokens.length; x++) {
+ // Each token begins with a one character parameter which specifies the
+ // operation of this token (delete, insert, equality).
+ var param = tokens[x].substring(1);
+ switch (tokens[x].charAt(0)) {
+ case '+':
+ try {
+ diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];
+ } catch (ex) {
+ // Malformed URI sequence.
+ throw new Error('Illegal escape in diff_fromDelta: ' + param);
+ }
+ break;
+ case '-':
+ // Fall through.
+ case '=':
+ var n = parseInt(param, 10);
+ if (isNaN(n) || n < 0) {
+ throw new Error('Invalid number in diff_fromDelta: ' + param);
+ }
+ var text = text1.substring(pointer, pointer += n);
+ if (tokens[x].charAt(0) == '=') {
+ diffs[diffsLength++] = [DIFF_EQUAL, text];
+ } else {
+ diffs[diffsLength++] = [DIFF_DELETE, text];
+ }
+ break;
+ default:
+ // Blank tokens are ok (from a trailing \t).
+ // Anything else is an error.
+ if (tokens[x]) {
+ throw new Error('Invalid diff operation in diff_fromDelta: ' +
+ tokens[x]);
+ }
+ }
+ }
+ if (pointer != text1.length) {
+ throw new Error('Delta length (' + pointer +
+ ') does not equal source text length (' + text1.length + ').');
+ }
+ return diffs;
+};
+
+
+// MATCH FUNCTIONS
+
+
+/**
+ * Locate the best instance of 'pattern' in 'text' near 'loc'.
+ * @param {string} text The text to search.
+ * @param {string} pattern The pattern to search for.
+ * @param {number} loc The location to search around.
+ * @return {number} Best match index or -1.
+ */
+diff_match_patch.prototype.match_main = function(text, pattern, loc) {
+ // Check for null inputs.
+ if (text == null || pattern == null || loc == null) {
+ throw new Error('Null input. (match_main)');
+ }
+
+ loc = Math.max(0, Math.min(loc, text.length));
+ if (text == pattern) {
+ // Shortcut (potentially not guaranteed by the algorithm)
+ return 0;
+ } else if (!text.length) {
+ // Nothing to match.
+ return -1;
+ } else if (text.substring(loc, loc + pattern.length) == pattern) {
+ // Perfect match at the perfect spot! (Includes case of null pattern)
+ return loc;
+ } else {
+ // Do a fuzzy compare.
+ return this.match_bitap(text, pattern, loc);
+ }
+};
+
+
+/**
+ * Locate the best instance of 'pattern' in 'text' near 'loc' using the
+ * Bitap algorithm.
+ * @param {string} text The text to search.
+ * @param {string} pattern The pattern to search for.
+ * @param {number} loc The location to search around.
+ * @return {number} Best match index or -1.
+ * @private
+ */
+diff_match_patch.prototype.match_bitap = function(text, pattern, loc) {
+ if (pattern.length > this.Match_MaxBits) {
+ throw new Error('Pattern too long for this browser.');
+ }
+
+ // Initialise the alphabet.
+ var s = this.match_alphabet(pattern);
+
+ var dmp = this; // 'this' becomes 'window' in a closure.
+
+ /**
+ * Compute and return the score for a match with e errors and x location.
+ * Accesses loc and pattern through being a closure.
+ * @param {number} e Number of errors in match.
+ * @param {number} x Location of match.
+ * @return {number} Overall score for match (0.0 = good, 1.0 = bad).
+ * @private
+ */
+ function match_bitapScore(e, x) {
+ var accuracy = e / pattern.length;
+ var proximity = Math.abs(loc - x);
+ if (!dmp.Match_Distance) {
+ // Dodge divide by zero error.
+ return proximity ? 1.0 : accuracy;
+ }
+ return accuracy + (proximity / dmp.Match_Distance);
+ }
+
+ // Highest score beyond which we give up.
+ var score_threshold = this.Match_Threshold;
+ // Is there a nearby exact match? (speedup)
+ var best_loc = text.indexOf(pattern, loc);
+ if (best_loc != -1) {
+ score_threshold = Math.min(match_bitapScore(0, best_loc), score_threshold);
+ // What about in the other direction? (speedup)
+ best_loc = text.lastIndexOf(pattern, loc + pattern.length);
+ if (best_loc != -1) {
+ score_threshold =
+ Math.min(match_bitapScore(0, best_loc), score_threshold);
+ }
+ }
+
+ // Initialise the bit arrays.
+ var matchmask = 1 << (pattern.length - 1);
+ best_loc = -1;
+
+ var bin_min, bin_mid;
+ var bin_max = pattern.length + text.length;
+ var last_rd;
+ for (var d = 0; d < pattern.length; d++) {
+ // Scan for the best match; each iteration allows for one more error.
+ // Run a binary search to determine how far from 'loc' we can stray at this
+ // error level.
+ bin_min = 0;
+ bin_mid = bin_max;
+ while (bin_min < bin_mid) {
+ if (match_bitapScore(d, loc + bin_mid) <= score_threshold) {
+ bin_min = bin_mid;
+ } else {
+ bin_max = bin_mid;
+ }
+ bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
+ }
+ // Use the result from this iteration as the maximum for the next.
+ bin_max = bin_mid;
+ var start = Math.max(1, loc - bin_mid + 1);
+ var finish = Math.min(loc + bin_mid, text.length) + pattern.length;
+
+ var rd = Array(finish + 2);
+ rd[finish + 1] = (1 << d) - 1;
+ for (var j = finish; j >= start; j--) {
+ // The alphabet (s) is a sparse hash, so the following line generates
+ // warnings.
+ var charMatch = s[text.charAt(j - 1)];
+ if (d === 0) { // First pass: exact match.
+ rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
+ } else { // Subsequent passes: fuzzy match.
+ rd[j] = ((rd[j + 1] << 1) | 1) & charMatch |
+ (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |
+ last_rd[j + 1];
+ }
+ if (rd[j] & matchmask) {
+ var score = match_bitapScore(d, j - 1);
+ // This match will almost certainly be better than any existing match.
+ // But check anyway.
+ if (score <= score_threshold) {
+ // Told you so.
+ score_threshold = score;
+ best_loc = j - 1;
+ if (best_loc > loc) {
+ // When passing loc, don't exceed our current distance from loc.
+ start = Math.max(1, 2 * loc - best_loc);
+ } else {
+ // Already passed loc, downhill from here on in.
+ break;
+ }
+ }
+ }
+ }
+ // No hope for a (better) match at greater error levels.
+ if (match_bitapScore(d + 1, loc) > score_threshold) {
+ break;
+ }
+ last_rd = rd;
+ }
+ return best_loc;
+};
+
+
+/**
+ * Initialise the alphabet for the Bitap algorithm.
+ * @param {string} pattern The text to encode.
+ * @return {!Object} Hash of character locations.
+ * @private
+ */
+diff_match_patch.prototype.match_alphabet = function(pattern) {
+ var s = {};
+ for (var i = 0; i < pattern.length; i++) {
+ s[pattern.charAt(i)] = 0;
+ }
+ for (var i = 0; i < pattern.length; i++) {
+ s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);
+ }
+ return s;
+};
+
+
+// PATCH FUNCTIONS
+
+
+/**
+ * Increase the context until it is unique,
+ * but don't let the pattern expand beyond Match_MaxBits.
+ * @param {!patch_obj} patch The patch to grow.
+ * @param {string} text Source text.
+ * @private
+ */
+diff_match_patch.prototype.patch_addContext = function(patch, text) {
+ if (text.length == 0) {
+ return;
+ }
+ var pattern = text.substring(patch.start2, patch.start2 + patch.length1);
+ var padding = 0;
+
+ // Look for the first and last matches of pattern in text. If two different
+ // matches are found, increase the pattern length.
+ while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&
+ pattern.length < this.Match_MaxBits - this.Patch_Margin -
+ this.Patch_Margin) {
+ padding += this.Patch_Margin;
+ pattern = text.substring(patch.start2 - padding,
+ patch.start2 + patch.length1 + padding);
+ }
+ // Add one chunk for good luck.
+ padding += this.Patch_Margin;
+
+ // Add the prefix.
+ var prefix = text.substring(patch.start2 - padding, patch.start2);
+ if (prefix) {
+ patch.diffs.unshift([DIFF_EQUAL, prefix]);
+ }
+ // Add the suffix.
+ var suffix = text.substring(patch.start2 + patch.length1,
+ patch.start2 + patch.length1 + padding);
+ if (suffix) {
+ patch.diffs.push([DIFF_EQUAL, suffix]);
+ }
+
+ // Roll back the start points.
+ patch.start1 -= prefix.length;
+ patch.start2 -= prefix.length;
+ // Extend the lengths.
+ patch.length1 += prefix.length + suffix.length;
+ patch.length2 += prefix.length + suffix.length;
+};
+
+
+/**
+ * Compute a list of patches to turn text1 into text2.
+ * Use diffs if provided, otherwise compute it ourselves.
+ * There are four ways to call this function, depending on what data is
+ * available to the caller:
+ * Method 1:
+ * a = text1, b = text2
+ * Method 2:
+ * a = diffs
+ * Method 3 (optimal):
+ * a = text1, b = diffs
+ * Method 4 (deprecated, use method 3):
+ * a = text1, b = text2, c = diffs
+ *
+ * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or
+ * Array of diff tuples for text1 to text2 (method 2).
+ * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or
+ * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).
+ * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples for
+ * text1 to text2 (method 4) or undefined (methods 1,2,3).
+ * @return {!Array.<!patch_obj>} Array of patch objects.
+ */
+diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
+ var text1, diffs;
+ if (typeof a == 'string' && typeof opt_b == 'string' &&
+ typeof opt_c == 'undefined') {
+ // Method 1: text1, text2
+ // Compute diffs from text1 and text2.
+ text1 = /** @type {string} */(a);
+ diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);
+ if (diffs.length > 2) {
+ this.diff_cleanupSemantic(diffs);
+ this.diff_cleanupEfficiency(diffs);
+ }
+ } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&
+ typeof opt_c == 'undefined') {
+ // Method 2: diffs
+ // Compute text1 from diffs.
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);
+ text1 = this.diff_text1(diffs);
+ } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&
+ typeof opt_c == 'undefined') {
+ // Method 3: text1, diffs
+ text1 = /** @type {string} */(a);
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);
+ } else if (typeof a == 'string' && typeof opt_b == 'string' &&
+ opt_c && typeof opt_c == 'object') {
+ // Method 4: text1, text2, diffs
+ // text2 is not used.
+ text1 = /** @type {string} */(a);
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);
+ } else {
+ throw new Error('Unknown call format to patch_make.');
+ }
+
+ if (diffs.length === 0) {
+ return []; // Get rid of the null case.
+ }
+ var patches = [];
+ var patch = new patch_obj();
+ var patchDiffLength = 0; // Keeping our own length var is faster in JS.
+ var char_count1 = 0; // Number of characters into the text1 string.
+ var char_count2 = 0; // Number of characters into the text2 string.
+ // Start with text1 (prepatch_text) and apply the diffs until we arrive at
+ // text2 (postpatch_text). We recreate the patches one by one to determine
+ // context info.
+ var prepatch_text = text1;
+ var postpatch_text = text1;
+ for (var x = 0; x < diffs.length; x++) {
+ var diff_type = diffs[x][0];
+ var diff_text = diffs[x][1];
+
+ if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
+ // A new patch starts here.
+ patch.start1 = char_count1;
+ patch.start2 = char_count2;
+ }
+
+ switch (diff_type) {
+ case DIFF_INSERT:
+ patch.diffs[patchDiffLength++] = diffs[x];
+ patch.length2 += diff_text.length;
+ postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +
+ postpatch_text.substring(char_count2);
+ break;
+ case DIFF_DELETE:
+ patch.length1 += diff_text.length;
+ patch.diffs[patchDiffLength++] = diffs[x];
+ postpatch_text = postpatch_text.substring(0, char_count2) +
+ postpatch_text.substring(char_count2 +
+ diff_text.length);
+ break;
+ case DIFF_EQUAL:
+ if (diff_text.length <= 2 * this.Patch_Margin &&
+ patchDiffLength && diffs.length != x + 1) {
+ // Small equality inside a patch.
+ patch.diffs[patchDiffLength++] = diffs[x];
+ patch.length1 += diff_text.length;
+ patch.length2 += diff_text.length;
+ } else if (diff_text.length >= 2 * this.Patch_Margin) {
+ // Time for a new patch.
+ if (patchDiffLength) {
+ this.patch_addContext(patch, prepatch_text);
+ patches.push(patch);
+ patch = new patch_obj();
+ patchDiffLength = 0;
+ // Unlike Unidiff, our patch lists have a rolling context.
+ // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
+ // Update prepatch text & pos to reflect the application of the
+ // just completed patch.
+ prepatch_text = postpatch_text;
+ char_count1 = char_count2;
+ }
+ }
+ break;
+ }
+
+ // Update the current character count.
+ if (diff_type !== DIFF_INSERT) {
+ char_count1 += diff_text.length;
+ }
+ if (diff_type !== DIFF_DELETE) {
+ char_count2 += diff_text.length;
+ }
+ }
+ // Pick up the leftover patch if not empty.
+ if (patchDiffLength) {
+ this.patch_addContext(patch, prepatch_text);
+ patches.push(patch);
+ }
+
+ return patches;
+};
+
+
+/**
+ * Given an array of patches, return another array that is identical.
+ * @param {!Array.<!patch_obj>} patches Array of patch objects.
+ * @return {!Array.<!patch_obj>} Array of patch objects.
+ */
+diff_match_patch.prototype.patch_deepCopy = function(patches) {
+ // Making deep copies is hard in JavaScript.
+ var patchesCopy = [];
+ for (var x = 0; x < patches.length; x++) {
+ var patch = patches[x];
+ var patchCopy = new patch_obj();
+ patchCopy.diffs = [];
+ for (var y = 0; y < patch.diffs.length; y++) {
+ patchCopy.diffs[y] = patch.diffs[y].slice();
+ }
+ patchCopy.start1 = patch.start1;
+ patchCopy.start2 = patch.start2;
+ patchCopy.length1 = patch.length1;
+ patchCopy.length2 = patch.length2;
+ patchesCopy[x] = patchCopy;
+ }
+ return patchesCopy;
+};
+
+
+/**
+ * Merge a set of patches onto the text. Return a patched text, as well
+ * as a list of true/false values indicating which patches were applied.
+ * @param {!Array.<!patch_obj>} patches Array of patch objects.
+ * @param {string} text Old text.
+ * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the
+ * new text and an array of boolean values.
+ */
+diff_match_patch.prototype.patch_apply = function(patches, text) {
+ if (patches.length == 0) {
+ return [text, []];
+ }
+
+ // Deep copy the patches so that no changes are made to originals.
+ patches = this.patch_deepCopy(patches);
+
+ var nullPadding = this.patch_addPadding(patches);
+ text = nullPadding + text + nullPadding;
+
+ this.patch_splitMax(patches);
+ // delta keeps track of the offset between the expected and actual location
+ // of the previous patch. If there are patches expected at positions 10 and
+ // 20, but the first patch was found at 12, delta is 2 and the second patch
+ // has an effective expected position of 22.
+ var delta = 0;
+ var results = [];
+ for (var x = 0; x < patches.length; x++) {
+ var expected_loc = patches[x].start2 + delta;
+ var text1 = this.diff_text1(patches[x].diffs);
+ var start_loc;
+ var end_loc = -1;
+ if (text1.length > this.Match_MaxBits) {
+ // patch_splitMax will only provide an oversized pattern in the case of
+ // a monster delete.
+ start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),
+ expected_loc);
+ if (start_loc != -1) {
+ end_loc = this.match_main(text,
+ text1.substring(text1.length - this.Match_MaxBits),
+ expected_loc + text1.length - this.Match_MaxBits);
+ if (end_loc == -1 || start_loc >= end_loc) {
+ // Can't find valid trailing context. Drop this patch.
+ start_loc = -1;
+ }
+ }
+ } else {
+ start_loc = this.match_main(text, text1, expected_loc);
+ }
+ if (start_loc == -1) {
+ // No match found. :(
+ results[x] = false;
+ // Subtract the delta for this failed patch from subsequent patches.
+ delta -= patches[x].length2 - patches[x].length1;
+ } else {
+ // Found a match. :)
+ results[x] = true;
+ delta = start_loc - expected_loc;
+ var text2;
+ if (end_loc == -1) {
+ text2 = text.substring(start_loc, start_loc + text1.length);
+ } else {
+ text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
+ }
+ if (text1 == text2) {
+ // Perfect match, just shove the replacement text in.
+ text = text.substring(0, start_loc) +
+ this.diff_text2(patches[x].diffs) +
+ text.substring(start_loc + text1.length);
+ } else {
+ // Imperfect match. Run a diff to get a framework of equivalent
+ // indices.
+ var diffs = this.diff_main(text1, text2, false);
+ if (text1.length > this.Match_MaxBits &&
+ this.diff_levenshtein(diffs) / text1.length >
+ this.Patch_DeleteThreshold) {
+ // The end points match, but the content is unacceptably bad.
+ results[x] = false;
+ } else {
+ this.diff_cleanupSemanticLossless(diffs);
+ var index1 = 0;
+ var index2;
+ for (var y = 0; y < patches[x].diffs.length; y++) {
+ var mod = patches[x].diffs[y];
+ if (mod[0] !== DIFF_EQUAL) {
+ index2 = this.diff_xIndex(diffs, index1);
+ }
+ if (mod[0] === DIFF_INSERT) { // Insertion
+ text = text.substring(0, start_loc + index2) + mod[1] +
+ text.substring(start_loc + index2);
+ } else if (mod[0] === DIFF_DELETE) { // Deletion
+ text = text.substring(0, start_loc + index2) +
+ text.substring(start_loc + this.diff_xIndex(diffs,
+ index1 + mod[1].length));
+ }
+ if (mod[0] !== DIFF_DELETE) {
+ index1 += mod[1].length;
+ }
+ }
+ }
+ }
+ }
+ }
+ // Strip the padding off.
+ text = text.substring(nullPadding.length, text.length - nullPadding.length);
+ return [text, results];
+};
+
+
+/**
+ * Add some padding on text start and end so that edges can match something.
+ * Intended to be called only from within patch_apply.
+ * @param {!Array.<!patch_obj>} patches Array of patch objects.
+ * @return {string} The padding string added to each side.
+ */
+diff_match_patch.prototype.patch_addPadding = function(patches) {
+ var paddingLength = this.Patch_Margin;
+ var nullPadding = '';
+ for (var x = 1; x <= paddingLength; x++) {
+ nullPadding += String.fromCharCode(x);
+ }
+
+ // Bump all the patches forward.
+ for (var x = 0; x < patches.length; x++) {
+ patches[x].start1 += paddingLength;
+ patches[x].start2 += paddingLength;
+ }
+
+ // Add some padding on start of first diff.
+ var patch = patches[0];
+ var diffs = patch.diffs;
+ if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
+ // Add nullPadding equality.
+ diffs.unshift([DIFF_EQUAL, nullPadding]);
+ patch.start1 -= paddingLength; // Should be 0.
+ patch.start2 -= paddingLength; // Should be 0.
+ patch.length1 += paddingLength;
+ patch.length2 += paddingLength;
+ } else if (paddingLength > diffs[0][1].length) {
+ // Grow first equality.
+ var extraLength = paddingLength - diffs[0][1].length;
+ diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
+ patch.start1 -= extraLength;
+ patch.start2 -= extraLength;
+ patch.length1 += extraLength;
+ patch.length2 += extraLength;
+ }
+
+ // Add some padding on end of last diff.
+ patch = patches[patches.length - 1];
+ diffs = patch.diffs;
+ if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
+ // Add nullPadding equality.
+ diffs.push([DIFF_EQUAL, nullPadding]);
+ patch.length1 += paddingLength;
+ patch.length2 += paddingLength;
+ } else if (paddingLength > diffs[diffs.length - 1][1].length) {
+ // Grow last equality.
+ var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
+ diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
+ patch.length1 += extraLength;
+ patch.length2 += extraLength;
+ }
+
+ return nullPadding;
+};
+
+
+/**
+ * Look through the patches and break up any which are longer than the maximum
+ * limit of the match algorithm.
+ * @param {!Array.<!patch_obj>} patches Array of patch objects.
+ */
+diff_match_patch.prototype.patch_splitMax = function(patches) {
+ var patch_size = this.Match_MaxBits;
+ for (var x = 0; x < patches.length; x++) {
+ if (patches[x].length1 > patch_size) {
+ var bigpatch = patches[x];
+ // Remove the big old patch.
+ patches.splice(x--, 1);
+ var start1 = bigpatch.start1;
+ var start2 = bigpatch.start2;
+ var precontext = '';
+ while (bigpatch.diffs.length !== 0) {
+ // Create one of several smaller patches.
+ var patch = new patch_obj();
+ var empty = true;
+ patch.start1 = start1 - precontext.length;
+ patch.start2 = start2 - precontext.length;
+ if (precontext !== '') {
+ patch.length1 = patch.length2 = precontext.length;
+ patch.diffs.push([DIFF_EQUAL, precontext]);
+ }
+ while (bigpatch.diffs.length !== 0 &&
+ patch.length1 < patch_size - this.Patch_Margin) {
+ var diff_type = bigpatch.diffs[0][0];
+ var diff_text = bigpatch.diffs[0][1];
+ if (diff_type === DIFF_INSERT) {
+ // Insertions are harmless.
+ patch.length2 += diff_text.length;
+ start2 += diff_text.length;
+ patch.diffs.push(bigpatch.diffs.shift());
+ empty = false;
+ } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&
+ patch.diffs[0][0] == DIFF_EQUAL &&
+ diff_text.length > 2 * patch_size) {
+ // This is a large deletion. Let it pass in one chunk.
+ patch.length1 += diff_text.length;
+ start1 += diff_text.length;
+ empty = false;
+ patch.diffs.push([diff_type, diff_text]);
+ bigpatch.diffs.shift();
+ } else {
+ // Deletion or equality. Only take as much as we can stomach.
+ diff_text = diff_text.substring(0, patch_size - patch.length1 -
+ this.Patch_Margin);
+ patch.length1 += diff_text.length;
+ start1 += diff_text.length;
+ if (diff_type === DIFF_EQUAL) {
+ patch.length2 += diff_text.length;
+ start2 += diff_text.length;
+ } else {
+ empty = false;
+ }
+ patch.diffs.push([diff_type, diff_text]);
+ if (diff_text == bigpatch.diffs[0][1]) {
+ bigpatch.diffs.shift();
+ } else {
+ bigpatch.diffs[0][1] =
+ bigpatch.diffs[0][1].substring(diff_text.length);
+ }
+ }
+ }
+ // Compute the head context for the next patch.
+ precontext = this.diff_text2(patch.diffs);
+ precontext =
+ precontext.substring(precontext.length - this.Patch_Margin);
+ // Append the end context for this patch.
+ var postcontext = this.diff_text1(bigpatch.diffs)
+ .substring(0, this.Patch_Margin);
+ if (postcontext !== '') {
+ patch.length1 += postcontext.length;
+ patch.length2 += postcontext.length;
+ if (patch.diffs.length !== 0 &&
+ patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {
+ patch.diffs[patch.diffs.length - 1][1] += postcontext;
+ } else {
+ patch.diffs.push([DIFF_EQUAL, postcontext]);
+ }
+ }
+ if (!empty) {
+ patches.splice(++x, 0, patch);
+ }
+ }
+ }
+ }
+};
+
+
+/**
+ * Take a list of patches and return a textual representation.
+ * @param {!Array.<!patch_obj>} patches Array of patch objects.
+ * @return {string} Text representation of patches.
+ */
+diff_match_patch.prototype.patch_toText = function(patches) {
+ var text = [];
+ for (var x = 0; x < patches.length; x++) {
+ text[x] = patches[x];
+ }
+ return text.join('');
+};
+
+
+/**
+ * Parse a textual representation of patches and return a list of patch objects.
+ * @param {string} textline Text representation of patches.
+ * @return {!Array.<!patch_obj>} Array of patch objects.
+ * @throws {!Error} If invalid input.
+ */
+diff_match_patch.prototype.patch_fromText = function(textline) {
+ var patches = [];
+ if (!textline) {
+ return patches;
+ }
+ var text = textline.split('\n');
+ var textPointer = 0;
+ var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
+ while (textPointer < text.length) {
+ var m = text[textPointer].match(patchHeader);
+ if (!m) {
+ throw new Error('Invalid patch string: ' + text[textPointer]);
+ }
+ var patch = new patch_obj();
+ patches.push(patch);
+ patch.start1 = parseInt(m[1], 10);
+ if (m[2] === '') {
+ patch.start1--;
+ patch.length1 = 1;
+ } else if (m[2] == '0') {
+ patch.length1 = 0;
+ } else {
+ patch.start1--;
+ patch.length1 = parseInt(m[2], 10);
+ }
+
+ patch.start2 = parseInt(m[3], 10);
+ if (m[4] === '') {
+ patch.start2--;
+ patch.length2 = 1;
+ } else if (m[4] == '0') {
+ patch.length2 = 0;
+ } else {
+ patch.start2--;
+ patch.length2 = parseInt(m[4], 10);
+ }
+ textPointer++;
+
+ while (textPointer < text.length) {
+ var sign = text[textPointer].charAt(0);
+ try {
+ var line = decodeURI(text[textPointer].substring(1));
+ } catch (ex) {
+ // Malformed URI sequence.
+ throw new Error('Illegal escape in patch_fromText: ' + line);
+ }
+ if (sign == '-') {
+ // Deletion.
+ patch.diffs.push([DIFF_DELETE, line]);
+ } else if (sign == '+') {
+ // Insertion.
+ patch.diffs.push([DIFF_INSERT, line]);
+ } else if (sign == ' ') {
+ // Minor equality.
+ patch.diffs.push([DIFF_EQUAL, line]);
+ } else if (sign == '@') {
+ // Start of next patch.
+ break;
+ } else if (sign === '') {
+ // Blank line? Whatever.
+ } else {
+ // WTF?
+ throw new Error('Invalid patch mode "' + sign + '" in: ' + line);
+ }
+ textPointer++;
+ }
+ }
+ return patches;
+};
+
+
+/**
+ * Class representing one patch operation.
+ * @constructor
+ */
+function patch_obj() {
+ /** @type {!Array.<!diff_match_patch.Diff>} */
+ this.diffs = [];
+ /** @type {?number} */
+ this.start1 = null;
+ /** @type {?number} */
+ this.start2 = null;
+ /** @type {number} */
+ this.length1 = 0;
+ /** @type {number} */
+ this.length2 = 0;
+}
+
+
+/**
+ * Emmulate GNU diff's format.
+ * Header: @@ -382,8 +481,9 @@
+ * Indicies are printed as 1-based, not 0-based.
+ * @return {string} The GNU diff string.
+ */
+patch_obj.prototype.toString = function() {
+ var coords1, coords2;
+ if (this.length1 === 0) {
+ coords1 = this.start1 + ',0';
+ } else if (this.length1 == 1) {
+ coords1 = this.start1 + 1;
+ } else {
+ coords1 = (this.start1 + 1) + ',' + this.length1;
+ }
+ if (this.length2 === 0) {
+ coords2 = this.start2 + ',0';
+ } else if (this.length2 == 1) {
+ coords2 = this.start2 + 1;
+ } else {
+ coords2 = (this.start2 + 1) + ',' + this.length2;
+ }
+ var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n'];
+ var op;
+ // Escape the body of the patch with %xx notation.
+ for (var x = 0; x < this.diffs.length; x++) {
+ switch (this.diffs[x][0]) {
+ case DIFF_INSERT:
+ op = '+';
+ break;
+ case DIFF_DELETE:
+ op = '-';
+ break;
+ case DIFF_EQUAL:
+ op = ' ';
+ break;
+ }
+ text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n';
+ }
+ return text.join('').replace(/%20/g, ' ');
+};
+
+
+// Export these global variables so that they survive Google's JS compiler.
+window['diff_match_patch'] = diff_match_patch;
+window['patch_obj'] = patch_obj;
+window['DIFF_DELETE'] = DIFF_DELETE;
+window['DIFF_INSERT'] = DIFF_INSERT;
+window['DIFF_EQUAL'] = DIFF_EQUAL;
diff --git a/src/pootle_it/html/js/editor.js b/src/pootle_it/html/js/editor.js
new file mode 100644
index 0000000..555a482
--- /dev/null
+++ b/src/pootle_it/html/js/editor.js
@@ -0,0 +1,1815 @@
+(function ($) {
+
+ window.PTL = window.PTL || {};
+
+ // XXX: maybe this can go into its own file
+ PTL.utils = {
+
+ /* Gets current URL's hash */
+ getHash: function (win) {
+ // Mozilla has a bug when it automatically unescapes %26 to '&'
+ // when getting hash from `window.location.hash'.
+ // So, we have to extract it from the `window.location'.
+ // Also, we don't need to decodeURIComponent() the hash
+ // as it will break encoded ampersand again
+ // (decoding can be done on the higher level, if needed)
+ return (win || window).location.toString().split('#', 2)[1] || '';
+ },
+
+ decodeURIParameter: function(s) {
+ return decodeURIComponent(s.replace(/\+/g, " "));
+ },
+
+ getParsedHash: function (h) {
+ var params = new Object();
+ var r = /([^&;=]+)=?([^&;]*)/g;
+ if (h == undefined) {
+ h = this.getHash();
+ }
+ var e;
+ while (e = r.exec(h)) {
+ params[this.decodeURIParameter(e[1])] = this.decodeURIParameter(e[2]);
+ }
+ return params;
+ },
+
+ /* Updates current URL's hash */
+ updateHashPart: function (part, newVal, removeArray) {
+ var params = new Array();
+ var r = /([^&;=]+)=?([^&;]*)/g;
+ var h = this.getHash();
+ var e, ok;
+ while (e = r.exec(h)) {
+ var p = this.decodeURIParameter(e[1]);
+ if (p == part) {
+ // replace with the given value
+ params.push(e[1] + '=' + encodeURIComponent(newVal));
+ ok = true;
+ } else if ($.inArray(p, removeArray) == -1) {
+ // use the parameter as is
+ params.push(e[1] + '=' + e[2]);
+ }
+ }
+ // if there was no old parameter, push the param at the end
+ if (!ok) {
+ params.push(encodeURIComponent(part) + '=' + encodeURIComponent(newVal));
+ }
+ return params.join('&');
+ }
+ };
+
+ // XXX: Know of a better place for this?
+ /* Returns the number (size) of properties of a given object */
+ Object.size = function (obj) {
+ var size = 0, key;
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ size++;
+ }
+ }
+ return size;
+ };
+
+ PTL.editor = {
+
+ /* Initializes the editor */
+ init: function (options) {
+
+ /* Default settings */
+ this.settings = {
+ secure: false,
+ mt: []
+ };
+ /* Merge given options with default settings */
+ if (options) {
+ $.extend(this.settings, options);
+ }
+
+ /* Initialize variables */
+ this.units = {};
+ this.store = $("div#pootle_path").text();
+ this.directory = $("div#directory").text();
+ this.currentPage = 1;
+ this.currentNumPages = 0;
+ this.pagesGot = {};
+ this.filter = "all";
+ this.checks = [];
+ this.ctxtGap = 0;
+ this.keepState = false;
+ this.preventNavigation = false;
+
+ this.isLoading = true;
+ this.showActivity();
+
+ /* Currently active search fields */
+ this.searchFields = [];
+ /* Valid search field options */
+ this.searchOptions = ['source', 'target', 'notes', 'locations'];
+
+ /* Regular expressions */
+ this.cpRE = /^(<[^>]+>|\[n\|t]|\W$^\n)*(\b|$)/gm;
+ this.escapeRE = /<[^<]*?>|\r\n|[\r\n\t&<>]/gm;
+ this.searchRE = /^in:.+|\sin:.+/i;
+
+ /* TM requests handler */
+ this.tmReq = null;
+
+ /* Differencer */
+ this.differencer = new diff_match_patch();
+
+ /* Compile templates */
+ this.tmpl = {vUnit: $.template($("#view_unit").html()),
+ tm: $.template($("#tm_suggestions").html())}
+
+ /* Set initial focus on page load */
+ this.focused = $(".translate-original-focus textarea").get(0);
+
+ /*
+ * Bind event handlers
+ */
+
+ /* Fuzzy / unfuzzy */
+ $("textarea.translation").live("keyup blur", function () {
+ if (!PTL.editor.keepState &&
+ $(this).attr("defaultValue") != $(this).val()) {
+ PTL.editor.ungoFuzzy();
+ }
+ });
+ $("input.fuzzycheck").live("click", function () {
+ if (PTL.editor.isFuzzy()) {
+ PTL.editor.doFuzzyArea();
+ } else {
+ PTL.editor.undoFuzzyArea();
+ }
+ });
+
+ /* Suggest / submit */
+ $(".switch-suggest-mode a").live("click", function () {
+ PTL.editor.toggleSuggestMode();
+ return false;
+ });
+
+ /* Update focus when appropriate */
+ $(".focusthis").live("focus", function (e) {
+ PTL.editor.focused = e.target;
+ });
+
+ /* Write TM results, special chars... into the currently focused element */
+ $(".writetm, .writespecial, .translate-full .highlight-escape, .translate-full .highlight-html").live("click", this.copyText);
+
+ /* Copy original translation */
+ $("a.copyoriginal").live("click", function () {
+ var sources = $(".translation-text", $(this).parent().parent().parent());
+ PTL.editor.copyOriginal(sources);
+ });
+ $("div.suggestion").live("click", function () {
+ // Don't copy if text has been selected
+ if (PTL.editor.getSelectedText() != "") {
+ return;
+ }
+ var sources = $(".suggestion-translation", this);
+ PTL.editor.copyOriginal(sources);
+ });
+
+ /* Editor navigation/submission */
+ $("table.translate-table").live("editor_ready", this.ready);
+ $("tr.view-row").live("click", this.gotoUnit);
+ $("input#item-number").live("keypress", function (e) {
+ // Perform action only when the 'Enter' key is pressed
+ if (e.keyCode == 13) {
+ PTL.editor.gotoPage(parseInt($("input#item-number").val()));
+ }
+ });
+ $("input.submit, input.suggest").live("click", this.processSubmit);
+ $("input.previous, input.next").live("click", this.gotoPrevNext);
+ $("#suggestion-container .rejectsugg").live("click", this.rejectSuggestion);
+ $("#suggestion-container .acceptsugg").live("click", this.acceptSuggestion);
+ $("#translate-checks-block .rejectcheck").live("click", this.rejectCheck);
+
+ /* Filtering */
+ $("div#filter-status select").live("change", this.filterStatus);
+ $("div#filter-checks select").live("change", this.filterChecks);
+ $("a.morecontext").live("click", this.getMoreContext);
+
+ /* Search */
+ $("input#id_search").live("keypress", function (e) {
+ if (e.keyCode == 13) {
+ e.preventDefault();
+ PTL.editor.search();
+ }
+ });
+
+ /* Bind hotkeys */
+ shortcut.add('ctrl+return', function () {
+ if (PTL.editor.isSuggestMode()) {
+ $("input.suggest").trigger("click");
+ } else {
+ $("input.submit").trigger("click");
+ }
+ });
+ shortcut.add('ctrl+space', function (e) {
+ // To prevent the click event which occurs in Firefox
+ // but not in Chrome (and not in IE)
+ if (e && e.preventDefault) {
+ e.preventDefault();
+ }
+
+ // Prevent automatic unfuzzying on keyup
+ PTL.editor.keepState = true;
+
+ if (PTL.editor.isFuzzy()) {
+ PTL.editor.ungoFuzzy();
+ } else {
+ PTL.editor.goFuzzy();
+ }
+ });
+ shortcut.add('ctrl+shift+space', function () {
+ PTL.editor.toggleSuggestMode();
+ });
+ shortcut.add('ctrl+up', function () {
+ $("input.previous").trigger("click");
+ });
+ shortcut.add('ctrl+down', function () {
+ $("input.next").trigger("click");
+ });
+ shortcut.add('ctrl+shift+home', function () {
+ PTL.editor.gotoFirstPage();
+ });
+ shortcut.add('ctrl+shift+end', function () {
+ PTL.editor.gotoLastPage();
+ });
+ shortcut.add('ctrl+shift+pageup', function () {
+ PTL.editor.gotoPrevPage();
+ });
+ shortcut.add('ctrl+shift+pagedown', function () {
+ PTL.editor.gotoNextPage();
+ });
+ shortcut.add('ctrl+shift+u', function () {
+ $("input#item-number").focus().select();
+ });
+ shortcut.add('ctrl+shift+s', function () {
+ $("#id_search").focus().select();
+ });
+ $("#id_search").focus(function() {
+ $(this).attr("focused", true);
+ });
+ $("#id_search").blur(function() {
+ $(this).attr("focused", "");
+ });
+ shortcut.add('escape', function () {
+ if ($("#id_search").attr("focused")) {
+ $("#id_search").blur();
+ }
+ });
+
+ /* XHR activity indicator */
+ $(document).ajaxStart(function () {
+ clearTimeout(PTL.editor.delayedActivityTimer);
+ PTL.editor.delayedActivityTimer = setTimeout(function () {
+ PTL.editor.showActivity();
+ }, 3000);
+ });
+ $(document).ajaxStop(function () {
+ clearTimeout(PTL.editor.delayedActivityTimer);
+ if (!PTL.editor.isLoading) {
+ PTL.editor.hideActivity();
+ }
+ });
+
+ /* Load MT backends */
+ $.each(this.settings.mt, function () {
+ var backend = this.name;
+
+ $.ajax({
+ url: m('js/mt/' + backend + '.js'),
+ async: false,
+ dataType: 'script',
+ success: function () {
+ setTimeout(function () {
+ PTL.editor.mt[backend].init();
+ }, 0);
+ $("table.translate-table").live("mt_ready",
+ PTL.editor.mt[backend].ready);
+ }
+ });
+ });
+
+ /* History support */
+ setTimeout(function () {
+ $.history.init(function (hash) {
+ var params = PTL.utils.getParsedHash(hash);
+
+ var withUid = false;
+ var pageNumber = undefined;
+
+ // Walk through known filtering criterias and apply them to the editor object
+
+ if ('unit' in params) {
+ var uid = parseInt(params['unit']);
+
+ if (uid && !isNaN(uid)) {
+ if (PTL.editor.activeUid != uid &&
+ PTL.editor.units[uid] == undefined) {
+ PTL.editor.activeUid = uid;
+ withUid = true;
+ } else {
+ // if uid is already preloaded, just switch to it
+ PTL.editor.activeUid = uid;
+ PTL.editor.displayEditUnit(uid);
+ return;
+ }
+ }
+ } else if ('page' in params) {
+ var p = parseInt(params['page']);
+
+ if (p && !isNaN(p) && p > 0) {
+ pageNumber = p;
+ }
+ }
+
+ if ('filter' in params) {
+ var a = params['filter'].split(',');
+
+ // Set current state
+ PTL.editor.filter = a.shift();
+ PTL.editor.checks = (PTL.editor.filter == "checks") ? a : [];
+ }
+
+ if ('search' in params) {
+ // Note that currently the search, if provided along with the other filters,
+ // would override them
+ PTL.editor.filter = "search";
+ PTL.editor.searchText = params['search'];
+ if ('sfields' in params) {
+ PTL.editor.searchFields = params['sfields'].split(',');
+ }
+ }
+
+ // Update the filter UI to match the current filter
+
+ // disable navigation on UI toolbar events to prevent data reload
+ PTL.editor.preventNavigation = true;
+
+ $("div#filter-status select [value='" + PTL.editor.filter + "']").attr("selected", "selected");
+ if (PTL.editor.filter == "checks") {
+ // if the checks selector is empty (i.e. the 'change' event was not fired
+ // because the selection did not change), force the update to populate the selector
+ if ($("div#filter-checks").length == 0) {
+ PTL.editor.filterStatus();
+ }
+ $("div#filter-checks select [value='" + PTL.editor.checks[0] + "']").attr("selected", "selected");
+ }
+
+ if (PTL.editor.filter == "search") {
+ $("#id_search").triggerHandler('focus');
+ $("#id_search").val(PTL.editor.searchText);
+
+ $("div.advancedsearch input").each(function () {
+ if ($.inArray($(this).val(), PTL.editor.searchFields) >= 0) {
+ $(this).attr("checked", "checked");
+ } else {
+ $(this).removeAttr("checked");
+ }
+ });
+ }
+ // re-enable normal event handling
+ PTL.editor.preventNavigation = false;
+
+ // Load the units that match the given criterias
+
+ PTL.editor.getViewUnits({pager: true, page: pageNumber, withUid: withUid});
+
+ if (PTL.editor.hasResults) {
+ // ensure all the data is preloaded before rendering the table
+ // otherwise, when the page is reloaded, some pages will not yet be there
+ PTL.editor.fetchPages(false);
+
+ // now we can safely render the table
+ PTL.editor.displayEditUnit(PTL.editor.activeUid);
+ }
+
+ }, {'unescape': true});
+ }, 1); // not sure why we had a 1000ms timeout here
+
+ },
+
+ /* Stuff to be done when the editor is ready */
+ ready: function () {
+ // Set textarea's initial height as well as the max-height
+ var maxheight = $(window).height() * 0.3;
+ $('textarea.expanding').TextAreaExpander('10', maxheight);
+
+ // Focus on the first textarea, if any
+ if ($(".focusthis").get(0)) {
+ $(".focusthis").get(0).focus();
+ }
+
+ // Highlight stuff
+ PTL.editor.hlSearch();
+ //PTL.editor.hlTerms(); // Disabled for now — it's annoying!
+
+ if (PTL.editor.settings.tmUrl != '') {
+ // Start retrieving TM units from amaGama
+ PTL.editor.getTMUnits();
+ }
+
+ // All is ready, let's call the ready functions of the MT backends
+ $("table.translate-table").trigger("mt_ready");
+
+ PTL.editor.isLoading = false;
+ PTL.editor.hideActivity();
+
+ // clear any pending 'Loading...' indicator timer
+ // as ajaxStop() is not fired in IE properly
+ // at initial page load (?!)
+ clearTimeout(PTL.editor.delayedActivityTimer);
+ },
+
+
+ /*
+ * Text utils
+ */
+
+ escapeUnsafeRegexSymbols: function (s) {
+ var i, r = "\\.+*?[^]$(){}=!<>¦:";
+ for (i = 0; i < r.length; i++) {
+ s = s.replace(new RegExp("\\" + r.charAt(i),"g"), "\\" + r.charAt(i));
+ }
+ return s;
+ },
+
+ makeRegexForMultipleWords: function (s) {
+ var i, w = s.split(' ');
+ for (i = 0; i < w.length; i++) {
+ w[i] = this.escapeUnsafeRegexSymbols(w[i]);
+ }
+ return '(' + w.join("|") + ')';
+ },
+
+ /* Highlights search results */
+ hlSearch: function () {
+ var hl = PTL.editor.filter == "search" ? PTL.editor.searchText : "",
+ sel = [],
+ selMap = {notes: "div.developer-comments",
+ locations: "div.translate-locations",
+ source: "td.translate-original, div.original div.translation-text",
+ target: "td.translate-translation"};
+
+ // Build highlighting selector based on chosen search fields
+ $.each(PTL.editor.searchFields, function (i, field) {
+ sel.push(selMap[field]);
+ });
+
+ // By default we search source and target texts
+ if (!sel.length) {
+ sel = [selMap['source'], selMap['target']];
+ }
+
+ $(sel.join(", ")).highlightRegex(new RegExp(PTL.editor.makeRegexForMultipleWords(hl), "i"));
+ },
+
+ /* Highlights matching terms in the source text */
+ hlTerms: function () {
+ var term;
+
+ $(".tm-original").each(function () {
+ term = $(this).text();
+ $("div.original .translation-text").highlightRegex(new RegExp(PTL.editor.escapeUnsafeRegexSymbols(term), "g"));
+ });
+ },
+
+
+ /* Copies text into the focused textarea */
+ copyText: function (e) {
+ var text, element, start;
+
+ // Determine which text we need
+ if ($(".tm-translation", this).length) {
+ text = $(".tm-translation", this).text();
+ } else {
+ text = $(this).text();
+ }
+
+ element = $(PTL.editor.focused);
+ start = element.caret().start + text.length;
+
+ element.val(element.caret().replace(text));
+ element.caret(start, start);
+ },
+
+
+ /* Copies source text(s) into the target textarea(s)*/
+ copyOriginal: function (sources) {
+ var cleanSources = [];
+ $.each(sources, function (i) {
+ cleanSources[i] = $(this).text();
+ });
+
+ var targets = $("[id^=id_target_f_]");
+ if (targets.length) {
+ var i, active,
+ max = cleanSources.length - 1;
+
+ for (var i=0; i<targets.length; i++) {
+ var newval = cleanSources[i] || cleanSources[max];
+ $(targets.get(i)).val(newval);
+ }
+
+ // Focus on the first textarea
+ active = $(targets).get(0);
+ active.focus();
+ // Make this fuzzy
+ PTL.editor.goFuzzy();
+ // Place cursor at start of target text
+ PTL.editor.cpRE.exec($(active).val());
+ i = PTL.editor.cpRE.lastIndex;
+ $(active).caret(i, i);
+ PTL.editor.cpRE.lastIndex = 0;
+ }
+ },
+
+
+ /* Gets selected text */
+ getSelectedText: function () {
+ var t = '';
+
+ if (window.getSelection) {
+ t = window.getSelection();
+ } else if (document.getSelection) {
+ t = document.getSelection();
+ } else if (document.selection) {
+ t = document.selection.createRange().text;
+ }
+
+ return t;
+ },
+
+ /* Escapes HTML tags */
+ escapeHtml: function (s) {
+ return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").
+ replace(/>/g,"&gt;").replace(/\n/,"<br/>");
+ },
+
+
+ /* Fancy escapes to highlight parts of the text such as HTML tags */
+ fancyEscape: function (text) {
+ function replace(match) {
+ var replaced,
+ escapeHl= '<span class="highlight-escape">%s</span>',
+ htmlHl = '<span class="highlight-html">&lt;%s&gt;</span>',
+ submap = {
+ '\r\n': escapeHl.replace(/%s/, '\\r\\n') + '<br/>\n',
+ '\r': escapeHl.replace(/%s/, '\\r') + '<br/>\n',
+ '\n': escapeHl.replace(/%s/, '\\n') + '<br/>\n',
+ '\t': escapeHl.replace(/%s/, '\\t') + '\t',
+ '&': '&amp;',
+ '<': '&lt;',
+ '>': '&gt;'
+ }
+
+ replaced = submap[match];
+
+ if (replaced == undefined) {
+ replaced = htmlHl.replace(/%s/, match.slice(1, match.length-1));
+ }
+
+ return replaced;
+ }
+
+ var orig = text,
+ matches = text.match(this.escapeRE);
+
+ for (var i in matches) {
+ orig = orig.replace(matches[i], replace(matches[i]))
+ }
+
+ return orig;
+ },
+
+
+ /* Does the actual diffing */
+ doDiff: function (a, b) {
+ var d, op, text,
+ textDiff = "",
+ removed = "",
+ diff = this.differencer.diff_main(a, b);
+
+ this.differencer.diff_cleanupSemantic(diff);
+
+ $.each(diff, function (k, v) {
+ op = v[0];
+ text = v[1];
+
+ if (op == 0) {
+ if (removed) {
+ textDiff += '<span class="diff-delete">' + PTL.editor.fancyEscape(removed) + '</span>'
+ removed = "";
+ }
+ textDiff += PTL.editor.fancyEscape(text);
+ } else if (op == 1) {
+ if (removed) {
+ // This is part of a substitution, not a plain insertion. We
+ // will format this differently.
+ textDiff += '<span class="diff-replace">' + PTL.editor.fancyEscape(text) + '</span>';
+ removed = "";
+ } else {
+ textDiff += '<span class="diff-insert">' + PTL.editor.fancyEscape(text) + '</span>';
+ }
+ } else if (op == -1) {
+ removed = text;
+ }
+ });
+
+ if (removed) {
+ textDiff += '<span class="diff-delete">' + PTL.editor.fancyEscape(removed) + '</span>';
+ }
+
+ return textDiff;
+ },
+
+
+ /*
+ * Fuzzying / unfuzzying functions
+ */
+
+ /* Sets the current unit's styling as fuzzy */
+ doFuzzyArea: function () {
+ $("tr.edit-row").addClass("fuzzy-unit");
+ },
+
+
+ /* Unsets the current unit's styling as fuzzy */
+ undoFuzzyArea: function () {
+ $("tr.edit-row").removeClass("fuzzy-unit");
+ },
+
+
+ /* Checks the current unit's fuzzy checkbox */
+ doFuzzyBox: function () {
+ $("input.fuzzycheck").attr("checked", "checked");
+ },
+
+
+ /* Unchecks the current unit's fuzzy checkbox */
+ undoFuzzyBox: function () {
+ $("input.fuzzycheck").removeAttr("checked");
+ },
+
+
+ /* Sets the current unit status as fuzzy (both styling and checkbox) */
+ goFuzzy: function () {
+ if (!this.isFuzzy()) {
+ this.keepState = true;
+ this.doFuzzyArea();
+ this.doFuzzyBox();
+ }
+ },
+
+
+ /* Unsets the current unit status as fuzzy (both styling and checkbox) */
+ ungoFuzzy: function () {
+ if (this.isFuzzy()) {
+ this.keepState = true;
+ this.undoFuzzyArea();
+ this.undoFuzzyBox();
+ }
+ },
+
+
+ /* Returns whether the current unit is fuzzy or not */
+ isFuzzy: function () {
+ return $("input.fuzzycheck").attr("checked");
+ },
+
+
+ /*
+ * Suggest / submit mode functions
+ */
+
+ /* Changes the editor into suggest mode */
+ doSuggestMode: function () {
+ $("table.translate-table").addClass("suggest-mode");
+ },
+
+
+ /* Changes the editor into submit mode */
+ undoSuggestMode: function () {
+ $("table.translate-table").removeClass("suggest-mode");
+ },
+
+
+ /* Returns true if the editor is in suggest mode */
+ isSuggestMode: function () {
+ return $("table.translate-table").hasClass("suggest-mode");
+ },
+
+
+ /* Toggles suggest/submit modes */
+ toggleSuggestMode: function () {
+ if (this.isSuggestMode()) {
+ this.undoSuggestMode();
+ } else {
+ this.doSuggestMode();
+ }
+ },
+
+ showActivity: function (force) {
+ if ($("#xhr-error").is(':hidden')) {
+ $("#xhr-activity").show();
+ }
+ },
+
+ hideActivity: function () {
+ $("#xhr-activity").hide();
+ },
+
+ /*
+ * Error handling
+ */
+
+ /* Displays error messages returned in XHR requests */
+ displayError: function (msg) {
+ if (msg) {
+ this.hideActivity();
+ $("#xhr-error span").text(msg).parent().stop(true, true).fadeIn(300).delay(2000).fadeOut(3500);
+ }
+ },
+
+
+ /* Handles XHR errors */
+ error: function (xhr, s) {
+ // TODO: i18n
+ var msg = "";
+
+ if (xhr.status == 0) {
+ msg = "Error while connecting to the server.";
+ } else if (xhr.status == 500) {
+ msg = "Server error.";
+ } else if (s == "timeout") {
+ msg = "Server seems down, try again later.";
+ } else {
+ // Since we use jquery-jsonp, we must differentiate between
+ // the passed arguments
+ if (xhr instanceof XMLHttpRequest) {
+ msg = $.parseJSON(xhr.responseText);
+ } else {
+ msg = "Unknown error.";
+ }
+ }
+
+ PTL.editor.displayError(msg);
+ },
+
+
+ /*
+ * Misc functions
+ */
+
+ /* Gets common request data */
+ getReqData: function () {
+ var reqData = {};
+
+ switch (this.filter) {
+
+ case "checks":
+ if (this.checks.length) {
+ reqData.matchnames = this.checks.join(",");
+ }
+ break;
+
+ case "search":
+ reqData.search = this.searchText;
+
+ // Override defaults if any fields have been specified
+ if (this.searchFields.length) {
+ reqData.sfields = this.searchFields;
+ } else {
+ reqData.sfields = ["source", "target"];
+ }
+ break;
+
+ case "suggestions":
+ reqData.matchnames = 'hassuggestion'
+ break;
+
+ case "mysuggestions":
+ reqData.matchnames = 'ownsuggestion'
+ break;
+
+ case "all":
+ break;
+
+ case "incomplete":
+ reqData.unitstates = "untranslated,fuzzy";
+ break;
+
+ default:
+ reqData.unitstates = this.filter;
+ break;
+ }
+
+ return reqData;
+ },
+
+
+ /*
+ * Unit navigation, display, submission
+ */
+
+ /* Gets the view units that refer to currentPage */
+ getViewUnits: function (opts) {
+ var extraData, reqData, viewUrl,
+ defaults = {async: false, limit: 0, page: this.currentPage,
+ pager: false, withUid: false},
+ urlStr = this.store ? this.store + '/view' : this.directory + 'view.html';
+ // Merge passed arguments with defaults
+ opts = $.extend({}, defaults, opts);
+
+ // Extend URL if needed
+ if (opts.limit != 0) {
+ urlStr = urlStr + '/limit/' + limit;
+ }
+ viewUrl = l(urlStr);
+
+ // Extra request variables specific to this function
+ extraData = {page: opts.page};
+ if (Object.size(this.meta) == 0) {
+ extraData.meta = true;
+ }
+ if (opts.pager) {
+ extraData.pager = opts.pager;
+ }
+ if (opts.withUid) {
+ extraData.uid = this.activeUid;
+ // We don't know the page number beforehand —
+ // delete the parameter as it's useless
+ delete extraData.page
+ }
+ reqData = $.extend(extraData, this.getReqData());
+
+ $.ajax({
+ url: viewUrl,
+ data: reqData,
+ dataType: 'json',
+ async: opts.async,
+ success: function (data) {
+ // Fill in metadata information if we don't have it yet
+ if (Object.size(PTL.editor.meta) == 0 && data.meta) {
+ PTL.editor.meta = data.meta;
+ }
+
+ // Receive pager in case we have asked for it
+ if (opts.pager) {
+ if (data.pager) {
+ PTL.editor.hasResults = true;
+
+ // Clear old data and add new results
+ PTL.editor.pagesGot = {};
+ PTL.editor.units = {};
+ PTL.editor.updatePager(data.pager);
+ // PTL.editor.fetchPages(false);
+ if (data.uid) {
+ PTL.editor.activeUid = data.uid;
+ }
+ }
+ }
+
+ // Store view units in the client
+ if (data.units.length) {
+ // Determine in which page we want to save units, as we may not
+ // have specified it in the GET parameters — in that case, the
+ // page number is specified within the response pager
+ if (opts.withUid && data.pager) {
+ var page = data.pager.number;
+ } else {
+ var page = opts.page;
+ }
+
+ PTL.editor.pagesGot[page] = [];
+
+ // Copy retrieved units to the client
+ $.each(data.units, function () {
+ PTL.editor.units[this.id] = this;
+ PTL.editor.pagesGot[page].push(this.id);
+ });
+
+ PTL.editor.hasResults = true;
+ } else {
+ PTL.editor.hasResults = false;
+ // TODO: i18n
+ PTL.editor.displayError("No results.");
+ // Clear the results table
+ PTL.editor.reDraw(null);
+ }
+ },
+ error: PTL.editor.error
+ });
+ },
+
+
+ /* Builds view rows for units represented by 'uids' */
+ buildRows: function (uids) {
+ var _this, i, unit,
+ cls = "even",
+ even = true,
+ rows = "";
+
+ for (i=0; i<uids.length; i++) {
+ _this = uids[i].id || uids[i];
+ unit = this.units[_this];
+
+ // Build row i
+ rows += '<tr id="row' + _this + '" class="view-row ' + cls + '">';
+ rows += this.tmpl.vUnit($, {data: {meta: this.meta,
+ unit: unit}}).join("");
+ rows += '</tr>';
+
+ // Update odd/even class
+ cls = even ? "odd" : "even";
+ even = !even;
+ }
+
+ return rows;
+ },
+
+
+ /* Builds context rows for units passed as 'units' */
+ buildCtxtRows: function (units) {
+ var i, unit,
+ cls = "even",
+ even = true,
+ rows = "";
+
+ for (i=0; i<units.length; i++) {
+ unit = units[i];
+
+ // Build context row i
+ rows += '<tr id="ctxt' + unit.id + '" class="context-row ' + cls + '">';
+ rows += this.tmpl.vUnit($, {data: {meta: this.meta,
+ unit: unit}}).join("");
+ rows += '</tr>';
+
+ // Update odd/even class
+ cls = even ? "odd" : "even";
+ even = !even;
+ }
+
+ return rows;
+ },
+
+
+ /* Gets uids that should be displayed before/after 'uid' */
+ getUidsBeforeAfter: function (uid) {
+ var howMuch, i, m, prevNextL, tu,
+ uids = {before: [], after: []},
+ limit = parseInt((this.pager.per_page - 1) / 2),
+ current = this.units[uid],
+ prevNext = {prev: "before", next: "after"};
+
+ for (m in prevNext) {
+ tu = current;
+
+ // Fill uids[before|after] with prev/next ids
+ for (i=0; i<limit; i++) {
+ if (tu[m] != undefined && tu[m] in this.units) {
+ var tu = this.units[tu[m]];
+ uids[prevNext[m]].push(tu.id);
+ }
+ }
+ }
+
+ // Only fill remaining rows if we have more units than the limit
+ if (Object.size(this.units) > limit) {
+ prevNextL = {prev: "after", next: "before"};
+
+ for (m in prevNext) {
+ // If we have less units that the limit, fill that in
+ if (uids[prevNextL[m]].length < limit) {
+ // Add (limit - length) units to uids[prevNext[m]]
+ howMuch = limit - uids[prevNextL[m]].length;
+ tu = this.units[uids[prevNext[m]][uids[prevNext[m]].length-1]];
+
+ for (i=0; i<howMuch; i++) {
+ if (tu[m] != undefined) {
+ var tu = this.units[tu[m]];
+ uids[prevNext[m]].push(tu.id);
+ }
+ }
+ }
+ }
+ }
+
+ uids.before.reverse();
+
+ return uids;
+ },
+
+
+ /* Checks and fixes the linking between units */
+ checkUnitsLinking: function () {
+ var first, last, lastInPrevPage, p, pnP;
+
+ for (p in this.pagesGot) {
+ // Ensure we work with integers
+ p = parseInt(p);
+
+ // First and last units in this page
+ first = this.pagesGot[p][0];
+ last = this.pagesGot[p][this.pagesGot[p].length-1];
+ // Check linking to the previous unit from the first unit in this page
+ if (p > 1 && (!this.units[first].hasOwnProperty('prev') || this.units[first].prev == null)) {
+ // We can only set the linking if the previous page
+ // has already been fetched
+ pnP = p - 1;
+ if (pnP in this.pagesGot) {
+ lastInPrevPage = this.pagesGot[pnP][this.pagesGot[pnP].length-1];
+ $.extend(this.units[first], {prev: lastInPrevPage});
+ }
+ }
+
+ // Check linking to the next unit from the last unit in this page
+ if (p < this.pager.num_pages &&
+ (!this.units[last].hasOwnProperty('next') || this.units[last].next == null)) {
+ // We can only set the linking if the next page
+ // has already been fetched
+ pnP = p + 1;
+ if (pnP in this.pagesGot) {
+ $.extend(this.units[last], {next: this.pagesGot[pnP][0]});
+ }
+ }
+ }
+ },
+
+
+ /* Sets the edit view for unit 'uid' */
+ displayEditUnit: function (uid) {
+ var uids, newTbody;
+
+ // Ensure linking is correct before moving to a specific unit
+ this.checkUnitsLinking();
+
+ if (PTL.editor.hasResults) {
+ // Fetch pages asynchronously — we already have the needed pages
+ // so this will return units whenever it can
+ this.fetchPages(true);
+
+ // Get the actual editing widget and the surrounding view rows
+ uids = this.getUidsBeforeAfter(uid);
+ newTbody = this.buildRows(uids.before) +
+ this.getEditUnit(uid) +
+ this.buildRows(uids.after);
+
+ this.reDraw(newTbody);
+ }
+ },
+
+
+ /* reDraws the translate table rows */
+ reDraw: function (newTbody) {
+ var tTable = $("table.translate-table"),
+ where = $("tbody", tTable),
+ oldRows = $("tr", where);
+
+ oldRows.remove();
+
+ // This fixes the issue with tipsy popups staying on the screen
+ // if their owner elements have been removed
+ $('.tipsy').remove(); // kill all open tipsy popups
+
+ where.append(newTbody);
+
+ // We are ready, call the ready handlers
+ $(tTable).trigger("editor_ready");
+ },
+
+
+ /* Fetches more view unit pages in case they're needed */
+ fetchPages: function (async) {
+ var i,
+ current = this.currentPage,
+ candidates = [current, current + 1, current - 1],
+ pages = [];
+
+ // We will only fetch valid pages and pages that haven't
+ // already been fetched
+ for (i=0; i<candidates.length; i++) {
+ if (candidates[i] <= this.pager.num_pages &&
+ candidates[i] > 0 &&
+ !(candidates[i] in this.pagesGot)) {
+ pages.push(candidates[i]);
+ }
+ }
+
+ // Do the actual fetching
+ for (i=0; i<pages.length; i++) {
+ this.getViewUnits({async: async, page: pages[i]});
+ }
+ },
+
+ /* Update filename breadcrumb */
+ updateBreadcrumbs: function (dircrumbs, storecrumbs) {
+ var needUpdate;
+ if (this.dircrumbs && (this.dircrumbs != dircrumbs)) {
+ this.dircrumbs = dircrumbs;
+ needUpdate = true;
+ }
+ if (this.storecrumbs && (this.storecrumbs != storecrumbs)) {
+ this.storecrumbs = storecrumbs;
+ needUpdate = true;
+ }
+ if (needUpdate) {
+ var c = $("#breadcrumbs").contents();
+ c.slice(c.index($("#projectcrumb")) + 1).remove();
+ $('#projectcrumb').after(dircrumbs + storecrumbs);
+ }
+ },
+
+ /* Updates the pager */
+ updatePager: function (pager) {
+ this.pager = pager;
+
+ // If page number or num_pages has changed, redraw pager
+ if (this.currentPage != pager.number ||
+ this.currentNumPages != pager.num_pages) {
+ this.currentPage = pager.number;
+ this.currentNumPages = pager.num_pages;
+
+ // Update UI elements
+ $("input#item-number").val(pager.number);
+ $("span#items-count").text(pager.num_pages);
+ }
+ },
+
+ /* Creates a pager based on the current client data and the given uid */
+ createPager: function (uid) {
+ var newPager = this.pager;
+
+ // In case the given uid is not within the current page,
+ // calculate in which page it is
+ if ($.inArray(uid, this.pagesGot[this.currentPage]) == -1) {
+ var newPageNumber,
+ i = this.currentPage,
+ j = this.currentPage,
+ found = false;
+
+ // Search uid within the pages the client knows of
+ while (!found && (i > 0 || j <= this.pager.num_pages)) {
+ if ($.inArray(uid, this.pagesGot[i]) != -1) {
+ newPageNumber = i;
+ found = true;
+ } else if ($.inArray(uid, this.pagesGot[j]) != -1) {
+ newPageNumber = j;
+ found = true;
+ }
+
+ i--;
+ j++;
+ }
+
+ if (found) {
+ newPager.number = newPageNumber;
+ }
+ }
+
+ return newPager;
+ },
+
+ /* Loads the edit unit 'uid' */
+ getEditUnit: function (uid) {
+ var editor,
+ eClass = "edit-row",
+ editUrl = l('/unit/edit/' + uid),
+ reqData = this.getReqData(),
+ widget = '',
+ ctxt = {before: [], after: []};
+
+ $.ajax({
+ url: editUrl,
+ async: false,
+ data: reqData,
+ dataType: 'json',
+ success: function (data) {
+ widget = data['editor'];
+ storecrumbs = data['storecrumbs'];
+ dircrumbs = data['dircrumbs'];
+ PTL.editor.updateBreadcrumbs(dircrumbs, storecrumbs);
+ // Update pager in case it's needed
+ PTL.editor.updatePager(PTL.editor.createPager(uid));
+
+ if (data.ctxt) {
+ PTL.editor.ctxtGap = 2;
+ ctxt.before = data.ctxt.before;
+ ctxt.after = data.ctxt.after;
+ }
+ },
+ error: PTL.editor.error
+ });
+
+ eClass += this.units[uid].isfuzzy ? " fuzzy-unit" : "";
+ // TODO: i18n
+ editor = (ctxt.before.length ? '<tr class="more-context before"><td colspan="2"><a class="morecontext">Show more context rows</a></td></tr>' : '') +
+ this.buildCtxtRows(ctxt.before) +
+ '<tr id="row' + uid + '" class="' + eClass + '">' +
+ widget + '</tr>' +
+ this.buildCtxtRows(ctxt.after) +
+ (ctxt.after.length ? '<tr class="more-context after"><td colspan="2"><a class="morecontext">Show more context rows</a></td></tr>' : '');
+
+ this.activeUid = uid;
+
+ return editor;
+ },
+
+
+ /* Pushes submissions or suggestions and moves to the next unit */
+ processSubmit: function (e, typeClass) {
+ e.preventDefault();
+
+ var formId, reqData, submitUrl, type,
+ uid = PTL.editor.activeUid,
+ typeMap = {submit: "submission", suggest: "suggestion"};
+
+ // Detect whether it's being called from a normal submit or
+ // from a captcha
+ if (typeClass == undefined) {
+ typeClass = $(e.target).attr("class");
+ formId = "translate";
+ } else {
+ formId = "captcha";
+ }
+
+ type = typeMap[typeClass];
+ submitUrl = l('/unit/process/' + uid + '/' + type);
+
+ // Serialize data to be sent and get required attributes for the request
+ reqData = $("form#" + formId).serializeObject();
+ $.extend(reqData, PTL.editor.getReqData());
+
+ $.ajax({
+ url: submitUrl,
+ type: 'POST',
+ data: reqData,
+ dataType: 'json',
+ async: false,
+ success: function (data) {
+ if (data.captcha) {
+ $.fancybox(data.captcha);
+ $("input#id_captcha_answer").focus();
+ } else {
+ // If it has been a successful submission, update the textarea
+ // contents as well as the fuzzy status
+ if (type == 'submission') {
+ PTL.editor.units[uid].isfuzzy = PTL.editor.isFuzzy();
+ $("textarea[id^=id_target_f_]").each(function (i) {
+ PTL.editor.units[uid].target[i].text = $(this).val();
+ });
+ }
+
+ // Try loading the next unit
+ var newUid = parseInt(PTL.editor.units[uid].next);
+ if (newUid) {
+ var newHash = PTL.utils.updateHashPart("unit", newUid, ["page"]);
+ $.history.load(newHash);
+ } else {
+ // TODO: i18n
+ PTL.editor.displayError("Congratulations, you walked through all items");
+ }
+ }
+ },
+ error: PTL.editor.error
+ });
+ },
+
+ /* Loads the editor with the next unit */
+ gotoPrevNext: function (e) {
+ e.preventDefault();
+ var current = PTL.editor.units[PTL.editor.activeUid],
+ prevNextMap = {previous: current.prev, next: current.next},
+ newUid = prevNextMap[$(e.target).attr("class")];
+
+ // Try loading the prev/next unit
+ if (newUid != null) {
+ var newHash = PTL.utils.updateHashPart("unit", parseInt(newUid), ["page"]);
+ $.history.load(newHash);
+ } else {
+ if ($(e.target).attr("class") == 'previous') {
+ // TODO: i18n
+ PTL.editor.displayError("You reached the beginning of the list");
+ } else {
+ // TODO: i18n
+ PTL.editor.displayError("You reached the end of the list");
+ }
+ }
+ },
+
+
+ /* Loads the editor with a specific unit */
+ gotoUnit: function (e) {
+ e.preventDefault();
+
+ // Don't load anything if we're just selecting text
+ if (PTL.editor.getSelectedText() != "") {
+ return;
+ }
+
+ // Get clicked unit's uid from the row's id information and
+ // try to load it
+ var m = $(this).attr("id").match(/row([0-9]+)/);
+ if (m) {
+ var uid = parseInt(m[1]);
+ var newHash = PTL.utils.updateHashPart("unit", uid, ["page"]);
+ $.history.load(newHash);
+ }
+ },
+
+ /* Loads the editor on a specific page */
+ gotoPage: function (page) {
+ // Only load the given page if it's within a valid page range
+ if (page && !isNaN(page) && page > 0 &&
+ page <= PTL.editor.pager.num_pages) {
+ var newHash = PTL.utils.updateHashPart("page", page, ["unit"]);
+ $.history.load(newHash);
+ }
+ },
+
+ gotoFirstPage: function () {
+ if (PTL.editor.currentNumPages > 0) {
+ this.gotoPage(1);
+ }
+ },
+
+ gotoLastPage: function () {
+ if (PTL.editor.currentNumPages > 0) {
+ this.gotoPage(PTL.editor.currentNumPages);
+ }
+ },
+
+ gotoPrevPage: function () {
+ if ((PTL.editor.currentNumPages > 0) && (this.currentPage > 1)) {
+ this.gotoPage(this.currentPage - 1);
+ }
+ },
+
+ gotoNextPage: function () {
+ if ((PTL.editor.currentNumPages > 0) && (this.currentPage < PTL.editor.currentNumPages)) {
+ this.gotoPage(this.currentPage + 1);
+ }
+ },
+
+ /*
+ * Units filtering
+ */
+
+ /* Gets the failing check options for the current query */
+ getCheckOptions: function () {
+ var opts,
+ checksUrl = this.store ? l(this.store + '/checks/') : l(this.directory + "checks.html");
+
+ $.ajax({
+ url: checksUrl,
+ async: false,
+ dataType: 'json',
+ success: function (data) {
+ opts = data.checks;
+ },
+ error: PTL.editor.error
+ });
+
+ return opts;
+ },
+
+ /* Loads units based on checks filtering */
+ filterChecks: function () {
+ if (PTL.editor.preventNavigation) {
+ return;
+ }
+ var filterBy = $("option:selected", this).val();
+
+ if (filterBy != "none") {
+ var newHash = "filter=checks," + filterBy;
+ $.history.load(newHash);
+ }
+ },
+
+ /* Loads units based on filtering */
+ filterStatus: function () {
+ // this function can be executed in different contexts,
+ // so using the full selector here
+ var filterBy = $("div#filter-status option:selected").val();
+
+ // Filtering by failing checks
+ if (filterBy == "checks") {
+ // Get actual failing checks
+ var opts = PTL.editor.getCheckOptions();
+
+ // If there are any failing checks, add them in a dropdown
+ if (opts.length) {
+ var dropdown = '<div id="filter-checks" class="toolbar-item">';
+ dropdown += '<select name="filter-checks">';
+ dropdown += '<option selected="selected" value="none">------</option>';
+ $.each(opts, function () {
+ dropdown += '<option value="' + this.name + '">' + this.text + '</option>';
+ });
+ dropdown += '</select></div>';
+ $("div#filter-status").first().after(dropdown);
+ } else { // No results
+ // TODO: i18n
+ PTL.editor.displayError("No results.");
+ $("#filter-status option[value=" + PTL.editor.filter + "]")
+ .attr("selected", "selected");
+ }
+ } else { // Normal filtering options (untranslated, fuzzy...)
+ $("div#filter-checks").remove();
+ if (!PTL.editor.preventNavigation) {
+ var newHash = "filter=" + filterBy;
+ $.history.load(newHash);
+ }
+ }
+ },
+
+ /* Gets more context units */
+ getMoreContext: function () {
+ var ctxtUrl = l('/unit/context/' + PTL.editor.activeUid);
+ reqData = {gap: PTL.editor.ctxtGap};
+
+ $.ajax({
+ url: ctxtUrl,
+ async: false,
+ dataType: 'json',
+ data: reqData,
+ success: function (data) {
+ // As we now have got more context rows, increase its gap
+ PTL.editor.ctxtGap += 2;
+
+ // Create context rows HTML
+ var before = PTL.editor.buildCtxtRows(data.ctxt.before);
+ var after = PTL.editor.buildCtxtRows(data.ctxt.after);
+
+ // Append context rows to their respective places
+ var ctxtRows = $("tr.context-row");
+ ctxtRows.first().before(before);
+ ctxtRows.last().after(after);
+ },
+ error: PTL.editor.error
+ });
+ },
+
+
+ /*
+ * Search
+ */
+
+ /* Parses search text to detect any given fields */
+ parseSearch: function (text) {
+ var searchFields = [],
+ parsed = text;
+
+ // Check if there are fields specified within the search text
+ if (this.searchRE.test(text)) {
+ var opt,
+ removeParts = [],
+ parts = text.split(" ");
+
+ $.each(parts, function (i, part) {
+ if (PTL.editor.searchRE.test(part)) {
+ opt = part.split(":")[1];
+
+ // Only consider valid fields
+ if ($.inArray(opt, PTL.editor.searchOptions) > -1) {
+ searchFields.push(opt);
+ }
+
+ // If it's an invalid field name, discard it from the search text
+ removeParts.push(i);
+ }
+ });
+
+ // Remove parsed fields from the original array.
+ // It has to be done in reverse order for not clashing with indexes.
+ $.each(removeParts.reverse(), function (i, j) {
+ parts.splice(j, 1);
+ });
+
+ // Join unparsed remaining text, as this will be the actual search text
+ parsed = encodeURIComponent(parts.join(" "));
+ } else {
+ parsed = encodeURIComponent(parsed);
+ // There were no fields specified within the text so we use the dropdown
+ $("div.advancedsearch input:checked").each(function () {
+ searchFields.push($(this).val());
+ });
+ }
+
+ // If any options have been chosen, append them to the resulting URL
+ if (searchFields.length) {
+ parsed += "&sfields=" + searchFields.join(',');
+ }
+
+ return parsed;
+ },
+
+
+ /* Loads the search view */
+ search: function () {
+ var text = $("input#id_search").val();
+ var newHash;
+ if (text) {
+ var parsed = this.parseSearch(text);
+ newHash = "search=" + parsed;
+ } else {
+ newHash = PTL.utils.updateHashPart("filter", "all", ["search", "sfields"]);
+ }
+ $.history.load(newHash);
+ },
+
+
+ /*
+ * User and TM suggestions
+ */
+
+ /* Filters TM results and does some processing (add diffs, extra texts...) */
+ filterTMResults: function (results) {
+ // FIXME: this just retrieves the first four results
+ // we could limit based on a threshold too.
+ // FIXME: use localized 'N% match' format string
+ var source = $("[id^=id_source_f_]").first().val(),
+ filtered = [];
+
+ for (var i=0; i<results.length && i<3; i++) {
+ results[i].source = this.doDiff(source, results[i].source);
+ results[i].target = this.fancyEscape(results[i].target);
+ results[i].qTitle = Math.round(results[i].quality) + '% match';
+ filtered.push(results[i]);
+ }
+
+ return filtered;
+ },
+
+
+ /* Gets TM suggestions from amaGama */
+ getTMUnits: function () {
+ var src = this.meta.source_lang,
+ tgt = this.meta.target_lang,
+ stext = $($("input[id^=id_source_f_]").get(0)).val(),
+ tmUrl = this.settings.tmUrl + src + "/" + tgt +
+ "/unit/" + encodeURIComponent(stext) + "?jsoncallback=?";
+
+ // Always abort previous requests so we only get results for the
+ // current unit
+ if (this.tmReq != null) {
+ this.tmReq.abort();
+ }
+
+ // We use $.jsonp here because jQuery's current jsonp methods don't
+ // accept error callbacks nor aborting requests
+ this.tmReq = $.jsonp({
+ url: tmUrl,
+ callback: '_jsonp' + PTL.editor.activeUid,
+ dataType: 'jsonp',
+ success: function (data) {
+ var uid = this.callback.slice(6);
+
+ if (uid == PTL.editor.activeUid && data.length > 0) {
+ var filtered = PTL.editor.filterTMResults(data),
+ // TODO: i18n
+ name = "amaGama server",
+ tm = PTL.editor.tmpl.tm($, {data: {meta: PTL.editor.meta,
+ suggs: filtered,
+ name: name}}).join("");
+
+ // Append results
+ $("div#suggestion-container").append(tm);
+ $("div#amagama_results").animate({height: 'show'}, 1000,
+ 'easeOutQuad');
+ }
+ },
+ error: PTL.editor.error
+ });
+ },
+
+
+ /* Rejects a suggestion */
+ rejectSuggestion: function () {
+ var element = $(this).parent(),
+ uid = $('.translate-container input#id_id').val(),
+ suggId = $(this).siblings("input.suggid").val(),
+ url = l('/suggestion/reject/') + uid + '/' + suggId;
+
+ $.post(url, {'reject': 1},
+ function (data) {
+ element.fadeOut(200, function () {
+ $(this).remove();
+
+ // Go to the next unit if there are no more suggestions left
+ if (!$("div#suggestion-container div[id^=suggestion]").length) {
+ $("input.next").trigger("click");
+ }
+ });
+ }, "json");
+ },
+
+
+ /* Accepts a suggestion */
+ acceptSuggestion: function () {
+ var element = $(this).parent(),
+ uid = $('.translate-container input#id_id').val(),
+ suggId = $(this).siblings("input.suggid").val(),
+ url = l('/suggestion/accept/') + uid + '/' + suggId;
+
+ $.post(url, {'accept': 1},
+ function (data) {
+ // Update target textareas
+ $.each(data.newtargets, function (i, target) {
+ $("textarea#id_target_f_" + i).val(target).focus();
+ });
+
+ // Update remaining suggestion's diff
+ $.each(data.newdiffs, function (suggId, sugg) {
+ $.each(sugg, function (i, target) {
+ $("#suggdiff-" + suggId + "-" + i).html(target);
+ });
+ });
+
+ // As in submissions, save current unit's status in the client
+ $("textarea[id^=id_target_f_]").each(function (i) {
+ PTL.editor.units[uid].target[i].text = $(this).val();
+ });
+ PTL.editor.units[uid].isfuzzy = false;
+
+ element.fadeOut(200, function () {
+ $(this).remove();
+
+ // Go to the next unit if there are no more suggestions left
+ if (!$("div#suggestion-container div[id^=suggestion]").length) {
+ $("input.next").trigger("click");
+ }
+ });
+ }, "json");
+ },
+
+
+ /* Rejects a quality check marking it as false positive */
+ rejectCheck: function () {
+ var element = $(this).parent(),
+ checkId = $(this).siblings("input.checkid").val(),
+ uid = $('.translate-container input#id_id').val(),
+ url = l('/qualitycheck/reject/') + uid + '/' + checkId;
+
+ $.post(url, {'reject': 1},
+ function (data) {
+ element.fadeOut(200, function () {
+ $(this).remove();
+ });
+ }, "json");
+ },
+
+
+ /*
+ * Machine Translation
+ */
+
+ /* Checks whether the provided source is supported */
+ isSupportedSource: function (pairs, source) {
+ for (var i in pairs) {
+ if (source == pairs[i].source) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+
+ /* Checks whether the provided target is supported */
+ isSupportedTarget: function (pairs, target) {
+ for (var i in pairs) {
+ if (target == pairs[i].target) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+
+ /* Checks whether the provided source-target pair is supported */
+ isSupportedPair: function (pairs, source, target) {
+ for (var i in pairs) {
+ if (source == pairs[i].source &&
+ target == pairs[i].target) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+
+ /* Adds a new MT service button in the editor toolbar */
+ addMTButton: function (container, aClass, imgFn, tooltip) {
+ var btn = '<a class="translate-mt ' + aClass + '">';
+ btn += '<img src="' + imgFn + '" title="' + tooltip + '" /></a>';
+ $(container).first().prepend(btn);
+ },
+
+ /* Goes through all source languages and adds a new MT service button
+ * in the editor toolbar if the language is supported
+ */
+ addMTButtons: function (provider) {
+ if (this.isSupportedTarget(provider.pairs, provider.targetLang)) {
+ var _this = this;
+ var sources = $(".translate-toolbar");
+ $(sources).each(function () {
+ var source = _this.normalizeCode($(this).parent().parent().find('.translation-text').attr("lang"));
+
+ var ok;
+ if (provider.validatePairs) {
+ ok = _this.isSupportedPair(provider.pairs, source, provider.targetLang);
+ } else {
+ ok = _this.isSupportedSource(provider.pairs, source);
+ }
+
+ if (ok) {
+ _this.addMTButton(this,
+ provider.buttonClassName,
+ provider.imageUri,
+ provider.hint + ' (' + source.toUpperCase() + '&rarr;' + provider.targetLang.toUpperCase() + ')');
+ }
+ });
+ }
+ },
+
+ /* Normalizes language codes in order to use them in MT services */
+ normalizeCode: function (locale) {
+ var clean = locale.replace('_', '-')
+ var atIndex = locale.indexOf("@");
+ if (atIndex != -1) {
+ clean = clean.slice(0, atIndex);
+ }
+ return clean;
+ },
+
+ collectArguments: function (s) {
+ this.argSubs[this.argPos] = s;
+ return "[" + (this.argPos++) + "]";
+ },
+
+ translate: function (linkObject, providerCallback) {
+ var areas = $("[id^=id_target_f_]");
+ var sources = $(linkObject).parent().parent().parent().find('.translation-text');
+ var langFrom = PTL.editor.normalizeCode(sources.eq(0).attr("lang"));
+ var langTo = PTL.editor.normalizeCode(areas.eq(0).attr("lang"));
+
+ var htmlPat = /<[\/]?\w+.*?>/g;
+ // The printf regex based on http://phpjs.org/functions/sprintf:522
+ var cPrintfPat = /%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g;
+ var csharpStrPat = /{\d+(,\d+)?(:[a-zA-Z ]+)?}/g;
+ var percentNumberPat = /%\d+/g;
+ var pos = 0;
+
+ var _this = this;
+
+ $(sources).each(function (j) {
+ var sourceText = $(this).text();
+
+ // Reset collected arguments array and counter
+ _this.argSubs = new Array();
+ _this.argPos = 0;
+
+ // Walk through known patterns and replace them with [N] placeholders
+
+ sourceText = sourceText.replace(htmlPat, function(s) { return _this.collectArguments(s) });
+ sourceText = sourceText.replace(cPrintfPat, function(s) { return _this.collectArguments(s) });
+ sourceText = sourceText.replace(csharpStrPat, function(s) { return _this.collectArguments(s) });
+ sourceText = sourceText.replace(percentNumberPat, function(s) { return _this.collectArguments(s) });
+
+ var result = providerCallback(sourceText, langFrom, langTo, function(translation, message) {
+ if (translation === false) {
+ PTL.editor.displayError(message);
+ return;
+ }
+
+ // Fix whitespace which may have been added around [N] blocks
+ for (var i = 0; i < _this.argSubs.length; i++) {
+ if (sourceText.match(new RegExp("\\[" + i + "\\][^\\s]"))) {
+ translation = translation.replace(new RegExp("\\[" + i + "\\]\\s+"), "[" + i + "]");
+ }
+ if (sourceText.match(new RegExp("[^\\s]\\[" + i + "\\]"))) {
+ translation = translation.replace(new RegExp("\\s+\\[" + i + "\\]"), "[" + i + "]");
+ }
+ }
+
+ // Replace temporary [N] placeholders back to their real values
+ for (var i = 0; i < _this.argSubs.length; i++) {
+ var value = _this.argSubs[i].replace(/\&/g, "&amp;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;");
+ translation = translation.replace("[" + i + "]", value);
+ }
+
+ areas.eq(j).val($("<div />").html(translation).text());
+ areas.eq(j).focus();
+ });
+ });
+
+ PTL.editor.goFuzzy();
+ return false;
+ }
+
+ }; // PTL.editor
+
+})(jQuery);
diff --git a/src/pootle_it/html/js/editor_bundle.js b/src/pootle_it/html/js/editor_bundle.js
new file mode 100644
index 0000000..2d2e694
--- /dev/null
+++ b/src/pootle_it/html/js/editor_bundle.js
@@ -0,0 +1,139 @@
+jQuery.easing.jswing=jQuery.easing.swing;
+jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(b,a,c,d,e){return jQuery.easing[jQuery.easing.def](b,a,c,d,e)},easeInQuad:function(b,a,c,d,e){return d*(a/=e)*a+c},easeOutQuad:function(b,a,c,d,e){return-d*(a/=e)*(a-2)+c},easeInOutQuad:function(b,a,c,d,e){if((a/=e/2)<1)return d/2*a*a+c;return-d/2*(--a*(a-2)-1)+c},easeInCubic:function(b,a,c,d,e){return d*(a/=e)*a*a+c},easeOutCubic:function(b,a,c,d,e){return d*((a=a/e-1)*a*a+1)+c},easeInOutCubic:function(b,a,c,d,e){if((a/=e/2)<1)return d/
+2*a*a*a+c;return d/2*((a-=2)*a*a+2)+c},easeInQuart:function(b,a,c,d,e){return d*(a/=e)*a*a*a+c},easeOutQuart:function(b,a,c,d,e){return-d*((a=a/e-1)*a*a*a-1)+c},easeInOutQuart:function(b,a,c,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+c;return-d/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(b,a,c,d,e){return d*(a/=e)*a*a*a*a+c},easeOutQuint:function(b,a,c,d,e){return d*((a=a/e-1)*a*a*a*a+1)+c},easeInOutQuint:function(b,a,c,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+c;return d/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(b,
+a,c,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+c},easeOutSine:function(b,a,c,d,e){return d*Math.sin(a/e*(Math.PI/2))+c},easeInOutSine:function(b,a,c,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+c},easeInExpo:function(b,a,c,d,e){return a==0?c:d*Math.pow(2,10*(a/e-1))+c},easeOutExpo:function(b,a,c,d,e){return a==e?c+d:d*(-Math.pow(2,-10*a/e)+1)+c},easeInOutExpo:function(b,a,c,d,e){if(a==0)return c;if(a==e)return c+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+c;return d/2*(-Math.pow(2,-10*--a)+2)+c},
+easeInCirc:function(b,a,c,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+c},easeOutCirc:function(b,a,c,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+c},easeInOutCirc:function(b,a,c,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+c;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(b,a,c,d,e){b=1.70158;var f=0,g=d;if(a==0)return c;if((a/=e)==1)return c+d;f||(f=e*0.3);if(g<Math.abs(d)){g=d;b=f/4}else b=f/(2*Math.PI)*Math.asin(d/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*e-b)*2*Math.PI/f))+c},easeOutElastic:function(b,
+a,c,d,e){b=1.70158;var f=0,g=d;if(a==0)return c;if((a/=e)==1)return c+d;f||(f=e*0.3);if(g<Math.abs(d)){g=d;b=f/4}else b=f/(2*Math.PI)*Math.asin(d/g);return g*Math.pow(2,-10*a)*Math.sin((a*e-b)*2*Math.PI/f)+d+c},easeInOutElastic:function(b,a,c,d,e){b=1.70158;var f=0,g=d;if(a==0)return c;if((a/=e/2)==2)return c+d;f||(f=e*0.3*1.5);if(g<Math.abs(d)){g=d;b=f/4}else b=f/(2*Math.PI)*Math.asin(d/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*e-b)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a*
+e-b)*2*Math.PI/f)*0.5+d+c},easeInBack:function(b,a,c,d,e,f){if(f==undefined)f=1.70158;return d*(a/=e)*a*((f+1)*a-f)+c},easeOutBack:function(b,a,c,d,e,f){if(f==undefined)f=1.70158;return d*((a=a/e-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(b,a,c,d,e,f){if(f==undefined)f=1.70158;if((a/=e/2)<1)return d/2*a*a*(((f*=1.525)+1)*a-f)+c;return d/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(b,a,c,d,e){return d-jQuery.easing.easeOutBounce(b,e-a,0,d,e)+c},easeOutBounce:function(b,a,c,d,e){return(a/=
+e)<1/2.75?d*7.5625*a*a+c:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(b,a,c,d,e){if(a<e/2)return jQuery.easing.easeInBounce(b,a*2,0,d,e)*0.5+c;return jQuery.easing.easeOutBounce(b,a*2-e,0,d,e)*0.5+d*0.5+c}});(function(b){function a(g){function h(j){var i=RegExp(b.map(j,encodeURIComponent).join("|"),"ig");return function(n){return n.replace(i,decodeURIComponent)}}g=b.extend({unescape:false},g||{});c.encoder=function(j){if(j===true)return function(i){return i};if(typeof j=="string"&&(j=h(j.split("")))||typeof j=="function")return function(i){return j(encodeURIComponent(i))};return encodeURIComponent}(g.unescape)}var c={put:function(g,h){(h||window).location.hash=this.encoder(g)},get:function(g){return(g||
+window).location.toString().split("#",2)[1]||""},encoder:encodeURIComponent},d={id:"__jQuery_history",init:function(){var g='<iframe id="'+this.id+'" style="display:none" src="javascript:false;" />';b("body").prepend(g);return this},_document:function(){return b("#"+this.id)[0].contentWindow.document},put:function(g){var h=this._document();h.open();h.close();c.put(g,h)},get:function(){return c.get(this._document())}},e={};e.base={callback:undefined,type:undefined,check:function(){},load:function(){},
+init:function(g,h){a(h);f.callback=g;f._options=h;f._init()},_init:function(){},_options:{}};e.timer={_appState:undefined,_init:function(){var g=c.get();f._appState=g;f.callback(g);setInterval(f.check,100)},check:function(){var g=c.get();if(g!=f._appState){f._appState=g;f.callback(g)}},load:function(g){if(g!=f._appState){c.put(g);f._appState=g;f.callback(g)}}};e.iframeTimer={_appState:undefined,_init:function(){var g=c.get();f._appState=g;d.init().put(g);f.callback(g);setInterval(f.check,100)},check:function(){var g=
+d.get(),h=c.get();if(h!=g)if(h==f._appState){f._appState=g;c.put(g);f.callback(g)}else{f._appState=h;d.put(h);f.callback(h)}},load:function(g){if(g!=f._appState){c.put(g);d.put(g);f._appState=g;f.callback(g)}}};e.hashchangeEvent={_init:function(){f.callback(c.get());b(window).bind("hashchange",f.check)},check:function(){f.callback(c.get())},load:function(g){c.put(g)}};var f=b.extend({},e.base);f.type=b.browser.msie&&(b.browser.version<8||document.documentMode<8)?"iframeTimer":"onhashchange"in window?
+"hashchangeEvent":"timer";b.extend(f,e[f.type]);b.history=f})(jQuery);(function(b){function a(p,q,o,r){r={data:r||(q?q.data:{}),_wrap:q?q._wrap:null,tmpl:null,parent:q||null,nodes:[],calls:j,nest:i,wrap:n,html:k,update:t};p&&b.extend(r,p,{nodes:[],parent:q});if(o){r.tmpl=o;r._ctnt=r._ctnt||r.tmpl(b,r);r.key=++G;(P.length?u:w)[G]=r}return r}function c(p,q,o){var r;o=o?b.map(o,function(x){return typeof x==="string"?p.key?x.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+v+'="'+p.key+'" $2'):x:c(x,p,x._ctnt)}):p;if(q)return o;o=o.join("");o.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
+function(x,A,E,F){r=b(E).get();h(r);if(A)r=d(A).concat(r);if(F)r=r.concat(d(F))});return r?r:d(o)}function d(p){var q=document.createElement("div");q.innerHTML=p;return b.makeArray(q.childNodes)}function e(p){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;with($data){_.push('"+b.trim(p).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
+function(q,o,r,x,A,E,F){q=b.tmpl.tag[r];if(!q)throw"Template command not found: "+r;r=q._default||[];if(E&&!/\w$/.test(A)){A+=E;E=""}if(A){A=g(A);F=F?","+g(F)+")":E?")":"";F=E?A.indexOf(".")>-1?A+E:"("+A+").call($item"+F:A;E=E?F:"(typeof("+A+")==='function'?("+A+").call($item):("+A+"))"}else E=F=r.$1||"null";x=g(x);return"');"+q[o?"close":"open"].split("$notnull_1").join(A?"typeof("+A+")!=='undefined' && ("+A+")!=null":"true").split("$1a").join(E).split("$1").join(F).split("$2").join(x?x.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,
+function(L,K,M,H){return(H=H?","+H+")":M?")":"")?"("+K+").call($item"+H:L}):r.$2||"")+"_.push('"})+"');}return _;")}function f(p,q){p._wrap=c(p,true,b.isArray(q)?q:[z.test(q)?q:b(q).html()]).join("")}function g(p){return p?p.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function h(p){function q(K){function M(N){N+=o;D=A[N]=A[N]||a(D,w[D.parent.key+o]||D.parent,null,true)}var H,C=K,D,O;if(O=K.getAttribute(v)){for(;C.parentNode&&(C=C.parentNode).nodeType===1&&!(H=C.getAttribute(v)););if(H!==O){C=C.parentNode?
+C.nodeType===11?0:C.getAttribute(v)||0:0;if(!(D=w[O])){D=u[O];D=a(D,w[C]||u[C],null,true);D.key=++G;w[G]=D}J&&M(O)}K.removeAttribute(v)}else if(J&&(D=b.data(K,"tmplItem"))){M(D.key);w[D.key]=D;C=(C=b.data(K.parentNode,"tmplItem"))?C.key:0}if(D){for(H=D;H&&H.key!=C;){H.nodes.push(K);H=H.parent}delete D._ctnt;delete D._wrap;b.data(K,"tmplItem",D)}}var o="_"+J,r,x,A={},E,F,L;E=0;for(F=p.length;E<F;E++)if((r=p[E]).nodeType===1){x=r.getElementsByTagName("*");for(L=x.length-1;L>=0;L--)q(x[L]);q(r)}}function j(p,
+q,o,r){if(!p)return P.pop();P.push({_:p,tmpl:q,item:this,data:o,options:r})}function i(p,q,o){return b.tmpl(b.template(p),q,o,this)}function n(p,q){var o=p.options||{};o.wrapped=q;return b.tmpl(b.template(p.tmpl),p.data,o,p.item)}function k(p,q){var o=this._wrap;return b.map(b(b.isArray(o)?o.join(""):o).filter(p||"*"),function(r){if(q)r=r.innerText||r.textContent;else{var x;if(!(x=r.outerHTML)){x=document.createElement("div");x.appendChild(r.cloneNode(true));x=x.innerHTML}r=x}return r})}function t(){var p=
+this.nodes;b.tmpl(null,null,null,this).insertBefore(p[0]);b(p).remove()}var s=b.fn.domManip,v="_tmplitem",z=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,w={},u={},y,I={key:0,data:{}},G=0,J=0,P=[];b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(p,q){b.fn[p]=function(o){var r=[];o=b(o);var x,A,E;x=this.length===1&&this[0].parentNode;y=w||{};if(x&&x.nodeType===11&&x.childNodes.length===1&&o.length===1){o[q](this[0]);r=this}else{A=0;for(E=
+o.length;A<E;A++){J=A;x=(A>0?this.clone(true):this).get();b.fn[q].apply(b(o[A]),x);r=r.concat(x)}J=0;r=this.pushStack(r,p,o.selector)}o=y;y=null;b.tmpl.complete(o);return r}});b.fn.extend({tmpl:function(p,q,o){return b.tmpl(this[0],p,q,o)},tmplItem:function(){return b.tmplItem(this[0])},template:function(p){return b.template(p,this[0])},domManip:function(p,q,o){if(p[0]&&p[0].nodeType){for(var r=b.makeArray(arguments),x=p.length,A=0,E;A<x&&!(E=b.data(p[A++],"tmplItem")););if(x>1)r[0]=[b.makeArray(p)];
+if(E&&J)r[2]=function(F){b.tmpl.afterManip(this,F,o)};s.apply(this,r)}else s.apply(this,arguments);J=0;y||b.tmpl.complete(w);return this}});b.extend({tmpl:function(p,q,o,r){var x=!r;if(x){r=I;p=b.template[p]||b.template(null,p);u={}}else if(!p){p=r.tmpl;w[r.key]=r;r.nodes=[];r.wrapped&&f(r,r.wrapped);return b(c(r,null,r.tmpl(b,r)))}if(!p)return[];if(typeof q==="function")q=q.call(r||{});o&&o.wrapped&&f(o,o.wrapped);q=b.isArray(q)?b.map(q,function(A){return A?a(o,r,p,A):null}):[a(o,r,p,q)];return x?
+b(c(r,null,q)):q},tmplItem:function(p){var q;if(p instanceof b)p=p[0];for(;p&&p.nodeType===1&&!(q=b.data(p,"tmplItem"))&&(p=p.parentNode););return q||I},template:function(p,q){if(q){if(typeof q==="string")q=e(q);else if(q instanceof b)q=q[0]||{};if(q.nodeType)q=b.data(q,"tmpl")||b.data(q,"tmpl",e(q.innerHTML));return typeof p==="string"?b.template[p]=q:q}return p?typeof p!=="string"?b.template(null,p):b.template[p]||b.template(null,z.test(p)?p:b(p)):null},encode:function(p){return(""+p).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;")}});
+b.extend(b.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},
+open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(){w={}},afterManip:function(p,q,o){var r=q.nodeType===11?b.makeArray(q.childNodes):q.nodeType===1?[q]:[];o.call(p,q);h(r);J++}})})(jQuery);(function(b,a){function c(){}function d(o){p=[o]}function e(o,r,x){return o&&o.apply(r.context||r,x)}function f(o){function r(B){!Q++&&a(function(){S();M&&(J[C]={s:[B]});E&&(B=E.apply(o,[B]));e(o.success,o,[B,u]);e(A,o,[o,u])},0)}function x(B){!Q++&&a(function(){S();M&&B!=y&&(J[C]=B);e(o.error,o,[o,B]);e(A,o,[o,B])},0)}o=b.extend({},q,o);var A=o.complete,E=o.dataFilter,F=o.callbackParameter,L=o.callback,K=o.cache,M=o.pageCache,H=o.charset,C=o.url,D=o.data,O=o.timeout,N,Q=0,S=c;o.abort=function(){!Q++&&
+S()};if(e(o.beforeSend,o,[o])===false||Q)return o;C=C||j;D=D?typeof D=="string"?D:b.param(D,o.traditional):j;C+=D?(/\?/.test(C)?"&":"?")+D:j;F&&(C+=(/\?/.test(C)?"&":"?")+encodeURIComponent(F)+"=?");!K&&!M&&(C+=(/\?/.test(C)?"&":"?")+"_"+(new Date).getTime()+"=");C=C.replace(/=\?(&|$)/,"="+L+"$1");M&&(N=J[C])?N.s?r(N.s[0]):x(N):a(function(B,R,T){if(!Q){T=O>0&&a(function(){x(y)},O);S=function(){T&&clearTimeout(T);B[v]=B[k]=B[s]=B[t]=null;G[z](B);R&&G[z](R)};window[L]=d;B=b(w)[0];B.id=n+P++;if(H)B[h]=
+H;var V=function(U){(B[k]||c)();U=p;p=undefined;U?r(U[0]):x(i)};if(I.msie){B.event=k;B.htmlFor=B.id;B[v]=function(){/loaded|complete/.test(B.readyState)&&V()}}else{B[t]=B[s]=V;I.opera?(R=b(w)[0]).text="jQuery('#"+B.id+"')[0]."+t+"()":B[g]=g}B.src=C;G.insertBefore(B,G.firstChild);R&&G.insertBefore(R,G.firstChild)}},0);return o}var g="async",h="charset",j="",i="error",n="_jqjsp",k="onclick",t="on"+i,s="onload",v="onreadystatechange",z="removeChild",w="<script/>",u="success",y="timeout",I=b.browser,
+G=b("head")[0]||document.documentElement,J={},P=0,p,q={callback:n,url:location.href};f.setup=function(o){b.extend(q,o)};b.jsonp=f})(jQuery,setTimeout);(function(b){b.fn.TextAreaExpander=function(a,c){function d(f){f=f.target||f;var g=f.value.length,h=f.offsetWidth;if(g!=f.valLength||h!=f.boxWidth){if(e&&(g<f.valLength||h!=f.boxWidth))f.style.height="0px";var j=Math.max(f.expandMin,Math.min(f.scrollHeight,f.expandMax));f.style.overflow=f.scrollHeight>j?"auto":"hidden";f.style.height=j+"px";f.valLength=g;f.boxWidth=h}return true}var e=!(b.browser.msie||b.browser.opera);this.each(function(){if(this.nodeName.toLowerCase()=="textarea"){var f=this.className.match(/expand(\d+)\-*(\d+)*/i);
+this.expandMin=a||(f?parseInt("0"+f[1],10):0);this.expandMax=c||(f?parseInt("0"+f[2],10):99999);d(this);if(!this.Initialized){this.Initialized=true;b(this).css("padding-top",0).css("padding-bottom",0);b(this).bind("keyup",d).bind("focus",d)}}});return this}})(jQuery);$(document).ready(function(){$("textarea[class*=expand]").TextAreaExpander()});function diff_match_patch(){this.Diff_Timeout=1;this.Diff_EditCost=4;this.Diff_DualThreshold=32;this.Match_Threshold=0.5;this.Match_Distance=1E3;this.Patch_DeleteThreshold=0.5;this.Patch_Margin=4;this.Match_MaxBits=function(){for(var b=0,a=1,c=2;a!=c;){b++;a=c;c<<=1}return b}()}var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;
+diff_match_patch.prototype.diff_main=function(b,a,c,d){if(typeof d=="undefined")d=this.Diff_Timeout<=0?Number.MAX_VALUE:(new Date).getTime()+this.Diff_Timeout*1E3;d=d;if(b==null||a==null)throw Error("Null input. (diff_main)");if(b==a){if(b)return[[DIFF_EQUAL,b]];return[]}if(typeof c=="undefined")c=true;var e=c,f=this.diff_commonPrefix(b,a);c=b.substring(0,f);b=b.substring(f);a=a.substring(f);f=this.diff_commonSuffix(b,a);var g=b.substring(b.length-f);b=b.substring(0,b.length-f);a=a.substring(0,a.length-
+f);b=this.diff_compute(b,a,e,d);c&&b.unshift([DIFF_EQUAL,c]);g&&b.push([DIFF_EQUAL,g]);this.diff_cleanupMerge(b);return b};
+diff_match_patch.prototype.diff_compute=function(b,a,c,d){var e;if(!b)return[[DIFF_INSERT,a]];if(!a)return[[DIFF_DELETE,b]];e=b.length>a.length?b:a;var f=b.length>a.length?a:b,g=e.indexOf(f);if(g!=-1){e=[[DIFF_INSERT,e.substring(0,g)],[DIFF_EQUAL,f],[DIFF_INSERT,e.substring(g+f.length)]];if(b.length>a.length)e[0][0]=e[2][0]=DIFF_DELETE;return e}if(e=this.diff_halfMatch(b,a)){b=e[1];a=e[3];d=e[4];e=this.diff_main(e[0],e[2],c);c=this.diff_main(b,a,c);return e.concat([[DIFF_EQUAL,d]],c)}if(c&&(b.length<
+100||a.length<100))c=false;var h;if(c){h=this.diff_linesToChars(b,a);b=h[0];a=h[1];h=h[2]}e=this.diff_map(b,a,d);if(c){this.diff_charsToLines(e,h);this.diff_cleanupSemantic(e);e.push([DIFF_EQUAL,""]);a=b=c=0;for(f=h="";c<e.length;){switch(e[c][0]){case DIFF_INSERT:a++;f+=e[c][1];break;case DIFF_DELETE:b++;h+=e[c][1];break;case DIFF_EQUAL:if(b>=1&&a>=1){h=this.diff_main(h,f,false,d);e.splice(c-b-a,b+a);c=c-b-a;for(b=h.length-1;b>=0;b--)e.splice(c,0,h[b]);c+=h.length}b=a=0;f=h=""}c++}e.pop()}return e};
+diff_match_patch.prototype.diff_linesToChars=function(b,a){function c(h){for(var j="",i=0,n=-1,k=d.length;n<h.length-1;){n=h.indexOf("\n",i);if(n==-1)n=h.length-1;var t=h.substring(i,n+1);i=n+1;if(e.hasOwnProperty?e.hasOwnProperty(t):e[t]!==undefined)j+=String.fromCharCode(e[t]);else{j+=String.fromCharCode(k);e[t]=k;d[k++]=t}}return j}var d=[],e={};d[0]="";var f=c(b),g=c(a);return[f,g,d]};
+diff_match_patch.prototype.diff_charsToLines=function(b,a){for(var c=0;c<b.length;c++){for(var d=b[c][1],e=[],f=0;f<d.length;f++)e[f]=a[d.charCodeAt(f)];b[c][1]=e.join("")}};
+diff_match_patch.prototype.diff_map=function(b,a,c){var d=b.length,e=a.length,f=d+e-1,g=this.Diff_DualThreshold*2<f,h=[],j=[],i={},n={};i[1]=0;n[1]=0;for(var k,t,s,v={},z=false,w=(d+e)%2,u=0;u<f;u++){if((new Date).getTime()>c)break;h[u]={};for(var y=-u;y<=u;y+=2){k=y==-u||y!=u&&i[y-1]<i[y+1]?i[y+1]:i[y-1]+1;t=k-y;if(g){s=k+","+t;if(w&&v[s]!==undefined)z=true;w||(v[s]=u)}for(;!z&&k<d&&t<e&&b.charAt(k)==a.charAt(t);){k++;t++;if(g){s=k+","+t;if(w&&v[s]!==undefined)z=true;w||(v[s]=u)}}i[y]=k;h[u][k+","+
+t]=true;if(k==d&&t==e)return this.diff_path1(h,b,a);else if(z){j=j.slice(0,v[s]+1);c=this.diff_path1(h,b.substring(0,k),a.substring(0,t));return c.concat(this.diff_path2(j,b.substring(k),a.substring(t)))}}if(g){j[u]={};for(y=-u;y<=u;y+=2){k=y==-u||y!=u&&n[y-1]<n[y+1]?n[y+1]:n[y-1]+1;t=k-y;s=d-k+","+(e-t);if(!w&&v[s]!==undefined)z=true;if(w)v[s]=u;for(;!z&&k<d&&t<e&&b.charAt(d-k-1)==a.charAt(e-t-1);){k++;t++;s=d-k+","+(e-t);if(!w&&v[s]!==undefined)z=true;if(w)v[s]=u}n[y]=k;j[u][k+","+t]=true;if(z){h=
+h.slice(0,v[s]+1);c=this.diff_path1(h,b.substring(0,d-k),a.substring(0,e-t));return c.concat(this.diff_path2(j,b.substring(d-k),a.substring(e-t)))}}}}return[[DIFF_DELETE,b],[DIFF_INSERT,a]]};
+diff_match_patch.prototype.diff_path1=function(b,a,c){for(var d=[],e=a.length,f=c.length,g=null,h=b.length-2;h>=0;h--)for(;;)if(b[h][e-1+","+f]!==undefined){e--;if(g===DIFF_DELETE)d[0][1]=a.charAt(e)+d[0][1];else d.unshift([DIFF_DELETE,a.charAt(e)]);g=DIFF_DELETE;break}else if(b[h][e+","+(f-1)]!==undefined){f--;if(g===DIFF_INSERT)d[0][1]=c.charAt(f)+d[0][1];else d.unshift([DIFF_INSERT,c.charAt(f)]);g=DIFF_INSERT;break}else{e--;f--;if(a.charAt(e)!=c.charAt(f))throw Error("No diagonal. Can't happen. (diff_path1)");
+if(g===DIFF_EQUAL)d[0][1]=a.charAt(e)+d[0][1];else d.unshift([DIFF_EQUAL,a.charAt(e)]);g=DIFF_EQUAL}return d};
+diff_match_patch.prototype.diff_path2=function(b,a,c){for(var d=[],e=0,f=a.length,g=c.length,h=null,j=b.length-2;j>=0;j--)for(;;)if(b[j][f-1+","+g]!==undefined){f--;if(h===DIFF_DELETE)d[e-1][1]+=a.charAt(a.length-f-1);else d[e++]=[DIFF_DELETE,a.charAt(a.length-f-1)];h=DIFF_DELETE;break}else if(b[j][f+","+(g-1)]!==undefined){g--;if(h===DIFF_INSERT)d[e-1][1]+=c.charAt(c.length-g-1);else d[e++]=[DIFF_INSERT,c.charAt(c.length-g-1)];h=DIFF_INSERT;break}else{f--;g--;if(a.charAt(a.length-f-1)!=c.charAt(c.length-
+g-1))throw Error("No diagonal. Can't happen. (diff_path2)");if(h===DIFF_EQUAL)d[e-1][1]+=a.charAt(a.length-f-1);else d[e++]=[DIFF_EQUAL,a.charAt(a.length-f-1)];h=DIFF_EQUAL}return d};diff_match_patch.prototype.diff_commonPrefix=function(b,a){if(!b||!a||b.charAt(0)!=a.charAt(0))return 0;for(var c=0,d=Math.min(b.length,a.length),e=d,f=0;c<e;){if(b.substring(f,e)==a.substring(f,e))f=c=e;else d=e;e=Math.floor((d-c)/2+c)}return e};
+diff_match_patch.prototype.diff_commonSuffix=function(b,a){if(!b||!a||b.charAt(b.length-1)!=a.charAt(a.length-1))return 0;for(var c=0,d=Math.min(b.length,a.length),e=d,f=0;c<e;){if(b.substring(b.length-e,b.length-f)==a.substring(a.length-e,a.length-f))f=c=e;else d=e;e=Math.floor((d-c)/2+c)}return e};
+diff_match_patch.prototype.diff_commonOverlap=function(b,a){var c=b.length,d=a.length;if(c==0||d==0)return 0;if(c>d)b=b.substring(c-d);else if(c<d)a=a.substring(0,c);c=Math.min(c,d);if(b==a)return c;d=0;for(var e=1;;){var f=b.substring(c-e);f=a.indexOf(f);if(f==-1)return d;e+=f;if(f==0||b.substring(c-e)==a.substring(0,e)){d=e;e++}}};
+diff_match_patch.prototype.diff_halfMatch=function(b,a){function c(i,n,k){for(var t=i.substring(k,k+Math.floor(i.length/4)),s=-1,v="",z,w,u,y;(s=n.indexOf(t,s+1))!=-1;){var I=f.diff_commonPrefix(i.substring(k),n.substring(s)),G=f.diff_commonSuffix(i.substring(0,k),n.substring(0,s));if(v.length<G+I){v=n.substring(s-G,s)+n.substring(s,s+I);z=i.substring(0,k-G);w=i.substring(k+I);u=n.substring(0,s-G);y=n.substring(s+I)}}return v.length>=i.length/2?[z,w,u,y,v]:null}var d=b.length>a.length?b:a,e=b.length>
+a.length?a:b;if(d.length<4||e.length*2<d.length)return null;var f=this,g=c(d,e,Math.ceil(d.length/4));d=c(d,e,Math.ceil(d.length/2));if(!g&&!d)return null;else g=d?g?g[4].length>d[4].length?g:d:d:g;var h,j;if(b.length>a.length){d=g[0];e=g[1];h=g[2];j=g[3]}else{h=g[0];j=g[1];d=g[2];e=g[3]}return[d,e,h,j,g[4]]};
+diff_match_patch.prototype.diff_cleanupSemantic=function(b){for(var a=false,c=[],d=0,e=null,f=0,g=0,h=0,j=0,i=0;f<b.length;){if(b[f][0]==DIFF_EQUAL){c[d++]=f;g=j;h=i;i=j=0;e=b[f][1]}else{if(b[f][0]==DIFF_INSERT)j+=b[f][1].length;else i+=b[f][1].length;if(e!==null&&e.length<=Math.max(g,h)&&e.length<=Math.max(j,i)){b.splice(c[d-1],0,[DIFF_DELETE,e]);b[c[d-1]+1][0]=DIFF_INSERT;d--;d--;f=d>0?c[d-1]:-1;i=j=h=g=0;e=null;a=true}}f++}a&&this.diff_cleanupMerge(b);this.diff_cleanupSemanticLossless(b);for(f=
+1;f<b.length;){if(b[f-1][0]==DIFF_DELETE&&b[f][0]==DIFF_INSERT){a=b[f-1][1];c=b[f][1];if(d=this.diff_commonOverlap(a,c)){b.splice(f,0,[DIFF_EQUAL,c.substring(0,d)]);b[f-1][1]=a.substring(0,a.length-d);b[f+1][1]=c.substring(d);f++}f++}f++}};
+diff_match_patch.prototype.diff_cleanupSemanticLossless=function(b){function a(w,u){if(!w||!u)return 5;var y=0;if(w.charAt(w.length-1).match(c)||u.charAt(0).match(c)){y++;if(w.charAt(w.length-1).match(d)||u.charAt(0).match(d)){y++;if(w.charAt(w.length-1).match(e)||u.charAt(0).match(e)){y++;if(w.match(f)||u.match(g))y++}}}return y}for(var c=/[^a-zA-Z0-9]/,d=/\s/,e=/[\r\n]/,f=/\n\r?\n$/,g=/^\r?\n\r?\n/,h=1;h<b.length-1;){if(b[h-1][0]==DIFF_EQUAL&&b[h+1][0]==DIFF_EQUAL){var j=b[h-1][1],i=b[h][1],n=b[h+
+1][1],k=this.diff_commonSuffix(j,i);if(k){var t=i.substring(i.length-k);j=j.substring(0,j.length-k);i=t+i.substring(0,i.length-k);n=t+n}k=j;t=i;for(var s=n,v=a(j,i)+a(i,n);i.charAt(0)===n.charAt(0);){j+=i.charAt(0);i=i.substring(1)+n.charAt(0);n=n.substring(1);var z=a(j,i)+a(i,n);if(z>=v){v=z;k=j;t=i;s=n}}if(b[h-1][1]!=k){if(k)b[h-1][1]=k;else{b.splice(h-1,1);h--}b[h][1]=t;if(s)b[h+1][1]=s;else{b.splice(h+1,1);h--}}}h++}};
+diff_match_patch.prototype.diff_cleanupEfficiency=function(b){for(var a=false,c=[],d=0,e="",f=0,g=false,h=false,j=false,i=false;f<b.length;){if(b[f][0]==DIFF_EQUAL){if(b[f][1].length<this.Diff_EditCost&&(j||i)){c[d++]=f;g=j;h=i;e=b[f][1]}else{d=0;e=""}j=i=false}else{if(b[f][0]==DIFF_DELETE)i=true;else j=true;if(e&&(g&&h&&j&&i||e.length<this.Diff_EditCost/2&&g+h+j+i==3)){b.splice(c[d-1],0,[DIFF_DELETE,e]);b[c[d-1]+1][0]=DIFF_INSERT;d--;e="";if(g&&h){j=i=true;d=0}else{d--;f=d>0?c[d-1]:-1;j=i=false}a=
+true}}f++}a&&this.diff_cleanupMerge(b)};
+diff_match_patch.prototype.diff_cleanupMerge=function(b){b.push([DIFF_EQUAL,""]);for(var a=0,c=0,d=0,e="",f="",g;a<b.length;)switch(b[a][0]){case DIFF_INSERT:d++;f+=b[a][1];a++;break;case DIFF_DELETE:c++;e+=b[a][1];a++;break;case DIFF_EQUAL:if(c+d>1){if(c!==0&&d!==0){g=this.diff_commonPrefix(f,e);if(g!==0){if(a-c-d>0&&b[a-c-d-1][0]==DIFF_EQUAL)b[a-c-d-1][1]+=f.substring(0,g);else{b.splice(0,0,[DIFF_EQUAL,f.substring(0,g)]);a++}f=f.substring(g);e=e.substring(g)}g=this.diff_commonSuffix(f,e);if(g!==
+0){b[a][1]=f.substring(f.length-g)+b[a][1];f=f.substring(0,f.length-g);e=e.substring(0,e.length-g)}}if(c===0)b.splice(a-c-d,c+d,[DIFF_INSERT,f]);else d===0?b.splice(a-c-d,c+d,[DIFF_DELETE,e]):b.splice(a-c-d,c+d,[DIFF_DELETE,e],[DIFF_INSERT,f]);a=a-c-d+(c?1:0)+(d?1:0)+1}else if(a!==0&&b[a-1][0]==DIFF_EQUAL){b[a-1][1]+=b[a][1];b.splice(a,1)}else a++;c=d=0;f=e=""}b[b.length-1][1]===""&&b.pop();c=false;for(a=1;a<b.length-1;){if(b[a-1][0]==DIFF_EQUAL&&b[a+1][0]==DIFF_EQUAL)if(b[a][1].substring(b[a][1].length-
+b[a-1][1].length)==b[a-1][1]){b[a][1]=b[a-1][1]+b[a][1].substring(0,b[a][1].length-b[a-1][1].length);b[a+1][1]=b[a-1][1]+b[a+1][1];b.splice(a-1,1);c=true}else if(b[a][1].substring(0,b[a+1][1].length)==b[a+1][1]){b[a-1][1]+=b[a+1][1];b[a][1]=b[a][1].substring(b[a+1][1].length)+b[a+1][1];b.splice(a+1,1);c=true}a++}c&&this.diff_cleanupMerge(b)};
+diff_match_patch.prototype.diff_xIndex=function(b,a){var c=0,d=0,e=0,f=0,g;for(g=0;g<b.length;g++){if(b[g][0]!==DIFF_INSERT)c+=b[g][1].length;if(b[g][0]!==DIFF_DELETE)d+=b[g][1].length;if(c>a)break;e=c;f=d}if(b.length!=g&&b[g][0]===DIFF_DELETE)return f;return f+(a-e)};
+diff_match_patch.prototype.diff_prettyHtml=function(b){for(var a=[],c=0,d=/&/g,e=/</g,f=/>/g,g=/\n/g,h=0;h<b.length;h++){var j=b[h][0],i=b[h][1],n=i.replace(d,"&amp;").replace(e,"&lt;").replace(f,"&gt;").replace(g,"&para;<BR>");switch(j){case DIFF_INSERT:a[h]='<INS STYLE="background:#E6FFE6;" TITLE="i='+c+'">'+n+"</INS>";break;case DIFF_DELETE:a[h]='<DEL STYLE="background:#FFE6E6;" TITLE="i='+c+'">'+n+"</DEL>";break;case DIFF_EQUAL:a[h]='<SPAN TITLE="i='+c+'">'+n+"</SPAN>"}if(j!==DIFF_DELETE)c+=i.length}return a.join("")};
+diff_match_patch.prototype.diff_text1=function(b){for(var a=[],c=0;c<b.length;c++)if(b[c][0]!==DIFF_INSERT)a[c]=b[c][1];return a.join("")};diff_match_patch.prototype.diff_text2=function(b){for(var a=[],c=0;c<b.length;c++)if(b[c][0]!==DIFF_DELETE)a[c]=b[c][1];return a.join("")};
+diff_match_patch.prototype.diff_levenshtein=function(b){for(var a=0,c=0,d=0,e=0;e<b.length;e++){var f=b[e][1];switch(b[e][0]){case DIFF_INSERT:c+=f.length;break;case DIFF_DELETE:d+=f.length;break;case DIFF_EQUAL:a+=Math.max(c,d);d=c=0}}a+=Math.max(c,d);return a};
+diff_match_patch.prototype.diff_toDelta=function(b){for(var a=[],c=0;c<b.length;c++)switch(b[c][0]){case DIFF_INSERT:a[c]="+"+encodeURI(b[c][1]);break;case DIFF_DELETE:a[c]="-"+b[c][1].length;break;case DIFF_EQUAL:a[c]="="+b[c][1].length}return a.join("\t").replace(/%20/g," ")};
+diff_match_patch.prototype.diff_fromDelta=function(b,a){for(var c=[],d=0,e=0,f=a.split(/\t/g),g=0;g<f.length;g++){var h=f[g].substring(1);switch(f[g].charAt(0)){case "+":try{c[d++]=[DIFF_INSERT,decodeURI(h)]}catch(j){throw Error("Illegal escape in diff_fromDelta: "+h);}break;case "-":case "=":var i=parseInt(h,10);if(isNaN(i)||i<0)throw Error("Invalid number in diff_fromDelta: "+h);h=b.substring(e,e+=i);if(f[g].charAt(0)=="=")c[d++]=[DIFF_EQUAL,h];else c[d++]=[DIFF_DELETE,h];break;default:if(f[g])throw Error("Invalid diff operation in diff_fromDelta: "+
+f[g]);}}if(e!=b.length)throw Error("Delta length ("+e+") does not equal source text length ("+b.length+").");return c};diff_match_patch.prototype.match_main=function(b,a,c){if(b==null||a==null||c==null)throw Error("Null input. (match_main)");c=Math.max(0,Math.min(c,b.length));return b==a?0:b.length?b.substring(c,c+a.length)==a?c:this.match_bitap(b,a,c):-1};
+diff_match_patch.prototype.match_bitap=function(b,a,c){function d(w,u){var y=w/a.length,I=Math.abs(c-u);if(!f.Match_Distance)return I?1:y;return y+I/f.Match_Distance}if(a.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");var e=this.match_alphabet(a),f=this,g=this.Match_Threshold,h=b.indexOf(a,c);if(h!=-1){g=Math.min(d(0,h),g);h=b.lastIndexOf(a,c+a.length);if(h!=-1)g=Math.min(d(0,h),g)}var j=1<<a.length-1;h=-1;for(var i,n,k=a.length+b.length,t,s=0;s<a.length;s++){i=0;for(n=
+k;i<n;){if(d(s,c+n)<=g)i=n;else k=n;n=Math.floor((k-i)/2+i)}k=n;i=Math.max(1,c-n+1);var v=Math.min(c+n,b.length)+a.length;n=Array(v+2);n[v+1]=(1<<s)-1;for(v=v;v>=i;v--){var z=e[b.charAt(v-1)];n[v]=s===0?(n[v+1]<<1|1)&z:(n[v+1]<<1|1)&z|(t[v+1]|t[v])<<1|1|t[v+1];if(n[v]&j){z=d(s,v-1);if(z<=g){g=z;h=v-1;if(h>c)i=Math.max(1,2*c-h);else break}}}if(d(s+1,c)>g)break;t=n}return h};
+diff_match_patch.prototype.match_alphabet=function(b){for(var a={},c=0;c<b.length;c++)a[b.charAt(c)]=0;for(c=0;c<b.length;c++)a[b.charAt(c)]|=1<<b.length-c-1;return a};
+diff_match_patch.prototype.patch_addContext=function(b,a){if(a.length!=0){for(var c=a.substring(b.start2,b.start2+b.length1),d=0;a.indexOf(c)!=a.lastIndexOf(c)&&c.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;){d+=this.Patch_Margin;c=a.substring(b.start2-d,b.start2+b.length1+d)}d+=this.Patch_Margin;(c=a.substring(b.start2-d,b.start2))&&b.diffs.unshift([DIFF_EQUAL,c]);(d=a.substring(b.start2+b.length1,b.start2+b.length1+d))&&b.diffs.push([DIFF_EQUAL,d]);b.start1-=c.length;b.start2-=
+c.length;b.length1+=c.length+d.length;b.length2+=c.length+d.length}};
+diff_match_patch.prototype.patch_make=function(b,a,c){var d;if(typeof b=="string"&&typeof a=="string"&&typeof c=="undefined"){d=b;a=this.diff_main(d,a,true);if(a.length>2){this.diff_cleanupSemantic(a);this.diff_cleanupEfficiency(a)}}else if(b&&typeof b=="object"&&typeof a=="undefined"&&typeof c=="undefined"){a=b;d=this.diff_text1(a)}else if(typeof b=="string"&&a&&typeof a=="object"&&typeof c=="undefined"){d=b;a=a}else if(typeof b=="string"&&typeof a=="string"&&c&&typeof c=="object"){d=b;a=c}else throw Error("Unknown call format to patch_make.");
+if(a.length===0)return[];c=[];b=new patch_obj;var e=0,f=0,g=0,h=d;d=d;for(var j=0;j<a.length;j++){var i=a[j][0],n=a[j][1];if(!e&&i!==DIFF_EQUAL){b.start1=f;b.start2=g}switch(i){case DIFF_INSERT:b.diffs[e++]=a[j];b.length2+=n.length;d=d.substring(0,g)+n+d.substring(g);break;case DIFF_DELETE:b.length1+=n.length;b.diffs[e++]=a[j];d=d.substring(0,g)+d.substring(g+n.length);break;case DIFF_EQUAL:if(n.length<=2*this.Patch_Margin&&e&&a.length!=j+1){b.diffs[e++]=a[j];b.length1+=n.length;b.length2+=n.length}else if(n.length>=
+2*this.Patch_Margin)if(e){this.patch_addContext(b,h);c.push(b);b=new patch_obj;e=0;h=d;f=g}}if(i!==DIFF_INSERT)f+=n.length;if(i!==DIFF_DELETE)g+=n.length}if(e){this.patch_addContext(b,h);c.push(b)}return c};diff_match_patch.prototype.patch_deepCopy=function(b){for(var a=[],c=0;c<b.length;c++){var d=b[c],e=new patch_obj;e.diffs=[];for(var f=0;f<d.diffs.length;f++)e.diffs[f]=d.diffs[f].slice();e.start1=d.start1;e.start2=d.start2;e.length1=d.length1;e.length2=d.length2;a[c]=e}return a};
+diff_match_patch.prototype.patch_apply=function(b,a){if(b.length==0)return[a,[]];b=this.patch_deepCopy(b);var c=this.patch_addPadding(b);a=c+a+c;this.patch_splitMax(b);for(var d=0,e=[],f=0;f<b.length;f++){var g=b[f].start2+d,h=this.diff_text1(b[f].diffs),j,i=-1;if(h.length>this.Match_MaxBits){j=this.match_main(a,h.substring(0,this.Match_MaxBits),g);if(j!=-1){i=this.match_main(a,h.substring(h.length-this.Match_MaxBits),g+h.length-this.Match_MaxBits);if(i==-1||j>=i)j=-1}}else j=this.match_main(a,h,
+g);if(j==-1){e[f]=false;d-=b[f].length2-b[f].length1}else{e[f]=true;d=j-g;g=i==-1?a.substring(j,j+h.length):a.substring(j,i+this.Match_MaxBits);if(h==g)a=a.substring(0,j)+this.diff_text2(b[f].diffs)+a.substring(j+h.length);else{g=this.diff_main(h,g,false);if(h.length>this.Match_MaxBits&&this.diff_levenshtein(g)/h.length>this.Patch_DeleteThreshold)e[f]=false;else{this.diff_cleanupSemanticLossless(g);h=0;var n;for(i=0;i<b[f].diffs.length;i++){var k=b[f].diffs[i];if(k[0]!==DIFF_EQUAL)n=this.diff_xIndex(g,
+h);if(k[0]===DIFF_INSERT)a=a.substring(0,j+n)+k[1]+a.substring(j+n);else if(k[0]===DIFF_DELETE)a=a.substring(0,j+n)+a.substring(j+this.diff_xIndex(g,h+k[1].length));if(k[0]!==DIFF_DELETE)h+=k[1].length}}}}}a=a.substring(c.length,a.length-c.length);return[a,e]};
+diff_match_patch.prototype.patch_addPadding=function(b){for(var a=this.Patch_Margin,c="",d=1;d<=a;d++)c+=String.fromCharCode(d);for(d=0;d<b.length;d++){b[d].start1+=a;b[d].start2+=a}d=b[0];var e=d.diffs;if(e.length==0||e[0][0]!=DIFF_EQUAL){e.unshift([DIFF_EQUAL,c]);d.start1-=a;d.start2-=a;d.length1+=a;d.length2+=a}else if(a>e[0][1].length){var f=a-e[0][1].length;e[0][1]=c.substring(e[0][1].length)+e[0][1];d.start1-=f;d.start2-=f;d.length1+=f;d.length2+=f}d=b[b.length-1];e=d.diffs;if(e.length==0||
+e[e.length-1][0]!=DIFF_EQUAL){e.push([DIFF_EQUAL,c]);d.length1+=a;d.length2+=a}else if(a>e[e.length-1][1].length){f=a-e[e.length-1][1].length;e[e.length-1][1]+=c.substring(0,f);d.length1+=f;d.length2+=f}return c};
+diff_match_patch.prototype.patch_splitMax=function(b){for(var a=this.Match_MaxBits,c=0;c<b.length;c++)if(b[c].length1>a){var d=b[c];b.splice(c--,1);for(var e=d.start1,f=d.start2,g="";d.diffs.length!==0;){var h=new patch_obj,j=true;h.start1=e-g.length;h.start2=f-g.length;if(g!==""){h.length1=h.length2=g.length;h.diffs.push([DIFF_EQUAL,g])}for(;d.diffs.length!==0&&h.length1<a-this.Patch_Margin;){g=d.diffs[0][0];var i=d.diffs[0][1];if(g===DIFF_INSERT){h.length2+=i.length;f+=i.length;h.diffs.push(d.diffs.shift());
+j=false}else if(g===DIFF_DELETE&&h.diffs.length==1&&h.diffs[0][0]==DIFF_EQUAL&&i.length>2*a){h.length1+=i.length;e+=i.length;j=false;h.diffs.push([g,i]);d.diffs.shift()}else{i=i.substring(0,a-h.length1-this.Patch_Margin);h.length1+=i.length;e+=i.length;if(g===DIFF_EQUAL){h.length2+=i.length;f+=i.length}else j=false;h.diffs.push([g,i]);if(i==d.diffs[0][1])d.diffs.shift();else d.diffs[0][1]=d.diffs[0][1].substring(i.length)}}g=this.diff_text2(h.diffs);g=g.substring(g.length-this.Patch_Margin);i=this.diff_text1(d.diffs).substring(0,
+this.Patch_Margin);if(i!==""){h.length1+=i.length;h.length2+=i.length;if(h.diffs.length!==0&&h.diffs[h.diffs.length-1][0]===DIFF_EQUAL)h.diffs[h.diffs.length-1][1]+=i;else h.diffs.push([DIFF_EQUAL,i])}j||b.splice(++c,0,h)}}};diff_match_patch.prototype.patch_toText=function(b){for(var a=[],c=0;c<b.length;c++)a[c]=b[c];return a.join("")};
+diff_match_patch.prototype.patch_fromText=function(b){var a=[];if(!b)return a;b=b.split("\n");for(var c=0,d=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;c<b.length;){var e=b[c].match(d);if(!e)throw Error("Invalid patch string: "+b[c]);var f=new patch_obj;a.push(f);f.start1=parseInt(e[1],10);if(e[2]===""){f.start1--;f.length1=1}else if(e[2]=="0")f.length1=0;else{f.start1--;f.length1=parseInt(e[2],10)}f.start2=parseInt(e[3],10);if(e[4]===""){f.start2--;f.length2=1}else if(e[4]=="0")f.length2=0;else{f.start2--;
+f.length2=parseInt(e[4],10)}for(c++;c<b.length;){e=b[c].charAt(0);try{var g=decodeURI(b[c].substring(1))}catch(h){throw Error("Illegal escape in patch_fromText: "+g);}if(e=="-")f.diffs.push([DIFF_DELETE,g]);else if(e=="+")f.diffs.push([DIFF_INSERT,g]);else if(e==" ")f.diffs.push([DIFF_EQUAL,g]);else if(e=="@")break;else if(e!=="")throw Error('Invalid patch mode "'+e+'" in: '+g);c++}}return a};function patch_obj(){this.diffs=[];this.start2=this.start1=null;this.length2=this.length1=0}
+patch_obj.prototype.toString=function(){for(var b=["@@ -"+(this.length1===0?this.start1+",0":this.length1==1?this.start1+1:this.start1+1+","+this.length1)+" +"+(this.length2===0?this.start2+",0":this.length2==1?this.start2+1:this.start2+1+","+this.length2)+" @@\n"],a,c=0;c<this.diffs.length;c++){switch(this.diffs[c][0]){case DIFF_INSERT:a="+";break;case DIFF_DELETE:a="-";break;case DIFF_EQUAL:a=" "}b[c+1]=a+encodeURI(this.diffs[c][1])+"\n"}return b.join("").replace(/%20/g," ")};
+window.diff_match_patch=diff_match_patch;window.patch_obj=patch_obj;window.DIFF_DELETE=DIFF_DELETE;window.DIFF_INSERT=DIFF_INSERT;window.DIFF_EQUAL=DIFF_EQUAL;(function(b){window.PTL=window.PTL||{};PTL.utils={getHash:function(a){return(a||window).location.toString().split("#",2)[1]||""},decodeURIParameter:function(a){return decodeURIComponent(a.replace(/\+/g," "))},getParsedHash:function(a){var c={},d=/([^&;=]+)=?([^&;]*)/g;if(a==undefined)a=this.getHash();for(var e;e=d.exec(a);)c[this.decodeURIParameter(e[1])]=this.decodeURIParameter(e[2]);return c},updateHashPart:function(a,c,d){for(var e=[],f=/([^&;=]+)=?([^&;]*)/g,g=this.getHash(),h,j;h=f.exec(g);){var i=
+this.decodeURIParameter(h[1]);if(i==a){e.push(h[1]+"="+encodeURIComponent(c));j=true}else b.inArray(i,d)==-1&&e.push(h[1]+"="+h[2])}j||e.push(encodeURIComponent(a)+"="+encodeURIComponent(c));return e.join("&")}};Object.size=function(a){var c=0,d;for(d in a)a.hasOwnProperty(d)&&c++;return c};PTL.editor={init:function(a){this.settings={secure:false,mt:[]};a&&b.extend(this.settings,a);this.units={};this.store=b("div#pootle_path").text();this.directory=b("div#directory").text();this.currentPage=1;this.currentNumPages=
+0;this.pagesGot={};this.filter="all";this.checks=[];this.ctxtGap=0;this.preventNavigation=this.keepState=false;this.isLoading=true;this.showActivity();this.searchFields=[];this.searchOptions=["source","target","notes","locations"];this.cpRE=/^(<[^>]+>|\[n\|t]|\W$^\n)*(\b|$)/gm;this.escapeRE=/<[^<]*?>|\r\n|[\r\n\t&<>]/gm;this.searchRE=/^in:.+|\sin:.+/i;this.tmReq=null;this.differencer=new diff_match_patch;this.tmpl={vUnit:b.template(b("#view_unit").html()),tm:b.template(b("#tm_suggestions").html())};
+this.focused=b(".translate-original-focus textarea").get(0);b("textarea.translation").live("keyup blur",function(){!PTL.editor.keepState&&b(this).attr("defaultValue")!=b(this).val()&&PTL.editor.ungoFuzzy()});b("input.fuzzycheck").live("click",function(){PTL.editor.isFuzzy()?PTL.editor.doFuzzyArea():PTL.editor.undoFuzzyArea()});b(".switch-suggest-mode a").live("click",function(){PTL.editor.toggleSuggestMode();return false});b(".focusthis").live("focus",function(c){PTL.editor.focused=c.target});b(".writetm, .writespecial, .translate-full .highlight-escape, .translate-full .highlight-html").live("click",
+this.copyText);b("a.copyoriginal").live("click",function(){var c=b(".translation-text",b(this).parent().parent().parent());PTL.editor.copyOriginal(c)});b("div.suggestion").live("click",function(){if(PTL.editor.getSelectedText()==""){var c=b(".suggestion-translation",this);PTL.editor.copyOriginal(c)}});b("table.translate-table").live("editor_ready",this.ready);b("tr.view-row").live("click",this.gotoUnit);b("input#item-number").live("keypress",function(c){c.keyCode==13&&PTL.editor.gotoPage(parseInt(b("input#item-number").val()))});
+b("input.submit, input.suggest").live("click",this.processSubmit);b("input.previous, input.next").live("click",this.gotoPrevNext);b("#suggestion-container .rejectsugg").live("click",this.rejectSuggestion);b("#suggestion-container .acceptsugg").live("click",this.acceptSuggestion);b("#translate-checks-block .rejectcheck").live("click",this.rejectCheck);b("div#filter-status select").live("change",this.filterStatus);b("div#filter-checks select").live("change",this.filterChecks);b("a.morecontext").live("click",
+this.getMoreContext);b("input#id_search").live("keypress",function(c){if(c.keyCode==13){c.preventDefault();PTL.editor.search()}});shortcut.add("ctrl+return",function(){PTL.editor.isSuggestMode()?b("input.suggest").trigger("click"):b("input.submit").trigger("click")});shortcut.add("ctrl+space",function(c){c&&c.preventDefault&&c.preventDefault();PTL.editor.keepState=true;PTL.editor.isFuzzy()?PTL.editor.ungoFuzzy():PTL.editor.goFuzzy()});shortcut.add("ctrl+shift+space",function(){PTL.editor.toggleSuggestMode()});
+shortcut.add("ctrl+up",function(){b("input.previous").trigger("click")});shortcut.add("ctrl+down",function(){b("input.next").trigger("click")});shortcut.add("ctrl+shift+home",function(){PTL.editor.gotoFirstPage()});shortcut.add("ctrl+shift+end",function(){PTL.editor.gotoLastPage()});shortcut.add("ctrl+shift+pageup",function(){PTL.editor.gotoPrevPage()});shortcut.add("ctrl+shift+pagedown",function(){PTL.editor.gotoNextPage()});shortcut.add("ctrl+shift+u",function(){b("input#item-number").focus().select()});
+shortcut.add("ctrl+shift+s",function(){b("#id_search").focus().select()});b("#id_search").focus(function(){b(this).attr("focused",true)});b("#id_search").blur(function(){b(this).attr("focused","")});shortcut.add("escape",function(){b("#id_search").attr("focused")&&b("#id_search").blur()});b(document).ajaxStart(function(){clearTimeout(PTL.editor.delayedActivityTimer);PTL.editor.delayedActivityTimer=setTimeout(function(){PTL.editor.showActivity()},3E3)});b(document).ajaxStop(function(){clearTimeout(PTL.editor.delayedActivityTimer);
+PTL.editor.isLoading||PTL.editor.hideActivity()});b.each(this.settings.mt,function(){var c=this.name;b.ajax({url:m("js/mt/"+c+".js"),async:false,dataType:"script",success:function(){setTimeout(function(){PTL.editor.mt[c].init()},0);b("table.translate-table").live("mt_ready",PTL.editor.mt[c].ready)}})});setTimeout(function(){b.history.init(function(c){c=PTL.utils.getParsedHash(c);var d=false,e=undefined;if("unit"in c){var f=parseInt(c.unit);if(f&&!isNaN(f))if(PTL.editor.activeUid!=f&&PTL.editor.units[f]==
+undefined){PTL.editor.activeUid=f;d=true}else{PTL.editor.activeUid=f;PTL.editor.displayEditUnit(f);return}}else if("page"in c)if((f=parseInt(c.page))&&!isNaN(f)&&f>0)e=f;if("filter"in c){f=c.filter.split(",");PTL.editor.filter=f.shift();PTL.editor.checks=PTL.editor.filter=="checks"?f:[]}if("search"in c){PTL.editor.filter="search";PTL.editor.searchText=c.search;if("sfields"in c)PTL.editor.searchFields=c.sfields.split(",")}PTL.editor.preventNavigation=true;b("div#filter-status select [value='"+PTL.editor.filter+
+"']").attr("selected","selected");if(PTL.editor.filter=="checks"){b("div#filter-checks").length==0&&PTL.editor.filterStatus();b("div#filter-checks select [value='"+PTL.editor.checks[0]+"']").attr("selected","selected")}if(PTL.editor.filter=="search"){b("#id_search").triggerHandler("focus");b("#id_search").val(PTL.editor.searchText);b("div.advancedsearch input").each(function(){b.inArray(b(this).val(),PTL.editor.searchFields)>=0?b(this).attr("checked","checked"):b(this).removeAttr("checked")})}PTL.editor.preventNavigation=
+false;PTL.editor.getViewUnits({pager:true,page:e,withUid:d});if(PTL.editor.hasResults){PTL.editor.fetchPages(false);PTL.editor.displayEditUnit(PTL.editor.activeUid)}},{unescape:true})},1)},ready:function(){var a=b(window).height()*0.3;b("textarea.expanding").TextAreaExpander("10",a);b(".focusthis").get(0)&&b(".focusthis").get(0).focus();PTL.editor.hlSearch();PTL.editor.settings.tmUrl!=""&&PTL.editor.getTMUnits();b("table.translate-table").trigger("mt_ready");PTL.editor.isLoading=false;PTL.editor.hideActivity();
+clearTimeout(PTL.editor.delayedActivityTimer)},escapeUnsafeRegexSymbols:function(a){var c;for(c=0;c<19;c++)a=a.replace(RegExp("\\"+"\\.+*?[^]$(){}=!<>\u00a6:".charAt(c),"g"),"\\"+"\\.+*?[^]$(){}=!<>\u00a6:".charAt(c));return a},makeRegexForMultipleWords:function(a){var c=a.split(" ");for(a=0;a<c.length;a++)c[a]=this.escapeUnsafeRegexSymbols(c[a]);return"("+c.join("|")+")"},hlSearch:function(){var a=PTL.editor.filter=="search"?PTL.editor.searchText:"",c=[],d={notes:"div.developer-comments",locations:"div.translate-locations",
+source:"td.translate-original, div.original div.translation-text",target:"td.translate-translation"};b.each(PTL.editor.searchFields,function(e,f){c.push(d[f])});c.length||(c=[d.source,d.target]);b(c.join(", ")).highlightRegex(RegExp(PTL.editor.makeRegexForMultipleWords(a),"i"))},hlTerms:function(){var a;b(".tm-original").each(function(){a=b(this).text();b("div.original .translation-text").highlightRegex(RegExp(PTL.editor.escapeUnsafeRegexSymbols(a),"g"))})},copyText:function(){var a,c,d;a=b(".tm-translation",
+this).length?b(".tm-translation",this).text():b(this).text();c=b(PTL.editor.focused);d=c.caret().start+a.length;c.val(c.caret().replace(a));c.caret(d,d)},copyOriginal:function(a){var c=[];b.each(a,function(g){c[g]=b(this).text()});var d=b("[id^=id_target_f_]");if(d.length){var e=c.length-1;for(a=0;a<d.length;a++){var f=c[a]||c[e];b(d.get(a)).val(f)}d=b(d).get(0);d.focus();PTL.editor.goFuzzy();PTL.editor.cpRE.exec(b(d).val());a=PTL.editor.cpRE.lastIndex;b(d).caret(a,a);PTL.editor.cpRE.lastIndex=0}},
+getSelectedText:function(){var a="";if(window.getSelection)a=window.getSelection();else if(document.getSelection)a=document.getSelection();else if(document.selection)a=document.selection.createRange().text;return a},escapeHtml:function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/,"<br/>")},fancyEscape:function(a){function c(f){var g;g={"\r\n":'<span class="highlight-escape">%s</span>'.replace(/%s/,"\\r\\n")+"<br/>\n","\r":'<span class="highlight-escape">%s</span>'.replace(/%s/,
+"\\r")+"<br/>\n","\n":'<span class="highlight-escape">%s</span>'.replace(/%s/,"\\n")+"<br/>\n","\t":'<span class="highlight-escape">%s</span>'.replace(/%s/,"\\t")+"\t","&":"&amp;","<":"&lt;",">":"&gt;"}[f];if(g==undefined)g='<span class="highlight-html">&lt;%s&gt;</span>'.replace(/%s/,f.slice(1,f.length-1));return g}var d=a;a=a.match(this.escapeRE);for(var e in a)d=d.replace(a[e],c(a[e]));return d},doDiff:function(a,c){var d,e,f="",g="",h=this.differencer.diff_main(a,c);this.differencer.diff_cleanupSemantic(h);
+b.each(h,function(j,i){d=i[0];e=i[1];if(d==0){if(g){f+='<span class="diff-delete">'+PTL.editor.fancyEscape(g)+"</span>";g=""}f+=PTL.editor.fancyEscape(e)}else if(d==1)if(g){f+='<span class="diff-replace">'+PTL.editor.fancyEscape(e)+"</span>";g=""}else f+='<span class="diff-insert">'+PTL.editor.fancyEscape(e)+"</span>";else if(d==-1)g=e});if(g)f+='<span class="diff-delete">'+PTL.editor.fancyEscape(g)+"</span>";return f},doFuzzyArea:function(){b("tr.edit-row").addClass("fuzzy-unit")},undoFuzzyArea:function(){b("tr.edit-row").removeClass("fuzzy-unit")},
+doFuzzyBox:function(){b("input.fuzzycheck").attr("checked","checked")},undoFuzzyBox:function(){b("input.fuzzycheck").removeAttr("checked")},goFuzzy:function(){if(!this.isFuzzy()){this.keepState=true;this.doFuzzyArea();this.doFuzzyBox()}},ungoFuzzy:function(){if(this.isFuzzy()){this.keepState=true;this.undoFuzzyArea();this.undoFuzzyBox()}},isFuzzy:function(){return b("input.fuzzycheck").attr("checked")},doSuggestMode:function(){b("table.translate-table").addClass("suggest-mode")},undoSuggestMode:function(){b("table.translate-table").removeClass("suggest-mode")},
+isSuggestMode:function(){return b("table.translate-table").hasClass("suggest-mode")},toggleSuggestMode:function(){this.isSuggestMode()?this.undoSuggestMode():this.doSuggestMode()},showActivity:function(){b("#xhr-error").is(":hidden")&&b("#xhr-activity").show()},hideActivity:function(){b("#xhr-activity").hide()},displayError:function(a){if(a){this.hideActivity();b("#xhr-error span").text(a).parent().stop(true,true).fadeIn(300).delay(2E3).fadeOut(3500)}},error:function(a,c){var d="";d=a.status==0?"Error while connecting to the server.":
+a.status==500?"Server error.":c=="timeout"?"Server seems down, try again later.":a instanceof XMLHttpRequest?b.parseJSON(a.responseText):"Unknown error.";PTL.editor.displayError(d)},getReqData:function(){var a={};switch(this.filter){case "checks":if(this.checks.length)a.matchnames=this.checks.join(",");break;case "search":a.search=this.searchText;a.sfields=this.searchFields.length?this.searchFields:["source","target"];break;case "suggestions":a.matchnames="hassuggestion";break;case "mysuggestions":a.matchnames=
+"ownsuggestion";break;case "all":break;case "incomplete":a.unitstates="untranslated,fuzzy";break;default:a.unitstates=this.filter}return a},getViewUnits:function(a){var c,d;d=this.store?this.store+"/view":this.directory+"view.html";a=b.extend({},{async:false,limit:0,page:this.currentPage,pager:false,withUid:false},a);if(a.limit!=0)d=d+"/limit/"+limit;d=l(d);c={page:a.page};if(Object.size(this.meta)==0)c.meta=true;if(a.pager)c.pager=a.pager;if(a.withUid){c.uid=this.activeUid;delete c.page}c=b.extend(c,
+this.getReqData());b.ajax({url:d,data:c,dataType:"json",async:a.async,success:function(e){if(Object.size(PTL.editor.meta)==0&&e.meta)PTL.editor.meta=e.meta;if(a.pager)if(e.pager){PTL.editor.hasResults=true;PTL.editor.pagesGot={};PTL.editor.units={};PTL.editor.updatePager(e.pager);if(e.uid)PTL.editor.activeUid=e.uid}if(e.units.length){var f=a.withUid&&e.pager?e.pager.number:a.page;PTL.editor.pagesGot[f]=[];b.each(e.units,function(){PTL.editor.units[this.id]=this;PTL.editor.pagesGot[f].push(this.id)});
+PTL.editor.hasResults=true}else{PTL.editor.hasResults=false;PTL.editor.displayError("No results.");PTL.editor.reDraw(null)}},error:PTL.editor.error})},buildRows:function(a){var c,d,e,f="even",g=true,h="";for(d=0;d<a.length;d++){c=a[d].id||a[d];e=this.units[c];h+='<tr id="row'+c+'" class="view-row '+f+'">';h+=this.tmpl.vUnit(b,{data:{meta:this.meta,unit:e}}).join("");h+="</tr>";f=g?"odd":"even";g=!g}return h},buildCtxtRows:function(a){var c,d,e="even",f=true,g="";for(c=0;c<a.length;c++){d=a[c];g+=
+'<tr id="ctxt'+d.id+'" class="context-row '+e+'">';g+=this.tmpl.vUnit(b,{data:{meta:this.meta,unit:d}}).join("");g+="</tr>";e=f?"odd":"even";f=!f}return g},getUidsBeforeAfter:function(a){var c,d,e,f,g={before:[],after:[]},h=parseInt((this.pager.per_page-1)/2);c=this.units[a];var j={prev:"before",next:"after"};for(d in j){f=c;for(a=0;a<h;a++)if(f[d]!=undefined&&f[d]in this.units){f=this.units[f[d]];g[j[d]].push(f.id)}}if(Object.size(this.units)>h){e={prev:"after",next:"before"};for(d in j)if(g[e[d]].length<
+h){c=h-g[e[d]].length;f=this.units[g[j[d]][g[j[d]].length-1]];for(a=0;a<c;a++)if(f[d]!=undefined){f=this.units[f[d]];g[j[d]].push(f.id)}}}g.before.reverse();return g},checkUnitsLinking:function(){var a,c,d,e;for(e in this.pagesGot){e=parseInt(e);a=this.pagesGot[e][0];c=this.pagesGot[e][this.pagesGot[e].length-1];if(e>1&&(!this.units[a].hasOwnProperty("prev")||this.units[a].prev==null)){d=e-1;if(d in this.pagesGot){d=this.pagesGot[d][this.pagesGot[d].length-1];b.extend(this.units[a],{prev:d})}}if(e<
+this.pager.num_pages&&(!this.units[c].hasOwnProperty("next")||this.units[c].next==null)){d=e+1;d in this.pagesGot&&b.extend(this.units[c],{next:this.pagesGot[d][0]})}}},displayEditUnit:function(a){var c;this.checkUnitsLinking();if(PTL.editor.hasResults){this.fetchPages(true);c=this.getUidsBeforeAfter(a);a=this.buildRows(c.before)+this.getEditUnit(a)+this.buildRows(c.after);this.reDraw(a)}},reDraw:function(a){var c=b("table.translate-table"),d=b("tbody",c);b("tr",d).remove();b(".tipsy").remove();d.append(a);
+b(c).trigger("editor_ready")},fetchPages:function(a){var c;c=this.currentPage;var d=[c,c+1,c-1],e=[];for(c=0;c<d.length;c++)d[c]<=this.pager.num_pages&&d[c]>0&&!(d[c]in this.pagesGot)&&e.push(d[c]);for(c=0;c<e.length;c++)this.getViewUnits({async:a,page:e[c]})},updateBreadcrumbs:function(a,c){var d;if(this.dircrumbs&&this.dircrumbs!=a){this.dircrumbs=a;d=true}if(this.storecrumbs&&this.storecrumbs!=c){this.storecrumbs=c;d=true}if(d){d=b("#breadcrumbs").contents();d.slice(d.index(b("#projectcrumb"))+
+1).remove();b("#projectcrumb").after(a+c)}},updatePager:function(a){this.pager=a;if(this.currentPage!=a.number||this.currentNumPages!=a.num_pages){this.currentPage=a.number;this.currentNumPages=a.num_pages;b("input#item-number").val(a.number);b("span#items-count").text(a.num_pages)}},createPager:function(a){var c=this.pager;if(b.inArray(a,this.pagesGot[this.currentPage])==-1){for(var d,e=this.currentPage,f=this.currentPage,g=false;!g&&(e>0||f<=this.pager.num_pages);){if(b.inArray(a,this.pagesGot[e])!=
+-1){d=e;g=true}else if(b.inArray(a,this.pagesGot[f])!=-1){d=f;g=true}e--;f++}if(g)c.number=d}return c},getEditUnit:function(a){var c;c="edit-row";var d=l("/unit/edit/"+a),e=this.getReqData(),f="",g={before:[],after:[]};b.ajax({url:d,async:false,data:e,dataType:"json",success:function(h){f=h.editor;storecrumbs=h.storecrumbs;dircrumbs=h.dircrumbs;PTL.editor.updateBreadcrumbs(dircrumbs,storecrumbs);PTL.editor.updatePager(PTL.editor.createPager(a));if(h.ctxt){PTL.editor.ctxtGap=2;g.before=h.ctxt.before;
+g.after=h.ctxt.after}},error:PTL.editor.error});c+=this.units[a].isfuzzy?" fuzzy-unit":"";c=(g.before.length?'<tr class="more-context before"><td colspan="2"><a class="morecontext">Show more context rows</a></td></tr>':"")+this.buildCtxtRows(g.before)+'<tr id="row'+a+'" class="'+c+'">'+f+"</tr>"+this.buildCtxtRows(g.after)+(g.after.length?'<tr class="more-context after"><td colspan="2"><a class="morecontext">Show more context rows</a></td></tr>':"");this.activeUid=a;return c},processSubmit:function(a,
+c){a.preventDefault();var d,e,f,g=PTL.editor.activeUid;if(c==undefined){c=b(a.target).attr("class");d="translate"}else d="captcha";f={submit:"submission",suggest:"suggestion"}[c];e=l("/unit/process/"+g+"/"+f);d=b("form#"+d).serializeObject();b.extend(d,PTL.editor.getReqData());b.ajax({url:e,type:"POST",data:d,dataType:"json",async:false,success:function(h){if(h.captcha){b.fancybox(h.captcha);b("input#id_captcha_answer").focus()}else{if(f=="submission"){PTL.editor.units[g].isfuzzy=PTL.editor.isFuzzy();
+b("textarea[id^=id_target_f_]").each(function(j){PTL.editor.units[g].target[j].text=b(this).val()})}if(h=parseInt(PTL.editor.units[g].next)){h=PTL.utils.updateHashPart("unit",h,["page"]);b.history.load(h)}else PTL.editor.displayError("Congratulations, you walked through all items")}},error:PTL.editor.error})},gotoPrevNext:function(a){a.preventDefault();var c=PTL.editor.units[PTL.editor.activeUid];c={previous:c.prev,next:c.next}[b(a.target).attr("class")];if(c!=null){a=PTL.utils.updateHashPart("unit",
+parseInt(c),["page"]);b.history.load(a)}else b(a.target).attr("class")=="previous"?PTL.editor.displayError("You reached the beginning of the list"):PTL.editor.displayError("You reached the end of the list")},gotoUnit:function(a){a.preventDefault();if(PTL.editor.getSelectedText()=="")if(a=b(this).attr("id").match(/row([0-9]+)/)){a=parseInt(a[1]);a=PTL.utils.updateHashPart("unit",a,["page"]);b.history.load(a)}},gotoPage:function(a){if(a&&!isNaN(a)&&a>0&&a<=PTL.editor.pager.num_pages){a=PTL.utils.updateHashPart("page",
+a,["unit"]);b.history.load(a)}},gotoFirstPage:function(){PTL.editor.currentNumPages>0&&this.gotoPage(1)},gotoLastPage:function(){PTL.editor.currentNumPages>0&&this.gotoPage(PTL.editor.currentNumPages)},gotoPrevPage:function(){PTL.editor.currentNumPages>0&&this.currentPage>1&&this.gotoPage(this.currentPage-1)},gotoNextPage:function(){PTL.editor.currentNumPages>0&&this.currentPage<PTL.editor.currentNumPages&&this.gotoPage(this.currentPage+1)},getCheckOptions:function(){var a,c=this.store?l(this.store+
+"/checks/"):l(this.directory+"checks.html");b.ajax({url:c,async:false,dataType:"json",success:function(d){a=d.checks},error:PTL.editor.error});return a},filterChecks:function(){if(!PTL.editor.preventNavigation){var a=b("option:selected",this).val();a!="none"&&b.history.load("filter=checks,"+a)}},filterStatus:function(){var a=b("div#filter-status option:selected").val();if(a=="checks"){a=PTL.editor.getCheckOptions();if(a.length){var c='<div id="filter-checks" class="toolbar-item">';c+='<select name="filter-checks">';
+c+='<option selected="selected" value="none">------</option>';b.each(a,function(){c+='<option value="'+this.name+'">'+this.text+"</option>"});c+="</select></div>";b("div#filter-status").first().after(c)}else{PTL.editor.displayError("No results.");b("#filter-status option[value="+PTL.editor.filter+"]").attr("selected","selected")}}else{b("div#filter-checks").remove();PTL.editor.preventNavigation||b.history.load("filter="+a)}},getMoreContext:function(){var a=l("/unit/context/"+PTL.editor.activeUid);
+reqData={gap:PTL.editor.ctxtGap};b.ajax({url:a,async:false,dataType:"json",data:reqData,success:function(c){PTL.editor.ctxtGap+=2;var d=PTL.editor.buildCtxtRows(c.ctxt.before);c=PTL.editor.buildCtxtRows(c.ctxt.after);var e=b("tr.context-row");e.first().before(d);e.last().after(c)},error:PTL.editor.error})},parseSearch:function(a){var c=[],d=a;if(this.searchRE.test(a)){var e,f=[],g=a.split(" ");b.each(g,function(h,j){if(PTL.editor.searchRE.test(j)){e=j.split(":")[1];b.inArray(e,PTL.editor.searchOptions)>
+-1&&c.push(e);f.push(h)}});b.each(f.reverse(),function(h,j){g.splice(j,1)});d=encodeURIComponent(g.join(" "))}else{d=encodeURIComponent(d);b("div.advancedsearch input:checked").each(function(){c.push(b(this).val())})}if(c.length)d+="&sfields="+c.join(",");return d},search:function(){var a=b("input#id_search").val();a=a?"search="+this.parseSearch(a):PTL.utils.updateHashPart("filter","all",["search","sfields"]);b.history.load(a)},filterTMResults:function(a){for(var c=b("[id^=id_source_f_]").first().val(),
+d=[],e=0;e<a.length&&e<3;e++){a[e].source=this.doDiff(c,a[e].source);a[e].target=this.fancyEscape(a[e].target);a[e].qTitle=Math.round(a[e].quality)+"% match";d.push(a[e])}return d},getTMUnits:function(){var a=this.meta.source_lang,c=this.meta.target_lang,d=b(b("input[id^=id_source_f_]").get(0)).val();a=this.settings.tmUrl+a+"/"+c+"/unit/"+encodeURIComponent(d)+"?jsoncallback=?";this.tmReq!=null&&this.tmReq.abort();this.tmReq=b.jsonp({url:a,callback:"_jsonp"+PTL.editor.activeUid,dataType:"jsonp",success:function(e){if(this.callback.slice(6)==
+PTL.editor.activeUid&&e.length>0){e=PTL.editor.filterTMResults(e);e=PTL.editor.tmpl.tm(b,{data:{meta:PTL.editor.meta,suggs:e,name:"amaGama server"}}).join("");b("div#suggestion-container").append(e);b("div#amagama_results").animate({height:"show"},1E3,"easeOutQuad")}},error:PTL.editor.error})},rejectSuggestion:function(){var a=b(this).parent(),c=b(".translate-container input#id_id").val(),d=b(this).siblings("input.suggid").val();c=l("/suggestion/reject/")+c+"/"+d;b.post(c,{reject:1},function(){a.fadeOut(200,
+function(){b(this).remove();b("div#suggestion-container div[id^=suggestion]").length||b("input.next").trigger("click")})},"json")},acceptSuggestion:function(){var a=b(this).parent(),c=b(".translate-container input#id_id").val(),d=b(this).siblings("input.suggid").val();d=l("/suggestion/accept/")+c+"/"+d;b.post(d,{accept:1},function(e){b.each(e.newtargets,function(f,g){b("textarea#id_target_f_"+f).val(g).focus()});b.each(e.newdiffs,function(f,g){b.each(g,function(h,j){b("#suggdiff-"+f+"-"+h).html(j)})});
+b("textarea[id^=id_target_f_]").each(function(f){PTL.editor.units[c].target[f].text=b(this).val()});PTL.editor.units[c].isfuzzy=false;a.fadeOut(200,function(){b(this).remove();b("div#suggestion-container div[id^=suggestion]").length||b("input.next").trigger("click")})},"json")},rejectCheck:function(){var a=b(this).parent(),c=b(this).siblings("input.checkid").val(),d=b(".translate-container input#id_id").val();c=l("/qualitycheck/reject/")+d+"/"+c;b.post(c,{reject:1},function(){a.fadeOut(200,function(){b(this).remove()})},
+"json")},isSupportedSource:function(a,c){for(var d in a)if(c==a[d].source)return true;return false},isSupportedTarget:function(a,c){for(var d in a)if(c==a[d].target)return true;return false},isSupportedPair:function(a,c,d){for(var e in a)if(c==a[e].source&&d==a[e].target)return true;return false},addMTButton:function(a,c,d,e){c='<a class="translate-mt '+c+'">';c+='<img src="'+d+'" title="'+e+'" /></a>';b(a).first().prepend(c)},addMTButtons:function(a){if(this.isSupportedTarget(a.pairs,a.targetLang)){var c=
+this,d=b(".translate-toolbar");b(d).each(function(){var e=c.normalizeCode(b(this).parent().parent().find(".translation-text").attr("lang"));(a.validatePairs?c.isSupportedPair(a.pairs,e,a.targetLang):c.isSupportedSource(a.pairs,e))&&c.addMTButton(this,a.buttonClassName,a.imageUri,a.hint+" ("+e.toUpperCase()+"&rarr;"+a.targetLang.toUpperCase()+")")})}},normalizeCode:function(a){var c=a.replace("_","-");a=a.indexOf("@");if(a!=-1)c=c.slice(0,a);return c},collectArguments:function(a){this.argSubs[this.argPos]=
+a;return"["+this.argPos++ +"]"},translate:function(a,c){var d=b("[id^=id_target_f_]"),e=b(a).parent().parent().parent().find(".translation-text"),f=PTL.editor.normalizeCode(e.eq(0).attr("lang")),g=PTL.editor.normalizeCode(d.eq(0).attr("lang")),h=/<[\/]?\w+.*?>/g,j=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuidfegEG])/g,i=/{\d+(,\d+)?(:[a-zA-Z ]+)?}/g,n=/%\d+/g,k=this;b(e).each(function(t){var s=b(this).text();k.argSubs=[];k.argPos=0;s=s.replace(h,function(v){return k.collectArguments(v)});
+s=s.replace(j,function(v){return k.collectArguments(v)});s=s.replace(i,function(v){return k.collectArguments(v)});s=s.replace(n,function(v){return k.collectArguments(v)});c(s,f,g,function(v,z){if(v===false)PTL.editor.displayError(z);else{for(var w=0;w<k.argSubs.length;w++){if(s.match(RegExp("\\["+w+"\\][^\\s]")))v=v.replace(RegExp("\\["+w+"\\]\\s+"),"["+w+"]");if(s.match(RegExp("[^\\s]\\["+w+"\\]")))v=v.replace(RegExp("\\s+\\["+w+"\\]"),"["+w+"]")}for(w=0;w<k.argSubs.length;w++){var u=k.argSubs[w].replace(/\&/g,
+"&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;");v=v.replace("["+w+"]",u)}d.eq(t).val(b("<div />").html(v).text());d.eq(t).focus()}})});PTL.editor.goFuzzy();return false}}})(jQuery);if(!this.JSON)this.JSON={};
+(function(){function b(i){return i<10?"0"+i:i}function a(i){e.lastIndex=0;return e.test(i)?'"'+i.replace(e,function(n){var k=h[n];return typeof k==="string"?k:"\\u"+("0000"+n.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'}function c(i,n){var k,t,s,v,z=f,w,u=n[i];if(u&&typeof u==="object"&&typeof u.toJSON==="function")u=u.toJSON(i);if(typeof j==="function")u=j.call(n,i,u);switch(typeof u){case "string":return a(u);case "number":return isFinite(u)?String(u):"null";case "boolean":case "null":return String(u);
+case "object":if(!u)return"null";f+=g;w=[];if(Object.prototype.toString.apply(u)==="[object Array]"){v=u.length;for(k=0;k<v;k+=1)w[k]=c(k,u)||"null";s=w.length===0?"[]":f?"[\n"+f+w.join(",\n"+f)+"\n"+z+"]":"["+w.join(",")+"]";f=z;return s}if(j&&typeof j==="object"){v=j.length;for(k=0;k<v;k+=1){t=j[k];if(typeof t==="string")if(s=c(t,u))w.push(a(t)+(f?": ":":")+s)}}else for(t in u)if(Object.hasOwnProperty.call(u,t))if(s=c(t,u))w.push(a(t)+(f?": ":":")+s);s=w.length===0?"{}":f?"{\n"+f+w.join(",\n"+f)+
+"\n"+z+"}":"{"+w.join(",")+"}";f=z;return s}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+b(this.getUTCMonth()+1)+"-"+b(this.getUTCDate())+"T"+b(this.getUTCHours())+":"+b(this.getUTCMinutes())+":"+b(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},j;if(typeof JSON.stringify!=="function")JSON.stringify=function(i,n,k){var t;g=f="";if(typeof k==="number")for(t=0;t<k;t+=1)g+=" ";else if(typeof k==="string")g=k;if((j=n)&&typeof n!=="function"&&(typeof n!=="object"||typeof n.length!=="number"))throw Error("JSON.stringify");return c("",
+{"":i})};if(typeof JSON.parse!=="function")JSON.parse=function(i,n){function k(s,v){var z,w,u=s[v];if(u&&typeof u==="object")for(z in u)if(Object.hasOwnProperty.call(u,z)){w=k(u,z);if(w!==undefined)u[z]=w;else delete u[z]}return n.call(s,v,u)}var t;i=String(i);d.lastIndex=0;if(d.test(i))i=i.replace(d,function(s){return"\\u"+("0000"+s.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(i.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){t=eval("("+i+")");return typeof n==="function"?k({"":t},""):t}throw new SyntaxError("JSON.parse");}})();(function(){jQuery.each({getSelection:function(){var b=this.jquery?this[0]:this;return("selectionStart"in b&&function(){var a=b.selectionEnd-b.selectionStart;return{start:b.selectionStart,end:b.selectionEnd,length:a,text:b.value.substr(b.selectionStart,a)}}||document.selection&&function(){b.focus();var a=document.selection.createRange();if(a==null)return{start:0,end:b.value.length,length:0};var c=b.createTextRange(),d=c.duplicate();c.moveToBookmark(a.getBookmark());d.setEndPoint("EndToStart",c);return{start:d.text.length,
+end:d.text.length+a.text.length,length:a.text.length,text:a.text}}||function(){return{start:0,end:b.value.length,length:0}})()},replaceSelection:function(b){var a=this.jquery?this[0]:this,c=b||"";return("selectionStart"in a&&function(){a.value=a.value.substr(0,a.selectionStart)+c+a.value.substr(a.selectionEnd,a.value.length);return this}||document.selection&&function(){a.focus();document.selection.createRange().text=c;return this}||function(){a.value+=c;return this})()}},function(b){jQuery.fn[b]=
+this})})();(function(b,a,c,d){b.fn.caret=function(e,f){var g,h,j=this[0],i=b.browser.msie;if(typeof e==="object"&&typeof e.start==="number"&&typeof e.end==="number"){g=e.start;h=e.end}else if(typeof e==="number"&&typeof f==="number"){g=e;h=f}else if(typeof e==="string")if((g=j.value.indexOf(e))>-1)h=g+e[a];else g=null;else if(Object.prototype.toString.call(e)==="[object RegExp]"){var n=e.exec(j.value);if(n!=null){g=n.index;h=g+n[0][a]}}if(typeof g!="undefined"){if(i){i=this[0].createTextRange();i.collapse(true);
+i.moveStart("character",g);i.moveEnd("character",h-g);i.select()}else{this[0].selectionStart=g;this[0].selectionEnd=h}this[0].focus();return this}else{if(i){h=document.selection;if(this[0].tagName.toLowerCase()!="textarea"){i=this.val();g=h[c]()[d]();g.moveEnd("character",i[a]);var k=g.text==""?i[a]:i.lastIndexOf(g.text);g=h[c]()[d]();g.moveStart("character",-i[a]);var t=g.text[a]}else{g=h[c]();h=g[d]();h.moveToElementText(this[0]);h.setEndPoint("EndToEnd",g);k=h.text[a]-g.text[a];t=k+g.text[a]}}else{k=
+j.selectionStart;t=j.selectionEnd}g=j.value.substring(k,t);return{start:k,end:t,text:g,replace:function(s){return j.value.substring(0,k)+s+j.value.substring(t,j.value[a])}}}}})(jQuery,"length","createRange","duplicate");(function(b){b.fn.highlightRegex=function(a){a==undefined||a.source==""?b(this).find("span.highlight").each(function(){b(this).replaceWith(b(this).text());b(this).parent().each(function(){node=b(this).get(0);node.normalize&&node.normalize()})}):b(this).each(function(){elt=b(this).get(0);elt.normalize();b.each(b.makeArray(elt.childNodes),function(c,d){if(d.nodeType==3)for(var e=d;(pos=e.data.search(a))>=0;){match=e.data.slice(pos).match(a)[0];if(match.length==0)break;var f=document.createElement("span");
+f.className="highlight";var g=e.splitText(pos);e=g.splitText(match.length);var h=g.cloneNode(true);f.appendChild(h);e.parentNode.replaceChild(f,g)}else b(d).highlightRegex(a)})});return b(this)}})(jQuery);(function(b,a){b.fn.serializeObject=function(){var c={};b.each(this.serializeArray(),function(d,e){var f=e.name,g=e.value;c[f]=c[f]===a?g:b.isArray(c[f])?c[f].concat(g):[c[f],g]});return c}})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.bidi.js b/src/pootle_it/html/js/jquery/jquery.bidi.js
new file mode 100644
index 0000000..a72ae40
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.bidi.js
@@ -0,0 +1,24 @@
+/**
+ * jquery.bidi.js -- set dir attribute based on first strongly
+ * directional character in text
+ *
+ * Alaa Abd El Fattah
+ *
+ */
+
+NOT_UNICODE_LETTER = /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u097B-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D3D\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC\u0EDD\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8B\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10D0-\u10FA\u10FC\u1100-\u1159\u115F-\u11A2\u11A8-\u11F9\u1200-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u1676\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19A9\u19C1-\u19C7\u1A00-\u1A16\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u2094\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C6F\u2C71-\u2C7D\u2C80-\u2CE4\u2D00-\u2D25\u2D30-\u2D65\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31B7\u31F0-\u31FF\u3400\u4DB5\u4E00\u9FC3\uA000-\uA48C\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA65F\uA662-\uA66E\uA67F-\uA697\uA717-\uA71F\uA722-\uA788\uA78B\uA78C\uA7FB-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA90A-\uA925\uA930-\uA946\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAC00\uD7A3\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/g;
+
+UNICODE_RTL = /^[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\uFB50-\uFDFF\uFE70-\uFEFF]/;
+
+(function($){
+ $.fn.bidi = function() {
+ return this.each(function() {
+ var obj = $(this);
+ var text = obj.text().replace(NOT_UNICODE_LETTER, "");
+ if (text && UNICODE_RTL.test(text))
+ obj.css("direction", "rtl");
+ else
+ obj.css("direction", "ltr");
+ });
+ };
+})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.caret.js b/src/pootle_it/html/js/jquery/jquery.caret.js
new file mode 100644
index 0000000..87d4a38
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.caret.js
@@ -0,0 +1,69 @@
+/*
+ *
+ * Copyright (c) 2010 C. F., Wong (<a href="http://cloudgen.w0ng.hk">Cloudgen Examplet Store</a>)
+ * Licensed under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+(function($,len,createRange,duplicate){
+ $.fn.caret=function(options,opt2){
+ var start,end,t=this[0],browser=$.browser.msie;
+ if(typeof options==="object" && typeof options.start==="number" && typeof options.end==="number") {
+ start=options.start;
+ end=options.end;
+ } else if(typeof options==="number" && typeof opt2==="number"){
+ start=options;
+ end=opt2;
+ } else if(typeof options==="string"){
+ if((start=t.value.indexOf(options))>-1) end=start+options[len];
+ else start=null;
+ } else if(Object.prototype.toString.call(options)==="[object RegExp]"){
+ var re=options.exec(t.value);
+ if(re != null) {
+ start=re.index;
+ end=start+re[0][len];
+ }
+ }
+ if(typeof start!="undefined"){
+ if(browser){
+ var selRange = this[0].createTextRange();
+ selRange.collapse(true);
+ selRange.moveStart('character', start);
+ selRange.moveEnd('character', end-start);
+ selRange.select();
+ } else {
+ this[0].selectionStart=start;
+ this[0].selectionEnd=end;
+ }
+ this[0].focus();
+ return this
+ } else {
+ if(browser){
+ var selection=document.selection;
+ if (this[0].tagName.toLowerCase() != "textarea") {
+ var val = this.val(),
+ range = selection[createRange]()[duplicate]();
+ range.moveEnd("character", val[len]);
+ var s = (range.text == "" ? val[len]:val.lastIndexOf(range.text));
+ range = selection[createRange]()[duplicate]();
+ range.moveStart("character", -val[len]);
+ var e = range.text[len];
+ } else {
+ var range = selection[createRange](),
+ stored_range = range[duplicate]();
+ stored_range.moveToElementText(this[0]);
+ stored_range.setEndPoint('EndToEnd', range);
+ var s = stored_range.text[len] - range.text[len],
+ e = s + range.text[len]
+ }
+ } else {
+ var s=t.selectionStart,
+ e=t.selectionEnd;
+ }
+ var te=t.value.substring(s,e);
+ return {start:s,end:e,text:te,replace:function(st){
+ return t.value.substring(0,s)+st+t.value.substring(e,t.value[len])
+ }}
+ }
+ }
+})(jQuery,"length","createRange","duplicate"); \ No newline at end of file
diff --git a/src/pootle_it/html/js/jquery/jquery.cookie.js b/src/pootle_it/html/js/jquery/jquery.cookie.js
new file mode 100644
index 0000000..79317f7
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.cookie.js
@@ -0,0 +1,96 @@
+/**
+ * Cookie plugin
+ *
+ * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ */
+
+/**
+ * Create a cookie with the given name and value and other optional parameters.
+ *
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Set the value of a cookie.
+ * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
+ * @desc Create a cookie with all available options.
+ * @example $.cookie('the_cookie', 'the_value');
+ * @desc Create a session cookie.
+ * @example $.cookie('the_cookie', null);
+ * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
+ * used when the cookie was set.
+ *
+ * @param String name The name of the cookie.
+ * @param String value The value of the cookie.
+ * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
+ * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
+ * If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
+ * If set to null or omitted, the cookie will be a session cookie and will not be retained
+ * when the the browser exits.
+ * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
+ * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
+ * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
+ * require a secure protocol (like HTTPS).
+ * @type undefined
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+
+/**
+ * Get the value of a cookie with the given name.
+ *
+ * @example $.cookie('the_cookie');
+ * @desc Get the value of a cookie.
+ *
+ * @param String name The name of the cookie.
+ * @return The value of the cookie.
+ * @type String
+ *
+ * @name $.cookie
+ * @cat Plugins/Cookie
+ * @author Klaus Hartl/klaus.hartl@stilbuero.de
+ */
+jQuery.cookie = function(name, value, options) {
+ if (typeof value != 'undefined') { // name and value given, set cookie
+ options = options || {};
+ if (value === null) {
+ value = '';
+ options.expires = -1;
+ }
+ var expires = '';
+ if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
+ var date;
+ if (typeof options.expires == 'number') {
+ date = new Date();
+ date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
+ } else {
+ date = options.expires;
+ }
+ expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
+ }
+ // CAUTION: Needed to parenthesize options.path and options.domain
+ // in the following expressions, otherwise they evaluate to undefined
+ // in the packed version for some reason...
+ var path = options.path ? '; path=' + (options.path) : '';
+ var domain = options.domain ? '; domain=' + (options.domain) : '';
+ var secure = options.secure ? '; secure' : '';
+ document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
+ } else { // only name given, get cookie
+ var cookieValue = null;
+ if (document.cookie && document.cookie != '') {
+ var cookies = document.cookie.split(';');
+ for (var i = 0; i < cookies.length; i++) {
+ var cookie = jQuery.trim(cookies[i]);
+ // Does this cookie string begin with the name we want?
+ if (cookie.substring(0, name.length + 1) == (name + '=')) {
+ cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
+ break;
+ }
+ }
+ }
+ return cookieValue;
+ }
+};
diff --git a/src/pootle_it/html/js/jquery/jquery.easing.js b/src/pootle_it/html/js/jquery/jquery.easing.js
new file mode 100644
index 0000000..ef74321
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.easing.js
@@ -0,0 +1,205 @@
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+jQuery.easing['jswing'] = jQuery.easing['swing'];
+
+jQuery.extend( jQuery.easing,
+{
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert(jQuery.easing.default);
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
+ return c/2*((t-=2)*t*t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t*t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+ return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */ \ No newline at end of file
diff --git a/src/pootle_it/html/js/jquery/jquery.fancybox.js b/src/pootle_it/html/js/jquery/jquery.fancybox.js
new file mode 100644
index 0000000..be77275
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.fancybox.js
@@ -0,0 +1,1156 @@
+/*
+ * FancyBox - jQuery Plugin
+ * Simple and fancy lightbox alternative
+ *
+ * Examples and documentation at: http://fancybox.net
+ *
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
+ *
+ * Version: 1.3.4 (11/11/2010)
+ * Requires: jQuery v1.3+
+ *
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
+;(function($) {
+ var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
+
+ selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
+
+ ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
+
+ loadingTimer, loadingFrame = 1,
+
+ titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
+
+ isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
+
+ /*
+ * Private methods
+ */
+
+ _abort = function() {
+ loading.hide();
+
+ imgPreloader.onerror = imgPreloader.onload = null;
+
+ if (ajaxLoader) {
+ ajaxLoader.abort();
+ }
+
+ tmp.empty();
+ },
+
+ _error = function() {
+ if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
+ loading.hide();
+ busy = false;
+ return;
+ }
+
+ selectedOpts.titleShow = false;
+
+ selectedOpts.width = 'auto';
+ selectedOpts.height = 'auto';
+
+ tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
+
+ _process_inline();
+ },
+
+ _start = function() {
+ var obj = selectedArray[ selectedIndex ],
+ href,
+ type,
+ title,
+ str,
+ emb,
+ ret;
+
+ _abort();
+
+ selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
+
+ ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
+
+ if (ret === false) {
+ busy = false;
+ return;
+ } else if (typeof ret == 'object') {
+ selectedOpts = $.extend(selectedOpts, ret);
+ }
+
+ title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
+
+ if (obj.nodeName && !selectedOpts.orig) {
+ selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
+ }
+
+ if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
+ title = selectedOpts.orig.attr('alt');
+ }
+
+ href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
+
+ if ((/^(?:javascript)/i).test(href) || href == '#') {
+ href = null;
+ }
+
+ if (selectedOpts.type) {
+ type = selectedOpts.type;
+
+ if (!href) {
+ href = selectedOpts.content;
+ }
+
+ } else if (selectedOpts.content) {
+ type = 'html';
+
+ } else if (href) {
+ if (href.match(imgRegExp)) {
+ type = 'image';
+
+ } else if (href.match(swfRegExp)) {
+ type = 'swf';
+
+ } else if ($(obj).hasClass("iframe")) {
+ type = 'iframe';
+
+ } else if (href.indexOf("#") === 0) {
+ type = 'inline';
+
+ } else {
+ type = 'ajax';
+ }
+ }
+
+ if (!type) {
+ _error();
+ return;
+ }
+
+ if (type == 'inline') {
+ obj = href.substr(href.indexOf("#"));
+ type = $(obj).length > 0 ? 'inline' : 'ajax';
+ }
+
+ selectedOpts.type = type;
+ selectedOpts.href = href;
+ selectedOpts.title = title;
+
+ if (selectedOpts.autoDimensions) {
+ if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
+ selectedOpts.width = 'auto';
+ selectedOpts.height = 'auto';
+ } else {
+ selectedOpts.autoDimensions = false;
+ }
+ }
+
+ if (selectedOpts.modal) {
+ selectedOpts.overlayShow = true;
+ selectedOpts.hideOnOverlayClick = false;
+ selectedOpts.hideOnContentClick = false;
+ selectedOpts.enableEscapeButton = false;
+ selectedOpts.showCloseButton = false;
+ }
+
+ selectedOpts.padding = parseInt(selectedOpts.padding, 10);
+ selectedOpts.margin = parseInt(selectedOpts.margin, 10);
+
+ tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
+
+ $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
+ $(this).replaceWith(content.children());
+ });
+
+ switch (type) {
+ case 'html' :
+ tmp.html( selectedOpts.content );
+ _process_inline();
+ break;
+
+ case 'inline' :
+ if ( $(obj).parent().is('#fancybox-content') === true) {
+ busy = false;
+ return;
+ }
+
+ $('<div class="fancybox-inline-tmp" />')
+ .hide()
+ .insertBefore( $(obj) )
+ .bind('fancybox-cleanup', function() {
+ $(this).replaceWith(content.children());
+ }).bind('fancybox-cancel', function() {
+ $(this).replaceWith(tmp.children());
+ });
+
+ $(obj).appendTo(tmp);
+
+ _process_inline();
+ break;
+
+ case 'image':
+ busy = false;
+
+ $.fancybox.showActivity();
+
+ imgPreloader = new Image();
+
+ imgPreloader.onerror = function() {
+ _error();
+ };
+
+ imgPreloader.onload = function() {
+ busy = true;
+
+ imgPreloader.onerror = imgPreloader.onload = null;
+
+ _process_image();
+ };
+
+ imgPreloader.src = href;
+ break;
+
+ case 'swf':
+ selectedOpts.scrolling = 'no';
+
+ str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
+ emb = '';
+
+ $.each(selectedOpts.swf, function(name, val) {
+ str += '<param name="' + name + '" value="' + val + '"></param>';
+ emb += ' ' + name + '="' + val + '"';
+ });
+
+ str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
+
+ tmp.html(str);
+
+ _process_inline();
+ break;
+
+ case 'ajax':
+ busy = false;
+
+ $.fancybox.showActivity();
+
+ selectedOpts.ajax.win = selectedOpts.ajax.success;
+
+ ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
+ url : href,
+ data : selectedOpts.ajax.data || {},
+ error : function(XMLHttpRequest, textStatus, errorThrown) {
+ if ( XMLHttpRequest.status > 0 ) {
+ _error();
+ }
+ },
+ success : function(data, textStatus, XMLHttpRequest) {
+ var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
+ if (o.status == 200) {
+ if ( typeof selectedOpts.ajax.win == 'function' ) {
+ ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
+
+ if (ret === false) {
+ loading.hide();
+ return;
+ } else if (typeof ret == 'string' || typeof ret == 'object') {
+ data = ret;
+ }
+ }
+
+ tmp.html( data );
+ _process_inline();
+ }
+ }
+ }));
+
+ break;
+
+ case 'iframe':
+ _show();
+ break;
+ }
+ },
+
+ _process_inline = function() {
+ var
+ w = selectedOpts.width,
+ h = selectedOpts.height;
+
+ if (w.toString().indexOf('%') > -1) {
+ w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
+
+ } else {
+ w = w == 'auto' ? 'auto' : w + 'px';
+ }
+
+ if (h.toString().indexOf('%') > -1) {
+ h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
+
+ } else {
+ h = h == 'auto' ? 'auto' : h + 'px';
+ }
+
+ tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
+
+ selectedOpts.width = tmp.width();
+ selectedOpts.height = tmp.height();
+
+ _show();
+ },
+
+ _process_image = function() {
+ selectedOpts.width = imgPreloader.width;
+ selectedOpts.height = imgPreloader.height;
+
+ $("<img />").attr({
+ 'id' : 'fancybox-img',
+ 'src' : imgPreloader.src,
+ 'alt' : selectedOpts.title
+ }).appendTo( tmp );
+
+ _show();
+ },
+
+ _show = function() {
+ var pos, equal;
+
+ loading.hide();
+
+ if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
+ $.event.trigger('fancybox-cancel');
+
+ busy = false;
+ return;
+ }
+
+ busy = true;
+
+ $(content.add( overlay )).unbind();
+
+ $(window).unbind("resize.fb scroll.fb");
+ $(document).unbind('keydown.fb');
+
+ if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
+ wrap.css('height', wrap.height());
+ }
+
+ currentArray = selectedArray;
+ currentIndex = selectedIndex;
+ currentOpts = selectedOpts;
+
+ if (currentOpts.overlayShow) {
+ overlay.css({
+ 'background-color' : currentOpts.overlayColor,
+ 'opacity' : currentOpts.overlayOpacity,
+ 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
+ 'height' : $(document).height()
+ });
+
+ if (!overlay.is(':visible')) {
+ if (isIE6) {
+ $('select:not(#fancybox-tmp select)').filter(function() {
+ return this.style.visibility !== 'hidden';
+ }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
+ this.style.visibility = 'inherit';
+ });
+ }
+
+ overlay.show();
+ }
+ } else {
+ overlay.hide();
+ }
+
+ final_pos = _get_zoom_to();
+
+ _process_title();
+
+ if (wrap.is(":visible")) {
+ $( close.add( nav_left ).add( nav_right ) ).hide();
+
+ pos = wrap.position(),
+
+ start_pos = {
+ top : pos.top,
+ left : pos.left,
+ width : wrap.width(),
+ height : wrap.height()
+ };
+
+ equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
+
+ content.fadeTo(currentOpts.changeFade, 0.3, function() {
+ var finish_resizing = function() {
+ content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
+ };
+
+ $.event.trigger('fancybox-change');
+
+ content
+ .empty()
+ .removeAttr('filter')
+ .css({
+ 'border-width' : currentOpts.padding,
+ 'width' : final_pos.width - currentOpts.padding * 2,
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
+ });
+
+ if (equal) {
+ finish_resizing();
+
+ } else {
+ fx.prop = 0;
+
+ $(fx).animate({prop: 1}, {
+ duration : currentOpts.changeSpeed,
+ easing : currentOpts.easingChange,
+ step : _draw,
+ complete : finish_resizing
+ });
+ }
+ });
+
+ return;
+ }
+
+ wrap.removeAttr("style");
+
+ content.css('border-width', currentOpts.padding);
+
+ if (currentOpts.transitionIn == 'elastic') {
+ start_pos = _get_zoom_from();
+
+ content.html( tmp.contents() );
+
+ wrap.show();
+
+ if (currentOpts.opacity) {
+ final_pos.opacity = 0;
+ }
+
+ fx.prop = 0;
+
+ $(fx).animate({prop: 1}, {
+ duration : currentOpts.speedIn,
+ easing : currentOpts.easingIn,
+ step : _draw,
+ complete : _finish
+ });
+
+ return;
+ }
+
+ if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
+ title.show();
+ }
+
+ content
+ .css({
+ 'width' : final_pos.width - currentOpts.padding * 2,
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
+ })
+ .html( tmp.contents() );
+
+ wrap
+ .css(final_pos)
+ .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
+ },
+
+ _format_title = function(title) {
+ if (title && title.length) {
+ if (currentOpts.titlePosition == 'float') {
+ return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
+ }
+
+ return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
+ }
+
+ return false;
+ },
+
+ _process_title = function() {
+ titleStr = currentOpts.title || '';
+ titleHeight = 0;
+
+ title
+ .empty()
+ .removeAttr('style')
+ .removeClass();
+
+ if (currentOpts.titleShow === false) {
+ title.hide();
+ return;
+ }
+
+ titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
+
+ if (!titleStr || titleStr === '') {
+ title.hide();
+ return;
+ }
+
+ title
+ .addClass('fancybox-title-' + currentOpts.titlePosition)
+ .html( titleStr )
+ .appendTo( 'body' )
+ .show();
+
+ switch (currentOpts.titlePosition) {
+ case 'inside':
+ title
+ .css({
+ 'width' : final_pos.width - (currentOpts.padding * 2),
+ 'marginLeft' : currentOpts.padding,
+ 'marginRight' : currentOpts.padding
+ });
+
+ titleHeight = title.outerHeight(true);
+
+ title.appendTo( outer );
+
+ final_pos.height += titleHeight;
+ break;
+
+ case 'over':
+ title
+ .css({
+ 'marginLeft' : currentOpts.padding,
+ 'width' : final_pos.width - (currentOpts.padding * 2),
+ 'bottom' : currentOpts.padding
+ })
+ .appendTo( outer );
+ break;
+
+ case 'float':
+ title
+ .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
+ .appendTo( wrap );
+ break;
+
+ default:
+ title
+ .css({
+ 'width' : final_pos.width - (currentOpts.padding * 2),
+ 'paddingLeft' : currentOpts.padding,
+ 'paddingRight' : currentOpts.padding
+ })
+ .appendTo( wrap );
+ break;
+ }
+
+ title.hide();
+ },
+
+ _set_navigation = function() {
+ if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
+ $(document).bind('keydown.fb', function(e) {
+ if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
+ e.preventDefault();
+ $.fancybox.close();
+
+ } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
+ e.preventDefault();
+ $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
+ }
+ });
+ }
+
+ if (!currentOpts.showNavArrows) {
+ nav_left.hide();
+ nav_right.hide();
+ return;
+ }
+
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
+ nav_left.show();
+ }
+
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
+ nav_right.show();
+ }
+ },
+
+ _finish = function () {
+ if (!$.support.opacity) {
+ content.get(0).style.removeAttribute('filter');
+ wrap.get(0).style.removeAttribute('filter');
+ }
+
+ if (selectedOpts.autoDimensions) {
+ content.css('height', 'auto');
+ }
+
+ wrap.css('height', 'auto');
+
+ if (titleStr && titleStr.length) {
+ title.show();
+ }
+
+ if (currentOpts.showCloseButton) {
+ close.show();
+ }
+
+ _set_navigation();
+
+ if (currentOpts.hideOnContentClick) {
+ content.bind('click', $.fancybox.close);
+ }
+
+ if (currentOpts.hideOnOverlayClick) {
+ overlay.bind('click', $.fancybox.close);
+ }
+
+ $(window).bind("resize.fb", $.fancybox.resize);
+
+ if (currentOpts.centerOnScroll) {
+ $(window).bind("scroll.fb", $.fancybox.center);
+ }
+
+ if (currentOpts.type == 'iframe') {
+ $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
+ }
+
+ wrap.show();
+
+ busy = false;
+
+ $.fancybox.center();
+
+ currentOpts.onComplete(currentArray, currentIndex, currentOpts);
+
+ _preload_images();
+ },
+
+ _preload_images = function() {
+ var href,
+ objNext;
+
+ if ((currentArray.length -1) > currentIndex) {
+ href = currentArray[ currentIndex + 1 ].href;
+
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
+ objNext = new Image();
+ objNext.src = href;
+ }
+ }
+
+ if (currentIndex > 0) {
+ href = currentArray[ currentIndex - 1 ].href;
+
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
+ objNext = new Image();
+ objNext.src = href;
+ }
+ }
+ },
+
+ _draw = function(pos) {
+ var dim = {
+ width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
+ height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
+
+ top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
+ left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
+ };
+
+ if (typeof final_pos.opacity !== 'undefined') {
+ dim.opacity = pos < 0.5 ? 0.5 : pos;
+ }
+
+ wrap.css(dim);
+
+ content.css({
+ 'width' : dim.width - currentOpts.padding * 2,
+ 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
+ });
+ },
+
+ _get_viewport = function() {
+ return [
+ $(window).width() - (currentOpts.margin * 2),
+ $(window).height() - (currentOpts.margin * 2),
+ $(document).scrollLeft() + currentOpts.margin,
+ $(document).scrollTop() + currentOpts.margin
+ ];
+ },
+
+ _get_zoom_to = function () {
+ var view = _get_viewport(),
+ to = {},
+ resize = currentOpts.autoScale,
+ double_padding = currentOpts.padding * 2,
+ ratio;
+
+ if (currentOpts.width.toString().indexOf('%') > -1) {
+ to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
+ } else {
+ to.width = currentOpts.width + double_padding;
+ }
+
+ if (currentOpts.height.toString().indexOf('%') > -1) {
+ to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
+ } else {
+ to.height = currentOpts.height + double_padding;
+ }
+
+ if (resize && (to.width > view[0] || to.height > view[1])) {
+ if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
+ ratio = (currentOpts.width ) / (currentOpts.height );
+
+ if ((to.width ) > view[0]) {
+ to.width = view[0];
+ to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
+ }
+
+ if ((to.height) > view[1]) {
+ to.height = view[1];
+ to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
+ }
+
+ } else {
+ to.width = Math.min(to.width, view[0]);
+ to.height = Math.min(to.height, view[1]);
+ }
+ }
+
+ to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
+ to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
+
+ return to;
+ },
+
+ _get_obj_pos = function(obj) {
+ var pos = obj.offset();
+
+ pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
+ pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
+
+ pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
+ pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
+
+ pos.width = obj.width();
+ pos.height = obj.height();
+
+ return pos;
+ },
+
+ _get_zoom_from = function() {
+ var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
+ from = {},
+ pos,
+ view;
+
+ if (orig && orig.length) {
+ pos = _get_obj_pos(orig);
+
+ from = {
+ width : pos.width + (currentOpts.padding * 2),
+ height : pos.height + (currentOpts.padding * 2),
+ top : pos.top - currentOpts.padding - 20,
+ left : pos.left - currentOpts.padding - 20
+ };
+
+ } else {
+ view = _get_viewport();
+
+ from = {
+ width : currentOpts.padding * 2,
+ height : currentOpts.padding * 2,
+ top : parseInt(view[3] + view[1] * 0.5, 10),
+ left : parseInt(view[2] + view[0] * 0.5, 10)
+ };
+ }
+
+ return from;
+ },
+
+ _animate_loading = function() {
+ if (!loading.is(':visible')){
+ clearInterval(loadingTimer);
+ return;
+ }
+
+ $('div', loading).css('top', (loadingFrame * -40) + 'px');
+
+ loadingFrame = (loadingFrame + 1) % 12;
+ };
+
+ /*
+ * Public methods
+ */
+
+ $.fn.fancybox = function(options) {
+ if (!$(this).length) {
+ return this;
+ }
+
+ $(this)
+ .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
+ .unbind('click.fb')
+ .bind('click.fb', function(e) {
+ e.preventDefault();
+
+ if (busy) {
+ return;
+ }
+
+ busy = true;
+
+ $(this).blur();
+
+ selectedArray = [];
+ selectedIndex = 0;
+
+ var rel = $(this).attr('rel') || '';
+
+ if (!rel || rel == '' || rel === 'nofollow') {
+ selectedArray.push(this);
+
+ } else {
+ selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
+ selectedIndex = selectedArray.index( this );
+ }
+
+ _start();
+
+ return;
+ });
+
+ return this;
+ };
+
+ $.fancybox = function(obj) {
+ var opts;
+
+ if (busy) {
+ return;
+ }
+
+ busy = true;
+ opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
+
+ selectedArray = [];
+ selectedIndex = parseInt(opts.index, 10) || 0;
+
+ if ($.isArray(obj)) {
+ for (var i = 0, j = obj.length; i < j; i++) {
+ if (typeof obj[i] == 'object') {
+ $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
+ } else {
+ obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
+ }
+ }
+
+ selectedArray = jQuery.merge(selectedArray, obj);
+
+ } else {
+ if (typeof obj == 'object') {
+ $(obj).data('fancybox', $.extend({}, opts, obj));
+ } else {
+ obj = $({}).data('fancybox', $.extend({content : obj}, opts));
+ }
+
+ selectedArray.push(obj);
+ }
+
+ if (selectedIndex > selectedArray.length || selectedIndex < 0) {
+ selectedIndex = 0;
+ }
+
+ _start();
+ };
+
+ $.fancybox.showActivity = function() {
+ clearInterval(loadingTimer);
+
+ loading.show();
+ loadingTimer = setInterval(_animate_loading, 66);
+ };
+
+ $.fancybox.hideActivity = function() {
+ loading.hide();
+ };
+
+ $.fancybox.next = function() {
+ return $.fancybox.pos( currentIndex + 1);
+ };
+
+ $.fancybox.prev = function() {
+ return $.fancybox.pos( currentIndex - 1);
+ };
+
+ $.fancybox.pos = function(pos) {
+ if (busy) {
+ return;
+ }
+
+ pos = parseInt(pos);
+
+ selectedArray = currentArray;
+
+ if (pos > -1 && pos < currentArray.length) {
+ selectedIndex = pos;
+ _start();
+
+ } else if (currentOpts.cyclic && currentArray.length > 1) {
+ selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
+ _start();
+ }
+
+ return;
+ };
+
+ $.fancybox.cancel = function() {
+ if (busy) {
+ return;
+ }
+
+ busy = true;
+
+ $.event.trigger('fancybox-cancel');
+
+ _abort();
+
+ selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
+
+ busy = false;
+ };
+
+ // Note: within an iframe use - parent.$.fancybox.close();
+ $.fancybox.close = function() {
+ if (busy || wrap.is(':hidden')) {
+ return;
+ }
+
+ busy = true;
+
+ if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
+ busy = false;
+ return;
+ }
+
+ _abort();
+
+ $(close.add( nav_left ).add( nav_right )).hide();
+
+ $(content.add( overlay )).unbind();
+
+ $(window).unbind("resize.fb scroll.fb");
+ $(document).unbind('keydown.fb');
+
+ content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
+
+ if (currentOpts.titlePosition !== 'inside') {
+ title.empty();
+ }
+
+ wrap.stop();
+
+ function _cleanup() {
+ overlay.fadeOut('fast');
+
+ title.empty().hide();
+ wrap.hide();
+
+ $.event.trigger('fancybox-cleanup');
+
+ content.empty();
+
+ currentOpts.onClosed(currentArray, currentIndex, currentOpts);
+
+ currentArray = selectedOpts = [];
+ currentIndex = selectedIndex = 0;
+ currentOpts = selectedOpts = {};
+
+ busy = false;
+ }
+
+ if (currentOpts.transitionOut == 'elastic') {
+ start_pos = _get_zoom_from();
+
+ var pos = wrap.position();
+
+ final_pos = {
+ top : pos.top ,
+ left : pos.left,
+ width : wrap.width(),
+ height : wrap.height()
+ };
+
+ if (currentOpts.opacity) {
+ final_pos.opacity = 1;
+ }
+
+ title.empty().hide();
+
+ fx.prop = 1;
+
+ $(fx).animate({ prop: 0 }, {
+ duration : currentOpts.speedOut,
+ easing : currentOpts.easingOut,
+ step : _draw,
+ complete : _cleanup
+ });
+
+ } else {
+ wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
+ }
+ };
+
+ $.fancybox.resize = function() {
+ if (overlay.is(':visible')) {
+ overlay.css('height', $(document).height());
+ }
+
+ $.fancybox.center(true);
+ };
+
+ $.fancybox.center = function() {
+ var view, align;
+
+ if (busy) {
+ return;
+ }
+
+ align = arguments[0] === true ? 1 : 0;
+ view = _get_viewport();
+
+ if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
+ return;
+ }
+
+ wrap
+ .stop()
+ .animate({
+ 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
+ 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
+ }, typeof arguments[0] == 'number' ? arguments[0] : 200);
+ };
+
+ $.fancybox.init = function() {
+ if ($("#fancybox-wrap").length) {
+ return;
+ }
+
+ $('body').append(
+ tmp = $('<div id="fancybox-tmp"></div>'),
+ loading = $('<div id="fancybox-loading"><div></div></div>'),
+ overlay = $('<div id="fancybox-overlay"></div>'),
+ wrap = $('<div id="fancybox-wrap"></div>')
+ );
+
+ outer = $('<div id="fancybox-outer"></div>')
+ .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
+ .appendTo( wrap );
+
+ outer.append(
+ content = $('<div id="fancybox-content"></div>'),
+ close = $('<a id="fancybox-close"></a>'),
+ title = $('<div id="fancybox-title"></div>'),
+
+ nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
+ nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
+ );
+
+ close.click($.fancybox.close);
+ loading.click($.fancybox.cancel);
+
+ nav_left.click(function(e) {
+ e.preventDefault();
+ $.fancybox.prev();
+ });
+
+ nav_right.click(function(e) {
+ e.preventDefault();
+ $.fancybox.next();
+ });
+
+ if ($.fn.mousewheel) {
+ wrap.bind('mousewheel.fb', function(e, delta) {
+ if (busy) {
+ e.preventDefault();
+
+ } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
+ e.preventDefault();
+ $.fancybox[ delta > 0 ? 'prev' : 'next']();
+ }
+ });
+ }
+
+ if (!$.support.opacity) {
+ wrap.addClass('fancybox-ie');
+ }
+
+ if (isIE6) {
+ loading.addClass('fancybox-ie6');
+ wrap.addClass('fancybox-ie6');
+
+ $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
+ }
+ };
+
+ $.fn.fancybox.defaults = {
+ padding : 10,
+ margin : 40,
+ opacity : false,
+ modal : false,
+ cyclic : false,
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
+
+ width : 560,
+ height : 340,
+
+ autoScale : true,
+ autoDimensions : true,
+ centerOnScroll : false,
+
+ ajax : {},
+ swf : { wmode: 'transparent' },
+
+ hideOnOverlayClick : true,
+ hideOnContentClick : false,
+
+ overlayShow : true,
+ overlayOpacity : 0.7,
+ overlayColor : '#777',
+
+ titleShow : true,
+ titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
+ titleFormat : null,
+ titleFromAlt : false,
+
+ transitionIn : 'fade', // 'elastic', 'fade' or 'none'
+ transitionOut : 'fade', // 'elastic', 'fade' or 'none'
+
+ speedIn : 300,
+ speedOut : 300,
+
+ changeSpeed : 300,
+ changeFade : 'fast',
+
+ easingIn : 'swing',
+ easingOut : 'swing',
+
+ showCloseButton : true,
+ showNavArrows : true,
+ enableEscapeButton : true,
+ enableKeyboardNav : true,
+
+ onStart : function(){},
+ onCancel : function(){},
+ onComplete : function(){},
+ onCleanup : function(){},
+ onClosed : function(){},
+ onError : function(){}
+ };
+
+ $(document).ready(function() {
+ $.fancybox.init();
+ });
+
+})(jQuery); \ No newline at end of file
diff --git a/src/pootle_it/html/js/jquery/jquery.fieldselection.js b/src/pootle_it/html/js/jquery/jquery.fieldselection.js
new file mode 100644
index 0000000..47f25a9
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.fieldselection.js
@@ -0,0 +1,83 @@
+/*
+ * jQuery plugin: fieldSelection - v0.1.0 - last change: 2006-12-16
+ * (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
+ */
+
+(function() {
+
+ var fieldSelection = {
+
+ getSelection: function() {
+
+ var e = this.jquery ? this[0] : this;
+
+ return (
+
+ /* mozilla / dom 3.0 */
+ ('selectionStart' in e && function() {
+ var l = e.selectionEnd - e.selectionStart;
+ return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
+ }) ||
+
+ /* exploder */
+ (document.selection && function() {
+
+ e.focus();
+
+ var r = document.selection.createRange();
+ if (r == null) {
+ return { start: 0, end: e.value.length, length: 0 }
+ }
+
+ var re = e.createTextRange();
+ var rc = re.duplicate();
+ re.moveToBookmark(r.getBookmark());
+ rc.setEndPoint('EndToStart', re);
+
+ return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text };
+ }) ||
+
+ /* browser not supported */
+ function() {
+ return { start: 0, end: e.value.length, length: 0 };
+ }
+
+ )();
+
+ },
+
+ replaceSelection: function() {
+
+ var e = this.jquery ? this[0] : this;
+ var text = arguments[0] || '';
+
+ return (
+
+ /* mozilla / dom 3.0 */
+ ('selectionStart' in e && function() {
+ e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
+ return this;
+ }) ||
+
+ /* exploder */
+ (document.selection && function() {
+ e.focus();
+ document.selection.createRange().text = text;
+ return this;
+ }) ||
+
+ /* browser not supported */
+ function() {
+ e.value += text;
+ return this;
+ }
+
+ )();
+
+ }
+
+ };
+
+ jQuery.each(fieldSelection, function(i) { jQuery.fn[i] = this; });
+
+})();
diff --git a/src/pootle_it/html/js/jquery/jquery.highlightRegex.js b/src/pootle_it/html/js/jquery/jquery.highlightRegex.js
new file mode 100644
index 0000000..b48f0a2
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.highlightRegex.js
@@ -0,0 +1,46 @@
+/*
+* jQuery Highlight Regex Plugin
+*
+* Based on highlight v3 by Johann Burkard
+* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
+*
+* (c) 2009 Jacob Rothstein
+* MIT license
+*/
+(function($){
+ $.fn.highlightRegex = function(regex) {
+ if(regex == undefined || regex.source == '') {
+ $(this).find('span.highlight').each(function(){
+ $(this).replaceWith($(this).text());
+ $(this).parent().each(function(){
+ node = $(this).get(0);
+ if(node.normalize) node.normalize();
+ });
+ });
+ } else {
+ $(this).each(function(){
+ elt = $(this).get(0)
+ elt.normalize();
+ $.each($.makeArray(elt.childNodes), function(i, node){
+ if(node.nodeType == 3) {
+ var searchnode = node
+ while((pos = searchnode.data.search(regex)) >= 0) {
+ match = searchnode.data.slice(pos).match(regex)[0];
+ if(match.length == 0) break;
+ var spannode = document.createElement('span');
+ spannode.className = 'highlight';
+ var middlebit = searchnode.splitText(pos);
+ var searchnode = middlebit.splitText(match.length);
+ var middleclone = middlebit.cloneNode(true);
+ spannode.appendChild(middleclone);
+ searchnode.parentNode.replaceChild(spannode, middlebit);
+ }
+ } else {
+ $(node).highlightRegex(regex);
+ }
+ })
+ })
+ }
+ return $(this);
+ }
+})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.history.js b/src/pootle_it/html/js/jquery/jquery.history.js
new file mode 100644
index 0000000..18e1c41
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.history.js
@@ -0,0 +1,198 @@
+/*
+ * jQuery history plugin
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2006-2009 Taku Sano (Mikage Sawatari)
+ * Copyright (c) 2010 Takayuki Miwa
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+(function($) {
+ var locationWrapper = {
+ put: function(hash, win) {
+ (win || window).location.hash = this.encoder(hash);
+ },
+ get: function(win) {
+ // *******************************************
+ // Patched by Igor Afanasyev
+ // *******************************************
+ // Mozilla has a bug when it automatically unescapes %26 to '&'
+ // when getting hash from `window.location.hash'.
+ // So, we have to extract it from the `window.location'.
+ // Also, we don't need to decodeURIComponent() the hash
+ // as it will break encoded ampersand again
+ // (decoding can be done on the higher level, if needed)
+ return (win || window).location.toString().split('#', 2)[1] || '';
+ // *******************************************
+ },
+ encoder: encodeURIComponent
+ };
+
+ var iframeWrapper = {
+ id: "__jQuery_history",
+ init: function() {
+ var html = '<iframe id="'+ this.id +'" style="display:none" src="javascript:false;" />';
+ $("body").prepend(html);
+ return this;
+ },
+ _document: function() {
+ return $("#"+ this.id)[0].contentWindow.document;
+ },
+ put: function(hash) {
+ var doc = this._document();
+ doc.open();
+ doc.close();
+ locationWrapper.put(hash, doc);
+ },
+ get: function() {
+ return locationWrapper.get(this._document());
+ }
+ };
+
+ function initObjects(options) {
+ options = $.extend({
+ unescape: false
+ }, options || {});
+
+ locationWrapper.encoder = encoder(options.unescape);
+
+ function encoder(unescape_) {
+ if(unescape_ === true) {
+ return function(hash){ return hash; };
+ }
+ if(typeof unescape_ == "string" &&
+ (unescape_ = partialDecoder(unescape_.split("")))
+ || typeof unescape_ == "function") {
+ return function(hash) { return unescape_(encodeURIComponent(hash)); };
+ }
+ return encodeURIComponent;
+ }
+
+ function partialDecoder(chars) {
+ var re = new RegExp($.map(chars, encodeURIComponent).join("|"), "ig");
+ return function(enc) { return enc.replace(re, decodeURIComponent); };
+ }
+ }
+
+ var implementations = {};
+
+ implementations.base = {
+ callback: undefined,
+ type: undefined,
+
+ check: function() {},
+ load: function(hash) {},
+ init: function(callback, options) {
+ initObjects(options);
+ self.callback = callback;
+ self._options = options;
+ self._init();
+ },
+
+ _init: function() {},
+ _options: {}
+ };
+
+ implementations.timer = {
+ _appState: undefined,
+ _init: function() {
+ var current_hash = locationWrapper.get();
+ self._appState = current_hash;
+ self.callback(current_hash);
+ setInterval(self.check, 100);
+ },
+ check: function() {
+ var current_hash = locationWrapper.get();
+ if(current_hash != self._appState) {
+ self._appState = current_hash;
+ self.callback(current_hash);
+ }
+ },
+ load: function(hash) {
+ if(hash != self._appState) {
+ locationWrapper.put(hash);
+ self._appState = hash;
+ self.callback(hash);
+ }
+ }
+ };
+
+ implementations.iframeTimer = {
+ _appState: undefined,
+ _init: function() {
+ var current_hash = locationWrapper.get();
+ self._appState = current_hash;
+ iframeWrapper.init().put(current_hash);
+ self.callback(current_hash);
+ setInterval(self.check, 100);
+ },
+ check: function() {
+ var iframe_hash = iframeWrapper.get(),
+ location_hash = locationWrapper.get();
+
+ if (location_hash != iframe_hash) {
+ if (location_hash == self._appState) { // user used Back or Forward button
+ self._appState = iframe_hash;
+ locationWrapper.put(iframe_hash);
+ self.callback(iframe_hash);
+ } else { // user loaded new bookmark
+ self._appState = location_hash;
+ iframeWrapper.put(location_hash);
+ self.callback(location_hash);
+ }
+ }
+ },
+ load: function(hash) {
+ if(hash != self._appState) {
+ locationWrapper.put(hash);
+ iframeWrapper.put(hash);
+ self._appState = hash;
+ self.callback(hash);
+ }
+ }
+ };
+
+ implementations.hashchangeEvent = {
+ _init: function() {
+ self.callback(locationWrapper.get());
+ $(window).bind('hashchange', self.check);
+ },
+ check: function() {
+ self.callback(locationWrapper.get());
+ },
+ load: function(hash) {
+ locationWrapper.put(hash);
+ }
+ };
+
+ var self = $.extend({}, implementations.base);
+
+ if($.browser.msie && ($.browser.version < 8 || document.documentMode < 8)) {
+ self.type = 'iframeTimer';
+ } else if("onhashchange" in window) {
+ self.type = 'hashchangeEvent';
+ } else {
+ self.type = 'timer';
+ }
+
+ $.extend(self, implementations[self.type]);
+ $.history = self;
+})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.js b/src/pootle_it/html/js/jquery/jquery.js
new file mode 100644
index 0000000..a4f1145
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.js
@@ -0,0 +1,7179 @@
+/*!
+ * jQuery JavaScript Library v1.4.4
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Nov 11 19:04:53 2010 -0500
+ */
+(function( window, undefined ) {
+
+// Use the correct document accordingly with window argument (sandbox)
+var document = window.document;
+var jQuery = (function() {
+
+// Define a local copy of jQuery
+var jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // A simple way to check for HTML strings or ID strings
+ // (both of which we optimize for)
+ quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,
+
+ // Is it a simple selector
+ isSimple = /^.[^:#\[\.,]*$/,
+
+ // Check if a string has a non-whitespace character in it
+ rnotwhite = /\S/,
+ rwhite = /\s/,
+
+ // Used for trimming whitespace
+ trimLeft = /^\s+/,
+ trimRight = /\s+$/,
+
+ // Check for non-word characters
+ rnonword = /\W/,
+
+ // Check for digits
+ rdigit = /\d/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+
+ // Useragent RegExp
+ rwebkit = /(webkit)[ \/]([\w.]+)/,
+ ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
+ rmsie = /(msie) ([\w.]+)/,
+ rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+
+ // Keep a UserAgent string for use with jQuery.browser
+ userAgent = navigator.userAgent,
+
+ // For matching the engine and version of the browser
+ browserMatch,
+
+ // Has the ready events already been bound?
+ readyBound = false,
+
+ // The functions to execute on DOM ready
+ readyList = [],
+
+ // The ready event handler
+ DOMContentLoaded,
+
+ // Save a reference to some core methods
+ toString = Object.prototype.toString,
+ hasOwn = Object.prototype.hasOwnProperty,
+ push = Array.prototype.push,
+ slice = Array.prototype.slice,
+ trim = String.prototype.trim,
+ indexOf = Array.prototype.indexOf,
+
+ // [[Class]] -> type pairs
+ class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+ init: function( selector, context ) {
+ var match, elem, ret, doc;
+
+ // Handle $(""), $(null), or $(undefined)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle $(DOMElement)
+ if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+ }
+
+ // The body element only exists once, optimize finding it
+ if ( selector === "body" && !context && document.body ) {
+ this.context = document;
+ this[0] = document.body;
+ this.selector = "body";
+ this.length = 1;
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ // Are we dealing with HTML string or an ID?
+ match = quickExpr.exec( selector );
+
+ // Verify a match, and that no context was specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ doc = (context ? context.ownerDocument || context : document);
+
+ // If a single string is passed in and it's a single tag
+ // just do a createElement and skip the rest
+ ret = rsingleTag.exec( selector );
+
+ if ( ret ) {
+ if ( jQuery.isPlainObject( context ) ) {
+ selector = [ document.createElement( ret[1] ) ];
+ jQuery.fn.attr.call( selector, context, true );
+
+ } else {
+ selector = [ doc.createElement( ret[1] ) ];
+ }
+
+ } else {
+ ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
+ selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes;
+ }
+
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $("#id")
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $("TAG")
+ } else if ( !context && !rnonword.test( selector ) ) {
+ this.selector = selector;
+ this.context = document;
+ selector = document.getElementsByTagName( selector );
+ return jQuery.merge( this, selector );
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return (context || rootjQuery).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return jQuery( context ).find( selector );
+ }
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if (selector.selector !== undefined) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The current version of jQuery being used
+ jquery: "1.4.4",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return slice.call( this, 0 );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems, name, selector ) {
+ // Build a new jQuery matched element set
+ var ret = jQuery();
+
+ if ( jQuery.isArray( elems ) ) {
+ push.apply( ret, elems );
+
+ } else {
+ jQuery.merge( ret, elems );
+ }
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ ret.context = this.context;
+
+ if ( name === "find" ) {
+ ret.selector = this.selector + (this.selector ? " " : "") + selector;
+ } else if ( name ) {
+ ret.selector = this.selector + "." + name + "(" + selector + ")";
+ }
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Attach the listeners
+ jQuery.bindReady();
+
+ // If the DOM is already ready
+ if ( jQuery.isReady ) {
+ // Execute the function immediately
+ fn.call( document, jQuery );
+
+ // Otherwise, remember the function for later
+ } else if ( readyList ) {
+ // Add the function to the wait list
+ readyList.push( fn );
+ }
+
+ return this;
+ },
+
+ eq: function( i ) {
+ return i === -1 ?
+ this.slice( i ) :
+ this.slice( i, +i + 1 );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ),
+ "slice", slice.call(arguments).join(",") );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || jQuery(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ window.$ = _$;
+
+ if ( deep ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+ // A third-party is pushing the ready event forwards
+ if ( wait === true ) {
+ jQuery.readyWait--;
+ }
+
+ // Make sure that the DOM is not already loaded
+ if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ if ( readyList ) {
+ // Execute all of them
+ var fn,
+ i = 0,
+ ready = readyList;
+
+ // Reset the list of functions
+ readyList = null;
+
+ while ( (fn = ready[ i++ ]) ) {
+ fn.call( document, jQuery );
+ }
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger( "ready" ).unbind( "ready" );
+ }
+ }
+ }
+ },
+
+ bindReady: function() {
+ if ( readyBound ) {
+ return;
+ }
+
+ readyBound = true;
+
+ // Catch cases where $(document).ready() is called after the
+ // browser event has already occurred.
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ return setTimeout( jQuery.ready, 1 );
+ }
+
+ // Mozilla, Opera and webkit nightlies currently support this event
+ if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", jQuery.ready, false );
+
+ // If IE event model is used
+ } else if ( document.attachEvent ) {
+ // ensure firing before onload,
+ // maybe late but safe also for iframes
+ document.attachEvent("onreadystatechange", DOMContentLoaded);
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", jQuery.ready );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var toplevel = false;
+
+ try {
+ toplevel = window.frameElement == null;
+ } catch(e) {}
+
+ if ( document.documentElement.doScroll && toplevel ) {
+ doScrollCheck();
+ }
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ // A crude way of determining if an object is a window
+ isWindow: function( obj ) {
+ return obj && typeof obj === "object" && "setInterval" in obj;
+ },
+
+ isNaN: function( obj ) {
+ return obj == null || !rdigit.test( obj ) || isNaN( obj );
+ },
+
+ type: function( obj ) {
+ return obj == null ?
+ String( obj ) :
+ class2type[ toString.call(obj) ] || "object";
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ for ( var name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw msg;
+ },
+
+ parseJSON: function( data ) {
+ if ( typeof data !== "string" || !data ) {
+ return null;
+ }
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test(data.replace(rvalidescape, "@")
+ .replace(rvalidtokens, "]")
+ .replace(rvalidbraces, "")) ) {
+
+ // Try to use the native JSON parser first
+ return window.JSON && window.JSON.parse ?
+ window.JSON.parse( data ) :
+ (new Function("return " + data))();
+
+ } else {
+ jQuery.error( "Invalid JSON: " + data );
+ }
+ },
+
+ noop: function() {},
+
+ // Evalulates a script in a global context
+ globalEval: function( data ) {
+ if ( data && rnotwhite.test(data) ) {
+ // Inspired by code by Andrea Giammarchi
+ // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
+ var head = document.getElementsByTagName("head")[0] || document.documentElement,
+ script = document.createElement("script");
+
+ script.type = "text/javascript";
+
+ if ( jQuery.support.scriptEval ) {
+ script.appendChild( document.createTextNode( data ) );
+ } else {
+ script.text = data;
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709).
+ head.insertBefore( script, head.firstChild );
+ head.removeChild( script );
+ }
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+ },
+
+ // args is for internal usage only
+ each: function( object, callback, args ) {
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction(object);
+
+ if ( args ) {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.apply( object[ name ], args ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( ; i < length; ) {
+ if ( callback.apply( object[ i++ ], args ) === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isObj ) {
+ for ( name in object ) {
+ if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( var value = object[0];
+ i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
+ }
+ }
+
+ return object;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: trim ?
+ function( text ) {
+ return text == null ?
+ "" :
+ trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( array, results ) {
+ var ret = results || [];
+
+ if ( array != null ) {
+ // The window, strings (and functions) also have 'length'
+ // The extra typeof function check is to prevent crashes
+ // in Safari 2 (See: #3039)
+ // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+ var type = jQuery.type(array);
+
+ if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
+ push.call( ret, array );
+ } else {
+ jQuery.merge( ret, array );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, array ) {
+ if ( array.indexOf ) {
+ return array.indexOf( elem );
+ }
+
+ for ( var i = 0, length = array.length; i < length; i++ ) {
+ if ( array[ i ] === elem ) {
+ return i;
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var i = first.length,
+ j = 0;
+
+ if ( typeof second.length === "number" ) {
+ for ( var l = second.length; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var ret = [], retVal;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var ret = [], value;
+
+ // Go through the array, translating each of the items to their
+ // new value (or values).
+ for ( var i = 0, length = elems.length; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ return ret.concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ proxy: function( fn, proxy, thisObject ) {
+ if ( arguments.length === 2 ) {
+ if ( typeof proxy === "string" ) {
+ thisObject = fn;
+ fn = thisObject[ proxy ];
+ proxy = undefined;
+
+ } else if ( proxy && !jQuery.isFunction( proxy ) ) {
+ thisObject = proxy;
+ proxy = undefined;
+ }
+ }
+
+ if ( !proxy && fn ) {
+ proxy = function() {
+ return fn.apply( thisObject || this, arguments );
+ };
+ }
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ if ( fn ) {
+ proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+ }
+
+ // So proxy can be declared as an argument
+ return proxy;
+ },
+
+ // Mutifunctional method to get and set values to a collection
+ // The value/s can be optionally by executed if its a function
+ access: function( elems, key, value, exec, fn, pass ) {
+ var length = elems.length;
+
+ // Setting many attributes
+ if ( typeof key === "object" ) {
+ for ( var k in key ) {
+ jQuery.access( elems, k, key[k], exec, fn, value );
+ }
+ return elems;
+ }
+
+ // Setting one attribute
+ if ( value !== undefined ) {
+ // Optionally, function values get executed if exec is true
+ exec = !pass && exec && jQuery.isFunction(value);
+
+ for ( var i = 0; i < length; i++ ) {
+ fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+ }
+
+ return elems;
+ }
+
+ // Getting an attribute
+ return length ? fn( elems[0], key ) : undefined;
+ },
+
+ now: function() {
+ return (new Date()).getTime();
+ },
+
+ // Use of jQuery.browser is frowned upon.
+ // More details: http://docs.jquery.com/Utilities/jQuery.browser
+ uaMatch: function( ua ) {
+ ua = ua.toLowerCase();
+
+ var match = rwebkit.exec( ua ) ||
+ ropera.exec( ua ) ||
+ rmsie.exec( ua ) ||
+ ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
+ [];
+
+ return { browser: match[1] || "", version: match[2] || "0" };
+ },
+
+ browser: {}
+});
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+browserMatch = jQuery.uaMatch( userAgent );
+if ( browserMatch.browser ) {
+ jQuery.browser[ browserMatch.browser ] = true;
+ jQuery.browser.version = browserMatch.version;
+}
+
+// Deprecated, use jQuery.browser.webkit instead
+if ( jQuery.browser.webkit ) {
+ jQuery.browser.safari = true;
+}
+
+if ( indexOf ) {
+ jQuery.inArray = function( elem, array ) {
+ return indexOf.call( array, elem );
+ };
+}
+
+// Verify that \s matches non-breaking spaces
+// (IE fails on this test)
+if ( !rwhite.test( "\xA0" ) ) {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+
+// Cleanup functions for the document ready method
+if ( document.addEventListener ) {
+ DOMContentLoaded = function() {
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
+ };
+
+} else if ( document.attachEvent ) {
+ DOMContentLoaded = function() {
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( document.readyState === "complete" ) {
+ document.detachEvent( "onreadystatechange", DOMContentLoaded );
+ jQuery.ready();
+ }
+ };
+}
+
+// The DOM ready check for Internet Explorer
+function doScrollCheck() {
+ if ( jQuery.isReady ) {
+ return;
+ }
+
+ try {
+ // If IE is used, use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ document.documentElement.doScroll("left");
+ } catch(e) {
+ setTimeout( doScrollCheck, 1 );
+ return;
+ }
+
+ // and execute any waiting functions
+ jQuery.ready();
+}
+
+// Expose jQuery to the global object
+return (window.jQuery = window.$ = jQuery);
+
+})();
+
+
+(function() {
+
+ jQuery.support = {};
+
+ var root = document.documentElement,
+ script = document.createElement("script"),
+ div = document.createElement("div"),
+ id = "script" + jQuery.now();
+
+ div.style.display = "none";
+ div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
+ var all = div.getElementsByTagName("*"),
+ a = div.getElementsByTagName("a")[0],
+ select = document.createElement("select"),
+ opt = select.appendChild( document.createElement("option") );
+
+ // Can't get basic test support
+ if ( !all || !all.length || !a ) {
+ return;
+ }
+
+ jQuery.support = {
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText insted)
+ style: /red/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.55$/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Make sure that if no value is specified for a checkbox
+ // that it defaults to "on".
+ // (WebKit defaults to "" instead)
+ checkOn: div.getElementsByTagName("input")[0].value === "on",
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Will be defined later
+ deleteExpando: true,
+ optDisabled: false,
+ checkClone: false,
+ scriptEval: false,
+ noCloneEvent: true,
+ boxModel: null,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableHiddenOffsets: true
+ };
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as diabled)
+ select.disabled = true;
+ jQuery.support.optDisabled = !opt.disabled;
+
+ script.type = "text/javascript";
+ try {
+ script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
+ } catch(e) {}
+
+ root.insertBefore( script, root.firstChild );
+
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
+ if ( window[ id ] ) {
+ jQuery.support.scriptEval = true;
+ delete window[ id ];
+ }
+
+ // Test to see if it's possible to delete an expando from an element
+ // Fails in Internet Explorer
+ try {
+ delete script.test;
+
+ } catch(e) {
+ jQuery.support.deleteExpando = false;
+ }
+
+ root.removeChild( script );
+
+ if ( div.attachEvent && div.fireEvent ) {
+ div.attachEvent("onclick", function click() {
+ // Cloning a node shouldn't copy over any
+ // bound event handlers (IE does this)
+ jQuery.support.noCloneEvent = false;
+ div.detachEvent("onclick", click);
+ });
+ div.cloneNode(true).fireEvent("onclick");
+ }
+
+ div = document.createElement("div");
+ div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
+
+ var fragment = document.createDocumentFragment();
+ fragment.appendChild( div.firstChild );
+
+ // WebKit doesn't clone checked state correctly in fragments
+ jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
+
+ // Figure out if the W3C box model works as expected
+ // document.body must exist before we can do this
+ jQuery(function() {
+ var div = document.createElement("div");
+ div.style.width = div.style.paddingLeft = "1px";
+
+ document.body.appendChild( div );
+ jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+
+ if ( "zoom" in div.style ) {
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ // (IE < 8 does this)
+ div.style.display = "inline";
+ div.style.zoom = 1;
+ jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2;
+
+ // Check if elements with layout shrink-wrap their children
+ // (IE 6 does this)
+ div.style.display = "";
+ div.innerHTML = "<div style='width:4px;'></div>";
+ jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2;
+ }
+
+ div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";
+ var tds = div.getElementsByTagName("td");
+
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ // (only IE 8 fails this test)
+ jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0;
+
+ tds[0].style.display = "";
+ tds[1].style.display = "none";
+
+ // Check if empty table cells still have offsetWidth/Height
+ // (IE < 8 fail this test)
+ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
+ div.innerHTML = "";
+
+ document.body.removeChild( div ).style.display = "none";
+ div = tds = null;
+ });
+
+ // Technique from Juriy Zaytsev
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
+
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
+
+ return isSupported;
+ };
+
+ jQuery.support.submitBubbles = eventSupported("submit");
+ jQuery.support.changeBubbles = eventSupported("change");
+
+ // release memory in IE
+ root = script = div = all = a = null;
+})();
+
+
+
+var windowData = {},
+ rbrace = /^(?:\{.*\}|\[.*\])$/;
+
+jQuery.extend({
+ cache: {},
+
+ // Please use with caution
+ uuid: 0,
+
+ // Unique for each copy of jQuery on the page
+ expando: "jQuery" + jQuery.now(),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ data: function( elem, name, data ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var isNode = elem.nodeType,
+ id = isNode ? elem[ jQuery.expando ] : null,
+ cache = jQuery.cache, thisCache;
+
+ if ( isNode && !id && typeof name === "string" && data === undefined ) {
+ return;
+ }
+
+ // Get the data from the object directly
+ if ( !isNode ) {
+ cache = elem;
+
+ // Compute a unique ID for the element
+ } else if ( !id ) {
+ elem[ jQuery.expando ] = id = ++jQuery.uuid;
+ }
+
+ // Avoid generating a new cache unless none exists and we
+ // want to manipulate it.
+ if ( typeof name === "object" ) {
+ if ( isNode ) {
+ cache[ id ] = jQuery.extend(cache[ id ], name);
+
+ } else {
+ jQuery.extend( cache, name );
+ }
+
+ } else if ( isNode && !cache[ id ] ) {
+ cache[ id ] = {};
+ }
+
+ thisCache = isNode ? cache[ id ] : cache;
+
+ // Prevent overriding the named cache with undefined values
+ if ( data !== undefined ) {
+ thisCache[ name ] = data;
+ }
+
+ return typeof name === "string" ? thisCache[ name ] : thisCache;
+ },
+
+ removeData: function( elem, name ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ elem = elem == window ?
+ windowData :
+ elem;
+
+ var isNode = elem.nodeType,
+ id = isNode ? elem[ jQuery.expando ] : elem,
+ cache = jQuery.cache,
+ thisCache = isNode ? cache[ id ] : id;
+
+ // If we want to remove a specific section of the element's data
+ if ( name ) {
+ if ( thisCache ) {
+ // Remove the section of cache data
+ delete thisCache[ name ];
+
+ // If we've removed all the data, remove the element's cache
+ if ( isNode && jQuery.isEmptyObject(thisCache) ) {
+ jQuery.removeData( elem );
+ }
+ }
+
+ // Otherwise, we want to remove all of the element's data
+ } else {
+ if ( isNode && jQuery.support.deleteExpando ) {
+ delete elem[ jQuery.expando ];
+
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+
+ // Completely remove the data cache
+ } else if ( isNode ) {
+ delete cache[ id ];
+
+ // Remove all fields from the object
+ } else {
+ for ( var n in elem ) {
+ delete elem[ n ];
+ }
+ }
+ }
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ if ( elem.nodeName ) {
+ var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ if ( match ) {
+ return !(match === true || elem.getAttribute("classid") !== match);
+ }
+ }
+
+ return true;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var data = null;
+
+ if ( typeof key === "undefined" ) {
+ if ( this.length ) {
+ var attr = this[0].attributes, name;
+ data = jQuery.data( this[0] );
+
+ for ( var i = 0, l = attr.length; i < l; i++ ) {
+ name = attr[i].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = name.substr( 5 );
+ dataAttr( this[0], name, data[ name ] );
+ }
+ }
+ }
+
+ return data;
+
+ } else if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ var parts = key.split(".");
+ parts[1] = parts[1] ? "." + parts[1] : "";
+
+ if ( value === undefined ) {
+ data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
+
+ // Try to fetch any internally stored data first
+ if ( data === undefined && this.length ) {
+ data = jQuery.data( this[0], key );
+ data = dataAttr( this[0], key, data );
+ }
+
+ return data === undefined && parts[1] ?
+ this.data( parts[0] ) :
+ data;
+
+ } else {
+ return this.each(function() {
+ var $this = jQuery( this ),
+ args = [ parts[0], value ];
+
+ $this.triggerHandler( "setData" + parts[1] + "!", args );
+ jQuery.data( this, key, value );
+ $this.triggerHandler( "changeData" + parts[1] + "!", args );
+ });
+ }
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+ data = elem.getAttribute( "data-" + key );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ !jQuery.isNaN( data ) ? parseFloat( data ) :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+
+
+
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ if ( !elem ) {
+ return;
+ }
+
+ type = (type || "fx") + "queue";
+ var q = jQuery.data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( !data ) {
+ return q || [];
+ }
+
+ if ( !q || jQuery.isArray(data) ) {
+ q = jQuery.data( elem, type, jQuery.makeArray(data) );
+
+ } else {
+ q.push( data );
+ }
+
+ return q;
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ fn = queue.shift();
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ }
+
+ if ( fn ) {
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift("inprogress");
+ }
+
+ fn.call(elem, function() {
+ jQuery.dequeue(elem, type);
+ });
+ }
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ }
+
+ if ( data === undefined ) {
+ return jQuery.queue( this[0], type );
+ }
+ return this.each(function( i ) {
+ var queue = jQuery.queue( this, type, data );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function() {
+ var elem = this;
+ setTimeout(function() {
+ jQuery.dequeue( elem, type );
+ }, time );
+ });
+ },
+
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ }
+});
+
+
+
+
+var rclass = /[\n\t]/g,
+ rspaces = /\s+/,
+ rreturn = /\r/g,
+ rspecialurl = /^(?:href|src|style)$/,
+ rtype = /^(?:button|input)$/i,
+ rfocusable = /^(?:button|input|object|select|textarea)$/i,
+ rclickable = /^a(?:rea)?$/i,
+ rradiocheck = /^(?:radio|checkbox)$/i;
+
+jQuery.props = {
+ "for": "htmlFor",
+ "class": "className",
+ readonly: "readOnly",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ tabindex: "tabIndex",
+ usemap: "useMap",
+ frameborder: "frameBorder"
+};
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, name, value, true, jQuery.attr );
+ },
+
+ removeAttr: function( name, fn ) {
+ return this.each(function(){
+ jQuery.attr( this, name, "" );
+ if ( this.nodeType === 1 ) {
+ this.removeAttribute( name );
+ }
+ });
+ },
+
+ addClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.addClass( value.call(this, i, self.attr("class")) );
+ });
+ }
+
+ if ( value && typeof value === "string" ) {
+ var classNames = (value || "").split( rspaces );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
+
+ if ( elem.nodeType === 1 ) {
+ if ( !elem.className ) {
+ elem.className = value;
+
+ } else {
+ var className = " " + elem.className + " ",
+ setClass = elem.className;
+
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
+ setClass += " " + classNames[c];
+ }
+ }
+ elem.className = jQuery.trim( setClass );
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.removeClass( value.call(this, i, self.attr("class")) );
+ });
+ }
+
+ if ( (value && typeof value === "string") || value === undefined ) {
+ var classNames = (value || "").split( rspaces );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ var elem = this[i];
+
+ if ( elem.nodeType === 1 && elem.className ) {
+ if ( value ) {
+ var className = (" " + elem.className + " ").replace(rclass, " ");
+ for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[c] + " ", " ");
+ }
+ elem.className = jQuery.trim( className );
+
+ } else {
+ elem.className = "";
+ }
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.split( rspaces );
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space seperated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ } else if ( type === "undefined" || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery.data( this, "__className__", this.className );
+ }
+
+ // toggle whole className
+ this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ";
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ if ( !arguments.length ) {
+ var elem = this[0];
+
+ if ( elem ) {
+ if ( jQuery.nodeName( elem, "option" ) ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+
+ // We need to handle select boxes special
+ if ( jQuery.nodeName( elem, "select" ) ) {
+ var index = elem.selectedIndex,
+ values = [],
+ options = elem.options,
+ one = elem.type === "select-one";
+
+ // Nothing was selected
+ if ( index < 0 ) {
+ return null;
+ }
+
+ // Loop through all the selected options
+ for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
+ var option = options[ i ];
+
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+
+ // Get the specific value for the option
+ value = jQuery(option).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ }
+
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) {
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+
+
+ // Everything else, we just grab the value
+ return (elem.value || "").replace(rreturn, "");
+
+ }
+
+ return undefined;
+ }
+
+ var isFunction = jQuery.isFunction(value);
+
+ return this.each(function(i) {
+ var self = jQuery(this), val = value;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call(this, i, self.val());
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray(val) ) {
+ val = jQuery.map(val, function (value) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) {
+ this.checked = jQuery.inArray( self.val(), val ) >= 0;
+
+ } else if ( jQuery.nodeName( this, "select" ) ) {
+ var values = jQuery.makeArray(val);
+
+ jQuery( "option", this ).each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ this.selectedIndex = -1;
+ }
+
+ } else {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ attrFn: {
+ val: true,
+ css: true,
+ html: true,
+ text: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
+ attr: function( elem, name, value, pass ) {
+ // don't set attributes on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ if ( pass && name in jQuery.attrFn ) {
+ return jQuery(elem)[name](value);
+ }
+
+ var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ),
+ // Whether we are setting (or getting)
+ set = value !== undefined;
+
+ // Try to normalize/fix the name
+ name = notxml && jQuery.props[ name ] || name;
+
+ // These attributes require special treatment
+ var special = rspecialurl.test( name );
+
+ // Safari mis-reports the default selected property of an option
+ // Accessing the parent's selectedIndex property fixes it
+ if ( name === "selected" && !jQuery.support.optSelected ) {
+ var parent = elem.parentNode;
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ }
+
+ // If applicable, access the attribute via the DOM 0 way
+ // 'in' checks fail in Blackberry 4.7 #6931
+ if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) {
+ if ( set ) {
+ // We can't allow the type property to be changed (since it causes problems in IE)
+ if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) {
+ jQuery.error( "type property can't be changed" );
+ }
+
+ if ( value === null ) {
+ if ( elem.nodeType === 1 ) {
+ elem.removeAttribute( name );
+ }
+
+ } else {
+ elem[ name ] = value;
+ }
+ }
+
+ // browsers index elements by id/name on forms, give priority to attributes.
+ if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) {
+ return elem.getAttributeNode( name ).nodeValue;
+ }
+
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ if ( name === "tabIndex" ) {
+ var attributeNode = elem.getAttributeNode( "tabIndex" );
+
+ return attributeNode && attributeNode.specified ?
+ attributeNode.value :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+
+ return elem[ name ];
+ }
+
+ if ( !jQuery.support.style && notxml && name === "style" ) {
+ if ( set ) {
+ elem.style.cssText = "" + value;
+ }
+
+ return elem.style.cssText;
+ }
+
+ if ( set ) {
+ // convert the value to a string (all browsers do this but IE) see #1070
+ elem.setAttribute( name, "" + value );
+ }
+
+ // Ensure that missing attributes return undefined
+ // Blackberry 4.7 returns "" from getAttribute #6938
+ if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) {
+ return undefined;
+ }
+
+ var attr = !jQuery.support.hrefNormalized && notxml && special ?
+ // Some attributes require a special call on IE
+ elem.getAttribute( name, 2 ) :
+ elem.getAttribute( name );
+
+ // Non-existent attributes return null, we normalize to undefined
+ return attr === null ? undefined : attr;
+ }
+});
+
+
+
+
+var rnamespaces = /\.(.*)$/,
+ rformElems = /^(?:textarea|input|select)$/i,
+ rperiod = /\./g,
+ rspace = / /g,
+ rescape = /[^\w\s.|`]/g,
+ fcleanup = function( nm ) {
+ return nm.replace(rescape, "\\$&");
+ },
+ focusCounts = { focusin: 0, focusout: 0 };
+
+/*
+ * A number of helper functions used for managing events.
+ * Many of the ideas behind this code originated from
+ * Dean Edwards' addEvent library.
+ */
+jQuery.event = {
+
+ // Bind an event to an element
+ // Original by Dean Edwards
+ add: function( elem, types, handler, data ) {
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // For whatever reason, IE has trouble passing the window object
+ // around, causing it to be cloned in the process
+ if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
+ elem = window;
+ }
+
+ if ( handler === false ) {
+ handler = returnFalse;
+ } else if ( !handler ) {
+ // Fixes bug #7229. Fix recommended by jdalton
+ return;
+ }
+
+ var handleObjIn, handleObj;
+
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ }
+
+ // Make sure that the function being executed has a unique ID
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure
+ var elemData = jQuery.data( elem );
+
+ // If no elemData is found then we must be trying to bind to one of the
+ // banned noData elements
+ if ( !elemData ) {
+ return;
+ }
+
+ // Use a key less likely to result in collisions for plain JS objects.
+ // Fixes bug #7150.
+ var eventKey = elem.nodeType ? "events" : "__events__",
+ events = elemData[ eventKey ],
+ eventHandle = elemData.handle;
+
+ if ( typeof events === "function" ) {
+ // On plain objects events is a fn that holds the the data
+ // which prevents this data from being JSON serialized
+ // the function does not need to be called, it just contains the data
+ eventHandle = events.handle;
+ events = events.events;
+
+ } else if ( !events ) {
+ if ( !elem.nodeType ) {
+ // On plain objects, create a fn that acts as the holder
+ // of the values to avoid JSON serialization of event data
+ elemData[ eventKey ] = elemData = function(){};
+ }
+
+ elemData.events = events = {};
+ }
+
+ if ( !eventHandle ) {
+ elemData.handle = eventHandle = function() {
+ // Handle the second event of a trigger and when
+ // an event is called after a page has unloaded
+ return typeof jQuery !== "undefined" && !jQuery.event.triggered ?
+ jQuery.event.handle.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ }
+
+ // Add elem as a property of the handle function
+ // This is to prevent a memory leak with non-native events in IE.
+ eventHandle.elem = elem;
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = types.split(" ");
+
+ var type, i = 0, namespaces;
+
+ while ( (type = types[ i++ ]) ) {
+ handleObj = handleObjIn ?
+ jQuery.extend({}, handleObjIn) :
+ { handler: handler, data: data };
+
+ // Namespaced event handlers
+ if ( type.indexOf(".") > -1 ) {
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ handleObj.namespace = namespaces.slice(0).sort().join(".");
+
+ } else {
+ namespaces = [];
+ handleObj.namespace = "";
+ }
+
+ handleObj.type = type;
+ if ( !handleObj.guid ) {
+ handleObj.guid = handler.guid;
+ }
+
+ // Get the current list of functions bound to this event
+ var handlers = events[ type ],
+ special = jQuery.event.special[ type ] || {};
+
+ // Init the event handler queue
+ if ( !handlers ) {
+ handlers = events[ type ] = [];
+
+ // Check for a special event handler
+ // Only use addEventListener/attachEvent if the special
+ // events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add the function to the element's handler list
+ handlers.push( handleObj );
+
+ // Keep track of which events have been used, for global triggering
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ global: {},
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, pos ) {
+ // don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ if ( handler === false ) {
+ handler = returnFalse;
+ }
+
+ var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,
+ eventKey = elem.nodeType ? "events" : "__events__",
+ elemData = jQuery.data( elem ),
+ events = elemData && elemData[ eventKey ];
+
+ if ( !elemData || !events ) {
+ return;
+ }
+
+ if ( typeof events === "function" ) {
+ elemData = events;
+ events = events.events;
+ }
+
+ // types is actually an event object here
+ if ( types && types.type ) {
+ handler = types.handler;
+ types = types.type;
+ }
+
+ // Unbind all events for the element
+ if ( !types || typeof types === "string" && types.charAt(0) === "." ) {
+ types = types || "";
+
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types );
+ }
+
+ return;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).unbind("mouseover mouseout", fn);
+ types = types.split(" ");
+
+ while ( (type = types[ i++ ]) ) {
+ origType = type;
+ handleObj = null;
+ all = type.indexOf(".") < 0;
+ namespaces = [];
+
+ if ( !all ) {
+ // Namespaced event handlers
+ namespaces = type.split(".");
+ type = namespaces.shift();
+
+ namespace = new RegExp("(^|\\.)" +
+ jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ eventType = events[ type ];
+
+ if ( !eventType ) {
+ continue;
+ }
+
+ if ( !handler ) {
+ for ( j = 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ jQuery.event.remove( elem, origType, handleObj.handler, j );
+ eventType.splice( j--, 1 );
+ }
+ }
+
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+
+ for ( j = pos || 0; j < eventType.length; j++ ) {
+ handleObj = eventType[ j ];
+
+ if ( handler.guid === handleObj.guid ) {
+ // remove the given handler for the given type
+ if ( all || namespace.test( handleObj.namespace ) ) {
+ if ( pos == null ) {
+ eventType.splice( j--, 1 );
+ }
+
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+
+ if ( pos != null ) {
+ break;
+ }
+ }
+ }
+
+ // remove generic event handler if no more handlers exist
+ if ( eventType.length === 0 || pos != null && eventType.length === 1 ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ ret = null;
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ var handle = elemData.handle;
+ if ( handle ) {
+ handle.elem = null;
+ }
+
+ delete elemData.events;
+ delete elemData.handle;
+
+ if ( typeof elemData === "function" ) {
+ jQuery.removeData( elem, eventKey );
+
+ } else if ( jQuery.isEmptyObject( elemData ) ) {
+ jQuery.removeData( elem );
+ }
+ }
+ },
+
+ // bubbling is internal
+ trigger: function( event, data, elem /*, bubbling */ ) {
+ // Event object or event type
+ var type = event.type || event,
+ bubbling = arguments[3];
+
+ if ( !bubbling ) {
+ event = typeof event === "object" ?
+ // jQuery.Event object
+ event[ jQuery.expando ] ? event :
+ // Object literal
+ jQuery.extend( jQuery.Event(type), event ) :
+ // Just the event type (string)
+ jQuery.Event(type);
+
+ if ( type.indexOf("!") >= 0 ) {
+ event.type = type = type.slice(0, -1);
+ event.exclusive = true;
+ }
+
+ // Handle a global trigger
+ if ( !elem ) {
+ // Don't bubble custom events when global (to avoid too much overhead)
+ event.stopPropagation();
+
+ // Only trigger if we've ever bound an event for it
+ if ( jQuery.event.global[ type ] ) {
+ jQuery.each( jQuery.cache, function() {
+ if ( this.events && this.events[type] ) {
+ jQuery.event.trigger( event, data, this.handle.elem );
+ }
+ });
+ }
+ }
+
+ // Handle triggering a single element
+
+ // don't do events on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return undefined;
+ }
+
+ // Clean up in case it is reused
+ event.result = undefined;
+ event.target = elem;
+
+ // Clone the incoming data, if any
+ data = jQuery.makeArray( data );
+ data.unshift( event );
+ }
+
+ event.currentTarget = elem;
+
+ // Trigger the event, it is assumed that "handle" is a function
+ var handle = elem.nodeType ?
+ jQuery.data( elem, "handle" ) :
+ (jQuery.data( elem, "__events__" ) || {}).handle;
+
+ if ( handle ) {
+ handle.apply( elem, data );
+ }
+
+ var parent = elem.parentNode || elem.ownerDocument;
+
+ // Trigger an inline bound script
+ try {
+ if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) {
+ if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) {
+ event.result = false;
+ event.preventDefault();
+ }
+ }
+
+ // prevent IE from throwing an error for some elements with some event types, see #3533
+ } catch (inlineError) {}
+
+ if ( !event.isPropagationStopped() && parent ) {
+ jQuery.event.trigger( event, data, parent, true );
+
+ } else if ( !event.isDefaultPrevented() ) {
+ var old,
+ target = event.target,
+ targetType = type.replace( rnamespaces, "" ),
+ isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
+ special = jQuery.event.special[ targetType ] || {};
+
+ if ( (!special._default || special._default.call( elem, event ) === false) &&
+ !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) {
+
+ try {
+ if ( target[ targetType ] ) {
+ // Make sure that we don't accidentally re-trigger the onFOO events
+ old = target[ "on" + targetType ];
+
+ if ( old ) {
+ target[ "on" + targetType ] = null;
+ }
+
+ jQuery.event.triggered = true;
+ target[ targetType ]();
+ }
+
+ // prevent IE from throwing an error for some elements with some event types, see #3533
+ } catch (triggerError) {}
+
+ if ( old ) {
+ target[ "on" + targetType ] = old;
+ }
+
+ jQuery.event.triggered = false;
+ }
+ }
+ },
+
+ handle: function( event ) {
+ var all, handlers, namespaces, namespace_re, events,
+ namespace_sort = [],
+ args = jQuery.makeArray( arguments );
+
+ event = args[0] = jQuery.event.fix( event || window.event );
+ event.currentTarget = this;
+
+ // Namespaced event handlers
+ all = event.type.indexOf(".") < 0 && !event.exclusive;
+
+ if ( !all ) {
+ namespaces = event.type.split(".");
+ event.type = namespaces.shift();
+ namespace_sort = namespaces.slice(0).sort();
+ namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ event.namespace = event.namespace || namespace_sort.join(".");
+
+ events = jQuery.data(this, this.nodeType ? "events" : "__events__");
+
+ if ( typeof events === "function" ) {
+ events = events.events;
+ }
+
+ handlers = (events || {})[ event.type ];
+
+ if ( events && handlers ) {
+ // Clone the handlers to prevent manipulation
+ handlers = handlers.slice(0);
+
+ for ( var j = 0, l = handlers.length; j < l; j++ ) {
+ var handleObj = handlers[ j ];
+
+ // Filter the functions by class
+ if ( all || namespace_re.test( handleObj.namespace ) ) {
+ // Pass in a reference to the handler function itself
+ // So that we can later remove it
+ event.handler = handleObj.handler;
+ event.data = handleObj.data;
+ event.handleObj = handleObj;
+
+ var ret = handleObj.handler.apply( this, args );
+
+ if ( ret !== undefined ) {
+ event.result = ret;
+ if ( ret === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // store a copy of the original event object
+ // and "clone" to set read-only properties
+ var originalEvent = event;
+ event = jQuery.Event( originalEvent );
+
+ for ( var i = this.props.length, prop; i; ) {
+ prop = this.props[ --i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Fix target property, if necessary
+ if ( !event.target ) {
+ // Fixes #1925 where srcElement might not be defined either
+ event.target = event.srcElement || document;
+ }
+
+ // check if target is a textnode (safari)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && event.fromElement ) {
+ event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;
+ }
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && event.clientX != null ) {
+ var doc = document.documentElement,
+ body = document.body;
+
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
+
+ // Add which for key events
+ if ( event.which == null && (event.charCode != null || event.keyCode != null) ) {
+ event.which = event.charCode != null ? event.charCode : event.keyCode;
+ }
+
+ // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
+ if ( !event.metaKey && event.ctrlKey ) {
+ event.metaKey = event.ctrlKey;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && event.button !== undefined ) {
+ event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
+ }
+
+ return event;
+ },
+
+ // Deprecated, use jQuery.guid instead
+ guid: 1E8,
+
+ // Deprecated, use jQuery.proxy instead
+ proxy: jQuery.proxy,
+
+ special: {
+ ready: {
+ // Make sure the ready event is setup
+ setup: jQuery.bindReady,
+ teardown: jQuery.noop
+ },
+
+ live: {
+ add: function( handleObj ) {
+ jQuery.event.add( this,
+ liveConvert( handleObj.origType, handleObj.selector ),
+ jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );
+ },
+
+ remove: function( handleObj ) {
+ jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );
+ }
+ },
+
+ beforeunload: {
+ setup: function( data, namespaces, eventHandle ) {
+ // We only want to do this special case on windows
+ if ( jQuery.isWindow( this ) ) {
+ this.onbeforeunload = eventHandle;
+ }
+ },
+
+ teardown: function( namespaces, eventHandle ) {
+ if ( this.onbeforeunload === eventHandle ) {
+ this.onbeforeunload = null;
+ }
+ }
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ if ( elem.detachEvent ) {
+ elem.detachEvent( "on" + type, handle );
+ }
+ };
+
+jQuery.Event = function( src ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !this.preventDefault ) {
+ return new jQuery.Event( src );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // timeStamp is buggy for some events on Firefox(#3843)
+ // So we won't rely on the native value
+ this.timeStamp = jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+ return false;
+}
+function returnTrue() {
+ return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ preventDefault: function() {
+ this.isDefaultPrevented = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+
+ // if preventDefault exists run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // otherwise set the returnValue property of the original event to false (IE)
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ this.isPropagationStopped = returnTrue;
+
+ var e = this.originalEvent;
+ if ( !e ) {
+ return;
+ }
+ // if stopPropagation exists run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+ // otherwise set the cancelBubble property of the original event to true (IE)
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ },
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse
+};
+
+// Checks if an event happened on an element within another element
+// Used in jQuery.event.special.mouseenter and mouseleave handlers
+var withinElement = function( event ) {
+ // Check if mouse(over|out) are still within the same parent element
+ var parent = event.relatedTarget;
+
+ // Firefox sometimes assigns relatedTarget a XUL element
+ // which we cannot access the parentNode property of
+ try {
+ // Traverse up the tree
+ while ( parent && parent !== this ) {
+ parent = parent.parentNode;
+ }
+
+ if ( parent !== this ) {
+ // set the correct event type
+ event.type = event.data;
+
+ // handle event if we actually just moused on to a non sub-element
+ jQuery.event.handle.apply( this, arguments );
+ }
+
+ // assuming we've left the element since we most likely mousedover a xul element
+ } catch(e) { }
+},
+
+// In case of event delegation, we only need to rename the event.type,
+// liveHandler will take care of the rest.
+delegate = function( event ) {
+ event.type = event.data;
+ jQuery.event.handle.apply( this, arguments );
+};
+
+// Create mouseenter and mouseleave events
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ setup: function( data ) {
+ jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );
+ },
+ teardown: function( data ) {
+ jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );
+ }
+ };
+});
+
+// submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function( data, namespaces ) {
+ if ( this.nodeName.toLowerCase() !== "form" ) {
+ jQuery.event.add(this, "click.specialSubmit", function( e ) {
+ var elem = e.target,
+ type = elem.type;
+
+ if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
+ e.liveFired = undefined;
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
+ var elem = e.target,
+ type = elem.type;
+
+ if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
+ e.liveFired = undefined;
+ return trigger( "submit", this, arguments );
+ }
+ });
+
+ } else {
+ return false;
+ }
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialSubmit" );
+ }
+ };
+
+}
+
+// change delegation, happens here so we have bind.
+if ( !jQuery.support.changeBubbles ) {
+
+ var changeFilters,
+
+ getVal = function( elem ) {
+ var type = elem.type, val = elem.value;
+
+ if ( type === "radio" || type === "checkbox" ) {
+ val = elem.checked;
+
+ } else if ( type === "select-multiple" ) {
+ val = elem.selectedIndex > -1 ?
+ jQuery.map( elem.options, function( elem ) {
+ return elem.selected;
+ }).join("-") :
+ "";
+
+ } else if ( elem.nodeName.toLowerCase() === "select" ) {
+ val = elem.selectedIndex;
+ }
+
+ return val;
+ },
+
+ testChange = function testChange( e ) {
+ var elem = e.target, data, val;
+
+ if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {
+ return;
+ }
+
+ data = jQuery.data( elem, "_change_data" );
+ val = getVal(elem);
+
+ // the current data will be also retrieved by beforeactivate
+ if ( e.type !== "focusout" || elem.type !== "radio" ) {
+ jQuery.data( elem, "_change_data", val );
+ }
+
+ if ( data === undefined || val === data ) {
+ return;
+ }
+
+ if ( data != null || val ) {
+ e.type = "change";
+ e.liveFired = undefined;
+ return jQuery.event.trigger( e, arguments[1], elem );
+ }
+ };
+
+ jQuery.event.special.change = {
+ filters: {
+ focusout: testChange,
+
+ beforedeactivate: testChange,
+
+ click: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Change has to be called before submit
+ // Keydown will be called before keypress, which is used in submit-event delegation
+ keydown: function( e ) {
+ var elem = e.target, type = elem.type;
+
+ if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
+ (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||
+ type === "select-multiple" ) {
+ return testChange.call( this, e );
+ }
+ },
+
+ // Beforeactivate happens also before the previous element is blurred
+ // with this event you can't trigger a change event, but you can store
+ // information
+ beforeactivate: function( e ) {
+ var elem = e.target;
+ jQuery.data( elem, "_change_data", getVal(elem) );
+ }
+ },
+
+ setup: function( data, namespaces ) {
+ if ( this.type === "file" ) {
+ return false;
+ }
+
+ for ( var type in changeFilters ) {
+ jQuery.event.add( this, type + ".specialChange", changeFilters[type] );
+ }
+
+ return rformElems.test( this.nodeName );
+ },
+
+ teardown: function( namespaces ) {
+ jQuery.event.remove( this, ".specialChange" );
+
+ return rformElems.test( this.nodeName );
+ }
+ };
+
+ changeFilters = jQuery.event.special.change.filters;
+
+ // Handle when the input is .focus()'d
+ changeFilters.focus = changeFilters.beforeactivate;
+}
+
+function trigger( type, elem, args ) {
+ args[0].type = type;
+ return jQuery.event.handle.apply( elem, args );
+}
+
+// Create "bubbling" focus and blur events
+if ( document.addEventListener ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( focusCounts[fix]++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --focusCounts[fix] === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+
+ function handler( e ) {
+ e = jQuery.event.fix( e );
+ e.type = fix;
+ return jQuery.event.trigger( e, null, e.target );
+ }
+ });
+}
+
+jQuery.each(["bind", "one"], function( i, name ) {
+ jQuery.fn[ name ] = function( type, data, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" ) {
+ for ( var key in type ) {
+ this[ name ](key, data, type[key], fn);
+ }
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) || data === false ) {
+ fn = data;
+ data = undefined;
+ }
+
+ var handler = name === "one" ? jQuery.proxy( fn, function( event ) {
+ jQuery( this ).unbind( event, handler );
+ return fn.apply( this, arguments );
+ }) : fn;
+
+ if ( type === "unload" && name !== "one" ) {
+ this.one( type, data, fn );
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.add( this[i], type, handler, data );
+ }
+ }
+
+ return this;
+ };
+});
+
+jQuery.fn.extend({
+ unbind: function( type, fn ) {
+ // Handle object literals
+ if ( typeof type === "object" && !type.preventDefault ) {
+ for ( var key in type ) {
+ this.unbind(key, type[key]);
+ }
+
+ } else {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ jQuery.event.remove( this[i], type, fn );
+ }
+ }
+
+ return this;
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.live( types, data, fn, selector );
+ },
+
+ undelegate: function( selector, types, fn ) {
+ if ( arguments.length === 0 ) {
+ return this.unbind( "live" );
+
+ } else {
+ return this.die( types, null, fn, selector );
+ }
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+
+ triggerHandler: function( type, data ) {
+ if ( this[0] ) {
+ var event = jQuery.Event( type );
+ event.preventDefault();
+ event.stopPropagation();
+ jQuery.event.trigger( event, data, this[0] );
+ return event.result;
+ }
+ },
+
+ toggle: function( fn ) {
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ i = 1;
+
+ // link all the functions, so any of them can unbind this click handler
+ while ( i < args.length ) {
+ jQuery.proxy( fn, args[ i++ ] );
+ }
+
+ return this.click( jQuery.proxy( fn, function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+ jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+ // Make sure that clicks stop
+ event.preventDefault();
+
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ }));
+ },
+
+ hover: function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+ }
+});
+
+var liveMap = {
+ focus: "focusin",
+ blur: "focusout",
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+};
+
+jQuery.each(["live", "die"], function( i, name ) {
+ jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {
+ var type, i = 0, match, namespaces, preType,
+ selector = origSelector || this.selector,
+ context = origSelector ? this : jQuery( this.context );
+
+ if ( typeof types === "object" && !types.preventDefault ) {
+ for ( var key in types ) {
+ context[ name ]( key, data, types[key], selector );
+ }
+
+ return this;
+ }
+
+ if ( jQuery.isFunction( data ) ) {
+ fn = data;
+ data = undefined;
+ }
+
+ types = (types || "").split(" ");
+
+ while ( (type = types[ i++ ]) != null ) {
+ match = rnamespaces.exec( type );
+ namespaces = "";
+
+ if ( match ) {
+ namespaces = match[0];
+ type = type.replace( rnamespaces, "" );
+ }
+
+ if ( type === "hover" ) {
+ types.push( "mouseenter" + namespaces, "mouseleave" + namespaces );
+ continue;
+ }
+
+ preType = type;
+
+ if ( type === "focus" || type === "blur" ) {
+ types.push( liveMap[ type ] + namespaces );
+ type = type + namespaces;
+
+ } else {
+ type = (liveMap[ type ] || type) + namespaces;
+ }
+
+ if ( name === "live" ) {
+ // bind live handler
+ for ( var j = 0, l = context.length; j < l; j++ ) {
+ jQuery.event.add( context[j], "live." + liveConvert( type, selector ),
+ { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );
+ }
+
+ } else {
+ // unbind live handler
+ context.unbind( "live." + liveConvert( type, selector ), fn );
+ }
+ }
+
+ return this;
+ };
+});
+
+function liveHandler( event ) {
+ var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
+ elems = [],
+ selectors = [],
+ events = jQuery.data( this, this.nodeType ? "events" : "__events__" );
+
+ if ( typeof events === "function" ) {
+ events = events.events;
+ }
+
+ // Make sure we avoid non-left-click bubbling in Firefox (#3861)
+ if ( event.liveFired === this || !events || !events.live || event.button && event.type === "click" ) {
+ return;
+ }
+
+ if ( event.namespace ) {
+ namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)");
+ }
+
+ event.liveFired = this;
+
+ var live = events.live.slice(0);
+
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) {
+ selectors.push( handleObj.selector );
+
+ } else {
+ live.splice( j--, 1 );
+ }
+ }
+
+ match = jQuery( event.target ).closest( selectors, event.currentTarget );
+
+ for ( i = 0, l = match.length; i < l; i++ ) {
+ close = match[i];
+
+ for ( j = 0; j < live.length; j++ ) {
+ handleObj = live[j];
+
+ if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) {
+ elem = close.elem;
+ related = null;
+
+ // Those two events require additional checking
+ if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
+ event.type = handleObj.preType;
+ related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];
+ }
+
+ if ( !related || related !== elem ) {
+ elems.push({ elem: elem, handleObj: handleObj, level: close.level });
+ }
+ }
+ }
+ }
+
+ for ( i = 0, l = elems.length; i < l; i++ ) {
+ match = elems[i];
+
+ if ( maxLevel && match.level > maxLevel ) {
+ break;
+ }
+
+ event.currentTarget = match.elem;
+ event.data = match.handleObj.data;
+ event.handleObj = match.handleObj;
+
+ ret = match.handleObj.origHandler.apply( match.elem, arguments );
+
+ if ( ret === false || event.isPropagationStopped() ) {
+ maxLevel = match.level;
+
+ if ( ret === false ) {
+ stop = false;
+ }
+ if ( event.isImmediatePropagationStopped() ) {
+ break;
+ }
+ }
+ }
+
+ return stop;
+}
+
+function liveConvert( type, selector ) {
+ return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&");
+}
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ if ( fn == null ) {
+ fn = data;
+ data = null;
+ }
+
+ return arguments.length > 0 ?
+ this.bind( name, data, fn ) :
+ this.trigger( name );
+ };
+
+ if ( jQuery.attrFn ) {
+ jQuery.attrFn[ name ] = true;
+ }
+});
+
+// Prevent memory leaks in IE
+// Window isn't included so as not to unbind existing unload events
+// More info:
+// - http://isaacschlueter.com/2006/10/msie-memory-leaks/
+if ( window.attachEvent && !window.addEventListener ) {
+ jQuery(window).bind("unload", function() {
+ for ( var id in jQuery.cache ) {
+ if ( jQuery.cache[ id ].handle ) {
+ // Try/Catch is to handle iframes being unloaded, see #4280
+ try {
+ jQuery.event.remove( jQuery.cache[ id ].handle.elem );
+ } catch(e) {}
+ }
+ }
+ });
+}
+
+
+/*!
+ * Sizzle CSS Selector Engine - v1.0
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+ done = 0,
+ toString = Object.prototype.toString,
+ hasDuplicate = false,
+ baseHasDuplicate = true;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+// Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+ baseHasDuplicate = false;
+ return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+ results = results || [];
+ context = context || document;
+
+ var origContext = context;
+
+ if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ var m, set, checkSet, extra, ret, cur, pop, i,
+ prune = true,
+ contextXML = Sizzle.isXML( context ),
+ parts = [],
+ soFar = selector;
+
+ // Reset the position of the chunker regexp (start from head)
+ do {
+ chunker.exec( "" );
+ m = chunker.exec( soFar );
+
+ if ( m ) {
+ soFar = m[3];
+
+ parts.push( m[1] );
+
+ if ( m[2] ) {
+ extra = m[3];
+ break;
+ }
+ }
+ } while ( m );
+
+ if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+ if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+ set = posProcess( parts[0] + parts[1], context );
+
+ } else {
+ set = Expr.relative[ parts[0] ] ?
+ [ context ] :
+ Sizzle( parts.shift(), context );
+
+ while ( parts.length ) {
+ selector = parts.shift();
+
+ if ( Expr.relative[ selector ] ) {
+ selector += parts.shift();
+ }
+
+ set = posProcess( selector, set );
+ }
+ }
+
+ } else {
+ // Take a shortcut and set the context if the root selector is an ID
+ // (but not if it'll be faster if the inner selector is an ID)
+ if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+ Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+ ret = Sizzle.find( parts.shift(), context, contextXML );
+ context = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set )[0] :
+ ret.set[0];
+ }
+
+ if ( context ) {
+ ret = seed ?
+ { expr: parts.pop(), set: makeArray(seed) } :
+ Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+ set = ret.expr ?
+ Sizzle.filter( ret.expr, ret.set ) :
+ ret.set;
+
+ if ( parts.length > 0 ) {
+ checkSet = makeArray( set );
+
+ } else {
+ prune = false;
+ }
+
+ while ( parts.length ) {
+ cur = parts.pop();
+ pop = cur;
+
+ if ( !Expr.relative[ cur ] ) {
+ cur = "";
+ } else {
+ pop = parts.pop();
+ }
+
+ if ( pop == null ) {
+ pop = context;
+ }
+
+ Expr.relative[ cur ]( checkSet, pop, contextXML );
+ }
+
+ } else {
+ checkSet = parts = [];
+ }
+ }
+
+ if ( !checkSet ) {
+ checkSet = set;
+ }
+
+ if ( !checkSet ) {
+ Sizzle.error( cur || selector );
+ }
+
+ if ( toString.call(checkSet) === "[object Array]" ) {
+ if ( !prune ) {
+ results.push.apply( results, checkSet );
+
+ } else if ( context && context.nodeType === 1 ) {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+ results.push( set[i] );
+ }
+ }
+
+ } else {
+ for ( i = 0; checkSet[i] != null; i++ ) {
+ if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+ results.push( set[i] );
+ }
+ }
+ }
+
+ } else {
+ makeArray( checkSet, results );
+ }
+
+ if ( extra ) {
+ Sizzle( extra, origContext, results, seed );
+ Sizzle.uniqueSort( results );
+ }
+
+ return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+ if ( sortOrder ) {
+ hasDuplicate = baseHasDuplicate;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( var i = 1; i < results.length; i++ ) {
+ if ( results[i] === results[ i - 1 ] ) {
+ results.splice( i--, 1 );
+ }
+ }
+ }
+ }
+
+ return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+ return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+ return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+ var set;
+
+ if ( !expr ) {
+ return [];
+ }
+
+ for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+ var match,
+ type = Expr.order[i];
+
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+ var left = match[1];
+ match.splice( 1, 1 );
+
+ if ( left.substr( left.length - 1 ) !== "\\" ) {
+ match[1] = (match[1] || "").replace(/\\/g, "");
+ set = Expr.find[ type ]( match, context, isXML );
+
+ if ( set != null ) {
+ expr = expr.replace( Expr.match[ type ], "" );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( !set ) {
+ set = context.getElementsByTagName( "*" );
+ }
+
+ return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+ var match, anyFound,
+ old = expr,
+ result = [],
+ curLoop = set,
+ isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+ while ( expr && set.length ) {
+ for ( var type in Expr.filter ) {
+ if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+ var found, item,
+ filter = Expr.filter[ type ],
+ left = match[1];
+
+ anyFound = false;
+
+ match.splice(1,1);
+
+ if ( left.substr( left.length - 1 ) === "\\" ) {
+ continue;
+ }
+
+ if ( curLoop === result ) {
+ result = [];
+ }
+
+ if ( Expr.preFilter[ type ] ) {
+ match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+ if ( !match ) {
+ anyFound = found = true;
+
+ } else if ( match === true ) {
+ continue;
+ }
+ }
+
+ if ( match ) {
+ for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+ if ( item ) {
+ found = filter( item, match, i, curLoop );
+ var pass = not ^ !!found;
+
+ if ( inplace && found != null ) {
+ if ( pass ) {
+ anyFound = true;
+
+ } else {
+ curLoop[i] = false;
+ }
+
+ } else if ( pass ) {
+ result.push( item );
+ anyFound = true;
+ }
+ }
+ }
+ }
+
+ if ( found !== undefined ) {
+ if ( !inplace ) {
+ curLoop = result;
+ }
+
+ expr = expr.replace( Expr.match[ type ], "" );
+
+ if ( !anyFound ) {
+ return [];
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Improper expression
+ if ( expr === old ) {
+ if ( anyFound == null ) {
+ Sizzle.error( expr );
+
+ } else {
+ break;
+ }
+ }
+
+ old = expr;
+ }
+
+ return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+ throw "Syntax error, unrecognized expression: " + msg;
+};
+
+var Expr = Sizzle.selectors = {
+ order: [ "ID", "NAME", "TAG" ],
+
+ match: {
+ ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+ NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+ ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
+ TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+ CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
+ POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+ PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+ },
+
+ leftMatch: {},
+
+ attrMap: {
+ "class": "className",
+ "for": "htmlFor"
+ },
+
+ attrHandle: {
+ href: function( elem ) {
+ return elem.getAttribute( "href" );
+ }
+ },
+
+ relative: {
+ "+": function(checkSet, part){
+ var isPartStr = typeof part === "string",
+ isTag = isPartStr && !/\W/.test( part ),
+ isPartStrNotTag = isPartStr && !isTag;
+
+ if ( isTag ) {
+ part = part.toLowerCase();
+ }
+
+ for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+ if ( (elem = checkSet[i]) ) {
+ while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+ checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+ elem || false :
+ elem === part;
+ }
+ }
+
+ if ( isPartStrNotTag ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ },
+
+ ">": function( checkSet, part ) {
+ var elem,
+ isPartStr = typeof part === "string",
+ i = 0,
+ l = checkSet.length;
+
+ if ( isPartStr && !/\W/.test( part ) ) {
+ part = part.toLowerCase();
+
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ var parent = elem.parentNode;
+ checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+ }
+ }
+
+ } else {
+ for ( ; i < l; i++ ) {
+ elem = checkSet[i];
+
+ if ( elem ) {
+ checkSet[i] = isPartStr ?
+ elem.parentNode :
+ elem.parentNode === part;
+ }
+ }
+
+ if ( isPartStr ) {
+ Sizzle.filter( part, checkSet, true );
+ }
+ }
+ },
+
+ "": function(checkSet, part, isXML){
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test(part) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+ },
+
+ "~": function( checkSet, part, isXML ) {
+ var nodeCheck,
+ doneName = done++,
+ checkFn = dirCheck;
+
+ if ( typeof part === "string" && !/\W/.test( part ) ) {
+ part = part.toLowerCase();
+ nodeCheck = part;
+ checkFn = dirNodeCheck;
+ }
+
+ checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+ }
+ },
+
+ find: {
+ ID: function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ },
+
+ NAME: function( match, context ) {
+ if ( typeof context.getElementsByName !== "undefined" ) {
+ var ret = [],
+ results = context.getElementsByName( match[1] );
+
+ for ( var i = 0, l = results.length; i < l; i++ ) {
+ if ( results[i].getAttribute("name") === match[1] ) {
+ ret.push( results[i] );
+ }
+ }
+
+ return ret.length === 0 ? null : ret;
+ }
+ },
+
+ TAG: function( match, context ) {
+ return context.getElementsByTagName( match[1] );
+ }
+ },
+ preFilter: {
+ CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+ match = " " + match[1].replace(/\\/g, "") + " ";
+
+ if ( isXML ) {
+ return match;
+ }
+
+ for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
+ if ( !inplace ) {
+ result.push( elem );
+ }
+
+ } else if ( inplace ) {
+ curLoop[i] = false;
+ }
+ }
+ }
+
+ return false;
+ },
+
+ ID: function( match ) {
+ return match[1].replace(/\\/g, "");
+ },
+
+ TAG: function( match, curLoop ) {
+ return match[1].toLowerCase();
+ },
+
+ CHILD: function( match ) {
+ if ( match[1] === "nth" ) {
+ // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+ var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+ match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+ !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+ // calculate the numbers (first)n+(last) including if they are negative
+ match[2] = (test[1] + (test[2] || 1)) - 0;
+ match[3] = test[3] - 0;
+ }
+
+ // TODO: Move to normal caching system
+ match[0] = done++;
+
+ return match;
+ },
+
+ ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+ var name = match[1].replace(/\\/g, "");
+
+ if ( !isXML && Expr.attrMap[name] ) {
+ match[1] = Expr.attrMap[name];
+ }
+
+ if ( match[2] === "~=" ) {
+ match[4] = " " + match[4] + " ";
+ }
+
+ return match;
+ },
+
+ PSEUDO: function( match, curLoop, inplace, result, not ) {
+ if ( match[1] === "not" ) {
+ // If we're dealing with a complex expression, or a simple one
+ if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+ match[3] = Sizzle(match[3], null, null, curLoop);
+
+ } else {
+ var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+ if ( !inplace ) {
+ result.push.apply( result, ret );
+ }
+
+ return false;
+ }
+
+ } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+ return true;
+ }
+
+ return match;
+ },
+
+ POS: function( match ) {
+ match.unshift( true );
+
+ return match;
+ }
+ },
+
+ filters: {
+ enabled: function( elem ) {
+ return elem.disabled === false && elem.type !== "hidden";
+ },
+
+ disabled: function( elem ) {
+ return elem.disabled === true;
+ },
+
+ checked: function( elem ) {
+ return elem.checked === true;
+ },
+
+ selected: function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ elem.parentNode.selectedIndex;
+
+ return elem.selected === true;
+ },
+
+ parent: function( elem ) {
+ return !!elem.firstChild;
+ },
+
+ empty: function( elem ) {
+ return !elem.firstChild;
+ },
+
+ has: function( elem, i, match ) {
+ return !!Sizzle( match[3], elem ).length;
+ },
+
+ header: function( elem ) {
+ return (/h\d/i).test( elem.nodeName );
+ },
+
+ text: function( elem ) {
+ return "text" === elem.type;
+ },
+ radio: function( elem ) {
+ return "radio" === elem.type;
+ },
+
+ checkbox: function( elem ) {
+ return "checkbox" === elem.type;
+ },
+
+ file: function( elem ) {
+ return "file" === elem.type;
+ },
+ password: function( elem ) {
+ return "password" === elem.type;
+ },
+
+ submit: function( elem ) {
+ return "submit" === elem.type;
+ },
+
+ image: function( elem ) {
+ return "image" === elem.type;
+ },
+
+ reset: function( elem ) {
+ return "reset" === elem.type;
+ },
+
+ button: function( elem ) {
+ return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
+ },
+
+ input: function( elem ) {
+ return (/input|select|textarea|button/i).test( elem.nodeName );
+ }
+ },
+ setFilters: {
+ first: function( elem, i ) {
+ return i === 0;
+ },
+
+ last: function( elem, i, match, array ) {
+ return i === array.length - 1;
+ },
+
+ even: function( elem, i ) {
+ return i % 2 === 0;
+ },
+
+ odd: function( elem, i ) {
+ return i % 2 === 1;
+ },
+
+ lt: function( elem, i, match ) {
+ return i < match[3] - 0;
+ },
+
+ gt: function( elem, i, match ) {
+ return i > match[3] - 0;
+ },
+
+ nth: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ },
+
+ eq: function( elem, i, match ) {
+ return match[3] - 0 === i;
+ }
+ },
+ filter: {
+ PSEUDO: function( elem, match, i, array ) {
+ var name = match[1],
+ filter = Expr.filters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+
+ } else if ( name === "contains" ) {
+ return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+ } else if ( name === "not" ) {
+ var not = match[3];
+
+ for ( var j = 0, l = not.length; j < l; j++ ) {
+ if ( not[j] === elem ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ } else {
+ Sizzle.error( "Syntax error, unrecognized expression: " + name );
+ }
+ },
+
+ CHILD: function( elem, match ) {
+ var type = match[1],
+ node = elem;
+
+ switch ( type ) {
+ case "only":
+ case "first":
+ while ( (node = node.previousSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ if ( type === "first" ) {
+ return true;
+ }
+
+ node = elem;
+
+ case "last":
+ while ( (node = node.nextSibling) ) {
+ if ( node.nodeType === 1 ) {
+ return false;
+ }
+ }
+
+ return true;
+
+ case "nth":
+ var first = match[2],
+ last = match[3];
+
+ if ( first === 1 && last === 0 ) {
+ return true;
+ }
+
+ var doneName = match[0],
+ parent = elem.parentNode;
+
+ if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+ var count = 0;
+
+ for ( node = parent.firstChild; node; node = node.nextSibling ) {
+ if ( node.nodeType === 1 ) {
+ node.nodeIndex = ++count;
+ }
+ }
+
+ parent.sizcache = doneName;
+ }
+
+ var diff = elem.nodeIndex - last;
+
+ if ( first === 0 ) {
+ return diff === 0;
+
+ } else {
+ return ( diff % first === 0 && diff / first >= 0 );
+ }
+ }
+ },
+
+ ID: function( elem, match ) {
+ return elem.nodeType === 1 && elem.getAttribute("id") === match;
+ },
+
+ TAG: function( elem, match ) {
+ return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+ },
+
+ CLASS: function( elem, match ) {
+ return (" " + (elem.className || elem.getAttribute("class")) + " ")
+ .indexOf( match ) > -1;
+ },
+
+ ATTR: function( elem, match ) {
+ var name = match[1],
+ result = Expr.attrHandle[ name ] ?
+ Expr.attrHandle[ name ]( elem ) :
+ elem[ name ] != null ?
+ elem[ name ] :
+ elem.getAttribute( name ),
+ value = result + "",
+ type = match[2],
+ check = match[4];
+
+ return result == null ?
+ type === "!=" :
+ type === "=" ?
+ value === check :
+ type === "*=" ?
+ value.indexOf(check) >= 0 :
+ type === "~=" ?
+ (" " + value + " ").indexOf(check) >= 0 :
+ !check ?
+ value && result !== false :
+ type === "!=" ?
+ value !== check :
+ type === "^=" ?
+ value.indexOf(check) === 0 :
+ type === "$=" ?
+ value.substr(value.length - check.length) === check :
+ type === "|=" ?
+ value === check || value.substr(0, check.length + 1) === check + "-" :
+ false;
+ },
+
+ POS: function( elem, match, i, array ) {
+ var name = match[2],
+ filter = Expr.setFilters[ name ];
+
+ if ( filter ) {
+ return filter( elem, i, match, array );
+ }
+ }
+ }
+};
+
+var origPOS = Expr.match.POS,
+ fescape = function(all, num){
+ return "\\" + (num - 0 + 1);
+ };
+
+for ( var type in Expr.match ) {
+ Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+ Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+
+var makeArray = function( array, results ) {
+ array = Array.prototype.slice.call( array, 0 );
+
+ if ( results ) {
+ results.push.apply( results, array );
+ return results;
+ }
+
+ return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+ Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+ makeArray = function( array, results ) {
+ var i = 0,
+ ret = results || [];
+
+ if ( toString.call(array) === "[object Array]" ) {
+ Array.prototype.push.apply( ret, array );
+
+ } else {
+ if ( typeof array.length === "number" ) {
+ for ( var l = array.length; i < l; i++ ) {
+ ret.push( array[i] );
+ }
+
+ } else {
+ for ( ; array[i]; i++ ) {
+ ret.push( array[i] );
+ }
+ }
+ }
+
+ return ret;
+ };
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+ sortOrder = function( a, b ) {
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+ return a.compareDocumentPosition ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+ };
+
+} else {
+ sortOrder = function( a, b ) {
+ var al, bl,
+ ap = [],
+ bp = [],
+ aup = a.parentNode,
+ bup = b.parentNode,
+ cur = aup;
+
+ // The nodes are identical, we can exit early
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // If the nodes are siblings (or identical) we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+
+ // If no parents were found then the nodes are disconnected
+ } else if ( !aup ) {
+ return -1;
+
+ } else if ( !bup ) {
+ return 1;
+ }
+
+ // Otherwise they're somewhere else in the tree so we need
+ // to build up a full list of the parentNodes for comparison
+ while ( cur ) {
+ ap.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ cur = bup;
+
+ while ( cur ) {
+ bp.unshift( cur );
+ cur = cur.parentNode;
+ }
+
+ al = ap.length;
+ bl = bp.length;
+
+ // Start walking down the tree looking for a discrepancy
+ for ( var i = 0; i < al && i < bl; i++ ) {
+ if ( ap[i] !== bp[i] ) {
+ return siblingCheck( ap[i], bp[i] );
+ }
+ }
+
+ // We ended someplace up the tree so do a sibling check
+ return i === al ?
+ siblingCheck( a, bp[i], -1 ) :
+ siblingCheck( ap[i], b, 1 );
+ };
+
+ siblingCheck = function( a, b, ret ) {
+ if ( a === b ) {
+ return ret;
+ }
+
+ var cur = a.nextSibling;
+
+ while ( cur ) {
+ if ( cur === b ) {
+ return -1;
+ }
+
+ cur = cur.nextSibling;
+ }
+
+ return 1;
+ };
+}
+
+// Utility function for retreiving the text value of an array of DOM nodes
+Sizzle.getText = function( elems ) {
+ var ret = "", elem;
+
+ for ( var i = 0; elems[i]; i++ ) {
+ elem = elems[i];
+
+ // Get the text from text nodes and CDATA nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+ ret += elem.nodeValue;
+
+ // Traverse everything else, except comment nodes
+ } else if ( elem.nodeType !== 8 ) {
+ ret += Sizzle.getText( elem.childNodes );
+ }
+ }
+
+ return ret;
+};
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+ // We're going to inject a fake input element with a specified name
+ var form = document.createElement("div"),
+ id = "script" + (new Date()).getTime(),
+ root = document.documentElement;
+
+ form.innerHTML = "<a name='" + id + "'/>";
+
+ // Inject it into the root element, check its status, and remove it quickly
+ root.insertBefore( form, root.firstChild );
+
+ // The workaround has to do additional checks after a getElementById
+ // Which slows things down for other browsers (hence the branching)
+ if ( document.getElementById( id ) ) {
+ Expr.find.ID = function( match, context, isXML ) {
+ if ( typeof context.getElementById !== "undefined" && !isXML ) {
+ var m = context.getElementById(match[1]);
+
+ return m ?
+ m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+
+ Expr.filter.ID = function( elem, match ) {
+ var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+ return elem.nodeType === 1 && node && node.nodeValue === match;
+ };
+ }
+
+ root.removeChild( form );
+
+ // release memory in IE
+ root = form = null;
+})();
+
+(function(){
+ // Check to see if the browser returns only elements
+ // when doing getElementsByTagName("*")
+
+ // Create a fake element
+ var div = document.createElement("div");
+ div.appendChild( document.createComment("") );
+
+ // Make sure no comments are found
+ if ( div.getElementsByTagName("*").length > 0 ) {
+ Expr.find.TAG = function( match, context ) {
+ var results = context.getElementsByTagName( match[1] );
+
+ // Filter out possible comments
+ if ( match[1] === "*" ) {
+ var tmp = [];
+
+ for ( var i = 0; results[i]; i++ ) {
+ if ( results[i].nodeType === 1 ) {
+ tmp.push( results[i] );
+ }
+ }
+
+ results = tmp;
+ }
+
+ return results;
+ };
+ }
+
+ // Check to see if an attribute returns normalized href attributes
+ div.innerHTML = "<a href='#'></a>";
+
+ if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+ div.firstChild.getAttribute("href") !== "#" ) {
+
+ Expr.attrHandle.href = function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ };
+ }
+
+ // release memory in IE
+ div = null;
+})();
+
+if ( document.querySelectorAll ) {
+ (function(){
+ var oldSizzle = Sizzle,
+ div = document.createElement("div"),
+ id = "__sizzle__";
+
+ div.innerHTML = "<p class='TEST'></p>";
+
+ // Safari can't handle uppercase or unicode characters when
+ // in quirks mode.
+ if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+ return;
+ }
+
+ Sizzle = function( query, context, extra, seed ) {
+ context = context || document;
+
+ // Make sure that attribute selectors are quoted
+ query = query.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ // Only use querySelectorAll on non-XML documents
+ // (ID selectors don't work in non-HTML documents)
+ if ( !seed && !Sizzle.isXML(context) ) {
+ if ( context.nodeType === 9 ) {
+ try {
+ return makeArray( context.querySelectorAll(query), extra );
+ } catch(qsaError) {}
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ var old = context.getAttribute( "id" ),
+ nid = old || id;
+
+ if ( !old ) {
+ context.setAttribute( "id", nid );
+ }
+
+ try {
+ return makeArray( context.querySelectorAll( "#" + nid + " " + query ), extra );
+
+ } catch(pseudoError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute( "id" );
+ }
+ }
+ }
+ }
+
+ return oldSizzle(query, context, extra, seed);
+ };
+
+ for ( var prop in oldSizzle ) {
+ Sizzle[ prop ] = oldSizzle[ prop ];
+ }
+
+ // release memory in IE
+ div = null;
+ })();
+}
+
+(function(){
+ var html = document.documentElement,
+ matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector,
+ pseudoWorks = false;
+
+ try {
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( document.documentElement, "[test!='']:sizzle" );
+
+ } catch( pseudoError ) {
+ pseudoWorks = true;
+ }
+
+ if ( matches ) {
+ Sizzle.matchesSelector = function( node, expr ) {
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+ if ( !Sizzle.isXML( node ) ) {
+ try {
+ if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+ return matches.call( node, expr );
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle(expr, null, null, [node]).length > 0;
+ };
+ }
+})();
+
+(function(){
+ var div = document.createElement("div");
+
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+ // Opera can't find a second classname (in 9.6)
+ // Also, make sure that getElementsByClassName actually exists
+ if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+ return;
+ }
+
+ // Safari caches class attributes, doesn't catch changes (in 3.2)
+ div.lastChild.className = "e";
+
+ if ( div.getElementsByClassName("e").length === 1 ) {
+ return;
+ }
+
+ Expr.order.splice(1, 0, "CLASS");
+ Expr.find.CLASS = function( match, context, isXML ) {
+ if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+ return context.getElementsByClassName(match[1]);
+ }
+ };
+
+ // release memory in IE
+ div = null;
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 && !isXML ){
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( elem.nodeName.toLowerCase() === cur ) {
+ match = elem;
+ break;
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+ for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+ var elem = checkSet[i];
+
+ if ( elem ) {
+ var match = false;
+
+ elem = elem[dir];
+
+ while ( elem ) {
+ if ( elem.sizcache === doneName ) {
+ match = checkSet[elem.sizset];
+ break;
+ }
+
+ if ( elem.nodeType === 1 ) {
+ if ( !isXML ) {
+ elem.sizcache = doneName;
+ elem.sizset = i;
+ }
+
+ if ( typeof cur !== "string" ) {
+ if ( elem === cur ) {
+ match = true;
+ break;
+ }
+
+ } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+ match = elem;
+ break;
+ }
+ }
+
+ elem = elem[dir];
+ }
+
+ checkSet[i] = match;
+ }
+ }
+}
+
+if ( document.documentElement.contains ) {
+ Sizzle.contains = function( a, b ) {
+ return a !== b && (a.contains ? a.contains(b) : true);
+ };
+
+} else if ( document.documentElement.compareDocumentPosition ) {
+ Sizzle.contains = function( a, b ) {
+ return !!(a.compareDocumentPosition(b) & 16);
+ };
+
+} else {
+ Sizzle.contains = function() {
+ return false;
+ };
+}
+
+Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function( selector, context ) {
+ var match,
+ tmpSet = [],
+ later = "",
+ root = context.nodeType ? [context] : context;
+
+ // Position selectors must be done after the filter
+ // And so must :not(positional) so we move all PSEUDOs to the end
+ while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+ later += match[0];
+ selector = selector.replace( Expr.match.PSEUDO, "" );
+ }
+
+ selector = Expr.relative[selector] ? selector + "*" : selector;
+
+ for ( var i = 0, l = root.length; i < l; i++ ) {
+ Sizzle( selector, root[i], tmpSet );
+ }
+
+ return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.filters;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})();
+
+
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prevUntil|prevAll)/,
+ // Note: This RegExp should be improved, or likely pulled from Sizzle
+ rmultiselector = /,/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ slice = Array.prototype.slice,
+ POS = jQuery.expr.match.POS;
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var ret = this.pushStack( "", "find", selector ),
+ length = 0;
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ length = ret.length;
+ jQuery.find( selector, this[i], ret );
+
+ if ( i > 0 ) {
+ // Make sure that the results are unique
+ for ( var n = length; n < ret.length; n++ ) {
+ for ( var r = 0; r < length; r++ ) {
+ if ( ret[r] === ret[n] ) {
+ ret.splice(n--, 1);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ has: function( target ) {
+ var targets = jQuery( target );
+ return this.filter(function() {
+ for ( var i = 0, l = targets.length; i < l; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false), "not", selector);
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true), "filter", selector );
+ },
+
+ is: function( selector ) {
+ return !!selector && jQuery.filter( selector, this ).length > 0;
+ },
+
+ closest: function( selectors, context ) {
+ var ret = [], i, l, cur = this[0];
+
+ if ( jQuery.isArray( selectors ) ) {
+ var match, selector,
+ matches = {},
+ level = 1;
+
+ if ( cur && selectors.length ) {
+ for ( i = 0, l = selectors.length; i < l; i++ ) {
+ selector = selectors[i];
+
+ if ( !matches[selector] ) {
+ matches[selector] = jQuery.expr.match.POS.test( selector ) ?
+ jQuery( selector, context || this.context ) :
+ selector;
+ }
+ }
+
+ while ( cur && cur.ownerDocument && cur !== context ) {
+ for ( selector in matches ) {
+ match = matches[selector];
+
+ if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) {
+ ret.push({ selector: selector, elem: cur, level: level });
+ }
+ }
+
+ cur = cur.parentNode;
+ level++;
+ }
+ }
+
+ return ret;
+ }
+
+ var pos = POS.test( selectors ) ?
+ jQuery( selectors, context || this.context ) : null;
+
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+
+ } else {
+ cur = cur.parentNode;
+ if ( !cur || !cur.ownerDocument || cur === context ) {
+ break;
+ }
+ }
+ }
+ }
+
+ ret = ret.length > 1 ? jQuery.unique(ret) : ret;
+
+ return this.pushStack( ret, "closest", selectors );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+ if ( !elem || typeof elem === "string" ) {
+ return jQuery.inArray( this[0],
+ // If it receives a string, the selector is used
+ // If it receives nothing, the siblings are used
+ elem ? jQuery( elem ) : this.parent().children() );
+ }
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context || this.context ) :
+ jQuery.makeArray( selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+ all :
+ jQuery.unique( all ) );
+ },
+
+ andSelf: function() {
+ return this.add( this.prevObject );
+ }
+});
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+ return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return jQuery.nth( elem, 2, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return jQuery.nth( elem, 2, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( elem.parentNode.firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.makeArray( elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 ? jQuery.unique( ret ) : ret;
+
+ if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret, name, slice.call(arguments).join(",") );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ nth: function( cur, result, dir, elem ) {
+ result = result || 1;
+ var num = 0;
+
+ for ( ; cur; cur = cur[dir] ) {
+ if ( cur.nodeType === 1 && ++num === result ) {
+ break;
+ }
+ }
+
+ return cur;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ return (elem === qualifier) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem, i ) {
+ return (jQuery.inArray( elem, qualifier ) >= 0) === keep;
+ });
+}
+
+
+
+
+var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnocache = /<(?:script|object|embed|option|style)/i,
+ // checked="checked" or checked (html5)
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ raction = /\=([^="'>\s]+\/)>/g,
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ area: [ 1, "<map>", "</map>" ],
+ _default: [ 0, "", "" ]
+ };
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE can't serialize <link> and <script> tags normally
+if ( !jQuery.support.htmlSerialize ) {
+ wrapMap._default = [ 1, "div<div>", "</div>" ];
+}
+
+jQuery.fn.extend({
+ text: function( text ) {
+ if ( jQuery.isFunction(text) ) {
+ return this.each(function(i) {
+ var self = jQuery( this );
+
+ self.text( text.call(this, i, self.text()) );
+ });
+ }
+
+ if ( typeof text !== "object" && text !== undefined ) {
+ return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
+ }
+
+ return jQuery.text( this );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append(this);
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ return this.each(function() {
+ jQuery( this ).wrapAll( html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this );
+ });
+ } else if ( arguments.length ) {
+ var set = jQuery(arguments[0]);
+ set.push.apply( set, this.toArray() );
+ return this.pushStack( set, "before", arguments );
+ }
+ },
+
+ after: function() {
+ if ( this[0] && this[0].parentNode ) {
+ return this.domManip(arguments, false, function( elem ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ });
+ } else if ( arguments.length ) {
+ var set = this.pushStack( this, "after", arguments );
+ set.push.apply( set, jQuery(arguments[0]).toArray() );
+ return set;
+ }
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ jQuery.cleanData( [ elem ] );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( elem.getElementsByTagName("*") );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( events ) {
+ // Do the clone
+ var ret = this.map(function() {
+ if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
+ // IE copies events bound via attachEvent when
+ // using cloneNode. Calling detachEvent on the
+ // clone will also remove the events from the orignal
+ // In order to get around this, we use innerHTML.
+ // Unfortunately, this means some modifications to
+ // attributes in IE that are actually only stored
+ // as properties will not be copied (such as the
+ // the name attribute on an input).
+ var html = this.outerHTML,
+ ownerDocument = this.ownerDocument;
+
+ if ( !html ) {
+ var div = ownerDocument.createElement("div");
+ div.appendChild( this.cloneNode(true) );
+ html = div.innerHTML;
+ }
+
+ return jQuery.clean([html.replace(rinlinejQuery, "")
+ // Handle the case in IE 8 where action=/test/> self-closes a tag
+ .replace(raction, '="$1">')
+ .replace(rleadingWhitespace, "")], ownerDocument)[0];
+ } else {
+ return this.cloneNode(true);
+ }
+ });
+
+ // Copy the events from the original to the clone
+ if ( events === true ) {
+ cloneCopyEvent( this, ret );
+ cloneCopyEvent( this.find("*"), ret.find("*") );
+ }
+
+ // Return the cloned set
+ return ret;
+ },
+
+ html: function( value ) {
+ if ( value === undefined ) {
+ return this[0] && this[0].nodeType === 1 ?
+ this[0].innerHTML.replace(rinlinejQuery, "") :
+ null;
+
+ // See if we can take a shortcut and just use innerHTML
+ } else if ( typeof value === "string" && !rnocache.test( value ) &&
+ (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
+ !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
+
+ value = value.replace(rxhtmlTag, "<$1></$2>");
+
+ try {
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( this[i].nodeType === 1 ) {
+ jQuery.cleanData( this[i].getElementsByTagName("*") );
+ this[i].innerHTML = value;
+ }
+ }
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {
+ this.empty().append( value );
+ }
+
+ } else if ( jQuery.isFunction( value ) ) {
+ this.each(function(i){
+ var self = jQuery( this );
+
+ self.html( value.call(this, i, self.html()) );
+ });
+
+ } else {
+ this.empty().append( value );
+ }
+
+ return this;
+ },
+
+ replaceWith: function( value ) {
+ if ( this[0] && this[0].parentNode ) {
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function(i) {
+ var self = jQuery(this), old = self.html();
+ self.replaceWith( value.call( this, i, old ) );
+ });
+ }
+
+ if ( typeof value !== "string" ) {
+ value = jQuery( value ).detach();
+ }
+
+ return this.each(function() {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ jQuery( this ).remove();
+
+ if ( next ) {
+ jQuery(next).before( value );
+ } else {
+ jQuery(parent).append( value );
+ }
+ });
+ } else {
+ return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value );
+ }
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+ var results, first, fragment, parent,
+ value = args[0],
+ scripts = [];
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
+ return this.each(function() {
+ jQuery(this).domManip( args, table, callback, true );
+ });
+ }
+
+ if ( jQuery.isFunction(value) ) {
+ return this.each(function(i) {
+ var self = jQuery(this);
+ args[0] = value.call(this, i, table ? self.html() : undefined);
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( this[0] ) {
+ parent = value && value.parentNode;
+
+ // If we're in a fragment, just use that instead of building a new one
+ if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
+ results = { fragment: parent };
+
+ } else {
+ results = jQuery.buildFragment( args, this, scripts );
+ }
+
+ fragment = results.fragment;
+
+ if ( fragment.childNodes.length === 1 ) {
+ first = fragment = fragment.firstChild;
+ } else {
+ first = fragment.firstChild;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+
+ for ( var i = 0, l = this.length; i < l; i++ ) {
+ callback.call(
+ table ?
+ root(this[i], first) :
+ this[i],
+ i > 0 || results.cacheable || this.length > 1 ?
+ fragment.cloneNode(true) :
+ fragment
+ );
+ }
+ }
+
+ if ( scripts.length ) {
+ jQuery.each( scripts, evalScript );
+ }
+ }
+
+ return this;
+ }
+});
+
+function root( elem, cur ) {
+ return jQuery.nodeName(elem, "table") ?
+ (elem.getElementsByTagName("tbody")[0] ||
+ elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
+ elem;
+}
+
+function cloneCopyEvent(orig, ret) {
+ var i = 0;
+
+ ret.each(function() {
+ if ( this.nodeName !== (orig[i] && orig[i].nodeName) ) {
+ return;
+ }
+
+ var oldData = jQuery.data( orig[i++] ),
+ curData = jQuery.data( this, oldData ),
+ events = oldData && oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( var type in events ) {
+ for ( var handler in events[ type ] ) {
+ jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data );
+ }
+ }
+ }
+ });
+}
+
+jQuery.buildFragment = function( args, nodes, scripts ) {
+ var fragment, cacheable, cacheresults,
+ doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
+
+ // Only cache "small" (1/2 KB) strings that are associated with the main document
+ // Cloning options loses the selected state, so don't cache them
+ // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+ // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+ if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
+ !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {
+
+ cacheable = true;
+ cacheresults = jQuery.fragments[ args[0] ];
+ if ( cacheresults ) {
+ if ( cacheresults !== 1 ) {
+ fragment = cacheresults;
+ }
+ }
+ }
+
+ if ( !fragment ) {
+ fragment = doc.createDocumentFragment();
+ jQuery.clean( args, doc, fragment, scripts );
+ }
+
+ if ( cacheable ) {
+ jQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;
+ }
+
+ return { fragment: fragment, cacheable: cacheable };
+};
+
+jQuery.fragments = {};
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [],
+ insert = jQuery( selector ),
+ parent = this.length === 1 && this[0].parentNode;
+
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ insert[ original ]( this[0] );
+ return this;
+
+ } else {
+ for ( var i = 0, l = insert.length; i < l; i++ ) {
+ var elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery( insert[i] )[ original ]( elems );
+ ret = ret.concat( elems );
+ }
+
+ return this.pushStack( ret, name, insert.selector );
+ }
+ };
+});
+
+jQuery.extend({
+ clean: function( elems, context, fragment, scripts ) {
+ context = context || document;
+
+ // !context.createElement fails in IE with an error but returns typeof 'object'
+ if ( typeof context.createElement === "undefined" ) {
+ context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
+ }
+
+ var ret = [];
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( typeof elem === "number" ) {
+ elem += "";
+ }
+
+ if ( !elem ) {
+ continue;
+ }
+
+ // Convert html string into DOM nodes
+ if ( typeof elem === "string" && !rhtml.test( elem ) ) {
+ elem = context.createTextNode( elem );
+
+ } else if ( typeof elem === "string" ) {
+ // Fix "XHTML"-style tags in all browsers
+ elem = elem.replace(rxhtmlTag, "<$1></$2>");
+
+ // Trim whitespace, otherwise indexOf won't work as expected
+ var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(),
+ wrap = wrapMap[ tag ] || wrapMap._default,
+ depth = wrap[0],
+ div = context.createElement("div");
+
+ // Go to html and back, then peel off extra wrappers
+ div.innerHTML = wrap[1] + elem + wrap[2];
+
+ // Move to the right depth
+ while ( depth-- ) {
+ div = div.lastChild;
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ var hasBody = rtbody.test(elem),
+ tbody = tag === "table" && !hasBody ?
+ div.firstChild && div.firstChild.childNodes :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !hasBody ?
+ div.childNodes :
+ [];
+
+ for ( var j = tbody.length - 1; j >= 0 ; --j ) {
+ if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+ tbody[ j ].parentNode.removeChild( tbody[ j ] );
+ }
+ }
+
+ }
+
+ // IE completely kills leading whitespace when innerHTML is used
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+ }
+
+ elem = div.childNodes;
+ }
+
+ if ( elem.nodeType ) {
+ ret.push( elem );
+ } else {
+ ret = jQuery.merge( ret, elem );
+ }
+ }
+
+ if ( fragment ) {
+ for ( i = 0; ret[i]; i++ ) {
+ if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
+ scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
+
+ } else {
+ if ( ret[i].nodeType === 1 ) {
+ ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
+ }
+ fragment.appendChild( ret[i] );
+ }
+ }
+ }
+
+ return ret;
+ },
+
+ cleanData: function( elems ) {
+ var data, id, cache = jQuery.cache,
+ special = jQuery.event.special,
+ deleteExpando = jQuery.support.deleteExpando;
+
+ for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+ if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
+ continue;
+ }
+
+ id = elem[ jQuery.expando ];
+
+ if ( id ) {
+ data = cache[ id ];
+
+ if ( data && data.events ) {
+ for ( var type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ if ( deleteExpando ) {
+ delete elem[ jQuery.expando ];
+
+ } else if ( elem.removeAttribute ) {
+ elem.removeAttribute( jQuery.expando );
+ }
+
+ delete cache[ id ];
+ }
+ }
+ }
+});
+
+function evalScript( i, elem ) {
+ if ( elem.src ) {
+ jQuery.ajax({
+ url: elem.src,
+ async: false,
+ dataType: "script"
+ });
+ } else {
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+ }
+
+ if ( elem.parentNode ) {
+ elem.parentNode.removeChild( elem );
+ }
+}
+
+
+
+
+var ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity=([^)]*)/,
+ rdashAlpha = /-([a-z])/ig,
+ rupper = /([A-Z])/g,
+ rnumpx = /^-?\d+(?:px)?$/i,
+ rnum = /^-?\d/,
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssWidth = [ "Left", "Right" ],
+ cssHeight = [ "Top", "Bottom" ],
+ curCSS,
+
+ getComputedStyle,
+ currentStyle,
+
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ };
+
+jQuery.fn.css = function( name, value ) {
+ // Setting 'undefined' is a no-op
+ if ( arguments.length === 2 && value === undefined ) {
+ return this;
+ }
+
+ return jQuery.access( this, name, value, true, function( elem, name, value ) {
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ });
+};
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity", "opacity" );
+ return ret === "" ? "1" : ret;
+
+ } else {
+ return elem.style.opacity;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "zIndex": true,
+ "fontWeight": true,
+ "opacity": true,
+ "zoom": true,
+ "lineHeight": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, origName = jQuery.camelCase( name ),
+ style = elem.style, hooks = jQuery.cssHooks[ origName ];
+
+ name = jQuery.cssProps[ origName ] || origName;
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( typeof value === "number" && isNaN( value ) || value == null ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra ) {
+ // Make sure that we're working with the right name
+ var ret, origName = jQuery.camelCase( name ),
+ hooks = jQuery.cssHooks[ origName ];
+
+ name = jQuery.cssProps[ origName ] || origName;
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
+ return ret;
+
+ // Otherwise, if a way to get the computed value exists, use that
+ } else if ( curCSS ) {
+ return curCSS( elem, name, origName );
+ }
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback ) {
+ var old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( var name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ callback.call( elem );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+ },
+
+ camelCase: function( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
+ }
+});
+
+// DEPRECATED, Use jQuery.css() instead
+jQuery.curCSS = jQuery.css;
+
+jQuery.each(["height", "width"], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ var val;
+
+ if ( computed ) {
+ if ( elem.offsetWidth !== 0 ) {
+ val = getWH( elem, name, extra );
+
+ } else {
+ jQuery.swap( elem, cssShow, function() {
+ val = getWH( elem, name, extra );
+ });
+ }
+
+ if ( val <= 0 ) {
+ val = curCSS( elem, name, name );
+
+ if ( val === "0px" && currentStyle ) {
+ val = currentStyle( elem, name, name );
+ }
+
+ if ( val != null ) {
+ // Should return "auto" instead of 0, use 0 for
+ // temporary backwards-compat
+ return val === "" || val === "auto" ? "0px" : val;
+ }
+ }
+
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+
+ // Should return "auto" instead of 0, use 0 for
+ // temporary backwards-compat
+ return val === "" || val === "auto" ? "0px" : val;
+ }
+
+ return typeof val === "string" ? val : val + "px";
+ }
+ },
+
+ set: function( elem, value ) {
+ if ( rnumpx.test( value ) ) {
+ // ignore negative width and height values #1599
+ value = parseFloat(value);
+
+ if ( value >= 0 ) {
+ return value + "px";
+ }
+
+ } else {
+ return value;
+ }
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ?
+ (parseFloat(RegExp.$1) / 100) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style;
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // Set the alpha filter to set the opacity
+ var opacity = jQuery.isNaN(value) ?
+ "" :
+ "alpha(opacity=" + value * 100 + ")",
+ filter = style.filter || "";
+
+ style.filter = ralpha.test(filter) ?
+ filter.replace(ralpha, opacity) :
+ style.filter + ' ' + opacity;
+ }
+ };
+}
+
+if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ getComputedStyle = function( elem, newName, name ) {
+ var ret, defaultView, computedStyle;
+
+ name = name.replace( rupper, "-$1" ).toLowerCase();
+
+ if ( !(defaultView = elem.ownerDocument.defaultView) ) {
+ return undefined;
+ }
+
+ if ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
+ ret = computedStyle.getPropertyValue( name );
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+ }
+
+ return ret;
+ };
+}
+
+if ( document.documentElement.currentStyle ) {
+ currentStyle = function( elem, name ) {
+ var left, rsLeft,
+ ret = elem.currentStyle && elem.currentStyle[ name ],
+ style = elem.style;
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
+ // Remember the original values
+ left = style.left;
+ rsLeft = elem.runtimeStyle.left;
+
+ // Put in the new values to get a computed value out
+ elem.runtimeStyle.left = elem.currentStyle.left;
+ style.left = name === "fontSize" ? "1em" : (ret || 0);
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ elem.runtimeStyle.left = rsLeft;
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+curCSS = getComputedStyle || currentStyle;
+
+function getWH( elem, name, extra ) {
+ var which = name === "width" ? cssWidth : cssHeight,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
+
+ if ( extra === "border" ) {
+ return val;
+ }
+
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
+ }
+
+ if ( extra === "margin" ) {
+ val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
+
+ } else {
+ val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
+ }
+ });
+
+ return val;
+}
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ var width = elem.offsetWidth,
+ height = elem.offsetHeight;
+
+ return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+
+
+
+var jsc = jQuery.now(),
+ rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+ rselectTextarea = /^(?:select|textarea)/i,
+ rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rbracket = /\[\]$/,
+ jsre = /\=\?(&|$)/,
+ rquery = /\?/,
+ rts = /([?&])_=[^&]*/,
+ rurl = /^(\w+:)?\/\/([^\/?#]+)/,
+ r20 = /%20/g,
+ rhash = /#.*$/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load;
+
+jQuery.fn.extend({
+ load: function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+
+ // Don't do a request if no elements are being requested
+ } else if ( !this.length ) {
+ return this;
+ }
+
+ var off = url.indexOf(" ");
+ if ( off >= 0 ) {
+ var selector = url.slice(off, url.length);
+ url = url.slice(0, off);
+ }
+
+ // Default to a GET request
+ var type = "GET";
+
+ // If the second parameter was provided
+ if ( params ) {
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+ // We assume that it's the callback
+ callback = params;
+ params = null;
+
+ // Otherwise, build a param string
+ } else if ( typeof params === "object" ) {
+ params = jQuery.param( params, jQuery.ajaxSettings.traditional );
+ type = "POST";
+ }
+ }
+
+ var self = this;
+
+ // Request the remote document
+ jQuery.ajax({
+ url: url,
+ type: type,
+ dataType: "html",
+ data: params,
+ complete: function( res, status ) {
+ // If successful, inject the HTML into all the matched elements
+ if ( status === "success" || status === "notmodified" ) {
+ // See if a selector was specified
+ self.html( selector ?
+ // Create a dummy div to hold the results
+ jQuery("<div>")
+ // inject the contents of the document in, removing the scripts
+ // to avoid any 'Permission Denied' errors in IE
+ .append(res.responseText.replace(rscript, ""))
+
+ // Locate the specified elements
+ .find(selector) :
+
+ // If not, just inject the full result
+ res.responseText );
+ }
+
+ if ( callback ) {
+ self.each( callback, [res.responseText, status, res] );
+ }
+ }
+ });
+
+ return this;
+ },
+
+ serialize: function() {
+ return jQuery.param(this.serializeArray());
+ },
+
+ serializeArray: function() {
+ return this.map(function() {
+ return this.elements ? jQuery.makeArray(this.elements) : this;
+ })
+ .filter(function() {
+ return this.name && !this.disabled &&
+ (this.checked || rselectTextarea.test(this.nodeName) ||
+ rinput.test(this.type));
+ })
+ .map(function( i, elem ) {
+ var val = jQuery(this).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray(val) ?
+ jQuery.map( val, function( val, i ) {
+ return { name: elem.name, value: val };
+ }) :
+ { name: elem.name, value: val };
+ }).get();
+ }
+});
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
+ jQuery.fn[o] = function( f ) {
+ return this.bind(o, f);
+ };
+});
+
+jQuery.extend({
+ get: function( url, data, callback, type ) {
+ // shift arguments if data argument was omited
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = null;
+ }
+
+ return jQuery.ajax({
+ type: "GET",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get(url, null, callback, "script");
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get(url, data, callback, "json");
+ },
+
+ post: function( url, data, callback, type ) {
+ // shift arguments if data argument was omited
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = {};
+ }
+
+ return jQuery.ajax({
+ type: "POST",
+ url: url,
+ data: data,
+ success: callback,
+ dataType: type
+ });
+ },
+
+ ajaxSetup: function( settings ) {
+ jQuery.extend( jQuery.ajaxSettings, settings );
+ },
+
+ ajaxSettings: {
+ url: location.href,
+ global: true,
+ type: "GET",
+ contentType: "application/x-www-form-urlencoded",
+ processData: true,
+ async: true,
+ /*
+ timeout: 0,
+ data: null,
+ username: null,
+ password: null,
+ traditional: false,
+ */
+ // This function can be overriden by calling jQuery.ajaxSetup
+ xhr: function() {
+ return new window.XMLHttpRequest();
+ },
+ accepts: {
+ xml: "application/xml, text/xml",
+ html: "text/html",
+ script: "text/javascript, application/javascript",
+ json: "application/json, text/javascript",
+ text: "text/plain",
+ _default: "*/*"
+ }
+ },
+
+ ajax: function( origSettings ) {
+ var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
+ jsonp, status, data, type = s.type.toUpperCase(), noContent = rnoContent.test(type);
+
+ s.url = s.url.replace( rhash, "" );
+
+ // Use original (not extended) context object if it was provided
+ s.context = origSettings && origSettings.context != null ? origSettings.context : s;
+
+ // convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Handle JSONP Parameter Callbacks
+ if ( s.dataType === "jsonp" ) {
+ if ( type === "GET" ) {
+ if ( !jsre.test( s.url ) ) {
+ s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
+ }
+ } else if ( !s.data || !jsre.test(s.data) ) {
+ s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
+ }
+ s.dataType = "json";
+ }
+
+ // Build temporary JSONP function
+ if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
+ jsonp = s.jsonpCallback || ("jsonp" + jsc++);
+
+ // Replace the =? sequence both in the query string and the data
+ if ( s.data ) {
+ s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
+ }
+
+ s.url = s.url.replace(jsre, "=" + jsonp + "$1");
+
+ // We need to make sure
+ // that a JSONP style response is executed properly
+ s.dataType = "script";
+
+ // Handle JSONP-style loading
+ var customJsonp = window[ jsonp ];
+
+ window[ jsonp ] = function( tmp ) {
+ if ( jQuery.isFunction( customJsonp ) ) {
+ customJsonp( tmp );
+
+ } else {
+ // Garbage collect
+ window[ jsonp ] = undefined;
+
+ try {
+ delete window[ jsonp ];
+ } catch( jsonpError ) {}
+ }
+
+ data = tmp;
+ jQuery.handleSuccess( s, xhr, status, data );
+ jQuery.handleComplete( s, xhr, status, data );
+
+ if ( head ) {
+ head.removeChild( script );
+ }
+ };
+ }
+
+ if ( s.dataType === "script" && s.cache === null ) {
+ s.cache = false;
+ }
+
+ if ( s.cache === false && noContent ) {
+ var ts = jQuery.now();
+
+ // try replacing _= if it is there
+ var ret = s.url.replace(rts, "$1_=" + ts);
+
+ // if nothing was replaced, add timestamp to the end
+ s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
+ }
+
+ // If data is available, append data to url for GET/HEAD requests
+ if ( s.data && noContent ) {
+ s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
+ }
+
+ // Watch for a new set of requests
+ if ( s.global && jQuery.active++ === 0 ) {
+ jQuery.event.trigger( "ajaxStart" );
+ }
+
+ // Matches an absolute URL, and saves the domain
+ var parts = rurl.exec( s.url ),
+ remote = parts && (parts[1] && parts[1].toLowerCase() !== location.protocol || parts[2].toLowerCase() !== location.host);
+
+ // If we're requesting a remote document
+ // and trying to load JSON or Script with a GET
+ if ( s.dataType === "script" && type === "GET" && remote ) {
+ var head = document.getElementsByTagName("head")[0] || document.documentElement;
+ var script = document.createElement("script");
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+ script.src = s.url;
+
+ // Handle Script loading
+ if ( !jsonp ) {
+ var done = false;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function() {
+ if ( !done && (!this.readyState ||
+ this.readyState === "loaded" || this.readyState === "complete") ) {
+ done = true;
+ jQuery.handleSuccess( s, xhr, status, data );
+ jQuery.handleComplete( s, xhr, status, data );
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+ if ( head && script.parentNode ) {
+ head.removeChild( script );
+ }
+ }
+ };
+ }
+
+ // Use insertBefore instead of appendChild to circumvent an IE6 bug.
+ // This arises when a base node is used (#2709 and #4378).
+ head.insertBefore( script, head.firstChild );
+
+ // We handle everything using the script element injection
+ return undefined;
+ }
+
+ var requestDone = false;
+
+ // Create the request object
+ var xhr = s.xhr();
+
+ if ( !xhr ) {
+ return;
+ }
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open(type, s.url, s.async, s.username, s.password);
+ } else {
+ xhr.open(type, s.url, s.async);
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ // Set content-type if data specified and content-body is valid for this type
+ if ( (s.data != null && !noContent) || (origSettings && origSettings.contentType) ) {
+ xhr.setRequestHeader("Content-Type", s.contentType);
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[s.url] ) {
+ xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url]);
+ }
+
+ if ( jQuery.etag[s.url] ) {
+ xhr.setRequestHeader("If-None-Match", jQuery.etag[s.url]);
+ }
+ }
+
+ // Set header so the called script knows that it's an XMLHttpRequest
+ // Only send the header if it's not a remote XHR
+ if ( !remote ) {
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
+ s.accepts[ s.dataType ] + ", */*; q=0.01" :
+ s.accepts._default );
+ } catch( headerError ) {}
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) {
+ // Handle the global AJAX counter
+ if ( s.global && jQuery.active-- === 1 ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+
+ // close opended socket
+ xhr.abort();
+ return false;
+ }
+
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxSend", [xhr, s] );
+ }
+
+ // Wait for a response to come back
+ var onreadystatechange = xhr.onreadystatechange = function( isTimeout ) {
+ // The request was aborted
+ if ( !xhr || xhr.readyState === 0 || isTimeout === "abort" ) {
+ // Opera doesn't call onreadystatechange before this point
+ // so we simulate the call
+ if ( !requestDone ) {
+ jQuery.handleComplete( s, xhr, status, data );
+ }
+
+ requestDone = true;
+ if ( xhr ) {
+ xhr.onreadystatechange = jQuery.noop;
+ }
+
+ // The transfer is complete and the data is available, or the request timed out
+ } else if ( !requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout") ) {
+ requestDone = true;
+ xhr.onreadystatechange = jQuery.noop;
+
+ status = isTimeout === "timeout" ?
+ "timeout" :
+ !jQuery.httpSuccess( xhr ) ?
+ "error" :
+ s.ifModified && jQuery.httpNotModified( xhr, s.url ) ?
+ "notmodified" :
+ "success";
+
+ var errMsg;
+
+ if ( status === "success" ) {
+ // Watch for, and catch, XML document parse errors
+ try {
+ // process the data (runs the xml through httpData regardless of callback)
+ data = jQuery.httpData( xhr, s.dataType, s );
+ } catch( parserError ) {
+ status = "parsererror";
+ errMsg = parserError;
+ }
+ }
+
+ // Make sure that the request was successful or notmodified
+ if ( status === "success" || status === "notmodified" ) {
+ // JSONP handles its own success callback
+ if ( !jsonp ) {
+ jQuery.handleSuccess( s, xhr, status, data );
+ }
+ } else {
+ jQuery.handleError( s, xhr, status, errMsg );
+ }
+
+ // Fire the complete handlers
+ if ( !jsonp ) {
+ jQuery.handleComplete( s, xhr, status, data );
+ }
+
+ if ( isTimeout === "timeout" ) {
+ xhr.abort();
+ }
+
+ // Stop memory leaks
+ if ( s.async ) {
+ xhr = null;
+ }
+ }
+ };
+
+ // Override the abort handler, if we can (IE 6 doesn't allow it, but that's OK)
+ // Opera doesn't fire onreadystatechange at all on abort
+ try {
+ var oldAbort = xhr.abort;
+ xhr.abort = function() {
+ if ( xhr ) {
+ // oldAbort has no call property in IE7 so
+ // just do it this way, which works in all
+ // browsers
+ Function.prototype.call.call( oldAbort, xhr );
+ }
+
+ onreadystatechange( "abort" );
+ };
+ } catch( abortError ) {}
+
+ // Timeout checker
+ if ( s.async && s.timeout > 0 ) {
+ setTimeout(function() {
+ // Check to see if the request is still happening
+ if ( xhr && !requestDone ) {
+ onreadystatechange( "timeout" );
+ }
+ }, s.timeout);
+ }
+
+ // Send the data
+ try {
+ xhr.send( noContent || s.data == null ? null : s.data );
+
+ } catch( sendError ) {
+ jQuery.handleError( s, xhr, null, sendError );
+
+ // Fire the complete handlers
+ jQuery.handleComplete( s, xhr, status, data );
+ }
+
+ // firefox 1.5 doesn't fire statechange for sync requests
+ if ( !s.async ) {
+ onreadystatechange();
+ }
+
+ // return XMLHttpRequest to allow aborting the request etc.
+ return xhr;
+ },
+
+ // Serialize an array of form elements or a set of
+ // key/values into a query string
+ param: function( a, traditional ) {
+ var s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction(value) ? value() : value;
+ s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray(a) || a.jquery ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( var prefix in a ) {
+ buildParams( prefix, a[prefix], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join("&").replace(r20, "+");
+ }
+});
+
+function buildParams( prefix, obj, traditional, add ) {
+ if ( jQuery.isArray(obj) && obj.length ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // If array item is non-scalar (array or object), encode its
+ // numeric index to resolve deserialization ambiguity issues.
+ // Note that rack (as of 1.0.0) can't currently deserialize
+ // nested arrays properly, and attempting to do so may cause
+ // a server error. Possible fixes are to modify rack's
+ // deserialization algorithm or to provide an option or flag
+ // to force array serialization to be shallow.
+ buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && obj != null && typeof obj === "object" ) {
+ if ( jQuery.isEmptyObject( obj ) ) {
+ add( prefix, "" );
+
+ // Serialize object item.
+ } else {
+ jQuery.each( obj, function( k, v ) {
+ buildParams( prefix + "[" + k + "]", v, traditional, add );
+ });
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+
+// This is still on the jQuery object... for now
+// Want to move this to jQuery.ajax some day
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ handleError: function( s, xhr, status, e ) {
+ // If a local callback was specified, fire it
+ if ( s.error ) {
+ s.error.call( s.context, xhr, status, e );
+ }
+
+ // Fire the global callback
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxError", [xhr, s, e] );
+ }
+ },
+
+ handleSuccess: function( s, xhr, status, data ) {
+ // If a local callback was specified, fire it and pass it the data
+ if ( s.success ) {
+ s.success.call( s.context, data, status, xhr );
+ }
+
+ // Fire the global callback
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxSuccess", [xhr, s] );
+ }
+ },
+
+ handleComplete: function( s, xhr, status ) {
+ // Process result
+ if ( s.complete ) {
+ s.complete.call( s.context, xhr, status );
+ }
+
+ // The request was completed
+ if ( s.global ) {
+ jQuery.triggerGlobal( s, "ajaxComplete", [xhr, s] );
+ }
+
+ // Handle the global AJAX counter
+ if ( s.global && jQuery.active-- === 1 ) {
+ jQuery.event.trigger( "ajaxStop" );
+ }
+ },
+
+ triggerGlobal: function( s, type, args ) {
+ (s.context && s.context.url == null ? jQuery(s.context) : jQuery.event).trigger(type, args);
+ },
+
+ // Determines if an XMLHttpRequest was successful or not
+ httpSuccess: function( xhr ) {
+ try {
+ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450
+ return !xhr.status && location.protocol === "file:" ||
+ xhr.status >= 200 && xhr.status < 300 ||
+ xhr.status === 304 || xhr.status === 1223;
+ } catch(e) {}
+
+ return false;
+ },
+
+ // Determines if an XMLHttpRequest returns NotModified
+ httpNotModified: function( xhr, url ) {
+ var lastModified = xhr.getResponseHeader("Last-Modified"),
+ etag = xhr.getResponseHeader("Etag");
+
+ if ( lastModified ) {
+ jQuery.lastModified[url] = lastModified;
+ }
+
+ if ( etag ) {
+ jQuery.etag[url] = etag;
+ }
+
+ return xhr.status === 304;
+ },
+
+ httpData: function( xhr, type, s ) {
+ var ct = xhr.getResponseHeader("content-type") || "",
+ xml = type === "xml" || !type && ct.indexOf("xml") >= 0,
+ data = xml ? xhr.responseXML : xhr.responseText;
+
+ if ( xml && data.documentElement.nodeName === "parsererror" ) {
+ jQuery.error( "parsererror" );
+ }
+
+ // Allow a pre-filtering function to sanitize the response
+ // s is checked to keep backwards compatibility
+ if ( s && s.dataFilter ) {
+ data = s.dataFilter( data, type );
+ }
+
+ // The filter can actually parse the response
+ if ( typeof data === "string" ) {
+ // Get the JavaScript object, if JSON is used.
+ if ( type === "json" || !type && ct.indexOf("json") >= 0 ) {
+ data = jQuery.parseJSON( data );
+
+ // If the type is "script", eval it in global context
+ } else if ( type === "script" || !type && ct.indexOf("javascript") >= 0 ) {
+ jQuery.globalEval( data );
+ }
+ }
+
+ return data;
+ }
+
+});
+
+/*
+ * Create the request object; Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+if ( window.ActiveXObject ) {
+ jQuery.ajaxSettings.xhr = function() {
+ if ( window.location.protocol !== "file:" ) {
+ try {
+ return new window.XMLHttpRequest();
+ } catch(xhrError) {}
+ }
+
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch(activeError) {}
+ };
+}
+
+// Does this browser support XHR requests?
+jQuery.support.ajax = !!jQuery.ajaxSettings.xhr();
+
+
+
+
+var elemdisplay = {},
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/,
+ timerId,
+ fxAttrs = [
+ // height animations
+ [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
+ // width animations
+ [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
+ // opacity animations
+ [ "opacity" ]
+ ];
+
+jQuery.fn.extend({
+ show: function( speed, easing, callback ) {
+ var elem, display;
+
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("show", 3), speed, easing, callback);
+
+ } else {
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ elem = this[i];
+ display = elem.style.display;
+
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
+ display = elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( display === "" && jQuery.css( elem, "display" ) === "none" ) {
+ jQuery.data(elem, "olddisplay", defaultDisplay(elem.nodeName));
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ elem = this[i];
+ display = elem.style.display;
+
+ if ( display === "" || display === "none" ) {
+ elem.style.display = jQuery.data(elem, "olddisplay") || "";
+ }
+ }
+
+ return this;
+ }
+ },
+
+ hide: function( speed, easing, callback ) {
+ if ( speed || speed === 0 ) {
+ return this.animate( genFx("hide", 3), speed, easing, callback);
+
+ } else {
+ for ( var i = 0, j = this.length; i < j; i++ ) {
+ var display = jQuery.css( this[i], "display" );
+
+ if ( display !== "none" ) {
+ jQuery.data( this[i], "olddisplay", display );
+ }
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( i = 0; i < j; i++ ) {
+ this[i].style.display = "none";
+ }
+
+ return this;
+ }
+ },
+
+ // Save the old toggle function
+ _toggle: jQuery.fn.toggle,
+
+ toggle: function( fn, fn2, callback ) {
+ var bool = typeof fn === "boolean";
+
+ if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
+ this._toggle.apply( this, arguments );
+
+ } else if ( fn == null || bool ) {
+ this.each(function() {
+ var state = bool ? fn : jQuery(this).is(":hidden");
+ jQuery(this)[ state ? "show" : "hide" ]();
+ });
+
+ } else {
+ this.animate(genFx("toggle", 3), fn, fn2, callback);
+ }
+
+ return this;
+ },
+
+ fadeTo: function( speed, to, easing, callback ) {
+ return this.filter(":hidden").css("opacity", 0).show().end()
+ .animate({opacity: to}, speed, easing, callback);
+ },
+
+ animate: function( prop, speed, easing, callback ) {
+ var optall = jQuery.speed(speed, easing, callback);
+
+ if ( jQuery.isEmptyObject( prop ) ) {
+ return this.each( optall.complete );
+ }
+
+ return this[ optall.queue === false ? "each" : "queue" ](function() {
+ // XXX 'this' does not always have a nodeName when running the
+ // test suite
+
+ var opt = jQuery.extend({}, optall), p,
+ isElement = this.nodeType === 1,
+ hidden = isElement && jQuery(this).is(":hidden"),
+ self = this;
+
+ for ( p in prop ) {
+ var name = jQuery.camelCase( p );
+
+ if ( p !== name ) {
+ prop[ name ] = prop[ p ];
+ delete prop[ p ];
+ p = name;
+ }
+
+ if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) {
+ return opt.complete.call(this);
+ }
+
+ if ( isElement && ( p === "height" || p === "width" ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height
+ // animated
+ if ( jQuery.css( this, "display" ) === "inline" &&
+ jQuery.css( this, "float" ) === "none" ) {
+ if ( !jQuery.support.inlineBlockNeedsLayout ) {
+ this.style.display = "inline-block";
+
+ } else {
+ var display = defaultDisplay(this.nodeName);
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( display === "inline" ) {
+ this.style.display = "inline-block";
+
+ } else {
+ this.style.display = "inline";
+ this.style.zoom = 1;
+ }
+ }
+ }
+ }
+
+ if ( jQuery.isArray( prop[p] ) ) {
+ // Create (if needed) and add to specialEasing
+ (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
+ prop[p] = prop[p][0];
+ }
+ }
+
+ if ( opt.overflow != null ) {
+ this.style.overflow = "hidden";
+ }
+
+ opt.curAnim = jQuery.extend({}, prop);
+
+ jQuery.each( prop, function( name, val ) {
+ var e = new jQuery.fx( self, opt, name );
+
+ if ( rfxtypes.test(val) ) {
+ e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop );
+
+ } else {
+ var parts = rfxnum.exec(val),
+ start = e.cur() || 0;
+
+ if ( parts ) {
+ var end = parseFloat( parts[2] ),
+ unit = parts[3] || "px";
+
+ // We need to compute starting value
+ if ( unit !== "px" ) {
+ jQuery.style( self, name, (end || 1) + unit);
+ start = ((end || 1) / e.cur()) * start;
+ jQuery.style( self, name, start + unit);
+ }
+
+ // If a +=/-= token was provided, we're doing a relative animation
+ if ( parts[1] ) {
+ end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
+ }
+
+ e.custom( start, end, unit );
+
+ } else {
+ e.custom( start, val, "" );
+ }
+ }
+ });
+
+ // For JS strict compliance
+ return true;
+ });
+ },
+
+ stop: function( clearQueue, gotoEnd ) {
+ var timers = jQuery.timers;
+
+ if ( clearQueue ) {
+ this.queue([]);
+ }
+
+ this.each(function() {
+ // go in reverse order so anything added to the queue during the loop is ignored
+ for ( var i = timers.length - 1; i >= 0; i-- ) {
+ if ( timers[i].elem === this ) {
+ if (gotoEnd) {
+ // force the next step to be the last
+ timers[i](true);
+ }
+
+ timers.splice(i, 1);
+ }
+ }
+ });
+
+ // start the next in the queue if the last step wasn't forced
+ if ( !gotoEnd ) {
+ this.dequeue();
+ }
+
+ return this;
+ }
+
+});
+
+function genFx( type, num ) {
+ var obj = {};
+
+ jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
+ obj[ this ] = type;
+ });
+
+ return obj;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show", 1),
+ slideUp: genFx("hide", 1),
+ slideToggle: genFx("toggle", 1),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.extend({
+ speed: function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
+
+ // Queueing
+ opt.old = opt.complete;
+ opt.complete = function() {
+ if ( opt.queue !== false ) {
+ jQuery(this).dequeue();
+ }
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+ };
+
+ return opt;
+ },
+
+ easing: {
+ linear: function( p, n, firstNum, diff ) {
+ return firstNum + diff * p;
+ },
+ swing: function( p, n, firstNum, diff ) {
+ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
+ }
+ },
+
+ timers: [],
+
+ fx: function( elem, options, prop ) {
+ this.options = options;
+ this.elem = elem;
+ this.prop = prop;
+
+ if ( !options.orig ) {
+ options.orig = {};
+ }
+ }
+
+});
+
+jQuery.fx.prototype = {
+ // Simple function for setting a style value
+ update: function() {
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ (jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
+ },
+
+ // Get the current size
+ cur: function() {
+ if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
+ return this.elem[ this.prop ];
+ }
+
+ var r = parseFloat( jQuery.css( this.elem, this.prop ) );
+ return r && r > -10000 ? r : 0;
+ },
+
+ // Start an animation from one number to another
+ custom: function( from, to, unit ) {
+ var self = this,
+ fx = jQuery.fx;
+
+ this.startTime = jQuery.now();
+ this.start = from;
+ this.end = to;
+ this.unit = unit || this.unit || "px";
+ this.now = this.start;
+ this.pos = this.state = 0;
+
+ function t( gotoEnd ) {
+ return self.step(gotoEnd);
+ }
+
+ t.elem = this.elem;
+
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval(fx.tick, fx.interval);
+ }
+ },
+
+ // Simple 'show' function
+ show: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
+ this.options.show = true;
+
+ // Begin the animation
+ // Make sure that we start at a small width/height to avoid any
+ // flash of content
+ this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur());
+
+ // Start by showing the element
+ jQuery( this.elem ).show();
+ },
+
+ // Simple 'hide' function
+ hide: function() {
+ // Remember where we started, so that we can go back to it later
+ this.options.orig[this.prop] = jQuery.style( this.elem, this.prop );
+ this.options.hide = true;
+
+ // Begin the animation
+ this.custom(this.cur(), 0);
+ },
+
+ // Each step of an animation
+ step: function( gotoEnd ) {
+ var t = jQuery.now(), done = true;
+
+ if ( gotoEnd || t >= this.options.duration + this.startTime ) {
+ this.now = this.end;
+ this.pos = this.state = 1;
+ this.update();
+
+ this.options.curAnim[ this.prop ] = true;
+
+ for ( var i in this.options.curAnim ) {
+ if ( this.options.curAnim[i] !== true ) {
+ done = false;
+ }
+ }
+
+ if ( done ) {
+ // Reset the overflow
+ if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
+ var elem = this.elem,
+ options = this.options;
+
+ jQuery.each( [ "", "X", "Y" ], function (index, value) {
+ elem.style[ "overflow" + value ] = options.overflow[index];
+ } );
+ }
+
+ // Hide the element if the "hide" operation was done
+ if ( this.options.hide ) {
+ jQuery(this.elem).hide();
+ }
+
+ // Reset the properties, if the item has been hidden or shown
+ if ( this.options.hide || this.options.show ) {
+ for ( var p in this.options.curAnim ) {
+ jQuery.style( this.elem, p, this.options.orig[p] );
+ }
+ }
+
+ // Execute the complete function
+ this.options.complete.call( this.elem );
+ }
+
+ return false;
+
+ } else {
+ var n = t - this.startTime;
+ this.state = n / this.options.duration;
+
+ // Perform the easing function, defaults to swing
+ var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
+ var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
+ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
+ this.now = this.start + ((this.end - this.start) * this.pos);
+
+ // Perform the next step of the animation
+ this.update();
+ }
+
+ return true;
+ }
+};
+
+jQuery.extend( jQuery.fx, {
+ tick: function() {
+ var timers = jQuery.timers;
+
+ for ( var i = 0; i < timers.length; i++ ) {
+ if ( !timers[i]() ) {
+ timers.splice(i--, 1);
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ },
+
+ interval: 13,
+
+ stop: function() {
+ clearInterval( timerId );
+ timerId = null;
+ },
+
+ speeds: {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+ },
+
+ step: {
+ opacity: function( fx ) {
+ jQuery.style( fx.elem, "opacity", fx.now );
+ },
+
+ _default: function( fx ) {
+ if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
+ fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
+ } else {
+ fx.elem[ fx.prop ] = fx.now;
+ }
+ }
+ }
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+
+function defaultDisplay( nodeName ) {
+ if ( !elemdisplay[ nodeName ] ) {
+ var elem = jQuery("<" + nodeName + ">").appendTo("body"),
+ display = elem.css("display");
+
+ elem.remove();
+
+ if ( display === "none" || display === "" ) {
+ display = "block";
+ }
+
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return elemdisplay[ nodeName ];
+}
+
+
+
+
+var rtable = /^t(?:able|d|h)$/i,
+ rroot = /^(?:body|html)$/i;
+
+if ( "getBoundingClientRect" in document.documentElement ) {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0], box;
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ try {
+ box = elem.getBoundingClientRect();
+ } catch(e) {}
+
+ var doc = elem.ownerDocument,
+ docElem = doc.documentElement;
+
+ // Make sure we're not dealing with a disconnected DOM node
+ if ( !box || !jQuery.contains( docElem, elem ) ) {
+ return box || { top: 0, left: 0 };
+ }
+
+ var body = doc.body,
+ win = getWindow(doc),
+ clientTop = docElem.clientTop || body.clientTop || 0,
+ clientLeft = docElem.clientLeft || body.clientLeft || 0,
+ scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ),
+ scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
+ top = box.top + scrollTop - clientTop,
+ left = box.left + scrollLeft - clientLeft;
+
+ return { top: top, left: left };
+ };
+
+} else {
+ jQuery.fn.offset = function( options ) {
+ var elem = this[0];
+
+ if ( options ) {
+ return this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ if ( !elem || !elem.ownerDocument ) {
+ return null;
+ }
+
+ if ( elem === elem.ownerDocument.body ) {
+ return jQuery.offset.bodyOffset( elem );
+ }
+
+ jQuery.offset.initialize();
+
+ var computedStyle,
+ offsetParent = elem.offsetParent,
+ prevOffsetParent = elem,
+ doc = elem.ownerDocument,
+ docElem = doc.documentElement,
+ body = doc.body,
+ defaultView = doc.defaultView,
+ prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
+ top = elem.offsetTop,
+ left = elem.offsetLeft;
+
+ while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ break;
+ }
+
+ computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
+ top -= elem.scrollTop;
+ left -= elem.scrollLeft;
+
+ if ( elem === offsetParent ) {
+ top += elem.offsetTop;
+ left += elem.offsetLeft;
+
+ if ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevOffsetParent = offsetParent;
+ offsetParent = elem.offsetParent;
+ }
+
+ if ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
+ top += parseFloat( computedStyle.borderTopWidth ) || 0;
+ left += parseFloat( computedStyle.borderLeftWidth ) || 0;
+ }
+
+ prevComputedStyle = computedStyle;
+ }
+
+ if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
+ top += body.offsetTop;
+ left += body.offsetLeft;
+ }
+
+ if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
+ top += Math.max( docElem.scrollTop, body.scrollTop );
+ left += Math.max( docElem.scrollLeft, body.scrollLeft );
+ }
+
+ return { top: top, left: left };
+ };
+}
+
+jQuery.offset = {
+ initialize: function() {
+ var body = document.body, container = document.createElement("div"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, "marginTop") ) || 0,
+ html = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
+
+ jQuery.extend( container.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" } );
+
+ container.innerHTML = html;
+ body.insertBefore( container, body.firstChild );
+ innerDiv = container.firstChild;
+ checkDiv = innerDiv.firstChild;
+ td = innerDiv.nextSibling.firstChild.firstChild;
+
+ this.doesNotAddBorder = (checkDiv.offsetTop !== 5);
+ this.doesAddBorderForTableAndCells = (td.offsetTop === 5);
+
+ checkDiv.style.position = "fixed";
+ checkDiv.style.top = "20px";
+
+ // safari subtracts parent border width here which is 5px
+ this.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);
+ checkDiv.style.position = checkDiv.style.top = "";
+
+ innerDiv.style.overflow = "hidden";
+ innerDiv.style.position = "relative";
+
+ this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);
+
+ this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);
+
+ body.removeChild( container );
+ body = container = innerDiv = checkDiv = table = td = null;
+ jQuery.offset.initialize = jQuery.noop;
+ },
+
+ bodyOffset: function( body ) {
+ var top = body.offsetTop,
+ left = body.offsetLeft;
+
+ jQuery.offset.initialize();
+
+ if ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {
+ top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
+ left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
+ }
+
+ return { top: top, left: left };
+ },
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1),
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is absolute
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ }
+
+ curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0;
+ curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0;
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if (options.top != null) {
+ props.top = (options.top - curOffset.top) + curTop;
+ }
+ if (options.left != null) {
+ props.left = (options.left - curOffset.left) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+ position: function() {
+ if ( !this[0] ) {
+ return null;
+ }
+
+ var elem = this[0],
+
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent(),
+
+ // Get correct offsets
+ offset = this.offset(),
+ parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+ // Subtract element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
+ offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
+
+ // Add offsetParent borders
+ parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
+ parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
+
+ // Subtract the two offsets
+ return {
+ top: offset.top - parentOffset.top,
+ left: offset.left - parentOffset.left
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.body;
+ while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( ["Left", "Top"], function( i, name ) {
+ var method = "scroll" + name;
+
+ jQuery.fn[ method ] = function(val) {
+ var elem = this[0], win;
+
+ if ( !elem ) {
+ return null;
+ }
+
+ if ( val !== undefined ) {
+ // Set the scroll offset
+ return this.each(function() {
+ win = getWindow( this );
+
+ if ( win ) {
+ win.scrollTo(
+ !i ? val : jQuery(win).scrollLeft(),
+ i ? val : jQuery(win).scrollTop()
+ );
+
+ } else {
+ this[ method ] = val;
+ }
+ });
+ } else {
+ win = getWindow( elem );
+
+ // Return the scroll offset
+ return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
+ jQuery.support.boxModel && win.document.documentElement[ method ] ||
+ win.document.body[ method ] :
+ elem[ method ];
+ }
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+
+
+
+
+// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+jQuery.each([ "Height", "Width" ], function( i, name ) {
+
+ var type = name.toLowerCase();
+
+ // innerHeight and innerWidth
+ jQuery.fn["inner" + name] = function() {
+ return this[0] ?
+ parseFloat( jQuery.css( this[0], type, "padding" ) ) :
+ null;
+ };
+
+ // outerHeight and outerWidth
+ jQuery.fn["outer" + name] = function( margin ) {
+ return this[0] ?
+ parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
+ null;
+ };
+
+ jQuery.fn[ type ] = function( size ) {
+ // Get window width or height
+ var elem = this[0];
+ if ( !elem ) {
+ return size == null ? null : this;
+ }
+
+ if ( jQuery.isFunction( size ) ) {
+ return this.each(function( i ) {
+ var self = jQuery( this );
+ self[ type ]( size.call( this, i, self[ type ]() ) );
+ });
+ }
+
+ if ( jQuery.isWindow( elem ) ) {
+ // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
+ return elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
+ elem.document.body[ "client" + name ];
+
+ // Get document width or height
+ } else if ( elem.nodeType === 9 ) {
+ // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
+ return Math.max(
+ elem.documentElement["client" + name],
+ elem.body["scroll" + name], elem.documentElement["scroll" + name],
+ elem.body["offset" + name], elem.documentElement["offset" + name]
+ );
+
+ // Get or set width or height on the element
+ } else if ( size === undefined ) {
+ var orig = jQuery.css( elem, type ),
+ ret = parseFloat( orig );
+
+ return jQuery.isNaN( ret ) ? orig : ret;
+
+ // Set the width or height on the element (default to pixels if value is unitless)
+ } else {
+ return this.css( type, typeof size === "string" ? size : size + "px" );
+ }
+ };
+
+});
+
+
+})(window);
diff --git a/src/pootle_it/html/js/jquery/jquery.jsonp.js b/src/pootle_it/html/js/jquery/jquery.jsonp.js
new file mode 100644
index 0000000..9c00417
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.jsonp.js
@@ -0,0 +1,261 @@
+/*
+ * jQuery JSONP Core Plugin 2.1.4 (2010-11-17)
+ *
+ * http://code.google.com/p/jquery-jsonp/
+ *
+ * Copyright (c) 2010 Julian Aubourg
+ *
+ * This document is licensed as free software under the terms of the
+ * MIT License: http://www.opensource.org/licenses/mit-license.php
+ */
+( function( $ , setTimeout ) {
+
+ // ###################### UTILITIES ##
+
+ // Noop
+ function noop() {
+ }
+
+ // Generic callback
+ function genericCallback( data ) {
+ lastValue = [ data ];
+ }
+
+ // Add script to document
+ function appendScript( node ) {
+ head.insertBefore( node , head.firstChild );
+ }
+
+ // Call if defined
+ function callIfDefined( method , object , parameters ) {
+ return method && method.apply( object.context || object , parameters );
+ }
+
+ // Give joining character given url
+ function qMarkOrAmp( url ) {
+ return /\?/ .test( url ) ? "&" : "?";
+ }
+
+ var // String constants (for better minification)
+ STR_ASYNC = "async",
+ STR_CHARSET = "charset",
+ STR_EMPTY = "",
+ STR_ERROR = "error",
+ STR_JQUERY_JSONP = "_jqjsp",
+ STR_ON = "on",
+ STR_ONCLICK = STR_ON + "click",
+ STR_ONERROR = STR_ON + STR_ERROR,
+ STR_ONLOAD = STR_ON + "load",
+ STR_ONREADYSTATECHANGE = STR_ON + "readystatechange",
+ STR_REMOVE_CHILD = "removeChild",
+ STR_SCRIPT_TAG = "<script/>",
+ STR_SUCCESS = "success",
+ STR_TIMEOUT = "timeout",
+
+ // Shortcut to jQuery.browser
+ browser = $.browser,
+
+ // Head element (for faster use)
+ head = $( "head" )[ 0 ] || document.documentElement,
+ // Page cache
+ pageCache = {},
+ // Counter
+ count = 0,
+ // Last returned value
+ lastValue,
+
+ // ###################### DEFAULT OPTIONS ##
+ xOptionsDefaults = {
+ //beforeSend: undefined,
+ //cache: false,
+ callback: STR_JQUERY_JSONP,
+ //callbackParameter: undefined,
+ //charset: undefined,
+ //complete: undefined,
+ //context: undefined,
+ //data: "",
+ //dataFilter: undefined,
+ //error: undefined,
+ //pageCache: false,
+ //success: undefined,
+ //timeout: 0,
+ //traditional: false,
+ url: location.href
+ };
+
+ // ###################### MAIN FUNCTION ##
+ function jsonp( xOptions ) {
+
+ // Build data with default
+ xOptions = $.extend( {} , xOptionsDefaults , xOptions );
+
+ // References to xOptions members (for better minification)
+ var completeCallback = xOptions.complete,
+ dataFilter = xOptions.dataFilter,
+ callbackParameter = xOptions.callbackParameter,
+ successCallbackName = xOptions.callback,
+ cacheFlag = xOptions.cache,
+ pageCacheFlag = xOptions.pageCache,
+ charset = xOptions.charset,
+ url = xOptions.url,
+ data = xOptions.data,
+ timeout = xOptions.timeout,
+ pageCached,
+
+ // Abort/done flag
+ done = 0,
+
+ // Life-cycle functions
+ cleanUp = noop;
+
+ // Create the abort method
+ xOptions.abort = function() {
+ ! done++ && cleanUp();
+ };
+
+ // Call beforeSend if provided (early abort if false returned)
+ if ( callIfDefined( xOptions.beforeSend, xOptions , [ xOptions ] ) === false || done ) {
+ return xOptions;
+ }
+
+ // Control entries
+ url = url || STR_EMPTY;
+ data = data ? ( (typeof data) == "string" ? data : $.param( data , xOptions.traditional ) ) : STR_EMPTY;
+
+ // Build final url
+ url += data ? ( qMarkOrAmp( url ) + data ) : STR_EMPTY;
+
+ // Add callback parameter if provided as option
+ callbackParameter && ( url += qMarkOrAmp( url ) + encodeURIComponent( callbackParameter ) + "=?" );
+
+ // Add anticache parameter if needed
+ ! cacheFlag && ! pageCacheFlag && ( url += qMarkOrAmp( url ) + "_" + ( new Date() ).getTime() + "=" );
+
+ // Replace last ? by callback parameter
+ url = url.replace( /=\?(&|$)/ , "=" + successCallbackName + "$1" );
+
+ // Success notifier
+ function notifySuccess( json ) {
+ ! done++ && setTimeout( function() {
+ cleanUp();
+ // Pagecache if needed
+ pageCacheFlag && ( pageCache [ url ] = { s: [ json ] } );
+ // Apply the data filter if provided
+ dataFilter && ( json = dataFilter.apply( xOptions , [ json ] ) );
+ // Call success then complete
+ callIfDefined( xOptions.success , xOptions , [ json , STR_SUCCESS ] );
+ callIfDefined( completeCallback , xOptions , [ xOptions , STR_SUCCESS ] );
+ } , 0 );
+ }
+
+ // Error notifier
+ function notifyError( type ) {
+ ! done++ && setTimeout( function() {
+ // Clean up
+ cleanUp();
+ // If pure error (not timeout), cache if needed
+ pageCacheFlag && type != STR_TIMEOUT && ( pageCache[ url ] = type );
+ // Call error then complete
+ callIfDefined( xOptions.error , xOptions , [ xOptions , type ] );
+ callIfDefined( completeCallback , xOptions , [ xOptions , type ] );
+ } , 0 );
+ }
+
+ // Check page cache
+ pageCacheFlag && ( pageCached = pageCache[ url ] )
+ ? ( pageCached.s ? notifySuccess( pageCached.s[ 0 ] ) : notifyError( pageCached ) )
+ :
+ // Initiate request
+ setTimeout( function( script , scriptAfter , timeoutTimer ) {
+
+ if ( ! done ) {
+
+ // If a timeout is needed, install it
+ timeoutTimer = timeout > 0 && setTimeout( function() {
+ notifyError( STR_TIMEOUT );
+ } , timeout );
+
+ // Re-declare cleanUp function
+ cleanUp = function() {
+ timeoutTimer && clearTimeout( timeoutTimer );
+ script[ STR_ONREADYSTATECHANGE ]
+ = script[ STR_ONCLICK ]
+ = script[ STR_ONLOAD ]
+ = script[ STR_ONERROR ]
+ = null;
+ head[ STR_REMOVE_CHILD ]( script );
+ scriptAfter && head[ STR_REMOVE_CHILD ]( scriptAfter );
+ };
+
+ // Install the generic callback
+ // (BEWARE: global namespace pollution ahoy)
+ window[ successCallbackName ] = genericCallback;
+
+ // Create the script tag
+ script = $( STR_SCRIPT_TAG )[ 0 ];
+ script.id = STR_JQUERY_JSONP + count++;
+
+ // Set charset if provided
+ if ( charset ) {
+ script[ STR_CHARSET ] = charset;
+ }
+
+ // Callback function
+ function callback( result ) {
+ ( script[ STR_ONCLICK ] || noop )();
+ result = lastValue;
+ lastValue = undefined;
+ result ? notifySuccess( result[ 0 ] ) : notifyError( STR_ERROR );
+ }
+
+ // IE: event/htmlFor/onclick trick
+ // One can't rely on proper order for onreadystatechange
+ // We have to sniff since FF doesn't like event & htmlFor... at all
+ if ( browser.msie ) {
+
+ script.event = STR_ONCLICK;
+ script.htmlFor = script.id;
+ script[ STR_ONREADYSTATECHANGE ] = function() {
+ /loaded|complete/.test( script.readyState ) && callback();
+ };
+
+ // All others: standard handlers
+ } else {
+
+ script[ STR_ONERROR ] = script[ STR_ONLOAD ] = callback;
+
+ browser.opera ?
+
+ // Opera: onerror is not called, use synchronized script execution
+ ( ( scriptAfter = $( STR_SCRIPT_TAG )[ 0 ] ).text = "jQuery('#" + script.id + "')[0]." + STR_ONERROR + "()" )
+
+ // Firefox: set script as async to avoid blocking scripts (3.6+ only)
+ : script[ STR_ASYNC ] = STR_ASYNC;
+
+ ;
+ }
+
+ // Set source
+ script.src = url;
+
+ // Append main script
+ appendScript( script );
+
+ // Opera: Append trailing script
+ scriptAfter && appendScript( scriptAfter );
+ }
+
+ } , 0 );
+
+ return xOptions;
+ }
+
+ // ###################### SETUP FUNCTION ##
+ jsonp.setup = function( xOptions ) {
+ $.extend( xOptionsDefaults , xOptions );
+ };
+
+ // ###################### INSTALL in jQuery ##
+ $.jsonp = jsonp;
+
+} )( jQuery , setTimeout ); \ No newline at end of file
diff --git a/src/pootle_it/html/js/jquery/jquery.serializeObject.js b/src/pootle_it/html/js/jquery/jquery.serializeObject.js
new file mode 100644
index 0000000..03b905b
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.serializeObject.js
@@ -0,0 +1,31 @@
+/*!
+ * jQuery serializeObject - v0.2 - 1/20/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ *
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+
+// Whereas .serializeArray() serializes a form into an array, .serializeObject()
+// serializes a form into an (arguably more useful) object.
+
+(function($,undefined){
+ '$:nomunge'; // Used by YUI compressor.
+
+ $.fn.serializeObject = function(){
+ var obj = {};
+
+ $.each( this.serializeArray(), function(i,o){
+ var n = o.name,
+ v = o.value;
+
+ obj[n] = obj[n] === undefined ? v
+ : $.isArray( obj[n] ) ? obj[n].concat( v )
+ : [ obj[n], v ];
+ });
+
+ return obj;
+ };
+
+})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.textarea-expander.js b/src/pootle_it/html/js/jquery/jquery.textarea-expander.js
new file mode 100644
index 0000000..da31a7e
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.textarea-expander.js
@@ -0,0 +1,95 @@
+/**
+ * TextAreaExpander plugin for jQuery
+ * v1.0
+ * Expands or contracts a textarea height depending on the
+ * quatity of content entered by the user in the box.
+ *
+ * By Craig Buckler, Optimalworks.net
+ *
+ * As featured on SitePoint.com:
+ * http://www.sitepoint.com/blogs/2009/07/29/build-auto-expanding-textarea-1/
+ *
+ * Please use as you wish at your own risk.
+ */
+
+/**
+ * Usage:
+ *
+ * From JavaScript, use:
+ * $(<node>).TextAreaExpander(<minHeight>, <maxHeight>);
+ * where:
+ * <node> is the DOM node selector, e.g. "textarea"
+ * <minHeight> is the minimum textarea height in pixels (optional)
+ * <maxHeight> is the maximum textarea height in pixels (optional)
+ *
+ * Alternatively, in you HTML:
+ * Assign a class of "expand" to any <textarea> tag.
+ * e.g. <textarea name="textarea1" rows="3" cols="40" class="expand"></textarea>
+ *
+ * Or assign a class of "expandMIN-MAX" to set the <textarea> minimum and maximum height.
+ * e.g. <textarea name="textarea1" rows="3" cols="40" class="expand50-200"></textarea>
+ * The textarea will use an appropriate height between 50 and 200 pixels.
+ */
+
+(function($) {
+
+ // jQuery plugin definition
+ $.fn.TextAreaExpander = function(minHeight, maxHeight) {
+
+ var hCheck = !($.browser.msie || $.browser.opera);
+
+ // resize a textarea
+ function ResizeTextarea(e) {
+
+ // event or initialize element?
+ e = e.target || e;
+
+ // find content length and box width
+ var vlen = e.value.length, ewidth = e.offsetWidth;
+ if (vlen != e.valLength || ewidth != e.boxWidth) {
+
+ if (hCheck && (vlen < e.valLength || ewidth != e.boxWidth)) e.style.height = "0px";
+ var h = Math.max(e.expandMin, Math.min(e.scrollHeight, e.expandMax));
+
+ e.style.overflow = (e.scrollHeight > h ? "auto" : "hidden");
+ e.style.height = h + "px";
+
+ e.valLength = vlen;
+ e.boxWidth = ewidth;
+ }
+
+ return true;
+ };
+
+ // initialize
+ this.each(function() {
+
+ // is a textarea?
+ if (this.nodeName.toLowerCase() != "textarea") return;
+
+ // set height restrictions
+ var p = this.className.match(/expand(\d+)\-*(\d+)*/i);
+ this.expandMin = minHeight || (p ? parseInt('0'+p[1], 10) : 0);
+ this.expandMax = maxHeight || (p ? parseInt('0'+p[2], 10) : 99999);
+
+ // initial resize
+ ResizeTextarea(this);
+
+ // zero vertical padding and add events
+ if (!this.Initialized) {
+ this.Initialized = true;
+ $(this).css("padding-top", 0).css("padding-bottom", 0);
+ $(this).bind("keyup", ResizeTextarea).bind("focus", ResizeTextarea);
+ }
+ });
+
+ return this;
+ };
+
+})(jQuery);
+
+
+// initialize all expanding textareas
+$(document).ready(function() {
+ $("textarea[class*=expand]").TextAreaExpander();
+});
diff --git a/src/pootle_it/html/js/jquery/jquery.tipsy.js b/src/pootle_it/html/js/jquery/jquery.tipsy.js
new file mode 100644
index 0000000..49aee1b
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.tipsy.js
@@ -0,0 +1,212 @@
+// tipsy, facebook style tooltips for jquery
+// version 1.0.0a
+// (c) 2008-2010 jason frame [jason@onehackoranother.com]
+// released under the MIT license
+
+(function($) {
+
+ function Tipsy(element, options) {
+ this.$element = $(element);
+ this.options = options;
+ this.enabled = true;
+ this.fixTitle();
+ }
+
+ Tipsy.prototype = {
+ show: function() {
+ var title = this.getTitle();
+ if (title && this.enabled) {
+ var $tip = this.tip();
+
+ $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
+ $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
+ $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
+
+ var pos = $.extend({}, this.$element.offset(), {
+ width: this.$element[0].offsetWidth,
+ height: this.$element[0].offsetHeight
+ });
+
+ var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
+ var gravity = (typeof this.options.gravity == 'function')
+ ? this.options.gravity.call(this.$element[0])
+ : this.options.gravity;
+
+ var tp;
+ switch (gravity.charAt(0)) {
+ case 'n':
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
+ break;
+ case 's':
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
+ break;
+ case 'e':
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
+ break;
+ case 'w':
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
+ break;
+ }
+
+ if (gravity.length == 2) {
+ if (gravity.charAt(1) == 'w') {
+ tp.left = pos.left + pos.width / 2 - 15;
+ } else {
+ tp.left = pos.left + pos.width / 2 - actualWidth + 15;
+ }
+ }
+
+ $tip.css(tp).addClass('tipsy-' + gravity);
+
+ if (this.options.fade) {
+ $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
+ } else {
+ $tip.css({visibility: 'visible', opacity: this.options.opacity});
+ }
+ }
+ },
+
+ hide: function() {
+ if (this.options.fade) {
+ this.tip().stop().fadeOut(function() { $(this).remove(); });
+ } else {
+ this.tip().remove();
+ }
+ },
+
+ fixTitle: function() {
+ var $e = this.$element;
+ if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
+ $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
+ }
+ },
+
+ getTitle: function() {
+ var title, $e = this.$element, o = this.options;
+ this.fixTitle();
+ var title, o = this.options;
+ if (typeof o.title == 'string') {
+ title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
+ } else if (typeof o.title == 'function') {
+ title = o.title.call($e[0]);
+ }
+ title = ('' + title).replace(/(^\s*|\s*$)/, "");
+ return title || o.fallback;
+ },
+
+ tip: function() {
+ if (!this.$tip) {
+ this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
+ }
+ return this.$tip;
+ },
+
+ validate: function() {
+ if (!this.$element[0].parentNode) {
+ this.hide();
+ this.$element = null;
+ this.options = null;
+ }
+ },
+
+ enable: function() { this.enabled = true; },
+ disable: function() { this.enabled = false; },
+ toggleEnabled: function() { this.enabled = !this.enabled; }
+ };
+
+ $.fn.tipsy = function(options) {
+
+ if (options === true) {
+ return this.data('tipsy');
+ } else if (typeof options == 'string') {
+ var tipsy = this.data('tipsy');
+ if (tipsy) tipsy[options]();
+ return this;
+ }
+
+ options = $.extend({}, $.fn.tipsy.defaults, options);
+
+ function get(ele) {
+ var tipsy = $.data(ele, 'tipsy');
+ if (!tipsy) {
+ tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
+ $.data(ele, 'tipsy', tipsy);
+ }
+ return tipsy;
+ }
+
+ function enter() {
+ var tipsy = get(this);
+ tipsy.hoverState = 'in';
+ if (options.delayIn == 0) {
+ tipsy.show();
+ } else {
+ tipsy.fixTitle();
+ setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
+ }
+ };
+
+ function leave() {
+ var tipsy = get(this);
+ tipsy.hoverState = 'out';
+ if (options.delayOut == 0) {
+ tipsy.hide();
+ } else {
+ setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
+ }
+ };
+
+ if (!options.live) this.each(function() { get(this); });
+
+ if (options.trigger != 'manual') {
+ var binder = options.live ? 'live' : 'bind',
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
+ this[binder](eventIn, enter)[binder](eventOut, leave);
+ }
+
+ return this;
+
+ };
+
+ $.fn.tipsy.defaults = {
+ delayIn: 0,
+ delayOut: 0,
+ fade: false,
+ fallback: '',
+ gravity: 'n',
+ html: false,
+ live: false,
+ offset: 0,
+ opacity: 0.8,
+ title: 'title',
+ trigger: 'hover'
+ };
+
+ // Overwrite this method to provide options on a per-element basis.
+ // For example, you could store the gravity in a 'tipsy-gravity' attribute:
+ // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
+ // (remember - do not modify 'options' in place!)
+ $.fn.tipsy.elementOptions = function(ele, options) {
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
+ };
+
+ $.fn.tipsy.autoNS = function() {
+ return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
+ };
+
+ $.fn.tipsy.autoWE = function() {
+ return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
+ };
+
+ $.fn.tipsy.autoNSedge = function() {
+ var leftOffset = $(this).offset().left;
+ var leftRight = Math.min(leftOffset, $(window).width() - leftOffset);
+ if (leftRight > $(window).width() * 0.10) {
+ return $.fn.tipsy.autoNS.call(this);
+ } else {
+ return $.fn.tipsy.autoNS.call(this) + $.fn.tipsy.autoWE.call(this);
+ }
+ };
+
+})(jQuery);
diff --git a/src/pootle_it/html/js/jquery/jquery.tmpl.js b/src/pootle_it/html/js/jquery/jquery.tmpl.js
new file mode 100644
index 0000000..1c5b2d6
--- /dev/null
+++ b/src/pootle_it/html/js/jquery/jquery.tmpl.js
@@ -0,0 +1,486 @@
+/*
+ * jQuery Templating Plugin
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ */
+(function( jQuery, undefined ){
+ var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
+ newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = [];
+
+ function newTmplItem( options, parentItem, fn, data ) {
+ // Returns a template item data structure for a new rendered instance of a template (a 'template item').
+ // The content field is a hierarchical array of strings and nested items (to be
+ // removed and replaced by nodes field of dom elements, once inserted in DOM).
+ var newItem = {
+ data: data || (parentItem ? parentItem.data : {}),
+ _wrap: parentItem ? parentItem._wrap : null,
+ tmpl: null,
+ parent: parentItem || null,
+ nodes: [],
+ calls: tiCalls,
+ nest: tiNest,
+ wrap: tiWrap,
+ html: tiHtml,
+ update: tiUpdate
+ };
+ if ( options ) {
+ jQuery.extend( newItem, options, { nodes: [], parent: parentItem } );
+ }
+ if ( fn ) {
+ // Build the hierarchical content to be used during insertion into DOM
+ newItem.tmpl = fn;
+ newItem._ctnt = newItem._ctnt || newItem.tmpl( jQuery, newItem );
+ newItem.key = ++itemKey;
+ // Keep track of new template item, until it is stored as jQuery Data on DOM element
+ (stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem;
+ }
+ return newItem;
+ }
+
+ // Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core).
+ jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+ }, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var ret = [], insert = jQuery( selector ), elems, i, l, tmplItems,
+ parent = this.length === 1 && this[0].parentNode;
+
+ appendToTmplItems = newTmplItems || {};
+ if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
+ insert[ original ]( this[0] );
+ ret = this;
+ } else {
+ for ( i = 0, l = insert.length; i < l; i++ ) {
+ cloneIndex = i;
+ elems = (i > 0 ? this.clone(true) : this).get();
+ jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
+ ret = ret.concat( elems );
+ }
+ cloneIndex = 0;
+ ret = this.pushStack( ret, name, insert.selector );
+ }
+ tmplItems = appendToTmplItems;
+ appendToTmplItems = null;
+ jQuery.tmpl.complete( tmplItems );
+ return ret;
+ };
+ });
+
+ jQuery.fn.extend({
+ // Use first wrapped element as template markup.
+ // Return wrapped set of template items, obtained by rendering template against data.
+ tmpl: function( data, options, parentItem ) {
+ return jQuery.tmpl( this[0], data, options, parentItem );
+ },
+
+ // Find which rendered template item the first wrapped DOM element belongs to
+ tmplItem: function() {
+ return jQuery.tmplItem( this[0] );
+ },
+
+ // Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template.
+ template: function( name ) {
+ return jQuery.template( name, this[0] );
+ },
+
+ domManip: function( args, table, callback, options ) {
+ // This appears to be a bug in the appendTo, etc. implementation
+ // it should be doing .call() instead of .apply(). See #6227
+ if ( args[0] && args[0].nodeType ) {
+ var dmArgs = jQuery.makeArray( arguments ), argsLength = args.length, i = 0, tmplItem;
+ while ( i < argsLength && !(tmplItem = jQuery.data( args[i++], "tmplItem" ))) {}
+ if ( argsLength > 1 ) {
+ dmArgs[0] = [jQuery.makeArray( args )];
+ }
+ if ( tmplItem && cloneIndex ) {
+ dmArgs[2] = function( fragClone ) {
+ // Handler called by oldManip when rendered template has been inserted into DOM.
+ jQuery.tmpl.afterManip( this, fragClone, callback );
+ };
+ }
+ oldManip.apply( this, dmArgs );
+ } else {
+ oldManip.apply( this, arguments );
+ }
+ cloneIndex = 0;
+ if ( !appendToTmplItems ) {
+ jQuery.tmpl.complete( newTmplItems );
+ }
+ return this;
+ }
+ });
+
+ jQuery.extend({
+ // Return wrapped set of template items, obtained by rendering template against data.
+ tmpl: function( tmpl, data, options, parentItem ) {
+ var ret, topLevel = !parentItem;
+ if ( topLevel ) {
+ // This is a top-level tmpl call (not from a nested template using {{tmpl}})
+ parentItem = topTmplItem;
+ tmpl = jQuery.template[tmpl] || jQuery.template( null, tmpl );
+ wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
+ } else if ( !tmpl ) {
+ // The template item is already associated with DOM - this is a refresh.
+ // Re-evaluate rendered template for the parentItem
+ tmpl = parentItem.tmpl;
+ newTmplItems[parentItem.key] = parentItem;
+ parentItem.nodes = [];
+ if ( parentItem.wrapped ) {
+ updateWrapped( parentItem, parentItem.wrapped );
+ }
+ // Rebuild, without creating a new template item
+ return jQuery( build( parentItem, null, parentItem.tmpl( jQuery, parentItem ) ));
+ }
+ if ( !tmpl ) {
+ return []; // Could throw...
+ }
+ if ( typeof data === "function" ) {
+ data = data.call( parentItem || {} );
+ }
+ if ( options && options.wrapped ) {
+ updateWrapped( options, options.wrapped );
+ }
+ ret = jQuery.isArray( data ) ?
+ jQuery.map( data, function( dataItem ) {
+ return dataItem ? newTmplItem( options, parentItem, tmpl, dataItem ) : null;
+ }) :
+ [ newTmplItem( options, parentItem, tmpl, data ) ];
+ return topLevel ? jQuery( build( parentItem, null, ret ) ) : ret;
+ },
+
+ // Return rendered template item for an element.
+ tmplItem: function( elem ) {
+ var tmplItem;
+ if ( elem instanceof jQuery ) {
+ elem = elem[0];
+ }
+ while ( elem && elem.nodeType === 1 && !(tmplItem = jQuery.data( elem, "tmplItem" )) && (elem = elem.parentNode) ) {}
+ return tmplItem || topTmplItem;
+ },
+
+ // Set:
+ // Use $.template( name, tmpl ) to cache a named template,
+ // where tmpl is a template string, a script element or a jQuery instance wrapping a script element, etc.
+ // Use $( "selector" ).template( name ) to provide access by name to a script block template declaration.
+
+ // Get:
+ // Use $.template( name ) to access a cached template.
+ // Also $( selectorToScriptBlock ).template(), or $.template( null, templateString )
+ // will return the compiled template, without adding a name reference.
+ // If templateString includes at least one HTML tag, $.template( templateString ) is equivalent
+ // to $.template( null, templateString )
+ template: function( name, tmpl ) {
+ if (tmpl) {
+ // Compile template and associate with name
+ if ( typeof tmpl === "string" ) {
+ // This is an HTML string being passed directly in.
+ tmpl = buildTmplFn( tmpl )
+ } else if ( tmpl instanceof jQuery ) {
+ tmpl = tmpl[0] || {};
+ }
+ if ( tmpl.nodeType ) {
+ // If this is a template block, use cached copy, or generate tmpl function and cache.
+ tmpl = jQuery.data( tmpl, "tmpl" ) || jQuery.data( tmpl, "tmpl", buildTmplFn( tmpl.innerHTML ));
+ }
+ return typeof name === "string" ? (jQuery.template[name] = tmpl) : tmpl;
+ }
+ // Return named compiled template
+ return name ? (typeof name !== "string" ? jQuery.template( null, name ):
+ (jQuery.template[name] ||
+ // If not in map, treat as a selector. (If integrated with core, use quickExpr.exec)
+ jQuery.template( null, htmlExpr.test( name ) ? name : jQuery( name )))) : null;
+ },
+
+ encode: function( text ) {
+ // Do HTML encoding replacing < > & and ' and " by corresponding entities.
+ return ("" + text).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;");
+ }
+ });
+
+ jQuery.extend( jQuery.tmpl, {
+ tag: {
+ "tmpl": {
+ _default: { $2: "null" },
+ open: "if($notnull_1){_=_.concat($item.nest($1,$2));}"
+ // tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions)
+ // This means that {{tmpl foo}} treats foo as a template (which IS a function).
+ // Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}.
+ },
+ "wrap": {
+ _default: { $2: "null" },
+ open: "$item.calls(_,$1,$2);_=[];",
+ close: "call=$item.calls();_=call._.concat($item.wrap(call,_));"
+ },
+ "each": {
+ _default: { $2: "$index, $value" },
+ open: "if($notnull_1){$.each($1a,function($2){with(this){",
+ close: "}});}"
+ },
+ "if": {
+ open: "if(($notnull_1) && $1a){",
+ close: "}"
+ },
+ "else": {
+ _default: { $1: "true" },
+ open: "}else if(($notnull_1) && $1a){"
+ },
+ "html": {
+ // Unecoded expression evaluation.
+ open: "if($notnull_1){_.push($1a);}"
+ },
+ "=": {
+ // Encoded expression evaluation. Abbreviated form is ${}.
+ _default: { $1: "$data" },
+ open: "if($notnull_1){_.push($.encode($1a));}"
+ },
+ "!": {
+ // Comment tag. Skipped by parser
+ open: ""
+ }
+ },
+
+ // This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events
+ complete: function( items ) {
+ newTmplItems = {};
+ },
+
+ // Call this from code which overrides domManip, or equivalent
+ // Manage cloning/storing template items etc.
+ afterManip: function afterManip( elem, fragClone, callback ) {
+ // Provides cloned fragment ready for fixup prior to and after insertion into DOM
+ var content = fragClone.nodeType === 11 ?
+ jQuery.makeArray(fragClone.childNodes) :
+ fragClone.nodeType === 1 ? [fragClone] : [];
+
+ // Return fragment to original caller (e.g. append) for DOM insertion
+ callback.call( elem, fragClone );
+
+ // Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by jQuery.data.
+ storeTmplItems( content );
+ cloneIndex++;
+ }
+ });
+
+ //========================== Private helper functions, used by code above ==========================
+
+ function build( tmplItem, nested, content ) {
+ // Convert hierarchical content into flat string array
+ // and finally return array of fragments ready for DOM insertion
+ var frag, ret = content ? jQuery.map( content, function( item ) {
+ return (typeof item === "string") ?
+ // Insert template item annotations, to be converted to jQuery.data( "tmplItem" ) when elems are inserted into DOM.
+ (tmplItem.key ? item.replace( /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g, "$1 " + tmplItmAtt + "=\"" + tmplItem.key + "\" $2" ) : item) :
+ // This is a child template item. Build nested template.
+ build( item, tmplItem, item._ctnt );
+ }) :
+ // If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}.
+ tmplItem;
+ if ( nested ) {
+ return ret;
+ }
+
+ // top-level template
+ ret = ret.join("");
+
+ // Support templates which have initial or final text nodes, or consist only of text
+ // Also support HTML entities within the HTML markup.
+ ret.replace( /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/, function( all, before, middle, after) {
+ frag = jQuery( middle ).get();
+
+ storeTmplItems( frag );
+ if ( before ) {
+ frag = unencode( before ).concat(frag);
+ }
+ if ( after ) {
+ frag = frag.concat(unencode( after ));
+ }
+ });
+ return frag ? frag : unencode( ret );
+ }
+
+ function unencode( text ) {
+ // Use createElement, since createTextNode will not render HTML entities correctly
+ var el = document.createElement( "div" );
+ el.innerHTML = text;
+ return jQuery.makeArray(el.childNodes);
+ }
+
+ // Generate a reusable function that will serve to render a template against data
+ function buildTmplFn( markup ) {
+ return new Function("jQuery","$item",
+ "var $=jQuery,call,_=[],$data=$item.data;" +
+
+ // Introduce the data as local variables using with(){}
+ "with($data){_.push('" +
+
+ // Convert the template into pure JavaScript
+ jQuery.trim(markup)
+ .replace( /([\\'])/g, "\\$1" )
+ .replace( /[\r\t\n]/g, " " )
+ .replace( /\$\{([^\}]*)\}/g, "{{= $1}}" )
+ .replace( /\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
+ function( all, slash, type, fnargs, target, parens, args ) {
+ var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect;
+ if ( !tag ) {
+ throw "Template command not found: " + type;
+ }
+ def = tag._default || [];
+ if ( parens && !/\w$/.test(target)) {
+ target += parens;
+ parens = "";
+ }
+ if ( target ) {
+ target = unescape( target );
+ args = args ? ("," + unescape( args ) + ")") : (parens ? ")" : "");
+ // Support for target being things like a.toLowerCase();
+ // In that case don't call with template item as 'this' pointer. Just evaluate...
+ expr = parens ? (target.indexOf(".") > -1 ? target + parens : ("(" + target + ").call($item" + args)) : target;
+ exprAutoFnDetect = parens ? expr : "(typeof(" + target + ")==='function'?(" + target + ").call($item):(" + target + "))";
+ } else {
+ exprAutoFnDetect = expr = def.$1 || "null";
+ }
+ fnargs = unescape( fnargs );
+ return "');" +
+ tag[ slash ? "close" : "open" ]
+ .split( "$notnull_1" ).join( target ? "typeof(" + target + ")!=='undefined' && (" + target + ")!=null" : "true" )
+ .split( "$1a" ).join( exprAutoFnDetect )
+ .split( "$1" ).join( expr )
+ .split( "$2" ).join( fnargs ?
+ fnargs.replace( /\s*([^\(]+)\s*(\((.*?)\))?/g, function( all, name, parens, params ) {
+ params = params ? ("," + params + ")") : (parens ? ")" : "");
+ return params ? ("(" + name + ").call($item" + params) : all;
+ })
+ : (def.$2||"")
+ ) +
+ "_.push('";
+ }) +
+ "');}return _;"
+ );
+ }
+ function updateWrapped( options, wrapped ) {
+ // Build the wrapped content.
+ options._wrap = build( options, true,
+ // Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string.
+ jQuery.isArray( wrapped ) ? wrapped : [htmlExpr.test( wrapped ) ? wrapped : jQuery( wrapped ).html()]
+ ).join("");
+ }
+
+ function unescape( args ) {
+ return args ? args.replace( /\\'/g, "'").replace(/\\\\/g, "\\" ) : null;
+ }
+ function outerHtml( elem ) {
+ var div = document.createElement("div");
+ div.appendChild( elem.cloneNode(true) );
+ return div.innerHTML;
+ }
+
+ // Store template items in jQuery.data(), ensuring a unique tmplItem data data structure for each rendered template instance.
+ function storeTmplItems( content ) {
+ var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m;
+ for ( i = 0, l = content.length; i < l; i++ ) {
+ if ( (elem = content[i]).nodeType !== 1 ) {
+ continue;
+ }
+ elems = elem.getElementsByTagName("*");
+ for ( m = elems.length - 1; m >= 0; m-- ) {
+ processItemKey( elems[m] );
+ }
+ processItemKey( elem );
+ }
+ function processItemKey( el ) {
+ var pntKey, pntNode = el, pntItem, tmplItem, key;
+ // Ensure that each rendered template inserted into the DOM has its own template item,
+ if ( (key = el.getAttribute( tmplItmAtt ))) {
+ while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { }
+ if ( pntKey !== key ) {
+ // The next ancestor with a _tmplitem expando is on a different key than this one.
+ // So this is a top-level element within this template item
+ // Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment.
+ pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0;
+ if ( !(tmplItem = newTmplItems[key]) ) {
+ // The item is for wrapped content, and was copied from the temporary parent wrappedItem.
+ tmplItem = wrappedItems[key];
+ tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode], null, true );
+ tmplItem.key = ++itemKey;
+ newTmplItems[itemKey] = tmplItem;
+ }
+ if ( cloneIndex ) {
+ cloneTmplItem( key );
+ }
+ }
+ el.removeAttribute( tmplItmAtt );
+ } else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) {
+ // This was a rendered element, cloned during append or appendTo etc.
+ // TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
+ cloneTmplItem( tmplItem.key );
+ newTmplItems[tmplItem.key] = tmplItem;
+ pntNode = jQuery.data( el.parentNode, "tmplItem" );
+ pntNode = pntNode ? pntNode.key : 0;
+ }
+ if ( tmplItem ) {
+ pntItem = tmplItem;
+ // Find the template item of the parent element.
+ // (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
+ while ( pntItem && pntItem.key != pntNode ) {
+ // Add this element as a top-level node for this rendered template item, as well as for any
+ // ancestor items between this item and the item of its parent element
+ pntItem.nodes.push( el );
+ pntItem = pntItem.parent;
+ }
+ // Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
+ delete tmplItem._ctnt;
+ delete tmplItem._wrap;
+ // Store template item as jQuery data on the element
+ jQuery.data( el, "tmplItem", tmplItem );
+ }
+ function cloneTmplItem( key ) {
+ key = key + keySuffix;
+ tmplItem = newClonedItems[key] =
+ (newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent, null, true ));
+ }
+ }
+ }
+
+ //---- Helper functions for template item ----
+
+ function tiCalls( content, tmpl, data, options ) {
+ if ( !content ) {
+ return stack.pop();
+ }
+ stack.push({ _: content, tmpl: tmpl, item:this, data: data, options: options });
+ }
+
+ function tiNest( tmpl, data, options ) {
+ // nested template, using {{tmpl}} tag
+ return jQuery.tmpl( jQuery.template( tmpl ), data, options, this );
+ }
+
+ function tiWrap( call, wrapped ) {
+ // nested template, using {{wrap}} tag
+ var options = call.options || {};
+ options.wrapped = wrapped;
+ // Apply the template, which may incorporate wrapped content,
+ return jQuery.tmpl( jQuery.template( call.tmpl ), call.data, options, call.item );
+ }
+
+ function tiHtml( filter, textOnly ) {
+ var wrapped = this._wrap;
+ return jQuery.map(
+ jQuery( jQuery.isArray( wrapped ) ? wrapped.join("") : wrapped ).filter( filter || "*" ),
+ function(e) {
+ return textOnly ?
+ e.innerText || e.textContent :
+ e.outerHTML || outerHtml(e);
+ });
+ }
+
+ function tiUpdate() {
+ var coll = this.nodes;
+ jQuery.tmpl( null, null, null, this).insertBefore( coll[0] );
+ jQuery( coll ).remove();
+ }
+})( jQuery );
diff --git a/src/pootle_it/html/js/json2.js b/src/pootle_it/html/js/json2.js
new file mode 100644
index 0000000..22b44d9
--- /dev/null
+++ b/src/pootle_it/html/js/json2.js
@@ -0,0 +1,483 @@
+/*
+ http://www.JSON.org/json2.js
+ 2010-11-17
+
+ Public Domain.
+
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+ See http://www.JSON.org/js.html
+
+
+ This code should be minified before deployment.
+ See http://javascript.crockford.com/jsmin.html
+
+ USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+ NOT CONTROL.
+
+
+ This file creates a global JSON object containing two methods: stringify
+ and parse.
+
+ JSON.stringify(value, replacer, space)
+ value any JavaScript value, usually an object or array.
+
+ replacer an optional parameter that determines how object
+ values are stringified for objects. It can be a
+ function or an array of strings.
+
+ space an optional parameter that specifies the indentation
+ of nested structures. If it is omitted, the text will
+ be packed without extra whitespace. If it is a number,
+ it will specify the number of spaces to indent at each
+ level. If it is a string (such as '\t' or '&nbsp;'),
+ it contains the characters used to indent at each level.
+
+ This method produces a JSON text from a JavaScript value.
+
+ When an object value is found, if the object contains a toJSON
+ method, its toJSON method will be called and the result will be
+ stringified. A toJSON method does not serialize: it returns the
+ value represented by the name/value pair that should be serialized,
+ or undefined if nothing should be serialized. The toJSON method
+ will be passed the key associated with the value, and this will be
+ bound to the value
+
+ For example, this would serialize Dates as ISO strings.
+
+ Date.prototype.toJSON = function (key) {
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ return this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z';
+ };
+
+ You can provide an optional replacer method. It will be passed the
+ key and value of each member, with this bound to the containing
+ object. The value that is returned from your method will be
+ serialized. If your method returns undefined, then the member will
+ be excluded from the serialization.
+
+ If the replacer parameter is an array of strings, then it will be
+ used to select the members to be serialized. It filters the results
+ such that only members with keys listed in the replacer array are
+ stringified.
+
+ Values that do not have JSON representations, such as undefined or
+ functions, will not be serialized. Such values in objects will be
+ dropped; in arrays they will be replaced with null. You can use
+ a replacer function to replace those with JSON values.
+ JSON.stringify(undefined) returns undefined.
+
+ The optional space parameter produces a stringification of the
+ value that is filled with line breaks and indentation to make it
+ easier to read.
+
+ If the space parameter is a non-empty string, then that string will
+ be used for indentation. If the space parameter is a number, then
+ the indentation will be that many spaces.
+
+ Example:
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}]);
+ // text is '["e",{"pluribus":"unum"}]'
+
+
+ text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+ // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+ text = JSON.stringify([new Date()], function (key, value) {
+ return this[key] instanceof Date ?
+ 'Date(' + this[key] + ')' : value;
+ });
+ // text is '["Date(---current time---)"]'
+
+
+ JSON.parse(text, reviver)
+ This method parses a JSON text to produce an object or array.
+ It can throw a SyntaxError exception.
+
+ The optional reviver parameter is a function that can filter and
+ transform the results. It receives each of the keys and values,
+ and its return value is used instead of the original value.
+ If it returns what it received, then the structure is not modified.
+ If it returns undefined then the member is deleted.
+
+ Example:
+
+ // Parse the text. Values that look like ISO date strings will
+ // be converted to Date objects.
+
+ myData = JSON.parse(text, function (key, value) {
+ var a;
+ if (typeof value === 'string') {
+ a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+ if (a) {
+ return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+ +a[5], +a[6]));
+ }
+ }
+ return value;
+ });
+
+ myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+ var d;
+ if (typeof value === 'string' &&
+ value.slice(0, 5) === 'Date(' &&
+ value.slice(-1) === ')') {
+ d = new Date(value.slice(5, -1));
+ if (d) {
+ return d;
+ }
+ }
+ return value;
+ });
+
+
+ This is a reference implementation. You are free to copy, modify, or
+ redistribute.
+*/
+
+/*jslint evil: true, strict: false, regexp: false */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+ call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+ getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+ lastIndex, length, parse, prototype, push, replace, slice, stringify,
+ test, toJSON, toString, valueOf
+*/
+
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+if (!this.JSON) {
+ this.JSON = {};
+}
+
+(function () {
+ "use strict";
+
+ function f(n) {
+ // Format integers to have at least two digits.
+ return n < 10 ? '0' + n : n;
+ }
+
+ if (typeof Date.prototype.toJSON !== 'function') {
+
+ Date.prototype.toJSON = function (key) {
+
+ return isFinite(this.valueOf()) ?
+ this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z' : null;
+ };
+
+ String.prototype.toJSON =
+ Number.prototype.toJSON =
+ Boolean.prototype.toJSON = function (key) {
+ return this.valueOf();
+ };
+ }
+
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+ gap,
+ indent,
+ meta = { // table of character substitutions
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '"' : '\\"',
+ '\\': '\\\\'
+ },
+ rep;
+
+
+ function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+ escapable.lastIndex = 0;
+ return escapable.test(string) ?
+ '"' + string.replace(escapable, function (a) {
+ var c = meta[a];
+ return typeof c === 'string' ? c :
+ '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ }) + '"' :
+ '"' + string + '"';
+ }
+
+
+ function str(key, holder) {
+
+// Produce a string from holder[key].
+
+ var i, // The loop counter.
+ k, // The member key.
+ v, // The member value.
+ length,
+ mind = gap,
+ partial,
+ value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+ if (value && typeof value === 'object' &&
+ typeof value.toJSON === 'function') {
+ value = value.toJSON(key);
+ }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+ if (typeof rep === 'function') {
+ value = rep.call(holder, key, value);
+ }
+
+// What happens next depends on the value's type.
+
+ switch (typeof value) {
+ case 'string':
+ return quote(value);
+
+ case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+ return isFinite(value) ? String(value) : 'null';
+
+ case 'boolean':
+ case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+ return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+ case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+ if (!value) {
+ return 'null';
+ }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+ gap += indent;
+ partial = [];
+
+// Is the value an array?
+
+ if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+ length = value.length;
+ for (i = 0; i < length; i += 1) {
+ partial[i] = str(i, value) || 'null';
+ }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+ v = partial.length === 0 ? '[]' :
+ gap ? '[\n' + gap +
+ partial.join(',\n' + gap) + '\n' +
+ mind + ']' :
+ '[' + partial.join(',') + ']';
+ gap = mind;
+ return v;
+ }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+ if (rep && typeof rep === 'object') {
+ length = rep.length;
+ for (i = 0; i < length; i += 1) {
+ k = rep[i];
+ if (typeof k === 'string') {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = str(k, value);
+ if (v) {
+ partial.push(quote(k) + (gap ? ': ' : ':') + v);
+ }
+ }
+ }
+ }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+ v = partial.length === 0 ? '{}' :
+ gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
+ mind + '}' : '{' + partial.join(',') + '}';
+ gap = mind;
+ return v;
+ }
+ }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+ if (typeof JSON.stringify !== 'function') {
+ JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+ var i;
+ gap = '';
+ indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+ if (typeof space === 'number') {
+ for (i = 0; i < space; i += 1) {
+ indent += ' ';
+ }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+ } else if (typeof space === 'string') {
+ indent = space;
+ }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+ rep = replacer;
+ if (replacer && typeof replacer !== 'function' &&
+ (typeof replacer !== 'object' ||
+ typeof replacer.length !== 'number')) {
+ throw new Error('JSON.stringify');
+ }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+ return str('', {'': value});
+ };
+ }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+ if (typeof JSON.parse !== 'function') {
+ JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+ var j;
+
+ function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+ var k, v, value = holder[key];
+ if (value && typeof value === 'object') {
+ for (k in value) {
+ if (Object.hasOwnProperty.call(value, k)) {
+ v = walk(value, k);
+ if (v !== undefined) {
+ value[k] = v;
+ } else {
+ delete value[k];
+ }
+ }
+ }
+ }
+ return reviver.call(holder, key, value);
+ }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+ text = String(text);
+ cx.lastIndex = 0;
+ if (cx.test(text)) {
+ text = text.replace(cx, function (a) {
+ return '\\u' +
+ ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ });
+ }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+ if (/^[\],:{}\s]*$/
+.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+ j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+ return typeof reviver === 'function' ?
+ walk({'': j}, '') : j;
+ }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+ throw new SyntaxError('JSON.parse');
+ };
+ }
+}());
diff --git a/src/pootle_it/html/js/mt/apertium.js b/src/pootle_it/html/js/mt/apertium.js
new file mode 100644
index 0000000..375b617
--- /dev/null
+++ b/src/pootle_it/html/js/mt/apertium.js
@@ -0,0 +1,61 @@
+(function ($) {
+ window.PTL.editor.mt = window.PTL.editor.mt || {};
+
+ PTL.editor.mt.apertium = {
+
+ buttonClassName: "apertium",
+ imageUri: m("images/apertium.png"),
+ hint: "Apertium",
+ validatePair: true,
+
+ url: "http://api.apertium.org/JSLibrary.js",
+ cookieName: "apertium_pairs",
+ cookieOptions: {path: '/', expires: 15},
+
+ init: function (apiKey) {
+ var _this = PTL.editor.mt.apertium;
+ /* Load Apertium library */
+ _this.url = apiKey == undefined ? _this.url : _this.url + '?key=' + apiKey;
+ $.getScript(_this.url, function () {
+ /* Init variables */
+ var _this = PTL.editor.mt.apertium;
+ _this.targetLang = PTL.editor.normalizeCode($("div#target_lang").text());
+
+ _this.pairs = $.cookie(_this.cookieName);
+ if (!_this.pairs) {
+ var pairs = apertium.getSupportedLanguagePairs();
+ _this.pairs = $.map(pairs, function (obj, i) {
+ return {source: obj.source, target: obj.target};
+ });
+ var cookie_data = JSON.stringify(_this.pairs);
+ $.cookie(_this.cookieName, cookie_data, _this.cookieOptions);
+ } else {
+ _this.pairs = $.parseJSON(_this.pairs);
+ }
+
+ /* Bind event handler */
+ $(".apertium").live("click", _this.translate);
+ });
+ },
+
+ ready: function () {
+ PTL.editor.addMTButtons(PTL.editor.mt.apertium);
+ },
+
+ translate: function () {
+ PTL.editor.translate(this, function(sourceText, langFrom, langTo, resultCallback) {
+ var content = new Object()
+ content.text = sourceText;
+ content.type = "txt";
+ apertium.translate(content, langFrom, langTo, function (result) {
+ if (result.translation) {
+ resultCallback(result.translation);
+ } else {
+ resultCallback(false, "Apertium Error: " + result.error.message);
+ }
+ });
+ });
+ }
+
+ };
+})(jQuery);
diff --git a/src/pootle_it/html/js/mt/google_translate.js b/src/pootle_it/html/js/mt/google_translate.js
new file mode 100644
index 0000000..78201dc
--- /dev/null
+++ b/src/pootle_it/html/js/mt/google_translate.js
@@ -0,0 +1,97 @@
+(function ($) {
+ window.PTL.editor.mt = window.PTL.editor.mt || {};
+
+ PTL.editor.mt.google_translate = {
+
+ buttonClassName: "googletranslate",
+ imageUri: m("images/google-translate.png"),
+ hint: "Google Translate",
+ validatePair: false,
+
+ url: "http://ajax.googleapis.com/ajax/services/language/translate",
+ pairs: [{"source":"af","target":"af"},
+ {"source":"sq","target":"sq"},
+ {"source":"ar","target":"ar"},
+ {"source":"be","target":"be"},
+ {"source":"bg","target":"bg"},
+ {"source":"ca","target":"ca"},
+ {"source":"zh","target":"zh"},
+ {"source":"zh-CN","target":"zh-CN"},
+ {"source":"zh-TW","target":"zh-TW"},
+ {"source":"hr","target":"hr"},
+ {"source":"cs","target":"cs"},
+ {"source":"da","target":"da"},
+ {"source":"nl","target":"nl"},
+ {"source":"en","target":"en"},
+ {"source":"et","target":"et"},
+ {"source":"tl","target":"tl"},
+ {"source":"fi","target":"fi"},
+ {"source":"fr","target":"fr"},
+ {"source":"gl","target":"gl"},
+ {"source":"de","target":"de"},
+ {"source":"el","target":"el"},
+ {"source":"ht","target":"ht"},
+ {"source":"iw","target":"iw"},
+ {"source":"hi","target":"hi"},
+ {"source":"hu","target":"hu"},
+ {"source":"is","target":"is"},
+ {"source":"id","target":"id"},
+ {"source":"ga","target":"ga"},
+ {"source":"it","target":"it"},
+ {"source":"ja","target":"ja"},
+ {"source":"ko","target":"ko"},
+ {"source":"lv","target":"lv"},
+ {"source":"lt","target":"lt"},
+ {"source":"mk","target":"mk"},
+ {"source":"ms","target":"ms"},
+ {"source":"mt","target":"mt"},
+ {"source":"no","target":"no"},
+ {"source":"fa","target":"fa"},
+ {"source":"pl","target":"pl"},
+ {"source":"pt","target":"pt"},
+ {"source":"pt-PT","target":"pt-PT"},
+ {"source":"ro","target":"ro"},
+ {"source":"ru","target":"ru"},
+ {"source":"sr","target":"sr"},
+ {"source":"sk","target":"sk"},
+ {"source":"sl","target":"sl"},
+ {"source":"es","target":"es"},
+ {"source":"sw","target":"sw"},
+ {"source":"sv","target":"sv"},
+ {"source":"tl","target":"tl"},
+ {"source":"th","target":"th"},
+ {"source":"tr","target":"tr"},
+ {"source":"uk","target":"uk"},
+ {"source":"vi","target":"vi"},
+ {"source":"cy","target":"cy"},
+ {"source":"yi","target":"yi"}],
+
+ init: function (apiKey) {
+ /* Prepare URL for requests. */
+ this.url = PTL.editor.settings.secure == false ? this.url : this.url.replace("http", "https");
+ this.url += "?callback=?";
+ /* Set target language */
+ this.targetLang = PTL.editor.normalizeCode($("div#target_lang").text());
+ /* Bind event handler */
+ $(".googletranslate").live("click", this.translate);
+ },
+
+ ready: function () {
+ PTL.editor.addMTButtons(PTL.editor.mt.google_translate);
+ },
+
+ translate: function () {
+ PTL.editor.translate(this, function(sourceText, langFrom, langTo, resultCallback) {
+ var transData = {v: '1.0', q: sourceText,
+ langpair: langFrom + '|' + langTo}
+ $.getJSON(PTL.editor.mt.google_translate.url, transData, function (r) {
+ if (r.responseData && r.responseStatus == 200) {
+ resultCallback(r.responseData.translatedText);
+ } else {
+ resultCallback(false, "Google Translate Error: " + r.responseDetails);
+ }
+ });
+ });
+ }
+ };
+})(jQuery);
diff --git a/src/pootle_it/html/js/shortcut.js b/src/pootle_it/html/js/shortcut.js
new file mode 100644
index 0000000..debaffb
--- /dev/null
+++ b/src/pootle_it/html/js/shortcut.js
@@ -0,0 +1,223 @@
+/**
+ * http://www.openjs.com/scripts/events/keyboard_shortcuts/
+ * Version : 2.01.B
+ * By Binny V A
+ * License : BSD
+ */
+shortcut = {
+ 'all_shortcuts':{},//All the shortcuts are stored in this array
+ 'add': function(shortcut_combination,callback,opt) {
+ //Provide a set of default options
+ var default_options = {
+ 'type':'keydown',
+ 'propagate':false,
+ 'disable_in_input':false,
+ 'target':document,
+ 'keycode':false
+ }
+ if(!opt) opt = default_options;
+ else {
+ for(var dfo in default_options) {
+ if(typeof opt[dfo] == 'undefined') opt[dfo] = default_options[dfo];
+ }
+ }
+
+ var ele = opt.target;
+ if(typeof opt.target == 'string') ele = document.getElementById(opt.target);
+ var ths = this;
+ shortcut_combination = shortcut_combination.toLowerCase();
+
+ //The function to be called at keypress
+ var func = function(e) {
+ e = e || window.event;
+
+ if(opt['disable_in_input']) { //Don't enable shortcut keys in Input, Textarea fields
+ var element;
+ if(e.target) element=e.target;
+ else if(e.srcElement) element=e.srcElement;
+ if(element.nodeType==3) element=element.parentNode;
+
+ if(element.tagName == 'INPUT' || element.tagName == 'TEXTAREA') return;
+ }
+
+ //Find Which key is pressed
+ if (e.keyCode) code = e.keyCode;
+ else if (e.which) code = e.which;
+ var character = String.fromCharCode(code).toLowerCase();
+
+ if(code == 188) character=","; //If the user presses , when the type is onkeydown
+ if(code == 190) character="."; //If the user presses , when the type is onkeydown
+
+ var keys = shortcut_combination.split("+");
+ //Key Pressed - counts the number of valid keypresses - if it is same as the number of keys, the shortcut function is invoked
+ var kp = 0;
+
+ //Work around for stupid Shift key bug created by using lowercase - as a result the shift+num combination was broken
+ var shift_nums = {
+ "`":"~",
+ "1":"!",
+ "2":"@",
+ "3":"#",
+ "4":"$",
+ "5":"%",
+ "6":"^",
+ "7":"&",
+ "8":"*",
+ "9":"(",
+ "0":")",
+ "-":"_",
+ "=":"+",
+ ";":":",
+ "'":"\"",
+ ",":"<",
+ ".":">",
+ "/":"?",
+ "\\":"|"
+ }
+ //Special Keys - and their codes
+ var special_keys = {
+ 'esc':27,
+ 'escape':27,
+ 'tab':9,
+ 'space':32,
+ 'return':13,
+ 'enter':13,
+ 'backspace':8,
+
+ 'scrolllock':145,
+ 'scroll_lock':145,
+ 'scroll':145,
+ 'capslock':20,
+ 'caps_lock':20,
+ 'caps':20,
+ 'numlock':144,
+ 'num_lock':144,
+ 'num':144,
+
+ 'pause':19,
+ 'break':19,
+
+ 'insert':45,
+ 'home':36,
+ 'delete':46,
+ 'end':35,
+
+ 'pageup':33,
+ 'page_up':33,
+ 'pu':33,
+
+ 'pagedown':34,
+ 'page_down':34,
+ 'pd':34,
+
+ 'left':37,
+ 'up':38,
+ 'right':39,
+ 'down':40,
+
+ 'f1':112,
+ 'f2':113,
+ 'f3':114,
+ 'f4':115,
+ 'f5':116,
+ 'f6':117,
+ 'f7':118,
+ 'f8':119,
+ 'f9':120,
+ 'f10':121,
+ 'f11':122,
+ 'f12':123
+ }
+
+ var modifiers = {
+ shift: { wanted:false, pressed:false},
+ ctrl : { wanted:false, pressed:false},
+ alt : { wanted:false, pressed:false},
+ meta : { wanted:false, pressed:false} //Meta is Mac specific
+ };
+
+ if(e.ctrlKey) modifiers.ctrl.pressed = true;
+ if(e.shiftKey) modifiers.shift.pressed = true;
+ if(e.altKey) modifiers.alt.pressed = true;
+ if(e.metaKey) modifiers.meta.pressed = true;
+
+ for(var i=0; k=keys[i],i<keys.length; i++) {
+ //Modifiers
+ if(k == 'ctrl' || k == 'control') {
+ kp++;
+ modifiers.ctrl.wanted = true;
+
+ } else if(k == 'shift') {
+ kp++;
+ modifiers.shift.wanted = true;
+
+ } else if(k == 'alt') {
+ kp++;
+ modifiers.alt.wanted = true;
+ } else if(k == 'meta') {
+ kp++;
+ modifiers.meta.wanted = true;
+ } else if(k.length > 1) { //If it is a special key
+ if(special_keys[k] == code) kp++;
+
+ } else if(opt['keycode']) {
+ if(opt['keycode'] == code) kp++;
+
+ } else { //The special keys did not match
+ if(character == k) kp++;
+ else {
+ if(shift_nums[character] && e.shiftKey) { //Stupid Shift key bug created by using lowercase
+ character = shift_nums[character];
+ if(character == k) kp++;
+ }
+ }
+ }
+ }
+
+ if(kp == keys.length &&
+ modifiers.ctrl.pressed == modifiers.ctrl.wanted &&
+ modifiers.shift.pressed == modifiers.shift.wanted &&
+ modifiers.alt.pressed == modifiers.alt.wanted &&
+ modifiers.meta.pressed == modifiers.meta.wanted) {
+ callback(e);
+
+ if(!opt['propagate']) { //Stop the event
+ //e.cancelBubble is supported by IE - this will kill the bubbling process.
+ e.cancelBubble = true;
+ e.returnValue = false;
+
+ //e.stopPropagation works in Firefox.
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
+ return false;
+ }
+ }
+ }
+ this.all_shortcuts[shortcut_combination] = {
+ 'callback':func,
+ 'target':ele,
+ 'event': opt['type']
+ };
+ //Attach the function with the event
+ if(ele.addEventListener) ele.addEventListener(opt['type'], func, false);
+ else if(ele.attachEvent) ele.attachEvent('on'+opt['type'], func);
+ else ele['on'+opt['type']] = func;
+ },
+
+ //Remove the shortcut - just specify the shortcut and I will remove the binding
+ 'remove':function(shortcut_combination) {
+ shortcut_combination = shortcut_combination.toLowerCase();
+ var binding = this.all_shortcuts[shortcut_combination];
+ delete(this.all_shortcuts[shortcut_combination])
+ if(!binding) return;
+ var type = binding['event'];
+ var ele = binding['target'];
+ var callback = binding['callback'];
+
+ if(ele.detachEvent) ele.detachEvent('on'+type, callback);
+ else if(ele.removeEventListener) ele.removeEventListener(type, callback, false);
+ else ele['on'+type] = false;
+ }
+} \ No newline at end of file
diff --git a/src/pootle_it/html/js/sorttable.js b/src/pootle_it/html/js/sorttable.js
new file mode 100644
index 0000000..341eed7
--- /dev/null
+++ b/src/pootle_it/html/js/sorttable.js
@@ -0,0 +1,523 @@
+/*
+ SortTable
+ version 2
+ 7th April 2007
+ Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+
+ Instructions:
+ Download this file
+ Add <script src="sorttable.js"></script> to your HTML
+ Add class="sortable" to any table you'd like to make sortable
+ Click on the headers to sort
+
+ Thanks to many, many people for contributions and suggestions.
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ This basically means: do what you want with it.
+*/
+
+
+var stIsIE = /*@cc_on!@*/false;
+
+sorttable = {
+ init: function() {
+ // quit if this function has already been called
+ if (arguments.callee.done) return;
+ // flag this function so we don't do the same thing twice
+ arguments.callee.done = true;
+ // kill the timer
+ if (_timer) clearInterval(_timer);
+
+ if (!document.createElement || !document.getElementsByTagName) return;
+
+ sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
+
+ forEach(document.getElementsByTagName('table'), function(table) {
+ if (table.className.search(/\bsortable\b/) != -1) {
+ sorttable.makeSortable(table);
+ }
+ });
+
+ },
+
+ makeSortable: function(table) {
+ if (table.getElementsByTagName('thead').length == 0) {
+ // table doesn't have a tHead. Since it should have, create one and
+ // put the first table row in it.
+ the = document.createElement('thead');
+ the.appendChild(table.rows[0]);
+ table.insertBefore(the,table.firstChild);
+ }
+ // Safari doesn't support table.tHead, sigh
+ if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
+
+ if (table.tHead.rows.length != 1) return; // can't cope with two header rows
+
+ // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
+ // "total" rows, for example). This is B&R, since what you're supposed
+ // to do is put them in a tfoot. So, if there are sortbottom rows,
+ // for backwards compatibility, move them to tfoot (creating it if needed).
+ sortbottomrows = [];
+ for (var i=0; i<table.rows.length; i++) {
+ if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
+ sortbottomrows[sortbottomrows.length] = table.rows[i];
+ }
+ }
+ if (sortbottomrows) {
+ if (table.tFoot == null) {
+ // table doesn't have a tfoot. Create one.
+ tfo = document.createElement('tfoot');
+ table.appendChild(tfo);
+ }
+ for (var i=0; i<sortbottomrows.length; i++) {
+ tfo.appendChild(sortbottomrows[i]);
+ }
+ delete sortbottomrows;
+ }
+
+ // work through each column and calculate its type
+ headrow = table.tHead.rows[0].cells;
+ for (var i=0; i<headrow.length; i++) {
+ // manually override the type with a sorttable_type attribute
+ if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
+ mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
+ if (mtch) { override = mtch[1]; }
+ if (mtch && typeof sorttable["sort_"+override] == 'function') {
+ headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
+ } else {
+ headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
+ }
+ // make it clickable to sort
+ headrow[i].sorttable_columnindex = i;
+ headrow[i].sorttable_tbody = table.tBodies[0];
+ // Add unsorted icon
+ unsorted = document.createElement('img');
+ unsorted.className = "sorttable_unsorted";
+ unsorted.src = m('images/ascdesc.gif');
+ headrow[i].appendChild(unsorted);
+ dean_addEvent(headrow[i],"click", function(e) {
+
+ if (this.className.search(/\bsorttable_sorted\b/) != -1) {
+ // if we're already sorted by this column, just
+ // reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted',
+ 'sorttable_sorted_reverse');
+ this.removeChild(document.getElementById('sorttable_sortfwdind'));
+ sortrevind = document.createElement('img');
+ sortrevind.id = "sorttable_sortrevind";
+ sortrevind.src = m('images/desc.gif');
+ this.appendChild(sortrevind);
+ return;
+ }
+ if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
+ // if we're already sorted by this column in reverse, just
+ // re-reverse the table, which is quicker
+ sorttable.reverse(this.sorttable_tbody);
+ this.className = this.className.replace('sorttable_sorted_reverse',
+ 'sorttable_sorted');
+ this.removeChild(document.getElementById('sorttable_sortrevind'));
+ sortfwdind = document.createElement('img');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.src = m('images/asc.gif');
+ this.appendChild(sortfwdind);
+ return;
+ }
+
+ // remove sorttable_sorted classes
+ theadrow = this.parentNode;
+ forEach(theadrow.childNodes, function(cell) {
+ if (cell.nodeType == 1) { // an element
+ // Add unsorted icon if necessary as well
+ if (cell.className.search(/\b(sorttable_sorted|sorttable_sorted_reverse)\b/) != -1) {
+ unsorted = document.createElement('img');
+ unsorted.className = "sorttable_unsorted";
+ unsorted.src = m('images/ascdesc.gif');
+ cell.appendChild(unsorted);
+ }
+ cell.className = cell.className.replace('sorttable_sorted_reverse','');
+ cell.className = cell.className.replace('sorttable_sorted','');
+ }
+ });
+ unsorted = $('.sorttable_unsorted', this).get(0);
+ if (unsorted) { unsorted.parentNode.removeChild(unsorted); }
+ sortfwdind = document.getElementById('sorttable_sortfwdind');
+ if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
+ sortrevind = document.getElementById('sorttable_sortrevind');
+ if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
+
+ this.className += ' sorttable_sorted';
+ sortfwdind = document.createElement('img');
+ sortfwdind.id = "sorttable_sortfwdind";
+ sortfwdind.src = m('images/asc.gif');
+ this.appendChild(sortfwdind);
+
+ // build an array to sort. This is a Schwartzian transform thing,
+ // i.e., we "decorate" each row with the actual sort key,
+ // sort based on the sort keys, and then put the rows back in order
+ // which is a lot faster because you only do getInnerText once per row
+ row_array = [];
+ col = this.sorttable_columnindex;
+ rows = this.sorttable_tbody.rows;
+ for (var j=0; j<rows.length; j++) {
+ row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
+ }
+ /* If you want a stable sort, uncomment the following line */
+ sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
+ /* and comment out this one */
+ //row_array.sort(this.sorttable_sortfunction);
+
+ tb = this.sorttable_tbody;
+ for (var j=0; j<row_array.length; j++) {
+ tb.appendChild(row_array[j][1]);
+ }
+
+ sorttable.make_zebra();
+
+ delete row_array;
+ });
+ }
+ }
+
+ },
+
+ guessType: function(table, column) {
+ // guess the type of a column based on its first non-blank row
+ sortfn = sorttable.sort_alpha;
+ for (var i=0; i<table.tBodies[0].rows.length; i++) {
+ text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
+ if (text != '') {
+ if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
+ return sorttable.sort_numeric;
+ }
+ // check for a date: dd/mm/yyyy or dd/mm/yy
+ // can have / or . or - as separator
+ // can be mm/dd as well
+ possdate = text.match(sorttable.DATE_RE)
+ if (possdate) {
+ // looks like a date
+ first = parseInt(possdate[1]);
+ second = parseInt(possdate[2]);
+ if (first > 12) {
+ // definitely dd/mm
+ return sorttable.sort_ddmm;
+ } else if (second > 12) {
+ return sorttable.sort_mmdd;
+ } else {
+ // looks like a date, but we can't tell which, so assume
+ // that it's dd/mm (English imperialism!) and keep looking
+ sortfn = sorttable.sort_ddmm;
+ }
+ }
+ }
+ }
+ return sortfn;
+ },
+
+ getInnerText: function(node) {
+ // gets the text we want to use for sorting for a cell.
+ // strips leading and trailing whitespace.
+ // this is *not* a generic getInnerText function; it's special to sorttable.
+ // for example, you can override the cell text with a customkey attribute.
+ // it also gets .value for <input> fields.
+
+ hasInputs = (typeof node.getElementsByTagName == 'function') &&
+ node.getElementsByTagName('input').length;
+
+ if (node.getAttribute("sorttable_customkey") != null) {
+ return node.getAttribute("sorttable_customkey");
+ }
+ else if (typeof node.textContent != 'undefined' && !hasInputs) {
+ return node.textContent.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.innerText != 'undefined' && !hasInputs) {
+ return node.innerText.replace(/^\s+|\s+$/g, '');
+ }
+ else if (typeof node.text != 'undefined' && !hasInputs) {
+ return node.text.replace(/^\s+|\s+$/g, '');
+ }
+ else {
+ switch (node.nodeType) {
+ case 3:
+ if (node.nodeName.toLowerCase() == 'input') {
+ return node.value.replace(/^\s+|\s+$/g, '');
+ }
+ case 4:
+ return node.nodeValue.replace(/^\s+|\s+$/g, '');
+ break;
+ case 1:
+ case 11:
+ var innerText = '';
+ for (var i = 0; i < node.childNodes.length; i++) {
+ innerText += sorttable.getInnerText(node.childNodes[i]);
+ }
+ return innerText.replace(/^\s+|\s+$/g, '');
+ break;
+ default:
+ return '';
+ }
+ }
+ },
+
+ reverse: function(tbody) {
+ // reverse the rows in a tbody
+ newrows = [];
+ for (var i=0; i<tbody.rows.length; i++) {
+ newrows[newrows.length] = tbody.rows[i];
+ }
+ for (var i=newrows.length-1; i>=0; i--) {
+ tbody.appendChild(newrows[i]);
+ }
+ delete newrows;
+ },
+
+ /* sort functions
+ each sort function takes two parameters, a and b
+ you are comparing a[0] and b[0] */
+ sort_numeric: function(a,b) {
+ aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
+ if (isNaN(aa)) aa = 0;
+ bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
+ if (isNaN(bb)) bb = 0;
+ return aa-bb;
+ },
+ sort_alpha: function(a,b) {
+ if (a[0]==b[0]) return 0;
+ if (a[0]<b[0]) return -1;
+ return 1;
+ },
+ sort_ddmm: function(a,b) {
+ mtch = a[0].match(sorttable.DATE_RE);
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt1 = y+m+d;
+ mtch = b[0].match(sorttable.DATE_RE);
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt2 = y+m+d;
+ if (dt1==dt2) return 0;
+ if (dt1<dt2) return -1;
+ return 1;
+ },
+ sort_mmdd: function(a,b) {
+ mtch = a[0].match(sorttable.DATE_RE);
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt1 = y+m+d;
+ mtch = b[0].match(sorttable.DATE_RE);
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
+ if (m.length == 1) m = '0'+m;
+ if (d.length == 1) d = '0'+d;
+ dt2 = y+m+d;
+ if (dt1==dt2) return 0;
+ if (dt1<dt2) return -1;
+ return 1;
+ },
+
+ shaker_sort: function(list, comp_func) {
+ // A stable sort function to allow multi-level sorting of data
+ // see: http://en.wikipedia.org/wiki/Cocktail_sort
+ // thanks to Joseph Nahmias
+ var b = 0;
+ var t = list.length - 1;
+ var swap = true;
+
+ while(swap) {
+ swap = false;
+ for(var i = b; i < t; ++i) {
+ if ( comp_func(list[i], list[i+1]) > 0 ) {
+ var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
+ swap = true;
+ }
+ } // for
+ t--;
+
+ if (!swap) break;
+
+ for(var i = t; i > b; --i) {
+ if ( comp_func(list[i], list[i-1]) < 0 ) {
+ var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
+ swap = true;
+ }
+ } // for
+ b++;
+
+ } // while(swap)
+ },
+
+ make_zebra: function() {
+ /* Customisation for zebra tags */
+ var cls = "even";
+ var even = true;
+ $("table.sortable tbody tr").each(function() {
+ $(this).addClass(cls)
+ cls = even ? "odd" : "even";
+ $(this).removeClass(cls)
+ even = !even;
+ });
+ }
+}
+
+/* ******************************************************************
+ Supporting functions: bundled here to avoid depending on a library
+ ****************************************************************** */
+
+// Dean Edwards/Matthias Miller/John Resig
+
+/* for Mozilla/Opera9 */
+if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", sorttable.init, false);
+}
+
+/* for Internet Explorer */
+/*@cc_on @*/
+/*@if (@_win32)
+ var dummy = (location.protocol == "https:") ? "//:" : "javascript:void(0)";
+ document.write('<script id=__ie_onload defer src="' + dummy + '"><\/script>');
+ var script = document.getElementById("__ie_onload");
+ script.onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ sorttable.init(); // call the onload handler
+ }
+ };
+/*@end @*/
+
+/* for Safari */
+if (/WebKit/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ sorttable.init(); // call the onload handler
+ }
+ }, 10);
+}
+
+/* for other browsers */
+window.onload = sorttable.init;
+
+// written by Dean Edwards, 2005
+// with input from Tino Zijdel, Matthias Miller, Diego Perini
+
+// http://dean.edwards.name/weblog/2005/10/add-event/
+
+function dean_addEvent(element, type, handler) {
+ if (element.addEventListener) {
+ element.addEventListener(type, handler, false);
+ } else {
+ // assign each event handler a unique ID
+ if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
+ // create a hash table of event types for the element
+ if (!element.events) element.events = {};
+ // create a hash table of event handlers for each element/event pair
+ var handlers = element.events[type];
+ if (!handlers) {
+ handlers = element.events[type] = {};
+ // store the existing event handler (if there is one)
+ if (element["on" + type]) {
+ handlers[0] = element["on" + type];
+ }
+ }
+ // store the event handler in the hash table
+ handlers[handler.$$guid] = handler;
+ // assign a global event handler to do all the work
+ element["on" + type] = handleEvent;
+ }
+};
+// a counter used to create unique IDs
+dean_addEvent.guid = 1;
+
+function removeEvent(element, type, handler) {
+ if (element.removeEventListener) {
+ element.removeEventListener(type, handler, false);
+ } else {
+ // delete the event handler from the hash table
+ if (element.events && element.events[type]) {
+ delete element.events[type][handler.$$guid];
+ }
+ }
+};
+
+function handleEvent(event) {
+ var returnValue = true;
+ // grab the event object (IE uses a global event object)
+ event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
+ // get a reference to the hash table of event handlers
+ var handlers = this.events[event.type];
+ // execute each event handler
+ for (var i in handlers) {
+ this.$$handleEvent = handlers[i];
+ if (this.$$handleEvent(event) === false) {
+ returnValue = false;
+ }
+ }
+ return returnValue;
+};
+
+function fixEvent(event) {
+ // add W3C standard event methods
+ event.preventDefault = fixEvent.preventDefault;
+ event.stopPropagation = fixEvent.stopPropagation;
+ return event;
+};
+fixEvent.preventDefault = function() {
+ this.returnValue = false;
+};
+fixEvent.stopPropagation = function() {
+ this.cancelBubble = true;
+}
+
+// Dean's forEach: http://dean.edwards.name/base/forEach.js
+/*
+ forEach, version 1.0
+ Copyright 2006, Dean Edwards
+ License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+// array-like enumeration
+if (!Array.forEach) { // mozilla already supports this
+ Array.forEach = function(array, block, context) {
+ for (var i = 0; i < array.length; i++) {
+ block.call(context, array[i], i, array);
+ }
+ };
+}
+
+// generic enumeration
+Function.prototype.forEach = function(object, block, context) {
+ for (var key in object) {
+ if (typeof this.prototype[key] == "undefined") {
+ block.call(context, object[key], key, object);
+ }
+ }
+};
+
+// character enumeration
+String.forEach = function(string, block, context) {
+ Array.forEach(string.split(""), function(chr, index) {
+ block.call(context, chr, index, string);
+ });
+};
+
+// globally resolve forEach enumeration
+var forEach = function(object, block, context) {
+ if (object) {
+ var resolve = Object; // default
+ if (object instanceof Function) {
+ // functions have a "length" property
+ resolve = Function;
+ } else if (object.forEach instanceof Function) {
+ // the object implements a custom forEach method so use that
+ object.forEach(block, context);
+ return;
+ } else if (typeof object == "string") {
+ // the object is a string
+ resolve = String;
+ } else if (typeof object.length == "number") {
+ // the object is array-like
+ resolve = Array;
+ }
+ resolve.forEach(object, block, context);
+ }
+};
+
diff --git a/src/pootle_it/html/pootle.bundle.css b/src/pootle_it/html/pootle.bundle.css
new file mode 100644
index 0000000..8993f40
--- /dev/null
+++ b/src/pootle_it/html/pootle.bundle.css
@@ -0,0 +1,4 @@
+@import "style.css";
+@import "admin.css";
+@import "translate.css";
+@import "fancybox-captcha.css";
diff --git a/src/pootle_it/html/style.css b/src/pootle_it/html/style.css
new file mode 100644
index 0000000..090169b
--- /dev/null
+++ b/src/pootle_it/html/style.css
@@ -0,0 +1,2073 @@
+/*
+ * BASIC ELEMENT STYLING
+ */
+
+html
+{
+ color: #000;
+ background: #FFF;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+}
+
+body
+{
+ background: #FFF;
+ color: #000;
+ width: 100%;
+
+ font-family: Segoe UI, Ubuntu, sans-serif;
+ font-size: 0.8125em;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: normal;
+}
+
+a,
+a:link
+{
+ text-decoration: none;
+ background-color: inherit;
+ color: #0489b7;
+}
+
+a:visited
+{
+ text-decoration: none;
+}
+
+a:hover
+{
+ text-decoration: underline;
+}
+
+a:active
+{
+ text-decoration: underline;
+}
+
+p,
+dd
+{
+ line-height: 1.5;
+}
+
+strong
+{
+ font-weight: bold;
+}
+
+em
+{
+ font-style: italic;
+}
+
+abbr,
+acronym
+{
+ border-bottom: 1px dotted #000;
+ cursor: help;
+}
+
+p,
+fieldset,
+pre
+{
+ margin-bottom: 1em;
+}
+
+th
+{
+ font-size: 110%;
+ padding: 0 0 7px 0;
+ background-color: inherit;
+ color: #4b4742;
+}
+
+td
+{
+ padding: 5px 0;
+}
+
+h1, h2, h3, h4, h5, h6
+{
+ font-weight: normal;
+ font-size: 100%;
+ color: #333;
+}
+
+h1
+{
+ font-size: 185%;
+}
+
+h2
+{
+ font-size: 170%;
+}
+
+h3
+{
+ font-size: 150%;
+}
+
+h4
+{
+ font-size: 137%;
+}
+
+h5
+{
+ font-size: 110%;
+}
+
+h6
+{
+ font-size: 100%;
+}
+
+body, div,
+ul, ol, li,
+h1, h2, h3, h4, h5, h6,
+pre, code,
+form, fieldset, legend,
+p, blockquote
+{
+ margin: 0;
+ padding: 0px;
+}
+
+input, textarea
+{
+ margin: 0;
+}
+
+table
+{
+ border-collapse: collapse;
+ border-spacing: 0;
+ font-size: inherit;
+}
+
+fieldset,
+img
+{
+ border: 0;
+}
+
+address, caption, cite, code, dfn,
+em, strong,
+th, var
+{
+ font-style: normal;
+ font-weight: normal;
+}
+
+li
+{
+ list-style: none;
+}
+
+caption,
+th
+{
+ text-align: left;
+}
+
+html[dir="rtl"] caption,
+html[dir="rtl"] th
+{
+ text-align: right;
+}
+
+q:before,
+q:after
+{
+ content: '';
+}
+
+abbr,
+acronym
+{
+ border: 0;
+ font-variant: normal;
+}
+
+sup
+{
+ vertical-align: text-top;
+}
+
+sub
+{
+ vertical-align: text-bottom;
+}
+
+input,
+textarea,
+select
+{
+ font-family: inherit;
+ font-size: inherit;
+ font-weight: inherit;
+}
+
+legend
+{
+ background-color: inherit;
+ color: #000;
+}
+
+pre, code, kbd, samp, tt
+{
+ font-family: monospace;
+ line-height: 100%;
+}
+
+#ft
+{
+ clear: both;
+}
+
+#bd:after
+{
+ content: ".";
+ display: block;
+ height: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+
+/*
+ * MAIN DIVs
+ */
+
+#wrapper,
+#doc
+{
+ width: 100%;
+}
+
+#doc:after
+{
+ content: ".";
+ display: block;
+ height: 0;
+ width: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+#nav-access
+{
+ position: absolute;
+ top: -1000px;
+}
+
+html[dir="ltr"] #nav-access
+{
+ left: -1000px;
+}
+
+html[dir="rtl"] #nav-access
+{
+ right: -1000px;
+}
+
+#precontent,
+#content,
+#postcontent
+{
+ margin: 0 1em;
+}
+
+#precontent,
+#content {
+ clear: both;
+}
+
+
+/*
+ * HEADER
+ */
+
+#header h1
+{
+ margin: 0;
+ padding: 25px;
+ background: url(images/logo.jpg) left 0.7em no-repeat;
+ padding-left: 60px;
+ float: left;
+ margin: 0 30px 0 20px;
+ font-weight: bold;
+}
+
+html[dir="rtl"] #header h1
+{
+ background: url(images/logo.jpg) right 0.7em no-repeat;
+ padding-left: 0;
+ padding-right: 60px;
+ margin: 0px 20px 0 30px;
+ float: right;
+}
+
+#nav-main ul
+{
+ margin: 5px 5px 0 5px;
+ position: absolute;
+ right: 0px;
+ top: 0px;
+}
+
+html[dir="rtl"] #nav-main ul
+{
+ right: auto;
+ left: 0px;
+}
+
+#nav-main ul li
+{
+ float: left;
+}
+
+html[dir="rtl"] #nav-main ul li
+{
+ float: right;
+}
+
+#nav-main ul li a
+{
+ padding: 0 10px;
+ display: block;
+ font-weight: bold;
+ font-size: 95%;
+}
+
+#nav-main a.admin
+{
+ color: #c30;
+}
+
+
+/*
+ * ZOOM CONTROL
+ */
+
+#zoom {
+ padding: 12px;
+ position: absolute;
+ right: 0px;
+ top: 25px;
+ font-size: 12px;
+ font-weight: bold;
+
+ filter:alpha(opacity=40);
+ -moz-opacity: 0.4;
+ -khtml-opacity: 0.4;
+ opacity: 0.4;
+}
+
+html[dir="rtl"] #zoom {
+ right: auto;
+ left: 0px;
+}
+
+#zoom a {
+ padding: 0 2px;
+ border: 1px dotted transparent;
+}
+
+#zoom:hover {
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+#zoom a:hover {
+ border: 1px dotted #0489b7;
+ text-decoration: none;
+}
+
+/*
+ * MENUBAR
+ */
+
+.menubar
+{
+ visibility: visible;
+ position: static;
+}
+
+.menubar ul,
+.menubar li,
+.menubar h6
+{
+ margin: 0;
+ padding: 0;
+}
+
+.menubar>.bd>ul:after
+{
+ content: ".";
+ display: block;
+ clear: both;
+ visibility: hidden;
+ height: 0;
+ line-height: 0;
+}
+
+
+/*
+ * FOOTER
+ */
+
+#footer
+{
+ background: #fff url(images/footer-bg.jpg) top center repeat-x;
+ text-align: center;
+ color: #888;
+ clear: both;
+ font-size: 90%;
+ margin-top: 2em;
+}
+
+#footer-contents
+{
+ margin: 0 auto;
+ width: 90%;
+}
+
+#footer .nav
+{
+ padding: 35px 0;
+}
+
+#footer .nav li
+{
+ display: inline;
+}
+
+#footer .nav li:after
+{
+ content: "|";
+ margin: 0 10px;
+}
+
+#footer .nav li:last-child:after
+{
+ content: '';
+ margin: 0;
+}
+
+#footer a:link,
+#footer a:visited
+{
+ color: #888;
+}
+
+#footer a:hover,
+#footer a:active
+{
+ color: #888;
+}
+
+
+/*
+ * MESSAGES
+ */
+
+.xhr-message
+{
+ position: fixed;
+ height: 2em;
+ bottom: 47px; /* #toolbar height + 1 */
+ left: 50%;
+ width: 400px;
+ margin-left: -200px;
+ z-index: 1001;
+ text-align: center;
+}
+
+.xhr-message span
+{
+ -moz-border-radius: 5px 5px 0 0;
+ -webkit-border-radius: 5px 5px 0 0;
+ border-radius: 5px 5px 0 0;
+ border: 1px solid #ccc;
+ border-bottom: 0px;
+ line-height: 2em;
+ padding: 0.5em 1em 0.5em 36px;
+}
+
+html[dir="rtl"] #xhr-activity span,
+html[dir="rtl"] #xhr-error span
+{
+ background-position: 85% center;
+ padding: 0.5em 36px 0.5em 1em;
+}
+
+#xhr-activity span,
+#xhr-error span
+{
+ background-position: 1em center;
+}
+
+#xhr-activity span
+{
+ background: url("images/activity.gif") 1em center no-repeat #e5f3f8;
+}
+
+#xhr-error span
+{
+ background: url("images/error.png") 1em center no-repeat #e5f3f8;
+}
+
+.form.message
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e5f3f8', endColorstr='#cde7f1');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ffd), to(#ffa));
+ background: -moz-linear-gradient(top, #e5f3f8, #cde7f1);
+}
+
+.form.success
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeffdd', endColorstr='#ccff99');
+ background: -webkit-gradient(linear, left top, left bottom, from(#efd), to(#cf9));
+ background: -moz-linear-gradient(top, #efd, #cf9);
+}
+
+.form.error
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffeeee', endColorstr='#ffcccc');
+ background: -webkit-gradient(linear, left top, left bottom, from(#fee), to(#fcc));
+ background: -moz-linear-gradient(top, #fee, #fcc);
+}
+
+.form p.info
+{
+ margin: 0.3em 0;
+}
+
+.form .success {
+ color: #390;
+}
+
+.form .error
+{
+ color: #c00;
+}
+
+.hide
+{
+ display: none;
+}
+
+p.help,
+span.help_text
+{
+ font-size: 85%;
+ font-style: italic;
+}
+
+/* FORM ERROR LISTS */
+
+ul.errorlist
+{
+ margin: 0;
+ padding: 0;
+}
+
+.errorlist li
+{
+ color: #c00;
+ margin-top: 0.2em;
+}
+
+
+/*
+ * PAGE BODY
+ */
+
+#body
+{
+ margin: 0;
+ padding: 5px 0px;
+}
+
+#body:after
+{
+ content: ".";
+ display: block;
+ height: 0;
+ width: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.intro
+{
+ margin: 0 1em;
+ line-height: 1.3em;
+}
+
+.intro .announcement {
+ background-color: #f9edd0;
+ padding: 1em 1em;
+ border: 1px dashed #935300;
+ color: #624800;
+}
+
+.intro strong {
+ font-weight: bold;
+}
+
+.intro em {
+ font-style: italic;
+}
+
+/* TABLES */
+
+.module table,
+.module-primary table
+{
+ width: 100%;
+}
+
+td.language,
+td.code,
+td.profile,
+td.username
+{
+ padding-left: 5px;
+}
+
+html[dir="rtl"] td.language,
+html[dir="rtl"] td.code,
+html[dir="rtl"] td.profile,
+html[dir="rtl"] td.username
+{
+ padding-left: 0;
+ padding-right: 5px;
+}
+
+tr.even,
+td.even,
+li.even
+{
+ background: #f7f7f7;
+}
+
+/* MODULES */
+
+.clear
+{
+ clear: both;
+}
+
+.module
+{
+ width: 48%;
+ float: right;
+ margin: 0;
+}
+
+html[dir="rtl"] .module
+{
+ float: left;
+}
+
+.module.first
+{
+ float: left;
+}
+
+html[dir="rtl"] .module.first
+{
+ float: right;
+}
+
+.module .hd h2,
+.module-primary .hd h2
+{
+ margin: 1em 0.5em 0;
+ color: #999;
+ border-bottom: 1px solid #eee;
+}
+
+html[dir="rtl"] .module .hd h2,
+html[dir="rtl"] .module-primary .hd h2
+{
+ margin-left: 0;
+ margin-right: 0.5em;
+}
+
+.module .bd,
+.module-primary .bd
+{
+ margin: 1em;
+}
+
+.module .nomargin,
+.module-primary .nomargin
+{
+ margin: 0;
+}
+
+.module .bd h2,
+.module-primary .bd h2
+{
+ color: #999;
+ margin-bottom: 0.5em;
+}
+
+.module .bd h3,
+.module-primary .bd h3
+{
+ font-size: 120%;
+}
+
+/* USER STATISTICS MODULE */
+
+.module.user-statistics table
+{
+ width: auto;
+}
+
+.module.user-statistics table th,
+.module.user-statistics table td
+{
+ padding: 0 0 10px;
+}
+
+.module.user-statistics table th
+{
+ padding-right: 2em;
+}
+
+.module.user-statistics div.avatar
+{
+ position: relative;
+}
+
+.module.user-statistics div.avatar img
+{
+ position: absolute;
+ right: 0;
+ border: 1px solid #EEE;
+}
+
+/* UPLOAD FORM / UPDATE FROM VCS */
+
+div#upload p,
+div#upload ul,
+div#update p,
+.general-message input
+{
+ margin-bottom: 0.5em;
+}
+
+
+/*
+ * FORMS
+ */
+
+.form {
+ width: 30em;
+ margin: 2em auto;
+ padding: 1em;
+ text-align: left;
+ -moz-border-radius: 10px;
+ -webkit-border-radius: 10px;
+ border-radius: 10px;
+ box-shadow: 0px 2px 5px #777;
+ -moz-box-shadow: 0px 2px 5px #777;
+ -webkit-box-shadow: 0px 2px 5px #777;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e5f3f8', endColorstr='#cde7f1');
+ background: -webkit-gradient(linear, left top, left bottom, from(#e5f3f8), to(#cde7f1));
+ background: -moz-linear-gradient(top, #e5f3f8, #cde7f1);
+}
+
+html[dir="rtl"] .form
+{
+ text-align: right;
+}
+
+.form h2
+{
+ margin-bottom: 0.5em;
+}
+
+.form p,
+.form div.p
+{
+ margin-top: 1em;
+}
+
+.form input[type="text"],
+.form input[type="password"],
+.form select,
+.form textarea
+{
+ width: 100%;
+}
+
+.form .buttons
+{
+ margin-top: 2em;
+ margin-bottom: 0;
+ text-align: right;
+}
+
+html[dir="rtl"] .form .buttons
+{
+ text-align: left;
+}
+
+input[type="submit"]
+{
+ border: 0;
+ padding: 5px 10px;
+ min-height: 16px;
+ min-width: 110px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ box-shadow: 0px 1px 2px #000;
+ -moz-box-shadow: 0px 1px 2px #000;
+ -webkit-box-shadow: 0px 0px 2px #000;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#cccccc');
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ccc));
+ background: -moz-linear-gradient(top, #fff, #ccc);
+ color: #000;
+}
+
+body.zoom-out-1 input[type="submit"]
+{
+ min-width: 100px;
+}
+
+body.zoom-out-2 input[type="submit"]
+{
+ min-width: 90px;
+}
+
+input[type="submit"]:hover {
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dddddd');
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ddd));
+ background: -moz-linear-gradient(top, #fff, #ddd);
+}
+
+input[type="submit"]:active
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#ffffff');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#fff));
+ background: -moz-linear-gradient(top, #ccc, #fff);
+}
+
+.formlink
+{
+ margin: 0 auto 1em;
+ font-size: 137%;
+ text-align: center;
+}
+
+
+/*
+ * NEWS FORM
+ */
+
+.news-feed,
+.news-feed-with-form {
+ margin-top: 2em;
+}
+
+.news-feed-with-form {
+ margin-left: 38em;
+}
+
+.news {
+ margin: 2em 0;
+ float: left;
+}
+
+/*
+ * CAPTCHA FORM
+ */
+
+.form .captcha
+{
+ text-align: left;
+ margin-top: 1em;
+}
+
+.form .captcha .question
+{
+ font-size: 120%;
+}
+
+.form .captcha input[type="text"]
+{
+ font-size: 120%;
+ width: 3em;
+}
+
+.form .captcha input[type="submit"]
+{
+ margin-left: 1em;
+ vertical-align: bottom;
+}
+
+.form .captcha ul.errorlist {
+ float: right;
+ line-height: 2em;
+}
+
+
+/*
+ * EXTERNAL LINKS
+ */
+
+a.external {
+ background: url(images/external-link.png) left 50% no-repeat;
+ padding-left: 14px;
+}
+
+html[dir="rtl"] a.external {
+ background: url(images/external-link.png) right 50% no-repeat;
+ padding-left: 0;
+ padding-right: 14px;
+}
+
+/*
+ * DOCUMENTATION
+ */
+
+.documentation
+{
+ margin: 2em;
+}
+
+.documentation h2,
+.documentation h3 {
+ color: #999;
+ border-bottom: 1px solid #eee;
+}
+
+.documentation h3 {
+ margin-top: 1.5em;
+}
+
+.documentation p
+{
+ margin: 1em 0;
+}
+
+.documentation ol,
+.documentation ul {
+ margin: 1em 1.5em;
+}
+
+.documentation ul li
+{
+ list-style-type: square;
+}
+
+.documentation ol li
+{
+ list-style-type: inherit;
+}
+
+.documentation dfn
+{
+ border-bottom: 1px dotted black;
+}
+
+.documentation .sidenote
+{
+ width: 10em;
+ font-size: 95%;
+ background-color: #ffe;
+ padding: 0 1em;
+ border: 1px dashed #cc9;
+ margin-top: 4em;
+ color: #777;
+}
+
+.documentation .sidenote p
+{
+ line-height: 130%;
+}
+
+.documentation .sidenote li {
+ margin: 0.2em 0;
+}
+
+
+/*
+ * TABBED MENU
+ */
+
+div#submenu
+{
+ border-bottom: 1px solid #afaba3;
+ clear: both;
+ height: 34px;
+ margin-bottom: 8px;
+}
+
+div#submenu-tabs
+{
+ float: left;
+ font-weight: bold;
+}
+
+html[dir="rtl"] div#submenu-tabs
+{
+ float: right;
+}
+
+div#submenu-tabs a
+{
+ background-color: inherit;
+ border: 1px solid transparent;
+ color: #4b4740;
+ display: block;
+ float: left;
+ height: 24px;
+ line-height: 22px;
+ margin: 8px 4px 0;
+ padding: 0 11px;
+ text-decoration: none;
+ -moz-border-radius: 5px 5px 0 0;
+ -webkit-border-radius: 5px 5px 0 0;
+ border-radius: 5px 5px 0 0;
+}
+
+html[dir="rtl"] div#submenu-tabs a
+{
+ float: right;
+}
+
+div#submenu-tabs a:hover
+{
+ background-color: #fff !important;
+ border-color: #777 #777 #fff;
+ border-style: solid;
+ border-width: 1px;
+ line-height: 20px;
+ margin-top: 9px;
+ color: #666 !important;
+}
+
+div#submenu-tabs a.admintab,
+div#submenu-tabs.admin a,
+div#submenu-tabs a .admin
+{
+ color: #c30 !important;
+}
+
+div#submenu-tabs a:visited
+{
+ color: #888;
+}
+
+body.dashboard div#submenu-tabs a.dashboard,
+body.settings div#submenu-tabs a.settings,
+body.profile div#submenu-tabs a.profile,
+body.password div#submenu-tabs a.password,
+body.admindashboard div#submenu-tabs a.admindashboard,
+body.admingeneral div#submenu-tabs a.admingeneral,
+body.adminusers div#submenu-tabs a.adminusers,
+body.adminlanguages div#submenu-tabs a.adminlanguages,
+body.adminprojects div#submenu-tabs a.adminprojects,
+body.adminpermissions div#submenu-tabs a.adminpermissions,
+body.projectoverview div#submenu-tabs a.projectoverview,
+body.projectadmin div#submenu-tabs a.projectadmin,
+body.projectperm div#submenu-tabs a.projectperm,
+body.languageoverview div#submenu-tabs a.languageoverview,
+body.languagenews div#submenu-tabs a.languagenews,
+body.languageadmin div#submenu-tabs a.languageadmin,
+body.tpoverview div#submenu-tabs a.tpoverview,
+body.tpnews div#submenu-tabs a.tpnews,
+body.tptranslate div#submenu-tabs a.tptranslate,
+body.tpreview div#submenu-tabs a.tpreview,
+body.tpterminology div#submenu-tabs a.tpterminology,
+body.tpadminpermissions div#submenu-tabs a.tpadminpermissions,
+body.tpadminfiles div#submenu-tabs a.tpadminfiles
+{
+ background-color: #fff;
+ border-color: #777 #777 #fff;
+ border-style: solid;
+ border-width: 1px;
+ color: black;
+ height: 30px;
+ line-height: 28px;
+ margin-top: 3px;
+ padding: 0 11px;
+}
+
+
+/*
+ * SETTINGS PAGE
+ */
+
+div.settings-container
+{
+ display: block;
+ margin: 0 auto 2em;
+ margin: 1em;
+}
+
+.settings-container h2
+{
+ color: #999;
+ margin: 1em 0 0.5em;
+}
+
+.settings-container p
+{
+ margin-bottom: 1em;
+}
+
+.settings-container input,
+.settings-container select,
+.settings-container textarea,
+#login input[type="text"],
+#login input[type="password"],
+#login select,
+#register input[type="text"],
+#register input[type="password"]
+{
+ display: block;
+}
+
+.settings-container table
+{
+ width: 100%;
+ margin-bottom: 1em;
+}
+
+.settings-container td
+{
+ font-size: inherit;
+}
+
+div#settings
+{
+ margin-bottom: 2em;
+}
+
+/* ADMIN TABLE BACKGROUNDS */
+
+.other-selected
+{
+ background-color: #8ec904 !important;
+}
+
+.delete-selected
+{
+ background-color: #e08566 !important;
+}
+
+.delete-selected.even
+{
+ background-color: #d67f62 !important;
+}
+
+.delete-selected > * {
+ filter:alpha(opacity=40);
+ -moz-opacity: 0.4;
+ -khtml-opacity: 0.4;
+ opacity: 0.4;
+}
+
+.delete-selected td.DELETE {
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+.other-selected a,
+.delete-selected a
+{
+ color: #fff;
+}
+
+/*
+ * SUMMARIES
+ */
+
+div.newsitem-sep
+{
+ border-bottom: 1px solid #ddd;
+ margin: 1.5em 0 2em;
+}
+
+#translationsummarylegend div {
+ font-size: 85%;
+ color: #888;
+ font-style: italic;
+}
+
+html[dir="ltr"] #translationsummarylegend div {
+ float: left;
+ margin-right: 2em;
+}
+
+html[dir="rtl"] #translationsummarylegend div {
+ float: right;
+ margin-left: 2em;
+}
+
+#translationsummarylegend div img
+{
+ vertical-align: middle;
+ width: 25px;
+ height: 15px;
+ padding: 0px 5px;
+}
+
+div#rss-alerts ul,
+div.latestnews ul
+{
+ margin: 0 1em;
+}
+
+div#rss-alerts li,
+div.latestnews li
+{
+ list-style-type: square;
+}
+
+div.latestnews p.subscribe
+{
+ background-image: url('images/feed.png');
+ background-repeat: no-repeat;
+ margin-top: 1em;
+ /* ltr */
+ background-position: left center;
+ padding-left: 2em;
+}
+
+html[dir="rtl"] div.latestnews p.subscribe
+{
+ /* undo ltr */
+ padding-left: 0;
+ /* rtl */
+ background-position: right center;
+ text-align: right;
+ padding-right: 2em;
+}
+
+div.topcontributors
+{
+ margin-top: 0;
+ padding-top: 3em;
+ margin-bottom: 2em;
+}
+
+table.topcontributors
+{
+ width: 100%;
+}
+
+table.topcontributors th
+{
+ color: #999;
+ font-size: 85%;
+ padding: 0 10px 7px 10px;
+}
+
+table.topcontributors td
+{
+ font-size: inherit;
+ padding: 5px 10px;
+}
+
+td.stats-number
+{
+ padding-right: 10px;
+ text-align: right;
+}
+
+td.stats-name .user-nobody
+{
+ font-style: italic;
+}
+
+html[dir="rtl"] td.language,
+html[dir="rtl"] td.stats-name,
+html[dir="rtl"] select#id_ui_lang option
+{
+ text-align: right !important;
+}
+
+div#innernav
+{
+ margin: 1.5em 1em 0;
+}
+
+.translate-offline-notice
+{
+ margin: 2em 1em;
+ padding: 0.5em 1em;
+ background-color: #fcf5ee;
+ border: 1px dashed #f5e0cb;
+ color: #bd844d;
+ line-height: 1.5;
+}
+
+.translate-offline-notice > div
+{
+ font-size: 85%;
+}
+
+.translate-offline-notice dfn
+{
+ border-bottom: 1px dotted #ac6520;
+}
+
+
+div#actionlinks
+{
+ margin-top: 0.5em;
+}
+
+div#actionlinks a
+{
+ padding: 0.1em 0.5em;
+ border: 1px solid #ccc;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ background-color: #eee;
+ color: #666;
+ margin-right: 0.5em;
+}
+
+html[dir="rtl"] div#actionlinks a
+{
+ margin-right: 0;
+ margin-left: 0.5em;
+}
+
+div#actionlinks a span
+{
+ background: url('images/actionlink.png') left 50% no-repeat;
+ padding-left: 1.2em;
+}
+
+html[dir="rtl"] div#actionlinks a span
+{
+ background-position: right 50%;
+ padding-left: 0;
+ padding-right: 1.2em;
+}
+
+div#actionlinks a.translate
+{
+ background-color: #e6f2f7;
+ border-color: #b3d8e6;
+ color: #337e99;
+}
+
+div#actionlinks a.translate span
+{
+ background-image: url('images/actionlink-translate-online.png');
+}
+
+div#actionlinks a.translate.download,
+div#actionlinks a.translate.upload
+{
+ background-color: #faeee3;
+ border-color: #efcca9;
+ color: #ac6520;
+}
+
+div#actionlinks a.translate.download span
+{
+ background-image: url('images/actionlink-translate-offline.png');
+}
+
+div#actionlinks a.translate.upload span
+{
+ background-image: url('images/actionlink-upload.png');
+}
+
+div#actionlinks a.file.download
+{
+ background-color: #eef3e9;
+ border-color: #ccdbbd;
+ color: #668548;
+}
+
+div#actionlinks a.file.download span
+{
+ background-image: url('images/actionlink-download.png');
+}
+
+div#actionlinks a.vcs.update,
+div#actionlinks a.vcs.commit
+{
+ background-color: #f3e9e9;
+ border-color: #dbbdbd;
+ color: #854848;
+}
+
+div#actionlinks a.vcs.update span
+{
+ background-image: url('images/actionlink-update.png');
+}
+
+div#actionlinks a.vcs.commit span
+{
+ background-image: url('images/actionlink-commit.png');
+}
+
+div#actionlinks a:hover
+{
+ background-color: #fff !important;
+ text-decoration: none;
+}
+
+.item div#actionlinks
+{
+ font-size: 85%;
+ padding-bottom: 0.2em;
+}
+
+.item
+{
+ padding: 1em;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+}
+
+.tptranslate .item,
+.tpreview .item {
+ background-color: #F7F7F7;
+}
+
+.item .title
+{
+ font-weight: bold;
+}
+
+.item h2
+{
+ font-size: 100%;
+}
+
+div.item-statistics
+{
+ margin-top: 1em;
+}
+
+div.item-statistics dl
+{
+ margin: 0;
+}
+
+div.item-statistics dl dt
+{
+ clear: left;
+ float: left;
+ text-align: right;
+ width: 100px;
+}
+
+html[dir="rtl"] div.item-statistics dl dt
+{
+ clear: right;
+ float: right;
+ text-align: left;
+}
+
+div.item-statistics dl dd
+{
+ line-height: inherit;
+ margin: 0 0 0 110px;
+}
+
+html[dir="rtl"] div.item-statistics dl dd
+{
+ margin: 0 110px 0 0;
+}
+
+div.small
+{
+ font-size: 1em;
+}
+
+.tiny
+{
+ font-size: 0.9em;
+}
+
+img.error
+{
+ vertical-align: middle;
+}
+
+/*
+ * Pretty Graphs, mostly from http://l10n.gnome.org/
+ */
+
+div.graph
+{
+ height: 14px;
+ width: 100px;
+ border: 0 none;
+ position: relative;
+}
+
+div.translated
+{
+ position: absolute;
+ top: 2px;
+ height: 100%;
+ background: #448844;
+ background: url('images/bar-translated.png');
+ background-repeat: repeat-x;
+ color: black;
+}
+
+div.goodchange
+{
+ position: absolute;
+ top: 2px;
+ height: 100%;
+ background: #55DD55;
+ background: url('images/bar-goodchange.png');
+ background-repeat: repeat-x;
+ color: black;
+}
+
+div.fuzzy
+{
+ position: absolute;
+ top: 2px;
+ height: 100%;
+ background: #4444AA;
+ background: url('images/bar-fuzzy.png');
+ background-repeat: repeat-x;
+ color: black;
+}
+
+div.untranslated
+{
+ position: absolute;
+ height: 100%;
+ top: 2px;
+ background: #FF4444;
+ background: url('images/bar-untranslated.png');
+ background-repeat: repeat-x;
+ color: black;
+}
+
+div.graph[dir="ltr"] div.translated
+{
+ left: 0%;
+}
+
+div.graph[dir="rtl"] div.translated
+{
+ right: 0%;
+}
+
+/* SORTABLE */
+
+table.sortable th
+{
+ cursor: pointer;
+ color: #999;
+ font-size: 85%;
+}
+
+table.sortable td
+{
+ padding: 5px;
+}
+
+
+table.sortable th.sorttable_sorted,
+table.sortable th.sorttable_sorted_reverse {
+ color: #000;
+}
+
+.sortkey
+{
+ display: none;
+}
+
+/* PAGER */
+
+div.pagination-control
+{
+ margin: 1.5em 0;
+}
+
+ul.pager li
+{
+ display: inline-block;
+}
+
+ul.pager li a,
+ul.pager li a:visited
+{
+ border: 1px solid #ccc;
+ text-decoration: none;
+}
+
+ul.pager li a:hover
+{
+ border-color: #68b8d4;
+ background-color: #b3dbe9;
+}
+
+ul.pager li span.current-link,
+ul.pager li a
+{
+ margin: 1px;
+ padding: 0.2em 0.7em 0.3em;
+}
+
+ul.pager li span.current-link
+{
+ background-color: #68b8d4;
+ color: #fff;
+ border: 1px solid #0489b7;
+ font-weight: bold;
+}
+
+html[dir="ltr"] ul.pager li:first-child > *
+{
+ padding-left: 1em;
+ -moz-border-radius: 1em 0 0 1em;
+ -webkit-border-radius: 1em 0 0 1em;
+ border-radius: 1em 0 0 1em;
+}
+
+html[dir="ltr"] ul.pager li:last-child > *
+{
+ padding-right: 1em;
+ -moz-border-radius: 0 1em 1em 0;
+ -webkit-border-radius: 0 1em 1em 0;
+ border-radius: 0 1em 1em 0;
+}
+
+html[dir="rtl"] ul.pager li:first-child > *
+{
+ padding-right: 1em;
+ -moz-border-radius: 0 1em 1em 0;
+ -webkit-border-radius: 0 1em 1em 0;
+ border-radius: 0 1em 1em 0;
+}
+
+html[dir="rtl"] ul.pager li:last-child > *
+{
+ padding-left: 1em;
+ -moz-border-radius: 1em 0 0 1em;
+ -webkit-border-radius: 1em 0 0 1em;
+ border-radius: 1em 0 0 1em;
+}
+
+
+/*
+ * NAVIGATION BAR
+ */
+
+.title a
+{
+ unicode-bidi: embed;
+}
+
+#breadcrumbs
+{
+ font-weight: normal;
+}
+
+#breadcrumbs span:last-child a {
+ color: inherit;
+}
+
+
+/* SEARCH */
+
+div#search
+{
+ /* this should better be fixed in html template */
+ position: absolute;
+ right: 1em;
+ top: 85px;
+}
+
+div#search[dir="rtl"]
+{
+ right: auto;
+ left: 2em;
+}
+
+div#toolbar_search
+{
+ position: relative;
+}
+
+
+div#toolbar_search input[type=text],
+div#search input[type=text]
+{
+ border: 1px solid #76b0bf;
+ height: 16px;
+ width: 145px;
+}
+
+div#toolbar_search .advancedlink,
+div#search .advancedlink
+{
+ width: 20px;
+ height: 20px;
+ padding: 0;
+ border: 0;
+ margin: 0 0 0 -5px;
+ cursor: pointer;
+ vertical-align: top; /* IE alignment fix */
+}
+
+div#toolbar_search[dir="rtl"] .advancedlink,
+div#search[dir="rtl"] .advancedlink
+{
+ margin: 0 -5px 0 0;
+}
+
+div.advancedsearch
+{
+ background-color: #fff;
+ border-bottom: 1px solid #76b0bf;
+ border-left: 1px solid #76b0bf;
+ border-right: 1px solid #76b0bf;
+ overflow: auto;
+ padding: 5px;
+ position: absolute;
+ z-index: 2000;
+ display: none;
+ width: 135px;
+}
+
+div.advancedsearch li {
+ padding: 0.4em;
+ font-size: 90%;
+}
+
+div.advancedsearch li input {
+ vertical-align: top;
+}
+
+
+div.search-container
+{
+ position: relative;
+}
+
+div#toolbar_search div.advancedsearch {
+ border-bottom: none;
+ border-top: 1px solid #76b0bf;
+ bottom: 20px;
+}
+
+div.nodefaultsearch
+{
+ background-color: #f1f3f5 !important;
+}
+
+label.inputHint
+{
+ display: none;
+}
+
+.togglesearch
+{
+ cursor: pointer;
+ vertical-align: top;
+}
+
+/* Fix for Opera + RTL */
+div#search[dir="rtl"] .togglesearch
+{
+ margin-left: -5px;
+}
+
+/* FILENAMES, STATS */
+
+.icon
+{
+ float: left;
+ margin-right: 8px;
+}
+
+.icon[dir="rtl"]
+{
+ float: right;
+ margin-left: 8px;
+}
+
+.translations-nav
+{
+ clear: both;
+ margin-top: 1em;
+}
+
+.translations-nav:after
+{
+ content: ".";
+ display: block;
+ height: 0;
+ width: 0;
+ clear: both;
+ visibility: hidden;
+}
+
+.translations-nav li
+{
+ float: left;
+ padding: 0 0 0 9px;
+}
+
+html[dir="rtl"] .translations-nav li
+{
+ float: right;
+ padding: 0 9px 0 0;
+}
+
+.translations-nav li:after
+{
+ content: "|";
+ margin: 0 0 0 10px;
+}
+
+html[dir="rtl"] .translations-nav li:after
+{
+ content: "|";
+ margin: 0 10px 0 0;
+}
+
+.translations-nav li:last-child:after,
+html[dir="rtl"] .translations-nav li:last-child:after
+{
+ content: '';
+ margin: 0;
+}
+
+.translations-nav a:link
+{
+ color: #807970;
+}
+
+.translations-nav a:visited
+{
+ color: #807970;
+}
+
+.translations-nav .important
+{
+ font-weight: bold;
+}
+
+
+/*
+ * RSS ALERTS
+ */
+
+#rss-alerts div.bd div.centered
+{
+ width: 100%;
+ text-align: center;
+}
+
+#rss-alerts iframe
+{
+ height: 25em;
+}
+
+/*
+ * MISC
+ */
+
+a.collapse,
+a.slide
+{
+ cursor: pointer;
+}
+
+.collapsethis,
+.slidethis
+{
+ display: none;
+}
+
+
+/*
+ * LANGUAGE SPECIFIC SETTINGS
+ */
+
+/*
+ * Language codes that are styled with right-to-left (rtl) layout:
+ *
+ * ar (Arabic)
+ * arc (Aramaic)
+ * dv (Dhivehi)
+ * fa (Persian)
+ * he (Hebrew)
+ * ks (Kashmir)
+ * ps (Pashto)
+ * ur (Urdu)
+ * yi (Yiddish)
+ *
+ * See: http://translate.sourceforge.net/wiki/l10n/displaysettings
+ * Also see: pagelayout.py::languagedir()
+ *
+ */
+
+/* Doesn't work: [dir="rtl"] */
+*:lang(ar), *:lang(arc), *:lang(dv), *:lang(fa), *:lang(he), *:lang(ks), *:lang(ps), *:lang(ur), *:lang(yi)
+{
+ /* If any styling is necessary for the rtl languages, add it here */
+ direction: rtl;
+}
+
+:lang(ak)
+{
+ font-family: Lucida, "DejaVu Sans", inherit;
+}
+
+:lang(ar)
+{
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+:lang(bn)
+{
+ font-family: FreeSans, MuktiNarrow, Vrinda, inherit;
+ font-size: medium;
+ line-height: 110%;
+}
+
+:lang(el)
+{
+ font-family: "DejaVu Sans", inherit;
+}
+
+:lang(fa)
+{
+ font-family: Terafik, Traffic, Roya, Nazli, Nazanin, inherit;
+ font-size: large;
+}
+
+:lang(ja),
+:lang(ko)
+{
+ font-size: medium;
+}
+
+:lang(zh)
+{
+ font-size: large;
+}
+
+:lang(km)
+{
+ font-family: "Khmer OS System", "Khmer OS", "Khmer Kampongtrach", "CDT Khmer", inherit;
+ line-height: 170%;
+}
+
+:lang(vi)
+{
+ font-family: "Lucida Grande", "Vu Phu Tho", "DejaVu Sans", inherit;
+}
+
+:lang(vi) a:hover[href]
+{
+ text-decoration: none;
+ color: #606047;
+}
+
+:lang(vi) a:active[href]
+{
+ text-decoration: none;
+ color: #606047;
+}
+
+/* FIX FOR HEADING SIZES */
+
+h2:lang(bn),
+h2:lang(ja),
+h2:lang(ko),
+h2:lang(zh)
+{
+ font-size: 170%;
+}
+
+h2:lang(bn) a,
+h2:lang(ja) a,
+h2:lang(ko) a,
+h2:lang(zh) a
+{
+ font-size: 100%;
+}
+
+
+/*
+ * Tipsy CSS
+ */
+
+.tipsy { padding: 5px; font-size: 11px; position: absolute; z-index: 100000; }
+ .tipsy-inner { padding: 5px 8px 4px 8px; background-color: black; color: white; max-width: 200px; text-align: center; }
+ .tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
+ .tipsy-arrow { position: absolute; background: url('images/tipsy.gif') no-repeat top left; width: 9px; height: 5px; }
+ .tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; }
+ .tipsy-nw .tipsy-arrow { top: 0; left: 10px; }
+ .tipsy-ne .tipsy-arrow { top: 0; right: 10px; }
+ .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; }
+ .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; }
+ .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
+ .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
+ .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }
+
+
+/*
+ * Size overrides for different zoom levels
+ */
+
+body.zoom-out-2 #content .documentation,
+body.zoom-out-2 #content table.sortable,
+body.zoom-out-2 table.translate-table,
+body.zoom-out-2 table.stats {
+ font-size: 90%;
+}
+
+body.zoom-out-1 #content .documentation,
+body.zoom-out-1 #content table.sortable,
+body.zoom-out-1 table.translate-table,
+body.zoom-out-1 table.stats {
+ font-size: 95%;
+}
+
+body.zoom-in-1 #content .documentation,
+body.zoom-in-1 #content table.sortable,
+body.zoom-in-1 table.translate-table,
+body.zoom-in-1 table.stats {
+ font-size: 115%;
+}
+
+body.zoom-in-2 #content .documentation,
+body.zoom-in-2 #content table.sortable,
+body.zoom-in-2 table.translate-table,
+body.zoom-in-2 table.stats {
+ font-size: 130%;
+}
diff --git a/src/pootle_it/html/translate.css b/src/pootle_it/html/translate.css
new file mode 100644
index 0000000..07b73c9
--- /dev/null
+++ b/src/pootle_it/html/translate.css
@@ -0,0 +1,1079 @@
+/*
+ * TRANSLATE PAGE
+ */
+
+/* MAIN TOOLBAR */
+
+textarea#view_unit
+{
+ display: none;
+}
+
+div#toolbar
+{
+ background-color: #e5f3f8;
+ border-top: 1px solid #ccc;
+ text-align: left;
+ width: 100%;
+ height: 46px;
+ position: fixed;
+ left: 0;
+ bottom: 0;
+ z-index: 1000;
+ box-shadow: 0px 0px 0px #ccc;
+ -moz-box-shadow: 0px 0px 20px #ccc;
+ -webkit-box-shadow: 0px 0px 20px #ccc;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e5f3f8', endColorstr='#cde7f1');
+ background: -webkit-gradient(linear, left top, left bottom, from(#e5f3f8), to(#cde7f1));
+ background: -moz-linear-gradient(top, #e5f3f8, #cde7f1);
+}
+
+body.zoom-out-1 #toolbar
+{
+ font-size: 95%;
+ height: 42px;
+}
+
+body.zoom-out-1 .xhr-message
+{
+ bottom: 43px;
+}
+
+body.zoom-out-2 #toolbar
+{
+ font-size: 90%;
+ height: 36px;
+}
+
+body.zoom-out-2 .xhr-message
+{
+ bottom: 37px;
+}
+
+div#toolbar > div
+{
+ display: inline-block;
+ padding: 10px;
+}
+
+body.zoom-out-1 div#toolbar > div
+{
+ padding: 8px;
+}
+
+body.zoom-out-2 div#toolbar > div
+{
+ padding: 6px;
+}
+
+#prevnext
+{
+ float: right;
+}
+
+#prevnext #item-navigation
+{
+ font-size: 120%;
+ margin: 0 0.5em;
+}
+
+#prevnext #item-number
+{
+ margin: 0; padding: 0;
+ text-align: center;
+ position: relative;
+ top: 1px;
+}
+
+#prevnext #items-count
+{
+ display: inline-block;
+ min-width: 1em;
+}
+
+
+#prevnext input[type="submit"]
+{
+ min-width: 100px;
+ padding: 4px 10px;
+}
+
+body.zoom-out-1 #prevnext input[type="submit"]
+{
+ min-width: 90px;
+ padding: 3px 8px;
+}
+
+body.zoom-out-2 #prevnext input[type="submit"]
+{
+ min-width: 85px;
+ padding: 2px 8px;
+}
+
+
+
+/* SPECIAL FOOTER */
+
+#translate-footer
+{
+ margin: 0 1em;
+ margin-bottom: 50px; /* this should be equlal or the height of the #toolbar */
+}
+
+/* TRANSLATE TABLE */
+
+table.translate-table
+{
+ width: 100%;
+ table-layout: fixed;
+ margin-top: -1.5em;
+}
+
+table.translate-table td
+{
+ vertical-align: middle;
+}
+
+th.translate-original,
+th.translate-translation
+{
+ width: 50%;
+}
+
+tr.edit-row
+{
+ background-color: #f1f7f8;
+}
+
+tr.more-context
+{
+ font-size: 82%;
+}
+
+tr.more-context td
+{
+ text-align: center;
+}
+
+tr.more-context a
+{
+ text-decoration: none;
+ filter:alpha(opacity=50);
+ -moz-opacity: 0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+tr.more-context a:hover
+{
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+tr.more-context.before td
+{
+ border-top: 1px solid #ccc;
+}
+
+tr.more-context.after td
+{
+ border-bottom: 1px solid #ccc;
+}
+
+tr.context-row,
+tr.view-row
+{
+ font-size: 92%;
+}
+
+tr.more-context,
+tr.context-row
+{
+ background-color: #f8fbfb;
+}
+
+tr.context-row
+{
+ color: #777;/*#76a1b0;*/
+ border-bottom: 1px solid #fff;
+ border-top: 1px solid #fff;
+}
+
+tr.view-row
+{
+ border-top: 1px solid #fff;
+ border-bottom: 1px solid #fff;
+ cursor: pointer;
+}
+
+tr.view-row:hover
+{
+ background-color: #d9edf4;
+}
+
+.translation-text
+{
+ max-width: 100%;
+ overflow: auto;
+ font-size: 115%;
+}
+
+div.sources
+{
+ margin-top: 2em;
+ margin-bottom: -0.5em; /* depends on zoom level */
+}
+
+
+body.zoom-out-1 div.sources
+{
+ margin-bottom: -0.7em;
+}
+
+body.zoom-out-2 div.sources
+{
+ margin-bottom: -1em;
+}
+
+div.sources .translation-text
+{
+ padding: 0.1em 0;
+}
+
+body.zoom-out-1 div.sources .translation-text
+{
+ padding-top: 0.4em;
+}
+
+body.zoom-out-1 div.sources .alternative .translation-text
+{
+ font-size: 98%;
+}
+
+body.zoom-out-2 div.sources .translation-text
+{
+ padding-top: 0.2em;
+}
+
+body.zoom-out-2 div.sources .alternative .translation-text
+{
+ font-size: 95%;
+}
+
+.translation-text-headers
+{
+ color: #999;
+ font-size: 85%;
+ position: relative;
+ border-bottom: 1px dotted #ccc;
+ padding-top: 0.5em;
+}
+
+.translation-space
+{
+ padding: 0 4px;
+ margin: 0 0.2em;
+ background-image: url('images/squiggle.png');
+ background-repeat: repeat-x;
+ background-position: text-bottom;
+ vertical-align: middle;
+}
+
+/* TRANSLATION UNIT LAYOUT */
+
+div.translate-container
+{
+ position: relative;
+}
+
+div.translate-left,
+div.translate-right
+{
+ margin-top: -1em;
+}
+
+
+div.translate-left
+{
+ float: left;
+ width: 24.5%;
+}
+
+div.translate-middle
+{
+ width: 50%;
+ margin: 0 auto;
+ position: relative;
+}
+
+div.translate-right
+{
+ float: right;
+ width: 24.5%;
+}
+
+/* ORIGINAL */
+
+div.source-language
+{
+ margin-bottom: 1em;
+}
+
+div.language-name
+{
+ border-top: 1px dotted #ccc;
+ border-left: 1px dotted #ccc;
+ border-right: 1px dotted #ccc;
+ border-bottom: 1px solid #f1f7f8;
+ -moz-border-radius: 5px 5px 0 0;
+ -webkit-border-radius: 5px 5px 0 0;
+ border-radius: 5px 5px 0 0;
+
+ padding: 1px 5px 0px;
+ display: inline-block;
+ position: absolute;
+ bottom: -1px;
+}
+
+.translate-focus div.translate-original,
+{
+ color: #000;
+}
+
+div.alternative
+{
+ color: #777;
+}
+
+table td.translate-original,
+table td.translate-translation
+{
+ padding: 0.5em 5px;
+}
+
+
+/* COMMENTS */
+
+.comments
+{
+ clear: both;
+ color: #666;
+}
+
+.comments p
+{
+ display: inline;
+ font-size: 85%;
+ line-height: 120%;
+}
+
+.sidetitle,
+.comments .developer-comments
+{
+ display: inline;
+}
+
+.translate-locations,
+.developer-comments,
+.translate-context
+{
+ margin-bottom: 0.5em;
+}
+
+.translate-locations
+{
+ display: inline;
+ font-size: 90%;
+ word-wrap: break-word;
+}
+
+.translate-context-value
+{
+ font-size: 90%;
+ font-weight: bold;
+ display: inline;
+}
+
+.translator-comments
+{
+ margin-bottom: 1em;
+}
+
+div.translator-comments
+{
+ text-align: center;
+}
+
+table.suggest-mode div.translator-comments
+{
+ display: none; /* for now, all translator comments are simply hidden in suggestion mode; TODO: display existing comments in read-only mode*/
+}
+
+div.translator-comments a
+{
+ text-decoration: none;
+}
+
+div.translator-comments a:hover
+{
+ border-bottom: 1px dotted #0489b7;
+}
+
+div.translator-comments label
+{
+ display: block;
+ color: #999;
+ font-size: 85%;
+}
+
+div.translator-comments textarea
+{
+ vertical-align: top;
+ padding: 0;
+ min-height: 1em;
+ width: 100%;
+ color: #666;
+ font-size: 90%;
+ line-height: 1.2em;
+}
+
+.terminology div.translator-comments
+{
+ background: #eaf0f4 url('images/user_comment.png') no-repeat;
+ background-position: 5px center;
+ border: 1px solid #d2e1ed;
+ overflow: auto;
+ padding: 5px 25px;
+}
+
+
+/* TRANSLATION */
+
+td.translate-focus
+{
+ border-top: 1px solid #ccc;
+ border-bottom: 1px solid #ccc;
+ vertical-align: top;
+}
+
+td.translate-full div.translate-original
+{
+ width: 100%;
+ margin: 0.5em 0;
+}
+
+td.translate-full textarea.translation
+{
+ width: 100%;
+ margin: 0 auto 0.5em;
+ padding: 0;
+ min-height: 2.7em;
+}
+
+
+/* TM */
+
+.sidebar
+{
+ padding: 0 20px 1em;
+}
+
+body.zoom-out-1 .sidebar
+{
+ padding-bottom: 0.7em;
+}
+
+body.zoom-out-2 .sidebar
+{
+ padding-bottom: 0.5em;
+}
+
+.sidetitle
+{
+ color: #999;
+ font-size: 85%;
+}
+
+#tm
+{
+ position: relative;
+}
+
+.tm-unit
+{
+ margin: 0 0.5em 0.5em 0;
+ padding: 0.1em 0.5em;
+ border: 1px dotted #999;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 90%;
+}
+
+.tm-unit:hover {
+ background-color: #fff;
+}
+
+.tm-original
+{
+ font-weight: bolder;
+ padding-right: 0.3em;
+}
+
+#tm[dir="rtl"] .tm-original
+{
+ padding-right: auto;
+ padding-left: 0.3em;
+}
+
+.tm-translation
+{
+ font-style: oblique;
+}
+
+.tm-translation[dir="rtl"]
+{
+ text-align: right;
+}
+
+/* SUGGESTIONS */
+
+div.translator-comments + #suggestion-container
+{
+ margin-top: 0.5em;
+}
+
+#suggestion-container
+{
+ margin-top: 1.8em;
+ margin-bottom: 1em;
+}
+
+.suggestion-block
+{
+ position: relative;
+ margin-bottom: 0.5em;
+}
+
+.suggestion-block:last-child
+{
+ margin-bottom: 0;
+}
+
+.suggestion-title
+{
+ color: #999;
+ font-size: 85%;
+}
+
+.suggestion-block .rejectsugg img
+{
+ right: 0.5em;
+ cursor: pointer;
+}
+
+.suggestion-block .rejectsugg img[dir="rtl"]
+{
+ left: 0.5em;
+ right: auto;
+}
+
+.suggestion-block .acceptsugg img
+{
+ right: 2.5em;
+ cursor: pointer;
+}
+
+.suggestion-block .acceptsugg img[dir="rtl"]
+{
+ left: 2.5em;
+ right: auto;
+}
+
+.suggestion-block .rejectsugg img,
+.suggestion-block .acceptsugg img
+{
+ position: absolute;
+ top: 50%;
+ filter:alpha(opacity=10);
+ -moz-opacity: 0.1;
+ -khtml-opacity: 0.1;
+ opacity: 0.1;
+}
+
+.suggestion-block:hover .rejectsugg img,
+.suggestion-block:hover .acceptsugg img
+{
+ filter:alpha(opacity=50);
+ -moz-opacity: 0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+.suggestion-block .rejectsugg img:hover,
+.suggestion-block .acceptsugg img:hover
+{
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+.suggestion
+{
+ background-color: #f1f7e4;
+ border: 1px dotted #ccc;
+ color: #444;
+ line-height: 140%;
+ padding: 0.5em;
+ padding-right: 5em;
+ cursor: pointer;
+}
+
+.translate-translation[dir="rtl"] .suggestion
+{
+ padding-right: 0.5em;
+ padding-left: 5em;
+}
+
+.suggestion:hover {
+ background-color: #fff;
+}
+
+.suggestion-original,
+#amagama_results .suggestion-translation
+{
+ display: inline-block;
+}
+
+.suggestion-original
+{
+ font-weight: bolder;
+ color: #000;
+ padding-right: 1em;
+}
+
+#suggestion[dir="rtl"] .suggestion-original
+{
+ padding-right: auto;
+ padding-left: 1em;
+}
+
+.suggestion-translation[dir="rtl"]
+{
+ text-align: right;
+}
+
+/* CHECKS */
+
+ul.checks
+{
+ display: inline;
+ font-size: 85%;
+}
+
+div.check a
+{
+ cursor: help;
+}
+
+.checkinfo
+{
+ vertical-align: top;
+ margin-top: 3px;
+}
+
+#translate-checks-block
+{
+ margin: 0 1em;
+}
+
+#translate-checks-block .sidetitle
+{
+ color: #900;
+}
+
+li.check
+{
+ display: inline-block;
+ border: 1px dotted #900;
+ margin: 0 0.5em 0.5em 0;
+ padding: 0.1em 0.1em 0.1em 0.5em;
+
+}
+
+li.check:hover
+{
+ background-color: #fff;
+}
+
+li.check > a {
+ cursor: help;
+}
+
+#translate-checks-block .rejectcheck img
+{
+ vertical-align: top;
+ margin-top: -1px;
+ margin-bottom: -1px;
+ cursor: pointer;
+ filter:alpha(opacity=50);
+ -moz-opacity: 0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+#translate-checks-block .rejectcheck img:hover
+{
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+/* CONTROLS */
+
+.translate-buttons-block
+{
+ left: 100%;
+ position: absolute;
+ margin: 0 10px 0 20px;
+}
+
+.translate-buttons-block[dir="rtl"]
+{
+ left: auto;
+ right: 102%;
+}
+
+.translate-buttons-block input[type="submit"]
+{
+ margin-bottom: 0.5em;
+}
+
+.buttons input[type="submit"].submit
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffee', endColorstr='#aaee77');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ffe), to(#ae7));
+ background: -moz-linear-gradient(top, #ffe, #ae7);
+}
+
+.translate-buttons-block input.submit:hover {
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#bbff88');
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#bf8));
+ background: -moz-linear-gradient(top, #fff, #bf8);
+}
+
+.translate-buttons-block input.submit:active
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#aaee77', endColorstr='#ffffee');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ae7), to(#ffe));
+ background: -moz-linear-gradient(top, #ae7, #ffe);
+}
+
+.buttons input[type="submit"].suggest
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffee', endColorstr='#eedd88');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ffe), to(#ed8));
+ background: -moz-linear-gradient(top, #ffe, #ed8);
+}
+
+.translate-buttons-block input.suggest:hover {
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ffee99');
+ background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#fe9));
+ background: -moz-linear-gradient(top, #fff, #fe9);
+}
+
+.translate-buttons-block input.suggest:active
+{
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eedd88', endColorstr='#ffffee');
+ background: -webkit-gradient(linear, left top, left bottom, from(#ed8), to(#ffe));
+ background: -moz-linear-gradient(top, #ed8, #ffe);
+}
+
+.translate-buttons-block input.suggest
+{
+ display: none;
+}
+
+table.suggest-mode .translate-buttons-block input.suggest
+{
+ display: block;
+}
+
+table.suggest-mode .translate-buttons-block input.submit
+{
+ display: none;
+}
+
+.translate-fuzzy-block
+{
+ text-align: center;
+ font-style: italic;
+}
+
+.translate-fuzzy-block label
+{
+ vertical-align: middle;
+}
+
+input.fuzzycheck
+{
+ vertical-align: middle;
+}
+
+table.suggest-mode .translate-fuzzy-block
+{
+ display: none;
+}
+
+.switch-suggest-mode
+{
+ position: absolute;
+ left: 120px;
+ top: 0px;
+ padding: 5px 0;
+ line-height: 150%;
+}
+
+.translate-full[dir="rtl"] .switch-suggest-mode
+{
+ left: 0px;
+ right: 120px;
+}
+
+.switch-suggest-mode a
+{
+ text-decoration: none;
+ white-space: nowrap;
+ filter:alpha(opacity=50);
+ -moz-opacity: 0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+.switch-suggest-mode a:hover
+{
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+.switch-suggest-mode .suggest
+{
+ display: none;
+}
+
+table.suggest-mode .switch-suggest-mode .suggest
+{
+ display: inherit;
+}
+
+table.suggest-mode .switch-suggest-mode .submit
+{
+ display: none;
+}
+
+.translate-specialchars-block
+{
+ text-align: center;
+ padding-bottom: 0.5em;
+}
+
+.translate-toolbar
+{
+ position: absolute;
+ top: -12px;
+ /* LTR */
+ right: 0;
+}
+
+.translate-toolbar a
+{
+ margin-left: 0.5em;
+}
+
+
+div.translation-text-headers[dir="rtl"] div.translate-toolbar
+{
+ right: auto;
+ left: 0;
+}
+
+div.translation-text-headers[dir="rtl"] div.translate-toolbar a
+{
+ margin-left: 0;
+ margin-right: 0.5em;
+}
+
+a.copyoriginal,
+a.translate-mt,
+a.writespecial,
+a.morecontext,
+.translate-full .highlight-escape,
+.translate-full .highlight-html
+{
+ cursor: pointer;
+}
+
+a.translate-mt,
+a.copyoriginal {
+ filter:alpha(opacity=50);
+ -moz-opacity: 0.5;
+ -khtml-opacity: 0.5;
+ opacity: 0.5;
+}
+
+a.translate-mt:hover,
+a.copyoriginal:hover {
+ filter:alpha(opacity=100);
+ -moz-opacity: 1;
+ -khtml-opacity: 1;
+ opacity: 1;
+}
+
+a.writespecial
+{
+ border: 1px dotted #999;
+ padding: 0 0.2em;
+ min-width: 1.3em;
+ margin: 2px 0;
+ color: #666;
+ display: inline-block;
+}
+
+a.writespecial:hover
+{
+ background-color: #fff;
+ text-decoration: none;
+}
+
+/* DIFF */
+
+.diff-replace,
+.diff-delete,
+.diff-insert
+{
+ color: #000;
+ background-color: #ffb;
+ border: 1px dotted #999;
+}
+
+.diff-delete,
+.diff-delete *
+{
+ color: #aaa !important;
+ text-decoration: line-through;
+}
+
+/* DIFF FOR TM SERVER ENTRIES */
+
+.tm-server .diff-replace,
+.tm-server .diff-delete,
+.tm-server .diff-insert
+{
+ color: #999;
+ border: 1px dotted #ccc;
+ background-color: #F1F7F8; /* same as edit-row bg */
+}
+
+.tm-server .diff-delete,
+.tm-server .diff-delete *
+{
+ color: #ccc !important;
+ font-weight: normal;
+}
+
+
+/* HIGHLIGHT */
+
+.highlight-escape
+{
+ color: purple;
+}
+
+.highlight-html
+{
+ color: #840;
+}
+
+.tm-server .suggestion-original .highlight-html
+{
+ color: #630;
+}
+
+.highlight
+{
+ background-color: #FFC;
+}
+
+/* FUZZY TRANSLATION */
+
+div.translate-translation
+{
+ min-height: 1.5em;
+}
+
+/* Special handling for languages with big fonts */
+td.translate-full div.translate-translation:lang(bn),
+td.translate-full div.translate-translation:lang(fa),
+td.translate-full div.translate-translation:lang(ja),
+td.translate-full div.translate-translation:lang(ko),
+td.translate-full div.translate-translation:lang(zh)
+{
+ margin-bottom: 35px;
+}
+
+tr.view-row td.fuzzy-unit .translation-text
+{
+ color: #888;
+ font-style: italic;
+}
+
+tr.edit-row.fuzzy-unit textarea.translation
+{
+ font-style: italic;
+}
+
+table.suggest-mode tr.edit-row.fuzzy-unit textarea.translation
+{
+ color: inherit;
+ font-style: normal;
+}
+
+
+textarea.translation
+{
+ resize: vertical;
+ font-size: 115%;
+}
+
+/* TERMINOLOGY MANAGEMENT */
+
+td.translate-delete-terminology input
+{
+ display: block;
+ margin: 0 auto;
+}
+
+.translate-term-original
+{
+ padding: 0 10px;
+}
+
+.translate-term-translation
+{
+ padding: 0 25px;
+}
+
+.left
+{
+ float: left;
+}
+
+.right
+{
+ float: right;
+}