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