OP AutoJoin

OP Autojoin!

当前为 2016-04-04 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         OP AutoJoin
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  OP Autojoin!
// @author       You
// @match        http://www.opiumpulses.com/giveaways*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';


$( document ).ready(function() {
    
    var url = "http://www.opiumpulses.com/giveaways?Giveaway_page=[NUM_PAGE]&Giveaway_status=active&Giveaway_who_can_join=everyone";
    
    if (window.location.href.indexOf("http://www.opiumpulses.com/giveaways/") > -1) { //dentro de una aplicación
        
        setInterval(function(){ 
            window.close();
        }, 5000);
        
    } else {
    
        var giveaways = $('.btn-success');
    
        for (var x = 0 ; x < giveaways.length && x < 10; x ++ ){
            
            giveaways[x].setAttribute('target', '_blank');
            giveaways[x].click();   
        }
        
        if (giveaways.length == 0) { //no hay mas que aplicar a en esta página 
            
            var page = getParameterByName('Giveaway_page'); 
            
            if (page == null) {
                page=1;
            } else 
            {
                page++;
            }
            
            if (page > 10 )
            {
                return;
            }
            
            window.location="http://www.opiumpulses.com/giveaways?Giveaway_page=[NUM_PAGE]&Giveaway_status=active&Giveaway_who_can_join=everyone".replace("[NUM_PAGE]", page);
            
        } else 
        {
            setInterval(function(){ 
                window.location.reload();
            }, 6000);
        }
   
    }
    
    
  
});

function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}