diff --git a/.gitignore b/.gitignore index 23b8aa1..aa2e345 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ node_modules/ legacy/ dist/ build/ -npm-debug.log \ No newline at end of file +npm-debug.log* \ No newline at end of file diff --git a/assets/css/main.css b/assets/css/main.css index a282829..e4487bf 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -130,6 +130,10 @@ h1, h2 { top: 0; -webkit-app-region: drag; margin: 0; } + .titlebar #titlebar-title { + text-align: center; + line-height: 25px; + color: white; } .titlebar-close, .titlebar-minimize, diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 718a61b..fa2e231 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -145,6 +145,11 @@ h1, h2 { top: 0; -webkit-app-region: drag; margin: 0; + #titlebar-title { + text-align: center; + line-height: $titlebar-height; + color: white; + } } .titlebar-close, diff --git a/npm-debug.log.1845718106 b/npm-debug.log.1845718106 deleted file mode 100644 index 6282a7c..0000000 --- a/npm-debug.log.1845718106 +++ /dev/null @@ -1,71 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', -1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', -1 verbose cli 'run', -1 verbose cli 'start' ] -2 info using npm@4.1.2 -3 info using node@v7.5.0 -4 warn onload-script failed to require onload script npm-autoinit/autoinit -5 warn onload-script Error: Cannot find module 'npm-autoinit/autoinit' -5 warn onload-script at Function.Module._resolveFilename (module.js:470:15) -5 warn onload-script at Function.Module._load (module.js:418:25) -5 warn onload-script at Module.require (module.js:498:17) -5 warn onload-script at require (internal/module.js:20:19) -5 warn onload-script at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:203:11) -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:314:16 -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7 -5 warn onload-script at Array.forEach (native) -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 -5 warn onload-script at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) -5 warn onload-script { Error: Cannot find module 'npm-autoinit/autoinit' -5 warn onload-script at Function.Module._resolveFilename (module.js:470:15) -5 warn onload-script at Function.Module._load (module.js:418:25) -5 warn onload-script at Module.require (module.js:498:17) -5 warn onload-script at require (internal/module.js:20:19) -5 warn onload-script at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:203:11) -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:314:16 -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7 -5 warn onload-script at Array.forEach (native) -5 warn onload-script at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 -5 warn onload-script at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) code: 'MODULE_NOT_FOUND' } -6 verbose run-script [ 'prestart', 'start', 'poststart' ] -7 info lifecycle comic-reader@0.1.15~prestart: comic-reader@0.1.15 -8 silly lifecycle comic-reader@0.1.15~prestart: no script for prestart, continuing -9 info lifecycle comic-reader@0.1.15~start: comic-reader@0.1.15 -10 verbose lifecycle comic-reader@0.1.15~start: unsafe-perm in lifecycle true -11 verbose lifecycle comic-reader@0.1.15~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\projects\github\comic-reader\node_modules\.bin;C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\projects\github\comic-reader\node_modules\.bin;D:\cmder\bin;D:\cmder\vendor\conemu-maximus5\ConEmu\Scripts;D:\cmder\vendor\conemu-maximus5;D:\cmder\vendor\conemu-maximus5\ConEmu;C:\tools\ruby23\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5\;C:\Program Files (x86)\Windows Live\Shared;C:\Users\bee\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_121\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Skype\Phone\;C:\Users\bee\AppData\Local\Microsoft\WindowsApps;C:\Users\bee\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\bee\AppData\Local\atom\bin;C:\Users\bee\AppData\Roaming\npm;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;D:\cmder\ -12 verbose lifecycle comic-reader@0.1.15~start: CWD: D:\projects\github\comic-reader -13 silly lifecycle comic-reader@0.1.15~start: Args: [ '/d /s /c', 'electron .' ] -14 silly lifecycle comic-reader@0.1.15~start: Returned: code: 3221225786 signal: null -15 info lifecycle comic-reader@0.1.15~start: Failed to exec start script -16 verbose stack Error: comic-reader@0.1.15 start: `electron .` -16 verbose stack Exit status 3221225786 -16 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16) -16 verbose stack at emitTwo (events.js:106:13) -16 verbose stack at EventEmitter.emit (events.js:192:7) -16 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14) -16 verbose stack at emitTwo (events.js:106:13) -16 verbose stack at ChildProcess.emit (events.js:192:7) -16 verbose stack at maybeClose (internal/child_process.js:890:16) -16 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) -17 verbose pkgid comic-reader@0.1.15 -18 verbose cwd D:\projects\github\comic-reader -19 error Windows_NT 10.0.14393 -20 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start" -21 error node v7.5.0 -22 error npm v4.1.2 -23 error code ELIFECYCLE -24 error comic-reader@0.1.15 start: `electron .` -24 error Exit status 3221225786 -25 error Failed at the comic-reader@0.1.15 start script 'electron .'. -25 error Make sure you have the latest version of node.js and npm installed. -25 error If you do, this is most likely a problem with the comic-reader package, -25 error not with npm itself. -25 error Tell the author that this fails on your system: -25 error electron . -25 error You can get information on how to open an issue for this project with: -25 error npm bugs comic-reader -25 error Or if that isn't available, you can get their info via: -25 error npm owner ls comic-reader -25 error There is likely additional logging output above. -26 verbose exit [ 1, true ] diff --git a/package.json b/package.json index ca07d3f..c646c7b 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "comic-reader", - "productName:": "Comic Reader", + "productName": "Comic Reader", "author": "Team Comic Reader", - "version": "0.1.15", + "version": "0.1.16", "description": "A simple comic reader app", "main": "main.js", "devDependencies": { diff --git a/renderer-process/viewcontrollers/titlebar-viewcontroller.js b/renderer-process/viewcontrollers/titlebar-viewcontroller.js index e62197c..e5098e6 100644 --- a/renderer-process/viewcontrollers/titlebar-viewcontroller.js +++ b/renderer-process/viewcontrollers/titlebar-viewcontroller.js @@ -1,28 +1,60 @@ -var titlebar = require('titlebar'); +var titlebar = require('titlebar')(); +var pjson = require('../../package.json'); const remote = require('electron').remote; +module.exports = { + updateTitle: updateTitle +} -var log = function(name) { - return function(e) { - console.log(name, e); - }; -}; -var t = titlebar() - .appendTo(document.querySelector('#titlebar')) - .on('close', function() { - var window = remote.getCurrentWindow(); - window.close(); - }) - .on('minimize', function() { - var window = remote.getCurrentWindow(); - window.minimize(); - }) - .on('fullscreen', function() { - var window = remote.getCurrentWindow(); - window.setFullScreen(!window.isFullScreen()); - - }) - .on('maximize', function() { - var window = remote.getCurrentWindow(); - window.maximize(); - }); \ No newline at end of file + + +function updateTitle() { + if ($('#read-view').hasClass('is-hidden')) { + setTitle(pjson.productName); + } else { + var comicTitle = $('#comic-header').attr('title'); + var episode = $('.chapter-entry.active').text(); + setTitle(comicTitle, [episode]); + } +} + +function setTitle(name, options) { + var result = name; + if (options !== undefined) { + var subtitle = options.join('-'); + result += '-' + subtitle; + + } + $("#titlebar-title").text(result); +} + + +function lateInit() { + titlebar.appendTo(document.querySelector('#titlebar')) + .on('close', function() { + var window = remote.getCurrentWindow(); + window.close(); + }) + .on('minimize', function() { + var window = remote.getCurrentWindow(); + window.minimize(); + }) + .on('fullscreen', function() { + var window = remote.getCurrentWindow(); + window.setFullScreen(!window.isFullScreen()); + + }) + .on('maximize', function() { + var window = remote.getCurrentWindow(); + window.maximize(); + }); + + var div = document.createElement('div'); + div.id = 'titlebar-title'; + titlebar.element.appendChild(div); + + setTitle(pjson.productName); +} + + +$(document).ready(lateInit); \ No newline at end of file diff --git a/renderer-process/viewcontrollers/view-switch-viewcontroller.js b/renderer-process/viewcontrollers/view-switch-viewcontroller.js index 7edc8ce..a65d8a1 100644 --- a/renderer-process/viewcontrollers/view-switch-viewcontroller.js +++ b/renderer-process/viewcontrollers/view-switch-viewcontroller.js @@ -7,6 +7,7 @@ // var subscriber = require('../subscribe-viewmodel'); var read_viewcontroller = require('./read-viewcontroller'); +var titlebar_viewcontroller = require('./titlebar-viewcontroller'); // Variable definition var updateAllUIFunc; @@ -95,6 +96,8 @@ function onTabEntryClick() { if ($(this).attr('id') == "tab-read") { read_viewcontroller.scrollToPage(-1); } + + titlebar_viewcontroller.updateTitle(); } diff --git a/renderer-process/viewmodels/comicparse-viewmodel.js b/renderer-process/viewmodels/comicparse-viewmodel.js index 9c9f27a..17276dc 100644 --- a/renderer-process/viewmodels/comicparse-viewmodel.js +++ b/renderer-process/viewmodels/comicparse-viewmodel.js @@ -21,6 +21,7 @@ var favorite_viewcontroller = require('../viewcontrollers/favorite-viewcontrolle var read_viewcontroller = require('../viewcontrollers/read-viewcontroller'); var viewswitch_viewcontroller = require("../viewcontrollers/view-switch-viewcontroller"); var translate_viewcontroller = require("../viewcontrollers/translate-viewcontroller"); +var titlebar_viewcontroller = require("../viewcontrollers/titlebar-viewcontroller"); module.exports = { selectComic: selectComic @@ -196,6 +197,7 @@ function updateChapterList() { read_viewcontroller.updateChapterList(comic_data); var keypath = "comic." + read_viewcontroller.getCurHost() + "." + read_viewcontroller.getCurTitleKey(); settings.set(keypath, comic_data); + titlebar_viewcontroller.updateTitle(); } /** diff --git a/renderer-process/viewmodels/subscribe-viewmodel.js b/renderer-process/viewmodels/subscribe-viewmodel.js index e432a2a..5c0c16e 100644 --- a/renderer-process/viewmodels/subscribe-viewmodel.js +++ b/renderer-process/viewmodels/subscribe-viewmodel.js @@ -215,7 +215,6 @@ function updateSubscribeUIStatus() { favorite_viewcontroller.updateSubscribeUI(all_comic_data, hasSubscription()); read_viewcontroller.updateSubscribeUI(all_comic_data); translate_viewcontroller.translate(); - var page_idx = read_viewcontroller.getCurrentPageIdx(); var titlekey = read_viewcontroller.getCurTitleKey(); var host = read_viewcontroller.getCurHost();