Skip to content

Instantly share code, notes, and snippets.

@romejiang
Created January 20, 2017 04:59
Show Gist options
  • Save romejiang/2c0cc658c4b6e97cf1cf2907730bd8f2 to your computer and use it in GitHub Desktop.
Save romejiang/2c0cc658c4b6e97cf1cf2907730bd8f2 to your computer and use it in GitHub Desktop.
// ====================================================
// 百度刷福程序
// 进百度图片,搜“福”,然后打开 console ,运行下面的程序,不懂问王鹤
// ====================================================
var step = 3000;
var size = 500;
var imgs = $(".main_img");
var index = imgs.length - 1;
$('body').append('<div id="alipay-bg" style="-webkit-opacity:0.7;-moz-opacity:0.7;-khtml-opacity:0.7;opacity:0.7;position: fixed;background: #fff;z-index: 999;left: 0;right: 0;top: 100px;bottom: 0;"></div><div id="alipay" style="position: fixed;z-index: 9999;left: 0;right: 0;top: 0;bottom: 0;"><div style="width: '+size+'px;height: '+size+'px;margin: auto;"><img id="fu" style="background: red;width:100%;height:100%;"></img></div></div>');
$('body').append("<div id='toolbar' style='position: fixed;background: red;z-index: 9999;margin: auto;top:0;left: 0;'><button class='step' second='3'>3秒</button><button class='step' second='5'>5秒</button><button class='step' second='7'>7秒</button><button class='step' second='9'>9秒</button><button class='step' second='11'>11秒</button> "+ imgs.length + "</div>");
$(".step").bind("click",function(){
// console.log(this);
step = parseInt($(this).attr('second')) * 1000;
});
function main(idx) {
if (imgs[idx]) {
$("#fu").attr('src', imgs[idx].src);
}
index--;
if (index < 0) index = imgs.length - 1;
setTimeout(function() {
main(index);
}, step);
}
setTimeout(function() {
main(index);
}, step);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment