{"id":1261,"date":"2026-06-03T12:45:24","date_gmt":"2026-06-03T12:45:24","guid":{"rendered":"https:\/\/discipleshiptraininginternational.com\/?page_id=1261"},"modified":"2026-06-04T01:58:32","modified_gmt":"2026-06-04T01:58:32","slug":"plp","status":"publish","type":"page","link":"https:\/\/discipleshiptraininginternational.com\/?page_id=1261","title":{"rendered":"My Personal Reading Room"},"content":{"rendered":"\n<div id=\"dti-reading-room\">\n  <div class=\"dti-room\">\n    <div class=\"dti-shelves\" id=\"dti-last-five\"><\/div>\n    <div class=\"dti-history-click\" onclick=\"openHistory()\"><\/div>\n  <\/div>\n\n  <div id=\"dti-full-library\">\n    <h2>My Personal Book History<\/h2>\n    <input id=\"dti-search\" placeholder=\"Search by book code or title...\">\n    <div id=\"dti-opened-list\"><\/div>\n  <\/div>\n<\/div>\n\n<style>\n#dti-reading-room {\n  width: 100%;\n  background: #f8f4ec;\n  padding: 0;\n  margin: 0 auto;\n  text-align: center;\n  font-family: Arial, sans-serif;\n}\n\n.dti-room {\n  position: relative;\n  width: 100%;\n  max-width: 1200px;\n  aspect-ratio: 744 \/ 480;\n  margin: 0 auto;\n  background-image: url('https:\/\/discipleshiptraininginternational.com\/wp-content\/uploads\/2026\/06\/plp.png');\n  background-size: 100% 100%;\n  background-position: center center;\n  background-repeat: no-repeat;\n  overflow: visible;\n}\n\n.dti-shelves {\n  position: absolute;\n  top: 14%;\n  left: 50%;\n  transform: translateX(-50%);\n  width: 47%;\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: -5% 8%;\n  z-index: 50;\n}\n\n.dti-history-click {\n  position: absolute;\n  left: 58%;\n  top: 38%;\n  width: 13%;\n  height: 34%;\n  cursor: pointer;\n  z-index: 200;\n}\n\n.dti-slot {\n  height: 132px;\n  display: flex;\n  align-items: flex-end;\n  justify-content: center;\n  position: relative;\n  z-index: 60;\n}\n\n.dti-book-cover {\n  width: 58px;\n  height: 90px;\n  object-fit: cover;\n  border-radius: 4px;\n  box-shadow: 0 5px 10px rgba(0,0,0,.30);\n  cursor: pointer;\n  z-index: 70;\n  transform: translateY(-39px);\n}\n\n.dti-label {\n  display: none;\n}\n\n#dti-full-library {\n  max-width: 1050px;\n  margin: 40px auto;\n  background: white;\n  padding: 25px;\n  border-radius: 12px;\n  display: none;\n  box-shadow: 0 5px 18px rgba(0,0,0,.18);\n}\n\n#dti-search {\n  width: 100%;\n  padding: 14px;\n  font-size: 17px;\n  margin-bottom: 20px;\n  border: 2px solid #ccc;\n  border-radius: 8px;\n  box-sizing: border-box;\n}\n\n.dti-row {\n  display: grid;\n  grid-template-columns: 110px 1fr 190px;\n  gap: 15px;\n  padding: 13px;\n  border-bottom: 1px solid #ddd;\n  text-align: left;\n  align-items: center;\n}\n\n.dti-row button {\n  background: #d4af37;\n  border: none;\n  padding: 9px 12px;\n  font-weight: bold;\n  cursor: pointer;\n  border-radius: 6px;\n  margin-right: 6px;\n}\n\n.dti-row button.dti-remove-btn {\n  background: #8b0000;\n  color: white;\n}\n\n@media(max-width:700px){\n  .dti-row {\n    grid-template-columns: 1fr;\n    text-align: center;\n  }\n\n  .dti-row button {\n    margin-top: 8px;\n  }\n}\n<\/style>\n\n<script>\nfunction normalizeDTIBook(book) {\n  return {\n    code: book.catalogNumber || book.code,\n    title: book.title,\n    cover: book.coverUrl || book.cover || book.cover_url,\n    html: book.bookUrl || book.html || book.html_url,\n    lastOpened: book.lastOpened || new Date().toLocaleString()\n  };\n}\n\nfunction getOpenedBooks() {\n  return JSON.parse(localStorage.getItem(\"dtiOpenedBooks\")) || [];\n}\n\nfunction saveOpenedBooks(books) {\n  localStorage.setItem(\"dtiOpenedBooks\", JSON.stringify(books));\n}\n\nfunction trackOpenedBook(book) {\n  const cleanBook = normalizeDTIBook(book);\n\n  let books = getOpenedBooks();\n\n  books = books.filter(function(item) {\n    return item.code !== cleanBook.code;\n  });\n\n  cleanBook.lastOpened = new Date().toLocaleString();\n\n  books.unshift(cleanBook);\n\n  saveOpenedBooks(books);\n}\n\nfunction openDTIBook(book) {\n  const cleanBook = normalizeDTIBook(book);\n\n  trackOpenedBook(cleanBook);\n\n  window.open(cleanBook.html, \"_blank\");\n\n  renderReadingRoom();\n\n  const historyBox = document.getElementById(\"dti-full-library\");\n  if (historyBox.style.display === \"block\") {\n    renderOpenedList();\n  }\n}\n\nfunction openHistory() {\n  const historyBox = document.getElementById(\"dti-full-library\");\n\n  if (historyBox.style.display === \"block\") {\n    historyBox.style.display = \"none\";\n    return;\n  }\n\n  historyBox.style.display = \"block\";\n  renderOpenedList();\n  historyBox.scrollIntoView({ behavior: \"smooth\" });\n}\n\nfunction removeOpenedBook(code) {\n  let books = getOpenedBooks();\n\n  books = books.filter(function(book) {\n    return book.code !== code;\n  });\n\n  saveOpenedBooks(books);\n\n  renderReadingRoom();\n  renderOpenedList();\n}\n\nfunction renderReadingRoom() {\n  const books = getOpenedBooks();\n  const lastFive = books.slice(0, 5);\n  const shelf = document.getElementById(\"dti-last-five\");\n\n  shelf.innerHTML = \"\";\n\n  for (let i = 0; i < 5; i++) {\n    const slot = document.createElement(\"div\");\n    slot.className = \"dti-slot\";\n\n    if (lastFive[i]) {\n      const book = lastFive[i];\n\n      slot.innerHTML = `\n        <img decoding=\"async\" \n          class=\"dti-book-cover\" \n          src=\"${book.cover}\" \n          alt=\"${book.code} - ${book.title}\" \n          title=\"${book.code} - ${book.title}\"\n        >\n      `;\n\n      slot.onclick = function() {\n        openDTIBook(book);\n      };\n    }\n\n    shelf.appendChild(slot);\n  }\n}\n\nfunction renderOpenedList() {\n  const list = document.getElementById(\"dti-opened-list\");\n  const searchInput = document.getElementById(\"dti-search\");\n  const search = searchInput.value.toLowerCase();\n\n  const books = getOpenedBooks().filter(function(book) {\n    const code = (book.code || \"\").toLowerCase();\n    const title = (book.title || \"\").toLowerCase();\n\n    return code.includes(search) || title.includes(search);\n  });\n\n  if (books.length === 0) {\n    list.innerHTML = \"<p>No books opened yet.<\/p>\";\n    return;\n  }\n\n  list.innerHTML = books.map(function(book) {\n    const safeBook = JSON.stringify(book).replace(\/'\/g, \"&#39;\");\n\n    return `\n      <div class=\"dti-row\">\n        <div><strong>${book.code}<\/strong><\/div>\n\n        <div>\n          ${book.title}<br>\n          <small>${book.lastOpened || \"\"}<\/small>\n        <\/div>\n\n        <div>\n          <button onclick='openDTIBook(${safeBook})'>Open<\/button>\n          <button class=\"dti-remove-btn\" onclick='removeOpenedBook(\"${book.code}\")'>Remove<\/button>\n        <\/div>\n      <\/div>\n    `;\n  }).join(\"\");\n}\n\ndocument.getElementById(\"dti-search\").addEventListener(\"input\", renderOpenedList);\n\nrenderReadingRoom();\n<\/script>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>My Personal Book History<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1261","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/pages\/1261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1261"}],"version-history":[{"count":24,"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/pages\/1261\/revisions"}],"predecessor-version":[{"id":1305,"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=\/wp\/v2\/pages\/1261\/revisions\/1305"}],"wp:attachment":[{"href":"https:\/\/discipleshiptraininginternational.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}