aluminum-components
Advanced tools
Comparing version 0.2.10 to 0.2.11
(function ($) { | ||
'use strict'; | ||
function getReadMoreContent(container) { | ||
var content = container.children('.ReadMoreContainer-content'); | ||
if (content.length === 0) { | ||
content = container.children('.Field-item'); | ||
} | ||
return content; | ||
} | ||
function getReadMoreBottom(container) { | ||
var readMoreContainer = container.find('.ReadMoreContainer-bottom'); | ||
if (readMoreContainer.length === 0) { | ||
var link = $('<a href="#" class="ReadMoreContainer-button">') | ||
.append($('<i class="fa fa-plus-circle">')) | ||
.append('Read More'); | ||
readMoreContainer = $('<div class="ReadMoreContainer-bottom">').append(link); | ||
container.append(readMoreContainer); | ||
} | ||
return readMoreContainer; | ||
} | ||
Drupal.behaviors.readMoreContainer = { | ||
@@ -9,3 +37,4 @@ attach: function (context, settings) { | ||
var height = item.data('height') || '20em'; | ||
var content = item.children('.ReadMoreContainer-content'); | ||
var content = getReadMoreContent(item); | ||
var bottom = getReadMoreBottom(item); | ||
var originalHeight = content.height(); | ||
@@ -21,3 +50,3 @@ | ||
item.data('originalHeight', originalHeight + 'px'); | ||
item.children('.ReadMoreContainer-bottom').css({display: 'block'}); | ||
bottom.css({display: 'block'}); | ||
item.toggleClass('is-closed', true); | ||
@@ -33,3 +62,3 @@ } | ||
var closed = container.hasClass('is-closed'); | ||
var content = container.children('.ReadMoreContainer-content'); | ||
var content = getReadMoreContent(container) | ||
var html = closed ? '<i class="fa fa-minus-circle"></i> Read Less' : '<i class="fa fa-plus-circle"></i> Read More'; | ||
@@ -36,0 +65,0 @@ var newHeight = closed ? container.data('originalHeight') : container.data('height') || '20em'; |
{ | ||
"name": "aluminum-components", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "A set of reusable web components (JS, SCSS mixins and styles, and template examples) for quickly building custom themes and web applications.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58789
148