new H_ui()
ui.js, line 29
Members
-
translate_blockObject
-
Block for translation UI logic.
Contains methods for changing language and translating content.
Methods
-
staticH_ui.add_window(parent_node, settings){H_ui_window}
ui.js, line 533 -
Adds a new window (modal/dialog) to the UI.
Name Type Description parent_nodeHTMLElement Parent node to append to. settingsObject Window settings Name Type Description titleString | Array | HTMLElement Add a title on top classString Additional CSS classes for the modal modalBoolean Display as modal with background mask closeBoolean | String Label for the close button, or true for default on_closefunction | String Callback executed when closed hiddenBoolean Hide it on create content_resizableBoolean Make the window partialy resizable. Depends its CSS, if there is min-width or min-height set remove_on_closeBoolean Remove from DOM when closed nodragBoolean Disable drag of whole modal disable_background_clickBoolean Disable closing by clicking background and pressing ESC key disable_auto_resizeBoolean Disable auto-resize/alignment on content change specialBoolean special modal, higher z-index special_levelNumber | String Priority level for special modals, or 'err' for error modals Returns:
Type Description H_ui_window The created window instance. -
staticH_ui.auto_close_modal(dom_element){H_ui_window|boolean}
ui.js, line 578 -
Click handler for the elements having the data-auto_close_modal attribute (see Html::parse_event()).
A submit control is not closed on click : the close is handled by the form validator, which asks for it in the sent data so the server answer is the one closing the modal, once the action is really done and successful. So the modal is never closed by a form rejected by the validator, by a form waiting for a confirm popup, or by an action that failed on the server side.Name Type Description dom_elementHTMLElement The element carrying the data-auto_close_modal attribute. Returns:
Type Description H_ui_window | boolean False when the close is left to the server answer, the closed modal otherwise. -
staticH_ui.change_multi_radio(event)
ui.js, line 201 -
Updates the selected state for multi-radio blocks.
Toggles the 'selected' class on labels.Name Type Description eventEvent The change event. -
staticH_ui.clean_color_pickers()
ui.js, line 133 -
Cleans up unused color pickers.
Destroys pickers that are no longer open or present in the DOM. -
staticH_ui.clean_tox()
ui.js, line 507 -
Cleans up TinyMCE auxiliary elements. Removes all elements with class 'tox-tinymce-aux' left by tynimce.
-
staticH_ui.close_auto_modal(){H_ui_window|boolean}
ui.js, line 596 -
Closes the modal of the last element submitted with the data-auto_close_modal attribute.
Called by the answer of the server when the action was launched by such an element and didn't raise any error (see HelPHP_module::add_json_output()), so the module keeps the decision : on an error the modal stays opened with its form, as it does when a module hides its modal by itself.Returns:
Type Description H_ui_window | boolean The closed modal, false when there is nothing left to close. -
staticH_ui.close_containing_modal(dom_element){H_ui_window|boolean}
ui.js, line 562 -
Closes the modal (window) containing the given element.
Name Type Description dom_elementHTMLElement Any element inside the modal to close. Returns:
Type Description H_ui_window | boolean The closed modal, false if the element is not inside a modal. -
staticH_ui.confirm_popup(message, ok_handler, cancel_handler)
ui.js, line 667 -
Displays a confirmation popup with OK and Cancel buttons.
Name Type Description messagestring | Array Message to display. ok_handlerfunction Handler for OK button. cancel_handlerfunction Handler for Cancel button. -
staticH_ui.copy_to_clipboard(content, popup, html)
ui.js, line 990 -
Copies content to the clipboard.
Optionally shows a popup and supports HTML content.Name Type Default Description contentstring Content to copy. popupboolean | string true optional Show popup or custom message. htmlboolean false optional Copy as HTML. -
staticH_ui.detect_screen_infos()
ui.js, line 887 -
Detects screen info and sets CSS variables.
window screen logarythmique ratio calculator is used to create some CSS vars that can reduce issues with some screens.
e.g : for a 4k screen, you don't display the navigator in full screen size, in general the user reduce the window size because it's more easy.
but in this case all vars based on screen width height should be reduced by a ratio based on fullHD as base.
--fhd-hr and --fhd-vr are those horizontal and vertical ratio that can be used to multiple othe size vars in your theme to auto adapt it to huge screen.
Called from init.js to set screen and window size variables. -
staticH_ui.display_color_picker(evt, dom_id)
ui.js, line 73 -
Displays a color picker for a given input.
Initializes and manages the color picker instance.
the colorpicker source in in /js/externals/alwan
as there is already tons of colopicker, we choose this one : https://github.com/sefianecho/alwan
Name Type Description evtEvent The triggering event. dom_idstring The DOM id of the input. -
staticH_ui.get_containing_modal(dom_element){H_ui_window|boolean}
ui.js, line 550 -
Returns the modal (window) object containing the given element.
The modal is not known when the html is generated by Php, it is found here thru the dom, for any element set inside a modal, whatever it was created from Php or Js.Name Type Description dom_elementHTMLElement Any element inside a modal. Returns:
Type Description H_ui_window | boolean The containing modal, false if the element is not inside a modal. -
staticH_ui.get_token_a_r(evt, from_form)
ui.js, line 276 -
Retrieves an anti-replay token via AJAX and inserts it into the form.
The token allows exactly one submit: the server consumes it, so a replayed POST is refused. It is neither a flood protection nor the CSRF token (see Security::csrf_token()).Name Type Default Description evtEvent The triggering event. from_formboolean false optional Whether the event is from a form. -
staticH_ui.hide_popup(dom_id)
ui.js, line 391 -
Hides the popup modal of one module instance, when it is still there.
Name Type Description dom_idstring Module instance id. -
staticH_ui.init_input_order(base_name, base_id, editable, callback)
ui.js, line 356 -
Initializes input order management for a group of inputs.
Name Type Description base_namestring Base name for the group. base_idstring Base id for the input. editableboolean Whether the input is editable. callbackfunction Callback on order change. -
staticH_ui.init_range_tracks()
ui.js, line 1015 -
Initializes styled input range tracks.
Updates CSS variables for custom range inputs. -
staticH_ui.input_copy_to_clipboard(id, popup, html)
ui.js, line 950 -
Copies the value of an input to the clipboard.
Optionally shows a popup and supports HTML content.Name Type Default Description idstring Input element id. popupboolean | string true optional Show popup or custom message. htmlboolean false optional Copy as HTML. -
staticH_ui.message_popup(message, ok_handler){H_ui_prompt}
ui.js, line 614 -
Displays a message popup with an OK button.
Name Type Description messagestring | Array Message to display. ok_handlerfunction Handler for OK button. Returns:
Type Description H_ui_prompt The prompt instance. -
staticH_ui.message_popup_timed(message, ok_handler, time)
ui.js, line 641 -
Displays a timed message popup.
Name Type Default Description messagestring | Array Message to display. ok_handlerfunction Handler for OK button. timenumber 3000 optional Time in ms before auto-close. -
staticH_ui.modal_parent(evt, module_name, dom_id){HTMLElement}
ui.js, line 372 -
Resolves the node a modal opened from a module has to live in.
The module's own container is the rule; document.body is kept for the modals that must block the whole page, and for the calls that carry neither an event nor a dom_id.Name Type Description evtEvent | Object The triggering event (may be an empty object). module_namestring optional Module name. dom_idstring optional Module instance id, used when the event carries nothing usable. Returns:
Type Description HTMLElement The parent node. -
staticH_ui.new_tab(url)
ui.js, line 344 -
Opens a new browser tab.
Name Type Description urlstring URL to open. -
staticH_ui.open_popup_modal(evt, module_name, params, special, special_level, title)
ui.js, line 426 -
Opens a popup modal for a module.
The window is added to the container of the module instance that opened it (see modal_parent): it is masked and hidden with that instance, and it stays open when the admin moves to another tab. document.body stays the parent of the imperative modals (confirm, message, errors).Name Type Default Description evtEvent The triggering event. module_namestring Module name. paramsObject Parameters for the module. specialboolean | number false optional Special modal: one reused window per instance, higher z-index. special_levelnumber 1 optional Special modal level. titleboolean | string false optional Window title. -
staticH_ui.popup(lapage, titre, w, h, scroll)
ui.js, line 310 -
Opens a popup window.
Name Type Description lapagestring URL to open. titrestring Window title. wnumber Width. hnumber Height. scrollboolean | number Enable scrollbars. -
staticH_ui.realign_windows(container)
ui.js, line 405 -
Re-applies the alignment of the windows waiting inside a container that was hidden.
An inactive tab has no box, so the alignment is deferred until the container is shown again.Name Type Description containerHTMLElement The container being shown. -
staticH_ui.scroll_to(dom_id, offset)
ui.js, line 260 -
Scrolls to a DOM element with an optional offset.
Name Type Default Description dom_idstring Target element id. offsetnumber 0 optional Offset in pixels. -
staticH_ui.scroll_toggle_class(elem_id, nbr_px, class_name)
ui.js, line 239 -
Adds or removes a CSS class on scroll.
Toggles the class when scrolling past a threshold.Name Type Description elem_idstring Target element id. nbr_pxnumber Scroll threshold in pixels. class_namestring CSS class to toggle. -
staticH_ui.show_big_view(evt, new_url, module_class)
ui.js, line 221 -
Displays an image at its nominal size in a modal window, with a zoom and a move tool.
The same window is reused from one image to the next.Name Type Default Description evtEvent | boolean The click on the image; its src is used when no url is given. new_urlstring | boolean false optional Image to display instead of the clicked one. module_classstring '' optional Extra class on the content, named after the calling module. -
staticH_ui.toggle_accordion(target, css_class, custom_func, indicator)
ui.js, line 152 -
Initializes an accordion UI component.
Adds toggling and indicator logic to elements with the given class.
The target must have "data-target_id" that points to the element to toggleName Type Default Description targetstring CSS class of toggler elements. css_classstring CSS class to toggle. custom_funcfunction | boolean false optional Custom function on open. indicatorstring | boolean false optional Id of the collapse indicator -
staticH_ui.tooltip(evt, id, set_position)
ui.js, line 699 -
Displays a tooltip for a DOM element.
Positions and shows the tooltip content.Name Type Default Description evtEvent The triggering event. idstring Tooltip content element id. set_positionboolean true Set position of the tooltip ? -
staticH_ui.update_css_fhd_vr()
ui.js, line 924 -
Updates CSS variable for FHD vertical ratio.
Called on window resize.