]>
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 | ||
ee517042 | 25 | require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { |
2fdbff06 | 26 | |
f6d2787a | 27 | ready(function() { |
ee517042 AD |
28 | PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) { |
29 | if (getInitParam('cdm_expanded')) { | |
2fdbff06 | 30 | |
ee517042 AD |
31 | window.setTimeout(function() { |
32 | if (row) { | |
33 | if (row.offsetHeight >= _shorten_expanded_threshold * window.innerHeight) { | |
34 | var content = row.select(".cdmContentInner")[0]; | |
2fdbff06 | 35 | |
ee517042 AD |
36 | if (content) { |
37 | content.innerHTML = "<div class='contentSizeWrapper'>" + | |
38 | content.innerHTML + "</div><button class='expandPrompt' onclick='return expandSizeWrapper(\""+row.id+"\")' "+ | |
39 | "href='#'>" + __("Click to expand article") + "</button>"; | |
40 | ||
41 | } | |
2fdbff06 AD |
42 | } |
43 | } | |
ee517042 AD |
44 | }, 150); |
45 | } | |
6fd79b12 | 46 | |
ee517042 AD |
47 | return true; |
48 | }); | |
2fdbff06 | 49 | }); |
ee517042 | 50 | |
2fdbff06 | 51 | }); |