Skip to content

Instantly share code, notes, and snippets.

@lolicsystem
Created July 29, 2010 15:37
Show Gist options
  • Save lolicsystem/498445 to your computer and use it in GitHub Desktop.
Save lolicsystem/498445 to your computer and use it in GitHub Desktop.
PixivのStaccfeedで、Auto Pager (自動継ぎ足し)するグリモン
// ==UserScript==
// @name StaccfeedAutoPager
// @namespace http://github.com/lolicsystem
// @description Auto-pager for Staccfeed in Pixiv
// @include http://www.pixiv.net/stacc/*
// @author Chiemimaru Kai (lolicsystem)
// @version 0.1
// ==/UserScript==
(function(){
var target = document.getElementById("insert_next_status");
var w = unsafeWindow;
if (target) {
var elementPosY = function(element) {
var posY = 0;
do {
posY += element.offsetTop || 0;
element = element.offsetParent;
} while (element);
return posY;
}
var isReached = function(element) {
return (elementPosY(element) < window.scrollY + document.documentElement.clientHeight);
}
var click_bt_more = function() {
if (isReached(target)) {
with(w) {
if (!STACC_motto_flag) {
$j("#no_stacc").remove();
if (STACC_click_possible) {
STACC_click_possible = false;
STACC_motto_flag = true;
$j("#now_loading").show();
$j(".bt_more a").css("cursor","default");
$j(".bt_more").fadeTo("slow", 0, function() {
_refreshTimeline(STACC_next_max_sid);
});
}
}
}
}
}
window.addEventListener("scroll", click_bt_more, false);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment