37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
function loadViewPage(url, id) {
|
|
var $listView = $(id);
|
|
|
|
$listView.empty().removeClass('in active');
|
|
$listView.load(url, function(response, status, xhr) {
|
|
$(this).addClass('in active');
|
|
$('#member-card').imagesLoaded(function() {
|
|
$('#member-card .member-avatar img').muImageResize({width: 150, height:150});
|
|
});
|
|
$('#member-abstract').imagesLoaded(function() {
|
|
$('#member-abstract .member-avatar img').muImageResize({width: 250, height:120});
|
|
});
|
|
})
|
|
}
|
|
|
|
$(function() {
|
|
$search = window.location.pathname.substring(1);
|
|
$search = $search.split("/");
|
|
$search = $search[$search.length-1];
|
|
$viewType = window.localStorage.getItem('viewType') || '#member-list';
|
|
$viewSwitchNo = window.localStorage.getItem('viewSwitchNo') || 0;
|
|
if($search == 'users-registrant-list.shtml') {
|
|
loadViewPage('member-registrant-list.html ' + $viewType, '#list-view');
|
|
} else {
|
|
loadViewPage('member-list.html ' + $viewType, '#list-view');
|
|
};
|
|
$('.view-switch').children('.btn').eq($viewSwitchNo).addClass('active');
|
|
$('.view-switch').delegate(".btn", 'click', function(e){
|
|
var url = $(this).attr('href'),
|
|
ID = url.split("#"),
|
|
ID = '#' + ID[ID.length-1];
|
|
window.localStorage.setItem('viewType', ID);
|
|
window.localStorage.setItem('viewSwitchNo', $(this).index());
|
|
loadViewPage(url, '#list-view');
|
|
e.preventDefault();
|
|
});
|
|
}) |