Skip to content

Commit

Permalink
Merge pull request #39 from Cortys/2.3.0
Browse files Browse the repository at this point in the history
2.3.0
  • Loading branch information
Cortys committed Sep 23, 2015
2 parents 85c1a4d + 831a2d7 commit eff6272
Show file tree
Hide file tree
Showing 12 changed files with 314 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"randomString": true,
"Queue": true,
"chrome": true,
"TEMPORARY": true
"TEMPORARY": true,
"current_version": true,
"MetaData": true
}
}
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/backgroundManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ getSettings(function() {
callback({
what: "completed_zipping"
});
});
}, request.comment);
return true;
}
else if(request.what == "download_blob") {
Expand Down
28 changes: 20 additions & 8 deletions source/comicReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ getSettings(function() {
port.send({
what: "message_to_opener",
message: {
what: "ready_to_download"
what: "ready_to_download",
data: getName()
}
}, function(start) {
if(start)
Expand All @@ -94,7 +95,7 @@ getSettings(function() {
data: perc
}
});
});
}, start.metaData);
else if(start.exploit) {
port.send({
what: "unlink_from_opener"
Expand Down Expand Up @@ -530,7 +531,7 @@ function setupSelectors() { // run a DOM scan to analyse how the reader DOM tree
}

// download the opened comic. a callback and a step function can be used.
function loadComic(callback, step) {
function loadComic(callback, step, metaData) {

addTopBar();
overlay.style.display = "block";
Expand All @@ -551,10 +552,12 @@ function loadComic(callback, step) {

if(!dom.getCanvasContainer() || dom.loaderVisible() || !dom.countCanvas()) // delay download if comic isn't displayed yet => reader not ready, first page is not loaded yet, first page is not displayed yet
return setTimeout(function() {
loadComic(callback, step);
loadComic(callback, step, metaData);
}, 100);

var pos = -1,
skipCount = 0,
skipStreak = 0,
numLength = String(l - 1).length,
nextPage = function(callback) {
clearTimeout(noChangeTimeout);
Expand All @@ -575,13 +578,20 @@ function loadComic(callback, step) {
swapPage(function() {
// Only swap if no other actor already swapped pages:
var canvasContainer = dom.canvasContainer;

if(changeWaiter === callback) {

// Delay page skips if they occurred rarely so far or more than one in a row:
var delayFactor = Math.min(skipCount / pos, 1) > 0.3 && skipStreak < 2 ? 1 : 2;

noChangeTimeout = setTimeout(function() {
if(changeWaiter === callback && !dom.isLoading() && dom.isActivePage(fig) && canvasContainer === dom.canvasContainer) {
changeWaiter = null;
skipCount++;
skipStreak++;
nextPage(callback);
}
}, settings.pageSkipDelay);
}, settings.pageSkipDelay * delayFactor);
realClick(fig);
}
});
Expand All @@ -593,6 +603,7 @@ function loadComic(callback, step) {
interval = function() {
nextPage(function() {
getOpenedPage(function(page) {
skipStreak = 0;
port.send({
what: "add_page",
page: (settings.container != 2 ? page : null),
Expand Down Expand Up @@ -636,7 +647,7 @@ function loadComic(callback, step) {
zipImages(function() {
step("save");
downloadBlob(getName() + "." + (settings.container ? "zip" : "cbz"), done);
});
}, metaData);
}
},
rmListener = function() {
Expand Down Expand Up @@ -755,15 +766,16 @@ function downloadData(name, data, overwrite, callback) { // overwrite is not use
}

// compress and download all pages that were backuped by this tab in the loadComic function
function zipImages(callback) {
function zipImages(callback, comment) {
if(settings.container == 2)
return typeof callback === "function" ? callback() : undefined;
renderFaviconPercentage(1);
div.innerHTML = "Zipping images...";
div.style.lineHeight = "50px";

port.send({
what: "start_zipping"
what: "start_zipping",
comment: comment
}, function(result) {
renderFaviconPercentage(1);
div.innerHTML = "Saving comic...";
Expand Down
2 changes: 1 addition & 1 deletion source/common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var current_version = 117,
var current_version = 118,
div, linkStyle = "color:#ffffff;font-weight:bold;background:linear-gradient(to bottom, rgb(115, 152, 200) 0%,rgb(179, 206, 233) 1%,rgb(82, 142, 204) 5%,rgb(79, 137, 200) 20%,rgb(66, 120, 184) 50%,rgb(49, 97, 161) 100%);padding:3px;text-decoration:none;display:inline-block;width:70px;text-align:center;height:22px;box-sizing:border-box;line-height:14px;border:1px solid rgb(49,96,166);",
settings;

Expand Down
10 changes: 5 additions & 5 deletions 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.2.0",
"version": "2.3.0",
"minimum_chrome_version": "39",

"icons": {
Expand Down Expand Up @@ -32,16 +32,16 @@
},

"content_scripts": [{
"matches": ["*://www.comixology.com/comic-reader/*", "*://www.comixology.eu/comic-reader/*", "*://www.comixology.co.uk/comic-reader/*", "*://www.comixology.fr/comic-reader/*", "*://www.comixology.de/comic-reader/*", "*://comicstore.marvel.com/comic-reader/*"],
"matches": ["*://www.comixology.com/comic-reader/*", "*://www.comixology.eu/comic-reader/*", "*://www.comixology.co.uk/comic-reader/*", "*://www.comixology.fr/comic-reader/*", "*://www.comixology.de/comic-reader/*", "*://comicstore.marvel.com/comic-reader/*", "*://www.readdcentertainment.com/comic-reader/*"],
"js": ["common.js", "reactivateDom.js"],
"run_at": "document_start"
}, {
"matches": ["*://www.comixology.com/comic-reader/*", "*://www.comixology.eu/comic-reader/*", "*://www.comixology.co.uk/comic-reader/*", "*://www.comixology.fr/comic-reader/*", "*://www.comixology.de/comic-reader/*", "*://comicstore.marvel.com/comic-reader/*"],
"matches": ["*://www.comixology.com/comic-reader/*", "*://www.comixology.eu/comic-reader/*", "*://www.comixology.co.uk/comic-reader/*", "*://www.comixology.fr/comic-reader/*", "*://www.comixology.de/comic-reader/*", "*://comicstore.marvel.com/comic-reader/*", "*://www.readdcentertainment.com/comic-reader/*"],
"js": ["diffMatchPatch.js", "common.js", "comicReader.js"],
"run_at": "document_idle"
}, {
"matches": ["*://www.comixology.com/my-*", "*://www.comixology.eu/my-*", "*://www.comixology.co.uk/my-*", "*://www.comixology.fr/my-*", "*://www.comixology.de/my-*", "*://comicstore.marvel.com/my-*", "*://www.comixology.com/wishlists*", "*://www.comixology.eu/wishlists", "*://www.comixology.co.uk/wishlists", "*://www.comixology.fr/wishlists", "*://www.comixology.de/wishlists", "*://comicstore.marvel.com/wishlists"],
"js": ["common.js", "myBooks.js"],
"matches": ["*://www.comixology.com/my-*", "*://www.comixology.eu/my-*", "*://www.comixology.co.uk/my-*", "*://www.comixology.fr/my-*", "*://www.comixology.de/my-*", "*://comicstore.marvel.com/my-*", "*://www.readdcentertainment.com/my-*", "*://www.comixology.com/wishlists*", "*://www.comixology.eu/wishlists", "*://www.comixology.co.uk/wishlists", "*://www.comixology.fr/wishlists", "*://www.comixology.de/wishlists", "*://comicstore.marvel.com/wishlists", "*://www.readdcentertainment.com/wishlists"],
"js": ["common.js", "myBooks.js", "metaData.js"],
"run_at": "document_end"
}],

Expand Down
Loading

0 comments on commit eff6272

Please sign in to comment.