클량 사게 뷰어
by Reiot
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css">
<script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script>
<script src="http://github.com/jamespadolsey/jQuery-Plugins/raw/master/cross-domain-ajax/jquery.xdomainajax.js"></script>
<!-- Start of first page -->
<div data-role="page" id="foo">
<div data-role="header" data-theme="b">
<h1>Clien Image Viewer</h1>
</div><!-- /header -->
<div data-role="content" data-theme="b">
<ul id="images" data-role="listview"></ul>
</div><!-- /content -->
<div data-role="footer" class="ui-bar" data-theme="b">
<a href="#" data-role="button" data-icon="refresh">More</a>
</div><!-- /header -->
</div><!-- /page -->
JavaScript
$(function() {
$.ajax({
url: 'http://clien.career.co.kr/cs2/bbs/board.php?bo_table=image',
type: 'GET',
success: function(res) {
var board_main = $(res.responseText).find('div.board_main form table');
board_main.find('img').each(function() {
var src = $(this).attr('src');
$(this).attr('src', 'http://clien.career.co.kr/cs2/bbs/' + src);
});
board_main.find('tr').each(function() {
var $li = $('<li>');
if ($(this).find('.view_head').length) {
// header tr
var post_title = $(this).find('div.view_title h4 span'),
// text
post_info = $(this).find('p.post_info'),
// span or img
user_info = $(this).find('p.user_info');
$li.attr('data-role', 'list-divider').attr('data-theme','d').append(post_title.text()).append(user_info).append(post_info.text());
$li.appendTo('#images');
} else {
// content tr
var view_content = $(this).find('div.view_content');
$li.append(view_content);
$li.appendTo('#images');
}
});
}
});
});