{"id":31653,"date":"2025-11-10T10:49:46","date_gmt":"2025-11-10T09:49:46","guid":{"rendered":"https:\/\/www.univ-djelfa.dz\/?page_id=31653"},"modified":"2025-11-12T11:36:26","modified_gmt":"2025-11-12T10:36:26","slug":"elementor-31653","status":"publish","type":"page","link":"https:\/\/www.univ-djelfa.dz\/?page_id=31653","title":{"rendered":"\u0627\u0644\u0628\u062d\u062b \u0627\u0644\u0628\u064a\u0628\u0644\u064a\u0648\u063a\u0631\u0627\u0641\u064a"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"31653\" class=\"elementor elementor-31653\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-284b9ec elementor-section-boxed elementor-section-height-default elementor-section-height-default exad-sticky-section-no\" data-id=\"284b9ec\" data-element_type=\"section\" data-settings=\"{&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-07ea5f0 exad-sticky-section-no\" data-id=\"07ea5f0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f93b90a exad-sticky-section-no elementor-widget elementor-widget-html\" data-id=\"f93b90a\" data-element_type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div dir=\"rtl\" style=\"font-family:'Cairo',sans-serif; background:#fff; padding:25px; border-radius:12px; border:1px solid #e0e0e0; max-width:100%; box-sizing:border-box;\">\n  <h2 style=\"text-align:center; color:#333; margin-bottom:10px;\">\ud83d\udcda \u0627\u0644\u0628\u062d\u062b \u0641\u064a \u0627\u0644\u0645\u0631\u0627\u062c\u0639<\/h2>\n  <div style=\"height:2px; background:#ccc; margin-bottom:15px;\"><\/div>\n\n  <div id=\"searchSection\" style=\"display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-bottom:15px;\">\n    <input id=\"titleInput\" placeholder=\"\ud83d\udd0d \u0627\u0644\u0628\u062d\u062b \u0628\u0627\u0644\u0639\u0646\u0648\u0627\u0646\" class=\"input-field\">\n    <input id=\"authorInput\" placeholder=\"\ud83d\udc64 \u0627\u0644\u0628\u062d\u062b \u0628\u0627\u0644\u0645\u0624\u0644\u0641\" class=\"input-field\">\n    <input id=\"publisherInput\" placeholder=\"\ud83c\udfe2 \u0627\u0644\u0628\u062d\u062b \u0628\u062f\u0627\u0631 \u0627\u0644\u0646\u0634\u0631\" class=\"input-field\">\n    <button id=\"searchBtn\" class=\"btn btn-dark\">\u0628\u062d\u062b<\/button>\n    <button id=\"resetBtn\" class=\"btn btn-light\">\u0645\u0633\u062d<\/button>\n    <button id=\"showAllBtn\" class=\"btn btn-gray\">\u0639\u0631\u0636 \u0643\u0644 \u0627\u0644\u0645\u0631\u0627\u062c\u0639<\/button>\n  <\/div>\n\n  <p id=\"noResults\" style=\"display:none; color:#a33; text-align:center;\">\u274c \u0644\u0627 \u062a\u0648\u062c\u062f \u0646\u062a\u0627\u0626\u062c<\/p>\n  <div id=\"resultsContainer\" style=\"display:none; margin-top:20px; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; display:grid;\"><\/div>\n  <div id=\"tableContainer\" style=\"display:none; margin-top:20px; width:100%; overflow-x:auto;\">\n    <table id=\"allRefsTable\" style=\"width:100%; border-collapse:collapse; text-align:right; background:#fff; font-size:14px;\">\n      <thead style=\"background:#f0f0f0; color:#333;\"><\/thead>\n      <tbody><\/tbody>\n    <\/table>\n  <\/div>\n  <div id=\"pagination\" style=\"text-align:center; margin-top:15px;\"><\/div>\n<\/div>\n\n<style>\n  .input-field {\n    padding:10px;\n    border:1px solid #ccc;\n    border-radius:8px;\n    min-width:220px;\n    flex:1;\n    box-sizing:border-box;\n  }\n  .btn {\n    border:none;\n    border-radius:8px;\n    padding:10px 18px;\n    cursor:pointer;\n    transition:0.2s;\n    white-space:nowrap;\n  }\n  .btn-dark { background:#666; color:#fff; }\n  .btn-light { background:#ccc; color:#333; }\n  .btn-gray { background:#888; color:#fff; }\n  .btn:hover { opacity:0.85; }\n\n  \/* \ud83e\udde9 \u062a\u062d\u0633\u064a\u0646 \u0627\u0644\u0639\u0631\u0636 \u0639\u0644\u0649 \u0627\u0644\u0647\u0627\u062a\u0641 *\/\n  @media (max-width:600px) {\n    #searchSection {\n      flex-direction:column;\n      align-items:stretch;\n    }\n    .input-field, .btn {\n      width:100%;\n      min-width:unset;\n    }\n    #resultsContainer {\n      grid-template-columns:1fr;\n    }\n    table {\n      font-size:12px;\n    }\n    th, td {\n      padding:6px !important;\n    }\n  }\n<\/style>\n\n<script>\nconst csvUrl = 'https:\/\/www.univ-djelfa.dz\/\/wp-content\/uploads\/libray.csv';\nlet headers = [];\nlet data = [];\nlet currentPage = 1;\nconst itemsPerPage = 9;\nconst tableItemsPerPage = 10;\n\nfunction detectDelimiter(line){\n  const semis=(line.match(\/;\/g)||[]).length;\n  const commas=(line.match(\/,\/g)||[]).length;\n  return semis>commas?';':',';\n}\n\nfunction parseCSV(text){\n  text=text.replace(\/^\\uFEFF\/, '');\n  const lines=text.split(\/\\r?\\n\/).filter(l=>l.trim()!=='');\n  if(!lines.length)return{headers:[],rows:[]};\n  const delim=detectDelimiter(lines[0]);\n  const headers=lines[0].split(delim).map(h=>h.trim());\n  const rows=lines.slice(1).map(line=>{\n    const parts=[];let cur='',inQuotes=false;\n    for(let ch of line){\n      if(ch==='\"') inQuotes=!inQuotes;\n      else if(ch===delim&&!inQuotes){parts.push(cur.trim());cur='';}\n      else cur+=ch;\n    }\n    parts.push(cur.trim());\n    return parts;\n  });\n  return {headers,rows};\n}\n\nfunction createCard(row){\n  let card = `<div style=\"background:#fff;border:1px solid #e0e0e0;border-radius:10px;padding:12px;box-shadow:0 1px 3px rgba(0,0,0,0.05);\">`;\n  for(let i=0;i<headers.length;i++){\n    if(!headers[i]) continue;\n    card += `<p><strong>${headers[i]}:<\/strong> ${row[i]||''}<\/p>`;\n  }\n  card += `<\/div>`;\n  return card;\n}\n\nfunction paginateResults(filtered){\n  const totalPages = Math.ceil(filtered.length \/ itemsPerPage);\n  if (currentPage > totalPages) currentPage = totalPages;\n  const start = (currentPage - 1) * itemsPerPage;\n  const end = start + itemsPerPage;\n  const paginated = filtered.slice(start, end);\n\n  const res = document.getElementById('resultsContainer');\n  const no = document.getElementById('noResults');\n  const paginationDiv = document.getElementById('pagination');\n\n  if (!filtered.length){\n    res.style.display='none';\n    paginationDiv.innerHTML='';\n    no.style.display='block';\n    return;\n  }\n\n  no.style.display='none';\n  res.style.display='grid';\n  res.innerHTML = paginated.map(createCard).join('');\n\n  renderShortPagination(totalPages, gotoPage);\n}\n\nfunction gotoPage(page){\n  currentPage = page;\n  performSearch();\n}\n\nfunction renderShortPagination(totalPages, callback){\n  const pagination=document.getElementById('pagination');\n  pagination.innerHTML='';\n  const delta=2;\n  let range = [];\n  for(let i=1;i<=totalPages;i++){\n    if(i===1 || i===totalPages || (i>=currentPage-delta && i<=currentPage+delta)){\n      range.push(i);\n    }\n  }\n  let last = 0;\n  range.forEach(i=>{\n    if(i-last>1) pagination.innerHTML+=' ... ';\n    pagination.innerHTML += `<button onclick=\"(${callback.name})(${i})\" style=\"margin:3px; padding:6px 12px; border-radius:6px; border:1px solid #ccc; background:${i===currentPage?'#666':'#fff'}; color:${i===currentPage?'#fff':'#333'}; cursor:pointer;\">${i}<\/button>`;\n    last=i;\n  });\n}\n\nfunction performSearch(){\n  const t=document.getElementById('titleInput').value.trim().toLowerCase();\n  const a=document.getElementById('authorInput').value.trim().toLowerCase();\n  const p=document.getElementById('publisherInput').value.trim().toLowerCase();\n  if(!data.length)return;\n\n  const ti=headers.findIndex(h=>h.replace(\/\\s|\u0640|_|-\/g,'').includes('\u0639\u0646\u0648\u0627\u0646'));\n  const ai=headers.findIndex(h=>h.replace(\/\\s|\u0640|_|-\/g,'').includes('\u0645\u0624\u0644\u0641'));\n  const pi=headers.findIndex(h=>h.replace(\/\\s|\u0640|_|-\/g,'').includes('\u0646\u0627\u0634\u0631'));\n\n  const filtered=data.filter(r=>(!t||(r[ti]||'').toLowerCase().includes(t))&&(!a||(r[ai]||'').toLowerCase().includes(a))&&(!p||(r[pi]||'').toLowerCase().includes(p)));\n  paginateResults(filtered);\n}\n\nfunction resetSearch(){\n  document.getElementById('titleInput').value='';\n  document.getElementById('authorInput').value='';\n  document.getElementById('publisherInput').value='';\n  document.getElementById('resultsContainer').style.display='none';\n  document.getElementById('noResults').style.display='none';\n  document.getElementById('pagination').innerHTML='';\n  currentPage = 1;\n}\n\nasync function loadCSV(){\n  try{\n    const res=await fetch(csvUrl);\n    if(!res.ok){throw new Error('file not found');}\n    const text=await res.text();\n    const utf8Text = new TextDecoder('utf-8', {fatal:false}).decode(new TextEncoder().encode(text));\n    const parsed=parseCSV(utf8Text);\n    headers=parsed.headers;\n    data=parsed.rows;\n  }catch(e){\n    alert('\u26a0\ufe0f \u062a\u0639\u0630\u0631 \u0642\u0631\u0627\u0621\u0629 \u0645\u0644\u0641 CSV. \u062a\u0623\u0643\u062f \u0645\u0646 \u0627\u0644\u0645\u0633\u0627\u0631 \u0623\u0648 \u0627\u0644\u062a\u0631\u0645\u064a\u0632.');\n    console.error(e);\n  }\n}\n\nfunction showAllReferences(){\n  const tableContainer=document.getElementById('tableContainer');\n  const resultsContainer=document.getElementById('resultsContainer');\n  const btn=document.getElementById('showAllBtn');\n\n  if(tableContainer.style.display==='none'){\n    resultsContainer.style.display='none';\n    renderTable(1);\n    tableContainer.style.display='block';\n    btn.textContent='\u0625\u062e\u0641\u0627\u0621 \u0627\u0644\u062c\u062f\u0648\u0644';\n  } else {\n    tableContainer.style.display='none';\n    btn.textContent='\u0639\u0631\u0636 \u0643\u0644 \u0627\u0644\u0645\u0631\u0627\u062c\u0639';\n  }\n}\n\nfunction renderTable(page){\n  const table=document.getElementById('allRefsTable');\n  const totalPages=Math.ceil(data.length\/tableItemsPerPage);\n  const start=(page-1)*tableItemsPerPage;\n  const end=start+tableItemsPerPage;\n  const rows=data.slice(start,end);\n\n  table.querySelector('thead').innerHTML='<tr>'+headers.map(h=>`<th style=\"padding:8px;border:1px solid #ccc;\">${h}<\/th>`).join('')+'<\/tr>';\n  table.querySelector('tbody').innerHTML=rows.map(r=>'<tr style=\"background:#fff;\">'+r.map(c=>`<td style=\"padding:6px;border:1px solid #eee;\">${c}<\/td>`).join('')+'<\/tr>').join('');\n\n  currentPage=page;\n  renderShortPagination(totalPages, renderTable);\n}\n\ndocument.addEventListener('DOMContentLoaded',()=>{\n  loadCSV();\n  document.getElementById('searchBtn').onclick=()=>{currentPage=1;performSearch();};\n  document.getElementById('resetBtn').onclick=resetSearch;\n  document.getElementById('showAllBtn').onclick=showAllReferences;\n});\n<\/script>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\ud83d\udcda \u0627\u0644\u0628\u062d\u062b \u0641\u064a \u0627\u0644\u0645\u0631\u0627\u062c\u0639 \u0628\u062d\u062b \u0645\u0633\u062d \u0639\u0631\u0636 \u0643\u0644 \u0627\u0644\u0645\u0631\u0627\u062c\u0639 \u274c \u0644\u0627 \u062a\u0648\u062c\u062f \u0646\u062a\u0627\u0626\u062c<\/p>\n","protected":false},"author":2,"featured_media":31660,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kad_post_transparent":"","_kad_post_title":"default","_kad_post_layout":"default","_kad_post_sidebar_id":"","_kad_post_content_style":"default","_kad_post_vertical_padding":"default","_kad_post_feature":"default","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"class_list":["post-31653","page","type-page","status-publish","has-post-thumbnail","hentry"],"lang":"ar","translations":{"ar":31653,"fr":31674},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/pages\/31653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31653"}],"version-history":[{"count":10,"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/pages\/31653\/revisions"}],"predecessor-version":[{"id":32008,"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/pages\/31653\/revisions\/32008"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=\/wp\/v2\/media\/31660"}],"wp:attachment":[{"href":"https:\/\/www.univ-djelfa.dz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}