-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e963fd
commit e84b4cc
Showing
8 changed files
with
399 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
!!! 5 | ||
%html | ||
%head | ||
%meta(charset="utf-8") | ||
%meta(name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no") | ||
%meta(http-equiv="x-ua-compatible" content="ie=edge") | ||
%link(rel="stylesheet" type="text/css" href="../node_modules/bootstrap/dist/css/bootstrap.min.css") | ||
%link(rel="stylesheet" type="text/css" href="css/core.css") | ||
%body | ||
%nav.navbar.navbar-dark.bg-dark.sticky-top.mb-4 | ||
.mr-auto | ||
%a(href="./index.html") | ||
%button.btn(type="button") | ||
%img(src="./img/circle-left.svg" height="30px" width="30px") | ||
%span.navbar-brand.pl-2.translate(data-key="DEBUG_REPOSITORY_NAME") | ||
%button.btn#reload(type="button") | ||
%img(src="./img/loop2.svg" height="30px" width="30px") | ||
%button.btn#apply(type="button") | ||
%img(src="./img/checkmark2.svg" height="30px" width="30px") | ||
.container-fluid#debug-repo | ||
.row#root | ||
%description(:hasinfo="hasinfo" :name="infoname" :version="infoversion" :maintainer="infomaintainer" :changelog="changelog") | ||
.col-12.text-center(v-if="loading") | ||
%img.spin(src="./img/spinner2.svg" height="40px" width="40px") | ||
.col-12(v-else-if="error") | ||
%p | ||
%span.translate(data-key="ERROR_HAPPEN") | ||
%p {{errorMsg}} | ||
%big-category(v-else=true v-for="(v, k) in plist" :name="k" :val="v") | ||
.modal.fade#progress | ||
.modal-dialog | ||
.modal-content | ||
.modal-header | ||
%h4.modal-title | ||
%modal-body(:phase="phase" :log="log" :finished="finished") | ||
.modal-footer | ||
%button.btn.btn-primary(type="button" :disabled="!finished" @click="reset") | ||
%span.translate(data-key="BUTTON_CLOSE") | ||
.modal.fade#detail | ||
.modal-dialog | ||
.modal-content | ||
.modal-body#outwebview | ||
%webview#detailweb(src="about:blank" autosize="on") | ||
.modal-footer | ||
%button.btn.btn-primary(type="button" data-dismiss="modal") | ||
%span.translate(data-key="BUTTON_CLOSE") | ||
%script(type="text/javascript") | ||
window.jQuery = window.$ = require("../node_modules/jquery/dist/jquery.slim.min.js"); | ||
%script(src="../node_modules/popper.js/dist/umd/popper.min.js") | ||
%script(src="../node_modules/bootstrap/dist/js/bootstrap.min.js") | ||
%script(src="../node_modules/vue/dist/vue.min.js") | ||
%script(src="./js/repo_components.js") | ||
%script(src="./js/debug_repo.js") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
{remote} = require "electron" | ||
{shell} = remote | ||
plistList = remote.require("./plistList") | ||
plistInfo = remote.require("./plistInfo") | ||
util = remote.require("./util") | ||
config = remote.require("./config") | ||
applyMod = remote.require("./applyMod") | ||
request = remote.require("./request") | ||
lang = remote.require("./lang") | ||
|
||
path = config.get("debugRepo") | ||
repo = | ||
type: "local" | ||
name: path | ||
langName = config.get("lang") | ||
|
||
langTable = lang.get() | ||
transEle = document.getElementsByClassName("translate") | ||
for te in transEle | ||
te.textContent = langTable[te.dataset.key] | ||
|
||
r = new Vue( | ||
el: "#root" | ||
data: | ||
loading: false | ||
error: false | ||
errorMsg: "" | ||
plist: {} | ||
hasinfo: false | ||
infoname: "" | ||
infoversion: "" | ||
infomaintainer: "" | ||
changelog: "" | ||
created: -> | ||
do => | ||
await @getPlist() | ||
await r.getPlistWithOutBlackout(true) | ||
return | ||
@getInfo() | ||
@getChangelog() | ||
return | ||
methods: | ||
getPlist: (force = false) -> | ||
@loading = true | ||
@error = false | ||
try | ||
obj = await plistList.getUntilDone(repo, langName, force) | ||
@loading = false | ||
@plist = obj | ||
catch err | ||
@loading = false | ||
@error = true | ||
@errorMsg = err | ||
return | ||
getPlistWithOutBlackout: (force = false) -> | ||
@error = false | ||
try | ||
obj = await plistList.getUntilDone(repo, langName, force) | ||
if JSON.stringify(@plist) isnt JSON.stringify(obj) | ||
@plist = obj | ||
catch err | ||
@error = true | ||
@errorMsg = err | ||
return | ||
getInfo: (force = false) -> | ||
try | ||
{name, version, maintainer} = await plistInfo.get(repo, force) | ||
@hasinfo = true | ||
@infoname = name | ||
@infoversion = version | ||
@infomaintainer = maintainer | ||
catch | ||
@hasinfo = false | ||
return | ||
getChangelog: -> | ||
@changelog = await request.getChangelog(repo) | ||
return | ||
) | ||
|
||
onBeforeClose = (e) -> | ||
if !confirm(langTable.CONFIRM_APPLY_CLOSE_STRING) | ||
e.returnValue = false | ||
return | ||
|
||
document.getElementById("apply").addEventListener("click", -> | ||
return unless confirm(langTable.CONFIRM_APPLY_STRING) | ||
# 閉じる防止 | ||
window.addEventListener("beforeunload", onBeforeClose) | ||
|
||
addMods = [] | ||
deleteMods = [] | ||
for $mod in $("button:not(.applied) input:checked") | ||
addMods.push({repo, name: $mod.dataset.path, showname: $mod.dataset.name}) | ||
for $mod in $("button.applied input:not(:checked)") | ||
deleteMods.push({repo, name: $mod.dataset.path, showname: $mod.dataset.name}) | ||
|
||
$("#progress").modal({ keyboard: false, focus: true, backdrop: "static" }) | ||
errored = false | ||
await applyMod.applyMods(addMods, deleteMods, (phase, type, mod, err) -> | ||
if phase is "done" | ||
$button = $("button[data-path=\"#{mod.name}\"]") | ||
switch type | ||
when "add" | ||
$button.addClass("applied") | ||
p.addLog(mod.showname, langTable.MODAL_LOG_APPLIED) | ||
when "delete" | ||
$button.removeClass("applied") | ||
p.addLog(mod.showname, langTable.MODAL_LOG_REMOVED) | ||
else if phase is "fail" | ||
$checkbox = $("button[data-path=\"#{mod.name}\"]").find("input") | ||
errored = true | ||
switch type | ||
when "add" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_FAILED_APPLY+"(#{err})") | ||
$checkbox.prop("checked", false) | ||
when "delete" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_FAILED_REMOVE+"(#{err})") | ||
$checkbox.prop("checked", true) | ||
else | ||
switch phase | ||
when "download" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_DOWNLOAD_START) | ||
when "downloaded" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_DOWNLOAD_FINISH) | ||
when "copydir" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_COPY_START) | ||
when "zipextract" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_EXTRACT_START) | ||
when "zipextracted" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_EXTRACT_FINISH) | ||
when "tempdone" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_TEMP_DONE) | ||
when "zipcompress" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_COMPRESS_START) | ||
when "zipcompressed" | ||
p.addLog(mod.showname, langTable.MODAL_LOG_COMPRESS_FINISH) | ||
return | ||
) | ||
if !errored | ||
p.changePhase("done") | ||
else | ||
p.changePhase("failed") | ||
# 閉じる防止解除 | ||
window.removeEventListener("beforeunload", onBeforeClose) | ||
return | ||
) |
Oops, something went wrong.