<?php
for ($i = 0; $i < 4; $i++) {
    $items[$i] = json_decode(file_get_contents("data/item" . $i . ".json"));
}
?>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="keywords" content="破解软件,绿色软件,汉化软件,注册机,KEY">
<meta name="description" content="软件云集是追风逐雨博客作者自用软件的一个软件下载集合,只为自身使用方便,无盈利,无恶意,如有侵权,请发送邮件到:shileiye@qq.com.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>软件云集 - 追风逐雨</title>

<!-- Set render engine for 360 browser -->
<meta name="renderer" content="webkit">

<!-- No Baidu Siteapp-->
<meta http-equiv="Cache-Control" content="no-siteapp"/>

<link rel="icon" type="image/png" href="assets/i/favicon.png">

<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">

<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="软件云集"/>
<link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">

<!-- Tile icon for Win8 (144x144 + tile color) -->
<meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
<meta name="msapplication-TileColor" content="#0e90d2">

<!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
<!--
<link rel="canonical" href="http://www.example.com/">
-->

<link rel="stylesheet" href="assets/css/amazeui.min.css">
<link rel="stylesheet" href="assets/css/app.css">
<link rel="stylesheet" href="assets/css/amazeui.datatables.min.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a
  href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<!-- 页面内容开始-->
<header data-am-widget="header" class="am-header am-header-default" data-am-sticky>
	<div class="am-header-left am-header-nav">
		<a href="#left-link" class="" data-am-offcanvas="{target: '#left-link', effect: 'push'}"><i class="am-header-icon am-icon-bars"></i></a>
	</div>
	<h1 class="am-header-title" data-am-smooth-scroll="{position: 0}">
		<a href="#title-link" class="">软件云集</a>
	</h1>
	<div class="am-header-right am-header-nav">
		<a href="/" class=""><i class="am-header-icon am-icon-home"></i></a>
	</div>
</header>

<div id="left-link" class="am-offcanvas">
	<div class="am-offcanvas-bar">
	<div class="am-offcanvas-content">
		<p>
		软件云集是追风逐雨博客作者自用软件的一个软件下载集合,只为自身使用方便,无盈利,无恶意.<br/>
		如有侵权,请发送邮件到:shileiye@qq.com.<br/>
		</p>
	</div>
	</div>
</div>

<div data-am-widget="tabs" class="am-tabs am-tabs-default">
	<ul class="am-tabs-nav am-cf">
	<?php for ($i = 0; $i < count($items); $i++) { ?>
	<li class="<?php if ($i == 0) echo 'am-active'; ?>"><a href="[data-tab-panel-<?php echo $i ?>]"><?php echo $items[$i]->title; ?></a></li>
	<?php } ?>
	</ul>
	<div class="am-tabs-bd">
	<?php for ($i = 0; $i < count($items); $i++) { ?>
		<div data-tab-panel-<?php echo $i ?> class="am-tab-panel <?php if ($i == 0) echo 'am-active'; ?>">
			<table width="100%" class="am-table am-table-striped am-table-bordered am-table-compact am-text-nowrap" id="<?php echo $items[$i]->title; ?>">
				<thead>
					<tr>
					<th><span>软件名称</span></th>
					<th><span>日期</span></th>
					<th><span>分类</span></th>
					<th><span>简介</span></th>
					<th>下载</th>
					</tr>
				</thead>
				<tbody>
				<?php foreach ($items[$i]->data as $key) { ?>
					<tr>
						<td><span class="fonts"><?php echo $key->name; ?></span></td>
						<td class="center"><?php echo $key->times; ?></td>
						<td class="center"><span class="am-badge am-badge-primary am-round am-text-sm"><?php echo $key->type; ?><span</td>
						<td><span class="fontsbody"><?php echo $key->body; ?></span></td>
						<td class="center">
							<?php if (isset($key->url->baidu) && $key->url->baidu != '') { ?>
							<a href="<?php echo $key->url->baidu; ?>" class="am-btn am-btn-success am-radius am-btn-xs" target="_blank"><i class="am-icon-cloud-download"></i> 百度网盘</a> 
							<?php } ?>
							<?php if (isset($key->url->s360) && $key->url->s360 != '') { ?>
							<a href="<?php echo $key->url->s360; ?>" class="am-btn am-btn-success am-radius am-btn-xs" target="_blank"><i class="am-icon-cloud-download"></i> 360网盘</a> 
							<?php } ?>
							<?php if (isset($key->url->local) && $key->url->local != '') { ?>
							<a href="<?php echo $key->url->local; ?>" class="am-btn am-btn-warning am-radius am-btn-xs" target="_blank"><i class="am-icon-download"></i> 本地下载</a>
							<?php } ?>
						</td>
					</tr>
				<?php } ?>
				</tbody>
			</table>
		</div>
	<?php } ?>
	</div>
</div>
<!-- 页面内容结束-->

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/amazeui.datatables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<script>
//支持中文排序
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
	"chinese-string-asc": function (s1, s2) {
	return s1.localeCompare(s2);
	},
	"chinese-string-desc": function (s1, s2) {
	return s2.localeCompare(s1);
	}
});

//表格样式
var table = $('<?php for ($i = 0; $i < count($items); $i++) echo ($i == 0) ? '#' . $items[$i]->title : ', #' . $items[$i]->title; ?>').DataTable({
	responsive: true, //忘了
	paging: false, //不显示分页
	dom: 't', //显示元件
	searching: true, //本地搜索
	order: [[1, 'desc'], [0, 'asc']], //按时间和名称排序
	columnDefs: [
	{type: 'chinese-string', targets: [0, 2]}, //第二列中文排序
	{targets: [3, 4], orderable: false}, //034禁用排序
	{targets: [4], bSearchable: false}	//4禁用检索
	],
	//列筛选
	initComplete: function(){
		var api = this.api();
		api.columns().indexes().flatten().each(function(i) {
			if (i != 0 && i != 3 && i != 4) {	//034不添加筛选
				var column = api.column(i);
				//var $span = $('<span class="addselect">▾</span>').appendTo($(column.header()))
				var wenzi = column.header().firstChild.innerHTML;
				var select = $('<select><option value="">全部' + wenzi + '</option></select>')
					.appendTo($(column.header()))
					.on('change click', function (evt) {
						evt.stopPropagation();
						var val = $.fn.dataTable.util.escapeRegex($(this).val());
						column.search(val, true, false).draw(); //列搜索
					});
				column.data().unique().sort().each(function(d, j) {
					function delHtmlTag(str) {
					return str.replace(/<[^>]+>/g, "");//去掉html标签
					}
					d = delHtmlTag(d)
					select.append('<option value="' + d + '">' + d + '</option>')
					//$span.append(select)
				});
			}
			if (i == 0 || i == 3) {	//添加搜索框
			var column = api.column(i);
			var wenzi = column.header().firstChild.innerHTML;
			var search = $('<input type="text" class="am-form-field am-radius dsearch" placeholder="' + wenzi + '"/>').appendTo($(column.header()))
				.on('input click', function (evt) {
					evt.stopPropagation();
					var val = $.fn.dataTable.util.escapeRegex($(this).val());
					//column.search(val ? '^' + val + '$' : '', true, false).draw();
					column.search(val, true, false).draw();
				});
			//column.header().append(search);
			}
		});
	}
});

/*
//自定义搜索
$('.dsearch').on('keyup click', function () {
var tsval = $(".dsearch").val()
table.search(tsval, false, false).draw();
});
 */
 
//标签切换
$(function () {
	$('#download-tabs').tabs({noSwipe: 0});
})
</script>
</body>
</html>