Compare commits

..

No commits in common. "b1d30b001093c98ee6f7e7ab687e02193578edf1" and "a1be0791a01d47cfb84adc0e18693d7ec9b3eabd" have entirely different histories.

18 changed files with 96 additions and 76306 deletions

1
.gitignore vendored
View file

@ -1,2 +1 @@
*.psd *.psd
*.pdf

View file

@ -1,12 +1,3 @@
#FateforgeTools
blabla
### Lib
- bryntum-grid
- water.css
- data localize
- jquery
## Spells ## Spells
### JSON structure ### JSON structure

File diff suppressed because it is too large Load diff

View file

@ -5,21 +5,19 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>fateforge-tools</title> <title>fateforge-tools</title>
<link rel="stylesheet" href="css/water.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
<link href="css/all.min.css" rel="stylesheet" /> <link href="css/all.min.css" rel="stylesheet" />
<link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png"> <link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png">
</head> </head>
<body> <body>
<header>
<button onclick="changeLangEN()">English</button> <button onclick="changeLangEN()">English</button>
<button onclick="changeLangFR()">French</button> <button onclick="changeLangFR()">French</button>
<a href="index.html"><h1>FateforgeTools</h1></a> <h1>FateforgeTools</h1>
<div data-localize="desc"> <div data-localize="desc">
A suite of tools for Fateforge players and Masters. A suite of tools for Fateforge players and Masters.
</div> </div>
</header>
<br> <br>
<div class="tools"> <div class="tools">
<button onclick="window.location.href='spells.html';"> <button onclick="window.location.href='spells.html';">
@ -56,10 +54,8 @@
vertical-align: text-bottom; vertical-align: text-bottom;
" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1" /></a> " src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1" /></a>
</p> </p>
<div class="CUVD"> <div class="CUVD" > <p data-localize="CUVD">CUVD
<p data-localize="CUVD">CUVD <p data-localize="link"></a></div>
<p data-localize="link"></a>
</div>
</footer> </footer>
<script type="text/javascript" src="lib/jquery.min.js"></script> <script type="text/javascript" src="lib/jquery.min.js"></script>

View file

@ -1,66 +1,29 @@
// Get the spell json based on choosen language defaultLanguage var normaliseLang;
normaliseLang = function (lang) {
lang = lang.replace(/_/, "-").toLowerCase();
if (lang.length > 3) {
lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
}
return lang;
};
var jsonsource = "".concat( $.defaultLanguage = normaliseLang(
"../data/spells/spells-grimoire-", navigator.languages && navigator.languages.length > 0
$.defaultLanguage.slice(0, 2), ? navigator.languages[0]
".json" : navigator.language || navigator.userLanguage
); );
var test; var lang = normaliseLang( $.defaultLanguage);
// Fetch data from server
fetch(jsonsource) fetch('data/spells/spells-grimoire-fr.json')
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((json) => JSON.parse(json));
// load fetched data into grid
test = data.spell;
console.log(test);
//document.getElementById("spell-list")
$("#spell-list").w2grid({
name: "Spells",
box: "#spellgrid",
show: {
header:false,
toolbar: true,
footer: false,
selectColumn: true
},
multiSelect: true,
multiSearch: true,
fixedBody: false,
records: test,
columns: [
{ field: "name", text: "Name", size: "30%",sortable: true, attr: 'align=center' },
{ field: "id", text: "ID", size: "30%" },
{ field: "email", text: "Email", size: "40%" },
{ field: "sdate", text: "Start Date", size: "120px" },
],
async onSelect(event) {
await event.complete
console.log('select', event.detail, this.getSelection())
},
onClick(event) {
let record = this.get(event.detail.name)
//grid2.clear()
/*grid2.add([
{ recid: 0, name: 'ID:', value: record.recid },
{ recid: 1, name: 'First Name:', value: record.fname },
{ recid: 2, name: 'Last Name:', value: record.lname },
{ recid: 3, name: 'Email:', value: record.email },
{ recid: 4, name: 'Date:', value: record.sdate }
])*/
console.log(record)
}
});
});
window.multi = function(el) { var string jsonsource = ''.concat("../data/spells/spells-grimoire-",navigator.languages[0].slice(0,2),".json");
grid.multiSelect = el.checked
grid.selectNone()
grid.refresh()
}
window.selColumn = function(flag) { import data from jsonsource assert { type: 'json' };
grid.show.selectColumn = flag console.log(data);
grid.refresh()
} var yourHtml = JSON;
document.getElementById("spell-list").innerHTML = yourHtml;

View file

@ -1,3 +1,4 @@
/* /*
Copyright (c) Jim Garvin (http://github.com/coderifous), 2008. Copyright (c) Jim Garvin (http://github.com/coderifous), 2008.
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
@ -9,36 +10,15 @@ http://keith-wood.name/localisation.html
(function($) { (function($) {
var normaliseLang; var normaliseLang;
normaliseLang = function(lang) { normaliseLang = function(lang) {
lang = lang.replace(/_/, "-").toLowerCase(); lang = lang.replace(/_/, '-').toLowerCase();
if (lang.length > 3) { if (lang.length > 3) {
lang = lang.substring(0, 3) + lang.substring(3).toUpperCase(); lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
} }
return lang; return lang;
}; };
$.defaultLanguage = normaliseLang( $.defaultLanguage = normaliseLang(navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] : navigator.language || navigator.userLanguage);
navigator.languages && navigator.languages.length > 0
? navigator.languages[0]
: navigator.language || navigator.userLanguage
);
$.localize = function(pkg, options) { $.localize = function(pkg, options) {
var defaultCallback, var defaultCallback, deferred, fileExtension, intermediateLangData, jsonCall, lang, loadLanguage, localizeElement, localizeForSpecialKeys, localizeImageElement, localizeInputElement, localizeOptgroupElement, notifyDelegateLanguageLoaded, regexify, setAttrFromValueForKey, setTextFromValueForKey, valueForKey, wrappedSet;
deferred,
fileExtension,
intermediateLangData,
jsonCall,
lang,
loadLanguage,
localizeElement,
localizeForSpecialKeys,
localizeImageElement,
localizeInputElement,
localizeOptgroupElement,
notifyDelegateLanguageLoaded,
regexify,
setAttrFromValueForKey,
setTextFromValueForKey,
valueForKey,
wrappedSet;
if (options == null) { if (options == null) {
options = {}; options = {};
} }
@ -62,16 +42,10 @@ http://keith-wood.name/localisation.html
} }
break; break;
case 2: case 2:
file = "" + pkg + "-" + lang.split("-")[0] + "." + fileExtension; file = "" + pkg + "-" + (lang.split('-')[0]) + "." + fileExtension;
return jsonCall(file, pkg, lang, level); return jsonCall(file, pkg, lang, level);
case 3: case 3:
file = file = "" + pkg + "-" + (lang.split('-').slice(0, 2).join('-')) + "." + fileExtension;
"" +
pkg +
"-" +
lang.split("-").slice(0, 2).join("-") +
"." +
fileExtension;
return jsonCall(file, pkg, lang, level); return jsonCall(file, pkg, lang, level);
default: default:
return deferred.resolve(); return deferred.resolve();
@ -88,7 +62,7 @@ http://keith-wood.name/localisation.html
return loadLanguage(pkg, lang, level + 1); return loadLanguage(pkg, lang, level + 1);
}; };
errorFunc = function() { errorFunc = function() {
if (level === 2 && lang.indexOf("-") > -1) { if (level === 2 && lang.indexOf('-') > -1) {
return loadLanguage(pkg, lang, level + 1); return loadLanguage(pkg, lang, level + 1);
} else if (options.fallback && options.fallback !== lang) { } else if (options.fallback && options.fallback !== lang) {
return loadLanguage(pkg, options.fallback); return loadLanguage(pkg, options.fallback);
@ -100,7 +74,7 @@ http://keith-wood.name/localisation.html
async: true, async: true,
timeout: options.timeout != null ? options.timeout : 500, timeout: options.timeout != null ? options.timeout : 500,
success: successFunc, success: successFunc,
error: errorFunc, error: errorFunc
}; };
if (window.location.protocol === "file:") { if (window.location.protocol === "file:") {
ajaxOptions.error = function(xhr) { ajaxOptions.error = function(xhr) {
@ -130,13 +104,13 @@ http://keith-wood.name/localisation.html
}); });
}; };
localizeElement = function(elem, key, value) { localizeElement = function(elem, key, value) {
if (elem.is("input")) { if (elem.is('input')) {
localizeInputElement(elem, key, value); localizeInputElement(elem, key, value);
} else if (elem.is("textarea")) { } else if (elem.is('textarea')) {
localizeInputElement(elem, key, value); localizeInputElement(elem, key, value);
} else if (elem.is("img")) { } else if (elem.is('img')) {
localizeImageElement(elem, key, value); localizeImageElement(elem, key, value);
} else if (elem.is("optgroup")) { } else if (elem.is('optgroup')) {
localizeOptgroupElement(elem, key, value); localizeOptgroupElement(elem, key, value);
} else if (!$.isPlainObject(value)) { } else if (!$.isPlainObject(value)) {
elem.html(value); elem.html(value);
@ -193,26 +167,20 @@ http://keith-wood.name/localisation.html
if (typeof string_or_regex_or_array === "string") { if (typeof string_or_regex_or_array === "string") {
return "^" + string_or_regex_or_array + "$"; return "^" + string_or_regex_or_array + "$";
} else if (string_or_regex_or_array.length != null) { } else if (string_or_regex_or_array.length != null) {
return (function () { return ((function() {
var _i, _len, _results; var _i, _len, _results;
_results = []; _results = [];
for ( for (_i = 0, _len = string_or_regex_or_array.length; _i < _len; _i++) {
_i = 0, _len = string_or_regex_or_array.length;
_i < _len;
_i++
) {
thing = string_or_regex_or_array[_i]; thing = string_or_regex_or_array[_i];
_results.push(regexify(thing)); _results.push(regexify(thing));
} }
return _results; return _results;
})().join("|"); })()).join("|");
} else { } else {
return string_or_regex_or_array; return string_or_regex_or_array;
} }
}; };
lang = normaliseLang( lang = normaliseLang(options.language ? options.language : $.defaultLanguage);
options.language ? options.language : $.defaultLanguage
);
if (options.skipLanguage && lang.match(regexify(options.skipLanguage))) { if (options.skipLanguage && lang.match(regexify(options.skipLanguage))) {
deferred.resolve(); deferred.resolve();
} else { } else {
@ -222,5 +190,5 @@ http://keith-wood.name/localisation.html
return wrappedSet; return wrappedSet;
}; };
$.fn.localize = $.localize; $.fn.localize = $.localize;
return ($.localize.data = {}); return $.localize.data = {};
})(jQuery); })(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

486
lib/w2ui/w2ui.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -5,67 +5,52 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>fateforge-tools</title> <title>fateforge-tools</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
<link href="css/all.min.css" rel="stylesheet" /> <link href="css/all.min.css" rel="stylesheet" />
<link href="css/water.css" rel="stylesheet" />
<link type="text/css" rel="stylesheet" href="lib/w2ui/w2ui.css" />
<link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png"> <link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png">
</head> </head>
<body> <body>
<header>
<button onclick="changeLangEN()">English</button> <button onclick="changeLangEN()">English</button>
<button onclick="changeLangFR()">French</button> <button onclick="changeLangFR()">French</button>
<a href="index.html">
<h1>FateforgeTools</h1> <h1>FateforgeTools</h1>
</a>
</header>
<h2 data-localize="btn-spells">Spells</h2> <h2 data-localize="btn-spells">Spells</h2>
<!--<div class="container" style="display: flex;flex-direction: row;flex-wrap: wrap;">--> <div class="container" style="display: flex;">
<div id="container" style="width: 100%; "> <div class="view-col" id="list">
<div style="display: flex; flex-direction: row;flex-wrap: wrap;"> <div id="sublistcontainer" class="sublist sublist--resizable">
<div id="spell-list" style="min-width: 300px;max-width:900px;height: 300px;""> <div id="sublistsort" class="btn-group">
<!-- FILL WITH JS--> <button class="btn-xs" data-sort="name" data-localize="spell-name">Name</button>
<button class="btn-xs" data-sort="level" data-localize="spell-level">Level</button>
<button class="btn-xs" data-sort="time" data-localize="spell-time">Time</button>
<button class="btn-xs" data-sort="school" data-localize="spell-school">School</button>
<button class="btn-xs" data-sort="concentration" title="Concentration" data-localize="spell-concentration">C.</button>
<button class="btn-xs" data-sort="range">Range</button>
</div>
<div id="spell-list" class="list subspells">
<!-- populate with JS -->
</div>
</div> </div>
<div class="view-col" id="content">
<table id="pagecontent" class="w-100 stats">
<tr><th class="border" colspan="6"></th></tr>
<tr><td colspan="6" class="initial-message">Select a spell from the list to view it here</td></tr>
<tr><th class="border" colspan="6"></th></tr>
<div class=" view-col" id="content" style="min-width: 400px;">
<table id="pagecontent" class="view" style="display: flex; border:solid">
<td class="initial-message">Select a spell from the list to view it here</td>
</table> </table>
</div> </div>
</div>
</div> </div>
<script type="text/javascript" src="lib/jquery.min.js"></script> <script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="lib/jquery.localize-dev.js"></script> <script type="text/javascript" src="lib/jquery.localize-dev.js"></script>
<script type="text/javascript" src="js/language.js"></script> <script type="text/javascript" src="js/language.js"></script>
<script type="text/javascript" src="lib/w2ui/w2ui.js"></script>
<script type="module" src="js/spells.js"></script> <script type="module" src="js/spells.js"></script>
<script src="https://kit.fontawesome.com/126cdd0e29.js" crossorigin="anonymous"></script> <script src="https://kit.fontawesome.com/126cdd0e29.js" crossorigin="anonymous"></script>
</body> </body>