PeeringDB = { is_mobile : /Android|WebOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), js_enabled : function() { return this.is_mobile ? false : true; }, advanced_search_result : { net : {}, fac : {}, ix : {} }, init : function() { this.InlineSearch.init_search(); twentyc.listutil.filter_input.init(); twentyc.listutil.sortable.init(); this.csrf = Cookies.get("csrftoken") $.ajaxSetup({ beforeSend : function(xhr, settings) { if(!/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type) && !this.crossDomain) { xhr.setRequestHeader("X-CSRFToken", PeeringDB.csrf); } } }); $('#form-create-account').on('export', function(e, data) { data.recaptcha = grecaptcha.getResponse(); }); this.fix_list_offsets(); $('.sponsor-badge').after().click(function(e) { // only redirect while not in edit mode if($(this).parents('.mode-edit').length == 0) window.location.href = "/sponsors"; }); $('.translate-btn').click(function(e){ $(this).closest('.fmt_text').find('.popin').remove(); var note_o = $(this).closest('.fmt_text').find('p'); var ps = []; note_o.each(function(i,o){ ps.push($(o).text()); }); var note = ps.join(' xx22xx '); var source = ''; //$('select[name="language-to"]').val(); var tgt = ''; //$('select[name="language-to"]').val(); $.post('translate', 'note=' + note + '&target=' + tgt + '&source=' + source) .done(function(reply){ if('undefined' != typeof(reply.error)){ var message = ('undefined' != typeof(reply.error.error))? reply.error.error.message : JSON.stringify(reply.error); note_o.parent().append( '
'); note_o.parent().append( '
' + translation + '