Crowdin = window.Crowdin ? Crowdin : { phrases: null, htmlPhrases: [], entryPoint: "http://crowdin.net/", jiptCDN: "http://jipt.crowdin.net/", editor: { currentTranslation: null, currentTranslations: [], currentElement: null, showTranslations: false, marker: "border", skipApproved: false, files: false, customPlaceholders: [], mergeDuplicates: true, currentPhraseId: null, traversePage: true }, suggestions: { tm: [], google: [], microsoft: [] }, language: { code: null, id: 0 }, source_language: { code: null }, project: { id: 0, identifier: null, name: null }, user: { is_leader: false, is_logged_in: true }, previewTranslations: false, _preloadCallbacks: [], is_first_run: false, matchType: { any: 0, text: 1, textRegExp: 2, html: 3, htmlRegExp: 4, htmlOuter: 5, title: 6 }, placeholders: [{ template: "((?:%%|%(?:[0-9]+\\$)?[+-]?(?:[ 0]|'.)?-?[0-9]*(?:\\.[0-9]+)?[bcdeufFosxX]))", replacement: "(.*)" }, { template: "(\\{0\\})", replacement: "(.*)" }, { template: "(\\{1\\})", replacement: "(.*)" }, { template: "(\\{2\\})", replacement: "(.*)" }, { template: "(\\{3\\})", replacement: "(.*)" }, { template: "(\\{4\\})", replacement: "(.*)" }, { template: "(\\{5\\})", replacement: "(.*)" }, { template: "(%1)", replacement: "(.*)" }, { template: "(%2)", replacement: "(.*)" }, { template: "(%3)", replacement: "(.*)" }, { template: "(%4)", replacement: "(.*)" }, { template: "(%5)", replacement: "(.*)" }, { template: "(%6)", replacement: "(.*)"}], init: function() { Crowdin.self = this; this.self_configure(); this.init_google_jsapi(); return this }, ready: function(a) { Crowdin._preloadCallbacks.push(a) }, get_instance: function() { return Crowdin.self }, start_translation: function() { if ($JIPT("#crowdin-translation-panel").length) { this.just_show_panel() } else { this.init_editor().init_translation_panel().init_help_dialog(); this.loader.create().hide() } }, self_configure: function() { if (this.check_first_run()) { this.is_first_run = true } else { this.is_first_run = false } if (!Crowdin.cookies.has("crowdin_language_code" + this.get_project_identifier()) || !Crowdin.cookies.has("crowdin_language_id" + this.get_project_identifier()) || !Crowdin.cookies.has("crowdin_project_id" + this.get_project_identifier()) || !Crowdin.cookies.has("crowdin_project_name" + this.get_project_identifier()) || !Crowdin.cookies.has("crowdin_source_language_code" + this.get_project_identifier())) { this.logout() } this.language.code = Crowdin.cookies.get("crowdin_language_code" + this.get_project_identifier()); this.language.id = Crowdin.cookies.get("crowdin_language_id" + this.get_project_identifier()); this.project.id = Crowdin.cookies.get("crowdin_project_id" + this.get_project_identifier()); this.project.name = Crowdin.cookies.get("crowdin_project_name" + this.get_project_identifier()); this.user.is_leader = Crowdin.cookies.get("crowdin_is_leader" + this.get_project_identifier()); if (Crowdin.cookies.has("crowdin_marker" + this.get_project_identifier())) { this.editor.marker = Crowdin.cookies.get("crowdin_marker" + this.get_project_identifier()) } if (Crowdin.cookies.has("crowdin_merge_duplicates" + this.get_project_identifier())) { this.editor.mergeDuplicates = (Crowdin.cookies.get("crowdin_merge_duplicates" + this.get_project_identifier()) == "true") } else { this.editor.mergeDuplicates = true } if (Crowdin.cookies.has("crowdin_show_translations" + this.get_project_identifier())) { this.editor.showTranslations = (Crowdin.cookies.get("crowdin_show_translations" + this.get_project_identifier()) == "true"); this.previewTranslations = this.editor.showTranslations } this.source_language.code = Crowdin.cookies.get("crowdin_source_language_code" + this.get_project_identifier()) }, check_first_run: function() { if (!Crowdin.cookies.pattern_has("crowdin_marker") && !Crowdin.cookies.pattern_has("crowdin_merge_duplicates") && !Crowdin.cookies.pattern_has("crowdin_show_translations")) { return true } else { return false } }, show_quick_start: function() { $JIPT("#crowdin-help-container").attr("src", this.jiptCDN + "help/quick-start.html"); $JIPT("#crowdin-help").dialog("open") }, set_element_marker: function(c, a) { if (this.previewTranslations) { return } c = $JIPT(c); var e = c.attr("class").split(/\s+/); var f = /^crowdin-jipt-/; for (var b = 0; b < e.length; b++) { var d = e[b]; if (d.match(f)) { c.removeClass(d) } } $JIPT(c).addClass(a + "-" + this.editor.marker) }, _get_editor_buttons: function() { var a = {}; if (this.editor.currentPhraseId) { a["Translate and Open Next"] = this._suggest_translation_and_open_next; a.Skip = this._proceed_to_next_phrase } if (this.editor.currentTranslations && this.editor.currentTranslations.length > 0) { a["Translate All"] = this._suggest_translation } else { a.Translate = this._suggest_translation } a.Cancel = function() { $JIPT("#crowdin-editor").dialog("close"); if (Crowdin.self.editor.currentElement != null) { } }; return a }, init_editor: function() { if ($JIPT("#crowdin-editor").length) { return this } $JIPT($JIPT("
").attr("id", "crowdin-editor").attr("title", "Crowdin Editor").css("display", "none").html(this.get_editor_markup())).appendTo("body"); $JIPT("#crowdin-editor").dialog({ autoOpen: false, height: "auto", zIndex: 16777260, width: 600, dialogClass: "cjipt", beforeClose: function() { $JIPT(".crowdin-active-element").removeClass("crowdin-active-element") }, buttons: this._get_editor_buttons() }); this.dialog_ui_help($JIPT("#crowdin-editor"), this.jiptCDN + "help/crowdin-editor.html"); $JIPT("#crowdin-show-hide-context").click(function() { $JIPT("#crowdin-context-header").slideToggle(); $JIPT(".crowdin-phrase-context").slideToggle() }); $JIPT("#crowdin-copy-source").click(function() { var a = Crowdin.self.editor.currentTranslation.html ? Crowdin.self.editor.currentTranslation.html : Crowdin.self.editor.currentTranslation.text; $JIPT(".crowdin-editor-translation").val(a).focus(); Crowdin.self.place_translation_preview(a) }); $JIPT("#crowdin-edit-context").click(function() { $JIPT("#crowdin-context-editor-current-context").html(Crowdin.self.editor.currentTranslation.context.replace(/(\r\n|\n\r|\r|\n)/g, "
")); $JIPT("#crowdin-context-editor").dialog("open"); Crowdin.self.fix_dialogs() }); $JIPT(".crowdin-editor-translation").keyup(function(a) { if ($JIPT(this).val().length == 0) { return } if (a.keyCode != 27) { Crowdin.self.place_translation_preview($JIPT(this).val()) } if ((a.ctrlKey) && ((a.keyCode == 10) || (a.keyCode == 13))) { if (Crowdin.self.editor.currentPhraseId) { Crowdin.self._suggest_translation_and_open_next() } else { Crowdin.self._suggest_translation() } } if ((a.altKey) && ((a.keyCode == 10) || (a.keyCode == 13))) { if (Crowdin.self.editor.currentPhraseId) { Crowdin.self._proceed_to_next_phrase() } } }); this.init_context_editor(); this.init_functions_proxy(); return this }, _suggest_translation_and_open_next: function() { if (Crowdin.self._suggest_translation()) { Crowdin.self._proceed_to_next_phrase() } }, _proceed_to_next_phrase: function() { if (Crowdin.self.editor.currentPhraseId && Crowdin.self.phrases[Crowdin.self.editor.currentPhraseId + 1]) { Crowdin.self.editor.currentPhraseId++; Crowdin.self.editor.currentTranslation = Crowdin.self.phrases[Crowdin.self.editor.currentPhraseId]; Crowdin.self.editor.currentTranslations = []; Crowdin.self.editor.currentElement = null; Crowdin.self.editor.currentPhraseId = Crowdin.self.editor.currentPhraseId; Crowdin.self.show_editor() } else { Crowdin.self.loader.notify("You reached the end of file.") } }, _suggest_translation: function() { if (!Crowdin.self._validate_translation()) { return false } else { Crowdin.self._force_suggest_translation(); return true } }, trigger_suggestion_added: function() { if (this.editor.currentElement != null) { for (var a = this.editor.currentTranslation.elements.length; a--; ) { this.set_element_marker(this.editor.currentTranslation.elements[a], "crowdin-jipt-translated") } } var c = null; for (var b = this.phrases.length; b--; ) { if (this.phrases[b].id == this.editor.currentTranslation.id) { this.phrases[b].suggestions_count++; c = b; break } } $JIPT(".jipt-phrases-to-translate li a[rel=" + c + "]").removeClass("crowdin-untranslated-item").addClass("crowdin-translated-item") }, trigger_suggestion_approved: function() { if (this.editor.currentElement != null) { for (var a = this.editor.currentTranslation.elements.length; a--; ) { this.set_element_marker(this.editor.currentTranslation.elements[a], "crowdin-jipt-approved") } } var c = null; for (var b = this.phrases.length; b--; ) { if (this.phrases[b].id == this.editor.currentTranslation.id) { this.phrases[b].approved = true; c = b; break } } $JIPT(".jipt-phrases-to-translate li a[rel=" + c + "]").removeClass("crowdin-translated-item").addClass("crowdin-approved-item") }, _force_suggest_translation: function() { $JIPT("#crowdin-editor").dialog("close"); this.trigger_suggestion_added(); if (this.editor.currentTranslations.length) { for (var a = 0; a < this.editor.currentTranslations.length; a++) { this.suggest(this.editor.currentTranslations[a].translation, $JIPT(".crowdin-editor-translation").val()) } } else { this.suggest(this.editor.currentTranslation, $JIPT(".crowdin-editor-translation").val()) } }, _validate_translation: function() { var a = $JIPT(".crowdin-editor-translation").val(); if (!a.length) { this.loader.notify("Translation can not be empty string"); $JIPT(".crowdin-editor-translation").focus(); return false } var p = this.editor.currentTranslation.text.match(/^\s*/g)[0].length; var b = a.match(/^\s*/g)[0].length; var c = this.editor.currentTranslation.text.match(/\s*$/g)[0].length; var d = a.match(/\s*$/g)[0].length; if (p != b && p == 0) { this.validation_message_with_action("Original text doesn't have any leading spaces, but your suggestion begins with " + b + " spaces"); return false } if (c != d && c == 0) { this.validation_message_with_action("Original text doesn't have any trailing spaces, but your suggestion ends with " + d + " spaces"); return false } if (p != b && b == 0) { this.validation_message_with_action("Original text begins with " + p + " leading spaces, but your suggestion haven't at all"); return false } if (c != d && d == 0) { this.validation_message_with_action("Original text ends with " + c + " trailing spaces, but your suggestion haven't at all"); return false } if (p != b && c != d) { this.validation_message_with_action("The original text has " + p + " leading spaces and " + c + " trailing spaces, your suggestion has " + b + " leading spaces and " + d + " trailing"); return false } if (p != b) { this.validation_message_with_action("The original text has " + p + " leading spaces, your suggestion has " + b); return false } if (c != d) { this.validation_message_with_action("The original text has " + c + " trailing spaces, your suggestion has " + d); return false } var l = this.editor.currentTranslation.text.match(/[\.\!\?\:]+\s*$/g); var h = a.match(/[\.\!\?\:]+\s*$/g); if (!this.is_eq(l, h) && l == null) { this.validation_message_with_action("The original text does not end with: " + h.join(", ") + ""); return false } if (!this.is_eq(l, h) && h == null) { this.validation_message_with_action('Probably you forgot the ending: "' + l.join(", ") + '"'); return false } if (!this.is_eq(l, h) && l != null && h != null) { this.validation_message_with_action('The original text ends with "' + l.join(", ") + '", but your suggestion ends with "' + h.join(", ") + '"'); return false } var n = []; var i = []; var m = []; var g, e, q = null, o = null, f = null; for (g = 0; g < this.placeholders.length; g++) { q = new RegExp(this.placeholders[g].template, "g"); o = this.editor.currentTranslation.text.match(q); f = a.match(q); if (o && o.length) { for (e = 0; e < o.length; e++) { i.push(o[e]) } } if (f && f.length) { for (e = 0; e < f.length; e++) { m.push(f[e]) } } } for (g = 0; g < this.editor.customPlaceholders.length; g++) { q = new RegExp(this.editor.customPlaceholders[g], "g"); o = this.editor.currentTranslation.text.match(q); f = a.match(q); if (o && o.length) { for (e = 0; e < o.length; e++) { i.push(o[e]) } } if (f && f.length) { for (e = 0; e < f.length; e++) { m.push(f[e]) } } } for (e = 0; e < i.length; e++) { if (m.indexOf(i[e]) == -1) { n.push(i[e]) } } if (n.length > 0) { this.validation_message_with_action("You translated or forgot some variables that should have been left as they were: " + n.join(", ") + ""); return false } return true }, validation_message_with_action: function(a) { this.loader.update(a + ' Continue anyway!') }, init_functions_proxy: function() { var b = window.alert; window.alert = function() { if (arguments[0]) { Crowdin.self.process_abstract_text(arguments[0]) } return b.apply(this, arguments) }; var a = window.confirm; window.confirm = function() { if (arguments[0]) { Crowdin.self.process_abstract_text(arguments[0]) } return a.apply(this, arguments) } }, process_abstract_text: function(b) { if (!b.length || !this.phrases) { return false } for (var a = this.phrases.length; a--; ) { if (this.fuzzy_trim(b) == this.phrases[a].textCleared) { this.editor.currentTranslation = this.phrases[a]; this.editor.currentTranslations = []; this.editor.currentElement = null; this.editor.currentPhraseId = null; this.show_editor(); return true } if (this.phrases[a].regexp) { if (b.match(this.phrases[a].regexp)) { this.editor.currentTranslation = this.phrases[a]; this.editor.currentTranslations = []; this.editor.currentElement = null; this.editor.currentPhraseId = null; this.show_editor(); return true } } } return false }, init_context_editor: function() { if ($JIPT("#crowdin-context-editor").length) { return } $JIPT($JIPT("
").attr("id", "crowdin-context-editor").attr("title", "Context Editor").css("display", "none").html(this.get_context_editor_markup())).appendTo("body"); $JIPT("#crowdin-context-editor").dialog({ autoOpen: false, height: "auto", width: 500, zIndex: 16777270, dialogClass: "cjipt", resizable: false, modal: true, buttons: this.get_context_editor_buttons() }); $JIPT("#crowdin-context-editor-current-context").hover(function() { $JIPT(this).css("background-color", "#fffed4") }, function() { $JIPT(this).css("background-color", "#fff") }); $JIPT("#crowdin-context-editor-current-context").click(function() { $JIPT("#crowdin-context-editor-context").val(Crowdin.self.editor.currentTranslation.context).focus() }) }, init_help_dialog: function() { if ($JIPT("#crowdin-help").length) { return this } $JIPT($JIPT("
").attr("id", "crowdin-help").attr("title", "Crowdin Help").css("display", "none").html('')).appendTo("body"); $JIPT("#crowdin-help").dialog({ autoOpen: false, height: 500, width: 700, zIndex: 16777271, dialogClass: "cjipt", resizable: true, modal: true }); return this }, get_context_editor_buttons: function() { var a = {}; a["Update context"] = function() { var c = $JIPT("#crowdin-context-editor-context").val(); Crowdin.self.editor.currentTranslation.context = c; var b = "File: " + Crowdin.self.editor.currentTranslation.file + "
Context:
" + c + "
"; $JIPT(".crowdin-phrase-context").html(b); $JIPT.ajax({ url: Crowdin.self.entryPoint + "jipt/update_context?callback=?", dataType: "json", data: { id: Crowdin.self.editor.currentTranslation.id, project: Crowdin.self.get_project_identifier(), context: c }, success: function(d) { if (!d.success) { alert(d.msg) } else { $JIPT("#crowdin-context-editor").dialog("close"); Crowdin.self.loader.notify("Context has been updated...") } } }) }; a.Cancel = function() { $JIPT("#crowdin-context-editor").dialog("close") }; return a }, get_match_type_text: function(a) { switch (a) { default: case this.matchType.text: case this.matchType.textRegExp: case this.matchType.html: case this.matchType.htmlRegExp: case this.matchType.htmlOuter: return "Text on page"; case this.matchType.title: return "Element title" } }, init_translation_panel: function() { if (!$JIPT("#crowdin-translation-panel").length) { $JIPT($JIPT("
").attr("id", "crowdin-translation-panel").attr("title", "Crowdin JIPT").css("display", "none").html(this.get_translation_panel_markup())).prependTo("body"); $JIPT("#crowdin-translation-panel").dialog({ autoOpen: false, height: "auto", zIndex: 16777260, dialogClass: "cjipt", width: 500, height: 380, position: ["right", "bottom"] }); this.dialog_ui_minimization($JIPT("#crowdin-translation-panel")); this.dialog_ui_help($JIPT("#crowdin-translation-panel"), this.jiptCDN + "help/translations-panel.html"); this.bind_auto_search() } else { this.just_show_panel() } if (!this.user.is_logged_in) { this.init_login_panel() } else { this.init_translation_panel_phrases(); this.configure_translation_panel() } return this }, configure_translation_panel: function() { $JIPT("#jipt-options #jipt-show-actual-translations").get(0).checked = this.editor.showTranslations; $JIPT("#jipt-options #jipt-group-matches").get(0).checked = this.editor.mergeDuplicates; $JIPT("#jipt-options #jipt-marker").val(this.editor.marker); if (!this.editor.traversePage) { $JIPT("#jipt-options .inline-table").hide(); $JIPT("#jipt-preview-translations").hide(); $JIPT("#jipt-marker").parents("tr").remove() } }, init_translation_panel_phrases: function() { $JIPT(".crowdin-translation-panel-container").tabs(); $JIPT.ajax({ url: this.entryPoint + "jipt/project_languages?callback=?", dataType: "json", data: { project: this.get_project_identifier() }, success: function(c) { if (!Crowdin.self.check_auth(c)) { return } for (var a = 0; a < c.length; a++) { var b = $JIPT("
' }, get_context_editor_markup: function() { return '

Note: Your comment will be visible for translators into other languages

' }, get_signup_panel_markup: function() { return '' }, set_project_identifier: function(a) { this.project.identifier = a }, set_target_language: function(a) { this.language.code = a; Crowdin.cookies.set("crowdin_language_code" + this.get_project_identifier(), a) }, set_marker: function(a) { this.editor.marker = a; Crowdin.cookies.set("crowdin_marker" + this.get_project_identifier(), a) }, set_target_language_id: function(a) { this.language.id = a; Crowdin.cookies.set("crowdin_language_id" + this.get_project_identifier(), a) }, set_project_id: function(a) { this.project.id = a; Crowdin.cookies.set("crowdin_project_id" + this.get_project_identifier(), a) }, mark_translatable_phrases: function(a) { this.editor.traversePage = a }, set_project_name: function(a) { this.project.name = a; Crowdin.cookies.set("crowdin_project_name" + this.get_project_identifier(), a) }, set_is_leader: function(a) { this.user.is_leader = a; Crowdin.cookies.set("crowdin_is_leader" + this.get_project_identifier(), a) }, set_translations_panel_state: function(a) { Crowdin.cookies.set("crowdin_is_tp_min" + this.get_project_identifier(), a) }, set_source_language: function(a) { this.source_language.code = a; Crowdin.cookies.set("crowdin_source_language_code" + this.get_project_identifier(), a) }, set_show_translations: function(a) { this.editor.showTranslations = a; Crowdin.cookies.set("crowdin_show_translations" + this.get_project_identifier(), a) }, set_files: function(a) { this.editor.files = a }, set_skip_approved: function(a) { this.editor.skipApproved = a }, set_custom_placeholders: function(a) { this.editor.customPlaceholders = a }, set_merge_duplicates: function(a) { this.editor.mergeDuplicates = a; Crowdin.cookies.set("crowdin_merge_duplicates" + this.get_project_identifier(), a) }, login: function(a, b, c) { $JIPT.ajax({ url: this.entryPoint + "jipt/login?callback=?", dataType: "json", data: { login: a, password: b, language_code: this.language.code, project: this.get_project_identifier() }, success: function(d) { Crowdin.self.login_success(d); if (c) { c(d.success) } } }) }, logout: function() { $JIPT.ajax({ url: this.entryPoint + "jipt/logout?callback=?", dataType: "json", data: { project: this.get_project_identifier() }, success: function(a) { Crowdin.self.user.is_logged_in = false; $JIPT("#crowdin-translation-panel").html(Crowdin.self.get_translation_panel_markup()); Crowdin.self.init_login_panel(); $JIPT("#crowdin-editor").dialog("close") } }) }, preview_translations: function() { this.overlay.create(); this.previewTranslations = true; this.drop_element_translation_relations(document.body); this.proceed_phrases_with_html(document.body); this.each_element(document.body, this.phrases); this.clear_markers($JIPT("body")); $JIPT("#crowdin-editor").dialog("close"); this.overlay.destroy() }, clear_markers: function(a) { a.find(".crowdin-jipt-approved-border").removeClass("crowdin-jipt-approved-border"); a.find(".crowdin-jipt-translated-border").removeClass("crowdin-jipt-translated-border"); a.find(".crowdin-jipt-untranslated-border").removeClass("crowdin-jipt-untranslated-border"); a.find(".crowdin-jipt-has-many-border").removeClass("crowdin-jipt-has-many-border"); a.find(".crowdin-jipt-approved-bg").removeClass("crowdin-jipt-approved-bg"); a.find(".crowdin-jipt-translated-bg").removeClass("crowdin-jipt-translated-bg"); a.find(".crowdin-jipt-untranslated-bg").removeClass("crowdin-jipt-untranslated-bg"); a.find(".crowdin-jipt-has-many-bg").removeClass("crowdin-jipt-has-many-bg"); a.find(".crowdin-jipt-approved-underline").removeClass("crowdin-jipt-approved-underline"); a.find(".crowdin-jipt-translated-underline").removeClass("crowdin-jipt-translated-underline"); a.find(".crowdin-jipt-untranslated-underline").removeClass("crowdin-jipt-untranslated-underline"); a.find(".crowdin-jipt-has-many-underline").removeClass("crowdin-jipt-has-many-underline"); a.find(".crowdin-jipt-approved-none").removeClass("crowdin-jipt-approved-none"); a.find(".crowdin-jipt-translated-none").removeClass("crowdin-jipt-translated-none"); a.find(".crowdin-jipt-untranslated-none").removeClass("crowdin-jipt-untranslated-none"); a.find(".crowdin-jipt-has-many-none").removeClass("crowdin-jipt-has-many-none") }, get_login_panel_markup: function() { return '' }, get_translation_panel_markup: function() { if (!this.user.is_logged_in) { return this.get_login_panel_markup() } else { return '
  • Loading...
   
' } }, get_project_identifier: function() { if (this.project.identifier != null) { return this.project.identifier } else { return document.domain } }, check_auth: function(a) { if (a.jipt_error) { $JIPT("#crowdin-editor").dialog("close"); $JIPT("#crowdin-translation-panel").dialog("close"); alert(a.message); this.user.is_logged_in = false; return false } if (a.auth_error) { this.user.is_logged_in = false; $JIPT("#crowdin-translation-panel").html(this.get_translation_panel_markup()); this.init_login_panel(); return false } else { return true } }, fix_dialogs: function() { this.clear_markers($JIPT("#crowdin-editor").parents(".ui-dialog")); $JIPT("#crowdin-editor").parents(".ui-dialog").css("height", "auto"); $JIPT("#crowdin-editor").css("height", "auto"); $JIPT("#crowdin-context-editor").parents(".ui-dialog").css("height", "auto") }, fuzzy_trim: function(a) { return a.replace(/^[\s:.()*-]+|[\s:.()*-]+$/g, "").replace(/\\t/g, "").replace(/\\n/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"') }, fuzzy_trimmed: function(c) { c = c.replace(/^[\s]+|[\s]+$/g, ""); var b = c.match(/^([:.()*-]+)/g); var a = c.match(/([:.()*-]+)$/g); return { l: b ? b[0] : "", r: a ? a[0] : ""} }, htmlspecialchars: function(a) { return a.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """) }, unhtmlspecialchars: function(a) { return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"') }, just_show_panel: function() { $JIPT("#crowdin-translation-panel").dialog("open") }, is_eq: function(c, b) { if (c == b) { return true } else { if (c == null || b == null) { return false } else { if (c.length != b.length) { return false } } } for (var a = 0; a < c.length; a++) { if (c[a] != b[a]) { return false } } return true }, load_external_resource: function(b, a) { if (a == "js") { var c = document.createElement("script"); c.setAttribute("type", "text/javascript"); c.setAttribute("src", b) } else { if (a == "css") { var c = document.createElement("link"); c.setAttribute("rel", "stylesheet"); c.setAttribute("type", "text/css"); c.setAttribute("href", b) } } if (typeof c != "undefined") { document.getElementsByTagName("head")[0].appendChild(c) } return c }, loader: { create: function() { var a = $JIPT("
").appendTo(document.body).attr("id", "crowdin-load-indicator"); return a }, hide: function() { $JIPT("#crowdin-load-indicator").hide(); return this }, fadeOut: function() { $JIPT("#crowdin-load-indicator").fadeOut(); return this }, show: function() { $JIPT("#crowdin-load-indicator").show(); return this }, update: function(a) { $JIPT("#crowdin-load-indicator").html(a).show(); Crowdin.self.loader.center(); return this }, notify: function(a) { Crowdin.self.loader.update(a); setTimeout(function() { Crowdin.self.loader.fadeOut() }, 2000); return this }, center: function() { var a = $JIPT("#crowdin-load-indicator"); a.css("left", ($JIPT(window).width() - a.width()) / 2 + $JIPT(window).scrollLeft() + "px"); return this } }, overlay: { create: function() { var a = $JIPT("
").appendTo(document.body).addClass("ui-widget-overlay").css({ width: $JIPT.ui.dialog.overlay.width(), height: $JIPT.ui.dialog.overlay.height(), zIndex: 16777271 }); return a }, destroy: function() { $JIPT(".ui-widget-overlay").remove() } }, cookies: { set: function(a, b) { var c = new Date((new Date()).getTime() + (365 * 1000 * 60 * 60 * 24)); document.cookie = a + "=" + escape(b) + ";expires=" + c.toGMTString() + ";path=/" }, get: function(a) { var e = document.cookie.split(";"); var c = ""; var f = ""; var d = ""; for (var b = 0; b < e.length; b++) { c = e[b].split("="); f = c[0].replace(/^\s+|\s+$/g, ""); if (f == a) { if (c.length > 1) { d = unescape(c[1].replace(/^\s+|\s+$/g, "")) } return d } c = null; f = "" } return null }, has: function(a) { return Crowdin.cookies.get(a) }, pattern_has: function(a) { var c = document.cookie.split(";"); var d = ""; for (var b = 0; b < c.length; b++) { d = c[b].split("=")[0].replace(/^\s+|\s+$/g, ""); if (d.indexOf(a)) { return true } } return false } }, dialog_ui_help: function(e, b) { var a = e.parents(".cjipt"); var d = a.find(".ui-dialog-titlebar:first"); var c = $JIPT("").addClass("ui-icon").addClass("ui-icon-help"); var f = $JIPT('').append(c); f.click(function(g) { $JIPT("#crowdin-help-container").attr("src", b); $JIPT("#crowdin-help").dialog("open"); g.stopPropagation(); return false }); d.append(f) }, dialog_ui_minimization: function(e) { var a = e.parents(".cjipt"); var d = a.find(".ui-dialog-titlebar"); var c = $JIPT("").addClass("ui-icon").addClass("ui-icon-minusthick").data("state", true); var b = $JIPT('').append(c); a.get(0).jipt_minimize = function() { c.removeClass("ui-icon-minusthick").addClass("ui-icon-newwin").data("height", a.height()).data("width", a.width()).data("position", a.position()).data("state", false); e.hide(); $JIPT(e).dialog("option", "resizable", false); $JIPT(e).dialog("option", "draggable", false); a.height("auto").width(250); a.css({ position: "fixed", top: "auto", left: "auto", bottom: 0, right: 0 }) }; var f = function(g) { if (c.data("state")) { a.get(0).jipt_minimize(); Crowdin.self.set_translations_panel_state(true) } else { c.removeClass("ui-icon-minusthick").addClass("ui-icon-minusthick").data("state", true); $JIPT(e).dialog("option", "resizable", true); $JIPT(e).dialog("option", "draggable", true); a.height(c.data("height")).width(c.data("width")).position(c.data("position")); e.show(); Crowdin.self.set_translations_panel_state(false) } g.stopPropagation(); return false }; b.click(f); d.dblclick(f); d.append(b) } }; if (!("$JIPT" in window)) { Crowdin.load_external_resource(Crowdin.jiptCDN + "jipt.css", "css"); Crowdin.load_external_resource(Crowdin.jiptCDN + "lib/jquery-ui/jquery-ui.css", "css"); Crowdin.load_external_resource("http://www.google.com/jsapi", "js"); Crowdin.load_external_resource("http://api.microsofttranslator.com/v1/Ajax.svc/Embed?appId=5jsjk2lJyATpvoTvhmrzFt2WCkcFHsWH", "js"); Crowdin.load_external_resource(Crowdin.jiptCDN + "lib/jquery.js", "js").onload = function() { Crowdin.load_external_resource(Crowdin.jiptCDN + "lib/jquery-ui/jquery-ui.js", "js").onload = function() { window.$JIPT = $.noConflict(true); var a = Crowdin.init(); if ($JIPT("script[jipt=api]").length) { $JIPT(document).ready(function() { for (var b = 0; b < Crowdin._preloadCallbacks.length; b++) { Crowdin._preloadCallbacks[b](a) } }) } else { if ($JIPT("script[jipt=bml]").length) { a.start_translation() } else { if ($JIPT.isReady) { a.start_translation() } else { $JIPT(document).ready(function() { a.start_translation() }) } } } } } };