2012-04-25 22:48:27 +02:00
|
|
|
/**
|
|
|
|
* OpenSlides utils functions
|
|
|
|
*
|
|
|
|
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
|
|
|
|
* :license: GNU GPL, see LICENSE for more details.
|
|
|
|
*/
|
|
|
|
|
2012-04-15 10:30:34 +02:00
|
|
|
$(function () {
|
2012-04-15 12:40:35 +02:00
|
|
|
$('.button').click(function (event) {
|
2012-04-15 10:30:34 +02:00
|
|
|
button = $(this);
|
2012-04-15 12:40:35 +02:00
|
|
|
if (button.hasClass('disabled')) {
|
|
|
|
event.preventDefault();
|
|
|
|
} else {
|
|
|
|
button.addClass('disabled');
|
|
|
|
setTimeout(function () {
|
|
|
|
button.removeClass('disabled');
|
|
|
|
}, 1000);
|
|
|
|
}
|
2012-04-15 10:30:34 +02:00
|
|
|
});
|
2012-04-20 22:43:12 +02:00
|
|
|
// activate an element to show it on projector
|
|
|
|
$('.activate_link').click(function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var link = $(this);
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
2013-01-08 23:05:35 +01:00
|
|
|
url: link.attr('href'),
|
2012-04-20 22:43:12 +02:00
|
|
|
dataType: 'json',
|
|
|
|
data: '',
|
|
|
|
success: function(data) {
|
2013-01-08 23:05:35 +01:00
|
|
|
$('.activate_link').removeClass('btn-primary');
|
|
|
|
$('.icon').removeClass('icon-white');
|
2012-04-20 22:43:12 +02:00
|
|
|
$('tr').removeClass('activeline');
|
|
|
|
link.parent().parent().parent().addClass('activeline');
|
2013-01-08 23:05:35 +01:00
|
|
|
link.addClass('btn-primary');
|
|
|
|
link.find('.icon').addClass('icon-white');
|
2012-04-20 22:43:12 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-04-15 10:30:34 +02:00
|
|
|
});
|
2012-04-17 13:41:43 +02:00
|
|
|
|
|
|
|
|
|
|
|
function new_message(text, type) {
|
2012-04-17 14:45:25 +02:00
|
|
|
var message = $('#dummy-notification').clone(true);
|
|
|
|
$(message).removeAttr('id').addClass(type).children('em').html(text);
|
2012-04-17 13:41:43 +02:00
|
|
|
$('#notifications').append(message);
|
2012-04-17 14:45:25 +02:00
|
|
|
message.slideDown('fast');
|
2012-04-17 13:41:43 +02:00
|
|
|
}
|
2012-09-05 00:20:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Functios for sidebar navigation
|
|
|
|
$(document).ready(function(){
|
|
|
|
// Resize navigation
|
|
|
|
$(window).resize(function(){
|
|
|
|
if($(this).width() < 1124) {
|
|
|
|
iconmenu();
|
|
|
|
if($(window).width() < 570) {
|
|
|
|
$('.table').each(function(){
|
|
|
|
if($(this).find('.table-wrapper').size() == 0) {
|
|
|
|
$(this).wrap('<div class="table-wrapper"></div>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fullmenu();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if($(window).width() < 1124) {
|
|
|
|
iconmenu();
|
|
|
|
if($(window).width() < 570) {
|
|
|
|
$('.table').each(function(){
|
|
|
|
if($(this).find('.table-wrapper').size() == 0) {
|
|
|
|
$(this).wrap('<div class="table-wrapper"></div>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
fullmenu();
|
|
|
|
}
|
|
|
|
// Sticky navigation
|
|
|
|
$(window).scroll(function(){
|
|
|
|
var el = $('.leftmenu > ul');
|
|
|
|
if($(window).width() > 479) {
|
|
|
|
if ( ($(this).scrollTop() > 80) && ($(this).scrollLeft() < 10)) {
|
|
|
|
el.css({'position':'fixed','top':'10px','width':'14.15%'});
|
|
|
|
} else {
|
|
|
|
el.css({'position': 'relative', 'top': '0','width':'auto'});
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (($(this).scrollTop() > 130) && ($(this).scrollLeft() < 10)){
|
|
|
|
el.css({'position':'fixed','top':'10px','width':'14.15%'});
|
|
|
|
} else {
|
|
|
|
el.css({'position': 'relative', 'top': '0','width':'auto'});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// Submenu with drop down
|
|
|
|
$('.leftmenu a').click(function(e){
|
|
|
|
if($(this).siblings('ul').size() == 1){
|
|
|
|
e.preventDefault();
|
|
|
|
var submenu = $(this).siblings('ul');
|
|
|
|
if($(this).hasClass('open')) {
|
|
|
|
if($(this).parents('.leftmenu').hasClass('lefticon')) {
|
|
|
|
submenu.fadeOut();
|
|
|
|
} else {
|
|
|
|
submenu.slideUp('fast');
|
|
|
|
}
|
|
|
|
$(this).removeClass('open');
|
|
|
|
} else {
|
|
|
|
if($(this).parents('.leftmenu').hasClass('lefticon')) {
|
|
|
|
submenu.fadeIn();
|
|
|
|
} else {
|
|
|
|
submenu.slideDown('fast');
|
|
|
|
}
|
|
|
|
$(this).addClass('open');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// Tooltips
|
|
|
|
$('.leftmenu').tooltip({
|
|
|
|
selector: "a[rel=tooltip]",
|
|
|
|
placement: 'right'
|
|
|
|
});
|
2012-09-10 23:28:19 +02:00
|
|
|
$(this).tooltip({
|
|
|
|
selector: "a[rel=tooltip]",
|
|
|
|
placement: 'bottom'
|
|
|
|
});
|
|
|
|
|
2012-09-05 00:20:28 +02:00
|
|
|
$('h1').tooltip({
|
|
|
|
selector: "a[rel=tooltip]",
|
|
|
|
placement: 'bottom'
|
|
|
|
});
|
|
|
|
$('body').tooltip({
|
|
|
|
selector: '.tooltip'
|
|
|
|
});
|
|
|
|
$('.tooltip-left').tooltip({
|
|
|
|
placement: 'left'
|
|
|
|
});
|
|
|
|
$('.tooltip-right').tooltip({
|
|
|
|
placement: 'right'
|
|
|
|
});
|
|
|
|
$('.tooltip-top').tooltip({
|
|
|
|
placement: 'top'
|
|
|
|
});
|
|
|
|
$('.tooltip-bottom').tooltip({
|
|
|
|
placement: 'bottom'
|
|
|
|
});
|
|
|
|
// Resize menu and content container
|
|
|
|
function iconmenu(){
|
|
|
|
$('.leftmenu').removeClass('span2').addClass('lefticon').addClass('span1');
|
|
|
|
$('.leftmenu > ul > li > a').each(function(){
|
|
|
|
atitle = $(this).text();
|
|
|
|
$(this).attr({'rel':'tooltip','title':atitle});
|
|
|
|
});
|
|
|
|
$('#content').removeClass('span10').addClass('span11');
|
|
|
|
}
|
|
|
|
|
|
|
|
function fullmenu(){
|
|
|
|
$('.leftmenu').removeClass('span1').removeClass('lefticon').addClass('span2');
|
|
|
|
$('.leftmenu > ul > li > a').each(function(){
|
|
|
|
$(this).attr({'rel':'','title':''});
|
|
|
|
});
|
|
|
|
$('#content').removeClass('span11').addClass('span10');
|
|
|
|
}
|
|
|
|
});
|