// ==UserScript==
// @name Theme tweaker LN
// @namespace https://openuserjs.org/scripts/akuma06/Theme_tweaker_LN
// @supportURL https://openuserjs.org/scripts/akuma06/Theme_tweaker_LN/issues
// @version 0.6.7
// @description This script provides some useful tools for ln translation website like a FullScreen Reader and some design style change for better readability. I provide the software as is, you can fully modify it to your likings :)
// @copyright 2016, akuma06
// @author akuma06
// @match http://krytykal.org/*
// @match http://avertranslation.org/*
// @match https://firebirdsnest.org/*
// @match http://blastron01.tumblr.com/*
// @match https://birdytranslations.com/*
// @match https://lightnovelstranslations.com/*
// @match http://tseirptranslations.com/*
// @match http://infinitenoveltranslations.net/*
// @match https://pumlated.wordpress.com/*
// @match https://omegaharem.wordpress.com/*
// @match https://pizzasandcoke.wordpress.com/*
// @match https://grimgarthetranslation.wordpress.com/*
// @match https://oniichanyamete.wordpress.com/*
// @match https://psicern.wordpress.com/*
// @match https://knightsoflunadia.wordpress.com/*
// @match http://www.yamitranslations.com/*
// @match http://www.wuxiaworld.com/*
// @match https://zirusmusings.com/*
// @match http*://moonbunnycafe.com/*
// @match https://isekailunatic.wordpress.com/*
// @match https://addnewtab.wordpress.com/*
// @match http://yukkuri-literature-service.blogspot.com/*
// @match http://gravitytales.com/*
// @require http://code.jquery.com/jquery-latest.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @downloadURL none
// ==/UserScript==
/* jshint asi:true */
var $ = window.jQuery
var regexp = {
"krytykal\.org/.*": "krytykal_org",
"avertranslation\.org/.*": "avertranslation_org",
"firebirdsnest\.org/.*":"firebirdsnest_org",
"tseirptranslations\.com/.*":"tseirptranslations_com",
"birdytranslations\.com/.*":"birdytranslations_com",
"lightnovelstranslations\.com/.*":"lightnovelstranslations_com",
"gravitytales\.com/.*":"gravitytales_com",
"infinitenoveltranslations\.net/.*":"infinitenoveltranslations_net",
"moonbunnycafe\.com/.*":"moonbunnycafe_com",
"zirusmusings\.com/.*": "zirusmusings_com",
"www\.yamitranslations\.com/.*": "www_yamitranslations_com",
"www\.wuxiaworld\.com/.*": "www_wuxiaworld_com",
"pumlated\.wordpress\.com/.*": "pumlated_wordpress_com",
"blastron01\.tumblr\.com/.*": "blastron01_tumblr_com",
"omegaharem\.wordpress\.com/.*": "omegaharem_wordpress_com",
"addnewtab\.wordpress\.com/.*": "addnewtab_wordpress_com",
"pizzasandcoke\.wordpress\.com/.*": "pizzasandcoke_wordpress_com",
"grimgarthetranslation\.wordpress\.com/.*": "grimgarthetranslation_wordpress_com",
"oniichanyamete\.wordpress\.com/.*": "oniichanyamete_wordpress_com",
"psicern\.wordpress\.com/.*": "psicern_wordpress_com",
"knightsoflunadia\.wordpress\.com/.*": "knightsoflunadia_wordpress_com",
"isekailunatic\.wordpress\.com/.*": "isekailunatic_wordpress_com",
"yukkuri-literature-service\.blogspot\.com/.*": "yukkuri_literature_service_blogspot_com"
}
function Infobox(params) {
this.clicked = []
var callback = params.callback
var appendTo = (params.append !== undefined) ? params.append : $("body")
var buttons = (params.buttons !== undefined) ? params.buttons : { Ok: () => { return } }
var parentDiv = $("
").css({ position: "fixed", zIndex:10000, background:"none", display:"flex", textAlign:"center", margin:0, padding:0, top:"0", left:"0", right:"0", bottom:"0" })
var infoDiv = $("").css({ background:"rgba(171, 171, 171, 0.88)", display: "inline-block", color: "white", borderRadius: "1em", boxShadow:"0 0 19px 2px black", padding: "2em", margin:"auto" })
this.close = function () {
if (callback !== undefined) {
callback(this)
}
$(parentDiv).remove()
}
var self = this
$(infoDiv).html($("").html(params.text))
var divButtons = $("").css({textAlign:"center"})
this.addButton = (name, button) => {
if (button instanceof Function) {
$(divButtons).append($("").css({ marginRight: "3px" }).text(name).click((e) => {
e.preventDefault()
self.clicked.push(name)
button(self)
self.close()
}))
} else if (button instanceof Object) {
$(divButtons).append($("").css({ marginRight: "3px" }).text(button.name).click((e) => {
e.preventDefault()
self.clicked.push(name)
button.action(self)
}))
}
}
for (var btn in buttons) {
this.addButton(btn, buttons[btn])
}
infoDiv.append(divButtons)
parentDiv.html(infoDiv)
appendTo.append(parentDiv)
return parentDiv
}
function Toast(params) {
var div = $("").html(params.text).css(Object.assign({ fontSize: "1rem", position: "fixed", zIndex:"10001", bottom: "30px", opacity: 0, borderRadius: "2px", left: "50%", padding: "16px", textAlign: "center", color: "#fff", backgroundColor: "#333", marginLeft: "-125px", minWidth: "250px", visibility: "hidden" }, params.styles))
$("body").append(div)
this.hide = () => {
div.animate({bottom: 0, opacity: 0 }, 500, function() {
$(this).css({ visibility: "hidden" })
if (params.onclose !== undefined) params.onclose.bind(this)()
})
}
this.show = () => {
div.css({ visibility: "visible" }).animate({bottom: "30px", opacity: 1 }, 500)
}
this.animate = () => {
this.show()
return setTimeout(this.hide, 3000)
}
}
function Tweaker(params) {
var self = this
const state = {
loading: false,
rendered: false,
autoOpen: false,
readerMode: false,
links: {
next: "",
previous: ""
}
}
this.state = state
var events = {
defaults:{
statechanged: (e) => {
if (e.params.newState === undefined) {
console.error("NewState was not defined when statechanged event emitted")
return
}
this.state = state
},
loadstarted: (e) => {
this.setState({ loading: true })
},
loadfinished: (e) => {
this.setState({ loading: false })
},
rendered: (e) => {
this.setState({ rendered: true })
},
readermodestart: (e) => {
this.setState({ readerMode: true })
sessionStorage.setItem("readerMode", true)
this.Popup($(e.params.link))
},
readermodeclose: (e) => {
$(this.active).remove()
$("body").css("overflow","")
$("html").css("overflow","")
sessionStorage.setItem("readerMode", false)
this.active = undefined
this.setState({ readerMode: false })
},
nextpage: (e) => {
window.location.href = this.state.links.next
},
previouspage: (e) => {
window.location.href = this.state.links.previous
},
scroll: (e) => {
if (this.active.scrollHeight <= (this.active.scrollTop+1.3*this.active.offsetHeight) || this.active.scrollTop <= 0.3*this.active.offsetHeight) {
localStorage.removeItem(window.location.href)
return
}
localStorage.setItem(window.location.href, this.active.scrollTop)
}
}
}
this.setState = (newState) => {
this.emit("statechanged", {newState: newState, oldState: state})
Object.assign(state, newState)
}
this.addEventListener = (name, callback) => {
if (events[name] === undefined) events[name] = []
events[name].push(callback)
}
this.emit = (name, params) => {
if (events[name] === undefined && events.defaults[name] === undefined) return
const event = {
allowDefault: true,
params: params,
allowPropagation: true,
stopImmediatePropagation: () => { this.allowPropagation = false},
preventDefault: () => { this.allowDefault = false }
}
if (events[name] !== undefined) {
for(var i = 0; i < events[name].length; i++) {
if (event.allowPropagation)
events[name][i].bind(this)(event)
}
}
if (event.allowDefault && events.defaults[name] !== undefined) events.defaults[name].bind(this)(event)
}
this.getActive = () => {
return this.active
}
this.active = undefined
this.mapF = (arr, text) => { return arr.map(function(ind, obj) { return ($(obj).text().match(text)) ? obj : undefined })[0] }
this.mapFExact = (arr, text) => { return arr.map(function(ind, obj) { return ($(obj).text() == text) ? obj : undefined })[0] }
var textTitle = (params !== undefined && params.title !== undefined) ? params.title.bind(this) : () => { return $(".entry-title")}
var icon, iconClose
if (params !== undefined) {
if (params.icon != "noticon") {
icon = (params.icon !== undefined && params.icon.open !== undefined) ? params.icon.open : undefined
iconClose = (params.icon !== undefined && params.icon.close !== undefined) ? params.icon.close : undefined
} else {
icon = "noticon noticon-external"
iconClose = "noticon noticon-close"
}
}
var contentDiv = (params !== undefined && params.content !== undefined && params.content.find !== undefined) ? params.content.find.bind(this) : (link) => { return $(link).parent().parent().siblings(".entry-content")}
var filter = (params !== undefined && params.content !== undefined && params.content.filter !== undefined) ? ((params.content.filter !== "") ? params.content.filter.bind(this) : (content) => { return content }) : (content) => { return $(content).find("> *:not(.sharedaddy)")}
var nextLink = (params !== undefined && params.next !== undefined && params.next.find !== undefined) ? params.next.find.bind(this) : (link, text) => { return this.mapF($(contentDiv(link)).find("a"), text)}
var prevLink = (params !== undefined && params.prev !== undefined && params.prev.find !== undefined) ? params.prev.find.bind(this) : (link, text) => { return this.mapF($(contentDiv(link)).find("a"), text)}
var nextText = (params !== undefined && params.next !== undefined && params.next.text !== undefined) ? params.next.text : "Next"
var prevText = (params !== undefined && params.prev !== undefined && params.prev.text !== undefined) ? params.prev.text : "Previous"
var styles = (params !== undefined) ? params.styles : undefined
this.navigation = (context) => {
if (params !== undefined && params.navigation !== undefined) params.navigation.bind(this)(context)
else this.navigationCallback(context)
}
this.Render = () => {
this.addEventListener("loadstarted", (e) => { $($(this.active).find("div")[0]).css("background", "none").text("Loading..."); e.stopImmediatePropagation() })
if (GM_getValue("firstlaunch") !== true) {
new Infobox({
text: "Welcome to LN Reader!
You can read LN in fullscreen mode by clicking on the link next to the Chapter title.
Furthermore, you move to the next/previous page with your left/right arrow keys.
Have fun reading!",
callback: () => GM_setValue("firstlaunch", true)
})
}
var tagIcon = (icon !== undefined) ? $("").attr("class", icon).css("font-size", "1.5em") : "±Reader"
var linkOpen = $('').html(tagIcon).click(function(e) {
e.preventDefault()
self.open($(this))
})
// console.log("Applying popup link...")
$(textTitle()).append(linkOpen)
if (styles !== undefined && styles instanceof Function) {
// console.log("Applying styles...")
styles(textTitle(), contentDiv(linkOpen))
}
this.navigation()
var readerMode = sessionStorage.getItem("readerMode")
if (readerMode=="true") {
this.setState({ autoOpen: true })
this.open($($(textTitle()).find("a:last")[0]))
}
// console.log("Rendering done!")
this.emit("rendered")
}
this.open = (link) => {
this.emit("readermodestart", { link: link })
}
this.Popup = (context) => {
// console.log("Opening popup...")
var containerStyle = (params.styles !== undefined && params.styles.container !== undefined) ? params.styles.container : {}
var container = $("").attr("tabindex", 0).attr("data-reader", "lnreader").css(Object.assign({ zIndex: "9999",
background:"#EEE",
width:"100%",
height:"100%",
position:"fixed",
top:"0", left:"0",
overflow:"auto",
padding:"20px 0px",
fontSize: "1.44rem",
lineHeight: "1.5" }, containerStyle))
var contentStyle = (params.styles !== undefined && params.styles.content !== undefined) ? params.styles.content : {}
var contentBlock = $("").attr("class", "post-content").css(Object.assign({ width:"60%",
minWidth:"700px",
maxWidth:"1200px",
height:"auto",
margin:"auto",
padding:"2.5em",
fontFamily: "'Open Sans', Tahoma, Arial, sans-serif",
background:"white",
color:"black",
textAlign:"justify" }, contentStyle))
var closeIconStyle = (params.styles !== undefined && params.styles.close !== undefined && params.styles.close.icon !== undefined) ? params.styles.close.icon : {}
var closeIcon = (iconClose !== undefined) ? $("").attr("class", iconClose).css(Object.assign({fontSize: "2em"}, closeIconStyle)) : "×"
var closeLinkStyle = (params.styles !== undefined && params.styles.close !== undefined && params.styles.close.link !== undefined) ? params.styles.close.link : {}
var linkClose = $("").html(closeIcon).css(Object.assign({position:"fixed", border: "none", left:"82%", top:"40px", fontSize:"3.5em"}, closeLinkStyle)).click(function(e){
e.preventDefault()
self.close()
})
$("body").append(container.html(
contentBlock.html($(filter(contentDiv(context))).clone())
.prepend(linkClose)
)
).css("overflow","hidden")
$(container).focus().on("click", function(e) {
if ($(this)[0].webkitRequestFullscreen !== undefined) $(this)[0].webkitRequestFullscreen()
else $(this)[0].mozRequestFullScreen()
})
this.active = $(container)[0]
var fullscreenElement = (document.webkitFullscreenElement !== undefined) ? document.webkitFullscreenElement : document.mozFullScreenElement
if (localStorage.getItem(window.location.href) !== null) {
new Infobox({
text:"We have saved where you left when reading this chapter, do you want to resume?",
buttons: {
Yes: () => {
var active = $("div[data-reader='lnreader']")[0]
active.scrollTop = localStorage.getItem(window.location.href)
active.focus()
},
No: () => localStorage.removeItem(window.location.href)
},
append: $(this.active)
})
} else if ((this.state.autoOpen)&&(fullscreenElement === null)) {
if (GM_getValue("no_more_fullscreen_mess") !== true)
new Infobox({
text: `We can't make the reader completely fullscreen without user gesture. You have to click on the reader or press Enter to be in fullscreen mode.`,
buttons: {
Ok: () => {
var active = $("div[data-reader='lnreader']")[0]
if (active.webkitRequestFullscreen !== undefined) active.webkitRequestFullscreen()
else active.mozRequestFullScreen()
active.focus()
},
DontShow: { name: "Don't Show again", action: (infobox) => { GM_setValue("no_more_fullscreen_mess", true); infobox.close() } }
},
append: $(this.active)
})
else
new Toast({ text: 'Press Enter for fullscreen', onclose: function() { $(this).remove() } }).animate()
}
if ($(container)[0].webkitRequestFullscreen !== undefined) $(container)[0].webkitRequestFullscreen()
else $(container)[0].mozRequestFullScreen()
$("html").css("overflow", "hidden")
// console.log("Looking for next/prev links...")
this.navigation(context)
// console.log("Popup opened!")
this.emit("readermodeopened")
}
this.close = () => {
this.emit("readermodeclose")
}
this.navigationCallback = (context) => {
if (context === undefined) {
return
}
var nextHref = $(nextLink(context, nextText)).attr("href")
if (nextHref) {
this.state.links.next = nextHref
// console.log("Next link found")
}
var previousHref = $(prevLink(context, prevText)).attr("href")
if (previousHref) {
this.state.links.previous = previousHref
// console.log("Previous link found")
}
this.attachEvents()
}
this.attachEvents = () => {
$(this.active).keyup(function (e) {
if ((e.which == 39)&&(self.state.links.next !== "")) {
e.preventDefault()
self.next(self)
// console.log("Moving to Next Page")
} else if ((e.which == 37)&&(self.state.links.previous !== "")) {
e.preventDefault()
self.previous(self)
// console.log("Moving to Previous Page")
}
})
if (this.active !== undefined) {
$(document).keyup((e) => {
var fullscreenElement = (document.webkitFullscreenElement !== undefined) ? document.webkitFullscreenElement : document.mozFullScreenElement
if (e.which == 13 && fullscreenElement === null) {
if (self.active.webkitRequestFullscreen !== undefined) self.active.webkitRequestFullscreen()
else self.active.mozRequestFullScreen()
}
})
$(this.active).keyup(function (e) {
if ((e.which == 40) && (self.state.links.next !== "")) {
self.hideup(e, true)
} else if ((e.which == 38) && (self.state.links.previous !== "")) {
self.hidedown(e, true)
} else if (e.which == 27) {
self.close()
}
}).keydown(function (e) {
if ((e.which == 40) && (self.state.links.next !== "")) {
self.hideup(e)
} else if ((e.which == 38) && (self.state.links.previous !== "")) {
self.hidedown(e)
}
}).scroll(() => { self.emit("scroll") } )
}
}
this.next = () => {
this.emit("loadstarted")
this.emit("nextpage")
}
this.previous = () => {
this.emit("loadstarted")
this.emit("previouspage")
}
this.hideup = function(e, reset) {
if (this.active !== undefined) {
var div = $(this.active).find("div")[0]
if (reset) {
div.style.position = ""
div.style.top = 0
return
}
if (this.active.scrollHeight <= (this.active.scrollTop+this.active.offsetHeight)) {
if (e !== undefined) e.preventDefault()
div.style.position = "relative"
var pos = (div.style.top.replace("px", "") !== "") ? parseFloat(div.style.top.replace("px", "")) : -1
pos = (pos >= 0) ? -1 : pos
if (-pos > this.active.offsetHeight) {
this.next(this)
} else {
pos-= -0.2*pos
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
pos -= 0.05*this.active.offsetHeight
}
div.style.top = pos+"px"
}
}
}
}
this.hidedown = function(e, reset) {
if (this.active !== undefined) {
var div = $(this.active).find("div")[0]
if (reset) {
div.style.position = ""
div.style.top = 0
return
}
if (this.active.scrollTop === 0) {
if (e !== undefined) e.preventDefault()
div.style.position = "relative"
var pos = (div.style.top.replace("px", "") !== "") ? parseFloat(div.style.top.replace("px", "")) : 1
pos = (pos <= 0) ? 1 : pos
if (pos > this.active.offsetHeight) {
this.previous(this)
} else {
pos += 0.2*pos
if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
pos += 0.05*this.active.offsetHeight
}
div.style.top = pos+"px"
}
}
}
}
}
var tweakes = {
krytykal_org :{ styles: () => {
$(".main-navigation .nav-menu ul li > a").each(function () {
this.style.setProperty("color", "black", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "black", "important")
})
})
$(".main-navigation ul.children").css("background", "#2f3c4e")
$(".main-navigation ul.children").css("border-left", "1px solid rgba(255,255,255,0.2)")
$(".main-navigation ul.children li").css("border", "0")
$(".main-navigation ul.children li a").each(function () {
this.style.setProperty("color", "white", "important")
this.style.setProperty("background", "none", "important")
this.style.setProperty("font-family", "'Open Sans', 'Droid Arabic Kufi', Arial, sans-serif", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "white", "important")
})
})
$("#page").css("color", "black")
$("#page").css("background", "white")
}
},
avertranslation_org: { styles: () => {
$("#menu-menu-1 li > a").each(function () {
this.style.setProperty("color", "black", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "black", "important")
})
})
$("#menu-menu-1 ul.sub-menu").css("background", "#2f3c4e")
$("#menu-menu-1 ul.sub-menu").css("border-left", "1px solid rgba(255,255,255,0.2)")
$("#menu-menu-1 ul.sub-menu li").css("border", "0")
$("#menu-menu-1 ul.sub-menu li a").each(function () {
this.style.setProperty("color", "white", "important")
this.style.setProperty("background", "none", "important")
this.style.setProperty("font-family", "'Open Sans', 'Droid Arabic Kufi', Arial, sans-serif", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "white", "important")
})
})
$("#page").css("color", "black")
$("#page").css("background", "white")
$("#access").css("background", "white")
} },
firebirdsnest_org: { styles: () => {
$(".hentry").css("color", "black")
$(".hentry").css("background", "white")
$("#menu li > a").each(function () {
this.style.setProperty("color", "black", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "black", "important")
})
})
$("#menu ul.sub-menu").css("background", "#2f3c4e")
$("#menu ul.sub-menu").css("border-left", "1px solid rgba(255,255,255,0.2)")
$("#menu ul.sub-menu li").css("border", "0")
$("#menu ul.sub-menu li a").each(function () {
this.style.setProperty("color", "white", "important")
this.style.setProperty("background", "none", "important")
this.style.setProperty("font-family", "'Open Sans', 'Droid Arabic Kufi', Arial, sans-serif", "important")
$(this).hover(function() {
this.style.setProperty("color", "#e74c3c", "important")
}, function () {
this.style.setProperty("color", "white", "important")
})
})
$("#menu").css({ background: "white", float:"none", margin: "auto"}).append($("").css("clear", "both"))
$("#container").css("width", "100%")
$("#main").css("width", "70%")
$("#page-wrap").css({width: "90%", minWidth: "1000px"})
$("#sidebar").css({width: "26%"})
$(".widget").css({padding: 0, width:"100%"})
$(".widget > *").css({marginLeft: "15px", marginBottom: "15px" })
$(".widget-title").css({ position: "static", width:"100%", marginLeft:0,marginBottom:0})
},
content: { find: () => { return $("#main .entry-content") }, filter: "" },
icon: {
close: "noticon noticon-close",
open: "noticon noticon-external"
},
title: () => { return $("#main .entry-title") },
},
tseirptranslations_com:{
title: () =>{ return $(".content .post-title") },
content: { find: (link) => { return $(link).parent().parent().siblings(".post-content") }, filter: (content) => { return $(content).find(">*:not(.sd-block)") } },
icon: { open: "genericon genericon-external", close: "genericon genericon-close" }
},
pumlated_wordpress_com:{
title: () =>{ return $("#content .entry-title") },
icon: "noticon",
prev: { find: () => { return $("a[rel='prev']") }},
next: { find: () => { return $("a[rel='next']") }}
},
yukkuri_literature_service_blogspot_com: {
title: () =>{ return $("#Blog1 .entry-title") },
},
pizzasandcoke_wordpress_com:{
title: () =>{ return $("#main .entry-title") },
icon: "noticon",
},
grimgarthetranslation_wordpress_com:{
title: () =>{ return $(".page .page-title") },
content: { find: (link) => { return $(link).parent().parent().siblings(".page-body")}, filter: (content) => { return $(content).find("> *:not(.sharedaddy)>*") } },
icon: "noticon",
},
omegaharem_wordpress_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: "noticon",
},
isekailunatic_wordpress_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: "noticon",
},
oniichanyamete_wordpress_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: "noticon",
},
infinitenoveltranslations_net:{
title: () =>{ return $(".entry-header .entry-title") },
icon: { open: "genericon genericon-external", close: "genericon genericon-close" },
styles: () => {
$("#xyz").prepend($("#xyz div").remove().html())
}
},
birdytranslations_com:{
title: () =>{ return $(".entry-header .entry-title") },
content: { find: (link) => { return $(link).parent().parent().siblings(".entry-wrapper") }, filter: (content) => { return $(content).find(".entry-content>*:not(.sharedaddy)") } },
icon: { open: "genericon genericon-external", close: "genericon genericon-close" },
next: { text: "[Next>"},
prev: { text: "{ return $(".hentry .entry-title") },
content: { find: (link) => { return $(link).parent().siblings(".entry-content") } },
icon: { open: "dashicons dashicons-external", close: "dashicons dashicons-close" },
},
psicern_wordpress_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: "noticon",
next: { text: "→"},
prev: { text: "←"}
},
www_wuxiaworld_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: { open: "fa fa-external-link", close: "fa fa-close" },
styles: (title, content) => {
if (window.location.href.match("wmw-index")) {
var parseChildren = (child) => {
if ($(child).children().length > 0) {
$(child).children().each(function() { parseChildren($(this)) })
}
$(child).html($(child).html().replace(/!/g, "."))
}
parseChildren($(content))
}
}
},
knightsoflunadia_wordpress_com:{
title: () =>{ return $(".entry-header .entry-title") },
icon: "noticon",
next: { find: () => { return $(".nav-next") }},
prev: { find: () => { return $(".nav-previous") }}
},
www_yamitranslations_com:{
title: () =>{ return $(".hentry .entry-title") },
content: { find: (link) => { return $(link).parent().siblings(".entry-content")}, filter: "" },
next: { find: (link, text) => { return this.mapF($(".orPrevNext"), text) }},
prev: { find: (link, text) => { return this.mapF($(".orPrevNext"), text) }},
navigation: () => {
if (document.querySelectorAll(".orPrevNext a").length === 0) {
// console.log("retry to find prev link")
setTimeout(() => { this.navigation(self) }, 300)
return
}
// console.log("found links!")
this.navigationCallback("")
}
},
zirusmusings_com:{
title: () =>{ return $(".page-title") },
content: { find: (link) => { return $(link).parent().parent().parent().parent().find(".entry-content") } },
icon: "noticon",
},
addnewtab_wordpress_com:{
title: () =>{ return $("#content .entry-title") },
icon: "noticon",
},
gravitytales_com: {
title: () => { return $($("#contentElement h3")[0]) },
icon: { open: "fa fa-external-link", close: "fa fa-close" },
content: { find: (link) => { return $("#chapterContent") } },
next: { find: () => { return $($(".chapter-navigation a")[2]) } },
prev: { find: () => { return $($(".chapter-navigation a")[0]) } }
},
blastron01_tumblr_com: {
title: () => { return $($("#blog h1")[0]) },
icon: { open: "icon icon-external-link", close: "fa fa-close" },
content: { find: (link) => { return $("#blog .post") }, filter: (content) => { return $(content).find("> *:not(.meta,.permalink-footer,h1:first)") } },
next: { text: "next" },
prev: { text: "prev" }
},
lightnovelstranslations_com: {
title: () => { return $("h1.entry-title") },
icon: { open: "fa fa-external-link", close: "fa fa-close" },
content: { find: (link) => { return $(link).parent().siblings(".entry-content") } },
next: { find: (link) => { return $($(link).parent().siblings(".entry-content").find("a")[1]) } },
prev: { find: (link) => { return $($(link).parent().siblings(".entry-content").find("a")[0]) } },
styles: { close: { icon: { fontSize: "inherit" }, link: { left:"", right: "10%" } }}
}
}
$.each(regexp, function (key, val) {
if (window.location.href.match(key)) {
if (tweakes[val] !== undefined)
new Tweaker(tweakes[val]).Render()
else console.error("The element in tweakes map is not defined")
}
})
// Registering menu command
if (GM_registerMenuCommand !== undefined) {
GM_registerMenuCommand("Theme Tweaker - Report Issues", () => { window.location.href="https://openuserjs.org/scripts/akuma06/Theme_tweaker_LN/issues" })
}