From 532ffc1b8e71d650cacb3ec243a9d6b07422f564 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 20 Apr 2014 15:37:36 +0200 Subject: Logintab bei Bedarf verstecken --- js/index.js | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/index.js b/js/index.js index 76e4b69..5183327 100644 --- a/js/index.js +++ b/js/index.js @@ -81,8 +81,28 @@ function fail(text){ console.log('Fehler: ' + text.toString() + ' / ' + text.code); } +/* entfernt das Logintab */ +function removelogintab(){ + $('#vplannavbar').find('*').andSelf().each(function(){ + $(this).removeClass(function(i, cn){ + var matches = cn.match(/ui-[\w\-]+/g) || []; + return (matches.join(' ')); + }); + if($(this).attr('class') == ''){ + $(this).removeAttr('class'); + } + }); + + $('#vplannavbar').navbar('destroy'); + $('#vplannavbar ul li:first').remove(); + $('#vplannavbar').navbar(); + + $('#login').remove(); + $('#vplantabs').tabs('refresh'); +} + /* fügt die lokale URL des Plans ein und ruft die Seite zum Rendering auf */ -function addplanattr(fileEntry){ +function addplanattr(fileEntry, wasdownloaded){ var sPath = fileEntry.toURL(); var name = fileEntry.name; console.log('Dateiname: ' + name); @@ -108,6 +128,10 @@ function addplanattr(fileEntry){ $('#vplantabs').append('
'); $('#vplantabs').tabs('refresh'); + + if($('#login').length && wasdownloaded){ + removelogintab(); + } } render_pdf(sPath, name); @@ -126,6 +150,10 @@ function download_pdf(link){ function(fileEntry){ // Datei ist schon heruntergeladen console.log('Datei schon heruntergeladen'); + + if($('#login').length){ + removelogintab(); + } }, function(err){ // Datei existiert noch nicht @@ -138,7 +166,7 @@ function download_pdf(link){ fileEntry.toURL(), function(theFile){ console.log('Download fertig: ' + theFile.toURL()); - addplanattr(theFile); + addplanattr(theFile, true); }, fail); }, fail); }); @@ -335,7 +363,7 @@ function load(){ if(actual.length > 0){ $('#noplans').hide('slow'); for(j = 0; j < actual.length; j++){ - addplanattr(actual[j]); + addplanattr(actual[j], false); } }else{ $('#noplans').show('fast'); -- cgit v1.3.1