diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-04-20 15:37:36 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-08-15 19:46:54 +0200 |
| commit | 532ffc1b8e71d650cacb3ec243a9d6b07422f564 (patch) | |
| tree | adc3a2e71f673532a772ababff2ba68c69a23a2a | |
| parent | 5f4a40b4e24e5e7e846ef87fc1fee7b004f26c59 (diff) | |
| download | wvs-vplan-532ffc1b8e71d650cacb3ec243a9d6b07422f564.tar.gz wvs-vplan-532ffc1b8e71d650cacb3ec243a9d6b07422f564.zip | |
Logintab bei Bedarf verstecken
| -rw-r--r-- | js/index.js | 34 |
1 files changed, 31 insertions, 3 deletions
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('<div id="' + name + '" class="ui-content tablist-content"></div>'); $('#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'); |
