Created
October 4, 2009 16:05
-
-
Save nanakoso/201453 to your computer and use it in GitHub Desktop.
[pixv] Insert Bookmarks with AutoPagerize
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
// ==UserScript== | |
// @name [pixv] Insert Bookmarks with AutoPagerize | |
// @version 0.41 | |
// @namespace http://www14.atwiki.jp/pixivhacker/ | |
// @description 『イラストの下に「このイラストをブックマークしているユーザー」を表示します。』のAutoPagerize対応判 Ver.4.0 | |
// @include http://www.pixiv.net/member_illust.php?mode=medium&illust_id=* | |
// @require https://gist.github.com/raw/3242/9dc0cdee5e975d275c7ab71f581d272eb316674f/dollarX.js | |
// ==/UserScript== | |
try{ | |
var content2 = unsafeWindow.$('contents'); | |
if(content2){ | |
var illustid = location.href.match(/\d+/); | |
var url = "http://www.pixiv.net/bookmark_detail.php?illust_id=" + illustid | |
if(unsafeWindow.AutoPagerize){ | |
alert("このユーザースクリプト([pixv] Insert Bookmarks with AutoPagerize)は\nAutoPagerizeより前に読み込まれるようグリースモンキーを設定しないと動作しません。"); | |
return; | |
}else{ | |
window.addEventListener('GM_AutoPagerizeLoaded', callAddFilter, false); | |
} | |
var div = document.createElement("div"); | |
div.className="autopagerize_page_element"; | |
var a = document.createElement("a"); | |
a.href = url; | |
a.appendChild(document.createTextNode("次の")); | |
a.setAttribute("rel", "next"); | |
a.style.visibility="hidden"; | |
div.appendChild(a); | |
content2.appendChild(div); | |
} | |
}catch(e0){ | |
GM_log("exception0"+e0); | |
} | |
function addPageElement(elm){ | |
var tmpName = elm.className; | |
tmpName += " autopagerize_page_element"; | |
elm.className = tmpName; | |
} | |
function callAddFilter(){ | |
this.$X = $X; | |
try{ | |
unsafeWindow.AutoPagerize.addDocumentFilter( | |
function(htmlDoc,requestURL,siteinfo){ | |
try{ | |
var page = $X('.//div[@class="bookmark_detail_body"]',htmlDoc)[0]; | |
var a = null; | |
if(page){ | |
addPageElement(page); | |
page.style.background = "none #FFFFFF"; | |
a = $X('.//a[contains(text(),"次へ")]',page)[0]; | |
if(a){ | |
a.setAttribute("rel", "next"); | |
} | |
} | |
if(a==null){ | |
var footer = $X('.//div[@class="one_column"][position()=2]',htmlDoc)[0]; | |
if(footer){ | |
addPageElement(footer); | |
} | |
} | |
}catch(e2){ | |
GM_log("exception2:"+e2); | |
} | |
} | |
); | |
}catch(e1){ | |
GM_log("exception1:"+e1); | |
} | |
} |
レイアウト修正。
ついでにその人の作品一覧を下に
追加するようにした。
AutoPagerizeとの順番違いの警告ダイアログが出ていなかったのを修正。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PIXIVのリニューアルに対応 2010/07/20