You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
3.6 KiB
PHP
75 lines
3.6 KiB
PHP
<ol style="padding-left: 15px;padding-top:15px;">
|
|
<?php
|
|
if (!empty($search_list)) {
|
|
foreach ($search_list as $key => $list) {
|
|
?>
|
|
<?php if ((!isset($search_type) && !in_array($list->ic_id, explode(',', $ic_id_list))) || isset($search_type)) { ?>
|
|
<li style="line-height:30px;">
|
|
<a target="_blank" href="<?php echo $this->config->item('site_url') . $list->ic_url; ?>"><?php echo $list->ic_url_title; ?><?php if (isset($search_type) && $search_type == 'recommended') echo '[已选择]'; ?></a>
|
|
<?php if (isset($search_type) && $search_type == 'recommended') { ?>
|
|
<span class="pull-right text-danger" style="cursor: pointer;" data-icid="<?php echo $list->ic_id; ?>" onclick="javascript:del_recommend(this,<?php echo $list->ic_id; ?>);">移除</span>
|
|
<?php } else { ?>
|
|
<span class="pull-right" style="cursor: pointer;" data-icid="<?php echo $list->ic_id; ?>" onclick="javascript:add_recommend_list(this,<?php echo $list->ic_id; ?>);">添加</span>
|
|
<?php } ?>
|
|
</li>
|
|
<?php } ?>
|
|
<?php }
|
|
} ?>
|
|
</ol>
|
|
<script type="text/javascript">
|
|
|
|
resize_recommend_list(10);
|
|
|
|
var popoverID = $(".recommend_info_popover").prev('input').attr('id');
|
|
|
|
function del_recommend(that, ic_id) {
|
|
var list = $('#' + popoverID).val().split(',');
|
|
var new_list = '';
|
|
for (var i = 0; i < list.length; i++) {
|
|
if (ic_id != list[i] && list[i] != '') {
|
|
new_list += list[i] + ',';
|
|
}
|
|
;
|
|
}
|
|
;
|
|
$('#' + popoverID).val(new_list);
|
|
|
|
var $a = $(that).prev('a');
|
|
var href = $a.attr('href');
|
|
var ic_url_title = $a.text().replace('[已选择]', '');
|
|
var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '</a><span class="pull-right" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:add_recommend_list(this,' + ic_id + ');">添加</span></li>';
|
|
if ($("#recommend_list>ol").length == 0) {
|
|
$("#recommend_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>');
|
|
}
|
|
;
|
|
$("#recommend_list>ol").prepend(html);
|
|
setTimeout(resize_recommend_list(9), 0);
|
|
$(that).parent('li').remove();
|
|
}
|
|
|
|
function add_recommend_list(that, ic_id) {
|
|
var stringflag = $('#' + popoverID).val() == '' ? '' : ',';
|
|
var icid = $('#' + popoverID).val() + stringflag + ic_id;
|
|
icid = icid.replace(',,', ',');
|
|
$('#' + popoverID).val(icid);
|
|
var $a = $(that).prev('a');
|
|
var href = $a.attr('href');
|
|
var ic_url_title = $a.text();
|
|
var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '[已选择]</a><span class="pull-right text-danger" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:del_recommend(this,' + ic_id + ');">移除</span></li>';
|
|
if ($("#recommended_list>ol").length == 0) {
|
|
$("#recommended_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>');
|
|
}
|
|
;
|
|
$("#recommended_list>ol").append(html);
|
|
setTimeout(resize_recommend_list(10), 0);
|
|
$(that).parent('li').remove();
|
|
}
|
|
|
|
function resize_recommend_list(count) {
|
|
if ($("#recommend_list>ol>li").length > count) {
|
|
$("#recommend_list").css({"margin-right": "-16px"});
|
|
} else {
|
|
$("#recommend_list").css({"margin-right": "0px"});
|
|
}
|
|
}
|
|
</script>
|