(function($) {
var mouseover = new MouseEvent("mouseover", {
bubbles: true,
cancelable: true,
view: window,
});
var click = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window,
});
$('a.j-like',document.getElementById('tphoto').contentDocument).each(function(index) {
console.log(this);
var o = this;
setTimeout(function() {
o.dispatchEvent(mouseover);
setTimeout(function() {
if (!$('span.op-num', o).data('ilike')) {
o.dispatchEvent(click);
}
}, 500);
}, index * 500);
});
})(jQuery);
转载于:https://my.oschina.net/jackin/blog/657134