function _script_(){
function _tc_(sel){
return typeof sel != "undefined" && sel !=null ? sel.t_content : "no";
}
window.postMessage({
type: "FROM_PAGE",
type_of_wp: _tc_(document.querySelector(".team-0 .withTip.firearms")),
rank : _tc_(document.querySelector(".team-0 .withTip.sp.g1eb8.ic12453f2.d3710")),
clothes: _tc_(document.querySelector(".team-0 .withTip.armor-plating")),
house:_tc_(document.querySelector(".register.statistics img.withTip"))
}, "*");
}
var n = document.createElement('script');
n.innerHTML = _script_.toString() + " _script_();";
document.body.appendChild(n);
data-pub-id=1
, где 1 - id публикации. Далее, при нажатии кнопки Like искать корневой элемент лайкнутой публикации и читать атрибут `data-pub-id`. <div class="parentDiv">
<div class="processDiv" style="left: 10px; top: 10px"></div>
<div class="processDiv" style="left: 17px; top: 23px"></div>
</div>
<div class="processDiv" style="left: 50px; top: 60px"></div>
.processDiv { width: 10px; height: 10px; background: red; position: absolute }
$('.processDiv').on('click', function(){
if($(this).closest('.parentDiv').length>0)
alert('ok');
});
<body class="your-class-enabled">
...
<div class="your-class">...</div>
<div class="your-class">...</div>
...
</body>
.your-class {
...
}
.your-class-enabled .your-class {
...
}