// ==UserScript==
// @name [TS] deviantART Gallery Pager
// @namespace TimidScript
// @version 1.0.19.2
// @description Auto-pager for DeviantArt gallery/favourites. On-top of FireFox, it now works with G-Chrome and Opera. NOW: With sticky paging button switch.
// @author TimidScript
// @homepageURL https://github.com/TimidScript
// @copyright © 2013+ TimidScript, Some Rights Reserved.
// @license https://github.com/TimidScript/UserScripts/blob/master/license.txt
// @include *://*.deviantart.com/gallery/*
// @include *://*.deviantart.com/favourites/*
// @require https://greasyfork.org/scripts/19967/code/TSL - GM_update.js
// @homeURL https://greasyfork.org/en/scripts/4682
// @grant GM_xmlhttpRequest
// @grant GM_info
// @grant GM_getMetadata
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_deleteValue
// @grant GM_registerMenuCommand
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACHDwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKJ2lDQ1BpY20AAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZEsRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTsAIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQdli7d1NqaQffkZKVwBALDACYrmcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtFehn4uWcQrf+L7a/80hoAYMyJarPziy2uCoD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jALOOoBLk+Q5BZyskLFiipVhVQVpdLKxKl8AA4GM1jECQjRBZEFFSieq0LMOMYIyNv/oU0i0nOb7UII7xV4IUK+QZkQqvfLtyjZVYPSRgyaAIBJVUjDc7M+icDqoh/GohSAOZSxQ6O8iMTM4loKJ2JIBNJBnFn81SKrDt9ArEfWRZmgfCcdhRMx7ASUwsAprouOsFmgsvwNV6DI1iiD5fsqTwylzZQaCIaFQN8q8+9xdsjd7yBa2GnuYjYLtnFk1IGYxUAwKALGVUb1iddAhMPFq5xSdgeqornhv6FwItImgHStSLzPRRneb1HP46MvnNAZe3n/XyhtRHoEuJhDhYliCrG7fgY7H2fgoTjfcCEtAlv2ajRjgSfqfLFVNhOWCfRLAC80eB9oTPFVItMAgflMAJ/Xf5hAAAccQZwGwnTwSofOZkIyCSzqiuedtHydjSbeOOkj1jlPEcARUz6OMnEaiCiDM6lM2nsioDy+5HX36FTXYaEx47J3sc5ToLy6bsY5bJ5+75UNO+xyoIbPKRiI3cgkRPkGvxR7+Awz5a7bvmV9H2TkiOaxCyfgHpzDukP536/vxvcaXT73wXEyieXrnNT9J11CeZ728ytjxt3wJuv6C8YoKK4unPbhBLwc57D35N/57/Z5VjlQg9dnCnj7Wr5Oo/rOAppy923/HBtV3sXIZiRdIIETcD1r5Miusdnj9+E0ECErk4DDis1nZcFssPJQXo5XzS48QFjFITLOYXGUiXCVSSDawGFh84iYaV8ggzD1/4AUKz5ixH8A8p7wO3/rrQUAAAAASUVORK5CYII=
// ==/UserScript==
/* License + Copyright Notice
********************************************************************************************
License can be found at: https://github.com/TimidScript/UserScripts/blob/master/license.txt
Below is a copy of the license the may not be up-to-date.
Copyright © TimidScript, Some Rights Reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1) GPL-3 License is met that does not conflict with the rest of the license (http://www.gnu.org/licenses/gpl-3.0.en.html)
2) This notice must be included
3) Due credits and link to original author's homepage (included in this notice).
4) Notify the original author of redistribution
5) Clear clarification of the License and Notice to the end user
6) Do not upload on OpenUserJS.org or any other site that infringes on this license
TimidScript's Homepages: GitHub: https://github.com/TimidScript
GreasyFork: https://greasyfork.org/users/1455
*/
/* Information
**************************************************************************************************
Version History
------------------------------------
1.0.19 (2016-10-15)
- Fix for Google Chrome as not longer able to access href property in link element.
1.0.18 (2016-05-27)
- Altered license
1.0.17 (2016-05-25)
- Moving to GreasyFork and preparing the removal of files from OUJS
1.0.16 (2016-04-10)
- updateURL added
1.0.15 (2016-04-03)
- Changed license to GPL-3
1.0.14
- Ability to set the scroll offset to allow more pages loaded as you scroll
1.0.13
- BugFix to support Chrome and Opera. Replaced createHTMLDocument('MPIV') as it only seems to work in FireFox
1.0.12 (2015-02-07)
- Support https
1.0.11 (2015-06-27)
- Using URI (base64) for script icon
1.0.10 (2015-05-25)
- Changed the position of the auto-pager button.
1.0.9 (2015-01-17)
- Changed the position of the Auto-Pager button and enlarged.
- Auto-paging button is always enabled now
- Removed search box from extra pages
- Bug fix in the way to detect group galleries
- Bug fix to Auto-Pager button
1.0.8 (2015-01-16)
- Bug fix to paging as it did not work in high resolution.
- Paging button added. It saves last setting.
- Added a setting to update url to the last page loaded. Remove the commenting from: GM_setValue("UpdateURL",1);
1.0.7 (2015-01-09)
- Big fix due favourites paging due to changes in divantArt site
- Take into account favourites folders when working out scrollOffsetExtra.
1.0.6 (2015-01-02)
- At least from Firefox version 34.0.5 window.scrollMaxY value no longer returns the max scrollable document
value. Replaced it with document.documentElement.scrollHeight.
//From version 34.# of FF scrollMaxY no longer returns
1.0.5 (2014-11-01)
- Bug fix: Check if comments are present in the gallery
- Bug fix: Loading icon gets removed now when you change page
1.0.4 (2014-10-31)
- Fix to support other browsers beside FireFox
1.0.3 (2014-08-29)
- Added GM_update
1.0.2 (2014-08-19)
- Cleaned up header for OUJS
1.0.1 (2013-02-27)
- Initial Release
**************************************************************************************************/
console.info("DeviantScript Gallery Pager");
/************** Variable you can set **************/
//Once set update, run the script once and then force update to allow automatic updating
//GM_setValue("UpdateURL", 1) //Turn on update URL
//GM_deleteValue("UpdateURL") //Turn off update URL
//GM_setValue("ScrollOffset", 500); //The gap between page loading
var scrollOffset = GM_getValue("ScrollOffset", 500);
var addPagination = true; //Adds page divider
var gmi = document.querySelector("#gmi-GZone[gmi-name='top_left']");
var intervalID = 0;
var nextPageURL = null;
var galleryPager = document.getElementById("gallery_pager");
var pagerSwitch;
AddPagerSwitch();
if (GetNextPageURL(document)) intervalID = setInterval(CheckScrollPosition, 200);
var loading = "data:image/gif;base64,R0lGODlhZABkAPQAAP///+AfH/Cbm+x6euZOTudTU+pvb+M3N+IuLuVFReloaOhhYe6Nje+UlOQ+PuAfH+2GhuhaWuEnJwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJBwAAACwAAAAAZABkAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zfMgoDw0csAgSEh/JBEBifucRymYBaaYzpdHjtuhba5cJLXoHDj3HZBykkIpDWAP0YrHsDiV5faB3CB3c8EHuFdisNDlMHTi4NEI2CJwWFewQuAwtBMAIKQZGSJAmVelVGEAaeXKEkEaQSpkUNngYNrCWEpIdGj6C3IpSFfb+CAwkOCbvEy8zNzs/Q0dLT1NUrAgOf1kUMBwjfB8rbOQLe3+C24wxCNwPn7wrjEAv0qzMK7+eX2wb0mzXu8iGIty1TPRvlBKazJgBVnBsN8okbRy6VgoUUM2rcyLGjx48gQ4ocSbKkyZMoJf8JMFCAwAJfKU0gOUDzgAOYHiE8XDGAJoKaalAoObHERFESU0oMFbF06YikKQQsiKCJBYGaNR2ocPr0AQCuQ8F6Fdt1rNeuLSBQjRDB3qSfPm1uPYvUbN2jTO2izQs171e6J9SuxXjCAFaaQYkC9ku2MWCnYR2rkDqV4IoEWG/O5fp3ceS7nuk2Db0YBQS3UVm6xBmztevXsGPLnk27tu3buHOvQU3bg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mmD6NEJVEg1Y4oQJtC3ixDwtZzWqWfGJBksajmhA0iTllCk+ikbNurXr17Bjy55Nu7bt20HkKGCwOiWDBAeC63S4B1vvFAIIBF+e4DEuAQsISCdHI/Ly5ad1QZBeQLrzMssRLFdgDKF0AgUUybB+/YB6XiO7Sz9+QkAE8cEREPh+y8B5hjbYtxxU6kDQAH3I7XEgnG4MNujggxBGCAVvt2XhwIUK8JfEIX3YYsCFB2CoRwEJJEQAgkM0ANyFLL7HgwElxphdGhCwCKIDLu4QXYwEUEeJAAnc6EACOeowAI8n1TKAjQ74uIIAo9Bnn4kRoDgElEEmQIULNWY54wkMjAKSLQq+IMCQQwZp5UVdZpnkbBC4OeSXqCXnJpG1qahQc7c1wAADGkoo6KCEFrpCCAA7AAAAAAAAAAAA";
function AddPagerSwitch()
{
var holder = document.createElement("div");
pagerSwitch = document.createElement("button");
holder.appendChild(pagerSwitch);
holder.setAttribute("style", "text-align:center;");
GM_addStyle(".smbutton-red2 {background:linear-gradient(center top , #ED7968, #EB462D) repeat scroll 0% 0% transparent;"
+ "background: -moz-linear-gradient(center top , #ED7968, #EB462D) repeat scroll 0% 0% transparent;"
+ "background: -webkit-linear-gradient(center top , #ED7968, #EB462D) repeat scroll 0% 0% transparent;"
+ "background: -o-linear-gradient(center top , #ED7968, #EB462D) repeat scroll 0% 0% transparent;}"
+ ".smbutton-red2:hover {background:linear-gradient(center top , #ED9588, #E9604B) repeat scroll 0% 0% transparent;"
+ "background: -moz-linear-gradient(center top , #ED9588, #E9604B) repeat scroll 0% 0% transparent;"
+ "background: -webkit-linear-gradient(center top , #ED9588, #E9604B) repeat scroll 0% 0% transparent;"
+ "background: -o-linear-gradient(center top , #ED9588, #E9604B) repeat scroll 0% 0% transparent;}"
+ ".smbutton-dead, .smbutton-dead:hover {background:linear-gradient(center top , #A39F9F, #787473) repeat scroll 0% 0% transparent;"
+ "background: -moz-linear-gradient(center top , #A39F9F, #787473) repeat scroll 0% 0% transparent;"
+ "background: -webkit-linear-gradient(center top , #A39F9F, #787473) repeat scroll 0% 0% transparent;"
+ "background: -o-linear-gradient(center top , #A39F9F, #787473) repeat scroll 0% 0% transparent;}"
+ ".pagerbtn {font-size: 14px !important; padding: 2px 50px; margin: 0;}"
);
GM_addStyle(".smbutton-red2 {bac}");
pagerSwitch.textContent = "Auto-Paging";
pagerSwitch.value = GM_getValue("Paging", 1);
pagerSwitch.className = (pagerSwitch.value == 1) ? "pagerbtn smbutton smbutton-green" : "pagerbtn smbutton smbutton-red2";
pagerSwitch.onclick = function ()
{
//if (pagerSwitch.value == -1) return;
if (pagerSwitch.value == 1)
{
pagerSwitch.value = 0;
pagerSwitch.className = "pagerbtn smbutton smbutton-red2";
}
else
{
pagerSwitch.value = 1;
pagerSwitch.className = "pagerbtn smbutton smbutton-green";
}
GM_setValue("Paging", pagerSwitch.value);
}
var holder = document.createElement("div");
holder.setAttribute("style", "text-align:center;");
holder.appendChild(pagerSwitch);
var container = document.querySelector(".folderview-art");
if (!container) container = document.getElementById("gmi-ResourceStream");
//.folderview-art > .pagination-wrapper
if (container)
{
container.appendChild(holder);
container.insertBefore(holder, container.firstElementChild);
}
}
function CheckScrollPosition()
{
if (pagerSwitch.value == 0) return;
var posBottom = getAbsolutePosition(gmi).top + gmi.offsetHeight;
if (window.innerHeight + window.scrollY > posBottom - scrollOffset)
{
GetNextPage();
}
function getAbsolutePosition(element)
{
var x = 0;
var y = 0;
while (element && !isNaN(element.offsetLeft) && !isNaN(element.offsetTop))
{
x += element.offsetLeft;
y += element.offsetTop;
element = element.offsetParent;
}
return { top: y, left: x };
}
}
function GetNextPageURL(doc)
{
var next = (doc.querySelector("#gmi-DoubleResourceStream")) ? doc.querySelector(".folderview-art > .pagination-wrapper li.next a.away") : doc.querySelector("#gallery_pager li.next a.away");
if (next)
{
//nextPageURL = next.href; No longer works on google
nextPageURL = next.getAttribute("href");
return true;
}
pagerSwitch.value = -1;
//pagerSwitch.className = "smbutton smbutton-dead";
nextPageURL = null;
return false;
}
function GetNextPage()
{
clearInterval(intervalID);
var div = document.createElement("div");
div.id = "deviantscript";
img = document.createElement("img");
img.src = loading;
div.appendChild(img);
document.getElementById("gmi-GPage").appendChild(div);
w = Math.round(img.clientWidth / 2);
div.setAttribute("style", "position: fixed; z-index: 999; bottom: 50%; left: 50%; margin: 0 0 0 -" + w + "px;");
var xhr = new XMLHttpRequest();
xhr.open("GET", nextPageURL, true);
//xhr.responseType = "document"; //Causes issues in Opera
xhr.onload = function (e)
{
if (xhr.readyState == 4)
{
if (xhr.status == 200)
{
//var xdoc = xhr.response; //Causes issues in opera;
//var xdoc = document.createElement("xml");
//xdoc.innerHTML = xhr.responseText;
var xdoc = new DOMParser().parseFromString(xhr.response, "text/html");
if (xdoc.querySelector("#gmi-DoubleResourceStream")) //Groups
{
gmi.appendChild(xdoc.querySelector("#gmi-GZone[gmi-name='top_left'] #gmi-GMFrame_Gruser").cloneNode(true));
}
else
{
//var el = xdoc.querySelector(".gallery-topbar");
//console.log(el);
//if (el) el.parentElement.removeChild(el);
gmi.appendChild(xdoc.querySelector("#gmi-ResourceStream, #gmi-EditableResourceStream").cloneNode(true));
if (addPagination) gmi.appendChild(xdoc.getElementsByClassName("pagination")[0].parentElement.cloneNode(true));
}
if (GM_getValue("UpdateURL")) window.history.pushState(null, "", xhr.responseURL);
if (GetNextPageURL(xdoc)) intervalID = setInterval(CheckScrollPosition, 200);
} else
{
console.error(xhr.statusText);
}
}
document.getElementById("deviantscript").parentNode.removeChild(document.getElementById("deviantscript"));
};
xhr.onerror = function (e)
{
document.getElementById("deviantscript").parentNode.removeChild(document.getElementById("deviantscript"));
console.error(xhr.statusText);
};
xhr.send(null);
}