暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165
  1. var RpgCards;
  2. (function (RpgCards) {
  3. function normalizeTag(tag) {
  4. return tag.trim().toLowerCase();
  5. }
  6. function splitParams(value) {
  7. return value.split("|").map(function (str) {
  8. return str.trim();
  9. });
  10. }
  11. var Options = (function () {
  12. function Options() {
  13. this.foreground_color = "white";
  14. this.background_color = "white";
  15. this.empty_color = "black";
  16. this.default_color = "black";
  17. this.default_icon = "";
  18. this.default_title_size = "13";
  19. this.page_size = "A4";
  20. this.page_rows = 3;
  21. this.page_columns = 3;
  22. this.card_arrangement = "doublesided";
  23. this.card_size = "25x35";
  24. this.card_count = null;
  25. this.icon_inline = true;
  26. }
  27. return Options;
  28. })();
  29. RpgCards.Options = Options;
  30. var Card = (function () {
  31. function Card() {
  32. this.count = 1;
  33. this.title = "New card";
  34. this.title_size = null;
  35. this.title_icon_text = null;
  36. this.color = null;
  37. this.color_front = null;
  38. this.color_back = null;
  39. this.icon = null;
  40. this.icon_front = null;
  41. this.icon_back = null;
  42. this.contents = [];
  43. this.tags = [];
  44. this.userData = null;
  45. }
  46. Card.fromJSON = function (json) {
  47. var result = new Card;
  48. result.count = json.count || 1;
  49. result.title = json.title || "";
  50. result.title_size = json.title_size || null;
  51. result.title_icon_text = json.title_icon_text || null;
  52. result.color = json.color || null;
  53. result.color_front = json.color_front || null;
  54. result.color_back = json.color_back || null;
  55. result.icon = json.icon || null;
  56. result.icon_front = json.icon_front || null;
  57. result.icon_back = json.icon_back || null;
  58. result.contents = json.contents || [];
  59. result.tags = json.tags || [];
  60. return result;
  61. };
  62. Card.prototype.toJSON = function () {
  63. return {
  64. count: this.count,
  65. title: this.title,
  66. title_size: this.title_size,
  67. title_icon_text: this.title_icon_text,
  68. color: this.color,
  69. color_front: this.color_front,
  70. color_back: this.color_back,
  71. icon: this.icon,
  72. icon_front: this.icon_front,
  73. icon_back: this.icon_back,
  74. contents: this.contents.slice(),
  75. tags: this.tags.slice()
  76. };
  77. };
  78. Card.prototype.duplicate = function () {
  79. var result = Card.fromJSON(this.toJSON());
  80. result.title += " (Copy)";
  81. return result;
  82. };
  83. Card.prototype.hasTag = function (tag) {
  84. var index = this.tags.indexOf(normalizeTag(tag));
  85. return index > -1;
  86. };
  87. Card.prototype.addTag = function (tag) {
  88. if (!this.hasTag(tag)) {
  89. this.tags.push(normalizeTag(tag));
  90. }
  91. };
  92. Card.prototype.removeTag = function (tag) {
  93. var ntag = normalizeTag(tag);
  94. this.tags = this.tags.filter(function (t) {
  95. return ntag != t;
  96. });
  97. };
  98. Card.prototype.findTag = function (pattern, flags) {
  99. var f = flags || "g";
  100. var regexp = new RegExp(pattern, f);
  101. var s = this.tags.join("\n");
  102. return regexp.exec(s);
  103. };
  104. Card.prototype.replaceTag = function (pattern, substitution, flags) {
  105. var f = flags || "g";
  106. var regexp = new RegExp(pattern, f);
  107. this.tags = this.tags.map(function (s) { return s.replace(regexp, substitution); });
  108. };
  109. Card.prototype.findContent = function (pattern, flags) {
  110. var f = flags || "g";
  111. var regexp = new RegExp(pattern, f);
  112. var s = this.contents.join("\n");
  113. return regexp.exec(s);
  114. };
  115. Card.prototype.replaceContent = function (pattern, substitution, flags) {
  116. var f = flags || "g";
  117. var regexp = new RegExp(pattern, f);
  118. this.contents = this.contents.map(function (s) { return s.replace(regexp, substitution); });
  119. };
  120. Card.prototype.findTitle = function (pattern, flags) {
  121. var f = flags || "g";
  122. var regexp = new RegExp(pattern, f);
  123. var s = this.title;
  124. return regexp.exec(s);
  125. };
  126. Card.prototype.findTitleAny = function (patterns, flags) {
  127. for (var i = 0; i < patterns.length; ++i) {
  128. var f = flags || "g";
  129. var regexp = new RegExp(patterns[i], f);
  130. var s = this.title;
  131. var result = regexp.exec(s);
  132. if (result) {
  133. return result;
  134. }
  135. }
  136. return null;
  137. };
  138. Card.prototype.getTitle = function (options) {
  139. return this.title || "";
  140. };
  141. Card.prototype.getTitleSize = function (options) {
  142. return this.title_size || options.default_title_size || "13";
  143. };
  144. Card.prototype.getTitleIconText = function (options) {
  145. return this.title_icon_text || "";
  146. };
  147. Card.prototype.getColorFront = function (options) {
  148. return this.color_front || this.color || options.default_color || "black";
  149. };
  150. Card.prototype.getColorBack = function (options) {
  151. return this.color_back || this.color || options.default_color || "black";
  152. };
  153. Card.prototype.getIconFront = function (options) {
  154. return this.icon_front || this.icon || options.default_icon || "";
  155. };
  156. Card.prototype.getIconBack = function (options) {
  157. return this.icon_back || this.icon || options.default_icon || "";
  158. };
  159. return Card;
  160. })();
  161. RpgCards.Card = Card;
  162. ;
  163. var CardDeck = (function () {
  164. function CardDeck() {
  165. this.cards = [];
  166. this._actions = [];
  167. }
  168. CardDeck.prototype.toJSON = function () {
  169. return this.cards.map(function (card) { return card.toJSON(); });
  170. };
  171. CardDeck.fromJSON = function (data) {
  172. if (Array.isArray(data)) {
  173. var result = new CardDeck;
  174. for (var i = 0; i < data.length; ++i) {
  175. result.cards.push(Card.fromJSON(data[i]));
  176. }
  177. return result;
  178. }
  179. else {
  180. throw new Error("Invalid data");
  181. }
  182. };
  183. CardDeck.prototype.addCards = function (cards) {
  184. var _this = this;
  185. cards.forEach(function (card) {
  186. _this._actions.push({ fn: "add", card: card, ref: null });
  187. });
  188. };
  189. CardDeck.prototype.addNewCard = function () {
  190. var newCard = new Card();
  191. this._actions.push({ fn: "add", card: newCard, ref: null });
  192. return newCard;
  193. };
  194. CardDeck.prototype.duplicateCard = function (card) {
  195. var newCard = card.duplicate();
  196. this._actions.push({ fn: "add", card: newCard, ref: card });
  197. return newCard;
  198. };
  199. CardDeck.prototype.deleteCard = function (card) {
  200. this._actions.push({ fn: "del", card: card, ref: null });
  201. };
  202. CardDeck.prototype.commit = function () {
  203. for (var i = 0; i < this._actions.length; ++i) {
  204. var action = this._actions[i];
  205. if (action.fn === "add") {
  206. var index = this.cards.indexOf(action.ref);
  207. if (index > -1) {
  208. this.cards.splice(index + 1, 0, action.card);
  209. }
  210. else {
  211. this.cards.push(action.card);
  212. }
  213. }
  214. else if (action.fn === "del") {
  215. var index = this.cards.indexOf(action.card);
  216. if (index > -1) {
  217. this.cards.splice(index, 1);
  218. }
  219. }
  220. }
  221. this._actions = [];
  222. };
  223. return CardDeck;
  224. })();
  225. RpgCards.CardDeck = CardDeck;
  226. var CardHtmlGenerator = (function () {
  227. function CardHtmlGenerator() {
  228. }
  229. CardHtmlGenerator.prototype._icon = function (src, ind, ind0) {
  230. if (src.length > 0) {
  231. return ind + '<card-icon src="./icons/' + src + '.svg"></card-icon>\n';
  232. }
  233. else {
  234. return "";
  235. }
  236. };
  237. CardHtmlGenerator.prototype._subtitle = function (params, card, options, ind, ind0) {
  238. var text = params[0] || "";
  239. return ind + '<card-subtitle>' + text + '</card-subtitle>\n';
  240. };
  241. CardHtmlGenerator.prototype._ruler = function (params, card, options, ind, ind0) {
  242. return ind + '<card-rule></card-rule>\n';
  243. };
  244. CardHtmlGenerator.prototype._boxes = function (params, card, options, ind, ind0) {
  245. var count = params[0] || 1;
  246. var size = params[1] || 3;
  247. return ind + '<card-boxes size="' + size + '" count="' + count + '"></card-boxes>\n';
  248. };
  249. CardHtmlGenerator.prototype._property = function (params, card, options, ind, ind0) {
  250. var header = params[0] || "";
  251. var text = params[1] || "";
  252. var result = "";
  253. result += ind + '<card-property>\n';
  254. result += ind + ind0 + '<h4>' + header + '</h4>\n';
  255. result += ind + ind0 + '<p>' + text + '</p>\n';
  256. result += ind + '</card-property>\n';
  257. return result;
  258. };
  259. CardHtmlGenerator.prototype._description = function (params, card, options, ind, ind0) {
  260. var header = params[0] || "";
  261. var text = params[1] || "";
  262. var result = "";
  263. result += ind + '<card-description>\n';
  264. result += ind + ind0 + '<h4>' + header + '</h4>\n';
  265. result += ind + ind0 + '<p>' + text + '</p>\n';
  266. result += ind + '</card-description>\n';
  267. return result;
  268. };
  269. CardHtmlGenerator.prototype._text = function (params, card, options, ind, ind0) {
  270. var text = params[0] || "";
  271. var result = "";
  272. result += ind + '<card-description>\n';
  273. result += ind + ind0 + '<p>' + text + '</p>\n';
  274. result += ind + '</card-description>\n';
  275. return result;
  276. };
  277. CardHtmlGenerator.prototype._dndstats = function (params, card, options, ind, ind0) {
  278. var stats = ["str", "dex", "con", "int", "wis", "cha"];
  279. var result = "";
  280. result += ind + '<card-dndstats';
  281. for (var i = 0; i < stats.length; ++i) {
  282. var value = params[i] || "";
  283. var stat = stats[i];
  284. result += ' ' + stat + '="' + value + '"';
  285. }
  286. result += '></card-dndstats>\n';
  287. return result;
  288. };
  289. CardHtmlGenerator.prototype._bullet = function (params, card, options, ind, ind0) {
  290. var text = params[0] || "";
  291. return ind + '<card-bullet>' + text + '</card-bullet>\n';
  292. };
  293. CardHtmlGenerator.prototype._section = function (params, card, options, ind, ind0) {
  294. var text = params[0] || "";
  295. return ind + '<card-section>' + text + '</card-section>\n';
  296. };
  297. CardHtmlGenerator.prototype._fill = function (params, card, options, ind, ind0) {
  298. var size = params[0] || "1";
  299. return ind + '<card-fill size="' + size + '"></card-fill>\n';
  300. };
  301. CardHtmlGenerator.prototype._vspace = function (params, card, options, ind, ind0) {
  302. var size = params[0] || "1em";
  303. return ind + '<card-vspace size="' + size + '"></card-vspace>\n';
  304. };
  305. CardHtmlGenerator.prototype._unknown = function (params, card, options, ind, ind0) {
  306. var text = params.join(' | ');
  307. return ind + '<card-description><p>' + text + '</p></card-description>\n';
  308. };
  309. CardHtmlGenerator.prototype._empty = function (params, card, options, ind, ind0) {
  310. return '';
  311. };
  312. CardHtmlGenerator.prototype._contents = function (contents, card, options, ind, ind0) {
  313. var _this = this;
  314. var result = "";
  315. result += ind + '<card-contents>\n';
  316. result += contents.map(function (value) {
  317. var parts = splitParams(value);
  318. var name = parts[0];
  319. var params = parts.splice(1);
  320. var generator = null;
  321. switch (name) {
  322. case "subtitle":
  323. generator = _this._subtitle;
  324. break;
  325. case "property":
  326. generator = _this._property;
  327. break;
  328. case "rule":
  329. generator = _this._ruler;
  330. break;
  331. case "ruler":
  332. generator = _this._ruler;
  333. break;
  334. case "boxes":
  335. generator = _this._boxes;
  336. break;
  337. case "description":
  338. generator = _this._description;
  339. break;
  340. case "dndstats":
  341. generator = _this._dndstats;
  342. break;
  343. case "text":
  344. generator = _this._text;
  345. break;
  346. case "bullet":
  347. generator = _this._bullet;
  348. break;
  349. case "fill":
  350. generator = _this._fill;
  351. break;
  352. case "vspace":
  353. generator = _this._vspace;
  354. break;
  355. case "section":
  356. generator = _this._section;
  357. break;
  358. case "disabled":
  359. generator = _this._empty;
  360. break;
  361. case "":
  362. generator = _this._empty;
  363. break;
  364. default: return _this._unknown(parts, card, options, ind, ind0);
  365. }
  366. return generator(params, card, options, ind + ind0, ind);
  367. }).join("\n");
  368. result += ind + '</card-contents>\n';
  369. return result;
  370. };
  371. CardHtmlGenerator.prototype._title = function (card, options, ind, ind0) {
  372. var title = card.getTitle(options);
  373. var title_size = card.getTitleSize(options);
  374. var title_icon_text = card.getTitleIconText(options);
  375. var icon = card.getIconFront(options);
  376. var result = "";
  377. result += ind + '<card-title size="' + title_size + '">\n';
  378. result += ind + ind0 + '<h1>' + title + '</h1>\n';
  379. result += ind + ind0 + '<h2>' + title_icon_text + '</h2>\n';
  380. result += this._icon(icon, ind + ind0, ind0);
  381. result += ind + '</card-title>\n';
  382. return result;
  383. };
  384. CardHtmlGenerator.prototype._card_front = function (card, options, ind, ind0) {
  385. var result = "";
  386. result += this._title(card, options, ind + ind0, ind0);
  387. result += this._contents(card.contents, card, options, ind + ind0, ind0);
  388. return result;
  389. };
  390. CardHtmlGenerator.prototype._card_back = function (card, options, ind, ind0) {
  391. var icon = card.getIconBack(options);
  392. var result = "";
  393. result += ind + '<card-back>\n';
  394. result += this._icon(icon, ind + ind0, ind);
  395. result += ind + '</card-back>\n';
  396. return result;
  397. };
  398. CardHtmlGenerator.prototype._card_empty = function (options, ind, ind0) {
  399. var result = "";
  400. result += ind + '<card-contents>\n';
  401. result += ind + '</card-contents>\n';
  402. return result;
  403. };
  404. CardHtmlGenerator.prototype._card = function (options, ind, ind0, content, color) {
  405. var size = options.card_size || "25x35";
  406. var result = "";
  407. result += ind + '<rpg-card color="' + color + '" size="' + size + '">\n';
  408. result += content;
  409. result += ind + '</rpg-card>\n';
  410. return result;
  411. };
  412. /** Generates HTML for the front side of the given card */
  413. CardHtmlGenerator.prototype.card_front = function (card, options, indent) {
  414. var content = this._card_front(card, options, "", indent);
  415. return this._card(options, "", indent, content, card.getColorFront(options));
  416. };
  417. /** Generates HTML for the back side of the given card */
  418. CardHtmlGenerator.prototype.card_back = function (card, options, indent) {
  419. var content = this._card_back(card, options, "", indent);
  420. return this._card(options, "", indent, content, card.getColorBack(options));
  421. };
  422. /** Generates HTML for an empty given card */
  423. CardHtmlGenerator.prototype.card_empty = function (options, indent) {
  424. var content = this._card_empty(options, "", indent);
  425. return this._card(options, "", indent, content, options.empty_color);
  426. };
  427. return CardHtmlGenerator;
  428. })();
  429. RpgCards.CardHtmlGenerator = CardHtmlGenerator;
  430. var CardPage = (function () {
  431. function CardPage(rows, cols) {
  432. this.rows = rows;
  433. this.cols = cols;
  434. this.cards = [];
  435. }
  436. /** Returns an empty page with the same dimensions */
  437. CardPage.prototype.newPage = function () {
  438. return new CardPage(this.rows, this.cols);
  439. };
  440. CardPage.prototype._posToIndex = function (row, col) {
  441. return row * this.cols + col;
  442. };
  443. /** Adds one card to the page */
  444. CardPage.prototype.addCard = function (card) {
  445. if (this.capacity() === 0) {
  446. throw new Error("This page is full.");
  447. }
  448. this.cards.push(card);
  449. };
  450. /**
  451. Adds several copies of a card to the page.
  452. Returns the number of copies that did not fit on the page.
  453. */
  454. CardPage.prototype.addCards = function (card, count) {
  455. while (this.capacity() > 0 && count > 0) {
  456. this.addCard(card);
  457. --count;
  458. }
  459. return count;
  460. };
  461. /** Fills all remaining slots on the current row with the given card */
  462. CardPage.prototype.fillRow = function (card) {
  463. while (this.capacityRow() > 0) {
  464. this.addCard(card);
  465. }
  466. };
  467. /** Fills all remaining slots on the page with empty cards */
  468. CardPage.prototype.fillPage = function (card) {
  469. while (this.capacity() > 0) {
  470. this.addCard(card);
  471. }
  472. };
  473. /** Empty slots on the page */
  474. CardPage.prototype.capacity = function () {
  475. return this.rows * this.cols - this.cards.length;
  476. };
  477. /** Empty slots on the current line */
  478. CardPage.prototype.capacityRow = function () {
  479. return this.capacity() % this.cols;
  480. };
  481. /** Flip card slots horizontally */
  482. CardPage.prototype.flipH = function () {
  483. if (this.capacity() > 0) {
  484. throw new Error("Cannot perform this operation while the page is not full");
  485. }
  486. for (var r = 0; r < this.rows; ++r) {
  487. for (var c = 0; c < Math.floor(this.cols / 2); ++c) {
  488. var indexL = this._posToIndex(r, c);
  489. var indexR = this._posToIndex(r, this.cols - c - 1);
  490. var cardL = this.cards[indexL];
  491. var cardR = this.cards[indexR];
  492. this.cards[indexL] = cardR;
  493. this.cards[indexR] = cardL;
  494. }
  495. }
  496. };
  497. return CardPage;
  498. })();
  499. var CardPageSet = (function () {
  500. function CardPageSet(rows, cols) {
  501. this.rows = rows;
  502. this.cols = cols;
  503. this.pages = [];
  504. }
  505. CardPageSet.prototype.lastPage = function () {
  506. if (this.pages.length === 0) {
  507. return null;
  508. }
  509. else {
  510. return this.pages[this.pages.length - 1];
  511. }
  512. };
  513. CardPageSet.prototype.addPage = function () {
  514. var newPage = new CardPage(this.rows, this.cols);
  515. this.pages.push(newPage);
  516. return newPage;
  517. };
  518. /**
  519. Adds one card to the last page.
  520. Adds a new pages if necessary.
  521. */
  522. CardPageSet.prototype.addCard = function (card) {
  523. var page = this.lastPage();
  524. if (page === null || page.capacity() === 0) {
  525. page = this.addPage();
  526. }
  527. page.addCard(card);
  528. };
  529. /**
  530. Adds several copies of a card to the last page.
  531. Adds new pages if necessary.
  532. */
  533. CardPageSet.prototype.addCards = function (card, count) {
  534. for (var i = 0; i < count; ++i) {
  535. this.addCard(card);
  536. }
  537. };
  538. CardPageSet.prototype.forEach = function (fn) {
  539. this.pages.forEach(fn);
  540. };
  541. CardPageSet.prototype.merge = function (other) {
  542. if (this.pages.length !== other.pages.length) {
  543. throw new Error("This function is only for merging two equally sized page sets");
  544. }
  545. var result = new CardPageSet(this.rows, this.cols);
  546. for (var i = 0; i < this.pages.length; ++i) {
  547. result.pages.push(this.pages[i]);
  548. result.pages.push(other.pages[i]);
  549. }
  550. return result;
  551. };
  552. return CardPageSet;
  553. })();
  554. var BoxSize = (function () {
  555. function BoxSize(p, w, h, wpx, hpx) {
  556. this.page = p;
  557. this.width = w;
  558. this.height = h;
  559. this.width_px = Math.floor(wpx);
  560. this.height_px = Math.floor(hpx);
  561. }
  562. return BoxSize;
  563. })();
  564. var boxSizes = {};
  565. boxSizes["auto"] = new BoxSize("auto", "auto", "auto", Infinity, Infinity);
  566. boxSizes["A2"] = new BoxSize("A2 portrait", "420mm", "594mm", 1587.401575, 2245.03937);
  567. boxSizes["A3"] = new BoxSize("A3 portrait", "297mm", "420mm", 1118.740158, 1587.401575);
  568. boxSizes["A4"] = new BoxSize("A4 portrait", "210mm", "297mm", 793.700787, 1118.740158);
  569. boxSizes["A5"] = new BoxSize("A5 portrait", "148mm", "210mm", 559.370079, 793.700787);
  570. boxSizes["Letter"] = new BoxSize("Letter portrait", "8.5in", "11in", 816, 1056);
  571. boxSizes["225x35"] = new BoxSize("2.25in 3.5in", "2.25in", "3.5in", 216, 336);
  572. boxSizes["25x35"] = new BoxSize("2.5in 3.5in", "2.5in", "3.5in", 240, 336);
  573. boxSizes["35x50"] = new BoxSize("3.5in 5.0in", "3.5in", "5.0in", 336, 480);
  574. boxSizes["50x70"] = new BoxSize("5.0in 7.0in", "5.0in", "7.0in", 480, 672);
  575. var PageHtmlGenerator = (function () {
  576. function PageHtmlGenerator() {
  577. this.indent = " ";
  578. }
  579. PageHtmlGenerator.prototype._pageColor = function (page, options) {
  580. if ((options.card_arrangement == "doublesided") && (page % 2 == 1)) {
  581. return options.background_color;
  582. }
  583. else {
  584. return options.foreground_color;
  585. }
  586. };
  587. PageHtmlGenerator.prototype._wrap = function (pageSet, options) {
  588. var result = "";
  589. for (var i = 0; i < pageSet.pages.length; ++i) {
  590. var page = pageSet.pages[i];
  591. var style = ' style="background-color:' + this._pageColor(i, options) + '"';
  592. result += '<card-page' + style + '>\n';
  593. result += page.cards.join("");
  594. result += '</card-page>\n';
  595. }
  596. return result;
  597. };
  598. PageHtmlGenerator.prototype._generatePagesDoublesided = function (cards, options, rows, cols, generator) {
  599. var front_pages = new CardPageSet(rows, cols);
  600. var back_pages = new CardPageSet(rows, cols);
  601. var empty = generator.card_empty(options, this.indent);
  602. for (var i = 0; i < cards.length; ++i) {
  603. var card = cards[i];
  604. var front = generator.card_front(card, options, this.indent);
  605. var back = generator.card_back(card, options, this.indent);
  606. front_pages.addCards(front, card.count);
  607. back_pages.addCards(back, card.count);
  608. }
  609. // Fill empty slots
  610. front_pages.forEach(function (page) { return page.fillPage(empty); });
  611. back_pages.forEach(function (page) { return page.fillPage(empty); });
  612. // Shuffle back cards so that they line up with their corresponding front cards
  613. back_pages.forEach(function (page) { return page.flipH(); });
  614. // Interleave front and back pages so that we can print double-sided
  615. return front_pages.merge(back_pages);
  616. };
  617. PageHtmlGenerator.prototype._generatePagesFrontOnly = function (cards, options, rows, cols, generator) {
  618. var pages = new CardPageSet(rows, cols);
  619. var empty = generator.card_empty(options, this.indent);
  620. for (var i = 0; i < cards.length; ++i) {
  621. var card = cards[i];
  622. var front = generator.card_front(card, options, this.indent);
  623. pages.addCards(front, card.count);
  624. }
  625. // Fill empty slots
  626. pages.forEach(function (page) { return page.fillPage(empty); });
  627. return pages;
  628. };
  629. PageHtmlGenerator.prototype._generatePagesSideBySide = function (cards, options, rows, cols, generator) {
  630. if (cols < 2) {
  631. throw new Error("Need at least two columns for side-by-side");
  632. }
  633. var pages = new CardPageSet(rows, cols);
  634. var empty = generator.card_empty(options, this.indent);
  635. for (var i = 0; i < cards.length; ++i) {
  636. var card = cards[i];
  637. var front = generator.card_front(card, options, this.indent);
  638. var back = generator.card_back(card, options, this.indent);
  639. for (var j = 0; j < card.count; ++j) {
  640. if (pages.pages.length > 0 && pages.lastPage().capacityRow() < 2) {
  641. pages.lastPage().fillRow(empty);
  642. }
  643. pages.addCard(front);
  644. pages.addCard(back);
  645. }
  646. }
  647. // Fill empty slots
  648. pages.forEach(function (page) { return page.fillPage(empty); });
  649. return pages;
  650. };
  651. PageHtmlGenerator.prototype._generatePages = function (cards, options, rows, cols, generator) {
  652. switch (options.card_arrangement) {
  653. case "doublesided": return this._generatePagesDoublesided(cards, options, rows, cols, generator);
  654. case "front_only": return this._generatePagesFrontOnly(cards, options, rows, cols, generator);
  655. case "side_by_side": return this._generatePagesSideBySide(cards, options, rows, cols, generator);
  656. default: throw new Error("Unknown card arrangement");
  657. }
  658. };
  659. PageHtmlGenerator.prototype._generateStyle = function (options) {
  660. var page_box = boxSizes[options.page_size] || boxSizes["auto"];
  661. var result = '';
  662. result += '<style type="text/css">\n';
  663. result += 'body {\n';
  664. result += ' display: block;\n';
  665. result += ' background: rgb(204, 204, 204);\n';
  666. result += '}\n';
  667. result += 'card-page {\n';
  668. result += ' width: ' + (page_box.width_px) + 'px;\n';
  669. result += ' height: ' + (page_box.height_px) + 'px;\n';
  670. result += '}\n';
  671. result += '@media print {\n';
  672. result += ' html, body {\n';
  673. result += ' width: ' + page_box.width_px + 'px;\n';
  674. result += ' }\n';
  675. result += ' body {\n';
  676. result += ' margin: 0;\n';
  677. result += ' padding: 0;\n';
  678. result += ' border: 0;\n';
  679. result += ' }\n';
  680. result += '}\n';
  681. result += '@page {\n';
  682. result += ' margin: 0;\n';
  683. result += ' size:' + page_box.width_px + 'px ' + page_box.height_px + 'px;\n';
  684. result += ' -webkit-print-color-adjust: exact;\n';
  685. result += '}\n';
  686. result += '</style>\n';
  687. return result;
  688. };
  689. PageHtmlGenerator.prototype.generateHtml = function (cards, options) {
  690. options = options || new Options();
  691. var rows = options.page_rows || 3;
  692. var cols = options.page_columns || 3;
  693. // Generate the HTML for each card
  694. var generator = new CardHtmlGenerator();
  695. var pages = this._generatePages(cards, options, rows, cols, generator);
  696. // Wrap all pages in a <page> element
  697. var document = this._wrap(pages, options);
  698. // Generate the HTML for the page layout
  699. var style = this._generateStyle(options);
  700. // Wrap all pages in a <page> element and add CSS for the page size
  701. var result = "";
  702. result += style;
  703. result += document;
  704. return result;
  705. };
  706. PageHtmlGenerator.prototype.insertInto = function (cards, options, container) {
  707. while (container.hasChildNodes()) {
  708. container.removeChild(container.lastChild);
  709. }
  710. // Insert the HTML
  711. var html = this.generateHtml(cards, options);
  712. container.innerHTML = html;
  713. };
  714. return PageHtmlGenerator;
  715. })();
  716. RpgCards.PageHtmlGenerator = PageHtmlGenerator;
  717. })(RpgCards || (RpgCards = {}));
  718. var RpgCardsUI;
  719. (function (RpgCardsUI) {
  720. RpgCardsUI.css_color_names = [
  721. "Black",
  722. "Navy",
  723. "DarkBlue",
  724. "MediumBlue",
  725. "Blue",
  726. "DarkGreen",
  727. "Green",
  728. "Teal",
  729. "DarkCyan",
  730. "DeepSkyBlue",
  731. "DarkTurquoise",
  732. "MediumSpringGreen",
  733. "Lime",
  734. "SpringGreen",
  735. "Aqua",
  736. "Cyan",
  737. "MidnightBlue",
  738. "DodgerBlue",
  739. "LightSeaGreen",
  740. "ForestGreen",
  741. "SeaGreen",
  742. "DarkSlateGray",
  743. "LimeGreen",
  744. "MediumSeaGreen",
  745. "Turquoise",
  746. "RoyalBlue",
  747. "SteelBlue",
  748. "DarkSlateBlue",
  749. "MediumTurquoise",
  750. "Indigo",
  751. "DarkOliveGreen",
  752. "CadetBlue",
  753. "CornflowerBlue",
  754. "MediumAquaMarine",
  755. "DimGray",
  756. "SlateBlue",
  757. "OliveDrab",
  758. "SlateGray",
  759. "LightSlateGray",
  760. "MediumSlateBlue",
  761. "LawnGreen",
  762. "Chartreuse",
  763. "Aquamarine",
  764. "Maroon",
  765. "Purple",
  766. "Olive",
  767. "Gray",
  768. "SkyBlue",
  769. "LightSkyBlue",
  770. "BlueViolet",
  771. "DarkRed",
  772. "DarkMagenta",
  773. "SaddleBrown",
  774. "DarkSeaGreen",
  775. "LightGreen",
  776. "MediumPurple",
  777. "DarkViolet",
  778. "PaleGreen",
  779. "DarkOrchid",
  780. "YellowGreen",
  781. "Sienna",
  782. "Brown",
  783. "DarkGray",
  784. "LightBlue",
  785. "GreenYellow",
  786. "PaleTurquoise",
  787. "LightSteelBlue",
  788. "PowderBlue",
  789. "FireBrick",
  790. "DarkGoldenRod",
  791. "MediumOrchid",
  792. "RosyBrown",
  793. "DarkKhaki",
  794. "Silver",
  795. "MediumVioletRed",
  796. "IndianRed",
  797. "Peru",
  798. "Chocolate",
  799. "Tan",
  800. "LightGray",
  801. "Thistle",
  802. "Orchid",
  803. "GoldenRod",
  804. "PaleVioletRed",
  805. "Crimson",
  806. "Gainsboro",
  807. "Plum",
  808. "BurlyWood",
  809. "LightCyan",
  810. "Lavender",
  811. "DarkSalmon",
  812. "Violet",
  813. "PaleGoldenRod",
  814. "LightCoral",
  815. "Khaki",
  816. "AliceBlue",
  817. "HoneyDew",
  818. "Azure",
  819. "SandyBrown",
  820. "Wheat",
  821. "Beige",
  822. "WhiteSmoke",
  823. "MintCream",
  824. "GhostWhite",
  825. "Salmon",
  826. "AntiqueWhite",
  827. "Linen",
  828. "LightGoldenRodYellow",
  829. "OldLace",
  830. "Red",
  831. "Fuchsia",
  832. "Magenta",
  833. "DeepPink",
  834. "OrangeRed",
  835. "Tomato",
  836. "HotPink",
  837. "Coral",
  838. "DarkOrange",
  839. "LightSalmon",
  840. "Orange",
  841. "LightPink",
  842. "Pink",
  843. "Gold",
  844. "PeachPuff",
  845. "NavajoWhite",
  846. "Moccasin",
  847. "Bisque",
  848. "MistyRose",
  849. "BlanchedAlmond",
  850. "PapayaWhip",
  851. "LavenderBlush",
  852. "SeaShell",
  853. "Cornsilk",
  854. "LemonChiffon",
  855. "FloralWhite",
  856. "Snow",
  857. "Yellow",
  858. "LightYellow",
  859. "Ivory",
  860. "White"
  861. ];
  862. RpgCardsUI.card_colors = {
  863. "": "",
  864. "dimgray": "dimgray",
  865. "black": "black",
  866. "darkgoldenrod": "darkgoldenrod",
  867. "saddlebrown": "saddlebrown",
  868. "indianred": "indianred",
  869. "maroon": "maroon",
  870. "indigo": "indigo",
  871. "darkblue": "darkblue",
  872. "royalblue": "royalblue",
  873. "darkgreen": "darkgreen",
  874. "#666633": "#666633",
  875. "rgb(140, 83, 133)": "rgb(140, 83, 133)",
  876. "rgb(255, 173, 70)": "rgb(255, 173, 70)",
  877. "rgb(96, 184, 93)": "rgb(96, 184, 93)",
  878. "rgb(59, 175, 177)": "rgb(59, 175, 177)",
  879. "rgb(128, 0, 0)": "rgb(128, 0, 0)",
  880. "rgb(133, 112, 86)": "rgb(133, 112, 86)",
  881. "rgb(248, 58, 34)": "rgb(248, 58, 34)"
  882. };
  883. })(RpgCardsUI || (RpgCardsUI = {}));
  884. var RpgCardsUI;
  885. (function (RpgCardsUI) {
  886. RpgCardsUI.icon_names = [
  887. "abstract-001",
  888. "abstract-002",
  889. "abstract-003",
  890. "abstract-004",
  891. "abstract-005",
  892. "abstract-006",
  893. "abstract-007",
  894. "abstract-008",
  895. "abstract-009",
  896. "abstract-010",
  897. "abstract-011",
  898. "abstract-012",
  899. "abstract-013",
  900. "abstract-014",
  901. "abstract-015",
  902. "abstract-016",
  903. "abstract-017",
  904. "abstract-018",
  905. "abstract-019",
  906. "abstract-020",
  907. "abstract-021",
  908. "abstract-022",
  909. "abstract-023",
  910. "abstract-024",
  911. "abstract-025",
  912. "abstract-026",
  913. "abstract-027",
  914. "abstract-028",
  915. "abstract-029",
  916. "abstract-030",
  917. "abstract-031",
  918. "abstract-032",
  919. "abstract-033",
  920. "abstract-034",
  921. "abstract-035",
  922. "abstract-036",
  923. "abstract-037",
  924. "abstract-038",
  925. "abstract-039",
  926. "abstract-040",
  927. "abstract-041",
  928. "abstract-042",
  929. "abstract-043",
  930. "abstract-044",
  931. "abstract-045",
  932. "abstract-046",
  933. "abstract-047",
  934. "abstract-048",
  935. "abstract-049",
  936. "abstract-050",
  937. "abstract-051",
  938. "abstract-052",
  939. "abstract-053",
  940. "abstract-054",
  941. "abstract-055",
  942. "abstract-056",
  943. "abstract-057",
  944. "abstract-058",
  945. "abstract-059",
  946. "abstract-060",
  947. "abstract-061",
  948. "abstract-062",
  949. "abstract-063",
  950. "abstract-064",
  951. "abstract-065",
  952. "abstract-066",
  953. "abstract-067",
  954. "abstract-068",
  955. "abstract-069",
  956. "abstract-070",
  957. "abstract-071",
  958. "abstract-072",
  959. "abstract-073",
  960. "abstract-074",
  961. "abstract-075",
  962. "abstract-076",
  963. "abstract-077",
  964. "abstract-078",
  965. "abstract-079",
  966. "abstract-080",
  967. "abstract-081",
  968. "abstract-082",
  969. "abstract-083",
  970. "abstract-084",
  971. "abstract-085",
  972. "abstract-086",
  973. "abstract-087",
  974. "abstract-088",
  975. "abstract-089",
  976. "abstract-090",
  977. "abstract-091",
  978. "abstract-092",
  979. "abstract-093",
  980. "abstract-094",
  981. "abstract-095",
  982. "abstract-096",
  983. "abstract-097",
  984. "abstract-098",
  985. "abstract-099",
  986. "abstract-100",
  987. "abstract-101",
  988. "abstract-102",
  989. "abstract-103",
  990. "abstract-104",
  991. "abstract-105",
  992. "abstract-106",
  993. "abstract-107",
  994. "abstract-108",
  995. "abstract-109",
  996. "abstract-110",
  997. "abstract-111",
  998. "abstract-112",
  999. "abstract-113",
  1000. "abstract-114",
  1001. "abstract-115",
  1002. "abstract-116",
  1003. "abstract-117",
  1004. "abstract-118",
  1005. "abstract-119",
  1006. "abstract-120",
  1007. "abstract-121",
  1008. "ace",
  1009. "acid-blob",
  1010. "acid-tube",
  1011. "acid",
  1012. "acorn",
  1013. "aerial-signal",
  1014. "aerosol",
  1015. "afterburn",
  1016. "ages",
  1017. "air-balloon",
  1018. "alarm-clock",
  1019. "alien-fire",
  1020. "alien-skull",
  1021. "alien-stare",
  1022. "all-for-one",
  1023. "alligator-clip",
  1024. "ammo-box",
  1025. "ammonite-fossil",
  1026. "ammonite",
  1027. "amphora",
  1028. "anatomy",
  1029. "anchor",
  1030. "andromeda-chain",
  1031. "angel-outfit",
  1032. "angel-wings",
  1033. "angler-fish",
  1034. "angry-eyes",
  1035. "angular-spider",
  1036. "animal-hide",
  1037. "animal-skull",
  1038. "ankh",
  1039. "anthem",
  1040. "anvil-impact",
  1041. "anvil",
  1042. "apple-maggot",
  1043. "apple-seeds",
  1044. "aquarius",
  1045. "aqueduct",
  1046. "archery-target",
  1047. "architect-mask",
  1048. "arcing-bolt",
  1049. "arena",
  1050. "aries",
  1051. "armadillo-tail",
  1052. "armor-vest",
  1053. "armoured-shell",
  1054. "arrow-cluster",
  1055. "arrow-flights",
  1056. "arrowed",
  1057. "arrowhead",
  1058. "arrows-shield",
  1059. "arson",
  1060. "artificial-hive",
  1061. "at-sea",
  1062. "atomic-slashes",
  1063. "aubergine",
  1064. "aura",
  1065. "auto-repair",
  1066. "autogun",
  1067. "awareness",
  1068. "axe-in-stump",
  1069. "axe-swing",
  1070. "back-forth",
  1071. "back-pain",
  1072. "backstab",
  1073. "backup",
  1074. "balloons",
  1075. "bandage-roll",
  1076. "bandaged",
  1077. "banknote",
  1078. "barbed-arrow",
  1079. "barbed-spear",
  1080. "barbed-wire",
  1081. "barbute",
  1082. "barefoot",
  1083. "barrel",
  1084. "baseball-bat",
  1085. "basketball-ball",
  1086. "bat-blade",
  1087. "bat-wing",
  1088. "battered-axe",
  1089. "batteries",
  1090. "battery-0",
  1091. "battery-100",
  1092. "battery-25",
  1093. "battery-50",
  1094. "battery-75",
  1095. "battery-minus",
  1096. "battery-pack-alt",
  1097. "battery-pack",
  1098. "battery-plus",
  1099. "battle-axe",
  1100. "battle-gear",
  1101. "batwing-emblem",
  1102. "beam-wake",
  1103. "beams-aura",
  1104. "beanstalk",
  1105. "beard",
  1106. "beast-eye",
  1107. "bee",
  1108. "beech",
  1109. "beer-stein",
  1110. "beetle-shell",
  1111. "behold",
  1112. "belt-buckles",
  1113. "bestial-fangs",
  1114. "beveled-star",
  1115. "big-egg",
  1116. "big-wave",
  1117. "biohazard",
  1118. "bird-claw",
  1119. "bird-limb",
  1120. "bird-mask",
  1121. "bird-twitter",
  1122. "black-bar",
  1123. "black-book",
  1124. "black-cat",
  1125. "black-flag",
  1126. "black-hole-bolas",
  1127. "black-knight-helm",
  1128. "blackball",
  1129. "blackcurrant",
  1130. "blade-bite",
  1131. "blade-fall",
  1132. "blast",
  1133. "blaster",
  1134. "bleeding-eye",
  1135. "bleeding-heart",
  1136. "block-house",
  1137. "bloody-stash",
  1138. "blunderbuss",
  1139. "boar-tusks",
  1140. "body-swapping",
  1141. "boiling-bubbles",
  1142. "bolas",
  1143. "bolt-shield",
  1144. "bolter-gun",
  1145. "bombing-run",
  1146. "bone-gnawer",
  1147. "bone-knife",
  1148. "book-1",
  1149. "book-2",
  1150. "book-3",
  1151. "book-4",
  1152. "book-5",
  1153. "book-6",
  1154. "book-7",
  1155. "book-8",
  1156. "book-9",
  1157. "book-aura",
  1158. "book-cover",
  1159. "book-storm",
  1160. "bookmark",
  1161. "bookmarklet",
  1162. "boomerang",
  1163. "boot-prints",
  1164. "boot-stomp",
  1165. "boots",
  1166. "bordered-shield",
  1167. "bottle-vapors",
  1168. "bottled-bolt",
  1169. "bottom-right-3d-arrow",
  1170. "bowie-knife",
  1171. "bowl-spiral",
  1172. "bowling-pin",
  1173. "bowling-propulsion",
  1174. "bowman",
  1175. "boxing-glove-surprise",
  1176. "boxing-glove",
  1177. "brain-freeze",
  1178. "brain-stem",
  1179. "brain",
  1180. "brainstorm",
  1181. "branch-arrow",
  1182. "brandy-bottle",
  1183. "brass-eye",
  1184. "bread",
  1185. "breastplate",
  1186. "brick-pile",
  1187. "brick-wall",
  1188. "bridge",
  1189. "broadhead-arrow",
  1190. "broadsword",
  1191. "broken-bone",
  1192. "broken-bottle",
  1193. "broken-heart",
  1194. "broken-shield",
  1195. "broken-skull",
  1196. "broken-tablet",
  1197. "brutal-helm",
  1198. "bubble-field",
  1199. "bubbles",
  1200. "bubbling-flask",
  1201. "bud",
  1202. "bugle-call",
  1203. "bulb",
  1204. "bull-horns",
  1205. "bull",
  1206. "bullets",
  1207. "burn",
  1208. "burning-book",
  1209. "burning-dot",
  1210. "burning-embers",
  1211. "burning-eye",
  1212. "burning-meteor",
  1213. "burning-passion",
  1214. "burning-round-shot",
  1215. "burning-tree",
  1216. "burst-blob",
  1217. "butterfly-warning",
  1218. "butterfly",
  1219. "cactus",
  1220. "caged-ball",
  1221. "cake-slice",
  1222. "caldera",
  1223. "campfire",
  1224. "cancel",
  1225. "cancer",
  1226. "candle-flame",
  1227. "candle-holder",
  1228. "candle-light",
  1229. "candle-skull",
  1230. "candlebright",
  1231. "cannister",
  1232. "cannon-ball",
  1233. "cannon-shot",
  1234. "cannon",
  1235. "capitol",
  1236. "capricorn",
  1237. "cargo-crane",
  1238. "carillon",
  1239. "carnivore-mouth",
  1240. "carrion",
  1241. "carrot",
  1242. "cartwheel",
  1243. "cash",
  1244. "castle",
  1245. "cauldron",
  1246. "cctv-camera",
  1247. "centipede",
  1248. "chain-lightning",
  1249. "chain-mail",
  1250. "chained-heart",
  1251. "chaingun",
  1252. "chalice-drops",
  1253. "charm",
  1254. "chart",
  1255. "checkbox-tree",
  1256. "checked-shield",
  1257. "checklist",
  1258. "cheerful",
  1259. "cheese-wedge",
  1260. "chemical-arrow",
  1261. "chemical-bolt",
  1262. "chemical-drop",
  1263. "chemical-tank",
  1264. "chicken-leg",
  1265. "church",
  1266. "circle-sparks",
  1267. "circuitry",
  1268. "circular-saw",
  1269. "circular-sawblade",
  1270. "claw-hammer",
  1271. "claw-slashes",
  1272. "claw-string",
  1273. "claw",
  1274. "cloak-dagger",
  1275. "clockwork",
  1276. "closed-doors",
  1277. "cloud-ring",
  1278. "cloudy-fork",
  1279. "clout",
  1280. "clover-spiked",
  1281. "clover",
  1282. "cluster-bomb",
  1283. "cobweb",
  1284. "coffee-mug",
  1285. "coffin",
  1286. "cog-lock",
  1287. "cog",
  1288. "cogsplosion",
  1289. "coiling-curl",
  1290. "cold-heart",
  1291. "coma",
  1292. "comb",
  1293. "compass",
  1294. "concentration-orb",
  1295. "condor-emblem",
  1296. "condylura-skull",
  1297. "contract",
  1298. "conversation",
  1299. "cooking-pot",
  1300. "cool-spices",
  1301. "corked-tube",
  1302. "corporal",
  1303. "cowled",
  1304. "crab-claw",
  1305. "crab",
  1306. "cracked-ball-dunk",
  1307. "cracked-disc",
  1308. "cracked-glass",
  1309. "cracked-helm",
  1310. "cracked-mask",
  1311. "cracked-saber",
  1312. "cracked-shield",
  1313. "crags",
  1314. "crenulated-shield",
  1315. "crescent-blade",
  1316. "crested-helmet",
  1317. "croc-jaws",
  1318. "croc-sword",
  1319. "croissant",
  1320. "crossbow",
  1321. "crossed-air-flows",
  1322. "crossed-axes",
  1323. "crossed-bones",
  1324. "crossed-chains",
  1325. "crossed-claws",
  1326. "crossed-pistols",
  1327. "crossed-sabres",
  1328. "crossed-slashes",
  1329. "crossed-swords",
  1330. "crow-dive",
  1331. "crown-coin",
  1332. "crown-of-thorns",
  1333. "crown",
  1334. "crowned-explosion",
  1335. "crowned-heart",
  1336. "crowned-skull",
  1337. "crush",
  1338. "crystal-ball",
  1339. "crystal-bars",
  1340. "crystal-cluster",
  1341. "crystal-eye",
  1342. "crystal-growth",
  1343. "crystal-shine",
  1344. "crystal-wand",
  1345. "crystalize",
  1346. "cubeforce",
  1347. "cubes",
  1348. "cupcake",
  1349. "cupidon-arrow",
  1350. "curled-leaf",
  1351. "curled-tentacle",
  1352. "curling-vines",
  1353. "curly-wing",
  1354. "cursed-star",
  1355. "curvy-knife",
  1356. "cut-diamond",
  1357. "cut-palm",
  1358. "cycle",
  1359. "cyclops",
  1360. "daggers",
  1361. "daisy",
  1362. "dark-squad",
  1363. "dead-eye",
  1364. "dead-wood",
  1365. "deadly-strike",
  1366. "death-note",
  1367. "death-skull",
  1368. "death-zone",
  1369. "deathcab",
  1370. "decapitation",
  1371. "defibrilate",
  1372. "delighted",
  1373. "demolish",
  1374. "dervish-swords",
  1375. "desert-skull",
  1376. "desk-lamp",
  1377. "despair",
  1378. "diablo-skull",
  1379. "diamond-hard",
  1380. "dice-six-faces-five",
  1381. "dice-six-faces-four",
  1382. "dice-six-faces-one",
  1383. "dice-six-faces-six",
  1384. "dice-six-faces-three",
  1385. "dice-six-faces-two",
  1386. "dig-dug",
  1387. "dinosaur-bones",
  1388. "dinosaur-egg",
  1389. "dinosaur-rex",
  1390. "disintegrate",
  1391. "distraction",
  1392. "divergence",
  1393. "divert",
  1394. "divided-spiral",
  1395. "diving-dagger",
  1396. "dna1",
  1397. "dna2",
  1398. "dnd5e-barbarian",
  1399. "dnd5e-bard",
  1400. "dnd5e-cleric",
  1401. "dnd5e-druid",
  1402. "dnd5e-fighter",
  1403. "dnd5e-monk",
  1404. "dnd5e-paladin",
  1405. "dnd5e-ranger",
  1406. "dnd5e-rogue",
  1407. "dnd5e-sorcerer",
  1408. "dnd5e-warlock",
  1409. "dnd5e-wizard",
  1410. "doctor-face",
  1411. "dodge",
  1412. "dodging",
  1413. "domino-mask",
  1414. "double-dragon",
  1415. "double-face-mask",
  1416. "double-quaver",
  1417. "double-shot",
  1418. "doubled",
  1419. "dove",
  1420. "dozen",
  1421. "dragon-balls",
  1422. "dragon-breath",
  1423. "dragon-head",
  1424. "dragon-spiral",
  1425. "dragonfly",
  1426. "drakkar",
  1427. "drama-masks",
  1428. "drill",
  1429. "drink-me",
  1430. "dripping-blade",
  1431. "dripping-goo",
  1432. "dripping-honey",
  1433. "dripping-knife",
  1434. "dripping-star",
  1435. "dripping-stone",
  1436. "dripping-sword",
  1437. "drop",
  1438. "droplet-splash",
  1439. "droplets",
  1440. "drowning",
  1441. "duality",
  1442. "duck",
  1443. "duel",
  1444. "dust-cloud",
  1445. "eagle-emblem",
  1446. "earth-crack",
  1447. "earth-spit",
  1448. "echo-ripples",
  1449. "eclipse",
  1450. "edge-crack",
  1451. "edged-shield",
  1452. "egg-clutch",
  1453. "egg-defense",
  1454. "egg-pod",
  1455. "egyptian-pyramids",
  1456. "elderberry",
  1457. "electric-whip",
  1458. "electric",
  1459. "elf-ear",
  1460. "ember-shot",
  1461. "embrassed-energy",
  1462. "embryo",
  1463. "emerald",
  1464. "empty-chessboard",
  1465. "empty-hourglass",
  1466. "energise",
  1467. "energy-arrow",
  1468. "energy-shield",
  1469. "energy-sword",
  1470. "engagement-ring",
  1471. "ent-mouth",
  1472. "envelope",
  1473. "erlenmeyer",
  1474. "eruption",
  1475. "eskimo",
  1476. "european-flag",
  1477. "evil-book",
  1478. "evil-fork",
  1479. "evil-moon",
  1480. "evil-tree",
  1481. "evil-wings",
  1482. "expand",
  1483. "expander",
  1484. "explosive-materials",
  1485. "extra-lucid",
  1486. "eye-of-horus",
  1487. "eye-shield",
  1488. "eyeball",
  1489. "eyedropper",
  1490. "eyestalk",
  1491. "fairy-wand",
  1492. "fairy",
  1493. "fall-down",
  1494. "falling-boulder",
  1495. "falling-eye",
  1496. "falling-leaf",
  1497. "falling-ovoid",
  1498. "falling-rocks",
  1499. "falling",
  1500. "fanged-skull",
  1501. "feather",
  1502. "feathered-wing",
  1503. "fedora",
  1504. "female",
  1505. "fez",
  1506. "field",
  1507. "finger-print",
  1508. "fire-ace",
  1509. "fire-axe",
  1510. "fire-bomb",
  1511. "fire-bottle",
  1512. "fire-bowl",
  1513. "fire-breath",
  1514. "fire-punch",
  1515. "fire-ring",
  1516. "fire-shield",
  1517. "fire-wave",
  1518. "fire",
  1519. "fireball",
  1520. "fireflake",
  1521. "firework-rocket",
  1522. "fish-corpse",
  1523. "fishbone",
  1524. "fishing-hook",
  1525. "fishing-net",
  1526. "fist",
  1527. "fizzing-flask",
  1528. "flake",
  1529. "flame-spin",
  1530. "flame-tunnel",
  1531. "flame",
  1532. "flamer",
  1533. "flaming-arrow",
  1534. "flaming-claw",
  1535. "flaming-trident",
  1536. "flash-grenade",
  1537. "flat-hammer",
  1538. "fleshy-mass",
  1539. "flexible-star",
  1540. "floating-crystal",
  1541. "flower-pot",
  1542. "flowers",
  1543. "fluffy-cloud",
  1544. "fluffy-swirl",
  1545. "fluffy-wing",
  1546. "flying-dagger",
  1547. "flying-flag",
  1548. "foam",
  1549. "focused-lightning",
  1550. "folded-paper",
  1551. "food-chain",
  1552. "foot-trip",
  1553. "footprint",
  1554. "forest",
  1555. "forward-field",
  1556. "fossil",
  1557. "fountain-pen",
  1558. "fountain",
  1559. "fox-head",
  1560. "fragrance",
  1561. "frankenstein-creature",
  1562. "freedom-dove",
  1563. "frog",
  1564. "front-teeth",
  1565. "frontal-lobe",
  1566. "frostfire",
  1567. "frozen-arrow",
  1568. "frozen-block",
  1569. "frozen-orb",
  1570. "fruiting",
  1571. "fulguro-punch",
  1572. "galleon",
  1573. "gamepad-cross",
  1574. "gamepad",
  1575. "gas-mask",
  1576. "gavel",
  1577. "gaze",
  1578. "gear-hammer",
  1579. "gears",
  1580. "gecko",
  1581. "gem-chain",
  1582. "gem-necklace",
  1583. "gem-pendant",
  1584. "gemini",
  1585. "gems",
  1586. "ghost",
  1587. "gibbet",
  1588. "gift-of-knowledge",
  1589. "gift-trap",
  1590. "glass-heart",
  1591. "glass-shot",
  1592. "globe",
  1593. "gloop",
  1594. "glowing-hands",
  1595. "gluttonous-smile",
  1596. "gluttony",
  1597. "gold-bar",
  1598. "gold-scarab",
  1599. "goo-explosion",
  1600. "goo-skull",
  1601. "goo-spurt",
  1602. "gooey-daemon",
  1603. "gooey-eyed-sun",
  1604. "gooey-impact",
  1605. "gooey-molecule",
  1606. "gooey-sword",
  1607. "grab",
  1608. "grapes",
  1609. "grasping-claws",
  1610. "grass",
  1611. "grease-trap",
  1612. "greaves",
  1613. "grenade",
  1614. "grim-reaper",
  1615. "groundbreaker",
  1616. "guarded-tower",
  1617. "guillotine",
  1618. "guitar",
  1619. "gunshot",
  1620. "halberd-shuriken",
  1621. "halberd",
  1622. "half-heart",
  1623. "half-tornado",
  1624. "hammer-drop",
  1625. "hammer-nails",
  1626. "hand-of-god",
  1627. "hand-saw",
  1628. "hand",
  1629. "handcuffs",
  1630. "hanging-spider",
  1631. "harpoon-chain",
  1632. "harpoon-trident",
  1633. "harpy",
  1634. "hatchets",
  1635. "haunting",
  1636. "hazard-sign",
  1637. "head-shot",
  1638. "headshot",
  1639. "health-decrease",
  1640. "health-increase",
  1641. "health-normal",
  1642. "heart-bottle",
  1643. "heart-drop",
  1644. "heart-inside",
  1645. "heart-organ",
  1646. "heart-tower",
  1647. "heartburn",
  1648. "heat-haze",
  1649. "heavy-arrow",
  1650. "heavy-fall",
  1651. "heavy-helm",
  1652. "heavy-rain",
  1653. "heavy-timer",
  1654. "helmet",
  1655. "help",
  1656. "hidden",
  1657. "high-grass",
  1658. "high-shot",
  1659. "histogram",
  1660. "hive",
  1661. "hole-ladder",
  1662. "holy-grail",
  1663. "holy-symbol",
  1664. "honeycomb",
  1665. "honeypot",
  1666. "hood",
  1667. "hoof",
  1668. "horizontal-flip",
  1669. "horn-internal",
  1670. "horned-helm",
  1671. "horned-skull",
  1672. "horse-head",
  1673. "horseshoe",
  1674. "hospital-cross",
  1675. "hot-spices",
  1676. "hot-surface",
  1677. "hound",
  1678. "hourglass",
  1679. "house",
  1680. "human-ear",
  1681. "hunting-horn",
  1682. "hydra-shot",
  1683. "hydra",
  1684. "hypersonic-bolt",
  1685. "hypodermic-test",
  1686. "i-brick",
  1687. "ice-bolt",
  1688. "ice-bomb",
  1689. "ice-cream-cone",
  1690. "ice-cube",
  1691. "ice-pop",
  1692. "ice-shield",
  1693. "ice-spear",
  1694. "icebergs",
  1695. "ifrit",
  1696. "igloo",
  1697. "imbricated-arrows",
  1698. "imp-laugh",
  1699. "imp",
  1700. "impact-point",
  1701. "implosion",
  1702. "imprisoned",
  1703. "incense",
  1704. "incisors",
  1705. "infested-mass",
  1706. "ink-swirl",
  1707. "inner-self",
  1708. "insect-jaws",
  1709. "interdiction",
  1710. "internal-injury",
  1711. "internal-organ",
  1712. "interstellar-path",
  1713. "invisible-face",
  1714. "invisible",
  1715. "iron-mask",
  1716. "j-brick",
  1717. "james-bond-aperture",
  1718. "jawbone",
  1719. "jellyfish",
  1720. "jet-pack",
  1721. "jetpack",
  1722. "jeweled-chalice",
  1723. "jigsaw-box",
  1724. "jigsaw-piece",
  1725. "journey",
  1726. "juggler",
  1727. "justice-star",
  1728. "kaleidoscope-pearls",
  1729. "kevlar",
  1730. "key",
  1731. "keyboard",
  1732. "kindle",
  1733. "king",
  1734. "kitchen-knives",
  1735. "knapsack",
  1736. "knife-fork",
  1737. "knife-thrust",
  1738. "l-brick",
  1739. "lamellar",
  1740. "lamprey-mouth",
  1741. "land-mine",
  1742. "lantern-flame",
  1743. "lantern",
  1744. "laser-blast",
  1745. "laser-gun",
  1746. "laser-sparks",
  1747. "laser-warning",
  1748. "laserburn",
  1749. "lasso",
  1750. "laurel-crown",
  1751. "laurels",
  1752. "lava",
  1753. "law-star",
  1754. "layered-armor",
  1755. "leaf-skeleton",
  1756. "leaf-swirl",
  1757. "leaky-skull",
  1758. "leather-boot",
  1759. "leather-vest",
  1760. "leeching-worm",
  1761. "leo",
  1762. "letter-bomb",
  1763. "level-four-advanced",
  1764. "level-four",
  1765. "level-three-advanced",
  1766. "level-three",
  1767. "level-two-advanced",
  1768. "level-two",
  1769. "lever",
  1770. "libra",
  1771. "life-buoy",
  1772. "life-in-the-balance",
  1773. "life-support",
  1774. "life-tap",
  1775. "lift",
  1776. "light-bulb",
  1777. "lighthouse",
  1778. "lightning-arc",
  1779. "lightning-bow",
  1780. "lightning-branches",
  1781. "lightning-frequency",
  1782. "lightning-helix",
  1783. "lightning-shield",
  1784. "lightning-shout",
  1785. "lightning-storm",
  1786. "lightning-tear",
  1787. "lightning-trio",
  1788. "linked-rings",
  1789. "lion",
  1790. "lips",
  1791. "lit-candelabra",
  1792. "lizard-tongue",
  1793. "lizardman",
  1794. "load",
  1795. "lob-arrow",
  1796. "locked-chest",
  1797. "locked-fortress",
  1798. "look-at",
  1799. "lotus-flower",
  1800. "lotus",
  1801. "love-howl",
  1802. "love-song",
  1803. "lucifer-cannon",
  1804. "lungs",
  1805. "lyre",
  1806. "mace-head",
  1807. "machete",
  1808. "mad-scientist",
  1809. "maggot",
  1810. "magic-gate",
  1811. "magic-lamp",
  1812. "magic-palm",
  1813. "magic-portal",
  1814. "magic-shield",
  1815. "magic-swirl",
  1816. "magnet-blast",
  1817. "magnet",
  1818. "magnifying-glass",
  1819. "mail-shirt",
  1820. "mailed-fist",
  1821. "male",
  1822. "manacles",
  1823. "mantrap",
  1824. "maple-leaf",
  1825. "marbles",
  1826. "marrow-drain",
  1827. "martini",
  1828. "masked-spider",
  1829. "mass-driver",
  1830. "match-head",
  1831. "materials-science",
  1832. "maze",
  1833. "meat-cleaver",
  1834. "meat-hook",
  1835. "meat",
  1836. "mechanical-arm",
  1837. "medal-skull",
  1838. "medal",
  1839. "medical-pack-alt",
  1840. "medical-pack",
  1841. "meditation",
  1842. "meeple",
  1843. "mesh-ball",
  1844. "metal-bar",
  1845. "metal-disc",
  1846. "metal-hand",
  1847. "meteor-impact",
  1848. "microchip",
  1849. "microphone",
  1850. "microscope-lens",
  1851. "mighty-boosh",
  1852. "mine-wagon",
  1853. "mineral-heart",
  1854. "minigun",
  1855. "mining",
  1856. "minions",
  1857. "minotaur",
  1858. "miracle-medecine",
  1859. "mirror-mirror",
  1860. "missile-mech",
  1861. "missile-pod",
  1862. "missile-swarm",
  1863. "mite-alt",
  1864. "mite",
  1865. "mixed-swords",
  1866. "moebius-star",
  1867. "moebius-triangle",
  1868. "molecule",
  1869. "molotov",
  1870. "monkey",
  1871. "moon-claws",
  1872. "moon",
  1873. "morbid-humour",
  1874. "mountain-cave",
  1875. "mountains",
  1876. "mountaintop",
  1877. "mouse",
  1878. "mouth-watering",
  1879. "move",
  1880. "movement-sensor",
  1881. "mp5",
  1882. "mucous-pillar",
  1883. "muscle-fat",
  1884. "muscle-up",
  1885. "mushroom-cloud",
  1886. "mushroom-gills",
  1887. "mushroom",
  1888. "nailed-foot",
  1889. "nailed-head",
  1890. "nails",
  1891. "needle-drill",
  1892. "needle-jaws",
  1893. "night-sky",
  1894. "ninja-mask",
  1895. "nodular",
  1896. "nothing-to-say",
  1897. "nuclear",
  1898. "o-brick",
  1899. "oak",
  1900. "obelisk",
  1901. "ocarina",
  1902. "octopus",
  1903. "omega",
  1904. "on-target",
  1905. "one-eyed",
  1906. "open-book",
  1907. "open-wound",
  1908. "ophiuchus",
  1909. "oppression",
  1910. "orb-direction",
  1911. "orb-wand",
  1912. "orbital",
  1913. "ouroboros",
  1914. "over-infinity",
  1915. "overdose",
  1916. "overdrive",
  1917. "overhead",
  1918. "overkill",
  1919. "overmind",
  1920. "owl",
  1921. "padlock",
  1922. "palette",
  1923. "palm-tree",
  1924. "palm",
  1925. "panda",
  1926. "panzerfaust",
  1927. "paper-bomb",
  1928. "paper-lantern",
  1929. "paper",
  1930. "papers",
  1931. "parachute",
  1932. "paranoia",
  1933. "parmecia",
  1934. "parrot-head",
  1935. "paw-front",
  1936. "paw-heart",
  1937. "paw",
  1938. "pawn",
  1939. "pawprint",
  1940. "pencil",
  1941. "perfume-bottle",
  1942. "perpendicular-rings",
  1943. "perspective-dice-six-faces-five",
  1944. "perspective-dice-six-faces-four",
  1945. "perspective-dice-six-faces-one",
  1946. "perspective-dice-six-faces-random",
  1947. "perspective-dice-six-faces-six",
  1948. "perspective-dice-six-faces-three",
  1949. "perspective-dice-six-faces-two",
  1950. "phone",
  1951. "piano-keys",
  1952. "pie-slice",
  1953. "pierced-body",
  1954. "pierced-heart",
  1955. "pig-face",
  1956. "pikeman",
  1957. "pill-drop",
  1958. "pill",
  1959. "pincers",
  1960. "pine-tree",
  1961. "ping-pong-bat",
  1962. "pirate-grave",
  1963. "pirate-skull",
  1964. "pisces",
  1965. "pistol-gun",
  1966. "pizza-cutter",
  1967. "plain-dagger",
  1968. "planks",
  1969. "plasma-bolt",
  1970. "plastron",
  1971. "pocket-bow",
  1972. "podium",
  1973. "pointing",
  1974. "pointy-hat",
  1975. "poison-bottle",
  1976. "poison-cloud",
  1977. "poison-gas",
  1978. "poison",
  1979. "pokecog",
  1980. "poker-hand",
  1981. "pollen-dust",
  1982. "portculis",
  1983. "potion-ball",
  1984. "pounce",
  1985. "pouring-chalice",
  1986. "powder",
  1987. "prayer",
  1988. "present",
  1989. "pretty-fangs",
  1990. "private",
  1991. "processor",
  1992. "profit",
  1993. "psychic-waves",
  1994. "pulse",
  1995. "pummeled",
  1996. "pumpkin-lantern",
  1997. "pumpkin-mask",
  1998. "punch",
  1999. "puppet",
  2000. "pyromaniac",
  2001. "quake-stomp",
  2002. "queen-crown",
  2003. "quick-slash",
  2004. "quicksand",
  2005. "quill-ink",
  2006. "quill",
  2007. "rabbit",
  2008. "radar-dish",
  2009. "radar-sweep",
  2010. "radial-balance",
  2011. "radioactive",
  2012. "ragged-wound",
  2013. "railway",
  2014. "rainbow-star",
  2015. "raining",
  2016. "rally-the-troops",
  2017. "ram",
  2018. "rapidshare-arrow",
  2019. "raven",
  2020. "ray-gun",
  2021. "razor-blade",
  2022. "reactor",
  2023. "reaper-scythe",
  2024. "recycle",
  2025. "regeneration",
  2026. "relic-blade",
  2027. "reticule",
  2028. "revolt",
  2029. "revolver",
  2030. "ribbon",
  2031. "ribcage",
  2032. "rifle",
  2033. "ringed-planet",
  2034. "ringing-bell",
  2035. "riot-shield",
  2036. "roast-chicken",
  2037. "robe",
  2038. "robot-golem",
  2039. "rock",
  2040. "rocket-flight",
  2041. "rocket",
  2042. "rogue",
  2043. "rolling-bomb",
  2044. "rosa-shield",
  2045. "rose",
  2046. "rough-wound",
  2047. "round-bottom-flask",
  2048. "round-shield",
  2049. "round-star",
  2050. "royal-love",
  2051. "rss",
  2052. "run",
  2053. "rune-stone",
  2054. "rune-sword",
  2055. "s-brick",
  2056. "saber-slash",
  2057. "saber-tooth",
  2058. "sabers-choc",
  2059. "sacrificial-dagger",
  2060. "sad-crab",
  2061. "sagittarius",
  2062. "sai",
  2063. "sailboat",
  2064. "salamander",
  2065. "salt-shaker",
  2066. "sands-of-time",
  2067. "saphir",
  2068. "sattelite",
  2069. "save",
  2070. "saw-claw",
  2071. "scale-mail",
  2072. "scales",
  2073. "scallop",
  2074. "scalpel-strike",
  2075. "scalpel",
  2076. "scar-wound",
  2077. "scarab-beetle",
  2078. "scarecrow",
  2079. "scissors",
  2080. "scorpio",
  2081. "scorpion-tail",
  2082. "scorpion",
  2083. "screaming",
  2084. "screen-impact",
  2085. "screwdriver",
  2086. "scroll-unfurled",
  2087. "scythe",
  2088. "sea-dragon",
  2089. "sea-serpent",
  2090. "seated-mouse",
  2091. "select",
  2092. "self-love",
  2093. "semi-closed-eye",
  2094. "sentry-gun",
  2095. "sergeant",
  2096. "serrated-slash",
  2097. "sewing-needle",
  2098. "shaking-hands",
  2099. "shard-sword",
  2100. "shark-jaws",
  2101. "sharp-crown",
  2102. "sharp-smile",
  2103. "shatter",
  2104. "shattered-glass",
  2105. "shattered-sword",
  2106. "sheep",
  2107. "sheikah-eye",
  2108. "shield-echoes",
  2109. "shield-reflect",
  2110. "shield",
  2111. "shieldcomb",
  2112. "shining-claw",
  2113. "shining-heart",
  2114. "shining-sword",
  2115. "shiny-apple",
  2116. "shiny-iris",
  2117. "shiny-purse",
  2118. "shotgun",
  2119. "shoulder-scales",
  2120. "shouting",
  2121. "shuriken",
  2122. "sickle",
  2123. "sideswipe",
  2124. "siege-tower",
  2125. "silence",
  2126. "sing",
  2127. "six-eyes",
  2128. "skeleton-inside",
  2129. "skeleton-key",
  2130. "skid-mark",
  2131. "skull-bolt",
  2132. "skull-crack",
  2133. "skull-crossed-bones",
  2134. "skull-in-jar",
  2135. "skull-mask",
  2136. "skull-ring",
  2137. "skull-shield",
  2138. "skull-signet",
  2139. "slap",
  2140. "slashed-shield",
  2141. "slavery-whip",
  2142. "sleepy",
  2143. "sliced-bread",
  2144. "slow-blob",
  2145. "sly",
  2146. "small-fire",
  2147. "smitten",
  2148. "smoking-finger",
  2149. "smoking-pipe",
  2150. "snail",
  2151. "snake-bite",
  2152. "snake-totem",
  2153. "snake",
  2154. "snatch",
  2155. "snorkel",
  2156. "snow-bottle",
  2157. "snowflake-1",
  2158. "snowflake-2",
  2159. "snowing",
  2160. "snowman",
  2161. "soccer-ball",
  2162. "sonic-boom",
  2163. "sonic-screech",
  2164. "sonic-shout",
  2165. "space-suit",
  2166. "spade-skull",
  2167. "spade",
  2168. "spanner",
  2169. "sparkling-sabre",
  2170. "sparky-bomb",
  2171. "sparrow",
  2172. "spartan",
  2173. "spatter",
  2174. "spawn-node",
  2175. "speaker",
  2176. "spears",
  2177. "spectacle-lenses",
  2178. "spectacles",
  2179. "spectre",
  2180. "spider-alt",
  2181. "spider-face",
  2182. "spikeball",
  2183. "spiked-armor",
  2184. "spiked-collar",
  2185. "spiked-fence",
  2186. "spiked-mace",
  2187. "spiked-shell",
  2188. "spiked-snail",
  2189. "spiked-tentacle",
  2190. "spikes-full",
  2191. "spikes-half",
  2192. "spikes-init",
  2193. "spikes",
  2194. "spiky-eclipse",
  2195. "spiky-field",
  2196. "spill",
  2197. "spinal-coil",
  2198. "spine-arrow",
  2199. "spinning-blades",
  2200. "spinning-sword",
  2201. "spiral-arrow",
  2202. "spiral-bloom",
  2203. "spiral-bottle",
  2204. "spiral-shell",
  2205. "spiral-thrust",
  2206. "splash",
  2207. "split-body",
  2208. "split-cross",
  2209. "splurt",
  2210. "spoon",
  2211. "spoted-flower",
  2212. "spotted-mushroom",
  2213. "spotted-wound",
  2214. "spoutnik",
  2215. "spray",
  2216. "sprint",
  2217. "sprout-disc",
  2218. "sprout",
  2219. "spyglass",
  2220. "square-bottle",
  2221. "squib",
  2222. "squid-head",
  2223. "squid",
  2224. "stag-head",
  2225. "stairs",
  2226. "stalagtite",
  2227. "star-prominences",
  2228. "star-pupil",
  2229. "star-sattelites",
  2230. "star-swirl",
  2231. "staryu",
  2232. "static-waves",
  2233. "static",
  2234. "steel-claws",
  2235. "steeltoe-boots",
  2236. "steelwing-emblem",
  2237. "steering-wheel",
  2238. "stick-splitting",
  2239. "sticking-plaster",
  2240. "stigmata",
  2241. "stiletto",
  2242. "stitched-wound",
  2243. "stomp",
  2244. "stone-axe",
  2245. "stone-block",
  2246. "stone-bridge",
  2247. "stone-crafting",
  2248. "stone-pile",
  2249. "stone-spear",
  2250. "stone-sphere",
  2251. "stone-tablet",
  2252. "stone-throne",
  2253. "stone-tower",
  2254. "stopwatch",
  2255. "strafe",
  2256. "striking-balls",
  2257. "striking-diamonds",
  2258. "strong",
  2259. "submarine",
  2260. "suckered-tentacle",
  2261. "suicide",
  2262. "suits",
  2263. "sun-cloud",
  2264. "sun",
  2265. "sunbeams",
  2266. "sundial",
  2267. "sunken-eye",
  2268. "sunrise",
  2269. "super-mushroom",
  2270. "supersonic-arrow",
  2271. "supersonic-bullet",
  2272. "surprised-skull",
  2273. "surprised",
  2274. "suspicious",
  2275. "swallow",
  2276. "swamp",
  2277. "swan",
  2278. "swap-bag",
  2279. "sword-array",
  2280. "sword-break",
  2281. "sword-clash",
  2282. "sword-hilt",
  2283. "sword-in-stone",
  2284. "sword-slice",
  2285. "sword-smithing",
  2286. "sword-spade",
  2287. "sword-spin",
  2288. "syringe",
  2289. "t-brick",
  2290. "table",
  2291. "tank",
  2292. "target-arrows",
  2293. "target-dummy",
  2294. "target-laser",
  2295. "target-shot",
  2296. "targeted",
  2297. "targeting",
  2298. "tattered-banner",
  2299. "taurus",
  2300. "teapot",
  2301. "tear-tracks",
  2302. "techno-heart",
  2303. "telefrag",
  2304. "telepathy",
  2305. "teleport",
  2306. "templar-heart",
  2307. "templar-shield",
  2308. "temptation",
  2309. "tennis-ball",
  2310. "tentacle-strike",
  2311. "tentacurl",
  2312. "terror",
  2313. "tesla-coil",
  2314. "tesla-turret",
  2315. "tesla",
  2316. "test-tubes",
  2317. "thermometer-scale",
  2318. "third-eye",
  2319. "thor-fist",
  2320. "thorn-helix",
  2321. "thorned-arrow",
  2322. "thorny-vine",
  2323. "three-keys",
  2324. "three-leaves",
  2325. "thrown-charcoal",
  2326. "thrown-daggers",
  2327. "thrown-knife",
  2328. "thrown-spear",
  2329. "thrust",
  2330. "thunder-skull",
  2331. "thunder-struck",
  2332. "thunderball",
  2333. "tic-tac-toe",
  2334. "tick",
  2335. "tied-scroll",
  2336. "tiger",
  2337. "time-bomb",
  2338. "time-trap",
  2339. "tinker",
  2340. "toad-teeth",
  2341. "tombstone",
  2342. "tooth",
  2343. "top-hat",
  2344. "top-paw",
  2345. "torch",
  2346. "tornado",
  2347. "totem-head",
  2348. "tower-fall",
  2349. "trade",
  2350. "trample",
  2351. "transform",
  2352. "transfuse",
  2353. "transportation-rings",
  2354. "trash-can",
  2355. "tread",
  2356. "treasure-map",
  2357. "trebuchet",
  2358. "tree-branch",
  2359. "trefoil-lily",
  2360. "trefoil-shuriken",
  2361. "tribal-mask",
  2362. "trident",
  2363. "triforce",
  2364. "trigger-hurt",
  2365. "trilobite",
  2366. "triorb",
  2367. "triple-claws",
  2368. "triple-corn",
  2369. "triple-lock",
  2370. "triple-needle",
  2371. "triple-skulls",
  2372. "triple-yin",
  2373. "tripwire",
  2374. "tron-arrow",
  2375. "trophy",
  2376. "trousers",
  2377. "tumor",
  2378. "tune-pitch",
  2379. "turd",
  2380. "turret",
  2381. "turtle-shell",
  2382. "turtle",
  2383. "twirly-flower",
  2384. "twister",
  2385. "two-feathers",
  2386. "two-shadows",
  2387. "tyre",
  2388. "ubisoft-sun",
  2389. "udder",
  2390. "ultrasound",
  2391. "umbrella",
  2392. "uncertainty",
  2393. "underhand",
  2394. "unfriendly-fire",
  2395. "unlit-bomb",
  2396. "unlit-candelabra",
  2397. "unlocking",
  2398. "unplugged",
  2399. "unstable-projectile",
  2400. "usable",
  2401. "valley",
  2402. "vanilla-flower",
  2403. "vertical-flip",
  2404. "vial",
  2405. "vile-fluid",
  2406. "vine-flower",
  2407. "vine-leaf",
  2408. "vine-whip",
  2409. "vintage-robot",
  2410. "viola",
  2411. "virgo",
  2412. "virus",
  2413. "visored-helm",
  2414. "volcano",
  2415. "vomiting",
  2416. "voodoo-doll",
  2417. "vortex",
  2418. "vulture",
  2419. "walkie-talkie",
  2420. "walking-boot",
  2421. "wasp-sting",
  2422. "watchtower",
  2423. "water-bolt",
  2424. "water-drop",
  2425. "water-splash",
  2426. "wave-crest",
  2427. "wave-strike",
  2428. "wavy-chains",
  2429. "wavy-itinerary",
  2430. "wax-seal",
  2431. "web-spit",
  2432. "weight-crush",
  2433. "wheat",
  2434. "whip",
  2435. "whiplash",
  2436. "whirlwind",
  2437. "white-book",
  2438. "white-cat",
  2439. "white-tower",
  2440. "wildfires",
  2441. "william-tell",
  2442. "windmill",
  2443. "windy-stripes",
  2444. "wine-glass",
  2445. "wing-cloak",
  2446. "winged-arrow",
  2447. "winged-emblem",
  2448. "winged-shield",
  2449. "winged-sword",
  2450. "wingfoot",
  2451. "witch-flight",
  2452. "wizard-staff",
  2453. "wolf-head",
  2454. "wolf-howl",
  2455. "wolf-trap",
  2456. "wolverine-claws",
  2457. "wood-axe",
  2458. "wood-pile",
  2459. "wooden-door",
  2460. "wooden-sign",
  2461. "world",
  2462. "worm-mouth",
  2463. "worried-eyes",
  2464. "wrapped-heart",
  2465. "wrapped-sweet",
  2466. "wrecking-ball",
  2467. "wrench",
  2468. "wyvern",
  2469. "yin-yang",
  2470. "z-brick",
  2471. "zebra-shield",
  2472. "zeus-sword",
  2473. "zig-arrow",
  2474. "zigzag-cage",
  2475. "zigzag-leaf",
  2476. "zigzag-tune"
  2477. ];
  2478. })(RpgCardsUI || (RpgCardsUI = {}));
  2479. var RpgCardsUI;
  2480. (function (RpgCardsUI) {
  2481. RpgCardsUI.card_data_example = [
  2482. {
  2483. "count": 1,
  2484. "color": "maroon",
  2485. "title": "Burning Hands",
  2486. "icon": "book-cover",
  2487. "icon_back": "robe",
  2488. "contents": [
  2489. "subtitle | 1st level evocation",
  2490. "rule",
  2491. "property | Casting time | 1 action",
  2492. "property | Range | Self (15ft cone)",
  2493. "property | Components | V,S",
  2494. "rule",
  2495. "fill | 2",
  2496. "text | Each creature in a 15-foot cone must make a Dexterity saving throw. A creature takes <b>3d6 fire damage</b> on a failed save, or half as much damage on a successful one.",
  2497. "text | The fire ignites any flammable objects in the area that aren't being worn or carried.",
  2498. "fill | 3",
  2499. "section | At higher levels",
  2500. "text | +1d6 damage for each slot above 1st"
  2501. ],
  2502. "tags": ["spell", "mage"]
  2503. },
  2504. {
  2505. "count": 1,
  2506. "color": "indigo",
  2507. "title": "Cunning Action",
  2508. "icon": "white-book",
  2509. "icon_back": "cloak-dagger",
  2510. "contents": [
  2511. "subtitle | Rogue feature",
  2512. "rule",
  2513. "fill | 2",
  2514. "text | You can take a <b>bonus action on each of your turns</b> in combat. This action can be used only to take the <b>Dash, Disengage, or Hide</b> action.",
  2515. "fill | 2",
  2516. "section | Fast hands (Thief 3rd)",
  2517. "text | You can also use the bonus action to make a Dexterity (<b>Sleight of Hand</b>) check, use your thieves' tools to <b>disarm a trap</b> or <b>open a lock</b>, or take the <b>Use an Object</b> action."
  2518. ],
  2519. "tags": ["feature", "rogue"]
  2520. },
  2521. {
  2522. "count": 1,
  2523. "color": "dimgray",
  2524. "title": "Full Plate",
  2525. "icon": "breastplate",
  2526. "contents": [
  2527. "subtitle | Heavy armor (1500gp)",
  2528. "rule",
  2529. "property | AC | 18",
  2530. "property | Strength required | 15",
  2531. "property | Stealth | Disadvantage",
  2532. "rule",
  2533. "fill | 2",
  2534. "description | Heavy | Unless you have the required strength, your speed is reduced by 10 feet.",
  2535. "description | Stealth | You have disadvantage on Dexterity (Stealth) checks.",
  2536. "fill | 3"
  2537. ],
  2538. "tags": ["item", "armor"]
  2539. },
  2540. {
  2541. "count": 1,
  2542. "color": "dimgray",
  2543. "title": "Dagger",
  2544. "icon": "mixed-swords",
  2545. "contents": [
  2546. "subtitle | Simple melee weapon (2gp)",
  2547. "rule",
  2548. "property | Damage | 1d4 piercing",
  2549. "property | Modifier | Strength or Dexterity",
  2550. "property | Properties | Light, Finesse, Thrown (20/60)",
  2551. "rule",
  2552. "fill | 2",
  2553. "description | Finesse | Use your choice of Strength or Dexterity modifier for attack and damage.",
  2554. "description | Light | When you attack while dual wielding light weapons, you may use a bonus action to attack with your off hand.",
  2555. "description | Thrown | You can throw the weapon to make a ranged attack with the given range.",
  2556. "fill | 3"
  2557. ],
  2558. "tags": ["item", "weapon"]
  2559. },
  2560. {
  2561. "count": 1,
  2562. "color": "dimgray",
  2563. "title": "Shortsword of Very Long Names",
  2564. "title_size": "10",
  2565. "icon": "crossed-swords",
  2566. "contents": [
  2567. "subtitle | Simple melee weapon (10gp)",
  2568. "rule",
  2569. "property | Damage | 1d6 piercing",
  2570. "property | Modifier | Strength or Dexterity",
  2571. "property | Properties | Light, Finesse",
  2572. "rule",
  2573. "fill | 2",
  2574. "description | Finesse | Use your choice of Strength or Dexterity modifier for attack and damage.",
  2575. "description | Light | When you attack while dual wielding light weapons, you may use a bonus action to attack with your off hand.",
  2576. "fill | 3"
  2577. ],
  2578. "tags": ["item", "weapon", "magic"]
  2579. },
  2580. {
  2581. "count": 1,
  2582. "color": "dimgray",
  2583. "title": "Wand of Magic Missiles",
  2584. "icon": "crystal-wand",
  2585. "contents": [
  2586. "subtitle | Wondrous item",
  2587. "rule",
  2588. "property | Maximum charges | 7",
  2589. "property | Recharge | 1d6+1 each day",
  2590. "property | Depletion | If you expend the last charge, roll a d20. On a 1, the item is destroyed.",
  2591. "rule",
  2592. "fill | 2",
  2593. "description | Spells | You can use your action to cast the following spells:",
  2594. "bullet | magic missile, 1st level (1 charge)",
  2595. "bullet | magic missile, 2nd level (2 charges)",
  2596. "bullet | magic missile, 3rd level (3 charges)",
  2597. "fill | 3",
  2598. "boxes | 7 | 2.5"
  2599. ],
  2600. "tags": ["item", "wondrous-item", "magic"]
  2601. },
  2602. {
  2603. "count": 2,
  2604. "color": "dimgray",
  2605. "title": "Potion of Healing",
  2606. "icon": "drink-me",
  2607. "contents": [
  2608. "subtitle | Potion (50gp)",
  2609. "rule",
  2610. "property | Use time | 1 action",
  2611. "property | Hit points restored | 2d4+2",
  2612. "rule",
  2613. "fill | 2",
  2614. "text | When you drink this potion, you regain 2d4+2 hitpoints.",
  2615. "text | Drinking or administering a potion takes 1 action.",
  2616. "fill | 3"
  2617. ],
  2618. "tags": ["item", "consumable"]
  2619. },
  2620. {
  2621. "count": 1,
  2622. "color": "black",
  2623. "title": "Goblin",
  2624. "icon": "imp-laugh",
  2625. "contents": [
  2626. "subtitle | Small humanoid (goblinoid)",
  2627. "rule",
  2628. "property | Armor class | 15 (leather armor, shield)",
  2629. "property | Hit points | 7 (2d6)",
  2630. "rule",
  2631. "dndstats | 8 | 14 | 10 | 10 | 8 | 8",
  2632. "rule",
  2633. "property | Skills | Stealth +6",
  2634. "property | Challenge | 1/4 (50 XP)",
  2635. "rule",
  2636. "description | Nimble escape | Disengage or Hide as bonus action",
  2637. "fill | 2",
  2638. "section | Actions",
  2639. "description | Scimitar | Melee Weapon Attack: +4 to hit, reach 5 ft., one target. Hit: 5 (1d6 + 2) slashing damage"
  2640. ],
  2641. "tags": ["creature", "humanoid"]
  2642. }
  2643. ];
  2644. })(RpgCardsUI || (RpgCardsUI = {}));
  2645. /// <reference path="./card.ts" />
  2646. /// <reference path="./colors.ts" />
  2647. /// <reference path="./icons.ts" />
  2648. /// <reference path="./example_data.ts" />
  2649. /// <reference path="./jquery.d.ts" />
  2650. /// <reference path="./ace.d.ts" />
  2651. /// <reference path="./shortcut.d.ts" />
  2652. var RpgCardsUI;
  2653. (function (RpgCardsUI) {
  2654. var deck = null;
  2655. var options = null;
  2656. var cardGenerator = null;
  2657. var pageGenerator = null;
  2658. var editor;
  2659. var editorFilter;
  2660. var editorSort;
  2661. var update_in_progress = false;
  2662. // ============================================================================
  2663. // Seleted card
  2664. // ============================================================================
  2665. function selected_card_index() {
  2666. return parseInt($("#selected-card").val(), 10);
  2667. }
  2668. function selected_card() {
  2669. var index = selected_card_index();
  2670. if (deck.cards.length > index) {
  2671. return deck.cards[index];
  2672. }
  2673. else {
  2674. return null;
  2675. }
  2676. }
  2677. function select_card_by_index(index) {
  2678. var size = deck.cards.length;
  2679. if (size === 0) {
  2680. $("#selected-card").val("");
  2681. update_selected_card();
  2682. }
  2683. else {
  2684. index = Math.min(size - 1, index);
  2685. index = Math.max(0, index);
  2686. if (index != selected_card_index()) {
  2687. $("#selected-card").val("" + index);
  2688. update_selected_card();
  2689. }
  2690. }
  2691. }
  2692. function select_first_card() {
  2693. select_card_by_index(0);
  2694. }
  2695. function select_last_card() {
  2696. select_card_by_index(deck.cards.length - 1);
  2697. }
  2698. function select_next_card() {
  2699. select_card_by_index(selected_card_index() + 1);
  2700. }
  2701. function select_prev_card() {
  2702. select_card_by_index(selected_card_index() - 1);
  2703. }
  2704. function select_card_by_card(card) {
  2705. var index = deck.cards.indexOf(card);
  2706. select_card_by_index(index);
  2707. }
  2708. // ============================================================================
  2709. // Rendering
  2710. // ============================================================================
  2711. function render_selected_card() {
  2712. if (update_in_progress) {
  2713. return;
  2714. }
  2715. var card = selected_card();
  2716. $('#preview-container').empty();
  2717. if (card) {
  2718. var front = cardGenerator.card_front(card, options, " ");
  2719. var back = cardGenerator.card_back(card, options, " ");
  2720. $('#preview-container').html(front + "\n" + back);
  2721. }
  2722. }
  2723. function update_selected_card() {
  2724. update_in_progress = true;
  2725. var card = selected_card();
  2726. if (card) {
  2727. $("#card-title").val(card.title);
  2728. $("#card-title-size").val(card.title_size);
  2729. $("#card-title-icon-text").val(card.title_icon_text);
  2730. $("#card-count").val("" + card.count);
  2731. $("#card-icon").val(card.icon);
  2732. $("#card-icon-back").val(card.icon_back);
  2733. //$("#card-contents").val(card.contents.join("\n"));
  2734. editor.setValue(card.contents.join("\n"), -1);
  2735. $("#card-tags").val(card.tags.join(", "));
  2736. $("#card-color").val(card.color).change();
  2737. }
  2738. else {
  2739. $("#card-title").val("");
  2740. $("#card-title-size").val("");
  2741. $("#card-title-icon-text").val("");
  2742. $("#card-count").val("1");
  2743. $("#card-icon").val("");
  2744. $("#card-icon-back").val("");
  2745. //$("#card-contents").val("");
  2746. editor.setValue("");
  2747. $("#card-tags").val("");
  2748. $("#card-color").val("").change();
  2749. }
  2750. update_in_progress = false;
  2751. render_selected_card();
  2752. }
  2753. function update_card_list() {
  2754. deck.commit();
  2755. $("#total_card_count").text("This deck contains " + deck.cards.length + " unique cards.");
  2756. $('#selected-card').empty();
  2757. for (var i = 0; i < deck.cards.length; ++i) {
  2758. var card = deck.cards[i];
  2759. $('#selected-card').append($("<option></option>").attr("value", i).text(card.title));
  2760. }
  2761. update_selected_card();
  2762. }
  2763. // ============================================================================
  2764. // Color picker
  2765. // ============================================================================
  2766. function setup_color_selector() {
  2767. // Insert colors
  2768. $.each(RpgCardsUI.card_colors, function (name, val) {
  2769. $(".colorselector-data").append($("<option></option>").attr("value", name).attr("data-color", val).text(name));
  2770. });
  2771. // Callbacks for when the user picks a color
  2772. $('#default_color_selector').colorselector({
  2773. callback: function (value, color, title) {
  2774. $("#default-color").val(title);
  2775. set_default_color(title);
  2776. }
  2777. });
  2778. $('#card_color_selector').colorselector({
  2779. callback: function (value, color, title) {
  2780. $("#card-color").val(title);
  2781. set_card_color(value);
  2782. }
  2783. });
  2784. $('#foreground_color_selector').colorselector({
  2785. callback: function (value, color, title) {
  2786. $("#foreground-color").val(title);
  2787. set_foreground_color(value);
  2788. }
  2789. });
  2790. $('#background_color_selector').colorselector({
  2791. callback: function (value, color, title) {
  2792. $("#background-color").val(title);
  2793. set_background_color(value);
  2794. }
  2795. });
  2796. // Styling
  2797. $(".dropdown-colorselector").addClass("input-group-addon color-input-addon");
  2798. }
  2799. function set_card_color(value) {
  2800. var card = selected_card();
  2801. if (card) {
  2802. card.color = value;
  2803. render_selected_card();
  2804. }
  2805. }
  2806. function set_default_color(color) {
  2807. options.default_color = color;
  2808. render_selected_card();
  2809. }
  2810. function set_foreground_color(color) {
  2811. options.foreground_color = color;
  2812. }
  2813. function set_background_color(color) {
  2814. options.background_color = color;
  2815. }
  2816. function update_card_color_selector(color, input, selector) {
  2817. if ($(selector + " option[value='" + color + "']").length > 0) {
  2818. // Update the color selector to the entered value
  2819. $(selector).colorselector("setValue", color);
  2820. }
  2821. else {
  2822. // Unknown color - select a neutral color and reset the text value
  2823. $(selector).colorselector("setValue", "");
  2824. input.val(color);
  2825. }
  2826. }
  2827. // ============================================================================
  2828. // Card values
  2829. // ============================================================================
  2830. function on_change_card_title() {
  2831. var title = $("#card-title").val();
  2832. var card = selected_card();
  2833. if (card) {
  2834. card.title = title;
  2835. $("#selected-card option:selected").text(title);
  2836. render_selected_card();
  2837. }
  2838. }
  2839. function on_change_card_color() {
  2840. var input = $(this);
  2841. var color = input.val();
  2842. update_card_color_selector(color, input, "#card_color_selector");
  2843. set_card_color(color);
  2844. }
  2845. function on_change_card_property() {
  2846. var property = $(this).attr("data-property");
  2847. var value = $(this).val();
  2848. var card = selected_card();
  2849. if (card) {
  2850. card[property] = value;
  2851. render_selected_card();
  2852. }
  2853. }
  2854. function on_change_card_contents() {
  2855. var value = editor.getValue();
  2856. var card = selected_card();
  2857. if (card) {
  2858. card.contents = value.split("\n");
  2859. render_selected_card();
  2860. }
  2861. }
  2862. function on_change_card_tags() {
  2863. var value = $(this).val();
  2864. var card = selected_card();
  2865. if (card) {
  2866. if (value.trim().length == 0) {
  2867. card.tags = [];
  2868. }
  2869. else {
  2870. card.tags = value.split(",").map(function (val) {
  2871. return val.trim().toLowerCase();
  2872. });
  2873. }
  2874. render_selected_card();
  2875. }
  2876. }
  2877. // ============================================================================
  2878. // Global default values
  2879. // ============================================================================
  2880. function on_change_option() {
  2881. var property = $(this).attr("data-option");
  2882. var value = $(this).val();
  2883. options[property] = value;
  2884. render_selected_card();
  2885. }
  2886. function on_change_default_color() {
  2887. var input = $(this);
  2888. var color = input.val();
  2889. update_card_color_selector(color, input, "#default_color_selector");
  2890. set_default_color(color);
  2891. }
  2892. function on_change_default_icon() {
  2893. var value = $(this).val();
  2894. options.default_icon = value;
  2895. render_selected_card();
  2896. }
  2897. function on_change_default_title_size() {
  2898. options.default_title_size = $(this).val();
  2899. render_selected_card();
  2900. }
  2901. function on_change_default_icon_size() {
  2902. options.icon_inline = $(this).is(':checked');
  2903. render_selected_card();
  2904. }
  2905. // ============================================================================
  2906. // Map/Filter
  2907. // ============================================================================
  2908. function apply_default_color() {
  2909. deck.cards.forEach(function (card) {
  2910. card.color = options.default_color;
  2911. });
  2912. render_selected_card();
  2913. }
  2914. function apply_default_icon() {
  2915. deck.cards.forEach(function (card) {
  2916. card.icon = options.default_icon;
  2917. });
  2918. render_selected_card();
  2919. }
  2920. function apply_default_icon_back() {
  2921. deck.cards.forEach(function (card) {
  2922. card.icon_back = options.default_icon;
  2923. });
  2924. render_selected_card();
  2925. }
  2926. function sort() {
  2927. showModal("#sort-modal");
  2928. }
  2929. function sort_execute() {
  2930. hideModal("#sort-modal");
  2931. var fn_code = editorSort.getValue();
  2932. var fn = new Function("card_a", "card_b", fn_code);
  2933. deck.cards = deck.cards.sort(function (card_a, card_b) {
  2934. var result = fn(card_a, card_b);
  2935. return result;
  2936. });
  2937. update_card_list();
  2938. }
  2939. function filter() {
  2940. showModal("#filter-modal");
  2941. }
  2942. function filter_execute() {
  2943. hideModal("#filter-modal");
  2944. var fn_code = editorFilter.getValue();
  2945. var fn = new Function("card", "deck", fn_code);
  2946. deck.cards.forEach(function (card) {
  2947. fn(card, deck);
  2948. });
  2949. deck.commit();
  2950. update_card_list();
  2951. }
  2952. // ============================================================================
  2953. // Modals
  2954. // ============================================================================
  2955. function showModal(id) {
  2956. $(id).modal('show');
  2957. }
  2958. function hideModal(id) {
  2959. $(id).modal('hide');
  2960. }
  2961. // ============================================================================
  2962. // I/O
  2963. // ============================================================================
  2964. function save_file() {
  2965. var str = JSON.stringify(deck.toJSON(), null, " ");
  2966. var parts = [str];
  2967. var blob = new Blob(parts, { type: 'application/json' });
  2968. var url = URL.createObjectURL(blob);
  2969. var a = $("#file-save-link")[0];
  2970. a.href = url;
  2971. a.download = "rpg_cards.json";
  2972. a.click();
  2973. setTimeout(function () {
  2974. URL.revokeObjectURL(url);
  2975. }, 1000);
  2976. }
  2977. function load_sample() {
  2978. deck = RpgCards.CardDeck.fromJSON(RpgCardsUI.card_data_example);
  2979. update_card_list();
  2980. }
  2981. function clear_all() {
  2982. deck = new RpgCards.CardDeck();
  2983. update_card_list();
  2984. }
  2985. function ui_load_files(evt) {
  2986. // ui_clear_all();
  2987. var files = evt.target.files;
  2988. for (var i = 0, f; f = files[i]; i++) {
  2989. var reader = new FileReader();
  2990. reader.onload = function (reader) {
  2991. var data = JSON.parse(this.result);
  2992. var deck = RpgCards.CardDeck.fromJSON(data);
  2993. add_cards(deck.cards);
  2994. };
  2995. reader.readAsText(f);
  2996. }
  2997. // Reset file input
  2998. $("#file-load-form")[0].reset();
  2999. }
  3000. function add_cards(cards) {
  3001. deck.addCards(cards);
  3002. update_card_list();
  3003. }
  3004. function add_new_card() {
  3005. deck.addNewCard();
  3006. update_card_list();
  3007. select_card_by_index(deck.cards.length - 1);
  3008. }
  3009. function duplicate_card() {
  3010. var newCard = null;
  3011. if (deck.cards.length > 0) {
  3012. var old_card = selected_card();
  3013. newCard = deck.duplicateCard(old_card);
  3014. }
  3015. else {
  3016. newCard = deck.addNewCard();
  3017. }
  3018. update_card_list();
  3019. select_card_by_card(newCard);
  3020. }
  3021. function delete_card() {
  3022. var index = selected_card_index();
  3023. var card = selected_card();
  3024. deck.deleteCard(card);
  3025. update_card_list();
  3026. select_card_by_index(Math.min(index, deck.cards.length - 1));
  3027. }
  3028. // ============================================================================
  3029. // Menu
  3030. // ============================================================================
  3031. function open_help() {
  3032. showModal("#help-modal");
  3033. }
  3034. function select_icon() {
  3035. window.open("http://game-icons.net/", "_blank");
  3036. }
  3037. var generate_modal_shown = false;
  3038. function generate() {
  3039. if (deck.cards.length === 0) {
  3040. alert("Your deck is empty. Please define some cards first, or load the sample deck.");
  3041. return;
  3042. }
  3043. // Generate output HTML
  3044. var card_html = pageGenerator.generateHtml(deck.cards, options);
  3045. // Open a new window for the output
  3046. // Use a separate window to avoid CSS conflicts
  3047. var tab = window.open("output.html", 'rpg-cards-output');
  3048. if (generate_modal_shown == false) {
  3049. showModal("#print-modal");
  3050. generate_modal_shown = true;
  3051. }
  3052. // Send the generated HTML to the new window
  3053. // Use a delay to give the new window time to set up a message listener
  3054. setTimeout(function () {
  3055. tab.postMessage(card_html, '*');
  3056. }, 500);
  3057. }
  3058. function collapse_menu() {
  3059. $("#menu-column").hide();
  3060. $("#card-column").removeClass("col-lg-5");
  3061. $("#card-column").addClass("col-lg-8");
  3062. editor.resize();
  3063. }
  3064. function uncollapse_menu() {
  3065. $("#menu-column").show();
  3066. $("#card-column").removeClass("col-lg-8");
  3067. $("#card-column").addClass("col-lg-5");
  3068. editor.resize();
  3069. }
  3070. function toggle_menu() {
  3071. if ($("#menu-column").is(":visible")) {
  3072. collapse_menu();
  3073. }
  3074. else {
  3075. uncollapse_menu();
  3076. }
  3077. }
  3078. RpgCardsUI.toggle_menu = toggle_menu;
  3079. // ============================================================================
  3080. // Initialization
  3081. // ============================================================================
  3082. function init() {
  3083. deck = new RpgCards.CardDeck();
  3084. options = new RpgCards.Options();
  3085. cardGenerator = new RpgCards.CardHtmlGenerator;
  3086. pageGenerator = new RpgCards.PageHtmlGenerator;
  3087. editor = ace.edit("card-contents");
  3088. editor.setShowInvisibles(true);
  3089. editor.renderer.setShowGutter(false);
  3090. editor.setOption("wrap", "free");
  3091. editor.setTheme("ace/theme/chrome");
  3092. editor.getSession().setMode("ace/mode/rpgcard");
  3093. editor.$blockScrolling = Infinity;
  3094. editorFilter = ace.edit("filter-function");
  3095. editorFilter.setShowInvisibles(true);
  3096. editorFilter.setTheme("ace/theme/chrome");
  3097. editorFilter.getSession().setMode("ace/mode/javascript");
  3098. editorSort = ace.edit("sort-function");
  3099. editorSort.setShowInvisibles(true);
  3100. editorSort.setTheme("ace/theme/chrome");
  3101. editorSort.getSession().setMode("ace/mode/javascript");
  3102. setup_color_selector();
  3103. $('.icon-list').typeahead({ source: RpgCardsUI.icon_names });
  3104. // Menu
  3105. $("#sort-execute").click(sort_execute);
  3106. $("#filter-execute").click(filter_execute);
  3107. $("#button-generate").click(generate);
  3108. $("#button-load").click(function () {
  3109. $("#file-load").click();
  3110. });
  3111. $("#file-load").change(ui_load_files);
  3112. $("#button-clear").click(clear_all);
  3113. $("#button-load-sample").click(load_sample);
  3114. $("#button-save").click(save_file);
  3115. $("#button-sort").click(sort);
  3116. $("#button-filter").click(filter);
  3117. $("#button-add-card").click(add_new_card);
  3118. $("#button-duplicate-card").click(duplicate_card);
  3119. $("#button-delete-card").click(delete_card);
  3120. $("#button-help").click(open_help);
  3121. $("#button-apply-color").click(apply_default_color);
  3122. $("#button-apply-icon").click(apply_default_icon);
  3123. $("#button-apply-icon-back").click(apply_default_icon_back);
  3124. $("#selected-card").change(update_selected_card);
  3125. $("#card-title").change(on_change_card_title);
  3126. $("#card-title-size").change(on_change_card_property);
  3127. $("#card-title-icon-text").change(on_change_card_property);
  3128. $("#card-icon").change(on_change_card_property);
  3129. $("#card-count").change(on_change_card_property);
  3130. $("#card-icon-back").change(on_change_card_property);
  3131. $("#card-color").change(on_change_card_color);
  3132. editor.getSession().on('change', on_change_card_contents);
  3133. //$("#card-contents").change(on_change_card_contents);
  3134. $("#card-tags").change(on_change_card_tags);
  3135. // Global options
  3136. $("#page-size").change(on_change_option);
  3137. $("#page-rows").change(on_change_option);
  3138. $("#page-columns").change(on_change_option);
  3139. $("#card-arrangement").change(on_change_option);
  3140. $("#card-size").change(on_change_option);
  3141. $("#background-color").change(on_change_option);
  3142. $("#default-color").change(on_change_default_color);
  3143. $("#default-icon").change(on_change_default_icon);
  3144. $("#default-title-size").change(on_change_default_title_size);
  3145. $("#small-icons").change(on_change_default_icon_size);
  3146. $(".icon-select-button").click(select_icon);
  3147. // Shortcuts
  3148. var shortcut_options = { disable_in_input: true };
  3149. shortcut.add("ctrl+m", toggle_menu, shortcut_options);
  3150. shortcut.add("ctrl+n", add_new_card, shortcut_options);
  3151. shortcut.add("ctrl+d", duplicate_card, shortcut_options);
  3152. shortcut.add("delete", delete_card, shortcut_options);
  3153. shortcut.add("down", select_next_card, shortcut_options);
  3154. shortcut.add("page_down", select_next_card, shortcut_options);
  3155. shortcut.add("up", select_prev_card, shortcut_options);
  3156. shortcut.add("page_up", select_prev_card, shortcut_options);
  3157. shortcut.add("home", select_first_card, shortcut_options);
  3158. shortcut.add("end", select_last_card, shortcut_options);
  3159. update_card_list();
  3160. }
  3161. $(document).ready(function () {
  3162. init();
  3163. });
  3164. })(RpgCardsUI || (RpgCardsUI = {}));
  3165. //# sourceMappingURL=ui.js.map