diff --git a/productMods/js/individual/individualUtils.js b/productMods/js/individual/individualUtils.js index bd79cc25..b8207d0a 100644 --- a/productMods/js/individual/individualUtils.js +++ b/productMods/js/individual/individualUtils.js @@ -5,6 +5,84 @@ $(document).ready(function(){ // "more"/"less" HTML truncator for showing more or less content in data property core:overview $('.overview-value').truncate({max_length: 500}); + // "more"/"less" HTML truncator for all properties + // $('.subclass-property-list li:gt(4)').hide(); + // $('ul li:gt(4)').hide(); + // $('.show_button').click(function() { + // $('ul li:gt(4)').show(); + // }); + + // var propList = '.property-list:not(:has(>li>ul)) li:gt(4)'; + + $.fn.exists = function () { + return this.length !== 0; + } + + $.fn.moreLess = function () { + $(this).each + } + + var togglePropDisplay = { + showMore: function($toggleLink, $itemContainer) { + $toggleLink.click(function() { + $itemContainer.show(); + $(this).attr('href', '#show less content'); + $(this).text('less'); + togglePropDisplay.showLess($toggleLink, $itemContainer); + return false; + }); + }, + + showLess: function($toggleLink, $itemContainer) { + $toggleLink.click(function() { + $itemContainer.hide(); + $(this).attr('href', '#show more content'); + $(this).text('more'); + togglePropDisplay.showMore($toggleLink, $itemContainer); + return false; + }); + } + }; + + var $propList = $('.property-list:not(:has(>li>ul))'); + $propList.each(function() { + var $additionalItems = $(this).find('li:gt(2)'); + if ( $additionalItems.exists() ) { + // create toggle link + var $toggleLink = $('more').appendTo(this); + + // create container for additional elements + var $itemContainer = $('
').appendTo(this); + + $additionalItems.appendTo($itemContainer); + + $itemContainer.hide(); + + togglePropDisplay.showMore($toggleLink, $itemContainer); + + // $wrappedItems.hide(); + + // var moreLess = $(this).find(':visible:last-child').after(' more'); + // $(additionalItems).first().before(' more'); + // $wrappedItems.before(' more'); + // togglePropDisplay.showMore($wrappedItems); + // $('.more-less').click(function() { + // $(additionalItems).show(); + // $('.more-less').attr('href', '#show less content').text('less'); + // + // }); + } + }); + + var subPropList = '.subclass-property-list'; + $(subPropList).each(function() { + var additionalItems = $(this).find('li:gt(4)'); + if ( additionalItems.exists() ) { + $(additionalItems).hide(); + $(this).append(' more'); + } + }); + // Change background color button when verbose mode is off $('a#verbosePropertySwitch:contains("Turn off")').addClass('verbose-off'); diff --git a/themes/wilma/css/wilma.css b/themes/wilma/css/wilma.css index bccfa7c3..a7eb9105 100644 --- a/themes/wilma/css/wilma.css +++ b/themes/wilma/css/wilma.css @@ -1406,7 +1406,7 @@ article.property ul.property-list { color: #5e6363; } article.property ul.property-list li a { - color: #2485ae; + /*color: #2485ae;*/ /* cappadona: seems unnecessarily specific and is overriding .more-less from individual.css so I'm commenting out for now */ line-height: 1.6em; } /* MISCELLANEOUS ------> */