Stable release of v3.2.0-beta1
Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
@ -14,7 +14,7 @@ jform_vvvvvyqvwh_required = false;
|
||||
jform_vvvvvyrvwi_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
document.addEventListener('DOMContentLoaded', function()
|
||||
{
|
||||
var class_extends_vvvvvxx = jQuery("#jform_class_extends").val();
|
||||
var joomla_plugin_group_vvvvvxx = jQuery("#jform_joomla_plugin_group").val();
|
||||
@ -615,7 +615,7 @@ function vvvvvyu(addreadme_vvvvvyu)
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
if (document.getElementById('jform_not_required')) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
@ -1099,41 +1099,52 @@ function getLinked(){
|
||||
});
|
||||
}
|
||||
|
||||
function getEditCustomCodeButtons_server(id){
|
||||
function getEditCustomCodeButtons_server(id) {
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&id='+id+'&return_here='+return_here;
|
||||
let requestParams = '';
|
||||
if (token.length > 0 && id > 0) {
|
||||
requestParams = token+'=1&id='+id+'&return_here='+return_here;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
// Construct URL with parameters for GET request
|
||||
const urlWithParams = getUrl + '&' + requestParams;
|
||||
|
||||
// Using the Fetch API for the GET request
|
||||
return fetch(urlWithParams, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return response.json();
|
||||
});
|
||||
}
|
||||
|
||||
function getEditCustomCodeButtons(){
|
||||
// get the id
|
||||
id = jQuery("#jform_id").val();
|
||||
getEditCustomCodeButtons_server(id).done(function(result) {
|
||||
if(isObject(result)){
|
||||
jQuery.each(result, function( field, buttons ) {
|
||||
jQuery('<div class="control-group"><div class="control-label"><label>Add/Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
|
||||
jQuery.each(buttons, function( name, button ) {
|
||||
jQuery(".control-customcode-buttons-"+field).append(button);
|
||||
function getEditCustomCodeButtons() {
|
||||
// Get the id using pure JavaScript
|
||||
const id = document.querySelector("#jform_id").value;
|
||||
getEditCustomCodeButtons_server(id).then(function(result) {
|
||||
if (typeof result === 'object') {
|
||||
Object.entries(result).forEach(([field, buttons]) => {
|
||||
// Creating the div element for buttons
|
||||
const div = document.createElement('div');
|
||||
div.className = 'control-group';
|
||||
div.innerHTML = '<div class="control-label"><label>Add/Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div>';
|
||||
|
||||
// Insert the div before .control-wrapper-{field}
|
||||
const insertBeforeElement = document.querySelector(".control-wrapper-"+field);
|
||||
insertBeforeElement.parentNode.insertBefore(div, insertBeforeElement);
|
||||
|
||||
// Adding buttons to the div
|
||||
Object.entries(buttons).forEach(([name, button]) => {
|
||||
const controlsDiv = document.querySelector(".control-customcode-buttons-"+field);
|
||||
controlsDiv.innerHTML += button;
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// check object is not empty
|
||||
function isObject(obj) {
|
||||
for(var prop in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user