This commit is contained in:
BoHung Chiu 2021-05-20 15:13:39 +08:00
parent 92bb0882b2
commit 8ad7143ec2
1 changed files with 27 additions and 9 deletions

View File

@ -2471,12 +2471,26 @@ var wpex = {};
var filter_constraints = filter_constraint.split(",") var filter_constraints = filter_constraint.split(",")
filter_constraints.forEach(function(vv){ filter_constraints.forEach(function(vv){
var rm_attr = ""; var rm_attr = "";
var clone_mode = false;
var max_count = -1;
if(vv[0] == "["){ if(vv[0] == "["){
var attr_pair = vv.slice(1,-1).split("="); if(vv.search('=') != -1){
attr_pair = attr_pair.map(function(v){ return v.match(/[^"^']+/)[0]}); var attr_pair = vv.slice(1,-1).split("=");
attr_pair[0] = attr_pair[0].replace("*",""); attr_pair = attr_pair.map(function(v){ return v.match(/[^"^']+/)[0]});
$div.attr(attr_pair[0],attr_pair[1]); attr_pair[0] = attr_pair[0].replace("*","");
rm_attr = attr_pair[0]; $div.attr(attr_pair[0],attr_pair[1]);
rm_attr = attr_pair[0];
}else{
clone_mode = true;
var attr_pair = [vv.split(/\[|\]/)[1],"All"];
$(v).attr(attr_pair[0],attr_pair[1]);
$div.attr(attr_pair[0],attr_pair[1]);
var match_max_count = vv.match(/:nth-child\(-n\+(\d+)\)/)
if(match_max_count && match_max_count.length == 2){
max_count = match_max_count[1];
}
rm_attr = attr_pair[0];
}
}else if(vv[0] == "."){ }else if(vv[0] == "."){
$div.attr('class',vv.slice(1)); $div.attr('class',vv.slice(1));
rm_attr = 'class'; rm_attr = 'class';
@ -2497,9 +2511,14 @@ var wpex = {};
} }
}) })
$div.append(parent_el.eq(0).prop("outerHTML")); $div.append(parent_el.eq(0).prop("outerHTML"));
$div.find(window.wpexAnimsition.linkElement).remove(); if(!clone_mode){
linkElements.removeAttr(rm_attr); $div.find(window.wpexAnimsition.linkElement).remove();
linkElements.appendTo($div.find("*").eq(-1)); linkElements.removeAttr(rm_attr);
linkElements.appendTo($div.find("*").eq(-1));
}else if(max_count != -1){
$div.find(window.wpexAnimsition.linkElement).not(":lt("+max_count+")").remove();
$div.find(window.wpexAnimsition.linkElement).removeAttr(rm_attr);
}
} }
}) })
$divs.push($div.prop("outerHTML")); $divs.push($div.prop("outerHTML"));
@ -2553,7 +2572,6 @@ var wpex = {};
} }
} }
window.already_changes[i] = true; window.already_changes[i] = true;
console.log("changed")
return; return;
} }
$container.imagesLoaded(function () { $container.imagesLoaded(function () {