Skip to content

Commit 3e75989

Browse files
committed
Remove Kanpen export support
1 parent 7ebe972 commit 3e75989

32 files changed

Lines changed: 11 additions & 613 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 & 24 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() 仮置きデータを復旧する

src/pzpr/parser.js

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,6 @@
225225
case URL_PZPRV3:
226226
url = url + "?%PID%/";
227227
break;
228-
case URL_KANPEN:
229-
url = "http://www.kanpen.net/%KID%.html?problem=";
230-
break;
231-
case URL_KANPENP:
232-
url = "http://www.kanpen.net/%KID%.html?pzpr=";
233-
break;
234-
case URL_HEYAAPP:
235-
url = "http://www.geocities.co.jp/heyawake/?problem=";
236-
break;
237228
case URL_PZPRFILE:
238229
url = url + "?";
239230
break;
@@ -253,9 +244,7 @@
253244
if (this.type === URL_PZPRFILE) {
254245
url = url + typ;
255246
}
256-
return url
257-
.replace("%PID%", pzpr.variety(pid).urlid)
258-
.replace("%KID%", pzpr.variety(this.pid).kanpenid);
247+
return url.replace("%PID%", pzpr.variety(pid).urlid);
259248
},
260249

261250
//---------------------------------------------------------------------------
@@ -329,29 +318,15 @@
329318
out = [];
330319

331320
/* URLにつけるオプション */
332-
if (pzl.type !== URL_KANPEN && pzl.type !== URL_HEYAAPP) {
333-
if (pzl.variant !== null) {
334-
out.push("v:" + pzl.variant);
335-
}
336-
if (pzl.type === URL_KANPENP || !!pzl.pflag) {
337-
out.push(pzl.pflag);
338-
}
321+
if (pzl.variant !== null) {
322+
out.push("v:" + pzl.variant);
323+
}
324+
if (!!pzl.pflag) {
325+
out.push(pzl.pflag);
339326
}
340327

341328
/* サイズを表す文字列 */
342-
if (pzl.type === URL_KANPEN) {
343-
if (pzl.pid === "kakuro") {
344-
out.push(row + 1);
345-
out.push(col + 1);
346-
} else if (pzl.pid === "sudoku") {
347-
out.push(col);
348-
} else {
349-
out.push(row);
350-
out.push(col);
351-
}
352-
} else if (pzl.type === URL_HEYAAPP) {
353-
out.push([col, row].join("x"));
354-
} else if (pzl.type !== URL_PZPRFILE) {
329+
if (pzl.type !== URL_PZPRFILE) {
355330
out.push(col);
356331
out.push(row);
357332
}
@@ -731,16 +706,7 @@
731706
puzzlenode.appendChild(puzzlenode.querySelector("answer"));
732707
}
733708

734-
var outputdata;
735-
if (pzl.type !== FILE_PBOX_XML) {
736-
outputdata = out.join("\n");
737-
} else {
738-
outputdata = new XMLSerializer().serializeToString(this.body);
739-
if (!outputdata.match(/^\<\?xml/)) {
740-
outputdata = '<?xml version="1.0" encoding="UTF-8"?>\n' + outputdata;
741-
}
742-
}
743-
return outputdata;
709+
return out.join("\n");
744710
},
745711

746712
createXMLNode: function(name, attrs) {

0 commit comments

Comments
 (0)