126e9a80 by Yokihito Oki

Merge branch 'video_liblary' into 'master'

Video liblary

See merge request !35
2 parents 67839487 3b3cd770
# ビデオライブラリ - 動画カテゴリー別に記事を一覧表示するモジュール
ビデオライブラリ配下の動画カテゴリーごとに、記事を一覧表示させるモジュールです。
ビデオライブラリの運用手順につきましては、別途ドキュメントが有ります。
[ビデオライブラリドキュメント](https://docs.google.com/document/d/1Mv310DNpZQIXYQrS9QYY9q_uzCUZxF9K6jtkQOx7ouc/edit?usp=sharing)
## インストール手順
1. 管理画面ログイン
2. エクステンション配下の管理を選択
3. (フォルダからインストール)を選択
4. フォームにインストールするモジュールまたは、コンポーネントのフォルダを指定(例:/var/www/html/src/com/com_hoge)
5. チェックしてインストール
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_CATEGORY_CUSTOM="Articles - Category"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_DESC="Select how you would like the articles to be grouped."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_LABEL="Article Grouping"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_DESC="Select the direction you would like the Article Groupings to be ordered by."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_LABEL="Grouping Direction"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_DESC="Select which field you would like Articles to be ordered by. Featured Ordering should only be used when Filtering Option for Featured Articles is set to 'Only'."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_LABEL="Article Field to Order By"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_DESC="Select the direction you would like Articles to be ordered by."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_LABEL="Ordering Direction"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_DESC="Select one or more authors from the list below."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_LABEL="Authors"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_DESC="Select one or more author aliases from the list below."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_LABEL="Author Aliases"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_DESC="Select Inclusive to Include the Selected Author Aliases, Exclusive to Exclude the Selected Author Aliases."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_LABEL="Author Alias Filtering Type"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_DESC="Select Inclusive to Include the Selected Authors, Exclusive to Exclude the Selected Authors."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_LABEL="Author Filtering Type"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_DESC="The number of child category levels to return."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_LABEL="Category Depth"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATEGORY_DESC="Please select one or more categories."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_DESC="Select Inclusive to Include the Selected Categories, Exclusive to Exclude the Selected Categories."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_LABEL="Category Filtering Type"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_DESC="The number of items to display. The default value of 0 will display all articles."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_LABEL="Count"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_DESC="Select which date field you want the date range to be applied to."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_LABEL="Date Range Field"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_DESC="Select which date field you want to display."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_LABEL="Date Field"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_DESC="Please enter in a valid date format. See: https://php.net/date for formatting information."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_LABEL="Date Format"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_DESC="Select Date Filtering Type."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_LABEL="Date Filtering"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEGROUPINGFIELD_DESC="Select which date field you want the date grouping to be applied to."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEGROUPINGFIELD_LABEL="Date Grouping Field"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_DESC="Please enter an End Date."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_LABEL="To Date"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_DESC="Please enter each Article ID on a new line."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_LABEL="Article IDs to Exclude"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DISPLAY_LABEL="Display Options"
; The following string is deprecated and will be removed with 4.0
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DYNAMIC_LABEL="Dynamic Mode Options"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_FILTERING_LABEL="Filtering Options"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_GROUPING_LABEL="Grouping Options"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_ORDERING_LABEL="Ordering Options"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_DESC="Please enter in a numeric character limit value. The introtext will be trimmed to the number of characters you enter."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_LABEL="Introtext Limit"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_LABEL="Linked Titles"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_DESC="Linked titles."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_DESC="Please select the mode you would like to use. If Normal Mode is chosen, then configure the module and it will display a static list of Articles on the menu items you assign the module to. If Dynamic Mode is chosen, then you can still configure the module normally, however now the Category option will no longer be used. Instead, the module will dynamically detect if you are on a Category view and will display the list of articles within that Category. When Dynamic Mode is chosen, it is best to leave the module set to display on all pages, as it will decide to display anything dynamically."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_LABEL="Mode"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_DESC="Please enter in a valid date format. See: https://php.net/date for formatting information."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_LABEL="Month and Year Display Format"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_DESC="Please enter a numeric value. Results will be retrieved relative to the current date and the value you enter."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_LABEL="Relative Date"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWAUTHOR_DESC="Select Show if you would like the author (or author alias instead, if available) to be displayed."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCATEGORY_DESC="Select Show if you would like the category name displayed."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_DESC="Include or Exclude Articles from Child Categories."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL="Child Category Articles"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWDATE_DESC="Select Show if you would like the date displayed."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_DESC="Select to Show, Hide, or Only display Featured Articles."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_LABEL="Featured Articles"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_DESC="Select Show if you would like the hits for each article to be displayed."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_LABEL="Hits"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_DESC="Select Show if you would like the introtext to be displayed."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_LABEL="Introtext"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_DESC="Select to Show or hide Article List from Article Pages. This means that the module will only display itself dynamically on Category Pages."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_LABEL="Show on Article Page"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWTAGS_DESC="Show the tags for each article."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_DESC="Please enter a Starting Date."
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_LABEL="Start Date Range"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ASCENDING_VALUE="Ascending"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_CREATED_VALUE="Created Date"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DATERANGE_VALUE="Date Range"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DESCENDING_VALUE="Descending"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DYNAMIC_VALUE="Dynamic"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUDE_VALUE="Exclude"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUSIVE_VALUE="Exclusive"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_HITS_VALUE="Hits"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ID_VALUE="ID"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUDE_VALUE="Include"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUSIVE_VALUE="Inclusive"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MODIFIED_VALUE="Modified Date"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MONTHYEAR_VALUE="Month and Year"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_NORMAL_VALUE="Normal"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_OFF_VALUE="Off"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ONLYFEATURED_VALUE="Only"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERING_VALUE="Article Order"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERINGFEATURED_VALUE="Featured Articles Order"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RANDOM_VALUE="Random"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RATING_VALUE="Rating"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RELATIVEDAY_VALUE="Relative Date"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_STARTPUBLISHING_VALUE="Start Publishing Date"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_FINISHPUBLISHING_VALUE="Finish Publishing Date"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_VOTE_VALUE="Vote"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_YEAR_VALUE="Year"
MOD_ARTICLES_CATEGORY_CUSTOM_READ_MORE="Read more: "
MOD_ARTICLES_CATEGORY_CUSTOM_READ_MORE_TITLE="Read More ..."
MOD_ARTICLES_CATEGORY_CUSTOM_REGISTER_TO_READ_MORE="Register to read more"
MOD_ARTICLES_CATEGORY_CUSTOM_UNTAGGED="Untagged"
MOD_ARTICLES_CATEGORY_CUSTOM_XML_DESCRIPTION="This module displays a list of articles from one or more categories."
; Joomla! Project
; Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_CATEGORY_CUSTOM="Articles - Category"
MOD_ARTICLES_CATEGORY_CUSTOM_XML_DESCRIPTION="This module displays a list of articles from one or more categories."
MOD_ARTICLES_CATEGORY_CUSTOM_LAYOUT_DEFAULT="Default"
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category_custom
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\String\StringHelper;
$com_path = JPATH_SITE . '/components/com_content/';
JLoader::register('ContentHelperRoute', $com_path . 'helpers/route.php');
JModelLegacy::addIncludePath($com_path . 'models', 'ContentModel');
/**
* Helper for mod_articles_categorymod_articles_categoryのヘルパー
*
* @since 1.6
*/
abstract class ModArticlesCategoryCustomHelper
{
/**
* Get a list of articles from a specific category特定のカテゴリから記事のリストを取得します
*
* @param \Joomla\Registry\Registry &$params object holding the models parametersモデルパラメータを保持するオブジェクト
*
* @return mixed
*
* @since 1.6
*/
public static function getList(&$params)
{
// Get an instance of the generic articles model一般的な記事モデルのインスタンスを取得します
$articles = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); // ContentModelArticles Object
// Set application parameters in modelモデルにアプリケーションパラメータを設定する
$app = JFactory::getApplication();
$appParams = $app->getParams();
$articles->setState('params', $appParams);
$articles->setState('list.start', 0);
$articles->setState('filter.published', 1);
// Set the filters based on the module paramsモジュールパラメータに基づいてフィルタを設定します
$articles->setState('list.limit', (int) $params->get('count', 0));
$articles->setState('load_tags', $params->get('show_tags', 0) || $params->get('article_grouping', 'none') === 'tags');
// Access filterアクセスフィルター
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$articles->setState('filter.access', $access);
// Prep for Normal or Dynamic Modes通常モードまたは動的モードの準備
$mode = $params->get('mode', 'normal');
switch ($mode)
{
case 'dynamic' :
$option = $app->input->get('option');
$view = $app->input->get('view');
if ($option === 'com_content')
{
switch ($view)
{
case 'category' :
case 'categories' :
$catids = array($app->input->getInt('id'));
break;
case 'article' :
if ($params->get('show_on_article_page', 1))
{
$article_id = $app->input->getInt('id');
$catid = $app->input->getInt('catid');
if (!$catid)
{
// Get an instance of the generic article model一般的な記事モデルのインスタンスを取得します
$article = JModelLegacy::getInstance('Article', 'ContentModel', array('ignore_request' => true));
$article->setState('params', $appParams);
$article->setState('filter.published', 1);
$article->setState('article.id', (int) $article_id);
$item = $article->getItem();
$catids = array($item->catid);
}
else
{
$catids = array($catid);
}
}
else
{
// Return right away if show_on_article_page option is offshow_on_article_pageオプションがオフの場合は、すぐに戻ります
return;
}
break;
case 'featured' :
default:
// Return right away if not on the category or article viewsカテゴリまたは記事のビューにない場合は、すぐに戻ります
return;
}
}
else
{
// Return right away if not on a com_content pagecom_contentページにない場合は、すぐに戻ります
return;
}
break;
case 'normal' :
default:
$catids = $params->get('catid');
$articles->setState('filter.category_id.include', (bool) $params->get('category_filtering_type', 1));
break;
}
// Category filter
if ($catids)
{
if ($params->get('show_child_category_articles', 0) && (int) $params->get('levels', 0) > 0)
{
// Get an instance of the generic categories modelジェネリックカテゴリモデルのインスタンスを取得します
$categories = JModelLegacy::getInstance('Categories', 'ContentModel', array('ignore_request' => true));
$categories->setState('params', $appParams);
$levels = $params->get('levels', 1) ?: 9999;
$categories->setState('filter.get_children', $levels);
$categories->setState('filter.published', 1);
$categories->setState('filter.access', $access);
$additional_catids = array();
foreach ($catids as $catid)
{
$categories->setState('filter.parentId', $catid);
$recursive = true;
$items = $categories->getItems($recursive);
if ($items)
{
foreach ($items as $category)
{
$condition = (($category->level - $categories->getParent()->level) <= $levels);
if ($condition)
{
$additional_catids[] = $category->id;
}
}
}
}
$catids = array_unique(array_merge($catids, $additional_catids));
}
$articles->setState('filter.category_id', $catids);
}
// Ordering
$ordering = $params->get('article_ordering', 'a.ordering');
switch ($ordering)
{
case 'random':
$articles->setState('list.ordering', JFactory::getDbo()->getQuery(true)->Rand());
break;
case 'rating_count':
case 'rating':
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
if (!JPluginHelper::isEnabled('content', 'vote'))
{
$articles->setState('list.ordering', 'a.ordering');
}
break;
default:
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction', $params->get('article_ordering_direction', 'ASC'));
break;
}
// Filter by multiple tags
$articles->setState('filter.tag', $params->get('filter_tag', array()));
$articles->setState('filter.featured', $params->get('show_front', 'show'));
$articles->setState('filter.author_id', $params->get('created_by', array()));
$articles->setState('filter.author_id.include', $params->get('author_filtering_type', 1));
$articles->setState('filter.author_alias', $params->get('created_by_alias', array()));
$articles->setState('filter.author_alias.include', $params->get('author_alias_filtering_type', 1));
$excluded_articles = $params->get('excluded_articles', '');
if ($excluded_articles)
{
$excluded_articles = explode("\r\n", $excluded_articles);
$articles->setState('filter.article_id', $excluded_articles);
// Exclude
$articles->setState('filter.article_id.include', false);
}
$date_filtering = $params->get('date_filtering', 'off');
if ($date_filtering !== 'off')
{
$articles->setState('filter.date_filtering', $date_filtering);
$articles->setState('filter.date_field', $params->get('date_field', 'a.created'));
$articles->setState('filter.start_date_range', $params->get('start_date_range', '1000-01-01 00:00:00'));
$articles->setState('filter.end_date_range', $params->get('end_date_range', '9999-12-31 23:59:59'));
$articles->setState('filter.relative_date', $params->get('relative_date', 30));
}
// Filter by language
$articles->setState('filter.language', $app->getLanguageFilter());
$items = $articles->getItems();
// Display options
$show_date = $params->get('show_date', 0);
$show_date_field = $params->get('show_date_field', 'created');
$show_date_format = $params->get('show_date_format', 'Y-m-d H:i:s');
$show_category = $params->get('show_category', 0);
$show_hits = $params->get('show_hits', 0);
$show_author = $params->get('show_author', 0);
$show_introtext = $params->get('show_introtext', 0);
$introtext_limit = $params->get('introtext_limit', 100);
// Find current Article ID if on an article page記事ページにある場合は、現在の記事IDを検索します
$option = $app->input->get('option');
$view = $app->input->get('view');
if ($option === 'com_content' && $view === 'article')
{
$active_article_id = $app->input->getInt('id');
}
else
{
$active_article_id = 0;
}
// Prepare data for display using display options表示オプションを使用して表示するデータを準備する
foreach ($items as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead.Catslugは非推奨です。代わりにcatidを使用してください 4.0 */
$item->catslug = $item->catid . ':' . $item->category_alias;
if ($access || in_array($item->access, $authorised))
{
// We know that user has the privilege to view the articleユーザーには記事を表示する権限があることがわかっています
$item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
}
else
{
$menu = $app->getMenu();
$menuitems = $menu->getItems('link', 'index.php?option=com_users&view=login');
if (isset($menuitems[0]))
{
$Itemid = $menuitems[0]->id;
}
elseif ($app->input->getInt('Itemid') > 0)
{
// Use Itemid from requesting page only if there is no existing menu既存のメニューがない場合にのみ、要求ページからItemidを使用します
$Itemid = $app->input->getInt('Itemid');
}
$item->link = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $Itemid);
}
// Used for styling the active articleアクティブな記事のスタイリングに使用されます
$item->active = $item->id == $active_article_id ? 'active' : '';
$item->displayDate = '';
if ($show_date)
{
$item->displayDate = JHtml::_('date', $item->$show_date_field, $show_date_format);
}
if ($item->catid)
{
$item->displayCategoryLink = JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
$item->displayCategoryTitle = $show_category ? '<a href="' . $item->displayCategoryLink . '">' . $item->category_title . '</a>' : '';
}
else
{
$item->displayCategoryTitle = $show_category ? $item->category_title : '';
}
$item->displayHits = $show_hits ? $item->hits : '';
$item->displayAuthorName = $show_author ? $item->author : '';
if ($show_introtext)
{
$item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'mod_articles_category_custom.content');
$item->introtext = self::_cleanIntrotext($item->introtext);
}
$item->displayIntrotext = $show_introtext ? self::truncate($item->introtext, $introtext_limit) : '';
$item->displayReadmore = $item->alternative_readmore;
}
return $items;
}
/**
* Strips unnecessary tags from the introtextイントロテキストから不要なタグを削除します
*
* @param string $introtext introtext to sanitize
*
* @return mixed|string
*
* @since 1.6
*/
public static function _cleanIntrotext($introtext)
{
$introtext = str_replace(array('<p>','</p>'), ' ', $introtext);
$introtext = strip_tags($introtext, '<h5><div><iframe><a><em><strong>');
$introtext = trim($introtext);
return $introtext;
}
/**
* Method to truncate introtext
*
* The goal is to get the proper length plain text string with as much of
* the html intact as possible with all tags properly closed.
*
* @param string $html The content of the introtext to be truncated
* @param integer $maxLength The maximum number of charactes to render
*
* @return string The truncated string
*
* @since 1.6
*/
public static function truncate($html, $maxLength = 0)
{
$baseLength = strlen($html);
// First get the plain text string. This is the rendered text we want to end up with.
$ptString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = false);
for ($maxLength; $maxLength < $baseLength;)
{
// Now get the string if we allow html.
$htmlString = JHtml::_('string.truncate', $html, $maxLength, $noSplit = true, $allowHtml = true);
// Now get the plain text from the html string.
$htmlStringToPtString = JHtml::_('string.truncate', $htmlString, $maxLength, $noSplit = true, $allowHtml = false);
// If the new plain text string matches the original plain text string we are done.
if ($ptString === $htmlStringToPtString)
{
return $htmlString;
}
// Get the number of html tag characters in the first $maxlength characters
$diffLength = strlen($ptString) - strlen($htmlStringToPtString);
// Set new $maxlength that adjusts for the html tags
$maxLength += $diffLength;
if ($baseLength <= $maxLength || $diffLength <= 0)
{
return $htmlString;
}
}
return $html;
}
/**
* Groups items by field
*
* @param array $list list of items
* @param string $fieldName name of field that is used for grouping
* @param string $article_grouping_direction ordering direction
* @param null $fieldNameToKeep field name to keep
*
* @return array
*
* @since 1.6
*/
public static function groupBy($list, $fieldName, $article_grouping_direction, $fieldNameToKeep = null)
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
if (!isset($grouped[$item->$fieldName]))
{
$grouped[$item->$fieldName] = array();
}
if ($fieldNameToKeep === null)
{
$grouped[$item->$fieldName][$key] = $item;
}
else
{
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
}
unset($list[$key]);
}
$article_grouping_direction($grouped);
return $grouped;
}
/**
* Groups items by date
*
* @param array $list list of items
* @param string $type type of grouping
* @param string $article_grouping_direction ordering direction
* @param string $month_year_format date format to use
* @param string $field date field to group by
*
* @return array
*
* @since 1.6
*/
public static function groupByDate($list, $type = 'year', $article_grouping_direction = 'ksort', $month_year_format = 'F Y', $field = 'created')
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
switch ($type)
{
case 'month_year' :
$month_year = StringHelper::substr($item->$field, 0, 7);
if (!isset($grouped[$month_year]))
{
$grouped[$month_year] = array();
}
$grouped[$month_year][$key] = $item;
break;
case 'year' :
default:
$year = StringHelper::substr($item->$field, 0, 4);
if (!isset($grouped[$year]))
{
$grouped[$year] = array();
}
$grouped[$year][$key] = $item;
break;
}
unset($list[$key]);
}
$article_grouping_direction($grouped);
if ($type === 'month_year')
{
foreach ($grouped as $group => $items)
{
$date = new JDate($group);
$formatted_group = $date->format($month_year_format);
$grouped[$formatted_group] = $items;
unset($grouped[$group]);
}
}
return $grouped;
}
/**
* Groups items by tags
*
* @param array $list list of items
* @param string $direction ordering direction
*
* @return array
*
* @since 3.9.0
*/
public static function groupByTags($list, $direction = 'ksort')
{
$grouped = array();
$untagged = array();
if (!$list)
{
return $grouped;
}
foreach ($list as $item)
{
if ($item->tags->itemTags)
{
foreach ($item->tags->itemTags as $tag)
{
$grouped[$tag->title][] = $item;
}
}
else
{
$untagged[] = $item;
}
}
$direction($grouped);
if ($untagged)
{
$grouped['MOD_ARTICLES_CATEGORY_CUSTOM_UNTAGGED'] = $untagged;
}
return $grouped;
}
}
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_CATEGORY_CUSTOM="ビデオライブラリ - カテゴリ"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_DESC="どのように記事を分類したいかを選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_LABEL="記事の分類"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_DESC="記事の分類の順序の方向を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_LABEL="分類の方向"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_DESC="記事の順序に使用する欄を選択します。注目の記事の並び替えは、注目の記事のフィルタリングオプションが「のみ」の時のみに使用されます。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_LABEL="並べる記事欄"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_DESC="記事の順序の方向を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_LABEL="順序の方向"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_DESC="下の一覧から1つあるいは複数の投稿者を選択します"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_LABEL="投稿者"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_DESC="下の一覧から1つあるいは複数の投稿者エイリアスを選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_LABEL="投稿者のエイリアス"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_DESC="選択された投稿者エイリアスを含めるには包括的を選択し、含めない場合は排他的を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_LABEL="投稿者エイリアスフィルタの種類"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_DESC="選択された投稿者を含めるには包括的を選択し、含めない場合は排他的を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_LABEL="投稿者フィルタの種類"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_DESC="辿る子カテゴリの階層の数です。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_LABEL="カテゴリの深さ"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATEGORY_DESC="1つまたは複数のカテゴリを選択してください。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_DESC="選択されたカテゴリを含めるには包括的を選択し、含めない場合は排他的を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_LABEL="カテゴリフィルタの種類"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_DESC="表示する項目数です。標準値0ですべての記事を表示します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_LABEL="表示数"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_DESC="どの日付欄を日付範囲に適用するかを選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_LABEL="日付範囲の項目"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_DESC="表示したい日付欄を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_LABEL="日付の欄"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_DESC="有効な日付形式で入力してください。フォーマットに付いての情報は次を参照: http://php.net/date"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_LABEL="日付フォーマット"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_DESC="日付フィルタの種類を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_LABEL="日付フィルタ"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_DESC="上で日付範囲を選択した場合、終了日を入力してください。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_LABEL="〜日まで"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_DESC="各記事IDを新しい行に入力してください。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_LABEL="除外する記事ID"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DISPLAY_LABEL="表示オプション"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DYNAMIC_LABEL="ダイナミックモードオプション"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_FILTERING_LABEL="フィルタオプション"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_GROUPING_LABEL="グループ分けオプション"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_ORDERING_LABEL="順序オプション"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_DESC="数値で文字数制限の値を入力してください。イントロテキストはあなたが入力した文字数にトリミングされます。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_LABEL="イントロテキスト制限"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_LABEL="リンクのタイトル"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_DESC="リンクのタイトルです。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_DESC="あなたが使用したいモードを選択してください。ノーマルモードが選択されている場合、モジュールを構成し、モジュールに割り当てたメニューアイテムの静的な記事一覧を表示します。ダイナミックモードが選択されている場合、ここでも通常モジュールを構成することができますが、もうカテゴリオプションは使用されなくなります。代わりに、モジュールはあなたがカテゴリ表示中であるかを動的に検出し、それに応じてそのカテゴリ内の記事一覧を表示します。ダイナミックモードがを選択した場合、何を表示するかを動的に決めるために、全てのページでモジュールを表示する設定のままにしておくことをおすすめします。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_LABEL="モード"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_DESC="有効な日付形式で入力してください。フォーマットに付いての情報は次を参照: http://php.net/date "
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_LABEL="月と年の表示形式"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_DESC="上で相対日付を選択した場合、数値で日の値を入力してください。結果は現在の日付とあなたが入力した値を基準に取得されます。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_LABEL="相対日付"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWAUTHOR_DESC="投稿者(または 利用可能であれば代わりに投稿者エイリアス)を表示したい場合は 表示 を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCATEGORY_DESC="カテゴリ名を表示したい場合は 表示 を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_DESC="子カテゴリから記事を含めるまたは除外します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL="子カテゴリの記事"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWDATE_DESC="日付を表示したい場合は 表示 を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_DESC="表示、非表示または注目の記事のみ表示を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_LABEL="注目の記事"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_DESC="各記事が表示された回数を表示したい場合は 表示 を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_LABEL="参照数"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_DESC="イントロテキストを表示したい場合は 表示 を選択します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_LABEL="イントロテキスト"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_DESC="記事のページから記事一覧の表示/非表示を選択します。これはモジュールがカテゴリのページに動的にそれ自身をただ表示することを意味します。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_LABEL="記事のページに表示する"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_DESC="上で日付範囲を選択した場合は開始日を入力してください。"
MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_LABEL="開始日付範囲"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ASCENDING_VALUE="昇順"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_CREATED_VALUE="作成日"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DATERANGE_VALUE="日付範囲"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DESCENDING_VALUE="降順"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DYNAMIC_VALUE="ダイナミック"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUDE_VALUE="含めない"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUSIVE_VALUE="排他的"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_HITS_VALUE="参照"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ID_VALUE="ID"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUDE_VALUE="含める"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUSIVE_VALUE="包括的"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MODIFIED_VALUE="更新日"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MONTHYEAR_VALUE="月と年"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_NORMAL_VALUE="ノーマル"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_OFF_VALUE="オフ"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ONLYFEATURED_VALUE="のみ"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERING_VALUE="記事の順序"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERINGFEATURED_VALUE="注目記事の並び替え"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RANDOM_VALUE="ランダム"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RATING_VALUE="評価"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RELATIVEDAY_VALUE="相対日付"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_STARTPUBLISHING_VALUE="公開開始日"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_FINISHPUBLISHING_VALUE="公開終了日"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_VOTE_VALUE="投票"
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_YEAR_VALUE="年"
MOD_ARTICLES_CATEGORY_CUSTOM_READ_MORE="続きを読む: "
MOD_ARTICLES_CATEGORY_CUSTOM_READ_MORE_TITLE="続きを読む..."
MOD_ARTICLES_CATEGORY_CUSTOM_REGISTER_TO_READ_MORE="続きを読むには登録してください"
MOD_ARTICLES_CATEGORY_CUSTOM_XML_DESCRIPTION="1つまたは複数のカテゴリから記事一覧を表示します。"
\ No newline at end of file
; Joomla! Project
; Copyright (C) 2005 - 2017 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8
MOD_ARTICLES_CATEGORY_CUSTOM="ビデオライブラリ - カテゴリ"
MOD_ARTICLES_CATEGORY_CUSTOM_XML_DESCRIPTION="1つまたは複数のカテゴリから記事一覧を表示します。(ビデオライブラリ専用のモジュールです)"
MOD_ARTICLES_CATEGORY_CUSTOM_LAYOUT_DEFAULT="標準"
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category_custom
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the helper functions only once
JLoader::register('ModArticlesCategoryCustomHelper', __DIR__ . '/helper.php');
$input = JFactory::getApplication()->input;
// Prep for Normal or Dynamic Modes
$mode = $params->get('mode', 'normal');
$idbase = null;
switch ($mode)
{
case 'dynamic' :
$option = $input->get('option');
$view = $input->get('view');
if ($option === 'com_content')
{
switch ($view)
{
case 'category' :
$idbase = $input->getInt('id');
break;
case 'categories' :
$idbase = $input->getInt('id');
break;
case 'article' :
if ($params->get('show_on_article_page', 1))
{
$idbase = $input->getInt('catid');
}
break;
}
}
break;
case 'normal' :
default:
$idbase = $params->get('catid');
break;
}
$cacheid = md5(serialize(array ($idbase, $module->module, $module->id)));
$cacheparams = new stdClass;
$cacheparams->cachemode = 'id';
$cacheparams->class = 'ModArticlesCategoryCustomHelper';
$cacheparams->method = 'getList';
$cacheparams->methodparams = $params;
$cacheparams->modeparams = $cacheid;
$list = JModuleHelper::moduleCache($module, $params, $cacheparams);
if (!empty($list))
{
$grouped = false;
$article_grouping = $params->get('article_grouping', 'none');
$article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');
$item_heading = $params->get('item_heading');
if ($article_grouping !== 'none')
{
$grouped = true;
switch ($article_grouping)
{
case 'year' :
case 'month_year' :
$list = ModArticlesCategoryCustomHelper::groupByDate(
$list,
$article_grouping,
$article_grouping_direction,
$params->get('month_year_format', 'F Y'),
$params->get('date_grouping_field', 'created')
);
break;
case 'author' :
case 'category_title' :
$list = ModArticlesCategoryCustomHelper::groupBy($list, $article_grouping, $article_grouping_direction);
break;
case 'tags' :
$list = ModArticlesCategoryCustomHelper::groupByTags($list, $article_grouping_direction);
break;
default:
break;
}
}
require JModuleHelper::getLayoutPath('mod_articles_category_custom', $params->get('layout', 'default'));
}
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1" client="site" method="upgrade">
<name>mod_articles_category_custom</name>
<author>Joomla! Project</author>
<creationDate>February 2010</creationDate>
<copyright>Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>MOD_ARTICLES_CATEGORY_CUSTOM_XML_DESCRIPTION</description>
<files>
<filename module="mod_articles_category_custom">mod_articles_category_custom.php</filename>
<folder>tmpl</folder>
<filename>helper.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.mod_articles_category_custom.ini</language>
<language tag="en-GB">en-GB.mod_articles_category_custom.sys.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_category_custom.ini</language>
<language tag="ja-JP">ja-JP.mod_articles_category_custom.sys.ini</language>
</languages>
<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ARTICLES_CATEGORY" />
<config>
<fields name="params">
<fieldset name="basic">
<field
name="mode"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MODE_DESC"
default="normal"
>
<option value="normal">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_NORMAL_VALUE</option>
<option value="dynamic">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DYNAMIC_VALUE</option>
</field>
</fieldset>
<fieldset
name="dynamic"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DYNAMIC_LABEL"
>
<field
name="show_on_article_page"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWONARTICLEPAGE_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
</fieldset>
<fieldset
name="filtering"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_FILTERING_LABEL"
>
<field
name="count"
type="number"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_COUNT_DESC"
default="0"
/>
<field
name="show_front"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWFEATURED_DESC"
default="show"
>
<option value="show">JSHOW</option>
<option value="hide">JHIDE</option>
<option value="only">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ONLYFEATURED_VALUE</option>
</field>
<field
name="filteringspacer0"
type="spacer"
hr="true"
/>
<field
name="category_filtering_type"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATFILTERINGTYPE_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUSIVE_VALUE</option>
<option value="0">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUSIVE_VALUE</option>
</field>
<field
name="catid"
type="category"
label="JCATEGORY"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATEGORY_DESC"
extension="com_content"
multiple="true"
size="5"
>
<option value="">JOPTION_ALL_CATEGORIES</option>
</field>
<field
name="show_child_category_articles"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCHILDCATEGORYARTICLES_DESC"
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUDE_VALUE</option>
<option value="0">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUDE_VALUE</option>
</field>
<field
name="levels"
type="number"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_CATDEPTH_DESC"
default="1"
/>
<field
name="filteringspacer1"
type="spacer"
hr="true"
/>
<field
name="filter_tag"
type="tag"
label="JTAG"
description="JTAG_FIELD_SELECT_DESC"
>
<option value="">JNONE</option>
</field>
<field
name="filteringspacer2"
type="spacer"
hr="true"
/>
<field
name="author_filtering_type"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORFILTERING_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUSIVE_VALUE</option>
<option value="0">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUSIVE_VALUE</option>
</field>
<field
name="created_by"
type="sql"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHOR_DESC"
multiple="true"
size="5"
query="select id, name, username from #__users where id IN (select distinct(created_by) from #__content) order by name ASC"
key_field="id"
value_field="name"
>
<option value="">JOPTION_SELECT_AUTHORS</option>
</field>
<field
name="filteringspacer3"
type="spacer"
hr="true"
/>
<field
name="author_alias_filtering_type"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIASFILTERING_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_INCLUSIVE_VALUE</option>
<option value="0">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_EXCLUSIVE_VALUE</option>
</field>
<field
name="created_by_alias"
type="sql"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_AUTHORALIAS_DESC"
multiple="true"
size="5"
query="select distinct(created_by_alias) from #__content where created_by_alias != '' order by created_by_alias ASC"
key_field="created_by_alias"
value_field="created_by_alias"
>
<option value="">JOPTION_SELECT_AUTHOR_ALIASES</option>
</field>
<field
name="filteringspacer4"
type="spacer"
hr="true"
/>
<field
name="excluded_articles"
type="textarea"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_EXCLUDEDARTICLES_DESC"
cols="10"
rows="3"
/>
<field
name="filteringspacer5"
type="spacer"
hr="true"
/>
<field
name="date_filtering"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFILTERING_DESC"
default="off"
>
<option value="off">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_OFF_VALUE</option>
<option value="range">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DATERANGE_VALUE</option>
<option value="relative">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RELATIVEDAY_VALUE</option>
</field>
<field
name="date_field"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATERANGEFIELD_DESC"
default="a.created"
>
<option value="a.created">
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_CREATED_VALUE
</option>
<option value="a.modified">
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MODIFIED_VALUE
</option>
<option value="a.publish_up">
MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_STARTPUBLISHING_VALUE
</option>
</field>
<field
name="start_date_range"
type="calendar"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_STARTDATE_DESC"
translateformat="true"
showtime="true"
size="22"
filter="user_utc"
/>
<field
name="end_date_range"
type="calendar"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ENDDATE_DESC"
translateformat="true"
showtime="true"
size="22"
filter="user_utc"
/>
<field
name="relative_date"
type="number"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_RELATIVEDATE_DESC"
default="30"
/>
</fieldset>
<fieldset
name="ordering"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_ORDERING_LABEL"
>
<field
name="article_ordering"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERING_DESC"
default="modified"
>
<option value="a.ordering">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERING_VALUE</option>
<option value="fp.ordering">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ORDERINGFEATURED_VALUE</option>
<option value="a.hits">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_HITS_VALUE</option>
<option value="a.title">JGLOBAL_TITLE</option>
<option value="a.id">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ID_VALUE</option>
<option value="a.alias">JFIELD_ALIAS_LABEL</option>
<option value="a.created">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_CREATED_VALUE</option>
<option value="modified">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MODIFIED_VALUE</option>
<option value="publish_up">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_STARTPUBLISHING_VALUE</option>
<option value="a.publish_down">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_FINISHPUBLISHING_VALUE</option>
<option value="random">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RANDOM_VALUE</option>
<option value="rating_count" requires="vote">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_VOTE_VALUE</option>
<option value="rating" requires="vote">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_RATING_VALUE</option>
</field>
<field
name="article_ordering_direction"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEORDERINGDIR_DESC"
default="ASC"
>
<option value="DESC">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DESCENDING_VALUE</option>
<option value="ASC">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ASCENDING_VALUE</option>
</field>
</fieldset>
<fieldset
name="grouping"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_GROUPING_LABEL"
>
<field
name="article_grouping"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPING_DESC"
default="none"
>
<option value="none">JNONE</option>
<option value="year">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_YEAR_VALUE</option>
<option value="month_year">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MONTHYEAR_VALUE</option>
<option value="author">JAUTHOR</option>
<option value="category_title">JCATEGORY</option>
</field>
<field
name="article_grouping_direction"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_ARTICLEGROUPINGDIR_DESC"
default="ksort"
>
<option value="krsort">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_DESCENDING_VALUE</option>
<option value="ksort">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_ASCENDING_VALUE</option>
</field>
<field
name="month_year_format"
type="text"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_MONTHYEARFORMAT_DESC"
default="F Y"
/>
</fieldset>
<fieldset
name="display"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_GROUP_DISPLAY_LABEL"
>
<field
name="link_titles"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_LINKTITLES_DESC"
default="1"
class="btn-group btn-group-yesno"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="show_date"
type="radio"
label="JDATE"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWDATE_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_date_field"
type="list"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELD_DESC"
default="created"
>
<option value="created">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_CREATED_VALUE</option>
<option value="modified">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_MODIFIED_VALUE</option>
<option value="publish_up">MOD_ARTICLES_CATEGORY_CUSTOM_OPTION_STARTPUBLISHING_VALUE</option>
</field>
<field
name="show_date_format"
type="text"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_DATEFIELDFORMAT_DESC"
default="Y-m-d H:i:s"
/>
<field
name="show_category"
type="radio"
label="JCATEGORY"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWCATEGORY_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_hits"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWHITS_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_author"
type="radio"
label="JAUTHOR"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWAUTHOR_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_introtext"
type="radio"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_SHOWINTROTEXT_DESC"
default="1"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="introtext_limit"
type="number"
label="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_LABEL"
description="MOD_ARTICLES_CATEGORY_CUSTOM_FIELD_INTROTEXTLIMIT_DESC"
default="1000"
/>
<field
name="show_readmore"
type="radio"
label="JGLOBAL_SHOW_READMORE_LABEL"
description="JGLOBAL_SHOW_READMORE_DESC"
default="0"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="show_readmore_title"
type="radio"
label="JGLOBAL_SHOW_READMORE_TITLE_LABEL"
description="JGLOBAL_SHOW_READMORE_TITLE_DESC"
default="1"
class="btn-group btn-group-yesno"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
</field>
<field
name="readmore_limit"
type="number"
label="JGLOBAL_SHOW_READMORE_LIMIT_LABEL"
description="JGLOBAL_SHOW_READMORE_LIMIT_DESC"
default="0"
/>
</fieldset>
<fieldset name="advanced">
<field
name="layout"
type="modulelayout"
label="JFIELD_ALT_LAYOUT_LABEL"
description="JFIELD_ALT_MODULE_LAYOUT_DESC"
/>
<field
name="moduleclass_sfx"
type="textarea"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC"
rows="3"
/>
<field
name="owncache"
type="list"
label="COM_MODULES_FIELD_CACHING_LABEL"
description="COM_MODULES_FIELD_CACHING_DESC"
default="1"
>
<option value="1">JGLOBAL_USE_GLOBAL</option>
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
</field>
<field
name="cache_time"
type="number"
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
description="COM_MODULES_FIELD_CACHE_TIME_DESC"
default="900"
/>
</fieldset>
</fields>
</config>
</extension>
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category_custom
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$catid = JRequest::getInt('catid');
?>
<!-- 記事カテゴリーの表示 -->
<h3><?php echo $list[0]->category_title; ?></h3>
<ul class="category-module-custom videos-custom-item-wrapper <?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
<p class="mod-articles-category-introtext">
<?php echo $item->displayIntrotext; ?>
</p>
</li>
<?php endforeach; ?>
</ul>
......@@ -3582,81 +3582,93 @@ body.itemid-132 table {
/* -------------------------------------------------------------------------
 ビデオライブラリページ
------------------------------------------------------------------------- */
.videos-custom h5 {
padding-left: 0;
font-size: 1.125rem;
background: none;
#content .blog.videos-custom h3 {
margin-bottom: 0px;
margin-top: 10px;
}
.videos-custom-item-wrapper {
.blog.videos-custom .videos-custom-item-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
justify-content: space-between;
margin: 0 0 16px;
}
.videos-custom-item-wrapper:before {
.blog.videos-custom .videos-custom-item-wrapper:before {
content: "";
display: block;
min-width: 190px;
width: 30%;
width: calc(33% - 8px);
height: 0px;
order: 1;
}
.videos-custom-item-wrapper:after {
.blog.videos-custom .videos-custom-item-wrapper:after {
content: "";
display: block;
min-width: 190px;
width: 30%;
width: calc(33% - 8px);
height: 0px;
}
.videos-custom-item {
.blog.videos-custom .videos-custom-item-wrapper > li {
list-style: none;
min-width: 190px;
width: 30%;
width: calc(33% - 8px);
margin-bottom: 16px;
font-size: 1rem;
text-align: justify;
}
.videos-custom-item-title {
.blog.videos-custom .videos-custom-item-wrapper > li > h5 {
padding-left: 0;
font-size: 1.125rem;
}
.videos-custom-item-explanation {
font-size: 1rem;
background: none;
margin-top: 15px;
margin-bottom: 5px;
}
/* ビデオライブラリページ レスポンシブ*/
@media (max-width: 900px) {
.videos-custom-item {
width: 45%;
.blog.videos-custom-item-wrapper:before {
width: calc(50% - 8px);
}
.videos-custom-item-wrapper:before {
width: 45%;
.blog.videos-custom-item-wrapper:after {
width: calc(50% - 8px);
}
.videos-custom-item-wrapper:after {
width: 45%;
.blog.videos-custom .videos-custom-item-wrapper > li {
width: calc(50% - 8px);
}
}
@media (max-width: 550px) {
.videos-custom-item-wrapper {
#content .blog.videos-custom h3 {
margin-bottom: 10px;
margin-top: 0px;
margin-bottom: 0px;
margin-top: 10px;
}
.blog.videos-custom-item-wrapper {
display: block;
}
.videos-custom-item {
.blog.videos-custom .videos-custom-item-wrapper > li {
height: auto;
width: 100%;
padding-bottom: 8px;
border-bottom: #003894 4px solid;
margin-bottom: 24px;
padding-bottom: 2px;
border-bottom: #003894 2px solid;
margin-bottom: 10px;
font-size: 0.875rem;
}
.videos-custom-item-title {
.blog.videos-custom .videos-custom-item-wrapper > li > h5 {
font-size: 1rem;
}
.videos-custom-item-explanation {
font-size: 0.875rem;
.blog.videos-custom .videos-custom-item-wrapper > li > p {
margin-bottom: 0;
}
}
......@@ -3762,6 +3774,11 @@ body.itemid-132 table {
background-color: #fff;
}
.item-page.photos-custom > div p:hover {
cursor: pointer;
}
.item-page.photos-custom > div p img {
display: block;
/* 親要素の真ん中に表示 */
......@@ -3792,28 +3809,37 @@ body.itemid-132 table {
}
.item-page.photos-custom #photo-popup {
display: block;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 220;
width: 90%;
height: 90%;
max-width: 1260px;
max-height: 90%;
overflow: auto;
}
.item-page.photos-custom #photo-popup.Vertical {
width: 60%;
.item-page.photos-custom #photo-popup.vertical {
display: flex;
align-items: center;
justify-content: center;
}
.item-page.photos-custom #photo-popup.horizontal {
width: 90%;
overflow: auto;
}
.item-page.photos-custom #photo-popup #photo-popup-img {
transition: opacity 0.5s;
}
.item-page.photos-custom #photo-popup.vertical #photo-popup-img {
max-height: 100%;
}
.item-page.photos-custom #photo-popup.horizontal #photo-popup-img {
width: 100%;
transition: all 0.5s;
}
.item-page.photos-custom #photo-popup-under {
......
......@@ -23,29 +23,12 @@ jQuery(function($) {
for (let i = 0; i < $imgWrppers.length; i++) {
// 子要素が空の場合削除(自動生成されたp要素は子要素が入っていない)
if ($imgWrppers[i]['children'].length === 0) {
$('.item-page.photos-custom > div p').eq(i).remove();
$imgWrppers[i].remove();
}
}
});
/**
* 画面サイズが4:3より縦長の場合は、写真を画面幅いっぱいに表示する。
*/
function setPopup() {
const winW = $(window).innerWidth();
const winH = $(window).innerHeight();
// 画面表示領域のアスペクト比を取得
const asp = winH / winW;
if (asp < 0.75) {
$('#photo-popup').removeClass('horizontal');
$('#photo-popup').addClass('Vertical');
} else {
$('#photo-popup').removeClass('Vertical');
$('#photo-popup').addClass('horizontal');
}
}
/**
* 画像のクリックをトリガーにして、ポップアップで表示する画像URLの取得と、
* popupの制御を行う関数の実行。
*/
......@@ -60,19 +43,14 @@ jQuery(function($) {
const $img = $('#photo-popup-img');
// popupに画像URLをセット
$img.attr('src', src);
setPopup();
$(window).resize(function () {
setPopup();
});
// 画像URLのセットから時間をあけることで、表示がなめらかになる。
setTimeout(function () {
// popupの表示
$('#photo-popup-wrapper').fadeIn();
// popupのみスクロール可とする。
$('body').css('overflow','hidden');
addClassToImage($img);
}, 50);
setTimeout(function () {
popupScrollSet($img);
}, 100);
});
/**
......@@ -97,11 +75,12 @@ jQuery(function($) {
src = $('.item-page.photos-custom > div p').eq(index).children('img').attr('src');
}
setTimeout(function () {
// transitionで透明になりきった時点で画像の差し替えを実行
// transitionで透明になりきるまでまって画像の差し替えを実行
$img.attr('src', src);
}, 400);
setTimeout(function () {
popupScrollSet($img);
// 画像URLのセットからすこし待つことで関数で正しい数値を取得できる。
addClassToImage($img);
}, 500);
setTimeout(function () {
$('#photo-popup').css('display','');
......@@ -126,7 +105,7 @@ jQuery(function($) {
$img.attr('src', src);
}, 400);
setTimeout(function () {
popupScrollSet($img);
addClassToImage($img);
}, 500);
setTimeout(function () {
$('#photo-popup').css('display','');
......@@ -146,18 +125,19 @@ jQuery(function($) {
}
/**
* 画像が縦長の場合、ポップアップ表示の際にスクロール値を画像の縦中央にセットする。
* 表示する画像のアスペクト比に応じたクラスを付与する。
* @param {*} $img ポップアップに表示している画像
*/
function popupScrollSet($img) {
function addClassToImage($img) {
const imgHeight = $img[0].naturalHeight; // 画像の本来の高さ
const imgWidth = $img[0].naturalWidth; // 画像の本来の幅
if (imgHeight > imgWidth) {
const wrapperWidth = $('#photo-popup').width(); // 画像の包括要素の幅
const scaleW = wrapperWidth / imgWidth; // 画像の横幅の縮尺比率
const scrollTop = imgHeight * scaleW * 0.25; // スクロール位置(画像の縮尺後の高さ×25%)
$('#photo-popup').scrollTop(scrollTop);
console.log('test');
const asp = imgHeight / imgWidth;
if (asp < 1) {
$('#photo-popup').removeClass('horizontal');
$('#photo-popup').addClass('vertical');
} else {
$('#photo-popup').removeClass('vertical');
$('#photo-popup').addClass('horizontal');
}
}
});
\ No newline at end of file
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!