Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore the legacy limit_height script
- Loading branch information
Showing
15 changed files
with
69 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
window.addEventListener('DOMContentLoaded', function() { | ||
document.querySelectorAll('div.limit_height').forEach(function(div) { | ||
window.console && console.warn('Using "limit_height" class on child_record_callback is deprecated. Set a list.sorting.limitHeight in your DCA instead.'); | ||
|
||
const parent = div.parentNode.closest('.tl_content'); | ||
|
||
// Return if the element is a wrapper | ||
if (parent && (parent.classList.contains('wrapper_start') || parent.classList.contains('wrapper_stop'))) return; | ||
|
||
const hgt = Number(div.className.replace(/[^0-9]*/, '')) | ||
|
||
// Return if there is no height value | ||
if (!hgt) return; | ||
|
||
const style = window.getComputedStyle(div, null); | ||
const padding = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); | ||
const height = div.clientHeight - padding; | ||
|
||
// Do not add the toggle if the preview height is below the max-height | ||
if (height <= hgt) return; | ||
|
||
// Resize the element if it is higher than the maximum height | ||
div.style.height = hgt+'px'; | ||
|
||
const button = document.createElement('button'); | ||
button.setAttribute('type', 'button'); | ||
button.title = Contao.lang.expand; | ||
button.innerHTML = '<span>...</span>'; | ||
button.classList.add('unselectable'); | ||
|
||
button.addEventListener('click', function() { | ||
if (div.style.height == 'auto') { | ||
div.style.height = hgt+'px'; | ||
button.title = Contao.lang.expand; | ||
} else { | ||
div.style.height = 'auto'; | ||
button.title = Contao.lang.collapse; | ||
} | ||
}); | ||
|
||
const toggler = document.createElement('div'); | ||
toggler.classList.add('limit_toggler'); | ||
toggler.append(button); | ||
|
||
div.append(toggler); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...ntao/themes/flexible/backend.c0eb0f53.css → ...ntao/themes/flexible/backend.d98ca954.css
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"backend.js": "/bundles/contaocore/backend.10759865.js", | ||
"backend.10759865.js.map": "/bundles/contaocore/backend.10759865.js.map" | ||
"backend.js": "/bundles/contaocore/backend.d672c357.js", | ||
"backend.d672c357.js.map": "/bundles/contaocore/backend.d672c357.js.map" | ||
} |