dojo: main UI: load stuff asynchronously

This commit is contained in:
Andrew Dolgov 2016-08-10 10:01:05 +03:00
parent 25a533c432
commit ee5170424e
4 changed files with 239 additions and 214 deletions

View File

@ -88,6 +88,15 @@
<link rel="shortcut icon" type="image/png" href="images/favicon.png"/> <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
<link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" /> <link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
<script>
dojoConfig = {
async: true,
packages: [
{ name: "fox", location: "../../js" },
]
};
</script>
<?php <?php
foreach (array("lib/prototype.js", foreach (array("lib/prototype.js",
"lib/scriptaculous/scriptaculous.js?load=effects,controls", "lib/scriptaculous/scriptaculous.js?load=effects,controls",
@ -105,7 +114,7 @@
require_once 'lib/jshrink/Minifier.php'; require_once 'lib/jshrink/Minifier.php';
print get_minified_js(array("tt-rss", print get_minified_js(array("tt-rss",
"functions", "feedlist", "viewfeed", "FeedTree", "PluginHost")); "functions", "feedlist", "viewfeed", "PluginHost"));
foreach (PluginHost::getInstance()->get_plugins() as $n => $p) { foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
if (method_exists($p, "get_js")) { if (method_exists($p, "get_js")) {

View File

@ -216,6 +216,8 @@ function genericSanityCheck() {
function init() { function init() {
try { try {
require(['dojo/_base/kernel', 'dojo/ready', 'dojo/parser', 'dojo/_base/loader'], function(dojo, ready, parser) {
//dojo.registerModulePath("fox", "../../js/"); //dojo.registerModulePath("fox", "../../js/");
dojo.require("fox.FeedTree"); dojo.require("fox.FeedTree");
@ -223,6 +225,7 @@ function init() {
dojo.require("dijit.ColorPalette"); dojo.require("dijit.ColorPalette");
dojo.require("dijit.Dialog"); dojo.require("dijit.Dialog");
dojo.require("dijit.form.Button"); dojo.require("dijit.form.Button");
dojo.require("dijit.form.ComboButton");
dojo.require("dijit.form.CheckBox"); dojo.require("dijit.form.CheckBox");
dojo.require("dijit.form.DropDownButton"); dojo.require("dijit.form.DropDownButton");
dojo.require("dijit.form.FilteringSelect"); dojo.require("dijit.form.FilteringSelect");
@ -238,6 +241,7 @@ function init() {
dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer"); dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.PopupMenuItem");
dojo.require("dijit.Menu"); dojo.require("dijit.Menu");
dojo.require("dijit.ProgressBar"); dojo.require("dijit.ProgressBar");
dojo.require("dijit.ProgressBar"); dojo.require("dijit.ProgressBar");
@ -559,6 +563,7 @@ function init() {
} }); } });
}; };
});
} catch (e) { } catch (e) {
exception_error("init", e); exception_error("init", e);
@ -568,7 +573,11 @@ function init() {
function init_second_stage() { function init_second_stage() {
try { try {
dojo.addOnLoad(function() { Event.observe(window, 'resize', function() {
dijit.byId("main").resize();
});
//dojo.addOnLoad(function() {
updateFeedList(); updateFeedList();
closeArticlePanel(); closeArticlePanel();
@ -594,7 +603,7 @@ function init_second_stage() {
} }
}); });
}); //});
delCookie("ttrss_test"); delCookie("ttrss_test");

View File

@ -1,5 +1,6 @@
dojo.addOnLoad(function() { require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) { dojo.addOnLoad(function () {
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
if (row) { if (row) {
console.log("af_zz_noautoplay!"); console.log("af_zz_noautoplay!");
console.log(row); console.log(row);
@ -11,7 +12,7 @@ dojo.addOnLoad(function() {
videos[i].removeAttribute("autoplay"); videos[i].removeAttribute("autoplay");
videos[i].pause(); videos[i].pause();
videos[i].onclick = function() { videos[i].onclick = function () {
this.paused ? this.play() : this.pause(); this.paused ? this.play() : this.pause();
} }
} }
@ -20,14 +21,14 @@ dojo.addOnLoad(function() {
return true; return true;
}); });
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) { PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
if (row) { if (row) {
var videos = row.getElementsByTagName("video"); var videos = row.getElementsByTagName("video");
for (i = 0; i < videos.length; i++) { for (i = 0; i < videos.length; i++) {
videos[i].removeAttribute("autoplay"); videos[i].removeAttribute("autoplay");
videos[i].pause(); videos[i].pause();
videos[i].onclick = function() { videos[i].onclick = function () {
this.paused ? this.play() : this.pause(); this.paused ? this.play() : this.pause();
} }
} }
@ -37,4 +38,6 @@ dojo.addOnLoad(function() {
return true; return true;
}); });
});
}); });

View File

@ -22,7 +22,9 @@ function expandSizeWrapper(id) {
} }
dojo.addOnLoad(function() { require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
dojo.addOnLoad(function() {
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) { PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
if (getInitParam('cdm_expanded')) { if (getInitParam('cdm_expanded')) {
@ -44,4 +46,6 @@ dojo.addOnLoad(function() {
return true; return true;
}); });
});
}); });