dojo: main UI: load stuff asynchronously
This commit is contained in:
parent
25a533c432
commit
ee5170424e
11
index.php
11
index.php
|
@ -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")) {
|
||||||
|
|
345
js/tt-rss.js
345
js/tt-rss.js
|
@ -216,90 +216,94 @@ function genericSanityCheck() {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
try {
|
try {
|
||||||
//dojo.registerModulePath("fox", "../../js/");
|
require(['dojo/_base/kernel', 'dojo/ready', 'dojo/parser', 'dojo/_base/loader'], function(dojo, ready, parser) {
|
||||||
|
|
||||||
dojo.require("fox.FeedTree");
|
//dojo.registerModulePath("fox", "../../js/");
|
||||||
|
|
||||||
dojo.require("dijit.ColorPalette");
|
dojo.require("fox.FeedTree");
|
||||||
dojo.require("dijit.Dialog");
|
|
||||||
dojo.require("dijit.form.Button");
|
|
||||||
dojo.require("dijit.form.CheckBox");
|
|
||||||
dojo.require("dijit.form.DropDownButton");
|
|
||||||
dojo.require("dijit.form.FilteringSelect");
|
|
||||||
dojo.require("dijit.form.Form");
|
|
||||||
dojo.require("dijit.form.RadioButton");
|
|
||||||
dojo.require("dijit.form.Select");
|
|
||||||
dojo.require("dijit.form.SimpleTextarea");
|
|
||||||
dojo.require("dijit.form.TextBox");
|
|
||||||
dojo.require("dijit.form.ComboBox");
|
|
||||||
dojo.require("dijit.form.ValidationTextBox");
|
|
||||||
dojo.require("dijit.InlineEditBox");
|
|
||||||
dojo.require("dijit.layout.AccordionContainer");
|
|
||||||
dojo.require("dijit.layout.BorderContainer");
|
|
||||||
dojo.require("dijit.layout.ContentPane");
|
|
||||||
dojo.require("dijit.layout.TabContainer");
|
|
||||||
dojo.require("dijit.Menu");
|
|
||||||
dojo.require("dijit.ProgressBar");
|
|
||||||
dojo.require("dijit.ProgressBar");
|
|
||||||
dojo.require("dijit.Toolbar");
|
|
||||||
dojo.require("dijit.Tree");
|
|
||||||
dojo.require("dijit.tree.dndSource");
|
|
||||||
dojo.require("dojo.data.ItemFileWriteStore");
|
|
||||||
|
|
||||||
dojo.parser.parse();
|
dojo.require("dijit.ColorPalette");
|
||||||
|
dojo.require("dijit.Dialog");
|
||||||
|
dojo.require("dijit.form.Button");
|
||||||
|
dojo.require("dijit.form.ComboButton");
|
||||||
|
dojo.require("dijit.form.CheckBox");
|
||||||
|
dojo.require("dijit.form.DropDownButton");
|
||||||
|
dojo.require("dijit.form.FilteringSelect");
|
||||||
|
dojo.require("dijit.form.Form");
|
||||||
|
dojo.require("dijit.form.RadioButton");
|
||||||
|
dojo.require("dijit.form.Select");
|
||||||
|
dojo.require("dijit.form.SimpleTextarea");
|
||||||
|
dojo.require("dijit.form.TextBox");
|
||||||
|
dojo.require("dijit.form.ComboBox");
|
||||||
|
dojo.require("dijit.form.ValidationTextBox");
|
||||||
|
dojo.require("dijit.InlineEditBox");
|
||||||
|
dojo.require("dijit.layout.AccordionContainer");
|
||||||
|
dojo.require("dijit.layout.BorderContainer");
|
||||||
|
dojo.require("dijit.layout.ContentPane");
|
||||||
|
dojo.require("dijit.layout.TabContainer");
|
||||||
|
dojo.require("dijit.PopupMenuItem");
|
||||||
|
dojo.require("dijit.Menu");
|
||||||
|
dojo.require("dijit.ProgressBar");
|
||||||
|
dojo.require("dijit.ProgressBar");
|
||||||
|
dojo.require("dijit.Toolbar");
|
||||||
|
dojo.require("dijit.Tree");
|
||||||
|
dojo.require("dijit.tree.dndSource");
|
||||||
|
dojo.require("dojo.data.ItemFileWriteStore");
|
||||||
|
|
||||||
if (!genericSanityCheck())
|
dojo.parser.parse();
|
||||||
return false;
|
|
||||||
|
|
||||||
loading_set_progress(30);
|
if (!genericSanityCheck())
|
||||||
|
return false;
|
||||||
|
|
||||||
var a = document.createElement('audio');
|
loading_set_progress(30);
|
||||||
|
|
||||||
var hasAudio = !!a.canPlayType;
|
var a = document.createElement('audio');
|
||||||
var hasSandbox = "sandbox" in document.createElement("iframe");
|
|
||||||
var hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
|
|
||||||
var clientTzOffset = new Date().getTimezoneOffset() * 60;
|
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
var hasAudio = !!a.canPlayType;
|
||||||
parameters: {op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
var hasSandbox = "sandbox" in document.createElement("iframe");
|
||||||
hasMp3: hasMp3,
|
var hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
|
||||||
clientTzOffset: clientTzOffset,
|
var clientTzOffset = new Date().getTimezoneOffset() * 60;
|
||||||
hasSandbox: hasSandbox},
|
|
||||||
onComplete: function(transport) {
|
new Ajax.Request("backend.php", {
|
||||||
|
parameters: {op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
||||||
|
hasMp3: hasMp3,
|
||||||
|
clientTzOffset: clientTzOffset,
|
||||||
|
hasSandbox: hasSandbox},
|
||||||
|
onComplete: function(transport) {
|
||||||
backend_sanity_check_callback(transport);
|
backend_sanity_check_callback(transport);
|
||||||
} });
|
} });
|
||||||
|
|
||||||
hotkey_actions["next_feed"] = function() {
|
hotkey_actions["next_feed"] = function() {
|
||||||
var rv = dijit.byId("feedTree").getNextFeed(
|
var rv = dijit.byId("feedTree").getNextFeed(
|
||||||
getActiveFeedId(), activeFeedIsCat());
|
getActiveFeedId(), activeFeedIsCat());
|
||||||
|
|
||||||
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_feed"] = function() {
|
hotkey_actions["prev_feed"] = function() {
|
||||||
var rv = dijit.byId("feedTree").getPreviousFeed(
|
var rv = dijit.byId("feedTree").getPreviousFeed(
|
||||||
getActiveFeedId(), activeFeedIsCat());
|
getActiveFeedId(), activeFeedIsCat());
|
||||||
|
|
||||||
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
if (rv) viewfeed({feed: rv[0], is_cat: rv[1], can_wait: true})
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article"] = function() {
|
hotkey_actions["next_article"] = function() {
|
||||||
moveToPost('next');
|
moveToPost('next');
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article"] = function() {
|
hotkey_actions["prev_article"] = function() {
|
||||||
moveToPost('prev');
|
moveToPost('prev');
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article_noscroll"] = function() {
|
hotkey_actions["next_article_noscroll"] = function() {
|
||||||
moveToPost('next', true);
|
moveToPost('next', true);
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article_noscroll"] = function() {
|
hotkey_actions["prev_article_noscroll"] = function() {
|
||||||
moveToPost('prev', true);
|
moveToPost('prev', true);
|
||||||
};
|
};
|
||||||
hotkey_actions["next_article_noexpand"] = function() {
|
hotkey_actions["next_article_noexpand"] = function() {
|
||||||
moveToPost('next', true, true);
|
moveToPost('next', true, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["prev_article_noexpand"] = function() {
|
hotkey_actions["prev_article_noexpand"] = function() {
|
||||||
moveToPost('prev', true, true);
|
moveToPost('prev', true, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["collapse_article"] = function() {
|
hotkey_actions["collapse_article"] = function() {
|
||||||
var id = getActiveArticleId();
|
var id = getActiveArticleId();
|
||||||
var elem = $("CICD-"+id);
|
var elem = $("CICD-"+id);
|
||||||
|
|
||||||
|
@ -311,8 +315,8 @@ function init() {
|
||||||
cdmExpandArticle(id);
|
cdmExpandArticle(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_expand"] = function() {
|
hotkey_actions["toggle_expand"] = function() {
|
||||||
var id = getActiveArticleId();
|
var id = getActiveArticleId();
|
||||||
var elem = $("CICD-"+id);
|
var elem = $("CICD-"+id);
|
||||||
|
|
||||||
|
@ -324,48 +328,48 @@ function init() {
|
||||||
cdmExpandArticle(id);
|
cdmExpandArticle(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["search_dialog"] = function() {
|
hotkey_actions["search_dialog"] = function() {
|
||||||
search();
|
search();
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_mark"] = function() {
|
hotkey_actions["toggle_mark"] = function() {
|
||||||
selectionToggleMarked(undefined, false, true);
|
selectionToggleMarked(undefined, false, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_publ"] = function() {
|
hotkey_actions["toggle_publ"] = function() {
|
||||||
selectionTogglePublished(undefined, false, true);
|
selectionTogglePublished(undefined, false, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_unread"] = function() {
|
hotkey_actions["toggle_unread"] = function() {
|
||||||
selectionToggleUnread(undefined, false, true);
|
selectionToggleUnread(undefined, false, true);
|
||||||
};
|
};
|
||||||
hotkey_actions["edit_tags"] = function() {
|
hotkey_actions["edit_tags"] = function() {
|
||||||
var id = getActiveArticleId();
|
var id = getActiveArticleId();
|
||||||
if (id) {
|
if (id) {
|
||||||
editArticleTags(id);
|
editArticleTags(id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
hotkey_actions["open_in_new_window"] = function() {
|
hotkey_actions["open_in_new_window"] = function() {
|
||||||
if (getActiveArticleId()) {
|
if (getActiveArticleId()) {
|
||||||
openArticleInNewWindow(getActiveArticleId());
|
openArticleInNewWindow(getActiveArticleId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["catchup_below"] = function() {
|
hotkey_actions["catchup_below"] = function() {
|
||||||
catchupRelativeToArticle(1);
|
catchupRelativeToArticle(1);
|
||||||
};
|
};
|
||||||
hotkey_actions["catchup_above"] = function() {
|
hotkey_actions["catchup_above"] = function() {
|
||||||
catchupRelativeToArticle(0);
|
catchupRelativeToArticle(0);
|
||||||
};
|
};
|
||||||
hotkey_actions["article_scroll_down"] = function() {
|
hotkey_actions["article_scroll_down"] = function() {
|
||||||
var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
|
var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
|
||||||
|
|
||||||
scrollArticle(40);
|
scrollArticle(40);
|
||||||
};
|
};
|
||||||
hotkey_actions["article_scroll_up"] = function() {
|
hotkey_actions["article_scroll_up"] = function() {
|
||||||
var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
|
var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
|
||||||
|
|
||||||
scrollArticle(-40);
|
scrollArticle(-40);
|
||||||
};
|
};
|
||||||
hotkey_actions["close_article"] = function() {
|
hotkey_actions["close_article"] = function() {
|
||||||
if (isCdmMode()) {
|
if (isCdmMode()) {
|
||||||
if (!getInitParam("cdm_expanded")) {
|
if (!getInitParam("cdm_expanded")) {
|
||||||
cdmCollapseArticle(false, getActiveArticleId());
|
cdmCollapseArticle(false, getActiveArticleId());
|
||||||
|
@ -373,8 +377,8 @@ function init() {
|
||||||
} else {
|
} else {
|
||||||
closeArticlePanel();
|
closeArticlePanel();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["email_article"] = function() {
|
hotkey_actions["email_article"] = function() {
|
||||||
if (typeof emailArticle != "undefined") {
|
if (typeof emailArticle != "undefined") {
|
||||||
emailArticle();
|
emailArticle();
|
||||||
} else if (typeof mailtoArticle != "undefined") {
|
} else if (typeof mailtoArticle != "undefined") {
|
||||||
|
@ -382,103 +386,103 @@ function init() {
|
||||||
} else {
|
} else {
|
||||||
alert(__("Please enable mail plugin first."));
|
alert(__("Please enable mail plugin first."));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["select_all"] = function() {
|
hotkey_actions["select_all"] = function() {
|
||||||
selectArticles('all');
|
selectArticles('all');
|
||||||
};
|
};
|
||||||
hotkey_actions["select_unread"] = function() {
|
hotkey_actions["select_unread"] = function() {
|
||||||
selectArticles('unread');
|
selectArticles('unread');
|
||||||
};
|
};
|
||||||
hotkey_actions["select_marked"] = function() {
|
hotkey_actions["select_marked"] = function() {
|
||||||
selectArticles('marked');
|
selectArticles('marked');
|
||||||
};
|
};
|
||||||
hotkey_actions["select_published"] = function() {
|
hotkey_actions["select_published"] = function() {
|
||||||
selectArticles('published');
|
selectArticles('published');
|
||||||
};
|
};
|
||||||
hotkey_actions["select_invert"] = function() {
|
hotkey_actions["select_invert"] = function() {
|
||||||
selectArticles('invert');
|
selectArticles('invert');
|
||||||
};
|
};
|
||||||
hotkey_actions["select_none"] = function() {
|
hotkey_actions["select_none"] = function() {
|
||||||
selectArticles('none');
|
selectArticles('none');
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_refresh"] = function() {
|
hotkey_actions["feed_refresh"] = function() {
|
||||||
if (getActiveFeedId() != undefined) {
|
if (getActiveFeedId() != undefined) {
|
||||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
|
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat()});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_unhide_read"] = function() {
|
hotkey_actions["feed_unhide_read"] = function() {
|
||||||
toggleDispRead();
|
toggleDispRead();
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_subscribe"] = function() {
|
hotkey_actions["feed_subscribe"] = function() {
|
||||||
quickAddFeed();
|
quickAddFeed();
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_debug_update"] = function() {
|
hotkey_actions["feed_debug_update"] = function() {
|
||||||
if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
|
if (!activeFeedIsCat() && parseInt(getActiveFeedId()) > 0) {
|
||||||
window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
|
window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + getActiveFeedId() +
|
||||||
"&csrf_token=" + getInitParam("csrf_token"));
|
"&csrf_token=" + getInitParam("csrf_token"));
|
||||||
} else {
|
} else {
|
||||||
alert("You can't debug this kind of feed.");
|
alert("You can't debug this kind of feed.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hotkey_actions["feed_debug_viewfeed"] = function() {
|
hotkey_actions["feed_debug_viewfeed"] = function() {
|
||||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), viewfeed_debug: true});
|
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), viewfeed_debug: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
hotkey_actions["feed_edit"] = function() {
|
hotkey_actions["feed_edit"] = function() {
|
||||||
if (activeFeedIsCat())
|
if (activeFeedIsCat())
|
||||||
alert(__("You can't edit this kind of feed."));
|
alert(__("You can't edit this kind of feed."));
|
||||||
else
|
else
|
||||||
editFeed(getActiveFeedId());
|
editFeed(getActiveFeedId());
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_catchup"] = function() {
|
hotkey_actions["feed_catchup"] = function() {
|
||||||
if (getActiveFeedId() != undefined) {
|
if (getActiveFeedId() != undefined) {
|
||||||
catchupCurrentFeed();
|
catchupCurrentFeed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_reverse"] = function() {
|
hotkey_actions["feed_reverse"] = function() {
|
||||||
reverseHeadlineOrder();
|
reverseHeadlineOrder();
|
||||||
};
|
};
|
||||||
hotkey_actions["feed_toggle_vgroup"] = function() {
|
hotkey_actions["feed_toggle_vgroup"] = function() {
|
||||||
var query_str = "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
|
var query_str = "?op=rpc&method=togglepref&key=VFEED_GROUP_BY_FEED";
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
new Ajax.Request("backend.php", {
|
||||||
parameters: query_str,
|
parameters: query_str,
|
||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
viewCurrentFeed();
|
viewCurrentFeed();
|
||||||
} });
|
} });
|
||||||
|
|
||||||
};
|
};
|
||||||
hotkey_actions["catchup_all"] = function() {
|
hotkey_actions["catchup_all"] = function() {
|
||||||
catchupAllFeeds();
|
catchupAllFeeds();
|
||||||
};
|
};
|
||||||
hotkey_actions["cat_toggle_collapse"] = function() {
|
hotkey_actions["cat_toggle_collapse"] = function() {
|
||||||
if (activeFeedIsCat()) {
|
if (activeFeedIsCat()) {
|
||||||
dijit.byId("feedTree").collapseCat(getActiveFeedId());
|
dijit.byId("feedTree").collapseCat(getActiveFeedId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_all"] = function() {
|
hotkey_actions["goto_all"] = function() {
|
||||||
viewfeed({feed: -4});
|
viewfeed({feed: -4});
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_fresh"] = function() {
|
hotkey_actions["goto_fresh"] = function() {
|
||||||
viewfeed({feed: -3});
|
viewfeed({feed: -3});
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_marked"] = function() {
|
hotkey_actions["goto_marked"] = function() {
|
||||||
viewfeed({feed: -1});
|
viewfeed({feed: -1});
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_published"] = function() {
|
hotkey_actions["goto_published"] = function() {
|
||||||
viewfeed({feed: -2});
|
viewfeed({feed: -2});
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_tagcloud"] = function() {
|
hotkey_actions["goto_tagcloud"] = function() {
|
||||||
displayDlg(__("Tag cloud"), "printTagCloud");
|
displayDlg(__("Tag cloud"), "printTagCloud");
|
||||||
};
|
};
|
||||||
hotkey_actions["goto_prefs"] = function() {
|
hotkey_actions["goto_prefs"] = function() {
|
||||||
gotoPreferences();
|
gotoPreferences();
|
||||||
};
|
};
|
||||||
hotkey_actions["select_article_cursor"] = function() {
|
hotkey_actions["select_article_cursor"] = function() {
|
||||||
var id = getArticleUnderPointer();
|
var id = getArticleUnderPointer();
|
||||||
if (id) {
|
if (id) {
|
||||||
var row = $("RROW-" + id);
|
var row = $("RROW-" + id);
|
||||||
|
@ -494,25 +498,25 @@ function init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["create_label"] = function() {
|
hotkey_actions["create_label"] = function() {
|
||||||
addLabel();
|
addLabel();
|
||||||
};
|
};
|
||||||
hotkey_actions["create_filter"] = function() {
|
hotkey_actions["create_filter"] = function() {
|
||||||
quickAddFilter();
|
quickAddFilter();
|
||||||
};
|
};
|
||||||
hotkey_actions["collapse_sidebar"] = function() {
|
hotkey_actions["collapse_sidebar"] = function() {
|
||||||
collapse_feedlist();
|
collapse_feedlist();
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_embed_original"] = function() {
|
hotkey_actions["toggle_embed_original"] = function() {
|
||||||
if (typeof embedOriginalArticle != "undefined") {
|
if (typeof embedOriginalArticle != "undefined") {
|
||||||
if (getActiveArticleId())
|
if (getActiveArticleId())
|
||||||
embedOriginalArticle(getActiveArticleId());
|
embedOriginalArticle(getActiveArticleId());
|
||||||
} else {
|
} else {
|
||||||
alert(__("Please enable embed_original plugin first."));
|
alert(__("Please enable embed_original plugin first."));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_widescreen"] = function() {
|
hotkey_actions["toggle_widescreen"] = function() {
|
||||||
if (!isCdmMode()) {
|
if (!isCdmMode()) {
|
||||||
_widescreen_mode = !_widescreen_mode;
|
_widescreen_mode = !_widescreen_mode;
|
||||||
|
|
||||||
|
@ -524,11 +528,11 @@ function init() {
|
||||||
} else {
|
} else {
|
||||||
alert(__("Widescreen is not available in combined mode."));
|
alert(__("Widescreen is not available in combined mode."));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
hotkey_actions["help_dialog"] = function() {
|
hotkey_actions["help_dialog"] = function() {
|
||||||
helpDialog("main");
|
helpDialog("main");
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_combined_mode"] = function() {
|
hotkey_actions["toggle_combined_mode"] = function() {
|
||||||
notify_progress("Loading, please wait...");
|
notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
var value = isCdmMode() ? "false" : "true";
|
var value = isCdmMode() ? "false" : "true";
|
||||||
|
@ -538,14 +542,14 @@ function init() {
|
||||||
parameters: query,
|
parameters: query,
|
||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
setInitParam("combined_display_mode",
|
setInitParam("combined_display_mode",
|
||||||
!getInitParam("combined_display_mode"));
|
!getInitParam("combined_display_mode"));
|
||||||
|
|
||||||
closeArticlePanel();
|
closeArticlePanel();
|
||||||
viewCurrentFeed();
|
viewCurrentFeed();
|
||||||
|
|
||||||
} });
|
} });
|
||||||
};
|
};
|
||||||
hotkey_actions["toggle_cdm_expanded"] = function() {
|
hotkey_actions["toggle_cdm_expanded"] = function() {
|
||||||
notify_progress("Loading, please wait...");
|
notify_progress("Loading, please wait...");
|
||||||
|
|
||||||
var value = getInitParam("cdm_expanded") ? "false" : "true";
|
var value = getInitParam("cdm_expanded") ? "false" : "true";
|
||||||
|
@ -557,8 +561,9 @@ function init() {
|
||||||
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
||||||
viewCurrentFeed();
|
viewCurrentFeed();
|
||||||
} });
|
} });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
} 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");
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,43 @@
|
||||||
dojo.addOnLoad(function() {
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
||||||
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
|
dojo.addOnLoad(function () {
|
||||||
if (row) {
|
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
|
||||||
console.log("af_zz_noautoplay!");
|
if (row) {
|
||||||
console.log(row);
|
console.log("af_zz_noautoplay!");
|
||||||
|
console.log(row);
|
||||||
|
|
||||||
var videos = row.getElementsByTagName("video");
|
var videos = row.getElementsByTagName("video");
|
||||||
console.log(row.innerHTML);
|
console.log(row.innerHTML);
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) {
|
|
||||||
if (row) {
|
|
||||||
var videos = row.getElementsByTagName("video");
|
|
||||||
|
|
||||||
for (i = 0; i < videos.length; i++) {
|
|
||||||
videos[i].removeAttribute("autoplay");
|
|
||||||
videos[i].pause();
|
|
||||||
videos[i].onclick = function() {
|
|
||||||
this.paused ? this.play() : this.pause();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
|
||||||
|
if (row) {
|
||||||
|
var videos = row.getElementsByTagName("video");
|
||||||
|
|
||||||
|
for (i = 0; i < videos.length; i++) {
|
||||||
|
videos[i].removeAttribute("autoplay");
|
||||||
|
videos[i].pause();
|
||||||
|
videos[i].onclick = function () {
|
||||||
|
this.paused ? this.play() : this.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
|
@ -22,26 +22,30 @@ function expandSizeWrapper(id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dojo.addOnLoad(function() {
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
||||||
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
|
|
||||||
if (getInitParam('cdm_expanded')) {
|
|
||||||
|
|
||||||
window.setTimeout(function() {
|
dojo.addOnLoad(function() {
|
||||||
if (row) {
|
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
|
||||||
if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
|
if (getInitParam('cdm_expanded')) {
|
||||||
var content = row.select(".cdmContentInner")[0];
|
|
||||||
|
|
||||||
if (content) {
|
window.setTimeout(function() {
|
||||||
content.innerHTML = "<div class='contentSizeWrapper'>" +
|
if (row) {
|
||||||
content.innerHTML + "</div><button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' "+
|
if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
|
||||||
"href='#'>" + __("Click to expand article") + "</button>";
|
var content = row.select(".cdmContentInner")[0];
|
||||||
|
|
||||||
|
if (content) {
|
||||||
|
content.innerHTML = "<div class='contentSizeWrapper'>" +
|
||||||
|
content.innerHTML + "</div><button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' "+
|
||||||
|
"href='#'>" + __("Click to expand article") + "</button>";
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 150);
|
||||||
}, 150);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue