Dialog box

All methods for working with dialog boxes are in the object

$.ics.dialog

confirm

Dialog box to confirm user action:

$.ics.dialog.confirm(options);

To support all functional classes with Helicobacter pylori opportunities should be connected to the file jquery.alerts.js. If the plugin is not connected it will be used by the built-in browser capabilities with the reduced functionality.

Options:

Name Description default
message the query Text. The empty string
title Header of the message pane. The empty string
callback Function to handle the result of the user’s choice. The first argument of the function is the result of the user’s choice: true button OK and false button Cancel. undefined
okButtonText text for the button OK. $.ics.configuration.dialog.okButtonText
cancelButtonText text for the button Cancel. $.ics.configuration.dialog.cancelButtonText

Example usage:

$.ics.dialog.confirm({
    message: 'Удалить файл?',
    title: 'Подтверждение удаления файла',
    callback: function (res) {
        if (res) {
            // When OK is pressed. 
            deleteFile();
        } else {
            // When pressing Cancel. 
            cancelFileDeleting();
        }
    }
});

The result (with connected plugin jquery.alerts):

The result (without plugin jquery.alerts):

alert

Dialog box to display information to the user:

$.ics.dialog.alert(options);

To support all functional classes with Helicobacter pylori opportunities should be connected to the file jquery.alerts.js. If the plugin is not connected it will be used by the built-in browser capabilities with the reduced functionality.

Options: | Name | Description | default| |:————–|:—————-|:——————| | message | Text messages. | undefined (empty string)| | title | Header of the message pane. | undefined (empty string)| | callback | callback Function after the window is closed by the user. Takes no arguments. | undefined|

If instead the options will be passed to the text, they will use the default options with the specified message.

Example usage:

$.ics.dialog.alert({
    message: 'Файл успешно удалён!',
    title: 'Внимание',
    callback: function () {
        // After closing the window. 
        // ... 
    }
});

The result (with connected plugin jquery.alerts):

The result (without plugin jquery.alerts):

Dialog modal window:

$.ics.dialog.modal(options);

For the operation method be sure to use a plug-jQuery Thickbox.

Options:

Name Description default  
content Content displayed in the window. Can be HTML. undefined (empty string)  
href Link to the page you want to display. This parameter has the higher priority compared to content. undefined (empty string)  
title Title of the window. undefined (empty string)  
callback callback Function before the window is closed by the user. The transmitted argument allows to cancel closing the window. undefined  
width Width of window in pixels. $.ics.configuration.dialog.width  
height Width of window in pixels. $.ics.configuration.dialog.height -
modal Flag modal window. In the case true there is no possibility to close the window. true  

The returned object:

Name Description
close Method to close the window.
closed Flag closed window to determine if it’s open another window.
context Context for the displayed window. If data is displayed on the link, you context refers to an object window open window, otherwise the object window the current window.

Example usage:

var modal = $.ics.dialog.modal({
    width: 500,
    content: '<strong>Выполняется сохранение...</strong>',
    title: 'Ждите!',
    modal: false,
    callback: function() {
        // After closing the window. 
        // ... 
    }
});

setTimeout(function() {
    modal.close();
}, 4000);

The result:

Special functions

generateUniqueId

Generating a unique identifier for the DOM element.

$.ics.generateUniqueId(prefix);

Parameters:

Name Description default    
prefix   Prefix for the generated ID.   undefined (empty string)
}        

Example usage:

var uniqueId = $.ics.generateUniqueId('element_'); // element_032452 
Переведено сервисом «Яндекс.Переводчик» http://translate.yandex.ru