From 25497336bba4ffc8fc702bfc5126e66130bd9cbc Mon Sep 17 00:00:00 2001 From: Hilmar Runge Date: Sat, 5 Jun 2021 07:51:38 +0000 Subject: Changed behavior in the user interaction of the languages selection. Now works... --- view/js/main.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'view/js') diff --git a/view/js/main.js b/view/js/main.js index 6c418b213..11e0f812c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -78,6 +78,65 @@ $(document).ready(function() { } }); + // @hilmar |-> + if ( typeof(window.tao) == 'undefined' ) { + window.tao = {}; + } + if ( typeof(window.tao.zin) == 'undefined' ) { + tao.zin = { syslc: '', syslcs: {}, htm: '', me: '', debug: '' }; + tao.zin.axim = '
'; + $('.navbar-app[href*="/lang"]').attr({"data-toggle": "dropdown", "aria-expand": "true", "id": "zintog"}) + .removeAttr('href').addClass('zinlcx zinlcxp dropdown dropdown-toggle'); + $('.dropdown-item[href*="/lang"]').addClass('zinlcxmi zinlcx').removeAttr('href').css('cursor','pointer'); + } + $('.zinlcx').on('click', function(e) { + if (tao.zin.syslc == '') { + $('.zinlcx').append(tao.zin.axim); + $.ajax({ + type: 'POST', url: 'lang', + data: { zinlc: '??' } + }).done( function(re) { + tao.zin.re = JSON.parse(re); + tao.zin.syslc = tao.zin.re.lc; + tao.zin.syslcs = tao.zin.re.lcs; + tao.zin.htm = ''; + $('.zinpax').remove(); + $('.zinlcx').append(tao.zin.htm); + $('.zinlcxp > ul').addClass('dropdown dropdown-menu dropdown-menu-right').css('left','-16em'); + }); + return false; + } else { + if (e.target.id == '') { + // noop click on lang again + return false; + } + tao.zin.me = e.target.id.substr(5); + $('#right_aside_wrapper').append(tao.zin.axim); + $.ajax({ + type: 'POST', url: 'lang', + data: { zinlc: tao.zin.me } + }).done( function(re) { + tao.zin.re = JSON.parse(re); + location.reload(true); + }); + } + }); + $('#zintog').on('click', function() { + $('.zinlcs').toggle(); + }); + $('#dropdown-menu').on('shown.bs.dropdown', function() { + tao.zin.debug += 'e,'; + //$('.zinlcs').removeAttr('display'); + }) + .on('mouseleave', function() { + $(this).trigger('click'); + }); + // @hilmar <-| + var tf = new Function('n', 's', 'var k = s.split("/")['+aStr['plural_func']+']; return (k ? k : s);'); jQuery.timeago.settings.strings = { -- cgit v1.2.3