Translated using Weblate (Bulgarian)
[phpmyadmin.git] / js / page_settings.js
blob49b0aee481a65b2bf5b6905756aeb4d43c402ba7
1 /* vim: set expandtab sw=4 ts=4 sts=4: */
2 /**
3  * @fileoverview    function used for page-related settings
4  * @name            Page-related settings
5  *
6  * @requires    jQuery
7  * @requires    jQueryUI
8  * @required    js/functions.js
9  */
11 function showSettings (selector) {
12     var buttons = {};
13     buttons[Messages.strApply] = function () {
14         $('.config-form').trigger('submit');
15     };
17     buttons[Messages.strCancel] = function () {
18         $(this).dialog('close');
19     };
21     // Keeping a clone to restore in case the user cancels the operation
22     var $clone = $(selector + ' .page_settings').clone(true);
23     $(selector)
24         .dialog({
25             title: Messages.strPageSettings,
26             width: 700,
27             minHeight: 250,
28             modal: true,
29             open: function () {
30                 $(this).dialog('option', 'maxHeight', $(window).height() - $(this).offset().top);
31             },
32             close: function () {
33                 $(selector + ' .page_settings').replaceWith($clone);
34             },
35             buttons: buttons
36         });
39 function showPageSettings () {
40     showSettings('#page_settings_modal');
43 function showNaviSettings () {
44     showSettings('#pma_navigation_settings');
47 AJAX.registerTeardown('page_settings.js', function () {
48     $('#page_settings_icon').css('display', 'none');
49     $('#page_settings_icon').off('click');
50     $('#pma_navigation_settings_icon').off('click');
51 });
53 AJAX.registerOnload('page_settings.js', function () {
54     if ($('#page_settings_modal').length) {
55         $('#page_settings_icon').css('display', 'inline');
56         $('#page_settings_icon').on('click', showPageSettings);
57     }
58     $('#pma_navigation_settings_icon').on('click', showNaviSettings);
59 });