rework loading progressbar

This commit is contained in:
Andrew Dolgov 2010-11-19 16:08:02 +03:00
parent b8aa9ca7f0
commit fcc3674439
8 changed files with 23 additions and 42 deletions

View File

@ -191,8 +191,6 @@ function viewfeed(feed, subop, is_cat, offset) {
function feedlist_init() { function feedlist_init() {
try { try {
loading_set_progress(90);
console.log("in feedlist init"); console.log("in feedlist init");
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1); hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
@ -204,7 +202,6 @@ function feedlist_init() {
setTimeout("viewfeed(-3)", 100); setTimeout("viewfeed(-3)", 100);
} else { } else {
setTimeout("viewfeed(-5)", 100); setTimeout("viewfeed(-5)", 100);
remove_splash();
} }
} }

View File

@ -1,6 +1,6 @@
var hotkeys_enabled = true; var hotkeys_enabled = true;
var notify_silent = false; var notify_silent = false;
var last_progress_point = 0; var loading_progress = 0;
var sanity_check_done = false; var sanity_check_done = false;
/* add method to remove element from array */ /* add method to remove element from array */
@ -879,21 +879,13 @@ function displayHelpInfobox(topic_id) {
function loading_set_progress(p) { function loading_set_progress(p) {
try { try {
if (p < last_progress_point || !Element.visible("overlay")) return; loading_progress += p;
console.log("loading_set_progress : " + p + " (" + last_progress_point + ")"); if (dijit.byId("loading_bar"))
dijit.byId("loading_bar").update({progress: loading_progress});
var o = $("l_progress_i"); if (loading_progress >= 90)
remove_splash();
// o.style.width = (p * 2) + "px";
new Effect.Scale(o, p, {
scaleY : false,
scaleFrom : last_progress_point,
scaleMode: { originalWidth : 200 },
queue: { position: 'end', scope: 'LSP-Q', limit: 3 } });
last_progress_point = p;
} catch (e) { } catch (e) {
exception_error("loading_set_progress", e); exception_error("loading_set_progress", e);
@ -901,6 +893,7 @@ function loading_set_progress(p) {
} }
function remove_splash() { function remove_splash() {
if (Element.visible("overlay")) { if (Element.visible("overlay")) {
console.log("about to remove splash, OMG!"); console.log("about to remove splash, OMG!");
Element.hide("overlay"); Element.hide("overlay");

View File

@ -25,7 +25,6 @@ function feedlist_callback2(transport) {
caller_subop = false; caller_subop = false;
} }
notify(""); notify("");
remove_splash();
} catch (e) { } catch (e) {
exception_error("feedlist_callback2", e); exception_error("feedlist_callback2", e);
@ -35,7 +34,6 @@ function feedlist_callback2(transport) {
function filterlist_callback2(transport) { function filterlist_callback2(transport) {
dijit.byId('filterConfigTab').attr('content', transport.responseText); dijit.byId('filterConfigTab').attr('content', transport.responseText);
notify(""); notify("");
remove_splash();
} }
function labellist_callback2(transport) { function labellist_callback2(transport) {
@ -46,7 +44,6 @@ function labellist_callback2(transport) {
closeInfoBox(); closeInfoBox();
notify(""); notify("");
remove_splash();
} catch (e) { } catch (e) {
exception_error("labellist_callback2", e); exception_error("labellist_callback2", e);
@ -58,7 +55,6 @@ function userlist_callback2(transport) {
dijit.byId('userConfigTab').attr('content', transport.responseText); dijit.byId('userConfigTab').attr('content', transport.responseText);
notify(""); notify("");
remove_splash();
} catch (e) { } catch (e) {
exception_error("userlist_callback2", e); exception_error("userlist_callback2", e);
} }
@ -69,7 +65,6 @@ function prefslist_callback2(transport) {
dijit.byId('genConfigTab').attr('content', transport.responseText); dijit.byId('genConfigTab').attr('content', transport.responseText);
notify(""); notify("");
remove_splash();
} catch (e) { } catch (e) {
exception_error("prefslist_callback2", e); exception_error("prefslist_callback2", e);
} }
@ -1072,7 +1067,7 @@ function init_second_stage() {
caller_subop = caller_subop + ":" + getURLParam("subopparam"); caller_subop = caller_subop + ":" + getURLParam("subopparam");
} }
loading_set_progress(60); loading_set_progress(50);
notify(""); notify("");
@ -1088,7 +1083,6 @@ function init_second_stage() {
}); });
setTimeout("hotkey_prefix_timeout()", 5*1000); setTimeout("hotkey_prefix_timeout()", 5*1000);
remove_splash();
} catch (e) { } catch (e) {
exception_error("init_second_stage", e); exception_error("init_second_stage", e);
@ -1117,6 +1111,7 @@ function init() {
dojo.require("dijit.tree.dndSource"); dojo.require("dijit.tree.dndSource");
dojo.require("dijit.InlineEditBox"); dojo.require("dijit.InlineEditBox");
dojo.require("dijit.ColorPalette"); dojo.require("dijit.ColorPalette");
dojo.require("dijit.ProgressBar");
dojo.registerModulePath("lib", ".."); dojo.registerModulePath("lib", "..");
dojo.registerModulePath("fox", "../.."); dojo.registerModulePath("fox", "../..");
@ -1126,7 +1121,7 @@ function init() {
dojo.require("fox.PrefFilterTree"); dojo.require("fox.PrefFilterTree");
dojo.require("fox.PrefLabelTree"); dojo.require("fox.PrefLabelTree");
loading_set_progress(30); loading_set_progress(50);
var query = "?op=rpc&subop=sanityCheck"; var query = "?op=rpc&subop=sanityCheck";

View File

@ -65,12 +65,10 @@
<div id="overlay"> <div id="overlay">
<div id="overlay_inner"> <div id="overlay_inner">
<?php echo __("Loading, please wait...") ?> <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
<div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
<div id="l_progress_o"> progress="0" maximum="100">
<div id="l_progress_i"></div>
</div> </div>
<noscript> <noscript>
<p><?php print_error(__("Your browser doesn't support Javascript, which is required <p><?php print_error(__("Your browser doesn't support Javascript, which is required
for this application to function properly. Please check your for this application to function properly. Please check your

View File

@ -185,7 +185,7 @@ input.editbox {
display : none; display : none;
float : right; float : right;
font-size : 12px; font-size : 12px;
z-index : 998; z-index : 99;
padding : 5px 5px 5px 5px; padding : 5px 5px 5px 5px;
} }
@ -807,7 +807,7 @@ div.browserFeedInfo div.detailsPart {
#overlay_inner { #overlay_inner {
font-weight : bold; font-weight : bold;
margin : 10px; margin : 1em;
} }
#noDaemonWarning { #noDaemonWarning {

View File

@ -120,6 +120,7 @@ function updateFeedList() {
var tmph = dojo.connect(tree, 'onLoad', function() { var tmph = dojo.connect(tree, 'onLoad', function() {
dojo.disconnect(tmph); dojo.disconnect(tmph);
Element.hide("feedlistLoading"); Element.hide("feedlistLoading");
loading_set_progress(25);
}); });
tree.startup(); tree.startup();
@ -254,6 +255,7 @@ function init() {
dojo.require("dijit.Tree"); dojo.require("dijit.Tree");
dojo.require("dijit.form.Select"); dojo.require("dijit.form.Select");
dojo.require("dijit.Toolbar"); dojo.require("dijit.Toolbar");
dojo.require("dijit.ProgressBar");
dojo.require("dojo.parser"); dojo.require("dojo.parser");
dojo.registerModulePath("fox", "../.."); dojo.registerModulePath("fox", "../..");
@ -279,7 +281,7 @@ function init() {
var params = "&ua=" + param_escape(navigator.userAgent); var params = "&ua=" + param_escape(navigator.userAgent);
loading_set_progress(30); loading_set_progress(20);
new Ajax.Request("backend.php", { new Ajax.Request("backend.php", {
parameters: "backend.php?op=rpc&subop=sanityCheck" + params, parameters: "backend.php?op=rpc&subop=sanityCheck" + params,
@ -305,7 +307,7 @@ function init_second_stage() {
feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1; feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
loading_set_progress(60); loading_set_progress(30);
if (has_local_storage()) if (has_local_storage())
localStorage.clear(); localStorage.clear();

View File

@ -61,12 +61,10 @@
<div id="overlay" style="display : block"> <div id="overlay" style="display : block">
<div id="overlay_inner"> <div id="overlay_inner">
<?php echo __("Loading, please wait...") ?> <div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
<div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
<div id="l_progress_o"> progress="0" maximum="100">
<div id="l_progress_i"></div>
</div> </div>
<noscript> <noscript>
<p> <p>
<?php print_error(__("Your browser doesn't support Javascript, which is required <?php print_error(__("Your browser doesn't support Javascript, which is required

View File

@ -35,7 +35,7 @@ function headlines_callback2(transport, feed_cur_page) {
if (!handle_rpc_reply(transport)) return; if (!handle_rpc_reply(transport)) return;
loading_set_progress(100); loading_set_progress(25);
console.log("headlines_callback2 [page=" + feed_cur_page + "]"); console.log("headlines_callback2 [page=" + feed_cur_page + "]");
@ -193,8 +193,6 @@ function headlines_callback2(transport, feed_cur_page) {
notify(""); notify("");
remove_splash();
} catch (e) { } catch (e) {
exception_error("headlines_callback2", e, transport); exception_error("headlines_callback2", e, transport);
} }