2015-07-07 13:43:22 +00:00
|
|
|
var _shorten_expanded_threshold = 1.5; //window heights
|
2013-07-31 14:58:56 +00:00
|
|
|
|
|
|
|
function expandSizeWrapper(id) {
|
2018-12-03 10:38:13 +00:00
|
|
|
const row = $(id);
|
2013-07-31 14:58:56 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
if (row) {
|
|
|
|
const content = row.select(".contentSizeWrapper")[0];
|
|
|
|
const link = row.select(".expandPrompt")[0];
|
2013-07-31 14:58:56 +00:00
|
|
|
|
2018-12-03 10:38:13 +00:00
|
|
|
if (content) content.removeClassName("contentSizeWrapper");
|
|
|
|
if (link) Element.hide(link);
|
2013-07-31 14:58:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-08-10 07:01:05 +00:00
|
|
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
2016-08-10 09:22:55 +00:00
|
|
|
ready(function() {
|
2016-08-10 07:01:05 +00:00
|
|
|
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
|
2018-11-30 10:51:54 +00:00
|
|
|
window.setTimeout(function() {
|
|
|
|
if (row) {
|
2018-11-30 12:48:17 +00:00
|
|
|
const c_inner = row.select(".content-inner")[0];
|
|
|
|
const c_inter = row.select(".intermediate")[0];
|
2013-07-31 14:58:56 +00:00
|
|
|
|
2018-11-30 10:51:54 +00:00
|
|
|
if (c_inner && c_inter &&
|
|
|
|
row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) {
|
2013-07-31 14:58:56 +00:00
|
|
|
|
2018-11-30 10:51:54 +00:00
|
|
|
c_inter.parentNode.removeChild(c_inter);
|
2016-08-10 07:01:05 +00:00
|
|
|
|
2018-11-30 10:51:54 +00:00
|
|
|
c_inner.innerHTML = "<div class='contentSizeWrapper'>" +
|
|
|
|
c_inner.innerHTML +
|
|
|
|
c_inter.innerHTML + "</div>" +
|
|
|
|
"<button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' href='#'>" +
|
|
|
|
__("Click to expand article") + "</button>";
|
2013-07-31 14:58:56 +00:00
|
|
|
}
|
2018-11-30 10:51:54 +00:00
|
|
|
}
|
|
|
|
}, 150);
|
2015-07-31 10:42:39 +00:00
|
|
|
|
2016-08-10 07:01:05 +00:00
|
|
|
return true;
|
|
|
|
});
|
2013-07-31 14:58:56 +00:00
|
|
|
});
|
|
|
|
});
|