//unsere eigenen Tabs! $.fn.sw_tabs = function() { //damit mir mein $(this) nicht verloren geht var thistabs = $(this); //diese Funktion prüft, ob die Pfeile für das hin und her scrollen erforderlich sind und fügt sie ggf. hinzu function scroll_tabs(thiss) { var wrapper_width = $(thiss).children('.tabs_wrapper').get(0).scrollWidth; var width = Math.ceil($(thiss).outerWidth()); if(wrapper_width > width) { $(thiss).addClass('tabs_scroll'); } else { $(thiss).removeClass('tabs_scroll'); } }; //diese Funktion führt das tatsächliche Scrollen aus und prüft, ob noch weiter nach rechts bzw. links gescrollt werden kann - je nach Ergebnis wird der Scrollpfeil dann disabled function move_tabs (scroll_amount, scroll_time) { thistabs.children('.tabs').children('.tabs_wrapper').animate({scrollLeft: scroll_amount}, scroll_time, function () { var width = thistabs.children(".tabs").outerWidth(); var wrapper_width = thistabs.children('.tabs').children('.tabs_wrapper').outerWidth(true); var wrapper_scrollwidth = thistabs.children('.tabs').children('.tabs_wrapper').get(0).scrollWidth; var scroll_left = thistabs.children('.tabs').children('.tabs_wrapper').get(0).scrollLeft; thistabs.children('.tabs').children('.pfeil').removeClass('disabled'); if(scroll_left == "0") { thistabs.children('.tabs').children('.pfeil_links').addClass('disabled'); } if (scroll_left >= (wrapper_scrollwidth - wrapper_width - 1) && scroll_left <= (wrapper_scrollwidth - wrapper_width + 1)) { thistabs.children('.tabs').children('.pfeil_rechts').addClass('disabled'); } }); }; //diese Funktionen werden zu Beginn des Aufrufens ausgeführt. //dazu gehört die Prüfung, ob Pfeile benötigt werden und das Laden des ersten Tabs setTimeout(function () {scroll_tabs(thistabs.children('.tabs'));}, 250); thistabs.children('.tabs_content').load(thistabs.children('.tabs').children('.tabs_wrapper').children('.tab:first-child').attr('goto')); thistabs.children('.tabs').children('.tabs_wrapper').children('.tab:first-child').addClass('tab_aktiv'); //wenn das Fenster seine Größe ändert, könnten die Scrollpfeile nötig werden, also prüfen wir das $(window).resize(function() { scroll_tabs(thistabs.children('.tabs')); }); //wir klicken auf einen Pfeil, um die Tabs nach links oder rechts zu scrollen thistabs.children('.tabs').children(".pfeil").click(function () { var width = thistabs.children(".tabs").outerWidth(); var wrapper_width = thistabs.children('.tabs').children('.tabs_wrapper').outerWidth(); var wrapper_scrollwidth = thistabs.children('.tabs').children('.tabs_wrapper').get(0).scrollWidth; var scroll_left = thistabs.children('.tabs').children('.tabs_wrapper').get(0).scrollLeft; if ($(this).hasClass('pfeil_links')) { var scroll_amount = scroll_left - wrapper_width; } if ($(this).hasClass('pfeil_rechts')) { var scroll_amount = scroll_left + wrapper_width; } move_tabs(scroll_amount, 500); }); //wir klicken auf einen Tab thistabs.children('.tabs').children('.tabs_wrapper').children('.tab').click(function() { //der Inhalt wird geladen thistabs.children('.tabs_content').load($(this).attr('goto')); thistabs.children('.tabs').children('.tabs_wrapper').children('.tab').removeClass('tab_aktiv'); $(this).addClass('tab_aktiv'); //falls was in der Buttonleiste stand, verschwindet es jetzt $('#fenster_blocker .fenster:last-child .buttonleiste').empty(); if($('.fenster').length == 0) { $('.toolbox').empty(); } var tab_left = $(this).position().left; var tab_width = $(this).outerWidth(true); var wrapper_width = thistabs.children('.tabs').children('.tabs_wrapper').outerWidth(); var scroll_left = thistabs.children('.tabs').children('.tabs_wrapper').get(0).scrollLeft; var pfeil_width = thistabs.children('.tabs').children('.pfeil').outerWidth(); //wenn der Tab nicht komplett im Sichtfeld ist, wird er ins Sichtfeld geschoben if (tab_left < pfeil_width) { move_tabs(scroll_left + tab_left - pfeil_width, 250); } if ((tab_left + tab_width + pfeil_width) > (wrapper_width)) { move_tabs(scroll_left - (wrapper_width - (tab_left + tab_width)) - pfeil_width, 250); } }); }; function load_sw_tab(klasse, pfad) { $(klasse).children('.tabs').children('.tabs_wrapper').children('.tab').each(function () { if ($(this).attr('goto') == pfad) { $(klasse).children('.tabs').children('.tabs_wrapper').children('.tab').removeClass('tab_aktiv'); $(this).addClass('tab_aktiv'); $(klasse).children('.tabs_content').load(pfad); } }); } //Headinfobereich var tId; $headinfobereich = function(text, typ) { if (typ == "success") { var farbe = "gruen"; var icon = "fa-check-circle"; } if (typ == "error") { var farbe = "rot"; var icon = "fa-times-circle"; } if (typ == "network") { var farbe = "rot"; var icon = "fa-chain-broken"; } $("#headinfobereich").removeClass('show').removeClass('rot').removeClass('gruen').hide().addClass(farbe); $('#headinfobereich .infotext').html(text); $('#headinfobereich .fa').attr('class', 'fa'); $('#headinfobereich .fa').addClass(icon); $("#headinfobereich").toggleClass('show', 500).show(); clearTimeout(tId); tId=setTimeout(function(){ $("#headinfobereich").toggleClass('show', 500).hide(500); }, 5000); } //Fenster bauen $fenster = function(klasse, titel, pfad, breite, hoehe, close_selector, close_pfad) { $('#fenster_blocker').append("
"+titel+"
"); $('#fenster_blocker .fenster:last-child').children('.fensterinhalt').load(pfad, function() { if ($get_device() == "desktop") { $('#fenster_blocker .fenster:last-child').css('height', hoehe); $('#fenster_blocker .fenster:last-child').css('width', breite); } $('#fenster_blocker .fenster:last-child').attr("close_selector", close_selector); $('#fenster_blocker .fenster:last-child').attr("close_pfad", close_pfad); $('#fenster_blocker .fenster:last-child').addClass('aktiv', 300); $('#fenster_blocker').addClass('aktiv', 300).show(); }); } $fenster_schliessen = function () { var selector = $('#fenster_blocker .fenster:last-child').attr('close_selector'); var pfad = $('#fenster_blocker .fenster:last-child').attr('close_pfad'); if ( typeof selector !== "undefined" && selector && typeof pfad !== "undefined" && pfad) { $(selector).load(pfad); } $('#fenster_blocker .fenster:last-child').removeClass('aktiv', 300).remove(); if($('#fenster_blocker .fenster').length == 0) { $('#fenster_blocker').removeClass('aktiv', 300).hide(300); } } //Fenster schließen $(document).on('click', '.fenster .symbolleiste .fenster_schliessen', $fenster_schliessen); $(document).on('click', '#fenster_blocker:not(input)', function(e) { if (e.target !== this) { e.stopPropagation(); return; } $fenster_schliessen(); }); //Klick auf einen Menüpunkt, der etwas im Seiteninhalt öffnen soll $(document).on('click', ".open_seiteninhalt", function() { $('.fenster').removeClass('aktiv', 300).remove(); $('#fenster_blocker').removeClass('aktiv', 300).hide(300); if($get_device() == "mobile"){ $('#sidemenu').removeClass('aktiv'); $('#seiteninhalt').removeClass('aktiv'); } var modulpfad = $(this).attr('punktid'); var anzname = $(this).attr('anz'); $('.element').removeClass('smakt'); $(".element[punktid='"+modulpfad+"']").addClass('smakt'); $.post("../extranet/core/callmodul.php", {modul:modulpfad,ziel:'seiteninhalt'}).done(function(antwort){ $('#seiteninhalt').html(antwort); }); $('*').unbind(); $(document).unbind('keydown'); return false; }); //Klick auf einen Menüpunkt, der ein Fenster öffnen soll $(document).on('click', ".open_prompt", function(){ if($get_device() == "mobile"){ $('#sidemenu').removeClass('aktiv'); $('#seiteninhalt').removeClass('aktiv'); } $fenster($(this).attr('punktid')+'prompt', $(this).children('div[class="text"]').text(), '../extranet/core/callmodul.php?modul='+$(this).attr('punktid'), $(this).attr('window_width'), $(this).attr('window_height')); return false; }); //Klick auf ein Menüelement, das nix öffnen soll $(document).on('click', ".open_none", function(){ return false; }); //Klick auf Logout $(document).on('click', ".open_logout", function(){ window.location.assign('./core/logout/index.php'); }); //beim Klick auf das Modultitelbild wird die index geladen function load_index(){ $('#seiteninhalt').load($(this).attr('pfad')); }; //beim Klick auf den Menüoberpunkt von der mobile wird das Menü geöffnet und geschlossen $(document).on('click', '.menu .element', function() { if ($get_device() == "mobile") { $('#sidemenu').toggleClass('aktiv'); $('#seiteninhalt').toggleClass('aktiv'); } }); //wenn das mobile Menü ausgefahren wird und man auf den seitenbereich klickt, fähr das menü ein $(document).on('click', '#seiteninhalt.aktiv', function(){ if ($get_device() == "mobile") { $('#sidemenu').removeClass('aktiv'); $('#seiteninhalt').removeClass('aktiv'); } }); $(document).off('click', "#sidemenu .element .not_punkt").on('click', "#sidemenu .element .not_punkt", function(e) { e.stopPropagation(); if($get_device() == "mobile") { $('#sidemenu').removeClass('aktiv'); $('#seiteninhalt').removeClass('aktiv'); } $fenster('benachrichtigungenprompt', 'Benachrichtigungen', './core/callmodul.php?modul=benachrichtigungen¶m='+$(this).parent().attr('punktid'), '300px', '500px'); return false; }); //Userdata Button $(document).off('click', ".ud-button").on('click', ".ud-button", function(){ $fenster('ud', 'Datei auswählen', './module/dateien/userdata/index.php?modul='+$(this).attr('ud-modul')+'&ordner='+$(this).attr('ud-ordner'), '800px', '600px'); }); (function($){ $.fn.extend({ swipeTable:function(params){ var conf = {start: 1, threshold:20, kopfspalte:false}; $.extend(conf, params); return $(this).each(function(){ if($get_device() == "mobile" ){ var top = $(this).offset().top+50; $('table:not(:has(#swipetipp))').append('
'); $(this).find('th[colspan], td[colspan]').each(function() { var cell, count, results; cell = $(this); count = parseInt(cell.attr('colspan')) - 1; cell.removeAttr('colspan'); results = []; while (count > 0) { cell.after(cell.clone()); cell = cell; results.push(count--); } return results; }); var menge = $(this).find("tr:nth-child(3) > td").length; $(this).after("
"); for(i=0; i"); } $(this).find('td, th').hide(); $(this).attr('show',conf.start); var min = 1; if(conf.kopfspalte == true){ conf.start = conf.start+1; $(this).attr('show',conf.start); $('#swipebullets').find('i:nth-child(1)').hide(); $(this).find('td:nth-child(1),th:nth-child(1)').show(); var min = 2; } $('#swipebullets').find('i:nth-child('+conf.start+')').addClass('fa-circle'); $(this).find('td:nth-child('+conf.start+'),th:nth-child('+conf.start+')').show(); var tabelle = $(this); $(this).swipe( {swipe:function(event, direction) { $('#swipetipp').remove(); var max = $(tabelle).find("tr:nth-child(3) > td").length; var current = parseInt($(tabelle).attr('show')); var neu = current; if(direction == "left" && current < max){ neu = current+1; } if(direction == "right" && current > min){ neu = current-1; } $(tabelle).find('td, th').hide(); if(conf.kopfspalte == true){ $(this).find('td:nth-child(1),th:nth-child(1)').show(); } $('#swipebullets').find('i').removeClass('fa-circle').addClass('fa-circle-o'); $(tabelle).find('td:nth-child('+neu+'),th:nth-child('+neu+')').show(); $('#swipebullets').find('i:nth-child('+neu+')').addClass('fa-circle'); $(tabelle).attr('show', neu); }, threshold:conf.threshold, allowPageScroll : "vertical" }); } }); } }); })(jQuery);