mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-07 01:06:48 +02:00
[ticket/15664] Ajaxify ext actions in ACP
PHPBB3-15664
This commit is contained in:
@@ -228,6 +228,64 @@ function parse_document(container)
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension actions helper functions
|
||||
*/
|
||||
function move_to_enabled(element)
|
||||
{
|
||||
var disabled_header = document.querySelector('#ext_disabled_header');
|
||||
disabled_header.parentNode.insertBefore(element, disabled_header);
|
||||
element.classList.remove('ext_disabled');
|
||||
element.classList.add('ext_enabled');
|
||||
}
|
||||
function move_to_disabled(element)
|
||||
{
|
||||
var table_body = document.querySelector('#ext_disabled_header').parentNode;
|
||||
table_body.appendChild(element);
|
||||
element.classList.remove('ext_enabled');
|
||||
element.classList.add('ext_disabled');
|
||||
}
|
||||
function set_actions(container, actions) {
|
||||
container.innerHTML = '';
|
||||
for (var i = 0; i < actions.length; i++) {
|
||||
var a = document.createElement('a');
|
||||
a.href = actions[i].U_ACTION.split('&').join('&'); // replace all occurances
|
||||
a.title = actions[i].L_ACTION_EXPLAIN;
|
||||
if (actions[i].COLOR) {
|
||||
a.style = actions[i].COLOR;
|
||||
}
|
||||
a.innerHTML = actions[i].L_ACTION;
|
||||
// ajaxify this action as well
|
||||
phpbb.ajaxify({
|
||||
selector: a,
|
||||
refresh: false,
|
||||
callback: actions[i].ACTION_AJAX
|
||||
});
|
||||
|
||||
container.appendChild(a);
|
||||
|
||||
if (i < actions.length - 1) {
|
||||
container.innerHTML += ' | ';
|
||||
}
|
||||
}
|
||||
}
|
||||
function show_enabled_header() {
|
||||
document.querySelector('#ext_enabled_header').classList.remove('hidden');
|
||||
}
|
||||
function show_disabled_header() {
|
||||
document.querySelector('#ext_disabled_header').classList.remove('hidden');
|
||||
}
|
||||
function hide_disabled_header_if_empty() {
|
||||
if (!document.querySelector('.ext_disabled')) {
|
||||
document.querySelector('#ext_disabled_header').classList.add('hidden');
|
||||
}
|
||||
}
|
||||
function hide_enabled_header_if_empty() {
|
||||
if (!document.querySelector('.ext_enabled')) {
|
||||
document.querySelector('#ext_enabled_header').classList.add('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run onload functions
|
||||
*/
|
||||
|
Reference in New Issue
Block a user