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("
" + 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("