Last active
December 17, 2015 05:39
-
-
Save fuqunaga/5559227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prog(url,html) | |
{ | |
var ajax = function(next_url, func){ | |
return next_url && func(next_url, function(data){ | |
prog(next_url, data); | |
}); | |
} | |
var get_func = function(next_url){ return ajax(next_url, $.get)}; | |
var post_func = function(next_url){ return ajax(next_url, $.post)}; | |
var link = function(btn_sel) | |
{ | |
return function(){ | |
return get_func($(html).find(btn_sel).attr('href')); | |
}; | |
}; | |
var flash_next = function(){ | |
var m = html.match(/_root\.next_url.*\"(.+)\"/); | |
return get_func(m && m[1]); | |
}; | |
var funcs = { | |
'/marathon/progress': flash_next | |
,'/marathon/flash': flash_next | |
,'/marathon/spark_result': link('.CenterBtn a') | |
,'/marathon': link('.MainBtn a') | |
,'/event': link('.event-link-btn a') | |
,'/eigyo/progress': flash_next | |
,'/eigyo/flash': flash_next | |
,'/eigyo': link('.MainBtn a') | |
,'/auditionbattle/chain': function(){ | |
return post_func($('.CenterBtn').parent('form').attr('action')); | |
} | |
}; | |
var matched=false; | |
for(var key in funcs) | |
{ | |
if ( url.match('index.php'+key) ) | |
{ | |
$('#ipop ul').append($('<li/>').text(key+' '+$("[class='heading cap-02']").first().text())); | |
matched=funcs[key](); | |
break; | |
} | |
} | |
if ( !matched ) location.assign(url); | |
} | |
$('body').append($('<div id=ipop>').css({ | |
top:$(document).scrollTop()+100, | |
left:50, | |
position:'absolute', | |
opacity:0.8, | |
color:'white', | |
'background-color':'#404040' | |
}).append('<ul/>').fadeIn()); | |
prog(location.href, $('body').html()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment