-$(document).ready(function(){
+var nextBodyIdx = 0;
+
+$(document).ready(function() {
+ loc = window.location.pathname;
+ if (loc.startsWith('/display')) {
+ return;
+ }
+
$("head").append('<style type="text/css"></style>');
var newStyleElement = $("head").children(':last');
- newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden;}');
+ newStyleElement.html('.limit-height{max-height: ' + postLimitHeight + 'px; overflow: hidden; }');
handleNewWallItemBodies();
return;
}
+ if (!$el.attr("id")) {
+ $el.attr("id", nextBodyIdx++);
+ }
addHeightToggleHandler($el);
var limited = processHeightLimit($el);
if (!limited) {
- var mutationObserver = new MutationObserver(function(mutations) {
+ var mutationObserver = new MutationObserver(function() {
var limited = processHeightLimit($el);
if (limited) {
mutationObserver.disconnect()
}
});
- mutationObserver.observe($el[0], { attributes: true, characterData: true, childList: true, subtree: true, attributeOldValue: true, characterDataOldValue: true });
+ mutationObserver.observe($el[0], {
+ attributes: true,
+ characterData: true,
+ childList: true,
+ subtree: true,
+ attributeOldValue: true,
+ characterDataOldValue: true
+ });
- $el.imagesLoaded().then(function(){
+ $el.imagesLoaded().then(function() {
processHeightLimit($el);
});
}
function addHeightToggleHandler($item) {
var itemId = parseInt($item.attr("id").replace("wall-item-body-", ""));
$item.data("item-id", itemId);
- var wrapperId = "wall-item-body-wrapper-" + itemId;
var toggleId = "wall-item-body-toggle-" + itemId;
- $item.wrap('<div id="' + wrapperId + '" class="wall-item-body-wrapper"></div>');
- $("#" + wrapperId).append('<div class="wall-item-body-toggle" data-item-id="' + itemId + '" id="' + toggleId + '" ><a href="javascript:void(0)" class="wall-item-body-toggle-text">Show more ...</a></div>');
+ $item.append('<div class="wall-item-body-toggle" data-item-id="' + itemId + '" id="' + toggleId + '" ><button type="button" class="wall-item-body-toggle-text">' + showmore_dyn_showmore_linktext + '</button></div>');
$item.addClass("limitable limit-height");
var $toggle = $("#" + toggleId);
return true;
}
}
-
-