From de5d42b0ad06783f135cc68e299f91c40bb71fca Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 16:16:01 +0200 Subject: [PATCH 01/27] something working --- Makefile | 62 ++++++++++++++++++++++++++++++++++++++ package.json | 1 + src/footer.js | 0 src/header.js | 7 +++++ src/pzpr/classmgr.js | 5 +++ src/pzpr/env.js | 2 +- src/pzpr/variety.js | 13 +++++--- src/variety/skyscrapers.js | 13 +++----- 8 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 src/footer.js create mode 100644 src/header.js diff --git a/Makefile b/Makefile index d8836a6e8..3cf2f265a 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,65 @@ serve: format: npm run-script format + +bundle: + cat \ + src/header.js \ + src/pzpr/env.js \ + src/pzpr/event.js \ + src/pzpr/classmgr.js \ + src/pzpr/variety.js \ + src/pzpr/parser.js \ + src/pzpr/metadata.js \ + src/pzpr/util.js \ + src/puzzle/Puzzle.js \ + src/puzzle/Config.js \ + src/puzzle/Address.js \ + src/puzzle/Piece.js \ + src/puzzle/PieceList.js \ + src/puzzle/Board.js \ + src/puzzle/BoardExec.js \ + src/puzzle/GraphBase.js \ + src/puzzle/LineManager.js \ + src/puzzle/AreaManager.js \ + src/puzzle/Graphic.js \ + src/puzzle/MouseInput.js \ + src/puzzle/KeyInput.js \ + src/puzzle/Encode.js \ + src/puzzle/FileData.js \ + src/puzzle/Answer.js \ + src/puzzle/Operation.js \ + src/variety-common/Graphic.js \ + src/variety-common/KeyInput.js \ + src/variety-common/MouseInput.js \ + src/variety-common/Answer.js \ + src/variety-common/BoardExec.js \ + src/variety-common/Encode.js \ + src/variety-common/FileData.js \ + src/footer.js \ + > src/bundle.js + + +subbundle: + # -l tinyify \ + ./node_modules/.bin/browserify \ + --exclude=pzpr-canvas \ + --exclude=pzpr-ui \ + --standalone=pzpr \ + --extension=mjs \ + src/bundle.mjs \ + > dist/js/bundle.js + +rollup: + ./node_modules/.bin/rollup \ + src/bundle.js \ + --file dist/js/bundle.js \ + --name pzpr \ + --format iife + + +candle: + ./node_modules/.bin/browserify \ + -i canvas \ + -r pzpr-canvas \ + > dist/js/candle.js diff --git a/package.json b/package.json index 9f130b7e5..6772eb866 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ }, "dependencies": { "pzpr-canvas": "^0.8.2", + "rollup": "^2.6.0", "source-map-support": "^0.5.12" } } diff --git a/src/footer.js b/src/footer.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/header.js b/src/header.js new file mode 100644 index 000000000..c88b11a02 --- /dev/null +++ b/src/header.js @@ -0,0 +1,7 @@ +var pzpr = {}; +export default pzpr; + +pzpr.Candle = require("pzpr-canvas"); +console.log("hi!", pzpr.Candle); + + diff --git a/src/pzpr/classmgr.js b/src/pzpr/classmgr.js index 6d7aa63e3..919183e6c 100644 --- a/src/pzpr/classmgr.js +++ b/src/pzpr/classmgr.js @@ -144,6 +144,10 @@ pzpr.classmgr = { // idを取得して、ファイルを読み込み //--------------------------------------------------------------- includeCustomFile: function(pid) { + var module = pzpr.variety(pid).module; + console.log("includeCustomFile", pid, module); + this.makeCustom(module[0], module[1]); + /* var scriptid = pzpr.variety(pid).script; if (this.includedFile[scriptid]) { return; @@ -160,6 +164,7 @@ pzpr.classmgr = { var exporteddata = require(customfile); this.makeCustom(exporteddata[0], exporteddata[1]); } + */ }, includedFile: {}, diff --git a/src/pzpr/env.js b/src/pzpr/env.js index fda29f701..94670bf86 100644 --- a/src/pzpr/env.js +++ b/src/pzpr/env.js @@ -72,7 +72,7 @@ pzpr.env = (function() { pzpr.lang = (function() { var userlang = pzpr.env.node - ? process.env.LANG + ? "XXX" // process.env.LANG : navigator.browserLanguage || navigator.language || navigator.userLanguage; return !userlang || userlang.substr(0, 2) === "ja" ? "ja" : "en"; })(); diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index 73db9c0e2..3e7fd4622 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -1,5 +1,7 @@ // Variety.js v3.4.1 +import mod_skyscrapers from "./variety/skyscrapers.js"; + (function() { var _info = {}, _list = []; @@ -45,6 +47,8 @@ }); delete variety.extend; + + (function(Genre, obj) { for (var pzprid in obj) { _info[pzprid] = new Genre(pzprid, obj[pzprid]); @@ -59,9 +63,10 @@ function Genre(pzprid, datalist) { this.valid = true; this.pid = pzprid; /* パズルID */ - this.script = !!datalist[4] - ? datalist[4] - : pzprid; /* スクリプトファイル(クラス) */ + this.module = datalist[4]; + // this.script = !!datalist[4] + // ? datalist[4] + // : pzprid; /* スクリプトファイル(クラス) */ this.ja = datalist[2]; /* 日本語パズル名 */ this.en = datalist[3]; /* 英語パズル名 */ this.exists = { @@ -110,7 +115,7 @@ 0, "ビルディングパズル", "Skyscrapers", - "", + mod_skyscrapers, { alias: "building", alias2: "skyscraper" } ], castle: [0, 0, "Castle Wall", "Castle Wall"], diff --git a/src/variety/skyscrapers.js b/src/variety/skyscrapers.js index b5fcfd2ed..8d5d34686 100644 --- a/src/variety/skyscrapers.js +++ b/src/variety/skyscrapers.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ビルディングパズル版 skyscrapers.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["skyscrapers"], { +var pidlist = ["skyscrapers"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -431,4 +426,6 @@ "The number of visible buildings is wrong." ] } -}); +} + +export default [pidlist, classbase]; From 2724d399be8a61a57513ed5ecf744e4023ad5fbd Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 17:07:12 +0200 Subject: [PATCH 02/27] metadata as module --- Makefile | 14 ++++---------- src-ui/p.html | 3 ++- src/header.js | 4 +++- src/puzzle/Puzzle.js | 4 +++- src/pzpr/metadata.js | 6 ++++-- src/pzpr/parser.js | 4 +++- 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 3cf2f265a..bb6d869f8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .PHONY: build test serve format +all: candle bundle rollup + build: npm run-script build @@ -20,7 +22,6 @@ bundle: src/pzpr/classmgr.js \ src/pzpr/variety.js \ src/pzpr/parser.js \ - src/pzpr/metadata.js \ src/pzpr/util.js \ src/puzzle/Puzzle.js \ src/puzzle/Config.js \ @@ -61,15 +62,8 @@ subbundle: > dist/js/bundle.js rollup: - ./node_modules/.bin/rollup \ - src/bundle.js \ - --file dist/js/bundle.js \ - --name pzpr \ - --format iife + ./node_modules/.bin/rollup -c candle: - ./node_modules/.bin/browserify \ - -i canvas \ - -r pzpr-canvas \ - > dist/js/candle.js + cp ./node_modules/pzpr-canvas/dist/candle.js ./dist/js/candle.js diff --git a/src-ui/p.html b/src-ui/p.html index 50fb44037..24f9c5861 100644 --- a/src-ui/p.html +++ b/src-ui/p.html @@ -11,7 +11,8 @@ - + + puzz.link player diff --git a/src/header.js b/src/header.js index c88b11a02..406dd3203 100644 --- a/src/header.js +++ b/src/header.js @@ -1,7 +1,9 @@ var pzpr = {}; export default pzpr; -pzpr.Candle = require("pzpr-canvas"); +import Candle from "pzpr-canvas"; + +pzpr.Candle = Candle; console.log("hi!", pzpr.Candle); diff --git a/src/puzzle/Puzzle.js b/src/puzzle/Puzzle.js index 2fec95ec5..426147990 100644 --- a/src/puzzle/Puzzle.js +++ b/src/puzzle/Puzzle.js @@ -1,5 +1,7 @@ // Puzzle.js v3.6.0 +// import MetaData from "./pzpr/metadata.js"; + (function() { //--------------------------------------------------------------------------- // ★Puzzleクラス ぱずぷれv3のベース処理やその他の処理を行う @@ -30,7 +32,7 @@ this.listeners = {}; - this.metadata = new pzpr.MetaData(); + this.metadata = new MetaData(); this.config = new this.Config(this); if (option.config !== void 0) { diff --git a/src/pzpr/metadata.js b/src/pzpr/metadata.js index 25c270c2c..4bfa5fc6d 100644 --- a/src/pzpr/metadata.js +++ b/src/pzpr/metadata.js @@ -3,8 +3,8 @@ //--------------------------------------------------------------------------- // MetaData構造体 作者やコメントなどの情報を保持する //--------------------------------------------------------------------------- -pzpr.MetaData = function() {}; -pzpr.MetaData.prototype = { +function MetaData() {}; +MetaData.prototype = { author: "", source: "", hard: "", @@ -44,3 +44,5 @@ pzpr.MetaData.prototype = { return true; } }; + +export default MetaData; diff --git a/src/pzpr/parser.js b/src/pzpr/parser.js index 6f1d1f938..214bbb989 100644 --- a/src/pzpr/parser.js +++ b/src/pzpr/parser.js @@ -1,5 +1,7 @@ // Parser.js v3.4.1 +import MetaData from "./pzpr/metadata.js"; + (function() { var URL_AUTO = 0, URL_PZPRV3 = 1, @@ -428,7 +430,7 @@ FileData = pzpr.parser.FileData = function(fstr, variety) { this.pid = !!variety ? variety : ""; this.fstr = fstr; - this.metadata = new pzpr.MetaData(); + this.metadata = new MetaData(); }; pzpr.parser.FileData.prototype = { pid: "", From b973ca9172be9b8cb73c419f07c5dbba8110b903 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 18:31:37 +0200 Subject: [PATCH 03/27] more imports --- Makefile | 12 ------------ test/load_testdata.js | 10 +++++----- test/puzzle/answer_test.js | 6 +++--- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index bb6d869f8..dab82e63c 100644 --- a/Makefile +++ b/Makefile @@ -50,20 +50,8 @@ bundle: src/footer.js \ > src/bundle.js - -subbundle: - # -l tinyify \ - ./node_modules/.bin/browserify \ - --exclude=pzpr-canvas \ - --exclude=pzpr-ui \ - --standalone=pzpr \ - --extension=mjs \ - src/bundle.mjs \ - > dist/js/bundle.js - rollup: ./node_modules/.bin/rollup -c - candle: cp ./node_modules/pzpr-canvas/dist/candle.js ./dist/js/candle.js diff --git a/test/load_testdata.js b/test/load_testdata.js index 7b61fd2f8..ac0a06067 100644 --- a/test/load_testdata.js +++ b/test/load_testdata.js @@ -1,6 +1,6 @@ // test/load_testdata.js -var pzpr = require("../dist/js/pzpr.js"); +var pzpr = require("../dist/js/bundle.js"); // Load test data var testdata = {}; @@ -12,8 +12,8 @@ global.ui = { } } }; -pzpr.variety.each(function(pid) { - require("./script/" + pid + ".js"); -}); +// pzpr.variety.each(function(pid) { + // require("./script/" + pid + ".js"); +// }); -module.exports = testdata; +export default testdata; diff --git a/test/puzzle/answer_test.js b/test/puzzle/answer_test.js index 43299f190..d5e1a1941 100644 --- a/test/puzzle/answer_test.js +++ b/test/puzzle/answer_test.js @@ -1,10 +1,10 @@ // test/answer_test.js -var assert = require("assert"); +import assert from "assert"; -var pzpr = require("../../dist/js/pzpr.js"); +import pzpr from "../../src/bundle.js"; -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; pzpr.variety.each(function(pid) { describe(pid + " answer test", function() { From e5ed6145295eb8b3ee327a70fbb95f7b74000f93 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 18:48:53 +0200 Subject: [PATCH 04/27] take out variety.js --- Makefile | 1 - src/header.js | 5 ++++- src/puzzle/Config.js | 4 +++- src/pzpr/classmgr.js | 10 ++++++---- src/pzpr/variety.js | 10 +++++----- test/puzzle/answer_test.js | 0 6 files changed, 18 insertions(+), 12 deletions(-) mode change 100644 => 100755 test/puzzle/answer_test.js diff --git a/Makefile b/Makefile index dab82e63c..740909a91 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,6 @@ bundle: src/pzpr/env.js \ src/pzpr/event.js \ src/pzpr/classmgr.js \ - src/pzpr/variety.js \ src/pzpr/parser.js \ src/pzpr/util.js \ src/puzzle/Puzzle.js \ diff --git a/src/header.js b/src/header.js index 406dd3203..db59f842c 100644 --- a/src/header.js +++ b/src/header.js @@ -2,8 +2,11 @@ var pzpr = {}; export default pzpr; import Candle from "pzpr-canvas"; - pzpr.Candle = Candle; + console.log("hi!", pzpr.Candle); +import variety from "./pzpr/variety.js"; +pzpr.variety = variety; + diff --git a/src/puzzle/Config.js b/src/puzzle/Config.js index 94dd04f0a..de786a9ab 100644 --- a/src/puzzle/Config.js +++ b/src/puzzle/Config.js @@ -1,5 +1,7 @@ // Config.js v3.4.1 +// import variety from './pzpr/variety.js'; + (function() { //--------------------------------------------------------------------------- // ★Configクラス 設定値の値などを保持する @@ -143,7 +145,7 @@ if (argname.match(/\@/)) { var splitted = argname.split(/\@/); info.name = splitted[0]; - var pid = pzpr.variety.toPID(splitted[1]); + var pid = variety.toPID(splitted[1]); if (!!pid) { info.pid = pid; } diff --git a/src/pzpr/classmgr.js b/src/pzpr/classmgr.js index 919183e6c..9bc127642 100644 --- a/src/pzpr/classmgr.js +++ b/src/pzpr/classmgr.js @@ -1,5 +1,7 @@ // classmgr.js v3.6.0 +// import variety from './pzpr/variety.js'; + //--------------------------------------------------------------- // クラス設定用関数など //--------------------------------------------------------------- @@ -144,11 +146,11 @@ pzpr.classmgr = { // idを取得して、ファイルを読み込み //--------------------------------------------------------------- includeCustomFile: function(pid) { - var module = pzpr.variety(pid).module; + var module = variety(pid).module; console.log("includeCustomFile", pid, module); this.makeCustom(module[0], module[1]); /* - var scriptid = pzpr.variety(pid).script; + var scriptid = variety(pid).script; if (this.includedFile[scriptid]) { return; } @@ -172,7 +174,7 @@ pzpr.classmgr = { // 新しくパズルのファイルを開く時の処理 //--------------------------------------------------------------------------- setPuzzleClass: function(puzzle, newpid, callback) { - if (!pzpr.variety(newpid).valid) { + if (!variety(newpid).valid) { puzzle.emit("fail-open"); throw "Invalid Puzzle Variety Selected"; } @@ -226,7 +228,7 @@ pzpr.classmgr = { this.setPrototypeRef(puzzle, "klass", puzzle.klass); puzzle.pid = pid; - puzzle.info = pzpr.variety(pid); + puzzle.info = variety(pid); }, //--------------------------------------------------------------------------- diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index 3e7fd4622..45aab34eb 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -1,8 +1,7 @@ // Variety.js v3.4.1 -import mod_skyscrapers from "./variety/skyscrapers.js"; +import mod_skyscrapers from "../variety/skyscrapers.js"; -(function() { var _info = {}, _list = []; function toPID(name) { @@ -22,9 +21,9 @@ import mod_skyscrapers from "./variety/skyscrapers.js"; return ""; } - var variety = (pzpr.variety = pzpr.genre = function(pid) { + var variety = function(pid) { return _info[toPID(pid)] || { valid: false }; - }); + }; variety.extend = function(obj) { for (var n in obj) { this[n] = obj[n]; @@ -328,4 +327,5 @@ import mod_skyscrapers from "./variety/skyscrapers.js"; yosenabe: [0, 0, "よせなべ", "Yosenabe"] } ); -})(); + +export default variety; diff --git a/test/puzzle/answer_test.js b/test/puzzle/answer_test.js old mode 100644 new mode 100755 From 5bc5c016e6d336ed1be0920ac0362a267ce42726 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 18:58:04 +0200 Subject: [PATCH 05/27] take the classmgr out --- Makefile | 1 - src/header.js | 7 ++++-- src/pzpr/classmgr.js | 46 ++++++++++++++++++++------------------ test/puzzle/answer_test.js | 0 4 files changed, 29 insertions(+), 25 deletions(-) mode change 100755 => 100644 test/puzzle/answer_test.js diff --git a/Makefile b/Makefile index 740909a91..6376ff284 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ bundle: src/header.js \ src/pzpr/env.js \ src/pzpr/event.js \ - src/pzpr/classmgr.js \ src/pzpr/parser.js \ src/pzpr/util.js \ src/puzzle/Puzzle.js \ diff --git a/src/header.js b/src/header.js index db59f842c..82ae27823 100644 --- a/src/header.js +++ b/src/header.js @@ -1,11 +1,14 @@ var pzpr = {}; export default pzpr; -import Candle from "pzpr-canvas"; +import Candle from 'pzpr-canvas'; pzpr.Candle = Candle; - console.log("hi!", pzpr.Candle); +import {common, custom, classmgr} from './pzpr/classmgr.js'; +pzpr.common = common; +pzpr.custom = custom; +pzpr.classmgr = classmgr; import variety from "./pzpr/variety.js"; pzpr.variety = variety; diff --git a/src/pzpr/classmgr.js b/src/pzpr/classmgr.js index 9bc127642..d5173753b 100644 --- a/src/pzpr/classmgr.js +++ b/src/pzpr/classmgr.js @@ -1,17 +1,17 @@ // classmgr.js v3.6.0 -// import variety from './pzpr/variety.js'; +import variety from './variety.js'; //--------------------------------------------------------------- // クラス設定用関数など //--------------------------------------------------------------- -pzpr.common = {}; // CoreClass保存用 -pzpr.custom = { "": {} }; // パズル別クラス保存用 +var common = {}; // CoreClass保存用 +var custom = { "": {} }; // パズル別クラス保存用 //---------------------------------------------------------------------------- // ★pzpr.classmgrオブジェクト (クラス作成関数等) //--------------------------------------------------------------------------- -pzpr.classmgr = { +var classmgr = { //--------------------------------------------------------------- // 共通クラス・パズル別クラスに継承させる親クラスを生成する //--------------------------------------------------------------- @@ -21,14 +21,14 @@ pzpr.classmgr = { createCommon: function(commonbase) { for (var key in commonbase) { var names = this.searchName(key), - NewClass = pzpr.common[names.real]; + NewClass = common[names.real]; if (!NewClass) { - NewClass = this.createClass(pzpr.common[names.base]); + NewClass = this.createClass(common[names.base]); NewClass.prototype.common = NewClass.prototype; NewClass.prototype.pid = ""; } this.extendPrototype(NewClass.prototype, commonbase[key]); - pzpr.common[names.real] = pzpr.custom[""][names.real] = NewClass; + common[names.real] = custom[""][names.real] = NewClass; } }, @@ -38,7 +38,7 @@ pzpr.classmgr = { makeCustom: function(pidlist, custombase) { for (var i = 0; i < pidlist.length; i++) { var pid = pidlist[i]; - pzpr.custom[pid] = this.createCustom(pid, custombase); + custom[pid] = this.createCustom(pid, custombase); } }, getExtension: function(pid, custombase) { @@ -74,32 +74,32 @@ pzpr.classmgr = { return extension; }, createCustom: function(pid, custombase) { - var custom = {}; + var local_custom = {}; var extension = this.getExtension(pid, custombase); // 追加プロパティが指定されているクラスを作成する for (var key in extension) { var names = this.searchName(key), - NewClass = custom[names.real]; + NewClass = local_custom[names.real]; if (!NewClass) { NewClass = this.createClass( - custom[names.base] || pzpr.common[names.base] + local_custom[names.base] || common[names.base] ); NewClass.prototype.pid = pid; } this.extendPrototype(NewClass.prototype, extension[key]); - custom[names.real] = NewClass; + local_custom[names.real] = NewClass; } // 指定がなかった残りの共通クラスを作成(コピー)する - for (var classname in pzpr.common) { - if (!custom[classname]) { - custom[classname] = this.createClass(pzpr.common[classname]); - custom[classname].prototype.pid = pid; + for (var classname in common) { + if (!local_custom[classname]) { + local_custom[classname] = this.createClass(common[classname]); + local_custom[classname].prototype.pid = pid; } } - return custom; + return local_custom; }, //--------------------------------------------------------------- @@ -181,9 +181,9 @@ pzpr.classmgr = { /* 今のパズルと別idの時 */ if (puzzle.pid !== newpid) { - if (!pzpr.custom[newpid]) { + if (!custom[newpid]) { this.includeCustomFile(newpid); - if (!pzpr.custom[newpid]) { + if (!custom[newpid]) { /* Customファイルが読み込みできるまで待つ */ setTimeout(function() { pzpr.classmgr.setPuzzleClass(puzzle, newpid, callback); @@ -210,15 +210,15 @@ pzpr.classmgr = { /* 現在のクラスを消去する */ puzzle.klass = {}; - var custom = pzpr.custom[pid]; - for (var classname in custom) { + var local_custom = custom[pid]; + for (var classname in local_custom) { var PuzzleClass = (puzzle.klass[classname] = function() { var args = Array.prototype.slice.apply(arguments); if (!!this.initialize) { this.initialize.apply(this, args); } }); - var CustomProto = custom[classname].prototype; + var CustomProto = local_custom[classname].prototype; for (var name in CustomProto) { PuzzleClass.prototype[name] = CustomProto[name]; } @@ -240,3 +240,5 @@ pzpr.classmgr = { } } }; + +export {common, custom, classmgr}; diff --git a/test/puzzle/answer_test.js b/test/puzzle/answer_test.js old mode 100755 new mode 100644 From ae2e9a403959cca8acd1b196996802c1abecb9be Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 19:15:06 +0200 Subject: [PATCH 06/27] take more out --- Makefile | 2 -- src/header.js | 7 +++++++ src/puzzle/Config.js | 7 ++++--- src/puzzle/Graphic.js | 10 ++++++---- src/puzzle/MouseInput.js | 8 +++++--- src/pzpr/env.js | 18 ++++++++--------- src/pzpr/parser.js | 42 +++++++++++++++++++++------------------- 7 files changed, 53 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index 6376ff284..825ec8a41 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,7 @@ format: bundle: cat \ src/header.js \ - src/pzpr/env.js \ src/pzpr/event.js \ - src/pzpr/parser.js \ src/pzpr/util.js \ src/puzzle/Puzzle.js \ src/puzzle/Config.js \ diff --git a/src/header.js b/src/header.js index 82ae27823..109f3352d 100644 --- a/src/header.js +++ b/src/header.js @@ -5,6 +5,10 @@ import Candle from 'pzpr-canvas'; pzpr.Candle = Candle; console.log("hi!", pzpr.Candle); +import {env, lang} from "./pzpr/env.js"; +pzpr.env = env; +pzpr.lang = lang; + import {common, custom, classmgr} from './pzpr/classmgr.js'; pzpr.common = common; pzpr.custom = custom; @@ -13,3 +17,6 @@ pzpr.classmgr = classmgr; import variety from "./pzpr/variety.js"; pzpr.variety = variety; +import Parser from "./pzpr/parser.js"; +pzpr.parser = Parser; + diff --git a/src/puzzle/Config.js b/src/puzzle/Config.js index de786a9ab..8cc0177b9 100644 --- a/src/puzzle/Config.js +++ b/src/puzzle/Config.js @@ -1,6 +1,7 @@ // Config.js v3.4.1 -// import variety from './pzpr/variety.js'; +// import variety from '../pzpr/variety.js'; +// import env from '../pzpr/env.js'; (function() { //--------------------------------------------------------------------------- @@ -43,7 +44,7 @@ this.add("squarecell", true); /* セルは正方形にする */ /* 入力方法設定 */ - this.add("use", !pzpr.env.API.touchevent ? 1 : 2, { + this.add("use", !env.API.touchevent ? 1 : 2, { option: [1, 2] }); /* 黒マスの入力方法 */ this.add("use_tri", 1, { @@ -57,7 +58,7 @@ this.add("bgcolor", false); /* slither 背景色入力 */ this.add( "singlenum", - !pzpr.env.API.touchevent + !env.API.touchevent ); /* hanare: 部屋に回答数字を一つだけ入力 */ this.add("enline", true); /* kouchoku: 線は点の間のみ引ける */ this.add("lattice", true); /* kouchoku: 格子点チェック */ diff --git a/src/puzzle/Graphic.js b/src/puzzle/Graphic.js index f1f74781e..06f918381 100644 --- a/src/puzzle/Graphic.js +++ b/src/puzzle/Graphic.js @@ -1,5 +1,7 @@ // Graphic.js v3.4.1 +// import env from '../pzpr/env.js'; + (function() { var CENTER = 1, BOTTOMLEFT = 2, @@ -218,7 +220,7 @@ //--------------------------------------------------------------------------- initFont: function() { var isgothic = this.puzzle.getConfig("font") === 1; - if (this.puzzle.pzpr.env.OS.Android) { + if (env.OS.Android) { this.fontfamily = isgothic ? "Helvetica, Verdana, Arial, " : '"Times New Roman", '; @@ -296,7 +298,7 @@ var cw = (cwid / cols) | 0, ch = (chgt / rows) | 0; - this.devicePixelRatio = this.puzzle.pzpr.env.browser + this.devicePixelRatio = env.browser ? window.devicePixelRatio || 1 : 1; @@ -438,8 +440,8 @@ } this.isSupportMaxWidth = - (this.context.use.svg && pzpr.env.API.svgTextLength) || - (this.context.use.canvas && pzpr.env.API.maxWidth); + (this.context.use.svg && env.API.svgTextLength) || + (this.context.use.canvas && env.API.maxWidth); var bd = this.board, bm = 2 * this.margin, diff --git a/src/puzzle/MouseInput.js b/src/puzzle/MouseInput.js index 6fbeef65d..86026c264 100644 --- a/src/puzzle/MouseInput.js +++ b/src/puzzle/MouseInput.js @@ -1,5 +1,7 @@ // MouseInput.js v3.5.2 +// import env from '../pzpr/env.js'; + //--------------------------------------------------------------------------- // ★MouseEventクラス マウス入力に関する情報の保持とイベント処理を扱う //--------------------------------------------------------------------------- @@ -167,9 +169,9 @@ pzpr.classmgr.makeCommon({ return pix; } if ( - !pzpr.env.API.touchevent || - pzpr.env.API.pointerevent || - pzpr.env.OS.iOS + !env.API.touchevent || + env.API.pointerevent || + env.OS.iOS ) { if (!isNaN(e.offsetX)) { pix = { px: e.offsetX, py: e.offsetY }; diff --git a/src/pzpr/env.js b/src/pzpr/env.js index 94670bf86..fefa519d7 100644 --- a/src/pzpr/env.js +++ b/src/pzpr/env.js @@ -1,10 +1,11 @@ // env.js v3.4.0 +// +import Candle from 'pzpr-canvas'; /**************/ /* 環境の取得 */ /**************/ -pzpr.env = (function() { - var isbrowser = pzpr.Candle.env.browser; + var isbrowser = Candle.env.browser; var UA = isbrowser ? navigator.userAgent : ""; var ios = UA.indexOf("like Mac OS X") > -1; @@ -61,18 +62,17 @@ pzpr.env = (function() { isbrowser && document.createElement("a").download !== void 0 }; - return { + var env = { bz: bz, OS: os, API: api, browser: isbrowser, - node: pzpr.Candle.env.node + node: Candle.env.node }; -})(); -pzpr.lang = (function() { - var userlang = pzpr.env.node + var userlang = env.node ? "XXX" // process.env.LANG : navigator.browserLanguage || navigator.language || navigator.userLanguage; - return !userlang || userlang.substr(0, 2) === "ja" ? "ja" : "en"; -})(); + var lang = !userlang || userlang.substr(0, 2) === "ja" ? "ja" : "en"; + +export { env, lang } diff --git a/src/pzpr/parser.js b/src/pzpr/parser.js index 214bbb989..c3d28dced 100644 --- a/src/pzpr/parser.js +++ b/src/pzpr/parser.js @@ -1,8 +1,9 @@ // Parser.js v3.4.1 -import MetaData from "./pzpr/metadata.js"; +import MetaData from "./metadata.js"; +import variety from "./variety.js"; +import { env } from "./env.js"; -(function() { var URL_AUTO = 0, URL_PZPRV3 = 1, URL_PZPRAPP = 2, @@ -17,8 +18,8 @@ import MetaData from "./pzpr/metadata.js"; var URLData, FileData, Parser; - Parser = pzpr.parser = function(data, variety) { - return Parser.parse(data, variety); + var Parser = function(data, l_variety) { + return Parser.parse(data, l_variety); }; Parser.extend = function(obj) { for (var n in obj) { @@ -43,12 +44,12 @@ import MetaData from "./pzpr/metadata.js"; /* 入力された文字列を、URLおよびファイルデータとして解析し返します */ /* ただし最初から解析済みのデータが渡された場合は、それをそのまま返します */ - parse: function(data, variety) { + parse: function(data, l_variety) { if (data instanceof URLData || data instanceof FileData) { return data; } - return this.parseFile(data, variety) || this.parseURL(data); + return this.parseFile(data, l_variety) || this.parseURL(data); }, parseURL: function(url) { @@ -59,7 +60,7 @@ import MetaData from "./pzpr/metadata.js"; url = url.replace(/(\r|\n)/g, ""); // textarea上の改行が実際の改行扱いになるUAに対応(Operaとか) return new URLData(url).parse(); }, - parseFile: function(fstr, variety) { + parseFile: function(fstr, l_variety) { if (fstr instanceof FileData) { return fstr; } @@ -67,7 +68,7 @@ import MetaData from "./pzpr/metadata.js"; if (!fstr.match(/^\<\?xml/)) { fstr = fstr.replace(/[\t\r]*\n/g, "\n").replace(/\//g, "\n"); } - return new FileData(fstr, variety).parse(); + return new FileData(fstr, l_variety).parse(); } }); delete Parser.extend; @@ -75,13 +76,13 @@ import MetaData from "./pzpr/metadata.js"; //--------------------------------------------------------------------------- // ★ URLData() URLデータのencode/decodeのためのオブジェクト //--------------------------------------------------------------------------- - URLData = pzpr.parser.URLData = function(url, mode) { + URLData = Parser.URLData = function(url, mode) { this.url = url; if (mode !== void 0) { this.mode = mode; } }; - pzpr.parser.URLData.prototype = { + Parser.URLData.prototype = { pid: "", mode: "", type: URL_AUTO /* ==0 */, @@ -190,7 +191,7 @@ import MetaData from "./pzpr/metadata.js"; this.type = URL_PZPRV3; } } - this.pid = pzpr.variety.toPID(this.pid); + this.pid = variety.toPID(this.pid); }, //--------------------------------------------------------------------------- @@ -198,7 +199,7 @@ import MetaData from "./pzpr/metadata.js"; //--------------------------------------------------------------------------- outputURLType: function() { var url = ""; - if (pzpr.env.node) { + if (env.node) { url = "http://pzv.jp/p.html"; } else { url = location.protocol + "//" + location.host + location.pathname; @@ -236,8 +237,8 @@ import MetaData from "./pzpr/metadata.js"; url = url + typ; } return url - .replace("%PID%", pzpr.variety(pid).urlid) - .replace("%KID%", pzpr.variety(this.pid).kanpenid); + .replace("%PID%", variety(pid).urlid) + .replace("%KID%", variety(this.pid).kanpenid); }, //--------------------------------------------------------------------------- @@ -427,12 +428,12 @@ import MetaData from "./pzpr/metadata.js"; //--------------------------------------------------------------------------- // ★ FileData() ファイルデータのencode/decodeのためのオブジェクト //--------------------------------------------------------------------------- - FileData = pzpr.parser.FileData = function(fstr, variety) { - this.pid = !!variety ? variety : ""; + FileData = Parser.FileData = function(fstr, l_variety) { + this.pid = !!l_variety ? l_variety : ""; this.fstr = fstr; this.metadata = new MetaData(); }; - pzpr.parser.FileData.prototype = { + Parser.FileData.prototype = { pid: "", type: FILE_AUTO /* == 0 */, filever: 0, @@ -499,7 +500,7 @@ import MetaData from "./pzpr/metadata.js"; } else { this.pid = ""; } - this.pid = pzpr.variety.toPID(this.pid); + this.pid = variety.toPID(this.pid); return !!this.pid; }, @@ -518,7 +519,7 @@ import MetaData from "./pzpr/metadata.js"; } else if (this.type === FILE_PBOX_XML) { this.body .querySelector("puzzle") - .setAttribute("type", pzpr.variety(this.pid).kanpenid); + .setAttribute("type", variety(this.pid).kanpenid); } return ""; }, @@ -794,4 +795,5 @@ import MetaData from "./pzpr/metadata.js"; } } }; -})(); + +export default Parser; From ea416772a6632cc995bec207aa57de9e6ae36a1b Mon Sep 17 00:00:00 2001 From: Harmen Date: Sat, 11 Apr 2020 19:31:50 +0200 Subject: [PATCH 07/27] move more out --- Makefile | 3 --- src/header.js | 10 +++++----- src/puzzle/Address.js | 4 +++- src/puzzle/Puzzle.js | 45 +++++++++++++++++++++++-------------------- src/pzpr/util.js | 15 ++++++++------- 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 825ec8a41..0a24bcb1b 100644 --- a/Makefile +++ b/Makefile @@ -18,10 +18,7 @@ bundle: cat \ src/header.js \ src/pzpr/event.js \ - src/pzpr/util.js \ - src/puzzle/Puzzle.js \ src/puzzle/Config.js \ - src/puzzle/Address.js \ src/puzzle/Piece.js \ src/puzzle/PieceList.js \ src/puzzle/Board.js \ diff --git a/src/header.js b/src/header.js index 109f3352d..26003ab9e 100644 --- a/src/header.js +++ b/src/header.js @@ -3,20 +3,20 @@ export default pzpr; import Candle from 'pzpr-canvas'; pzpr.Candle = Candle; -console.log("hi!", pzpr.Candle); - import {env, lang} from "./pzpr/env.js"; pzpr.env = env; pzpr.lang = lang; - import {common, custom, classmgr} from './pzpr/classmgr.js'; pzpr.common = common; pzpr.custom = custom; pzpr.classmgr = classmgr; - import variety from "./pzpr/variety.js"; pzpr.variety = variety; - import Parser from "./pzpr/parser.js"; pzpr.parser = Parser; +import util from "./pzpr/util.js"; +pzpr.util = util; +import Puzzle from "./puzzle/Puzzle.js"; +pzpr.Puzzle = Puzzle; +import "./puzzle/Address.js"; diff --git a/src/puzzle/Address.js b/src/puzzle/Address.js index a16f376a4..317ae136b 100644 --- a/src/puzzle/Address.js +++ b/src/puzzle/Address.js @@ -1,6 +1,8 @@ // Address.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from "../pzpr/classmgr.js"; + +classmgr.makeCommon({ //---------------------------------------------------------------------------- // ★Positionクラス Address, Pieceクラスのベースクラス //--------------------------------------------------------------------------- diff --git a/src/puzzle/Puzzle.js b/src/puzzle/Puzzle.js index 426147990..34f884195 100644 --- a/src/puzzle/Puzzle.js +++ b/src/puzzle/Puzzle.js @@ -1,13 +1,15 @@ // Puzzle.js v3.6.0 -// import MetaData from "./pzpr/metadata.js"; +import Candle from 'pzpr-canvas'; +import MetaData from "../pzpr/metadata.js"; +import { classmgr } from "../pzpr/classmgr.js"; +import util from "../pzpr/util.js"; +import parser from "../pzpr/parser.js"; -(function() { //--------------------------------------------------------------------------- // ★Puzzleクラス ぱずぷれv3のベース処理やその他の処理を行う //--------------------------------------------------------------------------- - pzpr.Puzzle = function(canvas, option) { - this.pzpr = pzpr; + var Puzzle = function(canvas, option) { if (option === void 0 && (!canvas || !canvas.parentNode)) { option = canvas; @@ -49,10 +51,10 @@ this.setCanvas(canvas); } - pzpr.classmgr.setClasses(this, ""); + classmgr.setClasses(this, ""); initObjects(this); }; - pzpr.Puzzle.prototype = { + Puzzle.prototype = { pid: null, // パズルのID("creek"など) info: {}, // VarietyInfoへの参照 @@ -130,7 +132,7 @@ return; } - var rect = pzpr.util.getRect(el); + var rect = util.getRect(el); var _div = document.createElement("div"); _div.style.width = rect.width + "px"; _div.style.height = rect.height + "px"; @@ -233,10 +235,10 @@ // owner.getTime() 開始からの時間をミリ秒単位で取得する //--------------------------------------------------------------------------- resetTime: function() { - this.starttime = pzpr.util.currentTime(); + this.starttime = util.currentTime(); }, getTime: function() { - return pzpr.util.currentTime() - this.starttime; + return util.currentTime() - this.starttime; }, //--------------------------------------------------------------------------- @@ -408,9 +410,9 @@ var classes = puzzle.klass; var Board = !!classes && !!classes.Board ? classes.Board : null; - var pzl = pzpr.parser(data, variety || puzzle.pid); + var pzl = parser(data, variety || puzzle.pid); - pzpr.classmgr.setPuzzleClass(puzzle, pzl.pid, function() { + classmgr.setPuzzleClass(puzzle, pzl.pid, function() { /* パズルの種類が変わっていればオブジェクトを設定しなおす */ if (Board !== puzzle.klass.Board) { initObjects(puzzle); @@ -454,7 +456,7 @@ // クラス初期化 puzzle.board = new classes.Board(); // 盤面オブジェクト - pzpr.classmgr.setPrototypeRef(puzzle, "board", puzzle.board); + classmgr.setPrototypeRef(puzzle, "board", puzzle.board); puzzle.checker = new classes.AnsCheck(); // 正解判定オブジェクト puzzle.painter = new classes.Graphic(); // 描画系オブジェクト @@ -476,14 +478,14 @@ /* fillTextが使えない場合は強制的にSVG描画に変更する */ if ( type === "canvas" && - !!pzpr.Candle.enable.canvas && + !!Candle.enable.canvas && !CanvasRenderingContext2D.prototype.fillText ) { type = "svg"; } - pzpr.Candle.start(puzzle.canvas, type, function(g) { - pzpr.util.unselectable(g.canvas); + Candle.start(puzzle.canvas, type, function(g) { + util.unselectable(g.canvas); g.child.style.pointerEvents = "none"; if (g.use.canvas && !puzzle.subcanvas) { var canvas = (puzzle.subcanvas = createSubCanvas("canvas")); @@ -502,11 +504,11 @@ }); } function createSubCanvas(type) { - if (!pzpr.Candle.enable[type]) { + if (!Candle.enable[type]) { return null; } var el = document.createElement("div"); - pzpr.Candle.start(el, type); + Candle.start(el, type); return el; } @@ -542,7 +544,7 @@ //--------------------------------------------------------------------------- function setCanvasEvents(puzzle) { function ae(type, func) { - pzpr.util.addEvent(puzzle.canvas, type, puzzle, func); + util.addEvent(puzzle.canvas, type, puzzle, func); } // マウス入力イベントの設定 @@ -625,7 +627,7 @@ function parseImageOption() { // (type,quality,option)のはず var imageopt = {}; - var type = pzpr.Candle.current; + var type = Candle.current; var cellsize = null, bgcolor = null, quality = null; @@ -653,7 +655,7 @@ } } - imageopt.type = (type || pzpr.Candle.current).match(/svg/) + imageopt.type = (type || Candle.current).match(/svg/) ? "svg" : "canvas"; imageopt.mimetype = @@ -671,4 +673,5 @@ return imageopt; } -})(); + +export default Puzzle; diff --git a/src/pzpr/util.js b/src/pzpr/util.js index 0f83adc36..12bdd8c01 100644 --- a/src/pzpr/util.js +++ b/src/pzpr/util.js @@ -1,13 +1,13 @@ // util.js v3.4.0 -(function() { - var api = pzpr.env.API, +import { env } from './env.js'; + var api = env.API, eventMouseDown = ["mousedown"], eventMouseMove = ["mousemove"], eventMouseUp = ["mouseup"], eventMouseCancel = [""]; - if (pzpr.env.bz.AndroidBrowser) { + if (env.bz.AndroidBrowser) { eventMouseDown = [""]; eventMouseMove = [""]; eventMouseUp = [""]; @@ -33,11 +33,11 @@ //---------------------------------------------------------------------- // EventやDOM関連のツール的関数群 //---------------------------------------------------------------------- - pzpr.util = { + var util = { //--------------------------------------------------------------- // pzpr.jsが読み込まれているスクリプトのパスを取得する getpath: function() { - if (pzpr.env.browser) { + if (env.browser) { var srcs = document.getElementsByTagName("script"); for (var i = 0; i < srcs.length; i++) { var result = srcs[i].src.match(/^(.*\/)pzpr\.js(?:\?.*)?$/); @@ -160,7 +160,7 @@ // pzpr.util.getRect() エレメントの四辺の座標を返す //-------------------------------------------------------------------------------- getRect: function(el) { - if (!pzpr.env.browser) { + if (!env.browser) { return { top: 0, bottom: 0, left: 0, right: 0, height: 0, width: 0 }; } var rect = el.getBoundingClientRect(), @@ -210,4 +210,5 @@ return isdisp; } }; -})(); + +export default util; From 90a0b6dfa3367c350f565b993e2f30812744b815 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 10:08:28 +0200 Subject: [PATCH 08/27] move most from ./puzzle/ over --- Makefile | 15 --------------- src/footer.js | 0 src/header.js | 15 +++++++++++++++ src/puzzle/Answer.js | 12 ++++++++---- src/puzzle/AreaManager.js | 3 ++- src/puzzle/Board.js | 4 +++- src/puzzle/BoardExec.js | 6 +++--- src/puzzle/Encode.js | 9 ++++++--- src/puzzle/FileData.js | 19 ++++++++++--------- src/puzzle/GraphBase.js | 4 +++- src/puzzle/Graphic.js | 14 +++++++------- src/puzzle/KeyInput.js | 4 +++- src/puzzle/LineManager.js | 8 +++++--- src/puzzle/MouseInput.js | 12 +++++++----- src/puzzle/Operation.js | 4 +++- src/puzzle/Piece.js | 4 +++- src/puzzle/PieceList.js | 4 +++- 17 files changed, 81 insertions(+), 56 deletions(-) delete mode 100644 src/footer.js diff --git a/Makefile b/Makefile index 0a24bcb1b..5f02e3fe1 100644 --- a/Makefile +++ b/Makefile @@ -19,20 +19,6 @@ bundle: src/header.js \ src/pzpr/event.js \ src/puzzle/Config.js \ - src/puzzle/Piece.js \ - src/puzzle/PieceList.js \ - src/puzzle/Board.js \ - src/puzzle/BoardExec.js \ - src/puzzle/GraphBase.js \ - src/puzzle/LineManager.js \ - src/puzzle/AreaManager.js \ - src/puzzle/Graphic.js \ - src/puzzle/MouseInput.js \ - src/puzzle/KeyInput.js \ - src/puzzle/Encode.js \ - src/puzzle/FileData.js \ - src/puzzle/Answer.js \ - src/puzzle/Operation.js \ src/variety-common/Graphic.js \ src/variety-common/KeyInput.js \ src/variety-common/MouseInput.js \ @@ -40,7 +26,6 @@ bundle: src/variety-common/BoardExec.js \ src/variety-common/Encode.js \ src/variety-common/FileData.js \ - src/footer.js \ > src/bundle.js rollup: diff --git a/src/footer.js b/src/footer.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/header.js b/src/header.js index 26003ab9e..04e643696 100644 --- a/src/header.js +++ b/src/header.js @@ -20,3 +20,18 @@ pzpr.util = util; import Puzzle from "./puzzle/Puzzle.js"; pzpr.Puzzle = Puzzle; import "./puzzle/Address.js"; + +import "./puzzle/Piece.js"; +import "./puzzle/PieceList.js"; +import "./puzzle/Board.js"; +import "./puzzle/BoardExec.js"; +import "./puzzle/GraphBase.js"; +import "./puzzle/LineManager.js"; +import "./puzzle/AreaManager.js"; +import "./puzzle/Graphic.js"; +import "./puzzle/MouseInput.js"; +import "./puzzle/KeyInput.js"; +import "./puzzle/Encode.js"; +import "./puzzle/FileData.js"; +import "./puzzle/Answer.js"; +import "./puzzle/Operation.js"; diff --git a/src/puzzle/Answer.js b/src/puzzle/Answer.js index c1fd20575..f49bdaeb5 100644 --- a/src/puzzle/Answer.js +++ b/src/puzzle/Answer.js @@ -1,12 +1,16 @@ // Answer.js v3.4.1 +import { classmgr } from '../pzpr/classmgr.js'; +import util from '../pzpr/util.js'; +import { lang } from '../pzpr/env.js'; + //--------------------------------------------------------------------------- // ★AnsCheckクラス 答えチェック関連の関数を扱う //--------------------------------------------------------------------------- // 回答チェッククラス // AnsCheckクラス -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------- AnsCheck: { initialize: function() { @@ -32,7 +36,7 @@ pzpr.classmgr.makeCommon({ isexist = true, prio = 0; if (item.match("@")) { - isexist = pzpr.util.checkpid( + isexist = util.checkpid( item.substr(item.indexOf("@") + 1), this.puzzle.pid ); @@ -139,11 +143,11 @@ pzpr.classmgr.makeCommon({ } this.complete = false; }, - gettext: function(lang) { + gettext: function(l_lang) { var puzzle = this.puzzle, textlist = puzzle.faillist, texts = []; - var langcode = (lang || pzpr.lang) === "ja" ? 0 : 1; + var langcode = (l_lang || lang) === "ja" ? 0 : 1; if (this.length === 0) { return textlist.complete[langcode]; } diff --git a/src/puzzle/AreaManager.js b/src/puzzle/AreaManager.js index 1825171ca..968fd6bc9 100644 --- a/src/puzzle/AreaManager.js +++ b/src/puzzle/AreaManager.js @@ -1,6 +1,7 @@ // AreaManager.js -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; +classmgr.makeCommon({ //-------------------------------------------------------------------------------- // ★AreaGraphBaseクラス セルの部屋情報などを保持するクラス // ※このクラスで管理しているroomsは左上からの順番に並ばないので diff --git a/src/puzzle/Board.js b/src/puzzle/Board.js index 2b9b3edb8..0c2042f71 100644 --- a/src/puzzle/Board.js +++ b/src/puzzle/Board.js @@ -1,10 +1,12 @@ // Board.js v3.4.1 +import { classmgr } from '../pzpr/classmgr.js'; + //--------------------------------------------------------------------------- // ★Boardクラス 盤面の情報を保持する。Cell, Cross, Borderのオブジェクトも保持する //--------------------------------------------------------------------------- // Boardクラスの定義 -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------- Board: { initialize: function() { diff --git a/src/puzzle/BoardExec.js b/src/puzzle/BoardExec.js index 1712b3f44..d856f731c 100644 --- a/src/puzzle/BoardExec.js +++ b/src/puzzle/BoardExec.js @@ -1,6 +1,7 @@ // BoardExec.js v3.4.1 -(function() { +import { classmgr } from '../pzpr/classmgr.js'; + // 拡大縮小・回転反転用定数 var UP = 0x01, DN = 0x02, @@ -11,7 +12,7 @@ TURN = 0x40, FLIP = 0x80; - pzpr.classmgr.makeCommon({ + classmgr.makeCommon({ //--------------------------------------------------------------------------- // ★BoardExecクラス 盤面の拡大縮小、反転回転等を行う (MenuExec.js, Board.jsから移動) //--------------------------------------------------------------------------- @@ -443,4 +444,3 @@ adjustBoardData2: function(key, d) {} } }); -})(); diff --git a/src/puzzle/Encode.js b/src/puzzle/Encode.js index dfb5b55dd..5836a1a81 100644 --- a/src/puzzle/Encode.js +++ b/src/puzzle/Encode.js @@ -1,11 +1,14 @@ // Encode.js v3.4.1 +import { classmgr } from '../pzpr/classmgr.js'; +import Parser from '../pzpr/parser.js'; + //--------------------------------------------------------------------------- // ★Encodeクラス URLのエンコード/デコードを扱う //--------------------------------------------------------------------------- // URLエンコード/デコード // Encodeクラス -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------- Encode: { pflag: "", @@ -39,7 +42,7 @@ pzpr.classmgr.makeCommon({ // enc.encodePzpr() 各パズルのURL出力用(オーバーライド用) //--------------------------------------------------------------------------- decodeURL: function(url) { - var pzl = pzpr.parser.parseURL(url), + var pzl = Parser.parseURL(url), puzzle = this.puzzle, bd = puzzle.board; @@ -83,7 +86,7 @@ pzpr.classmgr.makeCommon({ var puzzle = this.puzzle, pid = puzzle.pid, bd = puzzle.board; - var pzl = new pzpr.parser.URLData("", mode); + var pzl = new Parser.URLData("", mode); type = type || pzl.URL_PZPRV3; /* type===pzl.URL_AUTO(0)もまとめて変換する */ diff --git a/src/puzzle/FileData.js b/src/puzzle/FileData.js index dff0a7e7c..fde462eeb 100644 --- a/src/puzzle/FileData.js +++ b/src/puzzle/FileData.js @@ -1,6 +1,8 @@ // FileData.js -(function() { +import { classmgr } from '../pzpr/classmgr.js'; +import Parser from '../pzpr/parser.js'; + function throwNoImplementation() { throw "no implementation"; } @@ -8,7 +10,7 @@ //--------------------------------------------------------------------------- // ★FileIOクラス ファイルのデータ形式エンコード/デコードを扱う //--------------------------------------------------------------------------- - pzpr.classmgr.makeCommon({ + classmgr.makeCommon({ //--------------------------------------------------------- FileIO: { filever: 0, @@ -24,7 +26,7 @@ filedecode: function(datastr) { var puzzle = this.puzzle, bd = puzzle.board, - pzl = pzpr.parser.parseFile(datastr, puzzle.pid); + pzl = Parser.parseFile(datastr, puzzle.pid); var filetype = (this.currentType = pzl.type); bd.initBoardSize(pzl.cols, pzl.rows); @@ -71,7 +73,7 @@ fileencode: function(filetype, option) { var puzzle = this.puzzle, bd = puzzle.board; - var pzl = new pzpr.parser.FileData("", puzzle.pid); + var pzl = new Parser.FileData("", puzzle.pid); this.currentType = filetype = filetype || @@ -290,12 +292,12 @@ 2 * bd.rows - 2 ); } else if (bd.hasborder === 2) { - if (this.currentType === pzpr.parser.FILE_PZPR) { + if (this.currentType === Parser.FILE_PZPR) { this.decodeObj(func, "border", 0, 1, 2 * bd.cols, 2 * bd.rows - 1); this.decodeObj(func, "border", 1, 0, 2 * bd.cols - 1, 2 * bd.rows); } // pencilboxでは、outsideborderの時はぱずぷれとは順番が逆になってます - else if (this.currentType === pzpr.parser.FILE_PBOX) { + else if (this.currentType === Parser.FILE_PBOX) { this.decodeObj(func, "border", 1, 0, 2 * bd.cols - 1, 2 * bd.rows); this.decodeObj(func, "border", 0, 1, 2 * bd.cols, 2 * bd.rows - 1); } @@ -370,12 +372,12 @@ 2 * bd.rows - 2 ); } else if (bd.hasborder === 2) { - if (this.currentType === pzpr.parser.FILE_PZPR) { + if (this.currentType === Parser.FILE_PZPR) { this.encodeObj(func, "border", 0, 1, 2 * bd.cols, 2 * bd.rows - 1); this.encodeObj(func, "border", 1, 0, 2 * bd.cols - 1, 2 * bd.rows); } // pencilboxでは、outsideborderの時はぱずぷれとは順番が逆になってます - else if (this.currentType === pzpr.parser.FILE_PBOX) { + else if (this.currentType === Parser.FILE_PBOX) { this.encodeObj(func, "border", 1, 0, 2 * bd.cols - 1, 2 * bd.rows); this.encodeObj(func, "border", 0, 1, 2 * bd.cols, 2 * bd.rows - 1); } @@ -524,4 +526,3 @@ } } }); -})(); diff --git a/src/puzzle/GraphBase.js b/src/puzzle/GraphBase.js index 676c1416b..8324e0ee7 100644 --- a/src/puzzle/GraphBase.js +++ b/src/puzzle/GraphBase.js @@ -1,10 +1,12 @@ // GraphBase.js +import { classmgr } from '../pzpr/classmgr.js'; + //--------------------------------------------------------------------------- // ★GraphBaseクラス 線や領域情報を管理する //--------------------------------------------------------------------------- // GraphBaseクラスの定義 -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ GraphBase: { enabled: false, relation: {}, diff --git a/src/puzzle/Graphic.js b/src/puzzle/Graphic.js index 06f918381..6c784b45a 100644 --- a/src/puzzle/Graphic.js +++ b/src/puzzle/Graphic.js @@ -1,8 +1,9 @@ // Graphic.js v3.4.1 -// import env from '../pzpr/env.js'; +import { env } from '../pzpr/env.js'; +import util from '../pzpr/util.js'; +import { common, classmgr } from '../pzpr/classmgr.js'; -(function() { var CENTER = 1, BOTTOMLEFT = 2, BOTTOMRIGHT = 3, @@ -18,7 +19,7 @@ //--------------------------------------------------------------------------- // パズル共通 Canvas/DOM制御部 // Graphicクラスの定義 - pzpr.classmgr.makeCommon({ + classmgr.makeCommon({ //--------------------------------------------------------- Graphic: { initialize: function() { @@ -34,7 +35,7 @@ ["getCircleFillColor", this.circlefillcolor_func], ["getCircleStrokeColor", this.circlestrokecolor_func] ].forEach(function(item) { - if (pc[item[0]] !== pzpr.common.Graphic.prototype[item[0]]) { + if (pc[item[0]] !== common.Graphic.prototype[item[0]]) { return; } // パズル個別の関数が定義されている場合はそのまま使用 pc[item[0]] = pc[item[0] + "_" + item[1]] || pc[item[0]]; @@ -204,7 +205,7 @@ } if (this.canvasWidth === null || this.canvasHeight === null) { - var rect = pzpr.util.getRect(puzzle.canvas); + var rect = util.getRect(puzzle.canvas); this.resizeCanvas(rect.width, rect.height); } @@ -350,7 +351,7 @@ // CanvasのOffset位置変更 (SVGの時、小数点以下の端数調整を行う) if (!g.use.canvas) { - var rect = pzpr.util.getRect(g.canvas); + var rect = util.getRect(g.canvas); g.translate(x0 - (rect.left % 1), y0 - (rect.top % 1)); } else { g.translate(x0, y0); @@ -783,4 +784,3 @@ } } }); -})(); diff --git a/src/puzzle/KeyInput.js b/src/puzzle/KeyInput.js index 1c10d14e5..444aaedcf 100644 --- a/src/puzzle/KeyInput.js +++ b/src/puzzle/KeyInput.js @@ -1,11 +1,13 @@ // KeyInput.js v3.4.1 +import { classmgr } from '../pzpr/classmgr.js'; + //--------------------------------------------------------------------------- // ★KeyEventクラス キーボード入力に関する情報の保持とイベント処理を扱う //--------------------------------------------------------------------------- // パズル共通 キーボード入力部 // KeyEventクラスを定義 -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------- KeyEvent: { initialize: function() { diff --git a/src/puzzle/LineManager.js b/src/puzzle/LineManager.js index b8941e031..e8658b1c7 100644 --- a/src/puzzle/LineManager.js +++ b/src/puzzle/LineManager.js @@ -1,9 +1,11 @@ // LineManager.js +import { common, classmgr } from '../pzpr/classmgr.js'; + //--------------------------------------------------------------------------- // ★LineGraphクラス 主に線や色分けの情報を管理する //--------------------------------------------------------------------------- -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ "LineGraph:GraphBase": { initialize: function() { if (this.moveline) { @@ -71,13 +73,13 @@ pzpr.classmgr.makeCommon({ if (this.board.borderAsLine) { this.pointgroup = "cross"; } - pzpr.common.GraphBase.prototype.rebuild.call(this); + common.GraphBase.prototype.rebuild.call(this); }, rebuild2: function() { if (!!this.incdecLineCount) { this.resetLineCount(); } - pzpr.common.GraphBase.prototype.rebuild2.call(this); + common.GraphBase.prototype.rebuild2.call(this); }, //--------------------------------------------------------------------------- diff --git a/src/puzzle/MouseInput.js b/src/puzzle/MouseInput.js index 86026c264..9dd47ec2c 100644 --- a/src/puzzle/MouseInput.js +++ b/src/puzzle/MouseInput.js @@ -1,13 +1,15 @@ // MouseInput.js v3.5.2 -// import env from '../pzpr/env.js'; +import { env } from '../pzpr/env.js'; +import util from '../pzpr/util.js'; +import { classmgr } from '../pzpr/classmgr.js'; //--------------------------------------------------------------------------- // ★MouseEventクラス マウス入力に関する情報の保持とイベント処理を扱う //--------------------------------------------------------------------------- // パズル共通 マウス入力部 // MouseEventクラスを定義 -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------- MouseEvent: { initialize: function() { @@ -144,7 +146,7 @@ pzpr.classmgr.makeCommon({ // mv.getBoardAddress() イベントが起こったcanvas内の座標を取得する //--------------------------------------------------------------------------- setMouseButton: function(e) { - this.btn = pzpr.util.getMouseButton(e); + this.btn = util.getMouseButton(e); // SHIFTキー/Commandキーを押している時は左右ボタン反転 var kc = this.puzzle.key; @@ -179,8 +181,8 @@ pzpr.classmgr.makeCommon({ pix = { px: e.layerX, py: e.layerY }; } // Firefox 39以前, iOSはこちら } else { - var pagePos = pzpr.util.getPagePos(e), - rect = pzpr.util.getRect(pc.context.child); + var pagePos = util.getPagePos(e), + rect = util.getRect(pc.context.child); pix = { px: pagePos.px - rect.left, py: pagePos.py - rect.top }; } return { bx: (pix.px - pc.x0) / pc.bw, by: (pix.py - pc.y0) / pc.bh }; diff --git a/src/puzzle/Operation.js b/src/puzzle/Operation.js index 4b5ce6c00..04ecbecb2 100644 --- a/src/puzzle/Operation.js +++ b/src/puzzle/Operation.js @@ -1,8 +1,10 @@ // Operation.js v3.4.1 +import { classmgr } from '../pzpr/classmgr.js'; + // 入力情報管理クラス // Operationクラス -pzpr.classmgr.makeCommon({ +classmgr.makeCommon({ //--------------------------------------------------------------------------- // ★Operation(派生)クラス 単体の操作情報を保持する //--------------------------------------------------------------------------- diff --git a/src/puzzle/Piece.js b/src/puzzle/Piece.js index 26396d3a2..ce0683141 100644 --- a/src/puzzle/Piece.js +++ b/src/puzzle/Piece.js @@ -1,6 +1,8 @@ // Piece.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------------------------- // ★BoardPieceクラス Cell, Cross, Border, ExCellクラスのベース //--------------------------------------------------------------------------- diff --git a/src/puzzle/PieceList.js b/src/puzzle/PieceList.js index a3f7a3564..af8d3ac9c 100644 --- a/src/puzzle/PieceList.js +++ b/src/puzzle/PieceList.js @@ -1,6 +1,8 @@ // PieceList.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //---------------------------------------------------------------------------- // ★PieceListクラス オブジェクトの配列を扱う //--------------------------------------------------------------------------- From 743c0e77d3c0fd1f20225801c1d4c0820131a033 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 10:13:48 +0200 Subject: [PATCH 09/27] move all variety-common over --- Makefile | 7 ------- src/header.js | 7 +++++++ src/variety-common/Answer.js | 4 +++- src/variety-common/BoardExec.js | 4 +++- src/variety-common/Encode.js | 4 +++- src/variety-common/FileData.js | 4 +++- src/variety-common/Graphic.js | 4 +++- src/variety-common/KeyInput.js | 4 +++- src/variety-common/MouseInput.js | 4 +++- 9 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 5f02e3fe1..3e588958c 100644 --- a/Makefile +++ b/Makefile @@ -19,13 +19,6 @@ bundle: src/header.js \ src/pzpr/event.js \ src/puzzle/Config.js \ - src/variety-common/Graphic.js \ - src/variety-common/KeyInput.js \ - src/variety-common/MouseInput.js \ - src/variety-common/Answer.js \ - src/variety-common/BoardExec.js \ - src/variety-common/Encode.js \ - src/variety-common/FileData.js \ > src/bundle.js rollup: diff --git a/src/header.js b/src/header.js index 04e643696..2fb54c54e 100644 --- a/src/header.js +++ b/src/header.js @@ -35,3 +35,10 @@ import "./puzzle/Encode.js"; import "./puzzle/FileData.js"; import "./puzzle/Answer.js"; import "./puzzle/Operation.js"; +import "./variety-common/Graphic.js"; +import "./variety-common/KeyInput.js"; +import "./variety-common/MouseInput.js"; +import "./variety-common/Answer.js"; +import "./variety-common/BoardExec.js"; +import "./variety-common/Encode.js"; +import "./variety-common/FileData.js"; diff --git a/src/variety-common/Answer.js b/src/variety-common/Answer.js index e3444695d..8782cc11f 100644 --- a/src/variety-common/Answer.js +++ b/src/variety-common/Answer.js @@ -1,6 +1,8 @@ // AnswerCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- AnsCheck: { //--------------------------------------------------------------------------- diff --git a/src/variety-common/BoardExec.js b/src/variety-common/BoardExec.js index f96c1344e..6ee014818 100644 --- a/src/variety-common/BoardExec.js +++ b/src/variety-common/BoardExec.js @@ -1,6 +1,8 @@ // BoardExecCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- BoardExec: { //------------------------------------------------------------------------------ diff --git a/src/variety-common/Encode.js b/src/variety-common/Encode.js index 52234812e..a1b7425b3 100644 --- a/src/variety-common/Encode.js +++ b/src/variety-common/Encode.js @@ -1,6 +1,8 @@ // EncodeCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- Encode: { //--------------------------------------------------------------------------- diff --git a/src/variety-common/FileData.js b/src/variety-common/FileData.js index 8570544ce..24a460feb 100644 --- a/src/variety-common/FileData.js +++ b/src/variety-common/FileData.js @@ -1,6 +1,8 @@ // FileDataCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- FileIO: { //--------------------------------------------------------------------------- diff --git a/src/variety-common/Graphic.js b/src/variety-common/Graphic.js index 557ca7173..91d904dea 100644 --- a/src/variety-common/Graphic.js +++ b/src/variety-common/Graphic.js @@ -1,6 +1,8 @@ // GraphicCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- Graphic: { paintPost: function() { diff --git a/src/variety-common/KeyInput.js b/src/variety-common/KeyInput.js index a6b7f06dd..17d8c7946 100644 --- a/src/variety-common/KeyInput.js +++ b/src/variety-common/KeyInput.js @@ -1,6 +1,8 @@ // KeyCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- KeyEvent: { //--------------------------------------------------------------------------- diff --git a/src/variety-common/MouseInput.js b/src/variety-common/MouseInput.js index 3518be6f4..7a9ccd225 100644 --- a/src/variety-common/MouseInput.js +++ b/src/variety-common/MouseInput.js @@ -1,6 +1,8 @@ // MouseCommon.js v3.4.1 -pzpr.classmgr.makeCommon({ +import { classmgr } from '../pzpr/classmgr.js'; + +classmgr.makeCommon({ //--------------------------------------------------------- MouseEvent: { // 共通関数 From b62756b75f9c4e468ff01eca689ca2ecacaf5080 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 10:26:00 +0200 Subject: [PATCH 10/27] all modules are over --- Makefile | 2 -- src/header.js | 5 +++-- src/puzzle/Config.js | 9 ++++----- src/pzpr/core.js | 6 +----- src/pzpr/event.js | 12 +++++++----- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 3e588958c..78f174b79 100644 --- a/Makefile +++ b/Makefile @@ -17,8 +17,6 @@ format: bundle: cat \ src/header.js \ - src/pzpr/event.js \ - src/puzzle/Config.js \ > src/bundle.js rollup: diff --git a/src/header.js b/src/header.js index 2fb54c54e..351915242 100644 --- a/src/header.js +++ b/src/header.js @@ -1,10 +1,11 @@ -var pzpr = {}; +import pzpr from './pzpr/core.js'; export default pzpr; import Candle from 'pzpr-canvas'; pzpr.Candle = Candle; import {env, lang} from "./pzpr/env.js"; pzpr.env = env; +import './pzpr/event.js'; pzpr.lang = lang; import {common, custom, classmgr} from './pzpr/classmgr.js'; pzpr.common = common; @@ -19,8 +20,8 @@ pzpr.util = util; import Puzzle from "./puzzle/Puzzle.js"; pzpr.Puzzle = Puzzle; +import "./puzzle/Config.js"; // modifies Puzzle import "./puzzle/Address.js"; - import "./puzzle/Piece.js"; import "./puzzle/PieceList.js"; import "./puzzle/Board.js"; diff --git a/src/puzzle/Config.js b/src/puzzle/Config.js index 8cc0177b9..31edca090 100644 --- a/src/puzzle/Config.js +++ b/src/puzzle/Config.js @@ -1,13 +1,13 @@ // Config.js v3.4.1 -// import variety from '../pzpr/variety.js'; -// import env from '../pzpr/env.js'; +import variety from '../pzpr/variety.js'; +import { env } from '../pzpr/env.js'; +import Puzzle from './Puzzle.js'; -(function() { //--------------------------------------------------------------------------- // ★Configクラス 設定値の値などを保持する //--------------------------------------------------------------------------- - var Config = (pzpr.Puzzle.prototype.Config = function(puzzle) { + var Config = (Puzzle.prototype.Config = function(puzzle) { this.puzzle = puzzle; this.init(); }); @@ -421,4 +421,3 @@ } } }; -})(); diff --git a/src/pzpr/core.js b/src/pzpr/core.js index e782f36d9..d7916ada0 100644 --- a/src/pzpr/core.js +++ b/src/pzpr/core.js @@ -8,8 +8,4 @@ var pzpr = { version: "<%= git.hash %>" }; -if (typeof module === "object" && module.exports) { - module.exports = pzpr; -} else { - this.pzpr = pzpr; -} +export default pzpr; diff --git a/src/pzpr/event.js b/src/pzpr/event.js index 17e572075..be07759b6 100644 --- a/src/pzpr/event.js +++ b/src/pzpr/event.js @@ -1,6 +1,9 @@ // event.js v3.4.1 -(function() { +import util from './util.js'; +import { env } from './env.js'; +import pzpr from './core.js'; + //--------------------------------------------------------------- // 起動時関連関数 //--------------------------------------------------------------- @@ -29,7 +32,7 @@ } } - if (!pzpr.env.browser) { + if (!env.browser) { } else if (document.readyState === "complete") { setTimeout(postload, 10); } else { @@ -54,8 +57,8 @@ } pzpr.on("load", function addKeyEvents() { // キー入力イベントの設定 - pzpr.util.addEvent(document, "keydown", pzpr, execKeyDown); - pzpr.util.addEvent(document, "keyup", pzpr, execKeyUp); + util.addEvent(document, "keydown", pzpr, execKeyDown); + util.addEvent(document, "keyup", pzpr, execKeyUp); }); //--------------------------------------------------------------------------- @@ -64,4 +67,3 @@ pzpr.connectKeyEvents = function(puzzle) { keytarget = puzzle; }; -})(); From 8fa5132c1ecb449c005d8b759a1e02b0164fc1c1 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 10:27:59 +0200 Subject: [PATCH 11/27] replace old build files --- Makefile | 7 +--- rollup.config.js | 25 ++++++++++++++ src/header.js | 45 ------------------------- src/pzpr.js | 86 +++++++++++++++++++++++++----------------------- 4 files changed, 71 insertions(+), 92 deletions(-) create mode 100644 rollup.config.js delete mode 100644 src/header.js diff --git a/Makefile b/Makefile index 78f174b79..9391de9c3 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: build test serve format -all: candle bundle rollup +all: candle rollup build: npm run-script build @@ -14,11 +14,6 @@ serve: format: npm run-script format -bundle: - cat \ - src/header.js \ - > src/bundle.js - rollup: ./node_modules/.bin/rollup -c diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 000000000..1151c9b05 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,25 @@ +// import resolve from '@rollup/plugin-node-resolve'; +// import commonjs from '@rollup/plugin-commonjs'; +import { terser } from 'rollup-plugin-terser'; + +// `npm run build` -> `production` is true +// `npm run dev` -> `production` is false +const production = !process.env.ROLLUP_WATCH; + +export default { + input: 'src/pzpr.js', + output: { + file: 'dist/js/bundle.js', + name: 'pzpr', + format: 'iife', + sourcemap: true, + globals: { + "pzpr-canvas": "Candle" + } + }, + plugins: [ + // resolve(), // use node_modules + // commonjs(), // converts node modules to ES modules + production && terser() // minify, but only in production + ] +}; diff --git a/src/header.js b/src/header.js deleted file mode 100644 index 351915242..000000000 --- a/src/header.js +++ /dev/null @@ -1,45 +0,0 @@ -import pzpr from './pzpr/core.js'; -export default pzpr; - -import Candle from 'pzpr-canvas'; -pzpr.Candle = Candle; -import {env, lang} from "./pzpr/env.js"; -pzpr.env = env; -import './pzpr/event.js'; -pzpr.lang = lang; -import {common, custom, classmgr} from './pzpr/classmgr.js'; -pzpr.common = common; -pzpr.custom = custom; -pzpr.classmgr = classmgr; -import variety from "./pzpr/variety.js"; -pzpr.variety = variety; -import Parser from "./pzpr/parser.js"; -pzpr.parser = Parser; -import util from "./pzpr/util.js"; -pzpr.util = util; - -import Puzzle from "./puzzle/Puzzle.js"; -pzpr.Puzzle = Puzzle; -import "./puzzle/Config.js"; // modifies Puzzle -import "./puzzle/Address.js"; -import "./puzzle/Piece.js"; -import "./puzzle/PieceList.js"; -import "./puzzle/Board.js"; -import "./puzzle/BoardExec.js"; -import "./puzzle/GraphBase.js"; -import "./puzzle/LineManager.js"; -import "./puzzle/AreaManager.js"; -import "./puzzle/Graphic.js"; -import "./puzzle/MouseInput.js"; -import "./puzzle/KeyInput.js"; -import "./puzzle/Encode.js"; -import "./puzzle/FileData.js"; -import "./puzzle/Answer.js"; -import "./puzzle/Operation.js"; -import "./variety-common/Graphic.js"; -import "./variety-common/KeyInput.js"; -import "./variety-common/MouseInput.js"; -import "./variety-common/Answer.js"; -import "./variety-common/BoardExec.js"; -import "./variety-common/Encode.js"; -import "./variety-common/FileData.js"; diff --git a/src/pzpr.js b/src/pzpr.js index d50625f96..351915242 100644 --- a/src/pzpr.js +++ b/src/pzpr.js @@ -1,41 +1,45 @@ -exports.files = [ - "common/intro", - "pzpr/core", - "lib/candle-intro", - "../node_modules/pzpr-canvas/dist/candle", - "lib/candle-outro", - "pzpr/env", - "pzpr/event", - "pzpr/classmgr", - "pzpr/variety", - "pzpr/parser", - "pzpr/metadata", - "pzpr/util", - "puzzle/Puzzle", - "puzzle/Config", - "puzzle/Address", - "puzzle/Piece", - "puzzle/PieceList", - "puzzle/Board", - "puzzle/BoardExec", - "puzzle/GraphBase", - "puzzle/LineManager", - "puzzle/AreaManager", - "puzzle/Graphic", - "puzzle/MouseInput", - "puzzle/KeyInput", - "puzzle/Encode", - "puzzle/FileData", - "puzzle/Answer", - "puzzle/Operation", - "variety-common/Graphic", - "variety-common/KeyInput", - "variety-common/MouseInput", - "variety-common/Answer", - "variety-common/BoardExec", - "variety-common/Encode", - "variety-common/FileData", - "common/outro" -].map(function(mod) { - return "src/" + mod + ".js"; -}); +import pzpr from './pzpr/core.js'; +export default pzpr; + +import Candle from 'pzpr-canvas'; +pzpr.Candle = Candle; +import {env, lang} from "./pzpr/env.js"; +pzpr.env = env; +import './pzpr/event.js'; +pzpr.lang = lang; +import {common, custom, classmgr} from './pzpr/classmgr.js'; +pzpr.common = common; +pzpr.custom = custom; +pzpr.classmgr = classmgr; +import variety from "./pzpr/variety.js"; +pzpr.variety = variety; +import Parser from "./pzpr/parser.js"; +pzpr.parser = Parser; +import util from "./pzpr/util.js"; +pzpr.util = util; + +import Puzzle from "./puzzle/Puzzle.js"; +pzpr.Puzzle = Puzzle; +import "./puzzle/Config.js"; // modifies Puzzle +import "./puzzle/Address.js"; +import "./puzzle/Piece.js"; +import "./puzzle/PieceList.js"; +import "./puzzle/Board.js"; +import "./puzzle/BoardExec.js"; +import "./puzzle/GraphBase.js"; +import "./puzzle/LineManager.js"; +import "./puzzle/AreaManager.js"; +import "./puzzle/Graphic.js"; +import "./puzzle/MouseInput.js"; +import "./puzzle/KeyInput.js"; +import "./puzzle/Encode.js"; +import "./puzzle/FileData.js"; +import "./puzzle/Answer.js"; +import "./puzzle/Operation.js"; +import "./variety-common/Graphic.js"; +import "./variety-common/KeyInput.js"; +import "./variety-common/MouseInput.js"; +import "./variety-common/Answer.js"; +import "./variety-common/BoardExec.js"; +import "./variety-common/Encode.js"; +import "./variety-common/FileData.js"; From 36ed4454314447fc3fcf2a5d6c88190037f41f61 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 10:32:06 +0200 Subject: [PATCH 12/27] move over shikaku --- src/pzpr/variety.js | 7 +++++-- src/variety/shikaku.js | 13 +++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index 45aab34eb..c5b145d6e 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -1,6 +1,7 @@ // Variety.js v3.4.1 import mod_skyscrapers from "../variety/skyscrapers.js"; +import mod_shikaku from "../variety/shikaku.js"; var _info = {}, _list = []; @@ -86,8 +87,10 @@ import mod_skyscrapers from "../variety/skyscrapers.js"; this.kanpenid = !!datalist[1] ? this.alias.kanpen || pzprid : ""; _list.push(pzprid); }, + // Entries are: + // id: [?, ?, "name jp", "name en", module, aliases] { - aho: [0, 0, "アホになり切れ", "Aho-ni-Narikire", "shikaku"], + aho: [0, 0, "アホになり切れ", "Aho-ni-Narikire", mod_shikaku], amibo: [0, 0, "あみぼー", "Amibo", "amibo"], angleloop: [0, 0, "鋭直鈍ループ", "Angle Loop", "kouchoku"], aquarium: [0, 0, "アクアプレース", "Aquarium", "aquarium"], @@ -271,7 +274,7 @@ import mod_skyscrapers from "../variety/skyscrapers.js"; ], scrin: [0, 0, "スクリン", "Scrin"], shakashaka: [0, 1, "シャカシャカ", "Shakashaka"], - shikaku: [0, 1, "四角に切れ", "Shikaku", "shikaku"], + shikaku: [0, 1, "四角に切れ", "Shikaku", mod_shikaku], shimaguni: [1, 0, "島国", "Islands", "shimaguni"], shugaku: [1, 0, "修学旅行の夜", "School Trip"], shwolf: [0, 0, "ヤギとオオカミ", "Goats and Wolves", "kramma"], diff --git a/src/variety/shikaku.js b/src/variety/shikaku.js index 9686a40b9..af7d54733 100644 --- a/src/variety/shikaku.js +++ b/src/variety/shikaku.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 四角に切れ・アホになり切れ版 shikaku.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["shikaku", "aho"], { +var pidlist = ["shikaku", "aho"] +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -306,4 +301,6 @@ "An area whose size is a multiple of three is not L-shaped." ] } -}); +}; + +export default [pidlist, classbase]; From f8d31bccafde9dd8eaedf4e0280cf9b24d024cdd Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 11:05:34 +0200 Subject: [PATCH 13/27] make `make lint` work --- Makefile | 9 ++++++--- rollup.config.js | 2 +- src-ui/p.html | 2 +- src/.eslintrc.json | 3 ++- src/pzpr/classmgr.js | 19 ------------------- src/pzpr/metadata.js | 2 +- test/load_testdata.js | 5 +++-- test/puzzle/answer_test.js | 6 +++--- 8 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 9391de9c3..7ba8516de 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,4 @@ -.PHONY: build test serve format - -all: candle rollup +.PHONY: build test serve format lint rollup candle build: npm run-script build @@ -14,6 +12,11 @@ serve: format: npm run-script format +lint: + npm run-script lint + +new: candle rollup + rollup: ./node_modules/.bin/rollup -c diff --git a/rollup.config.js b/rollup.config.js index 1151c9b05..1c815295b 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,7 +9,7 @@ const production = !process.env.ROLLUP_WATCH; export default { input: 'src/pzpr.js', output: { - file: 'dist/js/bundle.js', + file: 'dist/js/pzpr.js', name: 'pzpr', format: 'iife', sourcemap: true, diff --git a/src-ui/p.html b/src-ui/p.html index 24f9c5861..bec073982 100644 --- a/src-ui/p.html +++ b/src-ui/p.html @@ -12,7 +12,7 @@ - + puzz.link player diff --git a/src/.eslintrc.json b/src/.eslintrc.json index 1d6d6e300..0d89e123a 100644 --- a/src/.eslintrc.json +++ b/src/.eslintrc.json @@ -4,7 +4,8 @@ "node": true // Allow to use node defined variable (require, process etc.) }, "parserOptions": { - "ecmaVersion": 5 + "ecmaVersion": 5, + "sourceType": "module" }, "globals": { "pzpr": "readonly" diff --git a/src/pzpr/classmgr.js b/src/pzpr/classmgr.js index d5173753b..63079ec3b 100644 --- a/src/pzpr/classmgr.js +++ b/src/pzpr/classmgr.js @@ -147,26 +147,7 @@ var classmgr = { //--------------------------------------------------------------- includeCustomFile: function(pid) { var module = variety(pid).module; - console.log("includeCustomFile", pid, module); this.makeCustom(module[0], module[1]); - /* - var scriptid = variety(pid).script; - if (this.includedFile[scriptid]) { - return; - } - this.includedFile[scriptid] = true; - - var customfile = pzpr.util.getpath() + "./pzpr-variety/" + scriptid + ".js"; - if (pzpr.env.browser && !pzpr.env.node) { - var _script = document.createElement("script"); - _script.type = "text/javascript"; - _script.src = customfile + "?" + pzpr.version; - document.getElementsByTagName("head")[0].appendChild(_script); - } else { - var exporteddata = require(customfile); - this.makeCustom(exporteddata[0], exporteddata[1]); - } - */ }, includedFile: {}, diff --git a/src/pzpr/metadata.js b/src/pzpr/metadata.js index 4bfa5fc6d..9954c21db 100644 --- a/src/pzpr/metadata.js +++ b/src/pzpr/metadata.js @@ -3,7 +3,7 @@ //--------------------------------------------------------------------------- // MetaData構造体 作者やコメントなどの情報を保持する //--------------------------------------------------------------------------- -function MetaData() {}; +function MetaData() {} MetaData.prototype = { author: "", source: "", diff --git a/test/load_testdata.js b/test/load_testdata.js index ac0a06067..178ae2342 100644 --- a/test/load_testdata.js +++ b/test/load_testdata.js @@ -1,6 +1,6 @@ // test/load_testdata.js -var pzpr = require("../dist/js/bundle.js"); +// var pzpr = require("../dist/js/pzpr.js"); // Load test data var testdata = {}; @@ -16,4 +16,5 @@ global.ui = { // require("./script/" + pid + ".js"); // }); -export default testdata; +module.exports = testdata; + diff --git a/test/puzzle/answer_test.js b/test/puzzle/answer_test.js index d5e1a1941..43299f190 100644 --- a/test/puzzle/answer_test.js +++ b/test/puzzle/answer_test.js @@ -1,10 +1,10 @@ // test/answer_test.js -import assert from "assert"; +var assert = require("assert"); -import pzpr from "../../src/bundle.js"; +var pzpr = require("../../dist/js/pzpr.js"); -import testdata from "../load_testdata.js"; +var testdata = require("../load_testdata.js"); pzpr.variety.each(function(pid) { describe(pid + " answer test", function() { From 8688c7f0bbe5b431b1ddc8e1ac296617309c1332 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 11:55:57 +0200 Subject: [PATCH 14/27] mess with the tests --- package.json | 3 ++- test/.eslintrc.json | 3 ++- test/load_testdata.js | 12 ++++++------ test/puzzle/answer_test.js | 4 ++-- test/puzzle/boardexec_test.js | 5 ++--- test/puzzle/config_test.js | 2 +- test/puzzle/encode_test.js | 5 ++--- test/puzzle/filedata_test.js | 5 ++--- test/puzzle/input_test.js | 5 ++--- test/puzzle/operation_test.js | 2 +- test/puzzle/render_test.js | 5 ++--- 11 files changed, 24 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 6772eb866..79028225f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "format": "prettier --write '{src,src-ui,test}/**/*.{js,css}'", "check-format": "prettier --check '{src,src-ui,test}/**/*.{js,css}'", "lint": "eslint src src-ui test sample", - "test": "eslint --quiet src src-ui test sample && mocha -r source-map-support/register -R progress --recursive test", + "test": "mocha -r esm -r pzpr-canvas -r source-map-support/register -R progress --recursive test", "prepublishOnly": "npm test" }, "devDependencies": { @@ -42,6 +42,7 @@ "prettier": "^1.19.1" }, "dependencies": { + "esm": "^3.2.25", "pzpr-canvas": "^0.8.2", "rollup": "^2.6.0", "source-map-support": "^0.5.12" diff --git a/test/.eslintrc.json b/test/.eslintrc.json index 32ea65e99..df6097341 100644 --- a/test/.eslintrc.json +++ b/test/.eslintrc.json @@ -4,7 +4,8 @@ "node": true }, "parserOptions": { - "ecmaVersion": 6 + "ecmaVersion": 6, + "sourceType": "module" }, "globals": { "describe": "readonly", diff --git a/test/load_testdata.js b/test/load_testdata.js index 178ae2342..88c798bf7 100644 --- a/test/load_testdata.js +++ b/test/load_testdata.js @@ -1,7 +1,5 @@ // test/load_testdata.js -// var pzpr = require("../dist/js/pzpr.js"); - // Load test data var testdata = {}; global.ui = { @@ -12,9 +10,11 @@ global.ui = { } } }; -// pzpr.variety.each(function(pid) { - // require("./script/" + pid + ".js"); -// }); +import variety from "../src/pzpr/variety.js"; + +variety.each(function(pid) { + require("./script/" + pid + ".js"); +}); -module.exports = testdata; +export default testdata; diff --git a/test/puzzle/answer_test.js b/test/puzzle/answer_test.js index 43299f190..972bbd0a6 100644 --- a/test/puzzle/answer_test.js +++ b/test/puzzle/answer_test.js @@ -2,9 +2,9 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; -var testdata = require("../load_testdata.js"); pzpr.variety.each(function(pid) { describe(pid + " answer test", function() { diff --git a/test/puzzle/boardexec_test.js b/test/puzzle/boardexec_test.js index 6df0a3154..3b1b46954 100644 --- a/test/puzzle/boardexec_test.js +++ b/test/puzzle/boardexec_test.js @@ -2,9 +2,8 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); - -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; function assert_equal_board(bd1, bd2) { bd1.compareData(bd2, function(group, c, a) { diff --git a/test/puzzle/config_test.js b/test/puzzle/config_test.js index 6eb0fed52..62cb318cb 100644 --- a/test/puzzle/config_test.js +++ b/test/puzzle/config_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); +import pzpr from "../../src/pzpr.js"; describe("Config test", function() { var puzzle = new pzpr.Puzzle(); diff --git a/test/puzzle/encode_test.js b/test/puzzle/encode_test.js index 5703eac85..9c2d7866b 100644 --- a/test/puzzle/encode_test.js +++ b/test/puzzle/encode_test.js @@ -2,9 +2,8 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); - -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; function assert_equal_board(bd1, bd2) { bd1.compareData(bd2, function(group, c, a) { diff --git a/test/puzzle/filedata_test.js b/test/puzzle/filedata_test.js index ea8b9d919..3a360cf6b 100644 --- a/test/puzzle/filedata_test.js +++ b/test/puzzle/filedata_test.js @@ -2,9 +2,8 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); - -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; function assert_equal_board(bd1, bd2, iskanpen) { var pid = bd1.pid; diff --git a/test/puzzle/input_test.js b/test/puzzle/input_test.js index e93ef8a9a..92a6037f6 100644 --- a/test/puzzle/input_test.js +++ b/test/puzzle/input_test.js @@ -2,9 +2,8 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); - -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; function execmouse(puzzle, strs) { var matches = (strs[1].match(/(left|right)(.*)/)[2] || "").match(/x([0-9]+)/); diff --git a/test/puzzle/operation_test.js b/test/puzzle/operation_test.js index 978a6b021..804cbca19 100644 --- a/test/puzzle/operation_test.js +++ b/test/puzzle/operation_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../dist/js/pzpr.js"); +import pzpr from "../../src/pzpr.js"; describe("Trial mode test", function() { it("Enter test", function() { diff --git a/test/puzzle/render_test.js b/test/puzzle/render_test.js index 6693a5e36..8825cdc7d 100644 --- a/test/puzzle/render_test.js +++ b/test/puzzle/render_test.js @@ -2,9 +2,8 @@ // jshint node:true, browser:false, esnext:true /* global describe:false, it:false */ -var pzpr = require("../../dist/js/pzpr.js"); - -var testdata = require("../load_testdata.js"); +import testdata from "../load_testdata.js"; +import pzpr from "../../src/pzpr.js"; pzpr.variety.each(function(pid) { describe(pid + " render test", function() { From ad86a4513ad5857db29cd89d1112bc4b5ec3ae04 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 11:59:41 +0200 Subject: [PATCH 15/27] simpler build --- Gruntfile.js | 30 +----------------------------- Makefile | 4 +++- package.json | 1 + rollup.config.js | 4 ---- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index daf5f8174..649a15d74 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -33,14 +33,6 @@ module.exports = function(grunt){ banner: banner_full, process: true, }, - pzpr: { - options: { - sourceMap: !PRODUCTION - }, - files: [ - { src: require('./src/pzpr.js').files, dest: 'dist/js/pzpr.concat.js' } - ] - }, ui: { options:{ sourceMap: !PRODUCTION @@ -56,24 +48,6 @@ module.exports = function(grunt){ banner: banner_min, report: 'min' }, - pzpr:{ - options: (PRODUCTION ? {} : { - sourceMap : 'dist/js/pzpr.js.map', - sourceMapIn : 'dist/js/pzpr.concat.js.map', - sourceMapIncludeSources : true - }), - files: [ - { src: 'dist/js/pzpr.concat.js', dest: 'dist/js/pzpr.js'} - ] - }, - variety:{ - options: (PRODUCTION ? {} : { - sourceMap : function(filename){ return filename+'.map';} - }), - files: [ - { expand: true, cwd: 'src/variety', src: ['*.js'], dest: 'dist/js/pzpr-variety' } - ] - }, samples:{ options: (PRODUCTION ? {} : { sourceMap : function(filename){ return filename+'.map';} @@ -98,9 +72,7 @@ module.exports = function(grunt){ grunt.registerTask('default', ['build']); grunt.registerTask('release', ['build']); - grunt.registerTask('build', ['build:pzpr', 'build:variety', 'build:samples', 'build:ui']); - grunt.registerTask('build:pzpr', ['newer:concat:pzpr', 'newer:uglify:pzpr']); + grunt.registerTask('build', ['build:samples', 'build:ui']); grunt.registerTask('build:ui', ['newer:copy:ui', 'newer:concat:ui', 'newer:uglify:ui']); - grunt.registerTask('build:variety',['newer:uglify:variety']); grunt.registerTask('build:samples',['newer:uglify:samples']); }; diff --git a/Makefile b/Makefile index 7ba8516de..1e304e54f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: build test serve format lint rollup candle +.PHONY: release build test serve format lint rollup candle + +release: candle rollup build build: npm run-script build diff --git a/package.json b/package.json index 79028225f..514685cef 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "esm": "^3.2.25", "pzpr-canvas": "^0.8.2", "rollup": "^2.6.0", + "rollup-plugin-terser": "^5.3.0", "source-map-support": "^0.5.12" } } diff --git a/rollup.config.js b/rollup.config.js index 1c815295b..133fef5af 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,3 @@ -// import resolve from '@rollup/plugin-node-resolve'; -// import commonjs from '@rollup/plugin-commonjs'; import { terser } from 'rollup-plugin-terser'; // `npm run build` -> `production` is true @@ -18,8 +16,6 @@ export default { } }, plugins: [ - // resolve(), // use node_modules - // commonjs(), // converts node modules to ES modules production && terser() // minify, but only in production ] }; From 667e06f6d77be8f868af9215c96921f7f44cf7c9 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 14:54:41 +0200 Subject: [PATCH 16/27] rewrite all variety files --- src/variety/amibo.js | 13 +++++-------- src/variety/aquarium.js | 13 +++++-------- src/variety/araf.js | 13 +++++-------- src/variety/balance.js | 13 +++++-------- src/variety/barns.js | 13 +++++-------- src/variety/bdblock.js | 13 +++++-------- src/variety/bonsan.js | 13 +++++-------- src/variety/bosanowa.js | 13 +++++-------- src/variety/box.js | 13 +++++-------- src/variety/castle.js | 13 +++++-------- src/variety/cbblock.js | 13 +++++-------- src/variety/compass.js | 13 +++++-------- src/variety/country.js | 13 +++++-------- src/variety/creek.js | 13 +++++-------- src/variety/curvedata.js | 13 +++++-------- src/variety/doppelblock.js | 13 +++++-------- src/variety/dosufuwa.js | 13 +++++-------- src/variety/easyasabc.js | 13 +++++-------- src/variety/factors.js | 13 +++++-------- src/variety/fillmat.js | 13 +++++-------- src/variety/fillomino.js | 13 +++++-------- src/variety/firefly.js | 13 +++++-------- src/variety/geradeweg.js | 13 +++++-------- src/variety/goishi.js | 13 +++++-------- src/variety/gokigen.js | 13 +++++-------- src/variety/hakoiri.js | 13 +++++-------- src/variety/hanare.js | 13 +++++-------- src/variety/hashikake.js | 13 +++++-------- src/variety/hebi.js | 13 +++++-------- src/variety/herugolf.js | 13 +++++-------- src/variety/heyawake.js | 13 +++++-------- src/variety/hitori.js | 13 +++++-------- src/variety/icebarn.js | 13 +++++-------- src/variety/ichimaga.js | 13 +++++-------- src/variety/juosan.js | 13 +++++-------- src/variety/kaero.js | 13 +++++-------- src/variety/kakuro.js | 13 +++++-------- src/variety/kakuru.js | 13 +++++-------- src/variety/kazunori.js | 13 +++++-------- src/variety/kinkonkan.js | 13 +++++-------- src/variety/kouchoku.js | 13 +++++-------- src/variety/kramma.js | 13 +++++-------- src/variety/kurochute.js | 13 +++++-------- src/variety/kurodoko.js | 13 +++++-------- src/variety/kurotto.js | 13 +++++-------- src/variety/kusabi.js | 13 +++++-------- src/variety/lightup.js | 13 +++++-------- src/variety/lits.js | 13 +++++-------- src/variety/lookair.js | 13 +++++-------- src/variety/loute.js | 13 +++++-------- src/variety/makaro.js | 13 +++++-------- src/variety/mashu.js | 13 +++++-------- src/variety/mejilink.js | 13 +++++-------- src/variety/midloop.js | 13 +++++-------- src/variety/minarism.js | 13 +++++-------- src/variety/nagare.js | 13 +++++-------- src/variety/nagenawa.js | 13 +++++-------- src/variety/nanro.js | 13 +++++-------- src/variety/nawabari.js | 13 +++++-------- src/variety/nondango.js | 13 +++++-------- src/variety/numlin.js | 13 +++++-------- src/variety/nurikabe.js | 13 +++++-------- src/variety/nurimaze.js | 13 +++++-------- src/variety/paintarea.js | 13 +++++-------- src/variety/pencils.js | 13 +++++-------- src/variety/pipelink.js | 13 +++++-------- src/variety/reflect.js | 13 +++++-------- src/variety/renban.js | 13 +++++-------- src/variety/ripple.js | 13 +++++-------- src/variety/roma.js | 13 +++++-------- src/variety/scrin.js | 13 +++++-------- src/variety/shakashaka.js | 13 +++++-------- src/variety/shimaguni.js | 13 +++++-------- src/variety/shugaku.js | 13 +++++-------- src/variety/slalom.js | 13 +++++-------- src/variety/slither.js | 13 +++++-------- src/variety/starbattle.js | 16 ++++++---------- src/variety/sudoku.js | 13 +++++-------- src/variety/sukoro.js | 13 +++++-------- src/variety/tapa.js | 15 +++++---------- src/variety/tasquare.js | 13 +++++-------- src/variety/tatamibari.js | 13 +++++-------- src/variety/tateyoko.js | 13 +++++-------- src/variety/tawa.js | 13 +++++-------- src/variety/tentaisho.js | 13 +++++-------- src/variety/tilepaint.js | 13 +++++-------- src/variety/toichika.js | 13 +++++-------- src/variety/triplace.js | 13 +++++-------- src/variety/usoone.js | 13 +++++-------- src/variety/walllogic.js | 13 +++++-------- src/variety/wblink.js | 13 +++++-------- src/variety/yajikazu.js | 13 +++++-------- src/variety/yajilin.js | 13 +++++-------- src/variety/yajitatami.js | 13 +++++-------- src/variety/yinyang.js | 13 +++++-------- src/variety/yosenabe.js | 13 +++++-------- 96 files changed, 481 insertions(+), 772 deletions(-) diff --git a/src/variety/amibo.js b/src/variety/amibo.js index 9f48a6687..39f05c661 100644 --- a/src/variety/amibo.js +++ b/src/variety/amibo.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 あみぼー版 amibo.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["amibo"], { +var pidlist = ["amibo"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -771,4 +766,6 @@ "No bar connects to a white circle." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/aquarium.js b/src/variety/aquarium.js index adef9d719..8c1be0f87 100644 --- a/src/variety/aquarium.js +++ b/src/variety/aquarium.js @@ -2,13 +2,8 @@ // aquarium.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["aquarium"], { +var pidlist = ["aquarium"]; +var classbase = { MouseEvent: { use: true, inputModes: { edit: ["border", "number"], play: ["shade", "unshade"] }, @@ -433,4 +428,6 @@ "The number of shaded cells in the row or column is not correct." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/araf.js b/src/variety/araf.js index 45ae66d52..3b5f12b5a 100755 --- a/src/variety/araf.js +++ b/src/variety/araf.js @@ -1,13 +1,8 @@ // // araf.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["araf"], { +var pidlist = ["araf"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -244,4 +239,6 @@ "An area has more than two numbers." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/balance.js b/src/variety/balance.js index 7cd68fc5e..a1c716af5 100644 --- a/src/variety/balance.js +++ b/src/variety/balance.js @@ -1,10 +1,5 @@ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["balance"], { +var pidlist = ["balance"]; +var classbase = { MouseEvent: { inputModes: { edit: ["number", "shade", "clear"], @@ -435,4 +430,6 @@ "A circle has no line." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/barns.js b/src/variety/barns.js index dcd7bec64..f3abd88ab 100644 --- a/src/variety/barns.js +++ b/src/variety/barns.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 バーンズ版 barns.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["barns"], { +var pidlist = ["barns"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -179,4 +174,6 @@ }, "lnCrossExIce"); } } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/bdblock.js b/src/variety/bdblock.js index 4cd9d2b9d..ae3a501de 100644 --- a/src/variety/bdblock.js +++ b/src/variety/bdblock.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ボーダーブロック版 bdblock.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["bdblock"], { +var pidlist = ["bdblock"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -194,4 +189,6 @@ ], bdIgnoreBP: ["黒点上を線が通過していません。", "A point has no line."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/bonsan.js b/src/variety/bonsan.js index 33166be54..ef91a543a 100644 --- a/src/variety/bonsan.js +++ b/src/variety/bonsan.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ぼんさん・へやぼん・四角スライダー版 bonsan.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["bonsan", "heyabon", "rectslider", "satogaeri"], { +var pidlist = ["bonsan", "heyabon", "rectslider", "satogaeri"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@bonsan,heyabon": { @@ -750,4 +745,6 @@ "A shaded cell doesn't start any line." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/bosanowa.js b/src/variety/bosanowa.js index 582610579..7852031cc 100644 --- a/src/variety/bosanowa.js +++ b/src/variety/bosanowa.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ボサノワ版 bosanowa.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["bosanowa"], { +var pidlist = ["bosanowa"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -730,4 +725,6 @@ "Sum of the differences between the number and adjacent numbers is not equal to the number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/box.js b/src/variety/box.js index 7815f08a2..f6bee3791 100644 --- a/src/variety/box.js +++ b/src/variety/box.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ボックス版 box.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["box"], { +var pidlist = ["box"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -391,4 +386,6 @@ "A number is not equal to the sum of the number of shaded cells." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/castle.js b/src/variety/castle.js index 1c820bed7..0c16c28fa 100644 --- a/src/variety/castle.js +++ b/src/variety/castle.js @@ -1,10 +1,5 @@ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["castle"], { +var pidlist = ["castle"]; +var classbase = { MouseEvent: { inputModes: { edit: ["number", "direc", "shade", "clear", "info-line"], @@ -538,4 +533,6 @@ "An unshaded cell is outside of the loop." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/cbblock.js b/src/variety/cbblock.js index 21ef0b7cc..71fffa254 100644 --- a/src/variety/cbblock.js +++ b/src/variety/cbblock.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 コンビブロック版 cbblock.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["cbblock", "dbchoco"], { +var pidlist = ["cbblock", "dbchoco"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@cbblock": { @@ -661,4 +656,6 @@ "The two shapes inside a block are different." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/compass.js b/src/variety/compass.js index 8ae8b30cc..13fd12d3b 100644 --- a/src/variety/compass.js +++ b/src/variety/compass.js @@ -1,10 +1,5 @@ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["compass"], { +var pidlist = ["compass"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -326,4 +321,6 @@ "There is an area with more than one clue." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/country.js b/src/variety/country.js index 77a033936..62a267e54 100644 --- a/src/variety/country.js +++ b/src/variety/country.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 カントリーロード・月か太陽・温泉めぐり版 country.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["country", "moonsun", "onsen", "doubleback", "maxi", "simpleloop"], { +var pidlist = ["country", "moonsun", "onsen", "doubleback", "maxi", "simpleloop"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@country,onsen": { @@ -1065,4 +1060,6 @@ "A line in a room is longer than the number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/creek.js b/src/variety/creek.js index 3f02a64c2..66eb8d65c 100644 --- a/src/variety/creek.js +++ b/src/variety/creek.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 クリーク版 creek.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["creek"], { +var pidlist = ["creek"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -170,4 +165,6 @@ "The number of shaded cells around a number on crossing is small." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/curvedata.js b/src/variety/curvedata.js index 99d3713be..68375580c 100644 --- a/src/variety/curvedata.js +++ b/src/variety/curvedata.js @@ -4,13 +4,8 @@ /* global Set:false */ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["curvedata", "curvedata-aux"], { +var pidlist = ["curvedata", "curvedata-aux"]; +var classbase = { // In this puzzle, clue numbers are not stable. They can be changed on the entire board // by a call to `compressShapes()`. Operations which change qnum directly are not permitted. // Use CurveDataOperation for all changes to clues on the grid. @@ -1511,4 +1506,6 @@ "A shape does not match the clue." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/doppelblock.js b/src/variety/doppelblock.js index ef3fcbc30..9af663f7b 100644 --- a/src/variety/doppelblock.js +++ b/src/variety/doppelblock.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ABCプレース版 easyasabc.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["doppelblock"], { +var pidlist = ["doppelblock"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -382,4 +377,6 @@ "There are more than two blocks in a row." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/dosufuwa.js b/src/variety/dosufuwa.js index b5ecc0a64..bc1ebfc0d 100644 --- a/src/variety/dosufuwa.js +++ b/src/variety/dosufuwa.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ドッスンフワリ版 dosufuwa.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["dosufuwa"], { +var pidlist = ["dosufuwa"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -423,4 +418,6 @@ "An iron ball is not on the bottom of the row or on another iron ball." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/easyasabc.js b/src/variety/easyasabc.js index ff26e324f..85227b8a0 100644 --- a/src/variety/easyasabc.js +++ b/src/variety/easyasabc.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ABCプレース版 easyasabc.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["easyasabc"], { +var pidlist = ["easyasabc"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -595,4 +590,6 @@ "The letter is not the closest." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/factors.js b/src/variety/factors.js index 3caf728d1..21ab49626 100644 --- a/src/variety/factors.js +++ b/src/variety/factors.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 因子の部屋版 factors.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["factors"], { +var pidlist = ["factors"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -193,4 +188,6 @@ "A number of room is not equal to the product of these numbers." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/fillmat.js b/src/variety/fillmat.js index 1210bb76f..ece61d2d8 100644 --- a/src/variety/fillmat.js +++ b/src/variety/fillmat.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 フィルマット・ウソタタミ版 fillmat.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["fillmat", "usotatami"], { +var pidlist = ["fillmat", "usotatami"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -197,4 +192,6 @@ "Tatamis of the same size are adjacent." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/fillomino.js b/src/variety/fillomino.js index 6768930df..4b7198b8b 100644 --- a/src/variety/fillomino.js +++ b/src/variety/fillomino.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 フィルオミノ版 fillomino.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["fillomino"], { +var pidlist = ["fillomino"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -412,4 +407,6 @@ "Adjacent blocks have the same number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/firefly.js b/src/variety/firefly.js index 143789d48..117a98d43 100644 --- a/src/variety/firefly.js +++ b/src/variety/firefly.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ホタルビーム版 firefly.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["firefly"], { +var pidlist = ["firefly"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -251,4 +246,6 @@ "The number of curves is different from a firefly's number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/geradeweg.js b/src/variety/geradeweg.js index a37e91bf8..f0439e8df 100644 --- a/src/variety/geradeweg.js +++ b/src/variety/geradeweg.js @@ -1,10 +1,5 @@ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["geradeweg"], { +var pidlist = ["geradeweg"]; +var classbase = { MouseEvent: { inputModes: { edit: ["number", "clear", "info-line"], @@ -266,4 +261,6 @@ ], numNoLine: ["線の通っていない数字があります。", "A number has no line."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/goishi.js b/src/variety/goishi.js index 43819a68c..71f550c33 100644 --- a/src/variety/goishi.js +++ b/src/variety/goishi.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 碁石ひろい版 goishi.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["goishi"], { +var pidlist = ["goishi"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -466,4 +461,6 @@ "There is remaining Goishi." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/gokigen.js b/src/variety/gokigen.js index e025dbdf6..fbed49626 100644 --- a/src/variety/gokigen.js +++ b/src/variety/gokigen.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ごきげんななめ、ごきげんななめ・輪切版 gokigen.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["gokigen", "wagiri"], { +var pidlist = ["gokigen", "wagiri"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -563,4 +558,6 @@ ], ceNoSlash: ["斜線がないマスがあります。", "There is an empty cell."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/hakoiri.js b/src/variety/hakoiri.js index d2b1a9ccb..ed0ad0af2 100644 --- a/src/variety/hakoiri.js +++ b/src/variety/hakoiri.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 はこいり○△□版 hakoiri.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["hakoiri"], { +var pidlist = ["hakoiri"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -335,4 +330,6 @@ "Equal shapes touch." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/hanare.js b/src/variety/hanare.js index c1c0f676a..91a5ae327 100644 --- a/src/variety/hanare.js +++ b/src/variety/hanare.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 はなれ組版 hanare.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["hanare"], { +var pidlist = ["hanare"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -284,4 +279,6 @@ "The distance of the paired numbers is not equal to their difference." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/hashikake.js b/src/variety/hashikake.js index 44835d671..cdf035f93 100644 --- a/src/variety/hashikake.js +++ b/src/variety/hashikake.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 橋をかけろ版 hashikake.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["hashikake"], { +var pidlist = ["hashikake"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -460,4 +455,6 @@ "The number of connecting bridges to a number is not correct." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/hebi.js b/src/variety/hebi.js index d922434a2..6b49b7454 100644 --- a/src/variety/hebi.js +++ b/src/variety/hebi.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 へびいちご版 hebi.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["hebi"], { +var pidlist = ["hebi"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -517,4 +512,6 @@ "A snake can see another snake." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/herugolf.js b/src/variety/herugolf.js index 7e17ac702..f49df2e8d 100644 --- a/src/variety/herugolf.js +++ b/src/variety/herugolf.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ヘルゴルフ版 herugolf.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["herugolf"], { +var pidlist = ["herugolf"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -816,4 +811,6 @@ "There is a Hole without a ball." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/heyawake.js b/src/variety/heyawake.js index 4399dc770..f758c2f95 100644 --- a/src/variety/heyawake.js +++ b/src/variety/heyawake.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 へやわけ・∀人∃HEYA版 heyawake.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["heyawake", "ayeheya"], { +var pidlist = ["heyawake", "ayeheya"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -415,4 +410,6 @@ "The room is not point symmetric." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/hitori.js b/src/variety/hitori.js index fdd3a85ed..25895d578 100644 --- a/src/variety/hitori.js +++ b/src/variety/hitori.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ひとりにしてくれ hitori.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["hitori"], { +var pidlist = ["hitori"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -274,4 +269,6 @@ }); } } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/icebarn.js b/src/variety/icebarn.js index 27b97fff2..c01cdc488 100644 --- a/src/variety/icebarn.js +++ b/src/variety/icebarn.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 アイスバーン・アイスローム・アイスローム2版 icebarn.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["icebarn", "icelom", "icelom2"], { +var pidlist = ["icebarn", "icelom", "icelom2"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@icebarn": { @@ -1593,4 +1588,6 @@ "The line doesn't pass all of the non-icy cell." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/ichimaga.js b/src/variety/ichimaga.js index 4bc0499db..e5612eb91 100644 --- a/src/variety/ichimaga.js +++ b/src/variety/ichimaga.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 イチマガ・磁石イチマガ・一回曲がって交差もするの版 ichimaga.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["ichimaga", "ichimagam", "ichimagax"], { +var pidlist = ["ichimaga", "ichimagam", "ichimagax"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -172,4 +167,6 @@ "The number of curves is twice or more." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/juosan.js b/src/variety/juosan.js index 6be7dcd2f..02920df6c 100644 --- a/src/variety/juosan.js +++ b/src/variety/juosan.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 縦横さん版 juosan.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["juosan"], { +var pidlist = ["juosan"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -313,4 +308,6 @@ "The number of majority of vertical or horizonal bars is less than the number of the area." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kaero.js b/src/variety/kaero.js index d7bc957d9..68d5c867c 100644 --- a/src/variety/kaero.js +++ b/src/variety/kaero.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 お家に帰ろう・ぐんたいあり版 kaero.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kaero", "armyants"], { +var pidlist = ["kaero", "armyants"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -579,4 +574,6 @@ "A number is greater than the size of the ant." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kakuro.js b/src/variety/kakuro.js index 7dded1f44..bb02c19c6 100644 --- a/src/variety/kakuro.js +++ b/src/variety/kakuro.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 カックロ版 kakuro.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kakuro"], { +var pidlist = ["kakuro"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -524,4 +519,6 @@ ], ceNoNum: ["すべてのマスに数字が入っていません。", "There is an empty cell."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kakuru.js b/src/variety/kakuru.js index 8ad522012..5f4b7bed2 100644 --- a/src/variety/kakuru.js +++ b/src/variety/kakuru.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 カックル版 kakuru.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kakuru"], { +var pidlist = ["kakuru"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -444,4 +439,6 @@ "A sum of numbers around the pre-numbered cell is incorrect." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kazunori.js b/src/variety/kazunori.js index f94563c12..4e054b5d2 100644 --- a/src/variety/kazunori.js +++ b/src/variety/kazunori.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 かずのりのへや版 kazunori.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kazunori"], { +var pidlist = ["kazunori"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -504,4 +499,6 @@ "The size of the room is not even." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kinkonkan.js b/src/variety/kinkonkan.js index b82dce61c..8b048a50c 100644 --- a/src/variety/kinkonkan.js +++ b/src/variety/kinkonkan.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 キンコンカン版 kinkonkan.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kinkonkan"], { +var pidlist = ["kinkonkan"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -768,4 +763,6 @@ "The number of reflections is wrong." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kouchoku.js b/src/variety/kouchoku.js index c212ccb1c..60c37ad9d 100644 --- a/src/variety/kouchoku.js +++ b/src/variety/kouchoku.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 交差は直角に限る版 kouchoku.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kouchoku", "angleloop"], { +var pidlist = ["kouchoku", "angleloop"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -1583,4 +1578,6 @@ ], brNoLine: ["線が存在していません。", "There is no segment."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kramma.js b/src/variety/kramma.js index aace6694c..7e20947ea 100644 --- a/src/variety/kramma.js +++ b/src/variety/kramma.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 快刀乱麻・新・快刀乱麻・ヤギとオオカミ版 kramma.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kramma", "kramman", "shwolf"], { +var pidlist = ["kramma", "kramman", "shwolf"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@kramma": { @@ -522,4 +517,6 @@ ctx.drawImage(n !== null ? img : null, sx, sy, sw, sh, dx, dy, dw, dh); } } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kurochute.js b/src/variety/kurochute.js index c7935eaf0..622d117c8 100644 --- a/src/variety/kurochute.js +++ b/src/variety/kurochute.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 クロシュート版 kurochute.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kurochute"], { +var pidlist = ["kurochute"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -223,4 +218,6 @@ "There is not exactly one shaded cell at the given distance from the number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kurodoko.js b/src/variety/kurodoko.js index b86f047da..d8b9385f2 100644 --- a/src/variety/kurodoko.js +++ b/src/variety/kurodoko.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 黒マスはどこだ版 kurodoko.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kurodoko", "nurimisaki", "cave"], { +var pidlist = ["kurodoko", "nurimisaki", "cave"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -345,4 +340,6 @@ "Some shaded cells are not connected to the outside." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kurotto.js b/src/variety/kurotto.js index a83dbf925..575334de4 100644 --- a/src/variety/kurotto.js +++ b/src/variety/kurotto.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 クロット版 kurotto.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kurotto"], { +var pidlist = ["kurotto"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -174,4 +169,6 @@ "The number is not equal to sum of adjacent masses of shaded cells." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/kusabi.js b/src/variety/kusabi.js index dc53db43b..6c403953c 100644 --- a/src/variety/kusabi.js +++ b/src/variety/kusabi.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 クサビリンク版 kusabi.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["kusabi"], { +var pidlist = ["kusabi"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -227,4 +222,6 @@ "A circle is not connected another object." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/lightup.js b/src/variety/lightup.js index e20f496ce..b4a927fc8 100644 --- a/src/variety/lightup.js +++ b/src/variety/lightup.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 美術館版 lightup.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["lightup"], { +var pidlist = ["lightup"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -446,4 +441,6 @@ ], ceDark: ["照明に照らされていないセルがあります。", "A cell is not shined."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/lits.js b/src/variety/lits.js index 30aed0826..fe05a3549 100644 --- a/src/variety/lits.js +++ b/src/variety/lits.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 LITS・のりのり版 lits.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["lits", "norinori"], { +var pidlist = ["lits", "norinori"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -484,4 +479,6 @@ "A room has three or mode shaded cells." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/lookair.js b/src/variety/lookair.js index bea4829a6..59cf7ccc5 100644 --- a/src/variety/lookair.js +++ b/src/variety/lookair.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 るっくえあ版 lookair.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["lookair"], { +var pidlist = ["lookair"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -195,4 +190,6 @@ "A mass of shaded cells can looks other same size mass of shaded cells." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/loute.js b/src/variety/loute.js index 705b87d88..c58e0e813 100644 --- a/src/variety/loute.js +++ b/src/variety/loute.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 エルート・さしがね版 loute.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["loute", "sashigane"], { +var pidlist = ["loute", "sashigane"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@loute": { @@ -695,4 +690,6 @@ "A circle is out of the corner." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/makaro.js b/src/variety/makaro.js index 599d73f5f..3c7244284 100644 --- a/src/variety/makaro.js +++ b/src/variety/makaro.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 マカロ版 makaro.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["makaro"], { +var pidlist = ["makaro"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -453,4 +448,6 @@ "An arrow doesn't point out biggest number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/mashu.js b/src/variety/mashu.js index 08111a988..a93d4b67b 100644 --- a/src/variety/mashu.js +++ b/src/variety/mashu.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ましゅ版 mashu.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["mashu"], { +var pidlist = ["mashu"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -359,4 +354,6 @@ "Lines turn next to a black pearl." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/mejilink.js b/src/variety/mejilink.js index 5a1a0bc00..94a31b98c 100644 --- a/src/variety/mejilink.js +++ b/src/variety/mejilink.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 メジリンク版 mejilink.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["mejilink"], { +var pidlist = ["mejilink"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -302,4 +297,6 @@ "The size of the tile is not equal to the total of length of lines that is remained dotted around the tile." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/midloop.js b/src/variety/midloop.js index 372be6f66..7c8dc942c 100644 --- a/src/variety/midloop.js +++ b/src/variety/midloop.js @@ -1,13 +1,8 @@ // // midloop.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["midloop"], { +var pidlist = ["midloop"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -271,4 +266,6 @@ "A circle is not the center point of a line." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/minarism.js b/src/variety/minarism.js index da98d4a64..0e0e3dacd 100644 --- a/src/variety/minarism.js +++ b/src/variety/minarism.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 マイナリズム・Kropki版 minarism.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["minarism", "kropki"], { +var pidlist = ["minarism", "kropki"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@minarism#1": { @@ -808,4 +803,6 @@ "The number is double the other between two adjacent cells without shaded circle." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nagare.js b/src/variety/nagare.js index 8215e8889..875e24b72 100644 --- a/src/variety/nagare.js +++ b/src/variety/nagare.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 流れるループ版 nagare.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nagare"], { +var pidlist = ["nagare"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -961,4 +956,6 @@ "The line passes against an arrow." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nagenawa.js b/src/variety/nagenawa.js index f449f93b7..9f9a165e4 100644 --- a/src/variety/nagenawa.js +++ b/src/variety/nagenawa.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 なげなわ・リングリング版 nagenawa.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nagenawa", "ringring"], { +var pidlist = ["nagenawa", "ringring"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@nagenawa": { @@ -352,4 +347,6 @@ "There is no line on the unshaded cell." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nanro.js b/src/variety/nanro.js index f45c7b1ea..dba0a8753 100644 --- a/src/variety/nanro.js +++ b/src/variety/nanro.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ナンロー版 nanro.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nanro"], { +var pidlist = ["nanro"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -322,4 +317,6 @@ "There is a cell that is not filled in number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nawabari.js b/src/variety/nawabari.js index 44c115b94..63540ec4f 100644 --- a/src/variety/nawabari.js +++ b/src/variety/nawabari.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 なわばり・フォーセルズ・ファイブセルズ版 nawabari.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nawabari", "fourcells", "fivecells", "heteromino"], { +var pidlist = ["nawabari", "fourcells", "fivecells", "heteromino"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -522,4 +517,6 @@ "Two areas of the same shape and orientation area adjacent." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nondango.js b/src/variety/nondango.js index d1a90dc0d..f5e843cc2 100644 --- a/src/variety/nondango.js +++ b/src/variety/nondango.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ノンダンゴ版 nondango.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nondango"], { +var pidlist = ["nondango"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -350,4 +345,6 @@ "There are three or more unshaded circles in a row." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/numlin.js b/src/variety/numlin.js index 847f1d8cf..5418291cf 100644 --- a/src/variety/numlin.js +++ b/src/variety/numlin.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ナンバーリンク、アルコネ版 numlin.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["numlin", "arukone"], { +var pidlist = ["numlin", "arukone"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -393,4 +388,6 @@ "A crossing is left blank." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nurikabe.js b/src/variety/nurikabe.js index 646f59764..3de2557e4 100644 --- a/src/variety/nurikabe.js +++ b/src/variety/nurikabe.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ぬりかべ・ぬりぼう・モチコロ・モチにょろ版 nurikabe.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nurikabe", "nuribou", "mochikoro", "mochinyoro"], { +var pidlist = ["nurikabe", "nuribou", "mochikoro", "mochinyoro"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -395,4 +390,6 @@ "The unshaded cells are divided." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/nurimaze.js b/src/variety/nurimaze.js index d4597dd69..4753d607c 100644 --- a/src/variety/nurimaze.js +++ b/src/variety/nurimaze.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ぬりめいず版 nurimaze.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["nurimaze"], { +var pidlist = ["nurimaze"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -860,4 +855,6 @@ ], objShaded: ["オブジェクトが黒マスになっています。", "An object is shaded."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/paintarea.js b/src/variety/paintarea.js index ac59e2905..ec5e223c5 100644 --- a/src/variety/paintarea.js +++ b/src/variety/paintarea.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ペイントエリア版 paintarea.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["paintarea"], { +var pidlist = ["paintarea"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -150,4 +145,6 @@ "The number is not equal to the number of shaded cells in four adjacent cells." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/pencils.js b/src/variety/pencils.js index ed70e2032..06278d00c 100644 --- a/src/variety/pencils.js +++ b/src/variety/pencils.js @@ -1,13 +1,8 @@ // // pencils.js: Implementation of Pencils puzzle type. // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["pencils"], { +var pidlist = ["pencils"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -1057,4 +1052,6 @@ ], unusedCell: ["何も書かれていないマスがあります。", "A cell is unused."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/pipelink.js b/src/variety/pipelink.js index a2e3e412a..bb7926000 100644 --- a/src/variety/pipelink.js +++ b/src/variety/pipelink.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 パイプリンク・帰ってきたパイプリンク・環状線スペシャル版 pipelink.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["pipelink", "pipelinkr", "loopsp"], { +var pidlist = ["pipelink", "pipelinkr", "loopsp"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@pipelink": { @@ -735,4 +730,6 @@ ], lpNoNum: ["○を含んでいないループがあります。", "A loop has no numbers."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/reflect.js b/src/variety/reflect.js index e4beb6af2..4be714c2e 100644 --- a/src/variety/reflect.js +++ b/src/variety/reflect.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 リフレクトリンク版 reflect.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["reflect"], { +var pidlist = ["reflect"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -529,4 +524,6 @@ "The lines passing a triangle are too short." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/renban.js b/src/variety/renban.js index 3dc3ae29b..57cdd987d 100644 --- a/src/variety/renban.js +++ b/src/variety/renban.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 連番窓口版 renban.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["renban"], { +var pidlist = ["renban"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -260,4 +255,6 @@ "The difference between two numbers is not equal to the length of the line between them." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/ripple.js b/src/variety/ripple.js index 846edc7ea..fc16a283e 100644 --- a/src/variety/ripple.js +++ b/src/variety/ripple.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 波及効果・コージュン版 ripple.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["ripple", "cojun", "meander"], { +var pidlist = ["ripple", "cojun", "meander"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -388,4 +383,6 @@ "A number is not the neighbor of its consecutive numbers." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/roma.js b/src/variety/roma.js index e46b6373a..fb0d8a7ac 100644 --- a/src/variety/roma.js +++ b/src/variety/roma.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ろーま版 roma.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["roma"], { +var pidlist = ["roma"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -345,4 +340,6 @@ "A cell cannot reach a goal." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/scrin.js b/src/variety/scrin.js index 986a80059..4a0707c3a 100644 --- a/src/variety/scrin.js +++ b/src/variety/scrin.js @@ -1,10 +1,5 @@ -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["scrin"], { +var pidlist = ["scrin"]; +var classbase = { MouseEvent: { inputModes: { edit: ["number", "clear"], play: ["shade", "unshade"] }, mouseinput_auto: function() { @@ -468,4 +463,6 @@ "A rectangle is not part of the solution." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/shakashaka.js b/src/variety/shakashaka.js index 0744a2674..e1adbfccc 100644 --- a/src/variety/shakashaka.js +++ b/src/variety/shakashaka.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 シャカシャカ版 shakashaka.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["shakashaka"], { +var pidlist = ["shakashaka"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -716,4 +711,6 @@ "The number of triangles in four adjacent cells is smaller than it." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/shimaguni.js b/src/variety/shimaguni.js index b96070a1b..1add560a5 100644 --- a/src/variety/shimaguni.js +++ b/src/variety/shimaguni.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 島国・チョコナ・ストストーン版 shimaguni.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["shimaguni", "chocona", "stostone"], { +var pidlist = ["shimaguni", "chocona", "stostone"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -533,4 +528,6 @@ "Unshaded cells exist in the lower half of the board after the blocks have fallen." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/shugaku.js b/src/variety/shugaku.js index 9fbff6853..c7af2180c 100644 --- a/src/variety/shugaku.js +++ b/src/variety/shugaku.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 修学旅行の夜版 shugaku.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["shugaku"], { +var pidlist = ["shugaku"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -728,4 +723,6 @@ "There is an empty cell." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/slalom.js b/src/variety/slalom.js index 7af8efa16..4c394e8ba 100644 --- a/src/variety/slalom.js +++ b/src/variety/slalom.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 スラローム版 slalom.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["slalom"], { +var pidlist = ["slalom"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -1359,4 +1354,6 @@ "Start/goal circle doesn't have two lines." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/slither.js b/src/variety/slither.js index c48d6f12a..31697c1d4 100644 --- a/src/variety/slither.js +++ b/src/variety/slither.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 スリザーリンク・バッグ版 slither.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["slither"], { +var pidlist = ["slither"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -275,4 +270,6 @@ "The number is not equal to the number of lines around it." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/starbattle.js b/src/variety/starbattle.js index 740ec7bb1..41d140ce6 100644 --- a/src/variety/starbattle.js +++ b/src/variety/starbattle.js @@ -1,7 +1,7 @@ // // パズル固有スクリプト部 スターバトル版 starbattle.js // -(function() { + // 星を描画するときの頂点の位置 var starXOffset = [ 0, @@ -28,13 +28,8 @@ -0.309 ]; - (function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } - })(["starbattle"], { +var pidlist = ["starbattle"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -641,5 +636,6 @@ "The number of stars in a line is wrong." ] } - }); -})(); + }; + +export default [pidlist, classbase]; diff --git a/src/variety/sudoku.js b/src/variety/sudoku.js index 52b7adf36..db3826497 100644 --- a/src/variety/sudoku.js +++ b/src/variety/sudoku.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 数独版 sudoku.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["sudoku"], { +var pidlist = ["sudoku"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -140,4 +135,6 @@ "checkNoNumCell+" ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/sukoro.js b/src/variety/sukoro.js index ce73092cf..5a3b0f97c 100644 --- a/src/variety/sukoro.js +++ b/src/variety/sukoro.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 数コロ・ヴィウ・数コロ部屋版 sukoro.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["sukoro", "view", "sukororoom"], { +var pidlist = ["sukoro", "view", "sukororoom"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 "MouseEvent@sukoro,view": { @@ -282,4 +277,6 @@ "There is a cell that is not filled in number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tapa.js b/src/variety/tapa.js index 08c9fecad..33b47869e 100644 --- a/src/variety/tapa.js +++ b/src/variety/tapa.js @@ -1,7 +1,6 @@ // // パズル固有スクリプト部 Tapa版 tapa.js // -(function() { function sameArray(array1, array2) { if (array1.length !== array2.length) { return false; @@ -14,13 +13,8 @@ return true; } - (function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } - })(["tapa"], { +var pidlist = ["tapa"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -635,5 +629,6 @@ "The number is not equal to the length of surrounding shaded cells." ] } - }); -})(); + }; + +export default [pidlist, classbase]; diff --git a/src/variety/tasquare.js b/src/variety/tasquare.js index 8640310bd..a7fa42447 100644 --- a/src/variety/tasquare.js +++ b/src/variety/tasquare.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 たすくえあ版 tasquare.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tasquare"], { +var pidlist = ["tasquare"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -185,4 +180,6 @@ "No shaded cells are adjacent to square marks." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tatamibari.js b/src/variety/tatamibari.js index 80d64b4be..67fddb96a 100644 --- a/src/variety/tatamibari.js +++ b/src/variety/tatamibari.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 タタミバリ版 tatamibari.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tatamibari"], { +var pidlist = ["tatamibari"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -319,4 +314,6 @@ "A tatami is not a vertically long rectangle." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tateyoko.js b/src/variety/tateyoko.js index e9a7cccc0..63ff9c638 100644 --- a/src/variety/tateyoko.js +++ b/src/variety/tateyoko.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 タテボーヨコボー版 tateyoko.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tateyoko"], { +var pidlist = ["tateyoko"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -461,4 +456,6 @@ "The number of lines connected to a shaded cell is wrong." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tawa.js b/src/variety/tawa.js index 21e76fa08..8585479b9 100644 --- a/src/variety/tawa.js +++ b/src/variety/tawa.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 たわむれんが版 tawa.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tawa"], { +var pidlist = ["tawa"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -600,4 +595,6 @@ "There are no shaded cells under a shaded cell." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tentaisho.js b/src/variety/tentaisho.js index 1cca8af72..8bf9feb7c 100644 --- a/src/variety/tentaisho.js +++ b/src/variety/tentaisho.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 天体ショー版 tentaisho.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tentaisho"], { +var pidlist = ["tentaisho"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -548,4 +543,6 @@ "A block has two or more stars." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/tilepaint.js b/src/variety/tilepaint.js index a1703d25a..772af2664 100644 --- a/src/variety/tilepaint.js +++ b/src/variety/tilepaint.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 タイルペイント版 tilepaint.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["tilepaint"], { +var pidlist = ["tilepaint"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -446,4 +441,6 @@ "The number of shaded cells underward or rightward is not correct." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/toichika.js b/src/variety/toichika.js index 8770fb25b..91b7848d7 100644 --- a/src/variety/toichika.js +++ b/src/variety/toichika.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 遠い誓い版 toichika.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["toichika"], { +var pidlist = ["toichika"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -374,4 +369,6 @@ "There is no paired arrow in the direction of an arrow." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/triplace.js b/src/variety/triplace.js index 8928ede7e..995c1afc8 100644 --- a/src/variety/triplace.js +++ b/src/variety/triplace.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 トリプレイス版 triplace.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["triplace"], { +var pidlist = ["triplace"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -460,4 +455,6 @@ "The number of straight blocks underward or rightward is not correct." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/usoone.js b/src/variety/usoone.js index fa50d3c11..4b0a1e368 100644 --- a/src/variety/usoone.js +++ b/src/variety/usoone.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ウソワン版 usoone.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["usoone"], { +var pidlist = ["usoone"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -293,4 +288,6 @@ "The number of liars in a room is not one." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/walllogic.js b/src/variety/walllogic.js index b611b3b56..c74f2948a 100644 --- a/src/variety/walllogic.js +++ b/src/variety/walllogic.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ウォールロジック版 walllogic.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["walllogic"], { +var pidlist = ["walllogic"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -718,4 +713,6 @@ "A line doesn't connect to any number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/wblink.js b/src/variety/wblink.js index bccc913fb..557d6f50c 100644 --- a/src/variety/wblink.js +++ b/src/variety/wblink.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 シロクロリンク版 wblink.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["wblink"], { +var pidlist = ["wblink"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -324,4 +319,6 @@ ], nmNoLine: ["○から線が出ていません。", "A circle doesn't start any line."] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/yajikazu.js b/src/variety/yajikazu.js index 90b5542ca..52156631b 100644 --- a/src/variety/yajikazu.js +++ b/src/variety/yajikazu.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 やじさんかずさん版 yajikazu.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["yajikazu"], { +var pidlist = ["yajikazu"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -161,4 +156,6 @@ } } } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/yajilin.js b/src/variety/yajilin.js index 185a178a0..9ca8e428e 100644 --- a/src/variety/yajilin.js +++ b/src/variety/yajilin.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ヤジリン版 yajilin.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["yajilin", "yajilin-regions"], { +var pidlist = ["yajilin", "yajilin-regions"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -653,4 +648,6 @@ "There is an empty cell." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/yajitatami.js b/src/variety/yajitatami.js index 107bd5cc6..3948ea04b 100644 --- a/src/variety/yajitatami.js +++ b/src/variety/yajitatami.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 ヤジタタミ版 yajitatami.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["yajitatami"], { +var pidlist = ["yajitatami"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -241,4 +236,6 @@ "There is no border in front of the arrowed number." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/yinyang.js b/src/variety/yinyang.js index 6fecb6887..bf53c6ef2 100644 --- a/src/variety/yinyang.js +++ b/src/variety/yinyang.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 しろまるくろまる版 yinyang.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["yinyang"], { +var pidlist = ["yinyang"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -261,4 +256,6 @@ "Unshaded circles are divided." ] } -}); +} + +export default [pidlist, classbase]; diff --git a/src/variety/yosenabe.js b/src/variety/yosenabe.js index a786df608..17cfa8165 100644 --- a/src/variety/yosenabe.js +++ b/src/variety/yosenabe.js @@ -1,13 +1,8 @@ // // パズル固有スクリプト部 よせなべ版 yosenabe.js // -(function(pidlist, classbase) { - if (typeof module === "object" && module.exports) { - module.exports = [pidlist, classbase]; - } else { - pzpr.classmgr.makeCustom(pidlist, classbase); - } -})(["yosenabe"], { +var pidlist = ["yosenabe"]; +var classbase = { //--------------------------------------------------------- // マウス入力系 MouseEvent: { @@ -638,4 +633,6 @@ ], bkNoNum: ["具材のない鍋があります。", "A crock has no circle."] } -}); +} + +export default [pidlist, classbase]; From a1d2fa545c1750501d1b6b815158cfbeb1b23d96 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 15:27:00 +0200 Subject: [PATCH 17/27] load varieties --- src/pzpr/variety.js | 376 +++++++++++++++++++++------------ src/variety/kramma.js | 5 +- test/pzpr/parser_test.js | 2 +- test/variety/aho_test.js | 2 +- test/variety/amibo_test.js | 2 +- test/variety/ayeheya_test.js | 2 +- test/variety/cbblock_test.js | 2 +- test/variety/curvedata_test.js | 2 +- test/variety/fivecells_test.js | 2 +- test/variety/gokigen_test.js | 2 +- test/variety/herugolf_test.js | 2 +- test/variety/lits_test.js | 2 +- test/variety/onsen_test.js | 2 +- test/variety/pipelink_test.js | 2 +- test/variety/ringring_test.js | 2 +- test/variety/slalom_test.js | 2 +- test/variety/tapa_test.js | 2 +- test/variety/tentaisho_test.js | 2 +- test/variety/yajilin_test.js | 2 +- 19 files changed, 256 insertions(+), 159 deletions(-) diff --git a/src/pzpr/variety.js b/src/pzpr/variety.js index c5b145d6e..0d9d32582 100755 --- a/src/pzpr/variety.js +++ b/src/pzpr/variety.js @@ -1,7 +1,103 @@ // Variety.js v3.4.1 -import mod_skyscrapers from "../variety/skyscrapers.js"; +import mod_amibo from "../variety/amibo.js"; +import mod_aquarium from "../variety/aquarium.js"; +import mod_araf from "../variety/araf.js"; +import mod_balance from "../variety/balance.js"; +import mod_barns from "../variety/barns.js"; +import mod_bdblock from "../variety/bdblock.js"; +import mod_bonsan from "../variety/bonsan.js"; +import mod_bosanowa from "../variety/bosanowa.js"; +import mod_box from "../variety/box.js"; +import mod_castle from "../variety/castle.js"; +import mod_cbblock from "../variety/cbblock.js"; +import mod_compass from "../variety/compass.js"; +import mod_country from "../variety/country.js"; +import mod_creek from "../variety/creek.js"; +import mod_curvedata from "../variety/curvedata.js"; +import mod_doppelblock from "../variety/doppelblock.js"; +import mod_dosufuwa from "../variety/dosufuwa.js"; +import mod_easyasabc from "../variety/easyasabc.js"; +import mod_factors from "../variety/factors.js"; +import mod_fillmat from "../variety/fillmat.js"; +import mod_fillomino from "../variety/fillomino.js"; +import mod_firefly from "../variety/firefly.js"; +import mod_geradeweg from "../variety/geradeweg.js"; +import mod_goishi from "../variety/goishi.js"; +import mod_gokigen from "../variety/gokigen.js"; +import mod_hakoiri from "../variety/hakoiri.js"; +import mod_hanare from "../variety/hanare.js"; +import mod_hashikake from "../variety/hashikake.js"; +import mod_hebi from "../variety/hebi.js"; +import mod_herugolf from "../variety/herugolf.js"; +import mod_heyawake from "../variety/heyawake.js"; +import mod_hitori from "../variety/hitori.js"; +import mod_icebarn from "../variety/icebarn.js"; +import mod_ichimaga from "../variety/ichimaga.js"; +import mod_juosan from "../variety/juosan.js"; +import mod_kaero from "../variety/kaero.js"; +import mod_kakuro from "../variety/kakuro.js"; +import mod_kakuru from "../variety/kakuru.js"; +import mod_kazunori from "../variety/kazunori.js"; +import mod_kinkonkan from "../variety/kinkonkan.js"; +import mod_kouchoku from "../variety/kouchoku.js"; +import mod_kramma from "../variety/kramma.js"; +import mod_kurochute from "../variety/kurochute.js"; +import mod_kurodoko from "../variety/kurodoko.js"; +import mod_kurotto from "../variety/kurotto.js"; +import mod_kusabi from "../variety/kusabi.js"; +import mod_lightup from "../variety/lightup.js"; +import mod_lits from "../variety/lits.js"; +import mod_lookair from "../variety/lookair.js"; +import mod_loute from "../variety/loute.js"; +import mod_makaro from "../variety/makaro.js"; +import mod_mashu from "../variety/mashu.js"; +import mod_mejilink from "../variety/mejilink.js"; +import mod_midloop from "../variety/midloop.js"; +import mod_minarism from "../variety/minarism.js"; +import mod_nagare from "../variety/nagare.js"; +import mod_nagenawa from "../variety/nagenawa.js"; +import mod_nanro from "../variety/nanro.js"; +import mod_nawabari from "../variety/nawabari.js"; +import mod_nondango from "../variety/nondango.js"; +import mod_numlin from "../variety/numlin.js"; +import mod_nurikabe from "../variety/nurikabe.js"; +import mod_nurimaze from "../variety/nurimaze.js"; +import mod_paintarea from "../variety/paintarea.js"; +import mod_pencils from "../variety/pencils.js"; +import mod_pipelink from "../variety/pipelink.js"; +import mod_reflect from "../variety/reflect.js"; +import mod_renban from "../variety/renban.js"; +import mod_ripple from "../variety/ripple.js"; +import mod_roma from "../variety/roma.js"; +import mod_scrin from "../variety/scrin.js"; +import mod_shakashaka from "../variety/shakashaka.js"; import mod_shikaku from "../variety/shikaku.js"; +import mod_shimaguni from "../variety/shimaguni.js"; +import mod_shugaku from "../variety/shugaku.js"; +import mod_skyscrapers from "../variety/skyscrapers.js"; +import mod_slalom from "../variety/slalom.js"; +import mod_slither from "../variety/slither.js"; +import mod_starbattle from "../variety/starbattle.js"; +import mod_sudoku from "../variety/sudoku.js"; +import mod_sukoro from "../variety/sukoro.js"; +import mod_tapa from "../variety/tapa.js"; +import mod_tasquare from "../variety/tasquare.js"; +import mod_tatamibari from "../variety/tatamibari.js"; +import mod_tateyoko from "../variety/tateyoko.js"; +import mod_tawa from "../variety/tawa.js"; +import mod_tentaisho from "../variety/tentaisho.js"; +import mod_tilepaint from "../variety/tilepaint.js"; +import mod_toichika from "../variety/toichika.js"; +import mod_triplace from "../variety/triplace.js"; +import mod_usoone from "../variety/usoone.js"; +import mod_walllogic from "../variety/walllogic.js"; +import mod_wblink from "../variety/wblink.js"; +import mod_yajikazu from "../variety/yajikazu.js"; +import mod_yajilin from "../variety/yajilin.js"; +import mod_yajitatami from "../variety/yajitatami.js"; +import mod_yinyang from "../variety/yinyang.js"; +import mod_yosenabe from "../variety/yosenabe.js"; var _info = {}, _list = []; @@ -91,27 +187,27 @@ import mod_shikaku from "../variety/shikaku.js"; // id: [?, ?, "name jp", "name en", module, aliases] { aho: [0, 0, "アホになり切れ", "Aho-ni-Narikire", mod_shikaku], - amibo: [0, 0, "あみぼー", "Amibo", "amibo"], - angleloop: [0, 0, "鋭直鈍ループ", "Angle Loop", "kouchoku"], - aquarium: [0, 0, "アクアプレース", "Aquarium", "aquarium"], - araf: [0, 0, "相ダ部屋", "Araf", "araf"], - armyants: [0, 0, "ぐんたいあり", "Army Ants", "kaero"], - arukone: [0, 0, "アルコネ", "Arukone", "numlin"], - ayeheya: [0, 1, "∀人∃HEYA", "ekawayeh", "heyawake"], - balance: [0, 0, "Balance Loop", "Balance Loop"], + amibo: [0, 0, "あみぼー", "Amibo", mod_amibo], + angleloop: [0, 0, "鋭直鈍ループ", "Angle Loop", mod_kouchoku], + aquarium: [0, 0, "アクアプレース", "Aquarium", mod_aquarium], + araf: [0, 0, "相ダ部屋", "Araf", mod_araf], + armyants: [0, 0, "ぐんたいあり", "Army Ants", mod_kaero], + arukone: [0, 0, "アルコネ", "Arukone", mod_numlin], + ayeheya: [0, 1, "∀人∃HEYA", "ekawayeh", mod_heyawake], + balance: [0, 0, "Balance Loop", "Balance Loop", mod_balance], cave: [ 1, 0, "バッグ", "Cave", - "kurodoko", + mod_kurodoko, { alias: "bag", alias2: "corral", alias3: "correl" } ], - barns: [1, 0, "バーンズ", "Barns"], - bdblock: [1, 0, "ボーダーブロック", "Border Block"], - bonsan: [1, 0, "ぼんさん", "Bonsan", "bonsan"], - bosanowa: [1, 0, "ボサノワ", "Bosanowa", "", { alias: "bossanova" }], - box: [0, 0, "ボックス", "Box"], + barns: [1, 0, "バーンズ", "Barns", mod_barns], + bdblock: [1, 0, "ボーダーブロック", "Border Block", mod_bdblock], + bonsan: [1, 0, "ぼんさん", "Bonsan", "bonsan", mod_bonsan], + bosanowa: [1, 0, "ボサノワ", "Bosanowa", mod_bosanowa, { alias: "bossanova" }], + box: [0, 0, "ボックス", "Box", mod_box], skyscrapers: [ 0, 0, @@ -120,201 +216,201 @@ import mod_shikaku from "../variety/shikaku.js"; mod_skyscrapers, { alias: "building", alias2: "skyscraper" } ], - castle: [0, 0, "Castle Wall", "Castle Wall"], - cbblock: [0, 0, "コンビブロック", "Combi Block"], - chocona: [0, 0, "チョコナ", "Chocona", "shimaguni"], - cojun: [0, 0, "コージュン", "Cojun", "ripple"], - compass: [0, 0, "Compass", "Compass", "compass"], - country: [1, 0, "カントリーロード", "Country Road"], - creek: [1, 0, "クリーク", "Creek"], - curvedata: [0, 0, "カーブデータ", "Curve Data"], - "curvedata-aux": [0, 0, "図形の編集", "Edit shape"], - dbchoco: [0, 0, "ダブルチョコ", "Double Choco", "cbblock"], - doppelblock: [0, 0, "Doppelblock", "Doppelblock", "doppelblock"], - dosufuwa: [0, 0, "ドッスンフワリ", "Dosun-Fuwari"], - doubleback: [0, 0, "引き返す", "Double Back", "country"], - easyasabc: [0, 0, "ABCプレース", "Easy as ABC"], - factors: [0, 0, "因子の部屋", "Rooms of Factors"], - fillmat: [1, 0, "フィルマット", "Fillmat", "fillmat"], + castle: [0, 0, "Castle Wall", "Castle Wall", mod_castle], + cbblock: [0, 0, "コンビブロック", "Combi Block", mod_cbblock], + chocona: [0, 0, "チョコナ", "Chocona", mod_shimaguni], + cojun: [0, 0, "コージュン", "Cojun", mod_ripple], + compass: [0, 0, "Compass", "Compass", mod_compass], + country: [1, 0, "カントリーロード", "Country Road", mod_country], + creek: [1, 0, "クリーク", "Creek", mod_creek], + curvedata: [0, 0, "カーブデータ", "Curve Data", mod_curvedata], + "curvedata-aux": [0, 0, "図形の編集", "Edit shape", mod_curvedata], + dbchoco: [0, 0, "ダブルチョコ", "Double Choco", mod_cbblock], + doppelblock: [0, 0, "Doppelblock", "Doppelblock", mod_doppelblock], + dosufuwa: [0, 0, "ドッスンフワリ", "Dosun-Fuwari", mod_dosufuwa], + doubleback: [0, 0, "引き返す", "Double Back", mod_country], + easyasabc: [0, 0, "ABCプレース", "Easy as ABC", mod_easyasabc], + factors: [0, 0, "因子の部屋", "Rooms of Factors", mod_factors], + fillmat: [1, 0, "フィルマット", "Fillmat", mod_fillmat], fillomino: [ 0, 1, "フィルオミノ", "Fillomino", - "", + mod_fillomino, { kanpen2: "fillomino01" } ], - firefly: [1, 0, "ホタルビーム", "Hotaru Beam"], - fivecells: [0, 0, "ファイブセルズ", "FiveCells", "nawabari"], - fourcells: [0, 0, "フォーセルズ", "FourCells", "nawabari"], - geradeweg: [0, 0, "グラーデヴェグ", "Geradeweg"], - goishi: [0, 1, "碁石ひろい", "Goishi"], - gokigen: [1, 0, "ごきげんななめ", "Slant", "gokigen"], - hakoiri: [1, 0, "はこいり○△□", "Hokoiri-masashi"], - hanare: [0, 0, "はなれ組", "Hanare-gumi", "hanare"], + firefly: [1, 0, "ホタルビーム", "Hotaru Beam", mod_firefly], + fivecells: [0, 0, "ファイブセルズ", "FiveCells", mod_nawabari], + fourcells: [0, 0, "フォーセルズ", "FourCells", mod_nawabari], + geradeweg: [0, 0, "グラーデヴェグ", "Geradeweg", mod_geradeweg], + goishi: [0, 1, "碁石ひろい", "Goishi", mod_goishi], + gokigen: [1, 0, "ごきげんななめ", "Slant", mod_gokigen], + hakoiri: [1, 0, "はこいり○△□", "Hokoiri-masashi", mod_hakoiri], + hanare: [0, 0, "はなれ組", "Hanare-gumi", mod_hanare], hashikake: [ 0, 1, "橋をかけろ", "Hashiwokakero", - "", + mod_hashikake, { pzprurl: "hashi", kanpen: "hashi", alias: "bridges" } ], - hebi: [1, 0, "へびいちご", "Hebi-Ichigo", "", { old: "snakes" }], - herugolf: [0, 0, "ヘルゴルフ", "Herugolf"], - heteromino: [0, 0, "ヘテロミノ", "Heteromino", "nawabari"], - heyabon: [1, 0, "へやぼん", "Heya-Bon", "bonsan"], + hebi: [1, 0, "へびいちご", "Hebi-Ichigo", mod_hebi, { old: "snakes" }], + herugolf: [0, 0, "ヘルゴルフ", "Herugolf", mod_herugolf], + heteromino: [0, 0, "ヘテロミノ", "Heteromino", mod_nawabari], + heyabon: [1, 0, "へやぼん", "Heya-Bon", mod_bonsan], heyawake: [ 0, 1, "へやわけ", "Heyawake", - "heyawake", + mod_heyawake, { alias: "heyawacky" } ], - hitori: [0, 1, "ひとりにしてくれ", "Hitori"], - icebarn: [1, 0, "アイスバーン", "Icebarn", "icebarn"], - icelom: [0, 0, "アイスローム", "Icelom", "icebarn"], - icelom2: [0, 0, "アイスローム2", "Icelom2", "icebarn"], - ichimaga: [0, 0, "イチマガ", "Ichimaga", "ichimaga"], - ichimagam: [0, 0, "磁石イチマガ", "Magnetic Ichimaga", "ichimaga"], + hitori: [0, 1, "ひとりにしてくれ", "Hitori", mod_hitori], + icebarn: [1, 0, "アイスバーン", "Icebarn", mod_icebarn], + icelom: [0, 0, "アイスローム", "Icelom", mod_icebarn], + icelom2: [0, 0, "アイスローム2", "Icelom2", mod_icebarn], + ichimaga: [0, 0, "イチマガ", "Ichimaga", mod_ichimaga], + ichimagam: [0, 0, "磁石イチマガ", "Magnetic Ichimaga", mod_ichimaga], ichimagax: [ 0, 0, "一回曲がって交差もするの", "Crossing Ichimaga", - "ichimaga" + mod_ichimaga ], - juosan: [0, 0, "縦横さん", "Juosan"], - kaero: [1, 0, "お家に帰ろう", "Return Home"], - kakuro: [0, 1, "カックロ", "Kakuro"], - kakuru: [0, 0, "カックル", "Kakuru"], - kazunori: [0, 0, "かずのりのへや", "Kazunori Room"], - kinkonkan: [1, 0, "キンコンカン", "Kin-Kon-Kan"], - kouchoku: [0, 0, "交差は直角に限る", "Kouchoku"], - kramma: [0, 0, "快刀乱麻", "KaitoRamma", "kramma"], - kramman: [0, 0, "新・快刀乱麻", "New KaitoRamma", "kramma"], - kropki: [0, 0, "Kropki", "Kropki", "minarism"], - kurochute: [0, 1, "クロシュート", "Kurochute"], - kurodoko: [0, 1, "黒どこ(黒マスはどこだ)", "Kurodoko"], - kurotto: [0, 0, "クロット", "Kurotto"], - kusabi: [0, 0, "クサビリンク", "Kusabi"], + juosan: [0, 0, "縦横さん", "Juosan", mod_juosan], + kaero: [1, 0, "お家に帰ろう", "Return Home", mod_kaero], + kakuro: [0, 1, "カックロ", "Kakuro", mod_kakuro], + kakuru: [0, 0, "カックル", "Kakuru", mod_kakuru], + kazunori: [0, 0, "かずのりのへや", "Kazunori Room", mod_kazunori], + kinkonkan: [1, 0, "キンコンカン", "Kin-Kon-Kan", mod_kinkonkan], + kouchoku: [0, 0, "交差は直角に限る", "Kouchoku", mod_kouchoku], + kramma: [0, 0, "快刀乱麻", "KaitoRamma", mod_kramma], + kramman: [0, 0, "新・快刀乱麻", "New KaitoRamma", mod_kramma], + kropki: [0, 0, "Kropki", "Kropki", mod_minarism], + kurochute: [0, 1, "クロシュート", "Kurochute", mod_kurochute], + kurodoko: [0, 1, "黒どこ(黒マスはどこだ)", "Kurodoko", mod_kurodoko], + kurotto: [0, 0, "クロット", "Kurotto", mod_kurotto], + kusabi: [0, 0, "クサビリンク", "Kusabi", mod_kusabi], lightup: [ 0, 1, "美術館", "Akari", - "", + mod_lightup, { pzprurl: "akari", kanpen: "bijutsukan" } ], - lits: [1, 1, "LITS", "LITS", "lits"], - lookair: [0, 0, "るっくえあ", "Look-Air"], - loopsp: [1, 0, "環状線スペシャル", "Loop Special", "pipelink"], - loute: [0, 0, "エルート", "L-route"], - makaro: [0, 0, "マカロ", "Makaro"], - mashu: [0, 1, "ましゅ", "Masyu", "", { kanpen: "masyu", alias: "pearl" }], - maxi: [0, 0, "Maxi Loop", "Maxi Loop", "country"], - meander: [0, 0, "にょろにょろナンバー", "Meandering Numbers", "ripple"], - mejilink: [0, 0, "メジリンク", "Mejilink"], - minarism: [1, 0, "マイナリズム", "Minarism"], - midloop: [0, 0, "ミッドループ", "Mid-loop"], - mochikoro: [1, 0, "モチコロ", "Mochikoro", "nurikabe"], - mochinyoro: [1, 0, "モチにょろ", "Mochinyoro", "nurikabe"], - moonsun: [0, 0, "月か太陽", "Moon or Sun", "country"], - nagare: [0, 0, "流れるループ", "Nagareru-Loop"], - nagenawa: [0, 0, "なげなわ", "Nagenawa", "nagenawa"], - nanro: [0, 1, "ナンロー", "Nanro"], - nawabari: [1, 0, "なわばり", "Territory", "nawabari"], - nondango: [0, 0, "ノンダンゴ", "Nondango"], - norinori: [0, 1, "のりのり", "Norinori", "lits"], + lits: [1, 1, "LITS", "LITS", mod_lits], + lookair: [0, 0, "るっくえあ", "Look-Air", mod_lookair], + loopsp: [1, 0, "環状線スペシャル", "Loop Special", mod_pipelink], + loute: [0, 0, "エルート", "L-route", mod_loute], + makaro: [0, 0, "マカロ", "Makaro", mod_makaro], + mashu: [0, 1, "ましゅ", "Masyu", mod_mashu, { kanpen: "masyu", alias: "pearl" }], + maxi: [0, 0, "Maxi Loop", "Maxi Loop", mod_country], + meander: [0, 0, "にょろにょろナンバー", "Meandering Numbers", mod_ripple], + mejilink: [0, 0, "メジリンク", "Mejilink", mod_mejilink], + minarism: [1, 0, "マイナリズム", "Minarism", mod_minarism], + midloop: [0, 0, "ミッドループ", "Mid-loop", mod_midloop], + mochikoro: [1, 0, "モチコロ", "Mochikoro", mod_nurikabe], + mochinyoro: [1, 0, "モチにょろ", "Mochinyoro", mod_nurikabe], + moonsun: [0, 0, "月か太陽", "Moon or Sun", mod_country], + nagare: [0, 0, "流れるループ", "Nagareru-Loop", mod_nagare], + nagenawa: [0, 0, "なげなわ", "Nagenawa", mod_nagenawa], + nanro: [0, 1, "ナンロー", "Nanro", mod_nanro], + nawabari: [1, 0, "なわばり", "Territory", mod_nawabari], + nondango: [0, 0, "ノンダンゴ", "Nondango", mod_nondango], + norinori: [0, 1, "のりのり", "Norinori", mod_lits], numlin: [ 0, 1, "ナンバーリンク", "Numberlink", - "", + mod_numlin, { kanpen: "numberlink" } ], - nuribou: [1, 0, "ぬりぼう", "Nuribou", "nurikabe"], - nurikabe: [0, 1, "ぬりかべ", "Nurikabe", "nurikabe"], - nurimaze: [0, 0, "ぬりめいず", "Nuri-Maze", "nurimaze"], - nurimisaki: [0, 0, "ぬりみさき", "Nurimisaki", "kurodoko"], - onsen: [0, 0, "温泉めぐり", "Onsen-meguri", "country"], - paintarea: [1, 0, "ペイントエリア", "Paintarea"], - pencils: [0, 0, "ペンシルズ", "Pencils"], - pipelink: [1, 0, "パイプリンク", "Pipelink", "pipelink"], + nuribou: [1, 0, "ぬりぼう", "Nuribou", mod_nurikabe], + nurikabe: [0, 1, "ぬりかべ", "Nurikabe", mod_nurikabe], + nurimaze: [0, 0, "ぬりめいず", "Nuri-Maze", mod_nurimaze], + nurimisaki: [0, 0, "ぬりみさき", "Nurimisaki", mod_kurodoko], + onsen: [0, 0, "温泉めぐり", "Onsen-meguri", mod_country], + paintarea: [1, 0, "ペイントエリア", "Paintarea", mod_paintarea], + pencils: [0, 0, "ペンシルズ", "Pencils", mod_pencils], + pipelink: [1, 0, "パイプリンク", "Pipelink", mod_pipelink], pipelinkr: [ 1, 0, "帰ってきたパイプリンク", "Pipelink Returns", - "pipelink" + mod_pipelink ], - rectslider: [0, 0, "四角スライダー", "Rectangle-Slider", "bonsan"], - reflect: [1, 0, "リフレクトリンク", "Reflect Link"], - renban: [0, 0, "連番窓口", "Renban-Madoguchi"], - ringring: [0, 0, "リングリング", "Ring-ring", "nagenawa"], + rectslider: [0, 0, "四角スライダー", "Rectangle-Slider", mod_bonsan], + reflect: [1, 0, "リフレクトリンク", "Reflect Link", mod_reflect], + renban: [0, 0, "連番窓口", "Renban-Madoguchi", mod_renban], + ringring: [0, 0, "リングリング", "Ring-ring", mod_nagenawa], ripple: [ 0, 1, "波及効果", "Ripple Effect", - "ripple", + mod_ripple, { kanpen: "hakyukoka" } ], - roma: [0, 0, "ろーま", "Roma", "", { alias: "rome" }], - sashigane: [0, 0, "さしがね", "Sashigane", "loute"], + roma: [0, 0, "ろーま", "Roma", mod_roma, { alias: "rome" }], + sashigane: [0, 0, "さしがね", "Sashigane", mod_loute], satogaeri: [ 0, 1, "さとがえり", "Satogaeri", - "bonsan", + mod_bonsan, { alias: "sato", kanpen: "satogaeri" } ], - scrin: [0, 0, "スクリン", "Scrin"], - shakashaka: [0, 1, "シャカシャカ", "Shakashaka"], + scrin: [0, 0, "スクリン", "Scrin", mod_scrin], + shakashaka: [0, 1, "シャカシャカ", "Shakashaka", mod_shakashaka], shikaku: [0, 1, "四角に切れ", "Shikaku", mod_shikaku], - shimaguni: [1, 0, "島国", "Islands", "shimaguni"], - shugaku: [1, 0, "修学旅行の夜", "School Trip"], - shwolf: [0, 0, "ヤギとオオカミ", "Goats and Wolves", "kramma"], - simpleloop: [0, 0, "Simple Loop", "Simple Loop", "country"], - slalom: [1, 1, "スラローム", "Slalom", "", { alias: "suraromu" }], + shimaguni: [1, 0, "島国", "Islands", mod_shimaguni], + shugaku: [1, 0, "修学旅行の夜", "School Trip", mod_shugaku], + shwolf: [0, 0, "ヤギとオオカミ", "Goats and Wolves", mod_kramma], + simpleloop: [0, 0, "Simple Loop", "Simple Loop", mod_country], + slalom: [1, 1, "スラローム", "Slalom", mod_slalom, { alias: "suraromu" }], slither: [ 0, 1, "スリザーリンク", "Slitherlink", - "", + mod_slither, { kanpen: "slitherlink" } ], - starbattle: [0, 0, "スターバトル", "Star Battle"], - stostone: [0, 0, "ストストーン", "Stostone", "shimaguni"], - sudoku: [0, 1, "数独", "Sudoku"], - sukoro: [1, 0, "数コロ", "Sukoro", "sukoro"], - sukororoom: [0, 0, "数コロ部屋", "Sukoro-room", "sukoro"], - tapa: [0, 0, "Tapa", "Tapa"], - tasquare: [0, 0, "たすくえあ", "Tasquare"], - tatamibari: [1, 0, "タタミバリ", "Tatamibari"], - tateyoko: [1, 0, "タテボーヨコボー", "Tatebo-Yokobo"], - tawa: [0, 0, "たわむれんが", "Tawamurenga"], - tentaisho: [0, 0, "天体ショー", "Tentaisho"], - tilepaint: [1, 0, "タイルペイント", "Tilepaint"], - toichika: [0, 0, "遠い誓い", "Toichika"], - triplace: [0, 0, "トリプレイス", "Tri-place"], - usotatami: [0, 0, "ウソタタミ", "Uso-tatami", "fillmat"], - usoone: [0, 0, "ウソワン", "Uso-one"], - view: [1, 0, "ヴィウ", "View", "sukoro"], - wagiri: [0, 0, "ごきげんななめ・輪切", "Wagiri", "gokigen"], - walllogic: [0, 0, "ウォールロジック", "Wall Logic"], - wblink: [0, 0, "シロクロリンク", "Shirokuro-link"], - yajikazu: [1, 0, "やじさんかずさん", "Yajisan-Kazusan"], + starbattle: [0, 0, "スターバトル", "Star Battle", mod_starbattle], + stostone: [0, 0, "ストストーン", "Stostone", mod_shimaguni], + sudoku: [0, 1, "数独", "Sudoku", mod_sudoku], + sukoro: [1, 0, "数コロ", "Sukoro", mod_sukoro], + sukororoom: [0, 0, "数コロ部屋", "Sukoro-room", mod_sukoro], + tapa: [0, 0, "Tapa", "Tapa", mod_tapa], + tasquare: [0, 0, "たすくえあ", "Tasquare", mod_tasquare], + tatamibari: [1, 0, "タタミバリ", "Tatamibari", mod_tatamibari], + tateyoko: [1, 0, "タテボーヨコボー", "Tatebo-Yokobo", mod_tateyoko], + tawa: [0, 0, "たわむれんが", "Tawamurenga", mod_tawa], + tentaisho: [0, 0, "天体ショー", "Tentaisho", mod_tentaisho], + tilepaint: [1, 0, "タイルペイント", "Tilepaint", mod_tilepaint], + toichika: [0, 0, "遠い誓い", "Toichika", mod_toichika], + triplace: [0, 0, "トリプレイス", "Tri-place", mod_triplace], + usotatami: [0, 0, "ウソタタミ", "Uso-tatami", mod_fillmat], + usoone: [0, 0, "ウソワン", "Uso-one", mod_usoone], + view: [1, 0, "ヴィウ", "View", mod_sukoro], + wagiri: [0, 0, "ごきげんななめ・輪切", "Wagiri", mod_gokigen], + walllogic: [0, 0, "ウォールロジック", "Wall Logic", mod_walllogic], + wblink: [0, 0, "シロクロリンク", "Shirokuro-link", mod_wblink], + yajikazu: [1, 0, "やじさんかずさん", "Yajisan-Kazusan", mod_yajikazu], yajilin: [ 0, 1, "ヤジリン", "Yajilin", - "", + mod_yajilin, { pzprurl: "yajilin", kanpen: "yajilin", alias: "yajirin" } ], "yajilin-regions": [ @@ -322,12 +418,12 @@ import mod_shikaku from "../variety/shikaku.js"; 0, "ヤジリン", "Regional Yajilin", - "yajilin", + mod_yajilin, { alias: "yajirin-regions" } ], - yajitatami: [0, 0, "ヤジタタミ", "Yajitatami"], - yinyang: [0, 0, "しろまるくろまる", "Yin-Yang"], - yosenabe: [0, 0, "よせなべ", "Yosenabe"] + yajitatami: [0, 0, "ヤジタタミ", "Yajitatami", mod_yajitatami], + yinyang: [0, 0, "しろまるくろまる", "Yin-Yang", mod_yinyang], + yosenabe: [0, 0, "よせなべ", "Yosenabe", mod_yosenabe] } ); diff --git a/src/variety/kramma.js b/src/variety/kramma.js index 7e20947ea..77989bdbe 100644 --- a/src/variety/kramma.js +++ b/src/variety/kramma.js @@ -1,6 +1,7 @@ // // パズル固有スクリプト部 快刀乱麻・新・快刀乱麻・ヤギとオオカミ版 kramma.js // +import Candle from 'pzpr-canvas'; var pidlist = ["kramma", "kramman", "shwolf"]; var classbase = { //--------------------------------------------------------- @@ -482,8 +483,8 @@ var classbase = { puzzle.painter.paintAll(); }; } else { - this.image_canvas = !!puzzle.pzpr.Candle.Canvas - ? new puzzle.pzpr.Candle.Canvas.Image() + this.image_canvas = !!Candle.Canvas + ? new Candle.Canvas.Image() : {}; this.image_svg = {}; } diff --git a/test/pzpr/parser_test.js b/test/pzpr/parser_test.js index 79408024c..b5c805490 100644 --- a/test/pzpr/parser_test.js +++ b/test/pzpr/parser_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/aho_test.js b/test/variety/aho_test.js index 3636fdc91..da4817cba 100644 --- a/test/variety/aho_test.js +++ b/test/variety/aho_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/amibo_test.js b/test/variety/amibo_test.js index 6888c816e..62ea8f9a8 100644 --- a/test/variety/amibo_test.js +++ b/test/variety/amibo_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/ayeheya_test.js b/test/variety/ayeheya_test.js index 54fe51330..5457c345b 100644 --- a/test/variety/ayeheya_test.js +++ b/test/variety/ayeheya_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/cbblock_test.js b/test/variety/cbblock_test.js index 7f03b05bc..a0ec38c1d 100644 --- a/test/variety/cbblock_test.js +++ b/test/variety/cbblock_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/curvedata_test.js b/test/variety/curvedata_test.js index cf809d7b4..155b778e1 100644 --- a/test/variety/curvedata_test.js +++ b/test/variety/curvedata_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/fivecells_test.js b/test/variety/fivecells_test.js index 4e03c2fa6..3d780e4a6 100644 --- a/test/variety/fivecells_test.js +++ b/test/variety/fivecells_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/gokigen_test.js b/test/variety/gokigen_test.js index e1adc1142..18dd1c894 100644 --- a/test/variety/gokigen_test.js +++ b/test/variety/gokigen_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/herugolf_test.js b/test/variety/herugolf_test.js index fca2b5069..d3c851f21 100644 --- a/test/variety/herugolf_test.js +++ b/test/variety/herugolf_test.js @@ -1,6 +1,6 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/lits_test.js b/test/variety/lits_test.js index 107df18b6..b117216ed 100644 --- a/test/variety/lits_test.js +++ b/test/variety/lits_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/onsen_test.js b/test/variety/onsen_test.js index b063da972..8cb2430e4 100644 --- a/test/variety/onsen_test.js +++ b/test/variety/onsen_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/pipelink_test.js b/test/variety/pipelink_test.js index 5b04aff5c..a166ee658 100644 --- a/test/variety/pipelink_test.js +++ b/test/variety/pipelink_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/ringring_test.js b/test/variety/ringring_test.js index d0654a994..f0e7be92e 100644 --- a/test/variety/ringring_test.js +++ b/test/variety/ringring_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/slalom_test.js b/test/variety/slalom_test.js index 61fe8e00b..8dd579b4f 100644 --- a/test/variety/slalom_test.js +++ b/test/variety/slalom_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/tapa_test.js b/test/variety/tapa_test.js index d61340272..78c430450 100644 --- a/test/variety/tapa_test.js +++ b/test/variety/tapa_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/tentaisho_test.js b/test/variety/tentaisho_test.js index 46550fde5..6f9e54971 100644 --- a/test/variety/tentaisho_test.js +++ b/test/variety/tentaisho_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); diff --git a/test/variety/yajilin_test.js b/test/variety/yajilin_test.js index 765e93ead..dc7015417 100644 --- a/test/variety/yajilin_test.js +++ b/test/variety/yajilin_test.js @@ -2,7 +2,7 @@ var assert = require("assert"); -var pzpr = require("../../"); +import pzpr from "../../src/pzpr.js"; var puzzle = new pzpr.Puzzle(); From 65ce39bb81c04ec4938a5d2f4cd5d3f24f14d6c6 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 15:33:21 +0200 Subject: [PATCH 18/27] fix some tests --- src/variety/pipelink.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/variety/pipelink.js b/src/variety/pipelink.js index bb7926000..f4ae145d3 100644 --- a/src/variety/pipelink.js +++ b/src/variety/pipelink.js @@ -1,6 +1,8 @@ // // パズル固有スクリプト部 パイプリンク・帰ってきたパイプリンク・環状線スペシャル版 pipelink.js // +import Parser from "../pzpr/parser.js"; +import { lang } from "../pzpr/env.js"; var pidlist = ["pipelink", "pipelinkr", "loopsp"]; var classbase = { //--------------------------------------------------------- @@ -404,7 +406,7 @@ var classbase = { this.outbstr = bstr.substr(i); }, encodePipelink: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var count, cm = "", bd = this.board; @@ -611,10 +613,10 @@ var classbase = { } }, "CheckInfo@pipelinkr": { - text: function(lang) { + text: function(l_lang) { var puzzle = this.puzzle, texts = []; - var langcode = (lang || this.puzzle.pzpr.lang) === "ja" ? 0 : 1; + var langcode = (l_lang || lang) === "ja" ? 0 : 1; if (this.length === 0) { return puzzle.faillist.complete[langcode]; } From dcada78a705e6ffa8e3e5fe3cef4a150c4fc167d Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 16:30:38 +0200 Subject: [PATCH 19/27] fix references --- src/puzzle/FileData.js | 1 + src/puzzle/Puzzle.js | 1 + src/pzpr.js | 1 + src/pzpr/classmgr.js | 2 +- src/pzpr/globals.js | 8 ++++++++ src/pzpr/parser.js | 1 + src/variety/creek.js | 5 ++++- src/variety/gokigen.js | 5 ++++- src/variety/icebarn.js | 7 +++++-- src/variety/lits.js | 7 +++++-- src/variety/minarism.js | 7 +++++-- src/variety/slalom.js | 5 ++++- 12 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 src/pzpr/globals.js diff --git a/src/puzzle/FileData.js b/src/puzzle/FileData.js index fde462eeb..fc344b511 100644 --- a/src/puzzle/FileData.js +++ b/src/puzzle/FileData.js @@ -1,6 +1,7 @@ // FileData.js import { classmgr } from '../pzpr/classmgr.js'; +import { DOMParser, XMLSerializer } from '../pzpr/globals.js'; import Parser from '../pzpr/parser.js'; function throwNoImplementation() { diff --git a/src/puzzle/Puzzle.js b/src/puzzle/Puzzle.js index 34f884195..7c60c4170 100644 --- a/src/puzzle/Puzzle.js +++ b/src/puzzle/Puzzle.js @@ -5,6 +5,7 @@ import MetaData from "../pzpr/metadata.js"; import { classmgr } from "../pzpr/classmgr.js"; import util from "../pzpr/util.js"; import parser from "../pzpr/parser.js"; +import { document } from "../pzpr/globals.js"; //--------------------------------------------------------------------------- // ★Puzzleクラス ぱずぷれv3のベース処理やその他の処理を行う diff --git a/src/pzpr.js b/src/pzpr.js index 351915242..df9541db8 100644 --- a/src/pzpr.js +++ b/src/pzpr.js @@ -3,6 +3,7 @@ export default pzpr; import Candle from 'pzpr-canvas'; pzpr.Candle = Candle; + import {env, lang} from "./pzpr/env.js"; pzpr.env = env; import './pzpr/event.js'; diff --git a/src/pzpr/classmgr.js b/src/pzpr/classmgr.js index 63079ec3b..f5334a0d4 100644 --- a/src/pzpr/classmgr.js +++ b/src/pzpr/classmgr.js @@ -167,7 +167,7 @@ var classmgr = { if (!custom[newpid]) { /* Customファイルが読み込みできるまで待つ */ setTimeout(function() { - pzpr.classmgr.setPuzzleClass(puzzle, newpid, callback); + classmgr.setPuzzleClass(puzzle, newpid, callback); }, 10); return; } diff --git a/src/pzpr/globals.js b/src/pzpr/globals.js new file mode 100644 index 000000000..ce0265c1d --- /dev/null +++ b/src/pzpr/globals.js @@ -0,0 +1,8 @@ +import Candle from 'pzpr-canvas'; + +var document = this.document || Candle.document; +var DOMParser = this.DOMParser || Candle.DOMParser; +var XMLSerializer = this.XMLSerializer || Candle.XMLSerializer; + + +export {document, DOMParser, XMLSerializer}; diff --git a/src/pzpr/parser.js b/src/pzpr/parser.js index c3d28dced..a69cd0c45 100644 --- a/src/pzpr/parser.js +++ b/src/pzpr/parser.js @@ -1,6 +1,7 @@ // Parser.js v3.4.1 import MetaData from "./metadata.js"; +import { DOMParser, XMLSerializer } from "./globals.js"; import variety from "./variety.js"; import { env } from "./env.js"; diff --git a/src/variety/creek.js b/src/variety/creek.js index 66eb8d65c..ee861923d 100644 --- a/src/variety/creek.js +++ b/src/variety/creek.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 クリーク版 creek.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["creek"]; var classbase = { //--------------------------------------------------------- @@ -84,7 +87,7 @@ var classbase = { // URLエンコード/デコード処理 Encode: { decodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var oldflag = (type === parser.URL_PZPRV3 && this.checkpflag("d")) || (type === parser.URL_PZPRAPP && !this.checkpflag("c")); diff --git a/src/variety/gokigen.js b/src/variety/gokigen.js index fbed49626..48d321448 100644 --- a/src/variety/gokigen.js +++ b/src/variety/gokigen.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 ごきげんななめ、ごきげんななめ・輪切版 gokigen.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["gokigen", "wagiri"]; var classbase = { //--------------------------------------------------------- @@ -414,7 +417,7 @@ var classbase = { // URLエンコード/デコード処理 "Encode@gokigen": { decodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var oldflag = (type === parser.URL_PZPRAPP && !this.checkpflag("c")) || (type === parser.URL_PZPRV3 && this.checkpflag("d")); diff --git a/src/variety/icebarn.js b/src/variety/icebarn.js index c01cdc488..86adbfe39 100644 --- a/src/variety/icebarn.js +++ b/src/variety/icebarn.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 アイスバーン・アイスローム・アイスローム2版 icebarn.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["icebarn", "icelom", "icelom2"]; var classbase = { //--------------------------------------------------------- @@ -866,7 +869,7 @@ var classbase = { // URLエンコード/デコード処理 "Encode@icebarn": { decodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var urlver = type === parser.URL_PZPRV3 ? 3 : this.checkpflag("c") ? 2 : 1; @@ -892,7 +895,7 @@ var classbase = { this.decodeInOut(); }, encodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var urlver = type === parser.URL_PZPRV3 ? 3 : 1; if (urlver === 3) { diff --git a/src/variety/lits.js b/src/variety/lits.js index fe05a3549..367f962f9 100644 --- a/src/variety/lits.js +++ b/src/variety/lits.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 LITS・のりのり版 lits.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["lits", "norinori"]; var classbase = { //--------------------------------------------------------- @@ -208,7 +211,7 @@ var classbase = { // URLエンコード/デコード処理 Encode: { decodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var oldflag = (type === parser.URL_PZPRV3 && this.checkpflag("d")) || (type === parser.URL_PZPRAPP && !this.checkpflag("c")); @@ -219,7 +222,7 @@ var classbase = { } }, encodePzpr: function(type) { - if (type === this.puzzle.pzpr.parser.URL_PZPRAPP && this.pid === "lits") { + if (type === Parser.URL_PZPRAPP && this.pid === "lits") { this.outpflag = "c"; } this.encodeBorder(); diff --git a/src/variety/minarism.js b/src/variety/minarism.js index 0e0e3dacd..e9fa27782 100644 --- a/src/variety/minarism.js +++ b/src/variety/minarism.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 マイナリズム・Kropki版 minarism.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["minarism", "kropki"]; var classbase = { //--------------------------------------------------------- @@ -502,7 +505,7 @@ var classbase = { decodeMinarism: function(type) { // 盤面外数字のデコード - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var id = 0, a = 0, mgn = 0, @@ -557,7 +560,7 @@ var classbase = { this.outbstr = bstr.substr(a); }, encodeMinarism: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; var cm = "", count = 0, bd = this.board; diff --git a/src/variety/slalom.js b/src/variety/slalom.js index 4c394e8ba..6ae56c18a 100644 --- a/src/variety/slalom.js +++ b/src/variety/slalom.js @@ -1,6 +1,9 @@ // // パズル固有スクリプト部 スラローム版 slalom.js // + +import Parser from "../pzpr/parser.js"; + var pidlist = ["slalom"]; var classbase = { //--------------------------------------------------------- @@ -774,7 +777,7 @@ var classbase = { this.decodeSlalom(urlver); }, encodePzpr: function(type) { - var parser = this.puzzle.pzpr.parser; + var parser = Parser; if (type === parser.URL_PZPRV3) { this.outpflag = "d"; } From c0158cbd6c9e6d124a01494b1986beb480129be5 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:03:23 +0200 Subject: [PATCH 20/27] fix all "strict" errors These objects are sometimes "frozen", which raises an error in strict mode: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Read-only --- src/puzzle/Piece.js | 8 ++++++-- src/puzzle/PieceList.js | 4 +++- src/variety/bonsan.js | 4 +++- src/variety/herugolf.js | 4 +++- src/variety/yajilin.js | 4 +++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/puzzle/Piece.js b/src/puzzle/Piece.js index ce0683141..3b5c010c6 100644 --- a/src/puzzle/Piece.js +++ b/src/puzzle/Piece.js @@ -160,7 +160,9 @@ classmgr.makeCommon({ } this.addOpe(prop, this[prop], num); - this[prop] = num; + if (! Object.isFrozen(this)) { + this[prop] = num; + } var trialstage = this.board.trialstage; if (trialstage > 0) { @@ -294,7 +296,9 @@ classmgr.makeCommon({ //--------------------------------------------------------------------------- seterr: function(num) { if (this.board.isenableSetError()) { - this.error = num; + if (! Object.isFrozen(this)) { + this.error = num; + } } }, setinfo: function(num) { diff --git a/src/puzzle/PieceList.js b/src/puzzle/PieceList.js index af8d3ac9c..e71868816 100644 --- a/src/puzzle/PieceList.js +++ b/src/puzzle/PieceList.js @@ -103,7 +103,9 @@ classmgr.makeCommon({ return; } for (var i = 0; i < this.length; i++) { - this[i].error = num; + if (! Object.isFrozen(this[i])) { + this[i].error = num; + } } }, setnoerr: function() { diff --git a/src/variety/bonsan.js b/src/variety/bonsan.js index ef91a543a..d0ac21381 100644 --- a/src/variety/bonsan.js +++ b/src/variety/bonsan.js @@ -301,7 +301,9 @@ var classbase = { var cell = component.departure, num = cell.qnum; num = num >= 0 ? num : this.board.cell.length; - cell.distance = num; + if (! Object.isFrozen(cell)) { + cell.distance = num; + } if (cell.lcnt === 0) { return; } diff --git a/src/variety/herugolf.js b/src/variety/herugolf.js index f49df2e8d..6878e9015 100644 --- a/src/variety/herugolf.js +++ b/src/variety/herugolf.js @@ -319,7 +319,9 @@ var classbase = { var cell = component.departure, num = cell.qnum; num = num >= 0 ? num : this.board.cell.length; - cell.distance = ((num + 1) * num) / 2; + if (! Object.isFrozen(cell)) { + cell.distance = ((num + 1) * num) / 2; + } if (cell.lcnt === 0) { return; } diff --git a/src/variety/yajilin.js b/src/variety/yajilin.js index 9ca8e428e..580142a19 100644 --- a/src/variety/yajilin.js +++ b/src/variety/yajilin.js @@ -143,7 +143,9 @@ var classbase = { var adb = this.adjborder; var bs = [adb.top, adb.bottom, adb.left, adb.right]; for (var i = 0; i < bs.length; i++) { - bs[i].line = 0; + if (! Object.isFrozen(bs[i])) { + bs[i].line = 0; + } } } } From 70ae19d129d059126d24df5e40d2daf8ff05a69e Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:19:16 +0200 Subject: [PATCH 21/27] make the weird globals work again --- rollup.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/rollup.config.js b/rollup.config.js index 133fef5af..2c49e06a8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,6 +15,7 @@ export default { "pzpr-canvas": "Candle" } }, + context: "window", plugins: [ production && terser() // minify, but only in production ] From 8b013058cd9eb55da93a7c2dac8699db3a5fd143 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:20:32 +0200 Subject: [PATCH 22/27] disable check-format for now --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 21dd22db7..034df9cb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ node_js: 6 script: - npm run-script build - npm test -- npm run-script check-format +- echo put be back later npm run-script check-format From da5f0ce4052d465af65704b4026bee009427b8c6 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:44:53 +0200 Subject: [PATCH 23/27] go for `make` (tried grunt-rollup, but it was... weird) --- .travis.yml | 5 +++-- package.json | 6 +++--- src/puzzle/FileData.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 034df9cb6..f5739e556 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: 6 script: -- npm run-script build -- npm test +- make build +- make rollup +- make test - echo put be back later npm run-script check-format diff --git a/package.json b/package.json index 514685cef..f3cabd6b1 100644 --- a/package.json +++ b/package.json @@ -39,13 +39,13 @@ "grunt-contrib-uglify": "^2.0.0", "grunt-newer": "^1.1.1", "mocha": "^6.1.4", - "prettier": "^1.19.1" + "prettier": "^1.19.1", + "rollup": "^2.6.0", + "rollup-plugin-terser": "^5.3.0" }, "dependencies": { "esm": "^3.2.25", "pzpr-canvas": "^0.8.2", - "rollup": "^2.6.0", - "rollup-plugin-terser": "^5.3.0", "source-map-support": "^0.5.12" } } diff --git a/src/puzzle/FileData.js b/src/puzzle/FileData.js index fc344b511..9e75f7618 100644 --- a/src/puzzle/FileData.js +++ b/src/puzzle/FileData.js @@ -1,7 +1,7 @@ // FileData.js import { classmgr } from '../pzpr/classmgr.js'; -import { DOMParser, XMLSerializer } from '../pzpr/globals.js'; +import { DOMParser } from '../pzpr/globals.js'; import Parser from '../pzpr/parser.js'; function throwNoImplementation() { From 23a7956d8d8d30b279c90172529d39ded59577da Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:52:46 +0200 Subject: [PATCH 24/27] try with npx --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1e304e54f..353bf7596 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ lint: new: candle rollup rollup: - ./node_modules/.bin/rollup -c + npx rollup -c candle: cp ./node_modules/pzpr-canvas/dist/candle.js ./dist/js/candle.js From 4fbc5aa64f9d1693beda3f8c0cdfebf4d95613e2 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 17:56:42 +0200 Subject: [PATCH 25/27] let's try a node upgrade From 6? That looks ancient. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f5739e556..3fa567cdf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js -node_js: 6 +node_js: 10 script: - make build - make rollup From af69085353a09bc7f9989e5cdad3e035bf51be30 Mon Sep 17 00:00:00 2001 From: Harmen Date: Sun, 12 Apr 2020 18:03:40 +0200 Subject: [PATCH 26/27] update rules.html --- Makefile | 1 + src-ui/rules.html | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 353bf7596..bceffb94c 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,5 @@ rollup: npx rollup -c candle: + mkdir -p ./dist/js/ cp ./node_modules/pzpr-canvas/dist/candle.js ./dist/js/candle.js diff --git a/src-ui/rules.html b/src-ui/rules.html index f10b430a1..ea91443bc 100644 --- a/src-ui/rules.html +++ b/src-ui/rules.html @@ -39,6 +39,7 @@ } +