625 lines
23 KiB
JavaScript
625 lines
23 KiB
JavaScript
|
//Global Variables
|
||
|
$sidebarState = window.localStorage.getItem('sidebarState');
|
||
|
$ua = navigator.userAgent;
|
||
|
$.extend($.support, {
|
||
|
touch: "ontouchend" in document
|
||
|
});
|
||
|
if($.support.touch) {
|
||
|
mouseenterEvent = clickEvent = "touchstart";
|
||
|
} else {
|
||
|
clickEvent = "click";
|
||
|
mouseenterEvent = "mouseenter";
|
||
|
};
|
||
|
|
||
|
|
||
|
!function ($) {
|
||
|
// Set sidebarState
|
||
|
sidebarState = function (v) {
|
||
|
if(v) {
|
||
|
window.localStorage.setItem('sidebarState', 1);
|
||
|
} else {
|
||
|
window.localStorage.removeItem('sidebarState');
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Focus first element
|
||
|
$.fn.focusFirstField = function(){
|
||
|
$this = this;
|
||
|
$this.find(":text:visible:enabled").filter(function(){
|
||
|
return $(this).parents(":hidden").size() == 0;
|
||
|
}).slice(0,1).focus();
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
|
||
|
//Checked Toggle
|
||
|
$.fn.togglebox = function () {
|
||
|
var $checked = this;
|
||
|
$checked.each(function() {
|
||
|
if(!$(this).closest('div').hasClass('togglebox')) {
|
||
|
$(this).wrap('<div class="toggle-control"/>');
|
||
|
if($(this).attr('type') == "hidden" && $(this).attr('value') == 'true') {
|
||
|
$(this).wrap('<div class="togglebox disable" />');
|
||
|
} else {
|
||
|
$(this).wrap('<div class="togglebox" />');
|
||
|
}
|
||
|
$('<label><b></b></label>').insertAfter($(this));
|
||
|
if($(this).data().deploy) {
|
||
|
switch($(this).data().deploy) {
|
||
|
case "left":
|
||
|
$(this).closest('.toggle-control').css('float','left');
|
||
|
break;
|
||
|
case "right":
|
||
|
$(this).closest('.toggle-control').css('float','right');
|
||
|
break;
|
||
|
case "inline":
|
||
|
$(this).closest('.toggle-control').css('display','inline-block');
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if($(this).data().title) {
|
||
|
$(this).closest('.toggle-control').append('<p>'+$(this).data().title+'</p>');
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
$checked.each(function(i) {
|
||
|
if($(this).attr('type') == "checkbox") {
|
||
|
if($(this).data().disabled) {
|
||
|
console.log("d")
|
||
|
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||
|
if($(this).prop('checked')) {
|
||
|
$(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
|
||
|
};
|
||
|
} else {
|
||
|
if($(this).prop('checked')) {
|
||
|
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||
|
};
|
||
|
}
|
||
|
$(this).on({
|
||
|
change: function() {
|
||
|
$(this).parent('.togglebox').toggleClass('disable');
|
||
|
$(this).closest('tr').toggleClass('disable');
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
if($(this).attr('type') == "radio") {
|
||
|
if(!$(this).prop('checked')) {
|
||
|
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
|
||
|
$(this).closest('tr').addClass('disable');
|
||
|
};
|
||
|
$(this).on({
|
||
|
change: function() {
|
||
|
$checked.not($(".toggle-check[type='checkbox']")).each(function(i) {
|
||
|
if(!$(this).parent('.togglebox').hasClass('disable')) {
|
||
|
$(this).parent('.togglebox').toggleClass('disable');
|
||
|
$(this).closest('tr').toggleClass('disable');
|
||
|
};
|
||
|
});
|
||
|
$(this).parent('.togglebox').toggleClass('disable')
|
||
|
$(this).closest('tr').toggleClass('disable');
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
if($('#sitemap').length) {
|
||
|
$(this).on({
|
||
|
change: function() {
|
||
|
$(this).closest('li').toggleClass('disabled');
|
||
|
if($(this).prop('checked')) {
|
||
|
$(this).attr('checked', 'checked');
|
||
|
$(this).parents('h6')
|
||
|
.siblings('ul')
|
||
|
.find('li')
|
||
|
.addClass('disabled')
|
||
|
.find('h6 .togglebox')
|
||
|
.addClass('disable')
|
||
|
.find('input[type="checkbox"]')
|
||
|
.prop('checked', true)
|
||
|
.attr('checked', 'checked');
|
||
|
} else {
|
||
|
$(this).removeAttr('checked');
|
||
|
$(this).parents('h6')
|
||
|
.siblings('ul')
|
||
|
.find('li')
|
||
|
.removeClass('disabled')
|
||
|
.find('h6 .togglebox')
|
||
|
.removeClass('disable')
|
||
|
.find('input[type="checkbox"]')
|
||
|
.prop('checked', false)
|
||
|
.removeAttr('checked');
|
||
|
};
|
||
|
// $('.toggle-check').each(function(i) {
|
||
|
// var len = $(this).closest('ul').children('li').length,
|
||
|
// checLen = $(this).closest('ul').children('li').find('input[checked]').length,
|
||
|
// checLen = checLen - $(this).closest('ul').children('li').find('ul').find('input[checked]').length;
|
||
|
// if(len == checLen) {
|
||
|
// $(this).closest('ul')
|
||
|
// .parent('li')
|
||
|
// .addClass('disabled')
|
||
|
// .children('h6')
|
||
|
// .find('.togglebox')
|
||
|
// .addClass('disable')
|
||
|
// .find('input[type="checkbox"]')
|
||
|
// .prop('checked', true)
|
||
|
// .attr('checked', 'checked');
|
||
|
// } else {
|
||
|
// $(this).closest('ul')
|
||
|
// .parent('li')
|
||
|
// .removeClass('disabled')
|
||
|
// .children('h6')
|
||
|
// .find('.togglebox')
|
||
|
// .removeClass('disable')
|
||
|
// .find('input[type="checkbox"]')
|
||
|
// .prop('checked', false)
|
||
|
// .removeAttr('checked');
|
||
|
// };
|
||
|
// });
|
||
|
},
|
||
|
});
|
||
|
};
|
||
|
});
|
||
|
};
|
||
|
|
||
|
|
||
|
// Search Clear
|
||
|
$.fn.searchClear = function (param){
|
||
|
_defaultSettings = {
|
||
|
inputName: ':input',
|
||
|
inputIcon: 'inputIcon',
|
||
|
clearBtnIcon: 'clearBtnIcon',
|
||
|
liveFilter: false,
|
||
|
};
|
||
|
_set = $.extend(_defaultSettings, param);
|
||
|
$this = this;
|
||
|
$input = this.find(_set.inputName);
|
||
|
$tmp = '<i class="'+_set.inputIcon+'"></i><i class="'+_set.clearBtnIcon+' search-clear"></i>';
|
||
|
$input.wrap('<div class="sc-field" />');
|
||
|
$this.find('.sc-field').prepend($tmp);
|
||
|
$searchClear = $this.find(".search-clear");
|
||
|
function run(e) {
|
||
|
$searchClear.hide();
|
||
|
$($input).each(function() {
|
||
|
if($(this).val().length > 0) {
|
||
|
$(this).prev($searchClear).show();
|
||
|
}else {
|
||
|
$(this).prev($searchClear).hide();
|
||
|
}
|
||
|
$(this).on("blur keyup", function(){
|
||
|
if($(this).val().length > 0) {
|
||
|
$(this).prev($searchClear).show();
|
||
|
}else {
|
||
|
$(this).prev($searchClear).hide();
|
||
|
}
|
||
|
});
|
||
|
if(_set.liveFilter) {
|
||
|
$(this).prevAll($searchClear).on({
|
||
|
click: function(){
|
||
|
$(this).hide();
|
||
|
$(this).next($input).val("");
|
||
|
$('.checkbox-card .mark').removeClass('mark')
|
||
|
},
|
||
|
});
|
||
|
} else {
|
||
|
$(this).prevAll($searchClear).on({
|
||
|
click: function(){
|
||
|
$(this).hide();
|
||
|
$(this).next($input).val("");
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// Checking IE10
|
||
|
// if Windows 8 and IE is ture. remove search clear buttom and fix text input padding-right
|
||
|
if(/Windows NT 6.2/g.test(navigator.userAgent)){
|
||
|
if(/MSIE/g.test(navigator.userAgent)){
|
||
|
$searchClear.remove();
|
||
|
$input.css({
|
||
|
'padding-right': '5px',
|
||
|
});
|
||
|
}else{run()}
|
||
|
}else{run()}
|
||
|
}
|
||
|
|
||
|
|
||
|
// Fixed Nav
|
||
|
fixedNav = function () {
|
||
|
if($('.fixed-nav').length){
|
||
|
var $fixedNav = $('.fixed-nav');
|
||
|
if($sidebarState){
|
||
|
$fixedNav.addClass('open');
|
||
|
}
|
||
|
$fixedNav.on(clickEvent, function() {
|
||
|
if($sidebarState) {
|
||
|
window.localStorage.removeItem('sidebarState');
|
||
|
$fixedNav.removeClass('open');
|
||
|
}else{
|
||
|
window.localStorage.setItem('sidebarState', 1);
|
||
|
$fixedNav.addClass('open');
|
||
|
}
|
||
|
$sidebarState = window.localStorage.getItem('sidebarState')
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
|
||
|
// Sidebar
|
||
|
sidebarNav = function () {
|
||
|
var $sidebar = $('#sidebar'),
|
||
|
$sidebarMenu = $('#sidebar-menu'),
|
||
|
$scroller = $('.scroller'),
|
||
|
$sidebarNav = $('.sidebar-nav'),
|
||
|
$el = $('.sidebar-nav').children('li'),
|
||
|
$elIndex = null,
|
||
|
$blockList = $('.sub-nav-block-list'),
|
||
|
$block = $('.sub-nav-block'),
|
||
|
$blockIndex = 0,
|
||
|
$arrow = $('.sub-nav-arrow'),
|
||
|
$wrap = $('#main-wrap'),
|
||
|
$wrapLeft = $wrap.css('margin-left'),
|
||
|
$position = $arrow.outerHeight(true)*-1,
|
||
|
$arrowHeightFormat = $arrow.outerHeight(true)/2;
|
||
|
if($('#sidebar').length>0) {
|
||
|
$wrap.css({'margin-left': 61});
|
||
|
$wrapLeft = 61;
|
||
|
}
|
||
|
if($el.hasClass('active')) {
|
||
|
// Menu defaults active
|
||
|
$elIndex = $el.filter('.active').index();
|
||
|
if($sidebarState && !$sidebarNav.hasClass('no-sub-nav')) {
|
||
|
$block.eq($elIndex).addClass('show');
|
||
|
$blockList.css({'width': 180});
|
||
|
$wrap.css({
|
||
|
'margin-left': 241,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
// Arrow defaults position
|
||
|
$position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
|
||
|
$arrow.css({
|
||
|
'top': $position,
|
||
|
});
|
||
|
}
|
||
|
if($.support.touch && !$sidebarNav.hasClass('no-sub-nav')) {
|
||
|
$el.find('a').removeAttr('href');
|
||
|
};
|
||
|
$el.on(mouseenterEvent, function(e) {
|
||
|
$block.siblings().removeClass('show').eq($(this).index()).addClass('show');
|
||
|
$arrow.stop(true, false).animate({
|
||
|
top: ($(this).position().top+$(this).height()/2)-$arrowHeightFormat+$('.scroller').position().top,
|
||
|
},{
|
||
|
duration: 500,
|
||
|
easing: 'easeInOutBack',
|
||
|
});
|
||
|
if(!$sidebarState || !$el.hasClass('active')) {
|
||
|
$blockList.css({'width': 180});
|
||
|
if($('#pageslide').length) {
|
||
|
if($('#pageslide').is(":hidden")) {
|
||
|
$wrap.css({
|
||
|
'margin-left': $blockList.width()+$sidebarNav.width(),
|
||
|
});
|
||
|
}
|
||
|
}else{
|
||
|
$wrap.css({
|
||
|
'margin-left': $blockList.width()+$sidebarNav.width(),
|
||
|
});
|
||
|
}
|
||
|
// if($('.topnav').length) {
|
||
|
// $('.topnav').css({
|
||
|
// 'left': $blockList.width()+$sidebarNav.width()+20,
|
||
|
// });
|
||
|
// }
|
||
|
if($('.bottomnav').length) {
|
||
|
$('.bottomnav').css({
|
||
|
'left': $blockList.width()+$sidebarNav.width()+20,
|
||
|
});
|
||
|
}
|
||
|
$sidebar.css({
|
||
|
'width': $blockList.width()+$sidebarNav.width(),
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
if ($sidebarNav.hasClass('no-sub-nav')) {
|
||
|
$sidebar.on('mouseleave', function() {
|
||
|
$arrow.stop(true, false).animate({
|
||
|
'top': $position,
|
||
|
},{
|
||
|
duration: 500,
|
||
|
easing: 'easeInOutBack',
|
||
|
});
|
||
|
})
|
||
|
};
|
||
|
// $el.on('mouseleave', function() {
|
||
|
// $el.hasClass('active') ? $position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
|
||
|
// $(this).hasClass('active') ? '':$(this).children('span').removeClass('hover');
|
||
|
// });
|
||
|
$block.on({
|
||
|
mouseenter: function() {
|
||
|
$blockIndex = $block.filter('.sub-nav-block show').index();
|
||
|
$el.eq($blockIndex).hasClass('active') ? '':$el.eq($blockIndex).children('span').addClass('hover');
|
||
|
},
|
||
|
mouseleave: function() {
|
||
|
$block.removeClass('show');
|
||
|
if(!$sidebarState || !$el.hasClass('active')) {
|
||
|
$blockList.css({'width': 0});
|
||
|
if($('#pageslide').length) {
|
||
|
if($('#pageslide').is(":hidden")) {
|
||
|
$wrap.css({
|
||
|
'margin-left': $wrapLeft,
|
||
|
});
|
||
|
// if($('.topnav').length) {
|
||
|
// if($sidebarState) {
|
||
|
// $('.topnav').css({
|
||
|
// 'left': 261,
|
||
|
// });
|
||
|
// }
|
||
|
// }
|
||
|
}
|
||
|
} else {
|
||
|
$wrap.css({
|
||
|
'margin-left': $blockList.width()+$sidebarNav.width(),
|
||
|
});
|
||
|
}
|
||
|
// if($('.topnav').length) {
|
||
|
// $('.topnav').css({
|
||
|
// 'left': $blockList.width()+$sidebarNav.width()+20,
|
||
|
// });
|
||
|
// }
|
||
|
if($('.bottomnav').length) {
|
||
|
$('.bottomnav').css({
|
||
|
'left': $blockList.width()+$sidebarNav.width()+20,
|
||
|
});
|
||
|
}
|
||
|
$sidebar.css({'width': 61});
|
||
|
}else{
|
||
|
$block.eq($elIndex).addClass('show');
|
||
|
};
|
||
|
|
||
|
|
||
|
if($elIndex === null) {
|
||
|
$position = $arrow.outerHeight(true)*-1;
|
||
|
} else {
|
||
|
$position = $el.eq($elIndex).position().top+$el.eq($elIndex).height()/2-$arrowHeightFormat+$('.scroller').position().top;
|
||
|
}
|
||
|
$arrow.stop(true, false).animate({
|
||
|
top: $position,
|
||
|
},{
|
||
|
duration: 500,
|
||
|
easing: 'easeInOutBack',
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
// Touch Start
|
||
|
$wrap.on({
|
||
|
touchstart: function() {
|
||
|
if(!$sidebarState || !$el.hasClass('active')) {
|
||
|
if($block.hasClass('show')) {
|
||
|
$blockIndex = $block.filter('.sub-nav-block show').index();
|
||
|
$block.removeClass('show');
|
||
|
$blockList.css({'width': 0});
|
||
|
$wrap.css({
|
||
|
'margin-left': $wrapLeft,
|
||
|
});
|
||
|
$sidebar.css({'width': 61});
|
||
|
$arrow.stop().animate({
|
||
|
top: $position,
|
||
|
},{
|
||
|
duration: 500,
|
||
|
easing: 'easeInOutBack',
|
||
|
});
|
||
|
$el.eq($blockIndex).hasClass('active') ? '':$el.eq($blockIndex).children('span').removeClass('hover');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
// Sidebar Nav Drag
|
||
|
if(/MSIE 8.0/g.test($ua)){
|
||
|
$arrow.remove();
|
||
|
$sidebarMenu.addClass('nano')
|
||
|
.children('.scroller')
|
||
|
.addClass('content')
|
||
|
.removeClass('scroller');
|
||
|
$sidebarMenu.nanoScroller({ scrollTop: 0 });
|
||
|
} else {
|
||
|
if($('#sidebar').length) {
|
||
|
var sidebarMenu = new iScroll('sidebar-menu', {
|
||
|
vScrollbar: true,
|
||
|
scrollbarClass: 'myScrollbar',
|
||
|
onBeforeScrollStart: function (e) {
|
||
|
var target = e.target;
|
||
|
clearTimeout(this.hoverTimeout);
|
||
|
while (target.nodeName != "SPAN") target = target.parentNode;
|
||
|
$target = $(target.parentNode).index();
|
||
|
},
|
||
|
touch: function () {
|
||
|
if (this.hoverTarget) {
|
||
|
clearTimeout(this.hoverTimeout);
|
||
|
$('.sub-nav-block').removeClass('show')
|
||
|
$('.sub-nav-block').eq($target).addClass('show')
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
// Initial State
|
||
|
initialState = function () {
|
||
|
if($('.bottomnav').length) {
|
||
|
var $bottomnavHeight = $('.bottomnav').outerHeight();
|
||
|
$('.wrap-inner').css({
|
||
|
'padding-bottom': $bottomnavHeight,
|
||
|
})
|
||
|
if($sidebarState) {
|
||
|
if(!$('.sidebar-nav').hasClass('no-sub-nav')) {
|
||
|
if($('#basic-info').length) {
|
||
|
$('.bottomnav').css({
|
||
|
'left': 631,
|
||
|
});
|
||
|
} else {
|
||
|
$('.bottomnav').css({
|
||
|
'left': 261,
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// if($('.topnav').length) {
|
||
|
// if($sidebarState) {
|
||
|
// $('.topnav').css({
|
||
|
// 'left': 261,
|
||
|
// });
|
||
|
// }
|
||
|
// }
|
||
|
};
|
||
|
$.fn.delayKeyup = function(callback, ms){
|
||
|
var timer = 0;
|
||
|
$(this).keyup(function(){
|
||
|
clearTimeout (timer);
|
||
|
timer = setTimeout(callback, ms);
|
||
|
});
|
||
|
return $(this);
|
||
|
};
|
||
|
}(window.jQuery);
|
||
|
|
||
|
|
||
|
var ini = function() {
|
||
|
api = this
|
||
|
api.modal = function(e) {
|
||
|
$('#dialog a.delete-item').attr("href", e);
|
||
|
$('#dialog').modal('show');
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
var ini = function() {
|
||
|
api = this
|
||
|
api.modal = function(e) {
|
||
|
$('#dialog a.delete-item').attr("href", e);
|
||
|
$('#dialog').modal('show');
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// Open Slide
|
||
|
function openSlide() {
|
||
|
var $openSlide = $('.open-slide');
|
||
|
typeof customOpenSlide === 'function' ? customOpenSlide($openSlide) : $openSlide.pageslide();
|
||
|
}
|
||
|
|
||
|
function formTip() {
|
||
|
if($('.main-forms').length && $('.add-on').length || $('.phtot-action').length) {
|
||
|
$('.main-forms .add-on, .main-forms .file-link, .phtot-action li').tooltip({
|
||
|
position: {
|
||
|
my: "center bottom-4",
|
||
|
at: "center top"
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
if($('.no-sub-nav').length) {
|
||
|
$('.no-sub-nav li').tooltip({
|
||
|
position: {
|
||
|
my: "left+20 center",
|
||
|
at: "right center"
|
||
|
},
|
||
|
track: true,
|
||
|
tooltipClass: "sidebar-tooltip",
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
function changeStatusHidden() {
|
||
|
$('#status').find('label.checkbox').each(function() {
|
||
|
$(this).find('input[type="hidden"]').clone().appendTo($(this));
|
||
|
$(this).find('input[type="hidden"]').eq(0).remove();
|
||
|
$(this).find('input[type="checkbox"]').after
|
||
|
});
|
||
|
};
|
||
|
|
||
|
|
||
|
// Document Ready
|
||
|
$(function() {
|
||
|
showFiltersOnPageRefresh();
|
||
|
|
||
|
new ini();
|
||
|
$('#main-wrap').on('click', '.delete', function() {
|
||
|
api.modal($(this).attr('rel'));
|
||
|
})
|
||
|
initialState();
|
||
|
$('#login').on('shown', function () {
|
||
|
$(document.body).addClass('modalBlur');
|
||
|
$('#login').focusFirstField();
|
||
|
}).on("hide", function() {
|
||
|
$(document.body).removeClass('modalBlur');
|
||
|
});
|
||
|
$('#orbit-bar .searchClear').searchClear({
|
||
|
inputName: '.search-query',
|
||
|
inputIcon: 'icon-search',
|
||
|
clearBtnIcon: 'icons-cross-3',
|
||
|
|
||
|
});
|
||
|
$('#filter .searchClear').searchClear({
|
||
|
inputName: '.search-query',
|
||
|
inputIcon: 'icon-search',
|
||
|
clearBtnIcon: 'icons-cross-3',
|
||
|
liveFilter: true,
|
||
|
});
|
||
|
$('#member-filter').on('shown', function() {
|
||
|
$(this).find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||
|
});
|
||
|
if($('#sidebar').length) {
|
||
|
if(!/MSIE 8.0/g.test(navigator.userAgent)){
|
||
|
document.getElementById('sidebar').addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
|
||
|
}
|
||
|
}
|
||
|
if($('#pageslide').length) {
|
||
|
openSlide();
|
||
|
}
|
||
|
if($('.tags').length) {
|
||
|
$('#filter-input').fastLiveFilter('#tags-list', '.filter-item', '.tag');
|
||
|
}
|
||
|
if($('#card-list').length) {
|
||
|
$('#filter-input').fastLiveFilter('#card-list', '.filter-item', '.user-name');
|
||
|
}
|
||
|
if($('.toggle-check').length) {
|
||
|
$('.toggle-check').togglebox();
|
||
|
}
|
||
|
if($('#status').length) {
|
||
|
changeStatusHidden();
|
||
|
}
|
||
|
formTip()
|
||
|
sidebarNav();
|
||
|
});
|
||
|
|
||
|
var showFiltersOnPageRefresh = function(){
|
||
|
var params = getUrlVars(),
|
||
|
paramfilter = params['new_filter[type]'];
|
||
|
|
||
|
// switch (paramfilter){
|
||
|
// case "role":
|
||
|
// paramfilter = "status";
|
||
|
// break;
|
||
|
// }
|
||
|
|
||
|
if( paramfilter ){
|
||
|
$( "#filter" ).addClass('open');
|
||
|
$( '#filter a[href="#collapse-' + paramfilter + '"]').parent().parent().addClass('active');
|
||
|
$( '#filter #collapse-' + paramfilter ).addClass('in');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var getUrlVars = function(){
|
||
|
var vars = [], hash;
|
||
|
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||
|
for(var i = 0; i < hashes.length; i++){
|
||
|
hash = hashes[i].split('=');
|
||
|
vars.push(decodeURIComponent(hash[0]));
|
||
|
vars[decodeURIComponent(hash[0])] = decodeURIComponent(hash[1]);
|
||
|
}
|
||
|
if(vars[0] == window.location.href){
|
||
|
vars =[];
|
||
|
}
|
||
|
return vars;
|
||
|
}
|