auto slides
@@ -1,20 +1,68 @@
/*
* @title auto slides
- * @description slide paging with Autopagerize/AutoPatchwork
+ * @description slide paging with AutoPagerize/AutoPatchwork
* @include http://*
* @contributor vzvu3k6k http://let.hatelabo.jp/vzvu3k6k/let/hLHX5ZrPpLVS
- * @author noromanba
- * @license Public Domain
+ * @author noromanba http://let.hatelabo.jp/noromanba/let/gYC-x-XT8IHVbA
+ * @license Public Domain https://creativecommons.org/licenses/publicdomain/
*/
-(function anonwrap() {
+(function () {
+ var slide = function () {
+ var seps = document.querySelectorAll('.autopagerize_page_separator');
+ if (seps.length < 1) return;
-var seps = document.querySelectorAll('[class^="autopagerize_page_separator"]'),
- end = seps[seps.length - 1].hasChildNodes() ? seps[seps.length - 1] : seps[seps.length - 2],
- start = end.parentNode.firstElementChild;
- range = document.createRange();
-range.setStart(start, 0);
-range.setEnd(end, 0);
-range.deleteContents();
+ // XXX depends style settings as user
+ var end = seps[seps.length - 1];
+ var start = end.parentElement.className.match(/autopagerize_page_separator_blocks/) ?
+ end.parentNode.parentNode.firstElementChild : // AutoPatchWork
+ end.parentNode.firstElementChild; // AutoPagerize
+ var range = document.createRange();
+ range.setStart(start, 0);
+ range.setEnd(end, 0);
+ range.deleteContents();
+ };
+ slide();
+
+// XXX throttling load problem. XHR storm like DoS; check height, times or lazy paging
+/*
+ // TODO MutationObserver/debouncing Mutation call
+ document.body.addEventListener('AutoPatchWork.DOMNodeInserted', function (_) {
+ slide();
+ }, false);
+ document.body.addEventListener('AutoPagerize_DOMNodeInserted', function (_) {
+ slide();
+ }, false);
+//*/
})();
+
+// # Separator structure
+// - Chrome(mium) Extention
+// - default settings
+//
+// ## AutoPagerize
+// ### HTML
+// <hr class="autopagerize_page_separator">
+// <p class="autopagerize_page_info">page: <a class="autopagerize_link" href="http://example.com?page=2">2</a>
+// </p>
+//
+// ## AutoPatchwork
+// ### Styles
+//
+// .autopagerize_page_separator_blocks .autopagerize_link{
+// display:inline-block;
+// }
+// .autopagerize_page_separator_blocks .autopagerize_link:before{
+// content:"page: " attr(number);
+// }
+//
+// > chrome-extension://aeolcjbaammbkgaiagooljfdepnjmkfd/options.html#styles
+//
+// ### HTML
+// <div class="autopagerize_page_separator_blocks">
+// <hr class="autopagerize_page_separator">
+// <p class="autopagerize_page_info">
+// <a class="autopagerize_link" href="http://example.com/?page=2" number="2" title="example"></a>
+// </p>
+// </div>
/*
* @title auto slides
* @description slide paging with AutoPagerize/AutoPatchwork
* @include http://*
* @contributor vzvu3k6k http://let.hatelabo.jp/vzvu3k6k/let/hLHX5ZrPpLVS
* @author noromanba http://let.hatelabo.jp/noromanba/let/gYC-x-XT8IHVbA
* @license Public Domain https://creativecommons.org/licenses/publicdomain/
*/
(function () {
var slide = function () {
var seps = document.querySelectorAll('.autopagerize_page_separator');
if (seps.length < 1) return;
// XXX depends style settings as user
var end = seps[seps.length - 1];
var start = end.parentElement.className.match(/autopagerize_page_separator_blocks/) ?
end.parentNode.parentNode.firstElementChild : // AutoPatchWork
end.parentNode.firstElementChild; // AutoPagerize
var range = document.createRange();
range.setStart(start, 0);
range.setEnd(end, 0);
range.deleteContents();
};
slide();
// XXX throttling load problem. XHR storm like DoS; check height, times or lazy paging
/*
// TODO MutationObserver/debouncing Mutation call
document.body.addEventListener('AutoPatchWork.DOMNodeInserted', function (_) {
slide();
}, false);
document.body.addEventListener('AutoPagerize_DOMNodeInserted', function (_) {
slide();
}, false);
//*/
})();
// # Separator structure
// - Chrome(mium) Extention
// - default settings
//
// ## AutoPagerize
// ### HTML
// <hr class="autopagerize_page_separator">
// <p class="autopagerize_page_info">page: <a class="autopagerize_link" href="http://example.com?page=2">2</a>
// </p>
//
// ## AutoPatchwork
// ### Styles
//
// .autopagerize_page_separator_blocks .autopagerize_link{
// display:inline-block;
// }
// .autopagerize_page_separator_blocks .autopagerize_link:before{
// content:"page: " attr(number);
// }
//
// > chrome-extension://aeolcjbaammbkgaiagooljfdepnjmkfd/options.html#styles
//
// ### HTML
// <div class="autopagerize_page_separator_blocks">
// <hr class="autopagerize_page_separator">
// <p class="autopagerize_page_info">
// <a class="autopagerize_link" href="http://example.com/?page=2" number="2" title="example"></a>
// </p>
// </div>
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。