diff --git a/app/assets/javascripts/bulletin/wpex.min.js b/app/assets/javascripts/bulletin/wpex.min.js index e78c567..0c5af37 100644 --- a/app/assets/javascripts/bulletin/wpex.min.js +++ b/app/assets/javascripts/bulletin/wpex.min.js @@ -2471,12 +2471,26 @@ var wpex = {}; var filter_constraints = filter_constraint.split(",") filter_constraints.forEach(function(vv){ var rm_attr = ""; + var clone_mode = false; + var max_count = -1; if(vv[0] == "["){ - var attr_pair = vv.slice(1,-1).split("="); - attr_pair = attr_pair.map(function(v){ return v.match(/[^"^']+/)[0]}); - attr_pair[0] = attr_pair[0].replace("*",""); - $div.attr(attr_pair[0],attr_pair[1]); - rm_attr = attr_pair[0]; + if(vv.search('=') != -1){ + var attr_pair = vv.slice(1,-1).split("="); + attr_pair = attr_pair.map(function(v){ return v.match(/[^"^']+/)[0]}); + attr_pair[0] = attr_pair[0].replace("*",""); + $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] == "."){ $div.attr('class',vv.slice(1)); rm_attr = 'class'; @@ -2497,9 +2511,14 @@ var wpex = {}; } }) $div.append(parent_el.eq(0).prop("outerHTML")); - $div.find(window.wpexAnimsition.linkElement).remove(); - linkElements.removeAttr(rm_attr); - linkElements.appendTo($div.find("*").eq(-1)); + if(!clone_mode){ + $div.find(window.wpexAnimsition.linkElement).remove(); + 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")); @@ -2553,7 +2572,6 @@ var wpex = {}; } } window.already_changes[i] = true; - console.log("changed") return; } $container.imagesLoaded(function () {