dsg
INSERT INTO `cp_filehtml` (`id`,`modul`,`app`,`path`,`type`,`cat`,`file_name`,`content`) VALUES ('275','post','1','u2/creator','0','js','post-view.js-','// $(document).on(\\\'touchstart\\\', \\\'.media-single-post-content .swiper-wrapper\\\', detectDoubleTapClosure((e) => {\r\n// const parent = e.closest(\\\'.media-post\\\')\r\n// const postId = parent.getAttribute(\\\'data-post-id\\\')\r\n// const isLiked = parent.getAttribute(\\\'data-is-liked\\\') === \\\'true\\\'\r\n\r\n// if (isLiked) {\r\n// return\r\n// }\r\n\r\n// togglePostLike(postId, true)\r\n// }), {\r\n// passive: false\r\n// })\r\n\r\n$(document).on(\\\'page:beforein\\\', \\\'.page[data-name=\\\"post-view\\\"]\\\', async function (e) {\r\n var pathStore = store.getters.getPathData\r\n\r\n var postId = e.detail.route.params.id\r\n var query = e.detail.route.query\r\n\r\n let commentId;\r\n\r\n if (query && query.commentId) {\r\n commentId = query.commentId\r\n }\r\n\r\n if (!postId || postId === \\\'-1\\\') {\r\n return\r\n }\r\n\r\n let cachedData = null\r\n\r\n try {\r\n if (pathStore && pathStore.value[`/post/${postId}`]) {\r\n cachedData = pathStore.value[`/post/${postId}`]\r\n }\r\n } catch (error) {\r\n console.error(\\\'Error fetching cached data:\\\', error)\r\n }\r\n\r\n if (!cachedData) {\r\n $(\\\'.loading-fullscreen.post-view\\\').show()\r\n\r\n const post = await getPostById(postId)\r\n if (!post) {\r\n app.dialog.alert(\\\'Post not found\\\', \\\'Error\\\')\r\n return\r\n }\r\n\r\n store.dispatch(\\\'setPathData\\\', {\r\n path: `/post/${postId}`,\r\n data: post,\r\n })\r\n\r\n cachedData = post\r\n } else {\r\n $(\\\'.loading-fullscreen.post-view\\\').hide()\r\n }\r\n\r\n displayPost(cachedData)\r\n\r\n if (commentId) {\r\n $(\\\'.media-post-comment\\\').click()\r\n }\r\n\r\n\r\n setTimeout(() => {\r\n // find .comment data-comment-id=\\\"${comment.id}\\\" and animate it to glow#\r\n if (commentId) {\r\n const comment = $(`.comment[data-comment-id=\\\"${commentId}\\\"]`)\r\n console.log(\\\'Comment:\\\', comment);\r\n\r\n if (comment.length > 0) {\r\n comment.addClass(\\\'target-highlight\\\')\r\n // Scroll to the comment\r\n document.querySelector(`.comment[data-comment-id=\\\"${commentId}\\\"]`).scrollIntoView({\r\n behavior: \\\'smooth\\\', // Optional, adds smooth scrolling\r\n block: \\\'start\\\', // Aligns the element to the top of the view\r\n inline: \\\'nearest\\\' // Aligns the element horizontally in the viewport\r\n });\r\n\r\n }\r\n\r\n setTimeout(() => {\r\n comment.removeClass(\\\'target-highlight\\\')\r\n }, 3000)\r\n }\r\n }, 2000)\r\n})');
Copy This

Warning: file_get_contents(/home/u340524018/domains/agniaga.com/public_html/sub/u2/creator/post-view.js-): Failed to open stream: No such file or directory in /home/u340524018/domains/agniaga.com/public_html/sub/u2/cp/inc.filehtml.php on line 319
// $(document).on(\'touchstart\', \'.media-single-post-content .swiper-wrapper\', detectDoubleTapClosure((e) => {
//   const parent = e.closest(\'.media-post\')
//   const postId = parent.getAttribute(\'data-post-id\')
//   const isLiked = parent.getAttribute(\'data-is-liked\') === \'true\'

//   if (isLiked) {
//     return
//   }

//   togglePostLike(postId, true)
// }), {
//   passive: false
// })

$(document).on(\'page:beforein\', \'.page[data-name=\"post-view\"]\', async function (e) {
  var pathStore = store.getters.getPathData

  var postId = e.detail.route.params.id
  var query = e.detail.route.query

  let commentId;

  if (query && query.commentId) {
    commentId = query.commentId
  }

  if (!postId || postId === \'-1\') {
    return
  }

  let cachedData = null

  try {
    if (pathStore && pathStore.value[`/post/${postId}`]) {
      cachedData = pathStore.value[`/post/${postId}`]
    }
  } catch (error) {
    console.error(\'Error fetching cached data:\', error)
  }

  if (!cachedData) {
    $(\'.loading-fullscreen.post-view\').show()

    const post = await getPostById(postId)
    if (!post) {
      app.dialog.alert(\'Post not found\', \'Error\')
      return
    }

    store.dispatch(\'setPathData\', {
      path: `/post/${postId}`,
      data: post,
    })

    cachedData = post
  } else {
    $(\'.loading-fullscreen.post-view\').hide()
  }

  displayPost(cachedData)

  if (commentId) {
    $(\'.media-post-comment\').click()
  }


  setTimeout(() => {
    // find .comment data-comment-id=\"${comment.id}\" and animate it to glow#
    if (commentId) {
      const comment = $(`.comment[data-comment-id=\"${commentId}\"]`)
      console.log(\'Comment:\', comment);

      if (comment.length > 0) {
        comment.addClass(\'target-highlight\')
        // Scroll to the comment
        document.querySelector(`.comment[data-comment-id=\"${commentId}\"]`).scrollIntoView({
          behavior: \'smooth\', // Optional, adds smooth scrolling
          block: \'start\', // Aligns the element to the top of the view
          inline: \'nearest\' // Aligns the element horizontally in the viewport
        });

      }

      setTimeout(() => {
        comment.removeClass(\'target-highlight\')
      }, 3000)
    }
  }, 2000)
})
Array
(
)
Add JS Function Name