Skip to content

Commit 758c254

Browse files
committed
Remove Kanpen export support
1 parent 7ebe972 commit 758c254

32 files changed

Lines changed: 14 additions & 1066 deletions

src-ui/js/ui/PopupMenu.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -487,17 +487,9 @@ ui.popupmgr.addpopup("urloutput", {
487487
},
488488

489489
reset: function(px, py) {
490-
var form = this.form,
491-
pid = ui.puzzle.pid,
492-
exists = pzpr.variety(pid).exists,
493-
parser = pzpr.parser;
490+
var parser = pzpr.parser;
494491
var url = ui.puzzle.getURL(parser.URL_PZPRV3);
495492
this.urlanchor.href = this.urlanchor.textContent = url;
496-
form.kanpen.style.display = form.kanpen.nextSibling.style.display = exists.kanpen
497-
? ""
498-
: "none";
499-
form.heyaapp.style.display = form.heyaapp.nextSibling.style.display =
500-
pid === "heyawake" ? "" : "none";
501493
},
502494

503495
show: function(px, py) {
@@ -513,17 +505,11 @@ ui.popupmgr.addpopup("urloutput", {
513505
var url = "",
514506
parser = pzpr.parser;
515507
switch (e.target.name) {
516-
case "kanpen":
517-
url = ui.puzzle.getURL(parser.URL_KANPEN);
518-
break;
519508
case "pzprv3e":
520509
url = ui.puzzle
521510
.getURL(parser.URL_PZPRV3)
522511
.replace(/\?(\w+)/, "?$1_edit");
523512
break;
524-
case "heyaapp":
525-
url = ui.puzzle.getURL(parser.URL_HEYAAPP);
526-
break;
527513
}
528514
this.urlanchor.href = this.urlanchor.textContent = url;
529515
}
@@ -577,9 +563,6 @@ ui.popupmgr.addpopup("filesave", {
577563
},
578564
reset: function() {
579565
/* ファイル形式選択オプション */
580-
var ispencilbox = pzpr.variety(ui.puzzle.pid).exists.pencilbox;
581-
this.form.filetype.options[1].disabled = !ispencilbox;
582-
this.form.filetype.options[2].disabled = !ispencilbox;
583566
var parser = pzpr.parser;
584567
this.form.ta.value = ui.puzzle.getFileData(parser.FILE_PZPR, {});
585568
this.form.ta2.value = this.form.ta.value.replace(/\n/g, "/");
@@ -637,12 +620,6 @@ ui.popupmgr.addpopup("filesave", {
637620
filetype = parser.FILE_PZPR,
638621
option = {};
639622
switch (form.filetype.value) {
640-
case "filesave2":
641-
filetype = parser.FILE_PBOX;
642-
break;
643-
case "filesave4":
644-
filetype = parser.FILE_PBOX_XML;
645-
break;
646623
case "filesave3":
647624
filetype = parser.FILE_PZPR;
648625
option.history = true;

src-ui/p.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,6 @@ <h2 id="title2">読み込み中です...</h2>
569569
<form name="urloutput">
570570
<a id="urlanchor" class="urlanchor" target="_blank"></a>
571571
<br>
572-
<button type="button" class="btn" data-button-exec="urloutput" name="kanpen" >__urloutput.kanpen__</button><br>
573-
<button type="button" class="btn" data-button-exec="urloutput" name="heyaapp">__urloutput.heyaapp__</button><br>
574572
<button type="button" class="btn" data-button-exec="urloutput" name="pzprv3e">__urloutput.pzprv3e__</button><br>
575573
<br>
576574
<button type="button" class="btn" data-button-exec="close">__close__</button>
@@ -603,8 +601,6 @@ <h2 id="title2">読み込み中です...</h2>
603601
<span>__filesave.format__</span>
604602
<select name="filetype" data-change-exec="changefilename">
605603
<option value="filesave">__filesave.format.pzprv3__</option>
606-
<option value="filesave2">__filesave.format.penciltxt__</option>
607-
<option value="filesave4">__filesave.format.pencilxml__</option>
608604
</select>
609605
<br>
610606
<span>__filesave.filename__</span>

src-ui/res/p.en.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,12 @@
241241
"urlinput.title": "Load from URL",
242242
"urlinput.submit": "Load",
243243
"urloutput.title": "Export URL",
244-
"urloutput.kanpen": "Change to Kanpen URL",
245-
"urloutput.heyaapp": "Change to Heyawake-Applet URL",
246244
"urloutput.pzprv3e": "Change to PUZ-PRE v3 Re-Edit URL",
247245
"fileopen.title": "Open File",
248246
"fileopen.choose": "Choose file",
249247
"filesave.title": "Save File",
250248
"filesave.format": "File format",
251249
"filesave.format.pzprv3": "Puz-Pre v3 format",
252-
"filesave.format.penciltxt": "Pencilbox Text format",
253-
"filesave.format.pencilxml": "Pencilbox XML format",
254250
"filesave.filename": "Filename",
255251
"filesave.submit": "Save",
256252
"filesave.invalid": "The filename contains invalid characters.",

src-ui/res/p.ja.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,12 @@
227227
"urlinput.title": "URL入力",
228228
"urlinput.submit": "読み込む",
229229
"urloutput.title": "URL出力",
230-
"urloutput.kanpen": "カンペンのURLを出力する",
231-
"urloutput.heyaapp": "へやわけアプレットのURLを出力する",
232230
"urloutput.pzprv3e": "ぱずぷれv3の再編集用URLを出力する",
233231
"fileopen.title": "ファイルを開く",
234232
"fileopen.choose": "ファイル選択",
235233
"filesave.title": "ファイルを保存する",
236234
"filesave.format": "ファイル形式",
237235
"filesave.format.pzprv3": "ファイル形式",
238-
"filesave.format.penciltxt": "pencilbox形式",
239-
"filesave.format.pencilxml": "pencilbox XML形式",
240236
"filesave.filename": "ファイル名",
241237
"filesave.submit": "保存",
242238
"filesave.invalid": "ファイル名として使用できない文字が含まれています。",

src/puzzle/Encode.js

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ pzpr.classmgr.makeCommon({
8585
bd = puzzle.board;
8686
var pzl = new pzpr.parser.URLData("", mode);
8787

88-
type =
89-
type || pzl.URL_PZPRV3; /* type===pzl.URL_AUTO(0)もまとめて変換する */
90-
if (type === pzl.URL_KANPEN && pid === "lits") {
91-
type = pzl.URL_KANPENP;
92-
}
88+
type = type || pzl.URL_PZPRV3;
9389

9490
this.outpflag = null;
9591
var variant = puzzle.getConfig("variant");
@@ -109,30 +105,6 @@ pzpr.classmgr.makeCommon({
109105
this.outbstr = lines.join("/");
110106
break;
111107

112-
case pzl.URL_PZPRAPP:
113-
throw Error("no implementation");
114-
115-
case pzl.URL_KANPENP:
116-
if (!puzzle.info.exists.kanpen) {
117-
throw Error("no implementation");
118-
}
119-
this.encodePzpr(pzl.URL_PZPRAPP);
120-
this.outpflag = this.outpflag || "";
121-
break;
122-
123-
case pzl.URL_KANPEN:
124-
this.fio = new puzzle.klass.FileIO();
125-
this.encodeKanpen();
126-
this.outbstr = this.fio.datastr
127-
.replace(/\r?\n/g, "/")
128-
.replace(/ /g, "_");
129-
this.fio = null;
130-
break;
131-
132-
case pzl.URL_HEYAAPP:
133-
this.encodeHeyaApp();
134-
break;
135-
136108
default:
137109
throw Error("invalid URL Type");
138110
}
@@ -158,14 +130,8 @@ pzpr.classmgr.makeCommon({
158130
decodeKanpen: function() {
159131
throw Error("no implementation");
160132
},
161-
encodeKanpen: function() {
162-
throw Error("no implementation");
163-
},
164133
decodeHeyaApp: function() {
165134
throw Error("no implementation");
166-
},
167-
encodeHeyaApp: function() {
168-
throw Error("no implementation");
169135
}
170136
}
171137
});

src/puzzle/FileData.js

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@
8585

8686
this.filever = 0;
8787
this.datastr = "";
88-
if (filetype === pzl.FILE_PBOX_XML) {
89-
this.xmldoc = new DOMParser().parseFromString(
90-
'<?xml version="1.0" encoding="utf-8" ?><puzzle />',
91-
"text/xml"
92-
);
93-
var puzzlenode = this.xmldoc.querySelector("puzzle");
94-
puzzlenode.appendChild(this.createXMLNode("board"));
95-
puzzlenode.appendChild(this.createXMLNode("answer"));
96-
}
9788

9889
// メイン処理
9990
switch (filetype) {
@@ -104,14 +95,6 @@
10495
}
10596
break;
10697

107-
case pzl.FILE_PBOX:
108-
this.kanpenSave();
109-
break;
110-
111-
case pzl.FILE_PBOX_XML:
112-
this.kanpenSaveXML();
113-
break;
114-
11598
default:
11699
throw Error("invalid filetype");
117100
}
@@ -120,11 +103,7 @@
120103
pzl.filever = this.filever;
121104
pzl.cols = bd.cols;
122105
pzl.rows = bd.rows;
123-
if (filetype !== pzl.FILE_PBOX_XML) {
124-
pzl.body = this.datastr;
125-
} else {
126-
pzl.body = this.xmldoc;
127-
}
106+
pzl.body = this.datastr;
128107
pzl.metadata.update(puzzle.metadata);
129108
if (option.history && filetype === pzl.FILE_PZPR) {
130109
pzl.history = puzzle.opemgr.encodeHistory({ time: !!option.time });
@@ -139,9 +118,7 @@
139118
decodeData: throwNoImplementation,
140119
encodeData: throwNoImplementation,
141120
kanpenOpen: throwNoImplementation,
142-
kanpenSave: throwNoImplementation,
143121
kanpenOpenXML: throwNoImplementation,
144-
kanpenSaveXML: throwNoImplementation,
145122

146123
//---------------------------------------------------------------------------
147124
// fio.decodeTrial() 仮置きデータを復旧する
@@ -447,10 +424,6 @@
447424
// fio.decodeCellXMLBoard() 配列で、個別文字列から個別セルの設定を行う (XML board用)
448425
// fio.decodeCellXMLBrow() 配列で、個別文字列から個別セルの設定を行う (XML board用)
449426
// fio.decodeCellXMLArow() 配列で、個別文字列から個別セルの設定を行う (XML answer用)
450-
// fio.encodeCellXMLBoard() 個別セルデータから個別文字列の設定を行う (XML board用)
451-
// fio.encodeCellXMLBrow() 個別セルデータから個別文字列の設定を行う (XML board用)
452-
// fio.encodeCellXMLArow() 個別セルデータから個別文字列の設定を行う (XML answer用)
453-
// fio.createXMLNode() 指定されたattributeを持つXMLのノードを作成する
454427
//---------------------------------------------------------------------------
455428
decodeCellXMLBoard: function(func) {
456429
var nodes = this.xmldoc.querySelectorAll("board number");
@@ -465,37 +438,14 @@
465438
}
466439
}
467440
},
468-
encodeCellXMLBoard: function(func) {
469-
var boardnode = this.xmldoc.querySelector("board");
470-
var bd = this.board;
471-
for (var i = 0; i < bd.cell.length; i++) {
472-
var cell = bd.cell[i],
473-
val = func(cell);
474-
if (val !== null) {
475-
boardnode.appendChild(
476-
this.createXMLNode("number", {
477-
r: ((cell.by / 2) | 0) + 1,
478-
c: ((cell.bx / 2) | 0) + 1,
479-
n: val
480-
})
481-
);
482-
}
483-
}
484-
},
485441

486442
PBOX_ADJUST: 0,
487443
decodeCellXMLBrow: function(func) {
488444
this.decodeCellXMLrow_com(func, "board", "brow");
489445
},
490-
encodeCellXMLBrow: function(func) {
491-
this.encodeCellXMLrow_com(func, "board", "brow");
492-
},
493446
decodeCellXMLArow: function(func) {
494447
this.decodeCellXMLrow_com(func, "answer", "arow");
495448
},
496-
encodeCellXMLArow: function(func) {
497-
this.encodeCellXMLrow_com(func, "answer", "arow");
498-
},
499449
decodeCellXMLrow_com: function(func, parentnodename, targetnodename) {
500450
var rownodes = this.xmldoc.querySelectorAll(
501451
parentnodename + " " + targetnodename
@@ -522,40 +472,6 @@
522472
}
523473
}
524474
}
525-
},
526-
encodeCellXMLrow_com: function(func, parentnodename, targetnodename) {
527-
var boardnode = this.xmldoc.querySelector(parentnodename);
528-
var ADJ = this.PBOX_ADJUST;
529-
var bd = this.board;
530-
for (var by = 1 - ADJ; by <= bd.maxby; by += 2) {
531-
var rownode = this.createXMLNode(targetnodename, {
532-
row: (((by + ADJ) / 2) | 0) + 1
533-
});
534-
for (var bx = 1 - ADJ; bx <= bd.maxbx; bx += 2) {
535-
var piece = bd.getobj(bx, by),
536-
nodename = func(piece),
537-
node;
538-
if (nodename.match(/n(\d\d+)/) || nodename.match(/n(\-\d+)/)) {
539-
node = this.createXMLNode("n", { v: RegExp.$1 });
540-
} else if (nodename === "n0") {
541-
node = this.createXMLNode("z");
542-
} else {
543-
node = this.createXMLNode(nodename);
544-
}
545-
rownode.appendChild(node);
546-
}
547-
boardnode.appendChild(rownode);
548-
}
549-
},
550-
551-
createXMLNode: function(name, attrs) {
552-
var node = this.xmldoc.createElement(name);
553-
if (!!attrs) {
554-
for (var i in attrs) {
555-
node.setAttribute(i, attrs[i]);
556-
}
557-
}
558-
return node;
559475
}
560476
}
561477
});

0 commit comments

Comments
 (0)