Ajout d'une extension
This commit is contained in:
13
ext/phpbbstudio/aps/adm/style/js/aps_common.js
Normal file
13
ext/phpbbstudio/aps/adm/style/js/aps_common.js
Normal file
@@ -0,0 +1,13 @@
|
||||
jQuery(function($) {
|
||||
$('.aps-names-toggle').on('click', function() {
|
||||
$(this).parents('fieldset').toggleClass('aps-points-full');
|
||||
let altText = $(this).data('text');
|
||||
$(this).data('text', $(this).text()).text(altText);
|
||||
});
|
||||
|
||||
$('#aps_points_icon').iconpicker({
|
||||
collision: true,
|
||||
placement: 'bottomRight',
|
||||
component: '#aps_points_icon + i',
|
||||
});
|
||||
});
|
||||
12
ext/phpbbstudio/aps/adm/style/js/aps_display.js
Normal file
12
ext/phpbbstudio/aps/adm/style/js/aps_display.js
Normal file
@@ -0,0 +1,12 @@
|
||||
jQuery(function($) {
|
||||
$('[data-aps-sortable]').sortable({
|
||||
axis: 'y',
|
||||
containment: $(this).selector,
|
||||
cursor: 'move',
|
||||
delay: 150,
|
||||
handle: '.aps-button-blue',
|
||||
forcePlaceholderSize: true,
|
||||
placeholder: 'panel',
|
||||
tolerance: 'pointer',
|
||||
});
|
||||
});
|
||||
83
ext/phpbbstudio/aps/adm/style/js/aps_forum.js
Normal file
83
ext/phpbbstudio/aps/adm/style/js/aps_forum.js
Normal file
@@ -0,0 +1,83 @@
|
||||
jQuery(function($) {
|
||||
let $button = $('#aps_points_copy_ajax'),
|
||||
$select = $('#aps_points_copy'),
|
||||
$form = $button.parents('form'),
|
||||
action = $form.attr('action').replace('&', '&');
|
||||
|
||||
let callback = 'aps_points_copy',
|
||||
$dark = $('#darkenwrapper');
|
||||
|
||||
$button.on('click', function(e) {
|
||||
/**
|
||||
* Handler for AJAX errors
|
||||
*/
|
||||
function errorHandler(jqXHR, textStatus, errorThrown) {
|
||||
if (typeof console !== 'undefined' && console.log) {
|
||||
console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown);
|
||||
}
|
||||
phpbb.clearLoadingTimeout();
|
||||
let responseText, errorText = false;
|
||||
try {
|
||||
responseText = JSON.parse(jqXHR.responseText);
|
||||
responseText = responseText.message;
|
||||
} catch (e) {}
|
||||
if (typeof responseText === 'string' && responseText.length > 0) {
|
||||
errorText = responseText;
|
||||
} else if (typeof errorThrown === 'string' && errorThrown.length > 0) {
|
||||
errorText = errorThrown;
|
||||
} else {
|
||||
errorText = $dark.attr('data-ajax-error-text-' + textStatus);
|
||||
if (typeof errorText !== 'string' || !errorText.length) {
|
||||
errorText = $dark.attr('data-ajax-error-text');
|
||||
}
|
||||
}
|
||||
phpbb.alert($dark.attr('data-ajax-error-title'), errorText);
|
||||
}
|
||||
|
||||
let request = $.ajax({
|
||||
url: action,
|
||||
type: 'post',
|
||||
data: {'aps_action': 'copy', 'aps_points_copy': $select.val()},
|
||||
success: function(response) {
|
||||
/**
|
||||
* @param {string} response.MESSAGE_TITLE
|
||||
* @param {string} response.MESSAGE_TEXT
|
||||
*/
|
||||
phpbb.alert(response.MESSAGE_TITLE, response.MESSAGE_TEXT);
|
||||
|
||||
if (typeof phpbb.ajaxCallbacks[callback] === 'function') {
|
||||
phpbb.ajaxCallbacks[callback].call(this, response);
|
||||
}
|
||||
},
|
||||
error: errorHandler,
|
||||
cache: false
|
||||
});
|
||||
|
||||
request.always(function() {
|
||||
let $loadingIndicator = phpbb.loadingIndicator();
|
||||
|
||||
if ($loadingIndicator && $loadingIndicator.is(':visible')) {
|
||||
$loadingIndicator.fadeOut(phpbb.alertTime);
|
||||
}
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
phpbb.addAjaxCallback('aps_points_copy', function(response) {
|
||||
$select.val(0);
|
||||
|
||||
/**
|
||||
* @param {array} response.APS_VALUES
|
||||
*/
|
||||
$.each(response.APS_VALUES, function(name, value) {
|
||||
$('#' + name).val(value);
|
||||
});
|
||||
});
|
||||
|
||||
phpbb.addAjaxCallback('aps_points_reset', function() {
|
||||
$('[name*="aps_values"]').each(function() {
|
||||
$(this).val(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
1
ext/phpbbstudio/aps/adm/style/js/fontawesome-iconpicker.min.js
vendored
Normal file
1
ext/phpbbstudio/aps/adm/style/js/fontawesome-iconpicker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
ext/phpbbstudio/aps/adm/style/js/jquery-ui-sortable.min.js
vendored
Normal file
7
ext/phpbbstudio/aps/adm/style/js/jquery-ui-sortable.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user