Galerie und tage

This commit is contained in:
2021-11-23 17:56:26 +01:00
parent ff35366279
commit 5f873bee89
4693 changed files with 149659 additions and 301447 deletions

View File

@@ -2,11 +2,12 @@
exports.type = 'perItem';
exports.active = true;
exports.active = false;
exports.description = 'removes viewBox attribute when possible';
exports.description = 'removes viewBox attribute when possible (disabled by default)';
var viewBoxElems = ['svg', 'pattern', 'symbol'];
var regViewBox = /^0\s0\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)\s([\-+]?\d*\.?\d+([eE][\-+]?\d+)?)$/,
viewBoxElems = ['svg', 'pattern'];
/**
* Remove viewBox attr which coincides with a width/height box.
@@ -32,15 +33,15 @@ exports.fn = function(item) {
item.hasAttr('height')
) {
var nums = item.attr('viewBox').value.split(/[ ,]+/g);
var match = item.attr('viewBox').value.match(regViewBox);
if (
nums[0] === '0' &&
nums[1] === '0' &&
item.attr('width').value.replace(/px$/, '') === nums[2] && // could use parseFloat too
item.attr('height').value.replace(/px$/, '') === nums[3]
) {
item.removeAttr('viewBox');
if (match) {
if (
item.attr('width').value === match[1] &&
item.attr('height').value === match[3]
) {
item.removeAttr('viewBox');
}
}
}