{"version":3,"sources":["transposh.js"],"sourcesContent":["/*  Copyright © 2009-2018 Transposh Team (website : http://transposh.org)\n *\n *\tThis program is free software; you can redistribute it and/or modify\n *\tit under the terms of the GNU General Public License as published by\n *\tthe Free Software Foundation; either version 2 of the License, or\n *\t(at your option) any later version.\n *\n *\tThis program is distributed in the hope that it will be useful,\n *\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n *\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *\tGNU General Public License for more details.\n *\n *\tYou should have received a copy of the GNU General Public License\n *\talong with this program; if not, write to the Free Software\n *\tFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA\n */\n\n// List of exposed functions:\n//    t_jp.dgpt = do_mass_google_translate;\n//    t_jp.dbt = do_mass_bing_translate;\n//    t_jp.dyt = do_mass_yandex_translate;\n//    t_jp.dat = do_mass_apertium_translate;\n//    t_jp.tfl = test_for_lazyrun;\n//    t_jp.tfju = test_for_jqueryui;\n//    t_jp.at = do_auto_translate;\n\n/*global Date, Math, alert, escape, clearTimeout, document, jQuery, setTimeout, t_jp, window, _mstConfig */\n(function ($) { // closure\n    var\n            // this is the size of strings to queue, we don't want too much there\n            BATCH_SIZE = 1024,\n            // number of phrases that might be translated\n            possibly_translateable,\n            // ids of progress bars\n            t_jp_prefix = t_jp.prefix,\n            // source - 0 is human, 1 google , 2 bing, 3 apertium, 4 yandex, 5 baidu - higher reserved for future engines\n            source = 1,\n            //Ajax translation\n            done_posted = 0, /*Timer for translation aggregation*/ timer, tokens = [], translations = [],\n            loadingmsn = 0\n            ;\n\n    // This function fixes the page, it gets a token and translation and fixes this,\n    // since here we only get the automated source, we use this to reduce the code size\n    function fix_page(token, translation) {\n        // Todo - Probably not needed, but in case we get bad stuff\n        if ($.trim(translation).length === 0) {\n            return;\n        }\n        // this is an inner function used to fix the images in the case of being inside the edit mode.\n        // if we are not editing, no images will be found and nothing will happen.\n        // even if this happens before the edit scripts adds the images, it won't matter as source is changed too and the\n        // edit script will fix this\n        var fix_image = function () { // handle the image changes\n            var img_segment_id = $(this).attr('id').substr($(this).attr('id').lastIndexOf('_') + 1),\n                    img = $(\"#\" + t_jp_prefix + \"img_\" + img_segment_id);\n            $(\"#\" + t_jp_prefix + img_segment_id).attr('data-source', 1); // source is 1\n            img.removeClass('tr-icon-yellow').removeClass('tr-icon-green').addClass('tr-icon-yellow');\n        };\n\n        // might need to escape the token selectors\n        token = token.replace(/([;&,\\.\\+\\*\\~':\"\\!\\^#$%@\\[\\]\\(\\)=>\\|])/g, '\\\\$1');\n        //window.console && console.log(token);\n        // rewrite text for all matching items at once\n        $(\"*[data-orig='\" + token + \"'][data-hidden!='y']\")\n                .html(translation)\n                .each(fix_image);\n\n        // TODO - FIX hidden elements too (need to update father's title)\n        $(\"*[data-orig='\" + token + \"'][data-hidden='y']\")\n                .attr('data-trans', translation)\n                .each(fix_image);\n    }\n\n    // we have four params, here two are implicit (source =1 auto translate, lang = target language)\n    function ajax_translate(token, translation) {\n        // we aggregate translations together, 200ms from the last translation we will send the timer\n        // so here we remove it so nothing unexpected happens\n        clearTimeout(timer);\n        // push translations\n        tokens.push(token);\n        translations.push(translation);\n        // This is a change - as we fix the pages before we got actual confirmation (worked well for auto-translation)\n        fix_page(token, translation);\n        timer = setTimeout(function () {\n            var data = {\n                ln0: t_jp.lang, // implicit\n                sr0: source, // implicit auto translate... 1 if google, 2 if msn\n                action: 'tp_translation',\n                items: tokens.length // we can do this here because all tokens will be different\n            }, i;\n            for (i = 0; i < tokens.length; i += 1) {\n                data[\"tk\" + i] = tokens[i];\n                data[\"tr\" + i] = translations[i];\n                // We are pre-accounting the progress bar here - which is not very nice\n                //if (source > 0) {\n                done_posted += $(\"*[data-orig='\" + tokens[i].replace(/([;&,\\.\\+\\*\\~':\"\\!\\^#$%@\\[\\]\\(\\)=>\\|])/g, '\\\\$1') + \"']\").length;\n                //}\n            }\n            $.ajax({\n                type: \"POST\",\n                url: t_jp.ajaxurl,\n                data: data,\n                success: function () {\n                    // Success now only updates the save progress bar (green)\n                    console.window && console.log(done_posted + \"/\" + possibly_translateable + \" translations posted\");\n                }\n                // we removed the error function, as there is no alert for automated thing, this will silently fail\n                // which although bad, is what we can do for now\n            });\n            translations = [];\n            tokens = [];\n        }, 200); // wait 200 ms... -- TODO, maybe do - items*3\n    }\n\n    // happens on traslate success\n    function auto_translate_success(token, translation) {\n        ajax_translate(token, $(\"<div>\" + $.trim(translation) + \"</div>\").text());\n        window.console && console.log(possibly_translateable - $(\".\" + t_jp_prefix + '[data-source=\"\"]').length + \"/\" + possibly_translateable + \" auto translated\");\n    }\n\n    // mass google translation - using proxy\n    function do_mass_google_translate(batchtrans, callback, lang) {\n        /*var sl = '';\n         if (usedefault) {\n         sl = t_jp.olang;\n         }*/\n        $.ajax({\n            url: t_jp.ajaxurl,\n            dataType: \"json\",\n            type: \"GET\",\n            // check each\n            data: {\n                action: 'tp_tp',\n                e: 'g',\n                tl: lang,\n                // sl: sl,\n                q: batchtrans\n            },\n            success: callback\n        });\n    }\n    function do_mass_google_invoker(tokens, trans) {\n        do_mass_google_translate(trans, function (result) {\n            $(result.results).each(function (i) {\n                auto_translate_success(tokens[i], this);\n            });\n        }, t_jp.lang);\n    }\n\n    /*  // mass google translation using an api key\n     function do_mass_google_api_translate(batchtrans, callback, lang) {\n     $.ajax({\n     url: 'https://www.googleapis.com/language/translate/v2',\n     dataType: \"jsonp\",\n     data: {\n     key: t_jp.google_key,\n     q: batchtrans,\n     target: lang,\n     source: t_jp.olang\n     },\n     traditional: true,\n     success: callback\n     });\n     }\n     function do_mass_google_api_invoker(tokens, trans) {\n     do_mass_google_api_translate(trans, function (result) {\n     // if there was an error we will try the other invoker\n     if (typeof result.error !== 'undefined') {\n     do_mass_google_invoker(tokens, trans);\n     } else {\n     $(result.data.translations).each(function (i) {\n     auto_translate_success(tokens[i], this.translatedText);\n     });\n     }\n     }, t_jp.lang);\n     }*/\n\n    // mass bing translation\n    function do_mass_bing_translate(batchtrans, callback, lang) {\n        if (t_jp.msn_key) {\n            var q = \"[\";\n            $(batchtrans).each(function (i) {\n                q += '\"' + encodeURIComponent(batchtrans[i].replace(/[\\\\\"]/g, '\\\\$&').replace(/(\\r\\n|\\n|\\r)/gm, \" \")) + '\",';\n            });\n            q = q.slice(0, -1) + ']';\n            $.ajax({\n                url: '//api.microsofttranslator.com/V2/Ajax.svc/TranslateArray?appId=' + t_jp.msn_key + '&to=' + lang + '&texts=' + q,\n                dataType: \"jsonp\",\n                jsonp: \"oncomplete\",\n                success: callback\n            });\n        } else {\n            if (loadingmsn === 1) {\n                setTimeout(function () {\n                    do_mass_bing_translate(batchtrans, callback, lang);\n                }, 500);\n            } else {\n                loadingmsn = 1;\n                $.getScript('//www.microsofttranslator.com/ajax/v2/toolkit.ashx?loc=en&toolbar=none', function () {\n                    t_jp.msn_key = _mstConfig.appId;\n                    do_mass_bing_translate(batchtrans, callback, lang);\n                });\n            }\n        }\n    }\n\n    function do_mass_bing_invoker(tokens, trans) {\n        source = 2;\n        do_mass_bing_translate(trans, function (result) {\n            $(result).each(function (i) {\n                auto_translate_success(tokens[i], this.TranslatedText);\n            });\n        }, t_jp.blang);\n    }\n\n    // mass yandex translation - using proxy\n    function do_mass_yandex_translate(batchtrans, callback, lang) {\n        /*var sl = '';\n         if (usedefault) {\n         sl = t_jp.olang;\n         }*/\n        $.ajax({\n            url: t_jp.ajaxurl,\n            dataType: \"json\",\n            type: \"GET\",\n            // check each\n            data: {\n                action: 'tp_tp',\n                e: 'y',\n                tl: lang,\n                // sl: sl,\n                q: batchtrans\n            },\n            success: callback\n        });\n    }\n    function do_mass_yandex_invoker(tokens, trans) {\n        source = 4;\n        do_mass_yandex_translate(trans, function (result) {\n            $(result.results).each(function (i) {\n                auto_translate_success(tokens[i], this);\n            });\n        }, t_jp.lang);\n    }\n\n    // mass baidu translation - using proxy\n    function do_mass_baidu_translate(batchtrans, callback, lang) {\n        /*var sl = '';\n         if (usedefault) {\n         sl = t_jp.olang;\n         }*/\n        $.ajax({\n            url: t_jp.ajaxurl,\n            dataType: \"json\",\n            type: \"GET\",\n            // check each\n            data: {\n                action: 'tp_tp',\n                e: 'u',\n                tl: lang,\n                // sl: sl,\n                q: batchtrans\n            },\n            success: callback\n        });\n    }\n    function do_mass_baidu_invoker(tokens, trans) {\n        source = 5;\n        do_mass_baidu_translate(trans, function (result) {\n            $(result.results).each(function (i) {\n                auto_translate_success(tokens[i], this);\n            });\n        }, t_jp.lang);\n    }\n\n    // mass apertium translation\n    function do_mass_apertium_translate(batchtrans, callback, lang) {\n        $.ajax({\n            url: 'http://api.apertium.org/json/translate',\n            data: {\n                q: batchtrans,\n                langpair: t_jp.olang + '|' + lang,\n                markUnknown: 'no'\n            },\n            dataType: \"jsonp\",\n            traditional: true,\n            success: callback\n        });\n    }\n\n    function do_mass_apertium_invoker(tokens, trans) {\n        source = 3;\n        do_mass_apertium_translate(trans, function (result) {\n            // we assume that 2xx answer should be good, 200 is good, 206 is partially good (some errors)\n            if (result.responseStatus >= 200 && result.responseStatus < 300) {\n                // single items get handled differently\n                if (result.responseData.translatedText !== undefined) {\n                    auto_translate_success(tokens[0], result.responseData.translatedText);\n                } else {\n                    $(result.responseData).each(function (i) {\n                        if (this.responseStatus === 200) {\n                            auto_translate_success(tokens[i], this.responseData.translatedText);\n                        }\n                    });\n                }\n            }\n        }, t_jp.lang);\n    }\n\n    // invokes the correct mass translator based on the preferred one...\n    function do_mass_invoke(batchtokens, batchtrans) {\n        t_jp.preferred.some(function (engine) {\n            //console.log(engine);\n            if (t_jp.engines[engine]) {\n                if (engine === 'a') {\n                    do_mass_apertium_invoker(batchtokens, batchtrans);\n                }\n                if (engine === 'b') {\n                    do_mass_bing_invoker(batchtokens, batchtrans);\n                }\n                if (engine === 'g') {\n                    do_mass_google_invoker(batchtokens, batchtrans);\n                }\n                if (engine === 'y') {\n                    do_mass_yandex_invoker(batchtokens, batchtrans);\n                }\n                if (engine === 'u') {\n                    do_mass_baidu_invoker(batchtokens, batchtrans);\n                }\n                return true;\n            }\n        });\n    }\n\n    //function for auto translation\n    function do_auto_translate() {\n        // auto_translated_previously...\n        var auto_translated_phrases = [], batchlength = 0, batchtrans = [], batchtokens = [];\n\n        $(\".\" + t_jp_prefix + '[data-source=\"\"]').each(function () {\n            var token = $(this).attr('data-orig'),\n                    // we only have orig if we have some translation? so it should probably not be here... ? (or maybe for future invalidations of cached auto translations)\n                    to_trans = $(this).attr('data-orig');\n            if (to_trans === undefined) {\n                to_trans = $(this).html();\n            }\n            if (auto_translated_phrases[to_trans] !== 1) {\n                auto_translated_phrases[to_trans] = 1;\n                if (batchlength + encodeURIComponent(to_trans).length > BATCH_SIZE) {\n                    do_mass_invoke(batchtokens, batchtrans);\n                    batchlength = 0;\n                    batchtrans = [];\n                    batchtokens = [];\n                }\n                batchlength += encodeURIComponent(to_trans).length;\n                batchtokens.push(token);\n                batchtrans.push(to_trans);\n            }\n        });\n        // this invokation is for the remaining items\n        do_mass_invoke(batchtokens, batchtrans);\n    }\n\n    // helper function for lazy running\n    function test_for_lazyrun(callback) {\n        if (typeof $.xLazyLoader === 'function') {\n            callback();\n        } else {\n            t_jp.$ = $; // We wanted the same jQuery... hmmm\n            $.getScript(t_jp.plugin_url + '/js/lazy.js', callback).done(callback);\n        }\n    }\n\n    function test_for_jqueryui(callback) {\n        if (test_for_jqueryui.hit /* might be needed? - && typeof $.fn.dialog !== 'function' */) {\n            callback();\n        } else {\n            test_for_jqueryui.hit = true;\n            test_for_lazyrun(function () {\n                // This is needed when old jQueryUI is being loaded (default for wp3.2)\n                $.fn.propAttr = $.fn.prop || $.fn.attr;\n                $.xLazyLoader({\n                    js: t_jp.jQueryUI + 'jquery-ui.min.js',\n                    css: t_jp.jQueryUI + 'themes/' + t_jp.theme + '/jquery-ui.css',\n                    success: callback\n                });\n            });\n        }\n    }\n\n    // expose some functions\n    t_jp.dgpt = do_mass_google_translate;\n    //t_jp.dgt = do_mass_google_api_translate;\n    t_jp.dbt = do_mass_bing_translate;\n    t_jp.dyt = do_mass_yandex_translate;\n    t_jp.dut = do_mass_baidu_translate;\n    t_jp.dat = do_mass_apertium_translate;\n    t_jp.at = do_auto_translate;\n    t_jp.tfl = test_for_lazyrun;\n    t_jp.tfju = test_for_jqueryui;\n\n    $(function () {\n        // set a global binglang (if needed)\n        if (typeof t_jp.blang === 'undefined')\n            t_jp.blang = t_jp.lang;\n\n        // this is the set_default_language function\n        // attach a function to the set_default_language link if its there\n        $('.' + t_jp_prefix + 'setdeflang').on(\"click\", function () {\n            $.ajax({\n                url: t_jp.ajaxurl,\n                data: {\n                    action: 'tp_cookie'\n                },\n                cache: false\n            });\n            $('.' + t_jp_prefix + 'setdeflang').hide(\"slow\");\n            return false;\n        });\n\n        // how many phrases are yet untranslated\n        possibly_translateable = $(\".\" + t_jp_prefix + '[data-source=\"\"]').length;\n\n        //now = new Date();\n        // we make sure script sub loaded are cached\n        $.ajaxSetup({\n            cache: true\n        });\n        // was: we'll only auto-translate and load the stuff if we either have more than 5 candidate translations, or more than one at 4am, and this language is supported...\n        // we'll translate if there's any candidate...?\n        if (possibly_translateable && !t_jp.noauto && !$.isEmptyObject(t_jp.engines)) {\n            do_auto_translate();\n        }\n\n        // this is the part when we have editor support\n        if (t_jp.edit) {\n            $.getScript(t_jp.plugin_url + '/js/transposhedit.js');\n        }\n    });\n}(jQuery)); // end of closure"],"names":["$","possibly_translateable","timer","t_jp_prefix","t_jp","prefix","source","done_posted","tokens","translations","loadingmsn","ajax_translate","token","translation","fix_image","clearTimeout","push","trim","length","img_segment_id","this","attr","substr","lastIndexOf","img","removeClass","addClass","replace","html","each","setTimeout","data","ln0","lang","sr0","action","items","i","ajax","type","url","ajaxurl","success","console","window","log","auto_translate_success","text","do_mass_google_translate","batchtrans","callback","dataType","e","tl","q","do_mass_bing_translate","msn_key","encodeURIComponent","slice","jsonp","getScript","_mstConfig","appId","do_mass_yandex_translate","do_mass_baidu_translate","do_mass_apertium_translate","langpair","olang","markUnknown","traditional","do_mass_invoke","batchtokens","preferred","some","engine","engines","result","responseStatus","undefined","responseData","translatedText","TranslatedText","blang","results","do_auto_translate","auto_translated_phrases","batchlength","to_trans","test_for_lazyrun","xLazyLoader","plugin_url","done","test_for_jqueryui","hit","fn","propAttr","prop","js","jQueryUI","css","theme","dgpt","dbt","dyt","dut","dat","at","tfl","tfju","on","cache","hide","ajaxSetup","noauto","isEmptyObject","edit","jQuery"],"mappings":"CA2BWA,IACP,IAIQC,EAMuDC,EAJvDC,EAAcC,KAAKC,OAEnBC,EAAS,EAETC,EAAc,EAAgDC,EAAS,GAAIC,EAAe,GAC1FC,EAAa,EAoCrB,SAASC,EAAeC,EAAOC,GA/B/B,IASQC,EAyBJC,aAAab,CAAK,EAElBM,EAAOQ,KAAKJ,CAAK,EACjBH,EAAaO,KAAKH,CAAW,EArCfD,EAuCLA,EAvCYC,EAuCLA,EArCmB,IAA/Bb,EAAEiB,KAAKJ,CAAW,EAAEK,SAOpBJ,EAAY,WACZ,IAAIK,EAAiBnB,EAAEoB,IAAI,EAAEC,KAAK,IAAI,EAAEC,OAAOtB,EAAEoB,IAAI,EAAEC,KAAK,IAAI,EAAEE,YAAY,GAAG,EAAI,CAAC,EAC9EC,EAAMxB,EAAE,IAAMG,EAAc,OAASgB,CAAc,EAC3DnB,EAAE,IAAMG,EAAcgB,CAAc,EAAEE,KAAK,cAAe,CAAC,EAC3DG,EAAIC,YAAY,gBAAgB,EAAEA,YAAY,eAAe,EAAEC,SAAS,gBAAgB,CAC5F,EAGAd,EAAQA,EAAMe,QAAQ,0CAA2C,MAAM,EAGvE3B,EAAE,gBAAkBY,EAAQ,sBAAsB,EACzCgB,KAAKf,CAAW,EAChBgB,KAAKf,CAAS,EAGvBd,EAAE,gBAAkBY,EAAQ,qBAAqB,EACxCS,KAAK,aAAcR,CAAW,EAC9BgB,KAAKf,CAAS,GAavBZ,EAAQ4B,WAAW,WAOf,IANA,IAAIC,EAAO,CACPC,IAAK5B,KAAK6B,KACVC,IAAK5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