var JVTranslate = function (element, options) { return this.init(element, options); }; (function ($) { JVTranslate.prototype = { options: { mode: 'flag', lang: '', api: '', flagsize: null, url: null, languages: '' }, init: function (element, options) { this.element = element; for (var key in options) { this.options[key] = options[key]; } if (this.options.api) { $.translate.load(this.options.api); if (this.options.mode == 'flag') { this.createFlags(); if (this.getCurrentLang()) { this.translate(this.getCurrentLang()); } } else { this.createTranslationBox(); } } }, getThis: function(){ return this; }, createTranslationBox: function () { var that = this; this.to = this.options.lang ? this.options.lang : 'vi'; if (this.options.languages != '') { languages = this.options.languages; } else { languages = $.translate.getLanguages(true); } this.result = $('
', { id: 'translate_result' }); this.input = $('