Home ยป Forum ยป Bug Report and Feature Requests

Forum: Bug Report and Feature Requests

TamperMonkey for Mobile/Justify text on Android

PeakGenre ๐Ÿšซ

So I got pretty annoyed with the UI for the sire on Android. There is no page down that easily accomplished, and the 'floatScroll' little icon was always blocking text, so I came up with something on my own using TamperMonkey. Currently you need to be using IceRaven (Firefox fork, that supports TamperMonkey, etc.) to load that addon.

You will need to tweak the scrollByAmount value for your device...I tried getting it programmatically but it just never worked right, and it gets thrown off with the presence or absence of the location bar, so a fixed value just worked best for me.

It also sets the text to be justified which I prefer but you can remove that.

Touching the bottom 15% of the page will page down the 'scollByAmount', so like FBReader or other readers that let you tap the bottom of the screen to scroll down.

This could probably be better, but it mostly just works for me.

pastebin.com/dL59KcBH

// ==UserScript==
// @name page down - storiesonline.net
// @namespace Violentmonkey Scripts
// @match https://storiesonline.net/s/*
// @grant none
// @version 1.0
// @author -
// @description 9/25/2020, 6:39:39 PM
// ==/UserScript==
(function(){
'use strict'

var scrollByAmount = 657;

function dimScroller(id) {
var scroller = document.getElementById(id);
if(scroller) {
scroller.style.opacity = 0.1;
}
};

function justifyText(id) {
var text = document.getElementById(id);
if(text) {
text.style.textAlign = 'justify';
text.style.textJustify = 'inter-word';
}
};

function addButton(text, onclick, cssObj) {
cssObj = cssObj || {position: 'fixed', bottom: '0%', height:'15%', width: '100%', 'z-index': 3, 'opacity': 0.1};
let button = document.createElement('button'), btnStyle = button.style;
document.body.appendChild(button);
button.innerHTML = text;
button.onclick = onclick;
button.id = 'pgdn';
Object.keys(cssObj).forEach(key => btnStyle[key] = cssObj[key]);
return button;
}

window.addEventListener('scroll',(e) => {
if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
let pgdn = document.getElementById('pgdn');
pgdn.style.display = 'none';
}
});

window.addEventListener('load', () => {
var b = addButton('+', () => {
window.scrollBy(0, scrollByAmount);
});

justifyText('story');
dimScroller('floatScroll');
});

setInterval(() => { dimScroller('floatScroll'); }, 100);
})();

Replies:   Dominions Son
Dominions Son ๐Ÿšซ

@PeakGenre

So I got pretty annoyed with the UI for the sire on Android.

A phone or a droid tablet?

PeakGenre ๐Ÿšซ

Phone. I am also not a fan of the slow auto-scrolling text. The current incarnation does have some annoying behavior in that it blocks the 'Next Chatper/Page' part just a bit when you get to the bottom of a chapter/page so you have to click the top half, but you can adjust the '15%' or whatever to change how tall the page down 'hit box' is.

I have run across a few stories where the 'load' event isn't firing, so I tweaked it to use setTimeout(...,1000); instead of using window.addEventListener('load'...), but not sure if 1000 is the right thing or if I figure out why the onload isn't firing I may tweak the code above. I've never tried to do anything on greasyfork.org, but I may post this there is anyone else finds it helpful.

The main issue is that the current android firefox app doesn't support any of the UserScript addons yet, so I had to use IceRaven (FF fork) that does.

Ernest Bywater ๐Ÿšซ

Is Tamper Monkey a cousin of Trunk Monkey?

https://www.youtube.com/watch?v=XW8iAVwt_Yc

Replies:   bk69
bk69 ๐Ÿšซ

@Ernest Bywater

Pretty sure it's a fork of GreaseMonkey.

Replies:   Keet
Keet ๐Ÿšซ

@bk69

Pretty sure it's a fork of GreaseMonkey.

TamperMonkey originally was a userscript for GreaseMonkey to support Chrome and evolved into a separate extension by wrapping itself into GreaseMonkey. Since then it went it's own way.

PeakGenre ๐Ÿšซ

It is not...

Back to Top

 

WARNING! ADULT CONTENT...

Storiesonline is for adult entertainment only. By accessing this site you declare that you are of legal age and that you agree with our Terms of Service and Privacy Policy.


Log In