fix reader features not working on insert-at-bottom

This commit is contained in:
wareya committed 2019-08-14 23:11:03 -04:00
1 parent 70b8971f6a
commit d0eb4ee13a
3 files changed
+13 -3

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "nazeka",
"version": "0.3.5",
"version": "0.4.0",
"author": "Wareya",
"homepage_url": "https://github.com/wareya/nazeka",
"description": "A rikai replacement.",
+2
View File
@@ -49,6 +49,7 @@ button
opacity: 0.35;
position: fixed;
right: 5px;
height: 2em;
bottom: calc( 10px + 2em );
}
#button_delete
@@ -56,6 +57,7 @@ button
opacity: 0.35;
position: fixed;
right: 5px;
height: 2em;
bottom: 5px;
}
</style>
+10 -2
View File
@@ -32,10 +32,16 @@ function update_styles()
target.marginRight = reader_settings.reader_margin;
target.fontFamily = reader_settings.reader_font;
let target2 = document.querySelector("#new_color_style");
target2.cssText = `body > p:nth-of-type(1)
let elements = document.body.getElementsByTagName("p");
let which = String(reader_settings.reader_reverse ? elements.length : 1);
target2.textContent = `body > p:nth-of-type(${which})
{
color: ${reader_settings.reader_fg};
}`;
console.log("attempted to update styles");
console.log(target2.textContent);
console.log(which);
console.log(reader_settings.reader_reverse);
}
async function reader_settings_init()
@@ -196,7 +202,9 @@ function toggle_pause()
function delete_newest()
{
let target = document.getElementsByTagName("p")[0];
let elements = document.getElementsByTagName("p");
let which = reader_settings.reader_reverse ? elements.length-1 : 0;
let target = document.getElementsByTagName("p")[which];
if(target.className == "nazeka_reader_insertion")
{
target.remove();