<?php
	require("../__common__/__define_mobile.php");
	require("__define.php");
	$login_id = mobile_login_check();
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<?php
	mobile_common_head('myHome RSS');
?>
<style>
ul.rss_item {
	margin: 0 0 0 18px;
	padding: 0;
	line-height: 2.4ex;
	list-style: none;
}
ul.rss_item li {
	margin: 1px 0 1px 0;
}
span.rss_time {
	font-size: 90%;
}
span.rss_description {
	font-size: 80%;
}
</style>
<style>
h2#title{
	margin:0;
}
#divRss {
	margin:0;
}
.ItemTitle{
	font-weight:bold;
	margin:5px 0px 0px 0px;
	padding-top:3px;
}
.ItemTitle a{ color:#4EBAFF; text-decoration:none }
.ItemTitle a:hover{ text-decoration:underline }
.ItemContent{
	padding:1px 3px 3px 3px;
	border-bottom:1px solid #D3CAD7;
	color:#3E3E3E;
	display: <?= $_COOKIE['rss_feed_showdesc'] ?>;
}
.ItemDate{
	font-size:11px;
	color:#AAA;
}
}
</style>
<script src="../js/ok2nd.js"></script>
<script src="FeedEk/FeedEk-ok2nd.js"></script>
</head>
<body>
<div data-role="page" data-url="<?= $_SERVER['REQUEST_URI'] ?>" id="top">
	<div data-role="header">
		<a href="list.php?cat=<?= $_GET['cat'] ?>&id=<?= $_GET['id'] ?>" data-icon="back" rel="external">RSS一覧</a>
		<h1>RSS</h1>
		<a href="../index" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
	</div>
	<div data-role="content">
	<?php
		rss($login_id, $login_id);
	?>
	</div>
	<div data-role="footer">
		<h1>ok.2nd</h1>
	</div>
</div>
</body>
</html>
<?php
function rss($login_id, $user_id) {
	$con = my_mysql_connect(_DB_SCHEMA);
	$sql = "select * from m_rss where c_delete = 0 and id_account = '" . $login_id . "'";
	$sql .= " and id_rss = " . intval($_GET['id']);
	if ($login_id != $user_id) {
		$sql .= " and c_privacy = 0";
	}
	$rs = my_mysql_query($sql);
	if ($rec = mysql_fetch_array($rs)) {
		rss_view($rec);
	}
}
function rss_view($rec, $cntmax=100) {
	if ($rec['c_rss_url'].'' == '') return;
?>
<h2 id="title"><a href="<?= $rec['c_home_url'] ?>" target="_blank"><?= $rec['c_title'] ?></a></h2>
<?php
	if ($_COOKIE['rss_feed_showdesc'].'' != 'none') {
		$checked = ' checked';
	}
?>
<span id="chk-desc"><label>本文表示:<input id="chkDesc" type="checkbox"<?= $checked ?> onclick="javascript:bodyView(this);"></label></span>
<div id="divRss"></div>
<script>
$(document).ready(function () {
	$('#divRss').FeedEk({
		FeedUrl: '<?= $rec['c_rss_url'] ?>',
		MaxCount: <?= RSS_FEEDEK_FEED_MAXCOUNT ?>,
		ShowDesc: true,
		ShowPubDate: true
	});
});
function bodyView(me) {
	if (me.checked) {
		display = 'block';
	} else {
		display = 'none';
	}
	$('.ItemContent').css('display',display);
	$.cookie('rss_feed_showdesc', display, { path: '<?= MY_SESSION_PATH ?>', expires: 365 });
}
</script>
<?php
}
?>
