xref: /plugin/autotranslation/script.js (revision 9c7d2c3210987abefa0930141b987fc8bb5f0555)
1/**
2 * Remove go button from translation dropdown
3 */
4jQuery(function(){
5    var $frm = jQuery('#translation__dropdown');
6    if(!$frm.length) return;
7    $frm.find('input[name=go]').hide();
8    $frm.find('select[name=id]').change(function(){
9        var id = jQuery(this).val();
10        // this should hopefully detect rewriting good enough:
11        var action = $frm.attr('action');
12        if(action.substr(action.length-1) == '/'){
13            var link = action + id;
14        }else{
15            var link = action + '?id=' + id;
16        }
17
18        window.location.href= link;
19    });
20});
21