summaryrefslogtreecommitdiff
path: root/plugins/shorten_expanded
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2016-08-10 10:01:05 +0300
committerAndrew Dolgov <[email protected]>2016-08-10 10:01:05 +0300
commitee5170424e8dc571b3a811e02f906aef5ee49e83 (patch)
tree3c79fb7ec06084dcee674a0e7021e9bcc4521a56 /plugins/shorten_expanded
parent25a533c432036280de057bf10ca7b673e4f4aac4 (diff)
dojo: main UI: load stuff asynchronously
Diffstat (limited to 'plugins/shorten_expanded')
-rw-r--r--plugins/shorten_expanded/init.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js
index 5e9e84aec..899f8a54d 100644
--- a/plugins/shorten_expanded/init.js
+++ b/plugins/shorten_expanded/init.js
@@ -22,26 +22,30 @@ function expandSizeWrapper(id) {
}
-dojo.addOnLoad(function() {
- PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
- if (getInitParam('cdm_expanded')) {
+require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
- window.setTimeout(function() {
- if (row) {
- if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
- var content = row.select(".cdmContentInner")[0];
+ dojo.addOnLoad(function() {
+ PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
+ if (getInitParam('cdm_expanded')) {
- if (content) {
- content.innerHTML = "<div class='contentSizeWrapper'>" +
- content.innerHTML + "</div><button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' "+
- "href='#'>" + __("Click to expand article") + "</button>";
+ window.setTimeout(function() {
+ if (row) {
+ if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
+ 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;
+ });
});
+
});