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) {
|
|
|
|
try {
|
2018-11-30 05:39:45 +00:00
|
|
|
const row = $(id);
|
2013-07-31 14:58:56 +00:00
|
|
|
|
|
|
|
console.log(row);
|
|
|
|
|
|
|
|
if (row) {
|
2018-11-30 05:39:45 +00:00
|
|
|
const content = row.select(".contentSizeWrapper")[0];
|
|
|
|
const link = row.select(".expandPrompt")[0];
|
2013-07-31 14:58:56 +00:00
|
|
|
|
|
|
|
if (content) content.removeClassName("contentSizeWrapper");
|
|
|
|
if (link) Element.hide(link);
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("expandSizeWrapper", e);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-08-10 07:01:05 +00:00
|
|
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
2013-07-31 14:58:56 +00:00
|
|
|
|
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
|
|
|
});
|
2016-08-10 07:01:05 +00:00
|
|
|
|
2013-07-31 14:58:56 +00:00
|
|
|
});
|