').append(b('
').append(this.UI.$showTranslated=b('
').text(l.Show_translated)).append(this.UI.$showUntranslated=b('
').text(l.Show_untranslated))).append(this.UI.$searchText=b('
').attr("placeholder",l.Search_for_)).append(b('
').append(this.UI.$searchButton=b('
')).append(b('
').append(b('
'))).append(b('').append(b("
").append(this.UI.$searchInOriginals=b('
').text(" "+l.Search_in_originals).prepend(b('
')))).append(b("
").append(this.UI.$searchInTranslations=b('
').text(" "+l.Search_in_translations).prepend(b('
')))).append(b("
").append(this.UI.$searchInContexts=b('
').text(" "+l.Search_in_contexts).prepend(b('
')))).append('
').append(b("
").append(this.UI.$showUnapproved=b('
').text(" "+l.Show_unapproved).prepend(b('
')))).append(b("
").append(this.UI.$showApproved=b('
').text(" "+l.Show_approved).prepend(b('
'))))))))))).append(b('
').append(b('
').append(b('
').append(b('
').append(b("
").text(l.Original_String)).append(b("
").text(l.Translation))).append(this.UI.$list=b('
').css("height",c+"px")))).append(b('
').append(b('
').append(b('
').text(l.Translate)).append(this.UI.$translation=b('
')).append(b('').append(b('
').attr("title",l.Keystroke_ctrl_return).data("text",l.Save_and_Continue).text(l.Save_and_Continue).on("click",function(){a.saveAndContinue()})).append(b('
').attr("title",l.Keystroke_ctrl_shift_return).data("text",l.Approve_and_Continue).text(l.Approve_and_Continue).on("click",function(){a.saveAndContinue(null,!0)})))))),this.UI.$container.find('[data-toggle="tooltip"]').tooltip(),this.on.uiLaunched&&this.on.uiLaunched(this);var d=this.translations.length;if(d
0){var h=0;this.getInitialTranslationIndex&&(h=this.getInitialTranslationIndex()||0),this.setCurrentTranslation(this.translations[h])}this.UI.$container.on("keydown",function(b){switch(b.keyCode||b.which){case k:b.ctrlKey&&(b.preventDefault(),setTimeout(function(){a.saveAndContinue(!1,b.shiftKey)},0))}})},viewAppliedFilter:function(){var a=this.appliedFilter;this.UI.$searchText.text()!==a.text&&this.UI.$searchText.text(a.text),this.UI.$searchInOriginals.find("i").removeClass("fa-check-square-o fa-square-o").addClass(a.searchInOriginals?"fa-check-square-o":"fa-square-o"),this.UI.$searchInTranslations.find("i").removeClass("fa-check-square-o fa-square-o").addClass(a.searchInTranslations?"fa-check-square-o":"fa-square-o"),this.UI.$searchInContexts.find("i").removeClass("fa-check-square-o fa-square-o").addClass(a.searchInContexts?"fa-check-square-o":"fa-square-o"),this.approvalSupport&&(this.UI.$showUnapproved.find("i").removeClass("fa-check-square-o fa-square-o").addClass(a.showUnapproved?"fa-check-square-o":"fa-square-o"),this.UI.$showApproved.find("i").removeClass("fa-check-square-o fa-square-o").addClass(a.showApproved?"fa-check-square-o":"fa-square-o")),this.UI.$showTranslated.removeClass("btn-default btn-primary").addClass(a.showTranslated?"btn-primary":"btn-default"),this.UI.$showUntranslated.removeClass("btn-default btn-primary").addClass(a.showUntranslated?"btn-primary":"btn-default")},filter:function(a){var c=this,d=b.extend(!0,{},this.appliedFilter,a,{text:this.UI.$searchText.val()}),e=!1;if(b.each(d,function(a,b){if(b!==c.appliedFilter[a]){switch(a){case"searchInOriginals":case"searchInTranslations":case"searchInContexts":if(""===c.appliedFilter.text)return}return e=!0,!1}}),this.appliedFilter=d,this.viewAppliedFilter(),e){this.appliedFilter.lowerCaseText=this.appliedFilter.text.toLowerCase();for(var f=this.translations.length,g=0;g'):a.css("width","auto").text(a.data("text"))})},saveAndContinue:function(a,c){var d=this;if(!this.busy){if(d.approvalSupport&&c&&d.currentTranslationView.UI.$approved.prop("checked",!0).trigger("change"),this.currentTranslationView.isDirty()===!1)return void this.gotoNextTranslation(a);var e=this.currentTranslationView.getTranslatedState(!0);if(e!==!1){var f=this.currentTranslationView.translation,g={};g.id=f.id,null===e?g.clear=1:(g.translated=e.strings,"approved"in e&&(g.approved=e.approved?1:0)),this.setBusy(!0),b.isFunction(this.saveAction)?this.saveAction(f,g,function(b){d.setBusy(!1),b?window.alert(b):d.gotoNextTranslation(a)}):b.ajax({type:"POST",url:this.saveAction,data:g,dataType:"json"}).always(function(){d.setBusy(!1)}).fail(function(a){a.responseJSON&&a.responseJSON.errors?window.alert(a.responseJSON.errors.join("\n")):window.alert(a.responseText)}).done(function(b){return b&&b.error?void window.alert(b.errors.join("\n")):(f.translatedSaved(e.strings,e.approved),void d.gotoNextTranslation(a))})}}},gotoNextTranslation:function(a){var c=this.UI.$list.children(":visible");if(0===c.length)return void this.setCurrentTranslation(null);var d=0;if(this.currentTranslationView){var e=b.inArray(this.currentTranslationView.translation.li,c);a?e>=0&&(d=e-1,d<0&&(d=c.length-1)):e>=0&&e0;)c.splice(0,1)[0].launch()}var b=!1,c=[];return{setDomReady:function(){b=!0,c.length&&a()},setTranslatorReady:function(d){c.push(d),b&&a()}}}();a.ccmTranslator={setI18NDictionart:function(a){b.extend(!0,l,a)},configureFrontend:function(a){b.isPlainObject(a)&&b.extend(m,a)},initialize:function(a){var b=new h(a);return o.setTranslatorReady(b),b},views:n},b(document).ready(function(){o.setDomReady()})}}(this,jQuery);