// ==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); } }