Skip to content

Commit

Permalink
2.0.2 RC2
Browse files Browse the repository at this point in the history
fixed minor UI bug, that could cause wrong button sizing, when
switching from series pane to my books pane.

this introduces a minor performance loss, which is acceptable though.
  • Loading branch information
Cortys committed Dec 17, 2014
1 parent 029835f commit b9e2b66
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Binary file modified download.zip
Binary file not shown.
Binary file modified extension.crx
Binary file not shown.
2 changes: 1 addition & 1 deletion source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "Comixology Backup",
"description": "Save your Comixology comics as standard CBZ files.",
"version": "2.0.1",
"version": "2.0.2",
"minimum_chrome_version": "31",

"icons": {
Expand Down
17 changes: 11 additions & 6 deletions source/myBooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ getSettings(function() {
updateDialog();

var cssClass = randomString(20, 40),
readButtonSelector = ".action-button.read-action:not(."+cssClass+")",
allButtonSelector = ".action-button.read-action",
readButtonSelector = allButtonSelector+":not(."+cssClass+")",
injectCss = function() {
var style = document.createElement("style");
style.type = "text/css";
Expand Down Expand Up @@ -40,20 +41,22 @@ getSettings(function() {
var randomId = randomString(20, 40); // make sure cmxlgy can not break button text rendering by changing class names
clone.innerHTML = button.innerHTML.replace(button.innerText.trim(), "<span class='text "+randomId+"'></span><span class='cancel'>Stop</span>");
clone.style.position = "relative";
clone.style.width = parseInt(button.style.width = buttonComputedStyle.width) + "px";
clone.style.textAlign = button.style.textAlign = "center";
clone.href = "javascript:";
clone.classList.add(cssClass);

t.text = clone.querySelector("span.text."+randomId);

this.show = function(b) {
if(document.contains(clone))
return;

if(b && b.href == button.href && b !== button) // after switching pages via ajax new button html elements are created, those will be linked to the internal download object
button = this.readButton = b;

clone.style.width = parseInt(button.style.width = window.getComputedStyle(button).width) + "px";

if(document.contains(clone))
return;

var parent = function goUp(button) { // recursively search for right parent element of read button
if(button == null)
return null;
Expand Down Expand Up @@ -282,13 +285,15 @@ getSettings(function() {
new MutationObserver(function(mutations) {
var reinit = false;
mutations.forEach(function(mutation) {
if(mutation.addedNodes && mutation.addedNodes.length)
if(mutation.addedNodes && mutation.addedNodes.length || (mutation.attributeName && !mutation.target.matches(allButtonSelector)))
reinit = true;
});
if(reinit)
init();
}).observe(document.getElementById("page_content_container"), {
childList: true,
subtree: true
subtree: true,
attributes: true,
attributeFilter: ["style"]
});
});

0 comments on commit b9e2b66

Please sign in to comment.