This commit is contained in:
wareya committed 2018-03-17 15:06:36 -04:00
1 parent 5bae58150a
commit 3a482a3646
4 files changed
+44 -14

No files matched your search

+2 -1
View File
@@ -14,7 +14,8 @@ let lookup_epwing_kana = new Map();
async function refresh_epwing()
{
epwing = (await browser.storage.local.get("epwing"))["epwing"];
let myjson = (await browser.storage.local.get("epwing"))["epwing"];
epwing = JSON.parse(myjson);
lookup_epwing_kan = new Map();
lookup_epwing_kana = new Map();
for (let i = 1; i < epwing.length; i++)
+7 -1
View File
@@ -1 +1,7 @@
<html><head><meta charset="utf-8"/></head><body><script src="background-script.js" charset="UTF-8"></script><textarea id="nazeka-paste-target"></textarea></body></html>
<html>
<head><meta charset="utf-8"/></head>
<body>
<script src="background-script.js" charset="UTF-8"></script>
<textarea id="nazeka-paste-target"></textarea>
</body>
</html>
+6 -7
View File
@@ -292,22 +292,21 @@ function buildpage()
file.addEventListener("change", () =>
{
let fname = document.querySelector("#file").files[0];
let fr = new FileReader();
fr.onload = (e) =>
let reader = new FileReader();
reader.onload = async(e) =>
{
try
{
document.querySelector("#import_label").textContent = "Importing...";
browser.storage.local.set({"epwing":JSON.parse(e.target.result)});
browser.storage.local.set({"epwing":JSON.stringify(JSON.parse(e.target.result))});
browser.runtime.sendMessage({type:"refreshepwing"});
document.querySelector("#import_label").textContent = "Imported. Might take a few seconds to apply.";
}
catch(e)
catch(except)
{
console.log(e);
console.log(except.stack);
}
};
fr.readAsText(fname);
reader.readAsText(fname);
});
let label = document.createElement("label");
label.for = file.id;
+29 -5
View File
@@ -188,7 +188,7 @@ function display_div (middle, x, y, time)
outer.style.bottom = (newy+settings.yoffset)+"px";
outer.style.right = "unset";
outer.style.left = (newx+settings.xoffset)+"px";
outer.style.marginRight = "-10000000000000000px"; // fixes an absolute positioning """feature""" on very wide pages (e.g. pages of vertical text)
outer.style.marginRight = "-10000000000000000px"; // fixes an absolute positioning """feature""" that doesn't work properly with very wide pages (e.g. pages of vertical text)
outer.style.marginLeft = "unset";
}
else if(corner == 1)
@@ -206,7 +206,7 @@ function display_div (middle, x, y, time)
outer.style.bottom = "unset";
outer.style.right = "unset";
outer.style.left = (newx+settings.xoffset)+"px";
outer.style.marginRight = "-10000000000000000px"; // fixes an absolute positioning """feature""" on very wide pages (e.g. pages of vertical text)
outer.style.marginRight = "-10000000000000000px"; // fixes an absolute positioning """feature""" that doesn't work properly with very wide pages (e.g. pages of vertical text)
outer.style.marginLeft = "unset";
}
}
@@ -316,8 +316,7 @@ function build_div_inner (text, result)
keb.textContent = kanji_text;
temptag.appendChild(keb);
// list readings
let readings = term.r_ele;
// deconjugations
if(term.deconj)
{
@@ -367,6 +366,10 @@ function build_div_inner (text, result)
}
temptag.appendChild(maininfos);
}
// list readings
let readings = term.r_ele;
temptag.appendChild(document.createTextNode(" 《"));
let e_readings = document.createElement("span");
e_readings.className = "nazeka_readings";
@@ -935,6 +938,7 @@ function update(event)
try
{
let display = getComputedStyle(current_node).display;
// break out of elements neither inline nor ruby
if(display != "inline" && display != "ruby")
break;
} catch(err) {}
@@ -955,10 +959,30 @@ function update(event)
try
{
let display = getComputedStyle(next_node).display;
if(display == "ruby")
if(display == "ruby-text")
continue;
if(display == "inline")
text += next_node.textContent;
// BUG: this should technically be recursive, not a special case, but it won't affect any real webpages
if(display == "ruby")
{
for(let child of next_node.childNodes)
{
try
{
let display = getComputedStyle(child).display;
if(display == "ruby-text")
continue;
if(display == "inline")
text += child.textContent;
}
catch(err)
{
text += child.textContent;
}
}
}
}
catch(err)
{