I'm a pen and paper role playing gamer and would like to have a searchable/sortable list of my spells to work in a browser without the need for a server - it should be able to run locally off my computer.
我是一个笔和纸的角色扮演游戏玩家,并希望有一个可搜索/可排序的我的法术列表,无需服务器即可在浏览器中工作 - 它应该可以在我的计算机本地运行。
Basically, I have a list of all existing spells with a few parameters like spell name, spell type, spell cost, etc. I want to be able to restrict the displayed list by spells belonging to one spell type and sort by various other parameters. Also, I will want to store the spell id and a yes/no flag locally in the browser to flag spells that I actually have access to. And I'll need a spell name search with resulting dropdown menu for spell selection (I've done dropdown menus before, I just don't know how to feed it without a server and ajax). The spell data is read-only, no changes need to be done to it. Yes, this is probably more non-coding related information than needed, but I'm hoping this will give you a better idea of what I need.
基本上,我有一个所有现有法术的列表,其中包含一些参数,如法术名称,法术类型,法术费用等。我希望能够通过属于一种法术类型的法术限制显示的列表,并按各种其他参数排序。此外,我还想在浏览器中本地存储拼写ID和是/否标志,以标记我实际可以访问的拼写。而且我需要一个拼写名称搜索以及用于拼写选择的结果下拉菜单(之前我已经完成了下拉菜单,我只是不知道如何在没有服务器和ajax的情况下提供它)。拼写数据是只读的,不需要对其进行任何更改。是的,这可能是非编码相关信息比需要的更多,但我希望这能让你更好地了解我的需求。
I've looked into HTML5 indexeddb but only found very limited and highly confusing information about it, and the previous HTML5 database system is marked as deprecated by the w3c (which may not mean anything, but I'd rather play it safe).
我已经研究过HTML5 indexeddb,但只发现了非常有限且高度混乱的信息,之前的HTML5数据库系统被w3c标记为弃用(这可能没什么意义,但我宁愿安全地玩它)。
I also would like the actual data to be "protected" in some way that a brief "show source code" won't immediately show the raw data (unless there's a better option out there), so I was thinking of having the input data be JSON and base64 encoded (both of which I have information on how to do) unless I can figure out the indexeddb stuff and how to have it populated during site load or something.
我还希望实际数据能够以某种方式被“保护”,即简短的“显示源代码”不会立即显示原始数据(除非有更好的选择),所以我想要输入数据是JSON和base64编码(我都有关于如何做的信息)除非我能找出indexeddb的东西以及如何在网站加载或其他东西中填充它。
I can handle the interface part of it all myself, I'm sure - when in doubt, I can even fall back on a table sorter for the sorting without the need to have that done by "database".
我可以自己处理它的界面部分,我敢肯定 - 当有疑问时,我甚至可以使用表格分类器进行排序,而无需通过“数据库”完成。
What I'm hoping for is a few places to start. I've spent days searching for stuff, but either I've entered the wrong search parameters, or there's just not that much indexeddb stuff out there yet. And the few pages I found were frankly a little above my understanding or going too fast for me with too little explanation.
我希望的是一些开始的地方。我花了好几天搜索东西,但是我输入了错误的搜索参数,或者那里还没有那么多的indexeddb东西。我找到的几页很坦率地说比我的理解还要高,或者对我来说太快了,解释得太少了。
Or maybe indexeddb is not even the way to go... That's where I need your advice. See, I've done basic javascript programming for 15 years or so and recently worked a bit more with jQuery, but that doesn't mean I've ever had any sort of training with either ;-) So this is brand-new territory for me.
或者也许indexeddb甚至没有办法......这就是我需要你的建议的地方。看,我已经完成了15年左右的基本javascript编程,并且最近使用jQuery进行了一些工作,但这并不意味着我曾经接受任何类型的培训;-)所以这是一个全新的领域为了我。
What I have now is an Excel file with the spells all listed and separated, and I'll just save that as CSV and convert it into whatever it needs to be - I can handle that. If need be, I'll write a quick PHP script to pick it apart and output it the way I need it to be, that's not a problem.
我现在拥有的是一个Excel文件,所有列出和分隔的法术,我只是将其保存为CSV并将其转换为它需要的任何东西 - 我可以处理它。如果需要的话,我会写一个快速的PHP脚本来分开它并按我需要的方式输出它,这不是问题。
I guess the most basic way is probably to convert the CSV data into one long JSON string that converts into an array containing one object per spell, but we're talking over 900 spells with description text and all, and I have no idea how much data like that a browser can handle...
我想最基本的方法可能是将CSV数据转换为一个长JSON字符串,该字符串转换为每个咒语包含一个对象的数组,但我们正在谈论超过900个带有描述文本和所有的法术,我不知道多少浏览器可以处理的数据......
(FYI, if by my descriptions you can guess what spell system this is, please do NOT mention it publicly - it's a personal project, not meant to be passed on or shared outside of my home network, but I still don't want any legal trouble.)
(仅供参考,如果通过我的描述你可以猜出这是什么拼写系统,请不要公开提及 - 这是一个个人项目,不是要在家庭网络之外传递或共享,但我仍然不希望任何法律问题。)
So in short, any ideas on how best to handle this and maybe a link or two with a simple tutorial on the matter would be much appreciated! I absolutely will do my own research once I have a place to start, and I promise I won't ask anyone to do my coding for me :-)
简而言之,任何关于如何最好地处理这个问题的想法,以及关于这个问题的简单教程的一两个链接都将不胜感激!一旦我有了一个可以开始的地方,我绝对会做自己的研究,我保证我不会要求任何人为我编码:-)
Thanks!
谢谢!
1 个解决方案
#1
2
Store your data in a .js object array. It should be relatively protected. Using a back end DB like SQL Server Express, SQLite, mySQL, or Oracle Express is always the way to go to store data.
将数据存储在.js对象数组中。它应该受到相对保护。使用像SQL Server Express,SQLite,mySQL或Oracle Express这样的后端数据库始终是存储数据的方法。
#1
2
Store your data in a .js object array. It should be relatively protected. Using a back end DB like SQL Server Express, SQLite, mySQL, or Oracle Express is always the way to go to store data.
将数据存储在.js对象数组中。它应该受到相对保护。使用像SQL Server Express,SQLite,mySQL或Oracle Express这样的后端数据库始终是存储数据的方法。