$(document).ready(function() {
$('#shimanotane_more').bind('click', function() { getList($(this).attr('data-count')); });
$('.photo').bind('click', function() { showDetail($(this).attr('id')); });
});
function getList(count) {
var fqdn = location.host;
$.ajax({
type: 'GET',
url: 'http://'+fqdn+'/index.php?module=WebAPI&action=MachinotaneDataGet',
data: {
count: count
},
dataType: 'json',
cache: false,
success: function(data) {
// Output data
$.each(data.reports, function(i, d) {
if (d.id) {
$('ul.photos').append('
');
}
});
//$('#shimanotane_more').attr('data-count', data.count);
if (data.count >= 30) {
$('#shimanotane_more_div').remove();
} else {
$('#shimanotane_more').attr('data-count', data.count);
}
$(".photo").bind("click", function(){
showDetail($(this).attr('id'));
});
}
});
}
function showDetail(id) {
var fqdn = location.host;
$.ajax({
type: 'GET',
url: 'http://'+fqdn+'/index.php?module=WebAPI&action=MachinotaneDetailDataGet',
data: {
id: id
},
dataType: 'json',
cache: false,
success: function(d) {
$('').on('click', function() {
layer_hide();
}).appendTo('body').fadeIn();
// Output data
var tags = [];
var btncloss = 'x';
$.each(d.tag, function(key, val) {
tags.push(''+key+'');
});
if ('http://machitane.net/faceimg/' == d.thumb) {
$('').append(
$('', {'html': 'x', 'class': 'btn cross'}),
'',
$('', {'html': d.body}),
$('', {'id': 'post_meta', 'html': d.date+'
'+d.user})
).on('click', function(e){
e.stopPropagation();
}).appendTo('div.layer').fadeIn();
$('#post span:first').addClass('btn cross');
$('span.cross').on('click', function(){
layer_hide();
});
} else {
$('').append(
$('', {'html': 'x', 'class': 'btn cross'}),
'',
$('', {'html': d.body}),
$('', {'id': 'post_thumb', 'src': d.thumb}),
$('', {'id': 'post_meta', 'html': d.date+'
'+d.user})
).on('click', function(e){
e.stopPropagation();
}).appendTo('div.layer').fadeIn();
$('#post span:first').addClass('btn cross');
$('span.cross').on('click', function(){
layer_hide();
});
}
}
});
}
$(document).ready(function() {
var fqdn = location.host;
$('img', '#map').click(function() {
var island = $(this).attr('island');
var id = $(this).attr('id');
var btncloss = 'x';
$.ajax({
type: 'GET',
url: 'http://'+fqdn+'/index.php?module=WebAPI&action=MachinotaneDetailDataGet',
data: {
id: id,
island: island
},
dataType: 'json',
cache: false,
success: function(d) {
$('').on('click', function() {
layer_hide();
}).appendTo('body').fadeIn();
// Output data
var tags = [];
$.each(d.tag, function(key, val) {
tags.push(''+key+'');
});
if ('http://machitane.net/faceimg/' == d.thumb) {
$('').append(
$('', {'html': btncloss}),
'',
$('', {'html': d.body}),
$('', {'id': 'post_meta', 'html': d.date+'
'+d.user})
).on('click', function(e){
e.stopPropagation();
}).appendTo('div.layer').fadeIn();
$('#post span:first').addClass('btn cross');
$('span.cross').on('click', function(){
layer_hide();
});
} else {
$('').append(
$('', {'html': btncloss}),
'',
$('', {'html': d.body}),
$('', {'id': 'post_thumb', 'src': d.thumb}),
$('', {'id': 'post_meta', 'html': d.date+'
'+d.user})
).on('click', function(e){
e.stopPropagation();
}).appendTo('div.layer').fadeIn();
$('#post span:first').addClass('btn cross');
$('span.cross').on('click', function(){
layer_hide();
});
}
}
});
});
});
function layer_esc(e) {
if (e.keyCode == 27) {
layer_hide();
}
}
function layer_hide() {
$('div.layer').fadeOut(function(){
$('div.layer').remove();
});
}
$(document).keydown(layer_esc);
function jumpShimanotane(){
window.open("http://machitane.net/shima/" , "_blank");
}