hallo und ein frohes neues.....
es ist zwar nicht die feine art andere seine probleme lösen zu lassen, den eigentlich sollte ich es alleine schaffen. aber nach unendlich vielen stunden und vielen tagen bitte ich euch hier um hilfe. ich behaupte daß ich wenigstens im ansatz dieses script verstehe, doch als alter mann und absolut neu in dieser materie möchte ich sie trotzdem erlernen. folgendes szenario:
das script läuft einmal als anonyme funktion durch und soll dann noch einmal als benannte funktion, angehangen als (inst) bei complete: function durchlaufen. die kommentare sind eine denkstütze für mich. meine auslegung. sicherlich mit fehlern.
ich entschuldige mich wenn es zu unübersichtlich wirkt. für eure hilfe wäre ich sehr dankbar.
hier das original: Progressbar | jQuery UI
vielen dank
es ist zwar nicht die feine art andere seine probleme lösen zu lassen, den eigentlich sollte ich es alleine schaffen. aber nach unendlich vielen stunden und vielen tagen bitte ich euch hier um hilfe. ich behaupte daß ich wenigstens im ansatz dieses script verstehe, doch als alter mann und absolut neu in dieser materie möchte ich sie trotzdem erlernen. folgendes szenario:
das script läuft einmal als anonyme funktion durch und soll dann noch einmal als benannte funktion, angehangen als (inst) bei complete: function durchlaufen. die kommentare sind eine denkstütze für mich. meine auslegung. sicherlich mit fehlern.
ich entschuldige mich wenn es zu unübersichtlich wirkt. für eure hilfe wäre ich sehr dankbar.
hier das original: Progressbar | jQuery UI
vielen dank
Code:
$(function() {
var progressTimer,
progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" ),
dialogButtons = [{
text: "Download Abbrechen",
click: closeDownload
}],
dialog = $( "#dialog" ).dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
buttons: dialogButtons,
open: function() {
progressTimer = setTimeout( progress, 2000 );
},
beforeClose: function() {
appbutton.button( "option", {
disabled: false,
label: "Beginne Download"
});
}
}),
appbutton = $( "#appbutton" )
.button()
.on( "click", function() {
$( this ).button( "option", {
disabled: true,
label: "Download läuft..."
});
dialog.dialog( "open" );
});
progressbar.progressbar({
value: false,
change: function() {
progressLabel.text( "Fortschritt Download: " + progressbar.progressbar( "value" ) + "%" );
},
complete: function() {
appbutton.text("Download Call'a'Cab App");
progressLabel.text( "Download erfolgreich!" );
dialog.dialog( "option", "buttons", [{
text: "App Installieren",
click: inst,
open: function() {
progressTimer = setTimeout( progress, 5000 );
},
}]);
$(".ui-dialog button").last().focus();
}
});
function progress() {
var val = progressbar.progressbar( "value" ) || 0;
progressbar.progressbar( "value", val + Math.floor( Math.random() * 3 ) );
if ( val <= 99 ) {
progressTimer = setTimeout( progress, 50 );
}
}
function closeDownload() {
clearTimeout( progressTimer );
dialog
.dialog( "option", "buttons", dialogButtons )
.dialog( "close" );
progressbar.progressbar( "value", false );
progressLabel
.text( "Beginne Download..." );
appbutton.focus();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function inst() {
var progressTimer,
progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" ),
dialogButtons = [{
text: " Installation Abbrechen ",
click: closeDownload
}],
dialog = $( "#dialog" ).dialog({
autoOpen: false,
closeOnEscape: false,
resizable: false,
buttons: dialogButtons,
open: function () {
progressTimer = setTimeout( progress, 2000 );
},
beforeClose: function() {
appbutton.button( "option", {
disabled: false,
label: "Download Call'a'Cab App"
});
}
}),
appbutton = $( "#appbutton" )
.button()
.on( "click", function() {
$( this ).button( "option", {
disabled: false,
change: "Installation läuft..."
});
dialog.dialog( "open" );
});
progressbar.progressbar({
value: false,
change: function() {
progressLabel.text( "BFortschritt Installation: " + progressbar.progressbar( "value" ) + "%" );
},
complete: function() {
progressLabel.text( "Installation beendet!" );
dialog.dialog( "option", "buttons", [{
text: "Schließen",
click: closeDownload
}]);
$(".ui-dialog button").last().on("click", function(){
var fenster = window.open('jqm.html', 'f', 'width=500,height=300');
if(fenster){
fenster.focus();
}else{
alert('Bitte neues Fenster erlauben');
}
return false;
});
}
});
function progress() {
var val = progressbar.progressbar( "value" ) || 0;
progressbar.progressbar( "value", val + Math.floor( Math.random() * 3 ) );
if ( val <= 99 ) {
progressTimer = setTimeout( progress, 50 );
}
}
function closeDownload() {
clearTimeout( progressTimer );
dialog.dialog( "option", "buttons", dialogButtons ).dialog("close");
progressbar.progressbar( "value", false );
progressLabel.text( "Beginn der Installation..." );
appbutton.focus();
}
};
});
Zuletzt bearbeitet: