|
1 | 1 | # GBF Miza's Library
|
2 |
| -Collection of common Assets, Javascript and CSS files to be used by my [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) and [GBF Animation Player](https://github.com/MizaGBF/GBFAP) projects. |
| 2 | +Collection of common Assets, Javascript and CSS files to be used by my [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) and [GBF Animation Player](https://github.com/MizaGBF/GBFAP) projects to build their HTML pages. |
| 3 | +It's intended to be in a folder alongside the other projects: |
| 4 | +``` |
| 5 | +Root Folder/ |
| 6 | +├── GBFAL/ |
| 7 | +├── GBFML/ |
| 8 | +└── GBFAP/ |
| 9 | +``` |
3 | 10 |
|
4 |
| -Documentation will be added at a later date. |
| 11 | +All lists further below are non-exhaustive. |
| 12 | + |
| 13 | +## Style Files |
| 14 | + |
| 15 | +### style.css |
| 16 | +The main CSS file, used for the [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) main page. |
| 17 | + |
| 18 | +## Javascript Files |
| 19 | + |
| 20 | +### gbf.js |
| 21 | +Standalone. |
| 22 | +Contains a class to handle types and corresponding index keys, along with returning endpoints for assets. |
| 23 | +Intended to be instantiated once in a global `gbf` variable upon initialization. |
| 24 | + |
| 25 | +### page.js |
| 26 | +Requires `gbf.js` and `util.js`. |
| 27 | +Used to build [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) and [GBF Animation Player](https://github.com/MizaGBF/GBFAP) pages, such as building the indexes or listing elements. |
| 28 | +Expect an `index` global variable to exist following the [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) format. |
| 29 | +[GBF Animation Player](https://github.com/MizaGBF/GBFAP) [overrides some functions](https://github.com/MizaGBF/GBFAP/blob/main/js/page_override.js) to bypass the format differences. |
| 30 | + |
| 31 | +List of callbacks: |
| 32 | +- `get_special_navigation_indexes(element_id, index_category_target, index_of_current_element_in_list, list_of_elements)`: Used for special "previous/next" navigation buttons, if you wish to "skip" along some elements in the list. |
| 33 | +- `index_onclick`: The onclick callback for elements generated by `list_elements`. |
| 34 | +- `bookmark_onclick`: The onclick callback for elements generated by `list_elements` for the bookmark list. |
| 35 | +- `history_onclick`: The onclick callback for elements generated by `list_elements` for the history list. |
| 36 | + |
| 37 | +### search.js |
| 38 | +Requires `page.js` and `util.js` (if a result area to populate is passed). |
| 39 | +Contains a class to generate search results. |
| 40 | +Intended to be instantiated once in a global `search` variable upon initialization. |
| 41 | +Expect an [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) or [GBF Animation Player](https://github.com/MizaGBF/GBFAP) `index` variable to exist with the `lookup` key to be set, containing an object of ID and lookup string pairs. |
| 42 | + |
| 43 | +List of callbacks: |
| 44 | +- `index_onclick`: The onclick callback for elements generated by `list_elements` for the populated result area. |
| 45 | +- `lookup(element_id)`: The function to call if `allow_lookup` is set. |
| 46 | + |
| 47 | +### util.js |
| 48 | +Standalone. |
| 49 | +Contains utility functions. |
| 50 | + |
| 51 | +## JSON |
| 52 | + |
| 53 | +### config.json |
| 54 | +`config.json` must be loaded and passed to some functions at the start to initialize the index or set specific settings. |
| 55 | +Here's a list of some of them: |
| 56 | +- `help_form` (Optional String), url to the Google Form. |
| 57 | +- `index` (Object), the index layout. |
| 58 | + |
| 59 | +## Variables |
| 60 | +Some variables might require to be defined to be used for some features: |
| 61 | +- `timestamp` (Integer), for `clock()`. |
| 62 | +- `index` (Object), ideally in the [GBF Asset Lookup](https://github.com/MizaGBF/GBFAL) format, for most of the project. |
| 63 | +- `bookmark_key` (String), the localStorage key to save the bookmarks. |
| 64 | +- `history_key` (String), the localStorage key to save the history. |
| 65 | +- `search_save_key` (String), the localStorage key to save the search settings. |
0 commit comments