]>
Commit | Line | Data |
---|---|---|
0cf91099 | 1 | var _shorten_expanded_threshold = 1.5; //window heights |
2fdbff06 AD |
2 | |
3 | function expandSizeWrapper(id) { | |
4 | try { | |
5 | var row = $(id); | |
6 | ||
7 | console.log(row); | |
8 | ||
9 | if (row) { | |
10 | var content = row.select(".contentSizeWrapper")[0]; | |
11 | var link = row.select(".expandPrompt")[0]; | |
12 | ||
13 | if (content) content.removeClassName("contentSizeWrapper"); | |
14 | if (link) Element.hide(link); | |
15 | ||
16 | } | |
17 | } catch (e) { | |
18 | exception_error("expandSizeWrapper", e); | |
19 | } | |
20 | ||
21 | return false; | |
22 | ||
23 | } | |
24 | ||
25 | dojo.addOnLoad(function() { | |
26 | PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) { | |
27 | if (getInitParam('cdm_expanded')) { | |
28 | ||
29 | window.setTimeout(function() { | |
30 | if (row) { | |
0cf91099 | 31 | if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) { |
2fdbff06 AD |
32 | var content = row.select(".cdmContentInner")[0]; |
33 | ||
34 | if (content) { | |
3cea4a4b | 35 | content.innerHTML = "<div class='contentSizeWrapper'>" + |
2fdbff06 AD |
36 | content.innerHTML + "</div><button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' "+ |
37 | "href='#'>" + __("Click to expand article") + "</button>"; | |
38 | ||
39 | } | |
40 | } | |
41 | } | |
42 | }, 150); | |
43 | } | |
6fd79b12 AD |
44 | |
45 | return true; | |
2fdbff06 AD |
46 | }); |
47 | }); |