Skip to content

Commit

Permalink
v1.1.4 Release
Browse files Browse the repository at this point in the history
Fixed a fairly serious bug that affected only new users of the app.
Didn't catch this before because I didn't clear my synchronized settings
for a long time...

Fixed a bug where if a page did some funky dynamic loading and unloaded
the popup element, it would not create a new one.
  • Loading branch information
Paperfeed committed Mar 13, 2018
1 parent c2e624b commit 414e21f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
8 changes: 4 additions & 4 deletions js/liuchan.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ class LiuChan {
highlightText: true,
highlightInput: false,
scaleOnZoom: true,
showOnKey: "0",
showOnKey: 0,
disableKeys: false
},
styling: {
useCustomization: false,
customColors: ['#FFFFE0', '#D7D3AF', 'rgba(66,8,8,0.10)'],
customColors: ["#ffffe0", "#d7d3af", "RGBA(0,8,8,0.1)"],
borderThickness: 2,
borderRadius: 8
},
Expand All @@ -112,11 +112,11 @@ class LiuChan {
displayHelp: true,
lineEnding: 'n',
copySeparator: 'tab',
maxClipCopyEntries: 7,
maxClipCopyEntries: "7",
ttsDialect: "zh-CN",
ttsSpeed: 0.9,
useCustomTones: false,
customTones: ['#F2777A', '#99CC99', '#6699CC', '#CC99CC', '#CCCCCC', '#66CCCC'],
customTones: ["#f2777a", "#99cc99", "#6699cc", "#cc99cc", "#cccccc", "#66cccc"],
version: CURRENT_VERSION
};

Expand Down
19 changes: 14 additions & 5 deletions js/liuchancontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ const lcxContent = {
window.onresize = this.setZoomLevel;
}

this.createPopup();
this.enabled = true;
},

createPopup: function() {
// Create and append stylesheet
this.loadStyleSheet();

Expand All @@ -64,9 +69,9 @@ const lcxContent = {
popup.style.setProperty('display', 'none', 'important');

this.setCustomStyling(popup);
this.setZoomLevel();
this.setZoomLevel(popup);

this.enabled = true;
return popup;
},

loadStyleSheet: function() {
Expand Down Expand Up @@ -143,8 +148,8 @@ const lcxContent = {
});
},

setZoomLevel: function () {
const popup = window.document.getElementById("liuchan-window");
setZoomLevel: function (popup) {
//const popup = window.document.getElementById("liuchan-window");
const zoomLevel = window.devicePixelRatio * 100;

// This functions scales the popup as the user zooms in order to make it seem as if it's not scaling. Yep.
Expand All @@ -169,7 +174,11 @@ const lcxContent = {

showPopup: function (text, elem, x, y) {
const wd = window.document;
const popup = wd.getElementById('liuchan-window');
let popup = wd.getElementById('liuchan-window');
if (popup === null) {
// Sometimes pages do some funky dynamic loading and we lose the popup, so we recreate it.
popup = this.createPopup();
}

if (isNaN(x) || isNaN(y)) {
x = 0;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "LiuChan Chinese Popup Dictionary",
"short_name": "LiuChan",
"version": "1.1.3",
"version": "1.1.4",
"options_page": "html/options.html",
"options_ui": {
"page": "html/options.html"
Expand Down

0 comments on commit 414e21f

Please sign in to comment.