{"id":37799,"date":"2025-09-18T14:36:38","date_gmt":"2025-09-18T06:36:38","guid":{"rendered":"https:\/\/student.edcity.hk\/pri\/?page_id=37799"},"modified":"2025-10-30T18:36:42","modified_gmt":"2025-10-30T10:36:42","slug":"funpost-videos","status":"publish","type":"page","link":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/","title":{"rendered":"Fun Post"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"37799\" class=\"elementor elementor-37799\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e3c8720 e-flex e-con-boxed e-con e-parent\" data-id=\"e3c8720\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-feb49bc elementor-widget elementor-widget-shortcode\" data-id=\"feb49bc\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"breadcrumbs\" typeof=\"BreadcrumbList\"><a href='https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/home\/' title='PICCKS\u5b78\u751f\u734e\u52f5\u8a08\u5283'>PICCKS\u5b78\u751f\u734e\u52f5\u8a08\u5283<\/a> &gt; <a href='https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks-post\/\u5c0f\u6821\u5831\u5f71\u7247\u5b78\u7fd2\u5eab202526\/' title='\u5c0f\u6821\u5831\u5f71\u7247\u5b78\u7fd2\u5eab'>\u5c0f\u6821\u5831\u5f71\u7247\u5b78\u7fd2\u5eab<\/a><\/div><style>div.breadcrumbs>a:hover{color:#E55125;}<\/style>\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c5ef5f9 elementor-widget elementor-widget-html\" data-id=\"c5ef5f9\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"category-filters\"><\/div>\r\n<div id=\"video-grid\"><\/div>\r\n<div id=\"loading\" style=\"display: none;\"><\/div>\r\n<div id=\"no-videos\" style=\"display: none;\"><\/div>\r\n\r\n<script>\r\n  \/\/ Get language from URL path\r\n  var lang = window.location.pathname.split('\/').find(s => ['zh-hant', 'en', 'zh-hans'].includes(s)) || 'zh-hant'\r\n\r\n  \/\/ Dictionary for translations\r\n  const i18n = {\r\n    'zh-hant': {\r\n      noVideos: '\u66ab\u7121\u5f71\u7247\u53ef\u986f\u793a',\r\n      learnMore: '\u4e86\u89e3\u66f4\u591a',\r\n      all: '\u5168\u9078'\r\n    },\r\n    'en': {\r\n      noVideos: 'No videos available',\r\n      learnMore: 'Learn more',\r\n      all: 'All'\r\n    },\r\n    'zh-hans': {\r\n      noVideos: '\u6682\u65e0\u5f71\u7247\u53ef\u663e\u793a',\r\n      learnMore: '\u4e86\u89e3\u66f4\u591a',\r\n      all: '\u5168\u9009'\r\n    }\r\n  }\r\n\r\n  \/\/ Pagination state\r\n  let allVideos = []\r\n  let filteredVideos = []\r\n  let currentPage = 1\r\n  const ITEMS_PER_PAGE = 12\r\n  let selectedCategories = []\r\n  let loadingMore = false\r\n\r\n  \/\/ Initialize page\r\n  $(function () {\r\n    loadVideos()\r\n  })\r\n\r\n  \/\/ Load videos from API (only once)\r\n  async function loadVideos() {\r\n    $('#loading').show()\r\n    try {\r\n      const response = await fetch(`\/pri\/wp-json\/piccks\/funpost\/video\/list?lang=${lang}`)\r\n      const result = await response.json()\r\n\r\n      allVideos = result.data || []\r\n      const categories = result.categories || []\r\n\r\n      if (allVideos.length === 0) {\r\n        $('#no-videos').text(i18n[lang].noVideos).show()\r\n      } else {\r\n        $('#video-grid').data('videos', allVideos)\r\n        setupCategoryFilters(categories)\r\n        selectedCategories = ['all']\r\n        filteredVideos = filterVideos(allVideos, selectedCategories)\r\n        renderVideosPage(1)\r\n        setupInfiniteScroll()\r\n      }\r\n    } catch (error) {\r\n      console.error('Failed to load videos:', error)\r\n  $('#no-videos').text(i18n[lang].noVideos).show()\r\n    } finally {\r\n      $('#loading').hide()\r\n    }\r\n  }\r\n\r\n  \/\/ Filter videos by selected categories\r\n  function filterVideos(videos, selectedCategories) {\r\n    const showAll = selectedCategories.includes('all') || selectedCategories.length === 0\r\n    return showAll\r\n      ? videos\r\n      : videos.filter(video => video.cate && selectedCategories.includes(video.cate.slug))\r\n  }\r\n\r\n  \/\/ Render a page of videos\r\n  function renderVideosPage(page) {\r\n    if (page === 1) {\r\n      $('#video-grid').empty()\r\n      $('#no-videos').hide()\r\n    }\r\n    const startIdx = (page - 1) * ITEMS_PER_PAGE\r\n    const endIdx = startIdx + ITEMS_PER_PAGE\r\n    const pageVideos = filteredVideos.slice(startIdx, endIdx)\r\n    if (pageVideos.length === 0 && page === 1) {\r\n      $('#no-videos').text(i18n[lang].noVideos).show()\r\n      return\r\n    }\r\n    pageVideos.forEach(video => {\r\n      const videoElement = `\r\n        <div class=\"video-item\">\r\n          <a href=\"${video.link}\">\r\n            <div class=\"video-thumbnail\">\r\n              <img decoding=\"async\" src=\"${video.img}\" alt=\"${video.title}\">\r\n            <\/div>\r\n            <h3>${video.title}<\/h3>\r\n          <\/a>\r\n          <div class=\"video-meta\">\r\n            <p class=\"video-category\">${video.cate.name || ''}<\/p>\r\n          <\/div>\r\n        <\/div>\r\n      `\r\n      $('#video-grid').append(videoElement)\r\n    })\r\n    loadingMore = false\r\n  }\r\n\r\n  \/\/ Setup infinite scroll\r\n  function setupInfiniteScroll() {\r\n    $(window).off('scroll.aicorner').on('scroll.aicorner', function () {\r\n      if (loadingMore) return\r\n      if ($(window).scrollTop() + $(window).height() > $(document).height() - 200) {\r\n        \/\/ Near bottom, load next page\r\n        if (currentPage * ITEMS_PER_PAGE < filteredVideos.length) {\r\n          loadingMore = true\r\n          currentPage++\r\n          renderVideosPage(currentPage)\r\n        }\r\n      }\r\n    })\r\n  }\r\n\r\n  \/\/ Setup category filters using the categories data from API\r\n  function setupCategoryFilters(categories) {\r\n    \/\/ Add category filters\r\n    $('.category-filters').empty()\r\n\r\n    \/\/ Add \"All\" checkbox first with proper translation\r\n    let filterHtml = `\r\n      <label class=\"filter-label\">\r\n        <input type=\"checkbox\" class=\"filter-checkbox\" data-category=\"all\"> ${i18n[lang].all}\r\n      <\/label>\r\n    `\r\n\r\n    \/\/ Add checkboxes for each category using label from API\r\n    categories.forEach(category => {\r\n      filterHtml += `\r\n        <label class=\"filter-label\">\r\n          <input type=\"checkbox\" class=\"filter-checkbox\" data-category=\"${category.value}\"> ${category.label}\r\n        <\/label>\r\n      `\r\n    })\r\n\r\n    $('.category-filters').html(filterHtml)\r\n\r\n    \/\/ Get videos data\r\n    const videos = $('#video-grid').data('videos') || []\r\n\r\n    \/\/ Add change handler to filter checkboxes\r\n    $('.filter-checkbox').on('change', function () {\r\n      const $this = $(this)\r\n      const category = $this.data('category')\r\n      const isChecked = $this.prop('checked')\r\n\r\n      \/\/ Handle \"All\" checkbox behavior\r\n      if (category === 'all') {\r\n        \/\/ Check\/uncheck all other checkboxes when \"All\" changes\r\n        $('.filter-checkbox').not(this).prop('checked', isChecked)\r\n      } else {\r\n        \/\/ If unchecking any category, also uncheck \"All\"\r\n        if (!isChecked) {\r\n          $('.filter-checkbox[data-category=\"all\"]').prop('checked', false)\r\n        }\r\n        \/\/ If all individual categories are checked, check \"All\" too\r\n        else if ($('.filter-checkbox:not([data-category=\"all\"]):checked').length === categories.length) {\r\n          $('.filter-checkbox[data-category=\"all\"]').prop('checked', true)\r\n        }\r\n      }\r\n\r\n      \/\/ Get all selected categories\r\n      selectedCategories = $('.filter-checkbox:checked').map(function () {\r\n        return $(this).data('category')\r\n      }).get()\r\n      \/\/ Filter and re-render videos\r\n      filteredVideos = filterVideos(allVideos, selectedCategories)\r\n      currentPage = 1\r\n      renderVideosPage(currentPage)\r\n    })\r\n  }\r\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":15,"featured_media":0,"parent":34118,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-37799","page","type-page","status-publish","hentry"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/\" \/>\n<meta property=\"og:site_name\" content=\"\u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-30T10:36:42+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/\",\"url\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/\",\"name\":\"Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f\",\"isPartOf\":{\"@id\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/#website\"},\"datePublished\":\"2025-09-18T06:36:38+00:00\",\"dateModified\":\"2025-10-30T10:36:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PICCKS 2025-26\",\"item\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Fun Post\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/#website\",\"url\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/\",\"name\":\"\u9999\u6e2f\u6559\u80b2\u57ce - \u5c0f\u5b78\u751f\",\"description\":\"\u5c0f\u5b78\u751f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/student.edcity.hk\/pri\/zh-hant\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/","og_locale":"zh_TW","og_type":"article","og_title":"Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f","og_url":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/","og_site_name":"\u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f","article_modified_time":"2025-10-30T10:36:42+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u9810\u4f30\u95b1\u8b80\u6642\u9593":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/","url":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/","name":"Fun Post - PICCKS 2025-26 - \u9999\u6e2f\u6559\u80b2\u57ce \u2013 \u5c0f\u5b78\u751f","isPartOf":{"@id":"https:\/\/student.edcity.hk\/pri\/zh-hant\/#website"},"datePublished":"2025-09-18T06:36:38+00:00","dateModified":"2025-10-30T10:36:42+00:00","breadcrumb":{"@id":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/funpost\/videos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/student.edcity.hk\/pri\/zh-hant\/"},{"@type":"ListItem","position":2,"name":"PICCKS 2025-26","item":"https:\/\/student.edcity.hk\/pri\/zh-hant\/piccks\/202526\/"},{"@type":"ListItem","position":3,"name":"Fun Post"}]},{"@type":"WebSite","@id":"https:\/\/student.edcity.hk\/pri\/zh-hant\/#website","url":"https:\/\/student.edcity.hk\/pri\/zh-hant\/","name":"\u9999\u6e2f\u6559\u80b2\u57ce - \u5c0f\u5b78\u751f","description":"\u5c0f\u5b78\u751f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/student.edcity.hk\/pri\/zh-hant\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"}]}},"_links":{"self":[{"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/pages\/37799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/comments?post=37799"}],"version-history":[{"count":101,"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/pages\/37799\/revisions"}],"predecessor-version":[{"id":41896,"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/pages\/37799\/revisions\/41896"}],"up":[{"embeddable":true,"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/pages\/34118"}],"wp:attachment":[{"href":"https:\/\/student.edcity.hk\/pri\/zh-hant\/wp-json\/wp\/v2\/media?parent=37799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}