1/** 2 * Created by Tomas Hujer on 20.7.16. 3 */ 4 5$(function() { 6 7 console.log('Lang switch'); 8 9 $('*[data-action="lang-switch"]').each(function (e) { 10 11 var $e_item = $(this); 12 var $e_parent = $e_item.closest($('*[data-parent="lang-switch"]')); 13 var s_lang = $e_item.attr('data-lang-id'); 14 //var s_controller = '<?=$this->s_controller;?>'; 15 //var s_action = '<?=$this->s_action;?>'; 16 17 var s_controller = $e_parent.attr('data-s_controller'); 18 var s_action = $e_parent.attr('data-s_action'); 19 20 //console.log(s_controller, s_action); 21 22 s_action = (s_action == 'index') ? '' : s_action; 23 s_controller = (s_controller == 'index') ? '' : s_controller; 24 s_lang = (s_lang == 'cz') ? '' : s_lang; 25 26 var s_url_old = window.location.href; 27 //console.log('s_url_old', s_url_old); 28 29 if(s_controller) { 30 var s_regexp = s_controller + (s_action ? ('/' + s_action) : '') + '(.*)'; 31 //console.log('s_regexp', s_regexp); 32 33 var a_param = s_url_old.match(s_regexp); 34 35 if(a_param) { 36 //console.log('a_param', a_param); 37 var s_param = (a_param.length > 1) ? a_param[1] : ''; 38 } else { 39 var s_param = ''; 40 } 41 42 if (s_param.indexOf('/') == 0) { 43 s_param = s_param.substring(1); 44 } 45 } else { 46 var s_param = ''; 47 } 48 49 if (s_action) { 50 s_action += '/'; 51 } 52 53 if (s_controller) { 54 s_controller += '/'; 55 } 56 57 if (s_lang) { 58 s_lang += '/' 59 } 60 61 //console.log(s_param); 62 63 var s_url_new = window.location.origin + '/' + s_lang + s_controller + s_action + s_param; 64 65 //console.log(s_url_new) 66 67 $e_item.attr('href', s_url_new); 68 69 }) 70 71}) 72
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.