diff --git a/DeckEditor/Deck.min.js b/DeckEditor/Deck.min.js index a238098..0d8084d 100644 --- a/DeckEditor/Deck.min.js +++ b/DeckEditor/Deck.min.js @@ -1 +1 @@ -"use strict";function callConstructor(e){var r=e.bind.apply(e,arguments);return new r}function applyToConstructor(e,r){var t=concat(null,toArr(r)),n=e.bind.apply(e,t);return new n}function nextTick(e){setTimeout(e,0)}function DeckManager(){this.getDeckNames()}function TextualRule(e,r,t){this.prop=e,this.map=r,this.exact=t}function NumericRule(e,r){this.prop=e,this.keywords=r}function Searcher(){this.rules=[ColorRule,CrossRule,TypeRule,RarityRule,RiseRule,TrapRule,AcceRule,SkillRule,NoBurstRule,TimmingRule,LimitingRule,ClassRule,PowerRule,LevelRule,LimitRule,NumberRule,IllustRule,WxidRule,NameRule]}var concat=Array.prototype.concat.bind([]),toArr=function(e){return e?"string"==typeof e?[]:Array.prototype.slice.call(e,0):[]},isArr=Array.isArray,inArr=function(e,r){return toArr(r).indexOf(e)!=-1},removeFromArr=function(e,r){var t=r.indexOf(e);return!(t<0)&&(r.splice(t,1),!0)},isStr=function(e){return"string"==typeof e},isObj=function(e){return e&&"object"==typeof e&&!isArr(e)},isNum=function(e){return"number"==typeof e},isFunc=function(e){return"function"==typeof e},pEach=function(e,r,t){return e.reduce(function(e,t){return e.then(function(){return r(t)})},Promise.resolve())};DeckManager.prototype.getDeckNames=function(){var e=localStorage.getItem("deck_filenames");return this._deckNames=e?JSON.parse(e):[],this._deckNames},DeckManager.prototype._updateDeckNames=function(){this._deckNames.sort(),localStorage.setItem("deck_filenames",JSON.stringify(this._deckNames))},DeckManager.prototype.createDeck=function(e,r){return!inArr(e,this._deckNames)&&(this._deckNames.push(e),this._updateDeckNames(),this.saveDeck(e,r),!0)},DeckManager.prototype.renameDeck=function(e,r){if(!inArr(e,this._deckNames))return!1;if(inArr(r,this._deckNames))return!1;var t=this.loadDeck(e);return this.deleteDeck(e),this.createDeck(r,t),!0},DeckManager.prototype.deleteDeck=function(e){return!!removeFromArr(e,this._deckNames)&&(this._updateDeckNames(),localStorage.removeItem("deck_file_"+e),!0)},DeckManager.prototype.loadDeck=function(e){var r=localStorage.getItem("deck_file_"+e);return r?JSON.parse(r):null},DeckManager.prototype.saveDeck=function(e,r){return!!inArr(e,this._deckNames)&&(localStorage.setItem("deck_file_"+e,JSON.stringify(r)),!0)},DeckManager.prototype.checkMainDeck=function(e){if(!isArr(e))return!1;if(40!==e.length)return!1;for(var r=[],t=0;t10)return!1;for(var r=[],t=0;t4)return!1;return!0},TextualRule.prototype.parse=function(e){for(var r=[],t=0;tcross<","【cross】","【交错】","【クロス】","[связь]",">크로스<"]};var TimmingRule={};TimmingRule.parse=function(e){for(var r=[],t=0;t=*(\d+)\+?$/),r||(r=e.match(/^(\d+)\+$/)),r){var t=parseInt(r[1]);return[t,1/0]}if(r=e.match(/^<=*(\d+)\-?$/),r||(r=e.match(/^(\d+)\-$/)),r){var t=parseInt(r[1]);return[-(1/0),t]}if(r=e.match(/^(\d+)[\-\~](\d+)$/)){var n=parseInt(r[1]),i=parseInt(r[2]);return[n,i]}return null},NumericRule.prototype.parseWord=function(e){for(var r=0;r=n&&t<=i})}};var PowerRule=new NumericRule("power",["力量","パワー","power","сила","파워"]),LevelRule=new NumericRule("level",["等级","レベル","level","lv.","lv","уровень","livello","레벨"]),LimitRule=new NumericRule("limit",["界限","リミット","limite","limit","ограничение","리미트"]),NumberRule=new NumericRule("",[""]);NumberRule.parse=function(e){for(var r=[],t=0;t=i&&n<=u})}};var IllustRule={};IllustRule.parseWord=function(e){var r=e.match(/illust:?(.+)/);return r||(r=e.match(/画师:?(.+)/)),r||(r=e.match(/畫師:?(.+)/)),r?r[1]:null},IllustRule.parse=function(e){for(var r=[],t=0;t10)return!1;for(var r=[],t=0;t4)return!1;return!0},TextualRule.prototype.parse=function(e){for(var r=[],t=0;tcross<","【cross】","【交错】","【クロス】","[связь]",">크로스<"]};var TimmingRule={};TimmingRule.parse=function(e){for(var r=[],t=0;t=*(\d+)\+?$/),r||(r=e.match(/^(\d+)\+$/)),r){var t=parseInt(r[1]);return[t,1/0]}if(r=e.match(/^<=*(\d+)\-?$/),r||(r=e.match(/^(\d+)\-$/)),r){var t=parseInt(r[1]);return[-(1/0),t]}if(r=e.match(/^(\d+)[\-\~](\d+)$/)){var n=parseInt(r[1]),i=parseInt(r[2]);return[n,i]}return null},NumericRule.prototype.parseWord=function(e){for(var r=0;r=n&&t<=i})}};var PowerRule=new NumericRule("power",["力量","パワー","power","сила","파워"]),LevelRule=new NumericRule("level",["等级","レベル","level","lv.","lv","уровень","livello","레벨"]),LimitRule=new NumericRule("limit",["界限","リミット","limite","limit","ограничение","리미트"]),NumberRule=new NumericRule("",[""]);NumberRule.parse=function(e){for(var r=[],t=0;t=i&&n<=u})}};var IllustRule={};IllustRule.parseWord=function(e){var r=e.match(/illust:?(.+)/);return r||(r=e.match(/画师:?(.+)/)),r||(r=e.match(/畫師:?(.+)/)),r?r[1]:null},IllustRule.parse=function(e){for(var r=[],t=0;t