assets/js/script.js
/**
 * Show The Confirm Delete, When The Post Delete Button is Clicked
 */
Show The Confirm Delete, When The Post Delete Button is Clicked
Show The Confirm Delete When The Post Delete Button is Clicked
function confirm_post_delete(post_id) {
  var main_area = document.querySelector('main.container');
  var html = '';
  html += '<div class="confirm-modal">';
  html += '<div class="content">';
  html += '<p>';
  html += 'هل أنت متأكد من حذف المنشور ؟';
  html += '</p>';
  html += '<ul class="confirm-actions">';
  html += '<li class="delete">';
  html += '<form method="POST" action="' + window.location.origin + '/laquatat/delete_post.php">';
  html += '<input type="hidden" name="post_id" value="' + post_id + '">';
  html += '<input type="hidden" name="token" value="' + token + '">';
  html += '<button type="submit">حذف</button>';
  html += '</form>';
  html += '</li>'; 
  html += `<li class="cancel" onclick="close_modal('main.container .confirm-modal')"><a>إلغاء</a></li>`;
  html += '</ul>'; 
  html += '</div>'; 
  html += '</div>'; 
  main_area.innerHTML += html;
  setTimeout(() => {
    document.querySelector('main.container .confirm-modal').classList.add('shown');
  }, 300);
}
function confirm_post_delete ( post_id ) { var main_area = document . querySelector ( 'main.container' ) ; var html = '' ; html += '<div class="confirm-modal">' ; html += '<div class="content">' ; html += '<p>' ; html += 'هل أنت متأكد من حذف المنشور ؟';
 html += '</p>' ; html += '<ul class="confirm-actions">' ; html += '<li class="delete">' ; html += '<form method="POST" action="' + window . location . origin + '/laquatat/delete_post.php">' ; html += '<input type="hidden" name="post_id" value="' + post_id + '">' ; html += '<input type="hidden" name="token" value="' + token + '">' ; html += '<button type="submit">حذف</button>';
 html += '</form>' ; html += '</li>' ; html += ` html += '</ul>' ; html += '</div>' ; html += '</div>' ; main_area . innerHTML += html ; setTimeout ( ( ) => { document . querySelector ( 'main.container .confirm-modal' ) . classList . add ( 'shown' ) ; } , 300 ) ; }
Show The Confirm Delete, When The Post Delete Button is Clicked
Show The Confirm Delete When The Post Delete Button is Clicked
// Setup Needed Variables
 // Modal HTML
 // Close '.delete'
 // Close '.confirm-actions'
 // Close '.content'
 // Clase '.confirm-modal'
 // Append Modal HTML To The Main Area
 // Show The Modal After 300 ms
