209 lines
6.4 KiB
JavaScript
209 lines
6.4 KiB
JavaScript
var viewportwidth,
|
|
viewportheight;
|
|
function resize() {
|
|
viewportheight=$(window).height();
|
|
viewportwidth=$(window).width();
|
|
if(window.navigator.userAgent.indexOf("MSIE")>0){
|
|
windH=document.clientHeight;
|
|
windW=document.clientWidht;
|
|
}
|
|
}
|
|
$(document).ready(function(){
|
|
|
|
$('.tip').tooltip({
|
|
placement: "left"
|
|
});
|
|
|
|
$(document).on('click', '.privacy', function() {
|
|
|
|
switch ($(this).val()) {
|
|
case 'true':
|
|
$(this).parents('.controls').children('.select-role').slideUp(300);
|
|
break;
|
|
case 'false':
|
|
$(this).parents('.controls').children('.select-role').slideDown(300);
|
|
break;
|
|
}
|
|
});
|
|
|
|
var $role = $('.select-role');
|
|
var method =$('.privacy:eq(1)').attr('checked');
|
|
if(method == 'checked'){
|
|
$role.slideDown(0);
|
|
}
|
|
$('.privacy').each(function($i) {
|
|
$(this).click(function() {
|
|
switch ($i) {
|
|
case 0:
|
|
$role.slideUp(300);
|
|
break;
|
|
case 1:
|
|
$role.slideDown(300);
|
|
break;
|
|
}
|
|
});
|
|
});
|
|
|
|
/*tinyscrollbar&windows-Size*/
|
|
resize();
|
|
mainResize()
|
|
mainTablePosition();
|
|
itemPosition()
|
|
$('#collapse-menu').on({
|
|
click: function(){
|
|
$('body').toggleClass("folded");
|
|
if($('#collapse-menu > i').attr("class")=="icon-chevron-right"){
|
|
$('#collapse-menu > i').removeClass('icon-chevron-right');
|
|
$('#collapse-menu > i').addClass('icon-chevron-left');
|
|
} else if($('#collapse-menu > i').attr("class")=="icon-chevron-left"){
|
|
$('#collapse-menu > i').removeClass('icon-chevron-left');
|
|
$('#collapse-menu > i').addClass('icon-chevron-right');
|
|
}
|
|
resize();
|
|
mainResize();
|
|
mainTablePosition();
|
|
itemPosition()
|
|
}
|
|
})
|
|
|
|
$('.with_action').on({
|
|
mouseleave: function(){
|
|
$('.quick-edit').find('.dropdown').removeClass("open");
|
|
}
|
|
})
|
|
|
|
$(window).resize(function(){
|
|
resize();
|
|
mainResize();
|
|
mainTablePosition();
|
|
itemPosition()
|
|
});
|
|
|
|
});
|
|
/*main-table position*/
|
|
function mainTablePosition() {
|
|
var $height = $('#main-wrap .subnav').length && $('#main-wrap .subnav').height();
|
|
var $table = $('.main-list').length && $('.main-list:last');
|
|
if($table && $table==0){
|
|
// $table.css({marginTop:$height});
|
|
$table.stop().animate({marginTop:$height}, 500)
|
|
}
|
|
else if($table){
|
|
if($height>0){
|
|
$height = $height-18;
|
|
}
|
|
$table.stop().animate({marginTop:$height}, 500, function(){
|
|
resize();
|
|
mainResize();
|
|
});
|
|
}
|
|
else if($('#main-wrap .subnav')){
|
|
var $object = $('#main-wrap .subnav').next();
|
|
// $object.css({marginTop:$height});
|
|
$object.stop().animate({marginTop:$height}, 500)
|
|
};
|
|
};
|
|
|
|
function moduleNav() {
|
|
var $moduleNav = $('#module-nav'),
|
|
$userDataW = $('.user-data').width();
|
|
$moduleNav.css("width", $userDataW);
|
|
}
|
|
function itemPosition() {
|
|
moduleNav();
|
|
if($('#isotope').length>0 && $('.user-info').length>0){
|
|
if(viewportwidth<=1200){
|
|
if($('body').attr("class")=="folded"){
|
|
$('#isotope').find('.detail').css("width", 550);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}else{
|
|
$('#isotope').find('.detail').css("width", 435);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}
|
|
}else if(viewportwidth>=1201 && viewportwidth<=1280){
|
|
if($('body').attr("class")=="folded"){
|
|
$('#isotope').find('.detail').css("width", 385);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}else{
|
|
$('#isotope').find('.detail').css("width", 325);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}
|
|
}else if(viewportwidth>=1281 && viewportwidth<=1440){
|
|
if($('body').attr("class")=="folded"){
|
|
$('#isotope').find('.detail').css("width", 470);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}else{
|
|
$('#isotope').find('.detail').css("width", 410);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}
|
|
}else if(viewportwidth>=1441){
|
|
if($('#isotope').length>0){
|
|
$('#isotope').find('.detail').css("width", 500);
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}
|
|
}
|
|
}else if($('#isotope').length>0){
|
|
$('#isotope').masonry({
|
|
itemSelector: '.item',
|
|
isAnimated: true
|
|
});
|
|
}
|
|
}
|
|
|
|
function mainResize() {
|
|
var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-2,
|
|
$subWiget = $('#sub-wiget').width()+18;
|
|
$orbitBar = $('#orbit-bar').height(),
|
|
$brand = $('#brand').height(),
|
|
$collapseMenu = $('#collapse-menu').height()+$('#position').height()+1,
|
|
$mainSidebar = $('#main-sidebar').width()+5,
|
|
$formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")),
|
|
$scrollContent = $('#main-sidebar .nav-list').height();
|
|
$('#main-sidebar').css("height", viewportheight-$orbitBar);
|
|
$('#main-sidebar .viewport').css("height", viewportheight-$orbitBar-$collapseMenu);
|
|
$('.user-roles .viewport').css("height", viewportheight-$orbitBar-$brand-30);
|
|
$('#main-sidebar .viewport').css("top", $collapseMenu);
|
|
$('#main-sidebar .scrollbar').css("top", $collapseMenu);
|
|
$('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget);
|
|
$('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-20);
|
|
$('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft);
|
|
$('#main-wrap .table-label').css("width", viewportwidth-$mainWrapMarginLeft);
|
|
$('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding);
|
|
$('.user-info').css("height", viewportheight-$orbitBar-30);
|
|
$('#main-sidebar').tinyscrollbar();
|
|
$('.detal-list').tinyscrollbar();
|
|
$('.user-roles').tinyscrollbar();
|
|
if((viewportheight-$orbitBar-$collapseMenu)>=$scrollContent){
|
|
$('#main-sidebar .overview').css("top", '0px');
|
|
}
|
|
};
|
|
$(window).scroll(function () {
|
|
//var $mainWrapMarginLeft = parseInt($('#main-wrap').css("margin-left"))-1;
|
|
//var $subnavWidth = parseInt($('#main-wrap > .subnav').css("width"));
|
|
var $winLeft = $(window).scrollLeft()
|
|
$(".table-label").css({left:$winLeft*-1} );
|
|
//$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} );
|
|
//$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} );
|
|
});
|